@valbuild/server 0.147.0 → 0.148.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +108 -0
- package/browser/dist/valbuild-server-browser.cjs.dev.js +2 -2
- package/browser/dist/valbuild-server-browser.cjs.prod.js +2 -2
- package/browser/dist/valbuild-server-browser.esm.js +2 -2
- package/dist/{ValRouterCore-7ffcc08c.cjs.prod.js → ValRouterCore-42772c21.cjs.prod.js} +980 -53
- package/dist/{ValRouterCore-f5004f8f.esm.js → ValRouterCore-7ca3dc68.esm.js} +972 -54
- package/dist/{ValRouterCore-3fd3d444.cjs.dev.js → ValRouterCore-9bdaaf89.cjs.dev.js} +980 -53
- package/dist/declarations/src/ValOps.d.ts +32 -11
- package/dist/declarations/src/ValOpsMemory.d.ts +4 -4
- package/dist/declarations/src/ValServer.d.ts +1 -2
- package/dist/declarations/src/checkRemoteRef.d.ts +40 -2
- package/dist/declarations/src/createFixPatch.d.ts +25 -3
- package/dist/declarations/src/fixFiles.d.ts +42 -0
- package/dist/declarations/src/fixHandlers.d.ts +14 -0
- package/dist/declarations/src/getSettings.d.ts +1 -0
- package/dist/declarations/src/index.d.ts +1 -0
- package/dist/declarations/src/platform.d.ts +16 -0
- package/dist/declarations/src/remoteFileCheck.d.ts +116 -0
- package/dist/declarations/src/remoteHostCheck.d.ts +101 -0
- package/dist/declarations/src/studioValidation.d.ts +84 -0
- package/dist/declarations/src/uploadRemoteFile.d.ts +1 -1
- package/dist/declarations/src/videosetFixes.d.ts +3 -2
- package/dist/{getJsonEntryAtCommit-df65d861.cjs.prod.js → getJsonEntryAtCommit-2e36e805.cjs.prod.js} +3 -4
- package/dist/{getJsonEntryAtCommit-1e08d724.esm.js → getJsonEntryAtCommit-40b6d9c1.esm.js} +3 -4
- package/dist/{getJsonEntryAtCommit-e96beb9e.cjs.dev.js → getJsonEntryAtCommit-64f67a50.cjs.dev.js} +3 -4
- package/dist/valbuild-server.cjs.dev.js +1352 -695
- package/dist/valbuild-server.cjs.prod.js +1352 -695
- package/dist/valbuild-server.esm.js +1352 -696
- package/package.json +4 -5
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ModuleFilePath, SourcePath, ValidationError, ValidationFix } from "@valbuild/core";
|
|
2
|
+
import type { Patch } from "@valbuild/core/patch";
|
|
3
|
+
import { FixPatchRemainingError } from "./createFixPatch.js";
|
|
4
|
+
import type { FixFiles } from "./fixFiles.js";
|
|
5
|
+
import { type RemoteHostProblem, type RemoteNetwork } from "./remoteFileCheck.js";
|
|
6
|
+
import { type PatchAnalysis, type Schemas, type Sources, type ValOps } from "./ValOps.js";
|
|
7
|
+
/**
|
|
8
|
+
* The Studio's full check, one module at a time: what `/validate` and
|
|
9
|
+
* `/validate/fix` answer with. See `docs/plans/studio-validate.md`.
|
|
10
|
+
*
|
|
11
|
+
* Both take the sources the caller is looking at — base plus the patches it
|
|
12
|
+
* names — so an error is about the content on the editor's screen, and a fix
|
|
13
|
+
* is a patch on top of it.
|
|
14
|
+
*/
|
|
15
|
+
export type StudioCheckInput = {
|
|
16
|
+
moduleFilePath: ModuleFilePath;
|
|
17
|
+
schemas: Schemas;
|
|
18
|
+
sources: Sources;
|
|
19
|
+
fileLastUpdatedByPatchId: PatchAnalysis["fileLastUpdatedByPatchId"];
|
|
20
|
+
/** How remote hosts are asked about refs. Tests replace it. */
|
|
21
|
+
network?: RemoteNetwork;
|
|
22
|
+
};
|
|
23
|
+
export type StudioModuleCheck = {
|
|
24
|
+
status: "ok";
|
|
25
|
+
errors: Record<SourcePath, ValidationError[]>;
|
|
26
|
+
/** Hosts that did not serve this module's remote files. */
|
|
27
|
+
remoteHosts: RemoteHostProblem[];
|
|
28
|
+
} | {
|
|
29
|
+
status: "unknown-module";
|
|
30
|
+
} | {
|
|
31
|
+
status: "invalid-source";
|
|
32
|
+
message: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Every error in one module: its sources against its schema, and its local
|
|
36
|
+
* files against their bytes.
|
|
37
|
+
*
|
|
38
|
+
* Not filtered the way the publish gate filters (`partitionValidationErrors`):
|
|
39
|
+
* the errors the gate hides because "the server repairs them on save" are the
|
|
40
|
+
* ones this check exists to show, since nothing repairs them in http mode.
|
|
41
|
+
*
|
|
42
|
+
* Remote files are checked too: a stale ref is an error with a fix, and a
|
|
43
|
+
* host that does not serve them is reported once, as a host, rather than as
|
|
44
|
+
* an error on every image it holds (`checkRemoteFiles`).
|
|
45
|
+
*
|
|
46
|
+
* Not yet here: the media directories' own entries, step 5 of the plan.
|
|
47
|
+
*/
|
|
48
|
+
export declare function checkModuleForStudio(ops: ValOps, input: StudioCheckInput): Promise<StudioModuleCheck>;
|
|
49
|
+
export type StudioFixResult = {
|
|
50
|
+
status: "ok";
|
|
51
|
+
patch: Patch;
|
|
52
|
+
remainingErrors: FixPatchRemainingError[];
|
|
53
|
+
} | {
|
|
54
|
+
status: "unknown-module";
|
|
55
|
+
} | {
|
|
56
|
+
status: "not-in-studio";
|
|
57
|
+
} | {
|
|
58
|
+
status: "not-found";
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* The patch that fixes one error, built from the server's own reading of the
|
|
62
|
+
* module rather than from the error the caller saw.
|
|
63
|
+
*
|
|
64
|
+
* The caller names the error by where it is and which fix it wants; the error
|
|
65
|
+
* itself is found again here. That is what keeps a stale or hand-written
|
|
66
|
+
* request from steering `createFixPatch` (CLAUDE.md, "Adding a ValidationFix
|
|
67
|
+
* code"), and it is what lets an error reported at a FIELD be fixed at the
|
|
68
|
+
* media value it belongs to: `validateFiles` reports a wrong width at
|
|
69
|
+
* `…"hero"."width"`, while the fix rewrites `…"hero"`.
|
|
70
|
+
*
|
|
71
|
+
* Only {@link isStudioFix} codes are built. The others need a disk or a
|
|
72
|
+
* remote host this server may not have, and are the CLI's for now.
|
|
73
|
+
*/
|
|
74
|
+
export declare function fixForStudio(ops: ValOps, input: StudioCheckInput & {
|
|
75
|
+
sourcePath: SourcePath;
|
|
76
|
+
fix: ValidationFix;
|
|
77
|
+
}): Promise<StudioFixResult>;
|
|
78
|
+
/**
|
|
79
|
+
* {@link FixFiles} over whatever store this server has: the disk in fs mode,
|
|
80
|
+
* the content service in http mode. A file a pending patch wrote is read from
|
|
81
|
+
* that patch, as `validateFiles` reads it, so a fix is made from the bytes
|
|
82
|
+
* the check was made from.
|
|
83
|
+
*/
|
|
84
|
+
export declare function opsFixFiles(ops: ValOps, fileLastUpdatedByPatchId: PatchAnalysis["fileLastUpdatedByPatchId"]): FixFiles;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function uploadRemoteFile(contentHost: string, project: string, bucket: string, fileHash: string, fileExt: string, fileBuffer:
|
|
1
|
+
export declare function uploadRemoteFile(contentHost: string, project: string, bucket: string, fileHash: string, fileExt: string, fileBuffer: Uint8Array, auth: {
|
|
2
2
|
pat: string;
|
|
3
3
|
} | {
|
|
4
4
|
apiKey: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ModuleFilePath, type SerializedRecordSchema, type SerializedSchema, type SerializedVideoSchema, type Source, type SourcePath, type ValidationError } from "@valbuild/core";
|
|
2
2
|
import { type Patch } from "@valbuild/core/patch";
|
|
3
3
|
import type { FixPatchRemainingError } from "./createFixPatch.js";
|
|
4
|
+
import type { FixFiles } from "./fixFiles.js";
|
|
4
5
|
import type { FixHandlerContext, FixHandlerResult, ModulePatch } from "./fixHandlers.js";
|
|
5
6
|
import { type GalleryEntryKey } from "./galleryEntryKey.js";
|
|
6
7
|
import type { Service } from "./Service.js";
|
|
@@ -129,8 +130,8 @@ export declare function videosetCheckAllFilesPatch({ projectRoot, apply, sourceP
|
|
|
129
130
|
* from the file at the entry's KEY, and write only that, one op per field —
|
|
130
131
|
* `alt` and anything already there are someone's, and stay.
|
|
131
132
|
*/
|
|
132
|
-
export declare function videosetAddMetadataPatch({
|
|
133
|
-
|
|
133
|
+
export declare function videosetAddMetadataPatch({ files, sourcePath, validationError, moduleSource, moduleSchema, }: {
|
|
134
|
+
files: FixFiles;
|
|
134
135
|
sourcePath: SourcePath;
|
|
135
136
|
validationError: ValidationError;
|
|
136
137
|
moduleSource: Source | undefined;
|
package/dist/{getJsonEntryAtCommit-df65d861.cjs.prod.js → getJsonEntryAtCommit-2e36e805.cjs.prod.js}
RENAMED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var ts = require('typescript');
|
|
4
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
4
|
+
var ValRouterCore = require('./ValRouterCore-42772c21.cjs.prod.js');
|
|
5
5
|
var fp = require('@valbuild/core/fp');
|
|
6
6
|
var jsonValuesModule = require('./jsonValuesModule-d1bb8d8f.cjs.prod.js');
|
|
7
|
-
require('buffer');
|
|
8
7
|
require('@valbuild/core');
|
|
9
8
|
require('@valbuild/shared/internal');
|
|
10
9
|
require('zod');
|
|
@@ -55,7 +54,7 @@ async function getJsonEntryAtCommit(ops, commitSha, moduleFilePath, key) {
|
|
|
55
54
|
if (fp.result.isErr(moduleRes)) {
|
|
56
55
|
return moduleRes;
|
|
57
56
|
}
|
|
58
|
-
const entryPath = findEntryImportPath(moduleFilePath, moduleGitPath.value, moduleRes.value
|
|
57
|
+
const entryPath = findEntryImportPath(moduleFilePath, moduleGitPath.value, ValRouterCore.bytesToUtf8(moduleRes.value), key);
|
|
59
58
|
if (fp.result.isErr(entryPath)) {
|
|
60
59
|
return entryPath;
|
|
61
60
|
}
|
|
@@ -73,7 +72,7 @@ async function getJsonEntryAtCommit(ops, commitSha, moduleFilePath, key) {
|
|
|
73
72
|
return entryRes;
|
|
74
73
|
}
|
|
75
74
|
try {
|
|
76
|
-
return fp.result.ok(JSON.parse(entryRes.value
|
|
75
|
+
return fp.result.ok(JSON.parse(ValRouterCore.bytesToUtf8(entryRes.value)));
|
|
77
76
|
} catch (err) {
|
|
78
77
|
return fp.result.err({
|
|
79
78
|
kind: "file-unavailable",
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import {
|
|
2
|
+
import { F as bytesToUtf8, G as posixPath } from './ValRouterCore-7ca3dc68.esm.js';
|
|
3
3
|
import { result } from '@valbuild/core/fp';
|
|
4
4
|
import { a as analyzeValModule, c as analyzeJsonValuesEntries } from './jsonValuesModule-427d68c8.esm.js';
|
|
5
|
-
import 'buffer';
|
|
6
5
|
import '@valbuild/core';
|
|
7
6
|
import '@valbuild/shared/internal';
|
|
8
7
|
import 'zod';
|
|
@@ -49,7 +48,7 @@ async function getJsonEntryAtCommit(ops, commitSha, moduleFilePath, key) {
|
|
|
49
48
|
if (result.isErr(moduleRes)) {
|
|
50
49
|
return moduleRes;
|
|
51
50
|
}
|
|
52
|
-
const entryPath = findEntryImportPath(moduleFilePath, moduleGitPath.value, moduleRes.value
|
|
51
|
+
const entryPath = findEntryImportPath(moduleFilePath, moduleGitPath.value, bytesToUtf8(moduleRes.value), key);
|
|
53
52
|
if (result.isErr(entryPath)) {
|
|
54
53
|
return entryPath;
|
|
55
54
|
}
|
|
@@ -67,7 +66,7 @@ async function getJsonEntryAtCommit(ops, commitSha, moduleFilePath, key) {
|
|
|
67
66
|
return entryRes;
|
|
68
67
|
}
|
|
69
68
|
try {
|
|
70
|
-
return result.ok(JSON.parse(entryRes.value
|
|
69
|
+
return result.ok(JSON.parse(bytesToUtf8(entryRes.value)));
|
|
71
70
|
} catch (err) {
|
|
72
71
|
return result.err({
|
|
73
72
|
kind: "file-unavailable",
|
package/dist/{getJsonEntryAtCommit-e96beb9e.cjs.dev.js → getJsonEntryAtCommit-64f67a50.cjs.dev.js}
RENAMED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var ts = require('typescript');
|
|
4
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
4
|
+
var ValRouterCore = require('./ValRouterCore-9bdaaf89.cjs.dev.js');
|
|
5
5
|
var fp = require('@valbuild/core/fp');
|
|
6
6
|
var jsonValuesModule = require('./jsonValuesModule-8ae503a8.cjs.dev.js');
|
|
7
|
-
require('buffer');
|
|
8
7
|
require('@valbuild/core');
|
|
9
8
|
require('@valbuild/shared/internal');
|
|
10
9
|
require('zod');
|
|
@@ -55,7 +54,7 @@ async function getJsonEntryAtCommit(ops, commitSha, moduleFilePath, key) {
|
|
|
55
54
|
if (fp.result.isErr(moduleRes)) {
|
|
56
55
|
return moduleRes;
|
|
57
56
|
}
|
|
58
|
-
const entryPath = findEntryImportPath(moduleFilePath, moduleGitPath.value, moduleRes.value
|
|
57
|
+
const entryPath = findEntryImportPath(moduleFilePath, moduleGitPath.value, ValRouterCore.bytesToUtf8(moduleRes.value), key);
|
|
59
58
|
if (fp.result.isErr(entryPath)) {
|
|
60
59
|
return entryPath;
|
|
61
60
|
}
|
|
@@ -73,7 +72,7 @@ async function getJsonEntryAtCommit(ops, commitSha, moduleFilePath, key) {
|
|
|
73
72
|
return entryRes;
|
|
74
73
|
}
|
|
75
74
|
try {
|
|
76
|
-
return fp.result.ok(JSON.parse(entryRes.value
|
|
75
|
+
return fp.result.ok(JSON.parse(ValRouterCore.bytesToUtf8(entryRes.value)));
|
|
77
76
|
} catch (err) {
|
|
78
77
|
return fp.result.err({
|
|
79
78
|
kind: "file-unavailable",
|