@sanity/workbench-cli 2.0.1 → 2.1.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.
Files changed (34) hide show
  1. package/dist/_exports/_internal_render.d.ts +12 -0
  2. package/dist/_exports/_internal_render.js +3 -0
  3. package/dist/_exports/_internal_render.js.map +1 -0
  4. package/dist/_exports/build.d.ts +13 -253
  5. package/dist/_exports/contract-DyG11fQ7.d.ts +45 -0
  6. package/dist/_exports/defineApp-DSvQx8rf.d.ts +151 -0
  7. package/dist/_exports/deploy.d.ts +94 -427
  8. package/dist/_exports/dev.d.ts +26 -196
  9. package/dist/_exports/index.d.ts +74 -407
  10. package/dist/_exports/init.d.ts +5 -9
  11. package/dist/_exports/preview.d.ts +20 -187
  12. package/dist/_exports/registry-DI7hnTof.d.ts +102 -0
  13. package/dist/_exports/resolveWorkbenchApp-Be9eU8mu.d.ts +41 -0
  14. package/dist/_exports/summarizeInterfaces-DLsq6P43.d.ts +62 -0
  15. package/dist/_exports/undeploy.d.ts +15 -296
  16. package/dist/actions/build/vite/plugins/plugin-module-federation.js +7 -15
  17. package/dist/actions/build/vite/plugins/plugin-module-federation.js.map +1 -1
  18. package/dist/actions/dev/registry.js +9 -0
  19. package/dist/actions/dev/registry.js.map +1 -1
  20. package/dist/actions/dev/startDevServerRegistration.js +50 -3
  21. package/dist/actions/dev/startDevServerRegistration.js.map +1 -1
  22. package/dist/actions/dev/startWorkbenchDevServer.js +15 -36
  23. package/dist/actions/dev/startWorkbenchDevServer.js.map +1 -1
  24. package/dist/actions/dev/writeWorkbenchRuntime.js +2 -2
  25. package/dist/actions/dev/writeWorkbenchRuntime.js.map +1 -1
  26. package/dist/defineApp.js +1 -4
  27. package/dist/defineApp.js.map +1 -1
  28. package/dist/renderDashboard.js +63 -0
  29. package/dist/renderDashboard.js.map +1 -0
  30. package/dist/services/applications.js +7 -7
  31. package/dist/services/applications.js.map +1 -1
  32. package/dist/services/installations.js +4 -4
  33. package/dist/services/installations.js.map +1 -1
  34. package/package.json +13 -7
@@ -16,7 +16,7 @@ async function getClient() {
16
16
  limit: 'none',
17
17
  organizationId
18
18
  },
19
- uri: '/installations'
19
+ url: '/installations'
20
20
  });
21
21
  return data.find((item)=>item.application?.slug === slug)?.id;
22
22
  }
@@ -32,7 +32,7 @@ async function getClient() {
32
32
  body: formData.pipe(new PassThrough()),
33
33
  headers: formData.getHeaders(),
34
34
  method: 'POST',
35
- uri: `/installations/${installationId}/configs`
35
+ url: `/installations/${installationId}/configs`
36
36
  });
37
37
  }
38
38
  /** The installation's deployed config snapshots, newest first. */ export async function listConfigs(installationId) {
@@ -41,7 +41,7 @@ async function getClient() {
41
41
  query: {
42
42
  limit: 'none'
43
43
  },
44
- uri: `/installations/${installationId}/configs`
44
+ url: `/installations/${installationId}/configs`
45
45
  });
46
46
  return data;
47
47
  }
@@ -53,7 +53,7 @@ async function getClient() {
53
53
  try {
54
54
  await client.request({
55
55
  method: 'DELETE',
56
- uri: `/installations/${installationId}/configs/${configId}`
56
+ url: `/installations/${installationId}/configs/${configId}`
57
57
  });
58
58
  } catch (err) {
59
59
  if (err?.statusCode !== 404) throw err;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/services/installations.ts"],"sourcesContent":["import {PassThrough} from 'node:stream'\nimport {type Gzip} from 'node:zlib'\n\nimport {getGlobalCliClient} from '@sanity/cli-core'\nimport FormData from 'form-data'\n\nimport {APP_WORKBENCH_API_VERSION} from './apiVersion.js'\n\nexport interface ConfigSnapshot {\n id: string\n\n createdAt?: string\n deployedBy?: string\n /** Whether this snapshot is the one being served; at most one per installation. */\n isActive?: boolean\n}\n\ninterface InstallationListItem {\n id: string\n\n application?: {slug?: string}\n}\n\nasync function getClient() {\n return getGlobalCliClient({apiVersion: APP_WORKBENCH_API_VERSION, requireUser: true})\n}\n\n/** The org's active singleton installation, matched on its slug. */\nexport async function resolveSingletonInstallationId(\n organizationId: string,\n slug: string,\n): Promise<string | undefined> {\n const client = await getClient()\n // `limit=none` returns every installation in one response, no pagination.\n const {data}: {data: InstallationListItem[]} = await client.request({\n query: {limit: 'none', organizationId},\n uri: '/installations',\n })\n return data.find((item) => item.application?.slug === slug)?.id\n}\n\n/** Upload a config snapshot to the installation as a multipart tarball. */\nexport async function createConfig(\n installationId: string,\n {tarball, version}: {tarball: Gzip; version: string},\n): Promise<void> {\n const formData = new FormData()\n formData.append('version', version)\n formData.append('tarball', tarball, {\n contentType: 'application/gzip',\n filename: 'installation-config.tar.gz',\n })\n\n const client = await getClient()\n await client.request({\n body: formData.pipe(new PassThrough()),\n headers: formData.getHeaders(),\n method: 'POST',\n uri: `/installations/${installationId}/configs`,\n })\n}\n\n/** The installation's deployed config snapshots, newest first. */\nexport async function listConfigs(installationId: string): Promise<ConfigSnapshot[]> {\n const client = await getClient()\n const {data}: {data: ConfigSnapshot[]} = await client.request({\n query: {limit: 'none'},\n uri: `/installations/${installationId}/configs`,\n })\n return data\n}\n\n/**\n * Soft-deletes one config snapshot; its content is purged once superseded.\n * Already deleted counts as done, so a partially-failed undeploy can re-run.\n */\nexport async function deleteConfig(installationId: string, configId: string): Promise<void> {\n const client = await getClient()\n try {\n await client.request({\n method: 'DELETE',\n uri: `/installations/${installationId}/configs/${configId}`,\n })\n } catch (err) {\n if ((err as {statusCode?: number})?.statusCode !== 404) throw err\n }\n}\n"],"names":["PassThrough","getGlobalCliClient","FormData","APP_WORKBENCH_API_VERSION","getClient","apiVersion","requireUser","resolveSingletonInstallationId","organizationId","slug","client","data","request","query","limit","uri","find","item","application","id","createConfig","installationId","tarball","version","formData","append","contentType","filename","body","pipe","headers","getHeaders","method","listConfigs","deleteConfig","configId","err","statusCode"],"mappings":"AAAA,SAAQA,WAAW,QAAO,cAAa;AAGvC,SAAQC,kBAAkB,QAAO,mBAAkB;AACnD,OAAOC,cAAc,YAAW;AAEhC,SAAQC,yBAAyB,QAAO,kBAAiB;AAiBzD,eAAeC;IACb,OAAOH,mBAAmB;QAACI,YAAYF;Q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,OAAOC,KAAK;QACZ,IAAI,AAACA,KAA+BC,eAAe,KAAK,MAAMD;IAChE;AACF"}
1
+ {"version":3,"sources":["../../src/services/installations.ts"],"sourcesContent":["import {PassThrough} from 'node:stream'\nimport {type Gzip} from 'node:zlib'\n\nimport {getGlobalCliClient} from '@sanity/cli-core'\nimport FormData from 'form-data'\n\nimport {APP_WORKBENCH_API_VERSION} from './apiVersion.js'\n\nexport interface ConfigSnapshot {\n id: string\n\n createdAt?: string\n deployedBy?: string\n /** Whether this snapshot is the one being served; at most one per installation. */\n isActive?: boolean\n}\n\ninterface InstallationListItem {\n id: string\n\n application?: {slug?: string}\n}\n\nasync function getClient() {\n return getGlobalCliClient({apiVersion: APP_WORKBENCH_API_VERSION, requireUser: true})\n}\n\n/** The org's active singleton installation, matched on its slug. */\nexport async function resolveSingletonInstallationId(\n organizationId: string,\n slug: string,\n): Promise<string | undefined> {\n const client = await getClient()\n // `limit=none` returns every installation in one response, no pagination.\n const {data}: {data: InstallationListItem[]} = await client.request({\n query: {limit: 'none', organizationId},\n url: '/installations',\n })\n return data.find((item) => item.application?.slug === slug)?.id\n}\n\n/** Upload a config snapshot to the installation as a multipart tarball. */\nexport async function createConfig(\n installationId: string,\n {tarball, version}: {tarball: Gzip; version: string},\n): Promise<void> {\n const formData = new FormData()\n formData.append('version', version)\n formData.append('tarball', tarball, {\n contentType: 'application/gzip',\n filename: 'installation-config.tar.gz',\n })\n\n const client = await getClient()\n await client.request({\n body: formData.pipe(new PassThrough()),\n headers: formData.getHeaders(),\n method: 'POST',\n url: `/installations/${installationId}/configs`,\n })\n}\n\n/** The installation's deployed config snapshots, newest first. */\nexport async function listConfigs(installationId: string): Promise<ConfigSnapshot[]> {\n const client = await getClient()\n const {data}: {data: ConfigSnapshot[]} = await client.request({\n query: {limit: 'none'},\n url: `/installations/${installationId}/configs`,\n })\n return data\n}\n\n/**\n * Soft-deletes one config snapshot; its content is purged once superseded.\n * Already deleted counts as done, so a partially-failed undeploy can re-run.\n */\nexport async function deleteConfig(installationId: string, configId: string): Promise<void> {\n const client = await getClient()\n try {\n await client.request({\n method: 'DELETE',\n url: `/installations/${installationId}/configs/${configId}`,\n })\n } catch (err) {\n if ((err as {statusCode?: number})?.statusCode !== 404) throw err\n }\n}\n"],"names":["PassThrough","getGlobalCliClient","FormData","APP_WORKBENCH_API_VERSION","getClient","apiVersion","requireUser","resolveSingletonInstallationId","organizationId","slug","client","data","request","query","limit","url","find","item","application","id","createConfig","installationId","tarball","version","formData","append","contentType","filename","body","pipe","headers","getHeaders","method","listConfigs","deleteConfig","configId","err","statusCode"],"mappings":"AAAA,SAAQA,WAAW,QAAO,cAAa;AAGvC,SAAQC,kBAAkB,QAAO,mBAAkB;AACnD,OAAOC,cAAc,YAAW;AAEhC,SAAQC,yBAAyB,QAAO,kBAAiB;AAiBzD,eAAeC;IACb,OAAOH,mBAAmB;QAACI,YAAYF;QAA2BG,aAAa;IAAI;AACrF;AAEA,kEAAkE,GAClE,OAAO,eAAeC,+BACpBC,cAAsB,EACtBC,IAAY;IAEZ,MAAMC,SAAS,MAAMN;IACrB,0EAA0E;IAC1E,MAAM,EAACO,IAAI,EAAC,GAAmC,MAAMD,OAAOE,OAAO,CAAC;QAClEC,OAAO;YAACC,OAAO;YAAQN;QAAc;QACrCO,KAAK;IACP;IACA,OAAOJ,KAAKK,IAAI,CAAC,CAACC,OAASA,KAAKC,WAAW,EAAET,SAASA,OAAOU;AAC/D;AAEA,yEAAyE,GACzE,OAAO,eAAeC,aACpBC,cAAsB,EACtB,EAACC,OAAO,EAAEC,OAAO,EAAmC;IAEpD,MAAMC,WAAW,IAAItB;IACrBsB,SAASC,MAAM,CAAC,WAAWF;IAC3BC,SAASC,MAAM,CAAC,WAAWH,SAAS;QAClCI,aAAa;QACbC,UAAU;IACZ;IAEA,MAAMjB,SAAS,MAAMN;IACrB,MAAMM,OAAOE,OAAO,CAAC;QACnBgB,MAAMJ,SAASK,IAAI,CAAC,IAAI7B;QACxB8B,SAASN,SAASO,UAAU;QAC5BC,QAAQ;QACRjB,KAAK,CAAC,eAAe,EAAEM,eAAe,QAAQ,CAAC;IACjD;AACF;AAEA,gEAAgE,GAChE,OAAO,eAAeY,YAAYZ,cAAsB;IACtD,MAAMX,SAAS,MAAMN;IACrB,MAAM,EAACO,IAAI,EAAC,GAA6B,MAAMD,OAAOE,OAAO,CAAC;QAC5DC,OAAO;YAACC,OAAO;QAAM;QACrBC,KAAK,CAAC,eAAe,EAAEM,eAAe,QAAQ,CAAC;IACjD;IACA,OAAOV;AACT;AAEA;;;CAGC,GACD,OAAO,eAAeuB,aAAab,cAAsB,EAAEc,QAAgB;IACzE,MAAMzB,SAAS,MAAMN;IACrB,IAAI;QACF,MAAMM,OAAOE,OAAO,CAAC;YACnBoB,QAAQ;YACRjB,KAAK,CAAC,eAAe,EAAEM,eAAe,SAAS,EAAEc,UAAU;QAC7D;IACF,EAAE,OAAOC,KAAK;QACZ,IAAI,AAACA,KAA+BC,eAAe,KAAK,MAAMD;IAChE;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/workbench-cli",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "Internal implementation detail of the Sanity CLI's unstable workbench support. Not intended for direct use.",
5
5
  "homepage": "https://github.com/sanity-io/cli",
6
6
  "bugs": "https://github.com/sanity-io/cli/issues",
@@ -43,6 +43,10 @@
43
43
  "source": "./src/_exports/preview.ts",
44
44
  "default": "./dist/_exports/preview.js"
45
45
  },
46
+ "./_internal_render": {
47
+ "source": "./src/_exports/_internal_render.ts",
48
+ "default": "./dist/_exports/_internal_render.js"
49
+ },
46
50
  "./undeploy": {
47
51
  "source": "./src/_exports/undeploy.ts",
48
52
  "default": "./dist/_exports/undeploy.js"
@@ -53,27 +57,29 @@
53
57
  "access": "public"
54
58
  },
55
59
  "dependencies": {
60
+ "@module-federation/runtime": "2.8.2",
56
61
  "@module-federation/vite": "1.20.7",
57
62
  "@sanity/types": "^6.7.0",
58
- "@vitejs/plugin-react": "^6.0.5",
63
+ "@vitejs/plugin-react": "^6.1.0",
59
64
  "form-data": "^4.0.5",
65
+ "rxjs": "^7.8.2",
60
66
  "tar-fs": "^3.1.2",
61
- "vite": "^8.2.0",
67
+ "vite": "^8.2.1",
62
68
  "zod": "^4.4.3",
63
- "@sanity/cli-core": "^3.0.0"
69
+ "@sanity/cli-core": "^3.3.0"
64
70
  },
65
71
  "devDependencies": {
66
72
  "@eslint/compat": "^2.1.0",
67
- "@sanity/pkg-utils": "^11.0.17",
73
+ "@sanity/pkg-utils": "^12.2.0",
68
74
  "@swc/cli": "^0.8.1",
69
75
  "@swc/core": "^1.15.43",
70
76
  "@types/node": "^22.20.0",
71
77
  "@types/tar-fs": "^2.0.4",
72
- "@vitest/coverage-istanbul": "^4.1.10",
78
+ "@vitest/coverage-istanbul": "^4.1.11",
73
79
  "eslint": "^10.7.0",
74
80
  "publint": "^0.3.21",
75
81
  "typescript": "^6.0.3",
76
- "vitest": "^4.1.10",
82
+ "vitest": "^4.1.11",
77
83
  "@repo/package.config": "0.0.1",
78
84
  "@repo/tsconfig": "3.70.0",
79
85
  "@sanity/eslint-config-cli": "^1.1.3"