@valbuild/shared 0.121.0 → 0.122.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 +76 -0
- package/dist/declarations/src/internal/ApiRoutes.d.ts +304 -41
- package/dist/declarations/src/internal/index.d.ts +2 -0
- package/dist/declarations/src/internal/schema/compatibility.d.ts +62 -0
- package/dist/declarations/src/internal/zod/History.d.ts +257 -0
- package/dist/declarations/src/internal/zod/Patch.d.ts +7 -0
- package/dist/declarations/src/internal/zod/SerializedSchema.d.ts +2 -1
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +649 -43
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +649 -43
- package/internal/dist/valbuild-shared-internal.esm.js +639 -44
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,81 @@
|
|
|
1
1
|
# @valbuild/shared
|
|
2
2
|
|
|
3
|
+
## 0.122.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#563](https://github.com/valbuild/val/pull/563) [`be32261`](https://github.com/valbuild/val/commit/be32261af19db8018bc37b180d903416018c0b79) Thanks [@freekh](https://github.com/freekh)! - See how a module looked at any past commit, and restore from it by pointing at it
|
|
8
|
+
|
|
9
|
+
Val could publish edits but never look back. Now every commit is a durable
|
|
10
|
+
record you can open, and any part of it can be put back.
|
|
11
|
+
|
|
12
|
+
**Open a commit and the Studio splits in two.** The left half is the Studio
|
|
13
|
+
itself — same navigation, same fields, same everything, because it _is_ the
|
|
14
|
+
editor rather than a copy of it. The right half shows the project as that commit
|
|
15
|
+
left it. On a phone the two become one pane and a toggle.
|
|
16
|
+
|
|
17
|
+
**Restoring is directed: you point at the old value, then at where it goes.**
|
|
18
|
+
Val does not try to work out which of today's fields corresponds to which of the
|
|
19
|
+
commit's. It cannot be sure — array items splice, schemas move — and a restore
|
|
20
|
+
that guesses wrong writes into the wrong place and looks like it worked. Two
|
|
21
|
+
picks leave nothing to guess. You can restore across paths, so last month's
|
|
22
|
+
headline can become today's tagline.
|
|
23
|
+
|
|
24
|
+
Before you click, every field on the "now" side says whether it can hold the
|
|
25
|
+
value you picked, and a field that cannot explains why when you click it rather
|
|
26
|
+
than doing nothing. A changed union is not itself a blocker: what matters is
|
|
27
|
+
whether the value's own shape is still allowed, so a union that gained a case
|
|
28
|
+
restores fine and one that lost the case you are restoring does not.
|
|
29
|
+
|
|
30
|
+
Rich text can be restored but is marked "probably fits" rather than confirmed —
|
|
31
|
+
comparing every mark and block against the options a schema allows is not done
|
|
32
|
+
yet, and saying so is better than a confident answer we cannot back. It is
|
|
33
|
+
checked properly the moment you commit to it: before anything is staged, the old
|
|
34
|
+
value is checked against the field it is going into, and a value that cannot be
|
|
35
|
+
that field is refused with the reason. A value that is the right shape but
|
|
36
|
+
breaks a rule about its content — a name too short for its `minLength` — is
|
|
37
|
+
staged and then held at publish, the same as if you had typed it, because a
|
|
38
|
+
restore should not be stricter than typing.
|
|
39
|
+
|
|
40
|
+
**A whole module can be put back on its own**, from a commit that changed
|
|
41
|
+
several, without reverting the rest of the commit.
|
|
42
|
+
|
|
43
|
+
**Restores are staged, not applied.** They land in pending changes, are reviewed
|
|
44
|
+
beside every other edit, and go out with the next publish. There is also "put
|
|
45
|
+
everything back", for when a whole publish was the mistake.
|
|
46
|
+
|
|
47
|
+
To make this possible, publishing now records each changed module's data and the
|
|
48
|
+
schema it was written against. Not the `.val.ts` — git already keeps that, but
|
|
49
|
+
it is code, and turning code back into data means parsing it, which is
|
|
50
|
+
best-effort and stops working as TypeScript, your runtime and Val move on. The
|
|
51
|
+
schema is kept because a value on its own cannot be drawn: showing a module as it
|
|
52
|
+
was at a commit whose schema has since changed needs _that commit's_ schema, and
|
|
53
|
+
nothing in your current checkout has it.
|
|
54
|
+
|
|
55
|
+
Things it will not pretend about: a module the commit did not touch says so
|
|
56
|
+
rather than showing today's value; a module saved by a different version of Val
|
|
57
|
+
says the version differs and that nothing is lost; a commit made before Val
|
|
58
|
+
started recording history disables restore with the reason next to it. Images
|
|
59
|
+
and files are restored by re-uploading them, since the bytes at an old commit
|
|
60
|
+
may no longer be on your branch.
|
|
61
|
+
|
|
62
|
+
History requires the Val content service. In filesystem mode it reports
|
|
63
|
+
`not-supported-in-fs-mode` rather than faking it from git, which has the files
|
|
64
|
+
but not which of a commit's changes were one editor's work.
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- [#618](https://github.com/valbuild/val/pull/618) [`da6794f`](https://github.com/valbuild/val/commit/da6794f3dbd77d49ccfe780b359bab1689ee1b11) Thanks [@freekh](https://github.com/freekh)! - Remove the unused `GET /api/val/session` endpoint.
|
|
69
|
+
|
|
70
|
+
Nothing called it. The Studio reads the profile id from `/stat`, and in proxy
|
|
71
|
+
mode the route proxied to `${VAL_BUILD_URL}/api/val/${project}/auth/session`,
|
|
72
|
+
an upstream route that no longer exists — so calling it by hand returned a 500
|
|
73
|
+
rather than a session. It is gone from both the route declarations in
|
|
74
|
+
`@valbuild/shared` and the implementation in `@valbuild/server`.
|
|
75
|
+
|
|
76
|
+
Session cookie handling itself is unchanged: `/authorize`, `/callback` and
|
|
77
|
+
`/logout` still set and clear `val_session` as before.
|
|
78
|
+
|
|
3
79
|
## 0.121.0
|
|
4
80
|
|
|
5
81
|
### Minor Changes
|
|
@@ -273,46 +273,6 @@ export declare const Api: {
|
|
|
273
273
|
}, z.core.$strip>;
|
|
274
274
|
};
|
|
275
275
|
};
|
|
276
|
-
"/session": {
|
|
277
|
-
GET: {
|
|
278
|
-
req: {
|
|
279
|
-
cookies: {
|
|
280
|
-
val_session: z.ZodOptional<z.ZodString>;
|
|
281
|
-
};
|
|
282
|
-
};
|
|
283
|
-
res: z.ZodUnion<readonly [z.ZodObject<{
|
|
284
|
-
status: z.ZodLiteral<200>;
|
|
285
|
-
json: z.ZodObject<{
|
|
286
|
-
mode: z.ZodUnion<readonly [z.ZodLiteral<"local">, z.ZodLiteral<"proxy">]>;
|
|
287
|
-
enabled: z.ZodBoolean;
|
|
288
|
-
}, z.core.$strip>;
|
|
289
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
290
|
-
status: z.ZodUnion<readonly [z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>, z.ZodLiteral<404>, z.ZodLiteral<500>, z.ZodLiteral<501>]>;
|
|
291
|
-
json: z.ZodObject<{
|
|
292
|
-
message: z.ZodString;
|
|
293
|
-
}, z.core.$strip>;
|
|
294
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
295
|
-
status: z.ZodLiteral<401>;
|
|
296
|
-
json: z.ZodObject<{
|
|
297
|
-
message: z.ZodString;
|
|
298
|
-
details: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
299
|
-
reason: z.ZodString;
|
|
300
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
301
|
-
sub: z.ZodString;
|
|
302
|
-
exp: z.ZodNumber;
|
|
303
|
-
token: z.ZodString;
|
|
304
|
-
org: z.ZodString;
|
|
305
|
-
project: z.ZodString;
|
|
306
|
-
}, z.core.$strip>]>;
|
|
307
|
-
}, z.core.$strip>;
|
|
308
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
309
|
-
status: z.ZodLiteral<500>;
|
|
310
|
-
json: z.ZodObject<{
|
|
311
|
-
message: z.ZodString;
|
|
312
|
-
}, z.core.$strip>;
|
|
313
|
-
}, z.core.$strip>]>;
|
|
314
|
-
};
|
|
315
|
-
};
|
|
316
276
|
"/logout": {
|
|
317
277
|
GET: {
|
|
318
278
|
req: {
|
|
@@ -980,7 +940,7 @@ export declare const Api: {
|
|
|
980
940
|
message: z.ZodString;
|
|
981
941
|
value: z.ZodOptional<z.ZodUnknown>;
|
|
982
942
|
fatal: z.ZodOptional<z.ZodBoolean>;
|
|
983
|
-
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>>>>;
|
|
943
|
+
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" | "external:upload", 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" | "external:upload", unknown>>>>;
|
|
984
944
|
}, z.core.$strip>>>>;
|
|
985
945
|
}, z.core.$strip>>;
|
|
986
946
|
}, z.core.$strip>;
|
|
@@ -1096,6 +1056,309 @@ export declare const Api: {
|
|
|
1096
1056
|
}, z.core.$strip>]>;
|
|
1097
1057
|
};
|
|
1098
1058
|
};
|
|
1059
|
+
"/history/commits": {
|
|
1060
|
+
GET: {
|
|
1061
|
+
req: {
|
|
1062
|
+
query: {
|
|
1063
|
+
branch: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>;
|
|
1064
|
+
limit: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>, z.ZodTransform<number, string>>>;
|
|
1065
|
+
/** The previous page's `nextCursor`. */
|
|
1066
|
+
cursor: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>>;
|
|
1067
|
+
};
|
|
1068
|
+
cookies: {
|
|
1069
|
+
val_session: z.ZodOptional<z.ZodString>;
|
|
1070
|
+
};
|
|
1071
|
+
};
|
|
1072
|
+
res: z.ZodUnion<readonly [z.ZodObject<{
|
|
1073
|
+
status: z.ZodLiteral<401>;
|
|
1074
|
+
json: z.ZodObject<{
|
|
1075
|
+
message: z.ZodString;
|
|
1076
|
+
}, z.core.$strip>;
|
|
1077
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1078
|
+
status: z.ZodLiteral<404>;
|
|
1079
|
+
json: z.ZodObject<{
|
|
1080
|
+
message: z.ZodString;
|
|
1081
|
+
}, z.core.$strip>;
|
|
1082
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1083
|
+
status: z.ZodLiteral<400>;
|
|
1084
|
+
json: z.ZodIntersection<z.ZodObject<{
|
|
1085
|
+
message: z.ZodString;
|
|
1086
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1087
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
1088
|
+
}, z.core.$strip>>;
|
|
1089
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1090
|
+
status: z.ZodLiteral<500>;
|
|
1091
|
+
json: z.ZodIntersection<z.ZodObject<{
|
|
1092
|
+
message: z.ZodString;
|
|
1093
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1094
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
1095
|
+
}, z.core.$strip>>;
|
|
1096
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1097
|
+
status: z.ZodLiteral<200>;
|
|
1098
|
+
json: z.ZodObject<{
|
|
1099
|
+
commits: z.ZodArray<z.ZodObject<{
|
|
1100
|
+
commitSha: z.ZodString;
|
|
1101
|
+
parentCommitSha: z.ZodString;
|
|
1102
|
+
clientCommitSha: z.ZodString;
|
|
1103
|
+
branch: z.ZodString;
|
|
1104
|
+
createdBranch: z.ZodNullable<z.ZodString>;
|
|
1105
|
+
creator: z.ZodNullable<z.ZodString>;
|
|
1106
|
+
message: z.ZodNullable<z.ZodString>;
|
|
1107
|
+
createdAt: z.ZodString;
|
|
1108
|
+
seqNum: z.ZodString;
|
|
1109
|
+
patchCount: z.ZodNumber;
|
|
1110
|
+
hasArchive: z.ZodBoolean;
|
|
1111
|
+
}, z.core.$strip>>;
|
|
1112
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
1113
|
+
}, z.core.$strip>;
|
|
1114
|
+
}, z.core.$strip>]>;
|
|
1115
|
+
};
|
|
1116
|
+
};
|
|
1117
|
+
/**
|
|
1118
|
+
* One commit, reconstructed. IMMUTABLE for a given sha - it says nothing
|
|
1119
|
+
* about the current source or schema, which is what lets it be cached
|
|
1120
|
+
* forever and what makes comparing many commits cheap.
|
|
1121
|
+
*/
|
|
1122
|
+
"/history/commit": {
|
|
1123
|
+
GET: {
|
|
1124
|
+
req: {
|
|
1125
|
+
query: {
|
|
1126
|
+
commit_sha: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>;
|
|
1127
|
+
};
|
|
1128
|
+
cookies: {
|
|
1129
|
+
val_session: z.ZodOptional<z.ZodString>;
|
|
1130
|
+
};
|
|
1131
|
+
};
|
|
1132
|
+
res: z.ZodUnion<readonly [z.ZodObject<{
|
|
1133
|
+
status: z.ZodLiteral<401>;
|
|
1134
|
+
json: z.ZodObject<{
|
|
1135
|
+
message: z.ZodString;
|
|
1136
|
+
}, z.core.$strip>;
|
|
1137
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1138
|
+
status: z.ZodLiteral<404>;
|
|
1139
|
+
json: z.ZodObject<{
|
|
1140
|
+
message: z.ZodString;
|
|
1141
|
+
}, z.core.$strip>;
|
|
1142
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1143
|
+
status: z.ZodLiteral<400>;
|
|
1144
|
+
json: z.ZodObject<{
|
|
1145
|
+
message: z.ZodString;
|
|
1146
|
+
}, z.core.$strip>;
|
|
1147
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1148
|
+
status: z.ZodLiteral<500>;
|
|
1149
|
+
json: z.ZodIntersection<z.ZodObject<{
|
|
1150
|
+
message: z.ZodString;
|
|
1151
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1152
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
1153
|
+
}, z.core.$strip>>;
|
|
1154
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1155
|
+
status: z.ZodLiteral<200>;
|
|
1156
|
+
json: z.ZodObject<{
|
|
1157
|
+
commit: z.ZodObject<{
|
|
1158
|
+
commitSha: z.ZodString;
|
|
1159
|
+
parentCommitSha: z.ZodString;
|
|
1160
|
+
clientCommitSha: z.ZodString;
|
|
1161
|
+
branch: z.ZodString;
|
|
1162
|
+
createdBranch: z.ZodNullable<z.ZodString>;
|
|
1163
|
+
creator: z.ZodNullable<z.ZodString>;
|
|
1164
|
+
message: z.ZodNullable<z.ZodString>;
|
|
1165
|
+
createdAt: z.ZodString;
|
|
1166
|
+
seqNum: z.ZodString;
|
|
1167
|
+
patchCount: z.ZodNumber;
|
|
1168
|
+
hasArchive: z.ZodBoolean;
|
|
1169
|
+
}, z.core.$strip>;
|
|
1170
|
+
modules: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1171
|
+
source: z.ZodNullable<z.ZodType<import("@valbuild/core/patch").JSONValue, unknown, z.core.$ZodTypeInternals<import("@valbuild/core/patch").JSONValue, unknown>>>;
|
|
1172
|
+
schema: z.ZodNullable<z.ZodType<import("@valbuild/core").SerializedSchema, unknown, z.core.$ZodTypeInternals<import("@valbuild/core").SerializedSchema, unknown>>>;
|
|
1173
|
+
patchIds: z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>;
|
|
1174
|
+
changedPaths: z.ZodArray<z.ZodString>;
|
|
1175
|
+
failures: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1176
|
+
kind: z.ZodLiteral<"commit-not-found">;
|
|
1177
|
+
commitSha: z.ZodString;
|
|
1178
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1179
|
+
kind: z.ZodLiteral<"archive-unreadable">;
|
|
1180
|
+
commitSha: z.ZodString;
|
|
1181
|
+
message: z.ZodString;
|
|
1182
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1183
|
+
kind: z.ZodLiteral<"source-unavailable">;
|
|
1184
|
+
moduleFilePath: z.ZodString;
|
|
1185
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1186
|
+
kind: z.ZodLiteral<"schema-unreadable">;
|
|
1187
|
+
moduleFilePath: z.ZodString;
|
|
1188
|
+
message: z.ZodString;
|
|
1189
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1190
|
+
kind: z.ZodLiteral<"file-unavailable">;
|
|
1191
|
+
gitPath: z.ZodString;
|
|
1192
|
+
message: z.ZodString;
|
|
1193
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1194
|
+
kind: z.ZodLiteral<"not-supported-in-fs-mode">;
|
|
1195
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1196
|
+
kind: z.ZodLiteral<"transport">;
|
|
1197
|
+
message: z.ZodString;
|
|
1198
|
+
}, z.core.$strip>], "kind">>;
|
|
1199
|
+
}, z.core.$strip>>;
|
|
1200
|
+
patches: z.ZodArray<z.ZodObject<{
|
|
1201
|
+
patchId: z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>;
|
|
1202
|
+
moduleFilePath: z.ZodString;
|
|
1203
|
+
patch: z.ZodUnknown;
|
|
1204
|
+
authorId: z.ZodNullable<z.ZodString>;
|
|
1205
|
+
createdAt: z.ZodString;
|
|
1206
|
+
baseSha: z.ZodString;
|
|
1207
|
+
coreVersion: z.ZodString;
|
|
1208
|
+
}, z.core.$strip>>;
|
|
1209
|
+
jsonEntries: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1210
|
+
binaryFiles: z.ZodArray<z.ZodObject<{
|
|
1211
|
+
gitPath: z.ZodString;
|
|
1212
|
+
change: z.ZodUnion<readonly [z.ZodLiteral<"added">, z.ZodLiteral<"modified">, z.ZodLiteral<"deleted">]>;
|
|
1213
|
+
remote: z.ZodBoolean;
|
|
1214
|
+
url: z.ZodString;
|
|
1215
|
+
}, z.core.$strip>>;
|
|
1216
|
+
warnings: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1217
|
+
kind: z.ZodLiteral<"commit-not-found">;
|
|
1218
|
+
commitSha: z.ZodString;
|
|
1219
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1220
|
+
kind: z.ZodLiteral<"archive-unreadable">;
|
|
1221
|
+
commitSha: z.ZodString;
|
|
1222
|
+
message: z.ZodString;
|
|
1223
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1224
|
+
kind: z.ZodLiteral<"source-unavailable">;
|
|
1225
|
+
moduleFilePath: z.ZodString;
|
|
1226
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1227
|
+
kind: z.ZodLiteral<"schema-unreadable">;
|
|
1228
|
+
moduleFilePath: z.ZodString;
|
|
1229
|
+
message: z.ZodString;
|
|
1230
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1231
|
+
kind: z.ZodLiteral<"file-unavailable">;
|
|
1232
|
+
gitPath: z.ZodString;
|
|
1233
|
+
message: z.ZodString;
|
|
1234
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1235
|
+
kind: z.ZodLiteral<"not-supported-in-fs-mode">;
|
|
1236
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1237
|
+
kind: z.ZodLiteral<"transport">;
|
|
1238
|
+
message: z.ZodString;
|
|
1239
|
+
}, z.core.$strip>], "kind">>;
|
|
1240
|
+
}, z.core.$strip>;
|
|
1241
|
+
}, z.core.$strip>]>;
|
|
1242
|
+
};
|
|
1243
|
+
};
|
|
1244
|
+
/**
|
|
1245
|
+
* ONE module, as of a commit — including a commit that did not change it.
|
|
1246
|
+
*
|
|
1247
|
+
* `/history/commit` covers what a commit changed, which is the narrow case:
|
|
1248
|
+
* navigate the history pane to anything else and there would be nothing to
|
|
1249
|
+
* show. This answers "how did this module look at that point", which is the
|
|
1250
|
+
* question someone comparing two panes is actually asking. Immutable for the
|
|
1251
|
+
* same reason: what a commit left behind cannot change.
|
|
1252
|
+
*/
|
|
1253
|
+
"/history/module": {
|
|
1254
|
+
GET: {
|
|
1255
|
+
req: {
|
|
1256
|
+
query: {
|
|
1257
|
+
commit_sha: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>;
|
|
1258
|
+
module_file_path: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>;
|
|
1259
|
+
};
|
|
1260
|
+
cookies: {
|
|
1261
|
+
val_session: z.ZodOptional<z.ZodString>;
|
|
1262
|
+
};
|
|
1263
|
+
};
|
|
1264
|
+
res: z.ZodUnion<readonly [z.ZodObject<{
|
|
1265
|
+
status: z.ZodLiteral<401>;
|
|
1266
|
+
json: z.ZodObject<{
|
|
1267
|
+
message: z.ZodString;
|
|
1268
|
+
}, z.core.$strip>;
|
|
1269
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1270
|
+
status: z.ZodLiteral<404>;
|
|
1271
|
+
json: z.ZodObject<{
|
|
1272
|
+
message: z.ZodString;
|
|
1273
|
+
}, z.core.$strip>;
|
|
1274
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1275
|
+
status: z.ZodLiteral<400>;
|
|
1276
|
+
json: z.ZodObject<{
|
|
1277
|
+
message: z.ZodString;
|
|
1278
|
+
}, z.core.$strip>;
|
|
1279
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1280
|
+
status: z.ZodLiteral<500>;
|
|
1281
|
+
json: z.ZodIntersection<z.ZodObject<{
|
|
1282
|
+
message: z.ZodString;
|
|
1283
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1284
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
1285
|
+
}, z.core.$strip>>;
|
|
1286
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1287
|
+
status: z.ZodLiteral<200>;
|
|
1288
|
+
json: z.ZodObject<{
|
|
1289
|
+
moduleFilePath: z.ZodString;
|
|
1290
|
+
module: z.ZodNullable<z.ZodObject<{
|
|
1291
|
+
source: z.ZodNullable<z.ZodType<import("@valbuild/core/patch").JSONValue, unknown, z.core.$ZodTypeInternals<import("@valbuild/core/patch").JSONValue, unknown>>>;
|
|
1292
|
+
schema: z.ZodNullable<z.ZodType<import("@valbuild/core").SerializedSchema, unknown, z.core.$ZodTypeInternals<import("@valbuild/core").SerializedSchema, unknown>>>;
|
|
1293
|
+
patchIds: z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>;
|
|
1294
|
+
changedPaths: z.ZodArray<z.ZodString>;
|
|
1295
|
+
failures: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1296
|
+
kind: z.ZodLiteral<"commit-not-found">;
|
|
1297
|
+
commitSha: z.ZodString;
|
|
1298
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1299
|
+
kind: z.ZodLiteral<"archive-unreadable">;
|
|
1300
|
+
commitSha: z.ZodString;
|
|
1301
|
+
message: z.ZodString;
|
|
1302
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1303
|
+
kind: z.ZodLiteral<"source-unavailable">;
|
|
1304
|
+
moduleFilePath: z.ZodString;
|
|
1305
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1306
|
+
kind: z.ZodLiteral<"schema-unreadable">;
|
|
1307
|
+
moduleFilePath: z.ZodString;
|
|
1308
|
+
message: z.ZodString;
|
|
1309
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1310
|
+
kind: z.ZodLiteral<"file-unavailable">;
|
|
1311
|
+
gitPath: z.ZodString;
|
|
1312
|
+
message: z.ZodString;
|
|
1313
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1314
|
+
kind: z.ZodLiteral<"not-supported-in-fs-mode">;
|
|
1315
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1316
|
+
kind: z.ZodLiteral<"transport">;
|
|
1317
|
+
message: z.ZodString;
|
|
1318
|
+
}, z.core.$strip>], "kind">>;
|
|
1319
|
+
}, z.core.$strip>>;
|
|
1320
|
+
}, z.core.$strip>;
|
|
1321
|
+
}, z.core.$strip>]>;
|
|
1322
|
+
};
|
|
1323
|
+
};
|
|
1324
|
+
/**
|
|
1325
|
+
* One file as it was at one commit.
|
|
1326
|
+
*
|
|
1327
|
+
* The lazy half: `/history/commit` NAMES a commit's binary files and this is
|
|
1328
|
+
* where their bytes come from, so nothing is fetched until an `<img>`
|
|
1329
|
+
* actually mounts. A file at a fixed commit cannot change, so the response is
|
|
1330
|
+
* immutable and the browser's own cache handles flipping between commits.
|
|
1331
|
+
*/
|
|
1332
|
+
"/history/files": {
|
|
1333
|
+
GET: {
|
|
1334
|
+
req: {
|
|
1335
|
+
query: {
|
|
1336
|
+
commit_sha: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>;
|
|
1337
|
+
path: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>;
|
|
1338
|
+
remote: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>>;
|
|
1339
|
+
};
|
|
1340
|
+
};
|
|
1341
|
+
res: z.ZodUnion<readonly [z.ZodObject<{
|
|
1342
|
+
status: z.ZodLiteral<401>;
|
|
1343
|
+
json: z.ZodObject<{
|
|
1344
|
+
message: z.ZodString;
|
|
1345
|
+
}, z.core.$strip>;
|
|
1346
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1347
|
+
status: z.ZodLiteral<404>;
|
|
1348
|
+
json: z.ZodObject<{
|
|
1349
|
+
message: z.ZodString;
|
|
1350
|
+
}, z.core.$strip>;
|
|
1351
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1352
|
+
status: z.ZodLiteral<400>;
|
|
1353
|
+
json: z.ZodObject<{
|
|
1354
|
+
message: z.ZodString;
|
|
1355
|
+
}, z.core.$strip>;
|
|
1356
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1357
|
+
status: z.ZodLiteral<200>;
|
|
1358
|
+
body: z.ZodCustom<import("node:stream/web").ReadableStream<unknown>, import("node:stream/web").ReadableStream<unknown>>;
|
|
1359
|
+
}, z.core.$strip>]>;
|
|
1360
|
+
};
|
|
1361
|
+
};
|
|
1099
1362
|
"/files": {
|
|
1100
1363
|
GET: {
|
|
1101
1364
|
req: {
|
|
@@ -3,11 +3,13 @@ export * from "./server/types.js";
|
|
|
3
3
|
export * from "./ValClient.js";
|
|
4
4
|
export * from "./ValUrls.js";
|
|
5
5
|
export * from "./ApiRoutes.js";
|
|
6
|
+
export * from "./schema/compatibility.js";
|
|
6
7
|
export * from "./newestCommitSha.js";
|
|
7
8
|
export * from "./zod/Patch.js";
|
|
8
9
|
export * from "./sessionStorage.js";
|
|
9
10
|
export * from "./SharedValConfig.js";
|
|
10
11
|
export * from "./zod/ValCommit.js";
|
|
12
|
+
export * from "./zod/History.js";
|
|
11
13
|
export * from "./zod/ValDeployment.js";
|
|
12
14
|
export * from "./getSitemapTree.js";
|
|
13
15
|
export * from "./parseRoutePattern.js";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Json, SerializedSchema } from "@valbuild/core";
|
|
2
|
+
/**
|
|
3
|
+
* Can this value, taken from one schema, be written into another?
|
|
4
|
+
*
|
|
5
|
+
* The question restore asks, and it is NOT the question validation asks.
|
|
6
|
+
* Validation checks a value against the schema it belongs to. This compares two
|
|
7
|
+
* schemas — the one a value was stored under and the one it is being written
|
|
8
|
+
* into — because a restore moves a value across a schema change, and possibly
|
|
9
|
+
* across paths.
|
|
10
|
+
*
|
|
11
|
+
* Three answers, not two. `unknown` is where the comparison genuinely cannot
|
|
12
|
+
* decide, and it exists so that an editor is told "we are not sure" rather than
|
|
13
|
+
* being given a confident answer we made up. Treating unknown as compatible
|
|
14
|
+
* writes values that break; treating it as incompatible blocks restores that
|
|
15
|
+
* would have been fine.
|
|
16
|
+
*/
|
|
17
|
+
export type Compatibility = {
|
|
18
|
+
status: "compatible";
|
|
19
|
+
} | {
|
|
20
|
+
status: "incompatible";
|
|
21
|
+
reason: IncompatibleReason;
|
|
22
|
+
} | {
|
|
23
|
+
status: "unknown";
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
export type IncompatibleReason = {
|
|
27
|
+
kind: "type-changed";
|
|
28
|
+
from: string;
|
|
29
|
+
to: string;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "no-matching-variant";
|
|
32
|
+
variants: string[];
|
|
33
|
+
} | {
|
|
34
|
+
kind: "unknown-field";
|
|
35
|
+
keys: string[];
|
|
36
|
+
} | {
|
|
37
|
+
kind: "missing-required";
|
|
38
|
+
keys: string[];
|
|
39
|
+
} | {
|
|
40
|
+
kind: "not-optional";
|
|
41
|
+
} | {
|
|
42
|
+
kind: "literal-changed";
|
|
43
|
+
from: string;
|
|
44
|
+
to: string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: "different-module";
|
|
47
|
+
from: string;
|
|
48
|
+
to: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* A sentence an editor can act on, for the popup that explains a refusal.
|
|
52
|
+
*
|
|
53
|
+
* Kept beside the reasons rather than in the UI so that adding a reason without
|
|
54
|
+
* wording for it is a type error rather than a blank dialog.
|
|
55
|
+
*/
|
|
56
|
+
export declare function explainIncompatible(reason: IncompatibleReason): string;
|
|
57
|
+
export declare function checkCompatibility(from: {
|
|
58
|
+
schema: SerializedSchema;
|
|
59
|
+
value: Json;
|
|
60
|
+
}, to: {
|
|
61
|
+
schema: SerializedSchema;
|
|
62
|
+
}): Compatibility;
|