@sanity/workbench-cli 2.0.2 → 2.2.1
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/README.md +1 -1
- package/dist/_exports/_internal_render.d.ts +12 -0
- package/dist/_exports/_internal_render.js +3 -0
- package/dist/_exports/_internal_render.js.map +1 -0
- package/dist/_exports/build.d.ts +4 -4
- package/dist/_exports/build.js +2 -1
- package/dist/_exports/build.js.map +1 -1
- package/dist/_exports/defineApp-DldjQwq6.d.ts +375 -0
- package/dist/_exports/deploy.d.ts +10 -9
- package/dist/_exports/deploy.js +1 -0
- package/dist/_exports/deploy.js.map +1 -1
- package/dist/_exports/dev.d.ts +1 -1
- package/dist/_exports/index.d.ts +23 -16
- package/dist/_exports/index.js +2 -1
- package/dist/_exports/index.js.map +1 -1
- package/dist/_exports/preview.d.ts +1 -1
- package/dist/_exports/{registry-DI7hnTof.d.ts → registry-HE_dEHFa.d.ts} +38 -15
- package/dist/_exports/resolveWorkbenchConfig-6iznHbED.d.ts +60 -0
- package/dist/_exports/{summarizeInterfaces-DBGiAwNT.d.ts → summarizeInterfaces-CjkeWwkY.d.ts} +20 -17
- package/dist/_exports/undeploy.d.ts +12 -9
- package/dist/actions/build/artifact.js +1 -1
- package/dist/actions/build/artifact.js.map +1 -1
- package/dist/actions/build/views/artifact.js +1 -1
- package/dist/actions/build/views/artifact.js.map +1 -1
- package/dist/actions/build/vite/optimize-deps.js +3 -3
- package/dist/actions/build/vite/optimize-deps.js.map +1 -1
- package/dist/actions/build/vite/plugins/plugin-module-federation.js +8 -17
- package/dist/actions/build/vite/plugins/plugin-module-federation.js.map +1 -1
- package/dist/actions/build/vite/plugins/plugin-sanity-federation-runtime.js +1 -1
- package/dist/actions/build/vite/plugins/plugin-sanity-federation-runtime.js.map +1 -1
- package/dist/actions/build/vite/workbench-vite-plugins.js +1 -1
- package/dist/actions/build/vite/workbench-vite-plugins.js.map +1 -1
- package/dist/actions/deploy/deployPayload.js +0 -3
- package/dist/actions/deploy/deployPayload.js.map +1 -1
- package/dist/actions/deploy/deployWorkbenchApp.js +46 -4
- package/dist/actions/deploy/deployWorkbenchApp.js.map +1 -1
- package/dist/actions/deploy/getWorkbench.js +4 -5
- package/dist/actions/deploy/getWorkbench.js.map +1 -1
- package/dist/actions/deploy/summarizeInterfaces.js +14 -10
- package/dist/actions/deploy/summarizeInterfaces.js.map +1 -1
- package/dist/actions/deploy/viewDeployment.js +17 -5
- package/dist/actions/deploy/viewDeployment.js.map +1 -1
- package/dist/actions/dev/deriveConfigs.js +9 -6
- package/dist/actions/dev/deriveConfigs.js.map +1 -1
- package/dist/actions/dev/exposesSetId.js +2 -2
- package/dist/actions/dev/exposesSetId.js.map +1 -1
- package/dist/actions/dev/registry.js +31 -25
- package/dist/actions/dev/registry.js.map +1 -1
- package/dist/actions/dev/startDevManifestWatcher.js.map +1 -1
- package/dist/actions/dev/startDevServerRegistration.js +35 -60
- package/dist/actions/dev/startDevServerRegistration.js.map +1 -1
- package/dist/actions/dev/startWorkbenchDevServer.js +15 -33
- package/dist/actions/dev/startWorkbenchDevServer.js.map +1 -1
- package/dist/actions/dev/writeWorkbenchRuntime.js +2 -2
- package/dist/actions/dev/writeWorkbenchRuntime.js.map +1 -1
- package/dist/actions/preview/serveBuiltApplication.js +1 -1
- package/dist/actions/preview/serveBuiltApplication.js.map +1 -1
- package/dist/actions/preview/startWorkbenchPreview.js +1 -1
- package/dist/actions/preview/startWorkbenchPreview.js.map +1 -1
- package/dist/actions/undeploy/workbenchUndeployAdapter.js +24 -33
- package/dist/actions/undeploy/workbenchUndeployAdapter.js.map +1 -1
- package/dist/appId.js +13 -9
- package/dist/appId.js.map +1 -1
- package/dist/applicationReference.js +12 -0
- package/dist/applicationReference.js.map +1 -0
- package/dist/contract.js +69 -31
- package/dist/contract.js.map +1 -1
- package/dist/defineApp.js +53 -63
- package/dist/defineApp.js.map +1 -1
- package/dist/defineView.js +3 -3
- package/dist/defineView.js.map +1 -1
- package/dist/deriveInterfaces.js +45 -19
- package/dist/deriveInterfaces.js.map +1 -1
- package/dist/renderDashboard.js +63 -0
- package/dist/renderDashboard.js.map +1 -0
- package/dist/resolveWorkbenchApp.js +13 -9
- package/dist/resolveWorkbenchApp.js.map +1 -1
- package/dist/resolveWorkbenchConfig.js +30 -0
- package/dist/resolveWorkbenchConfig.js.map +1 -0
- package/dist/services/applications.js +7 -1
- package/dist/services/applications.js.map +1 -1
- package/package.json +12 -6
- package/dist/_exports/contract-DyG11fQ7.d.ts +0 -45
- package/dist/_exports/defineApp-r_CmoZfS.d.ts +0 -169
- package/dist/_exports/resolveWorkbenchApp-DqFqET9E.d.ts +0 -41
|
@@ -42,7 +42,7 @@ export async function getApplication(applicationId) {
|
|
|
42
42
|
* Create an application record (no deployment), so the CLI can build with the
|
|
43
43
|
* returned id, then ship it via {@link createDeployment}.
|
|
44
44
|
*/ export async function createApplication(options) {
|
|
45
|
-
const { isSingleton, organizationId, projectId, slug, title, type, visibility } = options;
|
|
45
|
+
const { isSingleton, name, organizationId, projectId, slug, title, type, visibility } = options;
|
|
46
46
|
const client = await getClient();
|
|
47
47
|
return client.request({
|
|
48
48
|
body: {
|
|
@@ -50,6 +50,12 @@ export async function getApplication(applicationId) {
|
|
|
50
50
|
slug,
|
|
51
51
|
title,
|
|
52
52
|
type,
|
|
53
|
+
// Identity, distinct from the slug address. Omitted → Brett defaults it to slug.
|
|
54
|
+
...name ? {
|
|
55
|
+
name
|
|
56
|
+
} : {},
|
|
57
|
+
// Brett requires `isSingleton` on `POST /applications`, so the request
|
|
58
|
+
// builder keeps forwarding it even though the CLI itself never sets it.
|
|
53
59
|
...isSingleton === undefined ? {} : {
|
|
54
60
|
isSingleton
|
|
55
61
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/applications.ts"],"sourcesContent":["import {PassThrough} from 'node:stream'\nimport {type Gzip} from 'node:zlib'\n\nimport {type AppVisibility, getGlobalCliClient} from '@sanity/cli-core'\nimport {isStaging} from '@sanity/cli-core/util'\nimport FormData from 'form-data'\n\nimport {type AppInterfaceMetadata, type TileInterfaceMetadata} from '../contract.js'\nimport {APP_WORKBENCH_API_VERSION} from './apiVersion.js'\n\nexport type ApplicationType = 'coreApp' | 'studio'\n\nexport interface Application {\n id: string\n organizationId: string\n slug: string | null\n title: string\n type: ApplicationType\n}\n\ninterface BrettInterfaceBase {\n moduleId: string\n name: string\n title: string\n version: string\n}\n\n/**\n * An interface as Brett stores it, discriminated on `type`. `moduleId` is\n * remote-relative — the host prepends the app's id. Brett assigns the id.\n * @internal\n */\nexport type BrettInterface =\n | (BrettInterfaceBase & {metadata: AppInterfaceMetadata | null; type: 'app'})\n | (BrettInterfaceBase & {metadata: null; type: 'asset_source'})\n | (BrettInterfaceBase & {metadata: null; type: 'panel'})\n | (BrettInterfaceBase & {metadata: null; type: 'worker'})\n | (BrettInterfaceBase & {metadata: TileInterfaceMetadata; type: 'tile'})\n\n/**\n * A resource a deployment may interact with, as Brett stores it. Per-deployment\n * and forbidden for singletons (the server 400s).\n */\nexport interface BrettAccess {\n resourceId: string\n resourceType: 'canvas' | 'dashboard' | 'dataset' | 'media-library'\n}\n\n/** A studio workspace as Brett stores it. */\nexport interface BrettWorkspace {\n dataset: string\n projectId: string\n /** Lexicon schema descriptor id; Brett requires one per workspace. */\n schemaDescriptorId: string\n\n basePath?: string\n icon?: string\n name?: string\n subtitle?: string\n title?: string\n}\n\nexport function getWorkbenchUrl(organizationId: string): string {\n return `https://${organizationId}.${isStaging() ? 'run.sanity.work' : 'sanity.run'}`\n}\n\n/** Where a deployed application is served on its organization's workbench. */\nexport function getApplicationUrl(\n application: Pick<Application, 'id' | 'organizationId' | 'type'>,\n): string {\n const segment = application.type === 'studio' ? 'studio' : 'application'\n return `${getWorkbenchUrl(application.organizationId)}/${segment}/${application.id}`\n}\n\nasync function getClient() {\n return getGlobalCliClient({apiVersion: APP_WORKBENCH_API_VERSION, requireUser: true})\n}\n\nexport async function getApplication(applicationId: string): Promise<Application | null> {\n const client = await getClient()\n try {\n return await client.request({url: `/applications/${applicationId}`})\n } catch (err) {\n if ((err as {statusCode?: number})?.statusCode === 404) return null\n throw err\n }\n}\n\n/** Every application in an organization, in one page (`limit=none`). */\nexport async function listApplications(organizationId: string): Promise<Application[]> {\n const client = await getClient()\n const {data}: {data: Application[]} = await client.request({\n query: {limit: 'none', organizationId},\n url: '/applications',\n })\n return data\n}\n\n/**\n * Create an application record (no deployment), so the CLI can build with the\n * returned id, then ship it via {@link createDeployment}.\n */\nexport async function createApplication(options: {\n isSingleton?: boolean\n organizationId: string\n projectId?: string\n slug: string\n title: string\n type: ApplicationType\n visibility?: AppVisibility\n}): Promise<Application> {\n const {isSingleton, organizationId, projectId, slug, title, type, visibility} = options\n const client = await getClient()\n return client.request({\n body: {\n organizationId,\n slug,\n title,\n type,\n ...(isSingleton === undefined ? {} : {isSingleton}),\n ...(visibility ? {visibility} : {}),\n // Studio config is set once, at create — it's immutable on redeploy.\n ...(projectId ? {config: {studio: {projectId}}} : {}),\n },\n method: 'POST',\n url: `/applications`,\n })\n}\n\n/** Mutable application fields the deploy flow patches after create. */\nexport interface ApplicationUpdate {\n icon?: string | null\n title?: string\n visibility?: AppVisibility\n}\n\n// Patch an application's mutable fields.\nexport async function updateApplication(\n applicationId: string,\n update: ApplicationUpdate,\n): Promise<void> {\n const client = await getClient()\n await client.request({body: update, method: 'PATCH', url: `/applications/${applicationId}`})\n}\n\n/** Deploy a new active version to an existing application. */\nexport async function createDeployment(options: {\n access?: readonly BrettAccess[]\n applicationId: string\n interfaces: readonly BrettInterface[]\n isAutoUpdating: boolean\n tarball: Gzip\n version: string\n workspaces?: readonly BrettWorkspace[]\n}): Promise<{id: string}> {\n const {access, applicationId, interfaces, isAutoUpdating, tarball, version, workspaces} = options\n const formData = new FormData()\n formData.append('isAutoUpdating', isAutoUpdating.toString())\n appendDeploymentParts(formData, {access, interfaces, tarball, version, workspaces})\n return request(`/applications/${applicationId}/deployments`, formData)\n}\n\n/** Soft-deletes the application and all its deployments; already deleted counts as done. */\nexport async function deleteApplication(applicationId: string): Promise<void> {\n const client = await getClient()\n try {\n await client.request({method: 'DELETE', url: `/applications/${applicationId}`})\n } catch (err) {\n if ((err as {statusCode?: number})?.statusCode !== 404) throw err\n }\n}\n\nfunction appendDeploymentParts(\n formData: FormData,\n {\n access,\n interfaces,\n tarball,\n version,\n workspaces,\n }: {\n access?: readonly BrettAccess[]\n interfaces: readonly BrettInterface[]\n tarball: Gzip\n version: string\n workspaces?: readonly BrettWorkspace[]\n },\n): void {\n formData.append('version', version)\n appendJson(formData, 'interfaces', interfaces)\n // Studio-only — the server rejects a workspaces part on non-studio types.\n if (workspaces?.length) appendJson(formData, 'workspaces', workspaces)\n // Per-deployment; forbidden for singletons, so callers omit it there.\n if (access?.length) appendJson(formData, 'access', access)\n formData.append('tarball', tarball, {contentType: 'application/gzip', filename: 'app.tar.gz'})\n}\n\n/** Structured parts must arrive as JSON so the server parses them. */\nfunction appendJson(formData: FormData, name: string, value: unknown): void {\n formData.append(name, JSON.stringify(value), {contentType: 'application/json'})\n}\n\nasync function request<T>(url: string, formData: FormData): Promise<T> {\n const client = await getClient()\n return client.request({\n body: formData.pipe(new PassThrough()),\n headers: formData.getHeaders(),\n method: 'POST',\n url,\n })\n}\n"],"names":["PassThrough","getGlobalCliClient","isStaging","FormData","APP_WORKBENCH_API_VERSION","getWorkbenchUrl","organizationId","getApplicationUrl","application","segment","type","id","getClient","apiVersion","requireUser","getApplication","applicationId","client","request","url","err","statusCode","listApplications","data","query","limit","createApplication","options","isSingleton","projectId","slug","title","visibility","body","undefined","config","studio","method","updateApplication","update","createDeployment","access","interfaces","isAutoUpdating","tarball","version","workspaces","formData","append","toString","appendDeploymentParts","deleteApplication","appendJson","length","contentType","filename","name","value","JSON","stringify","pipe","headers","getHeaders"],"mappings":"AAAA,SAAQA,WAAW,QAAO,cAAa;AAGvC,SAA4BC,kBAAkB,QAAO,mBAAkB;AACv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DC,SAASC,MAAM,CAAC,WAAWH;IAC3BO,WAAWL,UAAU,cAAcL;IACnC,0EAA0E;IAC1E,IAAII,YAAYO,QAAQD,WAAWL,UAAU,cAAcD;IAC3D,sEAAsE;IACtE,IAAIL,QAAQY,QAAQD,WAAWL,UAAU,UAAUN;IACnDM,SAASC,MAAM,CAAC,WAAWJ,SAAS;QAACU,aAAa;QAAoBC,UAAU;IAAY;AAC9F;AAEA,oEAAoE,GACpE,SAASH,WAAWL,QAAkB,EAAES,IAAY,EAAEC,KAAc;IAClEV,SAASC,MAAM,CAACQ,MAAME,KAAKC,SAAS,CAACF,QAAQ;QAACH,aAAa;IAAkB;AAC/E;AAEA,eAAepC,QAAWC,GAAW,EAAE4B,QAAkB;IACvD,MAAM9B,SAAS,MAAML;IACrB,OAAOK,OAAOC,OAAO,CAAC;QACpBe,MAAMc,SAASa,IAAI,CAAC,IAAI5D;QACxB6D,SAASd,SAASe,UAAU;QAC5BzB,QAAQ;QACRlB;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/services/applications.ts"],"sourcesContent":["import {PassThrough} from 'node:stream'\nimport {type Gzip} from 'node:zlib'\n\nimport {type AppVisibility, getGlobalCliClient} from '@sanity/cli-core'\nimport {isStaging} from '@sanity/cli-core/util'\nimport FormData from 'form-data'\n\nimport {type TileInterfaceMetadata, type ViewPlacementMetadata} from '../contract.js'\nimport {APP_WORKBENCH_API_VERSION} from './apiVersion.js'\n\nexport type ApplicationType = 'coreApp' | 'studio'\n\nexport interface Application {\n id: string\n organizationId: string\n slug: string | null\n title: string\n type: ApplicationType\n}\n\ninterface BrettInterfaceBase {\n moduleId: string\n name: string\n title: string\n version: string\n}\n\n/**\n * An interface as Brett stores it, discriminated on `type`. `moduleId` is\n * remote-relative — the host prepends the app's id. Brett assigns the id.\n * @internal\n */\nexport type BrettInterface =\n | (BrettInterfaceBase & {metadata: null; type: 'asset_source'})\n | (BrettInterfaceBase & {metadata: null; type: 'worker'})\n | (BrettInterfaceBase & {metadata: TileInterfaceMetadata; type: 'tile'})\n | (BrettInterfaceBase & {metadata: ViewPlacementMetadata | null; type: 'app'})\n | (BrettInterfaceBase & {metadata: ViewPlacementMetadata | null; type: 'panel'})\n\n/**\n * A resource a deployment may interact with, as Brett stores it. Per-deployment\n * and forbidden for singletons (the server 400s).\n */\nexport interface BrettAccess {\n resourceId: string\n resourceType: 'canvas' | 'dashboard' | 'dataset' | 'media-library'\n}\n\n/** A studio workspace as Brett stores it. */\nexport interface BrettWorkspace {\n dataset: string\n projectId: string\n /** Lexicon schema descriptor id; Brett requires one per workspace. */\n schemaDescriptorId: string\n\n basePath?: string\n icon?: string\n name?: string\n subtitle?: string\n title?: string\n}\n\nexport function getWorkbenchUrl(organizationId: string): string {\n return `https://${organizationId}.${isStaging() ? 'run.sanity.work' : 'sanity.run'}`\n}\n\n/** Where a deployed application is served on its organization's workbench. */\nexport function getApplicationUrl(\n application: Pick<Application, 'id' | 'organizationId' | 'type'>,\n): string {\n const segment = application.type === 'studio' ? 'studio' : 'application'\n return `${getWorkbenchUrl(application.organizationId)}/${segment}/${application.id}`\n}\n\nasync function getClient() {\n return getGlobalCliClient({apiVersion: APP_WORKBENCH_API_VERSION, requireUser: true})\n}\n\nexport async function getApplication(applicationId: string): Promise<Application | null> {\n const client = await getClient()\n try {\n return await client.request({url: `/applications/${applicationId}`})\n } catch (err) {\n if ((err as {statusCode?: number})?.statusCode === 404) return null\n throw err\n }\n}\n\n/** Every application in an organization, in one page (`limit=none`). */\nexport async function listApplications(organizationId: string): Promise<Application[]> {\n const client = await getClient()\n const {data}: {data: Application[]} = await client.request({\n query: {limit: 'none', organizationId},\n url: '/applications',\n })\n return data\n}\n\n/**\n * Create an application record (no deployment), so the CLI can build with the\n * returned id, then ship it via {@link createDeployment}.\n */\nexport async function createApplication(options: {\n isSingleton?: boolean\n name?: string\n organizationId: string\n projectId?: string\n slug: string\n title: string\n type: ApplicationType\n visibility?: AppVisibility\n}): Promise<Application> {\n const {isSingleton, name, organizationId, projectId, slug, title, type, visibility} = options\n const client = await getClient()\n return client.request({\n body: {\n organizationId,\n slug,\n title,\n type,\n // Identity, distinct from the slug address. Omitted → Brett defaults it to slug.\n ...(name ? {name} : {}),\n // Brett requires `isSingleton` on `POST /applications`, so the request\n // builder keeps forwarding it even though the CLI itself never sets it.\n ...(isSingleton === undefined ? {} : {isSingleton}),\n ...(visibility ? {visibility} : {}),\n // Studio config is set once, at create — it's immutable on redeploy.\n ...(projectId ? {config: {studio: {projectId}}} : {}),\n },\n method: 'POST',\n url: `/applications`,\n })\n}\n\n/** Mutable application fields the deploy flow patches after create. */\nexport interface ApplicationUpdate {\n icon?: string | null\n title?: string\n visibility?: AppVisibility\n}\n\n// Patch an application's mutable fields.\nexport async function updateApplication(\n applicationId: string,\n update: ApplicationUpdate,\n): Promise<void> {\n const client = await getClient()\n await client.request({body: update, method: 'PATCH', url: `/applications/${applicationId}`})\n}\n\n/** Deploy a new active version to an existing application. */\nexport async function createDeployment(options: {\n access?: readonly BrettAccess[]\n applicationId: string\n interfaces: readonly BrettInterface[]\n isAutoUpdating: boolean\n tarball: Gzip\n version: string\n workspaces?: readonly BrettWorkspace[]\n}): Promise<{id: string}> {\n const {access, applicationId, interfaces, isAutoUpdating, tarball, version, workspaces} = options\n const formData = new FormData()\n formData.append('isAutoUpdating', isAutoUpdating.toString())\n appendDeploymentParts(formData, {access, interfaces, tarball, version, workspaces})\n return request(`/applications/${applicationId}/deployments`, formData)\n}\n\n/** Soft-deletes the application and all its deployments; already deleted counts as done. */\nexport async function deleteApplication(applicationId: string): Promise<void> {\n const client = await getClient()\n try {\n await client.request({method: 'DELETE', url: `/applications/${applicationId}`})\n } catch (err) {\n if ((err as {statusCode?: number})?.statusCode !== 404) throw err\n }\n}\n\nfunction appendDeploymentParts(\n formData: FormData,\n {\n access,\n interfaces,\n tarball,\n version,\n workspaces,\n }: {\n access?: readonly BrettAccess[]\n interfaces: readonly BrettInterface[]\n tarball: Gzip\n version: string\n workspaces?: readonly BrettWorkspace[]\n },\n): void {\n formData.append('version', version)\n appendJson(formData, 'interfaces', interfaces)\n // Studio-only — the server rejects a workspaces part on non-studio types.\n if (workspaces?.length) appendJson(formData, 'workspaces', workspaces)\n // Per-deployment; forbidden for singletons, so callers omit it there.\n if (access?.length) appendJson(formData, 'access', access)\n formData.append('tarball', tarball, {contentType: 'application/gzip', filename: 'app.tar.gz'})\n}\n\n/** Structured parts must arrive as JSON so the server parses them. */\nfunction appendJson(formData: FormData, name: string, value: unknown): void {\n formData.append(name, JSON.stringify(value), {contentType: 'application/json'})\n}\n\nasync function request<T>(url: string, formData: FormData): Promise<T> {\n const client = await getClient()\n return client.request({\n body: formData.pipe(new PassThrough()),\n headers: formData.getHeaders(),\n method: 'POST',\n url,\n })\n}\n"],"names":["PassThrough","getGlobalCliClient","isStaging","FormData","APP_WORKBENCH_API_VERSION","getWorkbenchUrl","organizationId","getApplicationUrl","application","segment","type","id","getClient","apiVersion","requireUser","getApplication","applicationId","client","request","url","err","statusCode","listApplications","data","query","limit","createApplication","options","isSingleton","name","projectId","slug","title","visibility","body","undefined","config","studio","method","updateApplication","update","createDeployment","access","interfaces","isAutoUpdating","tarball","version","workspaces","formData","append","toString","appendDeploymentParts","deleteApplication","appendJson","length","contentType","filename","value","JSON","stringify","pipe","headers","getHeaders"],"mappings":"AAAA,SAAQA,WAAW,QAAO,cAAa;AAGvC,SAA4BC,kBAAkB,QAAO,mBAAkB;AACvE,SAAQC,SAAS,QAAO,wBAAuB;AAC/C,OAAOC,cAAc,YAAW;AAGhC,SAAQC,yBAAyB,QAAO,kBAAiB;AAsDzD,OAAO,SAASC,gBAAgBC,cAAsB;IACpD,OAAO,CAAC,QAAQ,EAAEA,eAAe,CAAC,EAAEJ,cAAc,oBAAoB,cAAc;AACtF;AAEA,4EAA4E,GAC5E,OAAO,SAASK,kBACdC,WAAgE;IAEhE,MAAMC,UAAUD,YAAYE,IAAI,KAAK,WAAW,WAAW;IAC3D,OAAO,GAAGL,gB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;QAACU,aAAa;QAAoBC,UAAU;IAAY;AAC9F;AAEA,oEAAoE,GACpE,SAASH,WAAWL,QAAkB,EAAEnB,IAAY,EAAE4B,KAAc;IAClET,SAASC,MAAM,CAACpB,MAAM6B,KAAKC,SAAS,CAACF,QAAQ;QAACF,aAAa;IAAkB;AAC/E;AAEA,eAAerC,QAAWC,GAAW,EAAE6B,QAAkB;IACvD,MAAM/B,SAAS,MAAML;IACrB,OAAOK,OAAOC,OAAO,CAAC;QACpBgB,MAAMc,SAASY,IAAI,CAAC,IAAI5D;QACxB6D,SAASb,SAASc,UAAU;QAC5BxB,QAAQ;QACRnB;IACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/workbench-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.1",
|
|
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
|
|
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
67
|
"vite": "^8.2.1",
|
|
62
68
|
"zod": "^4.4.3",
|
|
63
|
-
"@sanity/cli-core": "^3.
|
|
69
|
+
"@sanity/cli-core": "^3.4.0"
|
|
64
70
|
},
|
|
65
71
|
"devDependencies": {
|
|
66
72
|
"@eslint/compat": "^2.1.0",
|
|
67
|
-
"@sanity/pkg-utils": "^12.
|
|
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.
|
|
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.
|
|
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"
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini";
|
|
2
|
-
/** @internal */
|
|
3
|
-
declare const VIEW_CONTRACT_VERSION = 1;
|
|
4
|
-
/** @internal */
|
|
5
|
-
declare const SERVICE_CONTRACT_VERSION = 1;
|
|
6
|
-
/**
|
|
7
|
-
* A view component. The return is opaque so the runtime helpers carry no React
|
|
8
|
-
* dependency — the generated artifact renders it with the app's own React.
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
type ViewComponent<TProps> = (props: TProps) => unknown;
|
|
12
|
-
/** @public */
|
|
13
|
-
interface ViewComponentBaseProps<TView> {
|
|
14
|
-
view: TView;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Component slots each interface type exposes, in render order. Source of truth
|
|
18
|
-
* for {@link InterfaceType} and the build; add a type by registering it here.
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
declare const VIEW_COMPONENTS: {
|
|
22
|
-
readonly asset_source: readonly ["asset_source"];
|
|
23
|
-
readonly panel: readonly ["title", "panel"];
|
|
24
|
-
readonly tile: readonly ["tile"];
|
|
25
|
-
};
|
|
26
|
-
/** @public */
|
|
27
|
-
type InterfaceType = keyof typeof VIEW_COMPONENTS;
|
|
28
|
-
/**
|
|
29
|
-
* A tile's footprint family — the shape it occupies on the dashboard. Modelled
|
|
30
|
-
* on iOS WidgetKit families, not a linear scale: `banner` is full-width and
|
|
31
|
-
* shallow, which a `small`→`large` magnitude can't express. The host maps a
|
|
32
|
-
* family to a layout slot; the component reads it to render per footprint.
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
declare const TileSizeSchema: z.ZodMiniEnum<{
|
|
36
|
-
small: "small";
|
|
37
|
-
large: "large";
|
|
38
|
-
banner: "banner";
|
|
39
|
-
}>;
|
|
40
|
-
/** @public */
|
|
41
|
-
type TileSize = z.infer<typeof TileSizeSchema>;
|
|
42
|
-
/** @public */
|
|
43
|
-
type ServiceType = 'worker';
|
|
44
|
-
export { VIEW_CONTRACT_VERSION as a, TileSize as i, SERVICE_CONTRACT_VERSION as n, ViewComponent as o, ServiceType as r, ViewComponentBaseProps as s, InterfaceType as t };
|
|
45
|
-
//# sourceMappingURL=contract-DyG11fQ7.d.ts.map
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/mini";
|
|
2
|
-
/** Dock groups an app can place itself into. */
|
|
3
|
-
declare const DockGroupSchema: z.ZodMiniEnum<{
|
|
4
|
-
"dock.system": "dock.system";
|
|
5
|
-
"dock.applications": "dock.applications";
|
|
6
|
-
"dock.user": "dock.user";
|
|
7
|
-
}>;
|
|
8
|
-
/**
|
|
9
|
-
* Dock group identifier. The API does not block a user app from declaring a
|
|
10
|
-
* reserved group (e.g. `dock.system`); priority conventions keep Sanity-owned
|
|
11
|
-
* apps ahead.
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
type DockGroup = z.output<typeof DockGroupSchema>;
|
|
15
|
-
/**
|
|
16
|
-
* Runtime-validation schema for `unstable_defineApp`.
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
declare const DefineAppInputSchema: z.ZodMiniObject<{
|
|
20
|
-
applicationType: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
21
|
-
coreApp: "coreApp";
|
|
22
|
-
studio: "studio";
|
|
23
|
-
canvas: "canvas";
|
|
24
|
-
dashboard: "dashboard";
|
|
25
|
-
"media-library": "media-library";
|
|
26
|
-
}>>;
|
|
27
|
-
config: z.ZodMiniOptional<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
28
|
-
appType: z.ZodMiniLiteral<"media-library">;
|
|
29
|
-
fields: z.ZodMiniArray<z.ZodMiniObject<{
|
|
30
|
-
public: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
31
|
-
title: z.ZodMiniString<string>;
|
|
32
|
-
name: z.ZodMiniString<string>;
|
|
33
|
-
src: z.ZodMiniString<string>;
|
|
34
|
-
}, z.core.$strip>>;
|
|
35
|
-
}, z.core.$strip>], "appType">>;
|
|
36
|
-
entry: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
37
|
-
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
38
|
-
"dock.system": "dock.system";
|
|
39
|
-
"dock.applications": "dock.applications";
|
|
40
|
-
"dock.user": "dock.user";
|
|
41
|
-
}>>;
|
|
42
|
-
icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
43
|
-
isSingleton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
44
|
-
organizationId: z.ZodMiniString<string>;
|
|
45
|
-
priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
46
|
-
services: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
47
|
-
title: z.ZodMiniString<string>;
|
|
48
|
-
name: z.ZodMiniString<string>;
|
|
49
|
-
src: z.ZodMiniString<string>;
|
|
50
|
-
type: z.ZodMiniLiteral<"worker">;
|
|
51
|
-
}, z.core.$strip>], "type">>>;
|
|
52
|
-
slug: z.ZodMiniString<string>;
|
|
53
|
-
title: z.ZodMiniString<string>;
|
|
54
|
-
views: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
55
|
-
title: z.ZodMiniString<string>;
|
|
56
|
-
name: z.ZodMiniString<string>;
|
|
57
|
-
src: z.ZodMiniString<string>;
|
|
58
|
-
type: z.ZodMiniLiteral<"panel">;
|
|
59
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
60
|
-
title: z.ZodMiniString<string>;
|
|
61
|
-
name: z.ZodMiniString<string>;
|
|
62
|
-
src: z.ZodMiniString<string>;
|
|
63
|
-
type: z.ZodMiniLiteral<"asset_source">;
|
|
64
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
65
|
-
priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
66
|
-
size: z.ZodMiniEnum<{
|
|
67
|
-
small: "small";
|
|
68
|
-
large: "large";
|
|
69
|
-
banner: "banner";
|
|
70
|
-
}>;
|
|
71
|
-
title: z.ZodMiniString<string>;
|
|
72
|
-
name: z.ZodMiniString<string>;
|
|
73
|
-
src: z.ZodMiniString<string>;
|
|
74
|
-
type: z.ZodMiniLiteral<"tile">;
|
|
75
|
-
}, z.core.$strip>], "type">>>;
|
|
76
|
-
visibility: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
77
|
-
default: "default";
|
|
78
|
-
unlisted: "unlisted";
|
|
79
|
-
disabled: "disabled";
|
|
80
|
-
}>>;
|
|
81
|
-
}, z.core.$strip>;
|
|
82
|
-
/** The `asset_source` variant of an app's `views`. @public */
|
|
83
|
-
type AssetSourceView = Extract<NonNullable<z.output<typeof DefineAppInputSchema>['views']>[number], {
|
|
84
|
-
type: 'asset_source';
|
|
85
|
-
}>;
|
|
86
|
-
/** The `tile` variant of an app's `views`. @public */
|
|
87
|
-
type TileView = Extract<NonNullable<z.output<typeof DefineAppInputSchema>['views']>[number], {
|
|
88
|
-
type: 'tile';
|
|
89
|
-
}>;
|
|
90
|
-
/**
|
|
91
|
-
* User-facing input for `unstable_defineApp`. Excludes the internal
|
|
92
|
-
* `applicationType`, `isSingleton`, and `config` — validated by the schema but
|
|
93
|
-
* not part of the public surface (Sanity-owned apps set them via
|
|
94
|
-
* `@ts-expect-error`). A union: an app declares an app `entry` (navigable) or
|
|
95
|
-
* panel `views`, never both — but `asset_source` and `tile` views are separate
|
|
96
|
-
* kinds and may accompany either.
|
|
97
|
-
* @public
|
|
98
|
-
*/
|
|
99
|
-
type DefineAppInput = Omit<z.output<typeof DefineAppInputSchema>, 'applicationType' | 'config' | 'entry' | 'isSingleton' | 'views'> & ({
|
|
100
|
-
entry?: never;
|
|
101
|
-
views?: NonNullable<z.output<typeof DefineAppInputSchema>['views']>;
|
|
102
|
-
} | {
|
|
103
|
-
entry?: string;
|
|
104
|
-
views?: (AssetSourceView | TileView)[];
|
|
105
|
-
});
|
|
106
|
-
/**
|
|
107
|
-
* Nominal brand the CLI discriminates on to enable the workbench build/deploy
|
|
108
|
-
* codepath. Registered via `Symbol.for` so the marker survives module-realm
|
|
109
|
-
* boundaries — `@sanity/cli-core` re-derives the same global symbol with
|
|
110
|
-
* `Symbol.for` rather than importing it, so it stays internal to this module.
|
|
111
|
-
*/
|
|
112
|
-
declare const WORKBENCH_APP: unique symbol;
|
|
113
|
-
/**
|
|
114
|
-
* The branded result of `unstable_defineApp`. Carries the same fields as the
|
|
115
|
-
* input plus the internal brand — users only ever see `DefineAppInput`.
|
|
116
|
-
* @public
|
|
117
|
-
*/
|
|
118
|
-
type DefineAppResult = DefineAppInput & {
|
|
119
|
-
readonly [WORKBENCH_APP]: true;
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* A branded app as the CLI reads it — the full schema shape, including the
|
|
123
|
-
* internal fields `DefineAppInput` omits. Schema-derived so the narrowing
|
|
124
|
-
* can't drift from what the schema validates.
|
|
125
|
-
* @public
|
|
126
|
-
*/
|
|
127
|
-
type WorkbenchApp = DefineAppResult & z.output<typeof DefineAppInputSchema>;
|
|
128
|
-
/**
|
|
129
|
-
* Whether `app` is a branded `unstable_defineApp(...)` result — the sole
|
|
130
|
-
* workbench opt-in.
|
|
131
|
-
* @public
|
|
132
|
-
*/
|
|
133
|
-
declare function isWorkbenchApp(app: unknown): app is WorkbenchApp;
|
|
134
|
-
/**
|
|
135
|
-
* Declare a Sanity Workbench application. Identity at runtime — returns the same
|
|
136
|
-
* object reference, tagged with the workbench brand. Field validation (the
|
|
137
|
-
* `slug` pattern etc.) runs at build time in the CLI via `DefineAppInputSchema`;
|
|
138
|
-
* this helper stays a thin, pure identity wrapper.
|
|
139
|
-
* @public
|
|
140
|
-
*/
|
|
141
|
-
declare function unstable_defineApp(input: DefineAppInput): DefineAppResult;
|
|
142
|
-
/**
|
|
143
|
-
* One custom field a media library exposes. `src` default-exports a `defineField(...)` schema type.
|
|
144
|
-
* @public
|
|
145
|
-
*/
|
|
146
|
-
interface MediaLibraryField {
|
|
147
|
-
/** Unique within the media library. */
|
|
148
|
-
name: string;
|
|
149
|
-
src: string;
|
|
150
|
-
title: string;
|
|
151
|
-
/** Readable outside the owning organization. */
|
|
152
|
-
public?: boolean;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Sanity-owned singleton, so authors don't name or title the app — only `organizationId` is required.
|
|
156
|
-
* @public
|
|
157
|
-
*/
|
|
158
|
-
interface DefineMediaLibraryInput {
|
|
159
|
-
/** Organization that owns the media library — the CLI runs and deploys against it. */
|
|
160
|
-
organizationId: string;
|
|
161
|
-
fields?: MediaLibraryField[];
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Declare the Sanity Media Library as a workbench app — a singleton whose `fields` become its config.
|
|
165
|
-
* @public
|
|
166
|
-
*/
|
|
167
|
-
declare function unstable_defineMediaLibrary(input: DefineMediaLibraryInput): DefineAppResult;
|
|
168
|
-
export { MediaLibraryField as a, unstable_defineApp as c, DockGroup as i, unstable_defineMediaLibrary as l, DefineAppResult as n, WorkbenchApp as o, DefineMediaLibraryInput as r, isWorkbenchApp as s, DefineAppInput as t };
|
|
169
|
-
//# sourceMappingURL=defineApp-r_CmoZfS.d.ts.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { o as WorkbenchApp, t as DefineAppInput } from "./defineApp-r_CmoZfS.js";
|
|
2
|
-
import { AppVisibility, CliConfig } from "@sanity/cli-core";
|
|
3
|
-
/**
|
|
4
|
-
* Bundled so adding a declaration family touches this type and the artifact
|
|
5
|
-
* expanders, not every hop of build/dev plumbing in between.
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
interface WorkbenchExposes {
|
|
9
|
-
config?: WorkbenchApp['config'];
|
|
10
|
-
services?: DefineAppInput['services'];
|
|
11
|
-
views?: DefineAppInput['views'];
|
|
12
|
-
}
|
|
13
|
-
/** @public */
|
|
14
|
-
interface ResolvedWorkbenchApp {
|
|
15
|
-
/** Organization that owns the app — part of its build-id identity. */
|
|
16
|
-
readonly organizationId: string;
|
|
17
|
-
/** Background worker services the app declares. */
|
|
18
|
-
readonly services: NonNullable<DefineAppInput['services']>;
|
|
19
|
-
readonly slug: string;
|
|
20
|
-
/** Dock panel views the app declares. */
|
|
21
|
-
readonly views: NonNullable<DefineAppInput['views']>;
|
|
22
|
-
/** Resolved app kind — `studio` or one of the SDK app types. */
|
|
23
|
-
readonly applicationType?: string;
|
|
24
|
-
/** Deploys on its own path, separate from the interfaces. */
|
|
25
|
-
readonly config?: WorkbenchApp['config'];
|
|
26
|
-
/** SDK app-view entrypoint, when declared. */
|
|
27
|
-
readonly entry?: string;
|
|
28
|
-
/** Path to the app's icon SVG, resolved and shipped to Brett on deploy. */
|
|
29
|
-
readonly icon?: string;
|
|
30
|
-
/** Explicit singleton flag (a Sanity-owned app); `undefined` when the app doesn't set it. */
|
|
31
|
-
readonly isSingleton?: boolean;
|
|
32
|
-
/** Dashboard visibility declared by the app; `undefined` when unset. */
|
|
33
|
-
readonly visibility?: AppVisibility;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Resolve the workbench app for a CLI config, or `null` for a plain project.
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
declare function resolveWorkbenchApp(cliConfig: CliConfig | null | undefined): ResolvedWorkbenchApp | null;
|
|
40
|
-
export { WorkbenchExposes as n, resolveWorkbenchApp as r, ResolvedWorkbenchApp as t };
|
|
41
|
-
//# sourceMappingURL=resolveWorkbenchApp-DqFqET9E.d.ts.map
|