@nocobase/plugin-idp-oauth 2.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +107 -0
- package/README.md +14 -0
- package/build.config.ts +46 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/ErrorPage.d.ts +11 -0
- package/dist/client/InteractionPage.d.ts +11 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.js +10 -0
- package/dist/client/locale.d.ts +10 -0
- package/dist/client/models/index.d.ts +11 -0
- package/dist/client/plugin.d.ts +13 -0
- package/dist/externalVersion.js +18 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/zh-CN.json +1 -0
- package/dist/node_modules/eta/LICENSE +7 -0
- package/dist/node_modules/eta/README.md +185 -0
- package/dist/node_modules/eta/dist/core.d.ts +179 -0
- package/dist/node_modules/eta/dist/core.d.ts.map +1 -0
- package/dist/node_modules/eta/dist/core.js +42 -0
- package/dist/node_modules/eta/dist/core.js.map +1 -0
- package/dist/node_modules/eta/dist/index.cjs +542 -0
- package/dist/node_modules/eta/dist/index.cjs.map +1 -0
- package/dist/node_modules/eta/dist/index.d.cts +187 -0
- package/dist/node_modules/eta/dist/index.d.cts.map +1 -0
- package/dist/node_modules/eta/dist/index.d.mts +187 -0
- package/dist/node_modules/eta/dist/index.d.mts.map +1 -0
- package/dist/node_modules/eta/dist/index.mjs +512 -0
- package/dist/node_modules/eta/dist/index.mjs.map +1 -0
- package/dist/node_modules/eta/package.json +75 -0
- package/dist/node_modules/jose/LICENSE.md +21 -0
- package/dist/node_modules/jose/README.md +153 -0
- package/dist/node_modules/jose/dist/types/index.d.ts +55 -0
- package/dist/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +31 -0
- package/dist/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +65 -0
- package/dist/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +31 -0
- package/dist/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +83 -0
- package/dist/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +38 -0
- package/dist/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +74 -0
- package/dist/node_modules/jose/dist/types/jwk/embedded.d.ts +17 -0
- package/dist/node_modules/jose/dist/types/jwk/thumbprint.d.ts +32 -0
- package/dist/node_modules/jose/dist/types/jwks/local.d.ts +29 -0
- package/dist/node_modules/jose/dist/types/jwks/remote.d.ts +237 -0
- package/dist/node_modules/jose/dist/types/jws/compact/sign.d.ts +36 -0
- package/dist/node_modules/jose/dist/types/jws/compact/verify.d.ts +33 -0
- package/dist/node_modules/jose/dist/types/jws/flattened/sign.d.ts +42 -0
- package/dist/node_modules/jose/dist/types/jws/flattened/verify.d.ts +33 -0
- package/dist/node_modules/jose/dist/types/jws/general/sign.d.ts +53 -0
- package/dist/node_modules/jose/dist/types/jws/general/verify.d.ts +41 -0
- package/dist/node_modules/jose/dist/types/jwt/decrypt.d.ts +35 -0
- package/dist/node_modules/jose/dist/types/jwt/encrypt.d.ts +91 -0
- package/dist/node_modules/jose/dist/types/jwt/sign.d.ts +43 -0
- package/dist/node_modules/jose/dist/types/jwt/unsecured.d.ts +43 -0
- package/dist/node_modules/jose/dist/types/jwt/verify.d.ts +37 -0
- package/dist/node_modules/jose/dist/types/key/export.d.ts +33 -0
- package/dist/node_modules/jose/dist/types/key/generate_key_pair.d.ts +47 -0
- package/dist/node_modules/jose/dist/types/key/generate_secret.d.ts +35 -0
- package/dist/node_modules/jose/dist/types/key/import.d.ts +83 -0
- package/dist/node_modules/jose/dist/types/types.d.ts +852 -0
- package/dist/node_modules/jose/dist/types/util/base64url.d.ts +9 -0
- package/dist/node_modules/jose/dist/types/util/decode_jwt.d.ts +18 -0
- package/dist/node_modules/jose/dist/types/util/decode_protected_header.d.ts +17 -0
- package/dist/node_modules/jose/dist/types/util/errors.d.ts +213 -0
- package/dist/node_modules/jose/dist/webapi/index.js +32 -0
- package/dist/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +27 -0
- package/dist/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +27 -0
- package/dist/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +155 -0
- package/dist/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +165 -0
- package/dist/node_modules/jose/dist/webapi/jwe/general/decrypt.js +31 -0
- package/dist/node_modules/jose/dist/webapi/jwe/general/encrypt.js +182 -0
- package/dist/node_modules/jose/dist/webapi/jwk/embedded.js +17 -0
- package/dist/node_modules/jose/dist/webapi/jwk/thumbprint.js +68 -0
- package/dist/node_modules/jose/dist/webapi/jwks/local.js +119 -0
- package/dist/node_modules/jose/dist/webapi/jwks/remote.js +179 -0
- package/dist/node_modules/jose/dist/webapi/jws/compact/sign.js +18 -0
- package/dist/node_modules/jose/dist/webapi/jws/compact/verify.js +21 -0
- package/dist/node_modules/jose/dist/webapi/jws/flattened/sign.js +89 -0
- package/dist/node_modules/jose/dist/webapi/jws/flattened/verify.js +110 -0
- package/dist/node_modules/jose/dist/webapi/jws/general/sign.js +70 -0
- package/dist/node_modules/jose/dist/webapi/jws/general/verify.js +24 -0
- package/dist/node_modules/jose/dist/webapi/jwt/decrypt.js +23 -0
- package/dist/node_modules/jose/dist/webapi/jwt/encrypt.js +101 -0
- package/dist/node_modules/jose/dist/webapi/jwt/sign.js +52 -0
- package/dist/node_modules/jose/dist/webapi/jwt/unsecured.js +63 -0
- package/dist/node_modules/jose/dist/webapi/jwt/verify.js +15 -0
- package/dist/node_modules/jose/dist/webapi/key/export.js +11 -0
- package/dist/node_modules/jose/dist/webapi/key/generate_key_pair.js +97 -0
- package/dist/node_modules/jose/dist/webapi/key/generate_secret.js +40 -0
- package/dist/node_modules/jose/dist/webapi/key/import.js +57 -0
- package/dist/node_modules/jose/dist/webapi/lib/aesgcmkw.js +15 -0
- package/dist/node_modules/jose/dist/webapi/lib/aeskw.js +25 -0
- package/dist/node_modules/jose/dist/webapi/lib/asn1.js +243 -0
- package/dist/node_modules/jose/dist/webapi/lib/base64.js +22 -0
- package/dist/node_modules/jose/dist/webapi/lib/buffer_utils.js +43 -0
- package/dist/node_modules/jose/dist/webapi/lib/check_key_type.js +122 -0
- package/dist/node_modules/jose/dist/webapi/lib/content_encryption.js +217 -0
- package/dist/node_modules/jose/dist/webapi/lib/crypto_key.js +136 -0
- package/dist/node_modules/jose/dist/webapi/lib/deflate.js +44 -0
- package/dist/node_modules/jose/dist/webapi/lib/ecdhes.js +52 -0
- package/dist/node_modules/jose/dist/webapi/lib/helpers.js +19 -0
- package/dist/node_modules/jose/dist/webapi/lib/invalid_key_input.js +27 -0
- package/dist/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -0
- package/dist/node_modules/jose/dist/webapi/lib/jwk_to_key.js +107 -0
- package/dist/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +238 -0
- package/dist/node_modules/jose/dist/webapi/lib/key_management.js +186 -0
- package/dist/node_modules/jose/dist/webapi/lib/key_to_jwk.js +31 -0
- package/dist/node_modules/jose/dist/webapi/lib/normalize_key.js +166 -0
- package/dist/node_modules/jose/dist/webapi/lib/pbes2kw.js +39 -0
- package/dist/node_modules/jose/dist/webapi/lib/rsaes.js +24 -0
- package/dist/node_modules/jose/dist/webapi/lib/signing.js +68 -0
- package/dist/node_modules/jose/dist/webapi/lib/type_checks.js +40 -0
- package/dist/node_modules/jose/dist/webapi/lib/validate_algorithms.js +10 -0
- package/dist/node_modules/jose/dist/webapi/lib/validate_crit.js +33 -0
- package/dist/node_modules/jose/dist/webapi/util/base64url.js +30 -0
- package/dist/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -0
- package/dist/node_modules/jose/dist/webapi/util/decode_protected_header.js +34 -0
- package/dist/node_modules/jose/dist/webapi/util/errors.js +99 -0
- package/dist/node_modules/jose/package.json +200 -0
- package/dist/node_modules/light-my-request/.gitattributes +2 -0
- package/dist/node_modules/light-my-request/.github/dependabot.yml +13 -0
- package/dist/node_modules/light-my-request/.github/stale.yml +21 -0
- package/dist/node_modules/light-my-request/.github/workflows/benchmark.yml +30 -0
- package/dist/node_modules/light-my-request/.github/workflows/ci.yml +23 -0
- package/dist/node_modules/light-my-request/LICENSE +32 -0
- package/dist/node_modules/light-my-request/benchmark/benchmark.js +164 -0
- package/dist/node_modules/light-my-request/build/build-validation.js +100 -0
- package/dist/node_modules/light-my-request/eslint.config.js +9 -0
- package/dist/node_modules/light-my-request/index.js +2 -0
- package/dist/node_modules/light-my-request/lib/config-validator.js +919 -0
- package/dist/node_modules/light-my-request/lib/form-data.js +79 -0
- package/dist/node_modules/light-my-request/lib/parse-url.js +47 -0
- package/dist/node_modules/light-my-request/lib/request.js +290 -0
- package/dist/node_modules/light-my-request/lib/response.js +240 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.gitattributes +2 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.github/dependabot.yml +13 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.github/workflows/ci.yml +24 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.taprc +2 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/benchmarks/warn.js +25 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/eslint.config.js +6 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/examples/example.js +11 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/index.js +124 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/package.json +73 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-interpolated-string.test.js +29 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-once-only.test.js +28 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-reset.test.js +36 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-set.test.js +30 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-unlimited.test.js +37 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/index.test.js +99 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/issue-88.test.js +33 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/jest.test.js +22 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/no-warnings.test.js +80 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/types/index.d.ts +37 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/types/index.test-d.ts +36 -0
- package/dist/node_modules/light-my-request/package.json +1 -0
- package/dist/node_modules/light-my-request/test/async-await.test.js +55 -0
- package/dist/node_modules/light-my-request/test/index.test.js +2316 -0
- package/dist/node_modules/light-my-request/test/request.test.js +16 -0
- package/dist/node_modules/light-my-request/test/response.test.js +19 -0
- package/dist/node_modules/light-my-request/test/stream.test.js +359 -0
- package/dist/node_modules/light-my-request/types/index.d.ts +128 -0
- package/dist/node_modules/light-my-request/types/index.test-d.ts +149 -0
- package/dist/node_modules/oidc-provider/LICENSE.md +21 -0
- package/dist/node_modules/oidc-provider/README.md +174 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/assign_claims.js +28 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/assign_defaults.js +17 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/authenticated_client_id.js +6 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/backchannel_request_remap_errors.js +17 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/backchannel_request_response.js +41 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_ciba_context.js +12 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_claims.js +68 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_client.js +21 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_client_grant_type.js +21 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_dpop_jkt.js +35 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_extra_params.js +18 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_id_token_hint.js +23 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_max_age.js +25 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_openid_scope.js +47 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_pkce.js +41 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_prompt.js +25 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_redirect_uri.js +41 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_requested_expiry.js +16 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_response_mode.js +54 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_response_type.js +26 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_scope.js +53 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/ciba_load_account.js +58 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/ciba_required.js +13 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/device_authorization_response.js +31 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/device_user_flow.js +31 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/device_user_flow_errors.js +37 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/device_user_flow_response.js +55 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/index.js +200 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/interaction_emit.js +9 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/interactions.js +149 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/load_account.js +15 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/load_grant.js +29 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/load_pushed_authorization_request.js +36 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/oauth_required.js +11 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/oidc_required.js +27 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/one_redirect_uri_clients.js +20 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/process_request_object.js +214 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/pushed_authorization_request_remap_errors.js +17 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/pushed_authorization_request_response.js +65 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/reject_registration.js +12 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/reject_request_and_uri.js +12 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/reject_unsupported.js +33 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/respond.js +46 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/resume.js +111 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/strip_outside_jar_params.js +19 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/unsupported_rar.js +9 -0
- package/dist/node_modules/oidc-provider/lib/actions/challenge.js +22 -0
- package/dist/node_modules/oidc-provider/lib/actions/code_verification.js +122 -0
- package/dist/node_modules/oidc-provider/lib/actions/discovery.js +151 -0
- package/dist/node_modules/oidc-provider/lib/actions/end_session.js +222 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/authorization_code.js +144 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/ciba.js +127 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/client_credentials.js +79 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/device_code.js +125 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/index.js +7 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/refresh_token.js +229 -0
- package/dist/node_modules/oidc-provider/lib/actions/index.js +25 -0
- package/dist/node_modules/oidc-provider/lib/actions/interaction.js +150 -0
- package/dist/node_modules/oidc-provider/lib/actions/introspection.js +164 -0
- package/dist/node_modules/oidc-provider/lib/actions/jwks.js +7 -0
- package/dist/node_modules/oidc-provider/lib/actions/registration.js +274 -0
- package/dist/node_modules/oidc-provider/lib/actions/revocation.js +81 -0
- package/dist/node_modules/oidc-provider/lib/actions/token.js +74 -0
- package/dist/node_modules/oidc-provider/lib/actions/userinfo.js +183 -0
- package/dist/node_modules/oidc-provider/lib/adapters/memory_adapter.js +95 -0
- package/dist/node_modules/oidc-provider/lib/consts/client_attributes.js +211 -0
- package/dist/node_modules/oidc-provider/lib/consts/dev_keystore.js +18 -0
- package/dist/node_modules/oidc-provider/lib/consts/index.js +13 -0
- package/dist/node_modules/oidc-provider/lib/consts/jwa.js +47 -0
- package/dist/node_modules/oidc-provider/lib/consts/non_rejectable_claims.js +1 -0
- package/dist/node_modules/oidc-provider/lib/consts/param_list.js +23 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/camel_case.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/defaults.js +28 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/difference.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/is_plain_object.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/map_keys.js +9 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/merge.js +25 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/omit_by.js +11 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/pick.js +10 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/pick_by.js +10 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/remove.js +9 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/set.js +18 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/snake_case.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/upper_first.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/account_claims.js +6 -0
- package/dist/node_modules/oidc-provider/lib/helpers/add_client.js +14 -0
- package/dist/node_modules/oidc-provider/lib/helpers/als.js +3 -0
- package/dist/node_modules/oidc-provider/lib/helpers/append_www_authenticate.js +9 -0
- package/dist/node_modules/oidc-provider/lib/helpers/attention.js +23 -0
- package/dist/node_modules/oidc-provider/lib/helpers/base64url.js +11 -0
- package/dist/node_modules/oidc-provider/lib/helpers/certificate_thumbprint.js +15 -0
- package/dist/node_modules/oidc-provider/lib/helpers/challenge.js +111 -0
- package/dist/node_modules/oidc-provider/lib/helpers/check_attest_binding.js +10 -0
- package/dist/node_modules/oidc-provider/lib/helpers/claims.js +79 -0
- package/dist/node_modules/oidc-provider/lib/helpers/client_id_metadata_document.js +198 -0
- package/dist/node_modules/oidc-provider/lib/helpers/client_schema.js +700 -0
- package/dist/node_modules/oidc-provider/lib/helpers/combined_scope.js +17 -0
- package/dist/node_modules/oidc-provider/lib/helpers/configuration.js +544 -0
- package/dist/node_modules/oidc-provider/lib/helpers/constant_equals.js +20 -0
- package/dist/node_modules/oidc-provider/lib/helpers/defaults.js +3510 -0
- package/dist/node_modules/oidc-provider/lib/helpers/epoch_time.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/err_out.js +17 -0
- package/dist/node_modules/oidc-provider/lib/helpers/errors.js +161 -0
- package/dist/node_modules/oidc-provider/lib/helpers/features.js +51 -0
- package/dist/node_modules/oidc-provider/lib/helpers/fetch_body_check.js +25 -0
- package/dist/node_modules/oidc-provider/lib/helpers/fetch_request.js +221 -0
- package/dist/node_modules/oidc-provider/lib/helpers/filter_claims.js +16 -0
- package/dist/node_modules/oidc-provider/lib/helpers/formatters.js +24 -0
- package/dist/node_modules/oidc-provider/lib/helpers/grant_common.js +214 -0
- package/dist/node_modules/oidc-provider/lib/helpers/html_safe.js +19 -0
- package/dist/node_modules/oidc-provider/lib/helpers/initialize_adapter.js +24 -0
- package/dist/node_modules/oidc-provider/lib/helpers/initialize_app.js +243 -0
- package/dist/node_modules/oidc-provider/lib/helpers/initialize_clients.js +24 -0
- package/dist/node_modules/oidc-provider/lib/helpers/initialize_keystore.js +310 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/check.js +21 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/index.js +43 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/prompt.js +95 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/prompts/consent.js +105 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/prompts/login.js +162 -0
- package/dist/node_modules/oidc-provider/lib/helpers/jwt.js +211 -0
- package/dist/node_modules/oidc-provider/lib/helpers/keystore.js +301 -0
- package/dist/node_modules/oidc-provider/lib/helpers/nanoid.js +5 -0
- package/dist/node_modules/oidc-provider/lib/helpers/oidc_context.js +284 -0
- package/dist/node_modules/oidc-provider/lib/helpers/params.js +27 -0
- package/dist/node_modules/oidc-provider/lib/helpers/pkce.js +30 -0
- package/dist/node_modules/oidc-provider/lib/helpers/pkce_format.js +17 -0
- package/dist/node_modules/oidc-provider/lib/helpers/process_response_types.js +202 -0
- package/dist/node_modules/oidc-provider/lib/helpers/re_render_errors.js +39 -0
- package/dist/node_modules/oidc-provider/lib/helpers/redirect_uri.js +16 -0
- package/dist/node_modules/oidc-provider/lib/helpers/resolve_resource.js +33 -0
- package/dist/node_modules/oidc-provider/lib/helpers/resolve_response_mode.js +7 -0
- package/dist/node_modules/oidc-provider/lib/helpers/resource_server.js +20 -0
- package/dist/node_modules/oidc-provider/lib/helpers/revoke.js +27 -0
- package/dist/node_modules/oidc-provider/lib/helpers/script_src_sha.js +21 -0
- package/dist/node_modules/oidc-provider/lib/helpers/sector_identifier.js +19 -0
- package/dist/node_modules/oidc-provider/lib/helpers/sector_validate.js +55 -0
- package/dist/node_modules/oidc-provider/lib/helpers/set_rt_bindings.js +21 -0
- package/dist/node_modules/oidc-provider/lib/helpers/token_find.js +51 -0
- package/dist/node_modules/oidc-provider/lib/helpers/type_validators.js +8 -0
- package/dist/node_modules/oidc-provider/lib/helpers/user_code_form.js +19 -0
- package/dist/node_modules/oidc-provider/lib/helpers/user_codes.js +38 -0
- package/dist/node_modules/oidc-provider/lib/helpers/valid_url.js +8 -0
- package/dist/node_modules/oidc-provider/lib/helpers/validate_dpop.js +129 -0
- package/dist/node_modules/oidc-provider/lib/helpers/validate_presence.js +17 -0
- package/dist/node_modules/oidc-provider/lib/helpers/weak_cache.js +11 -0
- package/dist/node_modules/oidc-provider/lib/index.js +21 -0
- package/dist/node_modules/oidc-provider/lib/models/access_token.js +31 -0
- package/dist/node_modules/oidc-provider/lib/models/authorization_code.js +27 -0
- package/dist/node_modules/oidc-provider/lib/models/backchannel_authentication_request.js +26 -0
- package/dist/node_modules/oidc-provider/lib/models/base_model.js +141 -0
- package/dist/node_modules/oidc-provider/lib/models/base_token.js +86 -0
- package/dist/node_modules/oidc-provider/lib/models/client.js +593 -0
- package/dist/node_modules/oidc-provider/lib/models/client_credentials.js +19 -0
- package/dist/node_modules/oidc-provider/lib/models/device_code.js +44 -0
- package/dist/node_modules/oidc-provider/lib/models/formats/dynamic.js +21 -0
- package/dist/node_modules/oidc-provider/lib/models/formats/index.js +14 -0
- package/dist/node_modules/oidc-provider/lib/models/formats/jwt.js +198 -0
- package/dist/node_modules/oidc-provider/lib/models/formats/opaque.js +58 -0
- package/dist/node_modules/oidc-provider/lib/models/grant.js +243 -0
- package/dist/node_modules/oidc-provider/lib/models/id_token.js +271 -0
- package/dist/node_modules/oidc-provider/lib/models/index.js +37 -0
- package/dist/node_modules/oidc-provider/lib/models/initial_access_token.js +12 -0
- package/dist/node_modules/oidc-provider/lib/models/interaction.js +73 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/apply.js +4 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/consumable.js +17 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/has_format.js +46 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/has_grant_id.js +12 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/has_grant_type.js +8 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/has_policies.js +38 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/is_attestation_constrained.js +15 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/is_sender_constrained.js +50 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/is_session_bound.js +38 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/set_audience.js +21 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/stores_auth.js +16 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/stores_pkce.js +9 -0
- package/dist/node_modules/oidc-provider/lib/models/pushed_authorization_request.js +21 -0
- package/dist/node_modules/oidc-provider/lib/models/refresh_token.js +47 -0
- package/dist/node_modules/oidc-provider/lib/models/registration_access_token.js +8 -0
- package/dist/node_modules/oidc-provider/lib/models/replay_detection.js +31 -0
- package/dist/node_modules/oidc-provider/lib/models/session.js +192 -0
- package/dist/node_modules/oidc-provider/lib/provider.js +453 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/form_post.js +36 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/fragment.js +7 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/index.js +15 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/jwt.js +43 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/query.js +7 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/web_message.js +55 -0
- package/dist/node_modules/oidc-provider/lib/shared/assemble_params.js +7 -0
- package/dist/node_modules/oidc-provider/lib/shared/attest_client_auth.js +111 -0
- package/dist/node_modules/oidc-provider/lib/shared/authorization_error_handler.js +104 -0
- package/dist/node_modules/oidc-provider/lib/shared/check_rar.js +75 -0
- package/dist/node_modules/oidc-provider/lib/shared/check_resource.js +77 -0
- package/dist/node_modules/oidc-provider/lib/shared/client_auth.js +263 -0
- package/dist/node_modules/oidc-provider/lib/shared/conditional_body.js +9 -0
- package/dist/node_modules/oidc-provider/lib/shared/cors.js +49 -0
- package/dist/node_modules/oidc-provider/lib/shared/error_handler.js +59 -0
- package/dist/node_modules/oidc-provider/lib/shared/jwt_client_auth.js +79 -0
- package/dist/node_modules/oidc-provider/lib/shared/no_cache.js +4 -0
- package/dist/node_modules/oidc-provider/lib/shared/reject_dupes.js +45 -0
- package/dist/node_modules/oidc-provider/lib/shared/reject_structured_tokens.js +18 -0
- package/dist/node_modules/oidc-provider/lib/shared/selective_body.js +60 -0
- package/dist/node_modules/oidc-provider/lib/shared/session.js +68 -0
- package/dist/node_modules/oidc-provider/lib/shared/set_www_authenticate_header.js +52 -0
- package/dist/node_modules/oidc-provider/lib/views/index.js +22 -0
- package/dist/node_modules/oidc-provider/lib/views/interaction.js +171 -0
- package/dist/node_modules/oidc-provider/lib/views/layout.js +237 -0
- package/dist/node_modules/oidc-provider/lib/views/login.js +43 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/LICENSE +21 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/README.md +1370 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.d.mts +1003 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.d.ts +1003 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.js +1616 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.mjs +1573 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/package.json +122 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/LICENSE +20 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/README.md +481 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/package.json +64 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/src/browser.js +272 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/src/common.js +292 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/src/index.js +10 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/src/node.js +263 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/HISTORY.md +186 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/LICENSE +23 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/README.md +169 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/index.js +290 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/package.json +54 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/LICENSE-MIT.txt +20 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/README.md +422 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/bin/jsesc +148 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/jsesc.js +337 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/man/jsesc.1 +94 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/package.json +56 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/LICENSE +20 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/README.md +38 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/bin/nanoid.js +55 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/index.browser.js +29 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/index.d.ts +106 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/index.js +47 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/nanoid.js +1 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/non-secure/index.d.ts +48 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/non-secure/index.js +21 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/package.json +46 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/url-alphabet/index.js +2 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/LICENSE +21 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/Readme.md +224 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/dist/index.d.ts +144 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/dist/index.js +409 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/dist/index.js.map +1 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/package.json +64 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/HISTORY.md +87 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/LICENSE +23 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/README.md +139 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/codes.json +65 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/index.js +146 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/package.json +49 -0
- package/dist/node_modules/oidc-provider/package.json +95 -0
- package/dist/node_modules/quick-lru/index.d.ts +178 -0
- package/dist/node_modules/quick-lru/index.js +329 -0
- package/dist/node_modules/quick-lru/license +9 -0
- package/dist/node_modules/quick-lru/package.json +54 -0
- package/dist/node_modules/quick-lru/readme.md +236 -0
- package/dist/node_modules/statuses/HISTORY.md +65 -0
- package/dist/node_modules/statuses/LICENSE +23 -0
- package/dist/node_modules/statuses/README.md +127 -0
- package/dist/node_modules/statuses/codes.json +66 -0
- package/dist/node_modules/statuses/index.js +113 -0
- package/dist/node_modules/statuses/package.json +48 -0
- package/dist/server/cache-adapter.d.ts +33 -0
- package/dist/server/cache-adapter.js +159 -0
- package/dist/server/index.d.ts +10 -0
- package/dist/server/index.js +48 -0
- package/dist/server/interaction.d.ts +26 -0
- package/dist/server/interaction.js +172 -0
- package/dist/server/paths.d.ts +19 -0
- package/dist/server/paths.js +64 -0
- package/dist/server/plugin.d.ts +16 -0
- package/dist/server/plugin.js +108 -0
- package/dist/server/provider-dispatch.d.ts +32 -0
- package/dist/server/provider-dispatch.js +252 -0
- package/dist/server/service.d.ts +63 -0
- package/dist/server/service.js +540 -0
- package/dist/server/utils.d.ts +12 -0
- package/dist/server/utils.js +58 -0
- package/package.json +24 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tiny, secure, URL-friendly, unique string ID generator for JavaScript
|
|
3
|
+
* with hardware random generator.
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* import { nanoid } from 'nanoid'
|
|
7
|
+
* model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT"
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Generate secure URL-friendly unique ID.
|
|
15
|
+
*
|
|
16
|
+
* By default, the ID will have 21 symbols to have a collision probability
|
|
17
|
+
* similar to UUID v4.
|
|
18
|
+
*
|
|
19
|
+
* ```js
|
|
20
|
+
* import { nanoid } from 'nanoid'
|
|
21
|
+
* model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param size Size of the ID. The default size is 21.
|
|
25
|
+
* @typeparam Type The ID type to replace `string` with some opaque type.
|
|
26
|
+
* @returns A random string.
|
|
27
|
+
*/
|
|
28
|
+
export function nanoid<Type extends string>(size?: number): Type
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Generate secure unique ID with custom alphabet.
|
|
32
|
+
*
|
|
33
|
+
* Alphabet must contain 256 symbols or less. Otherwise, the generator
|
|
34
|
+
* will not be secure.
|
|
35
|
+
*
|
|
36
|
+
* @param alphabet Alphabet used to generate the ID.
|
|
37
|
+
* @param defaultSize Size of the ID. The default size is 21.
|
|
38
|
+
* @typeparam Type The ID type to replace `string` with some opaque type.
|
|
39
|
+
* @returns A random string generator.
|
|
40
|
+
*
|
|
41
|
+
* ```js
|
|
42
|
+
* import { customAlphabet } from 'nanoid'
|
|
43
|
+
* const nanoid = customAlphabet('0123456789абвгдеё', 5)
|
|
44
|
+
* nanoid() //=> "8ё56а"
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export function customAlphabet<Type extends string>(
|
|
48
|
+
alphabet: string,
|
|
49
|
+
defaultSize?: number
|
|
50
|
+
): (size?: number) => Type
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Generate unique ID with custom random generator and alphabet.
|
|
54
|
+
*
|
|
55
|
+
* Alphabet must contain 256 symbols or less. Otherwise, the generator
|
|
56
|
+
* will not be secure.
|
|
57
|
+
*
|
|
58
|
+
* ```js
|
|
59
|
+
* import { customRandom } from 'nanoid'
|
|
60
|
+
*
|
|
61
|
+
* const nanoid = customRandom('abcdef', 5, size => {
|
|
62
|
+
* const random = []
|
|
63
|
+
* for (let i = 0; i < size; i++) {
|
|
64
|
+
* random.push(randomByte())
|
|
65
|
+
* }
|
|
66
|
+
* return random
|
|
67
|
+
* })
|
|
68
|
+
*
|
|
69
|
+
* nanoid() //=> "fbaef"
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @param alphabet Alphabet used to generate a random string.
|
|
73
|
+
* @param size Size of the random string.
|
|
74
|
+
* @param random A random bytes generator.
|
|
75
|
+
* @typeparam Type The ID type to replace `string` with some opaque type.
|
|
76
|
+
* @returns A random string generator.
|
|
77
|
+
*/
|
|
78
|
+
export function customRandom<Type extends string>(
|
|
79
|
+
alphabet: string,
|
|
80
|
+
size: number,
|
|
81
|
+
random: (bytes: number) => Uint8Array
|
|
82
|
+
): (size?: number) => Type
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* URL safe symbols.
|
|
86
|
+
*
|
|
87
|
+
* ```js
|
|
88
|
+
* import { urlAlphabet } from 'nanoid'
|
|
89
|
+
* const nanoid = customAlphabet(urlAlphabet, 10)
|
|
90
|
+
* nanoid() //=> "Uakgb_J5m9"
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export const urlAlphabet: string
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Generate an array of random bytes collected from hardware noise.
|
|
97
|
+
*
|
|
98
|
+
* ```js
|
|
99
|
+
* import { customRandom, random } from 'nanoid'
|
|
100
|
+
* const nanoid = customRandom("abcdef", 5, random)
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* @param bytes Size of the array.
|
|
104
|
+
* @returns An array of random bytes.
|
|
105
|
+
*/
|
|
106
|
+
export function random(bytes: number): Uint8Array
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { webcrypto as crypto } from 'node:crypto'
|
|
2
|
+
import { urlAlphabet as scopedUrlAlphabet } from './url-alphabet/index.js'
|
|
3
|
+
export { urlAlphabet } from './url-alphabet/index.js'
|
|
4
|
+
const POOL_SIZE_MULTIPLIER = 128
|
|
5
|
+
let pool, poolOffset
|
|
6
|
+
function fillPool(bytes) {
|
|
7
|
+
if (!pool || pool.length < bytes) {
|
|
8
|
+
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER)
|
|
9
|
+
crypto.getRandomValues(pool)
|
|
10
|
+
poolOffset = 0
|
|
11
|
+
} else if (poolOffset + bytes > pool.length) {
|
|
12
|
+
crypto.getRandomValues(pool)
|
|
13
|
+
poolOffset = 0
|
|
14
|
+
}
|
|
15
|
+
poolOffset += bytes
|
|
16
|
+
}
|
|
17
|
+
export function random(bytes) {
|
|
18
|
+
fillPool((bytes |= 0))
|
|
19
|
+
return pool.subarray(poolOffset - bytes, poolOffset)
|
|
20
|
+
}
|
|
21
|
+
export function customRandom(alphabet, defaultSize, getRandom) {
|
|
22
|
+
let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
|
|
23
|
+
let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
|
|
24
|
+
return (size = defaultSize) => {
|
|
25
|
+
if (!size) return ''
|
|
26
|
+
let id = ''
|
|
27
|
+
while (true) {
|
|
28
|
+
let bytes = getRandom(step)
|
|
29
|
+
let i = step
|
|
30
|
+
while (i--) {
|
|
31
|
+
id += alphabet[bytes[i] & mask] || ''
|
|
32
|
+
if (id.length >= size) return id
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function customAlphabet(alphabet, size = 21) {
|
|
38
|
+
return customRandom(alphabet, size, random)
|
|
39
|
+
}
|
|
40
|
+
export function nanoid(size = 21) {
|
|
41
|
+
fillPool((size |= 0))
|
|
42
|
+
let id = ''
|
|
43
|
+
for (let i = poolOffset - size; i < poolOffset; i++) {
|
|
44
|
+
id += scopedUrlAlphabet[pool[i] & 63]
|
|
45
|
+
}
|
|
46
|
+
return id
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let a="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";export let nanoid=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=a[63&r[e]];return t};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* By default, Nano ID uses hardware random bytes generation for security
|
|
3
|
+
* and low collision probability. If you are not so concerned with security,
|
|
4
|
+
* you can use it for environments without hardware random generators.
|
|
5
|
+
*
|
|
6
|
+
* ```js
|
|
7
|
+
* import { nanoid } from 'nanoid/non-secure'
|
|
8
|
+
* const id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqLJ"
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Generate URL-friendly unique ID. This method uses the non-secure
|
|
16
|
+
* predictable random generator with bigger collision probability.
|
|
17
|
+
*
|
|
18
|
+
* ```js
|
|
19
|
+
* import { nanoid } from 'nanoid/non-secure'
|
|
20
|
+
* model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @param size Size of the ID. The default size is 21.
|
|
24
|
+
* @typeparam Type The ID type to replace `string` with some opaque type.
|
|
25
|
+
* @returns A random string.
|
|
26
|
+
*/
|
|
27
|
+
export function nanoid<Type extends string>(size?: number): Type
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Generate a unique ID based on a custom alphabet.
|
|
31
|
+
* This method uses the non-secure predictable random generator
|
|
32
|
+
* with bigger collision probability.
|
|
33
|
+
*
|
|
34
|
+
* @param alphabet Alphabet used to generate the ID.
|
|
35
|
+
* @param defaultSize Size of the ID. The default size is 21.
|
|
36
|
+
* @typeparam Type The ID type to replace `string` with some opaque type.
|
|
37
|
+
* @returns A random string generator.
|
|
38
|
+
*
|
|
39
|
+
* ```js
|
|
40
|
+
* import { customAlphabet } from 'nanoid/non-secure'
|
|
41
|
+
* const nanoid = customAlphabet('0123456789абвгдеё', 5)
|
|
42
|
+
* model.id = nanoid() //=> "8ё56а"
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export function customAlphabet<Type extends string>(
|
|
46
|
+
alphabet: string,
|
|
47
|
+
defaultSize?: number
|
|
48
|
+
): (size?: number) => Type
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* @ts-self-types="./index.d.ts" */
|
|
2
|
+
let urlAlphabet =
|
|
3
|
+
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
|
|
4
|
+
export let customAlphabet = (alphabet, defaultSize = 21) => {
|
|
5
|
+
return (size = defaultSize) => {
|
|
6
|
+
let id = ''
|
|
7
|
+
let i = size | 0
|
|
8
|
+
while (i--) {
|
|
9
|
+
id += alphabet[(Math.random() * alphabet.length) | 0]
|
|
10
|
+
}
|
|
11
|
+
return id
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export let nanoid = (size = 21) => {
|
|
15
|
+
let id = ''
|
|
16
|
+
let i = size | 0
|
|
17
|
+
while (i--) {
|
|
18
|
+
id += urlAlphabet[(Math.random() * 64) | 0]
|
|
19
|
+
}
|
|
20
|
+
return id
|
|
21
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nanoid",
|
|
3
|
+
"version": "5.1.7",
|
|
4
|
+
"description": "A tiny (118 bytes), secure URL-friendly unique string ID generator",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"uuid",
|
|
7
|
+
"random",
|
|
8
|
+
"id",
|
|
9
|
+
"url"
|
|
10
|
+
],
|
|
11
|
+
"type": "module",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": "^18 || >=20"
|
|
14
|
+
},
|
|
15
|
+
"funding": [
|
|
16
|
+
{
|
|
17
|
+
"type": "github",
|
|
18
|
+
"url": "https://github.com/sponsors/ai"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"author": "Andrey Sitnik <andrey@sitnik.ru>",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"repository": "ai/nanoid",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./index.d.ts",
|
|
27
|
+
"browser": "./index.browser.js",
|
|
28
|
+
"react-native": "./index.browser.js",
|
|
29
|
+
"default": "./index.js"
|
|
30
|
+
},
|
|
31
|
+
"./non-secure": {
|
|
32
|
+
"types": "./non-secure/index.d.ts",
|
|
33
|
+
"default": "./non-secure/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"browser": {
|
|
38
|
+
"./index.js": "./index.browser.js"
|
|
39
|
+
},
|
|
40
|
+
"react-native": {
|
|
41
|
+
"./index.js": "./index.browser.js"
|
|
42
|
+
},
|
|
43
|
+
"bin": "./bin/nanoid.js",
|
|
44
|
+
"sideEffects": false,
|
|
45
|
+
"types": "./index.d.ts"
|
|
46
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Path-to-RegExp
|
|
2
|
+
|
|
3
|
+
> Turn a path string such as `/user/:name` into a regular expression.
|
|
4
|
+
|
|
5
|
+
[![NPM version][npm-image]][npm-url]
|
|
6
|
+
[![NPM downloads][downloads-image]][downloads-url]
|
|
7
|
+
[![Build status][build-image]][build-url]
|
|
8
|
+
[![Build coverage][coverage-image]][coverage-url]
|
|
9
|
+
[![License][license-image]][license-url]
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
npm install path-to-regexp --save
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
const {
|
|
21
|
+
match,
|
|
22
|
+
pathToRegexp,
|
|
23
|
+
compile,
|
|
24
|
+
parse,
|
|
25
|
+
stringify,
|
|
26
|
+
} = require("path-to-regexp");
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Parameters
|
|
30
|
+
|
|
31
|
+
Parameters match arbitrary strings in a path by matching up to the end of the segment, or up to any proceeding tokens. They are defined by prefixing a colon to the parameter name (`:foo`). Parameter names can use any valid JavaScript identifier, or be double quoted to use other characters (`:"param-name"`).
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
const fn = match("/:foo/:bar");
|
|
35
|
+
|
|
36
|
+
fn("/test/route");
|
|
37
|
+
//=> { path: '/test/route', params: { foo: 'test', bar: 'route' } }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Wildcard
|
|
41
|
+
|
|
42
|
+
Wildcard parameters match one or more characters across multiple segments. They are defined the same way as regular parameters, but are prefixed with an asterisk (`*foo`).
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
const fn = match("/*splat");
|
|
46
|
+
|
|
47
|
+
fn("/bar/baz");
|
|
48
|
+
//=> { path: '/bar/baz', params: { splat: [ 'bar', 'baz' ] } }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Optional
|
|
52
|
+
|
|
53
|
+
Braces can be used to define parts of the path that are optional.
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
const fn = match("/users{/:id}/delete");
|
|
57
|
+
|
|
58
|
+
fn("/users/delete");
|
|
59
|
+
//=> { path: '/users/delete', params: {} }
|
|
60
|
+
|
|
61
|
+
fn("/users/123/delete");
|
|
62
|
+
//=> { path: '/users/123/delete', params: { id: '123' } }
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Match
|
|
66
|
+
|
|
67
|
+
The `match` function returns a function for matching strings against a path:
|
|
68
|
+
|
|
69
|
+
- **path** String, `TokenData` object, or array of strings and `TokenData` objects.
|
|
70
|
+
- **options** _(optional)_ (Extends [pathToRegexp](#pathToRegexp) options)
|
|
71
|
+
- **decode** Function for decoding strings to params, or `false` to disable all processing. (default: `decodeURIComponent`)
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
const fn = match("/foo/:bar");
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Please note:** `path-to-regexp` is intended for ordered data (e.g. paths, hosts). It can not handle arbitrarily ordered data (e.g. query strings, URL fragments, JSON, etc).
|
|
78
|
+
|
|
79
|
+
## PathToRegexp
|
|
80
|
+
|
|
81
|
+
The `pathToRegexp` function returns the `regexp` for matching strings against paths, and an array of `keys` for understanding the `RegExp#exec` matches.
|
|
82
|
+
|
|
83
|
+
- **path** String, `TokenData` object, or array of strings and `TokenData` objects.
|
|
84
|
+
- **options** _(optional)_ (See [parse](#parse) for more options)
|
|
85
|
+
- **sensitive** Regexp will be case sensitive. (default: `false`)
|
|
86
|
+
- **end** Validate the match reaches the end of the string. (default: `true`)
|
|
87
|
+
- **delimiter** The default delimiter for segments, e.g. `[^/]` for `:named` parameters. (default: `'/'`)
|
|
88
|
+
- **trailing** Allows optional trailing delimiter to match. (default: `true`)
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
const { regexp, keys } = pathToRegexp("/foo/:bar");
|
|
92
|
+
|
|
93
|
+
regexp.exec("/foo/123"); //=> ["/foo/123", "123"]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Compile ("Reverse" Path-To-RegExp)
|
|
97
|
+
|
|
98
|
+
The `compile` function will return a function for transforming parameters into a valid path:
|
|
99
|
+
|
|
100
|
+
- **path** A string or `TokenData` object.
|
|
101
|
+
- **options** (See [parse](#parse) for more options)
|
|
102
|
+
- **delimiter** The default delimiter for segments, e.g. `[^/]` for `:named` parameters. (default: `'/'`)
|
|
103
|
+
- **encode** Function for encoding input strings for output into the path, or `false` to disable entirely. (default: `encodeURIComponent`)
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
const toPath = compile("/user/:id");
|
|
107
|
+
|
|
108
|
+
toPath({ id: "name" }); //=> "/user/name"
|
|
109
|
+
toPath({ id: "café" }); //=> "/user/caf%C3%A9"
|
|
110
|
+
|
|
111
|
+
const toPathRepeated = compile("/*segment");
|
|
112
|
+
|
|
113
|
+
toPathRepeated({ segment: ["foo"] }); //=> "/foo"
|
|
114
|
+
toPathRepeated({ segment: ["a", "b", "c"] }); //=> "/a/b/c"
|
|
115
|
+
|
|
116
|
+
// When disabling `encode`, you need to make sure inputs are encoded correctly. No arrays are accepted.
|
|
117
|
+
const toPathRaw = compile("/user/:id", { encode: false });
|
|
118
|
+
|
|
119
|
+
toPathRaw({ id: "%3A%2F" }); //=> "/user/%3A%2F"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Stringify
|
|
123
|
+
|
|
124
|
+
Transform a `TokenData` object to a Path-to-RegExp string.
|
|
125
|
+
|
|
126
|
+
- **data** A `TokenData` object.
|
|
127
|
+
|
|
128
|
+
```js
|
|
129
|
+
const data = {
|
|
130
|
+
tokens: [
|
|
131
|
+
{ type: "text", value: "/" },
|
|
132
|
+
{ type: "param", name: "foo" },
|
|
133
|
+
],
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const path = stringify(data); //=> "/:foo"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Developers
|
|
140
|
+
|
|
141
|
+
- If you are rewriting paths with match and compile, consider using `encode: false` and `decode: false` to keep raw paths passed around.
|
|
142
|
+
- To ensure matches work on paths containing characters usually encoded, such as emoji, consider using [encodeurl](https://github.com/pillarjs/encodeurl) for `encodePath`.
|
|
143
|
+
|
|
144
|
+
### Parse
|
|
145
|
+
|
|
146
|
+
The `parse` function accepts a string and returns `TokenData`, which can be used with `match` and `compile`.
|
|
147
|
+
|
|
148
|
+
- **path** A string.
|
|
149
|
+
- **options** _(optional)_
|
|
150
|
+
- **encodePath** A function for encoding input strings. (default: `x => x`, recommended: [`encodeurl`](https://github.com/pillarjs/encodeurl))
|
|
151
|
+
|
|
152
|
+
### Tokens
|
|
153
|
+
|
|
154
|
+
`TokenData` has two properties:
|
|
155
|
+
|
|
156
|
+
- **tokens** A sequence of tokens, currently of types `text`, `parameter`, `wildcard`, or `group`.
|
|
157
|
+
- **originalPath** The original path used with `parse`, shown in error messages to assist debugging.
|
|
158
|
+
|
|
159
|
+
### Custom path
|
|
160
|
+
|
|
161
|
+
In some applications you may not be able to use the `path-to-regexp` syntax, but you still want to use this library for `match` and `compile`. For example:
|
|
162
|
+
|
|
163
|
+
```js
|
|
164
|
+
import { match } from "path-to-regexp";
|
|
165
|
+
|
|
166
|
+
const tokens = [
|
|
167
|
+
{ type: "text", value: "/" },
|
|
168
|
+
{ type: "parameter", name: "foo" },
|
|
169
|
+
];
|
|
170
|
+
const originalPath = "/[foo]"; // To help debug error messages.
|
|
171
|
+
const path = { tokens, originalPath };
|
|
172
|
+
const fn = match(path);
|
|
173
|
+
|
|
174
|
+
fn("/test"); //=> { path: '/test', index: 0, params: { foo: 'test' } }
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Errors
|
|
178
|
+
|
|
179
|
+
An effort has been made to ensure ambiguous paths from previous releases throw an error. This means you might be seeing an error when things worked before.
|
|
180
|
+
|
|
181
|
+
### Missing parameter name
|
|
182
|
+
|
|
183
|
+
Parameter names must be provided after `:` or `*`, for example `/*path`. They can be valid JavaScript identifiers (e.g. `:myName`) or JSON strings (`:"my-name"`).
|
|
184
|
+
|
|
185
|
+
### Unexpected `?` or `+`
|
|
186
|
+
|
|
187
|
+
In past releases, `?`, `*`, and `+` were used to denote optional or repeating parameters. As an alternative, try these:
|
|
188
|
+
|
|
189
|
+
- For optional (`?`), use braces: `/file{.:ext}`.
|
|
190
|
+
- For one or more (`+`), use a wildcard: `/*path`.
|
|
191
|
+
- For zero or more (`*`), use both: `/files{/*path}`.
|
|
192
|
+
|
|
193
|
+
### Unexpected `(`, `)`, `[`, `]`, etc.
|
|
194
|
+
|
|
195
|
+
Previous versions of Path-to-RegExp used these for RegExp features. This version no longer supports them so they've been reserved to avoid ambiguity. To match these characters literally, escape them with a backslash, e.g. `"\\("`.
|
|
196
|
+
|
|
197
|
+
### Unterminated quote
|
|
198
|
+
|
|
199
|
+
Parameter names can be wrapped in double quote characters, and this error means you forgot to close the quote character. For example, `:"foo`.
|
|
200
|
+
|
|
201
|
+
### Express <= 4.x
|
|
202
|
+
|
|
203
|
+
Path-To-RegExp breaks compatibility with Express <= `4.x` in the following ways:
|
|
204
|
+
|
|
205
|
+
- The wildcard `*` must have a name and matches the behavior of parameters `:`.
|
|
206
|
+
- The optional character `?` is no longer supported, use braces instead: `/:file{.:ext}`.
|
|
207
|
+
- Regexp characters are not supported.
|
|
208
|
+
- Some characters have been reserved to avoid confusion during upgrade (`()[]?+!`).
|
|
209
|
+
- Parameter names now support valid JavaScript identifiers, or quoted like `:"this"`.
|
|
210
|
+
|
|
211
|
+
## License
|
|
212
|
+
|
|
213
|
+
MIT
|
|
214
|
+
|
|
215
|
+
[npm-image]: https://img.shields.io/npm/v/path-to-regexp
|
|
216
|
+
[npm-url]: https://npmjs.org/package/path-to-regexp
|
|
217
|
+
[downloads-image]: https://img.shields.io/npm/dm/path-to-regexp
|
|
218
|
+
[downloads-url]: https://npmjs.org/package/path-to-regexp
|
|
219
|
+
[build-image]: https://img.shields.io/github/actions/workflow/status/pillarjs/path-to-regexp/ci.yml?branch=master
|
|
220
|
+
[build-url]: https://github.com/pillarjs/path-to-regexp/actions/workflows/ci.yml?query=branch%3Amaster
|
|
221
|
+
[coverage-image]: https://img.shields.io/codecov/c/gh/pillarjs/path-to-regexp
|
|
222
|
+
[coverage-url]: https://codecov.io/gh/pillarjs/path-to-regexp
|
|
223
|
+
[license-image]: http://img.shields.io/npm/l/path-to-regexp.svg?style=flat
|
|
224
|
+
[license-url]: LICENSE.md
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encode a string into another string.
|
|
3
|
+
*/
|
|
4
|
+
export type Encode = (value: string) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Decode a string into another string.
|
|
7
|
+
*/
|
|
8
|
+
export type Decode = (value: string) => string;
|
|
9
|
+
export interface ParseOptions {
|
|
10
|
+
/**
|
|
11
|
+
* A function for encoding input strings.
|
|
12
|
+
*/
|
|
13
|
+
encodePath?: Encode;
|
|
14
|
+
}
|
|
15
|
+
export interface PathToRegexpOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Matches the path completely without trailing characters. (default: `true`)
|
|
18
|
+
*/
|
|
19
|
+
end?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Allows optional trailing delimiter to match. (default: `true`)
|
|
22
|
+
*/
|
|
23
|
+
trailing?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Match will be case sensitive. (default: `false`)
|
|
26
|
+
*/
|
|
27
|
+
sensitive?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The default delimiter for segments. (default: `'/'`)
|
|
30
|
+
*/
|
|
31
|
+
delimiter?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface MatchOptions extends PathToRegexpOptions {
|
|
34
|
+
/**
|
|
35
|
+
* Function for decoding strings for params, or `false` to disable entirely. (default: `decodeURIComponent`)
|
|
36
|
+
*/
|
|
37
|
+
decode?: Decode | false;
|
|
38
|
+
}
|
|
39
|
+
export interface CompileOptions {
|
|
40
|
+
/**
|
|
41
|
+
* Function for encoding input strings for output into the path, or `false` to disable entirely. (default: `encodeURIComponent`)
|
|
42
|
+
*/
|
|
43
|
+
encode?: Encode | false;
|
|
44
|
+
/**
|
|
45
|
+
* The default delimiter for segments. (default: `'/'`)
|
|
46
|
+
*/
|
|
47
|
+
delimiter?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Plain text.
|
|
51
|
+
*/
|
|
52
|
+
export interface Text {
|
|
53
|
+
type: "text";
|
|
54
|
+
value: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A parameter designed to match arbitrary text within a segment.
|
|
58
|
+
*/
|
|
59
|
+
export interface Parameter {
|
|
60
|
+
type: "param";
|
|
61
|
+
name: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A wildcard parameter designed to match multiple segments.
|
|
65
|
+
*/
|
|
66
|
+
export interface Wildcard {
|
|
67
|
+
type: "wildcard";
|
|
68
|
+
name: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A set of possible tokens to expand when matching.
|
|
72
|
+
*/
|
|
73
|
+
export interface Group {
|
|
74
|
+
type: "group";
|
|
75
|
+
tokens: Token[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A token that corresponds with a regexp capture.
|
|
79
|
+
*/
|
|
80
|
+
export type Key = Parameter | Wildcard;
|
|
81
|
+
/**
|
|
82
|
+
* A sequence of `path-to-regexp` keys that match capturing groups.
|
|
83
|
+
*/
|
|
84
|
+
export type Keys = Array<Key>;
|
|
85
|
+
/**
|
|
86
|
+
* A sequence of path match characters.
|
|
87
|
+
*/
|
|
88
|
+
export type Token = Text | Parameter | Wildcard | Group;
|
|
89
|
+
/**
|
|
90
|
+
* Tokenized path instance.
|
|
91
|
+
*/
|
|
92
|
+
export declare class TokenData {
|
|
93
|
+
readonly tokens: Token[];
|
|
94
|
+
readonly originalPath?: string | undefined;
|
|
95
|
+
constructor(tokens: Token[], originalPath?: string | undefined);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* ParseError is thrown when there is an error processing the path.
|
|
99
|
+
*/
|
|
100
|
+
export declare class PathError extends TypeError {
|
|
101
|
+
readonly originalPath: string | undefined;
|
|
102
|
+
constructor(message: string, originalPath: string | undefined);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Parse a string for the raw tokens.
|
|
106
|
+
*/
|
|
107
|
+
export declare function parse(str: string, options?: ParseOptions): TokenData;
|
|
108
|
+
/**
|
|
109
|
+
* Compile a string to a template function for the path.
|
|
110
|
+
*/
|
|
111
|
+
export declare function compile<P extends ParamData = ParamData>(path: Path, options?: CompileOptions & ParseOptions): (params?: P) => string;
|
|
112
|
+
export type ParamData = Partial<Record<string, string | string[]>>;
|
|
113
|
+
export type PathFunction<P extends ParamData> = (data?: P) => string;
|
|
114
|
+
/**
|
|
115
|
+
* A match result contains data about the path match.
|
|
116
|
+
*/
|
|
117
|
+
export interface MatchResult<P extends ParamData> {
|
|
118
|
+
path: string;
|
|
119
|
+
params: P;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* A match is either `false` (no match) or a match result.
|
|
123
|
+
*/
|
|
124
|
+
export type Match<P extends ParamData> = false | MatchResult<P>;
|
|
125
|
+
/**
|
|
126
|
+
* The match function takes a string and returns whether it matched the path.
|
|
127
|
+
*/
|
|
128
|
+
export type MatchFunction<P extends ParamData> = (path: string) => Match<P>;
|
|
129
|
+
/**
|
|
130
|
+
* Supported path types.
|
|
131
|
+
*/
|
|
132
|
+
export type Path = string | TokenData;
|
|
133
|
+
/**
|
|
134
|
+
* Transform a path into a match function.
|
|
135
|
+
*/
|
|
136
|
+
export declare function match<P extends ParamData>(path: Path | Path[], options?: MatchOptions & ParseOptions): MatchFunction<P>;
|
|
137
|
+
export declare function pathToRegexp(path: Path | Path[], options?: PathToRegexpOptions & ParseOptions): {
|
|
138
|
+
regexp: RegExp;
|
|
139
|
+
keys: Keys;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Stringify token data into a path string.
|
|
143
|
+
*/
|
|
144
|
+
export declare function stringify(data: TokenData): string;
|