@valbuild/shared 0.137.0 → 0.138.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/dist/declarations/src/internal/ApiRoutes.d.ts +33 -18
- package/dist/declarations/src/internal/publish/contentApi.d.ts +207 -4
- package/dist/declarations/src/internal/publish/protocol.d.ts +20 -1
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +132 -19
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +132 -19
- package/internal/dist/valbuild-shared-internal.esm.js +126 -20
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @valbuild/shared
|
|
2
2
|
|
|
3
|
+
## 0.138.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#754](https://github.com/valbuild/val/pull/754) [`6216172`](https://github.com/valbuild/val/commit/62161729aa40f737590b0a8093c0394385fffd8d) Thanks [@freekh](https://github.com/freekh)! - Connected projects hosted on the Val platform publish as a queued job too.
|
|
8
|
+
|
|
9
|
+
For a project with a GitHub repository whose site runs on the Val platform, pressing **Publish** is now a request, just as it is for a managed project. The Studio sends the job's changes; the content service pushes them as one commit on top of whatever is on the branch at that moment, so a developer's code push in between is kept. CI then builds it. A developer's change to the site's content files that this deployment has not seen stops the publish before anything is pushed, and says so.
|
|
10
|
+
|
|
11
|
+
- A build that CI reports as failed shows "Published, not on the site yet", with **View run**. The next publish builds again.
|
|
12
|
+
- New CLI command, `val ci-report --status failed|succeeded`, for a workflow's last step. It reads the commit, the branch and the run's address from GitHub Actions, uses the same `VAL_PROJECT_TOKEN` as `val publish`, and never fails the job.
|
|
13
|
+
|
|
14
|
+
Connected projects on a host of their own (for example Vercel) publish exactly as before.
|
|
15
|
+
|
|
16
|
+
- [#754](https://github.com/valbuild/val/pull/754) [`40e933d`](https://github.com/valbuild/val/commit/40e933da7fe01cfe1c3f4a43c156f0b2f8a11f62) Thanks [@freekh](https://github.com/freekh)! - Publishing a managed project is now a queued job, and a publish is either live or it did not happen.
|
|
17
|
+
|
|
18
|
+
Pressing **Publish** in a managed project no longer commits first and builds after. It asks the content service for a publish job and returns at once; the Studio tab that pressed builds the job and uploads it, and the content service checks the build renders and makes it live — recording the commit only then. So there is no longer a "Saved, not yet live" state to get stuck in, and no **Finish publishing** button to get out of it.
|
|
19
|
+
|
|
20
|
+
- A press made while another publish is going out is queued behind it, and built when its turn comes by whichever open Studio tab is free.
|
|
21
|
+
- A tab that closes after uploading costs nothing: the rest of the publish is the content service's.
|
|
22
|
+
- A publish that fails before it goes live says so, with **Try again** and **Discard changes**. Your changes are kept either way.
|
|
23
|
+
- Publishing from the site (a page that cannot build) still opens a Studio window to build it; the window now runs the publish job for the page.
|
|
24
|
+
|
|
25
|
+
Connected projects (with a repository) that are hosted on the Val platform publish as a queued job too — see the note on connected projects. Those hosted elsewhere, for example on Vercel, publish exactly as before.
|
|
26
|
+
|
|
27
|
+
For the Val server: the publish proxy now forwards the publish-job routes, `/api/val/publish-job-prepare` renders a job's sources and hands content its archive, and `/api/val/built-source` is removed.
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`57af895`](https://github.com/valbuild/val/commit/57af8959cc46519a405b1ed7441623f8bf2e6d27), [`5876fe0`](https://github.com/valbuild/val/commit/5876fe075fdee1f76f1cdaa2488ac52c58c894a8)]:
|
|
32
|
+
- @valbuild/core@0.138.0
|
|
33
|
+
|
|
3
34
|
## 0.137.0
|
|
4
35
|
|
|
5
36
|
### Minor Changes
|
|
@@ -424,6 +424,7 @@ export declare const Api: {
|
|
|
424
424
|
mode: z.ZodUnion<readonly [z.ZodLiteral<"http">, z.ZodLiteral<"fs">]>;
|
|
425
425
|
jsonEntriesSha: z.ZodOptional<z.ZodString>;
|
|
426
426
|
sourceMode: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"managed">, z.ZodLiteral<"connected">]>>;
|
|
427
|
+
publishJobs: z.ZodOptional<z.ZodBoolean>;
|
|
427
428
|
publishRefusal: z.ZodOptional<z.ZodObject<{
|
|
428
429
|
code: z.ZodLiteral<"no-base">;
|
|
429
430
|
message: z.ZodString;
|
|
@@ -470,6 +471,7 @@ export declare const Api: {
|
|
|
470
471
|
profileId: z.ZodNullable<z.ZodString>;
|
|
471
472
|
mode: z.ZodUnion<readonly [z.ZodLiteral<"http">, z.ZodLiteral<"fs">]>;
|
|
472
473
|
sourceMode: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"managed">, z.ZodLiteral<"connected">]>>;
|
|
474
|
+
publishJobs: z.ZodOptional<z.ZodBoolean>;
|
|
473
475
|
publishRefusal: z.ZodOptional<z.ZodObject<{
|
|
474
476
|
code: z.ZodLiteral<"no-base">;
|
|
475
477
|
message: z.ZodString;
|
|
@@ -1078,24 +1080,14 @@ export declare const Api: {
|
|
|
1078
1080
|
}, z.core.$strip>]>;
|
|
1079
1081
|
};
|
|
1080
1082
|
};
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
* with every commit since it applied, for a build made in the browser.
|
|
1084
|
-
*
|
|
1085
|
-
* A Studio build starts from the source stored with the live build. A commit
|
|
1086
|
-
* whose own publish failed -- or the first commit of a project that started
|
|
1087
|
-
* as a copy of a template -- is in content and in no stored source, so a build
|
|
1088
|
-
* that added only its own save's files shipped without it. Only this server
|
|
1089
|
-
* can render those commits back into text: content keeps a managed project's
|
|
1090
|
-
* content as Source, not as files.
|
|
1091
|
-
*
|
|
1092
|
-
* Committed patches only. A pending one is somebody's unpublished work, and
|
|
1093
|
-
* is not this build's to ship. 409 where there is nothing to answer with: a
|
|
1094
|
-
* project with a repository, or a build that did not embed its source.
|
|
1095
|
-
*/
|
|
1096
|
-
"/built-source": {
|
|
1097
|
-
GET: {
|
|
1083
|
+
"/publish-job-prepare": {
|
|
1084
|
+
POST: {
|
|
1098
1085
|
req: {
|
|
1086
|
+
body: z.ZodObject<{
|
|
1087
|
+
jobId: z.ZodString;
|
|
1088
|
+
tab: z.ZodString;
|
|
1089
|
+
patchIds: z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>;
|
|
1090
|
+
}, z.core.$strip>;
|
|
1099
1091
|
cookies: {
|
|
1100
1092
|
val_session: z.ZodOptional<z.ZodString>;
|
|
1101
1093
|
};
|
|
@@ -1105,6 +1097,11 @@ export declare const Api: {
|
|
|
1105
1097
|
json: z.ZodObject<{
|
|
1106
1098
|
message: z.ZodString;
|
|
1107
1099
|
}, z.core.$strip>;
|
|
1100
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1101
|
+
status: z.ZodLiteral<400>;
|
|
1102
|
+
json: z.ZodObject<{
|
|
1103
|
+
message: z.ZodString;
|
|
1104
|
+
}, z.core.$strip>;
|
|
1108
1105
|
}, z.core.$strip>, z.ZodObject<{
|
|
1109
1106
|
status: z.ZodLiteral<409>;
|
|
1110
1107
|
json: z.ZodObject<{
|
|
@@ -1115,10 +1112,28 @@ export declare const Api: {
|
|
|
1115
1112
|
json: z.ZodObject<{
|
|
1116
1113
|
message: z.ZodString;
|
|
1117
1114
|
}, z.core.$strip>;
|
|
1115
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1116
|
+
status: z.ZodLiteral<502>;
|
|
1117
|
+
json: z.ZodObject<{
|
|
1118
|
+
message: z.ZodString;
|
|
1119
|
+
}, z.core.$strip>;
|
|
1118
1120
|
}, z.core.$strip>, z.ZodObject<{
|
|
1119
1121
|
status: z.ZodLiteral<200>;
|
|
1120
1122
|
json: z.ZodObject<{
|
|
1121
|
-
|
|
1123
|
+
job: z.ZodNullable<z.ZodObject<{
|
|
1124
|
+
id: z.ZodString;
|
|
1125
|
+
step: z.ZodNullable<z.ZodEnum<{
|
|
1126
|
+
prepare: "prepare";
|
|
1127
|
+
build: "build";
|
|
1128
|
+
upload: "upload";
|
|
1129
|
+
}>>;
|
|
1130
|
+
base: z.ZodNullable<z.ZodString>;
|
|
1131
|
+
patches: z.ZodArray<z.ZodString>;
|
|
1132
|
+
}, z.core.$strip>>;
|
|
1133
|
+
sourceFiles: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
|
|
1134
|
+
binaryFiles: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1135
|
+
binaryFilesUnread: z.ZodArray<z.ZodString>;
|
|
1136
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
1122
1137
|
}, z.core.$strip>;
|
|
1123
1138
|
}, z.core.$strip>]>;
|
|
1124
1139
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The publish API's types, COPIED from the service that serves them.
|
|
3
3
|
*
|
|
4
|
-
* Source: `content/src/handlers/Api.ts` in valbuild/home
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Source: `content/src/handlers/Api.ts` in valbuild/home. The routes below
|
|
5
|
+
* are that file's `/publish*` entries and the types they use, verbatim,
|
|
6
|
+
* comments included, so that the two can be diffed by eye: the publish
|
|
7
|
+
* lifecycle from branch `claude/new-project-studio-saves-0g9ksb`, commit
|
|
8
|
+
* `ecf3b8d`; the publish-job routes (`/publish-requests`, `/publish-jobs`)
|
|
9
|
+
* and `PublishRequestStatus` / `PublishTabJob` from `main`, commit `acb4a49`, with `/ci-runs`.
|
|
8
10
|
*
|
|
9
11
|
* **Copied rather than imported, because it cannot be imported.** That file
|
|
10
12
|
* lives in a private repository which publishes nothing to npm, and its own
|
|
@@ -23,6 +25,7 @@
|
|
|
23
25
|
* A copy is not a guarantee, only a tripwire: nothing checks it against the
|
|
24
26
|
* service, and the parsers in `protocol.ts` are what actually holds at runtime.
|
|
25
27
|
*/
|
|
28
|
+
import type { Json } from "@valbuild/core";
|
|
26
29
|
export type ContentPublishApi = {
|
|
27
30
|
/**
|
|
28
31
|
* Publishing a build, as a resource with a lifecycle.
|
|
@@ -175,6 +178,173 @@ export type ContentPublishApi = {
|
|
|
175
178
|
};
|
|
176
179
|
};
|
|
177
180
|
};
|
|
181
|
+
/**
|
|
182
|
+
* Publishing as a queued job: a press of Publish is a REQUEST, and returns
|
|
183
|
+
* at once. A job takes every queued request and everything pending; the tab
|
|
184
|
+
* that pressed runs its prepare (through the Val server), build and upload,
|
|
185
|
+
* reporting each step; then content runs verify and the seal itself. See
|
|
186
|
+
* docs/app-mode.md, "Publishing is a queued job".
|
|
187
|
+
*
|
|
188
|
+
* ```
|
|
189
|
+
* POST /publish-requests press -> the request, and a job to build
|
|
190
|
+
* GET /publish-requests/{id} where it is: queued, publishing, live, failed
|
|
191
|
+
* POST /publish-requests/try-again Try again: resume a paused queue, press anew
|
|
192
|
+
* POST /publish-jobs/next a free tab asks for queued work
|
|
193
|
+
* POST /publish-jobs/{id}/prepare the job's sources, archived (the Val server's)
|
|
194
|
+
* POST /publish-jobs/{id}/steps the tab reports build and upload
|
|
195
|
+
* POST /publish-jobs/{id}/renew the tab is still building
|
|
196
|
+
* POST /publish-jobs/{id}/cancel Cancel, before the seal
|
|
197
|
+
* POST /publish-jobs/{id}/discard Discard these changes, on a failed job
|
|
198
|
+
* ```
|
|
199
|
+
*
|
|
200
|
+
* Every id the Studio sends -- a request's, a tab's -- is its own, minted by
|
|
201
|
+
* it, `[A-Za-z0-9_-]{1,100}`. A press is idempotent on its request id; a step
|
|
202
|
+
* report names its step, so one retried after a lost answer does nothing
|
|
203
|
+
* twice.
|
|
204
|
+
*/
|
|
205
|
+
/**
|
|
206
|
+
* CI's own report of how a build of a git commit went, sent by the
|
|
207
|
+
* connected workflow's last step with its project token. See `ciRuns.ts`.
|
|
208
|
+
*/
|
|
209
|
+
"/ci-runs": {
|
|
210
|
+
POST: {
|
|
211
|
+
body: {
|
|
212
|
+
commit: string;
|
|
213
|
+
branch?: string;
|
|
214
|
+
status: "failed" | "succeeded";
|
|
215
|
+
url?: string;
|
|
216
|
+
};
|
|
217
|
+
res: {
|
|
218
|
+
recorded: true;
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
"/ci-runs/newest": {
|
|
223
|
+
GET: {
|
|
224
|
+
res: {
|
|
225
|
+
run: {
|
|
226
|
+
commit: string;
|
|
227
|
+
status: "failed" | "succeeded";
|
|
228
|
+
url: string | null;
|
|
229
|
+
} | null;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
"/publish-requests": {
|
|
234
|
+
POST: {
|
|
235
|
+
body: {
|
|
236
|
+
requestId: string;
|
|
237
|
+
tab: string;
|
|
238
|
+
};
|
|
239
|
+
res: {
|
|
240
|
+
request: PublishRequestStatus;
|
|
241
|
+
job: PublishTabJob | null;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
"/publish-requests/try-again": {
|
|
246
|
+
POST: {
|
|
247
|
+
body: {
|
|
248
|
+
requestId: string;
|
|
249
|
+
tab: string;
|
|
250
|
+
};
|
|
251
|
+
res: {
|
|
252
|
+
request: PublishRequestStatus;
|
|
253
|
+
job: PublishTabJob | null;
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
"/publish-requests/:requestId": {
|
|
258
|
+
GET: {
|
|
259
|
+
res: {
|
|
260
|
+
request: PublishRequestStatus;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
"/publish-jobs/next": {
|
|
265
|
+
POST: {
|
|
266
|
+
body: {
|
|
267
|
+
tab: string;
|
|
268
|
+
};
|
|
269
|
+
res: {
|
|
270
|
+
job: PublishTabJob | null;
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
"/publish-jobs/:jobId/prepare": {
|
|
275
|
+
POST: {
|
|
276
|
+
/**
|
|
277
|
+
* `/commit`'s body, less what names a commit: the job's commit is minted
|
|
278
|
+
* at the seal. `modules` is required here -- a managed commit's archive,
|
|
279
|
+
* written from it, is the only copy of what it published.
|
|
280
|
+
*/
|
|
281
|
+
body: {
|
|
282
|
+
tab: string;
|
|
283
|
+
root: string;
|
|
284
|
+
filesDirectory?: string;
|
|
285
|
+
patchedSourceFiles: Record<string, string | null>;
|
|
286
|
+
patchedBinaryFilesDescriptors: Record<string, {
|
|
287
|
+
patchId: string;
|
|
288
|
+
remote?: boolean;
|
|
289
|
+
}>;
|
|
290
|
+
modules: Record<string, {
|
|
291
|
+
source: Json;
|
|
292
|
+
schema: Json;
|
|
293
|
+
}>;
|
|
294
|
+
/**
|
|
295
|
+
* Connected: the git commit the Studio's deployment was built from. A
|
|
296
|
+
* branch whose tip is that commit has nothing it has not seen.
|
|
297
|
+
*/
|
|
298
|
+
gitCommit?: string;
|
|
299
|
+
};
|
|
300
|
+
res: {
|
|
301
|
+
job: PublishTabJob | null;
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
"/publish-jobs/:jobId/steps": {
|
|
306
|
+
POST: {
|
|
307
|
+
body: {
|
|
308
|
+
tab: string;
|
|
309
|
+
step: "prepare" | "build" | "upload";
|
|
310
|
+
ok: boolean;
|
|
311
|
+
/** A finished build step: the id of the publish (`POST /publish`) it declared. */
|
|
312
|
+
build?: string;
|
|
313
|
+
};
|
|
314
|
+
res: {
|
|
315
|
+
job: PublishTabJob | null;
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
"/publish-jobs/:jobId/renew": {
|
|
320
|
+
POST: {
|
|
321
|
+
body: {
|
|
322
|
+
tab: string;
|
|
323
|
+
};
|
|
324
|
+
res: {
|
|
325
|
+
renewed: boolean;
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
"/publish-jobs/:jobId/cancel": {
|
|
330
|
+
POST: {
|
|
331
|
+
res: {
|
|
332
|
+
cancelled: boolean;
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
"/publish-jobs/:jobId/discard": {
|
|
337
|
+
POST: {
|
|
338
|
+
/** The forward closure, as `DELETE /patches` takes it. */
|
|
339
|
+
body: {
|
|
340
|
+
unstagePatchIds?: string[];
|
|
341
|
+
};
|
|
342
|
+
/** Changes it could not discard: another job in flight holds them. */
|
|
343
|
+
res: {
|
|
344
|
+
stillHeld: string[];
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
};
|
|
178
348
|
};
|
|
179
349
|
/**
|
|
180
350
|
* Where a publish is. Mirrors `PublishState` in `utils/publishPlan.ts`, which
|
|
@@ -199,3 +369,36 @@ export type PublishProblem = {
|
|
|
199
369
|
hint?: string;
|
|
200
370
|
keys?: string[];
|
|
201
371
|
};
|
|
372
|
+
/**
|
|
373
|
+
* Where a press of Publish is. `live` names the commit that carries it -- its
|
|
374
|
+
* own, or a newer one that contains it; `failed` names what the editor can do.
|
|
375
|
+
* The same shape as `RequestStatus` in `utils/jobPlan.ts`, which decides it.
|
|
376
|
+
*/
|
|
377
|
+
export type PublishRequestStatus = {
|
|
378
|
+
kind: "queued";
|
|
379
|
+
} | {
|
|
380
|
+
kind: "publishing";
|
|
381
|
+
} | {
|
|
382
|
+
kind: "live";
|
|
383
|
+
commit: string;
|
|
384
|
+
} | {
|
|
385
|
+
kind: "failed";
|
|
386
|
+
message: string;
|
|
387
|
+
actions: ("try-again" | "discard" | "re-run-build")[];
|
|
388
|
+
/** The job that failed: what Discard is pressed on. */
|
|
389
|
+
job: string;
|
|
390
|
+
} | {
|
|
391
|
+
kind: "cancelled";
|
|
392
|
+
} | {
|
|
393
|
+
kind: "nothing-to-publish";
|
|
394
|
+
};
|
|
395
|
+
/** What a tab needs to know about a job it is running. */
|
|
396
|
+
export type PublishTabJob = {
|
|
397
|
+
id: string;
|
|
398
|
+
/** The step the tab is to run next; null once the job is content's. */
|
|
399
|
+
step: "prepare" | "build" | "upload" | null;
|
|
400
|
+
/** The recorded commit its build is based on. */
|
|
401
|
+
base: string | null;
|
|
402
|
+
/** The changes its build is to include, on top of `base`. */
|
|
403
|
+
patches: string[];
|
|
404
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { ContentPublishApi, PublishProblem, PublishState } from "./contentApi.js";
|
|
2
|
+
import { ContentPublishApi, PublishProblem, PublishRequestStatus, PublishState, PublishTabJob } from "./contentApi.js";
|
|
3
3
|
/**
|
|
4
4
|
* Reading what content answers.
|
|
5
5
|
*
|
|
@@ -195,6 +195,25 @@ export type DependencyChange = z.infer<typeof dependencyChange>;
|
|
|
195
195
|
export declare const parseUpdateTarget: (body: unknown) => UpdateTargetResponse;
|
|
196
196
|
export declare const parseBuildTarget: (body: unknown) => BuildTargetResponse;
|
|
197
197
|
export declare const parseProjectSource: (body: unknown) => ProjectSourceResponse;
|
|
198
|
+
export type { PublishRequestStatus, PublishTabJob };
|
|
199
|
+
export type PressResponse = ContentPublishApi["/publish-requests"]["POST"]["res"];
|
|
200
|
+
export type RequestStatusResponse = ContentPublishApi["/publish-requests/:requestId"]["GET"]["res"];
|
|
201
|
+
export type NextJobResponse = ContentPublishApi["/publish-jobs/next"]["POST"]["res"];
|
|
202
|
+
export type JobPrepareBody = ContentPublishApi["/publish-jobs/:jobId/prepare"]["POST"]["body"];
|
|
203
|
+
export type JobStepBody = ContentPublishApi["/publish-jobs/:jobId/steps"]["POST"]["body"];
|
|
204
|
+
export type JobStepResponse = ContentPublishApi["/publish-jobs/:jobId/steps"]["POST"]["res"];
|
|
205
|
+
export type JobRenewResponse = ContentPublishApi["/publish-jobs/:jobId/renew"]["POST"]["res"];
|
|
206
|
+
export type JobCancelResponse = ContentPublishApi["/publish-jobs/:jobId/cancel"]["POST"]["res"];
|
|
207
|
+
export type JobDiscardResponse = ContentPublishApi["/publish-jobs/:jobId/discard"]["POST"]["res"];
|
|
208
|
+
export declare const parsePress: (body: unknown, call: string) => PressResponse;
|
|
209
|
+
export declare const parseRequestStatus: (body: unknown) => RequestStatusResponse;
|
|
210
|
+
export declare const parseJob: (body: unknown, call: string) => JobStepResponse;
|
|
211
|
+
export declare const parseRenew: (body: unknown) => JobRenewResponse;
|
|
212
|
+
export declare const parseCancel: (body: unknown) => JobCancelResponse;
|
|
213
|
+
export declare const parseDiscard: (body: unknown) => JobDiscardResponse;
|
|
214
|
+
export type CiRunReportBody = ContentPublishApi["/ci-runs"]["POST"]["body"];
|
|
215
|
+
export type NewestCiRunResponse = ContentPublishApi["/ci-runs/newest"]["GET"]["res"];
|
|
216
|
+
export declare const parseNewestCiRun: (body: unknown) => NewestCiRunResponse;
|
|
198
217
|
/**
|
|
199
218
|
* The `details` of a refusal, when it carries a list of problems.
|
|
200
219
|
*
|
|
@@ -1963,6 +1963,13 @@ var Api = {
|
|
|
1963
1963
|
* which is the one the Studio has always told.
|
|
1964
1964
|
*/
|
|
1965
1965
|
sourceMode: zod.z.union([zod.z.literal("managed"), zod.z.literal("connected")]).optional(),
|
|
1966
|
+
/**
|
|
1967
|
+
* A press of Publish is a publish JOB: every managed project,
|
|
1968
|
+
* and a connected one hosted on the platform. Absent from a
|
|
1969
|
+
* server that predates it: managed projects publish as jobs,
|
|
1970
|
+
* connected ones by commit.
|
|
1971
|
+
*/
|
|
1972
|
+
publishJobs: zod.z["boolean"]().optional(),
|
|
1966
1973
|
publishRefusal: PublishRefusal.optional()
|
|
1967
1974
|
}), zod.z.object({
|
|
1968
1975
|
type: zod.z.literal("use-websocket"),
|
|
@@ -2060,6 +2067,13 @@ var Api = {
|
|
|
2060
2067
|
* which is the one the Studio has always told.
|
|
2061
2068
|
*/
|
|
2062
2069
|
sourceMode: zod.z.union([zod.z.literal("managed"), zod.z.literal("connected")]).optional(),
|
|
2070
|
+
/**
|
|
2071
|
+
* A press of Publish is a publish JOB: every managed project,
|
|
2072
|
+
* and a connected one hosted on the platform. Absent from a
|
|
2073
|
+
* server that predates it: managed projects publish as jobs,
|
|
2074
|
+
* connected ones by commit.
|
|
2075
|
+
*/
|
|
2076
|
+
publishJobs: zod.z["boolean"]().optional(),
|
|
2063
2077
|
publishRefusal: PublishRefusal.optional()
|
|
2064
2078
|
})])
|
|
2065
2079
|
})])
|
|
@@ -2601,39 +2615,49 @@ var Api = {
|
|
|
2601
2615
|
})])
|
|
2602
2616
|
}
|
|
2603
2617
|
},
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
* with every commit since it applied, for a build made in the browser.
|
|
2607
|
-
*
|
|
2608
|
-
* A Studio build starts from the source stored with the live build. A commit
|
|
2609
|
-
* whose own publish failed -- or the first commit of a project that started
|
|
2610
|
-
* as a copy of a template -- is in content and in no stored source, so a build
|
|
2611
|
-
* that added only its own save's files shipped without it. Only this server
|
|
2612
|
-
* can render those commits back into text: content keeps a managed project's
|
|
2613
|
-
* content as Source, not as files.
|
|
2614
|
-
*
|
|
2615
|
-
* Committed patches only. A pending one is somebody's unpublished work, and
|
|
2616
|
-
* is not this build's to ship. 409 where there is nothing to answer with: a
|
|
2617
|
-
* project with a repository, or a build that did not embed its source.
|
|
2618
|
-
*/
|
|
2619
|
-
"/built-source": {
|
|
2620
|
-
GET: {
|
|
2618
|
+
"/publish-job-prepare": {
|
|
2619
|
+
POST: {
|
|
2621
2620
|
req: {
|
|
2621
|
+
body: zod.z.object({
|
|
2622
|
+
jobId: zod.z.string().regex(/^[A-Za-z0-9_-]{1,100}$/),
|
|
2623
|
+
tab: zod.z.string().regex(/^[A-Za-z0-9_-]{1,100}$/),
|
|
2624
|
+
/** The job's changes, as content handed them to the tab. */
|
|
2625
|
+
patchIds: zod.z.array(PatchId)
|
|
2626
|
+
}),
|
|
2622
2627
|
cookies: {
|
|
2623
2628
|
val_session: zod.z.string().optional()
|
|
2624
2629
|
}
|
|
2625
2630
|
},
|
|
2626
2631
|
res: zod.z.union([unauthorizedResponse, zod.z.object({
|
|
2632
|
+
status: zod.z.literal(400),
|
|
2633
|
+
json: GenericError
|
|
2634
|
+
}), zod.z.object({
|
|
2627
2635
|
status: zod.z.literal(409),
|
|
2628
2636
|
json: GenericError
|
|
2629
2637
|
}), zod.z.object({
|
|
2630
2638
|
status: zod.z.literal(500),
|
|
2631
2639
|
json: GenericError
|
|
2640
|
+
}), zod.z.object({
|
|
2641
|
+
status: zod.z.literal(502),
|
|
2642
|
+
json: GenericError
|
|
2632
2643
|
}), zod.z.object({
|
|
2633
2644
|
status: zod.z.literal(200),
|
|
2634
2645
|
json: zod.z.object({
|
|
2635
|
-
/**
|
|
2636
|
-
|
|
2646
|
+
/** The job as content has it now: its next step is the build. */
|
|
2647
|
+
job: zod.z.object({
|
|
2648
|
+
id: zod.z.string(),
|
|
2649
|
+
step: zod.z["enum"](["prepare", "build", "upload"]).nullable(),
|
|
2650
|
+
base: zod.z.string().nullable(),
|
|
2651
|
+
patches: zod.z.array(zod.z.string())
|
|
2652
|
+
}).nullable(),
|
|
2653
|
+
/** Every source file of the job's content, by path. `null` is deleted. */
|
|
2654
|
+
sourceFiles: zod.z.record(zod.z.string(), zod.z.string().nullable()),
|
|
2655
|
+
/** The job's own local binary files, base64, by path. */
|
|
2656
|
+
binaryFiles: zod.z.record(zod.z.string(), zod.z.string()),
|
|
2657
|
+
/** Binary files whose bytes could not be read back. */
|
|
2658
|
+
binaryFilesUnread: zod.z.array(zod.z.string()),
|
|
2659
|
+
/** The branch the job publishes to. */
|
|
2660
|
+
branch: zod.z.string().nullable()
|
|
2637
2661
|
})
|
|
2638
2662
|
})])
|
|
2639
2663
|
}
|
|
@@ -7515,6 +7539,88 @@ var parseProjectSource = function parseProjectSource(body) {
|
|
|
7515
7539
|
return parse(projectSourceResponse, body, "GET /v1/project-source");
|
|
7516
7540
|
};
|
|
7517
7541
|
|
|
7542
|
+
// ------------------------------------------------------ publish jobs
|
|
7543
|
+
|
|
7544
|
+
/*
|
|
7545
|
+
* Publishing as a queued job (valbuild/home docs/app-mode.md, "Publishing is a
|
|
7546
|
+
* queued job"): a press is a request, the tab builds and uploads the job it is
|
|
7547
|
+
* given, and content runs verify and the seal. Each parser is typed against
|
|
7548
|
+
* the copy in `contentApi.ts`, so a copy brought up to date fails to compile
|
|
7549
|
+
* here until these follow it.
|
|
7550
|
+
*/
|
|
7551
|
+
|
|
7552
|
+
var requestStatus = zod.z.union([zod.z.object({
|
|
7553
|
+
kind: zod.z.literal("queued")
|
|
7554
|
+
}), zod.z.object({
|
|
7555
|
+
kind: zod.z.literal("publishing")
|
|
7556
|
+
}), zod.z.object({
|
|
7557
|
+
kind: zod.z.literal("live"),
|
|
7558
|
+
commit: zod.z.string()
|
|
7559
|
+
}), zod.z.object({
|
|
7560
|
+
kind: zod.z.literal("failed"),
|
|
7561
|
+
message: zod.z.string(),
|
|
7562
|
+
actions: zod.z.array(zod.z["enum"](["try-again", "discard", "re-run-build"])),
|
|
7563
|
+
job: zod.z.string()
|
|
7564
|
+
}), zod.z.object({
|
|
7565
|
+
kind: zod.z.literal("cancelled")
|
|
7566
|
+
}), zod.z.object({
|
|
7567
|
+
kind: zod.z.literal("nothing-to-publish")
|
|
7568
|
+
})]);
|
|
7569
|
+
var tabJob = zod.z.object({
|
|
7570
|
+
id: zod.z.string(),
|
|
7571
|
+
step: zod.z["enum"](["prepare", "build", "upload"]).nullable(),
|
|
7572
|
+
base: zod.z.string().nullable(),
|
|
7573
|
+
patches: zod.z.array(zod.z.string())
|
|
7574
|
+
});
|
|
7575
|
+
var pressResponse = zod.z.object({
|
|
7576
|
+
request: requestStatus,
|
|
7577
|
+
job: tabJob.nullable()
|
|
7578
|
+
});
|
|
7579
|
+
var requestStatusResponse = zod.z.object({
|
|
7580
|
+
request: requestStatus
|
|
7581
|
+
});
|
|
7582
|
+
// `/next`, `/prepare` and `/steps` all answer with the job as it now is.
|
|
7583
|
+
var jobResponse = zod.z.object({
|
|
7584
|
+
job: tabJob.nullable()
|
|
7585
|
+
});
|
|
7586
|
+
var renewResponse = zod.z.object({
|
|
7587
|
+
renewed: zod.z["boolean"]()
|
|
7588
|
+
});
|
|
7589
|
+
var cancelResponse = zod.z.object({
|
|
7590
|
+
cancelled: zod.z["boolean"]()
|
|
7591
|
+
});
|
|
7592
|
+
var discardResponse = zod.z.object({
|
|
7593
|
+
stillHeld: zod.z.array(zod.z.string())
|
|
7594
|
+
});
|
|
7595
|
+
var parsePress = function parsePress(body, call) {
|
|
7596
|
+
return parse(pressResponse, body, call);
|
|
7597
|
+
};
|
|
7598
|
+
var parseRequestStatus = function parseRequestStatus(body) {
|
|
7599
|
+
return parse(requestStatusResponse, body, "GET /v1/publish-requests/{id}");
|
|
7600
|
+
};
|
|
7601
|
+
var parseJob = function parseJob(body, call) {
|
|
7602
|
+
return parse(jobResponse, body, call);
|
|
7603
|
+
};
|
|
7604
|
+
var parseRenew = function parseRenew(body) {
|
|
7605
|
+
return parse(renewResponse, body, "POST /v1/publish-jobs/{id}/renew");
|
|
7606
|
+
};
|
|
7607
|
+
var parseCancel = function parseCancel(body) {
|
|
7608
|
+
return parse(cancelResponse, body, "POST /v1/publish-jobs/{id}/cancel");
|
|
7609
|
+
};
|
|
7610
|
+
var parseDiscard = function parseDiscard(body) {
|
|
7611
|
+
return parse(discardResponse, body, "POST /v1/publish-jobs/{id}/discard");
|
|
7612
|
+
};
|
|
7613
|
+
var newestCiRunResponse = zod.z.object({
|
|
7614
|
+
run: zod.z.object({
|
|
7615
|
+
commit: zod.z.string(),
|
|
7616
|
+
status: zod.z["enum"](["failed", "succeeded"]),
|
|
7617
|
+
url: zod.z.string().nullable()
|
|
7618
|
+
}).nullable()
|
|
7619
|
+
});
|
|
7620
|
+
var parseNewestCiRun = function parseNewestCiRun(body) {
|
|
7621
|
+
return parse(newestCiRunResponse, body, "GET /v1/ci-runs/newest");
|
|
7622
|
+
};
|
|
7623
|
+
|
|
7518
7624
|
/**
|
|
7519
7625
|
* The `details` of a refusal, when it carries a list of problems.
|
|
7520
7626
|
*
|
|
@@ -7671,11 +7777,18 @@ exports.memoizePerRequest = memoizePerRequest;
|
|
|
7671
7777
|
exports.newestCommitSha = newestCommitSha;
|
|
7672
7778
|
exports.parseArtifacts = parseArtifacts;
|
|
7673
7779
|
exports.parseBuildTarget = parseBuildTarget;
|
|
7780
|
+
exports.parseCancel = parseCancel;
|
|
7674
7781
|
exports.parseDeclare = parseDeclare;
|
|
7782
|
+
exports.parseDiscard = parseDiscard;
|
|
7783
|
+
exports.parseJob = parseJob;
|
|
7784
|
+
exports.parseNewestCiRun = parseNewestCiRun;
|
|
7785
|
+
exports.parsePress = parsePress;
|
|
7675
7786
|
exports.parseProblems = parseProblems;
|
|
7676
7787
|
exports.parseProjectSource = parseProjectSource;
|
|
7677
7788
|
exports.parsePromote = parsePromote;
|
|
7678
7789
|
exports.parsePublishToken = parsePublishToken;
|
|
7790
|
+
exports.parseRenew = parseRenew;
|
|
7791
|
+
exports.parseRequestStatus = parseRequestStatus;
|
|
7679
7792
|
exports.parseStatus = parseStatus;
|
|
7680
7793
|
exports.parseUpdateTarget = parseUpdateTarget;
|
|
7681
7794
|
exports.parseVerify = parseVerify;
|
|
@@ -1963,6 +1963,13 @@ var Api = {
|
|
|
1963
1963
|
* which is the one the Studio has always told.
|
|
1964
1964
|
*/
|
|
1965
1965
|
sourceMode: zod.z.union([zod.z.literal("managed"), zod.z.literal("connected")]).optional(),
|
|
1966
|
+
/**
|
|
1967
|
+
* A press of Publish is a publish JOB: every managed project,
|
|
1968
|
+
* and a connected one hosted on the platform. Absent from a
|
|
1969
|
+
* server that predates it: managed projects publish as jobs,
|
|
1970
|
+
* connected ones by commit.
|
|
1971
|
+
*/
|
|
1972
|
+
publishJobs: zod.z["boolean"]().optional(),
|
|
1966
1973
|
publishRefusal: PublishRefusal.optional()
|
|
1967
1974
|
}), zod.z.object({
|
|
1968
1975
|
type: zod.z.literal("use-websocket"),
|
|
@@ -2060,6 +2067,13 @@ var Api = {
|
|
|
2060
2067
|
* which is the one the Studio has always told.
|
|
2061
2068
|
*/
|
|
2062
2069
|
sourceMode: zod.z.union([zod.z.literal("managed"), zod.z.literal("connected")]).optional(),
|
|
2070
|
+
/**
|
|
2071
|
+
* A press of Publish is a publish JOB: every managed project,
|
|
2072
|
+
* and a connected one hosted on the platform. Absent from a
|
|
2073
|
+
* server that predates it: managed projects publish as jobs,
|
|
2074
|
+
* connected ones by commit.
|
|
2075
|
+
*/
|
|
2076
|
+
publishJobs: zod.z["boolean"]().optional(),
|
|
2063
2077
|
publishRefusal: PublishRefusal.optional()
|
|
2064
2078
|
})])
|
|
2065
2079
|
})])
|
|
@@ -2601,39 +2615,49 @@ var Api = {
|
|
|
2601
2615
|
})])
|
|
2602
2616
|
}
|
|
2603
2617
|
},
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
* with every commit since it applied, for a build made in the browser.
|
|
2607
|
-
*
|
|
2608
|
-
* A Studio build starts from the source stored with the live build. A commit
|
|
2609
|
-
* whose own publish failed -- or the first commit of a project that started
|
|
2610
|
-
* as a copy of a template -- is in content and in no stored source, so a build
|
|
2611
|
-
* that added only its own save's files shipped without it. Only this server
|
|
2612
|
-
* can render those commits back into text: content keeps a managed project's
|
|
2613
|
-
* content as Source, not as files.
|
|
2614
|
-
*
|
|
2615
|
-
* Committed patches only. A pending one is somebody's unpublished work, and
|
|
2616
|
-
* is not this build's to ship. 409 where there is nothing to answer with: a
|
|
2617
|
-
* project with a repository, or a build that did not embed its source.
|
|
2618
|
-
*/
|
|
2619
|
-
"/built-source": {
|
|
2620
|
-
GET: {
|
|
2618
|
+
"/publish-job-prepare": {
|
|
2619
|
+
POST: {
|
|
2621
2620
|
req: {
|
|
2621
|
+
body: zod.z.object({
|
|
2622
|
+
jobId: zod.z.string().regex(/^[A-Za-z0-9_-]{1,100}$/),
|
|
2623
|
+
tab: zod.z.string().regex(/^[A-Za-z0-9_-]{1,100}$/),
|
|
2624
|
+
/** The job's changes, as content handed them to the tab. */
|
|
2625
|
+
patchIds: zod.z.array(PatchId)
|
|
2626
|
+
}),
|
|
2622
2627
|
cookies: {
|
|
2623
2628
|
val_session: zod.z.string().optional()
|
|
2624
2629
|
}
|
|
2625
2630
|
},
|
|
2626
2631
|
res: zod.z.union([unauthorizedResponse, zod.z.object({
|
|
2632
|
+
status: zod.z.literal(400),
|
|
2633
|
+
json: GenericError
|
|
2634
|
+
}), zod.z.object({
|
|
2627
2635
|
status: zod.z.literal(409),
|
|
2628
2636
|
json: GenericError
|
|
2629
2637
|
}), zod.z.object({
|
|
2630
2638
|
status: zod.z.literal(500),
|
|
2631
2639
|
json: GenericError
|
|
2640
|
+
}), zod.z.object({
|
|
2641
|
+
status: zod.z.literal(502),
|
|
2642
|
+
json: GenericError
|
|
2632
2643
|
}), zod.z.object({
|
|
2633
2644
|
status: zod.z.literal(200),
|
|
2634
2645
|
json: zod.z.object({
|
|
2635
|
-
/**
|
|
2636
|
-
|
|
2646
|
+
/** The job as content has it now: its next step is the build. */
|
|
2647
|
+
job: zod.z.object({
|
|
2648
|
+
id: zod.z.string(),
|
|
2649
|
+
step: zod.z["enum"](["prepare", "build", "upload"]).nullable(),
|
|
2650
|
+
base: zod.z.string().nullable(),
|
|
2651
|
+
patches: zod.z.array(zod.z.string())
|
|
2652
|
+
}).nullable(),
|
|
2653
|
+
/** Every source file of the job's content, by path. `null` is deleted. */
|
|
2654
|
+
sourceFiles: zod.z.record(zod.z.string(), zod.z.string().nullable()),
|
|
2655
|
+
/** The job's own local binary files, base64, by path. */
|
|
2656
|
+
binaryFiles: zod.z.record(zod.z.string(), zod.z.string()),
|
|
2657
|
+
/** Binary files whose bytes could not be read back. */
|
|
2658
|
+
binaryFilesUnread: zod.z.array(zod.z.string()),
|
|
2659
|
+
/** The branch the job publishes to. */
|
|
2660
|
+
branch: zod.z.string().nullable()
|
|
2637
2661
|
})
|
|
2638
2662
|
})])
|
|
2639
2663
|
}
|
|
@@ -7515,6 +7539,88 @@ var parseProjectSource = function parseProjectSource(body) {
|
|
|
7515
7539
|
return parse(projectSourceResponse, body, "GET /v1/project-source");
|
|
7516
7540
|
};
|
|
7517
7541
|
|
|
7542
|
+
// ------------------------------------------------------ publish jobs
|
|
7543
|
+
|
|
7544
|
+
/*
|
|
7545
|
+
* Publishing as a queued job (valbuild/home docs/app-mode.md, "Publishing is a
|
|
7546
|
+
* queued job"): a press is a request, the tab builds and uploads the job it is
|
|
7547
|
+
* given, and content runs verify and the seal. Each parser is typed against
|
|
7548
|
+
* the copy in `contentApi.ts`, so a copy brought up to date fails to compile
|
|
7549
|
+
* here until these follow it.
|
|
7550
|
+
*/
|
|
7551
|
+
|
|
7552
|
+
var requestStatus = zod.z.union([zod.z.object({
|
|
7553
|
+
kind: zod.z.literal("queued")
|
|
7554
|
+
}), zod.z.object({
|
|
7555
|
+
kind: zod.z.literal("publishing")
|
|
7556
|
+
}), zod.z.object({
|
|
7557
|
+
kind: zod.z.literal("live"),
|
|
7558
|
+
commit: zod.z.string()
|
|
7559
|
+
}), zod.z.object({
|
|
7560
|
+
kind: zod.z.literal("failed"),
|
|
7561
|
+
message: zod.z.string(),
|
|
7562
|
+
actions: zod.z.array(zod.z["enum"](["try-again", "discard", "re-run-build"])),
|
|
7563
|
+
job: zod.z.string()
|
|
7564
|
+
}), zod.z.object({
|
|
7565
|
+
kind: zod.z.literal("cancelled")
|
|
7566
|
+
}), zod.z.object({
|
|
7567
|
+
kind: zod.z.literal("nothing-to-publish")
|
|
7568
|
+
})]);
|
|
7569
|
+
var tabJob = zod.z.object({
|
|
7570
|
+
id: zod.z.string(),
|
|
7571
|
+
step: zod.z["enum"](["prepare", "build", "upload"]).nullable(),
|
|
7572
|
+
base: zod.z.string().nullable(),
|
|
7573
|
+
patches: zod.z.array(zod.z.string())
|
|
7574
|
+
});
|
|
7575
|
+
var pressResponse = zod.z.object({
|
|
7576
|
+
request: requestStatus,
|
|
7577
|
+
job: tabJob.nullable()
|
|
7578
|
+
});
|
|
7579
|
+
var requestStatusResponse = zod.z.object({
|
|
7580
|
+
request: requestStatus
|
|
7581
|
+
});
|
|
7582
|
+
// `/next`, `/prepare` and `/steps` all answer with the job as it now is.
|
|
7583
|
+
var jobResponse = zod.z.object({
|
|
7584
|
+
job: tabJob.nullable()
|
|
7585
|
+
});
|
|
7586
|
+
var renewResponse = zod.z.object({
|
|
7587
|
+
renewed: zod.z["boolean"]()
|
|
7588
|
+
});
|
|
7589
|
+
var cancelResponse = zod.z.object({
|
|
7590
|
+
cancelled: zod.z["boolean"]()
|
|
7591
|
+
});
|
|
7592
|
+
var discardResponse = zod.z.object({
|
|
7593
|
+
stillHeld: zod.z.array(zod.z.string())
|
|
7594
|
+
});
|
|
7595
|
+
var parsePress = function parsePress(body, call) {
|
|
7596
|
+
return parse(pressResponse, body, call);
|
|
7597
|
+
};
|
|
7598
|
+
var parseRequestStatus = function parseRequestStatus(body) {
|
|
7599
|
+
return parse(requestStatusResponse, body, "GET /v1/publish-requests/{id}");
|
|
7600
|
+
};
|
|
7601
|
+
var parseJob = function parseJob(body, call) {
|
|
7602
|
+
return parse(jobResponse, body, call);
|
|
7603
|
+
};
|
|
7604
|
+
var parseRenew = function parseRenew(body) {
|
|
7605
|
+
return parse(renewResponse, body, "POST /v1/publish-jobs/{id}/renew");
|
|
7606
|
+
};
|
|
7607
|
+
var parseCancel = function parseCancel(body) {
|
|
7608
|
+
return parse(cancelResponse, body, "POST /v1/publish-jobs/{id}/cancel");
|
|
7609
|
+
};
|
|
7610
|
+
var parseDiscard = function parseDiscard(body) {
|
|
7611
|
+
return parse(discardResponse, body, "POST /v1/publish-jobs/{id}/discard");
|
|
7612
|
+
};
|
|
7613
|
+
var newestCiRunResponse = zod.z.object({
|
|
7614
|
+
run: zod.z.object({
|
|
7615
|
+
commit: zod.z.string(),
|
|
7616
|
+
status: zod.z["enum"](["failed", "succeeded"]),
|
|
7617
|
+
url: zod.z.string().nullable()
|
|
7618
|
+
}).nullable()
|
|
7619
|
+
});
|
|
7620
|
+
var parseNewestCiRun = function parseNewestCiRun(body) {
|
|
7621
|
+
return parse(newestCiRunResponse, body, "GET /v1/ci-runs/newest");
|
|
7622
|
+
};
|
|
7623
|
+
|
|
7518
7624
|
/**
|
|
7519
7625
|
* The `details` of a refusal, when it carries a list of problems.
|
|
7520
7626
|
*
|
|
@@ -7671,11 +7777,18 @@ exports.memoizePerRequest = memoizePerRequest;
|
|
|
7671
7777
|
exports.newestCommitSha = newestCommitSha;
|
|
7672
7778
|
exports.parseArtifacts = parseArtifacts;
|
|
7673
7779
|
exports.parseBuildTarget = parseBuildTarget;
|
|
7780
|
+
exports.parseCancel = parseCancel;
|
|
7674
7781
|
exports.parseDeclare = parseDeclare;
|
|
7782
|
+
exports.parseDiscard = parseDiscard;
|
|
7783
|
+
exports.parseJob = parseJob;
|
|
7784
|
+
exports.parseNewestCiRun = parseNewestCiRun;
|
|
7785
|
+
exports.parsePress = parsePress;
|
|
7675
7786
|
exports.parseProblems = parseProblems;
|
|
7676
7787
|
exports.parseProjectSource = parseProjectSource;
|
|
7677
7788
|
exports.parsePromote = parsePromote;
|
|
7678
7789
|
exports.parsePublishToken = parsePublishToken;
|
|
7790
|
+
exports.parseRenew = parseRenew;
|
|
7791
|
+
exports.parseRequestStatus = parseRequestStatus;
|
|
7679
7792
|
exports.parseStatus = parseStatus;
|
|
7680
7793
|
exports.parseUpdateTarget = parseUpdateTarget;
|
|
7681
7794
|
exports.parseVerify = parseVerify;
|
|
@@ -1956,6 +1956,13 @@ var Api = {
|
|
|
1956
1956
|
* which is the one the Studio has always told.
|
|
1957
1957
|
*/
|
|
1958
1958
|
sourceMode: z.union([z.literal("managed"), z.literal("connected")]).optional(),
|
|
1959
|
+
/**
|
|
1960
|
+
* A press of Publish is a publish JOB: every managed project,
|
|
1961
|
+
* and a connected one hosted on the platform. Absent from a
|
|
1962
|
+
* server that predates it: managed projects publish as jobs,
|
|
1963
|
+
* connected ones by commit.
|
|
1964
|
+
*/
|
|
1965
|
+
publishJobs: z["boolean"]().optional(),
|
|
1959
1966
|
publishRefusal: PublishRefusal.optional()
|
|
1960
1967
|
}), z.object({
|
|
1961
1968
|
type: z.literal("use-websocket"),
|
|
@@ -2053,6 +2060,13 @@ var Api = {
|
|
|
2053
2060
|
* which is the one the Studio has always told.
|
|
2054
2061
|
*/
|
|
2055
2062
|
sourceMode: z.union([z.literal("managed"), z.literal("connected")]).optional(),
|
|
2063
|
+
/**
|
|
2064
|
+
* A press of Publish is a publish JOB: every managed project,
|
|
2065
|
+
* and a connected one hosted on the platform. Absent from a
|
|
2066
|
+
* server that predates it: managed projects publish as jobs,
|
|
2067
|
+
* connected ones by commit.
|
|
2068
|
+
*/
|
|
2069
|
+
publishJobs: z["boolean"]().optional(),
|
|
2056
2070
|
publishRefusal: PublishRefusal.optional()
|
|
2057
2071
|
})])
|
|
2058
2072
|
})])
|
|
@@ -2594,39 +2608,49 @@ var Api = {
|
|
|
2594
2608
|
})])
|
|
2595
2609
|
}
|
|
2596
2610
|
},
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
* with every commit since it applied, for a build made in the browser.
|
|
2600
|
-
*
|
|
2601
|
-
* A Studio build starts from the source stored with the live build. A commit
|
|
2602
|
-
* whose own publish failed -- or the first commit of a project that started
|
|
2603
|
-
* as a copy of a template -- is in content and in no stored source, so a build
|
|
2604
|
-
* that added only its own save's files shipped without it. Only this server
|
|
2605
|
-
* can render those commits back into text: content keeps a managed project's
|
|
2606
|
-
* content as Source, not as files.
|
|
2607
|
-
*
|
|
2608
|
-
* Committed patches only. A pending one is somebody's unpublished work, and
|
|
2609
|
-
* is not this build's to ship. 409 where there is nothing to answer with: a
|
|
2610
|
-
* project with a repository, or a build that did not embed its source.
|
|
2611
|
-
*/
|
|
2612
|
-
"/built-source": {
|
|
2613
|
-
GET: {
|
|
2611
|
+
"/publish-job-prepare": {
|
|
2612
|
+
POST: {
|
|
2614
2613
|
req: {
|
|
2614
|
+
body: z.object({
|
|
2615
|
+
jobId: z.string().regex(/^[A-Za-z0-9_-]{1,100}$/),
|
|
2616
|
+
tab: z.string().regex(/^[A-Za-z0-9_-]{1,100}$/),
|
|
2617
|
+
/** The job's changes, as content handed them to the tab. */
|
|
2618
|
+
patchIds: z.array(PatchId)
|
|
2619
|
+
}),
|
|
2615
2620
|
cookies: {
|
|
2616
2621
|
val_session: z.string().optional()
|
|
2617
2622
|
}
|
|
2618
2623
|
},
|
|
2619
2624
|
res: z.union([unauthorizedResponse, z.object({
|
|
2625
|
+
status: z.literal(400),
|
|
2626
|
+
json: GenericError
|
|
2627
|
+
}), z.object({
|
|
2620
2628
|
status: z.literal(409),
|
|
2621
2629
|
json: GenericError
|
|
2622
2630
|
}), z.object({
|
|
2623
2631
|
status: z.literal(500),
|
|
2624
2632
|
json: GenericError
|
|
2633
|
+
}), z.object({
|
|
2634
|
+
status: z.literal(502),
|
|
2635
|
+
json: GenericError
|
|
2625
2636
|
}), z.object({
|
|
2626
2637
|
status: z.literal(200),
|
|
2627
2638
|
json: z.object({
|
|
2628
|
-
/**
|
|
2629
|
-
|
|
2639
|
+
/** The job as content has it now: its next step is the build. */
|
|
2640
|
+
job: z.object({
|
|
2641
|
+
id: z.string(),
|
|
2642
|
+
step: z["enum"](["prepare", "build", "upload"]).nullable(),
|
|
2643
|
+
base: z.string().nullable(),
|
|
2644
|
+
patches: z.array(z.string())
|
|
2645
|
+
}).nullable(),
|
|
2646
|
+
/** Every source file of the job's content, by path. `null` is deleted. */
|
|
2647
|
+
sourceFiles: z.record(z.string(), z.string().nullable()),
|
|
2648
|
+
/** The job's own local binary files, base64, by path. */
|
|
2649
|
+
binaryFiles: z.record(z.string(), z.string()),
|
|
2650
|
+
/** Binary files whose bytes could not be read back. */
|
|
2651
|
+
binaryFilesUnread: z.array(z.string()),
|
|
2652
|
+
/** The branch the job publishes to. */
|
|
2653
|
+
branch: z.string().nullable()
|
|
2630
2654
|
})
|
|
2631
2655
|
})])
|
|
2632
2656
|
}
|
|
@@ -7508,6 +7532,88 @@ var parseProjectSource = function parseProjectSource(body) {
|
|
|
7508
7532
|
return parse(projectSourceResponse, body, "GET /v1/project-source");
|
|
7509
7533
|
};
|
|
7510
7534
|
|
|
7535
|
+
// ------------------------------------------------------ publish jobs
|
|
7536
|
+
|
|
7537
|
+
/*
|
|
7538
|
+
* Publishing as a queued job (valbuild/home docs/app-mode.md, "Publishing is a
|
|
7539
|
+
* queued job"): a press is a request, the tab builds and uploads the job it is
|
|
7540
|
+
* given, and content runs verify and the seal. Each parser is typed against
|
|
7541
|
+
* the copy in `contentApi.ts`, so a copy brought up to date fails to compile
|
|
7542
|
+
* here until these follow it.
|
|
7543
|
+
*/
|
|
7544
|
+
|
|
7545
|
+
var requestStatus = z.union([z.object({
|
|
7546
|
+
kind: z.literal("queued")
|
|
7547
|
+
}), z.object({
|
|
7548
|
+
kind: z.literal("publishing")
|
|
7549
|
+
}), z.object({
|
|
7550
|
+
kind: z.literal("live"),
|
|
7551
|
+
commit: z.string()
|
|
7552
|
+
}), z.object({
|
|
7553
|
+
kind: z.literal("failed"),
|
|
7554
|
+
message: z.string(),
|
|
7555
|
+
actions: z.array(z["enum"](["try-again", "discard", "re-run-build"])),
|
|
7556
|
+
job: z.string()
|
|
7557
|
+
}), z.object({
|
|
7558
|
+
kind: z.literal("cancelled")
|
|
7559
|
+
}), z.object({
|
|
7560
|
+
kind: z.literal("nothing-to-publish")
|
|
7561
|
+
})]);
|
|
7562
|
+
var tabJob = z.object({
|
|
7563
|
+
id: z.string(),
|
|
7564
|
+
step: z["enum"](["prepare", "build", "upload"]).nullable(),
|
|
7565
|
+
base: z.string().nullable(),
|
|
7566
|
+
patches: z.array(z.string())
|
|
7567
|
+
});
|
|
7568
|
+
var pressResponse = z.object({
|
|
7569
|
+
request: requestStatus,
|
|
7570
|
+
job: tabJob.nullable()
|
|
7571
|
+
});
|
|
7572
|
+
var requestStatusResponse = z.object({
|
|
7573
|
+
request: requestStatus
|
|
7574
|
+
});
|
|
7575
|
+
// `/next`, `/prepare` and `/steps` all answer with the job as it now is.
|
|
7576
|
+
var jobResponse = z.object({
|
|
7577
|
+
job: tabJob.nullable()
|
|
7578
|
+
});
|
|
7579
|
+
var renewResponse = z.object({
|
|
7580
|
+
renewed: z["boolean"]()
|
|
7581
|
+
});
|
|
7582
|
+
var cancelResponse = z.object({
|
|
7583
|
+
cancelled: z["boolean"]()
|
|
7584
|
+
});
|
|
7585
|
+
var discardResponse = z.object({
|
|
7586
|
+
stillHeld: z.array(z.string())
|
|
7587
|
+
});
|
|
7588
|
+
var parsePress = function parsePress(body, call) {
|
|
7589
|
+
return parse(pressResponse, body, call);
|
|
7590
|
+
};
|
|
7591
|
+
var parseRequestStatus = function parseRequestStatus(body) {
|
|
7592
|
+
return parse(requestStatusResponse, body, "GET /v1/publish-requests/{id}");
|
|
7593
|
+
};
|
|
7594
|
+
var parseJob = function parseJob(body, call) {
|
|
7595
|
+
return parse(jobResponse, body, call);
|
|
7596
|
+
};
|
|
7597
|
+
var parseRenew = function parseRenew(body) {
|
|
7598
|
+
return parse(renewResponse, body, "POST /v1/publish-jobs/{id}/renew");
|
|
7599
|
+
};
|
|
7600
|
+
var parseCancel = function parseCancel(body) {
|
|
7601
|
+
return parse(cancelResponse, body, "POST /v1/publish-jobs/{id}/cancel");
|
|
7602
|
+
};
|
|
7603
|
+
var parseDiscard = function parseDiscard(body) {
|
|
7604
|
+
return parse(discardResponse, body, "POST /v1/publish-jobs/{id}/discard");
|
|
7605
|
+
};
|
|
7606
|
+
var newestCiRunResponse = z.object({
|
|
7607
|
+
run: z.object({
|
|
7608
|
+
commit: z.string(),
|
|
7609
|
+
status: z["enum"](["failed", "succeeded"]),
|
|
7610
|
+
url: z.string().nullable()
|
|
7611
|
+
}).nullable()
|
|
7612
|
+
});
|
|
7613
|
+
var parseNewestCiRun = function parseNewestCiRun(body) {
|
|
7614
|
+
return parse(newestCiRunResponse, body, "GET /v1/ci-runs/newest");
|
|
7615
|
+
};
|
|
7616
|
+
|
|
7511
7617
|
/**
|
|
7512
7618
|
* The `details` of a refusal, when it carries a list of problems.
|
|
7513
7619
|
*
|
|
@@ -7529,4 +7635,4 @@ function parse(schema, body, call) {
|
|
|
7529
7635
|
return parsed.data;
|
|
7530
7636
|
}
|
|
7531
7637
|
|
|
7532
|
-
export { AA_LARGE, AA_TEXT, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, ModuleComparison, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchGroup, PatchId, PatchJSON, PublishProtocolError, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SerializedValViewSchema, SharedValConfig, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, ValCommit, ValDeployment, accentRamp, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, chainHeadOf, checkCompatibility, chooseEncoded, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, explainIncompatible, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, indexModule, isMimeTypeAccepted, isRemoteSchema, isSchemaSourceFixError, isSkippedSource, keyOfRecordPath, levenshtein, localeAt, memoizePerRequest, newestCommitSha, parseArtifacts, parseBuildTarget, parseDeclare, parseProblems, parseProjectSource, parsePromote, parsePublishToken, parseStatus, parseUpdateTarget, parseVerify, partitionValidationErrors, performSearch, relativeLuminance, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextToRemirror, safeParsePatch, sourcePathOfChild, themeCustomProperties, toolNames, traverseSchemaSource, urlOf, validateRoutePatterns, withExtension };
|
|
7638
|
+
export { AA_LARGE, AA_TEXT, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, ModuleComparison, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchGroup, PatchId, PatchJSON, PublishProtocolError, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SerializedValViewSchema, SharedValConfig, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, ValCommit, ValDeployment, accentRamp, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, chainHeadOf, checkCompatibility, chooseEncoded, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, explainIncompatible, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, indexModule, isMimeTypeAccepted, isRemoteSchema, isSchemaSourceFixError, isSkippedSource, keyOfRecordPath, levenshtein, localeAt, memoizePerRequest, newestCommitSha, parseArtifacts, parseBuildTarget, parseCancel, parseDeclare, parseDiscard, parseJob, parseNewestCiRun, parsePress, parseProblems, parseProjectSource, parsePromote, parsePublishToken, parseRenew, parseRequestStatus, parseStatus, parseUpdateTarget, parseVerify, partitionValidationErrors, performSearch, relativeLuminance, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextToRemirror, safeParsePatch, sourcePathOfChild, themeCustomProperties, toolNames, traverseSchemaSource, urlOf, validateRoutePatterns, withExtension };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.138.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Val shared types and utilities",
|
|
6
6
|
"repository": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"flexsearch": "^0.8.212",
|
|
38
38
|
"zod": "^4.4.3",
|
|
39
39
|
"zod-validation-error": "^5.0.0",
|
|
40
|
-
"@valbuild/core": "0.
|
|
40
|
+
"@valbuild/core": "0.138.0"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
43
|
"CHANGELOG.md",
|