Merge branch 'main' into angelapwen/deprecate-action-v2

This commit is contained in:
Angela P Wen 2025-01-10 08:54:32 -08:00 committed by GitHub
commit 4df151edec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
176 changed files with 676 additions and 3996 deletions

View file

@ -5,6 +5,7 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
## [UNRELEASED]
- CodeQL Action v2 is now deprecated, and is no longer updated or supported. For better performance, improved security, and new features, upgrade to v3. For more information, see [this changelog post](https://github.blog/changelog/2025-01-10-code-scanning-codeql-action-v2-is-now-deprecated/). [#2677](https://github.com/github/codeql-action/pull/2677)
- Update default CodeQL bundle version to 2.20.1. [#2678](https://github.com/github/codeql-action/pull/2678)
## 3.28.0 - 20 Dec 2024

View file

@ -1,6 +1,6 @@
{
"bundleVersion": "codeql-bundle-v2.20.0",
"cliVersion": "2.20.0",
"priorBundleVersion": "codeql-bundle-v2.19.4",
"priorCliVersion": "2.19.4"
"bundleVersion": "codeql-bundle-v2.20.1",
"cliVersion": "2.20.1",
"priorBundleVersion": "codeql-bundle-v2.20.0",
"priorCliVersion": "2.20.0"
}

View file

@ -154,7 +154,10 @@ async function startProxy(binPath, config, logFilePath, logger) {
core.setOutput("proxy_ca_certificate", config.ca.cert);
const registry_urls = config.all_credentials
.filter((credential) => credential.url !== undefined)
.map((credential) => credential.url);
.map((credential) => ({
type: credential.type,
url: credential.url,
}));
core.setOutput("proxy_urls", JSON.stringify(registry_urls));
}
catch (error) {

File diff suppressed because one or more lines are too long

171
node_modules/.package-lock.json generated vendored
View file

@ -1303,17 +1303,17 @@
"license": "MIT"
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.18.2.tgz",
"integrity": "sha512-adig4SzPLjeQ0Tm+jvsozSGiCliI2ajeURDGHjZ2llnA+A67HihCQ+a3amtPhUakd1GlwHxSRvzOZktbEvhPPg==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.19.0.tgz",
"integrity": "sha512-NggSaEZCdSrFddbctrVjkVZvFC6KGfKfNK0CU7mNK/iKHGKbzT4Wmgm08dKpcZECBu9f5FypndoMyRHkdqfT1Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.18.2",
"@typescript-eslint/type-utils": "8.18.2",
"@typescript-eslint/utils": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2",
"@typescript-eslint/scope-manager": "8.19.0",
"@typescript-eslint/type-utils": "8.19.0",
"@typescript-eslint/utils": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0",
"graphemer": "^1.4.0",
"ignore": "^5.3.1",
"natural-compare": "^1.4.0",
@ -1333,14 +1333,14 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.18.2.tgz",
"integrity": "sha512-YJFSfbd0CJjy14r/EvWapYgV4R5CHzptssoag2M7y3Ra7XNta6GPAJPPP5KGB9j14viYXyrzRO5GkX7CRfo8/g==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.19.0.tgz",
"integrity": "sha512-hkoJiKQS3GQ13TSMEiuNmSCvhz7ujyqD1x3ShbaETATHrck+9RaDdUbt+osXaUuns9OFwrDTTrjtwsU8gJyyRA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2"
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -1351,9 +1351,9 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.18.2.tgz",
"integrity": "sha512-Z/zblEPp8cIvmEn6+tPDIHUbRu/0z5lqZ+NvolL5SvXWT5rQy7+Nch83M0++XzO0XrWRFWECgOAyE8bsJTl1GQ==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.19.0.tgz",
"integrity": "sha512-8XQ4Ss7G9WX8oaYvD4OOLCjIQYgRQxO+qCiR2V2s2GxI9AUpo7riNwo6jDhKtTcaJjT8PY54j2Yb33kWtSJsmA==",
"dev": true,
"license": "MIT",
"engines": {
@ -1365,14 +1365,14 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/typescript-estree": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.18.2.tgz",
"integrity": "sha512-WXAVt595HjpmlfH4crSdM/1bcsqh+1weFRWIa9XMTx/XHZ9TCKMcr725tLYqWOgzKdeDrqVHxFotrvWcEsk2Tg==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.19.0.tgz",
"integrity": "sha512-WW9PpDaLIFW9LCbucMSdYUuGeFUz1OkWYS/5fwZwTA+l2RwlWFdJvReQqMUMBw4yJWJOfqd7An9uwut2Oj8sLw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2",
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",
@ -1392,16 +1392,16 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.18.2.tgz",
"integrity": "sha512-Cr4A0H7DtVIPkauj4sTSXVl+VBWewE9/o40KcF3TV9aqDEOWoXF3/+oRXNby3DYzZeCATvbdksYsGZzplwnK/Q==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.19.0.tgz",
"integrity": "sha512-PTBG+0oEMPH9jCZlfg07LCB2nYI0I317yyvXGfxnvGvw4SHIOuRnQ3kadyyXY6tGdChusIHIbM5zfIbp4M6tCg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "8.18.2",
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/typescript-estree": "8.18.2"
"@typescript-eslint/scope-manager": "8.19.0",
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/typescript-estree": "8.19.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -1416,13 +1416,13 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.18.2.tgz",
"integrity": "sha512-zORcwn4C3trOWiCqFQP1x6G3xTRyZ1LYydnj51cRnJ6hxBlr/cKPckk+PKPUw/fXmvfKTcw7bwY3w9izgx5jZw==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.19.0.tgz",
"integrity": "sha512-mCFtBbFBJDCNCWUl5y6sZSCHXw1DEFEk3c/M3nRK2a4XUB8StGFtmcEMizdjKuBzB6e/smJAAWYug3VrdLMr1w==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/types": "8.19.0",
"eslint-visitor-keys": "^4.2.0"
},
"engines": {
@ -1473,16 +1473,16 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.18.2.tgz",
"integrity": "sha512-y7tcq4StgxQD4mDr9+Jb26dZ+HTZ/SkfqpXSiqeUXZHxOUyjWDKsmwKhJ0/tApR08DgOhrFAoAhyB80/p3ViuA==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.19.0.tgz",
"integrity": "sha512-6M8taKyOETY1TKHp0x8ndycipTVgmp4xtg5QpEZzXxDhNvvHOJi5rLRkLr8SK3jTgD5l4fTlvBiRdfsuWydxBw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/scope-manager": "8.18.2",
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/typescript-estree": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2",
"@typescript-eslint/scope-manager": "8.19.0",
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/typescript-estree": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0",
"debug": "^4.3.4"
},
"engines": {
@ -1498,14 +1498,14 @@
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.18.2.tgz",
"integrity": "sha512-YJFSfbd0CJjy14r/EvWapYgV4R5CHzptssoag2M7y3Ra7XNta6GPAJPPP5KGB9j14viYXyrzRO5GkX7CRfo8/g==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.19.0.tgz",
"integrity": "sha512-hkoJiKQS3GQ13TSMEiuNmSCvhz7ujyqD1x3ShbaETATHrck+9RaDdUbt+osXaUuns9OFwrDTTrjtwsU8gJyyRA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2"
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -1516,9 +1516,9 @@
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.18.2.tgz",
"integrity": "sha512-Z/zblEPp8cIvmEn6+tPDIHUbRu/0z5lqZ+NvolL5SvXWT5rQy7+Nch83M0++XzO0XrWRFWECgOAyE8bsJTl1GQ==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.19.0.tgz",
"integrity": "sha512-8XQ4Ss7G9WX8oaYvD4OOLCjIQYgRQxO+qCiR2V2s2GxI9AUpo7riNwo6jDhKtTcaJjT8PY54j2Yb33kWtSJsmA==",
"dev": true,
"license": "MIT",
"engines": {
@ -1530,14 +1530,14 @@
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.18.2.tgz",
"integrity": "sha512-WXAVt595HjpmlfH4crSdM/1bcsqh+1weFRWIa9XMTx/XHZ9TCKMcr725tLYqWOgzKdeDrqVHxFotrvWcEsk2Tg==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.19.0.tgz",
"integrity": "sha512-WW9PpDaLIFW9LCbucMSdYUuGeFUz1OkWYS/5fwZwTA+l2RwlWFdJvReQqMUMBw4yJWJOfqd7An9uwut2Oj8sLw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2",
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",
@ -1557,13 +1557,13 @@
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.18.2.tgz",
"integrity": "sha512-zORcwn4C3trOWiCqFQP1x6G3xTRyZ1LYydnj51cRnJ6hxBlr/cKPckk+PKPUw/fXmvfKTcw7bwY3w9izgx5jZw==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.19.0.tgz",
"integrity": "sha512-mCFtBbFBJDCNCWUl5y6sZSCHXw1DEFEk3c/M3nRK2a4XUB8StGFtmcEMizdjKuBzB6e/smJAAWYug3VrdLMr1w==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/types": "8.19.0",
"eslint-visitor-keys": "^4.2.0"
},
"engines": {
@ -1632,14 +1632,14 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.18.2.tgz",
"integrity": "sha512-AB/Wr1Lz31bzHfGm/jgbFR0VB0SML/hd2P1yxzKDM48YmP7vbyJNHRExUE/wZsQj2wUCvbWH8poNHFuxLqCTnA==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.19.0.tgz",
"integrity": "sha512-TZs0I0OSbd5Aza4qAMpp1cdCYVnER94IziudE3JU328YUHgWu9gwiwhag+fuLeJ2LkWLXI+F/182TbG+JaBdTg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/typescript-estree": "8.18.2",
"@typescript-eslint/utils": "8.18.2",
"@typescript-eslint/typescript-estree": "8.19.0",
"@typescript-eslint/utils": "8.19.0",
"debug": "^4.3.4",
"ts-api-utils": "^1.3.0"
},
@ -1656,14 +1656,14 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/scope-manager": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.18.2.tgz",
"integrity": "sha512-YJFSfbd0CJjy14r/EvWapYgV4R5CHzptssoag2M7y3Ra7XNta6GPAJPPP5KGB9j14viYXyrzRO5GkX7CRfo8/g==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.19.0.tgz",
"integrity": "sha512-hkoJiKQS3GQ13TSMEiuNmSCvhz7ujyqD1x3ShbaETATHrck+9RaDdUbt+osXaUuns9OFwrDTTrjtwsU8gJyyRA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2"
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -1674,9 +1674,9 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.18.2.tgz",
"integrity": "sha512-Z/zblEPp8cIvmEn6+tPDIHUbRu/0z5lqZ+NvolL5SvXWT5rQy7+Nch83M0++XzO0XrWRFWECgOAyE8bsJTl1GQ==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.19.0.tgz",
"integrity": "sha512-8XQ4Ss7G9WX8oaYvD4OOLCjIQYgRQxO+qCiR2V2s2GxI9AUpo7riNwo6jDhKtTcaJjT8PY54j2Yb33kWtSJsmA==",
"dev": true,
"license": "MIT",
"engines": {
@ -1688,14 +1688,14 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.18.2.tgz",
"integrity": "sha512-WXAVt595HjpmlfH4crSdM/1bcsqh+1weFRWIa9XMTx/XHZ9TCKMcr725tLYqWOgzKdeDrqVHxFotrvWcEsk2Tg==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.19.0.tgz",
"integrity": "sha512-WW9PpDaLIFW9LCbucMSdYUuGeFUz1OkWYS/5fwZwTA+l2RwlWFdJvReQqMUMBw4yJWJOfqd7An9uwut2Oj8sLw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2",
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",
@ -1715,16 +1715,16 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/utils": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.18.2.tgz",
"integrity": "sha512-Cr4A0H7DtVIPkauj4sTSXVl+VBWewE9/o40KcF3TV9aqDEOWoXF3/+oRXNby3DYzZeCATvbdksYsGZzplwnK/Q==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.19.0.tgz",
"integrity": "sha512-PTBG+0oEMPH9jCZlfg07LCB2nYI0I317yyvXGfxnvGvw4SHIOuRnQ3kadyyXY6tGdChusIHIbM5zfIbp4M6tCg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "8.18.2",
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/typescript-estree": "8.18.2"
"@typescript-eslint/scope-manager": "8.19.0",
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/typescript-estree": "8.19.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@ -1739,13 +1739,13 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": {
"version": "8.18.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.18.2.tgz",
"integrity": "sha512-zORcwn4C3trOWiCqFQP1x6G3xTRyZ1LYydnj51cRnJ6hxBlr/cKPckk+PKPUw/fXmvfKTcw7bwY3w9izgx5jZw==",
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.19.0.tgz",
"integrity": "sha512-mCFtBbFBJDCNCWUl5y6sZSCHXw1DEFEk3c/M3nRK2a4XUB8StGFtmcEMizdjKuBzB6e/smJAAWYug3VrdLMr1w==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/types": "8.19.0",
"eslint-visitor-keys": "^4.2.0"
},
"engines": {
@ -7624,13 +7624,14 @@
"license": "MIT"
},
"node_modules/uuid": {
"version": "11.0.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.3.tgz",
"integrity": "sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg==",
"version": "11.0.4",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.4.tgz",
"integrity": "sha512-IzL6VtTTYcAhA/oghbFJ1Dkmqev+FpQWnCBaKq/gUluLxliWvO8DPFWfIviRmYbtaavtSQe4WBL++rFjdcGWEg==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist/esm/bin/uuid"
}

View file

@ -60,6 +60,7 @@ function typeNeedsParentheses(node) {
case utils_1.AST_NODE_TYPES.TSTypeOperator:
case utils_1.AST_NODE_TYPES.TSInferType:
case utils_1.AST_NODE_TYPES.TSConstructorType:
case utils_1.AST_NODE_TYPES.TSConditionalType:
return true;
case utils_1.AST_NODE_TYPES.Identifier:
return node.name === 'ReadonlyArray';

File diff suppressed because one or more lines are too long

View file

@ -61,9 +61,10 @@ exports.default = (0, util_1.createRule)({
const checker = services.program.getTypeChecker();
return {
AwaitExpression(node) {
const type = services.getTypeAtLocation(node.argument);
const originalNode = services.esTreeNodeToTSNodeMap.get(node);
const certainty = (0, util_1.needsToBeAwaited)(checker, originalNode, type);
const awaitArgumentEsNode = node.argument;
const awaitArgumentType = services.getTypeAtLocation(awaitArgumentEsNode);
const awaitArgumentTsNode = services.esTreeNodeToTSNodeMap.get(awaitArgumentEsNode);
const certainty = (0, util_1.needsToBeAwaited)(checker, awaitArgumentTsNode, awaitArgumentType);
if (certainty === util_1.Awaitable.Never) {
context.report({
node,

View file

@ -1 +1 @@
{"version":3,"file":"await-thenable.js","sourceRoot":"","sources":["../../src/rules/await-thenable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,sDAAwC;AAExC,kCAUiB;AACjB,2EAAwE;AASxE,kBAAe,IAAA,iBAAU,EAAgB;IACvC,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,kDAAkD;YAC/D,WAAW,EAAE,aAAa;YAC1B,oBAAoB,EAAE,IAAI;SAC3B;QACD,cAAc,EAAE,IAAI;QACpB,QAAQ,EAAE;YACR,KAAK,EAAE,6DAA6D;YACpE,8BAA8B,EAC5B,mEAAmE;YACrE,oBAAoB,EAAE,yCAAyC;YAC/D,0BAA0B,EACxB,oEAAoE;YACtE,WAAW,EAAE,6BAA6B;SAC3C;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAElB,MAAM,CAAC,OAAO;QACZ,MAAM,QAAQ,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAElD,OAAO;YACL,eAAe,CAAC,IAAI;gBAClB,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAEvD,MAAM,YAAY,GAAG,QAAQ,CAAC,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC9D,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,YAAY,EACV,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;gCAErD,UAAU,EAAE;oCACV,SAAS,EAAE,aAAa;oCACxB,GAAG,CAAC,KAAK;wCACP,MAAM,UAAU,GAAG,IAAA,iBAAU,EAC3B,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,EAAE,qBAAc,CAAC,EACtD,wBAAiB,CAAC,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,CACvD,CAAC;wCACF,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;oCAClC,CAAC;iCACF;6BACF,CAAC;yBACH,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}

View file

@ -51,13 +51,9 @@ exports.default = (0, util_1.createRule)({
if (parentId) {
const scope = context.sourceCode.getScope(parentId);
const superVar = utils_1.ASTUtils.findVariable(scope, parentId.name);
if (superVar) {
const isCircular = superVar.references.some(item => item.isTypeReference &&
node.range[0] <= item.identifier.range[0] &&
node.range[1] >= item.identifier.range[1]);
if (isCircular) {
return;
}
if (superVar &&
isDeeplyReferencingType(node, superVar, new Set([parentId]))) {
return;
}
}
context.report({
@ -192,4 +188,64 @@ function findParentDeclaration(node) {
}
return undefined;
}
function isDeeplyReferencingType(node, superVar, visited) {
if (visited.has(node)) {
// something on the chain is circular but it's not the reference being checked
return false;
}
visited.add(node);
switch (node.type) {
case utils_1.AST_NODE_TYPES.TSTypeLiteral:
return node.members.some(member => isDeeplyReferencingType(member, superVar, visited));
case utils_1.AST_NODE_TYPES.TSTypeAliasDeclaration:
return isDeeplyReferencingType(node.typeAnnotation, superVar, visited);
case utils_1.AST_NODE_TYPES.TSIndexedAccessType:
return [node.indexType, node.objectType].some(type => isDeeplyReferencingType(type, superVar, visited));
case utils_1.AST_NODE_TYPES.TSConditionalType:
return [
node.checkType,
node.extendsType,
node.falseType,
node.trueType,
].some(type => isDeeplyReferencingType(type, superVar, visited));
case utils_1.AST_NODE_TYPES.TSUnionType:
case utils_1.AST_NODE_TYPES.TSIntersectionType:
return node.types.some(type => isDeeplyReferencingType(type, superVar, visited));
case utils_1.AST_NODE_TYPES.TSInterfaceDeclaration:
return node.body.body.some(type => isDeeplyReferencingType(type, superVar, visited));
case utils_1.AST_NODE_TYPES.TSTypeAnnotation:
return isDeeplyReferencingType(node.typeAnnotation, superVar, visited);
case utils_1.AST_NODE_TYPES.TSIndexSignature: {
if (node.typeAnnotation) {
return isDeeplyReferencingType(node.typeAnnotation, superVar, visited);
}
break;
}
case utils_1.AST_NODE_TYPES.TSTypeParameterInstantiation: {
return node.params.some(param => isDeeplyReferencingType(param, superVar, visited));
}
case utils_1.AST_NODE_TYPES.TSTypeReference: {
if (isDeeplyReferencingType(node.typeName, superVar, visited)) {
return true;
}
if (node.typeArguments &&
isDeeplyReferencingType(node.typeArguments, superVar, visited)) {
return true;
}
break;
}
case utils_1.AST_NODE_TYPES.Identifier: {
// check if the identifier is a reference of the type being checked
if (superVar.references.some(ref => (0, util_1.isNodeEqual)(ref.identifier, node))) {
return true;
}
// otherwise, follow its definition(s)
const refVar = utils_1.ASTUtils.findVariable(superVar.scope, node.name);
if (refVar) {
return refVar.defs.some(def => isDeeplyReferencingType(def.node, superVar, visited));
}
}
}
return false;
}
//# sourceMappingURL=consistent-indexed-object-style.js.map

File diff suppressed because one or more lines are too long

View file

@ -371,6 +371,10 @@ function getAccessibility(node) {
*/
function getRank(node, orderConfig, supportsModifiers) {
const type = getNodeType(node);
if (node.type === utils_1.AST_NODE_TYPES.MethodDefinition &&
node.value.type === utils_1.AST_NODE_TYPES.TSEmptyBodyFunctionExpression) {
return -1;
}
if (type == null) {
// shouldn't happen but just in case, put it on the end
return orderConfig.length - 1;

File diff suppressed because one or more lines are too long

View file

@ -79,19 +79,23 @@ exports.default = (0, util_1.createRule)({
],
create(context, [options]) {
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
function getBooleanComparison(node) {
const comparison = deconstructComparison(node);
if (!comparison) {
return undefined;
}
const expressionType = (0, util_1.getConstrainedTypeAtLocation)(services, comparison.expression);
if (isBooleanType(expressionType)) {
const { constraintType, isTypeParameter } = (0, util_1.getConstraintInfo)(checker, services.getTypeAtLocation(comparison.expression));
if (isTypeParameter && constraintType == null) {
return undefined;
}
if (isBooleanType(constraintType)) {
return {
...comparison,
expressionIsNullableBoolean: false,
};
}
if (isNullableBoolean(expressionType)) {
if (isNullableBoolean(constraintType)) {
return {
...comparison,
expressionIsNullableBoolean: true,

File diff suppressed because one or more lines are too long

View file

@ -472,15 +472,7 @@ exports.default = (0, util_1.createRule)({
// Otherwise just do type analysis on the function as a whole.
const returnTypes = tsutils
.getCallSignaturesOfType((0, util_1.getConstrainedTypeAtLocation)(services, callback))
.map(sig => sig.getReturnType())
.map(t => {
// TODO: use `getConstraintTypeInfoAtLocation` once it's merged
// https://github.com/typescript-eslint/typescript-eslint/pull/10496
if (tsutils.isTypeParameter(t)) {
return checker.getBaseConstraintOfType(t);
}
return t;
});
.map(sig => sig.getReturnType());
if (returnTypes.length === 0) {
// Not a callable function, e.g. `any`
return;
@ -488,14 +480,17 @@ exports.default = (0, util_1.createRule)({
let hasFalsyReturnTypes = false;
let hasTruthyReturnTypes = false;
for (const type of returnTypes) {
const { constraintType } = (0, util_1.getConstraintInfo)(checker, type);
// Predicate is always necessary if it involves `any` or `unknown`
if (!type || (0, util_1.isTypeAnyType)(type) || (0, util_1.isTypeUnknownType)(type)) {
if (!constraintType ||
(0, util_1.isTypeAnyType)(constraintType) ||
(0, util_1.isTypeUnknownType)(constraintType)) {
return;
}
if (isPossiblyFalsy(type)) {
if (isPossiblyFalsy(constraintType)) {
hasFalsyReturnTypes = true;
}
if (isPossiblyTruthy(type)) {
if (isPossiblyTruthy(constraintType)) {
hasTruthyReturnTypes = true;
}
// bail early if both a possibly-truthy and a possibly-falsy have been detected

File diff suppressed because one or more lines are too long

View file

@ -82,7 +82,10 @@ exports.default = (0, util_1.createRule)({
conditionFixDefaultEmptyString: 'Explicitly treat nullish value the same as an empty string (`value ?? ""`)',
conditionFixDefaultFalse: 'Explicitly treat nullish value the same as false (`value ?? false`)',
conditionFixDefaultZero: 'Explicitly treat nullish value the same as 0 (`value ?? 0`)',
explicitBooleanReturnType: 'Add an explicit `boolean` return type annotation.',
noStrictNullCheck: 'This rule requires the `strictNullChecks` compiler option to be turned on to function correctly.',
predicateCannotBeAsync: "Predicate function should not be 'async'; expected a boolean return type.",
predicateReturnsNonBoolean: 'Predicate function should return a boolean.',
},
schema: [
{
@ -203,6 +206,69 @@ exports.default = (0, util_1.createRule)({
if (assertedArgument != null) {
traverseNode(assertedArgument, true);
}
if ((0, util_1.isArrayMethodCallWithPredicate)(context, services, node)) {
const predicate = node.arguments.at(0);
if (predicate) {
checkArrayMethodCallPredicate(predicate);
}
}
}
/**
* Dedicated function to check array method predicate calls. Reports predicate
* arguments that don't return a boolean value.
*
* Ignores the `allow*` options and requires a boolean value.
*/
function checkArrayMethodCallPredicate(predicateNode) {
const isFunctionExpression = utils_1.ASTUtils.isFunction(predicateNode);
// custom message for accidental `async` function expressions
if (isFunctionExpression && predicateNode.async) {
return context.report({
node: predicateNode,
messageId: 'predicateCannotBeAsync',
});
}
const returnTypes = services
.getTypeAtLocation(predicateNode)
.getCallSignatures()
.map(signature => {
const type = signature.getReturnType();
if (tsutils.isTypeParameter(type)) {
return checker.getBaseConstraintOfType(type) ?? type;
}
return type;
});
if (returnTypes.every(returnType => isBooleanType(returnType))) {
return;
}
const canFix = isFunctionExpression && !predicateNode.returnType;
return context.report({
node: predicateNode,
messageId: 'predicateReturnsNonBoolean',
suggest: canFix
? [
{
messageId: 'explicitBooleanReturnType',
fix: fixer => {
if (predicateNode.type ===
utils_1.AST_NODE_TYPES.ArrowFunctionExpression &&
(0, util_1.isParenlessArrowFunction)(predicateNode, context.sourceCode)) {
return [
fixer.insertTextBefore(predicateNode.params[0], '('),
fixer.insertTextAfter(predicateNode.params[0], '): boolean'),
];
}
if (predicateNode.params.length === 0) {
const closingBracket = (0, util_1.nullThrows)(context.sourceCode.getFirstToken(predicateNode, token => token.value === ')'), 'function expression has to have a closing parenthesis.');
return fixer.insertTextAfter(closingBracket, ': boolean');
}
const lastClosingParenthesis = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(predicateNode.params[predicateNode.params.length - 1], token => token.value === ')'), 'function expression has to have a closing parenthesis.');
return fixer.insertTextAfter(lastClosingParenthesis, ': boolean');
},
},
]
: null,
});
}
/**
* Inspects any node.
@ -843,6 +909,9 @@ function isArrayLengthExpression(node, typeChecker, services) {
*/
function isBrandedBoolean(type) {
return (type.isIntersection() &&
type.types.some(childType => tsutils.isTypeFlagSet(childType, ts.TypeFlags.BooleanLiteral | ts.TypeFlags.Boolean)));
type.types.some(childType => isBooleanType(childType)));
}
function isBooleanType(expressionType) {
return tsutils.isTypeFlagSet(expressionType, ts.TypeFlags.Boolean | ts.TypeFlags.BooleanLiteral);
}
//# sourceMappingURL=strict-boolean-expressions.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,71 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.getConstraintInfo = getConstraintInfo;
const tsutils = __importStar(require("ts-api-utils"));
/**
* Returns whether the type is a generic and what its constraint is.
*
* If the type is not a generic, `isTypeParameter` will be `false`, and
* `constraintType` will be the same as the input type.
*
* If the type is a generic, and it is constrained, `isTypeParameter` will be
* `true`, and `constraintType` will be the constraint type.
*
* If the type is a generic, but it is not constrained, `constraintType` will be
* `undefined` (rather than an `unknown` type), due to https://github.com/microsoft/TypeScript/issues/60475
*
* Successor to {@link getConstrainedTypeAtLocation} due to https://github.com/typescript-eslint/typescript-eslint/issues/10438
*
* This is considered internal since it is unstable for now and may have breaking changes at any time.
* Use at your own risk.
*
* @internal
*
*/
function getConstraintInfo(checker, type) {
if (tsutils.isTypeParameter(type)) {
const constraintType = checker.getBaseConstraintOfType(type);
return {
constraintType,
isTypeParameter: true,
};
}
return {
constraintType: type,
isTypeParameter: false,
};
}
//# sourceMappingURL=getConstraintInfo.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"getConstraintInfo.js","sourceRoot":"","sources":["../../src/util/getConstraintInfo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,8CAeC;AAzDD,sDAAwC;AAsBxC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,iBAAiB,CAC/B,OAAuB,EACvB,IAAa;IAEb,IAAI,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;QAC7D,OAAO;YACL,cAAc;YACd,eAAe,EAAE,IAAI;SACtB,CAAC;IACJ,CAAC;IACD,OAAO;QACL,cAAc,EAAE,IAAI;QACpB,eAAe,EAAE,KAAK;KACvB,CAAC;AACJ,CAAC"}

View file

@ -39,6 +39,7 @@ __exportStar(require("./objectIterators"), exports);
__exportStar(require("./needsToBeAwaited"), exports);
__exportStar(require("./scopeUtils"), exports);
__exportStar(require("./types"), exports);
__exportStar(require("./getConstraintInfo"), exports);
// this is done for convenience - saves migrating all of the old rules
__exportStar(require("@typescript-eslint/type-utils"), exports);
const { applyDefault, deepMerge, getParserServices, isObjectNotArray, nullThrows, NullThrowsReasons, } = utils_1.ESLintUtils;

View file

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAuD;AAEvD,6CAA2B;AAC3B,2DAAyC;AACzC,+CAA6B;AAC7B,oDAAkC;AAClC,uDAAqC;AACrC,0DAAwC;AACxC,yDAAuC;AACvC,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,qDAAmC;AACnC,mEAAiD;AACjD,+CAA6B;AAC7B,gDAA8B;AAC9B,kDAAgC;AAChC,iEAA+C;AAC/C,0DAAwC;AACxC,yCAAuB;AACvB,4DAA0C;AAC1C,oDAAkC;AAClC,qDAAmC;AACnC,+CAA6B;AAC7B,0CAAwB;AAExB,sEAAsE;AACtE,gEAA8C;AAC9C,MAAM,EACJ,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,GAClB,GAAG,mBAAW,CAAC;AAMd,oCAAY;AACZ,8BAAS;AACT,8CAAiB;AAGjB,4CAAgB;AAChB,gCAAU;AACV,8CAAiB"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAuD;AAEvD,6CAA2B;AAC3B,2DAAyC;AACzC,+CAA6B;AAC7B,oDAAkC;AAClC,uDAAqC;AACrC,0DAAwC;AACxC,yDAAuC;AACvC,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,qDAAmC;AACnC,mEAAiD;AACjD,+CAA6B;AAC7B,gDAA8B;AAC9B,kDAAgC;AAChC,iEAA+C;AAC/C,0DAAwC;AACxC,yCAAuB;AACvB,4DAA0C;AAC1C,oDAAkC;AAClC,qDAAmC;AACnC,+CAA6B;AAC7B,0CAAwB;AACxB,sDAAoC;AAEpC,sEAAsE;AACtE,gEAA8C;AAE9C,MAAM,EACJ,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,GAClB,GAAG,mBAAW,CAAC;AAMd,oCAAY;AACZ,8BAAS;AACT,8CAAiB;AAGjB,4CAAgB;AAChB,gCAAU;AACV,8CAAiB"}

View file

@ -37,6 +37,7 @@ exports.Awaitable = void 0;
exports.needsToBeAwaited = needsToBeAwaited;
const type_utils_1 = require("@typescript-eslint/type-utils");
const tsutils = __importStar(require("ts-api-utils"));
const getConstraintInfo_1 = require("./getConstraintInfo");
var Awaitable;
(function (Awaitable) {
Awaitable[Awaitable["Always"] = 0] = "Always";
@ -44,21 +45,17 @@ var Awaitable;
Awaitable[Awaitable["May"] = 2] = "May";
})(Awaitable || (exports.Awaitable = Awaitable = {}));
function needsToBeAwaited(checker, node, type) {
// can't use `getConstrainedTypeAtLocation` directly since it's bugged for
// unconstrained generics.
const constrainedType = !tsutils.isTypeParameter(type)
? type
: checker.getBaseConstraintOfType(type);
const { constraintType, isTypeParameter } = (0, getConstraintInfo_1.getConstraintInfo)(checker, type);
// unconstrained generic types should be treated as unknown
if (constrainedType == null) {
if (isTypeParameter && constraintType == null) {
return Awaitable.May;
}
// `any` and `unknown` types may need to be awaited
if ((0, type_utils_1.isTypeAnyType)(constrainedType) || (0, type_utils_1.isTypeUnknownType)(constrainedType)) {
if ((0, type_utils_1.isTypeAnyType)(constraintType) || (0, type_utils_1.isTypeUnknownType)(constraintType)) {
return Awaitable.May;
}
// 'thenable' values should always be be awaited
if (tsutils.isThenableType(checker, node, constrainedType)) {
if (tsutils.isThenableType(checker, node, constraintType)) {
return Awaitable.Always;
}
// anything else should not be awaited

View file

@ -1 +1 @@
{"version":3,"file":"needsToBeAwaited.js","sourceRoot":"","sources":["../../src/util/needsToBeAwaited.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,4CA4BC;AAxCD,8DAGuC;AACvC,sDAAwC;AAExC,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,6CAAM,CAAA;IACN,2CAAK,CAAA;IACL,uCAAG,CAAA;AACL,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB;AAED,SAAgB,gBAAgB,CAC9B,OAAuB,EACvB,IAAa,EACb,IAAa;IAEb,0EAA0E;IAC1E,0BAA0B;IAC1B,MAAM,eAAe,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC;QACpD,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAE1C,2DAA2D;IAC3D,IAAI,eAAe,IAAI,IAAI,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC,GAAG,CAAC;IACvB,CAAC;IAED,mDAAmD;IACnD,IAAI,IAAA,0BAAa,EAAC,eAAe,CAAC,IAAI,IAAA,8BAAiB,EAAC,eAAe,CAAC,EAAE,CAAC;QACzE,OAAO,SAAS,CAAC,GAAG,CAAC;IACvB,CAAC;IAED,gDAAgD;IAChD,IAAI,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,EAAE,CAAC;QAC3D,OAAO,SAAS,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED,sCAAsC;IACtC,OAAO,SAAS,CAAC,KAAK,CAAC;AACzB,CAAC"}
{"version":3,"file":"needsToBeAwaited.js","sourceRoot":"","sources":["../../src/util/needsToBeAwaited.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,4CAwBC;AAtCD,8DAGuC;AACvC,sDAAwC;AAExC,2DAAwD;AAExD,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,6CAAM,CAAA;IACN,2CAAK,CAAA;IACL,uCAAG,CAAA;AACL,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB;AAED,SAAgB,gBAAgB,CAC9B,OAAuB,EACvB,IAAa,EACb,IAAa;IAEb,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,IAAA,qCAAiB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAE7E,2DAA2D;IAC3D,IAAI,eAAe,IAAI,cAAc,IAAI,IAAI,EAAE,CAAC;QAC9C,OAAO,SAAS,CAAC,GAAG,CAAC;IACvB,CAAC;IAED,mDAAmD;IACnD,IAAI,IAAA,0BAAa,EAAC,cAAc,CAAC,IAAI,IAAA,8BAAiB,EAAC,cAAc,CAAC,EAAE,CAAC;QACvE,OAAO,SAAS,CAAC,GAAG,CAAC;IACvB,CAAC;IAED,gDAAgD;IAChD,IAAI,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC;QAC1D,OAAO,SAAS,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED,sCAAsC;IACtC,OAAO,SAAS,CAAC,KAAK,CAAC;AACzB,CAAC"}

View file

@ -22,6 +22,7 @@ The following nodes are considered boolean expressions and their type is checked
- Right-hand side operand is ignored when it's not a descendant of another boolean expression.
This is to allow usage of boolean operators for their short-circuiting behavior.
- Asserted argument of an assertion function (`assert(arg)`).
- Return type of array predicate functions such as `filter()`, `some()`, etc.
## Examples
@ -61,6 +62,9 @@ while (obj) {
declare function assert(value: unknown): asserts value;
let maybeString = Math.random() > 0.5 ? '' : undefined;
assert(maybeString);
// array predicates' return types are boolean contexts.
['one', null].filter(x => x);
```
</TabItem>

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
"version": "8.18.2",
"version": "8.19.0",
"description": "TypeScript scope analyser for ESLint",
"files": [
"dist",
@ -46,13 +46,13 @@
"typecheck": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2"
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@types/glob": "*",
"@typescript-eslint/typescript-estree": "8.18.2",
"@typescript-eslint/typescript-estree": "8.19.0",
"glob": "*",
"jest-specific-snapshot": "*",
"make-dir": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
"version": "8.18.2",
"version": "8.19.0",
"description": "Types for the TypeScript-ESTree AST spec",
"files": [
"dist",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
"version": "8.18.2",
"version": "8.19.0",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"files": [
"dist",
@ -54,8 +54,8 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2",
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",

View file

@ -1 +1 @@
{"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../src/json-schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B,KAAK,GACL,OAAO,GACP,SAAS,GACT,SAAS,GACT,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAE/D,MAAM,MAAM,uBAAuB,GAC/B,gBAAgB,GAChB,iBAAiB,GACjB,eAAe,CAAC;AAKpB,MAAM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B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEvC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE7B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE7B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEhC,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;IAE7B,IAAI,EAAE,SAAS,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;IAE1B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,IAAI,EAAE,KAAK,CAAC;CACb"}

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/utils",
"version": "8.18.2",
"version": "8.19.0",
"description": "Utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@ -64,9 +64,9 @@
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "8.18.2",
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/typescript-estree": "8.18.2"
"@typescript-eslint/scope-manager": "8.19.0",
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/typescript-estree": "8.19.0"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
"version": "8.18.2",
"version": "8.19.0",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"files": [
"dist",
@ -47,7 +47,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/types": "8.19.0",
"eslint-visitor-keys": "^4.2.0"
},
"devDependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin",
"version": "8.18.2",
"version": "8.19.0",
"description": "TypeScript plugin for ESLint",
"files": [
"dist",
@ -61,10 +61,10 @@
},
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.18.2",
"@typescript-eslint/type-utils": "8.18.2",
"@typescript-eslint/utils": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2",
"@typescript-eslint/scope-manager": "8.19.0",
"@typescript-eslint/type-utils": "8.19.0",
"@typescript-eslint/utils": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0",
"graphemer": "^1.4.0",
"ignore": "^5.3.1",
"natural-compare": "^1.4.0",
@ -75,8 +75,8 @@
"@types/marked": "^5.0.2",
"@types/mdast": "^4.0.3",
"@types/natural-compare": "*",
"@typescript-eslint/rule-schema-to-typescript-types": "8.18.2",
"@typescript-eslint/rule-tester": "8.18.2",
"@typescript-eslint/rule-schema-to-typescript-types": "8.19.0",
"@typescript-eslint/rule-tester": "8.19.0",
"ajv": "^6.12.6",
"cross-env": "^7.0.3",
"cross-fetch": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
"version": "8.18.2",
"version": "8.19.0",
"description": "TypeScript scope analyser for ESLint",
"files": [
"dist",
@ -46,13 +46,13 @@
"typecheck": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2"
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@types/glob": "*",
"@typescript-eslint/typescript-estree": "8.18.2",
"@typescript-eslint/typescript-estree": "8.19.0",
"glob": "*",
"jest-specific-snapshot": "*",
"make-dir": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
"version": "8.18.2",
"version": "8.19.0",
"description": "Types for the TypeScript-ESTree AST spec",
"files": [
"dist",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
"version": "8.18.2",
"version": "8.19.0",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"files": [
"dist",
@ -54,8 +54,8 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2",
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
"version": "8.18.2",
"version": "8.19.0",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"files": [
"dist",
@ -47,7 +47,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/types": "8.19.0",
"eslint-visitor-keys": "^4.2.0"
},
"devDependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/parser",
"version": "8.18.2",
"version": "8.19.0",
"description": "An ESLint custom parser which leverages TypeScript ESTree",
"files": [
"dist",
@ -53,10 +53,10 @@
"typescript": ">=4.8.4 <5.8.0"
},
"dependencies": {
"@typescript-eslint/scope-manager": "8.18.2",
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/typescript-estree": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2",
"@typescript-eslint/scope-manager": "8.19.0",
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/typescript-estree": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0",
"debug": "^4.3.4"
},
"devDependencies": {

View file

@ -1,7 +1,13 @@
import type { ParserServicesWithTypeInformation, TSESTree } from '@typescript-eslint/typescript-estree';
import type * as ts from 'typescript';
/**
* Resolves the given node's type. Will resolve to the type's generic constraint, if it has one.
* Resolves the given node's type. Will return the type's generic constraint, if it has one.
*
* Warning - if the type is generic and does _not_ have a constraint, the type will be
* returned as-is, rather than returning an `unknown` type. This can be checked
* for by checking for the type flag ts.TypeFlags.TypeParameter.
*
* @see https://github.com/typescript-eslint/typescript-eslint/issues/10438
*/
export declare function getConstrainedTypeAtLocation(services: ParserServicesWithTypeInformation, node: TSESTree.Node): ts.Type;
//# sourceMappingURL=getConstrainedTypeAtLocation.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"getConstrainedTypeAtLocation.d.ts","sourceRoot":"","sources":["../src/getConstrainedTypeAtLocation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EACjC,QAAQ,EACT,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,iCAAiC,EAC3C,IAAI,EAAE,QAAQ,CAAC,IAAI,GAClB,EAAE,CAAC,IAAI,CAOT"}
{"version":3,"file":"getConstrainedTypeAtLocation.d.ts","sourceRoot":"","sources":["../src/getConstrainedTypeAtLocation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EACjC,QAAQ,EACT,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,iCAAiC,EAC3C,IAAI,EAAE,QAAQ,CAAC,IAAI,GAClB,EAAE,CAAC,IAAI,CAOT"}

View file

@ -2,7 +2,13 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.getConstrainedTypeAtLocation = getConstrainedTypeAtLocation;
/**
* Resolves the given node's type. Will resolve to the type's generic constraint, if it has one.
* Resolves the given node's type. Will return the type's generic constraint, if it has one.
*
* Warning - if the type is generic and does _not_ have a constraint, the type will be
* returned as-is, rather than returning an `unknown` type. This can be checked
* for by checking for the type flag ts.TypeFlags.TypeParameter.
*
* @see https://github.com/typescript-eslint/typescript-eslint/issues/10438
*/
function getConstrainedTypeAtLocation(services, node) {
const nodeType = services.getTypeAtLocation(node);

View file

@ -1 +1 @@
{"version":3,"file":"getConstrainedTypeAtLocation.js","sourceRoot":"","sources":["../src/getConstrainedTypeAtLocation.ts"],"names":[],"mappings":";;AASA,oEAUC;AAbD;;GAEG;AACH,SAAgB,4BAA4B,CAC1C,QAA2C,EAC3C,IAAmB;IAEnB,MAAM,QAAQ,GAAG,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO;SACjC,cAAc,EAAE;SAChB,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAErC,OAAO,WAAW,IAAI,QAAQ,CAAC;AACjC,CAAC"}
{"version":3,"file":"getConstrainedTypeAtLocation.js","sourceRoot":"","sources":["../src/getConstrainedTypeAtLocation.ts"],"names":[],"mappings":";;AAeA,oEAUC;AAnBD;;;;;;;;GAQG;AACH,SAAgB,4BAA4B,CAC1C,QAA2C,EAC3C,IAAmB;IAEnB,MAAM,QAAQ,GAAG,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO;SACjC,cAAc,EAAE;SAChB,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAErC,OAAO,WAAW,IAAI,QAAQ,CAAC;AACjC,CAAC"}

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
"version": "8.18.2",
"version": "8.19.0",
"description": "TypeScript scope analyser for ESLint",
"files": [
"dist",
@ -46,13 +46,13 @@
"typecheck": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2"
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@types/glob": "*",
"@typescript-eslint/typescript-estree": "8.18.2",
"@typescript-eslint/typescript-estree": "8.19.0",
"glob": "*",
"jest-specific-snapshot": "*",
"make-dir": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
"version": "8.18.2",
"version": "8.19.0",
"description": "Types for the TypeScript-ESTree AST spec",
"files": [
"dist",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
"version": "8.18.2",
"version": "8.19.0",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"files": [
"dist",
@ -54,8 +54,8 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/visitor-keys": "8.18.2",
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/visitor-keys": "8.19.0",
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",

View file

@ -1 +1 @@
{"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../src/json-schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B,KAAK,GACL,OAAO,GACP,SAAS,GACT,SAAS,GACT,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAE/D,MAAM,MAAM,uBAAuB,GAC/B,gBAAgB,GAChB,iBAAiB,GACjB,eAAe,CAAC;AAKpB,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAAC;CACxC;AAKD,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,uBAAuB,CAAC;CAAG;AAE3E;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM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AAE,SAAS,GAAG,QAAQ,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;IAE7B,IAAI,EAAE,SAAS,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;IAE1B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,IAAI,EAAE,KAAK,CAAC;CACb"}

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/utils",
"version": "8.18.2",
"version": "8.19.0",
"description": "Utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@ -64,9 +64,9 @@
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "8.18.2",
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/typescript-estree": "8.18.2"
"@typescript-eslint/scope-manager": "8.19.0",
"@typescript-eslint/types": "8.19.0",
"@typescript-eslint/typescript-estree": "8.19.0"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
"version": "8.18.2",
"version": "8.19.0",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"files": [
"dist",
@ -47,7 +47,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "8.18.2",
"@typescript-eslint/types": "8.19.0",
"eslint-visitor-keys": "^4.2.0"
},
"devDependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/type-utils",
"version": "8.18.2",
"version": "8.19.0",
"description": "Type utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@ -46,8 +46,8 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/typescript-estree": "8.18.2",
"@typescript-eslint/utils": "8.18.2",
"@typescript-eslint/typescript-estree": "8.19.0",
"@typescript-eslint/utils": "8.19.0",
"debug": "^4.3.4",
"ts-api-utils": "^1.3.0"
},
@ -57,7 +57,7 @@
},
"devDependencies": {
"@jest/types": "29.6.3",
"@typescript-eslint/parser": "8.18.2",
"@typescript-eslint/parser": "8.19.0",
"ajv": "^6.12.6",
"downlevel-dts": "*",
"jest": "29.7.0",

335
node_modules/uuid/CHANGELOG.md generated vendored
View file

@ -1,335 +0,0 @@
# Change Log
## [11.0.3](https://github.com/uuidjs/uuid/compare/v11.0.2...v11.0.3) (2024-11-04)
### Bug Fixes
* apply stricter typing to the v* signatures ([#831](https://github.com/uuidjs/uuid/issues/831)) ([c2d3fed](https://github.com/uuidjs/uuid/commit/c2d3fed22cfd47c22c8f22f6154abb5060648ce5))
* export internal uuid types ([#833](https://github.com/uuidjs/uuid/issues/833)) ([341edf4](https://github.com/uuidjs/uuid/commit/341edf444ced63708ba336285dbec29443523939))
* remove sourcemaps ([#827](https://github.com/uuidjs/uuid/issues/827)) ([b93ea10](https://github.com/uuidjs/uuid/commit/b93ea101af7382053032d4fb61cc85599d6c7216))
* revert "simplify type for v3 and v5" ([#835](https://github.com/uuidjs/uuid/issues/835)) ([e2dee69](https://github.com/uuidjs/uuid/commit/e2dee691e95aba854a892d2507d8cd9f009bf61d))
## [11.0.2](https://github.com/uuidjs/uuid/compare/v11.0.1...v11.0.2) (2024-10-28)
### Bug Fixes
* remove wrapper.mjs ([#822](https://github.com/uuidjs/uuid/issues/822)) ([6683ad3](https://github.com/uuidjs/uuid/commit/6683ad38b048375b451eac1194960f24ba20e0ca))
## [11.0.1](https://github.com/uuidjs/uuid/compare/v11.0.0...v11.0.1) (2024-10-27)
### Bug Fixes
* restore package.json#browser field ([#817](https://github.com/uuidjs/uuid/issues/817)) ([ae8f386](https://github.com/uuidjs/uuid/commit/ae8f38657bca0ee053bf29c88c006b1ea05af1b5))
## [11.0.0](https://github.com/uuidjs/uuid/compare/v9.0.0...v11.0.0) (2024-10-26)
### ⚠ BREAKING CHANGES
- refactor v1 internal state and options logic (#780)
- refactor v7 internal state and options logic, fixes #764 (#779)
- Port to TypeScript, closes #762 (#763)
- update node support matrix (only support node 16-20) (#750)
### Features
- Port to TypeScript, closes [#762](https://github.com/uuidjs/uuid/issues/762) ([#763](https://github.com/uuidjs/uuid/issues/763)) ([1e0f987](https://github.com/uuidjs/uuid/commit/1e0f9870db864ca93f7a69db0d468b5e1b7605e7))
- update node support matrix (only support node 16-20) ([#750](https://github.com/uuidjs/uuid/issues/750)) ([883b163](https://github.com/uuidjs/uuid/commit/883b163b9ab9d6655bfbd8a35e61a3c71674dfe1))
### Bug Fixes
- missing v7 expectations in browser spec ([#751](https://github.com/uuidjs/uuid/issues/751)) ([f54a866](https://github.com/uuidjs/uuid/commit/f54a866cedb2b3b96581157c1f4ac935a0b11411))
- refactor v1 internal state and options logic ([#780](https://github.com/uuidjs/uuid/issues/780)) ([031b3d3](https://github.com/uuidjs/uuid/commit/031b3d3d738bc6694501ac0a37152b95ed500989))
- refactor v7 internal state and options logic, fixes [#764](https://github.com/uuidjs/uuid/issues/764) ([#779](https://github.com/uuidjs/uuid/issues/779)) ([9dbd1cd](https://github.com/uuidjs/uuid/commit/9dbd1cd4177c43fcaac961a3b16fb2d044c9940a))
- remove v4 options default assignment preventing native.randomUUID from being used ([#786](https://github.com/uuidjs/uuid/issues/786)) ([afe6232](https://github.com/uuidjs/uuid/commit/afe62323c4408a824755a39d7b971a8ae06f7199)), closes [#763](https://github.com/uuidjs/uuid/issues/763)
- seq_hi shift for byte 6 ([#775](https://github.com/uuidjs/uuid/issues/775)) ([1d532ca](https://github.com/uuidjs/uuid/commit/1d532ca374f181932a24a83fa98f71a5bd4f3e96))
- tsconfig module type ([#778](https://github.com/uuidjs/uuid/issues/778)) ([7eff835](https://github.com/uuidjs/uuid/commit/7eff835cba334ad418f57768c00d15b918a9b419))
## [10.0.0](https://github.com/uuidjs/uuid/compare/v9.0.0...v10.0.0) (2024-06-07)
### ⚠ BREAKING CHANGES
- update node support (drop node@12, node@14, add node@20) (#750)
### Features
- support support rfc9562 MAX uuid (new in RFC9562) ([#714](https://github.com/uuidjs/uuid/issues/714)) ([0385cd3](https://github.com/uuidjs/uuid/commit/0385cd3f18ae9920678b2849932fa7a9d9aee7d0))
- support rfc9562 v6 uuids ([#754](https://github.com/uuidjs/uuid/issues/754)) ([c4ed13e](https://github.com/uuidjs/uuid/commit/c4ed13e7159d87c9e42a349bdd9dc955f1af46b6))
- support rfc9562 v7 uuids ([#681](https://github.com/uuidjs/uuid/issues/681)) ([db76a12](https://github.com/uuidjs/uuid/commit/db76a1284760c441438f50a57924b322dae08891))
- update node support matrix (only support node 16-20) ([#750](https://github.com/uuidjs/uuid/issues/750)) ([883b163](https://github.com/uuidjs/uuid/commit/883b163b9ab9d6655bfbd8a35e61a3c71674dfe1))
- support rfc9562 v8 uuids ([#759](https://github.com/uuidjs/uuid/issues/759)) ([35a5342](https://github.com/uuidjs/uuid/commit/35a53428202657e402e6b4aa68f56c08194541bf))
### Bug Fixes
- revert "perf: remove superfluous call to toLowerCase ([#677](https://github.com/uuidjs/uuid/issues/677))" ([#738](https://github.com/uuidjs/uuid/issues/738)) ([e267b90](https://github.com/uuidjs/uuid/commit/e267b9073df1d0ce119ee53c0487fe76acb2be37))
## [9.0.1](https://github.com/uuidjs/uuid/compare/v9.0.0...v9.0.1) (2023-09-12)
### build
- Fix CI to work with Node.js 20.x
## [9.0.0](https://github.com/uuidjs/uuid/compare/v8.3.2...v9.0.0) (2022-09-05)
### ⚠ BREAKING CHANGES
- Drop Node.js 10.x support. This library always aims at supporting one EOLed LTS release which by this time now is 12.x which has reached EOL 30 Apr 2022.
- Remove the minified UMD build from the package.
Minified code is hard to audit and since this is a widely used library it seems more appropriate nowadays to optimize for auditability than to ship a legacy module format that, at best, serves educational purposes nowadays.
For production browser use cases, users should be using a bundler. For educational purposes, today's online sandboxes like replit.com offer convenient ways to load npm modules, so the use case for UMD through repos like UNPKG or jsDelivr has largely vanished.
- Drop IE 11 and Safari 10 support. Drop support for browsers that don't correctly implement const/let and default arguments, and no longer transpile the browser build to ES2015.
This also removes the fallback on msCrypto instead of the crypto API.
Browser tests are run in the first supported version of each supported browser and in the latest (as of this commit) version available on Browserstack.
### Features
- optimize uuid.v1 by 1.3x uuid.v4 by 4.3x (430%) ([#597](https://github.com/uuidjs/uuid/issues/597)) ([3a033f6](https://github.com/uuidjs/uuid/commit/3a033f6bab6bb3780ece6d645b902548043280bc))
- remove UMD build ([#645](https://github.com/uuidjs/uuid/issues/645)) ([e948a0f](https://github.com/uuidjs/uuid/commit/e948a0f22bf22f4619b27bd913885e478e20fe6f)), closes [#620](https://github.com/uuidjs/uuid/issues/620)
- use native crypto.randomUUID when available ([#600](https://github.com/uuidjs/uuid/issues/600)) ([c9e076c](https://github.com/uuidjs/uuid/commit/c9e076c852edad7e9a06baaa1d148cf4eda6c6c4))
### Bug Fixes
- add Jest/jsdom compatibility ([#642](https://github.com/uuidjs/uuid/issues/642)) ([16f9c46](https://github.com/uuidjs/uuid/commit/16f9c469edf46f0786164cdf4dc980743984a6fd))
- change default export to named function ([#545](https://github.com/uuidjs/uuid/issues/545)) ([c57bc5a](https://github.com/uuidjs/uuid/commit/c57bc5a9a0653273aa639cda9177ce52efabe42a))
- handle error when parameter is not set in v3 and v5 ([#622](https://github.com/uuidjs/uuid/issues/622)) ([fcd7388](https://github.com/uuidjs/uuid/commit/fcd73881692d9fabb63872576ba28e30ff852091))
- run npm audit fix ([#644](https://github.com/uuidjs/uuid/issues/644)) ([04686f5](https://github.com/uuidjs/uuid/commit/04686f54c5fed2cfffc1b619f4970c4bb8532353))
- upgrading from uuid3 broken link ([#568](https://github.com/uuidjs/uuid/issues/568)) ([1c849da](https://github.com/uuidjs/uuid/commit/1c849da6e164259e72e18636726345b13a7eddd6))
### build
- drop Node.js 8.x from babel transpile target ([#603](https://github.com/uuidjs/uuid/issues/603)) ([aa11485](https://github.com/uuidjs/uuid/commit/aa114858260402107ec8a1e1a825dea0a259bcb5))
- drop support for legacy browsers (IE11, Safari 10) ([#604](https://github.com/uuidjs/uuid/issues/604)) ([0f433e5](https://github.com/uuidjs/uuid/commit/0f433e5ec444edacd53016de67db021102f36148))
- drop node 10.x to upgrade dev dependencies ([#653](https://github.com/uuidjs/uuid/issues/653)) ([28a5712](https://github.com/uuidjs/uuid/commit/28a571283f8abda6b9d85e689f95b7d3ee9e282e)), closes [#643](https://github.com/uuidjs/uuid/issues/643)
### [8.3.2](https://github.com/uuidjs/uuid/compare/v8.3.1...v8.3.2) (2020-12-08)
### Bug Fixes
- lazy load getRandomValues ([#537](https://github.com/uuidjs/uuid/issues/537)) ([16c8f6d](https://github.com/uuidjs/uuid/commit/16c8f6df2f6b09b4d6235602d6a591188320a82e)), closes [#536](https://github.com/uuidjs/uuid/issues/536)
### [8.3.1](https://github.com/uuidjs/uuid/compare/v8.3.0...v8.3.1) (2020-10-04)
### Bug Fixes
- support expo>=39.0.0 ([#515](https://github.com/uuidjs/uuid/issues/515)) ([c65a0f3](https://github.com/uuidjs/uuid/commit/c65a0f3fa73b901959d638d1e3591dfacdbed867)), closes [#375](https://github.com/uuidjs/uuid/issues/375)
## [8.3.0](https://github.com/uuidjs/uuid/compare/v8.2.0...v8.3.0) (2020-07-27)
### Features
- add parse/stringify/validate/version/NIL APIs ([#479](https://github.com/uuidjs/uuid/issues/479)) ([0e6c10b](https://github.com/uuidjs/uuid/commit/0e6c10ba1bf9517796ff23c052fc0468eedfd5f4)), closes [#475](https://github.com/uuidjs/uuid/issues/475) [#478](https://github.com/uuidjs/uuid/issues/478) [#480](https://github.com/uuidjs/uuid/issues/480) [#481](https://github.com/uuidjs/uuid/issues/481) [#180](https://github.com/uuidjs/uuid/issues/180)
## [8.2.0](https://github.com/uuidjs/uuid/compare/v8.1.0...v8.2.0) (2020-06-23)
### Features
- improve performance of v1 string representation ([#453](https://github.com/uuidjs/uuid/issues/453)) ([0ee0b67](https://github.com/uuidjs/uuid/commit/0ee0b67c37846529c66089880414d29f3ae132d5))
- remove deprecated v4 string parameter ([#454](https://github.com/uuidjs/uuid/issues/454)) ([88ce3ca](https://github.com/uuidjs/uuid/commit/88ce3ca0ba046f60856de62c7ce03f7ba98ba46c)), closes [#437](https://github.com/uuidjs/uuid/issues/437)
- support jspm ([#473](https://github.com/uuidjs/uuid/issues/473)) ([e9f2587](https://github.com/uuidjs/uuid/commit/e9f2587a92575cac31bc1d4ae944e17c09756659))
### Bug Fixes
- prepare package exports for webpack 5 ([#468](https://github.com/uuidjs/uuid/issues/468)) ([8d6e6a5](https://github.com/uuidjs/uuid/commit/8d6e6a5f8965ca9575eb4d92e99a43435f4a58a8))
## [8.1.0](https://github.com/uuidjs/uuid/compare/v8.0.0...v8.1.0) (2020-05-20)
### Features
- improve v4 performance by reusing random number array ([#435](https://github.com/uuidjs/uuid/issues/435)) ([bf4af0d](https://github.com/uuidjs/uuid/commit/bf4af0d711b4d2ed03d1f74fd12ad0baa87dc79d))
- optimize V8 performance of bytesToUuid ([#434](https://github.com/uuidjs/uuid/issues/434)) ([e156415](https://github.com/uuidjs/uuid/commit/e156415448ec1af2351fa0b6660cfb22581971f2))
### Bug Fixes
- export package.json required by react-native and bundlers ([#449](https://github.com/uuidjs/uuid/issues/449)) ([be1c8fe](https://github.com/uuidjs/uuid/commit/be1c8fe9a3206c358e0059b52fafd7213aa48a52)), closes [ai/nanoevents#44](https://github.com/ai/nanoevents/issues/44#issuecomment-602010343) [#444](https://github.com/uuidjs/uuid/issues/444)
## [8.0.0](https://github.com/uuidjs/uuid/compare/v7.0.3...v8.0.0) (2020-04-29)
### ⚠ BREAKING CHANGES
- For native ECMAScript Module (ESM) usage in Node.js only named exports are exposed, there is no more default export.
```diff
-import uuid from 'uuid';
-console.log(uuid.v4()); // -> 'cd6c3b08-0adc-4f4b-a6ef-36087a1c9869'
+import { v4 as uuidv4 } from 'uuid';
+uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
```
- Deep requiring specific algorithms of this library like `require('uuid/v4')`, which has been deprecated in `uuid@7`, is no longer supported.
Instead use the named exports that this module exports.
For ECMAScript Modules (ESM):
```diff
-import uuidv4 from 'uuid/v4';
+import { v4 as uuidv4 } from 'uuid';
uuidv4();
```
For CommonJS:
```diff
-const uuidv4 = require('uuid/v4');
+const { v4: uuidv4 } = require('uuid');
uuidv4();
```
### Features
- native Node.js ES Modules (wrapper approach) ([#423](https://github.com/uuidjs/uuid/issues/423)) ([2d9f590](https://github.com/uuidjs/uuid/commit/2d9f590ad9701d692625c07ed62f0a0f91227991)), closes [#245](https://github.com/uuidjs/uuid/issues/245) [#419](https://github.com/uuidjs/uuid/issues/419) [#342](https://github.com/uuidjs/uuid/issues/342)
- remove deep requires ([#426](https://github.com/uuidjs/uuid/issues/426)) ([daf72b8](https://github.com/uuidjs/uuid/commit/daf72b84ceb20272a81bb5fbddb05dd95922cbba))
### Bug Fixes
- add CommonJS syntax example to README quickstart section ([#417](https://github.com/uuidjs/uuid/issues/417)) ([e0ec840](https://github.com/uuidjs/uuid/commit/e0ec8402c7ad44b7ef0453036c612f5db513fda0))
### [7.0.3](https://github.com/uuidjs/uuid/compare/v7.0.2...v7.0.3) (2020-03-31)
### Bug Fixes
- make deep require deprecation warning work in browsers ([#409](https://github.com/uuidjs/uuid/issues/409)) ([4b71107](https://github.com/uuidjs/uuid/commit/4b71107d8c0d2ef56861ede6403fc9dc35a1e6bf)), closes [#408](https://github.com/uuidjs/uuid/issues/408)
### [7.0.2](https://github.com/uuidjs/uuid/compare/v7.0.1...v7.0.2) (2020-03-04)
### Bug Fixes
- make access to msCrypto consistent ([#393](https://github.com/uuidjs/uuid/issues/393)) ([8bf2a20](https://github.com/uuidjs/uuid/commit/8bf2a20f3565df743da7215eebdbada9d2df118c))
- simplify link in deprecation warning ([#391](https://github.com/uuidjs/uuid/issues/391)) ([bb2c8e4](https://github.com/uuidjs/uuid/commit/bb2c8e4e9f4c5f9c1eaaf3ea59710c633cd90cb7))
- update links to match content in readme ([#386](https://github.com/uuidjs/uuid/issues/386)) ([44f2f86](https://github.com/uuidjs/uuid/commit/44f2f86e9d2bbf14ee5f0f00f72a3db1292666d4))
### [7.0.1](https://github.com/uuidjs/uuid/compare/v7.0.0...v7.0.1) (2020-02-25)
### Bug Fixes
- clean up esm builds for node and browser ([#383](https://github.com/uuidjs/uuid/issues/383)) ([59e6a49](https://github.com/uuidjs/uuid/commit/59e6a49e7ce7b3e8fb0f3ee52b9daae72af467dc))
- provide browser versions independent from module system ([#380](https://github.com/uuidjs/uuid/issues/380)) ([4344a22](https://github.com/uuidjs/uuid/commit/4344a22e7aed33be8627eeaaf05360f256a21753)), closes [#378](https://github.com/uuidjs/uuid/issues/378)
## [7.0.0](https://github.com/uuidjs/uuid/compare/v3.4.0...v7.0.0) (2020-02-24)
### ⚠ BREAKING CHANGES
- The default export, which used to be the v4() method but which was already discouraged in v3.x of this library, has been removed.
- Explicitly note that deep imports of the different uuid version functions are deprecated and no longer encouraged and that ECMAScript module named imports should be used instead. Emit a deprecation warning for people who deep-require the different algorithm variants.
- Remove builtin support for insecure random number generators in the browser. Users who want that will have to supply their own random number generator function.
- Remove support for generating v3 and v5 UUIDs in Node.js<4.x
- Convert code base to ECMAScript Modules (ESM) and release CommonJS build for node and ESM build for browser bundlers.
### Features
- add UMD build to npm package ([#357](https://github.com/uuidjs/uuid/issues/357)) ([4e75adf](https://github.com/uuidjs/uuid/commit/4e75adf435196f28e3fbbe0185d654b5ded7ca2c)), closes [#345](https://github.com/uuidjs/uuid/issues/345)
- add various es module and CommonJS examples ([b238510](https://github.com/uuidjs/uuid/commit/b238510bf352463521f74bab175a3af9b7a42555))
- ensure that docs are up-to-date in CI ([ee5e77d](https://github.com/uuidjs/uuid/commit/ee5e77db547474f5a8f23d6c857a6d399209986b))
- hybrid CommonJS & ECMAScript modules build ([a3f078f](https://github.com/uuidjs/uuid/commit/a3f078faa0baff69ab41aed08e041f8f9c8993d0))
- remove insecure fallback random number generator ([3a5842b](https://github.com/uuidjs/uuid/commit/3a5842b141a6e5de0ae338f391661e6b84b167c9)), closes [#173](https://github.com/uuidjs/uuid/issues/173)
- remove support for pre Node.js v4 Buffer API ([#356](https://github.com/uuidjs/uuid/issues/356)) ([b59b5c5](https://github.com/uuidjs/uuid/commit/b59b5c5ecad271c5453f1a156f011671f6d35627))
- rename repository to github:uuidjs/uuid ([#351](https://github.com/uuidjs/uuid/issues/351)) ([c37a518](https://github.com/uuidjs/uuid/commit/c37a518e367ac4b6d0aa62dba1bc6ce9e85020f7)), closes [#338](https://github.com/uuidjs/uuid/issues/338)
### Bug Fixes
- add deep-require proxies for local testing and adjust tests ([#365](https://github.com/uuidjs/uuid/issues/365)) ([7fedc79](https://github.com/uuidjs/uuid/commit/7fedc79ac8fda4bfd1c566c7f05ef4ac13b2db48))
- add note about removal of default export ([#372](https://github.com/uuidjs/uuid/issues/372)) ([12749b7](https://github.com/uuidjs/uuid/commit/12749b700eb49db8a9759fd306d8be05dbfbd58c)), closes [#370](https://github.com/uuidjs/uuid/issues/370)
- deprecated deep requiring of the different algorithm versions ([#361](https://github.com/uuidjs/uuid/issues/361)) ([c0bdf15](https://github.com/uuidjs/uuid/commit/c0bdf15e417639b1aeb0b247b2fb11f7a0a26b23))
## [3.4.0](https://github.com/uuidjs/uuid/compare/v3.3.3...v3.4.0) (2020-01-16)
### Features
- rename repository to github:uuidjs/uuid ([#351](https://github.com/uuidjs/uuid/issues/351)) ([e2d7314](https://github.com/uuidjs/uuid/commit/e2d7314)), closes [#338](https://github.com/uuidjs/uuid/issues/338)
## [3.3.3](https://github.com/uuidjs/uuid/compare/v3.3.2...v3.3.3) (2019-08-19)
### Bug Fixes
- no longer run ci tests on node v4
- upgrade dependencies
## [3.3.2](https://github.com/uuidjs/uuid/compare/v3.3.1...v3.3.2) (2018-06-28)
### Bug Fixes
- typo ([305d877](https://github.com/uuidjs/uuid/commit/305d877))
## [3.3.1](https://github.com/uuidjs/uuid/compare/v3.3.0...v3.3.1) (2018-06-28)
### Bug Fixes
- fix [#284](https://github.com/uuidjs/uuid/issues/284) by setting function name in try-catch ([f2a60f2](https://github.com/uuidjs/uuid/commit/f2a60f2))
# [3.3.0](https://github.com/uuidjs/uuid/compare/v3.2.1...v3.3.0) (2018-06-22)
### Bug Fixes
- assignment to readonly property to allow running in strict mode ([#270](https://github.com/uuidjs/uuid/issues/270)) ([d062fdc](https://github.com/uuidjs/uuid/commit/d062fdc))
- fix [#229](https://github.com/uuidjs/uuid/issues/229) ([c9684d4](https://github.com/uuidjs/uuid/commit/c9684d4))
- Get correct version of IE11 crypto ([#274](https://github.com/uuidjs/uuid/issues/274)) ([153d331](https://github.com/uuidjs/uuid/commit/153d331))
- mem issue when generating uuid ([#267](https://github.com/uuidjs/uuid/issues/267)) ([c47702c](https://github.com/uuidjs/uuid/commit/c47702c))
### Features
- enforce Conventional Commit style commit messages ([#282](https://github.com/uuidjs/uuid/issues/282)) ([cc9a182](https://github.com/uuidjs/uuid/commit/cc9a182))
## [3.2.1](https://github.com/uuidjs/uuid/compare/v3.2.0...v3.2.1) (2018-01-16)
### Bug Fixes
- use msCrypto if available. Fixes [#241](https://github.com/uuidjs/uuid/issues/241) ([#247](https://github.com/uuidjs/uuid/issues/247)) ([1fef18b](https://github.com/uuidjs/uuid/commit/1fef18b))
# [3.2.0](https://github.com/uuidjs/uuid/compare/v3.1.0...v3.2.0) (2018-01-16)
### Bug Fixes
- remove mistakenly added typescript dependency, rollback version (standard-version will auto-increment) ([09fa824](https://github.com/uuidjs/uuid/commit/09fa824))
- use msCrypto if available. Fixes [#241](https://github.com/uuidjs/uuid/issues/241) ([#247](https://github.com/uuidjs/uuid/issues/247)) ([1fef18b](https://github.com/uuidjs/uuid/commit/1fef18b))
### Features
- Add v3 Support ([#217](https://github.com/uuidjs/uuid/issues/217)) ([d94f726](https://github.com/uuidjs/uuid/commit/d94f726))
# [3.1.0](https://github.com/uuidjs/uuid/compare/v3.1.0...v3.0.1) (2017-06-17)
### Bug Fixes
- (fix) Add .npmignore file to exclude test/ and other non-essential files from packing. (#183)
- Fix typo (#178)
- Simple typo fix (#165)
### Features
- v5 support in CLI (#197)
- V5 support (#188)
# 3.0.1 (2016-11-28)
- split uuid versions into separate files
# 3.0.0 (2016-11-17)
- remove .parse and .unparse
# 2.0.0
- Removed uuid.BufferClass
# 1.4.0
- Improved module context detection
- Removed public RNG functions
# 1.3.2
- Improve tests and handling of v1() options (Issue #24)
- Expose RNG option to allow for perf testing with different generators
# 1.3.0
- Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)!
- Support for node.js crypto API
- De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code

18
node_modules/uuid/CONTRIBUTING.md generated vendored
View file

@ -1,18 +0,0 @@
# Contributing
Please feel free to file GitHub Issues or propose Pull Requests. We're always happy to discuss improvements to this library!
## Testing
```shell
npm test
```
## Releasing
Releases are supposed to be done from master, version bumping is automated through [`standard-version`](https://github.com/conventional-changelog/standard-version):
```shell
npm run release -- --dry-run # verify output manually
npm run release # follow the instructions from the output of this command
```

45
node_modules/uuid/README.md generated vendored
View file

@ -2,16 +2,15 @@
-- This file is auto-generated from README_js.md. Changes should be made there.
-->
# uuid [![CI](https://github.com/uuidjs/uuid/workflows/CI/badge.svg)](https://github.com/uuidjs/uuid/actions?query=workflow%3ACI) [![Browser](https://github.com/uuidjs/uuid/workflows/Browser/badge.svg)](https://github.com/uuidjs/uuid/actions?query=workflow%3ABrowser)
For the creation of [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (formally [RFC4122](https://www.rfc-editor.org/rfc/rfc4122.html)) UUIDs
- **Complete** - Support for all RFC9562 UUID versions
- **Cross-platform** - Support for ...
- CommonJS, [ECMAScript Modules](#ecmascript-modules)
- NodeJS 16+ ([LTS releases](https://github.com/nodejs/Release))
- Chrome, Safari, Firefox, Edge browsers
- **Cross-platform** - Support for...
- ESM & Common JS
- [Chrome, Safari, Firefox, Edge browsers](#support)
- [NodeJS](#support)
- [React Native / Expo](#react-native--expo)
- **Secure** - Cryptographically-strong random values
- **Compact** - No dependencies, [tree-shakable](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking)
@ -117,13 +116,13 @@ Example:
import { parse as uuidParse } from 'uuid';
// Parse a UUID
uuidParse('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨
// Uint8Array(16) [
// 110, 192, 189, 127, 17,
// 192, 67, 218, 151, 94,
// 42, 138, 217, 235, 174,
// 11
// ]
uuidParse('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨
// Uint8Array(16) [
// 110, 192, 189, 127, 17,
// 192, 67, 218, 151, 94,
// 42, 138, 217, 235, 174,
// 11
// ]
```
### uuid.stringify(arr[, offset])
@ -367,7 +366,7 @@ Create an RFC version 7 (random) UUID
| [`options.msecs = (current time)`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) |
| [`options.random = (random)`] | `Array` of 16 random bytes (0-255) used to generate other fields, above |
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
| [`options.seq = (random)`] | 32-bit sequence `Number` between 0 - 0xffffffff. This may be provided to help insure uniqueness for UUIDs generated within the same millisecond time interval. Default = random value. |
| [`options.seq = (random)`] | 32-bit sequence `Number` between 0 - 0xffffffff. This may be provided to help ensure uniqueness for UUIDs generated within the same millisecond time interval. Default = random value. |
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` |
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
@ -475,14 +474,28 @@ defined by RFC9562
## `options` Handling for Timestamp UUIDs
Prior to `uuid@11`, it was possible for `options` state to interfere with the internal state used to insure uniqueness of timestamp-based UUIDs (the `v1()`, `v6()`, and `v7()` methods). Starting with `uuid@11`, this issue has been addressed by using the presence of the `options` argument as a flag to select between two possible behaviors:
Prior to `uuid@11`, it was possible for `options` state to interfere with the internal state used to ensure uniqueness of timestamp-based UUIDs (the `v1()`, `v6()`, and `v7()` methods). Starting with `uuid@11`, this issue has been addressed by using the presence of the `options` argument as a flag to select between two possible behaviors:
- Without `options`: Internal state is utilized to improve UUID uniqueness.
- With `options`: Internal state is **NOT** used and, instead, appropriate defaults are applied as needed.
## Support
**Browsers**: `uuid` [builds are tested](/uuidjs/uuid/blob/main/wdio.conf.js) against the latest version of desktop Chrome, Safari, Firefox, and Edge. Mobile versions of these same browsers are expected to work but aren't currently tested.
**Node**: `uuid` [builds are tested](https://github.com/uuidjs/uuid/blob/main/.github/workflows/ci.yml#L26-L27) against node ([LTS releases](https://github.com/nodejs/Release)), plus one prior. E.g. `node@18` is in maintainence mode, and `node@22` is the current LTS release. So `uuid` supports `node@16`-`node@22`.
**Typescript**: TS versions released within the past two years are supported. [source](https://github.com/microsoft/TypeScript/issues/49088#issuecomment-2468723715)
## Known issues
### React Native / Expo
<!-- This header is referenced as an anchor in src/rng-browser.ts -->
### "getRandomValues() not supported"
This error occurs in environments where the standard [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) API is not supported. This issue can be resolved by adding an appropriate polyfill:
#### React Native / Expo
1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme)
1. Import it _before_ `uuid`. Since `uuid` might also appear as a transitive dependency of some other imports it's safest to just import `react-native-get-random-values` as the very first thing in your entry point:
@ -494,4 +507,4 @@ import { v4 as uuidv4 } from 'uuid';
---
Markdown generated from [README_js.md](README_js.md) by <a href="https://github.com/broofa/runmd"><image height="12px" src="https://camo.githubusercontent.com/5c7c603cd1e6a43370b0a5063d457e0dabb74cf317adc7baba183acb686ee8d0/687474703a2f2f692e696d6775722e636f6d2f634a4b6f3662552e706e67" /></a>
Markdown generated from [README_js.md](README_js.md) by <a href="https://github.com/broofa/runmd"><image height="13" src="https://camo.githubusercontent.com/5c7c603cd1e6a43370b0a5063d457e0dabb74cf317adc7baba183acb686ee8d0/687474703a2f2f692e696d6775722e636f6d2f634a4b6f3662552e706e67" /></a>

View file

@ -1,2 +1,2 @@
declare function md5(bytes: Uint8Array): Uint8Array;
declare function md5(bytes: Uint8Array): Uint8Array<ArrayBuffer>;
export default md5;

View file

@ -1,2 +1,2 @@
declare function parse(uuid: string): Uint8Array;
declare function parse(uuid: string): Uint8Array<ArrayBuffer>;
export default parse;

View file

@ -1 +1 @@
export default function rng(): Uint8Array;
export default function rng(): Uint8Array<ArrayBuffer>;

View file

@ -1 +0,0 @@
export {};

View file

@ -1,50 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const parse_js_1 = require("../parse.js");
const stringify_js_1 = require("../stringify.js");
const v4_js_1 = require("../v4.js");
function splitmix32(a) {
return function () {
a |= 0;
a = (a + 0x9e3779b9) | 0;
let t = a ^ (a >>> 16);
t = Math.imul(t, 0x21f0aaad);
t = t ^ (t >>> 15);
t = Math.imul(t, 0x735a2d97);
return ((t = t ^ (t >>> 15)) >>> 0) / 4294967296;
};
}
const rand = splitmix32(0x12345678);
function rng(bytes = new Uint8Array(16)) {
for (let i = 0; i < 16; i++) {
bytes[i] = rand() * 256;
}
return bytes;
}
(0, node_test_1.describe)('parse', () => {
(0, node_test_1.default)('String -> bytes parsing', () => {
assert.deepStrictEqual((0, parse_js_1.default)('0f5abcd1-c194-47f3-905b-2df7263a084b'), Uint8Array.from([
0x0f, 0x5a, 0xbc, 0xd1, 0xc1, 0x94, 0x47, 0xf3, 0x90, 0x5b, 0x2d, 0xf7, 0x26, 0x3a, 0x08,
0x4b,
]));
});
(0, node_test_1.default)('String -> bytes -> string symmetry for assorted uuids', () => {
for (let i = 0; i < 1000; i++) {
const uuid = (0, v4_js_1.default)({ rng });
assert.equal((0, stringify_js_1.default)((0, parse_js_1.default)(uuid)), uuid);
}
});
(0, node_test_1.default)('Case neutrality', () => {
assert.deepStrictEqual((0, parse_js_1.default)('0f5abcd1-c194-47f3-905b-2df7263a084b'), (0, parse_js_1.default)('0f5abcd1-c194-47f3-905b-2df7263a084b'.toUpperCase()));
});
(0, node_test_1.default)('Null UUID case', () => {
assert.deepStrictEqual((0, parse_js_1.default)('00000000-0000-0000-0000-000000000000'), Uint8Array.from(new Array(16).fill(0)));
});
(0, node_test_1.default)('UUID validation', () => {
assert.throws(() => (0, parse_js_1.default)());
assert.throws(() => (0, parse_js_1.default)('invalid uuid'));
assert.throws(() => (0, parse_js_1.default)('zyxwvuts-rqpo-nmlk-jihg-fedcba000000'));
});
});

View file

@ -1 +0,0 @@
export {};

View file

@ -1,14 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const rng_js_1 = require("../rng.js");
(0, node_test_1.describe)('rng', () => {
(0, node_test_1.default)('Node.js RNG', () => {
const bytes = (0, rng_js_1.default)();
assert.equal(bytes.length, 16);
for (let i = 0; i < bytes.length; ++i) {
assert.equal(typeof bytes[i], 'number');
}
});
});

View file

@ -1 +0,0 @@
export {};

View file

@ -1,23 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const stringify_js_1 = require("../stringify.js");
const BYTES = Uint8Array.of(0x0f, 0x5a, 0xbc, 0xd1, 0xc1, 0x94, 0x47, 0xf3, 0x90, 0x5b, 0x2d, 0xf7, 0x26, 0x3a, 0x08, 0x4b);
(0, node_test_1.describe)('stringify', () => {
(0, node_test_1.default)('Stringify Array (unsafe)', () => {
assert.equal((0, stringify_js_1.unsafeStringify)(BYTES), '0f5abcd1-c194-47f3-905b-2df7263a084b');
});
(0, node_test_1.default)('Stringify w/ offset (unsafe)', () => {
const bytes = new Uint8Array(19).fill(0);
bytes.set(BYTES, 3);
assert.equal((0, stringify_js_1.unsafeStringify)(bytes, 3), '0f5abcd1-c194-47f3-905b-2df7263a084b');
});
(0, node_test_1.default)('Stringify Array (safe)', () => {
assert.equal((0, stringify_js_1.default)(BYTES), '0f5abcd1-c194-47f3-905b-2df7263a084b');
});
(0, node_test_1.default)('Throws on not enough values (safe)', () => {
const bytes = BYTES.slice(0, 15);
assert.throws(() => (0, stringify_js_1.default)(bytes));
});
});

View file

@ -1,33 +0,0 @@
export declare const TESTS: ({
value: string;
expectedValidate: boolean;
expectedVersion: number;
} | {
value: string;
expectedValidate: boolean;
expectedVersion?: undefined;
} | {
value: undefined;
expectedValidate: boolean;
expectedVersion?: undefined;
} | {
value: null;
expectedValidate: boolean;
expectedVersion?: undefined;
} | {
value: number;
expectedValidate: boolean;
expectedVersion?: undefined;
} | {
value: RegExp;
expectedValidate: boolean;
expectedVersion?: undefined;
} | {
value: Date;
expectedValidate: boolean;
expectedVersion?: undefined;
} | {
value: boolean;
expectedValidate: boolean;
expectedVersion?: undefined;
})[];

View file

@ -1,91 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TESTS = void 0;
const max_js_1 = require("../max.js");
const nil_js_1 = require("../nil.js");
exports.TESTS = [
{ value: nil_js_1.default, expectedValidate: true, expectedVersion: 0 },
{ value: max_js_1.default, expectedValidate: true, expectedVersion: 15 },
{ value: '00000000-0000-1000-8000-000000000000', expectedValidate: true, expectedVersion: 1 },
{ value: 'ffffffff-ffff-1fff-8fff-ffffffffffff', expectedValidate: true, expectedVersion: 1 },
{ value: '00000000-0000-2000-8000-000000000000', expectedValidate: true, expectedVersion: 2 },
{ value: 'ffffffff-ffff-2fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 2 },
{ value: '00000000-0000-3000-8000-000000000000', expectedValidate: true, expectedVersion: 3 },
{ value: 'ffffffff-ffff-3fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 3 },
{ value: '00000000-0000-4000-8000-000000000000', expectedValidate: true, expectedVersion: 4 },
{ value: 'ffffffff-ffff-4fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 4 },
{ value: '00000000-0000-5000-8000-000000000000', expectedValidate: true, expectedVersion: 5 },
{ value: 'ffffffff-ffff-5fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 5 },
{ value: '00000000-0000-6000-8000-000000000000', expectedValidate: true, expectedVersion: 6 },
{ value: 'ffffffff-ffff-6fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 6 },
{ value: '00000000-0000-7000-8000-000000000000', expectedValidate: true, expectedVersion: 7 },
{ value: 'ffffffff-ffff-7fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 7 },
{ value: '00000000-0000-8000-8000-000000000000', expectedValidate: true, expectedVersion: 8 },
{ value: 'ffffffff-ffff-8fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 8 },
{ value: '00000000-0000-9000-8000-000000000000', expectedValidate: false },
{ value: 'ffffffff-ffff-9fff-bfff-ffffffffffff', expectedValidate: false },
{ value: '00000000-0000-a000-8000-000000000000', expectedValidate: false },
{ value: 'ffffffff-ffff-afff-bfff-ffffffffffff', expectedValidate: false },
{ value: '00000000-0000-b000-8000-000000000000', expectedValidate: false },
{ value: 'ffffffff-ffff-bfff-bfff-ffffffffffff', expectedValidate: false },
{ value: '00000000-0000-c000-8000-000000000000', expectedValidate: false },
{ value: 'ffffffff-ffff-cfff-bfff-ffffffffffff', expectedValidate: false },
{ value: '00000000-0000-d000-8000-000000000000', expectedValidate: false },
{ value: 'ffffffff-ffff-dfff-bfff-ffffffffffff', expectedValidate: false },
{ value: '00000000-0000-e000-8000-000000000000', expectedValidate: false },
{ value: 'ffffffff-ffff-efff-bfff-ffffffffffff', expectedValidate: false },
{ value: 'd9428888-122b-11e1-b85c-61cd3cbb3210', expectedValidate: true, expectedVersion: 1 },
{ value: '000003e8-2363-21ef-b200-325096b39f47', expectedValidate: true, expectedVersion: 2 },
{ value: 'a981a0c2-68b1-35dc-bcfc-296e52ab01ec', expectedValidate: true, expectedVersion: 3 },
{ value: '109156be-c4fb-41ea-b1b4-efe1671c5836', expectedValidate: true, expectedVersion: 4 },
{ value: '90123e1c-7512-523e-bb28-76fab9f2f73d', expectedValidate: true, expectedVersion: 5 },
{ value: '1ef21d2f-1207-6660-8c4f-419efbd44d48', expectedValidate: true, expectedVersion: 6 },
{ value: '017f22e2-79b0-7cc3-98c4-dc0c0c07398f', expectedValidate: true, expectedVersion: 7 },
{ value: '0d8f23a0-697f-83ae-802e-48f3756dd581', expectedValidate: true, expectedVersion: 8 },
{ value: '00000000-0000-1000-0000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-1000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-2000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-3000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-4000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-5000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-6000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-7000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-8000-000000000000', expectedValidate: true, expectedVersion: 1 },
{ value: '00000000-0000-1000-9000-000000000000', expectedValidate: true, expectedVersion: 1 },
{ value: '00000000-0000-1000-a000-000000000000', expectedValidate: true, expectedVersion: 1 },
{ value: '00000000-0000-1000-b000-000000000000', expectedValidate: true, expectedVersion: 1 },
{ value: '00000000-0000-1000-c000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-d000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-e000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-f000-000000000000', expectedValidate: false },
{ value: '00000000000000000000000000000000', expectedValidate: false },
{ value: '', expectedValidate: false },
{ value: 'invalid uuid string', expectedValidate: false },
{
value: '=Y00a-f*vb*-c-d#-p00f\b-g0h-#i^-j*3&-L00k-\nl---00n-fg000-00p-00r+',
expectedValidate: false,
},
{ value: undefined, expectedValidate: false },
{ value: null, expectedValidate: false },
{ value: 123, expectedValidate: false },
{ value: /regex/, expectedValidate: false },
{ value: new Date(0), expectedValidate: false },
{ value: false, expectedValidate: false },
];
for (let charIndex = 0; charIndex < 36; charIndex++) {
if (charIndex === 8 ||
charIndex === 13 ||
charIndex === 14 ||
charIndex === 18 ||
charIndex === 23) {
continue;
}
const nilChars = nil_js_1.default.split('');
const maxChars = max_js_1.default.split('');
for (let i = 0; i < 4; i++) {
nilChars[charIndex] = (0x0 ^ (1 << i)).toString(16);
exports.TESTS.push({ value: nilChars.join(''), expectedValidate: false });
maxChars[charIndex] = (0xf ^ (1 << i)).toString(16);
exports.TESTS.push({ value: maxChars.join(''), expectedValidate: false });
}
}

View file

@ -1 +0,0 @@
export {};

View file

@ -1,127 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const parse_js_1 = require("../parse.js");
const v1_js_1 = require("../v1.js");
const TIME = 1321644961388;
const RFC_V1 = 'c232ab00-9414-11ec-b3c8-9f68deced846';
const RFC_V1_BYTES = (0, parse_js_1.default)(RFC_V1);
const RFC_OPTIONS = {
msecs: 0x17f22e279b0,
nsecs: 0,
clockseq: 0x33c8,
node: Uint8Array.of(0x9f, 0x68, 0xde, 0xce, 0xd8, 0x46),
};
const RFC_RANDOM = Uint8Array.of(0, 0, 0, 0, 0, 0, 0, 0, RFC_OPTIONS.clockseq >> 8, RFC_OPTIONS.clockseq & 0xff, ...RFC_OPTIONS.node);
function compareV1TimeField(a, b) {
a = a.split('-').slice(0, 3).reverse().join('');
b = b.split('-').slice(0, 3).reverse().join('');
return a < b ? -1 : a > b ? 1 : 0;
}
(0, node_test_1.describe)('v1', () => {
(0, node_test_1.default)('v1 sort order (default)', () => {
const ids = [(0, v1_js_1.default)(), (0, v1_js_1.default)(), (0, v1_js_1.default)(), (0, v1_js_1.default)(), (0, v1_js_1.default)()];
const sorted = [...ids].sort(compareV1TimeField);
assert.deepEqual(ids, sorted);
});
(0, node_test_1.default)('v1 sort order (time option)', () => {
const ids = [
(0, v1_js_1.default)({ msecs: TIME - 10 * 3600 * 1000 }),
(0, v1_js_1.default)({ msecs: TIME - 1 }),
(0, v1_js_1.default)({ msecs: TIME }),
(0, v1_js_1.default)({ msecs: TIME + 1 }),
(0, v1_js_1.default)({ msecs: TIME + 28 * 24 * 3600 * 1000 }),
];
const sorted = [...ids].sort(compareV1TimeField);
assert.deepEqual(ids, sorted);
});
(0, node_test_1.default)('v1(options)', () => {
assert.equal((0, v1_js_1.default)({ msecs: RFC_OPTIONS.msecs, random: RFC_RANDOM }), RFC_V1, 'minimal options');
assert.equal((0, v1_js_1.default)(RFC_OPTIONS), RFC_V1, 'full options');
});
(0, node_test_1.default)('v1(options) equality', () => {
assert.notEqual((0, v1_js_1.default)({ msecs: TIME }), (0, v1_js_1.default)({ msecs: TIME }), 'UUIDs with minimal options differ');
assert.equal((0, v1_js_1.default)(RFC_OPTIONS), (0, v1_js_1.default)(RFC_OPTIONS), 'UUIDs with full options are identical');
});
(0, node_test_1.default)('fills one UUID into a buffer as expected', () => {
const buffer = new Uint8Array(16);
const result = (0, v1_js_1.default)(RFC_OPTIONS, buffer);
assert.deepEqual(buffer, RFC_V1_BYTES);
assert.strictEqual(buffer, result);
});
(0, node_test_1.default)('fills two UUIDs into a buffer as expected', () => {
const buffer = new Uint8Array(32);
(0, v1_js_1.default)(RFC_OPTIONS, buffer, 0);
(0, v1_js_1.default)(RFC_OPTIONS, buffer, 16);
const expectedBuf = new Uint8Array(32);
expectedBuf.set(RFC_V1_BYTES);
expectedBuf.set(RFC_V1_BYTES, 16);
assert.deepEqual(buffer, expectedBuf);
});
(0, node_test_1.default)('v1() state transitions', () => {
const PRE_STATE = {
msecs: 10,
nsecs: 20,
clockseq: 0x1234,
node: Uint8Array.of(0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc),
};
const tests = [
{
title: 'initial state',
state: {},
now: 10,
expected: {
msecs: 10,
nsecs: 0,
clockseq: RFC_OPTIONS.clockseq,
node: RFC_OPTIONS.node,
},
},
{
title: 'same time interval',
state: { ...PRE_STATE },
now: PRE_STATE.msecs,
expected: {
...PRE_STATE,
nsecs: 21,
},
},
{
title: 'new time interval',
state: { ...PRE_STATE },
now: PRE_STATE.msecs + 1,
expected: {
...PRE_STATE,
msecs: PRE_STATE.msecs + 1,
nsecs: 0,
},
},
{
title: 'same time interval (nsecs overflow)',
state: { ...PRE_STATE, nsecs: 9999 },
now: PRE_STATE.msecs,
expected: {
...PRE_STATE,
nsecs: 0,
clockseq: RFC_OPTIONS.clockseq,
node: RFC_OPTIONS.node,
},
},
{
title: 'time regression',
state: { ...PRE_STATE },
now: PRE_STATE.msecs - 1,
expected: {
...PRE_STATE,
msecs: PRE_STATE.msecs - 1,
clockseq: RFC_OPTIONS.clockseq,
node: RFC_OPTIONS.node,
},
},
];
for (const { title, state, now, expected } of tests) {
assert.deepStrictEqual((0, v1_js_1.updateV1State)(state, now, RFC_RANDOM), expected, `Failed: ${title}`);
}
});
});

View file

@ -1 +0,0 @@
export {};

View file

@ -1,143 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const md5_js_1 = require("../md5.js");
const sha1_js_1 = require("../sha1.js");
const v3_js_1 = require("../v3.js");
const v35_js_1 = require("../v35.js");
const v5_js_1 = require("../v5.js");
(0, node_test_1.describe)('v35', () => {
const HASH_SAMPLES = [
{
input: (0, v35_js_1.stringToBytes)(''),
sha1: 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
md5: 'd41d8cd98f00b204e9800998ecf8427e',
},
{
input: (0, v35_js_1.stringToBytes)('\t\b\f !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AE\u00AF\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF'),
sha1: 'ca4a426a3d536f14cfd79011e79e10d64de950a0',
md5: 'e8098ec21950f841731d28749129d3ee',
},
{
input: (0, v35_js_1.stringToBytes)('\u00A5\u0104\u018F\u0256\u02B1o\u0315\u038E\u0409\u0500\u0531\u05E1\u05B6\u0920\u0903\u09A4\u0983\u0A20\u0A02\u0AA0\u0A83\u0B06\u0C05\u0C03\u1401\u16A0'),
sha1: 'f2753ebc390e5f637e333c2a4179644a93ae9f65',
md5: '231b309e277b6be8bb3d6c688b7f098b',
},
];
function hashToHex(hash) {
const chars = new Array(hash.length);
for (let i = 0; i < hash.length; i++) {
chars[i] = hash[i].toString(16).padStart(2, '0');
}
return chars.join('');
}
HASH_SAMPLES.forEach(function (sample, i) {
(0, node_test_1.default)(`sha1(node) HASH_SAMPLES[${i}]`, () => {
assert.equal(hashToHex((0, sha1_js_1.default)(sample.input)), sample.sha1);
});
});
HASH_SAMPLES.forEach(function (sample, i) {
(0, node_test_1.default)(`md5(node) HASH_SAMPLES[${i}]`, () => {
assert.equal(hashToHex((0, md5_js_1.default)(sample.input)), sample.md5);
});
});
(0, node_test_1.default)('v3', () => {
assert.strictEqual((0, v3_js_1.default)('hello.example.com', v3_js_1.default.DNS), '9125a8dc-52ee-365b-a5aa-81b0b3681cf6');
assert.strictEqual((0, v3_js_1.default)('http://example.com/hello', v3_js_1.default.URL), 'c6235813-3ba4-3801-ae84-e0a6ebb7d138');
assert.strictEqual((0, v3_js_1.default)('hello', '0f5abcd1-c194-47f3-905b-2df7263a084b'), 'a981a0c2-68b1-35dc-bcfc-296e52ab01ec');
});
(0, node_test_1.default)('v3 namespace.toUpperCase', () => {
assert.strictEqual((0, v3_js_1.default)('hello.example.com', v3_js_1.default.DNS.toUpperCase()), '9125a8dc-52ee-365b-a5aa-81b0b3681cf6');
assert.strictEqual((0, v3_js_1.default)('http://example.com/hello', v3_js_1.default.URL.toUpperCase()), 'c6235813-3ba4-3801-ae84-e0a6ebb7d138');
assert.strictEqual((0, v3_js_1.default)('hello', '0f5abcd1-c194-47f3-905b-2df7263a084b'.toUpperCase()), 'a981a0c2-68b1-35dc-bcfc-296e52ab01ec');
});
(0, node_test_1.default)('v3 namespace string validation', () => {
assert.throws(() => {
(0, v3_js_1.default)('hello.example.com', 'zyxwvuts-rqpo-nmlk-jihg-fedcba000000');
});
assert.throws(() => {
(0, v3_js_1.default)('hello.example.com', 'invalid uuid value');
});
assert.ok((0, v3_js_1.default)('hello.example.com', '00000000-0000-0000-0000-000000000000'));
});
(0, node_test_1.default)('v3 namespace buffer validation', () => {
assert.throws(() => {
(0, v3_js_1.default)('hello.example.com', new Uint8Array(15));
});
assert.throws(() => {
(0, v3_js_1.default)('hello.example.com', new Uint8Array(17));
});
assert.ok((0, v3_js_1.default)('hello.example.com', new Uint8Array(16).fill(0)));
});
(0, node_test_1.default)('v3 fill buffer', () => {
let buf = new Uint8Array(16);
const expectedUuid = Uint8Array.of(0x91, 0x25, 0xa8, 0xdc, 0x52, 0xee, 0x36, 0x5b, 0xa5, 0xaa, 0x81, 0xb0, 0xb3, 0x68, 0x1c, 0xf6);
const result = (0, v3_js_1.default)('hello.example.com', v3_js_1.default.DNS, buf);
assert.deepEqual(buf, expectedUuid);
assert.strictEqual(result, buf);
buf = new Uint8Array(19).fill(0xaa);
const expectedBuf = new Uint8Array(19).fill(0xaa);
expectedBuf.set(expectedUuid, 3);
(0, v3_js_1.default)('hello.example.com', v3_js_1.default.DNS, buf, 3);
assert.deepEqual(buf, expectedBuf);
});
(0, node_test_1.default)('v3 undefined/null', () => {
assert.throws(() => (0, v3_js_1.default)());
assert.throws(() => (0, v3_js_1.default)('hello'));
assert.throws(() => (0, v3_js_1.default)('hello.example.com', undefined));
assert.throws(() => (0, v3_js_1.default)('hello.example.com', null, new Uint8Array(16)));
});
(0, node_test_1.default)('v5', () => {
assert.strictEqual((0, v5_js_1.default)('hello.example.com', v5_js_1.default.DNS), 'fdda765f-fc57-5604-a269-52a7df8164ec');
assert.strictEqual((0, v5_js_1.default)('http://example.com/hello', v5_js_1.default.URL), '3bbcee75-cecc-5b56-8031-b6641c1ed1f1');
assert.strictEqual((0, v5_js_1.default)('hello', '0f5abcd1-c194-47f3-905b-2df7263a084b'), '90123e1c-7512-523e-bb28-76fab9f2f73d');
});
(0, node_test_1.default)('v5 namespace.toUpperCase', () => {
assert.strictEqual((0, v5_js_1.default)('hello.example.com', v5_js_1.default.DNS.toUpperCase()), 'fdda765f-fc57-5604-a269-52a7df8164ec');
assert.strictEqual((0, v5_js_1.default)('http://example.com/hello', v5_js_1.default.URL.toUpperCase()), '3bbcee75-cecc-5b56-8031-b6641c1ed1f1');
assert.strictEqual((0, v5_js_1.default)('hello', '0f5abcd1-c194-47f3-905b-2df7263a084b'.toUpperCase()), '90123e1c-7512-523e-bb28-76fab9f2f73d');
});
(0, node_test_1.default)('v5 namespace string validation', () => {
assert.throws(() => {
(0, v5_js_1.default)('hello.example.com', 'zyxwvuts-rqpo-nmlk-jihg-fedcba000000');
});
assert.throws(() => {
(0, v5_js_1.default)('hello.example.com', 'invalid uuid value');
});
assert.ok((0, v5_js_1.default)('hello.example.com', '00000000-0000-0000-0000-000000000000'));
});
(0, node_test_1.default)('v5 namespace buffer validation', () => {
assert.throws(() => {
(0, v5_js_1.default)('hello.example.com', new Uint8Array(15));
});
assert.throws(() => {
(0, v5_js_1.default)('hello.example.com', new Uint8Array(17));
});
assert.ok((0, v5_js_1.default)('hello.example.com', new Uint8Array(16).fill(0)));
});
(0, node_test_1.default)('v5 fill buffer', () => {
let buf = new Uint8Array(16);
const expectedUuid = Uint8Array.of(0xfd, 0xda, 0x76, 0x5f, 0xfc, 0x57, 0x56, 0x04, 0xa2, 0x69, 0x52, 0xa7, 0xdf, 0x81, 0x64, 0xec);
const result = (0, v5_js_1.default)('hello.example.com', v5_js_1.default.DNS, buf);
assert.deepEqual(buf, expectedUuid);
assert.strictEqual(result, buf);
buf = new Uint8Array(19).fill(0xaa);
const expectedBuf = new Uint8Array(19).fill(0xaa);
expectedBuf.set(expectedUuid, 3);
(0, v5_js_1.default)('hello.example.com', v5_js_1.default.DNS, buf, 3);
assert.deepEqual(buf, expectedBuf);
});
(0, node_test_1.default)('v5 undefined/null', () => {
assert.throws(() => (0, v5_js_1.default)());
assert.throws(() => (0, v5_js_1.default)('hello'));
assert.throws(() => (0, v5_js_1.default)('hello.example.com', undefined));
assert.throws(() => (0, v5_js_1.default)('hello.example.com', null, new Uint8Array(16)));
});
(0, node_test_1.default)('v3/v5 constants', () => {
assert.strictEqual(v3_js_1.default.DNS, '6ba7b810-9dad-11d1-80b4-00c04fd430c8');
assert.strictEqual(v3_js_1.default.URL, '6ba7b811-9dad-11d1-80b4-00c04fd430c8');
assert.strictEqual(v5_js_1.default.DNS, '6ba7b810-9dad-11d1-80b4-00c04fd430c8');
assert.strictEqual(v5_js_1.default.URL, '6ba7b811-9dad-11d1-80b4-00c04fd430c8');
});
});

View file

@ -1 +0,0 @@
export {};

View file

@ -1,60 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const native_js_1 = require("../native.js");
const v4_js_1 = require("../v4.js");
const randomBytesFixture = Uint8Array.of(0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36);
const expectedBytes = Uint8Array.of(16, 145, 86, 190, 196, 251, 65, 234, 177, 180, 239, 225, 103, 28, 88, 54);
(0, node_test_1.describe)('v4', () => {
(0, node_test_1.default)('subsequent UUIDs are different', () => {
const id1 = (0, v4_js_1.default)();
const id2 = (0, v4_js_1.default)();
assert.ok(id1 !== id2);
});
(0, node_test_1.default)('should uses native randomUUID() if no option is passed', async () => {
const mock = (await Promise.resolve().then(() => require('node:test'))).default.mock;
if (!mock) {
return;
}
const mockRandomUUID = mock.method(native_js_1.default, 'randomUUID');
assert.equal(mockRandomUUID.mock.callCount(), 0);
(0, v4_js_1.default)();
assert.equal(mockRandomUUID.mock.callCount(), 1);
mock.restoreAll();
});
(0, node_test_1.default)('should not use native randomUUID() if an option is passed', async () => {
const mock = (await Promise.resolve().then(() => require('node:test'))).default.mock;
if (!mock) {
return;
}
const mockRandomUUID = mock.method(native_js_1.default, 'randomUUID');
assert.equal(mockRandomUUID.mock.callCount(), 0);
(0, v4_js_1.default)({});
assert.equal(mockRandomUUID.mock.callCount(), 0);
mock.restoreAll();
});
(0, node_test_1.default)('explicit options.random produces expected result', () => {
const id = (0, v4_js_1.default)({ random: randomBytesFixture });
assert.strictEqual(id, '109156be-c4fb-41ea-b1b4-efe1671c5836');
});
(0, node_test_1.default)('explicit options.rng produces expected result', () => {
const id = (0, v4_js_1.default)({ rng: () => randomBytesFixture });
assert.strictEqual(id, '109156be-c4fb-41ea-b1b4-efe1671c5836');
});
(0, node_test_1.default)('fills one UUID into a buffer as expected', () => {
const buffer = new Uint8Array(16);
const result = (0, v4_js_1.default)({ random: randomBytesFixture }, buffer);
assert.deepEqual(buffer, expectedBytes);
assert.strictEqual(buffer, result);
});
(0, node_test_1.default)('fills two UUIDs into a buffer as expected', () => {
const buffer = new Uint8Array(32);
(0, v4_js_1.default)({ random: randomBytesFixture }, buffer, 0);
(0, v4_js_1.default)({ random: randomBytesFixture }, buffer, 16);
const expectedBuf = new Uint8Array(32);
expectedBuf.set(expectedBytes);
expectedBuf.set(expectedBytes, 16);
assert.deepEqual(buffer, expectedBuf);
});
});

View file

@ -1 +0,0 @@
export {};

View file

@ -1,56 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const v1ToV6_js_1 = require("../v1ToV6.js");
const v6_js_1 = require("../v6.js");
const v6ToV1_js_1 = require("../v6ToV1.js");
(0, node_test_1.describe)('v6', () => {
const V1_ID = 'f1207660-21d2-11ef-8c4f-419efbd44d48';
const V6_ID = '1ef21d2f-1207-6660-8c4f-419efbd44d48';
const fullOptions = {
msecs: 0x133b891f705,
nsecs: 0x1538,
clockseq: 0x385c,
node: Uint8Array.of(0x61, 0xcd, 0x3c, 0xbb, 0x32, 0x10),
};
const EXPECTED_BYTES = Uint8Array.of(0x1e, 0x11, 0x22, 0xbd, 0x94, 0x28, 0x68, 0x88, 0xb8, 0x5c, 0x61, 0xcd, 0x3c, 0xbb, 0x32, 0x10);
(0, node_test_1.default)('default behavior', () => {
const id = (0, v6_js_1.default)();
assert.ok(/[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/.test(id), 'id is valid v6 UUID');
});
(0, node_test_1.default)('default behavior (binary type)', () => {
const buffer = new Uint8Array(16);
const result = (0, v6_js_1.default)(fullOptions, buffer);
assert.deepEqual(buffer, EXPECTED_BYTES);
assert.strictEqual(buffer, result);
});
(0, node_test_1.default)('all options', () => {
const id = (0, v6_js_1.default)(fullOptions);
assert.equal(id, '1e1122bd-9428-6888-b85c-61cd3cbb3210');
});
(0, node_test_1.default)('sort by creation time', () => {
const ids = [];
for (let i = 0; i < 5; i++) {
ids.push((0, v6_js_1.default)({ msecs: i * 1000 }));
}
assert.deepEqual(ids, ids.slice().sort());
});
(0, node_test_1.default)('creating at array offset', () => {
const buffer = new Uint8Array(32);
(0, v6_js_1.default)(fullOptions, buffer, 0);
(0, v6_js_1.default)(fullOptions, buffer, 16);
const expectedBuf = new Uint8Array(32);
expectedBuf.set(EXPECTED_BYTES, 0);
expectedBuf.set(EXPECTED_BYTES, 16);
assert.deepEqual(buffer, expectedBuf);
});
(0, node_test_1.default)('v1 -> v6 conversion', () => {
const id = (0, v1ToV6_js_1.default)(V1_ID);
assert.equal(id, V6_ID);
});
(0, node_test_1.default)('v6 -> v1 conversion', () => {
const id = (0, v6ToV1_js_1.default)(V6_ID);
assert.equal(id, V1_ID);
});
});

View file

@ -1 +0,0 @@
export {};

View file

@ -1,194 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const parse_js_1 = require("../parse.js");
const stringify_js_1 = require("../stringify.js");
const v7_js_1 = require("../v7.js");
const RFC_V7 = '017f22e2-79b0-7cc3-98c4-dc0c0c07398f';
const RFC_V7_BYTES = (0, parse_js_1.default)('017f22e2-79b0-7cc3-98c4-dc0c0c07398f');
const RFC_MSECS = 0x17f22e279b0;
const RFC_SEQ = (0x0cc3 << 20) | (0x98c4dc >> 2);
const RFC_RANDOM = Uint8Array.of(0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0x0c, 0xc3, 0x18, 0xc4, 0x6c, 0x0c, 0x0c, 0x07, 0x39, 0x8f);
(0, node_test_1.describe)('v7', () => {
(0, node_test_1.default)('subsequent UUIDs are different', () => {
const id1 = (0, v7_js_1.default)();
const id2 = (0, v7_js_1.default)();
assert.ok(id1 !== id2);
});
(0, node_test_1.default)('explicit options.random and options.msecs produces expected result', () => {
const id = (0, v7_js_1.default)({
random: RFC_RANDOM,
msecs: RFC_MSECS,
seq: RFC_SEQ,
});
assert.strictEqual(id, RFC_V7);
});
(0, node_test_1.default)('explicit options.rng produces expected result', () => {
const id = (0, v7_js_1.default)({
rng: () => RFC_RANDOM,
msecs: RFC_MSECS,
seq: RFC_SEQ,
});
assert.strictEqual(id, RFC_V7);
});
(0, node_test_1.default)('explicit options.msecs produces expected result', () => {
const id = (0, v7_js_1.default)({
msecs: RFC_MSECS,
});
assert.strictEqual(id.indexOf('017f22e2'), 0);
});
(0, node_test_1.default)('fills one UUID into a buffer as expected', () => {
const buffer = new Uint8Array(16);
const result = (0, v7_js_1.default)({
random: RFC_RANDOM,
msecs: RFC_MSECS,
seq: RFC_SEQ,
}, buffer);
(0, stringify_js_1.default)(buffer);
assert.deepEqual(buffer, RFC_V7_BYTES);
assert.strictEqual(buffer, result);
});
(0, node_test_1.default)('fills two UUIDs into a buffer as expected', () => {
const buffer = new Uint8Array(32);
(0, v7_js_1.default)({
random: RFC_RANDOM,
msecs: RFC_MSECS,
seq: RFC_SEQ,
}, buffer, 0);
(0, v7_js_1.default)({
random: RFC_RANDOM,
msecs: RFC_MSECS,
seq: RFC_SEQ,
}, buffer, 16);
const expected = new Uint8Array(32);
expected.set(RFC_V7_BYTES);
expected.set(RFC_V7_BYTES, 16);
assert.deepEqual(buffer, expected);
});
(0, node_test_1.default)('lexicographical sorting is preserved', () => {
let id;
let prior;
let msecs = RFC_MSECS;
for (let i = 0; i < 20000; ++i) {
if (i % 1500 === 0) {
msecs += 1;
}
id = (0, v7_js_1.default)({ msecs, seq: i });
if (prior !== undefined) {
assert.ok(prior < id, `${prior} < ${id}`);
}
prior = id;
}
});
(0, node_test_1.default)('can supply seq', () => {
let seq = 0x12345;
let uuid = (0, v7_js_1.default)({
msecs: RFC_MSECS,
seq,
});
assert.strictEqual(uuid.substr(0, 25), '017f22e2-79b0-7000-848d-1');
seq = 0x6fffffff;
uuid = (0, v7_js_1.default)({
msecs: RFC_MSECS,
seq,
});
assert.strictEqual(uuid.substring(0, 25), '017f22e2-79b0-76ff-bfff-f');
});
(0, node_test_1.default)('internal seq is reset upon timestamp change', () => {
(0, v7_js_1.default)({
msecs: RFC_MSECS,
seq: 0x6fffffff,
});
const uuid = (0, v7_js_1.default)({
msecs: RFC_MSECS + 1,
});
assert.ok(uuid.indexOf('fff') !== 15);
});
(0, node_test_1.default)('v7() state transitions', () => {
const tests = [
{
title: 'new time interval',
state: { msecs: 1, seq: 123 },
now: 2,
expected: {
msecs: 2,
seq: 0x6c318c4,
},
},
{
title: 'same time interval',
state: { msecs: 1, seq: 123 },
now: 1,
expected: {
msecs: 1,
seq: 124,
},
},
{
title: 'same time interval (sequence rollover)',
state: { msecs: 1, seq: 0xffffffff },
now: 1,
expected: {
msecs: 2,
seq: 0,
},
},
{
title: 'time regression',
state: { msecs: 2, seq: 123 },
now: 1,
expected: {
msecs: 2,
seq: 124,
},
},
{
title: 'time regression (sequence rollover)',
state: { msecs: 2, seq: 0xffffffff },
now: 1,
expected: {
msecs: 3,
seq: 0,
},
},
];
for (const { title, state, now, expected } of tests) {
assert.deepStrictEqual((0, v7_js_1.updateV7State)(state, now, RFC_RANDOM), expected, `Failed: ${title}`);
}
});
(0, node_test_1.default)('flipping bits changes the result', () => {
const asBigInt = (buf) => buf.reduce((acc, v) => (acc << 8n) | BigInt(v), 0n);
const asNumber = (bits, data) => Number(BigInt.asUintN(bits, data));
const flip = (data, n) => data ^ (1n << BigInt(127 - n));
const optionsFrom = (data) => {
const ms = asNumber(48, data >> 80n);
const hi = asNumber(12, data >> 64n);
const lo = asNumber(20, data >> 42n);
const r = BigInt.asUintN(42, data);
return {
msecs: ms,
seq: (hi << 20) | lo,
random: Uint8Array.from([
...Array(10).fill(0),
...Array(6)
.fill(0)
.map((_, i) => asNumber(8, r >> (BigInt(i) * 8n)))
.reverse(),
]),
};
};
const buf = new Uint8Array(16);
const data = asBigInt((0, v7_js_1.default)({}, buf));
const id = (0, stringify_js_1.default)(buf);
const reserved = [48, 49, 50, 51, 64, 65];
for (let i = 0; i < 128; ++i) {
if (reserved.includes(i)) {
continue;
}
const flipped = flip(data, i);
assert.strictEqual(asBigInt((0, v7_js_1.default)(optionsFrom(flipped), buf)).toString(16), flipped.toString(16), `Unequal uuids at bit ${i}`);
assert.notStrictEqual((0, stringify_js_1.default)(buf), id);
}
});
});

View file

@ -1 +0,0 @@
export {};

View file

@ -1,13 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const validate_js_1 = require("../validate.js");
const test_constants_js_1 = require("./test_constants.js");
(0, node_test_1.describe)('validate()', () => {
(0, node_test_1.default)('TESTS cases', () => {
for (const { value, expectedValidate } of test_constants_js_1.TESTS) {
assert.strictEqual((0, validate_js_1.default)(value), expectedValidate, `validate(${value}) should be ${expectedValidate}`);
}
});
});

View file

@ -1 +0,0 @@
export {};

View file

@ -1,20 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const version_js_1 = require("../version.js");
const test_constants_js_1 = require("./test_constants.js");
(0, node_test_1.describe)('version()', () => {
(0, node_test_1.default)('TESTS cases', () => {
for (const { value, expectedValidate, expectedVersion } of test_constants_js_1.TESTS) {
try {
const actualVersion = (0, version_js_1.default)(value);
assert.ok(expectedValidate, `version(${value}) should throw`);
assert.strictEqual(actualVersion, expectedVersion);
}
catch {
assert.ok(!expectedValidate, `version(${value}) threw unexpectedly`);
}
}
});
});

View file

@ -49,10 +49,18 @@ function updateV1State(state, now, rnds) {
return state;
}
function v1Bytes(rnds, msecs, nsecs, clockseq, node, buf, offset = 0) {
if (rnds.length < 16) {
throw new Error('Random bytes length must be >= 16');
}
if (!buf) {
buf = new Uint8Array(16);
offset = 0;
}
else {
if (offset < 0 || offset + 16 > buf.length) {
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
}
}
msecs ??= Date.now();
nsecs ??= 0;
clockseq ??= ((rnds[8] << 8) | rnds[9]) & 0x3fff;

View file

@ -1,7 +1,7 @@
import { UUIDTypes } from './types.js';
export declare function stringToBytes(str: string): Uint8Array;
export declare function stringToBytes(str: string): Uint8Array<ArrayBuffer>;
export declare const DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
export declare const URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
type HashFunction = (bytes: Uint8Array) => Uint8Array;
export default function v35(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: Uint8Array, offset?: number): string | Uint8Array;
export default function v35(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: Uint8Array, offset?: number): string | Uint8Array<ArrayBufferLike>;
export {};

View file

@ -8,11 +8,17 @@ function v4(options, buf, offset) {
return native_js_1.default.randomUUID();
}
options = options || {};
const rnds = options.random || (options.rng || rng_js_1.default)();
const rnds = options.random ?? options.rng?.() ?? (0, rng_js_1.default)();
if (rnds.length < 16) {
throw new Error('Random bytes length must be >= 16');
}
rnds[6] = (rnds[6] & 0x0f) | 0x40;
rnds[8] = (rnds[8] & 0x3f) | 0x80;
if (buf) {
offset = offset || 0;
if (offset < 0 || offset + 16 > buf.length) {
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
}
for (let i = 0; i < 16; ++i) {
buf[offset + i] = rnds[i];
}

View file

@ -33,10 +33,18 @@ function updateV7State(state, now, rnds) {
return state;
}
function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
if (rnds.length < 16) {
throw new Error('Random bytes length must be >= 16');
}
if (!buf) {
buf = new Uint8Array(16);
offset = 0;
}
else {
if (offset < 0 || offset + 16 > buf.length) {
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
}
}
msecs ??= Date.now();
seq ??= ((rnds[6] * 0x7f) << 24) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];
buf[offset++] = (msecs / 0x10000000000) & 0xff;

View file

@ -1,2 +1,2 @@
declare function md5(bytes: Uint8Array): Buffer;
declare function md5(bytes: Uint8Array): Buffer<ArrayBufferLike>;
export default md5;

View file

@ -1,2 +1,2 @@
declare function parse(uuid: string): Uint8Array;
declare function parse(uuid: string): Uint8Array<ArrayBuffer>;
export default parse;

View file

@ -1 +1 @@
export default function rng(): Uint8Array;
export default function rng(): Uint8Array<ArrayBuffer>;

View file

@ -1,2 +1,2 @@
declare function sha1(bytes: Uint8Array): Buffer;
declare function sha1(bytes: Uint8Array): Buffer<ArrayBufferLike>;
export default sha1;

View file

@ -1 +0,0 @@
export {};

View file

@ -1,50 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const parse_js_1 = require("../parse.js");
const stringify_js_1 = require("../stringify.js");
const v4_js_1 = require("../v4.js");
function splitmix32(a) {
return function () {
a |= 0;
a = (a + 0x9e3779b9) | 0;
let t = a ^ (a >>> 16);
t = Math.imul(t, 0x21f0aaad);
t = t ^ (t >>> 15);
t = Math.imul(t, 0x735a2d97);
return ((t = t ^ (t >>> 15)) >>> 0) / 4294967296;
};
}
const rand = splitmix32(0x12345678);
function rng(bytes = new Uint8Array(16)) {
for (let i = 0; i < 16; i++) {
bytes[i] = rand() * 256;
}
return bytes;
}
(0, node_test_1.describe)('parse', () => {
(0, node_test_1.default)('String -> bytes parsing', () => {
assert.deepStrictEqual((0, parse_js_1.default)('0f5abcd1-c194-47f3-905b-2df7263a084b'), Uint8Array.from([
0x0f, 0x5a, 0xbc, 0xd1, 0xc1, 0x94, 0x47, 0xf3, 0x90, 0x5b, 0x2d, 0xf7, 0x26, 0x3a, 0x08,
0x4b,
]));
});
(0, node_test_1.default)('String -> bytes -> string symmetry for assorted uuids', () => {
for (let i = 0; i < 1000; i++) {
const uuid = (0, v4_js_1.default)({ rng });
assert.equal((0, stringify_js_1.default)((0, parse_js_1.default)(uuid)), uuid);
}
});
(0, node_test_1.default)('Case neutrality', () => {
assert.deepStrictEqual((0, parse_js_1.default)('0f5abcd1-c194-47f3-905b-2df7263a084b'), (0, parse_js_1.default)('0f5abcd1-c194-47f3-905b-2df7263a084b'.toUpperCase()));
});
(0, node_test_1.default)('Null UUID case', () => {
assert.deepStrictEqual((0, parse_js_1.default)('00000000-0000-0000-0000-000000000000'), Uint8Array.from(new Array(16).fill(0)));
});
(0, node_test_1.default)('UUID validation', () => {
assert.throws(() => (0, parse_js_1.default)());
assert.throws(() => (0, parse_js_1.default)('invalid uuid'));
assert.throws(() => (0, parse_js_1.default)('zyxwvuts-rqpo-nmlk-jihg-fedcba000000'));
});
});

View file

@ -1 +0,0 @@
export {};

View file

@ -1,14 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const rng_js_1 = require("../rng.js");
(0, node_test_1.describe)('rng', () => {
(0, node_test_1.default)('Node.js RNG', () => {
const bytes = (0, rng_js_1.default)();
assert.equal(bytes.length, 16);
for (let i = 0; i < bytes.length; ++i) {
assert.equal(typeof bytes[i], 'number');
}
});
});

View file

@ -1 +0,0 @@
export {};

View file

@ -1,23 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const stringify_js_1 = require("../stringify.js");
const BYTES = Uint8Array.of(0x0f, 0x5a, 0xbc, 0xd1, 0xc1, 0x94, 0x47, 0xf3, 0x90, 0x5b, 0x2d, 0xf7, 0x26, 0x3a, 0x08, 0x4b);
(0, node_test_1.describe)('stringify', () => {
(0, node_test_1.default)('Stringify Array (unsafe)', () => {
assert.equal((0, stringify_js_1.unsafeStringify)(BYTES), '0f5abcd1-c194-47f3-905b-2df7263a084b');
});
(0, node_test_1.default)('Stringify w/ offset (unsafe)', () => {
const bytes = new Uint8Array(19).fill(0);
bytes.set(BYTES, 3);
assert.equal((0, stringify_js_1.unsafeStringify)(bytes, 3), '0f5abcd1-c194-47f3-905b-2df7263a084b');
});
(0, node_test_1.default)('Stringify Array (safe)', () => {
assert.equal((0, stringify_js_1.default)(BYTES), '0f5abcd1-c194-47f3-905b-2df7263a084b');
});
(0, node_test_1.default)('Throws on not enough values (safe)', () => {
const bytes = BYTES.slice(0, 15);
assert.throws(() => (0, stringify_js_1.default)(bytes));
});
});

View file

@ -1,33 +0,0 @@
export declare const TESTS: ({
value: string;
expectedValidate: boolean;
expectedVersion: number;
} | {
value: string;
expectedValidate: boolean;
expectedVersion?: undefined;
} | {
value: undefined;
expectedValidate: boolean;
expectedVersion?: undefined;
} | {
value: null;
expectedValidate: boolean;
expectedVersion?: undefined;
} | {
value: number;
expectedValidate: boolean;
expectedVersion?: undefined;
} | {
value: RegExp;
expectedValidate: boolean;
expectedVersion?: undefined;
} | {
value: Date;
expectedValidate: boolean;
expectedVersion?: undefined;
} | {
value: boolean;
expectedValidate: boolean;
expectedVersion?: undefined;
})[];

View file

@ -1,91 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TESTS = void 0;
const max_js_1 = require("../max.js");
const nil_js_1 = require("../nil.js");
exports.TESTS = [
{ value: nil_js_1.default, expectedValidate: true, expectedVersion: 0 },
{ value: max_js_1.default, expectedValidate: true, expectedVersion: 15 },
{ value: '00000000-0000-1000-8000-000000000000', expectedValidate: true, expectedVersion: 1 },
{ value: 'ffffffff-ffff-1fff-8fff-ffffffffffff', expectedValidate: true, expectedVersion: 1 },
{ value: '00000000-0000-2000-8000-000000000000', expectedValidate: true, expectedVersion: 2 },
{ value: 'ffffffff-ffff-2fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 2 },
{ value: '00000000-0000-3000-8000-000000000000', expectedValidate: true, expectedVersion: 3 },
{ value: 'ffffffff-ffff-3fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 3 },
{ value: '00000000-0000-4000-8000-000000000000', expectedValidate: true, expectedVersion: 4 },
{ value: 'ffffffff-ffff-4fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 4 },
{ value: '00000000-0000-5000-8000-000000000000', expectedValidate: true, expectedVersion: 5 },
{ value: 'ffffffff-ffff-5fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 5 },
{ value: '00000000-0000-6000-8000-000000000000', expectedValidate: true, expectedVersion: 6 },
{ value: 'ffffffff-ffff-6fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 6 },
{ value: '00000000-0000-7000-8000-000000000000', expectedValidate: true, expectedVersion: 7 },
{ value: 'ffffffff-ffff-7fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 7 },
{ value: '00000000-0000-8000-8000-000000000000', expectedValidate: true, expectedVersion: 8 },
{ value: 'ffffffff-ffff-8fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 8 },
{ value: '00000000-0000-9000-8000-000000000000', expectedValidate: false },
{ value: 'ffffffff-ffff-9fff-bfff-ffffffffffff', expectedValidate: false },
{ value: '00000000-0000-a000-8000-000000000000', expectedValidate: false },
{ value: 'ffffffff-ffff-afff-bfff-ffffffffffff', expectedValidate: false },
{ value: '00000000-0000-b000-8000-000000000000', expectedValidate: false },
{ value: 'ffffffff-ffff-bfff-bfff-ffffffffffff', expectedValidate: false },
{ value: '00000000-0000-c000-8000-000000000000', expectedValidate: false },
{ value: 'ffffffff-ffff-cfff-bfff-ffffffffffff', expectedValidate: false },
{ value: '00000000-0000-d000-8000-000000000000', expectedValidate: false },
{ value: 'ffffffff-ffff-dfff-bfff-ffffffffffff', expectedValidate: false },
{ value: '00000000-0000-e000-8000-000000000000', expectedValidate: false },
{ value: 'ffffffff-ffff-efff-bfff-ffffffffffff', expectedValidate: false },
{ value: 'd9428888-122b-11e1-b85c-61cd3cbb3210', expectedValidate: true, expectedVersion: 1 },
{ value: '000003e8-2363-21ef-b200-325096b39f47', expectedValidate: true, expectedVersion: 2 },
{ value: 'a981a0c2-68b1-35dc-bcfc-296e52ab01ec', expectedValidate: true, expectedVersion: 3 },
{ value: '109156be-c4fb-41ea-b1b4-efe1671c5836', expectedValidate: true, expectedVersion: 4 },
{ value: '90123e1c-7512-523e-bb28-76fab9f2f73d', expectedValidate: true, expectedVersion: 5 },
{ value: '1ef21d2f-1207-6660-8c4f-419efbd44d48', expectedValidate: true, expectedVersion: 6 },
{ value: '017f22e2-79b0-7cc3-98c4-dc0c0c07398f', expectedValidate: true, expectedVersion: 7 },
{ value: '0d8f23a0-697f-83ae-802e-48f3756dd581', expectedValidate: true, expectedVersion: 8 },
{ value: '00000000-0000-1000-0000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-1000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-2000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-3000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-4000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-5000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-6000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-7000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-8000-000000000000', expectedValidate: true, expectedVersion: 1 },
{ value: '00000000-0000-1000-9000-000000000000', expectedValidate: true, expectedVersion: 1 },
{ value: '00000000-0000-1000-a000-000000000000', expectedValidate: true, expectedVersion: 1 },
{ value: '00000000-0000-1000-b000-000000000000', expectedValidate: true, expectedVersion: 1 },
{ value: '00000000-0000-1000-c000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-d000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-e000-000000000000', expectedValidate: false },
{ value: '00000000-0000-1000-f000-000000000000', expectedValidate: false },
{ value: '00000000000000000000000000000000', expectedValidate: false },
{ value: '', expectedValidate: false },
{ value: 'invalid uuid string', expectedValidate: false },
{
value: '=Y00a-f*vb*-c-d#-p00f\b-g0h-#i^-j*3&-L00k-\nl---00n-fg000-00p-00r+',
expectedValidate: false,
},
{ value: undefined, expectedValidate: false },
{ value: null, expectedValidate: false },
{ value: 123, expectedValidate: false },
{ value: /regex/, expectedValidate: false },
{ value: new Date(0), expectedValidate: false },
{ value: false, expectedValidate: false },
];
for (let charIndex = 0; charIndex < 36; charIndex++) {
if (charIndex === 8 ||
charIndex === 13 ||
charIndex === 14 ||
charIndex === 18 ||
charIndex === 23) {
continue;
}
const nilChars = nil_js_1.default.split('');
const maxChars = max_js_1.default.split('');
for (let i = 0; i < 4; i++) {
nilChars[charIndex] = (0x0 ^ (1 << i)).toString(16);
exports.TESTS.push({ value: nilChars.join(''), expectedValidate: false });
maxChars[charIndex] = (0xf ^ (1 << i)).toString(16);
exports.TESTS.push({ value: maxChars.join(''), expectedValidate: false });
}
}

View file

@ -1 +0,0 @@
export {};

View file

@ -1,127 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const parse_js_1 = require("../parse.js");
const v1_js_1 = require("../v1.js");
const TIME = 1321644961388;
const RFC_V1 = 'c232ab00-9414-11ec-b3c8-9f68deced846';
const RFC_V1_BYTES = (0, parse_js_1.default)(RFC_V1);
const RFC_OPTIONS = {
msecs: 0x17f22e279b0,
nsecs: 0,
clockseq: 0x33c8,
node: Uint8Array.of(0x9f, 0x68, 0xde, 0xce, 0xd8, 0x46),
};
const RFC_RANDOM = Uint8Array.of(0, 0, 0, 0, 0, 0, 0, 0, RFC_OPTIONS.clockseq >> 8, RFC_OPTIONS.clockseq & 0xff, ...RFC_OPTIONS.node);
function compareV1TimeField(a, b) {
a = a.split('-').slice(0, 3).reverse().join('');
b = b.split('-').slice(0, 3).reverse().join('');
return a < b ? -1 : a > b ? 1 : 0;
}
(0, node_test_1.describe)('v1', () => {
(0, node_test_1.default)('v1 sort order (default)', () => {
const ids = [(0, v1_js_1.default)(), (0, v1_js_1.default)(), (0, v1_js_1.default)(), (0, v1_js_1.default)(), (0, v1_js_1.default)()];
const sorted = [...ids].sort(compareV1TimeField);
assert.deepEqual(ids, sorted);
});
(0, node_test_1.default)('v1 sort order (time option)', () => {
const ids = [
(0, v1_js_1.default)({ msecs: TIME - 10 * 3600 * 1000 }),
(0, v1_js_1.default)({ msecs: TIME - 1 }),
(0, v1_js_1.default)({ msecs: TIME }),
(0, v1_js_1.default)({ msecs: TIME + 1 }),
(0, v1_js_1.default)({ msecs: TIME + 28 * 24 * 3600 * 1000 }),
];
const sorted = [...ids].sort(compareV1TimeField);
assert.deepEqual(ids, sorted);
});
(0, node_test_1.default)('v1(options)', () => {
assert.equal((0, v1_js_1.default)({ msecs: RFC_OPTIONS.msecs, random: RFC_RANDOM }), RFC_V1, 'minimal options');
assert.equal((0, v1_js_1.default)(RFC_OPTIONS), RFC_V1, 'full options');
});
(0, node_test_1.default)('v1(options) equality', () => {
assert.notEqual((0, v1_js_1.default)({ msecs: TIME }), (0, v1_js_1.default)({ msecs: TIME }), 'UUIDs with minimal options differ');
assert.equal((0, v1_js_1.default)(RFC_OPTIONS), (0, v1_js_1.default)(RFC_OPTIONS), 'UUIDs with full options are identical');
});
(0, node_test_1.default)('fills one UUID into a buffer as expected', () => {
const buffer = new Uint8Array(16);
const result = (0, v1_js_1.default)(RFC_OPTIONS, buffer);
assert.deepEqual(buffer, RFC_V1_BYTES);
assert.strictEqual(buffer, result);
});
(0, node_test_1.default)('fills two UUIDs into a buffer as expected', () => {
const buffer = new Uint8Array(32);
(0, v1_js_1.default)(RFC_OPTIONS, buffer, 0);
(0, v1_js_1.default)(RFC_OPTIONS, buffer, 16);
const expectedBuf = new Uint8Array(32);
expectedBuf.set(RFC_V1_BYTES);
expectedBuf.set(RFC_V1_BYTES, 16);
assert.deepEqual(buffer, expectedBuf);
});
(0, node_test_1.default)('v1() state transitions', () => {
const PRE_STATE = {
msecs: 10,
nsecs: 20,
clockseq: 0x1234,
node: Uint8Array.of(0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc),
};
const tests = [
{
title: 'initial state',
state: {},
now: 10,
expected: {
msecs: 10,
nsecs: 0,
clockseq: RFC_OPTIONS.clockseq,
node: RFC_OPTIONS.node,
},
},
{
title: 'same time interval',
state: { ...PRE_STATE },
now: PRE_STATE.msecs,
expected: {
...PRE_STATE,
nsecs: 21,
},
},
{
title: 'new time interval',
state: { ...PRE_STATE },
now: PRE_STATE.msecs + 1,
expected: {
...PRE_STATE,
msecs: PRE_STATE.msecs + 1,
nsecs: 0,
},
},
{
title: 'same time interval (nsecs overflow)',
state: { ...PRE_STATE, nsecs: 9999 },
now: PRE_STATE.msecs,
expected: {
...PRE_STATE,
nsecs: 0,
clockseq: RFC_OPTIONS.clockseq,
node: RFC_OPTIONS.node,
},
},
{
title: 'time regression',
state: { ...PRE_STATE },
now: PRE_STATE.msecs - 1,
expected: {
...PRE_STATE,
msecs: PRE_STATE.msecs - 1,
clockseq: RFC_OPTIONS.clockseq,
node: RFC_OPTIONS.node,
},
},
];
for (const { title, state, now, expected } of tests) {
assert.deepStrictEqual((0, v1_js_1.updateV1State)(state, now, RFC_RANDOM), expected, `Failed: ${title}`);
}
});
});

View file

@ -1 +0,0 @@
export {};

View file

@ -1,143 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const md5_js_1 = require("../md5.js");
const sha1_js_1 = require("../sha1.js");
const v3_js_1 = require("../v3.js");
const v35_js_1 = require("../v35.js");
const v5_js_1 = require("../v5.js");
(0, node_test_1.describe)('v35', () => {
const HASH_SAMPLES = [
{
input: (0, v35_js_1.stringToBytes)(''),
sha1: 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
md5: 'd41d8cd98f00b204e9800998ecf8427e',
},
{
input: (0, v35_js_1.stringToBytes)('\t\b\f !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AE\u00AF\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF'),
sha1: 'ca4a426a3d536f14cfd79011e79e10d64de950a0',
md5: 'e8098ec21950f841731d28749129d3ee',
},
{
input: (0, v35_js_1.stringToBytes)('\u00A5\u0104\u018F\u0256\u02B1o\u0315\u038E\u0409\u0500\u0531\u05E1\u05B6\u0920\u0903\u09A4\u0983\u0A20\u0A02\u0AA0\u0A83\u0B06\u0C05\u0C03\u1401\u16A0'),
sha1: 'f2753ebc390e5f637e333c2a4179644a93ae9f65',
md5: '231b309e277b6be8bb3d6c688b7f098b',
},
];
function hashToHex(hash) {
const chars = new Array(hash.length);
for (let i = 0; i < hash.length; i++) {
chars[i] = hash[i].toString(16).padStart(2, '0');
}
return chars.join('');
}
HASH_SAMPLES.forEach(function (sample, i) {
(0, node_test_1.default)(`sha1(node) HASH_SAMPLES[${i}]`, () => {
assert.equal(hashToHex((0, sha1_js_1.default)(sample.input)), sample.sha1);
});
});
HASH_SAMPLES.forEach(function (sample, i) {
(0, node_test_1.default)(`md5(node) HASH_SAMPLES[${i}]`, () => {
assert.equal(hashToHex((0, md5_js_1.default)(sample.input)), sample.md5);
});
});
(0, node_test_1.default)('v3', () => {
assert.strictEqual((0, v3_js_1.default)('hello.example.com', v3_js_1.default.DNS), '9125a8dc-52ee-365b-a5aa-81b0b3681cf6');
assert.strictEqual((0, v3_js_1.default)('http://example.com/hello', v3_js_1.default.URL), 'c6235813-3ba4-3801-ae84-e0a6ebb7d138');
assert.strictEqual((0, v3_js_1.default)('hello', '0f5abcd1-c194-47f3-905b-2df7263a084b'), 'a981a0c2-68b1-35dc-bcfc-296e52ab01ec');
});
(0, node_test_1.default)('v3 namespace.toUpperCase', () => {
assert.strictEqual((0, v3_js_1.default)('hello.example.com', v3_js_1.default.DNS.toUpperCase()), '9125a8dc-52ee-365b-a5aa-81b0b3681cf6');
assert.strictEqual((0, v3_js_1.default)('http://example.com/hello', v3_js_1.default.URL.toUpperCase()), 'c6235813-3ba4-3801-ae84-e0a6ebb7d138');
assert.strictEqual((0, v3_js_1.default)('hello', '0f5abcd1-c194-47f3-905b-2df7263a084b'.toUpperCase()), 'a981a0c2-68b1-35dc-bcfc-296e52ab01ec');
});
(0, node_test_1.default)('v3 namespace string validation', () => {
assert.throws(() => {
(0, v3_js_1.default)('hello.example.com', 'zyxwvuts-rqpo-nmlk-jihg-fedcba000000');
});
assert.throws(() => {
(0, v3_js_1.default)('hello.example.com', 'invalid uuid value');
});
assert.ok((0, v3_js_1.default)('hello.example.com', '00000000-0000-0000-0000-000000000000'));
});
(0, node_test_1.default)('v3 namespace buffer validation', () => {
assert.throws(() => {
(0, v3_js_1.default)('hello.example.com', new Uint8Array(15));
});
assert.throws(() => {
(0, v3_js_1.default)('hello.example.com', new Uint8Array(17));
});
assert.ok((0, v3_js_1.default)('hello.example.com', new Uint8Array(16).fill(0)));
});
(0, node_test_1.default)('v3 fill buffer', () => {
let buf = new Uint8Array(16);
const expectedUuid = Uint8Array.of(0x91, 0x25, 0xa8, 0xdc, 0x52, 0xee, 0x36, 0x5b, 0xa5, 0xaa, 0x81, 0xb0, 0xb3, 0x68, 0x1c, 0xf6);
const result = (0, v3_js_1.default)('hello.example.com', v3_js_1.default.DNS, buf);
assert.deepEqual(buf, expectedUuid);
assert.strictEqual(result, buf);
buf = new Uint8Array(19).fill(0xaa);
const expectedBuf = new Uint8Array(19).fill(0xaa);
expectedBuf.set(expectedUuid, 3);
(0, v3_js_1.default)('hello.example.com', v3_js_1.default.DNS, buf, 3);
assert.deepEqual(buf, expectedBuf);
});
(0, node_test_1.default)('v3 undefined/null', () => {
assert.throws(() => (0, v3_js_1.default)());
assert.throws(() => (0, v3_js_1.default)('hello'));
assert.throws(() => (0, v3_js_1.default)('hello.example.com', undefined));
assert.throws(() => (0, v3_js_1.default)('hello.example.com', null, new Uint8Array(16)));
});
(0, node_test_1.default)('v5', () => {
assert.strictEqual((0, v5_js_1.default)('hello.example.com', v5_js_1.default.DNS), 'fdda765f-fc57-5604-a269-52a7df8164ec');
assert.strictEqual((0, v5_js_1.default)('http://example.com/hello', v5_js_1.default.URL), '3bbcee75-cecc-5b56-8031-b6641c1ed1f1');
assert.strictEqual((0, v5_js_1.default)('hello', '0f5abcd1-c194-47f3-905b-2df7263a084b'), '90123e1c-7512-523e-bb28-76fab9f2f73d');
});
(0, node_test_1.default)('v5 namespace.toUpperCase', () => {
assert.strictEqual((0, v5_js_1.default)('hello.example.com', v5_js_1.default.DNS.toUpperCase()), 'fdda765f-fc57-5604-a269-52a7df8164ec');
assert.strictEqual((0, v5_js_1.default)('http://example.com/hello', v5_js_1.default.URL.toUpperCase()), '3bbcee75-cecc-5b56-8031-b6641c1ed1f1');
assert.strictEqual((0, v5_js_1.default)('hello', '0f5abcd1-c194-47f3-905b-2df7263a084b'.toUpperCase()), '90123e1c-7512-523e-bb28-76fab9f2f73d');
});
(0, node_test_1.default)('v5 namespace string validation', () => {
assert.throws(() => {
(0, v5_js_1.default)('hello.example.com', 'zyxwvuts-rqpo-nmlk-jihg-fedcba000000');
});
assert.throws(() => {
(0, v5_js_1.default)('hello.example.com', 'invalid uuid value');
});
assert.ok((0, v5_js_1.default)('hello.example.com', '00000000-0000-0000-0000-000000000000'));
});
(0, node_test_1.default)('v5 namespace buffer validation', () => {
assert.throws(() => {
(0, v5_js_1.default)('hello.example.com', new Uint8Array(15));
});
assert.throws(() => {
(0, v5_js_1.default)('hello.example.com', new Uint8Array(17));
});
assert.ok((0, v5_js_1.default)('hello.example.com', new Uint8Array(16).fill(0)));
});
(0, node_test_1.default)('v5 fill buffer', () => {
let buf = new Uint8Array(16);
const expectedUuid = Uint8Array.of(0xfd, 0xda, 0x76, 0x5f, 0xfc, 0x57, 0x56, 0x04, 0xa2, 0x69, 0x52, 0xa7, 0xdf, 0x81, 0x64, 0xec);
const result = (0, v5_js_1.default)('hello.example.com', v5_js_1.default.DNS, buf);
assert.deepEqual(buf, expectedUuid);
assert.strictEqual(result, buf);
buf = new Uint8Array(19).fill(0xaa);
const expectedBuf = new Uint8Array(19).fill(0xaa);
expectedBuf.set(expectedUuid, 3);
(0, v5_js_1.default)('hello.example.com', v5_js_1.default.DNS, buf, 3);
assert.deepEqual(buf, expectedBuf);
});
(0, node_test_1.default)('v5 undefined/null', () => {
assert.throws(() => (0, v5_js_1.default)());
assert.throws(() => (0, v5_js_1.default)('hello'));
assert.throws(() => (0, v5_js_1.default)('hello.example.com', undefined));
assert.throws(() => (0, v5_js_1.default)('hello.example.com', null, new Uint8Array(16)));
});
(0, node_test_1.default)('v3/v5 constants', () => {
assert.strictEqual(v3_js_1.default.DNS, '6ba7b810-9dad-11d1-80b4-00c04fd430c8');
assert.strictEqual(v3_js_1.default.URL, '6ba7b811-9dad-11d1-80b4-00c04fd430c8');
assert.strictEqual(v5_js_1.default.DNS, '6ba7b810-9dad-11d1-80b4-00c04fd430c8');
assert.strictEqual(v5_js_1.default.URL, '6ba7b811-9dad-11d1-80b4-00c04fd430c8');
});
});

View file

@ -1 +0,0 @@
export {};

View file

@ -1,60 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const node_test_1 = require("node:test");
const native_js_1 = require("../native.js");
const v4_js_1 = require("../v4.js");
const randomBytesFixture = Uint8Array.of(0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36);
const expectedBytes = Uint8Array.of(16, 145, 86, 190, 196, 251, 65, 234, 177, 180, 239, 225, 103, 28, 88, 54);
(0, node_test_1.describe)('v4', () => {
(0, node_test_1.default)('subsequent UUIDs are different', () => {
const id1 = (0, v4_js_1.default)();
const id2 = (0, v4_js_1.default)();
assert.ok(id1 !== id2);
});
(0, node_test_1.default)('should uses native randomUUID() if no option is passed', async () => {
const mock = (await Promise.resolve().then(() => require('node:test'))).default.mock;
if (!mock) {
return;
}
const mockRandomUUID = mock.method(native_js_1.default, 'randomUUID');
assert.equal(mockRandomUUID.mock.callCount(), 0);
(0, v4_js_1.default)();
assert.equal(mockRandomUUID.mock.callCount(), 1);
mock.restoreAll();
});
(0, node_test_1.default)('should not use native randomUUID() if an option is passed', async () => {
const mock = (await Promise.resolve().then(() => require('node:test'))).default.mock;
if (!mock) {
return;
}
const mockRandomUUID = mock.method(native_js_1.default, 'randomUUID');
assert.equal(mockRandomUUID.mock.callCount(), 0);
(0, v4_js_1.default)({});
assert.equal(mockRandomUUID.mock.callCount(), 0);
mock.restoreAll();
});
(0, node_test_1.default)('explicit options.random produces expected result', () => {
const id = (0, v4_js_1.default)({ random: randomBytesFixture });
assert.strictEqual(id, '109156be-c4fb-41ea-b1b4-efe1671c5836');
});
(0, node_test_1.default)('explicit options.rng produces expected result', () => {
const id = (0, v4_js_1.default)({ rng: () => randomBytesFixture });
assert.strictEqual(id, '109156be-c4fb-41ea-b1b4-efe1671c5836');
});
(0, node_test_1.default)('fills one UUID into a buffer as expected', () => {
const buffer = new Uint8Array(16);
const result = (0, v4_js_1.default)({ random: randomBytesFixture }, buffer);
assert.deepEqual(buffer, expectedBytes);
assert.strictEqual(buffer, result);
});
(0, node_test_1.default)('fills two UUIDs into a buffer as expected', () => {
const buffer = new Uint8Array(32);
(0, v4_js_1.default)({ random: randomBytesFixture }, buffer, 0);
(0, v4_js_1.default)({ random: randomBytesFixture }, buffer, 16);
const expectedBuf = new Uint8Array(32);
expectedBuf.set(expectedBytes);
expectedBuf.set(expectedBytes, 16);
assert.deepEqual(buffer, expectedBuf);
});
});

View file

@ -1 +0,0 @@
export {};

Some files were not shown because too many files have changed in this diff Show more