playwright-smart-test 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +270 -2
- package/dist/ai/ai-analyzer.d.ts +17 -0
- package/dist/ai/ai-analyzer.js +224 -0
- package/dist/catalog/test-catalog.d.ts +8 -0
- package/dist/catalog/test-catalog.js +111 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +147 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.js +37 -0
- package/dist/config/schema.d.ts +97 -0
- package/dist/config/schema.js +72 -0
- package/dist/diff/git-diff-analyzer.d.ts +24 -0
- package/dist/diff/git-diff-analyzer.js +105 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/reporters/github-reporter.d.ts +5 -0
- package/dist/reporters/github-reporter.js +72 -0
- package/dist/reporters/terminal-reporter.d.ts +5 -0
- package/dist/reporters/terminal-reporter.js +69 -0
- package/dist/runner/playwright-runner.d.ts +7 -0
- package/dist/runner/playwright-runner.js +25 -0
- package/dist/selector/test-selector.d.ts +18 -0
- package/dist/selector/test-selector.js +303 -0
- package/node_modules/@colors/colors/LICENSE +26 -0
- package/node_modules/@colors/colors/README.md +219 -0
- package/node_modules/@colors/colors/examples/normal-usage.js +83 -0
- package/node_modules/@colors/colors/examples/safe-string.js +80 -0
- package/node_modules/@colors/colors/index.d.ts +136 -0
- package/node_modules/@colors/colors/lib/colors.js +211 -0
- package/node_modules/@colors/colors/lib/custom/trap.js +46 -0
- package/node_modules/@colors/colors/lib/custom/zalgo.js +110 -0
- package/node_modules/@colors/colors/lib/extendStringPrototype.js +110 -0
- package/node_modules/@colors/colors/lib/index.js +13 -0
- package/node_modules/@colors/colors/lib/maps/america.js +10 -0
- package/node_modules/@colors/colors/lib/maps/rainbow.js +12 -0
- package/node_modules/@colors/colors/lib/maps/random.js +11 -0
- package/node_modules/@colors/colors/lib/maps/zebra.js +5 -0
- package/node_modules/@colors/colors/lib/styles.js +95 -0
- package/node_modules/@colors/colors/lib/system/has-flag.js +35 -0
- package/node_modules/@colors/colors/lib/system/supports-colors.js +151 -0
- package/node_modules/@colors/colors/package.json +45 -0
- package/node_modules/@colors/colors/safe.d.ts +48 -0
- package/node_modules/@colors/colors/safe.js +10 -0
- package/node_modules/@colors/colors/themes/generic-logging.js +12 -0
- package/node_modules/@google/genai/LICENSE +202 -0
- package/node_modules/@google/genai/README.md +244 -0
- package/node_modules/@google/genai/dist/genai.d.ts +3329 -0
- package/node_modules/@google/genai/dist/index.js +6999 -0
- package/node_modules/@google/genai/dist/index.js.map +1 -0
- package/node_modules/@google/genai/dist/index.mjs +6961 -0
- package/node_modules/@google/genai/dist/index.mjs.map +1 -0
- package/node_modules/@google/genai/dist/node/index.js +7308 -0
- package/node_modules/@google/genai/dist/node/index.js.map +1 -0
- package/node_modules/@google/genai/dist/node/node.d.ts +3334 -0
- package/node_modules/@google/genai/dist/web/index.mjs +7007 -0
- package/node_modules/@google/genai/dist/web/index.mjs.map +1 -0
- package/node_modules/@google/genai/dist/web/web.d.ts +3329 -0
- package/node_modules/@google/genai/node/package.json +4 -0
- package/node_modules/@google/genai/package.json +104 -0
- package/node_modules/@google/genai/web/package.json +4 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/LICENSE.md +55 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/README.md +333 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.d.ts +114 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js +762 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.min.js +3 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/package.json +3 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.d.ts +4 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.d.ts.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js +142 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.d.ts +114 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.js +758 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.js.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.min.js +3 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.min.js.map +7 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/package.json +3 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.d.ts +4 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.d.ts.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.js +138 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.js.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/package.json +56 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/src/index.ts +900 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/src/parse-class.ts +158 -0
- package/node_modules/agent-base/LICENSE +22 -0
- package/node_modules/agent-base/README.md +69 -0
- package/node_modules/agent-base/dist/helpers.d.ts +15 -0
- package/node_modules/agent-base/dist/helpers.d.ts.map +1 -0
- package/node_modules/agent-base/dist/helpers.js +66 -0
- package/node_modules/agent-base/dist/helpers.js.map +1 -0
- package/node_modules/agent-base/dist/index.d.ts +41 -0
- package/node_modules/agent-base/dist/index.d.ts.map +1 -0
- package/node_modules/agent-base/dist/index.js +178 -0
- package/node_modules/agent-base/dist/index.js.map +1 -0
- package/node_modules/agent-base/package.json +46 -0
- package/node_modules/ansi-regex/index.d.ts +37 -0
- package/node_modules/ansi-regex/index.js +10 -0
- package/node_modules/ansi-regex/license +9 -0
- package/node_modules/ansi-regex/package.json +55 -0
- package/node_modules/ansi-regex/readme.md +78 -0
- package/node_modules/balanced-match/LICENSE.md +23 -0
- package/node_modules/balanced-match/README.md +57 -0
- package/node_modules/balanced-match/dist/commonjs/index.d.ts +9 -0
- package/node_modules/balanced-match/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/balanced-match/dist/commonjs/index.js +59 -0
- package/node_modules/balanced-match/dist/commonjs/index.js.map +1 -0
- package/node_modules/balanced-match/dist/commonjs/package.json +3 -0
- package/node_modules/balanced-match/dist/esm/index.d.ts +9 -0
- package/node_modules/balanced-match/dist/esm/index.d.ts.map +1 -0
- package/node_modules/balanced-match/dist/esm/index.js +54 -0
- package/node_modules/balanced-match/dist/esm/index.js.map +1 -0
- package/node_modules/balanced-match/dist/esm/package.json +3 -0
- package/node_modules/balanced-match/package.json +68 -0
- package/node_modules/base64-js/LICENSE +21 -0
- package/node_modules/base64-js/README.md +34 -0
- package/node_modules/base64-js/base64js.min.js +1 -0
- package/node_modules/base64-js/index.d.ts +3 -0
- package/node_modules/base64-js/index.js +150 -0
- package/node_modules/base64-js/package.json +47 -0
- package/node_modules/bignumber.js/CHANGELOG.md +381 -0
- package/node_modules/bignumber.js/LICENCE.md +26 -0
- package/node_modules/bignumber.js/README.md +289 -0
- package/node_modules/bignumber.js/bignumber.d.mts +6 -0
- package/node_modules/bignumber.js/bignumber.d.ts +5 -0
- package/node_modules/bignumber.js/bignumber.js +2922 -0
- package/node_modules/bignumber.js/bignumber.mjs +2907 -0
- package/node_modules/bignumber.js/doc/API.html +2249 -0
- package/node_modules/bignumber.js/package.json +60 -0
- package/node_modules/bignumber.js/types.d.ts +1821 -0
- package/node_modules/brace-expansion/LICENSE +23 -0
- package/node_modules/brace-expansion/README.md +105 -0
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts +12 -0
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/brace-expansion/dist/commonjs/index.js +333 -0
- package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -0
- package/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
- package/node_modules/brace-expansion/dist/esm/index.d.ts +12 -0
- package/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -0
- package/node_modules/brace-expansion/dist/esm/index.js +329 -0
- package/node_modules/brace-expansion/dist/esm/index.js.map +1 -0
- package/node_modules/brace-expansion/dist/esm/package.json +3 -0
- package/node_modules/brace-expansion/package.json +65 -0
- package/node_modules/buffer-equal-constant-time/.npmignore +2 -0
- package/node_modules/buffer-equal-constant-time/.travis.yml +4 -0
- package/node_modules/buffer-equal-constant-time/LICENSE.txt +12 -0
- package/node_modules/buffer-equal-constant-time/README.md +50 -0
- package/node_modules/buffer-equal-constant-time/index.js +41 -0
- package/node_modules/buffer-equal-constant-time/package.json +21 -0
- package/node_modules/buffer-equal-constant-time/test.js +42 -0
- package/node_modules/cli-table3/LICENSE +21 -0
- package/node_modules/cli-table3/README.md +236 -0
- package/node_modules/cli-table3/index.d.ts +96 -0
- package/node_modules/cli-table3/index.js +1 -0
- package/node_modules/cli-table3/package.json +100 -0
- package/node_modules/cli-table3/src/cell.js +409 -0
- package/node_modules/cli-table3/src/debug.js +28 -0
- package/node_modules/cli-table3/src/layout-manager.js +254 -0
- package/node_modules/cli-table3/src/table.js +106 -0
- package/node_modules/cli-table3/src/utils.js +344 -0
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1157 -0
- package/node_modules/commander/esm.mjs +16 -0
- package/node_modules/commander/index.js +24 -0
- package/node_modules/commander/lib/argument.js +149 -0
- package/node_modules/commander/lib/command.js +2509 -0
- package/node_modules/commander/lib/error.js +39 -0
- package/node_modules/commander/lib/help.js +520 -0
- package/node_modules/commander/lib/option.js +330 -0
- package/node_modules/commander/lib/suggestSimilar.js +101 -0
- package/node_modules/commander/package-support.json +16 -0
- package/node_modules/commander/package.json +84 -0
- package/node_modules/commander/typings/esm.d.mts +3 -0
- package/node_modules/commander/typings/index.d.ts +969 -0
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +64 -0
- package/node_modules/debug/src/browser.js +272 -0
- package/node_modules/debug/src/common.js +292 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/dotenv/CHANGELOG.md +520 -0
- package/node_modules/dotenv/LICENSE +23 -0
- package/node_modules/dotenv/README-es.md +411 -0
- package/node_modules/dotenv/README.md +645 -0
- package/node_modules/dotenv/SECURITY.md +1 -0
- package/node_modules/dotenv/config.d.ts +1 -0
- package/node_modules/dotenv/config.js +9 -0
- package/node_modules/dotenv/lib/cli-options.js +17 -0
- package/node_modules/dotenv/lib/env-options.js +28 -0
- package/node_modules/dotenv/lib/main.d.ts +162 -0
- package/node_modules/dotenv/lib/main.js +386 -0
- package/node_modules/dotenv/package.json +62 -0
- package/node_modules/ecdsa-sig-formatter/CODEOWNERS +1 -0
- package/node_modules/ecdsa-sig-formatter/LICENSE +201 -0
- package/node_modules/ecdsa-sig-formatter/README.md +65 -0
- package/node_modules/ecdsa-sig-formatter/package.json +46 -0
- package/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.d.ts +17 -0
- package/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js +187 -0
- package/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js +23 -0
- package/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/node_modules/emoji-regex/README.md +73 -0
- package/node_modules/emoji-regex/es2015/index.js +6 -0
- package/node_modules/emoji-regex/es2015/text.js +6 -0
- package/node_modules/emoji-regex/index.d.ts +23 -0
- package/node_modules/emoji-regex/index.js +6 -0
- package/node_modules/emoji-regex/package.json +50 -0
- package/node_modules/emoji-regex/text.js +6 -0
- package/node_modules/extend/.editorconfig +20 -0
- package/node_modules/extend/.eslintrc +17 -0
- package/node_modules/extend/.jscs.json +175 -0
- package/node_modules/extend/.travis.yml +230 -0
- package/node_modules/extend/CHANGELOG.md +83 -0
- package/node_modules/extend/LICENSE +23 -0
- package/node_modules/extend/README.md +81 -0
- package/node_modules/extend/component.json +32 -0
- package/node_modules/extend/index.js +117 -0
- package/node_modules/extend/package.json +42 -0
- package/node_modules/gaxios/LICENSE +202 -0
- package/node_modules/gaxios/README.md +171 -0
- package/node_modules/gaxios/build/src/common.d.ts +220 -0
- package/node_modules/gaxios/build/src/common.js +172 -0
- package/node_modules/gaxios/build/src/common.js.map +1 -0
- package/node_modules/gaxios/build/src/gaxios.d.ts +51 -0
- package/node_modules/gaxios/build/src/gaxios.js +363 -0
- package/node_modules/gaxios/build/src/gaxios.js.map +1 -0
- package/node_modules/gaxios/build/src/index.d.ts +14 -0
- package/node_modules/gaxios/build/src/index.js +33 -0
- package/node_modules/gaxios/build/src/index.js.map +1 -0
- package/node_modules/gaxios/build/src/retry.d.ts +8 -0
- package/node_modules/gaxios/build/src/retry.js +139 -0
- package/node_modules/gaxios/build/src/retry.js.map +1 -0
- package/node_modules/gaxios/build/src/util.d.ts +4 -0
- package/node_modules/gaxios/build/src/util.js +17 -0
- package/node_modules/gaxios/build/src/util.js.map +1 -0
- package/node_modules/gaxios/package.json +95 -0
- package/node_modules/gcp-metadata/LICENSE +202 -0
- package/node_modules/gcp-metadata/README.md +235 -0
- package/node_modules/gcp-metadata/build/src/gcp-residency.d.ts +57 -0
- package/node_modules/gcp-metadata/build/src/gcp-residency.js +114 -0
- package/node_modules/gcp-metadata/build/src/gcp-residency.js.map +1 -0
- package/node_modules/gcp-metadata/build/src/index.d.ts +156 -0
- package/node_modules/gcp-metadata/build/src/index.js +408 -0
- package/node_modules/gcp-metadata/build/src/index.js.map +1 -0
- package/node_modules/gcp-metadata/package.json +73 -0
- package/node_modules/glob/LICENSE.md +63 -0
- package/node_modules/glob/README.md +1377 -0
- package/node_modules/glob/dist/commonjs/glob.d.ts +405 -0
- package/node_modules/glob/dist/commonjs/glob.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/glob.js +241 -0
- package/node_modules/glob/dist/commonjs/glob.js.map +1 -0
- package/node_modules/glob/dist/commonjs/has-magic.d.ts +14 -0
- package/node_modules/glob/dist/commonjs/has-magic.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/has-magic.js +24 -0
- package/node_modules/glob/dist/commonjs/has-magic.js.map +1 -0
- package/node_modules/glob/dist/commonjs/ignore.d.ts +36 -0
- package/node_modules/glob/dist/commonjs/ignore.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/ignore.js +139 -0
- package/node_modules/glob/dist/commonjs/ignore.js.map +1 -0
- package/node_modules/glob/dist/commonjs/index.d.ts +98 -0
- package/node_modules/glob/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/index.js +68 -0
- package/node_modules/glob/dist/commonjs/index.js.map +1 -0
- package/node_modules/glob/dist/commonjs/index.min.js +3 -0
- package/node_modules/glob/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/glob/dist/commonjs/package.json +3 -0
- package/node_modules/glob/dist/commonjs/pattern.d.ts +86 -0
- package/node_modules/glob/dist/commonjs/pattern.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/pattern.js +235 -0
- package/node_modules/glob/dist/commonjs/pattern.js.map +1 -0
- package/node_modules/glob/dist/commonjs/processor.d.ts +72 -0
- package/node_modules/glob/dist/commonjs/processor.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/processor.js +314 -0
- package/node_modules/glob/dist/commonjs/processor.js.map +1 -0
- package/node_modules/glob/dist/commonjs/walker.d.ts +99 -0
- package/node_modules/glob/dist/commonjs/walker.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/walker.js +402 -0
- package/node_modules/glob/dist/commonjs/walker.js.map +1 -0
- package/node_modules/glob/dist/esm/glob.d.ts +405 -0
- package/node_modules/glob/dist/esm/glob.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/glob.js +237 -0
- package/node_modules/glob/dist/esm/glob.js.map +1 -0
- package/node_modules/glob/dist/esm/has-magic.d.ts +14 -0
- package/node_modules/glob/dist/esm/has-magic.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/has-magic.js +20 -0
- package/node_modules/glob/dist/esm/has-magic.js.map +1 -0
- package/node_modules/glob/dist/esm/ignore.d.ts +36 -0
- package/node_modules/glob/dist/esm/ignore.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/ignore.js +135 -0
- package/node_modules/glob/dist/esm/ignore.js.map +1 -0
- package/node_modules/glob/dist/esm/index.d.ts +98 -0
- package/node_modules/glob/dist/esm/index.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/index.js +55 -0
- package/node_modules/glob/dist/esm/index.js.map +1 -0
- package/node_modules/glob/dist/esm/index.min.js +3 -0
- package/node_modules/glob/dist/esm/index.min.js.map +7 -0
- package/node_modules/glob/dist/esm/package.json +3 -0
- package/node_modules/glob/dist/esm/pattern.d.ts +86 -0
- package/node_modules/glob/dist/esm/pattern.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/pattern.js +231 -0
- package/node_modules/glob/dist/esm/pattern.js.map +1 -0
- package/node_modules/glob/dist/esm/processor.d.ts +72 -0
- package/node_modules/glob/dist/esm/processor.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/processor.js +307 -0
- package/node_modules/glob/dist/esm/processor.js.map +1 -0
- package/node_modules/glob/dist/esm/walker.d.ts +99 -0
- package/node_modules/glob/dist/esm/walker.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/walker.js +396 -0
- package/node_modules/glob/dist/esm/walker.js.map +1 -0
- package/node_modules/glob/package.json +114 -0
- package/node_modules/glob/src/glob.ts +655 -0
- package/node_modules/glob/src/has-magic.ts +23 -0
- package/node_modules/glob/src/ignore.ts +162 -0
- package/node_modules/glob/src/index.ts +225 -0
- package/node_modules/glob/src/pattern.ts +286 -0
- package/node_modules/glob/src/processor.ts +333 -0
- package/node_modules/glob/src/walker.ts +523 -0
- package/node_modules/google-auth-library/LICENSE +202 -0
- package/node_modules/google-auth-library/README.md +1470 -0
- package/node_modules/google-auth-library/build/src/auth/authclient.d.ts +202 -0
- package/node_modules/google-auth-library/build/src/auth/authclient.js +116 -0
- package/node_modules/google-auth-library/build/src/auth/awsclient.d.ts +120 -0
- package/node_modules/google-auth-library/build/src/auth/awsclient.js +164 -0
- package/node_modules/google-auth-library/build/src/auth/awsrequestsigner.d.ts +40 -0
- package/node_modules/google-auth-library/build/src/auth/awsrequestsigner.js +209 -0
- package/node_modules/google-auth-library/build/src/auth/baseexternalclient.d.ts +322 -0
- package/node_modules/google-auth-library/build/src/auth/baseexternalclient.js +468 -0
- package/node_modules/google-auth-library/build/src/auth/computeclient.d.ts +37 -0
- package/node_modules/google-auth-library/build/src/auth/computeclient.js +117 -0
- package/node_modules/google-auth-library/build/src/auth/credentials.d.ts +75 -0
- package/node_modules/google-auth-library/build/src/auth/credentials.js +15 -0
- package/node_modules/google-auth-library/build/src/auth/defaultawssecuritycredentialssupplier.d.ts +79 -0
- package/node_modules/google-auth-library/build/src/auth/defaultawssecuritycredentialssupplier.js +196 -0
- package/node_modules/google-auth-library/build/src/auth/downscopedclient.d.ts +139 -0
- package/node_modules/google-auth-library/build/src/auth/downscopedclient.js +262 -0
- package/node_modules/google-auth-library/build/src/auth/envDetect.d.ts +10 -0
- package/node_modules/google-auth-library/build/src/auth/envDetect.js +89 -0
- package/node_modules/google-auth-library/build/src/auth/executable-response.d.ts +137 -0
- package/node_modules/google-auth-library/build/src/auth/executable-response.js +146 -0
- package/node_modules/google-auth-library/build/src/auth/externalAccountAuthorizedUserClient.d.ts +78 -0
- package/node_modules/google-auth-library/build/src/auth/externalAccountAuthorizedUserClient.js +239 -0
- package/node_modules/google-auth-library/build/src/auth/externalclient.d.ts +26 -0
- package/node_modules/google-auth-library/build/src/auth/externalclient.js +64 -0
- package/node_modules/google-auth-library/build/src/auth/filesubjecttokensupplier.d.ts +42 -0
- package/node_modules/google-auth-library/build/src/auth/filesubjecttokensupplier.js +81 -0
- package/node_modules/google-auth-library/build/src/auth/googleauth.d.ts +375 -0
- package/node_modules/google-auth-library/build/src/auth/googleauth.js +841 -0
- package/node_modules/google-auth-library/build/src/auth/iam.d.ts +23 -0
- package/node_modules/google-auth-library/build/src/auth/iam.js +41 -0
- package/node_modules/google-auth-library/build/src/auth/identitypoolclient.d.ts +102 -0
- package/node_modules/google-auth-library/build/src/auth/identitypoolclient.js +107 -0
- package/node_modules/google-auth-library/build/src/auth/idtokenclient.d.ts +27 -0
- package/node_modules/google-auth-library/build/src/auth/idtokenclient.js +55 -0
- package/node_modules/google-auth-library/build/src/auth/impersonated.d.ts +127 -0
- package/node_modules/google-auth-library/build/src/auth/impersonated.js +186 -0
- package/node_modules/google-auth-library/build/src/auth/jwtaccess.d.ts +62 -0
- package/node_modules/google-auth-library/build/src/auth/jwtaccess.js +192 -0
- package/node_modules/google-auth-library/build/src/auth/jwtclient.d.ts +117 -0
- package/node_modules/google-auth-library/build/src/auth/jwtclient.js +284 -0
- package/node_modules/google-auth-library/build/src/auth/loginticket.d.ts +140 -0
- package/node_modules/google-auth-library/build/src/auth/loginticket.js +57 -0
- package/node_modules/google-auth-library/build/src/auth/oauth2client.d.ts +575 -0
- package/node_modules/google-auth-library/build/src/auth/oauth2client.js +794 -0
- package/node_modules/google-auth-library/build/src/auth/oauth2common.d.ts +92 -0
- package/node_modules/google-auth-library/build/src/auth/oauth2common.js +192 -0
- package/node_modules/google-auth-library/build/src/auth/passthrough.d.ts +38 -0
- package/node_modules/google-auth-library/build/src/auth/passthrough.js +61 -0
- package/node_modules/google-auth-library/build/src/auth/pluggable-auth-client.d.ts +155 -0
- package/node_modules/google-auth-library/build/src/auth/pluggable-auth-client.js +215 -0
- package/node_modules/google-auth-library/build/src/auth/pluggable-auth-handler.d.ts +51 -0
- package/node_modules/google-auth-library/build/src/auth/pluggable-auth-handler.js +156 -0
- package/node_modules/google-auth-library/build/src/auth/refreshclient.d.ts +50 -0
- package/node_modules/google-auth-library/build/src/auth/refreshclient.js +132 -0
- package/node_modules/google-auth-library/build/src/auth/stscredentials.d.ts +114 -0
- package/node_modules/google-auth-library/build/src/auth/stscredentials.js +109 -0
- package/node_modules/google-auth-library/build/src/auth/urlsubjecttokensupplier.d.ts +57 -0
- package/node_modules/google-auth-library/build/src/auth/urlsubjecttokensupplier.js +63 -0
- package/node_modules/google-auth-library/build/src/crypto/browser/crypto.d.ts +27 -0
- package/node_modules/google-auth-library/build/src/crypto/browser/crypto.js +126 -0
- package/node_modules/google-auth-library/build/src/crypto/crypto.d.ts +44 -0
- package/node_modules/google-auth-library/build/src/crypto/crypto.js +47 -0
- package/node_modules/google-auth-library/build/src/crypto/node/crypto.d.ts +25 -0
- package/node_modules/google-auth-library/build/src/crypto/node/crypto.js +82 -0
- package/node_modules/google-auth-library/build/src/index.d.ts +33 -0
- package/node_modules/google-auth-library/build/src/index.js +68 -0
- package/node_modules/google-auth-library/build/src/messages.d.ts +11 -0
- package/node_modules/google-auth-library/build/src/messages.js +39 -0
- package/node_modules/google-auth-library/build/src/options.d.ts +1 -0
- package/node_modules/google-auth-library/build/src/options.js +34 -0
- package/node_modules/google-auth-library/build/src/transporters.d.ts +40 -0
- package/node_modules/google-auth-library/build/src/transporters.js +110 -0
- package/node_modules/google-auth-library/build/src/util.d.ts +151 -0
- package/node_modules/google-auth-library/build/src/util.js +125 -0
- package/node_modules/google-auth-library/package.json +94 -0
- package/node_modules/google-logging-utils/LICENSE +202 -0
- package/node_modules/google-logging-utils/build/src/colours.d.ts +29 -0
- package/node_modules/google-logging-utils/build/src/colours.js +80 -0
- package/node_modules/google-logging-utils/build/src/colours.js.map +1 -0
- package/node_modules/google-logging-utils/build/src/index.d.ts +1 -0
- package/node_modules/google-logging-utils/build/src/index.js +31 -0
- package/node_modules/google-logging-utils/build/src/index.js.map +1 -0
- package/node_modules/google-logging-utils/build/src/logging-utils.d.ts +222 -0
- package/node_modules/google-logging-utils/build/src/logging-utils.js +406 -0
- package/node_modules/google-logging-utils/build/src/logging-utils.js.map +1 -0
- package/node_modules/google-logging-utils/build/src/temporal.d.ts +45 -0
- package/node_modules/google-logging-utils/build/src/temporal.js +68 -0
- package/node_modules/google-logging-utils/build/src/temporal.js.map +1 -0
- package/node_modules/google-logging-utils/package.json +39 -0
- package/node_modules/gtoken/LICENSE +21 -0
- package/node_modules/gtoken/README.md +187 -0
- package/node_modules/gtoken/build/src/index.d.ts +93 -0
- package/node_modules/gtoken/build/src/index.js +276 -0
- package/node_modules/gtoken/package.json +62 -0
- package/node_modules/https-proxy-agent/LICENSE +22 -0
- package/node_modules/https-proxy-agent/README.md +70 -0
- package/node_modules/https-proxy-agent/dist/index.d.ts +47 -0
- package/node_modules/https-proxy-agent/dist/index.d.ts.map +1 -0
- package/node_modules/https-proxy-agent/dist/index.js +180 -0
- package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +15 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts.map +1 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +101 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- package/node_modules/https-proxy-agent/package.json +50 -0
- package/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
- package/node_modules/is-fullwidth-code-point/index.js +50 -0
- package/node_modules/is-fullwidth-code-point/license +9 -0
- package/node_modules/is-fullwidth-code-point/package.json +42 -0
- package/node_modules/is-fullwidth-code-point/readme.md +39 -0
- package/node_modules/is-stream/index.d.ts +79 -0
- package/node_modules/is-stream/index.js +28 -0
- package/node_modules/is-stream/license +9 -0
- package/node_modules/is-stream/package.json +42 -0
- package/node_modules/is-stream/readme.md +60 -0
- package/node_modules/json-bigint/LICENSE +20 -0
- package/node_modules/json-bigint/README.md +240 -0
- package/node_modules/json-bigint/index.js +12 -0
- package/node_modules/json-bigint/lib/parse.js +443 -0
- package/node_modules/json-bigint/lib/stringify.js +384 -0
- package/node_modules/json-bigint/package.json +34 -0
- package/node_modules/jwa/LICENSE +17 -0
- package/node_modules/jwa/README.md +150 -0
- package/node_modules/jwa/index.js +266 -0
- package/node_modules/jwa/opslevel.yml +6 -0
- package/node_modules/jwa/package.json +37 -0
- package/node_modules/jws/CHANGELOG.md +56 -0
- package/node_modules/jws/LICENSE +17 -0
- package/node_modules/jws/index.js +22 -0
- package/node_modules/jws/lib/data-stream.js +55 -0
- package/node_modules/jws/lib/sign-stream.js +83 -0
- package/node_modules/jws/lib/tostring.js +10 -0
- package/node_modules/jws/lib/verify-stream.js +125 -0
- package/node_modules/jws/opslevel.yml +6 -0
- package/node_modules/jws/package.json +34 -0
- package/node_modules/jws/readme.md +255 -0
- package/node_modules/lru-cache/LICENSE.md +55 -0
- package/node_modules/lru-cache/README.md +469 -0
- package/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.js +7 -0
- package/node_modules/lru-cache/dist/commonjs/browser/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/browser/index.js +1733 -0
- package/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/browser/index.min.js +2 -0
- package/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/commonjs/browser/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/commonjs/browser/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/browser/perf.js +10 -0
- package/node_modules/lru-cache/dist/commonjs/browser/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.cjs.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.d.cts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +7 -0
- package/node_modules/lru-cache/dist/commonjs/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/index.js +1733 -0
- package/node_modules/lru-cache/dist/commonjs/index.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
- package/node_modules/lru-cache/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.js +9 -0
- package/node_modules/lru-cache/dist/commonjs/node/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/node/index.js +1733 -0
- package/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/node/index.min.js +2 -0
- package/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/commonjs/node/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/commonjs/node/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/node/perf.js +10 -0
- package/node_modules/lru-cache/dist/commonjs/node/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/package.json +3 -0
- package/node_modules/lru-cache/dist/commonjs/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/commonjs/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/perf.js +10 -0
- package/node_modules/lru-cache/dist/commonjs/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel-react-native.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel-react-native.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/diagnostics-channel.js +7 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/index.js +1733 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/index.js.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/perf.js +10 -0
- package/node_modules/lru-cache/dist/commonjs/react-native/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
- package/node_modules/lru-cache/dist/esm/browser/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/browser/index.js +1729 -0
- package/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
- package/node_modules/lru-cache/dist/esm/browser/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/esm/browser/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/esm/browser/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/browser/perf.js +7 -0
- package/node_modules/lru-cache/dist/esm/browser/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map +1 -0
- package/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.mjs.map +1 -0
- package/node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
- package/node_modules/lru-cache/dist/esm/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/index.js +1729 -0
- package/node_modules/lru-cache/dist/esm/index.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/index.min.js +2 -0
- package/node_modules/lru-cache/dist/esm/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +6 -0
- package/node_modules/lru-cache/dist/esm/node/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/node/index.js +1729 -0
- package/node_modules/lru-cache/dist/esm/node/index.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
- package/node_modules/lru-cache/dist/esm/node/index.min.js.map +7 -0
- package/node_modules/lru-cache/dist/esm/node/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/esm/node/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/node/perf.js +7 -0
- package/node_modules/lru-cache/dist/esm/node/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/package.json +3 -0
- package/node_modules/lru-cache/dist/esm/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/esm/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/perf.js +7 -0
- package/node_modules/lru-cache/dist/esm/perf.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel-react-native.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel-react-native.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel.d.ts +5 -0
- package/node_modules/lru-cache/dist/esm/react-native/diagnostics-channel.js +4 -0
- package/node_modules/lru-cache/dist/esm/react-native/index.d.ts +1400 -0
- package/node_modules/lru-cache/dist/esm/react-native/index.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/react-native/index.js +1729 -0
- package/node_modules/lru-cache/dist/esm/react-native/index.js.map +1 -0
- package/node_modules/lru-cache/dist/esm/react-native/perf.d.ts +12 -0
- package/node_modules/lru-cache/dist/esm/react-native/perf.d.ts.map +1 -0
- package/node_modules/lru-cache/dist/esm/react-native/perf.js +7 -0
- package/node_modules/lru-cache/dist/esm/react-native/perf.js.map +1 -0
- package/node_modules/lru-cache/package.json +180 -0
- package/node_modules/minimatch/LICENSE.md +55 -0
- package/node_modules/minimatch/README.md +546 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
- package/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/escape.js +30 -0
- package/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/index.d.ts +185 -0
- package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/index.js +1550 -0
- package/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/package.json +3 -0
- package/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
- package/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
- package/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
- package/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
- package/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/escape.js +26 -0
- package/node_modules/minimatch/dist/esm/escape.js.map +1 -0
- package/node_modules/minimatch/dist/esm/index.d.ts +185 -0
- package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/index.js +1539 -0
- package/node_modules/minimatch/dist/esm/index.js.map +1 -0
- package/node_modules/minimatch/dist/esm/package.json +3 -0
- package/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
- package/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/unescape.js +34 -0
- package/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
- package/node_modules/minimatch/package.json +74 -0
- package/node_modules/minipass/LICENSE.md +55 -0
- package/node_modules/minipass/README.md +825 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts +545 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/commonjs/index.js +1038 -0
- package/node_modules/minipass/dist/commonjs/index.js.map +1 -0
- package/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/node_modules/minipass/dist/esm/index.d.ts +545 -0
- package/node_modules/minipass/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/esm/index.js +1020 -0
- package/node_modules/minipass/dist/esm/index.js.map +1 -0
- package/node_modules/minipass/dist/esm/package.json +3 -0
- package/node_modules/minipass/package.json +77 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/node_modules/node-fetch/LICENSE.md +22 -0
- package/node_modules/node-fetch/README.md +634 -0
- package/node_modules/node-fetch/browser.js +25 -0
- package/node_modules/node-fetch/lib/index.es.js +1777 -0
- package/node_modules/node-fetch/lib/index.js +1787 -0
- package/node_modules/node-fetch/lib/index.mjs +1775 -0
- package/node_modules/node-fetch/package.json +89 -0
- package/node_modules/path-scurry/LICENSE.md +55 -0
- package/node_modules/path-scurry/README.md +635 -0
- package/node_modules/path-scurry/dist/commonjs/index.d.ts +1122 -0
- package/node_modules/path-scurry/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/path-scurry/dist/commonjs/index.js +2056 -0
- package/node_modules/path-scurry/dist/commonjs/index.js.map +1 -0
- package/node_modules/path-scurry/dist/commonjs/package.json +3 -0
- package/node_modules/path-scurry/dist/esm/index.d.ts +1122 -0
- package/node_modules/path-scurry/dist/esm/index.d.ts.map +1 -0
- package/node_modules/path-scurry/dist/esm/index.js +2011 -0
- package/node_modules/path-scurry/dist/esm/index.js.map +1 -0
- package/node_modules/path-scurry/dist/esm/package.json +3 -0
- package/node_modules/path-scurry/package.json +72 -0
- package/node_modules/picocolors/LICENSE +15 -0
- package/node_modules/picocolors/README.md +21 -0
- package/node_modules/picocolors/package.json +25 -0
- package/node_modules/picocolors/picocolors.browser.js +4 -0
- package/node_modules/picocolors/picocolors.d.ts +5 -0
- package/node_modules/picocolors/picocolors.js +75 -0
- package/node_modules/picocolors/types.d.ts +51 -0
- package/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/safe-buffer/index.js +65 -0
- package/node_modules/safe-buffer/package.json +51 -0
- package/node_modules/string-width/index.d.ts +29 -0
- package/node_modules/string-width/index.js +47 -0
- package/node_modules/string-width/license +9 -0
- package/node_modules/string-width/package.json +56 -0
- package/node_modules/string-width/readme.md +50 -0
- package/node_modules/strip-ansi/index.d.ts +17 -0
- package/node_modules/strip-ansi/index.js +4 -0
- package/node_modules/strip-ansi/license +9 -0
- package/node_modules/strip-ansi/package.json +54 -0
- package/node_modules/strip-ansi/readme.md +46 -0
- package/node_modules/tr46/.npmignore +4 -0
- package/node_modules/tr46/index.js +193 -0
- package/node_modules/tr46/lib/.gitkeep +0 -0
- package/node_modules/tr46/lib/mappingTable.json +1 -0
- package/node_modules/tr46/package.json +31 -0
- package/node_modules/webidl-conversions/LICENSE.md +12 -0
- package/node_modules/webidl-conversions/README.md +53 -0
- package/node_modules/webidl-conversions/lib/index.js +189 -0
- package/node_modules/webidl-conversions/package.json +23 -0
- package/node_modules/whatwg-url/LICENSE.txt +21 -0
- package/node_modules/whatwg-url/README.md +67 -0
- package/node_modules/whatwg-url/lib/URL-impl.js +200 -0
- package/node_modules/whatwg-url/lib/URL.js +196 -0
- package/node_modules/whatwg-url/lib/public-api.js +11 -0
- package/node_modules/whatwg-url/lib/url-state-machine.js +1297 -0
- package/node_modules/whatwg-url/lib/utils.js +20 -0
- package/node_modules/whatwg-url/package.json +32 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +540 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +142 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +530 -0
- package/node_modules/ws/lib/receiver.js +743 -0
- package/node_modules/ws/lib/sender.js +610 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +562 -0
- package/node_modules/ws/lib/websocket.js +1426 -0
- package/node_modules/ws/package.json +74 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/node_modules/zod/LICENSE +21 -0
- package/node_modules/zod/README.md +218 -0
- package/node_modules/zod/compile.cjs +96 -0
- package/node_modules/zod/compile.d.cts +1 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +52 -0
- package/node_modules/zod/index.d.cts +3 -0
- package/node_modules/zod/index.d.ts +3 -0
- package/node_modules/zod/index.js +7 -0
- package/node_modules/zod/locales/index.cjs +36 -0
- package/node_modules/zod/locales/index.d.cts +1 -0
- package/node_modules/zod/locales/index.d.ts +1 -0
- package/node_modules/zod/locales/index.js +1 -0
- package/node_modules/zod/locales/package.json +7 -0
- package/node_modules/zod/mini/index.cjs +51 -0
- package/node_modules/zod/mini/index.d.cts +3 -0
- package/node_modules/zod/mini/index.d.ts +3 -0
- package/node_modules/zod/mini/index.js +3 -0
- package/node_modules/zod/mini/package.json +7 -0
- package/node_modules/zod/package.json +147 -0
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +7 -0
- package/node_modules/zod/src/locales/index.ts +1 -0
- package/node_modules/zod/src/mini/index.ts +3 -0
- package/node_modules/zod/src/v3/ZodError.ts +340 -0
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
- package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
- package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
- package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
- package/node_modules/zod/src/v3/errors.ts +13 -0
- package/node_modules/zod/src/v3/external.ts +6 -0
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
- package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
- package/node_modules/zod/src/v3/helpers/util.ts +224 -0
- package/node_modules/zod/src/v3/index.ts +4 -0
- package/node_modules/zod/src/v3/locales/en.ts +124 -0
- package/node_modules/zod/src/v3/standard-schema.ts +113 -0
- package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
- package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
- package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
- package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
- package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
- package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
- package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
- package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
- package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
- package/node_modules/zod/src/v3/tests/error.test.ts +586 -0
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
- package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +128 -0
- package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +206 -0
- package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
- package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
- package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
- package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object.test.ts +431 -0
- package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
- package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
- package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
- package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/readonly.test.ts +114 -0
- package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
- package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
- package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
- package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
- package/node_modules/zod/src/v3/tests/string.test.ts +922 -0
- package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
- package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
- package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
- package/node_modules/zod/src/v3/types.ts +5138 -0
- package/node_modules/zod/src/v4/classic/checks.ts +33 -0
- package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
- package/node_modules/zod/src/v4/classic/compat.ts +78 -0
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +97 -0
- package/node_modules/zod/src/v4/classic/external.ts +57 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +944 -0
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +5 -0
- package/node_modules/zod/src/v4/classic/iso.ts +20 -0
- package/node_modules/zod/src/v4/classic/parse.ts +88 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +2937 -0
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +86 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +291 -0
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +402 -0
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +89 -0
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +604 -0
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +572 -0
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +704 -0
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +92 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +316 -0
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +455 -0
- package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +221 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +942 -0
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +305 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +917 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +1108 -0
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
- package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +1467 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +391 -0
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +67 -0
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +958 -0
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +127 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +334 -0
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +262 -0
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +128 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +349 -0
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +401 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +1006 -0
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +366 -0
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +497 -0
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +144 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +44 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +184 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +885 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +707 -0
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +693 -0
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +196 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +153 -0
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +1440 -0
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +124 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +812 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +4733 -0
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +511 -0
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +310 -0
- package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
- package/node_modules/zod/src/v4/core/api.ts +1875 -0
- package/node_modules/zod/src/v4/core/checks.ts +1266 -0
- package/node_modules/zod/src/v4/core/compile.ts +2322 -0
- package/node_modules/zod/src/v4/core/core.ts +230 -0
- package/node_modules/zod/src/v4/core/doc.ts +52 -0
- package/node_modules/zod/src/v4/core/errors.ts +543 -0
- package/node_modules/zod/src/v4/core/index.ts +19 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +131 -0
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +934 -0
- package/node_modules/zod/src/v4/core/json-schema.ts +148 -0
- package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
- package/node_modules/zod/src/v4/core/parse.ts +309 -0
- package/node_modules/zod/src/v4/core/regexes.ts +217 -0
- package/node_modules/zod/src/v4/core/registries.ts +105 -0
- package/node_modules/zod/src/v4/core/schemas.ts +5226 -0
- package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
- package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +214 -0
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +180 -0
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
- package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
- package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +857 -0
- package/node_modules/zod/src/v4/core/util.ts +1293 -0
- package/node_modules/zod/src/v4/core/versions.ts +5 -0
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/core/zsf.ts +323 -0
- package/node_modules/zod/src/v4/index.ts +4 -0
- package/node_modules/zod/src/v4/locales/ar.ts +120 -0
- package/node_modules/zod/src/v4/locales/az.ts +116 -0
- package/node_modules/zod/src/v4/locales/be.ts +188 -0
- package/node_modules/zod/src/v4/locales/bg.ts +133 -0
- package/node_modules/zod/src/v4/locales/bn.ts +123 -0
- package/node_modules/zod/src/v4/locales/ca.ts +121 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
- package/node_modules/zod/src/v4/locales/cs.ts +123 -0
- package/node_modules/zod/src/v4/locales/da.ts +128 -0
- package/node_modules/zod/src/v4/locales/de.ts +121 -0
- package/node_modules/zod/src/v4/locales/el.ts +124 -0
- package/node_modules/zod/src/v4/locales/en.ts +136 -0
- package/node_modules/zod/src/v4/locales/eo.ts +123 -0
- package/node_modules/zod/src/v4/locales/es.ts +145 -0
- package/node_modules/zod/src/v4/locales/fa.ts +131 -0
- package/node_modules/zod/src/v4/locales/fi.ts +126 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +121 -0
- package/node_modules/zod/src/v4/locales/fr.ts +139 -0
- package/node_modules/zod/src/v4/locales/gu.ts +123 -0
- package/node_modules/zod/src/v4/locales/he.ts +253 -0
- package/node_modules/zod/src/v4/locales/hi.ts +126 -0
- package/node_modules/zod/src/v4/locales/hr.ts +135 -0
- package/node_modules/zod/src/v4/locales/hu.ts +122 -0
- package/node_modules/zod/src/v4/locales/hy.ts +175 -0
- package/node_modules/zod/src/v4/locales/id.ts +120 -0
- package/node_modules/zod/src/v4/locales/index.ts +63 -0
- package/node_modules/zod/src/v4/locales/is.ts +124 -0
- package/node_modules/zod/src/v4/locales/it.ts +121 -0
- package/node_modules/zod/src/v4/locales/ja.ts +119 -0
- package/node_modules/zod/src/v4/locales/ka.ts +128 -0
- package/node_modules/zod/src/v4/locales/kh.ts +7 -0
- package/node_modules/zod/src/v4/locales/km.ts +124 -0
- package/node_modules/zod/src/v4/locales/kn.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +126 -0
- package/node_modules/zod/src/v4/locales/lt.ts +243 -0
- package/node_modules/zod/src/v4/locales/mk.ts +123 -0
- package/node_modules/zod/src/v4/locales/ms.ts +120 -0
- package/node_modules/zod/src/v4/locales/ne.ts +128 -0
- package/node_modules/zod/src/v4/locales/nl.ts +126 -0
- package/node_modules/zod/src/v4/locales/nn.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +121 -0
- package/node_modules/zod/src/v4/locales/ota.ts +122 -0
- package/node_modules/zod/src/v4/locales/pl.ts +123 -0
- package/node_modules/zod/src/v4/locales/ps.ts +131 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
- package/node_modules/zod/src/v4/locales/pt.ts +159 -0
- package/node_modules/zod/src/v4/locales/ro.ts +132 -0
- package/node_modules/zod/src/v4/locales/ru.ts +188 -0
- package/node_modules/zod/src/v4/locales/sk.ts +123 -0
- package/node_modules/zod/src/v4/locales/sl.ts +123 -0
- package/node_modules/zod/src/v4/locales/sv.ts +124 -0
- package/node_modules/zod/src/v4/locales/ta.ts +123 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +124 -0
- package/node_modules/zod/src/v4/locales/tk.ts +113 -0
- package/node_modules/zod/src/v4/locales/tr.ts +116 -0
- package/node_modules/zod/src/v4/locales/ua.ts +7 -0
- package/node_modules/zod/src/v4/locales/uk.ts +122 -0
- package/node_modules/zod/src/v4/locales/ur.ts +124 -0
- package/node_modules/zod/src/v4/locales/uz.ts +120 -0
- package/node_modules/zod/src/v4/locales/vi.ts +122 -0
- package/node_modules/zod/src/v4/locales/yo.ts +129 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +121 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +120 -0
- package/node_modules/zod/src/v4/mini/checks.ts +33 -0
- package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +52 -0
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/index.ts +3 -0
- package/node_modules/zod/src/v4/mini/iso.ts +66 -0
- package/node_modules/zod/src/v4/mini/parse.ts +16 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +2051 -0
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +57 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +190 -0
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +158 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +582 -0
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +30 -0
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +41 -0
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +1146 -0
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +109 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +292 -0
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +341 -0
- package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +396 -0
- package/node_modules/zod/src/v4-mini/index.ts +3 -0
- package/node_modules/zod/v3/ZodError.cjs +167 -0
- package/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/zod/v3/ZodError.d.ts +164 -0
- package/node_modules/zod/v3/ZodError.js +143 -0
- package/node_modules/zod/v3/errors.cjs +36 -0
- package/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/zod/v3/errors.d.ts +5 -0
- package/node_modules/zod/v3/errors.js +9 -0
- package/node_modules/zod/v3/external.cjs +41 -0
- package/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/zod/v3/external.d.ts +6 -0
- package/node_modules/zod/v3/external.js +6 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +21 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +28 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/node_modules/zod/v3/helpers/parseUtil.cjs +143 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +21 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +21 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/zod/v3/helpers/util.cjs +156 -0
- package/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/zod/v3/helpers/util.d.ts +85 -0
- package/node_modules/zod/v3/helpers/util.js +133 -0
- package/node_modules/zod/v3/index.cjs +52 -0
- package/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/zod/v3/index.d.ts +4 -0
- package/node_modules/zod/v3/index.js +4 -0
- package/node_modules/zod/v3/locales/en.cjs +112 -0
- package/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/zod/v3/locales/en.d.ts +3 -0
- package/node_modules/zod/v3/locales/en.js +109 -0
- package/node_modules/zod/v3/package.json +7 -0
- package/node_modules/zod/v3/standard-schema.cjs +21 -0
- package/node_modules/zod/v3/standard-schema.d.cts +102 -0
- package/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/zod/v3/types.cjs +3798 -0
- package/node_modules/zod/v3/types.d.cts +1034 -0
- package/node_modules/zod/v3/types.d.ts +1034 -0
- package/node_modules/zod/v3/types.js +3697 -0
- package/node_modules/zod/v4/classic/checks.cjs +53 -0
- package/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/node_modules/zod/v4/classic/checks.js +1 -0
- package/node_modules/zod/v4/classic/coerce.cjs +66 -0
- package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/node_modules/zod/v4/classic/coerce.js +17 -0
- package/node_modules/zod/v4/classic/compat.cjs +80 -0
- package/node_modules/zod/v4/classic/compat.d.cts +48 -0
- package/node_modules/zod/v4/classic/compat.d.ts +48 -0
- package/node_modules/zod/v4/classic/compat.js +31 -0
- package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/node_modules/zod/v4/classic/errors.cjs +102 -0
- package/node_modules/zod/v4/classic/errors.d.cts +29 -0
- package/node_modules/zod/v4/classic/errors.d.ts +29 -0
- package/node_modules/zod/v4/classic/errors.js +57 -0
- package/node_modules/zod/v4/classic/external.cjs +97 -0
- package/node_modules/zod/v4/classic/external.d.cts +19 -0
- package/node_modules/zod/v4/classic/external.d.ts +19 -0
- package/node_modules/zod/v4/classic/external.js +17 -0
- package/node_modules/zod/v4/classic/from-json-schema.cjs +926 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.js +881 -0
- package/node_modules/zod/v4/classic/in-out.cjs +82 -0
- package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
- package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
- package/node_modules/zod/v4/classic/in-out.js +36 -0
- package/node_modules/zod/v4/classic/index.cjs +52 -0
- package/node_modules/zod/v4/classic/index.d.cts +3 -0
- package/node_modules/zod/v4/classic/index.d.ts +3 -0
- package/node_modules/zod/v4/classic/index.js +4 -0
- package/node_modules/zod/v4/classic/iso.cjs +68 -0
- package/node_modules/zod/v4/classic/iso.d.cts +7 -0
- package/node_modules/zod/v4/classic/iso.d.ts +7 -0
- package/node_modules/zod/v4/classic/iso.js +15 -0
- package/node_modules/zod/v4/classic/package.json +7 -0
- package/node_modules/zod/v4/classic/parse.cjs +63 -0
- package/node_modules/zod/v4/classic/parse.d.cts +44 -0
- package/node_modules/zod/v4/classic/parse.d.ts +44 -0
- package/node_modules/zod/v4/classic/parse.js +16 -0
- package/node_modules/zod/v4/classic/schemas.cjs +1676 -0
- package/node_modules/zod/v4/classic/schemas.d.cts +816 -0
- package/node_modules/zod/v4/classic/schemas.d.ts +816 -0
- package/node_modules/zod/v4/classic/schemas.js +1535 -0
- package/node_modules/zod/v4/core/api.cjs +1269 -0
- package/node_modules/zod/v4/core/api.d.cts +335 -0
- package/node_modules/zod/v4/core/api.d.ts +335 -0
- package/node_modules/zod/v4/core/api.js +1107 -0
- package/node_modules/zod/v4/core/checks.cjs +561 -0
- package/node_modules/zod/v4/core/checks.d.cts +294 -0
- package/node_modules/zod/v4/core/checks.d.ts +294 -0
- package/node_modules/zod/v4/core/checks.js +516 -0
- package/node_modules/zod/v4/core/compile.cjs +1916 -0
- package/node_modules/zod/v4/core/compile.d.cts +65 -0
- package/node_modules/zod/v4/core/compile.d.ts +65 -0
- package/node_modules/zod/v4/core/compile.js +1866 -0
- package/node_modules/zod/v4/core/core.cjs +167 -0
- package/node_modules/zod/v4/core/core.d.cts +82 -0
- package/node_modules/zod/v4/core/core.d.ts +82 -0
- package/node_modules/zod/v4/core/core.js +141 -0
- package/node_modules/zod/v4/core/doc.cjs +61 -0
- package/node_modules/zod/v4/core/doc.d.cts +16 -0
- package/node_modules/zod/v4/core/doc.d.ts +16 -0
- package/node_modules/zod/v4/core/doc.js +38 -0
- package/node_modules/zod/v4/core/errors.cjs +317 -0
- package/node_modules/zod/v4/core/errors.d.cts +225 -0
- package/node_modules/zod/v4/core/errors.d.ts +225 -0
- package/node_modules/zod/v4/core/errors.js +267 -0
- package/node_modules/zod/v4/core/index.cjs +70 -0
- package/node_modules/zod/v4/core/index.d.cts +19 -0
- package/node_modules/zod/v4/core/index.d.ts +19 -0
- package/node_modules/zod/v4/core/index.js +19 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +122 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.js +99 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +929 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +65 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +65 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +843 -0
- package/node_modules/zod/v4/core/json-schema.cjs +21 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +89 -0
- package/node_modules/zod/v4/core/json-schema.d.ts +89 -0
- package/node_modules/zod/v4/core/json-schema.js +1 -0
- package/node_modules/zod/v4/core/memoizer.cjs +360 -0
- package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
- package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
- package/node_modules/zod/v4/core/memoizer.js +311 -0
- package/node_modules/zod/v4/core/package.json +7 -0
- package/node_modules/zod/v4/core/parse.cjs +233 -0
- package/node_modules/zod/v4/core/parse.d.cts +52 -0
- package/node_modules/zod/v4/core/parse.d.ts +52 -0
- package/node_modules/zod/v4/core/parse.js +175 -0
- package/node_modules/zod/v4/core/regexes.cjs +209 -0
- package/node_modules/zod/v4/core/regexes.d.cts +90 -0
- package/node_modules/zod/v4/core/regexes.d.ts +90 -0
- package/node_modules/zod/v4/core/regexes.js +156 -0
- package/node_modules/zod/v4/core/registries.cjs +75 -0
- package/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/node_modules/zod/v4/core/registries.js +51 -0
- package/node_modules/zod/v4/core/schemas.cjs +2699 -0
- package/node_modules/zod/v4/core/schemas.d.cts +1275 -0
- package/node_modules/zod/v4/core/schemas.d.ts +1275 -0
- package/node_modules/zod/v4/core/schemas.js +2636 -0
- package/node_modules/zod/v4/core/standard-schema.cjs +21 -0
- package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
- package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
- package/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +681 -0
- package/node_modules/zod/v4/core/to-json-schema.d.cts +154 -0
- package/node_modules/zod/v4/core/to-json-schema.d.ts +154 -0
- package/node_modules/zod/v4/core/to-json-schema.js +651 -0
- package/node_modules/zod/v4/core/util.cjs +964 -0
- package/node_modules/zod/v4/core/util.d.cts +280 -0
- package/node_modules/zod/v4/core/util.d.ts +280 -0
- package/node_modules/zod/v4/core/util.js +873 -0
- package/node_modules/zod/v4/core/versions.cjs +27 -0
- package/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/node_modules/zod/v4/core/versions.js +5 -0
- package/node_modules/zod/v4/core/visit.cjs +214 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +51 -0
- package/node_modules/zod/v4/index.d.cts +3 -0
- package/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/zod/v4/index.js +4 -0
- package/node_modules/zod/v4/locales/ar.cjs +138 -0
- package/node_modules/zod/v4/locales/ar.d.cts +5 -0
- package/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/node_modules/zod/v4/locales/ar.js +111 -0
- package/node_modules/zod/v4/locales/az.cjs +137 -0
- package/node_modules/zod/v4/locales/az.d.cts +5 -0
- package/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/node_modules/zod/v4/locales/az.js +110 -0
- package/node_modules/zod/v4/locales/be.cjs +195 -0
- package/node_modules/zod/v4/locales/be.d.cts +5 -0
- package/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/node_modules/zod/v4/locales/be.js +168 -0
- package/node_modules/zod/v4/locales/bg.cjs +152 -0
- package/node_modules/zod/v4/locales/bg.d.cts +5 -0
- package/node_modules/zod/v4/locales/bg.d.ts +4 -0
- package/node_modules/zod/v4/locales/bg.js +125 -0
- package/node_modules/zod/v4/locales/bn.cjs +140 -0
- package/node_modules/zod/v4/locales/bn.d.cts +5 -0
- package/node_modules/zod/v4/locales/bn.d.ts +4 -0
- package/node_modules/zod/v4/locales/bn.js +113 -0
- package/node_modules/zod/v4/locales/ca.cjs +139 -0
- package/node_modules/zod/v4/locales/ca.d.cts +5 -0
- package/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/node_modules/zod/v4/locales/ca.js +112 -0
- package/node_modules/zod/v4/locales/ckb.cjs +160 -0
- package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
- package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
- package/node_modules/zod/v4/locales/ckb.js +133 -0
- package/node_modules/zod/v4/locales/cs.cjs +143 -0
- package/node_modules/zod/v4/locales/cs.d.cts +5 -0
- package/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/node_modules/zod/v4/locales/cs.js +116 -0
- package/node_modules/zod/v4/locales/da.cjs +147 -0
- package/node_modules/zod/v4/locales/da.d.cts +5 -0
- package/node_modules/zod/v4/locales/da.d.ts +4 -0
- package/node_modules/zod/v4/locales/da.js +120 -0
- package/node_modules/zod/v4/locales/de.cjs +140 -0
- package/node_modules/zod/v4/locales/de.d.cts +5 -0
- package/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/node_modules/zod/v4/locales/de.js +113 -0
- package/node_modules/zod/v4/locales/el.cjs +139 -0
- package/node_modules/zod/v4/locales/el.d.cts +5 -0
- package/node_modules/zod/v4/locales/el.d.ts +4 -0
- package/node_modules/zod/v4/locales/el.js +112 -0
- package/node_modules/zod/v4/locales/en.cjs +152 -0
- package/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/node_modules/zod/v4/locales/en.d.ts +4 -0
- package/node_modules/zod/v4/locales/en.js +125 -0
- package/node_modules/zod/v4/locales/eo.cjs +141 -0
- package/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/node_modules/zod/v4/locales/eo.d.ts +4 -0
- package/node_modules/zod/v4/locales/eo.js +114 -0
- package/node_modules/zod/v4/locales/es.cjs +163 -0
- package/node_modules/zod/v4/locales/es.d.cts +5 -0
- package/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/node_modules/zod/v4/locales/es.js +136 -0
- package/node_modules/zod/v4/locales/fa.cjs +146 -0
- package/node_modules/zod/v4/locales/fa.d.cts +5 -0
- package/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/node_modules/zod/v4/locales/fa.js +119 -0
- package/node_modules/zod/v4/locales/fi.cjs +144 -0
- package/node_modules/zod/v4/locales/fi.d.cts +5 -0
- package/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/node_modules/zod/v4/locales/fi.js +117 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +139 -0
- package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.js +112 -0
- package/node_modules/zod/v4/locales/fr.cjs +156 -0
- package/node_modules/zod/v4/locales/fr.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr.js +129 -0
- package/node_modules/zod/v4/locales/gu.cjs +140 -0
- package/node_modules/zod/v4/locales/gu.d.cts +5 -0
- package/node_modules/zod/v4/locales/gu.d.ts +4 -0
- package/node_modules/zod/v4/locales/gu.js +113 -0
- package/node_modules/zod/v4/locales/he.cjs +248 -0
- package/node_modules/zod/v4/locales/he.d.cts +5 -0
- package/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/node_modules/zod/v4/locales/he.js +221 -0
- package/node_modules/zod/v4/locales/hi.cjs +138 -0
- package/node_modules/zod/v4/locales/hi.d.cts +5 -0
- package/node_modules/zod/v4/locales/hi.d.ts +4 -0
- package/node_modules/zod/v4/locales/hi.js +111 -0
- package/node_modules/zod/v4/locales/hr.cjs +153 -0
- package/node_modules/zod/v4/locales/hr.d.cts +5 -0
- package/node_modules/zod/v4/locales/hr.d.ts +4 -0
- package/node_modules/zod/v4/locales/hr.js +126 -0
- package/node_modules/zod/v4/locales/hu.cjs +140 -0
- package/node_modules/zod/v4/locales/hu.d.cts +5 -0
- package/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/node_modules/zod/v4/locales/hu.js +113 -0
- package/node_modules/zod/v4/locales/hy.cjs +185 -0
- package/node_modules/zod/v4/locales/hy.d.cts +5 -0
- package/node_modules/zod/v4/locales/hy.d.ts +4 -0
- package/node_modules/zod/v4/locales/hy.js +158 -0
- package/node_modules/zod/v4/locales/id.cjs +138 -0
- package/node_modules/zod/v4/locales/id.d.cts +5 -0
- package/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/node_modules/zod/v4/locales/id.js +111 -0
- package/node_modules/zod/v4/locales/index.cjs +152 -0
- package/node_modules/zod/v4/locales/index.d.cts +63 -0
- package/node_modules/zod/v4/locales/index.d.ts +63 -0
- package/node_modules/zod/v4/locales/index.js +63 -0
- package/node_modules/zod/v4/locales/is.cjs +141 -0
- package/node_modules/zod/v4/locales/is.d.cts +5 -0
- package/node_modules/zod/v4/locales/is.d.ts +4 -0
- package/node_modules/zod/v4/locales/is.js +114 -0
- package/node_modules/zod/v4/locales/it.cjs +140 -0
- package/node_modules/zod/v4/locales/it.d.cts +5 -0
- package/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/node_modules/zod/v4/locales/it.js +113 -0
- package/node_modules/zod/v4/locales/ja.cjs +139 -0
- package/node_modules/zod/v4/locales/ja.d.cts +5 -0
- package/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/node_modules/zod/v4/locales/ja.js +112 -0
- package/node_modules/zod/v4/locales/ka.cjs +144 -0
- package/node_modules/zod/v4/locales/ka.d.cts +5 -0
- package/node_modules/zod/v4/locales/ka.d.ts +4 -0
- package/node_modules/zod/v4/locales/ka.js +117 -0
- package/node_modules/zod/v4/locales/kh.cjs +12 -0
- package/node_modules/zod/v4/locales/kh.d.cts +5 -0
- package/node_modules/zod/v4/locales/kh.d.ts +5 -0
- package/node_modules/zod/v4/locales/kh.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +142 -0
- package/node_modules/zod/v4/locales/km.d.cts +5 -0
- package/node_modules/zod/v4/locales/km.d.ts +4 -0
- package/node_modules/zod/v4/locales/km.js +115 -0
- package/node_modules/zod/v4/locales/kn.cjs +143 -0
- package/node_modules/zod/v4/locales/kn.d.cts +5 -0
- package/node_modules/zod/v4/locales/kn.d.ts +4 -0
- package/node_modules/zod/v4/locales/kn.js +116 -0
- package/node_modules/zod/v4/locales/ko.cjs +143 -0
- package/node_modules/zod/v4/locales/ko.d.cts +5 -0
- package/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/node_modules/zod/v4/locales/ko.js +116 -0
- package/node_modules/zod/v4/locales/lt.cjs +234 -0
- package/node_modules/zod/v4/locales/lt.d.cts +5 -0
- package/node_modules/zod/v4/locales/lt.d.ts +4 -0
- package/node_modules/zod/v4/locales/lt.js +207 -0
- package/node_modules/zod/v4/locales/mk.cjs +141 -0
- package/node_modules/zod/v4/locales/mk.d.cts +5 -0
- package/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/node_modules/zod/v4/locales/mk.js +114 -0
- package/node_modules/zod/v4/locales/ms.cjs +139 -0
- package/node_modules/zod/v4/locales/ms.d.cts +5 -0
- package/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/node_modules/zod/v4/locales/ms.js +112 -0
- package/node_modules/zod/v4/locales/ne.cjs +138 -0
- package/node_modules/zod/v4/locales/ne.d.cts +5 -0
- package/node_modules/zod/v4/locales/ne.d.ts +4 -0
- package/node_modules/zod/v4/locales/ne.js +111 -0
- package/node_modules/zod/v4/locales/nl.cjs +142 -0
- package/node_modules/zod/v4/locales/nl.d.cts +5 -0
- package/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/node_modules/zod/v4/locales/nl.js +115 -0
- package/node_modules/zod/v4/locales/nn.cjs +140 -0
- package/node_modules/zod/v4/locales/nn.d.cts +5 -0
- package/node_modules/zod/v4/locales/nn.d.ts +4 -0
- package/node_modules/zod/v4/locales/nn.js +113 -0
- package/node_modules/zod/v4/locales/no.cjs +140 -0
- package/node_modules/zod/v4/locales/no.d.cts +5 -0
- package/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/node_modules/zod/v4/locales/no.js +113 -0
- package/node_modules/zod/v4/locales/ota.cjs +141 -0
- package/node_modules/zod/v4/locales/ota.d.cts +5 -0
- package/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/node_modules/zod/v4/locales/ota.js +114 -0
- package/node_modules/zod/v4/locales/package.json +7 -0
- package/node_modules/zod/v4/locales/pl.cjs +141 -0
- package/node_modules/zod/v4/locales/pl.d.cts +5 -0
- package/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/node_modules/zod/v4/locales/pl.js +114 -0
- package/node_modules/zod/v4/locales/ps.cjs +146 -0
- package/node_modules/zod/v4/locales/ps.d.cts +5 -0
- package/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/node_modules/zod/v4/locales/ps.js +119 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
- package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt-BR.js +143 -0
- package/node_modules/zod/v4/locales/pt.cjs +169 -0
- package/node_modules/zod/v4/locales/pt.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt.js +142 -0
- package/node_modules/zod/v4/locales/ro.cjs +149 -0
- package/node_modules/zod/v4/locales/ro.d.cts +5 -0
- package/node_modules/zod/v4/locales/ro.d.ts +4 -0
- package/node_modules/zod/v4/locales/ro.js +122 -0
- package/node_modules/zod/v4/locales/ru.cjs +195 -0
- package/node_modules/zod/v4/locales/ru.d.cts +5 -0
- package/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/node_modules/zod/v4/locales/ru.js +168 -0
- package/node_modules/zod/v4/locales/sk.cjs +143 -0
- package/node_modules/zod/v4/locales/sk.d.cts +5 -0
- package/node_modules/zod/v4/locales/sk.d.ts +4 -0
- package/node_modules/zod/v4/locales/sk.js +116 -0
- package/node_modules/zod/v4/locales/sl.cjs +141 -0
- package/node_modules/zod/v4/locales/sl.d.cts +5 -0
- package/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/node_modules/zod/v4/locales/sl.js +114 -0
- package/node_modules/zod/v4/locales/sv.cjs +142 -0
- package/node_modules/zod/v4/locales/sv.d.cts +5 -0
- package/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/node_modules/zod/v4/locales/sv.js +115 -0
- package/node_modules/zod/v4/locales/ta.cjs +142 -0
- package/node_modules/zod/v4/locales/ta.d.cts +5 -0
- package/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/node_modules/zod/v4/locales/ta.js +115 -0
- package/node_modules/zod/v4/locales/tg.cjs +144 -0
- package/node_modules/zod/v4/locales/tg.d.cts +5 -0
- package/node_modules/zod/v4/locales/tg.d.ts +4 -0
- package/node_modules/zod/v4/locales/tg.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +142 -0
- package/node_modules/zod/v4/locales/th.d.cts +5 -0
- package/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/node_modules/zod/v4/locales/th.js +115 -0
- package/node_modules/zod/v4/locales/tk.cjs +134 -0
- package/node_modules/zod/v4/locales/tk.d.cts +5 -0
- package/node_modules/zod/v4/locales/tk.d.ts +4 -0
- package/node_modules/zod/v4/locales/tk.js +107 -0
- package/node_modules/zod/v4/locales/tr.cjs +137 -0
- package/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/node_modules/zod/v4/locales/tr.d.ts +4 -0
- package/node_modules/zod/v4/locales/tr.js +110 -0
- package/node_modules/zod/v4/locales/ua.cjs +12 -0
- package/node_modules/zod/v4/locales/ua.d.cts +5 -0
- package/node_modules/zod/v4/locales/ua.d.ts +5 -0
- package/node_modules/zod/v4/locales/ua.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +140 -0
- package/node_modules/zod/v4/locales/uk.d.cts +5 -0
- package/node_modules/zod/v4/locales/uk.d.ts +4 -0
- package/node_modules/zod/v4/locales/uk.js +113 -0
- package/node_modules/zod/v4/locales/ur.cjs +142 -0
- package/node_modules/zod/v4/locales/ur.d.cts +5 -0
- package/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/node_modules/zod/v4/locales/ur.js +115 -0
- package/node_modules/zod/v4/locales/uz.cjs +140 -0
- package/node_modules/zod/v4/locales/uz.d.cts +5 -0
- package/node_modules/zod/v4/locales/uz.d.ts +4 -0
- package/node_modules/zod/v4/locales/uz.js +113 -0
- package/node_modules/zod/v4/locales/vi.cjs +140 -0
- package/node_modules/zod/v4/locales/vi.d.cts +5 -0
- package/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/node_modules/zod/v4/locales/vi.js +113 -0
- package/node_modules/zod/v4/locales/yo.cjs +139 -0
- package/node_modules/zod/v4/locales/yo.d.cts +5 -0
- package/node_modules/zod/v4/locales/yo.d.ts +4 -0
- package/node_modules/zod/v4/locales/yo.js +112 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +141 -0
- package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.js +114 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +139 -0
- package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.js +112 -0
- package/node_modules/zod/v4/mini/checks.cjs +54 -0
- package/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/node_modules/zod/v4/mini/checks.js +1 -0
- package/node_modules/zod/v4/mini/coerce.cjs +71 -0
- package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/node_modules/zod/v4/mini/coerce.js +22 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/node_modules/zod/v4/mini/external.cjs +95 -0
- package/node_modules/zod/v4/mini/external.d.cts +16 -0
- package/node_modules/zod/v4/mini/external.d.ts +16 -0
- package/node_modules/zod/v4/mini/external.js +16 -0
- package/node_modules/zod/v4/mini/in-out.cjs +82 -0
- package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
- package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
- package/node_modules/zod/v4/mini/in-out.js +36 -0
- package/node_modules/zod/v4/mini/index.cjs +51 -0
- package/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/node_modules/zod/v4/mini/index.js +3 -0
- package/node_modules/zod/v4/mini/iso.cjs +83 -0
- package/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/node_modules/zod/v4/mini/iso.js +34 -0
- package/node_modules/zod/v4/mini/package.json +7 -0
- package/node_modules/zod/v4/mini/parse.cjs +37 -0
- package/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/node_modules/zod/v4/mini/parse.js +1 -0
- package/node_modules/zod/v4/mini/schemas.cjs +1147 -0
- package/node_modules/zod/v4/mini/schemas.d.cts +480 -0
- package/node_modules/zod/v4/mini/schemas.d.ts +480 -0
- package/node_modules/zod/v4/mini/schemas.js +1002 -0
- package/node_modules/zod/v4/package.json +7 -0
- package/node_modules/zod/v4-mini/index.cjs +51 -0
- package/node_modules/zod/v4-mini/index.d.cts +3 -0
- package/node_modules/zod/v4-mini/index.d.ts +3 -0
- package/node_modules/zod/v4-mini/index.js +3 -0
- package/node_modules/zod/v4-mini/package.json +7 -0
- package/package.json +66 -4
|
@@ -0,0 +1,1733 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module LRUCache
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LRUCache = void 0;
|
|
7
|
+
const diagnostics_channel_js_1 = require("./diagnostics-channel.js");
|
|
8
|
+
const perf_js_1 = require("./perf.js");
|
|
9
|
+
const hasSubscribers = () => diagnostics_channel_js_1.metrics.hasSubscribers || diagnostics_channel_js_1.tracing.hasSubscribers;
|
|
10
|
+
const warned = new Set();
|
|
11
|
+
/* c8 ignore start */
|
|
12
|
+
const PROCESS = (typeof process === 'object' && !!process ?
|
|
13
|
+
process
|
|
14
|
+
: {});
|
|
15
|
+
/* c8 ignore stop */
|
|
16
|
+
const emitWarning = (msg, type, code, fn) => {
|
|
17
|
+
if (typeof PROCESS.emitWarning === 'function') {
|
|
18
|
+
PROCESS.emitWarning(msg, type, code, fn);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
//oxlint-disable-next-line no-console
|
|
22
|
+
console.error(`[${code}] ${type}: ${msg}`);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const shouldWarn = (code) => !warned.has(code);
|
|
26
|
+
const TYPE = Symbol('type');
|
|
27
|
+
const isPosInt = (n) => !!n && n === Math.floor(n) && n > 0 && isFinite(n);
|
|
28
|
+
// This is a little bit ridiculous, tbh.
|
|
29
|
+
// The maximum array length is 2^32-1 or thereabouts on most JS impls.
|
|
30
|
+
// And well before that point, you're caching the entire world, I mean,
|
|
31
|
+
// that's ~32GB of just integers for the next/prev links, plus whatever
|
|
32
|
+
// else to hold that many keys and values. Just filling the memory with
|
|
33
|
+
// zeroes at init time is brutal when you get that big.
|
|
34
|
+
// But why not be complete?
|
|
35
|
+
// Maybe in the future, these limits will have expanded.
|
|
36
|
+
/* c8 ignore start */
|
|
37
|
+
const getUintArray = (max) => !isPosInt(max) ? null
|
|
38
|
+
: max <= Math.pow(2, 8) ? Uint8Array
|
|
39
|
+
: max <= Math.pow(2, 16) ? Uint16Array
|
|
40
|
+
: max <= Math.pow(2, 32) ? Uint32Array
|
|
41
|
+
: max <= Number.MAX_SAFE_INTEGER ? ZeroArray
|
|
42
|
+
: null;
|
|
43
|
+
/* c8 ignore stop */
|
|
44
|
+
class ZeroArray extends Array {
|
|
45
|
+
constructor(size) {
|
|
46
|
+
super(size);
|
|
47
|
+
this.fill(0);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
class Stack {
|
|
51
|
+
/* c8 ignore start - not sure why this is showing up uncovered?? */
|
|
52
|
+
heap;
|
|
53
|
+
/* c8 ignore stop */
|
|
54
|
+
length;
|
|
55
|
+
// private constructor
|
|
56
|
+
static #constructing = false;
|
|
57
|
+
static create(max) {
|
|
58
|
+
const HeapCls = getUintArray(max);
|
|
59
|
+
if (!HeapCls)
|
|
60
|
+
return [];
|
|
61
|
+
Stack.#constructing = true;
|
|
62
|
+
const s = new Stack(max, HeapCls);
|
|
63
|
+
Stack.#constructing = false;
|
|
64
|
+
return s;
|
|
65
|
+
}
|
|
66
|
+
constructor(max, HeapCls) {
|
|
67
|
+
/* c8 ignore start */
|
|
68
|
+
if (!Stack.#constructing) {
|
|
69
|
+
throw new TypeError('instantiate Stack using Stack.create(n)');
|
|
70
|
+
}
|
|
71
|
+
/* c8 ignore stop */
|
|
72
|
+
this.heap = new HeapCls(max);
|
|
73
|
+
this.length = 0;
|
|
74
|
+
}
|
|
75
|
+
push(n) {
|
|
76
|
+
this.heap[this.length++] = n;
|
|
77
|
+
}
|
|
78
|
+
pop() {
|
|
79
|
+
return this.heap[--this.length];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Default export, the thing you're using this module to get.
|
|
84
|
+
*
|
|
85
|
+
* The `K` and `V` types define the key and value types, respectively. The
|
|
86
|
+
* optional `FC` type defines the type of the `context` object passed to
|
|
87
|
+
* `cache.fetch()` and `cache.memo()`.
|
|
88
|
+
*
|
|
89
|
+
* Keys and values **must not** be `null` or `undefined`.
|
|
90
|
+
*
|
|
91
|
+
* All properties from the options object (with the exception of `max`,
|
|
92
|
+
* `maxSize`, `fetchMethod`, `memoMethod`, `dispose` and `disposeAfter`) are
|
|
93
|
+
* added as normal public members. (The listed options are read-only getters.)
|
|
94
|
+
*
|
|
95
|
+
* Changing any of these will alter the defaults for subsequent method calls.
|
|
96
|
+
*/
|
|
97
|
+
class LRUCache {
|
|
98
|
+
// options that cannot be changed without disaster
|
|
99
|
+
#max;
|
|
100
|
+
#maxSize;
|
|
101
|
+
#dispose;
|
|
102
|
+
#onInsert;
|
|
103
|
+
#disposeAfter;
|
|
104
|
+
#fetchMethod;
|
|
105
|
+
#memoMethod;
|
|
106
|
+
#perf;
|
|
107
|
+
/**
|
|
108
|
+
* {@link LRUCache.OptionsBase.perf}
|
|
109
|
+
*/
|
|
110
|
+
get perf() {
|
|
111
|
+
return this.#perf;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* {@link LRUCache.OptionsBase.ttl}
|
|
115
|
+
*/
|
|
116
|
+
ttl;
|
|
117
|
+
/**
|
|
118
|
+
* {@link LRUCache.OptionsBase.ttlResolution}
|
|
119
|
+
*/
|
|
120
|
+
ttlResolution;
|
|
121
|
+
/**
|
|
122
|
+
* {@link LRUCache.OptionsBase.ttlAutopurge}
|
|
123
|
+
*/
|
|
124
|
+
ttlAutopurge;
|
|
125
|
+
/**
|
|
126
|
+
* {@link LRUCache.OptionsBase.updateAgeOnGet}
|
|
127
|
+
*/
|
|
128
|
+
updateAgeOnGet;
|
|
129
|
+
/**
|
|
130
|
+
* {@link LRUCache.OptionsBase.updateAgeOnHas}
|
|
131
|
+
*/
|
|
132
|
+
updateAgeOnHas;
|
|
133
|
+
/**
|
|
134
|
+
* {@link LRUCache.OptionsBase.allowStale}
|
|
135
|
+
*/
|
|
136
|
+
allowStale;
|
|
137
|
+
/**
|
|
138
|
+
* {@link LRUCache.OptionsBase.noDisposeOnSet}
|
|
139
|
+
*/
|
|
140
|
+
noDisposeOnSet;
|
|
141
|
+
/**
|
|
142
|
+
* {@link LRUCache.OptionsBase.noUpdateTTL}
|
|
143
|
+
*/
|
|
144
|
+
noUpdateTTL;
|
|
145
|
+
/**
|
|
146
|
+
* {@link LRUCache.OptionsBase.maxEntrySize}
|
|
147
|
+
*/
|
|
148
|
+
maxEntrySize;
|
|
149
|
+
/**
|
|
150
|
+
* {@link LRUCache.OptionsBase.sizeCalculation}
|
|
151
|
+
*/
|
|
152
|
+
sizeCalculation;
|
|
153
|
+
/**
|
|
154
|
+
* {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
|
|
155
|
+
*/
|
|
156
|
+
noDeleteOnFetchRejection;
|
|
157
|
+
/**
|
|
158
|
+
* {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
|
|
159
|
+
*/
|
|
160
|
+
noDeleteOnStaleGet;
|
|
161
|
+
/**
|
|
162
|
+
* {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
|
|
163
|
+
*/
|
|
164
|
+
allowStaleOnFetchAbort;
|
|
165
|
+
/**
|
|
166
|
+
* {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
|
|
167
|
+
*/
|
|
168
|
+
allowStaleOnFetchRejection;
|
|
169
|
+
/**
|
|
170
|
+
* {@link LRUCache.OptionsBase.ignoreFetchAbort}
|
|
171
|
+
*/
|
|
172
|
+
ignoreFetchAbort;
|
|
173
|
+
/** {@link LRUCache.OptionsBase.backgroundFetchSize} */
|
|
174
|
+
backgroundFetchSize;
|
|
175
|
+
// computed properties
|
|
176
|
+
#size;
|
|
177
|
+
#calculatedSize;
|
|
178
|
+
#keyMap;
|
|
179
|
+
#keyList;
|
|
180
|
+
#valList;
|
|
181
|
+
#next;
|
|
182
|
+
#prev;
|
|
183
|
+
#head;
|
|
184
|
+
#tail;
|
|
185
|
+
#free;
|
|
186
|
+
#disposed;
|
|
187
|
+
#sizes;
|
|
188
|
+
#starts;
|
|
189
|
+
#ttls;
|
|
190
|
+
#autopurgeTimers;
|
|
191
|
+
#hasDispose;
|
|
192
|
+
#hasFetchMethod;
|
|
193
|
+
#hasDisposeAfter;
|
|
194
|
+
#hasOnInsert;
|
|
195
|
+
/**
|
|
196
|
+
* Do not call this method unless you need to inspect the
|
|
197
|
+
* inner workings of the cache. If anything returned by this
|
|
198
|
+
* object is modified in any way, strange breakage may occur.
|
|
199
|
+
*
|
|
200
|
+
* These fields are private for a reason!
|
|
201
|
+
*
|
|
202
|
+
* @internal
|
|
203
|
+
*/
|
|
204
|
+
static unsafeExposeInternals(c) {
|
|
205
|
+
return {
|
|
206
|
+
// properties
|
|
207
|
+
starts: c.#starts,
|
|
208
|
+
ttls: c.#ttls,
|
|
209
|
+
autopurgeTimers: c.#autopurgeTimers,
|
|
210
|
+
sizes: c.#sizes,
|
|
211
|
+
keyMap: c.#keyMap,
|
|
212
|
+
keyList: c.#keyList,
|
|
213
|
+
valList: c.#valList,
|
|
214
|
+
next: c.#next,
|
|
215
|
+
prev: c.#prev,
|
|
216
|
+
get head() {
|
|
217
|
+
return c.#head;
|
|
218
|
+
},
|
|
219
|
+
get tail() {
|
|
220
|
+
return c.#tail;
|
|
221
|
+
},
|
|
222
|
+
free: c.#free,
|
|
223
|
+
// methods
|
|
224
|
+
isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
|
|
225
|
+
backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
|
|
226
|
+
moveToTail: (index) => c.#moveToTail(index),
|
|
227
|
+
indexes: (options) => c.#indexes(options),
|
|
228
|
+
rindexes: (options) => c.#rindexes(options),
|
|
229
|
+
isStale: (index) => c.#isStale(index),
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
// Protected read-only members
|
|
233
|
+
/**
|
|
234
|
+
* {@link LRUCache.OptionsBase.max} (read-only)
|
|
235
|
+
*/
|
|
236
|
+
get max() {
|
|
237
|
+
return this.#max;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* {@link LRUCache.OptionsBase.maxSize} (read-only)
|
|
241
|
+
*/
|
|
242
|
+
get maxSize() {
|
|
243
|
+
return this.#maxSize;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The total computed size of items in the cache (read-only)
|
|
247
|
+
*/
|
|
248
|
+
get calculatedSize() {
|
|
249
|
+
return this.#calculatedSize;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The number of items stored in the cache (read-only)
|
|
253
|
+
*/
|
|
254
|
+
get size() {
|
|
255
|
+
return this.#size;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* {@link LRUCache.OptionsBase.fetchMethod} (read-only)
|
|
259
|
+
*/
|
|
260
|
+
get fetchMethod() {
|
|
261
|
+
return this.#fetchMethod;
|
|
262
|
+
}
|
|
263
|
+
get memoMethod() {
|
|
264
|
+
return this.#memoMethod;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* {@link LRUCache.OptionsBase.dispose} (read-only)
|
|
268
|
+
*/
|
|
269
|
+
get dispose() {
|
|
270
|
+
return this.#dispose;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* {@link LRUCache.OptionsBase.onInsert} (read-only)
|
|
274
|
+
*/
|
|
275
|
+
get onInsert() {
|
|
276
|
+
return this.#onInsert;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* {@link LRUCache.OptionsBase.disposeAfter} (read-only)
|
|
280
|
+
*/
|
|
281
|
+
get disposeAfter() {
|
|
282
|
+
return this.#disposeAfter;
|
|
283
|
+
}
|
|
284
|
+
constructor(options) {
|
|
285
|
+
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, onInsert, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, backgroundFetchSize = 1, perf, } = options;
|
|
286
|
+
this.backgroundFetchSize = backgroundFetchSize;
|
|
287
|
+
if (perf !== undefined) {
|
|
288
|
+
if (typeof perf?.now !== 'function') {
|
|
289
|
+
throw new TypeError('perf option must have a now() method if specified');
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
this.#perf = perf ?? perf_js_1.defaultPerf;
|
|
293
|
+
if (max !== 0 && !isPosInt(max)) {
|
|
294
|
+
throw new TypeError('max option must be a nonnegative integer');
|
|
295
|
+
}
|
|
296
|
+
const UintArray = max ? getUintArray(max) : Array;
|
|
297
|
+
if (!UintArray) {
|
|
298
|
+
throw new Error('invalid max value: ' + max);
|
|
299
|
+
}
|
|
300
|
+
this.#max = max;
|
|
301
|
+
this.#maxSize = maxSize;
|
|
302
|
+
this.maxEntrySize = maxEntrySize || this.#maxSize;
|
|
303
|
+
this.sizeCalculation = sizeCalculation;
|
|
304
|
+
if (this.sizeCalculation) {
|
|
305
|
+
if (!this.#maxSize && !this.maxEntrySize) {
|
|
306
|
+
throw new TypeError('cannot set sizeCalculation without setting maxSize or maxEntrySize');
|
|
307
|
+
}
|
|
308
|
+
if (typeof this.sizeCalculation !== 'function') {
|
|
309
|
+
throw new TypeError('sizeCalculation set to non-function');
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (memoMethod !== undefined && typeof memoMethod !== 'function') {
|
|
313
|
+
throw new TypeError('memoMethod must be a function if defined');
|
|
314
|
+
}
|
|
315
|
+
this.#memoMethod = memoMethod;
|
|
316
|
+
if (fetchMethod !== undefined && typeof fetchMethod !== 'function') {
|
|
317
|
+
throw new TypeError('fetchMethod must be a function if specified');
|
|
318
|
+
}
|
|
319
|
+
this.#fetchMethod = fetchMethod;
|
|
320
|
+
this.#hasFetchMethod = !!fetchMethod;
|
|
321
|
+
this.#keyMap = new Map();
|
|
322
|
+
this.#keyList = Array.from({ length: max }).fill(undefined);
|
|
323
|
+
this.#valList = Array.from({ length: max }).fill(undefined);
|
|
324
|
+
this.#next = new UintArray(max);
|
|
325
|
+
this.#prev = new UintArray(max);
|
|
326
|
+
this.#head = 0;
|
|
327
|
+
this.#tail = 0;
|
|
328
|
+
this.#free = Stack.create(max);
|
|
329
|
+
this.#size = 0;
|
|
330
|
+
this.#calculatedSize = 0;
|
|
331
|
+
if (typeof dispose === 'function') {
|
|
332
|
+
this.#dispose = dispose;
|
|
333
|
+
}
|
|
334
|
+
if (typeof onInsert === 'function') {
|
|
335
|
+
this.#onInsert = onInsert;
|
|
336
|
+
}
|
|
337
|
+
if (typeof disposeAfter === 'function') {
|
|
338
|
+
this.#disposeAfter = disposeAfter;
|
|
339
|
+
this.#disposed = [];
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
this.#disposeAfter = undefined;
|
|
343
|
+
this.#disposed = undefined;
|
|
344
|
+
}
|
|
345
|
+
this.#hasDispose = !!this.#dispose;
|
|
346
|
+
this.#hasOnInsert = !!this.#onInsert;
|
|
347
|
+
this.#hasDisposeAfter = !!this.#disposeAfter;
|
|
348
|
+
this.noDisposeOnSet = !!noDisposeOnSet;
|
|
349
|
+
this.noUpdateTTL = !!noUpdateTTL;
|
|
350
|
+
this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
|
|
351
|
+
this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
|
|
352
|
+
this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
|
|
353
|
+
this.ignoreFetchAbort = !!ignoreFetchAbort;
|
|
354
|
+
// NB: maxEntrySize is set to maxSize if it's set
|
|
355
|
+
if (this.maxEntrySize !== 0) {
|
|
356
|
+
if (this.#maxSize !== 0) {
|
|
357
|
+
if (!isPosInt(this.#maxSize)) {
|
|
358
|
+
throw new TypeError('maxSize must be a positive integer if specified');
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (!isPosInt(this.maxEntrySize)) {
|
|
362
|
+
throw new TypeError('maxEntrySize must be a positive integer if specified');
|
|
363
|
+
}
|
|
364
|
+
this.#initializeSizeTracking();
|
|
365
|
+
}
|
|
366
|
+
this.allowStale = !!allowStale;
|
|
367
|
+
this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
|
|
368
|
+
this.updateAgeOnGet = !!updateAgeOnGet;
|
|
369
|
+
this.updateAgeOnHas = !!updateAgeOnHas;
|
|
370
|
+
this.ttlResolution =
|
|
371
|
+
isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
|
|
372
|
+
this.ttlAutopurge = !!ttlAutopurge;
|
|
373
|
+
this.ttl = ttl || 0;
|
|
374
|
+
if (this.ttl) {
|
|
375
|
+
if (!isPosInt(this.ttl)) {
|
|
376
|
+
throw new TypeError('ttl must be a positive integer if specified');
|
|
377
|
+
}
|
|
378
|
+
this.#initializeTTLTracking();
|
|
379
|
+
}
|
|
380
|
+
// do not allow completely unbounded caches
|
|
381
|
+
if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
|
|
382
|
+
throw new TypeError('At least one of max, maxSize, or ttl is required');
|
|
383
|
+
}
|
|
384
|
+
if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
|
|
385
|
+
const code = 'LRU_CACHE_UNBOUNDED';
|
|
386
|
+
if (shouldWarn(code)) {
|
|
387
|
+
warned.add(code);
|
|
388
|
+
const msg = 'TTL caching without ttlAutopurge, max, or maxSize can ' +
|
|
389
|
+
'result in unbounded memory consumption.';
|
|
390
|
+
emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Return the number of ms left in the item's TTL. If item is not in cache,
|
|
396
|
+
* returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
|
|
397
|
+
*/
|
|
398
|
+
getRemainingTTL(key) {
|
|
399
|
+
return this.#keyMap.has(key) ? Infinity : 0;
|
|
400
|
+
}
|
|
401
|
+
#initializeTTLTracking() {
|
|
402
|
+
const ttls = new ZeroArray(this.#max);
|
|
403
|
+
const starts = new ZeroArray(this.#max);
|
|
404
|
+
this.#ttls = ttls;
|
|
405
|
+
this.#starts = starts;
|
|
406
|
+
const purgeTimers = this.ttlAutopurge ?
|
|
407
|
+
Array.from({
|
|
408
|
+
length: this.#max,
|
|
409
|
+
})
|
|
410
|
+
: undefined;
|
|
411
|
+
this.#autopurgeTimers = purgeTimers;
|
|
412
|
+
this.#setItemTTL = (index, ttl, start = this.#perf.now()) => {
|
|
413
|
+
starts[index] = ttl !== 0 ? start : 0;
|
|
414
|
+
ttls[index] = ttl;
|
|
415
|
+
setPurgeTimer(index, ttl);
|
|
416
|
+
};
|
|
417
|
+
this.#updateItemAge = index => {
|
|
418
|
+
starts[index] = ttls[index] !== 0 ? this.#perf.now() : 0;
|
|
419
|
+
setPurgeTimer(index, ttls[index]);
|
|
420
|
+
};
|
|
421
|
+
// clear out the purge timer if we're setting TTL to 0, and
|
|
422
|
+
// previously had a ttl purge timer running, so it doesn't
|
|
423
|
+
// fire unnecessarily. Don't need to do this if we're not doing
|
|
424
|
+
// autopurge.
|
|
425
|
+
const setPurgeTimer = !this.ttlAutopurge ?
|
|
426
|
+
() => { }
|
|
427
|
+
: (index, ttl) => {
|
|
428
|
+
if (purgeTimers?.[index]) {
|
|
429
|
+
clearTimeout(purgeTimers[index]);
|
|
430
|
+
purgeTimers[index] = undefined;
|
|
431
|
+
}
|
|
432
|
+
if (ttl && ttl !== 0 && purgeTimers) {
|
|
433
|
+
const t = setTimeout(() => {
|
|
434
|
+
if (this.#isStale(index)) {
|
|
435
|
+
this.#delete(this.#keyList[index], 'expire');
|
|
436
|
+
purgeTimers[index] = undefined;
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
setPurgeTimer(index, getRemainingTTL(index));
|
|
440
|
+
}
|
|
441
|
+
}, ttl + 1);
|
|
442
|
+
// unref() not supported on all platforms
|
|
443
|
+
/* c8 ignore start */
|
|
444
|
+
if (t.unref) {
|
|
445
|
+
t.unref();
|
|
446
|
+
}
|
|
447
|
+
/* c8 ignore stop */
|
|
448
|
+
purgeTimers[index] = t;
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
this.#statusTTL = (status, index) => {
|
|
452
|
+
if (ttls[index]) {
|
|
453
|
+
const ttl = ttls[index];
|
|
454
|
+
const start = starts[index];
|
|
455
|
+
/* c8 ignore start */
|
|
456
|
+
if (!ttl || !start) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
/* c8 ignore stop */
|
|
460
|
+
status.ttl = ttl;
|
|
461
|
+
status.start = start;
|
|
462
|
+
status.now = cachedNow || getNow();
|
|
463
|
+
const age = status.now - start;
|
|
464
|
+
status.remainingTTL = ttl - age;
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
// debounce calls to perf.now() to 1s so we're not hitting
|
|
468
|
+
// that costly call repeatedly.
|
|
469
|
+
let cachedNow = 0;
|
|
470
|
+
const getNow = () => {
|
|
471
|
+
const n = this.#perf.now();
|
|
472
|
+
if (this.ttlResolution > 0) {
|
|
473
|
+
cachedNow = n;
|
|
474
|
+
const t = setTimeout(() => (cachedNow = 0), this.ttlResolution);
|
|
475
|
+
// not available on all platforms
|
|
476
|
+
/* c8 ignore start */
|
|
477
|
+
if (t.unref) {
|
|
478
|
+
t.unref();
|
|
479
|
+
}
|
|
480
|
+
/* c8 ignore stop */
|
|
481
|
+
}
|
|
482
|
+
return n;
|
|
483
|
+
};
|
|
484
|
+
this.getRemainingTTL = key => {
|
|
485
|
+
const index = this.#keyMap.get(key);
|
|
486
|
+
if (index === undefined) {
|
|
487
|
+
return 0;
|
|
488
|
+
}
|
|
489
|
+
return getRemainingTTL(index);
|
|
490
|
+
};
|
|
491
|
+
const getRemainingTTL = (index) => {
|
|
492
|
+
const ttl = ttls[index];
|
|
493
|
+
const start = starts[index];
|
|
494
|
+
if (!ttl || !start) {
|
|
495
|
+
return Infinity;
|
|
496
|
+
}
|
|
497
|
+
const age = (cachedNow || getNow()) - start;
|
|
498
|
+
return ttl - age;
|
|
499
|
+
};
|
|
500
|
+
this.#isStale = index => {
|
|
501
|
+
const s = starts[index];
|
|
502
|
+
const t = ttls[index];
|
|
503
|
+
return !!t && !!s && (cachedNow || getNow()) - s > t;
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
// conditionally set private methods related to TTL
|
|
507
|
+
#updateItemAge = () => { };
|
|
508
|
+
#statusTTL = () => { };
|
|
509
|
+
#setItemTTL = () => { };
|
|
510
|
+
/* c8 ignore stop */
|
|
511
|
+
#isStale = () => false;
|
|
512
|
+
#initializeSizeTracking() {
|
|
513
|
+
const sizes = new ZeroArray(this.#max);
|
|
514
|
+
this.#calculatedSize = 0;
|
|
515
|
+
this.#sizes = sizes;
|
|
516
|
+
this.#removeItemSize = index => {
|
|
517
|
+
this.#calculatedSize -= sizes[index];
|
|
518
|
+
sizes[index] = 0;
|
|
519
|
+
};
|
|
520
|
+
this.#requireSize = (k, v, size, sizeCalculation) => {
|
|
521
|
+
if (!isPosInt(size)) {
|
|
522
|
+
// provisionally accept background fetches.
|
|
523
|
+
// actual value size will be checked when they return.
|
|
524
|
+
if (this.#isBackgroundFetch(v)) {
|
|
525
|
+
// NB: this cannot occur if v.__staleWhileFetching is set,
|
|
526
|
+
// because in that case, it would take on the size of the
|
|
527
|
+
// existing entry that it temporarily replaces.
|
|
528
|
+
return this.backgroundFetchSize;
|
|
529
|
+
}
|
|
530
|
+
if (sizeCalculation) {
|
|
531
|
+
if (typeof sizeCalculation !== 'function') {
|
|
532
|
+
throw new TypeError('sizeCalculation must be a function');
|
|
533
|
+
}
|
|
534
|
+
size = sizeCalculation(v, k);
|
|
535
|
+
if (!isPosInt(size)) {
|
|
536
|
+
throw new TypeError('sizeCalculation return invalid (expect positive integer)');
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
else {
|
|
540
|
+
throw new TypeError('invalid size value (must be positive integer). ' +
|
|
541
|
+
'When maxSize or maxEntrySize is used, sizeCalculation ' +
|
|
542
|
+
'or size must be set.');
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
return size;
|
|
546
|
+
};
|
|
547
|
+
this.#addItemSize = (index, size, status) => {
|
|
548
|
+
sizes[index] = size;
|
|
549
|
+
if (this.#maxSize) {
|
|
550
|
+
const maxSize = this.#maxSize - sizes[index];
|
|
551
|
+
while (this.#calculatedSize > maxSize) {
|
|
552
|
+
this.#evict(true);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
this.#calculatedSize += sizes[index];
|
|
556
|
+
if (status) {
|
|
557
|
+
status.entrySize = size;
|
|
558
|
+
status.totalCalculatedSize = this.#calculatedSize;
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
#removeItemSize = _i => { };
|
|
563
|
+
#addItemSize = (_i, _s, _st) => { };
|
|
564
|
+
#requireSize = (_k, _v, size, sizeCalculation) => {
|
|
565
|
+
if (size || sizeCalculation) {
|
|
566
|
+
throw new TypeError('cannot set size without setting maxSize or maxEntrySize on cache');
|
|
567
|
+
}
|
|
568
|
+
return 0;
|
|
569
|
+
};
|
|
570
|
+
*#indexes({ allowStale = this.allowStale } = {}) {
|
|
571
|
+
if (this.#size) {
|
|
572
|
+
for (let i = this.#tail; this.#isValidIndex(i);) {
|
|
573
|
+
if (allowStale || !this.#isStale(i)) {
|
|
574
|
+
yield i;
|
|
575
|
+
}
|
|
576
|
+
if (i === this.#head) {
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
i = this.#prev[i];
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
*#rindexes({ allowStale = this.allowStale } = {}) {
|
|
586
|
+
if (this.#size) {
|
|
587
|
+
for (let i = this.#head; this.#isValidIndex(i);) {
|
|
588
|
+
if (allowStale || !this.#isStale(i)) {
|
|
589
|
+
yield i;
|
|
590
|
+
}
|
|
591
|
+
if (i === this.#tail) {
|
|
592
|
+
break;
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
i = this.#next[i];
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
#isValidIndex(index) {
|
|
601
|
+
return (index !== undefined &&
|
|
602
|
+
this.#keyMap.get(this.#keyList[index]) === index);
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Return a generator yielding `[key, value]` pairs,
|
|
606
|
+
* in order from most recently used to least recently used.
|
|
607
|
+
*/
|
|
608
|
+
*entries() {
|
|
609
|
+
for (const i of this.#indexes()) {
|
|
610
|
+
if (this.#valList[i] !== undefined &&
|
|
611
|
+
this.#keyList[i] !== undefined &&
|
|
612
|
+
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
613
|
+
yield [this.#keyList[i], this.#valList[i]];
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Inverse order version of {@link LRUCache.entries}
|
|
619
|
+
*
|
|
620
|
+
* Return a generator yielding `[key, value]` pairs,
|
|
621
|
+
* in order from least recently used to most recently used.
|
|
622
|
+
*/
|
|
623
|
+
*rentries() {
|
|
624
|
+
for (const i of this.#rindexes()) {
|
|
625
|
+
if (this.#valList[i] !== undefined &&
|
|
626
|
+
this.#keyList[i] !== undefined &&
|
|
627
|
+
!this.#isBackgroundFetch(this.#valList[i])) {
|
|
628
|
+
yield [this.#keyList[i], this.#valList[i]];
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Return a generator yielding the keys in the cache,
|
|
634
|
+
* in order from most recently used to least recently used.
|
|
635
|
+
*/
|
|
636
|
+
*keys() {
|
|
637
|
+
for (const i of this.#indexes()) {
|
|
638
|
+
const k = this.#keyList[i];
|
|
639
|
+
if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i])) {
|
|
640
|
+
yield k;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Inverse order version of {@link LRUCache.keys}
|
|
646
|
+
*
|
|
647
|
+
* Return a generator yielding the keys in the cache,
|
|
648
|
+
* in order from least recently used to most recently used.
|
|
649
|
+
*/
|
|
650
|
+
*rkeys() {
|
|
651
|
+
for (const i of this.#rindexes()) {
|
|
652
|
+
const k = this.#keyList[i];
|
|
653
|
+
if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i])) {
|
|
654
|
+
yield k;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Return a generator yielding the values in the cache,
|
|
660
|
+
* in order from most recently used to least recently used.
|
|
661
|
+
*/
|
|
662
|
+
*values() {
|
|
663
|
+
for (const i of this.#indexes()) {
|
|
664
|
+
const v = this.#valList[i];
|
|
665
|
+
if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i])) {
|
|
666
|
+
yield this.#valList[i];
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Inverse order version of {@link LRUCache.values}
|
|
672
|
+
*
|
|
673
|
+
* Return a generator yielding the values in the cache,
|
|
674
|
+
* in order from least recently used to most recently used.
|
|
675
|
+
*/
|
|
676
|
+
*rvalues() {
|
|
677
|
+
for (const i of this.#rindexes()) {
|
|
678
|
+
const v = this.#valList[i];
|
|
679
|
+
if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i])) {
|
|
680
|
+
yield this.#valList[i];
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Iterating over the cache itself yields the same results as
|
|
686
|
+
* {@link LRUCache.entries}
|
|
687
|
+
*/
|
|
688
|
+
[Symbol.iterator]() {
|
|
689
|
+
return this.entries();
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* A String value that is used in the creation of the default string
|
|
693
|
+
* description of an object. Called by the built-in method
|
|
694
|
+
* `Object.prototype.toString`.
|
|
695
|
+
*/
|
|
696
|
+
[Symbol.toStringTag] = 'LRUCache';
|
|
697
|
+
/**
|
|
698
|
+
* Find a value for which the supplied fn method returns a truthy value,
|
|
699
|
+
* similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
|
|
700
|
+
*/
|
|
701
|
+
find(fn, getOptions = {}) {
|
|
702
|
+
for (const i of this.#indexes()) {
|
|
703
|
+
const v = this.#valList[i];
|
|
704
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
705
|
+
if (value === undefined)
|
|
706
|
+
continue;
|
|
707
|
+
if (fn(value, this.#keyList[i], this)) {
|
|
708
|
+
return this.#get(this.#keyList[i], getOptions);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Call the supplied function on each item in the cache, in order from most
|
|
714
|
+
* recently used to least recently used.
|
|
715
|
+
*
|
|
716
|
+
* `fn` is called as `fn(value, key, cache)`.
|
|
717
|
+
*
|
|
718
|
+
* If `thisp` is provided, function will be called in the `this`-context of
|
|
719
|
+
* the provided object, or the cache if no `thisp` object is provided.
|
|
720
|
+
*
|
|
721
|
+
* Does not update age or recenty of use, or iterate over stale values.
|
|
722
|
+
*/
|
|
723
|
+
forEach(fn, thisp = this) {
|
|
724
|
+
for (const i of this.#indexes()) {
|
|
725
|
+
const v = this.#valList[i];
|
|
726
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
727
|
+
if (value === undefined)
|
|
728
|
+
continue;
|
|
729
|
+
fn.call(thisp, value, this.#keyList[i], this);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* The same as {@link LRUCache.forEach} but items are iterated over in
|
|
734
|
+
* reverse order. (ie, less recently used items are iterated over first.)
|
|
735
|
+
*/
|
|
736
|
+
rforEach(fn, thisp = this) {
|
|
737
|
+
for (const i of this.#rindexes()) {
|
|
738
|
+
const v = this.#valList[i];
|
|
739
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
740
|
+
if (value === undefined)
|
|
741
|
+
continue;
|
|
742
|
+
fn.call(thisp, value, this.#keyList[i], this);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Delete any stale entries. Returns true if anything was removed,
|
|
747
|
+
* false otherwise.
|
|
748
|
+
*/
|
|
749
|
+
purgeStale() {
|
|
750
|
+
let deleted = false;
|
|
751
|
+
for (const i of this.#rindexes({ allowStale: true })) {
|
|
752
|
+
if (this.#isStale(i)) {
|
|
753
|
+
this.#delete(this.#keyList[i], 'expire');
|
|
754
|
+
deleted = true;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
return deleted;
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Get the extended info about a given entry, to get its value, size, and
|
|
761
|
+
* TTL info simultaneously. Returns `undefined` if the key is not present.
|
|
762
|
+
*
|
|
763
|
+
* Unlike {@link LRUCache#dump}, which is designed to be portable and survive
|
|
764
|
+
* serialization, the `start` value is always the current timestamp, and the
|
|
765
|
+
* `ttl` is a calculated remaining time to live (negative if expired).
|
|
766
|
+
*
|
|
767
|
+
* Always returns stale values, if their info is found in the cache, so be
|
|
768
|
+
* sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
|
|
769
|
+
* if relevant.
|
|
770
|
+
*/
|
|
771
|
+
info(key) {
|
|
772
|
+
const i = this.#keyMap.get(key);
|
|
773
|
+
if (i === undefined)
|
|
774
|
+
return undefined;
|
|
775
|
+
const v = this.#valList[i];
|
|
776
|
+
/* c8 ignore start - this isn't tested for the info function,
|
|
777
|
+
* but it's the same logic as found in other places. */
|
|
778
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
779
|
+
if (value === undefined)
|
|
780
|
+
return undefined;
|
|
781
|
+
/* c8 ignore stop */
|
|
782
|
+
const entry = { value };
|
|
783
|
+
if (this.#ttls && this.#starts) {
|
|
784
|
+
const ttl = this.#ttls[i];
|
|
785
|
+
const start = this.#starts[i];
|
|
786
|
+
if (ttl && start) {
|
|
787
|
+
const remain = ttl - (this.#perf.now() - start);
|
|
788
|
+
entry.ttl = remain;
|
|
789
|
+
entry.start = Date.now();
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
if (this.#sizes) {
|
|
793
|
+
entry.size = this.#sizes[i];
|
|
794
|
+
}
|
|
795
|
+
return entry;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
|
799
|
+
* passed to {@link LRUCache#load}.
|
|
800
|
+
*
|
|
801
|
+
* The `start` fields are calculated relative to a portable `Date.now()`
|
|
802
|
+
* timestamp, even if `performance.now()` is available.
|
|
803
|
+
*
|
|
804
|
+
* Stale entries are always included in the `dump`, even if
|
|
805
|
+
* {@link LRUCache.OptionsBase.allowStale} is false.
|
|
806
|
+
*
|
|
807
|
+
* Note: this returns an actual array, not a generator, so it can be more
|
|
808
|
+
* easily passed around.
|
|
809
|
+
*/
|
|
810
|
+
dump() {
|
|
811
|
+
const arr = [];
|
|
812
|
+
for (const i of this.#indexes({ allowStale: true })) {
|
|
813
|
+
const key = this.#keyList[i];
|
|
814
|
+
const v = this.#valList[i];
|
|
815
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
816
|
+
if (value === undefined || key === undefined)
|
|
817
|
+
continue;
|
|
818
|
+
const entry = { value };
|
|
819
|
+
if (this.#ttls && this.#starts) {
|
|
820
|
+
entry.ttl = this.#ttls[i];
|
|
821
|
+
// always dump the start relative to a portable timestamp
|
|
822
|
+
// it's ok for this to be a bit slow, it's a rare operation.
|
|
823
|
+
const age = this.#perf.now() - this.#starts[i];
|
|
824
|
+
entry.start = Math.floor(Date.now() - age);
|
|
825
|
+
}
|
|
826
|
+
if (this.#sizes) {
|
|
827
|
+
entry.size = this.#sizes[i];
|
|
828
|
+
}
|
|
829
|
+
arr.unshift([key, entry]);
|
|
830
|
+
}
|
|
831
|
+
return arr;
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Reset the cache and load in the items in entries in the order listed.
|
|
835
|
+
*
|
|
836
|
+
* The shape of the resulting cache may be different if the same options are
|
|
837
|
+
* not used in both caches.
|
|
838
|
+
*
|
|
839
|
+
* The `start` fields are assumed to be calculated relative to a portable
|
|
840
|
+
* `Date.now()` timestamp, even if `performance.now()` is available.
|
|
841
|
+
*/
|
|
842
|
+
load(arr) {
|
|
843
|
+
this.clear();
|
|
844
|
+
for (const [key, entry] of arr) {
|
|
845
|
+
if (entry.start) {
|
|
846
|
+
// entry.start is a portable timestamp, but we may be using
|
|
847
|
+
// node's performance.now(), so calculate the offset, so that
|
|
848
|
+
// we get the intended remaining TTL, no matter how long it's
|
|
849
|
+
// been on ice.
|
|
850
|
+
//
|
|
851
|
+
// it's ok for this to be a bit slow, it's a rare operation.
|
|
852
|
+
const age = Date.now() - entry.start;
|
|
853
|
+
entry.start = this.#perf.now() - age;
|
|
854
|
+
}
|
|
855
|
+
this.#set(key, entry.value, entry);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Add a value to the cache.
|
|
860
|
+
*
|
|
861
|
+
* Note: if `undefined` is specified as a value, this is an alias for
|
|
862
|
+
* {@link LRUCache#delete}
|
|
863
|
+
*
|
|
864
|
+
* Fields on the {@link LRUCache.SetOptions} options param will override
|
|
865
|
+
* their corresponding values in the constructor options for the scope
|
|
866
|
+
* of this single `set()` operation.
|
|
867
|
+
*
|
|
868
|
+
* If `start` is provided, then that will set the effective start
|
|
869
|
+
* time for the TTL calculation. Note that this must be a previous
|
|
870
|
+
* value of `performance.now()` if supported, or a previous value of
|
|
871
|
+
* `Date.now()` if not.
|
|
872
|
+
*
|
|
873
|
+
* Options object may also include `size`, which will prevent
|
|
874
|
+
* calling the `sizeCalculation` function and just use the specified
|
|
875
|
+
* number if it is a positive integer, and `noDisposeOnSet` which
|
|
876
|
+
* will prevent calling a `dispose` function in the case of
|
|
877
|
+
* overwrites.
|
|
878
|
+
*
|
|
879
|
+
* If the `size` (or return value of `sizeCalculation`) for a given
|
|
880
|
+
* entry is greater than `maxEntrySize`, then the item will not be
|
|
881
|
+
* added to the cache.
|
|
882
|
+
*
|
|
883
|
+
* Will update the recency of the entry.
|
|
884
|
+
*
|
|
885
|
+
* If the value is `undefined`, then this is an alias for
|
|
886
|
+
* `cache.delete(key)`. `undefined` is never stored in the cache.
|
|
887
|
+
*/
|
|
888
|
+
set(k, v, setOptions = {}) {
|
|
889
|
+
const { status = diagnostics_channel_js_1.metrics.hasSubscribers ? {} : undefined } = setOptions;
|
|
890
|
+
setOptions.status = status;
|
|
891
|
+
if (status) {
|
|
892
|
+
status.op = 'set';
|
|
893
|
+
status.key = k;
|
|
894
|
+
if (v !== undefined)
|
|
895
|
+
status.value = v;
|
|
896
|
+
status.cache = this;
|
|
897
|
+
}
|
|
898
|
+
const result = this.#set(k, v, setOptions);
|
|
899
|
+
if (status && diagnostics_channel_js_1.metrics.hasSubscribers) {
|
|
900
|
+
diagnostics_channel_js_1.metrics.publish(status);
|
|
901
|
+
}
|
|
902
|
+
return result;
|
|
903
|
+
}
|
|
904
|
+
#set(k, v, setOptions, bf) {
|
|
905
|
+
const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status, } = setOptions;
|
|
906
|
+
const isBF = this.#isBackgroundFetch(v);
|
|
907
|
+
if (v === undefined) {
|
|
908
|
+
if (status)
|
|
909
|
+
status.set = 'deleted';
|
|
910
|
+
this.delete(k);
|
|
911
|
+
return this;
|
|
912
|
+
}
|
|
913
|
+
let { noUpdateTTL = this.noUpdateTTL } = setOptions;
|
|
914
|
+
if (status && !isBF)
|
|
915
|
+
status.value = v;
|
|
916
|
+
const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation, status);
|
|
917
|
+
// if the item doesn't fit, don't do anything
|
|
918
|
+
// NB: maxEntrySize set to maxSize by default
|
|
919
|
+
if (this.maxEntrySize && size > this.maxEntrySize) {
|
|
920
|
+
// have to delete, in case something is there already.
|
|
921
|
+
this.#delete(k, 'set');
|
|
922
|
+
if (status) {
|
|
923
|
+
status.set = 'miss';
|
|
924
|
+
status.maxEntrySizeExceeded = true;
|
|
925
|
+
}
|
|
926
|
+
return this;
|
|
927
|
+
}
|
|
928
|
+
let index = this.#size === 0 ? undefined : this.#keyMap.get(k);
|
|
929
|
+
if (index === undefined) {
|
|
930
|
+
// addition
|
|
931
|
+
index = (this.#size === 0 ? this.#tail
|
|
932
|
+
: this.#free.length !== 0 ? this.#free.pop()
|
|
933
|
+
: this.#size === this.#max ? this.#evict(false)
|
|
934
|
+
: this.#size);
|
|
935
|
+
this.#keyList[index] = k;
|
|
936
|
+
this.#valList[index] = v;
|
|
937
|
+
this.#keyMap.set(k, index);
|
|
938
|
+
this.#next[this.#tail] = index;
|
|
939
|
+
this.#prev[index] = this.#tail;
|
|
940
|
+
this.#tail = index;
|
|
941
|
+
this.#size++;
|
|
942
|
+
this.#addItemSize(index, size, status);
|
|
943
|
+
if (status)
|
|
944
|
+
status.set = 'add';
|
|
945
|
+
noUpdateTTL = false;
|
|
946
|
+
if (this.#hasOnInsert && !isBF) {
|
|
947
|
+
this.#onInsert?.(v, k, 'add');
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
else {
|
|
951
|
+
// update
|
|
952
|
+
// might be updating a background fetch!
|
|
953
|
+
this.#moveToTail(index);
|
|
954
|
+
const oldVal = this.#valList[index];
|
|
955
|
+
if (v !== oldVal) {
|
|
956
|
+
if (!noDisposeOnSet) {
|
|
957
|
+
if (this.#isBackgroundFetch(oldVal)) {
|
|
958
|
+
if (oldVal !== bf) {
|
|
959
|
+
// setting over a background fetch, not merely resolving it.
|
|
960
|
+
oldVal.__abortController.abort(new Error('replaced'));
|
|
961
|
+
}
|
|
962
|
+
const { __staleWhileFetching: s } = oldVal;
|
|
963
|
+
if (s !== undefined && s !== v) {
|
|
964
|
+
if (this.#hasDispose) {
|
|
965
|
+
this.#dispose?.(s, k, 'set');
|
|
966
|
+
}
|
|
967
|
+
if (this.#hasDisposeAfter) {
|
|
968
|
+
this.#disposed?.push([s, k, 'set']);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
else {
|
|
973
|
+
if (this.#hasDispose) {
|
|
974
|
+
this.#dispose?.(oldVal, k, 'set');
|
|
975
|
+
}
|
|
976
|
+
if (this.#hasDisposeAfter) {
|
|
977
|
+
this.#disposed?.push([oldVal, k, 'set']);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
this.#removeItemSize(index);
|
|
982
|
+
this.#addItemSize(index, size, status);
|
|
983
|
+
this.#valList[index] = v;
|
|
984
|
+
if (!isBF) {
|
|
985
|
+
const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ?
|
|
986
|
+
oldVal.__staleWhileFetching
|
|
987
|
+
: oldVal;
|
|
988
|
+
const setType = oldValue === undefined ? 'add'
|
|
989
|
+
: v !== oldValue ? 'replace'
|
|
990
|
+
: 'update';
|
|
991
|
+
if (status) {
|
|
992
|
+
status.set = setType;
|
|
993
|
+
if (oldValue !== undefined)
|
|
994
|
+
status.oldValue = oldValue;
|
|
995
|
+
}
|
|
996
|
+
if (this.#hasOnInsert) {
|
|
997
|
+
this.onInsert?.(v, k, setType);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
else if (!isBF) {
|
|
1002
|
+
if (status) {
|
|
1003
|
+
status.set = 'update';
|
|
1004
|
+
}
|
|
1005
|
+
if (this.#hasOnInsert) {
|
|
1006
|
+
this.onInsert?.(v, k, 'update');
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
if (ttl !== 0 && !this.#ttls) {
|
|
1011
|
+
this.#initializeTTLTracking();
|
|
1012
|
+
}
|
|
1013
|
+
if (this.#ttls) {
|
|
1014
|
+
if (!noUpdateTTL) {
|
|
1015
|
+
this.#setItemTTL(index, ttl, start);
|
|
1016
|
+
}
|
|
1017
|
+
if (status)
|
|
1018
|
+
this.#statusTTL(status, index);
|
|
1019
|
+
}
|
|
1020
|
+
if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
|
|
1021
|
+
const dt = this.#disposed;
|
|
1022
|
+
let task;
|
|
1023
|
+
while ((task = dt?.shift())) {
|
|
1024
|
+
this.#disposeAfter?.(...task);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
return this;
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Evict the least recently used item, returning its value or
|
|
1031
|
+
* `undefined` if cache is empty.
|
|
1032
|
+
*/
|
|
1033
|
+
pop() {
|
|
1034
|
+
try {
|
|
1035
|
+
while (this.#size) {
|
|
1036
|
+
const val = this.#valList[this.#head];
|
|
1037
|
+
this.#evict(true);
|
|
1038
|
+
if (this.#isBackgroundFetch(val)) {
|
|
1039
|
+
if (val.__staleWhileFetching) {
|
|
1040
|
+
return val.__staleWhileFetching;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
else if (val !== undefined) {
|
|
1044
|
+
return val;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
finally {
|
|
1049
|
+
if (this.#hasDisposeAfter && this.#disposed) {
|
|
1050
|
+
const dt = this.#disposed;
|
|
1051
|
+
let task;
|
|
1052
|
+
while ((task = dt?.shift())) {
|
|
1053
|
+
this.#disposeAfter?.(...task);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
#evict(free) {
|
|
1059
|
+
const head = this.#head;
|
|
1060
|
+
const k = this.#keyList[head];
|
|
1061
|
+
const v = this.#valList[head];
|
|
1062
|
+
const isBF = this.#isBackgroundFetch(v);
|
|
1063
|
+
if (isBF) {
|
|
1064
|
+
v.__abortController.abort(new Error('evicted'));
|
|
1065
|
+
}
|
|
1066
|
+
const oldValue = isBF ? v.__staleWhileFetching : v;
|
|
1067
|
+
if ((this.#hasDispose || this.#hasDisposeAfter) &&
|
|
1068
|
+
oldValue !== undefined) {
|
|
1069
|
+
if (this.#hasDispose) {
|
|
1070
|
+
this.#dispose?.(oldValue, k, 'evict');
|
|
1071
|
+
}
|
|
1072
|
+
if (this.#hasDisposeAfter) {
|
|
1073
|
+
this.#disposed?.push([oldValue, k, 'evict']);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
this.#removeItemSize(head);
|
|
1077
|
+
if (this.#autopurgeTimers?.[head]) {
|
|
1078
|
+
clearTimeout(this.#autopurgeTimers[head]);
|
|
1079
|
+
this.#autopurgeTimers[head] = undefined;
|
|
1080
|
+
}
|
|
1081
|
+
// if we aren't about to use the index, then null these out
|
|
1082
|
+
if (free) {
|
|
1083
|
+
this.#keyList[head] = undefined;
|
|
1084
|
+
this.#valList[head] = undefined;
|
|
1085
|
+
this.#free.push(head);
|
|
1086
|
+
}
|
|
1087
|
+
if (this.#size === 1) {
|
|
1088
|
+
this.#head = this.#tail = 0;
|
|
1089
|
+
this.#free.length = 0;
|
|
1090
|
+
}
|
|
1091
|
+
else {
|
|
1092
|
+
this.#head = this.#next[head];
|
|
1093
|
+
}
|
|
1094
|
+
this.#keyMap.delete(k);
|
|
1095
|
+
this.#size--;
|
|
1096
|
+
return head;
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Check if a key is in the cache, without updating the recency of use.
|
|
1100
|
+
* Will return false if the item is stale, even though it is technically
|
|
1101
|
+
* in the cache.
|
|
1102
|
+
*
|
|
1103
|
+
* Check if a key is in the cache, without updating the recency of
|
|
1104
|
+
* use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
|
|
1105
|
+
* to `true` in either the options or the constructor.
|
|
1106
|
+
*
|
|
1107
|
+
* Will return `false` if the item is stale, even though it is technically in
|
|
1108
|
+
* the cache. The difference can be determined (if it matters) by using a
|
|
1109
|
+
* `status` argument, and inspecting the `has` field.
|
|
1110
|
+
*
|
|
1111
|
+
* Will not update item age unless
|
|
1112
|
+
* {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
|
|
1113
|
+
*/
|
|
1114
|
+
has(k, hasOptions = {}) {
|
|
1115
|
+
const { status = diagnostics_channel_js_1.metrics.hasSubscribers ? {} : undefined } = hasOptions;
|
|
1116
|
+
hasOptions.status = status;
|
|
1117
|
+
if (status) {
|
|
1118
|
+
status.op = 'has';
|
|
1119
|
+
status.key = k;
|
|
1120
|
+
status.cache = this;
|
|
1121
|
+
}
|
|
1122
|
+
const result = this.#has(k, hasOptions);
|
|
1123
|
+
if (diagnostics_channel_js_1.metrics.hasSubscribers)
|
|
1124
|
+
diagnostics_channel_js_1.metrics.publish(status);
|
|
1125
|
+
return result;
|
|
1126
|
+
}
|
|
1127
|
+
#has(k, hasOptions = {}) {
|
|
1128
|
+
const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
|
|
1129
|
+
const index = this.#keyMap.get(k);
|
|
1130
|
+
if (index !== undefined) {
|
|
1131
|
+
const v = this.#valList[index];
|
|
1132
|
+
if (this.#isBackgroundFetch(v) &&
|
|
1133
|
+
v.__staleWhileFetching === undefined) {
|
|
1134
|
+
return false;
|
|
1135
|
+
}
|
|
1136
|
+
if (!this.#isStale(index)) {
|
|
1137
|
+
if (updateAgeOnHas) {
|
|
1138
|
+
this.#updateItemAge(index);
|
|
1139
|
+
}
|
|
1140
|
+
if (status) {
|
|
1141
|
+
status.has = 'hit';
|
|
1142
|
+
this.#statusTTL(status, index);
|
|
1143
|
+
}
|
|
1144
|
+
return true;
|
|
1145
|
+
}
|
|
1146
|
+
else if (status) {
|
|
1147
|
+
status.has = 'stale';
|
|
1148
|
+
this.#statusTTL(status, index);
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
else if (status) {
|
|
1152
|
+
status.has = 'miss';
|
|
1153
|
+
}
|
|
1154
|
+
return false;
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Like {@link LRUCache#get} but doesn't update recency or delete stale
|
|
1158
|
+
* items.
|
|
1159
|
+
*
|
|
1160
|
+
* Returns `undefined` if the item is stale, unless
|
|
1161
|
+
* {@link LRUCache.OptionsBase.allowStale} is set.
|
|
1162
|
+
*/
|
|
1163
|
+
peek(k, peekOptions = {}) {
|
|
1164
|
+
const { status = hasSubscribers() ? {} : undefined } = peekOptions;
|
|
1165
|
+
if (status) {
|
|
1166
|
+
status.op = 'peek';
|
|
1167
|
+
status.key = k;
|
|
1168
|
+
status.cache = this;
|
|
1169
|
+
}
|
|
1170
|
+
peekOptions.status = status;
|
|
1171
|
+
const result = this.#peek(k, peekOptions);
|
|
1172
|
+
if (diagnostics_channel_js_1.metrics.hasSubscribers) {
|
|
1173
|
+
diagnostics_channel_js_1.metrics.publish(status);
|
|
1174
|
+
}
|
|
1175
|
+
return result;
|
|
1176
|
+
}
|
|
1177
|
+
#peek(k, peekOptions) {
|
|
1178
|
+
const { status, allowStale = this.allowStale } = peekOptions;
|
|
1179
|
+
const index = this.#keyMap.get(k);
|
|
1180
|
+
if (index === undefined || (!allowStale && this.#isStale(index))) {
|
|
1181
|
+
if (status)
|
|
1182
|
+
status.peek = index === undefined ? 'miss' : 'stale';
|
|
1183
|
+
return undefined;
|
|
1184
|
+
}
|
|
1185
|
+
const v = this.#valList[index];
|
|
1186
|
+
const val = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
1187
|
+
if (status) {
|
|
1188
|
+
if (val !== undefined) {
|
|
1189
|
+
status.peek = 'hit';
|
|
1190
|
+
status.value = val;
|
|
1191
|
+
}
|
|
1192
|
+
else {
|
|
1193
|
+
status.peek = 'miss';
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
return val;
|
|
1197
|
+
}
|
|
1198
|
+
#backgroundFetch(k, index, options, context) {
|
|
1199
|
+
const v = index === undefined ? undefined : this.#valList[index];
|
|
1200
|
+
if (this.#isBackgroundFetch(v)) {
|
|
1201
|
+
return v;
|
|
1202
|
+
}
|
|
1203
|
+
const ac = new AbortController();
|
|
1204
|
+
const { signal } = options;
|
|
1205
|
+
// when/if our AC signals, then stop listening to theirs.
|
|
1206
|
+
signal?.addEventListener('abort', () => ac.abort(signal.reason), {
|
|
1207
|
+
signal: ac.signal,
|
|
1208
|
+
});
|
|
1209
|
+
const fetchOpts = {
|
|
1210
|
+
signal: ac.signal,
|
|
1211
|
+
options,
|
|
1212
|
+
context,
|
|
1213
|
+
};
|
|
1214
|
+
const cb = (v, updateCache = false) => {
|
|
1215
|
+
const { aborted } = ac.signal;
|
|
1216
|
+
const ignoreAbort = options.ignoreFetchAbort && v !== undefined;
|
|
1217
|
+
const proceed = options.ignoreFetchAbort ||
|
|
1218
|
+
!!(options.allowStaleOnFetchAbort && v !== undefined);
|
|
1219
|
+
if (options.status) {
|
|
1220
|
+
if (aborted && !updateCache) {
|
|
1221
|
+
options.status.fetchAborted = true;
|
|
1222
|
+
options.status.fetchError = ac.signal.reason;
|
|
1223
|
+
if (ignoreAbort)
|
|
1224
|
+
options.status.fetchAbortIgnored = true;
|
|
1225
|
+
}
|
|
1226
|
+
else {
|
|
1227
|
+
options.status.fetchResolved = true;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
if (aborted && !ignoreAbort && !updateCache) {
|
|
1231
|
+
return fetchFail(ac.signal.reason, proceed);
|
|
1232
|
+
}
|
|
1233
|
+
// either we didn't abort, and are still here, or we did, and ignored
|
|
1234
|
+
const bf = p;
|
|
1235
|
+
// if nothing else has been written there but we're set to update the
|
|
1236
|
+
// cache and ignore the abort, or if it's still pending on this specific
|
|
1237
|
+
// background request, then write it to the cache.
|
|
1238
|
+
const vl = this.#valList[index];
|
|
1239
|
+
if (vl === p || (vl === undefined && ignoreAbort && updateCache)) {
|
|
1240
|
+
if (v === undefined) {
|
|
1241
|
+
if (bf.__staleWhileFetching !== undefined) {
|
|
1242
|
+
this.#valList[index] = bf.__staleWhileFetching;
|
|
1243
|
+
}
|
|
1244
|
+
else {
|
|
1245
|
+
this.#delete(k, 'fetch');
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
else {
|
|
1249
|
+
if (options.status)
|
|
1250
|
+
options.status.fetchUpdated = true;
|
|
1251
|
+
this.#set(k, v, fetchOpts.options, bf);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
return v;
|
|
1255
|
+
};
|
|
1256
|
+
const eb = (er) => {
|
|
1257
|
+
if (options.status) {
|
|
1258
|
+
options.status.fetchRejected = true;
|
|
1259
|
+
options.status.fetchError = er;
|
|
1260
|
+
}
|
|
1261
|
+
// do not pass go, do not collect $200
|
|
1262
|
+
return fetchFail(er, false);
|
|
1263
|
+
};
|
|
1264
|
+
const fetchFail = (er, proceed) => {
|
|
1265
|
+
const { aborted } = ac.signal;
|
|
1266
|
+
const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
|
|
1267
|
+
const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
|
|
1268
|
+
const noDelete = allowStale || options.noDeleteOnFetchRejection;
|
|
1269
|
+
const bf = p;
|
|
1270
|
+
if (this.#valList[index] === p) {
|
|
1271
|
+
// if we allow stale on fetch rejections, then we need to ensure that
|
|
1272
|
+
// the stale value is not removed from the cache when the fetch fails.
|
|
1273
|
+
const del = !noDelete || (!proceed && bf.__staleWhileFetching === undefined);
|
|
1274
|
+
if (del) {
|
|
1275
|
+
this.#delete(k, 'fetch');
|
|
1276
|
+
}
|
|
1277
|
+
else if (!allowStaleAborted) {
|
|
1278
|
+
// still replace the *promise* with the stale value,
|
|
1279
|
+
// since we are done with the promise at this point.
|
|
1280
|
+
// leave it untouched if we're still waiting for an
|
|
1281
|
+
// aborted background fetch that hasn't yet returned.
|
|
1282
|
+
this.#valList[index] = bf.__staleWhileFetching;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
if (allowStale) {
|
|
1286
|
+
if (options.status && bf.__staleWhileFetching !== undefined) {
|
|
1287
|
+
options.status.returnedStale = true;
|
|
1288
|
+
}
|
|
1289
|
+
return bf.__staleWhileFetching;
|
|
1290
|
+
}
|
|
1291
|
+
else if (bf.__returned === bf) {
|
|
1292
|
+
throw er;
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
const pcall = (res, rej) => {
|
|
1296
|
+
const fmp = this.#fetchMethod?.(k, v, fetchOpts);
|
|
1297
|
+
// ignored, we go until we finish, regardless.
|
|
1298
|
+
// defer check until we are actually aborting,
|
|
1299
|
+
// so fetchMethod can override.
|
|
1300
|
+
ac.signal.addEventListener('abort', () => {
|
|
1301
|
+
if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
|
|
1302
|
+
res(undefined);
|
|
1303
|
+
// when it eventually resolves, update the cache.
|
|
1304
|
+
if (options.allowStaleOnFetchAbort) {
|
|
1305
|
+
res = v => cb(v, true);
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
if (fmp && fmp instanceof Promise) {
|
|
1310
|
+
fmp.then(v => res(v === undefined ? undefined : v), rej);
|
|
1311
|
+
}
|
|
1312
|
+
else if (fmp !== undefined) {
|
|
1313
|
+
res(fmp);
|
|
1314
|
+
}
|
|
1315
|
+
};
|
|
1316
|
+
if (options.status)
|
|
1317
|
+
options.status.fetchDispatched = true;
|
|
1318
|
+
const p = new Promise(pcall).then(cb, eb);
|
|
1319
|
+
const bf = Object.assign(p, {
|
|
1320
|
+
__abortController: ac,
|
|
1321
|
+
__staleWhileFetching: v,
|
|
1322
|
+
__returned: undefined,
|
|
1323
|
+
});
|
|
1324
|
+
if (index === undefined) {
|
|
1325
|
+
// internal, don't expose status.
|
|
1326
|
+
this.#set(k, bf, { ...fetchOpts.options, status: undefined });
|
|
1327
|
+
index = this.#keyMap.get(k);
|
|
1328
|
+
}
|
|
1329
|
+
else {
|
|
1330
|
+
// do not call #set, because we do not want to adjust its place
|
|
1331
|
+
// in the lru queue, as it has not yet been "used". Also, we don't
|
|
1332
|
+
// need to worry about evicting for size, because a background fetch
|
|
1333
|
+
// over a stale value is treated as the same size as its stale value.
|
|
1334
|
+
this.#valList[index] = bf;
|
|
1335
|
+
}
|
|
1336
|
+
return bf;
|
|
1337
|
+
}
|
|
1338
|
+
#isBackgroundFetch(p) {
|
|
1339
|
+
if (!this.#hasFetchMethod)
|
|
1340
|
+
return false;
|
|
1341
|
+
const b = p;
|
|
1342
|
+
return (!!b &&
|
|
1343
|
+
b instanceof Promise &&
|
|
1344
|
+
b.hasOwnProperty('__staleWhileFetching') &&
|
|
1345
|
+
b.__abortController instanceof AbortController);
|
|
1346
|
+
}
|
|
1347
|
+
fetch(k, fetchOptions = {}) {
|
|
1348
|
+
const ths = diagnostics_channel_js_1.tracing.hasSubscribers;
|
|
1349
|
+
const { status = hasSubscribers() ? {} : undefined } = fetchOptions;
|
|
1350
|
+
fetchOptions.status = status;
|
|
1351
|
+
if (status && fetchOptions.context) {
|
|
1352
|
+
status.context = fetchOptions.context;
|
|
1353
|
+
}
|
|
1354
|
+
const p = this.#fetch(k, fetchOptions);
|
|
1355
|
+
if (status && ths) {
|
|
1356
|
+
status.trace = true;
|
|
1357
|
+
diagnostics_channel_js_1.tracing.tracePromise(() => p, status).catch(() => { });
|
|
1358
|
+
}
|
|
1359
|
+
return p;
|
|
1360
|
+
}
|
|
1361
|
+
async #fetch(k, fetchOptions = {}) {
|
|
1362
|
+
const {
|
|
1363
|
+
// get options
|
|
1364
|
+
allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet,
|
|
1365
|
+
// set options
|
|
1366
|
+
ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL,
|
|
1367
|
+
// fetch exclusive options
|
|
1368
|
+
noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, ignoreFetchAbort = this.ignoreFetchAbort, allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, context, forceRefresh = false, status, signal, } = fetchOptions;
|
|
1369
|
+
if (status) {
|
|
1370
|
+
status.op = 'fetch';
|
|
1371
|
+
status.key = k;
|
|
1372
|
+
if (forceRefresh)
|
|
1373
|
+
status.forceRefresh = true;
|
|
1374
|
+
status.cache = this;
|
|
1375
|
+
}
|
|
1376
|
+
if (!this.#hasFetchMethod) {
|
|
1377
|
+
if (status)
|
|
1378
|
+
status.fetch = 'get';
|
|
1379
|
+
return this.#get(k, {
|
|
1380
|
+
allowStale,
|
|
1381
|
+
updateAgeOnGet,
|
|
1382
|
+
noDeleteOnStaleGet,
|
|
1383
|
+
status,
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
const options = {
|
|
1387
|
+
allowStale,
|
|
1388
|
+
updateAgeOnGet,
|
|
1389
|
+
noDeleteOnStaleGet,
|
|
1390
|
+
ttl,
|
|
1391
|
+
noDisposeOnSet,
|
|
1392
|
+
size,
|
|
1393
|
+
sizeCalculation,
|
|
1394
|
+
noUpdateTTL,
|
|
1395
|
+
noDeleteOnFetchRejection,
|
|
1396
|
+
allowStaleOnFetchRejection,
|
|
1397
|
+
allowStaleOnFetchAbort,
|
|
1398
|
+
ignoreFetchAbort,
|
|
1399
|
+
status,
|
|
1400
|
+
signal,
|
|
1401
|
+
};
|
|
1402
|
+
let index = this.#keyMap.get(k);
|
|
1403
|
+
if (index === undefined) {
|
|
1404
|
+
if (status)
|
|
1405
|
+
status.fetch = 'miss';
|
|
1406
|
+
const p = this.#backgroundFetch(k, index, options, context);
|
|
1407
|
+
return (p.__returned = p);
|
|
1408
|
+
}
|
|
1409
|
+
else {
|
|
1410
|
+
// in cache, maybe already fetching
|
|
1411
|
+
const v = this.#valList[index];
|
|
1412
|
+
if (this.#isBackgroundFetch(v)) {
|
|
1413
|
+
const stale = allowStale && v.__staleWhileFetching !== undefined;
|
|
1414
|
+
if (status) {
|
|
1415
|
+
status.fetch = 'inflight';
|
|
1416
|
+
if (stale)
|
|
1417
|
+
status.returnedStale = true;
|
|
1418
|
+
}
|
|
1419
|
+
return stale ? v.__staleWhileFetching : (v.__returned = v);
|
|
1420
|
+
}
|
|
1421
|
+
// if we force a refresh, that means do NOT serve the cached value,
|
|
1422
|
+
// unless we are already in the process of refreshing the cache.
|
|
1423
|
+
const isStale = this.#isStale(index);
|
|
1424
|
+
if (!forceRefresh && !isStale) {
|
|
1425
|
+
if (status)
|
|
1426
|
+
status.fetch = 'hit';
|
|
1427
|
+
this.#moveToTail(index);
|
|
1428
|
+
if (updateAgeOnGet) {
|
|
1429
|
+
this.#updateItemAge(index);
|
|
1430
|
+
}
|
|
1431
|
+
if (status)
|
|
1432
|
+
this.#statusTTL(status, index);
|
|
1433
|
+
return v;
|
|
1434
|
+
}
|
|
1435
|
+
// ok, it is stale or a forced refresh, and not already fetching.
|
|
1436
|
+
// refresh the cache.
|
|
1437
|
+
const p = this.#backgroundFetch(k, index, options, context);
|
|
1438
|
+
const hasStale = p.__staleWhileFetching !== undefined;
|
|
1439
|
+
const staleVal = hasStale && allowStale;
|
|
1440
|
+
if (status) {
|
|
1441
|
+
status.fetch = isStale ? 'stale' : 'refresh';
|
|
1442
|
+
if (staleVal && isStale)
|
|
1443
|
+
status.returnedStale = true;
|
|
1444
|
+
}
|
|
1445
|
+
return staleVal ? p.__staleWhileFetching : (p.__returned = p);
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
forceFetch(k, fetchOptions = {}) {
|
|
1449
|
+
const ths = diagnostics_channel_js_1.tracing.hasSubscribers;
|
|
1450
|
+
const { status = hasSubscribers() ? {} : undefined } = fetchOptions;
|
|
1451
|
+
fetchOptions.status = status;
|
|
1452
|
+
if (status && fetchOptions.context) {
|
|
1453
|
+
status.context = fetchOptions.context;
|
|
1454
|
+
}
|
|
1455
|
+
const p = this.#forceFetch(k, fetchOptions);
|
|
1456
|
+
if (status && ths) {
|
|
1457
|
+
status.trace = true;
|
|
1458
|
+
diagnostics_channel_js_1.tracing.tracePromise(() => p, status).catch(() => { });
|
|
1459
|
+
}
|
|
1460
|
+
return p;
|
|
1461
|
+
}
|
|
1462
|
+
async #forceFetch(k, fetchOptions = {}) {
|
|
1463
|
+
const v = await this.#fetch(k, fetchOptions);
|
|
1464
|
+
if (v === undefined)
|
|
1465
|
+
throw new Error('fetch() returned undefined');
|
|
1466
|
+
return v;
|
|
1467
|
+
}
|
|
1468
|
+
memo(k, memoOptions = {}) {
|
|
1469
|
+
const { status = diagnostics_channel_js_1.metrics.hasSubscribers ? {} : undefined } = memoOptions;
|
|
1470
|
+
memoOptions.status = status;
|
|
1471
|
+
if (status) {
|
|
1472
|
+
status.op = 'memo';
|
|
1473
|
+
status.key = k;
|
|
1474
|
+
if (memoOptions.context) {
|
|
1475
|
+
status.context = memoOptions.context;
|
|
1476
|
+
}
|
|
1477
|
+
status.cache = this;
|
|
1478
|
+
}
|
|
1479
|
+
const result = this.#memo(k, memoOptions);
|
|
1480
|
+
if (status)
|
|
1481
|
+
status.value = result;
|
|
1482
|
+
if (diagnostics_channel_js_1.metrics.hasSubscribers)
|
|
1483
|
+
diagnostics_channel_js_1.metrics.publish(status);
|
|
1484
|
+
return result;
|
|
1485
|
+
}
|
|
1486
|
+
#memo(k, memoOptions = {}) {
|
|
1487
|
+
const memoMethod = this.#memoMethod;
|
|
1488
|
+
if (!memoMethod) {
|
|
1489
|
+
throw new Error('no memoMethod provided to constructor');
|
|
1490
|
+
}
|
|
1491
|
+
const { context, status, forceRefresh, ...options } = memoOptions;
|
|
1492
|
+
if (status && forceRefresh)
|
|
1493
|
+
status.forceRefresh = true;
|
|
1494
|
+
const v = this.#get(k, options);
|
|
1495
|
+
const refresh = forceRefresh || v === undefined;
|
|
1496
|
+
if (status) {
|
|
1497
|
+
status.memo = refresh ? 'miss' : 'hit';
|
|
1498
|
+
if (!refresh)
|
|
1499
|
+
status.value = v;
|
|
1500
|
+
}
|
|
1501
|
+
if (!refresh)
|
|
1502
|
+
return v;
|
|
1503
|
+
const vv = memoMethod(k, v, {
|
|
1504
|
+
options,
|
|
1505
|
+
context,
|
|
1506
|
+
});
|
|
1507
|
+
if (status)
|
|
1508
|
+
status.value = vv;
|
|
1509
|
+
this.#set(k, vv, options);
|
|
1510
|
+
return vv;
|
|
1511
|
+
}
|
|
1512
|
+
/**
|
|
1513
|
+
* Return a value from the cache. Will update the recency of the cache
|
|
1514
|
+
* entry found.
|
|
1515
|
+
*
|
|
1516
|
+
* If the key is not found, get() will return `undefined`.
|
|
1517
|
+
*/
|
|
1518
|
+
get(k, getOptions = {}) {
|
|
1519
|
+
const { status = diagnostics_channel_js_1.metrics.hasSubscribers ? {} : undefined } = getOptions;
|
|
1520
|
+
getOptions.status = status;
|
|
1521
|
+
if (status) {
|
|
1522
|
+
status.op = 'get';
|
|
1523
|
+
status.key = k;
|
|
1524
|
+
status.cache = this;
|
|
1525
|
+
}
|
|
1526
|
+
const result = this.#get(k, getOptions);
|
|
1527
|
+
if (status) {
|
|
1528
|
+
if (result !== undefined)
|
|
1529
|
+
status.value = result;
|
|
1530
|
+
if (diagnostics_channel_js_1.metrics.hasSubscribers)
|
|
1531
|
+
diagnostics_channel_js_1.metrics.publish(status);
|
|
1532
|
+
}
|
|
1533
|
+
return result;
|
|
1534
|
+
}
|
|
1535
|
+
#get(k, getOptions = {}) {
|
|
1536
|
+
const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status, } = getOptions;
|
|
1537
|
+
const index = this.#keyMap.get(k);
|
|
1538
|
+
if (index === undefined) {
|
|
1539
|
+
if (status)
|
|
1540
|
+
status.get = 'miss';
|
|
1541
|
+
return undefined;
|
|
1542
|
+
}
|
|
1543
|
+
const value = this.#valList[index];
|
|
1544
|
+
const fetching = this.#isBackgroundFetch(value);
|
|
1545
|
+
if (status)
|
|
1546
|
+
this.#statusTTL(status, index);
|
|
1547
|
+
if (this.#isStale(index)) {
|
|
1548
|
+
// delete only if not an in-flight background fetch
|
|
1549
|
+
if (!fetching) {
|
|
1550
|
+
if (!noDeleteOnStaleGet) {
|
|
1551
|
+
this.#delete(k, 'expire');
|
|
1552
|
+
}
|
|
1553
|
+
if (status)
|
|
1554
|
+
status.get = 'stale';
|
|
1555
|
+
if (allowStale) {
|
|
1556
|
+
if (status)
|
|
1557
|
+
status.returnedStale = true;
|
|
1558
|
+
return value;
|
|
1559
|
+
}
|
|
1560
|
+
return undefined;
|
|
1561
|
+
}
|
|
1562
|
+
if (status)
|
|
1563
|
+
status.get = 'stale-fetching';
|
|
1564
|
+
if (allowStale && value.__staleWhileFetching !== undefined) {
|
|
1565
|
+
if (status)
|
|
1566
|
+
status.returnedStale = true;
|
|
1567
|
+
return value.__staleWhileFetching;
|
|
1568
|
+
}
|
|
1569
|
+
return undefined;
|
|
1570
|
+
}
|
|
1571
|
+
// not stale
|
|
1572
|
+
if (status)
|
|
1573
|
+
status.get = fetching ? 'fetching' : 'hit';
|
|
1574
|
+
// if we're currently fetching it, we don't actually have it yet
|
|
1575
|
+
// it's not stale, which means this isn't a staleWhileRefetching.
|
|
1576
|
+
// If it's not stale, and fetching, AND has a __staleWhileFetching
|
|
1577
|
+
// value, then that means the user fetched with {forceRefresh:true},
|
|
1578
|
+
// so it's safe to return that value.
|
|
1579
|
+
this.#moveToTail(index);
|
|
1580
|
+
if (updateAgeOnGet) {
|
|
1581
|
+
this.#updateItemAge(index);
|
|
1582
|
+
}
|
|
1583
|
+
return fetching ? value.__staleWhileFetching : value;
|
|
1584
|
+
}
|
|
1585
|
+
#connect(p, n) {
|
|
1586
|
+
this.#prev[n] = p;
|
|
1587
|
+
this.#next[p] = n;
|
|
1588
|
+
}
|
|
1589
|
+
#moveToTail(index) {
|
|
1590
|
+
// if tail already, nothing to do
|
|
1591
|
+
// if head, move head to next[index]
|
|
1592
|
+
// else
|
|
1593
|
+
// move next[prev[index]] to next[index] (head has no prev)
|
|
1594
|
+
// move prev[next[index]] to prev[index]
|
|
1595
|
+
// prev[index] = tail
|
|
1596
|
+
// next[tail] = index
|
|
1597
|
+
// tail = index
|
|
1598
|
+
if (index !== this.#tail) {
|
|
1599
|
+
if (index === this.#head) {
|
|
1600
|
+
this.#head = this.#next[index];
|
|
1601
|
+
}
|
|
1602
|
+
else {
|
|
1603
|
+
this.#connect(this.#prev[index], this.#next[index]);
|
|
1604
|
+
}
|
|
1605
|
+
this.#connect(this.#tail, index);
|
|
1606
|
+
this.#tail = index;
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Deletes a key out of the cache.
|
|
1611
|
+
*
|
|
1612
|
+
* Returns true if the key was deleted, false otherwise.
|
|
1613
|
+
*/
|
|
1614
|
+
delete(k) {
|
|
1615
|
+
return this.#delete(k, 'delete');
|
|
1616
|
+
}
|
|
1617
|
+
#delete(k, reason) {
|
|
1618
|
+
if (diagnostics_channel_js_1.metrics.hasSubscribers) {
|
|
1619
|
+
diagnostics_channel_js_1.metrics.publish({
|
|
1620
|
+
op: 'delete',
|
|
1621
|
+
delete: reason,
|
|
1622
|
+
key: k,
|
|
1623
|
+
cache: this,
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
let deleted = false;
|
|
1627
|
+
if (this.#size !== 0) {
|
|
1628
|
+
const index = this.#keyMap.get(k);
|
|
1629
|
+
if (index !== undefined) {
|
|
1630
|
+
if (this.#autopurgeTimers?.[index]) {
|
|
1631
|
+
clearTimeout(this.#autopurgeTimers[index]);
|
|
1632
|
+
this.#autopurgeTimers[index] = undefined;
|
|
1633
|
+
}
|
|
1634
|
+
deleted = true;
|
|
1635
|
+
if (this.#size === 1) {
|
|
1636
|
+
this.#clear(reason);
|
|
1637
|
+
}
|
|
1638
|
+
else {
|
|
1639
|
+
this.#removeItemSize(index);
|
|
1640
|
+
const v = this.#valList[index];
|
|
1641
|
+
if (this.#isBackgroundFetch(v)) {
|
|
1642
|
+
v.__abortController.abort(new Error('deleted'));
|
|
1643
|
+
}
|
|
1644
|
+
else if (this.#hasDispose || this.#hasDisposeAfter) {
|
|
1645
|
+
if (this.#hasDispose) {
|
|
1646
|
+
this.#dispose?.(v, k, reason);
|
|
1647
|
+
}
|
|
1648
|
+
if (this.#hasDisposeAfter) {
|
|
1649
|
+
this.#disposed?.push([v, k, reason]);
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
this.#keyMap.delete(k);
|
|
1653
|
+
this.#keyList[index] = undefined;
|
|
1654
|
+
this.#valList[index] = undefined;
|
|
1655
|
+
if (index === this.#tail) {
|
|
1656
|
+
this.#tail = this.#prev[index];
|
|
1657
|
+
}
|
|
1658
|
+
else if (index === this.#head) {
|
|
1659
|
+
this.#head = this.#next[index];
|
|
1660
|
+
}
|
|
1661
|
+
else {
|
|
1662
|
+
const pi = this.#prev[index];
|
|
1663
|
+
this.#next[pi] = this.#next[index];
|
|
1664
|
+
const ni = this.#next[index];
|
|
1665
|
+
this.#prev[ni] = this.#prev[index];
|
|
1666
|
+
}
|
|
1667
|
+
this.#size--;
|
|
1668
|
+
this.#free.push(index);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
if (this.#hasDisposeAfter && this.#disposed?.length) {
|
|
1673
|
+
const dt = this.#disposed;
|
|
1674
|
+
let task;
|
|
1675
|
+
while ((task = dt?.shift())) {
|
|
1676
|
+
this.#disposeAfter?.(...task);
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
return deleted;
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Clear the cache entirely, throwing away all values.
|
|
1683
|
+
*/
|
|
1684
|
+
clear() {
|
|
1685
|
+
return this.#clear('delete');
|
|
1686
|
+
}
|
|
1687
|
+
#clear(reason) {
|
|
1688
|
+
for (const index of this.#rindexes({ allowStale: true })) {
|
|
1689
|
+
const v = this.#valList[index];
|
|
1690
|
+
if (this.#isBackgroundFetch(v)) {
|
|
1691
|
+
v.__abortController.abort(new Error('deleted'));
|
|
1692
|
+
}
|
|
1693
|
+
else {
|
|
1694
|
+
const k = this.#keyList[index];
|
|
1695
|
+
if (this.#hasDispose) {
|
|
1696
|
+
this.#dispose?.(v, k, reason);
|
|
1697
|
+
}
|
|
1698
|
+
if (this.#hasDisposeAfter) {
|
|
1699
|
+
this.#disposed?.push([v, k, reason]);
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
this.#keyMap.clear();
|
|
1704
|
+
void this.#valList.fill(undefined);
|
|
1705
|
+
this.#keyList.fill(undefined);
|
|
1706
|
+
if (this.#ttls && this.#starts) {
|
|
1707
|
+
this.#ttls.fill(0);
|
|
1708
|
+
this.#starts.fill(0);
|
|
1709
|
+
for (const t of this.#autopurgeTimers ?? []) {
|
|
1710
|
+
if (t !== undefined)
|
|
1711
|
+
clearTimeout(t);
|
|
1712
|
+
}
|
|
1713
|
+
this.#autopurgeTimers?.fill(undefined);
|
|
1714
|
+
}
|
|
1715
|
+
if (this.#sizes) {
|
|
1716
|
+
this.#sizes.fill(0);
|
|
1717
|
+
}
|
|
1718
|
+
this.#head = 0;
|
|
1719
|
+
this.#tail = 0;
|
|
1720
|
+
this.#free.length = 0;
|
|
1721
|
+
this.#calculatedSize = 0;
|
|
1722
|
+
this.#size = 0;
|
|
1723
|
+
if (this.#hasDisposeAfter && this.#disposed) {
|
|
1724
|
+
const dt = this.#disposed;
|
|
1725
|
+
let task;
|
|
1726
|
+
while ((task = dt?.shift())) {
|
|
1727
|
+
this.#disposeAfter?.(...task);
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
exports.LRUCache = LRUCache;
|
|
1733
|
+
//# sourceMappingURL=index.js.map
|