@novu/framework 0.24.3-alpha.5 → 0.24.3-alpha.7
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/README.md +1 -0
- package/dist/express.d.ts +2 -2
- package/dist/express.js +15 -18
- package/dist/h3.d.ts +2 -2
- package/dist/h3.js +15 -18
- package/dist/{handler-58kccf2b.d.ts → handler-VweGZ1Z4.d.ts} +228 -40
- package/dist/index.d.ts +4 -4
- package/dist/index.js +19 -22
- package/dist/next.d.ts +2 -2
- package/dist/next.js +15 -18
- package/dist/nuxt.d.ts +2 -2
- package/dist/nuxt.js +15 -18
- package/dist/remix.d.ts +2 -2
- package/dist/remix.js +15 -18
- package/dist/sveltekit.d.ts +2 -2
- package/dist/sveltekit.js +15 -18
- package/package.json +4 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { JSONSchema, FromSchema as FromSchema$1 } from 'json-schema-to-ts';
|
|
2
|
+
import { ZodSchema, infer } from 'zod';
|
|
3
3
|
|
|
4
4
|
declare enum HttpHeaderKeysEnum {
|
|
5
5
|
SIGNATURE = "x-novu-signature",
|
|
@@ -42,11 +42,6 @@ type ClientOptions = {
|
|
|
42
42
|
* The API key is used to sign the HMAC header.
|
|
43
43
|
*/
|
|
44
44
|
apiKey?: string;
|
|
45
|
-
/**
|
|
46
|
-
* Specify a custom Novu API URL.
|
|
47
|
-
* Defaults to 'https://api.novu.co'
|
|
48
|
-
*/
|
|
49
|
-
apiUrl?: string;
|
|
50
45
|
/**
|
|
51
46
|
* Explicitly use HMAC signature verification.
|
|
52
47
|
* Setting this to `false` will enable Novu to communicate with your Bridge API
|
|
@@ -61,7 +56,9 @@ type ClientOptions = {
|
|
|
61
56
|
strictAuthentication?: boolean;
|
|
62
57
|
};
|
|
63
58
|
|
|
64
|
-
type Schema = JSONSchema;
|
|
59
|
+
type Schema = JSONSchema | ZodSchema;
|
|
60
|
+
type JsonSchema = JSONSchema;
|
|
61
|
+
type FromSchema<T extends Schema> = T extends JSONSchema ? FromSchema$1<T> : T extends ZodSchema ? infer<T> : never;
|
|
65
62
|
|
|
66
63
|
declare const providerSchemas: {
|
|
67
64
|
chat: {
|
|
@@ -2428,7 +2425,7 @@ declare const delayResultSchema: {
|
|
|
2428
2425
|
readonly additionalProperties: false;
|
|
2429
2426
|
};
|
|
2430
2427
|
|
|
2431
|
-
declare const
|
|
2428
|
+
declare const digestRegularOutputSchema: {
|
|
2432
2429
|
readonly type: "object";
|
|
2433
2430
|
readonly properties: {
|
|
2434
2431
|
readonly amount: {
|
|
@@ -2438,10 +2435,85 @@ declare const digestOutputSchema: {
|
|
|
2438
2435
|
readonly type: "string";
|
|
2439
2436
|
readonly enum: readonly ["seconds", "minutes", "hours", "days", "weeks", "months"];
|
|
2440
2437
|
};
|
|
2438
|
+
readonly digestKey: {
|
|
2439
|
+
readonly type: "string";
|
|
2440
|
+
};
|
|
2441
|
+
readonly lookBackWindow: {
|
|
2442
|
+
readonly type: "object";
|
|
2443
|
+
readonly properties: {
|
|
2444
|
+
readonly amount: {
|
|
2445
|
+
readonly type: "number";
|
|
2446
|
+
};
|
|
2447
|
+
readonly unit: {
|
|
2448
|
+
readonly type: "string";
|
|
2449
|
+
readonly enum: readonly ["seconds", "minutes", "hours", "days", "weeks", "months"];
|
|
2450
|
+
};
|
|
2451
|
+
};
|
|
2452
|
+
readonly required: readonly ["amount", "unit"];
|
|
2453
|
+
readonly additionalProperties: false;
|
|
2454
|
+
};
|
|
2441
2455
|
};
|
|
2442
2456
|
readonly required: readonly ["amount", "unit"];
|
|
2443
2457
|
readonly additionalProperties: false;
|
|
2444
2458
|
};
|
|
2459
|
+
declare const digestTimedOutputSchema: {
|
|
2460
|
+
readonly type: "object";
|
|
2461
|
+
readonly properties: {
|
|
2462
|
+
readonly cron: {
|
|
2463
|
+
readonly type: "string";
|
|
2464
|
+
};
|
|
2465
|
+
readonly digestKey: {
|
|
2466
|
+
readonly type: "string";
|
|
2467
|
+
};
|
|
2468
|
+
};
|
|
2469
|
+
readonly required: readonly ["cron"];
|
|
2470
|
+
readonly additionalProperties: false;
|
|
2471
|
+
};
|
|
2472
|
+
declare const digestOutputSchema: {
|
|
2473
|
+
readonly oneOf: readonly [{
|
|
2474
|
+
readonly type: "object";
|
|
2475
|
+
readonly properties: {
|
|
2476
|
+
readonly amount: {
|
|
2477
|
+
readonly type: "number";
|
|
2478
|
+
};
|
|
2479
|
+
readonly unit: {
|
|
2480
|
+
readonly type: "string";
|
|
2481
|
+
readonly enum: readonly ["seconds", "minutes", "hours", "days", "weeks", "months"];
|
|
2482
|
+
};
|
|
2483
|
+
readonly digestKey: {
|
|
2484
|
+
readonly type: "string";
|
|
2485
|
+
};
|
|
2486
|
+
readonly lookBackWindow: {
|
|
2487
|
+
readonly type: "object";
|
|
2488
|
+
readonly properties: {
|
|
2489
|
+
readonly amount: {
|
|
2490
|
+
readonly type: "number";
|
|
2491
|
+
};
|
|
2492
|
+
readonly unit: {
|
|
2493
|
+
readonly type: "string";
|
|
2494
|
+
readonly enum: readonly ["seconds", "minutes", "hours", "days", "weeks", "months"];
|
|
2495
|
+
};
|
|
2496
|
+
};
|
|
2497
|
+
readonly required: readonly ["amount", "unit"];
|
|
2498
|
+
readonly additionalProperties: false;
|
|
2499
|
+
};
|
|
2500
|
+
};
|
|
2501
|
+
readonly required: readonly ["amount", "unit"];
|
|
2502
|
+
readonly additionalProperties: false;
|
|
2503
|
+
}, {
|
|
2504
|
+
readonly type: "object";
|
|
2505
|
+
readonly properties: {
|
|
2506
|
+
readonly cron: {
|
|
2507
|
+
readonly type: "string";
|
|
2508
|
+
};
|
|
2509
|
+
readonly digestKey: {
|
|
2510
|
+
readonly type: "string";
|
|
2511
|
+
};
|
|
2512
|
+
};
|
|
2513
|
+
readonly required: readonly ["cron"];
|
|
2514
|
+
readonly additionalProperties: false;
|
|
2515
|
+
}];
|
|
2516
|
+
};
|
|
2445
2517
|
declare const digestResultSchema: {
|
|
2446
2518
|
readonly type: "object";
|
|
2447
2519
|
readonly properties: {
|
|
@@ -2610,12 +2682,116 @@ type Awaitable<T> = T | Promise<T>;
|
|
|
2610
2682
|
|
|
2611
2683
|
type Skip<T> = (inputs: T) => Awaitable<boolean>;
|
|
2612
2684
|
|
|
2613
|
-
|
|
2614
|
-
|
|
2685
|
+
declare const actionStepSchemas: {
|
|
2686
|
+
delay: {
|
|
2687
|
+
output: {
|
|
2688
|
+
readonly type: "object";
|
|
2689
|
+
readonly properties: {
|
|
2690
|
+
readonly type: {
|
|
2691
|
+
readonly enum: readonly ["regular"];
|
|
2692
|
+
readonly default: "regular";
|
|
2693
|
+
};
|
|
2694
|
+
readonly amount: {
|
|
2695
|
+
readonly type: "number";
|
|
2696
|
+
};
|
|
2697
|
+
readonly unit: {
|
|
2698
|
+
readonly type: "string";
|
|
2699
|
+
readonly enum: readonly ["seconds", "minutes", "hours", "days", "weeks", "months"];
|
|
2700
|
+
};
|
|
2701
|
+
};
|
|
2702
|
+
readonly required: readonly ["amount", "unit"];
|
|
2703
|
+
readonly additionalProperties: false;
|
|
2704
|
+
};
|
|
2705
|
+
result: {
|
|
2706
|
+
readonly type: "object";
|
|
2707
|
+
readonly properties: {
|
|
2708
|
+
readonly duration: {
|
|
2709
|
+
readonly type: "number";
|
|
2710
|
+
};
|
|
2711
|
+
};
|
|
2712
|
+
readonly required: readonly ["duration"];
|
|
2713
|
+
readonly additionalProperties: false;
|
|
2714
|
+
};
|
|
2715
|
+
};
|
|
2716
|
+
digest: {
|
|
2717
|
+
output: {
|
|
2718
|
+
readonly oneOf: readonly [{
|
|
2719
|
+
readonly type: "object";
|
|
2720
|
+
readonly properties: {
|
|
2721
|
+
readonly amount: {
|
|
2722
|
+
readonly type: "number";
|
|
2723
|
+
};
|
|
2724
|
+
readonly unit: {
|
|
2725
|
+
readonly type: "string";
|
|
2726
|
+
readonly enum: readonly ["seconds", "minutes", "hours", "days", "weeks", "months"];
|
|
2727
|
+
};
|
|
2728
|
+
readonly digestKey: {
|
|
2729
|
+
readonly type: "string";
|
|
2730
|
+
};
|
|
2731
|
+
readonly lookBackWindow: {
|
|
2732
|
+
readonly type: "object";
|
|
2733
|
+
readonly properties: {
|
|
2734
|
+
readonly amount: {
|
|
2735
|
+
readonly type: "number";
|
|
2736
|
+
};
|
|
2737
|
+
readonly unit: {
|
|
2738
|
+
readonly type: "string";
|
|
2739
|
+
readonly enum: readonly ["seconds", "minutes", "hours", "days", "weeks", "months"];
|
|
2740
|
+
};
|
|
2741
|
+
};
|
|
2742
|
+
readonly required: readonly ["amount", "unit"];
|
|
2743
|
+
readonly additionalProperties: false;
|
|
2744
|
+
};
|
|
2745
|
+
};
|
|
2746
|
+
readonly required: readonly ["amount", "unit"];
|
|
2747
|
+
readonly additionalProperties: false;
|
|
2748
|
+
}, {
|
|
2749
|
+
readonly type: "object";
|
|
2750
|
+
readonly properties: {
|
|
2751
|
+
readonly cron: {
|
|
2752
|
+
readonly type: "string";
|
|
2753
|
+
};
|
|
2754
|
+
readonly digestKey: {
|
|
2755
|
+
readonly type: "string";
|
|
2756
|
+
};
|
|
2757
|
+
};
|
|
2758
|
+
readonly required: readonly ["cron"];
|
|
2759
|
+
readonly additionalProperties: false;
|
|
2760
|
+
}];
|
|
2761
|
+
};
|
|
2762
|
+
result: {
|
|
2763
|
+
readonly type: "object";
|
|
2764
|
+
readonly properties: {
|
|
2765
|
+
readonly events: {
|
|
2766
|
+
readonly type: "array";
|
|
2767
|
+
readonly items: {
|
|
2768
|
+
readonly type: "object";
|
|
2769
|
+
readonly properties: {
|
|
2770
|
+
readonly id: {
|
|
2771
|
+
readonly type: "string";
|
|
2772
|
+
};
|
|
2773
|
+
readonly time: {
|
|
2774
|
+
readonly type: "string";
|
|
2775
|
+
};
|
|
2776
|
+
readonly payload: {
|
|
2777
|
+
readonly type: "object";
|
|
2778
|
+
};
|
|
2779
|
+
};
|
|
2780
|
+
readonly required: readonly ["id", "time", "payload"];
|
|
2781
|
+
readonly additionalProperties: false;
|
|
2782
|
+
};
|
|
2783
|
+
};
|
|
2784
|
+
};
|
|
2785
|
+
readonly required: readonly ["events"];
|
|
2786
|
+
readonly additionalProperties: false;
|
|
2787
|
+
};
|
|
2788
|
+
};
|
|
2789
|
+
};
|
|
2790
|
+
|
|
2791
|
+
type StepOptions = {
|
|
2792
|
+
skip?: Skip<any>;
|
|
2615
2793
|
inputSchema?: Schema;
|
|
2616
|
-
|
|
2617
|
-
providers?: Record<string, (payload: unknown) => unknown | Promise<unknown>>;
|
|
2618
|
-
preferences?: (input: unknown) => Promise<Record<string, unknown>>;
|
|
2794
|
+
providers?: Record<string, (payload: any) => Awaitable<any>>;
|
|
2619
2795
|
};
|
|
2620
2796
|
declare enum JobStatusEnum {
|
|
2621
2797
|
PENDING = "pending",
|
|
@@ -2643,7 +2819,19 @@ type StepContext = {
|
|
|
2643
2819
|
};
|
|
2644
2820
|
};
|
|
2645
2821
|
type StepOutput<T_Result> = Promise<T_Result & StepContext>;
|
|
2646
|
-
type ActionStep<T_Outputs, T_Result> =
|
|
2822
|
+
type ActionStep<T_Outputs, T_Result> = <
|
|
2823
|
+
/**
|
|
2824
|
+
* The schema for the inputs of the step.
|
|
2825
|
+
*/
|
|
2826
|
+
T_InputSchema extends Schema,
|
|
2827
|
+
/**
|
|
2828
|
+
* The inputs for the step.
|
|
2829
|
+
*/
|
|
2830
|
+
T_Inputs = FromSchema<T_InputSchema>>(name: string, resolve: (inputs: T_Inputs) => Awaitable<T_Outputs>, options?: {
|
|
2831
|
+
skip?: Skip<T_Inputs>;
|
|
2832
|
+
inputSchema?: T_InputSchema;
|
|
2833
|
+
providers?: Record<string, (payload: unknown) => Awaitable<unknown>>;
|
|
2834
|
+
}) => StepOutput<T_Result>;
|
|
2647
2835
|
type CustomStep = <
|
|
2648
2836
|
/**
|
|
2649
2837
|
* The schema for the inputs of the step.
|
|
@@ -2747,6 +2935,12 @@ type ChatOutput = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.CHAT]['
|
|
|
2747
2935
|
type ChatResult = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.CHAT]['result']>;
|
|
2748
2936
|
type InAppOutput = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.IN_APP]['output']>;
|
|
2749
2937
|
type InAppResult = FromSchema<(typeof channelStepSchemas)[ChannelStepEnum.IN_APP]['result']>;
|
|
2938
|
+
type DelayOutput = FromSchema<(typeof actionStepSchemas)[ActionStepEnum.DELAY]['output']>;
|
|
2939
|
+
type DelayResult = FromSchema<(typeof actionStepSchemas)[ActionStepEnum.DELAY]['result']>;
|
|
2940
|
+
type digestRegularOutput = FromSchema<typeof digestRegularOutputSchema>;
|
|
2941
|
+
type digestTimedOutput = FromSchema<typeof digestTimedOutputSchema>;
|
|
2942
|
+
type DigestOutput = FromSchema<(typeof actionStepSchemas)[ActionStepEnum.DIGEST]['output']>;
|
|
2943
|
+
type DigestResult = FromSchema<(typeof actionStepSchemas)[ActionStepEnum.DIGEST]['result']>;
|
|
2750
2944
|
/**
|
|
2751
2945
|
* The step type.
|
|
2752
2946
|
*/
|
|
@@ -2804,35 +2998,34 @@ type WorkflowOptions<T_PayloadSchema, T_InputSchema> = {
|
|
|
2804
2998
|
};
|
|
2805
2999
|
|
|
2806
3000
|
type StepType = `${ChannelStepEnum | ActionStepEnum}`;
|
|
2807
|
-
type Validate = ValidateFunction;
|
|
2808
3001
|
type DiscoverProviderOutput = {
|
|
2809
3002
|
type: string;
|
|
2810
3003
|
code: string;
|
|
2811
|
-
resolve: (
|
|
3004
|
+
resolve: (inputs: unknown) => Awaitable<unknown>;
|
|
2812
3005
|
outputs: {
|
|
2813
|
-
schema:
|
|
2814
|
-
|
|
3006
|
+
schema: JsonSchema;
|
|
3007
|
+
unknownSchema: Schema;
|
|
2815
3008
|
};
|
|
2816
3009
|
};
|
|
2817
3010
|
type DiscoverStepOutput = {
|
|
2818
3011
|
stepId: string;
|
|
2819
3012
|
type: StepType;
|
|
2820
3013
|
inputs: {
|
|
2821
|
-
schema:
|
|
2822
|
-
|
|
3014
|
+
schema: JsonSchema;
|
|
3015
|
+
unknownSchema: Schema;
|
|
2823
3016
|
};
|
|
2824
3017
|
outputs: {
|
|
2825
|
-
schema:
|
|
2826
|
-
|
|
3018
|
+
schema: JsonSchema;
|
|
3019
|
+
unknownSchema: Schema;
|
|
2827
3020
|
};
|
|
2828
3021
|
results: {
|
|
2829
|
-
schema:
|
|
2830
|
-
|
|
3022
|
+
schema: JsonSchema;
|
|
3023
|
+
unknownSchema: Schema;
|
|
2831
3024
|
};
|
|
2832
3025
|
code: string;
|
|
2833
|
-
resolve: (
|
|
3026
|
+
resolve: (inputs: any) => Awaitable<any>;
|
|
2834
3027
|
providers: Array<DiscoverProviderOutput>;
|
|
2835
|
-
options:
|
|
3028
|
+
options: StepOptions;
|
|
2836
3029
|
};
|
|
2837
3030
|
type DiscoverWorkflowOutput = {
|
|
2838
3031
|
workflowId: string;
|
|
@@ -2841,12 +3034,12 @@ type DiscoverWorkflowOutput = {
|
|
|
2841
3034
|
code: string;
|
|
2842
3035
|
steps: Array<DiscoverStepOutput>;
|
|
2843
3036
|
data: {
|
|
2844
|
-
schema:
|
|
2845
|
-
|
|
3037
|
+
schema: JsonSchema;
|
|
3038
|
+
unknownSchema: Schema;
|
|
2846
3039
|
};
|
|
2847
3040
|
inputs: {
|
|
2848
|
-
schema:
|
|
2849
|
-
|
|
3041
|
+
schema: JsonSchema;
|
|
3042
|
+
unknownSchema: Schema;
|
|
2850
3043
|
};
|
|
2851
3044
|
};
|
|
2852
3045
|
type DiscoverOutput = {
|
|
@@ -2898,9 +3091,7 @@ type HealthCheck = {
|
|
|
2898
3091
|
|
|
2899
3092
|
declare class Client {
|
|
2900
3093
|
private discoveredWorkflows;
|
|
2901
|
-
private ajv;
|
|
2902
3094
|
private templateEngine;
|
|
2903
|
-
private readonly apiUrl;
|
|
2904
3095
|
apiKey?: string;
|
|
2905
3096
|
version: string;
|
|
2906
3097
|
strictAuthentication: boolean;
|
|
@@ -2913,9 +3104,6 @@ declare class Client {
|
|
|
2913
3104
|
private getStep;
|
|
2914
3105
|
private getRegisteredWorkflows;
|
|
2915
3106
|
discover(): DiscoverOutput;
|
|
2916
|
-
private getHeaders;
|
|
2917
|
-
diff(bridgeUrl: string, anonymous?: string): Promise<unknown>;
|
|
2918
|
-
sync(bridgeUrl: string, anonymous?: string, source?: string): Promise<unknown>;
|
|
2919
3107
|
/**
|
|
2920
3108
|
* Mocks data based on the given schema.
|
|
2921
3109
|
* The `default` value in the schema is used as the base data.
|
|
@@ -2926,9 +3114,9 @@ declare class Client {
|
|
|
2926
3114
|
*/
|
|
2927
3115
|
private mock;
|
|
2928
3116
|
private validate;
|
|
2929
|
-
private
|
|
2930
|
-
private
|
|
2931
|
-
private
|
|
3117
|
+
private throwInvalidProvider;
|
|
3118
|
+
private throwInvalidStep;
|
|
3119
|
+
private throwInvalidEvent;
|
|
2932
3120
|
private executeStepFactory;
|
|
2933
3121
|
private shouldSkip;
|
|
2934
3122
|
executeWorkflow(event: IEvent): Promise<ExecuteOutput>;
|
|
@@ -2998,4 +3186,4 @@ declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
|
|
|
2998
3186
|
private hashHmac;
|
|
2999
3187
|
}
|
|
3000
3188
|
|
|
3001
|
-
export { type
|
|
3189
|
+
export { type ActionStep as A, type DigestOutput as B, Client as C, type DiscoverWorkflowOutput as D, type Execute as E, type FromSchema as F, type DigestResult as G, type HealthCheck as H, type IEvent as I, JobStatusEnum as J, type Step as K, type Subscriber as L, type Either as M, NovuRequestHandler as N, type Awaitable as O, type PushOutput as P, type ExecuteInput as Q, type Schema as S, type WorkflowOptions as W, 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 ExecuteOutputMetadata as h, type ExecuteOutput as i, type SupportedFrameworkName as j, type StepOptions as k, type CustomStep as l, type ChannelStep as m, type EmailOutput as n, type EmailResult as o, type SmsOutput as p, type SmsResult as q, type PushResult as r, type ChatOutput as s, type ChatResult as t, type InAppOutput as u, type InAppResult as v, type DelayOutput as w, type DelayResult as x, type digestRegularOutput as y, type digestTimedOutput as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { E as Execute, W as WorkflowOptions, D as DiscoverWorkflowOutput } from './handler-
|
|
2
|
-
export {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { S as Schema, F as FromSchema, E as Execute, W as WorkflowOptions, D as DiscoverWorkflowOutput } from './handler-VweGZ1Z4.js';
|
|
2
|
+
export { A as ActionStep, O as Awaitable, m as ChannelStep, s as ChatOutput, t as ChatResult, C as Client, c as ClientOptions, b as CodeResult, l as CustomStep, w as DelayOutput, x as DelayResult, B as DigestOutput, G as DigestResult, g as DiscoverOutput, e as DiscoverProviderOutput, f as DiscoverStepOutput, M as Either, n as EmailOutput, o as EmailResult, Q as ExecuteInput, i as ExecuteOutput, h as ExecuteOutputMetadata, H as HealthCheck, I as IEvent, u as InAppOutput, v as InAppResult, J as JobStatusEnum, N as NovuRequestHandler, P as PushOutput, r as PushResult, a as ServeHandlerOptions, p as SmsOutput, q as SmsResult, K as Step, k as StepOptions, d as StepType, L as Subscriber, j as SupportedFrameworkName, y as digestRegularOutput, z as digestTimedOutput } from './handler-VweGZ1Z4.js';
|
|
3
|
+
import 'json-schema-to-ts';
|
|
4
|
+
import 'zod';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Define a new notification workflow.
|