@dreamlake/dreamlake-cli 0.104.6 → 0.104.8
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/content.d.ts +10 -3
- package/dist/api/content.js +1 -0
- package/dist/api/index.d.ts +18 -6
- package/dist/api/workspace.d.ts +3 -2
- package/dist/api/workspace.js +7 -6
- package/dist/cli/artifact/index.js +9 -5
- package/dist/cli/artifact/rename.d.ts +9 -0
- package/dist/cli/artifact/rename.js +45 -0
- package/dist/cli/help-examples.generated.js +2 -1
- package/dist/cli/share.js +9 -5
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +9 -9
package/dist/api/content.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { type VersionedContentStore } from "./storage.js";
|
|
2
2
|
import { type Transport } from "./client.js";
|
|
3
3
|
import { type JsonObject, type Query } from "./common.js";
|
|
4
|
+
import { type ArtifactVisibility } from "./workspace.js";
|
|
4
5
|
export declare function artifactsApi(t: Transport, namespace: string): {
|
|
5
6
|
publish: (id: string, input: {
|
|
6
7
|
content: Uint8Array;
|
|
7
8
|
title: string;
|
|
8
9
|
kind: string;
|
|
9
10
|
description?: string;
|
|
10
|
-
visibility?:
|
|
11
|
+
visibility?: ArtifactVisibility;
|
|
11
12
|
share?: boolean;
|
|
12
13
|
}, store: VersionedContentStore) => Promise<{
|
|
13
14
|
version: number;
|
|
@@ -17,13 +18,19 @@ export declare function artifactsApi(t: Transport, namespace: string): {
|
|
|
17
18
|
deleted?: boolean;
|
|
18
19
|
}) => Promise<unknown>;
|
|
19
20
|
get: (id: string) => Promise<unknown>;
|
|
21
|
+
rename: (id: string, input: {
|
|
22
|
+
slug: string;
|
|
23
|
+
expectedResourceId: string;
|
|
24
|
+
expectedSlug: string;
|
|
25
|
+
expectedRevision: number;
|
|
26
|
+
}) => Promise<unknown>;
|
|
20
27
|
uploadCredentials: (artifactId: string) => Promise<unknown>;
|
|
21
28
|
register: (id: string, input: {
|
|
22
29
|
kind: string;
|
|
23
30
|
version: number;
|
|
24
31
|
title?: string;
|
|
25
32
|
description?: string;
|
|
26
|
-
visibility?:
|
|
33
|
+
visibility?: ArtifactVisibility;
|
|
27
34
|
share?: boolean;
|
|
28
35
|
}) => Promise<unknown>;
|
|
29
36
|
delete: (id: string, permanent?: boolean) => Promise<unknown>;
|
|
@@ -36,7 +43,7 @@ export declare function artifactsApi(t: Transport, namespace: string): {
|
|
|
36
43
|
get: () => Promise<Record<string, unknown>>;
|
|
37
44
|
create: (role?: "read" | "write") => Promise<unknown>;
|
|
38
45
|
revoke: (revokeAccepted?: boolean) => Promise<unknown>;
|
|
39
|
-
visibility: (visibility:
|
|
46
|
+
visibility: (visibility: ArtifactVisibility) => Promise<unknown>;
|
|
40
47
|
access: () => Promise<unknown>;
|
|
41
48
|
remove: (userId: string) => Promise<unknown>;
|
|
42
49
|
};
|
package/dist/api/content.js
CHANGED
|
@@ -23,6 +23,7 @@ export function artifactsApi(t, namespace) {
|
|
|
23
23
|
}),
|
|
24
24
|
list: (query = {}) => call(t, "GET", base, undefined, query),
|
|
25
25
|
get: (id) => call(t, "GET", path(id)),
|
|
26
|
+
rename: (id, input) => call(t, "PATCH", path(id) + "/slug", input),
|
|
26
27
|
uploadCredentials: (artifactId) => call(t, "POST", base + "/upload-credentials", { artifactId }),
|
|
27
28
|
register: (id, input) => call(t, "POST", path(id), input),
|
|
28
29
|
delete: (id, permanent = false) => call(t, "DELETE", path(id) + (permanent ? "/purge" : "")),
|
package/dist/api/index.d.ts
CHANGED
|
@@ -763,7 +763,7 @@ export declare function createApi(transport: Transport): {
|
|
|
763
763
|
title: string;
|
|
764
764
|
kind: string;
|
|
765
765
|
description?: string;
|
|
766
|
-
visibility?: "
|
|
766
|
+
visibility?: import("./workspace.js").ArtifactVisibility;
|
|
767
767
|
share?: boolean;
|
|
768
768
|
}, store: import("./storage.js").VersionedContentStore) => Promise<{
|
|
769
769
|
version: number;
|
|
@@ -773,13 +773,19 @@ export declare function createApi(transport: Transport): {
|
|
|
773
773
|
deleted?: boolean;
|
|
774
774
|
}) => Promise<unknown>;
|
|
775
775
|
get: (id: string) => Promise<unknown>;
|
|
776
|
+
rename: (id: string, input: {
|
|
777
|
+
slug: string;
|
|
778
|
+
expectedResourceId: string;
|
|
779
|
+
expectedSlug: string;
|
|
780
|
+
expectedRevision: number;
|
|
781
|
+
}) => Promise<unknown>;
|
|
776
782
|
uploadCredentials: (artifactId: string) => Promise<unknown>;
|
|
777
783
|
register: (id: string, input: {
|
|
778
784
|
kind: string;
|
|
779
785
|
version: number;
|
|
780
786
|
title?: string;
|
|
781
787
|
description?: string;
|
|
782
|
-
visibility?:
|
|
788
|
+
visibility?: import("./workspace.js").ArtifactVisibility;
|
|
783
789
|
share?: boolean;
|
|
784
790
|
}) => Promise<unknown>;
|
|
785
791
|
delete: (id: string, permanent?: boolean) => Promise<unknown>;
|
|
@@ -792,7 +798,7 @@ export declare function createApi(transport: Transport): {
|
|
|
792
798
|
get: () => Promise<Record<string, unknown>>;
|
|
793
799
|
create: (role?: "read" | "write") => Promise<unknown>;
|
|
794
800
|
revoke: (revokeAccepted?: boolean) => Promise<unknown>;
|
|
795
|
-
visibility: (visibility: "
|
|
801
|
+
visibility: (visibility: import("./workspace.js").ArtifactVisibility) => Promise<unknown>;
|
|
796
802
|
access: () => Promise<unknown>;
|
|
797
803
|
remove: (userId: string) => Promise<unknown>;
|
|
798
804
|
};
|
|
@@ -1848,7 +1854,7 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1848
1854
|
title: string;
|
|
1849
1855
|
kind: string;
|
|
1850
1856
|
description?: string;
|
|
1851
|
-
visibility?: "
|
|
1857
|
+
visibility?: import("./workspace.js").ArtifactVisibility;
|
|
1852
1858
|
share?: boolean;
|
|
1853
1859
|
}, store: import("./storage.js").VersionedContentStore) => Promise<{
|
|
1854
1860
|
version: number;
|
|
@@ -1858,13 +1864,19 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1858
1864
|
deleted?: boolean;
|
|
1859
1865
|
}) => Promise<unknown>;
|
|
1860
1866
|
get: (id: string) => Promise<unknown>;
|
|
1867
|
+
rename: (id: string, input: {
|
|
1868
|
+
slug: string;
|
|
1869
|
+
expectedResourceId: string;
|
|
1870
|
+
expectedSlug: string;
|
|
1871
|
+
expectedRevision: number;
|
|
1872
|
+
}) => Promise<unknown>;
|
|
1861
1873
|
uploadCredentials: (artifactId: string) => Promise<unknown>;
|
|
1862
1874
|
register: (id: string, input: {
|
|
1863
1875
|
kind: string;
|
|
1864
1876
|
version: number;
|
|
1865
1877
|
title?: string;
|
|
1866
1878
|
description?: string;
|
|
1867
|
-
visibility?:
|
|
1879
|
+
visibility?: import("./workspace.js").ArtifactVisibility;
|
|
1868
1880
|
share?: boolean;
|
|
1869
1881
|
}) => Promise<unknown>;
|
|
1870
1882
|
delete: (id: string, permanent?: boolean) => Promise<unknown>;
|
|
@@ -1877,7 +1889,7 @@ export declare function createClient(options: ClientOptions): {
|
|
|
1877
1889
|
get: () => Promise<Record<string, unknown>>;
|
|
1878
1890
|
create: (role?: "read" | "write") => Promise<unknown>;
|
|
1879
1891
|
revoke: (revokeAccepted?: boolean) => Promise<unknown>;
|
|
1880
|
-
visibility: (visibility: "
|
|
1892
|
+
visibility: (visibility: import("./workspace.js").ArtifactVisibility) => Promise<unknown>;
|
|
1881
1893
|
access: () => Promise<unknown>;
|
|
1882
1894
|
remove: (userId: string) => Promise<unknown>;
|
|
1883
1895
|
};
|
package/dist/api/workspace.d.ts
CHANGED
|
@@ -209,11 +209,12 @@ export declare function connectionsApi(t: Transport, namespace: string): {
|
|
|
209
209
|
disable: (id: string, expectedSettingsRevision: number, key: string) => Promise<unknown>;
|
|
210
210
|
delete: (id: string, expectedSettingsRevision: number, key: string) => Promise<unknown>;
|
|
211
211
|
};
|
|
212
|
-
export
|
|
212
|
+
export type ArtifactVisibility = "private" | "public" | "unlisted";
|
|
213
|
+
export declare function sharingApi<K extends "notes" | "artifacts">(t: Transport, namespace: string, kind: K, id: string): {
|
|
213
214
|
get: () => Promise<Record<string, unknown>>;
|
|
214
215
|
create: (role?: "read" | "write") => Promise<unknown>;
|
|
215
216
|
revoke: (revokeAccepted?: boolean) => Promise<unknown>;
|
|
216
|
-
visibility: (visibility: "private" | "public" | "team") => Promise<unknown>;
|
|
217
|
+
visibility: (visibility: K extends "artifacts" ? ArtifactVisibility : "private" | "public" | "team") => Promise<unknown>;
|
|
217
218
|
access: () => Promise<unknown>;
|
|
218
219
|
remove: (userId: string) => Promise<unknown>;
|
|
219
220
|
};
|
package/dist/api/workspace.js
CHANGED
|
@@ -134,20 +134,21 @@ export function sharingApi(t, namespace, kind, id) {
|
|
|
134
134
|
const permissions = row.permissions;
|
|
135
135
|
if ((kind === "notes" ? permissions?.share : row.viewerCanManage) !== true)
|
|
136
136
|
throw new Error("not allowed to manage sharing for this resource");
|
|
137
|
-
return operation(
|
|
137
|
+
return operation(kind === "artifacts" && typeof row.artifactId === "string"
|
|
138
|
+
? `${namespacePath(namespace)}/artifacts/${seg(row.artifactId)}` : base);
|
|
138
139
|
}
|
|
139
140
|
return {
|
|
140
141
|
get,
|
|
141
|
-
create: (role = "read") => manage(() => kind === "notes"
|
|
142
|
+
create: (role = "read") => manage((base) => kind === "notes"
|
|
142
143
|
? call(t, "PUT", base + "/share", { role })
|
|
143
144
|
: call(t, "POST", base, { share: true })),
|
|
144
|
-
revoke: (revokeAccepted = false) => manage(() => kind === "notes"
|
|
145
|
+
revoke: (revokeAccepted = false) => manage((base) => kind === "notes"
|
|
145
146
|
? call(t, "DELETE", base + "/share", undefined, {
|
|
146
147
|
revokeAccepted: revokeAccepted ? "true" : undefined,
|
|
147
148
|
})
|
|
148
149
|
: call(t, "POST", base, { share: false })),
|
|
149
|
-
visibility: (visibility) => manage(() => call(t, kind === "notes" ? "PATCH" : "POST", base, { visibility })),
|
|
150
|
-
access: () => manage(() => call(t, "GET", base + "/share/access")),
|
|
151
|
-
remove: (userId) => manage(() => call(t, "DELETE", base + "/share/access/" + seg(userId))),
|
|
150
|
+
visibility: (visibility) => manage((base) => call(t, kind === "notes" ? "PATCH" : "POST", base, { visibility })),
|
|
151
|
+
access: () => manage((base) => call(t, "GET", base + "/share/access")),
|
|
152
|
+
remove: (userId) => manage((base) => call(t, "DELETE", base + "/share/access/" + seg(userId))),
|
|
152
153
|
};
|
|
153
154
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registerArtifactRenameCommand } from "./rename.js";
|
|
1
2
|
import { readSiteConfig } from './siteConfig.js';
|
|
2
3
|
import { collectionList } from "../collection-list.js";
|
|
3
4
|
import { registerShareCommands } from "../share.js";
|
|
@@ -125,14 +126,14 @@ export async function runDreamlakeArtifactPush(args, deps = {}) {
|
|
|
125
126
|
`use --kind (${[...KINDS].sort().join(", ")})`);
|
|
126
127
|
return 1;
|
|
127
128
|
}
|
|
128
|
-
if (args.visibility && args.visibility !== "public" && args.visibility !== "private") {
|
|
129
|
-
fail(`--visibility must be public or
|
|
129
|
+
if (args.visibility && args.visibility !== "public" && args.visibility !== "private" && args.visibility !== "unlisted") {
|
|
130
|
+
fail(`--visibility must be public, private or unlisted (got '${args.visibility}')`);
|
|
130
131
|
return 1;
|
|
131
132
|
}
|
|
132
133
|
const defaultTitle = directory
|
|
133
134
|
? path.basename(path.resolve(args.file))
|
|
134
135
|
: path.basename(args.file, path.extname(args.file));
|
|
135
|
-
|
|
136
|
+
let artifactId = args.artifactId ?? slugify(args.title ?? defaultTitle);
|
|
136
137
|
// Read the cover before any network call so a bad file fails fast.
|
|
137
138
|
let coverBytes = null;
|
|
138
139
|
if (args.cover) {
|
|
@@ -187,12 +188,14 @@ export async function runDreamlakeArtifactPush(args, deps = {}) {
|
|
|
187
188
|
}
|
|
188
189
|
// 1) broker: short-lived, prefix-scoped credentials + this artifact's own
|
|
189
190
|
// dataset backend. The content itself never goes through the server.
|
|
190
|
-
const cred = await jsonRequest("POST", `${ctx.remote}/namespaces/${encodeURIComponent(namespace)}/artifacts/upload-credentials`, token, { artifactId });
|
|
191
|
+
const cred = await jsonRequest("POST", `${ctx.remote}/namespaces/${encodeURIComponent(namespace)}/artifacts/upload-credentials`, token, { artifactId, resolveSlug: true });
|
|
191
192
|
if (cred.status < 200 || cred.status >= 300) {
|
|
192
193
|
fail(`could not get upload credentials → ${cred.status}: ${errorMessage(cred)}`);
|
|
193
194
|
return 1;
|
|
194
195
|
}
|
|
195
196
|
const broker = cred.body;
|
|
197
|
+
if (typeof cred.body?.artifactId === "string")
|
|
198
|
+
artifactId = cred.body.artifactId;
|
|
196
199
|
if (!broker?.credentials?.accessKeyId || !broker.backendUrl) {
|
|
197
200
|
fail("unexpected upload-credentials response (missing credentials or backendUrl)");
|
|
198
201
|
return 1;
|
|
@@ -408,6 +411,7 @@ export function registerArtifactCommand(program) {
|
|
|
408
411
|
.command("artifact")
|
|
409
412
|
.description("renderable artifacts (HTML/React/Markdown/SVG/code)");
|
|
410
413
|
registerShareCommands(artifact, "artifact");
|
|
414
|
+
registerArtifactRenameCommand(artifact);
|
|
411
415
|
withConnFlags(artifact
|
|
412
416
|
.command("push")
|
|
413
417
|
.description("push a renderable artifact — a new version of --id (written straight to storage)")
|
|
@@ -420,7 +424,7 @@ export function registerArtifactCommand(program) {
|
|
|
420
424
|
.option("--kind <kind>", "html, react, markdown, svg, code, mermaid (default: auto)")
|
|
421
425
|
.option("--id <artifact-id>", "stable artifact id for versioning (default: slug of title)")
|
|
422
426
|
.option("--namespace <slug>", "namespace (default: active login)")
|
|
423
|
-
.option("--visibility <visibility>", "read visibility: public | private (default: private)")
|
|
427
|
+
.option("--visibility <visibility>", "read visibility: public | private | unlisted (default: private)")
|
|
424
428
|
.option("--incremental", "upload only new compressed chunks (default; requires an updated viewer)", true)
|
|
425
429
|
.option("--full", "upload the entire file in the original single-blob format")
|
|
426
430
|
.addOption(new Option("--no-incremental", "compatibility alias for --full").hideHelp())
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { type DreamlakeOpts } from '../compat/ctx.js';
|
|
3
|
+
export declare function runArtifactRename(args: DreamlakeOpts & {
|
|
4
|
+
artifactId: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
namespace?: string;
|
|
7
|
+
json?: boolean;
|
|
8
|
+
}): Promise<number>;
|
|
9
|
+
export declare function registerArtifactRenameCommand(artifact: Command): void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { emitJson, fail, ok } from '../helpers.js';
|
|
2
|
+
import { resolveCtx } from '../compat/ctx.js';
|
|
3
|
+
import { errorMessage, jsonRequest, requireNamespace, requireToken } from '../compat/http.js';
|
|
4
|
+
import { withConnFlags } from '../compat/flags.js';
|
|
5
|
+
export async function runArtifactRename(args) {
|
|
6
|
+
if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/.test(args.slug)) {
|
|
7
|
+
fail('Invalid slug: use 1–128 letters, digits, dots, underscores or hyphens, starting with a letter or digit.');
|
|
8
|
+
return 1;
|
|
9
|
+
}
|
|
10
|
+
const ctx = resolveCtx(args), token = requireToken(ctx);
|
|
11
|
+
if (!token)
|
|
12
|
+
return 1;
|
|
13
|
+
const namespace = await requireNamespace(ctx, args.namespace);
|
|
14
|
+
if (!namespace)
|
|
15
|
+
return 1;
|
|
16
|
+
const url = `${ctx.remote}/namespaces/${encodeURIComponent(namespace)}/artifacts/${encodeURIComponent(args.artifactId)}`;
|
|
17
|
+
const current = await jsonRequest('GET', url, token);
|
|
18
|
+
if (current.status !== 200) {
|
|
19
|
+
fail(`Could not read artifact → ${current.status}: ${errorMessage(current)}`);
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
const row = current.body;
|
|
23
|
+
if (!row.resourceId || !row.slug || !Number.isSafeInteger(row.slugRevision)) {
|
|
24
|
+
fail('This server does not support native artifact slug rename. No changes made.');
|
|
25
|
+
return 1;
|
|
26
|
+
}
|
|
27
|
+
const response = await jsonRequest('PATCH', `${url}/slug`, token, {
|
|
28
|
+
slug: args.slug, expectedResourceId: row.resourceId, expectedSlug: row.slug, expectedRevision: row.slugRevision,
|
|
29
|
+
});
|
|
30
|
+
if (response.status !== 200) {
|
|
31
|
+
fail(`Rename failed → ${response.status}: ${errorMessage(response)}${response.status === 409 ? '. Re-read the artifact and resolve the conflict before retrying.' : ''}`);
|
|
32
|
+
return 1;
|
|
33
|
+
}
|
|
34
|
+
if (args.json)
|
|
35
|
+
emitJson(response.body);
|
|
36
|
+
else
|
|
37
|
+
ok(`artifact slug: ${args.slug} (existing links and all versions preserved)`);
|
|
38
|
+
return 0;
|
|
39
|
+
}
|
|
40
|
+
export function registerArtifactRenameCommand(artifact) {
|
|
41
|
+
withConnFlags(artifact.command('rename').description('change an artifact URL slug, preserving identity, versions and old links')
|
|
42
|
+
.argument('<artifact-id>', 'current slug, old slug or immutable artifact ID')
|
|
43
|
+
.argument('<slug>', 'new URL slug').option('--namespace <slug>', 'namespace').option('--json', 'JSON output'))
|
|
44
|
+
.action(async (artifactId, slug, opts) => { process.exit(await runArtifactRename({ ...opts, artifactId, slug })); });
|
|
45
|
+
}
|
|
@@ -8,7 +8,8 @@ export const helpExamples = {
|
|
|
8
8
|
"artifact push": "dreamlake artifact push ./dashboard.html --id q1-dashboard\n# Edit the file, then repeat the same command to upload only new chunks.\n\n# Static build with on-demand assets (CLI 0.101.0+; requires site hosting):\ndreamlake artifact push ./dist/client --site --id simulation\n\n# Compatibility with older self-hosted viewers:\ndreamlake artifact push ./dashboard.html --id q1-dashboard --full\n\n# Multiple self-contained HTML pages (requires an updated viewer):\ndreamlake artifact push ./report --entry index.html --id quarterly-report",
|
|
9
9
|
"artifact meta set": "# At push time:\ndreamlake artifact push ./report.html --id q1-dashboard \\\n --description \"Revenue, churn and pipeline for the quarter\" \\\n --cover ./cover.png\n\n# Or after the fact, for an artifact that already exists:\ndreamlake artifact meta set q1-dashboard --description \"Revenue, churn and pipeline\"\ndreamlake artifact meta set q1-dashboard --cover ./cover.png\ndreamlake artifact meta show q1-dashboard\n\n# Back to the automatic description / the generated cover:\ndreamlake artifact meta set q1-dashboard --clear-description --clear-cover",
|
|
10
10
|
"artifact share": "# Find the dashboard you already uploaded; no new version is needed.\ndreamlake artifact list\nARTIFACT=\"q1-dashboard\" # Replace with the id from list.\ndreamlake artifact share get \"$ARTIFACT\"\n\n# Give signed-in recipients read access, then verify the returned link.\ndreamlake artifact share create \"$ARTIFACT\"\ndreamlake artifact share get \"$ARTIFACT\"\n\n# When link access is no longer needed, revoke it and verify.\ndreamlake artifact share revoke \"$ARTIFACT\"\ndreamlake artifact share get \"$ARTIFACT\"",
|
|
11
|
-
"artifact visibility": "ARTIFACT=\"q1-dashboard\" # Your existing artifact id.\ndreamlake artifact visibility \"$ARTIFACT\" public\ndreamlake artifact visibility \"$ARTIFACT\" private",
|
|
11
|
+
"artifact visibility": "ARTIFACT=\"q1-dashboard\" # Your existing artifact id.\ndreamlake artifact visibility \"$ARTIFACT\" public\ndreamlake artifact visibility \"$ARTIFACT\" private\ndreamlake artifact visibility \"$ARTIFACT\" unlisted",
|
|
12
|
+
"artifact rename": "dreamlake artifact rename session-work-map-20261014 session-work-map --namespace my-team",
|
|
12
13
|
"runnable bind": "dreamlake runnable bind udf/acme/recipes.process@FULL_SHA256 \\\n --snapshot CODE_REPO_ID --project recipes \\\n --server \"$LAKESHORE_URL\" --cp-namespace acme --dry-run\ndreamlake runnable bind udf/acme/recipes.process@FULL_SHA256 \\\n --snapshot CODE_REPO_ID --project recipes --server \"$LAKESHORE_URL\" --cp-namespace acme",
|
|
13
14
|
"runnable execute": "dreamlake runnable execute exec/acme/recipes.process@EXECUTION_DIGEST \\\n --queue cpu --inputs record.json --timeout-seconds 600 --json\ndreamlake runnable execute exec/acme/recipes.process@EXECUTION_DIGEST \\\n --queue cpu --inputs record.json --timeout-seconds 600 --attempt 2 --json",
|
|
14
15
|
"runnable execution-receipt": "dreamlake runnable execution-receipt exec/acme/recipes.process@EXECUTION_DIGEST \\\n --queue cpu --inputs record.json --timeout-seconds 600 --wait-seconds 30",
|
package/dist/cli/share.js
CHANGED
|
@@ -10,8 +10,9 @@ export async function runShare(kind, operation, ref, opts) {
|
|
|
10
10
|
fail("--role must be read or write");
|
|
11
11
|
return 1;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const visibilities = kind === "artifact" ? ["private", "public", "unlisted"] : ["private", "public"];
|
|
14
|
+
if (operation === "visibility" && !visibilities.includes(opts.visibility ?? "")) {
|
|
15
|
+
fail(`visibility must be ${visibilities.join(", ")}`);
|
|
15
16
|
return 1;
|
|
16
17
|
}
|
|
17
18
|
const c = resolveCtx(opts);
|
|
@@ -45,6 +46,9 @@ export async function runShare(kind, operation, ref, opts) {
|
|
|
45
46
|
return 1;
|
|
46
47
|
row = await requestJson(c.remote, `/namespaces/${encodeURIComponent(ns)}/artifacts/${encodeURIComponent(id)}`, { token });
|
|
47
48
|
}
|
|
49
|
+
const urlId = kind === "artifact" ? row.slug ?? ref : id;
|
|
50
|
+
if (kind === "artifact" && typeof row.artifactId === "string")
|
|
51
|
+
id = row.artifactId;
|
|
48
52
|
const base = `/namespaces/${encodeURIComponent(ns)}/${kind === "notes" ? "notes" : "artifacts"}/${encodeURIComponent(id)}`;
|
|
49
53
|
const canManage = kind === "notes" ? row.permissions?.share : row.viewerCanManage;
|
|
50
54
|
// The artifact mutation endpoint is an upsert: preflight avoids creating a
|
|
@@ -89,10 +93,10 @@ export async function runShare(kind, operation, ref, opts) {
|
|
|
89
93
|
: { json: { share: operation === "create" } }),
|
|
90
94
|
});
|
|
91
95
|
}
|
|
92
|
-
const url = `${webBase(c.remote)}/${encodeURIComponent(ns)}/${kind === "notes" ? "notes" : "artifacts"}/${encodeURIComponent(
|
|
96
|
+
const url = `${webBase(c.remote)}/${encodeURIComponent(ns)}/${kind === "notes" ? "notes" : "artifacts"}/${encodeURIComponent(urlId)}`;
|
|
93
97
|
const result = {
|
|
94
98
|
url, visibility: row.visibility,
|
|
95
|
-
publicUrl: row.visibility === "public" ? url : null,
|
|
99
|
+
publicUrl: row.visibility === "public" || (kind === "artifact" && row.visibility === "unlisted") ? url : null,
|
|
96
100
|
shareUrl: row.shareToken ? `${url}?share=${encodeURIComponent(row.shareToken)}` : null,
|
|
97
101
|
shareRole: kind === "notes" ? row.shareRole ?? null : row.shareToken ? "read" : null,
|
|
98
102
|
// An omitted token is redacted, not evidence that sharing is disabled.
|
|
@@ -132,7 +136,7 @@ export function registerShareCommands(parent, kind) {
|
|
|
132
136
|
else
|
|
133
137
|
cmd.action(async (ref, opts) => { process.exit(await runShare(kind, operation, ref, opts)); });
|
|
134
138
|
}
|
|
135
|
-
withConnFlags(parent.command("visibility").argument("<resource>").argument("<visibility>", "private or public")
|
|
139
|
+
withConnFlags(parent.command("visibility").argument("<resource>").argument("<visibility>", kind === "artifact" ? "private, public or unlisted" : "private or public")
|
|
136
140
|
.description("set read visibility; does not revoke share links or accepted access")
|
|
137
141
|
.option("--namespace <slug>", "namespace").option("--json", "emit structured JSON"))
|
|
138
142
|
.action(async (ref, visibility, opts) => { process.exit(await runShare(kind, "visibility", ref, { ...opts, visibility })); });
|
package/dist/cli/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.104.
|
|
1
|
+
export declare const VERSION = "0.104.8";
|
package/dist/cli/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreamlake/dreamlake-cli",
|
|
3
|
-
"version": "0.104.
|
|
3
|
+
"version": "0.104.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dreamlake-ai/dreamlake-cli.git"
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"node": ">=18"
|
|
37
37
|
},
|
|
38
38
|
"optionalDependencies": {
|
|
39
|
-
"@dreamlake/dreamlake-cli-darwin-arm64": "0.104.
|
|
40
|
-
"@dreamlake/dreamlake-cli-darwin-x64": "0.104.
|
|
41
|
-
"@dreamlake/dreamlake-cli-linux-x64": "0.104.
|
|
42
|
-
"@dreamlake/dreamlake-cli-linux-arm64": "0.104.
|
|
43
|
-
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.104.
|
|
44
|
-
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.104.
|
|
45
|
-
"@dreamlake/dreamlake-cli-win32-x64": "0.104.
|
|
46
|
-
"@dreamlake/dreamlake-cli-win32-arm64": "0.104.
|
|
39
|
+
"@dreamlake/dreamlake-cli-darwin-arm64": "0.104.8",
|
|
40
|
+
"@dreamlake/dreamlake-cli-darwin-x64": "0.104.8",
|
|
41
|
+
"@dreamlake/dreamlake-cli-linux-x64": "0.104.8",
|
|
42
|
+
"@dreamlake/dreamlake-cli-linux-arm64": "0.104.8",
|
|
43
|
+
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.104.8",
|
|
44
|
+
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.104.8",
|
|
45
|
+
"@dreamlake/dreamlake-cli-win32-x64": "0.104.8",
|
|
46
|
+
"@dreamlake/dreamlake-cli-win32-arm64": "0.104.8"
|
|
47
47
|
}
|
|
48
48
|
}
|