@metamask/utils 8.0.0 → 8.2.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/CHANGELOG.md +25 -1
- package/dist/assert.js +16 -0
- package/dist/assert.js.map +1 -0
- package/dist/assert.mjs +16 -0
- package/dist/assert.mjs.map +1 -0
- package/dist/base64.js +11 -0
- package/dist/base64.js.map +1 -0
- package/dist/base64.mjs +11 -0
- package/dist/base64.mjs.map +1 -0
- package/dist/bytes.js +43 -0
- package/dist/bytes.js.map +1 -0
- package/dist/bytes.mjs +43 -0
- package/dist/bytes.mjs.map +1 -0
- package/dist/caip-types.js +40 -0
- package/dist/caip-types.js.map +1 -0
- package/dist/caip-types.mjs +40 -0
- package/dist/caip-types.mjs.map +1 -0
- package/dist/checksum.js +12 -0
- package/dist/checksum.js.map +1 -0
- package/dist/checksum.mjs +12 -0
- package/dist/checksum.mjs.map +1 -0
- package/dist/chunk-2CY4F77D.mjs +95 -0
- package/dist/chunk-2CY4F77D.mjs.map +1 -0
- package/dist/chunk-2LBGT4GH.js +15 -0
- package/dist/chunk-2LBGT4GH.js.map +1 -0
- package/dist/chunk-2TBCL6EF.js +1 -0
- package/dist/chunk-2TBCL6EF.js.map +1 -0
- package/dist/chunk-3W5G4CYI.js +25 -0
- package/dist/chunk-3W5G4CYI.js.map +1 -0
- package/dist/chunk-4JNG5UTO.js +44 -0
- package/dist/chunk-4JNG5UTO.js.map +1 -0
- package/dist/chunk-4RMX5YWE.js +34 -0
- package/dist/chunk-4RMX5YWE.js.map +1 -0
- package/dist/chunk-5WQRFJVQ.js +257 -0
- package/dist/chunk-5WQRFJVQ.js.map +1 -0
- package/dist/chunk-65KBH4FZ.mjs +257 -0
- package/dist/chunk-65KBH4FZ.mjs.map +1 -0
- package/dist/chunk-7S5AWFX7.mjs +61 -0
- package/dist/chunk-7S5AWFX7.mjs.map +1 -0
- package/dist/chunk-AY6FDCBT.mjs +1 -0
- package/dist/chunk-AY6FDCBT.mjs.map +1 -0
- package/dist/chunk-BKR45GQY.mjs +273 -0
- package/dist/chunk-BKR45GQY.mjs.map +1 -0
- package/dist/chunk-CSDMTDND.mjs +59 -0
- package/dist/chunk-CSDMTDND.mjs.map +1 -0
- package/dist/chunk-DMPG3H3G.js +61 -0
- package/dist/chunk-DMPG3H3G.js.map +1 -0
- package/dist/chunk-DYMCEQIV.mjs +1 -0
- package/dist/chunk-DYMCEQIV.mjs.map +1 -0
- package/dist/chunk-EQMZL4XU.js +1 -0
- package/dist/chunk-EQMZL4XU.js.map +1 -0
- package/dist/chunk-G66TREC6.mjs +69 -0
- package/dist/chunk-G66TREC6.mjs.map +1 -0
- package/dist/chunk-H4YFDLB7.mjs +70 -0
- package/dist/chunk-H4YFDLB7.mjs.map +1 -0
- package/dist/chunk-HLDWS2JR.mjs +35 -0
- package/dist/chunk-HLDWS2JR.mjs.map +1 -0
- package/dist/chunk-I575FZFH.mjs +1 -0
- package/dist/chunk-I575FZFH.mjs.map +1 -0
- package/dist/chunk-JCYFTGED.js +95 -0
- package/dist/chunk-JCYFTGED.js.map +1 -0
- package/dist/chunk-JPAL7Q5S.mjs +90 -0
- package/dist/chunk-JPAL7Q5S.mjs.map +1 -0
- package/dist/chunk-LC2CRSWD.js +1 -0
- package/dist/chunk-LC2CRSWD.js.map +1 -0
- package/dist/chunk-N53OILN6.mjs +16 -0
- package/dist/chunk-N53OILN6.mjs.map +1 -0
- package/dist/chunk-QVEKZRZ2.js +70 -0
- package/dist/chunk-QVEKZRZ2.js.map +1 -0
- package/dist/chunk-RIRDOQPX.mjs +15 -0
- package/dist/chunk-RIRDOQPX.mjs.map +1 -0
- package/dist/chunk-RKRGAFXY.js +1 -0
- package/dist/chunk-RKRGAFXY.js.map +1 -0
- package/dist/chunk-RRYOWRCV.mjs +1 -0
- package/dist/chunk-RRYOWRCV.mjs.map +1 -0
- package/dist/chunk-TGOMTREC.mjs +75 -0
- package/dist/chunk-TGOMTREC.mjs.map +1 -0
- package/dist/chunk-THNLGEXV.mjs +34 -0
- package/dist/chunk-THNLGEXV.mjs.map +1 -0
- package/dist/chunk-U7ZUGCE7.js +75 -0
- package/dist/chunk-U7ZUGCE7.js.map +1 -0
- package/dist/chunk-UOTVU7OQ.js +1 -0
- package/dist/chunk-UOTVU7OQ.js.map +1 -0
- package/dist/chunk-VBYRLAP6.js +59 -0
- package/dist/chunk-VBYRLAP6.js.map +1 -0
- package/dist/chunk-VL5DYXC5.mjs +122 -0
- package/dist/chunk-VL5DYXC5.mjs.map +1 -0
- package/dist/chunk-VSEW3V2L.mjs +44 -0
- package/dist/chunk-VSEW3V2L.mjs.map +1 -0
- package/dist/chunk-WA4DHIND.mjs +1 -0
- package/dist/chunk-WA4DHIND.mjs.map +1 -0
- package/dist/chunk-WQDTPIQK.js +122 -0
- package/dist/chunk-WQDTPIQK.js.map +1 -0
- package/dist/chunk-WRBN6DWM.js +35 -0
- package/dist/chunk-WRBN6DWM.js.map +1 -0
- package/dist/chunk-X66SUIEF.mjs +25 -0
- package/dist/chunk-X66SUIEF.mjs.map +1 -0
- package/dist/chunk-XYYGZF5Y.js +16 -0
- package/dist/chunk-XYYGZF5Y.js.map +1 -0
- package/dist/chunk-YQJBIHC7.js +273 -0
- package/dist/chunk-YQJBIHC7.js.map +1 -0
- package/dist/chunk-Z2RGWDD7.js +90 -0
- package/dist/chunk-Z2RGWDD7.js.map +1 -0
- package/dist/chunk-ZRNIY7OW.js +69 -0
- package/dist/chunk-ZRNIY7OW.js.map +1 -0
- package/dist/coercers.js +18 -0
- package/dist/coercers.js.map +1 -0
- package/dist/coercers.mjs +18 -0
- package/dist/coercers.mjs.map +1 -0
- package/dist/collections.js +10 -0
- package/dist/collections.js.map +1 -0
- package/dist/collections.mjs +10 -0
- package/dist/collections.mjs.map +1 -0
- package/dist/encryption-types.js +2 -0
- package/dist/encryption-types.js.map +1 -0
- package/dist/encryption-types.mjs +2 -0
- package/dist/encryption-types.mjs.map +1 -0
- package/dist/errors.js +17 -0
- package/dist/errors.js.map +1 -0
- package/dist/errors.mjs +17 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/fs.js +26 -0
- package/dist/fs.js.map +1 -0
- package/dist/fs.mjs +26 -0
- package/dist/fs.mjs.map +1 -0
- package/dist/hex.js +35 -0
- package/dist/hex.js.map +1 -0
- package/dist/hex.mjs +35 -0
- package/dist/hex.mjs.map +1 -0
- package/dist/index.js +289 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +289 -0
- package/dist/index.mjs.map +1 -0
- package/dist/json.js +75 -0
- package/dist/json.js.map +1 -0
- package/dist/json.mjs +75 -0
- package/dist/json.mjs.map +1 -0
- package/dist/keyring.js +2 -0
- package/dist/keyring.js.map +1 -0
- package/dist/keyring.mjs +2 -0
- package/dist/keyring.mjs.map +1 -0
- package/dist/logging.js +10 -0
- package/dist/logging.js.map +1 -0
- package/dist/logging.mjs +10 -0
- package/dist/logging.mjs.map +1 -0
- package/dist/misc.js +28 -0
- package/dist/misc.js.map +1 -0
- package/dist/misc.mjs +28 -0
- package/dist/misc.mjs.map +1 -0
- package/dist/node.js +309 -0
- package/dist/node.js.map +1 -0
- package/dist/node.mjs +309 -0
- package/dist/node.mjs.map +1 -0
- package/dist/number.js +18 -0
- package/dist/number.js.map +1 -0
- package/dist/number.mjs +18 -0
- package/dist/number.mjs.map +1 -0
- package/dist/opaque.js +2 -0
- package/dist/opaque.js.map +1 -0
- package/dist/opaque.mjs +2 -0
- package/dist/opaque.mjs.map +1 -0
- package/dist/time.js +12 -0
- package/dist/time.js.map +1 -0
- package/dist/time.mjs +12 -0
- package/dist/time.mjs.map +1 -0
- package/dist/transaction-types.js +2 -0
- package/dist/transaction-types.js.map +1 -0
- package/dist/transaction-types.mjs +2 -0
- package/dist/transaction-types.mjs.map +1 -0
- package/dist/types/assert.d.ts.map +1 -1
- package/dist/types/bytes.d.ts +14 -0
- package/dist/types/bytes.d.ts.map +1 -1
- package/dist/types/errors.d.ts +58 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/fs.d.ts +133 -0
- package/dist/types/fs.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/json.d.ts +83 -47
- package/dist/types/json.d.ts.map +1 -1
- package/dist/types/node.d.ts +3 -0
- package/dist/types/node.d.ts.map +1 -0
- package/dist/versions.js +27 -0
- package/dist/versions.js.map +1 -0
- package/dist/versions.mjs +27 -0
- package/dist/versions.mjs.map +1 -0
- package/package.json +21 -20
- package/dist/cjs/assert.js +0 -116
- package/dist/cjs/assert.js.map +0 -1
- package/dist/cjs/base64.js +0 -32
- package/dist/cjs/base64.js.map +0 -1
- package/dist/cjs/bytes.js +0 -255
- package/dist/cjs/bytes.js.map +0 -1
- package/dist/cjs/caip-types.js +0 -115
- package/dist/cjs/caip-types.js.map +0 -1
- package/dist/cjs/checksum.js +0 -17
- package/dist/cjs/checksum.js.map +0 -1
- package/dist/cjs/coercers.js +0 -96
- package/dist/cjs/coercers.js.map +0 -1
- package/dist/cjs/collections.js +0 -157
- package/dist/cjs/collections.js.map +0 -1
- package/dist/cjs/encryption-types.js +0 -6
- package/dist/cjs/encryption-types.js.map +0 -1
- package/dist/cjs/hex.js +0 -107
- package/dist/cjs/hex.js.map +0 -1
- package/dist/cjs/index.js +0 -37
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/json.js +0 -263
- package/dist/cjs/json.js.map +0 -1
- package/dist/cjs/keyring.js +0 -6
- package/dist/cjs/keyring.js.map +0 -1
- package/dist/cjs/logging.js +0 -33
- package/dist/cjs/logging.js.map +0 -1
- package/dist/cjs/misc.js +0 -111
- package/dist/cjs/misc.js.map +0 -1
- package/dist/cjs/number.js +0 -52
- package/dist/cjs/number.js.map +0 -1
- package/dist/cjs/opaque.js +0 -8
- package/dist/cjs/opaque.js.map +0 -1
- package/dist/cjs/time.js +0 -63
- package/dist/cjs/time.js.map +0 -1
- package/dist/cjs/transaction-types.js +0 -6
- package/dist/cjs/transaction-types.js.map +0 -1
- package/dist/cjs/versions.js +0 -79
- package/dist/cjs/versions.js.map +0 -1
- package/dist/esm/assert.js +0 -133
- package/dist/esm/assert.js.map +0 -1
- package/dist/esm/base64.js +0 -28
- package/dist/esm/base64.js.map +0 -1
- package/dist/esm/bytes.js +0 -334
- package/dist/esm/bytes.js.map +0 -1
- package/dist/esm/caip-types.js +0 -99
- package/dist/esm/caip-types.js.map +0 -1
- package/dist/esm/checksum.js +0 -7
- package/dist/esm/checksum.js.map +0 -1
- package/dist/esm/coercers.js +0 -153
- package/dist/esm/coercers.js.map +0 -1
- package/dist/esm/collections.js +0 -140
- package/dist/esm/collections.js.map +0 -1
- package/dist/esm/encryption-types.js +0 -3
- package/dist/esm/encryption-types.js.map +0 -1
- package/dist/esm/hex.js +0 -108
- package/dist/esm/hex.js.map +0 -1
- package/dist/esm/index.js +0 -20
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/json.js +0 -301
- package/dist/esm/json.js.map +0 -1
- package/dist/esm/keyring.js +0 -3
- package/dist/esm/keyring.js.map +0 -1
- package/dist/esm/logging.js +0 -34
- package/dist/esm/logging.js.map +0 -1
- package/dist/esm/misc.js +0 -129
- package/dist/esm/misc.js.map +0 -1
- package/dist/esm/number.js +0 -92
- package/dist/esm/number.js.map +0 -1
- package/dist/esm/opaque.js +0 -5
- package/dist/esm/opaque.js.map +0 -1
- package/dist/esm/package.json +0 -1
- package/dist/esm/time.js +0 -53
- package/dist/esm/time.js.map +0 -1
- package/dist/esm/transaction-types.js +0 -3
- package/dist/esm/transaction-types.js.map +0 -1
- package/dist/esm/versions.js +0 -78
- package/dist/esm/versions.js.map +0 -1
- package/dist/types/caip-types.test-d.d.ts +0 -2
- package/dist/types/caip-types.test-d.d.ts.map +0 -1
- package/dist/types/hex.test-d.d.ts +0 -2
- package/dist/types/hex.test-d.d.ts.map +0 -1
- package/dist/types/json.test-d.d.ts +0 -2
- package/dist/types/json.test-d.d.ts.map +0 -1
- package/dist/types/misc.test-d.d.ts +0 -2
- package/dist/types/misc.test-d.d.ts.map +0 -1
package/dist/time.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/assert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/assert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAK1C,oBAAY,yBAAyB,GACjC,CAAC,KAAK,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,KAAK,KAAK,CAAC,GAC1C,CAAC,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,KAAK,KAAK,CAAC,CAAC;AAkD3C;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,mBAAmB;gBAEpB,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;CAGzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,GAAG,EACV,OAAO,GAAE,MAAM,GAAG,KAA2B,EAE7C,YAAY,GAAE,yBAA0C,GACvD,OAAO,CAAC,KAAK,CAQf;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EACvC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,EAC5B,WAAW,SAAqB,EAEhC,YAAY,GAAE,yBAA0C,GACvD,OAAO,CAAC,KAAK,IAAI,IAAI,CASvB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,KAAK,GAAG,KAAK,CAItD"}
|
package/dist/types/bytes.d.ts
CHANGED
|
@@ -61,6 +61,13 @@ export declare function bytesToNumber(bytes: Uint8Array): number;
|
|
|
61
61
|
* @returns The string.
|
|
62
62
|
*/
|
|
63
63
|
export declare function bytesToString(bytes: Uint8Array): string;
|
|
64
|
+
/**
|
|
65
|
+
* Convert a `Uint8Array` to a base64 encoded string.
|
|
66
|
+
*
|
|
67
|
+
* @param bytes - The bytes to convert to a base64 encoded string.
|
|
68
|
+
* @returns The base64 encoded string.
|
|
69
|
+
*/
|
|
70
|
+
export declare function bytesToBase64(bytes: Uint8Array): string;
|
|
64
71
|
/**
|
|
65
72
|
* Convert a hexadecimal string to a `Uint8Array`. The string can optionally be
|
|
66
73
|
* prefixed with `0x`. It accepts even and odd length strings.
|
|
@@ -111,6 +118,13 @@ export declare function numberToBytes(value: number): Uint8Array;
|
|
|
111
118
|
* @returns The bytes as `Uint8Array`.
|
|
112
119
|
*/
|
|
113
120
|
export declare function stringToBytes(value: string): Uint8Array;
|
|
121
|
+
/**
|
|
122
|
+
* Convert a base64 encoded string to a `Uint8Array`.
|
|
123
|
+
*
|
|
124
|
+
* @param value - The base64 encoded string to convert to bytes.
|
|
125
|
+
* @returns The bytes as `Uint8Array`.
|
|
126
|
+
*/
|
|
127
|
+
export declare function base64ToBytes(value: string): Uint8Array;
|
|
114
128
|
/**
|
|
115
129
|
* Convert a byte-like value to a `Uint8Array`. The value can be a `Uint8Array`,
|
|
116
130
|
* a `bigint`, a `number`, or a `string`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/bytes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bytes.d.ts","sourceR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BAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAIvD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAIvD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,CAsBrD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAqBvD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAe1D"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guard for determining whether the given value is an error object with a
|
|
3
|
+
* `code` property such as the type of error that Node throws for filesystem
|
|
4
|
+
* operations, etc.
|
|
5
|
+
*
|
|
6
|
+
* @param error - The object to check.
|
|
7
|
+
* @returns A boolean.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isErrorWithCode(error: unknown): error is {
|
|
10
|
+
code: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Type guard for determining whether the given value is an error object with a
|
|
14
|
+
* `message` property, such as an instance of Error.
|
|
15
|
+
*
|
|
16
|
+
* @param error - The object to check.
|
|
17
|
+
* @returns A boolean.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isErrorWithMessage(error: unknown): error is {
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Type guard for determining whether the given value is an error object with a
|
|
24
|
+
* `stack` property, such as an instance of Error.
|
|
25
|
+
*
|
|
26
|
+
* @param error - The object to check.
|
|
27
|
+
* @returns A boolean.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isErrorWithStack(error: unknown): error is {
|
|
30
|
+
stack: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Attempts to obtain the message from a possible error object, defaulting to an
|
|
34
|
+
* empty string if it is impossible to do so.
|
|
35
|
+
*
|
|
36
|
+
* @param error - The possible error to get the message from.
|
|
37
|
+
* @returns The message if `error` is an object with a `message` property;
|
|
38
|
+
* the string version of `error` if it is not `undefined` or `null`; otherwise
|
|
39
|
+
* an empty string.
|
|
40
|
+
*/
|
|
41
|
+
export declare function getErrorMessage(error: unknown): string;
|
|
42
|
+
/**
|
|
43
|
+
* Builds a new error object, linking it to the original error via the `cause`
|
|
44
|
+
* property if it is an Error.
|
|
45
|
+
*
|
|
46
|
+
* This function is useful to reframe error messages in general, but is
|
|
47
|
+
* _critical_ when interacting with any of Node's filesystem functions as
|
|
48
|
+
* provided via `fs.promises`, because these do not produce stack traces in the
|
|
49
|
+
* case of an I/O error (see <https://github.com/nodejs/node/issues/30944>).
|
|
50
|
+
*
|
|
51
|
+
* @param originalError - The error to be wrapped (something throwable).
|
|
52
|
+
* @param message - The desired message of the new error.
|
|
53
|
+
* @returns A new error object.
|
|
54
|
+
*/
|
|
55
|
+
export declare function wrapError<Throwable>(originalError: Throwable, message: string): Error & {
|
|
56
|
+
code?: string;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAmBA;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAEzE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAE9B;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAE3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAUtD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,SAAS,EACjC,aAAa,EAAE,SAAS,EACxB,OAAO,EAAE,MAAM,GACd,KAAK,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CA4B3B"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { Json } from './json';
|
|
2
|
+
/**
|
|
3
|
+
* Information about the file sandbox provided to tests that need temporary
|
|
4
|
+
* access to the filesystem.
|
|
5
|
+
*/
|
|
6
|
+
export declare type FileSandbox = {
|
|
7
|
+
directoryPath: string;
|
|
8
|
+
withinSandbox: (test: (args: {
|
|
9
|
+
directoryPath: string;
|
|
10
|
+
}) => Promise<void>) => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Read the file at the given path, assuming its content is encoded as UTF-8.
|
|
14
|
+
*
|
|
15
|
+
* @param filePath - The path to the file.
|
|
16
|
+
* @returns The content of the file.
|
|
17
|
+
* @throws An error with a stack trace if reading fails in any way.
|
|
18
|
+
*/
|
|
19
|
+
export declare function readFile(filePath: string): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Write content to the file at the given path, creating the directory structure
|
|
22
|
+
* for the file automatically if necessary.
|
|
23
|
+
*
|
|
24
|
+
* @param filePath - The path to the file.
|
|
25
|
+
* @param content - The new content of the file.
|
|
26
|
+
* @throws An error with a stack trace if writing fails in any way.
|
|
27
|
+
*/
|
|
28
|
+
export declare function writeFile(filePath: string, content: string): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Read the assumed JSON file at the given path, attempts to parse it, and
|
|
31
|
+
* get the resulting object. Supports a custom parser (in case you want to
|
|
32
|
+
* use the [JSON5](https://www.npmjs.com/package/json5) package instead).
|
|
33
|
+
*
|
|
34
|
+
* @param filePath - The path segments pointing to the JSON file. Will be passed
|
|
35
|
+
* to path.join().
|
|
36
|
+
* @param options - Options to this function.
|
|
37
|
+
* @param options.parser - The parser object to use. Defaults to `JSON`.
|
|
38
|
+
* @param options.parser.parse - A function that parses JSON data.
|
|
39
|
+
* @returns The object corresponding to the parsed JSON file, typed against the
|
|
40
|
+
* struct.
|
|
41
|
+
* @throws An error with a stack trace if reading fails in any way, or if the
|
|
42
|
+
* parsed value is not a plain object.
|
|
43
|
+
*/
|
|
44
|
+
export declare function readJsonFile<Value extends Json>(filePath: string, { parser, }?: {
|
|
45
|
+
parser?: {
|
|
46
|
+
parse: (text: Parameters<typeof JSON.parse>[0]) => ReturnType<typeof JSON.parse>;
|
|
47
|
+
};
|
|
48
|
+
}): Promise<Value>;
|
|
49
|
+
/**
|
|
50
|
+
* Attempt to write the given JSON-like value to the file at the given path,
|
|
51
|
+
* creating the directory structure for the file automatically if necessary.
|
|
52
|
+
* Adds a newline to the end of the file. Supports a custom parser (in case you
|
|
53
|
+
* want to use the [JSON5](https://www.npmjs.com/package/json5) package
|
|
54
|
+
* instead).
|
|
55
|
+
*
|
|
56
|
+
* @param filePath - The path to write the JSON file to, including the file
|
|
57
|
+
* itself.
|
|
58
|
+
* @param jsonValue - The JSON-like value to write to the file. Make sure that
|
|
59
|
+
* JSON.stringify can handle it.
|
|
60
|
+
* @param options - The options to this function.
|
|
61
|
+
* @param options.prettify - Whether to format the JSON as it is turned into a
|
|
62
|
+
* string such that it is broken up into separate lines (using 2 spaces as
|
|
63
|
+
* indentation).
|
|
64
|
+
* @param options.stringifier - The stringifier to use. Defaults to `JSON`.
|
|
65
|
+
* @param options.stringifier.stringify - A function that stringifies JSON.
|
|
66
|
+
* @returns The object corresponding to the parsed JSON file, typed against the
|
|
67
|
+
* struct.
|
|
68
|
+
* @throws An error with a stack trace if writing fails in any way.
|
|
69
|
+
*/
|
|
70
|
+
export declare function writeJsonFile(filePath: string, jsonValue: Json, { stringifier, prettify, }?: {
|
|
71
|
+
stringifier?: {
|
|
72
|
+
stringify: typeof JSON.stringify;
|
|
73
|
+
};
|
|
74
|
+
prettify?: boolean;
|
|
75
|
+
}): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Test the given path to determine whether it represents a file.
|
|
78
|
+
*
|
|
79
|
+
* @param filePath - The path to a (supposed) file on the filesystem.
|
|
80
|
+
* @returns A promise for true if the file exists or false otherwise.
|
|
81
|
+
* @throws An error with a stack trace if reading fails in any way.
|
|
82
|
+
*/
|
|
83
|
+
export declare function fileExists(filePath: string): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Test the given path to determine whether it represents a directory.
|
|
86
|
+
*
|
|
87
|
+
* @param directoryPath - The path to a (supposed) directory on the filesystem.
|
|
88
|
+
* @returns A promise for true if the file exists or false otherwise.
|
|
89
|
+
* @throws An error with a stack trace if reading fails in any way.
|
|
90
|
+
*/
|
|
91
|
+
export declare function directoryExists(directoryPath: string): Promise<boolean>;
|
|
92
|
+
/**
|
|
93
|
+
* Create the given directory along with any directories leading up to the
|
|
94
|
+
* directory, or do nothing if the directory already exists.
|
|
95
|
+
*
|
|
96
|
+
* @param directoryPath - The path to the desired directory.
|
|
97
|
+
* @throws An error with a stack trace if reading fails in any way.
|
|
98
|
+
*/
|
|
99
|
+
export declare function ensureDirectoryStructureExists(directoryPath: string): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Remove the given file or directory if it exists, or do nothing if it does
|
|
102
|
+
* not.
|
|
103
|
+
*
|
|
104
|
+
* @param entryPath - The path to the file or directory.
|
|
105
|
+
* @throws An error with a stack trace if removal fails in any way.
|
|
106
|
+
*/
|
|
107
|
+
export declare function forceRemove(entryPath: string): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Construct a sandbox object which can be used in tests that need temporary
|
|
110
|
+
* access to the filesystem.
|
|
111
|
+
*
|
|
112
|
+
* @param projectName - The name of the project.
|
|
113
|
+
* @returns The sandbox object. This contains a `withinSandbox` function which
|
|
114
|
+
* can be used in tests (see example).
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* const { withinSandbox } = createSandbox('utils');
|
|
118
|
+
*
|
|
119
|
+
* // ... later ...
|
|
120
|
+
*
|
|
121
|
+
* it('does something with the filesystem', async () => {
|
|
122
|
+
* await withinSandbox(async ({ directoryPath }) => {
|
|
123
|
+
* await fs.promises.writeFile(
|
|
124
|
+
* path.join(directoryPath, 'some-file'),
|
|
125
|
+
* 'some content',
|
|
126
|
+
* 'utf8'
|
|
127
|
+
* );
|
|
128
|
+
* })
|
|
129
|
+
* });
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export declare function createSandbox(projectName: string): FileSandbox;
|
|
133
|
+
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/fs.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC;;;GAGG;AACH,oBAAY,WAAW,GAAG;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,CACb,IAAI,EAAE,CAAC,IAAI,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,KACrD,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMhE;AAED;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAAC,KAAK,SAAS,IAAI,EACnD,QAAQ,EAAE,MAAM,EAChB,EACE,MAAa,GACd,GAAE;IACD,MAAM,CAAC,EAAE;QACP,KAAK,EAAE,CACL,IAAI,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KACnC,UAAU,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;KACpC,CAAC;CACE,GACL,OAAO,CAAC,KAAK,CAAC,CAOhB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,IAAI,EACf,EACE,WAAkB,EAClB,QAAgB,GACjB,GAAE;IACD,WAAW,CAAC,EAAE;QACZ,SAAS,EAAE,OAAO,IAAI,CAAC,SAAS,CAAC;KAClC,CAAC;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACf,GACL,OAAO,CAAC,IAAI,CAAC,CAUf;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAWnE;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAc7E;AAED;;;;;;GAMG;AACH,wBAAsB,8BAA8B,CAClD,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CASf;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASlE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,CAsB9D"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
|
package/dist/types/json.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { Infer
|
|
1
|
+
import type { Infer } from 'superstruct';
|
|
2
|
+
import { Struct } from 'superstruct';
|
|
3
|
+
import type { ObjectSchema, Optionalize, Simplify } from 'superstruct/dist/utils';
|
|
2
4
|
import type { AssertionErrorConstructor } from './assert';
|
|
3
5
|
/**
|
|
4
6
|
* Any JSON-compatible value.
|
|
@@ -6,6 +8,70 @@ import type { AssertionErrorConstructor } from './assert';
|
|
|
6
8
|
export declare type Json = null | boolean | number | string | Json[] | {
|
|
7
9
|
[prop: string]: Json;
|
|
8
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* A helper type to make properties with `undefined` in their type optional, but
|
|
13
|
+
* not `undefined` itself.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* type Foo = ObjectOptional<{ foo: string | undefined }>;
|
|
18
|
+
* // Foo is equivalent to { foo?: string }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare type ObjectOptional<Schema extends Record<string, unknown>> = {
|
|
22
|
+
[Key in keyof Schema as Schema[Key] extends ExactOptionalGuard ? Key : never]?: Schema[Key] extends ExactOptionalGuard & infer Original ? Original : never;
|
|
23
|
+
} & {
|
|
24
|
+
[Key in keyof Schema as Schema[Key] extends ExactOptionalGuard ? never : Key]: Schema[Key];
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* An object type with support for exact optionals. This is used by the `object`
|
|
28
|
+
* struct. This uses the {@link ObjectOptional} helper to make properties with
|
|
29
|
+
* `undefined` in their type optional, but not `undefined` itself.
|
|
30
|
+
*/
|
|
31
|
+
export declare type ObjectType<Schema extends ObjectSchema> = Simplify<ObjectOptional<Optionalize<{
|
|
32
|
+
[Key in keyof Schema]: Infer<Schema[Key]>;
|
|
33
|
+
}>>>;
|
|
34
|
+
/**
|
|
35
|
+
* A struct to check if the given value is a valid object, with support for
|
|
36
|
+
* {@link exactOptional} types.
|
|
37
|
+
*
|
|
38
|
+
* @param schema - The schema of the object.
|
|
39
|
+
* @returns A struct to check if the given value is an object.
|
|
40
|
+
*/
|
|
41
|
+
export declare const object: <Schema extends ObjectSchema>(schema: Schema) => Struct<Simplify<ObjectOptional<Optionalize<{ [Key in keyof Schema]: Infer<Schema[Key]>; }>>>, unknown>;
|
|
42
|
+
declare const exactOptionalSymbol: unique symbol;
|
|
43
|
+
declare type ExactOptionalGuard = {
|
|
44
|
+
_exactOptionalGuard?: typeof exactOptionalSymbol;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* A struct which allows the property of an object to be absent, or to be present
|
|
48
|
+
* as long as it's valid and not set to `undefined`.
|
|
49
|
+
*
|
|
50
|
+
* This struct should be used in conjunction with the {@link object} from this
|
|
51
|
+
* library, to get proper type inference.
|
|
52
|
+
*
|
|
53
|
+
* @param struct - The struct to check the value against, if present.
|
|
54
|
+
* @returns A struct to check if the given value is valid, or not present.
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const struct = object({
|
|
58
|
+
* foo: exactOptional(string()),
|
|
59
|
+
* bar: exactOptional(number()),
|
|
60
|
+
* baz: optional(boolean()),
|
|
61
|
+
* qux: unknown(),
|
|
62
|
+
* });
|
|
63
|
+
*
|
|
64
|
+
* type Type = Infer<typeof struct>;
|
|
65
|
+
* // Type is equivalent to:
|
|
66
|
+
* // {
|
|
67
|
+
* // foo?: string;
|
|
68
|
+
* // bar?: number;
|
|
69
|
+
* // baz?: boolean | undefined;
|
|
70
|
+
* // qux: unknown;
|
|
71
|
+
* // }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare function exactOptional<Type, Schema>(struct: Struct<Type, Schema>): Struct<Type & ExactOptionalGuard, Schema>;
|
|
9
75
|
/**
|
|
10
76
|
* A struct to check if the given value is a valid JSON-serializable value.
|
|
11
77
|
*
|
|
@@ -66,16 +132,11 @@ export declare const JsonRpcIdStruct: Struct<string | number | null, null>;
|
|
|
66
132
|
*/
|
|
67
133
|
export declare type JsonRpcId = Infer<typeof JsonRpcIdStruct>;
|
|
68
134
|
export declare const JsonRpcErrorStruct: Struct<{
|
|
135
|
+
data?: Json & ExactOptionalGuard;
|
|
136
|
+
stack?: string;
|
|
69
137
|
code: number;
|
|
70
138
|
message: string;
|
|
71
|
-
|
|
72
|
-
stack?: string | undefined;
|
|
73
|
-
}, {
|
|
74
|
-
code: Struct<number, null>;
|
|
75
|
-
message: Struct<string, null>;
|
|
76
|
-
data: Struct<Json | undefined, unknown>;
|
|
77
|
-
stack: Struct<string | undefined, null>;
|
|
78
|
-
}>;
|
|
139
|
+
}, unknown>;
|
|
79
140
|
/**
|
|
80
141
|
* Mark a certain key of a type as optional.
|
|
81
142
|
*/
|
|
@@ -91,35 +152,23 @@ export declare type JsonRpcError = OptionalField<Infer<typeof JsonRpcErrorStruct
|
|
|
91
152
|
export declare const JsonRpcParamsStruct: Struct<Json[] | Record<string, Json>, null>;
|
|
92
153
|
export declare type JsonRpcParams = Json[] | Record<string, Json>;
|
|
93
154
|
export declare const JsonRpcRequestStruct: Struct<{
|
|
155
|
+
params?: (Json[] | Record<string, Json>) & ExactOptionalGuard;
|
|
94
156
|
id: string | number | null;
|
|
95
157
|
method: string;
|
|
96
158
|
jsonrpc: "2.0";
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
id: Struct<string | number | null, null>;
|
|
100
|
-
jsonrpc: Struct<"2.0", "2.0">;
|
|
101
|
-
method: Struct<string, null>;
|
|
102
|
-
params: Struct<Json[] | Record<string, Json>, null>;
|
|
103
|
-
}>;
|
|
104
|
-
export declare type InferWithParams<Type extends Struct<any>, Params extends JsonRpcParams> = Omit<Infer<Type>, 'params'> & (keyof Params extends undefined ? {
|
|
159
|
+
}, unknown>;
|
|
160
|
+
export declare type InferWithParams<Type extends Struct<any>, Params extends JsonRpcParams> = Infer<Type> & {
|
|
105
161
|
params?: Params;
|
|
106
|
-
}
|
|
107
|
-
params: Params;
|
|
108
|
-
});
|
|
162
|
+
};
|
|
109
163
|
/**
|
|
110
164
|
* A JSON-RPC request object.
|
|
111
165
|
*/
|
|
112
166
|
export declare type JsonRpcRequest<Params extends JsonRpcParams = JsonRpcParams> = InferWithParams<typeof JsonRpcRequestStruct, Params>;
|
|
113
167
|
export declare const JsonRpcNotificationStruct: Struct<{
|
|
168
|
+
params?: (Json[] | Record<string, Json>) & ExactOptionalGuard;
|
|
114
169
|
method: string;
|
|
115
170
|
jsonrpc: "2.0";
|
|
116
|
-
|
|
117
|
-
}, Omit<{
|
|
118
|
-
id: Struct<string | number | null, null>;
|
|
119
|
-
jsonrpc: Struct<"2.0", "2.0">;
|
|
120
|
-
method: Struct<string, null>;
|
|
121
|
-
params: Struct<Json[] | Record<string, Json>, null>;
|
|
122
|
-
}, "id">>;
|
|
171
|
+
}, unknown>;
|
|
123
172
|
/**
|
|
124
173
|
* A JSON-RPC notification object.
|
|
125
174
|
*/
|
|
@@ -162,26 +211,21 @@ export declare const PendingJsonRpcResponseStruct: Struct<{
|
|
|
162
211
|
jsonrpc: "2.0";
|
|
163
212
|
result: unknown;
|
|
164
213
|
error?: {
|
|
214
|
+
data?: Json & ExactOptionalGuard;
|
|
215
|
+
stack?: string;
|
|
165
216
|
code: number;
|
|
166
217
|
message: string;
|
|
167
|
-
data?: Json | undefined;
|
|
168
|
-
stack?: string | undefined;
|
|
169
218
|
} | undefined;
|
|
170
219
|
}, {
|
|
171
220
|
id: Struct<string | number | null, null>;
|
|
172
221
|
jsonrpc: Struct<"2.0", "2.0">;
|
|
173
222
|
result: Struct<unknown, null>;
|
|
174
223
|
error: Struct<{
|
|
224
|
+
data?: Json & ExactOptionalGuard;
|
|
225
|
+
stack?: string;
|
|
175
226
|
code: number;
|
|
176
227
|
message: string;
|
|
177
|
-
|
|
178
|
-
stack?: string | undefined;
|
|
179
|
-
} | undefined, {
|
|
180
|
-
code: Struct<number, null>;
|
|
181
|
-
message: Struct<string, null>;
|
|
182
|
-
data: Struct<Json | undefined, unknown>;
|
|
183
|
-
stack: Struct<string | undefined, null>;
|
|
184
|
-
}>;
|
|
228
|
+
} | undefined, unknown>;
|
|
185
229
|
}>;
|
|
186
230
|
/**
|
|
187
231
|
* A JSON-RPC response object that has not yet been resolved.
|
|
@@ -193,11 +237,7 @@ export declare const JsonRpcSuccessStruct: Struct<{
|
|
|
193
237
|
id: string | number | null;
|
|
194
238
|
jsonrpc: "2.0";
|
|
195
239
|
result: Json;
|
|
196
|
-
},
|
|
197
|
-
id: Struct<string | number | null, null>;
|
|
198
|
-
jsonrpc: Struct<"2.0", "2.0">;
|
|
199
|
-
result: Struct<Json, unknown>;
|
|
200
|
-
}>;
|
|
240
|
+
}, unknown>;
|
|
201
241
|
/**
|
|
202
242
|
* A successful JSON-RPC response object.
|
|
203
243
|
*/
|
|
@@ -208,11 +248,7 @@ export declare const JsonRpcFailureStruct: Struct<{
|
|
|
208
248
|
error: JsonRpcError;
|
|
209
249
|
id: string | number | null;
|
|
210
250
|
jsonrpc: "2.0";
|
|
211
|
-
},
|
|
212
|
-
id: Struct<string | number | null, null>;
|
|
213
|
-
jsonrpc: Struct<"2.0", "2.0">;
|
|
214
|
-
error: Struct<JsonRpcError, unknown>;
|
|
215
|
-
}>;
|
|
251
|
+
}, unknown>;
|
|
216
252
|
/**
|
|
217
253
|
* A failed JSON-RPC response object.
|
|
218
254
|
*/
|
package/dist/types/json.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAmBL,MAAM,EACP,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,QAAQ,EACT,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAI1D;;GAEG;AACH,oBAAY,IAAI,GACZ,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,IAAI,EAAE,GACN;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAE7B;;;;;;;;;GASG;AACH,oBAAY,cAAc,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KAClE,GAAG,IAAI,MAAM,MA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AC,EAAE,yBAAyB,GACvC,OAAO,CAAC,KAAK,IAAI,cAAc,CAOjC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EAEd,YAAY,CAAC,EAAE,yBAAyB,GACvC,OAAO,CAAC,KAAK,IAAI,YAAY,CAO/B;AAED,aAAK,uBAAuB,GAAG;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,uBAAuB,QAevC,OAAO,kCAStC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AAAA,cAAc,GAAG,CAAC;AAClB,cAAc,MAAM,CAAC"}
|
package/dist/versions.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkZRNIY7OWjs = require('./chunk-ZRNIY7OW.js');
|
|
12
|
+
require('./chunk-VBYRLAP6.js');
|
|
13
|
+
require('./chunk-DMPG3H3G.js');
|
|
14
|
+
require('./chunk-QVEKZRZ2.js');
|
|
15
|
+
require('./chunk-3W5G4CYI.js');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
exports.VersionRangeStruct = _chunkZRNIY7OWjs.VersionRangeStruct; exports.VersionStruct = _chunkZRNIY7OWjs.VersionStruct; exports.assertIsSemVerRange = _chunkZRNIY7OWjs.assertIsSemVerRange; exports.assertIsSemVerVersion = _chunkZRNIY7OWjs.assertIsSemVerVersion; exports.gtRange = _chunkZRNIY7OWjs.gtRange; exports.gtVersion = _chunkZRNIY7OWjs.gtVersion; exports.isValidSemVerRange = _chunkZRNIY7OWjs.isValidSemVerRange; exports.isValidSemVerVersion = _chunkZRNIY7OWjs.isValidSemVerVersion; exports.satisfiesVersionRange = _chunkZRNIY7OWjs.satisfiesVersionRange;
|
|
27
|
+
//# sourceMappingURL=versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
VersionRangeStruct,
|
|
3
|
+
VersionStruct,
|
|
4
|
+
assertIsSemVerRange,
|
|
5
|
+
assertIsSemVerVersion,
|
|
6
|
+
gtRange,
|
|
7
|
+
gtVersion,
|
|
8
|
+
isValidSemVerRange,
|
|
9
|
+
isValidSemVerVersion,
|
|
10
|
+
satisfiesVersionRange
|
|
11
|
+
} from "./chunk-G66TREC6.mjs";
|
|
12
|
+
import "./chunk-CSDMTDND.mjs";
|
|
13
|
+
import "./chunk-7S5AWFX7.mjs";
|
|
14
|
+
import "./chunk-H4YFDLB7.mjs";
|
|
15
|
+
import "./chunk-X66SUIEF.mjs";
|
|
16
|
+
export {
|
|
17
|
+
VersionRangeStruct,
|
|
18
|
+
VersionStruct,
|
|
19
|
+
assertIsSemVerRange,
|
|
20
|
+
assertIsSemVerVersion,
|
|
21
|
+
gtRange,
|
|
22
|
+
gtVersion,
|
|
23
|
+
isValidSemVerRange,
|
|
24
|
+
isValidSemVerVersion,
|
|
25
|
+
satisfiesVersionRange
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=versions.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|