@valbuild/shared 0.99.1 → 0.101.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/dist/declarations/src/internal/ApiRoutes.d.ts +72 -2
- package/dist/declarations/src/internal/zod/SerializedSchema.d.ts +11 -1
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +124 -4
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +124 -4
- package/internal/dist/valbuild-shared-internal.esm.js +122 -5
- package/package.json +2 -2
|
@@ -19,6 +19,12 @@ type CookieValue = EnableCookieValue | {
|
|
|
19
19
|
expires: Date;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Upper bound on how many `.jsonValues()` entries one `/json` request may ask
|
|
24
|
+
* for. Callers page through bigger sets; the Studio chunks its key windows to
|
|
25
|
+
* this. Shared so client and server agree on the limit.
|
|
26
|
+
*/
|
|
27
|
+
export declare const JSON_ENTRIES_BATCH_MAX = 100;
|
|
22
28
|
export declare const Api: {
|
|
23
29
|
"/draft/enable": {
|
|
24
30
|
GET: {
|
|
@@ -395,6 +401,7 @@ export declare const Api: {
|
|
|
395
401
|
schemaSha: z.ZodString;
|
|
396
402
|
baseSha: z.ZodString;
|
|
397
403
|
patches: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
404
|
+
jsonEntriesSha: z.ZodOptional<z.ZodString>;
|
|
398
405
|
}, z.core.$strip>>;
|
|
399
406
|
cookies: {
|
|
400
407
|
val_session: z.ZodOptional<z.ZodString>;
|
|
@@ -434,6 +441,7 @@ export declare const Api: {
|
|
|
434
441
|
}, z.core.$strip>;
|
|
435
442
|
profileId: z.ZodNullable<z.ZodString>;
|
|
436
443
|
mode: z.ZodUnion<readonly [z.ZodLiteral<"http">, z.ZodLiteral<"fs">]>;
|
|
444
|
+
jsonEntriesSha: z.ZodOptional<z.ZodString>;
|
|
437
445
|
}, z.core.$strip>, z.ZodObject<{
|
|
438
446
|
type: z.ZodLiteral<"use-websocket">;
|
|
439
447
|
url: z.ZodString;
|
|
@@ -819,7 +827,7 @@ export declare const Api: {
|
|
|
819
827
|
message: z.ZodString;
|
|
820
828
|
value: z.ZodOptional<z.ZodUnknown>;
|
|
821
829
|
fatal: z.ZodOptional<z.ZodBoolean>;
|
|
822
|
-
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" | "keyof:check-keys" | "router:check-route" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files", 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" | "keyof:check-keys" | "router:check-route" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files", unknown>>>>;
|
|
830
|
+
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" | "keyof:check-keys" | "router:check-route" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "jsonValues:extract-entry", 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" | "keyof:check-keys" | "router:check-route" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "jsonValues:extract-entry", unknown>>>>;
|
|
823
831
|
}, z.core.$strip>>>>;
|
|
824
832
|
}, z.core.$strip>>;
|
|
825
833
|
}, z.core.$strip>;
|
|
@@ -963,6 +971,68 @@ export declare const Api: {
|
|
|
963
971
|
}, z.core.$strip>]>;
|
|
964
972
|
};
|
|
965
973
|
};
|
|
974
|
+
"/json": {
|
|
975
|
+
GET: {
|
|
976
|
+
req: {
|
|
977
|
+
query: {
|
|
978
|
+
path: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>;
|
|
979
|
+
key: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>>;
|
|
980
|
+
keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
981
|
+
offset: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>, z.ZodTransform<number, string>>>;
|
|
982
|
+
limit: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>, z.ZodTransform<number, string>>>;
|
|
983
|
+
apply_patches: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>> & z.ZodType<"true" | "false", string[], z.core.$ZodTypeInternals<"true" | "false", string[]>>, z.ZodTransform<boolean, "true" | "false">>>;
|
|
984
|
+
};
|
|
985
|
+
cookies: {
|
|
986
|
+
val_session: z.ZodOptional<z.ZodString>;
|
|
987
|
+
};
|
|
988
|
+
};
|
|
989
|
+
res: z.ZodUnion<readonly [z.ZodObject<{
|
|
990
|
+
status: z.ZodLiteral<401>;
|
|
991
|
+
json: z.ZodObject<{
|
|
992
|
+
message: z.ZodString;
|
|
993
|
+
}, z.core.$strip>;
|
|
994
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
995
|
+
status: z.ZodLiteral<404>;
|
|
996
|
+
json: z.ZodObject<{
|
|
997
|
+
message: z.ZodString;
|
|
998
|
+
}, z.core.$strip>;
|
|
999
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1000
|
+
status: z.ZodLiteral<200>;
|
|
1001
|
+
json: z.ZodObject<{
|
|
1002
|
+
path: z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>;
|
|
1003
|
+
key: z.ZodString;
|
|
1004
|
+
content: z.ZodAny;
|
|
1005
|
+
}, z.core.$strip>;
|
|
1006
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1007
|
+
status: z.ZodLiteral<200>;
|
|
1008
|
+
json: z.ZodObject<{
|
|
1009
|
+
path: z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>;
|
|
1010
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
1011
|
+
key: z.ZodString;
|
|
1012
|
+
content: z.ZodAny;
|
|
1013
|
+
}, z.core.$strip>>;
|
|
1014
|
+
missing: z.ZodArray<z.ZodString>;
|
|
1015
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
1016
|
+
key: z.ZodString;
|
|
1017
|
+
message: z.ZodString;
|
|
1018
|
+
}, z.core.$strip>>;
|
|
1019
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
1020
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
1021
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
1022
|
+
}, z.core.$strip>;
|
|
1023
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1024
|
+
status: z.ZodLiteral<400>;
|
|
1025
|
+
json: z.ZodObject<{
|
|
1026
|
+
message: z.ZodString;
|
|
1027
|
+
}, z.core.$strip>;
|
|
1028
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1029
|
+
status: z.ZodLiteral<500>;
|
|
1030
|
+
json: z.ZodObject<{
|
|
1031
|
+
message: z.ZodString;
|
|
1032
|
+
}, z.core.$strip>;
|
|
1033
|
+
}, z.core.$strip>]>;
|
|
1034
|
+
};
|
|
1035
|
+
};
|
|
966
1036
|
"/ai/initialize": {
|
|
967
1037
|
POST: {
|
|
968
1038
|
req: {
|
|
@@ -1209,7 +1279,7 @@ type DefinedObject<T> = Pick<T, DefinedKeys<T>>;
|
|
|
1209
1279
|
*
|
|
1210
1280
|
* Do not change this without updating the ValRouter query parsing logic
|
|
1211
1281
|
* */
|
|
1212
|
-
export type ValidQueryParamTypes = boolean | string | string[] | undefined;
|
|
1282
|
+
export type ValidQueryParamTypes = boolean | number | string | string[] | undefined;
|
|
1213
1283
|
export type ApiEndpoint = {
|
|
1214
1284
|
req: {
|
|
1215
1285
|
path?: z.ZodString | z.ZodOptional<z.ZodString>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { type SerializedSchema as SerializedSchemaT, type SerializedStringSchema as SerializedStringSchemaT, type SerializedLiteralSchema as SerializedLiteralSchemaT, type SerializedBooleanSchema as SerializedBooleanSchemaT, type SerializedNumberSchema as SerializedNumberSchemaT, type SerializedObjectSchema as SerializedObjectSchemaT, type SerializedArraySchema as SerializedArraySchemaT, type SerializedUnionSchema as SerializedUnionSchemaT, type SerializedRichTextSchema as SerializedRichTextSchemaT, type SerializedRichTextOptions as SerializedRichTextOptionsT, type SerializedRecordSchema as SerializedRecordSchemaT, type SerializedKeyOfSchema as SerializedKeyOfSchemaT, type SerializedRouteSchema as SerializedRouteSchemaT, type SerializedFileSchema as SerializedFileSchemaT, type SerializedDateSchema as SerializedDateSchemaT, type SerializedDateTimeSchema as SerializedDateTimeSchemaT, type SerializedImageSchema as SerializedImageSchemaT } from "@valbuild/core";
|
|
2
|
+
import { type SerializedSchema as SerializedSchemaT, type SerializedStringSchema as SerializedStringSchemaT, type SerializedLiteralSchema as SerializedLiteralSchemaT, type SerializedBooleanSchema as SerializedBooleanSchemaT, type SerializedNumberSchema as SerializedNumberSchemaT, type SerializedObjectSchema as SerializedObjectSchemaT, type SerializedArraySchema as SerializedArraySchemaT, type SerializedUnionSchema as SerializedUnionSchemaT, type SerializedRichTextSchema as SerializedRichTextSchemaT, type SerializedRichTextOptions as SerializedRichTextOptionsT, type SerializedRecordSchema as SerializedRecordSchemaT, type SerializedKeyOfSchema as SerializedKeyOfSchemaT, type SerializedRouteSchema as SerializedRouteSchemaT, type SerializedFileSchema as SerializedFileSchemaT, type SerializedDateSchema as SerializedDateSchemaT, type SerializedDateTimeSchema as SerializedDateTimeSchemaT, type SerializedColorSchema as SerializedColorSchemaT, type SerializedImageSchema as SerializedImageSchemaT } from "@valbuild/core";
|
|
3
3
|
export declare const SerializedStringSchema: z.ZodType<SerializedStringSchemaT>;
|
|
4
4
|
export declare const SerializedLiteralSchema: z.ZodType<SerializedLiteralSchemaT>;
|
|
5
5
|
export declare const SerializedBooleanSchema: z.ZodType<SerializedBooleanSchemaT>;
|
|
@@ -28,5 +28,15 @@ export declare const DateOptions: z.ZodObject<{
|
|
|
28
28
|
}, z.core.$strip>;
|
|
29
29
|
export declare const SerializedDateSchema: z.ZodType<SerializedDateSchemaT>;
|
|
30
30
|
export declare const SerializedDateTimeSchema: z.ZodType<SerializedDateTimeSchemaT>;
|
|
31
|
+
export declare const ColorOptions: z.ZodObject<{
|
|
32
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
33
|
+
hex: "hex";
|
|
34
|
+
rgb: "rgb";
|
|
35
|
+
hsl: "hsl";
|
|
36
|
+
oklch: "oklch";
|
|
37
|
+
}>>;
|
|
38
|
+
alpha: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export declare const SerializedColorSchema: z.ZodType<SerializedColorSchemaT>;
|
|
31
41
|
export declare const SerializedRouteSchema: z.ZodType<SerializedRouteSchemaT>;
|
|
32
42
|
export declare const SerializedSchema: z.ZodType<SerializedSchemaT>;
|
|
@@ -1195,6 +1195,19 @@ var SerializedDateTimeSchema = zod.z.object({
|
|
|
1195
1195
|
hidden: zod.z["boolean"]().optional(),
|
|
1196
1196
|
description: zod.z.string().optional()
|
|
1197
1197
|
});
|
|
1198
|
+
var ColorOptions = zod.z.object({
|
|
1199
|
+
format: zod.z["enum"](["hex", "rgb", "hsl", "oklch"]).optional(),
|
|
1200
|
+
alpha: zod.z["boolean"]().optional()
|
|
1201
|
+
});
|
|
1202
|
+
var SerializedColorSchema = zod.z.object({
|
|
1203
|
+
type: zod.z.literal("color"),
|
|
1204
|
+
options: ColorOptions.optional(),
|
|
1205
|
+
opt: zod.z["boolean"](),
|
|
1206
|
+
customValidate: zod.z["boolean"]().optional(),
|
|
1207
|
+
readonly: zod.z["boolean"]().optional(),
|
|
1208
|
+
hidden: zod.z["boolean"]().optional(),
|
|
1209
|
+
description: zod.z.string().optional()
|
|
1210
|
+
});
|
|
1198
1211
|
var SerializedRouteSchema = zod.z.object({
|
|
1199
1212
|
type: zod.z.literal("route"),
|
|
1200
1213
|
options: zod.z.object({
|
|
@@ -1213,7 +1226,7 @@ var SerializedRouteSchema = zod.z.object({
|
|
|
1213
1226
|
readonly: zod.z["boolean"]().optional(),
|
|
1214
1227
|
hidden: zod.z["boolean"]().optional()
|
|
1215
1228
|
});
|
|
1216
|
-
var SerializedSchema = zod.z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedUnionSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedRouteSchema, SerializedFileSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedImageSchema]);
|
|
1229
|
+
var SerializedSchema = zod.z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedUnionSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedRouteSchema, SerializedFileSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedColorSchema, SerializedImageSchema]);
|
|
1217
1230
|
|
|
1218
1231
|
var ValCommit = zod.z.object({
|
|
1219
1232
|
commitSha: zod.z.string(),
|
|
@@ -1245,7 +1258,7 @@ var ValConfig = zod.z.object({
|
|
|
1245
1258
|
gitCommit: zod.z.string().optional(),
|
|
1246
1259
|
gitBranch: zod.z.string().optional()
|
|
1247
1260
|
});
|
|
1248
|
-
var ValidationFixZ = zod.z.union([zod.z.literal("image:add-metadata"), zod.z.literal("image:check-metadata"), zod.z.literal("image:check-remote"), zod.z.literal("image:upload-remote"), zod.z.literal("image:download-remote"), zod.z.literal("images:check-remote"), zod.z.literal("images:upload-remote"), zod.z.literal("file:add-metadata"), zod.z.literal("file:check-metadata"), zod.z.literal("file:check-remote"), zod.z.literal("file:upload-remote"), zod.z.literal("file:download-remote"), zod.z.literal("files:check-remote"), zod.z.literal("files:upload-remote"), zod.z.literal("keyof:check-keys"), zod.z.literal("router:check-route"), zod.z.literal("images:check-unique-folder"), zod.z.literal("files:check-unique-folder"), zod.z.literal("images:check-all-files"), zod.z.literal("files:check-all-files")]);
|
|
1261
|
+
var ValidationFixZ = zod.z.union([zod.z.literal("image:add-metadata"), zod.z.literal("image:check-metadata"), zod.z.literal("image:check-remote"), zod.z.literal("image:upload-remote"), zod.z.literal("image:download-remote"), zod.z.literal("images:check-remote"), zod.z.literal("images:upload-remote"), zod.z.literal("file:add-metadata"), zod.z.literal("file:check-metadata"), zod.z.literal("file:check-remote"), zod.z.literal("file:upload-remote"), zod.z.literal("file:download-remote"), zod.z.literal("files:check-remote"), zod.z.literal("files:upload-remote"), zod.z.literal("keyof:check-keys"), zod.z.literal("router:check-route"), zod.z.literal("images:check-unique-folder"), zod.z.literal("files:check-unique-folder"), zod.z.literal("images:check-all-files"), zod.z.literal("files:check-all-files"), zod.z.literal("jsonValues:extract-entry")]);
|
|
1249
1262
|
var ValidationError = zod.z.object({
|
|
1250
1263
|
message: zod.z.string(),
|
|
1251
1264
|
value: zod.z.unknown().optional(),
|
|
@@ -1294,6 +1307,18 @@ var onlyOneBooleanQueryParam = onlyOneStringQueryParam.refine(function (arg) {
|
|
|
1294
1307
|
}, "Value must be true or false").transform(function (arg) {
|
|
1295
1308
|
return arg === "true";
|
|
1296
1309
|
});
|
|
1310
|
+
var onlyOneIntQueryParam = onlyOneStringQueryParam.refine(function (arg) {
|
|
1311
|
+
return /^\d+$/.test(arg);
|
|
1312
|
+
}, "Value must be a non-negative whole number").transform(function (arg) {
|
|
1313
|
+
return parseInt(arg, 10);
|
|
1314
|
+
});
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* Upper bound on how many `.jsonValues()` entries one `/json` request may ask
|
|
1318
|
+
* for. Callers page through bigger sets; the Studio chunks its key windows to
|
|
1319
|
+
* this. Shared so client and server agree on the limit.
|
|
1320
|
+
*/
|
|
1321
|
+
var JSON_ENTRIES_BATCH_MAX = 100;
|
|
1297
1322
|
var Api = {
|
|
1298
1323
|
"/draft/enable": {
|
|
1299
1324
|
GET: {
|
|
@@ -1606,7 +1631,14 @@ var Api = {
|
|
|
1606
1631
|
sourcesSha: zod.z.string(),
|
|
1607
1632
|
schemaSha: zod.z.string(),
|
|
1608
1633
|
baseSha: zod.z.string(),
|
|
1609
|
-
patches: zod.z.array(zod.z.string()).optional()
|
|
1634
|
+
patches: zod.z.array(zod.z.string()).optional(),
|
|
1635
|
+
/**
|
|
1636
|
+
* Fingerprint of the `.jsonValues()` entry files the client last saw.
|
|
1637
|
+
* FS mode only: no other sha can see an entry file change, since a
|
|
1638
|
+
* jsonValues module's source is markers and the content sits behind a
|
|
1639
|
+
* thunk that `JSON.stringify` drops.
|
|
1640
|
+
*/
|
|
1641
|
+
jsonEntriesSha: zod.z.string().optional()
|
|
1610
1642
|
}).nullable(),
|
|
1611
1643
|
cookies: {
|
|
1612
1644
|
val_session: zod.z.string().optional()
|
|
@@ -1631,7 +1663,8 @@ var Api = {
|
|
|
1631
1663
|
patches: zod.z.array(PatchId),
|
|
1632
1664
|
config: ValConfig,
|
|
1633
1665
|
profileId: zod.z.string().nullable(),
|
|
1634
|
-
mode: zod.z.union([zod.z.literal("http"), zod.z.literal("fs")])
|
|
1666
|
+
mode: zod.z.union([zod.z.literal("http"), zod.z.literal("fs")]),
|
|
1667
|
+
jsonEntriesSha: zod.z.string().optional()
|
|
1635
1668
|
}), zod.z.object({
|
|
1636
1669
|
type: zod.z.literal("use-websocket"),
|
|
1637
1670
|
url: zod.z.string(),
|
|
@@ -1993,6 +2026,88 @@ var Api = {
|
|
|
1993
2026
|
})])
|
|
1994
2027
|
}
|
|
1995
2028
|
},
|
|
2029
|
+
// Loads the content of `.jsonValues()` record/router entries, so the Studio can
|
|
2030
|
+
// lazily load just the entries it needs (instead of the whole record), and so
|
|
2031
|
+
// the runtime can read draft edits in draft mode.
|
|
2032
|
+
//
|
|
2033
|
+
// Three request shapes, exactly one of which must be used:
|
|
2034
|
+
// 1. `key=<k>` — ONE entry; responds `{path, key, content}`.
|
|
2035
|
+
// 2. `keys=<k>&keys=<k2>&…` — a BATCH; responds `{path, entries, missing, errors}`.
|
|
2036
|
+
// 3. `offset=<n>&limit=<n>` — a PAGE of every entry, in module key order;
|
|
2037
|
+
// responds as (2) plus `{offset, limit, total}`.
|
|
2038
|
+
// (2) and (3) are what make loading many entries one round trip instead of N:
|
|
2039
|
+
// the server resolves sources and pending patches ONCE per request, not per entry.
|
|
2040
|
+
//
|
|
2041
|
+
// Batch failures are per entry, never whole-request: a key with no entry lands in
|
|
2042
|
+
// `missing`, a key whose `*.val.json` fails to load lands in `errors`. Only a
|
|
2043
|
+
// missing/non-record MODULE is a 404.
|
|
2044
|
+
//
|
|
2045
|
+
// `apply_patches` defaults to TRUE (as on `/sources/~`): the server replays
|
|
2046
|
+
// pending patches for the entry. The Studio passes `false` explicitly, because
|
|
2047
|
+
// it owns in-flight client patches the server has not seen yet and applies
|
|
2048
|
+
// them itself — letting the server apply them too would double-apply.
|
|
2049
|
+
//
|
|
2050
|
+
// Shape (3) REQUIRES `apply_patches=false`. Enumerating "every entry" from the
|
|
2051
|
+
// base source would silently omit draft-added keys, and the only all-mode caller
|
|
2052
|
+
// (the Studio) derives its key set from its own patched source anyway. Callers
|
|
2053
|
+
// that need draft-aware enumeration pass explicit `keys`.
|
|
2054
|
+
"/json": {
|
|
2055
|
+
GET: {
|
|
2056
|
+
req: {
|
|
2057
|
+
query: {
|
|
2058
|
+
path: onlyOneStringQueryParam,
|
|
2059
|
+
key: onlyOneStringQueryParam.optional(),
|
|
2060
|
+
keys: zod.z.array(zod.z.string()).max(JSON_ENTRIES_BATCH_MAX).optional(),
|
|
2061
|
+
offset: onlyOneIntQueryParam.optional(),
|
|
2062
|
+
limit: onlyOneIntQueryParam.refine(function (arg) {
|
|
2063
|
+
return arg > 0 && arg <= JSON_ENTRIES_BATCH_MAX;
|
|
2064
|
+
}, "limit must be between 1 and ".concat(JSON_ENTRIES_BATCH_MAX)).optional(),
|
|
2065
|
+
apply_patches: onlyOneBooleanQueryParam.optional()
|
|
2066
|
+
},
|
|
2067
|
+
cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
|
|
2068
|
+
},
|
|
2069
|
+
res: zod.z.union([unauthorizedResponse, notFoundResponse,
|
|
2070
|
+
// Shape (1): single `key`.
|
|
2071
|
+
zod.z.object({
|
|
2072
|
+
status: zod.z.literal(200),
|
|
2073
|
+
json: zod.z.object({
|
|
2074
|
+
path: ModuleFilePath,
|
|
2075
|
+
key: zod.z.string(),
|
|
2076
|
+
// The entry's JSON content (or null if the entry has no value).
|
|
2077
|
+
content: zod.z.any()
|
|
2078
|
+
})
|
|
2079
|
+
}),
|
|
2080
|
+
// Shapes (2) and (3): `keys` or `offset`+`limit`.
|
|
2081
|
+
zod.z.object({
|
|
2082
|
+
status: zod.z.literal(200),
|
|
2083
|
+
json: zod.z.object({
|
|
2084
|
+
path: ModuleFilePath,
|
|
2085
|
+
entries: zod.z.array(zod.z.object({
|
|
2086
|
+
key: zod.z.string(),
|
|
2087
|
+
// The entry's JSON content (or null if the entry has no value).
|
|
2088
|
+
content: zod.z.any()
|
|
2089
|
+
})),
|
|
2090
|
+
// Requested keys that have no entry (neither committed nor drafted).
|
|
2091
|
+
missing: zod.z.array(zod.z.string()),
|
|
2092
|
+
// Requested keys whose content could not be loaded.
|
|
2093
|
+
errors: zod.z.array(zod.z.object({
|
|
2094
|
+
key: zod.z.string(),
|
|
2095
|
+
message: zod.z.string()
|
|
2096
|
+
})),
|
|
2097
|
+
// All-mode only: the resolved window and the record's total key count.
|
|
2098
|
+
offset: zod.z.number().optional(),
|
|
2099
|
+
limit: zod.z.number().optional(),
|
|
2100
|
+
total: zod.z.number().optional()
|
|
2101
|
+
})
|
|
2102
|
+
}), zod.z.object({
|
|
2103
|
+
status: zod.z.literal(400),
|
|
2104
|
+
json: GenericError
|
|
2105
|
+
}), zod.z.object({
|
|
2106
|
+
status: zod.z.literal(500),
|
|
2107
|
+
json: GenericError
|
|
2108
|
+
})])
|
|
2109
|
+
}
|
|
2110
|
+
},
|
|
1996
2111
|
"/ai/initialize": {
|
|
1997
2112
|
POST: {
|
|
1998
2113
|
req: {
|
|
@@ -2180,6 +2295,8 @@ var Api = {
|
|
|
2180
2295
|
*
|
|
2181
2296
|
* Do not change this without updating the ValRouter query parsing logic
|
|
2182
2297
|
* */
|
|
2298
|
+
// `number` is allowed because the client stringifies every query value before it
|
|
2299
|
+
// goes on the URL (see createValClient), so a numeric param round-trips fine.
|
|
2183
2300
|
|
|
2184
2301
|
function _typeof(o) {
|
|
2185
2302
|
"@babel/helpers - typeof";
|
|
@@ -3169,10 +3286,12 @@ function resolveSchemaSourceFixes(validationErrors, snapshot) {
|
|
|
3169
3286
|
}
|
|
3170
3287
|
|
|
3171
3288
|
exports.Api = Api;
|
|
3289
|
+
exports.ColorOptions = ColorOptions;
|
|
3172
3290
|
exports.DEFAULT_ERROR_MESSAGE = DEFAULT_ERROR_MESSAGE;
|
|
3173
3291
|
exports.DateOptions = DateOptions;
|
|
3174
3292
|
exports.FileOptions = FileOptions;
|
|
3175
3293
|
exports.ImageOptions = ImageOptions;
|
|
3294
|
+
exports.JSON_ENTRIES_BATCH_MAX = JSON_ENTRIES_BATCH_MAX;
|
|
3176
3295
|
exports.ParentRef = ParentRef$1;
|
|
3177
3296
|
exports.Patch = Patch;
|
|
3178
3297
|
exports.PatchBlock = PatchBlock;
|
|
@@ -3192,6 +3311,7 @@ exports.RemirrorTextMark = RemirrorTextMark;
|
|
|
3192
3311
|
exports.RichTextOptions = RichTextOptions;
|
|
3193
3312
|
exports.SerializedArraySchema = SerializedArraySchema;
|
|
3194
3313
|
exports.SerializedBooleanSchema = SerializedBooleanSchema;
|
|
3314
|
+
exports.SerializedColorSchema = SerializedColorSchema;
|
|
3195
3315
|
exports.SerializedDateSchema = SerializedDateSchema;
|
|
3196
3316
|
exports.SerializedDateTimeSchema = SerializedDateTimeSchema;
|
|
3197
3317
|
exports.SerializedFileSchema = SerializedFileSchema;
|
|
@@ -1195,6 +1195,19 @@ var SerializedDateTimeSchema = zod.z.object({
|
|
|
1195
1195
|
hidden: zod.z["boolean"]().optional(),
|
|
1196
1196
|
description: zod.z.string().optional()
|
|
1197
1197
|
});
|
|
1198
|
+
var ColorOptions = zod.z.object({
|
|
1199
|
+
format: zod.z["enum"](["hex", "rgb", "hsl", "oklch"]).optional(),
|
|
1200
|
+
alpha: zod.z["boolean"]().optional()
|
|
1201
|
+
});
|
|
1202
|
+
var SerializedColorSchema = zod.z.object({
|
|
1203
|
+
type: zod.z.literal("color"),
|
|
1204
|
+
options: ColorOptions.optional(),
|
|
1205
|
+
opt: zod.z["boolean"](),
|
|
1206
|
+
customValidate: zod.z["boolean"]().optional(),
|
|
1207
|
+
readonly: zod.z["boolean"]().optional(),
|
|
1208
|
+
hidden: zod.z["boolean"]().optional(),
|
|
1209
|
+
description: zod.z.string().optional()
|
|
1210
|
+
});
|
|
1198
1211
|
var SerializedRouteSchema = zod.z.object({
|
|
1199
1212
|
type: zod.z.literal("route"),
|
|
1200
1213
|
options: zod.z.object({
|
|
@@ -1213,7 +1226,7 @@ var SerializedRouteSchema = zod.z.object({
|
|
|
1213
1226
|
readonly: zod.z["boolean"]().optional(),
|
|
1214
1227
|
hidden: zod.z["boolean"]().optional()
|
|
1215
1228
|
});
|
|
1216
|
-
var SerializedSchema = zod.z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedUnionSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedRouteSchema, SerializedFileSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedImageSchema]);
|
|
1229
|
+
var SerializedSchema = zod.z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedUnionSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedRouteSchema, SerializedFileSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedColorSchema, SerializedImageSchema]);
|
|
1217
1230
|
|
|
1218
1231
|
var ValCommit = zod.z.object({
|
|
1219
1232
|
commitSha: zod.z.string(),
|
|
@@ -1245,7 +1258,7 @@ var ValConfig = zod.z.object({
|
|
|
1245
1258
|
gitCommit: zod.z.string().optional(),
|
|
1246
1259
|
gitBranch: zod.z.string().optional()
|
|
1247
1260
|
});
|
|
1248
|
-
var ValidationFixZ = zod.z.union([zod.z.literal("image:add-metadata"), zod.z.literal("image:check-metadata"), zod.z.literal("image:check-remote"), zod.z.literal("image:upload-remote"), zod.z.literal("image:download-remote"), zod.z.literal("images:check-remote"), zod.z.literal("images:upload-remote"), zod.z.literal("file:add-metadata"), zod.z.literal("file:check-metadata"), zod.z.literal("file:check-remote"), zod.z.literal("file:upload-remote"), zod.z.literal("file:download-remote"), zod.z.literal("files:check-remote"), zod.z.literal("files:upload-remote"), zod.z.literal("keyof:check-keys"), zod.z.literal("router:check-route"), zod.z.literal("images:check-unique-folder"), zod.z.literal("files:check-unique-folder"), zod.z.literal("images:check-all-files"), zod.z.literal("files:check-all-files")]);
|
|
1261
|
+
var ValidationFixZ = zod.z.union([zod.z.literal("image:add-metadata"), zod.z.literal("image:check-metadata"), zod.z.literal("image:check-remote"), zod.z.literal("image:upload-remote"), zod.z.literal("image:download-remote"), zod.z.literal("images:check-remote"), zod.z.literal("images:upload-remote"), zod.z.literal("file:add-metadata"), zod.z.literal("file:check-metadata"), zod.z.literal("file:check-remote"), zod.z.literal("file:upload-remote"), zod.z.literal("file:download-remote"), zod.z.literal("files:check-remote"), zod.z.literal("files:upload-remote"), zod.z.literal("keyof:check-keys"), zod.z.literal("router:check-route"), zod.z.literal("images:check-unique-folder"), zod.z.literal("files:check-unique-folder"), zod.z.literal("images:check-all-files"), zod.z.literal("files:check-all-files"), zod.z.literal("jsonValues:extract-entry")]);
|
|
1249
1262
|
var ValidationError = zod.z.object({
|
|
1250
1263
|
message: zod.z.string(),
|
|
1251
1264
|
value: zod.z.unknown().optional(),
|
|
@@ -1294,6 +1307,18 @@ var onlyOneBooleanQueryParam = onlyOneStringQueryParam.refine(function (arg) {
|
|
|
1294
1307
|
}, "Value must be true or false").transform(function (arg) {
|
|
1295
1308
|
return arg === "true";
|
|
1296
1309
|
});
|
|
1310
|
+
var onlyOneIntQueryParam = onlyOneStringQueryParam.refine(function (arg) {
|
|
1311
|
+
return /^\d+$/.test(arg);
|
|
1312
|
+
}, "Value must be a non-negative whole number").transform(function (arg) {
|
|
1313
|
+
return parseInt(arg, 10);
|
|
1314
|
+
});
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* Upper bound on how many `.jsonValues()` entries one `/json` request may ask
|
|
1318
|
+
* for. Callers page through bigger sets; the Studio chunks its key windows to
|
|
1319
|
+
* this. Shared so client and server agree on the limit.
|
|
1320
|
+
*/
|
|
1321
|
+
var JSON_ENTRIES_BATCH_MAX = 100;
|
|
1297
1322
|
var Api = {
|
|
1298
1323
|
"/draft/enable": {
|
|
1299
1324
|
GET: {
|
|
@@ -1606,7 +1631,14 @@ var Api = {
|
|
|
1606
1631
|
sourcesSha: zod.z.string(),
|
|
1607
1632
|
schemaSha: zod.z.string(),
|
|
1608
1633
|
baseSha: zod.z.string(),
|
|
1609
|
-
patches: zod.z.array(zod.z.string()).optional()
|
|
1634
|
+
patches: zod.z.array(zod.z.string()).optional(),
|
|
1635
|
+
/**
|
|
1636
|
+
* Fingerprint of the `.jsonValues()` entry files the client last saw.
|
|
1637
|
+
* FS mode only: no other sha can see an entry file change, since a
|
|
1638
|
+
* jsonValues module's source is markers and the content sits behind a
|
|
1639
|
+
* thunk that `JSON.stringify` drops.
|
|
1640
|
+
*/
|
|
1641
|
+
jsonEntriesSha: zod.z.string().optional()
|
|
1610
1642
|
}).nullable(),
|
|
1611
1643
|
cookies: {
|
|
1612
1644
|
val_session: zod.z.string().optional()
|
|
@@ -1631,7 +1663,8 @@ var Api = {
|
|
|
1631
1663
|
patches: zod.z.array(PatchId),
|
|
1632
1664
|
config: ValConfig,
|
|
1633
1665
|
profileId: zod.z.string().nullable(),
|
|
1634
|
-
mode: zod.z.union([zod.z.literal("http"), zod.z.literal("fs")])
|
|
1666
|
+
mode: zod.z.union([zod.z.literal("http"), zod.z.literal("fs")]),
|
|
1667
|
+
jsonEntriesSha: zod.z.string().optional()
|
|
1635
1668
|
}), zod.z.object({
|
|
1636
1669
|
type: zod.z.literal("use-websocket"),
|
|
1637
1670
|
url: zod.z.string(),
|
|
@@ -1993,6 +2026,88 @@ var Api = {
|
|
|
1993
2026
|
})])
|
|
1994
2027
|
}
|
|
1995
2028
|
},
|
|
2029
|
+
// Loads the content of `.jsonValues()` record/router entries, so the Studio can
|
|
2030
|
+
// lazily load just the entries it needs (instead of the whole record), and so
|
|
2031
|
+
// the runtime can read draft edits in draft mode.
|
|
2032
|
+
//
|
|
2033
|
+
// Three request shapes, exactly one of which must be used:
|
|
2034
|
+
// 1. `key=<k>` — ONE entry; responds `{path, key, content}`.
|
|
2035
|
+
// 2. `keys=<k>&keys=<k2>&…` — a BATCH; responds `{path, entries, missing, errors}`.
|
|
2036
|
+
// 3. `offset=<n>&limit=<n>` — a PAGE of every entry, in module key order;
|
|
2037
|
+
// responds as (2) plus `{offset, limit, total}`.
|
|
2038
|
+
// (2) and (3) are what make loading many entries one round trip instead of N:
|
|
2039
|
+
// the server resolves sources and pending patches ONCE per request, not per entry.
|
|
2040
|
+
//
|
|
2041
|
+
// Batch failures are per entry, never whole-request: a key with no entry lands in
|
|
2042
|
+
// `missing`, a key whose `*.val.json` fails to load lands in `errors`. Only a
|
|
2043
|
+
// missing/non-record MODULE is a 404.
|
|
2044
|
+
//
|
|
2045
|
+
// `apply_patches` defaults to TRUE (as on `/sources/~`): the server replays
|
|
2046
|
+
// pending patches for the entry. The Studio passes `false` explicitly, because
|
|
2047
|
+
// it owns in-flight client patches the server has not seen yet and applies
|
|
2048
|
+
// them itself — letting the server apply them too would double-apply.
|
|
2049
|
+
//
|
|
2050
|
+
// Shape (3) REQUIRES `apply_patches=false`. Enumerating "every entry" from the
|
|
2051
|
+
// base source would silently omit draft-added keys, and the only all-mode caller
|
|
2052
|
+
// (the Studio) derives its key set from its own patched source anyway. Callers
|
|
2053
|
+
// that need draft-aware enumeration pass explicit `keys`.
|
|
2054
|
+
"/json": {
|
|
2055
|
+
GET: {
|
|
2056
|
+
req: {
|
|
2057
|
+
query: {
|
|
2058
|
+
path: onlyOneStringQueryParam,
|
|
2059
|
+
key: onlyOneStringQueryParam.optional(),
|
|
2060
|
+
keys: zod.z.array(zod.z.string()).max(JSON_ENTRIES_BATCH_MAX).optional(),
|
|
2061
|
+
offset: onlyOneIntQueryParam.optional(),
|
|
2062
|
+
limit: onlyOneIntQueryParam.refine(function (arg) {
|
|
2063
|
+
return arg > 0 && arg <= JSON_ENTRIES_BATCH_MAX;
|
|
2064
|
+
}, "limit must be between 1 and ".concat(JSON_ENTRIES_BATCH_MAX)).optional(),
|
|
2065
|
+
apply_patches: onlyOneBooleanQueryParam.optional()
|
|
2066
|
+
},
|
|
2067
|
+
cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
|
|
2068
|
+
},
|
|
2069
|
+
res: zod.z.union([unauthorizedResponse, notFoundResponse,
|
|
2070
|
+
// Shape (1): single `key`.
|
|
2071
|
+
zod.z.object({
|
|
2072
|
+
status: zod.z.literal(200),
|
|
2073
|
+
json: zod.z.object({
|
|
2074
|
+
path: ModuleFilePath,
|
|
2075
|
+
key: zod.z.string(),
|
|
2076
|
+
// The entry's JSON content (or null if the entry has no value).
|
|
2077
|
+
content: zod.z.any()
|
|
2078
|
+
})
|
|
2079
|
+
}),
|
|
2080
|
+
// Shapes (2) and (3): `keys` or `offset`+`limit`.
|
|
2081
|
+
zod.z.object({
|
|
2082
|
+
status: zod.z.literal(200),
|
|
2083
|
+
json: zod.z.object({
|
|
2084
|
+
path: ModuleFilePath,
|
|
2085
|
+
entries: zod.z.array(zod.z.object({
|
|
2086
|
+
key: zod.z.string(),
|
|
2087
|
+
// The entry's JSON content (or null if the entry has no value).
|
|
2088
|
+
content: zod.z.any()
|
|
2089
|
+
})),
|
|
2090
|
+
// Requested keys that have no entry (neither committed nor drafted).
|
|
2091
|
+
missing: zod.z.array(zod.z.string()),
|
|
2092
|
+
// Requested keys whose content could not be loaded.
|
|
2093
|
+
errors: zod.z.array(zod.z.object({
|
|
2094
|
+
key: zod.z.string(),
|
|
2095
|
+
message: zod.z.string()
|
|
2096
|
+
})),
|
|
2097
|
+
// All-mode only: the resolved window and the record's total key count.
|
|
2098
|
+
offset: zod.z.number().optional(),
|
|
2099
|
+
limit: zod.z.number().optional(),
|
|
2100
|
+
total: zod.z.number().optional()
|
|
2101
|
+
})
|
|
2102
|
+
}), zod.z.object({
|
|
2103
|
+
status: zod.z.literal(400),
|
|
2104
|
+
json: GenericError
|
|
2105
|
+
}), zod.z.object({
|
|
2106
|
+
status: zod.z.literal(500),
|
|
2107
|
+
json: GenericError
|
|
2108
|
+
})])
|
|
2109
|
+
}
|
|
2110
|
+
},
|
|
1996
2111
|
"/ai/initialize": {
|
|
1997
2112
|
POST: {
|
|
1998
2113
|
req: {
|
|
@@ -2180,6 +2295,8 @@ var Api = {
|
|
|
2180
2295
|
*
|
|
2181
2296
|
* Do not change this without updating the ValRouter query parsing logic
|
|
2182
2297
|
* */
|
|
2298
|
+
// `number` is allowed because the client stringifies every query value before it
|
|
2299
|
+
// goes on the URL (see createValClient), so a numeric param round-trips fine.
|
|
2183
2300
|
|
|
2184
2301
|
function _typeof(o) {
|
|
2185
2302
|
"@babel/helpers - typeof";
|
|
@@ -3169,10 +3286,12 @@ function resolveSchemaSourceFixes(validationErrors, snapshot) {
|
|
|
3169
3286
|
}
|
|
3170
3287
|
|
|
3171
3288
|
exports.Api = Api;
|
|
3289
|
+
exports.ColorOptions = ColorOptions;
|
|
3172
3290
|
exports.DEFAULT_ERROR_MESSAGE = DEFAULT_ERROR_MESSAGE;
|
|
3173
3291
|
exports.DateOptions = DateOptions;
|
|
3174
3292
|
exports.FileOptions = FileOptions;
|
|
3175
3293
|
exports.ImageOptions = ImageOptions;
|
|
3294
|
+
exports.JSON_ENTRIES_BATCH_MAX = JSON_ENTRIES_BATCH_MAX;
|
|
3176
3295
|
exports.ParentRef = ParentRef$1;
|
|
3177
3296
|
exports.Patch = Patch;
|
|
3178
3297
|
exports.PatchBlock = PatchBlock;
|
|
@@ -3192,6 +3311,7 @@ exports.RemirrorTextMark = RemirrorTextMark;
|
|
|
3192
3311
|
exports.RichTextOptions = RichTextOptions;
|
|
3193
3312
|
exports.SerializedArraySchema = SerializedArraySchema;
|
|
3194
3313
|
exports.SerializedBooleanSchema = SerializedBooleanSchema;
|
|
3314
|
+
exports.SerializedColorSchema = SerializedColorSchema;
|
|
3195
3315
|
exports.SerializedDateSchema = SerializedDateSchema;
|
|
3196
3316
|
exports.SerializedDateTimeSchema = SerializedDateTimeSchema;
|
|
3197
3317
|
exports.SerializedFileSchema = SerializedFileSchema;
|
|
@@ -1191,6 +1191,19 @@ var SerializedDateTimeSchema = z.object({
|
|
|
1191
1191
|
hidden: z["boolean"]().optional(),
|
|
1192
1192
|
description: z.string().optional()
|
|
1193
1193
|
});
|
|
1194
|
+
var ColorOptions = z.object({
|
|
1195
|
+
format: z["enum"](["hex", "rgb", "hsl", "oklch"]).optional(),
|
|
1196
|
+
alpha: z["boolean"]().optional()
|
|
1197
|
+
});
|
|
1198
|
+
var SerializedColorSchema = z.object({
|
|
1199
|
+
type: z.literal("color"),
|
|
1200
|
+
options: ColorOptions.optional(),
|
|
1201
|
+
opt: z["boolean"](),
|
|
1202
|
+
customValidate: z["boolean"]().optional(),
|
|
1203
|
+
readonly: z["boolean"]().optional(),
|
|
1204
|
+
hidden: z["boolean"]().optional(),
|
|
1205
|
+
description: z.string().optional()
|
|
1206
|
+
});
|
|
1194
1207
|
var SerializedRouteSchema = z.object({
|
|
1195
1208
|
type: z.literal("route"),
|
|
1196
1209
|
options: z.object({
|
|
@@ -1209,7 +1222,7 @@ var SerializedRouteSchema = z.object({
|
|
|
1209
1222
|
readonly: z["boolean"]().optional(),
|
|
1210
1223
|
hidden: z["boolean"]().optional()
|
|
1211
1224
|
});
|
|
1212
|
-
var SerializedSchema = z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedUnionSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedRouteSchema, SerializedFileSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedImageSchema]);
|
|
1225
|
+
var SerializedSchema = z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedUnionSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedRouteSchema, SerializedFileSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedColorSchema, SerializedImageSchema]);
|
|
1213
1226
|
|
|
1214
1227
|
var ValCommit = z.object({
|
|
1215
1228
|
commitSha: z.string(),
|
|
@@ -1241,7 +1254,7 @@ var ValConfig = z.object({
|
|
|
1241
1254
|
gitCommit: z.string().optional(),
|
|
1242
1255
|
gitBranch: z.string().optional()
|
|
1243
1256
|
});
|
|
1244
|
-
var ValidationFixZ = z.union([z.literal("image:add-metadata"), z.literal("image:check-metadata"), z.literal("image:check-remote"), z.literal("image:upload-remote"), z.literal("image:download-remote"), z.literal("images:check-remote"), z.literal("images:upload-remote"), z.literal("file:add-metadata"), z.literal("file:check-metadata"), z.literal("file:check-remote"), z.literal("file:upload-remote"), z.literal("file:download-remote"), z.literal("files:check-remote"), z.literal("files:upload-remote"), z.literal("keyof:check-keys"), z.literal("router:check-route"), z.literal("images:check-unique-folder"), z.literal("files:check-unique-folder"), z.literal("images:check-all-files"), z.literal("files:check-all-files")]);
|
|
1257
|
+
var ValidationFixZ = z.union([z.literal("image:add-metadata"), z.literal("image:check-metadata"), z.literal("image:check-remote"), z.literal("image:upload-remote"), z.literal("image:download-remote"), z.literal("images:check-remote"), z.literal("images:upload-remote"), z.literal("file:add-metadata"), z.literal("file:check-metadata"), z.literal("file:check-remote"), z.literal("file:upload-remote"), z.literal("file:download-remote"), z.literal("files:check-remote"), z.literal("files:upload-remote"), z.literal("keyof:check-keys"), z.literal("router:check-route"), z.literal("images:check-unique-folder"), z.literal("files:check-unique-folder"), z.literal("images:check-all-files"), z.literal("files:check-all-files"), z.literal("jsonValues:extract-entry")]);
|
|
1245
1258
|
var ValidationError = z.object({
|
|
1246
1259
|
message: z.string(),
|
|
1247
1260
|
value: z.unknown().optional(),
|
|
@@ -1290,6 +1303,18 @@ var onlyOneBooleanQueryParam = onlyOneStringQueryParam.refine(function (arg) {
|
|
|
1290
1303
|
}, "Value must be true or false").transform(function (arg) {
|
|
1291
1304
|
return arg === "true";
|
|
1292
1305
|
});
|
|
1306
|
+
var onlyOneIntQueryParam = onlyOneStringQueryParam.refine(function (arg) {
|
|
1307
|
+
return /^\d+$/.test(arg);
|
|
1308
|
+
}, "Value must be a non-negative whole number").transform(function (arg) {
|
|
1309
|
+
return parseInt(arg, 10);
|
|
1310
|
+
});
|
|
1311
|
+
|
|
1312
|
+
/**
|
|
1313
|
+
* Upper bound on how many `.jsonValues()` entries one `/json` request may ask
|
|
1314
|
+
* for. Callers page through bigger sets; the Studio chunks its key windows to
|
|
1315
|
+
* this. Shared so client and server agree on the limit.
|
|
1316
|
+
*/
|
|
1317
|
+
var JSON_ENTRIES_BATCH_MAX = 100;
|
|
1293
1318
|
var Api = {
|
|
1294
1319
|
"/draft/enable": {
|
|
1295
1320
|
GET: {
|
|
@@ -1602,7 +1627,14 @@ var Api = {
|
|
|
1602
1627
|
sourcesSha: z.string(),
|
|
1603
1628
|
schemaSha: z.string(),
|
|
1604
1629
|
baseSha: z.string(),
|
|
1605
|
-
patches: z.array(z.string()).optional()
|
|
1630
|
+
patches: z.array(z.string()).optional(),
|
|
1631
|
+
/**
|
|
1632
|
+
* Fingerprint of the `.jsonValues()` entry files the client last saw.
|
|
1633
|
+
* FS mode only: no other sha can see an entry file change, since a
|
|
1634
|
+
* jsonValues module's source is markers and the content sits behind a
|
|
1635
|
+
* thunk that `JSON.stringify` drops.
|
|
1636
|
+
*/
|
|
1637
|
+
jsonEntriesSha: z.string().optional()
|
|
1606
1638
|
}).nullable(),
|
|
1607
1639
|
cookies: {
|
|
1608
1640
|
val_session: z.string().optional()
|
|
@@ -1627,7 +1659,8 @@ var Api = {
|
|
|
1627
1659
|
patches: z.array(PatchId),
|
|
1628
1660
|
config: ValConfig,
|
|
1629
1661
|
profileId: z.string().nullable(),
|
|
1630
|
-
mode: z.union([z.literal("http"), z.literal("fs")])
|
|
1662
|
+
mode: z.union([z.literal("http"), z.literal("fs")]),
|
|
1663
|
+
jsonEntriesSha: z.string().optional()
|
|
1631
1664
|
}), z.object({
|
|
1632
1665
|
type: z.literal("use-websocket"),
|
|
1633
1666
|
url: z.string(),
|
|
@@ -1989,6 +2022,88 @@ var Api = {
|
|
|
1989
2022
|
})])
|
|
1990
2023
|
}
|
|
1991
2024
|
},
|
|
2025
|
+
// Loads the content of `.jsonValues()` record/router entries, so the Studio can
|
|
2026
|
+
// lazily load just the entries it needs (instead of the whole record), and so
|
|
2027
|
+
// the runtime can read draft edits in draft mode.
|
|
2028
|
+
//
|
|
2029
|
+
// Three request shapes, exactly one of which must be used:
|
|
2030
|
+
// 1. `key=<k>` — ONE entry; responds `{path, key, content}`.
|
|
2031
|
+
// 2. `keys=<k>&keys=<k2>&…` — a BATCH; responds `{path, entries, missing, errors}`.
|
|
2032
|
+
// 3. `offset=<n>&limit=<n>` — a PAGE of every entry, in module key order;
|
|
2033
|
+
// responds as (2) plus `{offset, limit, total}`.
|
|
2034
|
+
// (2) and (3) are what make loading many entries one round trip instead of N:
|
|
2035
|
+
// the server resolves sources and pending patches ONCE per request, not per entry.
|
|
2036
|
+
//
|
|
2037
|
+
// Batch failures are per entry, never whole-request: a key with no entry lands in
|
|
2038
|
+
// `missing`, a key whose `*.val.json` fails to load lands in `errors`. Only a
|
|
2039
|
+
// missing/non-record MODULE is a 404.
|
|
2040
|
+
//
|
|
2041
|
+
// `apply_patches` defaults to TRUE (as on `/sources/~`): the server replays
|
|
2042
|
+
// pending patches for the entry. The Studio passes `false` explicitly, because
|
|
2043
|
+
// it owns in-flight client patches the server has not seen yet and applies
|
|
2044
|
+
// them itself — letting the server apply them too would double-apply.
|
|
2045
|
+
//
|
|
2046
|
+
// Shape (3) REQUIRES `apply_patches=false`. Enumerating "every entry" from the
|
|
2047
|
+
// base source would silently omit draft-added keys, and the only all-mode caller
|
|
2048
|
+
// (the Studio) derives its key set from its own patched source anyway. Callers
|
|
2049
|
+
// that need draft-aware enumeration pass explicit `keys`.
|
|
2050
|
+
"/json": {
|
|
2051
|
+
GET: {
|
|
2052
|
+
req: {
|
|
2053
|
+
query: {
|
|
2054
|
+
path: onlyOneStringQueryParam,
|
|
2055
|
+
key: onlyOneStringQueryParam.optional(),
|
|
2056
|
+
keys: z.array(z.string()).max(JSON_ENTRIES_BATCH_MAX).optional(),
|
|
2057
|
+
offset: onlyOneIntQueryParam.optional(),
|
|
2058
|
+
limit: onlyOneIntQueryParam.refine(function (arg) {
|
|
2059
|
+
return arg > 0 && arg <= JSON_ENTRIES_BATCH_MAX;
|
|
2060
|
+
}, "limit must be between 1 and ".concat(JSON_ENTRIES_BATCH_MAX)).optional(),
|
|
2061
|
+
apply_patches: onlyOneBooleanQueryParam.optional()
|
|
2062
|
+
},
|
|
2063
|
+
cookies: _defineProperty({}, VAL_SESSION_COOKIE, z.string().optional())
|
|
2064
|
+
},
|
|
2065
|
+
res: z.union([unauthorizedResponse, notFoundResponse,
|
|
2066
|
+
// Shape (1): single `key`.
|
|
2067
|
+
z.object({
|
|
2068
|
+
status: z.literal(200),
|
|
2069
|
+
json: z.object({
|
|
2070
|
+
path: ModuleFilePath,
|
|
2071
|
+
key: z.string(),
|
|
2072
|
+
// The entry's JSON content (or null if the entry has no value).
|
|
2073
|
+
content: z.any()
|
|
2074
|
+
})
|
|
2075
|
+
}),
|
|
2076
|
+
// Shapes (2) and (3): `keys` or `offset`+`limit`.
|
|
2077
|
+
z.object({
|
|
2078
|
+
status: z.literal(200),
|
|
2079
|
+
json: z.object({
|
|
2080
|
+
path: ModuleFilePath,
|
|
2081
|
+
entries: z.array(z.object({
|
|
2082
|
+
key: z.string(),
|
|
2083
|
+
// The entry's JSON content (or null if the entry has no value).
|
|
2084
|
+
content: z.any()
|
|
2085
|
+
})),
|
|
2086
|
+
// Requested keys that have no entry (neither committed nor drafted).
|
|
2087
|
+
missing: z.array(z.string()),
|
|
2088
|
+
// Requested keys whose content could not be loaded.
|
|
2089
|
+
errors: z.array(z.object({
|
|
2090
|
+
key: z.string(),
|
|
2091
|
+
message: z.string()
|
|
2092
|
+
})),
|
|
2093
|
+
// All-mode only: the resolved window and the record's total key count.
|
|
2094
|
+
offset: z.number().optional(),
|
|
2095
|
+
limit: z.number().optional(),
|
|
2096
|
+
total: z.number().optional()
|
|
2097
|
+
})
|
|
2098
|
+
}), z.object({
|
|
2099
|
+
status: z.literal(400),
|
|
2100
|
+
json: GenericError
|
|
2101
|
+
}), z.object({
|
|
2102
|
+
status: z.literal(500),
|
|
2103
|
+
json: GenericError
|
|
2104
|
+
})])
|
|
2105
|
+
}
|
|
2106
|
+
},
|
|
1992
2107
|
"/ai/initialize": {
|
|
1993
2108
|
POST: {
|
|
1994
2109
|
req: {
|
|
@@ -2176,6 +2291,8 @@ var Api = {
|
|
|
2176
2291
|
*
|
|
2177
2292
|
* Do not change this without updating the ValRouter query parsing logic
|
|
2178
2293
|
* */
|
|
2294
|
+
// `number` is allowed because the client stringifies every query value before it
|
|
2295
|
+
// goes on the URL (see createValClient), so a numeric param round-trips fine.
|
|
2179
2296
|
|
|
2180
2297
|
function _typeof(o) {
|
|
2181
2298
|
"@babel/helpers - typeof";
|
|
@@ -3164,4 +3281,4 @@ function resolveSchemaSourceFixes(validationErrors, snapshot) {
|
|
|
3164
3281
|
return result;
|
|
3165
3282
|
}
|
|
3166
3283
|
|
|
3167
|
-
export { Api, DEFAULT_ERROR_MESSAGE, DateOptions, FileOptions, ImageOptions, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RichTextOptions, SerializedArraySchema, SerializedBooleanSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedStringSchema, SerializedUnionSchema, SharedValConfig, VAL_AI_SESSION_STORAGE_KEY, VAL_CONFIG_SESSION_STORAGE_KEY, VAL_ENABLE_COOKIE_NAME, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_THEME_SESSION_STORAGE_KEY, ValCommit, ValDeployment, createRegExpFromPattern, createValClient, filterRoutesByPatterns, findSimilar, getErrorMessageFromUnknownJson, getNextAppRouterSitemapTree, getNextAppRouterSourceFolder, getPatternFromModuleFilePath, getRoutesOf, getRoutesWithModulePaths, levenshtein, parseRoutePattern, remirrorToRichTextSource, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, richTextToRemirror, urlOf, validateRoutePatterns };
|
|
3284
|
+
export { Api, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, FileOptions, ImageOptions, JSON_ENTRIES_BATCH_MAX, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RichTextOptions, SerializedArraySchema, SerializedBooleanSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedStringSchema, SerializedUnionSchema, SharedValConfig, VAL_AI_SESSION_STORAGE_KEY, VAL_CONFIG_SESSION_STORAGE_KEY, VAL_ENABLE_COOKIE_NAME, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_THEME_SESSION_STORAGE_KEY, ValCommit, ValDeployment, createRegExpFromPattern, createValClient, filterRoutesByPatterns, findSimilar, getErrorMessageFromUnknownJson, getNextAppRouterSitemapTree, getNextAppRouterSourceFolder, getPatternFromModuleFilePath, getRoutesOf, getRoutesWithModulePaths, levenshtein, parseRoutePattern, remirrorToRichTextSource, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, richTextToRemirror, urlOf, validateRoutePatterns };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.101.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Val shared types and utilities",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"zod": "^4.3.5",
|
|
33
33
|
"zod-validation-error": "^5.0.0",
|
|
34
|
-
"@valbuild/core": "0.
|
|
34
|
+
"@valbuild/core": "0.101.0"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"dist",
|