@develit-services/notification 0.0.35 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/export/worker.cjs +22 -20
- package/dist/export/worker.d.cts +3 -4
- package/dist/export/worker.d.mts +3 -4
- package/dist/export/worker.d.ts +3 -4
- package/dist/export/worker.mjs +23 -21
- package/dist/export/wrangler.d.cts +2 -2
- package/dist/export/wrangler.d.mts +2 -2
- package/dist/export/wrangler.d.ts +2 -2
- package/dist/shared/{notification.BfmtOZWZ.d.cts → notification.B6BS7SD_.d.cts} +5 -5
- package/dist/shared/{notification.jEQePmaL.d.cts → notification.CBrLTgQh.d.cts} +1 -1
- package/dist/shared/{notification.jEQePmaL.d.mts → notification.CBrLTgQh.d.mts} +1 -1
- package/dist/shared/{notification.jEQePmaL.d.ts → notification.CBrLTgQh.d.ts} +1 -1
- package/dist/shared/{notification.CTS2eEHl.d.ts → notification.CQ6qviKt.d.ts} +5 -5
- package/dist/shared/{notification.BGfR3X_e.cjs → notification.Dk_5TX9v.cjs} +11 -13
- package/dist/shared/{notification.Di9LpjrD.mjs → notification.DkjmuyrV.mjs} +11 -13
- package/dist/shared/{notification.CBHpc8d5.d.mts → notification.jZ826xHp.d.mts} +5 -5
- package/dist/types.cjs +1 -1
- package/dist/types.d.cts +5 -5
- package/dist/types.d.mts +5 -5
- package/dist/types.d.ts +5 -5
- package/dist/types.mjs +1 -1
- package/package.json +10 -13
package/dist/export/worker.cjs
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
6
|
-
const slack_connector = require('../shared/notification.BGfR3X_e.cjs');
|
|
7
6
|
const database_schema = require('../shared/notification.4b3eUEIG.cjs');
|
|
8
7
|
require('drizzle-orm');
|
|
9
8
|
require('drizzle-orm/sqlite-core');
|
|
10
9
|
const cloudflare_workers = require('cloudflare:workers');
|
|
11
10
|
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');
|
|
@@ -77,20 +77,19 @@ const initiateSmsConnector = async (provider, accountId, authToken, serviceId) =
|
|
|
77
77
|
var __defProp = Object.defineProperty;
|
|
78
78
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
79
79
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
80
|
-
var result = __getOwnPropDesc(target, key) ;
|
|
80
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
81
81
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
82
82
|
if (decorator = decorators[i])
|
|
83
|
-
result = (decorator(target, key, result) ) || result;
|
|
84
|
-
if (result) __defProp(target, key, result);
|
|
83
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
84
|
+
if (kind && result) __defProp(target, key, result);
|
|
85
85
|
return result;
|
|
86
86
|
};
|
|
87
|
-
|
|
87
|
+
let NotificationServiceBase = class extends backendSdk.develitWorker(
|
|
88
88
|
cloudflare_workers.WorkerEntrypoint
|
|
89
89
|
) {
|
|
90
90
|
constructor(ctx, env) {
|
|
91
91
|
super(ctx, env);
|
|
92
|
-
this.slackConnector = new slack_connector.SlackConnector(this.env.
|
|
93
|
-
this.name = "notification-service";
|
|
92
|
+
this.slackConnector = new slack_connector.SlackConnector(this.env.SLACK_WEBHOOK);
|
|
94
93
|
this.db = d1.drizzle(this.env.NOTIFICATION_D1, { schema: tables });
|
|
95
94
|
}
|
|
96
95
|
async queue(batch) {
|
|
@@ -144,7 +143,7 @@ class NotificationServiceBase extends backendSdk.develitWorker(
|
|
|
144
143
|
metadata: {
|
|
145
144
|
ip,
|
|
146
145
|
userAgent,
|
|
147
|
-
initiator: { service, userId }
|
|
146
|
+
initiator: { service: service2, userId }
|
|
148
147
|
}
|
|
149
148
|
} = params;
|
|
150
149
|
if (!this.emailConnector) {
|
|
@@ -163,7 +162,7 @@ class NotificationServiceBase extends backendSdk.develitWorker(
|
|
|
163
162
|
id: backendSdk.uuidv4(),
|
|
164
163
|
event: "EMAIL",
|
|
165
164
|
ip,
|
|
166
|
-
initiatorService:
|
|
165
|
+
initiatorService: service2,
|
|
167
166
|
initiatorUserId: userId,
|
|
168
167
|
userAgent,
|
|
169
168
|
description: JSON.stringify(input)
|
|
@@ -184,7 +183,7 @@ class NotificationServiceBase extends backendSdk.develitWorker(
|
|
|
184
183
|
metadata: {
|
|
185
184
|
ip,
|
|
186
185
|
userAgent,
|
|
187
|
-
initiator: { service, userId }
|
|
186
|
+
initiator: { service: service2, userId }
|
|
188
187
|
}
|
|
189
188
|
} = params;
|
|
190
189
|
if (!this.smsConnector) {
|
|
@@ -203,7 +202,7 @@ class NotificationServiceBase extends backendSdk.develitWorker(
|
|
|
203
202
|
event: "SMS",
|
|
204
203
|
ip,
|
|
205
204
|
userAgent,
|
|
206
|
-
initiatorService:
|
|
205
|
+
initiatorService: service2,
|
|
207
206
|
initiatorUserId: userId,
|
|
208
207
|
description: JSON.stringify(input)
|
|
209
208
|
}
|
|
@@ -291,31 +290,34 @@ class NotificationServiceBase extends backendSdk.develitWorker(
|
|
|
291
290
|
}
|
|
292
291
|
);
|
|
293
292
|
}
|
|
294
|
-
}
|
|
293
|
+
};
|
|
295
294
|
__decorateClass([
|
|
296
295
|
backendSdk.cloudflareQueue({ baseDelay: 60 })
|
|
297
|
-
], NotificationServiceBase.prototype, "queue");
|
|
296
|
+
], NotificationServiceBase.prototype, "queue", 1);
|
|
298
297
|
__decorateClass([
|
|
299
298
|
backendSdk.action("private-send-email")
|
|
300
|
-
], NotificationServiceBase.prototype, "_sendEmail");
|
|
299
|
+
], NotificationServiceBase.prototype, "_sendEmail", 1);
|
|
301
300
|
__decorateClass([
|
|
302
301
|
backendSdk.action("private-send-sms")
|
|
303
|
-
], NotificationServiceBase.prototype, "_sendSms");
|
|
302
|
+
], NotificationServiceBase.prototype, "_sendSms", 1);
|
|
304
303
|
__decorateClass([
|
|
305
304
|
backendSdk.action("public-send-email")
|
|
306
|
-
], NotificationServiceBase.prototype, "sendEmail");
|
|
305
|
+
], NotificationServiceBase.prototype, "sendEmail", 1);
|
|
307
306
|
__decorateClass([
|
|
308
307
|
backendSdk.action("public-send-email-sync")
|
|
309
|
-
], NotificationServiceBase.prototype, "sendEmailSync");
|
|
308
|
+
], NotificationServiceBase.prototype, "sendEmailSync", 1);
|
|
310
309
|
__decorateClass([
|
|
311
310
|
backendSdk.action("public-send-sms")
|
|
312
|
-
], NotificationServiceBase.prototype, "sendSms");
|
|
311
|
+
], NotificationServiceBase.prototype, "sendSms", 1);
|
|
313
312
|
__decorateClass([
|
|
314
313
|
backendSdk.action("send-push-notification")
|
|
315
|
-
], NotificationServiceBase.prototype, "_sendPushNotification");
|
|
314
|
+
], NotificationServiceBase.prototype, "_sendPushNotification", 1);
|
|
316
315
|
__decorateClass([
|
|
317
316
|
backendSdk.action("send-slack-notification")
|
|
318
|
-
], NotificationServiceBase.prototype, "sendSlackNotification");
|
|
317
|
+
], NotificationServiceBase.prototype, "sendSlackNotification", 1);
|
|
318
|
+
NotificationServiceBase = __decorateClass([
|
|
319
|
+
backendSdk.service("notification")
|
|
320
|
+
], NotificationServiceBase);
|
|
319
321
|
function defineNotificationService() {
|
|
320
322
|
return class NotificationService extends NotificationServiceBase {
|
|
321
323
|
constructor(ctx, env) {
|
package/dist/export/worker.d.cts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
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.
|
|
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';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import 'zod/v4';
|
|
8
6
|
import '../shared/notification.BJyMXKGH.cjs';
|
|
9
7
|
import 'drizzle-orm/sqlite-core';
|
|
8
|
+
import 'zod';
|
|
9
|
+
import 'zod/v4';
|
|
10
10
|
|
|
11
11
|
declare const NotificationServiceBase_base: (abstract new (ctx: ExecutionContext, env: NotificationEnv) => WorkerEntrypoint<NotificationEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
|
|
12
12
|
declare class NotificationServiceBase extends NotificationServiceBase_base {
|
|
13
|
-
readonly name: string;
|
|
14
13
|
readonly slackConnector: SlackConnector;
|
|
15
14
|
protected emailConnector: IEmailConnector;
|
|
16
15
|
protected smsConnector: ISmsConnector;
|
package/dist/export/worker.d.mts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
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.
|
|
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';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import 'zod/v4';
|
|
8
6
|
import '../shared/notification.BJyMXKGH.mjs';
|
|
9
7
|
import 'drizzle-orm/sqlite-core';
|
|
8
|
+
import 'zod';
|
|
9
|
+
import 'zod/v4';
|
|
10
10
|
|
|
11
11
|
declare const NotificationServiceBase_base: (abstract new (ctx: ExecutionContext, env: NotificationEnv) => WorkerEntrypoint<NotificationEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
|
|
12
12
|
declare class NotificationServiceBase extends NotificationServiceBase_base {
|
|
13
|
-
readonly name: string;
|
|
14
13
|
readonly slackConnector: SlackConnector;
|
|
15
14
|
protected emailConnector: IEmailConnector;
|
|
16
15
|
protected smsConnector: ISmsConnector;
|
package/dist/export/worker.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
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.
|
|
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';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import 'zod/v4';
|
|
8
6
|
import '../shared/notification.BJyMXKGH.js';
|
|
9
7
|
import 'drizzle-orm/sqlite-core';
|
|
8
|
+
import 'zod';
|
|
9
|
+
import 'zod/v4';
|
|
10
10
|
|
|
11
11
|
declare const NotificationServiceBase_base: (abstract new (ctx: ExecutionContext, env: NotificationEnv) => WorkerEntrypoint<NotificationEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
|
|
12
12
|
declare class NotificationServiceBase extends NotificationServiceBase_base {
|
|
13
|
-
readonly name: string;
|
|
14
13
|
readonly slackConnector: SlackConnector;
|
|
15
14
|
protected emailConnector: IEmailConnector;
|
|
16
15
|
protected smsConnector: ISmsConnector;
|
package/dist/export/worker.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createInternalError, uuidv4, develitWorker, cloudflareQueue, action } from '@develit-io/backend-sdk';
|
|
2
|
-
import { E as EcomailConnector, T as TwilioConnector, S as SlackConnector, s as sendEmailInputSchema, a as sendSmsInputSchema, b as sendSlackInputSchema } from '../shared/notification.Di9LpjrD.mjs';
|
|
1
|
+
import { createInternalError, uuidv4, develitWorker, cloudflareQueue, action, service } from '@develit-io/backend-sdk';
|
|
3
2
|
import { s as schema } from '../shared/notification.C0X8Orrh.mjs';
|
|
4
3
|
import 'drizzle-orm';
|
|
5
4
|
import 'drizzle-orm/sqlite-core';
|
|
6
5
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
7
6
|
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';
|
|
@@ -73,20 +73,19 @@ const initiateSmsConnector = async (provider, accountId, authToken, serviceId) =
|
|
|
73
73
|
var __defProp = Object.defineProperty;
|
|
74
74
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
75
75
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
76
|
-
var result = __getOwnPropDesc(target, key) ;
|
|
76
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
77
77
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
78
78
|
if (decorator = decorators[i])
|
|
79
|
-
result = (decorator(target, key, result) ) || result;
|
|
80
|
-
if (result) __defProp(target, key, result);
|
|
79
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
80
|
+
if (kind && result) __defProp(target, key, result);
|
|
81
81
|
return result;
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
let NotificationServiceBase = class extends develitWorker(
|
|
84
84
|
WorkerEntrypoint
|
|
85
85
|
) {
|
|
86
86
|
constructor(ctx, env) {
|
|
87
87
|
super(ctx, env);
|
|
88
|
-
this.slackConnector = new SlackConnector(this.env.
|
|
89
|
-
this.name = "notification-service";
|
|
88
|
+
this.slackConnector = new SlackConnector(this.env.SLACK_WEBHOOK);
|
|
90
89
|
this.db = drizzle(this.env.NOTIFICATION_D1, { schema: tables });
|
|
91
90
|
}
|
|
92
91
|
async queue(batch) {
|
|
@@ -140,7 +139,7 @@ class NotificationServiceBase extends develitWorker(
|
|
|
140
139
|
metadata: {
|
|
141
140
|
ip,
|
|
142
141
|
userAgent,
|
|
143
|
-
initiator: { service, userId }
|
|
142
|
+
initiator: { service: service2, userId }
|
|
144
143
|
}
|
|
145
144
|
} = params;
|
|
146
145
|
if (!this.emailConnector) {
|
|
@@ -159,7 +158,7 @@ class NotificationServiceBase extends develitWorker(
|
|
|
159
158
|
id: uuidv4(),
|
|
160
159
|
event: "EMAIL",
|
|
161
160
|
ip,
|
|
162
|
-
initiatorService:
|
|
161
|
+
initiatorService: service2,
|
|
163
162
|
initiatorUserId: userId,
|
|
164
163
|
userAgent,
|
|
165
164
|
description: JSON.stringify(input)
|
|
@@ -180,7 +179,7 @@ class NotificationServiceBase extends develitWorker(
|
|
|
180
179
|
metadata: {
|
|
181
180
|
ip,
|
|
182
181
|
userAgent,
|
|
183
|
-
initiator: { service, userId }
|
|
182
|
+
initiator: { service: service2, userId }
|
|
184
183
|
}
|
|
185
184
|
} = params;
|
|
186
185
|
if (!this.smsConnector) {
|
|
@@ -199,7 +198,7 @@ class NotificationServiceBase extends develitWorker(
|
|
|
199
198
|
event: "SMS",
|
|
200
199
|
ip,
|
|
201
200
|
userAgent,
|
|
202
|
-
initiatorService:
|
|
201
|
+
initiatorService: service2,
|
|
203
202
|
initiatorUserId: userId,
|
|
204
203
|
description: JSON.stringify(input)
|
|
205
204
|
}
|
|
@@ -287,31 +286,34 @@ class NotificationServiceBase extends develitWorker(
|
|
|
287
286
|
}
|
|
288
287
|
);
|
|
289
288
|
}
|
|
290
|
-
}
|
|
289
|
+
};
|
|
291
290
|
__decorateClass([
|
|
292
291
|
cloudflareQueue({ baseDelay: 60 })
|
|
293
|
-
], NotificationServiceBase.prototype, "queue");
|
|
292
|
+
], NotificationServiceBase.prototype, "queue", 1);
|
|
294
293
|
__decorateClass([
|
|
295
294
|
action("private-send-email")
|
|
296
|
-
], NotificationServiceBase.prototype, "_sendEmail");
|
|
295
|
+
], NotificationServiceBase.prototype, "_sendEmail", 1);
|
|
297
296
|
__decorateClass([
|
|
298
297
|
action("private-send-sms")
|
|
299
|
-
], NotificationServiceBase.prototype, "_sendSms");
|
|
298
|
+
], NotificationServiceBase.prototype, "_sendSms", 1);
|
|
300
299
|
__decorateClass([
|
|
301
300
|
action("public-send-email")
|
|
302
|
-
], NotificationServiceBase.prototype, "sendEmail");
|
|
301
|
+
], NotificationServiceBase.prototype, "sendEmail", 1);
|
|
303
302
|
__decorateClass([
|
|
304
303
|
action("public-send-email-sync")
|
|
305
|
-
], NotificationServiceBase.prototype, "sendEmailSync");
|
|
304
|
+
], NotificationServiceBase.prototype, "sendEmailSync", 1);
|
|
306
305
|
__decorateClass([
|
|
307
306
|
action("public-send-sms")
|
|
308
|
-
], NotificationServiceBase.prototype, "sendSms");
|
|
307
|
+
], NotificationServiceBase.prototype, "sendSms", 1);
|
|
309
308
|
__decorateClass([
|
|
310
309
|
action("send-push-notification")
|
|
311
|
-
], NotificationServiceBase.prototype, "_sendPushNotification");
|
|
310
|
+
], NotificationServiceBase.prototype, "_sendPushNotification", 1);
|
|
312
311
|
__decorateClass([
|
|
313
312
|
action("send-slack-notification")
|
|
314
|
-
], NotificationServiceBase.prototype, "sendSlackNotification");
|
|
313
|
+
], NotificationServiceBase.prototype, "sendSlackNotification", 1);
|
|
314
|
+
NotificationServiceBase = __decorateClass([
|
|
315
|
+
service("notification")
|
|
316
|
+
], NotificationServiceBase);
|
|
315
317
|
function defineNotificationService() {
|
|
316
318
|
return class NotificationService extends NotificationServiceBase {
|
|
317
319
|
constructor(ctx, env) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NotificationServiceWranglerConfig } from '../shared/notification.
|
|
1
|
+
import { N as NotificationServiceWranglerConfig } from '../shared/notification.CBrLTgQh.cjs';
|
|
2
2
|
|
|
3
3
|
declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
|
|
4
4
|
vars: {
|
|
@@ -10,7 +10,7 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
|
|
|
10
10
|
SMS_PROVIDER: "twilio";
|
|
11
11
|
SMS_ACCOUNT_ID: string;
|
|
12
12
|
SMS_SERVICE_ID: string | number;
|
|
13
|
-
|
|
13
|
+
SLACK_WEBHOOK: string;
|
|
14
14
|
EMAIL_API_KEY: string;
|
|
15
15
|
SMS_AUTH_TOKEN: string;
|
|
16
16
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NotificationServiceWranglerConfig } from '../shared/notification.
|
|
1
|
+
import { N as NotificationServiceWranglerConfig } from '../shared/notification.CBrLTgQh.mjs';
|
|
2
2
|
|
|
3
3
|
declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
|
|
4
4
|
vars: {
|
|
@@ -10,7 +10,7 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
|
|
|
10
10
|
SMS_PROVIDER: "twilio";
|
|
11
11
|
SMS_ACCOUNT_ID: string;
|
|
12
12
|
SMS_SERVICE_ID: string | number;
|
|
13
|
-
|
|
13
|
+
SLACK_WEBHOOK: string;
|
|
14
14
|
EMAIL_API_KEY: string;
|
|
15
15
|
SMS_AUTH_TOKEN: string;
|
|
16
16
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NotificationServiceWranglerConfig } from '../shared/notification.
|
|
1
|
+
import { N as NotificationServiceWranglerConfig } from '../shared/notification.CBrLTgQh.js';
|
|
2
2
|
|
|
3
3
|
declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
|
|
4
4
|
vars: {
|
|
@@ -10,7 +10,7 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
|
|
|
10
10
|
SMS_PROVIDER: "twilio";
|
|
11
11
|
SMS_ACCOUNT_ID: string;
|
|
12
12
|
SMS_SERVICE_ID: string | number;
|
|
13
|
-
|
|
13
|
+
SLACK_WEBHOOK: string;
|
|
14
14
|
EMAIL_API_KEY: string;
|
|
15
15
|
SMS_AUTH_TOKEN: string;
|
|
16
16
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { s as schema } from './notification.BJyMXKGH.cjs';
|
|
1
2
|
import z$1, { z } from 'zod';
|
|
2
3
|
import { z as z$2 } from 'zod/v4';
|
|
3
4
|
import { InternalError } from '@develit-io/backend-sdk';
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
declare const tables: typeof schema;
|
|
5
7
|
|
|
6
8
|
declare const iContactSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
7
9
|
email: z.ZodString;
|
|
@@ -218,12 +220,10 @@ interface ISlack {
|
|
|
218
220
|
}
|
|
219
221
|
|
|
220
222
|
declare class SlackConnector {
|
|
221
|
-
private
|
|
222
|
-
constructor(
|
|
223
|
+
private webhook;
|
|
224
|
+
constructor(webhook: string);
|
|
223
225
|
sendNotificationToAllSlack(message: string): Promise<void>;
|
|
224
226
|
}
|
|
225
227
|
|
|
226
|
-
declare const tables: typeof schema;
|
|
227
|
-
|
|
228
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
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 };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { s as schema } from './notification.BJyMXKGH.js';
|
|
1
2
|
import z$1, { z } from 'zod';
|
|
2
3
|
import { z as z$2 } from 'zod/v4';
|
|
3
4
|
import { InternalError } from '@develit-io/backend-sdk';
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
declare const tables: typeof schema;
|
|
5
7
|
|
|
6
8
|
declare const iContactSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
7
9
|
email: z.ZodString;
|
|
@@ -218,12 +220,10 @@ interface ISlack {
|
|
|
218
220
|
}
|
|
219
221
|
|
|
220
222
|
declare class SlackConnector {
|
|
221
|
-
private
|
|
222
|
-
constructor(
|
|
223
|
+
private webhook;
|
|
224
|
+
constructor(webhook: string);
|
|
223
225
|
sendNotificationToAllSlack(message: string): Promise<void>;
|
|
224
226
|
}
|
|
225
227
|
|
|
226
|
-
declare const tables: typeof schema;
|
|
227
|
-
|
|
228
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
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 };
|
|
@@ -254,23 +254,21 @@ class TwilioConnector extends ISmsConnector {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
class SlackConnector {
|
|
257
|
-
constructor(
|
|
258
|
-
this.
|
|
257
|
+
constructor(webhook) {
|
|
258
|
+
this.webhook = webhook;
|
|
259
259
|
}
|
|
260
260
|
async sendNotificationToAllSlack(message) {
|
|
261
261
|
const controller = new AbortController();
|
|
262
262
|
const timeoutId = setTimeout(() => controller.abort(), 3e3);
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
throw new Error("Failed sending Slack notification to " + message);
|
|
273
|
-
}
|
|
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);
|
|
274
272
|
}
|
|
275
273
|
}
|
|
276
274
|
}
|
|
@@ -247,23 +247,21 @@ class TwilioConnector extends ISmsConnector {
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
class SlackConnector {
|
|
250
|
-
constructor(
|
|
251
|
-
this.
|
|
250
|
+
constructor(webhook) {
|
|
251
|
+
this.webhook = webhook;
|
|
252
252
|
}
|
|
253
253
|
async sendNotificationToAllSlack(message) {
|
|
254
254
|
const controller = new AbortController();
|
|
255
255
|
const timeoutId = setTimeout(() => controller.abort(), 3e3);
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
throw new Error("Failed sending Slack notification to " + message);
|
|
266
|
-
}
|
|
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);
|
|
267
265
|
}
|
|
268
266
|
}
|
|
269
267
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { s as schema } from './notification.BJyMXKGH.mjs';
|
|
1
2
|
import z$1, { z } from 'zod';
|
|
2
3
|
import { z as z$2 } from 'zod/v4';
|
|
3
4
|
import { InternalError } from '@develit-io/backend-sdk';
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
declare const tables: typeof schema;
|
|
5
7
|
|
|
6
8
|
declare const iContactSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
7
9
|
email: z.ZodString;
|
|
@@ -218,12 +220,10 @@ interface ISlack {
|
|
|
218
220
|
}
|
|
219
221
|
|
|
220
222
|
declare class SlackConnector {
|
|
221
|
-
private
|
|
222
|
-
constructor(
|
|
223
|
+
private webhook;
|
|
224
|
+
constructor(webhook: string);
|
|
223
225
|
sendNotificationToAllSlack(message: string): Promise<void>;
|
|
224
226
|
}
|
|
225
227
|
|
|
226
|
-
declare const tables: typeof schema;
|
|
227
|
-
|
|
228
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
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 };
|
package/dist/types.cjs
CHANGED
package/dist/types.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { I as IEmailConnector, h as IEmail, i as IContact, a as ISmsConnector, j as ISms, t as tables } from './shared/notification.
|
|
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.
|
|
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
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.
|
|
7
|
-
import 'zod';
|
|
8
|
-
import 'zod/v4';
|
|
6
|
+
export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.CBrLTgQh.cjs';
|
|
9
7
|
import './shared/notification.BJyMXKGH.cjs';
|
|
10
8
|
import 'drizzle-orm/sqlite-core';
|
|
9
|
+
import 'zod';
|
|
10
|
+
import 'zod/v4';
|
|
11
11
|
|
|
12
12
|
declare class EcomailConnector extends IEmailConnector {
|
|
13
13
|
static providerName: string;
|
package/dist/types.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { I as IEmailConnector, h as IEmail, i as IContact, a as ISmsConnector, j as ISms, t as tables } from './shared/notification.
|
|
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.
|
|
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
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.
|
|
7
|
-
import 'zod';
|
|
8
|
-
import 'zod/v4';
|
|
6
|
+
export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.CBrLTgQh.mjs';
|
|
9
7
|
import './shared/notification.BJyMXKGH.mjs';
|
|
10
8
|
import 'drizzle-orm/sqlite-core';
|
|
9
|
+
import 'zod';
|
|
10
|
+
import 'zod/v4';
|
|
11
11
|
|
|
12
12
|
declare class EcomailConnector extends IEmailConnector {
|
|
13
13
|
static providerName: string;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { I as IEmailConnector, h as IEmail, i as IContact, a as ISmsConnector, j as ISms, t as tables } from './shared/notification.
|
|
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.
|
|
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
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.
|
|
7
|
-
import 'zod';
|
|
8
|
-
import 'zod/v4';
|
|
6
|
+
export { b as NotificationServiceEnv, a as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.CBrLTgQh.js';
|
|
9
7
|
import './shared/notification.BJyMXKGH.js';
|
|
10
8
|
import 'drizzle-orm/sqlite-core';
|
|
9
|
+
import 'zod';
|
|
10
|
+
import 'zod/v4';
|
|
11
11
|
|
|
12
12
|
declare class EcomailConnector extends IEmailConnector {
|
|
13
13
|
static providerName: string;
|
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.
|
|
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';
|
|
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.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"author": "Develit.io s.r.o.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -30,33 +30,30 @@
|
|
|
30
30
|
"./dist"
|
|
31
31
|
],
|
|
32
32
|
"scripts": {
|
|
33
|
-
"dev": "wrangler dev --port
|
|
34
|
-
"wrangler:generate": "develit wrangler:generate",
|
|
33
|
+
"dev": "wrangler dev --port 9236 --persist-to ../../.wrangler/state",
|
|
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
39
|
"types": "wrangler types --env-interface NotificationEnv --include-runtime false",
|
|
40
|
-
"typecheck": "tsc",
|
|
41
40
|
"lint": "biome check",
|
|
42
41
|
"lint:fix": "biome check --fix",
|
|
43
42
|
"test": "vitest",
|
|
44
43
|
"test:cov": "vitest run --coverage",
|
|
45
44
|
"test:unit": "vitest unit fixtures",
|
|
46
45
|
"test:int": "vitest integration",
|
|
47
|
-
"build": "unbuild"
|
|
48
|
-
"changelogen": "bunx changelogen@latest --bump",
|
|
49
|
-
"release": "bun run build && bunx changelogen@latest --release --push && npm publish --access public"
|
|
46
|
+
"build": "unbuild"
|
|
50
47
|
},
|
|
51
48
|
"peerDependencies": {
|
|
52
|
-
"@develit-io/backend-sdk": "
|
|
53
|
-
"drizzle-kit": "
|
|
54
|
-
"drizzle-orm": "
|
|
49
|
+
"@develit-io/backend-sdk": "9.1.6",
|
|
50
|
+
"drizzle-kit": "0.31.8",
|
|
51
|
+
"drizzle-orm": "0.45.0",
|
|
55
52
|
"drizzle-seed": "*",
|
|
56
|
-
"wrangler": "
|
|
57
|
-
"zod": "
|
|
53
|
+
"wrangler": "4.50.0",
|
|
54
|
+
"zod": "4.1.13"
|
|
58
55
|
},
|
|
59
56
|
"dependencies": {
|
|
60
|
-
"twilio": "^5.10.
|
|
57
|
+
"twilio": "^5.10.7"
|
|
61
58
|
}
|
|
62
59
|
}
|