@valbuild/server 0.154.3 → 0.154.4
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 +14 -0
- package/browser/dist/valbuild-server-browser.cjs.dev.js +4 -4
- package/browser/dist/valbuild-server-browser.cjs.prod.js +4 -4
- package/browser/dist/valbuild-server-browser.esm.js +4 -4
- package/dist/{ValOpsMemory-972616ae.esm.js → ValOpsMemory-82af54c9.esm.js} +33 -14
- package/dist/{ValOpsMemory-45ba05ad.cjs.dev.js → ValOpsMemory-88633e0f.cjs.dev.js} +32 -12
- package/dist/{ValOpsMemory-18337353.cjs.prod.js → ValOpsMemory-a1a58597.cjs.prod.js} +32 -12
- package/dist/{ValPatchStore-df8cdbe7.cjs.dev.js → ValPatchStore-457b166f.cjs.prod.js} +37 -59
- package/dist/{ValPatchStore-e23070df.esm.js → ValPatchStore-9ccc09e7.esm.js} +38 -60
- package/dist/{ValPatchStore-2f92eced.cjs.prod.js → ValPatchStore-b53db740.cjs.dev.js} +37 -59
- package/dist/{ValRouterCore-86757d56.cjs.dev.js → ValRouterCore-65bb6323.cjs.prod.js} +11 -2
- package/dist/{ValRouterCore-5b747abb.cjs.prod.js → ValRouterCore-adb69698.cjs.dev.js} +11 -2
- package/dist/{ValRouterCore-73eb843d.esm.js → ValRouterCore-f7d6394e.esm.js} +11 -2
- package/dist/{createPrettierFormatter-851fcf99.cjs.dev.js → createPrettierFormatter-5d830bdf.cjs.dev.js} +6 -14
- package/dist/{createPrettierFormatter-05ad7480.cjs.prod.js → createPrettierFormatter-b31bfbe5.cjs.prod.js} +6 -14
- package/dist/{createPrettierFormatter-1edca494.esm.js → createPrettierFormatter-ce478de1.esm.js} +7 -15
- package/dist/{createValRuntime-472df6e8.cjs.prod.js → createValRuntime-07bf43dd.cjs.prod.js} +5 -5
- package/dist/{createValRuntime-5cebf459.cjs.dev.js → createValRuntime-858474b4.cjs.dev.js} +5 -5
- package/dist/{createValRuntime-c77ee010.esm.js → createValRuntime-d34c69e8.esm.js} +5 -5
- package/dist/declarations/src/draftReads.d.ts +5 -0
- package/dist/declarations/src/head.d.ts +7 -7
- package/dist/{draftReads-3f7dcda5.cjs.prod.js → draftReads-1f256502.cjs.dev.js} +5 -0
- package/dist/{draftReads-a300a02f.cjs.dev.js → draftReads-27351e97.cjs.prod.js} +5 -0
- package/dist/{draftReads-bca0d49c.esm.js → draftReads-7f0f0eb3.esm.js} +5 -0
- package/dist/{inTabFetch-0c997998.esm.js → inTabFetch-54c1cb83.esm.js} +2 -2
- package/dist/{inTabFetch-c2efa1bd.cjs.prod.js → inTabFetch-e9a48fac.cjs.prod.js} +2 -2
- package/dist/{inTabFetch-db6d6425.cjs.dev.js → inTabFetch-fb9cf5e0.cjs.dev.js} +2 -2
- package/dist/{proposalJsonEntries-0669f027.esm.js → proposalJsonEntries-2cd6f6fe.esm.js} +1 -1
- package/dist/{proposalJsonEntries-26f397bd.cjs.dev.js → proposalJsonEntries-d21900d4.cjs.dev.js} +1 -1
- package/dist/{proposalJsonEntries-9e537244.cjs.prod.js → proposalJsonEntries-d4623810.cjs.prod.js} +1 -1
- package/dist/{publishKit-ac0af189.esm.js → publishKit-4e7a1516.esm.js} +7 -7
- package/dist/{publishKit-38d46a51.cjs.dev.js → publishKit-6b88a02e.cjs.dev.js} +5 -5
- package/dist/{publishKit-7aca03bb.cjs.prod.js → publishKit-cf3858a0.cjs.prod.js} +5 -5
- package/dist/{valRuntime-70ee2dc2.cjs.dev.js → valRuntime-5cadce34.cjs.dev.js} +41 -23
- package/dist/{valRuntime-2a3cc887.cjs.prod.js → valRuntime-ae69b225.cjs.prod.js} +41 -23
- package/dist/{valRuntime-e4d26702.esm.js → valRuntime-ca9958fc.esm.js} +42 -24
- package/dist/valbuild-server.cjs.dev.js +6 -6
- package/dist/valbuild-server.cjs.prod.js +6 -6
- package/dist/valbuild-server.esm.js +9 -9
- package/internal/browser/dist/valbuild-server-internal-browser.cjs.dev.js +5 -5
- package/internal/browser/dist/valbuild-server-internal-browser.cjs.prod.js +5 -5
- package/internal/browser/dist/valbuild-server-internal-browser.esm.js +5 -5
- package/internal/dist/valbuild-server-internal.cjs.dev.js +4 -4
- package/internal/dist/valbuild-server-internal.cjs.prod.js +4 -4
- package/internal/dist/valbuild-server-internal.esm.js +4 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @valbuild/server
|
|
2
2
|
|
|
3
|
+
## 0.154.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1088](https://github.com/valbuild/val/pull/1088) [`0d7071a`](https://github.com/valbuild/val/commit/0d7071ac44af3d392a9a02c035aa9beb79e245a6) Thanks [@freekh](https://github.com/freekh)! - **A visitor leaving a slow page no longer breaks the next request on Cloudflare-style hosting.** On a host that runs the site in a workerd isolate (Val's hosting, Cloudflare Workers), a request could fail at once with "This promise was created by a request that has since ended, so it can never settle." Val's readers are made once per process, and several things they read were cached as a promise that the first request to ask made: the readers' runtime, the draft's chain of edits, a `.jsonValues()` entry's import, the API's and MCP's server. When that first request ended before its read finished -- the visitor closed the tab -- every other request waiting on the same read failed with it, or showed an editor the published page instead of the draft.
|
|
8
|
+
|
|
9
|
+
The same thing made the Studio's `/stat` say the content service could not be reached (a 503) when nothing had been asked of it at all.
|
|
10
|
+
|
|
11
|
+
What is cached between requests is now the value a read settled to, never a read still under way, and a read that failed is tried again by the next request rather than kept. A read of the content service that workerd refuses as another request's is made again, and if it is refused again `/stat` answers it as Val's own failure rather than as an unreachable service. Nothing changes in how you call `initValContent`, `initValRsc`, `initValServer` or `initValMcp`.
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`0d7071a`](https://github.com/valbuild/val/commit/0d7071ac44af3d392a9a02c035aa9beb79e245a6)]:
|
|
14
|
+
- @valbuild/shared@0.154.4
|
|
15
|
+
- @valbuild/ui@0.154.2
|
|
16
|
+
|
|
3
17
|
## 0.154.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var inTabFetch = require('../../dist/inTabFetch-
|
|
5
|
+
var inTabFetch = require('../../dist/inTabFetch-fb9cf5e0.cjs.dev.js');
|
|
6
6
|
require('@valbuild/core');
|
|
7
|
-
require('../../dist/ValOpsMemory-
|
|
7
|
+
require('../../dist/ValOpsMemory-88633e0f.cjs.dev.js');
|
|
8
8
|
require('zod');
|
|
9
9
|
require('@valbuild/shared/internal');
|
|
10
10
|
require('../../dist/jsonValuesPatch-88bc661d.cjs.dev.js');
|
|
11
11
|
require('@valbuild/core/fp');
|
|
12
12
|
require('zod-validation-error');
|
|
13
|
-
require('../../dist/ValPatchStore-
|
|
13
|
+
require('../../dist/ValPatchStore-b53db740.cjs.dev.js');
|
|
14
14
|
require('@valbuild/core/patch');
|
|
15
15
|
require('image-size');
|
|
16
|
-
require('../../dist/ValRouterCore-
|
|
16
|
+
require('../../dist/ValRouterCore-adb69698.cjs.dev.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var inTabFetch = require('../../dist/inTabFetch-
|
|
5
|
+
var inTabFetch = require('../../dist/inTabFetch-e9a48fac.cjs.prod.js');
|
|
6
6
|
require('@valbuild/core');
|
|
7
|
-
require('../../dist/ValOpsMemory-
|
|
7
|
+
require('../../dist/ValOpsMemory-a1a58597.cjs.prod.js');
|
|
8
8
|
require('zod');
|
|
9
9
|
require('@valbuild/shared/internal');
|
|
10
10
|
require('../../dist/jsonValuesPatch-92798812.cjs.prod.js');
|
|
11
11
|
require('@valbuild/core/fp');
|
|
12
12
|
require('zod-validation-error');
|
|
13
|
-
require('../../dist/ValPatchStore-
|
|
13
|
+
require('../../dist/ValPatchStore-457b166f.cjs.prod.js');
|
|
14
14
|
require('@valbuild/core/patch');
|
|
15
15
|
require('image-size');
|
|
16
|
-
require('../../dist/ValRouterCore-
|
|
16
|
+
require('../../dist/ValRouterCore-65bb6323.cjs.prod.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { c as createInTabValFetch } from '../../dist/inTabFetch-
|
|
1
|
+
export { c as createInTabValFetch } from '../../dist/inTabFetch-54c1cb83.esm.js';
|
|
2
2
|
import '@valbuild/core';
|
|
3
|
-
import '../../dist/ValOpsMemory-
|
|
3
|
+
import '../../dist/ValOpsMemory-82af54c9.esm.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '@valbuild/shared/internal';
|
|
6
6
|
import '../../dist/jsonValuesPatch-13acc674.esm.js';
|
|
7
7
|
import '@valbuild/core/fp';
|
|
8
8
|
import 'zod-validation-error';
|
|
9
|
-
import '../../dist/ValPatchStore-
|
|
9
|
+
import '../../dist/ValPatchStore-9ccc09e7.esm.js';
|
|
10
10
|
import '@valbuild/core/patch';
|
|
11
11
|
import 'image-size';
|
|
12
|
-
import '../../dist/ValRouterCore-
|
|
12
|
+
import '../../dist/ValRouterCore-f7d6394e.esm.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Internal, extractValModules, computeValModuleShas, ImageSchema, DEFAULT_CONTENT_HOST, hasRemoteFileSchema } from '@valbuild/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { ChainFold, schemaVersionOf, baseVersionOf, EMPTY_CHAIN, sameModuleVersion, baseModuleContent, applyPatchRecord, isSchemaSourceFixError, resolveSchemaSourceFixForError, isJsonValuesRootOp, expandJsonValuesRootOp, classifyJsonValuesOp, rebaseContentOp, SerializedSchema, valClientHeaders, sketchTitle, parseSketch, SKETCHPAD_MAX_TEXT_LENGTH, checkSketch, AnalyticsBeacon, VAL_ENABLE_COOKIE_NAME, VAL_STATE_COOKIE, VAL_SESSION_COOKIE, parseJob, VAL_STUDIO_HEADER, newestCommitSha, AIToolCallSummaries, getErrorMessageFromUnknownJson } from '@valbuild/shared/internal';
|
|
3
|
+
import { ChainFold, schemaVersionOf, baseVersionOf, EMPTY_CHAIN, sameModuleVersion, baseModuleContent, applyPatchRecord, isSchemaSourceFixError, resolveSchemaSourceFixForError, isJsonValuesRootOp, expandJsonValuesRootOp, classifyJsonValuesOp, rebaseContentOp, SerializedSchema, valClientHeaders, isCrossRequestError, sketchTitle, parseSketch, SKETCHPAD_MAX_TEXT_LENGTH, checkSketch, AnalyticsBeacon, VAL_ENABLE_COOKIE_NAME, VAL_STATE_COOKIE, VAL_SESSION_COOKIE, parseJob, VAL_STUDIO_HEADER, newestCommitSha, AIToolCallSummaries, getErrorMessageFromUnknownJson } from '@valbuild/shared/internal';
|
|
4
4
|
import { p as posixPath, f as findNestedJsonValuesRecords, g as getNewJsonEntryPaths, r as resolveExistingJsonPath } from './jsonValuesPatch-13acc674.esm.js';
|
|
5
5
|
import { fromError } from 'zod-validation-error';
|
|
6
6
|
import { result } from '@valbuild/core/fp';
|
|
7
|
-
import { V as ValHead, r as recordKeysOf, i as isLastingAnswer, d as draftOverlay, I as InMemoryPatchStore } from './ValPatchStore-
|
|
7
|
+
import { V as ValHead, r as recordKeysOf, i as isLastingAnswer, d as draftOverlay, I as InMemoryPatchStore } from './ValPatchStore-9ccc09e7.esm.js';
|
|
8
8
|
import { JSONOps, PatchError, applyPatch, deepClone } from '@valbuild/core/patch';
|
|
9
9
|
import sizeOf from 'image-size';
|
|
10
10
|
|
|
@@ -5118,7 +5118,7 @@ var packageJson = {
|
|
|
5118
5118
|
],
|
|
5119
5119
|
exports: true
|
|
5120
5120
|
},
|
|
5121
|
-
version: "0.154.
|
|
5121
|
+
version: "0.154.4",
|
|
5122
5122
|
scripts: {
|
|
5123
5123
|
typecheck: "tsc --noEmit",
|
|
5124
5124
|
test: "jest",
|
|
@@ -5244,6 +5244,25 @@ contentUrl) {
|
|
|
5244
5244
|
}
|
|
5245
5245
|
}
|
|
5246
5246
|
|
|
5247
|
+
/**
|
|
5248
|
+
* `fetch`, made again -- fresh, from this request -- when the first one was
|
|
5249
|
+
* refused as another request's (see {@link isCrossRequestError}). Only a
|
|
5250
|
+
* read: whether a write that was refused that way was sent is not known, and
|
|
5251
|
+
* sending it twice is worse than failing it once.
|
|
5252
|
+
*/
|
|
5253
|
+
async function fetchFresh(input, init) {
|
|
5254
|
+
try {
|
|
5255
|
+
return await fetch(input, init);
|
|
5256
|
+
} catch (err) {
|
|
5257
|
+
const method = ((init === null || init === void 0 ? void 0 : init.method) ?? (input instanceof Request ? input.method : undefined) ?? "GET").toUpperCase();
|
|
5258
|
+
if (!isCrossRequestError(err) || method !== "GET" && method !== "HEAD") {
|
|
5259
|
+
throw err;
|
|
5260
|
+
}
|
|
5261
|
+
Internal.log.debug("a fetch was refused as another request's: again", err);
|
|
5262
|
+
return await fetch(input, init);
|
|
5263
|
+
}
|
|
5264
|
+
}
|
|
5265
|
+
|
|
5247
5266
|
/**
|
|
5248
5267
|
* Forwarding for `/admin/proxy/*`: Val Build's Studio API, `/v1/studio/*` on
|
|
5249
5268
|
* the content server, called on the editor's behalf with the token from their
|
|
@@ -5271,7 +5290,7 @@ async function forwardToStudioApi({
|
|
|
5271
5290
|
body,
|
|
5272
5291
|
credential,
|
|
5273
5292
|
contentUrl,
|
|
5274
|
-
fetchImpl =
|
|
5293
|
+
fetchImpl = fetchFresh,
|
|
5275
5294
|
timeoutMs = DEFAULT_TIMEOUT_MS
|
|
5276
5295
|
}) {
|
|
5277
5296
|
const url = studioApiUrl(contentUrl, path, rawQuery);
|
|
@@ -5886,7 +5905,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
5886
5905
|
if (!options.apiKey) {
|
|
5887
5906
|
return null;
|
|
5888
5907
|
}
|
|
5889
|
-
return
|
|
5908
|
+
return fetchFresh(url, {
|
|
5890
5909
|
method: "POST",
|
|
5891
5910
|
headers: getAuthHeaders(options.apiKey, "application/json") // NOTE: we use apiKey as auth on this endpoint (we do not have a token yet)
|
|
5892
5911
|
}).then(async res => {
|
|
@@ -8985,7 +9004,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8985
9004
|
const execFetch = async headers => {
|
|
8986
9005
|
try {
|
|
8987
9006
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/profiles`;
|
|
8988
|
-
const upstreamRes = await
|
|
9007
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
8989
9008
|
method: "GET",
|
|
8990
9009
|
headers
|
|
8991
9010
|
});
|
|
@@ -9076,7 +9095,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9076
9095
|
const execFetch = async headers => {
|
|
9077
9096
|
try {
|
|
9078
9097
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/initialize`;
|
|
9079
|
-
const upstreamRes = await
|
|
9098
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9080
9099
|
method: "POST",
|
|
9081
9100
|
headers,
|
|
9082
9101
|
body: JSON.stringify({})
|
|
@@ -9223,7 +9242,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9223
9242
|
}
|
|
9224
9243
|
const qs = params.toString();
|
|
9225
9244
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/sessions${qs ? `?${qs}` : ""}`;
|
|
9226
|
-
const upstreamRes = await
|
|
9245
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9227
9246
|
headers
|
|
9228
9247
|
});
|
|
9229
9248
|
if (!upstreamRes.ok) {
|
|
@@ -9314,7 +9333,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9314
9333
|
const execFetch = async headers => {
|
|
9315
9334
|
try {
|
|
9316
9335
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/sessions/${encodeURIComponent(sessionId)}`;
|
|
9317
|
-
const upstreamRes = await
|
|
9336
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9318
9337
|
method: "PATCH",
|
|
9319
9338
|
headers,
|
|
9320
9339
|
body: JSON.stringify({
|
|
@@ -9421,7 +9440,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9421
9440
|
if (req.query.cursor_id) params.set("cursor_id", req.query.cursor_id);
|
|
9422
9441
|
const qs = params.toString();
|
|
9423
9442
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/sessions/${encodeURIComponent(sessionId)}/messages` + (qs ? `?${qs}` : "");
|
|
9424
|
-
const upstreamRes = await
|
|
9443
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9425
9444
|
headers
|
|
9426
9445
|
});
|
|
9427
9446
|
if (!upstreamRes.ok) {
|
|
@@ -9520,7 +9539,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9520
9539
|
const execFetch = async () => {
|
|
9521
9540
|
try {
|
|
9522
9541
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/patches/${encodeURIComponent(req.body.patchId)}/files/from-session-file`;
|
|
9523
|
-
const upstreamRes = await
|
|
9542
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9524
9543
|
method: "POST",
|
|
9525
9544
|
headers,
|
|
9526
9545
|
body: JSON.stringify({
|
|
@@ -9616,7 +9635,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9616
9635
|
const downloadUrl = `${options.valContentUrl}/v1/${options.project}/ai/images?key=${encodeURIComponent(sessionKey)}`;
|
|
9617
9636
|
let binaryRes;
|
|
9618
9637
|
try {
|
|
9619
|
-
binaryRes = await
|
|
9638
|
+
binaryRes = await fetchFresh(downloadUrl, {
|
|
9620
9639
|
headers
|
|
9621
9640
|
});
|
|
9622
9641
|
} catch (err) {
|
|
@@ -9727,7 +9746,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9727
9746
|
const execFetch = async () => {
|
|
9728
9747
|
try {
|
|
9729
9748
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/images`;
|
|
9730
|
-
const upstreamRes = await
|
|
9749
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9731
9750
|
method: "PATCH",
|
|
9732
9751
|
headers,
|
|
9733
9752
|
body: JSON.stringify({
|
|
@@ -11470,4 +11489,4 @@ class ValOpsMemory extends ValOps {
|
|
|
11470
11489
|
|
|
11471
11490
|
/** Kept exported so a host can name the error shape it may get back. */
|
|
11472
11491
|
|
|
11473
|
-
export { ValOps as A, isSafePatchId as B, isMediaFilePath as C, bufferFromDataUrl as D, isPublicFilePath as E, guessMimeTypeFromPath as F, createMetadataFromBuffer as G,
|
|
11492
|
+
export { ValOps as A, isSafePatchId as B, isMediaFilePath as C, bufferFromDataUrl as D, isPublicFilePath as E, guessMimeTypeFromPath as F, createMetadataFromBuffer as G, fetchFresh as H, DEFAULT_ANALYTICS_INGEST_URL as I, sessionAuth as J, isHttpOps as K, bytesToBase64 as L, MEDIA_FILE_PATH_ACCEPTS as M, bytesToUtf8 as N, ValServer as V, movedRemoteHost as a, fallbackRemoteHost as b, checkRemoteFiles as c, getFieldsForType as d, formatPatchSourceError as e, fallbackRefOf as f, getFileExt as g, VAL_CLIENT_HEADERS as h, isHlsMasterPlaylist as i, askOncePerHost as j, getSettings as k, largestHlsVariant as l, mapHlsUris as m, needsHostCheck as n, ValOpsMemory as o, parseHlsMasterVariants as p, summaryOf as q, rewriteRefHost as r, sumHlsSegmentDurations as s, matchesFilter as t, uploadRemoteFile as u, validateJsonValuesEntries as v, byUpdatedAt as w, newSketchpad as x, isSketchpadId as y, applySketchpadChange as z };
|
|
@@ -6,7 +6,7 @@ var internal = require('@valbuild/shared/internal');
|
|
|
6
6
|
var jsonValuesPatch = require('./jsonValuesPatch-88bc661d.cjs.dev.js');
|
|
7
7
|
var zodValidationError = require('zod-validation-error');
|
|
8
8
|
var fp = require('@valbuild/core/fp');
|
|
9
|
-
var ValPatchStore = require('./ValPatchStore-
|
|
9
|
+
var ValPatchStore = require('./ValPatchStore-b53db740.cjs.dev.js');
|
|
10
10
|
var patch = require('@valbuild/core/patch');
|
|
11
11
|
var sizeOf = require('image-size');
|
|
12
12
|
|
|
@@ -5124,7 +5124,7 @@ var packageJson = {
|
|
|
5124
5124
|
],
|
|
5125
5125
|
exports: true
|
|
5126
5126
|
},
|
|
5127
|
-
version: "0.154.
|
|
5127
|
+
version: "0.154.4",
|
|
5128
5128
|
scripts: {
|
|
5129
5129
|
typecheck: "tsc --noEmit",
|
|
5130
5130
|
test: "jest",
|
|
@@ -5250,6 +5250,25 @@ contentUrl) {
|
|
|
5250
5250
|
}
|
|
5251
5251
|
}
|
|
5252
5252
|
|
|
5253
|
+
/**
|
|
5254
|
+
* `fetch`, made again -- fresh, from this request -- when the first one was
|
|
5255
|
+
* refused as another request's (see {@link isCrossRequestError}). Only a
|
|
5256
|
+
* read: whether a write that was refused that way was sent is not known, and
|
|
5257
|
+
* sending it twice is worse than failing it once.
|
|
5258
|
+
*/
|
|
5259
|
+
async function fetchFresh(input, init) {
|
|
5260
|
+
try {
|
|
5261
|
+
return await fetch(input, init);
|
|
5262
|
+
} catch (err) {
|
|
5263
|
+
const method = ((init === null || init === void 0 ? void 0 : init.method) ?? (input instanceof Request ? input.method : undefined) ?? "GET").toUpperCase();
|
|
5264
|
+
if (!internal.isCrossRequestError(err) || method !== "GET" && method !== "HEAD") {
|
|
5265
|
+
throw err;
|
|
5266
|
+
}
|
|
5267
|
+
core.Internal.log.debug("a fetch was refused as another request's: again", err);
|
|
5268
|
+
return await fetch(input, init);
|
|
5269
|
+
}
|
|
5270
|
+
}
|
|
5271
|
+
|
|
5253
5272
|
/**
|
|
5254
5273
|
* Forwarding for `/admin/proxy/*`: Val Build's Studio API, `/v1/studio/*` on
|
|
5255
5274
|
* the content server, called on the editor's behalf with the token from their
|
|
@@ -5277,7 +5296,7 @@ async function forwardToStudioApi({
|
|
|
5277
5296
|
body,
|
|
5278
5297
|
credential,
|
|
5279
5298
|
contentUrl,
|
|
5280
|
-
fetchImpl =
|
|
5299
|
+
fetchImpl = fetchFresh,
|
|
5281
5300
|
timeoutMs = DEFAULT_TIMEOUT_MS
|
|
5282
5301
|
}) {
|
|
5283
5302
|
const url = studioApiUrl(contentUrl, path, rawQuery);
|
|
@@ -5892,7 +5911,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
5892
5911
|
if (!options.apiKey) {
|
|
5893
5912
|
return null;
|
|
5894
5913
|
}
|
|
5895
|
-
return
|
|
5914
|
+
return fetchFresh(url, {
|
|
5896
5915
|
method: "POST",
|
|
5897
5916
|
headers: getAuthHeaders(options.apiKey, "application/json") // NOTE: we use apiKey as auth on this endpoint (we do not have a token yet)
|
|
5898
5917
|
}).then(async res => {
|
|
@@ -8991,7 +9010,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8991
9010
|
const execFetch = async headers => {
|
|
8992
9011
|
try {
|
|
8993
9012
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/profiles`;
|
|
8994
|
-
const upstreamRes = await
|
|
9013
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
8995
9014
|
method: "GET",
|
|
8996
9015
|
headers
|
|
8997
9016
|
});
|
|
@@ -9082,7 +9101,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9082
9101
|
const execFetch = async headers => {
|
|
9083
9102
|
try {
|
|
9084
9103
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/initialize`;
|
|
9085
|
-
const upstreamRes = await
|
|
9104
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9086
9105
|
method: "POST",
|
|
9087
9106
|
headers,
|
|
9088
9107
|
body: JSON.stringify({})
|
|
@@ -9229,7 +9248,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9229
9248
|
}
|
|
9230
9249
|
const qs = params.toString();
|
|
9231
9250
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/sessions${qs ? `?${qs}` : ""}`;
|
|
9232
|
-
const upstreamRes = await
|
|
9251
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9233
9252
|
headers
|
|
9234
9253
|
});
|
|
9235
9254
|
if (!upstreamRes.ok) {
|
|
@@ -9320,7 +9339,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9320
9339
|
const execFetch = async headers => {
|
|
9321
9340
|
try {
|
|
9322
9341
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/sessions/${encodeURIComponent(sessionId)}`;
|
|
9323
|
-
const upstreamRes = await
|
|
9342
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9324
9343
|
method: "PATCH",
|
|
9325
9344
|
headers,
|
|
9326
9345
|
body: JSON.stringify({
|
|
@@ -9427,7 +9446,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9427
9446
|
if (req.query.cursor_id) params.set("cursor_id", req.query.cursor_id);
|
|
9428
9447
|
const qs = params.toString();
|
|
9429
9448
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/sessions/${encodeURIComponent(sessionId)}/messages` + (qs ? `?${qs}` : "");
|
|
9430
|
-
const upstreamRes = await
|
|
9449
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9431
9450
|
headers
|
|
9432
9451
|
});
|
|
9433
9452
|
if (!upstreamRes.ok) {
|
|
@@ -9526,7 +9545,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9526
9545
|
const execFetch = async () => {
|
|
9527
9546
|
try {
|
|
9528
9547
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/patches/${encodeURIComponent(req.body.patchId)}/files/from-session-file`;
|
|
9529
|
-
const upstreamRes = await
|
|
9548
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9530
9549
|
method: "POST",
|
|
9531
9550
|
headers,
|
|
9532
9551
|
body: JSON.stringify({
|
|
@@ -9622,7 +9641,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9622
9641
|
const downloadUrl = `${options.valContentUrl}/v1/${options.project}/ai/images?key=${encodeURIComponent(sessionKey)}`;
|
|
9623
9642
|
let binaryRes;
|
|
9624
9643
|
try {
|
|
9625
|
-
binaryRes = await
|
|
9644
|
+
binaryRes = await fetchFresh(downloadUrl, {
|
|
9626
9645
|
headers
|
|
9627
9646
|
});
|
|
9628
9647
|
} catch (err) {
|
|
@@ -9733,7 +9752,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9733
9752
|
const execFetch = async () => {
|
|
9734
9753
|
try {
|
|
9735
9754
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/images`;
|
|
9736
|
-
const upstreamRes = await
|
|
9755
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9737
9756
|
method: "PATCH",
|
|
9738
9757
|
headers,
|
|
9739
9758
|
body: JSON.stringify({
|
|
@@ -11492,6 +11511,7 @@ exports.checkRemoteFiles = checkRemoteFiles;
|
|
|
11492
11511
|
exports.createMetadataFromBuffer = createMetadataFromBuffer;
|
|
11493
11512
|
exports.fallbackRefOf = fallbackRefOf;
|
|
11494
11513
|
exports.fallbackRemoteHost = fallbackRemoteHost;
|
|
11514
|
+
exports.fetchFresh = fetchFresh;
|
|
11495
11515
|
exports.formatPatchSourceError = formatPatchSourceError;
|
|
11496
11516
|
exports.getFieldsForType = getFieldsForType;
|
|
11497
11517
|
exports.getFileExt = getFileExt;
|
|
@@ -6,7 +6,7 @@ var internal = require('@valbuild/shared/internal');
|
|
|
6
6
|
var jsonValuesPatch = require('./jsonValuesPatch-92798812.cjs.prod.js');
|
|
7
7
|
var zodValidationError = require('zod-validation-error');
|
|
8
8
|
var fp = require('@valbuild/core/fp');
|
|
9
|
-
var ValPatchStore = require('./ValPatchStore-
|
|
9
|
+
var ValPatchStore = require('./ValPatchStore-457b166f.cjs.prod.js');
|
|
10
10
|
var patch = require('@valbuild/core/patch');
|
|
11
11
|
var sizeOf = require('image-size');
|
|
12
12
|
|
|
@@ -5124,7 +5124,7 @@ var packageJson = {
|
|
|
5124
5124
|
],
|
|
5125
5125
|
exports: true
|
|
5126
5126
|
},
|
|
5127
|
-
version: "0.154.
|
|
5127
|
+
version: "0.154.4",
|
|
5128
5128
|
scripts: {
|
|
5129
5129
|
typecheck: "tsc --noEmit",
|
|
5130
5130
|
test: "jest",
|
|
@@ -5250,6 +5250,25 @@ contentUrl) {
|
|
|
5250
5250
|
}
|
|
5251
5251
|
}
|
|
5252
5252
|
|
|
5253
|
+
/**
|
|
5254
|
+
* `fetch`, made again -- fresh, from this request -- when the first one was
|
|
5255
|
+
* refused as another request's (see {@link isCrossRequestError}). Only a
|
|
5256
|
+
* read: whether a write that was refused that way was sent is not known, and
|
|
5257
|
+
* sending it twice is worse than failing it once.
|
|
5258
|
+
*/
|
|
5259
|
+
async function fetchFresh(input, init) {
|
|
5260
|
+
try {
|
|
5261
|
+
return await fetch(input, init);
|
|
5262
|
+
} catch (err) {
|
|
5263
|
+
const method = ((init === null || init === void 0 ? void 0 : init.method) ?? (input instanceof Request ? input.method : undefined) ?? "GET").toUpperCase();
|
|
5264
|
+
if (!internal.isCrossRequestError(err) || method !== "GET" && method !== "HEAD") {
|
|
5265
|
+
throw err;
|
|
5266
|
+
}
|
|
5267
|
+
core.Internal.log.debug("a fetch was refused as another request's: again", err);
|
|
5268
|
+
return await fetch(input, init);
|
|
5269
|
+
}
|
|
5270
|
+
}
|
|
5271
|
+
|
|
5253
5272
|
/**
|
|
5254
5273
|
* Forwarding for `/admin/proxy/*`: Val Build's Studio API, `/v1/studio/*` on
|
|
5255
5274
|
* the content server, called on the editor's behalf with the token from their
|
|
@@ -5277,7 +5296,7 @@ async function forwardToStudioApi({
|
|
|
5277
5296
|
body,
|
|
5278
5297
|
credential,
|
|
5279
5298
|
contentUrl,
|
|
5280
|
-
fetchImpl =
|
|
5299
|
+
fetchImpl = fetchFresh,
|
|
5281
5300
|
timeoutMs = DEFAULT_TIMEOUT_MS
|
|
5282
5301
|
}) {
|
|
5283
5302
|
const url = studioApiUrl(contentUrl, path, rawQuery);
|
|
@@ -5892,7 +5911,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
5892
5911
|
if (!options.apiKey) {
|
|
5893
5912
|
return null;
|
|
5894
5913
|
}
|
|
5895
|
-
return
|
|
5914
|
+
return fetchFresh(url, {
|
|
5896
5915
|
method: "POST",
|
|
5897
5916
|
headers: getAuthHeaders(options.apiKey, "application/json") // NOTE: we use apiKey as auth on this endpoint (we do not have a token yet)
|
|
5898
5917
|
}).then(async res => {
|
|
@@ -8991,7 +9010,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8991
9010
|
const execFetch = async headers => {
|
|
8992
9011
|
try {
|
|
8993
9012
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/profiles`;
|
|
8994
|
-
const upstreamRes = await
|
|
9013
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
8995
9014
|
method: "GET",
|
|
8996
9015
|
headers
|
|
8997
9016
|
});
|
|
@@ -9082,7 +9101,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9082
9101
|
const execFetch = async headers => {
|
|
9083
9102
|
try {
|
|
9084
9103
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/initialize`;
|
|
9085
|
-
const upstreamRes = await
|
|
9104
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9086
9105
|
method: "POST",
|
|
9087
9106
|
headers,
|
|
9088
9107
|
body: JSON.stringify({})
|
|
@@ -9229,7 +9248,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9229
9248
|
}
|
|
9230
9249
|
const qs = params.toString();
|
|
9231
9250
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/sessions${qs ? `?${qs}` : ""}`;
|
|
9232
|
-
const upstreamRes = await
|
|
9251
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9233
9252
|
headers
|
|
9234
9253
|
});
|
|
9235
9254
|
if (!upstreamRes.ok) {
|
|
@@ -9320,7 +9339,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9320
9339
|
const execFetch = async headers => {
|
|
9321
9340
|
try {
|
|
9322
9341
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/sessions/${encodeURIComponent(sessionId)}`;
|
|
9323
|
-
const upstreamRes = await
|
|
9342
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9324
9343
|
method: "PATCH",
|
|
9325
9344
|
headers,
|
|
9326
9345
|
body: JSON.stringify({
|
|
@@ -9427,7 +9446,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9427
9446
|
if (req.query.cursor_id) params.set("cursor_id", req.query.cursor_id);
|
|
9428
9447
|
const qs = params.toString();
|
|
9429
9448
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/sessions/${encodeURIComponent(sessionId)}/messages` + (qs ? `?${qs}` : "");
|
|
9430
|
-
const upstreamRes = await
|
|
9449
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9431
9450
|
headers
|
|
9432
9451
|
});
|
|
9433
9452
|
if (!upstreamRes.ok) {
|
|
@@ -9526,7 +9545,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9526
9545
|
const execFetch = async () => {
|
|
9527
9546
|
try {
|
|
9528
9547
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/patches/${encodeURIComponent(req.body.patchId)}/files/from-session-file`;
|
|
9529
|
-
const upstreamRes = await
|
|
9548
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9530
9549
|
method: "POST",
|
|
9531
9550
|
headers,
|
|
9532
9551
|
body: JSON.stringify({
|
|
@@ -9622,7 +9641,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9622
9641
|
const downloadUrl = `${options.valContentUrl}/v1/${options.project}/ai/images?key=${encodeURIComponent(sessionKey)}`;
|
|
9623
9642
|
let binaryRes;
|
|
9624
9643
|
try {
|
|
9625
|
-
binaryRes = await
|
|
9644
|
+
binaryRes = await fetchFresh(downloadUrl, {
|
|
9626
9645
|
headers
|
|
9627
9646
|
});
|
|
9628
9647
|
} catch (err) {
|
|
@@ -9733,7 +9752,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9733
9752
|
const execFetch = async () => {
|
|
9734
9753
|
try {
|
|
9735
9754
|
const upstreamUrl = `${options.valContentUrl}/v1/${options.project}/ai/images`;
|
|
9736
|
-
const upstreamRes = await
|
|
9755
|
+
const upstreamRes = await fetchFresh(upstreamUrl, {
|
|
9737
9756
|
method: "PATCH",
|
|
9738
9757
|
headers,
|
|
9739
9758
|
body: JSON.stringify({
|
|
@@ -11492,6 +11511,7 @@ exports.checkRemoteFiles = checkRemoteFiles;
|
|
|
11492
11511
|
exports.createMetadataFromBuffer = createMetadataFromBuffer;
|
|
11493
11512
|
exports.fallbackRefOf = fallbackRefOf;
|
|
11494
11513
|
exports.fallbackRemoteHost = fallbackRemoteHost;
|
|
11514
|
+
exports.fetchFresh = fetchFresh;
|
|
11495
11515
|
exports.formatPatchSourceError = formatPatchSourceError;
|
|
11496
11516
|
exports.getFieldsForType = getFieldsForType;
|
|
11497
11517
|
exports.getFileExt = getFileExt;
|
|
@@ -161,10 +161,37 @@ class ValHead {
|
|
|
161
161
|
memory;
|
|
162
162
|
store;
|
|
163
163
|
facts = new WeakMap();
|
|
164
|
+
/*
|
|
165
|
+
* What the head keeps between reads is what they SETTLED to, never a
|
|
166
|
+
* promise one of them is still waiting on: a head lives as long as the
|
|
167
|
+
* process, and on workerd a promise belongs to the request that made it --
|
|
168
|
+
* one that ends while its read is pending leaves a promise every later
|
|
169
|
+
* request fails on. See `SettledCache` in `@valbuild/shared/internal`.
|
|
170
|
+
* So two requests that find the chain moved at the same moment each fetch
|
|
171
|
+
* it: they used to join one fetch.
|
|
172
|
+
*/
|
|
164
173
|
chain = null;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
174
|
+
serialized = internal.settledOnce(() => this.ops.getSchemas().then(schemas => {
|
|
175
|
+
const serialized = {};
|
|
176
|
+
for (const [path, schema] of Object.entries(schemas)) {
|
|
177
|
+
try {
|
|
178
|
+
serialized[path] = schema["executeSerialize"]();
|
|
179
|
+
} catch {
|
|
180
|
+
// Reported elsewhere; read as "no schema", as the engine does.
|
|
181
|
+
serialized[path] = undefined;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return serialized;
|
|
185
|
+
}));
|
|
186
|
+
/** {@link tree}, for the newest chain it was made at. */
|
|
187
|
+
wholeTree = new internal.SettledCache({
|
|
188
|
+
keep: made => "ok" in made,
|
|
189
|
+
max: 1
|
|
190
|
+
});
|
|
191
|
+
/** {@link changed}, made once per chain: it looks at every record's markers. */
|
|
192
|
+
changedIn = new internal.SettledCache({
|
|
193
|
+
max: 1
|
|
194
|
+
});
|
|
168
195
|
constructor(ops, opts = {}) {
|
|
169
196
|
this.ops = ops;
|
|
170
197
|
this.memory = internal.memoryTier({
|
|
@@ -186,8 +213,8 @@ class ValHead {
|
|
|
186
213
|
|
|
187
214
|
/**
|
|
188
215
|
* The chain, re-read only when `seq` moved (or the base did: a publish
|
|
189
|
-
* adopted). A read that finds
|
|
190
|
-
*
|
|
216
|
+
* adopted). A read that finds it moved fetches it, even while another
|
|
217
|
+
* read's fetch is under way: see {@link chain}.
|
|
191
218
|
*
|
|
192
219
|
* Asks "has the chain moved?" once per call -- in http mode one request to
|
|
193
220
|
* the content service. A caller that reads several modules for ONE answer
|
|
@@ -204,26 +231,7 @@ class ValHead {
|
|
|
204
231
|
ok: held
|
|
205
232
|
};
|
|
206
233
|
}
|
|
207
|
-
|
|
208
|
-
if (position !== null && fetching !== null && fetching.seq === position.seq && fetching.epoch === position.epoch) {
|
|
209
|
-
return fetching.promise;
|
|
210
|
-
}
|
|
211
|
-
const promise = this.fetchChain(position, base);
|
|
212
|
-
if (position !== null) {
|
|
213
|
-
const started = {
|
|
214
|
-
...position,
|
|
215
|
-
promise
|
|
216
|
-
};
|
|
217
|
-
this.fetching = started;
|
|
218
|
-
// Cleared however it ends. `finally` would hand on a rejection to a
|
|
219
|
-
// promise nobody holds: an unhandled rejection, which ends a Node
|
|
220
|
-
// process. The caller is handed `promise` itself, and sees it.
|
|
221
|
-
const done = () => {
|
|
222
|
-
if (this.fetching === started) this.fetching = null;
|
|
223
|
-
};
|
|
224
|
-
promise.then(done, done);
|
|
225
|
-
}
|
|
226
|
-
return promise;
|
|
234
|
+
return this.fetchChain(position, base);
|
|
227
235
|
}
|
|
228
236
|
|
|
229
237
|
/** The chain a read is answered at: the one given, or the newest. */
|
|
@@ -290,19 +298,7 @@ class ValHead {
|
|
|
290
298
|
* and MCP's tools their schemas.
|
|
291
299
|
*/
|
|
292
300
|
serializedSchemas() {
|
|
293
|
-
this.serialized
|
|
294
|
-
const serialized = {};
|
|
295
|
-
for (const [path, schema] of Object.entries(schemas)) {
|
|
296
|
-
try {
|
|
297
|
-
serialized[path] = schema["executeSerialize"]();
|
|
298
|
-
} catch {
|
|
299
|
-
// Reported elsewhere; read as "no schema", as the engine does.
|
|
300
|
-
serialized[path] = undefined;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return serialized;
|
|
304
|
-
});
|
|
305
|
-
return this.serialized;
|
|
301
|
+
return this.serialized();
|
|
306
302
|
}
|
|
307
303
|
|
|
308
304
|
// #region modules
|
|
@@ -687,25 +683,14 @@ class ValHead {
|
|
|
687
683
|
* publish wrote that the bundle has not got. What `fetchValDraft` sends.
|
|
688
684
|
*/
|
|
689
685
|
async changed(at) {
|
|
690
|
-
var _made;
|
|
691
686
|
const synced = await this.at(at);
|
|
692
687
|
if ("error" in synced) return synced;
|
|
693
688
|
const chain = synced.ok;
|
|
694
|
-
|
|
695
|
-
if (((_made = made) === null || _made === void 0 ? void 0 : _made.chain) !== chain) {
|
|
696
|
-
made = {
|
|
697
|
-
chain,
|
|
698
|
-
paths: this.changedOf(chain)
|
|
699
|
-
};
|
|
700
|
-
this.changedIn = made;
|
|
701
|
-
}
|
|
689
|
+
const paths = await this.changedIn.get(chain, () => this.changedOf(chain));
|
|
702
690
|
return {
|
|
703
|
-
ok: [...
|
|
691
|
+
ok: [...paths]
|
|
704
692
|
};
|
|
705
693
|
}
|
|
706
|
-
|
|
707
|
-
/** {@link changed}, made once per chain: it looks at every record's markers. */
|
|
708
|
-
changedIn = null;
|
|
709
694
|
async changedOf(chain) {
|
|
710
695
|
const changed = new Set(chain.byModule.keys());
|
|
711
696
|
for (const path of Object.keys(chain.versions)) {
|
|
@@ -724,17 +709,10 @@ class ValHead {
|
|
|
724
709
|
* MCP read; made once per chain.
|
|
725
710
|
*/
|
|
726
711
|
async tree() {
|
|
727
|
-
var _this$wholeTree;
|
|
728
712
|
const synced = await this.sync();
|
|
729
713
|
if ("error" in synced) return synced;
|
|
730
714
|
const chain = synced.ok;
|
|
731
|
-
|
|
732
|
-
this.wholeTree = {
|
|
733
|
-
chain,
|
|
734
|
-
promise: this.makeTree(chain)
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
return this.wholeTree.promise;
|
|
715
|
+
return this.wholeTree.get(chain, () => this.makeTree(chain));
|
|
738
716
|
}
|
|
739
717
|
async makeTree(chain) {
|
|
740
718
|
const base = await this.ops.getBaseSources();
|