@develit-services/notification 3.0.0 → 5.0.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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
- const webhook_connector = require('../shared/notification.BLPB8Ib2.cjs');
4
+ const webhook_connector = require('./shared/notification.BLPB8Ib2.cjs');
5
5
  require('@develit-io/backend-sdk/signature');
6
6
  const cloudflare_workers = require('cloudflare:workers');
7
7
  require('zod');
@@ -57,7 +57,7 @@ var __decorateClass = (decorators, target, key, kind) => {
57
57
  if (kind && result) __defProp(target, key, result);
58
58
  return result;
59
59
  };
60
- let NotificationServiceBase = class extends backendSdk.develitWorker(
60
+ exports.NotificationServiceBase = class NotificationServiceBase extends backendSdk.develitWorker(
61
61
  cloudflare_workers.WorkerEntrypoint
62
62
  ) {
63
63
  constructor(ctx, env) {
@@ -520,48 +520,48 @@ let NotificationServiceBase = class extends backendSdk.develitWorker(
520
520
  };
521
521
  __decorateClass([
522
522
  backendSdk.cloudflareQueue({ baseDelay: 60 })
523
- ], NotificationServiceBase.prototype, "queue", 1);
523
+ ], exports.NotificationServiceBase.prototype, "queue", 1);
524
524
  __decorateClass([
525
525
  backendSdk.action("private-send-email")
526
- ], NotificationServiceBase.prototype, "_sendEmail", 1);
526
+ ], exports.NotificationServiceBase.prototype, "_sendEmail", 1);
527
527
  __decorateClass([
528
528
  backendSdk.action("private-send-sms")
529
- ], NotificationServiceBase.prototype, "_sendSms", 1);
529
+ ], exports.NotificationServiceBase.prototype, "_sendSms", 1);
530
530
  __decorateClass([
531
531
  backendSdk.action("send-email")
532
- ], NotificationServiceBase.prototype, "sendEmail", 1);
532
+ ], exports.NotificationServiceBase.prototype, "sendEmail", 1);
533
533
  __decorateClass([
534
534
  backendSdk.action("send-email-sync")
535
- ], NotificationServiceBase.prototype, "sendEmailSync", 1);
535
+ ], exports.NotificationServiceBase.prototype, "sendEmailSync", 1);
536
536
  __decorateClass([
537
537
  backendSdk.action("send-sms")
538
- ], NotificationServiceBase.prototype, "sendSms", 1);
538
+ ], exports.NotificationServiceBase.prototype, "sendSms", 1);
539
539
  __decorateClass([
540
540
  backendSdk.action("send-push-notification")
541
- ], NotificationServiceBase.prototype, "_sendPushNotification", 1);
541
+ ], exports.NotificationServiceBase.prototype, "_sendPushNotification", 1);
542
542
  __decorateClass([
543
543
  backendSdk.action("send-slack-notification")
544
- ], NotificationServiceBase.prototype, "sendSlackNotification", 1);
544
+ ], exports.NotificationServiceBase.prototype, "sendSlackNotification", 1);
545
545
  __decorateClass([
546
546
  backendSdk.action("send-webhook")
547
- ], NotificationServiceBase.prototype, "sendWebhook", 1);
547
+ ], exports.NotificationServiceBase.prototype, "sendWebhook", 1);
548
548
  __decorateClass([
549
549
  backendSdk.action("private-send-webhook")
550
- ], NotificationServiceBase.prototype, "_sendWebhook", 1);
550
+ ], exports.NotificationServiceBase.prototype, "_sendWebhook", 1);
551
551
  __decorateClass([
552
552
  backendSdk.action("get-received-emails")
553
- ], NotificationServiceBase.prototype, "getReceivedEmails", 1);
553
+ ], exports.NotificationServiceBase.prototype, "getReceivedEmails", 1);
554
554
  __decorateClass([
555
555
  backendSdk.action("wait-for-email")
556
- ], NotificationServiceBase.prototype, "waitForEmail", 1);
556
+ ], exports.NotificationServiceBase.prototype, "waitForEmail", 1);
557
557
  __decorateClass([
558
558
  backendSdk.action("clear-received-emails")
559
- ], NotificationServiceBase.prototype, "clearReceivedEmails", 1);
560
- NotificationServiceBase = __decorateClass([
559
+ ], exports.NotificationServiceBase.prototype, "clearReceivedEmails", 1);
560
+ exports.NotificationServiceBase = __decorateClass([
561
561
  backendSdk.service("notification")
562
- ], NotificationServiceBase);
562
+ ], exports.NotificationServiceBase);
563
563
  function defineNotificationService() {
564
- return class NotificationService extends NotificationServiceBase {
564
+ return class NotificationService extends exports.NotificationServiceBase {
565
565
  constructor(ctx, env) {
566
566
  super(ctx, env);
567
567
  }
@@ -1,6 +1,6 @@
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, 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';
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';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import 'zod';
6
6
  import 'zod/v4';
@@ -43,4 +43,4 @@ declare class NotificationServiceBase extends NotificationServiceBase_base {
43
43
  }
44
44
  declare function defineNotificationService(): typeof NotificationServiceBase;
45
45
 
46
- export { defineNotificationService };
46
+ export { NotificationServiceBase, defineNotificationService };
@@ -1,6 +1,6 @@
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, 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';
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';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import 'zod';
6
6
  import 'zod/v4';
@@ -43,4 +43,4 @@ declare class NotificationServiceBase extends NotificationServiceBase_base {
43
43
  }
44
44
  declare function defineNotificationService(): typeof NotificationServiceBase;
45
45
 
46
- export { defineNotificationService };
46
+ export { NotificationServiceBase, defineNotificationService };
@@ -1,6 +1,6 @@
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, 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';
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';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import 'zod';
6
6
  import 'zod/v4';
@@ -43,4 +43,4 @@ declare class NotificationServiceBase extends NotificationServiceBase_base {
43
43
  }
44
44
  declare function defineNotificationService(): typeof NotificationServiceBase;
45
45
 
46
- export { defineNotificationService };
46
+ export { NotificationServiceBase, defineNotificationService };
@@ -1,5 +1,5 @@
1
1
  import { createInternalError, develitWorker, uuidv4, cloudflareQueue, action, service } from '@develit-io/backend-sdk';
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';
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';
3
3
  import '@develit-io/backend-sdk/signature';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import 'zod';
@@ -566,4 +566,4 @@ function defineNotificationService() {
566
566
  };
567
567
  }
568
568
 
569
- export { defineNotificationService };
569
+ export { NotificationServiceBase, defineNotificationService };
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ const serviceConfig = require('@develit-io/platform-sdk/service-config');
4
+
5
+ const NOTIFICATION_SERVICE_BINDINGS = {
6
+ SECRETS_STORE: { kind: "service", target: "secrets-store" },
7
+ RECEIVED_EMAILS_KV: { kind: "kv", suffix: "received-emails" },
8
+ NOTIFICATIONS_QUEUE: { kind: "queueProducer", suffix: "notifications" },
9
+ AUDIT_LOGS_QUEUE: { kind: "queueProducer", suffix: "audit-logs" }
10
+ };
11
+ const NOTIFICATION_SERVICE_QUEUE_CONSUMERS = [
12
+ {
13
+ suffix: "notifications",
14
+ maxBatchSize: 1,
15
+ maxBatchTimeout: 5,
16
+ deadLetterQueueSuffix: "notifications-dlq"
17
+ }
18
+ ];
19
+ const notificationServiceConfig = serviceConfig.createTypedServiceConfigFactory()(
20
+ NOTIFICATION_SERVICE_BINDINGS,
21
+ NOTIFICATION_SERVICE_QUEUE_CONSUMERS
22
+ );
23
+ function notificationService(config, deployment, bindings) {
24
+ return {
25
+ resourceName: "notification",
26
+ variables: config.vars[deployment.environment],
27
+ bindings,
28
+ crons: config.triggers.crons[deployment.environment]
29
+ };
30
+ }
31
+
32
+ exports.NOTIFICATION_SERVICE_BINDINGS = NOTIFICATION_SERVICE_BINDINGS;
33
+ exports.NOTIFICATION_SERVICE_QUEUE_CONSUMERS = NOTIFICATION_SERVICE_QUEUE_CONSUMERS;
34
+ exports.notificationService = notificationService;
35
+ exports.notificationServiceConfig = notificationServiceConfig;
@@ -0,0 +1,105 @@
1
+ import * as _develit_io_platform_sdk from '@develit-io/platform-sdk';
2
+ import { Deployment } from '@develit-io/platform-sdk';
3
+ import { BindingsFromDescriptor } from '@develit-io/platform-sdk/service-config';
4
+
5
+ interface NotificationServiceVariables {
6
+ EMAIL_PROVIDER: string;
7
+ EMAIL_SENDER_EMAIL: string;
8
+ EMAIL_SENDER_NAME: string;
9
+ EMAIL_SMTP_HOST: string;
10
+ SMS_PROVIDER: string;
11
+ SLACK_WEBHOOK: string;
12
+ EMAIL_WHITELIST: string;
13
+ EMAIL_WHITELIST_FALLBACK: string;
14
+ [key: string]: string | number | boolean;
15
+ }
16
+ declare const NOTIFICATION_SERVICE_BINDINGS: {
17
+ readonly SECRETS_STORE: {
18
+ readonly kind: "service";
19
+ readonly target: "secrets-store";
20
+ };
21
+ readonly RECEIVED_EMAILS_KV: {
22
+ readonly kind: "kv";
23
+ readonly suffix: "received-emails";
24
+ };
25
+ readonly NOTIFICATIONS_QUEUE: {
26
+ readonly kind: "queueProducer";
27
+ readonly suffix: "notifications";
28
+ };
29
+ readonly AUDIT_LOGS_QUEUE: {
30
+ readonly kind: "queueProducer";
31
+ readonly suffix: "audit-logs";
32
+ };
33
+ };
34
+ declare const NOTIFICATION_SERVICE_QUEUE_CONSUMERS: readonly [{
35
+ readonly suffix: "notifications";
36
+ readonly maxBatchSize: 1;
37
+ readonly maxBatchTimeout: 5;
38
+ readonly deadLetterQueueSuffix: "notifications-dlq";
39
+ }];
40
+ declare const notificationServiceConfig: (project: string, version: string, options?: _develit_io_platform_sdk.ServiceConfigOptions<NotificationServiceVariables, _develit_io_platform_sdk.MiniflareIds<{
41
+ readonly SECRETS_STORE: {
42
+ readonly kind: "service";
43
+ readonly target: "secrets-store";
44
+ };
45
+ readonly RECEIVED_EMAILS_KV: {
46
+ readonly kind: "kv";
47
+ readonly suffix: "received-emails";
48
+ };
49
+ readonly NOTIFICATIONS_QUEUE: {
50
+ readonly kind: "queueProducer";
51
+ readonly suffix: "notifications";
52
+ };
53
+ readonly AUDIT_LOGS_QUEUE: {
54
+ readonly kind: "queueProducer";
55
+ readonly suffix: "audit-logs";
56
+ };
57
+ }>> | undefined) => _develit_io_platform_sdk.ServiceConfigWithBindings<NotificationServiceVariables, {
58
+ readonly SECRETS_STORE: {
59
+ readonly kind: "service";
60
+ readonly target: "secrets-store";
61
+ };
62
+ readonly RECEIVED_EMAILS_KV: {
63
+ readonly kind: "kv";
64
+ readonly suffix: "received-emails";
65
+ };
66
+ readonly NOTIFICATIONS_QUEUE: {
67
+ readonly kind: "queueProducer";
68
+ readonly suffix: "notifications";
69
+ };
70
+ readonly AUDIT_LOGS_QUEUE: {
71
+ readonly kind: "queueProducer";
72
+ readonly suffix: "audit-logs";
73
+ };
74
+ }, readonly [{
75
+ readonly suffix: "notifications";
76
+ readonly maxBatchSize: 1;
77
+ readonly maxBatchTimeout: 5;
78
+ readonly deadLetterQueueSuffix: "notifications-dlq";
79
+ }]>;
80
+ declare function notificationService(config: ReturnType<typeof notificationServiceConfig>, deployment: Deployment, bindings: BindingsFromDescriptor<typeof NOTIFICATION_SERVICE_BINDINGS>): {
81
+ resourceName: "notification";
82
+ variables: NotificationServiceVariables;
83
+ bindings: BindingsFromDescriptor<{
84
+ readonly SECRETS_STORE: {
85
+ readonly kind: "service";
86
+ readonly target: "secrets-store";
87
+ };
88
+ readonly RECEIVED_EMAILS_KV: {
89
+ readonly kind: "kv";
90
+ readonly suffix: "received-emails";
91
+ };
92
+ readonly NOTIFICATIONS_QUEUE: {
93
+ readonly kind: "queueProducer";
94
+ readonly suffix: "notifications";
95
+ };
96
+ readonly AUDIT_LOGS_QUEUE: {
97
+ readonly kind: "queueProducer";
98
+ readonly suffix: "audit-logs";
99
+ };
100
+ }>;
101
+ crons: string[];
102
+ };
103
+
104
+ export { NOTIFICATION_SERVICE_BINDINGS, NOTIFICATION_SERVICE_QUEUE_CONSUMERS, notificationService, notificationServiceConfig };
105
+ export type { NotificationServiceVariables };
@@ -0,0 +1,105 @@
1
+ import * as _develit_io_platform_sdk from '@develit-io/platform-sdk';
2
+ import { Deployment } from '@develit-io/platform-sdk';
3
+ import { BindingsFromDescriptor } from '@develit-io/platform-sdk/service-config';
4
+
5
+ interface NotificationServiceVariables {
6
+ EMAIL_PROVIDER: string;
7
+ EMAIL_SENDER_EMAIL: string;
8
+ EMAIL_SENDER_NAME: string;
9
+ EMAIL_SMTP_HOST: string;
10
+ SMS_PROVIDER: string;
11
+ SLACK_WEBHOOK: string;
12
+ EMAIL_WHITELIST: string;
13
+ EMAIL_WHITELIST_FALLBACK: string;
14
+ [key: string]: string | number | boolean;
15
+ }
16
+ declare const NOTIFICATION_SERVICE_BINDINGS: {
17
+ readonly SECRETS_STORE: {
18
+ readonly kind: "service";
19
+ readonly target: "secrets-store";
20
+ };
21
+ readonly RECEIVED_EMAILS_KV: {
22
+ readonly kind: "kv";
23
+ readonly suffix: "received-emails";
24
+ };
25
+ readonly NOTIFICATIONS_QUEUE: {
26
+ readonly kind: "queueProducer";
27
+ readonly suffix: "notifications";
28
+ };
29
+ readonly AUDIT_LOGS_QUEUE: {
30
+ readonly kind: "queueProducer";
31
+ readonly suffix: "audit-logs";
32
+ };
33
+ };
34
+ declare const NOTIFICATION_SERVICE_QUEUE_CONSUMERS: readonly [{
35
+ readonly suffix: "notifications";
36
+ readonly maxBatchSize: 1;
37
+ readonly maxBatchTimeout: 5;
38
+ readonly deadLetterQueueSuffix: "notifications-dlq";
39
+ }];
40
+ declare const notificationServiceConfig: (project: string, version: string, options?: _develit_io_platform_sdk.ServiceConfigOptions<NotificationServiceVariables, _develit_io_platform_sdk.MiniflareIds<{
41
+ readonly SECRETS_STORE: {
42
+ readonly kind: "service";
43
+ readonly target: "secrets-store";
44
+ };
45
+ readonly RECEIVED_EMAILS_KV: {
46
+ readonly kind: "kv";
47
+ readonly suffix: "received-emails";
48
+ };
49
+ readonly NOTIFICATIONS_QUEUE: {
50
+ readonly kind: "queueProducer";
51
+ readonly suffix: "notifications";
52
+ };
53
+ readonly AUDIT_LOGS_QUEUE: {
54
+ readonly kind: "queueProducer";
55
+ readonly suffix: "audit-logs";
56
+ };
57
+ }>> | undefined) => _develit_io_platform_sdk.ServiceConfigWithBindings<NotificationServiceVariables, {
58
+ readonly SECRETS_STORE: {
59
+ readonly kind: "service";
60
+ readonly target: "secrets-store";
61
+ };
62
+ readonly RECEIVED_EMAILS_KV: {
63
+ readonly kind: "kv";
64
+ readonly suffix: "received-emails";
65
+ };
66
+ readonly NOTIFICATIONS_QUEUE: {
67
+ readonly kind: "queueProducer";
68
+ readonly suffix: "notifications";
69
+ };
70
+ readonly AUDIT_LOGS_QUEUE: {
71
+ readonly kind: "queueProducer";
72
+ readonly suffix: "audit-logs";
73
+ };
74
+ }, readonly [{
75
+ readonly suffix: "notifications";
76
+ readonly maxBatchSize: 1;
77
+ readonly maxBatchTimeout: 5;
78
+ readonly deadLetterQueueSuffix: "notifications-dlq";
79
+ }]>;
80
+ declare function notificationService(config: ReturnType<typeof notificationServiceConfig>, deployment: Deployment, bindings: BindingsFromDescriptor<typeof NOTIFICATION_SERVICE_BINDINGS>): {
81
+ resourceName: "notification";
82
+ variables: NotificationServiceVariables;
83
+ bindings: BindingsFromDescriptor<{
84
+ readonly SECRETS_STORE: {
85
+ readonly kind: "service";
86
+ readonly target: "secrets-store";
87
+ };
88
+ readonly RECEIVED_EMAILS_KV: {
89
+ readonly kind: "kv";
90
+ readonly suffix: "received-emails";
91
+ };
92
+ readonly NOTIFICATIONS_QUEUE: {
93
+ readonly kind: "queueProducer";
94
+ readonly suffix: "notifications";
95
+ };
96
+ readonly AUDIT_LOGS_QUEUE: {
97
+ readonly kind: "queueProducer";
98
+ readonly suffix: "audit-logs";
99
+ };
100
+ }>;
101
+ crons: string[];
102
+ };
103
+
104
+ export { NOTIFICATION_SERVICE_BINDINGS, NOTIFICATION_SERVICE_QUEUE_CONSUMERS, notificationService, notificationServiceConfig };
105
+ export type { NotificationServiceVariables };
@@ -0,0 +1,105 @@
1
+ import * as _develit_io_platform_sdk from '@develit-io/platform-sdk';
2
+ import { Deployment } from '@develit-io/platform-sdk';
3
+ import { BindingsFromDescriptor } from '@develit-io/platform-sdk/service-config';
4
+
5
+ interface NotificationServiceVariables {
6
+ EMAIL_PROVIDER: string;
7
+ EMAIL_SENDER_EMAIL: string;
8
+ EMAIL_SENDER_NAME: string;
9
+ EMAIL_SMTP_HOST: string;
10
+ SMS_PROVIDER: string;
11
+ SLACK_WEBHOOK: string;
12
+ EMAIL_WHITELIST: string;
13
+ EMAIL_WHITELIST_FALLBACK: string;
14
+ [key: string]: string | number | boolean;
15
+ }
16
+ declare const NOTIFICATION_SERVICE_BINDINGS: {
17
+ readonly SECRETS_STORE: {
18
+ readonly kind: "service";
19
+ readonly target: "secrets-store";
20
+ };
21
+ readonly RECEIVED_EMAILS_KV: {
22
+ readonly kind: "kv";
23
+ readonly suffix: "received-emails";
24
+ };
25
+ readonly NOTIFICATIONS_QUEUE: {
26
+ readonly kind: "queueProducer";
27
+ readonly suffix: "notifications";
28
+ };
29
+ readonly AUDIT_LOGS_QUEUE: {
30
+ readonly kind: "queueProducer";
31
+ readonly suffix: "audit-logs";
32
+ };
33
+ };
34
+ declare const NOTIFICATION_SERVICE_QUEUE_CONSUMERS: readonly [{
35
+ readonly suffix: "notifications";
36
+ readonly maxBatchSize: 1;
37
+ readonly maxBatchTimeout: 5;
38
+ readonly deadLetterQueueSuffix: "notifications-dlq";
39
+ }];
40
+ declare const notificationServiceConfig: (project: string, version: string, options?: _develit_io_platform_sdk.ServiceConfigOptions<NotificationServiceVariables, _develit_io_platform_sdk.MiniflareIds<{
41
+ readonly SECRETS_STORE: {
42
+ readonly kind: "service";
43
+ readonly target: "secrets-store";
44
+ };
45
+ readonly RECEIVED_EMAILS_KV: {
46
+ readonly kind: "kv";
47
+ readonly suffix: "received-emails";
48
+ };
49
+ readonly NOTIFICATIONS_QUEUE: {
50
+ readonly kind: "queueProducer";
51
+ readonly suffix: "notifications";
52
+ };
53
+ readonly AUDIT_LOGS_QUEUE: {
54
+ readonly kind: "queueProducer";
55
+ readonly suffix: "audit-logs";
56
+ };
57
+ }>> | undefined) => _develit_io_platform_sdk.ServiceConfigWithBindings<NotificationServiceVariables, {
58
+ readonly SECRETS_STORE: {
59
+ readonly kind: "service";
60
+ readonly target: "secrets-store";
61
+ };
62
+ readonly RECEIVED_EMAILS_KV: {
63
+ readonly kind: "kv";
64
+ readonly suffix: "received-emails";
65
+ };
66
+ readonly NOTIFICATIONS_QUEUE: {
67
+ readonly kind: "queueProducer";
68
+ readonly suffix: "notifications";
69
+ };
70
+ readonly AUDIT_LOGS_QUEUE: {
71
+ readonly kind: "queueProducer";
72
+ readonly suffix: "audit-logs";
73
+ };
74
+ }, readonly [{
75
+ readonly suffix: "notifications";
76
+ readonly maxBatchSize: 1;
77
+ readonly maxBatchTimeout: 5;
78
+ readonly deadLetterQueueSuffix: "notifications-dlq";
79
+ }]>;
80
+ declare function notificationService(config: ReturnType<typeof notificationServiceConfig>, deployment: Deployment, bindings: BindingsFromDescriptor<typeof NOTIFICATION_SERVICE_BINDINGS>): {
81
+ resourceName: "notification";
82
+ variables: NotificationServiceVariables;
83
+ bindings: BindingsFromDescriptor<{
84
+ readonly SECRETS_STORE: {
85
+ readonly kind: "service";
86
+ readonly target: "secrets-store";
87
+ };
88
+ readonly RECEIVED_EMAILS_KV: {
89
+ readonly kind: "kv";
90
+ readonly suffix: "received-emails";
91
+ };
92
+ readonly NOTIFICATIONS_QUEUE: {
93
+ readonly kind: "queueProducer";
94
+ readonly suffix: "notifications";
95
+ };
96
+ readonly AUDIT_LOGS_QUEUE: {
97
+ readonly kind: "queueProducer";
98
+ readonly suffix: "audit-logs";
99
+ };
100
+ }>;
101
+ crons: string[];
102
+ };
103
+
104
+ export { NOTIFICATION_SERVICE_BINDINGS, NOTIFICATION_SERVICE_QUEUE_CONSUMERS, notificationService, notificationServiceConfig };
105
+ export type { NotificationServiceVariables };
@@ -0,0 +1,30 @@
1
+ import { createTypedServiceConfigFactory } from '@develit-io/platform-sdk/service-config';
2
+
3
+ const NOTIFICATION_SERVICE_BINDINGS = {
4
+ SECRETS_STORE: { kind: "service", target: "secrets-store" },
5
+ RECEIVED_EMAILS_KV: { kind: "kv", suffix: "received-emails" },
6
+ NOTIFICATIONS_QUEUE: { kind: "queueProducer", suffix: "notifications" },
7
+ AUDIT_LOGS_QUEUE: { kind: "queueProducer", suffix: "audit-logs" }
8
+ };
9
+ const NOTIFICATION_SERVICE_QUEUE_CONSUMERS = [
10
+ {
11
+ suffix: "notifications",
12
+ maxBatchSize: 1,
13
+ maxBatchTimeout: 5,
14
+ deadLetterQueueSuffix: "notifications-dlq"
15
+ }
16
+ ];
17
+ const notificationServiceConfig = createTypedServiceConfigFactory()(
18
+ NOTIFICATION_SERVICE_BINDINGS,
19
+ NOTIFICATION_SERVICE_QUEUE_CONSUMERS
20
+ );
21
+ function notificationService(config, deployment, bindings) {
22
+ return {
23
+ resourceName: "notification",
24
+ variables: config.vars[deployment.environment],
25
+ bindings,
26
+ crons: config.triggers.crons[deployment.environment]
27
+ };
28
+ }
29
+
30
+ export { NOTIFICATION_SERVICE_BINDINGS, NOTIFICATION_SERVICE_QUEUE_CONSUMERS, notificationService, notificationServiceConfig };
package/dist/types.d.cts CHANGED
@@ -1,7 +1,6 @@
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.CpJOS747.cjs';
5
4
  import 'zod';
6
5
  import 'zod/v4';
7
6
 
package/dist/types.d.mts CHANGED
@@ -1,7 +1,6 @@
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.CpJOS747.mjs';
5
4
  import 'zod';
6
5
  import 'zod/v4';
7
6
 
package/dist/types.d.ts CHANGED
@@ -1,7 +1,6 @@
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.CpJOS747.js';
5
4
  import 'zod';
6
5
  import 'zod/v4';
7
6
 
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@develit-services/notification",
3
- "version": "3.0.0",
3
+ "version": "5.0.0",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {
7
- "./wrangler": {
8
- "types": "./dist/export/wrangler.d.ts",
9
- "import": "./dist/export/wrangler.mjs",
10
- "require": "./dist/export/wrangler.cjs"
11
- },
12
- "./worker": {
13
- "types": "./dist/export/worker.d.ts",
14
- "import": "./dist/export/worker.mjs",
15
- "require": "./dist/export/worker.cjs"
7
+ "./base": {
8
+ "types": "./dist/base.d.ts",
9
+ "import": "./dist/base.mjs",
10
+ "require": "./dist/base.cjs"
16
11
  },
17
12
  "./@types": {
18
13
  "types": "./dist/types.d.ts",
19
14
  "import": "./dist/types.mjs",
20
15
  "require": "./dist/types.cjs"
21
16
  },
22
- "./package.json": "./package.json"
17
+ "./package.json": "./package.json",
18
+ "./service": {
19
+ "types": "./dist/service.d.ts",
20
+ "import": "./dist/service.mjs",
21
+ "require": "./dist/service.cjs"
22
+ }
23
23
  },
24
24
  "files": [
25
25
  "./dist"
@@ -41,6 +41,7 @@
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@develit-io/backend-sdk": "^11.0.2",
44
- "zod": "^4.1.13"
44
+ "zod": "^4.1.13",
45
+ "@develit-io/platform-sdk": "^4.1.1"
45
46
  }
46
47
  }
@@ -1,73 +0,0 @@
1
- 'use strict';
2
-
3
- const backendSdk = require('@develit-io/backend-sdk');
4
-
5
- function defineNotificationServiceWrangler(config) {
6
- const { project, name, envs } = config;
7
- const base = {
8
- ...backendSdk.composeWranglerBase({
9
- project,
10
- name
11
- }),
12
- vars: {
13
- ...envs.local.customVars,
14
- ...envs.local.vars,
15
- ENVIRONMENT: "localhost"
16
- },
17
- services: [
18
- {
19
- binding: "SECRETS_STORE",
20
- service: `${project}-secrets-store`
21
- }
22
- ],
23
- kv_namespaces: envs.local.kv ? [
24
- {
25
- binding: "RECEIVED_EMAILS_KV",
26
- id: envs.local.kv.id
27
- }
28
- ] : [],
29
- queues: {
30
- producers: [
31
- {
32
- binding: "NOTIFICATIONS_QUEUE",
33
- queue: `${project}-notifications`
34
- },
35
- {
36
- binding: "AUDIT_LOGS_QUEUE",
37
- queue: `${project}-audit-logs`
38
- }
39
- ],
40
- consumers: [
41
- {
42
- queue: `${project}-notifications`,
43
- max_batch_size: 1,
44
- max_batch_timeout: 5,
45
- dead_letter_queue: `${project}-notifications-dlq`
46
- }
47
- ]
48
- },
49
- env: {}
50
- };
51
- for (const [envName, envCfg] of Object.entries(envs).filter(
52
- ([key]) => key !== "local"
53
- )) {
54
- base.env[envName] = {
55
- vars: {
56
- ...envCfg.customVars,
57
- ...envCfg.vars,
58
- ENVIRONMENT: envName
59
- },
60
- ...envCfg.kv && {
61
- kv_namespaces: [
62
- {
63
- binding: "RECEIVED_EMAILS_KV",
64
- id: envCfg.kv.id
65
- }
66
- ]
67
- }
68
- };
69
- }
70
- return base;
71
- }
72
-
73
- exports.defineNotificationServiceWrangler = defineNotificationServiceWrangler;
@@ -1,53 +0,0 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.CpJOS747.cjs';
2
-
3
- declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
4
- vars: {
5
- ENVIRONMENT: string;
6
- EMAIL_PROVIDER: "ecomail";
7
- EMAIL_SENDER_EMAIL: string;
8
- EMAIL_SENDER_NAME: string;
9
- EMAIL_SMTP_HOST: string;
10
- SMS_PROVIDER: "twilio";
11
- SLACK_WEBHOOK: string;
12
- EMAIL_WHITELIST?: string;
13
- EMAIL_WHITELIST_FALLBACK?: string;
14
- };
15
- services: {
16
- binding: string;
17
- service: string;
18
- }[];
19
- kv_namespaces: {
20
- binding: string;
21
- id: string;
22
- }[];
23
- queues: {
24
- producers: {
25
- binding: string;
26
- queue: string;
27
- }[];
28
- consumers: {
29
- queue: string;
30
- max_batch_size: number;
31
- max_batch_timeout: number;
32
- dead_letter_queue: string;
33
- }[];
34
- };
35
- env: Record<string, unknown>;
36
- $schema: string;
37
- name: string;
38
- main: string;
39
- compatibility_date: string;
40
- compatibility_flags: string[];
41
- observability: {
42
- enabled: boolean;
43
- head_sampling_rate: number;
44
- logs: {
45
- enabled: boolean;
46
- invocation_logs: boolean;
47
- };
48
- };
49
- workers_dev: boolean;
50
- keep_vars: boolean;
51
- };
52
-
53
- export { defineNotificationServiceWrangler };
@@ -1,53 +0,0 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.CpJOS747.mjs';
2
-
3
- declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
4
- vars: {
5
- ENVIRONMENT: string;
6
- EMAIL_PROVIDER: "ecomail";
7
- EMAIL_SENDER_EMAIL: string;
8
- EMAIL_SENDER_NAME: string;
9
- EMAIL_SMTP_HOST: string;
10
- SMS_PROVIDER: "twilio";
11
- SLACK_WEBHOOK: string;
12
- EMAIL_WHITELIST?: string;
13
- EMAIL_WHITELIST_FALLBACK?: string;
14
- };
15
- services: {
16
- binding: string;
17
- service: string;
18
- }[];
19
- kv_namespaces: {
20
- binding: string;
21
- id: string;
22
- }[];
23
- queues: {
24
- producers: {
25
- binding: string;
26
- queue: string;
27
- }[];
28
- consumers: {
29
- queue: string;
30
- max_batch_size: number;
31
- max_batch_timeout: number;
32
- dead_letter_queue: string;
33
- }[];
34
- };
35
- env: Record<string, unknown>;
36
- $schema: string;
37
- name: string;
38
- main: string;
39
- compatibility_date: string;
40
- compatibility_flags: string[];
41
- observability: {
42
- enabled: boolean;
43
- head_sampling_rate: number;
44
- logs: {
45
- enabled: boolean;
46
- invocation_logs: boolean;
47
- };
48
- };
49
- workers_dev: boolean;
50
- keep_vars: boolean;
51
- };
52
-
53
- export { defineNotificationServiceWrangler };
@@ -1,53 +0,0 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.CpJOS747.js';
2
-
3
- declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
4
- vars: {
5
- ENVIRONMENT: string;
6
- EMAIL_PROVIDER: "ecomail";
7
- EMAIL_SENDER_EMAIL: string;
8
- EMAIL_SENDER_NAME: string;
9
- EMAIL_SMTP_HOST: string;
10
- SMS_PROVIDER: "twilio";
11
- SLACK_WEBHOOK: string;
12
- EMAIL_WHITELIST?: string;
13
- EMAIL_WHITELIST_FALLBACK?: string;
14
- };
15
- services: {
16
- binding: string;
17
- service: string;
18
- }[];
19
- kv_namespaces: {
20
- binding: string;
21
- id: string;
22
- }[];
23
- queues: {
24
- producers: {
25
- binding: string;
26
- queue: string;
27
- }[];
28
- consumers: {
29
- queue: string;
30
- max_batch_size: number;
31
- max_batch_timeout: number;
32
- dead_letter_queue: string;
33
- }[];
34
- };
35
- env: Record<string, unknown>;
36
- $schema: string;
37
- name: string;
38
- main: string;
39
- compatibility_date: string;
40
- compatibility_flags: string[];
41
- observability: {
42
- enabled: boolean;
43
- head_sampling_rate: number;
44
- logs: {
45
- enabled: boolean;
46
- invocation_logs: boolean;
47
- };
48
- };
49
- workers_dev: boolean;
50
- keep_vars: boolean;
51
- };
52
-
53
- export { defineNotificationServiceWrangler };
@@ -1,71 +0,0 @@
1
- import { composeWranglerBase } from '@develit-io/backend-sdk';
2
-
3
- function defineNotificationServiceWrangler(config) {
4
- const { project, name, envs } = config;
5
- const base = {
6
- ...composeWranglerBase({
7
- project,
8
- name
9
- }),
10
- vars: {
11
- ...envs.local.customVars,
12
- ...envs.local.vars,
13
- ENVIRONMENT: "localhost"
14
- },
15
- services: [
16
- {
17
- binding: "SECRETS_STORE",
18
- service: `${project}-secrets-store`
19
- }
20
- ],
21
- kv_namespaces: envs.local.kv ? [
22
- {
23
- binding: "RECEIVED_EMAILS_KV",
24
- id: envs.local.kv.id
25
- }
26
- ] : [],
27
- queues: {
28
- producers: [
29
- {
30
- binding: "NOTIFICATIONS_QUEUE",
31
- queue: `${project}-notifications`
32
- },
33
- {
34
- binding: "AUDIT_LOGS_QUEUE",
35
- queue: `${project}-audit-logs`
36
- }
37
- ],
38
- consumers: [
39
- {
40
- queue: `${project}-notifications`,
41
- max_batch_size: 1,
42
- max_batch_timeout: 5,
43
- dead_letter_queue: `${project}-notifications-dlq`
44
- }
45
- ]
46
- },
47
- env: {}
48
- };
49
- for (const [envName, envCfg] of Object.entries(envs).filter(
50
- ([key]) => key !== "local"
51
- )) {
52
- base.env[envName] = {
53
- vars: {
54
- ...envCfg.customVars,
55
- ...envCfg.vars,
56
- ENVIRONMENT: envName
57
- },
58
- ...envCfg.kv && {
59
- kv_namespaces: [
60
- {
61
- binding: "RECEIVED_EMAILS_KV",
62
- id: envCfg.kv.id
63
- }
64
- ]
65
- }
66
- };
67
- }
68
- return base;
69
- }
70
-
71
- export { defineNotificationServiceWrangler };
@@ -1,32 +0,0 @@
1
- interface NotificationServiceEnvironmentConfig {
2
- queue?: {
3
- max_batch_size?: number;
4
- max_batch_timeout?: number;
5
- };
6
- kv?: {
7
- id: string;
8
- };
9
- vars: {
10
- EMAIL_PROVIDER: 'ecomail';
11
- EMAIL_SENDER_EMAIL: string;
12
- EMAIL_SENDER_NAME: string;
13
- EMAIL_SMTP_HOST: string;
14
- SMS_PROVIDER: 'twilio';
15
- SLACK_WEBHOOK: string;
16
- EMAIL_WHITELIST?: string;
17
- EMAIL_WHITELIST_FALLBACK?: string;
18
- };
19
- customVars?: Record<string, string>;
20
- }
21
- interface NotificationServiceWranglerConfig {
22
- project: string;
23
- name: string;
24
- envs: {
25
- local: NotificationServiceEnvironmentConfig;
26
- [key: string]: NotificationServiceEnvironmentConfig;
27
- };
28
- }
29
- interface NotificationServiceEnv extends NotificationEnv {
30
- }
31
-
32
- export type { NotificationServiceWranglerConfig as N, NotificationServiceEnv as a, NotificationServiceEnvironmentConfig as b };
@@ -1,32 +0,0 @@
1
- interface NotificationServiceEnvironmentConfig {
2
- queue?: {
3
- max_batch_size?: number;
4
- max_batch_timeout?: number;
5
- };
6
- kv?: {
7
- id: string;
8
- };
9
- vars: {
10
- EMAIL_PROVIDER: 'ecomail';
11
- EMAIL_SENDER_EMAIL: string;
12
- EMAIL_SENDER_NAME: string;
13
- EMAIL_SMTP_HOST: string;
14
- SMS_PROVIDER: 'twilio';
15
- SLACK_WEBHOOK: string;
16
- EMAIL_WHITELIST?: string;
17
- EMAIL_WHITELIST_FALLBACK?: string;
18
- };
19
- customVars?: Record<string, string>;
20
- }
21
- interface NotificationServiceWranglerConfig {
22
- project: string;
23
- name: string;
24
- envs: {
25
- local: NotificationServiceEnvironmentConfig;
26
- [key: string]: NotificationServiceEnvironmentConfig;
27
- };
28
- }
29
- interface NotificationServiceEnv extends NotificationEnv {
30
- }
31
-
32
- export type { NotificationServiceWranglerConfig as N, NotificationServiceEnv as a, NotificationServiceEnvironmentConfig as b };
@@ -1,32 +0,0 @@
1
- interface NotificationServiceEnvironmentConfig {
2
- queue?: {
3
- max_batch_size?: number;
4
- max_batch_timeout?: number;
5
- };
6
- kv?: {
7
- id: string;
8
- };
9
- vars: {
10
- EMAIL_PROVIDER: 'ecomail';
11
- EMAIL_SENDER_EMAIL: string;
12
- EMAIL_SENDER_NAME: string;
13
- EMAIL_SMTP_HOST: string;
14
- SMS_PROVIDER: 'twilio';
15
- SLACK_WEBHOOK: string;
16
- EMAIL_WHITELIST?: string;
17
- EMAIL_WHITELIST_FALLBACK?: string;
18
- };
19
- customVars?: Record<string, string>;
20
- }
21
- interface NotificationServiceWranglerConfig {
22
- project: string;
23
- name: string;
24
- envs: {
25
- local: NotificationServiceEnvironmentConfig;
26
- [key: string]: NotificationServiceEnvironmentConfig;
27
- };
28
- }
29
- interface NotificationServiceEnv extends NotificationEnv {
30
- }
31
-
32
- export type { NotificationServiceWranglerConfig as N, NotificationServiceEnv as a, NotificationServiceEnvironmentConfig as b };