@valbuild/core 0.67.1 → 0.69.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/initVal.d.ts +5 -0
- 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/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-439509d7.esm.js → index-1d65adb5.esm.js} +4 -0
- package/dist/{index-3d77ee46.cjs.dev.js → index-47055fcc.cjs.dev.js} +4 -0
- package/dist/{index-b20f2afc.cjs.prod.js → index-6d63e99d.cjs.prod.js} +4 -0
- 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 {};
|
@@ -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 {};
|
@@ -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
|
|