@picked/cli 0.0.85-next.4 → 0.0.85-next.5

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/cjs/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const e=require("../workspace-use-CT6_jewh.cjs");let t=require("@picked/config"),n=require("node:util"),r=require("@picked/telemetry");var i=2e3,a=null,o=0;function s(e){if((0,t.isTelemetryForcedOffByEnvironment)())return;o=Date.now();let n=(0,t.detectHostEnvironment)();a={name:`picked.cli.${e}`,traceId:(0,r.createTraceId)(),spanId:(0,r.createSpanId)(),startTimeUnixNano:(0,r.toUnixNano)(o),endTimeUnixNano:(0,r.toUnixNano)(o),attributes:{"picked.cli.command":e,"picked.env.provider":n.provider,"picked.env.ci":n.ci},status:`unset`}}function c(e){a&&(a.endTimeUnixNano=(0,r.toUnixNano)(Date.now()),a.status=e===0?`ok`:`error`)}async function l(){let e=a;if(a=null,e)try{let n=await(0,t.loadResolvedPickedConfig)();if(!n||!(0,t.isTelemetryEnabled)(n))return;let a=(0,r.createTelemetryEmitter)({resource:{"service.name":`picked-cli`},headers:{"Picked-Telemetry":`cli`}});a.record(e),await Promise.race([a.flush(),new Promise(e=>{setTimeout(e,i).unref()})])}catch{}}var u=`Usage:
2
+ const e=require("../workspace-use-Cjn8sjJj.cjs");let t=require("@picked/config"),n=require("node:util"),r=require("@picked/telemetry");var i=2e3,a=null,o=0;function s(e){if((0,t.isTelemetryForcedOffByEnvironment)())return;o=Date.now();let n=(0,t.detectHostEnvironment)();a={name:`picked.cli.${e}`,traceId:(0,r.createTraceId)(),spanId:(0,r.createSpanId)(),startTimeUnixNano:(0,r.toUnixNano)(o),endTimeUnixNano:(0,r.toUnixNano)(o),attributes:{"picked.cli.command":e,"picked.env.provider":n.provider,"picked.env.ci":n.ci},status:`unset`}}function c(e){a&&(a.endTimeUnixNano=(0,r.toUnixNano)(Date.now()),a.status=e===0?`ok`:`error`)}async function l(){let e=a;if(a=null,e)try{let n=await(0,t.loadResolvedPickedConfig)();if(!n||!(0,t.isTelemetryEnabled)(n))return;let a=(0,r.createTelemetryEmitter)({resource:{"service.name":`picked-cli`},headers:{"Picked-Telemetry":`cli`}});a.record(e),await Promise.race([a.flush(),new Promise(e=>{setTimeout(e,i).unref()})])}catch{}}var u=`Usage:
3
3
  picked login
4
4
  picked logout
5
5
  picked whoami
@@ -7,4 +7,6 @@ const e=require("../workspace-use-CT6_jewh.cjs");let t=require("@picked/config")
7
7
  picked workspace list [--json]
8
8
  picked workspace use [--project <id>] [--workspace <id>] [--no-generate]
9
9
  picked use [--project <id>] [--workspace <id>] [--no-generate]
10
- picked generate types [--check]`;async function d(){let{positionals:t,values:r}=(0,n.parseArgs)({allowPositionals:!0,options:{check:{type:`boolean`,default:!1},project:{type:`string`},workspace:{type:`string`},json:{type:`boolean`,default:!1},generate:{type:`boolean`,default:!0},"no-generate":{type:`boolean`,default:!1}}}),[i,a]=t,o=r.generate&&!r[`no-generate`];if(i===`login`){s(`login`),process.exitCode=await e.o({});return}if(i===`logout`){s(`logout`),process.exitCode=await e.a();return}if(i===`whoami`){s(`whoami`),process.exitCode=await e.r();return}if(i===`status`){s(`status`),process.exitCode=await e.i({});return}if(i===`workspace`&&(a===`list`||a===`ls`)){s(`workspace list`),process.exitCode=await e.n({json:r.json});return}if(i===`workspace`&&a===`use`||i===`use`){s(`workspace use`),process.exitCode=await e.t({project:r.project,workspace:r.workspace,generate:o});return}if(i===`generate`&&a===`types`){s(`generate types`),process.exitCode=await e.s({check:r.check});return}s(`unknown`),console.error(u),process.exitCode=1}function f(e){let t=2,n=()=>{--t,t<=0&&process.exit(e)};setTimeout(()=>{process.exit(e)},2e3).unref(),process.stdout.write(``,n),process.stderr.write(``,n)}d().then(async()=>{let e=typeof process.exitCode==`number`?process.exitCode:0;c(e),await l(),f(e)}).catch(e=>{let t=e instanceof Error?e.message:String(e);console.error(t),c(1),l().finally(()=>{f(1)})});
10
+ picked workspace export --project <id> (--workspace <id> | --live) --out <dir>
11
+ picked workspace import --project <id> --in <dir> [--name <name>] [--publish]
12
+ picked generate types [--check]`;async function d(){let{positionals:t,values:r}=(0,n.parseArgs)({allowPositionals:!0,options:{check:{type:`boolean`,default:!1},project:{type:`string`},workspace:{type:`string`},json:{type:`boolean`,default:!1},generate:{type:`boolean`,default:!0},"no-generate":{type:`boolean`,default:!1},live:{type:`boolean`,default:!1},out:{type:`string`},in:{type:`string`},name:{type:`string`},publish:{type:`boolean`,default:!1}}}),[i,a]=t,o=r.generate&&!r[`no-generate`];if(i===`login`){s(`login`),process.exitCode=await e.c({});return}if(i===`logout`){s(`logout`),process.exitCode=await e.s();return}if(i===`whoami`){s(`whoami`),process.exitCode=await e.a();return}if(i===`status`){s(`status`),process.exitCode=await e.o({});return}if(i===`workspace`&&(a===`list`||a===`ls`)){s(`workspace list`),process.exitCode=await e.n({json:r.json});return}if(i===`workspace`&&a===`use`||i===`use`){s(`workspace use`),process.exitCode=await e.t({project:r.project,workspace:r.workspace,generate:o});return}if(i===`workspace`&&a===`export`){s(`workspace export`),process.exitCode=await e.i({project:r.project,workspace:r.workspace,live:r.live,out:r.out});return}if(i===`workspace`&&a===`import`){s(`workspace import`),process.exitCode=await e.r({project:r.project,in:r.in,name:r.name,publish:r.publish});return}if(i===`generate`&&a===`types`){s(`generate types`),process.exitCode=await e.l({check:r.check});return}s(`unknown`),console.error(u),process.exitCode=1}function f(e){let t=2,n=()=>{--t,t<=0&&process.exit(e)};setTimeout(()=>{process.exit(e)},2e3).unref(),process.stdout.write(``,n),process.stderr.write(``,n)}d().then(async()=>{let e=typeof process.exitCode==`number`?process.exitCode:0;c(e),await l(),f(e)}).catch(e=>{let t=e instanceof Error?e.message:String(e);console.error(t),c(1),l().finally(()=>{f(1)})});
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../workspace-use-CT6_jewh.cjs");exports.runGenerateTypes=e.s,exports.runLogin=e.o,exports.runLogout=e.a,exports.runStatus=e.i,exports.runWhoami=e.r,exports.runWorkspaceList=e.n,exports.runWorkspaceUse=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../workspace-use-Cjn8sjJj.cjs");exports.runGenerateTypes=e.l,exports.runLogin=e.c,exports.runLogout=e.s,exports.runStatus=e.o,exports.runWhoami=e.a,exports.runWorkspaceExport=e.i,exports.runWorkspaceImport=e.r,exports.runWorkspaceList=e.n,exports.runWorkspaceUse=e.t;
package/dist/esm/cli.js CHANGED
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env node
2
- import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "../workspace-use-Cbz1Bxse.js";
3
- import { detectHostEnvironment as s, isTelemetryEnabled as c, isTelemetryForcedOffByEnvironment as l, loadResolvedPickedConfig as u } from "@picked/config";
4
- import { parseArgs as d } from "node:util";
5
- import { createSpanId as f, createTelemetryEmitter as p, createTraceId as m, toUnixNano as h } from "@picked/telemetry";
2
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../workspace-use-CnR5FkxR.js";
3
+ import { detectHostEnvironment as l, isTelemetryEnabled as u, isTelemetryForcedOffByEnvironment as d, loadResolvedPickedConfig as f } from "@picked/config";
4
+ import { parseArgs as p } from "node:util";
5
+ import { createSpanId as m, createTelemetryEmitter as h, createTraceId as g, toUnixNano as _ } from "@picked/telemetry";
6
6
  //#region src/telemetry.ts
7
- var g = 2e3, _ = null, v = 0;
8
- function y(e) {
9
- if (l()) return;
10
- v = Date.now();
11
- let t = s();
12
- _ = {
7
+ var v = 2e3, y = null, b = 0;
8
+ function x(e) {
9
+ if (d()) return;
10
+ b = Date.now();
11
+ let t = l();
12
+ y = {
13
13
  name: `picked.cli.${e}`,
14
- traceId: m(),
15
- spanId: f(),
16
- startTimeUnixNano: h(v),
17
- endTimeUnixNano: h(v),
14
+ traceId: g(),
15
+ spanId: m(),
16
+ startTimeUnixNano: _(b),
17
+ endTimeUnixNano: _(b),
18
18
  attributes: {
19
19
  "picked.cli.command": e,
20
20
  "picked.env.provider": t.provider,
@@ -23,28 +23,28 @@ function y(e) {
23
23
  status: "unset"
24
24
  };
25
25
  }
26
- function b(e) {
27
- _ && (_.endTimeUnixNano = h(Date.now()), _.status = e === 0 ? "ok" : "error");
26
+ function S(e) {
27
+ y && (y.endTimeUnixNano = _(Date.now()), y.status = e === 0 ? "ok" : "error");
28
28
  }
29
- async function x() {
30
- let e = _;
31
- if (_ = null, e) try {
32
- let t = await u();
33
- if (!t || !c(t)) return;
34
- let n = p({
29
+ async function C() {
30
+ let e = y;
31
+ if (y = null, e) try {
32
+ let t = await f();
33
+ if (!t || !u(t)) return;
34
+ let n = h({
35
35
  resource: { "service.name": "picked-cli" },
36
36
  headers: { "Picked-Telemetry": "cli" }
37
37
  });
38
38
  n.record(e), await Promise.race([n.flush(), new Promise((e) => {
39
- setTimeout(e, g).unref();
39
+ setTimeout(e, v).unref();
40
40
  })]);
41
41
  } catch {}
42
42
  }
43
43
  //#endregion
44
44
  //#region src/cli.ts
45
- var S = "Usage:\n picked login\n picked logout\n picked whoami\n picked status\n picked workspace list [--json]\n picked workspace use [--project <id>] [--workspace <id>] [--no-generate]\n picked use [--project <id>] [--workspace <id>] [--no-generate]\n picked generate types [--check]";
46
- async function C() {
47
- let { positionals: s, values: c } = d({
45
+ var w = "Usage:\n picked login\n picked logout\n picked whoami\n picked status\n picked workspace list [--json]\n picked workspace use [--project <id>] [--workspace <id>] [--no-generate]\n picked use [--project <id>] [--workspace <id>] [--no-generate]\n picked workspace export --project <id> (--workspace <id> | --live) --out <dir>\n picked workspace import --project <id> --in <dir> [--name <name>] [--publish]\n picked generate types [--check]";
46
+ async function T() {
47
+ let { positionals: l, values: u } = p({
48
48
  allowPositionals: !0,
49
49
  options: {
50
50
  check: {
@@ -64,44 +64,73 @@ async function C() {
64
64
  "no-generate": {
65
65
  type: "boolean",
66
66
  default: !1
67
+ },
68
+ live: {
69
+ type: "boolean",
70
+ default: !1
71
+ },
72
+ out: { type: "string" },
73
+ in: { type: "string" },
74
+ name: { type: "string" },
75
+ publish: {
76
+ type: "boolean",
77
+ default: !1
67
78
  }
68
79
  }
69
- }), [l, u] = s, f = c.generate && !c["no-generate"];
70
- if (l === "login") {
71
- y("login"), process.exitCode = await r({});
80
+ }), [d, f] = l, m = u.generate && !u["no-generate"];
81
+ if (d === "login") {
82
+ x("login"), process.exitCode = await t({});
83
+ return;
84
+ }
85
+ if (d === "logout") {
86
+ x("logout"), process.exitCode = await s();
72
87
  return;
73
88
  }
74
- if (l === "logout") {
75
- y("logout"), process.exitCode = await e();
89
+ if (d === "whoami") {
90
+ x("whoami"), process.exitCode = await e();
76
91
  return;
77
92
  }
78
- if (l === "whoami") {
79
- y("whoami"), process.exitCode = await i();
93
+ if (d === "status") {
94
+ x("status"), process.exitCode = await a({});
80
95
  return;
81
96
  }
82
- if (l === "status") {
83
- y("status"), process.exitCode = await t({});
97
+ if (d === "workspace" && (f === "list" || f === "ls")) {
98
+ x("workspace list"), process.exitCode = await i({ json: u.json });
84
99
  return;
85
100
  }
86
- if (l === "workspace" && (u === "list" || u === "ls")) {
87
- y("workspace list"), process.exitCode = await n({ json: c.json });
101
+ if (d === "workspace" && f === "use" || d === "use") {
102
+ x("workspace use"), process.exitCode = await c({
103
+ project: u.project,
104
+ workspace: u.workspace,
105
+ generate: m
106
+ });
107
+ return;
108
+ }
109
+ if (d === "workspace" && f === "export") {
110
+ x("workspace export"), process.exitCode = await n({
111
+ project: u.project,
112
+ workspace: u.workspace,
113
+ live: u.live,
114
+ out: u.out
115
+ });
88
116
  return;
89
117
  }
90
- if (l === "workspace" && u === "use" || l === "use") {
91
- y("workspace use"), process.exitCode = await o({
92
- project: c.project,
93
- workspace: c.workspace,
94
- generate: f
118
+ if (d === "workspace" && f === "import") {
119
+ x("workspace import"), process.exitCode = await o({
120
+ project: u.project,
121
+ in: u.in,
122
+ name: u.name,
123
+ publish: u.publish
95
124
  });
96
125
  return;
97
126
  }
98
- if (l === "generate" && u === "types") {
99
- y("generate types"), process.exitCode = await a({ check: c.check });
127
+ if (d === "generate" && f === "types") {
128
+ x("generate types"), process.exitCode = await r({ check: u.check });
100
129
  return;
101
130
  }
102
- y("unknown"), console.error(S), process.exitCode = 1;
131
+ x("unknown"), console.error(w), process.exitCode = 1;
103
132
  }
104
- function w(e) {
133
+ function E(e) {
105
134
  let t = 2, n = () => {
106
135
  --t, t <= 0 && process.exit(e);
107
136
  };
@@ -109,13 +138,13 @@ function w(e) {
109
138
  process.exit(e);
110
139
  }, 2e3).unref(), process.stdout.write("", n), process.stderr.write("", n);
111
140
  }
112
- C().then(async () => {
141
+ T().then(async () => {
113
142
  let e = typeof process.exitCode == "number" ? process.exitCode : 0;
114
- b(e), await x(), w(e);
143
+ S(e), await C(), E(e);
115
144
  }).catch((e) => {
116
145
  let t = e instanceof Error ? e.message : String(e);
117
- console.error(t), b(1), x().finally(() => {
118
- w(1);
146
+ console.error(t), S(1), C().finally(() => {
147
+ E(1);
119
148
  });
120
149
  });
121
150
  //#endregion
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "../workspace-use-Cbz1Bxse.js";
2
- export { a as runGenerateTypes, r as runLogin, e as runLogout, t as runStatus, i as runWhoami, n as runWorkspaceList, o as runWorkspaceUse };
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../workspace-use-CnR5FkxR.js";
2
+ export { r as runGenerateTypes, t as runLogin, s as runLogout, a as runStatus, e as runWhoami, n as runWorkspaceExport, o as runWorkspaceImport, i as runWorkspaceList, c as runWorkspaceUse };
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Runs `picked login`: runs the browser + loopback PKCE OAuth flow and persists the
3
- * resulting session to the current directory's API origin auth config.
3
+ * resulting session to the current directory's API origin auth config. Fails without
4
+ * signing in while `PICKED_API_KEY` is set.
4
5
  *
5
6
  * @param {object} [options] - Command options.
6
7
  * @param {string} [options.cwd] - Working directory used to resolve the API origin.
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/login.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAsB,QAAQ,CAAC,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB1E"}
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/login.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,wBAAsB,QAAQ,CAAC,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwB1E"}
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Runs `picked whoami`: prints the identity signed in to the current directory's API origin.
3
+ * Fails without reading a session while `PICKED_API_KEY` is set.
3
4
  *
4
5
  * @param {object} [options] - Command options.
5
6
  * @param {string} [options.cwd] - Working directory used to resolve the API origin.
@@ -1 +1 @@
1
- {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../src/commands/whoami.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAAC,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAc3E"}
1
+ {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../src/commands/whoami.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAAC,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAsB3E"}
@@ -0,0 +1,28 @@
1
+ /** Options for {@link runWorkspaceExport}. */
2
+ interface RunWorkspaceExportOptions {
3
+ cwd?: string;
4
+ /** The project the exported workspace belongs to. */
5
+ project?: string;
6
+ /** The workspace to export. */
7
+ workspace?: string;
8
+ /** Export the snapshot workspace of the project's live version. */
9
+ live?: boolean;
10
+ /** The bundle directory to write, inside `cwd`. */
11
+ out?: string;
12
+ }
13
+ /**
14
+ * Runs `picked workspace export`: exports a workspace, or with `--live` the snapshot
15
+ * workspace of the project's live version, into a bundle directory. Every manifest asset is
16
+ * downloaded, checked against the manifest's size and SHA-256, and written to
17
+ * `assets/<sha256>`; a manifest item with no SHA-256 gets the hash of the downloaded bytes.
18
+ * `bundle.json` is written last, into a temporary sibling directory that becomes `--out` only
19
+ * once complete, so a failed run leaves `--out` as it was.
20
+ *
21
+ * @param {RunWorkspaceExportOptions} options - Command options.
22
+ * @returns {Promise<number>} Process exit code.
23
+ * @example
24
+ * await runWorkspaceExport({ project: 'proj-1', live: true, out: 'bundle' })
25
+ */
26
+ export declare function runWorkspaceExport(options: RunWorkspaceExportOptions): Promise<number>;
27
+ export {};
28
+ //# sourceMappingURL=workspace-export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-export.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace-export.ts"],"names":[],"mappings":"AAqBA,8CAA8C;AAC9C,UAAU,yBAAyB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,mDAAmD;IACnD,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAsKD;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsB5F"}
@@ -0,0 +1,26 @@
1
+ /** Options for {@link runWorkspaceImport}. */
2
+ interface RunWorkspaceImportOptions {
3
+ cwd?: string;
4
+ /** The project to import into. */
5
+ project?: string;
6
+ /** The bundle directory to read, inside `cwd`. */
7
+ in?: string;
8
+ /** The new workspace's name; the bundle's workspace name when omitted. */
9
+ name?: string;
10
+ /** Publish the new workspace after importing it. */
11
+ publish?: boolean;
12
+ }
13
+ /**
14
+ * Runs `picked workspace import`: stores the bundle's assets in the project, reusing the
15
+ * project's existing versions of identical bytes, imports the bundle as a new draft
16
+ * workspace, and with `--publish` publishes it. Prints the new workspace id. When storing
17
+ * fails or the API refuses the import, the assets this run uploaded are deleted.
18
+ *
19
+ * @param {RunWorkspaceImportOptions} options - Command options.
20
+ * @returns {Promise<number>} Process exit code.
21
+ * @example
22
+ * await runWorkspaceImport({ project: 'proj-1', in: 'bundle', publish: true })
23
+ */
24
+ export declare function runWorkspaceImport(options: RunWorkspaceImportOptions): Promise<number>;
25
+ export {};
26
+ //# sourceMappingURL=workspace-import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-import.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace-import.ts"],"names":[],"mappings":"AAyBA,8CAA8C;AAC9C,UAAU,yBAAyB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kDAAkD;IAClD,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAmPD;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwC5F"}
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * @param {object} [options] - Command options.
6
6
  * @param {string} [options.cwd] - Working directory used to resolve the API URL.
7
- * @param {boolean} [options.json] - Print machine-readable JSON to stdout instead of a table.
7
+ * @param {boolean} [options.json] - Print machine-readable JSON to stdout; the default is an indented list.
8
8
  * @returns {Promise<number>} Process exit code.
9
9
  * @example
10
10
  * await runWorkspaceList({ json: false })
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-list.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace-list.ts"],"names":[],"mappings":"AAiCA;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBlB"}
1
+ {"version":3,"file":"workspace-list.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace-list.ts"],"names":[],"mappings":"AAiCA;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-use.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace-use.ts"],"names":[],"mappings":"AAcA,2CAA2C;AAC3C,UAAU,sBAAsB;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAqID;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBvF"}
1
+ {"version":3,"file":"workspace-use.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace-use.ts"],"names":[],"mappings":"AAeA,2CAA2C;AAC3C,UAAU,sBAAsB;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AA+HD;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBvF"}
@@ -4,6 +4,8 @@ export { runLogin } from './commands/login';
4
4
  export { runLogout } from './commands/logout';
5
5
  export { runStatus } from './commands/status';
6
6
  export { runWhoami } from './commands/whoami';
7
+ export { runWorkspaceExport } from './commands/workspace-export';
8
+ export { runWorkspaceImport } from './commands/workspace-import';
7
9
  export { runWorkspaceList } from './commands/workspace-list';
8
10
  export { runWorkspaceUse } from './commands/workspace-use';
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA"}
@@ -0,0 +1,22 @@
1
+ import type { AdminApiClient } from '@picked/admin-api-client';
2
+ /**
3
+ * Reads the API key for non-interactive runs from `PICKED_API_KEY`.
4
+ *
5
+ * @returns {string | undefined} The trimmed key, or undefined when the variable is unset or blank.
6
+ * @example
7
+ * if (readApiKey()) console.error('Using PICKED_API_KEY')
8
+ */
9
+ export declare function readApiKey(): string | undefined;
10
+ /**
11
+ * Creates an admin API client for an API origin. With `PICKED_API_KEY` set, every request
12
+ * carries it as `X-API-Key` and the stored OAuth session is never read. Otherwise requests
13
+ * carry that origin's OAuth access token, refreshed as it nears expiry.
14
+ *
15
+ * @param {string} apiUrl - The API origin.
16
+ * @returns {Promise<AdminApiClient>} The client.
17
+ * @throws {Error} When there is no API key and no session for `apiUrl`.
18
+ * @example
19
+ * const client = await createCliAdminClient(await resolveApiUrl())
20
+ */
21
+ export declare function createCliAdminClient(apiUrl: string): Promise<AdminApiClient>;
22
+ //# sourceMappingURL=admin-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-client.d.ts","sourceRoot":"","sources":["../../../src/lib/admin-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAG9D;;;;;;GAMG;AACH,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAG/C;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAMlF"}
@@ -0,0 +1,79 @@
1
+ /** File name of the bundle document inside a bundle directory. */
2
+ export declare const BUNDLE_FILE = "bundle.json";
3
+ /** Directory inside a bundle directory that holds the asset files. */
4
+ export declare const ASSETS_DIR = "assets";
5
+ /**
6
+ * Resolves the bundle directory a flag names against the current directory.
7
+ *
8
+ * @param {string} cwd - The current directory.
9
+ * @param {string} value - The flag's value.
10
+ * @param {string} flag - The flag, for the error message.
11
+ * @returns {string} The absolute bundle directory, strictly inside `cwd`.
12
+ * @throws {Error} When the directory is `cwd` itself or lies outside it.
13
+ * @example
14
+ * resolveBundleDir('/work', 'bundle', '--out') // '/work/bundle'
15
+ */
16
+ export declare function resolveBundleDir(cwd: string, value: string, flag: string): string;
17
+ /** One asset version of a bundle's `assets` manifest, as the CLI reads it. */
18
+ export interface BundleAsset {
19
+ /** The asset version id in the source project. */
20
+ versionId: string;
21
+ fileName: string;
22
+ mimeType: string;
23
+ sizeBytes: number;
24
+ /** Lower-case hex SHA-256 of the bytes, or null when the source never recorded one. */
25
+ sha256: string | null;
26
+ downloadUrl: string;
27
+ }
28
+ /**
29
+ * Narrows a value to a plain JSON object.
30
+ *
31
+ * @param {unknown} value - The value.
32
+ * @returns {boolean} True for a non-null, non-array object.
33
+ * @example
34
+ * isRecord(JSON.parse(text))
35
+ */
36
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
37
+ /**
38
+ * Returns the path of an asset file inside a bundle directory.
39
+ *
40
+ * @param {string} bundleDir - The bundle directory.
41
+ * @param {string} sha256 - The lower-case hex SHA-256 of the file's bytes.
42
+ * @returns {string} `<bundleDir>/assets/<sha256>`.
43
+ * @example
44
+ * assetPath('./bundle', asset.sha256)
45
+ */
46
+ export declare function assetPath(bundleDir: string, sha256: string): string;
47
+ /**
48
+ * Reads the `assets` manifest of a bundle.
49
+ *
50
+ * @param {Record<string, unknown>} bundle - The bundle document.
51
+ * @returns {BundleAsset[]} Its items, in manifest order.
52
+ * @throws {Error} When `assets` is not an array of well-formed items.
53
+ * @example
54
+ * const assets = readAssetManifest(bundle)
55
+ */
56
+ export declare function readAssetManifest(bundle: Record<string, unknown>): BundleAsset[];
57
+ /**
58
+ * Checks bytes against the size and, when it has one, the SHA-256 of a manifest item.
59
+ *
60
+ * @param {BundleAsset} asset - The manifest item.
61
+ * @param {Uint8Array} bytes - The bytes.
62
+ * @param {string} source - Where the bytes came from, for the error message.
63
+ * @returns {string} The lower-case hex SHA-256 of `bytes`.
64
+ * @throws {Error} When the size or the SHA-256 differs from the manifest.
65
+ * @example
66
+ * const sha256 = verifyAssetBytes(asset, bytes, asset.downloadUrl)
67
+ */
68
+ export declare function verifyAssetBytes(asset: BundleAsset, bytes: Uint8Array, source: string): string;
69
+ /**
70
+ * Returns a copy of a bundle whose manifest items carry the given SHA-256 digests.
71
+ *
72
+ * @param {Record<string, unknown>} bundle - The bundle document.
73
+ * @param {string[]} hashes - The digest of each manifest item, in manifest order.
74
+ * @returns {Record<string, unknown>} The bundle with every item's `sha256` set.
75
+ * @example
76
+ * const written = withAssetHashes(bundle, [sha256])
77
+ */
78
+ export declare function withAssetHashes(bundle: Record<string, unknown>, hashes: string[]): Record<string, unknown>;
79
+ //# sourceMappingURL=bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../src/lib/bundle.ts"],"names":[],"mappings":"AAOA,kEAAkE;AAClE,eAAO,MAAM,WAAW,gBAAgB,CAAA;AAExC,sEAAsE;AACtE,eAAO,MAAM,UAAU,WAAW,CAAA;AAIlC;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CASjF;AAED,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,uFAAuF;IACvF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAcD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnE;AAuCD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,EAAE,CAIhF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAe9F;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE,MAAM,EAAE,GACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQzB"}
@@ -0,0 +1,120 @@
1
+ import type { AdminApiClient } from '@picked/admin-api-client';
2
+ /** One `workspaceImport` asset mapping: a bundle asset version and the target version for it. */
3
+ export interface AssetMapping {
4
+ sourceVersionId: string;
5
+ assetId: string;
6
+ versionId: string;
7
+ }
8
+ /** The target project's asset version for some bytes, and whether they had to be uploaded. */
9
+ interface UploadedAsset {
10
+ assetId: string;
11
+ versionId: string;
12
+ /** True when the project already held the bytes and nothing was uploaded. */
13
+ deduplicated: boolean;
14
+ }
15
+ /**
16
+ * The error thrown when a mutation payload carries user errors: the API answered and
17
+ * rejected the operation.
18
+ *
19
+ * @example
20
+ * if (error instanceof PayloadUserErrorsError) console.error(error.message)
21
+ */
22
+ export declare class PayloadUserErrorsError extends Error {
23
+ readonly name = "PayloadUserErrorsError";
24
+ }
25
+ /**
26
+ * Resolves the workspace that holds a project's live version: the snapshot workspace of
27
+ * the version the project serves.
28
+ *
29
+ * @param {AdminApiClient} client - The admin API client.
30
+ * @param {string} projectId - The project.
31
+ * @returns {Promise<string>} The snapshot workspace id.
32
+ * @throws {Error} When the project is not found, has no published version, or its live
33
+ * version has no snapshot workspace.
34
+ * @example
35
+ * const workspaceId = await resolveLiveWorkspaceId(client, 'proj-1')
36
+ */
37
+ export declare function resolveLiveWorkspaceId(client: AdminApiClient, projectId: string): Promise<string>;
38
+ /**
39
+ * Exports a workspace as a bundle.
40
+ *
41
+ * @param {AdminApiClient} client - The admin API client.
42
+ * @param {string} workspaceId - The workspace.
43
+ * @returns {Promise<Record<string, unknown>>} The bundle document.
44
+ * @throws {Error} On user errors, or when the payload has no bundle object.
45
+ * @example
46
+ * const bundle = await exportWorkspaceBundle(client, 'ws-1')
47
+ */
48
+ export declare function exportWorkspaceBundle(client: AdminApiClient, workspaceId: string): Promise<Record<string, unknown>>;
49
+ /**
50
+ * Stores bytes as an asset of a project. `assetUploadInit` receives their SHA-256: when the
51
+ * project already holds them it returns that version and nothing is uploaded; otherwise the
52
+ * bytes are PUT to the upload URL and committed with the same SHA-256.
53
+ *
54
+ * @param {AdminApiClient} client - The admin API client.
55
+ * @param {object} params - The upload.
56
+ * @param {string} params.projectId - The target project.
57
+ * @param {string} params.fileName - The asset's file name.
58
+ * @param {string} params.mimeType - The bytes' content type.
59
+ * @param {string} params.sha256 - Lower-case hex SHA-256 of `bytes`.
60
+ * @param {Uint8Array<ArrayBuffer>} params.bytes - The bytes.
61
+ * @returns {Promise<UploadedAsset>} The project's asset version for the bytes.
62
+ * @throws {Error} When storage rejects the upload or the commit returns user errors.
63
+ * @example
64
+ * const uploaded = await uploadAsset(client, { projectId, fileName, mimeType, sha256, bytes })
65
+ */
66
+ export declare function uploadAsset(client: AdminApiClient, params: {
67
+ projectId: string;
68
+ fileName: string;
69
+ mimeType: string;
70
+ sha256: string;
71
+ bytes: Uint8Array<ArrayBuffer>;
72
+ }): Promise<UploadedAsset>;
73
+ /**
74
+ * Deletes an asset of a project.
75
+ *
76
+ * @param {AdminApiClient} client - The admin API client.
77
+ * @param {string} assetId - The asset.
78
+ * @returns {Promise<void>} Resolves once deleted.
79
+ * @example
80
+ * await deleteAsset(client, 'asset-1')
81
+ */
82
+ export declare function deleteAsset(client: AdminApiClient, assetId: string): Promise<void>;
83
+ /**
84
+ * Imports a bundle as a new draft workspace of a project. The request may run for up to
85
+ * five minutes.
86
+ *
87
+ * @param {AdminApiClient} client - The admin API client.
88
+ * @param {object} params - The import.
89
+ * @param {string} params.projectId - The target project.
90
+ * @param {string} [params.name] - The new workspace's name; the bundle's name when omitted.
91
+ * @param {Record<string, unknown>} params.bundle - The bundle document.
92
+ * @param {AssetMapping[]} params.assetMap - The target version of every bundle asset version.
93
+ * @returns {Promise<{ id: string; name: string }>} The new workspace.
94
+ * @throws {PayloadUserErrorsError} On user errors.
95
+ * @throws {Error} When the request fails, or the payload has neither a workspace nor user errors.
96
+ * @example
97
+ * const workspace = await importWorkspaceBundle(client, { projectId, bundle, assetMap })
98
+ */
99
+ export declare function importWorkspaceBundle(client: AdminApiClient, params: {
100
+ projectId: string;
101
+ name?: string;
102
+ bundle: Record<string, unknown>;
103
+ assetMap: AssetMapping[];
104
+ }): Promise<{
105
+ id: string;
106
+ name: string;
107
+ }>;
108
+ /**
109
+ * Publishes a workspace, making it its project's live version.
110
+ *
111
+ * @param {AdminApiClient} client - The admin API client.
112
+ * @param {string} workspaceId - The workspace.
113
+ * @returns {Promise<void>} Resolves once published.
114
+ * @throws {Error} On user errors.
115
+ * @example
116
+ * await publishWorkspace(client, 'ws-1')
117
+ */
118
+ export declare function publishWorkspace(client: AdminApiClient, workspaceId: string): Promise<void>;
119
+ export {};
120
+ //# sourceMappingURL=workspace-transfer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-transfer.d.ts","sourceRoot":"","sources":["../../../src/lib/workspace-transfer.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAe9D,iGAAiG;AACjG,MAAM,WAAW,YAAY;IAC3B,eAAe,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,8FAA8F;AAC9F,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,6EAA6E;IAC7E,YAAY,EAAE,OAAO,CAAA;CACtB;AAED;;;;;;GAMG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,SAAkB,IAAI,4BAA2B;CAClD;AAqBD;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAUlC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE;IACN,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;CAC/B,GACA,OAAO,CAAC,aAAa,CAAC,CAmCxB;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAExF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE;IACN,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,QAAQ,EAAE,YAAY,EAAE,CAAA;CACzB,GACA,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAYvC;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKjG"}
@@ -1,3 +1,4 @@
1
+ import type { AdminApiClient } from '@picked/admin-api-client';
1
2
  import type { WorkspaceStatus } from '@picked/config';
2
3
  /** A workspace within a project, as returned by the workspace-tree query. */
3
4
  export interface WorkspaceNode {
@@ -30,25 +31,23 @@ export interface WorkspacePreviewInfo {
30
31
  /**
31
32
  * Fetches every organization, project, and workspace visible to the authenticated user.
32
33
  *
33
- * @param {string} apiUrl - Base Picked API URL.
34
- * @param {string} token - Bearer access token.
34
+ * @param {AdminApiClient} client - The admin API client.
35
35
  * @returns {Promise<OrgNode[]>} The organization/project/workspace tree.
36
- * @throws {Error} When the request fails or the caller is not authenticated.
36
+ * @throws {Error} When the request fails or the caller is not a signed-in user.
37
37
  * @example
38
- * const orgs = await fetchWorkspaceTree(apiUrl, token)
38
+ * const orgs = await fetchWorkspaceTree(client)
39
39
  */
40
- export declare function fetchWorkspaceTree(apiUrl: string, token: string): Promise<OrgNode[]>;
40
+ export declare function fetchWorkspaceTree(client: AdminApiClient): Promise<OrgNode[]>;
41
41
  /**
42
42
  * Fetches a single workspace's status, name, and stateless preview delivery token.
43
43
  *
44
- * @param {string} apiUrl - Base Picked API URL.
45
- * @param {string} token - Bearer access token.
44
+ * @param {AdminApiClient} client - The admin API client.
46
45
  * @param {string} projectId - Project the workspace belongs to.
47
46
  * @param {string} workspaceId - Workspace to fetch.
48
47
  * @returns {Promise<WorkspacePreviewInfo>} The workspace's status, name, and preview token.
49
48
  * @throws {Error} When the request fails or the workspace cannot be found.
50
49
  * @example
51
- * const info = await fetchPreviewToken(apiUrl, token, projectId, workspaceId)
50
+ * const info = await fetchPreviewToken(client, projectId, workspaceId)
52
51
  */
53
- export declare function fetchPreviewToken(apiUrl: string, token: string, projectId: string, workspaceId: string): Promise<WorkspacePreviewInfo>;
52
+ export declare function fetchPreviewToken(client: AdminApiClient, projectId: string, workspaceId: string): Promise<WorkspacePreviewInfo>;
54
53
  //# sourceMappingURL=workspaces.d.ts.map