@valbuild/shared 0.143.0 → 0.144.2
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 +31 -0
- package/dist/declarations/src/internal/ApiRoutes.d.ts +78 -107
- package/dist/declarations/src/internal/aiTools/aiImageToolPatches.d.ts +1 -1
- package/dist/declarations/src/internal/index.d.ts +1 -0
- package/dist/declarations/src/internal/publish/contentApi.d.ts +6 -0
- package/dist/declarations/src/internal/richtext/richTextImages.d.ts +21 -0
- package/dist/declarations/src/internal/server/types.d.ts +3 -3
- package/dist/declarations/src/internal/validation/partitionValidationErrors.d.ts +2 -1
- package/dist/declarations/src/internal/zod/History.d.ts +3 -3
- package/dist/declarations/src/internal/zod/Patch.d.ts +0 -1
- package/dist/declarations/src/internal/zod/SerializedSchema.d.ts +1 -1
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +126 -67
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +126 -67
- package/internal/dist/valbuild-shared-internal.esm.js +125 -68
- package/package.json +2 -2
|
@@ -426,4 +426,10 @@ export type PublishTabJob = {
|
|
|
426
426
|
base: string | null;
|
|
427
427
|
/** The changes its build is to include, on top of `base`. */
|
|
428
428
|
patches: string[];
|
|
429
|
+
/**
|
|
430
|
+
* Its content goes live on the build already live: content's prepare found
|
|
431
|
+
* it changes only Val content, which that build shows, so nothing is built
|
|
432
|
+
* for it. Set on the answer that hands it over (`step: null`).
|
|
433
|
+
*/
|
|
434
|
+
contentOnly?: true;
|
|
429
435
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SerializedImageSchema, SerializedRichTextSchema, SourcePath } from "@valbuild/core";
|
|
2
|
+
/**
|
|
3
|
+
* The image schema a rich text field's inline `img` nodes are validated with,
|
|
4
|
+
* when it is a real schema rather than `img: true`.
|
|
5
|
+
*
|
|
6
|
+
* It is the only way a rich text field can point INTO a gallery
|
|
7
|
+
* (`s.richtext({ img: s.image(galleryVal) })`), which is why every reference
|
|
8
|
+
* scan has to ask: the field's own schema is `richtext`, not `image`, so a walk
|
|
9
|
+
* that only looks for image leaves walks straight past the images in it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function richTextImageSchema(schema: SerializedRichTextSchema): SerializedImageSchema | null;
|
|
12
|
+
/**
|
|
13
|
+
* Every inline image in a rich text value, at the path of its `src`.
|
|
14
|
+
*
|
|
15
|
+
* `src` is a media value (`{ path, … }`), so the path handed out is one a
|
|
16
|
+
* patch can address — `field.0."children".1."src"` — and a rename rewrites
|
|
17
|
+
* `[…, "src", "path"]` there with the same op it uses on an image field.
|
|
18
|
+
* Images nest (a list item holds a paragraph holds the image), so the walk
|
|
19
|
+
* follows `children` all the way down.
|
|
20
|
+
*/
|
|
21
|
+
export declare function forEachRichTextImage(path: SourcePath, source: unknown, visit: (srcPath: SourcePath, src: Record<string, unknown>) => void): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Json } from "@valbuild/core";
|
|
2
|
-
export declare const VAL_SESSION_COOKIE:
|
|
3
|
-
export declare const VAL_STATE_COOKIE:
|
|
4
|
-
export declare const VAL_ENABLE_COOKIE_NAME:
|
|
2
|
+
export declare const VAL_SESSION_COOKIE: any;
|
|
3
|
+
export declare const VAL_STATE_COOKIE: any;
|
|
4
|
+
export declare const VAL_ENABLE_COOKIE_NAME: any;
|
|
5
5
|
export type VAL_SESSION_COOKIE = typeof VAL_SESSION_COOKIE;
|
|
6
6
|
export type VAL_STATE_COOKIE = typeof VAL_STATE_COOKIE;
|
|
7
7
|
export type VAL_ENABLE_COOKIE_NAME = typeof VAL_ENABLE_COOKIE_NAME;
|
|
@@ -5,7 +5,8 @@ import type { SourcePath, ValidationError } from "@valbuild/core";
|
|
|
5
5
|
* `skipped` errors carry only fix codes the user can't (or shouldn't) act on
|
|
6
6
|
* in the browser:
|
|
7
7
|
* - image/file metadata checks (need to read bytes from disk)
|
|
8
|
-
* - remote upload/download
|
|
8
|
+
* - remote upload/download, and the singular remote check (need a personal
|
|
9
|
+
* access token + network)
|
|
9
10
|
* - gallery directory uniqueness + untracked-files checks (need fs traversal)
|
|
10
11
|
*
|
|
11
12
|
* The server (ValOps + createFixPatch) resolves all of these automatically on
|
|
@@ -66,7 +66,7 @@ export type BinaryFileRef = z.infer<typeof BinaryFileRef>;
|
|
|
66
66
|
export declare const HistoricalModule: z.ZodObject<{
|
|
67
67
|
source: z.ZodNullable<z.ZodType<JSONValueT, unknown, z.core.$ZodTypeInternals<JSONValueT, unknown>>>;
|
|
68
68
|
schema: z.ZodNullable<z.ZodType<SerializedSchemaT, unknown, z.core.$ZodTypeInternals<SerializedSchemaT, unknown>>>;
|
|
69
|
-
patchIds: z.ZodArray<z.ZodString & z.ZodType<
|
|
69
|
+
patchIds: z.ZodArray<z.ZodString & z.ZodType<PatchIdT, string, z.core.$ZodTypeInternals<PatchIdT, string>>>;
|
|
70
70
|
changedPaths: z.ZodArray<z.ZodString>;
|
|
71
71
|
failures: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
72
72
|
kind: z.ZodLiteral<"commit-not-found">;
|
|
@@ -111,7 +111,7 @@ export declare const HistoricalPatchSet: z.ZodObject<{
|
|
|
111
111
|
modules: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
112
112
|
source: z.ZodNullable<z.ZodType<JSONValueT, unknown, z.core.$ZodTypeInternals<JSONValueT, unknown>>>;
|
|
113
113
|
schema: z.ZodNullable<z.ZodType<SerializedSchemaT, unknown, z.core.$ZodTypeInternals<SerializedSchemaT, unknown>>>;
|
|
114
|
-
patchIds: z.ZodArray<z.ZodString & z.ZodType<
|
|
114
|
+
patchIds: z.ZodArray<z.ZodString & z.ZodType<PatchIdT, string, z.core.$ZodTypeInternals<PatchIdT, string>>>;
|
|
115
115
|
changedPaths: z.ZodArray<z.ZodString>;
|
|
116
116
|
failures: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
117
117
|
kind: z.ZodLiteral<"commit-not-found">;
|
|
@@ -139,7 +139,7 @@ export declare const HistoricalPatchSet: z.ZodObject<{
|
|
|
139
139
|
}, z.core.$strip>], "kind">>;
|
|
140
140
|
}, z.core.$strip>>;
|
|
141
141
|
patches: z.ZodArray<z.ZodObject<{
|
|
142
|
-
patchId: z.ZodString & z.ZodType<
|
|
142
|
+
patchId: z.ZodString & z.ZodType<PatchIdT, string, z.core.$ZodTypeInternals<PatchIdT, string>>;
|
|
143
143
|
moduleFilePath: z.ZodString;
|
|
144
144
|
patch: z.ZodUnknown;
|
|
145
145
|
authorId: z.ZodNullable<z.ZodString>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { JSONValue as JSONValueT, PatchJSON as PatchJSONT, PatchBlock as PatchBlockT, ParentRef as ParentRefT } from "@valbuild/core/patch";
|
|
2
|
-
import type { PatchId as PatchIdT } from "@valbuild/core";
|
|
3
2
|
import { z } from "zod";
|
|
4
3
|
/**
|
|
5
4
|
* JSON, recursively — the shape of a Source over the wire.
|
|
@@ -83,7 +83,7 @@ export declare const SerializedSettingsSchema: z.ZodType<SerializedSettingsSchem
|
|
|
83
83
|
*/
|
|
84
84
|
export declare const SerializedValViewSchema: z.ZodObject<{
|
|
85
85
|
type: z.ZodLiteral<"view">;
|
|
86
|
-
moduleFilePath: z.ZodType<
|
|
86
|
+
moduleFilePath: z.ZodType<ModuleFilePathT, unknown, z.core.$ZodTypeInternals<ModuleFilePathT, unknown>>;
|
|
87
87
|
opt: z.ZodLiteral<false>;
|
|
88
88
|
readonly: z.ZodOptional<z.ZodBoolean>;
|
|
89
89
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var core = require('@valbuild/core');
|
|
6
5
|
var getSitemapTree = require('../../dist/getSitemapTree-c732e09a.cjs.dev.js');
|
|
6
|
+
var core = require('@valbuild/core');
|
|
7
7
|
var zod = require('zod');
|
|
8
8
|
var zodValidationError = require('zod-validation-error');
|
|
9
9
|
var FlexSearch = require('flexsearch');
|
|
@@ -657,6 +657,105 @@ function convertListItemToRemirrorParagraph(rtChildren) {
|
|
|
657
657
|
return children;
|
|
658
658
|
}
|
|
659
659
|
|
|
660
|
+
/**
|
|
661
|
+
* The one way to build a child's source path.
|
|
662
|
+
*
|
|
663
|
+
* There were five hand-rolled versions of this, three of them subtly different
|
|
664
|
+
* and two of them wrong, and the wrong ones were wrong in a way that hid: a
|
|
665
|
+
* module path segment has to be JSON-quoted if it is a string and bare if it is
|
|
666
|
+
* an array index, and both broken copies appended the raw key at the module
|
|
667
|
+
* root. An unquoted key parses fine as long as it contains no `.` — so every
|
|
668
|
+
* object field and every ordinary record key still resolved, and only a key with
|
|
669
|
+
* a dot in it broke. That is exactly what a media gallery is keyed by, so
|
|
670
|
+
* clicking a file in the Media panel navigated to
|
|
671
|
+
* `?p=/public/val/red-8x8_bfbd0.png`, which `splitModulePath` reads as the two
|
|
672
|
+
* segments `/public/val/red-8x8_bfbd0` and `png`, and the studio said the module
|
|
673
|
+
* was not found.
|
|
674
|
+
*
|
|
675
|
+
* So: one function, and never a template string. `Internal.createValPathOfItem`
|
|
676
|
+
* is the rule itself — `JSON.stringify` quotes a string and leaves a number
|
|
677
|
+
* bare, which is precisely the module-path grammar — and everything here defers
|
|
678
|
+
* to it rather than restating it.
|
|
679
|
+
*/
|
|
680
|
+
function sourcePathOfChild(parent, key) {
|
|
681
|
+
/**
|
|
682
|
+
* A parent that is already `…?p=` gets the key with no separator.
|
|
683
|
+
*
|
|
684
|
+
* The search index walks from `moduleFilePath + "?p="` rather than from the
|
|
685
|
+
* module file path, so that every path it produces has a module path — and
|
|
686
|
+
* `createValPathOfItem` would see the separator and join with a `.`, giving
|
|
687
|
+
* `?p=."title"`.
|
|
688
|
+
*/
|
|
689
|
+
if (parent.endsWith(core.Internal.ModuleFilePathSep)) {
|
|
690
|
+
return "".concat(parent).concat(JSON.stringify(key));
|
|
691
|
+
}
|
|
692
|
+
var path = core.Internal.createValPathOfItem(parent, key);
|
|
693
|
+
if (path === undefined) {
|
|
694
|
+
// Only when the parent is empty, which callers cannot produce: every walk
|
|
695
|
+
// starts from a module file path. Thrown rather than skipped so a future
|
|
696
|
+
// change that breaks that assumption is loud.
|
|
697
|
+
throw new Error("Could not build a source path for '".concat(key, "' under ").concat(parent));
|
|
698
|
+
}
|
|
699
|
+
return path;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* The same thing, for callers holding the module file path and module path apart.
|
|
704
|
+
*
|
|
705
|
+
* `ModulePath` is empty at the module root, which is the case both broken copies
|
|
706
|
+
* got wrong: there is no separator in the path yet, so the key is the first
|
|
707
|
+
* segment and still has to be quoted.
|
|
708
|
+
*/
|
|
709
|
+
function concatModulePath(moduleFilePath, modulePath, key) {
|
|
710
|
+
return sourcePathOfChild(modulePath ? core.Internal.joinModuleFilePathAndModulePath(moduleFilePath, modulePath) : moduleFilePath, key);
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* The image schema a rich text field's inline `img` nodes are validated with,
|
|
715
|
+
* when it is a real schema rather than `img: true`.
|
|
716
|
+
*
|
|
717
|
+
* It is the only way a rich text field can point INTO a gallery
|
|
718
|
+
* (`s.richtext({ img: s.image(galleryVal) })`), which is why every reference
|
|
719
|
+
* scan has to ask: the field's own schema is `richtext`, not `image`, so a walk
|
|
720
|
+
* that only looks for image leaves walks straight past the images in it.
|
|
721
|
+
*/
|
|
722
|
+
function richTextImageSchema(schema) {
|
|
723
|
+
var _schema$options;
|
|
724
|
+
var img = (_schema$options = schema.options) === null || _schema$options === void 0 ? void 0 : _schema$options.img;
|
|
725
|
+
return getSitemapTree._typeof(img) === "object" && img !== null ? img : null;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Every inline image in a rich text value, at the path of its `src`.
|
|
730
|
+
*
|
|
731
|
+
* `src` is a media value (`{ path, … }`), so the path handed out is one a
|
|
732
|
+
* patch can address — `field.0."children".1."src"` — and a rename rewrites
|
|
733
|
+
* `[…, "src", "path"]` there with the same op it uses on an image field.
|
|
734
|
+
* Images nest (a list item holds a paragraph holds the image), so the walk
|
|
735
|
+
* follows `children` all the way down.
|
|
736
|
+
*/
|
|
737
|
+
function forEachRichTextImage(path, source, visit) {
|
|
738
|
+
if (!Array.isArray(source)) {
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
for (var index = 0; index < source.length; index++) {
|
|
742
|
+
var node = source[index];
|
|
743
|
+
if (getSitemapTree._typeof(node) !== "object" || node === null || Array.isArray(node)) {
|
|
744
|
+
continue;
|
|
745
|
+
}
|
|
746
|
+
var nodePath = sourcePathOfChild(path, index);
|
|
747
|
+
if ("tag" in node && node.tag === "img" && "src" in node) {
|
|
748
|
+
var src = node.src;
|
|
749
|
+
if (getSitemapTree._typeof(src) === "object" && src !== null && !Array.isArray(src)) {
|
|
750
|
+
visit(sourcePathOfChild(nodePath, "src"), getSitemapTree._objectSpread2({}, src));
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
if ("children" in node) {
|
|
754
|
+
forEachRichTextImage(sourcePathOfChild(nodePath, "children"), node.children, visit);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
660
759
|
var VAL_SESSION_COOKIE = core.Internal.VAL_SESSION_COOKIE;
|
|
661
760
|
var VAL_STATE_COOKIE = core.Internal.VAL_STATE_COOKIE;
|
|
662
761
|
var VAL_ENABLE_COOKIE_NAME = core.Internal.VAL_ENABLE_COOKIE_NAME;
|
|
@@ -1172,7 +1271,7 @@ var SerializedRecordSchema = zod.z.lazy(function () {
|
|
|
1172
1271
|
dir: zod.z.string().optional(),
|
|
1173
1272
|
remote: zod.z["boolean"]().optional(),
|
|
1174
1273
|
encode: ImageEncodeOption.optional(),
|
|
1175
|
-
// A
|
|
1274
|
+
// A videodir's: see `VideoStreamOption` below for why it is spelled
|
|
1176
1275
|
// out rather than passed through.
|
|
1177
1276
|
stream: VideoStreamOption.optional(),
|
|
1178
1277
|
alt: SerializedSchema.optional(),
|
|
@@ -1228,7 +1327,7 @@ var SerializedVideoSchema = zod.z.object(getSitemapTree._objectSpread2(getSitema
|
|
|
1228
1327
|
options: VideoOptions.optional(),
|
|
1229
1328
|
opt: zod.z["boolean"](),
|
|
1230
1329
|
remote: zod.z["boolean"]().optional(),
|
|
1231
|
-
// The `s.
|
|
1330
|
+
// The `s.videodir()` a set-backed field picks from.
|
|
1232
1331
|
referencedModule: zod.z.string().optional()
|
|
1233
1332
|
}));
|
|
1234
1333
|
var DateOptions = zod.z.object({
|
|
@@ -5567,7 +5666,7 @@ function getSourceAt(source, path) {
|
|
|
5567
5666
|
* Walks `schema` along `path`, returning a structured result:
|
|
5568
5667
|
* - `leaf`: walked the full path; resolved schema at the end.
|
|
5569
5668
|
* - `richtext`: hit a richtext mid-walk; richtext is the resolved schema.
|
|
5570
|
-
* - `gallery-traversed`: hit an `s.
|
|
5669
|
+
* - `gallery-traversed`: hit an `s.imagedir()` record and walked past it (i.e. the
|
|
5571
5670
|
* path tries to address an entry inside the gallery — a clue the AI should
|
|
5572
5671
|
* have used the gallery tool instead).
|
|
5573
5672
|
* - `unresolved`: the path could not be walked.
|
|
@@ -5675,7 +5774,7 @@ function checkGallerySchema(moduleSchema) {
|
|
|
5675
5774
|
// looks like a gallery from here, and the tool can do nothing with one.
|
|
5676
5775
|
return {
|
|
5677
5776
|
kind: "error",
|
|
5678
|
-
message: "Module is a video set (s.
|
|
5777
|
+
message: "Module is a video set (s.videodir()), not an images gallery. Videos cannot be added or removed by this tool: upload them in Val Studio."
|
|
5679
5778
|
};
|
|
5680
5779
|
}
|
|
5681
5780
|
if (moduleSchema.type === "image") {
|
|
@@ -5706,7 +5805,7 @@ function buildImageGalleryPatch(args, moduleSchema) {
|
|
|
5706
5805
|
op: "add",
|
|
5707
5806
|
path: [args.filePath],
|
|
5708
5807
|
value: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, args.metadata), {}, {
|
|
5709
|
-
// `alt` is a REQUIRED field of a gallery entry (`s.
|
|
5808
|
+
// `alt` is a REQUIRED field of a gallery entry (`s.imagedir()` gives it a
|
|
5710
5809
|
// nullable string schema), so an entry written without one is invalid
|
|
5711
5810
|
// the moment it lands — and the caller that had no alt to give is the
|
|
5712
5811
|
// common case, not the odd one. Null is what the Studio's own upload
|
|
@@ -5769,7 +5868,7 @@ function buildRemoveImageGalleryEntryPatch(args, moduleSchema, moduleSource) {
|
|
|
5769
5868
|
var GALLERY_REDIRECT = {
|
|
5770
5869
|
kind: "wrong-tool",
|
|
5771
5870
|
suggestedTool: "add_session_image_to_gallery",
|
|
5772
|
-
reason: "Destination is a media gallery (s.
|
|
5871
|
+
reason: "Destination is a media gallery (s.imagedir() / s.filedir()). Gallery entries are keyed by file path and carry a file on disk, so they cannot be created with a plain patch. Use add_session_image_to_gallery."
|
|
5773
5872
|
};
|
|
5774
5873
|
|
|
5775
5874
|
/**
|
|
@@ -5779,10 +5878,10 @@ var GALLERY_REDIRECT = {
|
|
|
5779
5878
|
*/
|
|
5780
5879
|
var VIDEOSET_REFUSAL = {
|
|
5781
5880
|
kind: "error",
|
|
5782
|
-
message: "Destination is a video set (s.
|
|
5881
|
+
message: "Destination is a video set (s.videodir()). Its entries are keyed by file path and carry video files, so they cannot be created with a plain patch, and no tool here uploads a video: add it in Val Studio."
|
|
5783
5882
|
};
|
|
5784
5883
|
|
|
5785
|
-
/** An `s.
|
|
5884
|
+
/** An `s.imagedir()` / `s.filedir()` / `s.videodir()` record: a gallery, not an ordinary record. */
|
|
5786
5885
|
function isGallery(schema) {
|
|
5787
5886
|
return schema.type === "record" && schema.mediaType !== undefined;
|
|
5788
5887
|
}
|
|
@@ -6097,7 +6196,8 @@ function describeContainerAtPath(moduleSchema, moduleSource, path) {
|
|
|
6097
6196
|
* `skipped` errors carry only fix codes the user can't (or shouldn't) act on
|
|
6098
6197
|
* in the browser:
|
|
6099
6198
|
* - image/file metadata checks (need to read bytes from disk)
|
|
6100
|
-
* - remote upload/download
|
|
6199
|
+
* - remote upload/download, and the singular remote check (need a personal
|
|
6200
|
+
* access token + network)
|
|
6101
6201
|
* - gallery directory uniqueness + untracked-files checks (need fs traversal)
|
|
6102
6202
|
*
|
|
6103
6203
|
* The server (ValOps + createFixPatch) resolves all of these automatically on
|
|
@@ -6157,20 +6257,17 @@ function isSkippableFixCode(fix) {
|
|
|
6157
6257
|
case "image:upload-remote":
|
|
6158
6258
|
case "image:download-remote":
|
|
6159
6259
|
case "image:check-remote":
|
|
6160
|
-
case "images:check-remote":
|
|
6161
6260
|
case "images:upload-remote":
|
|
6162
6261
|
case "file:add-metadata":
|
|
6163
6262
|
case "file:check-metadata":
|
|
6164
6263
|
case "file:upload-remote":
|
|
6165
6264
|
case "file:download-remote":
|
|
6166
6265
|
case "file:check-remote":
|
|
6167
|
-
case "files:check-remote":
|
|
6168
6266
|
case "files:upload-remote":
|
|
6169
6267
|
case "video:add-metadata": // the Studio writes it on upload; --fix for the rest
|
|
6170
6268
|
case "video:upload-remote":
|
|
6171
6269
|
case "video:download-remote":
|
|
6172
6270
|
case "videos:add-metadata": // as `video:add-metadata`, for a set's entry
|
|
6173
|
-
case "videos:check-remote":
|
|
6174
6271
|
case "videos:upload-remote":
|
|
6175
6272
|
case "videos:check-unique-folder":
|
|
6176
6273
|
case "videos:check-all-files":
|
|
@@ -6181,6 +6278,18 @@ function isSkippableFixCode(fix) {
|
|
|
6181
6278
|
case "view:check-module":
|
|
6182
6279
|
// schema is code: nothing for an editor to do
|
|
6183
6280
|
return true;
|
|
6281
|
+
case "images:check-remote":
|
|
6282
|
+
case "files:check-remote":
|
|
6283
|
+
case "videos:check-remote":
|
|
6284
|
+
// A collection KEY that is wrong as a key: a remote URL in a gallery that
|
|
6285
|
+
// is not `.remote()`, one that does not parse, one outside the gallery's
|
|
6286
|
+
// directory. Unlike the singular `image:check-remote` above (core's "not
|
|
6287
|
+
// checked" marker on EVERY remote value, which the server does check),
|
|
6288
|
+
// core emits these only when the key is wrong, and nothing repairs that
|
|
6289
|
+
// on save -- not the server, not `val validate --fix`. Only a person knows
|
|
6290
|
+
// whether the key or the gallery's options are the mistake. Skipping them
|
|
6291
|
+
// also took them off the publish gate, so a broken key published unseen.
|
|
6292
|
+
return false;
|
|
6184
6293
|
case "keyof:check-keys":
|
|
6185
6294
|
case "router:check-route":
|
|
6186
6295
|
case "locale:check-locale":
|
|
@@ -6374,59 +6483,6 @@ function withExtension(filename, ext) {
|
|
|
6374
6483
|
return "".concat(base, ".").concat(ext);
|
|
6375
6484
|
}
|
|
6376
6485
|
|
|
6377
|
-
/**
|
|
6378
|
-
* The one way to build a child's source path.
|
|
6379
|
-
*
|
|
6380
|
-
* There were five hand-rolled versions of this, three of them subtly different
|
|
6381
|
-
* and two of them wrong, and the wrong ones were wrong in a way that hid: a
|
|
6382
|
-
* module path segment has to be JSON-quoted if it is a string and bare if it is
|
|
6383
|
-
* an array index, and both broken copies appended the raw key at the module
|
|
6384
|
-
* root. An unquoted key parses fine as long as it contains no `.` — so every
|
|
6385
|
-
* object field and every ordinary record key still resolved, and only a key with
|
|
6386
|
-
* a dot in it broke. That is exactly what a media gallery is keyed by, so
|
|
6387
|
-
* clicking a file in the Media panel navigated to
|
|
6388
|
-
* `?p=/public/val/red-8x8_bfbd0.png`, which `splitModulePath` reads as the two
|
|
6389
|
-
* segments `/public/val/red-8x8_bfbd0` and `png`, and the studio said the module
|
|
6390
|
-
* was not found.
|
|
6391
|
-
*
|
|
6392
|
-
* So: one function, and never a template string. `Internal.createValPathOfItem`
|
|
6393
|
-
* is the rule itself — `JSON.stringify` quotes a string and leaves a number
|
|
6394
|
-
* bare, which is precisely the module-path grammar — and everything here defers
|
|
6395
|
-
* to it rather than restating it.
|
|
6396
|
-
*/
|
|
6397
|
-
function sourcePathOfChild(parent, key) {
|
|
6398
|
-
/**
|
|
6399
|
-
* A parent that is already `…?p=` gets the key with no separator.
|
|
6400
|
-
*
|
|
6401
|
-
* The search index walks from `moduleFilePath + "?p="` rather than from the
|
|
6402
|
-
* module file path, so that every path it produces has a module path — and
|
|
6403
|
-
* `createValPathOfItem` would see the separator and join with a `.`, giving
|
|
6404
|
-
* `?p=."title"`.
|
|
6405
|
-
*/
|
|
6406
|
-
if (parent.endsWith(core.Internal.ModuleFilePathSep)) {
|
|
6407
|
-
return "".concat(parent).concat(JSON.stringify(key));
|
|
6408
|
-
}
|
|
6409
|
-
var path = core.Internal.createValPathOfItem(parent, key);
|
|
6410
|
-
if (path === undefined) {
|
|
6411
|
-
// Only when the parent is empty, which callers cannot produce: every walk
|
|
6412
|
-
// starts from a module file path. Thrown rather than skipped so a future
|
|
6413
|
-
// change that breaks that assumption is loud.
|
|
6414
|
-
throw new Error("Could not build a source path for '".concat(key, "' under ").concat(parent));
|
|
6415
|
-
}
|
|
6416
|
-
return path;
|
|
6417
|
-
}
|
|
6418
|
-
|
|
6419
|
-
/**
|
|
6420
|
-
* The same thing, for callers holding the module file path and module path apart.
|
|
6421
|
-
*
|
|
6422
|
-
* `ModulePath` is empty at the module root, which is the case both broken copies
|
|
6423
|
-
* got wrong: there is no separator in the path yet, so the key is the first
|
|
6424
|
-
* segment and still has to be quoted.
|
|
6425
|
-
*/
|
|
6426
|
-
function concatModulePath(moduleFilePath, modulePath, key) {
|
|
6427
|
-
return sourcePathOfChild(modulePath ? core.Internal.joinModuleFilePathAndModulePath(moduleFilePath, modulePath) : moduleFilePath, key);
|
|
6428
|
-
}
|
|
6429
|
-
|
|
6430
6486
|
/**
|
|
6431
6487
|
* Traverses a schema and source pair, calling a callback for each leaf node.
|
|
6432
6488
|
* Handles all schema types including primitives, objects, arrays, records, unions, richtext, files, images, etc.
|
|
@@ -7865,7 +7921,8 @@ var tabJob = zod.z.object({
|
|
|
7865
7921
|
id: zod.z.string(),
|
|
7866
7922
|
step: zod.z["enum"](["prepare", "build", "upload"]).nullable(),
|
|
7867
7923
|
base: zod.z.string().nullable(),
|
|
7868
|
-
patches: zod.z.array(zod.z.string())
|
|
7924
|
+
patches: zod.z.array(zod.z.string()),
|
|
7925
|
+
contentOnly: zod.z.literal(true).optional()
|
|
7869
7926
|
});
|
|
7870
7927
|
var pressResponse = zod.z.object({
|
|
7871
7928
|
request: requestStatus,
|
|
@@ -8056,6 +8113,7 @@ exports.filterRoutesByPatterns = filterRoutesByPatterns;
|
|
|
8056
8113
|
exports.findSimilar = findSimilar;
|
|
8057
8114
|
exports.fitWithin = fitWithin;
|
|
8058
8115
|
exports.flattenRichText = flattenRichText;
|
|
8116
|
+
exports.forEachRichTextImage = forEachRichTextImage;
|
|
8059
8117
|
exports.getErrorMessageFromUnknownJson = getErrorMessageFromUnknownJson;
|
|
8060
8118
|
exports.getFilenameFromRef = getFilenameFromRef;
|
|
8061
8119
|
exports.getInlineImgInfo = getInlineImgInfo;
|
|
@@ -8101,6 +8159,7 @@ exports.resolvePairGround = resolvePairGround;
|
|
|
8101
8159
|
exports.resolveSchemaSourceFixForError = resolveSchemaSourceFixForError;
|
|
8102
8160
|
exports.resolveSchemaSourceFixes = resolveSchemaSourceFixes;
|
|
8103
8161
|
exports.resolveSerializedSchemaAtPath = resolveSerializedSchemaAtPath;
|
|
8162
|
+
exports.richTextImageSchema = richTextImageSchema;
|
|
8104
8163
|
exports.richTextToRemirror = richTextToRemirror;
|
|
8105
8164
|
exports.safeParsePatch = safeParsePatch;
|
|
8106
8165
|
exports.sourcePathOfChild = sourcePathOfChild;
|