@novu/framework 2.0.0-canary.5 → 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.
- package/dist/{handler-kv_Ed8ly.d.ts → handler-oPkwX3nf.d.ts} +190 -30
- package/dist/index.d.ts +8 -7
- package/dist/index.js +40 -40
- package/dist/servers/express.d.ts +1 -1
- package/dist/servers/express.js +16 -16
- package/dist/servers/h3.d.ts +1 -1
- package/dist/servers/h3.js +17 -17
- package/dist/servers/lambda.d.ts +1 -1
- package/dist/servers/lambda.js +15 -15
- package/dist/servers/next.d.ts +1 -1
- package/dist/servers/next.js +17 -17
- package/dist/servers/nuxt.d.ts +1 -1
- package/dist/servers/nuxt.js +17 -17
- package/dist/servers/remix.d.ts +1 -1
- package/dist/servers/remix.js +17 -17
- package/dist/servers/sveltekit.d.ts +1 -1
- package/dist/servers/sveltekit.js +15 -15
- package/package.json +4 -4
|
@@ -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,
|
|
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: {
|
|
@@ -409,7 +443,7 @@ declare const providerSchemas: {
|
|
|
409
443
|
readonly properties: {
|
|
410
444
|
readonly to: {
|
|
411
445
|
readonly type: "string";
|
|
412
|
-
readonly
|
|
446
|
+
readonly pattern: "^\\+[1-9]\\d{1,14}$";
|
|
413
447
|
readonly description: "The recipient's phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (for SMS/MMS) or [channel address](https://www.twilio.com/docs/messaging/channels), e.g. `whatsapp:+15552229999`.";
|
|
414
448
|
};
|
|
415
449
|
readonly statusCallback: {
|
|
@@ -494,7 +528,7 @@ declare const providerSchemas: {
|
|
|
494
528
|
};
|
|
495
529
|
readonly from: {
|
|
496
530
|
readonly type: "string";
|
|
497
|
-
readonly
|
|
531
|
+
readonly pattern: "^\\+[1-9]\\d{1,14}$";
|
|
498
532
|
readonly description: "The sender's Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/quickstart), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/en-us/messaging/channels/sms/short-codes), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messagingServiceSid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service's Sender Pool) or you can provide a specific sender from your Sender Pool.";
|
|
499
533
|
};
|
|
500
534
|
readonly messagingServiceSid: {
|
|
@@ -3683,8 +3717,21 @@ declare const channelStepSchemas: {
|
|
|
3683
3717
|
readonly label: {
|
|
3684
3718
|
readonly type: "string";
|
|
3685
3719
|
};
|
|
3686
|
-
readonly
|
|
3687
|
-
readonly type: "
|
|
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 ["
|
|
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<
|
|
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
|
-
|
|
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
|
|
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
|
|
4044
|
-
type
|
|
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,
|
|
4193
|
+
email: ChannelStep<ChannelStepEnum.EMAIL, EmailOutputUnvalidated, EmailResult>;
|
|
4053
4194
|
/** Send an SMS. */
|
|
4054
|
-
sms: ChannelStep<ChannelStepEnum.SMS,
|
|
4195
|
+
sms: ChannelStep<ChannelStepEnum.SMS, SmsOutputUnvalidated, SmsResult>;
|
|
4055
4196
|
/** Send a push notification. */
|
|
4056
|
-
push: ChannelStep<ChannelStepEnum.PUSH,
|
|
4197
|
+
push: ChannelStep<ChannelStepEnum.PUSH, PushOutputUnvalidated, PushResult>;
|
|
4057
4198
|
/** Send a chat message. */
|
|
4058
|
-
chat: ChannelStep<ChannelStepEnum.CHAT,
|
|
4199
|
+
chat: ChannelStep<ChannelStepEnum.CHAT, ChatOutputUnvalidated, ChatResult>;
|
|
4059
4200
|
/** Send an in-app notification. */
|
|
4060
|
-
inApp: ChannelStep<ChannelStepEnum.IN_APP,
|
|
4201
|
+
inApp: ChannelStep<ChannelStepEnum.IN_APP, InAppOutputUnvalidated, InAppResult>;
|
|
4061
4202
|
/** Aggregate events for a period of time. */
|
|
4062
|
-
digest: ActionStep<
|
|
4203
|
+
digest: ActionStep<DigestOutputUnvalidated, DigestResult>;
|
|
4063
4204
|
/** Delay the workflow for a period of time. */
|
|
4064
|
-
delay: ActionStep<
|
|
4205
|
+
delay: ActionStep<DelayOutputUnvalidated, DelayResult>;
|
|
4065
4206
|
/** Execute custom code */
|
|
4066
4207
|
custom: CustomStep;
|
|
4067
4208
|
};
|
|
@@ -4073,6 +4214,7 @@ type Subscriber = {
|
|
|
4073
4214
|
email?: string;
|
|
4074
4215
|
phone?: string;
|
|
4075
4216
|
avatar?: string;
|
|
4217
|
+
locale?: string;
|
|
4076
4218
|
};
|
|
4077
4219
|
|
|
4078
4220
|
/**
|
|
@@ -4100,6 +4242,16 @@ type ExecuteInput<T_Payload extends Record<string, unknown>, T_Controls extends
|
|
|
4100
4242
|
* The function to execute the workflow.
|
|
4101
4243
|
*/
|
|
4102
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
|
+
};
|
|
4103
4255
|
/**
|
|
4104
4256
|
* The options for the workflow.
|
|
4105
4257
|
*/
|
|
@@ -4113,12 +4265,12 @@ type WorkflowOptions<T_PayloadSchema extends Schema, T_ControlSchema extends Sch
|
|
|
4113
4265
|
*/
|
|
4114
4266
|
inputSchema?: T_ControlSchema;
|
|
4115
4267
|
controlSchema?: T_ControlSchema;
|
|
4268
|
+
preferences?: WorkflowOptionsPreferences;
|
|
4116
4269
|
tags?: string[];
|
|
4117
4270
|
};
|
|
4118
4271
|
|
|
4119
4272
|
type EventPayload = ITriggerPayload & {};
|
|
4120
4273
|
type Actor = TriggerRecipientSubscriber & {};
|
|
4121
|
-
type Tenant = ITenantDefine & Record<string, never>;
|
|
4122
4274
|
type Recipients = TriggerRecipientsPayload & {};
|
|
4123
4275
|
type EventTriggerResult = {
|
|
4124
4276
|
/**
|
|
@@ -4147,14 +4299,6 @@ type EventTriggerParams<T_Payload = EventPayload> = {
|
|
|
4147
4299
|
* Bridge url to trigger the workflow to
|
|
4148
4300
|
*/
|
|
4149
4301
|
bridgeUrl?: string;
|
|
4150
|
-
/**
|
|
4151
|
-
* Payload to trigger the workflow with
|
|
4152
|
-
*/
|
|
4153
|
-
payload: T_Payload;
|
|
4154
|
-
/**
|
|
4155
|
-
* Tenant to trigger the workflow with
|
|
4156
|
-
*/
|
|
4157
|
-
tenant?: Tenant;
|
|
4158
4302
|
/**
|
|
4159
4303
|
* Transaction id for trigger
|
|
4160
4304
|
*/
|
|
@@ -4171,7 +4315,12 @@ type EventTriggerParams<T_Payload = EventPayload> = {
|
|
|
4171
4315
|
[stepId: string]: Record<string, unknown>;
|
|
4172
4316
|
};
|
|
4173
4317
|
};
|
|
4174
|
-
}
|
|
4318
|
+
} & ConditionalPartial<{
|
|
4319
|
+
/**
|
|
4320
|
+
* Payload to trigger the workflow with
|
|
4321
|
+
*/
|
|
4322
|
+
payload: T_Payload;
|
|
4323
|
+
}, PickRequiredKeys<T_Payload> extends never ? true : false>;
|
|
4175
4324
|
type EventTriggerResponse = {
|
|
4176
4325
|
/**
|
|
4177
4326
|
* If trigger was acknowledged or not
|
|
@@ -4234,6 +4383,16 @@ type DiscoverStepOutput = {
|
|
|
4234
4383
|
providers: Array<DiscoverProviderOutput>;
|
|
4235
4384
|
options: StepOptions;
|
|
4236
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
|
+
};
|
|
4237
4396
|
type DiscoverWorkflowOutput = {
|
|
4238
4397
|
workflowId: string;
|
|
4239
4398
|
execute: Execute<Record<string, unknown>, Record<string, unknown>>;
|
|
@@ -4258,6 +4417,7 @@ type DiscoverWorkflowOutput = {
|
|
|
4258
4417
|
schema: JsonSchema;
|
|
4259
4418
|
unknownSchema: Schema;
|
|
4260
4419
|
};
|
|
4420
|
+
preferences: DiscoverWorkflowOutputPreferences;
|
|
4261
4421
|
tags: string[];
|
|
4262
4422
|
};
|
|
4263
4423
|
type Workflow<T_Payload = any> = {
|
|
@@ -4418,4 +4578,4 @@ declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
|
|
|
4418
4578
|
private hashHmac;
|
|
4419
4579
|
}
|
|
4420
4580
|
|
|
4421
|
-
export { type
|
|
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,
|
|
2
|
-
export {
|
|
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: <
|
|
237
|
-
|
|
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,
|
|
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 };
|