@valbuild/core 0.33.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
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
export { i as expr } from './index-
|
1
|
+
import { a as array, o as object, u as union, r as richtext$1, b as record, c as content, P as PatchError, n as newSelectorProxy, d as createValPathOfItem, i as isSelector, g as getSource, e as resolvePath, s as splitModuleIdAndModulePath } from './ops-ce47df64.esm.js';
|
2
|
+
import { _ as _inherits, a as _createSuper, b as _classCallCheck, c as _createClass, d as _defineProperty, e as _typeof, S as Schema, G as GetSchema, g as getValPath, i as image, V as VAL_EXTENSION, f as file, h as _slicedToArray, j as isFile, F as FILE_REF_PROP, P as Path, k as GetSource, l as isSerializedVal, m as convertFileSource, n as getSchema, o as isVal } from './index-c83918b8.esm.js';
|
3
|
+
export { F as FILE_REF_PROP, p as GenericSelector, S as Schema, V as VAL_EXTENSION } from './index-c83918b8.esm.js';
|
4
|
+
export { i as expr } from './index-4f821892.esm.js';
|
5
5
|
import { _ as _createForOfIteratorHelper, i as isErr, a as isOk, e as err, o as ok, r as result } from './result-b96df128.esm.js';
|
6
6
|
|
7
7
|
var NumberSchema = /*#__PURE__*/function (_Schema) {
|
@@ -347,7 +347,7 @@ var KeyOfSchema = /*#__PURE__*/function (_Schema) {
|
|
347
347
|
value: function serialize() {
|
348
348
|
var path = getValPath(this.selector);
|
349
349
|
if (!path) {
|
350
|
-
throw new Error("Cannot serialize
|
350
|
+
throw new Error("Cannot serialize keyOf schema with empty selector. TIP: keyOf must be used with a Val Module.");
|
351
351
|
}
|
352
352
|
return {
|
353
353
|
type: "keyOf",
|
@@ -414,19 +414,18 @@ function initSchema() {
|
|
414
414
|
* Internally it is a Selector
|
415
415
|
**/
|
416
416
|
function richtext(templateStrings) {
|
417
|
-
var _ref;
|
418
417
|
for (var _len = arguments.length, nodes = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
419
418
|
nodes[_key - 1] = arguments[_key];
|
420
419
|
}
|
421
|
-
return
|
420
|
+
return _defineProperty(_defineProperty(_defineProperty({}, VAL_EXTENSION, "richtext"), "templateStrings", templateStrings), "exprs", nodes);
|
422
421
|
}
|
423
422
|
|
424
423
|
function link(text, _ref) {
|
425
|
-
var _ref2;
|
426
424
|
var href = _ref.href;
|
427
|
-
return
|
425
|
+
return _defineProperty(_defineProperty(_defineProperty({}, VAL_EXTENSION, "link"), "href", href), "children", [text]);
|
428
426
|
}
|
429
427
|
|
428
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
430
429
|
// import { i18n, I18n } from "./source/future/i18n";
|
431
430
|
// import { remote } from "./source/future/remote";
|
432
431
|
// type NarrowStrings<A> =
|
@@ -451,6 +450,7 @@ var initVal = function initVal() {
|
|
451
450
|
// richtext,
|
452
451
|
// },
|
453
452
|
// s,
|
453
|
+
// config: {},
|
454
454
|
// // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
455
455
|
// } as any;
|
456
456
|
// }
|
@@ -463,7 +463,8 @@ var initVal = function initVal() {
|
|
463
463
|
richtext: richtext,
|
464
464
|
link: link
|
465
465
|
},
|
466
|
-
s:
|
466
|
+
s: s,
|
467
|
+
config: {}
|
467
468
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
468
469
|
};
|
469
470
|
};
|
@@ -592,7 +593,7 @@ function getVal(selector) {
|
|
592
593
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
593
594
|
function isArrayOrArraySelector(child) {
|
594
595
|
if (isSelector(child)) {
|
595
|
-
return _typeof(child[GetSource]) === "object" &&
|
596
|
+
return _typeof(child[GetSource]) === "object" && child[GetSource] !== null && Array.isArray(child[GetSource]);
|
596
597
|
}
|
597
598
|
return Array.isArray(child);
|
598
599
|
}
|
@@ -600,7 +601,7 @@ function isArrayOrArraySelector(child) {
|
|
600
601
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
601
602
|
function isObjectOrObjectSelector(child) {
|
602
603
|
if (isSelector(child)) {
|
603
|
-
return _typeof(child[GetSource]) === "object" &&
|
604
|
+
return _typeof(child[GetSource]) === "object" && child[GetSource] !== null && !Array.isArray(child[GetSource]);
|
604
605
|
}
|
605
606
|
return _typeof(child) === "object";
|
606
607
|
}
|
@@ -670,7 +671,6 @@ function strip(value) {
|
|
670
671
|
}
|
671
672
|
}
|
672
673
|
function newValProxy(val) {
|
673
|
-
var _ref5;
|
674
674
|
var source = val.val;
|
675
675
|
switch (_typeof(source)) {
|
676
676
|
case "function":
|
@@ -713,7 +713,7 @@ function newValProxy(val) {
|
|
713
713
|
// intentional fallthrough
|
714
714
|
// eslint-disable-next-line no-fallthrough
|
715
715
|
default:
|
716
|
-
return
|
716
|
+
return _defineProperty(_defineProperty({}, Path, val.valPath), "val", val.val);
|
717
717
|
}
|
718
718
|
}
|
719
719
|
function hasOwn(obj, prop) {
|
@@ -1087,8 +1087,8 @@ var ValApi = /*#__PURE__*/function () {
|
|
1087
1087
|
}
|
1088
1088
|
_createClass(ValApi, [{
|
1089
1089
|
key: "getDisableUrl",
|
1090
|
-
value: function getDisableUrl() {
|
1091
|
-
return "".concat(this.host, "/disable");
|
1090
|
+
value: function getDisableUrl(redirectTo) {
|
1091
|
+
return "".concat(this.host, "/disable?redirect_to=").concat(encodeURIComponent(redirectTo));
|
1092
1092
|
}
|
1093
1093
|
}, {
|
1094
1094
|
key: "getEditUrl",
|
@@ -1100,6 +1100,11 @@ var ValApi = /*#__PURE__*/function () {
|
|
1100
1100
|
value: function getLoginUrl(redirectTo) {
|
1101
1101
|
return "".concat(this.host, "/authorize?redirect_to=").concat(encodeURIComponent(redirectTo));
|
1102
1102
|
}
|
1103
|
+
}, {
|
1104
|
+
key: "getEnableUrl",
|
1105
|
+
value: function getEnableUrl(redirectTo) {
|
1106
|
+
return "".concat(this.host, "/enable?redirect_to=").concat(encodeURIComponent(redirectTo));
|
1107
|
+
}
|
1103
1108
|
}, {
|
1104
1109
|
key: "getPatches",
|
1105
1110
|
value: function () {
|
@@ -1118,7 +1123,7 @@ var ValApi = /*#__PURE__*/function () {
|
|
1118
1123
|
}
|
1119
1124
|
}).then(function (res) {
|
1120
1125
|
return parse(res);
|
1121
|
-
}));
|
1126
|
+
})["catch"](createError));
|
1122
1127
|
case 3:
|
1123
1128
|
case "end":
|
1124
1129
|
return _context.stop();
|
@@ -1141,18 +1146,18 @@ var ValApi = /*#__PURE__*/function () {
|
|
1141
1146
|
body: JSON.stringify(_defineProperty({}, moduleId, patches))
|
1142
1147
|
}).then(function (res) {
|
1143
1148
|
return parse(res);
|
1144
|
-
});
|
1149
|
+
})["catch"](createError);
|
1145
1150
|
}
|
1146
1151
|
}, {
|
1147
1152
|
key: "getSession",
|
1148
1153
|
value: function getSession() {
|
1149
1154
|
return fetch("".concat(this.host, "/session")).then(function (res) {
|
1150
|
-
return parse(res);
|
1155
|
+
return parse(res)["catch"](createError);
|
1151
1156
|
});
|
1152
1157
|
}
|
1153
1158
|
}, {
|
1154
|
-
key: "
|
1155
|
-
value: function
|
1159
|
+
key: "getTree",
|
1160
|
+
value: function getTree(_ref2) {
|
1156
1161
|
var _ref2$patch = _ref2.patch,
|
1157
1162
|
patch = _ref2$patch === void 0 ? false : _ref2$patch,
|
1158
1163
|
_ref2$includeSchema = _ref2.includeSchema,
|
@@ -1170,11 +1175,17 @@ var ValApi = /*#__PURE__*/function () {
|
|
1170
1175
|
headers: headers
|
1171
1176
|
}).then(function (res) {
|
1172
1177
|
return parse(res);
|
1173
|
-
});
|
1178
|
+
})["catch"](createError);
|
1174
1179
|
}
|
1175
1180
|
}]);
|
1176
1181
|
return ValApi;
|
1177
1182
|
}();
|
1183
|
+
function createError(err$1) {
|
1184
|
+
return err({
|
1185
|
+
statusCode: 500,
|
1186
|
+
message: err$1 instanceof Error ? err$1.message : "Unknown error"
|
1187
|
+
});
|
1188
|
+
}
|
1178
1189
|
|
1179
1190
|
// TODO: validate
|
1180
1191
|
function parse(_x2) {
|
@@ -1182,6 +1193,7 @@ function parse(_x2) {
|
|
1182
1193
|
}
|
1183
1194
|
function _parse() {
|
1184
1195
|
_parse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(res) {
|
1196
|
+
var json;
|
1185
1197
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
1186
1198
|
while (1) switch (_context2.prev = _context2.next) {
|
1187
1199
|
case 0:
|
@@ -1197,31 +1209,41 @@ function _parse() {
|
|
1197
1209
|
_context2.t1 = _context2.sent;
|
1198
1210
|
return _context2.abrupt("return", _context2.t0.ok.call(_context2.t0, _context2.t1));
|
1199
1211
|
case 9:
|
1200
|
-
_context2.
|
1201
|
-
_context2.
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
_context2.
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1212
|
+
_context2.prev = 9;
|
1213
|
+
_context2.next = 12;
|
1214
|
+
return res.json();
|
1215
|
+
case 12:
|
1216
|
+
json = _context2.sent;
|
1217
|
+
return _context2.abrupt("return", err({
|
1218
|
+
statusCode: res.status,
|
1219
|
+
message: json.message || res.statusText,
|
1220
|
+
details: json.details || Object.fromEntries(Object.entries(json).filter(function (_ref3) {
|
1221
|
+
var _ref4 = _slicedToArray(_ref3, 1),
|
1222
|
+
key = _ref4[0];
|
1223
|
+
return key !== "message";
|
1224
|
+
}))
|
1225
|
+
}));
|
1211
1226
|
case 16:
|
1212
|
-
_context2.
|
1213
|
-
|
1214
|
-
case 18:
|
1215
|
-
_context2.prev = 18;
|
1216
|
-
_context2.t6 = _context2["catch"](0);
|
1227
|
+
_context2.prev = 16;
|
1228
|
+
_context2.t2 = _context2["catch"](9);
|
1217
1229
|
return _context2.abrupt("return", err({
|
1218
|
-
|
1230
|
+
statusCode: res.status,
|
1231
|
+
message: res.statusText
|
1219
1232
|
}));
|
1233
|
+
case 19:
|
1234
|
+
_context2.next = 24;
|
1235
|
+
break;
|
1220
1236
|
case 21:
|
1237
|
+
_context2.prev = 21;
|
1238
|
+
_context2.t3 = _context2["catch"](0);
|
1239
|
+
return _context2.abrupt("return", err({
|
1240
|
+
message: _context2.t3 instanceof Error ? _context2.t3.message : "Unknown error"
|
1241
|
+
}));
|
1242
|
+
case 24:
|
1221
1243
|
case "end":
|
1222
1244
|
return _context2.stop();
|
1223
1245
|
}
|
1224
|
-
}, _callee2, null, [[0,
|
1246
|
+
}, _callee2, null, [[0, 21], [9, 16]]);
|
1225
1247
|
}));
|
1226
1248
|
return _parse.apply(this, arguments);
|
1227
1249
|
}
|
@@ -1239,19 +1261,19 @@ var Internal = {
|
|
1239
1261
|
getSHA256Hash: getSHA256Hash,
|
1240
1262
|
createPatchJSONPath: function createPatchJSONPath(modulePath) {
|
1241
1263
|
return "/".concat(modulePath.split(".").map(function (segment) {
|
1242
|
-
return
|
1264
|
+
return segment && tryJsonParse(segment);
|
1243
1265
|
}).join("/"));
|
1244
1266
|
},
|
1245
|
-
/**
|
1246
|
-
* Enables draft mode: updates all Val modules with patches
|
1247
|
-
*/
|
1248
|
-
VAL_DRAFT_MODE_COOKIE: "val_draft_mode",
|
1249
|
-
/**
|
1250
|
-
* Enables Val: show the overlay / menu
|
1251
|
-
*/
|
1252
1267
|
VAL_ENABLE_COOKIE_NAME: "val_enable",
|
1253
1268
|
VAL_STATE_COOKIE: "val_state",
|
1254
1269
|
VAL_SESSION_COOKIE: "val_session"
|
1255
1270
|
};
|
1271
|
+
function tryJsonParse(str) {
|
1272
|
+
try {
|
1273
|
+
return JSON.parse(str);
|
1274
|
+
} catch (err) {
|
1275
|
+
return str;
|
1276
|
+
}
|
1277
|
+
}
|
1256
1278
|
|
1257
1279
|
export { Internal, ValApi, derefPatch, initVal };
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('../../dist/index-
|
6
|
-
var index = require('../../dist/index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('../../dist/index-6deb169d.cjs.dev.js');
|
6
|
+
var index = require('../../dist/index-a5295001.cjs.dev.js');
|
7
7
|
require('../../dist/result-48320acd.cjs.dev.js');
|
8
8
|
|
9
9
|
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var expr_dist_valbuildCoreExpr = require('../../dist/index-
|
6
|
-
var index = require('../../dist/index-
|
5
|
+
var expr_dist_valbuildCoreExpr = require('../../dist/index-216627d7.cjs.prod.js');
|
6
|
+
var index = require('../../dist/index-5bdaa229.cjs.prod.js');
|
7
7
|
require('../../dist/result-26f67b40.cjs.prod.js');
|
8
8
|
|
9
9
|
|
@@ -1,3 +1,3 @@
|
|
1
|
-
export { e as evaluate, p as parse } from '../../dist/index-
|
2
|
-
export { C as Call, E as Expr, N as NilSym, s as StringLiteral, t as StringTemplate, r as Sym } from '../../dist/index-
|
1
|
+
export { e as evaluate, p as parse } from '../../dist/index-4f821892.esm.js';
|
2
|
+
export { C as Call, E as Expr, N as NilSym, s as StringLiteral, t as StringTemplate, r as Sym } from '../../dist/index-c83918b8.esm.js';
|
3
3
|
import '../../dist/result-b96df128.esm.js';
|
package/package.json
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var index = require('../../dist/index-
|
5
|
+
var index = require('../../dist/index-a5295001.cjs.dev.js');
|
6
6
|
var result = require('../../dist/result-48320acd.cjs.dev.js');
|
7
7
|
var util = require('../../dist/util-b213092b.cjs.dev.js');
|
8
|
-
var ops = require('../../dist/ops-
|
8
|
+
var ops = require('../../dist/ops-bec039cc.cjs.dev.js');
|
9
9
|
|
10
10
|
function isNotRoot(path) {
|
11
11
|
return result.isNonEmpty(path);
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var index = require('../../dist/index-
|
5
|
+
var index = require('../../dist/index-5bdaa229.cjs.prod.js');
|
6
6
|
var result = require('../../dist/result-26f67b40.cjs.prod.js');
|
7
7
|
var util = require('../../dist/util-030d8a1f.cjs.prod.js');
|
8
|
-
var ops = require('../../dist/ops-
|
8
|
+
var ops = require('../../dist/ops-6489efeb.cjs.prod.js');
|
9
9
|
|
10
10
|
function isNotRoot(path) {
|
11
11
|
return result.isNonEmpty(path);
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { e as _typeof,
|
1
|
+
import { e as _typeof, h as _slicedToArray, c as _createClass, b as _classCallCheck, u as _toConsumableArray } from '../../dist/index-c83918b8.esm.js';
|
2
2
|
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-b96df128.esm.js';
|
3
3
|
import { p as pipe } from '../../dist/util-18613e99.esm.js';
|
4
|
-
import { P as PatchError, s as splitModuleIdAndModulePath } from '../../dist/ops-
|
5
|
-
export { P as PatchError } from '../../dist/ops-
|
4
|
+
import { P as PatchError, s as splitModuleIdAndModulePath } from '../../dist/ops-ce47df64.esm.js';
|
5
|
+
export { P as PatchError } from '../../dist/ops-ce47df64.esm.js';
|
6
6
|
|
7
7
|
function isNotRoot(path) {
|
8
8
|
return isNonEmpty(path);
|