@nr1e/commons 0.1.1 → 0.1.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/.editorconfig +0 -19
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -4
- package/.git/COMMIT_EDITMSG +0 -5
- package/.git/FETCH_HEAD +0 -1
- package/.git/HEAD +0 -1
- package/.git/config +0 -18
- package/.git/config.worktree +0 -5
- package/.git/description +0 -1
- package/.git/hooks/applypatch-msg.sample +0 -15
- package/.git/hooks/commit-msg.sample +0 -24
- package/.git/hooks/fsmonitor-watchman.sample +0 -174
- package/.git/hooks/post-update.sample +0 -8
- package/.git/hooks/pre-applypatch.sample +0 -14
- package/.git/hooks/pre-commit.sample +0 -49
- package/.git/hooks/pre-merge-commit.sample +0 -13
- package/.git/hooks/pre-push.sample +0 -53
- package/.git/hooks/pre-rebase.sample +0 -169
- package/.git/hooks/pre-receive.sample +0 -24
- package/.git/hooks/prepare-commit-msg.sample +0 -42
- package/.git/hooks/push-to-checkout.sample +0 -78
- package/.git/hooks/sendemail-validate.sample +0 -77
- package/.git/hooks/update.sample +0 -128
- package/.git/index +0 -0
- package/.git/info/exclude +0 -6
- package/.git/logs/HEAD +0 -2
- package/.git/logs/refs/heads/main +0 -2
- package/.git/logs/refs/remotes/origin/main +0 -2
- package/.git/objects/07/c0af7cd711cab6a55ad3dc349ac8c70775623c +0 -0
- package/.git/objects/0d/698432e2c44311c17b845cc63093a898972b95 +0 -0
- package/.git/objects/10/ba4a7d64968326293182d571a9c73f5e041fb6 +0 -3
- package/.git/objects/12/069a5aa45479564e00749f730582627a276a55 +0 -3
- package/.git/objects/14/5ab9cf82c40696a07ab42f117ba199acb2a50b +0 -4
- package/.git/objects/17/7b0dc4bf884f8ae0403b4aad053e76baafd632 +0 -2
- package/.git/objects/1d/a517ce3527df45a4f28e52ff2c0d9d1c8179f6 +0 -0
- package/.git/objects/27/50076ed23b5211a52ef834f40f183ddecb917a +0 -0
- package/.git/objects/2a/96e4bb57fa4bd69c719dca224b17b569e94e82 +0 -2
- package/.git/objects/2b/38c26b4ec43b8f5574acb164d2ba64bca8e230 +0 -0
- package/.git/objects/2c/61d463bee185f04e7c2bd1d2a15ad1117c589e +0 -0
- package/.git/objects/2d/22dbc836cfd75c8d7640ebe5a4fe90bd2c23c6 +0 -0
- package/.git/objects/2e/58414df7b4d5c972167a83270f78fc4ed508f5 +0 -0
- package/.git/objects/38/0be191ee415827a1217f46626fea4fefba48e5 +0 -0
- package/.git/objects/3a/93aa29cd19bdc95a87d15910baec8455f8b7b7 +0 -0
- package/.git/objects/50/150b739272269be2ede552448013eba65323da +0 -0
- package/.git/objects/53/2b7b796ffd3223f913a5a5e1e17743ee3591fe +0 -0
- package/.git/objects/54/a8535f50287f6a7a8c00aed143ca6e5ee5f5d1 +0 -0
- package/.git/objects/5d/4aa0709f62f1bc1fa80251208b570cb3b89d9c +0 -0
- package/.git/objects/63/1c43e00d4c34ba914c510f4fe2e6df15b8b06e +0 -0
- package/.git/objects/63/9900d13c6182e452e33a3bd638e70a0146c785 +0 -2
- package/.git/objects/64/3fa02661c3a1b54205729a75d2fb5f013833af +0 -0
- package/.git/objects/6c/59086d862516d2fffa5da2035e5003100fb5c7 +0 -0
- package/.git/objects/6c/b74f90a0c799eea1c54a04d8d6a8a9e9691cca +0 -2
- package/.git/objects/70/0e093acb1c1e55d523507411b7940a01a3bb65 +0 -0
- package/.git/objects/71/1ba2014bc137dece4c4156ff5e77e6abaeb95c +0 -0
- package/.git/objects/74/c82ffe8eb71efecbccfdf67b590949c944dd1a +0 -0
- package/.git/objects/76/1413a07839108abb46ef0e4490bd1c1444b4fc +0 -0
- package/.git/objects/77/96f8282f2c553ecdde72bc976478eb3a8a948e +0 -0
- package/.git/objects/79/ee123c2b23e069e35ed634d687e17f731cc702 +0 -0
- package/.git/objects/7d/80af9735f0527db35ecc79ae3c887e445cb3e0 +0 -0
- package/.git/objects/85/1d8d26c2a946ccfd5461a2573665c1fb7d71f7 +0 -0
- package/.git/objects/85/c5f24b8c55496f82a2680f94a7d3fa32887ea0 +0 -0
- package/.git/objects/87/00b3833597b600e6f0ffcfbaf622fd8cfaa9c3 +0 -1
- package/.git/objects/87/f31d3df8e7edbf96e45d80126f878b8e0c243f +0 -0
- package/.git/objects/8b/cc95b71b20c79513e9157b921238ca2c79f906 +0 -0
- package/.git/objects/8d/d819967bdc8457f04c1b5498bce89380d6552b +0 -7
- package/.git/objects/91/b0fba96bf994b6232bb923f2a9929fc258a05f +0 -0
- package/.git/objects/92/608c4e069a4301d466d8d18daecbe7abc9500e +0 -0
- package/.git/objects/94/a25f7f4cb416c083d265558da75d457237d671 +0 -0
- package/.git/objects/9c/69411050eac81b5dce09314516a30b38c41a20 +0 -3
- package/.git/objects/9f/54b5b21769da383f12fb9c7bd364bdb05e13a9 +0 -0
- package/.git/objects/a5/886c22eb68b152bb95ec5151504676d8e78ae1 +0 -0
- package/.git/objects/a6/582c9510e264f3b46fc3b20597a16923a03523 +0 -0
- package/.git/objects/a9/d7db9c0a81b2db47ca92e4e180b30090b27632 +0 -0
- package/.git/objects/ad/c418f9105db9ec488de6831584b82e3929eaef +0 -0
- package/.git/objects/b0/c1c68fbbad6b190434cd2bb0e807796bd56fca +0 -0
- package/.git/objects/b1/0f0d0ef3bc5aaf3a91be0b991cb6fe0fcadc40 +0 -0
- package/.git/objects/b6/3b642cfb4254fc0f7058903abc5b481895c4ef +0 -0
- package/.git/objects/b8/a2c461d7ffed9d4ba242c58a52341832b99e0a +0 -0
- package/.git/objects/ba/5b53857ced8d97f6d6e3fb3538b3273743dafc +0 -2
- package/.git/objects/ba/5ef7104c0d019a9692cd2d78261d96f29e916f +0 -0
- package/.git/objects/bc/91e0079eb00d56dcde16714748f36a10dbd525 +0 -0
- package/.git/objects/c1/beeb895b71b709e48560460199db11b3fc18af +0 -0
- package/.git/objects/c5/166c2aeebaeb0a0f7654223c843c50cd4c8953 +0 -0
- package/.git/objects/d4/0a2096fc36c1fd9c7a9263c458d5e8a4a5bee7 +0 -0
- package/.git/objects/e1/b744bc6076ebeb02fa86af98583ac22e070ec0 +0 -0
- package/.git/objects/e8/019be9e978a8e2f094e748cbb6ce0c7163adee +0 -0
- package/.git/objects/eb/1d744c4e9b47bc902647298424320078e32980 +0 -0
- package/.git/objects/ee/15af38be7f3c3862229e59c6b5688f8e0f6099 +0 -0
- package/.git/objects/f1/9e0f429f231c34432784f9e33b92ac1d598c17 +0 -0
- package/.git/objects/f9/86f2fe82493e85651396b6d5886316d1c890dd +0 -0
- package/.git/refs/heads/main +0 -1
- package/.git/refs/remotes/origin/main +0 -1
- package/.git/refs/tags/v0.1.1 +0 -1
- package/.git/shallow +0 -1
- package/.github/dependabot.yml +0 -10
- package/.github/workflows/ci.yml +0 -12
- package/.github/workflows/issues.yml +0 -13
- package/.github/workflows/publish.yml +0 -21
- package/.gitignore +0 -13
- package/.idea/.gitignore +0 -10
- package/.idea/aws.xml +0 -11
- package/.idea/codeStyles/Project.xml +0 -58
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/commons-js.iml +0 -14
- package/.idea/inspectionProfiles/Project_Default.xml +0 -7
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/.npmrc +0 -1
- package/.prettierignore +0 -7
- package/.prettierrc.cjs +0 -3
- package/LICENSE +0 -26
- package/README.md +0 -14
- package/coverage/base.css +0 -224
- package/coverage/bitsnbytes/b64.mts.html +0 -559
- package/coverage/bitsnbytes/index.html +0 -131
- package/coverage/bitsnbytes/index.mts.html +0 -88
- package/coverage/clover.xml +0 -1003
- package/coverage/coverage-final.json +0 -15
- package/coverage/errors/errors.mts.html +0 -898
- package/coverage/errors/index.html +0 -131
- package/coverage/errors/index.mts.html +0 -88
- package/coverage/favicon.png +0 -0
- package/coverage/http/http-method.mts.html +0 -112
- package/coverage/http/http-status-code.mts.html +0 -211
- package/coverage/http/index.html +0 -146
- package/coverage/http/index.mts.html +0 -91
- package/coverage/index.html +0 -191
- package/coverage/lang/index.html +0 -146
- package/coverage/lang/index.mts.html +0 -91
- package/coverage/lang/sleep.mts.html +0 -109
- package/coverage/lang/type-functions.mts.html +0 -124
- package/coverage/oauth/crypto-functions.mts.html +0 -217
- package/coverage/oauth/index.html +0 -131
- package/coverage/oauth/index.mts.html +0 -88
- package/coverage/prettify.css +0 -1
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/validator/index.html +0 -131
- package/coverage/validator/index.mts.html +0 -88
- package/coverage/validator/validators.mts.html +0 -1237
- package/dist/bitsnbytes/b64.test.d.mts +0 -2
- package/dist/bitsnbytes/b64.test.d.mts.map +0 -1
- package/dist/bitsnbytes/b64.test.mjs +0 -71
- package/dist/bitsnbytes/b64.test.mjs.map +0 -1
- package/dist/errors/errors.test.d.mts +0 -2
- package/dist/errors/errors.test.d.mts.map +0 -1
- package/dist/errors/errors.test.mjs +0 -45
- package/dist/errors/errors.test.mjs.map +0 -1
- package/dist/oauth/crypto-functions.test.d.mts +0 -2
- package/dist/oauth/crypto-functions.test.d.mts.map +0 -1
- package/dist/oauth/crypto-functions.test.mjs +0 -36
- package/dist/oauth/crypto-functions.test.mjs.map +0 -1
- package/dist/package.json +0 -72
- package/dist/validator/validators.test.d.mts +0 -2
- package/dist/validator/validators.test.d.mts.map +0 -1
- package/dist/validator/validators.test.mjs +0 -177
- package/dist/validator/validators.test.mjs.map +0 -1
- package/node_modules/@eslint/eslintrc/LICENSE +0 -19
- package/node_modules/@eslint/eslintrc/README.md +0 -115
- package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +0 -1104
- package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +0 -1
- package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +0 -4344
- package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +0 -1
- package/node_modules/@eslint/eslintrc/package.json +0 -82
- package/node_modules/@eslint/eslintrc/universal.js +0 -9
- package/node_modules/@eslint/js/LICENSE +0 -19
- package/node_modules/@eslint/js/README.md +0 -57
- package/node_modules/@eslint/js/package.json +0 -31
- package/node_modules/@eslint/js/src/index.js +0 -17
- package/node_modules/@eslint-community/eslint-utils/LICENSE +0 -21
- package/node_modules/@eslint-community/eslint-utils/README.md +0 -37
- package/node_modules/@eslint-community/eslint-utils/index.js +0 -2068
- package/node_modules/@eslint-community/eslint-utils/index.js.map +0 -1
- package/node_modules/@eslint-community/eslint-utils/index.mjs +0 -2027
- package/node_modules/@eslint-community/eslint-utils/index.mjs.map +0 -1
- package/node_modules/@eslint-community/eslint-utils/package.json +0 -73
- package/node_modules/@eslint-community/regexpp/LICENSE +0 -21
- package/node_modules/@eslint-community/regexpp/README.md +0 -177
- package/node_modules/@eslint-community/regexpp/index.d.ts +0 -1065
- package/node_modules/@eslint-community/regexpp/index.js +0 -2747
- package/node_modules/@eslint-community/regexpp/index.js.map +0 -1
- package/node_modules/@eslint-community/regexpp/index.mjs +0 -2737
- package/node_modules/@eslint-community/regexpp/index.mjs.map +0 -1
- package/node_modules/@eslint-community/regexpp/package.json +0 -93
- package/node_modules/@types/node/LICENSE +0 -21
- package/node_modules/@types/node/README.md +0 -15
- package/node_modules/@types/node/package.json +0 -217
- package/node_modules/@typescript-eslint/eslint-plugin/LICENSE +0 -21
- package/node_modules/@typescript-eslint/eslint-plugin/README.md +0 -10
- package/node_modules/@typescript-eslint/eslint-plugin/dist/index.js +0 -23
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/README.md +0 -23
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/TEMPLATE.md +0 -26
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/adjacent-overload-signatures.md +0 -93
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/array-type.md +0 -103
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/await-thenable.md +0 -40
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-ts-comment.md +0 -148
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-tslint-comment.md +0 -39
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-types.md +0 -183
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/block-spacing.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/brace-style.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/camelcase.md +0 -10
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/class-literal-property-style.md +0 -114
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-dangle.md +0 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-spacing.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-generic-constructors.md +0 -73
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-indexed-object-style.md +0 -80
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-assertions.md +0 -108
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-definitions.md +0 -82
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-exports.md +0 -100
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-imports.md +0 -105
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/default-param-last.md +0 -48
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/dot-notation.md +0 -77
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-function-return-type.md +0 -319
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-member-accessibility.md +0 -331
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-module-boundary-types.md +0 -250
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/func-call-spacing.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/indent.md +0 -20
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/init-declarations.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/key-spacing.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/keyword-spacing.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/lines-around-comment.md +0 -37
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/lines-between-class-members.md +0 -63
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-delimiter-style.md +0 -161
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md +0 -1360
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/method-signature-style.md +0 -110
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/naming-convention.md +0 -706
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-array-constructor.md +0 -35
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-base-to-string.md +0 -88
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md +0 -56
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-void-expression.md +0 -116
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dupe-class-members.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-enum-values.md +0 -50
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-imports.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-type-constituents.md +0 -61
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dynamic-delete.md +0 -53
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-function.md +0 -88
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-interface.md +0 -70
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-explicit-any.md +0 -174
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-non-null-assertion.md +0 -52
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-parens.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-semi.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extraneous-class.md +0 -294
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-floating-promises.md +0 -106
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-for-in-array.md +0 -56
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implicit-any-catch.md +0 -73
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implied-eval.md +0 -101
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-import-type-side-effects.md +0 -75
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-inferrable-types.md +0 -103
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-this.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-void-type.md +0 -113
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loop-func.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loss-of-precision.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-magic-numbers.md +0 -131
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-meaningless-void-operator.md +0 -47
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-new.md +0 -46
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-promises.md +0 -245
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-mixed-enums.md +0 -88
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-namespace.md +0 -129
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md +0 -49
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md +0 -35
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-assertion.md +0 -42
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-parameter-properties.md +0 -406
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redeclare.md +0 -73
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redundant-type-constituents.md +0 -78
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-require-imports.md +0 -37
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-restricted-imports.md +0 -63
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-shadow.md +0 -101
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-this-alias.md +0 -38
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-throw-literal.md +0 -111
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-type-alias.md +0 -602
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md +0 -133
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-condition.md +0 -103
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-qualifier.md +0 -51
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md +0 -73
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md +0 -77
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md +0 -55
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-argument.md +0 -83
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-assignment.md +0 -86
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-call.md +0 -58
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-declaration-merging.md +0 -54
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-enum-comparison.md +0 -75
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-member-access.md +0 -64
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-return.md +0 -103
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-expressions.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-vars.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-use-before-define.md +0 -97
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-constructor.md +0 -21
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-empty-export.md +0 -43
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-var-requires.md +0 -37
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md +0 -41
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/object-curly-spacing.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/padding-line-between-statements.md +0 -35
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/parameter-properties.md +0 -485
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-as-const.md +0 -44
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-enum-initializers.md +0 -62
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-for-of.md +0 -46
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-function-type.md +0 -92
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-includes.md +0 -77
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-literal-enum-member.md +0 -101
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-namespace-keyword.md +0 -47
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-nullish-coalescing.md +0 -164
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md +0 -71
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md +0 -268
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly.md +0 -87
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md +0 -58
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-regexp-exec.md +0 -46
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-return-this-type.md +0 -87
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md +0 -57
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-ts-expect-error.md +0 -69
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/promise-function-async.md +0 -59
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/quotes.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-array-sort-compare.md +0 -78
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-await.md +0 -24
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-plus-operands.md +0 -208
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-template-expressions.md +0 -117
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/return-await.md +0 -216
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/semi.md +0 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-constituents.md +0 -101
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-union-intersection-members.md +0 -106
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-blocks.md +0 -42
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-function-paren.md +0 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-infix-ops.md +0 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/strict-boolean-expressions.md +0 -183
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/switch-exhaustiveness-check.md +0 -106
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/triple-slash-reference.md +0 -61
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/type-annotation-spacing.md +0 -303
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/typedef.md +0 -320
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unbound-method.md +0 -103
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unified-signatures.md +0 -70
- package/node_modules/@typescript-eslint/eslint-plugin/index.d.ts +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/package.json +0 -87
- package/node_modules/@typescript-eslint/parser/LICENSE +0 -22
- package/node_modules/@typescript-eslint/parser/README.md +0 -10
- package/node_modules/@typescript-eslint/parser/dist/index.js +0 -17
- package/node_modules/@typescript-eslint/parser/package.json +0 -75
- package/node_modules/@typescript-eslint/scope-manager/LICENSE +0 -21
- package/node_modules/@typescript-eslint/scope-manager/README.md +0 -8
- package/node_modules/@typescript-eslint/scope-manager/dist/index.js +0 -31
- package/node_modules/@typescript-eslint/scope-manager/package.json +0 -67
- package/node_modules/@typescript-eslint/type-utils/LICENSE +0 -21
- package/node_modules/@typescript-eslint/type-utils/README.md +0 -12
- package/node_modules/@typescript-eslint/type-utils/dist/index.js +0 -36
- package/node_modules/@typescript-eslint/type-utils/package.json +0 -71
- package/node_modules/@typescript-eslint/types/LICENSE +0 -21
- package/node_modules/@typescript-eslint/types/README.md +0 -12
- package/node_modules/@typescript-eslint/types/dist/index.js +0 -24
- package/node_modules/@typescript-eslint/types/package.json +0 -84
- package/node_modules/@typescript-eslint/typescript-estree/LICENSE +0 -26
- package/node_modules/@typescript-eslint/typescript-estree/README.md +0 -10
- package/node_modules/@typescript-eslint/typescript-estree/dist/index.js +0 -38
- package/node_modules/@typescript-eslint/typescript-estree/package.json +0 -85
- package/node_modules/@typescript-eslint/utils/LICENSE +0 -21
- package/node_modules/@typescript-eslint/utils/README.md +0 -10
- package/node_modules/@typescript-eslint/utils/dist/index.js +0 -41
- package/node_modules/@typescript-eslint/utils/package.json +0 -70
- package/node_modules/@typescript-eslint/visitor-keys/LICENSE +0 -21
- package/node_modules/@typescript-eslint/visitor-keys/README.md +0 -10
- package/node_modules/@typescript-eslint/visitor-keys/dist/index.js +0 -8
- package/node_modules/@typescript-eslint/visitor-keys/package.json +0 -60
- package/node_modules/@vitest/coverage-v8/LICENSE +0 -21
- package/node_modules/@vitest/coverage-v8/dist/index.js +0 -54
- package/node_modules/@vitest/coverage-v8/package.json +0 -72
- package/pnpm-lock.yaml +0 -3277
- package/src/bitsnbytes/b64.mts +0 -158
- package/src/bitsnbytes/b64.test.mts +0 -78
- package/src/bitsnbytes/index.mts +0 -1
- package/src/errors/errors.mts +0 -271
- package/src/errors/errors.test.mts +0 -74
- package/src/errors/index.mts +0 -1
- package/src/http/http-method.mts +0 -9
- package/src/http/http-status-code.mts +0 -42
- package/src/http/index.mts +0 -2
- package/src/lang/index.mts +0 -2
- package/src/lang/sleep.mts +0 -8
- package/src/lang/type-functions.mts +0 -13
- package/src/oauth/crypto-functions.mts +0 -44
- package/src/oauth/crypto-functions.test.mts +0 -48
- package/src/oauth/index.mts +0 -1
- package/src/validator/index.mts +0 -1
- package/src/validator/validators.mts +0 -384
- package/src/validator/validators.test.mts +0 -245
- package/tsconfig.json +0 -18
- /package/{dist/bitsnbytes → bitsnbytes}/b64.d.mts +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/b64.d.mts.map +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/b64.mjs +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/b64.mjs.map +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/index.d.mts +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/index.d.mts.map +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/index.mjs +0 -0
- /package/{dist/bitsnbytes → bitsnbytes}/index.mjs.map +0 -0
- /package/{dist/errors → errors}/errors.d.mts +0 -0
- /package/{dist/errors → errors}/errors.d.mts.map +0 -0
- /package/{dist/errors → errors}/errors.mjs +0 -0
- /package/{dist/errors → errors}/errors.mjs.map +0 -0
- /package/{dist/errors → errors}/index.d.mts +0 -0
- /package/{dist/errors → errors}/index.d.mts.map +0 -0
- /package/{dist/errors → errors}/index.mjs +0 -0
- /package/{dist/errors → errors}/index.mjs.map +0 -0
- /package/{dist/http → http}/http-method.d.mts +0 -0
- /package/{dist/http → http}/http-method.d.mts.map +0 -0
- /package/{dist/http → http}/http-method.mjs +0 -0
- /package/{dist/http → http}/http-method.mjs.map +0 -0
- /package/{dist/http → http}/http-status-code.d.mts +0 -0
- /package/{dist/http → http}/http-status-code.d.mts.map +0 -0
- /package/{dist/http → http}/http-status-code.mjs +0 -0
- /package/{dist/http → http}/http-status-code.mjs.map +0 -0
- /package/{dist/http → http}/index.d.mts +0 -0
- /package/{dist/http → http}/index.d.mts.map +0 -0
- /package/{dist/http → http}/index.mjs +0 -0
- /package/{dist/http → http}/index.mjs.map +0 -0
- /package/{dist/lang → lang}/index.d.mts +0 -0
- /package/{dist/lang → lang}/index.d.mts.map +0 -0
- /package/{dist/lang → lang}/index.mjs +0 -0
- /package/{dist/lang → lang}/index.mjs.map +0 -0
- /package/{dist/lang → lang}/sleep.d.mts +0 -0
- /package/{dist/lang → lang}/sleep.d.mts.map +0 -0
- /package/{dist/lang → lang}/sleep.mjs +0 -0
- /package/{dist/lang → lang}/sleep.mjs.map +0 -0
- /package/{dist/lang → lang}/type-functions.d.mts +0 -0
- /package/{dist/lang → lang}/type-functions.d.mts.map +0 -0
- /package/{dist/lang → lang}/type-functions.mjs +0 -0
- /package/{dist/lang → lang}/type-functions.mjs.map +0 -0
- /package/{dist/oauth → oauth}/crypto-functions.d.mts +0 -0
- /package/{dist/oauth → oauth}/crypto-functions.d.mts.map +0 -0
- /package/{dist/oauth → oauth}/crypto-functions.mjs +0 -0
- /package/{dist/oauth → oauth}/crypto-functions.mjs.map +0 -0
- /package/{dist/oauth → oauth}/index.d.mts +0 -0
- /package/{dist/oauth → oauth}/index.d.mts.map +0 -0
- /package/{dist/oauth → oauth}/index.mjs +0 -0
- /package/{dist/oauth → oauth}/index.mjs.map +0 -0
- /package/{dist/validator → validator}/index.d.mts +0 -0
- /package/{dist/validator → validator}/index.d.mts.map +0 -0
- /package/{dist/validator → validator}/index.mjs +0 -0
- /package/{dist/validator → validator}/index.mjs.map +0 -0
- /package/{dist/validator → validator}/validators.d.mts +0 -0
- /package/{dist/validator → validator}/validators.d.mts.map +0 -0
- /package/{dist/validator → validator}/validators.mjs +0 -0
- /package/{dist/validator → validator}/validators.mjs.map +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"b64.test.d.mts","sourceRoot":"","sources":["../../src/bitsnbytes/b64.test.mts"],"names":[],"mappings":""}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { test, expect } from 'vitest';
|
|
2
|
-
import { stob64s, tob64s } from './b64.mjs';
|
|
3
|
-
import * as crypto from 'crypto';
|
|
4
|
-
test('Test tob64', () => {
|
|
5
|
-
const str = '"Computer, compute to the last digit the value of pi" -- Spock';
|
|
6
|
-
let b64s = [
|
|
7
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gU3BvY2s=',
|
|
8
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gU3BvYw==',
|
|
9
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gU3Bv',
|
|
10
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gU3A=',
|
|
11
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gUw==',
|
|
12
|
-
'IkN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gLS0gU3A',
|
|
28
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gUw',
|
|
29
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0g',
|
|
30
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0',
|
|
31
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLQ',
|
|
32
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIg',
|
|
33
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSI',
|
|
34
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaQ',
|
|
35
|
-
];
|
|
36
|
-
for (let i = 0; i < b64s.length; i++) {
|
|
37
|
-
expect(b64s[i]).toBe(stob64s(str.substring(0, str.length - i), { b64chars: 'url' }));
|
|
38
|
-
}
|
|
39
|
-
// Test YUI modified base64 encoding
|
|
40
|
-
b64s = [
|
|
41
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gU3BvY2s-',
|
|
42
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gU3BvYw--',
|
|
43
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gU3Bv',
|
|
44
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gU3A-',
|
|
45
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gUw--',
|
|
46
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0g',
|
|
47
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0-',
|
|
48
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLQ--',
|
|
49
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIg',
|
|
50
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSI-',
|
|
51
|
-
'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaQ--',
|
|
52
|
-
];
|
|
53
|
-
for (let i = 0; i < b64s.length; i++) {
|
|
54
|
-
expect(b64s[i]).toBe(stob64s(str.substring(0, str.length - i), { b64chars: 'yui' }));
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
test('Compare to Node', () => {
|
|
58
|
-
for (let i = 0; i < 100; i++) {
|
|
59
|
-
const bytes = crypto.randomBytes(16);
|
|
60
|
-
const str = tob64s(bytes, { b64chars: 'url' });
|
|
61
|
-
const nodeStr = bytes.toString('base64url');
|
|
62
|
-
expect(str).toEqual(nodeStr);
|
|
63
|
-
}
|
|
64
|
-
for (let i = 0; i < 100; i++) {
|
|
65
|
-
const bytes = crypto.randomBytes(16);
|
|
66
|
-
const str = tob64s(bytes, { b64chars: 'b64' });
|
|
67
|
-
const nodeStr = bytes.toString('base64');
|
|
68
|
-
expect(str).toEqual(nodeStr);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
//# sourceMappingURL=b64.test.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"b64.test.mjs","sourceRoot":"","sources":["../../src/bitsnbytes/b64.test.mts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE;IACtB,MAAM,GAAG,GAAG,gEAAgE,CAAC;IAC7E,IAAI,IAAI,GAAG;QACT,sFAAsF;QACtF,sFAAsF;QACtF,kFAAkF;QAClF,kFAAkF;QAClF,kFAAkF;QAClF,8EAA8E;QAC9E,8EAA8E;QAC9E,8EAA8E;QAC9E,0EAA0E;QAC1E,0EAA0E;QAC1E,0EAA0E;KAC3E,CAAC;IACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,oCAAoC;IACpC,IAAI,GAAG;QACL,qFAAqF;QACrF,oFAAoF;QACpF,kFAAkF;QAClF,iFAAiF;QACjF,gFAA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AC,QAAQ,EAAE,KAAK,EAAC,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC5C,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACrC,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACzC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import {test, expect} from 'vitest';\nimport {stob64s, tob64s} from './b64.mjs';\nimport * as crypto from 'crypto';\n\ntest('Test tob64', () => {\n const str = '\"Computer, compute to the last digit the value of pi\" -- Spock';\n let b64s = [\n 'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gU3BvY2s=',\n 'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gU3BvYw==',\n 'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gU3Bv',\n 'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0gU3A=',\n 'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRp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LS0gUw--',\n 'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0g',\n 'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLS0-',\n 'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIgLQ--',\n 'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSIg',\n 'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaSI-',\n 'IkNvbXB1dGVyLCBjb21wdXRlIHRvIHRoZSBsYXN0IGRpZ2l0IHRoZSB2YWx1ZSBvZiBwaQ--',\n ];\n for (let i = 0; i < b64s.length; i++) {\n expect(b64s[i]).toBe(\n stob64s(str.substring(0, str.length - i), {b64chars: 'yui'})\n );\n }\n});\n\ntest('Compare to Node', () => {\n for (let i = 0; i < 100; i++) {\n const bytes = crypto.randomBytes(16);\n const str = tob64s(bytes, {b64chars: 'url'});\n const nodeStr = bytes.toString('base64url');\n expect(str).toEqual(nodeStr);\n }\n for (let i = 0; i < 100; i++) {\n const bytes = crypto.randomBytes(16);\n const str = tob64s(bytes, {b64chars: 'b64'});\n const nodeStr = bytes.toString('base64');\n expect(str).toEqual(nodeStr);\n }\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.test.d.mts","sourceRoot":"","sources":["../../src/errors/errors.test.mts"],"names":[],"mappings":""}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { test, expect } from 'vitest';
|
|
2
|
-
import { BadRequestError, ForbiddenError, InternalServerError, isBadRequestError, isForbiddenError, isInternalServerError, isNotFoundError, isValidationError, NotFoundError, toError, ValidationError, } from './errors.mjs';
|
|
3
|
-
import { HttpStatusCode } from '../http/index.mjs';
|
|
4
|
-
test('Test isNotFoundError', () => {
|
|
5
|
-
expect(isNotFoundError(undefined)).toBeFalsy();
|
|
6
|
-
expect(isNotFoundError(null)).toBeFalsy();
|
|
7
|
-
expect(isNotFoundError({})).toBeFalsy();
|
|
8
|
-
expect(isNotFoundError(new ForbiddenError('just a test'))).toBeFalsy();
|
|
9
|
-
expect(isNotFoundError(new NotFoundError('just a test'))).toBeTruthy();
|
|
10
|
-
});
|
|
11
|
-
test('Test isForbiddenError', () => {
|
|
12
|
-
expect(isForbiddenError(undefined)).toBeFalsy();
|
|
13
|
-
expect(isForbiddenError(null)).toBeFalsy();
|
|
14
|
-
expect(isForbiddenError({})).toBeFalsy();
|
|
15
|
-
expect(isForbiddenError(new NotFoundError('just a test'))).toBeFalsy();
|
|
16
|
-
expect(isForbiddenError(new ForbiddenError('just a test'))).toBeTruthy();
|
|
17
|
-
});
|
|
18
|
-
test('Test isValidationError', () => {
|
|
19
|
-
expect(isValidationError(undefined)).toBeFalsy();
|
|
20
|
-
expect(isValidationError(null)).toBeFalsy();
|
|
21
|
-
expect(isValidationError({})).toBeFalsy();
|
|
22
|
-
expect(isValidationError(new NotFoundError('just a test'))).toBeFalsy();
|
|
23
|
-
expect(isValidationError(new ValidationError('just a test'))).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
test('Test isBadRequestError', () => {
|
|
26
|
-
expect(isBadRequestError(undefined)).toBeFalsy();
|
|
27
|
-
expect(isBadRequestError(null)).toBeFalsy();
|
|
28
|
-
expect(isBadRequestError({})).toBeFalsy();
|
|
29
|
-
expect(isBadRequestError(new NotFoundError('just a test'))).toBeFalsy();
|
|
30
|
-
expect(isBadRequestError(new BadRequestError('just a test'))).toBeTruthy();
|
|
31
|
-
});
|
|
32
|
-
test('Test isInternalServerError', () => {
|
|
33
|
-
expect(isInternalServerError(undefined)).toBeFalsy();
|
|
34
|
-
expect(isInternalServerError(null)).toBeFalsy();
|
|
35
|
-
expect(isInternalServerError({})).toBeFalsy();
|
|
36
|
-
expect(isInternalServerError(new NotFoundError('just a test'))).toBeFalsy();
|
|
37
|
-
expect(isInternalServerError(new InternalServerError('just a test'))).toBeTruthy();
|
|
38
|
-
});
|
|
39
|
-
test('Test toError', () => {
|
|
40
|
-
expect(isNotFoundError(toError(HttpStatusCode.NOT_FOUND, 'some message'))).toBeTruthy();
|
|
41
|
-
expect(isForbiddenError(toError(HttpStatusCode.FORBIDDEN, 'some message'))).toBeTruthy();
|
|
42
|
-
expect(isBadRequestError(toError(HttpStatusCode.BAD_REQUEST, 'some message'))).toBeTruthy();
|
|
43
|
-
expect(isInternalServerError(toError(HttpStatusCode.INTERNAL_SERVER_ERROR, 'some message'))).toBeTruthy();
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=errors.test.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.test.mjs","sourceRoot":"","sources":["../../src/errors/errors.test.mts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,EACL,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,OAAO,EACP,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAEjD,IAAI,CAAC,sBAAsB,EAAE,GAAG,EAAE;IAChC,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAC/C,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAC1C,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACxC,MAAM,CAAC,eAAe,CAAC,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OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CACvE,CAAC,UAAU,EAAE,CAAC;IACf,MAAM,CACJ,qBAAqB,CACnB,OAAO,CAAC,cAAc,CAAC,qBAAqB,EAAE,cAAc,CAAC,CAC9D,CACF,CAAC,UAAU,EAAE,CAAC;AACjB,CAAC,CAAC,CAAC","sourcesContent":["import {test, expect} from 'vitest';\nimport {\n BadRequestError,\n ForbiddenError,\n InternalServerError,\n isBadRequestError,\n isForbiddenError,\n isInternalServerError,\n isNotFoundError,\n isValidationError,\n NotFoundError,\n toError,\n ValidationError,\n} from './errors.mjs';\nimport {HttpStatusCode} from '../http/index.mjs';\n\ntest('Test isNotFoundError', () => {\n expect(isNotFoundError(undefined)).toBeFalsy();\n expect(isNotFoundError(null)).toBeFalsy();\n expect(isNotFoundError({})).toBeFalsy();\n expect(isNotFoundError(new ForbiddenError('just a test'))).toBeFalsy();\n expect(isNotFoundError(new NotFoundError('just a test'))).toBeTruthy();\n});\n\ntest('Test isForbiddenError', () => {\n expect(isForbiddenError(undefined)).toBeFalsy();\n expect(isForbiddenError(null)).toBeFalsy();\n expect(isForbiddenError({})).toBeFalsy();\n expect(isForbiddenError(new NotFoundError('just a test'))).toBeFalsy();\n expect(isForbiddenError(new ForbiddenError('just a test'))).toBeTruthy();\n});\n\ntest('Test isValidationError', () => {\n expect(isValidationError(undefined)).toBeFalsy();\n expect(isValidationError(null)).toBeFalsy();\n expect(isValidationError({})).toBeFalsy();\n expect(isValidationError(new NotFoundError('just a test'))).toBeFalsy();\n expect(isValidationError(new ValidationError('just a test'))).toBeTruthy();\n});\n\ntest('Test isBadRequestError', () => {\n expect(isBadRequestError(undefined)).toBeFalsy();\n expect(isBadRequestError(null)).toBeFalsy();\n expect(isBadRequestError({})).toBeFalsy();\n expect(isBadRequestError(new NotFoundError('just a test'))).toBeFalsy();\n expect(isBadRequestError(new BadRequestError('just a test'))).toBeTruthy();\n});\n\ntest('Test isInternalServerError', () => {\n expect(isInternalServerError(undefined)).toBeFalsy();\n expect(isInternalServerError(null)).toBeFalsy();\n expect(isInternalServerError({})).toBeFalsy();\n expect(isInternalServerError(new NotFoundError('just a test'))).toBeFalsy();\n expect(\n isInternalServerError(new InternalServerError('just a test'))\n ).toBeTruthy();\n});\n\ntest('Test toError', () => {\n expect(\n isNotFoundError(toError(HttpStatusCode.NOT_FOUND, 'some message'))\n ).toBeTruthy();\n expect(\n isForbiddenError(toError(HttpStatusCode.FORBIDDEN, 'some message'))\n ).toBeTruthy();\n expect(\n isBadRequestError(toError(HttpStatusCode.BAD_REQUEST, 'some message'))\n ).toBeTruthy();\n expect(\n isInternalServerError(\n toError(HttpStatusCode.INTERNAL_SERVER_ERROR, 'some message')\n )\n ).toBeTruthy();\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-functions.test.d.mts","sourceRoot":"","sources":["../../src/oauth/crypto-functions.test.mts"],"names":[],"mappings":""}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { test, expect } from 'vitest';
|
|
2
|
-
import { generateNonce, generateSecret, generateState, } from './crypto-functions.mjs';
|
|
3
|
-
test('Test generateState', () => {
|
|
4
|
-
const state = generateState();
|
|
5
|
-
expect(state).toMatch(/^[A-Za-z0-9_-]{22}$/);
|
|
6
|
-
});
|
|
7
|
-
test('Test generateState with custom length', () => {
|
|
8
|
-
const state = generateState(32);
|
|
9
|
-
expect(state).toMatch(/^[A-Za-z0-9_-]{43}$/);
|
|
10
|
-
});
|
|
11
|
-
test('Test generateState with invalid length', () => {
|
|
12
|
-
expect(() => generateState(10)).toThrow('State must be at least 16 bytes');
|
|
13
|
-
});
|
|
14
|
-
test('Test generateNonce', () => {
|
|
15
|
-
const nonce = generateNonce();
|
|
16
|
-
expect(nonce).toMatch(/^[A-Za-z0-9_-]{22}$/);
|
|
17
|
-
});
|
|
18
|
-
test('Test generateNonce with custom length', () => {
|
|
19
|
-
const nonce = generateNonce(32);
|
|
20
|
-
expect(nonce).toMatch(/^[A-Za-z0-9_-]{43}$/);
|
|
21
|
-
});
|
|
22
|
-
test('Test generateNonce with invalid length', () => {
|
|
23
|
-
expect(() => generateNonce(10)).toThrow('Nonce must be at least 16 bytes');
|
|
24
|
-
});
|
|
25
|
-
test('Test generateSecret', () => {
|
|
26
|
-
const secret = generateSecret();
|
|
27
|
-
expect(secret).toMatch(/^[A-Za-z0-9_-]{43}$/);
|
|
28
|
-
});
|
|
29
|
-
test('Test generateSecret with custom length', () => {
|
|
30
|
-
const secret = generateSecret(64);
|
|
31
|
-
expect(secret).toMatch(/^[A-Za-z0-9_-]{86}$/);
|
|
32
|
-
});
|
|
33
|
-
test('Test generateSecret with invalid length', () => {
|
|
34
|
-
expect(() => generateSecret(10)).toThrow('Secret must be at least 32 bytes');
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=crypto-functions.test.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-functions.test.mjs","sourceRoot":"","sources":["../../src/oauth/crypto-functions.test.mts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,EACL,aAAa,EACb,cAAc,EACd,aAAa,GACd,MAAM,wBAAwB,CAAC;AAEhC,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAC9B,MAAM,KAAK,GAAG,aAAa,EAAE,CAAC;IAC9B,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC/C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,uCAAuC,EAAE,GAAG,EAAE;IACjD,MAAM,KAAK,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;IAChC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC/C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,wCAAwC,EAAE,GAAG,EAAE;I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":["import {test, expect} from 'vitest';\nimport {\n generateNonce,\n generateSecret,\n generateState,\n} from './crypto-functions.mjs';\n\ntest('Test generateState', () => {\n const state = generateState();\n expect(state).toMatch(/^[A-Za-z0-9_-]{22}$/);\n});\n\ntest('Test generateState with custom length', () => {\n const state = generateState(32);\n expect(state).toMatch(/^[A-Za-z0-9_-]{43}$/);\n});\n\ntest('Test generateState with invalid length', () => {\n expect(() => generateState(10)).toThrow('State must be at least 16 bytes');\n});\n\ntest('Test generateNonce', () => {\n const nonce = generateNonce();\n expect(nonce).toMatch(/^[A-Za-z0-9_-]{22}$/);\n});\n\ntest('Test generateNonce with custom length', () => {\n const nonce = generateNonce(32);\n expect(nonce).toMatch(/^[A-Za-z0-9_-]{43}$/);\n});\n\ntest('Test generateNonce with invalid length', () => {\n expect(() => generateNonce(10)).toThrow('Nonce must be at least 16 bytes');\n});\n\ntest('Test generateSecret', () => {\n const secret = generateSecret();\n expect(secret).toMatch(/^[A-Za-z0-9_-]{43}$/);\n});\n\ntest('Test generateSecret with custom length', () => {\n const secret = generateSecret(64);\n expect(secret).toMatch(/^[A-Za-z0-9_-]{86}$/);\n});\n\ntest('Test generateSecret with invalid length', () => {\n expect(() => generateSecret(10)).toThrow('Secret must be at least 32 bytes');\n});\n"]}
|
package/dist/package.json
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nr1e/commons",
|
|
3
|
-
"description": "Provides common patterns for validation",
|
|
4
|
-
"version": "0.1.1",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"author": "NR1E, Inc.",
|
|
7
|
-
"publishConfig": {
|
|
8
|
-
"access": "public"
|
|
9
|
-
},
|
|
10
|
-
"license": "BSD-3-Clause",
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "https://github.com/nr1etech/commons-js.git"
|
|
14
|
-
},
|
|
15
|
-
"bugs": {
|
|
16
|
-
"url": "https://github.com/nr1etech/commons-js/issues"
|
|
17
|
-
},
|
|
18
|
-
"homepage": "https://github.com/nr1etech/commons-js#readme",
|
|
19
|
-
"files": [
|
|
20
|
-
"**"
|
|
21
|
-
],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "tsc",
|
|
24
|
-
"postbuild": "prettier --check . && gts lint && cp package.json dist",
|
|
25
|
-
"watch": "tsc -w",
|
|
26
|
-
"test": "vitest run --coverage",
|
|
27
|
-
"lint": "gts lint",
|
|
28
|
-
"clean": "rm -rf dist && rm -rf site && rm -rf coverage",
|
|
29
|
-
"fix": "gts fix",
|
|
30
|
-
"makepretty": "prettier --write .",
|
|
31
|
-
"site": "typedoc --out site \"src/**/*.mts\" --exclude \"src/**/*.test.*\""
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@types/node": "20.14.2",
|
|
35
|
-
"@vitest/coverage-v8": "^1.6.0",
|
|
36
|
-
"gts": "^5.3.1",
|
|
37
|
-
"ts-node": "^10.9.2",
|
|
38
|
-
"typedoc": "^0.25.13",
|
|
39
|
-
"typescript": "~5.4.5",
|
|
40
|
-
"vitest": "^1.6.0"
|
|
41
|
-
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"tslib": "^2.6.3"
|
|
44
|
-
},
|
|
45
|
-
"exports": {
|
|
46
|
-
"./bitsnbytes": {
|
|
47
|
-
"import": "./bitsnbytes/index.mjs",
|
|
48
|
-
"types": "./bitsnbytes/index.d.mts"
|
|
49
|
-
},
|
|
50
|
-
"./errors": {
|
|
51
|
-
"import": "./errors/index.mjs",
|
|
52
|
-
"types": "./errors/index.d.mts"
|
|
53
|
-
},
|
|
54
|
-
"./http": {
|
|
55
|
-
"import": "./http/index.mjs",
|
|
56
|
-
"types": "./http/index.d.mts"
|
|
57
|
-
},
|
|
58
|
-
"./lang": {
|
|
59
|
-
"import": "./lang/index.mjs",
|
|
60
|
-
"types": "./lang/index.d.mts"
|
|
61
|
-
},
|
|
62
|
-
"./oauth": {
|
|
63
|
-
"import": "./oauth/index.mjs",
|
|
64
|
-
"types": "./oauth/index.d.mts"
|
|
65
|
-
},
|
|
66
|
-
"./package.json": "./package.json",
|
|
67
|
-
"./validator": {
|
|
68
|
-
"import": "./validator/index.mjs",
|
|
69
|
-
"types": "./validator/index.d.mts"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validators.test.d.mts","sourceRoot":"","sources":["../../src/validator/validators.test.mts"],"names":[],"mappings":""}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { test, expect } from 'vitest';
|
|
2
|
-
import { betweenValues, email, number, maxLength, maxValue, minLength, minValue, notBlank, notEmpty, notNull, validString, isNotNull, isNotEmpty, isNotBlank, match, isMatch, isEmail, isMaxLength, isMinLength, isNumber, isMinValue, isMaxValue, isBetweenValues, isValidString, } from './validators.mjs';
|
|
3
|
-
test('Test isNotNull', () => {
|
|
4
|
-
expect(isNotNull('bar')).toBeTruthy();
|
|
5
|
-
expect(isNotNull(null)).toBeFalsy();
|
|
6
|
-
expect(isNotNull(undefined)).toBeFalsy();
|
|
7
|
-
});
|
|
8
|
-
test('Test notNull', () => {
|
|
9
|
-
notNull('foo', 'bar');
|
|
10
|
-
expect(() => notNull('foo', null)).toThrow('foo may not be null or undefined');
|
|
11
|
-
expect(() => notNull('foo', undefined)).toThrow('foo may not be null or undefined');
|
|
12
|
-
});
|
|
13
|
-
test('Test isNotEmpty', () => {
|
|
14
|
-
expect(isNotEmpty('bar')).toBeTruthy();
|
|
15
|
-
expect(isNotEmpty('')).toBeFalsy();
|
|
16
|
-
expect(isNotEmpty(null)).toBeFalsy();
|
|
17
|
-
expect(isNotEmpty(undefined)).toBeFalsy();
|
|
18
|
-
});
|
|
19
|
-
test('Test notEmpty', () => {
|
|
20
|
-
notEmpty('foo', 'bar');
|
|
21
|
-
expect(() => notEmpty('foo', '')).toThrow('foo may not be empty');
|
|
22
|
-
expect(() => notEmpty('foo', null)).toThrow('foo may not be empty');
|
|
23
|
-
expect(() => notEmpty('foo', undefined)).toThrow('foo may not be empty');
|
|
24
|
-
});
|
|
25
|
-
test('Test isNotBlank', () => {
|
|
26
|
-
expect(isNotBlank('bar')).toBeTruthy();
|
|
27
|
-
expect(isNotBlank(' ')).toBeFalsy();
|
|
28
|
-
expect(isNotBlank('')).toBeFalsy();
|
|
29
|
-
expect(isNotBlank(null)).toBeFalsy();
|
|
30
|
-
expect(isNotBlank(undefined)).toBeFalsy();
|
|
31
|
-
});
|
|
32
|
-
test('Test notBlank', () => {
|
|
33
|
-
notBlank('foo', 'bar');
|
|
34
|
-
expect(() => notBlank('foo', ' ')).toThrow('foo may not be blank');
|
|
35
|
-
expect(() => notBlank('foo', '')).toThrow('foo may not be blank');
|
|
36
|
-
expect(() => notBlank('foo', null)).toThrow('foo may not be blank');
|
|
37
|
-
expect(() => notBlank('foo', undefined)).toThrow('foo may not be blank');
|
|
38
|
-
});
|
|
39
|
-
test('Test isMatch', () => {
|
|
40
|
-
expect(isMatch(/bar/, 'bar')).toBeTruthy();
|
|
41
|
-
expect(isMatch(/bar/, null)).toBeTruthy();
|
|
42
|
-
expect(isMatch(/bar/, undefined)).toBeTruthy();
|
|
43
|
-
expect(isMatch(/bar/, 'baz')).toBeFalsy();
|
|
44
|
-
});
|
|
45
|
-
test('Test match', () => {
|
|
46
|
-
match('foo', /bar/, 'bar');
|
|
47
|
-
match('foo', /bar/, null);
|
|
48
|
-
match('foo', /bar/, undefined);
|
|
49
|
-
expect(() => match('foo', /bar/, 'baz')).toThrow('foo must match /bar/');
|
|
50
|
-
});
|
|
51
|
-
test('Test isEmail', () => {
|
|
52
|
-
expect(isEmail('test@example.com')).toBeTruthy();
|
|
53
|
-
expect(isEmail(null)).toBeTruthy();
|
|
54
|
-
expect(isEmail(undefined)).toBeTruthy();
|
|
55
|
-
expect(isEmail('test')).toBeFalsy();
|
|
56
|
-
});
|
|
57
|
-
test('Test email', () => {
|
|
58
|
-
email('foo', 'test@example.com');
|
|
59
|
-
email('foo', null);
|
|
60
|
-
email('foo', undefined);
|
|
61
|
-
expect(() => email('foo', 'test')).toThrow('foo is not a valid email address');
|
|
62
|
-
});
|
|
63
|
-
test('Test isMaxLength', () => {
|
|
64
|
-
const arr = [];
|
|
65
|
-
arr.push('a', 'b', 'c');
|
|
66
|
-
expect(isMaxLength(3, 'bar')).toBeTruthy();
|
|
67
|
-
expect(isMaxLength(3, null)).toBeTruthy();
|
|
68
|
-
expect(isMaxLength(3, undefined)).toBeTruthy();
|
|
69
|
-
expect(isMaxLength(3, arr)).toBeTruthy();
|
|
70
|
-
expect(isMaxLength(2, 'baz')).toBeFalsy();
|
|
71
|
-
expect(isMaxLength(2, arr)).toBeFalsy();
|
|
72
|
-
});
|
|
73
|
-
test('Test maxLength', () => {
|
|
74
|
-
const arr = [];
|
|
75
|
-
arr.push('a', 'b', 'c');
|
|
76
|
-
maxLength('foo', 3, 'bar');
|
|
77
|
-
maxLength('foo', 3, null);
|
|
78
|
-
maxLength('foo', 3, undefined);
|
|
79
|
-
maxLength('foo', 3, arr);
|
|
80
|
-
expect(() => maxLength('foo', 2, 'baz')).toThrow('length of foo may not exceed 2');
|
|
81
|
-
expect(() => maxLength('foo', 2, arr)).toThrow('length of foo may not exceed 2');
|
|
82
|
-
});
|
|
83
|
-
test('Test isMinLength', () => {
|
|
84
|
-
const arr = [];
|
|
85
|
-
arr.push('a', 'b', 'c');
|
|
86
|
-
expect(isMinLength(3, 'bar')).toBeTruthy();
|
|
87
|
-
expect(isMinLength(3, null)).toBeTruthy();
|
|
88
|
-
expect(isMinLength(3, undefined)).toBeTruthy();
|
|
89
|
-
expect(isMinLength(3, arr)).toBeTruthy();
|
|
90
|
-
expect(isMinLength(4, 'baz')).toBeFalsy();
|
|
91
|
-
expect(isMinLength(4, arr)).toBeFalsy();
|
|
92
|
-
});
|
|
93
|
-
test('Test minLength', () => {
|
|
94
|
-
const arr = [];
|
|
95
|
-
arr.push('a', 'b', 'c');
|
|
96
|
-
minLength('foo', 3, 'bar');
|
|
97
|
-
minLength('foo', 3, null);
|
|
98
|
-
minLength('foo', 3, undefined);
|
|
99
|
-
minLength('foo', 3, arr);
|
|
100
|
-
expect(() => minLength('foo', 4, 'baz')).toThrow('length of foo may not be less than 4');
|
|
101
|
-
expect(() => minLength('foo', 4, arr)).toThrow('length of foo may not be less than 4');
|
|
102
|
-
});
|
|
103
|
-
test('Test isNumber', () => {
|
|
104
|
-
expect(isNumber(1)).toBeTruthy();
|
|
105
|
-
expect(isNumber('1')).toBeTruthy();
|
|
106
|
-
expect(isNumber(null)).toBeTruthy();
|
|
107
|
-
expect(isNumber(undefined)).toBeTruthy();
|
|
108
|
-
expect(isNumber('bar')).toBeFalsy();
|
|
109
|
-
});
|
|
110
|
-
test('Test number', () => {
|
|
111
|
-
number('foo', 1);
|
|
112
|
-
number('foo', '1');
|
|
113
|
-
number('foo', null);
|
|
114
|
-
number('foo', undefined);
|
|
115
|
-
expect(() => number('foo', 'bar')).toThrow('foo is not a number');
|
|
116
|
-
});
|
|
117
|
-
test('Test isMinValue', () => {
|
|
118
|
-
expect(isMinValue(1, 2)).toBeTruthy();
|
|
119
|
-
expect(isMinValue(1, '2')).toBeTruthy();
|
|
120
|
-
expect(isMinValue(1, null)).toBeTruthy();
|
|
121
|
-
expect(isMinValue(1, undefined)).toBeTruthy();
|
|
122
|
-
expect(isMinValue(2, 1)).toBeFalsy();
|
|
123
|
-
});
|
|
124
|
-
test('Test minValue', () => {
|
|
125
|
-
minValue('foo', 1, 2);
|
|
126
|
-
minValue('foo', 1, '2');
|
|
127
|
-
minValue('foo', 1, null);
|
|
128
|
-
minValue('foo', 1, undefined);
|
|
129
|
-
expect(() => minValue('foo', 2, 1)).toThrow('foo may not be less than 2');
|
|
130
|
-
});
|
|
131
|
-
test('Test isMaxValue', () => {
|
|
132
|
-
expect(isMaxValue(2, 1)).toBeTruthy();
|
|
133
|
-
expect(isMaxValue(2, '1')).toBeTruthy();
|
|
134
|
-
expect(isMaxValue(2, null)).toBeTruthy();
|
|
135
|
-
expect(isMaxValue(2, undefined)).toBeTruthy();
|
|
136
|
-
expect(isMaxValue(1, 2)).toBeFalsy();
|
|
137
|
-
});
|
|
138
|
-
test('Test maxValue', () => {
|
|
139
|
-
maxValue('foo', 2, 1);
|
|
140
|
-
maxValue('foo', 2, '1');
|
|
141
|
-
maxValue('foo', 2, null);
|
|
142
|
-
maxValue('foo', 2, undefined);
|
|
143
|
-
expect(() => maxValue('foo', 1, 2)).toThrow('foo may not be greater than 1');
|
|
144
|
-
});
|
|
145
|
-
test('Test isBetweenValues', () => {
|
|
146
|
-
expect(isBetweenValues(1, 3, 2)).toBeTruthy();
|
|
147
|
-
expect(isBetweenValues(1, 3, '2')).toBeTruthy();
|
|
148
|
-
expect(isBetweenValues(1, 3, null)).toBeTruthy();
|
|
149
|
-
expect(isBetweenValues(1, 3, undefined)).toBeTruthy();
|
|
150
|
-
expect(isBetweenValues(1, 3, 4)).toBeFalsy();
|
|
151
|
-
});
|
|
152
|
-
test('Test betweenValues', () => {
|
|
153
|
-
betweenValues('foo', 1, 3, 2);
|
|
154
|
-
betweenValues('foo', 1, 3, '2');
|
|
155
|
-
betweenValues('foo', 1, 3, null);
|
|
156
|
-
betweenValues('foo', 1, 3, undefined);
|
|
157
|
-
expect(() => betweenValues('foo', 1, 3, 4)).toThrow('foo must be between 1 and 3');
|
|
158
|
-
});
|
|
159
|
-
test('Test isValidString', () => {
|
|
160
|
-
expect(isValidString({ required: true }, 'bar')).toBeTruthy();
|
|
161
|
-
expect(isValidString({ required: true }, ' ')).toBeTruthy();
|
|
162
|
-
expect(isValidString({ required: true }, '')).toBeTruthy();
|
|
163
|
-
expect(isValidString({ required: false }, null)).toBeTruthy();
|
|
164
|
-
expect(isValidString({ required: false }, undefined)).toBeTruthy();
|
|
165
|
-
expect(isValidString({ required: true }, null)).toBeFalsy();
|
|
166
|
-
expect(isValidString({ required: true }, undefined)).toBeFalsy();
|
|
167
|
-
});
|
|
168
|
-
test('Test validString', () => {
|
|
169
|
-
validString('foo', { required: true }, 'bar');
|
|
170
|
-
validString('foo', { required: true }, ' ');
|
|
171
|
-
validString('foo', { required: true }, '');
|
|
172
|
-
validString('foo', { required: false }, null);
|
|
173
|
-
validString('foo', { required: false }, undefined);
|
|
174
|
-
expect(() => validString('foo', { required: true }, null)).toThrow('foo may not be null or undefined');
|
|
175
|
-
expect(() => validString('foo', { required: true }, undefined)).toThrow('foo may not be null or undefined');
|
|
176
|
-
});
|
|
177
|
-
//# sourceMappingURL=validators.test.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validators.test.mjs","sourceRoot":"","sources":["../../src/validator/validators.test.mts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,EACL,aAAa,EACb,KAAK,EACL,MAAM,EACN,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,EACV,KAAK,EACL,OAAO,EACP,OAAO,EACP,WAAW,EACX,WAAW,EACX,QAAQ,EACR,UAAU,EACV,UAAU,EACV,eAAe,EACf,aAAa,GACd,MAAM,kBAAkB,CAAC;AAE1B,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC1B,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IACtC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACpC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;AAC3C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE;IACxB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACtB,MAAM,CAAC,GAAG,EAAE,CA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1C,WAAW,CAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,EAAE,EAAE,CAAC,CAAC;IACzC,WAAW,CAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,KAAK,EAAC,EAAE,IAAI,CAAC,CAAC;IAC5C,WAAW,CAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,KAAK,EAAC,EAAE,SAAS,CAAC,CAAC;IACjD,MAAM,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAC9D,kCAAkC,CACnC,CAAC;IACF,MAAM,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CACnE,kCAAkC,CACnC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import {test, expect} from 'vitest';\nimport {\n betweenValues,\n email,\n number,\n maxLength,\n maxValue,\n minLength,\n minValue,\n notBlank,\n notEmpty,\n notNull,\n validString,\n isNotNull,\n isNotEmpty,\n isNotBlank,\n match,\n isMatch,\n isEmail,\n isMaxLength,\n isMinLength,\n isNumber,\n isMinValue,\n isMaxValue,\n isBetweenValues,\n isValidString,\n} from './validators.mjs';\n\ntest('Test isNotNull', () => {\n expect(isNotNull('bar')).toBeTruthy();\n expect(isNotNull(null)).toBeFalsy();\n expect(isNotNull(undefined)).toBeFalsy();\n});\n\ntest('Test notNull', () => {\n notNull('foo', 'bar');\n expect(() => notNull('foo', null)).toThrow(\n 'foo may not be null or undefined'\n );\n expect(() => notNull('foo', undefined)).toThrow(\n 'foo may not be null or undefined'\n );\n});\n\ntest('Test isNotEmpty', () => {\n expect(isNotEmpty('bar')).toBeTruthy();\n expect(isNotEmpty('')).toBeFalsy();\n expect(isNotEmpty(null)).toBeFalsy();\n expect(isNotEmpty(undefined)).toBeFalsy();\n});\n\ntest('Test notEmpty', () => {\n notEmpty('foo', 'bar');\n expect(() => notEmpty('foo', '')).toThrow('foo may not be empty');\n expect(() => notEmpty('foo', null)).toThrow('foo may not be empty');\n expect(() => notEmpty('foo', undefined)).toThrow('foo may not be empty');\n});\n\ntest('Test isNotBlank', () => {\n expect(isNotBlank('bar')).toBeTruthy();\n expect(isNotBlank(' ')).toBeFalsy();\n expect(isNotBlank('')).toBeFalsy();\n expect(isNotBlank(null)).toBeFalsy();\n expect(isNotBlank(undefined)).toBeFalsy();\n});\n\ntest('Test notBlank', () => {\n notBlank('foo', 'bar');\n expect(() => notBlank('foo', ' ')).toThrow('foo may not be blank');\n expect(() => notBlank('foo', '')).toThrow('foo may not be blank');\n expect(() => notBlank('foo', null)).toThrow('foo may not be blank');\n expect(() => notBlank('foo', undefined)).toThrow('foo may not be blank');\n});\n\ntest('Test isMatch', () => {\n expect(isMatch(/bar/, 'bar')).toBeTruthy();\n expect(isMatch(/bar/, null)).toBeTruthy();\n expect(isMatch(/bar/, undefined)).toBeTruthy();\n expect(isMatch(/bar/, 'baz')).toBeFalsy();\n});\n\ntest('Test match', () => {\n match('foo', /bar/, 'bar');\n match('foo', /bar/, null);\n match('foo', /bar/, undefined);\n expect(() => match('foo', /bar/, 'baz')).toThrow('foo must match /bar/');\n});\n\ntest('Test isEmail', () => {\n expect(isEmail('test@example.com')).toBeTruthy();\n expect(isEmail(null)).toBeTruthy();\n expect(isEmail(undefined)).toBeTruthy();\n expect(isEmail('test')).toBeFalsy();\n});\n\ntest('Test email', () => {\n email('foo', 'test@example.com');\n email('foo', null);\n email('foo', undefined);\n expect(() => email('foo', 'test')).toThrow(\n 'foo is not a valid email address'\n );\n});\n\ntest('Test isMaxLength', () => {\n const arr: string[] = [];\n arr.push('a', 'b', 'c');\n expect(isMaxLength(3, 'bar')).toBeTruthy();\n expect(isMaxLength(3, null)).toBeTruthy();\n expect(isMaxLength(3, undefined)).toBeTruthy();\n expect(isMaxLength(3, arr)).toBeTruthy();\n expect(isMaxLength(2, 'baz')).toBeFalsy();\n expect(isMaxLength(2, arr)).toBeFalsy();\n});\n\ntest('Test maxLength', () => {\n const arr: string[] = [];\n arr.push('a', 'b', 'c');\n maxLength('foo', 3, 'bar');\n maxLength('foo', 3, null);\n maxLength('foo', 3, undefined);\n maxLength('foo', 3, arr);\n expect(() => maxLength('foo', 2, 'baz')).toThrow(\n 'length of foo may not exceed 2'\n );\n expect(() => maxLength('foo', 2, arr)).toThrow(\n 'length of foo may not exceed 2'\n );\n});\n\ntest('Test isMinLength', () => {\n const arr: string[] = [];\n arr.push('a', 'b', 'c');\n expect(isMinLength(3, 'bar')).toBeTruthy();\n expect(isMinLength(3, null)).toBeTruthy();\n expect(isMinLength(3, undefined)).toBeTruthy();\n expect(isMinLength(3, arr)).toBeTruthy();\n expect(isMinLength(4, 'baz')).toBeFalsy();\n expect(isMinLength(4, arr)).toBeFalsy();\n});\n\ntest('Test minLength', () => {\n const arr: string[] = [];\n arr.push('a', 'b', 'c');\n minLength('foo', 3, 'bar');\n minLength('foo', 3, null);\n minLength('foo', 3, undefined);\n minLength('foo', 3, arr);\n expect(() => minLength('foo', 4, 'baz')).toThrow(\n 'length of foo may not be less than 4'\n );\n expect(() => minLength('foo', 4, arr)).toThrow(\n 'length of foo may not be less than 4'\n );\n});\n\ntest('Test isNumber', () => {\n expect(isNumber(1)).toBeTruthy();\n expect(isNumber('1')).toBeTruthy();\n expect(isNumber(null)).toBeTruthy();\n expect(isNumber(undefined)).toBeTruthy();\n expect(isNumber('bar')).toBeFalsy();\n});\n\ntest('Test number', () => {\n number('foo', 1);\n number('foo', '1');\n number('foo', null);\n number('foo', undefined);\n expect(() => number('foo', 'bar')).toThrow('foo is not a number');\n});\n\ntest('Test isMinValue', () => {\n expect(isMinValue(1, 2)).toBeTruthy();\n expect(isMinValue(1, '2')).toBeTruthy();\n expect(isMinValue(1, null)).toBeTruthy();\n expect(isMinValue(1, undefined)).toBeTruthy();\n expect(isMinValue(2, 1)).toBeFalsy();\n});\n\ntest('Test minValue', () => {\n minValue('foo', 1, 2);\n minValue('foo', 1, '2');\n minValue('foo', 1, null);\n minValue('foo', 1, undefined);\n expect(() => minValue('foo', 2, 1)).toThrow('foo may not be less than 2');\n});\n\ntest('Test isMaxValue', () => {\n expect(isMaxValue(2, 1)).toBeTruthy();\n expect(isMaxValue(2, '1')).toBeTruthy();\n expect(isMaxValue(2, null)).toBeTruthy();\n expect(isMaxValue(2, undefined)).toBeTruthy();\n expect(isMaxValue(1, 2)).toBeFalsy();\n});\n\ntest('Test maxValue', () => {\n maxValue('foo', 2, 1);\n maxValue('foo', 2, '1');\n maxValue('foo', 2, null);\n maxValue('foo', 2, undefined);\n expect(() => maxValue('foo', 1, 2)).toThrow('foo may not be greater than 1');\n});\n\ntest('Test isBetweenValues', () => {\n expect(isBetweenValues(1, 3, 2)).toBeTruthy();\n expect(isBetweenValues(1, 3, '2')).toBeTruthy();\n expect(isBetweenValues(1, 3, null)).toBeTruthy();\n expect(isBetweenValues(1, 3, undefined)).toBeTruthy();\n expect(isBetweenValues(1, 3, 4)).toBeFalsy();\n});\n\ntest('Test betweenValues', () => {\n betweenValues('foo', 1, 3, 2);\n betweenValues('foo', 1, 3, '2');\n betweenValues('foo', 1, 3, null);\n betweenValues('foo', 1, 3, undefined);\n expect(() => betweenValues('foo', 1, 3, 4)).toThrow(\n 'foo must be between 1 and 3'\n );\n});\n\ntest('Test isValidString', () => {\n expect(isValidString({required: true}, 'bar')).toBeTruthy();\n expect(isValidString({required: true}, ' ')).toBeTruthy();\n expect(isValidString({required: true}, '')).toBeTruthy();\n expect(isValidString({required: false}, null)).toBeTruthy();\n expect(isValidString({required: false}, undefined)).toBeTruthy();\n expect(isValidString({required: true}, null)).toBeFalsy();\n expect(isValidString({required: true}, undefined)).toBeFalsy();\n});\n\ntest('Test validString', () => {\n validString('foo', {required: true}, 'bar');\n validString('foo', {required: true}, ' ');\n validString('foo', {required: true}, '');\n validString('foo', {required: false}, null);\n validString('foo', {required: false}, undefined);\n expect(() => validString('foo', {required: true}, null)).toThrow(\n 'foo may not be null or undefined'\n );\n expect(() => validString('foo', {required: true}, undefined)).toThrow(\n 'foo may not be null or undefined'\n );\n});\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
in the Software without restriction, including without limitation the rights
|
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
|
11
|
-
all copies or substantial portions of the Software.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
THE SOFTWARE.
|