@valbuild/core 0.21.1 → 0.22.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 +2 -1
- package/dist/declarations/src/index.d.ts +21 -3
- package/dist/declarations/src/module.d.ts +11 -5
- package/dist/declarations/src/patch/deref.d.ts +0 -3
- package/dist/declarations/src/patch/operation.d.ts +2 -0
- package/dist/declarations/src/schema/string.d.ts +5 -1
- package/dist/{index-75b79c89.cjs.prod.js → index-30eee5ec.cjs.prod.js} +47 -43
- package/dist/{index-067cff4a.cjs.prod.js → index-425d164d.cjs.prod.js} +1 -1
- package/dist/{index-31991dd7.cjs.dev.js → index-43369070.cjs.dev.js} +47 -43
- package/dist/{index-4bb14a92.esm.js → index-499b9e87.esm.js} +47 -43
- package/dist/{index-d17f9503.cjs.dev.js → index-a0f36fe3.cjs.dev.js} +1 -1
- package/dist/{index-870205b5.esm.js → index-f0475164.esm.js} +1 -1
- package/dist/{ops-9b396073.esm.js → ops-1225f750.esm.js} +5 -2
- package/dist/{ops-0f7617a0.cjs.dev.js → ops-558f07b7.cjs.dev.js} +5 -2
- package/dist/{ops-451ffb3f.cjs.prod.js → ops-b263963e.cjs.prod.js} +5 -2
- package/dist/valbuild-core.cjs.dev.js +251 -240
- package/dist/valbuild-core.cjs.prod.js +251 -240
- package/dist/valbuild-core.esm.js +252 -241
- package/expr/dist/valbuild-core-expr.cjs.dev.js +2 -2
- package/expr/dist/valbuild-core-expr.cjs.prod.js +2 -2
- package/expr/dist/valbuild-core-expr.esm.js +2 -2
- package/package.json +1 -1
- package/patch/dist/valbuild-core-patch.cjs.dev.js +13 -3
- package/patch/dist/valbuild-core-patch.cjs.prod.js +13 -3
- package/patch/dist/valbuild-core-patch.esm.js +14 -4
- package/src/ValApi.ts +9 -13
- package/src/index.ts +23 -3
- package/src/module.ts +40 -14
- package/src/patch/deref.test.ts +130 -132
- package/src/patch/deref.ts +12 -17
- package/src/patch/operation.ts +2 -0
- package/src/patch/parse.ts +15 -1
- package/src/schema/image.ts +5 -3
- package/src/schema/string.ts +27 -2
@@ -10,7 +10,8 @@ export declare class ValApi {
|
|
10
10
|
host: string;
|
11
11
|
constructor(host: string);
|
12
12
|
getDisableUrl(): string;
|
13
|
-
|
13
|
+
getEditUrl(): string;
|
14
|
+
postPatches(moduleId: ModuleId, patches: PatchJSON, headers?: Record<string, string> | undefined): Promise<result.Result<ApiPatchResponse, FetchError>>;
|
14
15
|
getSession(): Promise<result.Result<{
|
15
16
|
mode: "proxy" | "local";
|
16
17
|
member_role: "owner" | "developer" | "editor";
|
@@ -8,8 +8,9 @@ export type { SourceObject, SourcePrimitive, Source } from "./source/index.js";
|
|
8
8
|
export type { FileSource } from "./source/file.js";
|
9
9
|
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";
|
10
10
|
export { type Val, type SerializedVal, type ModuleId, type ModulePath, type SourcePath, type JsonOfSource, } from "./val/index.js";
|
11
|
-
export type { Json, JsonPrimitive } from "./Json.js";
|
12
|
-
export type {
|
11
|
+
export type { Json, JsonPrimitive, JsonArray, JsonObject } from "./Json.js";
|
12
|
+
export type { ValidationError, ValidationErrors, } from "./schema/validation/ValidationError.js";
|
13
|
+
import type { ValidationErrors } from "./schema/validation/ValidationError.js";
|
13
14
|
export type { ValidationFix } from "./schema/validation/ValidationFix.js";
|
14
15
|
export * as expr from "./expr/index.js";
|
15
16
|
export { FILE_REF_PROP } from "./source/file.js";
|
@@ -21,9 +22,17 @@ import { getSchema } from "./selector/index.js";
|
|
21
22
|
import { ModuleId, ModulePath, getValPath, isVal } from "./val/index.js";
|
22
23
|
import { createValPathOfItem } from "./selector/SelectorProxy.js";
|
23
24
|
import { getVal } from "./future/fetchVal.js";
|
24
|
-
import { Json } from "./Json.js";
|
25
|
+
import type { Json } from "./Json.js";
|
25
26
|
import { SerializedSchema } from "./schema/index.js";
|
26
27
|
export { ValApi } from "./ValApi.js";
|
28
|
+
export type { SerializedArraySchema } from "./schema/array.js";
|
29
|
+
export type { SerializedObjectSchema } from "./schema/object.js";
|
30
|
+
export type { SerializedRecordSchema } from "./schema/record.js";
|
31
|
+
export type { SerializedStringSchema } from "./schema/string.js";
|
32
|
+
export type { SerializedNumberSchema } from "./schema/number.js";
|
33
|
+
export type { SerializedBooleanSchema } from "./schema/boolean.js";
|
34
|
+
export type { SerializedImageSchema } from "./schema/image.js";
|
35
|
+
export type { SerializedRichTextSchema } from "./schema/richtext.js";
|
27
36
|
export type ApiTreeResponse = {
|
28
37
|
git: {
|
29
38
|
commit?: string;
|
@@ -36,6 +45,15 @@ export type ApiTreeResponse = {
|
|
36
45
|
failed?: string[];
|
37
46
|
};
|
38
47
|
source?: Json;
|
48
|
+
errors?: false | {
|
49
|
+
invalidModuleId?: ModuleId;
|
50
|
+
validation?: ValidationErrors;
|
51
|
+
fatal?: {
|
52
|
+
message: string;
|
53
|
+
stack?: string;
|
54
|
+
type?: string;
|
55
|
+
}[];
|
56
|
+
};
|
39
57
|
}>;
|
40
58
|
};
|
41
59
|
export type ApiPatchResponse = Record<ModuleId, string[]>;
|
@@ -3,20 +3,26 @@ import { GenericSelector, SelectorOf, SelectorSource } from "./selector/index.js
|
|
3
3
|
import { Source } from "./source/index.js";
|
4
4
|
import { ModuleId, ModulePath, SourcePath } from "./val/index.js";
|
5
5
|
import { Json } from "./Json.js";
|
6
|
+
import { RawString } from "./schema/string.js";
|
6
7
|
declare const brand: unique symbol;
|
7
8
|
export type ValModule<T extends SelectorSource> = SelectorOf<T> & ValModuleBrand;
|
8
9
|
export type ValModuleBrand = {
|
9
10
|
[brand]: "ValModule";
|
10
11
|
};
|
11
12
|
export type TypeOfValModule<T extends ValModule<SelectorSource>> = T extends GenericSelector<infer S> ? S : never;
|
12
|
-
|
13
|
+
type ReplaceRawStringWithString<T extends SelectorSource> = SelectorSource extends T ? T : T extends RawString ? string : T extends {
|
14
|
+
[key in string]: SelectorSource;
|
15
|
+
} ? {
|
16
|
+
[key in keyof T]: ReplaceRawStringWithString<T[key]>;
|
17
|
+
} : T extends SelectorSource[] ? ReplaceRawStringWithString<T[number]>[] : T;
|
18
|
+
export declare function content<T extends Schema<SelectorSource>>(id: string, schema: T, source: ReplaceRawStringWithString<SchemaTypeOf<T>>): ValModule<SchemaTypeOf<T>>;
|
13
19
|
export declare function getSource(valModule: ValModule<SelectorSource>): Source;
|
14
20
|
export declare function splitModuleIdAndModulePath(path: SourcePath): [moduleId: ModuleId, path: ModulePath];
|
15
21
|
export declare function getSourceAtPath(modulePath: ModulePath, valModule: ValModule<SelectorSource> | Source): any;
|
16
|
-
export declare function resolvePath
|
17
|
-
path:
|
18
|
-
schema:
|
19
|
-
source:
|
22
|
+
export declare function resolvePath<Src extends ValModule<SelectorSource> | Source, Sch extends Schema<SelectorSource> | SerializedSchema>(path: ModulePath, valModule: Src, schema: Sch): {
|
23
|
+
path: SourcePath;
|
24
|
+
schema: Sch;
|
25
|
+
source: Src;
|
20
26
|
};
|
21
27
|
export declare function parsePath(input: ModulePath): string[];
|
22
28
|
export type SerializedModule = {
|
@@ -7,8 +7,5 @@ export type DerefPatchResult = {
|
|
7
7
|
fileUpdates: {
|
8
8
|
[path: string]: string;
|
9
9
|
};
|
10
|
-
remotePatches: {
|
11
|
-
[ref: string]: Patch;
|
12
|
-
};
|
13
10
|
};
|
14
11
|
export declare function derefPatch<D, E>(patch: Operation[], document: D, ops: Ops<D, E>): result.Result<DerefPatchResult, E | PatchError>;
|
@@ -29,6 +29,7 @@ export type OperationJSON = {
|
|
29
29
|
} | {
|
30
30
|
op: "file";
|
31
31
|
path: string;
|
32
|
+
filePath: string;
|
32
33
|
value: JSONValue;
|
33
34
|
};
|
34
35
|
/**
|
@@ -63,5 +64,6 @@ export type Operation = {
|
|
63
64
|
} | {
|
64
65
|
op: "file";
|
65
66
|
path: string[];
|
67
|
+
filePath: string;
|
66
68
|
value: JSONValue;
|
67
69
|
};
|
@@ -11,6 +11,10 @@ export type SerializedStringSchema = {
|
|
11
11
|
opt: boolean;
|
12
12
|
raw: boolean;
|
13
13
|
};
|
14
|
+
declare const brand: unique symbol;
|
15
|
+
export type RawString = string & {
|
16
|
+
readonly [brand]: "raw";
|
17
|
+
};
|
14
18
|
export declare class StringSchema<Src extends string | null> extends Schema<Src> {
|
15
19
|
readonly options?: StringOptions | undefined;
|
16
20
|
readonly opt: boolean;
|
@@ -19,7 +23,7 @@ export declare class StringSchema<Src extends string | null> extends Schema<Src>
|
|
19
23
|
validate(path: SourcePath, src: Src): ValidationErrors;
|
20
24
|
assert(src: Src): boolean;
|
21
25
|
optional(): StringSchema<Src | null>;
|
22
|
-
raw(): StringSchema<Src>;
|
26
|
+
raw(): StringSchema<Src extends null ? RawString | null : RawString>;
|
23
27
|
serialize(): SerializedSchema;
|
24
28
|
}
|
25
29
|
export declare const string: <T extends string>(options?: StringOptions) => StringSchema<T>;
|
@@ -33,26 +33,26 @@ function _defineProperty(obj, key, value) {
|
|
33
33
|
return obj;
|
34
34
|
}
|
35
35
|
|
36
|
-
function ownKeys(
|
37
|
-
var
|
36
|
+
function ownKeys(e, r) {
|
37
|
+
var t = Object.keys(e);
|
38
38
|
if (Object.getOwnPropertySymbols) {
|
39
|
-
var
|
40
|
-
|
41
|
-
return Object.getOwnPropertyDescriptor(
|
42
|
-
})),
|
39
|
+
var o = Object.getOwnPropertySymbols(e);
|
40
|
+
r && (o = o.filter(function (r) {
|
41
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
42
|
+
})), t.push.apply(t, o);
|
43
43
|
}
|
44
|
-
return
|
44
|
+
return t;
|
45
45
|
}
|
46
|
-
function _objectSpread2(
|
47
|
-
for (var
|
48
|
-
var
|
49
|
-
|
50
|
-
_defineProperty(
|
51
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
52
|
-
Object.defineProperty(
|
46
|
+
function _objectSpread2(e) {
|
47
|
+
for (var r = 1; r < arguments.length; r++) {
|
48
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
49
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
50
|
+
_defineProperty(e, r, t[r]);
|
51
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
52
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
53
53
|
});
|
54
54
|
}
|
55
|
-
return
|
55
|
+
return e;
|
56
56
|
}
|
57
57
|
|
58
58
|
function _arrayWithoutHoles(arr) {
|
@@ -71,45 +71,45 @@ function _toConsumableArray(arr) {
|
|
71
71
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || result._unsupportedIterableToArray(arr) || _nonIterableSpread();
|
72
72
|
}
|
73
73
|
|
74
|
-
function _typeof(
|
74
|
+
function _typeof(o) {
|
75
75
|
"@babel/helpers - typeof";
|
76
76
|
|
77
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (
|
78
|
-
return typeof
|
79
|
-
} : function (
|
80
|
-
return
|
81
|
-
}, _typeof(
|
77
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
78
|
+
return typeof o;
|
79
|
+
} : function (o) {
|
80
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
81
|
+
}, _typeof(o);
|
82
82
|
}
|
83
83
|
|
84
84
|
function _arrayWithHoles(arr) {
|
85
85
|
if (Array.isArray(arr)) return arr;
|
86
86
|
}
|
87
87
|
|
88
|
-
function _iterableToArrayLimit(
|
89
|
-
var
|
90
|
-
if (null !=
|
91
|
-
var
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
88
|
+
function _iterableToArrayLimit(r, l) {
|
89
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
90
|
+
if (null != t) {
|
91
|
+
var e,
|
92
|
+
n,
|
93
|
+
i,
|
94
|
+
u,
|
95
|
+
a = [],
|
96
|
+
f = !0,
|
97
|
+
o = !1;
|
98
98
|
try {
|
99
|
-
if (
|
100
|
-
if (Object(
|
101
|
-
|
102
|
-
} else for (; !(
|
103
|
-
} catch (
|
104
|
-
|
99
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
100
|
+
if (Object(t) !== t) return;
|
101
|
+
f = !1;
|
102
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
103
|
+
} catch (r) {
|
104
|
+
o = !0, n = r;
|
105
105
|
} finally {
|
106
106
|
try {
|
107
|
-
if (!
|
107
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
108
108
|
} finally {
|
109
|
-
if (
|
109
|
+
if (o) throw n;
|
110
110
|
}
|
111
111
|
}
|
112
|
-
return
|
112
|
+
return a;
|
113
113
|
}
|
114
114
|
}
|
115
115
|
|
@@ -509,13 +509,17 @@ var image = function image(options) {
|
|
509
509
|
return new ImageSchema(options);
|
510
510
|
};
|
511
511
|
var convertFileSource = function convertFileSource(src) {
|
512
|
-
var _src$
|
512
|
+
var _src$metadata2;
|
513
513
|
// TODO: /public should be configurable
|
514
514
|
if (!src[FILE_REF_PROP].startsWith("/public")) {
|
515
|
-
|
515
|
+
var _src$metadata;
|
516
|
+
return {
|
517
|
+
url: src[FILE_REF_PROP] + "?sha256=".concat((_src$metadata = src.metadata) === null || _src$metadata === void 0 ? void 0 : _src$metadata.sha256),
|
518
|
+
metadata: src.metadata
|
519
|
+
};
|
516
520
|
}
|
517
521
|
return {
|
518
|
-
url: src[FILE_REF_PROP].slice("/public".length) + "?sha256=".concat((_src$
|
522
|
+
url: src[FILE_REF_PROP].slice("/public".length) + "?sha256=".concat((_src$metadata2 = src.metadata) === null || _src$metadata2 === void 0 ? void 0 : _src$metadata2.sha256),
|
519
523
|
metadata: src.metadata
|
520
524
|
};
|
521
525
|
};
|
@@ -33,26 +33,26 @@ function _defineProperty(obj, key, value) {
|
|
33
33
|
return obj;
|
34
34
|
}
|
35
35
|
|
36
|
-
function ownKeys(
|
37
|
-
var
|
36
|
+
function ownKeys(e, r) {
|
37
|
+
var t = Object.keys(e);
|
38
38
|
if (Object.getOwnPropertySymbols) {
|
39
|
-
var
|
40
|
-
|
41
|
-
return Object.getOwnPropertyDescriptor(
|
42
|
-
})),
|
39
|
+
var o = Object.getOwnPropertySymbols(e);
|
40
|
+
r && (o = o.filter(function (r) {
|
41
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
42
|
+
})), t.push.apply(t, o);
|
43
43
|
}
|
44
|
-
return
|
44
|
+
return t;
|
45
45
|
}
|
46
|
-
function _objectSpread2(
|
47
|
-
for (var
|
48
|
-
var
|
49
|
-
|
50
|
-
_defineProperty(
|
51
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
52
|
-
Object.defineProperty(
|
46
|
+
function _objectSpread2(e) {
|
47
|
+
for (var r = 1; r < arguments.length; r++) {
|
48
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
49
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
50
|
+
_defineProperty(e, r, t[r]);
|
51
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
52
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
53
53
|
});
|
54
54
|
}
|
55
|
-
return
|
55
|
+
return e;
|
56
56
|
}
|
57
57
|
|
58
58
|
function _arrayWithoutHoles(arr) {
|
@@ -71,45 +71,45 @@ function _toConsumableArray(arr) {
|
|
71
71
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || result._unsupportedIterableToArray(arr) || _nonIterableSpread();
|
72
72
|
}
|
73
73
|
|
74
|
-
function _typeof(
|
74
|
+
function _typeof(o) {
|
75
75
|
"@babel/helpers - typeof";
|
76
76
|
|
77
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (
|
78
|
-
return typeof
|
79
|
-
} : function (
|
80
|
-
return
|
81
|
-
}, _typeof(
|
77
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
78
|
+
return typeof o;
|
79
|
+
} : function (o) {
|
80
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
81
|
+
}, _typeof(o);
|
82
82
|
}
|
83
83
|
|
84
84
|
function _arrayWithHoles(arr) {
|
85
85
|
if (Array.isArray(arr)) return arr;
|
86
86
|
}
|
87
87
|
|
88
|
-
function _iterableToArrayLimit(
|
89
|
-
var
|
90
|
-
if (null !=
|
91
|
-
var
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
88
|
+
function _iterableToArrayLimit(r, l) {
|
89
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
90
|
+
if (null != t) {
|
91
|
+
var e,
|
92
|
+
n,
|
93
|
+
i,
|
94
|
+
u,
|
95
|
+
a = [],
|
96
|
+
f = !0,
|
97
|
+
o = !1;
|
98
98
|
try {
|
99
|
-
if (
|
100
|
-
if (Object(
|
101
|
-
|
102
|
-
} else for (; !(
|
103
|
-
} catch (
|
104
|
-
|
99
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
100
|
+
if (Object(t) !== t) return;
|
101
|
+
f = !1;
|
102
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
103
|
+
} catch (r) {
|
104
|
+
o = !0, n = r;
|
105
105
|
} finally {
|
106
106
|
try {
|
107
|
-
if (!
|
107
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
108
108
|
} finally {
|
109
|
-
if (
|
109
|
+
if (o) throw n;
|
110
110
|
}
|
111
111
|
}
|
112
|
-
return
|
112
|
+
return a;
|
113
113
|
}
|
114
114
|
}
|
115
115
|
|
@@ -509,13 +509,17 @@ var image = function image(options) {
|
|
509
509
|
return new ImageSchema(options);
|
510
510
|
};
|
511
511
|
var convertFileSource = function convertFileSource(src) {
|
512
|
-
var _src$
|
512
|
+
var _src$metadata2;
|
513
513
|
// TODO: /public should be configurable
|
514
514
|
if (!src[FILE_REF_PROP].startsWith("/public")) {
|
515
|
-
|
515
|
+
var _src$metadata;
|
516
|
+
return {
|
517
|
+
url: src[FILE_REF_PROP] + "?sha256=".concat((_src$metadata = src.metadata) === null || _src$metadata === void 0 ? void 0 : _src$metadata.sha256),
|
518
|
+
metadata: src.metadata
|
519
|
+
};
|
516
520
|
}
|
517
521
|
return {
|
518
|
-
url: src[FILE_REF_PROP].slice("/public".length) + "?sha256=".concat((_src$
|
522
|
+
url: src[FILE_REF_PROP].slice("/public".length) + "?sha256=".concat((_src$metadata2 = src.metadata) === null || _src$metadata2 === void 0 ? void 0 : _src$metadata2.sha256),
|
519
523
|
metadata: src.metadata
|
520
524
|
};
|
521
525
|
};
|
@@ -31,26 +31,26 @@ function _defineProperty(obj, key, value) {
|
|
31
31
|
return obj;
|
32
32
|
}
|
33
33
|
|
34
|
-
function ownKeys(
|
35
|
-
var
|
34
|
+
function ownKeys(e, r) {
|
35
|
+
var t = Object.keys(e);
|
36
36
|
if (Object.getOwnPropertySymbols) {
|
37
|
-
var
|
38
|
-
|
39
|
-
return Object.getOwnPropertyDescriptor(
|
40
|
-
})),
|
37
|
+
var o = Object.getOwnPropertySymbols(e);
|
38
|
+
r && (o = o.filter(function (r) {
|
39
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
40
|
+
})), t.push.apply(t, o);
|
41
41
|
}
|
42
|
-
return
|
42
|
+
return t;
|
43
43
|
}
|
44
|
-
function _objectSpread2(
|
45
|
-
for (var
|
46
|
-
var
|
47
|
-
|
48
|
-
_defineProperty(
|
49
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
50
|
-
Object.defineProperty(
|
44
|
+
function _objectSpread2(e) {
|
45
|
+
for (var r = 1; r < arguments.length; r++) {
|
46
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
47
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
48
|
+
_defineProperty(e, r, t[r]);
|
49
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
50
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
51
51
|
});
|
52
52
|
}
|
53
|
-
return
|
53
|
+
return e;
|
54
54
|
}
|
55
55
|
|
56
56
|
function _arrayWithoutHoles(arr) {
|
@@ -69,45 +69,45 @@ function _toConsumableArray(arr) {
|
|
69
69
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
70
70
|
}
|
71
71
|
|
72
|
-
function _typeof(
|
72
|
+
function _typeof(o) {
|
73
73
|
"@babel/helpers - typeof";
|
74
74
|
|
75
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (
|
76
|
-
return typeof
|
77
|
-
} : function (
|
78
|
-
return
|
79
|
-
}, _typeof(
|
75
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
76
|
+
return typeof o;
|
77
|
+
} : function (o) {
|
78
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
79
|
+
}, _typeof(o);
|
80
80
|
}
|
81
81
|
|
82
82
|
function _arrayWithHoles(arr) {
|
83
83
|
if (Array.isArray(arr)) return arr;
|
84
84
|
}
|
85
85
|
|
86
|
-
function _iterableToArrayLimit(
|
87
|
-
var
|
88
|
-
if (null !=
|
89
|
-
var
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
86
|
+
function _iterableToArrayLimit(r, l) {
|
87
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
88
|
+
if (null != t) {
|
89
|
+
var e,
|
90
|
+
n,
|
91
|
+
i,
|
92
|
+
u,
|
93
|
+
a = [],
|
94
|
+
f = !0,
|
95
|
+
o = !1;
|
96
96
|
try {
|
97
|
-
if (
|
98
|
-
if (Object(
|
99
|
-
|
100
|
-
} else for (; !(
|
101
|
-
} catch (
|
102
|
-
|
97
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
98
|
+
if (Object(t) !== t) return;
|
99
|
+
f = !1;
|
100
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
101
|
+
} catch (r) {
|
102
|
+
o = !0, n = r;
|
103
103
|
} finally {
|
104
104
|
try {
|
105
|
-
if (!
|
105
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
106
106
|
} finally {
|
107
|
-
if (
|
107
|
+
if (o) throw n;
|
108
108
|
}
|
109
109
|
}
|
110
|
-
return
|
110
|
+
return a;
|
111
111
|
}
|
112
112
|
}
|
113
113
|
|
@@ -507,13 +507,17 @@ var image = function image(options) {
|
|
507
507
|
return new ImageSchema(options);
|
508
508
|
};
|
509
509
|
var convertFileSource = function convertFileSource(src) {
|
510
|
-
var _src$
|
510
|
+
var _src$metadata2;
|
511
511
|
// TODO: /public should be configurable
|
512
512
|
if (!src[FILE_REF_PROP].startsWith("/public")) {
|
513
|
-
|
513
|
+
var _src$metadata;
|
514
|
+
return {
|
515
|
+
url: src[FILE_REF_PROP] + "?sha256=".concat((_src$metadata = src.metadata) === null || _src$metadata === void 0 ? void 0 : _src$metadata.sha256),
|
516
|
+
metadata: src.metadata
|
517
|
+
};
|
514
518
|
}
|
515
519
|
return {
|
516
|
-
url: src[FILE_REF_PROP].slice("/public".length) + "?sha256=".concat((_src$
|
520
|
+
url: src[FILE_REF_PROP].slice("/public".length) + "?sha256=".concat((_src$metadata2 = src.metadata) === null || _src$metadata2 === void 0 ? void 0 : _src$metadata2.sha256),
|
517
521
|
metadata: src.metadata
|
518
522
|
};
|
519
523
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { h as _objectSpread2, j as _slicedToArray, c as _createClass, b as _classCallCheck, r as Sym, C as Call, s as StringLiteral, t as StringTemplate, e as _typeof, m as isSerializedVal, F as FILE_REF_PROP, V as VAL_EXTENSION, n as convertFileSource, d as _defineProperty, S as Schema, E as Expr, u as _toConsumableArray, N as NilSym } from './index-
|
1
|
+
import { h as _objectSpread2, j as _slicedToArray, c as _createClass, b as _classCallCheck, r as Sym, C as Call, s as StringLiteral, t as StringTemplate, e as _typeof, m as isSerializedVal, F as FILE_REF_PROP, V as VAL_EXTENSION, n as convertFileSource, d as _defineProperty, S as Schema, E as Expr, u as _toConsumableArray, N as NilSym } from './index-499b9e87.esm.js';
|
2
2
|
import { i as isErr, e as err, o as ok, a as isOk } from './result-b96df128.esm.js';
|
3
3
|
|
4
4
|
var WHITE_SPACE = ["\n", "\r", "\t", " "];
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { e as _typeof, m as isSerializedVal, F as FILE_REF_PROP, V as VAL_EXTENSION, n as convertFileSource, d as _defineProperty, l as GetSource, P as Path, G as GetSchema, S as Schema, E as Expr, _ as _inherits, a as _createSuper, b as _classCallCheck, c as _createClass, j as _slicedToArray, h as _objectSpread2, u as _toConsumableArray, I as ImageSchema } from './index-
|
1
|
+
import { e as _typeof, m as isSerializedVal, F as FILE_REF_PROP, V as VAL_EXTENSION, n as convertFileSource, d as _defineProperty, l as GetSource, P as Path, G as GetSchema, S as Schema, E as Expr, _ as _inherits, a as _createSuper, b as _classCallCheck, c as _createClass, j as _slicedToArray, h as _objectSpread2, u as _toConsumableArray, I as ImageSchema } from './index-499b9e87.esm.js';
|
2
2
|
import { _ as _createForOfIteratorHelper } from './result-b96df128.esm.js';
|
3
3
|
|
4
4
|
function hasOwn(obj, prop) {
|
@@ -527,6 +527,9 @@ function getSource(valModule) {
|
|
527
527
|
return source;
|
528
528
|
}
|
529
529
|
function splitModuleIdAndModulePath(path) {
|
530
|
+
if (path.indexOf(".") === -1) {
|
531
|
+
return [path, ""];
|
532
|
+
}
|
530
533
|
return [path.slice(0, path.indexOf(".")), path.slice(path.indexOf(".") + 1)];
|
531
534
|
}
|
532
535
|
function isObjectSchema(schema) {
|
@@ -582,7 +585,7 @@ function resolvePath(path, valModule, schema) {
|
|
582
585
|
}
|
583
586
|
if (isArraySchema(resolvedSchema)) {
|
584
587
|
if (Number.isNaN(Number(part))) {
|
585
|
-
throw Error("Invalid path: array schema ".concat(resolvedSchema, " must have ").concat(part, "
|
588
|
+
throw Error("Invalid path: array schema ".concat(JSON.stringify(resolvedSchema), " must have a number as path, but got ").concat(part, ". Path: ").concat(path));
|
586
589
|
}
|
587
590
|
if (_typeof(resolvedSource) !== "object" && !Array.isArray(resolvedSource)) {
|
588
591
|
throw Error("Schema type error: expected source to be type of array, but got ".concat(_typeof(resolvedSource)));
|
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var index = require('./index-
|
3
|
+
var index = require('./index-43369070.cjs.dev.js');
|
4
4
|
var result = require('./result-48320acd.cjs.dev.js');
|
5
5
|
|
6
6
|
function hasOwn(obj, prop) {
|
@@ -529,6 +529,9 @@ function getSource(valModule) {
|
|
529
529
|
return source;
|
530
530
|
}
|
531
531
|
function splitModuleIdAndModulePath(path) {
|
532
|
+
if (path.indexOf(".") === -1) {
|
533
|
+
return [path, ""];
|
534
|
+
}
|
532
535
|
return [path.slice(0, path.indexOf(".")), path.slice(path.indexOf(".") + 1)];
|
533
536
|
}
|
534
537
|
function isObjectSchema(schema) {
|
@@ -584,7 +587,7 @@ function resolvePath(path, valModule, schema) {
|
|
584
587
|
}
|
585
588
|
if (isArraySchema(resolvedSchema)) {
|
586
589
|
if (Number.isNaN(Number(part))) {
|
587
|
-
throw Error("Invalid path: array schema ".concat(resolvedSchema, " must have ").concat(part, "
|
590
|
+
throw Error("Invalid path: array schema ".concat(JSON.stringify(resolvedSchema), " must have a number as path, but got ").concat(part, ". Path: ").concat(path));
|
588
591
|
}
|
589
592
|
if (index._typeof(resolvedSource) !== "object" && !Array.isArray(resolvedSource)) {
|
590
593
|
throw Error("Schema type error: expected source to be type of array, but got ".concat(index._typeof(resolvedSource)));
|