@develit-services/notification 0.0.24 → 0.0.26

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/dist/@types.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const twilio_connector = require('./shared/notification.8VrnX6x5.cjs');
3
+ const twilio_connector = require('./shared/notification.3PxQAUeO.cjs');
4
4
  require('zod');
5
5
  require('@develit-io/backend-sdk');
6
6
  require('zod/v4');
package/dist/@types.d.cts CHANGED
@@ -3,7 +3,7 @@ export { n as IPushNotification, o as ISlack, N as NotificationQueueMessage, S a
3
3
  import { InternalError } from '@develit-io/backend-sdk';
4
4
  import twilio from 'twilio';
5
5
  import { InferSelectModel, InferInsertModel } from 'drizzle-orm';
6
- export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.CNBJ5Beq.cjs';
6
+ export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.jEQePmaL.cjs';
7
7
  import 'zod';
8
8
  import 'zod/v4';
9
9
  import './shared/notification.BJyMXKGH.cjs';
package/dist/@types.d.mts CHANGED
@@ -3,7 +3,7 @@ export { n as IPushNotification, o as ISlack, N as NotificationQueueMessage, S a
3
3
  import { InternalError } from '@develit-io/backend-sdk';
4
4
  import twilio from 'twilio';
5
5
  import { InferSelectModel, InferInsertModel } from 'drizzle-orm';
6
- export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.CNBJ5Beq.mjs';
6
+ export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.jEQePmaL.mjs';
7
7
  import 'zod';
8
8
  import 'zod/v4';
9
9
  import './shared/notification.BJyMXKGH.mjs';
package/dist/@types.d.ts CHANGED
@@ -3,7 +3,7 @@ export { n as IPushNotification, o as ISlack, N as NotificationQueueMessage, S a
3
3
  import { InternalError } from '@develit-io/backend-sdk';
4
4
  import twilio from 'twilio';
5
5
  import { InferSelectModel, InferInsertModel } from 'drizzle-orm';
6
- export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.CNBJ5Beq.js';
6
+ export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.jEQePmaL.js';
7
7
  import 'zod';
8
8
  import 'zod/v4';
9
9
  import './shared/notification.BJyMXKGH.js';
package/dist/@types.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { E as EcomailConnector, I as IEmailConnector, d as ISmsConnector, T as TwilioConnector, i as iContactSchema, c as iEmailSchema, s as sendEmailInputSchema, b as sendSlackInputSchema, a as sendSmsInputSchema } from './shared/notification.DaWIyo2j.mjs';
1
+ export { E as EcomailConnector, I as IEmailConnector, d as ISmsConnector, T as TwilioConnector, i as iContactSchema, c as iEmailSchema, s as sendEmailInputSchema, b as sendSlackInputSchema, a as sendSmsInputSchema } from './shared/notification.CQ9G8X8X.mjs';
2
2
  import 'zod';
3
3
  import '@develit-io/backend-sdk';
4
4
  import 'zod/v4';
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const backendSdk = require('@develit-io/backend-sdk');
6
- const twilio_connector = require('../shared/notification.8VrnX6x5.cjs');
6
+ const twilio_connector = require('../shared/notification.3PxQAUeO.cjs');
7
7
  const database_schema = require('../shared/notification.4b3eUEIG.cjs');
8
8
  require('drizzle-orm');
9
9
  require('drizzle-orm/sqlite-core');
@@ -1,5 +1,5 @@
1
1
  import { createInternalError, uuidv4, develitWorker, useResult, cloudflareQueue, action } from '@develit-io/backend-sdk';
2
- import { E as EcomailConnector, T as TwilioConnector, s as sendEmailInputSchema, a as sendSmsInputSchema, b as sendSlackInputSchema } from '../shared/notification.DaWIyo2j.mjs';
2
+ import { E as EcomailConnector, T as TwilioConnector, s as sendEmailInputSchema, a as sendSmsInputSchema, b as sendSlackInputSchema } from '../shared/notification.CQ9G8X8X.mjs';
3
3
  import { s as schema } from '../shared/notification.C0X8Orrh.mjs';
4
4
  import 'drizzle-orm';
5
5
  import 'drizzle-orm/sqlite-core';
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  function defineNotificationServiceWrangler(config) {
4
- const { name, envs } = config;
4
+ const { project, name, envs } = config;
5
5
  const base = {
6
+ project,
6
7
  name,
7
8
  main: "./src/index.ts",
8
9
  compatibility_date: "2025-06-04",
@@ -17,17 +18,17 @@ function defineNotificationServiceWrangler(config) {
17
18
  preview_urls: false,
18
19
  workers_dev: false,
19
20
  vars: {
20
- //secrets
21
- EMAIL_API_KEY: "",
22
- SMS_AUTH_TOKEN: "",
23
- //vars
21
+ // Secrets
22
+ EMAIL_API_KEY: "[SECRET]",
23
+ SMS_AUTH_TOKEN: "[SECRET]",
24
+ // Variables
24
25
  ...envs.local.vars,
25
26
  ENVIRONMENT: "localhost"
26
27
  },
27
28
  d1_databases: [
28
29
  {
29
30
  binding: "NOTIFICATION_D1",
30
- database_name: name,
31
+ database_name: `${project}-${name}`,
31
32
  database_id: envs.local.d1.id,
32
33
  migrations_dir: "./src/database/migrations"
33
34
  }
@@ -36,7 +37,7 @@ function defineNotificationServiceWrangler(config) {
36
37
  producers: [
37
38
  {
38
39
  binding: "NOTIFICATIONS_QUEUE",
39
- queue: `${name}`
40
+ queue: `${project}-notifications`
40
41
  }
41
42
  ],
42
43
  consumers: [
@@ -44,7 +45,7 @@ function defineNotificationServiceWrangler(config) {
44
45
  queue: `${name}`,
45
46
  max_batch_size: 1,
46
47
  max_batch_timeout: 5,
47
- dead_letter_queue: `${name}-dlq`
48
+ dead_letter_queue: `${project}-notification-dlq`
48
49
  }
49
50
  ]
50
51
  },
@@ -61,7 +62,7 @@ function defineNotificationServiceWrangler(config) {
61
62
  d1_databases: [
62
63
  {
63
64
  binding: "NOTIFICATION_D1",
64
- database_name: `${name}-${envName}`,
65
+ database_name: `${project}-${name}-${envName}`,
65
66
  database_id: envCfg.d1.id,
66
67
  migrations_dir: "./src/database/migrations"
67
68
  }
@@ -70,15 +71,15 @@ function defineNotificationServiceWrangler(config) {
70
71
  producers: [
71
72
  {
72
73
  binding: "NOTIFICATIONS_QUEUE",
73
- queue: `${name}-${envName}`
74
+ queue: `${project}-notifications-${envName}`
74
75
  }
75
76
  ],
76
77
  consumers: [
77
78
  {
78
- queue: `${name}-${envName}`,
79
+ queue: `${project}-notifications-${envName}`,
79
80
  max_batch_size: envCfg.queue?.max_batch_size ?? 1,
80
81
  max_batch_timeout: envCfg.queue?.max_batch_timeout ?? 5,
81
- dead_letter_queue: `${name}-dlq-${envName}`
82
+ dead_letter_queue: `${project}-notifications-dlq-${envName}`
82
83
  }
83
84
  ]
84
85
  }
@@ -1,8 +1,9 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.CNBJ5Beq.cjs';
1
+ import { N as NotificationServiceWranglerConfig } from '../shared/notification.jEQePmaL.cjs';
2
2
 
3
3
  /** biome-ignore-all lint/suspicious/noExplicitAny: allow any */
4
4
 
5
5
  declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
6
+ project: string;
6
7
  name: string;
7
8
  main: string;
8
9
  compatibility_date: string;
@@ -1,8 +1,9 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.CNBJ5Beq.mjs';
1
+ import { N as NotificationServiceWranglerConfig } from '../shared/notification.jEQePmaL.mjs';
2
2
 
3
3
  /** biome-ignore-all lint/suspicious/noExplicitAny: allow any */
4
4
 
5
5
  declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
6
+ project: string;
6
7
  name: string;
7
8
  main: string;
8
9
  compatibility_date: string;
@@ -1,8 +1,9 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.CNBJ5Beq.js';
1
+ import { N as NotificationServiceWranglerConfig } from '../shared/notification.jEQePmaL.js';
2
2
 
3
3
  /** biome-ignore-all lint/suspicious/noExplicitAny: allow any */
4
4
 
5
5
  declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
6
+ project: string;
6
7
  name: string;
7
8
  main: string;
8
9
  compatibility_date: string;
@@ -1,6 +1,7 @@
1
1
  function defineNotificationServiceWrangler(config) {
2
- const { name, envs } = config;
2
+ const { project, name, envs } = config;
3
3
  const base = {
4
+ project,
4
5
  name,
5
6
  main: "./src/index.ts",
6
7
  compatibility_date: "2025-06-04",
@@ -15,17 +16,17 @@ function defineNotificationServiceWrangler(config) {
15
16
  preview_urls: false,
16
17
  workers_dev: false,
17
18
  vars: {
18
- //secrets
19
- EMAIL_API_KEY: "",
20
- SMS_AUTH_TOKEN: "",
21
- //vars
19
+ // Secrets
20
+ EMAIL_API_KEY: "[SECRET]",
21
+ SMS_AUTH_TOKEN: "[SECRET]",
22
+ // Variables
22
23
  ...envs.local.vars,
23
24
  ENVIRONMENT: "localhost"
24
25
  },
25
26
  d1_databases: [
26
27
  {
27
28
  binding: "NOTIFICATION_D1",
28
- database_name: name,
29
+ database_name: `${project}-${name}`,
29
30
  database_id: envs.local.d1.id,
30
31
  migrations_dir: "./src/database/migrations"
31
32
  }
@@ -34,7 +35,7 @@ function defineNotificationServiceWrangler(config) {
34
35
  producers: [
35
36
  {
36
37
  binding: "NOTIFICATIONS_QUEUE",
37
- queue: `${name}`
38
+ queue: `${project}-notifications`
38
39
  }
39
40
  ],
40
41
  consumers: [
@@ -42,7 +43,7 @@ function defineNotificationServiceWrangler(config) {
42
43
  queue: `${name}`,
43
44
  max_batch_size: 1,
44
45
  max_batch_timeout: 5,
45
- dead_letter_queue: `${name}-dlq`
46
+ dead_letter_queue: `${project}-notification-dlq`
46
47
  }
47
48
  ]
48
49
  },
@@ -59,7 +60,7 @@ function defineNotificationServiceWrangler(config) {
59
60
  d1_databases: [
60
61
  {
61
62
  binding: "NOTIFICATION_D1",
62
- database_name: `${name}-${envName}`,
63
+ database_name: `${project}-${name}-${envName}`,
63
64
  database_id: envCfg.d1.id,
64
65
  migrations_dir: "./src/database/migrations"
65
66
  }
@@ -68,15 +69,15 @@ function defineNotificationServiceWrangler(config) {
68
69
  producers: [
69
70
  {
70
71
  binding: "NOTIFICATIONS_QUEUE",
71
- queue: `${name}-${envName}`
72
+ queue: `${project}-notifications-${envName}`
72
73
  }
73
74
  ],
74
75
  consumers: [
75
76
  {
76
- queue: `${name}-${envName}`,
77
+ queue: `${project}-notifications-${envName}`,
77
78
  max_batch_size: envCfg.queue?.max_batch_size ?? 1,
78
79
  max_batch_timeout: envCfg.queue?.max_batch_timeout ?? 5,
79
- dead_letter_queue: `${name}-dlq-${envName}`
80
+ dead_letter_queue: `${project}-notifications-dlq-${envName}`
80
81
  }
81
82
  ]
82
83
  }
@@ -81,7 +81,12 @@ class EcomailConnector extends IEmailConnector {
81
81
  const ccContacts = email.cc ? this.convertContacts(email.cc) : [];
82
82
  const bccContacts = email.bcc ? this.convertContacts(email.bcc) : [];
83
83
  const replyTo = email.replyTo ? this.convertContacts(email.replyTo)[0] : void 0;
84
- const from = this.convertContact(email.from || this.SENDER_EMAIL);
84
+ const from = this.convertContact(
85
+ email.from || {
86
+ name: this.SENDER_NAME,
87
+ email: this.SENDER_EMAIL
88
+ }
89
+ );
85
90
  const subject = email.subject;
86
91
  const attachments = [];
87
92
  const contacts = toContacts.flatMap((to) => {
@@ -74,7 +74,12 @@ class EcomailConnector extends IEmailConnector {
74
74
  const ccContacts = email.cc ? this.convertContacts(email.cc) : [];
75
75
  const bccContacts = email.bcc ? this.convertContacts(email.bcc) : [];
76
76
  const replyTo = email.replyTo ? this.convertContacts(email.replyTo)[0] : void 0;
77
- const from = this.convertContact(email.from || this.SENDER_EMAIL);
77
+ const from = this.convertContact(
78
+ email.from || {
79
+ name: this.SENDER_NAME,
80
+ email: this.SENDER_EMAIL
81
+ }
82
+ );
78
83
  const subject = email.subject;
79
84
  const attachments = [];
80
85
  const contacts = toContacts.flatMap((to) => {
@@ -18,6 +18,7 @@ interface NotificationServiceEnvironmentConfig {
18
18
  };
19
19
  }
20
20
  interface NotificationServiceWranglerConfig {
21
+ project: string;
21
22
  name: string;
22
23
  envs: {
23
24
  local: NotificationServiceEnvironmentConfig;
@@ -18,6 +18,7 @@ interface NotificationServiceEnvironmentConfig {
18
18
  };
19
19
  }
20
20
  interface NotificationServiceWranglerConfig {
21
+ project: string;
21
22
  name: string;
22
23
  envs: {
23
24
  local: NotificationServiceEnvironmentConfig;
@@ -18,6 +18,7 @@ interface NotificationServiceEnvironmentConfig {
18
18
  };
19
19
  }
20
20
  interface NotificationServiceWranglerConfig {
21
+ project: string;
21
22
  name: string;
22
23
  envs: {
23
24
  local: NotificationServiceEnvironmentConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/notification",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -30,9 +30,9 @@
30
30
  "./dist"
31
31
  ],
32
32
  "scripts": {
33
- "dev": "wrangler dev --port 9232",
33
+ "dev": "wrangler dev --port 9233 --persist-to ../../.wrangler/state",
34
34
  "wrangler:generate": "bunx develit wrangler:generate",
35
- "db:init": "wrangler d1 execute notification --local --persist-to ../../.wrangler/state --command=\"SELECT 'Creating database...' AS status;\"",
35
+ "db:init": "wrangler d1 execute develit-notification --local --persist-to ../../.wrangler/state --command=\"SELECT 'Creating database...' AS status;\"",
36
36
  "db:generate": "drizzle-kit generate",
37
37
  "db:migrate": "drizzle-kit migrate",
38
38
  "db:explore": "drizzle-kit studio",