@did-btcr2/common 2.2.2 → 3.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/dist/cjs/canonicalization.js +66 -54
- package/dist/cjs/canonicalization.js.map +1 -1
- package/dist/cjs/constants.js +17 -11
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/index.js +5 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/json-patch.js +98 -0
- package/dist/cjs/json-patch.js.map +1 -0
- package/dist/cjs/logger.js +46 -12
- package/dist/cjs/logger.js.map +1 -1
- package/dist/cjs/utils/date.js +32 -0
- package/dist/cjs/utils/date.js.map +1 -0
- package/dist/cjs/utils/json.js +280 -0
- package/dist/cjs/utils/json.js.map +1 -0
- package/dist/cjs/utils/set.js +23 -0
- package/dist/cjs/utils/set.js.map +1 -0
- package/dist/cjs/utils/string.js +55 -0
- package/dist/cjs/utils/string.js.map +1 -0
- package/dist/esm/canonicalization.js +66 -54
- package/dist/esm/canonicalization.js.map +1 -1
- package/dist/esm/constants.js +17 -11
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/index.js +5 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/json-patch.js +98 -0
- package/dist/esm/json-patch.js.map +1 -0
- package/dist/esm/logger.js +46 -12
- package/dist/esm/logger.js.map +1 -1
- package/dist/esm/utils/date.js +32 -0
- package/dist/esm/utils/date.js.map +1 -0
- package/dist/esm/utils/json.js +280 -0
- package/dist/esm/utils/json.js.map +1 -0
- package/dist/esm/utils/set.js +23 -0
- package/dist/esm/utils/set.js.map +1 -0
- package/dist/esm/utils/string.js +55 -0
- package/dist/esm/utils/string.js.map +1 -0
- package/dist/types/canonicalization.d.ts +38 -29
- package/dist/types/canonicalization.d.ts.map +1 -1
- package/dist/types/constants.d.ts +6 -8
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/interfaces.d.ts +2 -2
- package/dist/types/interfaces.d.ts.map +1 -1
- package/dist/types/json-patch.d.ts +47 -0
- package/dist/types/json-patch.d.ts.map +1 -0
- package/dist/types/logger.d.ts +31 -8
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/types.d.ts +11 -4
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/date.d.ts +19 -0
- package/dist/types/utils/date.d.ts.map +1 -0
- package/dist/types/utils/json.d.ts +89 -0
- package/dist/types/utils/json.d.ts.map +1 -0
- package/dist/types/utils/set.d.ts +14 -0
- package/dist/types/utils/set.d.ts.map +1 -0
- package/dist/types/utils/string.d.ts +39 -0
- package/dist/types/utils/string.d.ts.map +1 -0
- package/package.json +3 -4
- package/src/canonicalization.ts +75 -58
- package/src/constants.ts +19 -12
- package/src/index.ts +5 -5
- package/src/interfaces.ts +2 -2
- package/src/json-patch.ts +103 -0
- package/src/logger.ts +59 -27
- package/src/types.ts +11 -6
- package/src/utils/date.ts +32 -0
- package/src/utils/json.ts +315 -0
- package/src/utils/set.ts +23 -0
- package/src/utils/string.ts +59 -0
- package/dist/cjs/exts.js +0 -189
- package/dist/cjs/exts.js.map +0 -1
- package/dist/cjs/patch.js +0 -163
- package/dist/cjs/patch.js.map +0 -1
- package/dist/esm/exts.js +0 -189
- package/dist/esm/exts.js.map +0 -1
- package/dist/esm/patch.js +0 -163
- package/dist/esm/patch.js.map +0 -1
- package/dist/types/exts.d.ts +0 -90
- package/dist/types/exts.d.ts.map +0 -1
- package/dist/types/patch.d.ts +0 -63
- package/dist/types/patch.d.ts.map +0 -1
- package/src/exts.ts +0 -310
- package/src/patch.ts +0 -181
- package/src/rdf-canonize.d.ts +0 -6
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility class for set operations.
|
|
3
|
+
* @name SetUtils
|
|
4
|
+
* @class SetUtils
|
|
5
|
+
*/
|
|
6
|
+
export class SetUtils {
|
|
7
|
+
/**
|
|
8
|
+
* Compute the set difference without mutating the inputs.
|
|
9
|
+
* @param {Set<T>} left - The left set.
|
|
10
|
+
* @param {Set<T>} right - The right set.
|
|
11
|
+
* @returns {Set<T>} A new set containing elements in `left` that are not in `right`.
|
|
12
|
+
*/
|
|
13
|
+
static difference(left, right) {
|
|
14
|
+
const result = new Set();
|
|
15
|
+
for (const value of left) {
|
|
16
|
+
if (!right.has(value)) {
|
|
17
|
+
result.add(value);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set.js","sourceRoot":"","sources":["../../../src/utils/set.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,QAAQ;IACnB;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAI,IAAY,EAAE,KAAa;QAC9C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAK,CAAC;QAC5B,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;YACzB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtB,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility class string-related operations.
|
|
3
|
+
* @name StringUtils
|
|
4
|
+
* @class StringUtils
|
|
5
|
+
*/
|
|
6
|
+
export class StringUtils {
|
|
7
|
+
/**
|
|
8
|
+
* Escape special characters in a string for use in a regular expression.
|
|
9
|
+
* @param {string} value - The string to escape.
|
|
10
|
+
* @returns {string} The escaped string.
|
|
11
|
+
*/
|
|
12
|
+
static escapeRegExp(value) {
|
|
13
|
+
return value.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Convert a camelCase string to snake_case.
|
|
17
|
+
* @param {string} value - The camelCase string to convert.
|
|
18
|
+
* @returns {string} The converted snake_case string.
|
|
19
|
+
*/
|
|
20
|
+
static toSnake(value) {
|
|
21
|
+
return value
|
|
22
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1_$2')
|
|
23
|
+
.toLowerCase();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Convert a string to SNAKE_SCREAMING_CASE.
|
|
27
|
+
* @param {string} value - The string to convert.
|
|
28
|
+
* @returns {string} The converted SNAKE_SCREAMING_CASE string.
|
|
29
|
+
*/
|
|
30
|
+
static toSnakeScream(value) {
|
|
31
|
+
return this.toSnake(value).toUpperCase();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Remove the last character from a string.
|
|
35
|
+
* @param {string} value - The string to chop.
|
|
36
|
+
* @returns {string} The chopped string.
|
|
37
|
+
*/
|
|
38
|
+
static chop(value) {
|
|
39
|
+
return value.length > 0 ? value.slice(0, -1) : '';
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Replace the end of a string if it matches a given pattern.
|
|
43
|
+
* @param {string} value - The string to modify.
|
|
44
|
+
* @param {string | RegExp} pattern - The pattern to match at the end of the string.
|
|
45
|
+
* @param {string} [replacement=''] - The replacement string.
|
|
46
|
+
* @returns {string} The modified string.
|
|
47
|
+
*/
|
|
48
|
+
static replaceEnd(value, pattern, replacement = '') {
|
|
49
|
+
const regex = pattern instanceof RegExp
|
|
50
|
+
? new RegExp(pattern.source.endsWith('$') ? pattern.source : `${pattern.source}$`, pattern.flags.replace(/g/g, ''))
|
|
51
|
+
: new RegExp(`${this.escapeRegExp(pattern)}$`);
|
|
52
|
+
return value.replace(regex, replacement);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"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C,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CanonicalizationAlgorithm,
|
|
1
|
+
import { CanonicalizationAlgorithm, CanonicalizationEncoding, HashBytes } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Canonicalization class provides methods for canonicalizing JSON objects
|
|
4
4
|
* and hashing them using SHA-256. It supports different canonicalization
|
|
@@ -7,22 +7,31 @@ import { CanonicalizationAlgorithm, HashBytes, JSONObject } from './types.js';
|
|
|
7
7
|
* @type {Canonicalization}
|
|
8
8
|
*/
|
|
9
9
|
export declare class Canonicalization {
|
|
10
|
-
private
|
|
10
|
+
private readonly _defaultAlgorithm;
|
|
11
11
|
/**
|
|
12
12
|
* Initializes the Canonicalization class with the specified algorithm.
|
|
13
|
-
* @param {CanonicalizationAlgorithm} algorithm The canonicalization algorithm to use ('jcs'
|
|
13
|
+
* @param {CanonicalizationAlgorithm} algorithm The canonicalization algorithm to use ('jcs').
|
|
14
14
|
*/
|
|
15
15
|
constructor(algorithm?: CanonicalizationAlgorithm);
|
|
16
|
-
/**
|
|
17
|
-
* Sets the canonicalization algorithm.
|
|
18
|
-
* @param {'jcs' | 'rdfc'} algorithm Either 'jcs' or 'rdfc'.
|
|
19
|
-
*/
|
|
20
|
-
set algorithm(algorithm: 'jcs' | 'rdfc');
|
|
21
16
|
/**
|
|
22
17
|
* Gets the canonicalization algorithm.
|
|
23
18
|
* @returns {CanonicalizationAlgorithm} The current canonicalization algorithm.
|
|
24
19
|
*/
|
|
25
20
|
get algorithm(): CanonicalizationAlgorithm;
|
|
21
|
+
/**
|
|
22
|
+
* Normalizes the canonicalization algorithm.
|
|
23
|
+
* @param {CanonicalizationAlgorithm} algorithm
|
|
24
|
+
* @returns {CanonicalizationAlgorithm} The normalized algorithm.
|
|
25
|
+
* @throws {CanonicalizationError} If the algorithm is not supported.
|
|
26
|
+
*/
|
|
27
|
+
static normalizeAlgorithm(algorithm: CanonicalizationAlgorithm): CanonicalizationAlgorithm;
|
|
28
|
+
/**
|
|
29
|
+
* Normalizes the canonicalization encoding.
|
|
30
|
+
* @param {CanonicalizationEncoding} encoding - The encoding to normalize.
|
|
31
|
+
* @returns {CanonicalizationEncoding} The normalized encoding.
|
|
32
|
+
* @throws {CanonicalizationError} If the encoding is not supported.
|
|
33
|
+
*/
|
|
34
|
+
static normalizeEncoding(encoding: CanonicalizationEncoding): CanonicalizationEncoding;
|
|
26
35
|
/**
|
|
27
36
|
* Implements {@link http://dcdpr.github.io/did-btcr2/#json-canonicalization-and-hash | 9.2 JSON Canonicalization and Hash}.
|
|
28
37
|
*
|
|
@@ -30,31 +39,32 @@ export declare class Canonicalization {
|
|
|
30
39
|
* Scheme. The function returns the canonicalizedBytes.
|
|
31
40
|
*
|
|
32
41
|
* Optionally encodes a sha256 hashed canonicalized JSON object.
|
|
33
|
-
* Step 1 Canonicalize (JCS
|
|
42
|
+
* Step 1 Canonicalize (JCS) → Step 2 Hash (SHA256) → Step 3 Encode (Hex/Base58).
|
|
34
43
|
*
|
|
35
|
-
* @param {
|
|
36
|
-
* @param {
|
|
44
|
+
* @param {Record<any, any>} object The object to process.
|
|
45
|
+
* @param {Object} [options] Options for processing.
|
|
46
|
+
* @param {CanonicalizationEncoding} [options.encoding='hex'] The encoding format ('hex' or 'base58').
|
|
47
|
+
* @param {CanonicalizationAlgorithm} [options.algorithm] The canonicalization algorithm to use.
|
|
37
48
|
* @returns {Promise<string>} The final SHA-256 hash bytes as a hex string.
|
|
38
49
|
*/
|
|
39
|
-
process(object:
|
|
50
|
+
process(object: Record<any, any>, options?: {
|
|
51
|
+
encoding?: CanonicalizationEncoding;
|
|
52
|
+
algorithm?: CanonicalizationAlgorithm;
|
|
53
|
+
multibase?: boolean;
|
|
54
|
+
}): Promise<string>;
|
|
40
55
|
/**
|
|
41
|
-
* Step 1: Uses this.algorithm to determine the method (JCS
|
|
42
|
-
* @param {
|
|
56
|
+
* Step 1: Uses this.algorithm to determine the method (JCS).
|
|
57
|
+
* @param {Record<any, any>} object The object to canonicalize.
|
|
58
|
+
* @param {CanonicalizationAlgorithm} [algorithm] The algorithm to use.
|
|
43
59
|
* @returns {Promise<string>} The canonicalized object.
|
|
44
60
|
*/
|
|
45
|
-
canonicalize(object:
|
|
61
|
+
canonicalize(object: Record<any, any>, algorithm?: CanonicalizationAlgorithm): Promise<string>;
|
|
46
62
|
/**
|
|
47
63
|
* Step 1: Canonicalizes an object using JCS (JSON Canonicalization Scheme).
|
|
48
|
-
* @param {
|
|
64
|
+
* @param {Record<any, any>} object The object to canonicalize.
|
|
49
65
|
* @returns {string} The canonicalized object.
|
|
50
66
|
*/
|
|
51
|
-
jcs(object:
|
|
52
|
-
/**
|
|
53
|
-
* Step 1: Canonicalizes an object using RDF Canonicalization (RDFC).
|
|
54
|
-
* @param {JSONObject} object The object to canonicalize.
|
|
55
|
-
* @returns {Promise<string>} The canonicalized object.
|
|
56
|
-
*/
|
|
57
|
-
rdfc(object: JSONObject): Promise<string>;
|
|
67
|
+
jcs(object: Record<any, any>): string;
|
|
58
68
|
/**
|
|
59
69
|
* Step 2: SHA-256 hashes a canonicalized object.
|
|
60
70
|
* @param {string} canonicalized The canonicalized object.
|
|
@@ -64,11 +74,11 @@ export declare class Canonicalization {
|
|
|
64
74
|
/**
|
|
65
75
|
* Step 3: Encodes SHA-256 hashed, canonicalized object as a hex or base58 string.
|
|
66
76
|
* @param {string} canonicalizedhash The canonicalized object to encode.
|
|
67
|
-
* @param {
|
|
77
|
+
* @param {CanonicalizationEncoding} encoding The encoding format ('hex' or 'base58').
|
|
68
78
|
* @throws {CanonicalizationError} If the encoding format is not supported.
|
|
69
79
|
* @returns {string} The encoded string.
|
|
70
80
|
*/
|
|
71
|
-
encode(canonicalizedhash: HashBytes, encoding?:
|
|
81
|
+
encode(canonicalizedhash: HashBytes, encoding?: CanonicalizationEncoding, multibase?: boolean): string;
|
|
72
82
|
/**
|
|
73
83
|
* Step 3.1: Encodes HashBytes (Uint8Array) to a hex string.
|
|
74
84
|
* @param {HashBytes} hashBytes The hash as a Uint8Array.
|
|
@@ -84,10 +94,10 @@ export declare class Canonicalization {
|
|
|
84
94
|
/**
|
|
85
95
|
* Canonicalizes an object, hashes it and returns it as hash bytes.
|
|
86
96
|
* Step 1-2: Canonicalize → Hash.
|
|
87
|
-
* @param {
|
|
97
|
+
* @param {Record<any, any>} object The object to process.
|
|
88
98
|
* @returns {Promise<HashBytes>} The final SHA-256 hash bytes.
|
|
89
99
|
*/
|
|
90
|
-
canonicalhash(object:
|
|
100
|
+
canonicalhash(object: Record<any, any>, algorithm?: CanonicalizationAlgorithm): Promise<HashBytes>;
|
|
91
101
|
/**
|
|
92
102
|
* Computes the SHA-256 hash of a canonicalized object and encodes it as a hex string.
|
|
93
103
|
* Step 2-3: Hash → Encode(Hex).
|
|
@@ -101,6 +111,5 @@ export declare class Canonicalization {
|
|
|
101
111
|
* @param {string} canonicalized The canonicalized object to hash.
|
|
102
112
|
* @returns {string} The SHA-256 hash as a base58 string.
|
|
103
113
|
*/
|
|
104
|
-
|
|
114
|
+
hashbase58(canonicalized: string): string;
|
|
105
115
|
}
|
|
106
|
-
export declare const canonicalization: Canonicalization;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonicalization.d.ts","sourceRoot":"","sources":["../../src/canonicalization.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,
|
|
1
|
+
{"version":3,"file":"canonicalization.d.ts","sourceRoot":"","sources":["../../src/canonicalization.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5F;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA4B;IAE9D;;;OAGG;gBACS,SAAS,GAAE,yBAAiC;IAIxD;;;OAGG;IACH,IAAI,SAAS,IAAI,yBAAyB,CAEzC;IAED;;;;;OAKG;IACH,MAAM,CAA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@@ -7,14 +7,7 @@ export declare const MULTIBASE_URI_PREFIX = "urn:mb:";
|
|
|
7
7
|
export declare const INITIAL_BLOCK_REWARD = 50;
|
|
8
8
|
export declare const HALVING_INTERVAL = 150;
|
|
9
9
|
export declare const COINBASE_MATURITY_DELAY = 100;
|
|
10
|
-
export declare const
|
|
11
|
-
username: string;
|
|
12
|
-
password: string;
|
|
13
|
-
host: string;
|
|
14
|
-
allowDefaultWallet: boolean;
|
|
15
|
-
version: string;
|
|
16
|
-
};
|
|
17
|
-
export declare const POLAR_ALICE_CLIENT_CONFIG: {
|
|
10
|
+
export declare const DEFAULT_POLAR_CONFIG: {
|
|
18
11
|
username: string;
|
|
19
12
|
password: string;
|
|
20
13
|
host: string;
|
|
@@ -32,6 +25,11 @@ export declare const DEFAULT_RPC_CONFIG: {
|
|
|
32
25
|
version: string;
|
|
33
26
|
};
|
|
34
27
|
export declare const DEFAULT_BLOCK_CONFIRMATIONS = 7;
|
|
28
|
+
/**
|
|
29
|
+
* Load a default RPC config, allowing environment overrides to avoid hard-coding credentials/hosts in bundles.
|
|
30
|
+
* @returns {typeof DEFAULT_POLAR_CONFIG} The RPC config.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getDefaultRpcConfig(): typeof DEFAULT_POLAR_CONFIG;
|
|
35
33
|
export declare const BIP340_PUBLIC_KEY_MULTIBASE_PREFIX: Bytes;
|
|
36
34
|
export declare const BIP340_PUBLIC_KEY_MULTIBASE_PREFIX_HASH: HashHex;
|
|
37
35
|
export declare const BIP340_SECRET_KEY_MULTIBASE_PREFIX: Bytes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,oB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AAqB,gDAAgD,CAAC;AACnF,eAAO,MAAM,eAAe,iCAAiC,CAAC;AAC9D,eAAO,MAAM,oBAAoB,iCAAiC,CAAC;AACnE,eAAO,MAAM,WAAW,6BAA6B,CAAC;AACtD,eAAO,MAAM,mBAAmB,sCAAsC,CAAC;AACvE,eAAO,MAAM,eAAe,0CAA0C,CAAC;AACvE,eAAO,MAAM,qBAAqB,uCAAuC,CAAC;AAC1E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC3B,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAGtC,CAAC;AAEF,eAAO,MAAM,sBAAsB,UAGlC,CAAC;AAEF,eAAO,MAAM,gCAAgC,UAK5C,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import './exts.js';
|
|
2
1
|
export * from './canonicalization.js';
|
|
3
2
|
export * from './constants.js';
|
|
4
3
|
export * from './errors.js';
|
|
5
4
|
export * from './interfaces.js';
|
|
5
|
+
export * from './json-patch.js';
|
|
6
6
|
export * from './logger.js';
|
|
7
|
-
export * from './patch.js';
|
|
8
7
|
export * from './types.js';
|
|
9
|
-
export * from './
|
|
8
|
+
export * from './utils/date.js';
|
|
9
|
+
export * from './utils/json.js';
|
|
10
|
+
export * from './utils/set.js';
|
|
11
|
+
export * from './utils/string.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export type JsonPatch = Array<PatchOperation>;
|
|
2
|
-
export type PatchOpCode = 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test' | string;
|
|
2
|
+
export type PatchOpCode = 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test' | (string & {});
|
|
3
3
|
/**
|
|
4
4
|
* A JSON Patch operation, as defined in {@link https://datatracker.ietf.org/doc/html/rfc6902 | RFC 6902}.
|
|
5
5
|
*/
|
|
6
6
|
export interface PatchOperation {
|
|
7
7
|
op: PatchOpCode;
|
|
8
8
|
path: string;
|
|
9
|
-
value?:
|
|
9
|
+
value?: unknown;
|
|
10
10
|
from?: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAC9C,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAC9C,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAClG;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,WAAW,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EA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AAW;IAC1B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEtC;;;;OAIG;IACH,eAAe,EAAE;QACf,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC;KACnC,CAAC;CACH;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IAEvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,iBAAiB,GACjB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IAEvB;;;OAGG;IACH,EAAE,EAAE,GAAG,CAAC;CACT;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PatchOperation } from './interfaces.js';
|
|
2
|
+
import { JSONObject } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Thin wrapper around fast-json-patch to keep a stable API within this package.
|
|
5
|
+
* @class JSONPatch
|
|
6
|
+
* @type {JSONPatch}
|
|
7
|
+
*/
|
|
8
|
+
export declare class JSONPatch {
|
|
9
|
+
/**
|
|
10
|
+
* Applies a JSON Patch to a source document and returns the patched document.
|
|
11
|
+
* Does not mutate the input document.
|
|
12
|
+
* @param {JSONObject} sourceDocument - The source JSON document to apply the patch to.
|
|
13
|
+
* @param {PatchOperation[]} operations - The JSON Patch operations to apply.
|
|
14
|
+
* @returns {JSONObject} The patched JSON document.
|
|
15
|
+
*/
|
|
16
|
+
static apply(sourceDocument: Record<any, any>, operations: PatchOperation[], options?: {
|
|
17
|
+
mutate?: boolean;
|
|
18
|
+
clone?: (value: any) => any;
|
|
19
|
+
}): Record<any, any>;
|
|
20
|
+
/**
|
|
21
|
+
* Compute a JSON Patch diff from source => target.
|
|
22
|
+
* @param {JSONObject} sourceDocument - The source JSON document.
|
|
23
|
+
* @param {JSONObject} targetDocument - The target JSON document.
|
|
24
|
+
* @param {string} [path] - An optional base path to prefix to each operation.
|
|
25
|
+
* @returns {PatchOperation[]} The computed JSON Patch operations.
|
|
26
|
+
*/
|
|
27
|
+
static diff(sourceDocument: JSONObject, targetDocument: JSONObject, path?: string): PatchOperation[];
|
|
28
|
+
/**
|
|
29
|
+
* Join a base pointer prefix with an operation path ensuring correct escaping.
|
|
30
|
+
* @param {string} prefix - The base pointer prefix.
|
|
31
|
+
* @param {string} opPath - The operation path.
|
|
32
|
+
* @returns {string} The joined pointer.
|
|
33
|
+
*/
|
|
34
|
+
static joinPointer(prefix: string, opPath: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Escape a JSON Pointer segment according to RFC 6901.
|
|
37
|
+
* @param {string} pointer - The JSON Pointer to escape.
|
|
38
|
+
* @returns {string} The escaped JSON Pointer.
|
|
39
|
+
*/
|
|
40
|
+
static escapeSegmentPath(pointer: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Validate JSON Patch operations.
|
|
43
|
+
* @param {PatchOperation[]} operations - The operations to validate.
|
|
44
|
+
* @returns {Error | null} An Error if validation fails, otherwise null.
|
|
45
|
+
*/
|
|
46
|
+
static validateOperations(operations: PatchOperation[]): Error | null;
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-patch.d.ts","sourceRoot":"","sources":["../../src/json-patch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAIxC;;;;GAIG;AACH,qBAAa,SAAS;IACpB;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,CACV,cAAc,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAChC,UAAU,EAAE,cAAc,EAAE,EAC5B,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAA;KAAO,GAC9D,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC;IAmBnB;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,GAAE,MAAW,GAAG,cAAc,EAAE;IAWxG;;;;;KAKC;IACD,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAM1D;;;;KAIC;IACD,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAOjD;;;;KAIC;IACD,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,cAAc,EAAE,GAAG,KAAK,GAAG,IAAI;CAYtE"}
|
package/dist/types/logger.d.ts
CHANGED
|
@@ -12,24 +12,46 @@ export declare const NODE_ENV: Env;
|
|
|
12
12
|
* - File/line tracing
|
|
13
13
|
* - Timestamps
|
|
14
14
|
* - Colorized output
|
|
15
|
+
* @class Logger
|
|
16
|
+
* @type {Logger}
|
|
15
17
|
*/
|
|
16
18
|
export declare class Logger {
|
|
17
19
|
private levels;
|
|
18
20
|
private namespace?;
|
|
19
|
-
|
|
21
|
+
private useColors;
|
|
22
|
+
private static shared;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new Logger instance.
|
|
25
|
+
* @param {string} namespace - Optional namespace for log messages.
|
|
26
|
+
* @param {Object} options - Configuration options.
|
|
27
|
+
* @param {Level[]} options.levels - Log levels to enable.
|
|
28
|
+
* @param {boolean} options.useColors - Whether to use colored output.
|
|
29
|
+
*/
|
|
30
|
+
constructor(namespace?: string, options?: {
|
|
31
|
+
levels?: Level[];
|
|
32
|
+
useColors?: boolean;
|
|
33
|
+
});
|
|
20
34
|
/**
|
|
21
35
|
* Logs a message with the specified level.
|
|
36
|
+
* @param {Level} level - The log level.
|
|
37
|
+
* @param {unknown} message - The message to log.
|
|
38
|
+
* @param {...unknown[]} args - Additional arguments to log.
|
|
39
|
+
* @returns {void}
|
|
22
40
|
*/
|
|
23
41
|
private _log;
|
|
24
|
-
debug(message?: unknown, ...args: unknown[]):
|
|
25
|
-
error(message?: unknown, ...args: unknown[]):
|
|
26
|
-
info(message?: unknown, ...args: unknown[]):
|
|
27
|
-
warn(message?: unknown, ...args: unknown[]):
|
|
28
|
-
security(message?: unknown, ...args: unknown[]):
|
|
29
|
-
log(message?: unknown, ...args: unknown[]):
|
|
30
|
-
newline():
|
|
42
|
+
debug(message?: unknown, ...args: unknown[]): Logger;
|
|
43
|
+
error(message?: unknown, ...args: unknown[]): Logger;
|
|
44
|
+
info(message?: unknown, ...args: unknown[]): Logger;
|
|
45
|
+
warn(message?: unknown, ...args: unknown[]): Logger;
|
|
46
|
+
security(message?: unknown, ...args: unknown[]): Logger;
|
|
47
|
+
log(message?: unknown, ...args: unknown[]): Logger;
|
|
48
|
+
newline(): Logger;
|
|
31
49
|
/**
|
|
32
50
|
* Static methods for convenience (auto-instantiate).
|
|
51
|
+
* These use a shared singleton instance.
|
|
52
|
+
* @param {unknown} message - The message to log.
|
|
53
|
+
* @param {...unknown[]} args - Additional arguments to log.
|
|
54
|
+
* @returns {void}
|
|
33
55
|
*/
|
|
34
56
|
static debug(message?: unknown, ...args: unknown[]): void;
|
|
35
57
|
static error(message?: unknown, ...args: unknown[]): void;
|
|
@@ -38,4 +60,5 @@ export declare class Logger {
|
|
|
38
60
|
static security(message?: unknown, ...args: unknown[]): void;
|
|
39
61
|
static log(message?: unknown, ...args: unknown[]): void;
|
|
40
62
|
static newline(): void;
|
|
63
|
+
private static instance;
|
|
41
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAEA,oBAAY,GAAG;IACb,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,IAAI,SAAS;CACd;AAED,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,CAAC;AAE7E,eAAO,MAAM,QAAQ,KAAmD,CAAC;AAoCzE
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAEA,oBAAY,GAAG;IACb,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,IAAI,SAAS;CACd;AAED,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,CAAC;AAE7E,eAAO,MAAM,QAAQ,KAAmD,CAAC;AAoCzE;;;;;;;;;GASG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,MAAM,CAAC,MAAM,CAAS;IAE9B;;;;;;OAMG;gBACS,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAO;IAOvF;;;;;;OAMG;IACH,OAAO,CAAC,IAAI;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OAAO;IAId,OAAO,CAAC,MAAM,CAAC,QAAQ;CASxB"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -67,12 +67,18 @@ export type BeaconUri = string;
|
|
|
67
67
|
export type DidPlaceholder = 'did:btcr2:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
|
|
68
68
|
export type CanonicalizedProofConfig = string;
|
|
69
69
|
export type CryptosuiteName = 'bip340-jcs-2025' | 'bip340-rdfc-2025';
|
|
70
|
-
export type
|
|
71
|
-
export type
|
|
72
|
-
export type
|
|
73
|
-
export type
|
|
70
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
71
|
+
export type JsonArray = JsonValue[];
|
|
72
|
+
export type JsonValue = JsonPrimitive | JsonArray | JsonObject;
|
|
73
|
+
export type JsonObject = {
|
|
74
|
+
[key: string]: JsonValue;
|
|
75
|
+
};
|
|
76
|
+
export type JSONObject = JsonObject;
|
|
74
77
|
export type Prototyped = JSONObject;
|
|
75
78
|
export type Unprototyped = JSONObject;
|
|
79
|
+
export type ContextObject = Record<string, JsonValue>;
|
|
80
|
+
export type Context = string | string[] | ContextObject | ContextObject[];
|
|
81
|
+
export type Maybe<T> = T | unknown;
|
|
76
82
|
export type TwoDigits = `${number}${number}`;
|
|
77
83
|
export type ThreeDigits = `${number}${number}${number}`;
|
|
78
84
|
export type Year = `${1 | 2}${ThreeDigits}`;
|
|
@@ -86,4 +92,5 @@ export type TzOffset = `${Hours}:${Minutes}`;
|
|
|
86
92
|
export type DateTimestamp = `${UtcTimestamp}Z` | `${UtcTimestamp}-${TzOffset}`;
|
|
87
93
|
export type CanonicalizableObject = Record<string, any>;
|
|
88
94
|
export type CanonicalizationAlgorithm = 'jcs' | 'rdfc';
|
|
95
|
+
export type CanonicalizationEncoding = 'hex' | 'base58';
|
|
89
96
|
export type UnixTimestamp = number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":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
+
export declare class DateUtils {
|
|
7
|
+
/**
|
|
8
|
+
* Render an ISO 8601 UTC timestamp without fractional seconds.
|
|
9
|
+
* @param {Date} [date=new Date()] - The date to format.
|
|
10
|
+
* @returns {string} The formatted date string.
|
|
11
|
+
*/
|
|
12
|
+
static getUTCDateTime(date?: Date): string;
|
|
13
|
+
/**
|
|
14
|
+
* Unix timestamp in seconds (integer).
|
|
15
|
+
* @param {Date} [date=new Date()] - The date to convert.
|
|
16
|
+
* @returns {number} The Unix timestamp in seconds.
|
|
17
|
+
*/
|
|
18
|
+
static toUnixSeconds(date?: Date): number;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,SAAS;IACpB;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM;IAQtD;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM;CAOtD"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { JSONObject, Prototyped, Unprototyped } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Options for cloning JSON values.
|
|
4
|
+
*/
|
|
5
|
+
type CloneOptions = {
|
|
6
|
+
stripPrototypes?: boolean;
|
|
7
|
+
transform?: (value: any) => any;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Utilities for working with JSON data.
|
|
11
|
+
* @name JSONUtils
|
|
12
|
+
* @class JSONUtils
|
|
13
|
+
*/
|
|
14
|
+
export declare class JSONUtils {
|
|
15
|
+
/**
|
|
16
|
+
* Check if a value is a JSON object (not an array, not null, and has Object prototype).
|
|
17
|
+
* @param {unknown} value - The value to check.
|
|
18
|
+
* @returns {boolean} True if the value is a JSON object.
|
|
19
|
+
*/
|
|
20
|
+
static isObject(value: unknown): value is JSONObject;
|
|
21
|
+
/**
|
|
22
|
+
* Check if a value is a parsable JSON string.
|
|
23
|
+
* @param {unknown} value - The value to check.
|
|
24
|
+
* @returns {boolean} True if the value is a parsable JSON string.
|
|
25
|
+
*/
|
|
26
|
+
static isParsable(value: unknown): value is string;
|
|
27
|
+
/**
|
|
28
|
+
* Check if a value is an unprototyped object (i.e., Object.create(null)).
|
|
29
|
+
* @param {unknown} value - The value to check.
|
|
30
|
+
* @returns {boolean} True if the value is an unprototyped object.
|
|
31
|
+
*/
|
|
32
|
+
static isUnprototyped(value: unknown): value is Unprototyped;
|
|
33
|
+
/**
|
|
34
|
+
* Normalize a JSON value by stripping prototypes from all objects within it.
|
|
35
|
+
* @param {T} value - The JSON value to normalize.
|
|
36
|
+
* @returns {Prototyped} The normalized JSON value.
|
|
37
|
+
*/
|
|
38
|
+
static normalize<T extends JSONObject | Array<any>>(value: T): Prototyped;
|
|
39
|
+
/**
|
|
40
|
+
* Shallow copy of a JSON object.
|
|
41
|
+
* @param {T extends JSONObject} value - The JSON object to copy.
|
|
42
|
+
* @returns {T} The copied JSON object.
|
|
43
|
+
*/
|
|
44
|
+
static copy<T extends JSONObject>(value: T): T;
|
|
45
|
+
/**
|
|
46
|
+
* Deep clone a JSON value.
|
|
47
|
+
* @param {T} value - The JSON value to clone.
|
|
48
|
+
* @returns {T} The cloned JSON value.
|
|
49
|
+
*/
|
|
50
|
+
static clone<T>(value: T): T;
|
|
51
|
+
/**
|
|
52
|
+
* Deep clone a JSON value, replacing strings that match a pattern.
|
|
53
|
+
* @param {T} value - The JSON value to clone.
|
|
54
|
+
* @param {RegExp} pattern - The regex pattern to match strings.
|
|
55
|
+
* @param {string} replacement - The replacement string.
|
|
56
|
+
* @returns {T} The cloned JSON value with replacements.
|
|
57
|
+
*/
|
|
58
|
+
static cloneReplace<T>(value: T, pattern: RegExp, replacement: string): T;
|
|
59
|
+
/**
|
|
60
|
+
* Deep equality check between two values.
|
|
61
|
+
* @param {unknown} a - The first value to compare.
|
|
62
|
+
* @param {unknown} b - The second value to compare.
|
|
63
|
+
* @param {WeakMap<object, object>} seen - A WeakMap to track seen object pairs for circular reference detection.
|
|
64
|
+
* @returns {boolean} True if the values are deeply equal.
|
|
65
|
+
*/
|
|
66
|
+
static deepEqual(a: unknown, b: unknown, seen?: WeakMap<object, object>, depth?: number): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Delete specified keys from a JSON value.
|
|
69
|
+
* @param {T} value - The JSON value to process.
|
|
70
|
+
* @param {Array<string | number | symbol>} keys - The keys to delete.
|
|
71
|
+
* @returns {T} The JSON value with specified keys deleted.
|
|
72
|
+
*/
|
|
73
|
+
static deleteKeys<T>(value: T, keys: Array<string | number | symbol>): T;
|
|
74
|
+
/**
|
|
75
|
+
* Sanitize a JSON value by removing undefined values from objects and arrays.
|
|
76
|
+
* @param {T} value - The JSON value to sanitize.
|
|
77
|
+
* @returns {T} The sanitized JSON value.
|
|
78
|
+
*/
|
|
79
|
+
static sanitize<T>(value: T): T;
|
|
80
|
+
/**
|
|
81
|
+
* Internal function to clone JSON values with options.
|
|
82
|
+
* @param {T} value - The value to clone.
|
|
83
|
+
* @param {CloneOptions} options - The cloning options.
|
|
84
|
+
* @param {WeakMap<object, any>} seen - A WeakMap to track seen objects for circular reference detection.
|
|
85
|
+
* @returns {any} The cloned value.
|
|
86
|
+
*/
|
|
87
|
+
static cloneInternal<T>(value: T, options?: CloneOptions, seen?: WeakMap<object, any>, depth?: number): any;
|
|
88
|
+
}
|
|
89
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/utils/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEnE;;GAEG;AACH,KAAK,YAAY,GAAG;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,K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MAAM,CAAC,aAAa,CAAC,CAAC,EACpB,KAAK,EAAE,CAAC,EACR,OAAO,GAAE,YAAiB,EAC1B,IAAI,GAAE,OAAO,CAAC,MAAM,EAAE,GAAG,CAA8B,EACvD,KAAK,GAAE,MAAU,GAChB,GAAG;CAmDP"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility class for set operations.
|
|
3
|
+
* @name SetUtils
|
|
4
|
+
* @class SetUtils
|
|
5
|
+
*/
|
|
6
|
+
export declare class SetUtils {
|
|
7
|
+
/**
|
|
8
|
+
* Compute the set difference without mutating the inputs.
|
|
9
|
+
* @param {Set<T>} left - The left set.
|
|
10
|
+
* @param {Set<T>} right - The right set.
|
|
11
|
+
* @returns {Set<T>} A new set containing elements in `left` that are not in `right`.
|
|
12
|
+
*/
|
|
13
|
+
static difference<T>(left: Set<T>, right: Set<T>): Set<T>;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/utils/set.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,QAAQ;IACnB;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;CAU1D"}
|