@bymax-one/nest-notification 1.4.9 → 1.4.11

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.
@@ -28,8 +28,10 @@ var NOTIFICATION_ERROR_CODES = {
28
28
  AUDIT_LOG_FAILED: "notification.audit_log_failed",
29
29
  CHANNEL_DISABLED: "notification.channel_disabled",
30
30
  /**
31
- * A `tenantId` or `recipient` that identifies nobody reached a scoping
32
- * boundary — empty, whitespace-only, or not a string at all. Distinct from
31
+ * A `tenantId`, `recipient` or `purpose` that cannot scope an OTP reached a
32
+ * scoping boundary: empty, whitespace-only, not a string at all, carrying a
33
+ * control character, or, for a purpose, longer than 64 characters or made of
34
+ * anything but `A-Z a-z 0-9 : _ -`. Distinct from
33
35
  * {@link EMAIL_INVALID_RECIPIENT}, which is about a malformed address rather
34
36
  * than a value that cannot scope anything.
35
37
  */
@@ -104,8 +104,10 @@ declare const NOTIFICATION_ERROR_CODES: {
104
104
  readonly AUDIT_LOG_FAILED: "notification.audit_log_failed";
105
105
  readonly CHANNEL_DISABLED: "notification.channel_disabled";
106
106
  /**
107
- * A `tenantId` or `recipient` that identifies nobody reached a scoping
108
- * boundary — empty, whitespace-only, or not a string at all. Distinct from
107
+ * A `tenantId`, `recipient` or `purpose` that cannot scope an OTP reached a
108
+ * scoping boundary: empty, whitespace-only, not a string at all, carrying a
109
+ * control character, or, for a purpose, longer than 64 characters or made of
110
+ * anything but `A-Z a-z 0-9 : _ -`. Distinct from
109
111
  * {@link EMAIL_INVALID_RECIPIENT}, which is about a malformed address rather
110
112
  * than a value that cannot scope anything.
111
113
  */
@@ -104,8 +104,10 @@ declare const NOTIFICATION_ERROR_CODES: {
104
104
  readonly AUDIT_LOG_FAILED: "notification.audit_log_failed";
105
105
  readonly CHANNEL_DISABLED: "notification.channel_disabled";
106
106
  /**
107
- * A `tenantId` or `recipient` that identifies nobody reached a scoping
108
- * boundary — empty, whitespace-only, or not a string at all. Distinct from
107
+ * A `tenantId`, `recipient` or `purpose` that cannot scope an OTP reached a
108
+ * scoping boundary: empty, whitespace-only, not a string at all, carrying a
109
+ * control character, or, for a purpose, longer than 64 characters or made of
110
+ * anything but `A-Z a-z 0-9 : _ -`. Distinct from
109
111
  * {@link EMAIL_INVALID_RECIPIENT}, which is about a malformed address rather
110
112
  * than a value that cannot scope anything.
111
113
  */
@@ -26,8 +26,10 @@ var NOTIFICATION_ERROR_CODES = {
26
26
  AUDIT_LOG_FAILED: "notification.audit_log_failed",
27
27
  CHANNEL_DISABLED: "notification.channel_disabled",
28
28
  /**
29
- * A `tenantId` or `recipient` that identifies nobody reached a scoping
30
- * boundary — empty, whitespace-only, or not a string at all. Distinct from
29
+ * A `tenantId`, `recipient` or `purpose` that cannot scope an OTP reached a
30
+ * scoping boundary: empty, whitespace-only, not a string at all, carrying a
31
+ * control character, or, for a purpose, longer than 64 characters or made of
32
+ * anything but `A-Z a-z 0-9 : _ -`. Distinct from
31
33
  * {@link EMAIL_INVALID_RECIPIENT}, which is about a malformed address rather
32
34
  * than a value that cannot scope anything.
33
35
  */
@@ -284,13 +284,14 @@ var ANY_CODE = "111111";
284
284
  var OTHER_CODE = "222222";
285
285
  function makeScope() {
286
286
  const run = crypto.randomUUID();
287
+ const purposeRun = run.replaceAll("-", "").slice(0, 12);
287
288
  return {
288
289
  tenantA: `${KEY_PREFIX}_${run}_${TENANT_A}`,
289
290
  tenantB: `${KEY_PREFIX}_${run}_${TENANT_B}`,
290
291
  recipient: `${run}_${RECIPIENT_LOCAL}`,
291
292
  absentRecipient: `${run}_${ABSENT_LOCAL}`,
292
- purpose: `${KEY_PREFIX}_${run}_${PURPOSE_MAIN}`,
293
- otherPurpose: `${KEY_PREFIX}_${run}_${PURPOSE_OTHER}`,
293
+ purpose: `${KEY_PREFIX}_${purposeRun}_${PURPOSE_MAIN}`,
294
+ otherPurpose: `${KEY_PREFIX}_${purposeRun}_${PURPOSE_OTHER}`,
294
295
  // Same characters, two different (tenant, recipient) splits. A key built by
295
296
  // joining the raw values around `:` maps both onto one string, and so does one
296
297
  // built around `::`, which the single-colon pair alone does not expose.
@@ -282,13 +282,14 @@ var ANY_CODE = "111111";
282
282
  var OTHER_CODE = "222222";
283
283
  function makeScope() {
284
284
  const run = randomUUID();
285
+ const purposeRun = run.replaceAll("-", "").slice(0, 12);
285
286
  return {
286
287
  tenantA: `${KEY_PREFIX}_${run}_${TENANT_A}`,
287
288
  tenantB: `${KEY_PREFIX}_${run}_${TENANT_B}`,
288
289
  recipient: `${run}_${RECIPIENT_LOCAL}`,
289
290
  absentRecipient: `${run}_${ABSENT_LOCAL}`,
290
- purpose: `${KEY_PREFIX}_${run}_${PURPOSE_MAIN}`,
291
- otherPurpose: `${KEY_PREFIX}_${run}_${PURPOSE_OTHER}`,
291
+ purpose: `${KEY_PREFIX}_${purposeRun}_${PURPOSE_MAIN}`,
292
+ otherPurpose: `${KEY_PREFIX}_${purposeRun}_${PURPOSE_OTHER}`,
292
293
  // Same characters, two different (tenant, recipient) splits. A key built by
293
294
  // joining the raw values around `:` maps both onto one string, and so does one
294
295
  // built around `::`, which the single-colon pair alone does not expose.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bymax-one/nest-notification",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "description": "Multi-channel notification library for NestJS — email, OTP, SMS, push — with pluggable providers and storage, multi-tenant by design, zero runtime dependencies.",
5
5
  "author": "Bymax One <support@bymax.one>",
6
6
  "license": "MIT",