@valbuild/shared 0.138.2 → 0.139.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 CHANGED
@@ -1,5 +1,55 @@
1
1
  # @valbuild/shared
2
2
 
3
+ ## 0.139.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#776](https://github.com/valbuild/val/pull/776) [`3eb5031`](https://github.com/valbuild/val/commit/3eb503167ae466ee586303c95efcc14665129481) Thanks [@freekh](https://github.com/freekh)! - **Breaking:** `.render({ as: "inline" })` now goes on the list, not on its items.
8
+
9
+ You now write `s.array(item).render({ as: "inline" })` and `s.record(item).render({ as: "inline" })`. Each item is then edited in its own row instead of in a preview row you click into. The list decides. The item schema stays reusable, and a page builder made of tagged blocks needs nothing on each block:
10
+
11
+ ```ts
12
+ // before
13
+ s.array(
14
+ s.discriminatedUnion(
15
+ "type",
16
+ hero.render({ as: "inline" }),
17
+ text.render({ as: "inline" }),
18
+ ),
19
+ );
20
+
21
+ // after
22
+ s.array(s.discriminatedUnion("type", hero, text)).render({ as: "inline" });
23
+ ```
24
+
25
+ What changed:
26
+
27
+ - Only `s.array()`, `s.record()` and `s.keyOf()` have `.render(...)` now. On every other schema the method is gone, so the old placement shows up as a type error. Move the render out one level.
28
+ - The render only affects the list's own items. A list nested inside one of those items keeps its default unless it has its own `.render`.
29
+ - `s.router()`, `s.imageset()` and `s.fileset()` throw if you give them a render, because pages and media have their own editors.
30
+ - `s.keyOf(...).render({ as: "inline" })` means the same as before: the selected entry's content is shown below the dropdown.
31
+
32
+ **Watch for one case that still compiles:** an array or record that is itself the item of another list. `s.record(s.array(s.string()).render({ as: "inline" }))` used to show the record's arrays inline. Now it shows each array's strings inline. To keep the old layout, write `s.record(s.array(s.string())).render({ as: "inline" })`.
33
+
34
+ ### Patch Changes
35
+
36
+ - Updated dependencies [[`3eb5031`](https://github.com/valbuild/val/commit/3eb503167ae466ee586303c95efcc14665129481)]:
37
+ - @valbuild/core@0.139.0
38
+
39
+ ## 0.138.4
40
+
41
+ ### Patch Changes
42
+
43
+ - [#770](https://github.com/valbuild/val/pull/770) [`0a885b1`](https://github.com/valbuild/val/commit/0a885b1f0304517b167b959958464066194732d0) Thanks [@freekh](https://github.com/freekh)! - Publishing a Git-connected app-mode project now puts your changes on the site in seconds, instead of waiting for CI.
44
+
45
+ - The Studio builds the site in the browser, the same way it does for a managed project. Val pushes the commit to your repository as before. When nothing but content has changed since the build the site is serving, the browser's build goes live right away. If a developer has pushed code in between, the site waits for CI's build, so their code is never taken off the site.
46
+ - If the browser cannot build, the publish still goes through and CI delivers it. This happens when the page is not cross-origin isolated, or when the build keeps failing. Your changes stay visible in the Studio until the site serves a build that has them.
47
+ - Content that would break a page is caught before anything is pushed to your repository.
48
+
49
+ - [#771](https://github.com/valbuild/val/pull/771) [`58d13a2`](https://github.com/valbuild/val/commit/58d13a2a534421b341b1bf71d02f0a2290fc0d61) Thanks [@freekh](https://github.com/freekh)! - A project created on val.build with a GitHub repository can publish right away. Before, the first publish was refused with "this deployment was not built from one" until the repository's first CI build had finished.
50
+
51
+ While that first build runs, the site is served the template's build. When you publish from it, Val now checks that its content files are exactly the same as the files in your repository. If they are, the publish goes ahead and is pushed to your repository straight away. Your changes stay visible in the Studio until the site serves CI's build of them. If the files differ, the publish is refused, as before.
52
+
3
53
  ## 0.138.2
4
54
 
5
55
  ### Patch Changes
@@ -1134,6 +1134,7 @@ export declare const Api: {
1134
1134
  binaryFiles: z.ZodRecord<z.ZodString, z.ZodString>;
1135
1135
  binaryFilesUnread: z.ZodArray<z.ZodString>;
1136
1136
  branch: z.ZodNullable<z.ZodString>;
1137
+ buildable: z.ZodOptional<z.ZodBoolean>;
1137
1138
  }, z.core.$strip>;
1138
1139
  }, z.core.$strip>]>;
1139
1140
  };
@@ -296,6 +296,20 @@ export type ContentPublishApi = {
296
296
  * branch whose tip is that commit has nothing it has not seen.
297
297
  */
298
298
  gitCommit?: string;
299
+ /**
300
+ * Connected: the tab can build this job (the deployment embeds its
301
+ * source). Without it, content goes on to the seal with no build and
302
+ * CI builds the push -- which is what a server that predates tab
303
+ * builds gets, since it never says so.
304
+ */
305
+ tabBuilds?: true;
306
+ /**
307
+ * Connected, a deployment built from no commit: its Val source files
308
+ * (modules and `val.modules.*`), by path from the project root, as git
309
+ * blob shas. The content service compares them with the branch when
310
+ * there is no commit to compare from.
311
+ */
312
+ deploymentFiles?: Record<string, string>;
299
313
  };
300
314
  res: {
301
315
  job: PublishTabJob | null;
@@ -310,6 +324,12 @@ export type ContentPublishApi = {
310
324
  ok: boolean;
311
325
  /** A finished build step: the id of the publish (`POST /publish`) it declared. */
312
326
  build?: string;
327
+ /**
328
+ * Connected, at `build`, instead of `build`: this tab cannot build
329
+ * (no cross-origin isolation, or a deployment that embeds no source).
330
+ * The job goes on without one, and CI builds the push.
331
+ */
332
+ noBuild?: true;
313
333
  /**
314
334
  * A failed step: why, in the tab's words. The step is still retried;
315
335
  * if it fails for good, this is what the editor is told.
@@ -86,9 +86,6 @@ export declare const SerializedSettingsSchema: z.ZodType<SerializedSettingsSchem
86
86
  */
87
87
  export declare const SerializedValViewSchema: z.ZodObject<{
88
88
  type: z.ZodLiteral<"view">;
89
- render: z.ZodOptional<z.ZodOptional<z.ZodObject<{
90
- as: z.ZodLiteral<"inline">;
91
- }, z.core.$strip>>>;
92
89
  moduleFilePath: z.ZodType<import("@valbuild/core").ModuleFilePath, unknown, z.core.$ZodTypeInternals<import("@valbuild/core").ModuleFilePath, unknown>>;
93
90
  opt: z.ZodLiteral<false>;
94
91
  readonly: z.ZodOptional<z.ZodBoolean>;
@@ -987,7 +987,8 @@ var _excluded = ["directory"];
987
987
 
988
988
  // A render is static config, so unlike a `preview` it travels WHOLE — this
989
989
  // is the field the editor reads the layout from. See `core/src/render.ts`.
990
- // Every field can carry `{ as: "inline" }`, and that is all a render says.
990
+ // Only array, record and keyOf carry one, and `{ as: "inline" }` is all it
991
+ // says. A stale `render` on any other schema is stripped here, harmlessly.
991
992
  // NB: these z.objects STRIP unknown keys, so a render variant that is not
992
993
  // declared here is silently dropped in transit — add it here when it is added
993
994
  // to `render.ts`.
@@ -1009,7 +1010,6 @@ var FieldRender = InlineRender.optional();
1009
1010
  * - those differ per schema, so there is nothing to share.
1010
1011
  */
1011
1012
  var commonSchemaFields = {
1012
- render: FieldRender,
1013
1013
  preview: zod.z.literal(true).optional(),
1014
1014
  // Whether the schema declares a `.validate()`. The function cannot serialize,
1015
1015
  // so this flag is what tells the Studio to run the custom validators on the
@@ -1068,6 +1068,7 @@ var SerializedObjectSchema = zod.z.lazy(function () {
1068
1068
  });
1069
1069
  var SerializedArraySchema = zod.z.lazy(function () {
1070
1070
  return zod.z.object(getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, commonSchemaFields), {}, {
1071
+ render: FieldRender,
1071
1072
  type: zod.z.literal("array"),
1072
1073
  item: SerializedSchema,
1073
1074
  opt: zod.z["boolean"]()
@@ -1160,6 +1161,7 @@ var SerializedRichTextSchema = zod.z.object(getSitemapTree._objectSpread2(getSit
1160
1161
  }));
1161
1162
  var SerializedRecordSchema = zod.z.lazy(function () {
1162
1163
  return zod.z.preprocess(readLegacyDirectoryAsDir, zod.z.object(getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, commonSchemaFields), {}, {
1164
+ render: FieldRender,
1163
1165
  type: zod.z.literal("record"),
1164
1166
  item: SerializedSchema,
1165
1167
  opt: zod.z["boolean"](),
@@ -1176,6 +1178,7 @@ var SerializedRecordSchema = zod.z.lazy(function () {
1176
1178
  });
1177
1179
  var SerializedKeyOfSchema = zod.z.lazy(function () {
1178
1180
  return zod.z.object(getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, commonSchemaFields), {}, {
1181
+ render: FieldRender,
1179
1182
  type: zod.z.literal("keyOf"),
1180
1183
  path: SourcePath,
1181
1184
  schema: zod.z.union([zod.z.object({
@@ -1235,7 +1238,6 @@ var SerializedCodeSchema = zod.z.object(getSitemapTree._objectSpread2(getSitemap
1235
1238
  }));
1236
1239
  var SerializedLocaleSchema = zod.z.object({
1237
1240
  type: zod.z.literal("locale"),
1238
- render: FieldRender,
1239
1241
  preview: zod.z.literal(true).optional(),
1240
1242
  opt: zod.z["boolean"](),
1241
1243
  customValidate: zod.z["boolean"]().optional(),
@@ -1261,7 +1263,7 @@ var SerializedRouteSchema = zod.z.object(getSitemapTree._objectSpread2(getSitema
1261
1263
 
1262
1264
  // A settings module, and each section inside one, serialize as this - the
1263
1265
  // shape is recursive because `items` holds sections which are themselves
1264
- // settings schemas. `s.settings()` never writes render/preview/customValidate
1266
+ // settings schemas. `s.settings()` never writes preview/customValidate
1265
1267
  // (see core/src/schema/settings.ts), but they are accepted here because they
1266
1268
  // are part of the declared type.
1267
1269
  var SerializedSettingsSchema = zod.z.lazy(function () {
@@ -1287,7 +1289,6 @@ var SerializedSettingsSchema = zod.z.lazy(function () {
1287
1289
  */
1288
1290
  var SerializedValViewSchema = zod.z.object({
1289
1291
  type: zod.z.literal("view"),
1290
- render: FieldRender.optional(),
1291
1292
  moduleFilePath: ModuleFilePath$1,
1292
1293
  opt: zod.z.literal(false),
1293
1294
  readonly: zod.z["boolean"]().optional(),
@@ -2657,7 +2658,14 @@ var Api = {
2657
2658
  /** Binary files whose bytes could not be read back. */
2658
2659
  binaryFilesUnread: zod.z.array(zod.z.string()),
2659
2660
  /** The branch the job publishes to. */
2660
- branch: zod.z.string().nullable()
2661
+ branch: zod.z.string().nullable(),
2662
+ /**
2663
+ * Can the tab build the job from `sourceFiles`? False for a
2664
+ * connected deployment that embeds no source: the tab reports
2665
+ * "no build", and CI builds the push. Absent from older servers,
2666
+ * which only answered buildable jobs.
2667
+ */
2668
+ buildable: zod.z["boolean"]().optional()
2661
2669
  })
2662
2670
  })])
2663
2671
  }
@@ -987,7 +987,8 @@ var _excluded = ["directory"];
987
987
 
988
988
  // A render is static config, so unlike a `preview` it travels WHOLE — this
989
989
  // is the field the editor reads the layout from. See `core/src/render.ts`.
990
- // Every field can carry `{ as: "inline" }`, and that is all a render says.
990
+ // Only array, record and keyOf carry one, and `{ as: "inline" }` is all it
991
+ // says. A stale `render` on any other schema is stripped here, harmlessly.
991
992
  // NB: these z.objects STRIP unknown keys, so a render variant that is not
992
993
  // declared here is silently dropped in transit — add it here when it is added
993
994
  // to `render.ts`.
@@ -1009,7 +1010,6 @@ var FieldRender = InlineRender.optional();
1009
1010
  * - those differ per schema, so there is nothing to share.
1010
1011
  */
1011
1012
  var commonSchemaFields = {
1012
- render: FieldRender,
1013
1013
  preview: zod.z.literal(true).optional(),
1014
1014
  // Whether the schema declares a `.validate()`. The function cannot serialize,
1015
1015
  // so this flag is what tells the Studio to run the custom validators on the
@@ -1068,6 +1068,7 @@ var SerializedObjectSchema = zod.z.lazy(function () {
1068
1068
  });
1069
1069
  var SerializedArraySchema = zod.z.lazy(function () {
1070
1070
  return zod.z.object(getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, commonSchemaFields), {}, {
1071
+ render: FieldRender,
1071
1072
  type: zod.z.literal("array"),
1072
1073
  item: SerializedSchema,
1073
1074
  opt: zod.z["boolean"]()
@@ -1160,6 +1161,7 @@ var SerializedRichTextSchema = zod.z.object(getSitemapTree._objectSpread2(getSit
1160
1161
  }));
1161
1162
  var SerializedRecordSchema = zod.z.lazy(function () {
1162
1163
  return zod.z.preprocess(readLegacyDirectoryAsDir, zod.z.object(getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, commonSchemaFields), {}, {
1164
+ render: FieldRender,
1163
1165
  type: zod.z.literal("record"),
1164
1166
  item: SerializedSchema,
1165
1167
  opt: zod.z["boolean"](),
@@ -1176,6 +1178,7 @@ var SerializedRecordSchema = zod.z.lazy(function () {
1176
1178
  });
1177
1179
  var SerializedKeyOfSchema = zod.z.lazy(function () {
1178
1180
  return zod.z.object(getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, commonSchemaFields), {}, {
1181
+ render: FieldRender,
1179
1182
  type: zod.z.literal("keyOf"),
1180
1183
  path: SourcePath,
1181
1184
  schema: zod.z.union([zod.z.object({
@@ -1235,7 +1238,6 @@ var SerializedCodeSchema = zod.z.object(getSitemapTree._objectSpread2(getSitemap
1235
1238
  }));
1236
1239
  var SerializedLocaleSchema = zod.z.object({
1237
1240
  type: zod.z.literal("locale"),
1238
- render: FieldRender,
1239
1241
  preview: zod.z.literal(true).optional(),
1240
1242
  opt: zod.z["boolean"](),
1241
1243
  customValidate: zod.z["boolean"]().optional(),
@@ -1261,7 +1263,7 @@ var SerializedRouteSchema = zod.z.object(getSitemapTree._objectSpread2(getSitema
1261
1263
 
1262
1264
  // A settings module, and each section inside one, serialize as this - the
1263
1265
  // shape is recursive because `items` holds sections which are themselves
1264
- // settings schemas. `s.settings()` never writes render/preview/customValidate
1266
+ // settings schemas. `s.settings()` never writes preview/customValidate
1265
1267
  // (see core/src/schema/settings.ts), but they are accepted here because they
1266
1268
  // are part of the declared type.
1267
1269
  var SerializedSettingsSchema = zod.z.lazy(function () {
@@ -1287,7 +1289,6 @@ var SerializedSettingsSchema = zod.z.lazy(function () {
1287
1289
  */
1288
1290
  var SerializedValViewSchema = zod.z.object({
1289
1291
  type: zod.z.literal("view"),
1290
- render: FieldRender.optional(),
1291
1292
  moduleFilePath: ModuleFilePath$1,
1292
1293
  opt: zod.z.literal(false),
1293
1294
  readonly: zod.z["boolean"]().optional(),
@@ -2657,7 +2658,14 @@ var Api = {
2657
2658
  /** Binary files whose bytes could not be read back. */
2658
2659
  binaryFilesUnread: zod.z.array(zod.z.string()),
2659
2660
  /** The branch the job publishes to. */
2660
- branch: zod.z.string().nullable()
2661
+ branch: zod.z.string().nullable(),
2662
+ /**
2663
+ * Can the tab build the job from `sourceFiles`? False for a
2664
+ * connected deployment that embeds no source: the tab reports
2665
+ * "no build", and CI builds the push. Absent from older servers,
2666
+ * which only answered buildable jobs.
2667
+ */
2668
+ buildable: zod.z["boolean"]().optional()
2661
2669
  })
2662
2670
  })])
2663
2671
  }
@@ -980,7 +980,8 @@ var _excluded = ["directory"];
980
980
 
981
981
  // A render is static config, so unlike a `preview` it travels WHOLE — this
982
982
  // is the field the editor reads the layout from. See `core/src/render.ts`.
983
- // Every field can carry `{ as: "inline" }`, and that is all a render says.
983
+ // Only array, record and keyOf carry one, and `{ as: "inline" }` is all it
984
+ // says. A stale `render` on any other schema is stripped here, harmlessly.
984
985
  // NB: these z.objects STRIP unknown keys, so a render variant that is not
985
986
  // declared here is silently dropped in transit — add it here when it is added
986
987
  // to `render.ts`.
@@ -1002,7 +1003,6 @@ var FieldRender = InlineRender.optional();
1002
1003
  * - those differ per schema, so there is nothing to share.
1003
1004
  */
1004
1005
  var commonSchemaFields = {
1005
- render: FieldRender,
1006
1006
  preview: z.literal(true).optional(),
1007
1007
  // Whether the schema declares a `.validate()`. The function cannot serialize,
1008
1008
  // so this flag is what tells the Studio to run the custom validators on the
@@ -1061,6 +1061,7 @@ var SerializedObjectSchema = z.lazy(function () {
1061
1061
  });
1062
1062
  var SerializedArraySchema = z.lazy(function () {
1063
1063
  return z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
1064
+ render: FieldRender,
1064
1065
  type: z.literal("array"),
1065
1066
  item: SerializedSchema,
1066
1067
  opt: z["boolean"]()
@@ -1153,6 +1154,7 @@ var SerializedRichTextSchema = z.object(_objectSpread2(_objectSpread2({}, common
1153
1154
  }));
1154
1155
  var SerializedRecordSchema = z.lazy(function () {
1155
1156
  return z.preprocess(readLegacyDirectoryAsDir, z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
1157
+ render: FieldRender,
1156
1158
  type: z.literal("record"),
1157
1159
  item: SerializedSchema,
1158
1160
  opt: z["boolean"](),
@@ -1169,6 +1171,7 @@ var SerializedRecordSchema = z.lazy(function () {
1169
1171
  });
1170
1172
  var SerializedKeyOfSchema = z.lazy(function () {
1171
1173
  return z.object(_objectSpread2(_objectSpread2({}, commonSchemaFields), {}, {
1174
+ render: FieldRender,
1172
1175
  type: z.literal("keyOf"),
1173
1176
  path: SourcePath,
1174
1177
  schema: z.union([z.object({
@@ -1228,7 +1231,6 @@ var SerializedCodeSchema = z.object(_objectSpread2(_objectSpread2({}, commonSche
1228
1231
  }));
1229
1232
  var SerializedLocaleSchema = z.object({
1230
1233
  type: z.literal("locale"),
1231
- render: FieldRender,
1232
1234
  preview: z.literal(true).optional(),
1233
1235
  opt: z["boolean"](),
1234
1236
  customValidate: z["boolean"]().optional(),
@@ -1254,7 +1256,7 @@ var SerializedRouteSchema = z.object(_objectSpread2(_objectSpread2({}, commonSch
1254
1256
 
1255
1257
  // A settings module, and each section inside one, serialize as this - the
1256
1258
  // shape is recursive because `items` holds sections which are themselves
1257
- // settings schemas. `s.settings()` never writes render/preview/customValidate
1259
+ // settings schemas. `s.settings()` never writes preview/customValidate
1258
1260
  // (see core/src/schema/settings.ts), but they are accepted here because they
1259
1261
  // are part of the declared type.
1260
1262
  var SerializedSettingsSchema = z.lazy(function () {
@@ -1280,7 +1282,6 @@ var SerializedSettingsSchema = z.lazy(function () {
1280
1282
  */
1281
1283
  var SerializedValViewSchema = z.object({
1282
1284
  type: z.literal("view"),
1283
- render: FieldRender.optional(),
1284
1285
  moduleFilePath: ModuleFilePath$1,
1285
1286
  opt: z.literal(false),
1286
1287
  readonly: z["boolean"]().optional(),
@@ -2650,7 +2651,14 @@ var Api = {
2650
2651
  /** Binary files whose bytes could not be read back. */
2651
2652
  binaryFilesUnread: z.array(z.string()),
2652
2653
  /** The branch the job publishes to. */
2653
- branch: z.string().nullable()
2654
+ branch: z.string().nullable(),
2655
+ /**
2656
+ * Can the tab build the job from `sourceFiles`? False for a
2657
+ * connected deployment that embeds no source: the tab reports
2658
+ * "no build", and CI builds the push. Absent from older servers,
2659
+ * which only answered buildable jobs.
2660
+ */
2661
+ buildable: z["boolean"]().optional()
2654
2662
  })
2655
2663
  })])
2656
2664
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/shared",
3
- "version": "0.138.2",
3
+ "version": "0.139.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.138.2"
40
+ "@valbuild/core": "0.139.0"
41
41
  },
42
42
  "files": [
43
43
  "CHANGELOG.md",