@dreamlake/dreamlake-cli 0.104.7 → 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.
@@ -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?: "private" | "public";
11
+ visibility?: ArtifactVisibility;
11
12
  share?: boolean;
12
13
  }, store: VersionedContentStore) => Promise<{
13
14
  version: number;
@@ -29,7 +30,7 @@ export declare function artifactsApi(t: Transport, namespace: string): {
29
30
  version: number;
30
31
  title?: string;
31
32
  description?: string;
32
- visibility?: string;
33
+ visibility?: ArtifactVisibility;
33
34
  share?: boolean;
34
35
  }) => Promise<unknown>;
35
36
  delete: (id: string, permanent?: boolean) => Promise<unknown>;
@@ -42,7 +43,7 @@ export declare function artifactsApi(t: Transport, namespace: string): {
42
43
  get: () => Promise<Record<string, unknown>>;
43
44
  create: (role?: "read" | "write") => Promise<unknown>;
44
45
  revoke: (revokeAccepted?: boolean) => Promise<unknown>;
45
- visibility: (visibility: "private" | "public" | "team") => Promise<unknown>;
46
+ visibility: (visibility: ArtifactVisibility) => Promise<unknown>;
46
47
  access: () => Promise<unknown>;
47
48
  remove: (userId: string) => Promise<unknown>;
48
49
  };
@@ -763,7 +763,7 @@ export declare function createApi(transport: Transport): {
763
763
  title: string;
764
764
  kind: string;
765
765
  description?: string;
766
- visibility?: "private" | "public";
766
+ visibility?: import("./workspace.js").ArtifactVisibility;
767
767
  share?: boolean;
768
768
  }, store: import("./storage.js").VersionedContentStore) => Promise<{
769
769
  version: number;
@@ -785,7 +785,7 @@ export declare function createApi(transport: Transport): {
785
785
  version: number;
786
786
  title?: string;
787
787
  description?: string;
788
- visibility?: string;
788
+ visibility?: import("./workspace.js").ArtifactVisibility;
789
789
  share?: boolean;
790
790
  }) => Promise<unknown>;
791
791
  delete: (id: string, permanent?: boolean) => Promise<unknown>;
@@ -798,7 +798,7 @@ export declare function createApi(transport: Transport): {
798
798
  get: () => Promise<Record<string, unknown>>;
799
799
  create: (role?: "read" | "write") => Promise<unknown>;
800
800
  revoke: (revokeAccepted?: boolean) => Promise<unknown>;
801
- visibility: (visibility: "private" | "public" | "team") => Promise<unknown>;
801
+ visibility: (visibility: import("./workspace.js").ArtifactVisibility) => Promise<unknown>;
802
802
  access: () => Promise<unknown>;
803
803
  remove: (userId: string) => Promise<unknown>;
804
804
  };
@@ -1854,7 +1854,7 @@ export declare function createClient(options: ClientOptions): {
1854
1854
  title: string;
1855
1855
  kind: string;
1856
1856
  description?: string;
1857
- visibility?: "private" | "public";
1857
+ visibility?: import("./workspace.js").ArtifactVisibility;
1858
1858
  share?: boolean;
1859
1859
  }, store: import("./storage.js").VersionedContentStore) => Promise<{
1860
1860
  version: number;
@@ -1876,7 +1876,7 @@ export declare function createClient(options: ClientOptions): {
1876
1876
  version: number;
1877
1877
  title?: string;
1878
1878
  description?: string;
1879
- visibility?: string;
1879
+ visibility?: import("./workspace.js").ArtifactVisibility;
1880
1880
  share?: boolean;
1881
1881
  }) => Promise<unknown>;
1882
1882
  delete: (id: string, permanent?: boolean) => Promise<unknown>;
@@ -1889,7 +1889,7 @@ export declare function createClient(options: ClientOptions): {
1889
1889
  get: () => Promise<Record<string, unknown>>;
1890
1890
  create: (role?: "read" | "write") => Promise<unknown>;
1891
1891
  revoke: (revokeAccepted?: boolean) => Promise<unknown>;
1892
- visibility: (visibility: "private" | "public" | "team") => Promise<unknown>;
1892
+ visibility: (visibility: import("./workspace.js").ArtifactVisibility) => Promise<unknown>;
1893
1893
  access: () => Promise<unknown>;
1894
1894
  remove: (userId: string) => Promise<unknown>;
1895
1895
  };
@@ -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 declare function sharingApi(t: Transport, namespace: string, kind: "notes" | "artifacts", id: string): {
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
  };
@@ -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
  }
@@ -126,8 +126,8 @@ export async function runDreamlakeArtifactPush(args, deps = {}) {
126
126
  `use --kind (${[...KINDS].sort().join(", ")})`);
127
127
  return 1;
128
128
  }
129
- if (args.visibility && args.visibility !== "public" && args.visibility !== "private") {
130
- fail(`--visibility must be public or private (got '${args.visibility}')`);
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}')`);
131
131
  return 1;
132
132
  }
133
133
  const defaultTitle = directory
@@ -424,7 +424,7 @@ export function registerArtifactCommand(program) {
424
424
  .option("--kind <kind>", "html, react, markdown, svg, code, mermaid (default: auto)")
425
425
  .option("--id <artifact-id>", "stable artifact id for versioning (default: slug of title)")
426
426
  .option("--namespace <slug>", "namespace (default: active login)")
427
- .option("--visibility <visibility>", "read visibility: public | private (default: private)")
427
+ .option("--visibility <visibility>", "read visibility: public | private | unlisted (default: private)")
428
428
  .option("--incremental", "upload only new compressed chunks (default; requires an updated viewer)", true)
429
429
  .option("--full", "upload the entire file in the original single-blob format")
430
430
  .addOption(new Option("--no-incremental", "compatibility alias for --full").hideHelp())
@@ -8,7 +8,7 @@ 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
12
  "artifact rename": "dreamlake artifact rename session-work-map-20261014 session-work-map --namespace my-team",
13
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",
14
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",
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
- if (operation === "visibility" && !["private", "public"].includes(opts.visibility ?? "")) {
14
- fail("visibility must be private or public");
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(id)}`;
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 })); });
@@ -1 +1 @@
1
- export declare const VERSION = "0.104.7";
1
+ export declare const VERSION = "0.104.8";
@@ -6,4 +6,4 @@
6
6
  // value means a binary that re-installs the same version forever.
7
7
  //
8
8
  // Editing this by hand does nothing for a release; bump package.json.
9
- export const VERSION = "0.104.7";
9
+ export const VERSION = "0.104.8";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamlake/dreamlake-cli",
3
- "version": "0.104.7",
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.7",
40
- "@dreamlake/dreamlake-cli-darwin-x64": "0.104.7",
41
- "@dreamlake/dreamlake-cli-linux-x64": "0.104.7",
42
- "@dreamlake/dreamlake-cli-linux-arm64": "0.104.7",
43
- "@dreamlake/dreamlake-cli-linux-x64-musl": "0.104.7",
44
- "@dreamlake/dreamlake-cli-linux-arm64-musl": "0.104.7",
45
- "@dreamlake/dreamlake-cli-win32-x64": "0.104.7",
46
- "@dreamlake/dreamlake-cli-win32-arm64": "0.104.7"
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
  }