@gadicc/loom 1.38.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 +103 -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 +33 -28
- 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 +7 -4
- package/esm/src/cli/migrationEnv.js.map +1 -0
- package/esm/src/cli/mod.d.ts +19 -7
- package/esm/src/cli/mod.d.ts.map +1 -1
- package/esm/src/cli/mod.js +2000 -742
- 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 +21 -15
- package/esm/src/cli/vercelBuildEnv.js.map +1 -0
- package/esm/src/cli/vercelEnvMask.d.ts +2 -2
- package/esm/src/cli/vercelEnvMask.d.ts.map +1 -1
- package/esm/src/cli/vercelEnvMask.js +8 -4
- 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 +45 -22
- package/esm/src/cli/vercelProjectRelease.js.map +1 -0
- package/esm/src/cli/vercelPulledEnv.d.ts +1 -1
- package/esm/src/cli/vercelPulledEnv.d.ts.map +1 -1
- package/esm/src/cli/vercelPulledEnv.js +1 -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/esm-package.md +35 -0
- package/skills/loom/references/local-development.md +261 -29
- package/skills/loom-mail/SKILL.md +1 -0
- 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 -582
- package/script/src/cli/mod.d.ts.map +0 -1
- package/script/src/cli/mod.js +0 -17010
- 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 -418
- package/script/src/cli/vercelEnvMask.d.ts +0 -38
- package/script/src/cli/vercelEnvMask.d.ts.map +0 -1
- package/script/src/cli/vercelEnvMask.js +0 -142
- 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/cli/vercelPulledEnv.d.ts +0 -65
- package/script/src/cli/vercelPulledEnv.d.ts.map +0 -1
- package/script/src/cli/vercelPulledEnv.js +0 -138
- 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,393 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ApiKeyAuditRepository,
|
|
3
|
+
type ApiKeyAuthorizationDescriptor,
|
|
4
|
+
type ApiKeyAuthorizationResult,
|
|
5
|
+
type ApiKeyCompletionReasonCode,
|
|
6
|
+
type ApiKeyCountryResolver,
|
|
7
|
+
type ApiKeyCredentialOptions,
|
|
8
|
+
type ApiKeyCredentialRejector,
|
|
9
|
+
type ApiKeyCredentialTransport,
|
|
10
|
+
type ApiKeyPolicy,
|
|
11
|
+
type ApiKeyPrincipal,
|
|
12
|
+
type ApiKeyRequestAuditContext,
|
|
13
|
+
type ApiKeyVerifier,
|
|
14
|
+
authorizeApiKey,
|
|
15
|
+
extractApiKeyCredential,
|
|
16
|
+
normalizeApiKeyCountryCode,
|
|
17
|
+
} from "../../apiKeys/mod.ts";
|
|
18
|
+
|
|
19
|
+
export interface ApiKeyRequestDependencies {
|
|
20
|
+
audit: ApiKeyAuditRepository;
|
|
21
|
+
credentialOptions?: ApiKeyCredentialOptions;
|
|
22
|
+
policy: ApiKeyPolicy;
|
|
23
|
+
/**
|
|
24
|
+
* Denies specific credential values before they are fingerprinted,
|
|
25
|
+
* verified, or attributed; see `AuthorizeApiKeyOptions.rejectCredential`.
|
|
26
|
+
* Applies to `authorizeApiKeyRequest`, `withApiKeyAuthorization`, and
|
|
27
|
+
* `authorizeSessionOrApiKeyRequest`.
|
|
28
|
+
*/
|
|
29
|
+
rejectCredential?: ApiKeyCredentialRejector;
|
|
30
|
+
/** Optional offline resolver used to snapshot an IP's ISO country code. */
|
|
31
|
+
resolveCountryCode?: ApiKeyCountryResolver;
|
|
32
|
+
requestContext?:
|
|
33
|
+
| ApiKeyRequestAuditContext
|
|
34
|
+
| ((
|
|
35
|
+
request: Request,
|
|
36
|
+
) => ApiKeyRequestAuditContext | Promise<ApiKeyRequestAuditContext>);
|
|
37
|
+
verifier: ApiKeyVerifier;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ApiKeyHandlerContext {
|
|
41
|
+
authorizationEventId: string;
|
|
42
|
+
key: {
|
|
43
|
+
id: string;
|
|
44
|
+
name?: string;
|
|
45
|
+
start?: string;
|
|
46
|
+
};
|
|
47
|
+
principal: ApiKeyPrincipal;
|
|
48
|
+
transport: ApiKeyCredentialTransport;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type ApiKeyRouteHandler<TRouteContext = unknown> = (
|
|
52
|
+
request: Request,
|
|
53
|
+
authorization: ApiKeyHandlerContext,
|
|
54
|
+
routeContext: TRouteContext,
|
|
55
|
+
) => Response | Promise<Response>;
|
|
56
|
+
|
|
57
|
+
export interface WithApiKeyAuthorizationOptions {
|
|
58
|
+
dependencies: ApiKeyRequestDependencies;
|
|
59
|
+
descriptor:
|
|
60
|
+
| ApiKeyAuthorizationDescriptor
|
|
61
|
+
| ((request: Request) => ApiKeyAuthorizationDescriptor);
|
|
62
|
+
errorFormat?: "json" | "text";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function nonEmptyHeader(request: Request, name: string) {
|
|
66
|
+
return request.headers.get(name)?.trim() || undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Reads Vercel's platform-owned client IP and country headers.
|
|
71
|
+
* Only use this helper for requests that arrived through Vercel's network.
|
|
72
|
+
*/
|
|
73
|
+
export function vercelApiKeyRequestContext(
|
|
74
|
+
request: Request,
|
|
75
|
+
): ApiKeyRequestAuditContext {
|
|
76
|
+
return {
|
|
77
|
+
countryCode: normalizeApiKeyCountryCode(
|
|
78
|
+
nonEmptyHeader(request, "x-vercel-ip-country"),
|
|
79
|
+
),
|
|
80
|
+
ipAddress: nonEmptyHeader(request, "x-vercel-forwarded-for"),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function resolveRequestContext(
|
|
85
|
+
request: Request,
|
|
86
|
+
dependencies: ApiKeyRequestDependencies,
|
|
87
|
+
) {
|
|
88
|
+
const configured =
|
|
89
|
+
typeof dependencies.requestContext === "function"
|
|
90
|
+
? await dependencies.requestContext(request)
|
|
91
|
+
: dependencies.requestContext;
|
|
92
|
+
const context: ApiKeyRequestAuditContext = {
|
|
93
|
+
method: request.method,
|
|
94
|
+
userAgent: request.headers.get("user-agent") ?? undefined,
|
|
95
|
+
...configured,
|
|
96
|
+
};
|
|
97
|
+
context.countryCode = normalizeApiKeyCountryCode(context.countryCode);
|
|
98
|
+
if (
|
|
99
|
+
!context.countryCode &&
|
|
100
|
+
context.ipAddress &&
|
|
101
|
+
dependencies.resolveCountryCode
|
|
102
|
+
) {
|
|
103
|
+
try {
|
|
104
|
+
context.countryCode = normalizeApiKeyCountryCode(
|
|
105
|
+
await dependencies.resolveCountryCode(context.ipAddress),
|
|
106
|
+
);
|
|
107
|
+
} catch {
|
|
108
|
+
// Geolocation enrichment must never change an authorization decision.
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return context;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Adapts a standard Request to the runtime-neutral API-key authorizer. */
|
|
115
|
+
export async function authorizeApiKeyRequest(
|
|
116
|
+
request: Request,
|
|
117
|
+
descriptor: ApiKeyAuthorizationDescriptor,
|
|
118
|
+
dependencies: ApiKeyRequestDependencies,
|
|
119
|
+
) {
|
|
120
|
+
return await authorizeApiKeyRequestWithContext(
|
|
121
|
+
request,
|
|
122
|
+
descriptor,
|
|
123
|
+
dependencies,
|
|
124
|
+
await resolveRequestContext(request, dependencies),
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function authorizeApiKeyRequestWithContext(
|
|
129
|
+
request: Request,
|
|
130
|
+
descriptor: ApiKeyAuthorizationDescriptor,
|
|
131
|
+
dependencies: ApiKeyRequestDependencies,
|
|
132
|
+
requestContext: ApiKeyRequestAuditContext,
|
|
133
|
+
) {
|
|
134
|
+
return await authorizeApiKey({
|
|
135
|
+
audit: dependencies.audit,
|
|
136
|
+
credentialOptions: dependencies.credentialOptions,
|
|
137
|
+
descriptor,
|
|
138
|
+
policy: dependencies.policy,
|
|
139
|
+
rejectCredential: dependencies.rejectCredential,
|
|
140
|
+
request: requestContext,
|
|
141
|
+
source: {
|
|
142
|
+
headers: request.headers,
|
|
143
|
+
searchParams: new URL(request.url).searchParams,
|
|
144
|
+
},
|
|
145
|
+
verifier: dependencies.verifier,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function authorizationErrorResponse(
|
|
150
|
+
result: Extract<ApiKeyAuthorizationResult, { ok: false }>,
|
|
151
|
+
format: "json" | "text",
|
|
152
|
+
) {
|
|
153
|
+
const message =
|
|
154
|
+
result.status === 503
|
|
155
|
+
? "API-key authorization is temporarily unavailable."
|
|
156
|
+
: result.status === 500
|
|
157
|
+
? "API-key authorization failed."
|
|
158
|
+
: result.status === 400
|
|
159
|
+
? "Invalid API-key credentials."
|
|
160
|
+
: result.status === 403
|
|
161
|
+
? "API key is not permitted for this operation."
|
|
162
|
+
: result.status === 429
|
|
163
|
+
? "API-key request limit exceeded."
|
|
164
|
+
: "API-key authentication required.";
|
|
165
|
+
if (format === "text") {
|
|
166
|
+
return new Response(`${message}\n`, {
|
|
167
|
+
status: result.status,
|
|
168
|
+
headers: { "content-type": "text/plain; charset=utf-8" },
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return Response.json(
|
|
172
|
+
{ error: { code: result.code, message } },
|
|
173
|
+
{ status: result.status },
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function withQueryCredentialHeaders(response: Response) {
|
|
178
|
+
const headers = new Headers(response.headers);
|
|
179
|
+
headers.set("cache-control", "private, no-store");
|
|
180
|
+
headers.set("referrer-policy", "no-referrer");
|
|
181
|
+
return new Response(response.body, {
|
|
182
|
+
headers,
|
|
183
|
+
status: response.status,
|
|
184
|
+
statusText: response.statusText,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function safeKey(principal: ApiKeyPrincipal) {
|
|
189
|
+
return {
|
|
190
|
+
id: principal.keyId,
|
|
191
|
+
name: principal.keyName,
|
|
192
|
+
start: principal.keyStart,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
async function appendCompletion(
|
|
197
|
+
dependencies: ApiKeyRequestDependencies,
|
|
198
|
+
descriptor: ApiKeyAuthorizationDescriptor,
|
|
199
|
+
authorization: ApiKeyHandlerContext,
|
|
200
|
+
response: Response,
|
|
201
|
+
startedAt: number,
|
|
202
|
+
requestContext: ApiKeyRequestAuditContext,
|
|
203
|
+
) {
|
|
204
|
+
await dependencies.audit.append({
|
|
205
|
+
actionName: descriptor.actionName,
|
|
206
|
+
authorizationEventId: authorization.authorizationEventId,
|
|
207
|
+
durationMs: Math.round(Math.max(0, performance.now() - startedAt)),
|
|
208
|
+
eventType: "completion",
|
|
209
|
+
functionName: descriptor.functionName,
|
|
210
|
+
httpStatus: response.status,
|
|
211
|
+
keyId: authorization.principal.keyId,
|
|
212
|
+
keyNameSnapshot: authorization.principal.keyName,
|
|
213
|
+
keyStartSnapshot: authorization.principal.keyStart,
|
|
214
|
+
metadata: descriptor.metadata,
|
|
215
|
+
operation: descriptor.operation,
|
|
216
|
+
operationOutcome: response.status >= 500 ? "failed" : "succeeded",
|
|
217
|
+
ownerId: authorization.principal.ownerId,
|
|
218
|
+
pageName: descriptor.pageName,
|
|
219
|
+
requestId: requestContext.requestId,
|
|
220
|
+
scopeAction: descriptor.permission.action,
|
|
221
|
+
scopeResource: descriptor.permission.resource,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** Records response creation and applies query-credential response policy. */
|
|
226
|
+
export async function completeApiKeyAuthorizedResponse(options: {
|
|
227
|
+
authorization: ApiKeyHandlerContext;
|
|
228
|
+
dependencies: ApiKeyRequestDependencies;
|
|
229
|
+
descriptor: ApiKeyAuthorizationDescriptor;
|
|
230
|
+
request: Request;
|
|
231
|
+
/** Reuses context already resolved for authorization when available. */
|
|
232
|
+
requestContext?: ApiKeyRequestAuditContext;
|
|
233
|
+
response: Response;
|
|
234
|
+
startedAt?: number;
|
|
235
|
+
}) {
|
|
236
|
+
await appendCompletion(
|
|
237
|
+
options.dependencies,
|
|
238
|
+
options.descriptor,
|
|
239
|
+
options.authorization,
|
|
240
|
+
options.response,
|
|
241
|
+
options.startedAt ?? performance.now(),
|
|
242
|
+
options.requestContext ??
|
|
243
|
+
(await resolveRequestContext(options.request, options.dependencies)),
|
|
244
|
+
);
|
|
245
|
+
return options.authorization.transport === "query"
|
|
246
|
+
? withQueryCredentialHeaders(options.response)
|
|
247
|
+
: options.response;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** Wraps a route handler with authorization and response-creation auditing. */
|
|
251
|
+
export function withApiKeyAuthorization<TRouteContext = unknown>(
|
|
252
|
+
options: WithApiKeyAuthorizationOptions,
|
|
253
|
+
handler: ApiKeyRouteHandler<TRouteContext>,
|
|
254
|
+
) {
|
|
255
|
+
return async function apiKeyAuthorizedRoute(
|
|
256
|
+
request: Request,
|
|
257
|
+
routeContext: TRouteContext,
|
|
258
|
+
) {
|
|
259
|
+
const descriptor =
|
|
260
|
+
typeof options.descriptor === "function"
|
|
261
|
+
? options.descriptor(request)
|
|
262
|
+
: options.descriptor;
|
|
263
|
+
const extracted = extractApiKeyCredential(
|
|
264
|
+
{
|
|
265
|
+
headers: request.headers,
|
|
266
|
+
searchParams: new URL(request.url).searchParams,
|
|
267
|
+
},
|
|
268
|
+
options.dependencies.credentialOptions,
|
|
269
|
+
);
|
|
270
|
+
const queryCredentialUsed =
|
|
271
|
+
extracted.kind === "present" && extracted.transport === "query";
|
|
272
|
+
const requestContext = await resolveRequestContext(
|
|
273
|
+
request,
|
|
274
|
+
options.dependencies,
|
|
275
|
+
);
|
|
276
|
+
const authorization = await authorizeApiKeyRequestWithContext(
|
|
277
|
+
request,
|
|
278
|
+
descriptor,
|
|
279
|
+
options.dependencies,
|
|
280
|
+
requestContext,
|
|
281
|
+
);
|
|
282
|
+
if (!authorization.ok) {
|
|
283
|
+
const response = authorizationErrorResponse(
|
|
284
|
+
authorization,
|
|
285
|
+
options.errorFormat ?? "json",
|
|
286
|
+
);
|
|
287
|
+
return queryCredentialUsed
|
|
288
|
+
? withQueryCredentialHeaders(response)
|
|
289
|
+
: response;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const startedAt = performance.now();
|
|
293
|
+
let response: Response;
|
|
294
|
+
const handlerAuthorization: ApiKeyHandlerContext = {
|
|
295
|
+
authorizationEventId: authorization.authorizationEventId,
|
|
296
|
+
key: safeKey(authorization.principal),
|
|
297
|
+
principal: authorization.principal,
|
|
298
|
+
transport: authorization.transport,
|
|
299
|
+
};
|
|
300
|
+
try {
|
|
301
|
+
response = await handler(request, handlerAuthorization, routeContext);
|
|
302
|
+
} catch {
|
|
303
|
+
response = authorizationErrorResponse(
|
|
304
|
+
{ code: "verification_error", ok: false, status: 500 },
|
|
305
|
+
options.errorFormat ?? "json",
|
|
306
|
+
);
|
|
307
|
+
try {
|
|
308
|
+
await options.dependencies.audit.append({
|
|
309
|
+
actionName: descriptor.actionName,
|
|
310
|
+
authorizationEventId: authorization.authorizationEventId,
|
|
311
|
+
durationMs: Math.round(Math.max(0, performance.now() - startedAt)),
|
|
312
|
+
eventType: "completion",
|
|
313
|
+
functionName: descriptor.functionName,
|
|
314
|
+
httpStatus: 500,
|
|
315
|
+
keyId: authorization.principal.keyId,
|
|
316
|
+
keyNameSnapshot: authorization.principal.keyName,
|
|
317
|
+
keyStartSnapshot: authorization.principal.keyStart,
|
|
318
|
+
metadata: descriptor.metadata,
|
|
319
|
+
operation: descriptor.operation,
|
|
320
|
+
operationOutcome: "failed",
|
|
321
|
+
ownerId: authorization.principal.ownerId,
|
|
322
|
+
pageName: descriptor.pageName,
|
|
323
|
+
// A fixed code: the error's class name is app-controlled (for
|
|
324
|
+
// example a database driver's) and owners can read this event.
|
|
325
|
+
reasonCode: "handler_error" satisfies ApiKeyCompletionReasonCode,
|
|
326
|
+
requestId: requestContext.requestId,
|
|
327
|
+
scopeAction: descriptor.permission.action,
|
|
328
|
+
scopeResource: descriptor.permission.resource,
|
|
329
|
+
});
|
|
330
|
+
} catch {
|
|
331
|
+
// The protected handler already failed; preserve a stable failure response.
|
|
332
|
+
}
|
|
333
|
+
return queryCredentialUsed
|
|
334
|
+
? withQueryCredentialHeaders(response)
|
|
335
|
+
: response;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
try {
|
|
339
|
+
return await completeApiKeyAuthorizedResponse({
|
|
340
|
+
authorization: handlerAuthorization,
|
|
341
|
+
dependencies: options.dependencies,
|
|
342
|
+
descriptor,
|
|
343
|
+
request,
|
|
344
|
+
requestContext,
|
|
345
|
+
response,
|
|
346
|
+
startedAt,
|
|
347
|
+
});
|
|
348
|
+
} catch {
|
|
349
|
+
const unavailable = authorizationErrorResponse(
|
|
350
|
+
{ code: "audit_unavailable", ok: false, status: 503 },
|
|
351
|
+
options.errorFormat ?? "json",
|
|
352
|
+
);
|
|
353
|
+
return queryCredentialUsed
|
|
354
|
+
? withQueryCredentialHeaders(unavailable)
|
|
355
|
+
: unavailable;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export type SessionOrApiKeyAuthorization<TSession> =
|
|
361
|
+
| { context: TSession; kind: "session" }
|
|
362
|
+
| ({ kind: "api-key" } & ApiKeyHandlerContext)
|
|
363
|
+
| Response;
|
|
364
|
+
|
|
365
|
+
/** Tries the app's fresh session policy first, then explicit API-key auth. */
|
|
366
|
+
export async function authorizeSessionOrApiKeyRequest<TSession>(options: {
|
|
367
|
+
apiKey: {
|
|
368
|
+
dependencies: ApiKeyRequestDependencies;
|
|
369
|
+
descriptor: ApiKeyAuthorizationDescriptor;
|
|
370
|
+
};
|
|
371
|
+
authorizeSession: (request: Request) => Promise<TSession | null>;
|
|
372
|
+
errorFormat?: "json" | "text";
|
|
373
|
+
request: Request;
|
|
374
|
+
}): Promise<SessionOrApiKeyAuthorization<TSession>> {
|
|
375
|
+
const session = await options.authorizeSession(options.request);
|
|
376
|
+
if (session !== null) return { context: session, kind: "session" };
|
|
377
|
+
|
|
378
|
+
const result = await authorizeApiKeyRequest(
|
|
379
|
+
options.request,
|
|
380
|
+
options.apiKey.descriptor,
|
|
381
|
+
options.apiKey.dependencies,
|
|
382
|
+
);
|
|
383
|
+
if (!result.ok) {
|
|
384
|
+
return authorizationErrorResponse(result, options.errorFormat ?? "json");
|
|
385
|
+
}
|
|
386
|
+
return {
|
|
387
|
+
authorizationEventId: result.authorizationEventId,
|
|
388
|
+
key: safeKey(result.principal),
|
|
389
|
+
kind: "api-key",
|
|
390
|
+
principal: result.principal,
|
|
391
|
+
transport: result.transport,
|
|
392
|
+
};
|
|
393
|
+
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* Browser-side Better Auth helpers. This module imports nothing, so it adds no
|
|
4
5
|
* dependency and is safe to reach from a consumer's own client module. Read
|
|
5
6
|
* globals through `globalThis`: a bare `window` becomes a build shim that is
|
|
6
7
|
* always defined, and pulls Node polyfills into the browser bundle.
|
|
7
8
|
*/
|
|
9
|
+
|
|
8
10
|
type PendingSessionState = {
|
|
9
|
-
|
|
11
|
+
isPending: boolean;
|
|
10
12
|
};
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* Wraps Better Auth's `useSession` so a session reports pending only until the
|
|
13
16
|
* page's first answer.
|
|
@@ -30,6 +33,17 @@ type PendingSessionState = {
|
|
|
30
33
|
* `useSession` directly again; the manifest's auth client module is the only
|
|
31
34
|
* other place to check.
|
|
32
35
|
*/
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
export function createSettledSessionHook<TState extends PendingSessionState>(
|
|
37
|
+
useSession: () => TState,
|
|
38
|
+
): () => TState {
|
|
39
|
+
let settled = false;
|
|
40
|
+
|
|
41
|
+
return function useSettledSession(): TState {
|
|
42
|
+
const session = useSession();
|
|
43
|
+
if (!session.isPending) {
|
|
44
|
+
if (typeof globalThis.document !== "undefined") settled = true;
|
|
45
|
+
return session;
|
|
46
|
+
}
|
|
47
|
+
return settled ? { ...session, isPending: false } : session;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
export const DEFAULT_BETTER_AUTH_SECRET_ENV = "BETTER_AUTH_SECRET";
|
|
2
|
+
export const DEFAULT_BETTER_AUTH_SECRETS_ENV = "BETTER_AUTH_SECRETS";
|
|
3
|
+
export const DEFAULT_BETTER_AUTH_DEPRECATED_SECRET_ENVS = [
|
|
4
|
+
"AUTH_SECRET",
|
|
5
|
+
"NEXTAUTH_SECRET",
|
|
6
|
+
] as const;
|
|
7
|
+
export const DEFAULT_BETTER_AUTH_COOKIE_CACHE_MAX_AGE_SECONDS = 10;
|
|
8
|
+
export const DEFAULT_BETTER_AUTH_LOCAL_ALLOWED_HOSTS = [
|
|
9
|
+
"localhost:*",
|
|
10
|
+
"127.0.0.1:*",
|
|
11
|
+
"[::1]:*",
|
|
12
|
+
] as const;
|
|
13
|
+
export const DEFAULT_BETTER_AUTH_LOCAL_TRUSTED_ORIGINS = [
|
|
14
|
+
"http://localhost:*",
|
|
15
|
+
"http://127.0.0.1:*",
|
|
16
|
+
"http://[::1]:*",
|
|
17
|
+
] as const;
|
|
18
|
+
|
|
19
|
+
export type BetterAuthSecretResolution = {
|
|
20
|
+
deprecated: boolean;
|
|
21
|
+
preferredEnvName: string;
|
|
22
|
+
secret: string;
|
|
23
|
+
source: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type BetterAuthEnv = Record<string, string | undefined>;
|
|
27
|
+
type RuntimeProcess = {
|
|
28
|
+
env?: BetterAuthEnv;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type ResolveBetterAuthSecretOptions = {
|
|
32
|
+
deprecatedEnvNames?: readonly string[];
|
|
33
|
+
env?: BetterAuthEnv;
|
|
34
|
+
preferredEnvName?: string;
|
|
35
|
+
versionedEnvName?: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type RequireBetterAuthSecretOptions = ResolveBetterAuthSecretOptions & {
|
|
39
|
+
nodeEnv?: string | undefined;
|
|
40
|
+
onDeprecatedEnv?: ((resolution: BetterAuthSecretResolution) => void) | null;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type CreateBetterAuthSessionConfigOptions = {
|
|
44
|
+
cookieCacheMaxAgeSeconds?: number;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type CreateBetterAuthLocalDevelopmentConfigOptions = {
|
|
48
|
+
/** Loopback hosts Better Auth may derive from a local request. */
|
|
49
|
+
allowedHosts?: readonly string[];
|
|
50
|
+
/** Stable public URL used when the incoming host cannot be accepted. */
|
|
51
|
+
fallback?: string | undefined;
|
|
52
|
+
/** Browser origins allowed to call the local auth endpoints. */
|
|
53
|
+
trustedOrigins?: readonly string[];
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Creates a loopback-only Better Auth policy for local reverse proxies.
|
|
58
|
+
*
|
|
59
|
+
* Proxy headers are trusted so tools such as `vercel dev` retain their public
|
|
60
|
+
* localhost URL instead of leaking an internal worker port into OAuth
|
|
61
|
+
* callbacks. Only spread this config into a non-production Better Auth setup.
|
|
62
|
+
*/
|
|
63
|
+
export function createBetterAuthLocalDevelopmentConfig(
|
|
64
|
+
options: CreateBetterAuthLocalDevelopmentConfigOptions = {},
|
|
65
|
+
) {
|
|
66
|
+
const fallback = options.fallback?.trim();
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
advanced: {
|
|
70
|
+
trustedProxyHeaders: true,
|
|
71
|
+
},
|
|
72
|
+
baseURL: {
|
|
73
|
+
allowedHosts: [
|
|
74
|
+
...(options.allowedHosts ?? DEFAULT_BETTER_AUTH_LOCAL_ALLOWED_HOSTS),
|
|
75
|
+
],
|
|
76
|
+
...(fallback ? { fallback } : {}),
|
|
77
|
+
protocol: "http" as const,
|
|
78
|
+
},
|
|
79
|
+
trustedOrigins: [
|
|
80
|
+
...(options.trustedOrigins ?? DEFAULT_BETTER_AUTH_LOCAL_TRUSTED_ORIGINS),
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function createBetterAuthSessionConfig(
|
|
86
|
+
options: CreateBetterAuthSessionConfigOptions = {},
|
|
87
|
+
) {
|
|
88
|
+
return {
|
|
89
|
+
cookieCache: {
|
|
90
|
+
enabled: true,
|
|
91
|
+
maxAge:
|
|
92
|
+
options.cookieCacheMaxAgeSeconds ??
|
|
93
|
+
DEFAULT_BETTER_AUTH_COOKIE_CACHE_MAX_AGE_SECONDS,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function getGlobalProcessEnv(): BetterAuthEnv {
|
|
99
|
+
return (globalThis as { process?: RuntimeProcess }).process?.env ?? {};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function resolveBetterAuthSecret(
|
|
103
|
+
options: ResolveBetterAuthSecretOptions = {},
|
|
104
|
+
): BetterAuthSecretResolution | null {
|
|
105
|
+
const env = options.env ?? getGlobalProcessEnv();
|
|
106
|
+
const preferredEnvName =
|
|
107
|
+
options.preferredEnvName ?? DEFAULT_BETTER_AUTH_SECRET_ENV;
|
|
108
|
+
const versionedEnvName =
|
|
109
|
+
options.versionedEnvName ?? DEFAULT_BETTER_AUTH_SECRETS_ENV;
|
|
110
|
+
const deprecatedEnvNames =
|
|
111
|
+
options.deprecatedEnvNames ?? DEFAULT_BETTER_AUTH_DEPRECATED_SECRET_ENVS;
|
|
112
|
+
|
|
113
|
+
const versionedSecrets = env[versionedEnvName];
|
|
114
|
+
if (versionedSecrets) {
|
|
115
|
+
const seenVersions = new Set<string>();
|
|
116
|
+
let currentSecret = "";
|
|
117
|
+
for (const [index, rawEntry] of versionedSecrets.split(",").entries()) {
|
|
118
|
+
const entry = rawEntry.trim();
|
|
119
|
+
const separatorIndex = entry.indexOf(":");
|
|
120
|
+
const version =
|
|
121
|
+
separatorIndex < 0 ? "" : entry.slice(0, separatorIndex).trim();
|
|
122
|
+
const secret =
|
|
123
|
+
separatorIndex < 0 ? "" : entry.slice(separatorIndex + 1).trim();
|
|
124
|
+
if (!/^(0|[1-9]\d*)$/.test(version) || !secret) {
|
|
125
|
+
throw new Error(
|
|
126
|
+
`Invalid ${versionedEnvName}. Expected a comma-separated list such as \`2:new-secret,1:old-secret\`.`,
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
if (seenVersions.has(version)) {
|
|
130
|
+
throw new Error(
|
|
131
|
+
`Invalid ${versionedEnvName}. Secret version ${version} is duplicated.`,
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
seenVersions.add(version);
|
|
135
|
+
if (index === 0) {
|
|
136
|
+
currentSecret = secret;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Better Auth reads BETTER_AUTH_SECRETS itself. Its `secret` option becomes
|
|
141
|
+
// the fallback for pre-rotation payloads, so preserve a legacy env value
|
|
142
|
+
// when one exists instead of accidentally replacing it with the new key.
|
|
143
|
+
const legacySecret =
|
|
144
|
+
env[preferredEnvName] ??
|
|
145
|
+
deprecatedEnvNames
|
|
146
|
+
.map((envName) => env[envName])
|
|
147
|
+
.find((secret) => Boolean(secret));
|
|
148
|
+
return {
|
|
149
|
+
deprecated: false,
|
|
150
|
+
preferredEnvName,
|
|
151
|
+
secret: legacySecret ?? currentSecret,
|
|
152
|
+
source: versionedEnvName,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const preferredSecret = env[preferredEnvName];
|
|
157
|
+
if (preferredSecret) {
|
|
158
|
+
return {
|
|
159
|
+
deprecated: false,
|
|
160
|
+
preferredEnvName,
|
|
161
|
+
secret: preferredSecret,
|
|
162
|
+
source: preferredEnvName,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
for (const envName of deprecatedEnvNames) {
|
|
167
|
+
const deprecatedSecret = env[envName];
|
|
168
|
+
if (!deprecatedSecret) {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return {
|
|
173
|
+
deprecated: true,
|
|
174
|
+
preferredEnvName,
|
|
175
|
+
secret: deprecatedSecret,
|
|
176
|
+
source: envName,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function requireBetterAuthSecret(
|
|
184
|
+
options: RequireBetterAuthSecretOptions = {},
|
|
185
|
+
) {
|
|
186
|
+
const resolution = resolveBetterAuthSecret(options);
|
|
187
|
+
|
|
188
|
+
if (!resolution) {
|
|
189
|
+
throw new Error(
|
|
190
|
+
`Missing Better Auth secret. Set ${
|
|
191
|
+
options.versionedEnvName ?? DEFAULT_BETTER_AUTH_SECRETS_ENV
|
|
192
|
+
} or ${options.preferredEnvName ?? DEFAULT_BETTER_AUTH_SECRET_ENV}.`,
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (resolution.deprecated && options.nodeEnv !== "test") {
|
|
197
|
+
if (options.onDeprecatedEnv) {
|
|
198
|
+
options.onDeprecatedEnv(resolution);
|
|
199
|
+
} else if (options.onDeprecatedEnv !== null) {
|
|
200
|
+
console.warn(
|
|
201
|
+
`Deprecated auth secret env ${resolution.source} is being used for Better Auth. Rename it to ${resolution.preferredEnvName}.`,
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return resolution.secret;
|
|
207
|
+
}
|