@novu/framework 2.0.3 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{handler-WKKD7ESp.d.ts → handler-_mH7Q42O.d.ts} +2751 -2650
- package/dist/index.d.ts +2 -2
- package/dist/index.js +38 -36
- package/dist/servers/express.d.ts +1 -1
- package/dist/servers/express.js +2 -2
- package/dist/servers/h3.d.ts +1 -1
- package/dist/servers/h3.js +1 -1
- package/dist/servers/lambda.d.ts +1 -1
- package/dist/servers/lambda.js +3 -3
- package/dist/servers/next.d.ts +1 -1
- package/dist/servers/next.js +1 -1
- package/dist/servers/nuxt.d.ts +4 -2
- package/dist/servers/nuxt.js +1 -1
- package/dist/servers/remix.d.ts +3 -3
- package/dist/servers/remix.js +1 -1
- package/dist/servers/sveltekit.d.ts +1 -1
- package/dist/servers/sveltekit.js +1 -1
- package/package.json +7 -4
package/dist/servers/remix.js
CHANGED
|
@@ -20,7 +20,7 @@ var we__default = /*#__PURE__*/_interopDefault(we);
|
|
|
20
20
|
var Ve__default = /*#__PURE__*/_interopDefault(Ve);
|
|
21
21
|
var Ye__default = /*#__PURE__*/_interopDefault(Ye);
|
|
22
22
|
|
|
23
|
-
var D=(r=>(r.TRIGGER="trigger",r.EXECUTE="execute",r.PREVIEW="preview",r))(D||{}),V=(r=>(r.DISCOVER="discover",r.HEALTH_CHECK="health-check",r.CODE="code",r))(V||{});var u=(n=>(n.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",n.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",n.WORKFLOW_EXECUTION_FAILED_ERROR="WorkflowExecutionFailedError",n.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",n.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",n.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",n.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",n.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",n.STEP_NOT_FOUND_ERROR="StepNotFoundError",n.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",n.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",n.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",n.EXECUTION_EVENT_PAYLOAD_INVALID_ERROR="ExecutionEventPayloadInvalidError",n.EXECUTION_EVENT_CONTROL_INVALID_ERROR="ExecutionEventControlInvalidError",n.EXECUTION_STATE_CONTROL_INVALID_ERROR="ExecutionStateControlInvalidError",n.STEP_CONTROL_COMPILATION_FAILED_ERROR="StepControlCompilationFailedError",n.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",n.INVALID_ACTION_ERROR="InvalidActionError",n.MISSING_SECRET_KEY_ERROR="MissingSecretKeyError",n.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",n.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",n.SIGNATURE_INVALID_ERROR="SignatureInvalidError",n.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",n.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",n.BRIDGE_ERROR="BridgeError",n.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",n.WORKFLOW_PAYLOAD_INVALID_ERROR="WorkflowPayloadInvalidError",n))(u||{});var Y=(r=>(r.POST="POST",r.GET="GET",r.OPTIONS="OPTIONS",r))(Y||{});var _e=(i=>(i.EMAIL="email",i.SMS="sms",i.PUSH="push",i.CHAT="chat",i.IN_APP="in_app",i))(_e||{});var Te="2.0.3";var y=Te,F="2024-06-26";var O=class extends Error{data},L=class extends O{statusCode=404},_=class extends O{statusCode=400},m=class extends O{statusCode=401},f=class extends O{statusCode=500},C=class extends O{statusCode=409};var b=class extends _{code="ExecutionStateCorruptError";constructor(e,t){super(`Workflow with id: \`${e}\` has a corrupt state. Step with id: \`${t}\` does not exist. Please provide the missing state.`),this.data={workflowId:e,stepId:t};}},P=class extends _{code="ExecutionEventPayloadInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`payload\`. Please provide the correct event payload.`),this.data=t;}},W=class extends _{code="ExecutionEventControlInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`controls\`. Please provide the correct event controls.`),this.data=t;}},$=class extends _{code="ExecutionStateControlInvalidError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid \`controls\`. Please provide the correct step controls.`),this.data=r;}},G=class extends _{code="ExecutionStateOutputInvalidError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid output. Please provide the correct step output.`),this.data=r;}},j=class extends _{code="ExecutionStateResultInvalidError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid result. Please provide the correct step result.`),this.data=r;}},K=class extends _{code="StepControlCompilationFailedError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has invalid controls syntax in step with id: \`${t}\`. Please correct step control syntax.`),this.data=r;}},B=class extends _{code="ExecutionProviderOutputInvalidError";constructor(e,t,r,s){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` and provider with id: \`${r}\` has invalid output. Please provide the correct provider output.`),this.data=s;}};var X=class extends O{statusCode;data;code;constructor(e,t,r){super(),this.data={message:r},this.statusCode=e,this.code=t;}};var Ae=()=>typeof Response<"u"?Response:crossFetch.Response;var l={info:o=>N__default.default.blue(o),warning:o=>N__default.default.yellow(o),error:o=>N__default.default.red(o),success:o=>N__default.default.green(o),underline:o=>N__default.default.underline(o),bold:o=>N__default.default.bold(o)},p={SUCCESS:l.success("\u2714"),ERROR:l.error("\u2717"),WARNING:l.warning("\u26A0"),INFO:l.info("\u2139"),ARROW:l.bold("\u2192"),MOCK:l.info("\u25CB"),HYDRATED:l.bold(l.info("\u2192")),STEP:l.info("\u03C3"),ACTION:l.info("\u03B1"),DURATION:l.info("\u0394"),PROVIDER:l.info("\u2699"),OUTPUT:l.info("\u21E2"),INPUT:l.info("\u21E0"),WORKFLOW:l.info("\u03C9"),STATE:l.info("\u03C3"),EXECUTE:l.info("\u03B5"),PREVIEW:l.info("\u03C1")};var ue=o=>Object.values(o).map(e=>`\`${e}\``).join(", "),J=o=>o.replaceAll(/(\w)(\w*)/g,(e,t,r)=>t.toUpperCase()+r.toLowerCase()).replaceAll(/[\s-]+/g,"");var me=(o,e="https://api.novu.co")=>{let t=process.env.NOVU_API_URL||e;return {post:async(r,s)=>{let i=await fetch(`${t}/v1${r}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${o}`},body:JSON.stringify(s)}),a=await i.json();if(i.ok)return a;throw shared.checkIsResponseError(a)?new X(a.statusCode,a.error,a.message):new v("Error processing API request to Novu Cloud from Bridge application.")},delete:async r=>(await fetch(`${t}/v1${r}`,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${o}`}})).json()}};var Ue={allowedTags:we__default.default.defaults.allowedTags.concat(["style","img","html","head","body","link","meta","title"]),allowedAttributes:!1,allowVulnerableTags:!0,parseStyleAttributes:!1,parser:{lowerCaseAttributeNames:!0}},Ie=o=>{if(!o)return o;let e=/^<!DOCTYPE .*?>/,t=o.match(e),r=we__default.default(o,Ue);return t?t[0]+r:r},q=o=>Object.keys(o).reduce((e,t)=>{let r=o[t];return typeof r=="string"?e[t]=Ie(r):Array.isArray(r)?e[t]=r.map(s=>typeof s=="string"?Ie(s):typeof s=="object"?q(s):s):typeof r=="object"&&r!==null?e[t]=q(r):e[t]=r,e},{});var z=class extends O{code="MethodNotAllowedError";statusCode=405;message=`Method not allowed. Please use one of ${ue(Y)}`},x=class extends _{code="InvalidActionError";constructor(e,t){super(`Invalid query string: \`action\`=\`${e}\`. Please use one of ${ue(t)}`);}};var v=class extends f{code="BridgeError";message="Something went wrong. Please try again later."};var U=class extends C{constructor(e,t){super(`${J(e)} with id: \`${t}\` already exists. Please use a different id.`);}},I=class extends L{constructor(e,t){super(`${J(e)} with id: \`${t}\` does not exist. Please provide a valid id.`);}},g=class extends f{constructor(e,t){super(`Failed to execute ${J(e)} with id: \`${t}\`. Please try again later.`);}};var Z=class extends I{code="ProviderNotFoundError";constructor(e){super("provider",e);}},Q=class extends g{code="ProviderExecutionFailedError";constructor(e){super("workflow",e);}};var H=class extends m{code="SignatureMismatchError";constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `novu-signature` header is correct and try again.");}},ee=class extends m{code="SignatureNotFoundError";constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");}},te=class extends m{code="SignatureInvalidError";constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");}},re=class extends m{code="SignatureExpiredError";constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);}},oe=class extends m{code="SigningKeyNotFoundError";constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");}};var se=class extends I{code="StepNotFoundError";constructor(e){super("step",e);}};var k=class extends I{code="WorkflowNotFoundError";constructor(e){super("workflow",e);}},ie=class extends U{code="WorkflowAlreadyExistsError";constructor(e){super("workflow",e);}};var Ne=o=>typeof structuredClone=="function"?structuredClone(o):JSON.parse(JSON.stringify(o));var ae=class{ajv;compiledSchemas;constructor(){this.ajv=new Ve__default.default({useDefaults:!0,removeAdditional:"failing"}),Ye__default.default(this.ajv),this.compiledSchemas=new Map;}canHandle(e){return typeof e=="boolean"?!1:e.type==="object"||!!e.anyOf||!!e.allOf||!!e.oneOf}async validate(e,t){let r=this.compiledSchemas.get(t);r||(r=this.ajv.compile(t),this.compiledSchemas.set(t,r));let s=Ne(e);return r(s)?{success:!0,data:s}:{success:!1,errors:r.errors.map(a=>({path:a.instancePath,message:a.message}))}}transformToJsonSchema(e){return e}};var ne=class{canHandle(e){return e.safeParseAsync!==void 0}async validate(e,t){let r=t.safeParse(e);return r.success?{success:!0,data:r.data}:{success:!1,errors:r.error.errors.map(s=>({path:`/${s.path.join("/")}`,message:s.message}))}}transformToJsonSchema(e){try{return zodToJsonSchema.zodToJsonSchema(e)}catch(t){throw t?.message?.includes("Cannot find module")&&console.error("Tried to use a zod schema in @novu/framework without `zod-to-json-schema` installed. Please install it by running `npm install zod-to-json-schema`."),t}}};var ce=new ne,de=new ae,ve=async(o,e)=>{if(ce.canHandle(o))return ce.validate(e,o);if(de.canHandle(o))return de.validate(e,o);throw new Error("Invalid schema")},ge=o=>{if(ce.canHandle(o))return ce.transformToJsonSchema(o);if(de.canHandle(o))return de.transformToJsonSchema(o);throw new Error("Invalid schema")};jsonSchemaFaker.JSONSchemaFaker.random.shuffle=function(){return ["[placeholder]"]};jsonSchemaFaker.JSONSchemaFaker.option({useDefaultValue:!0,alwaysFakeOptionals:!0});function Ce(){return ["development",void 0].includes(process.env.NODE_ENV)}var pe=class{discoveredWorkflows=[];templateEngine=new liquidjs.Liquid;secretKey;version=y;strictAuthentication;constructor(e){let t=this.buildOptions(e);this.secretKey=t.secretKey,this.strictAuthentication=t.strictAuthentication;}buildOptions(e){let t={secretKey:void 0,strictAuthentication:!Ce()};return t.secretKey=e?.secretKey||process.env.NOVU_SECRET_KEY||process.env.NOVU_API_KEY,e?.strictAuthentication!==void 0?t.strictAuthentication=e.strictAuthentication:process.env.NOVU_STRICT_AUTHENTICATION_ENABLED!==void 0&&(t.strictAuthentication=process.env.NOVU_STRICT_AUTHENTICATION_ENABLED==="true"),t}addWorkflows(e){for(let t of e){if(this.discoveredWorkflows.some(r=>r.workflowId===t.definition.workflowId))throw new ie(t.definition.workflowId);this.discoveredWorkflows.push(t.definition);}}healthCheck(){let e=this.discoveredWorkflows.length,t=this.discoveredWorkflows.reduce((r,s)=>r+s.steps.length,0);return {status:"ok",sdkVersion:y,frameworkVersion:F,discovered:{workflows:e,steps:t}}}getWorkflow(e){let t=this.discoveredWorkflows.find(r=>r.workflowId===e);if(t)return t;throw new k(e)}getStep(e,t){let s=this.getWorkflow(e).steps.find(i=>i.stepId===t);if(s)return s;throw new se(t)}getRegisteredWorkflows(){return this.discoveredWorkflows}discover(){return {workflows:this.getRegisteredWorkflows()}}mock(e){return jsonSchemaFaker.JSONSchemaFaker.generate(ge(e))}async validate(e,t,r,s,i,a,d){let c=await ve(t,e);if(c.success)return c.data;switch(r){case"event":this.throwInvalidEvent(s,i,c.errors);case"step":this.throwInvalidStep(a,s,i,c.errors);case"provider":this.throwInvalidProvider(a,d,s,i,c.errors);default:throw new Error(`Invalid component: '${r}'`)}}throwInvalidProvider(e,t,r,s,i){if(!e)throw new Error("stepId is required");if(!t)throw new Error("providerId is required");switch(r){case"output":throw new B(s,e,t,i);default:throw new Error(`Invalid payload type: '${r}'`)}}throwInvalidStep(e,t,r,s){if(!e)throw new Error("stepId is required");switch(t){case"output":throw new G(r,e,s);case"result":throw new j(r,e,s);case"controls":throw new $(r,e,s);default:throw new Error(`Invalid payload type: '${t}'`)}}throwInvalidEvent(e,t,r){switch(e){case"controls":throw new W(t,r);case"payload":throw new P(t,r);default:throw new Error(`Invalid payload type: '${e}'`)}}executeStepFactory(e,t){return async(r,s,i)=>{let a=this.getStep(e.workflowId,r),d=await this.createStepControls(a,e),c=e.action==="preview";if(!c&&await this.shouldSkip(i?.skip,d))return r===e.stepId&&t({options:{skip:!0},outputs:{},providers:{}}),{};let E=this.previewStep.bind(this),R=this.executeStep.bind(this),T=await(c?E:R)(e,{...a,providers:a.providers.map(S=>{let M=i?.providers?.[S.type];if(!M)throw new Z(S.type);return {...S,resolve:M}}),resolve:s});return Object.values(_e).includes(a.type)&&(T={...T,outputs:q(T.outputs)}),r===e.stepId&&t({...T,options:{skip:!1}}),T.outputs}}async shouldSkip(e,t){return e?e(t):!1}async executeWorkflow(e){let s=`${e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action"} workflowId:`;console.log(`
|
|
23
|
+
var D=(r=>(r.TRIGGER="trigger",r.EXECUTE="execute",r.PREVIEW="preview",r))(D||{}),V=(r=>(r.DISCOVER="discover",r.HEALTH_CHECK="health-check",r.CODE="code",r))(V||{});var u=(n=>(n.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",n.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",n.WORKFLOW_EXECUTION_FAILED_ERROR="WorkflowExecutionFailedError",n.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",n.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",n.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",n.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",n.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",n.STEP_NOT_FOUND_ERROR="StepNotFoundError",n.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",n.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",n.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",n.EXECUTION_EVENT_PAYLOAD_INVALID_ERROR="ExecutionEventPayloadInvalidError",n.EXECUTION_EVENT_CONTROL_INVALID_ERROR="ExecutionEventControlInvalidError",n.EXECUTION_STATE_CONTROL_INVALID_ERROR="ExecutionStateControlInvalidError",n.STEP_CONTROL_COMPILATION_FAILED_ERROR="StepControlCompilationFailedError",n.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",n.INVALID_ACTION_ERROR="InvalidActionError",n.MISSING_SECRET_KEY_ERROR="MissingSecretKeyError",n.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",n.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",n.SIGNATURE_INVALID_ERROR="SignatureInvalidError",n.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",n.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",n.BRIDGE_ERROR="BridgeError",n.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",n.WORKFLOW_PAYLOAD_INVALID_ERROR="WorkflowPayloadInvalidError",n))(u||{});var Y=(r=>(r.POST="POST",r.GET="GET",r.OPTIONS="OPTIONS",r))(Y||{});var _e=(i=>(i.EMAIL="email",i.SMS="sms",i.PUSH="push",i.CHAT="chat",i.IN_APP="in_app",i))(_e||{});var Te="2.1.1";var y=Te,F="2024-06-26";var O=class extends Error{data},L=class extends O{statusCode=404},_=class extends O{statusCode=400},m=class extends O{statusCode=401},f=class extends O{statusCode=500},C=class extends O{statusCode=409};var b=class extends _{code="ExecutionStateCorruptError";constructor(e,t){super(`Workflow with id: \`${e}\` has a corrupt state. Step with id: \`${t}\` does not exist. Please provide the missing state.`),this.data={workflowId:e,stepId:t};}},P=class extends _{code="ExecutionEventPayloadInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`payload\`. Please provide the correct event payload.`),this.data=t;}},W=class extends _{code="ExecutionEventControlInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`controls\`. Please provide the correct event controls.`),this.data=t;}},$=class extends _{code="ExecutionStateControlInvalidError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid \`controls\`. Please provide the correct step controls.`),this.data=r;}},G=class extends _{code="ExecutionStateOutputInvalidError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid output. Please provide the correct step output.`),this.data=r;}},j=class extends _{code="ExecutionStateResultInvalidError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid result. Please provide the correct step result.`),this.data=r;}},K=class extends _{code="StepControlCompilationFailedError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has invalid controls syntax in step with id: \`${t}\`. Please correct step control syntax.`),this.data=r;}},B=class extends _{code="ExecutionProviderOutputInvalidError";constructor(e,t,r,s){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` and provider with id: \`${r}\` has invalid output. Please provide the correct provider output.`),this.data=s;}};var X=class extends O{statusCode;data;code;constructor(e,t,r){super(),this.data={message:r},this.statusCode=e,this.code=t;}};var Ae=()=>typeof Response<"u"?Response:crossFetch.Response;var l={info:o=>N__default.default.blue(o),warning:o=>N__default.default.yellow(o),error:o=>N__default.default.red(o),success:o=>N__default.default.green(o),underline:o=>N__default.default.underline(o),bold:o=>N__default.default.bold(o)},p={SUCCESS:l.success("\u2714"),ERROR:l.error("\u2717"),WARNING:l.warning("\u26A0"),INFO:l.info("\u2139"),ARROW:l.bold("\u2192"),MOCK:l.info("\u25CB"),HYDRATED:l.bold(l.info("\u2192")),STEP:l.info("\u03C3"),ACTION:l.info("\u03B1"),DURATION:l.info("\u0394"),PROVIDER:l.info("\u2699"),OUTPUT:l.info("\u21E2"),INPUT:l.info("\u21E0"),WORKFLOW:l.info("\u03C9"),STATE:l.info("\u03C3"),EXECUTE:l.info("\u03B5"),PREVIEW:l.info("\u03C1")};var ue=o=>Object.values(o).map(e=>`\`${e}\``).join(", "),J=o=>o.replaceAll(/(\w)(\w*)/g,(e,t,r)=>t.toUpperCase()+r.toLowerCase()).replaceAll(/[\s-]+/g,"");var me=(o,e="https://api.novu.co")=>{let t=process.env.NOVU_API_URL||e;return {post:async(r,s)=>{let i=await fetch(`${t}/v1${r}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${o}`},body:JSON.stringify(s)}),a=await i.json();if(i.ok)return a;throw shared.checkIsResponseError(a)?new X(a.statusCode,a.error,a.message):new v("Error processing API request to Novu Cloud from Bridge application.")},delete:async r=>(await fetch(`${t}/v1${r}`,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${o}`}})).json()}};var Ue={allowedTags:we__default.default.defaults.allowedTags.concat(["style","img","html","head","body","link","meta","title"]),allowedAttributes:!1,allowVulnerableTags:!0,parseStyleAttributes:!1,parser:{lowerCaseAttributeNames:!0}},Ie=o=>{if(!o)return o;let e=/^<!DOCTYPE .*?>/,t=o.match(e),r=we__default.default(o,Ue);return t?t[0]+r:r},q=o=>Object.keys(o).reduce((e,t)=>{let r=o[t];return typeof r=="string"?e[t]=Ie(r):Array.isArray(r)?e[t]=r.map(s=>typeof s=="string"?Ie(s):typeof s=="object"?q(s):s):typeof r=="object"&&r!==null?e[t]=q(r):e[t]=r,e},{});var z=class extends O{code="MethodNotAllowedError";statusCode=405;message=`Method not allowed. Please use one of ${ue(Y)}`},x=class extends _{code="InvalidActionError";constructor(e,t){super(`Invalid query string: \`action\`=\`${e}\`. Please use one of ${ue(t)}`);}};var v=class extends f{code="BridgeError";message="Something went wrong. Please try again later."};var U=class extends C{constructor(e,t){super(`${J(e)} with id: \`${t}\` already exists. Please use a different id.`);}},I=class extends L{constructor(e,t){super(`${J(e)} with id: \`${t}\` does not exist. Please provide a valid id.`);}},g=class extends f{constructor(e,t){super(`Failed to execute ${J(e)} with id: \`${t}\`. Please try again later.`);}};var Z=class extends I{code="ProviderNotFoundError";constructor(e){super("provider",e);}},Q=class extends g{code="ProviderExecutionFailedError";constructor(e){super("workflow",e);}};var H=class extends m{code="SignatureMismatchError";constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `novu-signature` header is correct and try again.");}},ee=class extends m{code="SignatureNotFoundError";constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");}},te=class extends m{code="SignatureInvalidError";constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");}},re=class extends m{code="SignatureExpiredError";constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);}},oe=class extends m{code="SigningKeyNotFoundError";constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");}};var se=class extends I{code="StepNotFoundError";constructor(e){super("step",e);}};var k=class extends I{code="WorkflowNotFoundError";constructor(e){super("workflow",e);}},ie=class extends U{code="WorkflowAlreadyExistsError";constructor(e){super("workflow",e);}};var Ne=o=>typeof structuredClone=="function"?structuredClone(o):JSON.parse(JSON.stringify(o));var ae=class{ajv;compiledSchemas;constructor(){this.ajv=new Ve__default.default({useDefaults:!0,removeAdditional:"failing"}),Ye__default.default(this.ajv),this.compiledSchemas=new Map;}canHandle(e){return typeof e=="boolean"?!1:e.type==="object"||!!e.anyOf||!!e.allOf||!!e.oneOf}async validate(e,t){let r=this.compiledSchemas.get(t);r||(r=this.ajv.compile(t),this.compiledSchemas.set(t,r));let s=Ne(e);return r(s)?{success:!0,data:s}:{success:!1,errors:r.errors.map(a=>({path:a.instancePath,message:a.message}))}}transformToJsonSchema(e){return e}};var ne=class{canHandle(e){return e.safeParseAsync!==void 0}async validate(e,t){let r=t.safeParse(e);return r.success?{success:!0,data:r.data}:{success:!1,errors:r.error.errors.map(s=>({path:`/${s.path.join("/")}`,message:s.message}))}}transformToJsonSchema(e){try{return zodToJsonSchema.zodToJsonSchema(e)}catch(t){throw t?.message?.includes("Cannot find module")&&console.error("Tried to use a zod schema in @novu/framework without `zod-to-json-schema` installed. Please install it by running `npm install zod-to-json-schema`."),t}}};var ce=new ne,de=new ae,ve=async(o,e)=>{if(ce.canHandle(o))return ce.validate(e,o);if(de.canHandle(o))return de.validate(e,o);throw new Error("Invalid schema")},ge=o=>{if(ce.canHandle(o))return ce.transformToJsonSchema(o);if(de.canHandle(o))return de.transformToJsonSchema(o);throw new Error("Invalid schema")};jsonSchemaFaker.JSONSchemaFaker.random.shuffle=function(){return ["[placeholder]"]};jsonSchemaFaker.JSONSchemaFaker.option({useDefaultValue:!0,alwaysFakeOptionals:!0});function Ce(){return ["development",void 0].includes(process.env.NODE_ENV)}var pe=class{discoveredWorkflows=[];templateEngine=new liquidjs.Liquid;secretKey;version=y;strictAuthentication;constructor(e){let t=this.buildOptions(e);this.secretKey=t.secretKey,this.strictAuthentication=t.strictAuthentication;}buildOptions(e){let t={secretKey:void 0,strictAuthentication:!Ce()};return t.secretKey=e?.secretKey||process.env.NOVU_SECRET_KEY||process.env.NOVU_API_KEY,e?.strictAuthentication!==void 0?t.strictAuthentication=e.strictAuthentication:process.env.NOVU_STRICT_AUTHENTICATION_ENABLED!==void 0&&(t.strictAuthentication=process.env.NOVU_STRICT_AUTHENTICATION_ENABLED==="true"),t}addWorkflows(e){for(let t of e){if(this.discoveredWorkflows.some(r=>r.workflowId===t.definition.workflowId))throw new ie(t.definition.workflowId);this.discoveredWorkflows.push(t.definition);}}healthCheck(){let e=this.discoveredWorkflows.length,t=this.discoveredWorkflows.reduce((r,s)=>r+s.steps.length,0);return {status:"ok",sdkVersion:y,frameworkVersion:F,discovered:{workflows:e,steps:t}}}getWorkflow(e){let t=this.discoveredWorkflows.find(r=>r.workflowId===e);if(t)return t;throw new k(e)}getStep(e,t){let s=this.getWorkflow(e).steps.find(i=>i.stepId===t);if(s)return s;throw new se(t)}getRegisteredWorkflows(){return this.discoveredWorkflows}discover(){return {workflows:this.getRegisteredWorkflows()}}mock(e){return jsonSchemaFaker.JSONSchemaFaker.generate(ge(e))}async validate(e,t,r,s,i,a,d){let c=await ve(t,e);if(c.success)return c.data;switch(r){case"event":this.throwInvalidEvent(s,i,c.errors);case"step":this.throwInvalidStep(a,s,i,c.errors);case"provider":this.throwInvalidProvider(a,d,s,i,c.errors);default:throw new Error(`Invalid component: '${r}'`)}}throwInvalidProvider(e,t,r,s,i){if(!e)throw new Error("stepId is required");if(!t)throw new Error("providerId is required");switch(r){case"output":throw new B(s,e,t,i);default:throw new Error(`Invalid payload type: '${r}'`)}}throwInvalidStep(e,t,r,s){if(!e)throw new Error("stepId is required");switch(t){case"output":throw new G(r,e,s);case"result":throw new j(r,e,s);case"controls":throw new $(r,e,s);default:throw new Error(`Invalid payload type: '${t}'`)}}throwInvalidEvent(e,t,r){switch(e){case"controls":throw new W(t,r);case"payload":throw new P(t,r);default:throw new Error(`Invalid payload type: '${e}'`)}}executeStepFactory(e,t){return async(r,s,i)=>{let a=this.getStep(e.workflowId,r),d=await this.createStepControls(a,e),c=e.action==="preview";if(!c&&await this.shouldSkip(i?.skip,d))return r===e.stepId&&t({options:{skip:!0},outputs:{},providers:{}}),{};let E=this.previewStep.bind(this),R=this.executeStep.bind(this),T=await(c?E:R)(e,{...a,providers:a.providers.map(S=>{let M=i?.providers?.[S.type];if(!M)throw new Z(S.type);return {...S,resolve:M}}),resolve:s});return Object.values(_e).includes(a.type)&&(T={...T,outputs:q(T.outputs)}),r===e.stepId&&t({...T,options:{skip:!1}}),T.outputs}}async shouldSkip(e,t){return e?e(t):!1}async executeWorkflow(e){let s=`${e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action"} workflowId:`;console.log(`
|
|
24
24
|
${l.bold(l.underline(s))} '${e.workflowId}'`);let i=this.getWorkflow(e.workflowId),a=process.hrtime(),d={outputs:{},providers:{},options:{skip:!1}},c,E=new Promise(h=>{c=h;}),R=h=>{c(),d=h;},w;try{if(e.action==="execute"&&!e.payload&&!e.data)throw new P(e.workflowId,{message:"Event `payload` is required"});let h=await this.createExecutionPayload(e,i),A={...e,payload:h};await Promise.race([E,i.execute({payload:h,environment:{},input:{},controls:{},subscriber:e.subscriber,step:{email:this.executeStepFactory(A,R),sms:this.executeStepFactory(A,R),inApp:this.executeStepFactory(A,R),digest:this.executeStepFactory(A,R),delay:this.executeStepFactory(A,R),push:this.executeStepFactory(A,R),chat:this.executeStepFactory(A,R),custom:this.executeStepFactory(A,R)}})]);}catch(h){w=h;}let T=process.hrtime(a),S=T[0],M=T[1],Ee=S*1e3+M/1e6,Se=w?p.ERROR:p.SUCCESS,De=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action";if(console.log(`${Se} ${De} workflowId: \`${e.workflowId}\``),this.prettyPrintExecute(e,Ee,w),w)throw w;return {outputs:d.outputs,providers:d.providers,options:d.options,metadata:{status:"success",error:!1,duration:Ee}}}async createExecutionPayload(e,t){let r=e.payload||e.data;if(e.action==="preview"){let i=this.mock(t.payload.schema);r=Object.assign(i,r);}return await this.validate(r,t.payload.unknownSchema,"event","payload",e.workflowId)}prettyPrintExecute(e,t,r){let s=r?p.ERROR:p.SUCCESS,i=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action",a=r?"Failed to execute":i,d=r?l.error:l.success,c=`${s} ${a} workflowId: '${e.workflowId}`;console.log(`
|
|
25
25
|
${l.bold(d(c))}'`),console.log(` \u251C ${p.STEP} stepId: '${e.stepId}'`),console.log(` \u251C ${p.ACTION} action: '${e.action}'`),console.log(` \u2514 ${p.DURATION} duration: '${t.toFixed(2)}ms'
|
|
26
26
|
`);}async executeProviders(e,t,r){return t.providers.reduce(async(s,i)=>{let a=await s,d=this.previewProvider.bind(this),c=this.executeProvider.bind(this),R=await(e.action==="preview"?d:c)(e,t,i,r);return {...a,[i.type]:R}},Promise.resolve({}))}previewProvider(e,t,r,s){return console.log(` ${p.MOCK} Mocked provider: \`${r.type}\``),this.mock(r.outputs.schema)}async executeProvider(e,t,r,s){let i=le__default.default({indent:2}).start(`Executing provider: \`${r.type}\``);try{if(e.stepId===t.stepId){let a=await this.createStepControls(t,e),d=await r.resolve({controls:a,outputs:s}),c=await this.validate(d,r.outputs.unknownSchema,"step","output",e.workflowId,t.stepId,r.type);return i.succeed(`Executed provider: \`${r.type}\``),{...c,_passthrough:d._passthrough}}else return i.stopAndPersist({symbol:p.HYDRATED,text:`Hydrated provider: \`${r.type}\``}),{}}catch(a){throw i.stopAndPersist({symbol:p.ERROR,text:`Failed to execute provider: \`${r.type}\``}),new Q(`Failed to execute provider: '${r.type}'.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestEvent } from '@sveltejs/kit';
|
|
2
|
-
import { w as SupportedFrameworkName, c as ServeHandlerOptions } from '../handler-
|
|
2
|
+
import { w as SupportedFrameworkName, c as ServeHandlerOptions } from '../handler-_mH7Q42O.js';
|
|
3
3
|
import '@novu/shared';
|
|
4
4
|
import 'json-schema-to-ts';
|
|
5
5
|
import 'zod';
|
|
@@ -20,7 +20,7 @@ var we__default = /*#__PURE__*/_interopDefault(we);
|
|
|
20
20
|
var Ve__default = /*#__PURE__*/_interopDefault(Ve);
|
|
21
21
|
var Ye__default = /*#__PURE__*/_interopDefault(Ye);
|
|
22
22
|
|
|
23
|
-
var D=(r=>(r.TRIGGER="trigger",r.EXECUTE="execute",r.PREVIEW="preview",r))(D||{}),V=(r=>(r.DISCOVER="discover",r.HEALTH_CHECK="health-check",r.CODE="code",r))(V||{});var O=(d=>(d.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",d.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",d.WORKFLOW_EXECUTION_FAILED_ERROR="WorkflowExecutionFailedError",d.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",d.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",d.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",d.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",d.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",d.STEP_NOT_FOUND_ERROR="StepNotFoundError",d.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",d.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",d.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",d.EXECUTION_EVENT_PAYLOAD_INVALID_ERROR="ExecutionEventPayloadInvalidError",d.EXECUTION_EVENT_CONTROL_INVALID_ERROR="ExecutionEventControlInvalidError",d.EXECUTION_STATE_CONTROL_INVALID_ERROR="ExecutionStateControlInvalidError",d.STEP_CONTROL_COMPILATION_FAILED_ERROR="StepControlCompilationFailedError",d.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",d.INVALID_ACTION_ERROR="InvalidActionError",d.MISSING_SECRET_KEY_ERROR="MissingSecretKeyError",d.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",d.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",d.SIGNATURE_INVALID_ERROR="SignatureInvalidError",d.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",d.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",d.BRIDGE_ERROR="BridgeError",d.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",d.WORKFLOW_PAYLOAD_INVALID_ERROR="WorkflowPayloadInvalidError",d))(O||{});var Y=(r=>(r.POST="POST",r.GET="GET",r.OPTIONS="OPTIONS",r))(Y||{});var Re=(i=>(i.EMAIL="email",i.SMS="sms",i.PUSH="push",i.CHAT="chat",i.IN_APP="in_app",i))(Re||{});var Te="2.0.3";var P=Te,F="2024-06-26";var E=class extends Error{data},L=class extends E{statusCode=404},R=class extends E{statusCode=400},m=class extends E{statusCode=401},f=class extends E{statusCode=500},b=class extends E{statusCode=409};var C=class extends R{code="ExecutionStateCorruptError";constructor(e,t){super(`Workflow with id: \`${e}\` has a corrupt state. Step with id: \`${t}\` does not exist. Please provide the missing state.`),this.data={workflowId:e,stepId:t};}},y=class extends R{code="ExecutionEventPayloadInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`payload\`. Please provide the correct event payload.`),this.data=t;}},W=class extends R{code="ExecutionEventControlInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`controls\`. Please provide the correct event controls.`),this.data=t;}},$=class extends R{code="ExecutionStateControlInvalidError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid \`controls\`. Please provide the correct step controls.`),this.data=r;}},G=class extends R{code="ExecutionStateOutputInvalidError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid output. Please provide the correct step output.`),this.data=r;}},j=class extends R{code="ExecutionStateResultInvalidError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid result. Please provide the correct step result.`),this.data=r;}},K=class extends R{code="StepControlCompilationFailedError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has invalid controls syntax in step with id: \`${t}\`. Please correct step control syntax.`),this.data=r;}},B=class extends R{code="ExecutionProviderOutputInvalidError";constructor(e,t,r,s){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` and provider with id: \`${r}\` has invalid output. Please provide the correct provider output.`),this.data=s;}};var X=class extends E{statusCode;data;code;constructor(e,t,r){super(),this.data={message:r},this.statusCode=e,this.code=t;}};var Ae=()=>typeof Response<"u"?Response:crossFetch.Response;var l={info:o=>N__default.default.blue(o),warning:o=>N__default.default.yellow(o),error:o=>N__default.default.red(o),success:o=>N__default.default.green(o),underline:o=>N__default.default.underline(o),bold:o=>N__default.default.bold(o)},u={SUCCESS:l.success("\u2714"),ERROR:l.error("\u2717"),WARNING:l.warning("\u26A0"),INFO:l.info("\u2139"),ARROW:l.bold("\u2192"),MOCK:l.info("\u25CB"),HYDRATED:l.bold(l.info("\u2192")),STEP:l.info("\u03C3"),ACTION:l.info("\u03B1"),DURATION:l.info("\u0394"),PROVIDER:l.info("\u2699"),OUTPUT:l.info("\u21E2"),INPUT:l.info("\u21E0"),WORKFLOW:l.info("\u03C9"),STATE:l.info("\u03C3"),EXECUTE:l.info("\u03B5"),PREVIEW:l.info("\u03C1")};var _e=o=>Object.values(o).map(e=>`\`${e}\``).join(", "),q=o=>o.replaceAll(/(\w)(\w*)/g,(e,t,r)=>t.toUpperCase()+r.toLowerCase()).replaceAll(/[\s-]+/g,"");var me=(o,e="https://api.novu.co")=>{let t=process.env.NOVU_API_URL||e;return {post:async(r,s)=>{let i=await fetch(`${t}/v1${r}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${o}`},body:JSON.stringify(s)}),a=await i.json();if(i.ok)return a;throw shared.checkIsResponseError(a)?new X(a.statusCode,a.error,a.message):new v("Error processing API request to Novu Cloud from Bridge application.")},delete:async r=>(await fetch(`${t}/v1${r}`,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${o}`}})).json()}};var Ue={allowedTags:we__default.default.defaults.allowedTags.concat(["style","img","html","head","body","link","meta","title"]),allowedAttributes:!1,allowVulnerableTags:!0,parseStyleAttributes:!1,parser:{lowerCaseAttributeNames:!0}},Ie=o=>{if(!o)return o;let e=/^<!DOCTYPE .*?>/,t=o.match(e),r=we__default.default(o,Ue);return t?t[0]+r:r},J=o=>Object.keys(o).reduce((e,t)=>{let r=o[t];return typeof r=="string"?e[t]=Ie(r):Array.isArray(r)?e[t]=r.map(s=>typeof s=="string"?Ie(s):typeof s=="object"?J(s):s):typeof r=="object"&&r!==null?e[t]=J(r):e[t]=r,e},{});var z=class extends E{code="MethodNotAllowedError";statusCode=405;message=`Method not allowed. Please use one of ${_e(Y)}`},x=class extends R{code="InvalidActionError";constructor(e,t){super(`Invalid query string: \`action\`=\`${e}\`. Please use one of ${_e(t)}`);}};var v=class extends f{code="BridgeError";message="Something went wrong. Please try again later."};var U=class extends b{constructor(e,t){super(`${q(e)} with id: \`${t}\` already exists. Please use a different id.`);}},I=class extends L{constructor(e,t){super(`${q(e)} with id: \`${t}\` does not exist. Please provide a valid id.`);}},g=class extends f{constructor(e,t){super(`Failed to execute ${q(e)} with id: \`${t}\`. Please try again later.`);}};var Z=class extends I{code="ProviderNotFoundError";constructor(e){super("provider",e);}},Q=class extends g{code="ProviderExecutionFailedError";constructor(e){super("workflow",e);}};var H=class extends m{code="SignatureMismatchError";constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `novu-signature` header is correct and try again.");}},ee=class extends m{code="SignatureNotFoundError";constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");}},te=class extends m{code="SignatureInvalidError";constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");}},re=class extends m{code="SignatureExpiredError";constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);}},oe=class extends m{code="SigningKeyNotFoundError";constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");}};var se=class extends I{code="StepNotFoundError";constructor(e){super("step",e);}};var k=class extends I{code="WorkflowNotFoundError";constructor(e){super("workflow",e);}},ie=class extends U{code="WorkflowAlreadyExistsError";constructor(e){super("workflow",e);}};var Ne=o=>typeof structuredClone=="function"?structuredClone(o):JSON.parse(JSON.stringify(o));var ae=class{ajv;compiledSchemas;constructor(){this.ajv=new Ve__default.default({useDefaults:!0,removeAdditional:"failing"}),Ye__default.default(this.ajv),this.compiledSchemas=new Map;}canHandle(e){return typeof e=="boolean"?!1:e.type==="object"||!!e.anyOf||!!e.allOf||!!e.oneOf}async validate(e,t){let r=this.compiledSchemas.get(t);r||(r=this.ajv.compile(t),this.compiledSchemas.set(t,r));let s=Ne(e);return r(s)?{success:!0,data:s}:{success:!1,errors:r.errors.map(a=>({path:a.instancePath,message:a.message}))}}transformToJsonSchema(e){return e}};var ne=class{canHandle(e){return e.safeParseAsync!==void 0}async validate(e,t){let r=t.safeParse(e);return r.success?{success:!0,data:r.data}:{success:!1,errors:r.error.errors.map(s=>({path:`/${s.path.join("/")}`,message:s.message}))}}transformToJsonSchema(e){try{return zodToJsonSchema.zodToJsonSchema(e)}catch(t){throw t?.message?.includes("Cannot find module")&&console.error("Tried to use a zod schema in @novu/framework without `zod-to-json-schema` installed. Please install it by running `npm install zod-to-json-schema`."),t}}};var ce=new ne,de=new ae,ve=async(o,e)=>{if(ce.canHandle(o))return ce.validate(e,o);if(de.canHandle(o))return de.validate(e,o);throw new Error("Invalid schema")},ge=o=>{if(ce.canHandle(o))return ce.transformToJsonSchema(o);if(de.canHandle(o))return de.transformToJsonSchema(o);throw new Error("Invalid schema")};jsonSchemaFaker.JSONSchemaFaker.random.shuffle=function(){return ["[placeholder]"]};jsonSchemaFaker.JSONSchemaFaker.option({useDefaultValue:!0,alwaysFakeOptionals:!0});function be(){return ["development",void 0].includes(process.env.NODE_ENV)}var pe=class{discoveredWorkflows=[];templateEngine=new liquidjs.Liquid;secretKey;version=P;strictAuthentication;constructor(e){let t=this.buildOptions(e);this.secretKey=t.secretKey,this.strictAuthentication=t.strictAuthentication;}buildOptions(e){let t={secretKey:void 0,strictAuthentication:!be()};return t.secretKey=e?.secretKey||process.env.NOVU_SECRET_KEY||process.env.NOVU_API_KEY,e?.strictAuthentication!==void 0?t.strictAuthentication=e.strictAuthentication:process.env.NOVU_STRICT_AUTHENTICATION_ENABLED!==void 0&&(t.strictAuthentication=process.env.NOVU_STRICT_AUTHENTICATION_ENABLED==="true"),t}addWorkflows(e){for(let t of e){if(this.discoveredWorkflows.some(r=>r.workflowId===t.definition.workflowId))throw new ie(t.definition.workflowId);this.discoveredWorkflows.push(t.definition);}}healthCheck(){let e=this.discoveredWorkflows.length,t=this.discoveredWorkflows.reduce((r,s)=>r+s.steps.length,0);return {status:"ok",sdkVersion:P,frameworkVersion:F,discovered:{workflows:e,steps:t}}}getWorkflow(e){let t=this.discoveredWorkflows.find(r=>r.workflowId===e);if(t)return t;throw new k(e)}getStep(e,t){let s=this.getWorkflow(e).steps.find(i=>i.stepId===t);if(s)return s;throw new se(t)}getRegisteredWorkflows(){return this.discoveredWorkflows}discover(){return {workflows:this.getRegisteredWorkflows()}}mock(e){return jsonSchemaFaker.JSONSchemaFaker.generate(ge(e))}async validate(e,t,r,s,i,a,n){let c=await ve(t,e);if(c.success)return c.data;switch(r){case"event":this.throwInvalidEvent(s,i,c.errors);case"step":this.throwInvalidStep(a,s,i,c.errors);case"provider":this.throwInvalidProvider(a,n,s,i,c.errors);default:throw new Error(`Invalid component: '${r}'`)}}throwInvalidProvider(e,t,r,s,i){if(!e)throw new Error("stepId is required");if(!t)throw new Error("providerId is required");switch(r){case"output":throw new B(s,e,t,i);default:throw new Error(`Invalid payload type: '${r}'`)}}throwInvalidStep(e,t,r,s){if(!e)throw new Error("stepId is required");switch(t){case"output":throw new G(r,e,s);case"result":throw new j(r,e,s);case"controls":throw new $(r,e,s);default:throw new Error(`Invalid payload type: '${t}'`)}}throwInvalidEvent(e,t,r){switch(e){case"controls":throw new W(t,r);case"payload":throw new y(t,r);default:throw new Error(`Invalid payload type: '${e}'`)}}executeStepFactory(e,t){return async(r,s,i)=>{let a=this.getStep(e.workflowId,r),n=await this.createStepControls(a,e),c=e.action==="preview";if(!c&&await this.shouldSkip(i?.skip,n))return r===e.stepId&&t({options:{skip:!0},outputs:{},providers:{}}),{};let _=this.previewStep.bind(this),p=this.executeStep.bind(this),T=await(c?_:p)(e,{...a,providers:a.providers.map(S=>{let M=i?.providers?.[S.type];if(!M)throw new Z(S.type);return {...S,resolve:M}}),resolve:s});return Object.values(Re).includes(a.type)&&(T={...T,outputs:J(T.outputs)}),r===e.stepId&&t({...T,options:{skip:!1}}),T.outputs}}async shouldSkip(e,t){return e?e(t):!1}async executeWorkflow(e){let s=`${e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action"} workflowId:`;console.log(`
|
|
23
|
+
var D=(r=>(r.TRIGGER="trigger",r.EXECUTE="execute",r.PREVIEW="preview",r))(D||{}),V=(r=>(r.DISCOVER="discover",r.HEALTH_CHECK="health-check",r.CODE="code",r))(V||{});var O=(d=>(d.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",d.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",d.WORKFLOW_EXECUTION_FAILED_ERROR="WorkflowExecutionFailedError",d.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",d.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",d.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",d.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",d.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",d.STEP_NOT_FOUND_ERROR="StepNotFoundError",d.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",d.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",d.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",d.EXECUTION_EVENT_PAYLOAD_INVALID_ERROR="ExecutionEventPayloadInvalidError",d.EXECUTION_EVENT_CONTROL_INVALID_ERROR="ExecutionEventControlInvalidError",d.EXECUTION_STATE_CONTROL_INVALID_ERROR="ExecutionStateControlInvalidError",d.STEP_CONTROL_COMPILATION_FAILED_ERROR="StepControlCompilationFailedError",d.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",d.INVALID_ACTION_ERROR="InvalidActionError",d.MISSING_SECRET_KEY_ERROR="MissingSecretKeyError",d.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",d.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",d.SIGNATURE_INVALID_ERROR="SignatureInvalidError",d.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",d.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",d.BRIDGE_ERROR="BridgeError",d.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",d.WORKFLOW_PAYLOAD_INVALID_ERROR="WorkflowPayloadInvalidError",d))(O||{});var Y=(r=>(r.POST="POST",r.GET="GET",r.OPTIONS="OPTIONS",r))(Y||{});var Re=(i=>(i.EMAIL="email",i.SMS="sms",i.PUSH="push",i.CHAT="chat",i.IN_APP="in_app",i))(Re||{});var Te="2.1.1";var P=Te,F="2024-06-26";var E=class extends Error{data},b=class extends E{statusCode=404},R=class extends E{statusCode=400},m=class extends E{statusCode=401},f=class extends E{statusCode=500},L=class extends E{statusCode=409};var C=class extends R{code="ExecutionStateCorruptError";constructor(e,t){super(`Workflow with id: \`${e}\` has a corrupt state. Step with id: \`${t}\` does not exist. Please provide the missing state.`),this.data={workflowId:e,stepId:t};}},y=class extends R{code="ExecutionEventPayloadInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`payload\`. Please provide the correct event payload.`),this.data=t;}},W=class extends R{code="ExecutionEventControlInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`controls\`. Please provide the correct event controls.`),this.data=t;}},$=class extends R{code="ExecutionStateControlInvalidError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid \`controls\`. Please provide the correct step controls.`),this.data=r;}},G=class extends R{code="ExecutionStateOutputInvalidError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid output. Please provide the correct step output.`),this.data=r;}},j=class extends R{code="ExecutionStateResultInvalidError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid result. Please provide the correct step result.`),this.data=r;}},K=class extends R{code="StepControlCompilationFailedError";constructor(e,t,r){super(`Workflow with id: \`${e}\` has invalid controls syntax in step with id: \`${t}\`. Please correct step control syntax.`),this.data=r;}},B=class extends R{code="ExecutionProviderOutputInvalidError";constructor(e,t,r,s){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` and provider with id: \`${r}\` has invalid output. Please provide the correct provider output.`),this.data=s;}};var X=class extends E{statusCode;data;code;constructor(e,t,r){super(),this.data={message:r},this.statusCode=e,this.code=t;}};var Ae=()=>typeof Response<"u"?Response:crossFetch.Response;var l={info:o=>N__default.default.blue(o),warning:o=>N__default.default.yellow(o),error:o=>N__default.default.red(o),success:o=>N__default.default.green(o),underline:o=>N__default.default.underline(o),bold:o=>N__default.default.bold(o)},u={SUCCESS:l.success("\u2714"),ERROR:l.error("\u2717"),WARNING:l.warning("\u26A0"),INFO:l.info("\u2139"),ARROW:l.bold("\u2192"),MOCK:l.info("\u25CB"),HYDRATED:l.bold(l.info("\u2192")),STEP:l.info("\u03C3"),ACTION:l.info("\u03B1"),DURATION:l.info("\u0394"),PROVIDER:l.info("\u2699"),OUTPUT:l.info("\u21E2"),INPUT:l.info("\u21E0"),WORKFLOW:l.info("\u03C9"),STATE:l.info("\u03C3"),EXECUTE:l.info("\u03B5"),PREVIEW:l.info("\u03C1")};var _e=o=>Object.values(o).map(e=>`\`${e}\``).join(", "),q=o=>o.replaceAll(/(\w)(\w*)/g,(e,t,r)=>t.toUpperCase()+r.toLowerCase()).replaceAll(/[\s-]+/g,"");var me=(o,e="https://api.novu.co")=>{let t=process.env.NOVU_API_URL||e;return {post:async(r,s)=>{let i=await fetch(`${t}/v1${r}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${o}`},body:JSON.stringify(s)}),a=await i.json();if(i.ok)return a;throw shared.checkIsResponseError(a)?new X(a.statusCode,a.error,a.message):new v("Error processing API request to Novu Cloud from Bridge application.")},delete:async r=>(await fetch(`${t}/v1${r}`,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${o}`}})).json()}};var Ue={allowedTags:we__default.default.defaults.allowedTags.concat(["style","img","html","head","body","link","meta","title"]),allowedAttributes:!1,allowVulnerableTags:!0,parseStyleAttributes:!1,parser:{lowerCaseAttributeNames:!0}},Ie=o=>{if(!o)return o;let e=/^<!DOCTYPE .*?>/,t=o.match(e),r=we__default.default(o,Ue);return t?t[0]+r:r},J=o=>Object.keys(o).reduce((e,t)=>{let r=o[t];return typeof r=="string"?e[t]=Ie(r):Array.isArray(r)?e[t]=r.map(s=>typeof s=="string"?Ie(s):typeof s=="object"?J(s):s):typeof r=="object"&&r!==null?e[t]=J(r):e[t]=r,e},{});var z=class extends E{code="MethodNotAllowedError";statusCode=405;message=`Method not allowed. Please use one of ${_e(Y)}`},x=class extends R{code="InvalidActionError";constructor(e,t){super(`Invalid query string: \`action\`=\`${e}\`. Please use one of ${_e(t)}`);}};var v=class extends f{code="BridgeError";message="Something went wrong. Please try again later."};var U=class extends L{constructor(e,t){super(`${q(e)} with id: \`${t}\` already exists. Please use a different id.`);}},I=class extends b{constructor(e,t){super(`${q(e)} with id: \`${t}\` does not exist. Please provide a valid id.`);}},g=class extends f{constructor(e,t){super(`Failed to execute ${q(e)} with id: \`${t}\`. Please try again later.`);}};var Z=class extends I{code="ProviderNotFoundError";constructor(e){super("provider",e);}},Q=class extends g{code="ProviderExecutionFailedError";constructor(e){super("workflow",e);}};var H=class extends m{code="SignatureMismatchError";constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `novu-signature` header is correct and try again.");}},ee=class extends m{code="SignatureNotFoundError";constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");}},te=class extends m{code="SignatureInvalidError";constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");}},re=class extends m{code="SignatureExpiredError";constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);}},oe=class extends m{code="SigningKeyNotFoundError";constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");}};var se=class extends I{code="StepNotFoundError";constructor(e){super("step",e);}};var k=class extends I{code="WorkflowNotFoundError";constructor(e){super("workflow",e);}},ie=class extends U{code="WorkflowAlreadyExistsError";constructor(e){super("workflow",e);}};var Ne=o=>typeof structuredClone=="function"?structuredClone(o):JSON.parse(JSON.stringify(o));var ae=class{ajv;compiledSchemas;constructor(){this.ajv=new Ve__default.default({useDefaults:!0,removeAdditional:"failing"}),Ye__default.default(this.ajv),this.compiledSchemas=new Map;}canHandle(e){return typeof e=="boolean"?!1:e.type==="object"||!!e.anyOf||!!e.allOf||!!e.oneOf}async validate(e,t){let r=this.compiledSchemas.get(t);r||(r=this.ajv.compile(t),this.compiledSchemas.set(t,r));let s=Ne(e);return r(s)?{success:!0,data:s}:{success:!1,errors:r.errors.map(a=>({path:a.instancePath,message:a.message}))}}transformToJsonSchema(e){return e}};var ne=class{canHandle(e){return e.safeParseAsync!==void 0}async validate(e,t){let r=t.safeParse(e);return r.success?{success:!0,data:r.data}:{success:!1,errors:r.error.errors.map(s=>({path:`/${s.path.join("/")}`,message:s.message}))}}transformToJsonSchema(e){try{return zodToJsonSchema.zodToJsonSchema(e)}catch(t){throw t?.message?.includes("Cannot find module")&&console.error("Tried to use a zod schema in @novu/framework without `zod-to-json-schema` installed. Please install it by running `npm install zod-to-json-schema`."),t}}};var ce=new ne,de=new ae,ve=async(o,e)=>{if(ce.canHandle(o))return ce.validate(e,o);if(de.canHandle(o))return de.validate(e,o);throw new Error("Invalid schema")},ge=o=>{if(ce.canHandle(o))return ce.transformToJsonSchema(o);if(de.canHandle(o))return de.transformToJsonSchema(o);throw new Error("Invalid schema")};jsonSchemaFaker.JSONSchemaFaker.random.shuffle=function(){return ["[placeholder]"]};jsonSchemaFaker.JSONSchemaFaker.option({useDefaultValue:!0,alwaysFakeOptionals:!0});function Le(){return ["development",void 0].includes(process.env.NODE_ENV)}var pe=class{discoveredWorkflows=[];templateEngine=new liquidjs.Liquid;secretKey;version=P;strictAuthentication;constructor(e){let t=this.buildOptions(e);this.secretKey=t.secretKey,this.strictAuthentication=t.strictAuthentication;}buildOptions(e){let t={secretKey:void 0,strictAuthentication:!Le()};return t.secretKey=e?.secretKey||process.env.NOVU_SECRET_KEY||process.env.NOVU_API_KEY,e?.strictAuthentication!==void 0?t.strictAuthentication=e.strictAuthentication:process.env.NOVU_STRICT_AUTHENTICATION_ENABLED!==void 0&&(t.strictAuthentication=process.env.NOVU_STRICT_AUTHENTICATION_ENABLED==="true"),t}addWorkflows(e){for(let t of e){if(this.discoveredWorkflows.some(r=>r.workflowId===t.definition.workflowId))throw new ie(t.definition.workflowId);this.discoveredWorkflows.push(t.definition);}}healthCheck(){let e=this.discoveredWorkflows.length,t=this.discoveredWorkflows.reduce((r,s)=>r+s.steps.length,0);return {status:"ok",sdkVersion:P,frameworkVersion:F,discovered:{workflows:e,steps:t}}}getWorkflow(e){let t=this.discoveredWorkflows.find(r=>r.workflowId===e);if(t)return t;throw new k(e)}getStep(e,t){let s=this.getWorkflow(e).steps.find(i=>i.stepId===t);if(s)return s;throw new se(t)}getRegisteredWorkflows(){return this.discoveredWorkflows}discover(){return {workflows:this.getRegisteredWorkflows()}}mock(e){return jsonSchemaFaker.JSONSchemaFaker.generate(ge(e))}async validate(e,t,r,s,i,a,n){let c=await ve(t,e);if(c.success)return c.data;switch(r){case"event":this.throwInvalidEvent(s,i,c.errors);case"step":this.throwInvalidStep(a,s,i,c.errors);case"provider":this.throwInvalidProvider(a,n,s,i,c.errors);default:throw new Error(`Invalid component: '${r}'`)}}throwInvalidProvider(e,t,r,s,i){if(!e)throw new Error("stepId is required");if(!t)throw new Error("providerId is required");switch(r){case"output":throw new B(s,e,t,i);default:throw new Error(`Invalid payload type: '${r}'`)}}throwInvalidStep(e,t,r,s){if(!e)throw new Error("stepId is required");switch(t){case"output":throw new G(r,e,s);case"result":throw new j(r,e,s);case"controls":throw new $(r,e,s);default:throw new Error(`Invalid payload type: '${t}'`)}}throwInvalidEvent(e,t,r){switch(e){case"controls":throw new W(t,r);case"payload":throw new y(t,r);default:throw new Error(`Invalid payload type: '${e}'`)}}executeStepFactory(e,t){return async(r,s,i)=>{let a=this.getStep(e.workflowId,r),n=await this.createStepControls(a,e),c=e.action==="preview";if(!c&&await this.shouldSkip(i?.skip,n))return r===e.stepId&&t({options:{skip:!0},outputs:{},providers:{}}),{};let _=this.previewStep.bind(this),p=this.executeStep.bind(this),T=await(c?_:p)(e,{...a,providers:a.providers.map(S=>{let M=i?.providers?.[S.type];if(!M)throw new Z(S.type);return {...S,resolve:M}}),resolve:s});return Object.values(Re).includes(a.type)&&(T={...T,outputs:J(T.outputs)}),r===e.stepId&&t({...T,options:{skip:!1}}),T.outputs}}async shouldSkip(e,t){return e?e(t):!1}async executeWorkflow(e){let s=`${e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action"} workflowId:`;console.log(`
|
|
24
24
|
${l.bold(l.underline(s))} '${e.workflowId}'`);let i=this.getWorkflow(e.workflowId),a=process.hrtime(),n={outputs:{},providers:{},options:{skip:!1}},c,_=new Promise(h=>{c=h;}),p=h=>{c(),n=h;},w;try{if(e.action==="execute"&&!e.payload&&!e.data)throw new y(e.workflowId,{message:"Event `payload` is required"});let h=await this.createExecutionPayload(e,i),A={...e,payload:h};await Promise.race([_,i.execute({payload:h,environment:{},input:{},controls:{},subscriber:e.subscriber,step:{email:this.executeStepFactory(A,p),sms:this.executeStepFactory(A,p),inApp:this.executeStepFactory(A,p),digest:this.executeStepFactory(A,p),delay:this.executeStepFactory(A,p),push:this.executeStepFactory(A,p),chat:this.executeStepFactory(A,p),custom:this.executeStepFactory(A,p)}})]);}catch(h){w=h;}let T=process.hrtime(a),S=T[0],M=T[1],Ee=S*1e3+M/1e6,Se=w?u.ERROR:u.SUCCESS,De=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action";if(console.log(`${Se} ${De} workflowId: \`${e.workflowId}\``),this.prettyPrintExecute(e,Ee,w),w)throw w;return {outputs:n.outputs,providers:n.providers,options:n.options,metadata:{status:"success",error:!1,duration:Ee}}}async createExecutionPayload(e,t){let r=e.payload||e.data;if(e.action==="preview"){let i=this.mock(t.payload.schema);r=Object.assign(i,r);}return await this.validate(r,t.payload.unknownSchema,"event","payload",e.workflowId)}prettyPrintExecute(e,t,r){let s=r?u.ERROR:u.SUCCESS,i=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action",a=r?"Failed to execute":i,n=r?l.error:l.success,c=`${s} ${a} workflowId: '${e.workflowId}`;console.log(`
|
|
25
25
|
${l.bold(n(c))}'`),console.log(` \u251C ${u.STEP} stepId: '${e.stepId}'`),console.log(` \u251C ${u.ACTION} action: '${e.action}'`),console.log(` \u2514 ${u.DURATION} duration: '${t.toFixed(2)}ms'
|
|
26
26
|
`);}async executeProviders(e,t,r){return t.providers.reduce(async(s,i)=>{let a=await s,n=this.previewProvider.bind(this),c=this.executeProvider.bind(this),p=await(e.action==="preview"?n:c)(e,t,i,r);return {...a,[i.type]:p}},Promise.resolve({}))}previewProvider(e,t,r,s){return console.log(` ${u.MOCK} Mocked provider: \`${r.type}\``),this.mock(r.outputs.schema)}async executeProvider(e,t,r,s){let i=le__default.default({indent:2}).start(`Executing provider: \`${r.type}\``);try{if(e.stepId===t.stepId){let a=await this.createStepControls(t,e),n=await r.resolve({controls:a,outputs:s}),c=await this.validate(n,r.outputs.unknownSchema,"step","output",e.workflowId,t.stepId,r.type);return i.succeed(`Executed provider: \`${r.type}\``),{...c,_passthrough:n._passthrough}}else return i.stopAndPersist({symbol:u.HYDRATED,text:`Hydrated provider: \`${r.type}\``}),{}}catch(a){throw i.stopAndPersist({symbol:u.ERROR,text:`Failed to execute provider: \`${r.type}\``}),new Q(`Failed to execute provider: '${r.type}'.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novu/framework",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "The Code-First Notifications Workflow SDK.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"@sveltejs/kit": "^1.27.3",
|
|
136
136
|
"@types/aws-lambda": "^8.10.141",
|
|
137
137
|
"@types/express": "^4.17.13",
|
|
138
|
-
"@types/node": "^20.
|
|
138
|
+
"@types/node": "^20.15.0",
|
|
139
139
|
"@types/sanitize-html": "2.11.0",
|
|
140
140
|
"@vercel/node": "^2.15.9",
|
|
141
141
|
"aws-lambda": "^1.0.7",
|
|
@@ -146,13 +146,13 @@
|
|
|
146
146
|
"ts-node": "^10.9.2",
|
|
147
147
|
"tsup": "^8.0.2",
|
|
148
148
|
"tsx": "4.16.2",
|
|
149
|
-
"typescript": "
|
|
149
|
+
"typescript": "5.6.2",
|
|
150
150
|
"vitest": "^1.2.1",
|
|
151
151
|
"zod": "^3.23.0",
|
|
152
152
|
"zod-to-json-schema": "^3.23.0"
|
|
153
153
|
},
|
|
154
154
|
"dependencies": {
|
|
155
|
-
"@novu/shared": "2.
|
|
155
|
+
"@novu/shared": "^2.1.1",
|
|
156
156
|
"ajv": "^8.12.0",
|
|
157
157
|
"ajv-formats": "^2.1.1",
|
|
158
158
|
"better-ajv-errors": "^1.2.0",
|
|
@@ -163,5 +163,8 @@
|
|
|
163
163
|
"liquidjs": "^10.13.1",
|
|
164
164
|
"ora": "^5.4.1",
|
|
165
165
|
"sanitize-html": "^2.13.0"
|
|
166
|
+
},
|
|
167
|
+
"nx": {
|
|
168
|
+
"tags": ["package:public"]
|
|
166
169
|
}
|
|
167
170
|
}
|