@dreamlake/dreamlake-cli 0.88.0 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/access.d.ts +83 -0
- package/dist/api/access.js +77 -0
- package/dist/api/agent.d.ts +156 -0
- package/dist/api/agent.js +111 -0
- package/dist/api/browser.d.ts +90 -0
- package/dist/api/browser.js +102 -0
- package/dist/api/client.d.ts +53 -0
- package/dist/api/client.js +102 -0
- package/dist/api/common.d.ts +28 -0
- package/dist/api/common.js +16 -0
- package/dist/api/content.d.ts +195 -0
- package/dist/api/content.js +147 -0
- package/dist/api/execution.d.ts +84 -0
- package/dist/api/execution.js +73 -0
- package/dist/api/http.d.ts +19 -0
- package/dist/api/http.js +66 -0
- package/dist/api/index.d.ts +2330 -0
- package/dist/api/index.js +114 -0
- package/dist/api/infra.d.ts +2 -0
- package/dist/api/infra.js +2 -0
- package/dist/api/jobs.d.ts +2 -0
- package/dist/api/jobs.js +2 -0
- package/dist/api/layout.d.ts +2 -0
- package/dist/api/layout.js +2 -0
- package/dist/api/library-edit.d.ts +3 -0
- package/dist/api/library-edit.js +3 -0
- package/dist/api/library-manifest.d.ts +2 -0
- package/dist/api/library-manifest.js +2 -0
- package/dist/api/note-character-plan.d.ts +2 -0
- package/dist/api/note-character-plan.js +2 -0
- package/dist/api/note-editing.d.ts +2 -0
- package/dist/api/note-editing.js +2 -0
- package/dist/api/note-edits.d.ts +21 -0
- package/dist/api/note-edits.js +10 -0
- package/dist/api/note-events.d.ts +5 -0
- package/dist/api/note-events.js +11 -0
- package/dist/api/note-files.d.ts +75 -0
- package/dist/api/note-files.js +65 -0
- package/dist/api/note-html-read.d.ts +2 -0
- package/dist/api/note-html-read.js +2 -0
- package/dist/api/note-html.d.ts +2 -0
- package/dist/api/note-html.js +2 -0
- package/dist/api/note-toc.d.ts +2 -0
- package/dist/api/note-toc.js +2 -0
- package/dist/api/notes.d.ts +304 -0
- package/dist/api/notes.js +181 -0
- package/dist/api/open-resources.d.ts +27 -0
- package/dist/api/open-resources.js +102 -0
- package/dist/api/ownership.d.ts +12 -0
- package/dist/api/ownership.js +24 -0
- package/dist/api/platform.d.ts +83 -0
- package/dist/api/platform.js +56 -0
- package/dist/api/presigned-transfer.d.ts +2 -0
- package/dist/api/presigned-transfer.js +2 -0
- package/dist/api/registered-runs.d.ts +48 -0
- package/dist/api/registered-runs.js +33 -0
- package/dist/api/sessions.d.ts +299 -0
- package/dist/api/sessions.js +105 -0
- package/dist/api/storage.d.ts +46 -0
- package/dist/api/storage.js +34 -0
- package/dist/api/streams.d.ts +18 -0
- package/dist/api/streams.js +70 -0
- package/dist/api/vault.d.ts +93 -0
- package/dist/api/vault.js +79 -0
- package/dist/api/workspace.d.ts +180 -0
- package/dist/api/workspace.js +146 -0
- package/dist/cli/agent-identity.d.ts +4 -0
- package/dist/cli/agent-identity.js +21 -0
- package/dist/cli/agents/identity.d.ts +50 -0
- package/dist/cli/agents/identity.js +105 -0
- package/dist/cli/agents/index.d.ts +31 -0
- package/dist/cli/agents/index.js +580 -0
- package/dist/cli/agents/manage.d.ts +43 -0
- package/dist/cli/agents/manage.js +376 -0
- package/dist/cli/agents/spec.d.ts +104 -0
- package/dist/cli/agents/spec.js +280 -0
- package/dist/cli/agents/web.d.ts +7 -0
- package/dist/cli/agents/web.js +109 -0
- package/dist/cli/artifact/incremental.d.ts +21 -0
- package/dist/cli/artifact/incremental.js +80 -0
- package/dist/cli/artifact/index.d.ts +52 -0
- package/dist/cli/artifact/index.js +405 -0
- package/dist/cli/artifact/meta.d.ts +69 -0
- package/dist/cli/artifact/meta.js +189 -0
- package/dist/cli/auth/commands.d.ts +29 -0
- package/dist/cli/auth/commands.js +327 -0
- package/dist/cli/auth/constants.d.ts +13 -0
- package/dist/cli/auth/constants.js +18 -0
- package/dist/cli/auth/credentials.d.ts +37 -0
- package/dist/cli/auth/credentials.js +155 -0
- package/dist/cli/auth/device-flow.d.ts +32 -0
- package/dist/cli/auth/device-flow.js +154 -0
- package/dist/cli/auth/device-secret.d.ts +6 -0
- package/dist/cli/auth/device-secret.js +26 -0
- package/dist/cli/auth/machine.d.ts +15 -0
- package/dist/cli/auth/machine.js +126 -0
- package/dist/cli/auth/materialized.d.ts +32 -0
- package/dist/cli/auth/materialized.js +102 -0
- package/dist/cli/auth/migrate.d.ts +10 -0
- package/dist/cli/auth/migrate.js +75 -0
- package/dist/cli/client.d.ts +102 -0
- package/dist/cli/client.js +206 -0
- package/dist/cli/collection-list.d.ts +3 -0
- package/dist/cli/collection-list.js +25 -0
- package/dist/cli/compat/ctx.d.ts +26 -0
- package/dist/cli/compat/ctx.js +76 -0
- package/dist/cli/compat/dreamdb-wasm-embedded.d.ts +2 -0
- package/dist/cli/compat/dreamdb-wasm-embedded.js +8 -0
- package/dist/cli/compat/dreamdb-wasm.d.ts +1 -0
- package/dist/cli/compat/dreamdb-wasm.js +26 -0
- package/dist/cli/compat/dreamdb.d.ts +112 -0
- package/dist/cli/compat/dreamdb.js +219 -0
- package/dist/cli/compat/flags.d.ts +2 -0
- package/dist/cli/compat/flags.js +13 -0
- package/dist/cli/compat/http.d.ts +23 -0
- package/dist/cli/compat/http.js +137 -0
- package/dist/cli/compat/presignedTransfer.d.ts +139 -0
- package/dist/cli/compat/presignedTransfer.js +580 -0
- package/dist/cli/compat/s3-backend.d.ts +73 -0
- package/dist/cli/compat/s3-backend.js +132 -0
- package/dist/cli/config.d.ts +22 -0
- package/dist/cli/config.js +96 -0
- package/dist/cli/connection/dto.d.ts +159 -0
- package/dist/cli/connection/dto.js +497 -0
- package/dist/cli/connection/index.d.ts +50 -0
- package/dist/cli/connection/index.js +413 -0
- package/dist/cli/connection/oauth.d.ts +23 -0
- package/dist/cli/connection/oauth.js +290 -0
- package/dist/cli/connection/write.d.ts +47 -0
- package/dist/cli/connection/write.js +573 -0
- package/dist/cli/create/index.d.ts +19 -0
- package/dist/cli/create/index.js +209 -0
- package/dist/cli/declare/index.d.ts +29 -0
- package/dist/cli/declare/index.js +304 -0
- package/dist/cli/delete/index.d.ts +18 -0
- package/dist/cli/delete/index.js +232 -0
- package/dist/cli/download/index.d.ts +9 -0
- package/dist/cli/download/index.js +128 -0
- package/dist/cli/env/compose.d.ts +88 -0
- package/dist/cli/env/compose.js +402 -0
- package/dist/cli/env/index.d.ts +176 -0
- package/dist/cli/env/index.js +1011 -0
- package/dist/cli/experiments/index.d.ts +11 -0
- package/dist/cli/experiments/index.js +168 -0
- package/dist/cli/glob.d.ts +1 -0
- package/dist/cli/glob.js +45 -0
- package/dist/cli/graphql-helpers.d.ts +23 -0
- package/dist/cli/graphql-helpers.js +42 -0
- package/dist/cli/graphql.d.ts +10 -0
- package/dist/cli/graphql.js +47 -0
- package/dist/cli/help-examples.generated.d.ts +1 -0
- package/dist/cli/help-examples.generated.js +192 -0
- package/dist/cli/helpers.d.ts +8 -0
- package/dist/cli/helpers.js +106 -0
- package/dist/cli/hosts/api.d.ts +29 -0
- package/dist/cli/hosts/api.js +54 -0
- package/dist/cli/hosts/bootstrap-source.d.ts +1 -0
- package/dist/cli/hosts/bootstrap-source.js +2 -0
- package/dist/cli/hosts/catalog.d.ts +26 -0
- package/dist/cli/hosts/catalog.js +55 -0
- package/dist/cli/hosts/config.d.ts +45 -0
- package/dist/cli/hosts/config.js +179 -0
- package/dist/cli/hosts/credentials.d.ts +19 -0
- package/dist/cli/hosts/credentials.js +173 -0
- package/dist/cli/hosts/enroll.d.ts +17 -0
- package/dist/cli/hosts/enroll.js +109 -0
- package/dist/cli/hosts/enrollments.d.ts +25 -0
- package/dist/cli/hosts/enrollments.js +54 -0
- package/dist/cli/hosts/index.d.ts +6 -0
- package/dist/cli/hosts/index.js +279 -0
- package/dist/cli/hosts/inventory.d.ts +40 -0
- package/dist/cli/hosts/inventory.js +91 -0
- package/dist/cli/hosts/lifecycle.d.ts +15 -0
- package/dist/cli/hosts/lifecycle.js +108 -0
- package/dist/cli/hosts/metrics-source.d.ts +12 -0
- package/dist/cli/hosts/metrics-source.js +89 -0
- package/dist/cli/hosts/observations.d.ts +39 -0
- package/dist/cli/hosts/observations.js +102 -0
- package/dist/cli/hosts/remote.d.ts +5 -0
- package/dist/cli/hosts/remote.js +66 -0
- package/dist/cli/hosts/ssh.d.ts +63 -0
- package/dist/cli/hosts/ssh.js +276 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +288 -0
- package/dist/cli/infra/api.d.ts +95 -0
- package/dist/cli/infra/api.js +291 -0
- package/dist/cli/infra/index.d.ts +5 -0
- package/dist/cli/infra/index.js +102 -0
- package/dist/cli/infra/move.d.ts +15 -0
- package/dist/cli/infra/move.js +123 -0
- package/dist/cli/infra/transfer.d.ts +15 -0
- package/dist/cli/infra/transfer.js +280 -0
- package/dist/cli/jobs/api.d.ts +69 -0
- package/dist/cli/jobs/api.js +121 -0
- package/dist/cli/jobs/index.d.ts +5 -0
- package/dist/cli/jobs/index.js +140 -0
- package/dist/cli/lakeshore/index.d.ts +98 -0
- package/dist/cli/lakeshore/index.js +502 -0
- package/dist/cli/launch/index.d.ts +43 -0
- package/dist/cli/launch/index.js +270 -0
- package/dist/cli/layout/index.d.ts +2 -0
- package/dist/cli/layout/index.js +44 -0
- package/dist/cli/layout/transport.d.ts +12 -0
- package/dist/cli/layout/transport.js +70 -0
- package/dist/cli/library/add.d.ts +60 -0
- package/dist/cli/library/add.js +348 -0
- package/dist/cli/library/cache.d.ts +26 -0
- package/dist/cli/library/cache.js +88 -0
- package/dist/cli/library/config.d.ts +75 -0
- package/dist/cli/library/config.js +198 -0
- package/dist/cli/library/digest.d.ts +5 -0
- package/dist/cli/library/digest.js +19 -0
- package/dist/cli/library/discover.d.ts +87 -0
- package/dist/cli/library/discover.js +534 -0
- package/dist/cli/library/freshness.d.ts +35 -0
- package/dist/cli/library/freshness.js +109 -0
- package/dist/cli/library/generation.d.ts +35 -0
- package/dist/cli/library/generation.js +211 -0
- package/dist/cli/library/index.d.ts +2 -0
- package/dist/cli/library/index.js +36 -0
- package/dist/cli/library/info.d.ts +69 -0
- package/dist/cli/library/info.js +311 -0
- package/dist/cli/library/list.d.ts +33 -0
- package/dist/cli/library/list.js +86 -0
- package/dist/cli/library/manifest.d.ts +81 -0
- package/dist/cli/library/manifest.js +200 -0
- package/dist/cli/library/manifestCache.d.ts +45 -0
- package/dist/cli/library/manifestCache.js +169 -0
- package/dist/cli/library/pull.d.ts +30 -0
- package/dist/cli/library/pull.js +438 -0
- package/dist/cli/library/push.d.ts +72 -0
- package/dist/cli/library/push.js +642 -0
- package/dist/cli/library/rm.d.ts +31 -0
- package/dist/cli/library/rm.js +200 -0
- package/dist/cli/library/search.d.ts +18 -0
- package/dist/cli/library/search.js +181 -0
- package/dist/cli/library/stat.d.ts +15 -0
- package/dist/cli/library/stat.js +127 -0
- package/dist/cli/library/tools.d.ts +104 -0
- package/dist/cli/library/tools.js +163 -0
- package/dist/cli/library/wire.d.ts +47 -0
- package/dist/cli/library/wire.js +120 -0
- package/dist/cli/list/index.d.ts +26 -0
- package/dist/cli/list/index.js +256 -0
- package/dist/cli/notes/character-plan.d.ts +22 -0
- package/dist/cli/notes/character-plan.js +232 -0
- package/dist/cli/notes/document.d.ts +73 -0
- package/dist/cli/notes/document.js +306 -0
- package/dist/cli/notes/edit-commands.d.ts +106 -0
- package/dist/cli/notes/edit-commands.js +623 -0
- package/dist/cli/notes/editing.d.ts +81 -0
- package/dist/cli/notes/editing.js +305 -0
- package/dist/cli/notes/events.d.ts +36 -0
- package/dist/cli/notes/events.js +54 -0
- package/dist/cli/notes/files-commands.d.ts +120 -0
- package/dist/cli/notes/files-commands.js +554 -0
- package/dist/cli/notes/html-read.d.ts +9 -0
- package/dist/cli/notes/html-read.js +90 -0
- package/dist/cli/notes/html.d.ts +73 -0
- package/dist/cli/notes/html.js +381 -0
- package/dist/cli/notes/index.d.ts +123 -0
- package/dist/cli/notes/index.js +1303 -0
- package/dist/cli/notes/linger.d.ts +59 -0
- package/dist/cli/notes/linger.js +339 -0
- package/dist/cli/notes/media-commands.d.ts +5 -0
- package/dist/cli/notes/media-commands.js +51 -0
- package/dist/cli/notes/move-command.d.ts +83 -0
- package/dist/cli/notes/move-command.js +259 -0
- package/dist/cli/notes/rm-command.d.ts +22 -0
- package/dist/cli/notes/rm-command.js +110 -0
- package/dist/cli/notes/select-command.d.ts +12 -0
- package/dist/cli/notes/select-command.js +84 -0
- package/dist/cli/notes/suggest-diff.d.ts +56 -0
- package/dist/cli/notes/suggest-diff.js +311 -0
- package/dist/cli/notes/toc.d.ts +38 -0
- package/dist/cli/notes/toc.js +144 -0
- package/dist/cli/notes/transfer-command.d.ts +6 -0
- package/dist/cli/notes/transfer-command.js +9 -0
- package/dist/cli/notes/version-commands.d.ts +19 -0
- package/dist/cli/notes/version-commands.js +178 -0
- package/dist/cli/nymph/index.d.ts +74 -0
- package/dist/cli/nymph/index.js +349 -0
- package/dist/cli/org/index.d.ts +34 -0
- package/dist/cli/org/index.js +341 -0
- package/dist/cli/ownership/index.d.ts +12 -0
- package/dist/cli/ownership/index.js +122 -0
- package/dist/cli/ownership/metadata-transfer.d.ts +20 -0
- package/dist/cli/ownership/metadata-transfer.js +159 -0
- package/dist/cli/page/index.d.ts +58 -0
- package/dist/cli/page/index.js +387 -0
- package/dist/cli/pipeline/index.d.ts +69 -0
- package/dist/cli/pipeline/index.js +604 -0
- package/dist/cli/progress.d.ts +60 -0
- package/dist/cli/progress.js +276 -0
- package/dist/cli/project/attachments.d.ts +10 -0
- package/dist/cli/project/attachments.js +39 -0
- package/dist/cli/project/grants.d.ts +10 -0
- package/dist/cli/project/grants.js +39 -0
- package/dist/cli/project/index.d.ts +8 -0
- package/dist/cli/project/index.js +92 -0
- package/dist/cli/project/move.d.ts +57 -0
- package/dist/cli/project/move.js +242 -0
- package/dist/cli/project/output.d.ts +2 -0
- package/dist/cli/project/output.js +29 -0
- package/dist/cli/project/stream.d.ts +55 -0
- package/dist/cli/project/stream.js +207 -0
- package/dist/cli/project/transfer-preview.d.ts +8 -0
- package/dist/cli/project/transfer-preview.js +10 -0
- package/dist/cli/prompt.d.ts +1 -0
- package/dist/cli/prompt.js +17 -0
- package/dist/cli/provider/dreamdir.d.ts +52 -0
- package/dist/cli/provider/dreamdir.js +138 -0
- package/dist/cli/provider/index.d.ts +4 -0
- package/dist/cli/provider/index.js +419 -0
- package/dist/cli/provider/jump-worker.d.ts +9 -0
- package/dist/cli/provider/jump-worker.js +141 -0
- package/dist/cli/provider/lifecycle.d.ts +149 -0
- package/dist/cli/provider/lifecycle.js +1390 -0
- package/dist/cli/provider/machine.d.ts +17 -0
- package/dist/cli/provider/machine.js +116 -0
- package/dist/cli/provider/ssh.d.ts +105 -0
- package/dist/cli/provider/ssh.js +305 -0
- package/dist/cli/provider/terraform.d.ts +140 -0
- package/dist/cli/provider/terraform.js +288 -0
- package/dist/cli/providers/index.d.ts +18 -0
- package/dist/cli/providers/index.js +422 -0
- package/dist/cli/python.d.ts +61 -0
- package/dist/cli/python.js +255 -0
- package/dist/cli/queues/index.d.ts +33 -0
- package/dist/cli/queues/index.js +248 -0
- package/dist/cli/queues/slurm.d.ts +10 -0
- package/dist/cli/queues/slurm.js +134 -0
- package/dist/cli/resources.d.ts +72 -0
- package/dist/cli/resources.js +137 -0
- package/dist/cli/run/index.d.ts +15 -0
- package/dist/cli/run/index.js +163 -0
- package/dist/cli/run/input.d.ts +34 -0
- package/dist/cli/run/input.js +135 -0
- package/dist/cli/run/recovery.d.ts +2 -0
- package/dist/cli/run/recovery.js +18 -0
- package/dist/cli/run/setup.d.ts +3 -0
- package/dist/cli/run/setup.js +62 -0
- package/dist/cli/runconfig/index.d.ts +12 -0
- package/dist/cli/runconfig/index.js +130 -0
- package/dist/cli/runnable/index.d.ts +35 -0
- package/dist/cli/runnable/index.js +575 -0
- package/dist/cli/runnable/path.d.ts +115 -0
- package/dist/cli/runnable/path.js +288 -0
- package/dist/cli/runnable/run.d.ts +91 -0
- package/dist/cli/runnable/run.js +239 -0
- package/dist/cli/runnable/upload.d.ts +43 -0
- package/dist/cli/runnable/upload.js +342 -0
- package/dist/cli/runnable/worker.d.ts +1 -0
- package/dist/cli/runnable/worker.js +44 -0
- package/dist/cli/schemas/workflow-spec.schema.json +335 -0
- package/dist/cli/self-update/index.d.ts +5 -0
- package/dist/cli/self-update/index.js +107 -0
- package/dist/cli/self-update/install.d.ts +60 -0
- package/dist/cli/self-update/install.js +428 -0
- package/dist/cli/self-update/paths.d.ts +40 -0
- package/dist/cli/self-update/paths.js +87 -0
- package/dist/cli/self-update/releases.d.ts +41 -0
- package/dist/cli/self-update/releases.js +153 -0
- package/dist/cli/self-update/settings.d.ts +16 -0
- package/dist/cli/self-update/settings.js +68 -0
- package/dist/cli/self-update/update.d.ts +18 -0
- package/dist/cli/self-update/update.js +241 -0
- package/dist/cli/service-accounts/index.d.ts +3 -0
- package/dist/cli/service-accounts/index.js +149 -0
- package/dist/cli/session-affiliation.d.ts +26 -0
- package/dist/cli/session-affiliation.js +135 -0
- package/dist/cli/sessions/affiliation.d.ts +8 -0
- package/dist/cli/sessions/affiliation.js +66 -0
- package/dist/cli/sessions/api.d.ts +55 -0
- package/dist/cli/sessions/api.js +88 -0
- package/dist/cli/sessions/control.d.ts +6 -0
- package/dist/cli/sessions/control.js +159 -0
- package/dist/cli/sessions/conversation.d.ts +15 -0
- package/dist/cli/sessions/conversation.js +118 -0
- package/dist/cli/sessions/index.d.ts +2 -0
- package/dist/cli/sessions/index.js +209 -0
- package/dist/cli/sessions/managed.d.ts +39 -0
- package/dist/cli/sessions/managed.js +63 -0
- package/dist/cli/sessions/redaction.d.ts +2 -0
- package/dist/cli/sessions/redaction.js +11 -0
- package/dist/cli/sessions/runner/exec.d.ts +108 -0
- package/dist/cli/sessions/runner/exec.js +335 -0
- package/dist/cli/sessions/runner/journal.d.ts +26 -0
- package/dist/cli/sessions/runner/journal.js +49 -0
- package/dist/cli/sessions/runner/native.d.ts +48 -0
- package/dist/cli/sessions/runner/native.js +170 -0
- package/dist/cli/sessions/runner/pod.d.ts +30 -0
- package/dist/cli/sessions/runner/pod.js +129 -0
- package/dist/cli/sessions/runner/serve.d.ts +85 -0
- package/dist/cli/sessions/runner/serve.js +558 -0
- package/dist/cli/sessions/sync.d.ts +47 -0
- package/dist/cli/sessions/sync.js +80 -0
- package/dist/cli/sessions/transport.d.ts +14 -0
- package/dist/cli/sessions/transport.js +116 -0
- package/dist/cli/share.d.ts +15 -0
- package/dist/cli/share.js +139 -0
- package/dist/cli/skill/catalog.d.ts +141 -0
- package/dist/cli/skill/catalog.js +442 -0
- package/dist/cli/skill/files.d.ts +89 -0
- package/dist/cli/skill/files.js +264 -0
- package/dist/cli/skill/index.d.ts +268 -0
- package/dist/cli/skill/index.js +1216 -0
- package/dist/cli/skill/manifest.d.ts +30 -0
- package/dist/cli/skill/manifest.js +101 -0
- package/dist/cli/skill/prefs.d.ts +9 -0
- package/dist/cli/skill/prefs.js +32 -0
- package/dist/cli/skill/reminders.d.ts +15 -0
- package/dist/cli/skill/reminders.js +105 -0
- package/dist/cli/skill/tar.d.ts +17 -0
- package/dist/cli/skill/tar.js +195 -0
- package/dist/cli/snapshot/index.d.ts +24 -0
- package/dist/cli/snapshot/index.js +146 -0
- package/dist/cli/source/access.d.ts +45 -0
- package/dist/cli/source/access.js +563 -0
- package/dist/cli/source/control.d.ts +103 -0
- package/dist/cli/source/control.js +546 -0
- package/dist/cli/source/delete.d.ts +89 -0
- package/dist/cli/source/delete.js +463 -0
- package/dist/cli/source/index.d.ts +288 -0
- package/dist/cli/source/index.js +1348 -0
- package/dist/cli/source/share.d.ts +65 -0
- package/dist/cli/source/share.js +530 -0
- package/dist/cli/source/upload.d.ts +62 -0
- package/dist/cli/source/upload.js +258 -0
- package/dist/cli/source/write.d.ts +77 -0
- package/dist/cli/source/write.js +335 -0
- package/dist/cli/spawn.d.ts +28 -0
- package/dist/cli/spawn.js +81 -0
- package/dist/cli/target.d.ts +22 -0
- package/dist/cli/target.js +85 -0
- package/dist/cli/tasks/index.d.ts +38 -0
- package/dist/cli/tasks/index.js +365 -0
- package/dist/cli/team/index.d.ts +37 -0
- package/dist/cli/team/index.js +407 -0
- package/dist/cli/telemetry.d.ts +23 -0
- package/dist/cli/telemetry.js +262 -0
- package/dist/cli/telemetryJournal.d.ts +26 -0
- package/dist/cli/telemetryJournal.js +104 -0
- package/dist/cli/update/index.d.ts +21 -0
- package/dist/cli/update/index.js +284 -0
- package/dist/cli/upload/index.d.ts +11 -0
- package/dist/cli/upload/index.js +261 -0
- package/dist/cli/upload/kinds.d.ts +10 -0
- package/dist/cli/upload/kinds.js +85 -0
- package/dist/cli/upload/multipart.d.ts +21 -0
- package/dist/cli/upload/multipart.js +248 -0
- package/dist/cli/vault/affected-preview.d.ts +15 -0
- package/dist/cli/vault/affected-preview.js +38 -0
- package/dist/cli/vault/cloud.d.ts +55 -0
- package/dist/cli/vault/cloud.js +287 -0
- package/dist/cli/vault/format.d.ts +18 -0
- package/dist/cli/vault/format.js +104 -0
- package/dist/cli/vault/hostCredentials.d.ts +21 -0
- package/dist/cli/vault/hostCredentials.js +71 -0
- package/dist/cli/vault/hostSupersessions.d.ts +18 -0
- package/dist/cli/vault/hostSupersessions.js +68 -0
- package/dist/cli/vault/import.d.ts +3 -0
- package/dist/cli/vault/import.js +79 -0
- package/dist/cli/vault/index.d.ts +14 -0
- package/dist/cli/vault/index.js +225 -0
- package/dist/cli/vault/keys.d.ts +5 -0
- package/dist/cli/vault/keys.js +165 -0
- package/dist/cli/vault/kms.d.ts +6 -0
- package/dist/cli/vault/kms.js +169 -0
- package/dist/cli/vault/list.d.ts +13 -0
- package/dist/cli/vault/list.js +60 -0
- package/dist/cli/vault/listView.d.ts +21 -0
- package/dist/cli/vault/listView.js +123 -0
- package/dist/cli/vault/managementMetadata.d.ts +2 -0
- package/dist/cli/vault/managementMetadata.js +23 -0
- package/dist/cli/vault/mutations.d.ts +8 -0
- package/dist/cli/vault/mutations.js +151 -0
- package/dist/cli/vault/otp.d.ts +6 -0
- package/dist/cli/vault/otp.js +62 -0
- package/dist/cli/vault/otpIntent.d.ts +23 -0
- package/dist/cli/vault/otpIntent.js +76 -0
- package/dist/cli/vault/passImport.d.ts +25 -0
- package/dist/cli/vault/passImport.js +129 -0
- package/dist/cli/vault/passOtp.d.ts +51 -0
- package/dist/cli/vault/passOtp.js +101 -0
- package/dist/cli/vault/passStore.d.ts +26 -0
- package/dist/cli/vault/passStore.js +134 -0
- package/dist/cli/vault/passwordCommand.d.ts +39 -0
- package/dist/cli/vault/passwordCommand.js +101 -0
- package/dist/cli/vault/passwordProbe.d.ts +27 -0
- package/dist/cli/vault/passwordProbe.js +282 -0
- package/dist/cli/vault/passwordRotation.d.ts +9 -0
- package/dist/cli/vault/passwordRotation.js +273 -0
- package/dist/cli/vault/rotationApi.d.ts +13 -0
- package/dist/cli/vault/rotationApi.js +58 -0
- package/dist/cli/vault/rotationCommand.d.ts +2 -0
- package/dist/cli/vault/rotationCommand.js +75 -0
- package/dist/cli/vault/rotationEngine.d.ts +19 -0
- package/dist/cli/vault/rotationEngine.js +65 -0
- package/dist/cli/vault/rotationHelperSource.d.ts +2 -0
- package/dist/cli/vault/rotationHelperSource.js +3 -0
- package/dist/cli/vault/rotationInput.d.ts +11 -0
- package/dist/cli/vault/rotationInput.js +48 -0
- package/dist/cli/vault/rotationJournal.d.ts +16 -0
- package/dist/cli/vault/rotationJournal.js +183 -0
- package/dist/cli/vault/rotationKeys.d.ts +4 -0
- package/dist/cli/vault/rotationKeys.js +48 -0
- package/dist/cli/vault/rotationPrepare.d.ts +17 -0
- package/dist/cli/vault/rotationPrepare.js +108 -0
- package/dist/cli/vault/rotationRemote.d.ts +33 -0
- package/dist/cli/vault/rotationRemote.js +156 -0
- package/dist/cli/vault/rotationState.d.ts +42 -0
- package/dist/cli/vault/rotationState.js +115 -0
- package/dist/cli/vault/rotationTransport.d.ts +18 -0
- package/dist/cli/vault/rotationTransport.js +71 -0
- package/dist/cli/vault/sshSource.d.ts +18 -0
- package/dist/cli/vault/sshSource.js +196 -0
- package/dist/cli/vault/sshSync.d.ts +17 -0
- package/dist/cli/vault/sshSync.js +224 -0
- package/dist/cli/vault/sshTransfer.d.ts +22 -0
- package/dist/cli/vault/sshTransfer.js +140 -0
- package/dist/cli/vault/terraformState.d.ts +66 -0
- package/dist/cli/vault/terraformState.js +252 -0
- package/dist/cli/vault/terraformStateCommand.d.ts +2 -0
- package/dist/cli/vault/terraformStateCommand.js +61 -0
- package/dist/cli/vault/tree.d.ts +43 -0
- package/dist/cli/vault/tree.js +292 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.js +9 -0
- package/dist/cli/workflow/index.d.ts +76 -0
- package/dist/cli/workflow/index.js +826 -0
- package/dist/cli/workflow/validate.d.ts +19 -0
- package/dist/cli/workflow/validate.js +353 -0
- package/dist/package.json +1 -0
- package/package.json +28 -10
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Source control plane: its external layer, its lifecycle, and its removal.
|
|
3
|
+
*
|
|
4
|
+
* Contract: api-contract §5, §6 and §12.
|
|
5
|
+
*
|
|
6
|
+
* **Nothing here is shared with `delete.ts`.** The names rhyme and the shapes do
|
|
7
|
+
* not: a Source-delete operation has no `path` and no `deletedCount`, so the
|
|
8
|
+
* managed-directory validator rejects every real response; and §10's operations
|
|
9
|
+
* are readable by an actor holding Source EDIT while §12's are Owner/Admin
|
|
10
|
+
* only. Reusing either would be reusing a word.
|
|
11
|
+
*/
|
|
12
|
+
import { randomUUID } from "node:crypto";
|
|
13
|
+
import { requestJson } from "../client.js";
|
|
14
|
+
import { emitJson, fail } from "../helpers.js";
|
|
15
|
+
import { bad, ctx, isObject, resolveSource, strictArgs, seg, } from "./index.js";
|
|
16
|
+
import { explainWrite, assertSourceDetail } from "./write.js";
|
|
17
|
+
const MAX_IDEMPOTENCY_KEY = 255;
|
|
18
|
+
function idempotencyKey(override) {
|
|
19
|
+
if (override === undefined)
|
|
20
|
+
return { ok: true, key: randomUUID() };
|
|
21
|
+
const key = override.trim();
|
|
22
|
+
if (key === "") {
|
|
23
|
+
fail("--idempotency-key is empty — omit it to start a new command");
|
|
24
|
+
return { ok: false };
|
|
25
|
+
}
|
|
26
|
+
if (key.length > MAX_IDEMPOTENCY_KEY) {
|
|
27
|
+
fail(`--idempotency-key is longer than ${MAX_IDEMPOTENCY_KEY} characters`);
|
|
28
|
+
return { ok: false };
|
|
29
|
+
}
|
|
30
|
+
return { ok: true, key };
|
|
31
|
+
}
|
|
32
|
+
function neverAnswered(err) {
|
|
33
|
+
if (err instanceof Error && (err.name === "TimeoutError" || err.name === "AbortError")) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return err instanceof TypeError;
|
|
37
|
+
}
|
|
38
|
+
function parseJsonArg(value, flag) {
|
|
39
|
+
if (value === undefined)
|
|
40
|
+
return { ok: true, value: undefined };
|
|
41
|
+
try {
|
|
42
|
+
return { ok: true, value: JSON.parse(value) };
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// The parser names a character offset in a string the caller cannot see.
|
|
46
|
+
fail(`${flag} is not valid JSON`);
|
|
47
|
+
return { ok: false };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Read the revision the write will CAS on.
|
|
52
|
+
*
|
|
53
|
+
* §5 uses `expectedCompositionRevision` — the composition, not the settings.
|
|
54
|
+
* They are different numbers on the same object, and sending the wrong one
|
|
55
|
+
* fails against a Source nobody has touched, which reads as a conflict that
|
|
56
|
+
* never happened.
|
|
57
|
+
*/
|
|
58
|
+
async function compositionRevision(c, sourceId) {
|
|
59
|
+
const detail = await requestJson(c.remote, `/namespaces/${seg(c.ns)}/sources/${seg(sourceId)}`, {
|
|
60
|
+
token: c.token,
|
|
61
|
+
});
|
|
62
|
+
const revision = isObject(detail) ? detail.compositionRevision : undefined;
|
|
63
|
+
/*
|
|
64
|
+
* The same rule `settingsRevision` follows, and for the same reason: this
|
|
65
|
+
* goes straight back as a CAS token, and a fractional or negative one is
|
|
66
|
+
* refused as a malformed request — which reads as "your edit conflicted"
|
|
67
|
+
* rather than "the server said something this client cannot use".
|
|
68
|
+
*/
|
|
69
|
+
if (typeof revision !== "number" || !Number.isSafeInteger(revision) || revision < 0) {
|
|
70
|
+
bad("detail: compositionRevision must be a non-negative integer");
|
|
71
|
+
}
|
|
72
|
+
return revision;
|
|
73
|
+
}
|
|
74
|
+
function reportDetail(detail, json, what) {
|
|
75
|
+
if (json) {
|
|
76
|
+
emitJson({
|
|
77
|
+
name: detail.name,
|
|
78
|
+
lifecycle: detail.lifecycle,
|
|
79
|
+
// The display label, as this output has always carried.
|
|
80
|
+
provider: detail.provider?.label ?? null,
|
|
81
|
+
hasExternal: detail.hasExternal,
|
|
82
|
+
settingsRevision: detail.settingsRevision,
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
process.stdout.write(`${what} '${detail.name}'\n lifecycle ${detail.lifecycle}\n`);
|
|
87
|
+
if (detail.provider)
|
|
88
|
+
process.stdout.write(` provider ${detail.provider.label}\n`);
|
|
89
|
+
}
|
|
90
|
+
// ── external add / change ─────────────────────────────────────────────────────
|
|
91
|
+
export async function runExternalSet(opts) {
|
|
92
|
+
const c = await ctx(opts.namespace);
|
|
93
|
+
if (!c)
|
|
94
|
+
return 1;
|
|
95
|
+
const key = idempotencyKey(opts.idempotencyKey);
|
|
96
|
+
if (!key.ok)
|
|
97
|
+
return 1;
|
|
98
|
+
const target = parseJsonArg(opts.target, "--target");
|
|
99
|
+
const scope = parseJsonArg(opts.scope, "--scope");
|
|
100
|
+
const config = parseJsonArg(opts.config, "--config");
|
|
101
|
+
if (!target.ok || !scope.ok || !config.ok)
|
|
102
|
+
return 1;
|
|
103
|
+
try {
|
|
104
|
+
const source = await resolveSource(c, opts.source);
|
|
105
|
+
const revision = await compositionRevision(c, source.id);
|
|
106
|
+
/*
|
|
107
|
+
* One endpoint, two meanings.
|
|
108
|
+
*
|
|
109
|
+
* §5: with no external layer this is an Add; with one it is a Change that
|
|
110
|
+
* keeps the mount-slot layerId. The CLI does not branch on that — asking
|
|
111
|
+
* first and choosing would introduce a race the server's CAS already
|
|
112
|
+
* settles, and the answer is the same request either way.
|
|
113
|
+
*/
|
|
114
|
+
const detail = assertSourceDetail(await requestJson(c.remote, `/namespaces/${seg(c.ns)}/sources/${seg(source.id)}/external`, {
|
|
115
|
+
method: "PUT",
|
|
116
|
+
token: c.token,
|
|
117
|
+
/*
|
|
118
|
+
* The server records this one (routes.ts, the `/external` PUT).
|
|
119
|
+
*
|
|
120
|
+
* Without it a lost response is expensive rather than merely unclear:
|
|
121
|
+
* repeating the request re-validates against the provider, commits
|
|
122
|
+
* again, and advances the composition revision a second time.
|
|
123
|
+
*/
|
|
124
|
+
headers: { "Idempotency-Key": key.key },
|
|
125
|
+
json: {
|
|
126
|
+
expectedCompositionRevision: revision,
|
|
127
|
+
external: {
|
|
128
|
+
connectorKind: opts.connector,
|
|
129
|
+
...(opts.connection === undefined ? {} : { connectionId: opts.connection }),
|
|
130
|
+
target: target.value,
|
|
131
|
+
...(scope.value === undefined ? {} : { scope: scope.value }),
|
|
132
|
+
...(config.value === undefined ? {} : { config: config.value }),
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
}), "external");
|
|
136
|
+
reportDetail(detail, opts.json === true, "External layer set on");
|
|
137
|
+
return 0;
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
if (neverAnswered(err)) {
|
|
141
|
+
fail(`${explainWrite(err)}\n` +
|
|
142
|
+
` The server may or may not have applied it. Retry with the SAME key:\n` +
|
|
143
|
+
` --idempotency-key ${key.key}`);
|
|
144
|
+
return 1;
|
|
145
|
+
}
|
|
146
|
+
// A failed candidate validation keeps the old configuration (§5), so there
|
|
147
|
+
// is nothing to undo and nothing to retry on the caller's behalf.
|
|
148
|
+
fail(explainWrite(err));
|
|
149
|
+
return 1;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// ── external remove ───────────────────────────────────────────────────────────
|
|
153
|
+
export async function runExternalRemove(opts) {
|
|
154
|
+
const c = await ctx(opts.namespace);
|
|
155
|
+
if (!c)
|
|
156
|
+
return 1;
|
|
157
|
+
const key = idempotencyKey(opts.idempotencyKey);
|
|
158
|
+
if (!key.ok)
|
|
159
|
+
return 1;
|
|
160
|
+
try {
|
|
161
|
+
const source = await resolveSource(c, opts.source);
|
|
162
|
+
const revision = await compositionRevision(c, source.id);
|
|
163
|
+
await requestJson(c.remote, `/namespaces/${seg(c.ns)}/sources/${seg(source.id)}/external`, {
|
|
164
|
+
method: "DELETE",
|
|
165
|
+
token: c.token,
|
|
166
|
+
/*
|
|
167
|
+
* Recorded server-side, and the reason matters here more than anywhere.
|
|
168
|
+
*
|
|
169
|
+
* A detach that succeeded and lost its response looks, on a rerun,
|
|
170
|
+
* exactly like a Source that never had an external layer — the caller
|
|
171
|
+
* cannot tell "I removed it" from "there was nothing to remove".
|
|
172
|
+
*/
|
|
173
|
+
headers: { "Idempotency-Key": key.key },
|
|
174
|
+
json: { expectedCompositionRevision: revision },
|
|
175
|
+
});
|
|
176
|
+
if (opts.json)
|
|
177
|
+
emitJson({ source: source.name, hasExternal: false });
|
|
178
|
+
else {
|
|
179
|
+
/*
|
|
180
|
+
* §5: this only detaches. It does not touch the third-party payload, and
|
|
181
|
+
* the Source may now be an empty pure-managed one — saying "removed"
|
|
182
|
+
* alone invites someone to believe their bucket was emptied.
|
|
183
|
+
*/
|
|
184
|
+
process.stdout.write(`Detached the external layer from '${source.name}'\n` +
|
|
185
|
+
` Nothing was deleted at the provider; only the reference is gone.\n`);
|
|
186
|
+
}
|
|
187
|
+
return 0;
|
|
188
|
+
}
|
|
189
|
+
catch (err) {
|
|
190
|
+
if (neverAnswered(err)) {
|
|
191
|
+
fail(`${explainWrite(err)}\n` +
|
|
192
|
+
` The server may or may not have applied it. Retry with the SAME key:\n` +
|
|
193
|
+
` --idempotency-key ${key.key}`);
|
|
194
|
+
return 1;
|
|
195
|
+
}
|
|
196
|
+
fail(explainWrite(err));
|
|
197
|
+
return 1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// ── enable / disable ──────────────────────────────────────────────────────────
|
|
201
|
+
export async function runLifecycle(action, opts) {
|
|
202
|
+
const c = await ctx(opts.namespace);
|
|
203
|
+
if (!c)
|
|
204
|
+
return 1;
|
|
205
|
+
const key = idempotencyKey(opts.idempotencyKey);
|
|
206
|
+
if (!key.ok)
|
|
207
|
+
return 1;
|
|
208
|
+
try {
|
|
209
|
+
const source = await resolveSource(c, opts.source);
|
|
210
|
+
const detail = assertSourceDetail(await requestJson(c.remote, `/namespaces/${seg(c.ns)}/sources/${seg(source.id)}:${action}`, {
|
|
211
|
+
method: "POST",
|
|
212
|
+
token: c.token,
|
|
213
|
+
/*
|
|
214
|
+
* Sent even though the actions look naturally idempotent.
|
|
215
|
+
*
|
|
216
|
+
* Enabling twice does end in the same lifecycle, but `enable` runs the
|
|
217
|
+
* current configuration's validation on the way — so a rerun is a
|
|
218
|
+
* second provider check and a second chance to fail, not a no-op. The
|
|
219
|
+
* server keeps a record for exactly this.
|
|
220
|
+
*/
|
|
221
|
+
headers: { "Idempotency-Key": key.key },
|
|
222
|
+
}), action);
|
|
223
|
+
reportDetail(detail, opts.json === true, action === "enable" ? "Enabled" : "Disabled");
|
|
224
|
+
return 0;
|
|
225
|
+
}
|
|
226
|
+
catch (err) {
|
|
227
|
+
if (neverAnswered(err)) {
|
|
228
|
+
fail(`${explainWrite(err)}\n` +
|
|
229
|
+
` The server may or may not have applied it. Retry with the SAME key:\n` +
|
|
230
|
+
` --idempotency-key ${key.key}`);
|
|
231
|
+
return 1;
|
|
232
|
+
}
|
|
233
|
+
/*
|
|
234
|
+
* §6: enable runs the current configuration's minimal validation first, and
|
|
235
|
+
* a failure LEAVES IT DISABLED. So the error is the whole answer — there is
|
|
236
|
+
* no half-enabled state to describe and nothing to roll back.
|
|
237
|
+
*/
|
|
238
|
+
fail(explainWrite(err));
|
|
239
|
+
return 1;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// ── check-access ──────────────────────────────────────────────────────────────
|
|
243
|
+
const ACCESS_REASONS = [
|
|
244
|
+
"upstream-auth-failed",
|
|
245
|
+
"upstream-forbidden",
|
|
246
|
+
"upstream-not-found",
|
|
247
|
+
"upstream-rate-limited",
|
|
248
|
+
"upstream-timeout",
|
|
249
|
+
"internal-storage-unavailable",
|
|
250
|
+
"unknown",
|
|
251
|
+
];
|
|
252
|
+
export function assertAccessCheck(res, where) {
|
|
253
|
+
if (!isObject(res))
|
|
254
|
+
bad(`${where}: expected an object`);
|
|
255
|
+
if (res.status !== "available" && res.status !== "unavailable") {
|
|
256
|
+
bad(`${where}: unexpected status`);
|
|
257
|
+
}
|
|
258
|
+
if (res.reason !== undefined && !ACCESS_REASONS.includes(res.reason)) {
|
|
259
|
+
bad(`${where}: unknown reason`);
|
|
260
|
+
}
|
|
261
|
+
// Printed, so checked: `retryable` is what tells the caller whether to try
|
|
262
|
+
// again, and an absent one rendered as `undefined` is worse than no line.
|
|
263
|
+
if (typeof res.retryable !== "boolean")
|
|
264
|
+
bad(`${where}: missing retryable`);
|
|
265
|
+
if (typeof res.checkedAt !== "string" || Number.isNaN(Date.parse(res.checkedAt))) {
|
|
266
|
+
bad(`${where}: missing or unreadable checkedAt`);
|
|
267
|
+
}
|
|
268
|
+
if (res.managementHint !== undefined && typeof res.managementHint !== "string") {
|
|
269
|
+
bad(`${where}: managementHint must be a string`);
|
|
270
|
+
}
|
|
271
|
+
return res;
|
|
272
|
+
}
|
|
273
|
+
export async function runCheckAccess(opts) {
|
|
274
|
+
const c = await ctx(opts.namespace);
|
|
275
|
+
if (!c)
|
|
276
|
+
return 1;
|
|
277
|
+
try {
|
|
278
|
+
const source = await resolveSource(c, opts.source);
|
|
279
|
+
const check = assertAccessCheck(await requestJson(c.remote, `/namespaces/${seg(c.ns)}/sources/${seg(source.id)}:check-access`, {
|
|
280
|
+
method: "POST",
|
|
281
|
+
token: c.token,
|
|
282
|
+
}), "check-access");
|
|
283
|
+
if (opts.json) {
|
|
284
|
+
emitJson({
|
|
285
|
+
status: check.status,
|
|
286
|
+
...(check.reason === undefined ? {} : { reason: check.reason }),
|
|
287
|
+
retryable: check.retryable,
|
|
288
|
+
checkedAt: check.checkedAt,
|
|
289
|
+
...(check.managementHint === undefined ? {} : { managementHint: check.managementHint }),
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
process.stdout.write(`${source.name}: ${check.status}\n`);
|
|
294
|
+
if (check.reason)
|
|
295
|
+
process.stdout.write(` reason ${check.reason}\n`);
|
|
296
|
+
process.stdout.write(` retryable ${check.retryable}\n checked ${check.checkedAt}\n`);
|
|
297
|
+
if (check.managementHint)
|
|
298
|
+
process.stdout.write(` hint ${check.managementHint}\n`);
|
|
299
|
+
/*
|
|
300
|
+
* §6: the result is not persisted as health and does not change the
|
|
301
|
+
* lifecycle. Without this, an `unavailable` reads as a state change the
|
|
302
|
+
* caller should act on, and a `disable` follows that nobody asked for.
|
|
303
|
+
*/
|
|
304
|
+
process.stdout.write(` This is a probe: it changes nothing about the Source.\n`);
|
|
305
|
+
}
|
|
306
|
+
// `unavailable` is a successful probe reporting bad news, not a failed
|
|
307
|
+
// command — a script checking the exit code is asking "did the check run".
|
|
308
|
+
return 0;
|
|
309
|
+
}
|
|
310
|
+
catch (err) {
|
|
311
|
+
fail(explainWrite(err));
|
|
312
|
+
return 1;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
export function assertCreatedSourceDelete(res, where) {
|
|
316
|
+
if (!isObject(res))
|
|
317
|
+
bad(`${where}: expected an object`);
|
|
318
|
+
if (typeof res.operationId !== "string" || res.operationId === "") {
|
|
319
|
+
bad(`${where}: missing operationId`);
|
|
320
|
+
}
|
|
321
|
+
if (res.state !== "queued")
|
|
322
|
+
bad(`${where}: expected state 'queued'`);
|
|
323
|
+
return res;
|
|
324
|
+
}
|
|
325
|
+
const SOURCE_DELETE_STATES = [
|
|
326
|
+
"queued",
|
|
327
|
+
"running",
|
|
328
|
+
"failed",
|
|
329
|
+
"succeeded",
|
|
330
|
+
];
|
|
331
|
+
export function assertSourceDeleteOperation(res, where, expectedId) {
|
|
332
|
+
if (!isObject(res))
|
|
333
|
+
bad(`${where}: expected an object`);
|
|
334
|
+
if (typeof res.id !== "string" || res.id === "")
|
|
335
|
+
bad(`${where}: missing id`);
|
|
336
|
+
// An answer about a different operation is not an answer to the question.
|
|
337
|
+
if (res.id !== expectedId)
|
|
338
|
+
bad(`${where}: answered about ${res.id}, not ${expectedId}`);
|
|
339
|
+
if (typeof res.sourceId !== "string" || res.sourceId === "")
|
|
340
|
+
bad(`${where}: missing sourceId`);
|
|
341
|
+
if (!SOURCE_DELETE_STATES.includes(res.state)) {
|
|
342
|
+
bad(`${where}: unknown state`);
|
|
343
|
+
}
|
|
344
|
+
if (res.safeError !== undefined) {
|
|
345
|
+
const e = res.safeError;
|
|
346
|
+
if (!isObject(e))
|
|
347
|
+
bad(`${where}.safeError: expected an object`);
|
|
348
|
+
if (typeof e.code !== "string" || e.code === "")
|
|
349
|
+
bad(`${where}.safeError: missing code`);
|
|
350
|
+
if (typeof e.message !== "string")
|
|
351
|
+
bad(`${where}.safeError: missing message`);
|
|
352
|
+
if (typeof e.retryable !== "boolean")
|
|
353
|
+
bad(`${where}.safeError: missing retryable`);
|
|
354
|
+
if (typeof e.requestId !== "string")
|
|
355
|
+
bad(`${where}.safeError: missing requestId`);
|
|
356
|
+
}
|
|
357
|
+
return res;
|
|
358
|
+
}
|
|
359
|
+
function sourceDeleteJson(op) {
|
|
360
|
+
return {
|
|
361
|
+
operationId: op.id,
|
|
362
|
+
sourceId: op.sourceId,
|
|
363
|
+
state: op.state,
|
|
364
|
+
// Projected, not forwarded: only what was validated is published.
|
|
365
|
+
...(op.safeError === undefined
|
|
366
|
+
? {}
|
|
367
|
+
: {
|
|
368
|
+
error: {
|
|
369
|
+
code: op.safeError.code,
|
|
370
|
+
message: op.safeError.message,
|
|
371
|
+
retryable: op.safeError.retryable,
|
|
372
|
+
requestId: op.safeError.requestId,
|
|
373
|
+
},
|
|
374
|
+
}),
|
|
375
|
+
/*
|
|
376
|
+
* §12: the name is held until the cleanup succeeds. So a queued deletion
|
|
377
|
+
* does NOT free the name, and a caller scripting "delete then re-create"
|
|
378
|
+
* needs to know which of those is true right now.
|
|
379
|
+
*/
|
|
380
|
+
nameReleased: op.state === "succeeded",
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
function reportSourceDelete(op, json, prefix) {
|
|
384
|
+
if (json) {
|
|
385
|
+
emitJson(sourceDeleteJson(op));
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
process.stdout.write(`${prefix} ${op.id}\n state ${op.state}\n`);
|
|
389
|
+
if (op.safeError) {
|
|
390
|
+
process.stdout.write(` error ${op.safeError.code} ${op.safeError.message}\n`);
|
|
391
|
+
}
|
|
392
|
+
process.stdout.write(op.state === "succeeded"
|
|
393
|
+
? ` The name is free again.\n`
|
|
394
|
+
: ` The name stays taken until the cleanup succeeds.\n`);
|
|
395
|
+
}
|
|
396
|
+
export async function runSourceDelete(opts) {
|
|
397
|
+
const c = await ctx(opts.namespace);
|
|
398
|
+
if (!c)
|
|
399
|
+
return 1;
|
|
400
|
+
const key = idempotencyKey(opts.idempotencyKey);
|
|
401
|
+
if (!key.ok)
|
|
402
|
+
return 1;
|
|
403
|
+
try {
|
|
404
|
+
const source = await resolveSource(c, opts.source);
|
|
405
|
+
const created = assertCreatedSourceDelete(await requestJson(c.remote, `/namespaces/${seg(c.ns)}/sources/${seg(source.id)}`, {
|
|
406
|
+
method: "DELETE",
|
|
407
|
+
token: c.token,
|
|
408
|
+
headers: { "Idempotency-Key": key.key },
|
|
409
|
+
}), "delete-source");
|
|
410
|
+
if (opts.json) {
|
|
411
|
+
emitJson({ operationId: created.operationId, state: created.state, nameReleased: false });
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
process.stdout.write(`Queued deletion of '${source.name}' — operation ${created.operationId}\n` +
|
|
415
|
+
` Its Project and Bindr references were removed in the same transaction.\n` +
|
|
416
|
+
` The name stays taken until the cleanup succeeds.\n` +
|
|
417
|
+
` Check it with:\n` +
|
|
418
|
+
` dreamlake source delete-source-status ${created.operationId}\n`);
|
|
419
|
+
}
|
|
420
|
+
return 0;
|
|
421
|
+
}
|
|
422
|
+
catch (err) {
|
|
423
|
+
if (neverAnswered(err)) {
|
|
424
|
+
fail(`${explainWrite(err)}\n` +
|
|
425
|
+
` The server may or may not have queued it. Retry with the SAME key:\n` +
|
|
426
|
+
` --idempotency-key ${key.key}`);
|
|
427
|
+
return 1;
|
|
428
|
+
}
|
|
429
|
+
fail(explainWrite(err));
|
|
430
|
+
return 1;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
async function readSourceDelete(c, operationId) {
|
|
434
|
+
return assertSourceDeleteOperation(await requestJson(c.remote, `/namespaces/${seg(c.ns)}/source-delete-operations/${seg(operationId)}`, { token: c.token }), "source-delete-operation", operationId);
|
|
435
|
+
}
|
|
436
|
+
export async function runSourceDeleteStatus(operationId, opts) {
|
|
437
|
+
const c = await ctx(opts.namespace);
|
|
438
|
+
if (!c)
|
|
439
|
+
return 1;
|
|
440
|
+
try {
|
|
441
|
+
const op = await readSourceDelete(c, operationId);
|
|
442
|
+
reportSourceDelete(op, opts.json === true, "Source deletion");
|
|
443
|
+
return op.state === "failed" ? 1 : 0;
|
|
444
|
+
}
|
|
445
|
+
catch (err) {
|
|
446
|
+
fail(explainWrite(err));
|
|
447
|
+
return 1;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Retry a failed Source deletion.
|
|
452
|
+
*
|
|
453
|
+
* **No idempotency key, deliberately.** §12's retry route does not read the
|
|
454
|
+
* header — `retryDeleteOperation` is called with the namespace, the actor and
|
|
455
|
+
* the id, and nothing else — so a key sent here changes nothing, and telling
|
|
456
|
+
* the caller to repeat one would be promising a guarantee that does not exist:
|
|
457
|
+
* they would repeat the request and get a fresh attempt, or
|
|
458
|
+
* `SOURCE_OPERATION_IN_PROGRESS`, rather than the original result.
|
|
459
|
+
*
|
|
460
|
+
* So an ambiguous failure sends them to read the state instead, which is the
|
|
461
|
+
* only thing that actually answers the question.
|
|
462
|
+
*/
|
|
463
|
+
export async function runSourceDeleteRetry(operationId, opts) {
|
|
464
|
+
const c = await ctx(opts.namespace);
|
|
465
|
+
if (!c)
|
|
466
|
+
return 1;
|
|
467
|
+
try {
|
|
468
|
+
const op = assertSourceDeleteOperation(await requestJson(c.remote, `/namespaces/${seg(c.ns)}/source-delete-operations/${seg(operationId)}:retry`, { method: "POST", token: c.token }), "retry", operationId);
|
|
469
|
+
reportSourceDelete(op, opts.json === true, "Retrying source deletion");
|
|
470
|
+
return 0;
|
|
471
|
+
}
|
|
472
|
+
catch (err) {
|
|
473
|
+
if (neverAnswered(err)) {
|
|
474
|
+
fail(`${explainWrite(err)}\n` +
|
|
475
|
+
` The server may or may not have rescheduled it, and this endpoint has no\n` +
|
|
476
|
+
` idempotency key. Read the state instead:\n` +
|
|
477
|
+
` dreamlake source delete-source-status ${operationId}`);
|
|
478
|
+
return 1;
|
|
479
|
+
}
|
|
480
|
+
fail(explainWrite(err));
|
|
481
|
+
return 1;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
// ── registration ──────────────────────────────────────────────────────────────
|
|
485
|
+
export function registerSourceControlCommands(source) {
|
|
486
|
+
strictArgs(source.command("external-set"))
|
|
487
|
+
.description("attach or replace a source's external layer")
|
|
488
|
+
.requiredOption("--source <name>", "source name (see 'dreamlake source list')")
|
|
489
|
+
.requiredOption("--connector <kind>", "connector kind (e.g. s3, huggingface)")
|
|
490
|
+
.requiredOption("--target <json>", "connector target, as JSON")
|
|
491
|
+
.option("--connection <id>", "connection to authenticate with")
|
|
492
|
+
.option("--scope <json>", "scope within the target, as JSON")
|
|
493
|
+
.option("--config <json>", "connector config, as JSON")
|
|
494
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
495
|
+
.option("--idempotency-key <key>", "reuse a key from an attempt that never answered")
|
|
496
|
+
.option("--json", "emit JSON")
|
|
497
|
+
.action(async (opts) => process.exit(await runExternalSet(opts)));
|
|
498
|
+
strictArgs(source.command("external-remove"))
|
|
499
|
+
.description("detach a source's external layer (the provider is untouched)")
|
|
500
|
+
.requiredOption("--source <name>", "source name (see 'dreamlake source list')")
|
|
501
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
502
|
+
.option("--idempotency-key <key>", "reuse a key from an attempt that never answered")
|
|
503
|
+
.option("--json", "emit JSON")
|
|
504
|
+
.action(async (opts) => process.exit(await runExternalRemove(opts)));
|
|
505
|
+
strictArgs(source.command("enable"))
|
|
506
|
+
.description("enable a source (its configuration is validated first)")
|
|
507
|
+
.requiredOption("--source <name>", "source name (see 'dreamlake source list')")
|
|
508
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
509
|
+
.option("--idempotency-key <key>", "reuse a key from an attempt that never answered")
|
|
510
|
+
.option("--json", "emit JSON")
|
|
511
|
+
.action(async (opts) => process.exit(await runLifecycle("enable", opts)));
|
|
512
|
+
strictArgs(source.command("disable"))
|
|
513
|
+
.description("disable a source")
|
|
514
|
+
.requiredOption("--source <name>", "source name (see 'dreamlake source list')")
|
|
515
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
516
|
+
.option("--idempotency-key <key>", "reuse a key from an attempt that never answered")
|
|
517
|
+
.option("--json", "emit JSON")
|
|
518
|
+
.action(async (opts) => process.exit(await runLifecycle("disable", opts)));
|
|
519
|
+
strictArgs(source.command("check-access"))
|
|
520
|
+
.description("probe a source's upstream (changes nothing)")
|
|
521
|
+
.requiredOption("--source <name>", "source name (see 'dreamlake source list')")
|
|
522
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
523
|
+
.option("--json", "emit JSON")
|
|
524
|
+
.action(async (opts) => process.exit(await runCheckAccess(opts)));
|
|
525
|
+
strictArgs(source.command("delete-source"))
|
|
526
|
+
.description("queue deletion of a whole source")
|
|
527
|
+
.requiredOption("--source <name>", "source name (see 'dreamlake source list')")
|
|
528
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
529
|
+
.option("--idempotency-key <key>", "reuse a key from an attempt that never answered")
|
|
530
|
+
.option("--json", "emit JSON")
|
|
531
|
+
.action(async (opts) => process.exit(await runSourceDelete(opts)));
|
|
532
|
+
strictArgs(source.command("delete-source-status"))
|
|
533
|
+
.description("read a source-deletion operation")
|
|
534
|
+
.argument("<operationId>", "operation id from 'source delete-source'")
|
|
535
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
536
|
+
.option("--json", "emit JSON")
|
|
537
|
+
.action(async (id, opts) => process.exit(await runSourceDeleteStatus(id, opts)));
|
|
538
|
+
strictArgs(source.command("delete-source-retry"))
|
|
539
|
+
.description("retry a failed source-deletion operation")
|
|
540
|
+
.argument("<operationId>", "operation id from 'source delete-source'")
|
|
541
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
542
|
+
// No --idempotency-key: §12's retry route does not read one, and offering
|
|
543
|
+
// the flag would advertise a guarantee the server does not make.
|
|
544
|
+
.option("--json", "emit JSON")
|
|
545
|
+
.action(async (id, opts) => process.exit(await runSourceDeleteRetry(id, opts)));
|
|
546
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deleting managed objects and managed prefixes.
|
|
3
|
+
*
|
|
4
|
+
* Contract: api-contract §10. Two endpoints with genuinely different execution
|
|
5
|
+
* models, so two commands rather than one with `-r`:
|
|
6
|
+
*
|
|
7
|
+
* - `delete-object` is synchronous and physical. One object, `204`, done.
|
|
8
|
+
* - `delete-prefix` queues an operation and returns its id. It is not atomic,
|
|
9
|
+
* it records failure so it can be retried, and the retry reuses the same
|
|
10
|
+
* operation record rather than making a second one.
|
|
11
|
+
*
|
|
12
|
+
* A flag would have implied those are the same thing with a different scope.
|
|
13
|
+
* They are not: one returns a result, the other returns a handle.
|
|
14
|
+
*
|
|
15
|
+
* What deletion does NOT let this command claim is as important as what it
|
|
16
|
+
* does. Removing an internal object can uncover an external one at the same
|
|
17
|
+
* path, so "deleted" does not mean "gone" and a listing may be the same length
|
|
18
|
+
* afterwards. The server does not report whether anything reappeared, so
|
|
19
|
+
* neither does this.
|
|
20
|
+
*/
|
|
21
|
+
import type { Command } from "commander";
|
|
22
|
+
/** §10's operation states. `failed` is the only one Retry accepts. */
|
|
23
|
+
export type OperationState = "queued" | "running" | "failed" | "succeeded";
|
|
24
|
+
export interface DirectoryDeleteOperation {
|
|
25
|
+
id: string;
|
|
26
|
+
sourceId: string;
|
|
27
|
+
path: string;
|
|
28
|
+
state: OperationState;
|
|
29
|
+
deletedCount?: number;
|
|
30
|
+
safeError?: {
|
|
31
|
+
code: string;
|
|
32
|
+
message: string;
|
|
33
|
+
retryable: boolean;
|
|
34
|
+
requestId: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** What §10's creation endpoint returns — and it is NOT an operation. */
|
|
38
|
+
export interface CreatedOperation {
|
|
39
|
+
operationId: string;
|
|
40
|
+
state: "queued";
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The 202 from `managed-directory-deletions`.
|
|
44
|
+
*
|
|
45
|
+
* Two fields, and neither of them is `id`. Validating this with the full
|
|
46
|
+
* operation shape rejects every real response — the endpoint does not send
|
|
47
|
+
* `id`, `path` or `sourceId` — so the command would fail on a server that
|
|
48
|
+
* behaved exactly as specified.
|
|
49
|
+
*/
|
|
50
|
+
export declare function assertCreatedOperation(res: unknown, where: string): CreatedOperation;
|
|
51
|
+
/**
|
|
52
|
+
* A full operation, as `GET` and `:retry` return it.
|
|
53
|
+
*
|
|
54
|
+
* `expectedId` is required rather than optional: both callers know which
|
|
55
|
+
* operation they asked about, and an answer describing a different one is not
|
|
56
|
+
* an answer to their question. Accepting it would let a poll silently follow
|
|
57
|
+
* the server to another record — and from `:retry` it would mean a second
|
|
58
|
+
* operation was created, which §10 says never happens and which is where the
|
|
59
|
+
* fencing token comes from.
|
|
60
|
+
*/
|
|
61
|
+
export declare function assertOperation(res: unknown, where: string, expectedId: string): DirectoryDeleteOperation;
|
|
62
|
+
export declare function runDeleteObject(path: string, opts: {
|
|
63
|
+
source: string;
|
|
64
|
+
namespace?: string;
|
|
65
|
+
idempotencyKey?: string;
|
|
66
|
+
json?: boolean;
|
|
67
|
+
}): Promise<number>;
|
|
68
|
+
/** How long `--wait` will watch before handing the operation back. */
|
|
69
|
+
export declare const WAIT_TIMEOUT_MS: number;
|
|
70
|
+
export declare function runDeletePrefix(path: string, opts: {
|
|
71
|
+
source: string;
|
|
72
|
+
namespace?: string;
|
|
73
|
+
wait?: boolean;
|
|
74
|
+
idempotencyKey?: string;
|
|
75
|
+
json?: boolean;
|
|
76
|
+
/** Injectable so tests do not sleep. */
|
|
77
|
+
sleep?: (ms: number) => Promise<void>;
|
|
78
|
+
now?: () => number;
|
|
79
|
+
}): Promise<number>;
|
|
80
|
+
export declare function runDeleteStatus(operationId: string, opts: {
|
|
81
|
+
namespace?: string;
|
|
82
|
+
json?: boolean;
|
|
83
|
+
}): Promise<number>;
|
|
84
|
+
export declare function runDeleteRetry(operationId: string, opts: {
|
|
85
|
+
namespace?: string;
|
|
86
|
+
idempotencyKey?: string;
|
|
87
|
+
json?: boolean;
|
|
88
|
+
}): Promise<number>;
|
|
89
|
+
export declare function registerSourceDeleteCommands(source: Command): void;
|