@develit-services/notification 2.1.0 → 4.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.
package/README.md CHANGED
@@ -114,15 +114,17 @@ Kazdy webhook je automaticky podepsan RSA-PKCS1-v1_5 (SHA-256) podpisem. Privatn
114
114
 
115
115
  #### Generovani klicu
116
116
 
117
+ Privatni klic musi byt ve formatu **base64(PKCS8 DER)** — `crypto.subtle.importKey('pkcs8', ...)` nepracuje s PEM ani s PKCS1. Nasledujici jednorazovy skript vygeneruje oba klice naraz (funguje na Linuxu i macOS, bash i zsh):
118
+
117
119
  ```bash
118
- # Private key (base64, jedna radka) ulozit do Secrets Store jako NOTIFICATION_SERVICE_WEBHOOK_SIGNING_KEY
119
- openssl genrsa 4096 2>/dev/null | base64 -w0
120
+ PRIVATE_KEY=$(openssl genrsa 4096 2>/dev/null | openssl pkcs8 -topk8 -nocrypt -outform DER 2>/dev/null | base64 | tr -d '\n')
121
+ PUBLIC_KEY=$(echo "$PRIVATE_KEY" | base64 -d | openssl rsa -inform DER -pubout 2>/dev/null | base64 | tr -d '\n')
120
122
 
121
- # Public key z private key → poskytnout prijemcum webhooku v API docs
122
- echo "<PRIVATE_KEY_BASE64>" | base64 -d | openssl rsa -pubout 2>/dev/null | base64 -w0
123
+ printf 'NOTIFICATION_SERVICE_WEBHOOK_SIGNING_KEY (ulozit do Secrets Store):\n%s\n\n' "$PRIVATE_KEY"
124
+ printf 'Public key (poskytnout prijemcum webhooku):\n%s\n' "$PUBLIC_KEY"
123
125
  ```
124
126
 
125
- > Na macOS pouzit `base64` bez `-w0` (macOS verze nevypisuje newlines).
127
+ > Rychla kontrola: base64 PKCS8 klic vzdy zacina na `MII...QIBADAN` (ASN.1 SEQUENCE + version 0 + rsaEncryption OID). Pokud zacina na `Ls`, je to omylem zakodovany PEM text — importKey spadne na `Invalid PKCS8 input`.
126
128
 
127
129
  #### Overeni podpisu na strane prijemce
128
130
 
@@ -3,16 +3,15 @@
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
4
 
5
5
  function defineNotificationServiceWrangler(config) {
6
- const { project, name, envs } = config;
6
+ const { project, name, vars, kv } = config;
7
7
  const base = {
8
8
  ...backendSdk.composeWranglerBase({
9
9
  project,
10
10
  name
11
11
  }),
12
12
  vars: {
13
- ...envs.local.customVars,
14
- ...envs.local.vars,
15
- ENVIRONMENT: "localhost"
13
+ ENVIRONMENT: "localhost",
14
+ ...vars
16
15
  },
17
16
  services: [
18
17
  {
@@ -20,10 +19,10 @@ function defineNotificationServiceWrangler(config) {
20
19
  service: `${project}-secrets-store`
21
20
  }
22
21
  ],
23
- kv_namespaces: envs.local.kv ? [
22
+ kv_namespaces: kv ? [
24
23
  {
25
24
  binding: "RECEIVED_EMAILS_KV",
26
- id: envs.local.kv.id
25
+ id: kv.id
27
26
  }
28
27
  ] : [],
29
28
  queues: {
@@ -45,28 +44,8 @@ function defineNotificationServiceWrangler(config) {
45
44
  dead_letter_queue: `${project}-notifications-dlq`
46
45
  }
47
46
  ]
48
- },
49
- env: {}
47
+ }
50
48
  };
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
49
  return base;
71
50
  }
72
51
 
@@ -1,8 +1,8 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.CpJOS747.cjs';
1
+ import { N as NotificationServiceWranglerConfig } from '../shared/notification.DW8VtyNo.cjs';
2
2
 
3
3
  declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
4
4
  vars: {
5
- ENVIRONMENT: string;
5
+ VERSION: string;
6
6
  EMAIL_PROVIDER: "ecomail";
7
7
  EMAIL_SENDER_EMAIL: string;
8
8
  EMAIL_SENDER_NAME: string;
@@ -11,6 +11,7 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
11
11
  SLACK_WEBHOOK: string;
12
12
  EMAIL_WHITELIST?: string;
13
13
  EMAIL_WHITELIST_FALLBACK?: string;
14
+ ENVIRONMENT: string;
14
15
  };
15
16
  services: {
16
17
  binding: string;
@@ -32,7 +33,6 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
32
33
  dead_letter_queue: string;
33
34
  }[];
34
35
  };
35
- env: Record<string, unknown>;
36
36
  $schema: string;
37
37
  name: string;
38
38
  main: string;
@@ -1,8 +1,8 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.CpJOS747.mjs';
1
+ import { N as NotificationServiceWranglerConfig } from '../shared/notification.DW8VtyNo.mjs';
2
2
 
3
3
  declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
4
4
  vars: {
5
- ENVIRONMENT: string;
5
+ VERSION: string;
6
6
  EMAIL_PROVIDER: "ecomail";
7
7
  EMAIL_SENDER_EMAIL: string;
8
8
  EMAIL_SENDER_NAME: string;
@@ -11,6 +11,7 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
11
11
  SLACK_WEBHOOK: string;
12
12
  EMAIL_WHITELIST?: string;
13
13
  EMAIL_WHITELIST_FALLBACK?: string;
14
+ ENVIRONMENT: string;
14
15
  };
15
16
  services: {
16
17
  binding: string;
@@ -32,7 +33,6 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
32
33
  dead_letter_queue: string;
33
34
  }[];
34
35
  };
35
- env: Record<string, unknown>;
36
36
  $schema: string;
37
37
  name: string;
38
38
  main: string;
@@ -1,8 +1,8 @@
1
- import { N as NotificationServiceWranglerConfig } from '../shared/notification.CpJOS747.js';
1
+ import { N as NotificationServiceWranglerConfig } from '../shared/notification.DW8VtyNo.js';
2
2
 
3
3
  declare function defineNotificationServiceWrangler(config: NotificationServiceWranglerConfig): {
4
4
  vars: {
5
- ENVIRONMENT: string;
5
+ VERSION: string;
6
6
  EMAIL_PROVIDER: "ecomail";
7
7
  EMAIL_SENDER_EMAIL: string;
8
8
  EMAIL_SENDER_NAME: string;
@@ -11,6 +11,7 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
11
11
  SLACK_WEBHOOK: string;
12
12
  EMAIL_WHITELIST?: string;
13
13
  EMAIL_WHITELIST_FALLBACK?: string;
14
+ ENVIRONMENT: string;
14
15
  };
15
16
  services: {
16
17
  binding: string;
@@ -32,7 +33,6 @@ declare function defineNotificationServiceWrangler(config: NotificationServiceWr
32
33
  dead_letter_queue: string;
33
34
  }[];
34
35
  };
35
- env: Record<string, unknown>;
36
36
  $schema: string;
37
37
  name: string;
38
38
  main: string;
@@ -1,16 +1,15 @@
1
1
  import { composeWranglerBase } from '@develit-io/backend-sdk';
2
2
 
3
3
  function defineNotificationServiceWrangler(config) {
4
- const { project, name, envs } = config;
4
+ const { project, name, vars, kv } = config;
5
5
  const base = {
6
6
  ...composeWranglerBase({
7
7
  project,
8
8
  name
9
9
  }),
10
10
  vars: {
11
- ...envs.local.customVars,
12
- ...envs.local.vars,
13
- ENVIRONMENT: "localhost"
11
+ ENVIRONMENT: "localhost",
12
+ ...vars
14
13
  },
15
14
  services: [
16
15
  {
@@ -18,10 +17,10 @@ function defineNotificationServiceWrangler(config) {
18
17
  service: `${project}-secrets-store`
19
18
  }
20
19
  ],
21
- kv_namespaces: envs.local.kv ? [
20
+ kv_namespaces: kv ? [
22
21
  {
23
22
  binding: "RECEIVED_EMAILS_KV",
24
- id: envs.local.kv.id
23
+ id: kv.id
25
24
  }
26
25
  ] : [],
27
26
  queues: {
@@ -43,28 +42,8 @@ function defineNotificationServiceWrangler(config) {
43
42
  dead_letter_queue: `${project}-notifications-dlq`
44
43
  }
45
44
  ]
46
- },
47
- env: {}
45
+ }
48
46
  };
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
47
  return base;
69
48
  }
70
49
 
@@ -1,12 +1,8 @@
1
- interface NotificationServiceEnvironmentConfig {
2
- queue?: {
3
- max_batch_size?: number;
4
- max_batch_timeout?: number;
5
- };
6
- kv?: {
7
- id: string;
8
- };
1
+ interface NotificationServiceWranglerConfig {
2
+ project: string;
3
+ name: string;
9
4
  vars: {
5
+ VERSION: string;
10
6
  EMAIL_PROVIDER: 'ecomail';
11
7
  EMAIL_SENDER_EMAIL: string;
12
8
  EMAIL_SENDER_NAME: string;
@@ -15,18 +11,13 @@ interface NotificationServiceEnvironmentConfig {
15
11
  SLACK_WEBHOOK: string;
16
12
  EMAIL_WHITELIST?: string;
17
13
  EMAIL_WHITELIST_FALLBACK?: string;
14
+ [key: string]: string | boolean | undefined;
18
15
  };
19
- customVars?: Record<string, string>;
20
- }
21
- interface NotificationServiceWranglerConfig {
22
- project: string;
23
- name: string;
24
- envs: {
25
- local: NotificationServiceEnvironmentConfig;
26
- [key: string]: NotificationServiceEnvironmentConfig;
16
+ kv?: {
17
+ id: string;
27
18
  };
28
19
  }
29
20
  interface NotificationServiceEnv extends NotificationEnv {
30
21
  }
31
22
 
32
- export type { NotificationServiceWranglerConfig as N, NotificationServiceEnv as a, NotificationServiceEnvironmentConfig as b };
23
+ export type { NotificationServiceWranglerConfig as N, NotificationServiceEnv as a };
@@ -1,12 +1,8 @@
1
- interface NotificationServiceEnvironmentConfig {
2
- queue?: {
3
- max_batch_size?: number;
4
- max_batch_timeout?: number;
5
- };
6
- kv?: {
7
- id: string;
8
- };
1
+ interface NotificationServiceWranglerConfig {
2
+ project: string;
3
+ name: string;
9
4
  vars: {
5
+ VERSION: string;
10
6
  EMAIL_PROVIDER: 'ecomail';
11
7
  EMAIL_SENDER_EMAIL: string;
12
8
  EMAIL_SENDER_NAME: string;
@@ -15,18 +11,13 @@ interface NotificationServiceEnvironmentConfig {
15
11
  SLACK_WEBHOOK: string;
16
12
  EMAIL_WHITELIST?: string;
17
13
  EMAIL_WHITELIST_FALLBACK?: string;
14
+ [key: string]: string | boolean | undefined;
18
15
  };
19
- customVars?: Record<string, string>;
20
- }
21
- interface NotificationServiceWranglerConfig {
22
- project: string;
23
- name: string;
24
- envs: {
25
- local: NotificationServiceEnvironmentConfig;
26
- [key: string]: NotificationServiceEnvironmentConfig;
16
+ kv?: {
17
+ id: string;
27
18
  };
28
19
  }
29
20
  interface NotificationServiceEnv extends NotificationEnv {
30
21
  }
31
22
 
32
- export type { NotificationServiceWranglerConfig as N, NotificationServiceEnv as a, NotificationServiceEnvironmentConfig as b };
23
+ export type { NotificationServiceWranglerConfig as N, NotificationServiceEnv as a };
@@ -1,12 +1,8 @@
1
- interface NotificationServiceEnvironmentConfig {
2
- queue?: {
3
- max_batch_size?: number;
4
- max_batch_timeout?: number;
5
- };
6
- kv?: {
7
- id: string;
8
- };
1
+ interface NotificationServiceWranglerConfig {
2
+ project: string;
3
+ name: string;
9
4
  vars: {
5
+ VERSION: string;
10
6
  EMAIL_PROVIDER: 'ecomail';
11
7
  EMAIL_SENDER_EMAIL: string;
12
8
  EMAIL_SENDER_NAME: string;
@@ -15,18 +11,13 @@ interface NotificationServiceEnvironmentConfig {
15
11
  SLACK_WEBHOOK: string;
16
12
  EMAIL_WHITELIST?: string;
17
13
  EMAIL_WHITELIST_FALLBACK?: string;
14
+ [key: string]: string | boolean | undefined;
18
15
  };
19
- customVars?: Record<string, string>;
20
- }
21
- interface NotificationServiceWranglerConfig {
22
- project: string;
23
- name: string;
24
- envs: {
25
- local: NotificationServiceEnvironmentConfig;
26
- [key: string]: NotificationServiceEnvironmentConfig;
16
+ kv?: {
17
+ id: string;
27
18
  };
28
19
  }
29
20
  interface NotificationServiceEnv extends NotificationEnv {
30
21
  }
31
22
 
32
- export type { NotificationServiceWranglerConfig as N, NotificationServiceEnv as a, NotificationServiceEnvironmentConfig as b };
23
+ export type { NotificationServiceWranglerConfig as N, NotificationServiceEnv as a };
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.CpJOS747.cjs';
4
+ export { a as NotificationServiceEnv, N as NotificationServiceWranglerConfig } from './shared/notification.DW8VtyNo.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.CpJOS747.mjs';
4
+ export { a as NotificationServiceEnv, N as NotificationServiceWranglerConfig } from './shared/notification.DW8VtyNo.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.CpJOS747.js';
4
+ export { a as NotificationServiceEnv, N as NotificationServiceWranglerConfig } from './shared/notification.DW8VtyNo.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": "2.1.0",
3
+ "version": "4.0.0",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -40,7 +40,7 @@
40
40
  "twilio": "^5.12.1"
41
41
  },
42
42
  "peerDependencies": {
43
- "@develit-io/backend-sdk": "^9.10.3",
43
+ "@develit-io/backend-sdk": "^11.0.2",
44
44
  "zod": "^4.1.13"
45
45
  }
46
46
  }