@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.
Files changed (35) hide show
  1. package/README.md +239 -0
  2. package/dist/database/schema.cjs +4 -6
  3. package/dist/database/schema.d.cts +6 -2
  4. package/dist/database/schema.d.mts +6 -2
  5. package/dist/database/schema.d.ts +6 -2
  6. package/dist/database/schema.mjs +5 -3
  7. package/dist/export/worker.cjs +270 -69
  8. package/dist/export/worker.d.cts +22 -3
  9. package/dist/export/worker.d.mts +22 -3
  10. package/dist/export/worker.d.ts +22 -3
  11. package/dist/export/worker.mjs +262 -61
  12. package/dist/export/wrangler.cjs +19 -1
  13. package/dist/export/wrangler.d.cts +5 -1
  14. package/dist/export/wrangler.d.mts +5 -1
  15. package/dist/export/wrangler.d.ts +5 -1
  16. package/dist/export/wrangler.mjs +19 -1
  17. package/dist/shared/{notification.Dk_5TX9v.cjs → notification.BLPB8Ib2.cjs} +109 -11
  18. package/dist/shared/{notification.2rSOcFrr.d.cts → notification.BiG4Q650.d.cts} +99 -8
  19. package/dist/shared/{notification.C1quYqlT.d.mts → notification.BiG4Q650.d.mts} +99 -8
  20. package/dist/shared/{notification.oEdhCsu_.d.ts → notification.BiG4Q650.d.ts} +99 -8
  21. package/dist/shared/{notification.CM_WoR0y.mjs → notification.CP_hFlNt.mjs} +105 -12
  22. package/dist/shared/{notification.BB9Jl8DI.d.ts → notification.CdlaOUd0.d.cts} +3 -0
  23. package/dist/shared/{notification.BB9Jl8DI.d.cts → notification.CdlaOUd0.d.mts} +3 -0
  24. package/dist/shared/{notification.BB9Jl8DI.d.mts → notification.CdlaOUd0.d.ts} +3 -0
  25. package/dist/types.cjs +19 -19
  26. package/dist/types.d.cts +6 -18
  27. package/dist/types.d.mts +6 -18
  28. package/dist/types.d.ts +6 -18
  29. package/dist/types.mjs +2 -10
  30. package/package.json +3 -3
  31. package/dist/shared/notification.4b3eUEIG.cjs +0 -22
  32. package/dist/shared/notification.BWLPh6Gb.d.cts +0 -140
  33. package/dist/shared/notification.BWLPh6Gb.d.mts +0 -140
  34. package/dist/shared/notification.BWLPh6Gb.d.ts +0 -140
  35. package/dist/shared/notification.C0X8Orrh.mjs +0 -19
@@ -2,6 +2,7 @@ import z$1, { z } from 'zod';
2
2
  import { useFetch, createInternalError } from '@develit-io/backend-sdk';
3
3
  import { z as z$2 } from 'zod/v4';
4
4
  import twilio from 'twilio';
5
+ import { signPayload } from '@develit-io/backend-sdk/signature';
5
6
 
6
7
  const iContactSchema = z.union([
7
8
  z.string(),
@@ -70,6 +71,21 @@ class IEmailConnector {
70
71
  }
71
72
  }
72
73
 
74
+ const getReceivedEmailsInputSchema = z.object({
75
+ recipient: z.email("Invalid email address"),
76
+ limit: z.number().min(1).max(100).optional().default(10),
77
+ includeContent: z.boolean().optional().default(true)
78
+ });
79
+ const waitForEmailInputSchema = z.object({
80
+ recipient: z.email("Invalid email address"),
81
+ subject: z.string().optional(),
82
+ timeout: z.number().min(1e3).max(6e4).optional().default(1e4),
83
+ pollInterval: z.number().min(100).max(5e3).optional().default(500)
84
+ });
85
+ const clearReceivedEmailsInputSchema = z.object({
86
+ recipient: z.email("Invalid email address")
87
+ });
88
+
73
89
  class EcomailConnector extends IEmailConnector {
74
90
  static {
75
91
  this.providerName = "ecomail";
@@ -100,7 +116,12 @@ class EcomailConnector extends IEmailConnector {
100
116
  },
101
117
  body: JSON.stringify(emEmail)
102
118
  });
103
- if (error) throw error;
119
+ if (error)
120
+ throw createInternalError(error, {
121
+ message: `Ecomail: failed to send ${emEmail.message.template_id ? "template " : ""}email: ${error.message}`,
122
+ code: emEmail.message.template_id ? "CONN-N-02" : "CONN-N-01",
123
+ status: 502
124
+ });
104
125
  }
105
126
  convertEmail(email) {
106
127
  const toContacts = this.convertContacts(email.to);
@@ -208,6 +229,22 @@ const sendSmsInputSchema = z.object({
208
229
  })
209
230
  });
210
231
 
232
+ const sendWebhookInputSchema = z$2.object({
233
+ webhook: z$2.object({
234
+ url: z$2.url(),
235
+ payload: z$2.record(z$2.string(), z$2.unknown()),
236
+ headers: z$2.record(z$2.string(), z$2.string()).optional()
237
+ }),
238
+ metadata: z$2.object({
239
+ userAgent: z$2.string().optional(),
240
+ ip: z$2.ipv4().or(z$2.ipv6()).optional(),
241
+ initiator: z$2.object({
242
+ service: z$2.string(),
243
+ userId: z$2.string().optional()
244
+ })
245
+ })
246
+ });
247
+
211
248
  class ISmsConnector {
212
249
  constructor({
213
250
  ACCOUNT_ID,
@@ -239,8 +276,9 @@ class TwilioConnector extends ISmsConnector {
239
276
  to: sms.to
240
277
  });
241
278
  if (message.errorMessage)
242
- return createInternalError(null, {
243
- message: message.errorMessage,
279
+ throw createInternalError(null, {
280
+ message: `Twilio: ${message.errorMessage}`,
281
+ code: "CONN-N-03",
244
282
  status: message.errorCode
245
283
  });
246
284
  }
@@ -253,17 +291,72 @@ class SlackConnector {
253
291
  async sendNotificationToAllSlack(message) {
254
292
  const controller = new AbortController();
255
293
  const timeoutId = setTimeout(() => controller.abort(), 3e3);
256
- const response = await fetch(this.webhook, {
257
- method: "POST",
258
- body: JSON.stringify({ text: message }),
259
- headers: { "Content-Type": "application/json" },
260
- signal: controller.signal
261
- });
294
+ let response;
295
+ try {
296
+ response = await fetch(this.webhook, {
297
+ method: "POST",
298
+ body: JSON.stringify({ text: message }),
299
+ headers: { "Content-Type": "application/json" },
300
+ signal: controller.signal
301
+ });
302
+ } catch (error) {
303
+ clearTimeout(timeoutId);
304
+ throw createInternalError(error, {
305
+ message: "Slack: request timed out",
306
+ code: "CONN-N-05",
307
+ status: 504
308
+ });
309
+ }
262
310
  clearTimeout(timeoutId);
263
- if (!response.ok) {
264
- throw new Error("Failed sending Slack notification to " + message);
311
+ if (!response.ok)
312
+ throw createInternalError(null, {
313
+ message: `Slack: failed to send notification (${response.status})`,
314
+ code: "CONN-N-04",
315
+ status: 502
316
+ });
317
+ }
318
+ }
319
+
320
+ class WebhookConnector {
321
+ constructor(privateKey) {
322
+ this.privateKey = privateKey;
323
+ }
324
+ async sendWebhook(webhook) {
325
+ const body = JSON.stringify(webhook.payload);
326
+ const signature = await signPayload({
327
+ payload: body,
328
+ privateKey: this.privateKey
329
+ });
330
+ const controller = new AbortController();
331
+ const timeoutId = setTimeout(() => controller.abort(), 1e4);
332
+ let response;
333
+ try {
334
+ response = await fetch(webhook.url, {
335
+ method: "POST",
336
+ body,
337
+ headers: {
338
+ "Content-Type": "application/json",
339
+ "X-Webhook-Signature": signature,
340
+ ...webhook.headers
341
+ },
342
+ signal: controller.signal
343
+ });
344
+ } catch (error) {
345
+ clearTimeout(timeoutId);
346
+ throw createInternalError(error, {
347
+ message: "Webhook: request timed out",
348
+ code: "CONN-N-07",
349
+ status: 504
350
+ });
265
351
  }
352
+ clearTimeout(timeoutId);
353
+ if (!response.ok)
354
+ throw createInternalError(null, {
355
+ message: `Webhook: delivery failed (${response.status})`,
356
+ code: "CONN-N-06",
357
+ status: 502
358
+ });
266
359
  }
267
360
  }
268
361
 
269
- export { EcomailConnector as E, IEmailConnector as I, SlackConnector as S, TwilioConnector as T, sendSmsInputSchema as a, sendSlackInputSchema as b, ISmsConnector as c, iContactSchema as d, iEmailSchema as e, iAttachmentSchema as i, sendEmailInputSchema as s };
362
+ export { EcomailConnector as E, IEmailConnector as I, SlackConnector as S, TwilioConnector as T, WebhookConnector as W, ISmsConnector as a, iContactSchema as b, clearReceivedEmailsInputSchema as c, iEmailSchema as d, sendSlackInputSchema as e, sendSmsInputSchema as f, getReceivedEmailsInputSchema as g, sendWebhookInputSchema as h, iAttachmentSchema as i, sendEmailInputSchema as s, waitForEmailInputSchema as w };
@@ -6,6 +6,9 @@ interface NotificationServiceEnvironmentConfig {
6
6
  d1: {
7
7
  id: string;
8
8
  };
9
+ kv?: {
10
+ id: string;
11
+ };
9
12
  vars: {
10
13
  EMAIL_PROVIDER: 'ecomail';
11
14
  EMAIL_SENDER_EMAIL: string;
@@ -6,6 +6,9 @@ interface NotificationServiceEnvironmentConfig {
6
6
  d1: {
7
7
  id: string;
8
8
  };
9
+ kv?: {
10
+ id: string;
11
+ };
9
12
  vars: {
10
13
  EMAIL_PROVIDER: 'ecomail';
11
14
  EMAIL_SENDER_EMAIL: string;
@@ -6,6 +6,9 @@ interface NotificationServiceEnvironmentConfig {
6
6
  d1: {
7
7
  id: string;
8
8
  };
9
+ kv?: {
10
+ id: string;
11
+ };
9
12
  vars: {
10
13
  EMAIL_PROVIDER: 'ecomail';
11
14
  EMAIL_SENDER_EMAIL: string;
package/dist/types.cjs CHANGED
@@ -1,27 +1,27 @@
1
1
  'use strict';
2
2
 
3
- const slack_connector = require('./shared/notification.Dk_5TX9v.cjs');
3
+ const webhook_connector = require('./shared/notification.BLPB8Ib2.cjs');
4
4
  require('zod');
5
5
  require('@develit-io/backend-sdk');
6
6
  require('zod/v4');
7
7
  require('twilio');
8
+ require('@develit-io/backend-sdk/signature');
8
9
 
9
- const AUDIT_LOG_EVENT_TYPES = [
10
- "EMAIL",
11
- "SMS",
12
- "PUSH_NOTIFICATION",
13
- "SLACK"
14
- ];
15
10
 
16
- exports.EcomailConnector = slack_connector.EcomailConnector;
17
- exports.IEmailConnector = slack_connector.IEmailConnector;
18
- exports.ISmsConnector = slack_connector.ISmsConnector;
19
- exports.SlackConnector = slack_connector.SlackConnector;
20
- exports.TwilioConnector = slack_connector.TwilioConnector;
21
- exports.iAttachmentSchema = slack_connector.iAttachmentSchema;
22
- exports.iContactSchema = slack_connector.iContactSchema;
23
- exports.iEmailSchema = slack_connector.iEmailSchema;
24
- exports.sendEmailInputSchema = slack_connector.sendEmailInputSchema;
25
- exports.sendSlackInputSchema = slack_connector.sendSlackInputSchema;
26
- exports.sendSmsInputSchema = slack_connector.sendSmsInputSchema;
27
- exports.AUDIT_LOG_EVENT_TYPES = AUDIT_LOG_EVENT_TYPES;
11
+
12
+ exports.EcomailConnector = webhook_connector.EcomailConnector;
13
+ exports.IEmailConnector = webhook_connector.IEmailConnector;
14
+ exports.ISmsConnector = webhook_connector.ISmsConnector;
15
+ exports.SlackConnector = webhook_connector.SlackConnector;
16
+ exports.TwilioConnector = webhook_connector.TwilioConnector;
17
+ exports.WebhookConnector = webhook_connector.WebhookConnector;
18
+ exports.clearReceivedEmailsInputSchema = webhook_connector.clearReceivedEmailsInputSchema;
19
+ exports.getReceivedEmailsInputSchema = webhook_connector.getReceivedEmailsInputSchema;
20
+ exports.iAttachmentSchema = webhook_connector.iAttachmentSchema;
21
+ exports.iContactSchema = webhook_connector.iContactSchema;
22
+ exports.iEmailSchema = webhook_connector.iEmailSchema;
23
+ exports.sendEmailInputSchema = webhook_connector.sendEmailInputSchema;
24
+ exports.sendSlackInputSchema = webhook_connector.sendSlackInputSchema;
25
+ exports.sendSmsInputSchema = webhook_connector.sendSmsInputSchema;
26
+ exports.sendWebhookInputSchema = webhook_connector.sendWebhookInputSchema;
27
+ exports.waitForEmailInputSchema = webhook_connector.waitForEmailInputSchema;
package/dist/types.d.cts CHANGED
@@ -1,11 +1,7 @@
1
- import { I as IEmailConnector, h as IEmail, i as IContact, a as ISmsConnector, j as ISms, t as tables } from './shared/notification.2rSOcFrr.cjs';
2
- export { k as IAttachment, l as IPushNotification, m as ISlack, N as NotificationQueueMessage, b as SendEmailInput, c as SendEmailOutput, f as SendSlackInput, g as SendSlackOutput, d as SendSmsInput, e as SendSmsOutput, S as SlackConnector, n as iAttachmentSchema, o as iContactSchema, p as iEmailSchema, s as sendEmailInputSchema, q as sendSlackInputSchema, r as sendSmsInputSchema } from './shared/notification.2rSOcFrr.cjs';
3
- import { InternalError } from '@develit-io/backend-sdk';
1
+ import { I as IEmailConnector, n as IEmail, o as IContact, a as ISmsConnector, p as ISms } from './shared/notification.BiG4Q650.cjs';
2
+ export { C as ClearReceivedEmailsInput, m as ClearReceivedEmailsOutput, G as GetReceivedEmailsInput, j as GetReceivedEmailsOutput, q as IAttachment, r as IPushNotification, s as ISlack, t as IWebhook, N as NotificationQueueMessage, R as ReceivedEmail, b as SendEmailInput, c as SendEmailOutput, f as SendSlackInput, g as SendSlackOutput, d as SendSmsInput, e as SendSmsOutput, h as SendWebhookInput, i as SendWebhookOutput, S as SlackConnector, k as WaitForEmailInput, l as WaitForEmailOutput, W as WebhookConnector, u as clearReceivedEmailsInputSchema, v as getReceivedEmailsInputSchema, w as iAttachmentSchema, x as iContactSchema, y as iEmailSchema, z as sendEmailInputSchema, A as sendSlackInputSchema, B as sendSmsInputSchema, D as sendWebhookInputSchema, E as waitForEmailInputSchema } from './shared/notification.BiG4Q650.cjs';
4
3
  import twilio from 'twilio';
5
- import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
6
- export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.BB9Jl8DI.cjs';
7
- import './shared/notification.BWLPh6Gb.cjs';
8
- import 'drizzle-orm/sqlite-core';
4
+ export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.CdlaOUd0.cjs';
9
5
  import 'zod';
10
6
  import 'zod/v4';
11
7
 
@@ -57,16 +53,8 @@ declare class TwilioConnector extends ISmsConnector {
57
53
  AUTH_TOKEN: string;
58
54
  SERVICE_ID: string;
59
55
  });
60
- sendSms(sms: ISms): Promise<InternalError | void>;
56
+ sendSms(sms: ISms): Promise<void>;
61
57
  }
62
58
 
63
- interface AuditLogSelectType extends InferSelectModel<typeof tables.auditLog> {
64
- }
65
- interface AuditLogInsertType extends InferInsertModel<typeof tables.auditLog> {
66
- }
67
-
68
- declare const AUDIT_LOG_EVENT_TYPES: readonly ["EMAIL", "SMS", "PUSH_NOTIFICATION", "SLACK"];
69
- type AuditLogEventType = (typeof AUDIT_LOG_EVENT_TYPES)[number];
70
-
71
- export { AUDIT_LOG_EVENT_TYPES, EcomailConnector, IContact, IEmail, IEmailConnector, ISms, ISmsConnector, TwilioConnector };
72
- export type { AuditLogEventType, AuditLogInsertType, AuditLogSelectType, EMAttachment, EMContact, EMEmail };
59
+ export { EcomailConnector, IContact, IEmail, IEmailConnector, ISms, ISmsConnector, TwilioConnector };
60
+ export type { EMAttachment, EMContact, EMEmail };
package/dist/types.d.mts CHANGED
@@ -1,11 +1,7 @@
1
- import { I as IEmailConnector, h as IEmail, i as IContact, a as ISmsConnector, j as ISms, t as tables } from './shared/notification.C1quYqlT.mjs';
2
- export { k as IAttachment, l as IPushNotification, m as ISlack, N as NotificationQueueMessage, b as SendEmailInput, c as SendEmailOutput, f as SendSlackInput, g as SendSlackOutput, d as SendSmsInput, e as SendSmsOutput, S as SlackConnector, n as iAttachmentSchema, o as iContactSchema, p as iEmailSchema, s as sendEmailInputSchema, q as sendSlackInputSchema, r as sendSmsInputSchema } from './shared/notification.C1quYqlT.mjs';
3
- import { InternalError } from '@develit-io/backend-sdk';
1
+ import { I as IEmailConnector, n as IEmail, o as IContact, a as ISmsConnector, p as ISms } from './shared/notification.BiG4Q650.mjs';
2
+ export { C as ClearReceivedEmailsInput, m as ClearReceivedEmailsOutput, G as GetReceivedEmailsInput, j as GetReceivedEmailsOutput, q as IAttachment, r as IPushNotification, s as ISlack, t as IWebhook, N as NotificationQueueMessage, R as ReceivedEmail, b as SendEmailInput, c as SendEmailOutput, f as SendSlackInput, g as SendSlackOutput, d as SendSmsInput, e as SendSmsOutput, h as SendWebhookInput, i as SendWebhookOutput, S as SlackConnector, k as WaitForEmailInput, l as WaitForEmailOutput, W as WebhookConnector, u as clearReceivedEmailsInputSchema, v as getReceivedEmailsInputSchema, w as iAttachmentSchema, x as iContactSchema, y as iEmailSchema, z as sendEmailInputSchema, A as sendSlackInputSchema, B as sendSmsInputSchema, D as sendWebhookInputSchema, E as waitForEmailInputSchema } from './shared/notification.BiG4Q650.mjs';
4
3
  import twilio from 'twilio';
5
- import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
6
- export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.BB9Jl8DI.mjs';
7
- import './shared/notification.BWLPh6Gb.mjs';
8
- import 'drizzle-orm/sqlite-core';
4
+ export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.CdlaOUd0.mjs';
9
5
  import 'zod';
10
6
  import 'zod/v4';
11
7
 
@@ -57,16 +53,8 @@ declare class TwilioConnector extends ISmsConnector {
57
53
  AUTH_TOKEN: string;
58
54
  SERVICE_ID: string;
59
55
  });
60
- sendSms(sms: ISms): Promise<InternalError | void>;
56
+ sendSms(sms: ISms): Promise<void>;
61
57
  }
62
58
 
63
- interface AuditLogSelectType extends InferSelectModel<typeof tables.auditLog> {
64
- }
65
- interface AuditLogInsertType extends InferInsertModel<typeof tables.auditLog> {
66
- }
67
-
68
- declare const AUDIT_LOG_EVENT_TYPES: readonly ["EMAIL", "SMS", "PUSH_NOTIFICATION", "SLACK"];
69
- type AuditLogEventType = (typeof AUDIT_LOG_EVENT_TYPES)[number];
70
-
71
- export { AUDIT_LOG_EVENT_TYPES, EcomailConnector, IContact, IEmail, IEmailConnector, ISms, ISmsConnector, TwilioConnector };
72
- export type { AuditLogEventType, AuditLogInsertType, AuditLogSelectType, EMAttachment, EMContact, EMEmail };
59
+ export { EcomailConnector, IContact, IEmail, IEmailConnector, ISms, ISmsConnector, TwilioConnector };
60
+ export type { EMAttachment, EMContact, EMEmail };
package/dist/types.d.ts CHANGED
@@ -1,11 +1,7 @@
1
- import { I as IEmailConnector, h as IEmail, i as IContact, a as ISmsConnector, j as ISms, t as tables } from './shared/notification.oEdhCsu_.js';
2
- export { k as IAttachment, l as IPushNotification, m as ISlack, N as NotificationQueueMessage, b as SendEmailInput, c as SendEmailOutput, f as SendSlackInput, g as SendSlackOutput, d as SendSmsInput, e as SendSmsOutput, S as SlackConnector, n as iAttachmentSchema, o as iContactSchema, p as iEmailSchema, s as sendEmailInputSchema, q as sendSlackInputSchema, r as sendSmsInputSchema } from './shared/notification.oEdhCsu_.js';
3
- import { InternalError } from '@develit-io/backend-sdk';
1
+ import { I as IEmailConnector, n as IEmail, o as IContact, a as ISmsConnector, p as ISms } from './shared/notification.BiG4Q650.js';
2
+ export { C as ClearReceivedEmailsInput, m as ClearReceivedEmailsOutput, G as GetReceivedEmailsInput, j as GetReceivedEmailsOutput, q as IAttachment, r as IPushNotification, s as ISlack, t as IWebhook, N as NotificationQueueMessage, R as ReceivedEmail, b as SendEmailInput, c as SendEmailOutput, f as SendSlackInput, g as SendSlackOutput, d as SendSmsInput, e as SendSmsOutput, h as SendWebhookInput, i as SendWebhookOutput, S as SlackConnector, k as WaitForEmailInput, l as WaitForEmailOutput, W as WebhookConnector, u as clearReceivedEmailsInputSchema, v as getReceivedEmailsInputSchema, w as iAttachmentSchema, x as iContactSchema, y as iEmailSchema, z as sendEmailInputSchema, A as sendSlackInputSchema, B as sendSmsInputSchema, D as sendWebhookInputSchema, E as waitForEmailInputSchema } from './shared/notification.BiG4Q650.js';
4
3
  import twilio from 'twilio';
5
- import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
6
- export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.BB9Jl8DI.js';
7
- import './shared/notification.BWLPh6Gb.js';
8
- import 'drizzle-orm/sqlite-core';
4
+ export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.CdlaOUd0.js';
9
5
  import 'zod';
10
6
  import 'zod/v4';
11
7
 
@@ -57,16 +53,8 @@ declare class TwilioConnector extends ISmsConnector {
57
53
  AUTH_TOKEN: string;
58
54
  SERVICE_ID: string;
59
55
  });
60
- sendSms(sms: ISms): Promise<InternalError | void>;
56
+ sendSms(sms: ISms): Promise<void>;
61
57
  }
62
58
 
63
- interface AuditLogSelectType extends InferSelectModel<typeof tables.auditLog> {
64
- }
65
- interface AuditLogInsertType extends InferInsertModel<typeof tables.auditLog> {
66
- }
67
-
68
- declare const AUDIT_LOG_EVENT_TYPES: readonly ["EMAIL", "SMS", "PUSH_NOTIFICATION", "SLACK"];
69
- type AuditLogEventType = (typeof AUDIT_LOG_EVENT_TYPES)[number];
70
-
71
- export { AUDIT_LOG_EVENT_TYPES, EcomailConnector, IContact, IEmail, IEmailConnector, ISms, ISmsConnector, TwilioConnector };
72
- export type { AuditLogEventType, AuditLogInsertType, AuditLogSelectType, EMAttachment, EMContact, EMEmail };
59
+ export { EcomailConnector, IContact, IEmail, IEmailConnector, ISms, ISmsConnector, TwilioConnector };
60
+ export type { EMAttachment, EMContact, EMEmail };
package/dist/types.mjs CHANGED
@@ -1,14 +1,6 @@
1
- export { E as EcomailConnector, I as IEmailConnector, c as ISmsConnector, S as SlackConnector, T as TwilioConnector, i as iAttachmentSchema, d as iContactSchema, e as iEmailSchema, s as sendEmailInputSchema, b as sendSlackInputSchema, a as sendSmsInputSchema } from './shared/notification.CM_WoR0y.mjs';
1
+ export { E as EcomailConnector, I as IEmailConnector, a as ISmsConnector, S as SlackConnector, T as TwilioConnector, W as WebhookConnector, c as clearReceivedEmailsInputSchema, g as getReceivedEmailsInputSchema, i as iAttachmentSchema, b as iContactSchema, d as iEmailSchema, s as sendEmailInputSchema, e as sendSlackInputSchema, f as sendSmsInputSchema, h as sendWebhookInputSchema, w as waitForEmailInputSchema } from './shared/notification.CP_hFlNt.mjs';
2
2
  import 'zod';
3
3
  import '@develit-io/backend-sdk';
4
4
  import 'zod/v4';
5
5
  import 'twilio';
6
-
7
- const AUDIT_LOG_EVENT_TYPES = [
8
- "EMAIL",
9
- "SMS",
10
- "PUSH_NOTIFICATION",
11
- "SLACK"
12
- ];
13
-
14
- export { AUDIT_LOG_EVENT_TYPES };
6
+ import '@develit-io/backend-sdk/signature';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/notification",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -46,10 +46,10 @@
46
46
  "build": "unbuild"
47
47
  },
48
48
  "dependencies": {
49
- "twilio": "^5.12.0"
49
+ "twilio": "^5.12.1"
50
50
  },
51
51
  "peerDependencies": {
52
- "@develit-io/backend-sdk": "^9.8.1",
52
+ "@develit-io/backend-sdk": "^9.10.3",
53
53
  "drizzle-orm": "^0.45.0",
54
54
  "zod": "^4.1.13"
55
55
  }
@@ -1,22 +0,0 @@
1
- 'use strict';
2
-
3
- const backendSdk = require('@develit-io/backend-sdk');
4
- const sqliteCore = require('drizzle-orm/sqlite-core');
5
-
6
- const auditLog = sqliteCore.sqliteTable("audit_log", {
7
- ...backendSdk.base,
8
- event: sqliteCore.text("event").$type().notNull(),
9
- ip: sqliteCore.text("ip"),
10
- userAgent: sqliteCore.text("user_agent"),
11
- description: sqliteCore.text("description"),
12
- initiatorService: sqliteCore.text("initiator_service").notNull(),
13
- initiatorUserId: sqliteCore.text("initiator_user_id")
14
- });
15
-
16
- const schema = {
17
- __proto__: null,
18
- auditLog: auditLog
19
- };
20
-
21
- exports.auditLog = auditLog;
22
- exports.schema = schema;
@@ -1,140 +0,0 @@
1
- import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
2
-
3
- declare const auditLog: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
4
- name: "audit_log";
5
- schema: undefined;
6
- columns: {
7
- event: drizzle_orm_sqlite_core.SQLiteColumn<{
8
- name: "event";
9
- tableName: "audit_log";
10
- dataType: "string";
11
- columnType: "SQLiteText";
12
- data: "EMAIL" | "SMS" | "PUSH_NOTIFICATION" | "SLACK";
13
- driverParam: string;
14
- notNull: true;
15
- hasDefault: false;
16
- isPrimaryKey: false;
17
- isAutoincrement: false;
18
- hasRuntimeDefault: false;
19
- enumValues: [string, ...string[]];
20
- baseColumn: never;
21
- identity: undefined;
22
- generated: undefined;
23
- }, {}, {
24
- length: number | undefined;
25
- $type: "EMAIL" | "SMS" | "PUSH_NOTIFICATION" | "SLACK";
26
- }>;
27
- ip: drizzle_orm_sqlite_core.SQLiteColumn<{
28
- name: "ip";
29
- tableName: "audit_log";
30
- dataType: "string";
31
- columnType: "SQLiteText";
32
- data: string;
33
- driverParam: string;
34
- notNull: false;
35
- hasDefault: false;
36
- isPrimaryKey: false;
37
- isAutoincrement: false;
38
- hasRuntimeDefault: false;
39
- enumValues: [string, ...string[]];
40
- baseColumn: never;
41
- identity: undefined;
42
- generated: undefined;
43
- }, {}, {
44
- length: number | undefined;
45
- }>;
46
- userAgent: drizzle_orm_sqlite_core.SQLiteColumn<{
47
- name: "user_agent";
48
- tableName: "audit_log";
49
- dataType: "string";
50
- columnType: "SQLiteText";
51
- data: string;
52
- driverParam: string;
53
- notNull: false;
54
- hasDefault: false;
55
- isPrimaryKey: false;
56
- isAutoincrement: false;
57
- hasRuntimeDefault: false;
58
- enumValues: [string, ...string[]];
59
- baseColumn: never;
60
- identity: undefined;
61
- generated: undefined;
62
- }, {}, {
63
- length: number | undefined;
64
- }>;
65
- description: drizzle_orm_sqlite_core.SQLiteColumn<{
66
- name: "description";
67
- tableName: "audit_log";
68
- dataType: "string";
69
- columnType: "SQLiteText";
70
- data: string;
71
- driverParam: string;
72
- notNull: false;
73
- hasDefault: false;
74
- isPrimaryKey: false;
75
- isAutoincrement: false;
76
- hasRuntimeDefault: false;
77
- enumValues: [string, ...string[]];
78
- baseColumn: never;
79
- identity: undefined;
80
- generated: undefined;
81
- }, {}, {
82
- length: number | undefined;
83
- }>;
84
- initiatorService: drizzle_orm_sqlite_core.SQLiteColumn<{
85
- name: "initiator_service";
86
- tableName: "audit_log";
87
- dataType: "string";
88
- columnType: "SQLiteText";
89
- data: string;
90
- driverParam: string;
91
- notNull: true;
92
- hasDefault: false;
93
- isPrimaryKey: false;
94
- isAutoincrement: false;
95
- hasRuntimeDefault: false;
96
- enumValues: [string, ...string[]];
97
- baseColumn: never;
98
- identity: undefined;
99
- generated: undefined;
100
- }, {}, {
101
- length: number | undefined;
102
- }>;
103
- initiatorUserId: drizzle_orm_sqlite_core.SQLiteColumn<{
104
- name: "initiator_user_id";
105
- tableName: "audit_log";
106
- dataType: "string";
107
- columnType: "SQLiteText";
108
- data: string;
109
- driverParam: string;
110
- notNull: false;
111
- hasDefault: false;
112
- isPrimaryKey: false;
113
- isAutoincrement: false;
114
- hasRuntimeDefault: false;
115
- enumValues: [string, ...string[]];
116
- baseColumn: never;
117
- identity: undefined;
118
- generated: undefined;
119
- }, {}, {
120
- length: number | undefined;
121
- }>;
122
- id: _packages_backend_sdk.IsPrimaryKey<_packages_backend_sdk.NotNull<_packages_backend_sdk.SQLiteTextBuilderInitial<"id", [string, ...string[]], number | undefined>>>;
123
- createdAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"created_at">>;
124
- createdBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"created_by", [string, ...string[]], number | undefined>;
125
- updatedAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"updated_at">>>;
126
- updatedBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"updated_by", [string, ...string[]], number | undefined>;
127
- deletedAt: _packages_backend_sdk.HasDefault<_packages_backend_sdk.SQLiteTimestampBuilderInitial<"deleted_at">>;
128
- deletedBy: _packages_backend_sdk.SQLiteTextBuilderInitial<"deleted_by", [string, ...string[]], number | undefined>;
129
- };
130
- dialect: "sqlite";
131
- }>;
132
-
133
- declare const schema_auditLog: typeof auditLog;
134
- declare namespace schema {
135
- export {
136
- schema_auditLog as auditLog,
137
- };
138
- }
139
-
140
- export { auditLog as a, schema as s };