unified-notification-core 0.1.7 → 0.1.9
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/CHANGELOG.md +34 -1
- package/README.md +81 -20
- package/dist/cjs/context.d.ts +24 -0
- package/dist/cjs/context.d.ts.map +1 -0
- package/dist/cjs/context.js +167 -0
- package/dist/cjs/context.js.map +7 -0
- package/dist/cjs/contracts.d.ts +109 -0
- package/dist/cjs/contracts.d.ts.map +1 -0
- package/dist/cjs/contracts.js +20 -0
- package/dist/cjs/contracts.js.map +7 -0
- package/dist/cjs/core.d.ts +39 -0
- package/dist/cjs/core.d.ts.map +1 -0
- package/dist/cjs/core.js +156 -0
- package/dist/cjs/core.js.map +7 -0
- package/dist/cjs/delivery-admin.d.ts +13 -0
- package/dist/cjs/delivery-admin.d.ts.map +1 -0
- package/dist/cjs/delivery-admin.js +144 -0
- package/dist/cjs/delivery-admin.js.map +7 -0
- package/dist/cjs/delivery-executor.d.ts +15 -0
- package/dist/cjs/delivery-executor.d.ts.map +1 -0
- package/dist/cjs/delivery-executor.js +338 -0
- package/dist/cjs/delivery-executor.js.map +7 -0
- package/dist/cjs/delivery-store.d.ts +34 -0
- package/dist/cjs/delivery-store.d.ts.map +1 -0
- package/dist/cjs/delivery-store.js +526 -0
- package/dist/cjs/delivery-store.js.map +7 -0
- package/dist/cjs/dispatch-control.d.ts +36 -0
- package/dist/cjs/dispatch-control.d.ts.map +1 -0
- package/dist/cjs/dispatch-control.js +218 -0
- package/dist/cjs/dispatch-control.js.map +7 -0
- package/dist/cjs/dispatcher.d.ts +22 -0
- package/dist/cjs/dispatcher.d.ts.map +1 -0
- package/dist/cjs/dispatcher.js +327 -0
- package/dist/cjs/dispatcher.js.map +7 -0
- package/dist/cjs/errors.d.ts +25 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +193 -0
- package/dist/cjs/errors.js.map +7 -0
- package/dist/cjs/idempotency.d.ts +18 -0
- package/dist/cjs/idempotency.d.ts.map +1 -0
- package/dist/cjs/idempotency.js +69 -0
- package/dist/cjs/idempotency.js.map +7 -0
- package/dist/cjs/inbox.d.ts +24 -0
- package/dist/cjs/inbox.d.ts.map +1 -0
- package/dist/cjs/inbox.js +209 -0
- package/dist/cjs/inbox.js.map +7 -0
- package/dist/cjs/index.d.ts +12 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +63 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/json.d.ts +8 -0
- package/dist/cjs/json.d.ts.map +1 -0
- package/dist/cjs/json.js +265 -0
- package/dist/cjs/json.js.map +7 -0
- package/dist/cjs/keys.d.ts +10 -0
- package/dist/cjs/keys.d.ts.map +1 -0
- package/dist/cjs/keys.js +126 -0
- package/dist/cjs/keys.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/preference-store.d.ts +19 -0
- package/dist/cjs/preference-store.d.ts.map +1 -0
- package/dist/cjs/preference-store.js +247 -0
- package/dist/cjs/preference-store.js.map +7 -0
- package/dist/cjs/preferences.d.ts +23 -0
- package/dist/cjs/preferences.d.ts.map +1 -0
- package/dist/cjs/preferences.js +166 -0
- package/dist/cjs/preferences.js.map +7 -0
- package/dist/cjs/publication-input.d.ts +26 -0
- package/dist/cjs/publication-input.d.ts.map +1 -0
- package/dist/cjs/publication-input.js +171 -0
- package/dist/cjs/publication-input.js.map +7 -0
- package/dist/cjs/publication.d.ts +13 -0
- package/dist/cjs/publication.d.ts.map +1 -0
- package/dist/cjs/publication.js +228 -0
- package/dist/cjs/publication.js.map +7 -0
- package/dist/cjs/runtime.d.ts +4 -0
- package/dist/cjs/runtime.d.ts.map +1 -0
- package/dist/cjs/runtime.js +135 -0
- package/dist/cjs/runtime.js.map +7 -0
- package/dist/cjs/schedule.d.ts +5 -0
- package/dist/cjs/schedule.d.ts.map +1 -0
- package/dist/cjs/schedule.js +104 -0
- package/dist/cjs/schedule.js.map +7 -0
- package/dist/cjs/schema.d.ts +2734 -0
- package/dist/cjs/schema.d.ts.map +1 -0
- package/dist/cjs/schema.js +245 -0
- package/dist/cjs/schema.js.map +7 -0
- package/dist/cjs/strings.d.ts +5 -0
- package/dist/cjs/strings.d.ts.map +1 -0
- package/dist/cjs/strings.js +98 -0
- package/dist/cjs/strings.js.map +7 -0
- package/dist/cjs/types.d.ts +124 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +37 -0
- package/dist/cjs/types.js.map +7 -0
- package/dist/cjs/validation.d.ts +81 -0
- package/dist/cjs/validation.d.ts.map +1 -0
- package/dist/cjs/validation.js +611 -0
- package/dist/cjs/validation.js.map +7 -0
- package/dist/context.d.ts +24 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/contracts.d.ts +109 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/core.d.ts +26 -90
- package/dist/core.d.ts.map +1 -1
- package/dist/delivery-admin.d.ts +13 -0
- package/dist/delivery-admin.d.ts.map +1 -0
- package/dist/delivery-executor.d.ts +15 -0
- package/dist/delivery-executor.d.ts.map +1 -0
- package/dist/delivery-store.d.ts +34 -0
- package/dist/delivery-store.d.ts.map +1 -0
- package/dist/dispatch-control.d.ts +36 -0
- package/dist/dispatch-control.d.ts.map +1 -0
- package/dist/dispatcher.d.ts +22 -0
- package/dist/dispatcher.d.ts.map +1 -0
- package/dist/errors.d.ts +11 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/idempotency.d.ts +18 -0
- package/dist/idempotency.d.ts.map +1 -0
- package/dist/inbox.d.ts +24 -0
- package/dist/inbox.d.ts.map +1 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -6
- package/dist/json.d.ts.map +1 -1
- package/dist/preference-store.d.ts +19 -0
- package/dist/preference-store.d.ts.map +1 -0
- package/dist/preferences.d.ts.map +1 -1
- package/dist/publication-input.d.ts +26 -0
- package/dist/publication-input.d.ts.map +1 -0
- package/dist/publication.d.ts +13 -0
- package/dist/publication.d.ts.map +1 -0
- package/dist/schedule.d.ts +5 -0
- package/dist/schedule.d.ts.map +1 -0
- package/dist/schema.d.ts +57 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +1 -189
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validation.d.ts +81 -0
- package/dist/validation.d.ts.map +1 -0
- package/docs/adoption-notes.md +59 -6
- package/docs/architecture.md +160 -225
- package/examples/basic.ts +31 -10
- package/package.json +37 -14
- package/dist/core.js +0 -1787
- package/dist/core.js.map +0 -1
- package/dist/errors.js +0 -119
- package/dist/errors.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/json.js +0 -207
- package/dist/json.js.map +0 -1
- package/dist/keys.js +0 -68
- package/dist/keys.js.map +0 -1
- package/dist/preferences.js +0 -91
- package/dist/preferences.js.map +0 -1
- package/dist/runtime.js +0 -92
- package/dist/runtime.js.map +0 -1
- package/dist/schema.js.map +0 -1
- package/dist/strings.js +0 -63
- package/dist/strings.js.map +0 -1
- package/dist/types.js +0 -8
- package/dist/types.js.map +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
__export(index_exports, {
|
|
21
|
+
BUILT_IN_CHANNELS: () => import_types.BUILT_IN_CHANNELS,
|
|
22
|
+
NotificationConfigurationError: () => import_errors.NotificationConfigurationError,
|
|
23
|
+
NotificationDeliveryError: () => import_errors.NotificationDeliveryError,
|
|
24
|
+
NotificationDispatchError: () => import_errors2.NotificationDispatchError,
|
|
25
|
+
NotificationIdempotencyError: () => import_idempotency.NotificationIdempotencyError,
|
|
26
|
+
PREFERENCE_WILDCARD: () => import_types.PREFERENCE_WILDCARD,
|
|
27
|
+
UnifiedNotificationCore: () => import_core.UnifiedNotificationCore,
|
|
28
|
+
createNotificationCore: () => import_core.createNotificationCore,
|
|
29
|
+
createNotificationSchema: () => import_schema.createNotificationSchema,
|
|
30
|
+
notificationDeliveries: () => import_schema.notificationDeliveries,
|
|
31
|
+
notificationDispatchState: () => import_schema.notificationDispatchState,
|
|
32
|
+
notificationPreferences: () => import_schema.notificationPreferences,
|
|
33
|
+
notificationSchema: () => import_schema.notificationSchema,
|
|
34
|
+
notifications: () => import_schema.notifications,
|
|
35
|
+
resolvePreference: () => import_preferences.resolvePreference
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(index_exports);
|
|
38
|
+
var import_core = require("./core.js");
|
|
39
|
+
var import_errors = require("./errors.js");
|
|
40
|
+
var import_preferences = require("./preferences.js");
|
|
41
|
+
var import_schema = require("./schema.js");
|
|
42
|
+
var import_types = require("./types.js");
|
|
43
|
+
var import_idempotency = require("./idempotency.js");
|
|
44
|
+
var import_errors2 = require("./errors.js");
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
BUILT_IN_CHANNELS,
|
|
48
|
+
NotificationConfigurationError,
|
|
49
|
+
NotificationDeliveryError,
|
|
50
|
+
NotificationDispatchError,
|
|
51
|
+
NotificationIdempotencyError,
|
|
52
|
+
PREFERENCE_WILDCARD,
|
|
53
|
+
UnifiedNotificationCore,
|
|
54
|
+
createNotificationCore,
|
|
55
|
+
createNotificationSchema,
|
|
56
|
+
notificationDeliveries,
|
|
57
|
+
notificationDispatchState,
|
|
58
|
+
notificationPreferences,
|
|
59
|
+
notificationSchema,
|
|
60
|
+
notifications,
|
|
61
|
+
resolvePreference
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { UnifiedNotificationCore, createNotificationCore } from \"./core.js\";\nexport type {\n ChannelCircuitBreakerPolicy,\n ChannelDispatchPolicy,\n ChannelRateLimitPolicy,\n DispatchUntilIdleOptions,\n DispatchUntilIdleResult,\n DispatchUntilIdleStopReason,\n NotificationCoreConfig,\n} from \"./core.js\";\nexport {\n NotificationConfigurationError,\n NotificationDeliveryError,\n} from \"./errors.js\";\nexport { resolvePreference } from \"./preferences.js\";\nexport {\n createNotificationSchema,\n notificationDeliveries,\n notificationDispatchState,\n notificationPreferences,\n notificationSchema,\n notifications,\n} from \"./schema.js\";\nexport type {\n NotificationSchema,\n NotificationSchemaOptions,\n} from \"./schema.js\";\nexport { BUILT_IN_CHANNELS, PREFERENCE_WILDCARD } from \"./types.js\";\nexport type {\n BuiltInChannel,\n DeliveryAdapter,\n DeliveryAdapters,\n DeliveryContext,\n DeliveryResult,\n DeliveryStatus,\n DispatchResult,\n InboxCursor,\n InboxItem,\n InboxPage,\n JsonObject,\n JsonPrimitive,\n JsonValue,\n NotificationLogger,\n NotificationPayload,\n PreferenceDefaults,\n PreferenceOverride,\n PublishInput,\n PublishedNotification,\n ResolvedPreference,\n} from \"./types.js\";\n\nexport { NotificationIdempotencyError } from \"./idempotency.js\";\n\nexport { NotificationDispatchError } from \"./errors.js\";\nexport type { DispatchOptions } from \"./contracts.js\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgE;AAUhE,oBAGO;AACP,yBAAkC;AAClC,oBAOO;AAKP,mBAAuD;AAwBvD,yBAA6C;AAE7C,IAAAA,iBAA0C;",
|
|
6
|
+
"names": ["import_errors"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JsonObject, JsonValue } from "./types.js";
|
|
2
|
+
export declare const JSON_MAX_DEPTH = 256;
|
|
3
|
+
export declare const JSON_MAX_NODES = 10000;
|
|
4
|
+
export declare function normalizeJsonValue(value: unknown, label: string): JsonValue;
|
|
5
|
+
export declare function assertJsonValue(value: unknown, label: string): asserts value is JsonValue;
|
|
6
|
+
export declare function normalizeJsonObject(value: unknown, label: string): JsonObject;
|
|
7
|
+
export declare function assertJsonObject(value: unknown, label: string): asserts value is JsonObject;
|
|
8
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/json.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAExD,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,cAAc,QAAS,CAAC;AAsKrC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAkG3E;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,KAAK,IAAI,SAAS,CAE5B;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAS7E;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,KAAK,IAAI,UAAU,CAE7B"}
|
package/dist/cjs/json.js
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var json_exports = {};
|
|
20
|
+
__export(json_exports, {
|
|
21
|
+
JSON_MAX_DEPTH: () => JSON_MAX_DEPTH,
|
|
22
|
+
JSON_MAX_NODES: () => JSON_MAX_NODES,
|
|
23
|
+
assertJsonObject: () => assertJsonObject,
|
|
24
|
+
assertJsonValue: () => assertJsonValue,
|
|
25
|
+
normalizeJsonObject: () => normalizeJsonObject,
|
|
26
|
+
normalizeJsonValue: () => normalizeJsonValue
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(json_exports);
|
|
29
|
+
var import_errors = require("./errors.js");
|
|
30
|
+
var import_strings = require("./strings.js");
|
|
31
|
+
const JSON_MAX_DEPTH = 256;
|
|
32
|
+
const JSON_MAX_NODES = 1e4;
|
|
33
|
+
function jsonType(value) {
|
|
34
|
+
if (value === null) {
|
|
35
|
+
return "null";
|
|
36
|
+
}
|
|
37
|
+
return typeof value;
|
|
38
|
+
}
|
|
39
|
+
function inspect(label, operation) {
|
|
40
|
+
try {
|
|
41
|
+
return operation();
|
|
42
|
+
} catch {
|
|
43
|
+
throw new import_errors.NotificationConfigurationError(
|
|
44
|
+
`${label} could not be inspected as JSON`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function ownDescriptor(value, key, label) {
|
|
49
|
+
const descriptor = inspect(
|
|
50
|
+
label,
|
|
51
|
+
() => Object.getOwnPropertyDescriptor(value, key)
|
|
52
|
+
);
|
|
53
|
+
if (!descriptor) {
|
|
54
|
+
throw new import_errors.NotificationConfigurationError(
|
|
55
|
+
`${label} changed while being inspected`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return descriptor;
|
|
59
|
+
}
|
|
60
|
+
function arrayIndex(key, length) {
|
|
61
|
+
if (!key) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const index = Number(key);
|
|
65
|
+
return Number.isInteger(index) && index >= 0 && index <= 4294967294 && index < length && String(index) === key ? index : null;
|
|
66
|
+
}
|
|
67
|
+
function objectChildren(value, label, reserve) {
|
|
68
|
+
const prototype = inspect(label, () => Object.getPrototypeOf(value));
|
|
69
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
70
|
+
throw new import_errors.NotificationConfigurationError(
|
|
71
|
+
`${label} must contain only plain JSON objects`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
const keys = inspect(label, () => Reflect.ownKeys(value));
|
|
75
|
+
reserve(keys.length);
|
|
76
|
+
const children = [];
|
|
77
|
+
for (const key of keys) {
|
|
78
|
+
if (typeof key !== "string") {
|
|
79
|
+
throw new import_errors.NotificationConfigurationError(
|
|
80
|
+
`${label} must not contain symbol keys`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
(0, import_strings.assertPostgresSafeString)(key, `${label} key`);
|
|
84
|
+
const childLabel = `${label}.${key}`;
|
|
85
|
+
const descriptor = ownDescriptor(value, key, childLabel);
|
|
86
|
+
if (!descriptor.enumerable || !("value" in descriptor)) {
|
|
87
|
+
throw new import_errors.NotificationConfigurationError(
|
|
88
|
+
`${childLabel} must be an enumerable data property`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
children.push({ value: descriptor.value, label: childLabel, key });
|
|
92
|
+
}
|
|
93
|
+
return children;
|
|
94
|
+
}
|
|
95
|
+
function arrayChildren(value, label, reserve) {
|
|
96
|
+
const prototype = inspect(label, () => Object.getPrototypeOf(value));
|
|
97
|
+
if (prototype !== Array.prototype) {
|
|
98
|
+
throw new import_errors.NotificationConfigurationError(
|
|
99
|
+
`${label} arrays must use Array.prototype directly`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
const keys = inspect(label, () => Reflect.ownKeys(value));
|
|
103
|
+
let childCount = 0;
|
|
104
|
+
for (const key of keys) {
|
|
105
|
+
if (key !== "length") {
|
|
106
|
+
childCount += 1;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
reserve(childCount);
|
|
110
|
+
const lengthDescriptor = ownDescriptor(value, "length", `${label}.length`);
|
|
111
|
+
if (!("value" in lengthDescriptor) || typeof lengthDescriptor.value !== "number") {
|
|
112
|
+
throw new import_errors.NotificationConfigurationError(
|
|
113
|
+
`${label}.length must be an array data property`
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
const length = lengthDescriptor.value;
|
|
117
|
+
const children = [];
|
|
118
|
+
for (const key of keys) {
|
|
119
|
+
if (typeof key !== "string") {
|
|
120
|
+
throw new import_errors.NotificationConfigurationError(
|
|
121
|
+
`${label} must not contain symbol keys`
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
if (key === "length") {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
const index = arrayIndex(key, length);
|
|
128
|
+
if (index === null) {
|
|
129
|
+
throw new import_errors.NotificationConfigurationError(
|
|
130
|
+
`${label} must not contain extra array property "${key}"`
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
const childLabel = `${label}[${index}]`;
|
|
134
|
+
const descriptor = ownDescriptor(value, key, childLabel);
|
|
135
|
+
if (!descriptor.enumerable || !("value" in descriptor)) {
|
|
136
|
+
throw new import_errors.NotificationConfigurationError(
|
|
137
|
+
`${childLabel} must be an enumerable data property`
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
children.push({ value: descriptor.value, label: childLabel, key: index });
|
|
141
|
+
}
|
|
142
|
+
if (children.length !== length) {
|
|
143
|
+
throw new import_errors.NotificationConfigurationError(
|
|
144
|
+
`${label} must not contain sparse array entries`
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
children.sort((left, right) => Number(left.key) - Number(right.key));
|
|
148
|
+
return children;
|
|
149
|
+
}
|
|
150
|
+
function normalizeJsonValue(value, label) {
|
|
151
|
+
let normalized;
|
|
152
|
+
const stack = [
|
|
153
|
+
{
|
|
154
|
+
kind: "enter",
|
|
155
|
+
value,
|
|
156
|
+
label,
|
|
157
|
+
depth: 0,
|
|
158
|
+
assign: (result) => {
|
|
159
|
+
normalized = result;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
];
|
|
163
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
164
|
+
let reservedNodes = 1;
|
|
165
|
+
const reserve = (count) => {
|
|
166
|
+
if (count > JSON_MAX_NODES - reservedNodes) {
|
|
167
|
+
throw new import_errors.NotificationConfigurationError(
|
|
168
|
+
`${label} must contain at most ${JSON_MAX_NODES} JSON nodes`
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
reservedNodes += count;
|
|
172
|
+
};
|
|
173
|
+
while (stack.length > 0) {
|
|
174
|
+
const frame = stack.pop();
|
|
175
|
+
if (frame.kind === "exit") {
|
|
176
|
+
ancestors.delete(frame.value);
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (frame.depth > JSON_MAX_DEPTH) {
|
|
180
|
+
throw new import_errors.NotificationConfigurationError(
|
|
181
|
+
`${label} must have at most ${JSON_MAX_DEPTH} levels of nesting`
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
const current = frame.value;
|
|
185
|
+
if (current === null || typeof current === "boolean") {
|
|
186
|
+
frame.assign(current);
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
if (typeof current === "string") {
|
|
190
|
+
(0, import_strings.assertPostgresSafeString)(current, frame.label);
|
|
191
|
+
frame.assign(current);
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (typeof current === "number") {
|
|
195
|
+
if (!Number.isFinite(current)) {
|
|
196
|
+
throw new import_errors.NotificationConfigurationError(
|
|
197
|
+
`${frame.label} must contain only finite JSON numbers`
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
frame.assign(current);
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if (typeof current !== "object") {
|
|
204
|
+
throw new import_errors.NotificationConfigurationError(
|
|
205
|
+
`${frame.label} contains non-JSON ${jsonType(current)}`
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
if (ancestors.has(current)) {
|
|
209
|
+
throw new import_errors.NotificationConfigurationError(
|
|
210
|
+
`${frame.label} contains a cycle`
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
const isArray = inspect(frame.label, () => Array.isArray(current));
|
|
214
|
+
const children = isArray ? arrayChildren(current, frame.label, reserve) : objectChildren(current, frame.label, reserve);
|
|
215
|
+
const target = isArray ? [] : {};
|
|
216
|
+
frame.assign(target);
|
|
217
|
+
ancestors.add(current);
|
|
218
|
+
stack.push({ kind: "exit", value: current });
|
|
219
|
+
for (let index = children.length - 1; index >= 0; index -= 1) {
|
|
220
|
+
const child = children[index];
|
|
221
|
+
stack.push({
|
|
222
|
+
kind: "enter",
|
|
223
|
+
value: child.value,
|
|
224
|
+
label: child.label,
|
|
225
|
+
depth: frame.depth + 1,
|
|
226
|
+
assign: (result) => {
|
|
227
|
+
if (Array.isArray(target)) {
|
|
228
|
+
target[child.key] = result;
|
|
229
|
+
} else {
|
|
230
|
+
Object.defineProperty(target, child.key, {
|
|
231
|
+
value: result,
|
|
232
|
+
enumerable: true,
|
|
233
|
+
configurable: true,
|
|
234
|
+
writable: true
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return normalized;
|
|
242
|
+
}
|
|
243
|
+
function assertJsonValue(value, label) {
|
|
244
|
+
normalizeJsonValue(value, label);
|
|
245
|
+
}
|
|
246
|
+
function normalizeJsonObject(value, label) {
|
|
247
|
+
const isArray = value && typeof value === "object" ? inspect(label, () => Array.isArray(value)) : false;
|
|
248
|
+
if (!value || typeof value !== "object" || isArray) {
|
|
249
|
+
throw new import_errors.NotificationConfigurationError(`${label} must be a JSON object`);
|
|
250
|
+
}
|
|
251
|
+
return normalizeJsonValue(value, label);
|
|
252
|
+
}
|
|
253
|
+
function assertJsonObject(value, label) {
|
|
254
|
+
normalizeJsonObject(value, label);
|
|
255
|
+
}
|
|
256
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
257
|
+
0 && (module.exports = {
|
|
258
|
+
JSON_MAX_DEPTH,
|
|
259
|
+
JSON_MAX_NODES,
|
|
260
|
+
assertJsonObject,
|
|
261
|
+
assertJsonValue,
|
|
262
|
+
normalizeJsonObject,
|
|
263
|
+
normalizeJsonValue
|
|
264
|
+
});
|
|
265
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/json.ts"],
|
|
4
|
+
"sourcesContent": ["import { NotificationConfigurationError } from \"./errors.js\";\nimport { assertPostgresSafeString } from \"./strings.js\";\nimport type { JsonObject, JsonValue } from \"./types.js\";\n\nexport const JSON_MAX_DEPTH = 256;\nexport const JSON_MAX_NODES = 10_000;\n\ntype EnterFrame = {\n kind: \"enter\";\n value: unknown;\n label: string;\n depth: number;\n assign: (value: JsonValue) => void;\n};\n\ntype ExitFrame = {\n kind: \"exit\";\n value: object;\n};\n\ntype Frame = EnterFrame | ExitFrame;\n\ntype Child = {\n value: unknown;\n label: string;\n key: string | number;\n};\n\nfunction jsonType(value: unknown): string {\n if (value === null) {\n return \"null\";\n }\n return typeof value;\n}\n\nfunction inspect<T>(label: string, operation: () => T): T {\n try {\n return operation();\n } catch {\n throw new NotificationConfigurationError(\n `${label} could not be inspected as JSON`,\n );\n }\n}\n\nfunction ownDescriptor(\n value: object,\n key: PropertyKey,\n label: string,\n): PropertyDescriptor {\n const descriptor = inspect(label, () =>\n Object.getOwnPropertyDescriptor(value, key),\n );\n if (!descriptor) {\n throw new NotificationConfigurationError(\n `${label} changed while being inspected`,\n );\n }\n return descriptor;\n}\n\nfunction arrayIndex(key: string, length: number): number | null {\n if (!key) {\n return null;\n }\n const index = Number(key);\n return Number.isInteger(index) &&\n index >= 0 &&\n index <= 0xffff_fffe &&\n index < length &&\n String(index) === key\n ? index\n : null;\n}\n\nfunction objectChildren(\n value: object,\n label: string,\n reserve: (count: number) => void,\n): Child[] {\n const prototype = inspect(label, () => Object.getPrototypeOf(value));\n if (prototype !== Object.prototype && prototype !== null) {\n throw new NotificationConfigurationError(\n `${label} must contain only plain JSON objects`,\n );\n }\n const keys = inspect(label, () => Reflect.ownKeys(value));\n reserve(keys.length);\n const children: Child[] = [];\n for (const key of keys) {\n if (typeof key !== \"string\") {\n throw new NotificationConfigurationError(\n `${label} must not contain symbol keys`,\n );\n }\n assertPostgresSafeString(key, `${label} key`);\n const childLabel = `${label}.${key}`;\n const descriptor = ownDescriptor(value, key, childLabel);\n if (!descriptor.enumerable || !(\"value\" in descriptor)) {\n throw new NotificationConfigurationError(\n `${childLabel} must be an enumerable data property`,\n );\n }\n children.push({ value: descriptor.value, label: childLabel, key });\n }\n return children;\n}\n\nfunction arrayChildren(\n value: unknown[],\n label: string,\n reserve: (count: number) => void,\n): Child[] {\n const prototype = inspect(label, () => Object.getPrototypeOf(value));\n if (prototype !== Array.prototype) {\n throw new NotificationConfigurationError(\n `${label} arrays must use Array.prototype directly`,\n );\n }\n const keys = inspect(label, () => Reflect.ownKeys(value));\n let childCount = 0;\n for (const key of keys) {\n if (key !== \"length\") {\n childCount += 1;\n }\n }\n reserve(childCount);\n const lengthDescriptor = ownDescriptor(value, \"length\", `${label}.length`);\n if (\n !(\"value\" in lengthDescriptor) ||\n typeof lengthDescriptor.value !== \"number\"\n ) {\n throw new NotificationConfigurationError(\n `${label}.length must be an array data property`,\n );\n }\n const length = lengthDescriptor.value;\n const children: Child[] = [];\n for (const key of keys) {\n if (typeof key !== \"string\") {\n throw new NotificationConfigurationError(\n `${label} must not contain symbol keys`,\n );\n }\n if (key === \"length\") {\n continue;\n }\n const index = arrayIndex(key, length);\n if (index === null) {\n throw new NotificationConfigurationError(\n `${label} must not contain extra array property \"${key}\"`,\n );\n }\n const childLabel = `${label}[${index}]`;\n const descriptor = ownDescriptor(value, key, childLabel);\n if (!descriptor.enumerable || !(\"value\" in descriptor)) {\n throw new NotificationConfigurationError(\n `${childLabel} must be an enumerable data property`,\n );\n }\n children.push({ value: descriptor.value, label: childLabel, key: index });\n }\n if (children.length !== length) {\n throw new NotificationConfigurationError(\n `${label} must not contain sparse array entries`,\n );\n }\n children.sort((left, right) => Number(left.key) - Number(right.key));\n return children;\n}\n\nexport function normalizeJsonValue(value: unknown, label: string): JsonValue {\n let normalized!: JsonValue;\n const stack: Frame[] = [\n {\n kind: \"enter\",\n value,\n label,\n depth: 0,\n assign: (result) => {\n normalized = result;\n },\n },\n ];\n const ancestors = new Set<object>();\n let reservedNodes = 1;\n const reserve = (count: number) => {\n if (count > JSON_MAX_NODES - reservedNodes) {\n throw new NotificationConfigurationError(\n `${label} must contain at most ${JSON_MAX_NODES} JSON nodes`,\n );\n }\n reservedNodes += count;\n };\n\n while (stack.length > 0) {\n const frame = stack.pop()!;\n if (frame.kind === \"exit\") {\n ancestors.delete(frame.value);\n continue;\n }\n\n if (frame.depth > JSON_MAX_DEPTH) {\n throw new NotificationConfigurationError(\n `${label} must have at most ${JSON_MAX_DEPTH} levels of nesting`,\n );\n }\n\n const current = frame.value;\n if (current === null || typeof current === \"boolean\") {\n frame.assign(current);\n continue;\n }\n if (typeof current === \"string\") {\n assertPostgresSafeString(current, frame.label);\n frame.assign(current);\n continue;\n }\n if (typeof current === \"number\") {\n if (!Number.isFinite(current)) {\n throw new NotificationConfigurationError(\n `${frame.label} must contain only finite JSON numbers`,\n );\n }\n frame.assign(current);\n continue;\n }\n if (typeof current !== \"object\") {\n throw new NotificationConfigurationError(\n `${frame.label} contains non-JSON ${jsonType(current)}`,\n );\n }\n if (ancestors.has(current)) {\n throw new NotificationConfigurationError(\n `${frame.label} contains a cycle`,\n );\n }\n\n const isArray = inspect(frame.label, () => Array.isArray(current));\n const children = isArray\n ? arrayChildren(current as unknown[], frame.label, reserve)\n : objectChildren(current, frame.label, reserve);\n const target: JsonValue = isArray ? [] : {};\n frame.assign(target);\n ancestors.add(current);\n stack.push({ kind: \"exit\", value: current });\n for (let index = children.length - 1; index >= 0; index -= 1) {\n const child = children[index]!;\n stack.push({\n kind: \"enter\",\n value: child.value,\n label: child.label,\n depth: frame.depth + 1,\n assign: (result) => {\n if (Array.isArray(target)) {\n target[child.key as number] = result;\n } else {\n Object.defineProperty(target, child.key, {\n value: result,\n enumerable: true,\n configurable: true,\n writable: true,\n });\n }\n },\n });\n }\n }\n return normalized;\n}\n\nexport function assertJsonValue(\n value: unknown,\n label: string,\n): asserts value is JsonValue {\n normalizeJsonValue(value, label);\n}\n\nexport function normalizeJsonObject(value: unknown, label: string): JsonObject {\n const isArray =\n value && typeof value === \"object\"\n ? inspect(label, () => Array.isArray(value))\n : false;\n if (!value || typeof value !== \"object\" || isArray) {\n throw new NotificationConfigurationError(`${label} must be a JSON object`);\n }\n return normalizeJsonValue(value, label) as JsonObject;\n}\n\nexport function assertJsonObject(\n value: unknown,\n label: string,\n): asserts value is JsonObject {\n normalizeJsonObject(value, label);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA+C;AAC/C,qBAAyC;AAGlC,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAuB9B,SAAS,SAAS,OAAwB;AACxC,MAAI,UAAU,MAAM;AAClB,WAAO;AAAA,EACT;AACA,SAAO,OAAO;AAChB;AAEA,SAAS,QAAW,OAAe,WAAuB;AACxD,MAAI;AACF,WAAO,UAAU;AAAA,EACnB,QAAQ;AACN,UAAM,IAAI;AAAA,MACR,GAAG,KAAK;AAAA,IACV;AAAA,EACF;AACF;AAEA,SAAS,cACP,OACA,KACA,OACoB;AACpB,QAAM,aAAa;AAAA,IAAQ;AAAA,IAAO,MAChC,OAAO,yBAAyB,OAAO,GAAG;AAAA,EAC5C;AACA,MAAI,CAAC,YAAY;AACf,UAAM,IAAI;AAAA,MACR,GAAG,KAAK;AAAA,IACV;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,WAAW,KAAa,QAA+B;AAC9D,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,OAAO,GAAG;AACxB,SAAO,OAAO,UAAU,KAAK,KAC3B,SAAS,KACT,SAAS,cACT,QAAQ,UACR,OAAO,KAAK,MAAM,MAChB,QACA;AACN;AAEA,SAAS,eACP,OACA,OACA,SACS;AACT,QAAM,YAAY,QAAQ,OAAO,MAAM,OAAO,eAAe,KAAK,CAAC;AACnE,MAAI,cAAc,OAAO,aAAa,cAAc,MAAM;AACxD,UAAM,IAAI;AAAA,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;AAAA,QACT,MAAM;AAAA,QACN,OAAO,MAAM;AAAA,QACb,OAAO,MAAM;AAAA,QACb,OAAO,MAAM,QAAQ;AAAA,QACrB,QAAQ,CAAC,WAAW;AAClB,cAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,mBAAO,MAAM,GAAa,IAAI;AAAA,UAChC,OAAO;AACL,mBAAO,eAAe,QAAQ,MAAM,KAAK;AAAA,cACvC,OAAO;AAAA,cACP,YAAY;AAAA,cACZ,cAAc;AAAA,cACd,UAAU;AAAA,YACZ,CAAC;AAAA,UACH;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,gBACd,OACA,OAC4B;AAC5B,qBAAmB,OAAO,KAAK;AACjC;AAEO,SAAS,oBAAoB,OAAgB,OAA2B;AAC7E,QAAM,UACJ,SAAS,OAAO,UAAU,WACtB,QAAQ,OAAO,MAAM,MAAM,QAAQ,KAAK,CAAC,IACzC;AACN,MAAI,CAAC,SAAS,OAAO,UAAU,YAAY,SAAS;AAClD,UAAM,IAAI,6CAA+B,GAAG,KAAK,wBAAwB;AAAA,EAC3E;AACA,SAAO,mBAAmB,OAAO,KAAK;AACxC;AAEO,SAAS,iBACd,OACA,OAC6B;AAC7B,sBAAoB,OAAO,KAAK;AAClC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type SQLWrapper } from "drizzle-orm";
|
|
2
|
+
import type { PreferenceDefaults } from "./types.js";
|
|
3
|
+
export declare const ECMASCRIPT_TRIM_SQL_CHARACTER_LITERAL: string;
|
|
4
|
+
export declare function canonicalNotificationKeySql(column: SQLWrapper): import("drizzle-orm").SQL<string>;
|
|
5
|
+
export declare function normalizeNotificationKey(value: unknown, label: string, max: number): string;
|
|
6
|
+
export declare function normalizeUniqueNotificationKeys(values: readonly unknown[], label: string, max: number): string[];
|
|
7
|
+
export declare function normalizeChannelRecord<T>(record: Readonly<Record<string, T | undefined>>, label: string): Record<string, T>;
|
|
8
|
+
export declare function getOwnRecordValue<T>(record: Readonly<Record<string, T | undefined>> | undefined, key: string): T | undefined;
|
|
9
|
+
export declare function normalizePreferenceDefaults<TChannel extends string>(defaults: PreferenceDefaults<TChannel>): PreferenceDefaults<TChannel>;
|
|
10
|
+
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAKnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,eAAO,MAAM,qCAAqC,QAAgJ,CAAC;AAEnM,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,UAAU,qCAE7D;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,MAAM,CAeR;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,SAAS,OAAO,EAAE,EAC1B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CAUV;AAED,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,EAC/C,KAAK,EAAE,MAAM,GACZ,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAkBnB;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,SAAS,EAC3D,GAAG,EAAE,MAAM,GACV,CAAC,GAAG,SAAS,CAEf;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,SAAS,MAAM,EACjE,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GACrC,kBAAkB,CAAC,QAAQ,CAAC,CAgC9B"}
|
package/dist/cjs/keys.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var keys_exports = {};
|
|
20
|
+
__export(keys_exports, {
|
|
21
|
+
ECMASCRIPT_TRIM_SQL_CHARACTER_LITERAL: () => ECMASCRIPT_TRIM_SQL_CHARACTER_LITERAL,
|
|
22
|
+
canonicalNotificationKeySql: () => canonicalNotificationKeySql,
|
|
23
|
+
getOwnRecordValue: () => getOwnRecordValue,
|
|
24
|
+
normalizeChannelRecord: () => normalizeChannelRecord,
|
|
25
|
+
normalizeNotificationKey: () => normalizeNotificationKey,
|
|
26
|
+
normalizePreferenceDefaults: () => normalizePreferenceDefaults,
|
|
27
|
+
normalizeUniqueNotificationKeys: () => normalizeUniqueNotificationKeys
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(keys_exports);
|
|
30
|
+
var import_drizzle_orm = require("drizzle-orm");
|
|
31
|
+
var import_errors = require("./errors.js");
|
|
32
|
+
var import_runtime = require("./runtime.js");
|
|
33
|
+
var import_strings = require("./strings.js");
|
|
34
|
+
const ECMASCRIPT_TRIM_SQL_CHARACTER_LITERAL = String.raw`U&'\0009\000A\000B\000C\000D\0020\00A0\1680\2000\2001\2002\2003\2004\2005\2006\2007\2008\2009\200A\2028\2029\202F\205F\3000\FEFF'`;
|
|
35
|
+
function canonicalNotificationKeySql(column) {
|
|
36
|
+
return import_drizzle_orm.sql`btrim(${column}, ${import_drizzle_orm.sql.raw(ECMASCRIPT_TRIM_SQL_CHARACTER_LITERAL)})`;
|
|
37
|
+
}
|
|
38
|
+
function normalizeNotificationKey(value, label, max) {
|
|
39
|
+
if (typeof value !== "string") {
|
|
40
|
+
throw new import_errors.NotificationConfigurationError(`${label} must be a string`);
|
|
41
|
+
}
|
|
42
|
+
const normalized = value.trim();
|
|
43
|
+
if (!normalized) {
|
|
44
|
+
throw new import_errors.NotificationConfigurationError(`${label} must not be empty`);
|
|
45
|
+
}
|
|
46
|
+
if (normalized.length > max) {
|
|
47
|
+
throw new import_errors.NotificationConfigurationError(
|
|
48
|
+
`${label} must be at most ${max} characters`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
(0, import_strings.assertPostgresSafeString)(normalized, label);
|
|
52
|
+
return normalized;
|
|
53
|
+
}
|
|
54
|
+
function normalizeUniqueNotificationKeys(values, label, max) {
|
|
55
|
+
const snapshot = (0, import_runtime.captureArrayValues)(values, label);
|
|
56
|
+
if (snapshot.length === 0) {
|
|
57
|
+
throw new import_errors.NotificationConfigurationError(`${label} must not be empty`);
|
|
58
|
+
}
|
|
59
|
+
const normalized = /* @__PURE__ */ new Set();
|
|
60
|
+
for (const value of snapshot) {
|
|
61
|
+
normalized.add(normalizeNotificationKey(value, label, max));
|
|
62
|
+
}
|
|
63
|
+
return [...normalized];
|
|
64
|
+
}
|
|
65
|
+
function normalizeChannelRecord(record, label) {
|
|
66
|
+
const snapshot = (0, import_runtime.capturePlainRecord)(record, label);
|
|
67
|
+
const normalized = /* @__PURE__ */ Object.create(null);
|
|
68
|
+
for (const rawChannel of Object.keys(snapshot)) {
|
|
69
|
+
const value = snapshot[rawChannel];
|
|
70
|
+
const channel = normalizeNotificationKey(
|
|
71
|
+
rawChannel,
|
|
72
|
+
`${label}.channel`,
|
|
73
|
+
64
|
|
74
|
+
);
|
|
75
|
+
if (Object.hasOwn(normalized, channel)) {
|
|
76
|
+
throw new import_errors.NotificationConfigurationError(
|
|
77
|
+
`${label} contains duplicate canonical channel "${channel}"`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
normalized[channel] = value;
|
|
81
|
+
}
|
|
82
|
+
return normalized;
|
|
83
|
+
}
|
|
84
|
+
function getOwnRecordValue(record, key) {
|
|
85
|
+
return record && Object.hasOwn(record, key) ? record[key] : void 0;
|
|
86
|
+
}
|
|
87
|
+
function normalizePreferenceDefaults(defaults) {
|
|
88
|
+
const snapshot = (0, import_runtime.capturePlainRecord)(defaults, "preferenceDefaults");
|
|
89
|
+
const normalized = /* @__PURE__ */ Object.create(null);
|
|
90
|
+
for (const [rawTopic, channels] of Object.entries(snapshot)) {
|
|
91
|
+
const topic = normalizeNotificationKey(
|
|
92
|
+
rawTopic,
|
|
93
|
+
"preferenceDefaults.topic",
|
|
94
|
+
191
|
|
95
|
+
);
|
|
96
|
+
if (Object.hasOwn(normalized, topic)) {
|
|
97
|
+
throw new import_errors.NotificationConfigurationError(
|
|
98
|
+
`preferenceDefaults contains duplicate canonical topic "${topic}"`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
const normalizedChannels = normalizeChannelRecord(
|
|
102
|
+
channels,
|
|
103
|
+
`preferenceDefaults topic "${topic}"`
|
|
104
|
+
);
|
|
105
|
+
for (const enabled of Object.values(normalizedChannels)) {
|
|
106
|
+
if (typeof enabled !== "boolean") {
|
|
107
|
+
throw new import_errors.NotificationConfigurationError(
|
|
108
|
+
`preferenceDefaults topic "${topic}" values must be boolean`
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
normalized[topic] = normalizedChannels;
|
|
113
|
+
}
|
|
114
|
+
return normalized;
|
|
115
|
+
}
|
|
116
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
117
|
+
0 && (module.exports = {
|
|
118
|
+
ECMASCRIPT_TRIM_SQL_CHARACTER_LITERAL,
|
|
119
|
+
canonicalNotificationKeySql,
|
|
120
|
+
getOwnRecordValue,
|
|
121
|
+
normalizeChannelRecord,
|
|
122
|
+
normalizeNotificationKey,
|
|
123
|
+
normalizePreferenceDefaults,
|
|
124
|
+
normalizeUniqueNotificationKeys
|
|
125
|
+
});
|
|
126
|
+
//# sourceMappingURL=keys.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/keys.ts"],
|
|
4
|
+
"sourcesContent": ["import { sql, type SQLWrapper } from \"drizzle-orm\";\n\nimport { NotificationConfigurationError } from \"./errors.js\";\nimport { captureArrayValues, capturePlainRecord } from \"./runtime.js\";\nimport { assertPostgresSafeString } from \"./strings.js\";\nimport type { PreferenceDefaults } from \"./types.js\";\n\nexport const ECMASCRIPT_TRIM_SQL_CHARACTER_LITERAL = String.raw`U&'\\0009\\000A\\000B\\000C\\000D\\0020\\00A0\\1680\\2000\\2001\\2002\\2003\\2004\\2005\\2006\\2007\\2008\\2009\\200A\\2028\\2029\\202F\\205F\\3000\\FEFF'`;\n\nexport function canonicalNotificationKeySql(column: SQLWrapper) {\n return sql<string>`btrim(${column}, ${sql.raw(ECMASCRIPT_TRIM_SQL_CHARACTER_LITERAL)})`;\n}\n\nexport function normalizeNotificationKey(\n value: unknown,\n label: string,\n max: number,\n): string {\n if (typeof value !== \"string\") {\n throw new NotificationConfigurationError(`${label} must be a string`);\n }\n const normalized = value.trim();\n if (!normalized) {\n throw new NotificationConfigurationError(`${label} must not be empty`);\n }\n if (normalized.length > max) {\n throw new NotificationConfigurationError(\n `${label} must be at most ${max} characters`,\n );\n }\n assertPostgresSafeString(normalized, label);\n return normalized;\n}\n\nexport function normalizeUniqueNotificationKeys(\n values: readonly unknown[],\n label: string,\n max: number,\n): string[] {\n const snapshot = captureArrayValues(values, label);\n if (snapshot.length === 0) {\n throw new NotificationConfigurationError(`${label} must not be empty`);\n }\n const normalized = new Set<string>();\n for (const value of snapshot) {\n normalized.add(normalizeNotificationKey(value, label, max));\n }\n return [...normalized];\n}\n\nexport function normalizeChannelRecord<T>(\n record: Readonly<Record<string, T | undefined>>,\n label: string,\n): Record<string, T> {\n const snapshot = capturePlainRecord(record, label);\n const normalized = Object.create(null) as Record<string, T>;\n for (const rawChannel of Object.keys(snapshot)) {\n const value = snapshot[rawChannel] as T | undefined;\n const channel = normalizeNotificationKey(\n rawChannel,\n `${label}.channel`,\n 64,\n );\n if (Object.hasOwn(normalized, channel)) {\n throw new NotificationConfigurationError(\n `${label} contains duplicate canonical channel \"${channel}\"`,\n );\n }\n normalized[channel] = value as T;\n }\n return normalized;\n}\n\nexport function getOwnRecordValue<T>(\n record: Readonly<Record<string, T | undefined>> | undefined,\n key: string,\n): T | undefined {\n return record && Object.hasOwn(record, key) ? record[key] : undefined;\n}\n\nexport function normalizePreferenceDefaults<TChannel extends string>(\n defaults: PreferenceDefaults<TChannel>,\n): PreferenceDefaults<TChannel> {\n const snapshot = capturePlainRecord(defaults, \"preferenceDefaults\");\n const normalized = Object.create(null) as PreferenceDefaults<TChannel>;\n\n for (const [rawTopic, channels] of Object.entries(snapshot)) {\n const topic = normalizeNotificationKey(\n rawTopic,\n \"preferenceDefaults.topic\",\n 191,\n );\n if (Object.hasOwn(normalized, topic)) {\n throw new NotificationConfigurationError(\n `preferenceDefaults contains duplicate canonical topic \"${topic}\"`,\n );\n }\n\n const normalizedChannels = normalizeChannelRecord(\n channels as Readonly<Record<string, boolean | undefined>>,\n `preferenceDefaults topic \"${topic}\"`,\n );\n for (const enabled of Object.values(normalizedChannels)) {\n if (typeof enabled !== \"boolean\") {\n throw new NotificationConfigurationError(\n `preferenceDefaults topic \"${topic}\" values must be boolean`,\n );\n }\n }\n normalized[topic] = normalizedChannels as Partial<\n Record<TChannel, boolean>\n >;\n }\n return normalized;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAqC;AAErC,oBAA+C;AAC/C,qBAAuD;AACvD,qBAAyC;AAGlC,MAAM,wCAAwC,OAAO;AAErD,SAAS,4BAA4B,QAAoB;AAC9D,SAAO,+BAAoB,MAAM,KAAK,uBAAI,IAAI,qCAAqC,CAAC;AACtF;AAEO,SAAS,yBACd,OACA,OACA,KACQ;AACR,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,IAAI,6CAA+B,GAAG,KAAK,mBAAmB;AAAA,EACtE;AACA,QAAM,aAAa,MAAM,KAAK;AAC9B,MAAI,CAAC,YAAY;AACf,UAAM,IAAI,6CAA+B,GAAG,KAAK,oBAAoB;AAAA,EACvE;AACA,MAAI,WAAW,SAAS,KAAK;AAC3B,UAAM,IAAI;AAAA,MACR,GAAG,KAAK,oBAAoB,GAAG;AAAA,IACjC;AAAA,EACF;AACA,+CAAyB,YAAY,KAAK;AAC1C,SAAO;AACT;AAEO,SAAS,gCACd,QACA,OACA,KACU;AACV,QAAM,eAAW,mCAAmB,QAAQ,KAAK;AACjD,MAAI,SAAS,WAAW,GAAG;AACzB,UAAM,IAAI,6CAA+B,GAAG,KAAK,oBAAoB;AAAA,EACvE;AACA,QAAM,aAAa,oBAAI,IAAY;AACnC,aAAW,SAAS,UAAU;AAC5B,eAAW,IAAI,yBAAyB,OAAO,OAAO,GAAG,CAAC;AAAA,EAC5D;AACA,SAAO,CAAC,GAAG,UAAU;AACvB;AAEO,SAAS,uBACd,QACA,OACmB;AACnB,QAAM,eAAW,mCAAmB,QAAQ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type PreferenceOverride, type ResolvedPreference } from "./types.js";
|
|
2
|
+
import { CoreContext } from "./context.js";
|
|
3
|
+
export declare class PreferenceStore<TChannel extends string, TData extends JsonObject = JsonObject> {
|
|
4
|
+
readonly context: CoreContext<TChannel, TData>;
|
|
5
|
+
constructor(context: CoreContext<TChannel, TData>);
|
|
6
|
+
setPreference(preference: PreferenceOverride<TChannel>): Promise<void>;
|
|
7
|
+
setPreferences(recipientId: string, preferences: ReadonlyArray<Omit<PreferenceOverride<TChannel>, "recipientId">>): Promise<void>;
|
|
8
|
+
clearPreference(input: {
|
|
9
|
+
recipientId: string;
|
|
10
|
+
topic: string;
|
|
11
|
+
channel: TChannel | typeof PREFERENCE_WILDCARD;
|
|
12
|
+
}): Promise<boolean>;
|
|
13
|
+
getPreferences(input: {
|
|
14
|
+
recipientId: string;
|
|
15
|
+
topics: readonly string[];
|
|
16
|
+
channels: readonly TChannel[];
|
|
17
|
+
}): Promise<Array<ResolvedPreference<TChannel>>>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=preference-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preference-store.d.ts","sourceRoot":"","sources":["../../src/preference-store.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,mBAAmB,EACnB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,qBAAa,eAAe,CAC1B,QAAQ,SAAS,MAAM,EACvB,KAAK,SAAS,UAAU,GAAG,UAAU;IAEzB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC;gBAArC,OAAO,EAAE,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC;IACpD,aAAa,CAAC,UAAU,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAgEtE,cAAc,CAClB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,aAAa,CACxB,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,CAClD,GACA,OAAO,CAAC,IAAI,CAAC;IA8EV,eAAe,CAAC,KAAK,EAAE;QAC3B,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,QAAQ,GAAG,OAAO,mBAAmB,CAAC;KAChD,GAAG,OAAO,CAAC,OAAO,CAAC;IAyCd,cAAc,CAAC,KAAK,EAAE;QAC1B,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;QAC1B,QAAQ,EAAE,SAAS,QAAQ,EAAE,CAAC;KAC/B,GAAG,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;CAgDjD"}
|