@valbuild/core 0.67.0 → 0.68.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/dist/declarations/src/expr/expr.d.ts +2 -2
- package/dist/declarations/src/expr/parser.d.ts +2 -2
- package/dist/declarations/src/index.d.ts +2 -25
- package/dist/declarations/src/initSchema.d.ts +50 -20
- package/dist/declarations/src/patch/index.d.ts +1 -1
- package/dist/declarations/src/patch/patch.d.ts +12 -0
- package/dist/declarations/src/schema/keyOf.d.ts +1 -1
- package/dist/declarations/src/schema/richtext.d.ts +21 -1
- package/dist/declarations/src/schema/union.d.ts +11 -1
- package/dist/declarations/src/schema/validation/ValidationFix.d.ts +1 -1
- package/dist/declarations/src/source/file.d.ts +2 -2
- package/dist/declarations/src/source/image.d.ts +2 -2
- package/dist/declarations/src/val/index.d.ts +6 -0
- package/dist/{index-062f9388.esm.js → index-1d65adb5.esm.js} +25 -19
- package/dist/{index-38cd75f9.cjs.dev.js → index-47055fcc.cjs.dev.js} +25 -19
- package/dist/{index-55eeef93.cjs.prod.js → index-6d63e99d.cjs.prod.js} +25 -19
- package/dist/valbuild-core.cjs.dev.js +1 -1
- package/dist/valbuild-core.cjs.prod.js +1 -1
- package/dist/valbuild-core.esm.js +1 -1
- package/expr/dist/valbuild-core-expr.cjs.dev.js +1 -1
- package/expr/dist/valbuild-core-expr.cjs.prod.js +1 -1
- package/expr/dist/valbuild-core-expr.esm.js +1 -1
- package/package.json +1 -1
- package/patch/dist/valbuild-core-patch.cjs.dev.js +1 -1
- package/patch/dist/valbuild-core-patch.cjs.prod.js +1 -1
- package/patch/dist/valbuild-core-patch.esm.js +2 -2
@@ -1,8 +1,8 @@
|
|
1
1
|
export declare abstract class Expr {
|
2
|
-
readonly span?: [number, number?] | undefined;
|
2
|
+
readonly span?: [number, (number | undefined)?] | undefined;
|
3
3
|
abstract type: "StringLiteral" | "Sym" | "StringTemplate" | "Call";
|
4
4
|
abstract transpile(): string;
|
5
|
-
constructor(span?: [number, number?] | undefined);
|
5
|
+
constructor(span?: [number, (number | undefined)?] | undefined);
|
6
6
|
}
|
7
7
|
export declare class StringLiteral extends Expr {
|
8
8
|
readonly value: string;
|
@@ -2,7 +2,7 @@ import { result } from "../fp/index.js";
|
|
2
2
|
import { Expr } from "./expr.js";
|
3
3
|
export declare class ParserError {
|
4
4
|
readonly message: string;
|
5
|
-
readonly span?: [number, number?] | undefined;
|
6
|
-
constructor(message: string, span?: [number, number?] | undefined);
|
5
|
+
readonly span?: [number, (number | undefined)?] | undefined;
|
6
|
+
constructor(message: string, span?: [number, (number | undefined)?] | undefined);
|
7
7
|
}
|
8
8
|
export declare function parse(input: string): result.Result<Expr, ParserError>;
|
@@ -10,7 +10,7 @@ export type { FileSource } from "./source/file.js";
|
|
10
10
|
export type { RawString } from "./schema/string.js";
|
11
11
|
export type { ImageSource } from "./source/image.js";
|
12
12
|
export type { AllRichTextOptions, Bold, Styles, HeadingNode, ImageNode, Italic, LineThrough, ListItemNode, LinkNode, OrderedListNode, ParagraphNode, BrNode, RichTextNode, RichTextOptions, RichTextSource, BlockNode, SpanNode, UnorderedListNode, } from "./source/richtext.js";
|
13
|
-
export { type Val, type SerializedVal, type ModuleFilePath, type PatchId, type ModulePath, type SourcePath, type JsonOfSource, } from "./val/index.js";
|
13
|
+
export { type Val, type SerializedVal, type ModuleFilePath, type PatchId, type ModulePath, type SourcePath, type JsonOfSource, type ParentPatchId, } from "./val/index.js";
|
14
14
|
export type { Json, JsonPrimitive, JsonArray, JsonObject } from "./Json.js";
|
15
15
|
export type { ValidationError, ValidationErrors, } from "./schema/validation/ValidationError.js";
|
16
16
|
export type { ValidationFix } from "./schema/validation/ValidationFix.js";
|
@@ -72,30 +72,7 @@ declare const Internal: {
|
|
72
72
|
[k: string]: string;
|
73
73
|
};
|
74
74
|
ModuleFilePathSep: string;
|
75
|
-
notFileOp: (op: Operation) =>
|
76
|
-
op: "add";
|
77
|
-
path: string[];
|
78
|
-
value: import("./patch/index.js").JSONValue;
|
79
|
-
} | {
|
80
|
-
op: "remove";
|
81
|
-
path: import("./fp/array.js").NonEmptyArray<string>;
|
82
|
-
} | {
|
83
|
-
op: "replace";
|
84
|
-
path: string[];
|
85
|
-
value: import("./patch/index.js").JSONValue;
|
86
|
-
} | {
|
87
|
-
op: "move";
|
88
|
-
from: import("./fp/array.js").NonEmptyArray<string>;
|
89
|
-
path: string[];
|
90
|
-
} | {
|
91
|
-
op: "copy";
|
92
|
-
from: string[];
|
93
|
-
path: string[];
|
94
|
-
} | {
|
95
|
-
op: "test";
|
96
|
-
path: string[];
|
97
|
-
value: import("./patch/index.js").JSONValue;
|
98
|
-
};
|
75
|
+
notFileOp: (op: Operation) => boolean;
|
99
76
|
isFileOp: (op: Operation) => op is {
|
100
77
|
op: "file";
|
101
78
|
path: string[];
|
@@ -20,7 +20,7 @@ export type InitSchema = {
|
|
20
20
|
readonly union: typeof union;
|
21
21
|
readonly richtext: typeof richtext;
|
22
22
|
/**
|
23
|
-
* Define
|
23
|
+
* Define an image.
|
24
24
|
*
|
25
25
|
* Use c.image to create an image source.
|
26
26
|
*
|
@@ -45,30 +45,60 @@ export type InitSchema = {
|
|
45
45
|
readonly date: typeof date;
|
46
46
|
};
|
47
47
|
export declare function initSchema(): {
|
48
|
-
string: <T extends string>(options?: Record<string, never>) => import("./schema/string.js").StringSchema<T>;
|
48
|
+
string: <T extends string>(options?: Record<string, never> | undefined) => import("./schema/string.js").StringSchema<T>;
|
49
49
|
boolean: () => import("./schema/index.js").Schema<boolean>;
|
50
50
|
array: <S extends import("./schema/index.js").Schema<import("./selector/index.js").SelectorSource>>(schema: S) => import("./schema/index.js").Schema<import("./schema/index.js").SelectorOfSchema<S>[]>;
|
51
51
|
object: <Props extends {
|
52
52
|
[key: string]: import("./schema/index.js").Schema<import("./selector/index.js").SelectorSource>;
|
53
53
|
} & {
|
54
|
-
valPath?:
|
55
|
-
val?:
|
56
|
-
_type?:
|
57
|
-
_ref?:
|
58
|
-
andThen?:
|
59
|
-
assert?:
|
60
|
-
fold?:
|
54
|
+
valPath?: undefined;
|
55
|
+
val?: undefined;
|
56
|
+
_type?: undefined;
|
57
|
+
_ref?: undefined;
|
58
|
+
andThen?: undefined;
|
59
|
+
assert?: undefined;
|
60
|
+
fold?: undefined;
|
61
61
|
}>(schema: Props) => import("./schema/index.js").Schema<{ [key in keyof Props]: import("./schema/index.js").SelectorOfSchema<Props[key]>; }>;
|
62
62
|
number: (options?: {
|
63
|
-
max?: number;
|
64
|
-
min?: number;
|
65
|
-
}) => import("./schema/index.js").Schema<number>;
|
66
|
-
union: <Key extends string | import("./schema/index.js").Schema<string>,
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
63
|
+
max?: number | undefined;
|
64
|
+
min?: number | undefined;
|
65
|
+
} | undefined) => import("./schema/index.js").Schema<number>;
|
66
|
+
union: <Key extends string | import("./schema/index.js").Schema<string>, T_1 extends import("./schema/index.js").Schema<Key extends string ? {
|
67
|
+
[x: string]: import("./source/index.js").Source;
|
68
|
+
} & {
|
69
|
+
fold?: undefined;
|
70
|
+
assert?: undefined;
|
71
|
+
andThen?: undefined;
|
72
|
+
_ref?: undefined;
|
73
|
+
_type?: undefined;
|
74
|
+
val?: undefined;
|
75
|
+
valPath?: undefined;
|
76
|
+
} & { [k in Key]: string; } : Key extends import("./schema/index.js").Schema<string> ? string : unknown>[]>(key: Key, ...objects: T_1) => import("./schema/index.js").Schema<T_1 extends import("./schema/index.js").Schema<infer S_1 extends import("./selector/index.js").SelectorSource>[] ? S_1 extends import("./selector/index.js").SelectorSource ? S_1 | (Key extends import("./schema/index.js").Schema<infer K extends import("./selector/index.js").SelectorSource> ? K : never) : never : never>;
|
77
|
+
richtext: <O extends Partial<{
|
78
|
+
style: Partial<{
|
79
|
+
bold: boolean;
|
80
|
+
italic: boolean;
|
81
|
+
lineThrough: boolean;
|
82
|
+
}>;
|
83
|
+
block: Partial<{
|
84
|
+
h1: boolean;
|
85
|
+
h2: boolean;
|
86
|
+
h3: boolean;
|
87
|
+
h4: boolean;
|
88
|
+
h5: boolean;
|
89
|
+
h6: boolean;
|
90
|
+
ul: boolean;
|
91
|
+
ol: boolean;
|
92
|
+
}>;
|
93
|
+
inline: Partial<{
|
94
|
+
a: boolean;
|
95
|
+
img: boolean;
|
96
|
+
}>;
|
97
|
+
}>>(options?: O | undefined) => import("./schema/index.js").Schema<import("./index.js").RichTextSource<O>>;
|
98
|
+
image: (options?: import("./schema/image.js").ImageOptions | undefined) => import("./schema/index.js").Schema<import("./index.js").ImageSource>;
|
99
|
+
literal: <T_2 extends string>(value: T_2) => import("./schema/literal.js").LiteralSchema<T_2>;
|
100
|
+
keyOf: <Src extends import("./selector/index.js").GenericSelector<import("./source/index.js").SourceObject, undefined> & import("./module.js").ValModuleBrand>(valModule: Src) => import("./schema/index.js").Schema<Src extends import("./selector/index.js").GenericSelector<infer S_2 extends import("./source/index.js").Source, undefined> ? S_2 extends readonly import("./source/index.js").Source[] ? number : S_2 extends import("./source/index.js").SourceObject ? string extends keyof S_2 ? import("./schema/string.js").RawString : keyof S_2 : S_2 extends Record<string, import("./source/index.js").Source> ? import("./schema/string.js").RawString : never : never>;
|
101
|
+
record: <S_3 extends import("./schema/index.js").Schema<import("./selector/index.js").SelectorSource>>(schema: S_3) => import("./schema/index.js").Schema<Record<string, import("./schema/index.js").SelectorOfSchema<S_3>>>;
|
102
|
+
file: (options?: import("./schema/file.js").FileOptions | undefined) => import("./schema/index.js").Schema<import("./index.js").FileSource<import("./schema/file.js").FileMetadata>>;
|
103
|
+
date: (options?: Record<string, never> | undefined) => import("./schema/date.js").DateSchema<import("./schema/string.js").RawString>;
|
74
104
|
};
|
@@ -2,5 +2,5 @@ export { JSONOps } from "./json.js";
|
|
2
2
|
export { type OperationJSON, type Operation } from "./operation.js";
|
3
3
|
export { parsePatch, parseJSONPointer, formatJSONPointer } from "./parse.js";
|
4
4
|
export { type JSONValue, type Ops, PatchError } from "./ops.js";
|
5
|
-
export { type PatchJSON, type Patch, applyPatch } from "./patch.js";
|
5
|
+
export { type PatchJSON, type Patch, applyPatch, type PatchBlock, type ParentRef, } from "./patch.js";
|
6
6
|
export { isNotRoot, deepEqual, deepClone, parseAndValidateArrayIndex, sourceToPatchPath, } from "./util.js";
|
@@ -1,6 +1,18 @@
|
|
1
1
|
import { result } from "../fp/index.js";
|
2
2
|
import { Ops, PatchError } from "./ops.js";
|
3
3
|
import { Operation, OperationJSON } from "./operation.js";
|
4
|
+
import { PatchId } from "../val/index.js";
|
4
5
|
export type Patch = Operation[];
|
5
6
|
export type PatchJSON = OperationJSON[];
|
7
|
+
export type ParentRef = {
|
8
|
+
type: "head";
|
9
|
+
headBaseSha: string;
|
10
|
+
} | {
|
11
|
+
type: "patch";
|
12
|
+
patchId: PatchId;
|
13
|
+
};
|
14
|
+
export type PatchBlock = {
|
15
|
+
patch: Patch;
|
16
|
+
parentRef: ParentRef;
|
17
|
+
};
|
6
18
|
export declare function applyPatch<T, E>(document: T, ops: Ops<T, E>, patch: Operation[]): result.Result<T, E | PatchError>;
|
@@ -23,5 +23,5 @@ export declare class KeyOfSchema<Sel extends GenericSelector<SourceObject>, Src
|
|
23
23
|
nullable(): Schema<Src | null>;
|
24
24
|
serialize(): SerializedSchema;
|
25
25
|
}
|
26
|
-
export declare const keyOf: <Src extends GenericSelector<SourceObject> & ValModuleBrand>(valModule: Src) => Schema<KeyOfSelector<Src>>;
|
26
|
+
export declare const keyOf: <Src extends GenericSelector<SourceObject, undefined> & ValModuleBrand>(valModule: Src) => Schema<KeyOfSelector<Src>>;
|
27
27
|
export {};
|
@@ -17,4 +17,24 @@ export declare class RichTextSchema<O extends RichTextOptions, Src extends RichT
|
|
17
17
|
nullable(): Schema<Src | null>;
|
18
18
|
serialize(): SerializedSchema;
|
19
19
|
}
|
20
|
-
export declare const richtext: <O extends
|
20
|
+
export declare const richtext: <O extends Partial<{
|
21
|
+
style: Partial<{
|
22
|
+
bold: boolean;
|
23
|
+
italic: boolean;
|
24
|
+
lineThrough: boolean;
|
25
|
+
}>;
|
26
|
+
block: Partial<{
|
27
|
+
h1: boolean;
|
28
|
+
h2: boolean;
|
29
|
+
h3: boolean;
|
30
|
+
h4: boolean;
|
31
|
+
h5: boolean;
|
32
|
+
h6: boolean;
|
33
|
+
ul: boolean;
|
34
|
+
ol: boolean;
|
35
|
+
}>;
|
36
|
+
inline: Partial<{
|
37
|
+
a: boolean;
|
38
|
+
img: boolean;
|
39
|
+
}>;
|
40
|
+
}>>(options?: O | undefined) => Schema<RichTextSource<O>>;
|
@@ -33,5 +33,15 @@ export declare class UnionSchema<Key extends string | Schema<string>, T extends
|
|
33
33
|
serialize(): SerializedSchema;
|
34
34
|
constructor(key: Key, items: T, opt?: boolean);
|
35
35
|
}
|
36
|
-
export declare const union: <Key extends string | Schema<string>, T extends Schema<Key extends string ?
|
36
|
+
export declare const union: <Key extends string | Schema<string>, T extends Schema<Key extends string ? {
|
37
|
+
[x: string]: import("../source/index.js").Source;
|
38
|
+
} & {
|
39
|
+
fold?: undefined;
|
40
|
+
assert?: undefined;
|
41
|
+
andThen?: undefined;
|
42
|
+
_ref?: undefined;
|
43
|
+
_type?: undefined;
|
44
|
+
val?: undefined;
|
45
|
+
valPath?: undefined;
|
46
|
+
} & { [k in Key]: string; } : Key extends Schema<string> ? string : unknown>[]>(key: Key, ...objects: T) => Schema<SourceOf<Key, T>>;
|
37
47
|
export {};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare const ValidationFix: readonly ["image:add-metadata", "image:
|
1
|
+
export declare const ValidationFix: readonly ["image:change-extension", "image:add-metadata", "image:check-metadata", "file:change-extension", "file:add-metadata", "file:check-metadata"];
|
2
2
|
export type ValidationFix = (typeof ValidationFix)[number];
|
@@ -22,7 +22,7 @@ export type FileSource<Metadata extends FileMetadata | undefined = FileMetadata
|
|
22
22
|
export declare const initFile: (config?: ValConfig) => {
|
23
23
|
<Metadata extends {
|
24
24
|
readonly [key: string]: Json;
|
25
|
-
}>(ref:
|
26
|
-
(ref:
|
25
|
+
}>(ref: `/public/${string}/${string}`, metadata: Metadata): FileSource<Metadata>;
|
26
|
+
(ref: `/public/${string}/${string}`, metadata?: undefined): FileSource<undefined>;
|
27
27
|
};
|
28
28
|
export declare function isFile(obj: unknown): obj is FileSource;
|
@@ -14,6 +14,6 @@ export type ImageSource<Metadata extends ImageMetadata | undefined = ImageMetada
|
|
14
14
|
readonly patch_id?: string;
|
15
15
|
};
|
16
16
|
export declare const initImage: (config?: ValConfig) => {
|
17
|
-
(ref:
|
18
|
-
(ref:
|
17
|
+
(ref: `/public/${string}/${string}`, metadata: ImageMetadata): ImageSource<ImageMetadata>;
|
18
|
+
(ref: `/public/${string}/${string}`, metadata?: undefined): ImageSource<undefined>;
|
19
19
|
};
|
@@ -53,5 +53,11 @@ export type ModuleFilePath = string & {
|
|
53
53
|
export type PatchId = string & {
|
54
54
|
[brand]: "PatchId";
|
55
55
|
};
|
56
|
+
/**
|
57
|
+
* The patchId of the parent patch, or "head" if there is no parent patch.
|
58
|
+
*/
|
59
|
+
export type ParentPatchId = string & {
|
60
|
+
[brand]: "ParentPatchId";
|
61
|
+
};
|
56
62
|
export declare function getValPath(valOrSelector: Val<Json> | Selector<Source>): SourcePath | undefined;
|
57
63
|
export {};
|
@@ -447,7 +447,8 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
447
447
|
if (src[VAL_EXTENSION] !== "file") {
|
448
448
|
return _defineProperty({}, path, [{
|
449
449
|
message: "File did not have the valid file extension type. Got: ".concat(src[VAL_EXTENSION]),
|
450
|
-
value: src
|
450
|
+
value: src,
|
451
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
451
452
|
}]);
|
452
453
|
}
|
453
454
|
var _ref4 = this.options || {},
|
@@ -457,7 +458,8 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
457
458
|
if (accept && mimeType && !mimeType.includes("/")) {
|
458
459
|
return _defineProperty({}, path, [{
|
459
460
|
message: "Invalid mime type format. Got: ".concat(mimeType),
|
460
|
-
value: src
|
461
|
+
value: src,
|
462
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
461
463
|
}]);
|
462
464
|
}
|
463
465
|
if (accept && mimeType && mimeType.includes("/")) {
|
@@ -477,7 +479,8 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
477
479
|
if (!isValidMimeType) {
|
478
480
|
return _defineProperty({}, path, [{
|
479
481
|
message: "Mime type mismatch. Found '".concat(mimeType, "' but schema accepts '").concat(accept, "'"),
|
480
|
-
value: src
|
482
|
+
value: src,
|
483
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
481
484
|
}]);
|
482
485
|
}
|
483
486
|
}
|
@@ -485,13 +488,15 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
485
488
|
if (!fileMimeType) {
|
486
489
|
return _defineProperty({}, path, [{
|
487
490
|
message: "Could not determine mime type from file extension. Got: ".concat(src[FILE_REF_PROP]),
|
488
|
-
value: src
|
491
|
+
value: src,
|
492
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
489
493
|
}]);
|
490
494
|
}
|
491
495
|
if (fileMimeType !== mimeType) {
|
492
496
|
return _defineProperty({}, path, [{
|
493
497
|
message: "Mime type and file extension not matching. Mime type is '".concat(mimeType, "' but file extension is '").concat(fileMimeType, "'"),
|
494
|
-
value: src
|
498
|
+
value: src,
|
499
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
495
500
|
}]);
|
496
501
|
}
|
497
502
|
if (src.metadata) {
|
@@ -625,6 +630,10 @@ function isVal(val) {
|
|
625
630
|
* '/app/blogs.val.ts'
|
626
631
|
*/
|
627
632
|
|
633
|
+
/**
|
634
|
+
* The patchId of the parent patch, or "head" if there is no parent patch.
|
635
|
+
*/
|
636
|
+
|
628
637
|
function getValPath(valOrSelector) {
|
629
638
|
return valOrSelector[Path$1];
|
630
639
|
}
|
@@ -2092,14 +2101,6 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
2092
2101
|
return _createClass(RichTextSchema, [{
|
2093
2102
|
key: "validate",
|
2094
2103
|
value: function validate(path, src) {
|
2095
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2096
|
-
if (src !== null && src !== void 0 && src.markdownish) {
|
2097
|
-
return _defineProperty({}, path, [{
|
2098
|
-
message: "Replace markdown with structured format",
|
2099
|
-
value: src,
|
2100
|
-
fixes: ["fix:deprecated-richtext"]
|
2101
|
-
}]);
|
2102
|
-
}
|
2103
2104
|
var assertRes = this.assert(path, src);
|
2104
2105
|
if (!assertRes.success) {
|
2105
2106
|
return _defineProperty({}, path, assertRes.errors[path]);
|
@@ -2294,7 +2295,8 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2294
2295
|
if (src[VAL_EXTENSION] !== "file") {
|
2295
2296
|
return _defineProperty({}, path, [{
|
2296
2297
|
message: "Image did not have the valid file extension type. Got: ".concat(src[VAL_EXTENSION]),
|
2297
|
-
value: src
|
2298
|
+
value: src,
|
2299
|
+
fixes: ["image:change-extension", "image:check-metadata"]
|
2298
2300
|
}]);
|
2299
2301
|
}
|
2300
2302
|
var _ref4 = this.options || {},
|
@@ -2304,7 +2306,8 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2304
2306
|
if (accept && mimeType && !mimeType.includes("/")) {
|
2305
2307
|
return _defineProperty({}, path, [{
|
2306
2308
|
message: "Invalid mime type format. Got: '".concat(mimeType, "'"),
|
2307
|
-
value: src
|
2309
|
+
value: src,
|
2310
|
+
fixes: ["image:check-metadata"]
|
2308
2311
|
}]);
|
2309
2312
|
}
|
2310
2313
|
if (accept && mimeType && mimeType.includes("/")) {
|
@@ -2324,7 +2327,8 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2324
2327
|
if (!isValidMimeType) {
|
2325
2328
|
return _defineProperty({}, path, [{
|
2326
2329
|
message: "Mime type mismatch. Found '".concat(mimeType, "' but schema accepts '").concat(accept, "'"),
|
2327
|
-
value: src
|
2330
|
+
value: src,
|
2331
|
+
fixes: ["image:check-metadata"]
|
2328
2332
|
}]);
|
2329
2333
|
}
|
2330
2334
|
}
|
@@ -2332,13 +2336,15 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2332
2336
|
if (!fileMimeType) {
|
2333
2337
|
return _defineProperty({}, path, [{
|
2334
2338
|
message: "Could not determine mime type from file extension. Got: ".concat(src[FILE_REF_PROP]),
|
2335
|
-
value: src
|
2339
|
+
value: src,
|
2340
|
+
fixes: ["image:check-metadata"]
|
2336
2341
|
}]);
|
2337
2342
|
}
|
2338
2343
|
if (fileMimeType && mimeType && fileMimeType !== mimeType) {
|
2339
2344
|
return _defineProperty({}, path, [{
|
2340
2345
|
message: "Mime type and file extension not matching. Mime type is '".concat(mimeType, "' but file extension is '").concat(fileMimeType, "'"),
|
2341
|
-
value: src
|
2346
|
+
value: src,
|
2347
|
+
fixes: ["image:check-metadata"]
|
2342
2348
|
}]);
|
2343
2349
|
}
|
2344
2350
|
if (src.metadata) {
|
@@ -2354,7 +2360,7 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2354
2360
|
message: "Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and the mime type.",
|
2355
2361
|
// These validation errors will have to be picked up by logic outside of this package and revalidated. Reasons: 1) we have to read files to verify the metadata, which is handled differently in different runtimes (Browser, QuickJS, Node.js); 2) we want to keep this package dependency free.
|
2356
2362
|
value: src,
|
2357
|
-
fixes: ["image:
|
2363
|
+
fixes: ["image:check-metadata"]
|
2358
2364
|
}]);
|
2359
2365
|
}
|
2360
2366
|
return _defineProperty({}, path, [{
|
@@ -449,7 +449,8 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
449
449
|
if (src[VAL_EXTENSION] !== "file") {
|
450
450
|
return _defineProperty({}, path, [{
|
451
451
|
message: "File did not have the valid file extension type. Got: ".concat(src[VAL_EXTENSION]),
|
452
|
-
value: src
|
452
|
+
value: src,
|
453
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
453
454
|
}]);
|
454
455
|
}
|
455
456
|
var _ref4 = this.options || {},
|
@@ -459,7 +460,8 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
459
460
|
if (accept && mimeType && !mimeType.includes("/")) {
|
460
461
|
return _defineProperty({}, path, [{
|
461
462
|
message: "Invalid mime type format. Got: ".concat(mimeType),
|
462
|
-
value: src
|
463
|
+
value: src,
|
464
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
463
465
|
}]);
|
464
466
|
}
|
465
467
|
if (accept && mimeType && mimeType.includes("/")) {
|
@@ -479,7 +481,8 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
479
481
|
if (!isValidMimeType) {
|
480
482
|
return _defineProperty({}, path, [{
|
481
483
|
message: "Mime type mismatch. Found '".concat(mimeType, "' but schema accepts '").concat(accept, "'"),
|
482
|
-
value: src
|
484
|
+
value: src,
|
485
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
483
486
|
}]);
|
484
487
|
}
|
485
488
|
}
|
@@ -487,13 +490,15 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
487
490
|
if (!fileMimeType) {
|
488
491
|
return _defineProperty({}, path, [{
|
489
492
|
message: "Could not determine mime type from file extension. Got: ".concat(src[FILE_REF_PROP]),
|
490
|
-
value: src
|
493
|
+
value: src,
|
494
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
491
495
|
}]);
|
492
496
|
}
|
493
497
|
if (fileMimeType !== mimeType) {
|
494
498
|
return _defineProperty({}, path, [{
|
495
499
|
message: "Mime type and file extension not matching. Mime type is '".concat(mimeType, "' but file extension is '").concat(fileMimeType, "'"),
|
496
|
-
value: src
|
500
|
+
value: src,
|
501
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
497
502
|
}]);
|
498
503
|
}
|
499
504
|
if (src.metadata) {
|
@@ -627,6 +632,10 @@ function isVal(val) {
|
|
627
632
|
* '/app/blogs.val.ts'
|
628
633
|
*/
|
629
634
|
|
635
|
+
/**
|
636
|
+
* The patchId of the parent patch, or "head" if there is no parent patch.
|
637
|
+
*/
|
638
|
+
|
630
639
|
function getValPath(valOrSelector) {
|
631
640
|
return valOrSelector[Path$1];
|
632
641
|
}
|
@@ -2094,14 +2103,6 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
2094
2103
|
return _createClass(RichTextSchema, [{
|
2095
2104
|
key: "validate",
|
2096
2105
|
value: function validate(path, src) {
|
2097
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2098
|
-
if (src !== null && src !== void 0 && src.markdownish) {
|
2099
|
-
return _defineProperty({}, path, [{
|
2100
|
-
message: "Replace markdown with structured format",
|
2101
|
-
value: src,
|
2102
|
-
fixes: ["fix:deprecated-richtext"]
|
2103
|
-
}]);
|
2104
|
-
}
|
2105
2106
|
var assertRes = this.assert(path, src);
|
2106
2107
|
if (!assertRes.success) {
|
2107
2108
|
return _defineProperty({}, path, assertRes.errors[path]);
|
@@ -2296,7 +2297,8 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2296
2297
|
if (src[VAL_EXTENSION] !== "file") {
|
2297
2298
|
return _defineProperty({}, path, [{
|
2298
2299
|
message: "Image did not have the valid file extension type. Got: ".concat(src[VAL_EXTENSION]),
|
2299
|
-
value: src
|
2300
|
+
value: src,
|
2301
|
+
fixes: ["image:change-extension", "image:check-metadata"]
|
2300
2302
|
}]);
|
2301
2303
|
}
|
2302
2304
|
var _ref4 = this.options || {},
|
@@ -2306,7 +2308,8 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2306
2308
|
if (accept && mimeType && !mimeType.includes("/")) {
|
2307
2309
|
return _defineProperty({}, path, [{
|
2308
2310
|
message: "Invalid mime type format. Got: '".concat(mimeType, "'"),
|
2309
|
-
value: src
|
2311
|
+
value: src,
|
2312
|
+
fixes: ["image:check-metadata"]
|
2310
2313
|
}]);
|
2311
2314
|
}
|
2312
2315
|
if (accept && mimeType && mimeType.includes("/")) {
|
@@ -2326,7 +2329,8 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2326
2329
|
if (!isValidMimeType) {
|
2327
2330
|
return _defineProperty({}, path, [{
|
2328
2331
|
message: "Mime type mismatch. Found '".concat(mimeType, "' but schema accepts '").concat(accept, "'"),
|
2329
|
-
value: src
|
2332
|
+
value: src,
|
2333
|
+
fixes: ["image:check-metadata"]
|
2330
2334
|
}]);
|
2331
2335
|
}
|
2332
2336
|
}
|
@@ -2334,13 +2338,15 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2334
2338
|
if (!fileMimeType) {
|
2335
2339
|
return _defineProperty({}, path, [{
|
2336
2340
|
message: "Could not determine mime type from file extension. Got: ".concat(src[FILE_REF_PROP]),
|
2337
|
-
value: src
|
2341
|
+
value: src,
|
2342
|
+
fixes: ["image:check-metadata"]
|
2338
2343
|
}]);
|
2339
2344
|
}
|
2340
2345
|
if (fileMimeType && mimeType && fileMimeType !== mimeType) {
|
2341
2346
|
return _defineProperty({}, path, [{
|
2342
2347
|
message: "Mime type and file extension not matching. Mime type is '".concat(mimeType, "' but file extension is '").concat(fileMimeType, "'"),
|
2343
|
-
value: src
|
2348
|
+
value: src,
|
2349
|
+
fixes: ["image:check-metadata"]
|
2344
2350
|
}]);
|
2345
2351
|
}
|
2346
2352
|
if (src.metadata) {
|
@@ -2356,7 +2362,7 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2356
2362
|
message: "Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and the mime type.",
|
2357
2363
|
// These validation errors will have to be picked up by logic outside of this package and revalidated. Reasons: 1) we have to read files to verify the metadata, which is handled differently in different runtimes (Browser, QuickJS, Node.js); 2) we want to keep this package dependency free.
|
2358
2364
|
value: src,
|
2359
|
-
fixes: ["image:
|
2365
|
+
fixes: ["image:check-metadata"]
|
2360
2366
|
}]);
|
2361
2367
|
}
|
2362
2368
|
return _defineProperty({}, path, [{
|
@@ -449,7 +449,8 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
449
449
|
if (src[VAL_EXTENSION] !== "file") {
|
450
450
|
return _defineProperty({}, path, [{
|
451
451
|
message: "File did not have the valid file extension type. Got: ".concat(src[VAL_EXTENSION]),
|
452
|
-
value: src
|
452
|
+
value: src,
|
453
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
453
454
|
}]);
|
454
455
|
}
|
455
456
|
var _ref4 = this.options || {},
|
@@ -459,7 +460,8 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
459
460
|
if (accept && mimeType && !mimeType.includes("/")) {
|
460
461
|
return _defineProperty({}, path, [{
|
461
462
|
message: "Invalid mime type format. Got: ".concat(mimeType),
|
462
|
-
value: src
|
463
|
+
value: src,
|
464
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
463
465
|
}]);
|
464
466
|
}
|
465
467
|
if (accept && mimeType && mimeType.includes("/")) {
|
@@ -479,7 +481,8 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
479
481
|
if (!isValidMimeType) {
|
480
482
|
return _defineProperty({}, path, [{
|
481
483
|
message: "Mime type mismatch. Found '".concat(mimeType, "' but schema accepts '").concat(accept, "'"),
|
482
|
-
value: src
|
484
|
+
value: src,
|
485
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
483
486
|
}]);
|
484
487
|
}
|
485
488
|
}
|
@@ -487,13 +490,15 @@ var FileSchema = /*#__PURE__*/function (_Schema) {
|
|
487
490
|
if (!fileMimeType) {
|
488
491
|
return _defineProperty({}, path, [{
|
489
492
|
message: "Could not determine mime type from file extension. Got: ".concat(src[FILE_REF_PROP]),
|
490
|
-
value: src
|
493
|
+
value: src,
|
494
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
491
495
|
}]);
|
492
496
|
}
|
493
497
|
if (fileMimeType !== mimeType) {
|
494
498
|
return _defineProperty({}, path, [{
|
495
499
|
message: "Mime type and file extension not matching. Mime type is '".concat(mimeType, "' but file extension is '").concat(fileMimeType, "'"),
|
496
|
-
value: src
|
500
|
+
value: src,
|
501
|
+
fixes: ["file:change-extension", "file:check-metadata"]
|
497
502
|
}]);
|
498
503
|
}
|
499
504
|
if (src.metadata) {
|
@@ -627,6 +632,10 @@ function isVal(val) {
|
|
627
632
|
* '/app/blogs.val.ts'
|
628
633
|
*/
|
629
634
|
|
635
|
+
/**
|
636
|
+
* The patchId of the parent patch, or "head" if there is no parent patch.
|
637
|
+
*/
|
638
|
+
|
630
639
|
function getValPath(valOrSelector) {
|
631
640
|
return valOrSelector[Path$1];
|
632
641
|
}
|
@@ -2094,14 +2103,6 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
|
|
2094
2103
|
return _createClass(RichTextSchema, [{
|
2095
2104
|
key: "validate",
|
2096
2105
|
value: function validate(path, src) {
|
2097
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2098
|
-
if (src !== null && src !== void 0 && src.markdownish) {
|
2099
|
-
return _defineProperty({}, path, [{
|
2100
|
-
message: "Replace markdown with structured format",
|
2101
|
-
value: src,
|
2102
|
-
fixes: ["fix:deprecated-richtext"]
|
2103
|
-
}]);
|
2104
|
-
}
|
2105
2106
|
var assertRes = this.assert(path, src);
|
2106
2107
|
if (!assertRes.success) {
|
2107
2108
|
return _defineProperty({}, path, assertRes.errors[path]);
|
@@ -2296,7 +2297,8 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2296
2297
|
if (src[VAL_EXTENSION] !== "file") {
|
2297
2298
|
return _defineProperty({}, path, [{
|
2298
2299
|
message: "Image did not have the valid file extension type. Got: ".concat(src[VAL_EXTENSION]),
|
2299
|
-
value: src
|
2300
|
+
value: src,
|
2301
|
+
fixes: ["image:change-extension", "image:check-metadata"]
|
2300
2302
|
}]);
|
2301
2303
|
}
|
2302
2304
|
var _ref4 = this.options || {},
|
@@ -2306,7 +2308,8 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2306
2308
|
if (accept && mimeType && !mimeType.includes("/")) {
|
2307
2309
|
return _defineProperty({}, path, [{
|
2308
2310
|
message: "Invalid mime type format. Got: '".concat(mimeType, "'"),
|
2309
|
-
value: src
|
2311
|
+
value: src,
|
2312
|
+
fixes: ["image:check-metadata"]
|
2310
2313
|
}]);
|
2311
2314
|
}
|
2312
2315
|
if (accept && mimeType && mimeType.includes("/")) {
|
@@ -2326,7 +2329,8 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2326
2329
|
if (!isValidMimeType) {
|
2327
2330
|
return _defineProperty({}, path, [{
|
2328
2331
|
message: "Mime type mismatch. Found '".concat(mimeType, "' but schema accepts '").concat(accept, "'"),
|
2329
|
-
value: src
|
2332
|
+
value: src,
|
2333
|
+
fixes: ["image:check-metadata"]
|
2330
2334
|
}]);
|
2331
2335
|
}
|
2332
2336
|
}
|
@@ -2334,13 +2338,15 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2334
2338
|
if (!fileMimeType) {
|
2335
2339
|
return _defineProperty({}, path, [{
|
2336
2340
|
message: "Could not determine mime type from file extension. Got: ".concat(src[FILE_REF_PROP]),
|
2337
|
-
value: src
|
2341
|
+
value: src,
|
2342
|
+
fixes: ["image:check-metadata"]
|
2338
2343
|
}]);
|
2339
2344
|
}
|
2340
2345
|
if (fileMimeType && mimeType && fileMimeType !== mimeType) {
|
2341
2346
|
return _defineProperty({}, path, [{
|
2342
2347
|
message: "Mime type and file extension not matching. Mime type is '".concat(mimeType, "' but file extension is '").concat(fileMimeType, "'"),
|
2343
|
-
value: src
|
2348
|
+
value: src,
|
2349
|
+
fixes: ["image:check-metadata"]
|
2344
2350
|
}]);
|
2345
2351
|
}
|
2346
2352
|
if (src.metadata) {
|
@@ -2356,7 +2362,7 @@ var ImageSchema = /*#__PURE__*/function (_Schema) {
|
|
2356
2362
|
message: "Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and the mime type.",
|
2357
2363
|
// These validation errors will have to be picked up by logic outside of this package and revalidated. Reasons: 1) we have to read files to verify the metadata, which is handled differently in different runtimes (Browser, QuickJS, Node.js); 2) we want to keep this package dependency free.
|
2358
2364
|
value: src,
|
2359
|
-
fixes: ["image:
|
2365
|
+
fixes: ["image:check-metadata"]
|
2360
2366
|
}]);
|
2361
2367
|
}
|
2362
2368
|
return _defineProperty({}, path, [{
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('./index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('./index-6d63e99d.cjs.prod.js');
|
6
6
|
require('./result-787e35f6.cjs.prod.js');
|
7
7
|
|
8
8
|
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export { A as ArraySchema, B as BooleanSchema, D as DateSchema, F as FATAL_ERROR_TYPES, k as FILE_REF_PROP, l as FILE_REF_SUBTYPE_TAG, t as FileSchema, G as GenericSelector, r as ImageSchema, I as Internal, K as KeyOfSchema, L as LiteralSchema, M as ModuleFilePathSep, q as NumberSchema, O as ObjectSchema, R as RecordSchema, u as RichTextSchema, j as Schema, o as StringSchema, U as UnionSchema, V as VAL_EXTENSION, n as derefPatch, v as deserializeSchema, i as expr, h as initVal, m as modules } from './index-
|
1
|
+
export { A as ArraySchema, B as BooleanSchema, D as DateSchema, F as FATAL_ERROR_TYPES, k as FILE_REF_PROP, l as FILE_REF_SUBTYPE_TAG, t as FileSchema, G as GenericSelector, r as ImageSchema, I as Internal, K as KeyOfSchema, L as LiteralSchema, M as ModuleFilePathSep, q as NumberSchema, O as ObjectSchema, R as RecordSchema, u as RichTextSchema, j as Schema, o as StringSchema, U as UnionSchema, V as VAL_EXTENSION, n as derefPatch, v as deserializeSchema, i as expr, h as initVal, m as modules } from './index-1d65adb5.esm.js';
|
2
2
|
import './result-168dfc1d.esm.js';
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('../../dist/index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('../../dist/index-47055fcc.cjs.dev.js');
|
6
6
|
require('../../dist/result-bb1f436e.cjs.dev.js');
|
7
7
|
|
8
8
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('../../dist/index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('../../dist/index-6d63e99d.cjs.prod.js');
|
6
6
|
require('../../dist/result-787e35f6.cjs.prod.js');
|
7
7
|
|
8
8
|
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export { C as Call, E as Expr, N as NilSym, S as StringLiteral, e as StringTemplate, f as Sym, g as evaluate, p as parse } from '../../dist/index-
|
1
|
+
export { C as Call, E as Expr, N as NilSym, S as StringLiteral, e as StringTemplate, f as Sym, g as evaluate, p as parse } from '../../dist/index-1d65adb5.esm.js';
|
2
2
|
import '../../dist/result-168dfc1d.esm.js';
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('../../dist/index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('../../dist/index-47055fcc.cjs.dev.js');
|
6
6
|
var result = require('../../dist/result-bb1f436e.cjs.dev.js');
|
7
7
|
var util = require('../../dist/util-b213092b.cjs.dev.js');
|
8
8
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('../../dist/index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('../../dist/index-6d63e99d.cjs.prod.js');
|
6
6
|
var result = require('../../dist/result-787e35f6.cjs.prod.js');
|
7
7
|
var util = require('../../dist/util-030d8a1f.cjs.prod.js');
|
8
8
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-
|
2
|
-
export { P as PatchError } from '../../dist/index-
|
1
|
+
import { _ as _typeof, a as _slicedToArray, P as PatchError, s as splitModuleFilePathAndModulePath, b as _createClass, c as _classCallCheck, d as _toConsumableArray } from '../../dist/index-1d65adb5.esm.js';
|
2
|
+
export { P as PatchError } from '../../dist/index-1d65adb5.esm.js';
|
3
3
|
import { f as isNonEmpty, e as err, o as ok, m as map, g as flatMap, i as isErr, h as flatMapReduce, j as filterOrElse, k as mapErr, l as map$1, n as all, p as flatten, q as allT } from '../../dist/result-168dfc1d.esm.js';
|
4
4
|
import { p as pipe } from '../../dist/util-18613e99.esm.js';
|
5
5
|
|