@valbuild/core 0.34.0 → 0.35.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 +7 -3
- package/dist/declarations/src/index.d.ts +4 -11
- package/dist/declarations/src/initVal.d.ts +6 -0
- package/dist/{index-425d164d.cjs.prod.js → index-216627d7.cjs.prod.js} +3 -4
- package/dist/{index-f0475164.esm.js → index-4f821892.esm.js} +3 -4
- package/dist/{index-30eee5ec.cjs.prod.js → index-5bdaa229.cjs.prod.js} +27 -28
- package/dist/{index-a0f36fe3.cjs.dev.js → index-6deb169d.cjs.dev.js} +3 -4
- package/dist/{index-43369070.cjs.dev.js → index-a5295001.cjs.dev.js} +27 -28
- package/dist/{index-499b9e87.esm.js → index-c83918b8.esm.js} +28 -29
- package/dist/{ops-b263963e.cjs.prod.js → ops-6489efeb.cjs.prod.js} +102 -103
- package/dist/{ops-558f07b7.cjs.dev.js → ops-bec039cc.cjs.dev.js} +102 -103
- package/dist/{ops-1225f750.esm.js → ops-ce47df64.esm.js} +102 -103
- package/dist/valbuild-core.cjs.dev.js +69 -47
- package/dist/valbuild-core.cjs.prod.js +69 -47
- package/dist/valbuild-core.esm.js +70 -48
- 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 +2 -2
- package/patch/dist/valbuild-core-patch.cjs.prod.js +2 -2
- package/patch/dist/valbuild-core-patch.esm.js +3 -3
@@ -9,9 +9,10 @@ type FetchError = {
|
|
9
9
|
export declare class ValApi {
|
10
10
|
host: string;
|
11
11
|
constructor(host: string);
|
12
|
-
getDisableUrl(): string;
|
12
|
+
getDisableUrl(redirectTo: string): string;
|
13
13
|
getEditUrl(): string;
|
14
14
|
getLoginUrl(redirectTo: string): string;
|
15
|
+
getEnableUrl(redirectTo: string): string;
|
15
16
|
getPatches({ patchIds, headers, }: {
|
16
17
|
patchIds?: string[];
|
17
18
|
headers?: Record<string, string> | undefined;
|
@@ -20,8 +21,11 @@ export declare class ValApi {
|
|
20
21
|
getSession(): Promise<result.Result<{
|
21
22
|
mode: "proxy" | "local";
|
22
23
|
member_role: "owner" | "developer" | "editor";
|
23
|
-
}, FetchError
|
24
|
-
|
24
|
+
}, FetchError> | result.Ok<{
|
25
|
+
mode: "proxy" | "local";
|
26
|
+
member_role: "owner" | "developer" | "editor";
|
27
|
+
}>>;
|
28
|
+
getTree({ patch, includeSchema, includeSource, treePath, headers, }: {
|
25
29
|
patch?: boolean;
|
26
30
|
includeSchema?: boolean;
|
27
31
|
includeSource?: boolean;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export { initVal } from "./initVal.js";
|
2
|
-
export type { InitVal } from "./initVal.js";
|
2
|
+
export type { InitVal, ValConfig } from "./initVal.js";
|
3
3
|
export { Schema, type SerializedSchema } from "./schema/index.js";
|
4
4
|
export type { ImageMetadata } from "./schema/image.js";
|
5
5
|
export type { LinkSource } from "./source/link.js";
|
@@ -81,15 +81,8 @@ declare const Internal: {
|
|
81
81
|
createValPathOfItem: typeof createValPathOfItem;
|
82
82
|
getSHA256Hash: (bits: Uint8Array) => Promise<string>;
|
83
83
|
createPatchJSONPath: (modulePath: ModulePath) => string;
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
VAL_DRAFT_MODE_COOKIE: string;
|
88
|
-
/**
|
89
|
-
* Enables Val: show the overlay / menu
|
90
|
-
*/
|
91
|
-
VAL_ENABLE_COOKIE_NAME: string;
|
92
|
-
VAL_STATE_COOKIE: string;
|
93
|
-
VAL_SESSION_COOKIE: string;
|
84
|
+
VAL_ENABLE_COOKIE_NAME: "val_enable";
|
85
|
+
VAL_STATE_COOKIE: "val_state";
|
86
|
+
VAL_SESSION_COOKIE: "val_session";
|
94
87
|
};
|
95
88
|
export { Internal };
|
@@ -11,9 +11,15 @@ type ValConstructor = {
|
|
11
11
|
link: typeof link;
|
12
12
|
richtext: typeof richtext;
|
13
13
|
};
|
14
|
+
export type ValConfig = {
|
15
|
+
gitCommit?: string;
|
16
|
+
gitBranch?: string;
|
17
|
+
valConfigPath: string;
|
18
|
+
};
|
14
19
|
export type InitVal = {
|
15
20
|
val: ValConstructor;
|
16
21
|
s: InitSchema;
|
22
|
+
config: ValConfig;
|
17
23
|
};
|
18
24
|
export declare const initVal: () => InitVal;
|
19
25
|
export {};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var index$1 = require('./index-
|
3
|
+
var index$1 = require('./index-5bdaa229.cjs.prod.js');
|
4
4
|
var result = require('./result-26f67b40.cjs.prod.js');
|
5
5
|
|
6
6
|
var WHITE_SPACE = ["\n", "\r", "\t", " "];
|
@@ -319,7 +319,6 @@ function isSelector(source) {
|
|
319
319
|
return index$1._typeof(source) === "object" && source !== null && (SourceOrExpr in source || Path in source);
|
320
320
|
}
|
321
321
|
function newSelectorProxy(source, path, moduleSchema) {
|
322
|
-
var _ref;
|
323
322
|
if (index$1._typeof(source) === "object") {
|
324
323
|
if (isSelector(source)) {
|
325
324
|
return source;
|
@@ -417,7 +416,7 @@ function newSelectorProxy(source, path, moduleSchema) {
|
|
417
416
|
// intentional fallthrough
|
418
417
|
// eslint-disable-next-line no-fallthrough
|
419
418
|
default:
|
420
|
-
return
|
419
|
+
return index$1._defineProperty(index$1._defineProperty(index$1._defineProperty({
|
421
420
|
eq: function eq(other) {
|
422
421
|
var otherValue = other;
|
423
422
|
if (isSelector(other)) {
|
@@ -431,7 +430,7 @@ function newSelectorProxy(source, path, moduleSchema) {
|
|
431
430
|
andThen: function andThen(f) {
|
432
431
|
return _andThen(f, source === undefined ? null : source, path);
|
433
432
|
}
|
434
|
-
},
|
433
|
+
}, SourceOrExpr, source === undefined ? null : source), Path, path), GetSchema, moduleSchema);
|
435
434
|
}
|
436
435
|
}
|
437
436
|
function createValPathOfItem(arrayPath, prop) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { q as _objectSpread2, h as _slicedToArray, c as _createClass, b as _classCallCheck, r as Sym, C as Call, s as StringLiteral, t as StringTemplate, e as _typeof, l as isSerializedVal, F as FILE_REF_PROP, V as VAL_EXTENSION, m as convertFileSource, d as _defineProperty, E as Expr, S as Schema, u as _toConsumableArray, N as NilSym } from './index-c83918b8.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", " "];
|
@@ -317,7 +317,6 @@ function isSelector(source) {
|
|
317
317
|
return _typeof(source) === "object" && source !== null && (SourceOrExpr in source || Path in source);
|
318
318
|
}
|
319
319
|
function newSelectorProxy(source, path, moduleSchema) {
|
320
|
-
var _ref;
|
321
320
|
if (_typeof(source) === "object") {
|
322
321
|
if (isSelector(source)) {
|
323
322
|
return source;
|
@@ -415,7 +414,7 @@ function newSelectorProxy(source, path, moduleSchema) {
|
|
415
414
|
// intentional fallthrough
|
416
415
|
// eslint-disable-next-line no-fallthrough
|
417
416
|
default:
|
418
|
-
return
|
417
|
+
return _defineProperty(_defineProperty(_defineProperty({
|
419
418
|
eq: function eq(other) {
|
420
419
|
var otherValue = other;
|
421
420
|
if (isSelector(other)) {
|
@@ -429,7 +428,7 @@ function newSelectorProxy(source, path, moduleSchema) {
|
|
429
428
|
andThen: function andThen(f) {
|
430
429
|
return _andThen(f, source === undefined ? null : source, path);
|
431
430
|
}
|
432
|
-
},
|
431
|
+
}, SourceOrExpr, source === undefined ? null : source), Path, path), GetSchema, moduleSchema);
|
433
432
|
}
|
434
433
|
}
|
435
434
|
function createValPathOfItem(arrayPath, prop) {
|
@@ -2,6 +2,32 @@
|
|
2
2
|
|
3
3
|
var result = require('./result-26f67b40.cjs.prod.js');
|
4
4
|
|
5
|
+
function _arrayWithoutHoles(arr) {
|
6
|
+
if (Array.isArray(arr)) return result._arrayLikeToArray(arr);
|
7
|
+
}
|
8
|
+
|
9
|
+
function _iterableToArray(iter) {
|
10
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
11
|
+
}
|
12
|
+
|
13
|
+
function _nonIterableSpread() {
|
14
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
15
|
+
}
|
16
|
+
|
17
|
+
function _toConsumableArray(arr) {
|
18
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || result._unsupportedIterableToArray(arr) || _nonIterableSpread();
|
19
|
+
}
|
20
|
+
|
21
|
+
function _typeof(o) {
|
22
|
+
"@babel/helpers - typeof";
|
23
|
+
|
24
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
25
|
+
return typeof o;
|
26
|
+
} : function (o) {
|
27
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
28
|
+
}, _typeof(o);
|
29
|
+
}
|
30
|
+
|
5
31
|
function _toPrimitive(input, hint) {
|
6
32
|
if (typeof input !== "object" || input === null) return input;
|
7
33
|
var prim = input[Symbol.toPrimitive];
|
@@ -55,32 +81,6 @@ function _objectSpread2(e) {
|
|
55
81
|
return e;
|
56
82
|
}
|
57
83
|
|
58
|
-
function _arrayWithoutHoles(arr) {
|
59
|
-
if (Array.isArray(arr)) return result._arrayLikeToArray(arr);
|
60
|
-
}
|
61
|
-
|
62
|
-
function _iterableToArray(iter) {
|
63
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
64
|
-
}
|
65
|
-
|
66
|
-
function _nonIterableSpread() {
|
67
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
68
|
-
}
|
69
|
-
|
70
|
-
function _toConsumableArray(arr) {
|
71
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || result._unsupportedIterableToArray(arr) || _nonIterableSpread();
|
72
|
-
}
|
73
|
-
|
74
|
-
function _typeof(o) {
|
75
|
-
"@babel/helpers - typeof";
|
76
|
-
|
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
|
-
}
|
83
|
-
|
84
84
|
function _arrayWithHoles(arr) {
|
85
85
|
if (Array.isArray(arr)) return arr;
|
86
86
|
}
|
@@ -423,8 +423,7 @@ var FILE_REF_PROP = "_ref";
|
|
423
423
|
*/
|
424
424
|
|
425
425
|
function file(ref, metadata) {
|
426
|
-
|
427
|
-
return _ref = {}, _defineProperty(_ref, FILE_REF_PROP, ref), _defineProperty(_ref, VAL_EXTENSION, "file"), _defineProperty(_ref, "metadata", metadata), _ref;
|
426
|
+
return _defineProperty(_defineProperty(_defineProperty({}, FILE_REF_PROP, ref), VAL_EXTENSION, "file"), "metadata", metadata);
|
428
427
|
}
|
429
428
|
function isFile(obj) {
|
430
429
|
return _typeof(obj) === "object" && obj !== null && VAL_EXTENSION in obj && obj[VAL_EXTENSION] === "file" && FILE_REF_PROP in obj && typeof obj[FILE_REF_PROP] === "string";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var index$1 = require('./index-
|
3
|
+
var index$1 = require('./index-a5295001.cjs.dev.js');
|
4
4
|
var result = require('./result-48320acd.cjs.dev.js');
|
5
5
|
|
6
6
|
var WHITE_SPACE = ["\n", "\r", "\t", " "];
|
@@ -319,7 +319,6 @@ function isSelector(source) {
|
|
319
319
|
return index$1._typeof(source) === "object" && source !== null && (SourceOrExpr in source || Path in source);
|
320
320
|
}
|
321
321
|
function newSelectorProxy(source, path, moduleSchema) {
|
322
|
-
var _ref;
|
323
322
|
if (index$1._typeof(source) === "object") {
|
324
323
|
if (isSelector(source)) {
|
325
324
|
return source;
|
@@ -417,7 +416,7 @@ function newSelectorProxy(source, path, moduleSchema) {
|
|
417
416
|
// intentional fallthrough
|
418
417
|
// eslint-disable-next-line no-fallthrough
|
419
418
|
default:
|
420
|
-
return
|
419
|
+
return index$1._defineProperty(index$1._defineProperty(index$1._defineProperty({
|
421
420
|
eq: function eq(other) {
|
422
421
|
var otherValue = other;
|
423
422
|
if (isSelector(other)) {
|
@@ -431,7 +430,7 @@ function newSelectorProxy(source, path, moduleSchema) {
|
|
431
430
|
andThen: function andThen(f) {
|
432
431
|
return _andThen(f, source === undefined ? null : source, path);
|
433
432
|
}
|
434
|
-
},
|
433
|
+
}, SourceOrExpr, source === undefined ? null : source), Path, path), GetSchema, moduleSchema);
|
435
434
|
}
|
436
435
|
}
|
437
436
|
function createValPathOfItem(arrayPath, prop) {
|
@@ -2,6 +2,32 @@
|
|
2
2
|
|
3
3
|
var result = require('./result-48320acd.cjs.dev.js');
|
4
4
|
|
5
|
+
function _arrayWithoutHoles(arr) {
|
6
|
+
if (Array.isArray(arr)) return result._arrayLikeToArray(arr);
|
7
|
+
}
|
8
|
+
|
9
|
+
function _iterableToArray(iter) {
|
10
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
11
|
+
}
|
12
|
+
|
13
|
+
function _nonIterableSpread() {
|
14
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
15
|
+
}
|
16
|
+
|
17
|
+
function _toConsumableArray(arr) {
|
18
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || result._unsupportedIterableToArray(arr) || _nonIterableSpread();
|
19
|
+
}
|
20
|
+
|
21
|
+
function _typeof(o) {
|
22
|
+
"@babel/helpers - typeof";
|
23
|
+
|
24
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
25
|
+
return typeof o;
|
26
|
+
} : function (o) {
|
27
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
28
|
+
}, _typeof(o);
|
29
|
+
}
|
30
|
+
|
5
31
|
function _toPrimitive(input, hint) {
|
6
32
|
if (typeof input !== "object" || input === null) return input;
|
7
33
|
var prim = input[Symbol.toPrimitive];
|
@@ -55,32 +81,6 @@ function _objectSpread2(e) {
|
|
55
81
|
return e;
|
56
82
|
}
|
57
83
|
|
58
|
-
function _arrayWithoutHoles(arr) {
|
59
|
-
if (Array.isArray(arr)) return result._arrayLikeToArray(arr);
|
60
|
-
}
|
61
|
-
|
62
|
-
function _iterableToArray(iter) {
|
63
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
64
|
-
}
|
65
|
-
|
66
|
-
function _nonIterableSpread() {
|
67
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
68
|
-
}
|
69
|
-
|
70
|
-
function _toConsumableArray(arr) {
|
71
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || result._unsupportedIterableToArray(arr) || _nonIterableSpread();
|
72
|
-
}
|
73
|
-
|
74
|
-
function _typeof(o) {
|
75
|
-
"@babel/helpers - typeof";
|
76
|
-
|
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
|
-
}
|
83
|
-
|
84
84
|
function _arrayWithHoles(arr) {
|
85
85
|
if (Array.isArray(arr)) return arr;
|
86
86
|
}
|
@@ -423,8 +423,7 @@ var FILE_REF_PROP = "_ref";
|
|
423
423
|
*/
|
424
424
|
|
425
425
|
function file(ref, metadata) {
|
426
|
-
|
427
|
-
return _ref = {}, _defineProperty(_ref, FILE_REF_PROP, ref), _defineProperty(_ref, VAL_EXTENSION, "file"), _defineProperty(_ref, "metadata", metadata), _ref;
|
426
|
+
return _defineProperty(_defineProperty(_defineProperty({}, FILE_REF_PROP, ref), VAL_EXTENSION, "file"), "metadata", metadata);
|
428
427
|
}
|
429
428
|
function isFile(obj) {
|
430
429
|
return _typeof(obj) === "object" && obj !== null && VAL_EXTENSION in obj && obj[VAL_EXTENSION] === "file" && FILE_REF_PROP in obj && typeof obj[FILE_REF_PROP] === "string";
|
@@ -1,5 +1,31 @@
|
|
1
1
|
import { b as _arrayLikeToArray, c as _unsupportedIterableToArray } from './result-b96df128.esm.js';
|
2
2
|
|
3
|
+
function _arrayWithoutHoles(arr) {
|
4
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
5
|
+
}
|
6
|
+
|
7
|
+
function _iterableToArray(iter) {
|
8
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
9
|
+
}
|
10
|
+
|
11
|
+
function _nonIterableSpread() {
|
12
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
13
|
+
}
|
14
|
+
|
15
|
+
function _toConsumableArray(arr) {
|
16
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
17
|
+
}
|
18
|
+
|
19
|
+
function _typeof(o) {
|
20
|
+
"@babel/helpers - typeof";
|
21
|
+
|
22
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
23
|
+
return typeof o;
|
24
|
+
} : function (o) {
|
25
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
26
|
+
}, _typeof(o);
|
27
|
+
}
|
28
|
+
|
3
29
|
function _toPrimitive(input, hint) {
|
4
30
|
if (typeof input !== "object" || input === null) return input;
|
5
31
|
var prim = input[Symbol.toPrimitive];
|
@@ -53,32 +79,6 @@ function _objectSpread2(e) {
|
|
53
79
|
return e;
|
54
80
|
}
|
55
81
|
|
56
|
-
function _arrayWithoutHoles(arr) {
|
57
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
58
|
-
}
|
59
|
-
|
60
|
-
function _iterableToArray(iter) {
|
61
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
62
|
-
}
|
63
|
-
|
64
|
-
function _nonIterableSpread() {
|
65
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
66
|
-
}
|
67
|
-
|
68
|
-
function _toConsumableArray(arr) {
|
69
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
70
|
-
}
|
71
|
-
|
72
|
-
function _typeof(o) {
|
73
|
-
"@babel/helpers - typeof";
|
74
|
-
|
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
|
-
}
|
81
|
-
|
82
82
|
function _arrayWithHoles(arr) {
|
83
83
|
if (Array.isArray(arr)) return arr;
|
84
84
|
}
|
@@ -421,8 +421,7 @@ var FILE_REF_PROP = "_ref";
|
|
421
421
|
*/
|
422
422
|
|
423
423
|
function file(ref, metadata) {
|
424
|
-
|
425
|
-
return _ref = {}, _defineProperty(_ref, FILE_REF_PROP, ref), _defineProperty(_ref, VAL_EXTENSION, "file"), _defineProperty(_ref, "metadata", metadata), _ref;
|
424
|
+
return _defineProperty(_defineProperty(_defineProperty({}, FILE_REF_PROP, ref), VAL_EXTENSION, "file"), "metadata", metadata);
|
426
425
|
}
|
427
426
|
function isFile(obj) {
|
428
427
|
return _typeof(obj) === "object" && obj !== null && VAL_EXTENSION in obj && obj[VAL_EXTENSION] === "file" && FILE_REF_PROP in obj && typeof obj[FILE_REF_PROP] === "string";
|
@@ -554,4 +553,4 @@ function getValPath(valOrSelector) {
|
|
554
553
|
return valOrSelector[Path];
|
555
554
|
}
|
556
555
|
|
557
|
-
export { Call as C, Expr as E, FILE_REF_PROP as F, GetSchema as G, ImageSchema as I, NilSym as N, Path as P, Schema as S, VAL_EXTENSION as V, _inherits as _, _createSuper as a, _classCallCheck as b, _createClass as c, _defineProperty as d, _typeof as e, file as f, getValPath as g,
|
556
|
+
export { Call as C, Expr as E, FILE_REF_PROP as F, GetSchema as G, ImageSchema as I, NilSym as N, Path as P, Schema as S, VAL_EXTENSION as V, _inherits as _, _createSuper as a, _classCallCheck as b, _createClass as c, _defineProperty as d, _typeof as e, file as f, getValPath as g, _slicedToArray as h, image as i, isFile as j, GetSource as k, isSerializedVal as l, convertFileSource as m, getSchema as n, isVal as o, GenericSelector as p, _objectSpread2 as q, Sym as r, StringLiteral as s, StringTemplate as t, _toConsumableArray as u };
|
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var index = require('./index-
|
3
|
+
var index = require('./index-5bdaa229.cjs.prod.js');
|
4
4
|
var result = require('./result-26f67b40.cjs.prod.js');
|
5
5
|
|
6
6
|
function hasOwn(obj, prop) {
|
@@ -16,7 +16,6 @@ function isSelector(source) {
|
|
16
16
|
return index._typeof(source) === "object" && source !== null && (index.GetSource in source || index.Path in source);
|
17
17
|
}
|
18
18
|
function newSelectorProxy(source, path, moduleSchema) {
|
19
|
-
var _ref;
|
20
19
|
if (index._typeof(source) === "object") {
|
21
20
|
if (isSelector(source)) {
|
22
21
|
return source;
|
@@ -114,7 +113,7 @@ function newSelectorProxy(source, path, moduleSchema) {
|
|
114
113
|
// intentional fallthrough
|
115
114
|
// eslint-disable-next-line no-fallthrough
|
116
115
|
default:
|
117
|
-
return
|
116
|
+
return index._defineProperty(index._defineProperty(index._defineProperty({
|
118
117
|
eq: function eq(other) {
|
119
118
|
var otherValue = other;
|
120
119
|
if (isSelector(other)) {
|
@@ -128,7 +127,7 @@ function newSelectorProxy(source, path, moduleSchema) {
|
|
128
127
|
andThen: function andThen(f) {
|
129
128
|
return _andThen(f, source === undefined ? null : source, path);
|
130
129
|
}
|
131
|
-
}, index.
|
130
|
+
}, index.GetSource, source === undefined ? null : source), index.Path, path), index.GetSchema, moduleSchema);
|
132
131
|
}
|
133
132
|
}
|
134
133
|
function createValPathOfItem(arrayPath, prop) {
|
@@ -517,8 +516,7 @@ id,
|
|
517
516
|
schema,
|
518
517
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
519
518
|
source) {
|
520
|
-
|
521
|
-
return _ref = {}, index._defineProperty(_ref, index.GetSource, source), index._defineProperty(_ref, index.GetSchema, schema), index._defineProperty(_ref, index.Path, id), _ref;
|
519
|
+
return index._defineProperty(index._defineProperty(index._defineProperty({}, index.GetSource, source), index.GetSchema, schema), index.Path, id);
|
522
520
|
}
|
523
521
|
function getSource(valModule) {
|
524
522
|
var sourceOrExpr = valModule[index.GetSource];
|
@@ -581,107 +579,108 @@ function resolvePath(path, valModule, schema) {
|
|
581
579
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
582
580
|
var resolvedSource = valModule;
|
583
581
|
var _loop = function _loop() {
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
}
|
588
|
-
if (isArraySchema(resolvedSchema)) {
|
589
|
-
if (Number.isNaN(Number(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));
|
591
|
-
}
|
592
|
-
if (index._typeof(resolvedSource) !== "object" && !Array.isArray(resolvedSource)) {
|
593
|
-
throw Error("Schema type error: expected source to be type of array, but got ".concat(index._typeof(resolvedSource)));
|
594
|
-
}
|
595
|
-
if (!resolvedSource[part]) {
|
596
|
-
var _resolvedSource;
|
597
|
-
throw Error("Invalid path: array source (length: ".concat((_resolvedSource = resolvedSource) === null || _resolvedSource === void 0 ? void 0 : _resolvedSource.length, ") did not have index ").concat(part, " from path: ").concat(path));
|
598
|
-
}
|
599
|
-
resolvedSource = resolvedSource[part];
|
600
|
-
resolvedSchema = resolvedSchema.item;
|
601
|
-
} else if (isRecordSchema(resolvedSchema)) {
|
602
|
-
if (typeof part !== "string") {
|
603
|
-
throw Error("Invalid path: record schema ".concat(resolvedSchema, " must have path: ").concat(part, " as string"));
|
604
|
-
}
|
605
|
-
if (index._typeof(resolvedSource) !== "object" && !Array.isArray(resolvedSource)) {
|
606
|
-
throw Error("Schema type error: expected source to be type of record, but got ".concat(index._typeof(resolvedSource)));
|
607
|
-
}
|
608
|
-
if (!resolvedSource[part]) {
|
609
|
-
throw Error("Invalid path: record source did not have key ".concat(part, " from path: ").concat(path));
|
610
|
-
}
|
611
|
-
resolvedSource = resolvedSource[part];
|
612
|
-
resolvedSchema = resolvedSchema.item;
|
613
|
-
} else if (isObjectSchema(resolvedSchema)) {
|
614
|
-
if (index._typeof(resolvedSource) !== "object") {
|
615
|
-
throw Error("Schema type error: expected source to be type of object, but got ".concat(index._typeof(resolvedSource)));
|
616
|
-
}
|
617
|
-
if (!resolvedSource[part]) {
|
618
|
-
throw Error("Invalid path: object source did not have key ".concat(part, " from path: ").concat(path));
|
582
|
+
var part = parts.shift();
|
583
|
+
if (part === undefined) {
|
584
|
+
throw Error("Unexpected undefined part");
|
619
585
|
}
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
// if (!resolvedSchema.locales.includes(part)) {
|
624
|
-
// throw Error(
|
625
|
-
// `Invalid path: i18n schema ${resolvedSchema} supports locales ${resolvedSchema.locales.join(
|
626
|
-
// ", "
|
627
|
-
// )}, but found: ${part}`
|
628
|
-
// );
|
629
|
-
// }
|
630
|
-
// if (!Object.keys(resolvedSource).includes(part)) {
|
631
|
-
// throw Error(
|
632
|
-
// `Schema type error: expected source to be type of i18n with locale ${part}, but got ${JSON.stringify(
|
633
|
-
// Object.keys(resolvedSource)
|
634
|
-
// )}`
|
635
|
-
// );
|
636
|
-
// }
|
637
|
-
// resolvedSource = resolvedSource[part];
|
638
|
-
// resolvedSchema = resolvedSchema.item;
|
639
|
-
} else if (isImageSchema(resolvedSchema)) {
|
640
|
-
return {
|
641
|
-
v: {
|
642
|
-
path: origParts.slice(0, origParts.length - parts.length - 1).map(function (p) {
|
643
|
-
return JSON.stringify(p);
|
644
|
-
}).join("."),
|
645
|
-
// TODO: create a function generate path from parts (not sure if this always works)
|
646
|
-
schema: resolvedSchema,
|
647
|
-
source: resolvedSource
|
586
|
+
if (isArraySchema(resolvedSchema)) {
|
587
|
+
if (Number.isNaN(Number(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));
|
648
589
|
}
|
649
|
-
|
650
|
-
|
651
|
-
var _key = resolvedSchema.key;
|
652
|
-
var keyValue = resolvedSource[_key];
|
653
|
-
if (!keyValue) {
|
654
|
-
throw Error("Invalid path: union source ".concat(resolvedSchema, " did not have required key ").concat(_key, " in path: ").concat(path));
|
655
|
-
}
|
656
|
-
var schemaOfUnionKey = resolvedSchema.items.find(
|
657
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
658
|
-
function (child) {
|
659
|
-
var _child$items, _child$items$_key;
|
660
|
-
return (child === null || child === void 0 ? void 0 : (_child$items = child.items) === null || _child$items === void 0 ? void 0 : (_child$items$_key = _child$items[_key]) === null || _child$items$_key === void 0 ? void 0 : _child$items$_key.value) === keyValue;
|
661
|
-
});
|
662
|
-
if (!schemaOfUnionKey) {
|
663
|
-
throw Error("Invalid path: union schema ".concat(resolvedSchema, " did not have a child object with ").concat(_key, " of value ").concat(keyValue, " in path: ").concat(path));
|
664
|
-
}
|
665
|
-
resolvedSchema = schemaOfUnionKey.items[part];
|
666
|
-
resolvedSource = resolvedSource[part];
|
667
|
-
} else if (isRichTextSchema(resolvedSchema)) {
|
668
|
-
return {
|
669
|
-
v: {
|
670
|
-
path: origParts.slice(0, origParts.length - parts.length - 1).map(function (p) {
|
671
|
-
return JSON.stringify(p);
|
672
|
-
}).join("."),
|
673
|
-
// TODO: create a function generate path from parts (not sure if this always works)
|
674
|
-
schema: resolvedSchema,
|
675
|
-
source: resolvedSource
|
590
|
+
if (index._typeof(resolvedSource) !== "object" && !Array.isArray(resolvedSource)) {
|
591
|
+
throw Error("Schema type error: expected source to be type of array, but got ".concat(index._typeof(resolvedSource)));
|
676
592
|
}
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
593
|
+
if (!resolvedSource[part]) {
|
594
|
+
var _resolvedSource;
|
595
|
+
throw Error("Invalid path: array source (length: ".concat((_resolvedSource = resolvedSource) === null || _resolvedSource === void 0 ? void 0 : _resolvedSource.length, ") did not have index ").concat(part, " from path: ").concat(path));
|
596
|
+
}
|
597
|
+
resolvedSource = resolvedSource[part];
|
598
|
+
resolvedSchema = resolvedSchema.item;
|
599
|
+
} else if (isRecordSchema(resolvedSchema)) {
|
600
|
+
if (typeof part !== "string") {
|
601
|
+
throw Error("Invalid path: record schema ".concat(resolvedSchema, " must have path: ").concat(part, " as string"));
|
602
|
+
}
|
603
|
+
if (index._typeof(resolvedSource) !== "object" && !Array.isArray(resolvedSource)) {
|
604
|
+
throw Error("Schema type error: expected source to be type of record, but got ".concat(index._typeof(resolvedSource)));
|
605
|
+
}
|
606
|
+
if (!resolvedSource[part]) {
|
607
|
+
throw Error("Invalid path: record source did not have key ".concat(part, " from path: ").concat(path));
|
608
|
+
}
|
609
|
+
resolvedSource = resolvedSource[part];
|
610
|
+
resolvedSchema = resolvedSchema.item;
|
611
|
+
} else if (isObjectSchema(resolvedSchema)) {
|
612
|
+
if (index._typeof(resolvedSource) !== "object") {
|
613
|
+
throw Error("Schema type error: expected source to be type of object, but got ".concat(index._typeof(resolvedSource)));
|
614
|
+
}
|
615
|
+
if (!resolvedSource[part]) {
|
616
|
+
throw Error("Invalid path: object source did not have key ".concat(part, " from path: ").concat(path));
|
617
|
+
}
|
618
|
+
resolvedSource = resolvedSource[part];
|
619
|
+
resolvedSchema = resolvedSchema.items[part];
|
620
|
+
// } else if (isI18nSchema(resolvedSchema)) {
|
621
|
+
// if (!resolvedSchema.locales.includes(part)) {
|
622
|
+
// throw Error(
|
623
|
+
// `Invalid path: i18n schema ${resolvedSchema} supports locales ${resolvedSchema.locales.join(
|
624
|
+
// ", "
|
625
|
+
// )}, but found: ${part}`
|
626
|
+
// );
|
627
|
+
// }
|
628
|
+
// if (!Object.keys(resolvedSource).includes(part)) {
|
629
|
+
// throw Error(
|
630
|
+
// `Schema type error: expected source to be type of i18n with locale ${part}, but got ${JSON.stringify(
|
631
|
+
// Object.keys(resolvedSource)
|
632
|
+
// )}`
|
633
|
+
// );
|
634
|
+
// }
|
635
|
+
// resolvedSource = resolvedSource[part];
|
636
|
+
// resolvedSchema = resolvedSchema.item;
|
637
|
+
} else if (isImageSchema(resolvedSchema)) {
|
638
|
+
return {
|
639
|
+
v: {
|
640
|
+
path: origParts.slice(0, origParts.length - parts.length - 1).map(function (p) {
|
641
|
+
return JSON.stringify(p);
|
642
|
+
}).join("."),
|
643
|
+
// TODO: create a function generate path from parts (not sure if this always works)
|
644
|
+
schema: resolvedSchema,
|
645
|
+
source: resolvedSource
|
646
|
+
}
|
647
|
+
};
|
648
|
+
} else if (isUnionSchema(resolvedSchema)) {
|
649
|
+
var _key = resolvedSchema.key;
|
650
|
+
var keyValue = resolvedSource[_key];
|
651
|
+
if (!keyValue) {
|
652
|
+
throw Error("Invalid path: union source ".concat(resolvedSchema, " did not have required key ").concat(_key, " in path: ").concat(path));
|
653
|
+
}
|
654
|
+
var schemaOfUnionKey = resolvedSchema.items.find(
|
655
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
656
|
+
function (child) {
|
657
|
+
var _child$items;
|
658
|
+
return (child === null || child === void 0 || (_child$items = child.items) === null || _child$items === void 0 || (_child$items = _child$items[_key]) === null || _child$items === void 0 ? void 0 : _child$items.value) === keyValue;
|
659
|
+
});
|
660
|
+
if (!schemaOfUnionKey) {
|
661
|
+
throw Error("Invalid path: union schema ".concat(resolvedSchema, " did not have a child object with ").concat(_key, " of value ").concat(keyValue, " in path: ").concat(path));
|
662
|
+
}
|
663
|
+
resolvedSchema = schemaOfUnionKey.items[part];
|
664
|
+
resolvedSource = resolvedSource[part];
|
665
|
+
} else if (isRichTextSchema(resolvedSchema)) {
|
666
|
+
return {
|
667
|
+
v: {
|
668
|
+
path: origParts.slice(0, origParts.length - parts.length - 1).map(function (p) {
|
669
|
+
return JSON.stringify(p);
|
670
|
+
}).join("."),
|
671
|
+
// TODO: create a function generate path from parts (not sure if this always works)
|
672
|
+
schema: resolvedSchema,
|
673
|
+
source: resolvedSource
|
674
|
+
}
|
675
|
+
};
|
676
|
+
} else {
|
677
|
+
throw Error("Invalid path: ".concat(part, " resolved to an unexpected schema ").concat(JSON.stringify(resolvedSchema)));
|
678
|
+
}
|
679
|
+
},
|
680
|
+
_ret;
|
682
681
|
while (parts.length > 0) {
|
683
|
-
|
684
|
-
if (
|
682
|
+
_ret = _loop();
|
683
|
+
if (_ret) return _ret.v;
|
685
684
|
}
|
686
685
|
if (parts.length > 0) {
|
687
686
|
throw Error("Invalid path: ".concat(parts.join("."), " is not a valid path"));
|