@metamask/utils 8.1.0 → 8.2.1
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 +19 -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-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-4D6XQBHA.js +69 -0
- package/dist/chunk-4D6XQBHA.js.map +1 -0
- package/dist/chunk-4RMX5YWE.js +34 -0
- package/dist/chunk-4RMX5YWE.js.map +1 -0
- package/dist/chunk-52OU772R.mjs +122 -0
- package/dist/chunk-52OU772R.mjs.map +1 -0
- package/dist/chunk-6C35XQOF.mjs +257 -0
- package/dist/chunk-6C35XQOF.mjs.map +1 -0
- package/dist/chunk-6NZW4WK4.js +35 -0
- package/dist/chunk-6NZW4WK4.js.map +1 -0
- package/dist/chunk-6ZDHSOUV.js +59 -0
- package/dist/chunk-6ZDHSOUV.js.map +1 -0
- package/dist/chunk-74DGVJVE.mjs +59 -0
- package/dist/chunk-74DGVJVE.mjs.map +1 -0
- package/dist/chunk-AY6FDCBT.mjs +1 -0
- package/dist/chunk-AY6FDCBT.mjs.map +1 -0
- package/dist/chunk-BFQDMI3M.js +122 -0
- package/dist/chunk-BFQDMI3M.js.map +1 -0
- package/dist/chunk-DHVKFDHQ.js +95 -0
- package/dist/chunk-DHVKFDHQ.js.map +1 -0
- package/dist/chunk-DYMCEQIV.mjs +1 -0
- package/dist/chunk-DYMCEQIV.mjs.map +1 -0
- package/dist/chunk-E4C7EW4R.js +16 -0
- package/dist/chunk-E4C7EW4R.js.map +1 -0
- package/dist/chunk-EQMZL4XU.js +1 -0
- package/dist/chunk-EQMZL4XU.js.map +1 -0
- package/dist/chunk-GZS3IQBZ.mjs +16 -0
- package/dist/chunk-GZS3IQBZ.mjs.map +1 -0
- package/dist/chunk-H4YFDLB7.mjs +70 -0
- package/dist/chunk-H4YFDLB7.mjs.map +1 -0
- package/dist/chunk-I575FZFH.mjs +1 -0
- package/dist/chunk-I575FZFH.mjs.map +1 -0
- package/dist/chunk-IZC266HS.js +55 -0
- package/dist/chunk-IZC266HS.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-NQMRFZHB.mjs +35 -0
- package/dist/chunk-NQMRFZHB.mjs.map +1 -0
- package/dist/chunk-O3EIM33O.mjs +95 -0
- package/dist/chunk-O3EIM33O.mjs.map +1 -0
- package/dist/chunk-OLLG4H35.js +257 -0
- package/dist/chunk-OLLG4H35.js.map +1 -0
- package/dist/chunk-QEPVHEP7.js +273 -0
- package/dist/chunk-QEPVHEP7.js.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-ROQSKDP5.mjs +69 -0
- package/dist/chunk-ROQSKDP5.mjs.map +1 -0
- package/dist/chunk-RRYOWRCV.mjs +1 -0
- package/dist/chunk-RRYOWRCV.mjs.map +1 -0
- package/dist/chunk-S3UHBN2Z.mjs +44 -0
- package/dist/chunk-S3UHBN2Z.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-VA2DRBDE.mjs +273 -0
- package/dist/chunk-VA2DRBDE.mjs.map +1 -0
- package/dist/chunk-VFXTVNXN.js +44 -0
- package/dist/chunk-VFXTVNXN.js.map +1 -0
- package/dist/chunk-WA4DHIND.mjs +1 -0
- package/dist/chunk-WA4DHIND.mjs.map +1 -0
- package/dist/chunk-X66SUIEF.mjs +25 -0
- package/dist/chunk-X66SUIEF.mjs.map +1 -0
- package/dist/chunk-XYGUOY6N.mjs +55 -0
- package/dist/chunk-XYGUOY6N.mjs.map +1 -0
- package/dist/chunk-Z2RGWDD7.js +90 -0
- package/dist/chunk-Z2RGWDD7.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 -44
- 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 +22 -21
- 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 -265
- 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 -303
- 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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M,GAAG,aAAa,mCAAmC;AAAA,MACrE;AAEA,YAAM,+BAA+B,aAAa;AAElD,UAAI;AACF,cAAM,KAAK,EAAE,cAAc,CAAC;AAAA,MAC9B,UAAE;AACA,cAAM,YAAY,aAAa;AAAA,MACjC;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["// This file is intended to be used only in a Node.js context.\n/* eslint-disable import/no-nodejs-modules */\n\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\n\nimport { isErrorWithCode, wrapError } from './errors';\nimport type { Json } from './json';\n\n/**\n * Information about the file sandbox provided to tests that need temporary\n * access to the filesystem.\n */\nexport type FileSandbox = {\n directoryPath: string;\n withinSandbox: (\n test: (args: { directoryPath: string }) => Promise<void>,\n ) => Promise<void>;\n};\n\n/**\n * Read the file at the given path, assuming its content is encoded as UTF-8.\n *\n * @param filePath - The path to the file.\n * @returns The content of the file.\n * @throws An error with a stack trace if reading fails in any way.\n */\nexport async function readFile(filePath: string): Promise<string> {\n try {\n return await fs.promises.readFile(filePath, 'utf8');\n } catch (error) {\n throw wrapError(error, `Could not read file '${filePath}'`);\n }\n}\n\n/**\n * Write content to the file at the given path, creating the directory structure\n * for the file automatically if necessary.\n *\n * @param filePath - The path to the file.\n * @param content - The new content of the file.\n * @throws An error with a stack trace if writing fails in any way.\n */\nexport async function writeFile(\n filePath: string,\n content: string,\n): Promise<void> {\n try {\n await fs.promises.mkdir(path.dirname(filePath), { recursive: true });\n await fs.promises.writeFile(filePath, content);\n } catch (error) {\n throw wrapError(error, `Could not write file '${filePath}'`);\n }\n}\n\n/**\n * Read the assumed JSON file at the given path, attempts to parse it, and\n * get the resulting object. Supports a custom parser (in case you want to\n * use the [JSON5](https://www.npmjs.com/package/json5) package instead).\n *\n * @param filePath - The path segments pointing to the JSON file. Will be passed\n * to path.join().\n * @param options - Options to this function.\n * @param options.parser - The parser object to use. Defaults to `JSON`.\n * @param options.parser.parse - A function that parses JSON data.\n * @returns The object corresponding to the parsed JSON file, typed against the\n * struct.\n * @throws An error with a stack trace if reading fails in any way, or if the\n * parsed value is not a plain object.\n */\nexport async function readJsonFile<Value extends Json>(\n filePath: string,\n {\n parser = JSON,\n }: {\n parser?: {\n parse: (\n text: Parameters<typeof JSON.parse>[0],\n ) => ReturnType<typeof JSON.parse>;\n };\n } = {},\n): Promise<Value> {\n try {\n const content = await fs.promises.readFile(filePath, 'utf8');\n return parser.parse(content);\n } catch (error) {\n throw wrapError(error, `Could not read JSON file '${filePath}'`);\n }\n}\n\n/**\n * Attempt to write the given JSON-like value to the file at the given path,\n * creating the directory structure for the file automatically if necessary.\n * Adds a newline to the end of the file. Supports a custom parser (in case you\n * want to use the [JSON5](https://www.npmjs.com/package/json5) package\n * instead).\n *\n * @param filePath - The path to write the JSON file to, including the file\n * itself.\n * @param jsonValue - The JSON-like value to write to the file. Make sure that\n * JSON.stringify can handle it.\n * @param options - The options to this function.\n * @param options.prettify - Whether to format the JSON as it is turned into a\n * string such that it is broken up into separate lines (using 2 spaces as\n * indentation).\n * @param options.stringifier - The stringifier to use. Defaults to `JSON`.\n * @param options.stringifier.stringify - A function that stringifies JSON.\n * @returns The object corresponding to the parsed JSON file, typed against the\n * struct.\n * @throws An error with a stack trace if writing fails in any way.\n */\nexport async function writeJsonFile(\n filePath: string,\n jsonValue: Json,\n {\n stringifier = JSON,\n prettify = false,\n }: {\n stringifier?: {\n stringify: typeof JSON.stringify;\n };\n prettify?: boolean;\n } = {},\n): Promise<void> {\n try {\n await fs.promises.mkdir(path.dirname(filePath), { recursive: true });\n const json = prettify\n ? stringifier.stringify(jsonValue, null, ' ')\n : stringifier.stringify(jsonValue);\n await fs.promises.writeFile(filePath, json);\n } catch (error) {\n throw wrapError(error, `Could not write JSON file '${filePath}'`);\n }\n}\n\n/**\n * Test the given path to determine whether it represents a file.\n *\n * @param filePath - The path to a (supposed) file on the filesystem.\n * @returns A promise for true if the file exists or false otherwise.\n * @throws An error with a stack trace if reading fails in any way.\n */\nexport async function fileExists(filePath: string): Promise<boolean> {\n try {\n const stats = await fs.promises.stat(filePath);\n return stats.isFile();\n } catch (error) {\n if (isErrorWithCode(error) && error.code === 'ENOENT') {\n return false;\n }\n\n throw wrapError(error, `Could not determine if file exists '${filePath}'`);\n }\n}\n\n/**\n * Test the given path to determine whether it represents a directory.\n *\n * @param directoryPath - The path to a (supposed) directory on the filesystem.\n * @returns A promise for true if the file exists or false otherwise.\n * @throws An error with a stack trace if reading fails in any way.\n */\nexport async function directoryExists(directoryPath: string): Promise<boolean> {\n try {\n const stats = await fs.promises.stat(directoryPath);\n return stats.isDirectory();\n } catch (error) {\n if (isErrorWithCode(error) && error.code === 'ENOENT') {\n return false;\n }\n\n throw wrapError(\n error,\n `Could not determine if directory exists '${directoryPath}'`,\n );\n }\n}\n\n/**\n * Create the given directory along with any directories leading up to the\n * directory, or do nothing if the directory already exists.\n *\n * @param directoryPath - The path to the desired directory.\n * @throws An error with a stack trace if reading fails in any way.\n */\nexport async function ensureDirectoryStructureExists(\n directoryPath: string,\n): Promise<void> {\n try {\n await fs.promises.mkdir(directoryPath, { recursive: true });\n } catch (error) {\n throw wrapError(\n error,\n `Could not create directory structure '${directoryPath}'`,\n );\n }\n}\n\n/**\n * Remove the given file or directory if it exists, or do nothing if it does\n * not.\n *\n * @param entryPath - The path to the file or directory.\n * @throws An error with a stack trace if removal fails in any way.\n */\nexport async function forceRemove(entryPath: string): Promise<void> {\n try {\n return await fs.promises.rm(entryPath, {\n recursive: true,\n force: true,\n });\n } catch (error) {\n throw wrapError(error, `Could not remove file or directory '${entryPath}'`);\n }\n}\n\n/**\n * Construct a sandbox object which can be used in tests that need temporary\n * access to the filesystem.\n *\n * @param projectName - The name of the project.\n * @returns The sandbox object. This contains a `withinSandbox` function which\n * can be used in tests (see example).\n * @example\n * ```typescript\n * const { withinSandbox } = createSandbox('utils');\n *\n * // ... later ...\n *\n * it('does something with the filesystem', async () => {\n * await withinSandbox(async ({ directoryPath }) => {\n * await fs.promises.writeFile(\n * path.join(directoryPath, 'some-file'),\n * 'some content',\n * 'utf8'\n * );\n * })\n * });\n * ```\n */\nexport function createSandbox(projectName: string): FileSandbox {\n const timestamp = new Date().getTime();\n const directoryPath = path.join(os.tmpdir(), `${projectName}--${timestamp}`);\n\n return {\n directoryPath,\n async withinSandbox(\n test: (args: { directoryPath: string }) => Promise<void>,\n ) {\n if (await directoryExists(directoryPath)) {\n throw new Error(`${directoryPath} already exists. Cannot continue.`);\n }\n\n await ensureDirectoryStructureExists(directoryPath);\n\n try {\n await test({ directoryPath });\n } finally {\n await forceRemove(directoryPath);\n }\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkQEPVHEP7js = require('./chunk-QEPVHEP7.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunk6ZDHSOUVjs = require('./chunk-6ZDHSOUV.js');
|
|
9
|
+
|
|
10
|
+
// src/coercers.ts
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var _superstruct = require('superstruct');
|
|
21
|
+
var NumberLikeStruct = _superstruct.union.call(void 0, [_superstruct.number.call(void 0, ), _superstruct.bigint.call(void 0, ), _superstruct.string.call(void 0, ), _chunkQEPVHEP7js.StrictHexStruct]);
|
|
22
|
+
var NumberCoercer = _superstruct.coerce.call(void 0, _superstruct.number.call(void 0, ), NumberLikeStruct, Number);
|
|
23
|
+
var BigIntCoercer = _superstruct.coerce.call(void 0, _superstruct.bigint.call(void 0, ), NumberLikeStruct, BigInt);
|
|
24
|
+
var BytesLikeStruct = _superstruct.union.call(void 0, [_chunkQEPVHEP7js.StrictHexStruct, _superstruct.instance.call(void 0, Uint8Array)]);
|
|
25
|
+
var BytesCoercer = _superstruct.coerce.call(void 0,
|
|
26
|
+
_superstruct.instance.call(void 0, Uint8Array),
|
|
27
|
+
_superstruct.union.call(void 0, [_chunkQEPVHEP7js.StrictHexStruct]),
|
|
28
|
+
_chunkQEPVHEP7js.hexToBytes
|
|
29
|
+
);
|
|
30
|
+
var HexCoercer = _superstruct.coerce.call(void 0, _chunkQEPVHEP7js.StrictHexStruct, _superstruct.instance.call(void 0, Uint8Array), _chunkQEPVHEP7js.bytesToHex);
|
|
31
|
+
function createNumber(value) {
|
|
32
|
+
try {
|
|
33
|
+
const result = _superstruct.create.call(void 0, value, NumberCoercer);
|
|
34
|
+
_chunk6ZDHSOUVjs.assert.call(void 0,
|
|
35
|
+
Number.isFinite(result),
|
|
36
|
+
`Expected a number-like value, got "${value}".`
|
|
37
|
+
);
|
|
38
|
+
return result;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (error instanceof _superstruct.StructError) {
|
|
41
|
+
throw new Error(`Expected a number-like value, got "${value}".`);
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function createBigInt(value) {
|
|
47
|
+
try {
|
|
48
|
+
return _superstruct.create.call(void 0, value, BigIntCoercer);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
if (error instanceof _superstruct.StructError) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
`Expected a number-like value, got "${String(error.value)}".`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function createBytes(value) {
|
|
59
|
+
if (typeof value === "string" && value.toLowerCase() === "0x") {
|
|
60
|
+
return new Uint8Array();
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
return _superstruct.create.call(void 0, value, BytesCoercer);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
if (error instanceof _superstruct.StructError) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
`Expected a bytes-like value, got "${String(error.value)}".`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function createHex(value) {
|
|
74
|
+
if (value instanceof Uint8Array && value.length === 0 || typeof value === "string" && value.toLowerCase() === "0x") {
|
|
75
|
+
return "0x";
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
return _superstruct.create.call(void 0, value, HexCoercer);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
if (error instanceof _superstruct.StructError) {
|
|
81
|
+
throw new Error(
|
|
82
|
+
`Expected a bytes-like value, got "${String(error.value)}".`
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
exports.createNumber = createNumber; exports.createBigInt = createBigInt; exports.createBytes = createBytes; exports.createHex = createHex;
|
|
95
|
+
//# sourceMappingURL=chunk-DHVKFDHQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/coercers.ts"],"names":[],"mappings":";;;;;;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAOP,IAAM,mBAAmB,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,eAAe,CAAC;AAC9E,IAAM,gBAAgB,OAAO,OAAO,GAAG,kBAAkB,MAAM;AAC/D,IAAM,gBAAgB,OAAO,OAAO,GAAG,kBAAkB,MAAM;AAE/D,IAAM,kBAAkB,MAAM,CAAC,iBAAiB,SAAS,UAAU,CAAC,CAAC;AACrE,IAAM,eAAe;AAAA,EACnB,SAAS,UAAU;AAAA,EACnB,MAAM,CAAC,eAAe,CAAC;AAAA,EACvB;AACF;AAEA,IAAM,aAAa,OAAO,iBAAiB,SAAS,UAAU,GAAG,UAAU;AA8BpE,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instance,\n number,\n string,\n StructError,\n union,\n} from 'superstruct';\n\nimport { assert } from './assert';\nimport { bytesToHex, hexToBytes } from './bytes';\nimport type { Hex } from './hex';\nimport { StrictHexStruct } from './hex';\n\nconst NumberLikeStruct = union([number(), bigint(), string(), StrictHexStruct]);\nconst NumberCoercer = coerce(number(), NumberLikeStruct, Number);\nconst BigIntCoercer = coerce(bigint(), NumberLikeStruct, BigInt);\n\nconst BytesLikeStruct = union([StrictHexStruct, instance(Uint8Array)]);\nconst BytesCoercer = coerce(\n instance(Uint8Array),\n union([StrictHexStruct]),\n hexToBytes,\n);\n\nconst HexCoercer = coerce(StrictHexStruct, instance(Uint8Array), bytesToHex);\n\nexport type NumberLike = Infer<typeof NumberLikeStruct>;\nexport type BytesLike = Infer<typeof BytesLikeStruct>;\n\n/**\n * Create a number from a number-like value.\n *\n * - If the value is a number, it is returned as-is.\n * - If the value is a `bigint`, it is converted to a number.\n * - If the value is a string, it is interpreted as a decimal number.\n * - If the value is a hex string (i.e., it starts with \"0x\"), it is\n * interpreted as a hexadecimal number.\n *\n * This validates that the value is a number-like value, and that the resulting\n * number is not `NaN` or `Infinity`.\n *\n * @example\n * ```typescript\n * const value = createNumber('0x010203');\n * console.log(value); // 66051\n *\n * const otherValue = createNumber(123n);\n * console.log(otherValue); // 123\n * ```\n * @param value - The value to create the number from.\n * @returns The created number.\n * @throws If the value is not a number-like value, or if the resulting number\n * is `NaN` or `Infinity`.\n */\nexport function createNumber(value: NumberLike): number {\n try {\n const result = create(value, NumberCoercer);\n\n assert(\n Number.isFinite(result),\n `Expected a number-like value, got \"${value}\".`,\n );\n\n return result;\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(`Expected a number-like value, got \"${value}\".`);\n }\n\n /* istanbul ignore next */\n throw error;\n }\n}\n\n/**\n * Create a `bigint` from a number-like value.\n *\n * - If the value is a number, it is converted to a `bigint`.\n * - If the value is a `bigint`, it is returned as-is.\n * - If the value is a string, it is interpreted as a decimal number and\n * converted to a `bigint`.\n * - If the value is a hex string (i.e., it starts with \"0x\"), it is\n * interpreted as a hexadecimal number and converted to a `bigint`.\n *\n * @example\n * ```typescript\n * const value = createBigInt('0x010203');\n * console.log(value); // 16909060n\n *\n * const otherValue = createBigInt(123);\n * console.log(otherValue); // 123n\n * ```\n * @param value - The value to create the bigint from.\n * @returns The created bigint.\n * @throws If the value is not a number-like value.\n */\nexport function createBigInt(value: NumberLike): bigint {\n try {\n // The `BigInt` constructor throws if the value is not a number-like value.\n // There is no need to validate the value manually.\n return create(value, BigIntCoercer);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Expected a number-like value, got \"${String(error.value)}\".`,\n );\n }\n\n /* istanbul ignore next */\n throw error;\n }\n}\n\n/**\n * Create a byte array from a bytes-like value.\n *\n * - If the value is a byte array, it is returned as-is.\n * - If the value is a hex string (i.e., it starts with \"0x\"), it is interpreted\n * as a hexadecimal number and converted to a byte array.\n *\n * @example\n * ```typescript\n * const value = createBytes('0x010203');\n * console.log(value); // Uint8Array [ 1, 2, 3 ]\n *\n * const otherValue = createBytes('0x010203');\n * console.log(otherValue); // Uint8Array [ 1, 2, 3 ]\n * ```\n * @param value - The value to create the byte array from.\n * @returns The created byte array.\n * @throws If the value is not a bytes-like value.\n */\nexport function createBytes(value: BytesLike): Uint8Array {\n if (typeof value === 'string' && value.toLowerCase() === '0x') {\n return new Uint8Array();\n }\n\n try {\n return create(value, BytesCoercer);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Expected a bytes-like value, got \"${String(error.value)}\".`,\n );\n }\n\n /* istanbul ignore next */\n throw error;\n }\n}\n\n/**\n * Create a hexadecimal string from a bytes-like value.\n *\n * - If the value is a hex string (i.e., it starts with \"0x\"), it is returned\n * as-is.\n * - If the value is a `Uint8Array`, it is converted to a hex string.\n *\n * @example\n * ```typescript\n * const value = createHex(new Uint8Array([1, 2, 3]));\n * console.log(value); // '0x010203'\n *\n * const otherValue = createHex('0x010203');\n * console.log(otherValue); // '0x010203'\n * ```\n * @param value - The value to create the hex string from.\n * @returns The created hex string.\n * @throws If the value is not a bytes-like value.\n */\nexport function createHex(value: BytesLike): Hex {\n if (\n (value instanceof Uint8Array && value.length === 0) ||\n (typeof value === 'string' && value.toLowerCase() === '0x')\n ) {\n return '0x';\n }\n\n try {\n return create(value, HexCoercer);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Expected a bytes-like value, got \"${String(error.value)}\".`,\n );\n }\n\n /* istanbul ignore next */\n throw error;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-DYMCEQIV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk6NZW4WK4js = require('./chunk-6NZW4WK4.js');
|
|
4
|
+
|
|
5
|
+
// src/checksum.ts
|
|
6
|
+
var _superstruct = require('superstruct');
|
|
7
|
+
var ChecksumStruct = _superstruct.size.call(void 0,
|
|
8
|
+
_chunk6NZW4WK4js.base64.call(void 0, _superstruct.string.call(void 0, ), { paddingRequired: true }),
|
|
9
|
+
44,
|
|
10
|
+
44
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.ChecksumStruct = ChecksumStruct;
|
|
16
|
+
//# sourceMappingURL=chunk-E4C7EW4R.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/checksum.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,MAAM,cAAc;AAItB,IAAM,iBAAiB;AAAA,EAC5B,OAAO,OAAO,GAAG,EAAE,iBAAiB,KAAK,CAAC;AAAA,EAC1C;AAAA,EACA;AACF","sourcesContent":["import { size, string } from 'superstruct';\n\nimport { base64 } from './base64';\n\nexport const ChecksumStruct = size(\n base64(string(), { paddingRequired: true }),\n 44,\n 44,\n);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";//# sourceMappingURL=chunk-EQMZL4XU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
base64
|
|
3
|
+
} from "./chunk-NQMRFZHB.mjs";
|
|
4
|
+
|
|
5
|
+
// src/checksum.ts
|
|
6
|
+
import { size, string } from "superstruct";
|
|
7
|
+
var ChecksumStruct = size(
|
|
8
|
+
base64(string(), { paddingRequired: true }),
|
|
9
|
+
44,
|
|
10
|
+
44
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
ChecksumStruct
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=chunk-GZS3IQBZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/checksum.ts"],"sourcesContent":["import { size, string } from 'superstruct';\n\nimport { base64 } from './base64';\n\nexport const ChecksumStruct = size(\n base64(string(), { paddingRequired: true }),\n 44,\n 44,\n);\n"],"mappings":";;;;;AAAA,SAAS,MAAM,cAAc;AAItB,IAAM,iBAAiB;AAAA,EAC5B,OAAO,OAAO,GAAG,EAAE,iBAAiB,KAAK,CAAC;AAAA,EAC1C;AAAA,EACA;AACF;","names":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// src/misc.ts
|
|
2
|
+
function isNonEmptyArray(value) {
|
|
3
|
+
return Array.isArray(value) && value.length > 0;
|
|
4
|
+
}
|
|
5
|
+
function isNullOrUndefined(value) {
|
|
6
|
+
return value === null || value === void 0;
|
|
7
|
+
}
|
|
8
|
+
function isObject(value) {
|
|
9
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
10
|
+
}
|
|
11
|
+
var hasProperty = (objectToCheck, name) => Object.hasOwnProperty.call(objectToCheck, name);
|
|
12
|
+
function getKnownPropertyNames(object) {
|
|
13
|
+
return Object.getOwnPropertyNames(object);
|
|
14
|
+
}
|
|
15
|
+
var JsonSize = /* @__PURE__ */ ((JsonSize2) => {
|
|
16
|
+
JsonSize2[JsonSize2["Null"] = 4] = "Null";
|
|
17
|
+
JsonSize2[JsonSize2["Comma"] = 1] = "Comma";
|
|
18
|
+
JsonSize2[JsonSize2["Wrapper"] = 1] = "Wrapper";
|
|
19
|
+
JsonSize2[JsonSize2["True"] = 4] = "True";
|
|
20
|
+
JsonSize2[JsonSize2["False"] = 5] = "False";
|
|
21
|
+
JsonSize2[JsonSize2["Quote"] = 1] = "Quote";
|
|
22
|
+
JsonSize2[JsonSize2["Colon"] = 1] = "Colon";
|
|
23
|
+
JsonSize2[JsonSize2["Date"] = 24] = "Date";
|
|
24
|
+
return JsonSize2;
|
|
25
|
+
})(JsonSize || {});
|
|
26
|
+
var ESCAPE_CHARACTERS_REGEXP = /"|\\|\n|\r|\t/gu;
|
|
27
|
+
function isPlainObject(value) {
|
|
28
|
+
if (typeof value !== "object" || value === null) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
let proto = value;
|
|
33
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
34
|
+
proto = Object.getPrototypeOf(proto);
|
|
35
|
+
}
|
|
36
|
+
return Object.getPrototypeOf(value) === proto;
|
|
37
|
+
} catch (_) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function isASCII(character) {
|
|
42
|
+
return character.charCodeAt(0) <= 127;
|
|
43
|
+
}
|
|
44
|
+
function calculateStringSize(value) {
|
|
45
|
+
const size = value.split("").reduce((total, character) => {
|
|
46
|
+
if (isASCII(character)) {
|
|
47
|
+
return total + 1;
|
|
48
|
+
}
|
|
49
|
+
return total + 2;
|
|
50
|
+
}, 0);
|
|
51
|
+
return size + (value.match(ESCAPE_CHARACTERS_REGEXP) ?? []).length;
|
|
52
|
+
}
|
|
53
|
+
function calculateNumberSize(value) {
|
|
54
|
+
return value.toString().length;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
isNonEmptyArray,
|
|
59
|
+
isNullOrUndefined,
|
|
60
|
+
isObject,
|
|
61
|
+
hasProperty,
|
|
62
|
+
getKnownPropertyNames,
|
|
63
|
+
JsonSize,
|
|
64
|
+
ESCAPE_CHARACTERS_REGEXP,
|
|
65
|
+
isPlainObject,
|
|
66
|
+
isASCII,
|
|
67
|
+
calculateStringSize,
|
|
68
|
+
calculateNumberSize
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=chunk-H4YFDLB7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/misc.ts"],"sourcesContent":["//\n// Types\n//\n\n/**\n * Makes every specified property of the specified object type mutable.\n *\n * @template ObjectValue - The object whose readonly properties to make mutable.\n * @template TargetKey - The property key(s) to make mutable.\n */\nexport type Mutable<\n ObjectValue extends Record<string, unknown>,\n TargetKey extends keyof ObjectValue,\n> = {\n -readonly [Key in keyof Pick<ObjectValue, TargetKey>]: ObjectValue[Key];\n} & {\n [Key in keyof Omit<ObjectValue, TargetKey>]: ObjectValue[Key];\n};\n\n/**\n * Useful for representing some value that _might_ be present and / or complete.\n *\n * @template Value - The value that might be present or complete.\n */\nexport type PartialOrAbsent<Value> = Partial<Value> | null | undefined;\n\n/**\n * Like {@link Array}, but always non-empty.\n *\n * @template Element - The non-empty array member type.\n */\nexport type NonEmptyArray<Element> = [Element, ...Element[]];\n\n/**\n * A JavaScript object that is not `null`, a function, or an array.\n */\nexport type RuntimeObject = Record<PropertyKey, unknown>;\n\n//\n// Type Guards\n//\n\n/**\n * A {@link NonEmptyArray} type guard.\n *\n * @template Element - The non-empty array member type.\n * @param value - The value to check.\n * @returns Whether the value is a non-empty array.\n */\nexport function isNonEmptyArray<Element>(\n value: Element[],\n): value is NonEmptyArray<Element> {\n return Array.isArray(value) && value.length > 0;\n}\n\n/**\n * Type guard for \"nullishness\".\n *\n * @param value - Any value.\n * @returns `true` if the value is null or undefined, `false` otherwise.\n */\nexport function isNullOrUndefined(value: unknown): value is null | undefined {\n return value === null || value === undefined;\n}\n\n/**\n * A type guard for {@link RuntimeObject}.\n *\n * @param value - The value to check.\n * @returns Whether the specified value has a runtime type of `object` and is\n * neither `null` nor an `Array`.\n */\nexport function isObject(value: unknown): value is RuntimeObject {\n return Boolean(value) && typeof value === 'object' && !Array.isArray(value);\n}\n\n//\n// Other utility functions\n//\n\n/**\n * A type guard for ensuring an object has a property.\n *\n * @param objectToCheck - The object to check.\n * @param name - The property name to check for.\n * @returns Whether the specified object has an own property with the specified\n * name, regardless of whether it is enumerable or not.\n */\nexport const hasProperty = <\n // eslint-disable-next-line @typescript-eslint/ban-types\n ObjectToCheck extends Object,\n Property extends PropertyKey,\n>(\n objectToCheck: ObjectToCheck,\n name: Property,\n): objectToCheck is ObjectToCheck &\n Record<\n Property,\n Property extends keyof ObjectToCheck ? ObjectToCheck[Property] : unknown\n > => Object.hasOwnProperty.call(objectToCheck, name);\n\n/**\n * `Object.getOwnPropertyNames()` is intentionally generic: it returns the\n * immediate property names of an object, but it cannot make guarantees about\n * the contents of that object, so the type of the property names is merely\n * `string[]`. While this is technically accurate, it is also unnecessary if we\n * have an object with a type that we own (such as an enum).\n *\n * @param object - The plain object.\n * @returns The own property names of the object which are assigned a type\n * derived from the object itself.\n */\nexport function getKnownPropertyNames<Key extends PropertyKey>(\n object: Partial<Record<Key, any>>,\n): Key[] {\n return Object.getOwnPropertyNames(object) as Key[];\n}\n\nexport type PlainObject = Record<number | string | symbol, unknown>;\n\n/**\n * Predefined sizes (in Bytes) of specific parts of JSON structure.\n */\nexport enum JsonSize {\n Null = 4,\n Comma = 1,\n Wrapper = 1,\n True = 4,\n False = 5,\n Quote = 1,\n Colon = 1,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Date = 24,\n}\n\n/**\n * Regular expression with pattern matching for (special) escaped characters.\n */\nexport const ESCAPE_CHARACTERS_REGEXP = /\"|\\\\|\\n|\\r|\\t/gu;\n\n/**\n * Check if the value is plain object.\n *\n * @param value - Value to be checked.\n * @returns True if an object is the plain JavaScript object,\n * false if the object is not plain (e.g. function).\n */\nexport function isPlainObject(value: unknown): value is PlainObject {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n\n try {\n let proto = value;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(value) === proto;\n } catch (_) {\n return false;\n }\n}\n\n/**\n * Check if character is ASCII.\n *\n * @param character - Character.\n * @returns True if a character code is ASCII, false if not.\n */\nexport function isASCII(character: string) {\n return character.charCodeAt(0) <= 127;\n}\n\n/**\n * Calculate string size.\n *\n * @param value - String value to calculate size.\n * @returns Number of bytes used to store whole string value.\n */\nexport function calculateStringSize(value: string): number {\n const size = value.split('').reduce((total, character) => {\n if (isASCII(character)) {\n return total + 1;\n }\n return total + 2;\n }, 0);\n\n // Also detect characters that need backslash escape\n return size + (value.match(ESCAPE_CHARACTERS_REGEXP) ?? []).length;\n}\n\n/**\n * Calculate size of a number ofter JSON serialization.\n *\n * @param value - Number value to calculate size.\n * @returns Number of bytes used to store whole number in JSON.\n */\nexport function calculateNumberSize(value: number): number {\n return value.toString().length;\n}\n"],"mappings":";AAiDO,SAAS,gBACd,OACiC;AACjC,SAAO,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS;AAChD;AAQO,SAAS,kBAAkB,OAA2C;AAC3E,SAAO,UAAU,QAAQ,UAAU;AACrC;AASO,SAAS,SAAS,OAAwC;AAC/D,SAAO,QAAQ,KAAK,KAAK,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAcO,IAAM,cAAc,CAKzB,eACA,SAKK,OAAO,eAAe,KAAK,eAAe,IAAI;AAa9C,SAAS,sBACd,QACO;AACP,SAAO,OAAO,oBAAoB,MAA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1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkQVEKZRZ2js = require('./chunk-QVEKZRZ2.js');
|
|
5
|
+
|
|
6
|
+
// src/errors.ts
|
|
7
|
+
var _ponycause = require('pony-cause');
|
|
8
|
+
function isError(error) {
|
|
9
|
+
return error instanceof Error || _chunkQVEKZRZ2js.isObject.call(void 0, error) && error.constructor.name === "Error";
|
|
10
|
+
}
|
|
11
|
+
function isErrorWithCode(error) {
|
|
12
|
+
return typeof error === "object" && error !== null && "code" in error;
|
|
13
|
+
}
|
|
14
|
+
function isErrorWithMessage(error) {
|
|
15
|
+
return typeof error === "object" && error !== null && "message" in error;
|
|
16
|
+
}
|
|
17
|
+
function isErrorWithStack(error) {
|
|
18
|
+
return typeof error === "object" && error !== null && "stack" in error;
|
|
19
|
+
}
|
|
20
|
+
function getErrorMessage(error) {
|
|
21
|
+
if (isErrorWithMessage(error) && typeof error.message === "string") {
|
|
22
|
+
return error.message;
|
|
23
|
+
}
|
|
24
|
+
if (_chunkQVEKZRZ2js.isNullOrUndefined.call(void 0, error)) {
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
return String(error);
|
|
28
|
+
}
|
|
29
|
+
function wrapError(originalError, message) {
|
|
30
|
+
if (isError(originalError)) {
|
|
31
|
+
let error;
|
|
32
|
+
if (Error.length === 2) {
|
|
33
|
+
error = new Error(message, { cause: originalError });
|
|
34
|
+
} else {
|
|
35
|
+
error = new (0, _ponycause.ErrorWithCause)(message, { cause: originalError });
|
|
36
|
+
}
|
|
37
|
+
if (isErrorWithCode(originalError)) {
|
|
38
|
+
error.code = originalError.code;
|
|
39
|
+
}
|
|
40
|
+
return error;
|
|
41
|
+
}
|
|
42
|
+
if (message.length > 0) {
|
|
43
|
+
return new Error(`${String(originalError)}: ${message}`);
|
|
44
|
+
}
|
|
45
|
+
return new Error(String(originalError));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
exports.isErrorWithCode = isErrorWithCode; exports.isErrorWithMessage = isErrorWithMessage; exports.isErrorWithStack = isErrorWithStack; exports.getErrorMessage = getErrorMessage; exports.wrapError = wrapError;
|
|
55
|
+
//# sourceMappingURL=chunk-IZC266HS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";;;;;;AAAA,SAAS,sBAAsB;AAY/B,SAAS,QAAQ,OAAgC;AAC/C,SACE,iBAAiB,SAChB,SAAS,KAAK,KAAK,MAAM,YAAY,SAAS;AAEnD;AAUO,SAAS,gBAAgB,OAA2C;AACzE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AAClE;AASO,SAAS,mBACd,OAC8B;AAC9B,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,aAAa;AACrE;AASO,SAAS,iBAAiB,OAA4C;AAC3E,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,WAAW;AACnE;AAWO,SAAS,gBAAgB,OAAwB;AACtD,MAAI,mBAAmB,KAAK,KAAK,OAAO,MAAM,YAAY,UAAU;AAClE,WAAO,MAAM;AAAA,EACf;AAEA,MAAI,kBAAkB,KAAK,GAAG;AAC5B,WAAO;AAAA,EACT;AAEA,SAAO,OAAO,KAAK;AACrB;AAeO,SAAS,UACd,eACA,SAC2B;AAC3B,MAAI,QAAQ,aAAa,GAAG;AAC1B,QAAI;AACJ,QAAI,MAAM,WAAW,GAAG;AAMtB,cAAQ,IAAI,MAAM,SAAS,EAAE,OAAO,cAAc,CAAC;AAAA,IACrD,OAAO;AAGL,cAAQ,IAAI,eAAe,SAAS,EAAE,OAAO,cAAc,CAAC;AAAA,IAC9D;AAEA,QAAI,gBAAgB,aAAa,GAAG;AAClC,YAAM,OAAO,cAAc;AAAA,IAC7B;AAEA,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ,SAAS,GAAG;AACtB,WAAO,IAAI,MAAM,GAAG,OAAO,aAAa,CAAC,KAAK,OAAO,EAAE;AAAA,EACzD;AAEA,SAAO,IAAI,MAAM,OAAO,aAAa,CAAC;AACxC","sourcesContent":["import { ErrorWithCause } from 'pony-cause';\n\nimport { isNullOrUndefined, isObject } from './misc';\n\n/**\n * Type guard for determining whether the given value is an instance of Error.\n * For errors generated via `fs.promises`, `error instanceof Error` won't work,\n * so we have to come up with another way of testing.\n *\n * @param error - The object to check.\n * @returns A boolean.\n */\nfunction isError(error: unknown): error is Error {\n return (\n error instanceof Error ||\n (isObject(error) && error.constructor.name === 'Error')\n );\n}\n\n/**\n * Type guard for determining whether the given value is an error object with a\n * `code` property such as the type of error that Node throws for filesystem\n * operations, etc.\n *\n * @param error - The object to check.\n * @returns A boolean.\n */\nexport function isErrorWithCode(error: unknown): error is { code: string } {\n return typeof error === 'object' && error !== null && 'code' in error;\n}\n\n/**\n * Type guard for determining whether the given value is an error object with a\n * `message` property, such as an instance of Error.\n *\n * @param error - The object to check.\n * @returns A boolean.\n */\nexport function isErrorWithMessage(\n error: unknown,\n): error is { message: string } {\n return typeof error === 'object' && error !== null && 'message' in error;\n}\n\n/**\n * Type guard for determining whether the given value is an error object with a\n * `stack` property, such as an instance of Error.\n *\n * @param error - The object to check.\n * @returns A boolean.\n */\nexport function isErrorWithStack(error: unknown): error is { stack: string } {\n return typeof error === 'object' && error !== null && 'stack' in error;\n}\n\n/**\n * Attempts to obtain the message from a possible error object, defaulting to an\n * empty string if it is impossible to do so.\n *\n * @param error - The possible error to get the message from.\n * @returns The message if `error` is an object with a `message` property;\n * the string version of `error` if it is not `undefined` or `null`; otherwise\n * an empty string.\n */\nexport function getErrorMessage(error: unknown): string {\n if (isErrorWithMessage(error) && typeof error.message === 'string') {\n return error.message;\n }\n\n if (isNullOrUndefined(error)) {\n return '';\n }\n\n return String(error);\n}\n\n/**\n * Builds a new error object, linking it to the original error via the `cause`\n * property if it is an Error.\n *\n * This function is useful to reframe error messages in general, but is\n * _critical_ when interacting with any of Node's filesystem functions as\n * provided via `fs.promises`, because these do not produce stack traces in the\n * case of an I/O error (see <https://github.com/nodejs/node/issues/30944>).\n *\n * @param originalError - The error to be wrapped (something throwable).\n * @param message - The desired message of the new error.\n * @returns A new error object.\n */\nexport function wrapError<Throwable>(\n originalError: Throwable,\n message: string,\n): Error & { code?: string } {\n if (isError(originalError)) {\n let error: Error & { code?: string };\n if (Error.length === 2) {\n // for some reason `tsserver` is not complaining that the\n // Error constructor doesn't support a second argument in the editor,\n // but `tsc` does. Error causes are not supported by our current tsc target (ES2020, we need ES2022 to make this work)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n error = new Error(message, { cause: originalError });\n } else {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n error = new ErrorWithCause(message, { cause: originalError });\n }\n\n if (isErrorWithCode(originalError)) {\n error.code = originalError.code;\n }\n\n return error;\n }\n\n if (message.length > 0) {\n return new Error(`${String(originalError)}: ${message}`);\n }\n\n return new Error(String(originalError));\n}\n"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__privateAdd,
|
|
3
|
+
__privateGet,
|
|
4
|
+
__privateSet
|
|
5
|
+
} from "./chunk-X66SUIEF.mjs";
|
|
6
|
+
|
|
7
|
+
// src/collections.ts
|
|
8
|
+
var _map;
|
|
9
|
+
var FrozenMap = class {
|
|
10
|
+
constructor(entries) {
|
|
11
|
+
__privateAdd(this, _map, void 0);
|
|
12
|
+
__privateSet(this, _map, new Map(entries));
|
|
13
|
+
Object.freeze(this);
|
|
14
|
+
}
|
|
15
|
+
get size() {
|
|
16
|
+
return __privateGet(this, _map).size;
|
|
17
|
+
}
|
|
18
|
+
[Symbol.iterator]() {
|
|
19
|
+
return __privateGet(this, _map)[Symbol.iterator]();
|
|
20
|
+
}
|
|
21
|
+
entries() {
|
|
22
|
+
return __privateGet(this, _map).entries();
|
|
23
|
+
}
|
|
24
|
+
forEach(callbackfn, thisArg) {
|
|
25
|
+
return __privateGet(this, _map).forEach(
|
|
26
|
+
(value, key, _map2) => callbackfn.call(thisArg, value, key, this)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
get(key) {
|
|
30
|
+
return __privateGet(this, _map).get(key);
|
|
31
|
+
}
|
|
32
|
+
has(key) {
|
|
33
|
+
return __privateGet(this, _map).has(key);
|
|
34
|
+
}
|
|
35
|
+
keys() {
|
|
36
|
+
return __privateGet(this, _map).keys();
|
|
37
|
+
}
|
|
38
|
+
values() {
|
|
39
|
+
return __privateGet(this, _map).values();
|
|
40
|
+
}
|
|
41
|
+
toString() {
|
|
42
|
+
return `FrozenMap(${this.size}) {${this.size > 0 ? ` ${[...this.entries()].map(([key, value]) => `${String(key)} => ${String(value)}`).join(", ")} ` : ""}}`;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
_map = new WeakMap();
|
|
46
|
+
var _set;
|
|
47
|
+
var FrozenSet = class {
|
|
48
|
+
constructor(values) {
|
|
49
|
+
__privateAdd(this, _set, void 0);
|
|
50
|
+
__privateSet(this, _set, new Set(values));
|
|
51
|
+
Object.freeze(this);
|
|
52
|
+
}
|
|
53
|
+
get size() {
|
|
54
|
+
return __privateGet(this, _set).size;
|
|
55
|
+
}
|
|
56
|
+
[Symbol.iterator]() {
|
|
57
|
+
return __privateGet(this, _set)[Symbol.iterator]();
|
|
58
|
+
}
|
|
59
|
+
entries() {
|
|
60
|
+
return __privateGet(this, _set).entries();
|
|
61
|
+
}
|
|
62
|
+
forEach(callbackfn, thisArg) {
|
|
63
|
+
return __privateGet(this, _set).forEach(
|
|
64
|
+
(value, value2, _set2) => callbackfn.call(thisArg, value, value2, this)
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
has(value) {
|
|
68
|
+
return __privateGet(this, _set).has(value);
|
|
69
|
+
}
|
|
70
|
+
keys() {
|
|
71
|
+
return __privateGet(this, _set).keys();
|
|
72
|
+
}
|
|
73
|
+
values() {
|
|
74
|
+
return __privateGet(this, _set).values();
|
|
75
|
+
}
|
|
76
|
+
toString() {
|
|
77
|
+
return `FrozenSet(${this.size}) {${this.size > 0 ? ` ${[...this.values()].map((member) => String(member)).join(", ")} ` : ""}}`;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
_set = new WeakMap();
|
|
81
|
+
Object.freeze(FrozenMap);
|
|
82
|
+
Object.freeze(FrozenMap.prototype);
|
|
83
|
+
Object.freeze(FrozenSet);
|
|
84
|
+
Object.freeze(FrozenSet.prototype);
|
|
85
|
+
|
|
86
|
+
export {
|
|
87
|
+
FrozenMap,
|
|
88
|
+
FrozenSet
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=chunk-JPAL7Q5S.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/collections.ts"],"sourcesContent":["/**\n * A {@link ReadonlyMap} that cannot be modified after instantiation.\n * The implementation uses an inner map hidden via a private field, and the\n * immutability guarantee relies on it being impossible to get a reference\n * to this map.\n */\nclass FrozenMap<Key, Value> implements ReadonlyMap<Key, Value> {\n readonly #map: Map<Key, Value>;\n\n public get size() {\n return this.#map.size;\n }\n\n public [Symbol.iterator]() {\n return this.#map[Symbol.iterator]();\n }\n\n constructor(entries?: readonly (readonly [Key, Value])[] | null) {\n this.#map = new Map<Key, Value>(entries);\n Object.freeze(this);\n }\n\n public entries() {\n return this.#map.entries();\n }\n\n public forEach(\n callbackfn: (value: Value, key: Key, map: this) => void,\n thisArg?: any,\n ): void {\n // We have to wrap the specified callback in order to prevent it from\n // receiving a reference to the inner map.\n return this.#map.forEach((value: Value, key: Key, _map: unknown) =>\n callbackfn.call(thisArg, value, key, this),\n );\n }\n\n public get(key: Key) {\n return this.#map.get(key);\n }\n\n public has(key: Key) {\n return this.#map.has(key);\n }\n\n public keys() {\n return this.#map.keys();\n }\n\n public values() {\n return this.#map.values();\n }\n\n public toString(): string {\n return `FrozenMap(${this.size}) {${\n this.size > 0\n ? ` ${[...this.entries()]\n .map(([key, value]) => `${String(key)} => ${String(value)}`)\n .join(', ')} `\n : ''\n }}`;\n }\n}\n\n/**\n * A {@link ReadonlySet} that cannot be modified after instantiation.\n * The implementation uses an inner set hidden via a private field, and the\n * immutability guarantee relies on it being impossible to get a reference\n * to this set.\n */\nclass FrozenSet<Value> implements ReadonlySet<Value> {\n readonly #set: Set<Value>;\n\n public get size() {\n return this.#set.size;\n }\n\n public [Symbol.iterator]() {\n return this.#set[Symbol.iterator]();\n }\n\n constructor(values?: readonly Value[] | null) {\n this.#set = new Set<Value>(values);\n Object.freeze(this);\n }\n\n public entries() {\n return this.#set.entries();\n }\n\n public forEach(\n callbackfn: (value: Value, value2: Value, set: this) => void,\n thisArg?: any,\n ): void {\n // We have to wrap the specified callback in order to prevent it from\n // receiving a reference to the inner set.\n return this.#set.forEach((value: Value, value2: Value, _set: unknown) =>\n callbackfn.call(thisArg, value, value2, this),\n );\n }\n\n public has(value: Value) {\n return this.#set.has(value);\n }\n\n public keys() {\n return this.#set.keys();\n }\n\n public values() {\n return this.#set.values();\n }\n\n public toString(): string {\n return `FrozenSet(${this.size}) {${\n this.size > 0\n ? ` ${[...this.values()].map((member) => String(member)).join(', ')} `\n : ''\n }}`;\n }\n}\n\nObject.freeze(FrozenMap);\nObject.freeze(FrozenMap.prototype);\n\nObject.freeze(FrozenSet);\nObject.freeze(FrozenSet.prototype);\n\nexport { FrozenMap, FrozenSet };\n"],"mappings":";;;;;;;AAAA;AAMA,IAAM,YAAN,MAA+D;AAAA,EAW7D,YAAY,SAAqD;AAVjE,uBAAS,MAAT;AAWE,uBAAK,MAAO,IAAI,IAAgB,OAAO;AACvC,WAAO,OAAO,IAAI;AAAA,EACpB;AAAA,EAXA,IAAW,OAAO;AAChB,WAAO,mBAAK,MAAK;AAAA,EACnB;AAAA,EAEA,CAAQ,OAAO,QAAQ,IAAI;AACzB,WAAO,mBAAK,MAAK,OAA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,UACrD,WAAW,KAAK,SAAS,OAAO,QAAQ,IAAI;AAAA,IAC9C;AAAA,EACF;AAAA,EAEO,IAAI,OAAc;AACvB,WAAO,mBAAK,MAAK,IAAI,KAAK;AAAA,EAC5B;AAAA,EAEO,OAAO;AACZ,WAAO,mBAAK,MAAK,KAAK;AAAA,EACxB;AAAA,EAEO,SAAS;AACd,WAAO,mBAAK,MAAK,OAAO;AAAA,EAC1B;AAAA,EAEO,WAAmB;AACxB,WAAO,aAAa,KAAK,IAAI,MAC3B,KAAK,OAAO,IACR,IAAI,CAAC,GAAG,KAAK,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,OAAO,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,MACjE,EACN;AAAA,EACF;AACF;AAjDW;AAmDX,OAAO,OAAO,SAAS;AACvB,OAAO,OAAO,UAAU,SAAS;AAEjC,OAAO,OAAO,SAAS;AACvB,OAAO,OAAO,UAAU,SAAS;","names":["_map","_set"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";//# sourceMappingURL=chunk-LC2CRSWD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assert
|
|
3
|
+
} from "./chunk-74DGVJVE.mjs";
|
|
4
|
+
|
|
5
|
+
// src/base64.ts
|
|
6
|
+
import { pattern } from "superstruct";
|
|
7
|
+
var base64 = (struct, options = {}) => {
|
|
8
|
+
const paddingRequired = options.paddingRequired ?? false;
|
|
9
|
+
const characterSet = options.characterSet ?? "base64";
|
|
10
|
+
let letters;
|
|
11
|
+
if (characterSet === "base64") {
|
|
12
|
+
letters = String.raw`[A-Za-z0-9+\/]`;
|
|
13
|
+
} else {
|
|
14
|
+
assert(characterSet === "base64url");
|
|
15
|
+
letters = String.raw`[-_A-Za-z0-9]`;
|
|
16
|
+
}
|
|
17
|
+
let re;
|
|
18
|
+
if (paddingRequired) {
|
|
19
|
+
re = new RegExp(
|
|
20
|
+
`^(?:${letters}{4})*(?:${letters}{3}=|${letters}{2}==)?$`,
|
|
21
|
+
"u"
|
|
22
|
+
);
|
|
23
|
+
} else {
|
|
24
|
+
re = new RegExp(
|
|
25
|
+
`^(?:${letters}{4})*(?:${letters}{2,3}|${letters}{3}=|${letters}{2}==)?$`,
|
|
26
|
+
"u"
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return pattern(struct, re);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
base64
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=chunk-NQMRFZHB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/base64.ts"],"sourcesContent":["import type { Struct } from 'superstruct';\nimport { pattern } from 'superstruct';\n\nimport { assert } from './assert';\n\nexport type Base64Options = {\n /**\n * Is the `=` padding at the end required or not.\n *\n * @default false\n */\n // Padding is optional in RFC 4648, that's why the default value is false\n paddingRequired?: boolean;\n /**\n * Which character set should be used.\n * The sets are based on {@link https://datatracker.ietf.org/doc/html/rfc4648 RFC 4648}.\n *\n * @default 'base64'\n */\n characterSet?: 'base64' | 'base64url';\n};\n\n/**\n * Ensure that a provided string-based struct is valid base64.\n *\n * @param struct - The string based struct.\n * @param options - Optional options to specialize base64 validation. See {@link Base64Options} documentation.\n * @returns A superstruct validating base64.\n */\nexport const base64 = <Type extends string, Schema>(\n struct: Struct<Type, Schema>,\n options: Base64Options = {},\n) => {\n const paddingRequired = options.paddingRequired ?? false;\n const characterSet = options.characterSet ?? 'base64';\n\n let letters: string;\n if (characterSet === 'base64') {\n letters = String.raw`[A-Za-z0-9+\\/]`;\n } else {\n assert(characterSet === 'base64url');\n letters = String.raw`[-_A-Za-z0-9]`;\n }\n\n let re: RegExp;\n if (paddingRequired) {\n re = new RegExp(\n `^(?:${letters}{4})*(?:${letters}{3}=|${letters}{2}==)?$`,\n 'u',\n );\n } else {\n re = new RegExp(\n `^(?:${letters}{4})*(?:${letters}{2,3}|${letters}{3}=|${letters}{2}==)?$`,\n 'u',\n );\n }\n\n return pattern(struct, re);\n};\n"],"mappings":";;;;;AACA,SAAS,eAAe;AA4BjB,IAAM,SAAS,CACpB,QACA,UAAyB,CAAC,MACvB;AACH,QAAM,kBAAkB,QAAQ,mBAAmB;AACnD,QAAM,eAAe,QAAQ,gBAAgB;AAE7C,MAAI;AACJ,MAAI,iBAAiB,UAAU;AAC7B,cAAU,OAAO;AAAA,EACnB,OAAO;AACL,WAAO,iBAAiB,WAAW;AACnC,cAAU,OAAO;AAAA,EACnB;AAEA,MAAI;AACJ,MAAI,iBAAiB;AACnB,SAAK,IAAI;AAAA,MACP,OAAO,OAAO,WAAW,OAAO,QAAQ,OAAO;AAAA,MAC/C;AAAA,IACF;AAAA,EACF,OAAO;AACL,SAAK,IAAI;AAAA,MACP,OAAO,OAAO,WAAW,OAAO,SAAS,OAAO,QAAQ,OAAO;AAAA,MAC/D;AAAA,IACF;AAAA,EACF;AAEA,SAAO,QAAQ,QAAQ,EAAE;AAC3B;","names":[]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StrictHexStruct,
|
|
3
|
+
bytesToHex,
|
|
4
|
+
hexToBytes
|
|
5
|
+
} from "./chunk-VA2DRBDE.mjs";
|
|
6
|
+
import {
|
|
7
|
+
assert
|
|
8
|
+
} from "./chunk-74DGVJVE.mjs";
|
|
9
|
+
|
|
10
|
+
// src/coercers.ts
|
|
11
|
+
import {
|
|
12
|
+
bigint,
|
|
13
|
+
coerce,
|
|
14
|
+
create,
|
|
15
|
+
instance,
|
|
16
|
+
number,
|
|
17
|
+
string,
|
|
18
|
+
StructError,
|
|
19
|
+
union
|
|
20
|
+
} from "superstruct";
|
|
21
|
+
var NumberLikeStruct = union([number(), bigint(), string(), StrictHexStruct]);
|
|
22
|
+
var NumberCoercer = coerce(number(), NumberLikeStruct, Number);
|
|
23
|
+
var BigIntCoercer = coerce(bigint(), NumberLikeStruct, BigInt);
|
|
24
|
+
var BytesLikeStruct = union([StrictHexStruct, instance(Uint8Array)]);
|
|
25
|
+
var BytesCoercer = coerce(
|
|
26
|
+
instance(Uint8Array),
|
|
27
|
+
union([StrictHexStruct]),
|
|
28
|
+
hexToBytes
|
|
29
|
+
);
|
|
30
|
+
var HexCoercer = coerce(StrictHexStruct, instance(Uint8Array), bytesToHex);
|
|
31
|
+
function createNumber(value) {
|
|
32
|
+
try {
|
|
33
|
+
const result = create(value, NumberCoercer);
|
|
34
|
+
assert(
|
|
35
|
+
Number.isFinite(result),
|
|
36
|
+
`Expected a number-like value, got "${value}".`
|
|
37
|
+
);
|
|
38
|
+
return result;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (error instanceof StructError) {
|
|
41
|
+
throw new Error(`Expected a number-like value, got "${value}".`);
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function createBigInt(value) {
|
|
47
|
+
try {
|
|
48
|
+
return create(value, BigIntCoercer);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
if (error instanceof StructError) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
`Expected a number-like value, got "${String(error.value)}".`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function createBytes(value) {
|
|
59
|
+
if (typeof value === "string" && value.toLowerCase() === "0x") {
|
|
60
|
+
return new Uint8Array();
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
return create(value, BytesCoercer);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
if (error instanceof StructError) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
`Expected a bytes-like value, got "${String(error.value)}".`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function createHex(value) {
|
|
74
|
+
if (value instanceof Uint8Array && value.length === 0 || typeof value === "string" && value.toLowerCase() === "0x") {
|
|
75
|
+
return "0x";
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
return create(value, HexCoercer);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
if (error instanceof StructError) {
|
|
81
|
+
throw new Error(
|
|
82
|
+
`Expected a bytes-like value, got "${String(error.value)}".`
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
createNumber,
|
|
91
|
+
createBigInt,
|
|
92
|
+
createBytes,
|
|
93
|
+
createHex
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=chunk-O3EIM33O.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/coercers.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport {\n bigint,\n coerce,\n create,\n instance,\n number,\n string,\n StructError,\n union,\n} from 'superstruct';\n\nimport { assert } from './assert';\nimport { bytesToHex, hexToBytes } from './bytes';\nimport type { Hex } from './hex';\nimport { StrictHexStruct } from './hex';\n\nconst NumberLikeStruct = union([number(), bigint(), string(), StrictHexStruct]);\nconst NumberCoercer = coerce(number(), NumberLikeStruct, Number);\nconst BigIntCoercer = coerce(bigint(), NumberLikeStruct, BigInt);\n\nconst BytesLikeStruct = union([StrictHexStruct, instance(Uint8Array)]);\nconst BytesCoercer = coerce(\n instance(Uint8Array),\n union([StrictHexStruct]),\n hexToBytes,\n);\n\nconst HexCoercer = coerce(StrictHexStruct, instance(Uint8Array), bytesToHex);\n\nexport type NumberLike = Infer<typeof NumberLikeStruct>;\nexport type BytesLike = Infer<typeof BytesLikeStruct>;\n\n/**\n * Create a number from a number-like value.\n *\n * - If the value is a number, it is returned as-is.\n * - If the value is a `bigint`, it is converted to a number.\n * - If the value is a string, it is interpreted as a decimal number.\n * - If the value is a hex string (i.e., it starts with \"0x\"), it is\n * interpreted as a hexadecimal number.\n *\n * This validates that the value is a number-like value, and that the resulting\n * number is not `NaN` or `Infinity`.\n *\n * @example\n * ```typescript\n * const value = createNumber('0x010203');\n * console.log(value); // 66051\n *\n * const otherValue = createNumber(123n);\n * console.log(otherValue); // 123\n * ```\n * @param value - The value to create the number from.\n * @returns The created number.\n * @throws If the value is not a number-like value, or if the resulting number\n * is `NaN` or `Infinity`.\n */\nexport function createNumber(value: NumberLike): number {\n try {\n const result = create(value, NumberCoercer);\n\n assert(\n Number.isFinite(result),\n `Expected a number-like value, got \"${value}\".`,\n );\n\n return result;\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(`Expected a number-like value, got \"${value}\".`);\n }\n\n /* istanbul ignore next */\n throw error;\n }\n}\n\n/**\n * Create a `bigint` from a number-like value.\n *\n * - If the value is a number, it is converted to a `bigint`.\n * - If the value is a `bigint`, it is returned as-is.\n * - If the value is a string, it is interpreted as a decimal number and\n * converted to a `bigint`.\n * - If the value is a hex string (i.e., it starts with \"0x\"), it is\n * interpreted as a hexadecimal number and converted to a `bigint`.\n *\n * @example\n * ```typescript\n * const value = createBigInt('0x010203');\n * console.log(value); // 16909060n\n *\n * const otherValue = createBigInt(123);\n * console.log(otherValue); // 123n\n * ```\n * @param value - The value to create the bigint from.\n * @returns The created bigint.\n * @throws If the value is not a number-like value.\n */\nexport function createBigInt(value: NumberLike): bigint {\n try {\n // The `BigInt` constructor throws if the value is not a number-like value.\n // There is no need to validate the value manually.\n return create(value, BigIntCoercer);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Expected a number-like value, got \"${String(error.value)}\".`,\n );\n }\n\n /* istanbul ignore next */\n throw error;\n }\n}\n\n/**\n * Create a byte array from a bytes-like value.\n *\n * - If the value is a byte array, it is returned as-is.\n * - If the value is a hex string (i.e., it starts with \"0x\"), it is interpreted\n * as a hexadecimal number and converted to a byte array.\n *\n * @example\n * ```typescript\n * const value = createBytes('0x010203');\n * console.log(value); // Uint8Array [ 1, 2, 3 ]\n *\n * const otherValue = createBytes('0x010203');\n * console.log(otherValue); // Uint8Array [ 1, 2, 3 ]\n * ```\n * @param value - The value to create the byte array from.\n * @returns The created byte array.\n * @throws If the value is not a bytes-like value.\n */\nexport function createBytes(value: BytesLike): Uint8Array {\n if (typeof value === 'string' && value.toLowerCase() === '0x') {\n return new Uint8Array();\n }\n\n try {\n return create(value, BytesCoercer);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Expected a bytes-like value, got \"${String(error.value)}\".`,\n );\n }\n\n /* istanbul ignore next */\n throw error;\n }\n}\n\n/**\n * Create a hexadecimal string from a bytes-like value.\n *\n * - If the value is a hex string (i.e., it starts with \"0x\"), it is returned\n * as-is.\n * - If the value is a `Uint8Array`, it is converted to a hex string.\n *\n * @example\n * ```typescript\n * const value = createHex(new Uint8Array([1, 2, 3]));\n * console.log(value); // '0x010203'\n *\n * const otherValue = createHex('0x010203');\n * console.log(otherValue); // '0x010203'\n * ```\n * @param value - The value to create the hex string from.\n * @returns The created hex string.\n * @throws If the value is not a bytes-like value.\n */\nexport function createHex(value: BytesLike): Hex {\n if (\n (value instanceof Uint8Array && value.length === 0) ||\n (typeof value === 'string' && value.toLowerCase() === '0x')\n ) {\n return '0x';\n }\n\n try {\n return create(value, HexCoercer);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Expected a bytes-like value, got \"${String(error.value)}\".`,\n );\n }\n\n /* istanbul ignore next */\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAOP,IAAM,mBAAmB,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,eAAe,CAAC;AAC9E,IAAM,gBAAgB,OAAO,OAAO,GAAG,kBAAkB,MAAM;AAC/D,IAAM,gBAAgB,OAAO,OAAO,GAAG,kBAA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