@valbuild/shared 0.150.20 → 0.152.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 +268 -0
- package/client/dist/valbuild-shared-client.cjs.dev.js +1 -1
- package/client/dist/valbuild-shared-client.cjs.prod.js +1 -1
- package/client/dist/valbuild-shared-client.esm.js +1 -1
- package/dist/declarations/src/internal/ApiRoutes.d.ts +270 -2
- package/dist/declarations/src/internal/aiTools/toolNames.d.ts +1 -1
- package/dist/declarations/src/internal/content/applyChain.d.ts +124 -0
- package/dist/declarations/src/internal/content/buildRegistry.d.ts +36 -0
- package/dist/declarations/src/internal/content/jsonValuesOps.d.ts +110 -0
- package/dist/declarations/src/internal/content/moduleStore.d.ts +119 -0
- package/dist/declarations/src/internal/content/source.d.ts +71 -0
- package/dist/declarations/src/internal/content/version.d.ts +151 -0
- package/dist/declarations/src/internal/index.d.ts +8 -1
- package/dist/declarations/src/internal/publish/projectSource.d.ts +28 -0
- package/dist/declarations/src/internal/search/searchIndex.d.ts +34 -3
- package/dist/declarations/src/internal/server/types.d.ts +9 -1
- package/dist/declarations/src/internal/sketchpad/sketchFormat.d.ts +41 -6
- package/dist/declarations/src/internal/valCanvasProtocol.d.ts +46 -0
- package/dist/declarations/src/internal/valClientHeader.d.ts +36 -0
- package/dist/declarations/src/publish/callJson.d.ts +15 -0
- package/dist/declarations/src/publish/jobClient.d.ts +7 -1
- package/dist/declarations/src/publish/publishClient.d.ts +2 -14
- package/dist/{getSitemapTree-fef55872.esm.js → getSitemapTree-3c1b9e57.esm.js} +18 -2
- package/dist/{getSitemapTree-6dfa2f4e.cjs.dev.js → getSitemapTree-59c5ed5d.cjs.dev.js} +18 -2
- package/dist/{getSitemapTree-8a04f3cf.cjs.prod.js → getSitemapTree-6b9024d1.cjs.prod.js} +18 -2
- package/dist/{protocol-d0efb8cd.cjs.dev.js → projectSource-2a58ef15.cjs.dev.js} +221 -0
- package/dist/{protocol-55cfa3cf.esm.js → projectSource-7f0ee83c.esm.js} +216 -1
- package/dist/{protocol-b1055ef0.cjs.prod.js → projectSource-ed6aec39.cjs.prod.js} +221 -0
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +2521 -192
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +2521 -192
- package/internal/dist/valbuild-shared-internal.esm.js +2463 -175
- package/package.json +3 -3
- package/publish/dist/valbuild-shared-publish.cjs.dev.js +48 -155
- package/publish/dist/valbuild-shared-publish.cjs.prod.js +48 -155
- package/publish/dist/valbuild-shared-publish.esm.js +17 -123
- package/dist/declarations/src/internal/server/requestScopedMemo.d.ts +0 -49
|
@@ -512,6 +512,75 @@ export declare const Api: {
|
|
|
512
512
|
}, z.core.$strip>]>;
|
|
513
513
|
};
|
|
514
514
|
};
|
|
515
|
+
/**
|
|
516
|
+
* What each module IS, right now: its version (`schema`, `base`, `chain`),
|
|
517
|
+
* and the project version that is relative to. What `/stat` answers, per
|
|
518
|
+
* module; see `docs/plans/one-content-model.md`, "The Studio loads
|
|
519
|
+
* everything from one place".
|
|
520
|
+
*
|
|
521
|
+
* It has its own ETag, so a client that sends it back (`If-None-Match`)
|
|
522
|
+
* gets a 304 and no body while nothing has moved. Computed from versions
|
|
523
|
+
* kept as content changes: answering it hashes nothing.
|
|
524
|
+
*
|
|
525
|
+
* "Since `seq` N" (`?since=N`, with the ETag of the manifest the client
|
|
526
|
+
* holds, which was answered at `seq` N, as `If-None-Match`): the modules
|
|
527
|
+
* whose version moved since that manifest, and no others, with `since: N`
|
|
528
|
+
* on the answer to say it is a delta. The ETag is in the body too (`tag`),
|
|
529
|
+
* for a client that reads answers through `ValClient`, which hands over
|
|
530
|
+
* the body and not the headers. Answered whole -- no `since` -- when the server no
|
|
531
|
+
* longer holds the manifest that ETag names (another process, another
|
|
532
|
+
* build, too long ago), and by a server of the release before, which
|
|
533
|
+
* ignores the parameter. Optional both ways.
|
|
534
|
+
*/
|
|
535
|
+
"/manifest": {
|
|
536
|
+
GET: {
|
|
537
|
+
req: {
|
|
538
|
+
cookies: {
|
|
539
|
+
val_session: z.ZodOptional<z.ZodString>;
|
|
540
|
+
};
|
|
541
|
+
headers: {
|
|
542
|
+
"if-none-match": z.ZodOptional<z.ZodString>;
|
|
543
|
+
};
|
|
544
|
+
query: {
|
|
545
|
+
since: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>>;
|
|
546
|
+
};
|
|
547
|
+
};
|
|
548
|
+
res: z.ZodUnion<readonly [z.ZodObject<{
|
|
549
|
+
status: z.ZodLiteral<401>;
|
|
550
|
+
json: z.ZodObject<{
|
|
551
|
+
message: z.ZodString;
|
|
552
|
+
}, z.core.$strip>;
|
|
553
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
554
|
+
status: z.ZodLiteral<500>;
|
|
555
|
+
json: z.ZodObject<{
|
|
556
|
+
message: z.ZodString;
|
|
557
|
+
}, z.core.$strip>;
|
|
558
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
559
|
+
status: z.ZodLiteral<200>;
|
|
560
|
+
json: z.ZodObject<{
|
|
561
|
+
project: z.ZodObject<{
|
|
562
|
+
build: z.ZodString;
|
|
563
|
+
seq: z.ZodNumber;
|
|
564
|
+
}, z.core.$strip>;
|
|
565
|
+
modules: z.ZodRecord<z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>, z.ZodObject<{
|
|
566
|
+
schema: z.ZodString;
|
|
567
|
+
base: z.ZodString;
|
|
568
|
+
chain: z.ZodString;
|
|
569
|
+
}, z.core.$strip>>;
|
|
570
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
571
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
572
|
+
superseded: z.ZodOptional<z.ZodBoolean>;
|
|
573
|
+
registry: z.ZodOptional<z.ZodObject<{
|
|
574
|
+
entry: z.ZodString;
|
|
575
|
+
core: z.ZodString;
|
|
576
|
+
}, z.core.$strip>>;
|
|
577
|
+
}, z.core.$strip>;
|
|
578
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
579
|
+
status: z.ZodLiteral<304>;
|
|
580
|
+
json: z.ZodOptional<z.ZodNull>;
|
|
581
|
+
}, z.core.$strip>]>;
|
|
582
|
+
};
|
|
583
|
+
};
|
|
515
584
|
"/stat": {
|
|
516
585
|
POST: {
|
|
517
586
|
req: {
|
|
@@ -580,6 +649,10 @@ export declare const Api: {
|
|
|
580
649
|
branch: z.ZodString;
|
|
581
650
|
}, z.core.$strip>>;
|
|
582
651
|
historyBranch: z.ZodOptional<z.ZodString>;
|
|
652
|
+
version: z.ZodOptional<z.ZodObject<{
|
|
653
|
+
build: z.ZodString;
|
|
654
|
+
seq: z.ZodNumber;
|
|
655
|
+
}, z.core.$strip>>;
|
|
583
656
|
}, z.core.$strip>, z.ZodObject<{
|
|
584
657
|
type: z.ZodLiteral<"use-websocket">;
|
|
585
658
|
url: z.ZodString;
|
|
@@ -634,6 +707,10 @@ export declare const Api: {
|
|
|
634
707
|
branch: z.ZodString;
|
|
635
708
|
}, z.core.$strip>>;
|
|
636
709
|
historyBranch: z.ZodOptional<z.ZodString>;
|
|
710
|
+
version: z.ZodOptional<z.ZodObject<{
|
|
711
|
+
build: z.ZodString;
|
|
712
|
+
seq: z.ZodNumber;
|
|
713
|
+
}, z.core.$strip>>;
|
|
637
714
|
}, z.core.$strip>]>;
|
|
638
715
|
}, z.core.$strip>]>;
|
|
639
716
|
};
|
|
@@ -675,11 +752,17 @@ export declare const Api: {
|
|
|
675
752
|
cookies: {
|
|
676
753
|
val_session: z.ZodOptional<z.ZodString>;
|
|
677
754
|
};
|
|
755
|
+
headers: {
|
|
756
|
+
"if-none-match": z.ZodOptional<z.ZodString>;
|
|
757
|
+
};
|
|
678
758
|
};
|
|
679
|
-
res: z.ZodObject<{
|
|
759
|
+
res: z.ZodUnion<readonly [z.ZodObject<{
|
|
680
760
|
status: z.ZodNumber;
|
|
681
761
|
json: z.ZodUnknown;
|
|
682
|
-
}, z.core.$strip
|
|
762
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
763
|
+
status: z.ZodLiteral<304>;
|
|
764
|
+
json: z.ZodOptional<z.ZodNull>;
|
|
765
|
+
}, z.core.$strip>]>;
|
|
683
766
|
};
|
|
684
767
|
POST: {
|
|
685
768
|
req: {
|
|
@@ -1182,6 +1265,22 @@ export declare const Api: {
|
|
|
1182
1265
|
}, z.core.$strip>]>;
|
|
1183
1266
|
headVersion: z.ZodOptional<z.ZodNumber>;
|
|
1184
1267
|
}, z.core.$strip>;
|
|
1268
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1269
|
+
status: z.ZodLiteral<502>;
|
|
1270
|
+
json: z.ZodObject<{
|
|
1271
|
+
type: z.ZodLiteral<"service-error">;
|
|
1272
|
+
message: z.ZodString;
|
|
1273
|
+
details: z.ZodOptional<z.ZodString>;
|
|
1274
|
+
newPatchIds: z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>;
|
|
1275
|
+
parentRef: z.ZodUnion<readonly [z.ZodObject<{
|
|
1276
|
+
type: z.ZodLiteral<"head">;
|
|
1277
|
+
headBaseSha: z.ZodString;
|
|
1278
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1279
|
+
type: z.ZodLiteral<"patch">;
|
|
1280
|
+
patchId: z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>;
|
|
1281
|
+
}, z.core.$strip>]>;
|
|
1282
|
+
headVersion: z.ZodOptional<z.ZodNumber>;
|
|
1283
|
+
}, z.core.$strip>;
|
|
1185
1284
|
}, z.core.$strip>, z.ZodObject<{
|
|
1186
1285
|
status: z.ZodLiteral<200>;
|
|
1187
1286
|
json: z.ZodObject<{
|
|
@@ -1232,6 +1331,7 @@ export declare const Api: {
|
|
|
1232
1331
|
error: z.ZodObject<{
|
|
1233
1332
|
message: z.ZodString;
|
|
1234
1333
|
}, z.core.$strip>;
|
|
1334
|
+
details: z.ZodOptional<z.ZodString>;
|
|
1235
1335
|
}, z.core.$strip>;
|
|
1236
1336
|
}, z.core.$strip>, z.ZodObject<{
|
|
1237
1337
|
status: z.ZodLiteral<200>;
|
|
@@ -1284,6 +1384,10 @@ export declare const Api: {
|
|
|
1284
1384
|
errors: z.ZodOptional<z.ZodRecord<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>, z.ZodObject<{
|
|
1285
1385
|
message: z.ZodString;
|
|
1286
1386
|
}, z.core.$strip>>>;
|
|
1387
|
+
version: z.ZodOptional<z.ZodObject<{
|
|
1388
|
+
build: z.ZodString;
|
|
1389
|
+
seq: z.ZodNumber;
|
|
1390
|
+
}, z.core.$strip>>;
|
|
1287
1391
|
}, z.core.$strip>;
|
|
1288
1392
|
}, z.core.$strip>]>;
|
|
1289
1393
|
};
|
|
@@ -1326,6 +1430,15 @@ export declare const Api: {
|
|
|
1326
1430
|
}, z.core.$strip>]>;
|
|
1327
1431
|
};
|
|
1328
1432
|
};
|
|
1433
|
+
/**
|
|
1434
|
+
* @deprecated The whole tree. Nothing of this release asks it: the Studio
|
|
1435
|
+
* reads modules by version (`GET /manifest`, `GET /modules/~`), the draft
|
|
1436
|
+
* readers and MCP read the head in-process. Kept, with `exclude_patches`
|
|
1437
|
+
* (`BaseAlignment`'s fetch) and the ignored `validate_sources` and
|
|
1438
|
+
* `validate_binary_files`, for a Studio of the release before; goes in the
|
|
1439
|
+
* release after the one that ships this (see "Release-delayed deletions"
|
|
1440
|
+
* in `docs/plans/one-content-model.md`).
|
|
1441
|
+
*/
|
|
1329
1442
|
"/sources/~": {
|
|
1330
1443
|
PUT: {
|
|
1331
1444
|
req: {
|
|
@@ -1397,8 +1510,153 @@ export declare const Api: {
|
|
|
1397
1510
|
fatal: z.ZodOptional<z.ZodBoolean>;
|
|
1398
1511
|
fixes: z.ZodOptional<z.ZodArray<z.ZodType<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "video:add-metadata" | "video:upload-remote" | "video:download-remote" | "videos:add-metadata" | "videos:check-remote" | "videos:upload-remote" | "keyof:check-keys" | "image:check-gallery" | "file:check-gallery" | "video:check-gallery" | "router:check-route" | "locale:check-locale" | "router:check-locale-param" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "videos:check-unique-folder" | "videos:check-all-files" | "jsonValues:extract-entry" | "record:fill-keys" | "external:upload" | "view:check-module" | "remote:rewrite-host", unknown, z.core.$ZodTypeInternals<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "video:add-metadata" | "video:upload-remote" | "video:download-remote" | "videos:add-metadata" | "videos:check-remote" | "videos:upload-remote" | "keyof:check-keys" | "image:check-gallery" | "file:check-gallery" | "video:check-gallery" | "router:check-route" | "locale:check-locale" | "router:check-locale-param" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "videos:check-unique-folder" | "videos:check-all-files" | "jsonValues:extract-entry" | "record:fill-keys" | "external:upload" | "view:check-module" | "remote:rewrite-host", unknown>>>>;
|
|
1399
1512
|
}, z.core.$strip>>>>;
|
|
1513
|
+
version: z.ZodOptional<z.ZodObject<{
|
|
1514
|
+
schema: z.ZodString;
|
|
1515
|
+
base: z.ZodString;
|
|
1516
|
+
chain: z.ZodString;
|
|
1517
|
+
}, z.core.$strip>>;
|
|
1518
|
+
}, z.core.$strip>>;
|
|
1519
|
+
project: z.ZodOptional<z.ZodObject<{
|
|
1520
|
+
build: z.ZodString;
|
|
1521
|
+
seq: z.ZodNumber;
|
|
1522
|
+
}, z.core.$strip>>;
|
|
1523
|
+
}, z.core.$strip>;
|
|
1524
|
+
}, z.core.$strip>]>;
|
|
1525
|
+
};
|
|
1526
|
+
};
|
|
1527
|
+
/**
|
|
1528
|
+
* One module by version: phase 6 of `docs/plans/one-content-model.md`
|
|
1529
|
+
* ("The Studio loads everything from one place"). `GET /modules/~<path>`,
|
|
1530
|
+
* with `v` the version wanted as its `moduleKey` (the newest when absent;
|
|
1531
|
+
* a base is a version with the empty chain) and `have` the version the
|
|
1532
|
+
* caller holds: when the caller's chain is a start of the answer's under
|
|
1533
|
+
* the same schema and base, the answer is the patches from it (`delta`),
|
|
1534
|
+
* otherwise the whole module. An answer for an asked `v` is immutable.
|
|
1535
|
+
*/
|
|
1536
|
+
"/modules/~": {
|
|
1537
|
+
GET: {
|
|
1538
|
+
req: {
|
|
1539
|
+
path: z.ZodString;
|
|
1540
|
+
query: {
|
|
1541
|
+
v: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>>;
|
|
1542
|
+
have: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>>;
|
|
1543
|
+
};
|
|
1544
|
+
cookies: {
|
|
1545
|
+
val_session: z.ZodOptional<z.ZodString>;
|
|
1546
|
+
};
|
|
1547
|
+
};
|
|
1548
|
+
res: z.ZodUnion<readonly [z.ZodObject<{
|
|
1549
|
+
status: z.ZodLiteral<401>;
|
|
1550
|
+
json: z.ZodObject<{
|
|
1551
|
+
message: z.ZodString;
|
|
1552
|
+
}, z.core.$strip>;
|
|
1553
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1554
|
+
status: z.ZodLiteral<404>;
|
|
1555
|
+
json: z.ZodObject<{
|
|
1556
|
+
message: z.ZodString;
|
|
1557
|
+
current: z.ZodOptional<z.ZodObject<{
|
|
1558
|
+
schema: z.ZodString;
|
|
1559
|
+
base: z.ZodString;
|
|
1560
|
+
chain: z.ZodString;
|
|
1400
1561
|
}, z.core.$strip>>;
|
|
1401
1562
|
}, z.core.$strip>;
|
|
1563
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1564
|
+
status: z.ZodLiteral<500>;
|
|
1565
|
+
json: z.ZodObject<{
|
|
1566
|
+
message: z.ZodString;
|
|
1567
|
+
}, z.core.$strip>;
|
|
1568
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1569
|
+
status: z.ZodLiteral<200>;
|
|
1570
|
+
headers: z.ZodOptional<z.ZodObject<{
|
|
1571
|
+
"Cache-Control": z.ZodString;
|
|
1572
|
+
}, z.core.$strip>>;
|
|
1573
|
+
json: z.ZodUnion<readonly [z.ZodObject<{
|
|
1574
|
+
kind: z.ZodLiteral<"module">;
|
|
1575
|
+
version: z.ZodObject<{
|
|
1576
|
+
schema: z.ZodString;
|
|
1577
|
+
base: z.ZodString;
|
|
1578
|
+
chain: z.ZodString;
|
|
1579
|
+
}, z.core.$strip>;
|
|
1580
|
+
source: z.ZodAny;
|
|
1581
|
+
entries: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
1582
|
+
content: z.ZodAny;
|
|
1583
|
+
version: z.ZodObject<{
|
|
1584
|
+
schema: z.ZodString;
|
|
1585
|
+
base: z.ZodString;
|
|
1586
|
+
chain: z.ZodString;
|
|
1587
|
+
key: z.ZodString;
|
|
1588
|
+
}, z.core.$strip>;
|
|
1589
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1590
|
+
deleted: z.ZodLiteral<true>;
|
|
1591
|
+
version: z.ZodObject<{
|
|
1592
|
+
schema: z.ZodString;
|
|
1593
|
+
base: z.ZodString;
|
|
1594
|
+
chain: z.ZodString;
|
|
1595
|
+
key: z.ZodString;
|
|
1596
|
+
}, z.core.$strip>;
|
|
1597
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1598
|
+
error: z.ZodString;
|
|
1599
|
+
patchId: z.ZodOptional<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>;
|
|
1600
|
+
version: z.ZodObject<{
|
|
1601
|
+
schema: z.ZodString;
|
|
1602
|
+
base: z.ZodString;
|
|
1603
|
+
chain: z.ZodString;
|
|
1604
|
+
key: z.ZodString;
|
|
1605
|
+
}, z.core.$strip>;
|
|
1606
|
+
}, z.core.$strip>]>>;
|
|
1607
|
+
patches: z.ZodOptional<z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>>;
|
|
1608
|
+
failed: z.ZodOptional<z.ZodObject<{
|
|
1609
|
+
patchId: z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>;
|
|
1610
|
+
message: z.ZodString;
|
|
1611
|
+
}, z.core.$strip>>;
|
|
1612
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1613
|
+
kind: z.ZodLiteral<"delta">;
|
|
1614
|
+
from: z.ZodObject<{
|
|
1615
|
+
schema: z.ZodString;
|
|
1616
|
+
base: z.ZodString;
|
|
1617
|
+
chain: z.ZodString;
|
|
1618
|
+
}, z.core.$strip>;
|
|
1619
|
+
to: z.ZodObject<{
|
|
1620
|
+
schema: z.ZodString;
|
|
1621
|
+
base: z.ZodString;
|
|
1622
|
+
chain: z.ZodString;
|
|
1623
|
+
}, z.core.$strip>;
|
|
1624
|
+
patches: z.ZodArray<z.ZodObject<{
|
|
1625
|
+
patchId: z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>;
|
|
1626
|
+
patch: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1627
|
+
op: z.ZodLiteral<"add">;
|
|
1628
|
+
path: z.ZodArray<z.ZodString>;
|
|
1629
|
+
value: z.ZodType<import("@valbuild/core/patch").JSONValue, unknown, z.core.$ZodTypeInternals<import("@valbuild/core/patch").JSONValue, unknown>>;
|
|
1630
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1631
|
+
op: z.ZodLiteral<"remove">;
|
|
1632
|
+
path: z.ZodTuple<[z.ZodString], z.ZodString>;
|
|
1633
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1634
|
+
op: z.ZodLiteral<"replace">;
|
|
1635
|
+
path: z.ZodArray<z.ZodString>;
|
|
1636
|
+
value: z.ZodType<import("@valbuild/core/patch").JSONValue, unknown, z.core.$ZodTypeInternals<import("@valbuild/core/patch").JSONValue, unknown>>;
|
|
1637
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1638
|
+
op: z.ZodLiteral<"move">;
|
|
1639
|
+
from: z.ZodTuple<[z.ZodString], z.ZodString>;
|
|
1640
|
+
path: z.ZodArray<z.ZodString>;
|
|
1641
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1642
|
+
op: z.ZodLiteral<"copy">;
|
|
1643
|
+
from: z.ZodArray<z.ZodString>;
|
|
1644
|
+
path: z.ZodArray<z.ZodString>;
|
|
1645
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1646
|
+
op: z.ZodLiteral<"test">;
|
|
1647
|
+
path: z.ZodArray<z.ZodString>;
|
|
1648
|
+
value: z.ZodType<import("@valbuild/core/patch").JSONValue, unknown, z.core.$ZodTypeInternals<import("@valbuild/core/patch").JSONValue, unknown>>;
|
|
1649
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1650
|
+
op: z.ZodLiteral<"file">;
|
|
1651
|
+
path: z.ZodArray<z.ZodString>;
|
|
1652
|
+
filePath: z.ZodString;
|
|
1653
|
+
value: z.ZodType<import("@valbuild/core/patch").JSONValue, unknown, z.core.$ZodTypeInternals<import("@valbuild/core/patch").JSONValue, unknown>>;
|
|
1654
|
+
remote: z.ZodBoolean;
|
|
1655
|
+
nestedFilePath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1656
|
+
metadata: z.ZodOptional<z.ZodType<import("@valbuild/core/patch").JSONValue, unknown, z.core.$ZodTypeInternals<import("@valbuild/core/patch").JSONValue, unknown>>>;
|
|
1657
|
+
}, z.core.$strict>], "op">>;
|
|
1658
|
+
}, z.core.$strip>>;
|
|
1659
|
+
}, z.core.$strip>]>;
|
|
1402
1660
|
}, z.core.$strip>]>;
|
|
1403
1661
|
};
|
|
1404
1662
|
};
|
|
@@ -2259,6 +2517,11 @@ export declare const Api: {
|
|
|
2259
2517
|
path: z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>;
|
|
2260
2518
|
key: z.ZodString;
|
|
2261
2519
|
content: z.ZodAny;
|
|
2520
|
+
version: z.ZodOptional<z.ZodObject<{
|
|
2521
|
+
schema: z.ZodString;
|
|
2522
|
+
base: z.ZodString;
|
|
2523
|
+
chain: z.ZodString;
|
|
2524
|
+
}, z.core.$strip>>;
|
|
2262
2525
|
}, z.core.$strip>;
|
|
2263
2526
|
}, z.core.$strip>, z.ZodObject<{
|
|
2264
2527
|
status: z.ZodLiteral<200>;
|
|
@@ -2276,6 +2539,11 @@ export declare const Api: {
|
|
|
2276
2539
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
2277
2540
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
2278
2541
|
total: z.ZodOptional<z.ZodNumber>;
|
|
2542
|
+
version: z.ZodOptional<z.ZodObject<{
|
|
2543
|
+
schema: z.ZodString;
|
|
2544
|
+
base: z.ZodString;
|
|
2545
|
+
chain: z.ZodString;
|
|
2546
|
+
}, z.core.$strip>>;
|
|
2279
2547
|
}, z.core.$strip>;
|
|
2280
2548
|
}, z.core.$strip>, z.ZodObject<{
|
|
2281
2549
|
status: z.ZodLiteral<400>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const toolNames: readonly ["get_all_schema", "get_source", "search_content", "validate_content", "create_patch", "add_session_image_to_gallery", "remove_image_gallery_entry", "navigate_to", "get_current_context", "get_patches", "get_source_path_from_route", "set_session_name", "show_compare_view", "ask_user_question", "duplicate_source", "empty_at_path", "count_entries", "get_record_keys", "list_sketchpads", "create_sketchpad", "read_sketchpad", "write_sketchpad"];
|
|
1
|
+
export declare const toolNames: readonly ["get_all_schema", "get_source", "search_content", "validate_content", "create_patch", "add_session_image_to_gallery", "remove_image_gallery_entry", "convert_session_image", "navigate_to", "get_current_context", "get_patches", "get_source_path_from_route", "set_session_name", "show_compare_view", "ask_user_question", "duplicate_source", "empty_at_path", "count_entries", "get_record_keys", "list_sketchpads", "create_sketchpad", "read_sketchpad", "write_sketchpad", "highlight_sketchpad_blocks", "clear_sketchpad_highlights"];
|
|
2
2
|
export type ToolName = (typeof toolNames)[number];
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { type PatchId } from "@valbuild/core";
|
|
2
|
+
import type { SerializedSchema } from "@valbuild/core";
|
|
3
|
+
import { type Operation, type Patch, type ReadonlyJSONValue } from "@valbuild/core/patch";
|
|
4
|
+
/** What one `.jsonValues()` entry is at a point in a module's chain. */
|
|
5
|
+
export type EntryState =
|
|
6
|
+
/** Its content, known. */
|
|
7
|
+
{
|
|
8
|
+
kind: "content";
|
|
9
|
+
content: ReadonlyJSONValue;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The content of the BASE entry `from` (its own key, or the one it was
|
|
13
|
+
* moved or copied from), with `ops` on top: an entry nobody has loaded,
|
|
14
|
+
* whose edits are held until somebody does ({@link resolveEntry}).
|
|
15
|
+
*/
|
|
16
|
+
| {
|
|
17
|
+
kind: "waiting";
|
|
18
|
+
from: string;
|
|
19
|
+
ops: HeldOps | null;
|
|
20
|
+
}
|
|
21
|
+
/** Removed, or moved away. */
|
|
22
|
+
| {
|
|
23
|
+
kind: "deleted";
|
|
24
|
+
}
|
|
25
|
+
/** An op on it could not be applied. Sticky, as a module's failure is. */
|
|
26
|
+
| {
|
|
27
|
+
kind: "error";
|
|
28
|
+
patchId: PatchId;
|
|
29
|
+
message: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The ops held for an entry, newest first: a list that is extended without
|
|
33
|
+
* copying, so a chain of N edits to an entry nobody loaded costs N, not N².
|
|
34
|
+
*/
|
|
35
|
+
export type HeldOps = {
|
|
36
|
+
readonly op: Operation;
|
|
37
|
+
readonly patchId: PatchId;
|
|
38
|
+
readonly before: HeldOps | null;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* A module's content: its source, and what its `.jsonValues()` entries are.
|
|
42
|
+
*
|
|
43
|
+
* `entries` holds only the entries the chain has touched. An entry it has
|
|
44
|
+
* not is the base's: `waiting` on its own key with nothing held, as long as
|
|
45
|
+
* the source has its marker ({@link entryState}). So a module with no
|
|
46
|
+
* entries, or a chain that never touches one, costs nothing here.
|
|
47
|
+
*/
|
|
48
|
+
export type ModuleContent = {
|
|
49
|
+
readonly source: ReadonlyJSONValue;
|
|
50
|
+
readonly entries: ReadonlyMap<string, EntryState>;
|
|
51
|
+
};
|
|
52
|
+
/** One patch of a module's chain. */
|
|
53
|
+
export type PatchRecord = {
|
|
54
|
+
readonly patchId: PatchId;
|
|
55
|
+
readonly patch: Patch;
|
|
56
|
+
};
|
|
57
|
+
export type PatchRecordResult = {
|
|
58
|
+
status: "applied";
|
|
59
|
+
module: ModuleContent;
|
|
60
|
+
} | {
|
|
61
|
+
status: "failed";
|
|
62
|
+
patchId: PatchId;
|
|
63
|
+
message: string;
|
|
64
|
+
};
|
|
65
|
+
/** A module's content with nothing applied yet: its base. */
|
|
66
|
+
export declare function baseModuleContent(source: ReadonlyJSONValue): ModuleContent;
|
|
67
|
+
/**
|
|
68
|
+
* The work the engine has done in this process: patches applied
|
|
69
|
+
* (`engine:apply-patch`) and bytes copied (`engine:clone-bytes`, see
|
|
70
|
+
* {@link SLOT_BYTES}). A test takes it before and after; never reset, so two
|
|
71
|
+
* readers of it cannot disturb each other.
|
|
72
|
+
*/
|
|
73
|
+
export declare function engineWork(): {
|
|
74
|
+
applyPatch: number;
|
|
75
|
+
cloneBytes: number;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Applies one patch to a module's content. Nothing is mutated: the module
|
|
79
|
+
* passed in is still what it was, and the one returned shares every subtree
|
|
80
|
+
* the patch did not touch.
|
|
81
|
+
*
|
|
82
|
+
* `failed` means the patch does not apply, and then none of it does: half a
|
|
83
|
+
* patch is half an edit. The caller stops the module's chain there.
|
|
84
|
+
*
|
|
85
|
+
* `schema` is the module's serialized schema: it says which ops reach into a
|
|
86
|
+
* `.jsonValues()` entry. Without one, every op is an op on the source.
|
|
87
|
+
*/
|
|
88
|
+
export declare function applyPatchRecord(module: ModuleContent, record: PatchRecord, schema: SerializedSchema | undefined): PatchRecordResult;
|
|
89
|
+
/**
|
|
90
|
+
* A module's chain: every patch in order, stopping at the first that does
|
|
91
|
+
* not apply. `applied` is how many did, so the chain the content is AT is
|
|
92
|
+
* the first `applied` ids -- what its version names.
|
|
93
|
+
*/
|
|
94
|
+
export declare function applyChain(module: ModuleContent, records: readonly PatchRecord[], schema: SerializedSchema | undefined): {
|
|
95
|
+
module: ModuleContent;
|
|
96
|
+
applied: number;
|
|
97
|
+
failed: {
|
|
98
|
+
patchId: PatchId;
|
|
99
|
+
message: string;
|
|
100
|
+
} | null;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* What an entry is in this module: what the chain made it, or -- for one the
|
|
104
|
+
* chain never touched -- the base's, if the source has its marker.
|
|
105
|
+
*/
|
|
106
|
+
export declare function entryState(module: ModuleContent, key: string): EntryState | undefined;
|
|
107
|
+
/** An entry's content, read. */
|
|
108
|
+
export type EntryContent = {
|
|
109
|
+
kind: "content";
|
|
110
|
+
content: ReadonlyJSONValue;
|
|
111
|
+
} | {
|
|
112
|
+
kind: "missing";
|
|
113
|
+
} | {
|
|
114
|
+
kind: "error";
|
|
115
|
+
message: string;
|
|
116
|
+
patchId?: PatchId;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* An entry's content: what {@link entryState} says, with what it was waiting
|
|
120
|
+
* for applied. `baseContentOf` is the BASE content of an entry by key (its
|
|
121
|
+
* `*.val.json`, or what a save left there), `undefined` for one the base does
|
|
122
|
+
* not have.
|
|
123
|
+
*/
|
|
124
|
+
export declare function resolveEntry(key: string, state: EntryState | undefined, baseContentOf: (key: string) => ReadonlyJSONValue | undefined): EntryContent;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a build's `val.modules` registry can be imported from: phase 9 of
|
|
3
|
+
* `docs/plans/one-content-model.md`, "Reloading the schema while the Studio
|
|
4
|
+
* runs".
|
|
5
|
+
*
|
|
6
|
+
* A build made by `@valbuild/tanstack-build` (every build the platform
|
|
7
|
+
* serves) emits its `val.modules` as an ES module of its own beside its
|
|
8
|
+
* client chunks, named after the build: `/_app/val-modules-<build>.js`,
|
|
9
|
+
* whose default export is the registry. The server running that build knows
|
|
10
|
+
* its name (`VAL_BUILD`, Val's `publishBuild`) and names the entry on
|
|
11
|
+
* `GET /manifest` (`registry`), so a Studio opened on an older build imports
|
|
12
|
+
* the new one's code and reloads it in place (`HostStore.reloadCode`)
|
|
13
|
+
* instead of being told to reload the page.
|
|
14
|
+
*
|
|
15
|
+
* The convention is the builder's and this file's together: the builder
|
|
16
|
+
* writes the file (`valModulesEntryFile` in `@valbuild/tanstack-build`, which
|
|
17
|
+
* does not depend on this package), and each side pins the same literal,
|
|
18
|
+
* `val-modules-<build>.js` (`buildRegistry.test.ts` here, `valModules.test.ts`
|
|
19
|
+
* there).
|
|
20
|
+
*/
|
|
21
|
+
/** The file a build's registry is emitted as, among its client chunks. */
|
|
22
|
+
export declare function valModulesEntryFile(build: string): string;
|
|
23
|
+
/** Where a build served by the platform serves its registry. */
|
|
24
|
+
export declare function valModulesEntryPath(build: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* What `GET /manifest` says about the code of the build that answered:
|
|
27
|
+
* where its registry is, and which Val it runs. A Studio running another
|
|
28
|
+
* Val cannot take the build's code in (its own stores would run against a
|
|
29
|
+
* new core), so it reloads itself instead (`other-val-version`).
|
|
30
|
+
*/
|
|
31
|
+
export type BuildRegistry = {
|
|
32
|
+
/** The registry's entry, from the site's origin. */
|
|
33
|
+
entry: string;
|
|
34
|
+
/** `@valbuild/core`'s version, as the build runs it. */
|
|
35
|
+
core: string;
|
|
36
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type SerializedSchema } from "@valbuild/core";
|
|
2
|
+
import { result } from "@valbuild/core/fp";
|
|
3
|
+
import { PatchError, type JSONValue, type Operation } from "@valbuild/core/patch";
|
|
4
|
+
/**
|
|
5
|
+
* Classification of a single patch op against a module's serialized schema,
|
|
6
|
+
* used by the commit flow to route ops for `.jsonValues()` records:
|
|
7
|
+
*
|
|
8
|
+
* - `normal`: the op does not descend into a `.jsonValues()` entry; apply it to
|
|
9
|
+
* the `.val.ts` as usual.
|
|
10
|
+
* - `entry`: the op targets a `.jsonValues()` entry. `recordPath` is the path to
|
|
11
|
+
* the record within the module source (empty for a root record/router),
|
|
12
|
+
* `entryKey` is the entry key, and `subPath` is the remaining path inside the
|
|
13
|
+
* entry (empty when the op targets the entry value itself, e.g. add/remove of
|
|
14
|
+
* the whole entry).
|
|
15
|
+
*/
|
|
16
|
+
export type JsonValuesOpClass = {
|
|
17
|
+
kind: "normal";
|
|
18
|
+
} | {
|
|
19
|
+
kind: "entry";
|
|
20
|
+
recordPath: string[];
|
|
21
|
+
entryKey: string;
|
|
22
|
+
subPath: string[];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Walks the serialized schema following the op path. When a `.jsonValues()`
|
|
26
|
+
* record is encountered, the next path segment is the entry key and everything
|
|
27
|
+
* after it lives inside the entry's `*.val.json` (so it does not touch the
|
|
28
|
+
* `.val.ts`). Returns `{ kind: "normal" }` when the op never enters a
|
|
29
|
+
* `.jsonValues()` record.
|
|
30
|
+
*/
|
|
31
|
+
export declare function classifyJsonValuesOp(schema: SerializedSchema, opPath: string[]): JsonValuesOpClass;
|
|
32
|
+
/**
|
|
33
|
+
* Is this op a write of the WHOLE record at the root of a `.jsonValues()`
|
|
34
|
+
* module?
|
|
35
|
+
*
|
|
36
|
+
* The one op {@link classifyJsonValuesOp} cannot classify: it finds the entry
|
|
37
|
+
* key by walking the op path, and the root path has no segments to walk, so a
|
|
38
|
+
* root write reads as `normal` and gets applied to the `.val.ts` - writing
|
|
39
|
+
* markers over the `c.json(() => import(...))` calls that make the entries load
|
|
40
|
+
* at all. {@link expandJsonValuesRootOp} turns it into ops that DO name a key,
|
|
41
|
+
* which everything downstream already handles.
|
|
42
|
+
*
|
|
43
|
+
* `add` counts as well as `replace`: at the root both mean "the document is now
|
|
44
|
+
* this" (see `JSONOps`), so both have to be expanded or the unexpanded one is
|
|
45
|
+
* the same bug again.
|
|
46
|
+
*
|
|
47
|
+
* The value has to BE a record, and that is part of the question rather than a
|
|
48
|
+
* check inside the expansion: a `.jsonValues()` record can be nullable, and
|
|
49
|
+
* `null` at the root means the module no longer has a record at all - there are
|
|
50
|
+
* no entries to write, and it is an ordinary `.val.ts` write, exactly as it was
|
|
51
|
+
* before any of this existed. Same for any other non-record value: not a
|
|
52
|
+
* whole-record write, so not this conversion's to route.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isJsonValuesRootOp(schema: SerializedSchema, op: Operation): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* One entry as it stands right now, for {@link expandJsonValuesRootOp} to
|
|
57
|
+
* expand against.
|
|
58
|
+
*
|
|
59
|
+
* The key set decides add-vs-replace-vs-remove. The content, where the caller
|
|
60
|
+
* has it, decides whether an op is emitted at all: an entry whose content is
|
|
61
|
+
* already what the root write says is left alone rather than rewritten, so
|
|
62
|
+
* putting a module back does not touch every `*.val.json` it did not change.
|
|
63
|
+
* `undefined` means "this entry exists, content unknown" - which is what the
|
|
64
|
+
* Studio's draft source has, because the source holds markers - and yields a
|
|
65
|
+
* `replace`, the safe answer.
|
|
66
|
+
*/
|
|
67
|
+
export type CurrentJsonEntries = ReadonlyMap<string, JSONValue | undefined>;
|
|
68
|
+
/**
|
|
69
|
+
* Fans a whole-record write at a `.jsonValues()` module's root out into ops
|
|
70
|
+
* that each name an entry key.
|
|
71
|
+
*
|
|
72
|
+
* This is THE conversion, and it has exactly one implementation on purpose: the
|
|
73
|
+
* commit flow (`ValOps.prepare`) and the engine that builds draft content
|
|
74
|
+
* (`applyPatchRecord`) both expand through here, so a draft
|
|
75
|
+
* cannot show something other than what publishing writes. A second
|
|
76
|
+
* implementation of the same rule would differ silently, which is the whole
|
|
77
|
+
* failure mode this exists to prevent.
|
|
78
|
+
*
|
|
79
|
+
* The value must be the entries' CONTENT. A module's Source is markers, not
|
|
80
|
+
* content, so a Source handed over here is refused rather than written: that is
|
|
81
|
+
* the shape of the original bug (a revert replaying the archived Source), and
|
|
82
|
+
* it is not recoverable afterwards - the markers replace the entries' content
|
|
83
|
+
* on disk.
|
|
84
|
+
*/
|
|
85
|
+
export declare function expandJsonValuesRootOp(op: Operation, currentEntries: CurrentJsonEntries): result.Result<Operation[], PatchError>;
|
|
86
|
+
/**
|
|
87
|
+
* What a whole-record write says about ONE entry: the same rule
|
|
88
|
+
* {@link expandJsonValuesRootOp} applies to all of them.
|
|
89
|
+
*
|
|
90
|
+
* For a reader that is about one entry. Expanding the whole record to find the
|
|
91
|
+
* one op that names its key costs an op per entry per entry read - the record
|
|
92
|
+
* squared, on exactly the large records this feature is for. The rule itself is
|
|
93
|
+
* `writeForEntry`, shared with the expansion above, so the two cannot come to
|
|
94
|
+
* disagree; only the loop around it differs.
|
|
95
|
+
*
|
|
96
|
+
* `null` means the write says nothing about this entry: it holds that content
|
|
97
|
+
* already, or the record does not name it and it does not exist.
|
|
98
|
+
*/
|
|
99
|
+
export declare function expandJsonValuesRootOpForKey(op: Operation, entryKey: string, currentEntries: CurrentJsonEntries): result.Result<Operation | null, PatchError>;
|
|
100
|
+
/**
|
|
101
|
+
* Rebases a patch op that targets a `.jsonValues()` entry's content so its paths
|
|
102
|
+
* are relative to the entry's `*.val.json` root (drops the record + entry-key
|
|
103
|
+
* prefix). Used to replay the op against the backing JSON file.
|
|
104
|
+
*/
|
|
105
|
+
export declare function rebaseContentOp(op: Operation, prefixLen: number): result.Result<Operation, PatchError>;
|
|
106
|
+
/**
|
|
107
|
+
* The entry a path names when it names a WHOLE entry of the root
|
|
108
|
+
* `.jsonValues()` record, and `undefined` for anything else.
|
|
109
|
+
*/
|
|
110
|
+
export declare function wholeEntryKey(serializedSchema: SerializedSchema | undefined, path: string[]): string | undefined;
|