@gadicc/loom 1.37.0 → 2.0.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/.loom-source-manifest.json +97 -0
- package/README.md +113 -31
- package/db/databaseTls.js +6 -3
- package/db/databaseUrl.js +3 -2
- package/db/drizzle-config.js +14 -16
- package/db/fixtures.d.ts +1 -3
- package/db/fixtures.js +4 -7
- package/esm/bin/loom.d.ts +2 -1
- package/esm/bin/loom.d.ts.map +1 -1
- package/esm/bin/loom.js +37 -10
- package/esm/bin/loom.js.map +1 -0
- package/esm/mod.d.ts +0 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +1 -1
- package/esm/mod.js.map +1 -0
- package/esm/src/apiKeys/authorize.d.ts.map +1 -1
- package/esm/src/apiKeys/authorize.js +15 -14
- package/esm/src/apiKeys/authorize.js.map +1 -0
- package/esm/src/apiKeys/betterAuth.d.ts.map +1 -1
- package/esm/src/apiKeys/betterAuth.js +1 -0
- package/esm/src/apiKeys/betterAuth.js.map +1 -0
- package/esm/src/apiKeys/country.d.ts.map +1 -1
- package/esm/src/apiKeys/country.js +1 -0
- package/esm/src/apiKeys/country.js.map +1 -0
- package/esm/src/apiKeys/credentials.d.ts.map +1 -1
- package/esm/src/apiKeys/credentials.js +3 -1
- package/esm/src/apiKeys/credentials.js.map +1 -0
- package/esm/src/apiKeys/fingerprint.d.ts.map +1 -1
- package/esm/src/apiKeys/fingerprint.js +1 -0
- package/esm/src/apiKeys/fingerprint.js.map +1 -0
- package/esm/src/apiKeys/lifecycle.d.ts.map +1 -1
- package/esm/src/apiKeys/lifecycle.js +1 -0
- package/esm/src/apiKeys/lifecycle.js.map +1 -0
- package/esm/src/apiKeys/limits.d.ts.map +1 -1
- package/esm/src/apiKeys/limits.js +10 -10
- package/esm/src/apiKeys/limits.js.map +1 -0
- package/esm/src/apiKeys/mod.d.ts +0 -1
- package/esm/src/apiKeys/mod.d.ts.map +1 -1
- package/esm/src/apiKeys/mod.js +1 -1
- package/esm/src/apiKeys/mod.js.map +1 -0
- package/esm/src/apiKeys/permissions.d.ts.map +1 -1
- package/esm/src/apiKeys/permissions.js +1 -0
- package/esm/src/apiKeys/permissions.js.map +1 -0
- package/esm/src/apiKeys/policy.d.ts.map +1 -1
- package/esm/src/apiKeys/policy.js +1 -0
- package/esm/src/apiKeys/policy.js.map +1 -0
- package/esm/src/apiKeys/retention.d.ts.map +1 -1
- package/esm/src/apiKeys/retention.js +1 -0
- package/esm/src/apiKeys/retention.js.map +1 -0
- package/esm/src/apiKeys/types.d.ts.map +1 -1
- package/esm/src/apiKeys/types.js +1 -0
- package/esm/src/apiKeys/types.js.map +1 -0
- package/esm/src/cli/atomicText.d.ts +3 -0
- package/esm/src/cli/atomicText.d.ts.map +1 -0
- package/esm/src/cli/atomicText.js +33 -0
- package/esm/src/cli/atomicText.js.map +1 -0
- package/esm/src/cli/bunLocalDev.d.ts +65 -0
- package/esm/src/cli/bunLocalDev.d.ts.map +1 -0
- package/esm/src/cli/bunLocalDev.js +459 -0
- package/esm/src/cli/bunLocalDev.js.map +1 -0
- package/esm/src/cli/bunProject.d.ts +30 -0
- package/esm/src/cli/bunProject.d.ts.map +1 -0
- package/esm/src/cli/bunProject.js +309 -0
- package/esm/src/cli/bunProject.js.map +1 -0
- package/esm/src/cli/cliBootstrap.d.ts +83 -0
- package/esm/src/cli/cliBootstrap.d.ts.map +1 -0
- package/esm/src/cli/cliBootstrap.js +186 -0
- package/esm/src/cli/cliBootstrap.js.map +1 -0
- package/esm/src/cli/externalSkills.d.ts.map +1 -1
- package/esm/src/cli/externalSkills.js +9 -5
- package/esm/src/cli/externalSkills.js.map +1 -0
- package/esm/src/cli/filesR2Policy.d.ts.map +1 -1
- package/esm/src/cli/filesR2Policy.js +18 -11
- package/esm/src/cli/filesR2Policy.js.map +1 -0
- package/esm/src/cli/generatedBuild.d.ts +42 -0
- package/esm/src/cli/generatedBuild.d.ts.map +1 -0
- package/esm/src/cli/generatedBuild.js +259 -0
- package/esm/src/cli/generatedBuild.js.map +1 -0
- package/esm/src/cli/generatedCleanup.d.ts +7 -0
- package/esm/src/cli/generatedCleanup.d.ts.map +1 -0
- package/esm/src/cli/generatedCleanup.js +67 -0
- package/esm/src/cli/generatedCleanup.js.map +1 -0
- package/esm/src/cli/generatedDevLease.d.ts +8 -0
- package/esm/src/cli/generatedDevLease.d.ts.map +1 -0
- package/esm/src/cli/generatedDevLease.js +39 -0
- package/esm/src/cli/generatedDevLease.js.map +1 -0
- package/esm/src/cli/generatedInstall.d.ts +64 -0
- package/esm/src/cli/generatedInstall.d.ts.map +1 -0
- package/esm/src/cli/generatedInstall.js +466 -0
- package/esm/src/cli/generatedInstall.js.map +1 -0
- package/esm/src/cli/generatedWorkflow.d.ts +34 -0
- package/esm/src/cli/generatedWorkflow.d.ts.map +1 -0
- package/esm/src/cli/generatedWorkflow.js +85 -0
- package/esm/src/cli/generatedWorkflow.js.map +1 -0
- package/esm/src/cli/legacyManagedOutputs.d.ts.map +1 -1
- package/esm/src/cli/legacyManagedOutputs.js +1 -0
- package/esm/src/cli/legacyManagedOutputs.js.map +1 -0
- package/esm/src/cli/localDb.d.ts.map +1 -1
- package/esm/src/cli/localDb.js +35 -30
- package/esm/src/cli/localDb.js.map +1 -0
- package/esm/src/cli/localDevLock.d.ts +9 -0
- package/esm/src/cli/localDevLock.d.ts.map +1 -1
- package/esm/src/cli/localDevLock.js +54 -13
- package/esm/src/cli/localDevLock.js.map +1 -0
- package/esm/src/cli/localDevPackage.d.ts +6 -11
- package/esm/src/cli/localDevPackage.d.ts.map +1 -1
- package/esm/src/cli/localDevPackage.js +51 -48
- package/esm/src/cli/localDevPackage.js.map +1 -0
- package/esm/src/cli/managedFiles.d.ts.map +1 -1
- package/esm/src/cli/managedFiles.js +34 -18
- package/esm/src/cli/managedFiles.js.map +1 -0
- package/esm/src/cli/migrationEnv.d.ts +16 -3
- package/esm/src/cli/migrationEnv.d.ts.map +1 -1
- package/esm/src/cli/migrationEnv.js +9 -6
- package/esm/src/cli/migrationEnv.js.map +1 -0
- package/esm/src/cli/mod.d.ts +20 -7
- package/esm/src/cli/mod.d.ts.map +1 -1
- package/esm/src/cli/mod.js +2148 -730
- package/esm/src/cli/mod.js.map +1 -0
- package/esm/src/cli/packageTreeSignature.d.ts +8 -0
- package/esm/src/cli/packageTreeSignature.d.ts.map +1 -0
- package/esm/src/cli/packageTreeSignature.js +60 -0
- package/esm/src/cli/packageTreeSignature.js.map +1 -0
- package/esm/src/cli/processIdentity.d.ts +7 -0
- package/esm/src/cli/processIdentity.d.ts.map +1 -0
- package/esm/src/cli/processIdentity.js +39 -0
- package/esm/src/cli/processIdentity.js.map +1 -0
- package/esm/src/cli/projectSkills.d.ts +1 -1
- package/esm/src/cli/projectSkills.d.ts.map +1 -1
- package/esm/src/cli/projectSkills.js +31 -23
- package/esm/src/cli/projectSkills.js.map +1 -0
- package/esm/src/cli/projectTooling.d.ts +6 -3
- package/esm/src/cli/projectTooling.d.ts.map +1 -1
- package/esm/src/cli/projectTooling.js +86 -41
- package/esm/src/cli/projectTooling.js.map +1 -0
- package/esm/src/cli/releaseConfig.d.ts.map +1 -1
- package/esm/src/cli/releaseConfig.js +5 -3
- package/esm/src/cli/releaseConfig.js.map +1 -0
- package/esm/src/cli/releaseCredentials.d.ts.map +1 -1
- package/esm/src/cli/releaseCredentials.js +19 -31
- package/esm/src/cli/releaseCredentials.js.map +1 -0
- package/esm/src/cli/releaseTrust.d.ts.map +1 -1
- package/esm/src/cli/releaseTrust.js +11 -4
- package/esm/src/cli/releaseTrust.js.map +1 -0
- package/esm/src/cli/releaseTrustCommand.d.ts.map +1 -1
- package/esm/src/cli/releaseTrustCommand.js +6 -4
- package/esm/src/cli/releaseTrustCommand.js.map +1 -0
- package/esm/src/cli/sourceConfig.d.ts +3 -0
- package/esm/src/cli/sourceConfig.d.ts.map +1 -0
- package/esm/src/cli/sourceConfig.js +91 -0
- package/esm/src/cli/sourceConfig.js.map +1 -0
- package/esm/src/cli/sourceDev.d.ts +77 -0
- package/esm/src/cli/sourceDev.d.ts.map +1 -0
- package/esm/src/cli/sourceDev.js +974 -0
- package/esm/src/cli/sourceDev.js.map +1 -0
- package/esm/src/cli/vercelBuildEnv.d.ts.map +1 -1
- package/esm/src/cli/vercelBuildEnv.js +44 -21
- package/esm/src/cli/vercelBuildEnv.js.map +1 -0
- package/esm/src/cli/vercelEnvMask.d.ts +38 -0
- package/esm/src/cli/vercelEnvMask.d.ts.map +1 -0
- package/esm/src/cli/vercelEnvMask.js +140 -0
- package/esm/src/cli/vercelEnvMask.js.map +1 -0
- package/esm/src/cli/vercelProjectRelease.d.ts.map +1 -1
- package/esm/src/cli/vercelProjectRelease.js +47 -24
- package/esm/src/cli/vercelProjectRelease.js.map +1 -0
- package/esm/src/cli/vercelPulledEnv.d.ts +65 -0
- package/esm/src/cli/vercelPulledEnv.d.ts.map +1 -0
- package/esm/src/cli/vercelPulledEnv.js +133 -0
- package/esm/src/cli/vercelPulledEnv.js.map +1 -0
- package/esm/src/clientData/identity.d.ts.map +1 -1
- package/esm/src/clientData/identity.js +1 -0
- package/esm/src/clientData/identity.js.map +1 -0
- package/esm/src/clientData/mod.d.ts +0 -1
- package/esm/src/clientData/mod.d.ts.map +1 -1
- package/esm/src/clientData/mod.js +1 -0
- package/esm/src/clientData/mod.js.map +1 -0
- package/esm/src/files/client.d.ts +1 -1
- package/esm/src/files/client.d.ts.map +1 -1
- package/esm/src/files/client.js +3 -4
- package/esm/src/files/client.js.map +1 -0
- package/esm/src/files/errors.d.ts.map +1 -1
- package/esm/src/files/errors.js +3 -12
- package/esm/src/files/errors.js.map +1 -0
- package/esm/src/files/hash.d.ts +1 -1
- package/esm/src/files/hash.d.ts.map +1 -1
- package/esm/src/files/hash.js +1 -0
- package/esm/src/files/hash.js.map +1 -0
- package/esm/src/files/memory.d.ts.map +1 -1
- package/esm/src/files/memory.js +2 -1
- package/esm/src/files/memory.js.map +1 -0
- package/esm/src/files/metadata.d.ts.map +1 -1
- package/esm/src/files/metadata.js +11 -18
- package/esm/src/files/metadata.js.map +1 -0
- package/esm/src/files/mod.d.ts +0 -1
- package/esm/src/files/mod.d.ts.map +1 -1
- package/esm/src/files/mod.js +1 -1
- package/esm/src/files/mod.js.map +1 -0
- package/esm/src/files/s3.d.ts.map +1 -1
- package/esm/src/files/s3.js +6 -4
- package/esm/src/files/s3.js.map +1 -0
- package/esm/src/files/service.d.ts.map +1 -1
- package/esm/src/files/service.js +3 -4
- package/esm/src/files/service.js.map +1 -0
- package/esm/src/files/types.d.ts.map +1 -1
- package/esm/src/files/types.js +1 -0
- package/esm/src/files/types.js.map +1 -0
- package/esm/src/jobs/catalog.d.ts.map +1 -1
- package/esm/src/jobs/catalog.js +5 -1
- package/esm/src/jobs/catalog.js.map +1 -0
- package/esm/src/jobs/controller.d.ts +1 -1
- package/esm/src/jobs/controller.d.ts.map +1 -1
- package/esm/src/jobs/controller.js +11 -55
- package/esm/src/jobs/controller.js.map +1 -0
- package/esm/src/jobs/direct.d.ts.map +1 -1
- package/esm/src/jobs/direct.js +3 -3
- package/esm/src/jobs/direct.js.map +1 -0
- package/esm/src/jobs/events.d.ts.map +1 -1
- package/esm/src/jobs/events.js +1 -0
- package/esm/src/jobs/events.js.map +1 -0
- package/esm/src/jobs/format.d.ts +5 -5
- package/esm/src/jobs/format.d.ts.map +1 -1
- package/esm/src/jobs/format.js +2 -1
- package/esm/src/jobs/format.js.map +1 -0
- package/esm/src/jobs/http.d.ts +3 -3
- package/esm/src/jobs/http.d.ts.map +1 -1
- package/esm/src/jobs/http.js +1 -0
- package/esm/src/jobs/http.js.map +1 -0
- package/esm/src/jobs/log.d.ts.map +1 -1
- package/esm/src/jobs/log.js +1 -0
- package/esm/src/jobs/log.js.map +1 -0
- package/esm/src/jobs/mod.d.ts.map +1 -1
- package/esm/src/jobs/mod.js +1 -0
- package/esm/src/jobs/mod.js.map +1 -0
- package/esm/src/jobs/run.d.ts.map +1 -1
- package/esm/src/jobs/run.js +1 -0
- package/esm/src/jobs/run.js.map +1 -0
- package/esm/src/jobs/sanitize.d.ts.map +1 -1
- package/esm/src/jobs/sanitize.js +1 -0
- package/esm/src/jobs/sanitize.js.map +1 -0
- package/esm/src/jobs/types.d.ts +1 -0
- package/esm/src/jobs/types.d.ts.map +1 -1
- package/esm/src/jobs/types.js +1 -0
- package/esm/src/jobs/types.js.map +1 -0
- package/esm/src/mail/errors.d.ts.map +1 -1
- package/esm/src/mail/errors.js +8 -42
- package/esm/src/mail/errors.js.map +1 -0
- package/esm/src/mail/memory.d.ts +1 -1
- package/esm/src/mail/memory.d.ts.map +1 -1
- package/esm/src/mail/memory.js +10 -14
- package/esm/src/mail/memory.js.map +1 -0
- package/esm/src/mail/mod.d.ts +0 -1
- package/esm/src/mail/mod.d.ts.map +1 -1
- package/esm/src/mail/mod.js +1 -1
- package/esm/src/mail/mod.js.map +1 -0
- package/esm/src/mail/postal.d.ts +1 -2
- package/esm/src/mail/postal.d.ts.map +1 -1
- package/esm/src/mail/postal.js +22 -18
- package/esm/src/mail/postal.js.map +1 -0
- package/esm/src/mail/retry.d.ts.map +1 -1
- package/esm/src/mail/retry.js +1 -0
- package/esm/src/mail/retry.js.map +1 -0
- package/esm/src/mail/sender.d.ts.map +1 -1
- package/esm/src/mail/sender.js +1 -0
- package/esm/src/mail/sender.js.map +1 -0
- package/esm/src/mail/service.d.ts.map +1 -1
- package/esm/src/mail/service.js +6 -7
- package/esm/src/mail/service.js.map +1 -0
- package/esm/src/mail/types.d.ts.map +1 -1
- package/esm/src/mail/types.js +1 -0
- package/esm/src/mail/types.js.map +1 -0
- package/esm/src/mui/apiKeys.d.ts +10 -11
- package/esm/src/mui/apiKeys.d.ts.map +1 -1
- package/esm/src/mui/apiKeys.js +83 -214
- package/esm/src/mui/apiKeys.js.map +1 -0
- package/esm/src/mui/apiKeysView.d.ts +1 -1
- package/esm/src/mui/apiKeysView.d.ts.map +1 -1
- package/esm/src/mui/apiKeysView.js +11 -9
- package/esm/src/mui/apiKeysView.js.map +1 -0
- package/esm/src/mui/confirm.d.ts +2 -2
- package/esm/src/mui/confirm.d.ts.map +1 -1
- package/esm/src/mui/confirm.js +3 -7
- package/esm/src/mui/confirm.js.map +1 -0
- package/esm/src/mui/mail.d.ts +4 -4
- package/esm/src/mui/mail.d.ts.map +1 -1
- package/esm/src/mui/mail.js +11 -71
- package/esm/src/mui/mail.js.map +1 -0
- package/esm/src/mui/mailView.d.ts +1 -1
- package/esm/src/mui/mailView.d.ts.map +1 -1
- package/esm/src/mui/mailView.js +1 -0
- package/esm/src/mui/mailView.js.map +1 -0
- package/esm/src/mui/mod.d.ts +0 -1
- package/esm/src/mui/mod.d.ts.map +1 -1
- package/esm/src/mui/mod.js +1 -0
- package/esm/src/mui/mod.js.map +1 -0
- package/esm/src/next/apiKeys/mod.d.ts +2 -3
- package/esm/src/next/apiKeys/mod.d.ts.map +1 -1
- package/esm/src/next/apiKeys/mod.js +6 -5
- package/esm/src/next/apiKeys/mod.js.map +1 -0
- package/esm/src/next/auth/client.d.ts +0 -1
- package/esm/src/next/auth/client.d.ts.map +1 -1
- package/esm/src/next/auth/client.js +1 -0
- package/esm/src/next/auth/client.js.map +1 -0
- package/esm/src/next/auth/config.d.ts.map +1 -1
- package/esm/src/next/auth/config.js +11 -17
- package/esm/src/next/auth/config.js.map +1 -0
- package/esm/src/next/auth/localTestLogin.d.ts.map +1 -1
- package/esm/src/next/auth/localTestLogin.js +13 -9
- package/esm/src/next/auth/localTestLogin.js.map +1 -0
- package/esm/src/next/auth/mod.d.ts.map +1 -1
- package/esm/src/next/auth/mod.js +1 -0
- package/esm/src/next/auth/mod.js.map +1 -0
- package/esm/src/next/auth/server.d.ts +2 -2
- package/esm/src/next/auth/server.d.ts.map +1 -1
- package/esm/src/next/auth/server.js +1 -0
- package/esm/src/next/auth/server.js.map +1 -0
- package/esm/src/next/files/mod.d.ts +0 -1
- package/esm/src/next/files/mod.d.ts.map +1 -1
- package/esm/src/next/files/mod.js +1 -1
- package/esm/src/next/files/mod.js.map +1 -0
- package/esm/src/next/files/route.d.ts +1 -1
- package/esm/src/next/files/route.d.ts.map +1 -1
- package/esm/src/next/files/route.js +11 -11
- package/esm/src/next/files/route.js.map +1 -0
- package/esm/src/next/jobs/list.d.ts +5 -5
- package/esm/src/next/jobs/list.d.ts.map +1 -1
- package/esm/src/next/jobs/list.js +15 -19
- package/esm/src/next/jobs/list.js.map +1 -0
- package/esm/src/next/jobs/mod.d.ts.map +1 -1
- package/esm/src/next/jobs/mod.js +1 -0
- package/esm/src/next/jobs/mod.js.map +1 -0
- package/esm/src/next/jobs/paths.d.ts +2 -2
- package/esm/src/next/jobs/paths.d.ts.map +1 -1
- package/esm/src/next/jobs/paths.js +1 -0
- package/esm/src/next/jobs/paths.js.map +1 -0
- package/esm/src/next/jobs/route.d.ts +2 -2
- package/esm/src/next/jobs/route.d.ts.map +1 -1
- package/esm/src/next/jobs/route.js +4 -4
- package/esm/src/next/jobs/route.js.map +1 -0
- package/esm/src/next/jobs/run.d.ts +2 -2
- package/esm/src/next/jobs/run.d.ts.map +1 -1
- package/esm/src/next/jobs/run.js +68 -132
- package/esm/src/next/jobs/run.js.map +1 -0
- package/esm/src/next/jobs/runRequest.d.ts +1 -1
- package/esm/src/next/jobs/runRequest.d.ts.map +1 -1
- package/esm/src/next/jobs/runRequest.js +3 -4
- package/esm/src/next/jobs/runRequest.js.map +1 -0
- package/esm/src/next/jobs/stream.d.ts.map +1 -1
- package/esm/src/next/jobs/stream.js +1 -0
- package/esm/src/next/jobs/stream.js.map +1 -0
- package/esm/src/next/mail/mod.d.ts +0 -1
- package/esm/src/next/mail/mod.d.ts.map +1 -1
- package/esm/src/next/mail/mod.js +1 -1
- package/esm/src/next/mail/mod.js.map +1 -0
- package/esm/src/next/mail/route.d.ts +2 -2
- package/esm/src/next/mail/route.d.ts.map +1 -1
- package/esm/src/next/mail/route.js +1 -0
- package/esm/src/next/mail/route.js.map +1 -0
- package/esm/src/next/pwa/mod.d.ts +0 -4
- package/esm/src/next/pwa/mod.d.ts.map +1 -1
- package/esm/src/next/pwa/mod.js +32 -16
- package/esm/src/next/pwa/mod.js.map +1 -0
- package/esm/src/next/pwa/worker.d.ts +0 -1
- package/esm/src/next/pwa/worker.d.ts.map +1 -1
- package/esm/src/next/pwa/worker.js +1 -0
- package/esm/src/next/pwa/worker.js.map +1 -0
- package/esm/src/next/secrets/constants.d.ts +3 -0
- package/esm/src/next/secrets/constants.d.ts.map +1 -0
- package/esm/src/next/secrets/constants.js +3 -0
- package/esm/src/next/secrets/constants.js.map +1 -0
- package/esm/src/next/secrets/mod.d.ts +1 -3
- package/esm/src/next/secrets/mod.d.ts.map +1 -1
- package/esm/src/next/secrets/mod.js +6 -7
- package/esm/src/next/secrets/mod.js.map +1 -0
- package/esm/src/next/sourceDev.d.ts +6 -0
- package/esm/src/next/sourceDev.d.ts.map +1 -0
- package/esm/src/next/sourceDev.js +41 -0
- package/esm/src/next/sourceDev.js.map +1 -0
- package/esm/src/secrets/encoding.d.ts.map +1 -1
- package/esm/src/secrets/encoding.js +1 -0
- package/esm/src/secrets/encoding.js.map +1 -0
- package/esm/src/secrets/errors.d.ts.map +1 -1
- package/esm/src/secrets/errors.js +3 -7
- package/esm/src/secrets/errors.js.map +1 -0
- package/esm/src/secrets/fingerprint.d.ts.map +1 -1
- package/esm/src/secrets/fingerprint.js +1 -0
- package/esm/src/secrets/fingerprint.js.map +1 -0
- package/esm/src/secrets/frame.d.ts.map +1 -1
- package/esm/src/secrets/frame.js +4 -3
- package/esm/src/secrets/frame.js.map +1 -0
- package/esm/src/secrets/keyring.d.ts.map +1 -1
- package/esm/src/secrets/keyring.js +6 -6
- package/esm/src/secrets/keyring.js.map +1 -0
- package/esm/src/secrets/legacy.d.ts +0 -1
- package/esm/src/secrets/legacy.d.ts.map +1 -1
- package/esm/src/secrets/legacy.js +13 -10
- package/esm/src/secrets/legacy.js.map +1 -0
- package/esm/src/secrets/maintenance.d.ts +0 -1
- package/esm/src/secrets/maintenance.d.ts.map +1 -1
- package/esm/src/secrets/maintenance.js +9 -24
- package/esm/src/secrets/maintenance.js.map +1 -0
- package/esm/src/secrets/mod.d.ts +0 -1
- package/esm/src/secrets/mod.d.ts.map +1 -1
- package/esm/src/secrets/mod.js +1 -1
- package/esm/src/secrets/mod.js.map +1 -0
- package/esm/src/secrets/secrets.d.ts.map +1 -1
- package/esm/src/secrets/secrets.js +38 -30
- package/esm/src/secrets/secrets.js.map +1 -0
- package/package.json +111 -135
- package/skills/loom/SKILL.md +40 -5
- package/skills/loom/references/dependency-upgrades.md +4 -0
- package/skills/loom/references/esm-package.md +35 -0
- package/skills/loom/references/local-development.md +261 -29
- package/skills/loom/references/release-safety.md +10 -3
- package/skills/loom-auth/references/secrets-and-rotation.md +2 -1
- package/skills/loom-mail/SKILL.md +1 -0
- package/skills/loom-scaffold/references/greenfield-workflow.md +2 -1
- package/skills/upgrade-deps/SKILL.md +4 -2
- package/source/bin/loom.ts +50 -0
- package/source/mod.ts +10 -0
- package/source/src/apiKeys/authorize.ts +294 -0
- package/source/src/apiKeys/betterAuth.ts +253 -0
- package/source/src/apiKeys/country.ts +7 -0
- package/source/src/apiKeys/credentials.ts +171 -0
- package/source/src/apiKeys/fingerprint.ts +10 -0
- package/{script/src/apiKeys/lifecycle.d.ts → source/src/apiKeys/lifecycle.ts} +21 -23
- package/source/src/apiKeys/limits.ts +372 -0
- package/source/src/apiKeys/mod.ts +11 -0
- package/source/src/apiKeys/permissions.ts +153 -0
- package/source/src/apiKeys/policy.ts +189 -0
- package/source/src/apiKeys/retention.ts +136 -0
- package/source/src/apiKeys/types.ts +288 -0
- package/source/src/cli/atomicText.ts +38 -0
- package/source/src/cli/bunLocalDev.ts +646 -0
- package/source/src/cli/bunProject.ts +433 -0
- package/source/src/cli/cliBootstrap.ts +313 -0
- package/source/src/cli/externalSkills.ts +315 -0
- package/source/src/cli/filesR2Policy.ts +212 -0
- package/source/src/cli/generatedBuild.ts +380 -0
- package/source/src/cli/generatedCleanup.ts +87 -0
- package/source/src/cli/generatedDevLease.ts +52 -0
- package/source/src/cli/generatedInstall.ts +630 -0
- package/source/src/cli/generatedWorkflow.ts +135 -0
- package/{script/src/cli/legacyManagedOutputs.js → source/src/cli/legacyManagedOutputs.ts} +36 -30
- package/source/src/cli/localDb.ts +548 -0
- package/source/src/cli/localDevLock.ts +462 -0
- package/source/src/cli/localDevPackage.ts +754 -0
- package/source/src/cli/managedFiles.ts +688 -0
- package/source/src/cli/migrationEnv.ts +267 -0
- package/source/src/cli/mod.ts +26788 -0
- package/source/src/cli/packageTreeSignature.ts +65 -0
- package/source/src/cli/processIdentity.ts +38 -0
- package/source/src/cli/projectSkills.ts +1102 -0
- package/source/src/cli/projectTooling.ts +1140 -0
- package/source/src/cli/releaseConfig.ts +36 -0
- package/source/src/cli/releaseCredentials.ts +642 -0
- package/source/src/cli/releaseTrust.ts +194 -0
- package/source/src/cli/releaseTrustCommand.ts +210 -0
- package/source/src/cli/sourceConfig.ts +106 -0
- package/source/src/cli/sourceDev.ts +1279 -0
- package/source/src/cli/vercelBuildEnv.ts +714 -0
- package/source/src/cli/vercelEnvMask.ts +182 -0
- package/source/src/cli/vercelProjectRelease.ts +807 -0
- package/source/src/cli/vercelPulledEnv.ts +174 -0
- package/source/src/clientData/identity.ts +229 -0
- package/source/src/clientData/mod.ts +1 -0
- package/source/src/files/client.ts +75 -0
- package/source/src/files/errors.ts +69 -0
- package/source/src/files/hash.ts +109 -0
- package/source/src/files/memory.ts +158 -0
- package/source/src/files/metadata.ts +251 -0
- package/source/src/files/mod.ts +8 -0
- package/source/src/files/s3.ts +182 -0
- package/source/src/files/service.ts +210 -0
- package/source/src/files/types.ts +171 -0
- package/source/src/jobs/catalog.ts +303 -0
- package/source/src/jobs/controller.ts +156 -0
- package/source/src/jobs/direct.ts +177 -0
- package/source/src/jobs/events.ts +74 -0
- package/source/src/jobs/format.ts +233 -0
- package/source/src/jobs/http.ts +83 -0
- package/source/src/jobs/log.ts +10 -0
- package/source/src/jobs/mod.ts +10 -0
- package/source/src/jobs/run.ts +141 -0
- package/source/src/jobs/sanitize.ts +142 -0
- package/source/src/jobs/types.ts +43 -0
- package/source/src/mail/errors.ts +77 -0
- package/source/src/mail/memory.ts +451 -0
- package/source/src/mail/mod.ts +5 -0
- package/source/src/mail/postal.ts +363 -0
- package/source/src/mail/retry.ts +30 -0
- package/source/src/mail/sender.ts +57 -0
- package/source/src/mail/service.ts +252 -0
- package/source/src/mail/types.ts +229 -0
- package/source/src/mui/apiKeys.tsx +1044 -0
- package/source/src/mui/apiKeysView.ts +535 -0
- package/source/src/mui/confirm.tsx +138 -0
- package/source/src/mui/mail.tsx +279 -0
- package/source/src/mui/mailView.ts +50 -0
- package/source/src/mui/mod.ts +3 -0
- package/source/src/next/apiKeys/mod.ts +393 -0
- package/{script/src/next/auth/client.d.ts → source/src/next/auth/client.ts} +19 -5
- package/source/src/next/auth/config.ts +207 -0
- package/source/src/next/auth/localTestLogin.ts +412 -0
- package/source/src/next/auth/mod.ts +3 -0
- package/source/src/next/auth/server.ts +94 -0
- package/source/src/next/files/mod.ts +1 -0
- package/source/src/next/files/route.ts +621 -0
- package/source/src/next/jobs/list.tsx +90 -0
- package/source/src/next/jobs/mod.ts +5 -0
- package/source/src/next/jobs/paths.ts +70 -0
- package/source/src/next/jobs/route.ts +207 -0
- package/source/src/next/jobs/run.tsx +888 -0
- package/source/src/next/jobs/runRequest.ts +92 -0
- package/source/src/next/jobs/stream.ts +33 -0
- package/source/src/next/mail/mod.ts +1 -0
- package/source/src/next/mail/route.ts +75 -0
- package/source/src/next/pwa/mod.tsx +453 -0
- package/source/src/next/pwa/worker.ts +59 -0
- package/source/src/next/secrets/constants.ts +2 -0
- package/source/src/next/secrets/mod.ts +319 -0
- package/source/src/next/sourceDev.ts +50 -0
- package/source/src/secrets/encoding.ts +102 -0
- package/source/src/secrets/errors.ts +58 -0
- package/source/src/secrets/fingerprint.ts +132 -0
- package/source/src/secrets/frame.ts +119 -0
- package/source/src/secrets/keyring.ts +225 -0
- package/source/src/secrets/legacy.ts +244 -0
- package/source/src/secrets/maintenance.ts +517 -0
- package/source/src/secrets/mod.ts +38 -0
- package/source/src/secrets/secrets.ts +926 -0
- package/db/databaseTls.test.ts +0 -171
- package/db/databaseUrl.test.ts +0 -72
- package/db/neonEndpoint.test.ts +0 -51
- package/db/testing.test.ts +0 -28
- package/deno.json +0 -3
- package/esm/_dnt.polyfills.d.ts +0 -166
- package/esm/_dnt.polyfills.d.ts.map +0 -1
- package/esm/_dnt.polyfills.js +0 -177
- package/esm/_dnt.shims.d.ts +0 -2
- package/esm/_dnt.shims.d.ts.map +0 -1
- package/esm/_dnt.shims.js +0 -57
- package/esm/package.json +0 -3
- package/script/_dnt.polyfills.d.ts +0 -166
- package/script/_dnt.polyfills.d.ts.map +0 -1
- package/script/_dnt.polyfills.js +0 -180
- package/script/_dnt.shims.d.ts +0 -2
- package/script/_dnt.shims.d.ts.map +0 -1
- package/script/_dnt.shims.js +0 -60
- package/script/bin/loom.d.ts +0 -2
- package/script/bin/loom.d.ts.map +0 -1
- package/script/bin/loom.js +0 -17
- package/script/mod.d.ts +0 -12
- package/script/mod.d.ts.map +0 -1
- package/script/mod.js +0 -27
- package/script/package.json +0 -3
- package/script/src/apiKeys/authorize.d.ts +0 -4
- package/script/src/apiKeys/authorize.d.ts.map +0 -1
- package/script/src/apiKeys/authorize.js +0 -258
- package/script/src/apiKeys/betterAuth.d.ts +0 -123
- package/script/src/apiKeys/betterAuth.d.ts.map +0 -1
- package/script/src/apiKeys/betterAuth.js +0 -169
- package/script/src/apiKeys/country.d.ts +0 -3
- package/script/src/apiKeys/country.d.ts.map +0 -1
- package/script/src/apiKeys/country.js +0 -10
- package/script/src/apiKeys/credentials.d.ts +0 -39
- package/script/src/apiKeys/credentials.d.ts.map +0 -1
- package/script/src/apiKeys/credentials.js +0 -121
- package/script/src/apiKeys/fingerprint.d.ts +0 -3
- package/script/src/apiKeys/fingerprint.d.ts.map +0 -1
- package/script/src/apiKeys/fingerprint.js +0 -8
- package/script/src/apiKeys/lifecycle.d.ts.map +0 -1
- package/script/src/apiKeys/lifecycle.js +0 -7
- package/script/src/apiKeys/limits.d.ts +0 -132
- package/script/src/apiKeys/limits.d.ts.map +0 -1
- package/script/src/apiKeys/limits.js +0 -254
- package/script/src/apiKeys/mod.d.ts +0 -13
- package/script/src/apiKeys/mod.d.ts.map +0 -1
- package/script/src/apiKeys/mod.js +0 -28
- package/script/src/apiKeys/permissions.d.ts +0 -56
- package/script/src/apiKeys/permissions.d.ts.map +0 -1
- package/script/src/apiKeys/permissions.js +0 -136
- package/script/src/apiKeys/policy.d.ts +0 -61
- package/script/src/apiKeys/policy.d.ts.map +0 -1
- package/script/src/apiKeys/policy.js +0 -94
- package/script/src/apiKeys/retention.d.ts +0 -55
- package/script/src/apiKeys/retention.d.ts.map +0 -1
- package/script/src/apiKeys/retention.js +0 -70
- package/script/src/apiKeys/types.d.ts +0 -242
- package/script/src/apiKeys/types.d.ts.map +0 -1
- package/script/src/apiKeys/types.js +0 -2
- package/script/src/cli/externalSkills.d.ts +0 -39
- package/script/src/cli/externalSkills.d.ts.map +0 -1
- package/script/src/cli/externalSkills.js +0 -204
- package/script/src/cli/filesR2Policy.d.ts +0 -33
- package/script/src/cli/filesR2Policy.d.ts.map +0 -1
- package/script/src/cli/filesR2Policy.js +0 -135
- package/script/src/cli/legacyManagedOutputs.d.ts +0 -33
- package/script/src/cli/legacyManagedOutputs.d.ts.map +0 -1
- package/script/src/cli/localDb.d.ts +0 -28
- package/script/src/cli/localDb.d.ts.map +0 -1
- package/script/src/cli/localDb.js +0 -370
- package/script/src/cli/localDevLock.d.ts +0 -97
- package/script/src/cli/localDevLock.d.ts.map +0 -1
- package/script/src/cli/localDevLock.js +0 -320
- package/script/src/cli/localDevPackage.d.ts +0 -172
- package/script/src/cli/localDevPackage.d.ts.map +0 -1
- package/script/src/cli/localDevPackage.js +0 -635
- package/script/src/cli/managedFiles.d.ts +0 -131
- package/script/src/cli/managedFiles.d.ts.map +0 -1
- package/script/src/cli/managedFiles.js +0 -536
- package/script/src/cli/migrationEnv.d.ts +0 -63
- package/script/src/cli/migrationEnv.d.ts.map +0 -1
- package/script/src/cli/migrationEnv.js +0 -217
- package/script/src/cli/mod.d.ts +0 -581
- package/script/src/cli/mod.d.ts.map +0 -1
- package/script/src/cli/mod.js +0 -16850
- package/script/src/cli/projectSkills.d.ts +0 -109
- package/script/src/cli/projectSkills.d.ts.map +0 -1
- package/script/src/cli/projectSkills.js +0 -749
- package/script/src/cli/projectTooling.d.ts +0 -164
- package/script/src/cli/projectTooling.d.ts.map +0 -1
- package/script/src/cli/projectTooling.js +0 -847
- package/script/src/cli/releaseConfig.d.ts +0 -10
- package/script/src/cli/releaseConfig.d.ts.map +0 -1
- package/script/src/cli/releaseConfig.js +0 -26
- package/script/src/cli/releaseCredentials.d.ts +0 -32
- package/script/src/cli/releaseCredentials.d.ts.map +0 -1
- package/script/src/cli/releaseCredentials.js +0 -392
- package/script/src/cli/releaseTrust.d.ts +0 -39
- package/script/src/cli/releaseTrust.d.ts.map +0 -1
- package/script/src/cli/releaseTrust.js +0 -130
- package/script/src/cli/releaseTrustCommand.d.ts +0 -18
- package/script/src/cli/releaseTrustCommand.d.ts.map +0 -1
- package/script/src/cli/releaseTrustCommand.js +0 -145
- package/script/src/cli/vercelBuildEnv.d.ts +0 -62
- package/script/src/cli/vercelBuildEnv.d.ts.map +0 -1
- package/script/src/cli/vercelBuildEnv.js +0 -401
- package/script/src/cli/vercelProjectRelease.d.ts +0 -38
- package/script/src/cli/vercelProjectRelease.d.ts.map +0 -1
- package/script/src/cli/vercelProjectRelease.js +0 -607
- package/script/src/clientData/identity.d.ts +0 -89
- package/script/src/clientData/identity.d.ts.map +0 -1
- package/script/src/clientData/identity.js +0 -134
- package/script/src/clientData/mod.d.ts +0 -3
- package/script/src/clientData/mod.d.ts.map +0 -1
- package/script/src/clientData/mod.js +0 -18
- package/script/src/files/client.d.ts +0 -29
- package/script/src/files/client.d.ts.map +0 -1
- package/script/src/files/client.js +0 -45
- package/script/src/files/errors.d.ts +0 -37
- package/script/src/files/errors.d.ts.map +0 -1
- package/script/src/files/errors.js +0 -76
- package/script/src/files/hash.d.ts +0 -15
- package/script/src/files/hash.d.ts.map +0 -1
- package/script/src/files/hash.js +0 -89
- package/script/src/files/memory.d.ts +0 -29
- package/script/src/files/memory.d.ts.map +0 -1
- package/script/src/files/memory.js +0 -113
- package/script/src/files/metadata.d.ts +0 -10
- package/script/src/files/metadata.d.ts.map +0 -1
- package/script/src/files/metadata.js +0 -189
- package/script/src/files/mod.d.ts +0 -10
- package/script/src/files/mod.d.ts.map +0 -1
- package/script/src/files/mod.js +0 -25
- package/script/src/files/s3.d.ts +0 -29
- package/script/src/files/s3.d.ts.map +0 -1
- package/script/src/files/s3.js +0 -110
- package/script/src/files/service.d.ts +0 -27
- package/script/src/files/service.d.ts.map +0 -1
- package/script/src/files/service.js +0 -139
- package/script/src/files/types.d.ts +0 -134
- package/script/src/files/types.d.ts.map +0 -1
- package/script/src/files/types.js +0 -2
- package/script/src/jobs/catalog.d.ts +0 -32
- package/script/src/jobs/catalog.d.ts.map +0 -1
- package/script/src/jobs/catalog.js +0 -223
- package/script/src/jobs/controller.d.ts +0 -41
- package/script/src/jobs/controller.d.ts.map +0 -1
- package/script/src/jobs/controller.js +0 -151
- package/script/src/jobs/direct.d.ts +0 -36
- package/script/src/jobs/direct.d.ts.map +0 -1
- package/script/src/jobs/direct.js +0 -128
- package/script/src/jobs/events.d.ts +0 -23
- package/script/src/jobs/events.d.ts.map +0 -1
- package/script/src/jobs/events.js +0 -50
- package/script/src/jobs/format.d.ts +0 -16
- package/script/src/jobs/format.d.ts.map +0 -1
- package/script/src/jobs/format.js +0 -193
- package/script/src/jobs/http.d.ts +0 -22
- package/script/src/jobs/http.d.ts.map +0 -1
- package/script/src/jobs/http.js +0 -50
- package/script/src/jobs/log.d.ts +0 -2
- package/script/src/jobs/log.d.ts.map +0 -1
- package/script/src/jobs/log.js +0 -13
- package/script/src/jobs/mod.d.ts +0 -11
- package/script/src/jobs/mod.d.ts.map +0 -1
- package/script/src/jobs/mod.js +0 -26
- package/script/src/jobs/run.d.ts +0 -39
- package/script/src/jobs/run.d.ts.map +0 -1
- package/script/src/jobs/run.js +0 -86
- package/script/src/jobs/sanitize.d.ts +0 -30
- package/script/src/jobs/sanitize.d.ts.map +0 -1
- package/script/src/jobs/sanitize.js +0 -97
- package/script/src/jobs/types.d.ts +0 -31
- package/script/src/jobs/types.d.ts.map +0 -1
- package/script/src/jobs/types.js +0 -2
- package/script/src/mail/errors.d.ts +0 -33
- package/script/src/mail/errors.d.ts.map +0 -1
- package/script/src/mail/errors.js +0 -97
- package/script/src/mail/memory.d.ts +0 -30
- package/script/src/mail/memory.d.ts.map +0 -1
- package/script/src/mail/memory.js +0 -345
- package/script/src/mail/mod.d.ts +0 -7
- package/script/src/mail/mod.d.ts.map +0 -1
- package/script/src/mail/mod.js +0 -22
- package/script/src/mail/postal.d.ts +0 -57
- package/script/src/mail/postal.d.ts.map +0 -1
- package/script/src/mail/postal.js +0 -251
- package/script/src/mail/retry.d.ts +0 -9
- package/script/src/mail/retry.d.ts.map +0 -1
- package/script/src/mail/retry.js +0 -22
- package/script/src/mail/sender.d.ts +0 -5
- package/script/src/mail/sender.d.ts.map +0 -1
- package/script/src/mail/sender.js +0 -52
- package/script/src/mail/service.d.ts +0 -23
- package/script/src/mail/service.d.ts.map +0 -1
- package/script/src/mail/service.js +0 -191
- package/script/src/mail/types.d.ts +0 -176
- package/script/src/mail/types.d.ts.map +0 -1
- package/script/src/mail/types.js +0 -2
- package/script/src/mui/apiKeys.d.ts +0 -171
- package/script/src/mui/apiKeys.d.ts.map +0 -1
- package/script/src/mui/apiKeys.js +0 -470
- package/script/src/mui/apiKeysView.d.ts +0 -193
- package/script/src/mui/apiKeysView.d.ts.map +0 -1
- package/script/src/mui/apiKeysView.js +0 -331
- package/script/src/mui/confirm.d.ts +0 -12
- package/script/src/mui/confirm.d.ts.map +0 -1
- package/script/src/mui/confirm.js +0 -85
- package/script/src/mui/mail.d.ts +0 -29
- package/script/src/mui/mail.d.ts.map +0 -1
- package/script/src/mui/mail.js +0 -159
- package/script/src/mui/mailView.d.ts +0 -20
- package/script/src/mui/mailView.d.ts.map +0 -1
- package/script/src/mui/mailView.js +0 -32
- package/script/src/mui/mod.d.ts +0 -5
- package/script/src/mui/mod.d.ts.map +0 -1
- package/script/src/mui/mod.js +0 -20
- package/script/src/next/apiKeys/mod.d.ts +0 -71
- package/script/src/next/apiKeys/mod.d.ts.map +0 -1
- package/script/src/next/apiKeys/mod.js +0 -227
- package/script/src/next/auth/client.d.ts.map +0 -1
- package/script/src/next/auth/client.js +0 -39
- package/script/src/next/auth/config.d.ts +0 -62
- package/script/src/next/auth/config.d.ts.map +0 -1
- package/script/src/next/auth/config.js +0 -178
- package/script/src/next/auth/localTestLogin.d.ts +0 -75
- package/script/src/next/auth/localTestLogin.d.ts.map +0 -1
- package/script/src/next/auth/localTestLogin.js +0 -291
- package/script/src/next/auth/mod.d.ts +0 -4
- package/script/src/next/auth/mod.d.ts.map +0 -1
- package/script/src/next/auth/mod.js +0 -19
- package/script/src/next/auth/server.d.ts +0 -44
- package/script/src/next/auth/server.d.ts.map +0 -1
- package/script/src/next/auth/server.js +0 -39
- package/script/src/next/files/mod.d.ts +0 -3
- package/script/src/next/files/mod.d.ts.map +0 -1
- package/script/src/next/files/mod.js +0 -18
- package/script/src/next/files/route.d.ts +0 -99
- package/script/src/next/files/route.d.ts.map +0 -1
- package/script/src/next/files/route.js +0 -353
- package/script/src/next/jobs/list.d.ts +0 -25
- package/script/src/next/jobs/list.d.ts.map +0 -1
- package/script/src/next/jobs/list.js +0 -48
- package/script/src/next/jobs/mod.d.ts +0 -6
- package/script/src/next/jobs/mod.d.ts.map +0 -1
- package/script/src/next/jobs/mod.js +0 -21
- package/script/src/next/jobs/paths.d.ts +0 -14
- package/script/src/next/jobs/paths.d.ts.map +0 -1
- package/script/src/next/jobs/paths.js +0 -47
- package/script/src/next/jobs/route.d.ts +0 -48
- package/script/src/next/jobs/route.d.ts.map +0 -1
- package/script/src/next/jobs/route.js +0 -105
- package/script/src/next/jobs/run.d.ts +0 -58
- package/script/src/next/jobs/run.d.ts.map +0 -1
- package/script/src/next/jobs/run.js +0 -592
- package/script/src/next/jobs/runRequest.d.ts +0 -19
- package/script/src/next/jobs/runRequest.d.ts.map +0 -1
- package/script/src/next/jobs/runRequest.js +0 -81
- package/script/src/next/jobs/stream.d.ts +0 -3
- package/script/src/next/jobs/stream.d.ts.map +0 -1
- package/script/src/next/jobs/stream.js +0 -28
- package/script/src/next/mail/mod.d.ts +0 -3
- package/script/src/next/mail/mod.d.ts.map +0 -1
- package/script/src/next/mail/mod.js +0 -18
- package/script/src/next/mail/route.d.ts +0 -12
- package/script/src/next/mail/route.d.ts.map +0 -1
- package/script/src/next/mail/route.js +0 -46
- package/script/src/next/pwa/mod.d.ts +0 -112
- package/script/src/next/pwa/mod.d.ts.map +0 -1
- package/script/src/next/pwa/mod.js +0 -303
- package/script/src/next/pwa/worker.d.ts +0 -27
- package/script/src/next/pwa/worker.d.ts.map +0 -1
- package/script/src/next/pwa/worker.js +0 -33
- package/script/src/next/secrets/mod.d.ts +0 -108
- package/script/src/next/secrets/mod.d.ts.map +0 -1
- package/script/src/next/secrets/mod.js +0 -218
- package/script/src/secrets/encoding.d.ts +0 -32
- package/script/src/secrets/encoding.d.ts.map +0 -1
- package/script/src/secrets/encoding.js +0 -95
- package/script/src/secrets/errors.d.ts +0 -45
- package/script/src/secrets/errors.d.ts.map +0 -1
- package/script/src/secrets/errors.js +0 -45
- package/script/src/secrets/fingerprint.d.ts +0 -43
- package/script/src/secrets/fingerprint.d.ts.map +0 -1
- package/script/src/secrets/fingerprint.js +0 -92
- package/script/src/secrets/frame.d.ts +0 -34
- package/script/src/secrets/frame.d.ts.map +0 -1
- package/script/src/secrets/frame.js +0 -91
- package/script/src/secrets/keyring.d.ts +0 -62
- package/script/src/secrets/keyring.d.ts.map +0 -1
- package/script/src/secrets/keyring.js +0 -202
- package/script/src/secrets/legacy.d.ts +0 -60
- package/script/src/secrets/legacy.d.ts.map +0 -1
- package/script/src/secrets/legacy.js +0 -186
- package/script/src/secrets/maintenance.d.ts +0 -173
- package/script/src/secrets/maintenance.d.ts.map +0 -1
- package/script/src/secrets/maintenance.js +0 -323
- package/script/src/secrets/mod.d.ts +0 -6
- package/script/src/secrets/mod.d.ts.map +0 -1
- package/script/src/secrets/mod.js +0 -24
- package/script/src/secrets/secrets.d.ts +0 -192
- package/script/src/secrets/secrets.d.ts.map +0 -1
- package/script/src/secrets/secrets.js +0 -532
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ApiKeyCredentialExtractionResult,
|
|
3
|
+
ApiKeyCredentialOptions,
|
|
4
|
+
ApiKeyCredentialSource,
|
|
5
|
+
ApiKeyCredentialTransport,
|
|
6
|
+
} from "./types.ts";
|
|
7
|
+
|
|
8
|
+
const DEFAULT_QUERY_NAME = "apiKey";
|
|
9
|
+
const DEFAULT_X_API_KEY_HEADER = "x-api-key";
|
|
10
|
+
|
|
11
|
+
/** `ApiKeyCredentialOptions` with Loom's defaults applied. */
|
|
12
|
+
export type ResolvedApiKeyCredentialOptions = Required<ApiKeyCredentialOptions>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Applies Loom's credential defaults: Bearer and the `x-api-key` header are
|
|
16
|
+
* accepted unless disabled, and query credentials only when enabled.
|
|
17
|
+
* `extractApiKeyCredential` uses the same resolution.
|
|
18
|
+
*/
|
|
19
|
+
export function resolveApiKeyCredentialOptions(
|
|
20
|
+
options: ApiKeyCredentialOptions = {},
|
|
21
|
+
): ResolvedApiKeyCredentialOptions {
|
|
22
|
+
return {
|
|
23
|
+
allowAuthorizationBearer: options.allowAuthorizationBearer !== false,
|
|
24
|
+
allowQuery: options.allowQuery === true,
|
|
25
|
+
allowXApiKey: options.allowXApiKey !== false,
|
|
26
|
+
queryName: options.queryName ?? DEFAULT_QUERY_NAME,
|
|
27
|
+
xApiKeyHeaderName: options.xApiKeyHeaderName ?? DEFAULT_X_API_KEY_HEADER,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The accepted transports of one `ApiKeyCredentialOptions`, for UI copy. */
|
|
32
|
+
export interface ApiKeyTransportDescription {
|
|
33
|
+
/** Accepted transports in preference order: Bearer, header, query. */
|
|
34
|
+
accepted: ApiKeyCredentialTransport[];
|
|
35
|
+
/** Whether `Authorization: Bearer <key>` is accepted. */
|
|
36
|
+
bearer: boolean;
|
|
37
|
+
/** The accepted `x-api-key` header name, or `null` when disabled. */
|
|
38
|
+
headerName: string | null;
|
|
39
|
+
/**
|
|
40
|
+
* The transport to recommend: Bearer when enabled, otherwise the header,
|
|
41
|
+
* and the query parameter only when it is the sole option. `null` when no
|
|
42
|
+
* transport is accepted.
|
|
43
|
+
*/
|
|
44
|
+
preferred: ApiKeyCredentialTransport | null;
|
|
45
|
+
/** The accepted query parameter name, or `null` when disabled. */
|
|
46
|
+
queryName: string | null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Describes which transports `options` accept and which to recommend, so UI
|
|
51
|
+
* copy can derive from the same object the authorizer uses. Pure and
|
|
52
|
+
* import-free at runtime, so client components can call it.
|
|
53
|
+
*/
|
|
54
|
+
export function describeApiKeyTransports(
|
|
55
|
+
options: ApiKeyCredentialOptions = {},
|
|
56
|
+
): ApiKeyTransportDescription {
|
|
57
|
+
const resolved = resolveApiKeyCredentialOptions(options);
|
|
58
|
+
const accepted: ApiKeyCredentialTransport[] = [];
|
|
59
|
+
if (resolved.allowAuthorizationBearer) accepted.push("authorization-bearer");
|
|
60
|
+
if (resolved.allowXApiKey) accepted.push("x-api-key");
|
|
61
|
+
if (resolved.allowQuery) accepted.push("query");
|
|
62
|
+
return {
|
|
63
|
+
accepted,
|
|
64
|
+
bearer: resolved.allowAuthorizationBearer,
|
|
65
|
+
headerName: resolved.allowXApiKey ? resolved.xApiKeyHeaderName : null,
|
|
66
|
+
preferred: accepted[0] ?? null,
|
|
67
|
+
queryName: resolved.allowQuery ? resolved.queryName : null,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type Candidate = {
|
|
72
|
+
/** More than one value arrived in this transport. */
|
|
73
|
+
ambiguous?: boolean;
|
|
74
|
+
credential?: string;
|
|
75
|
+
malformed?: boolean;
|
|
76
|
+
transport: ApiKeyCredentialTransport;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// API keys and Bearer tokens (RFC 6750) never contain a comma, so a comma
|
|
80
|
+
// means several credentials arrived, never one key. Repeated `x-api-key` lines
|
|
81
|
+
// reach `Headers.get` joined with ", " on Node and in fetch runtimes. Node's
|
|
82
|
+
// HTTP parser instead keeps only the first of repeated `Authorization` lines,
|
|
83
|
+
// so there the comma check only covers a literal comma in the header (and any
|
|
84
|
+
// runtime that joins); the first value still goes through full verification.
|
|
85
|
+
|
|
86
|
+
function bearerCandidate(headers: Headers): Candidate | null {
|
|
87
|
+
const value = headers.get("authorization");
|
|
88
|
+
if (value === null) return null;
|
|
89
|
+
if (value.includes(",")) {
|
|
90
|
+
return { ambiguous: true, transport: "authorization-bearer" };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// The auth-scheme name is case-insensitive (RFC 7235); the single space
|
|
94
|
+
// and the whitespace-free token are not relaxed.
|
|
95
|
+
const match = /^Bearer ([^\s]+)$/i.exec(value);
|
|
96
|
+
return match
|
|
97
|
+
? { credential: match[1], transport: "authorization-bearer" }
|
|
98
|
+
: { malformed: true, transport: "authorization-bearer" };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function valueCandidate(
|
|
102
|
+
value: string | null,
|
|
103
|
+
transport: ApiKeyCredentialTransport,
|
|
104
|
+
): Candidate | null {
|
|
105
|
+
if (value === null) return null;
|
|
106
|
+
if (transport === "x-api-key" && value.includes(",")) {
|
|
107
|
+
return { ambiguous: true, transport };
|
|
108
|
+
}
|
|
109
|
+
if (value.trim() === "" || value !== value.trim()) {
|
|
110
|
+
return { malformed: true, transport };
|
|
111
|
+
}
|
|
112
|
+
return { credential: value, transport };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function queryCandidate(
|
|
116
|
+
searchParams: URLSearchParams | undefined,
|
|
117
|
+
name: string,
|
|
118
|
+
): Candidate | null {
|
|
119
|
+
const values = searchParams?.getAll(name) ?? [];
|
|
120
|
+
if (values.length > 1) return { ambiguous: true, transport: "query" };
|
|
121
|
+
return valueCandidate(values[0] ?? null, "query");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Extracts exactly one API-key credential without selecting a precedence.
|
|
126
|
+
* Several transports, a repeated header (a comma in its value), or a repeated
|
|
127
|
+
* query parameter are `ambiguous`.
|
|
128
|
+
*/
|
|
129
|
+
export function extractApiKeyCredential(
|
|
130
|
+
source: ApiKeyCredentialSource,
|
|
131
|
+
options: ApiKeyCredentialOptions = {},
|
|
132
|
+
): ApiKeyCredentialExtractionResult {
|
|
133
|
+
const resolved = resolveApiKeyCredentialOptions(options);
|
|
134
|
+
const candidates: Candidate[] = [];
|
|
135
|
+
if (resolved.allowAuthorizationBearer) {
|
|
136
|
+
const candidate = bearerCandidate(source.headers);
|
|
137
|
+
if (candidate) candidates.push(candidate);
|
|
138
|
+
}
|
|
139
|
+
if (resolved.allowXApiKey) {
|
|
140
|
+
const candidate = valueCandidate(
|
|
141
|
+
source.headers.get(resolved.xApiKeyHeaderName),
|
|
142
|
+
"x-api-key",
|
|
143
|
+
);
|
|
144
|
+
if (candidate) candidates.push(candidate);
|
|
145
|
+
}
|
|
146
|
+
if (resolved.allowQuery) {
|
|
147
|
+
const candidate = queryCandidate(source.searchParams, resolved.queryName);
|
|
148
|
+
if (candidate) candidates.push(candidate);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (candidates.length === 0) return { kind: "missing" };
|
|
152
|
+
if (
|
|
153
|
+
candidates.length > 1 ||
|
|
154
|
+
candidates.some((candidate) => candidate.ambiguous)
|
|
155
|
+
) {
|
|
156
|
+
return {
|
|
157
|
+
kind: "ambiguous",
|
|
158
|
+
transports: candidates.map((candidate) => candidate.transport),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const candidate = candidates[0];
|
|
163
|
+
if (candidate.malformed || candidate.credential === undefined) {
|
|
164
|
+
return { kind: "malformed", transport: candidate.transport };
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
credential: candidate.credential,
|
|
168
|
+
kind: "present",
|
|
169
|
+
transport: candidate.transport,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Produces a lowercase SHA-256 fingerprint without retaining the credential. */
|
|
2
|
+
export async function fingerprintApiKeyCredential(credential: string) {
|
|
3
|
+
const digest = await crypto.subtle.digest(
|
|
4
|
+
"SHA-256",
|
|
5
|
+
new TextEncoder().encode(credential),
|
|
6
|
+
);
|
|
7
|
+
return Array.from(new Uint8Array(digest), (byte) =>
|
|
8
|
+
byte.toString(16).padStart(2, "0"),
|
|
9
|
+
).join("");
|
|
10
|
+
}
|
|
@@ -3,39 +3,37 @@
|
|
|
3
3
|
* the optional MUI components. This module has no runtime code, so server
|
|
4
4
|
* action files can import these types without touching a client module.
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
/** Input collected by the create dialog and passed to `onCreate`. */
|
|
7
8
|
export interface ApiKeyCreateInput {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
/**
|
|
10
|
+
* ISO timestamp, or `null` when "Never" was chosen. The plugin then applies
|
|
11
|
+
* `keyExpiration.defaultExpiresIn`, which must be `null` for "Never".
|
|
12
|
+
*/
|
|
13
|
+
expiresAt: string | null;
|
|
14
|
+
/** Trimmed key name. */
|
|
15
|
+
name: string;
|
|
16
|
+
scopeIds: string[];
|
|
16
17
|
}
|
|
18
|
+
|
|
17
19
|
/** The one-time secret and display fields returned after key creation. */
|
|
18
20
|
export interface ApiKeyCreateResult {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
key: string;
|
|
22
|
+
keyStart?: string;
|
|
23
|
+
name: string;
|
|
22
24
|
}
|
|
25
|
+
|
|
23
26
|
/**
|
|
24
27
|
* A user-correctable failure returned, rather than thrown, by a lifecycle
|
|
25
28
|
* action. Next.js replaces thrown Server Function messages with a generic one
|
|
26
29
|
* in production, so return this for messages the user must see.
|
|
27
30
|
*/
|
|
28
|
-
export type ApiKeyActionFailure = {
|
|
29
|
-
|
|
30
|
-
ok: false;
|
|
31
|
-
};
|
|
31
|
+
export type ApiKeyActionFailure = { message: string; ok: false };
|
|
32
|
+
|
|
32
33
|
/** Result-returning form of a create action (`onCreate`). */
|
|
33
|
-
export type ApiKeyCreateActionResult =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
export type ApiKeyCreateActionResult =
|
|
35
|
+
| { created: ApiKeyCreateResult; ok: true }
|
|
36
|
+
| ApiKeyActionFailure;
|
|
37
|
+
|
|
37
38
|
/** Result-returning form of a rename or revoke action. */
|
|
38
|
-
export type ApiKeyMutationResult = {
|
|
39
|
-
ok: true;
|
|
40
|
-
} | ApiKeyActionFailure;
|
|
41
|
-
//# sourceMappingURL=lifecycle.d.ts.map
|
|
39
|
+
export type ApiKeyMutationResult = { ok: true } | ApiKeyActionFailure;
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounds shared by API-key lifecycle validation, the MUI dialogs, and the
|
|
3
|
+
* consumer's Better Auth api-key plugin configuration.
|
|
4
|
+
*
|
|
5
|
+
* Pass the same values to the plugin (see `betterAuthApiKeyLimitOptions`) and
|
|
6
|
+
* to these validators so input the app accepts is never rejected later by the
|
|
7
|
+
* plugin with a raw library message.
|
|
8
|
+
*/
|
|
9
|
+
export interface ApiKeyLimits {
|
|
10
|
+
/**
|
|
11
|
+
* Longest custom expiry, in days (plugin `keyExpiration.maxExpiresIn`).
|
|
12
|
+
* Keys created without an expiry never expire and are not bound by this.
|
|
13
|
+
*/
|
|
14
|
+
maxExpiresInDays: number;
|
|
15
|
+
/** Longest trimmed key name (plugin `maximumNameLength`). */
|
|
16
|
+
maxNameLength: number;
|
|
17
|
+
/** Shortest custom expiry, in days (plugin `keyExpiration.minExpiresIn`). */
|
|
18
|
+
minExpiresInDays: number;
|
|
19
|
+
/** Shortest trimmed key name (plugin `minimumNameLength`). At least 1. */
|
|
20
|
+
minNameLength: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** A validated value, or a message that is safe to show to the user. */
|
|
24
|
+
export type ApiKeyValidationResult<TValue> =
|
|
25
|
+
| { ok: true; value: TValue }
|
|
26
|
+
| { message: string; ok: false };
|
|
27
|
+
|
|
28
|
+
/** User-facing messages derived from one set of limits. */
|
|
29
|
+
export interface ApiKeyLimitMessages {
|
|
30
|
+
/** A custom expiry that is not a parseable date. */
|
|
31
|
+
expiryInvalid: string;
|
|
32
|
+
/** No expiry was chosen although no-expiry keys are not allowed. */
|
|
33
|
+
expiryRequired: string;
|
|
34
|
+
/** A custom expiry beyond `maxExpiresInDays`. */
|
|
35
|
+
expiryTooLate: string;
|
|
36
|
+
/** A custom expiry before `minExpiresInDays`, or not in the future. */
|
|
37
|
+
expiryTooSoon: string;
|
|
38
|
+
/** A blank or out-of-range trimmed key name. */
|
|
39
|
+
nameLength: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Options for `resolveApiKeyExpiresIn`. */
|
|
43
|
+
export interface ResolveApiKeyExpiresInOptions {
|
|
44
|
+
/**
|
|
45
|
+
* Whether a missing expiry (`null`/`undefined`) is accepted. It means
|
|
46
|
+
* "never expires" only while the plugin's `keyExpiration.defaultExpiresIn`
|
|
47
|
+
* is `null`. Defaults to `true`; pass `false` when the app requires every
|
|
48
|
+
* key to expire.
|
|
49
|
+
*/
|
|
50
|
+
allowNoExpiry?: boolean;
|
|
51
|
+
/** Reference time; defaults to `Date.now()`. */
|
|
52
|
+
now?: Date | number;
|
|
53
|
+
/**
|
|
54
|
+
* Slack, in seconds, for an expiry chosen right at a limit. Defaults to
|
|
55
|
+
* `API_KEY_EXPIRY_TOLERANCE_SECONDS`.
|
|
56
|
+
*/
|
|
57
|
+
toleranceSeconds?: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Better Auth api-key plugin options derived from `ApiKeyLimits`. */
|
|
61
|
+
export interface BetterAuthApiKeyLimitOptions {
|
|
62
|
+
/** Both values are in days, matching the plugin. */
|
|
63
|
+
keyExpiration: { maxExpiresIn: number; minExpiresIn: number };
|
|
64
|
+
maximumNameLength: number;
|
|
65
|
+
minimumNameLength: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Seconds in one day; the plugin compares `expiresIn / 86400` to its limits. */
|
|
69
|
+
export const API_KEY_SECONDS_PER_DAY = 86_400;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Default slack for a custom expiry chosen right at a limit. The browser
|
|
73
|
+
* converts the chosen date before the request reaches the server, and clocks
|
|
74
|
+
* drift, so "one day from now" arrives a little under one day away. Values
|
|
75
|
+
* within this slack are clamped onto the limit instead of being rejected.
|
|
76
|
+
*/
|
|
77
|
+
export const API_KEY_EXPIRY_TOLERANCE_SECONDS = 300;
|
|
78
|
+
|
|
79
|
+
const NAME_REQUIRED_MESSAGE = "Enter a name for this key.";
|
|
80
|
+
const EXPIRY_IN_FUTURE_MESSAGE = "Choose a future expiry date.";
|
|
81
|
+
|
|
82
|
+
function formatDays(days: number) {
|
|
83
|
+
return days === 1 ? "1 day" : `${days} days`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function formatCharacters(count: number) {
|
|
87
|
+
return count === 1 ? "1 character" : `${count} characters`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function assertDays(field: string, value: unknown) {
|
|
91
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
92
|
+
throw new Error(
|
|
93
|
+
`Invalid API-key limits: ${field} must be a finite number of days >= 0.`,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function assertNameLength(field: string, value: unknown) {
|
|
99
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1) {
|
|
100
|
+
throw new Error(
|
|
101
|
+
`Invalid API-key limits: ${field} must be a safe integer >= 1.`,
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Rejects malformed limits so a misconfiguration fails loudly rather than
|
|
108
|
+
* silently validating nothing. Omitted fields are allowed here; the public
|
|
109
|
+
* Better Auth helpers require every field through their types.
|
|
110
|
+
*/
|
|
111
|
+
function assertLimits(limits: Partial<ApiKeyLimits>) {
|
|
112
|
+
if (!limits || typeof limits !== "object") {
|
|
113
|
+
throw new Error("Invalid API-key limits: expected an object.");
|
|
114
|
+
}
|
|
115
|
+
const { maxExpiresInDays, maxNameLength, minExpiresInDays, minNameLength } =
|
|
116
|
+
limits;
|
|
117
|
+
if (minExpiresInDays !== undefined) {
|
|
118
|
+
assertDays("minExpiresInDays", minExpiresInDays);
|
|
119
|
+
}
|
|
120
|
+
if (maxExpiresInDays !== undefined) {
|
|
121
|
+
assertDays("maxExpiresInDays", maxExpiresInDays);
|
|
122
|
+
}
|
|
123
|
+
if (minNameLength !== undefined) {
|
|
124
|
+
assertNameLength("minNameLength", minNameLength);
|
|
125
|
+
}
|
|
126
|
+
if (maxNameLength !== undefined) {
|
|
127
|
+
assertNameLength("maxNameLength", maxNameLength);
|
|
128
|
+
}
|
|
129
|
+
if (
|
|
130
|
+
minExpiresInDays !== undefined &&
|
|
131
|
+
maxExpiresInDays !== undefined &&
|
|
132
|
+
minExpiresInDays > maxExpiresInDays
|
|
133
|
+
) {
|
|
134
|
+
throw new Error(
|
|
135
|
+
"Invalid API-key limits: minExpiresInDays exceeds maxExpiresInDays.",
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
if (
|
|
139
|
+
minNameLength !== undefined &&
|
|
140
|
+
maxNameLength !== undefined &&
|
|
141
|
+
minNameLength > maxNameLength
|
|
142
|
+
) {
|
|
143
|
+
throw new Error(
|
|
144
|
+
"Invalid API-key limits: minNameLength exceeds maxNameLength.",
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function assertCompleteLimits(limits: ApiKeyLimits) {
|
|
150
|
+
assertLimits(limits);
|
|
151
|
+
for (const field of [
|
|
152
|
+
"maxExpiresInDays",
|
|
153
|
+
"maxNameLength",
|
|
154
|
+
"minExpiresInDays",
|
|
155
|
+
"minNameLength",
|
|
156
|
+
] as const) {
|
|
157
|
+
if (limits[field] === undefined) {
|
|
158
|
+
throw new Error(`Invalid API-key limits: ${field} is required.`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Builds the user-facing messages for one set of limits.
|
|
165
|
+
*
|
|
166
|
+
* Server validation, the MUI dialogs, and `betterAuthApiKeyInputErrorMessage`
|
|
167
|
+
* all use these, so the same input produces the same text everywhere. Bounds
|
|
168
|
+
* omitted from `limits` fall back to the generic messages Loom's dialogs used
|
|
169
|
+
* before limits existed.
|
|
170
|
+
*/
|
|
171
|
+
export function apiKeyLimitMessages(
|
|
172
|
+
limits: Partial<ApiKeyLimits>,
|
|
173
|
+
): ApiKeyLimitMessages {
|
|
174
|
+
assertLimits(limits);
|
|
175
|
+
const { maxExpiresInDays, maxNameLength, minExpiresInDays, minNameLength } =
|
|
176
|
+
limits;
|
|
177
|
+
let nameLength = NAME_REQUIRED_MESSAGE;
|
|
178
|
+
if (minNameLength !== undefined && maxNameLength !== undefined) {
|
|
179
|
+
nameLength = `Key names must be between ${minNameLength} and ${maxNameLength} characters.`;
|
|
180
|
+
} else if (maxNameLength !== undefined) {
|
|
181
|
+
nameLength = `Key names must be at most ${formatCharacters(
|
|
182
|
+
maxNameLength,
|
|
183
|
+
)}.`;
|
|
184
|
+
} else if (minNameLength !== undefined) {
|
|
185
|
+
nameLength = `Key names must be at least ${formatCharacters(
|
|
186
|
+
minNameLength,
|
|
187
|
+
)}.`;
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
expiryInvalid: "Expiry must be a valid date.",
|
|
191
|
+
expiryRequired: "Choose an expiry date.",
|
|
192
|
+
expiryTooLate:
|
|
193
|
+
maxExpiresInDays === undefined
|
|
194
|
+
? "Expiry is too far in the future."
|
|
195
|
+
: `Expiry must be no more than ${formatDays(maxExpiresInDays)} from now.`,
|
|
196
|
+
expiryTooSoon:
|
|
197
|
+
minExpiresInDays === undefined || minExpiresInDays === 0
|
|
198
|
+
? EXPIRY_IN_FUTURE_MESSAGE
|
|
199
|
+
: `Expiry must be at least ${formatDays(minExpiresInDays)} from now.`,
|
|
200
|
+
nameLength,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Validates and trims an untrusted key name.
|
|
206
|
+
*
|
|
207
|
+
* Accepts `unknown` because server-action arguments are untrusted. A blank
|
|
208
|
+
* name is always rejected. Omitted bounds are not enforced here, so pass the
|
|
209
|
+
* same complete `ApiKeyLimits` given to the plugin.
|
|
210
|
+
*/
|
|
211
|
+
export function validateApiKeyName(
|
|
212
|
+
name: unknown,
|
|
213
|
+
limits: Partial<ApiKeyLimits>,
|
|
214
|
+
): ApiKeyValidationResult<string> {
|
|
215
|
+
const messages = apiKeyLimitMessages(limits);
|
|
216
|
+
const trimmed = typeof name === "string" ? name.trim() : "";
|
|
217
|
+
if (
|
|
218
|
+
trimmed.length === 0 ||
|
|
219
|
+
(limits.minNameLength !== undefined &&
|
|
220
|
+
trimmed.length < limits.minNameLength) ||
|
|
221
|
+
(limits.maxNameLength !== undefined &&
|
|
222
|
+
trimmed.length > limits.maxNameLength)
|
|
223
|
+
) {
|
|
224
|
+
return { message: messages.nameLength, ok: false };
|
|
225
|
+
}
|
|
226
|
+
return { ok: true, value: trimmed };
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function referenceTime(now: Date | number | undefined) {
|
|
230
|
+
const value =
|
|
231
|
+
now === undefined
|
|
232
|
+
? Date.now()
|
|
233
|
+
: typeof now === "number"
|
|
234
|
+
? now
|
|
235
|
+
: now.valueOf();
|
|
236
|
+
if (!Number.isFinite(value)) {
|
|
237
|
+
throw new Error("resolveApiKeyExpiresIn: `now` must be a valid time.");
|
|
238
|
+
}
|
|
239
|
+
return value;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Converts an untrusted absolute expiry into the plugin's relative
|
|
244
|
+
* `expiresIn` seconds, or `null` when no expiry was chosen.
|
|
245
|
+
*
|
|
246
|
+
* Only strings are accepted (parsed with `Date`; send ISO timestamps), and
|
|
247
|
+
* `null`/`undefined` mean no expiry unless `allowNoExpiry` is `false`. Values
|
|
248
|
+
* beyond the tolerance past a limit are rejected with a readable message;
|
|
249
|
+
* values within it are clamped onto the limit, so a returned number always
|
|
250
|
+
* lies inside the plugin's inclusive bounds. The result is never below 1,
|
|
251
|
+
* because the plugin treats a falsy `expiresIn` as "not given". Pass
|
|
252
|
+
* `value ?? undefined` to `createApiKey`.
|
|
253
|
+
*
|
|
254
|
+
* For a key without `expiresIn` the plugin applies
|
|
255
|
+
* `keyExpiration.defaultExpiresIn`, so `null` only means "never expires"
|
|
256
|
+
* while that option is `null` (the plugin default).
|
|
257
|
+
*/
|
|
258
|
+
export function resolveApiKeyExpiresIn(
|
|
259
|
+
expiresAt: unknown,
|
|
260
|
+
limits: Partial<ApiKeyLimits>,
|
|
261
|
+
options: ResolveApiKeyExpiresInOptions = {},
|
|
262
|
+
): ApiKeyValidationResult<number | null> {
|
|
263
|
+
const messages = apiKeyLimitMessages(limits);
|
|
264
|
+
const tolerance =
|
|
265
|
+
options.toleranceSeconds ?? API_KEY_EXPIRY_TOLERANCE_SECONDS;
|
|
266
|
+
if (!Number.isFinite(tolerance) || tolerance < 0) {
|
|
267
|
+
throw new Error(
|
|
268
|
+
"resolveApiKeyExpiresIn: toleranceSeconds must be a finite number >= 0.",
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
if (expiresAt === null || expiresAt === undefined) {
|
|
272
|
+
return options.allowNoExpiry === false
|
|
273
|
+
? { message: messages.expiryRequired, ok: false }
|
|
274
|
+
: { ok: true, value: null };
|
|
275
|
+
}
|
|
276
|
+
const target =
|
|
277
|
+
typeof expiresAt === "string" ? new Date(expiresAt).valueOf() : Number.NaN;
|
|
278
|
+
if (!Number.isFinite(target)) {
|
|
279
|
+
return { message: messages.expiryInvalid, ok: false };
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const seconds = Math.floor((target - referenceTime(options.now)) / 1000);
|
|
283
|
+
// The slack only ever applies above "in the future": a past expiry is never
|
|
284
|
+
// clamped into a valid one, whatever the configured minimum.
|
|
285
|
+
const minSeconds = (limits.minExpiresInDays ?? 0) * API_KEY_SECONDS_PER_DAY;
|
|
286
|
+
if (seconds < Math.max(1, minSeconds - tolerance)) {
|
|
287
|
+
return { message: messages.expiryTooSoon, ok: false };
|
|
288
|
+
}
|
|
289
|
+
if (limits.maxExpiresInDays !== undefined) {
|
|
290
|
+
const maxSeconds = limits.maxExpiresInDays * API_KEY_SECONDS_PER_DAY;
|
|
291
|
+
if (seconds > maxSeconds + tolerance) {
|
|
292
|
+
return { message: messages.expiryTooLate, ok: false };
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const lower = Math.max(1, Math.ceil(minSeconds));
|
|
297
|
+
const upper =
|
|
298
|
+
limits.maxExpiresInDays === undefined
|
|
299
|
+
? Number.POSITIVE_INFINITY
|
|
300
|
+
: Math.floor(limits.maxExpiresInDays * API_KEY_SECONDS_PER_DAY);
|
|
301
|
+
if (upper < lower) {
|
|
302
|
+
// A sub-second maximum cannot express any expiry the plugin accepts.
|
|
303
|
+
return { message: messages.expiryTooLate, ok: false };
|
|
304
|
+
}
|
|
305
|
+
return { ok: true, value: Math.min(Math.max(seconds, lower), upper) };
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Plugin rejection codes a user can correct, mapped to message keys. Local
|
|
310
|
+
* validation with the same limits should make these unreachable; mapping them
|
|
311
|
+
* keeps configuration drift from showing a raw library message.
|
|
312
|
+
*/
|
|
313
|
+
const BETTER_AUTH_INPUT_ERROR_MESSAGE_KEYS: ReadonlyMap<
|
|
314
|
+
string,
|
|
315
|
+
keyof ApiKeyLimitMessages
|
|
316
|
+
> = new Map([
|
|
317
|
+
["EXPIRES_IN_IS_TOO_SMALL", "expiryTooSoon"],
|
|
318
|
+
["EXPIRES_IN_IS_TOO_LARGE", "expiryTooLate"],
|
|
319
|
+
["INVALID_NAME_LENGTH", "nameLength"],
|
|
320
|
+
["NAME_REQUIRED", "nameLength"],
|
|
321
|
+
]);
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Maps a correctable Better Auth api-key plugin rejection to the same message
|
|
325
|
+
* local validation would show, or returns `null` for anything else.
|
|
326
|
+
*
|
|
327
|
+
* Structural, like Better Auth's own `isAPIError`: it reads `error.body.code`
|
|
328
|
+
* from an error named `APIError` without importing Better Auth. Every other
|
|
329
|
+
* error, including other plugin codes, returns `null` and should be rethrown
|
|
330
|
+
* unchanged.
|
|
331
|
+
*/
|
|
332
|
+
export function betterAuthApiKeyInputErrorMessage(
|
|
333
|
+
error: unknown,
|
|
334
|
+
limits: ApiKeyLimits,
|
|
335
|
+
): string | null {
|
|
336
|
+
assertCompleteLimits(limits);
|
|
337
|
+
if (
|
|
338
|
+
!error ||
|
|
339
|
+
typeof error !== "object" ||
|
|
340
|
+
(error as { name?: unknown }).name !== "APIError"
|
|
341
|
+
) {
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
const body = (error as { body?: unknown }).body;
|
|
345
|
+
if (!body || typeof body !== "object") return null;
|
|
346
|
+
const code = (body as { code?: unknown }).code;
|
|
347
|
+
if (typeof code !== "string") return null;
|
|
348
|
+
const key = BETTER_AUTH_INPUT_ERROR_MESSAGE_KEYS.get(code);
|
|
349
|
+
return key ? apiKeyLimitMessages(limits)[key] : null;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Returns the Better Auth api-key plugin options that enforce `limits`.
|
|
354
|
+
*
|
|
355
|
+
* Merge `keyExpiration` with any other expiration options the app sets, for
|
|
356
|
+
* example `keyExpiration: { ...options.keyExpiration, defaultExpiresIn: null }`.
|
|
357
|
+
* It deliberately leaves `defaultExpiresIn` alone: keep it `null` (the plugin
|
|
358
|
+
* default) when "Never" should mean a key that never expires.
|
|
359
|
+
*/
|
|
360
|
+
export function betterAuthApiKeyLimitOptions(
|
|
361
|
+
limits: ApiKeyLimits,
|
|
362
|
+
): BetterAuthApiKeyLimitOptions {
|
|
363
|
+
assertCompleteLimits(limits);
|
|
364
|
+
return {
|
|
365
|
+
keyExpiration: {
|
|
366
|
+
maxExpiresIn: limits.maxExpiresInDays,
|
|
367
|
+
minExpiresIn: limits.minExpiresInDays,
|
|
368
|
+
},
|
|
369
|
+
maximumNameLength: limits.maxNameLength,
|
|
370
|
+
minimumNameLength: limits.minNameLength,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./authorize.ts";
|
|
2
|
+
export * from "./betterAuth.ts";
|
|
3
|
+
export * from "./country.ts";
|
|
4
|
+
export * from "./credentials.ts";
|
|
5
|
+
export * from "./fingerprint.ts";
|
|
6
|
+
export * from "./lifecycle.ts";
|
|
7
|
+
export * from "./limits.ts";
|
|
8
|
+
export * from "./permissions.ts";
|
|
9
|
+
export * from "./policy.ts";
|
|
10
|
+
export * from "./retention.ts";
|
|
11
|
+
export * from "./types.ts";
|