@novu/framework 2.10.0 → 2.10.1-alpha.0
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/cjs/{health-check.types-DwKatX-8.d.cts → health-check.types-Nhsa_lGZ.d.cts} +28 -9
- package/dist/cjs/index-naFCU9MB.d.cts +268 -0
- package/dist/cjs/index.cjs +148 -92
- package/dist/cjs/index.d.cts +4 -3
- package/dist/cjs/internal/index.cjs +1 -1
- package/dist/cjs/internal/index.d.cts +6 -4
- package/dist/cjs/jsx-dev-runtime.cjs +1 -0
- package/dist/cjs/jsx-dev-runtime.d.cts +1 -0
- package/dist/cjs/jsx-runtime.cjs +1 -0
- package/dist/cjs/jsx-runtime.d.cts +1 -0
- package/dist/cjs/servers/express.cjs +148 -92
- package/dist/cjs/servers/express.d.cts +5 -4
- package/dist/cjs/servers/h3.cjs +148 -92
- package/dist/cjs/servers/h3.d.cts +5 -4
- package/dist/cjs/servers/lambda.cjs +148 -92
- package/dist/cjs/servers/lambda.d.cts +6 -5
- package/dist/cjs/servers/nest.cjs +148 -92
- package/dist/cjs/servers/nest.d.cts +14 -10
- package/dist/cjs/servers/next.cjs +148 -92
- package/dist/cjs/servers/next.d.cts +5 -4
- package/dist/cjs/servers/nuxt.cjs +148 -92
- package/dist/cjs/servers/nuxt.d.cts +5 -4
- package/dist/cjs/servers/remix.cjs +148 -92
- package/dist/cjs/servers/remix.d.cts +5 -4
- package/dist/cjs/servers/sveltekit.cjs +148 -92
- package/dist/cjs/servers/sveltekit.d.cts +5 -4
- package/dist/cjs/step-resolver.cjs +4 -4
- package/dist/cjs/step-resolver.d.cts +85 -36
- package/dist/cjs/{subscriber.types-CftO3aFY.d.cts → subscriber.types-CNLicO8m.d.cts} +12 -1
- package/dist/cjs/validators.cjs +1 -1
- package/dist/esm/chunk-2GCKOQK4.js +0 -0
- package/dist/esm/chunk-2M25EATE.js +1 -0
- package/dist/esm/chunk-52LSX2V5.js +1 -0
- package/dist/esm/chunk-6GCCKYZC.js +1 -0
- package/dist/esm/{chunk-RCWIURDJ.js → chunk-CBLKARLC.js} +4 -4
- package/dist/esm/chunk-EWC7I6UD.js +1 -0
- package/dist/esm/chunk-T2VIX2ZH.js +22 -0
- package/dist/esm/{chunk-JKG63DBC.js → chunk-U3IL7QCI.js} +1 -1
- package/dist/esm/chunk-WUP5SBTV.js +130 -0
- package/dist/esm/{health-check.types-C4vZDz5x.d.ts → health-check.types-zMcfbkrA.d.ts} +28 -9
- package/dist/esm/index-cfmN-nqZ.d.ts +268 -0
- package/dist/esm/index.d.ts +4 -3
- package/dist/esm/index.js +1 -1
- package/dist/esm/internal/index.d.ts +6 -4
- package/dist/esm/internal/index.js +1 -1
- package/dist/esm/jsx-dev-runtime.d.ts +1 -0
- package/dist/esm/jsx-dev-runtime.js +1 -0
- package/dist/esm/jsx-runtime.d.ts +1 -0
- package/dist/esm/jsx-runtime.js +1 -0
- package/dist/esm/servers/express.d.ts +5 -4
- package/dist/esm/servers/express.js +1 -1
- package/dist/esm/servers/h3.d.ts +5 -4
- package/dist/esm/servers/h3.js +1 -1
- package/dist/esm/servers/lambda.d.ts +6 -5
- package/dist/esm/servers/lambda.js +1 -1
- package/dist/esm/servers/nest.d.ts +14 -10
- package/dist/esm/servers/nest.js +1 -1
- package/dist/esm/servers/next.d.ts +5 -4
- package/dist/esm/servers/next.js +1 -1
- package/dist/esm/servers/nuxt.d.ts +5 -4
- package/dist/esm/servers/nuxt.js +1 -1
- package/dist/esm/servers/remix.d.ts +5 -4
- package/dist/esm/servers/remix.js +1 -1
- package/dist/esm/servers/sveltekit.d.ts +5 -4
- package/dist/esm/servers/sveltekit.js +1 -1
- package/dist/esm/step-resolver.d.ts +85 -36
- package/dist/esm/step-resolver.js +1 -1
- package/dist/esm/{subscriber.types-CfRj4acH.d.ts → subscriber.types-B0sKq6v3.d.ts} +12 -1
- package/dist/esm/validators.js +1 -1
- package/jsx-dev-runtime/package.json +3 -0
- package/jsx-runtime/package.json +3 -0
- package/package.json +26 -3
- package/dist/cjs/index-BTTxx1ad.d.cts +0 -141
- package/dist/esm/chunk-APAOD3BG.js +0 -1
- package/dist/esm/chunk-LPE4ME2M.js +0 -1
- package/dist/esm/chunk-MQSAHSED.js +0 -1
- package/dist/esm/chunk-PLPQUHX6.js +0 -1
- package/dist/esm/chunk-WSQ6EEHO.js +0 -95
- package/dist/esm/index-D4Rt1gOC.d.ts +0 -141
package/dist/esm/servers/next.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l,b as x,c,d as T}from"../chunk-
|
|
1
|
+
import{a as l,b as x,c as q,d as S,e as T,f as w,g as P,h as A,i as E,j as b,k as v,l as g,m as c,n as k}from"../chunk-WUP5SBTV.js";import"../chunk-T2VIX2ZH.js";import{a as G}from"../chunk-2M25EATE.js";import"../chunk-U3IL7QCI.js";import{O as j}from"../chunk-6GCCKYZC.js";import{a as F}from"../chunk-CBLKARLC.js";import{f as O}from"../chunk-EWC7I6UD.js";import"../chunk-52LSX2V5.js";var m="next",N=o=>typeof o=="object"&&o!==null&&typeof o.setHeader=="function"&&typeof o.status=="function"&&typeof o.send=="function",L=o=>{let p=new c({frameworkName:m,...o,handler:(h,R,d)=>{let n=R,i=e=>{let t=typeof n.headers.get=="function"?n.headers.get(e):n.headers[e];return Array.isArray(t)?t[0]:t};return{body:()=>typeof n.json=="function"?n.json():n.body,headers:i,method:()=>h||n.method||"",queryString:(e,t)=>{var a;let r=((a=n.query)==null?void 0:a[e])||t.searchParams.get(e);return Array.isArray(r)?r[0]:r},url:()=>{let e;try{e=new URL(n.url)}catch{}if(e){let s=i("host");if(s){let u=new URL(s.includes("://")?s:`${e.protocol}//${s}`);e.protocol=u.protocol,e.host=u.host,e.port=u.port,e.username=u.username,e.password=u.password}return e}let t="https",r=i("host")||"";try{(process.env.NODE_ENV==="development"||process.env.NODE_ENV==="dev")&&(t="http")}catch{}return new URL(n.url,`${t}://${r}`)},transformResponse:({body:e,headers:t,status:r})=>{if(N(d)){Object.entries(t).forEach(([s,u])=>{d.setHeader(s,u)}),d.status(r).send(e);return}let a=l();return new a(e,{status:r,headers:t})}}}}).createHandler(),f=p.bind(null,void 0);return Object.defineProperties(f,{GET:{value:p.bind(null,"GET")},POST:{value:p.bind(null,"POST")},OPTIONS:{value:p.bind(null,"OPTIONS")}})};export{q as Actions,S as Button,T as Card,w as CardLink,P as CardText,x as Client,O as CronExpression,A as Divider,c as NovuRequestHandler,E as Select,b as SelectOption,j as SeverityLevelEnum,v as TextInput,g as agent,m as frameworkName,F as providerSchemas,L as serve,G as step,k as workflow};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as h3 from 'h3';
|
|
2
2
|
import { H3Event } from 'h3';
|
|
3
|
-
import { S as ServeHandlerOptions } from '../index-
|
|
4
|
-
export { C as Client, N as NovuRequestHandler, w as workflow } from '../index-
|
|
5
|
-
export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-
|
|
6
|
-
export { C as ContextResolved, S as Subscriber, p as providerSchemas } from '../subscriber.types-
|
|
3
|
+
import { S as ServeHandlerOptions } from '../index-cfmN-nqZ.js';
|
|
4
|
+
export { A as Agent, a as AgentContext, b as AgentHandlers, c as AgentReaction, C as Client, F as FileRef, M as MessageContent, N as NovuRequestHandler, d as agent, w as workflow } from '../index-cfmN-nqZ.js';
|
|
5
|
+
export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-zMcfbkrA.js';
|
|
6
|
+
export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-B0sKq6v3.js';
|
|
7
7
|
import { S as SupportedFrameworkName } from '../server.types-BRWsA1CA.js';
|
|
8
|
+
export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
|
|
8
9
|
export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, step } from '../step-resolver.js';
|
|
9
10
|
import '../base.schema.types-BApIn9jr.js';
|
|
10
11
|
import 'json-schema-to-ts';
|
package/dist/esm/servers/nuxt.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as H,c as
|
|
1
|
+
import{b as H,c as S,d as i,e as y,f,g,h as N,i as w,j as c,k as x,l as E,m as t,n as b}from"../chunk-WUP5SBTV.js";import"../chunk-T2VIX2ZH.js";import{a as q}from"../chunk-2M25EATE.js";import"../chunk-U3IL7QCI.js";import{O}from"../chunk-6GCCKYZC.js";import{a as k}from"../chunk-CBLKARLC.js";import{f as l}from"../chunk-EWC7I6UD.js";import"../chunk-52LSX2V5.js";import{getHeader as o,getQuery as a,readBody as n,send as p,setHeaders as m}from"h3";var u="nuxt",C=d=>new t({frameworkName:u,...d,handler:r=>({queryString:e=>String(a(r)[e]),body:()=>n(r),headers:e=>o(r,e),url:()=>new URL(String(r.path),`${process.env.NODE_ENV==="development"?"http":"https"}://${String(o(r,"host"))}`),method:()=>r.method,transformResponse:e=>{let{res:s}=r.node;return s.statusCode=e.status,m(r,e.headers),p(r,e.body)}})}).createHandler();export{S as Actions,i as Button,y as Card,f as CardLink,g as CardText,H as Client,l as CronExpression,N as Divider,t as NovuRequestHandler,w as Select,c as SelectOption,O as SeverityLevelEnum,x as TextInput,E as agent,u as frameworkName,k as providerSchemas,C as serve,q as step,b as workflow};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { S as ServeHandlerOptions } from '../index-
|
|
2
|
-
export { C as Client, N as NovuRequestHandler, w as workflow } from '../index-
|
|
3
|
-
export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-
|
|
4
|
-
export { C as ContextResolved, S as Subscriber, p as providerSchemas } from '../subscriber.types-
|
|
1
|
+
import { S as ServeHandlerOptions } from '../index-cfmN-nqZ.js';
|
|
2
|
+
export { A as Agent, a as AgentContext, b as AgentHandlers, c as AgentReaction, C as Client, F as FileRef, M as MessageContent, N as NovuRequestHandler, d as agent, w as workflow } from '../index-cfmN-nqZ.js';
|
|
3
|
+
export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-zMcfbkrA.js';
|
|
4
|
+
export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-B0sKq6v3.js';
|
|
5
5
|
import { S as SupportedFrameworkName } from '../server.types-BRWsA1CA.js';
|
|
6
|
+
export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
|
|
6
7
|
export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, step } from '../step-resolver.js';
|
|
7
8
|
import '../base.schema.types-BApIn9jr.js';
|
|
8
9
|
import 'json-schema-to-ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t,b as h,c as
|
|
1
|
+
import{a as t,b as h,c as l,d as R,e as c,f as i,g as w,h as f,i as x,j as k,k as v,l as H,m as o,n as g}from"../chunk-WUP5SBTV.js";import"../chunk-T2VIX2ZH.js";import{a as y}from"../chunk-2M25EATE.js";import"../chunk-U3IL7QCI.js";import{O as S}from"../chunk-6GCCKYZC.js";import{a as N}from"../chunk-CBLKARLC.js";import{f as u}from"../chunk-EWC7I6UD.js";import"../chunk-52LSX2V5.js";var m="remix",O=s=>new o({frameworkName:m,...s,handler:({request:e})=>({body:()=>e.json(),headers:r=>e.headers.get(r),method:()=>e.method,url:()=>new URL(e.url,`https://${e.headers.get("host")||""}`),transformResponse:({body:r,status:n,headers:p})=>{let a=t();return new a(r,{status:n,headers:p})}})}).createHandler();export{l as Actions,R as Button,c as Card,i as CardLink,w as CardText,h as Client,u as CronExpression,f as Divider,o as NovuRequestHandler,x as Select,k as SelectOption,S as SeverityLevelEnum,v as TextInput,H as agent,m as frameworkName,N as providerSchemas,O as serve,y as step,g as workflow};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { RequestEvent } from '@sveltejs/kit';
|
|
2
|
-
import { S as ServeHandlerOptions } from '../index-
|
|
3
|
-
export { C as Client, N as NovuRequestHandler, w as workflow } from '../index-
|
|
4
|
-
export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-
|
|
5
|
-
export { C as ContextResolved, S as Subscriber, p as providerSchemas } from '../subscriber.types-
|
|
2
|
+
import { S as ServeHandlerOptions } from '../index-cfmN-nqZ.js';
|
|
3
|
+
export { A as Agent, a as AgentContext, b as AgentHandlers, c as AgentReaction, C as Client, F as FileRef, M as MessageContent, N as NovuRequestHandler, d as agent, w as workflow } from '../index-cfmN-nqZ.js';
|
|
4
|
+
export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-zMcfbkrA.js';
|
|
5
|
+
export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-B0sKq6v3.js';
|
|
6
6
|
import { S as SupportedFrameworkName } from '../server.types-BRWsA1CA.js';
|
|
7
|
+
export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
|
|
7
8
|
export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, step } from '../step-resolver.js';
|
|
8
9
|
import '../base.schema.types-BApIn9jr.js';
|
|
9
10
|
import 'json-schema-to-ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,b as E,c as
|
|
1
|
+
import{a as r,b as E,c as P,d as R,e as T,f as S,g as c,h as f,i as h,j as N,k as q,l as F,m as s,n as y}from"../chunk-WUP5SBTV.js";import"../chunk-T2VIX2ZH.js";import{a as G}from"../chunk-2M25EATE.js";import"../chunk-U3IL7QCI.js";import{O as w}from"../chunk-6GCCKYZC.js";import{a as b}from"../chunk-CBLKARLC.js";import{f as v}from"../chunk-EWC7I6UD.js";import"../chunk-52LSX2V5.js";var m="sveltekit",H=o=>{let t=new s({frameworkName:m,...o,handler:(u,e)=>({method:()=>u||e.request.method||"",body:()=>e.request.json(),headers:n=>e.request.headers.get(n),url:()=>{let n=process.env.NODE_ENV==="development"||process.env.NODE_ENV==="dev"?"http":"https";return new URL(e.request.url,`${n}://${e.request.headers.get("host")||""}`)},transformResponse:({body:n,headers:d,status:a})=>{let l=r();return new l(n,{status:a,headers:d})}})}).createHandler(),p=t.bind(null,void 0);return Object.defineProperties(p,{GET:{value:t.bind(null,"GET")},POST:{value:t.bind(null,"POST")},OPTIONS:{value:t.bind(null,"OPTIONS")}})};export{P as Actions,R as Button,T as Card,S as CardLink,c as CardText,E as Client,v as CronExpression,f as Divider,s as NovuRequestHandler,h as Select,N as SelectOption,w as SeverityLevelEnum,q as TextInput,F as agent,m as frameworkName,b as providerSchemas,H as serve,G as step,y as workflow};
|
|
@@ -1,93 +1,142 @@
|
|
|
1
|
-
import { S as Subscriber, C as ContextResolved,
|
|
2
|
-
export { a9 as channelStepSchemas } from './subscriber.types-
|
|
1
|
+
import { S as Subscriber, C as ContextResolved, E as EnvironmentSystemVariables, M as EmailOutputUnvalidated, g as Awaitable, p as providerSchemas, W as WithPassthrough, a2 as SmsOutputUnvalidated, l as ChatOutputUnvalidated, _ as PushOutputUnvalidated, Q as InAppOutputUnvalidated, u as DelayOutputUnvalidated, F as DigestOutputUnvalidated, a7 as ThrottleOutputUnvalidated } from './subscriber.types-B0sKq6v3.js';
|
|
2
|
+
export { a9 as actionStepSchemas, aa as channelStepSchemas } from './subscriber.types-B0sKq6v3.js';
|
|
3
3
|
import { S as Schema, a as FromSchema } from './base.schema.types-BApIn9jr.js';
|
|
4
4
|
import 'json-schema-to-ts';
|
|
5
5
|
import 'zod';
|
|
6
6
|
|
|
7
|
-
type StepResolverContext<TPayload extends Record<string, unknown> = Record<string, unknown>> = {
|
|
7
|
+
type StepResolverContext<TPayload extends Record<string, unknown> = Record<string, unknown>, TEnv extends Record<string, unknown> = Record<string, string>> = {
|
|
8
8
|
payload: TPayload;
|
|
9
9
|
subscriber: Subscriber;
|
|
10
10
|
context: ContextResolved;
|
|
11
11
|
steps: Record<string, unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* Environment variables defined in the Novu Dashboard, merged with built-in
|
|
14
|
+
* environment system variables (`name`, `type`).
|
|
15
|
+
*
|
|
16
|
+
* @example `env.name` — name of the current Novu environment
|
|
17
|
+
* @example `env.type` — type of the current Novu environment ("dev" | "prod")
|
|
18
|
+
* @example `env.MY_SECRET` — a user-defined environment variable
|
|
19
|
+
*/
|
|
20
|
+
env: TEnv & EnvironmentSystemVariables;
|
|
12
21
|
};
|
|
13
22
|
type ResolveControls<T extends Schema | undefined> = T extends Schema ? FromSchema<T> : Record<string, unknown>;
|
|
14
|
-
type
|
|
23
|
+
type ResolveEnv<T extends Schema | undefined> = T extends Schema ? FromSchema<T> : Record<string, string>;
|
|
24
|
+
type StepResolverProviders<T_StepType extends keyof typeof providerSchemas, T_Controls, T_Output, T_Payload extends Record<string, unknown> = Record<string, unknown>, T_Env extends Record<string, unknown> = Record<string, string>> = {
|
|
15
25
|
[K in keyof (typeof providerSchemas)[T_StepType]]?: (step: {
|
|
16
26
|
controls: T_Controls;
|
|
17
27
|
outputs: T_Output;
|
|
18
|
-
}, ctx: StepResolverContext<T_Payload>) => Awaitable<WithPassthrough<Record<string, unknown>>>;
|
|
28
|
+
}, ctx: StepResolverContext<T_Payload, T_Env>) => Awaitable<WithPassthrough<Record<string, unknown>>>;
|
|
19
29
|
};
|
|
20
|
-
type BaseStepResolverOptions<TControlSchema extends Schema | undefined, TPayloadSchema extends Schema | undefined> = {
|
|
30
|
+
type BaseStepResolverOptions<TControlSchema extends Schema | undefined, TPayloadSchema extends Schema | undefined, TEnvSchema extends Schema | undefined = undefined> = {
|
|
21
31
|
controlSchema?: TControlSchema;
|
|
22
32
|
payloadSchema?: TPayloadSchema;
|
|
23
|
-
|
|
33
|
+
envSchema?: TEnvSchema;
|
|
34
|
+
skip?: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Awaitable<boolean>;
|
|
24
35
|
};
|
|
25
|
-
type ChannelStepResolverOptions<T_StepType extends keyof typeof providerSchemas, TControlSchema extends Schema | undefined, TPayloadSchema extends Schema | undefined, T_Output extends Record<string, unknown
|
|
26
|
-
providers?: StepResolverProviders<T_StepType, ResolveControls<TControlSchema>, T_Output, ResolveControls<TPayloadSchema>>;
|
|
36
|
+
type ChannelStepResolverOptions<T_StepType extends keyof typeof providerSchemas, TControlSchema extends Schema | undefined, TPayloadSchema extends Schema | undefined, T_Output extends Record<string, unknown>, TEnvSchema extends Schema | undefined = undefined> = BaseStepResolverOptions<TControlSchema, TPayloadSchema, TEnvSchema> & {
|
|
37
|
+
providers?: StepResolverProviders<T_StepType, ResolveControls<TControlSchema>, T_Output, ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>;
|
|
27
38
|
disableOutputSanitization?: boolean;
|
|
28
39
|
};
|
|
29
|
-
type EmailStepResolver<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined> = {
|
|
40
|
+
type EmailStepResolver<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined> = {
|
|
30
41
|
type: 'email';
|
|
31
42
|
stepId: string;
|
|
32
|
-
resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>>) => Promise<EmailOutputUnvalidated>;
|
|
43
|
+
resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<EmailOutputUnvalidated>;
|
|
33
44
|
controlSchema?: TControlSchema;
|
|
34
45
|
payloadSchema?: TPayloadSchema;
|
|
35
|
-
|
|
36
|
-
|
|
46
|
+
envSchema?: TEnvSchema;
|
|
47
|
+
skip?: BaseStepResolverOptions<TControlSchema, TPayloadSchema, TEnvSchema>['skip'];
|
|
48
|
+
providers?: StepResolverProviders<'email', ResolveControls<TControlSchema>, EmailOutputUnvalidated, ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>;
|
|
37
49
|
disableOutputSanitization?: boolean;
|
|
38
50
|
};
|
|
39
|
-
type SmsStepResolver<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined> = {
|
|
51
|
+
type SmsStepResolver<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined> = {
|
|
40
52
|
type: 'sms';
|
|
41
53
|
stepId: string;
|
|
42
|
-
resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>>) => Promise<SmsOutputUnvalidated>;
|
|
54
|
+
resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<SmsOutputUnvalidated>;
|
|
43
55
|
controlSchema?: TControlSchema;
|
|
44
56
|
payloadSchema?: TPayloadSchema;
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
envSchema?: TEnvSchema;
|
|
58
|
+
skip?: BaseStepResolverOptions<TControlSchema, TPayloadSchema, TEnvSchema>['skip'];
|
|
59
|
+
providers?: StepResolverProviders<'sms', ResolveControls<TControlSchema>, SmsOutputUnvalidated, ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>;
|
|
47
60
|
disableOutputSanitization?: boolean;
|
|
48
61
|
};
|
|
49
|
-
type ChatStepResolver<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined> = {
|
|
62
|
+
type ChatStepResolver<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined> = {
|
|
50
63
|
type: 'chat';
|
|
51
64
|
stepId: string;
|
|
52
|
-
resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>>) => Promise<ChatOutputUnvalidated>;
|
|
65
|
+
resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<ChatOutputUnvalidated>;
|
|
53
66
|
controlSchema?: TControlSchema;
|
|
54
67
|
payloadSchema?: TPayloadSchema;
|
|
55
|
-
|
|
56
|
-
|
|
68
|
+
envSchema?: TEnvSchema;
|
|
69
|
+
skip?: BaseStepResolverOptions<TControlSchema, TPayloadSchema, TEnvSchema>['skip'];
|
|
70
|
+
providers?: StepResolverProviders<'chat', ResolveControls<TControlSchema>, ChatOutputUnvalidated, ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>;
|
|
57
71
|
disableOutputSanitization?: boolean;
|
|
58
72
|
};
|
|
59
|
-
type PushStepResolver<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined> = {
|
|
73
|
+
type PushStepResolver<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined> = {
|
|
60
74
|
type: 'push';
|
|
61
75
|
stepId: string;
|
|
62
|
-
resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>>) => Promise<PushOutputUnvalidated>;
|
|
76
|
+
resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<PushOutputUnvalidated>;
|
|
63
77
|
controlSchema?: TControlSchema;
|
|
64
78
|
payloadSchema?: TPayloadSchema;
|
|
65
|
-
|
|
66
|
-
|
|
79
|
+
envSchema?: TEnvSchema;
|
|
80
|
+
skip?: BaseStepResolverOptions<TControlSchema, TPayloadSchema, TEnvSchema>['skip'];
|
|
81
|
+
providers?: StepResolverProviders<'push', ResolveControls<TControlSchema>, PushOutputUnvalidated, ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>;
|
|
67
82
|
disableOutputSanitization?: boolean;
|
|
68
83
|
};
|
|
69
|
-
type InAppStepResolver<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined> = {
|
|
84
|
+
type InAppStepResolver<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined> = {
|
|
70
85
|
type: 'in_app';
|
|
71
86
|
stepId: string;
|
|
72
|
-
resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>>) => Promise<InAppOutputUnvalidated>;
|
|
87
|
+
resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<InAppOutputUnvalidated>;
|
|
73
88
|
controlSchema?: TControlSchema;
|
|
74
89
|
payloadSchema?: TPayloadSchema;
|
|
75
|
-
|
|
76
|
-
|
|
90
|
+
envSchema?: TEnvSchema;
|
|
91
|
+
skip?: BaseStepResolverOptions<TControlSchema, TPayloadSchema, TEnvSchema>['skip'];
|
|
92
|
+
providers?: StepResolverProviders<'in_app', ResolveControls<TControlSchema>, InAppOutputUnvalidated, ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>;
|
|
77
93
|
disableOutputSanitization?: boolean;
|
|
78
94
|
};
|
|
79
|
-
type
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
type DelayStepResolver<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined> = {
|
|
96
|
+
type: 'delay';
|
|
97
|
+
stepId: string;
|
|
98
|
+
resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<DelayOutputUnvalidated>;
|
|
99
|
+
controlSchema?: TControlSchema;
|
|
100
|
+
payloadSchema?: TPayloadSchema;
|
|
101
|
+
envSchema?: TEnvSchema;
|
|
102
|
+
skip?: BaseStepResolverOptions<TControlSchema, TPayloadSchema, TEnvSchema>['skip'];
|
|
103
|
+
};
|
|
104
|
+
type DigestStepResolver<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined> = {
|
|
105
|
+
type: 'digest';
|
|
106
|
+
stepId: string;
|
|
107
|
+
resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<DigestOutputUnvalidated>;
|
|
108
|
+
controlSchema?: TControlSchema;
|
|
109
|
+
payloadSchema?: TPayloadSchema;
|
|
110
|
+
envSchema?: TEnvSchema;
|
|
111
|
+
skip?: BaseStepResolverOptions<TControlSchema, TPayloadSchema, TEnvSchema>['skip'];
|
|
112
|
+
};
|
|
113
|
+
type ThrottleStepResolver<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined> = {
|
|
114
|
+
type: 'throttle';
|
|
115
|
+
stepId: string;
|
|
116
|
+
resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<ThrottleOutputUnvalidated>;
|
|
117
|
+
controlSchema?: TControlSchema;
|
|
118
|
+
payloadSchema?: TPayloadSchema;
|
|
119
|
+
envSchema?: TEnvSchema;
|
|
120
|
+
skip?: BaseStepResolverOptions<TControlSchema, TPayloadSchema, TEnvSchema>['skip'];
|
|
121
|
+
};
|
|
122
|
+
type AnyStepResolver = EmailStepResolver<Schema | undefined, Schema | undefined, Schema | undefined> | SmsStepResolver<Schema | undefined, Schema | undefined, Schema | undefined> | ChatStepResolver<Schema | undefined, Schema | undefined, Schema | undefined> | PushStepResolver<Schema | undefined, Schema | undefined, Schema | undefined> | InAppStepResolver<Schema | undefined, Schema | undefined, Schema | undefined> | DelayStepResolver<Schema | undefined, Schema | undefined, Schema | undefined> | DigestStepResolver<Schema | undefined, Schema | undefined, Schema | undefined> | ThrottleStepResolver<Schema | undefined, Schema | undefined, Schema | undefined>;
|
|
123
|
+
declare function email<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined>(stepId: string, resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<EmailOutputUnvalidated>, options?: ChannelStepResolverOptions<'email', TControlSchema, TPayloadSchema, EmailOutputUnvalidated, TEnvSchema>): EmailStepResolver<TControlSchema, TPayloadSchema, TEnvSchema>;
|
|
124
|
+
declare function sms<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined>(stepId: string, resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<SmsOutputUnvalidated>, options?: ChannelStepResolverOptions<'sms', TControlSchema, TPayloadSchema, SmsOutputUnvalidated, TEnvSchema>): SmsStepResolver<TControlSchema, TPayloadSchema, TEnvSchema>;
|
|
125
|
+
declare function chat<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined>(stepId: string, resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<ChatOutputUnvalidated>, options?: ChannelStepResolverOptions<'chat', TControlSchema, TPayloadSchema, ChatOutputUnvalidated, TEnvSchema>): ChatStepResolver<TControlSchema, TPayloadSchema, TEnvSchema>;
|
|
126
|
+
declare function push<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined>(stepId: string, resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<PushOutputUnvalidated>, options?: ChannelStepResolverOptions<'push', TControlSchema, TPayloadSchema, PushOutputUnvalidated, TEnvSchema>): PushStepResolver<TControlSchema, TPayloadSchema, TEnvSchema>;
|
|
127
|
+
declare function inApp<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined>(stepId: string, resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<InAppOutputUnvalidated>, options?: ChannelStepResolverOptions<'in_app', TControlSchema, TPayloadSchema, InAppOutputUnvalidated, TEnvSchema>): InAppStepResolver<TControlSchema, TPayloadSchema, TEnvSchema>;
|
|
128
|
+
declare function delay<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined>(stepId: string, resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<DelayOutputUnvalidated>, options?: BaseStepResolverOptions<TControlSchema, TPayloadSchema, TEnvSchema>): DelayStepResolver<TControlSchema, TPayloadSchema, TEnvSchema>;
|
|
129
|
+
declare function digest<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined>(stepId: string, resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<DigestOutputUnvalidated>, options?: BaseStepResolverOptions<TControlSchema, TPayloadSchema, TEnvSchema>): DigestStepResolver<TControlSchema, TPayloadSchema, TEnvSchema>;
|
|
130
|
+
declare function throttle<TControlSchema extends Schema | undefined = undefined, TPayloadSchema extends Schema | undefined = undefined, TEnvSchema extends Schema | undefined = undefined>(stepId: string, resolve: (controls: ResolveControls<TControlSchema>, ctx: StepResolverContext<ResolveControls<TPayloadSchema>, ResolveEnv<TEnvSchema>>) => Promise<ThrottleOutputUnvalidated>, options?: BaseStepResolverOptions<TControlSchema, TPayloadSchema, TEnvSchema>): ThrottleStepResolver<TControlSchema, TPayloadSchema, TEnvSchema>;
|
|
85
131
|
declare const step: {
|
|
86
132
|
email: typeof email;
|
|
87
133
|
sms: typeof sms;
|
|
88
134
|
chat: typeof chat;
|
|
89
135
|
push: typeof push;
|
|
90
136
|
inApp: typeof inApp;
|
|
137
|
+
delay: typeof delay;
|
|
138
|
+
digest: typeof digest;
|
|
139
|
+
throttle: typeof throttle;
|
|
91
140
|
};
|
|
92
141
|
|
|
93
|
-
export { type AnyStepResolver, type ChatStepResolver, ContextResolved, type EmailStepResolver, type InAppStepResolver, type PushStepResolver, type SmsStepResolver, type StepResolverContext, Subscriber, WithPassthrough, providerSchemas, step };
|
|
142
|
+
export { type AnyStepResolver, type ChatStepResolver, ContextResolved, type DelayStepResolver, type DigestStepResolver, type EmailStepResolver, type InAppStepResolver, type PushStepResolver, type SmsStepResolver, type StepResolverContext, Subscriber, type ThrottleStepResolver, WithPassthrough, providerSchemas, step };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as o}from"./chunk-2M25EATE.js";import{a as e,e as t,f as r}from"./chunk-CBLKARLC.js";import"./chunk-52LSX2V5.js";export{t as actionStepSchemas,r as channelStepSchemas,e as providerSchemas,o as step};
|
|
@@ -4559,6 +4559,17 @@ type Step = {
|
|
|
4559
4559
|
custom: CustomStep;
|
|
4560
4560
|
};
|
|
4561
4561
|
|
|
4562
|
+
/**
|
|
4563
|
+
* The environment system variables automatically injected into every workflow execution.
|
|
4564
|
+
* These are read-only variables derived from the Novu environment the workflow runs in.
|
|
4565
|
+
*/
|
|
4566
|
+
type EnvironmentSystemVariables = {
|
|
4567
|
+
/** The name of the environment (e.g. "Development", "Production"). */
|
|
4568
|
+
name: string;
|
|
4569
|
+
/** The type of the environment (e.g. "dev", "prod"). */
|
|
4570
|
+
type: 'dev' | 'prod';
|
|
4571
|
+
};
|
|
4572
|
+
|
|
4562
4573
|
type Subscriber = {
|
|
4563
4574
|
subscriberId?: string;
|
|
4564
4575
|
firstName?: string | null;
|
|
@@ -4570,4 +4581,4 @@ type Subscriber = {
|
|
|
4570
4581
|
data?: Record<string, unknown> | null;
|
|
4571
4582
|
};
|
|
4572
4583
|
|
|
4573
|
-
export { type
|
|
4584
|
+
export { type PushResult as $, ActionStepEnum as A, type DigestOutput as B, type ContextResolved as C, type DeepPartial as D, type EnvironmentSystemVariables as E, type DigestOutputUnvalidated as F, type DigestRegularOutput as G, type DigestRegularOutputUnvalidated as H, type DigestResult as I, type DigestTimedOutput as J, type DigestTimedOutputUnvalidated as K, type EmailOutput as L, type EmailOutputUnvalidated as M, type EmailResult as N, type InAppOutput as O, type PickRequiredKeys as P, type InAppOutputUnvalidated as Q, type InAppResult as R, type Subscriber as S, type Indexable as T, JobStatusEnum as U, type PickOptional as V, type WithPassthrough as W, type PickOptionalKeys as X, type PickRequired as Y, type PushOutput as Z, type PushOutputUnvalidated as _, type Either as a, type Skip as a0, type SmsOutput as a1, type SmsOutputUnvalidated as a2, type SmsResult as a3, type StepContext as a4, type StepOutput as a5, type ThrottleOutput as a6, type ThrottleOutputUnvalidated as a7, type ThrottleResult as a8, actionStepSchemas as a9, channelStepSchemas as aa, type ContextPayload as b, type ConditionalPartial as c, type Step as d, type Prettify as e, ChannelStepEnum as f, type Awaitable as g, type StepOptions as h, type ActionStep as i, type ChannelStep as j, type ChatOutput as k, type ChatOutputUnvalidated as l, type ChatResult as m, type ContextValue as n, type CustomStep as o, providerSchemas as p, type DeepRequired as q, type DelayDynamicOutput as r, type DelayDynamicOutputUnvalidated as s, type DelayOutput as t, type DelayOutputUnvalidated as u, type DelayRegularOutput as v, type DelayRegularOutputUnvalidated as w, type DelayResult as x, type DelayTimedOutput as y, type DelayTimedOutputUnvalidated as z };
|
package/dist/esm/validators.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-U3IL7QCI.js";import"./chunk-EWC7I6UD.js";import"./chunk-52LSX2V5.js";export{b as transformSchema,a as validateData};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novu/framework",
|
|
3
|
-
"version": "2.10.0",
|
|
3
|
+
"version": "2.10.1-alpha.0",
|
|
4
4
|
"description": "The Code-First Notifications Workflow SDK.",
|
|
5
5
|
"main": "./dist/cjs/index.cjs",
|
|
6
6
|
"types": "./dist/cjs/index.d.cts",
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
"remix",
|
|
27
27
|
"step-resolver",
|
|
28
28
|
"sveltekit",
|
|
29
|
+
"jsx-runtime",
|
|
30
|
+
"jsx-dev-runtime",
|
|
29
31
|
"validators",
|
|
30
32
|
"README.md"
|
|
31
33
|
],
|
|
@@ -58,6 +60,26 @@
|
|
|
58
60
|
"default": "./dist/esm/index.js"
|
|
59
61
|
}
|
|
60
62
|
},
|
|
63
|
+
"./jsx-runtime": {
|
|
64
|
+
"require": {
|
|
65
|
+
"types": "./dist/cjs/jsx-runtime.d.cts",
|
|
66
|
+
"default": "./dist/cjs/jsx-runtime.cjs"
|
|
67
|
+
},
|
|
68
|
+
"import": {
|
|
69
|
+
"types": "./dist/esm/jsx-runtime.d.ts",
|
|
70
|
+
"default": "./dist/esm/jsx-runtime.js"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"./jsx-dev-runtime": {
|
|
74
|
+
"require": {
|
|
75
|
+
"types": "./dist/cjs/jsx-dev-runtime.d.cts",
|
|
76
|
+
"default": "./dist/cjs/jsx-dev-runtime.cjs"
|
|
77
|
+
},
|
|
78
|
+
"import": {
|
|
79
|
+
"types": "./dist/esm/jsx-dev-runtime.d.ts",
|
|
80
|
+
"default": "./dist/esm/jsx-dev-runtime.js"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
61
83
|
"./express": {
|
|
62
84
|
"require": {
|
|
63
85
|
"types": "./dist/cjs/servers/express.d.cts",
|
|
@@ -227,7 +249,7 @@
|
|
|
227
249
|
"express": "^4.19.2",
|
|
228
250
|
"h3": "^1.11.1",
|
|
229
251
|
"madge": "^8.0.0",
|
|
230
|
-
"next": "^
|
|
252
|
+
"next": "^16.2.1",
|
|
231
253
|
"ts-node": "^10.9.2",
|
|
232
254
|
"tsup": "^8.0.2",
|
|
233
255
|
"tsx": "4.16.2",
|
|
@@ -237,6 +259,7 @@
|
|
|
237
259
|
"zod-to-json-schema": "^3.23.3"
|
|
238
260
|
},
|
|
239
261
|
"dependencies": {
|
|
262
|
+
"chat": "^4.25.0",
|
|
240
263
|
"ajv": "^8.18.0",
|
|
241
264
|
"ajv-formats": "^2.1.1",
|
|
242
265
|
"better-ajv-errors": "^1.2.0",
|
|
@@ -244,7 +267,7 @@
|
|
|
244
267
|
"cross-fetch": "^4.0.0",
|
|
245
268
|
"json-schema-to-ts": "^3.0.0",
|
|
246
269
|
"jsonrepair": "^3.13.1",
|
|
247
|
-
"liquidjs": "^10.25.
|
|
270
|
+
"liquidjs": "^10.25.5",
|
|
248
271
|
"pluralize": "^8.0.0",
|
|
249
272
|
"sanitize-html": "^2.13.0"
|
|
250
273
|
},
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { C as ClientOptions, W as Workflow, H as HealthCheck, D as DiscoverOutput, h as Event, m as ExecuteOutput, d as CodeResult, i as EventTriggerParams, l as Execute, s as WorkflowOptions } from './health-check.types-DwKatX-8.cjs';
|
|
2
|
-
import { f as Awaitable } from './subscriber.types-CftO3aFY.cjs';
|
|
3
|
-
import { S as Schema, a as FromSchema, F as FromSchemaUnvalidated } from './base.schema.types-BApIn9jr.cjs';
|
|
4
|
-
import './step-resolver.cjs';
|
|
5
|
-
|
|
6
|
-
declare class Client {
|
|
7
|
-
private discoveredWorkflows;
|
|
8
|
-
private discoverWorkflowPromises;
|
|
9
|
-
private templateEngine;
|
|
10
|
-
secretKey: string;
|
|
11
|
-
apiUrl: string;
|
|
12
|
-
version: string;
|
|
13
|
-
strictAuthentication: boolean;
|
|
14
|
-
verbose: boolean;
|
|
15
|
-
constructor(options?: ClientOptions);
|
|
16
|
-
private buildOptions;
|
|
17
|
-
private log;
|
|
18
|
-
/**
|
|
19
|
-
* Adds workflows to the client.
|
|
20
|
-
*
|
|
21
|
-
* A locking mechanism is used to ensure that duplicate workflows are not added.
|
|
22
|
-
*
|
|
23
|
-
* @param workflows - The workflows to add.
|
|
24
|
-
*/
|
|
25
|
-
addWorkflows(workflows: Array<Workflow>): Promise<void>;
|
|
26
|
-
private addWorkflow;
|
|
27
|
-
healthCheck(): HealthCheck;
|
|
28
|
-
private getWorkflow;
|
|
29
|
-
private getStep;
|
|
30
|
-
private getRegisteredWorkflows;
|
|
31
|
-
discover(): DiscoverOutput;
|
|
32
|
-
/**
|
|
33
|
-
* Mocks data based on the given schema.
|
|
34
|
-
* The `default` value in the schema is used as the base data.
|
|
35
|
-
* If no `default` value is provided, the data is generated using JSONSchemaFaker.
|
|
36
|
-
*
|
|
37
|
-
* @param schema
|
|
38
|
-
* @returns mocked data
|
|
39
|
-
*/
|
|
40
|
-
private mock;
|
|
41
|
-
private validate;
|
|
42
|
-
private throwInvalidProvider;
|
|
43
|
-
private throwInvalidStep;
|
|
44
|
-
private throwInvalidEvent;
|
|
45
|
-
private executeStepFactory;
|
|
46
|
-
private shouldSanitize;
|
|
47
|
-
private shouldSkip;
|
|
48
|
-
executeWorkflow(event: Event): Promise<ExecuteOutput>;
|
|
49
|
-
private createExecutionPayload;
|
|
50
|
-
private prettyPrintExecute;
|
|
51
|
-
private executeProviders;
|
|
52
|
-
private previewProvider;
|
|
53
|
-
private executeProvider;
|
|
54
|
-
private executeStep;
|
|
55
|
-
private compileControls;
|
|
56
|
-
/**
|
|
57
|
-
* Preprocesses standalone translation patterns.
|
|
58
|
-
* Transforms {{t.key}} to [T:key] placeholder (not Liquid syntax, passes through unchanged).
|
|
59
|
-
*/
|
|
60
|
-
private preprocessTranslationPatterns;
|
|
61
|
-
/**
|
|
62
|
-
* Preprocesses translation keys used as filter arguments.
|
|
63
|
-
* Transforms 't.key' to '[T:key]' placeholder (not Liquid syntax, passes through unchanged).
|
|
64
|
-
* Example: pluralize: 't.apple', 't.apples' → pluralize: '[T:apple]', '[T:apples]'
|
|
65
|
-
*/
|
|
66
|
-
private preprocessFilterTranslationArgs;
|
|
67
|
-
/**
|
|
68
|
-
* Post-processes placeholders back to translation markers after Liquid render.
|
|
69
|
-
* Transforms [T:key] back to {{t.key}} for the translation service.
|
|
70
|
-
*/
|
|
71
|
-
private postprocessTranslationMarkers;
|
|
72
|
-
/**
|
|
73
|
-
* Create the controls for a step, taking both the event controls and the default controls into account
|
|
74
|
-
*
|
|
75
|
-
* @param step The step to create the controls for
|
|
76
|
-
* @param event The event that triggered the step
|
|
77
|
-
* @returns The controls for the step
|
|
78
|
-
*/
|
|
79
|
-
private createStepControls;
|
|
80
|
-
private previewStep;
|
|
81
|
-
private constructStepForPreview;
|
|
82
|
-
private extractMockDataForPreviousSteps;
|
|
83
|
-
private previewRequiredStep;
|
|
84
|
-
private getStepState;
|
|
85
|
-
private getStepCode;
|
|
86
|
-
private getWorkflowCode;
|
|
87
|
-
getCode(workflowId: string, stepId?: string): CodeResult;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
type ServeHandlerOptions = {
|
|
91
|
-
client?: Client;
|
|
92
|
-
workflows: Array<Workflow>;
|
|
93
|
-
};
|
|
94
|
-
type INovuRequestHandlerOptions<Input extends any[] = any[], Output = any> = ServeHandlerOptions & {
|
|
95
|
-
frameworkName: string;
|
|
96
|
-
client?: Client;
|
|
97
|
-
workflows: Array<Workflow>;
|
|
98
|
-
handler: Handler<Input, Output>;
|
|
99
|
-
};
|
|
100
|
-
type Handler<Input extends any[] = any[], Output = any> = (...args: Input) => HandlerResponse<Output>;
|
|
101
|
-
type HandlerResponse<Output = any> = {
|
|
102
|
-
body: () => Awaitable<any>;
|
|
103
|
-
headers: (key: string) => Awaitable<string | null | undefined>;
|
|
104
|
-
method: () => Awaitable<string>;
|
|
105
|
-
queryString?: (key: string, url: URL) => Awaitable<string | null | undefined>;
|
|
106
|
-
url: () => Awaitable<URL>;
|
|
107
|
-
transformResponse: (res: IActionResponse<string>) => Output;
|
|
108
|
-
};
|
|
109
|
-
type IActionResponse<TBody extends string = string> = {
|
|
110
|
-
status: number;
|
|
111
|
-
headers: Record<string, string>;
|
|
112
|
-
body: TBody;
|
|
113
|
-
};
|
|
114
|
-
declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
|
|
115
|
-
readonly frameworkName: string;
|
|
116
|
-
readonly handler: Handler<Input, Output>;
|
|
117
|
-
readonly client: Client;
|
|
118
|
-
private readonly hmacEnabled;
|
|
119
|
-
private readonly http;
|
|
120
|
-
private readonly workflows;
|
|
121
|
-
constructor(options: INovuRequestHandlerOptions<Input, Output>);
|
|
122
|
-
createHandler(): (...args: Input) => Promise<Output>;
|
|
123
|
-
private getStaticHeaders;
|
|
124
|
-
private createResponse;
|
|
125
|
-
private createError;
|
|
126
|
-
private handleAction;
|
|
127
|
-
private getPostActionMap;
|
|
128
|
-
triggerAction(triggerEvent: EventTriggerParams): () => Promise<IActionResponse<string>>;
|
|
129
|
-
private getGetActionMap;
|
|
130
|
-
private handlePostAction;
|
|
131
|
-
private handleGetAction;
|
|
132
|
-
private handleError;
|
|
133
|
-
private validateHmac;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Define a new notification workflow.
|
|
138
|
-
*/
|
|
139
|
-
declare function workflow<T_PayloadSchema extends Schema, T_ControlSchema extends Schema, T_PayloadValidated extends Record<string, unknown> = FromSchema<T_PayloadSchema>, T_PayloadUnvalidated extends Record<string, unknown> = FromSchemaUnvalidated<T_PayloadSchema>, T_Controls extends Record<string, unknown> = FromSchema<T_ControlSchema>>(workflowId: string, execute: Execute<T_PayloadValidated, T_Controls>, workflowOptions?: WorkflowOptions<T_PayloadSchema, T_ControlSchema>): Workflow<T_PayloadUnvalidated>;
|
|
140
|
-
|
|
141
|
-
export { Client as C, type INovuRequestHandlerOptions as I, NovuRequestHandler as N, type ServeHandlerOptions as S, workflow as w };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as w,g as m,i as C,q as A,r as P,s as i,t as y,u as x,v as k}from"./chunk-LPE4ME2M.js";var N=class extends x{constructor(t){super("Unknown BridgeError",{cause:t});this.statusCode=500;this.code="BridgeError"}};var U=class extends i{constructor(t,n){super(`Workflow with id: \`${t}\` has a corrupt state. Step with id: \`${n}\` does not exist. Please provide the missing state.`);this.code="ExecutionStateCorruptError";this.data={workflowId:t,stepId:n}}},v=class extends i{constructor(t,n){super(`Workflow with id: \`${t}\` has invalid \`payload\`. Please provide the correct event payload.`);this.code="ExecutionEventPayloadInvalidError";this.data=n}},I=class extends i{constructor(t,n){super(`Workflow with id: \`${t}\` has invalid \`controls\`. Please provide the correct event controls.`);this.code="ExecutionEventControlInvalidError";this.data=n}},D=class extends i{constructor(t,n,r){super(`Workflow with id: \`${t}\` has an invalid state. Step with id: \`${n}\` has invalid \`controls\`. Please provide the correct step controls.`);this.code="ExecutionStateControlInvalidError";this.data=r}},F=class extends i{constructor(t,n,r){super(`Workflow with id: \`${t}\` has an invalid state. Step with id: \`${n}\` has invalid output. Please provide the correct step output.`);this.code="ExecutionStateOutputInvalidError";this.data=r}},$=class extends i{constructor(t,n,r){super(`Workflow with id: \`${t}\` has an invalid state. Step with id: \`${n}\` has invalid result. Please provide the correct step result.`);this.code="ExecutionStateResultInvalidError";this.data=r}},L=class extends i{constructor(t,n,r){super(`Workflow with id: \`${t}\` has invalid controls syntax in step with id: \`${n}\`. Please correct step control syntax.`);this.code="StepControlCompilationFailedError";this.data=r}},j=class extends i{constructor(t,n,r,p){super(`Workflow with id: \`${t}\` has an invalid state. Step with id: \`${n}\` and provider with id: \`${r}\` has invalid output. Please provide the correct provider output.`);this.code="ExecutionProviderOutputInvalidError";this.data=p}},W=class extends i{constructor(t,n){super(`Workflow with id: \`${t}\` has invalid \`payload\`. Please provide the correct payload.`);this.code="WorkflowPayloadInvalidError";this.data=n}};var q=e=>Object.values(m).includes(e==null?void 0:e.code),Me=e=>!q(e)&&typeof e.statusCode=="number"&&e.statusCode>=400&&e.statusCode<500;var E=e=>Object.values(e).map(o=>`\`${o}\``).join(", "),O=e=>e.replaceAll(/(\w)(\w*)/g,(o,t,n)=>t.toUpperCase()+n.toLowerCase()).replaceAll(/[\s-]+/g,"");var V=class extends A{constructor(){super(...arguments);this.code="MethodNotAllowedError";this.statusCode=405;this.message=`Method not allowed. Please use one of ${E(C)}`}},G=class extends i{constructor(t,n){super(`Invalid query string: \`action\`=\`${t}\`. Please use one of ${E(n)}`);this.code="InvalidActionError"}},K=class extends i{constructor(){super("Missing secret key. Set the `NOVU_SECRET_KEY` environment variable or pass `secretKey` to the client options.");this.code="MissingSecretKeyError"}};var M=class extends Error{constructor(o,t,n){super(),this.data={message:n},this.statusCode=o,this.code=t}};var f=class extends k{constructor(o,t){super(`${O(o)} with id: \`${t}\` already exists. Please use a different id.`)}},l=class extends P{constructor(o,t){super(`${O(o)} with id: \`${t}\` does not exist. Please provide a valid id.`)}},g=class extends x{constructor(t,n,r,p){super(`Failed to ${r} ${O(t)} with id: \`${n}\``,{cause:p});this.statusCode=502}};var H=class extends l{constructor(t){super("provider",t);this.code="ProviderNotFoundError"}},J=class extends g{constructor(t,n,r){super("provider",t,n,r);this.code="ProviderExecutionFailedError"}};var Y=class extends y{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"}},z=class extends y{constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");this.code="SignatureNotFoundError"}},Q=class extends y{constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");this.code="SignatureInvalidError"}},B=class extends y{constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);this.code="SignatureExpiredError"}},Z=class extends y{constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");this.code="SigningKeyNotFoundError"}},ee=class extends y{constructor(){super("Signature version is invalid. Please provide a signature version with version `v1` in the `novu-signature` header");this.code="SignatureVersionInvalidError"}};var te=class extends l{constructor(t){super("step",t);this.code="StepNotFoundError"}},oe=class extends f{constructor(t){super("step",t);this.code="StepAlreadyExistsError"}},re=class extends g{constructor(t,n,r){super("step",t,n,r);this.code="StepExecutionFailedError"}};var ne=class extends l{constructor(t){super("workflow",t);this.code="WorkflowNotFoundError"}},se=class extends f{constructor(t){super("workflow",t);this.code="WorkflowAlreadyExistsError"}};function Te(e,o){let t={...e};for(let n of Object.keys(o)){let r=o[n];r&&typeof r=="object"&&!Array.isArray(r)?t[n]=Te(t[n]||{},r):(Array.isArray(r),t[n]=r)}return t}function T(e,o){let t=o.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},e);if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);if(typeof t=="object"){let n=JSON.stringify(t);return n==="{}"?"":n}return""}function ae(e,o=2,t,n=", "){if(!Array.isArray(e)||e.length===0)return"";let r=t?e.map(s=>typeof s!="object"||!s?"":T(s,t)):e;if(r.length===1)return r[0];if(r.length===2)return`${r[0]} and ${r[1]}`;if(r.length===3&&o>=3)return`${r[0]}, ${n}${r[1]} and ${r[2]}`;let p=r.slice(0,o),d=r.length-o;return`${p.join(n)} and ${d} ${d===1?"other":"others"}`}import Ee from"pluralize";function pe(e,o="",t="",n="true"){if(e==null)return"";let r=0;if(Array.isArray(e)?r=e.length:typeof e=="object"?r=Object.keys(e).length:typeof e=="string"?r=+e:typeof e=="number"?r=e:r=Number(e),Number.isNaN(r)&&(r=0),r<=0)return"";let p;return t?p=r===1?o:t:p=Ee(o,r),n==="true"?`${r} ${p}`:p}import{TokenKind as ie}from"liquidjs";import _e from"pluralize";import{z as h}from"zod";var ce="",me=2,de="other",le=", ",he=" and ",Se=", and ",ue={0:"keyPath",1:"limit",2:"overflowSuffix",3:"wordsConnector",4:"twoWordsConnector",5:"lastWordConnector"};function ye(e,o=ce,t=me,n=de,r=le,p=he,d=Se){if(!Array.isArray(e)||e.length===0)return"";let s=o?e.map(c=>typeof c!="object"||!c?"":T(c,o)):e,u=s.length;if(u===1)return s[0];if(u===2)return`${s[0]}${p}${s[1]}`;if(t>=u){let c=s.slice(0,u-1),_=s[u-1];return`${c.join(r)}${d}${_}`}let a=s.slice(0,t),S=u-t,R=t===1?p:d;return`${a.join(r)}${R}${S} ${_e(n,S)}`}function Vt(e={},...o){let{requireKeyPath:t=!1}=e,n=[];if(o.length<1)return n.push({message:"Expected at least 1 argument",begin:0,end:0,value:""}),n;let r=h.object({keyPath:t?h.string().min(1,"must be non-empty"):h.string().optional().default(ce),limit:h.number().optional().default(me).refine(s=>s>=0,"must be greater than or equal to 0"),overflowSuffix:h.string().optional().default(de),wordsConnector:h.string().optional().default(le),twoWordsConnector:h.string().optional().default(he),lastWordConnector:h.string().optional().default(Se)}),p={};o.forEach((s,u)=>{if(!Array.isArray(s)){let a=s.getText();(s.kind===ie.Quoted||s.kind===ie.Number)&&(a=s.content);let S=ue[u];p[S]=a}});let d=r.safeParse(p);if(!d.success)for(let s of d.error.issues){let u="string";"type"in s&&(u=s.type);let a=s.path[0],S=Object.entries(ue).find(([_,Oe])=>Oe===a),R=S?parseInt(S[0],10):null,c=typeof R=="number"?o[R]:null;c&&!Array.isArray(c)&&n.push({message:`"toSentence" expects a ${u}${s.message?` that ${s.message}`:""} for argument "${a}"`,begin:c.begin,end:c.end,value:c.getText()})}return n}import{Liquid as we}from"liquidjs";function Ce(e){return Array.isArray(e)||typeof e=="object"&&e!==null?fe(e):typeof e=="string"?e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"):e==null?"":String(e)}var fe=(e,o=0)=>Array.isArray(e)||typeof e=="object"&&e!==null?JSON.stringify(e,null,o).replace(/"/g,"'").replace(/\n/g,"\\n"):e==null?"":String(e);function Yt(e){let o=new we({outputEscape:Ce,...e});return o.registerFilter("json",(t,n)=>fe(t,n)),o.registerFilter("digest",ae),o.registerFilter("toSentence",ye),o.registerFilter("pluralize",pe),o}var Ae={type:"object",properties:{type:{enum:["regular"]},amount:{type:"number"},unit:{type:"string",enum:["seconds","minutes","hours","days","weeks","months"]},extendToSchedule:{type:"boolean"}},required:["amount","unit"],additionalProperties:!1},Pe={type:"object",properties:{type:{enum:["timed"]},cron:{type:"string"},extendToSchedule:{type:"boolean"}},required:["cron"],additionalProperties:!1},ke={type:"object",properties:{type:{enum:["dynamic"]},dynamicKey:{type:"string"},extendToSchedule:{type:"boolean"}},required:["dynamicKey"],additionalProperties:!1},Ne={oneOf:[Ae,Pe,ke]},be={type:"object",properties:{duration:{type:"number"}},required:["duration"],additionalProperties:!1},ge={output:Ne,result:be};var Ue={type:"object",properties:{type:{enum:["regular"]},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},extendToSchedule:{type:"boolean"}},required:["amount","unit"],additionalProperties:!1},ve={type:"object",properties:{type:{enum:["timed"]},cron:{type:"string"},digestKey:{type:"string"},extendToSchedule:{type:"boolean"}},required:["cron"],additionalProperties:!1},Ie={oneOf:[Ue,ve]},De={type:"object",properties:{eventCount:{type:"number"},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},Re={output:Ie,result:De};var xe={output:{type:"object",properties:{type:{type:"string",enum:["fixed","dynamic"]},amount:{type:"number"},unit:{type:"string",enum:["minutes","hours","days"]},dynamicKey:{type:"string"},threshold:{type:"number"},throttleKey:{type:"string"}},required:["type"],additionalProperties:!1},result:{type:"object",properties:{throttled:{type:"boolean",description:"Whether the workflow execution was throttled"},executionCount:{type:"number",description:"Number of executions within the throttle window"},threshold:{type:"number",description:"The throttle threshold that was applied"},windowStart:{type:"string",format:"date-time",description:"Start time of the throttle window"}},required:["throttled"],additionalProperties:!1}};var ro={delay:ge,digest:Re,throttle:xe};var so={type:"object",properties:{},required:[],additionalProperties:!1};var Fe=(a=>(a.PENDING="pending",a.QUEUED="queued",a.RUNNING="running",a.COMPLETED="completed",a.FAILED="failed",a.DELAYED="delayed",a.CANCELED="canceled",a.MERGED="merged",a.SKIPPED="skipped",a))(Fe||{});var $e=(r=>(r.NONE="none",r.LOW="low",r.MEDIUM="medium",r.HIGH="high",r))($e||{});export{N as a,U as b,v as c,I as d,D as e,F as f,$ as g,L as h,j as i,W as j,q as k,Me as l,V as m,G as n,K as o,M as p,f as q,l as r,g as s,H as t,J as u,Y as v,z as w,Q as x,B as y,Z as z,ee as A,te as B,oe as C,re as D,ne as E,se as F,Te as G,ae as H,pe as I,ye as J,Vt as K,Yt as L,ge as M,Re as N,xe as O,ro as P,so as Q,Fe as R,$e as S};
|