@novu/framework 2.0.0-canary.6 → 2.0.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.
@@ -1,6 +1,6 @@
1
1
  import { JSONSchema, FromSchema as FromSchema$1 } from 'json-schema-to-ts';
2
2
  import zod from 'zod';
3
- import { TriggerEventStatusEnum, ITriggerPayload, TriggerRecipientSubscriber, ITenantDefine, TriggerRecipientsPayload } from '@novu/shared';
3
+ import { ChannelTypeEnum, TriggerEventStatusEnum, ITriggerPayload, TriggerRecipientSubscriber, TriggerRecipientsPayload } from '@novu/shared';
4
4
 
5
5
  type CodeResult = {
6
6
  code: string;
@@ -56,7 +56,41 @@ declare enum ActionStepEnum {
56
56
  }
57
57
 
58
58
  type JsonSchema = JSONSchema;
59
+ /**
60
+ * A schema used to validate a JSON object.
61
+ *
62
+ * Supported schemas:
63
+ * - JSONSchema
64
+ * - ZodSchema
65
+ */
59
66
  type Schema = JsonSchema | zod.ZodSchema;
67
+ /**
68
+ * Infer the type of a Schema for unvalidated data.
69
+ *
70
+ * The resulting type has default properties set to optional,
71
+ * reflecting the fact that the data is unvalidated and has
72
+ * not had default properties set.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * type MySchema = FromSchemaUnvalidated<typeof mySchema>;
77
+ * ```
78
+ */
79
+ type FromSchemaUnvalidated<T extends Schema> = T extends JSONSchema ? FromSchema$1<T, {
80
+ keepDefaultedPropertiesOptional: true;
81
+ }> : T extends zod.ZodSchema ? zod.input<T> : never;
82
+ /**
83
+ * Infer the type of a Schema for validated data.
84
+ *
85
+ * The resulting type has default properties set to required,
86
+ * reflecting the fact that the data has been validated and
87
+ * default properties have been set.
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * type MySchema = FromSchema<typeof mySchema>;
92
+ * ```
93
+ */
60
94
  type FromSchema<T extends Schema> = T extends JSONSchema ? FromSchema$1<T> : T extends zod.ZodSchema ? zod.infer<T> : never;
61
95
 
62
96
  declare const providerSchemas: {
@@ -3683,8 +3717,21 @@ declare const channelStepSchemas: {
3683
3717
  readonly label: {
3684
3718
  readonly type: "string";
3685
3719
  };
3686
- readonly url: {
3687
- readonly type: "string";
3720
+ readonly redirect: {
3721
+ readonly type: "object";
3722
+ readonly properties: {
3723
+ readonly url: {
3724
+ readonly type: "string";
3725
+ readonly format: "uri";
3726
+ };
3727
+ readonly target: {
3728
+ readonly type: "string";
3729
+ readonly enum: readonly ["_self", "_blank", "_parent", "_top", "_unfencedTop"];
3730
+ readonly default: "_blank";
3731
+ };
3732
+ };
3733
+ readonly required: readonly ["url"];
3734
+ readonly additionalProperties: false;
3688
3735
  };
3689
3736
  };
3690
3737
  readonly required: readonly ["label"];
@@ -3696,11 +3743,44 @@ declare const channelStepSchemas: {
3696
3743
  readonly label: {
3697
3744
  readonly type: "string";
3698
3745
  };
3746
+ readonly redirect: {
3747
+ readonly type: "object";
3748
+ readonly properties: {
3749
+ readonly url: {
3750
+ readonly type: "string";
3751
+ readonly format: "uri";
3752
+ };
3753
+ readonly target: {
3754
+ readonly type: "string";
3755
+ readonly enum: readonly ["_self", "_blank", "_parent", "_top", "_unfencedTop"];
3756
+ readonly default: "_blank";
3757
+ };
3758
+ };
3759
+ readonly required: readonly ["url"];
3760
+ readonly additionalProperties: false;
3761
+ };
3762
+ };
3763
+ readonly required: readonly ["label"];
3764
+ readonly additionalProperties: false;
3765
+ };
3766
+ readonly data: {
3767
+ readonly type: "object";
3768
+ readonly additionalProperties: true;
3769
+ };
3770
+ readonly redirect: {
3771
+ readonly type: "object";
3772
+ readonly properties: {
3699
3773
  readonly url: {
3700
3774
  readonly type: "string";
3775
+ readonly format: "uri";
3776
+ };
3777
+ readonly target: {
3778
+ readonly type: "string";
3779
+ readonly enum: readonly ["_self", "_blank", "_parent", "_top", "_unfencedTop"];
3780
+ readonly default: "_blank";
3701
3781
  };
3702
3782
  };
3703
- readonly required: readonly ["label"];
3783
+ readonly required: readonly ["url"];
3704
3784
  readonly additionalProperties: false;
3705
3785
  };
3706
3786
  };
@@ -3855,6 +3935,54 @@ type Awaitable<T> = T | Promise<T>;
3855
3935
  type Prettify<T> = {
3856
3936
  [K in keyof T]: T[K];
3857
3937
  } & {};
3938
+ /**
3939
+ * Mark properties of T as optional if Condition is true
3940
+ */
3941
+ type ConditionalPartial<T extends Obj, Condition extends boolean> = Condition extends true ? Partial<T> : T;
3942
+ /**
3943
+ * Same as Nullable except without `null`.
3944
+ */
3945
+ type Optional<T> = T | undefined;
3946
+ /**
3947
+ * Types that can be used to index native JavaScript types, (Object, Array, etc.).
3948
+ */
3949
+ type IndexSignature = string | number | symbol;
3950
+ /**
3951
+ * An object of any index-able type to avoid conflicts between `{}`, `Record`, `object`, etc.
3952
+ */
3953
+ type Obj<O extends Record<IndexSignature, unknown> | object = Record<IndexSignature, unknown> | object> = {
3954
+ [K in keyof O as K extends never ? never : K]: K extends never ? never : O[K] extends never ? never : O[K];
3955
+ } & Omit<O, never>;
3956
+ /**
3957
+ * Any type that is indexable using `string`, `number`, or `symbol`.
3958
+ */
3959
+ type Indexable<ValueTypes = unknown> = {
3960
+ [K: IndexSignature]: ValueTypes;
3961
+ } | Obj;
3962
+ /**
3963
+ * Picks only the optional properties from a type, removing the required ones.
3964
+ * Optionally, recurses through nested objects if `DEEP` is true.
3965
+ */
3966
+ type PickOptional<T, DEEP extends boolean = true> = {
3967
+ [K in keyof T as undefined extends T[K] ? K : never]: DEEP extends false ? T[K] : T[K] extends Optional<Indexable> ? PickOptional<T[K], DEEP> : T[K];
3968
+ };
3969
+ /**
3970
+ * Picks only the required fields out of a type, removing the optional ones.
3971
+ * Optionally, recurses through nested objects if `DEEP` is true.
3972
+ */
3973
+ type PickRequired<T, DEEP extends boolean = true> = {
3974
+ [K in keyof T as K extends keyof PickOptional<T, DEEP> ? never : K]: T[K] extends Indexable ? PickRequired<T[K], DEEP> : T[K];
3975
+ };
3976
+ /**
3977
+ * Picks only the required keys out of a type, removing the optional ones.
3978
+ * Optionally, recurses through nested objects if `DEEP` is true.
3979
+ */
3980
+ type PickRequiredKeys<T, DEEP extends boolean = true> = keyof PickRequired<T, DEEP>;
3981
+ /**
3982
+ * Picks only the optional keys out of a type, removing the required ones.
3983
+ * Optionally, recurses through nested objects if `DEEP` is true.
3984
+ */
3985
+ type PickOptionalKeys<T, DEEP extends boolean = true> = keyof PickOptional<T, DEEP>;
3858
3986
 
3859
3987
  type Passthrough = {
3860
3988
  body?: Record<string, unknown>;
@@ -3880,7 +4008,7 @@ type Providers<T_StepType extends keyof typeof providerSchemas, T_Controls, T_Ou
3880
4008
  * The outputs of the step.
3881
4009
  */
3882
4010
  outputs: T_Output;
3883
- }) => Awaitable<WithPassthrough<FromSchema<(typeof providerSchemas)[T_StepType][K]['output']>>>;
4011
+ }) => Awaitable<WithPassthrough<FromSchemaUnvalidated<(typeof providerSchemas)[T_StepType][K]['output']>>>;
3884
4012
  };
3885
4013
 
3886
4014
  type Skip<T> = (controls: T) => Awaitable<boolean>;
@@ -3964,17 +4092,21 @@ T_OutputsSchema extends Schema = Schema,
3964
4092
  /**
3965
4093
  * The controls for the step.
3966
4094
  */
3967
- T_Controls extends Record<string, unknown> = FromSchema<T_ControlSchema>,
4095
+ T_Controls extends Record<string, unknown> = FromSchema<T_ControlSchema>, T_IntermediaryResult extends Record<string, unknown> = FromSchema<T_OutputsSchema>, T_IntermediaryOutput extends Record<string, unknown> = FromSchemaUnvalidated<T_OutputsSchema>,
4096
+ /**
4097
+ * The output for the step.
4098
+ */
4099
+ T_Outputs extends T_IntermediaryOutput = T_IntermediaryOutput,
3968
4100
  /**
3969
4101
  * The result for the step.
3970
4102
  */
3971
- T_Intermediary extends Record<string, unknown> = FromSchema<T_OutputsSchema>, T_Outputs extends T_Intermediary = T_Intermediary, T_Result extends T_Intermediary = T_Intermediary>(
4103
+ T_Result extends T_IntermediaryResult = T_IntermediaryResult>(
3972
4104
  /**
3973
4105
  * The name of the step. This is used to identify the step in the workflow.
3974
4106
  */
3975
4107
  name: string,
3976
4108
  /**
3977
- * The function to resolve the step notification content for the step.
4109
+ * The function to resolve the custom data for the step.
3978
4110
  *
3979
4111
  * @param controls The controls for the step.
3980
4112
  */
@@ -4029,39 +4161,48 @@ options?: StepOptions<T_ControlSchema, T_Controls> & {
4029
4161
  providers?: Prettify<Providers<T_StepType, T_Controls, T_Outputs>>;
4030
4162
  }) => StepOutput<T_Result>;
4031
4163
  type EmailOutput = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.EMAIL]['output']>;
4164
+ type EmailOutputUnvalidated = FromSchemaUnvalidated<(typeof channelStepSchemas)[ChannelStepEnum.EMAIL]['output']>;
4032
4165
  type EmailResult = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.EMAIL]['result']>;
4033
4166
  type SmsOutput = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.SMS]['output']>;
4167
+ type SmsOutputUnvalidated = FromSchemaUnvalidated<(typeof channelStepSchemas)[ChannelStepEnum.SMS]['output']>;
4034
4168
  type SmsResult = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.SMS]['result']>;
4035
4169
  type PushOutput = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.PUSH]['output']>;
4170
+ type PushOutputUnvalidated = FromSchemaUnvalidated<(typeof channelStepSchemas)[ChannelStepEnum.PUSH]['output']>;
4036
4171
  type PushResult = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.PUSH]['result']>;
4037
4172
  type ChatOutput = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.CHAT]['output']>;
4173
+ type ChatOutputUnvalidated = FromSchemaUnvalidated<(typeof channelStepSchemas)[ChannelStepEnum.CHAT]['output']>;
4038
4174
  type ChatResult = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.CHAT]['result']>;
4039
4175
  type InAppOutput = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.IN_APP]['output']>;
4176
+ type InAppOutputUnvalidated = FromSchemaUnvalidated<(typeof channelStepSchemas)[ChannelStepEnum.IN_APP]['output']>;
4040
4177
  type InAppResult = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.IN_APP]['result']>;
4041
4178
  type DelayOutput = FromSchema<(typeof actionStepSchemas)[ActionStepEnum.DELAY]['output']>;
4179
+ type DelayOutputUnvalidated = FromSchemaUnvalidated<(typeof actionStepSchemas)[ActionStepEnum.DELAY]['output']>;
4042
4180
  type DelayResult = FromSchema<(typeof actionStepSchemas)[ActionStepEnum.DELAY]['result']>;
4043
- type digestRegularOutput = FromSchema<typeof digestRegularOutputSchema>;
4044
- type digestTimedOutput = FromSchema<typeof digestTimedOutputSchema>;
4181
+ type DigestRegularOutput = FromSchema<typeof digestRegularOutputSchema>;
4182
+ type DigestRegularOutputUnvalidated = FromSchemaUnvalidated<typeof digestRegularOutputSchema>;
4183
+ type DigestTimedOutput = FromSchema<typeof digestTimedOutputSchema>;
4184
+ type DigestTimedOutputUnvalidated = FromSchemaUnvalidated<typeof digestTimedOutputSchema>;
4045
4185
  type DigestOutput = FromSchema<(typeof actionStepSchemas)[ActionStepEnum.DIGEST]['output']>;
4186
+ type DigestOutputUnvalidated = FromSchemaUnvalidated<(typeof actionStepSchemas)[ActionStepEnum.DIGEST]['output']>;
4046
4187
  type DigestResult = FromSchema<(typeof actionStepSchemas)[ActionStepEnum.DIGEST]['result']>;
4047
4188
  /**
4048
4189
  * The step type.
4049
4190
  */
4050
4191
  type Step = {
4051
4192
  /** Send an email. */
4052
- email: ChannelStep<ChannelStepEnum.EMAIL, EmailOutput, EmailResult>;
4193
+ email: ChannelStep<ChannelStepEnum.EMAIL, EmailOutputUnvalidated, EmailResult>;
4053
4194
  /** Send an SMS. */
4054
- sms: ChannelStep<ChannelStepEnum.SMS, SmsOutput, SmsResult>;
4195
+ sms: ChannelStep<ChannelStepEnum.SMS, SmsOutputUnvalidated, SmsResult>;
4055
4196
  /** Send a push notification. */
4056
- push: ChannelStep<ChannelStepEnum.PUSH, PushOutput, PushResult>;
4197
+ push: ChannelStep<ChannelStepEnum.PUSH, PushOutputUnvalidated, PushResult>;
4057
4198
  /** Send a chat message. */
4058
- chat: ChannelStep<ChannelStepEnum.CHAT, ChatOutput, ChatResult>;
4199
+ chat: ChannelStep<ChannelStepEnum.CHAT, ChatOutputUnvalidated, ChatResult>;
4059
4200
  /** Send an in-app notification. */
4060
- inApp: ChannelStep<ChannelStepEnum.IN_APP, InAppOutput, InAppResult>;
4201
+ inApp: ChannelStep<ChannelStepEnum.IN_APP, InAppOutputUnvalidated, InAppResult>;
4061
4202
  /** Aggregate events for a period of time. */
4062
- digest: ActionStep<DigestOutput, DigestResult>;
4203
+ digest: ActionStep<DigestOutputUnvalidated, DigestResult>;
4063
4204
  /** Delay the workflow for a period of time. */
4064
- delay: ActionStep<DelayOutput, DelayResult>;
4205
+ delay: ActionStep<DelayOutputUnvalidated, DelayResult>;
4065
4206
  /** Execute custom code */
4066
4207
  custom: CustomStep;
4067
4208
  };
@@ -4101,6 +4242,16 @@ type ExecuteInput<T_Payload extends Record<string, unknown>, T_Controls extends
4101
4242
  * The function to execute the workflow.
4102
4243
  */
4103
4244
  type Execute<T_Payload extends Record<string, unknown>, T_Controls extends Record<string, unknown>> = (event: ExecuteInput<T_Payload, T_Controls>) => Promise<void>;
4245
+ type WorkflowOptionChannelPreference = {
4246
+ defaultValue?: boolean;
4247
+ readOnly?: boolean;
4248
+ };
4249
+ type WorkflowOptionsPreferences = {
4250
+ workflow?: WorkflowOptionChannelPreference;
4251
+ channels?: {
4252
+ [key in (typeof ChannelTypeEnum)[keyof typeof ChannelTypeEnum]]?: WorkflowOptionChannelPreference;
4253
+ };
4254
+ };
4104
4255
  /**
4105
4256
  * The options for the workflow.
4106
4257
  */
@@ -4114,12 +4265,12 @@ type WorkflowOptions<T_PayloadSchema extends Schema, T_ControlSchema extends Sch
4114
4265
  */
4115
4266
  inputSchema?: T_ControlSchema;
4116
4267
  controlSchema?: T_ControlSchema;
4268
+ preferences?: WorkflowOptionsPreferences;
4117
4269
  tags?: string[];
4118
4270
  };
4119
4271
 
4120
4272
  type EventPayload = ITriggerPayload & {};
4121
4273
  type Actor = TriggerRecipientSubscriber & {};
4122
- type Tenant = ITenantDefine & Record<string, never>;
4123
4274
  type Recipients = TriggerRecipientsPayload & {};
4124
4275
  type EventTriggerResult = {
4125
4276
  /**
@@ -4148,14 +4299,6 @@ type EventTriggerParams<T_Payload = EventPayload> = {
4148
4299
  * Bridge url to trigger the workflow to
4149
4300
  */
4150
4301
  bridgeUrl?: string;
4151
- /**
4152
- * Payload to trigger the workflow with
4153
- */
4154
- payload: T_Payload;
4155
- /**
4156
- * Tenant to trigger the workflow with
4157
- */
4158
- tenant?: Tenant;
4159
4302
  /**
4160
4303
  * Transaction id for trigger
4161
4304
  */
@@ -4172,7 +4315,12 @@ type EventTriggerParams<T_Payload = EventPayload> = {
4172
4315
  [stepId: string]: Record<string, unknown>;
4173
4316
  };
4174
4317
  };
4175
- };
4318
+ } & ConditionalPartial<{
4319
+ /**
4320
+ * Payload to trigger the workflow with
4321
+ */
4322
+ payload: T_Payload;
4323
+ }, PickRequiredKeys<T_Payload> extends never ? true : false>;
4176
4324
  type EventTriggerResponse = {
4177
4325
  /**
4178
4326
  * If trigger was acknowledged or not
@@ -4235,6 +4383,16 @@ type DiscoverStepOutput = {
4235
4383
  providers: Array<DiscoverProviderOutput>;
4236
4384
  options: StepOptions;
4237
4385
  };
4386
+ type ChannelPreference = {
4387
+ defaultValue: boolean;
4388
+ readOnly: boolean;
4389
+ };
4390
+ type DiscoverWorkflowOutputPreferences = {
4391
+ workflow: ChannelPreference;
4392
+ channels: {
4393
+ [key in (typeof ChannelTypeEnum)[keyof typeof ChannelTypeEnum]]: ChannelPreference;
4394
+ };
4395
+ };
4238
4396
  type DiscoverWorkflowOutput = {
4239
4397
  workflowId: string;
4240
4398
  execute: Execute<Record<string, unknown>, Record<string, unknown>>;
@@ -4259,6 +4417,7 @@ type DiscoverWorkflowOutput = {
4259
4417
  schema: JsonSchema;
4260
4418
  unknownSchema: Schema;
4261
4419
  };
4420
+ preferences: DiscoverWorkflowOutputPreferences;
4262
4421
  tags: string[];
4263
4422
  };
4264
4423
  type Workflow<T_Payload = any> = {
@@ -4419,4 +4578,4 @@ declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
4419
4578
  private hashHmac;
4420
4579
  }
4421
4580
 
4422
- export { type DigestOutput as $, ActionStepEnum as A, type ChannelStep as B, Client as C, type DiscoverProviderOutput as D, type Execute as E, type FromSchema as F, GetActionEnum as G, type HealthCheck as H, type EmailOutput as I, type JsonSchema as J, type EmailResult as K, type SmsOutput as L, type SmsResult as M, NovuRequestHandler as N, type PushOutput as O, PostActionEnum as P, type PushResult as Q, type ChatOutput as R, type Schema as S, type ChatResult as T, type InAppOutput as U, type InAppResult as V, type WorkflowOptions as W, type DelayOutput as X, type DelayResult as Y, type digestRegularOutput as Z, type digestTimedOutput as _, type Workflow as a, type DigestResult as a0, type Step as a1, type Subscriber as a2, type Either as a3, type Awaitable as a4, type Prettify as a5, type ExecuteInput as a6, type ServeHandlerOptions as b, ChannelStepEnum as c, type CodeResult as d, type ClientOptions as e, type StepType as f, type DiscoverStepOutput as g, type DiscoverWorkflowOutput as h, type DiscoverOutput as i, type EventTriggerResult as j, type EventTriggerParams as k, type EventTriggerResponse as l, type CancelEventTriggerResponse as m, type Event as n, type State as o, type ExecuteOutputMetadata as p, type ExecuteOutputOptions as q, type ExecuteOutput as r, type SupportedFrameworkName as s, type Skip as t, type StepOptions as u, JobStatusEnum as v, type StepContext as w, type StepOutput as x, type ActionStep as y, type CustomStep as z };
4581
+ export { type ChatResult as $, ActionStepEnum as A, type StepOutput as B, Client as C, type DiscoverProviderOutput as D, type Execute as E, type FromSchemaUnvalidated as F, GetActionEnum as G, type HealthCheck as H, type ActionStep as I, type JsonSchema as J, type CustomStep as K, type ChannelStep as L, type EmailOutput as M, NovuRequestHandler as N, type EmailOutputUnvalidated as O, PostActionEnum as P, type EmailResult as Q, type SmsOutput as R, type Schema as S, type SmsOutputUnvalidated as T, type SmsResult as U, type PushOutput as V, type WorkflowOptions as W, type PushOutputUnvalidated as X, type PushResult as Y, type ChatOutput as Z, type ChatOutputUnvalidated as _, type FromSchema as a, type InAppOutput as a0, type InAppOutputUnvalidated as a1, type InAppResult as a2, type DelayOutput as a3, type DelayOutputUnvalidated as a4, type DelayResult as a5, type DigestRegularOutput as a6, type DigestRegularOutputUnvalidated as a7, type DigestTimedOutput as a8, type DigestTimedOutputUnvalidated as a9, type DigestOutput as aa, type DigestOutputUnvalidated as ab, type DigestResult as ac, type Step as ad, type Subscriber as ae, type Either as af, type Awaitable as ag, type Prettify as ah, type ConditionalPartial as ai, type Indexable as aj, type PickOptional as ak, type PickRequired as al, type PickRequiredKeys as am, type PickOptionalKeys as an, type ExecuteInput as ao, type WorkflowOptionChannelPreference as ap, type WorkflowOptionsPreferences as aq, type Workflow as b, type ServeHandlerOptions as c, ChannelStepEnum as d, type CodeResult as e, type ClientOptions as f, type StepType as g, type DiscoverStepOutput as h, type ChannelPreference as i, type DiscoverWorkflowOutputPreferences as j, type DiscoverWorkflowOutput as k, type DiscoverOutput as l, type EventTriggerResult as m, type EventTriggerParams as n, type EventTriggerResponse as o, type CancelEventTriggerResponse as p, type Event as q, type State as r, type ExecuteOutputMetadata as s, type ExecuteOutputOptions as t, type ExecuteOutput as u, type SupportedFrameworkName as v, type Skip as w, type StepOptions as x, JobStatusEnum as y, type StepContext as z };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as Schema, J as JsonSchema, F as FromSchema, E as Execute, W as WorkflowOptions, a as Workflow } from './handler-908yagvL.js';
2
- export { y as ActionStep, A as ActionStepEnum, a4 as Awaitable, m as CancelEventTriggerResponse, B as ChannelStep, c as ChannelStepEnum, R as ChatOutput, T as ChatResult, C as Client, e as ClientOptions, d as CodeResult, z as CustomStep, X as DelayOutput, Y as DelayResult, $ as DigestOutput, a0 as DigestResult, i as DiscoverOutput, D as DiscoverProviderOutput, g as DiscoverStepOutput, h as DiscoverWorkflowOutput, a3 as Either, I as EmailOutput, K as EmailResult, n as Event, k as EventTriggerParams, l as EventTriggerResponse, j as EventTriggerResult, a6 as ExecuteInput, r as ExecuteOutput, p as ExecuteOutputMetadata, q as ExecuteOutputOptions, G as GetActionEnum, H as HealthCheck, U as InAppOutput, V as InAppResult, v as JobStatusEnum, N as NovuRequestHandler, P as PostActionEnum, a5 as Prettify, O as PushOutput, Q as PushResult, b as ServeHandlerOptions, t as Skip, L as SmsOutput, M as SmsResult, o as State, a1 as Step, w as StepContext, u as StepOptions, x as StepOutput, f as StepType, a2 as Subscriber, s as SupportedFrameworkName, Z as digestRegularOutput, _ as digestTimedOutput } from './handler-908yagvL.js';
1
+ import { S as Schema, F as FromSchemaUnvalidated, a as FromSchema, J as JsonSchema, E as Execute, W as WorkflowOptions, b as Workflow } from './handler-oPkwX3nf.js';
2
+ export { I as ActionStep, A as ActionStepEnum, ag as Awaitable, p as CancelEventTriggerResponse, i as ChannelPreference, L as ChannelStep, d as ChannelStepEnum, Z as ChatOutput, _ as ChatOutputUnvalidated, $ as ChatResult, C as Client, f as ClientOptions, e as CodeResult, ai as ConditionalPartial, K as CustomStep, a3 as DelayOutput, a4 as DelayOutputUnvalidated, a5 as DelayResult, aa as DigestOutput, ab as DigestOutputUnvalidated, a6 as DigestRegularOutput, a7 as DigestRegularOutputUnvalidated, ac as DigestResult, a8 as DigestTimedOutput, a9 as DigestTimedOutputUnvalidated, l as DiscoverOutput, D as DiscoverProviderOutput, h as DiscoverStepOutput, k as DiscoverWorkflowOutput, j as DiscoverWorkflowOutputPreferences, af as Either, M as EmailOutput, O as EmailOutputUnvalidated, Q as EmailResult, q as Event, n as EventTriggerParams, o as EventTriggerResponse, m as EventTriggerResult, ao as ExecuteInput, u as ExecuteOutput, s as ExecuteOutputMetadata, t as ExecuteOutputOptions, G as GetActionEnum, H as HealthCheck, a0 as InAppOutput, a1 as InAppOutputUnvalidated, a2 as InAppResult, aj as Indexable, y as JobStatusEnum, N as NovuRequestHandler, ak as PickOptional, an as PickOptionalKeys, al as PickRequired, am as PickRequiredKeys, P as PostActionEnum, ah as Prettify, V as PushOutput, X as PushOutputUnvalidated, Y as PushResult, c as ServeHandlerOptions, w as Skip, R as SmsOutput, T as SmsOutputUnvalidated, U as SmsResult, r as State, ad as Step, z as StepContext, x as StepOptions, B as StepOutput, g as StepType, ae as Subscriber, v as SupportedFrameworkName, ap as WorkflowOptionChannelPreference, aq as WorkflowOptionsPreferences } from './handler-oPkwX3nf.js';
3
3
  import { ValidateFunction as ValidateFunction$1 } from 'ajv';
4
4
  import { ParseReturnType } from 'zod';
5
5
  import 'json-schema-to-ts';
@@ -117,6 +117,7 @@ declare enum ErrorCodeEnum {
117
117
  EXECUTION_EVENT_PAYLOAD_INVALID_ERROR = "ExecutionEventPayloadInvalidError",
118
118
  EXECUTION_EVENT_CONTROL_INVALID_ERROR = "ExecutionEventControlInvalidError",
119
119
  EXECUTION_STATE_CONTROL_INVALID_ERROR = "ExecutionStateControlInvalidError",
120
+ STEP_CONTROL_COMPILATION_FAILED_ERROR = "StepControlCompilationFailedError",
120
121
  METHOD_NOT_ALLOWED_ERROR = "MethodNotAllowedError",
121
122
  INVALID_ACTION_ERROR = "InvalidActionError",
122
123
  MISSING_SECRET_KEY_ERROR = "MissingSecretKeyError",
@@ -232,15 +233,15 @@ type ValidateResult<T> = {
232
233
  success: true;
233
234
  data: T;
234
235
  };
235
- interface Validator<T_Schema extends Schema> {
236
- validate: <T_Data extends Record<string, unknown>>(data: T_Data, schema: T_Schema) => Promise<ValidateResult<T_Data>>;
237
- isSchema: (schema: Schema) => schema is T_Schema;
236
+ interface Validator<T_Schema extends Schema = Schema> {
237
+ validate: <T_Unvalidated extends Record<string, unknown> = FromSchemaUnvalidated<T_Schema>, T_Validated extends Record<string, unknown> = FromSchema<T_Schema>>(data: T_Unvalidated, schema: T_Schema) => Promise<ValidateResult<T_Validated>>;
238
+ canHandle: (schema: Schema) => schema is T_Schema;
238
239
  transformToJsonSchema: (schema: T_Schema) => JsonSchema;
239
240
  }
240
241
 
241
242
  /**
242
243
  * Define a new notification workflow.
243
244
  */
244
- declare function workflow<T_PayloadSchema extends Schema, T_ControlSchema extends Schema, T_Payload extends Record<string, unknown> = FromSchema<T_PayloadSchema>, T_Controls extends Record<string, unknown> = FromSchema<T_ControlSchema>>(workflowId: string, execute: Execute<T_Payload, T_Controls>, workflowOptions?: WorkflowOptions<T_PayloadSchema, T_ControlSchema>): Workflow<T_Payload>;
245
+ 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>;
245
246
 
246
- export { CronExpression, ErrorCodeEnum, Execute, FRAMEWORK_VERSION, FromSchema, HttpHeaderKeysEnum, HttpMethodEnum, HttpQueryKeysEnum, HttpStatusEnum, JsonSchema, NovuApiEndpointsEnum, RETRYABLE_ERROR_STATUS_CODES, ResourceEnum, SDK_VERSION, SIGNATURE_TIMESTAMP_TOLERANCE, SIGNATURE_TIMESTAMP_TOLERANCE_MINUTES, Schema, type ValidateFunction, type ValidateResult, type ValidationError, type Validator, Workflow, WorkflowOptions, workflow };
247
+ export { CronExpression, ErrorCodeEnum, Execute, FRAMEWORK_VERSION, FromSchema, FromSchemaUnvalidated, HttpHeaderKeysEnum, HttpMethodEnum, HttpQueryKeysEnum, HttpStatusEnum, JsonSchema, NovuApiEndpointsEnum, RETRYABLE_ERROR_STATUS_CODES, ResourceEnum, SDK_VERSION, SIGNATURE_TIMESTAMP_TOLERANCE, SIGNATURE_TIMESTAMP_TOLERANCE_MINUTES, Schema, type ValidateFunction, type ValidateResult, type ValidationError, type Validator, Workflow, WorkflowOptions, workflow };