@sanity/workbench-cli 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,187 +1,6 @@
1
- import { CliConfig } from "@sanity/cli-core";
2
- import { Output } from "@sanity/cli-core";
3
- import { z } from "zod/mini";
4
-
5
- /**
6
- * A manifest describing a running dev server process (studio or app).
7
- * Stored as `~/.sanity/dev-servers/<pid>.json`.
8
- *
9
- * The workbench singleton is tracked separately via the lock file — see
10
- * `acquireWorkbenchLock` and `readWorkbenchLock` below.
11
- */
12
- declare type DevServerManifest = z.infer<typeof devServerManifestSchema>;
13
-
14
- declare const devServerManifestSchema: z.ZodMiniObject<
15
- {
16
- configs: z.ZodMiniOptional<
17
- z.ZodMiniArray<
18
- z.ZodMiniObject<
19
- {
20
- appType: z.ZodMiniOptional<z.ZodMiniString<string>>;
21
- fields: z.ZodMiniArray<
22
- z.ZodMiniObject<
23
- {
24
- name: z.ZodMiniString<string>;
25
- public: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
26
- src: z.ZodMiniString<string>;
27
- title: z.ZodMiniString<string>;
28
- },
29
- z.core.$strip
30
- >
31
- >;
32
- id: z.ZodMiniString<string>;
33
- moduleName: z.ZodMiniOptional<z.ZodMiniString<string>>;
34
- version: z.ZodMiniString<string>;
35
- },
36
- z.core.$strip
37
- >
38
- >
39
- >;
40
- host: z.ZodMiniString<string>;
41
- id: z.ZodMiniOptional<z.ZodMiniString<string>>;
42
- interfaces: z.ZodMiniOptional<
43
- z.ZodMiniArray<
44
- z.ZodMiniDiscriminatedUnion<
45
- [
46
- z.ZodMiniObject<
47
- {
48
- metadata: z.ZodMiniNullable<
49
- z.ZodMiniObject<
50
- {
51
- group: z.ZodMiniOptional<z.ZodMiniString<string>>;
52
- priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
53
- },
54
- z.core.$strip
55
- >
56
- >;
57
- type: z.ZodMiniLiteral<"app">;
58
- id: z.ZodMiniString<string>;
59
- moduleId: z.ZodMiniString<string>;
60
- name: z.ZodMiniString<string>;
61
- src: z.ZodMiniString<string>;
62
- title: z.ZodMiniString<string>;
63
- version: z.ZodMiniOptional<z.ZodMiniString<string>>;
64
- },
65
- z.core.$strip
66
- >,
67
- z.ZodMiniObject<
68
- {
69
- metadata: z.ZodMiniNull;
70
- type: z.ZodMiniLiteral<"panel">;
71
- id: z.ZodMiniString<string>;
72
- moduleId: z.ZodMiniString<string>;
73
- name: z.ZodMiniString<string>;
74
- src: z.ZodMiniString<string>;
75
- title: z.ZodMiniString<string>;
76
- version: z.ZodMiniOptional<z.ZodMiniString<string>>;
77
- },
78
- z.core.$strip
79
- >,
80
- z.ZodMiniObject<
81
- {
82
- metadata: z.ZodMiniNull;
83
- type: z.ZodMiniLiteral<"asset_source">;
84
- id: z.ZodMiniString<string>;
85
- moduleId: z.ZodMiniString<string>;
86
- name: z.ZodMiniString<string>;
87
- src: z.ZodMiniString<string>;
88
- title: z.ZodMiniString<string>;
89
- version: z.ZodMiniOptional<z.ZodMiniString<string>>;
90
- },
91
- z.core.$strip
92
- >,
93
- z.ZodMiniObject<
94
- {
95
- metadata: z.ZodMiniObject<
96
- {
97
- priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
98
- size: z.ZodMiniEnum<{
99
- small: "small";
100
- large: "large";
101
- banner: "banner";
102
- }>;
103
- },
104
- z.core.$strip
105
- >;
106
- type: z.ZodMiniLiteral<"tile">;
107
- id: z.ZodMiniString<string>;
108
- moduleId: z.ZodMiniString<string>;
109
- name: z.ZodMiniString<string>;
110
- src: z.ZodMiniString<string>;
111
- title: z.ZodMiniString<string>;
112
- version: z.ZodMiniOptional<z.ZodMiniString<string>>;
113
- },
114
- z.core.$strip
115
- >,
116
- z.ZodMiniObject<
117
- {
118
- metadata: z.ZodMiniNull;
119
- type: z.ZodMiniLiteral<"worker">;
120
- id: z.ZodMiniString<string>;
121
- moduleId: z.ZodMiniString<string>;
122
- name: z.ZodMiniString<string>;
123
- src: z.ZodMiniString<string>;
124
- title: z.ZodMiniString<string>;
125
- version: z.ZodMiniOptional<z.ZodMiniString<string>>;
126
- },
127
- z.core.$strip
128
- >,
129
- ],
130
- "type"
131
- >
132
- >
133
- >;
134
- manifest: z.ZodMiniOptional<
135
- z.ZodMiniUnion<
136
- readonly [
137
- z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>,
138
- z.ZodMiniObject<
139
- {
140
- group: z.ZodMiniOptional<z.ZodMiniString<string>>;
141
- icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
142
- priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
143
- slug: z.ZodMiniOptional<z.ZodMiniString<string>>;
144
- title: z.ZodMiniOptional<z.ZodMiniString<string>>;
145
- version: z.ZodMiniString<string>;
146
- },
147
- z.core.$strip
148
- >,
149
- ]
150
- >
151
- >;
152
- manifestUpdatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
153
- pid: z.ZodMiniNumber<number>;
154
- port: z.ZodMiniNumber<number>;
155
- projectId: z.ZodMiniOptional<z.ZodMiniString<string>>;
156
- startedAt: z.ZodMiniString<string>;
157
- type: z.ZodMiniEnum<{
158
- coreApp: "coreApp";
159
- studio: "studio";
160
- }>;
161
- version: z.ZodMiniLiteral<1>;
162
- workDir: z.ZodMiniString<string>;
163
- },
164
- z.core.$strip
165
- >;
166
-
167
- /**
168
- * `sanity start` for a workbench app: serve a production build the way dev serves
169
- * a live one. The same singleton workbench shell renders it and the same registry
170
- * advertises it — only the remote differs, static files from the build output
171
- * instead of a live Vite dev server. There's no config watcher or rebuild: a
172
- * build is fixed, so nothing re-syncs.
173
- *
174
- * A running workbench claims the configured port, so the built remote binds the
175
- * next one. Without one the remote takes the configured port and announces its
176
- * own URL.
177
- */
178
- export declare function startWorkbenchPreview(
179
- options: StartWorkbenchPreviewOptions,
180
- ): Promise<{
181
- close: () => Promise<void>;
182
- }>;
183
-
184
- export declare interface StartWorkbenchPreviewOptions {
1
+ import { t as DevServerManifest } from "./registry-DI7hnTof.js";
2
+ import { CliConfig, Output } from "@sanity/cli-core";
3
+ interface StartWorkbenchPreviewOptions {
185
4
  /** Directory for the workbench Vite server's dependency cache. */
186
5
  cacheDir: string;
187
6
  /** CLI-domain `app.id`/`deployment.appId` deprecation check, run before registering. */
@@ -191,7 +10,7 @@ export declare interface StartWorkbenchPreviewOptions {
191
10
  extractManifest: (params: {
192
11
  configPath: string;
193
12
  workDir: string;
194
- }) => Promise<DevServerManifest["manifest"]>;
13
+ }) => Promise<DevServerManifest['manifest']>;
195
14
  httpHost: string;
196
15
  httpPort: number;
197
16
  isApp: boolean;
@@ -201,5 +20,19 @@ export declare interface StartWorkbenchPreviewOptions {
201
20
  reactStrictMode: boolean;
202
21
  workDir: string;
203
22
  }
204
-
205
- export {};
23
+ /**
24
+ * `sanity start` for a workbench app: serve a production build the way dev serves
25
+ * a live one. The same singleton workbench shell renders it and the same registry
26
+ * advertises it — only the remote differs, static files from the build output
27
+ * instead of a live Vite dev server. There's no config watcher or rebuild: a
28
+ * build is fixed, so nothing re-syncs.
29
+ *
30
+ * A running workbench claims the configured port, so the built remote binds the
31
+ * next one. Without one the remote takes the configured port and announces its
32
+ * own URL.
33
+ */
34
+ declare function startWorkbenchPreview(options: StartWorkbenchPreviewOptions): Promise<{
35
+ close: () => Promise<void>;
36
+ }>;
37
+ export { type StartWorkbenchPreviewOptions, startWorkbenchPreview };
38
+ //# sourceMappingURL=preview.d.ts.map
@@ -0,0 +1,102 @@
1
+ import { z } from "zod/mini";
2
+ declare const devServerManifestSchema: z.ZodMiniObject<{
3
+ configs: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
4
+ appType: z.ZodMiniOptional<z.ZodMiniString<string>>;
5
+ fields: z.ZodMiniArray<z.ZodMiniObject<{
6
+ name: z.ZodMiniString<string>;
7
+ public: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
8
+ src: z.ZodMiniString<string>;
9
+ title: z.ZodMiniString<string>;
10
+ }, z.core.$strip>>;
11
+ id: z.ZodMiniString<string>;
12
+ moduleName: z.ZodMiniOptional<z.ZodMiniString<string>>;
13
+ version: z.ZodMiniString<string>;
14
+ }, z.core.$strip>>>;
15
+ host: z.ZodMiniString<string>;
16
+ id: z.ZodMiniOptional<z.ZodMiniString<string>>;
17
+ interfaces: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
18
+ metadata: z.ZodMiniNullable<z.ZodMiniObject<{
19
+ group: z.ZodMiniOptional<z.ZodMiniString<string>>;
20
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
21
+ }, z.core.$strip>>;
22
+ type: z.ZodMiniLiteral<"app">;
23
+ id: z.ZodMiniString<string>;
24
+ moduleId: z.ZodMiniString<string>;
25
+ name: z.ZodMiniString<string>;
26
+ src: z.ZodMiniString<string>;
27
+ title: z.ZodMiniString<string>;
28
+ version: z.ZodMiniOptional<z.ZodMiniString<string>>;
29
+ }, z.core.$strip>, z.ZodMiniObject<{
30
+ metadata: z.ZodMiniNull;
31
+ type: z.ZodMiniLiteral<"panel">;
32
+ id: z.ZodMiniString<string>;
33
+ moduleId: z.ZodMiniString<string>;
34
+ name: z.ZodMiniString<string>;
35
+ src: z.ZodMiniString<string>;
36
+ title: z.ZodMiniString<string>;
37
+ version: z.ZodMiniOptional<z.ZodMiniString<string>>;
38
+ }, z.core.$strip>, z.ZodMiniObject<{
39
+ metadata: z.ZodMiniNull;
40
+ type: z.ZodMiniLiteral<"asset_source">;
41
+ id: z.ZodMiniString<string>;
42
+ moduleId: z.ZodMiniString<string>;
43
+ name: z.ZodMiniString<string>;
44
+ src: z.ZodMiniString<string>;
45
+ title: z.ZodMiniString<string>;
46
+ version: z.ZodMiniOptional<z.ZodMiniString<string>>;
47
+ }, z.core.$strip>, z.ZodMiniObject<{
48
+ metadata: z.ZodMiniObject<{
49
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
50
+ size: z.ZodMiniEnum<{
51
+ small: "small";
52
+ large: "large";
53
+ banner: "banner";
54
+ }>;
55
+ }, z.core.$strip>;
56
+ type: z.ZodMiniLiteral<"tile">;
57
+ id: z.ZodMiniString<string>;
58
+ moduleId: z.ZodMiniString<string>;
59
+ name: z.ZodMiniString<string>;
60
+ src: z.ZodMiniString<string>;
61
+ title: z.ZodMiniString<string>;
62
+ version: z.ZodMiniOptional<z.ZodMiniString<string>>;
63
+ }, z.core.$strip>, z.ZodMiniObject<{
64
+ metadata: z.ZodMiniNull;
65
+ type: z.ZodMiniLiteral<"worker">;
66
+ id: z.ZodMiniString<string>;
67
+ moduleId: z.ZodMiniString<string>;
68
+ name: z.ZodMiniString<string>;
69
+ src: z.ZodMiniString<string>;
70
+ title: z.ZodMiniString<string>;
71
+ version: z.ZodMiniOptional<z.ZodMiniString<string>>;
72
+ }, z.core.$strip>], "type">>>;
73
+ manifest: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>, z.ZodMiniObject<{
74
+ group: z.ZodMiniOptional<z.ZodMiniString<string>>;
75
+ icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
76
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
77
+ slug: z.ZodMiniOptional<z.ZodMiniString<string>>;
78
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
79
+ version: z.ZodMiniString<string>;
80
+ }, z.core.$strip>]>>;
81
+ manifestUpdatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
82
+ pid: z.ZodMiniNumber<number>;
83
+ port: z.ZodMiniNumber<number>;
84
+ projectId: z.ZodMiniOptional<z.ZodMiniString<string>>;
85
+ startedAt: z.ZodMiniString<string>;
86
+ type: z.ZodMiniEnum<{
87
+ coreApp: "coreApp";
88
+ studio: "studio";
89
+ }>;
90
+ version: z.ZodMiniLiteral<1>;
91
+ workDir: z.ZodMiniString<string>;
92
+ }, z.core.$strip>;
93
+ /**
94
+ * A manifest describing a running dev server process (studio or app).
95
+ * Stored as `~/.sanity/dev-servers/<pid>.json`.
96
+ *
97
+ * The workbench singleton is tracked separately via the lock file — see
98
+ * `acquireWorkbenchLock` and `readWorkbenchLock` below.
99
+ */
100
+ type DevServerManifest = z.infer<typeof devServerManifestSchema>;
101
+ export { DevServerManifest as t };
102
+ //# sourceMappingURL=registry-DI7hnTof.d.ts.map
@@ -0,0 +1,41 @@
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
@@ -0,0 +1,62 @@
1
+ import { n as WorkbenchExposes, t as ResolvedWorkbenchApp } from "./resolveWorkbenchApp-DqFqET9E.js";
2
+ import { CliConfig } from "@sanity/cli-core";
3
+ import { z } from "zod/mini";
4
+ /**
5
+ * Payload registering an app's views with the application service on deploy.
6
+ *
7
+ * Phase 1 stub: the service that stores views does not exist yet, so the
8
+ * payload is validated and logged only — never sent. Builds the contract the
9
+ * application-service endpoint will accept.
10
+ */
11
+ declare const viewDeploymentPayloadSchema: z.ZodMiniObject<{
12
+ applicationId: z.ZodMiniString<string>;
13
+ views: z.ZodMiniArray<z.ZodMiniObject<{
14
+ name: z.ZodMiniString<string>;
15
+ src: z.ZodMiniString<string>;
16
+ type: z.ZodMiniEnum<{
17
+ panel: "panel";
18
+ asset_source: "asset_source";
19
+ tile: "tile";
20
+ }>;
21
+ }, z.core.$loose>>;
22
+ }, z.core.$strip>;
23
+ type ViewDeploymentPayload = z.infer<typeof viewDeploymentPayloadSchema>;
24
+ interface DeployableWorkbenchApp extends ResolvedWorkbenchApp {
25
+ /**
26
+ * Throws when the app exposes nothing (no entry, view, service, or config) —
27
+ * the remote would have nothing to load. Gated before any prompt or API call.
28
+ */
29
+ assertDeployable(): void;
30
+ /**
31
+ * Validates the app's declared views into the application-service payload.
32
+ * Throws when a view declaration is malformed.
33
+ */
34
+ buildViewDeploymentPayload(applicationId: string): ViewDeploymentPayload;
35
+ /**
36
+ * A singleton (the Media Library) that carries an config — deploy
37
+ * persists the config to the org's installation. Independent of the interfaces,
38
+ * which register regardless; non-singletons never carry a config.
39
+ */
40
+ deploySingletonConfig: boolean;
41
+ /** Declares something to host as an application — an entry, view, or service. */
42
+ hasInterfaces: boolean;
43
+ }
44
+ declare function getWorkbench(cliConfig: CliConfig | null | undefined): DeployableWorkbenchApp | null;
45
+ /** A view or service as the deploy report and `--json` output surface it. */
46
+ interface DeployedInterface {
47
+ name: string;
48
+ src: string;
49
+ title: string;
50
+ type: string;
51
+ }
52
+ /**
53
+ * One report line per non-empty group, alongside the records `--json` reports.
54
+ * @internal
55
+ */
56
+ declare function summarizeInterfaces({ services, views }: WorkbenchExposes): {
57
+ lines: string[];
58
+ services: DeployedInterface[];
59
+ views: DeployedInterface[];
60
+ };
61
+ export { getWorkbench as i, summarizeInterfaces as n, DeployableWorkbenchApp as r, DeployedInterface as t };
62
+ //# sourceMappingURL=summarizeInterfaces-DBGiAwNT.d.ts.map