@valbuild/core 0.61.0 → 0.62.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/ValApi.d.ts +18 -15
- package/dist/declarations/src/index.d.ts +36 -42
- package/dist/declarations/src/initVal.d.ts +1 -1
- package/dist/declarations/src/module.d.ts +3 -2
- package/dist/declarations/src/source/file.d.ts +1 -0
- package/dist/declarations/src/val/index.d.ts +4 -4
- package/dist/index-316f5dd8.esm.js +4016 -0
- package/dist/index-3193efd5.cjs.dev.js +4057 -0
- package/dist/index-596f28bb.cjs.prod.js +4057 -0
- package/dist/{result-b96df128.esm.js → result-a8316efa.esm.js} +1 -1
- package/dist/valbuild-core.cjs.dev.js +29 -1844
- package/dist/valbuild-core.cjs.prod.js +29 -1844
- package/dist/valbuild-core.esm.js +2 -1823
- package/expr/dist/valbuild-core-expr.cjs.dev.js +7 -8
- package/expr/dist/valbuild-core-expr.cjs.prod.js +7 -8
- package/expr/dist/valbuild-core-expr.esm.js +2 -3
- package/fp/dist/valbuild-core-fp.esm.js +1 -1
- package/package.json +1 -1
- package/patch/dist/valbuild-core-patch.cjs.dev.js +46 -50
- package/patch/dist/valbuild-core-patch.cjs.prod.js +46 -50
- package/patch/dist/valbuild-core-patch.esm.js +6 -10
- package/dist/index-051c34f3.esm.js +0 -539
- package/dist/index-0df230ef.cjs.dev.js +0 -572
- package/dist/index-2dfaf8f7.cjs.prod.js +0 -643
- package/dist/index-e8ab2166.cjs.dev.js +0 -643
- package/dist/index-ed5767a3.esm.js +0 -639
- package/dist/index-f2552460.cjs.prod.js +0 -572
- package/dist/ops-34737ef0.cjs.dev.js +0 -1068
- package/dist/ops-92570725.cjs.prod.js +0 -1068
- package/dist/ops-9262cf01.esm.js +0 -1044
@@ -1,7 +1,7 @@
|
|
1
|
-
import { ApiCommitResponse, ApiGetPatchResponse, ApiPostValidationErrorResponse,
|
1
|
+
import { ApiCommitResponse, ApiGetPatchResponse, ApiPostValidationErrorResponse, ApiPostValidationResponse, ApiTreeResponse, Json, ApiSchemaResponse } from "./index.js";
|
2
2
|
import { result } from "./fp/index.js";
|
3
3
|
import { Patch } from "./patch/index.js";
|
4
|
-
import {
|
4
|
+
import { ModuleFilePath, PatchId } from "./val/index.js";
|
5
5
|
type FetchError = {
|
6
6
|
message: string;
|
7
7
|
details?: unknown;
|
@@ -13,13 +13,9 @@ export declare class ValApi {
|
|
13
13
|
getDisableUrl(redirectTo: string): string;
|
14
14
|
getLoginUrl(redirectTo: string): string;
|
15
15
|
getEnableUrl(redirectTo: string): string;
|
16
|
-
getPatches(
|
17
|
-
patchIds?: string[];
|
18
|
-
headers?: Record<string, string> | undefined;
|
19
|
-
}): Promise<result.Result<ApiGetPatchResponse, FetchError>>;
|
16
|
+
getPatches(): Promise<result.Result<ApiGetPatchResponse, FetchError>>;
|
20
17
|
deletePatches(ids: string[], headers?: Record<string, string>): Promise<result.Result<Json, FetchError>>;
|
21
18
|
getEditUrl(): string;
|
22
|
-
postPatches(moduleId: ModuleId, patches: Patch, headers?: Record<string, string> | undefined): Promise<result.Result<ApiPostPatchResponse, FetchError>>;
|
23
19
|
getSession(): Promise<result.Result<{
|
24
20
|
mode: "proxy" | "local";
|
25
21
|
member_role: "owner" | "developer" | "editor";
|
@@ -27,19 +23,26 @@ export declare class ValApi {
|
|
27
23
|
mode: "proxy" | "local";
|
28
24
|
member_role: "owner" | "developer" | "editor";
|
29
25
|
}>>;
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
getSchema({ headers }: {
|
27
|
+
headers?: Record<string, string> | undefined;
|
28
|
+
}): Promise<result.Result<ApiSchemaResponse, FetchError>>;
|
29
|
+
putTree({ treePath, patchIds, addPatch, validateAll, validateSource, validateBinaryFiles, headers, }: {
|
34
30
|
treePath?: string;
|
31
|
+
patchIds?: PatchId[];
|
32
|
+
addPatch?: {
|
33
|
+
path: ModuleFilePath;
|
34
|
+
patch: Patch;
|
35
|
+
};
|
36
|
+
validateAll?: boolean;
|
37
|
+
validateSource?: boolean;
|
38
|
+
validateBinaryFiles?: boolean;
|
35
39
|
headers?: Record<string, string> | undefined;
|
36
40
|
}): Promise<result.Result<ApiTreeResponse, FetchError>>;
|
37
|
-
|
38
|
-
|
39
|
-
headers?: Record<string, string> | undefined;
|
41
|
+
postSave({ patchIds, }: {
|
42
|
+
patchIds: PatchId[];
|
40
43
|
}): Promise<result.Result<ApiCommitResponse, FetchError | ApiPostValidationErrorResponse>>;
|
41
44
|
postValidate({ patches, headers, }: {
|
42
|
-
patches?: Record<
|
45
|
+
patches?: Record<ModuleFilePath, PatchId[]>;
|
43
46
|
headers?: Record<string, string> | undefined;
|
44
47
|
}): Promise<result.Result<ApiPostValidationResponse | ApiPostValidationErrorResponse, FetchError>>;
|
45
48
|
}
|
@@ -12,26 +12,26 @@ export type { RawString } from "./schema/string.js";
|
|
12
12
|
export type { ImageSource } from "./source/image.js";
|
13
13
|
export { RT_IMAGE_TAG } from "./source/richtext.js";
|
14
14
|
export type { AnyRichTextOptions, Bold, Classes, HeadingNode, ImageNode, Italic, LineThrough, ListItemNode, LinkNode, OrderedListNode, ParagraphNode, BrNode, RichText, RichTextNode, RichTextOptions, RichTextSource, RootNode, SpanNode, UnorderedListNode, } from "./source/richtext.js";
|
15
|
-
export { type Val, type SerializedVal, type
|
15
|
+
export { type Val, type SerializedVal, type ModuleFilePath, type PatchId, type ModulePath, type SourcePath, type JsonOfSource, } from "./val/index.js";
|
16
16
|
export type { Json, JsonPrimitive, JsonArray, JsonObject } from "./Json.js";
|
17
17
|
export type { ValidationError, ValidationErrors, } from "./schema/validation/ValidationError.js";
|
18
|
-
import type { ValidationErrors } from "./schema/validation/ValidationError.js";
|
18
|
+
import type { ValidationError, ValidationErrors } from "./schema/validation/ValidationError.js";
|
19
19
|
export type { ValidationFix } from "./schema/validation/ValidationFix.js";
|
20
20
|
export * as expr from "./expr/index.js";
|
21
21
|
export { FILE_REF_PROP, FILE_REF_SUBTYPE_TAG } from "./source/file.js";
|
22
22
|
export { VAL_EXTENSION, type SourceArray } from "./source/index.js";
|
23
23
|
export { derefPatch } from "./patch/deref.js";
|
24
24
|
export { type SelectorSource, type SelectorOf, GenericSelector, } from "./selector/index.js";
|
25
|
-
import { getSource, resolvePath,
|
25
|
+
import { getSource, resolvePath, splitModuleFilePathAndModulePath } from "./module.js";
|
26
26
|
import { getSchema } from "./selector/index.js";
|
27
|
-
import {
|
27
|
+
import { ModuleFilePath, ModulePath, PatchId, SourcePath, getValPath, isVal } from "./val/index.js";
|
28
28
|
import { convertFileSource } from "./schema/file.js";
|
29
29
|
import { createValPathOfItem } from "./selector/SelectorProxy.js";
|
30
30
|
import { getVal } from "./future/fetchVal.js";
|
31
31
|
import type { Json } from "./Json.js";
|
32
|
-
import {
|
33
|
-
import { Operation, Patch } from "./patch/index.js";
|
32
|
+
import { Operation } from "./patch/index.js";
|
34
33
|
import { initSchema } from "./initSchema.js";
|
34
|
+
import { SerializedSchema } from "./schema/index.js";
|
35
35
|
export { type SerializedArraySchema, ArraySchema } from "./schema/array.js";
|
36
36
|
export { type SerializedObjectSchema, ObjectSchema } from "./schema/object.js";
|
37
37
|
export { type SerializedRecordSchema, RecordSchema } from "./schema/record.js";
|
@@ -45,55 +45,48 @@ export { type SerializedUnionSchema, UnionSchema } from "./schema/union.js";
|
|
45
45
|
export { type SerializedLiteralSchema, LiteralSchema } from "./schema/literal.js";
|
46
46
|
export { deserializeSchema } from "./schema/deserialize.js";
|
47
47
|
export { ValApi } from "./ValApi.js";
|
48
|
-
export type ApiCommitResponse = {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
applied: PatchId[];
|
53
|
-
};
|
54
|
-
}>;
|
55
|
-
git: {
|
56
|
-
commit?: string;
|
57
|
-
branch?: string;
|
58
|
-
};
|
48
|
+
export type ApiCommitResponse = {};
|
49
|
+
export type ApiSchemaResponse = {
|
50
|
+
schemaSha: string;
|
51
|
+
schemas: Record<ModuleFilePath, SerializedSchema>;
|
59
52
|
};
|
60
53
|
export type ApiTreeResponse = {
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
54
|
+
schemaSha: string;
|
55
|
+
fatalErrors?: ({
|
56
|
+
message: string;
|
57
|
+
type: "invalid-module-file-path";
|
58
|
+
actualModuleFilePath: string;
|
59
|
+
expectedModuleFilePath: string;
|
60
|
+
} | {
|
61
|
+
message: string;
|
62
|
+
stack?: string;
|
63
|
+
type?: undefined;
|
64
|
+
})[];
|
65
|
+
modules: Record<ModuleFilePath, {
|
66
|
+
source: Json;
|
67
67
|
patches?: {
|
68
68
|
applied: PatchId[];
|
69
|
-
|
70
|
-
|
71
|
-
source?: Json;
|
72
|
-
errors?: false | {
|
73
|
-
invalidModuleId?: ModuleId;
|
74
|
-
validation?: ValidationErrors;
|
75
|
-
fatal?: {
|
69
|
+
skipped?: PatchId[];
|
70
|
+
errors?: Record<PatchId, {
|
76
71
|
message: string;
|
77
|
-
|
78
|
-
type?: string;
|
79
|
-
}[];
|
72
|
+
}>;
|
80
73
|
};
|
74
|
+
validationErrors?: Record<SourcePath, ValidationError[]>;
|
81
75
|
}>;
|
82
76
|
};
|
83
|
-
export type ApiGetPatchResponse = Record<
|
84
|
-
patch: Patch;
|
77
|
+
export type ApiGetPatchResponse = Record<ModuleFilePath, {
|
85
78
|
patch_id: PatchId;
|
86
79
|
created_at: string;
|
87
|
-
|
80
|
+
applied_at_base_sha: string | null;
|
88
81
|
author?: string;
|
89
82
|
}[]>;
|
90
83
|
export type ApiDeletePatchResponse = PatchId[];
|
91
|
-
export type ApiPostPatchResponse = Record<
|
84
|
+
export type ApiPostPatchResponse = Record<ModuleFilePath, {
|
92
85
|
patch_id: PatchId;
|
93
86
|
}>;
|
94
87
|
export type ApiPostValidationResponse = {
|
95
88
|
validationErrors: false;
|
96
|
-
modules: Record<
|
89
|
+
modules: Record<ModuleFilePath, {
|
97
90
|
patches: {
|
98
91
|
applied: PatchId[];
|
99
92
|
};
|
@@ -102,16 +95,16 @@ export type ApiPostValidationResponse = {
|
|
102
95
|
export declare const FATAL_ERROR_TYPES: readonly ["no-schema", "no-source", "invalid-id", "no-module", "invalid-patch"];
|
103
96
|
export type FatalErrorType = (typeof FATAL_ERROR_TYPES)[number];
|
104
97
|
export type ApiPostValidationErrorResponse = {
|
105
|
-
modules: Record<
|
98
|
+
modules: Record<ModuleFilePath, {
|
106
99
|
patches: {
|
107
100
|
applied: PatchId[];
|
108
101
|
failed?: PatchId[];
|
109
102
|
};
|
110
103
|
}>;
|
111
|
-
validationErrors: Record<
|
104
|
+
validationErrors: Record<ModuleFilePath, {
|
112
105
|
source?: Json;
|
113
106
|
errors: {
|
114
|
-
|
107
|
+
invalidModulePath?: ModuleFilePath;
|
115
108
|
validation?: ValidationErrors;
|
116
109
|
fatal?: {
|
117
110
|
message: string;
|
@@ -131,11 +124,12 @@ declare const Internal: {
|
|
131
124
|
getVal: typeof getVal;
|
132
125
|
getSource: typeof getSource;
|
133
126
|
resolvePath: typeof resolvePath;
|
134
|
-
|
127
|
+
splitModuleFilePathAndModulePath: typeof splitModuleFilePathAndModulePath;
|
135
128
|
isVal: typeof isVal;
|
136
129
|
createValPathOfItem: typeof createValPathOfItem;
|
137
130
|
getSHA256Hash: (bits: Uint8Array) => string;
|
138
131
|
initSchema: typeof initSchema;
|
132
|
+
ModuleFilePathSep: string;
|
139
133
|
notFileOp: (op: Operation) => boolean;
|
140
134
|
isFileOp: (op: Operation) => op is {
|
141
135
|
op: "file";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Schema, SelectorOfSchema, SerializedSchema } from "./schema/index.js";
|
2
2
|
import { GenericSelector, SelectorOf, SelectorSource } from "./selector/index.js";
|
3
3
|
import { Source } from "./source/index.js";
|
4
|
-
import {
|
4
|
+
import { ModuleFilePath, ModulePath, SourcePath } from "./val/index.js";
|
5
5
|
import { Json } from "./Json.js";
|
6
6
|
import { RawString } from "./schema/string.js";
|
7
7
|
import { ImageSelector } from "./selector/image.js";
|
@@ -20,7 +20,8 @@ type ReplaceRawStringWithString<T extends SelectorSource> = SelectorSource exten
|
|
20
20
|
export declare function define<T extends Schema<SelectorSource>>(id: string, // TODO: `/${string}`
|
21
21
|
schema: T, source: ReplaceRawStringWithString<SelectorOfSchema<T>>): ValModule<SelectorOfSchema<T>>;
|
22
22
|
export declare function getSource(valModule: ValModule<SelectorSource>): Source;
|
23
|
-
export declare function
|
23
|
+
export declare function splitModuleFilePathAndModulePath(path: SourcePath): [moduleId: ModuleFilePath, path: ModulePath];
|
24
|
+
export declare const ModuleFilePathSep = "?p=";
|
24
25
|
export declare function getSourceAtPath(modulePath: ModulePath, valModule: ValModule<SelectorSource> | Source): any;
|
25
26
|
export declare function resolvePath<Src extends ValModule<SelectorSource> | Source, Sch extends Schema<SelectorSource> | SerializedSchema>(path: ModulePath, valModule: Src, schema: Sch): {
|
26
27
|
path: SourcePath;
|
@@ -16,6 +16,7 @@ export type FileSource<Metadata extends FileMetadata | undefined = FileMetadata
|
|
16
16
|
readonly [VAL_EXTENSION]: "file";
|
17
17
|
readonly [FILE_REF_SUBTYPE_TAG]?: string;
|
18
18
|
readonly metadata?: Metadata;
|
19
|
+
readonly patch_id?: string;
|
19
20
|
};
|
20
21
|
export declare function file<Metadata extends {
|
21
22
|
readonly [key: string]: Json;
|
@@ -42,13 +42,13 @@ export type ModulePath = string & {
|
|
42
42
|
[brand]: "ModulePath";
|
43
43
|
};
|
44
44
|
/**
|
45
|
-
* The
|
45
|
+
* The path of the module.
|
46
46
|
*
|
47
47
|
* @example
|
48
|
-
* '/app/blogs'
|
48
|
+
* '/app/blogs.val.ts'
|
49
49
|
*/
|
50
|
-
export type
|
51
|
-
[brand]: "
|
50
|
+
export type ModuleFilePath = string & {
|
51
|
+
[brand]: "ModuleFilePath";
|
52
52
|
};
|
53
53
|
export type PatchId = string & {
|
54
54
|
[brand]: "PatchId";
|