@develit-services/notification 0.4.1 → 0.5.1

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 (29) hide show
  1. package/README.md +182 -0
  2. package/dist/database/schema.d.cts +1 -1
  3. package/dist/database/schema.d.mts +1 -1
  4. package/dist/database/schema.d.ts +1 -1
  5. package/dist/export/worker.cjs +11 -5
  6. package/dist/export/worker.d.cts +2 -2
  7. package/dist/export/worker.d.mts +2 -2
  8. package/dist/export/worker.d.ts +2 -2
  9. package/dist/export/worker.mjs +11 -5
  10. package/dist/export/wrangler.d.cts +1 -1
  11. package/dist/export/wrangler.d.mts +1 -1
  12. package/dist/export/wrangler.d.ts +1 -1
  13. package/dist/shared/{notification.Dk_5TX9v.cjs → notification.B0pktSz9.cjs} +31 -12
  14. package/dist/shared/{notification.CQ6qviKt.d.ts → notification.B4ZLWDCP.d.cts} +4 -5
  15. package/dist/shared/{notification.ko9XPJGs.d.cts → notification.BB9Jl8DI.d.cts} +1 -1
  16. package/dist/shared/{notification.ko9XPJGs.d.mts → notification.BB9Jl8DI.d.mts} +1 -1
  17. package/dist/shared/{notification.ko9XPJGs.d.ts → notification.BB9Jl8DI.d.ts} +1 -1
  18. package/dist/shared/{notification.BJyMXKGH.d.cts → notification.BWLPh6Gb.d.cts} +7 -70
  19. package/dist/shared/{notification.BJyMXKGH.d.mts → notification.BWLPh6Gb.d.mts} +7 -70
  20. package/dist/shared/{notification.BJyMXKGH.d.ts → notification.BWLPh6Gb.d.ts} +7 -70
  21. package/dist/shared/{notification.DkjmuyrV.mjs → notification.CmITLO7E.mjs} +32 -13
  22. package/dist/shared/{notification.B6BS7SD_.d.cts → notification.CpFoKjoN.d.mts} +4 -5
  23. package/dist/shared/{notification.jZ826xHp.d.mts → notification.DWuoMDHY.d.ts} +4 -5
  24. package/dist/types.cjs +1 -1
  25. package/dist/types.d.cts +6 -7
  26. package/dist/types.d.mts +6 -7
  27. package/dist/types.d.ts +6 -7
  28. package/dist/types.mjs +1 -1
  29. package/package.json +10 -13
package/README.md ADDED
@@ -0,0 +1,182 @@
1
+ # Notification Service
2
+
3
+ Microsluzba pro odesilani notifikaci (email, SMS, Slack, push). Postavena na Cloudflare Workers s D1 databazi.
4
+
5
+ ## Obsah
6
+
7
+ - [Architektura](#architektura)
8
+ - [Kanaly notifikaci](#kanaly-notifikaci)
9
+ - [Queue processing](#queue-processing)
10
+ - [Konektory](#konektory)
11
+ - [RPC akce](#rpc-akce)
12
+ - [Audit logging](#audit-logging)
13
+ - [Databazove schema](#databazove-schema)
14
+ - [Error Codes](#error-codes)
15
+
16
+ ## Architektura
17
+
18
+ Sluzba se sklada z:
19
+
20
+ - **Akce (Actions)** - RPC endpointy pro odesilani notifikaci
21
+ - **Queue handler** - Asynchronni zpracovani notifikaci z fronty
22
+ - **Konektory** - Abstrakce nad API externich sluzeb (Ecomail, Twilio, Slack)
23
+ - **Audit log** - Zaznamenani vsech odeslanych notifikaci do D1
24
+
25
+ Bindings:
26
+ - `NOTIFICATION_D1` - Cloudflare D1 databaze
27
+ - `NOTIFICATIONS_QUEUE` - Fronta pro asynchronni zpracovani
28
+ - `SECRETS_STORE` - Service binding na secrets store
29
+ - `SLACK_WEBHOOK` - Webhook URL pro Slack notifikace
30
+
31
+ ## Kanaly notifikaci
32
+
33
+ | Kanal | Konektor | Stav |
34
+ |-------|----------|------|
35
+ | Email | Ecomail | Aktivni |
36
+ | SMS | Twilio | Aktivni |
37
+ | Slack | Slack Webhook | Aktivni |
38
+ | Push | - | Neimplementovano |
39
+
40
+ ## Queue processing
41
+
42
+ Notifikace lze odesilat synchronne (primo) nebo asynchronne (pres frontu).
43
+
44
+ ### Async flow (vychozi)
45
+
46
+ ```
47
+ public-send-email / public-send-sms
48
+
49
+
50
+ NOTIFICATIONS_QUEUE
51
+
52
+
53
+ Queue handler (switch dle type)
54
+ ├─ email → _sendEmail()
55
+ ├─ sms → _sendSms()
56
+ ├─ slack → sendSlackNotification()
57
+ └─ push → _sendPushNotification() (501)
58
+
59
+ ├─ success → message.ack()
60
+ └─ error → message.retry() (exponential backoff, base 60s)
61
+ ```
62
+
63
+ ### Sync flow
64
+
65
+ `public-send-email-sync` vola `_sendEmail()` primo bez fronty.
66
+
67
+ ### Queue message
68
+
69
+ ```typescript
70
+ {
71
+ type: 'email' | 'sms' | 'pushNotification' | 'slack'
72
+ metadata: {
73
+ userAgent?: string
74
+ ip?: string
75
+ initiator: { service: string, userId?: string }
76
+ }
77
+ payload: {
78
+ email?: IEmail
79
+ sms?: ISms
80
+ pushNotification?: IPushNotification
81
+ slack?: ISlack
82
+ }
83
+ }
84
+ ```
85
+
86
+ ## Konektory
87
+
88
+ ### Ecomail (email)
89
+
90
+ Provider pro transakcni emaily. Podporuje:
91
+ - Plain text a HTML emaily (`/transactional/send-message`)
92
+ - Template emaily s merge vars (`/transactional/send-template`)
93
+ - Prilohy (base64, max 10 priloh, celkem 25MB)
94
+ - CC, BCC, Reply-To
95
+
96
+ Omezeni: Ecomail odmita emaily s `localhost` v template variables - connector automaticky nahradi `localhost` za `origin`.
97
+
98
+ ### Twilio (SMS)
99
+
100
+ Provider pro SMS pres Twilio Messaging Service.
101
+
102
+ ### Slack (webhook)
103
+
104
+ Odesilani notifikaci pres Slack Incoming Webhook. Timeout 3s.
105
+
106
+ ## RPC akce
107
+
108
+ Notification service je **RPC worker** - vsechny akce dostupne pres Cloudflare Worker binding.
109
+
110
+ ### Verejne akce
111
+
112
+ | Akce | Popis |
113
+ |------|-------|
114
+ | `public-send-email` | Zaradi email do fronty (async) |
115
+ | `public-send-email-sync` | Odesle email primo (sync) |
116
+ | `public-send-sms` | Zaradi SMS do fronty (async) |
117
+ | `send-slack-notification` | Odesle Slack notifikaci (sync) |
118
+
119
+ ### Interni akce
120
+
121
+ | Akce | Popis |
122
+ |------|-------|
123
+ | `private-send-email` | Odesle email pres konektor + audit log |
124
+ | `private-send-sms` | Odesle SMS pres konektor + audit log |
125
+ | `send-push-notification` | Neimplementovano (501) |
126
+
127
+ ### Vstupy
128
+
129
+ Vsechny akce vyzaduji `metadata` objekt:
130
+
131
+ ```typescript
132
+ metadata: {
133
+ userAgent?: string
134
+ ip?: string // IPv4 nebo IPv6
135
+ initiator: {
136
+ service: string // nazev volajici sluzby
137
+ userId?: string
138
+ }
139
+ }
140
+ ```
141
+
142
+ **Email** podporuje: `to`, `cc`, `bcc`, `replyTo`, `from`, `subject`, `text`, `html`, `templateId`, `templateVariables`, `attachments`.
143
+
144
+ **SMS** podporuje: `message`, `to`.
145
+
146
+ **Slack** podporuje: `message`.
147
+
148
+ ## Audit logging
149
+
150
+ Kazdy uspesne odeslany email a SMS se zaznamenava do audit logu.
151
+
152
+ Zaznamenavane udaje: event type, IP adresa, user agent, popis (JSON vstupu), initiator service, initiator user ID.
153
+
154
+ ## Databazove schema
155
+
156
+ ### audit_log
157
+
158
+ | Sloupec | Typ | Popis |
159
+ |---------|-----|-------|
160
+ | `id` | text | UUID |
161
+ | `createdAt` | timestamp | Cas vytvoreni |
162
+ | `event` | text | `EMAIL` \| `SMS` \| `PUSH_NOTIFICATION` \| `SLACK` |
163
+ | `ip` | text | IP adresa (nullable) |
164
+ | `userAgent` | text | User agent (nullable) |
165
+ | `description` | text | JSON dump vstupu (nullable) |
166
+ | `initiatorService` | text | Nazev volajici sluzby |
167
+ | `initiatorUserId` | text | ID uzivatele (nullable) |
168
+
169
+ ## Error Codes
170
+
171
+ Format: `{CATEGORY}-N-{NUMBER}`
172
+
173
+ | Code | Status | Popis |
174
+ |------|--------|-------|
175
+ | `CONN-N-01` | 502 | Ecomail: failed to send email |
176
+ | `CONN-N-02` | 502 | Ecomail: failed to send template email |
177
+ | `CONN-N-03` | 502 | Twilio: failed to send SMS |
178
+ | `CONN-N-04` | 502 | Slack: failed to send notification |
179
+ | `CONN-N-05` | 504 | Slack: request timed out |
180
+ | `VALID-N-01` | 404 | Unsupported email provider |
181
+ | `VALID-N-02` | 404 | Unsupported SMS provider |
182
+ | `SYS-N-01` | 501 | Push notifications not implemented |
@@ -1,2 +1,2 @@
1
- export { a as auditLog } from '../shared/notification.BJyMXKGH.cjs';
1
+ export { a as auditLog } from '../shared/notification.BWLPh6Gb.cjs';
2
2
  import 'drizzle-orm/sqlite-core';
@@ -1,2 +1,2 @@
1
- export { a as auditLog } from '../shared/notification.BJyMXKGH.mjs';
1
+ export { a as auditLog } from '../shared/notification.BWLPh6Gb.mjs';
2
2
  import 'drizzle-orm/sqlite-core';
@@ -1,2 +1,2 @@
1
- export { a as auditLog } from '../shared/notification.BJyMXKGH.js';
1
+ export { a as auditLog } from '../shared/notification.BWLPh6Gb.js';
2
2
  import 'drizzle-orm/sqlite-core';
@@ -6,7 +6,7 @@ const backendSdk = require('@develit-io/backend-sdk');
6
6
  const database_schema = require('../shared/notification.4b3eUEIG.cjs');
7
7
  require('drizzle-orm');
8
8
  require('drizzle-orm/sqlite-core');
9
- const slack_connector = require('../shared/notification.Dk_5TX9v.cjs');
9
+ const slack_connector = require('../shared/notification.B0pktSz9.cjs');
10
10
  const cloudflare_workers = require('cloudflare:workers');
11
11
  const d1 = require('drizzle-orm/d1');
12
12
  require('zod');
@@ -22,6 +22,7 @@ const initiateEmailConnector = async (provider, apiKey, smtpHost, senderEmail, s
22
22
  if (!connector)
23
23
  throw backendSdk.createInternalError(null, {
24
24
  message: "Unsupported email provider",
25
+ code: "VALID-N-01",
25
26
  status: 404
26
27
  });
27
28
  return new connector({
@@ -64,7 +65,8 @@ const initiateSmsConnector = async (provider, accountId, authToken, serviceId) =
64
65
  );
65
66
  if (!connector)
66
67
  throw backendSdk.createInternalError(null, {
67
- message: "Unsupported sms provider",
68
+ message: "Unsupported SMS provider",
69
+ code: "VALID-N-02",
68
70
  status: 404
69
71
  });
70
72
  return new connector({
@@ -280,9 +282,13 @@ let NotificationServiceBase = class extends backendSdk.develitWorker(
280
282
  );
281
283
  }
282
284
  async _sendPushNotification() {
283
- this.logInput({});
284
- this.logError({ error: "Method not implemented." });
285
- throw new Error("Method not implemented.");
285
+ return this.handleAction(null, { successMessage: "" }, async () => {
286
+ throw backendSdk.createInternalError(null, {
287
+ message: "Push notifications not implemented",
288
+ code: "SYS-N-01",
289
+ status: 501
290
+ });
291
+ });
286
292
  }
287
293
  async sendSlackNotification(input) {
288
294
  return this.handleAction(
@@ -1,9 +1,9 @@
1
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
2
  import { IRPCResponse } from '@develit-io/backend-sdk';
3
- import { S as SlackConnector, I as IEmailConnector, a as ISmsConnector, t as tables, N as NotificationQueueMessage, b as SendEmailInput, c as SendEmailOutput, d as SendSmsInput, e as SendSmsOutput, f as SendSlackInput, g as SendSlackOutput } from '../shared/notification.B6BS7SD_.cjs';
3
+ import { S as SlackConnector, I as IEmailConnector, a as ISmsConnector, t as tables, N as NotificationQueueMessage, b as SendEmailInput, c as SendEmailOutput, d as SendSmsInput, e as SendSmsOutput, f as SendSlackInput, g as SendSlackOutput } from '../shared/notification.B4ZLWDCP.cjs';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
- import '../shared/notification.BJyMXKGH.cjs';
6
+ import '../shared/notification.BWLPh6Gb.cjs';
7
7
  import 'drizzle-orm/sqlite-core';
8
8
  import 'zod';
9
9
  import 'zod/v4';
@@ -1,9 +1,9 @@
1
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
2
  import { IRPCResponse } from '@develit-io/backend-sdk';
3
- import { S as SlackConnector, I as IEmailConnector, a as ISmsConnector, t as tables, N as NotificationQueueMessage, b as SendEmailInput, c as SendEmailOutput, d as SendSmsInput, e as SendSmsOutput, f as SendSlackInput, g as SendSlackOutput } from '../shared/notification.jZ826xHp.mjs';
3
+ import { S as SlackConnector, I as IEmailConnector, a as ISmsConnector, t as tables, N as NotificationQueueMessage, b as SendEmailInput, c as SendEmailOutput, d as SendSmsInput, e as SendSmsOutput, f as SendSlackInput, g as SendSlackOutput } from '../shared/notification.CpFoKjoN.mjs';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
- import '../shared/notification.BJyMXKGH.mjs';
6
+ import '../shared/notification.BWLPh6Gb.mjs';
7
7
  import 'drizzle-orm/sqlite-core';
8
8
  import 'zod';
9
9
  import 'zod/v4';
@@ -1,9 +1,9 @@
1
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
2
  import { IRPCResponse } from '@develit-io/backend-sdk';
3
- import { S as SlackConnector, I as IEmailConnector, a as ISmsConnector, t as tables, N as NotificationQueueMessage, b as SendEmailInput, c as SendEmailOutput, d as SendSmsInput, e as SendSmsOutput, f as SendSlackInput, g as SendSlackOutput } from '../shared/notification.CQ6qviKt.js';
3
+ import { S as SlackConnector, I as IEmailConnector, a as ISmsConnector, t as tables, N as NotificationQueueMessage, b as SendEmailInput, c as SendEmailOutput, d as SendSmsInput, e as SendSmsOutput, f as SendSlackInput, g as SendSlackOutput } from '../shared/notification.DWuoMDHY.js';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
- import '../shared/notification.BJyMXKGH.js';
6
+ import '../shared/notification.BWLPh6Gb.js';
7
7
  import 'drizzle-orm/sqlite-core';
8
8
  import 'zod';
9
9
  import 'zod/v4';
@@ -2,7 +2,7 @@ import { createInternalError, uuidv4, develitWorker, cloudflareQueue, action, se
2
2
  import { s as schema } from '../shared/notification.C0X8Orrh.mjs';
3
3
  import 'drizzle-orm';
4
4
  import 'drizzle-orm/sqlite-core';
5
- import { E as EcomailConnector, T as TwilioConnector, S as SlackConnector, s as sendEmailInputSchema, a as sendSmsInputSchema, b as sendSlackInputSchema } from '../shared/notification.DkjmuyrV.mjs';
5
+ import { E as EcomailConnector, T as TwilioConnector, S as SlackConnector, s as sendEmailInputSchema, a as sendSmsInputSchema, b as sendSlackInputSchema } from '../shared/notification.CmITLO7E.mjs';
6
6
  import { WorkerEntrypoint } from 'cloudflare:workers';
7
7
  import { drizzle } from 'drizzle-orm/d1';
8
8
  import 'zod';
@@ -18,6 +18,7 @@ const initiateEmailConnector = async (provider, apiKey, smtpHost, senderEmail, s
18
18
  if (!connector)
19
19
  throw createInternalError(null, {
20
20
  message: "Unsupported email provider",
21
+ code: "VALID-N-01",
21
22
  status: 404
22
23
  });
23
24
  return new connector({
@@ -60,7 +61,8 @@ const initiateSmsConnector = async (provider, accountId, authToken, serviceId) =
60
61
  );
61
62
  if (!connector)
62
63
  throw createInternalError(null, {
63
- message: "Unsupported sms provider",
64
+ message: "Unsupported SMS provider",
65
+ code: "VALID-N-02",
64
66
  status: 404
65
67
  });
66
68
  return new connector({
@@ -276,9 +278,13 @@ let NotificationServiceBase = class extends develitWorker(
276
278
  );
277
279
  }
278
280
  async _sendPushNotification() {
279
- this.logInput({});
280
- this.logError({ error: "Method not implemented." });
281
- throw new Error("Method not implemented.");
281
+ return this.handleAction(null, { successMessage: "" }, async () => {
282
+ throw createInternalError(null, {
283
+ message: "Push notifications not implemented",
284
+ code: "SYS-N-01",
285
+ status: 501
286
+ });
287
+ });
282
288
  }
283
289
  async sendSlackNotification(input) {
284
290
  return this.handleAction(
@@ -1,4 +1,4 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.ko9XPJGs.cjs';
1
+ import { N as NotificationServiceWranglerConfig } from '../shared/notification.BB9Jl8DI.cjs';
2
2
 
3
3
  declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
4
4
  vars: {
@@ -1,4 +1,4 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.ko9XPJGs.mjs';
1
+ import { N as NotificationServiceWranglerConfig } from '../shared/notification.BB9Jl8DI.mjs';
2
2
 
3
3
  declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
4
4
  vars: {
@@ -1,4 +1,4 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.ko9XPJGs.js';
1
+ import { N as NotificationServiceWranglerConfig } from '../shared/notification.BB9Jl8DI.js';
2
2
 
3
3
  declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
4
4
  vars: {
@@ -107,7 +107,12 @@ class EcomailConnector extends IEmailConnector {
107
107
  },
108
108
  body: JSON.stringify(emEmail)
109
109
  });
110
- if (error) throw error;
110
+ if (error)
111
+ throw backendSdk.createInternalError(error, {
112
+ message: `Ecomail: failed to send ${emEmail.message.template_id ? "template " : ""}email: ${error.message}`,
113
+ code: emEmail.message.template_id ? "CONN-N-02" : "CONN-N-01",
114
+ status: 502
115
+ });
111
116
  }
112
117
  convertEmail(email) {
113
118
  const toContacts = this.convertContacts(email.to);
@@ -246,8 +251,9 @@ class TwilioConnector extends ISmsConnector {
246
251
  to: sms.to
247
252
  });
248
253
  if (message.errorMessage)
249
- return backendSdk.createInternalError(null, {
250
- message: message.errorMessage,
254
+ throw backendSdk.createInternalError(null, {
255
+ message: `Twilio: ${message.errorMessage}`,
256
+ code: "CONN-N-03",
251
257
  status: message.errorCode
252
258
  });
253
259
  }
@@ -260,16 +266,29 @@ class SlackConnector {
260
266
  async sendNotificationToAllSlack(message) {
261
267
  const controller = new AbortController();
262
268
  const timeoutId = setTimeout(() => controller.abort(), 3e3);
263
- const response = await fetch(this.webhook, {
264
- method: "POST",
265
- body: JSON.stringify({ text: message }),
266
- headers: { "Content-Type": "application/json" },
267
- signal: controller.signal
268
- });
269
- clearTimeout(timeoutId);
270
- if (!response.ok) {
271
- throw new Error("Failed sending Slack notification to " + message);
269
+ let response;
270
+ try {
271
+ response = await fetch(this.webhook, {
272
+ method: "POST",
273
+ body: JSON.stringify({ text: message }),
274
+ headers: { "Content-Type": "application/json" },
275
+ signal: controller.signal
276
+ });
277
+ } catch (error) {
278
+ clearTimeout(timeoutId);
279
+ throw backendSdk.createInternalError(error, {
280
+ message: "Slack: request timed out",
281
+ code: "CONN-N-05",
282
+ status: 504
283
+ });
272
284
  }
285
+ clearTimeout(timeoutId);
286
+ if (!response.ok)
287
+ throw backendSdk.createInternalError(null, {
288
+ message: `Slack: failed to send notification (${response.status})`,
289
+ code: "CONN-N-04",
290
+ status: 502
291
+ });
273
292
  }
274
293
  }
275
294
 
@@ -1,7 +1,6 @@
1
- import { s as schema } from './notification.BJyMXKGH.js';
1
+ import { s as schema } from './notification.BWLPh6Gb.cjs';
2
2
  import z$1, { z } from 'zod';
3
3
  import { z as z$2 } from 'zod/v4';
4
- import { InternalError } from '@develit-io/backend-sdk';
5
4
 
6
5
  declare const tables: typeof schema;
7
6
 
@@ -212,7 +211,7 @@ declare abstract class ISmsConnector {
212
211
  AUTH_TOKEN: string;
213
212
  SERVICE_ID: string;
214
213
  });
215
- abstract sendSms(sms: ISms): Promise<InternalError | void>;
214
+ abstract sendSms(sms: ISms): Promise<void>;
216
215
  }
217
216
 
218
217
  interface ISlack {
@@ -225,5 +224,5 @@ declare class SlackConnector {
225
224
  sendNotificationToAllSlack(message: string): Promise<void>;
226
225
  }
227
226
 
228
- export { IEmailConnector as I, SlackConnector as S, ISmsConnector as a, iContactSchema as k, iAttachmentSchema as l, iEmailSchema as m, sendSlackInputSchema as o, sendSmsInputSchema as p, sendEmailInputSchema as s, tables as t };
229
- export type { NotificationQueueMessage as N, SendEmailInput as b, SendEmailOutput as c, SendSmsInput as d, SendSmsOutput as e, SendSlackInput as f, SendSlackOutput as g, IEmail as h, IContact as i, ISms as j, IAttachment as n, IPushNotification as q, ISlack as r };
227
+ export { IEmailConnector as I, SlackConnector as S, ISmsConnector as a, iAttachmentSchema as n, iContactSchema as o, iEmailSchema as p, sendSlackInputSchema as q, sendSmsInputSchema as r, sendEmailInputSchema as s, tables as t };
228
+ export type { NotificationQueueMessage as N, SendEmailInput as b, SendEmailOutput as c, SendSmsInput as d, SendSmsOutput as e, SendSlackInput as f, SendSlackOutput as g, IEmail as h, IContact as i, ISms as j, IAttachment as k, IPushNotification as l, ISlack as m };
@@ -26,4 +26,4 @@ interface NotificationServiceWranglerConfig {
26
26
  interface NotificationServiceEnv extends NotificationEnv {
27
27
  }
28
28
 
29
- export type { NotificationServiceWranglerConfig as N, NotificationServiceEnvironmentConfig as a, NotificationServiceEnv as b };
29
+ export type { NotificationServiceWranglerConfig as N, NotificationServiceEnv as a, NotificationServiceEnvironmentConfig as b };
@@ -26,4 +26,4 @@ interface NotificationServiceWranglerConfig {
26
26
  interface NotificationServiceEnv extends NotificationEnv {
27
27
  }
28
28
 
29
- export type { NotificationServiceWranglerConfig as N, NotificationServiceEnvironmentConfig as a, NotificationServiceEnv as b };
29
+ export type { NotificationServiceWranglerConfig as N, NotificationServiceEnv as a, NotificationServiceEnvironmentConfig as b };
@@ -26,4 +26,4 @@ interface NotificationServiceWranglerConfig {
26
26
  interface NotificationServiceEnv extends NotificationEnv {
27
27
  }
28
28
 
29
- export type { NotificationServiceWranglerConfig as N, NotificationServiceEnvironmentConfig as a, NotificationServiceEnv as b };
29
+ export type { NotificationServiceWranglerConfig as N, NotificationServiceEnv as a, NotificationServiceEnvironmentConfig as b };
@@ -119,76 +119,13 @@ declare const auditLog: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
119
119
  }, {}, {
120
120
  length: number | undefined;
121
121
  }>;
122
- id: drizzle_orm_sqlite_core.SQLiteColumn<{
123
- name: "id";
124
- tableName: "audit_log";
125
- dataType: "string";
126
- columnType: "SQLiteText";
127
- data: string;
128
- driverParam: string;
129
- notNull: true;
130
- hasDefault: false;
131
- isPrimaryKey: true;
132
- isAutoincrement: false;
133
- hasRuntimeDefault: false;
134
- enumValues: [string, ...string[]];
135
- baseColumn: never;
136
- identity: undefined;
137
- generated: undefined;
138
- }, {}, {
139
- length: number | undefined;
140
- }>;
141
- createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
142
- name: "created_at";
143
- tableName: "audit_log";
144
- dataType: "date";
145
- columnType: "SQLiteTimestamp";
146
- data: Date;
147
- driverParam: number;
148
- notNull: false;
149
- hasDefault: true;
150
- isPrimaryKey: false;
151
- isAutoincrement: false;
152
- hasRuntimeDefault: false;
153
- enumValues: undefined;
154
- baseColumn: never;
155
- identity: undefined;
156
- generated: undefined;
157
- }, {}, {}>;
158
- updatedAt: drizzle_orm_sqlite_core.SQLiteColumn<{
159
- name: "updated_at";
160
- tableName: "audit_log";
161
- dataType: "date";
162
- columnType: "SQLiteTimestamp";
163
- data: Date;
164
- driverParam: number;
165
- notNull: false;
166
- hasDefault: true;
167
- isPrimaryKey: false;
168
- isAutoincrement: false;
169
- hasRuntimeDefault: false;
170
- enumValues: undefined;
171
- baseColumn: never;
172
- identity: undefined;
173
- generated: undefined;
174
- }, {}, {}>;
175
- deletedAt: drizzle_orm_sqlite_core.SQLiteColumn<{
176
- name: "deleted_at";
177
- tableName: "audit_log";
178
- dataType: "date";
179
- columnType: "SQLiteTimestamp";
180
- data: Date;
181
- driverParam: number;
182
- notNull: false;
183
- hasDefault: true;
184
- isPrimaryKey: false;
185
- isAutoincrement: false;
186
- hasRuntimeDefault: false;
187
- enumValues: undefined;
188
- baseColumn: never;
189
- identity: undefined;
190
- generated: undefined;
191
- }, {}, {}>;
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>;
192
129
  };
193
130
  dialect: "sqlite";
194
131
  }>;
@@ -119,76 +119,13 @@ declare const auditLog: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
119
119
  }, {}, {
120
120
  length: number | undefined;
121
121
  }>;
122
- id: drizzle_orm_sqlite_core.SQLiteColumn<{
123
- name: "id";
124
- tableName: "audit_log";
125
- dataType: "string";
126
- columnType: "SQLiteText";
127
- data: string;
128
- driverParam: string;
129
- notNull: true;
130
- hasDefault: false;
131
- isPrimaryKey: true;
132
- isAutoincrement: false;
133
- hasRuntimeDefault: false;
134
- enumValues: [string, ...string[]];
135
- baseColumn: never;
136
- identity: undefined;
137
- generated: undefined;
138
- }, {}, {
139
- length: number | undefined;
140
- }>;
141
- createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
142
- name: "created_at";
143
- tableName: "audit_log";
144
- dataType: "date";
145
- columnType: "SQLiteTimestamp";
146
- data: Date;
147
- driverParam: number;
148
- notNull: false;
149
- hasDefault: true;
150
- isPrimaryKey: false;
151
- isAutoincrement: false;
152
- hasRuntimeDefault: false;
153
- enumValues: undefined;
154
- baseColumn: never;
155
- identity: undefined;
156
- generated: undefined;
157
- }, {}, {}>;
158
- updatedAt: drizzle_orm_sqlite_core.SQLiteColumn<{
159
- name: "updated_at";
160
- tableName: "audit_log";
161
- dataType: "date";
162
- columnType: "SQLiteTimestamp";
163
- data: Date;
164
- driverParam: number;
165
- notNull: false;
166
- hasDefault: true;
167
- isPrimaryKey: false;
168
- isAutoincrement: false;
169
- hasRuntimeDefault: false;
170
- enumValues: undefined;
171
- baseColumn: never;
172
- identity: undefined;
173
- generated: undefined;
174
- }, {}, {}>;
175
- deletedAt: drizzle_orm_sqlite_core.SQLiteColumn<{
176
- name: "deleted_at";
177
- tableName: "audit_log";
178
- dataType: "date";
179
- columnType: "SQLiteTimestamp";
180
- data: Date;
181
- driverParam: number;
182
- notNull: false;
183
- hasDefault: true;
184
- isPrimaryKey: false;
185
- isAutoincrement: false;
186
- hasRuntimeDefault: false;
187
- enumValues: undefined;
188
- baseColumn: never;
189
- identity: undefined;
190
- generated: undefined;
191
- }, {}, {}>;
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>;
192
129
  };
193
130
  dialect: "sqlite";
194
131
  }>;
@@ -119,76 +119,13 @@ declare const auditLog: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
119
119
  }, {}, {
120
120
  length: number | undefined;
121
121
  }>;
122
- id: drizzle_orm_sqlite_core.SQLiteColumn<{
123
- name: "id";
124
- tableName: "audit_log";
125
- dataType: "string";
126
- columnType: "SQLiteText";
127
- data: string;
128
- driverParam: string;
129
- notNull: true;
130
- hasDefault: false;
131
- isPrimaryKey: true;
132
- isAutoincrement: false;
133
- hasRuntimeDefault: false;
134
- enumValues: [string, ...string[]];
135
- baseColumn: never;
136
- identity: undefined;
137
- generated: undefined;
138
- }, {}, {
139
- length: number | undefined;
140
- }>;
141
- createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
142
- name: "created_at";
143
- tableName: "audit_log";
144
- dataType: "date";
145
- columnType: "SQLiteTimestamp";
146
- data: Date;
147
- driverParam: number;
148
- notNull: false;
149
- hasDefault: true;
150
- isPrimaryKey: false;
151
- isAutoincrement: false;
152
- hasRuntimeDefault: false;
153
- enumValues: undefined;
154
- baseColumn: never;
155
- identity: undefined;
156
- generated: undefined;
157
- }, {}, {}>;
158
- updatedAt: drizzle_orm_sqlite_core.SQLiteColumn<{
159
- name: "updated_at";
160
- tableName: "audit_log";
161
- dataType: "date";
162
- columnType: "SQLiteTimestamp";
163
- data: Date;
164
- driverParam: number;
165
- notNull: false;
166
- hasDefault: true;
167
- isPrimaryKey: false;
168
- isAutoincrement: false;
169
- hasRuntimeDefault: false;
170
- enumValues: undefined;
171
- baseColumn: never;
172
- identity: undefined;
173
- generated: undefined;
174
- }, {}, {}>;
175
- deletedAt: drizzle_orm_sqlite_core.SQLiteColumn<{
176
- name: "deleted_at";
177
- tableName: "audit_log";
178
- dataType: "date";
179
- columnType: "SQLiteTimestamp";
180
- data: Date;
181
- driverParam: number;
182
- notNull: false;
183
- hasDefault: true;
184
- isPrimaryKey: false;
185
- isAutoincrement: false;
186
- hasRuntimeDefault: false;
187
- enumValues: undefined;
188
- baseColumn: never;
189
- identity: undefined;
190
- generated: undefined;
191
- }, {}, {}>;
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>;
192
129
  };
193
130
  dialect: "sqlite";
194
131
  }>;
@@ -100,7 +100,12 @@ class EcomailConnector extends IEmailConnector {
100
100
  },
101
101
  body: JSON.stringify(emEmail)
102
102
  });
103
- if (error) throw error;
103
+ if (error)
104
+ throw createInternalError(error, {
105
+ message: `Ecomail: failed to send ${emEmail.message.template_id ? "template " : ""}email: ${error.message}`,
106
+ code: emEmail.message.template_id ? "CONN-N-02" : "CONN-N-01",
107
+ status: 502
108
+ });
104
109
  }
105
110
  convertEmail(email) {
106
111
  const toContacts = this.convertContacts(email.to);
@@ -239,8 +244,9 @@ class TwilioConnector extends ISmsConnector {
239
244
  to: sms.to
240
245
  });
241
246
  if (message.errorMessage)
242
- return createInternalError(null, {
243
- message: message.errorMessage,
247
+ throw createInternalError(null, {
248
+ message: `Twilio: ${message.errorMessage}`,
249
+ code: "CONN-N-03",
244
250
  status: message.errorCode
245
251
  });
246
252
  }
@@ -253,17 +259,30 @@ class SlackConnector {
253
259
  async sendNotificationToAllSlack(message) {
254
260
  const controller = new AbortController();
255
261
  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
- });
262
- clearTimeout(timeoutId);
263
- if (!response.ok) {
264
- throw new Error("Failed sending Slack notification to " + message);
262
+ let response;
263
+ try {
264
+ response = await fetch(this.webhook, {
265
+ method: "POST",
266
+ body: JSON.stringify({ text: message }),
267
+ headers: { "Content-Type": "application/json" },
268
+ signal: controller.signal
269
+ });
270
+ } catch (error) {
271
+ clearTimeout(timeoutId);
272
+ throw createInternalError(error, {
273
+ message: "Slack: request timed out",
274
+ code: "CONN-N-05",
275
+ status: 504
276
+ });
265
277
  }
278
+ clearTimeout(timeoutId);
279
+ if (!response.ok)
280
+ throw createInternalError(null, {
281
+ message: `Slack: failed to send notification (${response.status})`,
282
+ code: "CONN-N-04",
283
+ status: 502
284
+ });
266
285
  }
267
286
  }
268
287
 
269
- export { EcomailConnector as E, IEmailConnector as I, SlackConnector as S, TwilioConnector as T, sendSmsInputSchema as a, sendSlackInputSchema as b, iAttachmentSchema as c, iEmailSchema as d, ISmsConnector as e, iContactSchema as i, sendEmailInputSchema as s };
288
+ 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 };
@@ -1,7 +1,6 @@
1
- import { s as schema } from './notification.BJyMXKGH.cjs';
1
+ import { s as schema } from './notification.BWLPh6Gb.mjs';
2
2
  import z$1, { z } from 'zod';
3
3
  import { z as z$2 } from 'zod/v4';
4
- import { InternalError } from '@develit-io/backend-sdk';
5
4
 
6
5
  declare const tables: typeof schema;
7
6
 
@@ -212,7 +211,7 @@ declare abstract class ISmsConnector {
212
211
  AUTH_TOKEN: string;
213
212
  SERVICE_ID: string;
214
213
  });
215
- abstract sendSms(sms: ISms): Promise<InternalError | void>;
214
+ abstract sendSms(sms: ISms): Promise<void>;
216
215
  }
217
216
 
218
217
  interface ISlack {
@@ -225,5 +224,5 @@ declare class SlackConnector {
225
224
  sendNotificationToAllSlack(message: string): Promise<void>;
226
225
  }
227
226
 
228
- export { IEmailConnector as I, SlackConnector as S, ISmsConnector as a, iContactSchema as k, iAttachmentSchema as l, iEmailSchema as m, sendSlackInputSchema as o, sendSmsInputSchema as p, sendEmailInputSchema as s, tables as t };
229
- export type { NotificationQueueMessage as N, SendEmailInput as b, SendEmailOutput as c, SendSmsInput as d, SendSmsOutput as e, SendSlackInput as f, SendSlackOutput as g, IEmail as h, IContact as i, ISms as j, IAttachment as n, IPushNotification as q, ISlack as r };
227
+ export { IEmailConnector as I, SlackConnector as S, ISmsConnector as a, iAttachmentSchema as n, iContactSchema as o, iEmailSchema as p, sendSlackInputSchema as q, sendSmsInputSchema as r, sendEmailInputSchema as s, tables as t };
228
+ export type { NotificationQueueMessage as N, SendEmailInput as b, SendEmailOutput as c, SendSmsInput as d, SendSmsOutput as e, SendSlackInput as f, SendSlackOutput as g, IEmail as h, IContact as i, ISms as j, IAttachment as k, IPushNotification as l, ISlack as m };
@@ -1,7 +1,6 @@
1
- import { s as schema } from './notification.BJyMXKGH.mjs';
1
+ import { s as schema } from './notification.BWLPh6Gb.js';
2
2
  import z$1, { z } from 'zod';
3
3
  import { z as z$2 } from 'zod/v4';
4
- import { InternalError } from '@develit-io/backend-sdk';
5
4
 
6
5
  declare const tables: typeof schema;
7
6
 
@@ -212,7 +211,7 @@ declare abstract class ISmsConnector {
212
211
  AUTH_TOKEN: string;
213
212
  SERVICE_ID: string;
214
213
  });
215
- abstract sendSms(sms: ISms): Promise<InternalError | void>;
214
+ abstract sendSms(sms: ISms): Promise<void>;
216
215
  }
217
216
 
218
217
  interface ISlack {
@@ -225,5 +224,5 @@ declare class SlackConnector {
225
224
  sendNotificationToAllSlack(message: string): Promise<void>;
226
225
  }
227
226
 
228
- export { IEmailConnector as I, SlackConnector as S, ISmsConnector as a, iContactSchema as k, iAttachmentSchema as l, iEmailSchema as m, sendSlackInputSchema as o, sendSmsInputSchema as p, sendEmailInputSchema as s, tables as t };
229
- export type { NotificationQueueMessage as N, SendEmailInput as b, SendEmailOutput as c, SendSmsInput as d, SendSmsOutput as e, SendSlackInput as f, SendSlackOutput as g, IEmail as h, IContact as i, ISms as j, IAttachment as n, IPushNotification as q, ISlack as r };
227
+ export { IEmailConnector as I, SlackConnector as S, ISmsConnector as a, iAttachmentSchema as n, iContactSchema as o, iEmailSchema as p, sendSlackInputSchema as q, sendSmsInputSchema as r, sendEmailInputSchema as s, tables as t };
228
+ export type { NotificationQueueMessage as N, SendEmailInput as b, SendEmailOutput as c, SendSmsInput as d, SendSmsOutput as e, SendSlackInput as f, SendSlackOutput as g, IEmail as h, IContact as i, ISms as j, IAttachment as k, IPushNotification as l, ISlack as m };
package/dist/types.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const slack_connector = require('./shared/notification.Dk_5TX9v.cjs');
3
+ const slack_connector = require('./shared/notification.B0pktSz9.cjs');
4
4
  require('zod');
5
5
  require('@develit-io/backend-sdk');
6
6
  require('zod/v4');
package/dist/types.d.cts CHANGED
@@ -1,10 +1,9 @@
1
- import { I as IEmailConnector, h as IEmail, i as IContact, a as ISmsConnector, j as ISms, t as tables } from './shared/notification.B6BS7SD_.cjs';
2
- export { n as IAttachment, q as IPushNotification, r 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, l as iAttachmentSchema, k as iContactSchema, m as iEmailSchema, s as sendEmailInputSchema, o as sendSlackInputSchema, p as sendSmsInputSchema } from './shared/notification.B6BS7SD_.cjs';
3
- import { InternalError } from '@develit-io/backend-sdk';
1
+ import { I as IEmailConnector, h as IEmail, i as IContact, a as ISmsConnector, j as ISms, t as tables } from './shared/notification.B4ZLWDCP.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.B4ZLWDCP.cjs';
4
3
  import twilio from 'twilio';
5
- import { InferSelectModel, InferInsertModel } from 'drizzle-orm';
6
- export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.ko9XPJGs.cjs';
7
- import './shared/notification.BJyMXKGH.cjs';
4
+ import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
5
+ export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.BB9Jl8DI.cjs';
6
+ import './shared/notification.BWLPh6Gb.cjs';
8
7
  import 'drizzle-orm/sqlite-core';
9
8
  import 'zod';
10
9
  import 'zod/v4';
@@ -57,7 +56,7 @@ declare class TwilioConnector extends ISmsConnector {
57
56
  AUTH_TOKEN: string;
58
57
  SERVICE_ID: string;
59
58
  });
60
- sendSms(sms: ISms): Promise<InternalError | void>;
59
+ sendSms(sms: ISms): Promise<void>;
61
60
  }
62
61
 
63
62
  interface AuditLogSelectType extends InferSelectModel<typeof tables.auditLog> {
package/dist/types.d.mts CHANGED
@@ -1,10 +1,9 @@
1
- import { I as IEmailConnector, h as IEmail, i as IContact, a as ISmsConnector, j as ISms, t as tables } from './shared/notification.jZ826xHp.mjs';
2
- export { n as IAttachment, q as IPushNotification, r 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, l as iAttachmentSchema, k as iContactSchema, m as iEmailSchema, s as sendEmailInputSchema, o as sendSlackInputSchema, p as sendSmsInputSchema } from './shared/notification.jZ826xHp.mjs';
3
- import { InternalError } from '@develit-io/backend-sdk';
1
+ import { I as IEmailConnector, h as IEmail, i as IContact, a as ISmsConnector, j as ISms, t as tables } from './shared/notification.CpFoKjoN.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.CpFoKjoN.mjs';
4
3
  import twilio from 'twilio';
5
- import { InferSelectModel, InferInsertModel } from 'drizzle-orm';
6
- export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.ko9XPJGs.mjs';
7
- import './shared/notification.BJyMXKGH.mjs';
4
+ import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
5
+ export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.BB9Jl8DI.mjs';
6
+ import './shared/notification.BWLPh6Gb.mjs';
8
7
  import 'drizzle-orm/sqlite-core';
9
8
  import 'zod';
10
9
  import 'zod/v4';
@@ -57,7 +56,7 @@ declare class TwilioConnector extends ISmsConnector {
57
56
  AUTH_TOKEN: string;
58
57
  SERVICE_ID: string;
59
58
  });
60
- sendSms(sms: ISms): Promise<InternalError | void>;
59
+ sendSms(sms: ISms): Promise<void>;
61
60
  }
62
61
 
63
62
  interface AuditLogSelectType extends InferSelectModel<typeof tables.auditLog> {
package/dist/types.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import { I as IEmailConnector, h as IEmail, i as IContact, a as ISmsConnector, j as ISms, t as tables } from './shared/notification.CQ6qviKt.js';
2
- export { n as IAttachment, q as IPushNotification, r 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, l as iAttachmentSchema, k as iContactSchema, m as iEmailSchema, s as sendEmailInputSchema, o as sendSlackInputSchema, p as sendSmsInputSchema } from './shared/notification.CQ6qviKt.js';
3
- import { InternalError } from '@develit-io/backend-sdk';
1
+ import { I as IEmailConnector, h as IEmail, i as IContact, a as ISmsConnector, j as ISms, t as tables } from './shared/notification.DWuoMDHY.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.DWuoMDHY.js';
4
3
  import twilio from 'twilio';
5
- import { InferSelectModel, InferInsertModel } from 'drizzle-orm';
6
- export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.ko9XPJGs.js';
7
- import './shared/notification.BJyMXKGH.js';
4
+ import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
5
+ export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.BB9Jl8DI.js';
6
+ import './shared/notification.BWLPh6Gb.js';
8
7
  import 'drizzle-orm/sqlite-core';
9
8
  import 'zod';
10
9
  import 'zod/v4';
@@ -57,7 +56,7 @@ declare class TwilioConnector extends ISmsConnector {
57
56
  AUTH_TOKEN: string;
58
57
  SERVICE_ID: string;
59
58
  });
60
- sendSms(sms: ISms): Promise<InternalError | void>;
59
+ sendSms(sms: ISms): Promise<void>;
61
60
  }
62
61
 
63
62
  interface AuditLogSelectType extends InferSelectModel<typeof tables.auditLog> {
package/dist/types.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { E as EcomailConnector, I as IEmailConnector, e as ISmsConnector, S as SlackConnector, T as TwilioConnector, c as iAttachmentSchema, i as iContactSchema, d as iEmailSchema, s as sendEmailInputSchema, b as sendSlackInputSchema, a as sendSmsInputSchema } from './shared/notification.DkjmuyrV.mjs';
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.CmITLO7E.mjs';
2
2
  import 'zod';
3
3
  import '@develit-io/backend-sdk';
4
4
  import 'zod/v4';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/notification",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -33,9 +33,9 @@
33
33
  "dev": "wrangler dev --port 9236 --persist-to ../../.wrangler/state -c ./wrangler.jsonc -c ../../apps/secrets-store/wrangler.jsonc",
34
34
  "wrangler:generate": "bunx develit wrangler:generate --types",
35
35
  "db:init": "wrangler d1 execute develit-notification --local --persist-to ../../.wrangler/state --command=\"SELECT 'Creating database...' AS status;\"",
36
- "db:generate": "drizzle-kit generate",
37
- "db:migrate": "drizzle-kit migrate",
38
- "db:explore": "drizzle-kit studio",
36
+ "db:generate": "NODE_OPTIONS='--import tsx' drizzle-kit generate",
37
+ "db:migrate": "NODE_OPTIONS='--import tsx' drizzle-kit migrate",
38
+ "db:explore": "NODE_OPTIONS='--import tsx' drizzle-kit studio",
39
39
  "types": "bash typegen.sh",
40
40
  "lint": "biome check",
41
41
  "lint:fix": "biome check --fix",
@@ -45,15 +45,12 @@
45
45
  "test:int": "vitest integration",
46
46
  "build": "unbuild"
47
47
  },
48
- "peerDependencies": {
49
- "@develit-io/backend-sdk": "9.1.6",
50
- "drizzle-kit": "0.31.8",
51
- "drizzle-orm": "0.45.0",
52
- "drizzle-seed": "*",
53
- "wrangler": "4.50.0",
54
- "zod": "4.1.13"
55
- },
56
48
  "dependencies": {
57
- "twilio": "^5.10.7"
49
+ "twilio": "^5.12.0"
50
+ },
51
+ "peerDependencies": {
52
+ "@develit-io/backend-sdk": "^9.8.1",
53
+ "drizzle-orm": "^0.45.0",
54
+ "zod": "^4.1.13"
58
55
  }
59
56
  }