@novu/framework 0.24.3-alpha.13 → 0.24.3-alpha.15

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.
@@ -1,6 +1,6 @@
1
1
  import { JSONSchema, FromSchema as FromSchema$1 } from 'json-schema-to-ts';
2
2
  import * as z from 'zod';
3
- import { TriggerRecipientsPayload, TriggerRecipientSubscriber, ITriggerPayload, ITenantDefine } from '@novu/shared';
3
+ import { TriggerEventStatusEnum, ITriggerPayload, TriggerRecipientSubscriber, ITenantDefine, TriggerRecipientsPayload } from '@novu/shared';
4
4
 
5
5
  type CodeResult = {
6
6
  code: string;
@@ -2645,37 +2645,6 @@ declare const channelStepSchemas: {
2645
2645
  };
2646
2646
  };
2647
2647
 
2648
- type Providers<T_StepType extends keyof typeof providerSchemas, T_Control, T_Output> = {
2649
- [K in keyof (typeof providerSchemas)[T_StepType]]: (step: {
2650
- /**
2651
- * The controls for the step.
2652
- *
2653
- * @deprecated Use `controls` instead
2654
- */
2655
- inputs: T_Control;
2656
- /**
2657
- * The controls for the step.
2658
- */
2659
- controls: T_Control;
2660
- /**
2661
- * The outputs of the step.
2662
- */
2663
- outputs: T_Output;
2664
- }) => Promise<FromSchema<(typeof providerSchemas)[T_StepType][K]['output']>>;
2665
- };
2666
-
2667
- /**
2668
- * A type that represents either `A` or `B`. Shared properties retain their
2669
- * types and unique properties are marked as optional.
2670
- */
2671
- type Either<A, B> = Partial<A> & Partial<B> & (A | B);
2672
- /**
2673
- * A type that represents a value that may be a promise or a regular value.
2674
- */
2675
- type Awaitable<T> = T | Promise<T>;
2676
-
2677
- type Skip<T> = (controls: T) => Awaitable<boolean>;
2678
-
2679
2648
  declare const actionStepSchemas: {
2680
2649
  delay: {
2681
2650
  output: {
@@ -2782,6 +2751,44 @@ declare const actionStepSchemas: {
2782
2751
  };
2783
2752
  };
2784
2753
 
2754
+ type Providers<T_StepType extends keyof typeof providerSchemas, T_Control, T_Output> = {
2755
+ [K in keyof (typeof providerSchemas)[T_StepType]]: (step: {
2756
+ /**
2757
+ * The controls for the step.
2758
+ *
2759
+ * @deprecated Use `controls` instead
2760
+ */
2761
+ inputs: T_Control;
2762
+ /**
2763
+ * The controls for the step.
2764
+ */
2765
+ controls: T_Control;
2766
+ /**
2767
+ * The outputs of the step.
2768
+ */
2769
+ outputs: T_Output;
2770
+ }) => Promise<FromSchema<(typeof providerSchemas)[T_StepType][K]['output']>>;
2771
+ };
2772
+
2773
+ /**
2774
+ * A type that represents either `A` or `B`. Shared properties retain their
2775
+ * types and unique properties are marked as optional.
2776
+ */
2777
+ type Either<A, B> = Partial<A> & Partial<B> & (A | B);
2778
+ /**
2779
+ * A type that represents a value that may be a promise or a regular value.
2780
+ */
2781
+ type Awaitable<T> = T | Promise<T>;
2782
+ /**
2783
+ * A type that represents a type that is a prettified version of the original type.
2784
+ * The prettified type has any generics removed from intellisense and displays a flat object.
2785
+ */
2786
+ type Prettify<T> = {
2787
+ [K in keyof T]: T[K];
2788
+ } & {};
2789
+
2790
+ type Skip<T> = (controls: T) => Awaitable<boolean>;
2791
+
2785
2792
  type StepOptions = {
2786
2793
  skip?: Skip<any>;
2787
2794
  inputSchema?: Schema;
@@ -3002,8 +3009,12 @@ type Step = {
3002
3009
  };
3003
3010
 
3004
3011
  type Subscriber = {
3012
+ subscriberId?: string;
3005
3013
  firstName?: string;
3006
3014
  lastName?: string;
3015
+ email?: string;
3016
+ phone?: string;
3017
+ avatar?: string;
3007
3018
  };
3008
3019
 
3009
3020
  /**
@@ -3046,6 +3057,87 @@ type WorkflowOptions<T_PayloadSchema, T_ControlSchema> = {
3046
3057
  controlSchema?: T_ControlSchema;
3047
3058
  };
3048
3059
 
3060
+ type EventPayload = ITriggerPayload & {};
3061
+ type Actor = TriggerRecipientSubscriber & {};
3062
+ type Tenant = ITenantDefine & Record<string, never>;
3063
+ type Recipients = TriggerRecipientsPayload & {};
3064
+ type EventTriggerResult = {
3065
+ /**
3066
+ * Cancel the workflow execution
3067
+ */
3068
+ cancel: () => Promise<CancelEventTriggerResponse>;
3069
+ /**
3070
+ * Response data for the trigger
3071
+ */
3072
+ data: EventTriggerResponse;
3073
+ };
3074
+ type EventTriggerParams<T_Payload = EventPayload> = {
3075
+ /**
3076
+ * Workflow id
3077
+ */
3078
+ workflowId: string;
3079
+ /**
3080
+ * Recipients to trigger the workflow to
3081
+ */
3082
+ to: Recipients;
3083
+ /**
3084
+ * Actor to trigger the workflow from
3085
+ */
3086
+ actor?: Actor;
3087
+ /**
3088
+ * Bridge url to trigger the workflow to
3089
+ */
3090
+ bridgeUrl?: string;
3091
+ /**
3092
+ * Payload to trigger the workflow with
3093
+ */
3094
+ payload: T_Payload;
3095
+ /**
3096
+ * Tenant to trigger the workflow with
3097
+ */
3098
+ tenant?: Tenant;
3099
+ /**
3100
+ * Transaction id for trigger
3101
+ */
3102
+ transactionId?: string;
3103
+ /**
3104
+ * Overrides for trigger
3105
+ */
3106
+ overrides?: Record<string, unknown>;
3107
+ /**
3108
+ * Controls for the step execution
3109
+ */
3110
+ controls?: {
3111
+ steps: {
3112
+ [stepId: string]: Record<string, unknown>;
3113
+ };
3114
+ };
3115
+ };
3116
+ type EventTriggerResponse = {
3117
+ /**
3118
+ * If trigger was acknowledged or not
3119
+ */
3120
+ acknowledged: boolean;
3121
+ /**
3122
+ * Status for trigger
3123
+ */
3124
+ status: `${TriggerEventStatusEnum}`;
3125
+ /**
3126
+ * Any errors encountered during the trigger
3127
+ */
3128
+ error?: string[];
3129
+ /**
3130
+ * Unique transaction identifier for the event
3131
+ */
3132
+ transactionId?: string;
3133
+ };
3134
+ /**
3135
+ * Flag indicating if the event was cancelled or not.
3136
+ * `false` indicates the event was not cancelled because the execution was completed.
3137
+ * `true` indicates the in-flight execution was cancelled.
3138
+ */
3139
+ type CancelEventTriggerResponse = boolean;
3140
+
3049
3141
  type StepType = `${ChannelStepEnum | ActionStepEnum}`;
3050
3142
  type DiscoverProviderOutput = {
3051
3143
  type: string;
@@ -3108,6 +3200,10 @@ type DiscoverWorkflowOutput = {
3108
3200
  unknownSchema: Schema;
3109
3201
  };
3110
3202
  };
3203
+ type Workflow<T_Payload = any> = {
3204
+ trigger: (event: Prettify<Omit<EventTriggerParams<T_Payload>, 'workflowId' | 'bridgeUrl' | 'controls'>>) => Promise<EventTriggerResult>;
3205
+ definition: DiscoverWorkflowOutput;
3206
+ };
3111
3207
  type DiscoverOutput = {
3112
3208
  workflows: Array<DiscoverWorkflowOutput>;
3113
3209
  };
@@ -3125,16 +3221,6 @@ type Event = {
3125
3221
  action: 'execute' | 'preview';
3126
3222
  subscriber: Subscriber;
3127
3223
  };
3128
- type TriggerEvent = {
3129
- workflowId: string;
3130
- to: TriggerRecipientsPayload;
3131
- actor?: TriggerRecipientSubscriber;
3132
- bridgeUrl?: string;
3133
- payload: ITriggerPayload;
3134
- tenant?: ITenantDefine;
3135
- transactionId?: string;
3136
- overrides?: Record<string, unknown>;
3137
- };
3138
3224
  type State = {
3139
3225
  stepId: string;
3140
3226
  outputs: any;
@@ -3178,7 +3264,7 @@ declare class Client {
3178
3264
  strictAuthentication: boolean;
3179
3265
  constructor(options?: ClientOptions);
3180
3266
  private buildOptions;
3181
- addWorkflows(workflows: Array<DiscoverWorkflowOutput>): void;
3267
+ addWorkflows(workflows: Array<Workflow>): void;
3182
3268
  healthCheck(): HealthCheck;
3183
3269
  private getWorkflow;
3184
3270
  private getStep;
@@ -3221,16 +3307,16 @@ declare class Client {
3221
3307
  getCode(workflowId: string, stepId?: string): CodeResult;
3222
3308
  }
3223
3309
 
3224
- interface ServeHandlerOptions {
3310
+ type ServeHandlerOptions = {
3225
3311
  client?: Client;
3226
- workflows: Array<DiscoverWorkflowOutput>;
3227
- }
3228
- interface INovuRequestHandlerOptions<Input extends any[] = any[], Output = any> extends ServeHandlerOptions {
3312
+ workflows: Array<Workflow>;
3313
+ };
3314
+ type INovuRequestHandlerOptions<Input extends any[] = any[], Output = any> = ServeHandlerOptions & {
3229
3315
  frameworkName: string;
3230
3316
  client?: Client;
3231
- workflows: Array<DiscoverWorkflowOutput>;
3317
+ workflows: Array<Workflow>;
3232
3318
  handler: Handler<Input, Output>;
3233
- }
3319
+ };
3234
3320
  type Handler<Input extends any[] = any[], Output = any> = (...args: Input) => HandlerResponse<Output>;
3235
3321
  type HandlerResponse<Output = any> = {
3236
3322
  body: () => Awaitable<any>;
@@ -3240,11 +3326,11 @@ type HandlerResponse<Output = any> = {
3240
3326
  url: () => Awaitable<URL>;
3241
3327
  transformResponse: (res: IActionResponse<string>) => Output;
3242
3328
  };
3243
- interface IActionResponse<TBody extends string = string> {
3329
+ type IActionResponse<TBody extends string = string> = {
3244
3330
  status: number;
3245
3331
  headers: Record<string, string>;
3246
3332
  body: TBody;
3247
- }
3333
+ };
3248
3334
  declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
3249
3335
  readonly frameworkName: string;
3250
3336
  readonly handler: Handler<Input, Output>;
@@ -3258,7 +3344,7 @@ declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
3258
3344
  private createError;
3259
3345
  private handleAction;
3260
3346
  private getPostActionMap;
3261
- triggerAction(triggerEvent: TriggerEvent): () => Promise<IActionResponse<string>>;
3347
+ triggerAction(triggerEvent: EventTriggerParams): () => Promise<IActionResponse<string>>;
3262
3348
  private getGetActionMap;
3263
3349
  private handlePostAction;
3264
3350
  private handleGetAction;
@@ -3268,4 +3354,4 @@ declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
3268
3354
  private hashHmac;
3269
3355
  }
3270
3356
 
3271
- export { type ActionStep as A, type digestRegularOutput as B, Client as C, type DiscoverWorkflowOutput as D, type Execute as E, type FromSchema as F, type digestTimedOutput as G, type HealthCheck as H, type InAppOutput as I, type JsonSchema as J, type DigestOutput as K, type DigestResult as L, type Step as M, NovuRequestHandler as N, type Subscriber as O, type PushOutput as P, type Either as Q, type Awaitable as R, type Schema as S, type TriggerEvent as T, type ExecuteInput as U, type Skip as V, type WorkflowOptions as W, ChannelStepEnum as X, ActionStepEnum as Y, type ServeHandlerOptions as a, type CodeResult as b, type ClientOptions as c, type StepType as d, type DiscoverProviderOutput as e, type DiscoverStepOutput as f, type DiscoverOutput as g, type Event as h, type State as i, type ExecuteOutputMetadata as j, type ExecuteOutput as k, type SupportedFrameworkName as l, type StepOptions as m, JobStatusEnum as n, type CustomStep as o, type ChannelStep as p, type EmailOutput as q, type EmailResult as r, type SmsOutput as s, type SmsResult as t, type PushResult as u, type ChatOutput as v, type ChatResult as w, type InAppResult as x, type DelayOutput as y, type DelayResult as z };
3357
+ export { type ExecuteInput as $, type ActionStep as A, type PushResult as B, Client as C, type DiscoverProviderOutput as D, type Execute as E, type FromSchema as F, type ChatOutput as G, type HealthCheck as H, type ChatResult as I, type JsonSchema as J, type InAppOutput as K, type InAppResult as L, type DelayOutput as M, NovuRequestHandler as N, type DelayResult as O, type PushOutput as P, type digestRegularOutput as Q, type digestTimedOutput as R, type Schema as S, type DigestOutput as T, type DigestResult as U, type Step as V, type WorkflowOptions as W, type Subscriber as X, type Either as Y, type Awaitable as Z, type Prettify as _, type Workflow as a, ChannelStepEnum as a0, ActionStepEnum as a1, type ServeHandlerOptions as b, type CodeResult as c, type ClientOptions as d, type StepType as e, type DiscoverStepOutput as f, type DiscoverWorkflowOutput as g, type DiscoverOutput as h, type EventTriggerResult as i, type EventTriggerParams as j, type EventTriggerResponse as k, type CancelEventTriggerResponse as l, type Event as m, type State as n, type ExecuteOutputMetadata as o, type ExecuteOutput as p, type SupportedFrameworkName as q, type Skip as r, type StepOptions as s, JobStatusEnum as t, type CustomStep as u, type ChannelStep as v, type EmailOutput as w, type EmailResult as x, type SmsOutput as y, type SmsResult as z };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,99 @@
1
- import { S as Schema, J as JsonSchema, F as FromSchema, E as Execute, W as WorkflowOptions, D as DiscoverWorkflowOutput } from './handler-PIXNhv7t.js';
2
- export { A as ActionStep, Y as ActionStepEnum, R as Awaitable, p as ChannelStep, X as ChannelStepEnum, v as ChatOutput, w as ChatResult, C as Client, c as ClientOptions, b as CodeResult, o as CustomStep, y as DelayOutput, z as DelayResult, K as DigestOutput, L as DigestResult, g as DiscoverOutput, e as DiscoverProviderOutput, f as DiscoverStepOutput, Q as Either, q as EmailOutput, r as EmailResult, h as Event, U as ExecuteInput, k as ExecuteOutput, j as ExecuteOutputMetadata, H as HealthCheck, I as InAppOutput, x as InAppResult, n as JobStatusEnum, N as NovuRequestHandler, P as PushOutput, u as PushResult, a as ServeHandlerOptions, V as Skip, s as SmsOutput, t as SmsResult, i as State, M as Step, m as StepOptions, d as StepType, O as Subscriber, l as SupportedFrameworkName, T as TriggerEvent, B as digestRegularOutput, G as digestTimedOutput } from './handler-PIXNhv7t.js';
1
+ import { S as Schema, J as JsonSchema, F as FromSchema, E as Execute, W as WorkflowOptions, a as Workflow } from './handler-Mor_4K8F.js';
2
+ export { A as ActionStep, a1 as ActionStepEnum, Z as Awaitable, l as CancelEventTriggerResponse, v as ChannelStep, a0 as ChannelStepEnum, G as ChatOutput, I as ChatResult, C as Client, d as ClientOptions, c as CodeResult, u as CustomStep, M as DelayOutput, O as DelayResult, T as DigestOutput, U as DigestResult, h as DiscoverOutput, D as DiscoverProviderOutput, f as DiscoverStepOutput, g as DiscoverWorkflowOutput, Y as Either, w as EmailOutput, x as EmailResult, m as Event, j as EventTriggerParams, k as EventTriggerResponse, i as EventTriggerResult, $ as ExecuteInput, p as ExecuteOutput, o as ExecuteOutputMetadata, H as HealthCheck, K as InAppOutput, L as InAppResult, t as JobStatusEnum, N as NovuRequestHandler, _ as Prettify, P as PushOutput, B as PushResult, b as ServeHandlerOptions, r as Skip, y as SmsOutput, z as SmsResult, n as State, V as Step, s as StepOptions, e as StepType, X as Subscriber, q as SupportedFrameworkName, Q as digestRegularOutput, R as digestTimedOutput } from './handler-Mor_4K8F.js';
3
3
  import { ValidateFunction as ValidateFunction$1 } from 'ajv';
4
4
  import { ParseReturnType } from 'zod';
5
5
  import 'json-schema-to-ts';
6
6
  import '@novu/shared';
7
7
 
8
+ /**
9
+ * Cron expression helper.
10
+ */
11
+ declare enum CronExpression {
12
+ EVERY_SECOND = "* * * * * *",
13
+ EVERY_5_SECONDS = "*/5 * * * * *",
14
+ EVERY_10_SECONDS = "*/10 * * * * *",
15
+ EVERY_30_SECONDS = "*/30 * * * * *",
16
+ EVERY_MINUTE = "*/1 * * * *",
17
+ EVERY_5_MINUTES = "0 */5 * * * *",
18
+ EVERY_10_MINUTES = "0 */10 * * * *",
19
+ EVERY_30_MINUTES = "0 */30 * * * *",
20
+ EVERY_HOUR = "0 0-23/1 * * *",
21
+ EVERY_2_HOURS = "0 0-23/2 * * *",
22
+ EVERY_3_HOURS = "0 0-23/3 * * *",
23
+ EVERY_4_HOURS = "0 0-23/4 * * *",
24
+ EVERY_5_HOURS = "0 0-23/5 * * *",
25
+ EVERY_6_HOURS = "0 0-23/6 * * *",
26
+ EVERY_7_HOURS = "0 0-23/7 * * *",
27
+ EVERY_8_HOURS = "0 0-23/8 * * *",
28
+ EVERY_9_HOURS = "0 0-23/9 * * *",
29
+ EVERY_10_HOURS = "0 0-23/10 * * *",
30
+ EVERY_11_HOURS = "0 0-23/11 * * *",
31
+ EVERY_12_HOURS = "0 0-23/12 * * *",
32
+ EVERY_DAY_AT_1AM = "0 01 * * *",
33
+ EVERY_DAY_AT_2AM = "0 02 * * *",
34
+ EVERY_DAY_AT_3AM = "0 03 * * *",
35
+ EVERY_DAY_AT_4AM = "0 04 * * *",
36
+ EVERY_DAY_AT_5AM = "0 05 * * *",
37
+ EVERY_DAY_AT_6AM = "0 06 * * *",
38
+ EVERY_DAY_AT_7AM = "0 07 * * *",
39
+ EVERY_DAY_AT_8AM = "0 08 * * *",
40
+ EVERY_DAY_AT_9AM = "0 09 * * *",
41
+ EVERY_DAY_AT_10AM = "0 10 * * *",
42
+ EVERY_DAY_AT_11AM = "0 11 * * *",
43
+ EVERY_DAY_AT_NOON = "0 12 * * *",
44
+ EVERY_DAY_AT_1PM = "0 13 * * *",
45
+ EVERY_DAY_AT_2PM = "0 14 * * *",
46
+ EVERY_DAY_AT_3PM = "0 15 * * *",
47
+ EVERY_DAY_AT_4PM = "0 16 * * *",
48
+ EVERY_DAY_AT_5PM = "0 17 * * *",
49
+ EVERY_DAY_AT_6PM = "0 18 * * *",
50
+ EVERY_DAY_AT_7PM = "0 19 * * *",
51
+ EVERY_DAY_AT_8PM = "0 20 * * *",
52
+ EVERY_DAY_AT_9PM = "0 21 * * *",
53
+ EVERY_DAY_AT_10PM = "0 22 * * *",
54
+ EVERY_DAY_AT_11PM = "0 23 * * *",
55
+ EVERY_DAY_AT_MIDNIGHT = "0 0 * * *",
56
+ EVERY_WEEK = "0 0 * * 0",
57
+ EVERY_WEEKDAY = "0 0 * * 1-5",
58
+ EVERY_WEEKEND = "0 0 * * 6,0",
59
+ EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT = "0 0 1 * *",
60
+ EVERY_1ST_DAY_OF_MONTH_AT_NOON = "0 12 1 * *",
61
+ EVERY_2ND_HOUR = "0 */2 * * *",
62
+ EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM = "0 1-23/2 * * *",
63
+ EVERY_2ND_MONTH = "0 0 1 */2 *",
64
+ EVERY_QUARTER = "0 0 1 */3 *",
65
+ EVERY_6_MONTHS = "0 0 1 */6 *",
66
+ EVERY_YEAR = "0 0 1 0 *",
67
+ EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM = "0 */30 9-17 * * *",
68
+ EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM = "0 */30 9-18 * * *",
69
+ EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM = "0 */30 10-19 * * *",
70
+ MONDAY_TO_FRIDAY_AT_1AM = "0 0 01 * * 1-5",
71
+ MONDAY_TO_FRIDAY_AT_2AM = "0 0 02 * * 1-5",
72
+ MONDAY_TO_FRIDAY_AT_3AM = "0 0 03 * * 1-5",
73
+ MONDAY_TO_FRIDAY_AT_4AM = "0 0 04 * * 1-5",
74
+ MONDAY_TO_FRIDAY_AT_5AM = "0 0 05 * * 1-5",
75
+ MONDAY_TO_FRIDAY_AT_6AM = "0 0 06 * * 1-5",
76
+ MONDAY_TO_FRIDAY_AT_7AM = "0 0 07 * * 1-5",
77
+ MONDAY_TO_FRIDAY_AT_8AM = "0 0 08 * * 1-5",
78
+ MONDAY_TO_FRIDAY_AT_9AM = "0 0 09 * * 1-5",
79
+ MONDAY_TO_FRIDAY_AT_09_30AM = "0 30 09 * * 1-5",
80
+ MONDAY_TO_FRIDAY_AT_10AM = "0 0 10 * * 1-5",
81
+ MONDAY_TO_FRIDAY_AT_11AM = "0 0 11 * * 1-5",
82
+ MONDAY_TO_FRIDAY_AT_11_30AM = "0 30 11 * * 1-5",
83
+ MONDAY_TO_FRIDAY_AT_12PM = "0 0 12 * * 1-5",
84
+ MONDAY_TO_FRIDAY_AT_1PM = "0 0 13 * * 1-5",
85
+ MONDAY_TO_FRIDAY_AT_2PM = "0 0 14 * * 1-5",
86
+ MONDAY_TO_FRIDAY_AT_3PM = "0 0 15 * * 1-5",
87
+ MONDAY_TO_FRIDAY_AT_4PM = "0 0 16 * * 1-5",
88
+ MONDAY_TO_FRIDAY_AT_5PM = "0 0 17 * * 1-5",
89
+ MONDAY_TO_FRIDAY_AT_6PM = "0 0 18 * * 1-5",
90
+ MONDAY_TO_FRIDAY_AT_7PM = "0 0 19 * * 1-5",
91
+ MONDAY_TO_FRIDAY_AT_8PM = "0 0 20 * * 1-5",
92
+ MONDAY_TO_FRIDAY_AT_9PM = "0 0 21 * * 1-5",
93
+ MONDAY_TO_FRIDAY_AT_10PM = "0 0 22 * * 1-5",
94
+ MONDAY_TO_FRIDAY_AT_11PM = "0 0 23 * * 1-5"
95
+ }
96
+
8
97
  declare enum PostActionEnum {
9
98
  TRIGGER = "trigger",
10
99
  EXECUTE = "execute",
@@ -48,7 +137,8 @@ declare enum ErrorCodeEnum {
48
137
  SIGNATURE_EXPIRED_ERROR = "SignatureExpiredError",
49
138
  SIGNING_KEY_NOT_FOUND_ERROR = "SigningKeyNotFoundError",
50
139
  PLATFORM_ERROR = "PlatformError",
51
- SIGNATURE_VERSION_INVALID_ERROR = "SignatureVersionInvalidError"
140
+ SIGNATURE_VERSION_INVALID_ERROR = "SignatureVersionInvalidError",
141
+ WORKFLOW_PAYLOAD_INVALID_ERROR = "WorkflowPayloadInvalidError"
52
142
  }
53
143
 
54
144
  declare enum HttpHeaderKeysEnum {
@@ -138,95 +228,6 @@ declare enum ResourceEnum {
138
228
  STEP = "step"
139
229
  }
140
230
 
141
- /**
142
- * Cron expression helper.
143
- */
144
- declare enum CronExpression {
145
- EVERY_SECOND = "* * * * * *",
146
- EVERY_5_SECONDS = "*/5 * * * * *",
147
- EVERY_10_SECONDS = "*/10 * * * * *",
148
- EVERY_30_SECONDS = "*/30 * * * * *",
149
- EVERY_MINUTE = "*/1 * * * *",
150
- EVERY_5_MINUTES = "0 */5 * * * *",
151
- EVERY_10_MINUTES = "0 */10 * * * *",
152
- EVERY_30_MINUTES = "0 */30 * * * *",
153
- EVERY_HOUR = "0 0-23/1 * * *",
154
- EVERY_2_HOURS = "0 0-23/2 * * *",
155
- EVERY_3_HOURS = "0 0-23/3 * * *",
156
- EVERY_4_HOURS = "0 0-23/4 * * *",
157
- EVERY_5_HOURS = "0 0-23/5 * * *",
158
- EVERY_6_HOURS = "0 0-23/6 * * *",
159
- EVERY_7_HOURS = "0 0-23/7 * * *",
160
- EVERY_8_HOURS = "0 0-23/8 * * *",
161
- EVERY_9_HOURS = "0 0-23/9 * * *",
162
- EVERY_10_HOURS = "0 0-23/10 * * *",
163
- EVERY_11_HOURS = "0 0-23/11 * * *",
164
- EVERY_12_HOURS = "0 0-23/12 * * *",
165
- EVERY_DAY_AT_1AM = "0 01 * * *",
166
- EVERY_DAY_AT_2AM = "0 02 * * *",
167
- EVERY_DAY_AT_3AM = "0 03 * * *",
168
- EVERY_DAY_AT_4AM = "0 04 * * *",
169
- EVERY_DAY_AT_5AM = "0 05 * * *",
170
- EVERY_DAY_AT_6AM = "0 06 * * *",
171
- EVERY_DAY_AT_7AM = "0 07 * * *",
172
- EVERY_DAY_AT_8AM = "0 08 * * *",
173
- EVERY_DAY_AT_9AM = "0 09 * * *",
174
- EVERY_DAY_AT_10AM = "0 10 * * *",
175
- EVERY_DAY_AT_11AM = "0 11 * * *",
176
- EVERY_DAY_AT_NOON = "0 12 * * *",
177
- EVERY_DAY_AT_1PM = "0 13 * * *",
178
- EVERY_DAY_AT_2PM = "0 14 * * *",
179
- EVERY_DAY_AT_3PM = "0 15 * * *",
180
- EVERY_DAY_AT_4PM = "0 16 * * *",
181
- EVERY_DAY_AT_5PM = "0 17 * * *",
182
- EVERY_DAY_AT_6PM = "0 18 * * *",
183
- EVERY_DAY_AT_7PM = "0 19 * * *",
184
- EVERY_DAY_AT_8PM = "0 20 * * *",
185
- EVERY_DAY_AT_9PM = "0 21 * * *",
186
- EVERY_DAY_AT_10PM = "0 22 * * *",
187
- EVERY_DAY_AT_11PM = "0 23 * * *",
188
- EVERY_DAY_AT_MIDNIGHT = "0 0 * * *",
189
- EVERY_WEEK = "0 0 * * 0",
190
- EVERY_WEEKDAY = "0 0 * * 1-5",
191
- EVERY_WEEKEND = "0 0 * * 6,0",
192
- EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT = "0 0 1 * *",
193
- EVERY_1ST_DAY_OF_MONTH_AT_NOON = "0 12 1 * *",
194
- EVERY_2ND_HOUR = "0 */2 * * *",
195
- EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM = "0 1-23/2 * * *",
196
- EVERY_2ND_MONTH = "0 0 1 */2 *",
197
- EVERY_QUARTER = "0 0 1 */3 *",
198
- EVERY_6_MONTHS = "0 0 1 */6 *",
199
- EVERY_YEAR = "0 0 1 0 *",
200
- EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM = "0 */30 9-17 * * *",
201
- EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM = "0 */30 9-18 * * *",
202
- EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM = "0 */30 10-19 * * *",
203
- MONDAY_TO_FRIDAY_AT_1AM = "0 0 01 * * 1-5",
204
- MONDAY_TO_FRIDAY_AT_2AM = "0 0 02 * * 1-5",
205
- MONDAY_TO_FRIDAY_AT_3AM = "0 0 03 * * 1-5",
206
- MONDAY_TO_FRIDAY_AT_4AM = "0 0 04 * * 1-5",
207
- MONDAY_TO_FRIDAY_AT_5AM = "0 0 05 * * 1-5",
208
- MONDAY_TO_FRIDAY_AT_6AM = "0 0 06 * * 1-5",
209
- MONDAY_TO_FRIDAY_AT_7AM = "0 0 07 * * 1-5",
210
- MONDAY_TO_FRIDAY_AT_8AM = "0 0 08 * * 1-5",
211
- MONDAY_TO_FRIDAY_AT_9AM = "0 0 09 * * 1-5",
212
- MONDAY_TO_FRIDAY_AT_09_30AM = "0 30 09 * * 1-5",
213
- MONDAY_TO_FRIDAY_AT_10AM = "0 0 10 * * 1-5",
214
- MONDAY_TO_FRIDAY_AT_11AM = "0 0 11 * * 1-5",
215
- MONDAY_TO_FRIDAY_AT_11_30AM = "0 30 11 * * 1-5",
216
- MONDAY_TO_FRIDAY_AT_12PM = "0 0 12 * * 1-5",
217
- MONDAY_TO_FRIDAY_AT_1PM = "0 0 13 * * 1-5",
218
- MONDAY_TO_FRIDAY_AT_2PM = "0 0 14 * * 1-5",
219
- MONDAY_TO_FRIDAY_AT_3PM = "0 0 15 * * 1-5",
220
- MONDAY_TO_FRIDAY_AT_4PM = "0 0 16 * * 1-5",
221
- MONDAY_TO_FRIDAY_AT_5PM = "0 0 17 * * 1-5",
222
- MONDAY_TO_FRIDAY_AT_6PM = "0 0 18 * * 1-5",
223
- MONDAY_TO_FRIDAY_AT_7PM = "0 0 19 * * 1-5",
224
- MONDAY_TO_FRIDAY_AT_8PM = "0 0 20 * * 1-5",
225
- MONDAY_TO_FRIDAY_AT_9PM = "0 0 21 * * 1-5",
226
- MONDAY_TO_FRIDAY_AT_10PM = "0 0 22 * * 1-5",
227
- MONDAY_TO_FRIDAY_AT_11PM = "0 0 23 * * 1-5"
228
- }
229
-
230
231
  type ValidateFunction<T = unknown> = ValidateFunction$1<T> | ((data: T) => ParseReturnType<T>);
231
232
  type ValidationError = {
232
233
  path: string;
@@ -248,6 +249,6 @@ interface Validator<T_Schema extends Schema> {
248
249
  /**
249
250
  * Define a new notification workflow.
250
251
  */
251
- declare function workflow<T_PayloadSchema extends Schema, T_ControlSchema extends Schema, T_Payload = FromSchema<T_PayloadSchema>, T_Control = FromSchema<T_ControlSchema>>(workflowId: string, execute: Execute<T_Payload, T_Control>, workflowOptions?: WorkflowOptions<T_PayloadSchema, T_ControlSchema>): DiscoverWorkflowOutput;
252
+ declare function workflow<T_PayloadSchema extends Schema, T_ControlSchema extends Schema, T_Payload = FromSchema<T_PayloadSchema>, T_Control = FromSchema<T_ControlSchema>>(workflowId: string, execute: Execute<T_Payload, T_Control>, workflowOptions?: WorkflowOptions<T_PayloadSchema, T_ControlSchema>): Workflow<T_Payload>;
252
253
 
253
- export { CronExpression, DiscoverWorkflowOutput, ErrorCodeEnum, Execute, FromSchema, GetActionEnum, HttpHeaderKeysEnum, HttpMethodEnum, HttpQueryKeysEnum, HttpStatusEnum, JsonSchema, NovuApiEndpointsEnum, PostActionEnum, RETRYABLE_ERROR_STATUS_CODES, ResourceEnum, SIGNATURE_TIMESTAMP_TOLERANCE, SIGNATURE_TIMESTAMP_TOLERANCE_MINUTES, Schema, type ValidateFunction, type ValidateResult, type ValidationError, type Validator, WorkflowOptions, workflow };
254
+ export { CronExpression, ErrorCodeEnum, Execute, FromSchema, GetActionEnum, HttpHeaderKeysEnum, HttpMethodEnum, HttpQueryKeysEnum, HttpStatusEnum, JsonSchema, NovuApiEndpointsEnum, PostActionEnum, RETRYABLE_ERROR_STATUS_CODES, ResourceEnum, SIGNATURE_TIMESTAMP_TOLERANCE, SIGNATURE_TIMESTAMP_TOLERANCE_MINUTES, Schema, type ValidateFunction, type ValidateResult, type ValidationError, type Validator, Workflow, WorkflowOptions, workflow };