@valbuild/server 0.154.3 → 0.155.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/browser/dist/valbuild-server-browser.cjs.dev.js +4 -4
  3. package/browser/dist/valbuild-server-browser.cjs.prod.js +4 -4
  4. package/browser/dist/valbuild-server-browser.esm.js +4 -4
  5. package/dist/{ValOpsMemory-972616ae.esm.js → ValOpsMemory-1a0bc2dc.esm.js} +33 -14
  6. package/dist/{ValOpsMemory-45ba05ad.cjs.dev.js → ValOpsMemory-6e829758.cjs.dev.js} +32 -12
  7. package/dist/{ValOpsMemory-18337353.cjs.prod.js → ValOpsMemory-f000531b.cjs.prod.js} +32 -12
  8. package/dist/{ValPatchStore-df8cdbe7.cjs.dev.js → ValPatchStore-457b166f.cjs.prod.js} +37 -59
  9. package/dist/{ValPatchStore-e23070df.esm.js → ValPatchStore-9ccc09e7.esm.js} +38 -60
  10. package/dist/{ValPatchStore-2f92eced.cjs.prod.js → ValPatchStore-b53db740.cjs.dev.js} +37 -59
  11. package/dist/{ValRouterCore-86757d56.cjs.dev.js → ValRouterCore-65bb6323.cjs.prod.js} +11 -2
  12. package/dist/{ValRouterCore-5b747abb.cjs.prod.js → ValRouterCore-adb69698.cjs.dev.js} +11 -2
  13. package/dist/{ValRouterCore-73eb843d.esm.js → ValRouterCore-f7d6394e.esm.js} +11 -2
  14. package/dist/{createPrettierFormatter-851fcf99.cjs.dev.js → createPrettierFormatter-5d830bdf.cjs.dev.js} +6 -14
  15. package/dist/{createPrettierFormatter-05ad7480.cjs.prod.js → createPrettierFormatter-b31bfbe5.cjs.prod.js} +6 -14
  16. package/dist/{createPrettierFormatter-1edca494.esm.js → createPrettierFormatter-ce478de1.esm.js} +7 -15
  17. package/dist/{createValRuntime-5cebf459.cjs.dev.js → createValRuntime-1c7d891e.cjs.dev.js} +5 -5
  18. package/dist/{createValRuntime-472df6e8.cjs.prod.js → createValRuntime-a519939b.cjs.prod.js} +5 -5
  19. package/dist/{createValRuntime-c77ee010.esm.js → createValRuntime-f55300a0.esm.js} +5 -5
  20. package/dist/declarations/src/draftReads.d.ts +5 -0
  21. package/dist/declarations/src/head.d.ts +7 -7
  22. package/dist/{draftReads-3f7dcda5.cjs.prod.js → draftReads-1f256502.cjs.dev.js} +5 -0
  23. package/dist/{draftReads-a300a02f.cjs.dev.js → draftReads-27351e97.cjs.prod.js} +5 -0
  24. package/dist/{draftReads-bca0d49c.esm.js → draftReads-7f0f0eb3.esm.js} +5 -0
  25. package/dist/{inTabFetch-c2efa1bd.cjs.prod.js → inTabFetch-3d8ceb84.cjs.prod.js} +2 -2
  26. package/dist/{inTabFetch-db6d6425.cjs.dev.js → inTabFetch-75753a09.cjs.dev.js} +2 -2
  27. package/dist/{inTabFetch-0c997998.esm.js → inTabFetch-dae5dd87.esm.js} +2 -2
  28. package/dist/{proposalJsonEntries-0669f027.esm.js → proposalJsonEntries-2cd6f6fe.esm.js} +1 -1
  29. package/dist/{proposalJsonEntries-26f397bd.cjs.dev.js → proposalJsonEntries-d21900d4.cjs.dev.js} +1 -1
  30. package/dist/{proposalJsonEntries-9e537244.cjs.prod.js → proposalJsonEntries-d4623810.cjs.prod.js} +1 -1
  31. package/dist/{publishKit-ac0af189.esm.js → publishKit-04b6d255.esm.js} +7 -7
  32. package/dist/{publishKit-7aca03bb.cjs.prod.js → publishKit-395b92e5.cjs.prod.js} +5 -5
  33. package/dist/{publishKit-38d46a51.cjs.dev.js → publishKit-de4baed6.cjs.dev.js} +5 -5
  34. package/dist/{valRuntime-e4d26702.esm.js → valRuntime-7fd12e16.esm.js} +42 -24
  35. package/dist/{valRuntime-70ee2dc2.cjs.dev.js → valRuntime-d3cc6e0d.cjs.dev.js} +41 -23
  36. package/dist/{valRuntime-2a3cc887.cjs.prod.js → valRuntime-e922e372.cjs.prod.js} +41 -23
  37. package/dist/valbuild-server.cjs.dev.js +6 -6
  38. package/dist/valbuild-server.cjs.prod.js +6 -6
  39. package/dist/valbuild-server.esm.js +9 -9
  40. package/internal/browser/dist/valbuild-server-internal-browser.cjs.dev.js +5 -5
  41. package/internal/browser/dist/valbuild-server-internal-browser.cjs.prod.js +5 -5
  42. package/internal/browser/dist/valbuild-server-internal-browser.esm.js +5 -5
  43. package/internal/dist/valbuild-server-internal.cjs.dev.js +4 -4
  44. package/internal/dist/valbuild-server-internal.cjs.prod.js +4 -4
  45. package/internal/dist/valbuild-server-internal.esm.js +4 -4
  46. package/package.json +4 -4
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@valbuild/core');
4
- var ValOpsMemory = require('./ValOpsMemory-18337353.cjs.prod.js');
5
- var ValRouterCore = require('./ValRouterCore-5b747abb.cjs.prod.js');
4
+ var ValOpsMemory = require('./ValOpsMemory-f000531b.cjs.prod.js');
5
+ var ValRouterCore = require('./ValRouterCore-65bb6323.cjs.prod.js');
6
6
 
7
7
  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.";
8
8
 
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@valbuild/core');
4
- var ValOpsMemory = require('./ValOpsMemory-45ba05ad.cjs.dev.js');
5
- var ValRouterCore = require('./ValRouterCore-86757d56.cjs.dev.js');
4
+ var ValOpsMemory = require('./ValOpsMemory-6e829758.cjs.dev.js');
5
+ var ValRouterCore = require('./ValRouterCore-adb69698.cjs.dev.js');
6
6
 
7
7
  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.";
8
8
 
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_CONTENT_HOST } from '@valbuild/core';
2
- import { o as ValOpsMemory, K as bytesToBase64, V as ValServer } from './ValOpsMemory-972616ae.esm.js';
3
- import { c as createValRequestHandler } from './ValRouterCore-73eb843d.esm.js';
2
+ import { o as ValOpsMemory, L as bytesToBase64, V as ValServer } from './ValOpsMemory-1a0bc2dc.esm.js';
3
+ import { c as createValRequestHandler } from './ValRouterCore-f7d6394e.esm.js';
4
4
 
5
5
  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.";
6
6
 
@@ -1,7 +1,7 @@
1
1
  import { result, pipe } from '@valbuild/core/fp';
2
2
  import ts from 'typescript';
3
3
  import { r as resolveExistingJsonPath } from './jsonValuesPatch-13acc674.esm.js';
4
- import { a as proposalSnapshot, i as isObject, d as isJsonValue } from './createPrettierFormatter-1edca494.esm.js';
4
+ import { a as proposalSnapshot, i as isObject, d as isJsonValue } from './createPrettierFormatter-ce478de1.esm.js';
5
5
 
6
6
  class ValSyntaxError {
7
7
  constructor(message, node) {
@@ -3,7 +3,7 @@
3
3
  var fp = require('@valbuild/core/fp');
4
4
  var ts = require('typescript');
5
5
  var jsonValuesPatch = require('./jsonValuesPatch-88bc661d.cjs.dev.js');
6
- var createPrettierFormatter = require('./createPrettierFormatter-851fcf99.cjs.dev.js');
6
+ var createPrettierFormatter = require('./createPrettierFormatter-5d830bdf.cjs.dev.js');
7
7
 
8
8
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
9
9
 
@@ -3,7 +3,7 @@
3
3
  var fp = require('@valbuild/core/fp');
4
4
  var ts = require('typescript');
5
5
  var jsonValuesPatch = require('./jsonValuesPatch-92798812.cjs.prod.js');
6
- var createPrettierFormatter = require('./createPrettierFormatter-05ad7480.cjs.prod.js');
6
+ var createPrettierFormatter = require('./createPrettierFormatter-b31bfbe5.cjs.prod.js');
7
7
 
8
8
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
9
9
 
@@ -1,11 +1,11 @@
1
1
  import ts from 'typescript';
2
2
  import { result, pipe } from '@valbuild/core/fp';
3
- import { T as TSOps } from './valRuntime-e4d26702.esm.js';
4
- export { h as insertValJsonEntry, f as removeValJsonEntry } from './valRuntime-e4d26702.esm.js';
5
- import { a as analyzeValModule, c as analyzeJsonValuesEntries } from './proposalJsonEntries-0669f027.esm.js';
6
- export { c as analyzeJsonValuesEntries, a as analyzeValModule, j as evaluateModuleSource, k as jsonValuesRecordKeys } from './proposalJsonEntries-0669f027.esm.js';
3
+ import { T as TSOps } from './valRuntime-7fd12e16.esm.js';
4
+ export { h as insertValJsonEntry, f as removeValJsonEntry } from './valRuntime-7fd12e16.esm.js';
5
+ import { a as analyzeValModule, c as analyzeJsonValuesEntries } from './proposalJsonEntries-2cd6f6fe.esm.js';
6
+ export { c as analyzeJsonValuesEntries, a as analyzeValModule, j as evaluateModuleSource, k as jsonValuesRecordKeys } from './proposalJsonEntries-2cd6f6fe.esm.js';
7
7
  import { p as posixPath } from './jsonValuesPatch-13acc674.esm.js';
8
- import { L as bytesToUtf8 } from './ValOpsMemory-972616ae.esm.js';
8
+ import { N as bytesToUtf8 } from './ValOpsMemory-1a0bc2dc.esm.js';
9
9
  import '@valbuild/core';
10
10
  import 'path';
11
11
  import 'zod';
@@ -15,11 +15,11 @@ import '@valbuild/shared/internal';
15
15
  import 'os';
16
16
  import 'crypto';
17
17
  import 'buffer';
18
- import './createPrettierFormatter-1edca494.esm.js';
18
+ import './createPrettierFormatter-ce478de1.esm.js';
19
19
  import '@valbuild/core/patch';
20
20
  import 'node:vm';
21
21
  import 'node:module';
22
- import './ValPatchStore-e23070df.esm.js';
22
+ import './ValPatchStore-9ccc09e7.esm.js';
23
23
  import 'image-size';
24
24
 
25
25
  /**
@@ -2,10 +2,10 @@
2
2
 
3
3
  var ts = require('typescript');
4
4
  var fp = require('@valbuild/core/fp');
5
- var valRuntime = require('./valRuntime-2a3cc887.cjs.prod.js');
6
- var proposalJsonEntries = require('./proposalJsonEntries-9e537244.cjs.prod.js');
5
+ var valRuntime = require('./valRuntime-e922e372.cjs.prod.js');
6
+ var proposalJsonEntries = require('./proposalJsonEntries-d4623810.cjs.prod.js');
7
7
  var jsonValuesPatch = require('./jsonValuesPatch-92798812.cjs.prod.js');
8
- var ValOpsMemory = require('./ValOpsMemory-18337353.cjs.prod.js');
8
+ var ValOpsMemory = require('./ValOpsMemory-f000531b.cjs.prod.js');
9
9
  require('@valbuild/core');
10
10
  require('path');
11
11
  require('zod');
@@ -15,11 +15,11 @@ require('@valbuild/shared/internal');
15
15
  require('os');
16
16
  require('crypto');
17
17
  require('buffer');
18
- require('./createPrettierFormatter-05ad7480.cjs.prod.js');
18
+ require('./createPrettierFormatter-b31bfbe5.cjs.prod.js');
19
19
  require('@valbuild/core/patch');
20
20
  require('node:vm');
21
21
  require('node:module');
22
- require('./ValPatchStore-2f92eced.cjs.prod.js');
22
+ require('./ValPatchStore-457b166f.cjs.prod.js');
23
23
  require('image-size');
24
24
 
25
25
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -2,10 +2,10 @@
2
2
 
3
3
  var ts = require('typescript');
4
4
  var fp = require('@valbuild/core/fp');
5
- var valRuntime = require('./valRuntime-70ee2dc2.cjs.dev.js');
6
- var proposalJsonEntries = require('./proposalJsonEntries-26f397bd.cjs.dev.js');
5
+ var valRuntime = require('./valRuntime-d3cc6e0d.cjs.dev.js');
6
+ var proposalJsonEntries = require('./proposalJsonEntries-d21900d4.cjs.dev.js');
7
7
  var jsonValuesPatch = require('./jsonValuesPatch-88bc661d.cjs.dev.js');
8
- var ValOpsMemory = require('./ValOpsMemory-45ba05ad.cjs.dev.js');
8
+ var ValOpsMemory = require('./ValOpsMemory-6e829758.cjs.dev.js');
9
9
  require('@valbuild/core');
10
10
  require('path');
11
11
  require('zod');
@@ -15,11 +15,11 @@ require('@valbuild/shared/internal');
15
15
  require('os');
16
16
  require('crypto');
17
17
  require('buffer');
18
- require('./createPrettierFormatter-851fcf99.cjs.dev.js');
18
+ require('./createPrettierFormatter-5d830bdf.cjs.dev.js');
19
19
  require('@valbuild/core/patch');
20
20
  require('node:vm');
21
21
  require('node:module');
22
- require('./ValPatchStore-df8cdbe7.cjs.dev.js');
22
+ require('./ValPatchStore-b53db740.cjs.dev.js');
23
23
  require('image-size');
24
24
 
25
25
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -1,18 +1,18 @@
1
1
  import { Internal, deserializeSchema, DEFAULT_CONTENT_HOST } from '@valbuild/core';
2
- import { q as summaryOf, t as matchesFilter, w as byUpdatedAt, x as newSketchpad, y as isSketchpadId, z as applySketchpadChange, A as ValOps, h as VAL_CLIENT_HEADERS, B as isSafePatchId, C as isMediaFilePath, M as MEDIA_FILE_PATH_ACCEPTS, D as bufferFromDataUrl, d as getFieldsForType, u as uploadRemoteFile, g as getFileExt, E as isPublicFilePath, F as guessMimeTypeFromPath, G as createMetadataFromBuffer, H as DEFAULT_ANALYTICS_INGEST_URL, o as ValOpsMemory, I as sessionAuth, J as isHttpOps } from './ValOpsMemory-972616ae.esm.js';
2
+ import { q as summaryOf, t as matchesFilter, w as byUpdatedAt, x as newSketchpad, y as isSketchpadId, z as applySketchpadChange, A as ValOps, h as VAL_CLIENT_HEADERS, B as isSafePatchId, C as isMediaFilePath, M as MEDIA_FILE_PATH_ACCEPTS, D as bufferFromDataUrl, d as getFieldsForType, u as uploadRemoteFile, g as getFileExt, E as isPublicFilePath, F as guessMimeTypeFromPath, G as createMetadataFromBuffer, H as fetchFresh, I as DEFAULT_ANALYTICS_INGEST_URL, o as ValOpsMemory, J as sessionAuth, K as isHttpOps } from './ValOpsMemory-1a0bc2dc.esm.js';
3
3
  import path from 'path';
4
4
  import ts from 'typescript';
5
5
  import { z } from 'zod';
6
6
  import fs from 'fs';
7
7
  import { fromError } from 'zod-validation-error';
8
8
  import { pipe, result } from '@valbuild/core/fp';
9
- import { a as analyzeValModule, e as findObjectPropertyAssignment, g as findObjectPropertyAssignmentToRemove, h as evaluateExpression, s as shallowValidateExpression, v as validateInitializers, c as analyzeJsonValuesEntries, i as proposalJsonEntries } from './proposalJsonEntries-0669f027.esm.js';
9
+ import { a as analyzeValModule, e as findObjectPropertyAssignment, g as findObjectPropertyAssignmentToRemove, h as evaluateExpression, s as shallowValidateExpression, v as validateInitializers, c as analyzeJsonValuesEntries, i as proposalJsonEntries } from './proposalJsonEntries-2cd6f6fe.esm.js';
10
10
  import { r as resolveExistingJsonPath } from './jsonValuesPatch-13acc674.esm.js';
11
- import { Patch, Sketchpad, schemaErrorsOf, PatchSets, joinSharedChanges, schemaTypesOfPath, sideFiles, sideSource, JSONValue, SketchpadSummary, getErrorMessageFromUnknownJson, PlanRefusalError, PatchId as PatchId$1, SerializedSchema, valModulesEntryPath, newestCommitSha } from '@valbuild/shared/internal';
11
+ import { Patch, Sketchpad, schemaErrorsOf, PatchSets, joinSharedChanges, schemaTypesOfPath, sideFiles, sideSource, JSONValue, SketchpadSummary, getErrorMessageFromUnknownJson, PlanRefusalError, PatchId as PatchId$1, SerializedSchema, valModulesEntryPath, newestCommitSha, isCrossRequestError } from '@valbuild/shared/internal';
12
12
  import os from 'os';
13
13
  import crypto$1, { randomBytes, createHash } from 'crypto';
14
14
  import { Buffer as Buffer$1 } from 'buffer';
15
- import { l as layeredSnapshot, s as stagedAfterBuild, e as servingBuildOf, a as proposalSnapshot, n as namedMode, f as selectsHttpMode } from './createPrettierFormatter-1edca494.esm.js';
15
+ import { l as layeredSnapshot, s as stagedAfterBuild, e as servingBuildOf, a as proposalSnapshot, n as namedMode, f as selectsHttpMode } from './createPrettierFormatter-ce478de1.esm.js';
16
16
  import { PatchError, deepEqual, isNotRoot, parseAndValidateArrayIndex, applyPatch, deepClone, JSONOps } from '@valbuild/core/patch';
17
17
  import 'node:vm';
18
18
  import 'node:module';
@@ -1861,7 +1861,7 @@ function createFsSketchpadStore(rootDir, now = () => new Date()) {
1861
1861
  * as a bundler does.
1862
1862
  */
1863
1863
  function loadTypeScriptKit() {
1864
- return import('./publishKit-ac0af189.esm.js');
1864
+ return import('./publishKit-04b6d255.esm.js');
1865
1865
  }
1866
1866
 
1867
1867
  /** Serializes a schema, or gives up quietly — serialization errors are reported elsewhere. */
@@ -4164,7 +4164,7 @@ async function stagedModuleSources(files) {
4164
4164
  parseValFile,
4165
4165
  analyzeValModule,
4166
4166
  evaluateModuleSource
4167
- } = await import('./publishKit-ac0af189.esm.js');
4167
+ } = await import('./publishKit-04b6d255.esm.js');
4168
4168
  const sources = {};
4169
4169
  for (const {
4170
4170
  path,
@@ -5120,7 +5120,7 @@ class ValOpsHttp extends ValOps {
5120
5120
  branch
5121
5121
  })}` : "";
5122
5122
  try {
5123
- const res = await fetch(`${this.contentUrl}/v1/${this.project}/chain/version${query}`, {
5123
+ const res = await fetchFresh(`${this.contentUrl}/v1/${this.project}/chain/version${query}`, {
5124
5124
  headers: this.authHeaders
5125
5125
  });
5126
5126
  if (res.status === 404) {
@@ -5281,7 +5281,7 @@ class ValOpsHttp extends ValOps {
5281
5281
  * rather than letting the tab talk to content.
5282
5282
  */
5283
5283
  async mintPublishToken() {
5284
- const res = await fetch(`${this.contentUrl}/v1/${this.project}/publish-token`, {
5284
+ const res = await fetchFresh(`${this.contentUrl}/v1/${this.project}/publish-token`, {
5285
5285
  method: "POST",
5286
5286
  headers: this.authHeaders
5287
5287
  });
@@ -5565,7 +5565,7 @@ class ValOpsHttp extends ValOps {
5565
5565
  }
5566
5566
  // Staged module files go with the Source they declare.
5567
5567
  const body = (writes === null || writes === void 0 ? void 0 : writes.write) === "files" && init.body !== undefined ? await withStagedModuleSources(init.body) : init.body;
5568
- const res = await fetch(`${this.contentUrl}/v1/${this.project}/proposals${path}`, {
5568
+ const res = await fetchFresh(`${this.contentUrl}/v1/${this.project}/proposals${path}`, {
5569
5569
  method: init.method,
5570
5570
  headers: {
5571
5571
  ...this.authHeaders,
@@ -5632,7 +5632,7 @@ class ValOpsHttp extends ValOps {
5632
5632
  message: `Invalid update: ${fromError(request.error).toString()}`
5633
5633
  });
5634
5634
  }
5635
- const content = (path, init = {}) => fetch(`${this.contentUrl}/v1/${this.project}/proposals/${name}${path}`, {
5635
+ const content = (path, init = {}) => fetchFresh(`${this.contentUrl}/v1/${this.project}/proposals/${name}${path}`, {
5636
5636
  ...init,
5637
5637
  headers: {
5638
5638
  ...this.authHeaders,
@@ -5749,7 +5749,7 @@ class ValOpsHttp extends ValOps {
5749
5749
 
5750
5750
  /** Content's proposals API for one proposal, as the person asking. */
5751
5751
  proposalContent(name, profileId) {
5752
- return (path, init = {}) => fetch(`${this.contentUrl}/v1/${this.project}/proposals/${name}${path}`, {
5752
+ return (path, init = {}) => fetchFresh(`${this.contentUrl}/v1/${this.project}/proposals/${name}${path}`, {
5753
5753
  ...init,
5754
5754
  headers: {
5755
5755
  ...this.authHeaders,
@@ -5909,7 +5909,7 @@ class ValOpsHttp extends ValOps {
5909
5909
  message: `Invalid update: ${fromError(request.error).toString()}`
5910
5910
  });
5911
5911
  }
5912
- const content = (path, init = {}) => fetch(`${this.contentUrl}/v1/${this.project}/proposals/${name}${path}`, {
5912
+ const content = (path, init = {}) => fetchFresh(`${this.contentUrl}/v1/${this.project}/proposals/${name}${path}`, {
5913
5913
  ...init,
5914
5914
  headers: {
5915
5915
  ...this.authHeaders,
@@ -6019,7 +6019,7 @@ class ValOpsHttp extends ValOps {
6019
6019
  }
6020
6020
  async callPublishApi(path, init) {
6021
6021
  const json = "application/json";
6022
- const send = async token => fetch(`${this.contentUrl}/v1${path}`, {
6022
+ const send = async token => fetchFresh(`${this.contentUrl}/v1${path}`, {
6023
6023
  method: init.method,
6024
6024
  headers: {
6025
6025
  ...VAL_CLIENT_HEADERS,
@@ -6086,7 +6086,7 @@ class ValOpsHttp extends ValOps {
6086
6086
  async getPresignedAuthNonce(profileId, corsOrigin) {
6087
6087
  try {
6088
6088
  var _res$headers$get2;
6089
- const res = await fetch(`${this.contentUrl}/v1/${this.project}/presigned-auth-nonce`, {
6089
+ const res = await fetchFresh(`${this.contentUrl}/v1/${this.project}/presigned-auth-nonce`, {
6090
6090
  method: "POST",
6091
6091
  headers: {
6092
6092
  ...this.authHeaders,
@@ -6413,7 +6413,7 @@ class ValOpsHttp extends ValOps {
6413
6413
  * `applicable/patches`), so its `patches` messages and that stat agree.
6414
6414
  */
6415
6415
  relativeTo) {
6416
- return fetch(`${this.contentUrl}/v1/${this.project}/websocket/nonces`, {
6416
+ return fetchFresh(`${this.contentUrl}/v1/${this.project}/websocket/nonces`, {
6417
6417
  method: "POST",
6418
6418
  body: JSON.stringify({
6419
6419
  profileId,
@@ -6663,7 +6663,7 @@ class ValOpsHttp extends ValOps {
6663
6663
  }
6664
6664
  const searchParams = new URLSearchParams(params);
6665
6665
  try {
6666
- const patchesRes = await fetch(`${this.contentUrl}/v1/${this.project}/applicable/patches${searchParams.size > 0 ? `?${searchParams.toString()}` : ""}`, {
6666
+ const patchesRes = await fetchFresh(`${this.contentUrl}/v1/${this.project}/applicable/patches${searchParams.size > 0 ? `?${searchParams.toString()}` : ""}`, {
6667
6667
  headers: this.authHeaders
6668
6668
  });
6669
6669
  const patches = [];
@@ -6797,6 +6797,24 @@ class ValOpsHttp extends ValOps {
6797
6797
  }
6798
6798
  };
6799
6799
  } catch (err) {
6800
+ if (isCrossRequestError(err)) {
6801
+ /*
6802
+ * Not the network: workerd refused, at once, a promise or I/O object
6803
+ * of another request, so nothing was asked of the content service.
6804
+ * `fetchFresh` already tried once more. A server failure, then --
6805
+ * never `networkError`, which `/stat` answers as a 503 saying the
6806
+ * service could not be reached.
6807
+ */
6808
+ const details = err instanceof Error ? err.message : String(err);
6809
+ Internal.log.error(`Could not get patches. ${details}`);
6810
+ return {
6811
+ patches: [],
6812
+ error: {
6813
+ message: "Val's server could not load your changes, because of an error in Val itself. Trying again usually works.",
6814
+ details
6815
+ }
6816
+ };
6817
+ }
6800
6818
  const failure = contentServiceUnreachable(contentServiceName(this.contentUrl), "load your changes", err);
6801
6819
  Internal.log.error(`Could not get patches. ${failure.message} ${failure.details}`);
6802
6820
  return {
@@ -6811,7 +6829,7 @@ class ValOpsHttp extends ValOps {
6811
6829
  }
6812
6830
  async saveSourceFilePatch(path, patch, patchId, parentRef, authorId, sessionId) {
6813
6831
  const baseSha = await this.getBaseSha();
6814
- return fetch(`${this.contentUrl}/v1/${this.project}/patches`, {
6832
+ return fetchFresh(`${this.contentUrl}/v1/${this.project}/patches`, {
6815
6833
  method: "POST",
6816
6834
  headers: {
6817
6835
  ...this.authHeaders,
@@ -6921,7 +6939,7 @@ class ValOpsHttp extends ValOps {
6921
6939
  */
6922
6940
  async saveBase64EncodedBinaryFileFromPatch(filePathOrRef, parentRef, patchId, data, type, metadata) {
6923
6941
  const filePath = filePathOrRef;
6924
- return fetch(`${this.contentUrl}/v1/${this.project}/patches/${patchId}/files`, {
6942
+ return fetchFresh(`${this.contentUrl}/v1/${this.project}/patches/${patchId}/files`, {
6925
6943
  method: "POST",
6926
6944
  headers: {
6927
6945
  ...this.authHeaders,
@@ -6976,7 +6994,7 @@ class ValOpsHttp extends ValOps {
6976
6994
  params.set("body_sha",
6977
6995
  // We use this for cache invalidation
6978
6996
  Internal.getSHA256Hash(textEncoder.encode(stringifiedFiles)));
6979
- return fetch(`${this.contentUrl}/v1/${this.project}/files?${params}`, {
6997
+ return fetchFresh(`${this.contentUrl}/v1/${this.project}/files?${params}`, {
6980
6998
  method: "PUT",
6981
6999
  // Yes, PUT is weird. Weirder to have a body in a GET request.
6982
7000
  headers: {
@@ -7133,7 +7151,7 @@ class ValOpsHttp extends ValOps {
7133
7151
  params.set("file_path", filePath);
7134
7152
  params.set("remote", remote.toString());
7135
7153
  try {
7136
- const metadataRes = await fetch(`${this.contentUrl}/v1/${this.project}/patches/${patchId}/files?${params}`, {
7154
+ const metadataRes = await fetchFresh(`${this.contentUrl}/v1/${this.project}/patches/${patchId}/files?${params}`, {
7137
7155
  headers: {
7138
7156
  ...this.authHeaders,
7139
7157
  "Content-Type": "application/json"
@@ -7191,7 +7209,7 @@ class ValOpsHttp extends ValOps {
7191
7209
  };
7192
7210
  }
7193
7211
  async deletePatches(patchIds) {
7194
- return fetch(`${this.contentUrl}/v1/${this.project}/patches`, {
7212
+ return fetchFresh(`${this.contentUrl}/v1/${this.project}/patches`, {
7195
7213
  method: "DELETE",
7196
7214
  headers: {
7197
7215
  ...this.authHeaders,
@@ -7263,7 +7281,7 @@ class ValOpsHttp extends ValOps {
7263
7281
  */
7264
7282
  const proposalName = intoProposal ?? ((_this$proposal4 = this.proposal) === null || _this$proposal4 === void 0 ? void 0 : _this$proposal4.name);
7265
7283
  const commitUrl = proposalName !== undefined ? `${this.contentUrl}/v1/${this.project}/proposals/${proposalName}/save` : `${this.contentUrl}/v1/${this.project}/commit`;
7266
- const res = await fetch(commitUrl, {
7284
+ const res = await fetchFresh(commitUrl, {
7267
7285
  method: "POST",
7268
7286
  headers: {
7269
7287
  ...this.authHeaders,
@@ -7399,7 +7417,7 @@ class ValOpsHttp extends ValOps {
7399
7417
  async getHistory(path, schema, commitShaForErrors) {
7400
7418
  let res;
7401
7419
  try {
7402
- res = await fetch(`${this.contentUrl}/v1/${this.project}${path}`, {
7420
+ res = await fetchFresh(`${this.contentUrl}/v1/${this.project}${path}`, {
7403
7421
  headers: {
7404
7422
  ...this.authHeaders,
7405
7423
  "Content-Type": "application/json"
@@ -7550,7 +7568,7 @@ class ValOpsHttp extends ValOps {
7550
7568
  }
7551
7569
  let res;
7552
7570
  try {
7553
- res = await fetch(`${this.contentUrl}/v1/${this.project}/commits/${commitSha}/file?${params}`, {
7571
+ res = await fetchFresh(`${this.contentUrl}/v1/${this.project}/commits/${commitSha}/file?${params}`, {
7554
7572
  headers: {
7555
7573
  ...this.authHeaders
7556
7574
  }
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@valbuild/core');
4
- var ValOpsMemory = require('./ValOpsMemory-45ba05ad.cjs.dev.js');
4
+ var ValOpsMemory = require('./ValOpsMemory-6e829758.cjs.dev.js');
5
5
  var path = require('path');
6
6
  var ts = require('typescript');
7
7
  var z = require('zod');
8
8
  var fs = require('fs');
9
9
  var zodValidationError = require('zod-validation-error');
10
10
  var fp = require('@valbuild/core/fp');
11
- var proposalJsonEntries = require('./proposalJsonEntries-26f397bd.cjs.dev.js');
11
+ var proposalJsonEntries = require('./proposalJsonEntries-d21900d4.cjs.dev.js');
12
12
  var jsonValuesPatch = require('./jsonValuesPatch-88bc661d.cjs.dev.js');
13
13
  var internal = require('@valbuild/shared/internal');
14
14
  var os = require('os');
15
15
  var crypto$1 = require('crypto');
16
16
  var buffer = require('buffer');
17
- var createPrettierFormatter = require('./createPrettierFormatter-851fcf99.cjs.dev.js');
17
+ var createPrettierFormatter = require('./createPrettierFormatter-5d830bdf.cjs.dev.js');
18
18
  var patch = require('@valbuild/core/patch');
19
19
  require('node:vm');
20
20
  require('node:module');
@@ -1889,7 +1889,7 @@ function createFsSketchpadStore(rootDir, now = () => new Date()) {
1889
1889
  * as a bundler does.
1890
1890
  */
1891
1891
  function loadTypeScriptKit() {
1892
- return Promise.resolve().then(function () { return require('./publishKit-38d46a51.cjs.dev.js'); });
1892
+ return Promise.resolve().then(function () { return require('./publishKit-de4baed6.cjs.dev.js'); });
1893
1893
  }
1894
1894
 
1895
1895
  /** Serializes a schema, or gives up quietly — serialization errors are reported elsewhere. */
@@ -4192,7 +4192,7 @@ async function stagedModuleSources(files) {
4192
4192
  parseValFile,
4193
4193
  analyzeValModule,
4194
4194
  evaluateModuleSource
4195
- } = await Promise.resolve().then(function () { return require('./publishKit-38d46a51.cjs.dev.js'); });
4195
+ } = await Promise.resolve().then(function () { return require('./publishKit-de4baed6.cjs.dev.js'); });
4196
4196
  const sources = {};
4197
4197
  for (const {
4198
4198
  path,
@@ -5148,7 +5148,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
5148
5148
  branch
5149
5149
  })}` : "";
5150
5150
  try {
5151
- const res = await fetch(`${this.contentUrl}/v1/${this.project}/chain/version${query}`, {
5151
+ const res = await ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/chain/version${query}`, {
5152
5152
  headers: this.authHeaders
5153
5153
  });
5154
5154
  if (res.status === 404) {
@@ -5309,7 +5309,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
5309
5309
  * rather than letting the tab talk to content.
5310
5310
  */
5311
5311
  async mintPublishToken() {
5312
- const res = await fetch(`${this.contentUrl}/v1/${this.project}/publish-token`, {
5312
+ const res = await ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/publish-token`, {
5313
5313
  method: "POST",
5314
5314
  headers: this.authHeaders
5315
5315
  });
@@ -5593,7 +5593,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
5593
5593
  }
5594
5594
  // Staged module files go with the Source they declare.
5595
5595
  const body = (writes === null || writes === void 0 ? void 0 : writes.write) === "files" && init.body !== undefined ? await withStagedModuleSources(init.body) : init.body;
5596
- const res = await fetch(`${this.contentUrl}/v1/${this.project}/proposals${path}`, {
5596
+ const res = await ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/proposals${path}`, {
5597
5597
  method: init.method,
5598
5598
  headers: {
5599
5599
  ...this.authHeaders,
@@ -5660,7 +5660,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
5660
5660
  message: `Invalid update: ${zodValidationError.fromError(request.error).toString()}`
5661
5661
  });
5662
5662
  }
5663
- const content = (path, init = {}) => fetch(`${this.contentUrl}/v1/${this.project}/proposals/${name}${path}`, {
5663
+ const content = (path, init = {}) => ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/proposals/${name}${path}`, {
5664
5664
  ...init,
5665
5665
  headers: {
5666
5666
  ...this.authHeaders,
@@ -5777,7 +5777,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
5777
5777
 
5778
5778
  /** Content's proposals API for one proposal, as the person asking. */
5779
5779
  proposalContent(name, profileId) {
5780
- return (path, init = {}) => fetch(`${this.contentUrl}/v1/${this.project}/proposals/${name}${path}`, {
5780
+ return (path, init = {}) => ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/proposals/${name}${path}`, {
5781
5781
  ...init,
5782
5782
  headers: {
5783
5783
  ...this.authHeaders,
@@ -5937,7 +5937,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
5937
5937
  message: `Invalid update: ${zodValidationError.fromError(request.error).toString()}`
5938
5938
  });
5939
5939
  }
5940
- const content = (path, init = {}) => fetch(`${this.contentUrl}/v1/${this.project}/proposals/${name}${path}`, {
5940
+ const content = (path, init = {}) => ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/proposals/${name}${path}`, {
5941
5941
  ...init,
5942
5942
  headers: {
5943
5943
  ...this.authHeaders,
@@ -6047,7 +6047,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
6047
6047
  }
6048
6048
  async callPublishApi(path, init) {
6049
6049
  const json = "application/json";
6050
- const send = async token => fetch(`${this.contentUrl}/v1${path}`, {
6050
+ const send = async token => ValOpsMemory.fetchFresh(`${this.contentUrl}/v1${path}`, {
6051
6051
  method: init.method,
6052
6052
  headers: {
6053
6053
  ...ValOpsMemory.VAL_CLIENT_HEADERS,
@@ -6114,7 +6114,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
6114
6114
  async getPresignedAuthNonce(profileId, corsOrigin) {
6115
6115
  try {
6116
6116
  var _res$headers$get2;
6117
- const res = await fetch(`${this.contentUrl}/v1/${this.project}/presigned-auth-nonce`, {
6117
+ const res = await ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/presigned-auth-nonce`, {
6118
6118
  method: "POST",
6119
6119
  headers: {
6120
6120
  ...this.authHeaders,
@@ -6441,7 +6441,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
6441
6441
  * `applicable/patches`), so its `patches` messages and that stat agree.
6442
6442
  */
6443
6443
  relativeTo) {
6444
- return fetch(`${this.contentUrl}/v1/${this.project}/websocket/nonces`, {
6444
+ return ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/websocket/nonces`, {
6445
6445
  method: "POST",
6446
6446
  body: JSON.stringify({
6447
6447
  profileId,
@@ -6691,7 +6691,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
6691
6691
  }
6692
6692
  const searchParams = new URLSearchParams(params);
6693
6693
  try {
6694
- const patchesRes = await fetch(`${this.contentUrl}/v1/${this.project}/applicable/patches${searchParams.size > 0 ? `?${searchParams.toString()}` : ""}`, {
6694
+ const patchesRes = await ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/applicable/patches${searchParams.size > 0 ? `?${searchParams.toString()}` : ""}`, {
6695
6695
  headers: this.authHeaders
6696
6696
  });
6697
6697
  const patches = [];
@@ -6825,6 +6825,24 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
6825
6825
  }
6826
6826
  };
6827
6827
  } catch (err) {
6828
+ if (internal.isCrossRequestError(err)) {
6829
+ /*
6830
+ * Not the network: workerd refused, at once, a promise or I/O object
6831
+ * of another request, so nothing was asked of the content service.
6832
+ * `fetchFresh` already tried once more. A server failure, then --
6833
+ * never `networkError`, which `/stat` answers as a 503 saying the
6834
+ * service could not be reached.
6835
+ */
6836
+ const details = err instanceof Error ? err.message : String(err);
6837
+ core.Internal.log.error(`Could not get patches. ${details}`);
6838
+ return {
6839
+ patches: [],
6840
+ error: {
6841
+ message: "Val's server could not load your changes, because of an error in Val itself. Trying again usually works.",
6842
+ details
6843
+ }
6844
+ };
6845
+ }
6828
6846
  const failure = contentServiceUnreachable(contentServiceName(this.contentUrl), "load your changes", err);
6829
6847
  core.Internal.log.error(`Could not get patches. ${failure.message} ${failure.details}`);
6830
6848
  return {
@@ -6839,7 +6857,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
6839
6857
  }
6840
6858
  async saveSourceFilePatch(path, patch, patchId, parentRef, authorId, sessionId) {
6841
6859
  const baseSha = await this.getBaseSha();
6842
- return fetch(`${this.contentUrl}/v1/${this.project}/patches`, {
6860
+ return ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/patches`, {
6843
6861
  method: "POST",
6844
6862
  headers: {
6845
6863
  ...this.authHeaders,
@@ -6949,7 +6967,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
6949
6967
  */
6950
6968
  async saveBase64EncodedBinaryFileFromPatch(filePathOrRef, parentRef, patchId, data, type, metadata) {
6951
6969
  const filePath = filePathOrRef;
6952
- return fetch(`${this.contentUrl}/v1/${this.project}/patches/${patchId}/files`, {
6970
+ return ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/patches/${patchId}/files`, {
6953
6971
  method: "POST",
6954
6972
  headers: {
6955
6973
  ...this.authHeaders,
@@ -7004,7 +7022,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
7004
7022
  params.set("body_sha",
7005
7023
  // We use this for cache invalidation
7006
7024
  core.Internal.getSHA256Hash(textEncoder.encode(stringifiedFiles)));
7007
- return fetch(`${this.contentUrl}/v1/${this.project}/files?${params}`, {
7025
+ return ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/files?${params}`, {
7008
7026
  method: "PUT",
7009
7027
  // Yes, PUT is weird. Weirder to have a body in a GET request.
7010
7028
  headers: {
@@ -7161,7 +7179,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
7161
7179
  params.set("file_path", filePath);
7162
7180
  params.set("remote", remote.toString());
7163
7181
  try {
7164
- const metadataRes = await fetch(`${this.contentUrl}/v1/${this.project}/patches/${patchId}/files?${params}`, {
7182
+ const metadataRes = await ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/patches/${patchId}/files?${params}`, {
7165
7183
  headers: {
7166
7184
  ...this.authHeaders,
7167
7185
  "Content-Type": "application/json"
@@ -7219,7 +7237,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
7219
7237
  };
7220
7238
  }
7221
7239
  async deletePatches(patchIds) {
7222
- return fetch(`${this.contentUrl}/v1/${this.project}/patches`, {
7240
+ return ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/patches`, {
7223
7241
  method: "DELETE",
7224
7242
  headers: {
7225
7243
  ...this.authHeaders,
@@ -7291,7 +7309,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
7291
7309
  */
7292
7310
  const proposalName = intoProposal ?? ((_this$proposal4 = this.proposal) === null || _this$proposal4 === void 0 ? void 0 : _this$proposal4.name);
7293
7311
  const commitUrl = proposalName !== undefined ? `${this.contentUrl}/v1/${this.project}/proposals/${proposalName}/save` : `${this.contentUrl}/v1/${this.project}/commit`;
7294
- const res = await fetch(commitUrl, {
7312
+ const res = await ValOpsMemory.fetchFresh(commitUrl, {
7295
7313
  method: "POST",
7296
7314
  headers: {
7297
7315
  ...this.authHeaders,
@@ -7427,7 +7445,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
7427
7445
  async getHistory(path, schema, commitShaForErrors) {
7428
7446
  let res;
7429
7447
  try {
7430
- res = await fetch(`${this.contentUrl}/v1/${this.project}${path}`, {
7448
+ res = await ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}${path}`, {
7431
7449
  headers: {
7432
7450
  ...this.authHeaders,
7433
7451
  "Content-Type": "application/json"
@@ -7578,7 +7596,7 @@ class ValOpsHttp extends ValOpsMemory.ValOps {
7578
7596
  }
7579
7597
  let res;
7580
7598
  try {
7581
- res = await fetch(`${this.contentUrl}/v1/${this.project}/commits/${commitSha}/file?${params}`, {
7599
+ res = await ValOpsMemory.fetchFresh(`${this.contentUrl}/v1/${this.project}/commits/${commitSha}/file?${params}`, {
7582
7600
  headers: {
7583
7601
  ...this.authHeaders
7584
7602
  }