@finda-co/novu-framework
Version:
The Code-First Notifications Workflow SDK.
2 lines (1 loc) • 20.7 kB
JavaScript
;var R=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var Ie=Object.prototype.hasOwnProperty;var Pe=(s,n)=>{for(var i in n)R(s,i,{get:n[i],enumerable:!0})},Ee=(s,n,i,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of xe(n))!Ie.call(s,a)&&a!==i&&R(s,a,{get:()=>n[a],enumerable:!(o=ve(n,a))||o.enumerable});return s};var Ne=s=>Ee(R({},"__esModule",{value:!0}),s);var Ke={};Pe(Ke,{ActionStepEnum:()=>Se,BadRequestError:()=>p,BridgeError:()=>E,ChannelStepEnum:()=>we,ConflictError:()=>O,CronExpression:()=>be,ErrorCodeEnum:()=>c,ExecutionEventControlsInvalidError:()=>D,ExecutionEventPayloadInvalidError:()=>C,ExecutionProviderOutputInvalidError:()=>F,ExecutionStateControlsInvalidError:()=>k,ExecutionStateCorruptError:()=>N,ExecutionStateOutputInvalidError:()=>M,ExecutionStateResultInvalidError:()=>U,ForbiddenError:()=>P,FrameworkError:()=>h,GetActionEnum:()=>ge,HttpHeaderKeysEnum:()=>I,HttpMethodEnum:()=>A,HttpQueryKeysEnum:()=>Te,HttpStatusEnum:()=>T,InvalidActionError:()=>W,JobStatusEnum:()=>Re,MethodNotAllowedError:()=>V,MissingSecretKeyError:()=>q,NotFoundError:()=>S,NovuApiEndpointsEnum:()=>fe,PlatformError:()=>G,PostActionEnum:()=>ye,ProviderExecutionFailedError:()=>B,ProviderNotFoundError:()=>J,ResourceConflictError:()=>f,ResourceEnum:()=>w,ResourceExecutionFailed:()=>b,ResourceNotFoundError:()=>y,SIGNATURE_TIMESTAMP_TOLERANCE:()=>$e,SIGNATURE_TIMESTAMP_TOLERANCE_MINUTES:()=>x,ServerError:()=>g,SignatureExpiredError:()=>K,SignatureInvalidError:()=>$,SignatureMismatchError:()=>z,SignatureNotFoundError:()=>X,SignatureVersionInvalidError:()=>H,SigningKeyNotFoundError:()=>Q,StepAlreadyExistsError:()=>ee,StepControlCompilationFailedError:()=>L,StepExecutionFailedError:()=>te,StepNotFoundError:()=>Z,UnauthorizedError:()=>u,WorkflowAlreadyExistsError:()=>ne,WorkflowChannelEnum:()=>Oe,WorkflowNotFoundError:()=>ie,WorkflowPayloadInvalidError:()=>Y,actionStepSchemas:()=>re,channelStepSchemas:()=>me,isFrameworkError:()=>_e,isNativeError:()=>Ae});module.exports=Ne(Ke);var Ce={type:"object",properties:{type:{enum:["regular"],default:"regular"},amount:{type:"number"},unit:{type:"string",enum:["seconds","minutes","hours","days","weeks","months"]}},required:["amount","unit"],additionalProperties:!1},De={type:"object",properties:{duration:{type:"number"}},required:["duration"],additionalProperties:!1},oe={output:Ce,result:De};var ke={type:"object",properties:{amount:{type:"number"},unit:{type:"string",enum:["seconds","minutes","hours","days","weeks","months"]},digestKey:{type:"string"},lookBackWindow:{type:"object",properties:{amount:{type:"number"},unit:{type:"string",enum:["seconds","minutes","hours","days","weeks","months"]}},required:["amount","unit"],additionalProperties:!1}},required:["amount","unit"],additionalProperties:!1},Me={type:"object",properties:{cron:{type:"string"},digestKey:{type:"string"}},required:["cron"],additionalProperties:!1},Ue={oneOf:[ke,Me]},Le={type:"object",properties:{events:{type:"array",items:{type:"object",properties:{id:{type:"string"},time:{type:"string"},payload:{type:"object"}},required:["id","time","payload"],additionalProperties:!1}}},required:["events"],additionalProperties:!1},se={output:Ue,result:Le};var re={delay:oe,digest:se};var Fe={type:"object",properties:{body:{type:"string"}},required:["body"],additionalProperties:!1},Ye={type:"object",properties:{},required:[],additionalProperties:!1},ae={output:Fe,result:Ye};var je={type:"object",properties:{subject:{type:"string"},body:{type:"string"}},required:["subject","body"],additionalProperties:!1},Ve={type:"object",properties:{},required:[],additionalProperties:!1},pe={output:je,result:Ve};var We="^(?!mailto:)(?:(https?):\\/\\/[^\\s/$.?#].[^\\s]*)|^(\\/[^\\s]*)$",ce={type:"object",properties:{url:{type:"string",pattern:We},target:{type:"string",enum:["_self","_blank","_parent","_top","_unfencedTop"],default:"_blank"}},if:{properties:{url:{type:"string",pattern:"^/"}}},then:{properties:{target:{default:"_self"}}},else:{properties:{target:{default:"_blank"}}},required:["url"],additionalProperties:!1},le={type:"object",properties:{label:{type:"string"},redirect:ce},required:["label"],additionalProperties:!1},qe={type:"object",properties:{subject:{type:"string"},body:{type:"string"},avatar:{type:"string",format:"uri"},primaryAction:le,secondaryAction:le,data:{type:"object",additionalProperties:!0},redirect:ce},required:["body"],additionalProperties:!1},Ge={type:"object",properties:{seen:{type:"boolean"},read:{type:"boolean"},lastSeenDate:{type:"string",format:"date-time",nullable:!0},lastReadDate:{type:"string",format:"date-time",nullable:!0}},required:["seen","read","lastSeenDate","lastReadDate"],additionalProperties:!1},de={output:qe,result:Ge};var Je={type:"object",properties:{subject:{type:"string"},body:{type:"string"}},required:["subject","body"],additionalProperties:!1},Be={type:"object",properties:{},required:[],additionalProperties:!1},he={output:Je,result:Be};var ze={type:"object",properties:{body:{type:"string"}},required:["body"],additionalProperties:!1},Xe={type:"object",properties:{},required:[],additionalProperties:!1},ue={output:ze,result:Xe};var me={chat:ae,sms:ue,push:he,email:pe,in_app:de};var ye=(o=>(o.TRIGGER="trigger",o.EXECUTE="execute",o.PREVIEW="preview",o))(ye||{}),ge=(o=>(o.DISCOVER="discover",o.HEALTH_CHECK="health-check",o.CODE="code",o))(ge||{});var fe=(i=>(i.SYNC="/v1/bridge/sync",i.DIFF="/v1/bridge/diff",i))(fe||{}),x=5,$e=1500;var be=(t=>(t.EVERY_SECOND="* * * * * *",t.EVERY_5_SECONDS="*/5 * * * * *",t.EVERY_10_SECONDS="*/10 * * * * *",t.EVERY_30_SECONDS="*/30 * * * * *",t.EVERY_MINUTE="*/1 * * * *",t.EVERY_5_MINUTES="0 */5 * * * *",t.EVERY_10_MINUTES="0 */10 * * * *",t.EVERY_30_MINUTES="0 */30 * * * *",t.EVERY_HOUR="0 0-23/1 * * *",t.EVERY_2_HOURS="0 0-23/2 * * *",t.EVERY_3_HOURS="0 0-23/3 * * *",t.EVERY_4_HOURS="0 0-23/4 * * *",t.EVERY_5_HOURS="0 0-23/5 * * *",t.EVERY_6_HOURS="0 0-23/6 * * *",t.EVERY_7_HOURS="0 0-23/7 * * *",t.EVERY_8_HOURS="0 0-23/8 * * *",t.EVERY_9_HOURS="0 0-23/9 * * *",t.EVERY_10_HOURS="0 0-23/10 * * *",t.EVERY_11_HOURS="0 0-23/11 * * *",t.EVERY_12_HOURS="0 0-23/12 * * *",t.EVERY_DAY_AT_1AM="0 01 * * *",t.EVERY_DAY_AT_2AM="0 02 * * *",t.EVERY_DAY_AT_3AM="0 03 * * *",t.EVERY_DAY_AT_4AM="0 04 * * *",t.EVERY_DAY_AT_5AM="0 05 * * *",t.EVERY_DAY_AT_6AM="0 06 * * *",t.EVERY_DAY_AT_7AM="0 07 * * *",t.EVERY_DAY_AT_8AM="0 08 * * *",t.EVERY_DAY_AT_9AM="0 09 * * *",t.EVERY_DAY_AT_10AM="0 10 * * *",t.EVERY_DAY_AT_11AM="0 11 * * *",t.EVERY_DAY_AT_NOON="0 12 * * *",t.EVERY_DAY_AT_1PM="0 13 * * *",t.EVERY_DAY_AT_2PM="0 14 * * *",t.EVERY_DAY_AT_3PM="0 15 * * *",t.EVERY_DAY_AT_4PM="0 16 * * *",t.EVERY_DAY_AT_5PM="0 17 * * *",t.EVERY_DAY_AT_6PM="0 18 * * *",t.EVERY_DAY_AT_7PM="0 19 * * *",t.EVERY_DAY_AT_8PM="0 20 * * *",t.EVERY_DAY_AT_9PM="0 21 * * *",t.EVERY_DAY_AT_10PM="0 22 * * *",t.EVERY_DAY_AT_11PM="0 23 * * *",t.EVERY_DAY_AT_MIDNIGHT="0 0 * * *",t.EVERY_WEEK="0 0 * * 0",t.EVERY_WEEKDAY="0 0 * * 1-5",t.EVERY_WEEKEND="0 0 * * 6,0",t.EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT="0 0 1 * *",t.EVERY_1ST_DAY_OF_MONTH_AT_NOON="0 12 1 * *",t.EVERY_2ND_HOUR="0 */2 * * *",t.EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM="0 1-23/2 * * *",t.EVERY_2ND_MONTH="0 0 1 */2 *",t.EVERY_QUARTER="0 0 1 */3 *",t.EVERY_6_MONTHS="0 0 1 */6 *",t.EVERY_YEAR="0 0 1 0 *",t.EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM="0 */30 9-17 * * *",t.EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM="0 */30 9-18 * * *",t.EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM="0 */30 10-19 * * *",t.MONDAY_TO_FRIDAY_AT_1AM="0 0 01 * * 1-5",t.MONDAY_TO_FRIDAY_AT_2AM="0 0 02 * * 1-5",t.MONDAY_TO_FRIDAY_AT_3AM="0 0 03 * * 1-5",t.MONDAY_TO_FRIDAY_AT_4AM="0 0 04 * * 1-5",t.MONDAY_TO_FRIDAY_AT_5AM="0 0 05 * * 1-5",t.MONDAY_TO_FRIDAY_AT_6AM="0 0 06 * * 1-5",t.MONDAY_TO_FRIDAY_AT_7AM="0 0 07 * * 1-5",t.MONDAY_TO_FRIDAY_AT_8AM="0 0 08 * * 1-5",t.MONDAY_TO_FRIDAY_AT_9AM="0 0 09 * * 1-5",t.MONDAY_TO_FRIDAY_AT_09_30AM="0 30 09 * * 1-5",t.MONDAY_TO_FRIDAY_AT_10AM="0 0 10 * * 1-5",t.MONDAY_TO_FRIDAY_AT_11AM="0 0 11 * * 1-5",t.MONDAY_TO_FRIDAY_AT_11_30AM="0 30 11 * * 1-5",t.MONDAY_TO_FRIDAY_AT_12PM="0 0 12 * * 1-5",t.MONDAY_TO_FRIDAY_AT_1PM="0 0 13 * * 1-5",t.MONDAY_TO_FRIDAY_AT_2PM="0 0 14 * * 1-5",t.MONDAY_TO_FRIDAY_AT_3PM="0 0 15 * * 1-5",t.MONDAY_TO_FRIDAY_AT_4PM="0 0 16 * * 1-5",t.MONDAY_TO_FRIDAY_AT_5PM="0 0 17 * * 1-5",t.MONDAY_TO_FRIDAY_AT_6PM="0 0 18 * * 1-5",t.MONDAY_TO_FRIDAY_AT_7PM="0 0 19 * * 1-5",t.MONDAY_TO_FRIDAY_AT_8PM="0 0 20 * * 1-5",t.MONDAY_TO_FRIDAY_AT_9PM="0 0 21 * * 1-5",t.MONDAY_TO_FRIDAY_AT_10PM="0 0 22 * * 1-5",t.MONDAY_TO_FRIDAY_AT_11PM="0 0 23 * * 1-5",t))(be||{});var c=(r=>(r.BRIDGE_ERROR="BridgeError",r.EXECUTION_EVENT_CONTROL_INVALID_ERROR="ExecutionEventControlInvalidError",r.EXECUTION_EVENT_PAYLOAD_INVALID_ERROR="ExecutionEventPayloadInvalidError",r.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",r.EXECUTION_STATE_CONTROL_INVALID_ERROR="ExecutionStateControlInvalidError",r.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",r.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",r.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",r.INVALID_ACTION_ERROR="InvalidActionError",r.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",r.MISSING_DEPENDENCY_ERROR="MissingDependencyError",r.MISSING_SECRET_KEY_ERROR="MissingSecretKeyError",r.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",r.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",r.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",r.SIGNATURE_INVALID_ERROR="SignatureInvalidError",r.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",r.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",r.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",r.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",r.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",r.STEP_CONTROL_COMPILATION_FAILED_ERROR="StepControlCompilationFailedError",r.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",r.STEP_NOT_FOUND_ERROR="StepNotFoundError",r.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",r.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",r.WORKFLOW_PAYLOAD_INVALID_ERROR="WorkflowPayloadInvalidError",r))(c||{});var I=(d=>(d.NOVU_SIGNATURE="novu-signature",d.NOVU_ANONYMOUS="novu-anonymous",d.NOVU_FRAMEWORK_SDK="novu-framework-sdk",d.NOVU_FRAMEWORK_SERVER="novu-framework-server",d.NOVU_FRAMEWORK_VERSION="novu-framework-version",d.USER_AGENT="user-agent",d.CONTENT_TYPE="content-type",d.ACCESS_CONTROL_ALLOW_ORIGIN="access-control-allow-origin",d.ACCESS_CONTROL_ALLOW_METHODS="access-control-allow-methods",d.ACCESS_CONTROL_ALLOW_HEADERS="access-control-allow-headers",d.ACCESS_CONTROL_MAX_AGE="access-control-max-age",d))(I||{});var A=(o=>(o.POST="POST",o.GET="GET",o.OPTIONS="OPTIONS",o))(A||{});var Te=(a=>(a.WORKFLOW_ID="workflowId",a.STEP_ID="stepId",a.ACTION="action",a.SOURCE="source",a))(Te||{});var T=(e=>(e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLYHINTS=103]="EARLYHINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.AMBIGUOUS=300]="AMBIGUOUS",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.FOUND=302]="FOUND",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",e[e.URI_TOO_LONG=414]="URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",e[e.MISDIRECTED=421]="MISDIRECTED",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e))(T||{});var w=(o=>(o.WORKFLOW="workflow",o.PROVIDER="provider",o.STEP="step",o))(w||{});var we=(l=>(l.EMAIL="email",l.SMS="sms",l.PUSH="push",l.CHAT="chat",l.IN_APP="in_app",l))(we||{}),Se=(o=>(o.DIGEST="digest",o.DELAY="delay",o.CUSTOM="custom",o))(Se||{});var Oe=(l=>(l.EMAIL="email",l.SMS="sms",l.PUSH="push",l.CHAT="chat",l.IN_APP="inApp",l))(Oe||{});var Ae=s=>{var i,o;if(typeof s!="object"||s===null)return!1;let n=Object.getPrototypeOf(s);return(o=(i=n==null?void 0:n.constructor)==null?void 0:i.name.endsWith("Error"))!=null?o:!1},h=class extends Error{},S=class extends h{constructor(){super(...arguments);this.statusCode=404}},p=class extends h{constructor(){super(...arguments);this.statusCode=400}},u=class extends h{constructor(){super(...arguments);this.statusCode=401}},g=class extends h{constructor(n,{cause:i}={}){var o;Ae(i)?(super(`${n}: ${i.message}`),this.data={stack:(o=i.stack)!=null?o:n}):(super(`${n}${i?`: ${JSON.stringify(i,null,2)}`:""}`),this.data={stack:n})}},O=class extends h{constructor(){super(...arguments);this.statusCode=409}},P=class extends h{constructor(){super(...arguments);this.statusCode=403}};var E=class extends g{constructor(i){super("Unknown BridgeError",{cause:i});this.statusCode=500;this.code="BridgeError"}};var N=class extends p{constructor(i,o){super(`Workflow with id: \`${i}\` has a corrupt state. Step with id: \`${o}\` does not exist. Please provide the missing state.`);this.code="ExecutionStateCorruptError";this.data={workflowId:i,stepId:o}}},C=class extends p{constructor(i,o){super(`Workflow with id: \`${i}\` has invalid \`payload\`. Please provide the correct event payload.`);this.code="ExecutionEventPayloadInvalidError";this.data=o}},D=class extends p{constructor(i,o){super(`Workflow with id: \`${i}\` has invalid \`controls\`. Please provide the correct event controls.`);this.code="ExecutionEventControlInvalidError";this.data=o}},k=class extends p{constructor(i,o,a){super(`Workflow with id: \`${i}\` has an invalid state. Step with id: \`${o}\` has invalid \`controls\`. Please provide the correct step controls.`);this.code="ExecutionStateControlInvalidError";this.data=a}},M=class extends p{constructor(i,o,a){super(`Workflow with id: \`${i}\` has an invalid state. Step with id: \`${o}\` has invalid output. Please provide the correct step output.`);this.code="ExecutionStateOutputInvalidError";this.data=a}},U=class extends p{constructor(i,o,a){super(`Workflow with id: \`${i}\` has an invalid state. Step with id: \`${o}\` has invalid result. Please provide the correct step result.`);this.code="ExecutionStateResultInvalidError";this.data=a}},L=class extends p{constructor(i,o,a){super(`Workflow with id: \`${i}\` has invalid controls syntax in step with id: \`${o}\`. Please correct step control syntax.`);this.code="StepControlCompilationFailedError";this.data=a}},F=class extends p{constructor(i,o,a,l){super(`Workflow with id: \`${i}\` has an invalid state. Step with id: \`${o}\` and provider with id: \`${a}\` has invalid output. Please provide the correct provider output.`);this.code="ExecutionProviderOutputInvalidError";this.data=l}},Y=class extends p{constructor(i,o){super(`Workflow with id: \`${i}\` has invalid \`payload\`. Please provide the correct payload.`);this.code="WorkflowPayloadInvalidError";this.data=o}};var j=s=>Object.values(s).map(n=>`\`${n}\``).join(", "),_=s=>s.replaceAll(/(\w)(\w*)/g,(n,i,o)=>i.toUpperCase()+o.toLowerCase()).replaceAll(/[\s-]+/g,"");var V=class extends h{constructor(){super(...arguments);this.code="MethodNotAllowedError";this.statusCode=405;this.message=`Method not allowed. Please use one of ${j(A)}`}},W=class extends p{constructor(i,o){super(`Invalid query string: \`action\`=\`${i}\`. Please use one of ${j(o)}`);this.code="InvalidActionError"}},q=class extends p{constructor(){super("Missing secret key. Set the `NOVU_SECRET_KEY` environment variable or pass `secretKey` to the client options.");this.code="MissingSecretKeyError"}};var G=class extends Error{constructor(n,i,o){super(),this.data={message:o},this.statusCode=n,this.code=i}};var f=class extends O{constructor(n,i){super(`${_(n)} with id: \`${i}\` already exists. Please use a different id.`)}},y=class extends S{constructor(n,i){super(`${_(n)} with id: \`${i}\` does not exist. Please provide a valid id.`)}},b=class extends g{constructor(i,o,a,l){super(`Failed to ${a} ${_(i)} with id: \`${o}\``,{cause:l});this.statusCode=502}};var J=class extends y{constructor(i){super("provider",i);this.code="ProviderNotFoundError"}},B=class extends b{constructor(i,o,a){super("provider",i,o,a);this.code="ProviderExecutionFailedError"}};var z=class extends u{constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `novu-signature` header is correct and try again.");this.code="SignatureMismatchError"}},X=class extends u{constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");this.code="SignatureNotFoundError"}},$=class extends u{constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");this.code="SignatureInvalidError"}},K=class extends u{constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);this.code="SignatureExpiredError"}},Q=class extends u{constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");this.code="SigningKeyNotFoundError"}},H=class extends u{constructor(){super("Signature version is invalid. Please provide a signature version with version `v1` in the `novu-signature` header");this.code="SignatureVersionInvalidError"}};var Z=class extends y{constructor(i){super("step",i);this.code="StepNotFoundError"}},ee=class extends f{constructor(i){super("step",i);this.code="StepAlreadyExistsError"}},te=class extends b{constructor(i,o,a){super("step",i,o,a);this.code="StepExecutionFailedError"}};var ie=class extends y{constructor(i){super("workflow",i);this.code="WorkflowNotFoundError"}},ne=class extends f{constructor(i){super("workflow",i);this.code="WorkflowAlreadyExistsError"}};var _e=s=>Object.values(c).includes(s==null?void 0:s.code);var Re=(m=>(m.PENDING="pending",m.QUEUED="queued",m.RUNNING="running",m.COMPLETED="completed",m.FAILED="failed",m.DELAYED="delayed",m.CANCELED="canceled",m.MERGED="merged",m.SKIPPED="skipped",m))(Re||{});0&&(module.exports={ActionStepEnum,BadRequestError,BridgeError,ChannelStepEnum,ConflictError,CronExpression,ErrorCodeEnum,ExecutionEventControlsInvalidError,ExecutionEventPayloadInvalidError,ExecutionProviderOutputInvalidError,ExecutionStateControlsInvalidError,ExecutionStateCorruptError,ExecutionStateOutputInvalidError,ExecutionStateResultInvalidError,ForbiddenError,FrameworkError,GetActionEnum,HttpHeaderKeysEnum,HttpMethodEnum,HttpQueryKeysEnum,HttpStatusEnum,InvalidActionError,JobStatusEnum,MethodNotAllowedError,MissingSecretKeyError,NotFoundError,NovuApiEndpointsEnum,PlatformError,PostActionEnum,ProviderExecutionFailedError,ProviderNotFoundError,ResourceConflictError,ResourceEnum,ResourceExecutionFailed,ResourceNotFoundError,SIGNATURE_TIMESTAMP_TOLERANCE,SIGNATURE_TIMESTAMP_TOLERANCE_MINUTES,ServerError,SignatureExpiredError,SignatureInvalidError,SignatureMismatchError,SignatureNotFoundError,SignatureVersionInvalidError,SigningKeyNotFoundError,StepAlreadyExistsError,StepControlCompilationFailedError,StepExecutionFailedError,StepNotFoundError,UnauthorizedError,WorkflowAlreadyExistsError,WorkflowChannelEnum,WorkflowNotFoundError,WorkflowPayloadInvalidError,actionStepSchemas,channelStepSchemas,isFrameworkError,isNativeError});