@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,261 @@
|
|
|
1
|
+
// `dreamlake upload <file|dir> --episode <target> --to <path>`.
|
|
2
|
+
//
|
|
3
|
+
// Single file → one multipart upload. Directory → flat (non-recursive)
|
|
4
|
+
// folder upload with a resume manifest, matching dreamlake-py's
|
|
5
|
+
// cli/commands/upload.py. `--bindr a,b` adds the uploaded node(s) to the
|
|
6
|
+
// named bindrs (auto-created when missing).
|
|
7
|
+
import { createHash, } from "node:crypto";
|
|
8
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync, } from "node:fs";
|
|
9
|
+
import { homedir } from "node:os";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { HttpError, requestJson } from "../client.js";
|
|
12
|
+
import { resolveNamespace, resolveRemote, resolveToken } from "../config.js";
|
|
13
|
+
import { fail, humanSize, ok, splitCsv } from "../helpers.js";
|
|
14
|
+
import { confirm } from "../prompt.js";
|
|
15
|
+
import { formatTarget, parseTarget } from "../target.js";
|
|
16
|
+
import { detectKind } from "./kinds.js";
|
|
17
|
+
import { uploadFile } from "./multipart.js";
|
|
18
|
+
// Junk files skipped in folder mode (mirrors dl.upload_folder's defaults).
|
|
19
|
+
const FOLDER_IGNORE = [/^\.DS_Store$/, /^Thumbs\.db$/, /\.tmp$/, /\.lock$/, /\.swp$/, /^\./];
|
|
20
|
+
// ─── bindr membership ────────────────────────────────────────────────
|
|
21
|
+
async function addToBindrs(bindrNames, nodeIds, t, token, remote) {
|
|
22
|
+
if (bindrNames.length === 0 || nodeIds.length === 0)
|
|
23
|
+
return;
|
|
24
|
+
const base = `/namespaces/${t.namespace}/projects/${t.project}/bindrs`;
|
|
25
|
+
for (const name of bindrNames) {
|
|
26
|
+
try {
|
|
27
|
+
const res = await requestJson(remote, `${base}/${name}/members`, {
|
|
28
|
+
method: "POST",
|
|
29
|
+
token,
|
|
30
|
+
json: { add: nodeIds },
|
|
31
|
+
});
|
|
32
|
+
process.stdout.write(` bindr: added to '${name}' (total: ${res.total ?? "?"})\n`);
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
if (err instanceof HttpError && err.status === 404) {
|
|
36
|
+
// Bindr doesn't exist — create it with these members.
|
|
37
|
+
await requestJson(remote, base, {
|
|
38
|
+
method: "POST",
|
|
39
|
+
token,
|
|
40
|
+
json: { name, members: nodeIds },
|
|
41
|
+
});
|
|
42
|
+
process.stdout.write(` bindr: created '${name}' (${nodeIds.length} files)\n`);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
fail(`bindr '${name}': ${err.message}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// ─── shared setup: resolve target + namespace + token ────────────────
|
|
51
|
+
async function resolveContext(episode) {
|
|
52
|
+
let t;
|
|
53
|
+
try {
|
|
54
|
+
t = parseTarget(episode);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
fail(err.message);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const remote = resolveRemote();
|
|
61
|
+
const token = resolveToken();
|
|
62
|
+
if (!token) {
|
|
63
|
+
fail("not authenticated. run 'dreamlake login' first");
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const namespace = await resolveNamespace(t.namespace, { token, remote });
|
|
67
|
+
if (!namespace) {
|
|
68
|
+
fail("namespace not specified and no authenticated user found. run 'dreamlake login'");
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
t.namespace = namespace;
|
|
72
|
+
return {
|
|
73
|
+
t,
|
|
74
|
+
ut: { namespace, project: t.project, episode: t.episode },
|
|
75
|
+
token,
|
|
76
|
+
remote,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
// ─── single file ─────────────────────────────────────────────────────
|
|
80
|
+
async function uploadSingle(file, opts) {
|
|
81
|
+
// Unknown extensions upload as kind="file" — the unified /files route
|
|
82
|
+
// accepts any kind.
|
|
83
|
+
const kind = detectKind(file, opts.type);
|
|
84
|
+
const ctx = await resolveContext(opts.episode);
|
|
85
|
+
if (!ctx)
|
|
86
|
+
return 1;
|
|
87
|
+
const destPath = opts.to.replace(/^\/+/, "");
|
|
88
|
+
process.stdout.write(`Uploading ${path.basename(file)} (${kind})\n`);
|
|
89
|
+
process.stdout.write(` episode: ${formatTarget(ctx.t)}\n`);
|
|
90
|
+
process.stdout.write(` path: /${destPath}\n`);
|
|
91
|
+
try {
|
|
92
|
+
const result = await uploadFile(file, ctx.ut, destPath, kind, ctx.token, ctx.remote);
|
|
93
|
+
ok(`Uploaded: ${destPath ? `/${destPath}` : ""}/${path.basename(file)}`);
|
|
94
|
+
process.stdout.write(` object: ${result.objectKey}\n`);
|
|
95
|
+
process.stdout.write(` node id: ${result.nodeId ?? "?"}\n`);
|
|
96
|
+
const bindrNames = splitCsv(opts.bindr);
|
|
97
|
+
if (bindrNames.length > 0 && result.nodeId) {
|
|
98
|
+
await addToBindrs(bindrNames, [result.nodeId], ctx.ut, ctx.token, ctx.remote);
|
|
99
|
+
}
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
fail(err.message);
|
|
104
|
+
return 1;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function manifestPath(dir, episode, to) {
|
|
108
|
+
const stateDir = path.join(homedir(), ".dreamlake", "uploads");
|
|
109
|
+
mkdirSync(stateDir, { recursive: true });
|
|
110
|
+
const h = createHash("sha256")
|
|
111
|
+
.update(`${path.resolve(dir)}:${episode}:${to}`)
|
|
112
|
+
.digest("hex")
|
|
113
|
+
.slice(0, 16);
|
|
114
|
+
return path.join(stateDir, `folder-${h}.json`);
|
|
115
|
+
}
|
|
116
|
+
async function uploadFolder(dir, opts) {
|
|
117
|
+
const ctx = await resolveContext(opts.episode);
|
|
118
|
+
if (!ctx)
|
|
119
|
+
return 1;
|
|
120
|
+
const destPath = opts.to.replace(/^\/+/, "");
|
|
121
|
+
process.stdout.write(`\nScanning ${dir} ...\n`);
|
|
122
|
+
const allEntries = readdirSync(dir)
|
|
123
|
+
.map((name) => path.join(dir, name))
|
|
124
|
+
.filter((p) => statSync(p).isFile())
|
|
125
|
+
.sort();
|
|
126
|
+
const classified = {}; // filename → kind
|
|
127
|
+
const skipped = [];
|
|
128
|
+
for (const p of allEntries) {
|
|
129
|
+
const name = path.basename(p);
|
|
130
|
+
if (FOLDER_IGNORE.some((re) => re.test(name)))
|
|
131
|
+
skipped.push(name);
|
|
132
|
+
else
|
|
133
|
+
classified[name] = detectKind(name);
|
|
134
|
+
}
|
|
135
|
+
const totalUploadable = Object.keys(classified).length;
|
|
136
|
+
const mPath = manifestPath(dir, opts.episode, opts.to);
|
|
137
|
+
let manifest;
|
|
138
|
+
if (existsSync(mPath)) {
|
|
139
|
+
try {
|
|
140
|
+
manifest = JSON.parse(readFileSync(mPath, "utf8"));
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
manifest = { sourceDir: path.resolve(dir), target: opts.episode, to: opts.to, files: {}, skipped: [] };
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
manifest = { sourceDir: path.resolve(dir), target: opts.episode, to: opts.to, files: {}, skipped: [] };
|
|
148
|
+
}
|
|
149
|
+
for (const [name, cat] of Object.entries(classified)) {
|
|
150
|
+
if (!manifest.files[name])
|
|
151
|
+
manifest.files[name] = { status: "pending", category: cat };
|
|
152
|
+
}
|
|
153
|
+
manifest.skipped = skipped;
|
|
154
|
+
// Summary.
|
|
155
|
+
process.stdout.write(`\n Total ${allEntries.length} files\n`);
|
|
156
|
+
const byCat = {};
|
|
157
|
+
for (const cat of Object.values(classified))
|
|
158
|
+
byCat[cat] = (byCat[cat] ?? 0) + 1;
|
|
159
|
+
for (const cat of Object.keys(byCat).sort()) {
|
|
160
|
+
process.stdout.write(` ${cat.padEnd(11)} ${byCat[cat]}\n`);
|
|
161
|
+
}
|
|
162
|
+
if (skipped.length > 0) {
|
|
163
|
+
const preview = skipped.slice(0, 10).join(", ");
|
|
164
|
+
const more = skipped.length > 10 ? ` ...and ${skipped.length - 10} more` : "";
|
|
165
|
+
process.stdout.write(` Skipped ${skipped.length} — ignored (junk/hidden): ${preview}${more}\n`);
|
|
166
|
+
}
|
|
167
|
+
if (totalUploadable === 0) {
|
|
168
|
+
process.stdout.write("\n No files to upload.\n");
|
|
169
|
+
return 0;
|
|
170
|
+
}
|
|
171
|
+
if (!opts.yes) {
|
|
172
|
+
const proceed = await confirm(" Continue?", true);
|
|
173
|
+
if (!proceed)
|
|
174
|
+
return 0;
|
|
175
|
+
}
|
|
176
|
+
writeFileSync(mPath, JSON.stringify(manifest, null, 2));
|
|
177
|
+
// Upload pending/failed.
|
|
178
|
+
const toUpload = Object.entries(manifest.files).filter(([, info]) => info.status === "pending" || info.status === "failed");
|
|
179
|
+
let uploaded = 0;
|
|
180
|
+
let failed = 0;
|
|
181
|
+
for (const [name, info] of toUpload) {
|
|
182
|
+
const filePath = path.join(dir, name);
|
|
183
|
+
if (!existsSync(filePath)) {
|
|
184
|
+
info.status = "failed";
|
|
185
|
+
info.error = "file not found";
|
|
186
|
+
failed++;
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
const sizeStr = humanSize(statSync(filePath).size);
|
|
190
|
+
process.stdout.write(`\n→ ${name} (${info.category}, ${sizeStr})\n`);
|
|
191
|
+
try {
|
|
192
|
+
const result = await uploadFile(filePath, ctx.ut, destPath, info.category, ctx.token, ctx.remote);
|
|
193
|
+
info.status = "done";
|
|
194
|
+
if (result.nodeId)
|
|
195
|
+
info.nodeId = result.nodeId;
|
|
196
|
+
uploaded++;
|
|
197
|
+
}
|
|
198
|
+
catch (err) {
|
|
199
|
+
info.status = "failed";
|
|
200
|
+
info.error = err.message;
|
|
201
|
+
failed++;
|
|
202
|
+
fail(`${name}: ${err.message}`);
|
|
203
|
+
}
|
|
204
|
+
writeFileSync(mPath, JSON.stringify(manifest, null, 2));
|
|
205
|
+
}
|
|
206
|
+
// Summary.
|
|
207
|
+
const totalDone = Object.values(manifest.files).filter((f) => f.status === "done").length;
|
|
208
|
+
process.stdout.write("\n");
|
|
209
|
+
if (failed === 0) {
|
|
210
|
+
ok(`${totalDone}/${totalUploadable} uploaded, ${skipped.length} skipped`);
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
process.stdout.write(`⚠ ${totalDone}/${totalUploadable} uploaded, ${skipped.length} skipped, ${failed} failed\n`);
|
|
214
|
+
process.stdout.write(" Re-run to retry failed files.\n");
|
|
215
|
+
}
|
|
216
|
+
// Bindr membership.
|
|
217
|
+
const bindrNames = splitCsv(opts.bindr);
|
|
218
|
+
if (bindrNames.length > 0) {
|
|
219
|
+
const nodeIds = Object.values(manifest.files)
|
|
220
|
+
.map((f) => f.nodeId)
|
|
221
|
+
.filter((id) => Boolean(id));
|
|
222
|
+
if (nodeIds.length > 0) {
|
|
223
|
+
await addToBindrs(bindrNames, nodeIds, ctx.ut, ctx.token, ctx.remote);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (failed === 0 && existsSync(mPath))
|
|
227
|
+
rmSync(mPath);
|
|
228
|
+
return failed === 0 ? 0 : 1;
|
|
229
|
+
}
|
|
230
|
+
// ─── entry ───────────────────────────────────────────────────────────
|
|
231
|
+
export async function runUpload(file, opts) {
|
|
232
|
+
if (!opts.episode) {
|
|
233
|
+
fail("--episode is required");
|
|
234
|
+
return 1;
|
|
235
|
+
}
|
|
236
|
+
if (!opts.to) {
|
|
237
|
+
fail("--to is required");
|
|
238
|
+
return 1;
|
|
239
|
+
}
|
|
240
|
+
if (!existsSync(file)) {
|
|
241
|
+
fail(`file not found: ${file}`);
|
|
242
|
+
return 1;
|
|
243
|
+
}
|
|
244
|
+
if (statSync(file).isDirectory())
|
|
245
|
+
return uploadFolder(file, opts);
|
|
246
|
+
return uploadSingle(file, opts);
|
|
247
|
+
}
|
|
248
|
+
export function registerUploadCommand(program) {
|
|
249
|
+
program
|
|
250
|
+
.command("upload")
|
|
251
|
+
.description("upload a file (or a flat directory) to DreamLake")
|
|
252
|
+
.argument("<path>", "local file or directory")
|
|
253
|
+
.requiredOption("--episode <target>", "episode scope: space[@namespace][:episode]")
|
|
254
|
+
.requiredOption("--to <path>", "destination path within the episode")
|
|
255
|
+
.option("--type <category>", "override auto-detected category")
|
|
256
|
+
.option("--bindr <names>", "comma-separated bindr names to add the upload to")
|
|
257
|
+
.option("--yes", "skip the folder-upload confirmation prompt")
|
|
258
|
+
.action(async (file, opts) => {
|
|
259
|
+
process.exit(await runUpload(file, opts));
|
|
260
|
+
});
|
|
261
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const EXTENSION_TO_KIND: Record<string, string>;
|
|
2
|
+
export declare const MIME_MAP: Record<string, string>;
|
|
3
|
+
/** Lowercase file extension including the dot, e.g. "/a/b.MP4" → ".mp4". */
|
|
4
|
+
export declare function extOf(filename: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Detect the asset kind from the extension, or use the override.
|
|
7
|
+
* Unknown extensions fall through to "file" (still uploads — the server
|
|
8
|
+
* treats kind as free-form).
|
|
9
|
+
*/
|
|
10
|
+
export declare function detectKind(filename: string, typeOverride?: string): string;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Extension → kind / MIME maps for the unified BSS `/files` route.
|
|
2
|
+
// Ported from dreamlake-py's __init__.py (dl.upload) — the per-category
|
|
3
|
+
// BSS routes used by the older Python CLI no longer exist server-side;
|
|
4
|
+
// `kind` is free-form and anything not in this table uploads as "file".
|
|
5
|
+
export const EXTENSION_TO_KIND = {
|
|
6
|
+
".mp4": "video",
|
|
7
|
+
".mkv": "video",
|
|
8
|
+
".mov": "video",
|
|
9
|
+
".webm": "video",
|
|
10
|
+
".wav": "audio",
|
|
11
|
+
".mp3": "audio",
|
|
12
|
+
".aac": "audio",
|
|
13
|
+
".opus": "audio",
|
|
14
|
+
".flac": "audio",
|
|
15
|
+
".jpg": "image",
|
|
16
|
+
".jpeg": "image",
|
|
17
|
+
".png": "image",
|
|
18
|
+
".gif": "image",
|
|
19
|
+
".webp": "image",
|
|
20
|
+
".bmp": "image",
|
|
21
|
+
".tiff": "image",
|
|
22
|
+
".tif": "image",
|
|
23
|
+
".jsonl": "label-track",
|
|
24
|
+
".vtt": "text-track",
|
|
25
|
+
".srt": "text-track",
|
|
26
|
+
".parquet": "parquet",
|
|
27
|
+
".csv": "csv",
|
|
28
|
+
".npy": "npy",
|
|
29
|
+
".npz": "npy",
|
|
30
|
+
".pkl": "pickle",
|
|
31
|
+
".pickle": "pickle",
|
|
32
|
+
".txt": "text",
|
|
33
|
+
".md": "text",
|
|
34
|
+
".log": "text",
|
|
35
|
+
".json": "json",
|
|
36
|
+
};
|
|
37
|
+
export const MIME_MAP = {
|
|
38
|
+
".mp4": "video/mp4",
|
|
39
|
+
".mkv": "video/x-matroska",
|
|
40
|
+
".mov": "video/quicktime",
|
|
41
|
+
".webm": "video/webm",
|
|
42
|
+
".wav": "audio/wav",
|
|
43
|
+
".mp3": "audio/mpeg",
|
|
44
|
+
".aac": "audio/aac",
|
|
45
|
+
".opus": "audio/ogg",
|
|
46
|
+
".flac": "audio/flac",
|
|
47
|
+
".jpg": "image/jpeg",
|
|
48
|
+
".jpeg": "image/jpeg",
|
|
49
|
+
".png": "image/png",
|
|
50
|
+
".gif": "image/gif",
|
|
51
|
+
".webp": "image/webp",
|
|
52
|
+
".bmp": "image/bmp",
|
|
53
|
+
".tiff": "image/tiff",
|
|
54
|
+
".tif": "image/tiff",
|
|
55
|
+
".vtt": "text/vtt",
|
|
56
|
+
".srt": "text/plain",
|
|
57
|
+
".jsonl": "application/x-jsonlines",
|
|
58
|
+
".parquet": "application/vnd.apache.parquet",
|
|
59
|
+
".csv": "text/csv",
|
|
60
|
+
".npy": "application/octet-stream",
|
|
61
|
+
".npz": "application/octet-stream",
|
|
62
|
+
".pkl": "application/octet-stream",
|
|
63
|
+
".pickle": "application/octet-stream",
|
|
64
|
+
".txt": "text/plain",
|
|
65
|
+
".md": "text/markdown",
|
|
66
|
+
".log": "text/plain",
|
|
67
|
+
".json": "application/json",
|
|
68
|
+
};
|
|
69
|
+
/** Lowercase file extension including the dot, e.g. "/a/b.MP4" → ".mp4". */
|
|
70
|
+
export function extOf(filename) {
|
|
71
|
+
const dot = filename.lastIndexOf(".");
|
|
72
|
+
if (dot < 0)
|
|
73
|
+
return "";
|
|
74
|
+
return filename.slice(dot).toLowerCase();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Detect the asset kind from the extension, or use the override.
|
|
78
|
+
* Unknown extensions fall through to "file" (still uploads — the server
|
|
79
|
+
* treats kind as free-form).
|
|
80
|
+
*/
|
|
81
|
+
export function detectKind(filename, typeOverride) {
|
|
82
|
+
if (typeOverride)
|
|
83
|
+
return typeOverride;
|
|
84
|
+
return EXTENSION_TO_KIND[extOf(filename)] ?? "file";
|
|
85
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type SignedOperation } from "../compat/presignedTransfer.js";
|
|
2
|
+
export interface UploadTarget {
|
|
3
|
+
namespace: string;
|
|
4
|
+
project: string;
|
|
5
|
+
episode: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface UploadResult {
|
|
8
|
+
nodeId: string | null;
|
|
9
|
+
/** The key the server minted. Echoed, never parsed — see the authorize side. */
|
|
10
|
+
objectKey: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* sha256 of the file, streamed.
|
|
14
|
+
*
|
|
15
|
+
* Reading it whole would reintroduce the 2 GiB ceiling this change removes,
|
|
16
|
+
* and the hash is computed for every upload including the ones that then
|
|
17
|
+
* stream happily.
|
|
18
|
+
*/
|
|
19
|
+
export declare function hashFile(filePath: string): Promise<string>;
|
|
20
|
+
export declare function uploadFile(filePath: string, t: UploadTarget, destPath: string, kind: string, token: string, remote: string): Promise<UploadResult>;
|
|
21
|
+
export type { SignedOperation };
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// `dreamlake upload` — authorize against dreamlake-server, then put the bytes
|
|
2
|
+
// straight into S3.
|
|
3
|
+
//
|
|
4
|
+
// This replaces the 7-phase BSS handshake (init / parts / PUT / complete, then
|
|
5
|
+
// a registration in BSS, then one in dreamlake-server). BSS is going away, and
|
|
6
|
+
// with it the second registration: the node now records `metadata.s3Key`, so
|
|
7
|
+
// reading or deleting a file no longer resolves an id through another service.
|
|
8
|
+
//
|
|
9
|
+
// ## Resume is the part that had to survive
|
|
10
|
+
//
|
|
11
|
+
// The old flow kept `{uploadId, key}` under `~/.dreamlake/uploads/<hash>.json`
|
|
12
|
+
// and, on re-run, asked BSS which parts had landed so it could send only the
|
|
13
|
+
// rest. Removing BSS is an internal refactor; it must not cost a user the
|
|
14
|
+
// ability to finish a multi-gigabyte upload that was interrupted. So the state
|
|
15
|
+
// file stays, and `POST .../upload-authorizations/resume` answers what
|
|
16
|
+
// `/files/upload/multipart/parts-done` used to.
|
|
17
|
+
//
|
|
18
|
+
// Two differences from the old record, both deliberate:
|
|
19
|
+
//
|
|
20
|
+
// - it stores `{objectKey, uploadId, size}` and nothing about parts. Which
|
|
21
|
+
// parts exist is STORAGE's answer, not ours: a part can fail after we noted
|
|
22
|
+
// it, or succeed after we gave up, and a local list that disagrees would
|
|
23
|
+
// complete the upload naming parts storage does not have. The old flow
|
|
24
|
+
// asked BSS for the same reason — it saved parts, then ignored them.
|
|
25
|
+
// - the hash is the full sha256, not its first 16 characters. The authorize
|
|
26
|
+
// endpoint refuses anything else: the hash is the only client-controlled
|
|
27
|
+
// part of the object key, so a loose one escapes the project's prefix.
|
|
28
|
+
//
|
|
29
|
+
// A file interrupted under the BSS-era CLI cannot be picked up here — that
|
|
30
|
+
// record names a BSS upload id under a different key. Those restart once.
|
|
31
|
+
//
|
|
32
|
+
// ## The bytes are never buffered whole
|
|
33
|
+
//
|
|
34
|
+
// `executePresignedBatch` streams each range off one open handle, which is also
|
|
35
|
+
// what lifts the old 2 GiB ceiling: the previous implementation did
|
|
36
|
+
// `readFileSync`, so a file past Buffer's cap could not be uploaded at all.
|
|
37
|
+
import { createHash } from "node:crypto";
|
|
38
|
+
import { createReadStream, existsSync, mkdirSync, rmSync, readFileSync, writeFileSync } from "node:fs";
|
|
39
|
+
import { stat } from "node:fs/promises";
|
|
40
|
+
import { homedir } from "node:os";
|
|
41
|
+
import path from "node:path";
|
|
42
|
+
import { HttpError, requestJson } from "../client.js";
|
|
43
|
+
import { assertPresignedTransfer, executePresignedBatch, } from "../compat/presignedTransfer.js";
|
|
44
|
+
import { humanSize } from "../helpers.js";
|
|
45
|
+
import { PartsProgress } from "../progress.js";
|
|
46
|
+
import { MIME_MAP, extOf } from "./kinds.js";
|
|
47
|
+
/**
|
|
48
|
+
* Parts in flight within one file.
|
|
49
|
+
*
|
|
50
|
+
* Carried over from the BSS uploader's `MAX_WORKERS`. The executor defaults to
|
|
51
|
+
* sequential, which would quarter the throughput of every large upload — a
|
|
52
|
+
* regression users would feel even though nothing about the feature changed.
|
|
53
|
+
*/
|
|
54
|
+
const PART_CONCURRENCY = 4;
|
|
55
|
+
// ─── resume state on disk ────────────────────────────────────────────
|
|
56
|
+
function statePath(hash) {
|
|
57
|
+
const dir = path.join(homedir(), ".dreamlake", "uploads");
|
|
58
|
+
mkdirSync(dir, { recursive: true });
|
|
59
|
+
return path.join(dir, `${hash}.json`);
|
|
60
|
+
}
|
|
61
|
+
function saveState(hash, state) {
|
|
62
|
+
writeFileSync(statePath(hash), JSON.stringify(state));
|
|
63
|
+
}
|
|
64
|
+
function loadState(hash) {
|
|
65
|
+
const p = statePath(hash);
|
|
66
|
+
if (!existsSync(p))
|
|
67
|
+
return null;
|
|
68
|
+
try {
|
|
69
|
+
const raw = JSON.parse(readFileSync(p, "utf8"));
|
|
70
|
+
// A record written by the BSS-era CLI has `key`/`totalParts` and no
|
|
71
|
+
// `objectKey`. Reading it as ours would send a BSS upload id to S3; it is
|
|
72
|
+
// simply not a resumable upload any more, so it is dropped.
|
|
73
|
+
if (typeof raw?.objectKey !== "string" ||
|
|
74
|
+
typeof raw?.uploadId !== "string" ||
|
|
75
|
+
typeof raw?.size !== "number") {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
return { objectKey: raw.objectKey, uploadId: raw.uploadId, size: raw.size };
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function clearState(hash) {
|
|
85
|
+
const p = statePath(hash);
|
|
86
|
+
if (existsSync(p))
|
|
87
|
+
rmSync(p);
|
|
88
|
+
}
|
|
89
|
+
// ─── hashing ─────────────────────────────────────────────────────────
|
|
90
|
+
/**
|
|
91
|
+
* sha256 of the file, streamed.
|
|
92
|
+
*
|
|
93
|
+
* Reading it whole would reintroduce the 2 GiB ceiling this change removes,
|
|
94
|
+
* and the hash is computed for every upload including the ones that then
|
|
95
|
+
* stream happily.
|
|
96
|
+
*/
|
|
97
|
+
export async function hashFile(filePath) {
|
|
98
|
+
const h = createHash("sha256");
|
|
99
|
+
await new Promise((resolve, reject) => {
|
|
100
|
+
const s = createReadStream(filePath);
|
|
101
|
+
s.on("data", (c) => h.update(c));
|
|
102
|
+
s.on("error", reject);
|
|
103
|
+
s.on("end", () => resolve());
|
|
104
|
+
});
|
|
105
|
+
return h.digest("hex");
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A resume answer, rebuilt into the transfer shape the executor already knows.
|
|
109
|
+
*
|
|
110
|
+
* The two endpoints deliberately differ: authorize nests the plan under
|
|
111
|
+
* `transfer`, resume returns it flat alongside the parts already stored. Rather
|
|
112
|
+
* than teach the executor a second shape, the flat one is folded into the first
|
|
113
|
+
* here — and then validated by exactly the same function, with the stored part
|
|
114
|
+
* numbers supplied so the coverage check spans the union.
|
|
115
|
+
*/
|
|
116
|
+
function transferFromResume(body, size) {
|
|
117
|
+
const completedRaw = Array.isArray(body.completed) ? body.completed : [];
|
|
118
|
+
const completedParts = completedRaw.map((p, i) => {
|
|
119
|
+
const entry = p;
|
|
120
|
+
if (typeof entry?.partNumber !== "number" || typeof entry?.etag !== "string" || !entry.etag) {
|
|
121
|
+
throw new Error(`resume: completed[${i}] is missing a partNumber or an ETag`);
|
|
122
|
+
}
|
|
123
|
+
return { partNumber: entry.partNumber, etag: entry.etag };
|
|
124
|
+
});
|
|
125
|
+
const candidate = {
|
|
126
|
+
kind: "s3-multipart",
|
|
127
|
+
uploadId: body.uploadId,
|
|
128
|
+
partSize: body.partSize,
|
|
129
|
+
parts: body.parts,
|
|
130
|
+
complete: body.complete,
|
|
131
|
+
abort: body.abort,
|
|
132
|
+
};
|
|
133
|
+
const transfer = assertPresignedTransfer(candidate, size, "resume", undefined, completedParts.map((p) => p.partNumber));
|
|
134
|
+
return { transfer, completedParts };
|
|
135
|
+
}
|
|
136
|
+
/** Ask the server to pick up a recorded upload. `null` → start fresh. */
|
|
137
|
+
async function tryResume(remote, token, t, state, size) {
|
|
138
|
+
try {
|
|
139
|
+
const body = await requestJson(remote, `/namespaces/${encodeURIComponent(t.namespace)}` +
|
|
140
|
+
`/projects/${encodeURIComponent(t.project)}/upload-authorizations/resume`, { method: "POST", token, json: { objectKey: state.objectKey, uploadId: state.uploadId, size } });
|
|
141
|
+
return transferFromResume(body, size);
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
/*
|
|
145
|
+
* A resume that cannot be honoured is not a failure of the upload.
|
|
146
|
+
*
|
|
147
|
+
* 404 — the upload completed, was aborted, or the bucket's lifecycle rule
|
|
148
|
+
* swept it; 409 — what is stored describes a different partitioning of the
|
|
149
|
+
* file, usually because the file changed since the record was written.
|
|
150
|
+
* Both mean "start over", which is something this function can just do.
|
|
151
|
+
* Anything else is a real error and is left to the caller.
|
|
152
|
+
*/
|
|
153
|
+
if (err instanceof HttpError && (err.status === 404 || err.status === 409))
|
|
154
|
+
return null;
|
|
155
|
+
throw err;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// ─── the upload ──────────────────────────────────────────────────────
|
|
159
|
+
export async function uploadFile(filePath, t, destPath, kind, token, remote) {
|
|
160
|
+
const filename = path.basename(filePath);
|
|
161
|
+
const contentType = MIME_MAP[extOf(filename)] ?? "application/octet-stream";
|
|
162
|
+
const fullName = `/${destPath}/${filename}`.replace(/\/+/g, "/");
|
|
163
|
+
const fileSize = (await stat(filePath)).size;
|
|
164
|
+
const hash = await hashFile(filePath);
|
|
165
|
+
process.stdout.write(` size: ${humanSize(fileSize)}\n`);
|
|
166
|
+
let objectKey;
|
|
167
|
+
let transfer;
|
|
168
|
+
let completedParts = [];
|
|
169
|
+
const prior = loadState(hash);
|
|
170
|
+
const resumed = prior && prior.size === fileSize ? await tryResume(remote, token, t, prior, fileSize) : null;
|
|
171
|
+
if (resumed && prior) {
|
|
172
|
+
objectKey = prior.objectKey;
|
|
173
|
+
transfer = resumed.transfer;
|
|
174
|
+
completedParts = resumed.completedParts;
|
|
175
|
+
const total = completedParts.length + (transfer.kind === "s3-multipart" ? transfer.parts.length : 0);
|
|
176
|
+
process.stdout.write(` resuming: ${completedParts.length}/${total} done, ` +
|
|
177
|
+
`${total - completedParts.length} remaining\n`);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
if (prior)
|
|
181
|
+
clearState(hash);
|
|
182
|
+
const auth = await requestJson(remote, `/namespaces/${encodeURIComponent(t.namespace)}` +
|
|
183
|
+
`/projects/${encodeURIComponent(t.project)}/upload-authorizations`, {
|
|
184
|
+
method: "POST",
|
|
185
|
+
token,
|
|
186
|
+
json: { files: [{ name: fullName, size: fileSize, hash, mediaType: contentType }] },
|
|
187
|
+
});
|
|
188
|
+
const object = auth.objects?.[0];
|
|
189
|
+
// An empty `objects` would otherwise read as "nothing to upload", and the
|
|
190
|
+
// node would be registered for bytes that were never sent.
|
|
191
|
+
if (!object || typeof object.objectKey !== "string") {
|
|
192
|
+
throw new Error("the server authorized no upload for this file");
|
|
193
|
+
}
|
|
194
|
+
objectKey = object.objectKey;
|
|
195
|
+
transfer = assertPresignedTransfer(object.transfer, fileSize, "upload");
|
|
196
|
+
// Recorded BEFORE a byte moves. A crash during the first part still leaves
|
|
197
|
+
// something to resume from; recording after would lose the whole upload.
|
|
198
|
+
if (transfer.kind === "s3-multipart") {
|
|
199
|
+
saveState(hash, { objectKey, uploadId: transfer.uploadId, size: fileSize });
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const totalParts = transfer.kind === "s3-multipart" ? transfer.parts.length + completedParts.length : 1;
|
|
203
|
+
if (transfer.kind === "s3-multipart") {
|
|
204
|
+
process.stdout.write(` parts: ${totalParts} x ${transfer.partSize / 1024 / 1024} MB\n`);
|
|
205
|
+
}
|
|
206
|
+
const file = {
|
|
207
|
+
relativePath: fullName,
|
|
208
|
+
size: fileSize,
|
|
209
|
+
transfer,
|
|
210
|
+
...(completedParts.length > 0 ? { completedParts } : {}),
|
|
211
|
+
};
|
|
212
|
+
const progress = new PartsProgress(totalParts, "uploading");
|
|
213
|
+
progress.advance(completedParts.length);
|
|
214
|
+
try {
|
|
215
|
+
await executePresignedBatch([file], {
|
|
216
|
+
localPath: () => filePath,
|
|
217
|
+
partConcurrency: PART_CONCURRENCY,
|
|
218
|
+
// The parts already sent are what the next run skips. Aborting here would
|
|
219
|
+
// turn every interruption into a restart from zero — the exact capability
|
|
220
|
+
// the resume endpoint exists to keep.
|
|
221
|
+
onFailure: "keep",
|
|
222
|
+
onPartDone: () => progress.advance(),
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
catch (err) {
|
|
226
|
+
progress.done_();
|
|
227
|
+
throw new Error(`${err.message} — upload paused, re-run to resume`);
|
|
228
|
+
}
|
|
229
|
+
progress.done_();
|
|
230
|
+
clearState(hash);
|
|
231
|
+
const nodeBody = {
|
|
232
|
+
namespace: t.namespace,
|
|
233
|
+
kind,
|
|
234
|
+
name: fullName,
|
|
235
|
+
project: t.project,
|
|
236
|
+
metadata: { s3Key: objectKey, hash, size: fileSize, contentType },
|
|
237
|
+
};
|
|
238
|
+
if (t.episode)
|
|
239
|
+
nodeBody.episode = t.episode;
|
|
240
|
+
// Last, as on every other upload surface: a batch abandoned halfway leaves no
|
|
241
|
+
// row claiming a file that was never stored.
|
|
242
|
+
const node = await requestJson(remote, "/nodes", {
|
|
243
|
+
method: "POST",
|
|
244
|
+
token,
|
|
245
|
+
json: nodeBody,
|
|
246
|
+
});
|
|
247
|
+
return { nodeId: node.id ?? null, objectKey };
|
|
248
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function affectedPageOptions(limit: unknown, after?: unknown): {
|
|
2
|
+
cursor?: string | undefined;
|
|
3
|
+
limit: number;
|
|
4
|
+
} | undefined;
|
|
5
|
+
export declare function affectedView(value: any, prefix: string, keyRef: string): {
|
|
6
|
+
observedAt: any;
|
|
7
|
+
contextFingerprint: any;
|
|
8
|
+
schemaVersion: number;
|
|
9
|
+
consistency: string;
|
|
10
|
+
includesRetired: boolean;
|
|
11
|
+
comparison: string;
|
|
12
|
+
blockedReason: any;
|
|
13
|
+
entries: any;
|
|
14
|
+
nextCursor: any;
|
|
15
|
+
};
|