@zackbart/connecta 0.34.1 → 0.35.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/CHANGELOG.md +363 -0
- package/README.md +62 -106
- package/SECURITY.md +3 -2
- package/bin/connecta.mjs +41 -16
- package/bin/version.mjs +1 -1
- package/dist/access-tokens.d.ts +2 -1
- package/dist/access-tokens.js +66 -30
- package/dist/activity.d.ts +1 -1
- package/dist/activity.js +2 -0
- package/dist/agent-config.d.ts +23 -0
- package/dist/agent-config.js +59 -0
- package/dist/agent-description.js +16 -0
- package/dist/agent-identity.js +4 -4
- package/dist/agent-observation.js +39 -0
- package/dist/auth/clerk-sdk/client.d.ts +2 -0
- package/dist/auth/clerk-sdk/generated.js +554 -563
- package/dist/auth/clerk-transport.js +70 -3
- package/dist/auth/clerk.d.ts +13 -0
- package/dist/auth/clerk.js +653 -246
- package/dist/auth/cloudflare-access.js +46 -42
- package/dist/auth/downstream-client-metadata.js +2 -2
- package/dist/auth/downstream-oauth.js +2051 -1160
- package/dist/auth/downstream-revocation.js +88 -88
- package/dist/auth/native-call.js +20 -0
- package/dist/auth/native.js +184 -0
- package/dist/auth/oauth-start-reset.js +11 -5
- package/dist/auth/oauth-token-response.js +121 -102
- package/dist/auth/oauth-v2-migration.js +97 -78
- package/dist/auth/renewable-grant.js +10 -0
- package/dist/auth/static-oauth.js +663 -271
- package/dist/auth/vercel-agent.js +266 -0
- package/dist/auth-admission.js +204 -0
- package/dist/auth-elicitation.js +350 -241
- package/dist/authorization-handoff.js +164 -90
- package/dist/call-admission-context.js +3 -10
- package/dist/call-admission.js +2 -0
- package/dist/call-classification.js +9 -0
- package/dist/call-recovery.js +32 -13
- package/dist/canonical-json.js +8 -0
- package/dist/catalog-cache.js +369 -213
- package/dist/catalog-service.js +659 -530
- package/dist/catalog.js +5 -1
- package/dist/concurrency.js +0 -25
- package/dist/config-defaults.d.ts +1 -0
- package/dist/config-defaults.js +1 -0
- package/dist/config-schema.d.ts +3 -1
- package/dist/config-schema.js +13 -3
- package/dist/config.d.ts +40 -6
- package/dist/config.js +40 -26
- package/dist/connector-caller.d.ts +4 -0
- package/dist/connector-caller.js +17 -4
- package/dist/connectors/api-connector.d.ts +12 -7
- package/dist/connectors/api-connector.js +142 -56
- package/dist/connectors/guarded-fetch.d.ts +51 -17
- package/dist/connectors/guarded-fetch.js +215 -121
- package/dist/connectors/negotiation-cache.js +20 -10
- package/dist/connectors/remote-mcp.d.ts +10 -30
- package/dist/connectors/remote-mcp.js +955 -563
- package/dist/d1.js +10 -243
- package/dist/derived-context.js +5 -0
- package/dist/describe-config.d.ts +3 -1
- package/dist/describe-config.js +2 -0
- package/dist/downstream-input.js +347 -260
- package/dist/errors.d.ts +87 -6
- package/dist/errors.js +114 -4
- package/dist/execute.js +87 -50
- package/dist/executor-admission.js +3 -0
- package/dist/executors/quickjs.js +163 -112
- package/dist/guarded-transport.js +50 -0
- package/dist/guest-runtime.js +1 -1
- package/dist/http/client.js +439 -0
- package/dist/http/errors.js +558 -0
- package/dist/http/fields.js +49 -0
- package/dist/http/hatch-paging.js +318 -0
- package/dist/http/hatch.js +1279 -0
- package/dist/http/json-schema.js +267 -0
- package/dist/http/node-transport.js +241 -0
- package/dist/http/oauth.js +162 -0
- package/dist/http/paging.js +228 -0
- package/dist/http/provider.js +221 -0
- package/dist/http/safety.js +82 -0
- package/dist/http/services.js +79 -0
- package/dist/http/tools.js +383 -0
- package/dist/http/vendor-index.js +138 -0
- package/dist/http/vendor.js +448 -0
- package/dist/http/write-request.js +66 -0
- package/dist/http-policy.d.ts +11 -0
- package/dist/http-policy.js +45 -0
- package/dist/inbound-credential.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -0
- package/dist/invocation-auth.js +30 -19
- package/dist/invocation.js +218 -85
- package/dist/mcp-result.js +0 -4
- package/dist/membership.d.ts +4 -0
- package/dist/meta-output.js +1 -1
- package/dist/meta-tools.js +531 -406
- package/dist/native-recovery.js +52 -0
- package/dist/native-tools.js +382 -0
- package/dist/node.d.ts +4 -3
- package/dist/node.js +45 -8
- package/dist/oauth-handoff.js +177 -104
- package/dist/oauth-partition.js +6 -20
- package/dist/oauth-sealing.js +6 -7
- package/dist/operation-vocabulary.js +101 -0
- package/dist/operator-record.d.ts +2 -2
- package/dist/operator-record.js +17 -4
- package/dist/operator-ui/agents.d.ts +5 -4
- package/dist/operator-ui/agents.js +17 -7
- package/dist/operator-ui/config-summary.js +5 -4
- package/dist/operator-ui/connection-map.js +7 -5
- package/dist/operator-ui/contract.d.ts +7 -3
- package/dist/operator-ui/endpoints.js +4 -13
- package/dist/operator-ui/fix-prompts.d.ts +1 -1
- package/dist/operator-ui/fix-prompts.js +0 -8
- package/dist/operator-ui/generated.js +3 -3
- package/dist/operator-ui/model.d.ts +2 -3
- package/dist/operator-ui/overview.js +5 -2
- package/dist/operator-ui/setup-commands.js +0 -4
- package/dist/operator-ui/view.d.ts +2 -25
- package/dist/operator-ui/view.js +2 -76
- package/dist/program-writes.js +47 -26
- package/dist/provider-call-facts.d.ts +115 -0
- package/dist/provider-call-facts.js +182 -0
- package/dist/provider-call.d.ts +112 -0
- package/dist/provider-call.js +271 -0
- package/dist/provider.d.ts +65 -31
- package/dist/provider.js +116 -39
- package/dist/providers/_shared/google/hatch.js +91 -0
- package/dist/providers/_shared/google/kit.js +537 -0
- package/dist/providers/_shared/google/result-size.js +15 -2
- package/dist/providers/_shared/google/service-account.d.ts +2 -1
- package/dist/providers/_shared/google/service-account.js +8 -4
- package/dist/providers/_shared/google/workspace.d.ts +6 -210
- package/dist/providers/_shared/google/workspace.js +6 -425
- package/dist/providers/_shared/rest/compact-index.js +86 -0
- package/dist/providers/_shared/rest/dispatch.js +3 -23
- package/dist/providers/_shared/rest/kit.js +546 -0
- package/dist/providers/_shared/rest/operation-index.js +230 -14
- package/dist/providers/_shared/rest/response-media.js +11 -0
- package/dist/providers/_shared/rest/tools.js +101 -78
- package/dist/providers/_shared/rest/value-safety.js +353 -195
- package/dist/providers/_shared/sensitive-fields.js +27 -0
- package/dist/providers/breeze/api.js +584 -0
- package/dist/providers/breeze/index.d.ts +1 -3
- package/dist/providers/breeze/index.js +67 -1420
- package/dist/providers/breeze/openapi.generated.js +60 -0
- package/dist/providers/breeze/skill.generated.js +2 -6
- package/dist/providers/breeze/tools.js +696 -0
- package/dist/providers/ccb/api.js +496 -0
- package/dist/providers/ccb/index.d.ts +15 -37
- package/dist/providers/ccb/index.js +77 -1702
- package/dist/providers/ccb/lib/constants.d.ts +34 -0
- package/dist/providers/ccb/lib/constants.js +74 -0
- package/dist/providers/ccb/lib/guide.js +9 -0
- package/dist/providers/ccb/lib/verdicts.js +387 -0
- package/dist/providers/ccb/openapi.generated.js +397 -0
- package/dist/providers/ccb/safety.js +295 -0
- package/dist/providers/ccb/skill.generated.js +2 -6
- package/dist/providers/ccb/tools.js +853 -0
- package/dist/providers/cloudflare/api.js +1066 -0
- package/dist/providers/cloudflare/index.d.ts +5 -22
- package/dist/providers/cloudflare/index.js +79 -197
- package/dist/providers/cloudflare/lib/config.d.ts +16 -0
- package/dist/providers/cloudflare/lib/config.js +2 -0
- package/dist/providers/cloudflare/lib/discovery.js +29 -0
- package/dist/providers/cloudflare/{graphql.js → lib/graphql.js} +1 -1
- package/dist/providers/cloudflare/lib/hatch.js +103 -0
- package/dist/providers/cloudflare/lib/path-bounds.js +28 -0
- package/dist/providers/cloudflare/lib/response-media.js +75 -0
- package/dist/providers/cloudflare/openapi.generated.js +4 -3
- package/dist/providers/cloudflare/{value-safety.js → safety.js} +487 -0
- package/dist/providers/cloudflare/skill.generated.js +2 -10
- package/dist/providers/cloudflare/tools.js +360 -0
- package/dist/providers/docs/api.js +51 -0
- package/dist/providers/docs/index.d.ts +1 -12
- package/dist/providers/docs/index.js +53 -1165
- package/dist/providers/docs/lib/constants.d.ts +18 -0
- package/dist/providers/docs/lib/constants.js +18 -0
- package/dist/providers/docs/lib/discovery.js +26 -0
- package/dist/providers/docs/lib/requests.js +48 -0
- package/dist/providers/docs/lib/schemas.js +168 -0
- package/dist/providers/docs/openapi.generated.js +16 -0
- package/dist/providers/docs/safety.js +54 -0
- package/dist/providers/docs/skill.generated.js +2 -6
- package/dist/providers/docs/tools.js +802 -0
- package/dist/providers/drive/api.js +177 -0
- package/dist/providers/drive/index.d.ts +1 -12
- package/dist/providers/drive/index.js +38 -1448
- package/dist/providers/drive/lib/constants.d.ts +6 -0
- package/dist/providers/drive/lib/constants.js +6 -0
- package/dist/providers/drive/lib/contracts.js +532 -0
- package/dist/providers/drive/lib/hatch.js +197 -0
- package/dist/providers/drive/openapi.generated.js +77 -0
- package/dist/providers/drive/safety.js +90 -0
- package/dist/providers/drive/skill.generated.js +2 -6
- package/dist/providers/drive/tools.js +1290 -0
- package/dist/providers/forms/api.js +71 -0
- package/dist/providers/forms/index.d.ts +1 -12
- package/dist/providers/forms/index.js +49 -1145
- package/dist/providers/forms/lib/constants.d.ts +14 -0
- package/dist/providers/forms/lib/constants.js +19 -0
- package/dist/providers/forms/lib/hatch.js +72 -0
- package/dist/providers/forms/openapi.generated.js +23 -0
- package/dist/providers/forms/safety.js +34 -0
- package/dist/providers/forms/skill.generated.js +2 -8
- package/dist/providers/forms/tools.js +1024 -0
- package/dist/providers/github/api.js +150 -0
- package/dist/providers/github/index.d.ts +4 -5
- package/dist/providers/github/index.js +30 -87
- package/dist/providers/github/{auth.d.ts → lib/auth.d.ts} +5 -3
- package/dist/providers/github/{auth.js → lib/auth.js} +40 -43
- package/dist/providers/github/lib/discovery.js +132 -0
- package/dist/providers/github/lib/operations.js +58 -0
- package/dist/providers/github/{scope.d.ts → lib/scope.d.ts} +2 -0
- package/dist/providers/github/{scope.js → lib/scope.js} +25 -1
- package/dist/providers/github/openapi.generated.js +1216 -0
- package/dist/providers/github/safety.js +216 -0
- package/dist/providers/github/skill.generated.js +2 -5
- package/dist/providers/github/tools.js +506 -0
- package/dist/providers/gmail/api.js +114 -0
- package/dist/providers/gmail/index.d.ts +1 -12
- package/dist/providers/gmail/index.js +73 -1621
- package/dist/providers/gmail/lib/constants.d.ts +13 -0
- package/dist/providers/gmail/lib/constants.js +16 -0
- package/dist/providers/gmail/lib/index.js +173 -0
- package/dist/providers/gmail/lib/schemas.js +176 -0
- package/dist/providers/gmail/lib/threading.js +120 -0
- package/dist/providers/gmail/openapi.generated.js +92 -0
- package/dist/providers/gmail/safety.js +21 -0
- package/dist/providers/gmail/skill.generated.js +2 -6
- package/dist/providers/gmail/tools.js +1435 -0
- package/dist/providers/overflow/api.js +1008 -0
- package/dist/providers/overflow/index.d.ts +1 -17
- package/dist/providers/overflow/index.js +60 -1488
- package/dist/providers/overflow/skill.generated.js +2 -5
- package/dist/providers/overflow/tools.js +873 -0
- package/dist/providers/planning-center/api.js +467 -0
- package/dist/providers/planning-center/index.d.ts +4 -35
- package/dist/providers/planning-center/index.js +69 -2445
- package/dist/providers/planning-center/lib/constants.d.ts +58 -0
- package/dist/providers/planning-center/lib/constants.js +83 -0
- package/dist/providers/planning-center/lib/discovery.js +40 -0
- package/dist/providers/planning-center/lib/guide.js +39 -0
- package/dist/providers/planning-center/lib/json-api.js +83 -0
- package/dist/providers/planning-center/lib/verdicts.js +1758 -0
- package/dist/providers/planning-center/openapi.generated.js +1764 -0
- package/dist/providers/planning-center/safety.js +188 -0
- package/dist/providers/planning-center/skill.generated.js +2 -27
- package/dist/providers/planning-center/tools.js +1010 -0
- package/dist/providers/sheets/api.js +133 -0
- package/dist/providers/sheets/index.d.ts +4 -16
- package/dist/providers/sheets/index.js +61 -1172
- package/dist/providers/sheets/lib/constants.d.ts +14 -0
- package/dist/providers/sheets/lib/constants.js +14 -0
- package/dist/providers/sheets/lib/hatch.js +163 -0
- package/dist/providers/sheets/lib/requests.js +105 -0
- package/dist/providers/sheets/lib/schemas.js +138 -0
- package/dist/providers/sheets/openapi.generated.js +30 -0
- package/dist/providers/sheets/safety.js +27 -0
- package/dist/providers/sheets/skill.generated.js +2 -7
- package/dist/providers/sheets/tools.js +734 -0
- package/dist/providers/slides/api.js +147 -0
- package/dist/providers/slides/index.d.ts +2 -10
- package/dist/providers/slides/index.js +48 -2555
- package/dist/providers/slides/lib/constants.d.ts +11 -0
- package/dist/providers/slides/lib/constants.js +11 -0
- package/dist/providers/slides/lib/requests.js +60 -0
- package/dist/providers/slides/lib/schemas.js +565 -0
- package/dist/providers/slides/openapi.generated.js +18 -0
- package/dist/providers/slides/skill.generated.js +2 -6
- package/dist/providers/slides/tools.js +1968 -0
- package/dist/providers/stripe/api.js +401 -0
- package/dist/providers/stripe/index.d.ts +5 -27
- package/dist/providers/stripe/index.js +74 -210
- package/dist/providers/stripe/lib/config.d.ts +4 -0
- package/dist/providers/stripe/lib/config.js +2 -0
- package/dist/providers/stripe/openapi.generated.js +4 -3
- package/dist/providers/stripe/{value-safety.js → safety.js} +5 -5
- package/dist/providers/stripe/skill.generated.js +2 -11
- package/dist/providers/stripe/tools.js +77 -0
- package/dist/providers/tithely/api.js +531 -0
- package/dist/providers/tithely/index.d.ts +17 -0
- package/dist/providers/tithely/index.js +86 -965
- package/dist/providers/tithely/skill.generated.js +2 -5
- package/dist/providers/tithely/tools.js +426 -0
- package/dist/providers/vercel/api.js +551 -0
- package/dist/providers/vercel/index.d.ts +9 -25
- package/dist/providers/vercel/index.js +66 -260
- package/dist/providers/vercel/lib/config.d.ts +2 -0
- package/dist/providers/vercel/lib/config.js +2 -0
- package/dist/providers/vercel/lib/index.js +117 -0
- package/dist/providers/vercel/lib/logs.js +100 -0
- package/dist/providers/vercel/lib/pin.js +270 -0
- package/dist/providers/vercel/openapi.generated.js +10 -5
- package/dist/providers/vercel/{value-safety.js → safety.js} +247 -38
- package/dist/providers/vercel/skill.generated.js +2 -7
- package/dist/providers/vercel/tools.js +642 -0
- package/dist/redaction-identity.js +47 -0
- package/dist/redaction-marker.js +125 -0
- package/dist/registry.d.ts +21 -15
- package/dist/registry.js +409 -376
- package/dist/routes/access-tokens.js +1 -1
- package/dist/routes/actor-labels.js +1 -1
- package/dist/routes/connect.js +1 -1
- package/dist/routes/dispatch.js +103 -0
- package/dist/routes/mcp.js +170 -79
- package/dist/routes/oauth.js +3 -1
- package/dist/routes/operator.js +2 -2
- package/dist/routes/shared.d.ts +5 -4
- package/dist/routes/shared.js +244 -177
- package/dist/routes/skills.js +10 -8
- package/dist/routes/ui-config.js +27 -3
- package/dist/routes/ui-data.js +21 -20
- package/dist/routes/ui.js +1 -1
- package/dist/runtime/call-admission.js +0 -26
- package/dist/runtime/call-entry.js +30 -0
- package/dist/runtime/call.js +556 -0
- package/dist/runtime/connector-scope.js +7 -0
- package/dist/runtime/credential-probe.js +34 -0
- package/dist/runtime/executor.js +40 -0
- package/dist/runtime/native-storage.js +63 -0
- package/dist/runtime/registry.js +27 -0
- package/dist/runtime/request-scope.js +72 -0
- package/dist/runtime/run.js +15 -7
- package/dist/runtime/shared-read.js +34 -5
- package/dist/runtime/storage.js +34 -21
- package/dist/sent-secrets.d.ts +194 -37
- package/dist/sent-secrets.js +1743 -340
- package/dist/server.js +5 -56
- package/dist/skills.js +322 -222
- package/dist/sqlite.js +15 -14
- package/dist/storage/d1-copy.js +255 -0
- package/dist/storage/d1-driver.js +15 -0
- package/dist/storage/keys.js +28 -0
- package/dist/storage/sql-driver.js +88 -0
- package/dist/storage/sql-native.js +544 -0
- package/dist/storage/sql-schema.d.ts +6 -0
- package/dist/storage/sql-schema.js +15 -0
- package/dist/storage/sql.d.ts +14 -20
- package/dist/storage/sql.js +29 -535
- package/dist/timeout.js +0 -26
- package/dist/tool-safety.js +20 -10
- package/dist/types.d.ts +7 -109
- package/dist/upward.js +3 -0
- package/dist/usage-guide.js +3 -1
- package/dist/validate.d.ts +4 -2
- package/dist/validate.js +86 -9
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker.js +312 -292
- package/dist/workspace-subject.js +5 -1
- package/dist/write-outcome.js +454 -34
- package/documentation/README.md +27 -7
- package/documentation/architecture.md +2547 -226
- package/documentation/auth.md +821 -98
- package/documentation/code-mode.md +49 -16
- package/documentation/deploying.md +164 -20
- package/documentation/hosted-mcp-migration.md +460 -0
- package/documentation/integrating.md +129 -144
- package/documentation/meta-tools.md +409 -32
- package/documentation/operating.md +27 -3
- package/documentation/operator-tests.md +3 -0
- package/documentation/operator-ui.md +68 -45
- package/documentation/provider-auth-migration.md +16 -63
- package/documentation/provider-migration-0.29.md +10 -5
- package/documentation/provider-migration-0.35.md +975 -0
- package/documentation/providers.md +965 -0
- package/examples/worker/AGENTS.md +23 -9
- package/examples/worker/README.md +254 -135
- package/examples/worker/alchemy.run.ts +116 -0
- package/examples/worker/gitignore +10 -0
- package/examples/worker/src/connecta.config.ts +23 -21
- package/examples/worker/wrangler.jsonc +14 -5
- package/guides/connecting-agents.md +157 -0
- package/guides/how-it-works.md +156 -0
- package/guides/safety-and-trust.md +153 -0
- package/package.json +27 -46
- package/templates/node/.env.example +3 -0
- package/templates/node/README.md +22 -2
- package/templates/node/docker-compose.yml +1 -0
- package/templates/node/package.json +3 -2
- package/templates/node/src/connecta.config.ts +8 -0
- package/dist/catalog-drift.d.ts +0 -138
- package/dist/catalog-drift.js +0 -578
- package/dist/providers/_shared/request-token.js +0 -83
- package/dist/providers/_shared/rest/operation-index.d.ts +0 -133
- package/dist/providers/_shared/rest/tools.d.ts +0 -141
- package/dist/providers/_shared/rest/value-safety.d.ts +0 -201
- package/dist/providers/basecamp/index.d.ts +0 -45
- package/dist/providers/basecamp/index.js +0 -997
- package/dist/providers/basecamp/skill.generated.js +0 -9
- package/dist/providers/cloudflare/rest.d.ts +0 -37
- package/dist/providers/cloudflare/rest.js +0 -1097
- package/dist/providers/github/hosted.js +0 -218
- package/dist/providers/github/rest.js +0 -321
- package/dist/providers/infisical/index.d.ts +0 -7
- package/dist/providers/infisical/index.js +0 -713
- package/dist/providers/infisical/skill.generated.js +0 -8
- package/dist/providers/intercom/index.d.ts +0 -24
- package/dist/providers/intercom/index.js +0 -121
- package/dist/providers/intercom/skill.generated.js +0 -8
- package/dist/providers/linear/index.d.ts +0 -55
- package/dist/providers/linear/index.js +0 -537
- package/dist/providers/linear/skill.generated.js +0 -8
- package/dist/providers/mixpanel/index.d.ts +0 -59
- package/dist/providers/mixpanel/index.js +0 -472
- package/dist/providers/mixpanel/operations.js +0 -20
- package/dist/providers/mixpanel/rest.js +0 -603
- package/dist/providers/mixpanel/skill.generated.js +0 -10
- package/dist/providers/mixpanel/value-safety.js +0 -16
- package/dist/providers/notion/index.d.ts +0 -67
- package/dist/providers/notion/index.js +0 -368
- package/dist/providers/notion/openapi.generated.js +0 -75
- package/dist/providers/notion/rest.d.ts +0 -24
- package/dist/providers/notion/rest.js +0 -1226
- package/dist/providers/notion/skill.generated.js +0 -11
- package/dist/providers/notion/value-safety.js +0 -56
- package/dist/providers/revenuecat/index.d.ts +0 -51
- package/dist/providers/revenuecat/index.js +0 -697
- package/dist/providers/revenuecat/skill.generated.js +0 -11
- package/dist/providers/stripe/rest.d.ts +0 -14
- package/dist/providers/stripe/rest.js +0 -402
- package/dist/providers/vercel/rest.d.ts +0 -20
- package/dist/providers/vercel/rest.js +0 -1020
- package/dist/providers/wispr-flow/index.d.ts +0 -14
- package/dist/providers/wispr-flow/index.js +0 -117
- package/dist/providers/wispr-flow/skill.generated.js +0 -8
- /package/dist/providers/github/{key.js → lib/key.js} +0 -0
|
@@ -49,75 +49,66 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
49
49
|
SOFTWARE.
|
|
50
50
|
*/
|
|
51
51
|
import { clerkSdkFailure as oe } from "../clerk-transport.js";
|
|
52
|
-
var
|
|
53
|
-
var
|
|
52
|
+
var Ft = ["CI", "CONTINUOUS_INTEGRATION", "GITHUB_ACTIONS", "GITLAB_CI", "CIRCLECI", "TRAVIS", "BUILDKITE", "BITBUCKET_BUILD_NUMBER", "APPVEYOR", "CODEBUILD_BUILD_ID", "TF_BUILD", "TEAMCITY_VERSION", "JENKINS_URL", "HUDSON_URL", "BAMBOO_BUILDKEY", "CF_PAGES"];
|
|
53
|
+
var Kt = () => { try {
|
|
54
54
|
return !1;
|
|
55
55
|
}
|
|
56
|
-
catch { } return !1; },
|
|
56
|
+
catch { } return !1; }, Ht = () => { try {
|
|
57
57
|
return !0;
|
|
58
58
|
}
|
|
59
59
|
catch { } return !1; };
|
|
60
|
-
var
|
|
61
|
-
let s =
|
|
62
|
-
|
|
60
|
+
var zt = new Set, de = (t, e, r) => {
|
|
61
|
+
let s = Kt() || Ht(), n = r ?? t;
|
|
62
|
+
zt.has(n) || s || (zt.add(n), console.warn(`Clerk - DEPRECATION WARNING: "${t}" is deprecated and will be removed in the next major release.
|
|
63
63
|
${e}`));
|
|
64
64
|
};
|
|
65
|
-
var We = [".lcl.dev", ".lclstage.dev", ".lclclerk.com"],
|
|
65
|
+
var We = [".lcl.dev", ".lclstage.dev", ".lclclerk.com"], Wt = [".accounts.dev", ".accountsstage.dev", ".accounts.lclclerk.com"], Bt = [".lcl.dev", ".stg.dev", ".lclstage.dev", ".stgstage.dev", ".dev.lclclerk.com", ".stg.lclclerk.com", ".accounts.lclclerk.com", "accountsstage.dev", "accounts.dev"];
|
|
66
66
|
var fe = t => typeof atob < "u" && typeof atob == "function" ? atob(t) : typeof globalThis.Buffer < "u" ? globalThis.Buffer.from(t, "base64").toString() : t;
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
function
|
|
67
|
+
var jt = t => typeof btoa < "u" && typeof btoa == "function" ? btoa(t) : typeof globalThis.Buffer < "u" ? globalThis.Buffer.from(t).toString("base64") : t;
|
|
68
|
+
var $t = "pk_live_", Ln = "pk_test_";
|
|
69
|
+
function Gt(t) { if (!t.endsWith("$"))
|
|
70
70
|
return !1; let e = t.slice(0, -1); return e.includes("$") ? !1 : e.includes("."); }
|
|
71
|
-
function ee(t, e = {}) { if (t = t || "", !t ||
|
|
71
|
+
function ee(t, e = {}) { if (t = t || "", !t || !Vt(t)) {
|
|
72
72
|
if (e.fatal && !t)
|
|
73
73
|
throw new Error("Publishable key is missing. Ensure that your publishable key is correctly configured. Double-check your environment configuration for your keys, or access them here: https://dashboard.clerk.com/last-active?path=api-keys");
|
|
74
|
-
if (e.fatal &&
|
|
74
|
+
if (e.fatal && !Vt(t))
|
|
75
75
|
throw new Error("Publishable key not valid.");
|
|
76
76
|
return null;
|
|
77
|
-
} let r = t.startsWith(
|
|
77
|
+
} let r = t.startsWith($t) ? "production" : "development", s; try {
|
|
78
78
|
s = fe(t.split("_")[2]);
|
|
79
79
|
}
|
|
80
80
|
catch {
|
|
81
81
|
if (e.fatal)
|
|
82
82
|
throw new Error("Publishable key not valid: Failed to decode key.");
|
|
83
83
|
return null;
|
|
84
|
-
} if (!
|
|
84
|
+
} if (!Gt(s)) {
|
|
85
85
|
if (e.fatal)
|
|
86
86
|
throw new Error("Publishable key not valid: Decoded key has invalid format.");
|
|
87
87
|
return null;
|
|
88
88
|
} let n = s.slice(0, -1); return e.proxyUrl ? n = e.proxyUrl : r !== "development" && e.domain && e.isSatellite && (n = `clerk.${e.domain}`), { instanceType: r, frontendApi: n }; }
|
|
89
|
-
function
|
|
90
|
-
if (!(t.startsWith(
|
|
89
|
+
function Vt(t = "") { try {
|
|
90
|
+
if (!(t.startsWith($t) || t.startsWith(Ln)))
|
|
91
91
|
return !1;
|
|
92
92
|
let e = t.split("_");
|
|
93
93
|
if (e.length !== 3)
|
|
94
94
|
return !1;
|
|
95
95
|
let r = e[2];
|
|
96
|
-
return r ?
|
|
96
|
+
return r ? Gt(fe(r)) : !1;
|
|
97
97
|
}
|
|
98
98
|
catch {
|
|
99
99
|
return !1;
|
|
100
100
|
} }
|
|
101
|
-
function
|
|
102
|
-
return !1; let r = typeof e == "string" ? e : e.hostname, s = t.get(r); return s === void 0 && (s =
|
|
103
|
-
function
|
|
101
|
+
function Qt() { let t = new Map; return { isDevOrStagingUrl: e => { if (!e)
|
|
102
|
+
return !1; let r = typeof e == "string" ? e : e.hostname, s = t.get(r); return s === void 0 && (s = Bt.some(n => r.endsWith(n)), t.set(r, s)), s; } }; }
|
|
103
|
+
function Yt(t) { return t.startsWith("live_") || t.startsWith("pk_live_"); }
|
|
104
104
|
function Be(t) { return t.startsWith("test_") || t.startsWith("sk_test_"); }
|
|
105
|
-
async function je(t, e = globalThis.crypto.subtle) { let r = new TextEncoder().encode(t), s = await e.digest("sha-1", r); return
|
|
105
|
+
async function je(t, e = globalThis.crypto.subtle) { let r = new TextEncoder().encode(t), s = await e.digest("sha-1", r); return jt(String.fromCharCode(...new Uint8Array(s))).replace(/\+/gi, "-").replace(/\//gi, "_").substring(0, 8); }
|
|
106
106
|
var Ve = (t, e) => `${t}_${e}`;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return await t();
|
|
110
|
-
}
|
|
111
|
-
catch (p) {
|
|
112
|
-
if (r++, !s(p, r))
|
|
113
|
-
throw p;
|
|
114
|
-
d && await d(r), a && r === 1 ? await Zt(er(zn, c)) : await f();
|
|
115
|
-
} };
|
|
116
|
-
function tr(t) { return We.some(e => t.startsWith("accounts.") && t.endsWith(e)); }
|
|
117
|
-
function rr(t) { return Bt.some(e => t.endsWith(e) && !t.endsWith(".clerk" + e)); }
|
|
107
|
+
function Xt(t) { return We.some(e => t.startsWith("accounts.") && t.endsWith(e)); }
|
|
108
|
+
function Zt(t) { return Wt.some(e => t.endsWith(e) && !t.endsWith(".clerk" + e)); }
|
|
118
109
|
function we(t) { function e(r) { let s = r ?? this; if (!s)
|
|
119
110
|
throw new TypeError(`${t.kind || t.name} type guard requires an error object`); return t.kind && typeof s == "object" && s !== null && "constructor" in s && s.constructor?.kind === t.kind ? !0 : s instanceof t; } return e; }
|
|
120
|
-
var ae = class
|
|
111
|
+
var ae = class er extends Error {
|
|
121
112
|
static kind = "ClerkError";
|
|
122
113
|
clerkError = !0;
|
|
123
114
|
code;
|
|
@@ -125,7 +116,7 @@ var ae = class sr extends Error {
|
|
|
125
116
|
docsUrl;
|
|
126
117
|
cause;
|
|
127
118
|
get name() { return this.constructor.name; }
|
|
128
|
-
constructor(e) { super(new.target.formatMessage(new.target.kind, e.message, e.code, e.docsUrl), { cause: e.cause }), Object.setPrototypeOf(this,
|
|
119
|
+
constructor(e) { super(new.target.formatMessage(new.target.kind, e.message, e.code, e.docsUrl), { cause: e.cause }), Object.setPrototypeOf(this, er.prototype), this.code = e.code, this.docsUrl = e.docsUrl, this.longMessage = e.longMessage, this.cause = e.cause; }
|
|
129
120
|
toString() {
|
|
130
121
|
return `[${this.name}]
|
|
131
122
|
Message:${this.message}`;
|
|
@@ -141,11 +132,11 @@ Message:${this.message}`;
|
|
|
141
132
|
Docs: ${n}`), r;
|
|
142
133
|
}
|
|
143
134
|
};
|
|
144
|
-
var
|
|
135
|
+
var $e = class tr extends ae {
|
|
145
136
|
static kind = "ClerkRuntimeError";
|
|
146
137
|
clerkRuntimeError = !0;
|
|
147
|
-
constructor(e, r) { super({ ...r, message: e }), Object.setPrototypeOf(this,
|
|
148
|
-
},
|
|
138
|
+
constructor(e, r) { super({ ...r, message: e }), Object.setPrototypeOf(this, tr.prototype); }
|
|
139
|
+
}, rr = we($e);
|
|
149
140
|
var Ae = class {
|
|
150
141
|
static kind = "ClerkAPIError";
|
|
151
142
|
code;
|
|
@@ -153,15 +144,15 @@ var Ae = class {
|
|
|
153
144
|
longMessage;
|
|
154
145
|
meta;
|
|
155
146
|
constructor(t) { let e = { code: t.code, message: t.message, longMessage: t.long_message, meta: { paramName: t.meta?.param_name, sessionId: t.meta?.session_id, emailAddresses: t.meta?.email_addresses, identifiers: t.meta?.identifiers, zxcvbn: t.meta?.zxcvbn, plan: t.meta?.plan, isPlanUpgradePossible: t.meta?.is_plan_upgrade_possible, seatsQuantityToAdd: t.meta?.seats_quantity_to_add, seatsQuantity: t.meta?.seats_quantity } }; this.code = e.code, this.message = e.message, this.longMessage = e.longMessage, this.meta = e.meta; }
|
|
156
|
-
},
|
|
157
|
-
function
|
|
158
|
-
var pe = class
|
|
147
|
+
}, Dn = we(Ae);
|
|
148
|
+
function Ge(t) { return new Ae(t); }
|
|
149
|
+
var pe = class sr extends ae {
|
|
159
150
|
static kind = "ClerkAPIResponseError";
|
|
160
151
|
status;
|
|
161
152
|
clerkTraceId;
|
|
162
153
|
retryAfter;
|
|
163
154
|
errors;
|
|
164
|
-
constructor(e, r) { let { data: s, status: n, clerkTraceId: i, retryAfter: o } = r; super({ ...r, message: e, code: "api_response_error" }), Object.setPrototypeOf(this,
|
|
155
|
+
constructor(e, r) { let { data: s, status: n, clerkTraceId: i, retryAfter: o } = r; super({ ...r, message: e, code: "api_response_error" }), Object.setPrototypeOf(this, sr.prototype), this.status = n, this.clerkTraceId = i, this.retryAfter = o, this.errors = (s || []).map(a => new Ae(a)); }
|
|
165
156
|
toString() {
|
|
166
157
|
let e = `[${this.name}]
|
|
167
158
|
Message:${this.message}
|
|
@@ -172,27 +163,27 @@ Clerk Trace ID: ${this.clerkTraceId}`), e;
|
|
|
172
163
|
}
|
|
173
164
|
static formatMessage(e, r, s, n) { return r; }
|
|
174
165
|
}, Pe = we(pe);
|
|
175
|
-
var
|
|
176
|
-
function
|
|
166
|
+
var Fn = Object.freeze({ InvalidProxyUrlErrorMessage: "The proxyUrl passed to Clerk is invalid. The expected value for proxyUrl is an absolute URL or a relative path with a leading '/'. (key={{url}})", InvalidPublishableKeyErrorMessage: "The publishableKey passed to Clerk is invalid. You can get your Publishable key at https://dashboard.clerk.com/last-active?path=api-keys. (key={{key}})", MissingPublishableKeyErrorMessage: "Missing publishableKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.", MissingSecretKeyErrorMessage: "Missing secretKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.", MissingClerkProvider: "{{source}} can only be used within the <ClerkProvider /> component. Learn more: https://clerk.com/docs/components/clerk-provider" });
|
|
167
|
+
function Qe({ packageName: t, customMessages: e }) { let r = t; function s(i, o) { if (!o)
|
|
177
168
|
return `${r}: ${i}`; let a = i, c = i.matchAll(/{{([a-zA-Z0-9-_]+)}}/g); for (let d of c) {
|
|
178
169
|
let f = (o[d[1]] || "").toString();
|
|
179
170
|
a = a.replace(`{{${d[1]}}}`, f);
|
|
180
|
-
} return `${r}: ${a}`; } let n = { ...
|
|
181
|
-
var
|
|
182
|
-
var
|
|
183
|
-
constructor({ action: e, message: r, reason: s }) { super(r), Object.setPrototypeOf(this,
|
|
171
|
+
} return `${r}: ${a}`; } let n = { ...Fn, ...e }; return { setPackageName({ packageName: i }) { return typeof i == "string" && (r = i), this; }, setMessages({ customMessages: i }) { return Object.assign(n, i || {}), this; }, throwInvalidPublishableKeyError(i) { throw new Error(s(n.InvalidPublishableKeyErrorMessage, i)); }, throwInvalidProxyUrl(i) { throw new Error(s(n.InvalidProxyUrlErrorMessage, i)); }, throwMissingPublishableKeyError() { throw new Error(s(n.MissingPublishableKeyErrorMessage)); }, throwMissingSecretKeyError() { throw new Error(s(n.MissingSecretKeyErrorMessage)); }, throwMissingClerkProviderError(i) { throw new Error(s(n.MissingClerkProvider, i)); }, throw(i) { throw new Error(s(i)); } }; }
|
|
172
|
+
var Kn = Qe({ packageName: "@clerk/backend" }), { isDevOrStagingUrl: el } = Qt();
|
|
173
|
+
var nr = { InvalidSecretKey: "clerk_key_invalid" }, I = { TokenExpired: "token-expired", TokenInvalid: "token-invalid", TokenInvalidAlgorithm: "token-invalid-algorithm", TokenInvalidAuthorizedParties: "token-invalid-authorized-parties", TokenInvalidSignature: "token-invalid-signature", TokenNotActiveYet: "token-not-active-yet", TokenIatInTheFuture: "token-iat-in-the-future", TokenVerificationFailed: "token-verification-failed", InvalidSecretKey: "secret-key-invalid", LocalJWKMissing: "jwk-local-missing", RemoteJWKFailedToLoad: "jwk-remote-failed-to-load", RemoteJWKInvalid: "jwk-remote-invalid", RemoteJWKMissing: "jwk-remote-missing", JWKFailedToResolve: "jwk-failed-to-resolve", JWKKidMismatch: "jwk-kid-mismatch" }, L = { ContactSupport: "Contact support@clerk.com", EnsureClerkJWT: "Make sure that this is a valid Clerk-generated JWT.", SetClerkJWTKey: "Set the CLERK_JWT_KEY environment variable.", SetClerkSecretKey: "Set the CLERK_SECRET_KEY environment variable.", EnsureClockSync: "Make sure your system clock is in sync (e.g. turn off and on automatic time synchronization)." }, U = class ir extends Error {
|
|
174
|
+
constructor({ action: e, message: r, reason: s }) { super(r), Object.setPrototypeOf(this, ir.prototype), this.reason = s, this.message = r, this.action = e; }
|
|
184
175
|
getFullMessage() { return `${[this.message, this.action].filter(e => e).join(" ")} (reason=${this.reason}, token-carrier=${this.tokenCarrier})`; }
|
|
185
176
|
};
|
|
186
|
-
var W = { TokenInvalid: "token-invalid", InvalidSecretKey: "secret-key-invalid", UnexpectedError: "unexpected-error", TokenVerificationFailed: "token-verification-failed" },
|
|
187
|
-
constructor({ message: e, code: r, status: s, action: n }) { super({ message: e, code: r }), Object.setPrototypeOf(this,
|
|
177
|
+
var W = { TokenInvalid: "token-invalid", InvalidSecretKey: "secret-key-invalid", UnexpectedError: "unexpected-error", TokenVerificationFailed: "token-verification-failed" }, or = class ar extends ae {
|
|
178
|
+
constructor({ message: e, code: r, status: s, action: n }) { super({ message: e, code: r }), Object.setPrototypeOf(this, ar.prototype), this.status = s, this.action = n; }
|
|
188
179
|
static formatMessage(e, r, s, n) { return r; }
|
|
189
180
|
getFullMessage() { return `${this.message} (code=${this.code}, status=${this.status || "n/a"})`; }
|
|
190
181
|
};
|
|
191
|
-
|
|
192
|
-
var B =
|
|
193
|
-
var
|
|
194
|
-
var
|
|
195
|
-
function
|
|
182
|
+
or.kind = "MachineTokenVerificationError";
|
|
183
|
+
var B = or;
|
|
184
|
+
var cr = crypto;
|
|
185
|
+
var Hn = fetch.bind(globalThis), te = { crypto: cr, get fetch() { return Hn; }, AbortController: globalThis.AbortController, Blob: globalThis.Blob, FormData: globalThis.FormData, Headers: globalThis.Headers, Request: globalThis.Request, Response: globalThis.Response }, Ye = { parse(t, e) { return zn(t, ur, e); }, stringify(t, e) { return Wn(t, ur, e); } }, ur = { chars: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bits: 6 };
|
|
186
|
+
function zn(t, e, r = {}) { if (!e.codes) {
|
|
196
187
|
e.codes = {};
|
|
197
188
|
for (let c = 0; c < e.chars.length; ++c)
|
|
198
189
|
e.codes[e.chars[c]] = c;
|
|
@@ -206,78 +197,78 @@ function Gn(t, e, r = {}) { if (!e.codes) {
|
|
|
206
197
|
o = o << e.bits | d, i += e.bits, i >= 8 && (i -= 8, n[a++] = 255 & o >> i);
|
|
207
198
|
} if (i >= e.bits || 255 & o << 8 - i)
|
|
208
199
|
throw new SyntaxError("Unexpected end of data"); return n; }
|
|
209
|
-
function
|
|
200
|
+
function Wn(t, e, r = {}) { let { pad: s = !0 } = r, n = (1 << e.bits) - 1, i = "", o = 0, a = 0; for (let c = 0; c < t.length; ++c)
|
|
210
201
|
for (a = a << 8 | 255 & t[c], o += 8; o > e.bits;)
|
|
211
202
|
o -= e.bits, i += e.chars[n & a >> o]; if (o && (i += e.chars[n & a << e.bits - o]), s)
|
|
212
203
|
for (; i.length * e.bits & 7;)
|
|
213
204
|
i += "="; return i; }
|
|
214
|
-
var
|
|
215
|
-
function
|
|
216
|
-
throw new Error(`Unsupported algorithm ${t}, expected one of ${
|
|
217
|
-
var
|
|
205
|
+
var Ze = { RS256: "SHA-256", RS384: "SHA-384", RS512: "SHA-512" }, Xe = "RSASSA-PKCS1-v1_5", lr = { RS256: Xe, RS384: Xe, RS512: Xe }, et = Object.keys(Ze);
|
|
206
|
+
function Bn(t) { let e = Ze[t], r = lr[t]; if (!e || !r)
|
|
207
|
+
throw new Error(`Unsupported algorithm ${t}, expected one of ${et.join(",")}.`); return { hash: { name: Ze[t] }, name: lr[t] }; }
|
|
208
|
+
var jn = t => Array.isArray(t) && t.length > 0 && t.every(e => typeof e == "string"), Vn = (t, e) => { let r = [e].flat().filter(i => !!i), s = [t].flat().filter(i => !!i); if (r.length > 0 && s.length > 0) {
|
|
218
209
|
if (typeof t == "string") {
|
|
219
210
|
if (!r.includes(t))
|
|
220
211
|
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Invalid JWT audience claim (aud) ${JSON.stringify(t)}. Is not included in "${JSON.stringify(r)}".` });
|
|
221
212
|
}
|
|
222
|
-
else if (
|
|
213
|
+
else if (jn(t) && !t.some(i => r.includes(i)))
|
|
223
214
|
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Invalid JWT audience claim array (aud) ${JSON.stringify(t)}. Is not included in "${JSON.stringify(r)}".` });
|
|
224
|
-
} },
|
|
215
|
+
} }, tt = (t, e) => { if (typeof t > "u" && typeof e > "u")
|
|
225
216
|
return; let r = e ?? "JWT", s = Array.isArray(r) ? r : [r]; if (!s.includes(t))
|
|
226
|
-
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenInvalid, message: `Invalid JWT type ${JSON.stringify(t)}. Expected "${s.join(", ")}".` }); },
|
|
227
|
-
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenInvalidAlgorithm, message: `Invalid JWT algorithm ${JSON.stringify(t)}. Supported: ${
|
|
228
|
-
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Subject claim (sub) is required and must be a string. Received ${JSON.stringify(t)}.` }); },
|
|
229
|
-
throw new U({ reason: I.TokenInvalidAuthorizedParties, message: `Invalid JWT Authorized party claim (azp) ${JSON.stringify(t)}. Expected "${e}".` }); },
|
|
217
|
+
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenInvalid, message: `Invalid JWT type ${JSON.stringify(t)}. Expected "${s.join(", ")}".` }); }, rt = t => { if (!et.includes(t))
|
|
218
|
+
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenInvalidAlgorithm, message: `Invalid JWT algorithm ${JSON.stringify(t)}. Supported: ${et}.` }); }, $n = t => { if (typeof t != "string")
|
|
219
|
+
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Subject claim (sub) is required and must be a string. Received ${JSON.stringify(t)}.` }); }, Gn = (t, e) => { if (!(!e || e.length === 0) && (!t || !e.includes(t)))
|
|
220
|
+
throw new U({ reason: I.TokenInvalidAuthorizedParties, message: `Invalid JWT Authorized party claim (azp) ${JSON.stringify(t)}. Expected "${e}".` }); }, Qn = (t, e) => { if (typeof t != "number")
|
|
230
221
|
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Invalid JWT expiry date claim (exp) ${JSON.stringify(t)}. Expected number.` }); let r = new Date(Date.now()), s = new Date(0); if (s.setUTCSeconds(t), s.getTime() <= r.getTime() - e)
|
|
231
|
-
throw new U({ reason: I.TokenExpired, message: `JWT is expired. Expiry date: ${s.toUTCString()}, Current date: ${r.toUTCString()}.` }); },
|
|
222
|
+
throw new U({ reason: I.TokenExpired, message: `JWT is expired. Expiry date: ${s.toUTCString()}, Current date: ${r.toUTCString()}.` }); }, Yn = (t, e) => { if (typeof t > "u")
|
|
232
223
|
return; if (typeof t != "number")
|
|
233
224
|
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Invalid JWT not before date claim (nbf) ${JSON.stringify(t)}. Expected number.` }); let r = new Date(Date.now()), s = new Date(0); if (s.setUTCSeconds(t), s.getTime() > r.getTime() + e)
|
|
234
|
-
throw new U({ reason: I.TokenNotActiveYet, message: `JWT cannot be used prior to not before date claim (nbf). Not before date: ${s.toUTCString()}; Current date: ${r.toUTCString()};` }); },
|
|
225
|
+
throw new U({ reason: I.TokenNotActiveYet, message: `JWT cannot be used prior to not before date claim (nbf). Not before date: ${s.toUTCString()}; Current date: ${r.toUTCString()};` }); }, Xn = (t, e) => { if (typeof t > "u")
|
|
235
226
|
return; if (typeof t != "number")
|
|
236
227
|
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Invalid JWT issued at date claim (iat) ${JSON.stringify(t)}. Expected number.` }); let r = new Date(Date.now()), s = new Date(0); if (s.setUTCSeconds(t), s.getTime() > r.getTime() + e)
|
|
237
228
|
throw new U({ reason: I.TokenIatInTheFuture, message: `JWT issued at date claim (iat) is in the future. Issued at date: ${s.toUTCString()}; Current date: ${r.toUTCString()};` }); };
|
|
238
|
-
function
|
|
229
|
+
function Zn(t) { let e = t.replace(/-----BEGIN.*?-----/g, "").replace(/-----END.*?-----/g, "").replace(/\s/g, ""), r = fe(e), s = new ArrayBuffer(r.length), n = new Uint8Array(s); for (let i = 0, o = r.length; i < o; i++)
|
|
239
230
|
n[i] = r.charCodeAt(i); return n; }
|
|
240
|
-
function
|
|
241
|
-
return te.crypto.subtle.importKey("jwk", t, e, !1, [r]); let s =
|
|
242
|
-
var
|
|
243
|
-
async function
|
|
244
|
-
let c = await
|
|
231
|
+
function ei(t, e, r) { if (typeof t == "object")
|
|
232
|
+
return te.crypto.subtle.importKey("jwk", t, e, !1, [r]); let s = Zn(t), n = r === "sign" ? "pkcs8" : "spki"; return te.crypto.subtle.importKey(n, s, e, !1, [r]); }
|
|
233
|
+
var ti = 5 * 1e3;
|
|
234
|
+
async function st(t, e) { let { header: r, signature: s, raw: n } = t, o = new TextEncoder().encode([n.header, n.payload].join(".")), a = Bn(r.alg); try {
|
|
235
|
+
let c = await ei(e, a, "verify");
|
|
245
236
|
return { data: await te.crypto.subtle.verify(a.name, c, s, o) };
|
|
246
237
|
}
|
|
247
238
|
catch (c) {
|
|
248
239
|
return { errors: [new U({ reason: I.TokenInvalidSignature, message: c?.message })] };
|
|
249
240
|
} }
|
|
250
241
|
function K(t) { let e = (t || "").toString().split("."); if (e.length !== 3)
|
|
251
|
-
return { errors: [new U({ reason: I.TokenInvalid, message: "Invalid JWT form. A JWT consists of three parts separated by dots." })] }; let [r, s, n] = e, i = new TextDecoder, o = JSON.parse(i.decode(
|
|
252
|
-
async function
|
|
242
|
+
return { errors: [new U({ reason: I.TokenInvalid, message: "Invalid JWT form. A JWT consists of three parts separated by dots." })] }; let [r, s, n] = e, i = new TextDecoder, o = JSON.parse(i.decode(Ye.parse(r, { loose: !0 }))), a = JSON.parse(i.decode(Ye.parse(s, { loose: !0 }))), c = Ye.parse(n, { loose: !0 }); return { data: { header: o, payload: a, signature: c, raw: { header: r, payload: s, signature: n, text: t } } }; }
|
|
243
|
+
async function nt(t, e) { let { audience: r, authorizedParties: s, clockSkewInMs: n, key: i, headerType: o } = e, a = typeof n == "number" && Number.isFinite(n) ? n : ti, { data: c, errors: d } = K(t); if (d)
|
|
253
244
|
return { errors: d }; let { header: f, payload: p } = c; try {
|
|
254
245
|
let { typ: A, alg: P } = f;
|
|
255
|
-
|
|
246
|
+
tt(A, o), rt(P);
|
|
256
247
|
}
|
|
257
248
|
catch (A) {
|
|
258
249
|
return { errors: [A] };
|
|
259
|
-
} let { data: E, errors: S } = await
|
|
250
|
+
} let { data: E, errors: S } = await st(c, i); if (S)
|
|
260
251
|
return { errors: [new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Error verifying JWT signature. ${S[0]}` })] }; if (!E)
|
|
261
252
|
return { errors: [new U({ reason: I.TokenInvalidSignature, message: "JWT signature is invalid." })] }; try {
|
|
262
253
|
let { azp: A, sub: P, aud: x, iat: l, exp: y, nbf: m } = p;
|
|
263
|
-
|
|
254
|
+
$n(P), Vn(x, r), Gn(A, s), Qn(y, a), Yn(m, a), Xn(l, a);
|
|
264
255
|
}
|
|
265
256
|
catch (A) {
|
|
266
257
|
return { errors: [A] };
|
|
267
258
|
} return { data: p }; }
|
|
268
|
-
var
|
|
269
|
-
for (let n of
|
|
270
|
-
!
|
|
271
|
-
function
|
|
272
|
-
var Ie = new Set,
|
|
273
|
-
function
|
|
274
|
-
function
|
|
275
|
-
var
|
|
259
|
+
var ri = Object.create, hr = Object.defineProperty, si = Object.getOwnPropertyDescriptor, dr = Object.getOwnPropertyNames, ni = Object.getPrototypeOf, ii = Object.prototype.hasOwnProperty, fr = t => { throw TypeError(t); }, pr = (t, e) => function () { return e || (0, t[dr(t)[0]])((e = { exports: {} }).exports, e), e.exports; }, oi = (t, e, r, s) => { if (e && typeof e == "object" || typeof e == "function")
|
|
260
|
+
for (let n of dr(e))
|
|
261
|
+
!ii.call(t, n) && n !== r && hr(t, n, { get: () => e[n], enumerable: !(s = si(e, n)) || s.enumerable }); return t; }, mr = (t, e, r) => (r = t != null ? ri(ni(t)) : {}, oi(e || !t || !t.__esModule ? hr(r, "default", { value: t, enumerable: !0 }) : r, t)), it = (t, e, r) => e.has(t) || fr("Cannot " + r), yr = (t, e, r) => (it(t, e, "read from private field"), r ? r.call(t) : e.get(t)), ot = (t, e, r) => e.has(t) ? fr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), gr = (t, e, r, s) => (it(t, e, "write to private field"), s ? s.call(t, r) : e.set(t, r), r), ce = (t, e, r) => (it(t, e, "access private method"), r);
|
|
262
|
+
function at(t) { return t ? `https://${t.replace(/clerk\.accountsstage\./, "accountsstage.").replace(/clerk\.accounts\.|clerk\./, "accounts.")}` : ""; }
|
|
263
|
+
var Ie = new Set, kr = { warnOnce: t => { Ie.has(t) || (Ie.add(t), console.warn(t)); }, logOnce: t => { Ie.has(t) || (console.log(t), Ie.add(t)); } };
|
|
264
|
+
function ai(t) { return t ? t.replace(/([-_][a-z])/g, e => e.toUpperCase().replace(/-|_/, "")) : ""; }
|
|
265
|
+
function ci(t) { return t ? t.replace(/[A-Z]/g, e => `_${e.toLowerCase()}`) : ""; }
|
|
266
|
+
var _r = t => { let e = r => { if (!r)
|
|
276
267
|
return r; if (Array.isArray(r))
|
|
277
268
|
return r.map(i => typeof i == "object" || Array.isArray(i) ? e(i) : i); let s = { ...r }, n = Object.keys(s); for (let i of n) {
|
|
278
269
|
let o = t(i.toString());
|
|
279
270
|
o !== i && (s[o] = s[i], delete s[i]), typeof s[o] == "object" && (s[o] = e(s[o]));
|
|
280
|
-
} return s; }; return e; },
|
|
271
|
+
} return s; }; return e; }, fl = _r(ci), pl = _r(ai);
|
|
281
272
|
function ue(t) { if (typeof t == "boolean")
|
|
282
273
|
return t; if (t == null)
|
|
283
274
|
return !1; if (typeof t == "string") {
|
|
@@ -286,32 +277,32 @@ function ue(t) { if (typeof t == "boolean")
|
|
|
286
277
|
if (t.toLowerCase() === "false")
|
|
287
278
|
return !1;
|
|
288
279
|
} let e = parseInt(t, 10); return isNaN(e) ? !1 : e > 0; }
|
|
289
|
-
var
|
|
290
|
-
function
|
|
291
|
-
function
|
|
292
|
-
function
|
|
293
|
-
function
|
|
280
|
+
var ui = [".vercel.app"], li = "/__clerk";
|
|
281
|
+
function hi(t) { return ui.some(e => t?.endsWith(e)) ?? !1; }
|
|
282
|
+
function vr() { return typeof process < "u" && process.env ? process.env : {}; }
|
|
283
|
+
function di(t = vr()) { return ue(t.CLERK_DISABLE_AUTO_PROXY); }
|
|
284
|
+
function fi(t) { if (t.startsWith("http://") || t.startsWith("https://"))
|
|
294
285
|
try {
|
|
295
286
|
return new URL(t).hostname;
|
|
296
287
|
}
|
|
297
288
|
catch {
|
|
298
289
|
return "";
|
|
299
290
|
} return t.split("/")[0] || ""; }
|
|
300
|
-
function
|
|
301
|
-
return ""; let n = s.VERCEL_PROJECT_PRODUCTION_URL; return !n || !
|
|
302
|
-
var
|
|
291
|
+
function Sr({ publishableKey: t, hasDomain: e = !1, hasProxyUrl: r = !1, environment: s = vr() }) { if (r || e || !Yt(t) || di(s) || s.VERCEL_TARGET_ENV !== "production")
|
|
292
|
+
return ""; let n = s.VERCEL_PROJECT_PRODUCTION_URL; return !n || !hi(fi(n)) ? "" : li; }
|
|
293
|
+
var pi = { strict_mfa: { afterMinutes: 10, level: "multi_factor" }, strict: { afterMinutes: 10, level: "second_factor" }, moderate: { afterMinutes: 60, level: "second_factor" }, lax: { afterMinutes: 1440, level: "second_factor" } }, mi = new Set(["first_factor", "second_factor", "multi_factor"]), yi = new Set(["strict_mfa", "strict", "moderate", "lax"]), Tr = new Set(["o", "org", "organization"]), br = new Set(["u", "user"]), gi = t => typeof t == "number" && t > 0, ki = t => mi.has(t), _i = t => yi.has(t), Er = t => typeof t == "number" && Number.isFinite(t) && (t === -1 || t >= 0), ct = t => t.replace(/^(org:)*/, "org:"), vi = (t, e) => { let { orgId: r, orgRole: s, orgPermissions: n } = e, i = t.role !== void 0, o = t.permission !== void 0; return !i && !o ? "skip" : i && typeof t.role != "string" || o && typeof t.permission != "string" || !r || i && (typeof s != "string" || !s || ct(s) !== ct(t.role)) || o && (!Array.isArray(n) || !n.includes(ct(t.permission))) ? "fail" : "pass"; }, wr = (t, e) => { let { org: r, user: s } = ut(t), [n, i] = e.split(":"), o = i !== void 0, a = n, c = i || n; if (o && !Tr.has(a) && !br.has(a))
|
|
303
294
|
throw new Error(`Invalid scope: ${a}`); if (o) {
|
|
304
|
-
if (
|
|
295
|
+
if (Tr.has(a))
|
|
305
296
|
return r.includes(c);
|
|
306
|
-
if (
|
|
297
|
+
if (br.has(a))
|
|
307
298
|
return s.includes(c);
|
|
308
|
-
} return [...r, ...s].includes(c); },
|
|
299
|
+
} return [...r, ...s].includes(c); }, Si = (t, e) => { let { features: r, plans: s } = e, n = t.feature !== void 0, i = t.plan !== void 0; if (!n && !i)
|
|
309
300
|
return "skip"; if (n && typeof t.feature != "string" || i && typeof t.plan != "string")
|
|
310
301
|
return "fail"; if (n) {
|
|
311
302
|
if (typeof r != "string" || !r)
|
|
312
303
|
return "fail";
|
|
313
304
|
try {
|
|
314
|
-
if (!
|
|
305
|
+
if (!wr(r, t.feature))
|
|
315
306
|
return "fail";
|
|
316
307
|
}
|
|
317
308
|
catch {
|
|
@@ -321,32 +312,32 @@ var vi = { strict_mfa: { afterMinutes: 10, level: "multi_factor" }, strict: { af
|
|
|
321
312
|
if (typeof s != "string" || !s)
|
|
322
313
|
return "fail";
|
|
323
314
|
try {
|
|
324
|
-
if (!
|
|
315
|
+
if (!wr(s, t.plan))
|
|
325
316
|
return "fail";
|
|
326
317
|
}
|
|
327
318
|
catch {
|
|
328
319
|
return "fail";
|
|
329
320
|
}
|
|
330
|
-
} return "pass"; },
|
|
321
|
+
} return "pass"; }, ut = t => { let e = [], r = []; if (!t)
|
|
331
322
|
return { org: e, user: r }; let s = t.split(","); for (let n = 0; n < s.length; n++) {
|
|
332
323
|
let i = s[n].trim(), o = i.indexOf(":");
|
|
333
324
|
if (o === -1)
|
|
334
325
|
throw new Error(`Invalid claim element (missing colon): ${i}`);
|
|
335
326
|
let a = i.slice(0, o), c = i.slice(o + 1);
|
|
336
327
|
a === "o" ? e.push(c) : a === "u" ? r.push(c) : (a === "ou" || a === "uo") && (e.push(c), r.push(c));
|
|
337
|
-
} return { org: e, user: r }; },
|
|
338
|
-
return !1; let e = n => typeof n == "string" ?
|
|
339
|
-
return "skip"; if (!e || !Array.isArray(e) || e.length !== 2 || !
|
|
340
|
-
return "fail"; let r =
|
|
328
|
+
} return { org: e, user: r }; }, Ti = t => { if (!t)
|
|
329
|
+
return !1; let e = n => typeof n == "string" ? pi[n] : n, r = typeof t == "string" && _i(t), s = typeof t == "object" && ki(t.level) && gi(t.afterMinutes); return r || s ? e.bind(null, t) : !1; }, bi = (t, { factorVerificationAge: e }) => { if (t.reverification === void 0)
|
|
330
|
+
return "skip"; if (!e || !Array.isArray(e) || e.length !== 2 || !Er(e[0]) || !Er(e[1]))
|
|
331
|
+
return "fail"; let r = Ti(t.reverification); if (!r)
|
|
341
332
|
return "fail"; let { level: s, afterMinutes: n } = r(), [i, o] = e; if (i === -1 && o === -1)
|
|
342
333
|
return "fail"; let a = i !== -1 && n > i, c = o !== -1 && n > o; switch (s) {
|
|
343
334
|
case "first_factor": return a ? "pass" : "fail";
|
|
344
335
|
case "second_factor": return o === -1 ? a ? "pass" : "fail" : c ? "pass" : "fail";
|
|
345
336
|
case "multi_factor": return o === -1 ? a ? "pass" : "fail" : i === -1 ? "fail" : a && c ? "pass" : "fail";
|
|
346
|
-
} },
|
|
347
|
-
var
|
|
337
|
+
} }, Ei = t => t.some(e => e === "pass") && t.every(e => e === "pass" || e === "skip"), Ar = t => e => t.userId ? Ei([vi(e, t), Si(e, t), bi(e, t)]) : !1;
|
|
338
|
+
var wi = ({ per: t, fpm: e }) => { if (!t || !e)
|
|
348
339
|
return { permissions: [], featurePermissionMap: [] }; let r = t.split(",").map(s => s.trim()); return { permissions: r, featurePermissionMap: e.split(",").map(s => Number.parseInt(s.trim(), 10)).map(s => s.toString(2).padStart(r.length, "0").split("").map(n => Number.parseInt(n, 10)).reverse()).filter(Boolean) }; };
|
|
349
|
-
function
|
|
340
|
+
function Ai({ features: t, permissions: e, featurePermissionMap: r }) { if (!t || !e || !r)
|
|
350
341
|
return []; let s = []; for (let n = 0; n < t.length; n++) {
|
|
351
342
|
let i = t[n];
|
|
352
343
|
if (n >= r.length)
|
|
@@ -356,19 +347,19 @@ function Ui({ features: t, permissions: e, featurePermissionMap: r }) { if (!t |
|
|
|
356
347
|
for (let a = 0; a < o.length; a++)
|
|
357
348
|
o[a] === 1 && s.push(`org:${i}:${e[a]}`);
|
|
358
349
|
} return s; }
|
|
359
|
-
var
|
|
350
|
+
var Pr = t => { let e, r, s, n, i = t.fva ?? null, o = t.sts ?? null; switch (t.v) {
|
|
360
351
|
case 2:
|
|
361
352
|
if (t.o) {
|
|
362
353
|
e = t.o?.id, s = t.o?.slg, t.o?.rol && (r = `org:${t.o?.rol}`);
|
|
363
|
-
let { org: a } =
|
|
364
|
-
n =
|
|
354
|
+
let { org: a } = ut(t.fea), { permissions: c, featurePermissionMap: d } = wi({ per: t.o?.per, fpm: t.o?.fpm });
|
|
355
|
+
n = Ai({ features: a, featurePermissionMap: d, permissions: c });
|
|
365
356
|
}
|
|
366
357
|
break;
|
|
367
358
|
default:
|
|
368
359
|
e = t.org_id, r = t.org_role, s = t.org_slug, n = t.org_permissions;
|
|
369
360
|
break;
|
|
370
361
|
} return { sessionClaims: t, sessionId: t.sid, sessionStatus: o, actor: t.act, userId: t.sub, orgId: e, orgRole: r, orgSlug: s, orgPermissions: n, factorVerificationAge: i }; };
|
|
371
|
-
function
|
|
362
|
+
function Pi(t) { for (var e = [], r = 0; r < t.length;) {
|
|
372
363
|
var s = t[r];
|
|
373
364
|
if (s === "*" || s === "+" || s === "?") {
|
|
374
365
|
e.push({ type: "MODIFIER", index: r, value: t[r++] });
|
|
@@ -428,7 +419,7 @@ function Ri(t) { for (var e = [], r = 0; r < t.length;) {
|
|
|
428
419
|
}
|
|
429
420
|
e.push({ type: "CHAR", index: r, value: t[r++] });
|
|
430
421
|
} return e.push({ type: "END", index: r, value: "" }), e; }
|
|
431
|
-
function
|
|
422
|
+
function Ii(t, e) { e === void 0 && (e = {}); for (var r = Pi(t), s = e.prefixes, n = s === void 0 ? "./" : s, i = e.delimiter, o = i === void 0 ? "/#?" : i, a = [], c = 0, d = 0, f = "", p = function (_) { if (d < r.length && r[d].type === _)
|
|
432
423
|
return r[d++].value; }, E = function (_) { var O = p(_); if (O !== void 0)
|
|
433
424
|
return O; var q = r[d], z = q.type, D = q.index; throw new TypeError("Unexpected ".concat(z, " at ").concat(D, ", expected ").concat(_)); }, S = function () { for (var _ = "", O; O = p("CHAR") || p("ESCAPED_CHAR");)
|
|
434
425
|
_ += O; return _; }, A = function (_) { for (var O = 0, q = o; O < q.length; O++) {
|
|
@@ -455,19 +446,19 @@ function qi(t, e) { e === void 0 && (e = {}); for (var r = Ri(t), s = e.prefixes
|
|
|
455
446
|
}
|
|
456
447
|
E("END");
|
|
457
448
|
} return a; }
|
|
458
|
-
function
|
|
459
|
-
function
|
|
449
|
+
function Oi(t, e) { var r = []; return Ci(Or(t, r, e), r, e); }
|
|
450
|
+
function Ci(t, e, r) { r === void 0 && (r = {}); var s = r.decode, n = s === void 0 ? function (i) { return i; } : s; return function (i) { var o = t.exec(i); if (!o)
|
|
460
451
|
return !1; for (var a = o[0], c = o.index, d = Object.create(null), f = function (E) { if (o[E] === void 0)
|
|
461
452
|
return "continue"; var S = e[E - 1]; S.modifier === "*" || S.modifier === "+" ? d[S.name] = o[E].split(S.prefix + S.suffix).map(function (A) { return n(A, S); }) : d[S.name] = n(o[E], S); }, p = 1; p < o.length; p++)
|
|
462
453
|
f(p); return { path: a, index: c, params: d }; }; }
|
|
463
454
|
function G(t) { return t.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1"); }
|
|
464
|
-
function
|
|
465
|
-
function
|
|
455
|
+
function Ir(t) { return t && t.sensitive ? "" : "i"; }
|
|
456
|
+
function xi(t, e) { if (!e)
|
|
466
457
|
return t; for (var r = /\((?:\?<(.*?)>)?(?!\?)/g, s = 0, n = r.exec(t.source); n;)
|
|
467
458
|
e.push({ name: n[1] || s++, prefix: "", suffix: "", modifier: "", pattern: "" }), n = r.exec(t.source); return t; }
|
|
468
|
-
function
|
|
469
|
-
function
|
|
470
|
-
function
|
|
459
|
+
function Ui(t, e, r) { var s = t.map(function (n) { return Or(n, e, r).source; }); return new RegExp("(?:".concat(s.join("|"), ")"), Ir(r)); }
|
|
460
|
+
function Ri(t, e, r) { return qi(Ii(t, r), e, r); }
|
|
461
|
+
function qi(t, e, r) { r === void 0 && (r = {}); for (var s = r.strict, n = s === void 0 ? !1 : s, i = r.start, o = i === void 0 ? !0 : i, a = r.end, c = a === void 0 ? !0 : a, d = r.encode, f = d === void 0 ? function (q) { return q; } : d, p = r.delimiter, E = p === void 0 ? "/#?" : p, S = r.endsWith, A = S === void 0 ? "" : S, P = "[".concat(G(A), "]|$"), x = "[".concat(G(E), "]"), l = o ? "^" : "", y = 0, m = t; y < m.length; y++) {
|
|
471
462
|
var h = m[y];
|
|
472
463
|
if (typeof h == "string")
|
|
473
464
|
l += G(f(h));
|
|
@@ -494,18 +485,18 @@ function Fi(t, e, r) { r === void 0 && (r = {}); for (var s = r.strict, n = s ==
|
|
|
494
485
|
else {
|
|
495
486
|
var _ = t[t.length - 1], O = typeof _ == "string" ? x.indexOf(_[_.length - 1]) > -1 : _ === void 0;
|
|
496
487
|
n || (l += "(?:".concat(x, "(?=").concat(P, "))?")), O || (l += "(?=".concat(x, "|").concat(P, ")"));
|
|
497
|
-
} return new RegExp(l,
|
|
498
|
-
function
|
|
499
|
-
function
|
|
488
|
+
} return new RegExp(l, Ir(r)); }
|
|
489
|
+
function Or(t, e, r) { return t instanceof RegExp ? xi(t, e) : Array.isArray(t) ? Ui(t, e, r) : Ri(t, e, r); }
|
|
490
|
+
function lt(t, e) {
|
|
500
491
|
try {
|
|
501
|
-
return
|
|
492
|
+
return Oi(t, e);
|
|
502
493
|
}
|
|
503
494
|
catch (r) {
|
|
504
495
|
throw new Error(`Invalid path and options: Consult the documentation of path-to-regexp here: https://github.com/pillarjs/path-to-regexp/tree/6.x
|
|
505
496
|
${r.message}`);
|
|
506
497
|
}
|
|
507
498
|
}
|
|
508
|
-
var
|
|
499
|
+
var Mi = pr({ "../../node_modules/.pnpm/cookie@1.1.1/node_modules/cookie/dist/index.js"(t) {
|
|
509
500
|
"use strict";
|
|
510
501
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.parseCookie = c, t.parse = c, t.stringifyCookie = d, t.stringifySetCookie = f, t.serialize = f, t.parseSetCookie = p, t.stringifySetCookie = f, t.serialize = f;
|
|
511
502
|
var e = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/, r = /^[\u0021-\u003A\u003C-\u007E]*$/, s = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i, n = /^[\u0020-\u003A\u003D-\u007E]*$/, i = /^-?\d+$/, o = Object.prototype.toString, a = (() => { let l = function () { }; return l.prototype = Object.create(null), l; })();
|
|
@@ -639,13 +630,13 @@ var Ki = gr({ "../../node_modules/.pnpm/cookie@1.1.1/node_modules/cookie/dist/in
|
|
|
639
630
|
return l;
|
|
640
631
|
} }
|
|
641
632
|
function x(l) { return o.call(l) === "[object Date]"; }
|
|
642
|
-
} }),
|
|
643
|
-
function
|
|
644
|
-
function
|
|
633
|
+
} }), Xr = "https://api.clerk.com", Zr = "v1", es = "@clerk/backend@3.12.0", Ni = 300, At = "2026-05-12", Ji = { AuthToken: "__clerkAuthToken", AuthSignature: "__clerkAuthSignature", AuthStatus: "__clerkAuthStatus", AuthReason: "__clerkAuthReason", AuthMessage: "__clerkAuthMessage", ClerkUrl: "__clerkUrl" }, Je = { Session: "__session", Refresh: "__refresh", ClientUat: "__client_uat", Handshake: "__clerk_handshake", DevBrowser: "__clerk_db_jwt", RedirectCount: "__clerk_redirect_count", HandshakeNonce: "__clerk_handshake_nonce" }, Li = { ClerkSynced: "__clerk_synced", SuffixedCookies: "suffixed_cookies", ClerkRedirectUrl: "__clerk_redirect_url", DevBrowser: Je.DevBrowser, Handshake: Je.Handshake, HandshakeHelp: "__clerk_help", LegacyDevBrowser: "__dev_session", HandshakeReason: "__clerk_hs_reason", HandshakeNonce: Je.HandshakeNonce, HandshakeFormat: "format", Session: "__session" }, Di = { Accept: "accept", AuthMessage: "x-clerk-auth-message", Authorization: "authorization", AuthReason: "x-clerk-auth-reason", AuthSignature: "x-clerk-auth-signature", AuthStatus: "x-clerk-auth-status", AuthToken: "x-clerk-auth-token", CacheControl: "cache-control", ClerkRedirectTo: "x-clerk-redirect-to", ClerkRequestData: "x-clerk-request-data", ClerkUrl: "x-clerk-clerk-url", CloudFrontForwardedProto: "cloudfront-forwarded-proto", ContentType: "content-type", ContentSecurityPolicy: "content-security-policy", ContentSecurityPolicyReportOnly: "content-security-policy-report-only", EnableDebug: "x-clerk-debug", ForwardedHost: "x-forwarded-host", ForwardedPort: "x-forwarded-port", ForwardedProto: "x-forwarded-proto", Host: "host", Location: "location", Nonce: "x-nonce", Origin: "origin", Referrer: "referer", SecFetchDest: "sec-fetch-dest", SecFetchSite: "sec-fetch-site", UserAgent: "user-agent", ReportingEndpoints: "reporting-endpoints" }, Fi = { Json: "application/json" }, Ki = { NeedsSync: "false", Completed: "true" }, v = { Attributes: Ji, Cookies: Je, Headers: Di, ContentTypes: Fi, QueryParameters: Li, ClerkSyncStatus: Ki };
|
|
634
|
+
function Cr(t, e) { return Object.keys(t).reduce((r, s) => ({ ...r, [s]: e[s] || r[s] }), { ...t }); }
|
|
635
|
+
function ts(t) { if (!t || typeof t != "string")
|
|
645
636
|
throw Error("Missing Clerk Secret Key. Go to https://dashboard.clerk.com and get your key for your instance."); }
|
|
646
|
-
function
|
|
647
|
-
var b = { SessionToken: "session_token", ApiKey: "api_key", M2MToken: "m2m_token", OAuthToken: "oauth_token" },
|
|
648
|
-
constructor(t, e, r) { this.cookieSuffix = t, this.clerkRequest = e, this.originalFrontendApi = ""; let s =
|
|
637
|
+
function Hi(t) { ee(t, { fatal: !0 }); }
|
|
638
|
+
var b = { SessionToken: "session_token", ApiKey: "api_key", M2MToken: "m2m_token", OAuthToken: "oauth_token" }, zi = class {
|
|
639
|
+
constructor(t, e, r) { this.cookieSuffix = t, this.clerkRequest = e, this.originalFrontendApi = ""; let s = Sr({ publishableKey: r.publishableKey ?? "", hasProxyUrl: !!r.proxyUrl, hasDomain: !!r.domain }); s && (r = { ...r, proxyUrl: `${e.clerkUrl.origin}${s}` }), r.acceptsToken === b.M2MToken || r.acceptsToken === b.ApiKey ? this.initHeaderValues() : (this.initPublishableKeyValues(r), this.initHeaderValues(), this.initCookieValues(), this.initHandshakeValues()), Object.assign(this, r), this.clerkUrl = this.clerkRequest.clerkUrl, this.proxyUrl?.startsWith("/") && (this.proxyUrl = `${this.clerkUrl.origin}${this.proxyUrl}`); }
|
|
649
640
|
get sessionToken() { return this.sessionTokenInCookie || this.tokenInHeader; }
|
|
650
641
|
usesSuffixedCookies() { let t = this.getSuffixedCookie(v.Cookies.ClientUat), e = this.getCookie(v.Cookies.ClientUat), r = this.getSuffixedCookie(v.Cookies.Session) || "", s = this.getCookie(v.Cookies.Session) || ""; if (s && !this.tokenHasIssuer(s))
|
|
651
642
|
return !1; if (s && !this.tokenBelongsToInstance(s))
|
|
@@ -671,9 +662,9 @@ var b = { SessionToken: "session_token", ApiKey: "api_key", M2MToken: "m2m_token
|
|
|
671
662
|
if (e === s)
|
|
672
663
|
return !0;
|
|
673
664
|
}
|
|
674
|
-
if (this.instanceType !== "production" && (
|
|
665
|
+
if (this.instanceType !== "production" && (Xt(e) || Zt(e)))
|
|
675
666
|
return !0;
|
|
676
|
-
let r =
|
|
667
|
+
let r = at(this.frontendApi);
|
|
677
668
|
if (r) {
|
|
678
669
|
let s = new URL(r).origin;
|
|
679
670
|
if (t.origin === s)
|
|
@@ -684,7 +675,7 @@ var b = { SessionToken: "session_token", ApiKey: "api_key", M2MToken: "m2m_token
|
|
|
684
675
|
catch {
|
|
685
676
|
return !1;
|
|
686
677
|
} }
|
|
687
|
-
initPublishableKeyValues(t) {
|
|
678
|
+
initPublishableKeyValues(t) { Hi(t.publishableKey), this.publishableKey = t.publishableKey; let e = t.proxyUrl; e?.startsWith("/") && (e = `${this.clerkRequest.clerkUrl.origin}${e}`); let r = ee(this.publishableKey, { fatal: !0, domain: t.domain, isSatellite: t.isSatellite }); this.originalFrontendApi = r.frontendApi; let s = ee(this.publishableKey, { fatal: !0, proxyUrl: e, domain: t.domain, isSatellite: t.isSatellite }); this.instanceType = s.instanceType, this.frontendApi = s.frontendApi; }
|
|
688
679
|
initHeaderValues() { this.method = this.clerkRequest.method, this.tokenInHeader = this.parseAuthorizationHeader(this.getHeader(v.Headers.Authorization)), this.origin = this.getHeader(v.Headers.Origin), this.host = this.getHeader(v.Headers.Host), this.forwardedHost = this.getHeader(v.Headers.ForwardedHost), this.forwardedProto = this.getHeader(v.Headers.CloudFrontForwardedProto) || this.getHeader(v.Headers.ForwardedProto), this.referrer = this.getHeader(v.Headers.Referrer), this.userAgent = this.getHeader(v.Headers.UserAgent), this.secFetchDest = this.getHeader(v.Headers.SecFetchDest), this.accept = this.getHeader(v.Headers.Accept); }
|
|
689
680
|
initCookieValues() { this.sessionTokenInCookie = this.getSuffixedOrUnSuffixedCookie(v.Cookies.Session), this.refreshTokenInCookie = this.getSuffixedCookie(v.Cookies.Refresh), this.clientUat = Number.parseInt(this.getSuffixedOrUnSuffixedCookie(v.Cookies.ClientUat) || "") || 0; }
|
|
690
681
|
initHandshakeValues() { this.devBrowserToken = this.getQueryParam(v.QueryParameters.DevBrowser) || this.getSuffixedOrUnSuffixedCookie(v.Cookies.DevBrowser), this.handshakeToken = this.getQueryParam(v.QueryParameters.Handshake) || this.getCookie(v.Cookies.Handshake), this.handshakeRedirectLoopCounter = Number(this.getCookie(v.Cookies.RedirectCount)) || 0, this.handshakeNonce = this.getQueryParam(v.QueryParameters.HandshakeNonce) || this.getCookie(v.Cookies.HandshakeNonce); }
|
|
@@ -702,11 +693,11 @@ var b = { SessionToken: "session_token", ApiKey: "api_key", M2MToken: "m2m_token
|
|
|
702
693
|
return !1; let { data: e, errors: r } = K(t); if (r)
|
|
703
694
|
return !1; let s = e.payload.iss.replace(/https?:\/\//gi, ""); return this.originalFrontendApi === s; }
|
|
704
695
|
sessionExpired(t) { return !!t && t?.payload.exp <= Date.now() / 1e3 >> 0; }
|
|
705
|
-
},
|
|
706
|
-
function
|
|
696
|
+
}, Wi = async (t, e) => { let r = e.publishableKey ? await je(e.publishableKey, te.crypto.subtle) : ""; return new zi(r, t, e); }, Le = "/", Bi = new RegExp("(?<!:)" + Le + "{1,}", "g"), xr = 10;
|
|
697
|
+
function ji(t) { let e = t; for (let r = 0; r <= xr; r++) {
|
|
707
698
|
if (e.split(/[/\\]/).some(s => s === "." || s === ".."))
|
|
708
699
|
return !0;
|
|
709
|
-
if (r ===
|
|
700
|
+
if (r === xr)
|
|
710
701
|
throw new Error(`joinPaths: too many layers of encoding in ${t}`);
|
|
711
702
|
try {
|
|
712
703
|
let s = decodeURIComponent(e);
|
|
@@ -718,27 +709,27 @@ function Xi(t) { let e = t; for (let r = 0; r <= qr; r++) {
|
|
|
718
709
|
break;
|
|
719
710
|
}
|
|
720
711
|
} return !1; }
|
|
721
|
-
function u(...t) { let e = t.filter(r => r).join(Le).replace(
|
|
722
|
-
if (
|
|
712
|
+
function u(...t) { let e = t.filter(r => r).join(Le).replace(Bi, Le); for (let r of e.split(Le))
|
|
713
|
+
if (ji(r))
|
|
723
714
|
throw new Error(`joinPaths: "." and ".." path segments are not allowed (received "${e}")`); return e; }
|
|
724
715
|
var C = class {
|
|
725
716
|
constructor(t) { this.request = t; }
|
|
726
717
|
requireId(t) { if (!t)
|
|
727
718
|
throw new Error("A valid resource ID is required."); }
|
|
728
|
-
},
|
|
729
|
-
async create(t) { return this.request({ method: "POST", path:
|
|
730
|
-
async revoke(t) { return this.requireId(t), this.request({ method: "POST", path: u(
|
|
731
|
-
},
|
|
732
|
-
async create(t) { return this.request({ method: "POST", path:
|
|
733
|
-
async revoke(t) { return this.requireId(t), this.request({ method: "POST", path: u(
|
|
734
|
-
},
|
|
735
|
-
async createAccountlessApplication(t) { let e = t?.requestHeaders ? Object.fromEntries(t.requestHeaders.entries()) : void 0; return this.request({ method: "POST", path:
|
|
736
|
-
async completeAccountlessApplicationOnboarding(t) { let e = t?.requestHeaders ? Object.fromEntries(t.requestHeaders.entries()) : void 0; return this.request({ method: "POST", path: u(
|
|
737
|
-
},
|
|
738
|
-
async getAllowlistIdentifierList(t = {}) { return this.request({ method: "GET", path:
|
|
739
|
-
async createAllowlistIdentifier(t) { return this.request({ method: "POST", path:
|
|
740
|
-
async deleteAllowlistIdentifier(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(
|
|
741
|
-
}, Q = "/api_keys",
|
|
719
|
+
}, Ur = "/actor_tokens", Vi = class extends C {
|
|
720
|
+
async create(t) { return this.request({ method: "POST", path: Ur, bodyParams: t }); }
|
|
721
|
+
async revoke(t) { return this.requireId(t), this.request({ method: "POST", path: u(Ur, t, "revoke") }); }
|
|
722
|
+
}, Rr = "/agents/tasks", $i = class extends C {
|
|
723
|
+
async create(t) { return this.request({ method: "POST", path: Rr, bodyParams: t, options: { deepSnakecaseBodyParamKeys: !0 } }); }
|
|
724
|
+
async revoke(t) { return this.requireId(t), this.request({ method: "POST", path: u(Rr, t, "revoke") }); }
|
|
725
|
+
}, qr = "/accountless_applications", Gi = class extends C {
|
|
726
|
+
async createAccountlessApplication(t) { let e = t?.requestHeaders ? Object.fromEntries(t.requestHeaders.entries()) : void 0; return this.request({ method: "POST", path: qr, headerParams: e, queryParams: { source: t?.source } }); }
|
|
727
|
+
async completeAccountlessApplicationOnboarding(t) { let e = t?.requestHeaders ? Object.fromEntries(t.requestHeaders.entries()) : void 0; return this.request({ method: "POST", path: u(qr, "complete"), headerParams: e, queryParams: { source: t?.source } }); }
|
|
728
|
+
}, ht = "/allowlist_identifiers", Qi = class extends C {
|
|
729
|
+
async getAllowlistIdentifierList(t = {}) { return this.request({ method: "GET", path: ht, queryParams: { ...t, paginated: !0 } }); }
|
|
730
|
+
async createAllowlistIdentifier(t) { return this.request({ method: "POST", path: ht, bodyParams: t }); }
|
|
731
|
+
async deleteAllowlistIdentifier(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(ht, t) }); }
|
|
732
|
+
}, Q = "/api_keys", Yi = class extends C {
|
|
742
733
|
async list(t) { return this.request({ method: "GET", path: Q, queryParams: t }); }
|
|
743
734
|
async create(t) { return this.request({ method: "POST", path: Q, bodyParams: t }); }
|
|
744
735
|
async get(t) { return this.requireId(t), this.request({ method: "GET", path: u(Q, t) }); }
|
|
@@ -747,50 +738,50 @@ var C = class {
|
|
|
747
738
|
async revoke(t) { let { apiKeyId: e, revocationReason: r = null } = t; return this.requireId(e), this.request({ method: "POST", path: u(Q, e, "revoke"), bodyParams: { revocationReason: r } }); }
|
|
748
739
|
async getSecret(t) { return this.requireId(t), this.request({ method: "GET", path: u(Q, t, "secret") }); }
|
|
749
740
|
async verify(t) { return this.request({ method: "POST", path: u(Q, "verify"), bodyParams: { secret: t } }); }
|
|
750
|
-
},
|
|
751
|
-
async changeDomain(t) { return this.request({ method: "POST", path: u(
|
|
752
|
-
},
|
|
753
|
-
async getBlocklistIdentifierList(t = {}) { return this.request({ method: "GET", path:
|
|
754
|
-
async createBlocklistIdentifier(t) { return this.request({ method: "POST", path:
|
|
755
|
-
async deleteBlocklistIdentifier(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(
|
|
756
|
-
}, Oe = "/clients",
|
|
741
|
+
}, Xi = "/beta_features", Zi = class extends C {
|
|
742
|
+
async changeDomain(t) { return this.request({ method: "POST", path: u(Xi, "change_domain"), bodyParams: t }); }
|
|
743
|
+
}, dt = "/blocklist_identifiers", eo = class extends C {
|
|
744
|
+
async getBlocklistIdentifierList(t = {}) { return this.request({ method: "GET", path: dt, queryParams: t }); }
|
|
745
|
+
async createBlocklistIdentifier(t) { return this.request({ method: "POST", path: dt, bodyParams: t }); }
|
|
746
|
+
async deleteBlocklistIdentifier(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(dt, t) }); }
|
|
747
|
+
}, Oe = "/clients", to = class extends C {
|
|
757
748
|
async getClientList(t = {}) { return this.request({ method: "GET", path: Oe, queryParams: { ...t, paginated: !0 } }); }
|
|
758
749
|
async getClient(t) { return this.requireId(t), this.request({ method: "GET", path: u(Oe, t) }); }
|
|
759
750
|
verifyClient(t) { return this.request({ method: "POST", path: u(Oe, "verify"), bodyParams: { token: t } }); }
|
|
760
751
|
async getHandshakePayload(t) { return this.request({ method: "GET", path: u(Oe, "handshake_payload"), queryParams: t }); }
|
|
761
|
-
}, Ce = "/domains",
|
|
752
|
+
}, Ce = "/domains", ro = class extends C {
|
|
762
753
|
async list() { return this.request({ method: "GET", path: Ce }); }
|
|
763
754
|
async add(t) { return this.request({ method: "POST", path: Ce, bodyParams: t }); }
|
|
764
755
|
async update(t) { let { domainId: e, ...r } = t; return this.requireId(e), this.request({ method: "PATCH", path: u(Ce, e), bodyParams: r }); }
|
|
765
756
|
async delete(t) { return this.deleteDomain(t); }
|
|
766
757
|
async deleteDomain(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(Ce, t) }); }
|
|
767
|
-
}, xe = "/email_addresses",
|
|
758
|
+
}, xe = "/email_addresses", so = class extends C {
|
|
768
759
|
async getEmailAddress(t) { return this.requireId(t), this.request({ method: "GET", path: u(xe, t) }); }
|
|
769
760
|
async createEmailAddress(t) { return this.request({ method: "POST", path: xe, bodyParams: t }); }
|
|
770
761
|
async updateEmailAddress(t, e = {}) { return this.requireId(t), this.request({ method: "PATCH", path: u(xe, t), bodyParams: e }); }
|
|
771
762
|
async deleteEmailAddress(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(xe, t) }); }
|
|
772
|
-
},
|
|
773
|
-
async create(t) { return this.request({ method: "POST", path:
|
|
774
|
-
}, me = "/enterprise_connections",
|
|
763
|
+
}, no = "/email", io = class extends C {
|
|
764
|
+
async create(t) { return this.request({ method: "POST", path: no, bodyParams: t, options: { deepSnakecaseBodyParamKeys: !0 } }); }
|
|
765
|
+
}, me = "/enterprise_connections", oo = class extends C {
|
|
775
766
|
async createEnterpriseConnection(t) { return this.request({ method: "POST", path: me, bodyParams: t, options: { deepSnakecaseBodyParamKeys: !0 } }); }
|
|
776
767
|
async updateEnterpriseConnection(t, e) { return this.requireId(t), this.request({ method: "PATCH", path: u(me, t), bodyParams: e, options: { deepSnakecaseBodyParamKeys: !0 } }); }
|
|
777
768
|
async getEnterpriseConnectionList(t = {}) { return this.request({ method: "GET", path: me, queryParams: t }); }
|
|
778
769
|
async getEnterpriseConnection(t) { return this.requireId(t), this.request({ method: "GET", path: u(me, t) }); }
|
|
779
770
|
async deleteEnterpriseConnection(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(me, t) }); }
|
|
780
|
-
},
|
|
781
|
-
async verify(t) { return this.request({ method: "POST", path: u(
|
|
782
|
-
}, ye = "/instance",
|
|
771
|
+
}, ao = "/oauth_applications/access_tokens", co = class extends C {
|
|
772
|
+
async verify(t) { return this.request({ method: "POST", path: u(ao, "verify"), bodyParams: { access_token: t } }); }
|
|
773
|
+
}, ye = "/instance", uo = class extends C {
|
|
783
774
|
async get() { return this.request({ method: "GET", path: ye }); }
|
|
784
775
|
async update(t) { return this.request({ method: "PATCH", path: ye, bodyParams: t }); }
|
|
785
776
|
async updateRestrictions(t) { return this.request({ method: "PATCH", path: u(ye, "restrictions"), bodyParams: t }); }
|
|
786
777
|
async getOrganizationSettings() { return this.request({ method: "GET", path: u(ye, "organization_settings") }); }
|
|
787
778
|
async updateOrganizationSettings(t) { return this.request({ method: "PATCH", path: u(ye, "organization_settings"), bodyParams: t }); }
|
|
788
|
-
}, Ue = "/invitations",
|
|
779
|
+
}, Ue = "/invitations", lo = class extends C {
|
|
789
780
|
async getInvitationList(t = {}) { return this.request({ method: "GET", path: Ue, queryParams: { ...t, paginated: !0 } }); }
|
|
790
781
|
async createInvitation(t) { return this.request({ method: "POST", path: Ue, bodyParams: t }); }
|
|
791
782
|
async createInvitationBulk(t) { return this.request({ method: "POST", path: u(Ue, "bulk"), bodyParams: t }); }
|
|
792
783
|
async revokeInvitation(t) { return this.requireId(t), this.request({ method: "POST", path: u(Ue, t, "revoke") }); }
|
|
793
|
-
}, $ = "/machines",
|
|
784
|
+
}, $ = "/machines", ho = class extends C {
|
|
794
785
|
async get(t) { return this.requireId(t), this.request({ method: "GET", path: u($, t) }); }
|
|
795
786
|
async list(t = {}) { return this.request({ method: "GET", path: $, queryParams: t }); }
|
|
796
787
|
async create(t) { return this.request({ method: "POST", path: $, bodyParams: t }); }
|
|
@@ -800,51 +791,51 @@ var C = class {
|
|
|
800
791
|
async rotateSecretKey(t) { let { machineId: e, previousTokenTtl: r } = t; return this.requireId(e), this.request({ method: "POST", path: u($, e, "secret_key", "rotate"), bodyParams: { previousTokenTtl: r } }); }
|
|
801
792
|
async createScope(t, e) { return this.requireId(t), this.request({ method: "POST", path: u($, t, "scopes"), bodyParams: { toMachineId: e } }); }
|
|
802
793
|
async deleteScope(t, e) { return this.requireId(t), this.request({ method: "DELETE", path: u($, t, "scopes", e) }); }
|
|
803
|
-
},
|
|
794
|
+
}, rs = class kt {
|
|
804
795
|
constructor(e, r, s, n, i, o, a, c, d, f, p) { this.id = e, this.clientId = r, this.type = s, this.subject = n, this.scopes = i, this.revoked = o, this.revocationReason = a, this.expired = c, this.expiration = d, this.createdAt = f, this.updatedAt = p; }
|
|
805
|
-
static fromJSON(e) { return new
|
|
806
|
-
static fromJwtPayload(e, r = 5e3) { let s = e; return new
|
|
807
|
-
},
|
|
808
|
-
function
|
|
809
|
-
|
|
810
|
-
var
|
|
796
|
+
static fromJSON(e) { return new kt(e.id, e.client_id, e.type, e.subject, e.scopes, e.revoked, e.revocation_reason, e.expired, e.expiration, e.created_at, e.updated_at); }
|
|
797
|
+
static fromJwtPayload(e, r = 5e3) { let s = e; return new kt(s.jti ?? "", s.client_id ?? "", "oauth_token", e.sub, s.scp ?? s.scope?.split(" ") ?? [], !1, null, e.exp * 1e3 <= Date.now() - r, e.exp * 1e3, e.iat * 1e3, e.iat * 1e3); }
|
|
798
|
+
}, fo = new Set(["iss", "sub", "exp", "nbf", "iat", "jti"]);
|
|
799
|
+
function po(t) { let e = {}; for (let r of Object.keys(t))
|
|
800
|
+
fo.has(r) || (e[r] = t[r]); return Object.keys(e).length > 0 ? e : null; }
|
|
801
|
+
var ss = class _t {
|
|
811
802
|
constructor(e, r, s, n, i, o, a, c, d, f, p) { this.id = e, this.subject = r, this.scopes = s, this.claims = n, this.revoked = i, this.revocationReason = o, this.expired = a, this.expiration = c, this.createdAt = d, this.updatedAt = f, this.token = p; }
|
|
812
|
-
static fromJSON(e) { return new
|
|
813
|
-
static fromJwtPayload(e, r = 5e3) { return new
|
|
814
|
-
}, Ke = {},
|
|
815
|
-
function
|
|
816
|
-
function
|
|
817
|
-
function
|
|
818
|
-
var
|
|
819
|
-
function
|
|
803
|
+
static fromJSON(e) { return new _t(e.id, e.subject, e.scopes, e.claims, e.revoked, e.revocation_reason, e.expired, e.expiration, e.created_at, e.updated_at, e.token); }
|
|
804
|
+
static fromJwtPayload(e, r = 5e3) { return new _t(e.jti ?? "", e.sub, e.scopes?.split(" ") ?? e.aud ?? [], po(e), !1, null, e.exp * 1e3 <= Date.now() - r, e.exp * 1e3, e.iat * 1e3, e.iat * 1e3); }
|
|
805
|
+
}, Ke = {}, vt = 0;
|
|
806
|
+
function St(t) { return Ke[t]; }
|
|
807
|
+
function mo() { return Object.values(Ke); }
|
|
808
|
+
function ns(t, e, r = !0) { Ke[t] = e, vt = r ? Date.now() : -1; }
|
|
809
|
+
var yo = "-----BEGIN PUBLIC KEY-----", go = "-----END PUBLIC KEY-----", ko = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA", _o = "IDAQAB";
|
|
810
|
+
function Pt(t) { let { kid: e, pem: r } = t, s = `local-${e}`, n = St(s); if (n)
|
|
820
811
|
return n; if (!r)
|
|
821
|
-
throw new U({ action: L.SetClerkJWTKey, message: "Missing local JWK.", reason: I.LocalJWKMissing }); let i = r.replace(/\r\n|\n|\r/g, "").replace(
|
|
822
|
-
async function
|
|
812
|
+
throw new U({ action: L.SetClerkJWTKey, message: "Missing local JWK.", reason: I.LocalJWKMissing }); let i = r.replace(/\r\n|\n|\r/g, "").replace(yo, "").replace(go, "").replace(ko, "").replace(_o, "").replace(/\+/g, "-").replace(/\//g, "_"), o = { kid: s, kty: "RSA", alg: "RS256", n: i, e: "AQAB" }; return ns(s, o, !1), o; }
|
|
813
|
+
async function It(t) { let { secretKey: e, apiUrl: r = Xr, apiVersion: s = Zr, kid: n, skipJwksCache: i } = t; if (i || So() || !St(n)) {
|
|
823
814
|
if (!e)
|
|
824
815
|
throw new U({ action: L.ContactSupport, message: "Failed to load JWKS from Clerk Backend or Frontend API.", reason: I.RemoteJWKFailedToLoad });
|
|
825
|
-
let a = () =>
|
|
816
|
+
let a = () => vo(r, e, s, t.fetch), { keys: c } = await a();
|
|
826
817
|
if (!c || !c.length)
|
|
827
818
|
throw new U({ action: L.ContactSupport, message: "The JWKS endpoint did not contain any signing keys. Contact support@clerk.com.", reason: I.RemoteJWKFailedToLoad });
|
|
828
|
-
c.forEach(d =>
|
|
829
|
-
} let o =
|
|
830
|
-
let c =
|
|
819
|
+
c.forEach(d => ns(d.kid, d));
|
|
820
|
+
} let o = St(n); if (!o) {
|
|
821
|
+
let c = mo().map(d => d.kid).sort().join(", ");
|
|
831
822
|
throw new U({ action: `Go to your Dashboard and validate your secret and public keys are correct. ${L.ContactSupport} if the issue persists.`, message: `Unable to find a signing key in JWKS that matches the kid='${n}' of the provided session token. Please make sure that the __session cookie or the HTTP authorization header contain a Clerk-generated session JWT. The following kid is available: ${c}`, reason: I.JWKKidMismatch });
|
|
832
823
|
} return o; }
|
|
833
|
-
async function
|
|
834
|
-
throw new U({ action: L.SetClerkSecretKey, message: "Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.", reason: I.RemoteJWKFailedToLoad }); let n = new URL(t); n.pathname = u(n.pathname, r, "/jwks"); let i = await s(n.href, { headers: { Authorization: `Bearer ${e}`, "Clerk-API-Version":
|
|
835
|
-
let o = await i.json(), a =
|
|
824
|
+
async function vo(t, e, r, s) { if (!e)
|
|
825
|
+
throw new U({ action: L.SetClerkSecretKey, message: "Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.", reason: I.RemoteJWKFailedToLoad }); let n = new URL(t); n.pathname = u(n.pathname, r, "/jwks"); let i = await s(n.href, { headers: { Authorization: `Bearer ${e}`, "Clerk-API-Version": At, "Content-Type": "application/json", "User-Agent": es } }); if (!i.ok) {
|
|
826
|
+
let o = await i.json(), a = To(o?.errors, nr.InvalidSecretKey);
|
|
836
827
|
if (a) {
|
|
837
828
|
let c = I.InvalidSecretKey;
|
|
838
829
|
throw new U({ action: L.ContactSupport, message: a.message, reason: c });
|
|
839
830
|
}
|
|
840
831
|
throw new U({ action: L.ContactSupport, message: `Error loading Clerk JWKS from ${n.href} with code=${i.status}`, reason: I.RemoteJWKFailedToLoad });
|
|
841
832
|
} return i.json(); }
|
|
842
|
-
function
|
|
843
|
-
return !1; let t = Date.now() -
|
|
844
|
-
var
|
|
845
|
-
function
|
|
833
|
+
function So() { if (vt === -1)
|
|
834
|
+
return !1; let t = Date.now() - vt >= Ni * 1e3; return t && (Ke = {}), t; }
|
|
835
|
+
var To = (t, e) => t ? t.find(r => r.code === e) : null, Ot = "mt_", is = "mch_", Ct = "oat_", xt = "ak_", os = "cl_B7d4PD333AAA", bo = [Ot, Ct, xt], Eo = /^[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+$/;
|
|
836
|
+
function Ut(t) { return Eo.test(t); }
|
|
846
837
|
var De = ["at+jwt", "application/at+jwt"];
|
|
847
|
-
function
|
|
838
|
+
function Rt(t) { if (!Ut(t))
|
|
848
839
|
return !1; try {
|
|
849
840
|
let { data: e, errors: r } = K(t);
|
|
850
841
|
return !r && !!e && De.includes(e.header.typ);
|
|
@@ -852,51 +843,51 @@ function qt(t) { if (!Rt(t))
|
|
|
852
843
|
catch {
|
|
853
844
|
return !1;
|
|
854
845
|
} }
|
|
855
|
-
function He(t) { if (!
|
|
846
|
+
function He(t) { if (!Ut(t))
|
|
856
847
|
return !1; try {
|
|
857
848
|
let { data: e, errors: r } = K(t);
|
|
858
|
-
return !r && !!e && typeof e.payload.sub == "string" && e.payload.sub.startsWith(
|
|
849
|
+
return !r && !!e && typeof e.payload.sub == "string" && e.payload.sub.startsWith(is);
|
|
859
850
|
}
|
|
860
851
|
catch {
|
|
861
852
|
return !1;
|
|
862
853
|
} }
|
|
863
|
-
function
|
|
864
|
-
function
|
|
865
|
-
function
|
|
866
|
-
function
|
|
867
|
-
return b.M2MToken; if (t.startsWith(
|
|
868
|
-
return b.OAuthToken; if (t.startsWith(
|
|
854
|
+
function Mr(t) { return Rt(t) || He(t); }
|
|
855
|
+
function wo(t) { return bo.some(e => t.startsWith(e)); }
|
|
856
|
+
function Tt(t) { return wo(t) || Rt(t) || He(t); }
|
|
857
|
+
function bt(t) { if (t.startsWith(Ot) || He(t))
|
|
858
|
+
return b.M2MToken; if (t.startsWith(Ct) || Rt(t))
|
|
859
|
+
return b.OAuthToken; if (t.startsWith(xt))
|
|
869
860
|
return b.ApiKey; throw new Error("Unknown machine token type"); }
|
|
870
|
-
var
|
|
871
|
-
async function
|
|
861
|
+
var as = (t, e) => t ? e === "any" ? !0 : (Array.isArray(e) ? e : [e]).includes(t) : !1, Hl = new Set([b.ApiKey, b.M2MToken, b.OAuthToken]);
|
|
862
|
+
async function cs(t, e, r, s) { try {
|
|
872
863
|
let n;
|
|
873
864
|
if (r.jwtKey)
|
|
874
|
-
n =
|
|
865
|
+
n = Pt({ kid: e, pem: r.jwtKey });
|
|
875
866
|
else if (r.secretKey)
|
|
876
|
-
n = await
|
|
867
|
+
n = await It({ ...r, kid: e });
|
|
877
868
|
else
|
|
878
869
|
return { error: new B({ action: L.SetClerkJWTKey, message: "Failed to resolve JWK during verification.", code: W.TokenVerificationFailed }) };
|
|
879
|
-
let { data: i, errors: o } = await
|
|
870
|
+
let { data: i, errors: o } = await nt(t, { ...r, key: n, ...s ? { headerType: s } : {} });
|
|
880
871
|
return o ? { error: new B({ code: W.TokenVerificationFailed, message: o[0].message }) } : { payload: i };
|
|
881
872
|
}
|
|
882
873
|
catch (n) {
|
|
883
874
|
return { error: new B({ code: W.TokenVerificationFailed, message: n.message }) };
|
|
884
875
|
} }
|
|
885
|
-
async function
|
|
886
|
-
return { data: void 0, tokenType: b.M2MToken, errors: [new B({ code: W.TokenInvalid, message: "Invalid M2M JWT category." })] }; let n = await
|
|
887
|
-
async function
|
|
888
|
-
var Re = "/m2m_tokens", Fe, ie, Se,
|
|
889
|
-
constructor(t, e = {}) { super(t),
|
|
876
|
+
async function us(t, e, r) { let s = e.header.cat; if (s !== void 0 && s !== os)
|
|
877
|
+
return { data: void 0, tokenType: b.M2MToken, errors: [new B({ code: W.TokenInvalid, message: "Invalid M2M JWT category." })] }; let n = await cs(t, e.header.kid, r); return "error" in n ? { data: void 0, tokenType: b.M2MToken, errors: [n.error] } : { data: ss.fromJwtPayload(n.payload, r.clockSkewInMs), tokenType: b.M2MToken, errors: void 0 }; }
|
|
878
|
+
async function Ao(t, e, r) { let s = await cs(t, e.header.kid, r, De); return "error" in s ? { data: void 0, tokenType: b.OAuthToken, errors: [s.error] } : { data: rs.fromJwtPayload(s.payload, r.clockSkewInMs), tokenType: b.OAuthToken, errors: void 0 }; }
|
|
879
|
+
var Re = "/m2m_tokens", Fe, ie, Se, ls, Po = class extends C {
|
|
880
|
+
constructor(t, e = {}) { super(t), ot(this, ie), ot(this, Fe), gr(this, Fe, e); }
|
|
890
881
|
async list(t) { let { machineSecretKey: e, ...r } = t, s = ce(this, ie, Se).call(this, { method: "GET", path: Re, queryParams: r }, e); return this.request(s); }
|
|
891
882
|
async createToken(t) { let { claims: e = null, machineSecretKey: r, minRemainingTtlSeconds: s, secondsUntilExpiration: n = null, tokenFormat: i = "opaque" } = t || {}, o = ce(this, ie, Se).call(this, { method: "POST", path: Re, bodyParams: { secondsUntilExpiration: n, claims: e, minRemainingTtlSeconds: s, tokenFormat: i } }, r); return this.request(o); }
|
|
892
883
|
async revokeToken(t) { let { m2mTokenId: e, revocationReason: r = null, machineSecretKey: s } = t; this.requireId(e); let n = ce(this, ie, Se).call(this, { method: "POST", path: u(Re, e, "revoke"), bodyParams: { revocationReason: r } }, s); return this.request(n); }
|
|
893
884
|
async verify(t) { let { token: e, machineSecretKey: r } = t; if (He(e))
|
|
894
|
-
return ce(this, ie,
|
|
885
|
+
return ce(this, ie, ls).call(this, e); let s = ce(this, ie, Se).call(this, { method: "POST", path: u(Re, "verify"), bodyParams: { token: e } }, r); return this.request(s); }
|
|
895
886
|
};
|
|
896
887
|
Fe = new WeakMap;
|
|
897
888
|
ie = new WeakSet;
|
|
898
889
|
Se = function (t, e) { return e ? { ...t, headerParams: { ...t.headerParams, Authorization: `Bearer ${e}` } } : t; };
|
|
899
|
-
|
|
890
|
+
ls = async function (t) { let e; try {
|
|
900
891
|
let { data: s, errors: n } = K(t);
|
|
901
892
|
if (n)
|
|
902
893
|
throw n[0];
|
|
@@ -904,17 +895,17 @@ fs = async function (t) { let e; try {
|
|
|
904
895
|
}
|
|
905
896
|
catch (s) {
|
|
906
897
|
throw new B({ code: W.TokenInvalid, message: s.message });
|
|
907
|
-
} let r = await
|
|
898
|
+
} let r = await us(t, e, yr(this, Fe)); if (r.errors)
|
|
908
899
|
throw r.errors[0]; return r.data; };
|
|
909
|
-
var
|
|
910
|
-
async getJwks() { return this.request({ method: "GET", path:
|
|
911
|
-
}, ge = "/jwt_templates",
|
|
900
|
+
var Io = "/jwks", Oo = class extends C {
|
|
901
|
+
async getJwks() { return this.request({ method: "GET", path: Io }); }
|
|
902
|
+
}, ge = "/jwt_templates", Co = class extends C {
|
|
912
903
|
async list(t = {}) { return this.request({ method: "GET", path: ge, queryParams: { ...t, paginated: !0 } }); }
|
|
913
904
|
async get(t) { return this.requireId(t), this.request({ method: "GET", path: u(ge, t) }); }
|
|
914
905
|
async create(t) { return this.request({ method: "POST", path: ge, bodyParams: t }); }
|
|
915
906
|
async update(t) { let { templateId: e, ...r } = t; return this.requireId(e), this.request({ method: "PATCH", path: u(ge, e), bodyParams: r }); }
|
|
916
907
|
async delete(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(ge, t) }); }
|
|
917
|
-
}, N = "/organizations",
|
|
908
|
+
}, N = "/organizations", xo = class extends C {
|
|
918
909
|
async getOrganizationList(t) { return this.request({ method: "GET", path: N, queryParams: t }); }
|
|
919
910
|
async createOrganization(t) { return this.request({ method: "POST", path: N, bodyParams: t }); }
|
|
920
911
|
async getOrganization(t) { let { includeMembersCount: e } = t, r = "organizationId" in t ? t.organizationId : t.slug; return this.requireId(r), this.request({ method: "GET", path: u(N, r), queryParams: { includeMembersCount: e } }); }
|
|
@@ -939,13 +930,13 @@ var qo = "/jwks", Mo = class extends C {
|
|
|
939
930
|
async createOrganizationDomain(t) { let { organizationId: e, ...r } = t; return this.requireId(e), this.request({ method: "POST", path: u(N, e, "domains"), bodyParams: { ...r, verified: r.verified ?? !0 } }); }
|
|
940
931
|
async updateOrganizationDomain(t) { let { organizationId: e, domainId: r, ...s } = t; return this.requireId(e), this.requireId(r), this.request({ method: "PATCH", path: u(N, e, "domains", r), bodyParams: s }); }
|
|
941
932
|
async deleteOrganizationDomain(t) { let { organizationId: e, domainId: r } = t; return this.requireId(e), this.requireId(r), this.request({ method: "DELETE", path: u(N, e, "domains", r) }); }
|
|
942
|
-
}, ke = "/organization_permissions",
|
|
933
|
+
}, ke = "/organization_permissions", Uo = class extends C {
|
|
943
934
|
async getOrganizationPermissionList(t = {}) { return this.request({ method: "GET", path: ke, queryParams: t }); }
|
|
944
935
|
async getOrganizationPermission(t) { return this.requireId(t), this.request({ method: "GET", path: u(ke, t) }); }
|
|
945
936
|
async createOrganizationPermission(t) { return this.request({ method: "POST", path: ke, bodyParams: t }); }
|
|
946
937
|
async updateOrganizationPermission(t) { let { permissionId: e, ...r } = t; return this.requireId(e), this.request({ method: "PATCH", path: u(ke, e), bodyParams: r }); }
|
|
947
938
|
async deleteOrganizationPermission(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(ke, t) }); }
|
|
948
|
-
}, re = "/organization_roles",
|
|
939
|
+
}, re = "/organization_roles", Ro = class extends C {
|
|
949
940
|
async getOrganizationRoleList(t = {}) { return this.request({ method: "GET", path: re, queryParams: t }); }
|
|
950
941
|
async getOrganizationRole(t) { return this.requireId(t), this.request({ method: "GET", path: u(re, t) }); }
|
|
951
942
|
async createOrganizationRole(t) { return this.request({ method: "POST", path: re, bodyParams: t }); }
|
|
@@ -953,7 +944,7 @@ var qo = "/jwks", Mo = class extends C {
|
|
|
953
944
|
async deleteOrganizationRole(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(re, t) }); }
|
|
954
945
|
async assignPermissionToOrganizationRole(t) { let { organizationRoleId: e, permissionId: r } = t; return this.requireId(e), this.requireId(r), this.request({ method: "POST", path: u(re, e, "permissions", r) }); }
|
|
955
946
|
async removePermissionFromOrganizationRole(t) { let { organizationRoleId: e, permissionId: r } = t; return this.requireId(e), this.requireId(r), this.request({ method: "DELETE", path: u(re, e, "permissions", r) }); }
|
|
956
|
-
}, se = "/oauth_applications",
|
|
947
|
+
}, se = "/oauth_applications", qo = class extends C {
|
|
957
948
|
async list(t = {}) { return this.request({ method: "GET", path: se, queryParams: t }); }
|
|
958
949
|
async get(t) { return this.requireId(t), this.request({ method: "GET", path: u(se, t) }); }
|
|
959
950
|
async create(t) { return this.request({ method: "POST", path: se, bodyParams: t }); }
|
|
@@ -961,19 +952,19 @@ var qo = "/jwks", Mo = class extends C {
|
|
|
961
952
|
async delete(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(se, t) }); }
|
|
962
953
|
async rotateSecret(t) { return this.requireId(t), this.request({ method: "POST", path: u(se, t, "rotate_secret") }); }
|
|
963
954
|
async revokeToken(t) { let { oauthApplicationId: e, ...r } = t; return this.requireId(e), this.request({ method: "POST", path: u(se, e, "revoke_token"), bodyParams: r }); }
|
|
964
|
-
}, qe = "/phone_numbers",
|
|
955
|
+
}, qe = "/phone_numbers", Mo = class extends C {
|
|
965
956
|
async getPhoneNumber(t) { return this.requireId(t), this.request({ method: "GET", path: u(qe, t) }); }
|
|
966
957
|
async createPhoneNumber(t) { return this.request({ method: "POST", path: qe, bodyParams: t }); }
|
|
967
958
|
async updatePhoneNumber(t, e = {}) { return this.requireId(t), this.request({ method: "PATCH", path: u(qe, t), bodyParams: e }); }
|
|
968
959
|
async deletePhoneNumber(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(qe, t) }); }
|
|
969
|
-
},
|
|
970
|
-
async verify(t) { return this.request({ method: "POST", path:
|
|
971
|
-
}, Me = "/redirect_urls",
|
|
960
|
+
}, No = "/proxy_checks", Jo = class extends C {
|
|
961
|
+
async verify(t) { return this.request({ method: "POST", path: No, bodyParams: t }); }
|
|
962
|
+
}, Me = "/redirect_urls", Lo = class extends C {
|
|
972
963
|
async getRedirectUrlList() { return this.request({ method: "GET", path: Me, queryParams: { paginated: !0 } }); }
|
|
973
964
|
async getRedirectUrl(t) { return this.requireId(t), this.request({ method: "GET", path: u(Me, t) }); }
|
|
974
965
|
async createRedirectUrl(t) { return this.request({ method: "POST", path: Me, bodyParams: t }); }
|
|
975
966
|
async deleteRedirectUrl(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(Me, t) }); }
|
|
976
|
-
}, ne = "/role_sets",
|
|
967
|
+
}, ne = "/role_sets", Do = class extends C {
|
|
977
968
|
async getRoleSetList(t = {}) { return this.request({ method: "GET", path: ne, queryParams: t }); }
|
|
978
969
|
async getRoleSet(t) { return this.requireId(t), this.request({ method: "GET", path: u(ne, t) }); }
|
|
979
970
|
async createRoleSet(t) { return this.request({ method: "POST", path: ne, bodyParams: t }); }
|
|
@@ -981,13 +972,13 @@ var qo = "/jwks", Mo = class extends C {
|
|
|
981
972
|
async addRolesToRoleSet(t) { let { roleSetKeyOrId: e, ...r } = t; return this.requireId(e), this.request({ method: "POST", path: u(ne, e, "roles"), bodyParams: r }); }
|
|
982
973
|
async replaceRoleInRoleSet(t) { let { roleSetKeyOrId: e, ...r } = t; return this.requireId(e), this.request({ method: "POST", path: u(ne, e, "roles", "replace"), bodyParams: r }); }
|
|
983
974
|
async replaceRoleSet(t) { let { roleSetKeyOrId: e, ...r } = t; return this.requireId(e), this.request({ method: "POST", path: u(ne, e, "replace"), bodyParams: r }); }
|
|
984
|
-
}, _e = "/saml_connections",
|
|
975
|
+
}, _e = "/saml_connections", Fo = class extends C {
|
|
985
976
|
async getSamlConnectionList(t = {}) { return this.request({ method: "GET", path: _e, queryParams: t }); }
|
|
986
977
|
async createSamlConnection(t) { return this.request({ method: "POST", path: _e, bodyParams: t, options: { deepSnakecaseBodyParamKeys: !0 } }); }
|
|
987
978
|
async getSamlConnection(t) { return this.requireId(t), this.request({ method: "GET", path: u(_e, t) }); }
|
|
988
979
|
async updateSamlConnection(t, e = {}) { return this.requireId(t), this.request({ method: "PATCH", path: u(_e, t), bodyParams: e, options: { deepSnakecaseBodyParamKeys: !0 } }); }
|
|
989
980
|
async deleteSamlConnection(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(_e, t) }); }
|
|
990
|
-
}, Y = "/sessions",
|
|
981
|
+
}, Y = "/sessions", Ko = class extends C {
|
|
991
982
|
async getSessionList(t = {}) { return this.request({ method: "GET", path: Y, queryParams: { ...t, paginated: !0 } }); }
|
|
992
983
|
async getSession(t) { return this.requireId(t), this.request({ method: "GET", path: u(Y, t) }); }
|
|
993
984
|
async createSession(t) { return this.request({ method: "POST", path: Y, bodyParams: t }); }
|
|
@@ -995,15 +986,15 @@ var qo = "/jwks", Mo = class extends C {
|
|
|
995
986
|
async verifySession(t, e) { return this.requireId(t), this.request({ method: "POST", path: u(Y, t, "verify"), bodyParams: { token: e } }); }
|
|
996
987
|
async getToken(t, e, r) { this.requireId(t); let n = { method: "POST", path: e ? u(Y, t, "tokens", e) : u(Y, t, "tokens") }; return r !== void 0 && (n.bodyParams = { expires_in_seconds: r }), this.request(n); }
|
|
997
988
|
async refreshSession(t, e) { this.requireId(t); let { suffixed_cookies: r, ...s } = e; return this.request({ method: "POST", path: u(Y, t, "refresh"), bodyParams: s, queryParams: { suffixed_cookies: r } }); }
|
|
998
|
-
},
|
|
999
|
-
async createSignInToken(t) { return this.request({ method: "POST", path:
|
|
1000
|
-
async revokeSignInToken(t) { return this.requireId(t), this.request({ method: "POST", path: u(
|
|
1001
|
-
},
|
|
1002
|
-
async get(t) { return this.requireId(t), this.request({ method: "GET", path: u(
|
|
1003
|
-
async update(t) { let { signUpAttemptId: e, ...r } = t; return this.request({ method: "PATCH", path: u(
|
|
1004
|
-
},
|
|
1005
|
-
async createTestingToken() { return this.request({ method: "POST", path:
|
|
1006
|
-
}, R = "/users",
|
|
989
|
+
}, Nr = "/sign_in_tokens", Ho = class extends C {
|
|
990
|
+
async createSignInToken(t) { return this.request({ method: "POST", path: Nr, bodyParams: t }); }
|
|
991
|
+
async revokeSignInToken(t) { return this.requireId(t), this.request({ method: "POST", path: u(Nr, t, "revoke") }); }
|
|
992
|
+
}, Jr = "/sign_ups", zo = class extends C {
|
|
993
|
+
async get(t) { return this.requireId(t), this.request({ method: "GET", path: u(Jr, t) }); }
|
|
994
|
+
async update(t) { let { signUpAttemptId: e, ...r } = t; return this.request({ method: "PATCH", path: u(Jr, e), bodyParams: r }); }
|
|
995
|
+
}, Wo = "/testing_tokens", Bo = class extends C {
|
|
996
|
+
async createTestingToken() { return this.request({ method: "POST", path: Wo }); }
|
|
997
|
+
}, R = "/users", jo = class extends C {
|
|
1007
998
|
async getUserList(t = {}) { let { limit: e, offset: r, orderBy: s, ...n } = t, [i, o] = await Promise.all([this.request({ method: "GET", path: R, queryParams: t }), this.getCount(n)]); return { data: i, totalCount: o }; }
|
|
1008
999
|
async getUser(t) { return this.requireId(t), this.request({ method: "GET", path: u(R, t) }); }
|
|
1009
1000
|
async createUser(t) { return this.request({ method: "POST", path: R, bodyParams: t }); }
|
|
@@ -1033,51 +1024,51 @@ var qo = "/jwks", Mo = class extends C {
|
|
|
1033
1024
|
async deleteUserTOTP(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(R, t, "totp") }); }
|
|
1034
1025
|
async setPasswordCompromised(t, e = { revokeAllSessions: !1 }) { return this.requireId(t), this.request({ method: "POST", path: u(R, t, "password", "set_compromised"), bodyParams: e }); }
|
|
1035
1026
|
async unsetPasswordCompromised(t) { return this.requireId(t), this.request({ method: "POST", path: u(R, t, "password", "unset_compromised") }); }
|
|
1036
|
-
}, le = "/waitlist_entries",
|
|
1027
|
+
}, le = "/waitlist_entries", Vo = class extends C {
|
|
1037
1028
|
async list(t = {}) { return this.request({ method: "GET", path: le, queryParams: t }); }
|
|
1038
1029
|
async create(t) { return this.request({ method: "POST", path: le, bodyParams: t }); }
|
|
1039
1030
|
async createBulk(t) { return this.request({ method: "POST", path: u(le, "bulk"), bodyParams: t }); }
|
|
1040
1031
|
async invite(t, e = {}) { return this.requireId(t), this.request({ method: "POST", path: u(le, t, "invite"), bodyParams: e }); }
|
|
1041
1032
|
async reject(t) { return this.requireId(t), this.request({ method: "POST", path: u(le, t, "reject") }); }
|
|
1042
1033
|
async delete(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(le, t) }); }
|
|
1043
|
-
},
|
|
1044
|
-
async createSvixApp() { return this.request({ method: "POST", path: u(
|
|
1045
|
-
async generateSvixAuthURL() { return this.request({ method: "POST", path: u(
|
|
1046
|
-
async deleteSvixApp() { return this.request({ method: "DELETE", path: u(
|
|
1047
|
-
},
|
|
1048
|
-
async getPlanList(t) { return this.request({ method: "GET", path: u(
|
|
1049
|
-
async cancelSubscriptionItem(t, e) { return this.requireId(t), this.request({ method: "DELETE", path: u(
|
|
1034
|
+
}, ft = "/webhooks", $o = class extends C {
|
|
1035
|
+
async createSvixApp() { return this.request({ method: "POST", path: u(ft, "svix") }); }
|
|
1036
|
+
async generateSvixAuthURL() { return this.request({ method: "POST", path: u(ft, "svix_url") }); }
|
|
1037
|
+
async deleteSvixApp() { return this.request({ method: "DELETE", path: u(ft, "svix") }); }
|
|
1038
|
+
}, Lr = "/billing", Go = "/organizations", Qo = "/users", Yo = class extends C {
|
|
1039
|
+
async getPlanList(t) { return this.request({ method: "GET", path: u(Lr, "plans"), queryParams: t }); }
|
|
1040
|
+
async cancelSubscriptionItem(t, e) { return this.requireId(t), this.request({ method: "DELETE", path: u(Lr, "subscription_items", t), queryParams: e }); }
|
|
1050
1041
|
async extendSubscriptionItemFreeTrial(t, e) { return this.requireId(t), this.request({ method: "POST", path: u("/billing", "subscription_items", t, "extend_free_trial"), bodyParams: e }); }
|
|
1051
|
-
async getOrganizationBillingSubscription(t) { return this.requireId(t), this.request({ method: "GET", path: u(
|
|
1052
|
-
async getUserBillingSubscription(t) { return this.requireId(t), this.request({ method: "GET", path: u(
|
|
1053
|
-
},
|
|
1054
|
-
return s.get(t); s.set(t, r.target); let { target: n } = r; delete r.target; let i = o => o.map(a =>
|
|
1042
|
+
async getOrganizationBillingSubscription(t) { return this.requireId(t), this.request({ method: "GET", path: u(Go, t, "billing", "subscription") }); }
|
|
1043
|
+
async getUserBillingSubscription(t) { return this.requireId(t), this.request({ method: "GET", path: u(Qo, t, "billing", "subscription") }); }
|
|
1044
|
+
}, hs = t => typeof t == "object" && t !== null, Dr = t => hs(t) && !(t instanceof RegExp) && !(t instanceof Error) && !(t instanceof Date) && !(globalThis.Blob && t instanceof globalThis.Blob), Xo = Symbol("mapObjectSkip"), Et = (t, e, r, s = new WeakMap) => { if (r = { deep: !1, target: {}, ...r }, s.has(t))
|
|
1045
|
+
return s.get(t); s.set(t, r.target); let { target: n } = r; delete r.target; let i = o => o.map(a => Dr(a) ? Et(a, e, r, s) : a); if (Array.isArray(t))
|
|
1055
1046
|
return i(t); for (let [o, a] of Object.entries(t)) {
|
|
1056
1047
|
let c = e(o, a, t);
|
|
1057
|
-
if (c ===
|
|
1048
|
+
if (c === Xo)
|
|
1058
1049
|
continue;
|
|
1059
1050
|
let [d, f, { shouldRecurse: p = !0 } = {}] = c;
|
|
1060
|
-
d !== "__proto__" && (r.deep && p &&
|
|
1051
|
+
d !== "__proto__" && (r.deep && p && Dr(f) && (f = Array.isArray(f) ? i(f) : Et(f, e, r, s)), n[d] = f);
|
|
1061
1052
|
} return n; };
|
|
1062
|
-
function
|
|
1053
|
+
function Fr(t, e, r) { if (!hs(t))
|
|
1063
1054
|
throw new TypeError(`Expected an object, got \`${t}\` (${typeof t})`); if (Array.isArray(t))
|
|
1064
|
-
throw new TypeError("Expected an object, got an array"); return
|
|
1065
|
-
var
|
|
1066
|
-
function
|
|
1055
|
+
throw new TypeError("Expected an object, got an array"); return Et(t, e, r); }
|
|
1056
|
+
var Zo = /([\p{Ll}\d])(\p{Lu})/gu, ea = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu, ta = /(\d)\p{Ll}|(\p{L})\d/u, ra = /[^\p{L}\d]+/giu, Kr = "$1\0$2", Hr = "";
|
|
1057
|
+
function ds(t) { let e = t.trim(); e = e.replace(Zo, Kr).replace(ea, Kr), e = e.replace(ra, "\0"); let r = 0, s = e.length; for (; e.charAt(r) === "\0";)
|
|
1067
1058
|
r++; if (r === s)
|
|
1068
1059
|
return []; for (; e.charAt(s - 1) === "\0";)
|
|
1069
1060
|
s--; return e.slice(r, s).split(/\0/g); }
|
|
1070
|
-
function
|
|
1071
|
-
let s = e[r], n =
|
|
1061
|
+
function sa(t) { let e = ds(t); for (let r = 0; r < e.length; r++) {
|
|
1062
|
+
let s = e[r], n = ta.exec(s);
|
|
1072
1063
|
if (n) {
|
|
1073
1064
|
let i = n.index + (n[1] ?? n[2]).length;
|
|
1074
1065
|
e.splice(r, 1, s.slice(0, i), s.slice(i));
|
|
1075
1066
|
}
|
|
1076
1067
|
} return e; }
|
|
1077
|
-
function
|
|
1078
|
-
function
|
|
1079
|
-
function
|
|
1080
|
-
function
|
|
1068
|
+
function na(t, e) { let [r, s, n] = oa(t, e); return r + s.map(ia(e?.locale)).join(e?.delimiter ?? " ") + n; }
|
|
1069
|
+
function zr(t, e) { return na(t, { delimiter: "_", ...e }); }
|
|
1070
|
+
function ia(t) { return t === !1 ? e => e.toLowerCase() : e => e.toLocaleLowerCase(t); }
|
|
1071
|
+
function oa(t, e = {}) { let r = e.split ?? (e.separateNumbers ? sa : ds), s = e.prefixCharacters ?? Hr, n = e.suffixCharacters ?? Hr, i = 0, o = t.length; for (; i < t.length;) {
|
|
1081
1072
|
let a = t.charAt(i);
|
|
1082
1073
|
if (!s.includes(a))
|
|
1083
1074
|
break;
|
|
@@ -1088,305 +1079,305 @@ function da(t, e = {}) { let r = e.split ?? (e.separateNumbers ? ua : ms), s = e
|
|
|
1088
1079
|
break;
|
|
1089
1080
|
o = a;
|
|
1090
1081
|
} return [t.slice(0, i), r(t.slice(i, o)), t.slice(o)]; }
|
|
1091
|
-
var
|
|
1092
|
-
function
|
|
1093
|
-
if (t.some(n => n.constructor !==
|
|
1082
|
+
var Wr = {}.constructor;
|
|
1083
|
+
function aa(t, e) { if (Array.isArray(t)) {
|
|
1084
|
+
if (t.some(n => n.constructor !== Wr))
|
|
1094
1085
|
throw new Error("obj must be array of plain objects");
|
|
1095
1086
|
e = { deep: !0, exclude: [], parsingOptions: {}, ...e };
|
|
1096
|
-
let s = e.snakeCase || (n =>
|
|
1097
|
-
return t.map(n =>
|
|
1087
|
+
let s = e.snakeCase || (n => zr(n, e.parsingOptions));
|
|
1088
|
+
return t.map(n => Fr(n, (i, o) => [Br(e.exclude, i) ? i : s(i), o, jr(i, o, e)], e));
|
|
1098
1089
|
}
|
|
1099
|
-
else if (t.constructor !==
|
|
1100
|
-
throw new Error("obj must be an plain object"); e = { deep: !0, exclude: [], parsingOptions: {}, ...e }; let r = e.snakeCase || (s =>
|
|
1101
|
-
function
|
|
1102
|
-
function
|
|
1103
|
-
var
|
|
1090
|
+
else if (t.constructor !== Wr)
|
|
1091
|
+
throw new Error("obj must be an plain object"); e = { deep: !0, exclude: [], parsingOptions: {}, ...e }; let r = e.snakeCase || (s => zr(s, e.parsingOptions)); return Fr(t, (s, n) => [Br(e.exclude, s) ? s : r(s), n, jr(s, n, e)], e); }
|
|
1092
|
+
function Br(t, e) { return t.some(r => typeof r == "string" ? r === e : r.test(e)); }
|
|
1093
|
+
function jr(t, e, r) { return r.shouldRecurse ? { shouldRecurse: r.shouldRecurse(t, e) } : void 0; }
|
|
1094
|
+
var Vr = aa, ca = class fs {
|
|
1104
1095
|
constructor(e, r, s, n) { this.publishableKey = e, this.secretKey = r, this.claimUrl = s, this.apiKeysUrl = n; }
|
|
1105
|
-
static fromJSON(e) { return new
|
|
1106
|
-
},
|
|
1096
|
+
static fromJSON(e) { return new fs(e.publishable_key, e.secret_key, e.claim_url, e.api_keys_url); }
|
|
1097
|
+
}, ua = class ps {
|
|
1107
1098
|
constructor(e, r, s, n) { this.agentId = e, this.taskId = r, this.agentTaskId = s, this.url = n; }
|
|
1108
|
-
static fromJSON(e) { let r = e.agent_task_id ?? e.task_id ?? ""; return new
|
|
1109
|
-
},
|
|
1099
|
+
static fromJSON(e) { let r = e.agent_task_id ?? e.task_id ?? ""; return new ps(e.agent_id, r, r, e.url); }
|
|
1100
|
+
}, la = class ms {
|
|
1110
1101
|
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.status = r, this.userId = s, this.actor = n, this.token = i, this.url = o, this.createdAt = a, this.updatedAt = c; }
|
|
1111
|
-
static fromJSON(e) { return new
|
|
1112
|
-
},
|
|
1102
|
+
static fromJSON(e) { return new ms(e.id, e.status, e.user_id, e.actor, e.token, e.url, e.created_at, e.updated_at); }
|
|
1103
|
+
}, ha = class ys {
|
|
1113
1104
|
constructor(e, r, s, n, i, o, a) { this.id = e, this.identifier = r, this.identifierType = s, this.createdAt = n, this.updatedAt = i, this.instanceId = o, this.invitationId = a; }
|
|
1114
|
-
static fromJSON(e) { return new
|
|
1115
|
-
},
|
|
1105
|
+
static fromJSON(e) { return new ys(e.id, e.identifier, e.identifier_type, e.created_at, e.updated_at, e.instance_id, e.invitation_id); }
|
|
1106
|
+
}, da = class gs {
|
|
1116
1107
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x) { this.id = e, this.type = r, this.name = s, this.subject = n, this.scopes = i, this.claims = o, this.revoked = a, this.revocationReason = c, this.expired = d, this.expiration = f, this.createdBy = p, this.description = E, this.lastUsedAt = S, this.createdAt = A, this.updatedAt = P, this.secret = x; }
|
|
1117
|
-
static fromJSON(e) { return new
|
|
1118
|
-
},
|
|
1108
|
+
static fromJSON(e) { return new gs(e.id, e.type, e.name, e.subject, e.scopes, e.claims, e.revoked, e.revocation_reason, e.expired, e.expiration, e.created_by, e.description, e.last_used_at, e.created_at, e.updated_at, e.secret); }
|
|
1109
|
+
}, fa = class ks {
|
|
1119
1110
|
constructor(e, r, s, n, i, o) { this.id = e, this.identifier = r, this.identifierType = s, this.createdAt = n, this.updatedAt = i, this.instanceId = o; }
|
|
1120
|
-
static fromJSON(e) { return new
|
|
1121
|
-
},
|
|
1111
|
+
static fromJSON(e) { return new ks(e.id, e.identifier, e.identifier_type, e.created_at, e.updated_at, e.instance_id); }
|
|
1112
|
+
}, pa = class _s {
|
|
1122
1113
|
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.isMobile = r, this.ipAddress = s, this.city = n, this.country = i, this.browserVersion = o, this.browserName = a, this.deviceType = c; }
|
|
1123
|
-
static fromJSON(e) { return new
|
|
1124
|
-
},
|
|
1114
|
+
static fromJSON(e) { return new _s(e.id, e.is_mobile, e.ip_address, e.city, e.country, e.browser_version, e.browser_name, e.device_type); }
|
|
1115
|
+
}, vs = class Ss {
|
|
1125
1116
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E = null) { this.id = e, this.clientId = r, this.userId = s, this.status = n, this.lastActiveAt = i, this.expireAt = o, this.abandonAt = a, this.createdAt = c, this.updatedAt = d, this.lastActiveOrganizationId = f, this.latestActivity = p, this.actor = E; }
|
|
1126
|
-
static fromJSON(e) { return new
|
|
1127
|
-
},
|
|
1117
|
+
static fromJSON(e) { return new Ss(e.id, e.client_id, e.user_id, e.status, e.last_active_at, e.expire_at, e.abandon_at, e.created_at, e.updated_at, e.last_active_organization_id, e.latest_activity && pa.fromJSON(e.latest_activity), e.actor); }
|
|
1118
|
+
}, ma = class Ts {
|
|
1128
1119
|
constructor(e, r, s, n, i, o, a, c, d) { this.id = e, this.sessionIds = r, this.sessions = s, this.signInId = n, this.signUpId = i, this.lastActiveSessionId = o, this.lastAuthenticationStrategy = a, this.createdAt = c, this.updatedAt = d; }
|
|
1129
|
-
static fromJSON(e) { return new
|
|
1130
|
-
},
|
|
1120
|
+
static fromJSON(e) { return new Ts(e.id, e.session_ids, e.sessions.map(r => vs.fromJSON(r)), e.sign_in_id, e.sign_up_id, e.last_active_session_id, e.last_authentication_strategy, e.created_at, e.updated_at); }
|
|
1121
|
+
}, ya = class bs {
|
|
1131
1122
|
constructor(e, r, s) { this.host = e, this.value = r, this.required = s; }
|
|
1132
|
-
static fromJSON(e) { return new
|
|
1133
|
-
},
|
|
1123
|
+
static fromJSON(e) { return new bs(e.host, e.value, e.required); }
|
|
1124
|
+
}, ga = class Es {
|
|
1134
1125
|
constructor(e) { this.cookies = e; }
|
|
1135
|
-
static fromJSON(e) { return new
|
|
1136
|
-
},
|
|
1126
|
+
static fromJSON(e) { return new Es(e.cookies); }
|
|
1127
|
+
}, ka = class ws {
|
|
1137
1128
|
constructor(e, r, s, n) { this.object = e, this.id = r, this.slug = s, this.deleted = n; }
|
|
1138
|
-
static fromJSON(e) { return new
|
|
1139
|
-
},
|
|
1129
|
+
static fromJSON(e) { return new ws(e.object, e.id || null, e.slug || null, e.deleted); }
|
|
1130
|
+
}, _a = class As {
|
|
1140
1131
|
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.name = r, this.isSatellite = s, this.frontendApiUrl = n, this.developmentOrigin = i, this.cnameTargets = o, this.accountsPortalUrl = a, this.proxyUrl = c; }
|
|
1141
|
-
static fromJSON(e) { return new
|
|
1142
|
-
},
|
|
1132
|
+
static fromJSON(e) { return new As(e.id, e.name, e.is_satellite, e.frontend_api_url, e.development_origin, e.cname_targets && e.cname_targets.map(r => ya.fromJSON(r)), e.accounts_portal_url, e.proxy_url); }
|
|
1133
|
+
}, va = class Ps {
|
|
1143
1134
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E) { this.id = e, this.fromEmailName = r, this.emailAddressId = s, this.toEmailAddress = n, this.subject = i, this.body = o, this.bodyPlain = a, this.status = c, this.slug = d, this.data = f, this.deliveredByClerk = p, this.userId = E; }
|
|
1144
|
-
static fromJSON(e) { return new
|
|
1145
|
-
},
|
|
1135
|
+
static fromJSON(e) { return new Ps(e.id, e.from_email_name, e.email_address_id, e.to_email_address, e.subject, e.body, e.body_plain, e.status, e.slug, e.data, e.delivered_by_clerk, e.user_id); }
|
|
1136
|
+
}, Is = class Os {
|
|
1146
1137
|
constructor(e, r) { this.id = e, this.type = r; }
|
|
1147
|
-
static fromJSON(e) { return new
|
|
1148
|
-
}, be = class
|
|
1138
|
+
static fromJSON(e) { return new Os(e.id, e.type); }
|
|
1139
|
+
}, be = class Cs {
|
|
1149
1140
|
constructor(e, r, s = null, n = null, i = null, o = null, a = null) { this.status = e, this.strategy = r, this.externalVerificationRedirectURL = s, this.attempts = n, this.expireAt = i, this.nonce = o, this.message = a; }
|
|
1150
|
-
static fromJSON(e) { return new
|
|
1151
|
-
},
|
|
1141
|
+
static fromJSON(e) { return new Cs(e.status, e.strategy, e.external_verification_redirect_url ? new URL(e.external_verification_redirect_url) : null, e.attempts, e.expire_at, e.nonce); }
|
|
1142
|
+
}, xs = class Us {
|
|
1152
1143
|
constructor(e, r, s, n) { this.id = e, this.emailAddress = r, this.verification = s, this.linkedTo = n; }
|
|
1153
|
-
static fromJSON(e) { return new
|
|
1154
|
-
},
|
|
1144
|
+
static fromJSON(e) { return new Us(e.id, e.email_address, e.verification && be.fromJSON(e.verification), e.linked_to.map(r => Is.fromJSON(r))); }
|
|
1145
|
+
}, Rs = class qs {
|
|
1155
1146
|
constructor(e, r, s, n, i) { this.id = e, this.name = r, this.description = s, this.slug = n, this.avatarUrl = i; }
|
|
1156
|
-
static fromJSON(e) { return new
|
|
1157
|
-
},
|
|
1147
|
+
static fromJSON(e) { return new qs(e.id, e.name, e.description ?? null, e.slug, e.avatar_url ?? null); }
|
|
1148
|
+
}, Ms = class Ns {
|
|
1158
1149
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x) { this.id = e, this.name = r, this.slug = s, this.description = n, this.isDefault = i, this.isRecurring = o, this.hasBaseFee = a, this.publiclyVisible = c, this.fee = d, this.annualFee = f, this.annualMonthlyFee = p, this.forPayerType = E, this.features = S, this.avatarUrl = A, this.freeTrialDays = P, this.freeTrialEnabled = x; }
|
|
1159
|
-
static fromJSON(e) { let r = s => s ? { amount: s.amount, amountFormatted: s.amount_formatted, currency: s.currency, currencySymbol: s.currency_symbol } : null; return new
|
|
1160
|
-
},
|
|
1150
|
+
static fromJSON(e) { let r = s => s ? { amount: s.amount, amountFormatted: s.amount_formatted, currency: s.currency, currencySymbol: s.currency_symbol } : null; return new Ns(e.id, e.name, e.slug, e.description ?? null, e.is_default, e.is_recurring, e.has_base_fee, e.publicly_visible, r(e.fee), r(e.annual_fee), r(e.annual_monthly_fee), e.for_payer_type, (e.features ?? []).map(s => Rs.fromJSON(s)), e.avatar_url, e.free_trial_days, e.free_trial_enabled); }
|
|
1151
|
+
}, Js = class Ls {
|
|
1161
1152
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x, l) { this.id = e, this.status = r, this.planPeriod = s, this.periodStart = n, this.nextPayment = i, this.amount = o, this.plan = a, this.planId = c, this.createdAt = d, this.updatedAt = f, this.periodEnd = p, this.canceledAt = E, this.pastDueAt = S, this.endedAt = A, this.payerId = P, this.isFreeTrial = x, this.lifetimePaid = l; }
|
|
1162
|
-
static fromJSON(e) { function r(s) { return s && { amount: s.amount, amountFormatted: s.amount_formatted, currency: s.currency, currencySymbol: s.currency_symbol }; } return new
|
|
1163
|
-
},
|
|
1153
|
+
static fromJSON(e) { function r(s) { return s && { amount: s.amount, amountFormatted: s.amount_formatted, currency: s.currency, currencySymbol: s.currency_symbol }; } return new Ls(e.id, e.status, e.plan_period, e.period_start, e.next_payment, r(e.amount) ?? void 0, e.plan ? Ms.fromJSON(e.plan) : null, e.plan_id ?? null, e.created_at, e.updated_at, e.period_end, e.canceled_at, e.past_due_at, e.ended_at, e.payer_id, e.is_free_trial, r(e.lifetime_paid) ?? void 0); }
|
|
1154
|
+
}, Sa = class Ds {
|
|
1164
1155
|
constructor(e, r, s, n, i, o, a, c, d, f) { this.id = e, this.status = r, this.payerId = s, this.createdAt = n, this.updatedAt = i, this.activeAt = o, this.pastDueAt = a, this.subscriptionItems = c, this.nextPayment = d, this.eligibleForFreeTrial = f; }
|
|
1165
|
-
static fromJSON(e) { let r = e.next_payment ? { date: e.next_payment.date, amount: { amount: e.next_payment.amount.amount, amountFormatted: e.next_payment.amount.amount_formatted, currency: e.next_payment.amount.currency, currencySymbol: e.next_payment.amount.currency_symbol } } : null; return new
|
|
1166
|
-
},
|
|
1156
|
+
static fromJSON(e) { let r = e.next_payment ? { date: e.next_payment.date, amount: { amount: e.next_payment.amount.amount, amountFormatted: e.next_payment.amount.amount_formatted, currency: e.next_payment.amount.currency, currencySymbol: e.next_payment.amount.currency_symbol } } : null; return new Ds(e.id, e.status, e.payer_id, e.created_at, e.updated_at, e.active_at ?? null, e.past_due_at ?? null, (e.subscription_items ?? []).map(s => Js.fromJSON(s)), r, e.eligible_for_free_trial ?? !1); }
|
|
1157
|
+
}, Ta = class Fs {
|
|
1167
1158
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S) { this.id = e, this.active = r, this.allowIdpInitiated = s, this.allowSubdomains = n, this.disableAdditionalIdentifications = i, this.domain = o, this.logoPublicUrl = a, this.name = c, this.protocol = d, this.provider = f, this.syncUserAttributes = p, this.createdAt = E, this.updatedAt = S; }
|
|
1168
|
-
static fromJSON(e) { return new
|
|
1169
|
-
},
|
|
1159
|
+
static fromJSON(e) { return new Fs(e.id, e.active, e.allow_idp_initiated, e.allow_subdomains, e.disable_additional_identifications, e.domain, e.logo_public_url, e.name, e.protocol, e.provider, e.sync_user_attributes, e.created_at, e.updated_at); }
|
|
1160
|
+
}, Ks = class Hs {
|
|
1170
1161
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S) { this.id = e, this.active = r, this.emailAddress = s, this.enterpriseConnection = n, this.firstName = i, this.lastName = o, this.protocol = a, this.provider = c, this.providerUserId = d, this.publicMetadata = f, this.verification = p, this.lastAuthenticatedAt = E, this.enterpriseConnectionId = S; }
|
|
1171
|
-
static fromJSON(e) { return new
|
|
1172
|
-
},
|
|
1162
|
+
static fromJSON(e) { return new Hs(e.id, e.active, e.email_address, e.enterprise_connection && Ta.fromJSON(e.enterprise_connection), e.first_name, e.last_name, e.protocol, e.provider, e.provider_user_id, e.public_metadata, e.verification && be.fromJSON(e.verification), e.last_authenticated_at, e.enterprise_connection_id); }
|
|
1163
|
+
}, ba = class zs {
|
|
1173
1164
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P) { this.id = e, this.name = r, this.idpEntityId = s, this.idpSsoUrl = n, this.idpCertificate = i, this.idpCertificateIssuedAt = o, this.idpCertificateExpiresAt = a, this.idpMetadataUrl = c, this.idpMetadata = d, this.acsUrl = f, this.spEntityId = p, this.spMetadataUrl = E, this.syncUserAttributes = S, this.allowSubdomains = A, this.allowIdpInitiated = P; }
|
|
1174
|
-
static fromJSON(e) { return new
|
|
1175
|
-
},
|
|
1165
|
+
static fromJSON(e) { return new zs(e.id, e.name, e.idp_entity_id, e.idp_sso_url, e.idp_certificate, e.idp_certificate_issued_at, e.idp_certificate_expires_at, e.idp_metadata_url, e.idp_metadata, e.acs_url, e.sp_entity_id, e.sp_metadata_url, e.sync_user_attributes, e.allow_subdomains, e.allow_idp_initiated); }
|
|
1166
|
+
}, Ea = class Ws {
|
|
1176
1167
|
constructor(e, r, s, n, i, o, a) { this.id = e, this.name = r, this.clientId = s, this.discoveryUrl = n, this.logoPublicUrl = i, this.createdAt = o, this.updatedAt = a; }
|
|
1177
|
-
static fromJSON(e) { return new
|
|
1178
|
-
},
|
|
1168
|
+
static fromJSON(e) { return new Ws(e.id, e.name, e.client_id, e.discovery_url, e.logo_public_url, e.created_at, e.updated_at); }
|
|
1169
|
+
}, wa = class Bs {
|
|
1179
1170
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E) { this.id = e, this.name = r, this.domains = s, this.organizationId = n, this.active = i, this.syncUserAttributes = o, this.allowSubdomains = a, this.disableAdditionalIdentifications = c, this.createdAt = d, this.updatedAt = f, this.samlConnection = p, this.oauthConfig = E; }
|
|
1180
|
-
static fromJSON(e) { return new
|
|
1181
|
-
},
|
|
1171
|
+
static fromJSON(e) { return new Bs(e.id, e.name, e.domains, e.organization_id, e.active, e.sync_user_attributes, e.allow_subdomains, e.disable_additional_identifications, e.created_at, e.updated_at, e.saml_connection != null ? ba.fromJSON(e.saml_connection) : null, e.oauth_config != null ? Ea.fromJSON(e.oauth_config) : null); }
|
|
1172
|
+
}, Aa = class js {
|
|
1182
1173
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S = {}, A, P, x) { this.id = e, this.provider = r, this.providerUserId = s, this.identificationId = n, this.externalId = i, this.approvedScopes = o, this.emailAddress = a, this.firstName = c, this.lastName = d, this.imageUrl = f, this.username = p, this.phoneNumber = E, this.publicMetadata = S, this.label = A, this.verification = P, this.externalAccountId = x; }
|
|
1183
|
-
static fromJSON(e) { return new
|
|
1184
|
-
},
|
|
1174
|
+
static fromJSON(e) { return new js(e.id, e.provider, e.provider_user_id, e.identification_id, e.provider_user_id, e.approved_scopes, e.email_address, e.first_name, e.last_name, e.image_url || "", e.username, e.phone_number, e.public_metadata, e.label, e.verification && be.fromJSON(e.verification), e.external_account_id); }
|
|
1175
|
+
}, Pa = class Vs {
|
|
1185
1176
|
constructor(e, r, s) { this.id = e, this.environmentType = r, this.allowedOrigins = s; }
|
|
1186
|
-
static fromJSON(e) { return new
|
|
1187
|
-
},
|
|
1177
|
+
static fromJSON(e) { return new Vs(e.id, e.environment_type, e.allowed_origins); }
|
|
1178
|
+
}, Ia = class $s {
|
|
1188
1179
|
constructor(e, r, s, n, i) { this.allowlist = e, this.blocklist = r, this.blockEmailSubaddresses = s, this.blockDisposableEmailDomains = n, this.ignoreDotsForGmailAddresses = i; }
|
|
1189
|
-
static fromJSON(e) { return new
|
|
1190
|
-
},
|
|
1180
|
+
static fromJSON(e) { return new $s(e.allowlist, e.blocklist, e.block_email_subaddresses, e.block_disposable_email_domains, e.ignore_dots_for_gmail_addresses); }
|
|
1181
|
+
}, Oa = class Gs {
|
|
1191
1182
|
constructor(e, r, s, n, i) { this.id = e, this.restrictedToAllowlist = r, this.fromEmailAddress = s, this.progressiveSignUp = n, this.enhancedEmailDeliverability = i; }
|
|
1192
|
-
static fromJSON(e) { return new
|
|
1193
|
-
},
|
|
1183
|
+
static fromJSON(e) { return new Gs(e.id, e.restricted_to_allowlist, e.from_email_address, e.progressive_sign_up, e.enhanced_email_deliverability); }
|
|
1184
|
+
}, Qs = class Ys {
|
|
1194
1185
|
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.emailAddress = r, this.publicMetadata = s, this.createdAt = n, this.updatedAt = i, this.status = o, this.url = a, this.revoked = c, this._raw = null; }
|
|
1195
1186
|
get raw() { return this._raw; }
|
|
1196
|
-
static fromJSON(e) { let r = new
|
|
1197
|
-
}, w = { AccountlessApplication: "accountless_application", ActorToken: "actor_token", AgentTask: "agent_task", AllowlistIdentifier: "allowlist_identifier", ApiKey: "api_key", BlocklistIdentifier: "blocklist_identifier", Client: "client", Cookies: "cookies", Domain: "domain", Email: "email", EnterpriseAccount: "enterprise_account", EnterpriseConnection: "enterprise_connection", EmailAddress: "email_address", ExternalAccount: "external_account", FacebookAccount: "facebook_account", GoogleAccount: "google_account", Instance: "instance", InstanceRestrictions: "instance_restrictions", InstanceSettings: "instance_settings", Invitation: "invitation", Machine: "machine", MachineScope: "machine_scope", MachineSecretKey: "machine_secret_key", M2MToken: "machine_to_machine_token", JwtTemplate: "jwt_template", OauthAccessToken: "oauth_access_token", IdpOAuthAccessToken: "clerk_idp_oauth_access_token", OAuthApplication: "oauth_application", Organization: "organization", OrganizationDomain: "organization_domain", OrganizationInvitation: "organization_invitation", OrganizationMembership: "organization_membership", OrganizationSettings: "organization_settings", PhoneNumber: "phone_number", ProxyCheck: "proxy_check", RedirectUrl: "redirect_url", SamlConnection: "saml_connection", Session: "session", SignInAttempt: "sign_in_attempt", SignInToken: "sign_in_token", SignUpAttempt: "sign_up_attempt", SmsMessage: "sms_message", User: "user", WaitlistEntry: "waitlist_entry", Web3Wallet: "web3_wallet", Token: "token", TotalCount: "total_count", TestingToken: "testing_token", Role: "role", RoleSet: "role_set", RoleSetItem: "role_set_item", RoleSetMigration: "role_set_migration", Permission: "permission", BillingPayer: "commerce_payer", BillingPaymentAttempt: "commerce_payment_attempt", BillingSubscription: "commerce_subscription", BillingSubscriptionItem: "commerce_subscription_item", BillingPlan: "commerce_plan", Feature: "feature" },
|
|
1187
|
+
static fromJSON(e) { let r = new Ys(e.id, e.email_address, e.public_metadata, e.created_at, e.updated_at, e.status, e.url, e.revoked); return r._raw = e, r; }
|
|
1188
|
+
}, w = { AccountlessApplication: "accountless_application", ActorToken: "actor_token", AgentTask: "agent_task", AllowlistIdentifier: "allowlist_identifier", ApiKey: "api_key", BlocklistIdentifier: "blocklist_identifier", Client: "client", Cookies: "cookies", Domain: "domain", Email: "email", EnterpriseAccount: "enterprise_account", EnterpriseConnection: "enterprise_connection", EmailAddress: "email_address", ExternalAccount: "external_account", FacebookAccount: "facebook_account", GoogleAccount: "google_account", Instance: "instance", InstanceRestrictions: "instance_restrictions", InstanceSettings: "instance_settings", Invitation: "invitation", Machine: "machine", MachineScope: "machine_scope", MachineSecretKey: "machine_secret_key", M2MToken: "machine_to_machine_token", JwtTemplate: "jwt_template", OauthAccessToken: "oauth_access_token", IdpOAuthAccessToken: "clerk_idp_oauth_access_token", OAuthApplication: "oauth_application", Organization: "organization", OrganizationDomain: "organization_domain", OrganizationInvitation: "organization_invitation", OrganizationMembership: "organization_membership", OrganizationSettings: "organization_settings", PhoneNumber: "phone_number", ProxyCheck: "proxy_check", RedirectUrl: "redirect_url", SamlConnection: "saml_connection", Session: "session", SignInAttempt: "sign_in_attempt", SignInToken: "sign_in_token", SignUpAttempt: "sign_up_attempt", SmsMessage: "sms_message", User: "user", WaitlistEntry: "waitlist_entry", Web3Wallet: "web3_wallet", Token: "token", TotalCount: "total_count", TestingToken: "testing_token", Role: "role", RoleSet: "role_set", RoleSetItem: "role_set_item", RoleSetMigration: "role_set_migration", Permission: "permission", BillingPayer: "commerce_payer", BillingPaymentAttempt: "commerce_payment_attempt", BillingSubscription: "commerce_subscription", BillingSubscriptionItem: "commerce_subscription_item", BillingPlan: "commerce_plan", Feature: "feature" }, Ca = class Xs {
|
|
1198
1189
|
constructor(e, r, s, n, i, o, a, c, d) { this.id = e, this.name = r, this.claims = s, this.lifetime = n, this.allowedClockSkew = i, this.customSigningKey = o, this.signingAlgorithm = a, this.createdAt = c, this.updatedAt = d; }
|
|
1199
|
-
static fromJSON(e) { return new
|
|
1200
|
-
},
|
|
1190
|
+
static fromJSON(e) { return new Xs(e.id, e.name, e.claims, e.lifetime, e.allowed_clock_skew, e.custom_signing_key, e.signing_algorithm, e.created_at, e.updated_at); }
|
|
1191
|
+
}, xa = class wt {
|
|
1201
1192
|
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.name = r, this.instanceId = s, this.createdAt = n, this.updatedAt = i, this.scopedMachines = o, this.defaultTokenTtl = a, this.secretKey = c; }
|
|
1202
|
-
static fromJSON(e) { return new
|
|
1203
|
-
},
|
|
1193
|
+
static fromJSON(e) { return new wt(e.id, e.name, e.instance_id, e.created_at, e.updated_at, e.scoped_machines.map(r => new wt(r.id, r.name, r.instance_id, r.created_at, r.updated_at, [], r.default_token_ttl)), e.default_token_ttl, e.secret_key); }
|
|
1194
|
+
}, Ua = class Zs {
|
|
1204
1195
|
constructor(e, r, s, n) { this.fromMachineId = e, this.toMachineId = r, this.createdAt = s, this.deleted = n; }
|
|
1205
|
-
static fromJSON(e) { return new
|
|
1206
|
-
},
|
|
1196
|
+
static fromJSON(e) { return new Zs(e.from_machine_id, e.to_machine_id, e.created_at, e.deleted); }
|
|
1197
|
+
}, Ra = class en {
|
|
1207
1198
|
constructor(e) { this.secret = e; }
|
|
1208
|
-
static fromJSON(e) { return new
|
|
1209
|
-
},
|
|
1199
|
+
static fromJSON(e) { return new en(e.secret); }
|
|
1200
|
+
}, qa = class tn {
|
|
1210
1201
|
constructor(e, r, s, n = {}, i, o, a, c, d) { this.externalAccountId = e, this.provider = r, this.token = s, this.publicMetadata = n, this.label = i, this.scopes = o, this.tokenSecret = a, this.expiresAt = c, this.idToken = d; }
|
|
1211
|
-
static fromJSON(e) { return new
|
|
1212
|
-
},
|
|
1202
|
+
static fromJSON(e) { return new tn(e.external_account_id, e.provider, e.token, e.public_metadata, e.label || "", e.scopes, e.token_secret, e.expires_at, e.id_token); }
|
|
1203
|
+
}, Ma = class rn {
|
|
1213
1204
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x, l, y, m, h) { this.id = e, this.instanceId = r, this.name = s, this.clientId = n, this.clientUri = i, this.clientImageUrl = o, this.dynamicallyRegistered = a, this.consentScreenEnabled = c, this.pkceRequired = d, this.isPublic = f, this.scopes = p, this.redirectUris = E, this.authorizeUrl = S, this.tokenFetchUrl = A, this.userInfoUrl = P, this.discoveryUrl = x, this.tokenIntrospectionUrl = l, this.createdAt = y, this.updatedAt = m, this.clientSecret = h; }
|
|
1214
|
-
static fromJSON(e) { return new
|
|
1215
|
-
},
|
|
1205
|
+
static fromJSON(e) { return new rn(e.id, e.instance_id, e.name, e.client_id, e.client_uri, e.client_image_url, e.dynamically_registered, e.consent_screen_enabled, e.pkce_required, e.public, e.scopes, e.redirect_uris, e.authorize_url, e.token_fetch_url, e.user_info_url, e.discovery_url, e.token_introspection_url, e.created_at, e.updated_at, e.client_secret); }
|
|
1206
|
+
}, sn = class nn {
|
|
1216
1207
|
constructor(e, r, s, n, i, o, a, c = {}, d = {}, f, p, E, S) { this.id = e, this.name = r, this.slug = s, this.imageUrl = n, this.hasImage = i, this.createdAt = o, this.updatedAt = a, this.publicMetadata = c, this.privateMetadata = d, this.maxAllowedMemberships = f, this.adminDeleteEnabled = p, this.membersCount = E, this.createdBy = S, this._raw = null; }
|
|
1217
1208
|
get raw() { return this._raw; }
|
|
1218
|
-
static fromJSON(e) { let r = new
|
|
1219
|
-
},
|
|
1209
|
+
static fromJSON(e) { let r = new nn(e.id, e.name, e.slug, e.image_url || "", e.has_image, e.created_at, e.updated_at, e.public_metadata, e.private_metadata, e.max_allowed_memberships, e.admin_delete_enabled, e.members_count, e.created_by); return r._raw = e, r; }
|
|
1210
|
+
}, Na = class on {
|
|
1220
1211
|
constructor(e, r, s, n, i, o, a, c, d, f, p = {}, E = {}, S) { this.id = e, this.emailAddress = r, this.role = s, this.roleName = n, this.organizationId = i, this.createdAt = o, this.updatedAt = a, this.expiresAt = c, this.url = d, this.status = f, this.publicMetadata = p, this.privateMetadata = E, this.publicOrganizationData = S, this._raw = null; }
|
|
1221
1212
|
get raw() { return this._raw; }
|
|
1222
|
-
static fromJSON(e) { let r = new
|
|
1223
|
-
},
|
|
1213
|
+
static fromJSON(e) { let r = new on(e.id, e.email_address, e.role, e.role_name, e.organization_id, e.created_at, e.updated_at, e.expires_at, e.url, e.status, e.public_metadata, e.private_metadata, e.public_organization_data); return r._raw = e, r; }
|
|
1214
|
+
}, Ja = class an {
|
|
1224
1215
|
constructor(e, r, s, n = {}, i = {}, o, a, c, d) { this.id = e, this.role = r, this.permissions = s, this.publicMetadata = n, this.privateMetadata = i, this.createdAt = o, this.updatedAt = a, this.organization = c, this.publicUserData = d, this._raw = null; }
|
|
1225
1216
|
get raw() { return this._raw; }
|
|
1226
|
-
static fromJSON(e) { let r = new
|
|
1227
|
-
},
|
|
1217
|
+
static fromJSON(e) { let r = new an(e.id, e.role, e.permissions, e.public_metadata, e.private_metadata, e.created_at, e.updated_at, sn.fromJSON(e.organization), La.fromJSON(e.public_user_data)); return r._raw = e, r; }
|
|
1218
|
+
}, La = class cn {
|
|
1228
1219
|
constructor(e, r, s, n, i, o) { this.identifier = e, this.firstName = r, this.lastName = s, this.imageUrl = n, this.hasImage = i, this.userId = o; }
|
|
1229
|
-
static fromJSON(e) { return new
|
|
1230
|
-
},
|
|
1220
|
+
static fromJSON(e) { return new cn(e.identifier, e.first_name, e.last_name, e.image_url, e.has_image, e.user_id); }
|
|
1221
|
+
}, Da = class un {
|
|
1231
1222
|
constructor(e, r, s, n, i, o, a, c, d, f) { this.enabled = e, this.maxAllowedMemberships = r, this.maxAllowedRoles = s, this.maxAllowedPermissions = n, this.creatorRole = i, this.adminDeleteEnabled = o, this.domainsEnabled = a, this.slugDisabled = c, this.domainsEnrollmentModes = d, this.domainsDefaultRole = f; }
|
|
1232
|
-
static fromJSON(e) { return new
|
|
1233
|
-
},
|
|
1223
|
+
static fromJSON(e) { return new un(e.enabled, e.max_allowed_memberships, e.max_allowed_roles, e.max_allowed_permissions, e.creator_role, e.admin_delete_enabled, e.domains_enabled, e.slug_disabled, e.domains_enrollment_modes, e.domains_default_role); }
|
|
1224
|
+
}, ln = class hn {
|
|
1234
1225
|
constructor(e, r, s, n, i, o) { this.id = e, this.name = r, this.key = s, this.description = n, this.createdAt = i, this.updatedAt = o; }
|
|
1235
|
-
static fromJSON(e) { return new
|
|
1236
|
-
},
|
|
1226
|
+
static fromJSON(e) { return new hn(e.id, e.name, e.key, e.description, e.created_at, e.updated_at); }
|
|
1227
|
+
}, dn = class fn {
|
|
1237
1228
|
constructor(e, r, s, n, i, o) { this.id = e, this.phoneNumber = r, this.reservedForSecondFactor = s, this.defaultSecondFactor = n, this.verification = i, this.linkedTo = o; }
|
|
1238
|
-
static fromJSON(e) { return new
|
|
1239
|
-
},
|
|
1229
|
+
static fromJSON(e) { return new fn(e.id, e.phone_number, e.reserved_for_second_factor, e.default_second_factor, e.verification && be.fromJSON(e.verification), e.linked_to.map(r => Is.fromJSON(r))); }
|
|
1230
|
+
}, Fa = class pn {
|
|
1240
1231
|
constructor(e, r, s, n, i, o, a) { this.id = e, this.domainId = r, this.lastRunAt = s, this.proxyUrl = n, this.successful = i, this.createdAt = o, this.updatedAt = a; }
|
|
1241
|
-
static fromJSON(e) { return new
|
|
1242
|
-
},
|
|
1232
|
+
static fromJSON(e) { return new pn(e.id, e.domain_id, e.last_run_at, e.proxy_url, e.successful, e.created_at, e.updated_at); }
|
|
1233
|
+
}, Ka = class mn {
|
|
1243
1234
|
constructor(e, r, s, n) { this.id = e, this.url = r, this.createdAt = s, this.updatedAt = n; }
|
|
1244
|
-
static fromJSON(e) { return new
|
|
1245
|
-
},
|
|
1235
|
+
static fromJSON(e) { return new mn(e.id, e.url, e.created_at, e.updated_at); }
|
|
1236
|
+
}, Ha = class yn {
|
|
1246
1237
|
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.name = r, this.key = s, this.description = n, this.permissions = i, this.isCreatorEligible = o, this.createdAt = a, this.updatedAt = c; }
|
|
1247
|
-
static fromJSON(e) { return new
|
|
1248
|
-
},
|
|
1238
|
+
static fromJSON(e) { return new yn(e.id, e.name, e.key, e.description, (e.permissions ?? []).map(r => ln.fromJSON(r)), e.is_creator_eligible, e.created_at, e.updated_at); }
|
|
1239
|
+
}, pt = class gn {
|
|
1249
1240
|
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.name = r, this.key = s, this.description = n, this.createdAt = i, this.updatedAt = o, this.membersCount = a, this.hasMembers = c; }
|
|
1250
|
-
static fromJSON(e) { return new
|
|
1251
|
-
},
|
|
1241
|
+
static fromJSON(e) { return new gn(e.id, e.name, e.key, e.description, e.created_at, e.updated_at, e.members_count, e.has_members); }
|
|
1242
|
+
}, za = class kn {
|
|
1252
1243
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S) { this.id = e, this.organizationId = r, this.instanceId = s, this.sourceRoleSetId = n, this.destRoleSetId = i, this.triggerType = o, this.status = a, this.migratedMembers = c, this.mappings = d, this.createdAt = f, this.updatedAt = p, this.startedAt = E, this.completedAt = S; }
|
|
1253
|
-
static fromJSON(e) { return new
|
|
1254
|
-
},
|
|
1244
|
+
static fromJSON(e) { return new kn(e.id, e.organization_id, e.instance_id, e.source_role_set_id, e.dest_role_set_id, e.trigger_type, e.status, e.migrated_members, e.mappings, e.created_at, e.updated_at, e.started_at, e.completed_at); }
|
|
1245
|
+
}, Wa = class _n {
|
|
1255
1246
|
constructor(e, r, s, n, i, o, a, c, d, f, p) { this.id = e, this.name = r, this.key = s, this.description = n, this.roles = i, this.defaultRole = o, this.creatorRole = a, this.type = c, this.roleSetMigration = d, this.createdAt = f, this.updatedAt = p; }
|
|
1256
|
-
static fromJSON(e) { return new
|
|
1257
|
-
},
|
|
1247
|
+
static fromJSON(e) { return new _n(e.id, e.name, e.key, e.description, (e.roles ?? []).map(r => pt.fromJSON(r)), e.default_role ? pt.fromJSON(e.default_role) : null, e.creator_role ? pt.fromJSON(e.creator_role) : null, e.type, e.role_set_migration ? za.fromJSON(e.role_set_migration) : null, e.created_at, e.updated_at); }
|
|
1248
|
+
}, Ba = class vn {
|
|
1258
1249
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x, l, y, m, h, g, k, T) { this.id = e, this.name = r, this.domain = s, this.organizationId = n, this.idpEntityId = i, this.idpSsoUrl = o, this.idpCertificate = a, this.idpCertificateIssuedAt = c, this.idpCertificateExpiresAt = d, this.idpMetadataUrl = f, this.idpMetadata = p, this.acsUrl = E, this.spEntityId = S, this.spMetadataUrl = A, this.active = P, this.provider = x, this.userCount = l, this.syncUserAttributes = y, this.allowSubdomains = m, this.allowIdpInitiated = h, this.createdAt = g, this.updatedAt = k, this.attributeMapping = T; }
|
|
1259
|
-
static fromJSON(e) { return new
|
|
1260
|
-
},
|
|
1250
|
+
static fromJSON(e) { return new vn(e.id, e.name, e.domain, e.organization_id, e.idp_entity_id, e.idp_sso_url, e.idp_certificate, e.idp_certificate_issued_at, e.idp_certificate_expires_at, e.idp_metadata_url, e.idp_metadata, e.acs_url, e.sp_entity_id, e.sp_metadata_url, e.active, e.provider, e.user_count, e.sync_user_attributes, e.allow_subdomains, e.allow_idp_initiated, e.created_at, e.updated_at, e.attribute_mapping && ja.fromJSON(e.attribute_mapping)); }
|
|
1251
|
+
}, ja = class Sn {
|
|
1261
1252
|
constructor(e, r, s, n) { this.userId = e, this.emailAddress = r, this.firstName = s, this.lastName = n; }
|
|
1262
|
-
static fromJSON(e) { return new
|
|
1263
|
-
},
|
|
1253
|
+
static fromJSON(e) { return new Sn(e.user_id, e.email_address, e.first_name, e.last_name); }
|
|
1254
|
+
}, Va = class Tn {
|
|
1264
1255
|
constructor(e, r, s, n, i, o, a) { this.id = e, this.userId = r, this.token = s, this.status = n, this.url = i, this.createdAt = o, this.updatedAt = a; }
|
|
1265
|
-
static fromJSON(e) { return new
|
|
1266
|
-
},
|
|
1256
|
+
static fromJSON(e) { return new Tn(e.id, e.user_id, e.token, e.status, e.url, e.created_at, e.updated_at); }
|
|
1257
|
+
}, mt = class bn {
|
|
1267
1258
|
constructor(e, r) { this.nextAction = e, this.supportedStrategies = r; }
|
|
1268
|
-
static fromJSON(e) { return new
|
|
1269
|
-
},
|
|
1259
|
+
static fromJSON(e) { return new bn(e.next_action, e.supported_strategies); }
|
|
1260
|
+
}, $a = class En {
|
|
1270
1261
|
constructor(e, r, s, n) { this.emailAddress = e, this.phoneNumber = r, this.web3Wallet = s, this.externalAccount = n; }
|
|
1271
|
-
static fromJSON(e) { return new
|
|
1272
|
-
},
|
|
1262
|
+
static fromJSON(e) { return new En(e.email_address && mt.fromJSON(e.email_address), e.phone_number && mt.fromJSON(e.phone_number), e.web3_wallet && mt.fromJSON(e.web3_wallet), e.external_account); }
|
|
1263
|
+
}, Ga = class wn {
|
|
1273
1264
|
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x, l, y, m, h, g, k) { this.id = e, this.status = r, this.requiredFields = s, this.optionalFields = n, this.missingFields = i, this.unverifiedFields = o, this.verifications = a, this.username = c, this.emailAddress = d, this.phoneNumber = f, this.web3Wallet = p, this.passwordEnabled = E, this.firstName = S, this.lastName = A, this.customAction = P, this.externalId = x, this.createdSessionId = l, this.createdUserId = y, this.abandonAt = m, this.legalAcceptedAt = h, this.publicMetadata = g, this.unsafeMetadata = k; }
|
|
1274
|
-
static fromJSON(e) { return new
|
|
1275
|
-
},
|
|
1265
|
+
static fromJSON(e) { return new wn(e.id, e.status, e.required_fields, e.optional_fields, e.missing_fields, e.unverified_fields, e.verifications ? $a.fromJSON(e.verifications) : null, e.username, e.email_address, e.phone_number, e.web3_wallet, e.password_enabled, e.first_name, e.last_name, e.custom_action, e.external_id, e.created_session_id, e.created_user_id, e.abandon_at, e.legal_accepted_at, e.public_metadata, e.unsafe_metadata); }
|
|
1266
|
+
}, Qa = class An {
|
|
1276
1267
|
constructor(e, r, s, n, i, o, a) { this.id = e, this.fromPhoneNumber = r, this.toPhoneNumber = s, this.message = n, this.status = i, this.phoneNumberId = o, this.data = a; }
|
|
1277
|
-
static fromJSON(e) { return new
|
|
1278
|
-
},
|
|
1268
|
+
static fromJSON(e) { return new An(e.id, e.from_phone_number, e.to_phone_number, e.message, e.status, e.phone_number_id, e.data); }
|
|
1269
|
+
}, Ya = class Pn {
|
|
1279
1270
|
constructor(e) { this.jwt = e; }
|
|
1280
|
-
static fromJSON(e) { return new
|
|
1281
|
-
},
|
|
1271
|
+
static fromJSON(e) { return new Pn(e.jwt); }
|
|
1272
|
+
}, Xa = class In {
|
|
1282
1273
|
constructor(e, r, s) { this.id = e, this.web3Wallet = r, this.verification = s; }
|
|
1283
|
-
static fromJSON(e) { return new
|
|
1284
|
-
},
|
|
1285
|
-
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x, l, y, m, h = {}, g = {}, k = {}, T = [], _ = [], O = [], q = [], z = [], D, J, H = null, V,
|
|
1274
|
+
static fromJSON(e) { return new In(e.id, e.web3_wallet, e.verification && be.fromJSON(e.verification)); }
|
|
1275
|
+
}, Za = class On {
|
|
1276
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x, l, y, m, h = {}, g = {}, k = {}, T = [], _ = [], O = [], q = [], z = [], D, J, H = null, V, Lt, Ee) { this.id = e, this.passwordEnabled = r, this.totpEnabled = s, this.backupCodeEnabled = n, this.twoFactorEnabled = i, this.banned = o, this.locked = a, this.createdAt = c, this.updatedAt = d, this.imageUrl = f, this.hasImage = p, this.primaryEmailAddressId = E, this.primaryPhoneNumberId = S, this.primaryWeb3WalletId = A, this.lastSignInAt = P, this.externalId = x, this.username = l, this.firstName = y, this.lastName = m, this.publicMetadata = h, this.privateMetadata = g, this.unsafeMetadata = k, this.emailAddresses = T, this.phoneNumbers = _, this.web3Wallets = O, this.externalAccounts = q, this.enterpriseAccounts = z, this.lastActiveAt = D, this.createOrganizationEnabled = J, this.createOrganizationsLimit = H, this.deleteSelfEnabled = V, this.legalAcceptedAt = Lt, this.locale = Ee, this._raw = null; }
|
|
1286
1277
|
get raw() { return this._raw; }
|
|
1287
|
-
static fromJSON(e) { let r = new
|
|
1278
|
+
static fromJSON(e) { let r = new On(e.id, e.password_enabled, e.totp_enabled, e.backup_code_enabled, e.two_factor_enabled, e.banned, e.locked, e.created_at, e.updated_at, e.image_url, e.has_image, e.primary_email_address_id, e.primary_phone_number_id, e.primary_web3_wallet_id, e.last_sign_in_at, e.external_id, e.username, e.first_name, e.last_name, e.public_metadata, e.private_metadata, e.unsafe_metadata, (e.email_addresses || []).map(s => xs.fromJSON(s)), (e.phone_numbers || []).map(s => dn.fromJSON(s)), (e.web3_wallets || []).map(s => Xa.fromJSON(s)), (e.external_accounts || []).map(s => Aa.fromJSON(s)), (e.enterprise_accounts || []).map(s => Ks.fromJSON(s)), e.last_active_at, e.create_organization_enabled, e.create_organizations_limit, e.delete_self_enabled, e.legal_accepted_at, e.locale); return r._raw = e, r; }
|
|
1288
1279
|
get primaryEmailAddress() { return this.emailAddresses.find(({ id: e }) => e === this.primaryEmailAddressId) ?? null; }
|
|
1289
1280
|
get primaryPhoneNumber() { return this.phoneNumbers.find(({ id: e }) => e === this.primaryPhoneNumberId) ?? null; }
|
|
1290
1281
|
get primaryWeb3Wallet() { return this.web3Wallets.find(({ id: e }) => e === this.primaryWeb3WalletId) ?? null; }
|
|
1291
1282
|
get fullName() { return [this.firstName, this.lastName].join(" ").trim() || null; }
|
|
1292
|
-
},
|
|
1283
|
+
}, ec = class Cn {
|
|
1293
1284
|
constructor(e, r, s, n, i, o, a) { this.id = e, this.emailAddress = r, this.status = s, this.invitation = n, this.createdAt = i, this.updatedAt = o, this.isLocked = a; }
|
|
1294
|
-
static fromJSON(e) { return new
|
|
1285
|
+
static fromJSON(e) { return new Cn(e.id, e.email_address, e.status, e.invitation && Qs.fromJSON(e.invitation), e.created_at, e.updated_at, e.is_locked); }
|
|
1295
1286
|
};
|
|
1296
|
-
function
|
|
1297
|
-
function
|
|
1298
|
-
function
|
|
1299
|
-
function
|
|
1287
|
+
function tc(t) { let e, r; return Array.isArray(t) ? { data: t.map(n => Ne(n)) } : sc(t) ? (e = t.m2m_tokens.map(s => Ne(s)), r = t.total_count, { data: e, totalCount: r }) : rc(t) ? (e = t.data.map(s => Ne(s)), r = t.total_count, { data: e, totalCount: r }) : { data: Ne(t) }; }
|
|
1288
|
+
function rc(t) { return !t || typeof t != "object" || !("data" in t) ? !1 : Array.isArray(t.data) && t.data !== void 0; }
|
|
1289
|
+
function sc(t) { return !t || typeof t != "object" || !("m2m_tokens" in t) ? !1 : Array.isArray(t.m2m_tokens); }
|
|
1290
|
+
function nc(t) { return t.total_count; }
|
|
1300
1291
|
function Ne(t) { if (typeof t != "string" && "object" in t && "deleted" in t)
|
|
1301
|
-
return
|
|
1302
|
-
case w.AccountlessApplication: return
|
|
1303
|
-
case w.ActorToken: return
|
|
1304
|
-
case w.AllowlistIdentifier: return
|
|
1305
|
-
case w.ApiKey: return
|
|
1306
|
-
case w.BlocklistIdentifier: return
|
|
1307
|
-
case w.Client: return
|
|
1308
|
-
case w.Cookies: return
|
|
1309
|
-
case w.Domain: return
|
|
1310
|
-
case w.EmailAddress: return
|
|
1311
|
-
case w.EnterpriseAccount: return
|
|
1312
|
-
case w.Email: return
|
|
1313
|
-
case w.IdpOAuthAccessToken: return
|
|
1314
|
-
case w.Instance: return
|
|
1315
|
-
case w.InstanceRestrictions: return
|
|
1316
|
-
case w.InstanceSettings: return
|
|
1317
|
-
case w.Invitation: return
|
|
1318
|
-
case w.JwtTemplate: return
|
|
1319
|
-
case w.Machine: return
|
|
1320
|
-
case w.MachineScope: return
|
|
1321
|
-
case w.MachineSecretKey: return
|
|
1322
|
-
case w.M2MToken: return
|
|
1323
|
-
case w.OauthAccessToken: return
|
|
1324
|
-
case w.OAuthApplication: return
|
|
1325
|
-
case w.Organization: return
|
|
1326
|
-
case w.OrganizationInvitation: return
|
|
1327
|
-
case w.OrganizationMembership: return
|
|
1328
|
-
case w.OrganizationSettings: return
|
|
1329
|
-
case w.Permission: return
|
|
1330
|
-
case w.PhoneNumber: return
|
|
1331
|
-
case w.ProxyCheck: return
|
|
1332
|
-
case w.RedirectUrl: return
|
|
1333
|
-
case w.Role: return
|
|
1334
|
-
case w.RoleSet: return
|
|
1335
|
-
case w.EnterpriseConnection: return
|
|
1336
|
-
case w.SamlConnection: return
|
|
1337
|
-
case w.SignInToken: return
|
|
1338
|
-
case w.AgentTask: return
|
|
1339
|
-
case w.SignUpAttempt: return
|
|
1340
|
-
case w.Session: return
|
|
1341
|
-
case w.SmsMessage: return
|
|
1342
|
-
case w.Token: return
|
|
1343
|
-
case w.TotalCount: return
|
|
1344
|
-
case w.User: return
|
|
1345
|
-
case w.WaitlistEntry: return
|
|
1346
|
-
case w.BillingPlan: return
|
|
1347
|
-
case w.BillingSubscription: return
|
|
1348
|
-
case w.BillingSubscriptionItem: return
|
|
1349
|
-
case w.Feature: return
|
|
1292
|
+
return ka.fromJSON(t); switch (t.object) {
|
|
1293
|
+
case w.AccountlessApplication: return ca.fromJSON(t);
|
|
1294
|
+
case w.ActorToken: return la.fromJSON(t);
|
|
1295
|
+
case w.AllowlistIdentifier: return ha.fromJSON(t);
|
|
1296
|
+
case w.ApiKey: return da.fromJSON(t);
|
|
1297
|
+
case w.BlocklistIdentifier: return fa.fromJSON(t);
|
|
1298
|
+
case w.Client: return ma.fromJSON(t);
|
|
1299
|
+
case w.Cookies: return ga.fromJSON(t);
|
|
1300
|
+
case w.Domain: return _a.fromJSON(t);
|
|
1301
|
+
case w.EmailAddress: return xs.fromJSON(t);
|
|
1302
|
+
case w.EnterpriseAccount: return Ks.fromJSON(t);
|
|
1303
|
+
case w.Email: return va.fromJSON(t);
|
|
1304
|
+
case w.IdpOAuthAccessToken: return rs.fromJSON(t);
|
|
1305
|
+
case w.Instance: return Pa.fromJSON(t);
|
|
1306
|
+
case w.InstanceRestrictions: return Ia.fromJSON(t);
|
|
1307
|
+
case w.InstanceSettings: return Oa.fromJSON(t);
|
|
1308
|
+
case w.Invitation: return Qs.fromJSON(t);
|
|
1309
|
+
case w.JwtTemplate: return Ca.fromJSON(t);
|
|
1310
|
+
case w.Machine: return xa.fromJSON(t);
|
|
1311
|
+
case w.MachineScope: return Ua.fromJSON(t);
|
|
1312
|
+
case w.MachineSecretKey: return Ra.fromJSON(t);
|
|
1313
|
+
case w.M2MToken: return ss.fromJSON(t);
|
|
1314
|
+
case w.OauthAccessToken: return qa.fromJSON(t);
|
|
1315
|
+
case w.OAuthApplication: return Ma.fromJSON(t);
|
|
1316
|
+
case w.Organization: return sn.fromJSON(t);
|
|
1317
|
+
case w.OrganizationInvitation: return Na.fromJSON(t);
|
|
1318
|
+
case w.OrganizationMembership: return Ja.fromJSON(t);
|
|
1319
|
+
case w.OrganizationSettings: return Da.fromJSON(t);
|
|
1320
|
+
case w.Permission: return ln.fromJSON(t);
|
|
1321
|
+
case w.PhoneNumber: return dn.fromJSON(t);
|
|
1322
|
+
case w.ProxyCheck: return Fa.fromJSON(t);
|
|
1323
|
+
case w.RedirectUrl: return Ka.fromJSON(t);
|
|
1324
|
+
case w.Role: return Ha.fromJSON(t);
|
|
1325
|
+
case w.RoleSet: return Wa.fromJSON(t);
|
|
1326
|
+
case w.EnterpriseConnection: return wa.fromJSON(t);
|
|
1327
|
+
case w.SamlConnection: return Ba.fromJSON(t);
|
|
1328
|
+
case w.SignInToken: return Va.fromJSON(t);
|
|
1329
|
+
case w.AgentTask: return ua.fromJSON(t);
|
|
1330
|
+
case w.SignUpAttempt: return Ga.fromJSON(t);
|
|
1331
|
+
case w.Session: return vs.fromJSON(t);
|
|
1332
|
+
case w.SmsMessage: return Qa.fromJSON(t);
|
|
1333
|
+
case w.Token: return Ya.fromJSON(t);
|
|
1334
|
+
case w.TotalCount: return nc(t);
|
|
1335
|
+
case w.User: return Za.fromJSON(t);
|
|
1336
|
+
case w.WaitlistEntry: return ec.fromJSON(t);
|
|
1337
|
+
case w.BillingPlan: return Ms.fromJSON(t);
|
|
1338
|
+
case w.BillingSubscription: return Sa.fromJSON(t);
|
|
1339
|
+
case w.BillingSubscriptionItem: return Js.fromJSON(t);
|
|
1340
|
+
case w.Feature: return Rs.fromJSON(t);
|
|
1350
1341
|
default: return t;
|
|
1351
1342
|
} }
|
|
1352
|
-
function ve(t) { return
|
|
1353
|
-
let _ =
|
|
1343
|
+
function ve(t) { return ic(async (r) => { let { secretKey: s, machineSecretKey: n, useMachineSecretKey: i = !1, requireSecretKey: o = !0, apiUrl: a = Xr, apiVersion: c = Zr, userAgent: d = es, skipApiVersionInUrl: f = !1 } = t, { path: p, method: E, queryParams: S, headerParams: A, bodyParams: P, formData: x, options: l } = r, { deepSnakecaseBodyParamKeys: y = !1 } = l || {}; o && ts(s); let m = f ? u(a, p) : u(a, c, p), h = new URL(m); if (S) {
|
|
1344
|
+
let _ = Vr({ ...S });
|
|
1354
1345
|
for (let [O, q] of Object.entries(_))
|
|
1355
1346
|
q && [q].flat().forEach(z => h.searchParams.append(O, z));
|
|
1356
|
-
} let g = new Headers({ "Clerk-API-Version":
|
|
1347
|
+
} let g = new Headers({ "Clerk-API-Version": At, [v.Headers.UserAgent]: d, ...A }), k = v.Headers.Authorization; g.has(k) || (i && n ? g.set(k, `Bearer ${n}`) : s && g.set(k, `Bearer ${s}`)); let T; try {
|
|
1357
1348
|
if (x)
|
|
1358
1349
|
T = await t.fetch(h.href, { method: E, headers: g, body: x });
|
|
1359
1350
|
else {
|
|
1360
1351
|
g.set("Content-Type", "application/json");
|
|
1361
1352
|
let q = () => { if (!(E !== "GET" && P && Object.keys(P).length > 0))
|
|
1362
|
-
return null; let D = J =>
|
|
1353
|
+
return null; let D = J => Vr(J, { deep: y }); return { body: JSON.stringify(Array.isArray(P) ? P.map(D) : D(P)) }; };
|
|
1363
1354
|
T = await t.fetch(h.href, { method: E, headers: g, ...q() });
|
|
1364
1355
|
}
|
|
1365
1356
|
if (T.status === 204)
|
|
1366
1357
|
return { data: void 0, errors: null };
|
|
1367
1358
|
let O = await (T?.headers && T.headers?.get(v.Headers.ContentType) === v.ContentTypes.Json ? T.json() : T.text());
|
|
1368
|
-
return T.ok ? { ...
|
|
1359
|
+
return T.ok ? { ...tc(O), errors: null } : { data: null, errors: Gr(O), status: T?.status, statusText: T?.statusText, clerkTraceId: yt(O, T?.headers), retryAfter: $r(T?.headers) };
|
|
1369
1360
|
}
|
|
1370
1361
|
catch (_) {
|
|
1371
|
-
return _ instanceof Error ? { data: null, errors: [{ code: "unexpected_error", message: _.message || "Unexpected error" }], clerkTraceId:
|
|
1362
|
+
return _ instanceof Error ? { data: null, errors: [{ code: "unexpected_error", message: _.message || "Unexpected error" }], clerkTraceId: yt(_, T?.headers) } : { data: null, errors: Gr(_), status: T?.status, statusText: T?.statusText, clerkTraceId: yt(_, T?.headers), retryAfter: $r(T?.headers) };
|
|
1372
1363
|
} }); }
|
|
1373
|
-
function
|
|
1374
|
-
function
|
|
1364
|
+
function yt(t, e) { return t && typeof t == "object" && "clerk_trace_id" in t && typeof t.clerk_trace_id == "string" ? t.clerk_trace_id : e?.get("cf-ray") || ""; }
|
|
1365
|
+
function $r(t) { let e = t?.get("Retry-After"); if (!e)
|
|
1375
1366
|
return; let r = parseInt(e, 10); if (!isNaN(r))
|
|
1376
1367
|
return r; }
|
|
1377
|
-
function
|
|
1368
|
+
function Gr(t) { if (t && typeof t == "object" && "errors" in t) {
|
|
1378
1369
|
let e = t.errors;
|
|
1379
|
-
return e.length > 0 ? e.map(
|
|
1370
|
+
return e.length > 0 ? e.map(Ge) : [];
|
|
1380
1371
|
} return []; }
|
|
1381
|
-
function
|
|
1372
|
+
function ic(t) { return async (...e) => { let { data: r, errors: s, totalCount: n, status: i, statusText: o, clerkTraceId: a, retryAfter: c } = await t(...e); if (s) {
|
|
1382
1373
|
let d = new pe(o || "", { data: [], status: i, clerkTraceId: a, retryAfter: c });
|
|
1383
1374
|
throw d.errors = s, d;
|
|
1384
1375
|
} return typeof n < "u" ? { data: r, totalCount: n } : r; }; }
|
|
1385
|
-
function he(t) { let e = ve(t); return { __experimental_accountlessApplications: new
|
|
1376
|
+
function he(t) { let e = ve(t); return { __experimental_accountlessApplications: new Gi(ve({ ...t, requireSecretKey: !1 })), actorTokens: new Vi(e), agentTasks: new $i(e), allowlistIdentifiers: new Qi(e), apiKeys: new Yi(ve({ ...t, skipApiVersionInUrl: !0 })), betaFeatures: new Zi(e), blocklistIdentifiers: new eo(e), billing: new Yo(e), clients: new to(e), domains: new ro(e), emailAddresses: new so(e), emails: new io(e), enterpriseConnections: new oo(e), idPOAuthAccessToken: new co(ve({ ...t, skipApiVersionInUrl: !0 })), instance: new uo(e), invitations: new lo(e), jwks: new Oo(e), jwtTemplates: new Co(e), machines: new ho(e), m2m: new Po(ve({ ...t, skipApiVersionInUrl: !0, requireSecretKey: !1, useMachineSecretKey: !0 }), { secretKey: t.secretKey, apiUrl: t.apiUrl, jwtKey: t.jwtKey, fetch: t.fetch }), oauthApplications: new qo(e), organizations: new xo(e), organizationPermissions: new Uo(e), organizationRoles: new Ro(e), phoneNumbers: new Mo(e), proxyChecks: new Jo(e), redirectUrls: new Lo(e), roleSets: new Do(e), sessions: new Ko(e), signInTokens: new Ho(e), signUps: new zo(e), testingTokens: new Bo(e), users: new jo(e), waitlistEntries: new Vo(e), webhooks: new $o(e), samlConnections: new Fo(e) }; }
|
|
1386
1377
|
var ze = t => () => { let e = { ...t }; return e.secretKey = (e.secretKey || "").substring(0, 7), e.jwtKey = (e.jwtKey || "").substring(0, 7), e.sessionToken = (e.sessionToken || "").substring(0, 7), e.tokenInHeader = (e.tokenInHeader || "").substring(0, 7), e.sessionTokenInCookie = (e.sessionTokenInCookie || "").substring(0, 7), e.refreshTokenInCookie = (e.refreshTokenInCookie || "").substring(0, 7), e.devBrowserToken = (e.devBrowserToken || "").substring(0, 7), e.handshakeToken = (e.handshakeToken || "").substring(0, 7), { ...e }; };
|
|
1387
|
-
function
|
|
1388
|
-
function
|
|
1389
|
-
function
|
|
1378
|
+
function oc(t, e, r) { let { actor: s, sessionId: n, sessionStatus: i, userId: o, orgId: a, orgRole: c, orgSlug: d, orgPermissions: f, factorVerificationAge: p } = Pr(r), E = he(t), S = lc({ sessionId: n, sessionToken: e, fetcher: async (A, P, x) => (await E.sessions.getToken(A, P || "", x)).jwt }); return { tokenType: b.SessionToken, actor: s, sessionClaims: r, sessionId: n, sessionStatus: i, userId: o, orgId: a, orgRole: c, orgSlug: d, orgPermissions: f, factorVerificationAge: p, getToken: S, has: Ar({ orgId: a, orgRole: c, orgPermissions: f, userId: o, factorVerificationAge: p, features: r.fea || "", plans: r.pla || "" }), debug: ze({ ...t, sessionToken: e }), isAuthenticated: !0 }; }
|
|
1379
|
+
function xn(t, e) { return { tokenType: b.SessionToken, sessionClaims: null, sessionId: null, sessionStatus: e ?? null, userId: null, actor: null, orgId: null, orgRole: null, orgSlug: null, orgPermissions: null, factorVerificationAge: null, getToken: () => Promise.resolve(null), has: () => !1, debug: ze(t), isAuthenticated: !1 }; }
|
|
1380
|
+
function ac(t, e, r, s) { let n = { id: r.id, subject: r.subject, getToken: () => Promise.resolve(e), has: () => !1, debug: ze(s), isAuthenticated: !0 }; switch (t) {
|
|
1390
1381
|
case b.ApiKey: {
|
|
1391
1382
|
let i = r;
|
|
1392
1383
|
return { ...n, tokenType: t, name: i.name, claims: i.claims, scopes: i.scopes, userId: i.subject.startsWith("user_") ? i.subject : null, orgId: i.subject.startsWith("org_") ? i.subject : null };
|
|
@@ -1401,23 +1392,23 @@ function fc(t, e, r, s) { let n = { id: r.id, subject: r.subject, getToken: () =
|
|
|
1401
1392
|
}
|
|
1402
1393
|
default: throw new Error(`Invalid token type: ${t}`);
|
|
1403
1394
|
} }
|
|
1404
|
-
function
|
|
1395
|
+
function cc(t, e) { let r = { id: null, subject: null, scopes: null, has: () => !1, getToken: () => Promise.resolve(null), debug: ze(e), isAuthenticated: !1 }; switch (t) {
|
|
1405
1396
|
case b.ApiKey: return { ...r, tokenType: t, name: null, claims: null, scopes: null, userId: null, orgId: null };
|
|
1406
1397
|
case b.M2MToken: return { ...r, tokenType: t, claims: null, scopes: null, machineId: null };
|
|
1407
1398
|
case b.OAuthToken: return { ...r, tokenType: t, scopes: null, userId: null, clientId: null };
|
|
1408
1399
|
default: throw new Error(`Invalid token type: ${t}`);
|
|
1409
1400
|
} }
|
|
1410
|
-
function
|
|
1411
|
-
var
|
|
1401
|
+
function uc() { return { isAuthenticated: !1, tokenType: null, getToken: () => Promise.resolve(null), has: () => !1, debug: () => ({}) }; }
|
|
1402
|
+
var lc = t => { let { fetcher: e, sessionToken: r, sessionId: s } = t || {}; return async (n = {}) => s ? n.template || n.expiresInSeconds !== void 0 ? e(s, n.template, n.expiresInSeconds) : r : null; };
|
|
1412
1403
|
var Te = { SignedIn: "signed-in", SignedOut: "signed-out", Handshake: "handshake" }, M = { ClientUATWithoutSessionToken: "client-uat-but-no-session-token", DevBrowserMissing: "dev-browser-missing", DevBrowserSync: "dev-browser-sync", PrimaryRespondsToSyncing: "primary-responds-to-syncing", PrimaryDomainCrossOriginSync: "primary-domain-cross-origin-sync", SatelliteCookieNeedsSyncing: "satellite-needs-syncing", SessionTokenAndUATMissing: "session-token-and-uat-missing", SessionTokenMissing: "session-token-missing", SessionTokenExpired: "session-token-expired", SessionTokenIATBeforeClientUAT: "session-token-iat-before-client-uat", SessionTokenNBF: "session-token-nbf", SessionTokenIatInTheFuture: "session-token-iat-in-the-future", SessionTokenWithoutClientUAT: "session-token-but-no-client-uat", ActiveOrganizationMismatch: "active-organization-mismatch", TokenTypeMismatch: "token-type-mismatch", UnexpectedError: "unexpected-error" };
|
|
1413
1404
|
function X(t) { let { authenticateContext: e, headers: r = new Headers, token: s } = t, n = (({ treatPendingAsSignedOut: i = !0 } = {}) => { if (t.tokenType === b.SessionToken) {
|
|
1414
|
-
let { sessionClaims: a } = t, c =
|
|
1415
|
-
return i && c.sessionStatus === "pending" ?
|
|
1416
|
-
} let { machineData: o } = t; return
|
|
1417
|
-
function F(t) { let { authenticateContext: e, headers: r = new Headers, reason: s, message: n = "", tokenType: i } = t, o = (() => i === b.SessionToken ?
|
|
1418
|
-
function
|
|
1419
|
-
function
|
|
1420
|
-
var
|
|
1405
|
+
let { sessionClaims: a } = t, c = oc(e, s, a);
|
|
1406
|
+
return i && c.sessionStatus === "pending" ? xn(void 0, c.sessionStatus) : c;
|
|
1407
|
+
} let { machineData: o } = t; return ac(t.tokenType, s, o, e); }); return { status: Te.SignedIn, reason: null, message: null, proxyUrl: e.proxyUrl || "", publishableKey: e.publishableKey || "", isSatellite: e.isSatellite || !1, domain: e.domain || "", signInUrl: e.signInUrl || "", signUpUrl: e.signUpUrl || "", afterSignInUrl: e.afterSignInUrl || "", afterSignUpUrl: e.afterSignUpUrl || "", isSignedIn: !0, isAuthenticated: !0, tokenType: t.tokenType, toAuth: n, headers: r, token: s }; }
|
|
1408
|
+
function F(t) { let { authenticateContext: e, headers: r = new Headers, reason: s, message: n = "", tokenType: i } = t, o = (() => i === b.SessionToken ? xn({ ...e, status: Te.SignedOut, reason: s, message: n }) : cc(i, { reason: s, message: n, headers: r })); return qt({ status: Te.SignedOut, reason: s, message: n, proxyUrl: e.proxyUrl || "", publishableKey: e.publishableKey || "", isSatellite: e.isSatellite || !1, domain: e.domain || "", signInUrl: e.signInUrl || "", signUpUrl: e.signUpUrl || "", afterSignInUrl: e.afterSignInUrl || "", afterSignUpUrl: e.afterSignUpUrl || "", isSignedIn: !1, isAuthenticated: !1, tokenType: i, toAuth: o, headers: r, token: null }); }
|
|
1409
|
+
function hc(t, e, r = "", s) { return qt({ status: Te.Handshake, reason: e, message: r, publishableKey: t.publishableKey || "", isSatellite: t.isSatellite || !1, domain: t.domain || "", proxyUrl: t.proxyUrl || "", signInUrl: t.signInUrl || "", signUpUrl: t.signUpUrl || "", afterSignInUrl: t.afterSignInUrl || "", afterSignUpUrl: t.afterSignUpUrl || "", isSignedIn: !1, isAuthenticated: !1, tokenType: b.SessionToken, toAuth: () => null, headers: s, token: null }); }
|
|
1410
|
+
function dc() { let t = uc(); return qt({ status: Te.SignedOut, reason: M.TokenTypeMismatch, message: "", proxyUrl: "", publishableKey: "", isSatellite: !1, domain: "", signInUrl: "", signUpUrl: "", afterSignInUrl: "", afterSignUpUrl: "", isSignedIn: !1, isAuthenticated: !1, tokenType: null, toAuth: () => t, headers: new Headers, token: null }); }
|
|
1411
|
+
var qt = t => { let e = new Headers(t.headers || {}); if (t.message)
|
|
1421
1412
|
try {
|
|
1422
1413
|
e.set(v.Headers.AuthMessage, t.message);
|
|
1423
1414
|
}
|
|
@@ -1429,39 +1420,39 @@ var Mt = t => { let e = new Headers(t.headers || {}); if (t.message)
|
|
|
1429
1420
|
try {
|
|
1430
1421
|
e.set(v.Headers.AuthStatus, t.status);
|
|
1431
1422
|
}
|
|
1432
|
-
catch { } return t.headers = e, t; },
|
|
1423
|
+
catch { } return t.headers = e, t; }, fc = mr(Mi()), pc = class extends URL {
|
|
1433
1424
|
isCrossOrigin(t) { return this.origin !== new URL(t.toString()).origin; }
|
|
1434
|
-
},
|
|
1425
|
+
}, gt = (...t) => new pc(...t), mc = class extends Request {
|
|
1435
1426
|
constructor(t, e) { let r = typeof t != "string" && "url" in t ? t.url : String(t), s; e ? s = e : typeof t != "string" && (s = new Proxy(t, { get(n, i) { if (!(i === "signal" || i === "body"))
|
|
1436
1427
|
return Reflect.get(n, i, n); } })), super(r, s), this.clerkUrl = this.deriveUrlFromHeaders(this), this.cookies = this.parseCookies(this); }
|
|
1437
1428
|
toJSON() { return { url: this.clerkUrl.href, method: this.method, headers: JSON.stringify(Object.fromEntries(this.headers)), clerkUrl: this.clerkUrl.toString(), cookies: JSON.stringify(Object.fromEntries(this.cookies)) }; }
|
|
1438
1429
|
deriveUrlFromHeaders(t) { let e = new URL(t.url), r = t.headers.get(v.Headers.ForwardedProto), s = t.headers.get(v.Headers.ForwardedHost), n = t.headers.get(v.Headers.Host), i = e.protocol, o = this.getFirstValueFromHeader(s) ?? n, a = this.getFirstValueFromHeader(r) ?? i?.replace(/[:/]/, ""), c = o && a ? `${a}://${o}` : e.origin; if (c === e.origin)
|
|
1439
|
-
return
|
|
1440
|
-
return
|
|
1430
|
+
return gt(e); try {
|
|
1431
|
+
return gt(e.pathname + e.search, c);
|
|
1441
1432
|
}
|
|
1442
1433
|
catch {
|
|
1443
|
-
return
|
|
1434
|
+
return gt(e);
|
|
1444
1435
|
} }
|
|
1445
1436
|
getFirstValueFromHeader(t) { return t?.split(",")[0]; }
|
|
1446
|
-
parseCookies(t) { let e = (0,
|
|
1437
|
+
parseCookies(t) { let e = (0, fc.parse)(this.decodeCookieValue(t.headers.get("cookie") || "")); return new Map(Object.entries(e)); }
|
|
1447
1438
|
decodeCookieValue(t) { return t && t.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); }
|
|
1448
|
-
},
|
|
1439
|
+
}, yc = (...t) => t[0] && typeof t[0] == "object" && "clerkUrl" in t[0] && "cookies" in t[0] ? t[0] : new mc(...t), Un = t => t.split(";")[0]?.split("=")[0], Rn = t => t.split(";")[0]?.split("=")[1];
|
|
1449
1440
|
async function Z(t, e) { let { data: r, errors: s } = K(t); if (s)
|
|
1450
|
-
return { errors: s }; let { header: n } = r, { kid: i } = n; if (n.cat ===
|
|
1441
|
+
return { errors: s }; let { header: n } = r, { kid: i } = n; if (n.cat === os)
|
|
1451
1442
|
return { errors: [new U({ action: L.EnsureClerkJWT, reason: I.TokenInvalid, message: "Invalid session token category." })] }; try {
|
|
1452
1443
|
let o;
|
|
1453
1444
|
if (e.jwtKey)
|
|
1454
|
-
o =
|
|
1445
|
+
o = Pt({ kid: i, pem: e.jwtKey });
|
|
1455
1446
|
else if (e.secretKey)
|
|
1456
|
-
o = await
|
|
1447
|
+
o = await It({ ...e, kid: i });
|
|
1457
1448
|
else
|
|
1458
1449
|
return { errors: [new U({ action: L.SetClerkJWTKey, message: "Failed to resolve JWK during verification.", reason: I.JWKFailedToResolve })] };
|
|
1459
|
-
return await
|
|
1450
|
+
return await nt(t, { ...e, key: o });
|
|
1460
1451
|
}
|
|
1461
1452
|
catch (o) {
|
|
1462
1453
|
return { errors: [o] };
|
|
1463
1454
|
} }
|
|
1464
|
-
function
|
|
1455
|
+
function Mt(t, e, r) { if (Pe(e)) {
|
|
1465
1456
|
let s, n;
|
|
1466
1457
|
switch (e.status) {
|
|
1467
1458
|
case 401:
|
|
@@ -1474,25 +1465,25 @@ function Nt(t, e, r) { if (Pe(e)) {
|
|
|
1474
1465
|
}
|
|
1475
1466
|
return { data: void 0, tokenType: t, errors: [new B({ message: n, code: s, status: e.status })] };
|
|
1476
1467
|
} return { data: void 0, tokenType: t, errors: [new B({ message: "Unexpected error", code: W.UnexpectedError, status: e.status })] }; }
|
|
1477
|
-
async function
|
|
1468
|
+
async function gc(t, e) { try {
|
|
1478
1469
|
return { data: await he(e).m2m.verify({ token: t }), tokenType: b.M2MToken, errors: void 0 };
|
|
1479
1470
|
}
|
|
1480
1471
|
catch (r) {
|
|
1481
|
-
return
|
|
1472
|
+
return Mt(b.M2MToken, r, "Machine token not found");
|
|
1482
1473
|
} }
|
|
1483
|
-
async function
|
|
1474
|
+
async function kc(t, e) { try {
|
|
1484
1475
|
return { data: await he(e).idPOAuthAccessToken.verify(t), tokenType: b.OAuthToken, errors: void 0 };
|
|
1485
1476
|
}
|
|
1486
1477
|
catch (r) {
|
|
1487
|
-
return
|
|
1478
|
+
return Mt(b.OAuthToken, r, "OAuth token not found");
|
|
1488
1479
|
} }
|
|
1489
|
-
async function
|
|
1480
|
+
async function _c(t, e) { try {
|
|
1490
1481
|
return { data: await he(e).apiKeys.verify(t), tokenType: b.ApiKey, errors: void 0 };
|
|
1491
1482
|
}
|
|
1492
1483
|
catch (r) {
|
|
1493
|
-
return
|
|
1484
|
+
return Mt(b.ApiKey, r, "API key not found");
|
|
1494
1485
|
} }
|
|
1495
|
-
async function
|
|
1486
|
+
async function Qr(t, e) { if (Ut(t)) {
|
|
1496
1487
|
let r;
|
|
1497
1488
|
try {
|
|
1498
1489
|
let { data: s, errors: n } = K(t);
|
|
@@ -1503,27 +1494,27 @@ async function Zr(t, e) { if (Rt(t)) {
|
|
|
1503
1494
|
catch (s) {
|
|
1504
1495
|
return { data: void 0, tokenType: b.M2MToken, errors: [new B({ code: W.TokenInvalid, message: s.message })] };
|
|
1505
1496
|
}
|
|
1506
|
-
return typeof r.payload.sub == "string" && r.payload.sub.startsWith(
|
|
1507
|
-
} if (t.startsWith(
|
|
1508
|
-
return
|
|
1509
|
-
return
|
|
1510
|
-
return
|
|
1511
|
-
async function
|
|
1512
|
-
throw s[0]; let { header: n, payload: i } = r, { typ: o, alg: a } = n;
|
|
1497
|
+
return typeof r.payload.sub == "string" && r.payload.sub.startsWith(is) ? us(t, r, e) : De.includes(r.header.typ) ? Ao(t, r, e) : { data: void 0, tokenType: b.OAuthToken, errors: [new B({ code: W.TokenVerificationFailed, message: `Invalid JWT type: ${r.header.typ ?? "missing"}. Expected one of: ${De.join(", ")} for OAuth, or sub starting with 'mch_' for M2M` })] };
|
|
1498
|
+
} if (t.startsWith(Ot))
|
|
1499
|
+
return gc(t, e); if (t.startsWith(Ct))
|
|
1500
|
+
return kc(t, e); if (t.startsWith(xt))
|
|
1501
|
+
return _c(t, e); throw new Error("Unknown machine token type"); }
|
|
1502
|
+
async function vc(t, { key: e }) { let { data: r, errors: s } = K(t); if (s)
|
|
1503
|
+
throw s[0]; let { header: n, payload: i } = r, { typ: o, alg: a } = n; tt(o), rt(a); let { data: c, errors: d } = await st(r, e); if (d)
|
|
1513
1504
|
throw new U({ reason: I.TokenVerificationFailed, message: `Error verifying handshake token. ${d[0]}` }); if (!c)
|
|
1514
1505
|
throw new U({ reason: I.TokenInvalidSignature, message: "Handshake signature is invalid." }); return i; }
|
|
1515
|
-
async function
|
|
1506
|
+
async function Sc(t, e) { let { secretKey: r, apiUrl: s, apiVersion: n, jwksCacheTtlInMs: i, jwtKey: o, skipJwksCache: a } = e, { data: c, errors: d } = K(t); if (d)
|
|
1516
1507
|
throw d[0]; let { kid: f } = c.header, p; if (o)
|
|
1517
|
-
p =
|
|
1508
|
+
p = Pt({ kid: f, pem: o });
|
|
1518
1509
|
else if (r)
|
|
1519
|
-
p = await
|
|
1510
|
+
p = await It({ secretKey: r, apiUrl: s, apiVersion: n, kid: f, jwksCacheTtlInMs: i, skipJwksCache: a, fetch: e.fetch });
|
|
1520
1511
|
else
|
|
1521
|
-
throw new U({ action: L.SetClerkJWTKey, message: "Failed to resolve JWK during handshake verification.", reason: I.JWKFailedToResolve }); return
|
|
1522
|
-
var
|
|
1512
|
+
throw new U({ action: L.SetClerkJWTKey, message: "Failed to resolve JWK during handshake verification.", reason: I.JWKFailedToResolve }); return vc(t, { key: p }); }
|
|
1513
|
+
var Tc = class {
|
|
1523
1514
|
constructor(t, e, r) { this.authenticateContext = t, this.options = e, this.organizationMatcher = r; }
|
|
1524
1515
|
isRequestEligibleForHandshake() { let { accept: t, method: e, secFetchDest: r } = this.authenticateContext; return e !== "GET" ? !1 : !!(r === "document" || r === "iframe" || !r && t?.startsWith("text/html")); }
|
|
1525
1516
|
buildRedirectToHandshake(t) { if (!this.authenticateContext?.clerkUrl)
|
|
1526
|
-
throw new Error("Missing clerkUrl in authenticateContext"); let e = this.removeDevBrowserFromURL(this.authenticateContext.clerkUrl), r = this.authenticateContext.frontendApi.startsWith("http") ? this.authenticateContext.frontendApi : `https://${this.authenticateContext.frontendApi}`; r = r.replace(/\/+$/, "") + "/"; let s = new URL("v1/client/handshake", r); s.searchParams.append("redirect_url", e?.href || ""), s.searchParams.append("__clerk_api_version",
|
|
1517
|
+
throw new Error("Missing clerkUrl in authenticateContext"); let e = this.removeDevBrowserFromURL(this.authenticateContext.clerkUrl), r = this.authenticateContext.frontendApi.startsWith("http") ? this.authenticateContext.frontendApi : `https://${this.authenticateContext.frontendApi}`; r = r.replace(/\/+$/, "") + "/"; let s = new URL("v1/client/handshake", r); s.searchParams.append("redirect_url", e?.href || ""), s.searchParams.append("__clerk_api_version", At), s.searchParams.append(v.QueryParameters.SuffixedCookies, this.authenticateContext.usesSuffixedCookies().toString()), s.searchParams.append(v.QueryParameters.HandshakeReason, t), s.searchParams.append(v.QueryParameters.HandshakeFormat, "nonce"), this.authenticateContext.sessionToken && s.searchParams.append(v.QueryParameters.Session, this.authenticateContext.sessionToken), this.authenticateContext.instanceType === "development" && this.authenticateContext.devBrowserToken && s.searchParams.append(v.QueryParameters.DevBrowser, this.authenticateContext.devBrowserToken); let n = this.getOrganizationSyncTarget(this.authenticateContext.clerkUrl, this.organizationMatcher); return n && this.getOrganizationSyncQueryParams(n).forEach((o, a) => { s.searchParams.append(a, o); }), new Headers({ [v.Headers.Location]: s.href }); }
|
|
1527
1518
|
async getCookiesFromHandshake() { let t = []; if (this.authenticateContext.handshakeNonce)
|
|
1528
1519
|
try {
|
|
1529
1520
|
let e = await this.authenticateContext.apiClient?.clients.getHandshakePayload({ nonce: this.authenticateContext.handshakeNonce });
|
|
@@ -1533,10 +1524,10 @@ var Ic = class {
|
|
|
1533
1524
|
oe(e);
|
|
1534
1525
|
}
|
|
1535
1526
|
else if (this.authenticateContext.handshakeToken) {
|
|
1536
|
-
let e = await
|
|
1527
|
+
let e = await Sc(this.authenticateContext.handshakeToken, this.authenticateContext);
|
|
1537
1528
|
e && Array.isArray(e.handshake) && t.push(...e.handshake);
|
|
1538
1529
|
} return t; }
|
|
1539
|
-
async resolveHandshake() { let t = new Headers({ "Access-Control-Allow-Origin": "null", "Access-Control-Allow-Credentials": "true" }), e = await this.getCookiesFromHandshake(), r = ""; if (e.forEach(i => { t.append("Set-Cookie", i),
|
|
1530
|
+
async resolveHandshake() { let t = new Headers({ "Access-Control-Allow-Origin": "null", "Access-Control-Allow-Credentials": "true" }), e = await this.getCookiesFromHandshake(), r = ""; if (e.forEach(i => { t.append("Set-Cookie", i), Un(i).startsWith(v.Cookies.Session) && (r = Rn(i)); }), this.authenticateContext.instanceType === "development") {
|
|
1540
1531
|
let i = new URL(this.authenticateContext.clerkUrl);
|
|
1541
1532
|
i.searchParams.delete(v.QueryParameters.Handshake), i.searchParams.delete(v.QueryParameters.HandshakeHelp), i.searchParams.delete(v.QueryParameters.DevBrowser), i.searchParams.delete(v.QueryParameters.HandshakeNonce), t.append(v.Headers.Location, i.toString()), t.set(v.Headers.CacheControl, "no-store");
|
|
1542
1533
|
} if (r === "")
|
|
@@ -1558,11 +1549,11 @@ var Ic = class {
|
|
|
1558
1549
|
removeDevBrowserFromURL(t) { let e = new URL(t); return e.searchParams.delete(v.QueryParameters.DevBrowser), e.searchParams.delete(v.QueryParameters.LegacyDevBrowser), e; }
|
|
1559
1550
|
getOrganizationSyncTarget(t, e) { return e.findTarget(t); }
|
|
1560
1551
|
getOrganizationSyncQueryParams(t) { let e = new Map; return t.type === "personalAccount" && e.set("organization_id", ""), t.type === "organization" && (t.organizationId && e.set("organization_id", t.organizationId), t.organizationSlug && e.set("organization_id", t.organizationSlug)), e; }
|
|
1561
|
-
},
|
|
1552
|
+
}, bc = class {
|
|
1562
1553
|
constructor(t) { this.organizationPattern = this.createMatcher(t?.organizationPatterns), this.personalAccountPattern = this.createMatcher(t?.personalAccountPatterns); }
|
|
1563
1554
|
createMatcher(t) { if (!t)
|
|
1564
1555
|
return null; try {
|
|
1565
|
-
return
|
|
1556
|
+
return lt(t);
|
|
1566
1557
|
}
|
|
1567
1558
|
catch (e) {
|
|
1568
1559
|
throw new Error(`Invalid pattern "${t}": ${e}`);
|
|
@@ -1587,23 +1578,23 @@ var Ic = class {
|
|
|
1587
1578
|
return oe(e), null;
|
|
1588
1579
|
} }
|
|
1589
1580
|
}, j = { NonEligibleNoCookie: "non-eligible-no-refresh-cookie", NonEligibleNonGet: "non-eligible-non-get", InvalidSessionToken: "invalid-session-token", MissingApiClient: "missing-api-client", MissingSessionToken: "missing-session-token", MissingRefreshToken: "missing-refresh-token", ExpiredSessionTokenDecodeFailed: "expired-session-token-decode-failed", ExpiredSessionTokenMissingSidClaim: "expired-session-token-missing-sid-claim", FetchError: "fetch-error", UnexpectedSDKError: "unexpected-sdk-error", UnexpectedBAPIError: "unexpected-bapi-error" };
|
|
1590
|
-
function
|
|
1581
|
+
function Ec(t, e) { if (!t && Be(e))
|
|
1591
1582
|
throw new Error("Missing signInUrl. Pass a signInUrl for dev instances if an app is satellite"); }
|
|
1592
|
-
function
|
|
1583
|
+
function wc(t) { if (!t)
|
|
1593
1584
|
throw new Error("Missing domain and proxyUrl. A satellite application needs to specify a domain or a proxyUrl"); }
|
|
1594
|
-
function
|
|
1585
|
+
function Ac(t, e) { let r; try {
|
|
1595
1586
|
r = new URL(t);
|
|
1596
1587
|
}
|
|
1597
1588
|
catch {
|
|
1598
1589
|
throw new Error("The signInUrl needs to have a absolute url format.");
|
|
1599
1590
|
} if (r.origin === e)
|
|
1600
1591
|
throw new Error("The signInUrl needs to be on a different origin than your satellite application."); }
|
|
1601
|
-
function
|
|
1592
|
+
function Pc(t) { if (!t.machineSecretKey && !t.secretKey)
|
|
1602
1593
|
throw new Error("Machine token authentication requires either a Machine secret key or a Clerk secret key. Ensure a Clerk secret key or Machine secret key is set."); }
|
|
1603
|
-
function
|
|
1604
|
-
function
|
|
1605
|
-
function
|
|
1606
|
-
var
|
|
1594
|
+
function Ic(t, e, r) { return t.reason === I.TokenExpired && !!e.refreshTokenInCookie && r.method === "GET"; }
|
|
1595
|
+
function Yr(t, e, r) { return as(t, e) ? null : F({ tokenType: typeof e == "string" ? e : t, authenticateContext: r, reason: M.TokenTypeMismatch }); }
|
|
1596
|
+
function Oc(t, e) { let r = null, { tokenInHeader: s } = e; s && (Tt(s) ? r = bt(s) : r = b.SessionToken); let n = r ?? b.SessionToken; return as(n, t); }
|
|
1597
|
+
var Cc = (async (t, e) => { let r = await Wi(yc(t), e), s = e.acceptsToken ?? b.SessionToken; s !== b.M2MToken && (ts(r.secretKey), r.isSatellite && (Ec(r.signInUrl, r.secretKey), r.signInUrl && r.origin && Ac(r.signInUrl, r.origin), wc(r.proxyUrl || r.domain))), s === b.M2MToken && Pc(r); let n = new bc(e.organizationSyncOptions), i = new Tc(r, { organizationSyncOptions: e.organizationSyncOptions }, n); async function o(l) { if (!e.apiClient)
|
|
1607
1598
|
return { data: null, error: { message: "An apiClient is needed to perform token refresh.", cause: { reason: j.MissingApiClient } } }; let { sessionToken: y, refreshTokenInCookie: m } = l; if (!y)
|
|
1608
1599
|
return { data: null, error: { message: "Session token must be provided.", cause: { reason: j.MissingSessionToken } } }; if (!m)
|
|
1609
1600
|
return { data: null, error: { message: "Refresh token must be provided.", cause: { reason: j.MissingRefreshToken } } }; let { data: h, errors: g } = K(y); if (!h || g)
|
|
@@ -1614,14 +1605,14 @@ var Nc = (async (t, e) => { let r = await Qi(Tc(t), e), s = e.acceptsToken ?? b.
|
|
|
1614
1605
|
catch (k) {
|
|
1615
1606
|
return k?.errors?.length ? k.errors[0].code === "unexpected_error" ? { data: null, error: { message: "Fetch unexpected error", cause: { reason: j.FetchError, errors: k.errors } } } : { data: null, error: { message: k.errors[0].code, cause: { reason: k.errors[0].code, errors: k.errors } } } : { data: null, error: { message: "Unexpected Server/BAPI error", cause: { reason: j.UnexpectedBAPIError, errors: [k] } } };
|
|
1616
1607
|
} } async function a(l) { let { data: y, error: m } = await o(l); if (!y || y.length === 0)
|
|
1617
|
-
return { data: null, error: m }; let h = new Headers, g = ""; y.forEach(_ => { h.append("Set-Cookie", _),
|
|
1608
|
+
return { data: null, error: m }; let h = new Headers, g = ""; y.forEach(_ => { h.append("Set-Cookie", _), Un(_).startsWith(v.Cookies.Session) && (g = Rn(_)); }); let { data: k, errors: T } = await Z(g, l); return T ? { data: null, error: { message: "Clerk: unable to verify refreshed session token.", cause: { reason: j.InvalidSessionToken, errors: T } } } : { data: { jwtPayload: k, sessionToken: g, headers: h }, error: null }; } function c(l, y, m, h) { if (!i.isRequestEligibleForHandshake())
|
|
1618
1609
|
return F({ tokenType: b.SessionToken, authenticateContext: l, reason: y, message: m }); let g = h ?? i.buildRedirectToHandshake(y); if (g.get(v.Headers.Location) && g.set(v.Headers.CacheControl, "no-store"), i.checkAndTrackRedirectLoop(g)) {
|
|
1619
1610
|
let T = d(y);
|
|
1620
1611
|
return oe(), F({ tokenType: b.SessionToken, authenticateContext: l, reason: y, message: m });
|
|
1621
|
-
} return
|
|
1612
|
+
} return hc(l, y, m, g); } function d(l) { return l === M.SatelliteCookieNeedsSyncing ? "Clerk: Satellite-domain authentication resulted in an infinite redirect loop. Check that this request is using a configured primary or satellite domain for the production instance. For preview deployments, use a development/staging Clerk instance or a supported configured preview-domain setup." : "Clerk: Refreshing the session token resulted in an infinite redirect loop. This usually means that your Clerk instance keys do not match - make sure to copy the correct publishable and secret keys from the Clerk dashboard."; } function f(l, y) { let m = n.findTarget(l.clerkUrl); if (!m)
|
|
1622
1613
|
return null; let h = !1; if (m.type === "organization" && (m.organizationSlug && m.organizationSlug !== y.orgSlug && (h = !0), m.organizationId && m.organizationId !== y.orgId && (h = !0)), m.type === "personalAccount" && y.orgId && (h = !0), !h)
|
|
1623
1614
|
return null; if (l.handshakeRedirectLoopCounter >= 3)
|
|
1624
|
-
return oe(), null; let g = c(l, M.ActiveOrganizationMismatch, ""); return g.status !== "handshake" ? null : g; } async function p() { let { tokenInHeader: l } = r; if (
|
|
1615
|
+
return oe(), null; let g = c(l, M.ActiveOrganizationMismatch, ""); return g.status !== "handshake" ? null : g; } async function p() { let { tokenInHeader: l } = r; if (Mr(l))
|
|
1625
1616
|
return F({ tokenType: b.SessionToken, authenticateContext: r, reason: M.TokenTypeMismatch, message: "" }); try {
|
|
1626
1617
|
let { data: y, errors: m } = await Z(l, r);
|
|
1627
1618
|
if (m)
|
|
@@ -1661,77 +1652,77 @@ catch (y) {
|
|
|
1661
1652
|
return F({ tokenType: b.SessionToken, authenticateContext: r, reason: M.SessionTokenAndUATMissing }); if (!l && y)
|
|
1662
1653
|
return c(r, M.SessionTokenWithoutClientUAT, ""); if (l && !y)
|
|
1663
1654
|
return c(r, M.ClientUATWithoutSessionToken, ""); let { data: z, errors: D } = K(r.sessionTokenInCookie); if (D)
|
|
1664
|
-
return S(D[0], "cookie"); if (
|
|
1655
|
+
return S(D[0], "cookie"); if (Mr(r.sessionTokenInCookie))
|
|
1665
1656
|
return F({ tokenType: b.SessionToken, authenticateContext: r, reason: M.TokenTypeMismatch, message: "" }); if (z.payload.iat < r.clientUat)
|
|
1666
1657
|
return c(r, M.SessionTokenIATBeforeClientUAT, ""); try {
|
|
1667
1658
|
let { data: J, errors: H } = await Z(r.sessionTokenInCookie, r);
|
|
1668
1659
|
if (H)
|
|
1669
1660
|
throw H[0];
|
|
1670
|
-
J.azp ||
|
|
1661
|
+
J.azp || kr.warnOnce("Clerk: Session token from cookie is missing the azp claim. In a future version of Clerk, this token will be considered invalid. Please contact Clerk support if you see this warning.");
|
|
1671
1662
|
let V = X({ tokenType: b.SessionToken, authenticateContext: r, sessionClaims: J, headers: new Headers, token: r.sessionTokenInCookie });
|
|
1672
1663
|
if (!r.isSatellite && r.method === "GET" && r.secFetchDest === "document" && r.isCrossOriginReferrer() && !r.isKnownClerkReferrer() && r.handshakeRedirectLoopCounter === 0)
|
|
1673
1664
|
return c(r, M.PrimaryDomainCrossOriginSync, "Cross-origin request from satellite domain requires handshake");
|
|
1674
1665
|
let Ee = V.toAuth();
|
|
1675
1666
|
if (Ee.userId) {
|
|
1676
|
-
let
|
|
1677
|
-
if (
|
|
1678
|
-
return
|
|
1667
|
+
let Dt = f(r, Ee);
|
|
1668
|
+
if (Dt)
|
|
1669
|
+
return Dt;
|
|
1679
1670
|
}
|
|
1680
1671
|
return V;
|
|
1681
1672
|
}
|
|
1682
1673
|
catch (J) {
|
|
1683
1674
|
return S(J, "cookie");
|
|
1684
1675
|
} return F({ tokenType: b.SessionToken, authenticateContext: r, reason: M.UnexpectedError }); } async function S(l, y) { if (!(l instanceof U))
|
|
1685
|
-
return F({ tokenType: b.SessionToken, authenticateContext: r, reason: M.UnexpectedError }); let m; if (
|
|
1676
|
+
return F({ tokenType: b.SessionToken, authenticateContext: r, reason: M.UnexpectedError }); let m; if (Ic(l, r, t)) {
|
|
1686
1677
|
let { data: g, error: k } = await a(r);
|
|
1687
1678
|
if (g)
|
|
1688
1679
|
return X({ tokenType: b.SessionToken, authenticateContext: r, sessionClaims: g.jwtPayload, headers: g.headers, token: g.sessionToken });
|
|
1689
1680
|
k?.cause?.reason ? m = k.cause.reason : m = j.UnexpectedSDKError;
|
|
1690
1681
|
}
|
|
1691
1682
|
else
|
|
1692
|
-
t.method !== "GET" ? m = j.NonEligibleNonGet : r.refreshTokenInCookie ? m = null : m = j.NonEligibleNoCookie; return l.tokenCarrier = y, [I.TokenExpired, I.TokenNotActiveYet, I.TokenIatInTheFuture].includes(l.reason) ? c(r,
|
|
1693
|
-
return S(new Error("Missing token in header"), "header"); if (!
|
|
1694
|
-
return F({ tokenType: s, authenticateContext: r, reason: M.TokenTypeMismatch, message: "" }); let y =
|
|
1695
|
-
return m; let { data: h, tokenType: g, errors: k } = await
|
|
1696
|
-
return S(new Error("Missing token in header"), "header"); if (
|
|
1697
|
-
let h =
|
|
1683
|
+
t.method !== "GET" ? m = j.NonEligibleNonGet : r.refreshTokenInCookie ? m = null : m = j.NonEligibleNoCookie; return l.tokenCarrier = y, [I.TokenExpired, I.TokenNotActiveYet, I.TokenIatInTheFuture].includes(l.reason) ? c(r, Uc({ tokenError: l.reason, refreshError: m }), l.getFullMessage()) : F({ tokenType: b.SessionToken, authenticateContext: r, reason: l.reason, message: l.getFullMessage() }); } function A(l, y) { return y instanceof B ? F({ tokenType: l, authenticateContext: r, reason: y.code, message: y.getFullMessage() }) : F({ tokenType: l, authenticateContext: r, reason: M.UnexpectedError }); } async function P() { let { tokenInHeader: l } = r; if (!l)
|
|
1684
|
+
return S(new Error("Missing token in header"), "header"); if (!Tt(l))
|
|
1685
|
+
return F({ tokenType: s, authenticateContext: r, reason: M.TokenTypeMismatch, message: "" }); let y = bt(l), m = Yr(y, s, r); if (m)
|
|
1686
|
+
return m; let { data: h, tokenType: g, errors: k } = await Qr(l, r); return k ? A(g, k[0]) : X({ tokenType: g, authenticateContext: r, machineData: h, token: l }); } async function x() { let { tokenInHeader: l } = r; if (!l)
|
|
1687
|
+
return S(new Error("Missing token in header"), "header"); if (Tt(l)) {
|
|
1688
|
+
let h = bt(l), g = Yr(h, s, r);
|
|
1698
1689
|
if (g)
|
|
1699
1690
|
return g;
|
|
1700
|
-
let { data: k, tokenType: T, errors: _ } = await
|
|
1691
|
+
let { data: k, tokenType: T, errors: _ } = await Qr(l, r);
|
|
1701
1692
|
return _ ? A(T, _[0]) : X({ tokenType: T, authenticateContext: r, machineData: k, token: l });
|
|
1702
|
-
} let { data: y, errors: m } = await Z(l, r); return m ? S(m[0], "header") : X({ tokenType: b.SessionToken, authenticateContext: r, sessionClaims: y, token: l }); } return Array.isArray(s) && !
|
|
1693
|
+
} let { data: y, errors: m } = await Z(l, r); return m ? S(m[0], "header") : X({ tokenType: b.SessionToken, authenticateContext: r, sessionClaims: y, token: l }); } return Array.isArray(s) && !Oc(s, r) ? dc() : r.tokenInHeader ? s === "any" || Array.isArray(s) ? x() : s === b.SessionToken ? p() : P() : s === b.OAuthToken || s === b.ApiKey || s === b.M2MToken ? F({ tokenType: s, authenticateContext: r, reason: "No token in header" }) : E(); }), xc = t => { let { isSignedIn: e, isAuthenticated: r, proxyUrl: s, reason: n, message: i, publishableKey: o, isSatellite: a, domain: c } = t; return { isSignedIn: e, isAuthenticated: r, proxyUrl: s, reason: n, message: i, publishableKey: o, isSatellite: a, domain: c }; }, Uc = ({ tokenError: t, refreshError: e }) => { switch (t) {
|
|
1703
1694
|
case I.TokenExpired: return `${M.SessionTokenExpired}-refresh-${e}`;
|
|
1704
1695
|
case I.TokenNotActiveYet: return M.SessionTokenNBF;
|
|
1705
1696
|
case I.TokenIatInTheFuture: return M.SessionTokenIatInTheFuture;
|
|
1706
1697
|
default: return M.UnexpectedError;
|
|
1707
|
-
} },
|
|
1708
|
-
function
|
|
1709
|
-
function
|
|
1698
|
+
} }, Rc = { fetch: void 0, secretKey: "", machineSecretKey: "", jwtKey: "", apiUrl: void 0, apiVersion: void 0, proxyUrl: "", publishableKey: "", isSatellite: !1, domain: "", audience: "" };
|
|
1699
|
+
function qn(t) { let e = Cr(Rc, t.options), r = t.apiClient; return { authenticateRequest: (n, i = {}) => { let { apiUrl: o, apiVersion: a } = e, c = Cr(e, i); return Cc(n, { ...i, ...c, apiUrl: o, apiVersion: a, apiClient: r }); }, debugRequestState: xc }; }
|
|
1700
|
+
function Mn(t) { return async (...e) => { let { data: r, errors: s } = await t(...e); if (s)
|
|
1710
1701
|
throw s[0]; return r; }; }
|
|
1711
|
-
var
|
|
1712
|
-
function
|
|
1713
|
-
function
|
|
1714
|
-
function
|
|
1715
|
-
function
|
|
1716
|
-
function
|
|
1717
|
-
for (let t of
|
|
1702
|
+
var Jn = Symbol.for("@clerk/shared.telemetryNoticeShown"), qc = ["Attention: Clerk collects telemetry data from its SDKs when connected to development instances.", "The data collected is used to inform Clerk's product roadmap.", "To learn more, including how to opt-out from the telemetry program, visit: https://clerk.com/docs/telemetry."];
|
|
1703
|
+
function Mc() { return !(typeof window < "u" || typeof globalThis.EdgeRuntime < "u"); }
|
|
1704
|
+
function Nc() { return typeof process > "u" || !process.env ? !1 : Ft.some(t => ue(process.env[t])); }
|
|
1705
|
+
function Jc() { return !!globalThis[Jn]; }
|
|
1706
|
+
function Lc() { globalThis[Jn] = !0; }
|
|
1707
|
+
function Dc() { if (!(typeof console > "u" || typeof console.log != "function")) {
|
|
1708
|
+
for (let t of qc)
|
|
1718
1709
|
console.log(t);
|
|
1719
1710
|
console.log("");
|
|
1720
1711
|
} }
|
|
1721
|
-
function
|
|
1712
|
+
function Fc(t = {}) { if (!t.skip)
|
|
1722
1713
|
try {
|
|
1723
|
-
if (!
|
|
1714
|
+
if (!Mc() || Nc() || Jc())
|
|
1724
1715
|
return;
|
|
1725
|
-
|
|
1716
|
+
Dc(), Lc();
|
|
1726
1717
|
}
|
|
1727
1718
|
catch { } }
|
|
1728
|
-
var
|
|
1719
|
+
var Kc = 864e5, Hc = class {
|
|
1729
1720
|
#e;
|
|
1730
|
-
#r =
|
|
1721
|
+
#r = Kc;
|
|
1731
1722
|
constructor(t) { this.#e = t; }
|
|
1732
1723
|
isEventThrottled(t) { let e = Date.now(), r = this.#t(t), s = this.#e.getItem(r); return s ? e - s > this.#r ? (this.#e.setItem(r, e), !1) : !0 : (this.#e.setItem(r, e), !1); }
|
|
1733
1724
|
#t(t) { let { sk: e, pk: r, payload: s, ...n } = t, i = { ...s, ...n }; return JSON.stringify(Object.keys({ ...s, ...n }).sort().map(o => i[o])); }
|
|
1734
|
-
},
|
|
1725
|
+
}, Nn = class {
|
|
1735
1726
|
#e = "clerk_telemetry_throttler";
|
|
1736
1727
|
getItem(t) { return this.#r()[t]; }
|
|
1737
1728
|
setItem(t, e) { try {
|
|
@@ -1754,7 +1745,7 @@ var Vc = 864e5, $c = class {
|
|
|
1754
1745
|
return {};
|
|
1755
1746
|
} }
|
|
1756
1747
|
static isSupported() { return typeof window < "u" && !!window.localStorage; }
|
|
1757
|
-
},
|
|
1748
|
+
}, zc = class {
|
|
1758
1749
|
#e = new Map;
|
|
1759
1750
|
#r = 1e4;
|
|
1760
1751
|
getItem(t) { if (this.#e.size > this.#r) {
|
|
@@ -1764,14 +1755,14 @@ var Vc = 864e5, $c = class {
|
|
|
1764
1755
|
setItem(t, e) { this.#e.set(t, e); }
|
|
1765
1756
|
removeItem(t) { this.#e.delete(t); }
|
|
1766
1757
|
};
|
|
1767
|
-
function
|
|
1768
|
-
var
|
|
1758
|
+
function Wc(t) { return typeof t == "object" && t !== null && "constructor" in t && typeof t.constructor == "function"; }
|
|
1759
|
+
var Bc = new Set(["error", "warn", "info", "debug", "trace"]), Nt = { samplingRate: 1, maxBufferSize: 5, endpoint: "https://clerk-telemetry.com" }, Jt = class {
|
|
1769
1760
|
#e;
|
|
1770
1761
|
#r;
|
|
1771
1762
|
#t = {};
|
|
1772
1763
|
#n = [];
|
|
1773
1764
|
#s = null;
|
|
1774
|
-
constructor(t) { this.#e = { maxBufferSize: t.maxBufferSize ??
|
|
1765
|
+
constructor(t) { this.#e = { maxBufferSize: t.maxBufferSize ?? Nt.maxBufferSize, samplingRate: t.samplingRate ?? Nt.samplingRate, perEventSampling: t.perEventSampling ?? !0, disabled: t.disabled ?? !1, debug: t.debug ?? !1, endpoint: Nt.endpoint }, !t.clerkVersion && typeof window > "u" ? this.#t.clerkVersion = "" : this.#t.clerkVersion = t.clerkVersion ?? "", this.#t.sdk = t.sdk, this.#t.sdkVersion = t.sdkVersion, this.#t.publishableKey = t.publishableKey ?? ""; let e = ee(t.publishableKey); e && (this.#t.instanceType = e.instanceType), t.secretKey && (this.#t.secretKey = t.secretKey.substring(0, 16)); let r = Nn.isSupported() ? new Nn : new zc; this.#r = new Hc(r), Fc({ skip: !this.isEnabled }); }
|
|
1775
1766
|
get isEnabled() { return !(this.#t.instanceType !== "development" || this.#e.disabled || typeof process < "u" && process.env && ue(process.env.CLERK_TELEMETRY_DISABLED) || typeof window < "u" && window?.navigator?.webdriver); }
|
|
1776
1767
|
get isDebug() { return this.#e.debug || typeof process < "u" && process.env && ue(process.env.CLERK_TELEMETRY_DEBUG); }
|
|
1777
1768
|
record(t) { try {
|
|
@@ -1786,7 +1777,7 @@ var Yc = new Set(["error", "warn", "info", "debug", "trace"]), Jt = { samplingRa
|
|
|
1786
1777
|
recordLog(t) { try {
|
|
1787
1778
|
if (!this.#u(t))
|
|
1788
1779
|
return;
|
|
1789
|
-
let e = typeof t?.level == "string" &&
|
|
1780
|
+
let e = typeof t?.level == "string" && Bc.has(t.level), r = typeof t?.message == "string" && t.message.trim().length > 0, s = null, n = t?.timestamp;
|
|
1790
1781
|
if (typeof n == "number" || typeof n == "string") {
|
|
1791
1782
|
let a = new Date(n);
|
|
1792
1783
|
Number.isNaN(a.getTime()) || (s = a);
|
|
@@ -1824,7 +1815,7 @@ var Yc = new Set(["error", "warn", "info", "debug", "trace"]), Jt = { samplingRa
|
|
|
1824
1815
|
let e = window;
|
|
1825
1816
|
if (e.Clerk) {
|
|
1826
1817
|
let r = e.Clerk;
|
|
1827
|
-
if (
|
|
1818
|
+
if (Wc(r) && r.constructor.sdkMetadata) {
|
|
1828
1819
|
let { name: s, version: n } = r.constructor.sdkMetadata;
|
|
1829
1820
|
s !== void 0 && (t.name = s), n !== void 0 && (t.version = n);
|
|
1830
1821
|
}
|
|
@@ -1840,6 +1831,6 @@ var Yc = new Set(["error", "warn", "info", "debug", "trace"]), Jt = { samplingRa
|
|
|
1840
1831
|
return null;
|
|
1841
1832
|
} }
|
|
1842
1833
|
};
|
|
1843
|
-
var
|
|
1844
|
-
function
|
|
1845
|
-
export {
|
|
1834
|
+
var ud = Mn(Z);
|
|
1835
|
+
function jc(t) { let e = { ...t }, r = he(e), s = qn({ options: e, apiClient: r }), n = new Jt({ publishableKey: e.publishableKey, secretKey: e.secretKey, samplingRate: .1, ...e.sdkMetadata ? { sdk: e.sdkMetadata.name, sdkVersion: e.sdkMetadata.version } : {}, ...e.telemetry || {} }); return { ...r, ...s, telemetry: n }; }
|
|
1836
|
+
export { jc as createClerkClient };
|