@develit-services/notification 0.3.0 → 0.4.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.
@@ -6,9 +6,9 @@ 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
10
  const cloudflare_workers = require('cloudflare:workers');
10
11
  const d1 = require('drizzle-orm/d1');
11
- const slack_connector = require('../shared/notification.Dk_5TX9v.cjs');
12
12
  require('zod');
13
13
  require('zod/v4');
14
14
  require('twilio');
@@ -149,7 +149,9 @@ let NotificationServiceBase = class extends backendSdk.develitWorker(
149
149
  if (!this.emailConnector) {
150
150
  this.emailConnector = await initiateEmailConnector(
151
151
  this.env.EMAIL_PROVIDER,
152
- this.env.EMAIL_API_KEY,
152
+ (await this.env.SECRETS_STORE.get({
153
+ secretName: "NOTIFICATION_SERVICE_EMAIL_API_KEY"
154
+ })).data?.secretValue || "",
153
155
  this.env.EMAIL_SMTP_HOST,
154
156
  this.env.EMAIL_SENDER_EMAIL,
155
157
  this.env.EMAIL_SENDER_NAME
@@ -189,9 +191,15 @@ let NotificationServiceBase = class extends backendSdk.develitWorker(
189
191
  if (!this.smsConnector) {
190
192
  this.smsConnector = await initiateSmsConnector(
191
193
  this.env.SMS_PROVIDER,
192
- this.env.SMS_ACCOUNT_ID,
193
- this.env.SMS_AUTH_TOKEN,
194
- this.env.SMS_SERVICE_ID
194
+ (await this.env.SECRETS_STORE.get({
195
+ secretName: "NOTIFICATION_SERVICE_SMS_ACCOUNT_ID"
196
+ })).data?.secretValue || "",
197
+ (await this.env.SECRETS_STORE.get({
198
+ secretName: "NOTIFICATION_SERVICE_SMS_AUTH_TOKEN"
199
+ })).data?.secretValue || "",
200
+ (await this.env.SECRETS_STORE.get({
201
+ secretName: "NOTIFICATION_SERVICE_SMS_SERVICE_ID"
202
+ })).data?.secretValue || ""
195
203
  );
196
204
  }
197
205
  await this.smsConnector.sendSms({ message, to });
@@ -2,9 +2,9 @@ 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
6
  import { WorkerEntrypoint } from 'cloudflare:workers';
6
7
  import { drizzle } from 'drizzle-orm/d1';
7
- import { E as EcomailConnector, T as TwilioConnector, S as SlackConnector, s as sendEmailInputSchema, a as sendSmsInputSchema, b as sendSlackInputSchema } from '../shared/notification.DkjmuyrV.mjs';
8
8
  import 'zod';
9
9
  import 'zod/v4';
10
10
  import 'twilio';
@@ -145,7 +145,9 @@ let NotificationServiceBase = class extends develitWorker(
145
145
  if (!this.emailConnector) {
146
146
  this.emailConnector = await initiateEmailConnector(
147
147
  this.env.EMAIL_PROVIDER,
148
- this.env.EMAIL_API_KEY,
148
+ (await this.env.SECRETS_STORE.get({
149
+ secretName: "NOTIFICATION_SERVICE_EMAIL_API_KEY"
150
+ })).data?.secretValue || "",
149
151
  this.env.EMAIL_SMTP_HOST,
150
152
  this.env.EMAIL_SENDER_EMAIL,
151
153
  this.env.EMAIL_SENDER_NAME
@@ -185,9 +187,15 @@ let NotificationServiceBase = class extends develitWorker(
185
187
  if (!this.smsConnector) {
186
188
  this.smsConnector = await initiateSmsConnector(
187
189
  this.env.SMS_PROVIDER,
188
- this.env.SMS_ACCOUNT_ID,
189
- this.env.SMS_AUTH_TOKEN,
190
- this.env.SMS_SERVICE_ID
190
+ (await this.env.SECRETS_STORE.get({
191
+ secretName: "NOTIFICATION_SERVICE_SMS_ACCOUNT_ID"
192
+ })).data?.secretValue || "",
193
+ (await this.env.SECRETS_STORE.get({
194
+ secretName: "NOTIFICATION_SERVICE_SMS_AUTH_TOKEN"
195
+ })).data?.secretValue || "",
196
+ (await this.env.SECRETS_STORE.get({
197
+ secretName: "NOTIFICATION_SERVICE_SMS_SERVICE_ID"
198
+ })).data?.secretValue || ""
191
199
  );
192
200
  }
193
201
  await this.smsConnector.sendSms({ message, to });
@@ -10,13 +10,15 @@ function defineNotificationServiceWrangler(config) {
10
10
  name
11
11
  }),
12
12
  vars: {
13
- // Secrets
14
- EMAIL_API_KEY: "[SECRET]",
15
- SMS_AUTH_TOKEN: "[SECRET]",
16
- // Variables
17
13
  ...envs.local.vars,
18
14
  ENVIRONMENT: "localhost"
19
15
  },
16
+ services: [
17
+ {
18
+ binding: "SECRETS_STORE",
19
+ service: `${project}-secrets-store`
20
+ }
21
+ ],
20
22
  d1_databases: [
21
23
  {
22
24
  binding: "NOTIFICATION_D1",
@@ -1,4 +1,4 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.CBrLTgQh.cjs';
1
+ import { N as NotificationServiceWranglerConfig } from '../shared/notification.ko9XPJGs.cjs';
2
2
 
3
3
  declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
4
4
  vars: {
@@ -8,12 +8,12 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
8
8
  EMAIL_SENDER_NAME: string;
9
9
  EMAIL_SMTP_HOST: string;
10
10
  SMS_PROVIDER: "twilio";
11
- SMS_ACCOUNT_ID: string;
12
- SMS_SERVICE_ID: string | number;
13
11
  SLACK_WEBHOOK: string;
14
- EMAIL_API_KEY: string;
15
- SMS_AUTH_TOKEN: string;
16
12
  };
13
+ services: {
14
+ binding: string;
15
+ service: string;
16
+ }[];
17
17
  d1_databases: {
18
18
  binding: string;
19
19
  database_name: string;
@@ -1,4 +1,4 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.CBrLTgQh.mjs';
1
+ import { N as NotificationServiceWranglerConfig } from '../shared/notification.ko9XPJGs.mjs';
2
2
 
3
3
  declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
4
4
  vars: {
@@ -8,12 +8,12 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
8
8
  EMAIL_SENDER_NAME: string;
9
9
  EMAIL_SMTP_HOST: string;
10
10
  SMS_PROVIDER: "twilio";
11
- SMS_ACCOUNT_ID: string;
12
- SMS_SERVICE_ID: string | number;
13
11
  SLACK_WEBHOOK: string;
14
- EMAIL_API_KEY: string;
15
- SMS_AUTH_TOKEN: string;
16
12
  };
13
+ services: {
14
+ binding: string;
15
+ service: string;
16
+ }[];
17
17
  d1_databases: {
18
18
  binding: string;
19
19
  database_name: string;
@@ -1,4 +1,4 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.CBrLTgQh.js';
1
+ import { N as NotificationServiceWranglerConfig } from '../shared/notification.ko9XPJGs.js';
2
2
 
3
3
  declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
4
4
  vars: {
@@ -8,12 +8,12 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
8
8
  EMAIL_SENDER_NAME: string;
9
9
  EMAIL_SMTP_HOST: string;
10
10
  SMS_PROVIDER: "twilio";
11
- SMS_ACCOUNT_ID: string;
12
- SMS_SERVICE_ID: string | number;
13
11
  SLACK_WEBHOOK: string;
14
- EMAIL_API_KEY: string;
15
- SMS_AUTH_TOKEN: string;
16
12
  };
13
+ services: {
14
+ binding: string;
15
+ service: string;
16
+ }[];
17
17
  d1_databases: {
18
18
  binding: string;
19
19
  database_name: string;
@@ -8,13 +8,15 @@ function defineNotificationServiceWrangler(config) {
8
8
  name
9
9
  }),
10
10
  vars: {
11
- // Secrets
12
- EMAIL_API_KEY: "[SECRET]",
13
- SMS_AUTH_TOKEN: "[SECRET]",
14
- // Variables
15
11
  ...envs.local.vars,
16
12
  ENVIRONMENT: "localhost"
17
13
  },
14
+ services: [
15
+ {
16
+ binding: "SECRETS_STORE",
17
+ service: `${project}-secrets-store`
18
+ }
19
+ ],
18
20
  d1_databases: [
19
21
  {
20
22
  binding: "NOTIFICATION_D1",
@@ -12,8 +12,6 @@ interface NotificationServiceEnvironmentConfig {
12
12
  EMAIL_SENDER_NAME: string;
13
13
  EMAIL_SMTP_HOST: string;
14
14
  SMS_PROVIDER: 'twilio';
15
- SMS_ACCOUNT_ID: string;
16
- SMS_SERVICE_ID: string | number;
17
15
  SLACK_WEBHOOK: string;
18
16
  };
19
17
  }
@@ -12,8 +12,6 @@ interface NotificationServiceEnvironmentConfig {
12
12
  EMAIL_SENDER_NAME: string;
13
13
  EMAIL_SMTP_HOST: string;
14
14
  SMS_PROVIDER: 'twilio';
15
- SMS_ACCOUNT_ID: string;
16
- SMS_SERVICE_ID: string | number;
17
15
  SLACK_WEBHOOK: string;
18
16
  };
19
17
  }
@@ -12,8 +12,6 @@ interface NotificationServiceEnvironmentConfig {
12
12
  EMAIL_SENDER_NAME: string;
13
13
  EMAIL_SMTP_HOST: string;
14
14
  SMS_PROVIDER: 'twilio';
15
- SMS_ACCOUNT_ID: string;
16
- SMS_SERVICE_ID: string | number;
17
15
  SLACK_WEBHOOK: string;
18
16
  };
19
17
  }
package/dist/types.d.cts CHANGED
@@ -3,7 +3,7 @@ export { n as IAttachment, q as IPushNotification, r as ISlack, N as Notificatio
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.CBrLTgQh.cjs';
6
+ export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.ko9XPJGs.cjs';
7
7
  import './shared/notification.BJyMXKGH.cjs';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'zod';
package/dist/types.d.mts CHANGED
@@ -3,7 +3,7 @@ export { n as IAttachment, q as IPushNotification, r as ISlack, N as Notificatio
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.CBrLTgQh.mjs';
6
+ export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.ko9XPJGs.mjs';
7
7
  import './shared/notification.BJyMXKGH.mjs';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'zod';
package/dist/types.d.ts CHANGED
@@ -3,7 +3,7 @@ export { n as IAttachment, q as IPushNotification, r as ISlack, N as Notificatio
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.CBrLTgQh.js';
6
+ export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.ko9XPJGs.js';
7
7
  import './shared/notification.BJyMXKGH.js';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'zod';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/notification",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -30,13 +30,13 @@
30
30
  "./dist"
31
31
  ],
32
32
  "scripts": {
33
- "dev": "wrangler dev --port 9236 --persist-to ../../.wrangler/state",
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
36
  "db:generate": "drizzle-kit generate",
37
37
  "db:migrate": "drizzle-kit migrate",
38
38
  "db:explore": "drizzle-kit studio",
39
- "types": "wrangler types --env-interface NotificationEnv --include-runtime false",
39
+ "types": "bash typegen.sh",
40
40
  "lint": "biome check",
41
41
  "lint:fix": "biome check --fix",
42
42
  "test": "vitest",