@wener/utils 1.1.17 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +5 -5
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/server.cjs +1 -1
- package/dist/cjs/server.cjs.map +1 -1
- package/dist/esm/index.js +11 -11
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server.js +1 -1
- package/dist/esm/server.js.map +1 -1
- package/dist/system/index.js +5 -5
- package/dist/system/index.js.map +1 -1
- package/dist/system/server.js +1 -1
- package/dist/system/server.js.map +1 -1
- package/lib/asyncs/createLazyPromise.js.map +1 -1
- package/lib/browsers/download.js.map +1 -1
- package/lib/browsers/getFileFromDataTransfer.js.map +1 -1
- package/lib/browsers/loaders.js.map +1 -1
- package/lib/crypto/getNodeCrypto.js.map +1 -1
- package/lib/crypto/getRandomValues.js.map +1 -1
- package/lib/crypto/pem/pem.js.map +1 -1
- package/lib/crypto/ulid.js +4 -1
- package/lib/crypto/ulid.js.map +1 -1
- package/lib/fetch/dumpRequest.js.map +1 -1
- package/lib/fetch/dumpResponse.js.map +1 -1
- package/lib/i18n/createTranslate.js.map +1 -1
- package/lib/io/ArrayBuffers.js +142 -164
- package/lib/io/ArrayBuffers.js.map +1 -1
- package/lib/io/Buffer.js +5 -6
- package/lib/io/Buffer.js.map +1 -1
- package/lib/libs/ms.js.map +1 -1
- package/lib/modules/parseModuleId.js.map +1 -1
- package/lib/server.js +8 -7
- package/lib/server.js.map +1 -1
- package/lib/servers/crypto/md5.js.map +1 -0
- package/lib/servers/fetch/createFetchWithProxy.js.map +1 -0
- package/lib/servers/fetch/createFetchWithProxyByUndici.js.map +1 -0
- package/lib/servers/{createFetchWithRetry.js → fetch/createFetchWithRetry.js} +1 -1
- package/lib/servers/fetch/createFetchWithRetry.js.map +1 -0
- package/lib/servers/getPackageDir.js +18 -0
- package/lib/servers/getPackageDir.js.map +1 -0
- package/lib/servers/polyfill/polyfillBrowser.js.map +1 -0
- package/lib/servers/{polyfillCrypto.js → polyfill/polyfillCrypto.js} +1 -1
- package/lib/servers/polyfill/polyfillCrypto.js.map +1 -0
- package/lib/servers/polyfill/polyfillFetch.js.map +1 -0
- package/lib/servers/{polyfillJsDom.js → polyfill/polyfillJsDom.js} +1 -1
- package/lib/servers/polyfill/polyfillJsDom.js.map +1 -0
- package/lib/strings/formatBytes.js.map +1 -1
- package/lib/validations/isUUID.js +1 -1
- package/lib/validations/isUUID.js.map +1 -1
- package/lib/validations/parseTimestamp.js.map +1 -1
- package/package.json +6 -9
- package/src/crypto/hashing.test.ts +4 -1
- package/src/crypto/ulid.test.ts +14 -1
- package/src/crypto/ulid.ts +5 -2
- package/src/langs/hashCode.ts +37 -0
- package/src/logging/Logger.ts +6 -6
- package/src/logging/slog.test.ts +8 -0
- package/src/logging/slog.ts +100 -0
- package/src/server.ts +8 -7
- package/src/servers/{createFetchWithProxyByNodeFetch.ts → fetch/createFetchWithProxyByNodeFetch.ts} +2 -2
- package/src/servers/{createFetchWithProxyByUndici.ts → fetch/createFetchWithProxyByUndici.ts} +2 -2
- package/src/servers/{createFetchWithRetry.ts → fetch/createFetchWithRetry.ts} +2 -2
- package/src/servers/getPackageDir.ts +16 -0
- package/src/servers/{polyfillCrypto.ts → polyfill/polyfillCrypto.ts} +1 -1
- package/src/servers/{polyfillFetch.ts → polyfill/polyfillFetch.ts} +1 -1
- package/src/servers/{polyfillJsDom.ts → polyfill/polyfillJsDom.ts} +1 -1
- package/src/servers/{polyfillWebSocket.ts → polyfill/polyfillWebSocket.ts} +2 -2
- package/src/validations/isUUID.test.ts +14 -0
- package/src/validations/isUUID.ts +2 -2
- package/lib/servers/createFetchWithProxy.js.map +0 -1
- package/lib/servers/createFetchWithProxyByUndici.js.map +0 -1
- package/lib/servers/createFetchWithRetry.js.map +0 -1
- package/lib/servers/md5.js.map +0 -1
- package/lib/servers/polyfillBrowser.js.map +0 -1
- package/lib/servers/polyfillCrypto.js.map +0 -1
- package/lib/servers/polyfillFetch.js.map +0 -1
- package/lib/servers/polyfillJsDom.js.map +0 -1
- /package/lib/servers/{md5.js → crypto/md5.js} +0 -0
- /package/lib/servers/{createFetchWithProxy.js → fetch/createFetchWithProxy.js} +0 -0
- /package/lib/servers/{createFetchWithProxyByUndici.js → fetch/createFetchWithProxyByUndici.js} +0 -0
- /package/lib/servers/{polyfillBrowser.js → polyfill/polyfillBrowser.js} +0 -0
- /package/lib/servers/{polyfillFetch.js → polyfill/polyfillFetch.js} +0 -0
- /package/src/servers/{md5.ts → crypto/md5.ts} +0 -0
- /package/src/servers/{createFetchWithProxy.ts → fetch/createFetchWithProxy.ts} +0 -0
- /package/src/servers/{polyfillBrowser.test.ts → polyfill/polyfillBrowser.test.ts} +0 -0
- /package/src/servers/{polyfillBrowser.ts → polyfill/polyfillBrowser.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polyfillBrowser.js","sources":["../../../src/servers/polyfill/polyfillBrowser.ts"],"sourcesContent":["import { polyfillCrypto } from './polyfillCrypto';\nimport { polyfillFetch } from './polyfillFetch';\nimport { polyfillJsDom } from './polyfillJsDom';\n\n/**\n * Polyfills the browser environment with the necessary APIs for the server.\n * Currently, this includes:\n * - `window`\n * - `document`\n * - `fetch`\n * - `crypto`\n */\nexport async function polyfillBrowser() {\n await polyfillCrypto();\n await polyfillFetch();\n await polyfillJsDom();\n}\n"],"names":[],"mappings":";;;;AAYA,eAAsB,eAAkB,GAAA;AACtC,EAAA,MAAM,cAAe,EAAA,CAAA;AACrB,EAAA,MAAM,aAAc,EAAA,CAAA;AACpB,EAAA,MAAM,aAAc,EAAA,CAAA;AACtB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polyfillCrypto.js","sources":["../../../src/servers/polyfill/polyfillCrypto.ts"],"sourcesContent":["import { getGlobalThis } from '../../isomorphics/getGlobalThis';\n\nexport async function polyfillCrypto() {\n const globalThis = getGlobalThis();\n if ('crypto' in globalThis) {\n return false;\n }\n (globalThis as any).crypto = (await import('node:crypto')).webcrypto as Crypto;\n return true;\n}\n"],"names":[],"mappings":";;AAEA,eAAsB,cAAiB,GAAA;AACrC,EAAA,MAAM,aAAa,aAAc,EAAA,CAAA;AACjC,EAAA,IAAI,YAAY,UAAY,EAAA;AAC1B,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AACA,EAAC,UAAmB,CAAA,MAAA,GAAA,CAAU,MAAM,OAAO,aAAa,CAAG,EAAA,SAAA,CAAA;AAC3D,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polyfillFetch.js","sources":["../../../src/servers/polyfill/polyfillFetch.ts"],"sourcesContent":["import type { MaybePromise } from '../../asyncs/MaybePromise';\n\nexport function polyfillFetch(nodeFetch: typeof import('node-fetch')): boolean;\nexport function polyfillFetch(nodeFetch?: undefined): Promise<boolean>;\nexport function polyfillFetch(nodeFetch?: typeof import('node-fetch')): MaybePromise<boolean> {\n if ('fetch' in globalThis) {\n return false;\n }\n // sync mode\n if (nodeFetch) {\n const { default: fetch, Response, Headers, Request, AbortError, FetchError, FormData, Blob, File } = nodeFetch;\n Object.assign(globalThis, {\n fetch,\n Response,\n Headers,\n Request,\n AbortError,\n FetchError,\n FormData,\n Blob,\n File,\n });\n // abort controller\n return true;\n }\n return import('node-fetch').then((v) => polyfillFetch(v));\n}\n"],"names":[],"mappings":"AAIO,SAAS,cAAc,SAAgE,EAAA;AAC5F,EAAA,IAAI,WAAW,UAAY,EAAA;AACzB,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAEA,EAAA,IAAI,SAAW,EAAA;AACb,IAAM,MAAA,EAAE,OAAS,EAAA,KAAA,EAAO,QAAU,EAAA,OAAA,EAAS,OAAS,EAAA,UAAA,EAAY,UAAY,EAAA,QAAA,EAAU,IAAM,EAAA,IAAA,EAAS,GAAA,SAAA,CAAA;AACrG,IAAA,MAAA,CAAO,OAAO,UAAY,EAAA;AAAA,MACxB,KAAA;AAAA,MACA,QAAA;AAAA,MACA,OAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AACA,EAAO,OAAA,OAAO,YAAY,CAAE,CAAA,IAAA,CAAK,CAAC,CAAM,KAAA,aAAA,CAAc,CAAC,CAAC,CAAA,CAAA;AAC1D;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polyfillJsDom.js","sources":["../../../src/servers/polyfill/polyfillJsDom.ts"],"sourcesContent":["import type { ConstructorOptions, ResourceLoaderConstructorOptions } from 'jsdom';\nimport { getGlobalThis } from '../../isomorphics/getGlobalThis';\n\nexport async function polyfillJsDom() {\n if (typeof window !== 'undefined') {\n return false;\n }\n\n const globalThis = getGlobalThis();\n\n const { ResourceLoader, JSDOM } = await import('jsdom');\n\n // https://github.com/lukechilds/window/blob/master/src/index.js\n // eslint-disable-next-line @typescript-eslint/no-extraneous-class\n class Window {\n constructor(opts: ResourceLoaderConstructorOptions & ConstructorOptions = {}) {\n const { proxy, strictSSL, userAgent, ...jsdomOpts } = opts;\n const resources = new ResourceLoader({\n proxy,\n strictSSL,\n userAgent,\n });\n return new JSDOM(\n '',\n Object.assign(jsdomOpts, {\n resources,\n }),\n ).window;\n }\n }\n\n // https://github.com/lukechilds/browser-env/blob/master/src/index.js\n // Default jsdom config.\n // These settings must override any custom settings to make sure we can iterate\n // over the window object.\n const defaultJsdomConfig = {\n // features: {\n // FetchExternalResources: false,\n // ProcessExternalResources: false,\n // },\n };\n // IIFE executed on import to return an array of global Node.js properties that\n // conflict with global browser properties.\n const protectedProperties = (() =>\n Object.getOwnPropertyNames(new Window(defaultJsdomConfig)).filter(\n (prop) => typeof globalThis[prop as keyof typeof globalThis] !== 'undefined',\n ))();\n\n function installEnv(...args: any[]) {\n // Sets up global browser environment\n // Extract options from args\n const properties = args.filter((arg: any) => Array.isArray(arg))[0];\n const userJsdomConfig = args.filter((arg: any) => !Array.isArray(arg))[0];\n\n // Create window object\n const window = new Window(Object.assign({}, userJsdomConfig, defaultJsdomConfig));\n\n // Get all global browser properties\n Object.getOwnPropertyNames(window)\n\n // Remove protected properties\n .filter((prop) => !protectedProperties.includes(prop))\n\n // If we're only applying specific required properties remove everything else\n .filter((prop) => !(properties && properties.indexOf(prop) === -1))\n .filter((prop) => {\n switch (prop) {\n case 'undefined':\n return false;\n }\n return true;\n })\n\n // Copy what's left to the Node.js global scope\n .forEach((prop) => {\n // console.debug(`define globalThis.${prop}`);\n Object.defineProperty(globalThis, prop, {\n configurable: true,\n get: () => window[prop as keyof Window] as any,\n });\n });\n\n return window;\n }\n\n installEnv({ url: 'http://localhost' });\n return true;\n}\n"],"names":["window"],"mappings":";;AAGA,eAAsB,aAAgB,GAAA;AACpC,EAAI,IAAA,OAAO,WAAW,WAAa,EAAA;AACjC,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAEA,EAAA,MAAM,aAAa,aAAc,EAAA,CAAA;AAEjC,EAAA,MAAM,EAAE,cAAgB,EAAA,KAAA,EAAU,GAAA,MAAM,OAAO,OAAO,CAAA,CAAA;AAAA,EAItD,MAAM,MAAO,CAAA;AAAA,IACX,WAAA,CAAY,IAA8D,GAAA,EAAI,EAAA;AAC5E,MAAA,MAAM,EAAE,KAAO,EAAA,SAAA,EAAW,SAAW,EAAA,GAAG,WAAc,GAAA,IAAA,CAAA;AACtD,MAAM,MAAA,SAAA,GAAY,IAAI,cAAe,CAAA;AAAA,QACnC,KAAA;AAAA,QACA,SAAA;AAAA,QACA,SAAA;AAAA,OACD,CAAA,CAAA;AACD,MAAA,OAAO,IAAI,KAAA;AAAA,QACT,EAAA;AAAA,QACA,MAAA,CAAO,OAAO,SAAW,EAAA;AAAA,UACvB,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,CAGA,OAAQ,CAAA,CAAC,IAAS,KAAA;AAEjB,MAAO,MAAA,CAAA,cAAA,CAAe,YAAY,IAAM,EAAA;AAAA,QACtC,YAAc,EAAA,IAAA;AAAA,QACd,GAAA,EAAK,MAAMA,OAAAA,CAAO,IAAoB,CAAA;AAAA,OACvC,CAAA,CAAA;AAAA,KACF,CAAA,CAAA;AAEH,IAAOA,OAAAA,OAAAA,CAAAA;AAAA,GACT;AAEA,EAAW,UAAA,CAAA,EAAE,GAAK,EAAA,kBAAA,EAAoB,CAAA,CAAA;AACtC,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatBytes.js","sources":["../../src/strings/formatBytes.ts"],"sourcesContent":["/**\n * Format bytes as human-readable text.\n *\n * @param bytes Number of bytes.\n * @param si True to use metric (SI) units, aka powers of 1000. False to use\n * binary (IEC), aka powers of 1024.\n * @param dp Number of decimal places to display.\n *\n * @return Formatted string.\n */\nexport function formatBytes(bytes: number, si = false, dp = 1) {\n const thresh = si ? 1000 : 1024;\n\n if (Math.abs(bytes) < thresh) {\n return `${bytes} B`;\n }\n\n const units = si\n ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']\n : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];\n let u = -1;\n const r = 10 ** dp;\n\n do {\n bytes /= thresh;\n ++u;\n } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);\n\n return bytes.toFixed(dp) + ' ' + units[u];\n}\n"],"names":[],"mappings":"AAUO,SAAS,WAAY,CAAA,KAAA,EAAe,EAAK,GAAA,KAAA,EAAO,KAAK,CAAG,EAAA;AAC7D,EAAM,MAAA,MAAA,GAAS,KAAK,GAAO,GAAA,IAAA,CAAA;AAE3B,EAAA,IAAI,IAAK,CAAA,GAAA,CAAI,KAAK,CAAA,GAAI,MAAQ,EAAA;AAC5B,IAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"formatBytes.js","sources":["../../src/strings/formatBytes.ts"],"sourcesContent":["/**\n * Format bytes as human-readable text.\n *\n * @param bytes Number of bytes.\n * @param si True to use metric (SI) units, aka powers of 1000. False to use\n * binary (IEC), aka powers of 1024.\n * @param dp Number of decimal places to display.\n *\n * @return Formatted string.\n */\nexport function formatBytes(bytes: number, si = false, dp = 1) {\n const thresh = si ? 1000 : 1024;\n\n if (Math.abs(bytes) < thresh) {\n return `${bytes} B`;\n }\n\n const units = si\n ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']\n : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];\n let u = -1;\n const r = 10 ** dp;\n\n do {\n bytes /= thresh;\n ++u;\n } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);\n\n return bytes.toFixed(dp) + ' ' + units[u];\n}\n"],"names":[],"mappings":"AAUO,SAAS,WAAY,CAAA,KAAA,EAAe,EAAK,GAAA,KAAA,EAAO,KAAK,CAAG,EAAA;AAC7D,EAAM,MAAA,MAAA,GAAS,KAAK,GAAO,GAAA,IAAA,CAAA;AAE3B,EAAA,IAAI,IAAK,CAAA,GAAA,CAAI,KAAK,CAAA,GAAI,MAAQ,EAAA;AAC5B,IAAA,OAAO,GAAG,KAAK,CAAA,EAAA,CAAA,CAAA;AAAA,GACjB;AAEA,EAAM,MAAA,KAAA,GAAQ,KACV,CAAC,IAAA,EAAM,MAAM,IAAM,EAAA,IAAA,EAAM,MAAM,IAAM,EAAA,IAAA,EAAM,IAAI,CAC/C,GAAA,CAAC,OAAO,KAAO,EAAA,KAAA,EAAO,OAAO,KAAO,EAAA,KAAA,EAAO,OAAO,KAAK,CAAA,CAAA;AAC3D,EAAA,IAAI,CAAI,GAAA,CAAA,CAAA,CAAA;AACR,EAAA,MAAM,IAAI,EAAM,IAAA,EAAA,CAAA;AAEhB,EAAG,GAAA;AACD,IAAS,KAAA,IAAA,MAAA,CAAA;AACT,IAAE,EAAA,CAAA,CAAA;AAAA,GACK,QAAA,IAAA,CAAK,KAAM,CAAA,IAAA,CAAK,GAAI,CAAA,KAAK,CAAI,GAAA,CAAC,CAAI,GAAA,CAAA,IAAK,MAAU,IAAA,CAAA,GAAI,MAAM,MAAS,GAAA,CAAA,EAAA;AAE7E,EAAA,OAAO,MAAM,OAAQ,CAAA,EAAE,CAAI,GAAA,GAAA,GAAM,MAAM,CAAC,CAAA,CAAA;AAC1C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUUID.js","sources":["../../src/validations/isUUID.ts"],"sourcesContent":["export function isUUID(str: string) {\n return /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(str);\n}\n"],"names":[],"mappings":"AAAO,SAAS,OAAO,
|
|
1
|
+
{"version":3,"file":"isUUID.js","sources":["../../src/validations/isUUID.ts"],"sourcesContent":["export function isUUID(str: string | undefined | null) {\n return Boolean(str) && /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(String(str));\n}\n"],"names":[],"mappings":"AAAO,SAAS,OAAO,GAAgC,EAAA;AACrD,EAAA,OAAO,QAAQ,GAAG,CAAA,IAAK,yEAAyE,IAAK,CAAA,MAAA,CAAO,GAAG,CAAC,CAAA,CAAA;AAClH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseTimestamp.js","sources":["../../src/validations/parseTimestamp.ts"],"sourcesContent":["export function parseTimestamp(raw?: string | number | Date): Date | undefined {\n if (!raw) {\n return undefined;\n }\n if (raw instanceof Date) {\n return raw;\n }\n\n if (typeof raw === 'string' && /^[0-9.]+$/.test(raw)) {\n let n = parseFloat(raw);\n const len = Math.floor(n).toString().length;\n /*\n 最常见的是 10 位和 13 位\n 9999999999 - 10*9 - 1970-04-26\n 99999999999 - 11*9 - 1973\n 999999999999 - 12*9 - 2001\n */\n if (len <= 11) {\n n *= 1000;\n }\n return new Date(n);\n } else if (typeof raw === 'string') {\n const date = new Date(raw);\n if (!isNaN(+date)) {\n return date;\n }\n }\n throw new Error(`parseTimestamp: invalid \"${raw}\"`);\n}\n"],"names":[],"mappings":"AAAO,SAAS,eAAe,GAAgD,EAAA;AAC7E,EAAA,IAAI,CAAC,GAAK,EAAA;AACR,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AACA,EAAA,IAAI,eAAe,IAAM,EAAA;AACvB,IAAO,OAAA,GAAA,CAAA;AAAA,GACT;AAEA,EAAA,IAAI,OAAO,GAAQ,KAAA,QAAA,IAAY,WAAY,CAAA,IAAA,CAAK,GAAG,CAAG,EAAA;AACpD,IAAI,IAAA,CAAA,GAAI,WAAW,GAAG,CAAA,CAAA;AACtB,IAAA,MAAM,MAAM,IAAK,CAAA,KAAA,CAAM,CAAC,CAAA,CAAE,UAAW,CAAA,MAAA,CAAA;AAOrC,IAAA,IAAI,OAAO,EAAI,EAAA;AACb,MAAK,CAAA,IAAA,GAAA,CAAA;AAAA,KACP;AACA,IAAO,OAAA,IAAI,KAAK,CAAC,CAAA,CAAA;AAAA,GACnB,MAAA,IAAW,OAAO,GAAA,KAAQ,QAAU,EAAA;AAClC,IAAM,MAAA,IAAA,GAAO,IAAI,IAAA,CAAK,GAAG,CAAA,CAAA;AACzB,IAAA,IAAI,CAAC,KAAA,CAAM,CAAC,IAAI,CAAG,EAAA;AACjB,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAAA,GACF;AACA,
|
|
1
|
+
{"version":3,"file":"parseTimestamp.js","sources":["../../src/validations/parseTimestamp.ts"],"sourcesContent":["export function parseTimestamp(raw?: string | number | Date): Date | undefined {\n if (!raw) {\n return undefined;\n }\n if (raw instanceof Date) {\n return raw;\n }\n\n if (typeof raw === 'string' && /^[0-9.]+$/.test(raw)) {\n let n = parseFloat(raw);\n const len = Math.floor(n).toString().length;\n /*\n 最常见的是 10 位和 13 位\n 9999999999 - 10*9 - 1970-04-26\n 99999999999 - 11*9 - 1973\n 999999999999 - 12*9 - 2001\n */\n if (len <= 11) {\n n *= 1000;\n }\n return new Date(n);\n } else if (typeof raw === 'string') {\n const date = new Date(raw);\n if (!isNaN(+date)) {\n return date;\n }\n }\n throw new Error(`parseTimestamp: invalid \"${raw}\"`);\n}\n"],"names":[],"mappings":"AAAO,SAAS,eAAe,GAAgD,EAAA;AAC7E,EAAA,IAAI,CAAC,GAAK,EAAA;AACR,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AACA,EAAA,IAAI,eAAe,IAAM,EAAA;AACvB,IAAO,OAAA,GAAA,CAAA;AAAA,GACT;AAEA,EAAA,IAAI,OAAO,GAAQ,KAAA,QAAA,IAAY,WAAY,CAAA,IAAA,CAAK,GAAG,CAAG,EAAA;AACpD,IAAI,IAAA,CAAA,GAAI,WAAW,GAAG,CAAA,CAAA;AACtB,IAAA,MAAM,MAAM,IAAK,CAAA,KAAA,CAAM,CAAC,CAAA,CAAE,UAAW,CAAA,MAAA,CAAA;AAOrC,IAAA,IAAI,OAAO,EAAI,EAAA;AACb,MAAK,CAAA,IAAA,GAAA,CAAA;AAAA,KACP;AACA,IAAO,OAAA,IAAI,KAAK,CAAC,CAAA,CAAA;AAAA,GACnB,MAAA,IAAW,OAAO,GAAA,KAAQ,QAAU,EAAA;AAClC,IAAM,MAAA,IAAA,GAAO,IAAI,IAAA,CAAK,GAAG,CAAA,CAAA;AACzB,IAAA,IAAI,CAAC,KAAA,CAAM,CAAC,IAAI,CAAG,EAAA;AACjB,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAAA,GACF;AACA,EAAA,MAAM,IAAI,KAAA,CAAM,CAA4B,yBAAA,EAAA,GAAG,CAAG,CAAA,CAAA,CAAA,CAAA;AACpD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wener/utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Utils for daily use",
|
|
6
6
|
"repository": {
|
|
@@ -10,9 +10,6 @@
|
|
|
10
10
|
"homepage": "https://github.com/wenerme/wode#readme",
|
|
11
11
|
"author": "wener",
|
|
12
12
|
"license": "MIT",
|
|
13
|
-
"main": "dist/cjs/index.cjs",
|
|
14
|
-
"module": "lib/index.js",
|
|
15
|
-
"types": "src/index.ts",
|
|
16
13
|
"files": [
|
|
17
14
|
"dist",
|
|
18
15
|
"index.ts",
|
|
@@ -40,12 +37,12 @@
|
|
|
40
37
|
}
|
|
41
38
|
},
|
|
42
39
|
"devDependencies": {
|
|
43
|
-
"@types/lodash": "^4.14.
|
|
44
|
-
"@types/ws": "^8.5.
|
|
45
|
-
"https-proxy-agent": "^7.0.
|
|
40
|
+
"@types/lodash": "^4.14.196",
|
|
41
|
+
"@types/ws": "^8.5.5",
|
|
42
|
+
"https-proxy-agent": "^7.0.1",
|
|
46
43
|
"lodash": "^4.17.21",
|
|
47
|
-
"node-fetch": "^3.3.
|
|
48
|
-
"undici": "^5.
|
|
44
|
+
"node-fetch": "^3.3.2",
|
|
45
|
+
"undici": "^5.23.0"
|
|
49
46
|
},
|
|
50
47
|
"publishConfig": {
|
|
51
48
|
"registry": "https://registry.npmjs.org",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { test, beforeAll, expect } from 'vitest';
|
|
2
|
-
import { polyfillCrypto } from '../servers/polyfillCrypto';
|
|
2
|
+
import { polyfillCrypto } from '../servers/polyfill/polyfillCrypto';
|
|
3
3
|
import { isUUID } from '../validations/isUUID';
|
|
4
4
|
import { hex } from './base';
|
|
5
5
|
import { sha1, sha256, sha384, sha512 } from './hashing';
|
|
6
|
+
import { md5 } from './md5';
|
|
6
7
|
import { _randomUUID } from './randomUUID';
|
|
7
8
|
|
|
8
9
|
beforeAll(async () => {
|
|
@@ -19,6 +20,8 @@ test('sha', async () => {
|
|
|
19
20
|
expect(hex(await sha512(''))).toBe(
|
|
20
21
|
'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e',
|
|
21
22
|
);
|
|
23
|
+
|
|
24
|
+
expect(md5('Hello')).toBe('8b1a9953c4611296a827abf8c47804d7');
|
|
22
25
|
});
|
|
23
26
|
|
|
24
27
|
test('randomUUID', () => {
|
package/src/crypto/ulid.test.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { expect, test } from 'vitest';
|
|
2
|
-
import {
|
|
2
|
+
import { randomUUID } from './randomUUID';
|
|
3
|
+
import { createULID, isULID, parseULID, ulid } from './ulid';
|
|
4
|
+
|
|
5
|
+
test('isULID', () => {
|
|
6
|
+
for (const [a, b] of [
|
|
7
|
+
[undefined, false],
|
|
8
|
+
[null, false],
|
|
9
|
+
['', false],
|
|
10
|
+
[randomUUID(), false],
|
|
11
|
+
[ulid(), true],
|
|
12
|
+
] as const) {
|
|
13
|
+
expect(isULID(a), `${a} -> ${b}`).toEqual(b);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
3
16
|
|
|
4
17
|
test('ulid', () => {
|
|
5
18
|
// monotonic
|
package/src/crypto/ulid.ts
CHANGED
|
@@ -30,9 +30,12 @@ const RANDOM_LEN = 16;
|
|
|
30
30
|
/**
|
|
31
31
|
* check give {@link str} is a valid ulid
|
|
32
32
|
*/
|
|
33
|
-
export function isULID(str: string): boolean {
|
|
33
|
+
export function isULID(str: string | undefined | null): boolean {
|
|
34
|
+
if (!str) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
34
37
|
// ttttttttttrrrrrrrrrrrrrrrr
|
|
35
|
-
return str
|
|
38
|
+
return str.length === 26 && /^[0-9A-HJKMNP-TV-Z]{26}$/i.test(str);
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
function replaceCharAt(str: string, index: number, char: string) {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
function sortObjectKeys(obj?: Record<string, any>) {
|
|
2
|
+
if (obj === null || obj === undefined) {
|
|
3
|
+
return obj;
|
|
4
|
+
}
|
|
5
|
+
if (typeof obj !== 'object') {
|
|
6
|
+
// it is a primitive: number/string (in an array)
|
|
7
|
+
return obj;
|
|
8
|
+
}
|
|
9
|
+
return Object.keys(obj)
|
|
10
|
+
.sort()
|
|
11
|
+
.reduce(
|
|
12
|
+
(acc, key) => {
|
|
13
|
+
if (Array.isArray(obj[key])) {
|
|
14
|
+
acc[key] = obj[key].map(sortObjectKeys);
|
|
15
|
+
} else if (typeof obj[key] === 'object') {
|
|
16
|
+
acc[key] = sortObjectKeys(obj[key]);
|
|
17
|
+
} else {
|
|
18
|
+
acc[key] = obj[key];
|
|
19
|
+
}
|
|
20
|
+
return acc;
|
|
21
|
+
},
|
|
22
|
+
{} as Record<string, any>,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function toDeterministicJson(o: any) {
|
|
27
|
+
// https://github.com/kikobeats/json-stringify-deterministic
|
|
28
|
+
// https://stackoverflow.com/a/54902696/1870054
|
|
29
|
+
|
|
30
|
+
let sorted: any = sortObjectKeys(o);
|
|
31
|
+
let out = JSON.stringify(sorted, function (_, v) {
|
|
32
|
+
return v === undefined ? 'undef' : v;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Remove all whitespace
|
|
36
|
+
return out.replace(/\s+/g, '');
|
|
37
|
+
}
|
package/src/logging/Logger.ts
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* Logger interface satisfies the `console`, `pino` logger interface.
|
|
3
3
|
*/
|
|
4
4
|
export interface Logger {
|
|
5
|
-
trace(...
|
|
5
|
+
trace(...args: any[]): void;
|
|
6
6
|
|
|
7
|
-
debug(...
|
|
7
|
+
debug(...args: any[]): void;
|
|
8
8
|
|
|
9
|
-
info(...
|
|
9
|
+
info(...args: any[]): void;
|
|
10
10
|
|
|
11
|
-
warn(...
|
|
11
|
+
warn(...args: any[]): void;
|
|
12
12
|
|
|
13
|
-
error(...
|
|
13
|
+
error(...args: any[]): void;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* create child logger with given context
|
|
@@ -19,7 +19,7 @@ export interface Logger {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface LoggerWithChild extends Logger {
|
|
22
|
-
child: (o:
|
|
22
|
+
child: (o: Record<string, any>) => LoggerWithChild;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'trace';
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Logger, LogLevel } from './Logger';
|
|
2
|
+
|
|
3
|
+
enum Level {
|
|
4
|
+
trace = -8,
|
|
5
|
+
debug = -4,
|
|
6
|
+
info = 0,
|
|
7
|
+
warn = 4,
|
|
8
|
+
error = 8,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface LogRecord {
|
|
12
|
+
time?: Date;
|
|
13
|
+
message: string;
|
|
14
|
+
level?: 'info' | 'debug' | 'warn' | 'error' | 'trace';
|
|
15
|
+
attrs?: Record<string, any>;
|
|
16
|
+
|
|
17
|
+
source?: {
|
|
18
|
+
func?: string;
|
|
19
|
+
file?: string;
|
|
20
|
+
line?: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// https://cs.opensource.google/go/x/exp/+/d63ba01a:slog/record.go
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type LogFunc =
|
|
27
|
+
| ((message: string) => void)
|
|
28
|
+
| ((message: string, attrs: Record<string, any>) => void)
|
|
29
|
+
| ((message: string, key: string, value: any, ...attrs: any[]) => void);
|
|
30
|
+
|
|
31
|
+
function createLogFunc(opts: {
|
|
32
|
+
onRecord: (rec: LogRecord) => void;
|
|
33
|
+
attrs?: Record<string, any>;
|
|
34
|
+
level?: LogLevel;
|
|
35
|
+
}): LogFunc {
|
|
36
|
+
return (msg: string, ...args: any[]) => {
|
|
37
|
+
const rec = {
|
|
38
|
+
message: String(msg),
|
|
39
|
+
level: opts.level,
|
|
40
|
+
attrs: Object.assign({}, opts.attrs),
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
if (args[0] && typeof args[0] === 'object') {
|
|
44
|
+
rec.attrs = Object.assign(rec.attrs, args[0]);
|
|
45
|
+
} else {
|
|
46
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
47
|
+
rec.attrs[String(args[i])] = args[i + 1];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
opts.onRecord(rec);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function stringify(rec: LogRecord, opts: { level?: boolean } = {}) {
|
|
56
|
+
const sb = [];
|
|
57
|
+
if (rec.time) {
|
|
58
|
+
sb.push(rec.time.toJSON());
|
|
59
|
+
}
|
|
60
|
+
rec.level && opts.level !== false && sb.push(rec.level.toUpperCase().padStart(5, ' '));
|
|
61
|
+
sb.push(rec.message);
|
|
62
|
+
|
|
63
|
+
if (rec.attrs) {
|
|
64
|
+
for (let [key, value] of Object.entries(rec.attrs)) {
|
|
65
|
+
sb.push(`${key}=${JSON.stringify(value)}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return sb.join(' ');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function createLogger(
|
|
72
|
+
opts: { writer?: (record: LogRecord) => void; level?: LogLevel; time?: boolean } = {},
|
|
73
|
+
): Logger {
|
|
74
|
+
opts.time ??= typeof window === 'undefined';
|
|
75
|
+
const onRecord = (record: LogRecord) => {
|
|
76
|
+
// can change options after create
|
|
77
|
+
const { writer = createLogger.writer, level, time } = opts;
|
|
78
|
+
if (level) {
|
|
79
|
+
if (Level[level] < Level[record.level!]) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (time) {
|
|
84
|
+
record.time = new Date();
|
|
85
|
+
}
|
|
86
|
+
writer(record);
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
trace: createLogFunc({ onRecord, level: 'trace' }),
|
|
90
|
+
debug: createLogFunc({ onRecord, level: 'debug' }),
|
|
91
|
+
info: createLogFunc({ onRecord, level: 'info' }),
|
|
92
|
+
warn: createLogFunc({ onRecord, level: 'warn' }),
|
|
93
|
+
error: createLogFunc({ onRecord, level: 'error' }),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
createLogger.writer = (record: LogRecord) => {
|
|
98
|
+
const { level } = record;
|
|
99
|
+
console[level || 'info'](stringify(record));
|
|
100
|
+
};
|
package/src/server.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { polyfillCrypto } from './servers/polyfillCrypto';
|
|
2
|
-
export { polyfillJsDom } from './servers/polyfillJsDom';
|
|
3
|
-
export { polyfillBrowser } from './servers/polyfillBrowser';
|
|
4
|
-
export { createFetchWithProxyByUndici } from './servers/createFetchWithProxyByUndici';
|
|
5
|
-
export { createFetchWithProxy } from './servers/createFetchWithProxy';
|
|
6
|
-
export { createFetchWithRetry, type FetchWithRetryOptions } from './servers/createFetchWithRetry';
|
|
1
|
+
export { polyfillCrypto } from './servers/polyfill/polyfillCrypto';
|
|
2
|
+
export { polyfillJsDom } from './servers/polyfill/polyfillJsDom';
|
|
3
|
+
export { polyfillBrowser } from './servers/polyfill/polyfillBrowser';
|
|
4
|
+
export { createFetchWithProxyByUndici } from './servers/fetch/createFetchWithProxyByUndici';
|
|
5
|
+
export { createFetchWithProxy } from './servers/fetch/createFetchWithProxy';
|
|
6
|
+
export { createFetchWithRetry, type FetchWithRetryOptions } from './servers/fetch/createFetchWithRetry';
|
|
7
7
|
|
|
8
|
-
export { md5 } from './servers/md5';
|
|
8
|
+
export { md5 } from './servers/crypto/md5';
|
|
9
|
+
export { getPackageDir } from './servers/getPackageDir';
|
package/src/servers/{createFetchWithProxyByNodeFetch.ts → fetch/createFetchWithProxyByNodeFetch.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type FetchLike } from '
|
|
2
|
-
import { getGlobalThis } from '
|
|
1
|
+
import { type FetchLike } from '../../fetch';
|
|
2
|
+
import { getGlobalThis } from '../../isomorphics/getGlobalThis';
|
|
3
3
|
|
|
4
4
|
export function createFetchWithProxyByNodeFetch({
|
|
5
5
|
proxy,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FetchLike } from '
|
|
2
|
-
import { getGlobalThis } from '
|
|
1
|
+
import { FetchLike } from '../../fetch';
|
|
2
|
+
import { getGlobalThis } from '../../isomorphics/getGlobalThis';
|
|
3
3
|
|
|
4
4
|
type RequestDelayFunction = (attempt: number, error: Error | null, response: Response | null) => number;
|
|
5
5
|
type RequestRetryOnFunction = (
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
|
|
8
|
+
export function getPackageDir(currentDir: string = __dirname) {
|
|
9
|
+
while (!fs.existsSync(path.join(currentDir, 'package.json'))) {
|
|
10
|
+
currentDir = path.resolve(currentDir, '..');
|
|
11
|
+
if (currentDir === '/') {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return currentDir;
|
|
16
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MaybePromise } from '
|
|
1
|
+
import type { MaybePromise } from '../../asyncs/MaybePromise';
|
|
2
2
|
|
|
3
3
|
export function polyfillFetch(nodeFetch: typeof import('node-fetch')): boolean;
|
|
4
4
|
export function polyfillFetch(nodeFetch?: undefined): Promise<boolean>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConstructorOptions, ResourceLoaderConstructorOptions } from 'jsdom';
|
|
2
|
-
import { getGlobalThis } from '
|
|
2
|
+
import { getGlobalThis } from '../../isomorphics/getGlobalThis';
|
|
3
3
|
|
|
4
4
|
export async function polyfillJsDom() {
|
|
5
5
|
if (typeof window !== 'undefined') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MaybePromise } from '
|
|
2
|
-
import { getGlobalThis } from '
|
|
1
|
+
import type { MaybePromise } from '../../asyncs/MaybePromise';
|
|
2
|
+
import { getGlobalThis } from '../../isomorphics/getGlobalThis';
|
|
3
3
|
|
|
4
4
|
export function polyfillWebSocket(ws: any): boolean;
|
|
5
5
|
export function polyfillWebSocket(ws?: undefined): Promise<boolean>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { expect, test } from 'vitest';
|
|
2
|
+
import { randomUUID } from '../crypto/randomUUID';
|
|
3
|
+
import { isUUID } from './isUUID';
|
|
4
|
+
|
|
5
|
+
test('isUUID', () => {
|
|
6
|
+
for (const [a, b] of [
|
|
7
|
+
[undefined, false],
|
|
8
|
+
[null, false],
|
|
9
|
+
['', false],
|
|
10
|
+
[randomUUID(), true],
|
|
11
|
+
] as const) {
|
|
12
|
+
expect(isUUID(a), `${a} -> ${b}`).toEqual(b);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export function isUUID(str: string) {
|
|
2
|
-
return /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(str);
|
|
1
|
+
export function isUUID(str: string | undefined | null) {
|
|
2
|
+
return Boolean(str) && /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(String(str));
|
|
3
3
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createFetchWithProxy.js","sources":["../../src/servers/createFetchWithProxy.ts"],"sourcesContent":["import { createFetchWithProxyByUndici } from './createFetchWithProxyByUndici';\n\nexport const createFetchWithProxy = createFetchWithProxyByUndici;\n"],"names":[],"mappings":";;AAEO,MAAM,oBAAuB,GAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createFetchWithProxyByUndici.js","sources":["../../src/servers/createFetchWithProxyByUndici.ts"],"sourcesContent":["import { MaybePromise } from '../asyncs/MaybePromise';\nimport { FetchLike } from '../fetch';\n\nexport function createFetchWithProxyByUndici({\n proxy,\n token: _token,\n fetch,\n undici,\n}: {\n proxy?: string;\n token?: string;\n fetch?: FetchLike;\n undici?: MaybePromise<{ fetch: any; ProxyAgent: any }>;\n} = {}): FetchLike {\n if (!proxy) {\n return fetch || globalThis.fetch;\n }\n let agent: any;\n // https://github.com/nodejs/undici/blob/main/docs/best-practices/proxy.md\n return async (...args) => {\n const init = (args[1] ||= {}) as RequestInit & {\n duplex?: string;\n dispatcher?: any;\n };\n {\n const body = init.body;\n if (typeof body === 'object' && body && (body instanceof ReadableStream || Symbol.asyncIterator in body)) {\n // request.duplex must be set if request.body is ReadableStream or Async Iterables\n init.duplex ||= 'half';\n }\n }\n if (!agent) {\n let uri = proxy;\n let token = _token;\n {\n let u: URL | undefined;\n try {\n u = new URL(proxy);\n } catch (e) {}\n if (!token && u && (u.username || u.password)) {\n token = `Basic ${btoa(`${u.username || ''}:${u.password}`)}`;\n u.username = '';\n u.password = '';\n uri = u.toString();\n }\n }\n // if in next use 'next/dist/compiled/undici'\n undici ||= import('undici');\n const mod = await undici;\n const ProxyAgent = mod.ProxyAgent as new (_: any) => any;\n fetch ||= mod.fetch as FetchLike;\n // https://github.com/nodejs/undici/blob/main/docs/api/ProxyAgent.md\n agent = new ProxyAgent({\n uri,\n token,\n });\n // https://github.com/nodejs/node/issues/43187#issuecomment-1134634174\n // (global as any)[Symbol.for('undici.globalDispatcher.1')] = agent;\n // fixme should unwrap error https://github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AE,QAAW,GAAA,EAAA,CAAA;AACb,UAAA,CAAA,CAAE,QAAW,GAAA,EAAA,CAAA;AACb,UAAA,GAAA,GAAM,EAAE,QAAS,EAAA,CAAA;AAAA,SACnB;AAAA,OACF;AAEA,MAAA,MAAA,KAAA,MAAA,GAAW,OAAO,QAAQ,CAAA,CAAA,CAAA;AAC1B,MAAA,MAAM,MAAM,MAAM,MAAA,CAAA;AAClB,MAAA,MAAM,aAAa,GAAI,CAAA,UAAA,CAAA;AACvB,MAAA,KAAA,KAAA,KAAA,GAAU,GAAI,CAAA,KAAA,CAAA,CAAA;AAEd,MAAA,KAAA,GAAQ,IAAI,UAAW,CAAA;AAAA,QACrB,GAAA;AAAA,QACA,KAAA;AAAA,OACD,CAAA,CAAA;AAAA,KAIH;AACA,IAAA,IAAA,CAAK,UAAa,GAAA,KAAA,CAAA;AAClB,IAAO,OAAA,MAAM,KAAO,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GAC7B,CAAA;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createFetchWithRetry.js","sources":["../../src/servers/createFetchWithRetry.ts"],"sourcesContent":["import { FetchLike } from '../fetch';\nimport { getGlobalThis } from '../isomorphics/getGlobalThis';\n\ntype RequestDelayFunction = (attempt: number, error: Error | null, response: Response | null) => number;\ntype RequestRetryOnFunction = (\n attempt: number,\n error: Error | null,\n response: Response | null,\n) => boolean | Promise<boolean>;\n\nexport interface FetchWithRetryOptions {\n fetch?: FetchLike;\n retries?: number;\n retryDelay?: number | RequestDelayFunction;\n retryOn?: number[] | RequestRetryOnFunction;\n}\n\nexport function createFetchWithRetry({\n fetch = getGlobalThis().fetch,\n retries = 3,\n retryDelay = 1000,\n retryOn = [],\n}: FetchWithRetryOptions = {}): FetchLike {\n // https://github.com/jonbern/fetch-retry/blob/master/index.js\n\n return function fetchRetry(input: string | Request, init?: RequestInit) {\n return new Promise(function (resolve, reject) {\n var wrappedFetch = function (attempt: number) {\n // As of node 18, this is no longer needed since node comes with native support for fetch:\n /* istanbul ignore next */\n var _input = typeof Request !== 'undefined' && input instanceof Request ? input.clone() : input;\n fetch(_input, init)\n .then(function (response) {\n if (Array.isArray(retryOn) && retryOn.indexOf(response.status) === -1) {\n resolve(response);\n } else if (typeof retryOn === 'function') {\n try {\n return Promise.resolve(retryOn(attempt, null, response))\n .then(function (retryOnResponse) {\n if (retryOnResponse) {\n retry(attempt, null, response);\n } else {\n resolve(response);\n }\n })\n .catch(reject);\n } catch (error) {\n reject(error);\n }\n } else {\n if (attempt < retries) {\n retry(attempt, null, response);\n } else {\n resolve(response);\n }\n }\n return;\n })\n .catch(function (error) {\n if (typeof retryOn === 'function') {\n try {\n // eslint-disable-next-line no-undef\n Promise.resolve(retryOn(attempt, error, null))\n .then(function (retryOnResponse) {\n if (retryOnResponse) {\n retry(attempt, error, null);\n } else {\n reject(error);\n }\n })\n .catch(function (error) {\n reject(error);\n });\n } catch (error) {\n reject(error);\n }\n } else if (attempt < retries) {\n retry(attempt, error, null);\n } else {\n reject(error);\n }\n });\n };\n\n function retry(attempt: number, error: any, response: Response | null) {\n let delay = typeof retryDelay === 'function' ? retryDelay(attempt, error, response) : retryDelay;\n setTimeout(function () {\n wrappedFetch(++attempt);\n }, delay);\n }\n\n wrappedFetch(0);\n });\n };\n}\n"],"names":["error"],"mappings":";;AAiBO,SAAS,oBAAqB,CAAA;AAAA,EACnC,KAAA,GAAQ,eAAgB,CAAA,KAAA;AAAA,EACxB,OAAU,GAAA,CAAA;AAAA,EACV,UAAa,GAAA,GAAA;AAAA,EACb,UAAU,EAAC;AACb,CAAA,GAA2B,EAAe,EAAA;AAGxC,EAAO,OAAA,SAAS,UAAW,CAAA,KAAA,EAAyB,IAAoB,EAAA;AACtE,IAAA,OAAO,IAAI,OAAA,CAAQ,SAAU,OAAA,EAAS,MAAQ,EAAA;AAC5C,MAAI,IAAA,YAAA,GAAe,SAAU,OAAiB,EAAA;AAG5C,QAAI,IAAA,MAAA,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S,EAAA,KAAA,EAAO,IAAI,CAAC,CAAA,CAC1C,IAAK,CAAA,SAAU,eAAiB,EAAA;AAC/B,gBAAA,IAAI,eAAiB,EAAA;AACnB,kBAAM,KAAA,CAAA,OAAA,EAAS,OAAO,IAAI,CAAA,CAAA;AAAA,iBACrB,MAAA;AACL,kBAAA,MAAA,CAAO,KAAK,CAAA,CAAA;AAAA,iBACd;AAAA,eACD,CAAA,CACA,KAAM,CAAA,SAAUA,MAAO,EAAA;AACtB,gBAAA,MAAA,CAAOA,MAAK,CAAA,CAAA;AAAA,eACb,CAAA,CAAA;AAAA,qBACIA,MAAP,EAAA;AACA,cAAA,MAAA,CAAOA,MAAK,CAAA,CAAA;AAAA,aACd;AAAA,WACF,MAAA,IAAW,UAAU,OAAS,EAAA;AAC5B,YAAM,KAAA,CAAA,OAAA,EAAS,OAAO,IAAI,CAAA,CAAA;AAAA,WACrB,MAAA;AACL,YAAA,MAAA,CAAO,KAAK,CAAA,CAAA;AAAA,WACd;AAAA,SACD,CAAA,CAAA;AAAA,OACL,CAAA;AAEA,MAAS,SAAA,KAAA,CAAM,OAAiB,EAAA,KAAA,EAAY,QAA2B,EAAA;AACrE,QAAI,IAAA,KAAA,GAAQ,OAAO,UAAe,KAAA,UAAA,GAAa,WAAW,OAAS,EAAA,KAAA,EAAO,QAAQ,CAAI,GAAA,UAAA,CAAA;AACtF,QAAA,UAAA,CAAW,WAAY;AACrB,UAAA,YAAA,CAAa,EAAE,OAAO,CAAA,CAAA;AAAA,WACrB,KAAK,CAAA,CAAA;AAAA,OACV;AAEA,MAAA,YAAA,CAAa,CAAC,CAAA,CAAA;AAAA,KACf,CAAA,CAAA;AAAA,GACH,CAAA;AACF;;;;"}
|
package/lib/servers/md5.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"md5.js","sources":["../../src/servers/md5.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\n\nexport function md5(input: Buffer | string) {\n return createHash('md5').update(input).digest('hex') as string;\n}\n"],"names":[],"mappings":";;AAEO,SAAS,IAAI,KAAwB,EAAA;AAC1C,EAAA,OAAO,WAAW,KAAK,CAAA,CAAE,OAAO,KAAK,CAAA,CAAE,OAAO,KAAK,CAAA,CAAA;AACrD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polyfillBrowser.js","sources":["../../src/servers/polyfillBrowser.ts"],"sourcesContent":["import { polyfillCrypto } from './polyfillCrypto';\nimport { polyfillFetch } from './polyfillFetch';\nimport { polyfillJsDom } from './polyfillJsDom';\n\n/**\n * Polyfills the browser environment with the necessary APIs for the server.\n * Currently, this includes:\n * - `window`\n * - `document`\n * - `fetch`\n * - `crypto`\n */\nexport async function polyfillBrowser() {\n await polyfillCrypto();\n await polyfillFetch();\n await polyfillJsDom();\n}\n"],"names":[],"mappings":";;;;AAYA,eAAsB,eAAkB,GAAA;AACtC,EAAA,MAAM,cAAe,EAAA,CAAA;AACrB,EAAA,MAAM,aAAc,EAAA,CAAA;AACpB,EAAA,MAAM,aAAc,EAAA,CAAA;AACtB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polyfillCrypto.js","sources":["../../src/servers/polyfillCrypto.ts"],"sourcesContent":["import { getGlobalThis } from '../isomorphics/getGlobalThis';\n\nexport async function polyfillCrypto() {\n const globalThis = getGlobalThis();\n if ('crypto' in globalThis) {\n return false;\n }\n (globalThis as any).crypto = (await import('node:crypto')).webcrypto as Crypto;\n return true;\n}\n"],"names":[],"mappings":";;AAEA,eAAsB,cAAiB,GAAA;AACrC,EAAA,MAAM,aAAa,aAAc,EAAA,CAAA;AACjC,EAAA,IAAI,YAAY,UAAY,EAAA;AAC1B,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AACA,EAAC,UAAmB,CAAA,MAAA,GAAA,CAAU,MAAM,OAAO,aAAa,CAAG,EAAA,SAAA,CAAA;AAC3D,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polyfillFetch.js","sources":["../../src/servers/polyfillFetch.ts"],"sourcesContent":["import type { MaybePromise } from '../asyncs/MaybePromise';\n\nexport function polyfillFetch(nodeFetch: typeof import('node-fetch')): boolean;\nexport function polyfillFetch(nodeFetch?: undefined): Promise<boolean>;\nexport function polyfillFetch(nodeFetch?: typeof import('node-fetch')): MaybePromise<boolean> {\n if ('fetch' in globalThis) {\n return false;\n }\n // sync mode\n if (nodeFetch) {\n const { default: fetch, Response, Headers, Request, AbortError, FetchError, FormData, Blob, File } = nodeFetch;\n Object.assign(globalThis, {\n fetch,\n Response,\n Headers,\n Request,\n AbortError,\n FetchError,\n FormData,\n Blob,\n File,\n });\n // abort controller\n return true;\n }\n return import('node-fetch').then((v) => polyfillFetch(v));\n}\n"],"names":[],"mappings":"AAIO,SAAS,cAAc,SAAgE,EAAA;AAC5F,EAAA,IAAI,WAAW,UAAY,EAAA;AACzB,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAEA,EAAA,IAAI,SAAW,EAAA;AACb,IAAM,MAAA,EAAE,OAAS,EAAA,KAAA,EAAO,QAAU,EAAA,OAAA,EAAS,OAAS,EAAA,UAAA,EAAY,UAAY,EAAA,QAAA,EAAU,IAAM,EAAA,IAAA,EAAS,GAAA,SAAA,CAAA;AACrG,IAAA,MAAA,CAAO,OAAO,UAAY,EAAA;AAAA,MACxB,KAAA;AAAA,MACA,QAAA;AAAA,MACA,OAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AACA,EAAO,OAAA,OAAO,YAAY,CAAE,CAAA,IAAA,CAAK,CAAC,CAAM,KAAA,aAAA,CAAc,CAAC,CAAC,CAAA,CAAA;AAC1D;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polyfillJsDom.js","sources":["../../src/servers/polyfillJsDom.ts"],"sourcesContent":["import type { ConstructorOptions, ResourceLoaderConstructorOptions } from 'jsdom';\nimport { getGlobalThis } from '../isomorphics/getGlobalThis';\n\nexport async function polyfillJsDom() {\n if (typeof window !== 'undefined') {\n return false;\n }\n\n const globalThis = getGlobalThis();\n\n const { ResourceLoader, JSDOM } = await import('jsdom');\n\n // https://github.com/lukechilds/window/blob/master/src/index.js\n // eslint-disable-next-line @typescript-eslint/no-extraneous-class\n class Window {\n constructor(opts: ResourceLoaderConstructorOptions & ConstructorOptions = {}) {\n const { proxy, strictSSL, userAgent, ...jsdomOpts } = opts;\n const resources = new ResourceLoader({\n proxy,\n strictSSL,\n userAgent,\n });\n return new JSDOM(\n '',\n Object.assign(jsdomOpts, {\n resources,\n }),\n ).window;\n }\n }\n\n // https://github.com/lukechilds/browser-env/blob/master/src/index.js\n // Default jsdom config.\n // These settings must override any custom settings to make sure we can iterate\n // over the window object.\n const defaultJsdomConfig = {\n // features: {\n // FetchExternalResources: false,\n // ProcessExternalResources: false,\n // },\n };\n // IIFE executed on import to return an array of global Node.js properties that\n // conflict with global browser properties.\n const protectedProperties = (() =>\n Object.getOwnPropertyNames(new Window(defaultJsdomConfig)).filter(\n (prop) => typeof globalThis[prop as keyof typeof globalThis] !== 'undefined',\n ))();\n\n function installEnv(...args: any[]) {\n // Sets up global browser environment\n // Extract options from args\n const properties = args.filter((arg: any) => Array.isArray(arg))[0];\n const userJsdomConfig = args.filter((arg: any) => !Array.isArray(arg))[0];\n\n // Create window object\n const window = new Window(Object.assign({}, userJsdomConfig, defaultJsdomConfig));\n\n // Get all global browser properties\n Object.getOwnPropertyNames(window)\n\n // Remove protected properties\n .filter((prop) => !protectedProperties.includes(prop))\n\n // If we're only applying specific required properties remove everything else\n .filter((prop) => !(properties && properties.indexOf(prop) === -1))\n .filter((prop) => {\n switch (prop) {\n case 'undefined':\n return false;\n }\n return true;\n })\n\n // Copy what's left to the Node.js global scope\n .forEach((prop) => {\n // console.debug(`define globalThis.${prop}`);\n Object.defineProperty(globalThis, prop, {\n configurable: true,\n get: () => window[prop as keyof Window] as any,\n });\n });\n\n return window;\n }\n\n installEnv({ url: 'http://localhost' });\n return true;\n}\n"],"names":["window"],"mappings":";;AAGA,eAAsB,aAAgB,GAAA;AACpC,EAAI,IAAA,OAAO,WAAW,WAAa,EAAA;AACjC,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAEA,EAAA,MAAM,aAAa,aAAc,EAAA,CAAA;AAEjC,EAAA,MAAM,EAAE,cAAgB,EAAA,KAAA,EAAU,GAAA,MAAM,OAAO,OAAO,CAAA,CAAA;AAItD,EAAA,MAAM,MAAO,CAAA;AAAA,IACX,WAAA,CAAY,IAA8D,GAAA,EAAI,EAAA;AAC5E,MAAA,MAAM,EAAE,KAAO,EAAA,SAAA,EAAW,SAAW,EAAA,GAAG,WAAc,GAAA,IAAA,CAAA;AACtD,MAAM,MAAA,SAAA,GAAY,IAAI,cAAe,CAAA;AAAA,QACnC,KAAA;AAAA,QACA,SAAA;AAAA,QACA,SAAA;AAAA,OACD,CAAA,CAAA;AACD,MAAA,OAAO,IAAI,KAAA;AAAA,QACT,EAAA;AAAA,QACA,MAAA,CAAO,OAAO,SAAW,EAAA;AAAA,UACvB,SAAA;AAAA,SACD,CAAA;AAAA,OACD,CAAA,MAAA,CAAA;AAAA,KACJ;AAAA,GACF;AAMA,EAAA,MAAM,kBAAqB,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAK3B,CAAA;AAGA,EAAM,MAAA,mBAAA,GAAA,CAAuB,MAC3B,MAAO,CAAA,mBAAA,CAAoB,IAAI,MAAO,CAAA,kBAAkB,CAAC,CAAE,CAAA,MAAA;AAAA,IACzD,CAAC,IAAA,KAAS,OAAO,UAAA,CAAW,IAA+B,CAAM,KAAA,WAAA;AAAA,GAChE,GAAA,CAAA;AAEL,EAAA,SAAS,cAAc,IAAa,EAAA;A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/package/lib/servers/{createFetchWithProxyByUndici.js → fetch/createFetchWithProxyByUndici.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|