@valbuild/shared 0.123.2 → 0.124.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 +108 -0
- package/dist/declarations/src/internal/ApiRoutes.d.ts +77 -0
- package/dist/declarations/src/internal/search/searchIndex.d.ts +31 -2
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +183 -145
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +183 -145
- package/internal/dist/valbuild-shared-internal.esm.js +183 -145
- package/package.json +2 -2
|
@@ -904,97 +904,96 @@ var InlineRender = z.object({
|
|
|
904
904
|
as: z.literal("inline")
|
|
905
905
|
});
|
|
906
906
|
var FieldRender = InlineRender.optional();
|
|
907
|
-
|
|
908
|
-
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* The fields EVERY serialized schema carries, in one place.
|
|
910
|
+
*
|
|
911
|
+
* Spread into each schema below rather than retyped, because retyping them is
|
|
912
|
+
* exactly how they went missing: `customValidate` and `description` were
|
|
913
|
+
* declared on six of the eighteen schemas and silently dropped by the other
|
|
914
|
+
* twelve. A field added to the base of `SerializedSchema` needs adding here and
|
|
915
|
+
* nowhere else.
|
|
916
|
+
*
|
|
917
|
+
* `type`, `opt` and whatever is particular to the schema stay at the call site
|
|
918
|
+
* - those differ per schema, so there is nothing to share.
|
|
919
|
+
*/
|
|
920
|
+
var commonSchemaFields = {
|
|
909
921
|
render: FieldRender,
|
|
922
|
+
preview: z.literal(true).optional(),
|
|
923
|
+
// Whether the schema declares a `.validate()`. The function cannot serialize,
|
|
924
|
+
// so this flag is what tells the Studio to run the custom validators on the
|
|
925
|
+
// main thread against the real instance - dropped, and they never run at all.
|
|
926
|
+
// See `hasCustomValidate` in `ui/spa/validation/customValidate.ts`.
|
|
927
|
+
customValidate: z["boolean"]().optional(),
|
|
928
|
+
readonly: z["boolean"]().optional(),
|
|
929
|
+
hidden: z["boolean"]().optional(),
|
|
930
|
+
description: z.string().optional()
|
|
931
|
+
};
|
|
932
|
+
var SerializedStringSchema = z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
933
|
+
type: z.literal("string"),
|
|
910
934
|
// `.multiline()`. Stripped like any undeclared key if it goes missing here,
|
|
911
935
|
// which is a single-line input where the author asked for a text box.
|
|
912
936
|
multiline: z["boolean"]().optional(),
|
|
913
|
-
preview: z.literal(true).optional(),
|
|
914
937
|
options: z.object({
|
|
915
938
|
maxLength: z.number().optional(),
|
|
916
939
|
minLength: z.number().optional(),
|
|
917
940
|
regexp: z.object({
|
|
941
|
+
// `.regexp(re, message)`'s message. Written by
|
|
942
|
+
// `StringSchema.executeSerialize`, so omitting it here strips the
|
|
943
|
+
// author's own wording and leaves the generic "Expected string to
|
|
944
|
+
// match reg exp: …" in its place.
|
|
945
|
+
message: z.string().optional(),
|
|
918
946
|
source: z.string(),
|
|
919
947
|
flags: z.string()
|
|
920
|
-
}).optional()
|
|
948
|
+
}).optional(),
|
|
949
|
+
customValidate: z["boolean"]().optional()
|
|
921
950
|
}).optional(),
|
|
922
951
|
opt: z["boolean"](),
|
|
923
|
-
raw: z["boolean"]()
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
});
|
|
927
|
-
var SerializedLiteralSchema = z.object({
|
|
952
|
+
raw: z["boolean"]()
|
|
953
|
+
}));
|
|
954
|
+
var SerializedLiteralSchema = z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
928
955
|
type: z.literal("literal"),
|
|
929
|
-
render: FieldRender,
|
|
930
|
-
preview: z.literal(true).optional(),
|
|
931
956
|
value: z.string(),
|
|
932
|
-
opt: z["boolean"]()
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
});
|
|
936
|
-
var SerializedBooleanSchema = z.object({
|
|
957
|
+
opt: z["boolean"]()
|
|
958
|
+
}));
|
|
959
|
+
var SerializedBooleanSchema = z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
937
960
|
type: z.literal("boolean"),
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
readonly: z["boolean"]().optional(),
|
|
942
|
-
hidden: z["boolean"]().optional()
|
|
943
|
-
});
|
|
944
|
-
var SerializedNumberSchema = z.object({
|
|
961
|
+
opt: z["boolean"]()
|
|
962
|
+
}));
|
|
963
|
+
var SerializedNumberSchema = z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
945
964
|
type: z.literal("number"),
|
|
946
|
-
render: FieldRender,
|
|
947
|
-
preview: z.literal(true).optional(),
|
|
948
965
|
options: z.object({
|
|
949
966
|
max: z.number().optional(),
|
|
950
967
|
min: z.number().optional()
|
|
951
968
|
}).optional(),
|
|
952
|
-
opt: z["boolean"]()
|
|
953
|
-
|
|
954
|
-
hidden: z["boolean"]().optional()
|
|
955
|
-
});
|
|
969
|
+
opt: z["boolean"]()
|
|
970
|
+
}));
|
|
956
971
|
var SerializedObjectSchema = z.lazy(function () {
|
|
957
|
-
return z.object({
|
|
972
|
+
return z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
958
973
|
type: z.literal("object"),
|
|
959
|
-
render: FieldRender,
|
|
960
|
-
preview: z.literal(true).optional(),
|
|
961
974
|
items: z.record(z.string(), SerializedSchema),
|
|
962
|
-
opt: z["boolean"]()
|
|
963
|
-
|
|
964
|
-
hidden: z["boolean"]().optional()
|
|
965
|
-
});
|
|
975
|
+
opt: z["boolean"]()
|
|
976
|
+
}));
|
|
966
977
|
});
|
|
967
978
|
var SerializedArraySchema = z.lazy(function () {
|
|
968
|
-
return z.object({
|
|
979
|
+
return z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
969
980
|
type: z.literal("array"),
|
|
970
|
-
render: FieldRender,
|
|
971
|
-
preview: z.literal(true).optional(),
|
|
972
981
|
item: SerializedSchema,
|
|
973
|
-
opt: z["boolean"]()
|
|
974
|
-
|
|
975
|
-
hidden: z["boolean"]().optional()
|
|
976
|
-
});
|
|
982
|
+
opt: z["boolean"]()
|
|
983
|
+
}));
|
|
977
984
|
});
|
|
978
985
|
var SerializedUnionSchema = z.lazy(function () {
|
|
979
|
-
return z.union([z.object({
|
|
986
|
+
return z.union([z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
980
987
|
type: z.literal("union"),
|
|
981
|
-
render: FieldRender,
|
|
982
|
-
preview: z.literal(true).optional(),
|
|
983
988
|
key: SerializedLiteralSchema,
|
|
984
989
|
items: z.array(SerializedLiteralSchema),
|
|
985
|
-
opt: z["boolean"]()
|
|
986
|
-
|
|
987
|
-
hidden: z["boolean"]().optional()
|
|
988
|
-
}), z.object({
|
|
990
|
+
opt: z["boolean"]()
|
|
991
|
+
})), z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
989
992
|
type: z.literal("union"),
|
|
990
|
-
render: FieldRender,
|
|
991
|
-
preview: z.literal(true).optional(),
|
|
992
993
|
key: z.string(),
|
|
993
994
|
items: z.array(SerializedObjectSchema),
|
|
994
|
-
opt: z["boolean"]()
|
|
995
|
-
|
|
996
|
-
hidden: z["boolean"]().optional()
|
|
997
|
-
})]);
|
|
995
|
+
opt: z["boolean"]()
|
|
996
|
+
}))]);
|
|
998
997
|
});
|
|
999
998
|
var ImageEncodeOption = z.union([z.literal(false), z.object({
|
|
1000
999
|
type: z.literal("webp"),
|
|
@@ -1007,15 +1006,16 @@ var ImageOptions = z.object({
|
|
|
1007
1006
|
accept: z.string().optional(),
|
|
1008
1007
|
encode: ImageEncodeOption.optional()
|
|
1009
1008
|
});
|
|
1010
|
-
var SerializedImageSchema = z.object({
|
|
1009
|
+
var SerializedImageSchema = z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
1011
1010
|
type: z.literal("image"),
|
|
1012
|
-
render: FieldRender,
|
|
1013
|
-
preview: z.literal(true).optional(),
|
|
1014
1011
|
options: ImageOptions.optional(),
|
|
1015
1012
|
opt: z["boolean"](),
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1013
|
+
// `.remote()`, and the gallery a gallery-backed field reads its metadata
|
|
1014
|
+
// from. Neither is cosmetic: dropped, a remote field looks local and a
|
|
1015
|
+
// gallery-backed one looks like it holds its own dimensions.
|
|
1016
|
+
remote: z["boolean"]().optional(),
|
|
1017
|
+
referencedModule: z.string().optional()
|
|
1018
|
+
}));
|
|
1019
1019
|
var RichTextOptions = z.lazy(function () {
|
|
1020
1020
|
return z.object({
|
|
1021
1021
|
// Set by `.maxLength()` / `.minLength()`, not by the options argument.
|
|
@@ -1038,20 +1038,14 @@ var RichTextOptions = z.lazy(function () {
|
|
|
1038
1038
|
img: z.union([z["boolean"](), SerializedImageSchema]).optional()
|
|
1039
1039
|
});
|
|
1040
1040
|
});
|
|
1041
|
-
var SerializedRichTextSchema = z.object({
|
|
1041
|
+
var SerializedRichTextSchema = z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
1042
1042
|
type: z.literal("richtext"),
|
|
1043
|
-
render: FieldRender,
|
|
1044
|
-
preview: z.literal(true).optional(),
|
|
1045
1043
|
options: RichTextOptions.optional(),
|
|
1046
|
-
opt: z["boolean"]()
|
|
1047
|
-
|
|
1048
|
-
hidden: z["boolean"]().optional()
|
|
1049
|
-
});
|
|
1044
|
+
opt: z["boolean"]()
|
|
1045
|
+
}));
|
|
1050
1046
|
var SerializedRecordSchema = z.lazy(function () {
|
|
1051
|
-
return z.object({
|
|
1047
|
+
return z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
1052
1048
|
type: z.literal("record"),
|
|
1053
|
-
render: FieldRender,
|
|
1054
|
-
preview: z.literal(true).optional(),
|
|
1055
1049
|
item: SerializedSchema,
|
|
1056
1050
|
opt: z["boolean"](),
|
|
1057
1051
|
// Optional gallery marker for files/images
|
|
@@ -1062,16 +1056,12 @@ var SerializedRecordSchema = z.lazy(function () {
|
|
|
1062
1056
|
remote: z["boolean"]().optional(),
|
|
1063
1057
|
encode: ImageEncodeOption.optional(),
|
|
1064
1058
|
alt: SerializedSchema.optional(),
|
|
1065
|
-
moduleMetadata: z.record(z.string(), z.record(z.string(), z.any())).optional()
|
|
1066
|
-
|
|
1067
|
-
hidden: z["boolean"]().optional()
|
|
1068
|
-
}).passthrough();
|
|
1059
|
+
moduleMetadata: z.record(z.string(), z.record(z.string(), z.any())).optional()
|
|
1060
|
+
})).passthrough();
|
|
1069
1061
|
});
|
|
1070
1062
|
var SerializedKeyOfSchema = z.lazy(function () {
|
|
1071
|
-
return z.object({
|
|
1063
|
+
return z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
1072
1064
|
type: z.literal("keyOf"),
|
|
1073
|
-
render: FieldRender,
|
|
1074
|
-
preview: z.literal(true).optional(),
|
|
1075
1065
|
path: SourcePath,
|
|
1076
1066
|
schema: z.union([z.object({
|
|
1077
1067
|
type: z.literal("object"),
|
|
@@ -1082,82 +1072,54 @@ var SerializedKeyOfSchema = z.lazy(function () {
|
|
|
1082
1072
|
opt: z["boolean"]().optional()
|
|
1083
1073
|
})]).optional(),
|
|
1084
1074
|
values: z.union([z.literal("string"), z.array(z.string())]),
|
|
1085
|
-
opt: z["boolean"]()
|
|
1086
|
-
|
|
1087
|
-
hidden: z["boolean"]().optional()
|
|
1088
|
-
});
|
|
1075
|
+
opt: z["boolean"]()
|
|
1076
|
+
}));
|
|
1089
1077
|
});
|
|
1090
1078
|
var FileOptions = z.object({
|
|
1091
1079
|
accept: z.string().optional()
|
|
1092
1080
|
});
|
|
1093
|
-
var SerializedFileSchema = z.object({
|
|
1081
|
+
var SerializedFileSchema = z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
1094
1082
|
type: z.literal("file"),
|
|
1095
|
-
render: FieldRender,
|
|
1096
|
-
preview: z.literal(true).optional(),
|
|
1097
1083
|
options: FileOptions.optional(),
|
|
1098
1084
|
opt: z["boolean"](),
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1085
|
+
// See `SerializedImageSchema` above: `.remote()` and the gallery a
|
|
1086
|
+
// gallery-backed field reads from.
|
|
1087
|
+
remote: z["boolean"]().optional(),
|
|
1088
|
+
referencedModule: z.string().optional()
|
|
1089
|
+
}));
|
|
1102
1090
|
var DateOptions = z.object({
|
|
1103
1091
|
from: z.string().optional(),
|
|
1104
1092
|
to: z.string().optional()
|
|
1105
1093
|
});
|
|
1106
|
-
var SerializedDateSchema = z.object({
|
|
1094
|
+
var SerializedDateSchema = z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
1107
1095
|
type: z.literal("date"),
|
|
1108
|
-
render: FieldRender,
|
|
1109
|
-
preview: z.literal(true).optional(),
|
|
1110
1096
|
options: DateOptions.optional(),
|
|
1111
|
-
opt: z["boolean"]()
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
hidden: z["boolean"]().optional(),
|
|
1115
|
-
description: z.string().optional()
|
|
1116
|
-
});
|
|
1117
|
-
var SerializedDateTimeSchema = z.object({
|
|
1097
|
+
opt: z["boolean"]()
|
|
1098
|
+
}));
|
|
1099
|
+
var SerializedDateTimeSchema = z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
1118
1100
|
type: z.literal("dateTime"),
|
|
1119
|
-
render: FieldRender,
|
|
1120
|
-
preview: z.literal(true).optional(),
|
|
1121
1101
|
options: DateOptions.optional(),
|
|
1122
|
-
opt: z["boolean"]()
|
|
1123
|
-
|
|
1124
|
-
readonly: z["boolean"]().optional(),
|
|
1125
|
-
hidden: z["boolean"]().optional(),
|
|
1126
|
-
description: z.string().optional()
|
|
1127
|
-
});
|
|
1102
|
+
opt: z["boolean"]()
|
|
1103
|
+
}));
|
|
1128
1104
|
var ColorOptions = z.object({
|
|
1129
1105
|
format: z["enum"](["hex", "rgb", "hsl", "oklch"]).optional(),
|
|
1130
1106
|
alpha: z["boolean"]().optional()
|
|
1131
1107
|
});
|
|
1132
|
-
var SerializedColorSchema = z.object({
|
|
1108
|
+
var SerializedColorSchema = z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
1133
1109
|
type: z.literal("color"),
|
|
1134
|
-
render: FieldRender,
|
|
1135
|
-
preview: z.literal(true).optional(),
|
|
1136
1110
|
options: ColorOptions.optional(),
|
|
1137
|
-
opt: z["boolean"]()
|
|
1138
|
-
|
|
1139
|
-
readonly: z["boolean"]().optional(),
|
|
1140
|
-
hidden: z["boolean"]().optional(),
|
|
1141
|
-
description: z.string().optional()
|
|
1142
|
-
});
|
|
1111
|
+
opt: z["boolean"]()
|
|
1112
|
+
}));
|
|
1143
1113
|
var CodeOptions = z.object({
|
|
1144
1114
|
language: z["enum"](CODE_LANGUAGES).optional()
|
|
1145
1115
|
});
|
|
1146
|
-
var SerializedCodeSchema = z.object({
|
|
1116
|
+
var SerializedCodeSchema = z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
1147
1117
|
type: z.literal("code"),
|
|
1148
|
-
render: FieldRender,
|
|
1149
|
-
preview: z.literal(true).optional(),
|
|
1150
1118
|
options: CodeOptions.optional(),
|
|
1151
|
-
opt: z["boolean"]()
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
hidden: z["boolean"]().optional(),
|
|
1155
|
-
description: z.string().optional()
|
|
1156
|
-
});
|
|
1157
|
-
var SerializedRouteSchema = z.object({
|
|
1119
|
+
opt: z["boolean"]()
|
|
1120
|
+
}));
|
|
1121
|
+
var SerializedRouteSchema = z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
1158
1122
|
type: z.literal("route"),
|
|
1159
|
-
render: FieldRender,
|
|
1160
|
-
preview: z.literal(true).optional(),
|
|
1161
1123
|
options: z.object({
|
|
1162
1124
|
include: z.object({
|
|
1163
1125
|
source: z.string(),
|
|
@@ -1169,11 +1131,8 @@ var SerializedRouteSchema = z.object({
|
|
|
1169
1131
|
}).optional(),
|
|
1170
1132
|
customValidate: z["boolean"]().optional()
|
|
1171
1133
|
}).optional(),
|
|
1172
|
-
opt: z["boolean"]()
|
|
1173
|
-
|
|
1174
|
-
readonly: z["boolean"]().optional(),
|
|
1175
|
-
hidden: z["boolean"]().optional()
|
|
1176
|
-
});
|
|
1134
|
+
opt: z["boolean"]()
|
|
1135
|
+
}));
|
|
1177
1136
|
|
|
1178
1137
|
// A settings module, and each section inside one, serialize as this - the
|
|
1179
1138
|
// shape is recursive because `items` holds sections which are themselves
|
|
@@ -1181,17 +1140,11 @@ var SerializedRouteSchema = z.object({
|
|
|
1181
1140
|
// (see core/src/schema/settings.ts), but they are accepted here because they
|
|
1182
1141
|
// are part of the declared type.
|
|
1183
1142
|
var SerializedSettingsSchema = z.lazy(function () {
|
|
1184
|
-
return z.object({
|
|
1143
|
+
return z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
|
|
1185
1144
|
type: z.literal("settings"),
|
|
1186
|
-
render: FieldRender,
|
|
1187
|
-
preview: z.literal(true).optional(),
|
|
1188
1145
|
items: z.record(z.string(), SerializedSchema),
|
|
1189
|
-
opt: z["boolean"]()
|
|
1190
|
-
|
|
1191
|
-
readonly: z["boolean"]().optional(),
|
|
1192
|
-
hidden: z["boolean"]().optional(),
|
|
1193
|
-
description: z.string().optional()
|
|
1194
|
-
});
|
|
1146
|
+
opt: z["boolean"]()
|
|
1147
|
+
}));
|
|
1195
1148
|
});
|
|
1196
1149
|
var SerializedSchema = z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedUnionSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedRouteSchema, SerializedFileSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedColorSchema, SerializedCodeSchema, SerializedSettingsSchema, SerializedImageSchema]);
|
|
1197
1150
|
|
|
@@ -2503,6 +2456,66 @@ var Api = {
|
|
|
2503
2456
|
* actually mounts. A file at a fixed commit cannot change, so the response is
|
|
2504
2457
|
* immutable and the browser's own cache handles flipping between commits.
|
|
2505
2458
|
*/
|
|
2459
|
+
/**
|
|
2460
|
+
* One `.jsonValues()` entry's content, as it was at a commit.
|
|
2461
|
+
*
|
|
2462
|
+
* The history pane's counterpart to `/json`. A `.jsonValues()` record's
|
|
2463
|
+
* source is only `{_type:"json"}` markers - the content is per entry, fetched
|
|
2464
|
+
* on demand - so without this the commit pane rendered every entry as an
|
|
2465
|
+
* empty field, which is a claim that the author left it blank.
|
|
2466
|
+
*
|
|
2467
|
+
* One entry per request, deliberately: the store fetches an entry when
|
|
2468
|
+
* something reads inside it, so a batch would mean guessing which entries the
|
|
2469
|
+
* pane is about to show. Authenticated for the same reasons as
|
|
2470
|
+
* `/history/files` below.
|
|
2471
|
+
*/
|
|
2472
|
+
"/history/json": {
|
|
2473
|
+
GET: {
|
|
2474
|
+
req: {
|
|
2475
|
+
query: {
|
|
2476
|
+
commit_sha: onlyOneStringQueryParam,
|
|
2477
|
+
path: onlyOneStringQueryParam,
|
|
2478
|
+
key: onlyOneStringQueryParam
|
|
2479
|
+
},
|
|
2480
|
+
cookies: {
|
|
2481
|
+
val_session: z.string().optional()
|
|
2482
|
+
}
|
|
2483
|
+
},
|
|
2484
|
+
res: z.union([unauthorizedResponse, notFoundResponse, z.object({
|
|
2485
|
+
status: z.literal(400),
|
|
2486
|
+
json: GenericError.and(z.object({
|
|
2487
|
+
kind: z.string().optional()
|
|
2488
|
+
}))
|
|
2489
|
+
}), z.object({
|
|
2490
|
+
status: z.literal(500),
|
|
2491
|
+
json: GenericError.and(z.object({
|
|
2492
|
+
kind: z.string().optional()
|
|
2493
|
+
}))
|
|
2494
|
+
}), z.object({
|
|
2495
|
+
status: z.literal(200),
|
|
2496
|
+
json: z.object({
|
|
2497
|
+
path: ModuleFilePath,
|
|
2498
|
+
key: z.string(),
|
|
2499
|
+
content: z.unknown()
|
|
2500
|
+
})
|
|
2501
|
+
})])
|
|
2502
|
+
}
|
|
2503
|
+
},
|
|
2504
|
+
/**
|
|
2505
|
+
* A binary file as it was at a commit.
|
|
2506
|
+
*
|
|
2507
|
+
* AUTHENTICATED, unlike `/files` below - and the difference is not an
|
|
2508
|
+
* oversight in either direction. See the comment on `/files`: what makes it
|
|
2509
|
+
* safe to leave open is that a `patch_id` is an unguessable UUID, and what
|
|
2510
|
+
* makes leaving it open NECESSARY is that a draft image is fetched by the
|
|
2511
|
+
* app's own backend during Next image optimisation, with no cookies.
|
|
2512
|
+
*
|
|
2513
|
+
* Neither holds here. A commit sha is published - `git log`, the GitHub UI,
|
|
2514
|
+
* every PR - so it is not a secret to stand in for a credential. And nothing
|
|
2515
|
+
* fetches these server-side: they are read by the Studio, in a browser that
|
|
2516
|
+
* has the session cookie, for the history pane and for staging a restore.
|
|
2517
|
+
* So this one asks.
|
|
2518
|
+
*/
|
|
2506
2519
|
"/history/files": {
|
|
2507
2520
|
GET: {
|
|
2508
2521
|
req: {
|
|
@@ -2510,6 +2523,9 @@ var Api = {
|
|
|
2510
2523
|
commit_sha: onlyOneStringQueryParam,
|
|
2511
2524
|
path: onlyOneStringQueryParam,
|
|
2512
2525
|
remote: onlyOneStringQueryParam.optional()
|
|
2526
|
+
},
|
|
2527
|
+
cookies: {
|
|
2528
|
+
val_session: z.string().optional()
|
|
2513
2529
|
}
|
|
2514
2530
|
},
|
|
2515
2531
|
res: z.union([unauthorizedResponse, notFoundResponse, z.object({
|
|
@@ -5322,6 +5338,28 @@ function getRefParts(ref) {
|
|
|
5322
5338
|
* them — an agent and an editor searching the same project should find the same
|
|
5323
5339
|
* things.
|
|
5324
5340
|
*/
|
|
5341
|
+
/**
|
|
5342
|
+
* The parts of FlexSearch's `Index` this module uses.
|
|
5343
|
+
*
|
|
5344
|
+
* Structural, rather than importing flexsearch's own `Index`, because
|
|
5345
|
+
* {@link SearchIndex} is EXPORTED — and a `.d.ts` that names `flexsearch` pulls
|
|
5346
|
+
* that package's `declare module "flexsearch"` into every consumer's TypeScript
|
|
5347
|
+
* program. Ambient module declarations are global to a program, so a consumer
|
|
5348
|
+
* with its own flexsearch at another version then checks its OWN calls against
|
|
5349
|
+
* the copy we dragged in, whichever of the two wins.
|
|
5350
|
+
*
|
|
5351
|
+
* That is not hypothetical: `@valbuild/shared` gained a flexsearch dependency
|
|
5352
|
+
* in 0.123.0 for `search_content`, and valbuild/web — which pins flexsearch
|
|
5353
|
+
* 0.7 and calls `new flexsearch.Document({ language: "en", … })` — stopped
|
|
5354
|
+
* building on 0.123.2, because 0.8's `DocumentOptions` has no `language`. Its
|
|
5355
|
+
* own resolved copy was still 0.7; only the types had been replaced.
|
|
5356
|
+
*
|
|
5357
|
+
* Three methods is all this module calls, and none of their signatures here is
|
|
5358
|
+
* a guess: `add` and `remove` are used in `indexModule`/`removeModule`, and
|
|
5359
|
+
* `search`'s result is only ever `.length`-ed, `.slice`-d and mapped over as
|
|
5360
|
+
* ids. `FlexSearch.Index` is still constructed with the real library in
|
|
5361
|
+
* {@link createSearchIndex} — a value import, which does not reach the `.d.ts`.
|
|
5362
|
+
*/
|
|
5325
5363
|
|
|
5326
5364
|
/** An index with nothing in it. Fill it with {@link indexModule}. */
|
|
5327
5365
|
function createSearchIndex() {
|
|
@@ -5423,9 +5461,9 @@ function removeModule(searchIndex, moduleFilePath) {
|
|
|
5423
5461
|
_step;
|
|
5424
5462
|
try {
|
|
5425
5463
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
5426
|
-
var
|
|
5427
|
-
index.remove(
|
|
5428
|
-
pathToLabel["delete"](
|
|
5464
|
+
var _id = _step.value;
|
|
5465
|
+
index.remove(_id);
|
|
5466
|
+
pathToLabel["delete"](_id);
|
|
5429
5467
|
}
|
|
5430
5468
|
} catch (err) {
|
|
5431
5469
|
_iterator.e(err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.124.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.124.0"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
43
|
"CHANGELOG.md",
|