@sanity/workbench-cli 2.1.0 → 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/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-DLsq6P43.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 +1 -2
- 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 +3 -3
- package/dist/actions/dev/startWorkbenchDevServer.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 +52 -59
- 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/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 +2 -2
- package/dist/_exports/contract-DyG11fQ7.d.ts +0 -45
- package/dist/_exports/defineApp-DSvQx8rf.d.ts +0 -151
- package/dist/_exports/resolveWorkbenchApp-Be9eU8mu.d.ts +0 -41
package/dist/deriveInterfaces.js
CHANGED
|
@@ -14,47 +14,73 @@ import { isWorkbenchApp } from './defineApp.js';
|
|
|
14
14
|
throw new Error('App views for studios are not implemented yet');
|
|
15
15
|
}
|
|
16
16
|
const entry = isApp ? app.entry : GENERATED_ENTRY;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
// Identity, not address: interface ids and the app-view name key on `name`
|
|
18
|
+
// (which defaults to `slug`, so existing apps derive byte-identical ids).
|
|
19
|
+
const appName = app.name ?? app.slug;
|
|
20
|
+
const shared = (kind, declaration)=>({
|
|
21
|
+
id: `${appName}-${kind}-${declaration.name}`,
|
|
22
|
+
moduleId: interfaceModuleId(kind, declaration.name),
|
|
20
23
|
name: declaration.name,
|
|
21
24
|
src: declaration.src,
|
|
22
25
|
title: declaration.title,
|
|
23
|
-
|
|
24
|
-
version: interfaceContractVersion(type)
|
|
26
|
+
version: interfaceContractVersion(kind)
|
|
25
27
|
});
|
|
28
|
+
const placementMetadata = (dock)=>{
|
|
29
|
+
const group = dock?.group ?? app.dock?.group;
|
|
30
|
+
const order = dock?.order ?? app.dock?.order;
|
|
31
|
+
if (group === undefined && order === undefined) return null;
|
|
32
|
+
return {
|
|
33
|
+
dock: {
|
|
34
|
+
...group === undefined ? {} : {
|
|
35
|
+
group
|
|
36
|
+
},
|
|
37
|
+
...order === undefined ? {} : {
|
|
38
|
+
order
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
};
|
|
26
43
|
return [
|
|
27
44
|
...(app.views ?? []).map((view)=>{
|
|
28
|
-
|
|
29
|
-
// (required) and an optional sort `priority`. Both authored top-level.
|
|
30
|
-
if (view.type === 'tile') {
|
|
45
|
+
if (view.surface === 'tile') {
|
|
31
46
|
return {
|
|
32
|
-
...shared(view.
|
|
33
|
-
metadata: view.
|
|
47
|
+
...shared(view.surface, view),
|
|
48
|
+
metadata: view.order === undefined ? {
|
|
34
49
|
size: view.size
|
|
35
50
|
} : {
|
|
36
|
-
|
|
51
|
+
order: view.order,
|
|
37
52
|
size: view.size
|
|
38
|
-
}
|
|
53
|
+
},
|
|
54
|
+
surface: view.surface
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (view.surface === 'app' || view.surface === 'panel') {
|
|
58
|
+
return {
|
|
59
|
+
...shared(view.surface, view),
|
|
60
|
+
metadata: placementMetadata(view.dock),
|
|
61
|
+
surface: view.surface
|
|
39
62
|
};
|
|
40
63
|
}
|
|
41
64
|
return {
|
|
42
|
-
...shared(view.
|
|
43
|
-
metadata: null
|
|
65
|
+
...shared(view.surface, view),
|
|
66
|
+
metadata: null,
|
|
67
|
+
surface: view.surface
|
|
44
68
|
};
|
|
45
69
|
}),
|
|
46
|
-
...(app.
|
|
47
|
-
...shared('worker',
|
|
48
|
-
metadata: null
|
|
70
|
+
...(app.webWorkers ?? []).map((webWorker)=>({
|
|
71
|
+
...shared('worker', webWorker),
|
|
72
|
+
metadata: null,
|
|
73
|
+
type: 'worker'
|
|
49
74
|
})),
|
|
50
75
|
...entry === undefined ? [] : [
|
|
51
76
|
{
|
|
52
77
|
...shared('app', {
|
|
53
|
-
name:
|
|
78
|
+
name: appName,
|
|
54
79
|
src: entry,
|
|
55
80
|
title: appTitle ?? app.title
|
|
56
81
|
}),
|
|
57
|
-
metadata:
|
|
82
|
+
metadata: placementMetadata(),
|
|
83
|
+
surface: 'app'
|
|
58
84
|
}
|
|
59
85
|
]
|
|
60
86
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/deriveInterfaces.ts"],"sourcesContent":["import {type CliConfig} from '@sanity/cli-core'\n\nimport {FEDERATION_FILE_NAME, RUNTIME_DIR} from './actions/build/vite/constants.js'\nimport {\n type
|
|
1
|
+
{"version":3,"sources":["../src/deriveInterfaces.ts"],"sourcesContent":["import {type CliConfig} from '@sanity/cli-core'\n\nimport {FEDERATION_FILE_NAME, RUNTIME_DIR} from './actions/build/vite/constants.js'\nimport {\n type Dock,\n interfaceContractVersion,\n type InterfaceKind,\n interfaceModuleId,\n type TileInterfaceMetadata,\n type ViewPlacementMetadata,\n} from './contract.js'\nimport {isWorkbenchApp} from './defineApp.js'\n\n/** What a studio exposes as `./App` — the generated entry that renders `sanity.config.ts`. */\nconst GENERATED_ENTRY = `./${RUNTIME_DIR}/${FEDERATION_FILE_NAME}.jsx`\n\ninterface DerivedInterfaceBase {\n /** CLI-minted for a local interface; a deployed one gets its id from Brett. */\n id: string\n moduleId: string\n name: string\n src: string\n title: string\n\n version?: string\n}\n\n/** @internal */\nexport type DerivedInterface =\n | (DerivedInterfaceBase & {metadata: null; surface: 'asset_source'})\n | (DerivedInterfaceBase & {metadata: null; type: 'worker'})\n | (DerivedInterfaceBase & {metadata: TileInterfaceMetadata; surface: 'tile'})\n | (DerivedInterfaceBase & {metadata: ViewPlacementMetadata | null; surface: 'app'})\n | (DerivedInterfaceBase & {metadata: ViewPlacementMetadata | null; surface: 'panel'})\n\n/**\n * `appTitle` titles the app view where a deploy resolved one through `--title`;\n * dev takes it from the config.\n * @internal\n */\nexport function deriveInterfaces(\n app: CliConfig['app'],\n {appTitle, isApp}: {appTitle?: string; isApp: boolean},\n): DerivedInterface[] {\n if (!isWorkbenchApp(app)) return []\n\n // The schema rejects a *declared* studio with an `entry`; `isApp` is resolved\n // from the project, so a detected one only fails here.\n if (!isApp && app.entry !== undefined) {\n throw new Error('App views for studios are not implemented yet')\n }\n const entry = isApp ? app.entry : GENERATED_ENTRY\n\n // Identity, not address: interface ids and the app-view name key on `name`\n // (which defaults to `slug`, so existing apps derive byte-identical ids).\n const appName = app.name ?? app.slug\n\n const shared = (\n kind: InterfaceKind,\n declaration: {name: string; src: string; title: string},\n ) => ({\n id: `${appName}-${kind}-${declaration.name}`,\n moduleId: interfaceModuleId(kind, declaration.name),\n name: declaration.name,\n src: declaration.src,\n title: declaration.title,\n version: interfaceContractVersion(kind),\n })\n\n const placementMetadata = (dock?: Dock): ViewPlacementMetadata | null => {\n const group = dock?.group ?? app.dock?.group\n const order = dock?.order ?? app.dock?.order\n if (group === undefined && order === undefined) return null\n return {\n dock: {\n ...(group === undefined ? {} : {group}),\n ...(order === undefined ? {} : {order}),\n },\n }\n }\n\n return [\n ...(app.views ?? []).map((view): DerivedInterface => {\n if (view.surface === 'tile') {\n return {\n ...shared(view.surface, view),\n metadata:\n view.order === undefined ? {size: view.size} : {order: view.order, size: view.size},\n surface: view.surface,\n }\n }\n if (view.surface === 'app' || view.surface === 'panel') {\n return {\n ...shared(view.surface, view),\n metadata: placementMetadata(view.dock),\n surface: view.surface,\n }\n }\n return {...shared(view.surface, view), metadata: null, surface: view.surface}\n }),\n ...(app.webWorkers ?? []).map(\n (webWorker): DerivedInterface => ({\n ...shared('worker', webWorker),\n metadata: null,\n type: 'worker',\n }),\n ),\n ...(entry === undefined\n ? []\n : [\n {\n ...shared('app', {name: appName, src: entry, title: appTitle ?? app.title}),\n metadata: placementMetadata(),\n surface: 'app' as const,\n },\n ]),\n ]\n}\n"],"names":["FEDERATION_FILE_NAME","RUNTIME_DIR","interfaceContractVersion","interfaceModuleId","isWorkbenchApp","GENERATED_ENTRY","deriveInterfaces","app","appTitle","isApp","entry","undefined","Error","appName","name","slug","shared","kind","declaration","id","moduleId","src","title","version","placementMetadata","dock","group","order","views","map","view","surface","metadata","size","webWorkers","webWorker","type"],"mappings":"AAEA,SAAQA,oBAAoB,EAAEC,WAAW,QAAO,oCAAmC;AACnF,SAEEC,wBAAwB,EAExBC,iBAAiB,QAGZ,gBAAe;AACtB,SAAQC,cAAc,QAAO,iBAAgB;AAE7C,4FAA4F,GAC5F,MAAMC,kBAAkB,CAAC,EAAE,EAAE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KC,OAAO,EAAED,KAAK;oBAC7BE,UACEF,KAAKH,KAAK,KAAKhB,YAAY;wBAACsB,MAAMH,KAAKG,IAAI;oBAAA,IAAI;wBAACN,OAAOG,KAAKH,KAAK;wBAAEM,MAAMH,KAAKG,IAAI;oBAAA;oBACpFF,SAASD,KAAKC,OAAO;gBACvB;YACF;YACA,IAAID,KAAKC,OAAO,KAAK,SAASD,KAAKC,OAAO,KAAK,SAAS;gBACtD,OAAO;oBACL,GAAGf,OAAOc,KAAKC,OAAO,EAAED,KAAK;oBAC7BE,UAAUR,kBAAkBM,KAAKL,IAAI;oBACrCM,SAASD,KAAKC,OAAO;gBACvB;YACF;YACA,OAAO;gBAAC,GAAGf,OAAOc,KAAKC,OAAO,EAAED,KAAK;gBAAEE,UAAU;gBAAMD,SAASD,KAAKC,OAAO;YAAA;QAC9E;WACG,AAACxB,CAAAA,IAAI2B,UAAU,IAAI,EAAE,AAAD,EAAGL,GAAG,CAC3B,CAACM,YAAiC,CAAA;gBAChC,GAAGnB,OAAO,UAAUmB,UAAU;gBAC9BH,UAAU;gBACVI,MAAM;YACR,CAAA;WAEE1B,UAAUC,YACV,EAAE,GACF;YACE;gBACE,GAAGK,OAAO,OAAO;oBAACF,MAAMD;oBAASQ,KAAKX;oBAAOY,OAAOd,YAAYD,IAAIe,KAAK;gBAAA,EAAE;gBAC3EU,UAAUR;gBACVO,SAAS;YACX;SACD;KACN;AACH"}
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
// Package-internal shared resolver: turn a CLI config's branded
|
|
2
|
-
// `
|
|
3
|
-
// project
|
|
4
|
-
//
|
|
2
|
+
// `defineApplication` app into its declared interfaces, or `null` for a plain
|
|
3
|
+
// project — and for a config (a branded `unstable_defineMediaLibrary`), which
|
|
4
|
+
// is not an app. The build and deploy accessors (actions/build, actions/deploy)
|
|
5
|
+
// each build their command-specific view on top of this one brand-check +
|
|
5
6
|
// extraction, so the discrimination lives in exactly one place.
|
|
6
|
-
import { isWorkbenchApp
|
|
7
|
+
import { isWorkbenchApp } from './defineApp.js';
|
|
7
8
|
import { formatWorkbenchAppErrors, validateWorkbenchApp } from './validateWorkbenchApp.js';
|
|
8
9
|
/**
|
|
9
|
-
* Resolve the workbench app for a CLI config, or `null` for a plain project
|
|
10
|
+
* Resolve the workbench app for a CLI config, or `null` for a plain project or a
|
|
11
|
+
* config (which is not an app — read it with `resolveWorkbenchConfig`).
|
|
10
12
|
* @public
|
|
11
13
|
*/ export function resolveWorkbenchApp(cliConfig) {
|
|
12
14
|
const app = cliConfig?.app;
|
|
15
|
+
// A config carries a distinct brand, so `isWorkbenchApp` is false for it — it
|
|
16
|
+
// resolves to `null` here, like a plain project.
|
|
13
17
|
if (!isWorkbenchApp(app)) return null;
|
|
14
18
|
const errors = validateWorkbenchApp(app);
|
|
15
19
|
if (errors.length > 0) throw new Error(formatWorkbenchAppErrors(errors));
|
|
16
20
|
return {
|
|
17
21
|
applicationType: app.applicationType,
|
|
18
|
-
config: readConfig(app),
|
|
19
22
|
entry: app.entry,
|
|
20
23
|
icon: app.icon,
|
|
21
|
-
|
|
24
|
+
// Identity defaults to the address, so existing apps behave identically.
|
|
25
|
+
name: app.name ?? app.slug,
|
|
22
26
|
organizationId: app.organizationId,
|
|
23
|
-
services: app.services ?? [],
|
|
24
27
|
slug: app.slug,
|
|
25
28
|
views: app.views ?? [],
|
|
26
|
-
visibility: app.visibility
|
|
29
|
+
visibility: app.visibility,
|
|
30
|
+
webWorkers: app.webWorkers ?? []
|
|
27
31
|
};
|
|
28
32
|
}
|
|
29
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resolveWorkbenchApp.ts"],"sourcesContent":["// Package-internal shared resolver: turn a CLI config's branded\n// `
|
|
1
|
+
{"version":3,"sources":["../src/resolveWorkbenchApp.ts"],"sourcesContent":["// Package-internal shared resolver: turn a CLI config's branded\n// `defineApplication` app into its declared interfaces, or `null` for a plain\n// project — and for a config (a branded `unstable_defineMediaLibrary`), which\n// is not an app. The build and deploy accessors (actions/build, actions/deploy)\n// each build their command-specific view on top of this one brand-check +\n// extraction, so the discrimination lives in exactly one place.\n\nimport {type AppVisibility, type CliConfig} from '@sanity/cli-core'\n\nimport {type WorkbenchConfigValue} from './contract.js'\nimport {type DefineAppInput, isWorkbenchApp} from './defineApp.js'\nimport {formatWorkbenchAppErrors, validateWorkbenchApp} from './validateWorkbenchApp.js'\n\n/**\n * Bundled so adding a declaration family touches this type and the artifact\n * expanders, not every hop of build/dev plumbing in between. `config` is sourced\n * from `resolveWorkbenchConfig` (a config is not an app), not from this resolver.\n * @internal\n */\nexport interface WorkbenchExposes {\n config?: WorkbenchConfigValue\n views?: DefineAppInput['views']\n webWorkers?: DefineAppInput['webWorkers']\n}\n\n/** @public */\nexport interface ResolvedWorkbenchApp {\n /**\n * Stable identity, distinct from the `slug` address. Defaults to `slug`, and is\n * what every identity key (build id, interface ids) is built from.\n */\n readonly name: string\n /** Organization that owns the app — part of its build-id identity. */\n readonly organizationId: string\n readonly slug: string\n\n /** Views the app declares. */\n readonly views: NonNullable<DefineAppInput['views']>\n\n /** Background web workers the app declares. */\n readonly webWorkers: NonNullable<DefineAppInput['webWorkers']>\n\n /** Resolved app kind — `studio` or one of the SDK app types. */\n readonly applicationType?: string\n /** SDK app-view entrypoint, when declared. */\n readonly entry?: string\n /** Path to the app's icon SVG, resolved and shipped to Brett on deploy. */\n readonly icon?: string\n /** Dashboard visibility declared by the app; `undefined` when unset. */\n readonly visibility?: AppVisibility\n}\n\n/**\n * Resolve the workbench app for a CLI config, or `null` for a plain project or a\n * config (which is not an app — read it with `resolveWorkbenchConfig`).\n * @public\n */\nexport function resolveWorkbenchApp(\n cliConfig: CliConfig | null | undefined,\n): ResolvedWorkbenchApp | null {\n const app = cliConfig?.app\n // A config carries a distinct brand, so `isWorkbenchApp` is false for it — it\n // resolves to `null` here, like a plain project.\n if (!isWorkbenchApp(app)) return null\n\n const errors = validateWorkbenchApp(app)\n if (errors.length > 0) throw new Error(formatWorkbenchAppErrors(errors))\n\n return {\n applicationType: app.applicationType,\n entry: app.entry,\n icon: app.icon,\n // Identity defaults to the address, so existing apps behave identically.\n name: app.name ?? app.slug,\n organizationId: app.organizationId,\n slug: app.slug,\n views: app.views ?? [],\n visibility: app.visibility,\n webWorkers: app.webWorkers ?? [],\n }\n}\n"],"names":["isWorkbenchApp","formatWorkbenchAppErrors","validateWorkbenchApp","resolveWorkbenchApp","cliConfig","app","errors","length","Error","applicationType","entry","icon","name","slug","organizationId","views","visibility","webWorkers"],"mappings":"AAAA,gEAAgE;AAChE,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAChF,0EAA0E;AAC1E,gEAAgE;AAKhE,SAA6BA,cAAc,QAAO,iBAAgB;AAClE,SAAQC,wBAAwB,EAAEC,oBAAoB,QAAO,4BAA2B;AAyCxF;;;;CAIC,GACD,OAAO,SAASC,oBACdC,SAAuC;IAEvC,MAAMC,MAAMD,WAAWC;IACvB,8EAA8E;IAC9E,iDAAiD;IACjD,IAAI,CAACL,eAAeK,MAAM,OAAO;IAEjC,MAAMC,SAASJ,qBAAqBG;IACpC,IAAIC,OAAOC,MAAM,GAAG,GAAG,MAAM,IAAIC,MAAMP,yBAAyBK;IAEhE,OAAO;QACLG,iBAAiBJ,IAAII,eAAe;QACpCC,OAAOL,IAAIK,KAAK;QAChBC,MAAMN,IAAIM,IAAI;QACd,yEAAyE;QACzEC,MAAMP,IAAIO,IAAI,IAAIP,IAAIQ,IAAI;QAC1BC,gBAAgBT,IAAIS,cAAc;QAClCD,MAAMR,IAAIQ,IAAI;QACdE,OAAOV,IAAIU,KAAK,IAAI,EAAE;QACtBC,YAAYX,IAAIW,UAAU;QAC1BC,YAAYZ,IAAIY,UAAU,IAAI,EAAE;IAClC;AACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Package-internal shared resolver: turn a CLI config's branded
|
|
2
|
+
// `unstable_defineMediaLibrary` config into its target `appType`, owning
|
|
3
|
+
// `organizationId`, and `fields`, or `null` when the config is not a config
|
|
4
|
+
// (a plain project or an app). The deploy/undeploy/build paths consult this
|
|
5
|
+
// second resolver; app-only callers keep using `resolveWorkbenchApp`.
|
|
6
|
+
import { ConfigSchema } from './contract.js';
|
|
7
|
+
import { isWorkbenchConfig } from './defineApp.js';
|
|
8
|
+
/**
|
|
9
|
+
* Resolve the workbench config for a CLI config, or `null` when it carries no
|
|
10
|
+
* config brand (a plain project or an app). The only config today is the Media
|
|
11
|
+
* Library, so the resolved shape is a {@link ResolvedMediaLibraryConfig}.
|
|
12
|
+
* @public
|
|
13
|
+
*/ export function resolveWorkbenchConfig(cliConfig) {
|
|
14
|
+
const app = cliConfig?.app;
|
|
15
|
+
if (!isWorkbenchConfig(app)) return null;
|
|
16
|
+
const result = ConfigSchema.safeParse({
|
|
17
|
+
appType: app.appType,
|
|
18
|
+
fields: app.fields
|
|
19
|
+
});
|
|
20
|
+
if (!result.success) {
|
|
21
|
+
throw new Error(`Invalid workbench config: ${result.error.message}`);
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
appType: app.appType,
|
|
25
|
+
fields: app.fields,
|
|
26
|
+
organizationId: app.organizationId
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=resolveWorkbenchConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resolveWorkbenchConfig.ts"],"sourcesContent":["// Package-internal shared resolver: turn a CLI config's branded\n// `unstable_defineMediaLibrary` config into its target `appType`, owning\n// `organizationId`, and `fields`, or `null` when the config is not a config\n// (a plain project or an app). The deploy/undeploy/build paths consult this\n// second resolver; app-only callers keep using `resolveWorkbenchApp`.\n\nimport {type CliConfig} from '@sanity/cli-core'\n\nimport {ConfigSchema, type WorkbenchConfigValue} from './contract.js'\nimport {isWorkbenchConfig} from './defineApp.js'\n\n/** @public */\nexport interface ResolvedMediaLibraryConfig {\n /** Target app the config binds to — resolves the org installation on deploy. */\n readonly appType: WorkbenchConfigValue['appType']\n /** The config's declared fields, expanded into the federation remote on build. */\n readonly fields: WorkbenchConfigValue['fields']\n /** Organization that owns the config's target installation. */\n readonly organizationId: string\n}\n\n/**\n * Resolve the workbench config for a CLI config, or `null` when it carries no\n * config brand (a plain project or an app). The only config today is the Media\n * Library, so the resolved shape is a {@link ResolvedMediaLibraryConfig}.\n * @public\n */\nexport function resolveWorkbenchConfig(\n cliConfig: CliConfig | null | undefined,\n): ResolvedMediaLibraryConfig | null {\n const app = cliConfig?.app\n if (!isWorkbenchConfig(app)) return null\n\n const result = ConfigSchema.safeParse({appType: app.appType, fields: app.fields})\n if (!result.success) {\n throw new Error(`Invalid workbench config: ${result.error.message}`)\n }\n\n return {appType: app.appType, fields: app.fields, organizationId: app.organizationId}\n}\n"],"names":["ConfigSchema","isWorkbenchConfig","resolveWorkbenchConfig","cliConfig","app","result","safeParse","appType","fields","success","Error","error","message","organizationId"],"mappings":"AAAA,gEAAgE;AAChE,yEAAyE;AACzE,4EAA4E;AAC5E,4EAA4E;AAC5E,sEAAsE;AAItE,SAAQA,YAAY,QAAkC,gBAAe;AACrE,SAAQC,iBAAiB,QAAO,iBAAgB;AAYhD;;;;;CAKC,GACD,OAAO,SAASC,uBACdC,SAAuC;IAEvC,MAAMC,MAAMD,WAAWC;IACvB,IAAI,CAACH,kBAAkBG,MAAM,OAAO;IAEpC,MAAMC,SAASL,aAAaM,SAAS,CAAC;QAACC,SAASH,IAAIG,OAAO;QAAEC,QAAQJ,IAAII,MAAM;IAAA;IAC/E,IAAI,CAACH,OAAOI,OAAO,EAAE;QACnB,MAAM,IAAIC,MAAM,CAAC,0BAA0B,EAAEL,OAAOM,KAAK,CAACC,OAAO,EAAE;IACrE;IAEA,OAAO;QAACL,SAASH,IAAIG,OAAO;QAAEC,QAAQJ,IAAII,MAAM;QAAEK,gBAAgBT,IAAIS,cAAc;IAAA;AACtF"}
|
|
@@ -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;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,gBAAgBG,YAAYF,cAAc,EAAE,CAAC,EAAEG,QAAQ,CAAC,EAAED,YAAYG,EAAE,EAAE;AACtF;AAEA,eAAeC;IACb,OAAOX,mBAAmB;QAACY,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ACvD,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,gBAAgBG,YAAYF,cAAc,EAAE,CAAC,EAAEG,QAAQ,CAAC,EAAED,YAAYG,EAAE,EAAE;AACtF;AAEA,eAAeC;IACb,OAAOX,mBAAmB;QAACY,YAAYT;QAA2BU,aAAa;IAAI;AACrF;AAEA,OAAO,eAAeC,eAAeC,aAAqB;IACxD,MAAMC,SAAS,MAAML;IACrB,IAAI;QACF,OAAO,MAAMK,OAAOC,OAAO,CAAC;YAACC,KAAK,CAAC,cAAc,EAAEH,eAAe;QAAA;IACpE,EAAE,OAAOI,KAAK;QACZ,IAAI,AAACA,KAA+BC,eAAe,KAAK,OAAO;QAC/D,MAAMD;IACR;AACF;AAEA,sEAAsE,GACtE,OAAO,eAAeE,iBAAiBhB,cAAsB;IAC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|
|
2
2
|
"name": "@sanity/workbench-cli",
|
|
3
|
-
"version": "2.1
|
|
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",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"tar-fs": "^3.1.2",
|
|
67
67
|
"vite": "^8.2.1",
|
|
68
68
|
"zod": "^4.4.3",
|
|
69
|
-
"@sanity/cli-core": "^3.
|
|
69
|
+
"@sanity/cli-core": "^3.4.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@eslint/compat": "^2.1.0",
|
|
@@ -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,151 +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
|
-
/**
|
|
83
|
-
* User-facing input for `unstable_defineApp`. Excludes the internal
|
|
84
|
-
* `applicationType`, `isSingleton`, and `config`.
|
|
85
|
-
* @public
|
|
86
|
-
*/
|
|
87
|
-
type DefineAppInput = Omit<z.output<typeof DefineAppInputSchema>, 'applicationType' | 'config' | 'isSingleton'>;
|
|
88
|
-
/**
|
|
89
|
-
* Nominal brand the CLI discriminates on to enable the workbench build/deploy
|
|
90
|
-
* codepath. Registered via `Symbol.for` so the marker survives module-realm
|
|
91
|
-
* boundaries — `@sanity/cli-core` re-derives the same global symbol with
|
|
92
|
-
* `Symbol.for` rather than importing it, so it stays internal to this module.
|
|
93
|
-
*/
|
|
94
|
-
declare const WORKBENCH_APP: unique symbol;
|
|
95
|
-
/**
|
|
96
|
-
* The branded result of `unstable_defineApp`. Carries the same fields as the
|
|
97
|
-
* input plus the internal brand — users only ever see `DefineAppInput`.
|
|
98
|
-
* @public
|
|
99
|
-
*/
|
|
100
|
-
type DefineAppResult = DefineAppInput & {
|
|
101
|
-
readonly [WORKBENCH_APP]: true;
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* A branded app as the CLI reads it — the full schema shape, including the
|
|
105
|
-
* internal fields `DefineAppInput` omits. Schema-derived so the narrowing
|
|
106
|
-
* can't drift from what the schema validates.
|
|
107
|
-
* @public
|
|
108
|
-
*/
|
|
109
|
-
type WorkbenchApp = DefineAppResult & z.output<typeof DefineAppInputSchema>;
|
|
110
|
-
/**
|
|
111
|
-
* Whether `app` is a branded `unstable_defineApp(...)` result — the sole
|
|
112
|
-
* workbench opt-in.
|
|
113
|
-
* @public
|
|
114
|
-
*/
|
|
115
|
-
declare function isWorkbenchApp(app: unknown): app is WorkbenchApp;
|
|
116
|
-
/**
|
|
117
|
-
* Declare a Sanity Workbench application. Identity at runtime — returns the same
|
|
118
|
-
* object reference, tagged with the workbench brand. Field validation (the
|
|
119
|
-
* `slug` pattern etc.) runs at build time in the CLI via `DefineAppInputSchema`;
|
|
120
|
-
* this helper stays a thin, pure identity wrapper.
|
|
121
|
-
* @public
|
|
122
|
-
*/
|
|
123
|
-
declare function unstable_defineApp(input: DefineAppInput): DefineAppResult;
|
|
124
|
-
/**
|
|
125
|
-
* One custom field a media library exposes. `src` default-exports a `defineField(...)` schema type.
|
|
126
|
-
* @public
|
|
127
|
-
*/
|
|
128
|
-
interface MediaLibraryField {
|
|
129
|
-
/** Unique within the media library. */
|
|
130
|
-
name: string;
|
|
131
|
-
src: string;
|
|
132
|
-
title: string;
|
|
133
|
-
/** Readable outside the owning organization. */
|
|
134
|
-
public?: boolean;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Sanity-owned singleton, so authors don't name or title the app — only `organizationId` is required.
|
|
138
|
-
* @public
|
|
139
|
-
*/
|
|
140
|
-
interface DefineMediaLibraryInput {
|
|
141
|
-
/** Organization that owns the media library — the CLI runs and deploys against it. */
|
|
142
|
-
organizationId: string;
|
|
143
|
-
fields?: MediaLibraryField[];
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Declare the Sanity Media Library as a workbench app — a singleton whose `fields` become its config.
|
|
147
|
-
* @public
|
|
148
|
-
*/
|
|
149
|
-
declare function unstable_defineMediaLibrary(input: DefineMediaLibraryInput): DefineAppResult;
|
|
150
|
-
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 };
|
|
151
|
-
//# sourceMappingURL=defineApp-DSvQx8rf.d.ts.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { o as WorkbenchApp, t as DefineAppInput } from "./defineApp-DSvQx8rf.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-Be9eU8mu.d.ts.map
|