@valbuild/server 0.154.0 → 0.154.1

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/browser/dist/valbuild-server-browser.cjs.dev.js +2 -2
  3. package/browser/dist/valbuild-server-browser.cjs.prod.js +2 -2
  4. package/browser/dist/valbuild-server-browser.esm.js +2 -2
  5. package/dist/{ValRouter-cd6e854a.cjs.prod.js → ValRouter-31f89baf.cjs.prod.js} +3 -3
  6. package/dist/{ValRouter-1f427c38.cjs.dev.js → ValRouter-9505c550.cjs.dev.js} +3 -3
  7. package/dist/{ValRouter-558dc66d.esm.js → ValRouter-b7dc784d.esm.js} +3 -3
  8. package/dist/{ValRouterCore-4be8eaf1.cjs.prod.js → ValRouterCore-361673dc.cjs.dev.js} +39 -5
  9. package/dist/{ValRouterCore-fe985e4c.esm.js → ValRouterCore-be314bc7.esm.js} +39 -5
  10. package/dist/{ValRouterCore-0c088c9e.cjs.dev.js → ValRouterCore-cfb35067.cjs.prod.js} +39 -5
  11. package/dist/{inTabFetch-f6694ad2.cjs.prod.js → inTabFetch-56226d62.cjs.prod.js} +1 -1
  12. package/dist/{inTabFetch-c8966e73.cjs.dev.js → inTabFetch-5d0314a3.cjs.dev.js} +1 -1
  13. package/dist/{inTabFetch-877e7d11.esm.js → inTabFetch-7c8a5628.esm.js} +1 -1
  14. package/dist/{publishKit-cfe1273d.cjs.dev.js → publishKit-5a8c9a0d.cjs.dev.js} +2 -2
  15. package/dist/{publishKit-e7f7db7c.cjs.prod.js → publishKit-707230bc.cjs.prod.js} +2 -2
  16. package/dist/{publishKit-0709423c.esm.js → publishKit-b850045b.esm.js} +3 -3
  17. package/dist/valbuild-server.cjs.dev.js +2 -2
  18. package/dist/valbuild-server.cjs.prod.js +2 -2
  19. package/dist/valbuild-server.esm.js +4 -4
  20. package/internal/browser/dist/valbuild-server-internal-browser.cjs.dev.js +2 -2
  21. package/internal/browser/dist/valbuild-server-internal-browser.cjs.prod.js +2 -2
  22. package/internal/browser/dist/valbuild-server-internal-browser.esm.js +2 -2
  23. package/internal/dist/valbuild-server-internal.cjs.dev.js +2 -2
  24. package/internal/dist/valbuild-server-internal.cjs.prod.js +2 -2
  25. package/internal/dist/valbuild-server-internal.esm.js +2 -2
  26. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @valbuild/server
2
2
 
3
+ ## 0.154.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1072](https://github.com/valbuild/val/pull/1072) [`def1434`](https://github.com/valbuild/val/commit/def1434324a0b3e26202148cb11726e02bd5bffe) Thanks [@freekh](https://github.com/freekh)! - The assistant's code tools answer faster in a proposal.
8
+
9
+ - **Reading costs no request after the first.** The Studio keeps the proposal's project in the tab for the life of the chat, instead of fetching the site's source and the proposal's files again for every `read_file`, `search_code`, `list_files`, `edit_file`, `format_files` and `lint`. It is read again when someone changes the proposal, when the site is published, and after the assistant's own changes.
10
+ - **A change is one or two requests instead of four.** `edit_file`, `write_files`, `format_files` and `lint` with `fix` no longer ask whether code mode is on before each write: Val's server already refuses a write while it is off, and the assistant is still told who turned it off. Before a file is edited, the Studio asks what the proposal stages now, so a change someone else made to it is edited rather than overwritten.
11
+ - **A change does not wait for the schema to be re-read unless it can change it.** Only a write to a `.val.ts`, `val.modules.ts`, `val.config.ts` or a file they import waits for the Studio to evaluate the Val modules. A component, a stylesheet or a route is answered at once, and several edits in one reply are evaluated together rather than one after another.
12
+
13
+ - Updated dependencies [[`37e4f39`](https://github.com/valbuild/val/commit/37e4f390d1fd6a930488c9487de43f8c1a390122), [`245843e`](https://github.com/valbuild/val/commit/245843ec527212dc31c6e1da1f0bd5f9d99cf8d3), [`d4e514f`](https://github.com/valbuild/val/commit/d4e514f9eac2f014fc07aa768787d637898dc744), [`def1434`](https://github.com/valbuild/val/commit/def1434324a0b3e26202148cb11726e02bd5bffe), [`82c641c`](https://github.com/valbuild/val/commit/82c641ca00ddfe1ed5b07b9ccb5ee39b0c6f102e)]:
14
+ - @valbuild/ui@0.154.1
15
+ - @valbuild/shared@0.154.1
16
+
3
17
  ## 0.154.0
4
18
 
5
19
  ### Patch Changes
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var inTabFetch = require('../../dist/inTabFetch-c8966e73.cjs.dev.js');
5
+ var inTabFetch = require('../../dist/inTabFetch-5d0314a3.cjs.dev.js');
6
6
  require('@valbuild/core');
7
- require('../../dist/ValRouterCore-0c088c9e.cjs.dev.js');
7
+ require('../../dist/ValRouterCore-361673dc.cjs.dev.js');
8
8
  require('zod');
9
9
  require('@valbuild/shared/internal');
10
10
  require('zod-validation-error');
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var inTabFetch = require('../../dist/inTabFetch-f6694ad2.cjs.prod.js');
5
+ var inTabFetch = require('../../dist/inTabFetch-56226d62.cjs.prod.js');
6
6
  require('@valbuild/core');
7
- require('../../dist/ValRouterCore-4be8eaf1.cjs.prod.js');
7
+ require('../../dist/ValRouterCore-cfb35067.cjs.prod.js');
8
8
  require('zod');
9
9
  require('@valbuild/shared/internal');
10
10
  require('zod-validation-error');
@@ -1,6 +1,6 @@
1
- export { c as createInTabValFetch } from '../../dist/inTabFetch-877e7d11.esm.js';
1
+ export { c as createInTabValFetch } from '../../dist/inTabFetch-7c8a5628.esm.js';
2
2
  import '@valbuild/core';
3
- import '../../dist/ValRouterCore-fe985e4c.esm.js';
3
+ import '../../dist/ValRouterCore-be314bc7.esm.js';
4
4
  import 'zod';
5
5
  import '@valbuild/shared/internal';
6
6
  import 'zod-validation-error';
@@ -2,7 +2,7 @@
2
2
 
3
3
  var core = require('@valbuild/core');
4
4
  var server = require('@valbuild/ui/server');
5
- var ValRouterCore = require('./ValRouterCore-4be8eaf1.cjs.prod.js');
5
+ var ValRouterCore = require('./ValRouterCore-cfb35067.cjs.prod.js');
6
6
  var path = require('path');
7
7
  var ts = require('typescript');
8
8
  var z = require('zod');
@@ -2249,7 +2249,7 @@ function createFsSketchpadStore(rootDir, now = () => new Date()) {
2249
2249
  * as a bundler does.
2250
2250
  */
2251
2251
  function loadTypeScriptKit() {
2252
- return Promise.resolve().then(function () { return require('./publishKit-e7f7db7c.cjs.prod.js'); });
2252
+ return Promise.resolve().then(function () { return require('./publishKit-707230bc.cjs.prod.js'); });
2253
2253
  }
2254
2254
 
2255
2255
  /** Serializes a schema, or gives up quietly — serialization errors are reported elsewhere. */
@@ -5064,7 +5064,7 @@ async function stagedModuleSources(files) {
5064
5064
  parseValFile,
5065
5065
  analyzeValModule,
5066
5066
  evaluateModuleSource
5067
- } = await Promise.resolve().then(function () { return require('./publishKit-e7f7db7c.cjs.prod.js'); });
5067
+ } = await Promise.resolve().then(function () { return require('./publishKit-707230bc.cjs.prod.js'); });
5068
5068
  const sources = {};
5069
5069
  for (const {
5070
5070
  path,
@@ -2,7 +2,7 @@
2
2
 
3
3
  var core = require('@valbuild/core');
4
4
  var server = require('@valbuild/ui/server');
5
- var ValRouterCore = require('./ValRouterCore-0c088c9e.cjs.dev.js');
5
+ var ValRouterCore = require('./ValRouterCore-361673dc.cjs.dev.js');
6
6
  var path = require('path');
7
7
  var ts = require('typescript');
8
8
  var z = require('zod');
@@ -2249,7 +2249,7 @@ function createFsSketchpadStore(rootDir, now = () => new Date()) {
2249
2249
  * as a bundler does.
2250
2250
  */
2251
2251
  function loadTypeScriptKit() {
2252
- return Promise.resolve().then(function () { return require('./publishKit-cfe1273d.cjs.dev.js'); });
2252
+ return Promise.resolve().then(function () { return require('./publishKit-5a8c9a0d.cjs.dev.js'); });
2253
2253
  }
2254
2254
 
2255
2255
  /** Serializes a schema, or gives up quietly — serialization errors are reported elsewhere. */
@@ -5064,7 +5064,7 @@ async function stagedModuleSources(files) {
5064
5064
  parseValFile,
5065
5065
  analyzeValModule,
5066
5066
  evaluateModuleSource
5067
- } = await Promise.resolve().then(function () { return require('./publishKit-cfe1273d.cjs.dev.js'); });
5067
+ } = await Promise.resolve().then(function () { return require('./publishKit-5a8c9a0d.cjs.dev.js'); });
5068
5068
  const sources = {};
5069
5069
  for (const {
5070
5070
  path,
@@ -1,6 +1,6 @@
1
1
  import { Internal, deserializeSchema, DEFAULT_CONTENT_HOST, DEFAULT_VAL_REMOTE_HOST } from '@valbuild/core';
2
2
  import { createUIRequestHandler } from '@valbuild/ui/server';
3
- import { r as resolveExistingJsonPath, s as summaryOf, m as matchesFilter, h as byUpdatedAt, n as newSketchpad, i as isSketchpadId, j as applySketchpadChange, k as ValOps, V as VAL_CLIENT_HEADERS, l as isSafePatchId, o as isMediaFilePath, M as MEDIA_FILE_PATH_ACCEPTS, p as bufferFromDataUrl, q as getFieldsForType, u as uploadRemoteFile, d as getFileExt, t as isPublicFilePath, w as guessMimeTypeFromPath, x as createMetadataFromBuffer, D as DEFAULT_ANALYTICS_INGEST_URL, e as ValOpsMemory, y as sessionAuth, z as isHttpOps, A as isHlsMasterPlaylist, B as sumHlsSegmentDurations, C as parseHlsMasterVariants, E as largestHlsVariant, F as fallbackRefOf, G as mapHlsUris, H as movedRemoteHost, J as needsHostCheck, K as rewriteRefHost, L as fallbackRemoteHost, N as checkRemoteFiles, O as ValServer, P as setRequestGuard, Q as parseAllowedHosts, R as createValRequestHandler } from './ValRouterCore-fe985e4c.esm.js';
3
+ import { r as resolveExistingJsonPath, s as summaryOf, m as matchesFilter, h as byUpdatedAt, n as newSketchpad, i as isSketchpadId, j as applySketchpadChange, k as ValOps, V as VAL_CLIENT_HEADERS, l as isSafePatchId, o as isMediaFilePath, M as MEDIA_FILE_PATH_ACCEPTS, p as bufferFromDataUrl, q as getFieldsForType, u as uploadRemoteFile, d as getFileExt, t as isPublicFilePath, w as guessMimeTypeFromPath, x as createMetadataFromBuffer, D as DEFAULT_ANALYTICS_INGEST_URL, e as ValOpsMemory, y as sessionAuth, z as isHttpOps, A as isHlsMasterPlaylist, B as sumHlsSegmentDurations, C as parseHlsMasterVariants, E as largestHlsVariant, F as fallbackRefOf, G as mapHlsUris, H as movedRemoteHost, J as needsHostCheck, K as rewriteRefHost, L as fallbackRemoteHost, N as checkRemoteFiles, O as ValServer, P as setRequestGuard, Q as parseAllowedHosts, R as createValRequestHandler } from './ValRouterCore-be314bc7.esm.js';
4
4
  import path from 'path';
5
5
  import ts from 'typescript';
6
6
  import { z } from 'zod';
@@ -2215,7 +2215,7 @@ function createFsSketchpadStore(rootDir, now = () => new Date()) {
2215
2215
  * as a bundler does.
2216
2216
  */
2217
2217
  function loadTypeScriptKit() {
2218
- return import('./publishKit-0709423c.esm.js');
2218
+ return import('./publishKit-b850045b.esm.js');
2219
2219
  }
2220
2220
 
2221
2221
  /** Serializes a schema, or gives up quietly — serialization errors are reported elsewhere. */
@@ -5030,7 +5030,7 @@ async function stagedModuleSources(files) {
5030
5030
  parseValFile,
5031
5031
  analyzeValModule,
5032
5032
  evaluateModuleSource
5033
- } = await import('./publishKit-0709423c.esm.js');
5033
+ } = await import('./publishKit-b850045b.esm.js');
5034
5034
  const sources = {};
5035
5035
  for (const {
5036
5036
  path,
@@ -6409,7 +6409,7 @@ var packageJson = {
6409
6409
  ],
6410
6410
  exports: true
6411
6411
  },
6412
- version: "0.154.0",
6412
+ version: "0.154.1",
6413
6413
  scripts: {
6414
6414
  typecheck: "tsc --noEmit",
6415
6415
  test: "jest",
@@ -7968,8 +7968,24 @@ const ValServer = (valModules, options, callbacks, platform) => {
7968
7968
  }
7969
7969
  };
7970
7970
  }
7971
- const saved = await saveBeforeCode(cookies, "Saved before the code was changed");
7972
- return saved === null ? null : {
7971
+ const saved = await saveBeforeCodeOutcome(cookies, "Saved before the code was changed");
7972
+ if ("saved" in saved) {
7973
+ const savedFirst = saved.saved;
7974
+ const staged = await proxyProposalsApi(path, "POST", profileId, JSON.stringify(body ?? {}));
7975
+ /*
7976
+ * `savedFirst` goes with content's answer: the tab that staged holds
7977
+ * the proposal's files (`projectSnapshot.ts` in `@valbuild/ui`), and a
7978
+ * save made here wrote `.val.ts` files it did not write itself.
7979
+ */
7980
+ return staged.status === 200 && isJsonObject(staged.json) ? {
7981
+ status: 200,
7982
+ json: {
7983
+ ...staged.json,
7984
+ savedFirst
7985
+ }
7986
+ } : staged;
7987
+ }
7988
+ return {
7973
7989
  status: saved.status,
7974
7990
  json: {
7975
7991
  message: `The code was not changed, because the changes waiting to be saved could not be saved first: ${saved.message}`,
@@ -7985,6 +8001,17 @@ const ValServer = (valModules, options, callbacks, platform) => {
7985
8001
  * `null` when there was nothing to save or it was saved, otherwise why not.
7986
8002
  */
7987
8003
  const saveBeforeCode = async (cookies, message) => {
8004
+ const outcome = await saveBeforeCodeOutcome(cookies, message);
8005
+ return "saved" in outcome ? null : outcome;
8006
+ };
8007
+
8008
+ /**
8009
+ * {@link saveBeforeCode}, saying whether anything was saved: `saved: false`
8010
+ * when nothing was pending. What a staging's answer tells the tab
8011
+ * (`savedFirst`), which holds the proposal's files and has to know whether
8012
+ * a save changed a `.val.ts` under them.
8013
+ */
8014
+ const saveBeforeCodeOutcome = async (cookies, message) => {
7988
8015
  const chain = await serverOps.fetchPatches({
7989
8016
  excludePatchOps: true
7990
8017
  });
@@ -7995,12 +8022,16 @@ const ValServer = (valModules, options, callbacks, platform) => {
7995
8022
  };
7996
8023
  }
7997
8024
  const pending = chain.patches.filter(patch => patch.appliedAt === null).map(patch => patch.patchId);
7998
- if (pending.length === 0) return null;
8025
+ if (pending.length === 0) return {
8026
+ saved: false
8027
+ };
7999
8028
  const saved = await saveChanges(cookies, {
8000
8029
  patchIds: pending,
8001
8030
  message
8002
8031
  });
8003
- if (saved.status === 200) return null;
8032
+ if (saved.status === 200) return {
8033
+ saved: true
8034
+ };
8004
8035
  const said = "message" in saved.json && typeof saved.json.message === "string" ? saved.json.message : `the save answered ${saved.status}`;
8005
8036
  /*
8006
8037
  * Why, in the words of each module that could not be saved: "Failed to
@@ -11906,6 +11937,9 @@ function sourceFilePatchErrorsOf(json) {
11906
11937
  }
11907
11938
  return messages;
11908
11939
  }
11940
+ function isJsonObject(value) {
11941
+ return typeof value === "object" && value !== null && !Array.isArray(value);
11942
+ }
11909
11943
 
11910
11944
  async function uploadRemoteFile(contentHost, project, bucket, fileHash, fileExt, fileBuffer, auth) {
11911
11945
  const authHeader = "apiKey" in auth ? {
@@ -6403,7 +6403,7 @@ var packageJson = {
6403
6403
  ],
6404
6404
  exports: true
6405
6405
  },
6406
- version: "0.154.0",
6406
+ version: "0.154.1",
6407
6407
  scripts: {
6408
6408
  typecheck: "tsc --noEmit",
6409
6409
  test: "jest",
@@ -7962,8 +7962,24 @@ const ValServer = (valModules, options, callbacks, platform) => {
7962
7962
  }
7963
7963
  };
7964
7964
  }
7965
- const saved = await saveBeforeCode(cookies, "Saved before the code was changed");
7966
- return saved === null ? null : {
7965
+ const saved = await saveBeforeCodeOutcome(cookies, "Saved before the code was changed");
7966
+ if ("saved" in saved) {
7967
+ const savedFirst = saved.saved;
7968
+ const staged = await proxyProposalsApi(path, "POST", profileId, JSON.stringify(body ?? {}));
7969
+ /*
7970
+ * `savedFirst` goes with content's answer: the tab that staged holds
7971
+ * the proposal's files (`projectSnapshot.ts` in `@valbuild/ui`), and a
7972
+ * save made here wrote `.val.ts` files it did not write itself.
7973
+ */
7974
+ return staged.status === 200 && isJsonObject(staged.json) ? {
7975
+ status: 200,
7976
+ json: {
7977
+ ...staged.json,
7978
+ savedFirst
7979
+ }
7980
+ } : staged;
7981
+ }
7982
+ return {
7967
7983
  status: saved.status,
7968
7984
  json: {
7969
7985
  message: `The code was not changed, because the changes waiting to be saved could not be saved first: ${saved.message}`,
@@ -7979,6 +7995,17 @@ const ValServer = (valModules, options, callbacks, platform) => {
7979
7995
  * `null` when there was nothing to save or it was saved, otherwise why not.
7980
7996
  */
7981
7997
  const saveBeforeCode = async (cookies, message) => {
7998
+ const outcome = await saveBeforeCodeOutcome(cookies, message);
7999
+ return "saved" in outcome ? null : outcome;
8000
+ };
8001
+
8002
+ /**
8003
+ * {@link saveBeforeCode}, saying whether anything was saved: `saved: false`
8004
+ * when nothing was pending. What a staging's answer tells the tab
8005
+ * (`savedFirst`), which holds the proposal's files and has to know whether
8006
+ * a save changed a `.val.ts` under them.
8007
+ */
8008
+ const saveBeforeCodeOutcome = async (cookies, message) => {
7982
8009
  const chain = await serverOps.fetchPatches({
7983
8010
  excludePatchOps: true
7984
8011
  });
@@ -7989,12 +8016,16 @@ const ValServer = (valModules, options, callbacks, platform) => {
7989
8016
  };
7990
8017
  }
7991
8018
  const pending = chain.patches.filter(patch => patch.appliedAt === null).map(patch => patch.patchId);
7992
- if (pending.length === 0) return null;
8019
+ if (pending.length === 0) return {
8020
+ saved: false
8021
+ };
7993
8022
  const saved = await saveChanges(cookies, {
7994
8023
  patchIds: pending,
7995
8024
  message
7996
8025
  });
7997
- if (saved.status === 200) return null;
8026
+ if (saved.status === 200) return {
8027
+ saved: true
8028
+ };
7998
8029
  const said = "message" in saved.json && typeof saved.json.message === "string" ? saved.json.message : `the save answered ${saved.status}`;
7999
8030
  /*
8000
8031
  * Why, in the words of each module that could not be saved: "Failed to
@@ -11900,6 +11931,9 @@ function sourceFilePatchErrorsOf(json) {
11900
11931
  }
11901
11932
  return messages;
11902
11933
  }
11934
+ function isJsonObject(value) {
11935
+ return typeof value === "object" && value !== null && !Array.isArray(value);
11936
+ }
11903
11937
 
11904
11938
  async function uploadRemoteFile(contentHost, project, bucket, fileHash, fileExt, fileBuffer, auth) {
11905
11939
  const authHeader = "apiKey" in auth ? {
@@ -6409,7 +6409,7 @@ var packageJson = {
6409
6409
  ],
6410
6410
  exports: true
6411
6411
  },
6412
- version: "0.154.0",
6412
+ version: "0.154.1",
6413
6413
  scripts: {
6414
6414
  typecheck: "tsc --noEmit",
6415
6415
  test: "jest",
@@ -7968,8 +7968,24 @@ const ValServer = (valModules, options, callbacks, platform) => {
7968
7968
  }
7969
7969
  };
7970
7970
  }
7971
- const saved = await saveBeforeCode(cookies, "Saved before the code was changed");
7972
- return saved === null ? null : {
7971
+ const saved = await saveBeforeCodeOutcome(cookies, "Saved before the code was changed");
7972
+ if ("saved" in saved) {
7973
+ const savedFirst = saved.saved;
7974
+ const staged = await proxyProposalsApi(path, "POST", profileId, JSON.stringify(body ?? {}));
7975
+ /*
7976
+ * `savedFirst` goes with content's answer: the tab that staged holds
7977
+ * the proposal's files (`projectSnapshot.ts` in `@valbuild/ui`), and a
7978
+ * save made here wrote `.val.ts` files it did not write itself.
7979
+ */
7980
+ return staged.status === 200 && isJsonObject(staged.json) ? {
7981
+ status: 200,
7982
+ json: {
7983
+ ...staged.json,
7984
+ savedFirst
7985
+ }
7986
+ } : staged;
7987
+ }
7988
+ return {
7973
7989
  status: saved.status,
7974
7990
  json: {
7975
7991
  message: `The code was not changed, because the changes waiting to be saved could not be saved first: ${saved.message}`,
@@ -7985,6 +8001,17 @@ const ValServer = (valModules, options, callbacks, platform) => {
7985
8001
  * `null` when there was nothing to save or it was saved, otherwise why not.
7986
8002
  */
7987
8003
  const saveBeforeCode = async (cookies, message) => {
8004
+ const outcome = await saveBeforeCodeOutcome(cookies, message);
8005
+ return "saved" in outcome ? null : outcome;
8006
+ };
8007
+
8008
+ /**
8009
+ * {@link saveBeforeCode}, saying whether anything was saved: `saved: false`
8010
+ * when nothing was pending. What a staging's answer tells the tab
8011
+ * (`savedFirst`), which holds the proposal's files and has to know whether
8012
+ * a save changed a `.val.ts` under them.
8013
+ */
8014
+ const saveBeforeCodeOutcome = async (cookies, message) => {
7988
8015
  const chain = await serverOps.fetchPatches({
7989
8016
  excludePatchOps: true
7990
8017
  });
@@ -7995,12 +8022,16 @@ const ValServer = (valModules, options, callbacks, platform) => {
7995
8022
  };
7996
8023
  }
7997
8024
  const pending = chain.patches.filter(patch => patch.appliedAt === null).map(patch => patch.patchId);
7998
- if (pending.length === 0) return null;
8025
+ if (pending.length === 0) return {
8026
+ saved: false
8027
+ };
7999
8028
  const saved = await saveChanges(cookies, {
8000
8029
  patchIds: pending,
8001
8030
  message
8002
8031
  });
8003
- if (saved.status === 200) return null;
8032
+ if (saved.status === 200) return {
8033
+ saved: true
8034
+ };
8004
8035
  const said = "message" in saved.json && typeof saved.json.message === "string" ? saved.json.message : `the save answered ${saved.status}`;
8005
8036
  /*
8006
8037
  * Why, in the words of each module that could not be saved: "Failed to
@@ -11906,6 +11937,9 @@ function sourceFilePatchErrorsOf(json) {
11906
11937
  }
11907
11938
  return messages;
11908
11939
  }
11940
+ function isJsonObject(value) {
11941
+ return typeof value === "object" && value !== null && !Array.isArray(value);
11942
+ }
11909
11943
 
11910
11944
  async function uploadRemoteFile(contentHost, project, bucket, fileHash, fileExt, fileBuffer, auth) {
11911
11945
  const authHeader = "apiKey" in auth ? {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@valbuild/core');
4
- var ValRouterCore = require('./ValRouterCore-4be8eaf1.cjs.prod.js');
4
+ var ValRouterCore = require('./ValRouterCore-cfb35067.cjs.prod.js');
5
5
 
6
6
  const NO_SESSIONS = "Val: sessions are not available here -- this server runs in the browser, " + "has no secret to sign them with, and serves without authenticating.";
7
7
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@valbuild/core');
4
- var ValRouterCore = require('./ValRouterCore-0c088c9e.cjs.dev.js');
4
+ var ValRouterCore = require('./ValRouterCore-361673dc.cjs.dev.js');
5
5
 
6
6
  const NO_SESSIONS = "Val: sessions are not available here -- this server runs in the browser, " + "has no secret to sign them with, and serves without authenticating.";
7
7
 
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_CONTENT_HOST } from '@valbuild/core';
2
- import { e as ValOpsMemory, S as bytesToBase64, O as ValServer, R as createValRequestHandler } from './ValRouterCore-fe985e4c.esm.js';
2
+ import { e as ValOpsMemory, S as bytesToBase64, O as ValServer, R as createValRequestHandler } from './ValRouterCore-be314bc7.esm.js';
3
3
 
4
4
  const NO_SESSIONS = "Val: sessions are not available here -- this server runs in the browser, " + "has no secret to sign them with, and serves without authenticating.";
5
5
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  var ts = require('typescript');
4
4
  var fp = require('@valbuild/core/fp');
5
- var ValRouter = require('./ValRouter-1f427c38.cjs.dev.js');
6
- var ValRouterCore = require('./ValRouterCore-0c088c9e.cjs.dev.js');
5
+ var ValRouter = require('./ValRouter-9505c550.cjs.dev.js');
6
+ var ValRouterCore = require('./ValRouterCore-361673dc.cjs.dev.js');
7
7
  require('@valbuild/core');
8
8
  require('@valbuild/ui/server');
9
9
  require('path');
@@ -2,8 +2,8 @@
2
2
 
3
3
  var ts = require('typescript');
4
4
  var fp = require('@valbuild/core/fp');
5
- var ValRouter = require('./ValRouter-cd6e854a.cjs.prod.js');
6
- var ValRouterCore = require('./ValRouterCore-4be8eaf1.cjs.prod.js');
5
+ var ValRouter = require('./ValRouter-31f89baf.cjs.prod.js');
6
+ var ValRouterCore = require('./ValRouterCore-cfb35067.cjs.prod.js');
7
7
  require('@valbuild/core');
8
8
  require('@valbuild/ui/server');
9
9
  require('path');
@@ -1,8 +1,8 @@
1
1
  import ts from 'typescript';
2
2
  import { result, pipe } from '@valbuild/core/fp';
3
- import { a as analyzeValModule, c as analyzeJsonValuesEntries, T as TSOps } from './ValRouter-558dc66d.esm.js';
4
- export { c as analyzeJsonValuesEntries, a as analyzeValModule, a8 as evaluateModuleSource, i as insertValJsonEntry, a9 as jsonValuesRecordKeys, r as removeValJsonEntry } from './ValRouter-558dc66d.esm.js';
5
- import { Y as bytesToUtf8, Z as posixPath } from './ValRouterCore-fe985e4c.esm.js';
3
+ import { a as analyzeValModule, c as analyzeJsonValuesEntries, T as TSOps } from './ValRouter-b7dc784d.esm.js';
4
+ export { c as analyzeJsonValuesEntries, a as analyzeValModule, a8 as evaluateModuleSource, i as insertValJsonEntry, a9 as jsonValuesRecordKeys, r as removeValJsonEntry } from './ValRouter-b7dc784d.esm.js';
5
+ import { Y as bytesToUtf8, Z as posixPath } from './ValRouterCore-be314bc7.esm.js';
6
6
  import '@valbuild/core';
7
7
  import '@valbuild/ui/server';
8
8
  import 'path';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValRouter = require('./ValRouter-1f427c38.cjs.dev.js');
5
+ var ValRouter = require('./ValRouter-9505c550.cjs.dev.js');
6
6
  var patch = require('@valbuild/core/patch');
7
7
  var fp = require('@valbuild/core/fp');
8
8
  var core = require('@valbuild/core');
@@ -11,7 +11,7 @@ var path = require('path');
11
11
  var fs = require('fs');
12
12
  var vm = require('node:vm');
13
13
  var node_module = require('node:module');
14
- var ValRouterCore = require('./ValRouterCore-0c088c9e.cjs.dev.js');
14
+ var ValRouterCore = require('./ValRouterCore-361673dc.cjs.dev.js');
15
15
  var internal = require('@valbuild/shared/internal');
16
16
  var sucrase = require('sucrase');
17
17
  var fs$1 = require('fs/promises');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValRouter = require('./ValRouter-cd6e854a.cjs.prod.js');
5
+ var ValRouter = require('./ValRouter-31f89baf.cjs.prod.js');
6
6
  var patch = require('@valbuild/core/patch');
7
7
  var fp = require('@valbuild/core/fp');
8
8
  var core = require('@valbuild/core');
@@ -11,7 +11,7 @@ var path = require('path');
11
11
  var fs = require('fs');
12
12
  var vm = require('node:vm');
13
13
  var node_module = require('node:module');
14
- var ValRouterCore = require('./ValRouterCore-4be8eaf1.cjs.prod.js');
14
+ var ValRouterCore = require('./ValRouterCore-cfb35067.cjs.prod.js');
15
15
  var internal = require('@valbuild/shared/internal');
16
16
  var sucrase = require('sucrase');
17
17
  var fs$1 = require('fs/promises');
@@ -1,5 +1,5 @@
1
- import { T as TSOps, a as analyzeValModule, f as flatMapErrors, b as formatSyntaxError, c as analyzeJsonValuesEntries, r as removeValJsonEntry, i as insertValJsonEntry, d as collectionReferencePatches, e as checkGalleryFiles, h as handleVideoUploadRemote, g as handleVideoDownloadRemote, j as handleVideosetMetadata, k as handleVideosetUploadRemote, l as handleVideosetCheckRemote, m as handleVideosetCheckAllFiles, n as canReadVideoMetadata, u as unreadableVideoMetadataMessage, o as localFilesWarning, p as openRemoteUploadSession, q as uploadBytesToRemote, s as getPersonalAccessTokenPath, V as ValOpsFS } from './ValRouter-558dc66d.esm.js';
2
- export { F as APP_MODE_REQUIRES_REMOTE_FILES, V as ValOpsFS, X as ValOpsHttp, a as analyzeValModule, R as checkRemoteRef, x as contentFromEnv, H as createFixPatch, t as createValApiRouter, D as createValOps, v as createValServer, a0 as decodeJwtWithoutVerifying, _ as describePatchStoreProblems, S as downloadFileFromRemote, a2 as encodeJwt, M as extractFileMetadata, L as extractImageMetadata, N as extractVideoMetadata, O as extractVideoMetadataFromFile, P as filesOfVideo, J as filesOfVideosetEntry, G as formatSyntaxErrorTree, U as getCachedRemoteFileDir, W as getCachedRemoteFilePath, a1 as getExpire, s as getPersonalAccessTokenPath, Q as getValidationErrorFileRef, m as handleVideosetCheckAllFiles, l as handleVideosetCheckRemote, j as handleVideosetMetadata, k as handleVideosetUploadRemote, C as initHandlerOptions, z as layeredSnapshot, Y as loadTypeScriptKit, K as parsePersonalAccessTokenFile, y as proposalFromEnv, A as proposalSnapshot, B as proposalSnapshotForReaders, Z as readPatchStore, E as resolveRemoteFileAuth, w as safeReadGit, $ as verifyJwt, I as videosetEntryVideoSchema } from './ValRouter-558dc66d.esm.js';
1
+ import { T as TSOps, a as analyzeValModule, f as flatMapErrors, b as formatSyntaxError, c as analyzeJsonValuesEntries, r as removeValJsonEntry, i as insertValJsonEntry, d as collectionReferencePatches, e as checkGalleryFiles, h as handleVideoUploadRemote, g as handleVideoDownloadRemote, j as handleVideosetMetadata, k as handleVideosetUploadRemote, l as handleVideosetCheckRemote, m as handleVideosetCheckAllFiles, n as canReadVideoMetadata, u as unreadableVideoMetadataMessage, o as localFilesWarning, p as openRemoteUploadSession, q as uploadBytesToRemote, s as getPersonalAccessTokenPath, V as ValOpsFS } from './ValRouter-b7dc784d.esm.js';
2
+ export { F as APP_MODE_REQUIRES_REMOTE_FILES, V as ValOpsFS, X as ValOpsHttp, a as analyzeValModule, R as checkRemoteRef, x as contentFromEnv, H as createFixPatch, t as createValApiRouter, D as createValOps, v as createValServer, a0 as decodeJwtWithoutVerifying, _ as describePatchStoreProblems, S as downloadFileFromRemote, a2 as encodeJwt, M as extractFileMetadata, L as extractImageMetadata, N as extractVideoMetadata, O as extractVideoMetadataFromFile, P as filesOfVideo, J as filesOfVideosetEntry, G as formatSyntaxErrorTree, U as getCachedRemoteFileDir, W as getCachedRemoteFilePath, a1 as getExpire, s as getPersonalAccessTokenPath, Q as getValidationErrorFileRef, m as handleVideosetCheckAllFiles, l as handleVideosetCheckRemote, j as handleVideosetMetadata, k as handleVideosetUploadRemote, C as initHandlerOptions, z as layeredSnapshot, Y as loadTypeScriptKit, K as parsePersonalAccessTokenFile, y as proposalFromEnv, A as proposalSnapshot, B as proposalSnapshotForReaders, Z as readPatchStore, E as resolveRemoteFileAuth, w as safeReadGit, $ as verifyJwt, I as videosetEntryVideoSchema } from './ValRouter-b7dc784d.esm.js';
3
3
  import { applyPatch, PatchError, JSONOps, deepClone } from '@valbuild/core/patch';
4
4
  import { pipe, result } from '@valbuild/core/fp';
5
5
  import { derefPatch, Internal, extractValModules, DEFAULT_CONTENT_HOST } from '@valbuild/core';
@@ -9,8 +9,8 @@ import path from 'path';
9
9
  import fs from 'fs';
10
10
  import vm from 'node:vm';
11
11
  import { Module } from 'node:module';
12
- import { r as resolveExistingJsonPath, f as findNestedJsonValuesRecords, v as validateJsonValuesEntries, g as getNewJsonEntryPaths, a as formatPatchSourceError, V as VAL_CLIENT_HEADERS } from './ValRouterCore-fe985e4c.esm.js';
13
- export { I as InMemoryPatchStore, e as ValOpsMemory, b as askOncePerHost, a as formatPatchSourceError, d as getFileExt, c as getSettings, u as uploadRemoteFile } from './ValRouterCore-fe985e4c.esm.js';
12
+ import { r as resolveExistingJsonPath, f as findNestedJsonValuesRecords, v as validateJsonValuesEntries, g as getNewJsonEntryPaths, a as formatPatchSourceError, V as VAL_CLIENT_HEADERS } from './ValRouterCore-be314bc7.esm.js';
13
+ export { I as InMemoryPatchStore, e as ValOpsMemory, b as askOncePerHost, a as formatPatchSourceError, d as getFileExt, c as getSettings, u as uploadRemoteFile } from './ValRouterCore-be314bc7.esm.js';
14
14
  import { isJsonValuesRootOp, rebaseContentOp, classifyJsonValuesOp, richTextImageSchema } from '@valbuild/shared/internal';
15
15
  export { classifyJsonValuesOp, rebaseContentOp } from '@valbuild/shared/internal';
16
16
  import { transform } from 'sucrase';
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var inTabFetch = require('../../../dist/inTabFetch-c8966e73.cjs.dev.js');
5
+ var inTabFetch = require('../../../dist/inTabFetch-5d0314a3.cjs.dev.js');
6
6
  var draftReads = require('../../../dist/draftReads-df44e629.cjs.dev.js');
7
7
  require('@valbuild/core');
8
- require('../../../dist/ValRouterCore-0c088c9e.cjs.dev.js');
8
+ require('../../../dist/ValRouterCore-361673dc.cjs.dev.js');
9
9
  require('zod');
10
10
  require('@valbuild/shared/internal');
11
11
  require('zod-validation-error');
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var inTabFetch = require('../../../dist/inTabFetch-f6694ad2.cjs.prod.js');
5
+ var inTabFetch = require('../../../dist/inTabFetch-56226d62.cjs.prod.js');
6
6
  var draftReads = require('../../../dist/draftReads-0dcddf72.cjs.prod.js');
7
7
  require('@valbuild/core');
8
- require('../../../dist/ValRouterCore-4be8eaf1.cjs.prod.js');
8
+ require('../../../dist/ValRouterCore-cfb35067.cjs.prod.js');
9
9
  require('zod');
10
10
  require('@valbuild/shared/internal');
11
11
  require('zod-validation-error');
@@ -1,7 +1,7 @@
1
- export { a as createInTabVal } from '../../../dist/inTabFetch-877e7d11.esm.js';
1
+ export { a as createInTabVal } from '../../../dist/inTabFetch-7c8a5628.esm.js';
2
2
  export { s as serverDraftSource } from '../../../dist/draftReads-1f29aedd.esm.js';
3
3
  import '@valbuild/core';
4
- import '../../../dist/ValRouterCore-fe985e4c.esm.js';
4
+ import '../../../dist/ValRouterCore-be314bc7.esm.js';
5
5
  import 'zod';
6
6
  import '@valbuild/shared/internal';
7
7
  import 'zod-validation-error';
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValRouter = require('../../dist/ValRouter-1f427c38.cjs.dev.js');
5
+ var ValRouter = require('../../dist/ValRouter-9505c550.cjs.dev.js');
6
6
  var draftReads = require('../../dist/draftReads-df44e629.cjs.dev.js');
7
- var ValRouterCore = require('../../dist/ValRouterCore-0c088c9e.cjs.dev.js');
7
+ var ValRouterCore = require('../../dist/ValRouterCore-361673dc.cjs.dev.js');
8
8
  require('@valbuild/core');
9
9
  require('@valbuild/ui/server');
10
10
  require('path');
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValRouter = require('../../dist/ValRouter-cd6e854a.cjs.prod.js');
5
+ var ValRouter = require('../../dist/ValRouter-31f89baf.cjs.prod.js');
6
6
  var draftReads = require('../../dist/draftReads-0dcddf72.cjs.prod.js');
7
- var ValRouterCore = require('../../dist/ValRouterCore-4be8eaf1.cjs.prod.js');
7
+ var ValRouterCore = require('../../dist/ValRouterCore-cfb35067.cjs.prod.js');
8
8
  require('@valbuild/core');
9
9
  require('@valbuild/ui/server');
10
10
  require('path');
@@ -1,6 +1,6 @@
1
- export { a3 as createValRuntime, a4 as proposalAsBuilt, a5 as servingBuildOf, a6 as stagedAfterBuild, a7 as valRuntime } from '../../dist/ValRouter-558dc66d.esm.js';
1
+ export { a3 as createValRuntime, a4 as proposalAsBuilt, a5 as servingBuildOf, a6 as stagedAfterBuild, a7 as valRuntime } from '../../dist/ValRouter-b7dc784d.esm.js';
2
2
  export { d as draftForRequest, r as readDraftChanges, s as serverDraftSource } from '../../dist/draftReads-1f29aedd.esm.js';
3
- export { W as HEAD_BUDGET_BYTES, X as HEAD_VERSIONS_PER_MODULE, T as ValHead, U as headWork } from '../../dist/ValRouterCore-fe985e4c.esm.js';
3
+ export { W as HEAD_BUDGET_BYTES, X as HEAD_VERSIONS_PER_MODULE, T as ValHead, U as headWork } from '../../dist/ValRouterCore-be314bc7.esm.js';
4
4
  import '@valbuild/core';
5
5
  import '@valbuild/ui/server';
6
6
  import 'path';
package/package.json CHANGED
@@ -37,7 +37,7 @@
37
37
  ],
38
38
  "exports": true
39
39
  },
40
- "version": "0.154.0",
40
+ "version": "0.154.1",
41
41
  "devDependencies": {
42
42
  "@prettier/sync": "^0.6.1",
43
43
  "@types/jest": "^30.0.0",
@@ -51,9 +51,9 @@
51
51
  "typescript": "^6.0.3",
52
52
  "zod": "^4.6.6",
53
53
  "zod-validation-error": "^5.0.0",
54
- "@valbuild/core": "0.153.5",
55
- "@valbuild/ui": "0.154.0",
56
- "@valbuild/shared": "0.154.0"
54
+ "@valbuild/shared": "0.154.1",
55
+ "@valbuild/ui": "0.154.1",
56
+ "@valbuild/core": "0.153.5"
57
57
  },
58
58
  "engines": {
59
59
  "node": "^20.19.0 || >=22"