@valbuild/core 0.150.3 → 0.153.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,66 @@
1
1
  # @valbuild/core
2
2
 
3
+ ## 0.153.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1023](https://github.com/valbuild/val/pull/1023) [`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41) Thanks [@freekh](https://github.com/freekh)! - The assistant can search the web, if you turn it on.
8
+
9
+ Settings → Assistant has a new switch, **Search the web**. It is off unless someone turns it on (`assistant.webSearch: true` in `settings.val.ts`). When it is on, the assistant can look things up online with your AI provider's own search, and each search is billed to your project's AI key. You can see each search in the chat.
10
+
11
+ Web pages can contain instructions written for AI assistants, so after the assistant has searched the web, it asks you before it changes the site's code or builds it. The question comes from Val, not from the assistant. Content edits are not affected: they stay drafts you can review and revert, as before.
12
+
13
+ Needs a Val Build version with web search. With an older one, nothing changes.
14
+
15
+ ## 0.151.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#1006](https://github.com/valbuild/val/pull/1006) [`3aff85e`](https://github.com/valbuild/val/commit/3aff85e9a40cb0879285b86fd41fa8167db1bb5e) Thanks [@freekh](https://github.com/freekh)! - **A JSON Patch `test` op now fails when it does not hold.** A `test` op is a
20
+ precondition: "only apply this patch if the value at this path is still
21
+ this". Val used to accept every `test` op without checking it, so a patch
22
+ that should have been refused was applied anyway.
23
+
24
+ Now a `test` op fails its patch when the path does not exist, or when the
25
+ value there is not deeply equal to the one given (objects and arrays are
26
+ compared all the way down, and `0`, `""`, `false` and `null` are all
27
+ different from each other). The ops after it are not applied. This holds in
28
+ every place Val applies a patch -- the Studio's drafts, a draft page, the
29
+ content tools for MCP, and Publish -- so a patch a draft shows is a patch
30
+ Publish accepts.
31
+
32
+ Nothing in the Studio, the CLI or the content tools writes `test` ops of
33
+ its own, so this only changes anything for a patch you, or an agent through
34
+ the MCP `create_patch` tool, wrote with a `test` op in it: one whose test
35
+ does not hold is now refused with `Test failed` (or, for a path that does
36
+ not exist, `Path refers to non-existing object/array`) instead of applied.
37
+
38
+ ### Patch Changes
39
+
40
+ - [#1006](https://github.com/valbuild/val/pull/1006) [`a325152`](https://github.com/valbuild/val/commit/a325152856a881faec84c112fcf226828739f563) Thanks [@freekh](https://github.com/freekh)! - **A draft page shows the right `.jsonValues()` entries, whichever reader reads them.**
41
+
42
+ - **Pending edits to an entry.** In draft mode, `fetchVal` of a whole
43
+ `.jsonValues()` record now shows the unpublished edits to its entries. It
44
+ used to show the published content of every entry, even one an editor had
45
+ just changed, while `fetchValKey` and `fetchValRoute` of the same entry
46
+ showed the edit. The entries a pending change touches are read from Val's
47
+ server; the others are loaded from your build, as before.
48
+ - **Entries published without a rebuild.** On a host that does not rebuild
49
+ the site after a publish, a draft page now shows the published entries
50
+ straight away -- in `fetchVal`, and in `useVal`, `useValKey` and
51
+ `useValRoute` alike. They used to show those entries as they were before
52
+ the publish, from the site's build, until it was rebuilt (and on TanStack
53
+ Start the server render showed the new content, then the page switched
54
+ back to the old). Val's server marks each entry a publish wrote, and the
55
+ readers and the Studio load a marked entry from the server.
56
+
57
+ - [#1006](https://github.com/valbuild/val/pull/1006) [`f5110c9`](https://github.com/valbuild/val/commit/f5110c9aa2a0a6ff0586e9f0f2a29eb1baef557d) Thanks [@freekh](https://github.com/freekh)! - A field that picks an image, file or video from a library (`s.image(imagesVal)`,
58
+ `s.file(filesVal)`, `s.video(videosVal)`) now gets the right url on a draft page
59
+ when the file was uploaded in an unpublished change. The server-rendered page
60
+ used to name the file at its published url, where nothing exists until the
61
+ change is published, so the image or video was broken until the Studio's
62
+ preview replaced it.
63
+
3
64
  ## 0.150.3
4
65
 
5
66
  ### Patch Changes
@@ -43,7 +43,7 @@ import { initSchema } from "./initSchema.js";
43
43
  import { getMimeType, mimeTypeToFileExt, filenameToMimeType, mimeTypeMatchesAccept, isFontMimeType, sniffFontMimeType } from "./mimeType/index.js";
44
44
  import { type ImageMetadata } from "./schema/image.js";
45
45
  import { type FileMetadata } from "./schema/file.js";
46
- import { isJson, getJsonImport, resolveJsonValues } from "./source/json.js";
46
+ import { isJson, isJsonFromServer, getJsonImport, resolveJsonValues } from "./source/json.js";
47
47
  import { isExternal, hasInlineExternalEntries } from "./source/external.js";
48
48
  import { createExternalFileRef, splitExternalFileRef, isExternalFileRef } from "./source/externalRef.js";
49
49
  import { createRemoteRef } from "./source/remote.js";
@@ -213,6 +213,7 @@ declare const Internal: {
213
213
  validate: (val: ValModule<SelectorSource>, path: SourcePath, src: unknown) => import("./index.js").ValidationErrors | undefined;
214
214
  isVal: typeof isVal;
215
215
  isJson: typeof isJson;
216
+ isJsonFromServer: typeof isJsonFromServer;
216
217
  getJsonImport: typeof getJsonImport;
217
218
  resolveJsonValues: typeof resolveJsonValues;
218
219
  isExternal: typeof isExternal;
@@ -35,6 +35,17 @@ export type JsonSource<T = unknown> = {
35
35
  } & PhantomType<T>;
36
36
  export declare function json<T = Json>(importThunk: JsonImportThunk<T>): JsonSource<T>;
37
37
  export declare function isJson(obj: unknown): obj is JsonSource;
38
+ /**
39
+ * Whether this `.jsonValues()` entry's content has to be read from the server
40
+ * rather than from the bundle's `import()`: a marker carrying a `patch_id`.
41
+ *
42
+ * The server writes one for an entry a pending patch added or replaced, and
43
+ * for every entry a publish wrote (`adoptCommittedSources`), because a host
44
+ * that does not rebuild after a publish -- memory mode -- still has the
45
+ * content from before it in the bundle. A marker without one is the bundle's
46
+ * entry, and any reader may fill it from there.
47
+ */
48
+ export declare function isJsonFromServer(obj: unknown): boolean;
38
49
  /**
39
50
  * Reads the runtime-only lazy import thunk from a {@link JsonSource}. Returns
40
51
  * `undefined` for a transport marker (sent over the wire without the thunk).
@@ -289,6 +289,11 @@ export declare function galleryEntryOf(src: {
289
289
  * - **The defaults** — description, focal point, a video's poster, start, end
290
290
  * and captions ({@link GALLERY_DEFAULT_GROUPS}). An editor sets them once
291
291
  * on the gallery entry; a field that sets its own wins, KEY BY KEY.
292
+ * - **Where an unpublished file is** — the `patch_id` Val's server stamps on
293
+ * a gallery entry whose file was uploaded in a pending change. The field
294
+ * names the same file by its path, so it is served by the same patch; with
295
+ * no `patch_id` the field's url was the published one, for a file that is
296
+ * not published yet. A field's own `patch_id` (its own upload) wins.
292
297
  *
293
298
  * The single implementation of that merge: core, stega/RSC and the Studio all
294
299
  * call it rather than each rolling their own, so a page and the Studio's
@@ -248,6 +248,16 @@ export type AssistantSettingsSource = {
248
248
  * field unset and nothing is required.
249
249
  */
250
250
  translation?: Record<string, string | null> | null;
251
+ /**
252
+ * Whether the assistant may search the web.
253
+ *
254
+ * Off unless someone turns it on: a search puts text a stranger wrote in
255
+ * front of a model that can change this project, and each search is billed
256
+ * to the project's own AI key. When it is on, a turn that has searched asks
257
+ * the editor before it changes any code (see `webSearchGate.ts` in the
258
+ * Studio, and `docs/plans/assistant-web-search.md` in valbuild/home).
259
+ */
260
+ webSearch?: boolean | null;
251
261
  };
252
262
  /**
253
263
  * The cap on each of the assistant's prose fields, in characters.
@@ -3283,6 +3283,11 @@ function galleryEntryOf(src, schema, getModuleSource) {
3283
3283
  * - **The defaults** — description, focal point, a video's poster, start, end
3284
3284
  * and captions ({@link GALLERY_DEFAULT_GROUPS}). An editor sets them once
3285
3285
  * on the gallery entry; a field that sets its own wins, KEY BY KEY.
3286
+ * - **Where an unpublished file is** — the `patch_id` Val's server stamps on
3287
+ * a gallery entry whose file was uploaded in a pending change. The field
3288
+ * names the same file by its path, so it is served by the same patch; with
3289
+ * no `patch_id` the field's url was the published one, for a file that is
3290
+ * not published yet. A field's own `patch_id` (its own upload) wins.
3286
3291
  *
3287
3292
  * The single implementation of that merge: core, stega/RSC and the Studio all
3288
3293
  * call it rather than each rolling their own, so a page and the Studio's
@@ -3313,6 +3318,9 @@ function fillFromGallery(src, schema, getModuleSource) {
3313
3318
  } finally {
3314
3319
  _iterator.f();
3315
3320
  }
3321
+ if (own.patch_id === undefined && typeof entry.patch_id === "string") {
3322
+ filled.patch_id = entry.patch_id;
3323
+ }
3316
3324
  var _iterator2 = result._createForOfIteratorHelper(GALLERY_DEFAULT_GROUPS),
3317
3325
  _step2;
3318
3326
  try {
@@ -5775,6 +5783,20 @@ function isJson(obj) {
5775
5783
  return _typeof(obj) === "object" && obj !== null && VAL_EXTENSION in obj && obj[VAL_EXTENSION] === JSON_VAL_EXTENSION_TAG;
5776
5784
  }
5777
5785
 
5786
+ /**
5787
+ * Whether this `.jsonValues()` entry's content has to be read from the server
5788
+ * rather than from the bundle's `import()`: a marker carrying a `patch_id`.
5789
+ *
5790
+ * The server writes one for an entry a pending patch added or replaced, and
5791
+ * for every entry a publish wrote (`adoptCommittedSources`), because a host
5792
+ * that does not rebuild after a publish -- memory mode -- still has the
5793
+ * content from before it in the bundle. A marker without one is the bundle's
5794
+ * entry, and any reader may fill it from there.
5795
+ */
5796
+ function isJsonFromServer(obj) {
5797
+ return isJson(obj) && typeof obj.patch_id === "string" && obj.patch_id.length > 0;
5798
+ }
5799
+
5778
5800
  /**
5779
5801
  * Reads the runtime-only lazy import thunk from a {@link JsonSource}. Returns
5780
5802
  * `undefined` for a transport marker (sent over the wire without the thunk).
@@ -10467,7 +10489,8 @@ function settings() {
10467
10489
  enabled: _boolean().nullable().describe("Whether editors have an assistant in this project. Unset means nobody has decided: it is offered, and turned on when someone accepts."),
10468
10490
  context: string().multiline().maxLength(ASSISTANT_SETTINGS_MAX_LENGTH).nullable().describe("Background the assistant would otherwise have to guess: what this site is, who runs it, names and spellings that matter."),
10469
10491
  tone: string().multiline().maxLength(ASSISTANT_SETTINGS_MAX_LENGTH).nullable().describe("How the assistant should write when it writes content: formal or playful, British or American, how headings are cased."),
10470
- translation: record(locale(), string().multiline().maxLength(ASSISTANT_SETTINGS_MAX_LENGTH).nullable()).nullable().describe("How to translate into each language: dialect, formality, and the words that stay untranslated.")
10492
+ translation: record(locale(), string().multiline().maxLength(ASSISTANT_SETTINGS_MAX_LENGTH).nullable()).nullable().describe("How to translate into each language: dialect, formality, and the words that stay untranslated."),
10493
+ webSearch: _boolean().nullable().describe("Whether the assistant may search the web. Off unless turned on. After a search it asks before changing code.")
10471
10494
  }),
10472
10495
  theme: new SettingsSchema({
10473
10496
  accent: color({
@@ -15536,7 +15559,9 @@ function computeValModuleShas(config, entries, moduleErrors) {
15536
15559
  var baseSha = configSha;
15537
15560
  // NOTE: schemaSha is deliberately NOT seeded with configSha. It is compared
15538
15561
  // across bundles (the server extracts from the Node bundle, the editor SPA
15539
- // from the browser bundle) to detect that a new version has been deployed.
15562
+ // from the browser bundle) to detect that a new version has been deployed --
15563
+ // by a Studio of the release before phase 9's; today's compares each
15564
+ // module's schema version on the manifest, which has the same constraint.
15540
15565
  // The config contains values that are not part of the schema and that differ
15541
15566
  // between those two bundles - most notably the documented
15542
15567
  // `gitCommit: process.env.VERCEL_GIT_COMMIT_SHA` / `gitBranch`, which are
@@ -16979,7 +17004,7 @@ function isInlineRender(container) {
16979
17004
 
16980
17005
  var corePackageJson = {
16981
17006
  name: "@valbuild/core",
16982
- version: "0.150.3",
17007
+ version: "0.153.0",
16983
17008
  "private": false,
16984
17009
  description: "Val - supercharged hard-coded content",
16985
17010
  repository: {
@@ -17140,6 +17165,7 @@ var Internal = {
17140
17165
  },
17141
17166
  isVal: isVal,
17142
17167
  isJson: isJson,
17168
+ isJsonFromServer: isJsonFromServer,
17143
17169
  getJsonImport: getJsonImport,
17144
17170
  resolveJsonValues: resolveJsonValues,
17145
17171
  isExternal: isExternal,
@@ -3283,6 +3283,11 @@ function galleryEntryOf(src, schema, getModuleSource) {
3283
3283
  * - **The defaults** — description, focal point, a video's poster, start, end
3284
3284
  * and captions ({@link GALLERY_DEFAULT_GROUPS}). An editor sets them once
3285
3285
  * on the gallery entry; a field that sets its own wins, KEY BY KEY.
3286
+ * - **Where an unpublished file is** — the `patch_id` Val's server stamps on
3287
+ * a gallery entry whose file was uploaded in a pending change. The field
3288
+ * names the same file by its path, so it is served by the same patch; with
3289
+ * no `patch_id` the field's url was the published one, for a file that is
3290
+ * not published yet. A field's own `patch_id` (its own upload) wins.
3286
3291
  *
3287
3292
  * The single implementation of that merge: core, stega/RSC and the Studio all
3288
3293
  * call it rather than each rolling their own, so a page and the Studio's
@@ -3313,6 +3318,9 @@ function fillFromGallery(src, schema, getModuleSource) {
3313
3318
  } finally {
3314
3319
  _iterator.f();
3315
3320
  }
3321
+ if (own.patch_id === undefined && typeof entry.patch_id === "string") {
3322
+ filled.patch_id = entry.patch_id;
3323
+ }
3316
3324
  var _iterator2 = result._createForOfIteratorHelper(GALLERY_DEFAULT_GROUPS),
3317
3325
  _step2;
3318
3326
  try {
@@ -5775,6 +5783,20 @@ function isJson(obj) {
5775
5783
  return _typeof(obj) === "object" && obj !== null && VAL_EXTENSION in obj && obj[VAL_EXTENSION] === JSON_VAL_EXTENSION_TAG;
5776
5784
  }
5777
5785
 
5786
+ /**
5787
+ * Whether this `.jsonValues()` entry's content has to be read from the server
5788
+ * rather than from the bundle's `import()`: a marker carrying a `patch_id`.
5789
+ *
5790
+ * The server writes one for an entry a pending patch added or replaced, and
5791
+ * for every entry a publish wrote (`adoptCommittedSources`), because a host
5792
+ * that does not rebuild after a publish -- memory mode -- still has the
5793
+ * content from before it in the bundle. A marker without one is the bundle's
5794
+ * entry, and any reader may fill it from there.
5795
+ */
5796
+ function isJsonFromServer(obj) {
5797
+ return isJson(obj) && typeof obj.patch_id === "string" && obj.patch_id.length > 0;
5798
+ }
5799
+
5778
5800
  /**
5779
5801
  * Reads the runtime-only lazy import thunk from a {@link JsonSource}. Returns
5780
5802
  * `undefined` for a transport marker (sent over the wire without the thunk).
@@ -10467,7 +10489,8 @@ function settings() {
10467
10489
  enabled: _boolean().nullable().describe("Whether editors have an assistant in this project. Unset means nobody has decided: it is offered, and turned on when someone accepts."),
10468
10490
  context: string().multiline().maxLength(ASSISTANT_SETTINGS_MAX_LENGTH).nullable().describe("Background the assistant would otherwise have to guess: what this site is, who runs it, names and spellings that matter."),
10469
10491
  tone: string().multiline().maxLength(ASSISTANT_SETTINGS_MAX_LENGTH).nullable().describe("How the assistant should write when it writes content: formal or playful, British or American, how headings are cased."),
10470
- translation: record(locale(), string().multiline().maxLength(ASSISTANT_SETTINGS_MAX_LENGTH).nullable()).nullable().describe("How to translate into each language: dialect, formality, and the words that stay untranslated.")
10492
+ translation: record(locale(), string().multiline().maxLength(ASSISTANT_SETTINGS_MAX_LENGTH).nullable()).nullable().describe("How to translate into each language: dialect, formality, and the words that stay untranslated."),
10493
+ webSearch: _boolean().nullable().describe("Whether the assistant may search the web. Off unless turned on. After a search it asks before changing code.")
10471
10494
  }),
10472
10495
  theme: new SettingsSchema({
10473
10496
  accent: color({
@@ -15536,7 +15559,9 @@ function computeValModuleShas(config, entries, moduleErrors) {
15536
15559
  var baseSha = configSha;
15537
15560
  // NOTE: schemaSha is deliberately NOT seeded with configSha. It is compared
15538
15561
  // across bundles (the server extracts from the Node bundle, the editor SPA
15539
- // from the browser bundle) to detect that a new version has been deployed.
15562
+ // from the browser bundle) to detect that a new version has been deployed --
15563
+ // by a Studio of the release before phase 9's; today's compares each
15564
+ // module's schema version on the manifest, which has the same constraint.
15540
15565
  // The config contains values that are not part of the schema and that differ
15541
15566
  // between those two bundles - most notably the documented
15542
15567
  // `gitCommit: process.env.VERCEL_GIT_COMMIT_SHA` / `gitBranch`, which are
@@ -16979,7 +17004,7 @@ function isInlineRender(container) {
16979
17004
 
16980
17005
  var corePackageJson = {
16981
17006
  name: "@valbuild/core",
16982
- version: "0.150.3",
17007
+ version: "0.153.0",
16983
17008
  "private": false,
16984
17009
  description: "Val - supercharged hard-coded content",
16985
17010
  repository: {
@@ -17140,6 +17165,7 @@ var Internal = {
17140
17165
  },
17141
17166
  isVal: isVal,
17142
17167
  isJson: isJson,
17168
+ isJsonFromServer: isJsonFromServer,
17143
17169
  getJsonImport: getJsonImport,
17144
17170
  resolveJsonValues: resolveJsonValues,
17145
17171
  isExternal: isExternal,
@@ -3281,6 +3281,11 @@ function galleryEntryOf(src, schema, getModuleSource) {
3281
3281
  * - **The defaults** — description, focal point, a video's poster, start, end
3282
3282
  * and captions ({@link GALLERY_DEFAULT_GROUPS}). An editor sets them once
3283
3283
  * on the gallery entry; a field that sets its own wins, KEY BY KEY.
3284
+ * - **Where an unpublished file is** — the `patch_id` Val's server stamps on
3285
+ * a gallery entry whose file was uploaded in a pending change. The field
3286
+ * names the same file by its path, so it is served by the same patch; with
3287
+ * no `patch_id` the field's url was the published one, for a file that is
3288
+ * not published yet. A field's own `patch_id` (its own upload) wins.
3284
3289
  *
3285
3290
  * The single implementation of that merge: core, stega/RSC and the Studio all
3286
3291
  * call it rather than each rolling their own, so a page and the Studio's
@@ -3311,6 +3316,9 @@ function fillFromGallery(src, schema, getModuleSource) {
3311
3316
  } finally {
3312
3317
  _iterator.f();
3313
3318
  }
3319
+ if (own.patch_id === undefined && typeof entry.patch_id === "string") {
3320
+ filled.patch_id = entry.patch_id;
3321
+ }
3314
3322
  var _iterator2 = _createForOfIteratorHelper(GALLERY_DEFAULT_GROUPS),
3315
3323
  _step2;
3316
3324
  try {
@@ -5773,6 +5781,20 @@ function isJson(obj) {
5773
5781
  return _typeof(obj) === "object" && obj !== null && VAL_EXTENSION in obj && obj[VAL_EXTENSION] === JSON_VAL_EXTENSION_TAG;
5774
5782
  }
5775
5783
 
5784
+ /**
5785
+ * Whether this `.jsonValues()` entry's content has to be read from the server
5786
+ * rather than from the bundle's `import()`: a marker carrying a `patch_id`.
5787
+ *
5788
+ * The server writes one for an entry a pending patch added or replaced, and
5789
+ * for every entry a publish wrote (`adoptCommittedSources`), because a host
5790
+ * that does not rebuild after a publish -- memory mode -- still has the
5791
+ * content from before it in the bundle. A marker without one is the bundle's
5792
+ * entry, and any reader may fill it from there.
5793
+ */
5794
+ function isJsonFromServer(obj) {
5795
+ return isJson(obj) && typeof obj.patch_id === "string" && obj.patch_id.length > 0;
5796
+ }
5797
+
5776
5798
  /**
5777
5799
  * Reads the runtime-only lazy import thunk from a {@link JsonSource}. Returns
5778
5800
  * `undefined` for a transport marker (sent over the wire without the thunk).
@@ -10465,7 +10487,8 @@ function settings() {
10465
10487
  enabled: _boolean().nullable().describe("Whether editors have an assistant in this project. Unset means nobody has decided: it is offered, and turned on when someone accepts."),
10466
10488
  context: string().multiline().maxLength(ASSISTANT_SETTINGS_MAX_LENGTH).nullable().describe("Background the assistant would otherwise have to guess: what this site is, who runs it, names and spellings that matter."),
10467
10489
  tone: string().multiline().maxLength(ASSISTANT_SETTINGS_MAX_LENGTH).nullable().describe("How the assistant should write when it writes content: formal or playful, British or American, how headings are cased."),
10468
- translation: record(locale(), string().multiline().maxLength(ASSISTANT_SETTINGS_MAX_LENGTH).nullable()).nullable().describe("How to translate into each language: dialect, formality, and the words that stay untranslated.")
10490
+ translation: record(locale(), string().multiline().maxLength(ASSISTANT_SETTINGS_MAX_LENGTH).nullable()).nullable().describe("How to translate into each language: dialect, formality, and the words that stay untranslated."),
10491
+ webSearch: _boolean().nullable().describe("Whether the assistant may search the web. Off unless turned on. After a search it asks before changing code.")
10469
10492
  }),
10470
10493
  theme: new SettingsSchema({
10471
10494
  accent: color({
@@ -15534,7 +15557,9 @@ function computeValModuleShas(config, entries, moduleErrors) {
15534
15557
  var baseSha = configSha;
15535
15558
  // NOTE: schemaSha is deliberately NOT seeded with configSha. It is compared
15536
15559
  // across bundles (the server extracts from the Node bundle, the editor SPA
15537
- // from the browser bundle) to detect that a new version has been deployed.
15560
+ // from the browser bundle) to detect that a new version has been deployed --
15561
+ // by a Studio of the release before phase 9's; today's compares each
15562
+ // module's schema version on the manifest, which has the same constraint.
15538
15563
  // The config contains values that are not part of the schema and that differ
15539
15564
  // between those two bundles - most notably the documented
15540
15565
  // `gitCommit: process.env.VERCEL_GIT_COMMIT_SHA` / `gitBranch`, which are
@@ -16977,7 +17002,7 @@ function isInlineRender(container) {
16977
17002
 
16978
17003
  var corePackageJson = {
16979
17004
  name: "@valbuild/core",
16980
- version: "0.150.3",
17005
+ version: "0.153.0",
16981
17006
  "private": false,
16982
17007
  description: "Val - supercharged hard-coded content",
16983
17008
  repository: {
@@ -17138,6 +17163,7 @@ var Internal = {
17138
17163
  },
17139
17164
  isVal: isVal,
17140
17165
  isJson: isJson,
17166
+ isJsonFromServer: isJsonFromServer,
17141
17167
  getJsonImport: getJsonImport,
17142
17168
  resolveJsonValues: resolveJsonValues,
17143
17169
  isExternal: isExternal,
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dist_valbuildCore = require('./index-a031b958.cjs.dev.js');
5
+ var dist_valbuildCore = require('./index-8a50c651.cjs.dev.js');
6
6
  require('./result-bb1f436e.cjs.dev.js');
7
7
 
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dist_valbuildCore = require('./index-ec5b1776.cjs.prod.js');
5
+ var dist_valbuildCore = require('./index-2fecc26e.cjs.prod.js');
6
6
  require('./result-787e35f6.cjs.prod.js');
7
7
 
8
8
 
@@ -1,2 +1,2 @@
1
- export { H as ASSISTANT_SETTINGS_MAX_LENGTH, A as ArraySchema, B as BooleanSchema, a4 as CODE_LANGUAGES, a5 as COLOR_FORMATS, a3 as CodeSchema, a2 as ColorSchema, e as DEFAULT_APP_HOST, a6 as DEFAULT_COLOR_FORMAT, D as DEFAULT_CONTENT_HOST, u as DEFAULT_FONT_ACCEPT, f as DEFAULT_STATIC_HOST, o as DEFAULT_VAL_REMOTE_HOST, x as DEFAULT_VIDEO_ACCEPT, y as DEFAULT_VIDEO_RENDITIONS, z as DEFAULT_VIDEO_SEGMENT_DURATION, C as DateSchema, a7 as DateTimeSchema, ad as DiscriminatedUnionSchema, ae as EnumSchema, F as FATAL_ERROR_TYPES, v as FONT_MIME_TYPES, t as FileSchema, G as GenericSelector, r as ImageSchema, I as Internal, a8 as KeyOfSchema, af as LiteralSchema, Z as LocaleSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, ac as RichTextSchema, ab as RouteSchema, Q as SETTINGS_MODULE_CONVENTION, S as Schema, E as SettingsSchema, q as StringSchema, T as THEME_LOGO_DIRECTORY, K as THEME_RADIUS_LENGTHS, J as THEME_RADIUS_STEPS, av as UNSAFE_URL_SCHEMES, V as VAL_EXTENSION, a9 as ValViewSchema, w as VideoSchema, L as assistantAvailability, k as computeSchemaSha, j as computeSourcesSha, h as computeValModuleShas, $ as declaredKeySetOf, p as derefPatch, ar as describeSchemeRejection, ag as deserializeSchema, a1 as discriminatedUnionBranchOf, g as extractValModules, ao as getSourcePathFromRoute, n as hasMediaSchema, l as hasRemoteFileSchema, i as initVal, as as isCheckableScheme, ai as isInlineRender, ap as isPageRouter, U as isRootModuleFilePath, aa as isValViewSource, Y as localeOfValue, X as localeTagError, an as matchRoutePattern, a0 as missingDeclaredKeys, m as modules, aj as parseNextJsRoutePattern, ak as parseTanStackRoutePattern, ah as previewScope, at as rejectScheme, W as resolveSettingsModule, aq as routePatternOf, au as schemeOf, al as tanStackSegmentsOfRoutePath, am as validateUrlAgainstPattern } from './index-da7db0cd.esm.js';
1
+ export { H as ASSISTANT_SETTINGS_MAX_LENGTH, A as ArraySchema, B as BooleanSchema, a4 as CODE_LANGUAGES, a5 as COLOR_FORMATS, a3 as CodeSchema, a2 as ColorSchema, e as DEFAULT_APP_HOST, a6 as DEFAULT_COLOR_FORMAT, D as DEFAULT_CONTENT_HOST, u as DEFAULT_FONT_ACCEPT, f as DEFAULT_STATIC_HOST, o as DEFAULT_VAL_REMOTE_HOST, x as DEFAULT_VIDEO_ACCEPT, y as DEFAULT_VIDEO_RENDITIONS, z as DEFAULT_VIDEO_SEGMENT_DURATION, C as DateSchema, a7 as DateTimeSchema, ad as DiscriminatedUnionSchema, ae as EnumSchema, F as FATAL_ERROR_TYPES, v as FONT_MIME_TYPES, t as FileSchema, G as GenericSelector, r as ImageSchema, I as Internal, a8 as KeyOfSchema, af as LiteralSchema, Z as LocaleSchema, M as ModuleFilePathSep, N as NumberSchema, O as ObjectSchema, R as RecordSchema, ac as RichTextSchema, ab as RouteSchema, Q as SETTINGS_MODULE_CONVENTION, S as Schema, E as SettingsSchema, q as StringSchema, T as THEME_LOGO_DIRECTORY, K as THEME_RADIUS_LENGTHS, J as THEME_RADIUS_STEPS, av as UNSAFE_URL_SCHEMES, V as VAL_EXTENSION, a9 as ValViewSchema, w as VideoSchema, L as assistantAvailability, k as computeSchemaSha, j as computeSourcesSha, h as computeValModuleShas, $ as declaredKeySetOf, p as derefPatch, ar as describeSchemeRejection, ag as deserializeSchema, a1 as discriminatedUnionBranchOf, g as extractValModules, ao as getSourcePathFromRoute, n as hasMediaSchema, l as hasRemoteFileSchema, i as initVal, as as isCheckableScheme, ai as isInlineRender, ap as isPageRouter, U as isRootModuleFilePath, aa as isValViewSource, Y as localeOfValue, X as localeTagError, an as matchRoutePattern, a0 as missingDeclaredKeys, m as modules, aj as parseNextJsRoutePattern, ak as parseTanStackRoutePattern, ah as previewScope, at as rejectScheme, W as resolveSettingsModule, aq as routePatternOf, au as schemeOf, al as tanStackSegmentsOfRoutePath, am as validateUrlAgainstPattern } from './index-d44e8db9.esm.js';
2
2
  import './result-daff1cae.esm.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/core",
3
- "version": "0.150.3",
3
+ "version": "0.153.0",
4
4
  "private": false,
5
5
  "description": "Val - supercharged hard-coded content",
6
6
  "repository": {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dist_valbuildCore = require('../../dist/index-a031b958.cjs.dev.js');
5
+ var dist_valbuildCore = require('../../dist/index-8a50c651.cjs.dev.js');
6
6
  var result = require('../../dist/result-bb1f436e.cjs.dev.js');
7
7
  var util = require('../../dist/util-b213092b.cjs.dev.js');
8
8
 
@@ -437,7 +437,14 @@ function apply(document, ops, op) {
437
437
  return ops.copy(document, op.from, op.path);
438
438
  case "test":
439
439
  {
440
- if (!ops.test(document, op.path, op.value)) {
440
+ // `ops.test` answers with a Result: an error when the path does not
441
+ // exist, and `false` when the value there is not deeply equal. Both
442
+ // fail the patch (RFC 6902, 4.6).
443
+ var tested = ops.test(document, op.path, op.value);
444
+ if (result.isErr(tested)) {
445
+ return tested;
446
+ }
447
+ if (!tested.value) {
441
448
  return result.err(new dist_valbuildCore.PatchError("Test failed"));
442
449
  }
443
450
  return result.ok(document);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dist_valbuildCore = require('../../dist/index-ec5b1776.cjs.prod.js');
5
+ var dist_valbuildCore = require('../../dist/index-2fecc26e.cjs.prod.js');
6
6
  var result = require('../../dist/result-787e35f6.cjs.prod.js');
7
7
  var util = require('../../dist/util-030d8a1f.cjs.prod.js');
8
8
 
@@ -437,7 +437,14 @@ function apply(document, ops, op) {
437
437
  return ops.copy(document, op.from, op.path);
438
438
  case "test":
439
439
  {
440
- if (!ops.test(document, op.path, op.value)) {
440
+ // `ops.test` answers with a Result: an error when the path does not
441
+ // exist, and `false` when the value there is not deeply equal. Both
442
+ // fail the patch (RFC 6902, 4.6).
443
+ var tested = ops.test(document, op.path, op.value);
444
+ if (result.isErr(tested)) {
445
+ return tested;
446
+ }
447
+ if (!tested.value) {
441
448
  return result.err(new dist_valbuildCore.PatchError("Test failed"));
442
449
  }
443
450
  return result.ok(document);
@@ -1,5 +1,5 @@
1
- import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-da7db0cd.esm.js';
2
- export { P as PatchError } from '../../dist/index-da7db0cd.esm.js';
1
+ import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-d44e8db9.esm.js';
2
+ export { P as PatchError } from '../../dist/index-d44e8db9.esm.js';
3
3
  import { f as isNonEmpty, e as err, o as ok, m as map, g as flatMap, i as isErr, h as flatMapReduce, j as filterOrElse, k as mapErr, l as map$1, n as all, p as flatten, q as allT } from '../../dist/result-daff1cae.esm.js';
4
4
  import { p as pipe } from '../../dist/util-18613e99.esm.js';
5
5
 
@@ -434,7 +434,14 @@ function apply(document, ops, op) {
434
434
  return ops.copy(document, op.from, op.path);
435
435
  case "test":
436
436
  {
437
- if (!ops.test(document, op.path, op.value)) {
437
+ // `ops.test` answers with a Result: an error when the path does not
438
+ // exist, and `false` when the value there is not deeply equal. Both
439
+ // fail the patch (RFC 6902, 4.6).
440
+ var tested = ops.test(document, op.path, op.value);
441
+ if (isErr(tested)) {
442
+ return tested;
443
+ }
444
+ if (!tested.value) {
438
445
  return err(new PatchError("Test failed"));
439
446
  }
440
447
  return ok(document);