@develit-services/notification 0.5.0 → 0.6.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/README.md +239 -0
- package/dist/database/schema.cjs +4 -6
- package/dist/database/schema.d.cts +6 -2
- package/dist/database/schema.d.mts +6 -2
- package/dist/database/schema.d.ts +6 -2
- package/dist/database/schema.mjs +5 -3
- package/dist/export/worker.cjs +270 -69
- package/dist/export/worker.d.cts +22 -3
- package/dist/export/worker.d.mts +22 -3
- package/dist/export/worker.d.ts +22 -3
- package/dist/export/worker.mjs +262 -61
- package/dist/export/wrangler.cjs +19 -1
- package/dist/export/wrangler.d.cts +5 -1
- package/dist/export/wrangler.d.mts +5 -1
- package/dist/export/wrangler.d.ts +5 -1
- package/dist/export/wrangler.mjs +19 -1
- package/dist/shared/{notification.Dk_5TX9v.cjs → notification.BLPB8Ib2.cjs} +109 -11
- package/dist/shared/{notification.2rSOcFrr.d.cts → notification.BiG4Q650.d.cts} +99 -8
- package/dist/shared/{notification.C1quYqlT.d.mts → notification.BiG4Q650.d.mts} +99 -8
- package/dist/shared/{notification.oEdhCsu_.d.ts → notification.BiG4Q650.d.ts} +99 -8
- package/dist/shared/{notification.CM_WoR0y.mjs → notification.CP_hFlNt.mjs} +105 -12
- package/dist/shared/{notification.BB9Jl8DI.d.ts → notification.CdlaOUd0.d.cts} +3 -0
- package/dist/shared/{notification.BB9Jl8DI.d.cts → notification.CdlaOUd0.d.mts} +3 -0
- package/dist/shared/{notification.BB9Jl8DI.d.mts → notification.CdlaOUd0.d.ts} +3 -0
- package/dist/types.cjs +19 -19
- package/dist/types.d.cts +6 -18
- package/dist/types.d.mts +6 -18
- package/dist/types.d.ts +6 -18
- package/dist/types.mjs +2 -10
- package/package.json +3 -3
- package/dist/shared/notification.4b3eUEIG.cjs +0 -22
- package/dist/shared/notification.BWLPh6Gb.d.cts +0 -140
- package/dist/shared/notification.BWLPh6Gb.d.mts +0 -140
- package/dist/shared/notification.BWLPh6Gb.d.ts +0 -140
- package/dist/shared/notification.C0X8Orrh.mjs +0 -19
|
@@ -4,6 +4,7 @@ const z = require('zod');
|
|
|
4
4
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
5
5
|
const v4 = require('zod/v4');
|
|
6
6
|
const twilio = require('twilio');
|
|
7
|
+
const signature = require('@develit-io/backend-sdk/signature');
|
|
7
8
|
|
|
8
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
9
10
|
|
|
@@ -77,6 +78,21 @@ class IEmailConnector {
|
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
|
|
81
|
+
const getReceivedEmailsInputSchema = z.z.object({
|
|
82
|
+
recipient: z.z.email("Invalid email address"),
|
|
83
|
+
limit: z.z.number().min(1).max(100).optional().default(10),
|
|
84
|
+
includeContent: z.z.boolean().optional().default(true)
|
|
85
|
+
});
|
|
86
|
+
const waitForEmailInputSchema = z.z.object({
|
|
87
|
+
recipient: z.z.email("Invalid email address"),
|
|
88
|
+
subject: z.z.string().optional(),
|
|
89
|
+
timeout: z.z.number().min(1e3).max(6e4).optional().default(1e4),
|
|
90
|
+
pollInterval: z.z.number().min(100).max(5e3).optional().default(500)
|
|
91
|
+
});
|
|
92
|
+
const clearReceivedEmailsInputSchema = z.z.object({
|
|
93
|
+
recipient: z.z.email("Invalid email address")
|
|
94
|
+
});
|
|
95
|
+
|
|
80
96
|
class EcomailConnector extends IEmailConnector {
|
|
81
97
|
static {
|
|
82
98
|
this.providerName = "ecomail";
|
|
@@ -107,7 +123,12 @@ class EcomailConnector extends IEmailConnector {
|
|
|
107
123
|
},
|
|
108
124
|
body: JSON.stringify(emEmail)
|
|
109
125
|
});
|
|
110
|
-
if (error)
|
|
126
|
+
if (error)
|
|
127
|
+
throw backendSdk.createInternalError(error, {
|
|
128
|
+
message: `Ecomail: failed to send ${emEmail.message.template_id ? "template " : ""}email: ${error.message}`,
|
|
129
|
+
code: emEmail.message.template_id ? "CONN-N-02" : "CONN-N-01",
|
|
130
|
+
status: 502
|
|
131
|
+
});
|
|
111
132
|
}
|
|
112
133
|
convertEmail(email) {
|
|
113
134
|
const toContacts = this.convertContacts(email.to);
|
|
@@ -215,6 +236,22 @@ const sendSmsInputSchema = z.z.object({
|
|
|
215
236
|
})
|
|
216
237
|
});
|
|
217
238
|
|
|
239
|
+
const sendWebhookInputSchema = v4.z.object({
|
|
240
|
+
webhook: v4.z.object({
|
|
241
|
+
url: v4.z.url(),
|
|
242
|
+
payload: v4.z.record(v4.z.string(), v4.z.unknown()),
|
|
243
|
+
headers: v4.z.record(v4.z.string(), v4.z.string()).optional()
|
|
244
|
+
}),
|
|
245
|
+
metadata: v4.z.object({
|
|
246
|
+
userAgent: v4.z.string().optional(),
|
|
247
|
+
ip: v4.z.ipv4().or(v4.z.ipv6()).optional(),
|
|
248
|
+
initiator: v4.z.object({
|
|
249
|
+
service: v4.z.string(),
|
|
250
|
+
userId: v4.z.string().optional()
|
|
251
|
+
})
|
|
252
|
+
})
|
|
253
|
+
});
|
|
254
|
+
|
|
218
255
|
class ISmsConnector {
|
|
219
256
|
constructor({
|
|
220
257
|
ACCOUNT_ID,
|
|
@@ -246,8 +283,9 @@ class TwilioConnector extends ISmsConnector {
|
|
|
246
283
|
to: sms.to
|
|
247
284
|
});
|
|
248
285
|
if (message.errorMessage)
|
|
249
|
-
|
|
250
|
-
message: message.errorMessage
|
|
286
|
+
throw backendSdk.createInternalError(null, {
|
|
287
|
+
message: `Twilio: ${message.errorMessage}`,
|
|
288
|
+
code: "CONN-N-03",
|
|
251
289
|
status: message.errorCode
|
|
252
290
|
});
|
|
253
291
|
}
|
|
@@ -260,16 +298,71 @@ class SlackConnector {
|
|
|
260
298
|
async sendNotificationToAllSlack(message) {
|
|
261
299
|
const controller = new AbortController();
|
|
262
300
|
const timeoutId = setTimeout(() => controller.abort(), 3e3);
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
301
|
+
let response;
|
|
302
|
+
try {
|
|
303
|
+
response = await fetch(this.webhook, {
|
|
304
|
+
method: "POST",
|
|
305
|
+
body: JSON.stringify({ text: message }),
|
|
306
|
+
headers: { "Content-Type": "application/json" },
|
|
307
|
+
signal: controller.signal
|
|
308
|
+
});
|
|
309
|
+
} catch (error) {
|
|
310
|
+
clearTimeout(timeoutId);
|
|
311
|
+
throw backendSdk.createInternalError(error, {
|
|
312
|
+
message: "Slack: request timed out",
|
|
313
|
+
code: "CONN-N-05",
|
|
314
|
+
status: 504
|
|
315
|
+
});
|
|
316
|
+
}
|
|
269
317
|
clearTimeout(timeoutId);
|
|
270
|
-
if (!response.ok)
|
|
271
|
-
throw
|
|
318
|
+
if (!response.ok)
|
|
319
|
+
throw backendSdk.createInternalError(null, {
|
|
320
|
+
message: `Slack: failed to send notification (${response.status})`,
|
|
321
|
+
code: "CONN-N-04",
|
|
322
|
+
status: 502
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
class WebhookConnector {
|
|
328
|
+
constructor(privateKey) {
|
|
329
|
+
this.privateKey = privateKey;
|
|
330
|
+
}
|
|
331
|
+
async sendWebhook(webhook) {
|
|
332
|
+
const body = JSON.stringify(webhook.payload);
|
|
333
|
+
const signature$1 = await signature.signPayload({
|
|
334
|
+
payload: body,
|
|
335
|
+
privateKey: this.privateKey
|
|
336
|
+
});
|
|
337
|
+
const controller = new AbortController();
|
|
338
|
+
const timeoutId = setTimeout(() => controller.abort(), 1e4);
|
|
339
|
+
let response;
|
|
340
|
+
try {
|
|
341
|
+
response = await fetch(webhook.url, {
|
|
342
|
+
method: "POST",
|
|
343
|
+
body,
|
|
344
|
+
headers: {
|
|
345
|
+
"Content-Type": "application/json",
|
|
346
|
+
"X-Webhook-Signature": signature$1,
|
|
347
|
+
...webhook.headers
|
|
348
|
+
},
|
|
349
|
+
signal: controller.signal
|
|
350
|
+
});
|
|
351
|
+
} catch (error) {
|
|
352
|
+
clearTimeout(timeoutId);
|
|
353
|
+
throw backendSdk.createInternalError(error, {
|
|
354
|
+
message: "Webhook: request timed out",
|
|
355
|
+
code: "CONN-N-07",
|
|
356
|
+
status: 504
|
|
357
|
+
});
|
|
272
358
|
}
|
|
359
|
+
clearTimeout(timeoutId);
|
|
360
|
+
if (!response.ok)
|
|
361
|
+
throw backendSdk.createInternalError(null, {
|
|
362
|
+
message: `Webhook: delivery failed (${response.status})`,
|
|
363
|
+
code: "CONN-N-06",
|
|
364
|
+
status: 502
|
|
365
|
+
});
|
|
273
366
|
}
|
|
274
367
|
}
|
|
275
368
|
|
|
@@ -278,9 +371,14 @@ exports.IEmailConnector = IEmailConnector;
|
|
|
278
371
|
exports.ISmsConnector = ISmsConnector;
|
|
279
372
|
exports.SlackConnector = SlackConnector;
|
|
280
373
|
exports.TwilioConnector = TwilioConnector;
|
|
374
|
+
exports.WebhookConnector = WebhookConnector;
|
|
375
|
+
exports.clearReceivedEmailsInputSchema = clearReceivedEmailsInputSchema;
|
|
376
|
+
exports.getReceivedEmailsInputSchema = getReceivedEmailsInputSchema;
|
|
281
377
|
exports.iAttachmentSchema = iAttachmentSchema;
|
|
282
378
|
exports.iContactSchema = iContactSchema;
|
|
283
379
|
exports.iEmailSchema = iEmailSchema;
|
|
284
380
|
exports.sendEmailInputSchema = sendEmailInputSchema;
|
|
285
381
|
exports.sendSlackInputSchema = sendSlackInputSchema;
|
|
286
382
|
exports.sendSmsInputSchema = sendSmsInputSchema;
|
|
383
|
+
exports.sendWebhookInputSchema = sendWebhookInputSchema;
|
|
384
|
+
exports.waitForEmailInputSchema = waitForEmailInputSchema;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { s as schema } from './notification.BWLPh6Gb.cjs';
|
|
2
1
|
import z$1, { z } from 'zod';
|
|
3
2
|
import { z as z$2 } from 'zod/v4';
|
|
4
|
-
import { InternalError } from '@develit-io/backend-sdk';
|
|
5
|
-
|
|
6
|
-
declare const tables: typeof schema;
|
|
7
3
|
|
|
8
4
|
declare const iContactSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
9
5
|
email: z.ZodString;
|
|
@@ -79,6 +75,68 @@ declare abstract class IEmailConnector {
|
|
|
79
75
|
abstract sendEmail(email: IEmail): Promise<void>;
|
|
80
76
|
}
|
|
81
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Received Email structure (matches email-receiver format)
|
|
80
|
+
*/
|
|
81
|
+
interface ReceivedEmail {
|
|
82
|
+
messageId: string;
|
|
83
|
+
from: string;
|
|
84
|
+
to: string;
|
|
85
|
+
subject: string;
|
|
86
|
+
text?: string;
|
|
87
|
+
html?: string;
|
|
88
|
+
headers: Record<string, string>;
|
|
89
|
+
receivedAt: string;
|
|
90
|
+
size: number;
|
|
91
|
+
raw?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Input schema for getting received emails
|
|
95
|
+
*/
|
|
96
|
+
declare const getReceivedEmailsInputSchema: z.ZodObject<{
|
|
97
|
+
recipient: z.ZodEmail;
|
|
98
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
99
|
+
includeContent: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
type GetReceivedEmailsInput = z.infer<typeof getReceivedEmailsInputSchema>;
|
|
102
|
+
/**
|
|
103
|
+
* Output schema for getting received emails
|
|
104
|
+
*/
|
|
105
|
+
interface GetReceivedEmailsOutput {
|
|
106
|
+
emails: ReceivedEmail[];
|
|
107
|
+
count: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Input schema for waiting for email (E2E tests helper)
|
|
111
|
+
*/
|
|
112
|
+
declare const waitForEmailInputSchema: z.ZodObject<{
|
|
113
|
+
recipient: z.ZodEmail;
|
|
114
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
115
|
+
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
116
|
+
pollInterval: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
type WaitForEmailInput = z.infer<typeof waitForEmailInputSchema>;
|
|
119
|
+
/**
|
|
120
|
+
* Output schema for waiting for email
|
|
121
|
+
*/
|
|
122
|
+
interface WaitForEmailOutput {
|
|
123
|
+
email: ReceivedEmail | null;
|
|
124
|
+
found: boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Input schema for clearing received emails
|
|
128
|
+
*/
|
|
129
|
+
declare const clearReceivedEmailsInputSchema: z.ZodObject<{
|
|
130
|
+
recipient: z.ZodEmail;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
type ClearReceivedEmailsInput = z.infer<typeof clearReceivedEmailsInputSchema>;
|
|
133
|
+
/**
|
|
134
|
+
* Output schema for clearing received emails
|
|
135
|
+
*/
|
|
136
|
+
interface ClearReceivedEmailsOutput {
|
|
137
|
+
deleted: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
82
140
|
declare const sendEmailInputSchema: z$1.ZodObject<{
|
|
83
141
|
email: z$1.ZodObject<{
|
|
84
142
|
to: z$1.ZodUnion<readonly [z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
|
|
@@ -176,11 +234,31 @@ interface SendSmsInput extends z.infer<typeof sendSmsInputSchema> {
|
|
|
176
234
|
interface SendSmsOutput {
|
|
177
235
|
}
|
|
178
236
|
|
|
237
|
+
declare const sendWebhookInputSchema: z$2.ZodObject<{
|
|
238
|
+
webhook: z$2.ZodObject<{
|
|
239
|
+
url: z$2.ZodURL;
|
|
240
|
+
payload: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
|
|
241
|
+
headers: z$2.ZodOptional<z$2.ZodRecord<z$2.ZodString, z$2.ZodString>>;
|
|
242
|
+
}, z$2.core.$strip>;
|
|
243
|
+
metadata: z$2.ZodObject<{
|
|
244
|
+
userAgent: z$2.ZodOptional<z$2.ZodString>;
|
|
245
|
+
ip: z$2.ZodOptional<z$2.ZodUnion<[z$2.ZodIPv4, z$2.ZodIPv6]>>;
|
|
246
|
+
initiator: z$2.ZodObject<{
|
|
247
|
+
service: z$2.ZodString;
|
|
248
|
+
userId: z$2.ZodOptional<z$2.ZodString>;
|
|
249
|
+
}, z$2.core.$strip>;
|
|
250
|
+
}, z$2.core.$strip>;
|
|
251
|
+
}, z$2.core.$strip>;
|
|
252
|
+
interface SendWebhookInput extends z$2.infer<typeof sendWebhookInputSchema> {
|
|
253
|
+
}
|
|
254
|
+
interface SendWebhookOutput {
|
|
255
|
+
}
|
|
256
|
+
|
|
179
257
|
interface IPushNotification {
|
|
180
258
|
}
|
|
181
259
|
|
|
182
260
|
interface NotificationQueueMessage {
|
|
183
|
-
type: 'email' | 'sms' | 'pushNotification' | 'slack';
|
|
261
|
+
type: 'email' | 'sms' | 'pushNotification' | 'slack' | 'webhook';
|
|
184
262
|
metadata: {
|
|
185
263
|
userAgent?: string;
|
|
186
264
|
ip?: string;
|
|
@@ -194,6 +272,7 @@ interface NotificationQueueMessage {
|
|
|
194
272
|
sms?: ISms;
|
|
195
273
|
pushNotification?: IPushNotification;
|
|
196
274
|
slack?: ISlack;
|
|
275
|
+
webhook?: IWebhook;
|
|
197
276
|
};
|
|
198
277
|
}
|
|
199
278
|
|
|
@@ -212,7 +291,7 @@ declare abstract class ISmsConnector {
|
|
|
212
291
|
AUTH_TOKEN: string;
|
|
213
292
|
SERVICE_ID: string;
|
|
214
293
|
});
|
|
215
|
-
abstract sendSms(sms: ISms): Promise<
|
|
294
|
+
abstract sendSms(sms: ISms): Promise<void>;
|
|
216
295
|
}
|
|
217
296
|
|
|
218
297
|
interface ISlack {
|
|
@@ -225,5 +304,17 @@ declare class SlackConnector {
|
|
|
225
304
|
sendNotificationToAllSlack(message: string): Promise<void>;
|
|
226
305
|
}
|
|
227
306
|
|
|
228
|
-
|
|
229
|
-
|
|
307
|
+
interface IWebhook {
|
|
308
|
+
url: string;
|
|
309
|
+
payload: Record<string, unknown>;
|
|
310
|
+
headers?: Record<string, string>;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
declare class WebhookConnector {
|
|
314
|
+
private privateKey;
|
|
315
|
+
constructor(privateKey: string);
|
|
316
|
+
sendWebhook(webhook: IWebhook): Promise<void>;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export { sendSlackInputSchema as A, sendSmsInputSchema as B, sendWebhookInputSchema as D, waitForEmailInputSchema as E, IEmailConnector as I, SlackConnector as S, WebhookConnector as W, ISmsConnector as a, clearReceivedEmailsInputSchema as u, getReceivedEmailsInputSchema as v, iAttachmentSchema as w, iContactSchema as x, iEmailSchema as y, sendEmailInputSchema as z };
|
|
320
|
+
export type { ClearReceivedEmailsInput as C, GetReceivedEmailsInput as G, NotificationQueueMessage as N, ReceivedEmail as R, SendEmailInput as b, SendEmailOutput as c, SendSmsInput as d, SendSmsOutput as e, SendSlackInput as f, SendSlackOutput as g, SendWebhookInput as h, SendWebhookOutput as i, GetReceivedEmailsOutput as j, WaitForEmailInput as k, WaitForEmailOutput as l, ClearReceivedEmailsOutput as m, IEmail as n, IContact as o, ISms as p, IAttachment as q, IPushNotification as r, ISlack as s, IWebhook as t };
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { s as schema } from './notification.BWLPh6Gb.mjs';
|
|
2
1
|
import z$1, { z } from 'zod';
|
|
3
2
|
import { z as z$2 } from 'zod/v4';
|
|
4
|
-
import { InternalError } from '@develit-io/backend-sdk';
|
|
5
|
-
|
|
6
|
-
declare const tables: typeof schema;
|
|
7
3
|
|
|
8
4
|
declare const iContactSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
9
5
|
email: z.ZodString;
|
|
@@ -79,6 +75,68 @@ declare abstract class IEmailConnector {
|
|
|
79
75
|
abstract sendEmail(email: IEmail): Promise<void>;
|
|
80
76
|
}
|
|
81
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Received Email structure (matches email-receiver format)
|
|
80
|
+
*/
|
|
81
|
+
interface ReceivedEmail {
|
|
82
|
+
messageId: string;
|
|
83
|
+
from: string;
|
|
84
|
+
to: string;
|
|
85
|
+
subject: string;
|
|
86
|
+
text?: string;
|
|
87
|
+
html?: string;
|
|
88
|
+
headers: Record<string, string>;
|
|
89
|
+
receivedAt: string;
|
|
90
|
+
size: number;
|
|
91
|
+
raw?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Input schema for getting received emails
|
|
95
|
+
*/
|
|
96
|
+
declare const getReceivedEmailsInputSchema: z.ZodObject<{
|
|
97
|
+
recipient: z.ZodEmail;
|
|
98
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
99
|
+
includeContent: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
type GetReceivedEmailsInput = z.infer<typeof getReceivedEmailsInputSchema>;
|
|
102
|
+
/**
|
|
103
|
+
* Output schema for getting received emails
|
|
104
|
+
*/
|
|
105
|
+
interface GetReceivedEmailsOutput {
|
|
106
|
+
emails: ReceivedEmail[];
|
|
107
|
+
count: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Input schema for waiting for email (E2E tests helper)
|
|
111
|
+
*/
|
|
112
|
+
declare const waitForEmailInputSchema: z.ZodObject<{
|
|
113
|
+
recipient: z.ZodEmail;
|
|
114
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
115
|
+
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
116
|
+
pollInterval: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
type WaitForEmailInput = z.infer<typeof waitForEmailInputSchema>;
|
|
119
|
+
/**
|
|
120
|
+
* Output schema for waiting for email
|
|
121
|
+
*/
|
|
122
|
+
interface WaitForEmailOutput {
|
|
123
|
+
email: ReceivedEmail | null;
|
|
124
|
+
found: boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Input schema for clearing received emails
|
|
128
|
+
*/
|
|
129
|
+
declare const clearReceivedEmailsInputSchema: z.ZodObject<{
|
|
130
|
+
recipient: z.ZodEmail;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
type ClearReceivedEmailsInput = z.infer<typeof clearReceivedEmailsInputSchema>;
|
|
133
|
+
/**
|
|
134
|
+
* Output schema for clearing received emails
|
|
135
|
+
*/
|
|
136
|
+
interface ClearReceivedEmailsOutput {
|
|
137
|
+
deleted: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
82
140
|
declare const sendEmailInputSchema: z$1.ZodObject<{
|
|
83
141
|
email: z$1.ZodObject<{
|
|
84
142
|
to: z$1.ZodUnion<readonly [z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
|
|
@@ -176,11 +234,31 @@ interface SendSmsInput extends z.infer<typeof sendSmsInputSchema> {
|
|
|
176
234
|
interface SendSmsOutput {
|
|
177
235
|
}
|
|
178
236
|
|
|
237
|
+
declare const sendWebhookInputSchema: z$2.ZodObject<{
|
|
238
|
+
webhook: z$2.ZodObject<{
|
|
239
|
+
url: z$2.ZodURL;
|
|
240
|
+
payload: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
|
|
241
|
+
headers: z$2.ZodOptional<z$2.ZodRecord<z$2.ZodString, z$2.ZodString>>;
|
|
242
|
+
}, z$2.core.$strip>;
|
|
243
|
+
metadata: z$2.ZodObject<{
|
|
244
|
+
userAgent: z$2.ZodOptional<z$2.ZodString>;
|
|
245
|
+
ip: z$2.ZodOptional<z$2.ZodUnion<[z$2.ZodIPv4, z$2.ZodIPv6]>>;
|
|
246
|
+
initiator: z$2.ZodObject<{
|
|
247
|
+
service: z$2.ZodString;
|
|
248
|
+
userId: z$2.ZodOptional<z$2.ZodString>;
|
|
249
|
+
}, z$2.core.$strip>;
|
|
250
|
+
}, z$2.core.$strip>;
|
|
251
|
+
}, z$2.core.$strip>;
|
|
252
|
+
interface SendWebhookInput extends z$2.infer<typeof sendWebhookInputSchema> {
|
|
253
|
+
}
|
|
254
|
+
interface SendWebhookOutput {
|
|
255
|
+
}
|
|
256
|
+
|
|
179
257
|
interface IPushNotification {
|
|
180
258
|
}
|
|
181
259
|
|
|
182
260
|
interface NotificationQueueMessage {
|
|
183
|
-
type: 'email' | 'sms' | 'pushNotification' | 'slack';
|
|
261
|
+
type: 'email' | 'sms' | 'pushNotification' | 'slack' | 'webhook';
|
|
184
262
|
metadata: {
|
|
185
263
|
userAgent?: string;
|
|
186
264
|
ip?: string;
|
|
@@ -194,6 +272,7 @@ interface NotificationQueueMessage {
|
|
|
194
272
|
sms?: ISms;
|
|
195
273
|
pushNotification?: IPushNotification;
|
|
196
274
|
slack?: ISlack;
|
|
275
|
+
webhook?: IWebhook;
|
|
197
276
|
};
|
|
198
277
|
}
|
|
199
278
|
|
|
@@ -212,7 +291,7 @@ declare abstract class ISmsConnector {
|
|
|
212
291
|
AUTH_TOKEN: string;
|
|
213
292
|
SERVICE_ID: string;
|
|
214
293
|
});
|
|
215
|
-
abstract sendSms(sms: ISms): Promise<
|
|
294
|
+
abstract sendSms(sms: ISms): Promise<void>;
|
|
216
295
|
}
|
|
217
296
|
|
|
218
297
|
interface ISlack {
|
|
@@ -225,5 +304,17 @@ declare class SlackConnector {
|
|
|
225
304
|
sendNotificationToAllSlack(message: string): Promise<void>;
|
|
226
305
|
}
|
|
227
306
|
|
|
228
|
-
|
|
229
|
-
|
|
307
|
+
interface IWebhook {
|
|
308
|
+
url: string;
|
|
309
|
+
payload: Record<string, unknown>;
|
|
310
|
+
headers?: Record<string, string>;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
declare class WebhookConnector {
|
|
314
|
+
private privateKey;
|
|
315
|
+
constructor(privateKey: string);
|
|
316
|
+
sendWebhook(webhook: IWebhook): Promise<void>;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export { sendSlackInputSchema as A, sendSmsInputSchema as B, sendWebhookInputSchema as D, waitForEmailInputSchema as E, IEmailConnector as I, SlackConnector as S, WebhookConnector as W, ISmsConnector as a, clearReceivedEmailsInputSchema as u, getReceivedEmailsInputSchema as v, iAttachmentSchema as w, iContactSchema as x, iEmailSchema as y, sendEmailInputSchema as z };
|
|
320
|
+
export type { ClearReceivedEmailsInput as C, GetReceivedEmailsInput as G, NotificationQueueMessage as N, ReceivedEmail as R, SendEmailInput as b, SendEmailOutput as c, SendSmsInput as d, SendSmsOutput as e, SendSlackInput as f, SendSlackOutput as g, SendWebhookInput as h, SendWebhookOutput as i, GetReceivedEmailsOutput as j, WaitForEmailInput as k, WaitForEmailOutput as l, ClearReceivedEmailsOutput as m, IEmail as n, IContact as o, ISms as p, IAttachment as q, IPushNotification as r, ISlack as s, IWebhook as t };
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { s as schema } from './notification.BWLPh6Gb.js';
|
|
2
1
|
import z$1, { z } from 'zod';
|
|
3
2
|
import { z as z$2 } from 'zod/v4';
|
|
4
|
-
import { InternalError } from '@develit-io/backend-sdk';
|
|
5
|
-
|
|
6
|
-
declare const tables: typeof schema;
|
|
7
3
|
|
|
8
4
|
declare const iContactSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
9
5
|
email: z.ZodString;
|
|
@@ -79,6 +75,68 @@ declare abstract class IEmailConnector {
|
|
|
79
75
|
abstract sendEmail(email: IEmail): Promise<void>;
|
|
80
76
|
}
|
|
81
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Received Email structure (matches email-receiver format)
|
|
80
|
+
*/
|
|
81
|
+
interface ReceivedEmail {
|
|
82
|
+
messageId: string;
|
|
83
|
+
from: string;
|
|
84
|
+
to: string;
|
|
85
|
+
subject: string;
|
|
86
|
+
text?: string;
|
|
87
|
+
html?: string;
|
|
88
|
+
headers: Record<string, string>;
|
|
89
|
+
receivedAt: string;
|
|
90
|
+
size: number;
|
|
91
|
+
raw?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Input schema for getting received emails
|
|
95
|
+
*/
|
|
96
|
+
declare const getReceivedEmailsInputSchema: z.ZodObject<{
|
|
97
|
+
recipient: z.ZodEmail;
|
|
98
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
99
|
+
includeContent: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
type GetReceivedEmailsInput = z.infer<typeof getReceivedEmailsInputSchema>;
|
|
102
|
+
/**
|
|
103
|
+
* Output schema for getting received emails
|
|
104
|
+
*/
|
|
105
|
+
interface GetReceivedEmailsOutput {
|
|
106
|
+
emails: ReceivedEmail[];
|
|
107
|
+
count: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Input schema for waiting for email (E2E tests helper)
|
|
111
|
+
*/
|
|
112
|
+
declare const waitForEmailInputSchema: z.ZodObject<{
|
|
113
|
+
recipient: z.ZodEmail;
|
|
114
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
115
|
+
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
116
|
+
pollInterval: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
type WaitForEmailInput = z.infer<typeof waitForEmailInputSchema>;
|
|
119
|
+
/**
|
|
120
|
+
* Output schema for waiting for email
|
|
121
|
+
*/
|
|
122
|
+
interface WaitForEmailOutput {
|
|
123
|
+
email: ReceivedEmail | null;
|
|
124
|
+
found: boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Input schema for clearing received emails
|
|
128
|
+
*/
|
|
129
|
+
declare const clearReceivedEmailsInputSchema: z.ZodObject<{
|
|
130
|
+
recipient: z.ZodEmail;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
type ClearReceivedEmailsInput = z.infer<typeof clearReceivedEmailsInputSchema>;
|
|
133
|
+
/**
|
|
134
|
+
* Output schema for clearing received emails
|
|
135
|
+
*/
|
|
136
|
+
interface ClearReceivedEmailsOutput {
|
|
137
|
+
deleted: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
82
140
|
declare const sendEmailInputSchema: z$1.ZodObject<{
|
|
83
141
|
email: z$1.ZodObject<{
|
|
84
142
|
to: z$1.ZodUnion<readonly [z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
|
|
@@ -176,11 +234,31 @@ interface SendSmsInput extends z.infer<typeof sendSmsInputSchema> {
|
|
|
176
234
|
interface SendSmsOutput {
|
|
177
235
|
}
|
|
178
236
|
|
|
237
|
+
declare const sendWebhookInputSchema: z$2.ZodObject<{
|
|
238
|
+
webhook: z$2.ZodObject<{
|
|
239
|
+
url: z$2.ZodURL;
|
|
240
|
+
payload: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
|
|
241
|
+
headers: z$2.ZodOptional<z$2.ZodRecord<z$2.ZodString, z$2.ZodString>>;
|
|
242
|
+
}, z$2.core.$strip>;
|
|
243
|
+
metadata: z$2.ZodObject<{
|
|
244
|
+
userAgent: z$2.ZodOptional<z$2.ZodString>;
|
|
245
|
+
ip: z$2.ZodOptional<z$2.ZodUnion<[z$2.ZodIPv4, z$2.ZodIPv6]>>;
|
|
246
|
+
initiator: z$2.ZodObject<{
|
|
247
|
+
service: z$2.ZodString;
|
|
248
|
+
userId: z$2.ZodOptional<z$2.ZodString>;
|
|
249
|
+
}, z$2.core.$strip>;
|
|
250
|
+
}, z$2.core.$strip>;
|
|
251
|
+
}, z$2.core.$strip>;
|
|
252
|
+
interface SendWebhookInput extends z$2.infer<typeof sendWebhookInputSchema> {
|
|
253
|
+
}
|
|
254
|
+
interface SendWebhookOutput {
|
|
255
|
+
}
|
|
256
|
+
|
|
179
257
|
interface IPushNotification {
|
|
180
258
|
}
|
|
181
259
|
|
|
182
260
|
interface NotificationQueueMessage {
|
|
183
|
-
type: 'email' | 'sms' | 'pushNotification' | 'slack';
|
|
261
|
+
type: 'email' | 'sms' | 'pushNotification' | 'slack' | 'webhook';
|
|
184
262
|
metadata: {
|
|
185
263
|
userAgent?: string;
|
|
186
264
|
ip?: string;
|
|
@@ -194,6 +272,7 @@ interface NotificationQueueMessage {
|
|
|
194
272
|
sms?: ISms;
|
|
195
273
|
pushNotification?: IPushNotification;
|
|
196
274
|
slack?: ISlack;
|
|
275
|
+
webhook?: IWebhook;
|
|
197
276
|
};
|
|
198
277
|
}
|
|
199
278
|
|
|
@@ -212,7 +291,7 @@ declare abstract class ISmsConnector {
|
|
|
212
291
|
AUTH_TOKEN: string;
|
|
213
292
|
SERVICE_ID: string;
|
|
214
293
|
});
|
|
215
|
-
abstract sendSms(sms: ISms): Promise<
|
|
294
|
+
abstract sendSms(sms: ISms): Promise<void>;
|
|
216
295
|
}
|
|
217
296
|
|
|
218
297
|
interface ISlack {
|
|
@@ -225,5 +304,17 @@ declare class SlackConnector {
|
|
|
225
304
|
sendNotificationToAllSlack(message: string): Promise<void>;
|
|
226
305
|
}
|
|
227
306
|
|
|
228
|
-
|
|
229
|
-
|
|
307
|
+
interface IWebhook {
|
|
308
|
+
url: string;
|
|
309
|
+
payload: Record<string, unknown>;
|
|
310
|
+
headers?: Record<string, string>;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
declare class WebhookConnector {
|
|
314
|
+
private privateKey;
|
|
315
|
+
constructor(privateKey: string);
|
|
316
|
+
sendWebhook(webhook: IWebhook): Promise<void>;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export { sendSlackInputSchema as A, sendSmsInputSchema as B, sendWebhookInputSchema as D, waitForEmailInputSchema as E, IEmailConnector as I, SlackConnector as S, WebhookConnector as W, ISmsConnector as a, clearReceivedEmailsInputSchema as u, getReceivedEmailsInputSchema as v, iAttachmentSchema as w, iContactSchema as x, iEmailSchema as y, sendEmailInputSchema as z };
|
|
320
|
+
export type { ClearReceivedEmailsInput as C, GetReceivedEmailsInput as G, NotificationQueueMessage as N, ReceivedEmail as R, SendEmailInput as b, SendEmailOutput as c, SendSmsInput as d, SendSmsOutput as e, SendSlackInput as f, SendSlackOutput as g, SendWebhookInput as h, SendWebhookOutput as i, GetReceivedEmailsOutput as j, WaitForEmailInput as k, WaitForEmailOutput as l, ClearReceivedEmailsOutput as m, IEmail as n, IContact as o, ISms as p, IAttachment as q, IPushNotification as r, ISlack as s, IWebhook as t };
|