@fgv/ts-utils 5.1.0-25 → 5.1.0-27

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.
@@ -20,7 +20,7 @@
20
20
  * SOFTWARE.
21
21
  */
22
22
  import { mapResults } from './mapResults';
23
- import { fail, succeed } from './result';
23
+ import { captureResult, fail, succeed } from './result';
24
24
  /**
25
25
  * Normalizes an arbitrary JSON object
26
26
  * @public
@@ -62,6 +62,59 @@ export class Normalizer {
62
62
  }
63
63
  return fail(`normalize: Unexpected type - cannot normalize '${typeof from}'`);
64
64
  }
65
+ /**
66
+ * Produces a stable, byte-identical JSON string following RFC 8785
67
+ * (JSON Canonicalization Scheme) key-ordering rules.
68
+ *
69
+ * Builds the output string directly rather than constructing an intermediate
70
+ * JS object, so integer-string keys (`"10"`, `"2"`) retain lexicographic
71
+ * order instead of being reordered numerically by the JS engine during
72
+ * `JSON.stringify`.
73
+ *
74
+ * @param from - Any JSON-compatible value (string, number, boolean, null,
75
+ * plain object, or array). Fails for non-JSON types (Map, Set, Date,
76
+ * RegExp, function, symbol, bigint, undefined).
77
+ * @returns `Result<string>` — the canonical JSON string, or a failure if
78
+ * `from` contains non-serializable types.
79
+ * @public
80
+ */
81
+ canonicalize(from) {
82
+ return captureResult(() => this._canonicalizeRfc8785(from));
83
+ }
84
+ /**
85
+ * Recursively builds a byte-identical RFC 8785 JSON string.
86
+ * @throws For non-JSON-serializable types (non-finite numbers, Date, RegExp,
87
+ * Map, Set, class instances, function, symbol, bigint, undefined).
88
+ * Callers must wrap in captureResult.
89
+ */
90
+ _canonicalizeRfc8785(value) {
91
+ if (value === null)
92
+ return 'null';
93
+ if (typeof value === 'boolean')
94
+ return value ? 'true' : 'false';
95
+ if (typeof value === 'number') {
96
+ if (!Number.isFinite(value)) {
97
+ throw new Error(`canonicalize: non-finite number (${value}) is not representable in JSON`);
98
+ }
99
+ return JSON.stringify(value);
100
+ }
101
+ if (typeof value === 'string')
102
+ return JSON.stringify(value);
103
+ if (Array.isArray(value)) {
104
+ return '[' + value.map((item) => this._canonicalizeRfc8785(item)).join(',') + ']';
105
+ }
106
+ if (typeof value === 'object') {
107
+ const proto = Object.getPrototypeOf(value);
108
+ if (proto !== Object.prototype && proto !== null) {
109
+ throw new Error(`canonicalize: cannot serialize non-plain object (${Object.prototype.toString.call(value)})`);
110
+ }
111
+ const obj = value;
112
+ const sortedKeys = Object.keys(obj).sort((k1, k2) => this._compareKeys(k1, k2));
113
+ const pairs = sortedKeys.map((k) => JSON.stringify(k) + ':' + this._canonicalizeRfc8785(obj[k]));
114
+ return '{' + pairs.join(',') + '}';
115
+ }
116
+ throw new Error(`canonicalize: cannot serialize value of type '${typeof value}'`);
117
+ }
65
118
  /**
66
119
  * Compares two property names from some object being normalized.
67
120
  * @param k1 - First key to be compared.
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/packlets/base/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAU,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAYjD;;;GAGG;AACH,MAAM,OAAO,UAAU;IACrB;;;;;OAKG;IACI,SAAS,CAAI,IAAO;QACzB,QAAQ,OAAO,IAAI,EAAE,CAAC;YACpB,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,WAAW;gBACd,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;YACrC,KAAK,QAAQ;gBACX,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,YAAY,IAAI,IAAI,IAAI,YAAY,MAAM,EAAE,CAAC;oBACpE,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBACr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;QACvB,CAAC;QACD,IAAI,IAAI,YAAY,IAAI,EAAE,CAAC;YACzB,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,IAAI,YAAY,MAAM,EAAE,CAAC;YAC3B,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,sBAAsB;QACtB,OAAO,IAAI,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF","sourcesContent":["/*\n * Copyright (c) 2021 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { mapResults } from './mapResults';\nimport { Result, fail, succeed } from './result';\n\n/**\n * @internal\n */\nexport type Entry<T> = [string | number | symbol, T];\n\n/**\n * @internal\n */\nexport type ResultEntry<T> = [string | number | symbol, Result<T>];\n\n/**\n * Normalizes an arbitrary JSON object\n * @public\n */\nexport class Normalizer {\n /**\n * Normalizes the supplied value\n *\n * @param from - The value to be normalized\n * @returns A normalized version of the value\n */\n public normalize<T>(from: T): Result<T> {\n switch (typeof from) {\n case 'string':\n case 'bigint':\n case 'boolean':\n case 'number':\n case 'symbol':\n case 'undefined':\n return this.normalizeLiteral(from);\n case 'object':\n if (from === null || from instanceof Date || from instanceof RegExp) {\n return this.normalizeLiteral(from);\n } else if (Array.isArray(from)) {\n return this._normalizeArray(from) as unknown as Result<T>;\n } else if (from instanceof Map) {\n return succeed(new Map(this.normalizeEntries(from.entries())) as unknown as T);\n } else if (from instanceof Set) {\n return succeed(new Set(this.normalizeEntries(from.entries())) as unknown as T);\n }\n const obj: { [key in number | string | symbol]: unknown } = {};\n for (const e of this.normalizeEntries(Object.entries(from as unknown as object))) {\n obj[e[0]] = e[1];\n }\n return succeed(obj as T);\n }\n return fail(`normalize: Unexpected type - cannot normalize '${typeof from}'`);\n }\n\n /**\n * Compares two property names from some object being normalized.\n * @param k1 - First key to be compared.\n * @param k2 - Second key to be compared.\n * @returns `1` if `k1` is greater, `-1` if `k2` is greater and\n * `0` if they are equal.\n * @internal\n */\n protected _compareKeys(k1: unknown, k2: unknown): number {\n const cs1 = String(k1);\n const cs2 = String(k2);\n if (cs1 > cs2) {\n return 1;\n }\n if (cs2 > cs1) {\n return -1;\n }\n /* c8 ignore next 2 */\n return 0;\n }\n\n /**\n * Normalizes an array of object property entries (e.g. as returned by `Object.entries()`).\n * @remarks\n * Converts property names (entry key) to string and then sorts as string.\n * @param entries - The entries to be normalized.\n * @returns A normalized sorted array of entries.\n */\n public normalizeEntries<T = unknown>(entries: Iterable<Entry<T>>): Entry<T>[] {\n return Array.from(entries)\n .sort((e1, e2) => this._compareKeys(e1[0], e2[0]))\n .map((e) => [e[0], this.normalize(e[1])] as ResultEntry<T>)\n .filter((e) => e[1].isSuccess())\n .map((e) => [e[0], e[1].orThrow()]);\n }\n\n protected _normalizeArray(from: unknown[]): Result<unknown[]> {\n return mapResults(from.map((v) => this.normalize(v)));\n }\n\n /**\n * Normalizes the supplied literal value\n * @param from - The literal value to be normalized.\n * @returns A normalized value for the literal.\n */\n public normalizeLiteral<T>(from: T): Result<T> {\n // TODO: Apply configurable normalization rules\n switch (typeof from) {\n case 'string':\n return succeed(from);\n case 'bigint':\n case 'boolean':\n case 'number':\n case 'symbol':\n case 'undefined':\n return succeed(from);\n }\n if (from === null) {\n return succeed(from);\n }\n if (from instanceof Date) {\n return succeed(from);\n }\n if (from instanceof RegExp) {\n return succeed(from);\n }\n /* c8 ignore next 2 */\n return fail(`cannot normalize ${JSON.stringify(from)}`);\n }\n}\n"]}
1
+ {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/packlets/base/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAU,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAYhE;;;GAGG;AACH,MAAM,OAAO,UAAU;IACrB;;;;;OAKG;IACI,SAAS,CAAI,IAAO;QACzB,QAAQ,OAAO,IAAI,EAAE,CAAC;YACpB,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,WAAW;gBACd,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;YACrC,KAAK,QAAQ;gBACX,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,YAAY,IAAI,IAAI,IAAI,YAAY,MAAM,EAAE,CAAC;oBACpE,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBACrC,CAAC;qBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC/B,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAyB,CAAC;gBAC5D,CAAC;qBAAM,IAAI,IAAI,YAAY,GA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AC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAED;;;;OAIG;IACI,gBAAgB,CAAI,IAAO;QAChC,+CAA+C;QAC/C,QAAQ,OAAO,IAAI,EAAE,CAAC;YACpB,KAAK,QAAQ;gBACX,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;YACvB,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,WAAW;gBACd,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,IAAI,YAAY,IAAI,EAAE,CAAC;YACzB,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,IAAI,YAAY,MAAM,EAAE,CAAC;YAC3B,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,sBAAsB;QACtB,OAAO,IAAI,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF","sourcesContent":["/*\n * Copyright (c) 2021 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { mapResults } from './mapResults';\nimport { Result, captureResult, fail, succeed } from './result';\n\n/**\n * @internal\n */\nexport type Entry<T> = [string | number | symbol, T];\n\n/**\n * @internal\n */\nexport type ResultEntry<T> = [string | number | symbol, Result<T>];\n\n/**\n * Normalizes an arbitrary JSON object\n * @public\n */\nexport class Normalizer {\n /**\n * Normalizes the supplied value\n *\n * @param from - The value to be normalized\n * @returns A normalized version of the value\n */\n public normalize<T>(from: T): Result<T> {\n switch (typeof from) {\n case 'string':\n case 'bigint':\n case 'boolean':\n case 'number':\n case 'symbol':\n case 'undefined':\n return this.normalizeLiteral(from);\n case 'object':\n if (from === null || from instanceof Date || from instanceof RegExp) {\n return this.normalizeLiteral(from);\n } else if (Array.isArray(from)) {\n return this._normalizeArray(from) as unknown as Result<T>;\n } else if (from instanceof Map) {\n return succeed(new Map(this.normalizeEntries(from.entries())) as unknown as T);\n } else if (from instanceof Set) {\n return succeed(new Set(this.normalizeEntries(from.entries())) as unknown as T);\n }\n const obj: { [key in number | string | symbol]: unknown } = {};\n for (const e of this.normalizeEntries(Object.entries(from as unknown as object))) {\n obj[e[0]] = e[1];\n }\n return succeed(obj as T);\n }\n return fail(`normalize: Unexpected type - cannot normalize '${typeof from}'`);\n }\n\n /**\n * Produces a stable, byte-identical JSON string following RFC 8785\n * (JSON Canonicalization Scheme) key-ordering rules.\n *\n * Builds the output string directly rather than constructing an intermediate\n * JS object, so integer-string keys (`\"10\"`, `\"2\"`) retain lexicographic\n * order instead of being reordered numerically by the JS engine during\n * `JSON.stringify`.\n *\n * @param from - Any JSON-compatible value (string, number, boolean, null,\n * plain object, or array). Fails for non-JSON types (Map, Set, Date,\n * RegExp, function, symbol, bigint, undefined).\n * @returns `Result<string>` — the canonical JSON string, or a failure if\n * `from` contains non-serializable types.\n * @public\n */\n public canonicalize(from: unknown): Result<string> {\n return captureResult(() => this._canonicalizeRfc8785(from));\n }\n\n /**\n * Recursively builds a byte-identical RFC 8785 JSON string.\n * @throws For non-JSON-serializable types (non-finite numbers, Date, RegExp,\n * Map, Set, class instances, function, symbol, bigint, undefined).\n * Callers must wrap in captureResult.\n */\n protected _canonicalizeRfc8785(value: unknown): string {\n if (value === null) return 'null';\n if (typeof value === 'boolean') return value ? 'true' : 'false';\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) {\n throw new Error(`canonicalize: non-finite number (${value}) is not representable in JSON`);\n }\n return JSON.stringify(value);\n }\n if (typeof value === 'string') return JSON.stringify(value);\n if (Array.isArray(value)) {\n return '[' + value.map((item) => this._canonicalizeRfc8785(item)).join(',') + ']';\n }\n if (typeof value === 'object') {\n const proto = Object.getPrototypeOf(value as object) as unknown;\n if (proto !== Object.prototype && proto !== null) {\n throw new Error(\n `canonicalize: cannot serialize non-plain object (${Object.prototype.toString.call(value)})`\n );\n }\n const obj = value as Record<string, unknown>;\n const sortedKeys = Object.keys(obj).sort((k1, k2) => this._compareKeys(k1, k2));\n const pairs = sortedKeys.map((k) => JSON.stringify(k) + ':' + this._canonicalizeRfc8785(obj[k]));\n return '{' + pairs.join(',') + '}';\n }\n throw new Error(`canonicalize: cannot serialize value of type '${typeof value}'`);\n }\n\n /**\n * Compares two property names from some object being normalized.\n * @param k1 - First key to be compared.\n * @param k2 - Second key to be compared.\n * @returns `1` if `k1` is greater, `-1` if `k2` is greater and\n * `0` if they are equal.\n * @internal\n */\n protected _compareKeys(k1: unknown, k2: unknown): number {\n const cs1 = String(k1);\n const cs2 = String(k2);\n if (cs1 > cs2) {\n return 1;\n }\n if (cs2 > cs1) {\n return -1;\n }\n /* c8 ignore next 2 */\n return 0;\n }\n\n /**\n * Normalizes an array of object property entries (e.g. as returned by `Object.entries()`).\n * @remarks\n * Converts property names (entry key) to string and then sorts as string.\n * @param entries - The entries to be normalized.\n * @returns A normalized sorted array of entries.\n */\n public normalizeEntries<T = unknown>(entries: Iterable<Entry<T>>): Entry<T>[] {\n return Array.from(entries)\n .sort((e1, e2) => this._compareKeys(e1[0], e2[0]))\n .map((e) => [e[0], this.normalize(e[1])] as ResultEntry<T>)\n .filter((e) => e[1].isSuccess())\n .map((e) => [e[0], e[1].orThrow()]);\n }\n\n protected _normalizeArray(from: unknown[]): Result<unknown[]> {\n return mapResults(from.map((v) => this.normalize(v)));\n }\n\n /**\n * Normalizes the supplied literal value\n * @param from - The literal value to be normalized.\n * @returns A normalized value for the literal.\n */\n public normalizeLiteral<T>(from: T): Result<T> {\n // TODO: Apply configurable normalization rules\n switch (typeof from) {\n case 'string':\n return succeed(from);\n case 'bigint':\n case 'boolean':\n case 'number':\n case 'symbol':\n case 'undefined':\n return succeed(from);\n }\n if (from === null) {\n return succeed(from);\n }\n if (from instanceof Date) {\n return succeed(from);\n }\n if (from instanceof RegExp) {\n return succeed(from);\n }\n /* c8 ignore next 2 */\n return fail(`cannot normalize ${JSON.stringify(from)}`);\n }\n}\n"]}
@@ -4541,6 +4541,30 @@ declare class Collectible<TKEY extends string = string, TINDEX extends number =
4541
4541
  * @returns A normalized version of the value
4542
4542
  */
4543
4543
  normalize<T>(from: T): Result<T>;
4544
+ /**
4545
+ * Produces a stable, byte-identical JSON string following RFC 8785
4546
+ * (JSON Canonicalization Scheme) key-ordering rules.
4547
+ *
4548
+ * Builds the output string directly rather than constructing an intermediate
4549
+ * JS object, so integer-string keys (`"10"`, `"2"`) retain lexicographic
4550
+ * order instead of being reordered numerically by the JS engine during
4551
+ * `JSON.stringify`.
4552
+ *
4553
+ * @param from - Any JSON-compatible value (string, number, boolean, null,
4554
+ * plain object, or array). Fails for non-JSON types (Map, Set, Date,
4555
+ * RegExp, function, symbol, bigint, undefined).
4556
+ * @returns `Result<string>` — the canonical JSON string, or a failure if
4557
+ * `from` contains non-serializable types.
4558
+ * @public
4559
+ */
4560
+ canonicalize(from: unknown): Result<string>;
4561
+ /**
4562
+ * Recursively builds a byte-identical RFC 8785 JSON string.
4563
+ * @throws For non-JSON-serializable types (non-finite numbers, Date, RegExp,
4564
+ * Map, Set, class instances, function, symbol, bigint, undefined).
4565
+ * Callers must wrap in captureResult.
4566
+ */
4567
+ protected _canonicalizeRfc8785(value: unknown): string;
4544
4568
  /**
4545
4569
  * Compares two property names from some object being normalized.
4546
4570
  * @param k1 - First key to be compared.
@@ -19,6 +19,30 @@ export declare class Normalizer {
19
19
  * @returns A normalized version of the value
20
20
  */
21
21
  normalize<T>(from: T): Result<T>;
22
+ /**
23
+ * Produces a stable, byte-identical JSON string following RFC 8785
24
+ * (JSON Canonicalization Scheme) key-ordering rules.
25
+ *
26
+ * Builds the output string directly rather than constructing an intermediate
27
+ * JS object, so integer-string keys (`"10"`, `"2"`) retain lexicographic
28
+ * order instead of being reordered numerically by the JS engine during
29
+ * `JSON.stringify`.
30
+ *
31
+ * @param from - Any JSON-compatible value (string, number, boolean, null,
32
+ * plain object, or array). Fails for non-JSON types (Map, Set, Date,
33
+ * RegExp, function, symbol, bigint, undefined).
34
+ * @returns `Result<string>` — the canonical JSON string, or a failure if
35
+ * `from` contains non-serializable types.
36
+ * @public
37
+ */
38
+ canonicalize(from: unknown): Result<string>;
39
+ /**
40
+ * Recursively builds a byte-identical RFC 8785 JSON string.
41
+ * @throws For non-JSON-serializable types (non-finite numbers, Date, RegExp,
42
+ * Map, Set, class instances, function, symbol, bigint, undefined).
43
+ * Callers must wrap in captureResult.
44
+ */
45
+ protected _canonicalizeRfc8785(value: unknown): string;
22
46
  /**
23
47
  * Compares two property names from some object being normalized.
24
48
  * @param k1 - First key to be compared.
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/packlets/base/normalize.ts"],"names":[],"mappings":"AAuBA,OAAO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CAAC,CAAC,CAAC;AAEnE;;;GAGG;AACH,qBAAa,UAAU;IACrB;;;;;OAKG;IACI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IA4BvC;;;;;;;;;;;;;;;OAeG;IACI,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IAIlD;;;;;OAKG;IACH,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;IA4BtD;;;;;;;OAOG;IACH,SAAS,CAAC,YAAY,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,GAAG,MAAM;IAaxD;;;;;;OAMG;IACI,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE;IAQ7E,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IAI7D;;;;OAIG;IACI,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;CAwB/C"}
@@ -65,6 +65,59 @@ class Normalizer {
65
65
  }
66
66
  return (0, result_1.fail)(`normalize: Unexpected type - cannot normalize '${typeof from}'`);
67
67
  }
68
+ /**
69
+ * Produces a stable, byte-identical JSON string following RFC 8785
70
+ * (JSON Canonicalization Scheme) key-ordering rules.
71
+ *
72
+ * Builds the output string directly rather than constructing an intermediate
73
+ * JS object, so integer-string keys (`"10"`, `"2"`) retain lexicographic
74
+ * order instead of being reordered numerically by the JS engine during
75
+ * `JSON.stringify`.
76
+ *
77
+ * @param from - Any JSON-compatible value (string, number, boolean, null,
78
+ * plain object, or array). Fails for non-JSON types (Map, Set, Date,
79
+ * RegExp, function, symbol, bigint, undefined).
80
+ * @returns `Result<string>` — the canonical JSON string, or a failure if
81
+ * `from` contains non-serializable types.
82
+ * @public
83
+ */
84
+ canonicalize(from) {
85
+ return (0, result_1.captureResult)(() => this._canonicalizeRfc8785(from));
86
+ }
87
+ /**
88
+ * Recursively builds a byte-identical RFC 8785 JSON string.
89
+ * @throws For non-JSON-serializable types (non-finite numbers, Date, RegExp,
90
+ * Map, Set, class instances, function, symbol, bigint, undefined).
91
+ * Callers must wrap in captureResult.
92
+ */
93
+ _canonicalizeRfc8785(value) {
94
+ if (value === null)
95
+ return 'null';
96
+ if (typeof value === 'boolean')
97
+ return value ? 'true' : 'false';
98
+ if (typeof value === 'number') {
99
+ if (!Number.isFinite(value)) {
100
+ throw new Error(`canonicalize: non-finite number (${value}) is not representable in JSON`);
101
+ }
102
+ return JSON.stringify(value);
103
+ }
104
+ if (typeof value === 'string')
105
+ return JSON.stringify(value);
106
+ if (Array.isArray(value)) {
107
+ return '[' + value.map((item) => this._canonicalizeRfc8785(item)).join(',') + ']';
108
+ }
109
+ if (typeof value === 'object') {
110
+ const proto = Object.getPrototypeOf(value);
111
+ if (proto !== Object.prototype && proto !== null) {
112
+ throw new Error(`canonicalize: cannot serialize non-plain object (${Object.prototype.toString.call(value)})`);
113
+ }
114
+ const obj = value;
115
+ const sortedKeys = Object.keys(obj).sort((k1, k2) => this._compareKeys(k1, k2));
116
+ const pairs = sortedKeys.map((k) => JSON.stringify(k) + ':' + this._canonicalizeRfc8785(obj[k]));
117
+ return '{' + pairs.join(',') + '}';
118
+ }
119
+ throw new Error(`canonicalize: cannot serialize value of type '${typeof value}'`);
120
+ }
68
121
  /**
69
122
  * Compares two property names from some object being normalized.
70
123
  * @param k1 - First key to be compared.
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/packlets/base/normalize.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,6CAA0C;AAC1C,qCAAiD;AAYjD;;;GAGG;AACH,MAAa,UAAU;IACrB;;;;;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AI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAED;;;;OAIG;IACI,gBAAgB,CAAI,IAAO;QAChC,+CAA+C;QAC/C,QAAQ,OAAO,IAAI,EAAE,CAAC;YACpB,KAAK,QAAQ;gBACX,OAAO,IAAA,gBAAO,EAAC,IAAI,CAAC,CAAC;YACvB,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,WAAW;gBACd,OAAO,IAAA,gBAAO,EAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,OAAO,IAAA,gBAAO,EAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,IAAI,YAAY,IAAI,EAAE,CAAC;YACzB,OAAO,IAAA,gBAAO,EAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,IAAI,YAAY,MAAM,EAAE,CAAC;YAC3B,OAAO,IAAA,gBAAO,EAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,sBAAsB;QACtB,OAAO,IAAA,aAAI,EAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF;AAxGD,gCAwGC","sourcesContent":["/*\n * Copyright (c) 2021 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { mapResults } from './mapResults';\nimport { Result, fail, succeed } from './result';\n\n/**\n * @internal\n */\nexport type Entry<T> = [string | number | symbol, T];\n\n/**\n * @internal\n */\nexport type ResultEntry<T> = [string | number | symbol, Result<T>];\n\n/**\n * Normalizes an arbitrary JSON object\n * @public\n */\nexport class Normalizer {\n /**\n * Normalizes the supplied value\n *\n * @param from - The value to be normalized\n * @returns A normalized version of the value\n */\n public normalize<T>(from: T): Result<T> {\n switch (typeof from) {\n case 'string':\n case 'bigint':\n case 'boolean':\n case 'number':\n case 'symbol':\n case 'undefined':\n return this.normalizeLiteral(from);\n case 'object':\n if (from === null || from instanceof Date || from instanceof RegExp) {\n return this.normalizeLiteral(from);\n } else if (Array.isArray(from)) {\n return this._normalizeArray(from) as unknown as Result<T>;\n } else if (from instanceof Map) {\n return succeed(new Map(this.normalizeEntries(from.entries())) as unknown as T);\n } else if (from instanceof Set) {\n return succeed(new Set(this.normalizeEntries(from.entries())) as unknown as T);\n }\n const obj: { [key in number | string | symbol]: unknown } = {};\n for (const e of this.normalizeEntries(Object.entries(from as unknown as object))) {\n obj[e[0]] = e[1];\n }\n return succeed(obj as T);\n }\n return fail(`normalize: Unexpected type - cannot normalize '${typeof from}'`);\n }\n\n /**\n * Compares two property names from some object being normalized.\n * @param k1 - First key to be compared.\n * @param k2 - Second key to be compared.\n * @returns `1` if `k1` is greater, `-1` if `k2` is greater and\n * `0` if they are equal.\n * @internal\n */\n protected _compareKeys(k1: unknown, k2: unknown): number {\n const cs1 = String(k1);\n const cs2 = String(k2);\n if (cs1 > cs2) {\n return 1;\n }\n if (cs2 > cs1) {\n return -1;\n }\n /* c8 ignore next 2 */\n return 0;\n }\n\n /**\n * Normalizes an array of object property entries (e.g. as returned by `Object.entries()`).\n * @remarks\n * Converts property names (entry key) to string and then sorts as string.\n * @param entries - The entries to be normalized.\n * @returns A normalized sorted array of entries.\n */\n public normalizeEntries<T = unknown>(entries: Iterable<Entry<T>>): Entry<T>[] {\n return Array.from(entries)\n .sort((e1, e2) => this._compareKeys(e1[0], e2[0]))\n .map((e) => [e[0], this.normalize(e[1])] as ResultEntry<T>)\n .filter((e) => e[1].isSuccess())\n .map((e) => [e[0], e[1].orThrow()]);\n }\n\n protected _normalizeArray(from: unknown[]): Result<unknown[]> {\n return mapResults(from.map((v) => this.normalize(v)));\n }\n\n /**\n * Normalizes the supplied literal value\n * @param from - The literal value to be normalized.\n * @returns A normalized value for the literal.\n */\n public normalizeLiteral<T>(from: T): Result<T> {\n // TODO: Apply configurable normalization rules\n switch (typeof from) {\n case 'string':\n return succeed(from);\n case 'bigint':\n case 'boolean':\n case 'number':\n case 'symbol':\n case 'undefined':\n return succeed(from);\n }\n if (from === null) {\n return succeed(from);\n }\n if (from instanceof Date) {\n return succeed(from);\n }\n if (from instanceof RegExp) {\n return succeed(from);\n }\n /* c8 ignore next 2 */\n return fail(`cannot normalize ${JSON.stringify(from)}`);\n }\n}\n"]}
1
+ {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/packlets/base/normalize.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,6CAA0C;AAC1C,qCAAgE;AAYhE;;;GAGG;AACH,MAAa,UAAU;IACrB;;;;;OAKG;IACI,SAAS,CAAI,IAAO;QACzB,QAAQ,OAAO,IAAI,EAAE,CAAC;YACpB,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ,CAAC;YACd,KAAK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AoB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF;AA9JD,gCA8JC","sourcesContent":["/*\n * Copyright (c) 2021 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { mapResults } from './mapResults';\nimport { Result, captureResult, fail, succeed } from './result';\n\n/**\n * @internal\n */\nexport type Entry<T> = [string | number | symbol, T];\n\n/**\n * @internal\n */\nexport type ResultEntry<T> = [string | number | symbol, Result<T>];\n\n/**\n * Normalizes an arbitrary JSON object\n * @public\n */\nexport class Normalizer {\n /**\n * Normalizes the supplied value\n *\n * @param from - The value to be normalized\n * @returns A normalized version of the value\n */\n public normalize<T>(from: T): Result<T> {\n switch (typeof from) {\n case 'string':\n case 'bigint':\n case 'boolean':\n case 'number':\n case 'symbol':\n case 'undefined':\n return this.normalizeLiteral(from);\n case 'object':\n if (from === null || from instanceof Date || from instanceof RegExp) {\n return this.normalizeLiteral(from);\n } else if (Array.isArray(from)) {\n return this._normalizeArray(from) as unknown as Result<T>;\n } else if (from instanceof Map) {\n return succeed(new Map(this.normalizeEntries(from.entries())) as unknown as T);\n } else if (from instanceof Set) {\n return succeed(new Set(this.normalizeEntries(from.entries())) as unknown as T);\n }\n const obj: { [key in number | string | symbol]: unknown } = {};\n for (const e of this.normalizeEntries(Object.entries(from as unknown as object))) {\n obj[e[0]] = e[1];\n }\n return succeed(obj as T);\n }\n return fail(`normalize: Unexpected type - cannot normalize '${typeof from}'`);\n }\n\n /**\n * Produces a stable, byte-identical JSON string following RFC 8785\n * (JSON Canonicalization Scheme) key-ordering rules.\n *\n * Builds the output string directly rather than constructing an intermediate\n * JS object, so integer-string keys (`\"10\"`, `\"2\"`) retain lexicographic\n * order instead of being reordered numerically by the JS engine during\n * `JSON.stringify`.\n *\n * @param from - Any JSON-compatible value (string, number, boolean, null,\n * plain object, or array). Fails for non-JSON types (Map, Set, Date,\n * RegExp, function, symbol, bigint, undefined).\n * @returns `Result<string>` — the canonical JSON string, or a failure if\n * `from` contains non-serializable types.\n * @public\n */\n public canonicalize(from: unknown): Result<string> {\n return captureResult(() => this._canonicalizeRfc8785(from));\n }\n\n /**\n * Recursively builds a byte-identical RFC 8785 JSON string.\n * @throws For non-JSON-serializable types (non-finite numbers, Date, RegExp,\n * Map, Set, class instances, function, symbol, bigint, undefined).\n * Callers must wrap in captureResult.\n */\n protected _canonicalizeRfc8785(value: unknown): string {\n if (value === null) return 'null';\n if (typeof value === 'boolean') return value ? 'true' : 'false';\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) {\n throw new Error(`canonicalize: non-finite number (${value}) is not representable in JSON`);\n }\n return JSON.stringify(value);\n }\n if (typeof value === 'string') return JSON.stringify(value);\n if (Array.isArray(value)) {\n return '[' + value.map((item) => this._canonicalizeRfc8785(item)).join(',') + ']';\n }\n if (typeof value === 'object') {\n const proto = Object.getPrototypeOf(value as object) as unknown;\n if (proto !== Object.prototype && proto !== null) {\n throw new Error(\n `canonicalize: cannot serialize non-plain object (${Object.prototype.toString.call(value)})`\n );\n }\n const obj = value as Record<string, unknown>;\n const sortedKeys = Object.keys(obj).sort((k1, k2) => this._compareKeys(k1, k2));\n const pairs = sortedKeys.map((k) => JSON.stringify(k) + ':' + this._canonicalizeRfc8785(obj[k]));\n return '{' + pairs.join(',') + '}';\n }\n throw new Error(`canonicalize: cannot serialize value of type '${typeof value}'`);\n }\n\n /**\n * Compares two property names from some object being normalized.\n * @param k1 - First key to be compared.\n * @param k2 - Second key to be compared.\n * @returns `1` if `k1` is greater, `-1` if `k2` is greater and\n * `0` if they are equal.\n * @internal\n */\n protected _compareKeys(k1: unknown, k2: unknown): number {\n const cs1 = String(k1);\n const cs2 = String(k2);\n if (cs1 > cs2) {\n return 1;\n }\n if (cs2 > cs1) {\n return -1;\n }\n /* c8 ignore next 2 */\n return 0;\n }\n\n /**\n * Normalizes an array of object property entries (e.g. as returned by `Object.entries()`).\n * @remarks\n * Converts property names (entry key) to string and then sorts as string.\n * @param entries - The entries to be normalized.\n * @returns A normalized sorted array of entries.\n */\n public normalizeEntries<T = unknown>(entries: Iterable<Entry<T>>): Entry<T>[] {\n return Array.from(entries)\n .sort((e1, e2) => this._compareKeys(e1[0], e2[0]))\n .map((e) => [e[0], this.normalize(e[1])] as ResultEntry<T>)\n .filter((e) => e[1].isSuccess())\n .map((e) => [e[0], e[1].orThrow()]);\n }\n\n protected _normalizeArray(from: unknown[]): Result<unknown[]> {\n return mapResults(from.map((v) => this.normalize(v)));\n }\n\n /**\n * Normalizes the supplied literal value\n * @param from - The literal value to be normalized.\n * @returns A normalized value for the literal.\n */\n public normalizeLiteral<T>(from: T): Result<T> {\n // TODO: Apply configurable normalization rules\n switch (typeof from) {\n case 'string':\n return succeed(from);\n case 'bigint':\n case 'boolean':\n case 'number':\n case 'symbol':\n case 'undefined':\n return succeed(from);\n }\n if (from === null) {\n return succeed(from);\n }\n if (from instanceof Date) {\n return succeed(from);\n }\n if (from instanceof RegExp) {\n return succeed(from);\n }\n /* c8 ignore next 2 */\n return fail(`cannot normalize ${JSON.stringify(from)}`);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fgv/ts-utils",
3
- "version": "5.1.0-25",
3
+ "version": "5.1.0-27",
4
4
  "description": "Assorted Typescript Utilities",
5
5
  "main": "lib/index.js",
6
6
  "module": "dist/index.js",
@@ -54,8 +54,8 @@
54
54
  "@rushstack/heft-jest-plugin": "1.2.6",
55
55
  "eslint-plugin-tsdoc": "~0.5.2",
56
56
  "typedoc": "~0.28.16",
57
- "@fgv/heft-dual-rig": "5.1.0-25",
58
- "@fgv/typedoc-compact-theme": "5.1.0-25"
57
+ "@fgv/heft-dual-rig": "5.1.0-27",
58
+ "@fgv/typedoc-compact-theme": "5.1.0-27"
59
59
  },
60
60
  "repository": {
61
61
  "type": "git",