@develit-services/notification 0.6.0 → 0.6.2
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 +80 -58
- package/dist/export/worker.d.cts +0 -5
- package/dist/export/worker.d.mts +0 -5
- package/dist/export/worker.d.ts +0 -5
- package/dist/export/worker.mjs +80 -58
- package/dist/export/wrangler.cjs +0 -16
- package/dist/export/wrangler.d.cts +1 -7
- package/dist/export/wrangler.d.mts +1 -7
- package/dist/export/wrangler.d.ts +1 -7
- package/dist/export/wrangler.mjs +0 -16
- package/dist/shared/{notification.CdlaOUd0.d.cts → notification.Csi9Hg5K.d.cts} +0 -3
- package/dist/shared/{notification.CdlaOUd0.d.mts → notification.Csi9Hg5K.d.mts} +0 -3
- package/dist/shared/{notification.CdlaOUd0.d.ts → notification.Csi9Hg5K.d.ts} +0 -3
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -11
- package/dist/database/schema.cjs +0 -7
- package/dist/database/schema.d.cts +0 -6
- package/dist/database/schema.d.mts +0 -6
- package/dist/database/schema.d.ts +0 -6
- package/dist/database/schema.mjs +0 -5
package/dist/export/worker.cjs
CHANGED
|
@@ -3,19 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
6
|
-
const database_schema = require('../database/schema.cjs');
|
|
7
|
-
require('drizzle-orm');
|
|
8
|
-
require('drizzle-orm/sqlite-core');
|
|
9
6
|
const webhook_connector = require('../shared/notification.BLPB8Ib2.cjs');
|
|
10
7
|
require('@develit-io/backend-sdk/signature');
|
|
11
8
|
const cloudflare_workers = require('cloudflare:workers');
|
|
12
|
-
const d1 = require('drizzle-orm/d1');
|
|
13
9
|
require('zod');
|
|
14
10
|
require('zod/v4');
|
|
15
11
|
require('twilio');
|
|
16
12
|
|
|
17
|
-
const tables = database_schema.schema;
|
|
18
|
-
|
|
19
13
|
const initiateEmailConnector = async (provider, apiKey, smtpHost, senderEmail, senderName) => {
|
|
20
14
|
const connector = [webhook_connector.EcomailConnector].find(
|
|
21
15
|
(conn) => conn.providerName === provider
|
|
@@ -71,7 +65,6 @@ let NotificationServiceBase = class extends backendSdk.develitWorker(
|
|
|
71
65
|
constructor(ctx, env) {
|
|
72
66
|
super(ctx, env);
|
|
73
67
|
this.slackConnector = new webhook_connector.SlackConnector(this.env.SLACK_WEBHOOK);
|
|
74
|
-
this.db = d1.drizzle(this.env.NOTIFICATION_D1, { schema: tables });
|
|
75
68
|
}
|
|
76
69
|
async queue(batch) {
|
|
77
70
|
for (const message of batch.messages) {
|
|
@@ -145,24 +138,28 @@ let NotificationServiceBase = class extends backendSdk.develitWorker(
|
|
|
145
138
|
);
|
|
146
139
|
}
|
|
147
140
|
await this.emailConnector.sendEmail(email);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
141
|
+
try {
|
|
142
|
+
await this.pushToQueue(this.env.AUDIT_LOGS_QUEUE, {
|
|
143
|
+
logType: "event",
|
|
144
|
+
service: "notification",
|
|
145
|
+
correlationId: backendSdk.uuidv4(),
|
|
146
|
+
eventType: "notification.email_sent",
|
|
147
|
+
actorUserId: userId,
|
|
148
|
+
actorEmail: userId || "SYSTEM",
|
|
149
|
+
targetType: "email",
|
|
150
|
+
targetId: email.to,
|
|
151
|
+
sourceIp: ip,
|
|
152
|
+
userAgent,
|
|
153
|
+
outcome: "success",
|
|
154
|
+
description: `Email sent to ${email.to}`,
|
|
155
|
+
details: JSON.stringify({
|
|
156
|
+
subject: email.subject,
|
|
157
|
+
templateId: email.templateId
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
} catch (e) {
|
|
161
|
+
console.error("Failed to push email audit log", e);
|
|
162
|
+
}
|
|
166
163
|
return {};
|
|
167
164
|
}
|
|
168
165
|
);
|
|
@@ -195,21 +192,25 @@ let NotificationServiceBase = class extends backendSdk.develitWorker(
|
|
|
195
192
|
);
|
|
196
193
|
}
|
|
197
194
|
await this.smsConnector.sendSms({ message, to });
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
195
|
+
try {
|
|
196
|
+
await this.pushToQueue(this.env.AUDIT_LOGS_QUEUE, {
|
|
197
|
+
logType: "event",
|
|
198
|
+
service: "notification",
|
|
199
|
+
correlationId: backendSdk.uuidv4(),
|
|
200
|
+
eventType: "notification.sms_sent",
|
|
201
|
+
actorUserId: userId,
|
|
202
|
+
actorEmail: userId || "SYSTEM",
|
|
203
|
+
targetType: "sms",
|
|
204
|
+
targetId: to,
|
|
205
|
+
sourceIp: ip,
|
|
206
|
+
userAgent,
|
|
207
|
+
outcome: "success",
|
|
208
|
+
description: `SMS sent to ${to}`,
|
|
209
|
+
details: JSON.stringify({ message })
|
|
210
|
+
});
|
|
211
|
+
} catch (e) {
|
|
212
|
+
console.error("Failed to push sms audit log", e);
|
|
213
|
+
}
|
|
213
214
|
return {};
|
|
214
215
|
}
|
|
215
216
|
);
|
|
@@ -290,8 +291,25 @@ let NotificationServiceBase = class extends backendSdk.develitWorker(
|
|
|
290
291
|
},
|
|
291
292
|
{ successMessage: "Slack sent." },
|
|
292
293
|
async (params) => {
|
|
293
|
-
const { slack } = params;
|
|
294
|
+
const { slack, metadata } = params;
|
|
294
295
|
await this.slackConnector.sendNotificationToAllSlack(slack.message);
|
|
296
|
+
await this.pushToQueue(this.env.AUDIT_LOGS_QUEUE, {
|
|
297
|
+
logType: "event",
|
|
298
|
+
service: "notification",
|
|
299
|
+
correlationId: backendSdk.uuidv4(),
|
|
300
|
+
eventType: "notification.slack_sent",
|
|
301
|
+
actorUserId: metadata?.initiator?.userId,
|
|
302
|
+
actorEmail: metadata?.initiator?.userId || "SYSTEM",
|
|
303
|
+
targetType: "slack",
|
|
304
|
+
targetId: "all-channels",
|
|
305
|
+
sourceIp: metadata?.ip,
|
|
306
|
+
userAgent: metadata?.userAgent,
|
|
307
|
+
outcome: "success",
|
|
308
|
+
description: "Slack notification sent",
|
|
309
|
+
details: JSON.stringify({
|
|
310
|
+
message: slack.message
|
|
311
|
+
})
|
|
312
|
+
});
|
|
295
313
|
return {};
|
|
296
314
|
}
|
|
297
315
|
);
|
|
@@ -343,23 +361,27 @@ let NotificationServiceBase = class extends backendSdk.develitWorker(
|
|
|
343
361
|
this.webhookConnector = new webhook_connector.WebhookConnector(privateKey);
|
|
344
362
|
}
|
|
345
363
|
await this.webhookConnector.sendWebhook(webhook);
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
364
|
+
try {
|
|
365
|
+
await this.pushToQueue(this.env.AUDIT_LOGS_QUEUE, {
|
|
366
|
+
logType: "event",
|
|
367
|
+
service: "notification",
|
|
368
|
+
correlationId: backendSdk.uuidv4(),
|
|
369
|
+
eventType: "notification.webhook_sent",
|
|
370
|
+
actorUserId: userId,
|
|
371
|
+
actorEmail: userId || "SYSTEM",
|
|
372
|
+
targetType: "webhook",
|
|
373
|
+
targetId: webhook.url,
|
|
374
|
+
sourceIp: ip,
|
|
375
|
+
userAgent,
|
|
376
|
+
outcome: "success",
|
|
377
|
+
description: `Webhook sent to ${webhook.url}`,
|
|
378
|
+
details: JSON.stringify({
|
|
379
|
+
url: webhook.url
|
|
380
|
+
})
|
|
381
|
+
});
|
|
382
|
+
} catch (e) {
|
|
383
|
+
console.error("Failed to push webhook audit log", e);
|
|
384
|
+
}
|
|
363
385
|
return {};
|
|
364
386
|
}
|
|
365
387
|
);
|
package/dist/export/worker.d.cts
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
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 schema } from '../database/schema.cjs';
|
|
4
3
|
import { S as SlackConnector, W as WebhookConnector, I as IEmailConnector, a as ISmsConnector, N as NotificationQueueMessage, b as SendEmailInput, c as SendEmailOutput, d as SendSmsInput, e as SendSmsOutput, f as SendSlackInput, g as SendSlackOutput, h as SendWebhookInput, i as SendWebhookOutput, G as GetReceivedEmailsInput, j as GetReceivedEmailsOutput, k as WaitForEmailInput, l as WaitForEmailOutput, C as ClearReceivedEmailsInput, m as ClearReceivedEmailsOutput } from '../shared/notification.BiG4Q650.cjs';
|
|
5
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
6
|
-
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
7
5
|
import 'zod';
|
|
8
6
|
import 'zod/v4';
|
|
9
7
|
|
|
10
|
-
declare const tables: typeof schema;
|
|
11
|
-
|
|
12
8
|
declare const NotificationServiceBase_base: (abstract new (ctx: ExecutionContext, env: NotificationEnv) => WorkerEntrypoint<NotificationEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
|
|
13
9
|
declare class NotificationServiceBase extends NotificationServiceBase_base {
|
|
14
10
|
readonly slackConnector: SlackConnector;
|
|
15
11
|
protected webhookConnector: WebhookConnector;
|
|
16
12
|
protected emailConnector: IEmailConnector;
|
|
17
13
|
protected smsConnector: ISmsConnector;
|
|
18
|
-
readonly db: DrizzleD1Database<typeof tables>;
|
|
19
14
|
constructor(ctx: ExecutionContext, env: NotificationEnv);
|
|
20
15
|
queue(batch: MessageBatch<NotificationQueueMessage>): Promise<void>;
|
|
21
16
|
protected _sendEmail(input: SendEmailInput): Promise<IRPCResponse<SendEmailOutput>>;
|
package/dist/export/worker.d.mts
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
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 schema } from '../database/schema.mjs';
|
|
4
3
|
import { S as SlackConnector, W as WebhookConnector, I as IEmailConnector, a as ISmsConnector, N as NotificationQueueMessage, b as SendEmailInput, c as SendEmailOutput, d as SendSmsInput, e as SendSmsOutput, f as SendSlackInput, g as SendSlackOutput, h as SendWebhookInput, i as SendWebhookOutput, G as GetReceivedEmailsInput, j as GetReceivedEmailsOutput, k as WaitForEmailInput, l as WaitForEmailOutput, C as ClearReceivedEmailsInput, m as ClearReceivedEmailsOutput } from '../shared/notification.BiG4Q650.mjs';
|
|
5
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
6
|
-
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
7
5
|
import 'zod';
|
|
8
6
|
import 'zod/v4';
|
|
9
7
|
|
|
10
|
-
declare const tables: typeof schema;
|
|
11
|
-
|
|
12
8
|
declare const NotificationServiceBase_base: (abstract new (ctx: ExecutionContext, env: NotificationEnv) => WorkerEntrypoint<NotificationEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
|
|
13
9
|
declare class NotificationServiceBase extends NotificationServiceBase_base {
|
|
14
10
|
readonly slackConnector: SlackConnector;
|
|
15
11
|
protected webhookConnector: WebhookConnector;
|
|
16
12
|
protected emailConnector: IEmailConnector;
|
|
17
13
|
protected smsConnector: ISmsConnector;
|
|
18
|
-
readonly db: DrizzleD1Database<typeof tables>;
|
|
19
14
|
constructor(ctx: ExecutionContext, env: NotificationEnv);
|
|
20
15
|
queue(batch: MessageBatch<NotificationQueueMessage>): Promise<void>;
|
|
21
16
|
protected _sendEmail(input: SendEmailInput): Promise<IRPCResponse<SendEmailOutput>>;
|
package/dist/export/worker.d.ts
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
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 schema } from '../database/schema.js';
|
|
4
3
|
import { S as SlackConnector, W as WebhookConnector, I as IEmailConnector, a as ISmsConnector, N as NotificationQueueMessage, b as SendEmailInput, c as SendEmailOutput, d as SendSmsInput, e as SendSmsOutput, f as SendSlackInput, g as SendSlackOutput, h as SendWebhookInput, i as SendWebhookOutput, G as GetReceivedEmailsInput, j as GetReceivedEmailsOutput, k as WaitForEmailInput, l as WaitForEmailOutput, C as ClearReceivedEmailsInput, m as ClearReceivedEmailsOutput } from '../shared/notification.BiG4Q650.js';
|
|
5
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
6
|
-
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
7
5
|
import 'zod';
|
|
8
6
|
import 'zod/v4';
|
|
9
7
|
|
|
10
|
-
declare const tables: typeof schema;
|
|
11
|
-
|
|
12
8
|
declare const NotificationServiceBase_base: (abstract new (ctx: ExecutionContext, env: NotificationEnv) => WorkerEntrypoint<NotificationEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
|
|
13
9
|
declare class NotificationServiceBase extends NotificationServiceBase_base {
|
|
14
10
|
readonly slackConnector: SlackConnector;
|
|
15
11
|
protected webhookConnector: WebhookConnector;
|
|
16
12
|
protected emailConnector: IEmailConnector;
|
|
17
13
|
protected smsConnector: ISmsConnector;
|
|
18
|
-
readonly db: DrizzleD1Database<typeof tables>;
|
|
19
14
|
constructor(ctx: ExecutionContext, env: NotificationEnv);
|
|
20
15
|
queue(batch: MessageBatch<NotificationQueueMessage>): Promise<void>;
|
|
21
16
|
protected _sendEmail(input: SendEmailInput): Promise<IRPCResponse<SendEmailOutput>>;
|
package/dist/export/worker.mjs
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { createInternalError, develitWorker, uuidv4, cloudflareQueue, action, service } from '@develit-io/backend-sdk';
|
|
2
|
-
import { s as schema } from '../database/schema.mjs';
|
|
3
|
-
import 'drizzle-orm';
|
|
4
|
-
import 'drizzle-orm/sqlite-core';
|
|
5
2
|
import { E as EcomailConnector, T as TwilioConnector, S as SlackConnector, s as sendEmailInputSchema, f as sendSmsInputSchema, e as sendSlackInputSchema, h as sendWebhookInputSchema, W as WebhookConnector, g as getReceivedEmailsInputSchema, w as waitForEmailInputSchema, c as clearReceivedEmailsInputSchema } from '../shared/notification.CP_hFlNt.mjs';
|
|
6
3
|
import '@develit-io/backend-sdk/signature';
|
|
7
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
8
|
-
import { drizzle } from 'drizzle-orm/d1';
|
|
9
5
|
import 'zod';
|
|
10
6
|
import 'zod/v4';
|
|
11
7
|
import 'twilio';
|
|
12
8
|
|
|
13
|
-
const tables = schema;
|
|
14
|
-
|
|
15
9
|
const initiateEmailConnector = async (provider, apiKey, smtpHost, senderEmail, senderName) => {
|
|
16
10
|
const connector = [EcomailConnector].find(
|
|
17
11
|
(conn) => conn.providerName === provider
|
|
@@ -67,7 +61,6 @@ let NotificationServiceBase = class extends develitWorker(
|
|
|
67
61
|
constructor(ctx, env) {
|
|
68
62
|
super(ctx, env);
|
|
69
63
|
this.slackConnector = new SlackConnector(this.env.SLACK_WEBHOOK);
|
|
70
|
-
this.db = drizzle(this.env.NOTIFICATION_D1, { schema: tables });
|
|
71
64
|
}
|
|
72
65
|
async queue(batch) {
|
|
73
66
|
for (const message of batch.messages) {
|
|
@@ -141,24 +134,28 @@ let NotificationServiceBase = class extends develitWorker(
|
|
|
141
134
|
);
|
|
142
135
|
}
|
|
143
136
|
await this.emailConnector.sendEmail(email);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
137
|
+
try {
|
|
138
|
+
await this.pushToQueue(this.env.AUDIT_LOGS_QUEUE, {
|
|
139
|
+
logType: "event",
|
|
140
|
+
service: "notification",
|
|
141
|
+
correlationId: uuidv4(),
|
|
142
|
+
eventType: "notification.email_sent",
|
|
143
|
+
actorUserId: userId,
|
|
144
|
+
actorEmail: userId || "SYSTEM",
|
|
145
|
+
targetType: "email",
|
|
146
|
+
targetId: email.to,
|
|
147
|
+
sourceIp: ip,
|
|
148
|
+
userAgent,
|
|
149
|
+
outcome: "success",
|
|
150
|
+
description: `Email sent to ${email.to}`,
|
|
151
|
+
details: JSON.stringify({
|
|
152
|
+
subject: email.subject,
|
|
153
|
+
templateId: email.templateId
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
} catch (e) {
|
|
157
|
+
console.error("Failed to push email audit log", e);
|
|
158
|
+
}
|
|
162
159
|
return {};
|
|
163
160
|
}
|
|
164
161
|
);
|
|
@@ -191,21 +188,25 @@ let NotificationServiceBase = class extends develitWorker(
|
|
|
191
188
|
);
|
|
192
189
|
}
|
|
193
190
|
await this.smsConnector.sendSms({ message, to });
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
191
|
+
try {
|
|
192
|
+
await this.pushToQueue(this.env.AUDIT_LOGS_QUEUE, {
|
|
193
|
+
logType: "event",
|
|
194
|
+
service: "notification",
|
|
195
|
+
correlationId: uuidv4(),
|
|
196
|
+
eventType: "notification.sms_sent",
|
|
197
|
+
actorUserId: userId,
|
|
198
|
+
actorEmail: userId || "SYSTEM",
|
|
199
|
+
targetType: "sms",
|
|
200
|
+
targetId: to,
|
|
201
|
+
sourceIp: ip,
|
|
202
|
+
userAgent,
|
|
203
|
+
outcome: "success",
|
|
204
|
+
description: `SMS sent to ${to}`,
|
|
205
|
+
details: JSON.stringify({ message })
|
|
206
|
+
});
|
|
207
|
+
} catch (e) {
|
|
208
|
+
console.error("Failed to push sms audit log", e);
|
|
209
|
+
}
|
|
209
210
|
return {};
|
|
210
211
|
}
|
|
211
212
|
);
|
|
@@ -286,8 +287,25 @@ let NotificationServiceBase = class extends develitWorker(
|
|
|
286
287
|
},
|
|
287
288
|
{ successMessage: "Slack sent." },
|
|
288
289
|
async (params) => {
|
|
289
|
-
const { slack } = params;
|
|
290
|
+
const { slack, metadata } = params;
|
|
290
291
|
await this.slackConnector.sendNotificationToAllSlack(slack.message);
|
|
292
|
+
await this.pushToQueue(this.env.AUDIT_LOGS_QUEUE, {
|
|
293
|
+
logType: "event",
|
|
294
|
+
service: "notification",
|
|
295
|
+
correlationId: uuidv4(),
|
|
296
|
+
eventType: "notification.slack_sent",
|
|
297
|
+
actorUserId: metadata?.initiator?.userId,
|
|
298
|
+
actorEmail: metadata?.initiator?.userId || "SYSTEM",
|
|
299
|
+
targetType: "slack",
|
|
300
|
+
targetId: "all-channels",
|
|
301
|
+
sourceIp: metadata?.ip,
|
|
302
|
+
userAgent: metadata?.userAgent,
|
|
303
|
+
outcome: "success",
|
|
304
|
+
description: "Slack notification sent",
|
|
305
|
+
details: JSON.stringify({
|
|
306
|
+
message: slack.message
|
|
307
|
+
})
|
|
308
|
+
});
|
|
291
309
|
return {};
|
|
292
310
|
}
|
|
293
311
|
);
|
|
@@ -339,23 +357,27 @@ let NotificationServiceBase = class extends develitWorker(
|
|
|
339
357
|
this.webhookConnector = new WebhookConnector(privateKey);
|
|
340
358
|
}
|
|
341
359
|
await this.webhookConnector.sendWebhook(webhook);
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
360
|
+
try {
|
|
361
|
+
await this.pushToQueue(this.env.AUDIT_LOGS_QUEUE, {
|
|
362
|
+
logType: "event",
|
|
363
|
+
service: "notification",
|
|
364
|
+
correlationId: uuidv4(),
|
|
365
|
+
eventType: "notification.webhook_sent",
|
|
366
|
+
actorUserId: userId,
|
|
367
|
+
actorEmail: userId || "SYSTEM",
|
|
368
|
+
targetType: "webhook",
|
|
369
|
+
targetId: webhook.url,
|
|
370
|
+
sourceIp: ip,
|
|
371
|
+
userAgent,
|
|
372
|
+
outcome: "success",
|
|
373
|
+
description: `Webhook sent to ${webhook.url}`,
|
|
374
|
+
details: JSON.stringify({
|
|
375
|
+
url: webhook.url
|
|
376
|
+
})
|
|
377
|
+
});
|
|
378
|
+
} catch (e) {
|
|
379
|
+
console.error("Failed to push webhook audit log", e);
|
|
380
|
+
}
|
|
359
381
|
return {};
|
|
360
382
|
}
|
|
361
383
|
);
|
package/dist/export/wrangler.cjs
CHANGED
|
@@ -19,14 +19,6 @@ function defineNotificationServiceWrangler(config) {
|
|
|
19
19
|
service: `${project}-secrets-store`
|
|
20
20
|
}
|
|
21
21
|
],
|
|
22
|
-
d1_databases: [
|
|
23
|
-
{
|
|
24
|
-
binding: "NOTIFICATION_D1",
|
|
25
|
-
database_name: `${project}-notification`,
|
|
26
|
-
database_id: envs.local.d1.id,
|
|
27
|
-
migrations_dir: "./src/database/migrations"
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
22
|
kv_namespaces: envs.local.kv ? [
|
|
31
23
|
{
|
|
32
24
|
binding: "RECEIVED_EMAILS_KV",
|
|
@@ -63,14 +55,6 @@ function defineNotificationServiceWrangler(config) {
|
|
|
63
55
|
...envCfg.vars,
|
|
64
56
|
ENVIRONMENT: envName
|
|
65
57
|
},
|
|
66
|
-
d1_databases: [
|
|
67
|
-
{
|
|
68
|
-
binding: "NOTIFICATION_D1",
|
|
69
|
-
database_name: `${project}-notification-${envName}`,
|
|
70
|
-
database_id: envCfg.d1.id,
|
|
71
|
-
migrations_dir: "./src/database/migrations"
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
58
|
...envCfg.kv && {
|
|
75
59
|
kv_namespaces: [
|
|
76
60
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NotificationServiceWranglerConfig } from '../shared/notification.
|
|
1
|
+
import { N as NotificationServiceWranglerConfig } from '../shared/notification.Csi9Hg5K.cjs';
|
|
2
2
|
|
|
3
3
|
declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
|
|
4
4
|
vars: {
|
|
@@ -14,12 +14,6 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
|
|
|
14
14
|
binding: string;
|
|
15
15
|
service: string;
|
|
16
16
|
}[];
|
|
17
|
-
d1_databases: {
|
|
18
|
-
binding: string;
|
|
19
|
-
database_name: string;
|
|
20
|
-
database_id: string;
|
|
21
|
-
migrations_dir: string;
|
|
22
|
-
}[];
|
|
23
17
|
kv_namespaces: {
|
|
24
18
|
binding: string;
|
|
25
19
|
id: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NotificationServiceWranglerConfig } from '../shared/notification.
|
|
1
|
+
import { N as NotificationServiceWranglerConfig } from '../shared/notification.Csi9Hg5K.mjs';
|
|
2
2
|
|
|
3
3
|
declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
|
|
4
4
|
vars: {
|
|
@@ -14,12 +14,6 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
|
|
|
14
14
|
binding: string;
|
|
15
15
|
service: string;
|
|
16
16
|
}[];
|
|
17
|
-
d1_databases: {
|
|
18
|
-
binding: string;
|
|
19
|
-
database_name: string;
|
|
20
|
-
database_id: string;
|
|
21
|
-
migrations_dir: string;
|
|
22
|
-
}[];
|
|
23
17
|
kv_namespaces: {
|
|
24
18
|
binding: string;
|
|
25
19
|
id: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as NotificationServiceWranglerConfig } from '../shared/notification.
|
|
1
|
+
import { N as NotificationServiceWranglerConfig } from '../shared/notification.Csi9Hg5K.js';
|
|
2
2
|
|
|
3
3
|
declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
|
|
4
4
|
vars: {
|
|
@@ -14,12 +14,6 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
|
|
|
14
14
|
binding: string;
|
|
15
15
|
service: string;
|
|
16
16
|
}[];
|
|
17
|
-
d1_databases: {
|
|
18
|
-
binding: string;
|
|
19
|
-
database_name: string;
|
|
20
|
-
database_id: string;
|
|
21
|
-
migrations_dir: string;
|
|
22
|
-
}[];
|
|
23
17
|
kv_namespaces: {
|
|
24
18
|
binding: string;
|
|
25
19
|
id: string;
|
package/dist/export/wrangler.mjs
CHANGED
|
@@ -17,14 +17,6 @@ function defineNotificationServiceWrangler(config) {
|
|
|
17
17
|
service: `${project}-secrets-store`
|
|
18
18
|
}
|
|
19
19
|
],
|
|
20
|
-
d1_databases: [
|
|
21
|
-
{
|
|
22
|
-
binding: "NOTIFICATION_D1",
|
|
23
|
-
database_name: `${project}-notification`,
|
|
24
|
-
database_id: envs.local.d1.id,
|
|
25
|
-
migrations_dir: "./src/database/migrations"
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
20
|
kv_namespaces: envs.local.kv ? [
|
|
29
21
|
{
|
|
30
22
|
binding: "RECEIVED_EMAILS_KV",
|
|
@@ -61,14 +53,6 @@ function defineNotificationServiceWrangler(config) {
|
|
|
61
53
|
...envCfg.vars,
|
|
62
54
|
ENVIRONMENT: envName
|
|
63
55
|
},
|
|
64
|
-
d1_databases: [
|
|
65
|
-
{
|
|
66
|
-
binding: "NOTIFICATION_D1",
|
|
67
|
-
database_name: `${project}-notification-${envName}`,
|
|
68
|
-
database_id: envCfg.d1.id,
|
|
69
|
-
migrations_dir: "./src/database/migrations"
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
56
|
...envCfg.kv && {
|
|
73
57
|
kv_namespaces: [
|
|
74
58
|
{
|
package/dist/types.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { I as IEmailConnector, n as IEmail, o as IContact, a as ISmsConnector, p as ISms } from './shared/notification.BiG4Q650.cjs';
|
|
2
2
|
export { C as ClearReceivedEmailsInput, m as ClearReceivedEmailsOutput, G as GetReceivedEmailsInput, j as GetReceivedEmailsOutput, q as IAttachment, r as IPushNotification, s as ISlack, t as IWebhook, N as NotificationQueueMessage, R as ReceivedEmail, b as SendEmailInput, c as SendEmailOutput, f as SendSlackInput, g as SendSlackOutput, d as SendSmsInput, e as SendSmsOutput, h as SendWebhookInput, i as SendWebhookOutput, S as SlackConnector, k as WaitForEmailInput, l as WaitForEmailOutput, W as WebhookConnector, u as clearReceivedEmailsInputSchema, v as getReceivedEmailsInputSchema, w as iAttachmentSchema, x as iContactSchema, y as iEmailSchema, z as sendEmailInputSchema, A as sendSlackInputSchema, B as sendSmsInputSchema, D as sendWebhookInputSchema, E as waitForEmailInputSchema } from './shared/notification.BiG4Q650.cjs';
|
|
3
3
|
import twilio from 'twilio';
|
|
4
|
-
export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.
|
|
4
|
+
export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.Csi9Hg5K.cjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'zod/v4';
|
|
7
7
|
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { I as IEmailConnector, n as IEmail, o as IContact, a as ISmsConnector, p as ISms } from './shared/notification.BiG4Q650.mjs';
|
|
2
2
|
export { C as ClearReceivedEmailsInput, m as ClearReceivedEmailsOutput, G as GetReceivedEmailsInput, j as GetReceivedEmailsOutput, q as IAttachment, r as IPushNotification, s as ISlack, t as IWebhook, N as NotificationQueueMessage, R as ReceivedEmail, b as SendEmailInput, c as SendEmailOutput, f as SendSlackInput, g as SendSlackOutput, d as SendSmsInput, e as SendSmsOutput, h as SendWebhookInput, i as SendWebhookOutput, S as SlackConnector, k as WaitForEmailInput, l as WaitForEmailOutput, W as WebhookConnector, u as clearReceivedEmailsInputSchema, v as getReceivedEmailsInputSchema, w as iAttachmentSchema, x as iContactSchema, y as iEmailSchema, z as sendEmailInputSchema, A as sendSlackInputSchema, B as sendSmsInputSchema, D as sendWebhookInputSchema, E as waitForEmailInputSchema } from './shared/notification.BiG4Q650.mjs';
|
|
3
3
|
import twilio from 'twilio';
|
|
4
|
-
export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.
|
|
4
|
+
export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.Csi9Hg5K.mjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'zod/v4';
|
|
7
7
|
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { I as IEmailConnector, n as IEmail, o as IContact, a as ISmsConnector, p as ISms } from './shared/notification.BiG4Q650.js';
|
|
2
2
|
export { C as ClearReceivedEmailsInput, m as ClearReceivedEmailsOutput, G as GetReceivedEmailsInput, j as GetReceivedEmailsOutput, q as IAttachment, r as IPushNotification, s as ISlack, t as IWebhook, N as NotificationQueueMessage, R as ReceivedEmail, b as SendEmailInput, c as SendEmailOutput, f as SendSlackInput, g as SendSlackOutput, d as SendSmsInput, e as SendSmsOutput, h as SendWebhookInput, i as SendWebhookOutput, S as SlackConnector, k as WaitForEmailInput, l as WaitForEmailOutput, W as WebhookConnector, u as clearReceivedEmailsInputSchema, v as getReceivedEmailsInputSchema, w as iAttachmentSchema, x as iContactSchema, y as iEmailSchema, z as sendEmailInputSchema, A as sendSlackInputSchema, B as sendSmsInputSchema, D as sendWebhookInputSchema, E as waitForEmailInputSchema } from './shared/notification.BiG4Q650.js';
|
|
3
3
|
import twilio from 'twilio';
|
|
4
|
-
export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.
|
|
4
|
+
export { a as NotificationServiceEnv, b as NotificationServiceEnvironmentConfig, N as NotificationServiceWranglerConfig } from './shared/notification.Csi9Hg5K.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'zod/v4';
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@develit-services/notification",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"author": "Develit.io s.r.o.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -14,11 +14,6 @@
|
|
|
14
14
|
"import": "./dist/export/worker.mjs",
|
|
15
15
|
"require": "./dist/export/worker.cjs"
|
|
16
16
|
},
|
|
17
|
-
"./db-schema": {
|
|
18
|
-
"types": "./dist/database/schema.d.ts",
|
|
19
|
-
"import": "./dist/database/schema.mjs",
|
|
20
|
-
"require": "./dist/database/schema.cjs"
|
|
21
|
-
},
|
|
22
17
|
"./@types": {
|
|
23
18
|
"types": "./dist/types.d.ts",
|
|
24
19
|
"import": "./dist/types.mjs",
|
|
@@ -32,10 +27,6 @@
|
|
|
32
27
|
"scripts": {
|
|
33
28
|
"dev": "wrangler dev --port 9236 --persist-to ../../.wrangler/state -c ./wrangler.jsonc -c ../../apps/secrets-store/wrangler.jsonc",
|
|
34
29
|
"wrangler:generate": "bunx develit wrangler:generate --types",
|
|
35
|
-
"db:init": "wrangler d1 execute develit-notification --local --persist-to ../../.wrangler/state --command=\"SELECT 'Creating database...' AS status;\"",
|
|
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
30
|
"types": "bash typegen.sh",
|
|
40
31
|
"lint": "biome check",
|
|
41
32
|
"lint:fix": "biome check --fix",
|
|
@@ -50,7 +41,6 @@
|
|
|
50
41
|
},
|
|
51
42
|
"peerDependencies": {
|
|
52
43
|
"@develit-io/backend-sdk": "^9.10.3",
|
|
53
|
-
"drizzle-orm": "^0.45.0",
|
|
54
44
|
"zod": "^4.1.13"
|
|
55
45
|
}
|
|
56
46
|
}
|
package/dist/database/schema.cjs
DELETED