@gadicc/loom 1.38.0 → 2.0.1
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 +2010 -745
- 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 +26794 -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,210 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LoomFileDuplicateError,
|
|
3
|
+
LoomFileNotFoundError,
|
|
4
|
+
LoomFileStorageReadUnsupportedError,
|
|
5
|
+
} from "./errors.ts";
|
|
6
|
+
import {
|
|
7
|
+
assertExpectedSha256,
|
|
8
|
+
readLoomFileBodyBytes,
|
|
9
|
+
sha256Hex,
|
|
10
|
+
} from "./hash.ts";
|
|
11
|
+
import { detectLoomFileMetadata } from "./metadata.ts";
|
|
12
|
+
import type {
|
|
13
|
+
LoomFileRecord,
|
|
14
|
+
LoomFileRepository,
|
|
15
|
+
LoomFileService,
|
|
16
|
+
LoomFileStorageAdapter,
|
|
17
|
+
LoomFileVisibility,
|
|
18
|
+
SaveLoomFileInput,
|
|
19
|
+
} from "./types.ts";
|
|
20
|
+
|
|
21
|
+
export interface CreateLoomFileServiceOptions<
|
|
22
|
+
TRecord extends LoomFileRecord = LoomFileRecord,
|
|
23
|
+
> {
|
|
24
|
+
/**
|
|
25
|
+
* Controls what happens when the same SHA-256 digest already has an active
|
|
26
|
+
* record. `reuse` preserves content-addressed dedupe, `reject` returns a
|
|
27
|
+
* 409-style LoomFileDuplicateError, and `store` preserves the legacy
|
|
28
|
+
* `reuseExisting: false` behavior of attempting another storage/DB write.
|
|
29
|
+
*/
|
|
30
|
+
duplicatePolicy?: "reject" | "reuse" | "store";
|
|
31
|
+
objectKey?: (input: { byteSize: number; sha256: string }) => string;
|
|
32
|
+
repository: LoomFileRepository<TRecord>;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use duplicatePolicy instead. `false` maps to `store` unless
|
|
35
|
+
* duplicatePolicy is explicitly provided.
|
|
36
|
+
*/
|
|
37
|
+
reuseExisting?: boolean;
|
|
38
|
+
storage: LoomFileStorageAdapter;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function normalizeNullableText(value: string | null | undefined) {
|
|
42
|
+
const normalized = value?.trim();
|
|
43
|
+
return normalized ? normalized : null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function isActiveRecord(record: LoomFileRecord) {
|
|
47
|
+
return !record.deletedAt;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const visibilityRank = {
|
|
51
|
+
private: 0,
|
|
52
|
+
authenticated: 1,
|
|
53
|
+
public: 2,
|
|
54
|
+
} satisfies Record<LoomFileVisibility, number>;
|
|
55
|
+
|
|
56
|
+
function normalizeVisibility(
|
|
57
|
+
visibility: LoomFileVisibility | null | undefined,
|
|
58
|
+
): LoomFileVisibility {
|
|
59
|
+
return visibility ?? "private";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function mostPermissiveVisibility(
|
|
63
|
+
a: LoomFileVisibility | null | undefined,
|
|
64
|
+
b: LoomFileVisibility | null | undefined,
|
|
65
|
+
): LoomFileVisibility {
|
|
66
|
+
const normalizedA = normalizeVisibility(a);
|
|
67
|
+
const normalizedB = normalizeVisibility(b);
|
|
68
|
+
return visibilityRank[normalizedB] > visibilityRank[normalizedA]
|
|
69
|
+
? normalizedB
|
|
70
|
+
: normalizedA;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function maybeUpgradeExistingVisibility<
|
|
74
|
+
TRecord extends LoomFileRecord = LoomFileRecord,
|
|
75
|
+
>(
|
|
76
|
+
repository: LoomFileRepository<TRecord>,
|
|
77
|
+
record: TRecord,
|
|
78
|
+
requestedVisibility: LoomFileVisibility | null | undefined,
|
|
79
|
+
) {
|
|
80
|
+
const nextVisibility = mostPermissiveVisibility(
|
|
81
|
+
record.visibility,
|
|
82
|
+
requestedVisibility,
|
|
83
|
+
);
|
|
84
|
+
if (nextVisibility === record.visibility) return record;
|
|
85
|
+
return (
|
|
86
|
+
(await repository.updateVisibility?.(record.id, nextVisibility)) ?? record
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Creates the core files service used by route handlers and app-local adapters.
|
|
92
|
+
* It dedupes by SHA-256 before writing to object storage by default.
|
|
93
|
+
*/
|
|
94
|
+
export function createLoomFileService<
|
|
95
|
+
TRecord extends LoomFileRecord = LoomFileRecord,
|
|
96
|
+
>(options: CreateLoomFileServiceOptions<TRecord>): LoomFileService<TRecord> {
|
|
97
|
+
const duplicatePolicy =
|
|
98
|
+
options.duplicatePolicy ??
|
|
99
|
+
(options.reuseExisting === false ? "store" : "reuse");
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
async getDownloadObject(record) {
|
|
103
|
+
if (!options.storage.getObject) {
|
|
104
|
+
throw new LoomFileStorageReadUnsupportedError();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const object = await options.storage.getObject({
|
|
108
|
+
bucket: record.bucket,
|
|
109
|
+
objectKey: record.objectKey,
|
|
110
|
+
record,
|
|
111
|
+
});
|
|
112
|
+
if (!object) {
|
|
113
|
+
throw new LoomFileNotFoundError("Stored file object not found.");
|
|
114
|
+
}
|
|
115
|
+
return object;
|
|
116
|
+
},
|
|
117
|
+
async getFileById(id) {
|
|
118
|
+
if (!options.repository.findById) {
|
|
119
|
+
throw new LoomFileNotFoundError(
|
|
120
|
+
"This files repository does not support id lookups.",
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
const record = await options.repository.findById(id);
|
|
124
|
+
return record && isActiveRecord(record) ? record : null;
|
|
125
|
+
},
|
|
126
|
+
async getFileBySha256(sha256) {
|
|
127
|
+
const record = await options.repository.findBySha256(sha256);
|
|
128
|
+
return record && isActiveRecord(record) ? record : null;
|
|
129
|
+
},
|
|
130
|
+
async saveFile(input: SaveLoomFileInput) {
|
|
131
|
+
const bytes = await readLoomFileBodyBytes(input.body, {
|
|
132
|
+
maxBytes: input.maxBytes,
|
|
133
|
+
});
|
|
134
|
+
const sha256 = await sha256Hex(bytes);
|
|
135
|
+
assertExpectedSha256(sha256, input.expectedSha256 ?? null);
|
|
136
|
+
|
|
137
|
+
const existing = await options.repository.findBySha256(sha256);
|
|
138
|
+
if (existing && isActiveRecord(existing)) {
|
|
139
|
+
if (duplicatePolicy === "reject") {
|
|
140
|
+
throw new LoomFileDuplicateError();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (duplicatePolicy === "reuse") {
|
|
144
|
+
const record = await maybeUpgradeExistingVisibility(
|
|
145
|
+
options.repository,
|
|
146
|
+
existing,
|
|
147
|
+
input.visibility,
|
|
148
|
+
);
|
|
149
|
+
return {
|
|
150
|
+
byteSize: record.byteSize,
|
|
151
|
+
created: false,
|
|
152
|
+
detectedContentType: record.detectedContentType,
|
|
153
|
+
kind: record.kind,
|
|
154
|
+
record,
|
|
155
|
+
reusedExisting: true,
|
|
156
|
+
sha256,
|
|
157
|
+
stored: false,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const contentType = normalizeNullableText(input.contentType);
|
|
163
|
+
const detected = detectLoomFileMetadata(bytes, { contentType });
|
|
164
|
+
const objectKey =
|
|
165
|
+
input.objectKey ??
|
|
166
|
+
options.objectKey?.({ byteSize: bytes.byteLength, sha256 }) ??
|
|
167
|
+
sha256;
|
|
168
|
+
const storageReference = await options.storage.putObject({
|
|
169
|
+
body: bytes,
|
|
170
|
+
byteSize: bytes.byteLength,
|
|
171
|
+
contentType,
|
|
172
|
+
detectedContentType: detected.detectedContentType,
|
|
173
|
+
metadata: {
|
|
174
|
+
sha256,
|
|
175
|
+
},
|
|
176
|
+
objectKey,
|
|
177
|
+
sha256,
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const record = await options.repository.insert({
|
|
181
|
+
bucket: storageReference.bucket ?? options.storage.bucket ?? null,
|
|
182
|
+
byteSize: bytes.byteLength,
|
|
183
|
+
contentType,
|
|
184
|
+
detectedContentType: detected.detectedContentType,
|
|
185
|
+
imageMeta: detected.imageMeta,
|
|
186
|
+
kind: detected.kind,
|
|
187
|
+
meta: input.meta ?? {},
|
|
188
|
+
objectKey: storageReference.objectKey,
|
|
189
|
+
originalFilename: normalizeNullableText(input.originalFilename),
|
|
190
|
+
ownerId: normalizeNullableText(input.ownerId),
|
|
191
|
+
ownerType: normalizeNullableText(input.ownerType),
|
|
192
|
+
sha256,
|
|
193
|
+
storageProvider:
|
|
194
|
+
storageReference.storageProvider ?? options.storage.provider,
|
|
195
|
+
visibility: normalizeVisibility(input.visibility),
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
return {
|
|
199
|
+
byteSize: bytes.byteLength,
|
|
200
|
+
created: true,
|
|
201
|
+
detectedContentType: detected.detectedContentType,
|
|
202
|
+
kind: detected.kind,
|
|
203
|
+
record,
|
|
204
|
+
reusedExisting: false,
|
|
205
|
+
sha256,
|
|
206
|
+
stored: true,
|
|
207
|
+
};
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
export type LoomFileKind =
|
|
2
|
+
| "archive"
|
|
3
|
+
| "audio"
|
|
4
|
+
| "image"
|
|
5
|
+
| "other"
|
|
6
|
+
| "pdf"
|
|
7
|
+
| "text"
|
|
8
|
+
| "video";
|
|
9
|
+
|
|
10
|
+
export type LoomFileBody =
|
|
11
|
+
| ArrayBuffer
|
|
12
|
+
| ArrayBufferView
|
|
13
|
+
| Blob
|
|
14
|
+
| ReadableStream<Uint8Array>;
|
|
15
|
+
|
|
16
|
+
export interface LoomFileOwner {
|
|
17
|
+
ownerId: string;
|
|
18
|
+
ownerType: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type LoomFileVisibility = "authenticated" | "private" | "public";
|
|
22
|
+
|
|
23
|
+
export interface LoomImageMetadata extends Record<string, unknown> {
|
|
24
|
+
format: string;
|
|
25
|
+
height: number;
|
|
26
|
+
width: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface LoomFileDetectedMetadata {
|
|
30
|
+
detectedContentType: string | null;
|
|
31
|
+
imageMeta: LoomImageMetadata | null;
|
|
32
|
+
kind: LoomFileKind;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Canonical file metadata shape mirrored by the managed `files` schema
|
|
37
|
+
* blueprint. Apps may add domain associations in separate local tables.
|
|
38
|
+
*/
|
|
39
|
+
export interface LoomFileRecord {
|
|
40
|
+
audioMeta: Record<string, unknown> | null;
|
|
41
|
+
bucket: string | null;
|
|
42
|
+
byteSize: number;
|
|
43
|
+
contentType: string | null;
|
|
44
|
+
createdAt?: Date;
|
|
45
|
+
deletedAt?: Date | null;
|
|
46
|
+
detectedContentType: string | null;
|
|
47
|
+
id: string;
|
|
48
|
+
imageMeta: Record<string, unknown> | null;
|
|
49
|
+
kind: LoomFileKind;
|
|
50
|
+
meta: Record<string, unknown>;
|
|
51
|
+
objectKey: string;
|
|
52
|
+
originalFilename: string | null;
|
|
53
|
+
ownerId: string | null;
|
|
54
|
+
ownerType: string | null;
|
|
55
|
+
sha256: string;
|
|
56
|
+
storageProvider: string;
|
|
57
|
+
updatedAt?: Date;
|
|
58
|
+
visibility: LoomFileVisibility;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface LoomFileCreateInput {
|
|
62
|
+
audioMeta?: Record<string, unknown> | null;
|
|
63
|
+
bucket?: string | null;
|
|
64
|
+
byteSize: number;
|
|
65
|
+
contentType?: string | null;
|
|
66
|
+
detectedContentType?: string | null;
|
|
67
|
+
imageMeta?: Record<string, unknown> | null;
|
|
68
|
+
kind: LoomFileKind;
|
|
69
|
+
meta?: Record<string, unknown>;
|
|
70
|
+
objectKey: string;
|
|
71
|
+
originalFilename?: string | null;
|
|
72
|
+
ownerId?: string | null;
|
|
73
|
+
ownerType?: string | null;
|
|
74
|
+
sha256: string;
|
|
75
|
+
storageProvider: string;
|
|
76
|
+
visibility?: LoomFileVisibility;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Persistence adapter for the app-local Drizzle table materialized by
|
|
81
|
+
* `loom add files`.
|
|
82
|
+
*/
|
|
83
|
+
export interface LoomFileRepository<
|
|
84
|
+
TRecord extends LoomFileRecord = LoomFileRecord,
|
|
85
|
+
> {
|
|
86
|
+
findById?(id: string): Promise<TRecord | null>;
|
|
87
|
+
findBySha256(sha256: string): Promise<TRecord | null>;
|
|
88
|
+
insert(input: LoomFileCreateInput): Promise<TRecord>;
|
|
89
|
+
updateVisibility?(
|
|
90
|
+
id: string,
|
|
91
|
+
visibility: LoomFileVisibility,
|
|
92
|
+
): Promise<TRecord>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface LoomFileStorageReference {
|
|
96
|
+
bucket?: string | null;
|
|
97
|
+
objectKey: string;
|
|
98
|
+
storageProvider?: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface LoomFileStoragePutInput {
|
|
102
|
+
body: Uint8Array;
|
|
103
|
+
byteSize: number;
|
|
104
|
+
contentType?: string | null;
|
|
105
|
+
detectedContentType?: string | null;
|
|
106
|
+
metadata?: Record<string, string>;
|
|
107
|
+
objectKey: string;
|
|
108
|
+
sha256: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface LoomFileStorageGetInput {
|
|
112
|
+
bucket?: string | null;
|
|
113
|
+
objectKey: string;
|
|
114
|
+
record?: LoomFileRecord;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface LoomFileStorageGetResult {
|
|
118
|
+
body: BodyInit;
|
|
119
|
+
byteSize?: number;
|
|
120
|
+
contentType?: string | null;
|
|
121
|
+
etag?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Object-storage adapter boundary. Provider-specific packages such as S3 should
|
|
126
|
+
* implement this instead of leaking SDK types through the core runtime.
|
|
127
|
+
*/
|
|
128
|
+
export interface LoomFileStorageAdapter {
|
|
129
|
+
readonly bucket?: string | null;
|
|
130
|
+
readonly provider: string;
|
|
131
|
+
deleteObject?(input: LoomFileStorageGetInput): Promise<void>;
|
|
132
|
+
getObject?(
|
|
133
|
+
input: LoomFileStorageGetInput,
|
|
134
|
+
): Promise<LoomFileStorageGetResult | null>;
|
|
135
|
+
putObject(input: LoomFileStoragePutInput): Promise<LoomFileStorageReference>;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface SaveLoomFileInput {
|
|
139
|
+
body: LoomFileBody;
|
|
140
|
+
contentType?: string | null;
|
|
141
|
+
expectedSha256?: string | null;
|
|
142
|
+
maxBytes?: number;
|
|
143
|
+
meta?: Record<string, unknown>;
|
|
144
|
+
objectKey?: string;
|
|
145
|
+
originalFilename?: string | null;
|
|
146
|
+
ownerId?: string | null;
|
|
147
|
+
ownerType?: string | null;
|
|
148
|
+
visibility?: LoomFileVisibility;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface SaveLoomFileResult<
|
|
152
|
+
TRecord extends LoomFileRecord = LoomFileRecord,
|
|
153
|
+
> {
|
|
154
|
+
byteSize: number;
|
|
155
|
+
created: boolean;
|
|
156
|
+
detectedContentType: string | null;
|
|
157
|
+
kind: LoomFileKind;
|
|
158
|
+
record: TRecord;
|
|
159
|
+
reusedExisting: boolean;
|
|
160
|
+
sha256: string;
|
|
161
|
+
stored: boolean;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface LoomFileService<
|
|
165
|
+
TRecord extends LoomFileRecord = LoomFileRecord,
|
|
166
|
+
> {
|
|
167
|
+
getDownloadObject(record: TRecord): Promise<LoomFileStorageGetResult>;
|
|
168
|
+
getFileById(id: string): Promise<TRecord | null>;
|
|
169
|
+
getFileBySha256(sha256: string): Promise<TRecord | null>;
|
|
170
|
+
saveFile(input: SaveLoomFileInput): Promise<SaveLoomFileResult<TRecord>>;
|
|
171
|
+
}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
JobCatalog,
|
|
3
|
+
JobDefinition,
|
|
4
|
+
JobMeta,
|
|
5
|
+
JobParams,
|
|
6
|
+
JobParamsDefinition,
|
|
7
|
+
} from "./types.ts";
|
|
8
|
+
|
|
9
|
+
// oxlint-disable-next-line typescript/no-explicit-any -- Match JobDefinition's parameter erasure while preserving concrete handler inference.
|
|
10
|
+
type JobModule<TParams extends Record<string, any>> = Pick<
|
|
11
|
+
JobDefinition<TParams>,
|
|
12
|
+
"handler" | "meta"
|
|
13
|
+
>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Create a catalog entry that exposes metadata immediately and loads its job
|
|
17
|
+
* implementation only when selected for execution.
|
|
18
|
+
*
|
|
19
|
+
* This prevents HTTP routes and direct runners from evaluating every job's
|
|
20
|
+
* transitive dependencies while constructing a catalog.
|
|
21
|
+
*/
|
|
22
|
+
export function createLazyJob<
|
|
23
|
+
// oxlint-disable-next-line typescript/no-explicit-any -- Preserve JobDefinition's heterogeneous parameter compatibility without widening concrete handlers.
|
|
24
|
+
TParams extends Record<string, any> = Record<string, any>,
|
|
25
|
+
>(
|
|
26
|
+
meta: JobDefinition<TParams>["meta"],
|
|
27
|
+
load: () => Promise<JobModule<TParams>>,
|
|
28
|
+
): JobDefinition<TParams> {
|
|
29
|
+
let loadedJob: Promise<JobModule<TParams>> | undefined;
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
meta,
|
|
33
|
+
async handler(controller, params) {
|
|
34
|
+
loadedJob ??= load().then((job) => {
|
|
35
|
+
if (job.meta.id !== meta.id) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Lazy job metadata mismatch: expected "${meta.id}", loaded "${job.meta.id}"`,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
return job;
|
|
41
|
+
});
|
|
42
|
+
const job = await loadedJob;
|
|
43
|
+
await job.handler(controller, params);
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function createJobCatalog<const TJobs extends readonly JobDefinition[]>(
|
|
49
|
+
jobs: TJobs,
|
|
50
|
+
): JobCatalog<TJobs[number]> {
|
|
51
|
+
const registry: Record<string, TJobs[number]> = {};
|
|
52
|
+
const metas = jobs.map((job) => job.meta);
|
|
53
|
+
|
|
54
|
+
for (const job of jobs) {
|
|
55
|
+
const id = job.meta.id.trim();
|
|
56
|
+
if (!id) {
|
|
57
|
+
throw new Error("Job meta.id must be non-empty.");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (id in registry) {
|
|
61
|
+
throw new Error(`Duplicate job id "${id}".`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
registry[id] = job;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
jobs: Object.freeze(registry),
|
|
69
|
+
metas: Object.freeze([...metas]),
|
|
70
|
+
ids: Object.freeze(metas.map((meta) => meta.id)),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function getJob<TJob extends JobDefinition>(
|
|
75
|
+
catalog: JobCatalog<TJob>,
|
|
76
|
+
id: string,
|
|
77
|
+
): TJob | undefined {
|
|
78
|
+
return catalog.jobs[id];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function isJobMeta(value: unknown): value is JobMeta {
|
|
82
|
+
if (!value || typeof value !== "object") {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const meta = value as Partial<JobMeta>;
|
|
87
|
+
return typeof meta.id === "string" && typeof meta.desc === "string";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function isJobDefinition(value: unknown): value is JobDefinition {
|
|
91
|
+
if (!value || typeof value !== "object") {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const job = value as Partial<JobDefinition>;
|
|
96
|
+
return isJobMeta(job.meta) && typeof job.handler === "function";
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function isJobCatalog<TJob extends JobDefinition>(
|
|
100
|
+
value: unknown,
|
|
101
|
+
): value is JobCatalog<TJob> {
|
|
102
|
+
if (!value || typeof value !== "object") {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const catalog = value as Partial<JobCatalog<TJob>>;
|
|
107
|
+
return (
|
|
108
|
+
!!catalog.jobs &&
|
|
109
|
+
typeof catalog.jobs === "object" &&
|
|
110
|
+
Array.isArray(catalog.metas) &&
|
|
111
|
+
Array.isArray(catalog.ids)
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function getSourceValues(source: Record<string, unknown> | Iterable<unknown>) {
|
|
116
|
+
if (Symbol.iterator in Object(source)) {
|
|
117
|
+
return Array.from(source as Iterable<unknown>);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return Object.values(source);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function collectJobDefinitions(
|
|
124
|
+
source: Record<string, unknown> | Iterable<unknown>,
|
|
125
|
+
): JobDefinition[] {
|
|
126
|
+
return getSourceValues(source).filter(isJobDefinition);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function collectJobMetas(
|
|
130
|
+
source: Record<string, unknown> | Iterable<unknown>,
|
|
131
|
+
): JobMeta[] {
|
|
132
|
+
return getSourceValues(source).filter(isJobMeta);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function createJobCatalogFromSource<TJob extends JobDefinition>(
|
|
136
|
+
source: JobCatalog<TJob> | Record<string, unknown> | Iterable<unknown>,
|
|
137
|
+
): JobCatalog<TJob> {
|
|
138
|
+
if (isJobCatalog<TJob>(source)) {
|
|
139
|
+
return source;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return createJobCatalog(collectJobDefinitions(source) as TJob[]);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface ResolvedJobSelection<TJob extends JobDefinition> {
|
|
146
|
+
id: string;
|
|
147
|
+
job: TJob;
|
|
148
|
+
index: number | null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function resolveJobSelection<TJob extends JobDefinition>(
|
|
152
|
+
catalog: JobCatalog<TJob>,
|
|
153
|
+
selection: string,
|
|
154
|
+
): ResolvedJobSelection<TJob> {
|
|
155
|
+
if (!selection) {
|
|
156
|
+
throw new Error("Please provide a job ID as the first argument.");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const jobIndex = Number.parseInt(selection, 10);
|
|
160
|
+
if (jobIndex.toString() === selection) {
|
|
161
|
+
const meta = catalog.metas[jobIndex];
|
|
162
|
+
if (!meta) {
|
|
163
|
+
throw new Error(`Invalid job number "${jobIndex}".`);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
id: meta.id,
|
|
168
|
+
job: catalog.jobs[meta.id],
|
|
169
|
+
index: jobIndex,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const job = catalog.jobs[selection];
|
|
174
|
+
if (!job) {
|
|
175
|
+
throw new Error(`No job found with ID "${selection}".`);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return {
|
|
179
|
+
id: selection,
|
|
180
|
+
job,
|
|
181
|
+
index: null,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function createJobUsageText<TJob extends JobDefinition>(
|
|
186
|
+
catalog: JobCatalog<TJob>,
|
|
187
|
+
command = "pnpm job",
|
|
188
|
+
): string {
|
|
189
|
+
const lines = [
|
|
190
|
+
`Usage: ${command} <jobId>[?key=value&key2=value2]`,
|
|
191
|
+
"",
|
|
192
|
+
"Available jobs:",
|
|
193
|
+
];
|
|
194
|
+
|
|
195
|
+
catalog.metas.forEach((meta, index) => {
|
|
196
|
+
lines.push(
|
|
197
|
+
` - [${index.toString().padStart(2, " ")}] ${meta.id}: ${meta.desc}`,
|
|
198
|
+
);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
lines.push("");
|
|
202
|
+
|
|
203
|
+
return lines.join("\n");
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export function validateAndParseParams(
|
|
207
|
+
rawParams: Record<string, string>,
|
|
208
|
+
paramsDef?: JobParamsDefinition,
|
|
209
|
+
): { parsed: JobParams; errors: string[] } {
|
|
210
|
+
const parsed: JobParams = {};
|
|
211
|
+
const errors: string[] = [];
|
|
212
|
+
|
|
213
|
+
if (!paramsDef) {
|
|
214
|
+
return { parsed: rawParams, errors: [] };
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
for (const [key, def] of Object.entries(paramsDef)) {
|
|
218
|
+
const rawVal = rawParams[key];
|
|
219
|
+
|
|
220
|
+
if (rawVal === undefined) {
|
|
221
|
+
if (def.required) {
|
|
222
|
+
errors.push(`Missing required option: --${key}`);
|
|
223
|
+
} else if (def.default !== undefined) {
|
|
224
|
+
parsed[key] = def.default;
|
|
225
|
+
}
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (def.type === "boolean") {
|
|
230
|
+
const lower = rawVal.toLowerCase();
|
|
231
|
+
if (
|
|
232
|
+
lower === "true" ||
|
|
233
|
+
lower === "" ||
|
|
234
|
+
lower === "1" ||
|
|
235
|
+
lower === "yes"
|
|
236
|
+
) {
|
|
237
|
+
parsed[key] = true;
|
|
238
|
+
} else if (lower === "false" || lower === "0" || lower === "no") {
|
|
239
|
+
parsed[key] = false;
|
|
240
|
+
} else {
|
|
241
|
+
errors.push(
|
|
242
|
+
`Invalid value for boolean option --${key}: "${rawVal}". Expected true or false.`,
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
} else if (def.type === "number") {
|
|
246
|
+
const num = Number(rawVal);
|
|
247
|
+
if (Number.isNaN(num)) {
|
|
248
|
+
errors.push(
|
|
249
|
+
`Invalid value for number option --${key}: "${rawVal}". Expected a number.`,
|
|
250
|
+
);
|
|
251
|
+
} else {
|
|
252
|
+
parsed[key] = num;
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
parsed[key] = rawVal;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
for (const key of Object.keys(rawParams)) {
|
|
260
|
+
if (!(key in paramsDef)) {
|
|
261
|
+
errors.push(`Unknown option: --${key}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return { parsed, errors };
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export function createJobHelpText(meta: JobMeta, command = "pnpm job"): string {
|
|
269
|
+
const lines = [
|
|
270
|
+
`Job: ${meta.id}`,
|
|
271
|
+
`Description: ${meta.desc}`,
|
|
272
|
+
"",
|
|
273
|
+
`Usage: ${command} ${meta.id} [options]`,
|
|
274
|
+
];
|
|
275
|
+
|
|
276
|
+
if (meta.params && Object.keys(meta.params).length > 0) {
|
|
277
|
+
lines.push("", "Options:");
|
|
278
|
+
const keys = Object.keys(meta.params);
|
|
279
|
+
const maxKeyLength = Math.max(...keys.map((k) => k.length));
|
|
280
|
+
|
|
281
|
+
for (const [key, def] of Object.entries(meta.params)) {
|
|
282
|
+
const typeStr = `<${def.type}>`;
|
|
283
|
+
const optPart = `--${key} ${typeStr}`.padEnd(maxKeyLength + 12, " ");
|
|
284
|
+
let descPart = def.desc;
|
|
285
|
+
const details: string[] = [];
|
|
286
|
+
if (def.required) {
|
|
287
|
+
details.push("required");
|
|
288
|
+
}
|
|
289
|
+
if (def.default !== undefined) {
|
|
290
|
+
details.push(`default: ${JSON.stringify(def.default)}`);
|
|
291
|
+
}
|
|
292
|
+
if (details.length > 0) {
|
|
293
|
+
descPart += ` (${details.join(", ")})`;
|
|
294
|
+
}
|
|
295
|
+
lines.push(` ${optPart}${descPart}`);
|
|
296
|
+
}
|
|
297
|
+
} else {
|
|
298
|
+
lines.push("", "Options: None");
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
lines.push("");
|
|
302
|
+
return lines.join("\n");
|
|
303
|
+
}
|