@novu/framework 2.10.1-alpha.6 → 2.11.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.
Files changed (64) hide show
  1. package/dist/cjs/{health-check.types-S8oS3AQZ.d.cts → health-check.types-uaDLF5bo.d.cts} +3 -2
  2. package/dist/cjs/{index-BAY1Gj4h.d.cts → index-D-SLxj--.d.cts} +55 -27
  3. package/dist/cjs/index.cjs +82 -82
  4. package/dist/cjs/index.d.cts +3 -3
  5. package/dist/cjs/internal/index.cjs +1 -1
  6. package/dist/cjs/internal/index.d.cts +3 -3
  7. package/dist/cjs/jsx-dev-runtime.cjs +1 -1
  8. package/dist/cjs/jsx-runtime.cjs +1 -1
  9. package/dist/cjs/servers/express.cjs +90 -90
  10. package/dist/cjs/servers/express.d.cts +4 -4
  11. package/dist/cjs/servers/h3.cjs +86 -86
  12. package/dist/cjs/servers/h3.d.cts +4 -4
  13. package/dist/cjs/servers/lambda.cjs +86 -86
  14. package/dist/cjs/servers/lambda.d.cts +5 -5
  15. package/dist/cjs/servers/nest.cjs +90 -90
  16. package/dist/cjs/servers/nest.d.cts +6 -6
  17. package/dist/cjs/servers/next.cjs +86 -86
  18. package/dist/cjs/servers/next.d.cts +4 -4
  19. package/dist/cjs/servers/nuxt.cjs +86 -86
  20. package/dist/cjs/servers/nuxt.d.cts +4 -4
  21. package/dist/cjs/servers/remix.cjs +86 -86
  22. package/dist/cjs/servers/remix.d.cts +4 -4
  23. package/dist/cjs/servers/sveltekit.cjs +86 -86
  24. package/dist/cjs/servers/sveltekit.d.cts +4 -4
  25. package/dist/cjs/step-resolver.cjs +1 -1
  26. package/dist/cjs/step-resolver.d.cts +2 -2
  27. package/dist/cjs/{subscriber.types-DgRgSKMw.d.cts → subscriber.types-PRaHFLJu.d.cts} +8 -0
  28. package/dist/esm/{chunk-U3IL7QCI.js → chunk-DKQLYSZS.js} +1 -1
  29. package/dist/esm/chunk-FRWG7YTE.js +1 -0
  30. package/dist/esm/{chunk-T2VIX2ZH.js → chunk-K7PM3FEJ.js} +11 -11
  31. package/dist/esm/chunk-LJUUDK2J.js +130 -0
  32. package/dist/esm/{chunk-6GCCKYZC.js → chunk-N4PZBM53.js} +1 -1
  33. package/dist/esm/{chunk-CBLKARLC.js → chunk-QTWEINJ4.js} +1 -1
  34. package/dist/esm/{health-check.types-C5lg4csi.d.ts → health-check.types-XZwesagD.d.ts} +3 -2
  35. package/dist/esm/{index-DiFdSsia.d.ts → index-dylq0Kmx.d.ts} +55 -27
  36. package/dist/esm/index.d.ts +3 -3
  37. package/dist/esm/index.js +1 -1
  38. package/dist/esm/internal/index.d.ts +3 -3
  39. package/dist/esm/internal/index.js +1 -1
  40. package/dist/esm/jsx-dev-runtime.js +1 -1
  41. package/dist/esm/jsx-runtime.js +1 -1
  42. package/dist/esm/servers/express.d.ts +4 -4
  43. package/dist/esm/servers/express.js +1 -1
  44. package/dist/esm/servers/h3.d.ts +4 -4
  45. package/dist/esm/servers/h3.js +1 -1
  46. package/dist/esm/servers/lambda.d.ts +5 -5
  47. package/dist/esm/servers/lambda.js +1 -1
  48. package/dist/esm/servers/nest.d.ts +6 -6
  49. package/dist/esm/servers/nest.js +1 -1
  50. package/dist/esm/servers/next.d.ts +4 -4
  51. package/dist/esm/servers/next.js +1 -1
  52. package/dist/esm/servers/nuxt.d.ts +4 -4
  53. package/dist/esm/servers/nuxt.js +1 -1
  54. package/dist/esm/servers/remix.d.ts +4 -4
  55. package/dist/esm/servers/remix.js +1 -1
  56. package/dist/esm/servers/sveltekit.d.ts +4 -4
  57. package/dist/esm/servers/sveltekit.js +1 -1
  58. package/dist/esm/step-resolver.d.ts +2 -2
  59. package/dist/esm/step-resolver.js +1 -1
  60. package/dist/esm/{subscriber.types-CbMgjzR-.d.ts → subscriber.types-CC7F0JO_.d.ts} +8 -0
  61. package/dist/esm/validators.js +1 -1
  62. package/package.json +5 -5
  63. package/dist/esm/chunk-EWC7I6UD.js +0 -1
  64. package/dist/esm/chunk-H2XIPY7V.js +0 -130
@@ -1,4 +1,4 @@
1
- import { b as ContextPayload, c as ConditionalPartial, P as PickRequiredKeys, d as Step, e as Prettify, S as Subscriber, E as EnvironmentSystemVariables, C as ContextResolved, D as DeepPartial$1, f as ChannelStepEnum, A as ActionStepEnum, g as Awaitable, W as WithPassthrough, h as StepOptions } from './subscriber.types-DgRgSKMw.cjs';
1
+ import { b as ContextPayload, c as ConditionalPartial, P as PickRequiredKeys, d as Step, e as Prettify, S as Subscriber, E as EnvironmentSystemVariables, C as ContextResolved, D as DeepPartial$1, f as ChannelStepEnum, A as ActionStepEnum, g as Awaitable, W as WithPassthrough, h as StepOptions } from './subscriber.types-PRaHFLJu.cjs';
2
2
  import { S as Schema, J as JsonSchema } from './base.schema.types-BApIn9jr.cjs';
3
3
 
4
4
  declare enum ChannelTypeEnum {
@@ -66,7 +66,8 @@ declare enum ChatProviderIdEnum {
66
66
  GetStream = "getstream",
67
67
  RocketChat = "rocket-chat",
68
68
  WhatsAppBusiness = "whatsapp-business",
69
- ChatWebhook = "chat-webhook"
69
+ ChatWebhook = "chat-webhook",
70
+ Telegram = "telegram"
70
71
  }
71
72
  declare enum PushProviderIdEnum {
72
73
  FCM = "fcm",
@@ -1,6 +1,6 @@
1
1
  import { ChatElement, Emoji, CardElement } from 'chat';
2
- import { T as TriggerRecipientsPayload, C as ClientOptions, W as Workflow, H as HealthCheck, e as DiscoverOutput, i as Event, n as ExecuteOutput, d as CodeResult, j as EventTriggerParams, m as Execute, t as WorkflowOptions } from './health-check.types-S8oS3AQZ.cjs';
3
- import { g as Awaitable } from './subscriber.types-DgRgSKMw.cjs';
2
+ import { T as TriggerRecipientsPayload, C as ClientOptions, W as Workflow, H as HealthCheck, e as DiscoverOutput, i as Event, n as ExecuteOutput, d as CodeResult, j as EventTriggerParams, m as Execute, t as WorkflowOptions } from './health-check.types-uaDLF5bo.cjs';
3
+ import { g as Awaitable } from './subscriber.types-PRaHFLJu.cjs';
4
4
  import { S as Schema, a as FromSchema, F as FromSchemaUnvalidated } from './base.schema.types-BApIn9jr.cjs';
5
5
  import './step-resolver.cjs';
6
6
 
@@ -85,6 +85,27 @@ interface AgentHistoryEntry {
85
85
  };
86
86
  createdAt: string;
87
87
  }
88
+ /** Resolved inbound email domain metadata (present when `platform === 'email'`). */
89
+ interface AgentEmailDomainContext {
90
+ id: string;
91
+ name: string;
92
+ data?: Record<string, string>;
93
+ }
94
+ /** Resolved inbound email route metadata (present when `platform === 'email'`). */
95
+ interface AgentEmailRouteContext {
96
+ address: string;
97
+ data?: Record<string, string>;
98
+ }
99
+ /** Resolved inbound email envelope (present when `platform === 'email'`). */
100
+ interface AgentEmailContext {
101
+ domain?: AgentEmailDomainContext;
102
+ route?: AgentEmailRouteContext;
103
+ /**
104
+ * Platform-native Message-ID of the message that started this email thread.
105
+ * Equals the current message ID on the first message of a thread.
106
+ */
107
+ rootMessageId?: string;
108
+ }
88
109
  /** Platform-specific identifiers for the thread and channel. */
89
110
  interface AgentPlatformContext {
90
111
  /** Platform-native thread ID (e.g. Slack thread `ts`, Teams conversation ID). */
@@ -93,6 +114,10 @@ interface AgentPlatformContext {
93
114
  channelId: string;
94
115
  /** Whether the message arrived in a direct message rather than a shared channel. */
95
116
  isDM: boolean;
117
+ /** Platform-native raw message payload from the chat SDK adapter (e.g. email `NovuEmailRawMessage`). */
118
+ message?: unknown;
119
+ /** Resolved inbound email routing metadata extracted from the raw payload. */
120
+ email?: AgentEmailContext;
96
121
  }
97
122
  interface FileRef {
98
123
  filename: string;
@@ -118,6 +143,7 @@ interface FileRef {
118
143
  * - `ChatElement` — interactive card built with Card(), Button(), etc.
119
144
  *
120
145
  * For file attachments, pass a `files` array as the second argument to reply()/edit().
146
+ * Cards and files can be combined on platforms that support it (e.g. WhatsApp sends media then the card).
121
147
  */
122
148
  type MessageContent = string | ChatElement;
123
149
  /** Normalized content shape sent over HTTP to the reply endpoint. */
@@ -126,10 +152,15 @@ interface ReplyContent {
126
152
  card?: CardElement;
127
153
  files?: FileRef[];
128
154
  }
129
- /** Data carried by a button click or other interactive action. */
155
+ /**
156
+ * Data carried by a button click or other interactive action.
157
+ *
158
+ * Used both on the bridge wire (`AgentBridgeRequest.action`) and as the
159
+ * handler-facing argument passed to `onAction(action, ctx)`.
160
+ */
130
161
  interface AgentAction {
131
162
  /** The `id` prop of the clicked `<Button>` or action element. */
132
- actionId: string;
163
+ id: string;
133
164
  /** The `value` prop of the clicked element, if set. */
134
165
  value?: string;
135
166
  /** Platform-native message ID of the message containing the clicked button/action. */
@@ -258,8 +289,6 @@ interface AgentContextBase {
258
289
  /** Context passed to the `onMessage` handler. */
259
290
  interface AgentMessageContext extends AgentContextBase {
260
291
  readonly event: 'onMessage';
261
- /** The incoming message that triggered this handler. */
262
- readonly message: AgentMessage;
263
292
  }
264
293
  /** Context passed to the `onAction` handler. */
265
294
  interface AgentActionContext extends AgentContextBase {
@@ -282,42 +311,41 @@ type AgentContext = AgentMessageContext | AgentActionContext | AgentReactionCont
282
311
  interface AgentHandlers {
283
312
  /**
284
313
  * Fires on every text message the user sends.
285
- * `message` is the incoming message. `ctx` provides conversation history, subscriber,
286
- * metadata, and reply/trigger methods.
314
+ *
315
+ * @param message - The incoming message that triggered this handler.
316
+ * @param ctx - Conversation history, subscriber, metadata, and reply/trigger methods.
317
+ *
287
318
  * Return a string or JSX card to reply, or call `ctx.reply()` directly
288
319
  * for more control (e.g. editing a message in place).
289
320
  */
290
- onMessage: (payload: {
291
- message: AgentMessage;
292
- ctx: AgentMessageContext;
293
- }) => Awaitable<MessageContent | void>;
321
+ onMessage: (message: AgentMessage, ctx: AgentMessageContext) => Awaitable<MessageContent | void>;
294
322
  /**
295
323
  * Fires when the user adds or removes an emoji reaction to a message.
296
- * `reaction` carries the emoji and whether it was added or removed.
324
+ *
325
+ * @param reaction - The emoji reaction (carries the emoji and whether it was added or removed).
326
+ * @param ctx - Conversation context (history, subscriber, metadata, reply/trigger methods).
327
+ *
297
328
  * Return a string or card to post a reply, or return nothing to silently acknowledge.
298
329
  */
299
- onReaction?: (payload: {
300
- reaction: AgentReaction;
301
- ctx: AgentReactionContext;
302
- }) => Awaitable<MessageContent | void>;
330
+ onReaction?: (reaction: AgentReaction, ctx: AgentReactionContext) => Awaitable<MessageContent | void>;
303
331
  /**
304
332
  * Fires when the user clicks a `<Button>` or other interactive element.
305
- * `actionId` is the `id` prop of the clicked element; `value` is its `value` prop.
333
+ *
334
+ * @param action - The interactive action that triggered this handler.
335
+ * `action.id` is the `id` prop of the clicked element; `action.value` is its `value` prop.
336
+ * @param ctx - Conversation context (history, subscriber, metadata, reply/trigger methods).
337
+ *
306
338
  * Return a string or card to reply, or return nothing to silently acknowledge the click.
307
339
  */
308
- onAction?: (payload: {
309
- actionId: string;
310
- value?: string;
311
- ctx: AgentActionContext;
312
- }) => Awaitable<MessageContent | void>;
340
+ onAction?: (action: AgentAction, ctx: AgentActionContext) => Awaitable<MessageContent | void>;
313
341
  /**
314
342
  * Fires after `ctx.resolve()` is called and the conversation is marked resolved.
315
343
  * Use for post-resolution side-effects (e.g. triggering a follow-up workflow).
316
- * Access subscriber and conversation via `ctx.subscriber` and `ctx.conversation`.
344
+ *
345
+ * @param ctx - Conversation context. Access subscriber and conversation via
346
+ * `ctx.subscriber` and `ctx.conversation`.
317
347
  */
318
- onResolve?: (payload: {
319
- ctx: AgentResolveContext;
320
- }) => Awaitable<MessageContent | void>;
348
+ onResolve?: (ctx: AgentResolveContext) => Awaitable<MessageContent | void>;
321
349
  }
322
350
  interface Agent {
323
351
  id: string;