@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,174 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
|
|
3
|
+
/** One assignment read from a dotenv file, in file order. */
|
|
4
|
+
export type PulledEnvEntry = {
|
|
5
|
+
/**
|
|
6
|
+
* The on-disk text up to the last `"` on the line, when a dotenv-style early
|
|
7
|
+
* close (see {@link parsePulledEnv}) ended {@link raw} sooner. A Vercel value
|
|
8
|
+
* can itself contain `" #`, so masking registers this form too.
|
|
9
|
+
*/
|
|
10
|
+
alternateRaw?: string;
|
|
11
|
+
/** 1-based line on which the assignment ends (later for multi-line). */
|
|
12
|
+
endLine: number;
|
|
13
|
+
key: string;
|
|
14
|
+
/** 1-based line on which the assignment starts. */
|
|
15
|
+
line: number;
|
|
16
|
+
/**
|
|
17
|
+
* The value as written on disk between its quotes (or the trimmed unquoted
|
|
18
|
+
* text), before `\n`/`\r` escapes are decoded.
|
|
19
|
+
*/
|
|
20
|
+
raw: string;
|
|
21
|
+
/** The decoded value (see {@link parsePulledEnv} for how it is chosen). */
|
|
22
|
+
value: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** A parsed dotenv file. */
|
|
26
|
+
export type PulledEnvFile = {
|
|
27
|
+
entries: PulledEnvEntry[];
|
|
28
|
+
/** 1-based lines that are neither blank, a comment, nor an assignment. */
|
|
29
|
+
unrecognizedLines: number[];
|
|
30
|
+
/** Final value per key; a later assignment wins, as in dotenv. */
|
|
31
|
+
values: Record<string, string>;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// `[\s\S]` rather than `.`: Vercel writes U+2028 and U+2029 unescaped, and `.`
|
|
35
|
+
// would stop at them and reject the whole line.
|
|
36
|
+
const ASSIGNMENT = /^\s*(?:export\s+)?([\w.-]+)(?:\s*=|:\s)\s*([\s\S]*)$/;
|
|
37
|
+
|
|
38
|
+
/** Decodes the `\n` and `\r` escapes `vercel pull` writes in quoted values. */
|
|
39
|
+
export function decodePulledEnvEscapes(raw: string) {
|
|
40
|
+
return raw.replaceAll("\\n", "\n").replaceAll("\\r", "\r");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function escapeRegExp(text: string) {
|
|
44
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Where a double-quoted value that closes on its own line ends: at the first
|
|
49
|
+
* `"` followed only by whitespace and an optional `# comment` (dotenv's early
|
|
50
|
+
* close, which hand-written files rely on), and otherwise at the last `"`.
|
|
51
|
+
* Vercel never writes comments, so its lines end at the last `"` unless the
|
|
52
|
+
* value itself contains `"` followed by ` #`.
|
|
53
|
+
*/
|
|
54
|
+
function closingQuoteIndex(rest: string) {
|
|
55
|
+
for (let index = rest.indexOf('"', 1); index > 0;) {
|
|
56
|
+
if (/^\s*(?:#[\s\S]*)?$/.test(rest.slice(index + 1))) return index;
|
|
57
|
+
index = rest.indexOf('"', index + 1);
|
|
58
|
+
}
|
|
59
|
+
return -1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Parses dotenv text so that masking and placeholder checks see the value
|
|
64
|
+
* Vercel stored.
|
|
65
|
+
*
|
|
66
|
+
* `vercel pull` writes every variable as `KEY="<value>"`, escaping only newline
|
|
67
|
+
* and carriage return (as `\n` and `\r`) and writing `"`, `\`, `#`, `$`, U+2028
|
|
68
|
+
* and U+2029 as they are. No consumer reads that format back exactly:
|
|
69
|
+
*
|
|
70
|
+
* - Node's `util.parseEnv` ends the value at its first embedded `"`, so
|
|
71
|
+
* `KEY="{"a":1}"` reads as `{`.
|
|
72
|
+
* - `vercel build` loads the file with its bundled dotenv 4.0.0, which trims
|
|
73
|
+
* inside the quotes, decodes `\n` but not `\r`, does not treat `#` specially,
|
|
74
|
+
* and drops any line containing U+2028 or U+2029.
|
|
75
|
+
* - Next.js (`@next/env`) uses dotenv 16, which cuts a value containing both
|
|
76
|
+
* `"` and `#` (`KEY="a"b#c"` reads as `"a"b`), and then expands `$VAR`.
|
|
77
|
+
*
|
|
78
|
+
* This reader is deliberately closer to the stored value than any of them,
|
|
79
|
+
* because masking has to cover the secret itself: a double-quoted value that
|
|
80
|
+
* closes on its line runs to the last `"` (or an earlier `"` followed only by a
|
|
81
|
+
* comment, see {@link PulledEnvEntry.alternateRaw}), nothing is trimmed inside
|
|
82
|
+
* the quotes, `#` and `$` are literal, and only `\n` and `\r` are decoded.
|
|
83
|
+
* Everything else follows dotenv 16: unquoted values end at `#` and are
|
|
84
|
+
* trimmed, single- and backtick-quoted values are literal, and quoted values
|
|
85
|
+
* may span lines.
|
|
86
|
+
*/
|
|
87
|
+
export function parsePulledEnv(source: string): PulledEnvFile {
|
|
88
|
+
// dotenv normalizes line endings before parsing; Vercel escapes CR and LF
|
|
89
|
+
// inside values, so a real CR here is always part of a line ending.
|
|
90
|
+
const lines = source.replace(/\r\n?/g, "\n").split("\n");
|
|
91
|
+
const entries: PulledEnvEntry[] = [];
|
|
92
|
+
const unrecognizedLines: number[] = [];
|
|
93
|
+
|
|
94
|
+
for (let index = 0; index < lines.length; index++) {
|
|
95
|
+
const lineText = lines[index];
|
|
96
|
+
const trimmed = lineText.trim();
|
|
97
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
98
|
+
const match = lineText.match(ASSIGNMENT);
|
|
99
|
+
if (!match) {
|
|
100
|
+
unrecognizedLines.push(index + 1);
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const [, key, rest] = match;
|
|
104
|
+
const line = index + 1;
|
|
105
|
+
const quote = rest[0];
|
|
106
|
+
|
|
107
|
+
const closing = quote === '"' ? closingQuoteIndex(rest) : -1;
|
|
108
|
+
if (closing > 0) {
|
|
109
|
+
const raw = rest.slice(1, closing);
|
|
110
|
+
const last = rest.lastIndexOf('"');
|
|
111
|
+
entries.push({
|
|
112
|
+
...(last > closing ? { alternateRaw: rest.slice(1, last) } : {}),
|
|
113
|
+
endLine: line,
|
|
114
|
+
key,
|
|
115
|
+
line,
|
|
116
|
+
raw,
|
|
117
|
+
value: decodePulledEnvEscapes(raw),
|
|
118
|
+
});
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (quote === '"' || quote === "'" || quote === "`") {
|
|
123
|
+
// As in dotenv: the first unescaped closing quote, possibly on a later
|
|
124
|
+
// line, followed only by whitespace or a comment.
|
|
125
|
+
const q = escapeRegExp(quote);
|
|
126
|
+
const remaining = [rest.slice(1), ...lines.slice(index + 1)].join("\n");
|
|
127
|
+
const closed = remaining.match(
|
|
128
|
+
new RegExp(`^((?:\\\\${q}|[^${q}])*)${q}[ \\t]*(?:#[^\\n]*)?(?:\\n|$)`),
|
|
129
|
+
);
|
|
130
|
+
if (closed) {
|
|
131
|
+
const raw = closed[1];
|
|
132
|
+
index += (closed[0].replace(/\n$/, "").match(/\n/g) ?? []).length;
|
|
133
|
+
entries.push({
|
|
134
|
+
endLine: index + 1,
|
|
135
|
+
key,
|
|
136
|
+
line,
|
|
137
|
+
raw,
|
|
138
|
+
value: quote === '"' ? decodePulledEnvEscapes(raw) : raw,
|
|
139
|
+
});
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// dotenv's unquoted form: up to the first `#`, trimmed, with one pair of
|
|
145
|
+
// matching surrounding quotes removed.
|
|
146
|
+
const text = rest.split("#", 1)[0].trim();
|
|
147
|
+
const surrounding = text.match(/^(['"`])([\s\S]*)\1$/);
|
|
148
|
+
const raw = surrounding ? surrounding[2] : text;
|
|
149
|
+
entries.push({
|
|
150
|
+
endLine: line,
|
|
151
|
+
key,
|
|
152
|
+
line,
|
|
153
|
+
raw,
|
|
154
|
+
value: text.startsWith('"') ? decodePulledEnvEscapes(raw) : raw,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const values: Record<string, string> = {};
|
|
159
|
+
for (const entry of entries) values[entry.key] = entry.value;
|
|
160
|
+
return { entries, unrecognizedLines, values };
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Decodes UTF-8, throwing on invalid bytes instead of replacing them. */
|
|
164
|
+
export function decodePulledEnvBytes(bytes: Uint8Array) {
|
|
165
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Reads and parses a dotenv file with {@link parsePulledEnv}. Throws on bytes
|
|
170
|
+
* that are not UTF-8 rather than silently replacing them.
|
|
171
|
+
*/
|
|
172
|
+
export function readPulledEnvFile(path: string): PulledEnvFile {
|
|
173
|
+
return parsePulledEnv(decodePulledEnvBytes(readFileSync(path)));
|
|
174
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
export type ClientDataIdentityStatus = "active" | "signed-out" | "unknown";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Storage-neutral identity fence for account-owned browser data.
|
|
5
|
+
*
|
|
6
|
+
* Owner IDs are opaque strings. The consuming app remains responsible for
|
|
7
|
+
* validating their format before calling these helpers.
|
|
8
|
+
*/
|
|
9
|
+
export interface ClientDataIdentityState<TOwnerId extends string = string> {
|
|
10
|
+
/** Last verified owner, retained while signed out so stored rows stay attributable. */
|
|
11
|
+
readonly lastOwnerId: TOwnerId | null;
|
|
12
|
+
/** Whether the last durable identity decision activated or fenced the owner. */
|
|
13
|
+
readonly status: ClientDataIdentityStatus;
|
|
14
|
+
/** Monotonic ordering for identity writes and cross-context notifications. */
|
|
15
|
+
readonly revision: number;
|
|
16
|
+
/** Revision of the newest sign-out explicitly requested by the user. */
|
|
17
|
+
readonly explicitSignOutRevision: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type ClientDataIdentitySignal<TOwnerId extends string = string> =
|
|
21
|
+
| {
|
|
22
|
+
readonly type: "owner-active";
|
|
23
|
+
readonly ownerId: TOwnerId;
|
|
24
|
+
readonly revision: number;
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
readonly type: "signed-out";
|
|
28
|
+
readonly explicit: boolean;
|
|
29
|
+
/** An immediate pre-persistence sign-out fence intentionally has no revision. */
|
|
30
|
+
readonly revision?: number;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export interface ClientDataIdentitySignalDecision {
|
|
34
|
+
readonly accepted: boolean;
|
|
35
|
+
readonly appliedRevision: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type ClientDataSignOutTransition<TOwnerId extends string = string> =
|
|
39
|
+
| {
|
|
40
|
+
readonly outcome: "applied";
|
|
41
|
+
readonly revision: number;
|
|
42
|
+
readonly signal: Extract<
|
|
43
|
+
ClientDataIdentitySignal<TOwnerId>,
|
|
44
|
+
{ type: "signed-out" }
|
|
45
|
+
>;
|
|
46
|
+
readonly state: ClientDataIdentityState<TOwnerId>;
|
|
47
|
+
}
|
|
48
|
+
| {
|
|
49
|
+
readonly outcome: "stale" | "unchanged";
|
|
50
|
+
readonly state: ClientDataIdentityState<TOwnerId>;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type ClientDataActivationTransition<TOwnerId extends string = string> =
|
|
54
|
+
| {
|
|
55
|
+
readonly outcome: "applied";
|
|
56
|
+
readonly revision: number;
|
|
57
|
+
readonly signal: Extract<
|
|
58
|
+
ClientDataIdentitySignal<TOwnerId>,
|
|
59
|
+
{ type: "owner-active" }
|
|
60
|
+
>;
|
|
61
|
+
readonly state: ClientDataIdentityState<TOwnerId>;
|
|
62
|
+
}
|
|
63
|
+
| {
|
|
64
|
+
readonly outcome: "blocked";
|
|
65
|
+
readonly state: ClientDataIdentityState<TOwnerId>;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
function assertRevision(value: number, label: string): void {
|
|
69
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
70
|
+
throw new TypeError(`${label} must be a non-negative safe integer.`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function assertState<TOwnerId extends string>(
|
|
75
|
+
state: ClientDataIdentityState<TOwnerId>,
|
|
76
|
+
): void {
|
|
77
|
+
assertRevision(state.revision, "Identity revision");
|
|
78
|
+
assertRevision(state.explicitSignOutRevision, "Explicit sign-out revision");
|
|
79
|
+
if (state.explicitSignOutRevision > state.revision) {
|
|
80
|
+
throw new TypeError(
|
|
81
|
+
"Explicit sign-out revision cannot exceed the identity revision.",
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
if (
|
|
85
|
+
state.status !== "active" &&
|
|
86
|
+
state.status !== "signed-out" &&
|
|
87
|
+
state.status !== "unknown"
|
|
88
|
+
) {
|
|
89
|
+
throw new TypeError("Identity status is invalid.");
|
|
90
|
+
}
|
|
91
|
+
if (
|
|
92
|
+
(state.lastOwnerId !== null && typeof state.lastOwnerId !== "string") ||
|
|
93
|
+
(state.status === "active" && state.lastOwnerId === null)
|
|
94
|
+
) {
|
|
95
|
+
throw new TypeError("Active client data must have a string owner ID.");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function nextRevision(revision: number): number {
|
|
100
|
+
if (revision === Number.MAX_SAFE_INTEGER) {
|
|
101
|
+
throw new RangeError("Identity revision is exhausted.");
|
|
102
|
+
}
|
|
103
|
+
return revision + 1;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Creates the durable state used before this device has verified an owner. */
|
|
107
|
+
export function createClientDataIdentityState<
|
|
108
|
+
TOwnerId extends string = string,
|
|
109
|
+
>(): ClientDataIdentityState<TOwnerId> {
|
|
110
|
+
return {
|
|
111
|
+
lastOwnerId: null,
|
|
112
|
+
status: "unknown",
|
|
113
|
+
revision: 0,
|
|
114
|
+
explicitSignOutRevision: 0,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Returns the owner that may be reopened offline, or null while fenced. */
|
|
119
|
+
export function activeClientDataOwner<TOwnerId extends string>(
|
|
120
|
+
state: ClientDataIdentityState<TOwnerId>,
|
|
121
|
+
): TOwnerId | null {
|
|
122
|
+
assertState(state);
|
|
123
|
+
return state.status === "active" ? state.lastOwnerId : null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Applies a signed-out identity answer to a state read in the same transaction.
|
|
128
|
+
*
|
|
129
|
+
* Pass `expectedRevision` from before an asynchronous session check. A newer
|
|
130
|
+
* identity write then makes that delayed answer stale instead of allowing it to
|
|
131
|
+
* fence the newly activated owner.
|
|
132
|
+
*/
|
|
133
|
+
export function transitionClientDataSignOut<TOwnerId extends string>(
|
|
134
|
+
state: ClientDataIdentityState<TOwnerId>,
|
|
135
|
+
options: {
|
|
136
|
+
readonly expectedRevision?: number;
|
|
137
|
+
readonly explicit?: boolean;
|
|
138
|
+
} = {},
|
|
139
|
+
): ClientDataSignOutTransition<TOwnerId> {
|
|
140
|
+
assertState(state);
|
|
141
|
+
if (options.expectedRevision !== undefined) {
|
|
142
|
+
assertRevision(options.expectedRevision, "Expected identity revision");
|
|
143
|
+
if (options.expectedRevision !== state.revision) {
|
|
144
|
+
return { outcome: "stale", state };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const explicit = options.explicit === true;
|
|
149
|
+
if (state.status === "signed-out" && !explicit) {
|
|
150
|
+
return { outcome: "unchanged", state };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const revision = nextRevision(state.revision);
|
|
154
|
+
const next = {
|
|
155
|
+
...state,
|
|
156
|
+
status: "signed-out" as const,
|
|
157
|
+
revision,
|
|
158
|
+
explicitSignOutRevision: explicit
|
|
159
|
+
? revision
|
|
160
|
+
: state.explicitSignOutRevision,
|
|
161
|
+
};
|
|
162
|
+
return {
|
|
163
|
+
outcome: "applied",
|
|
164
|
+
revision,
|
|
165
|
+
signal: { type: "signed-out", explicit, revision },
|
|
166
|
+
state: next,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Activates a freshly verified owner and advances the durable identity revision.
|
|
172
|
+
*
|
|
173
|
+
* `baselineRevision` only fences an explicit sign-out that happened after the
|
|
174
|
+
* caller began verification. It does not order competing owner verifications.
|
|
175
|
+
* Within one runtime, callers must abort or generation-check asynchronous
|
|
176
|
+
* session requests. Across tabs or workers, the persistence adapter must also
|
|
177
|
+
* compare the durable revision with the request's original revision, or apply
|
|
178
|
+
* equivalent durable ordering, before calling this transition. Otherwise an
|
|
179
|
+
* older owner-A response can overtake a newer owner-B activation.
|
|
180
|
+
*/
|
|
181
|
+
export function transitionClientDataActivation<TOwnerId extends string>(
|
|
182
|
+
state: ClientDataIdentityState<TOwnerId>,
|
|
183
|
+
ownerId: TOwnerId,
|
|
184
|
+
options: { readonly baselineRevision?: number } = {},
|
|
185
|
+
): ClientDataActivationTransition<TOwnerId> {
|
|
186
|
+
assertState(state);
|
|
187
|
+
if (typeof ownerId !== "string") {
|
|
188
|
+
throw new TypeError("Client-data owner ID must be a string.");
|
|
189
|
+
}
|
|
190
|
+
if (options.baselineRevision !== undefined) {
|
|
191
|
+
assertRevision(options.baselineRevision, "Baseline identity revision");
|
|
192
|
+
if (state.explicitSignOutRevision > options.baselineRevision) {
|
|
193
|
+
return { outcome: "blocked", state };
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const revision = nextRevision(state.revision);
|
|
198
|
+
const next = {
|
|
199
|
+
...state,
|
|
200
|
+
lastOwnerId: ownerId,
|
|
201
|
+
status: "active" as const,
|
|
202
|
+
revision,
|
|
203
|
+
};
|
|
204
|
+
return {
|
|
205
|
+
outcome: "applied",
|
|
206
|
+
revision,
|
|
207
|
+
signal: { type: "owner-active", ownerId, revision },
|
|
208
|
+
state: next,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Orders a validated cross-context identity signal against the newest applied
|
|
214
|
+
* durable revision. An unrevisioned sign-out is an immediate fence and always
|
|
215
|
+
* applies; the storage adapter must later reconcile it with durable state.
|
|
216
|
+
*/
|
|
217
|
+
export function acceptClientDataIdentitySignal<TOwnerId extends string>(
|
|
218
|
+
appliedRevision: number,
|
|
219
|
+
signal: ClientDataIdentitySignal<TOwnerId>,
|
|
220
|
+
): ClientDataIdentitySignalDecision {
|
|
221
|
+
assertRevision(appliedRevision, "Applied identity revision");
|
|
222
|
+
if (signal.revision === undefined) {
|
|
223
|
+
return { accepted: true, appliedRevision };
|
|
224
|
+
}
|
|
225
|
+
assertRevision(signal.revision, "Signal identity revision");
|
|
226
|
+
return signal.revision < appliedRevision
|
|
227
|
+
? { accepted: false, appliedRevision }
|
|
228
|
+
: { accepted: true, appliedRevision: signal.revision };
|
|
229
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./identity.ts";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { sha256Hex } from "./hash.ts";
|
|
2
|
+
import type { LoomFileRecord } from "./types.ts";
|
|
3
|
+
|
|
4
|
+
export interface LoomFileUploadResponse<
|
|
5
|
+
TRecord extends LoomFileRecord = LoomFileRecord,
|
|
6
|
+
> {
|
|
7
|
+
created: boolean;
|
|
8
|
+
file: TRecord;
|
|
9
|
+
reusedExisting: boolean;
|
|
10
|
+
sha256: string;
|
|
11
|
+
stored: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface UploadLoomFileOptions {
|
|
15
|
+
computeSha256?: boolean;
|
|
16
|
+
endpoint?: string;
|
|
17
|
+
extraFields?: Record<string, string>;
|
|
18
|
+
fetch?: typeof fetch;
|
|
19
|
+
fieldName?: string;
|
|
20
|
+
file: Blob;
|
|
21
|
+
filename?: string;
|
|
22
|
+
headers?: HeadersInit;
|
|
23
|
+
sha256?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getBlobFilename(file: Blob, fallback = "file") {
|
|
27
|
+
const candidate =
|
|
28
|
+
"name" in file && typeof file.name === "string" ? file.name : null;
|
|
29
|
+
return candidate || fallback;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function createLoomFileUploadFormData(
|
|
33
|
+
options: UploadLoomFileOptions,
|
|
34
|
+
) {
|
|
35
|
+
const formData = new FormData();
|
|
36
|
+
const fieldName = options.fieldName ?? "file";
|
|
37
|
+
const filename = options.filename ?? getBlobFilename(options.file);
|
|
38
|
+
const sha256 =
|
|
39
|
+
options.sha256 ??
|
|
40
|
+
(options.computeSha256 === false
|
|
41
|
+
? null
|
|
42
|
+
: await sha256Hex(await options.file.arrayBuffer()));
|
|
43
|
+
|
|
44
|
+
formData.set(fieldName, options.file, filename);
|
|
45
|
+
if (sha256) {
|
|
46
|
+
formData.set("sha256", sha256);
|
|
47
|
+
}
|
|
48
|
+
for (const [key, value] of Object.entries(options.extraFields ?? {})) {
|
|
49
|
+
formData.set(key, value);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return { formData, sha256 };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Uploads a blob through the shared multipart route contract. UI libraries can
|
|
57
|
+
* wrap this helper without coupling Loom to a specific component package.
|
|
58
|
+
*/
|
|
59
|
+
export async function uploadLoomFile<
|
|
60
|
+
TRecord extends LoomFileRecord = LoomFileRecord,
|
|
61
|
+
>(options: UploadLoomFileOptions): Promise<LoomFileUploadResponse<TRecord>> {
|
|
62
|
+
const fetchImpl = options.fetch ?? fetch;
|
|
63
|
+
const { formData } = await createLoomFileUploadFormData(options);
|
|
64
|
+
const response = await fetchImpl(options.endpoint ?? "/api/files", {
|
|
65
|
+
body: formData,
|
|
66
|
+
headers: options.headers,
|
|
67
|
+
method: "POST",
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
throw new Error(`Loom file upload failed with HTTP ${response.status}.`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return (await response.json()) as LoomFileUploadResponse<TRecord>;
|
|
75
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error for file runtime failures that can be translated into HTTP
|
|
3
|
+
* responses by route adapters.
|
|
4
|
+
*/
|
|
5
|
+
export class LoomFileError extends Error {
|
|
6
|
+
readonly code: string;
|
|
7
|
+
readonly status: number;
|
|
8
|
+
|
|
9
|
+
constructor(message: string, options: { code: string; status: number }) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "LoomFileError";
|
|
12
|
+
this.code = options.code;
|
|
13
|
+
this.status = options.status;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class LoomFileDigestMismatchError extends LoomFileError {
|
|
18
|
+
constructor(options: { actual: string; expected: string }) {
|
|
19
|
+
super(
|
|
20
|
+
`SHA-256 digest mismatch: expected ${options.expected}, received ${options.actual}.`,
|
|
21
|
+
{ code: "digest_mismatch", status: 400 },
|
|
22
|
+
);
|
|
23
|
+
this.name = "LoomFileDigestMismatchError";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class LoomFileDuplicateError extends LoomFileError {
|
|
28
|
+
constructor(message = "A file with the same SHA-256 digest already exists.") {
|
|
29
|
+
super(message, { code: "duplicate_file", status: 409 });
|
|
30
|
+
this.name = "LoomFileDuplicateError";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class LoomFileInvalidDigestError extends LoomFileError {
|
|
35
|
+
constructor(value: string) {
|
|
36
|
+
super(`Invalid SHA-256 digest: ${value}.`, {
|
|
37
|
+
code: "invalid_digest",
|
|
38
|
+
status: 400,
|
|
39
|
+
});
|
|
40
|
+
this.name = "LoomFileInvalidDigestError";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export class LoomFileNotFoundError extends LoomFileError {
|
|
45
|
+
constructor(message = "File not found.") {
|
|
46
|
+
super(message, { code: "not_found", status: 404 });
|
|
47
|
+
this.name = "LoomFileNotFoundError";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export class LoomFileSizeLimitError extends LoomFileError {
|
|
52
|
+
constructor(options: { actual: number; maxBytes: number }) {
|
|
53
|
+
super(
|
|
54
|
+
`File is too large: ${options.actual} bytes exceeds ${options.maxBytes} bytes.`,
|
|
55
|
+
{ code: "size_limit_exceeded", status: 413 },
|
|
56
|
+
);
|
|
57
|
+
this.name = "LoomFileSizeLimitError";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export class LoomFileStorageReadUnsupportedError extends LoomFileError {
|
|
62
|
+
constructor() {
|
|
63
|
+
super("The configured file storage adapter does not support reads.", {
|
|
64
|
+
code: "storage_read_unsupported",
|
|
65
|
+
status: 501,
|
|
66
|
+
});
|
|
67
|
+
this.name = "LoomFileStorageReadUnsupportedError";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LoomFileDigestMismatchError,
|
|
3
|
+
LoomFileInvalidDigestError,
|
|
4
|
+
LoomFileSizeLimitError,
|
|
5
|
+
} from "./errors.ts";
|
|
6
|
+
import type { LoomFileBody } from "./types.ts";
|
|
7
|
+
|
|
8
|
+
export interface ReadLoomFileBodyOptions {
|
|
9
|
+
maxBytes?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function toHex(bytes: Uint8Array) {
|
|
13
|
+
return [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function isReadableStream(value: unknown): value is ReadableStream<Uint8Array> {
|
|
17
|
+
return value instanceof ReadableStream;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function isArrayBufferView(value: unknown): value is ArrayBufferView {
|
|
21
|
+
return ArrayBuffer.isView(value);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function assertWithinLimit(byteSize: number, maxBytes: number | undefined) {
|
|
25
|
+
if (maxBytes !== undefined && byteSize > maxBytes) {
|
|
26
|
+
throw new LoomFileSizeLimitError({ actual: byteSize, maxBytes });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Reads a supported file body into bytes and enforces an optional size limit.
|
|
32
|
+
* Route adapters use this before hashing so server-side limits are applied
|
|
33
|
+
* consistently for raw and multipart uploads.
|
|
34
|
+
*/
|
|
35
|
+
export async function readLoomFileBodyBytes(
|
|
36
|
+
body: LoomFileBody,
|
|
37
|
+
options: ReadLoomFileBodyOptions = {},
|
|
38
|
+
) {
|
|
39
|
+
if (body instanceof Blob) {
|
|
40
|
+
assertWithinLimit(body.size, options.maxBytes);
|
|
41
|
+
return new Uint8Array(await body.arrayBuffer());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (body instanceof ArrayBuffer) {
|
|
45
|
+
assertWithinLimit(body.byteLength, options.maxBytes);
|
|
46
|
+
return new Uint8Array(body);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (isArrayBufferView(body)) {
|
|
50
|
+
assertWithinLimit(body.byteLength, options.maxBytes);
|
|
51
|
+
return new Uint8Array(body.buffer, body.byteOffset, body.byteLength);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (isReadableStream(body)) {
|
|
55
|
+
const reader = body.getReader();
|
|
56
|
+
const chunks: Uint8Array[] = [];
|
|
57
|
+
let size = 0;
|
|
58
|
+
|
|
59
|
+
while (true) {
|
|
60
|
+
const { done, value } = await reader.read();
|
|
61
|
+
if (done) break;
|
|
62
|
+
size += value.byteLength;
|
|
63
|
+
assertWithinLimit(size, options.maxBytes);
|
|
64
|
+
chunks.push(value);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const bytes = new Uint8Array(size);
|
|
68
|
+
let offset = 0;
|
|
69
|
+
for (const chunk of chunks) {
|
|
70
|
+
bytes.set(chunk, offset);
|
|
71
|
+
offset += chunk.byteLength;
|
|
72
|
+
}
|
|
73
|
+
return bytes;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
throw new TypeError("Unsupported Loom file body.");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export async function sha256Hex(body: Uint8Array | ArrayBuffer) {
|
|
80
|
+
const bytes = body instanceof ArrayBuffer ? new Uint8Array(body) : body;
|
|
81
|
+
const digest = await crypto.subtle.digest("SHA-256", bytes.slice().buffer);
|
|
82
|
+
return toHex(new Uint8Array(digest));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function isSha256Hex(value: string) {
|
|
86
|
+
return /^[a-f0-9]{64}$/i.test(value);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function normalizeSha256Hex(value: string) {
|
|
90
|
+
const normalized = value.trim().toLowerCase();
|
|
91
|
+
if (!isSha256Hex(normalized)) {
|
|
92
|
+
throw new LoomFileInvalidDigestError(value);
|
|
93
|
+
}
|
|
94
|
+
return normalized;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function assertExpectedSha256(actual: string, expected: string | null) {
|
|
98
|
+
if (!expected) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const normalizedExpected = normalizeSha256Hex(expected);
|
|
103
|
+
if (actual !== normalizedExpected) {
|
|
104
|
+
throw new LoomFileDigestMismatchError({
|
|
105
|
+
actual,
|
|
106
|
+
expected: normalizedExpected,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|