@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,1044 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MUI components for API-key management.
|
|
5
|
+
*
|
|
6
|
+
* Requires `@mui/material` 6 or newer (TextField `slotProps`), although the
|
|
7
|
+
* package's optional `@mui/material` peer stays `>=5` for `mui/mail` and
|
|
8
|
+
* `mui/confirm`. The dialogs track pending requests with React 19 async
|
|
9
|
+
* transitions; on React 18 they work but do not disable while pending.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import Alert, { type AlertProps } from "@mui/material/Alert";
|
|
15
|
+
import Box from "@mui/material/Box";
|
|
16
|
+
import Button from "@mui/material/Button";
|
|
17
|
+
import Checkbox from "@mui/material/Checkbox";
|
|
18
|
+
import Chip from "@mui/material/Chip";
|
|
19
|
+
import CircularProgress from "@mui/material/CircularProgress";
|
|
20
|
+
import Dialog from "@mui/material/Dialog";
|
|
21
|
+
import DialogActions from "@mui/material/DialogActions";
|
|
22
|
+
import DialogContent from "@mui/material/DialogContent";
|
|
23
|
+
import DialogContentText from "@mui/material/DialogContentText";
|
|
24
|
+
import DialogTitle from "@mui/material/DialogTitle";
|
|
25
|
+
import FormControlLabel from "@mui/material/FormControlLabel";
|
|
26
|
+
import Paper from "@mui/material/Paper";
|
|
27
|
+
import Stack from "@mui/material/Stack";
|
|
28
|
+
import Table from "@mui/material/Table";
|
|
29
|
+
import TableBody from "@mui/material/TableBody";
|
|
30
|
+
import TableCell from "@mui/material/TableCell";
|
|
31
|
+
import TableContainer from "@mui/material/TableContainer";
|
|
32
|
+
import TableHead from "@mui/material/TableHead";
|
|
33
|
+
import TablePagination from "@mui/material/TablePagination";
|
|
34
|
+
import TableRow from "@mui/material/TableRow";
|
|
35
|
+
import TextField from "@mui/material/TextField";
|
|
36
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
37
|
+
import Typography from "@mui/material/Typography";
|
|
38
|
+
import React, { type ReactNode } from "react";
|
|
39
|
+
import { describeApiKeyTransports } from "../apiKeys/credentials.ts";
|
|
40
|
+
import type {
|
|
41
|
+
ApiKeyCreateActionResult,
|
|
42
|
+
ApiKeyCreateInput,
|
|
43
|
+
ApiKeyCreateResult,
|
|
44
|
+
ApiKeyMutationResult,
|
|
45
|
+
} from "../apiKeys/lifecycle.ts";
|
|
46
|
+
import type { ApiKeyLimits } from "../apiKeys/limits.ts";
|
|
47
|
+
import type { ApiKeyCredentialOptions } from "../apiKeys/types.ts";
|
|
48
|
+
import {
|
|
49
|
+
API_KEY_CREATE_FAILED_MESSAGE,
|
|
50
|
+
API_KEY_RENAME_FAILED_MESSAGE,
|
|
51
|
+
API_KEY_REVOKE_FAILED_MESSAGE,
|
|
52
|
+
type ApiKeyAuditRow,
|
|
53
|
+
type ApiKeyRow,
|
|
54
|
+
type ApiKeyScopeDefinition,
|
|
55
|
+
type ApiKeyThrownErrorMessages,
|
|
56
|
+
countryCodeToFlagEmoji,
|
|
57
|
+
formatApiKeyDate,
|
|
58
|
+
getApiKeyAuditReason,
|
|
59
|
+
getApiKeyCustomExpiryInputBounds,
|
|
60
|
+
getApiKeyExpiryOptions,
|
|
61
|
+
getApiKeyStatus,
|
|
62
|
+
getApiKeyTransportGuidanceCopy,
|
|
63
|
+
resolveApiKeyCreateActionResult,
|
|
64
|
+
resolveApiKeyCreateInput,
|
|
65
|
+
resolveApiKeyMutationResult,
|
|
66
|
+
resolveApiKeyRename,
|
|
67
|
+
resolveApiKeyThrownErrorMessage,
|
|
68
|
+
} from "./apiKeysView.ts";
|
|
69
|
+
|
|
70
|
+
export * from "./apiKeysView.ts";
|
|
71
|
+
|
|
72
|
+
/* oxlint-disable jsx-a11y/prefer-tag-over-role -- A country flag is text emoji, not a URL-backed img element. */
|
|
73
|
+
function IpCountry(props: {
|
|
74
|
+
countryCode?: string | null;
|
|
75
|
+
ipAddress?: string | null;
|
|
76
|
+
}) {
|
|
77
|
+
const flag = countryCodeToFlagEmoji(props.countryCode);
|
|
78
|
+
if (!flag && !props.ipAddress) return <>—</>;
|
|
79
|
+
return (
|
|
80
|
+
<>
|
|
81
|
+
{flag ? (
|
|
82
|
+
<Box
|
|
83
|
+
component="span"
|
|
84
|
+
role="img"
|
|
85
|
+
aria-label={props.countryCode?.toUpperCase()}
|
|
86
|
+
sx={{ mr: props.ipAddress ? 0.75 : 0 }}
|
|
87
|
+
>
|
|
88
|
+
{flag}
|
|
89
|
+
</Box>
|
|
90
|
+
) : null}
|
|
91
|
+
{props.ipAddress}
|
|
92
|
+
</>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* oxlint-enable jsx-a11y/prefer-tag-over-role */
|
|
97
|
+
|
|
98
|
+
export interface ApiKeyTableColumn {
|
|
99
|
+
header: ReactNode;
|
|
100
|
+
id: string;
|
|
101
|
+
render: (row: ApiKeyRow) => ReactNode;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface ApiKeyCreateDialogProps {
|
|
105
|
+
/** Offer "Never" as an expiry. Defaults to `true`. */
|
|
106
|
+
allowNoExpiry?: boolean;
|
|
107
|
+
error?: string | null;
|
|
108
|
+
/**
|
|
109
|
+
* Preset lifetimes in days. Presets outside `limits` are hidden. Defaults
|
|
110
|
+
* to `[7, 30]`.
|
|
111
|
+
*/
|
|
112
|
+
expiryPresetDays?: readonly number[];
|
|
113
|
+
/**
|
|
114
|
+
* Name and expiry bounds, checked before `onCreate` with the same messages
|
|
115
|
+
* as server-side validation. Pass the limits given to the plugin; omitted
|
|
116
|
+
* bounds are not checked here.
|
|
117
|
+
*/
|
|
118
|
+
limits?: Partial<ApiKeyLimits>;
|
|
119
|
+
onClose: () => void;
|
|
120
|
+
/**
|
|
121
|
+
* Creates the key. Return `{ ok: false, message }` for a user-correctable
|
|
122
|
+
* problem: Next.js masks thrown Server Function messages in production.
|
|
123
|
+
* A thrown error's message is shown unless `thrownErrorMessages` is
|
|
124
|
+
* `"generic"`.
|
|
125
|
+
*/
|
|
126
|
+
onCreate: (
|
|
127
|
+
input: ApiKeyCreateInput,
|
|
128
|
+
) => Promise<ApiKeyCreateResult | ApiKeyCreateActionResult>;
|
|
129
|
+
onCreated: (result: ApiKeyCreateResult) => void;
|
|
130
|
+
open: boolean;
|
|
131
|
+
scopes: ApiKeyScopeDefinition[];
|
|
132
|
+
/**
|
|
133
|
+
* `"show"` (default, the original behaviour) displays a thrown error's
|
|
134
|
+
* message; `"generic"` shows a fixed message instead. Use `"generic"` with
|
|
135
|
+
* result-returning `onCreate` callbacks.
|
|
136
|
+
*/
|
|
137
|
+
thrownErrorMessages?: ApiKeyThrownErrorMessages;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function ApiKeyCreateDialog(props: ApiKeyCreateDialogProps) {
|
|
141
|
+
const expiryOptions = getApiKeyExpiryOptions({
|
|
142
|
+
allowNoExpiry: props.allowNoExpiry,
|
|
143
|
+
expiryPresetDays: props.expiryPresetDays,
|
|
144
|
+
limits: props.limits,
|
|
145
|
+
});
|
|
146
|
+
const defaultExpiry = expiryOptions[0].value;
|
|
147
|
+
const [name, setName] = React.useState("");
|
|
148
|
+
const [scopeIds, setScopeIds] = React.useState<string[]>([]);
|
|
149
|
+
const [expiryChoice, setExpiry] = React.useState(defaultExpiry);
|
|
150
|
+
const [customExpiry, setCustomExpiry] = React.useState("");
|
|
151
|
+
const [localError, setLocalError] = React.useState<string | null>(null);
|
|
152
|
+
const [pending, startTransition] = React.useTransition();
|
|
153
|
+
// Reference time for the custom input's min/max. It is refreshed when the
|
|
154
|
+
// dialog opens, when the input is chosen, focused, or changed, and on
|
|
155
|
+
// submit, so the bounds are never older than the last interaction. A value
|
|
156
|
+
// picked at the minimum and submitted more than the tolerance later is
|
|
157
|
+
// genuinely too soon and is rejected with the server's message.
|
|
158
|
+
const [boundsTime, setBoundsTime] = React.useState(() => Date.now());
|
|
159
|
+
const [wasOpen, setWasOpen] = React.useState(props.open);
|
|
160
|
+
if (props.open !== wasOpen) {
|
|
161
|
+
setWasOpen(props.open);
|
|
162
|
+
if (props.open) setBoundsTime(Date.now());
|
|
163
|
+
}
|
|
164
|
+
// Fall back to the default if changed props removed the chosen option.
|
|
165
|
+
const expiry = expiryOptions.some((option) => option.value === expiryChoice)
|
|
166
|
+
? expiryChoice
|
|
167
|
+
: defaultExpiry;
|
|
168
|
+
const customBounds =
|
|
169
|
+
expiry === "custom"
|
|
170
|
+
? getApiKeyCustomExpiryInputBounds(props.limits, boundsTime)
|
|
171
|
+
: null;
|
|
172
|
+
|
|
173
|
+
const close = () => {
|
|
174
|
+
if (!pending) props.onClose();
|
|
175
|
+
};
|
|
176
|
+
const submit = () => {
|
|
177
|
+
const now = Date.now();
|
|
178
|
+
// A failed check below shows the picker's minimum as of now.
|
|
179
|
+
setBoundsTime(now);
|
|
180
|
+
const input = resolveApiKeyCreateInput(
|
|
181
|
+
{ customExpiry, expiry, name, scopeIds },
|
|
182
|
+
{ allowNoExpiry: props.allowNoExpiry, limits: props.limits, now },
|
|
183
|
+
);
|
|
184
|
+
if (!input.ok) {
|
|
185
|
+
setLocalError(input.message);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
setLocalError(null);
|
|
189
|
+
startTransition(async () => {
|
|
190
|
+
try {
|
|
191
|
+
const result = resolveApiKeyCreateActionResult(
|
|
192
|
+
await props.onCreate(input.value),
|
|
193
|
+
);
|
|
194
|
+
if (!result.ok) {
|
|
195
|
+
// Keep every field so the user can correct the input.
|
|
196
|
+
setLocalError(result.message);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
props.onCreated(result.created);
|
|
200
|
+
setName("");
|
|
201
|
+
setScopeIds([]);
|
|
202
|
+
setExpiry(defaultExpiry);
|
|
203
|
+
setCustomExpiry("");
|
|
204
|
+
props.onClose();
|
|
205
|
+
} catch (error) {
|
|
206
|
+
setLocalError(
|
|
207
|
+
resolveApiKeyThrownErrorMessage(
|
|
208
|
+
error,
|
|
209
|
+
props.thrownErrorMessages ?? "show",
|
|
210
|
+
API_KEY_CREATE_FAILED_MESSAGE,
|
|
211
|
+
),
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
<Dialog
|
|
219
|
+
open={props.open}
|
|
220
|
+
onClose={close}
|
|
221
|
+
fullWidth
|
|
222
|
+
maxWidth="sm"
|
|
223
|
+
aria-labelledby="loom-api-key-create-title"
|
|
224
|
+
>
|
|
225
|
+
<DialogTitle id="loom-api-key-create-title">Create API key</DialogTitle>
|
|
226
|
+
<DialogContent>
|
|
227
|
+
<Stack spacing={2} sx={{ pt: 1 }}>
|
|
228
|
+
<TextField
|
|
229
|
+
label="Key name"
|
|
230
|
+
value={name}
|
|
231
|
+
required
|
|
232
|
+
autoFocus
|
|
233
|
+
onChange={(event) => setName(event.target.value)}
|
|
234
|
+
disabled={pending}
|
|
235
|
+
/>
|
|
236
|
+
<Box component="fieldset" sx={{ border: 0, m: 0, p: 0 }}>
|
|
237
|
+
<Typography component="legend" variant="subtitle2">
|
|
238
|
+
Scopes
|
|
239
|
+
</Typography>
|
|
240
|
+
{props.scopes.map((scope) => (
|
|
241
|
+
<Tooltip
|
|
242
|
+
key={scope.id}
|
|
243
|
+
title={scope.description ?? ""}
|
|
244
|
+
placement="right"
|
|
245
|
+
>
|
|
246
|
+
<FormControlLabel
|
|
247
|
+
control={
|
|
248
|
+
<Checkbox
|
|
249
|
+
checked={scopeIds.includes(scope.id)}
|
|
250
|
+
onChange={(_, checked) =>
|
|
251
|
+
setScopeIds((current) =>
|
|
252
|
+
checked
|
|
253
|
+
? [...current, scope.id]
|
|
254
|
+
: current.filter((id) => id !== scope.id),
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
/>
|
|
258
|
+
}
|
|
259
|
+
disabled={pending || scope.disabled}
|
|
260
|
+
label={scope.label}
|
|
261
|
+
/>
|
|
262
|
+
</Tooltip>
|
|
263
|
+
))}
|
|
264
|
+
</Box>
|
|
265
|
+
<TextField
|
|
266
|
+
select
|
|
267
|
+
label="Expiry"
|
|
268
|
+
value={expiry}
|
|
269
|
+
onChange={(event) => {
|
|
270
|
+
setExpiry(event.target.value);
|
|
271
|
+
setBoundsTime(Date.now());
|
|
272
|
+
}}
|
|
273
|
+
disabled={pending}
|
|
274
|
+
slotProps={{ select: { native: true } }}
|
|
275
|
+
>
|
|
276
|
+
{expiryOptions.map((option) => (
|
|
277
|
+
<option key={option.value} value={option.value}>
|
|
278
|
+
{option.label}
|
|
279
|
+
</option>
|
|
280
|
+
))}
|
|
281
|
+
</TextField>
|
|
282
|
+
{customBounds ? (
|
|
283
|
+
<TextField
|
|
284
|
+
type="datetime-local"
|
|
285
|
+
label="Expires at"
|
|
286
|
+
value={customExpiry}
|
|
287
|
+
onChange={(event) => {
|
|
288
|
+
setCustomExpiry(event.target.value);
|
|
289
|
+
setBoundsTime(Date.now());
|
|
290
|
+
}}
|
|
291
|
+
onFocus={() => setBoundsTime(Date.now())}
|
|
292
|
+
slotProps={{
|
|
293
|
+
htmlInput: { max: customBounds.max, min: customBounds.min },
|
|
294
|
+
inputLabel: { shrink: true },
|
|
295
|
+
}}
|
|
296
|
+
disabled={pending}
|
|
297
|
+
/>
|
|
298
|
+
) : null}
|
|
299
|
+
{localError || props.error ? (
|
|
300
|
+
<Alert severity="error">{localError ?? props.error}</Alert>
|
|
301
|
+
) : null}
|
|
302
|
+
</Stack>
|
|
303
|
+
</DialogContent>
|
|
304
|
+
<DialogActions>
|
|
305
|
+
<Button onClick={close} disabled={pending}>
|
|
306
|
+
Cancel
|
|
307
|
+
</Button>
|
|
308
|
+
<Button onClick={submit} variant="contained" disabled={pending}>
|
|
309
|
+
{pending ? "Creating…" : "Create key"}
|
|
310
|
+
</Button>
|
|
311
|
+
</DialogActions>
|
|
312
|
+
</Dialog>
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export interface ApiKeyTransportGuidanceProps {
|
|
317
|
+
/**
|
|
318
|
+
* The same plain options object the authorizer uses, so the copy cannot
|
|
319
|
+
* drift from the transports the app accepts.
|
|
320
|
+
*/
|
|
321
|
+
credentialOptions: ApiKeyCredentialOptions;
|
|
322
|
+
sx?: AlertProps["sx"];
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Tells key holders how to send a key: the preferred transport (Bearer when
|
|
327
|
+
* enabled), the other accepted ones, and a URL-leakage warning when query
|
|
328
|
+
* credentials are enabled.
|
|
329
|
+
*/
|
|
330
|
+
export function ApiKeyTransportGuidance(props: ApiKeyTransportGuidanceProps) {
|
|
331
|
+
const copy = getApiKeyTransportGuidanceCopy(
|
|
332
|
+
describeApiKeyTransports(props.credentialOptions),
|
|
333
|
+
);
|
|
334
|
+
return (
|
|
335
|
+
<Alert severity={copy.severity} sx={props.sx}>
|
|
336
|
+
{[copy.primary, copy.alternatives, copy.queryWarning]
|
|
337
|
+
.filter((line): line is string => line !== null)
|
|
338
|
+
.map((line) => (
|
|
339
|
+
<Box key={line} component="span" sx={{ display: "block" }}>
|
|
340
|
+
{line}
|
|
341
|
+
</Box>
|
|
342
|
+
))}
|
|
343
|
+
</Alert>
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export interface ApiKeySecretDialogProps {
|
|
348
|
+
/**
|
|
349
|
+
* The app's accepted transports. When given, the dialog shows
|
|
350
|
+
* `ApiKeyTransportGuidance` and ignores `queryCredentialsEnabled`.
|
|
351
|
+
*/
|
|
352
|
+
credentialOptions?: ApiKeyCredentialOptions;
|
|
353
|
+
open: boolean;
|
|
354
|
+
onClose: () => void;
|
|
355
|
+
/**
|
|
356
|
+
* @deprecated Pass `credentialOptions`, so the copy matches the transports
|
|
357
|
+
* the authorizer accepts. Without `credentialOptions`, `true` still shows
|
|
358
|
+
* the original query-parameter warning.
|
|
359
|
+
*/
|
|
360
|
+
queryCredentialsEnabled?: boolean;
|
|
361
|
+
result: ApiKeyCreateResult | null;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export function ApiKeySecretDialog(props: ApiKeySecretDialogProps) {
|
|
365
|
+
const [copied, setCopied] = React.useState(false);
|
|
366
|
+
const [copyFailed, setCopyFailed] = React.useState(false);
|
|
367
|
+
const activeCopy = React.useRef<object | null>(null);
|
|
368
|
+
React.useEffect(() => {
|
|
369
|
+
activeCopy.current = props.open && props.result ? {} : null;
|
|
370
|
+
setCopied(false);
|
|
371
|
+
setCopyFailed(false);
|
|
372
|
+
return () => {
|
|
373
|
+
activeCopy.current = null;
|
|
374
|
+
};
|
|
375
|
+
}, [props.open, props.result]);
|
|
376
|
+
const copy = async () => {
|
|
377
|
+
const result = props.result;
|
|
378
|
+
if (!result || !props.open || !activeCopy.current) return;
|
|
379
|
+
// Each attempt has ownership; closing, replacing the result, or retrying
|
|
380
|
+
// invalidates pending work, even when the same result object is reused.
|
|
381
|
+
const attempt = {};
|
|
382
|
+
activeCopy.current = attempt;
|
|
383
|
+
setCopied(false);
|
|
384
|
+
setCopyFailed(false);
|
|
385
|
+
try {
|
|
386
|
+
const clipboard = (
|
|
387
|
+
globalThis.navigator as Navigator & {
|
|
388
|
+
clipboard?: { writeText(value: string): Promise<void> };
|
|
389
|
+
}
|
|
390
|
+
).clipboard;
|
|
391
|
+
if (!clipboard) throw new Error("Clipboard access is unavailable.");
|
|
392
|
+
await clipboard.writeText(result.key);
|
|
393
|
+
if (activeCopy.current === attempt) setCopied(true);
|
|
394
|
+
} catch {
|
|
395
|
+
// Never expose provider errors: their text may contain the one-time key.
|
|
396
|
+
if (activeCopy.current === attempt) setCopyFailed(true);
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
return (
|
|
400
|
+
<Dialog
|
|
401
|
+
open={props.open}
|
|
402
|
+
onClose={props.onClose}
|
|
403
|
+
fullWidth
|
|
404
|
+
maxWidth="sm"
|
|
405
|
+
aria-labelledby="loom-api-key-secret-title"
|
|
406
|
+
>
|
|
407
|
+
<DialogTitle id="loom-api-key-secret-title">
|
|
408
|
+
Copy your API key now
|
|
409
|
+
</DialogTitle>
|
|
410
|
+
<DialogContent>
|
|
411
|
+
<DialogContentText>
|
|
412
|
+
This secret is shown once and cannot be recovered after you close this
|
|
413
|
+
dialog.
|
|
414
|
+
</DialogContentText>
|
|
415
|
+
<TextField
|
|
416
|
+
value={props.result?.key ?? ""}
|
|
417
|
+
fullWidth
|
|
418
|
+
margin="normal"
|
|
419
|
+
label="API key"
|
|
420
|
+
slotProps={{
|
|
421
|
+
htmlInput: { readOnly: true, "aria-label": "New API key" },
|
|
422
|
+
}}
|
|
423
|
+
/>
|
|
424
|
+
{props.credentialOptions ? (
|
|
425
|
+
<ApiKeyTransportGuidance
|
|
426
|
+
credentialOptions={props.credentialOptions}
|
|
427
|
+
/>
|
|
428
|
+
) : props.queryCredentialsEnabled ? (
|
|
429
|
+
<Alert severity="warning">
|
|
430
|
+
Query-parameter keys can appear in browser history, access logs,
|
|
431
|
+
copied links, and referrers. Prefer an authorization header.
|
|
432
|
+
</Alert>
|
|
433
|
+
) : null}
|
|
434
|
+
{copyFailed ? (
|
|
435
|
+
<Alert severity="error" sx={{ mt: 2 }}>
|
|
436
|
+
Could not copy the key. Select and copy it manually.
|
|
437
|
+
</Alert>
|
|
438
|
+
) : null}
|
|
439
|
+
{copied ? (
|
|
440
|
+
<Alert severity="success" sx={{ mt: 2 }}>
|
|
441
|
+
Copied.
|
|
442
|
+
</Alert>
|
|
443
|
+
) : null}
|
|
444
|
+
</DialogContent>
|
|
445
|
+
<DialogActions>
|
|
446
|
+
<Button
|
|
447
|
+
onClick={() => {
|
|
448
|
+
void copy();
|
|
449
|
+
}}
|
|
450
|
+
disabled={!props.result}
|
|
451
|
+
>
|
|
452
|
+
Copy key
|
|
453
|
+
</Button>
|
|
454
|
+
<Button onClick={props.onClose} variant="contained">
|
|
455
|
+
I saved it
|
|
456
|
+
</Button>
|
|
457
|
+
</DialogActions>
|
|
458
|
+
</Dialog>
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export interface ApiKeyRenameDialogProps {
|
|
463
|
+
/** The key's current name; the field starts with it on every open. */
|
|
464
|
+
currentName: string;
|
|
465
|
+
/** Name bounds, checked with the same messages as server validation. */
|
|
466
|
+
limits?: Partial<ApiKeyLimits>;
|
|
467
|
+
onClose: () => void;
|
|
468
|
+
/**
|
|
469
|
+
* Renames the key to the trimmed, validated name. Return
|
|
470
|
+
* `{ ok: false, message }` for a user-correctable problem; a thrown error
|
|
471
|
+
* shows a generic message because Next.js masks its text in production.
|
|
472
|
+
*/
|
|
473
|
+
onRename: (name: string) => Promise<void | ApiKeyMutationResult>;
|
|
474
|
+
open: boolean;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Edits one key name with inline validation. A failed rename keeps the dialog
|
|
479
|
+
* open with the typed value; an unchanged name closes it without a call.
|
|
480
|
+
*/
|
|
481
|
+
export function ApiKeyRenameDialog(props: ApiKeyRenameDialogProps) {
|
|
482
|
+
const formId = React.useId();
|
|
483
|
+
const [name, setName] = React.useState(props.currentName);
|
|
484
|
+
const [error, setError] = React.useState<string | null>(null);
|
|
485
|
+
const [pending, startTransition] = React.useTransition();
|
|
486
|
+
// Start from the current name each time the dialog opens.
|
|
487
|
+
const [wasOpen, setWasOpen] = React.useState(props.open);
|
|
488
|
+
if (props.open !== wasOpen) {
|
|
489
|
+
setWasOpen(props.open);
|
|
490
|
+
if (props.open) {
|
|
491
|
+
setName(props.currentName);
|
|
492
|
+
setError(null);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
const close = () => {
|
|
497
|
+
if (!pending) props.onClose();
|
|
498
|
+
};
|
|
499
|
+
const submit = (event: React.FormEvent) => {
|
|
500
|
+
event.preventDefault();
|
|
501
|
+
if (pending) return;
|
|
502
|
+
const resolved = resolveApiKeyRename(name, props.currentName, props.limits);
|
|
503
|
+
if (!resolved.ok) {
|
|
504
|
+
setError(resolved.message);
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
if (resolved.value.unchanged) {
|
|
508
|
+
props.onClose();
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
setError(null);
|
|
512
|
+
startTransition(async () => {
|
|
513
|
+
try {
|
|
514
|
+
const result = resolveApiKeyMutationResult(
|
|
515
|
+
await props.onRename(resolved.value.name),
|
|
516
|
+
API_KEY_RENAME_FAILED_MESSAGE,
|
|
517
|
+
);
|
|
518
|
+
if (!result.ok) {
|
|
519
|
+
setError(result.message);
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
props.onClose();
|
|
523
|
+
} catch {
|
|
524
|
+
setError(API_KEY_RENAME_FAILED_MESSAGE);
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
return (
|
|
530
|
+
<Dialog
|
|
531
|
+
open={props.open}
|
|
532
|
+
onClose={close}
|
|
533
|
+
fullWidth
|
|
534
|
+
maxWidth="xs"
|
|
535
|
+
aria-labelledby={`${formId}-title`}
|
|
536
|
+
>
|
|
537
|
+
<DialogTitle id={`${formId}-title`}>Rename API key</DialogTitle>
|
|
538
|
+
<DialogContent>
|
|
539
|
+
<Box component="form" id={formId} onSubmit={submit} noValidate>
|
|
540
|
+
<TextField
|
|
541
|
+
label="Key name"
|
|
542
|
+
value={name}
|
|
543
|
+
required
|
|
544
|
+
autoFocus
|
|
545
|
+
fullWidth
|
|
546
|
+
margin="dense"
|
|
547
|
+
onChange={(event) => setName(event.target.value)}
|
|
548
|
+
disabled={pending}
|
|
549
|
+
error={error !== null}
|
|
550
|
+
helperText={error ?? undefined}
|
|
551
|
+
/>
|
|
552
|
+
</Box>
|
|
553
|
+
</DialogContent>
|
|
554
|
+
<DialogActions>
|
|
555
|
+
<Button onClick={close} disabled={pending}>
|
|
556
|
+
Cancel
|
|
557
|
+
</Button>
|
|
558
|
+
<Button
|
|
559
|
+
type="submit"
|
|
560
|
+
form={formId}
|
|
561
|
+
variant="contained"
|
|
562
|
+
disabled={pending}
|
|
563
|
+
>
|
|
564
|
+
{pending ? "Renaming…" : "Rename"}
|
|
565
|
+
</Button>
|
|
566
|
+
</DialogActions>
|
|
567
|
+
</Dialog>
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export interface ApiKeysTableProps {
|
|
572
|
+
admin?: boolean;
|
|
573
|
+
extraColumns?: ApiKeyTableColumn[];
|
|
574
|
+
/** Name bounds for the rename dialog. */
|
|
575
|
+
limits?: Partial<ApiKeyLimits>;
|
|
576
|
+
loading?: boolean;
|
|
577
|
+
/**
|
|
578
|
+
* Renames a key. Return `{ ok: false, message }` for a user-correctable
|
|
579
|
+
* problem; thrown errors show a generic message.
|
|
580
|
+
*/
|
|
581
|
+
onRename?: (id: string, name: string) => Promise<void | ApiKeyMutationResult>;
|
|
582
|
+
/**
|
|
583
|
+
* Revokes a key after a confirmation prompt. Return `{ ok: false, message }`
|
|
584
|
+
* for a user-correctable problem; thrown errors show a generic message.
|
|
585
|
+
*/
|
|
586
|
+
onRevoke?: (id: string) => Promise<void | ApiKeyMutationResult>;
|
|
587
|
+
rows: ApiKeyRow[];
|
|
588
|
+
scopes?: ApiKeyScopeDefinition[];
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
function ScopeChips({ scopes }: { scopes: string[] }) {
|
|
592
|
+
return (
|
|
593
|
+
<Stack direction="row" sx={{ flexWrap: "wrap", gap: 0.5 }}>
|
|
594
|
+
{scopes.map((scope) => (
|
|
595
|
+
<Chip key={scope} size="small" label={scope} />
|
|
596
|
+
))}
|
|
597
|
+
</Stack>
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
export function ApiKeysTable(props: ApiKeysTableProps) {
|
|
602
|
+
const [pendingId, setPendingId] = React.useState<string | null>(null);
|
|
603
|
+
const [actionError, setActionError] = React.useState<{
|
|
604
|
+
message: string;
|
|
605
|
+
rowId: string;
|
|
606
|
+
} | null>(null);
|
|
607
|
+
const [renameRow, setRenameRow] = React.useState<ApiKeyRow | null>(null);
|
|
608
|
+
const [renameOpen, setRenameOpen] = React.useState(false);
|
|
609
|
+
const revoke = async (row: ApiKeyRow) => {
|
|
610
|
+
if (
|
|
611
|
+
!props.onRevoke ||
|
|
612
|
+
!globalThis.confirm(`Revoke “${row.name}”? This cannot be undone.`)
|
|
613
|
+
)
|
|
614
|
+
return;
|
|
615
|
+
setActionError(null);
|
|
616
|
+
setPendingId(row.id);
|
|
617
|
+
try {
|
|
618
|
+
const result = resolveApiKeyMutationResult(
|
|
619
|
+
await props.onRevoke(row.id),
|
|
620
|
+
API_KEY_REVOKE_FAILED_MESSAGE,
|
|
621
|
+
);
|
|
622
|
+
if (!result.ok) {
|
|
623
|
+
setActionError({ message: result.message, rowId: row.id });
|
|
624
|
+
}
|
|
625
|
+
} catch {
|
|
626
|
+
setActionError({
|
|
627
|
+
message: API_KEY_REVOKE_FAILED_MESSAGE,
|
|
628
|
+
rowId: row.id,
|
|
629
|
+
});
|
|
630
|
+
} finally {
|
|
631
|
+
setPendingId(null);
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
const rename = (row: ApiKeyRow) => {
|
|
635
|
+
if (!props.onRename) return;
|
|
636
|
+
setActionError(null);
|
|
637
|
+
setRenameRow(row);
|
|
638
|
+
setRenameOpen(true);
|
|
639
|
+
};
|
|
640
|
+
if (props.loading) {
|
|
641
|
+
return (
|
|
642
|
+
<Box sx={{ py: 6, textAlign: "center" }}>
|
|
643
|
+
<CircularProgress aria-label="Loading API keys" />
|
|
644
|
+
</Box>
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
if (!props.rows.length) {
|
|
648
|
+
return (
|
|
649
|
+
<Alert severity="info">
|
|
650
|
+
No API keys yet. Create one when you are ready to connect an external
|
|
651
|
+
tool.
|
|
652
|
+
</Alert>
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
const actions = (row: ApiKeyRow) => (
|
|
657
|
+
<Stack direction="row" spacing={1}>
|
|
658
|
+
<Button
|
|
659
|
+
size="small"
|
|
660
|
+
onClick={() => rename(row)}
|
|
661
|
+
disabled={!props.onRename || pendingId === row.id}
|
|
662
|
+
>
|
|
663
|
+
Rename
|
|
664
|
+
</Button>
|
|
665
|
+
<Button
|
|
666
|
+
size="small"
|
|
667
|
+
color="error"
|
|
668
|
+
onClick={() => {
|
|
669
|
+
void revoke(row);
|
|
670
|
+
}}
|
|
671
|
+
disabled={!props.onRevoke || !row.enabled || pendingId === row.id}
|
|
672
|
+
>
|
|
673
|
+
Revoke
|
|
674
|
+
</Button>
|
|
675
|
+
</Stack>
|
|
676
|
+
);
|
|
677
|
+
const errorRowName = actionError
|
|
678
|
+
? props.rows.find((row) => row.id === actionError.rowId)?.name
|
|
679
|
+
: undefined;
|
|
680
|
+
return (
|
|
681
|
+
<>
|
|
682
|
+
{actionError ? (
|
|
683
|
+
<Alert
|
|
684
|
+
severity="error"
|
|
685
|
+
onClose={() => setActionError(null)}
|
|
686
|
+
sx={{ mb: 1.5 }}
|
|
687
|
+
>
|
|
688
|
+
{errorRowName ? `“${errorRowName}”: ` : ""}
|
|
689
|
+
{actionError.message}
|
|
690
|
+
</Alert>
|
|
691
|
+
) : null}
|
|
692
|
+
<TableContainer
|
|
693
|
+
component={Paper}
|
|
694
|
+
variant="outlined"
|
|
695
|
+
sx={{ display: { xs: "none", md: "block" } }}
|
|
696
|
+
>
|
|
697
|
+
<Table
|
|
698
|
+
size="small"
|
|
699
|
+
aria-label={props.admin ? "All user API keys" : "Your API keys"}
|
|
700
|
+
>
|
|
701
|
+
<TableHead>
|
|
702
|
+
<TableRow>
|
|
703
|
+
{props.admin ? <TableCell>Owner</TableCell> : null}
|
|
704
|
+
<TableCell>Name / start</TableCell>
|
|
705
|
+
<TableCell>Status</TableCell>
|
|
706
|
+
<TableCell>Scopes</TableCell>
|
|
707
|
+
<TableCell>Created</TableCell>
|
|
708
|
+
<TableCell>Expires</TableCell>
|
|
709
|
+
<TableCell>Last successful use</TableCell>
|
|
710
|
+
{props.extraColumns?.map((column) => (
|
|
711
|
+
<TableCell key={column.id}>{column.header}</TableCell>
|
|
712
|
+
))}
|
|
713
|
+
<TableCell align="right">Actions</TableCell>
|
|
714
|
+
</TableRow>
|
|
715
|
+
</TableHead>
|
|
716
|
+
<TableBody>
|
|
717
|
+
{props.rows.map((row) => (
|
|
718
|
+
<TableRow key={row.id} hover>
|
|
719
|
+
{props.admin ? (
|
|
720
|
+
<TableCell>
|
|
721
|
+
<Typography variant="body2">
|
|
722
|
+
{row.ownerName ?? row.ownerId ?? "Unknown"}
|
|
723
|
+
</Typography>
|
|
724
|
+
<Typography variant="caption" color="text.secondary">
|
|
725
|
+
{row.ownerEmail}
|
|
726
|
+
</Typography>
|
|
727
|
+
</TableCell>
|
|
728
|
+
) : null}
|
|
729
|
+
<TableCell>
|
|
730
|
+
<Typography variant="body2" sx={{ fontWeight: 600 }}>
|
|
731
|
+
{row.name}
|
|
732
|
+
</Typography>
|
|
733
|
+
<Typography variant="caption" color="text.secondary">
|
|
734
|
+
{row.start ?? "No visible prefix"}
|
|
735
|
+
</Typography>
|
|
736
|
+
</TableCell>
|
|
737
|
+
<TableCell>
|
|
738
|
+
<Chip
|
|
739
|
+
size="small"
|
|
740
|
+
color={
|
|
741
|
+
getApiKeyStatus(row) === "Active" ? "success" : "default"
|
|
742
|
+
}
|
|
743
|
+
label={getApiKeyStatus(row)}
|
|
744
|
+
/>
|
|
745
|
+
</TableCell>
|
|
746
|
+
<TableCell>
|
|
747
|
+
<ScopeChips scopes={row.scopes} />
|
|
748
|
+
</TableCell>
|
|
749
|
+
<TableCell>{formatApiKeyDate(row.createdAt)}</TableCell>
|
|
750
|
+
<TableCell>{formatApiKeyDate(row.expiresAt)}</TableCell>
|
|
751
|
+
<TableCell>
|
|
752
|
+
{formatApiKeyDate(row.lastUsedAt)}
|
|
753
|
+
{row.lastUsedScope ? (
|
|
754
|
+
<Typography variant="caption" sx={{ display: "block" }}>
|
|
755
|
+
{row.lastUsedScope}
|
|
756
|
+
</Typography>
|
|
757
|
+
) : null}
|
|
758
|
+
{row.lastUsedCountryCode || row.lastUsedIpAddress ? (
|
|
759
|
+
<Typography variant="caption" sx={{ display: "block" }}>
|
|
760
|
+
<IpCountry
|
|
761
|
+
countryCode={row.lastUsedCountryCode}
|
|
762
|
+
ipAddress={row.lastUsedIpAddress}
|
|
763
|
+
/>
|
|
764
|
+
</Typography>
|
|
765
|
+
) : null}
|
|
766
|
+
</TableCell>
|
|
767
|
+
{props.extraColumns?.map((column) => (
|
|
768
|
+
<TableCell key={column.id}>{column.render(row)}</TableCell>
|
|
769
|
+
))}
|
|
770
|
+
<TableCell align="right">{actions(row)}</TableCell>
|
|
771
|
+
</TableRow>
|
|
772
|
+
))}
|
|
773
|
+
</TableBody>
|
|
774
|
+
</Table>
|
|
775
|
+
</TableContainer>
|
|
776
|
+
<Stack spacing={1.5} sx={{ display: { xs: "flex", md: "none" } }}>
|
|
777
|
+
{props.rows.map((row) => (
|
|
778
|
+
<Paper key={row.id} variant="outlined" sx={{ p: 2 }}>
|
|
779
|
+
<Stack spacing={1}>
|
|
780
|
+
<Stack direction="row" sx={{ justifyContent: "space-between" }}>
|
|
781
|
+
<Box>
|
|
782
|
+
<Typography sx={{ fontWeight: 600 }}>{row.name}</Typography>
|
|
783
|
+
<Typography variant="caption" color="text.secondary">
|
|
784
|
+
{row.start}
|
|
785
|
+
</Typography>
|
|
786
|
+
</Box>
|
|
787
|
+
<Chip size="small" label={getApiKeyStatus(row)} />
|
|
788
|
+
</Stack>
|
|
789
|
+
{props.admin ? (
|
|
790
|
+
<Typography variant="body2">
|
|
791
|
+
{row.ownerName ?? row.ownerEmail ?? row.ownerId}
|
|
792
|
+
</Typography>
|
|
793
|
+
) : null}
|
|
794
|
+
<ScopeChips scopes={row.scopes} />
|
|
795
|
+
<Typography variant="caption">
|
|
796
|
+
Last successful use: {formatApiKeyDate(row.lastUsedAt)}
|
|
797
|
+
{row.lastUsedScope ? ` · ${row.lastUsedScope}` : ""}
|
|
798
|
+
{row.lastUsedCountryCode || row.lastUsedIpAddress ? (
|
|
799
|
+
<>
|
|
800
|
+
{" · "}
|
|
801
|
+
<IpCountry
|
|
802
|
+
countryCode={row.lastUsedCountryCode}
|
|
803
|
+
ipAddress={row.lastUsedIpAddress}
|
|
804
|
+
/>
|
|
805
|
+
</>
|
|
806
|
+
) : null}
|
|
807
|
+
</Typography>
|
|
808
|
+
{actions(row)}
|
|
809
|
+
</Stack>
|
|
810
|
+
</Paper>
|
|
811
|
+
))}
|
|
812
|
+
</Stack>
|
|
813
|
+
{props.onRename && renameRow ? (
|
|
814
|
+
<ApiKeyRenameDialog
|
|
815
|
+
open={renameOpen}
|
|
816
|
+
currentName={renameRow.name}
|
|
817
|
+
limits={props.limits}
|
|
818
|
+
onClose={() => setRenameOpen(false)}
|
|
819
|
+
onRename={(name) => props.onRename!(renameRow.id, name)}
|
|
820
|
+
/>
|
|
821
|
+
) : null}
|
|
822
|
+
</>
|
|
823
|
+
);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
export function AdminApiKeysTable(props: Omit<ApiKeysTableProps, "admin">) {
|
|
827
|
+
return <ApiKeysTable {...props} admin />;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
export interface ApiKeyAuditTableProps {
|
|
831
|
+
count: number;
|
|
832
|
+
loading?: boolean;
|
|
833
|
+
onPageChange: (page: number) => void;
|
|
834
|
+
page: number;
|
|
835
|
+
rows: ApiKeyAuditRow[];
|
|
836
|
+
rowsPerPage: number;
|
|
837
|
+
/**
|
|
838
|
+
* Show the Key column. Defaults to whether any row on the current page has
|
|
839
|
+
* a `keyName` or `keyStart` snapshot; pass it when the app maps snapshots,
|
|
840
|
+
* so the column does not appear and disappear between pages.
|
|
841
|
+
*/
|
|
842
|
+
showKey?: boolean;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
export function ApiKeyAuditTable(props: ApiKeyAuditTableProps) {
|
|
846
|
+
// Inferring the key column keeps tables without snapshots exactly as before.
|
|
847
|
+
const showKey =
|
|
848
|
+
props.showKey ?? props.rows.some((row) => row.keyName || row.keyStart);
|
|
849
|
+
return (
|
|
850
|
+
<Paper variant="outlined">
|
|
851
|
+
<TableContainer>
|
|
852
|
+
<Table size="small" aria-label="API-key audit history">
|
|
853
|
+
<TableHead>
|
|
854
|
+
<TableRow>
|
|
855
|
+
<TableCell>Time</TableCell>
|
|
856
|
+
{showKey ? <TableCell>Key</TableCell> : null}
|
|
857
|
+
<TableCell>Scope</TableCell>
|
|
858
|
+
<TableCell>Operation</TableCell>
|
|
859
|
+
<TableCell>Transport</TableCell>
|
|
860
|
+
<TableCell>Client</TableCell>
|
|
861
|
+
<TableCell>Outcome</TableCell>
|
|
862
|
+
<TableCell>Context</TableCell>
|
|
863
|
+
</TableRow>
|
|
864
|
+
</TableHead>
|
|
865
|
+
<TableBody>
|
|
866
|
+
{props.loading ? (
|
|
867
|
+
<TableRow>
|
|
868
|
+
<TableCell colSpan={showKey ? 8 : 7} align="center">
|
|
869
|
+
<CircularProgress
|
|
870
|
+
size={24}
|
|
871
|
+
aria-label="Loading audit history"
|
|
872
|
+
/>
|
|
873
|
+
</TableCell>
|
|
874
|
+
</TableRow>
|
|
875
|
+
) : (
|
|
876
|
+
props.rows.map((row) => {
|
|
877
|
+
const reason = getApiKeyAuditReason(row);
|
|
878
|
+
return (
|
|
879
|
+
<TableRow key={row.id}>
|
|
880
|
+
<TableCell>{formatApiKeyDate(row.occurredAt)}</TableCell>
|
|
881
|
+
{showKey ? (
|
|
882
|
+
<TableCell>
|
|
883
|
+
<Typography variant="body2">
|
|
884
|
+
{row.keyName ?? "—"}
|
|
885
|
+
</Typography>
|
|
886
|
+
{row.keyStart ? (
|
|
887
|
+
<Typography variant="caption" color="text.secondary">
|
|
888
|
+
{row.keyStart}
|
|
889
|
+
</Typography>
|
|
890
|
+
) : null}
|
|
891
|
+
</TableCell>
|
|
892
|
+
) : null}
|
|
893
|
+
<TableCell>{row.scope}</TableCell>
|
|
894
|
+
<TableCell>{row.operation}</TableCell>
|
|
895
|
+
<TableCell>{row.transport ?? "—"}</TableCell>
|
|
896
|
+
<TableCell>
|
|
897
|
+
<Typography variant="body2">
|
|
898
|
+
<IpCountry
|
|
899
|
+
countryCode={row.countryCode}
|
|
900
|
+
ipAddress={row.ipAddress}
|
|
901
|
+
/>
|
|
902
|
+
</Typography>
|
|
903
|
+
<Typography variant="caption" color="text.secondary">
|
|
904
|
+
{row.userAgent ?? ""}
|
|
905
|
+
</Typography>
|
|
906
|
+
</TableCell>
|
|
907
|
+
<TableCell>
|
|
908
|
+
{[row.authorizationOutcome, row.operationOutcome]
|
|
909
|
+
.filter(Boolean)
|
|
910
|
+
.join(" / ")}
|
|
911
|
+
{reason ? (
|
|
912
|
+
<Typography
|
|
913
|
+
variant="caption"
|
|
914
|
+
color="text.secondary"
|
|
915
|
+
sx={{ display: "block" }}
|
|
916
|
+
>
|
|
917
|
+
{reason}
|
|
918
|
+
</Typography>
|
|
919
|
+
) : null}
|
|
920
|
+
</TableCell>
|
|
921
|
+
<TableCell>
|
|
922
|
+
{[row.pageName, row.functionName, row.actionName]
|
|
923
|
+
.filter(Boolean)
|
|
924
|
+
.join(" · ") || "—"}
|
|
925
|
+
</TableCell>
|
|
926
|
+
</TableRow>
|
|
927
|
+
);
|
|
928
|
+
})
|
|
929
|
+
)}
|
|
930
|
+
</TableBody>
|
|
931
|
+
</Table>
|
|
932
|
+
</TableContainer>
|
|
933
|
+
<TablePagination
|
|
934
|
+
component="div"
|
|
935
|
+
count={props.count}
|
|
936
|
+
page={props.page}
|
|
937
|
+
rowsPerPage={props.rowsPerPage}
|
|
938
|
+
rowsPerPageOptions={[props.rowsPerPage]}
|
|
939
|
+
onPageChange={(_event, page) => props.onPageChange(page)}
|
|
940
|
+
/>
|
|
941
|
+
</Paper>
|
|
942
|
+
);
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
export interface ApiKeysManagerProps extends Omit<
|
|
946
|
+
ApiKeysTableProps,
|
|
947
|
+
"onRevoke" | "onRename"
|
|
948
|
+
> {
|
|
949
|
+
/** Offer "Never" as an expiry in the create dialog. Defaults to `true`. */
|
|
950
|
+
allowNoExpiry?: boolean;
|
|
951
|
+
error?: string | null;
|
|
952
|
+
/** Create-dialog expiry presets in days. Defaults to `[7, 30]`. */
|
|
953
|
+
expiryPresetDays?: readonly number[];
|
|
954
|
+
/** See `ApiKeyCreateDialogProps.onCreate`. */
|
|
955
|
+
onCreate?: (
|
|
956
|
+
input: ApiKeyCreateInput,
|
|
957
|
+
) => Promise<ApiKeyCreateResult | ApiKeyCreateActionResult>;
|
|
958
|
+
/** See `ApiKeysTableProps.onRename`. */
|
|
959
|
+
onRename?: (id: string, name: string) => Promise<void | ApiKeyMutationResult>;
|
|
960
|
+
/** See `ApiKeysTableProps.onRevoke`. */
|
|
961
|
+
onRevoke?: (id: string) => Promise<void | ApiKeyMutationResult>;
|
|
962
|
+
/**
|
|
963
|
+
* The same plain options object the authorizer uses. The secret dialog
|
|
964
|
+
* then derives its transport guidance from it; render
|
|
965
|
+
* `ApiKeyTransportGuidance` elsewhere on the page for the same copy.
|
|
966
|
+
*/
|
|
967
|
+
credentialOptions?: ApiKeyCredentialOptions;
|
|
968
|
+
/**
|
|
969
|
+
* @deprecated Pass `credentialOptions` instead; it overrides this prop.
|
|
970
|
+
*/
|
|
971
|
+
queryCredentialsEnabled?: boolean;
|
|
972
|
+
scopes: ApiKeyScopeDefinition[];
|
|
973
|
+
/** See `ApiKeyCreateDialogProps.thrownErrorMessages`. */
|
|
974
|
+
thrownErrorMessages?: ApiKeyThrownErrorMessages;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
export function ApiKeysManager(props: ApiKeysManagerProps) {
|
|
978
|
+
const [createOpen, setCreateOpen] = React.useState(false);
|
|
979
|
+
const [secret, setSecret] = React.useState<ApiKeyCreateResult | null>(null);
|
|
980
|
+
return (
|
|
981
|
+
<Stack spacing={2}>
|
|
982
|
+
<Stack
|
|
983
|
+
direction={{ xs: "column", sm: "row" }}
|
|
984
|
+
sx={{
|
|
985
|
+
alignItems: { sm: "center" },
|
|
986
|
+
gap: 1,
|
|
987
|
+
justifyContent: "space-between",
|
|
988
|
+
}}
|
|
989
|
+
>
|
|
990
|
+
<Box>
|
|
991
|
+
<Typography variant="h5" component="h1">
|
|
992
|
+
API keys
|
|
993
|
+
</Typography>
|
|
994
|
+
<Typography color="text.secondary">
|
|
995
|
+
Create scoped credentials for tools you trust.
|
|
996
|
+
</Typography>
|
|
997
|
+
</Box>
|
|
998
|
+
<Button
|
|
999
|
+
variant="contained"
|
|
1000
|
+
onClick={() => setCreateOpen(true)}
|
|
1001
|
+
disabled={!props.onCreate}
|
|
1002
|
+
>
|
|
1003
|
+
Create API key
|
|
1004
|
+
</Button>
|
|
1005
|
+
</Stack>
|
|
1006
|
+
{props.error ? <Alert severity="error">{props.error}</Alert> : null}
|
|
1007
|
+
<ApiKeysTable
|
|
1008
|
+
rows={props.rows}
|
|
1009
|
+
loading={props.loading}
|
|
1010
|
+
scopes={props.scopes}
|
|
1011
|
+
extraColumns={props.extraColumns}
|
|
1012
|
+
limits={props.limits}
|
|
1013
|
+
onRename={props.onRename}
|
|
1014
|
+
onRevoke={props.onRevoke}
|
|
1015
|
+
/>
|
|
1016
|
+
<ApiKeyCreateDialog
|
|
1017
|
+
open={createOpen}
|
|
1018
|
+
onClose={() => setCreateOpen(false)}
|
|
1019
|
+
scopes={props.scopes}
|
|
1020
|
+
error={props.error}
|
|
1021
|
+
limits={props.limits}
|
|
1022
|
+
allowNoExpiry={props.allowNoExpiry}
|
|
1023
|
+
thrownErrorMessages={props.thrownErrorMessages}
|
|
1024
|
+
expiryPresetDays={props.expiryPresetDays}
|
|
1025
|
+
onCreate={
|
|
1026
|
+
props.onCreate ??
|
|
1027
|
+
(() =>
|
|
1028
|
+
Promise.resolve({
|
|
1029
|
+
message: "Key creation is unavailable.",
|
|
1030
|
+
ok: false as const,
|
|
1031
|
+
}))
|
|
1032
|
+
}
|
|
1033
|
+
onCreated={setSecret}
|
|
1034
|
+
/>
|
|
1035
|
+
<ApiKeySecretDialog
|
|
1036
|
+
open={secret !== null}
|
|
1037
|
+
result={secret}
|
|
1038
|
+
credentialOptions={props.credentialOptions}
|
|
1039
|
+
queryCredentialsEnabled={props.queryCredentialsEnabled}
|
|
1040
|
+
onClose={() => setSecret(null)}
|
|
1041
|
+
/>
|
|
1042
|
+
</Stack>
|
|
1043
|
+
);
|
|
1044
|
+
}
|