@dreamlake/dreamlake-cli 0.88.1 → 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,563 @@
|
|
|
1
|
+
// `dreamlake source stat | editors | editor-add | editor-remove | references`
|
|
2
|
+
//
|
|
3
|
+
// Three server surfaces that had no CLI, grouped because they answer the same
|
|
4
|
+
// two questions an operator asks before changing anything: what is actually
|
|
5
|
+
// there, and who else is attached to it.
|
|
6
|
+
//
|
|
7
|
+
// stat one exact path in the resolved view, with its metadata
|
|
8
|
+
// editors who has been granted Editor on this Source (Owner/Admin only)
|
|
9
|
+
// references which Projects and Bindrs point at it (Owner/Admin only)
|
|
10
|
+
//
|
|
11
|
+
// `references` exists for the question a delete raises. It is ADMIN-only and
|
|
12
|
+
// deliberately not permission-filtered: a version that listed only the Projects
|
|
13
|
+
// the caller belongs to would UNDER-report what a delete is about to detach,
|
|
14
|
+
// which is the one direction that must not be wrong. There is no bind or unbind
|
|
15
|
+
// here — those belong to the Project/Bindr API, and this side only reads.
|
|
16
|
+
import { randomUUID } from "node:crypto";
|
|
17
|
+
import { HttpError, requestJson } from "../client.js";
|
|
18
|
+
import { emitJson, fail, ok, renderTable } from "../helpers.js";
|
|
19
|
+
import { asProviderIdentity, bad, ctx, explain, isObject, nullableString, resolveSource, seg, strictArgs, } from "./index.js";
|
|
20
|
+
import { explainWrite } from "./write.js";
|
|
21
|
+
/**
|
|
22
|
+
* Explain a failed Owner/Admin-only command: `editors`, `editor-add`,
|
|
23
|
+
* `editor-remove`, `references`.
|
|
24
|
+
*
|
|
25
|
+
* Not `explain`. That rewrites every 403 as "you need read access to this
|
|
26
|
+
* namespace", which is right for browse and wrong here: a member who can read
|
|
27
|
+
* the Source is refused because these routes need Owner/Admin, and naming the
|
|
28
|
+
* wrong permission sends them to ask for something that would not help. The
|
|
29
|
+
* server's typed message and code are passed through instead, as the share
|
|
30
|
+
* commands do. Only a 403 without a v1 envelope gets a sentence of ours, and it
|
|
31
|
+
* names the permission these commands actually need.
|
|
32
|
+
*/
|
|
33
|
+
function explainAdmin(err) {
|
|
34
|
+
if (err instanceof HttpError && err.status === 403) {
|
|
35
|
+
if (err.code)
|
|
36
|
+
return `${err.message} [${err.code}]`;
|
|
37
|
+
return "permission denied — this needs the namespace Owner or Admin";
|
|
38
|
+
}
|
|
39
|
+
return explainWrite(err);
|
|
40
|
+
}
|
|
41
|
+
// ─── shapes ───────────────────────────────────────────────────────────────────
|
|
42
|
+
/**
|
|
43
|
+
* The subject kinds the contract names.
|
|
44
|
+
*
|
|
45
|
+
* `SERVICE_ACCOUNT` is accepted here because the wire accepts it. Whether one
|
|
46
|
+
* can be created is another plane's question, and refusing the word locally
|
|
47
|
+
* would make this client wrong the day it can.
|
|
48
|
+
*/
|
|
49
|
+
const SUBJECT_TYPES = ["USER", "TEAM", "SERVICE_ACCOUNT"];
|
|
50
|
+
/**
|
|
51
|
+
* `size` — a non-negative integer, or null.
|
|
52
|
+
*
|
|
53
|
+
* "A finite number" was too loose in both directions the contract closes. The
|
|
54
|
+
* response schema types it `integer`, and the adapter boundary rejects anything
|
|
55
|
+
* that is not a non-negative integer or null before it can become a DTO — so
|
|
56
|
+
* `1.5` and `-1` are values no compliant server produces, and printing either
|
|
57
|
+
* would state a byte count that cannot exist.
|
|
58
|
+
*/
|
|
59
|
+
function nullableSize(v) {
|
|
60
|
+
return v === null || (typeof v === "number" && Number.isSafeInteger(v) && v >= 0);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Every consumed field checked, and a NEW object returned.
|
|
64
|
+
*
|
|
65
|
+
* The response is not handed to `emitJson`. Every other Source `--json` site
|
|
66
|
+
* builds its output from validated fields, and this one forwarded whatever
|
|
67
|
+
* arrived — so a server, a proxy or an endpoint that was not the one the caller
|
|
68
|
+
* thought could put an extra key straight into the log they were piping into.
|
|
69
|
+
* Projecting by name closes that regardless of what shows up.
|
|
70
|
+
*/
|
|
71
|
+
function assertStat(res) {
|
|
72
|
+
const at = "the stat response";
|
|
73
|
+
if (!isObject(res))
|
|
74
|
+
bad(`${at} was not an object`);
|
|
75
|
+
for (const k of ["name", "path"]) {
|
|
76
|
+
if (typeof res[k] !== "string" || res[k] === "")
|
|
77
|
+
bad(`${at} is missing '${k}'`);
|
|
78
|
+
}
|
|
79
|
+
if (res.kind !== "file" && res.kind !== "directory")
|
|
80
|
+
bad(`${at} has no usable 'kind'`);
|
|
81
|
+
// The origin union, both arms. `external` without a provider would render as
|
|
82
|
+
// "external (undefined)" — a sentence about the object that is not true.
|
|
83
|
+
const o = res.origin;
|
|
84
|
+
if (!isObject(o))
|
|
85
|
+
bad(`${at} is missing 'origin'`);
|
|
86
|
+
let origin;
|
|
87
|
+
if (o.kind === "dreamlake-storage") {
|
|
88
|
+
origin = { kind: "dreamlake-storage" };
|
|
89
|
+
}
|
|
90
|
+
else if (o.kind === "external") {
|
|
91
|
+
// `{id, label}` on current servers, a bare label string before the
|
|
92
|
+
// product-identity change — both become the identity, and anything else
|
|
93
|
+
// would render as "external (undefined)".
|
|
94
|
+
const provider = asProviderIdentity(o.provider);
|
|
95
|
+
if (provider === null)
|
|
96
|
+
bad(`${at} has an external origin with no 'provider'`);
|
|
97
|
+
origin = { kind: "external", provider };
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
bad(`${at} has an origin this client does not recognise`);
|
|
101
|
+
}
|
|
102
|
+
// Required and nullable. Absent is not null: "unknown size" and "the server
|
|
103
|
+
// did not answer" are different, and only one of them is a fact.
|
|
104
|
+
if (!nullableSize(res.size)) {
|
|
105
|
+
bad(`${at} has a 'size' that is neither a non-negative integer nor null`);
|
|
106
|
+
}
|
|
107
|
+
if (!nullableString(res.modifiedAt))
|
|
108
|
+
bad(`${at} has a 'modifiedAt' that is neither a string nor null`);
|
|
109
|
+
if (!nullableString(res.mediaType))
|
|
110
|
+
bad(`${at} has a 'mediaType' that is neither a string nor null`);
|
|
111
|
+
if (!nullableString(res.observedRevision)) {
|
|
112
|
+
bad(`${at} has an 'observedRevision' that is neither a string nor null`);
|
|
113
|
+
}
|
|
114
|
+
for (const k of ["canPreview", "canDownload", "canDelete"]) {
|
|
115
|
+
// Consumed as permissions. An absent one read as `undefined` is falsy here,
|
|
116
|
+
// which is safe — but it would also be indistinguishable from a real
|
|
117
|
+
// `false`, and "you may not download this" is a claim.
|
|
118
|
+
if (typeof res[k] !== "boolean")
|
|
119
|
+
bad(`${at} is missing '${k}'`);
|
|
120
|
+
}
|
|
121
|
+
if (res.metadata !== null && !isObject(res.metadata)) {
|
|
122
|
+
bad(`${at} has a 'metadata' that is neither an object nor null`);
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
name: res.name,
|
|
126
|
+
path: res.path,
|
|
127
|
+
kind: res.kind,
|
|
128
|
+
origin,
|
|
129
|
+
size: res.size,
|
|
130
|
+
modifiedAt: res.modifiedAt,
|
|
131
|
+
mediaType: res.mediaType,
|
|
132
|
+
canPreview: res.canPreview,
|
|
133
|
+
canDownload: res.canDownload,
|
|
134
|
+
canDelete: res.canDelete,
|
|
135
|
+
observedRevision: res.observedRevision,
|
|
136
|
+
metadata: res.metadata,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function assertEditor(raw, where) {
|
|
140
|
+
if (!isObject(raw))
|
|
141
|
+
bad(`${where} was not an object`);
|
|
142
|
+
const t = raw.subjectType;
|
|
143
|
+
if (typeof t !== "string" || !SUBJECT_TYPES.includes(t)) {
|
|
144
|
+
bad(`${where} has no usable 'subjectType'`);
|
|
145
|
+
}
|
|
146
|
+
for (const k of ["subjectId", "createdByActorId", "createdAt"]) {
|
|
147
|
+
if (typeof raw[k] !== "string" || raw[k] === "")
|
|
148
|
+
bad(`${where} is missing '${k}'`);
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
subjectType: t,
|
|
152
|
+
subjectId: raw.subjectId,
|
|
153
|
+
createdByActorId: raw.createdByActorId,
|
|
154
|
+
createdAt: raw.createdAt,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
// ─── stat ─────────────────────────────────────────────────────────────────────
|
|
158
|
+
/**
|
|
159
|
+
* One exact path, resolved.
|
|
160
|
+
*
|
|
161
|
+
* Not a substitute for `browse`: browse answers "what is in this directory",
|
|
162
|
+
* stat answers "what is this, exactly" — including `observedRevision` and the
|
|
163
|
+
* connector's metadata, neither of which a listing carries. The path travels as
|
|
164
|
+
* a query parameter, verbatim. It is a value, not a URL segment, and this
|
|
165
|
+
* client does not trim, normalize or re-split it: the server owns what a valid
|
|
166
|
+
* canonical path is, and tidying one changes which object is addressed.
|
|
167
|
+
*/
|
|
168
|
+
export async function runSourceStat(pathArg, opts) {
|
|
169
|
+
const c = await ctx(opts.namespace);
|
|
170
|
+
if (!c)
|
|
171
|
+
return 1;
|
|
172
|
+
try {
|
|
173
|
+
const source = await resolveSource(c, opts.source);
|
|
174
|
+
const stat = assertStat(await requestJson(c.remote, `/namespaces/${seg(c.ns)}/sources/${seg(source.id)}/stat`, { token: c.token, query: { path: pathArg } }));
|
|
175
|
+
if (opts.json) {
|
|
176
|
+
// `origin.provider` keeps the shape this output has always had — a
|
|
177
|
+
// printable label — whichever generation of the wire answered.
|
|
178
|
+
emitJson({
|
|
179
|
+
...stat,
|
|
180
|
+
origin: stat.origin.kind === "external"
|
|
181
|
+
? { kind: "external", provider: stat.origin.provider.label }
|
|
182
|
+
: stat.origin,
|
|
183
|
+
});
|
|
184
|
+
return 0;
|
|
185
|
+
}
|
|
186
|
+
process.stdout.write(` ${stat.path}\n`);
|
|
187
|
+
process.stdout.write(` kind: ${stat.kind}\n`);
|
|
188
|
+
process.stdout.write(` origin: ${stat.origin.kind === "external" ? `external (${stat.origin.provider.label})` : "DreamLake storage"}\n`);
|
|
189
|
+
if (stat.size !== null)
|
|
190
|
+
process.stdout.write(` size: ${stat.size}\n`);
|
|
191
|
+
if (stat.modifiedAt !== null)
|
|
192
|
+
process.stdout.write(` modified: ${stat.modifiedAt}\n`);
|
|
193
|
+
if (stat.mediaType !== null)
|
|
194
|
+
process.stdout.write(` type: ${stat.mediaType}\n`);
|
|
195
|
+
process.stdout.write(` you may: ${[
|
|
196
|
+
stat.canPreview ? "preview" : null,
|
|
197
|
+
stat.canDownload ? "download" : null,
|
|
198
|
+
stat.canDelete ? "delete" : null,
|
|
199
|
+
]
|
|
200
|
+
.filter(Boolean)
|
|
201
|
+
.join(", ") || "(nothing)"}\n`);
|
|
202
|
+
/*
|
|
203
|
+
* `null` is printed rather than skipped. It means the backend published no
|
|
204
|
+
* version for this object, which is a fact about the object — and silence
|
|
205
|
+
* would read as "this field was not asked for".
|
|
206
|
+
*/
|
|
207
|
+
process.stdout.write(` revision: ${stat.observedRevision ?? "(none published)"}\n`);
|
|
208
|
+
if (stat.metadata !== null && Object.keys(stat.metadata).length > 0) {
|
|
209
|
+
for (const [k, v] of Object.entries(stat.metadata)) {
|
|
210
|
+
process.stdout.write(` ${k}: ${typeof v === "string" ? v : JSON.stringify(v)}\n`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return 0;
|
|
214
|
+
}
|
|
215
|
+
catch (err) {
|
|
216
|
+
fail(explain(err));
|
|
217
|
+
return 1;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// ─── editors ──────────────────────────────────────────────────────────────────
|
|
221
|
+
export async function runSourceEditors(opts) {
|
|
222
|
+
const c = await ctx(opts.namespace);
|
|
223
|
+
if (!c)
|
|
224
|
+
return 1;
|
|
225
|
+
try {
|
|
226
|
+
const source = await resolveSource(c, opts.source);
|
|
227
|
+
const res = await requestJson(c.remote, `/namespaces/${seg(c.ns)}/sources/${seg(source.id)}/editors`, { token: c.token });
|
|
228
|
+
if (!isObject(res) || !Array.isArray(res.items))
|
|
229
|
+
bad("the editor list is missing 'items'");
|
|
230
|
+
const items = res.items.map((x, i) => assertEditor(x, `editor ${i + 1}`));
|
|
231
|
+
if (opts.json) {
|
|
232
|
+
emitJson({ items });
|
|
233
|
+
return 0;
|
|
234
|
+
}
|
|
235
|
+
if (items.length === 0) {
|
|
236
|
+
/*
|
|
237
|
+
* No Editors is not "no one can edit". Owners and Admins are not Editor
|
|
238
|
+
* rows — the Editor grant is the flat, per-Source one on top of them —
|
|
239
|
+
* and reporting an empty list as "nobody has access" would be false.
|
|
240
|
+
*/
|
|
241
|
+
process.stdout.write(`No one holds a per-source Editor grant on '${source.name}'.\n`);
|
|
242
|
+
process.stdout.write(" (Owners and Admins are not listed here; they are not Editor rows.)\n");
|
|
243
|
+
return 0;
|
|
244
|
+
}
|
|
245
|
+
process.stdout.write(renderTable(items.map((x) => ({
|
|
246
|
+
subject: `${x.subjectType} ${x.subjectId}`,
|
|
247
|
+
granted: x.createdAt,
|
|
248
|
+
by: x.createdByActorId,
|
|
249
|
+
})), ["subject", "granted", "by"]));
|
|
250
|
+
process.stdout.write(`\n ${items.length} editor(s) on '${source.name}'\n`);
|
|
251
|
+
return 0;
|
|
252
|
+
}
|
|
253
|
+
catch (err) {
|
|
254
|
+
fail(explainAdmin(err));
|
|
255
|
+
return 1;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Add and remove are both idempotent server-side and both read an
|
|
260
|
+
* `Idempotency-Key`, so one is sent — random per invocation, never derived.
|
|
261
|
+
*
|
|
262
|
+
* The key matters less here than on a create, and it is still not optional: a
|
|
263
|
+
* dropped response leaves the caller unable to tell an applied grant from a
|
|
264
|
+
* lost one, and repeating the command with the same key is the only way to ask
|
|
265
|
+
* that question without risking a second write.
|
|
266
|
+
*/
|
|
267
|
+
const MAX_IDEMPOTENCY_KEY = 255;
|
|
268
|
+
function idempotencyKey(override) {
|
|
269
|
+
if (override === undefined)
|
|
270
|
+
return { ok: true, key: randomUUID() };
|
|
271
|
+
const key = override.trim();
|
|
272
|
+
if (key === "") {
|
|
273
|
+
fail("--idempotency-key is empty — omit it to start a new command");
|
|
274
|
+
return { ok: false };
|
|
275
|
+
}
|
|
276
|
+
/*
|
|
277
|
+
* The server's bound, checked before the request rather than after it. A key
|
|
278
|
+
* over 255 characters is a guaranteed `SOURCE_REQUEST_INVALID`, and the whole
|
|
279
|
+
* point of an explicit key is that it is being reused after an attempt whose
|
|
280
|
+
* outcome is unknown — spending that reuse on a refusal is the worst moment
|
|
281
|
+
* to discover the limit.
|
|
282
|
+
*/
|
|
283
|
+
if (key.length > MAX_IDEMPOTENCY_KEY) {
|
|
284
|
+
fail(`--idempotency-key is longer than ${MAX_IDEMPOTENCY_KEY} characters`);
|
|
285
|
+
return { ok: false };
|
|
286
|
+
}
|
|
287
|
+
return { ok: true, key };
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* A request that got no answer, as opposed to one that was refused — or one
|
|
291
|
+
* that was answered badly.
|
|
292
|
+
*
|
|
293
|
+
* `!(err instanceof HttpError)` was wrong in a way that matters: every ordinary
|
|
294
|
+
* `Error` matched it, including the one `assertEditor` throws. A server that
|
|
295
|
+
* COMMITTED the write and returned a 201 missing `subjectId` would have been
|
|
296
|
+
* reported as "the response never arrived", with advice to retry using the same
|
|
297
|
+
* key — a confident, false statement about a write that had already happened,
|
|
298
|
+
* made at the moment the caller most needs the truth.
|
|
299
|
+
*
|
|
300
|
+
* The list is what `fetch` actually produces when nothing came back: an
|
|
301
|
+
* abort, a timeout, and the `TypeError` it raises for DNS failures, refused
|
|
302
|
+
* connections and dropped sockets. Same shape as the rest of the Source write
|
|
303
|
+
* plane, restated here rather than imported for the same reason the idempotency
|
|
304
|
+
* helper is.
|
|
305
|
+
*/
|
|
306
|
+
function neverAnswered(err) {
|
|
307
|
+
if (err instanceof Error && err.name === "TimeoutError")
|
|
308
|
+
return true;
|
|
309
|
+
if (err instanceof Error && err.name === "AbortError")
|
|
310
|
+
return true;
|
|
311
|
+
return err instanceof TypeError;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* What to say when the request left and no answer came back.
|
|
315
|
+
*
|
|
316
|
+
* The key is random per invocation, so it exists only inside this process — if
|
|
317
|
+
* it is not printed here, the advice to "retry with the same key" names
|
|
318
|
+
* something the caller cannot produce. Both Editor mutations are recorded
|
|
319
|
+
* server-side under the key, so repeating with it returns the original result
|
|
320
|
+
* instead of acting twice.
|
|
321
|
+
*/
|
|
322
|
+
function ambiguous(what, key, err) {
|
|
323
|
+
fail(`${what}: the request was sent but the response never arrived.\n` +
|
|
324
|
+
` The server may or may not have applied it. Retry with the SAME key:\n` +
|
|
325
|
+
` --idempotency-key ${key}\n` +
|
|
326
|
+
` Reusing that key returns the original result instead of acting twice.\n` +
|
|
327
|
+
` (${err.message})`);
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* The pre-read, with its own error handling.
|
|
331
|
+
*
|
|
332
|
+
* Deliberately NOT inside the mutation's try. `resolveSource` is a plain list
|
|
333
|
+
* read; a dropped socket there means nothing was written and nothing can have
|
|
334
|
+
* been, because the write has not been composed yet. Letting it fall into the
|
|
335
|
+
* mutation's catch would print "this may have applied, retry with the same key"
|
|
336
|
+
* about a request that never left the process.
|
|
337
|
+
*/
|
|
338
|
+
async function resolveForWrite(c, name) {
|
|
339
|
+
try {
|
|
340
|
+
return await resolveSource(c, name);
|
|
341
|
+
}
|
|
342
|
+
catch (err) {
|
|
343
|
+
fail(explain(err));
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function checkSubject(subjectType) {
|
|
348
|
+
if (SUBJECT_TYPES.includes(subjectType))
|
|
349
|
+
return true;
|
|
350
|
+
fail(`--subject-type must be one of: ${SUBJECT_TYPES.join(", ")}`);
|
|
351
|
+
return false;
|
|
352
|
+
}
|
|
353
|
+
export async function runSourceEditorAdd(opts) {
|
|
354
|
+
if (!checkSubject(opts.subjectType))
|
|
355
|
+
return 1;
|
|
356
|
+
const key = idempotencyKey(opts.idempotencyKey);
|
|
357
|
+
if (!key.ok)
|
|
358
|
+
return 1;
|
|
359
|
+
const c = await ctx(opts.namespace);
|
|
360
|
+
if (!c)
|
|
361
|
+
return 1;
|
|
362
|
+
const source = await resolveForWrite(c, opts.source);
|
|
363
|
+
if (!source)
|
|
364
|
+
return 1;
|
|
365
|
+
try {
|
|
366
|
+
const res = await requestJson(c.remote, `/namespaces/${seg(c.ns)}/sources/${seg(source.id)}/editors`, {
|
|
367
|
+
method: "POST",
|
|
368
|
+
token: c.token,
|
|
369
|
+
headers: { "Idempotency-Key": key.key },
|
|
370
|
+
json: { subjectType: opts.subjectType, subjectId: opts.subjectId },
|
|
371
|
+
});
|
|
372
|
+
const editor = assertEditor(res, "the created editor");
|
|
373
|
+
if (opts.json) {
|
|
374
|
+
emitJson(editor);
|
|
375
|
+
return 0;
|
|
376
|
+
}
|
|
377
|
+
ok(`${editor.subjectType} ${editor.subjectId} can now edit '${source.name}'`);
|
|
378
|
+
return 0;
|
|
379
|
+
}
|
|
380
|
+
catch (err) {
|
|
381
|
+
if (neverAnswered(err))
|
|
382
|
+
ambiguous("editor-add", key.key, err);
|
|
383
|
+
else
|
|
384
|
+
fail(explainAdmin(err));
|
|
385
|
+
return 1;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
export async function runSourceEditorRemove(opts) {
|
|
389
|
+
if (!checkSubject(opts.subjectType))
|
|
390
|
+
return 1;
|
|
391
|
+
const key = idempotencyKey(opts.idempotencyKey);
|
|
392
|
+
if (!key.ok)
|
|
393
|
+
return 1;
|
|
394
|
+
const c = await ctx(opts.namespace);
|
|
395
|
+
if (!c)
|
|
396
|
+
return 1;
|
|
397
|
+
const source = await resolveForWrite(c, opts.source);
|
|
398
|
+
if (!source)
|
|
399
|
+
return 1;
|
|
400
|
+
try {
|
|
401
|
+
await requestJson(c.remote, `/namespaces/${seg(c.ns)}/sources/${seg(source.id)}/editors/` +
|
|
402
|
+
`${seg(opts.subjectType)}/${seg(opts.subjectId)}`, { method: "DELETE", token: c.token, headers: { "Idempotency-Key": key.key } });
|
|
403
|
+
if (opts.json) {
|
|
404
|
+
emitJson({ source: source.name, subjectType: opts.subjectType, subjectId: opts.subjectId, removed: true });
|
|
405
|
+
return 0;
|
|
406
|
+
}
|
|
407
|
+
/*
|
|
408
|
+
* "no longer", not "was removed". Remove is idempotent and deliberately
|
|
409
|
+
* works for a subject that already left the namespace — that row is exactly
|
|
410
|
+
* the one an Admin most needs to clear — so a 204 says the grant is gone,
|
|
411
|
+
* not that one was found.
|
|
412
|
+
*/
|
|
413
|
+
ok(`${opts.subjectType} ${opts.subjectId} no longer holds an Editor grant on '${source.name}'`);
|
|
414
|
+
return 0;
|
|
415
|
+
}
|
|
416
|
+
catch (err) {
|
|
417
|
+
if (neverAnswered(err))
|
|
418
|
+
ambiguous("editor-remove", key.key, err);
|
|
419
|
+
else
|
|
420
|
+
fail(explainAdmin(err));
|
|
421
|
+
return 1;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
// ─── organizational references ────────────────────────────────────────────────
|
|
425
|
+
export async function runSourceReferences(opts) {
|
|
426
|
+
let limit;
|
|
427
|
+
if (opts.limit !== undefined) {
|
|
428
|
+
limit = Number(opts.limit);
|
|
429
|
+
if (!Number.isSafeInteger(limit) || limit < 1) {
|
|
430
|
+
fail("--limit must be a positive integer");
|
|
431
|
+
return 1;
|
|
432
|
+
}
|
|
433
|
+
/*
|
|
434
|
+
* No upper bound here, deliberately. §13.1 says an over-large `limit` is
|
|
435
|
+
* CLAMPED rather than rejected, precisely so a client never has to discover
|
|
436
|
+
* the ceiling by failing — and a cap invented locally would reintroduce the
|
|
437
|
+
* failure the contract removed.
|
|
438
|
+
*/
|
|
439
|
+
}
|
|
440
|
+
const c = await ctx(opts.namespace);
|
|
441
|
+
if (!c)
|
|
442
|
+
return 1;
|
|
443
|
+
try {
|
|
444
|
+
const source = await resolveSource(c, opts.source);
|
|
445
|
+
const res = await requestJson(c.remote, `/namespaces/${seg(c.ns)}/sources/${seg(source.id)}/organizational-references`, { token: c.token, query: { limit, cursor: opts.cursor } });
|
|
446
|
+
if (!isObject(res) || !Array.isArray(res.items)) {
|
|
447
|
+
bad("the reference list is missing 'items'");
|
|
448
|
+
}
|
|
449
|
+
if (!("nextCursor" in res) || !nullableString(res.nextCursor)) {
|
|
450
|
+
bad("the reference list is missing 'nextCursor'");
|
|
451
|
+
}
|
|
452
|
+
const items = res.items.map((raw, i) => {
|
|
453
|
+
const at = `reference ${i + 1}`;
|
|
454
|
+
if (!isObject(raw))
|
|
455
|
+
bad(`${at} was not an object`);
|
|
456
|
+
if (raw.kind !== "project" && raw.kind !== "bindr")
|
|
457
|
+
bad(`${at} has no usable 'kind'`);
|
|
458
|
+
for (const k of ["bindingId", "projectNodeId", "projectName"]) {
|
|
459
|
+
if (typeof raw[k] !== "string" || raw[k] === "")
|
|
460
|
+
bad(`${at} is missing '${k}'`);
|
|
461
|
+
}
|
|
462
|
+
const common = {
|
|
463
|
+
bindingId: raw.bindingId,
|
|
464
|
+
projectNodeId: raw.projectNodeId,
|
|
465
|
+
projectName: raw.projectName,
|
|
466
|
+
};
|
|
467
|
+
if (raw.kind === "project")
|
|
468
|
+
return { kind: "project", ...common };
|
|
469
|
+
/*
|
|
470
|
+
* A bindr reference carries three more fields, and the contract makes all
|
|
471
|
+
* three present for this kind. They are its stable identity: `bindrId`
|
|
472
|
+
* names the Bindr and `referenceId` names the row inside it, while
|
|
473
|
+
* `bindrName` is a display string that can change. Keeping only the name
|
|
474
|
+
* left `--json` unable to say WHICH Bindr a delete would detach.
|
|
475
|
+
*/
|
|
476
|
+
for (const k of ["referenceId", "bindrId", "bindrName"]) {
|
|
477
|
+
if (typeof raw[k] !== "string" || raw[k] === "") {
|
|
478
|
+
bad(`${at} is a bindr reference with no '${k}'`);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
return {
|
|
482
|
+
kind: "bindr",
|
|
483
|
+
...common,
|
|
484
|
+
referenceId: raw.referenceId,
|
|
485
|
+
bindrId: raw.bindrId,
|
|
486
|
+
bindrName: raw.bindrName,
|
|
487
|
+
};
|
|
488
|
+
});
|
|
489
|
+
const nextCursor = res.nextCursor;
|
|
490
|
+
if (opts.json) {
|
|
491
|
+
emitJson({ items, nextCursor });
|
|
492
|
+
return 0;
|
|
493
|
+
}
|
|
494
|
+
if (items.length === 0) {
|
|
495
|
+
if (nextCursor !== null) {
|
|
496
|
+
process.stdout.write(" Nothing on this page — but this is not the last one.\n");
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
process.stdout.write(`Nothing organizes '${source.name}'.\n`);
|
|
500
|
+
return 0;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
process.stdout.write(renderTable(items.map((x) => ({
|
|
505
|
+
kind: x.kind,
|
|
506
|
+
project: x.projectName,
|
|
507
|
+
// Only a bindr reference has one; a project reference is the
|
|
508
|
+
// Project itself, and inventing a dash-free blank would read as a
|
|
509
|
+
// bindr with an empty name.
|
|
510
|
+
bindr: x.kind === "bindr" ? x.bindrName : "-",
|
|
511
|
+
binding: x.bindingId,
|
|
512
|
+
})), ["kind", "project", "bindr", "binding"]));
|
|
513
|
+
process.stdout.write(`\n ${items.length} reference(s) on this page\n`);
|
|
514
|
+
/*
|
|
515
|
+
* Said plainly, because this list is read before a delete: what is here
|
|
516
|
+
* gets detached, and a page is not the whole answer.
|
|
517
|
+
*/
|
|
518
|
+
process.stdout.write(" Deleting this source detaches every reference, not just these.\n");
|
|
519
|
+
}
|
|
520
|
+
if (nextCursor !== null) {
|
|
521
|
+
process.stdout.write(`\n More to come. Next page:\n dreamlake source references --source ${source.name}` +
|
|
522
|
+
` --namespace ${c.ns} --cursor ${nextCursor}\n`);
|
|
523
|
+
}
|
|
524
|
+
return 0;
|
|
525
|
+
}
|
|
526
|
+
catch (err) {
|
|
527
|
+
fail(explainAdmin(err));
|
|
528
|
+
return 1;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
// ─── registration ─────────────────────────────────────────────────────────────
|
|
532
|
+
export function registerSourceAccessCommands(source) {
|
|
533
|
+
strictArgs(source.command("stat"))
|
|
534
|
+
.description("show one exact path in the resolved view, with its metadata")
|
|
535
|
+
.argument("<path>", "path within the source")
|
|
536
|
+
.requiredOption("--source <name>", "source name (see 'dreamlake source list')")
|
|
537
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
538
|
+
.option("--json", "emit JSON")
|
|
539
|
+
.action(async (p, opts) => process.exit(await runSourceStat(p, opts)));
|
|
540
|
+
strictArgs(source.command("editors"))
|
|
541
|
+
.description("who holds a per-source Editor grant (Owner/Admin only)")
|
|
542
|
+
.requiredOption("--source <name>", "source name")
|
|
543
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
544
|
+
.option("--json", "emit JSON")
|
|
545
|
+
.action(async (opts) => process.exit(await runSourceEditors(opts)));
|
|
546
|
+
const subject = (cmd) => cmd
|
|
547
|
+
.requiredOption("--source <name>", "source name")
|
|
548
|
+
.requiredOption("--subject-type <kind>", `one of: ${SUBJECT_TYPES.join(", ")}`)
|
|
549
|
+
.requiredOption("--subject-id <id>", "the user, team or service account id")
|
|
550
|
+
.option("--idempotency-key <key>", "reuse a key from an attempt that never answered")
|
|
551
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
552
|
+
.option("--json", "emit JSON");
|
|
553
|
+
subject(strictArgs(source.command("editor-add")).description("grant Editor on a source")).action(async (opts) => process.exit(await runSourceEditorAdd(opts)));
|
|
554
|
+
subject(strictArgs(source.command("editor-remove")).description("revoke Editor on a source")).action(async (opts) => process.exit(await runSourceEditorRemove(opts)));
|
|
555
|
+
strictArgs(source.command("references"))
|
|
556
|
+
.description("which projects and bindrs organize this source (Owner/Admin only)")
|
|
557
|
+
.requiredOption("--source <name>", "source name")
|
|
558
|
+
.option("--limit <n>", "page size (the server clamps an over-large value)")
|
|
559
|
+
.option("--cursor <cursor>", "continue from the cursor printed by the previous page")
|
|
560
|
+
.option("--namespace <slug>", "namespace slug (default: active login)")
|
|
561
|
+
.option("--json", "emit JSON")
|
|
562
|
+
.action(async (opts) => process.exit(await runSourceReferences(opts)));
|
|
563
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
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 type { Command } from "commander";
|
|
13
|
+
export declare function runExternalSet(opts: {
|
|
14
|
+
source: string;
|
|
15
|
+
connector: string;
|
|
16
|
+
target: string;
|
|
17
|
+
connection?: string;
|
|
18
|
+
scope?: string;
|
|
19
|
+
config?: string;
|
|
20
|
+
namespace?: string;
|
|
21
|
+
idempotencyKey?: string;
|
|
22
|
+
json?: boolean;
|
|
23
|
+
}): Promise<number>;
|
|
24
|
+
export declare function runExternalRemove(opts: {
|
|
25
|
+
source: string;
|
|
26
|
+
namespace?: string;
|
|
27
|
+
idempotencyKey?: string;
|
|
28
|
+
json?: boolean;
|
|
29
|
+
}): Promise<number>;
|
|
30
|
+
export declare function runLifecycle(action: "enable" | "disable", opts: {
|
|
31
|
+
source: string;
|
|
32
|
+
namespace?: string;
|
|
33
|
+
idempotencyKey?: string;
|
|
34
|
+
json?: boolean;
|
|
35
|
+
}): Promise<number>;
|
|
36
|
+
declare const ACCESS_REASONS: readonly ["upstream-auth-failed", "upstream-forbidden", "upstream-not-found", "upstream-rate-limited", "upstream-timeout", "internal-storage-unavailable", "unknown"];
|
|
37
|
+
export interface AccessCheck {
|
|
38
|
+
status: "available" | "unavailable";
|
|
39
|
+
reason?: (typeof ACCESS_REASONS)[number];
|
|
40
|
+
retryable: boolean;
|
|
41
|
+
checkedAt: string;
|
|
42
|
+
managementHint?: string;
|
|
43
|
+
}
|
|
44
|
+
export declare function assertAccessCheck(res: unknown, where: string): AccessCheck;
|
|
45
|
+
export declare function runCheckAccess(opts: {
|
|
46
|
+
source: string;
|
|
47
|
+
namespace?: string;
|
|
48
|
+
json?: boolean;
|
|
49
|
+
}): Promise<number>;
|
|
50
|
+
/** §12's creation response. Same two fields as §10's, and a different endpoint. */
|
|
51
|
+
export interface CreatedSourceDelete {
|
|
52
|
+
operationId: string;
|
|
53
|
+
state: "queued";
|
|
54
|
+
}
|
|
55
|
+
export declare function assertCreatedSourceDelete(res: unknown, where: string): CreatedSourceDelete;
|
|
56
|
+
export type SourceDeleteState = "queued" | "running" | "failed" | "succeeded";
|
|
57
|
+
/**
|
|
58
|
+
* §12's operation. Note what is NOT here: no `path`, no `deletedCount`.
|
|
59
|
+
*
|
|
60
|
+
* This is why the managed-directory validator cannot be reused — it requires
|
|
61
|
+
* both, and would reject every real Source-delete response.
|
|
62
|
+
*/
|
|
63
|
+
export interface SourceDeleteOperation {
|
|
64
|
+
id: string;
|
|
65
|
+
sourceId: string;
|
|
66
|
+
state: SourceDeleteState;
|
|
67
|
+
safeError?: {
|
|
68
|
+
code: string;
|
|
69
|
+
message: string;
|
|
70
|
+
retryable: boolean;
|
|
71
|
+
requestId: string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export declare function assertSourceDeleteOperation(res: unknown, where: string, expectedId: string): SourceDeleteOperation;
|
|
75
|
+
export declare function runSourceDelete(opts: {
|
|
76
|
+
source: string;
|
|
77
|
+
namespace?: string;
|
|
78
|
+
idempotencyKey?: string;
|
|
79
|
+
json?: boolean;
|
|
80
|
+
}): Promise<number>;
|
|
81
|
+
export declare function runSourceDeleteStatus(operationId: string, opts: {
|
|
82
|
+
namespace?: string;
|
|
83
|
+
json?: boolean;
|
|
84
|
+
}): Promise<number>;
|
|
85
|
+
/**
|
|
86
|
+
* Retry a failed Source deletion.
|
|
87
|
+
*
|
|
88
|
+
* **No idempotency key, deliberately.** §12's retry route does not read the
|
|
89
|
+
* header — `retryDeleteOperation` is called with the namespace, the actor and
|
|
90
|
+
* the id, and nothing else — so a key sent here changes nothing, and telling
|
|
91
|
+
* the caller to repeat one would be promising a guarantee that does not exist:
|
|
92
|
+
* they would repeat the request and get a fresh attempt, or
|
|
93
|
+
* `SOURCE_OPERATION_IN_PROGRESS`, rather than the original result.
|
|
94
|
+
*
|
|
95
|
+
* So an ambiguous failure sends them to read the state instead, which is the
|
|
96
|
+
* only thing that actually answers the question.
|
|
97
|
+
*/
|
|
98
|
+
export declare function runSourceDeleteRetry(operationId: string, opts: {
|
|
99
|
+
namespace?: string;
|
|
100
|
+
json?: boolean;
|
|
101
|
+
}): Promise<number>;
|
|
102
|
+
export declare function registerSourceControlCommands(source: Command): void;
|
|
103
|
+
export {};
|