@valbuild/shared 0.67.1 → 0.68.1
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/internal/ApiRoutes.d.ts +564 -349
- package/dist/declarations/src/internal/index.d.ts +1 -1
- package/dist/declarations/src/internal/richtext/conversion/remirrorTypes.d.ts +336 -12
- package/dist/declarations/src/internal/zod/Patch.d.ts +23 -0
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +223 -622
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +223 -622
- package/internal/dist/valbuild-shared-internal.esm.js +219 -622
- package/package.json +2 -2
- package/dist/declarations/src/internal/ValCache.d.ts +0 -49
@@ -1,6 +1,5 @@
|
|
1
1
|
import { Internal, VAL_EXTENSION, FILE_REF_PROP, FILE_REF_SUBTYPE_TAG } from '@valbuild/core';
|
2
2
|
import { z } from 'zod';
|
3
|
-
import { result } from '@valbuild/core/fp';
|
4
3
|
import { fromZodError } from 'zod-validation-error';
|
5
4
|
|
6
5
|
function _toPrimitive(t, r) {
|
@@ -717,46 +716,6 @@ var VAL_SESSION_COOKIE = Internal.VAL_SESSION_COOKIE;
|
|
717
716
|
var VAL_STATE_COOKIE = Internal.VAL_STATE_COOKIE;
|
718
717
|
var VAL_ENABLE_COOKIE_NAME = Internal.VAL_ENABLE_COOKIE_NAME;
|
719
718
|
|
720
|
-
function _arrayWithHoles(r) {
|
721
|
-
if (Array.isArray(r)) return r;
|
722
|
-
}
|
723
|
-
|
724
|
-
function _iterableToArrayLimit(r, l) {
|
725
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
726
|
-
if (null != t) {
|
727
|
-
var e,
|
728
|
-
n,
|
729
|
-
i,
|
730
|
-
u,
|
731
|
-
a = [],
|
732
|
-
f = !0,
|
733
|
-
o = !1;
|
734
|
-
try {
|
735
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
736
|
-
if (Object(t) !== t) return;
|
737
|
-
f = !1;
|
738
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
739
|
-
} catch (r) {
|
740
|
-
o = !0, n = r;
|
741
|
-
} finally {
|
742
|
-
try {
|
743
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
744
|
-
} finally {
|
745
|
-
if (o) throw n;
|
746
|
-
}
|
747
|
-
}
|
748
|
-
return a;
|
749
|
-
}
|
750
|
-
}
|
751
|
-
|
752
|
-
function _nonIterableRest() {
|
753
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
754
|
-
}
|
755
|
-
|
756
|
-
function _slicedToArray(r, e) {
|
757
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
758
|
-
}
|
759
|
-
|
760
719
|
function _regeneratorRuntime() {
|
761
720
|
_regeneratorRuntime = function () {
|
762
721
|
return e;
|
@@ -1085,522 +1044,52 @@ function _asyncToGenerator(n) {
|
|
1085
1044
|
};
|
1086
1045
|
}
|
1087
1046
|
|
1088
|
-
function _classCallCheck(a, n) {
|
1089
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
1090
|
-
}
|
1091
|
-
|
1092
|
-
function _defineProperties(e, r) {
|
1093
|
-
for (var t = 0; t < r.length; t++) {
|
1094
|
-
var o = r[t];
|
1095
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
1096
|
-
}
|
1097
|
-
}
|
1098
|
-
function _createClass(e, r, t) {
|
1099
|
-
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
1100
|
-
writable: !1
|
1101
|
-
}), e;
|
1102
|
-
}
|
1103
|
-
|
1104
|
-
var ValCache = /*#__PURE__*/function () {
|
1105
|
-
function ValCache(client) {
|
1106
|
-
_classCallCheck(this, ValCache);
|
1107
|
-
this.client = client;
|
1108
|
-
this.drafts = {};
|
1109
|
-
this.schema = {};
|
1110
|
-
}
|
1111
|
-
return _createClass(ValCache, [{
|
1112
|
-
key: "reloadPaths",
|
1113
|
-
value: function () {
|
1114
|
-
var _reloadPaths = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(paths) {
|
1115
|
-
var patchesResponse, patches, filteredPatches, treeRes, data, _i, _Object$keys, _data$modules, pathS, path;
|
1116
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
1117
|
-
while (1) switch (_context.prev = _context.next) {
|
1118
|
-
case 0:
|
1119
|
-
_context.next = 2;
|
1120
|
-
return this.client("/patches/~", "GET", {
|
1121
|
-
query: {
|
1122
|
-
omit_patch: true,
|
1123
|
-
author: [],
|
1124
|
-
patch_id: [],
|
1125
|
-
module_file_path: paths
|
1126
|
-
}
|
1127
|
-
});
|
1128
|
-
case 2:
|
1129
|
-
patchesResponse = _context.sent;
|
1130
|
-
if (!(patchesResponse.status !== 200)) {
|
1131
|
-
_context.next = 6;
|
1132
|
-
break;
|
1133
|
-
}
|
1134
|
-
console.error("Val: failed to get patches", patchesResponse.json.message, patchesResponse.json);
|
1135
|
-
return _context.abrupt("return");
|
1136
|
-
case 6:
|
1137
|
-
patches = patchesResponse.json;
|
1138
|
-
filteredPatches = Object.keys(patches);
|
1139
|
-
_context.next = 10;
|
1140
|
-
return this.client("/sources", "PUT", {
|
1141
|
-
query: {
|
1142
|
-
validate_sources: true,
|
1143
|
-
validate_all: false,
|
1144
|
-
validate_binary_files: false
|
1145
|
-
},
|
1146
|
-
path: undefined,
|
1147
|
-
body: {
|
1148
|
-
patchIds: filteredPatches
|
1149
|
-
}
|
1150
|
-
});
|
1151
|
-
case 10:
|
1152
|
-
treeRes = _context.sent;
|
1153
|
-
_context.next = 13;
|
1154
|
-
return this.initialize();
|
1155
|
-
case 13:
|
1156
|
-
if (treeRes.status === 200) {
|
1157
|
-
data = treeRes.json;
|
1158
|
-
for (_i = 0, _Object$keys = Object.keys(data.modules); _i < _Object$keys.length; _i++) {
|
1159
|
-
pathS = _Object$keys[_i];
|
1160
|
-
path = pathS;
|
1161
|
-
this.drafts[path] = data === null || data === void 0 || (_data$modules = data.modules) === null || _data$modules === void 0 || (_data$modules = _data$modules[path]) === null || _data$modules === void 0 ? void 0 : _data$modules.source;
|
1162
|
-
this.emitEvent(path, this.drafts[path]);
|
1163
|
-
}
|
1164
|
-
} else {
|
1165
|
-
console.error("Val: failed to reload paths", paths, treeRes.json);
|
1166
|
-
}
|
1167
|
-
case 14:
|
1168
|
-
case "end":
|
1169
|
-
return _context.stop();
|
1170
|
-
}
|
1171
|
-
}, _callee, this);
|
1172
|
-
}));
|
1173
|
-
function reloadPaths(_x) {
|
1174
|
-
return _reloadPaths.apply(this, arguments);
|
1175
|
-
}
|
1176
|
-
return reloadPaths;
|
1177
|
-
}()
|
1178
|
-
}, {
|
1179
|
-
key: "reset",
|
1180
|
-
value: function () {
|
1181
|
-
var _reset = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
1182
|
-
var patchesRes, allPatches, treeRes, initRes, _i2, _Object$keys2, _treeRes$json, pathS, path;
|
1183
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
1184
|
-
while (1) switch (_context2.prev = _context2.next) {
|
1185
|
-
case 0:
|
1186
|
-
_context2.next = 2;
|
1187
|
-
return this.client("/patches/~", "GET", {
|
1188
|
-
query: {
|
1189
|
-
omit_patch: true,
|
1190
|
-
author: [],
|
1191
|
-
patch_id: [],
|
1192
|
-
module_file_path: []
|
1193
|
-
}
|
1194
|
-
});
|
1195
|
-
case 2:
|
1196
|
-
patchesRes = _context2.sent;
|
1197
|
-
if (!(patchesRes.status !== 200)) {
|
1198
|
-
_context2.next = 6;
|
1199
|
-
break;
|
1200
|
-
}
|
1201
|
-
console.error("Val: failed to get patches", patchesRes.json);
|
1202
|
-
return _context2.abrupt("return", result.err({
|
1203
|
-
errorType: "other",
|
1204
|
-
message: "Failed to get patches"
|
1205
|
-
}));
|
1206
|
-
case 6:
|
1207
|
-
allPatches = Object.keys(patchesRes.json.patches);
|
1208
|
-
_context2.next = 9;
|
1209
|
-
return this.client("/sources", "PUT", {
|
1210
|
-
path: undefined,
|
1211
|
-
query: {
|
1212
|
-
validate_sources: false,
|
1213
|
-
validate_all: false,
|
1214
|
-
validate_binary_files: false
|
1215
|
-
},
|
1216
|
-
body: {
|
1217
|
-
patchIds: allPatches
|
1218
|
-
}
|
1219
|
-
});
|
1220
|
-
case 9:
|
1221
|
-
treeRes = _context2.sent;
|
1222
|
-
_context2.next = 12;
|
1223
|
-
return this.initialize();
|
1224
|
-
case 12:
|
1225
|
-
initRes = _context2.sent;
|
1226
|
-
if (!result.isErr(initRes)) {
|
1227
|
-
_context2.next = 16;
|
1228
|
-
break;
|
1229
|
-
}
|
1230
|
-
console.error("Failed to initialize inside reset", initRes.error);
|
1231
|
-
return _context2.abrupt("return", result.err({
|
1232
|
-
errorType: "other",
|
1233
|
-
message: initRes.error.message
|
1234
|
-
}));
|
1235
|
-
case 16:
|
1236
|
-
if (!(treeRes.status === 200)) {
|
1237
|
-
_context2.next = 21;
|
1238
|
-
break;
|
1239
|
-
}
|
1240
|
-
for (_i2 = 0, _Object$keys2 = Object.keys(treeRes.json.modules); _i2 < _Object$keys2.length; _i2++) {
|
1241
|
-
pathS = _Object$keys2[_i2];
|
1242
|
-
path = pathS;
|
1243
|
-
this.drafts[path] = (_treeRes$json = treeRes.json) === null || _treeRes$json === void 0 || (_treeRes$json = _treeRes$json.modules) === null || _treeRes$json === void 0 || (_treeRes$json = _treeRes$json[path]) === null || _treeRes$json === void 0 ? void 0 : _treeRes$json.source;
|
1244
|
-
this.emitEvent(path, this.drafts[path]);
|
1245
|
-
}
|
1246
|
-
return _context2.abrupt("return", result.ok(undefined));
|
1247
|
-
case 21:
|
1248
|
-
if (!(treeRes.status === 400 && "type" in treeRes.json)) {
|
1249
|
-
_context2.next = 25;
|
1250
|
-
break;
|
1251
|
-
}
|
1252
|
-
return _context2.abrupt("return", result.err({
|
1253
|
-
errorType: "patch-error",
|
1254
|
-
errors: Object.entries(treeRes.json.errors).flatMap(function (_ref) {
|
1255
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
1256
|
-
moduleFilePath = _ref2[0],
|
1257
|
-
value = _ref2[1];
|
1258
|
-
return (value !== null && value !== void 0 ? value : []).map(function (item) {
|
1259
|
-
return {
|
1260
|
-
moduleFilePath: moduleFilePath,
|
1261
|
-
patchError: item.error.message,
|
1262
|
-
patchId: item.patchId,
|
1263
|
-
skipped: item.skipped
|
1264
|
-
};
|
1265
|
-
});
|
1266
|
-
})
|
1267
|
-
}));
|
1268
|
-
case 25:
|
1269
|
-
console.error("Val: failed to reset", treeRes.json);
|
1270
|
-
return _context2.abrupt("return", result.err({
|
1271
|
-
errorType: "other",
|
1272
|
-
message: "Failed to reset " + JSON.stringify(treeRes.json)
|
1273
|
-
}));
|
1274
|
-
case 27:
|
1275
|
-
case "end":
|
1276
|
-
return _context2.stop();
|
1277
|
-
}
|
1278
|
-
}, _callee2, this);
|
1279
|
-
}));
|
1280
|
-
function reset() {
|
1281
|
-
return _reset.apply(this, arguments);
|
1282
|
-
}
|
1283
|
-
return reset;
|
1284
|
-
}()
|
1285
|
-
}, {
|
1286
|
-
key: "getModule",
|
1287
|
-
value: function () {
|
1288
|
-
var _getModule = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(path) {
|
1289
|
-
var refetch,
|
1290
|
-
treeRes,
|
1291
|
-
_treeRes$json2,
|
1292
|
-
_treeRes$json3,
|
1293
|
-
fetchedSource,
|
1294
|
-
schema,
|
1295
|
-
_args3 = arguments;
|
1296
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
1297
|
-
while (1) switch (_context3.prev = _context3.next) {
|
1298
|
-
case 0:
|
1299
|
-
refetch = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
|
1300
|
-
if (!(!refetch && this.drafts[path] && this.schema[path])) {
|
1301
|
-
_context3.next = 3;
|
1302
|
-
break;
|
1303
|
-
}
|
1304
|
-
return _context3.abrupt("return", result.ok({
|
1305
|
-
source: this.drafts[path],
|
1306
|
-
schema: this.schema[path]
|
1307
|
-
}));
|
1308
|
-
case 3:
|
1309
|
-
_context3.next = 5;
|
1310
|
-
return this.client("/sources", "PUT", {
|
1311
|
-
path: path,
|
1312
|
-
body: {},
|
1313
|
-
query: {
|
1314
|
-
validate_sources: false,
|
1315
|
-
validate_all: false,
|
1316
|
-
validate_binary_files: false
|
1317
|
-
}
|
1318
|
-
});
|
1319
|
-
case 5:
|
1320
|
-
treeRes = _context3.sent;
|
1321
|
-
if (!(treeRes.status === 200)) {
|
1322
|
-
_context3.next = 26;
|
1323
|
-
break;
|
1324
|
-
}
|
1325
|
-
if ((_treeRes$json2 = treeRes.json) !== null && _treeRes$json2 !== void 0 && (_treeRes$json2 = _treeRes$json2.modules) !== null && _treeRes$json2 !== void 0 && _treeRes$json2[path]) {
|
1326
|
-
_context3.next = 10;
|
1327
|
-
break;
|
1328
|
-
}
|
1329
|
-
console.error("Val: could not find the module", {
|
1330
|
-
moduleIds: Object.keys(treeRes.json.modules),
|
1331
|
-
moduleId: path,
|
1332
|
-
data: treeRes
|
1333
|
-
});
|
1334
|
-
return _context3.abrupt("return", result.err({
|
1335
|
-
message: "Could not fetch data.\nCould not find the module:\n" + path + "\n\nVerify that the val.modules file includes this module."
|
1336
|
-
}));
|
1337
|
-
case 10:
|
1338
|
-
fetchedSource = (_treeRes$json3 = treeRes.json) === null || _treeRes$json3 === void 0 || (_treeRes$json3 = _treeRes$json3.modules) === null || _treeRes$json3 === void 0 || (_treeRes$json3 = _treeRes$json3[path]) === null || _treeRes$json3 === void 0 ? void 0 : _treeRes$json3.source;
|
1339
|
-
schema = this.schema[path];
|
1340
|
-
if (this.schema[path]) {
|
1341
|
-
_context3.next = 17;
|
1342
|
-
break;
|
1343
|
-
}
|
1344
|
-
_context3.next = 15;
|
1345
|
-
return this.initialize();
|
1346
|
-
case 15:
|
1347
|
-
if (this.schema[path]) {
|
1348
|
-
_context3.next = 17;
|
1349
|
-
break;
|
1350
|
-
}
|
1351
|
-
return _context3.abrupt("return", result.err({
|
1352
|
-
message: "Path not found in schema. Verify that the module exists."
|
1353
|
-
}));
|
1354
|
-
case 17:
|
1355
|
-
if (!(fetchedSource !== undefined)) {
|
1356
|
-
_context3.next = 22;
|
1357
|
-
break;
|
1358
|
-
}
|
1359
|
-
this.drafts[path] = fetchedSource;
|
1360
|
-
return _context3.abrupt("return", result.ok({
|
1361
|
-
source: fetchedSource,
|
1362
|
-
schema: schema
|
1363
|
-
}));
|
1364
|
-
case 22:
|
1365
|
-
console.error("Val: could not find the module source");
|
1366
|
-
return _context3.abrupt("return", result.err({
|
1367
|
-
message: "Could not fetch data. Verify that the module exists."
|
1368
|
-
}));
|
1369
|
-
case 24:
|
1370
|
-
_context3.next = 33;
|
1371
|
-
break;
|
1372
|
-
case 26:
|
1373
|
-
if (!(treeRes.status === 504)) {
|
1374
|
-
_context3.next = 31;
|
1375
|
-
break;
|
1376
|
-
}
|
1377
|
-
console.error("Val: timeout", treeRes.json);
|
1378
|
-
return _context3.abrupt("return", result.err({
|
1379
|
-
message: "Timed out while fetching data. Try again later."
|
1380
|
-
}));
|
1381
|
-
case 31:
|
1382
|
-
console.error("Val: failed to get module", treeRes.json);
|
1383
|
-
return _context3.abrupt("return", result.err({
|
1384
|
-
message: "Could not fetch data. Verify that is correctly configured."
|
1385
|
-
}));
|
1386
|
-
case 33:
|
1387
|
-
case "end":
|
1388
|
-
return _context3.stop();
|
1389
|
-
}
|
1390
|
-
}, _callee3, this);
|
1391
|
-
}));
|
1392
|
-
function getModule(_x2) {
|
1393
|
-
return _getModule.apply(this, arguments);
|
1394
|
-
}
|
1395
|
-
return getModule;
|
1396
|
-
}()
|
1397
|
-
}, {
|
1398
|
-
key: "deletePatches",
|
1399
|
-
value: function () {
|
1400
|
-
var _deletePatches = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(patchIds) {
|
1401
|
-
var patchesRes;
|
1402
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
1403
|
-
while (1) switch (_context4.prev = _context4.next) {
|
1404
|
-
case 0:
|
1405
|
-
_context4.next = 2;
|
1406
|
-
return this.client("/patches/~", "DELETE", {
|
1407
|
-
query: {
|
1408
|
-
id: patchIds
|
1409
|
-
}
|
1410
|
-
});
|
1411
|
-
case 2:
|
1412
|
-
patchesRes = _context4.sent;
|
1413
|
-
if (!(patchesRes.status === 200)) {
|
1414
|
-
_context4.next = 7;
|
1415
|
-
break;
|
1416
|
-
}
|
1417
|
-
return _context4.abrupt("return", result.ok(patchesRes.json));
|
1418
|
-
case 7:
|
1419
|
-
console.error("Val: failed to delete patches", patchesRes.json);
|
1420
|
-
return _context4.abrupt("return", result.err({
|
1421
|
-
message: patchesRes.json.message
|
1422
|
-
}));
|
1423
|
-
case 9:
|
1424
|
-
case "end":
|
1425
|
-
return _context4.stop();
|
1426
|
-
}
|
1427
|
-
}, _callee4, this);
|
1428
|
-
}));
|
1429
|
-
function deletePatches(_x3) {
|
1430
|
-
return _deletePatches.apply(this, arguments);
|
1431
|
-
}
|
1432
|
-
return deletePatches;
|
1433
|
-
}()
|
1434
|
-
}, {
|
1435
|
-
key: "applyPatch",
|
1436
|
-
value: function () {
|
1437
|
-
var _applyPatch = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(path, patchIds, patch) {
|
1438
|
-
var treeRes, _treeRes$json4, newPatchIds, newPatchId, fetchedSource, _treeRes$json5;
|
1439
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
1440
|
-
while (1) switch (_context5.prev = _context5.next) {
|
1441
|
-
case 0:
|
1442
|
-
_context5.next = 2;
|
1443
|
-
return this.client("/sources", "PUT", {
|
1444
|
-
path: path,
|
1445
|
-
query: {
|
1446
|
-
validate_sources: false,
|
1447
|
-
validate_all: false,
|
1448
|
-
validate_binary_files: false
|
1449
|
-
},
|
1450
|
-
body: {
|
1451
|
-
patchIds: patchIds,
|
1452
|
-
addPatches: [{
|
1453
|
-
path: path,
|
1454
|
-
patch: patch
|
1455
|
-
}]
|
1456
|
-
}
|
1457
|
-
});
|
1458
|
-
case 2:
|
1459
|
-
treeRes = _context5.sent;
|
1460
|
-
if (!(treeRes.status === 200)) {
|
1461
|
-
_context5.next = 20;
|
1462
|
-
break;
|
1463
|
-
}
|
1464
|
-
newPatchIds = treeRes.json.newPatchIds;
|
1465
|
-
if (newPatchIds) {
|
1466
|
-
_context5.next = 8;
|
1467
|
-
break;
|
1468
|
-
}
|
1469
|
-
console.error("Val: could create patch", treeRes);
|
1470
|
-
return _context5.abrupt("return", result.err({
|
1471
|
-
errorType: "other",
|
1472
|
-
message: "Val: could not create patch"
|
1473
|
-
}));
|
1474
|
-
case 8:
|
1475
|
-
newPatchId = newPatchIds[0];
|
1476
|
-
fetchedSource = (_treeRes$json4 = treeRes.json) === null || _treeRes$json4 === void 0 || (_treeRes$json4 = _treeRes$json4.modules) === null || _treeRes$json4 === void 0 || (_treeRes$json4 = _treeRes$json4[path]) === null || _treeRes$json4 === void 0 ? void 0 : _treeRes$json4.source;
|
1477
|
-
if (!(fetchedSource !== undefined)) {
|
1478
|
-
_context5.next = 16;
|
1479
|
-
break;
|
1480
|
-
}
|
1481
|
-
this.drafts[path] = fetchedSource;
|
1482
|
-
this.emitEvent(path, fetchedSource);
|
1483
|
-
return _context5.abrupt("return", result.ok({
|
1484
|
-
newPatchId: newPatchId,
|
1485
|
-
modules: _defineProperty({}, path, {
|
1486
|
-
patchIds: ((_treeRes$json5 = treeRes.json) === null || _treeRes$json5 === void 0 || (_treeRes$json5 = _treeRes$json5.modules) === null || _treeRes$json5 === void 0 || (_treeRes$json5 = _treeRes$json5[path]) === null || _treeRes$json5 === void 0 || (_treeRes$json5 = _treeRes$json5.patches) === null || _treeRes$json5 === void 0 ? void 0 : _treeRes$json5.applied) || []
|
1487
|
-
})
|
1488
|
-
}));
|
1489
|
-
case 16:
|
1490
|
-
console.error("Val: could not patch");
|
1491
|
-
return _context5.abrupt("return", result.err({
|
1492
|
-
errorType: "other",
|
1493
|
-
message: "Val: could not fetch data. Verify that the module exists."
|
1494
|
-
}));
|
1495
|
-
case 18:
|
1496
|
-
_context5.next = 26;
|
1497
|
-
break;
|
1498
|
-
case 20:
|
1499
|
-
if (!(treeRes.status === 400 && "type" in treeRes.json)) {
|
1500
|
-
_context5.next = 24;
|
1501
|
-
break;
|
1502
|
-
}
|
1503
|
-
return _context5.abrupt("return", result.err({
|
1504
|
-
errorType: "patch-error",
|
1505
|
-
errors: Object.entries(treeRes.json.errors).flatMap(function (_ref3) {
|
1506
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
1507
|
-
moduleFilePath = _ref4[0],
|
1508
|
-
value = _ref4[1];
|
1509
|
-
return (value !== null && value !== void 0 ? value : []).map(function (item) {
|
1510
|
-
return {
|
1511
|
-
moduleFilePath: moduleFilePath,
|
1512
|
-
patchError: item.error.message,
|
1513
|
-
patchId: item.patchId,
|
1514
|
-
skipped: item.skipped
|
1515
|
-
};
|
1516
|
-
});
|
1517
|
-
})
|
1518
|
-
}));
|
1519
|
-
case 24:
|
1520
|
-
console.error("Val: failed to get module", treeRes.json);
|
1521
|
-
return _context5.abrupt("return", result.err({
|
1522
|
-
errorType: "other",
|
1523
|
-
message: "Val: could not fetch data. Verify that is correctly configured."
|
1524
|
-
}));
|
1525
|
-
case 26:
|
1526
|
-
case "end":
|
1527
|
-
return _context5.stop();
|
1528
|
-
}
|
1529
|
-
}, _callee5, this);
|
1530
|
-
}));
|
1531
|
-
function applyPatch(_x4, _x5, _x6) {
|
1532
|
-
return _applyPatch.apply(this, arguments);
|
1533
|
-
}
|
1534
|
-
return applyPatch;
|
1535
|
-
}()
|
1536
|
-
}, {
|
1537
|
-
key: "emitEvent",
|
1538
|
-
value: function emitEvent(path, source) {
|
1539
|
-
var event = new CustomEvent("val-event", {
|
1540
|
-
detail: {
|
1541
|
-
type: "module-update",
|
1542
|
-
path: path,
|
1543
|
-
source: source
|
1544
|
-
}
|
1545
|
-
});
|
1546
|
-
window.dispatchEvent(event);
|
1547
|
-
}
|
1548
|
-
}, {
|
1549
|
-
key: "initialize",
|
1550
|
-
value: function () {
|
1551
|
-
var _initialize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
1552
|
-
var schemaRes, paths, _i3, _arr, moduleId, schema, msg;
|
1553
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
1554
|
-
while (1) switch (_context6.prev = _context6.next) {
|
1555
|
-
case 0:
|
1556
|
-
_context6.next = 2;
|
1557
|
-
return this.client("/schema", "GET", {});
|
1558
|
-
case 2:
|
1559
|
-
schemaRes = _context6.sent;
|
1560
|
-
if (!(schemaRes.status === 200)) {
|
1561
|
-
_context6.next = 9;
|
1562
|
-
break;
|
1563
|
-
}
|
1564
|
-
paths = [];
|
1565
|
-
for (_i3 = 0, _arr = Object.keys(schemaRes.json.schemas); _i3 < _arr.length; _i3++) {
|
1566
|
-
moduleId = _arr[_i3];
|
1567
|
-
schema = schemaRes.json.schemas[moduleId];
|
1568
|
-
if (schema) {
|
1569
|
-
paths.push(moduleId);
|
1570
|
-
this.schema[moduleId] = schema;
|
1571
|
-
}
|
1572
|
-
}
|
1573
|
-
return _context6.abrupt("return", result.ok(paths));
|
1574
|
-
case 9:
|
1575
|
-
msg = "Failed to fetch content. ";
|
1576
|
-
if (schemaRes.status === 401) {
|
1577
|
-
msg += "Authorization failed - check that you are logged in.";
|
1578
|
-
} else {
|
1579
|
-
msg += "Get a developer to verify that is correctly setup.";
|
1580
|
-
}
|
1581
|
-
return _context6.abrupt("return", result.err({
|
1582
|
-
message: msg,
|
1583
|
-
details: {
|
1584
|
-
fetchError: schemaRes.json
|
1585
|
-
}
|
1586
|
-
}));
|
1587
|
-
case 12:
|
1588
|
-
case "end":
|
1589
|
-
return _context6.stop();
|
1590
|
-
}
|
1591
|
-
}, _callee6, this);
|
1592
|
-
}));
|
1593
|
-
function initialize() {
|
1594
|
-
return _initialize.apply(this, arguments);
|
1595
|
-
}
|
1596
|
-
return initialize;
|
1597
|
-
}()
|
1598
|
-
}]);
|
1599
|
-
}();
|
1600
|
-
|
1601
1047
|
var JSONValueT = z.lazy(function () {
|
1602
1048
|
return z.union([z.string(), z.number(), z["boolean"](), z["null"](), z.array(JSONValueT), z.record(JSONValueT)]);
|
1603
1049
|
});
|
1050
|
+
|
1051
|
+
/**
|
1052
|
+
* Raw JSON patch operation.
|
1053
|
+
*/
|
1054
|
+
var OperationJSONT = z.discriminatedUnion("op", [z.object({
|
1055
|
+
op: z.literal("add"),
|
1056
|
+
path: z.string(),
|
1057
|
+
value: JSONValueT
|
1058
|
+
}).strict(), z.object({
|
1059
|
+
op: z.literal("remove"),
|
1060
|
+
/**
|
1061
|
+
* Must be non-root
|
1062
|
+
*/
|
1063
|
+
path: z.string()
|
1064
|
+
}).strict(), z.object({
|
1065
|
+
op: z.literal("replace"),
|
1066
|
+
path: z.string(),
|
1067
|
+
value: JSONValueT
|
1068
|
+
}).strict(), z.object({
|
1069
|
+
op: z.literal("move"),
|
1070
|
+
/**
|
1071
|
+
* Must be non-root and not a proper prefix of "path".
|
1072
|
+
*/
|
1073
|
+
from: z.string(),
|
1074
|
+
path: z.string()
|
1075
|
+
}).strict(), z.object({
|
1076
|
+
op: z.literal("copy"),
|
1077
|
+
from: z.string(),
|
1078
|
+
path: z.string()
|
1079
|
+
}).strict(), z.object({
|
1080
|
+
op: z.literal("test"),
|
1081
|
+
path: z.string(),
|
1082
|
+
value: JSONValueT
|
1083
|
+
}).strict(), z.object({
|
1084
|
+
op: z.literal("file"),
|
1085
|
+
path: z.string(),
|
1086
|
+
filePath: z.string(),
|
1087
|
+
value: z.string()
|
1088
|
+
}).strict()]);
|
1089
|
+
var PatchJSON = z.array(OperationJSONT);
|
1090
|
+
/**
|
1091
|
+
* Raw JSON patch operation.
|
1092
|
+
*/
|
1604
1093
|
var OperationT = z.discriminatedUnion("op", [z.object({
|
1605
1094
|
op: z.literal("add"),
|
1606
1095
|
path: z.array(z.string()),
|
@@ -1629,11 +1118,24 @@ var OperationT = z.discriminatedUnion("op", [z.object({
|
|
1629
1118
|
path: z.array(z.string()),
|
1630
1119
|
filePath: z.string(),
|
1631
1120
|
nestedFilePath: z.array(z.string()).optional(),
|
1632
|
-
value: z.
|
1633
|
-
sha256: z.string()
|
1634
|
-
})])
|
1121
|
+
value: z.string()
|
1635
1122
|
}).strict()]);
|
1636
1123
|
var Patch = z.array(OperationT);
|
1124
|
+
var PatchId = z.string().refine(function (_id) {
|
1125
|
+
return true;
|
1126
|
+
} // TODO: validation
|
1127
|
+
);
|
1128
|
+
var ParentRef$1 = z.union([z.object({
|
1129
|
+
type: z.literal("head"),
|
1130
|
+
headBaseSha: z.string()
|
1131
|
+
}), z.object({
|
1132
|
+
type: z.literal("patch"),
|
1133
|
+
patchId: PatchId
|
1134
|
+
})]);
|
1135
|
+
var PatchBlock = z.object({
|
1136
|
+
patch: Patch,
|
1137
|
+
parentRef: ParentRef$1
|
1138
|
+
});
|
1637
1139
|
|
1638
1140
|
var SourcePath = z.string().transform(function (path) {
|
1639
1141
|
return path;
|
@@ -1763,14 +1265,17 @@ var SerializedImageSchema = z.object({
|
|
1763
1265
|
});
|
1764
1266
|
var SerializedSchema = z.union([SerializedStringSchema, SerializedLiteralSchema, SerializedBooleanSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedArraySchema, SerializedUnionSchema, SerializedRichTextSchema, SerializedRecordSchema, SerializedKeyOfSchema, SerializedFileSchema, SerializedDateSchema, SerializedImageSchema]);
|
1765
1267
|
|
1766
|
-
var PatchId = z.string().refine(function (_id) {
|
1767
|
-
return true;
|
1768
|
-
} // TODO:
|
1769
|
-
);
|
1770
1268
|
var ModuleFilePath = z.string().refine(function (_path) {
|
1771
1269
|
return true;
|
1772
|
-
} // TODO:
|
1270
|
+
} // TODO: validation
|
1773
1271
|
);
|
1272
|
+
var ParentRef = z.union([z.object({
|
1273
|
+
type: z.literal("head"),
|
1274
|
+
headBaseSha: z.string()
|
1275
|
+
}), z.object({
|
1276
|
+
type: z.literal("patch"),
|
1277
|
+
patchId: PatchId
|
1278
|
+
})]);
|
1774
1279
|
var ValConfig = z.object({
|
1775
1280
|
project: z.string().optional(),
|
1776
1281
|
root: z.string().optional(),
|
@@ -1787,15 +1292,28 @@ var ValidationError = z.object({
|
|
1787
1292
|
fatal: z["boolean"]().optional(),
|
1788
1293
|
fixes: z.array(ValidationFixZ).optional()
|
1789
1294
|
});
|
1790
|
-
var
|
1295
|
+
var unauthorizedResponse = z.object({
|
1791
1296
|
status: z.literal(401),
|
1792
1297
|
json: z.object({
|
1793
1298
|
message: z.string()
|
1794
1299
|
})
|
1795
1300
|
});
|
1301
|
+
var notFoundResponse = z.object({
|
1302
|
+
status: z.literal(404),
|
1303
|
+
json: z.object({
|
1304
|
+
message: z.string()
|
1305
|
+
})
|
1306
|
+
});
|
1796
1307
|
var GenericError = z.object({
|
1797
1308
|
message: z.string()
|
1798
1309
|
});
|
1310
|
+
var GenericPatchError = z.union([z.object({
|
1311
|
+
patchId: PatchId,
|
1312
|
+
message: z.string()
|
1313
|
+
}), z.object({
|
1314
|
+
parentPatchId: z.string(),
|
1315
|
+
message: z.string()
|
1316
|
+
})]);
|
1799
1317
|
var ModulesError = z.object({
|
1800
1318
|
message: z.string(),
|
1801
1319
|
path: ModuleFilePath.optional()
|
@@ -2076,7 +1594,7 @@ var Api = {
|
|
2076
1594
|
})])
|
2077
1595
|
}
|
2078
1596
|
},
|
2079
|
-
"/patches
|
1597
|
+
"/patches": {
|
2080
1598
|
DELETE: {
|
2081
1599
|
req: {
|
2082
1600
|
query: {
|
@@ -2086,17 +1604,54 @@ var Api = {
|
|
2086
1604
|
val_session: z.string().optional()
|
2087
1605
|
}
|
2088
1606
|
},
|
2089
|
-
res: z.union([
|
1607
|
+
res: z.union([unauthorizedResponse, z.object({
|
2090
1608
|
status: z.literal(500),
|
2091
1609
|
json: z.object({
|
2092
1610
|
message: z.string(),
|
2093
|
-
|
1611
|
+
errors: z.array(GenericPatchError)
|
2094
1612
|
})
|
2095
1613
|
}), z.object({
|
2096
1614
|
status: z.literal(200),
|
2097
1615
|
json: z.array(PatchId)
|
2098
1616
|
})])
|
2099
1617
|
},
|
1618
|
+
PUT: {
|
1619
|
+
req: {
|
1620
|
+
body: z.object({
|
1621
|
+
parentRef: ParentRef,
|
1622
|
+
patches: z.array(z.object({
|
1623
|
+
path: ModuleFilePath,
|
1624
|
+
patch: Patch
|
1625
|
+
}))
|
1626
|
+
}),
|
1627
|
+
cookies: {
|
1628
|
+
val_session: z.string().optional()
|
1629
|
+
}
|
1630
|
+
},
|
1631
|
+
res: z.union([unauthorizedResponse, z.object({
|
1632
|
+
status: z.literal(409),
|
1633
|
+
// conflict: i.e. not a head of patches
|
1634
|
+
json: z.object({
|
1635
|
+
type: z.literal("patch-head-conflict"),
|
1636
|
+
message: z.string()
|
1637
|
+
})
|
1638
|
+
}), z.object({
|
1639
|
+
status: z.literal(400),
|
1640
|
+
json: z.object({
|
1641
|
+
type: z.literal("patch-error"),
|
1642
|
+
message: z.string(),
|
1643
|
+
errors: z.record(ModuleFilePath, z.array(z.object({
|
1644
|
+
error: GenericError
|
1645
|
+
})))
|
1646
|
+
})
|
1647
|
+
}), z.object({
|
1648
|
+
status: z.literal(200),
|
1649
|
+
json: z.object({
|
1650
|
+
newPatchIds: z.array(PatchId),
|
1651
|
+
parentRef: ParentRef
|
1652
|
+
})
|
1653
|
+
})])
|
1654
|
+
},
|
2100
1655
|
GET: {
|
2101
1656
|
req: {
|
2102
1657
|
query: {
|
@@ -2109,18 +1664,25 @@ var Api = {
|
|
2109
1664
|
val_session: z.string().optional()
|
2110
1665
|
}
|
2111
1666
|
},
|
2112
|
-
res: z.union([
|
1667
|
+
res: z.union([unauthorizedResponse, z.object({
|
2113
1668
|
status: z.literal(500),
|
2114
1669
|
json: z.object({
|
2115
1670
|
message: z.string(),
|
2116
|
-
|
1671
|
+
patchErrors: z.array(GenericPatchError)
|
1672
|
+
})
|
1673
|
+
}), z.object({
|
1674
|
+
status: z.literal(500),
|
1675
|
+
json: z.object({
|
1676
|
+
message: z.string(),
|
1677
|
+
error: GenericError
|
2117
1678
|
})
|
2118
1679
|
}), z.object({
|
2119
1680
|
status: z.literal(200),
|
2120
1681
|
json: z.object({
|
2121
|
-
patches: z.
|
1682
|
+
patches: z.array(z.object({
|
2122
1683
|
path: ModuleFilePath,
|
2123
1684
|
patch: Patch.optional(),
|
1685
|
+
patchId: PatchId,
|
2124
1686
|
createdAt: z.string(),
|
2125
1687
|
authorId: z.string().nullable(),
|
2126
1688
|
appliedAt: z.object({
|
@@ -2131,6 +1693,7 @@ var Api = {
|
|
2131
1693
|
timestamp: z.string()
|
2132
1694
|
}).nullable()
|
2133
1695
|
})),
|
1696
|
+
baseSha: z.string(),
|
2134
1697
|
error: GenericError.optional(),
|
2135
1698
|
errors: z.record(PatchId, GenericError).optional()
|
2136
1699
|
})
|
@@ -2144,7 +1707,7 @@ var Api = {
|
|
2144
1707
|
val_session: z.string().optional()
|
2145
1708
|
}
|
2146
1709
|
},
|
2147
|
-
res: z.union([
|
1710
|
+
res: z.union([unauthorizedResponse, z.object({
|
2148
1711
|
status: z.literal(500),
|
2149
1712
|
json: z.object({
|
2150
1713
|
message: z.string(),
|
@@ -2165,16 +1728,12 @@ var Api = {
|
|
2165
1728
|
})])
|
2166
1729
|
}
|
2167
1730
|
},
|
2168
|
-
"/sources": {
|
1731
|
+
"/sources/~": {
|
2169
1732
|
PUT: {
|
2170
1733
|
req: {
|
2171
1734
|
path: z.string().optional(),
|
2172
1735
|
body: z.object({
|
2173
|
-
patchIds: z.array(PatchId).optional()
|
2174
|
-
addPatches: z.array(z.object({
|
2175
|
-
path: ModuleFilePath,
|
2176
|
-
patch: Patch
|
2177
|
-
})).optional()
|
1736
|
+
patchIds: z.array(PatchId).optional()
|
2178
1737
|
}).optional(),
|
2179
1738
|
query: {
|
2180
1739
|
validate_all: z["boolean"]().optional(),
|
@@ -2185,13 +1744,9 @@ var Api = {
|
|
2185
1744
|
val_session: z.string().optional()
|
2186
1745
|
}
|
2187
1746
|
},
|
2188
|
-
res: z.union([
|
1747
|
+
res: z.union([unauthorizedResponse, z.object({
|
2189
1748
|
status: z.literal(401),
|
2190
1749
|
json: GenericError
|
2191
|
-
}), z.object({
|
2192
|
-
status: z.literal(409),
|
2193
|
-
// conflict: i.e. not a head of patches
|
2194
|
-
json: GenericError
|
2195
1750
|
}), z.object({
|
2196
1751
|
status: z.literal(500),
|
2197
1752
|
json: z.object({
|
@@ -2199,32 +1754,15 @@ var Api = {
|
|
2199
1754
|
details: z.union([z.array(ModulesError), GenericError])
|
2200
1755
|
})
|
2201
1756
|
}), z.object({
|
2202
|
-
status: z.literal(
|
1757
|
+
status: z.literal(409),
|
2203
1758
|
json: z.object({
|
2204
|
-
message: z.string()
|
2205
|
-
details: z.array(ModulesError)
|
1759
|
+
message: z.string()
|
2206
1760
|
})
|
2207
1761
|
}), z.object({
|
2208
1762
|
status: z.literal(400),
|
2209
1763
|
json: z.object({
|
2210
|
-
type: z.literal("patch-error"),
|
2211
1764
|
message: z.string(),
|
2212
|
-
|
2213
|
-
modules: z.record(ModuleFilePath, z.object({
|
2214
|
-
source: z.any(),
|
2215
|
-
//.optional(), // TODO: Json zod type
|
2216
|
-
patches: z.object({
|
2217
|
-
applied: z.array(PatchId),
|
2218
|
-
skipped: z.array(PatchId).optional(),
|
2219
|
-
errors: z.record(PatchId, GenericError).optional()
|
2220
|
-
}).optional(),
|
2221
|
-
validationErrors: z.record(SourcePath, z.array(ValidationError)).optional()
|
2222
|
-
})),
|
2223
|
-
errors: z.record(ModuleFilePath, z.array(z.object({
|
2224
|
-
patchId: PatchId,
|
2225
|
-
skipped: z["boolean"](),
|
2226
|
-
error: GenericError
|
2227
|
-
})))
|
1765
|
+
details: z.array(ModulesError)
|
2228
1766
|
})
|
2229
1767
|
}), z.object({
|
2230
1768
|
status: z.literal(200),
|
@@ -2239,12 +1777,32 @@ var Api = {
|
|
2239
1777
|
errors: z.record(PatchId, GenericError).optional()
|
2240
1778
|
}).optional(),
|
2241
1779
|
validationErrors: z.record(SourcePath, z.array(ValidationError)).optional()
|
2242
|
-
}))
|
2243
|
-
newPatchIds: z.array(PatchId).optional()
|
1780
|
+
}))
|
2244
1781
|
})
|
2245
1782
|
})])
|
2246
1783
|
}
|
2247
1784
|
},
|
1785
|
+
"/profiles": {
|
1786
|
+
GET: {
|
1787
|
+
req: {
|
1788
|
+
cookies: {
|
1789
|
+
val_session: z.string().optional()
|
1790
|
+
}
|
1791
|
+
},
|
1792
|
+
res: z.object({
|
1793
|
+
status: z.literal(200),
|
1794
|
+
json: z.object({
|
1795
|
+
profiles: z.array(z.object({
|
1796
|
+
profileId: z.string(),
|
1797
|
+
fullName: z.string(),
|
1798
|
+
avatar: z.object({
|
1799
|
+
url: z.string()
|
1800
|
+
}).nullable()
|
1801
|
+
}))
|
1802
|
+
})
|
1803
|
+
})
|
1804
|
+
}
|
1805
|
+
},
|
2248
1806
|
"/save": {
|
2249
1807
|
POST: {
|
2250
1808
|
req: {
|
@@ -2255,7 +1813,7 @@ var Api = {
|
|
2255
1813
|
val_session: z.string().optional()
|
2256
1814
|
}
|
2257
1815
|
},
|
2258
|
-
res: z.union([
|
1816
|
+
res: z.union([unauthorizedResponse, z.object({
|
2259
1817
|
status: z.literal(200),
|
2260
1818
|
json: z.object({}) // TODO:
|
2261
1819
|
}), z.object({
|
@@ -2284,14 +1842,9 @@ var Api = {
|
|
2284
1842
|
patch_id: PatchId.optional()
|
2285
1843
|
}
|
2286
1844
|
},
|
2287
|
-
res: z.union([z.object({
|
1845
|
+
res: z.union([unauthorizedResponse, notFoundResponse, z.object({
|
2288
1846
|
status: z.literal(200),
|
2289
1847
|
body: z["instanceof"](ReadableStream)
|
2290
|
-
}), z.object({
|
2291
|
-
status: z.literal(404),
|
2292
|
-
json: z.object({
|
2293
|
-
message: z.string()
|
2294
|
-
})
|
2295
1848
|
})])
|
2296
1849
|
}
|
2297
1850
|
}
|
@@ -2387,9 +1940,13 @@ var createValClient = function createValClient(host) {
|
|
2387
1940
|
case 7:
|
2388
1941
|
reqBodyResult = (_apiEndpoint$req$body = apiEndpoint.req.body) === null || _apiEndpoint$req$body === void 0 ? void 0 : _apiEndpoint$req$body.safeParse(anyReq.body);
|
2389
1942
|
if (!(reqBodyResult && !reqBodyResult.success)) {
|
2390
|
-
_context2.next =
|
1943
|
+
_context2.next = 11;
|
2391
1944
|
break;
|
2392
1945
|
}
|
1946
|
+
console.error("Invalid request body", {
|
1947
|
+
body: anyReq.body,
|
1948
|
+
error: reqBodyResult.error
|
1949
|
+
});
|
2393
1950
|
return _context2.abrupt("return", {
|
2394
1951
|
status: null,
|
2395
1952
|
json: {
|
@@ -2401,9 +1958,9 @@ var createValClient = function createValClient(host) {
|
|
2401
1958
|
}
|
2402
1959
|
}
|
2403
1960
|
});
|
2404
|
-
case
|
2405
|
-
_context2.prev =
|
2406
|
-
_context2.next =
|
1961
|
+
case 11:
|
1962
|
+
_context2.prev = 11;
|
1963
|
+
_context2.next = 14;
|
2407
1964
|
return fetch("".concat(host).concat(fullPath), {
|
2408
1965
|
method: method,
|
2409
1966
|
headers: {
|
@@ -2426,7 +1983,7 @@ var createValClient = function createValClient(host) {
|
|
2426
1983
|
status: null,
|
2427
1984
|
json: {
|
2428
1985
|
type: "client_side_validation_error",
|
2429
|
-
message: "Invalid
|
1986
|
+
message: "Invalid response (expected JSON, but got something else). This could be a result of mismatched Val versions or a transient error.",
|
2430
1987
|
details: {
|
2431
1988
|
validationError: "Invalid content type",
|
2432
1989
|
data: {
|
@@ -2489,12 +2046,12 @@ var createValClient = function createValClient(host) {
|
|
2489
2046
|
return _ref2.apply(this, arguments);
|
2490
2047
|
};
|
2491
2048
|
}());
|
2492
|
-
case
|
2049
|
+
case 14:
|
2493
2050
|
res = _context2.sent;
|
2494
2051
|
return _context2.abrupt("return", res);
|
2495
|
-
case
|
2496
|
-
_context2.prev =
|
2497
|
-
_context2.t0 = _context2["catch"](
|
2052
|
+
case 18:
|
2053
|
+
_context2.prev = 18;
|
2054
|
+
_context2.t0 = _context2["catch"](11);
|
2498
2055
|
return _context2.abrupt("return", {
|
2499
2056
|
status: null,
|
2500
2057
|
json: {
|
@@ -2504,11 +2061,11 @@ var createValClient = function createValClient(host) {
|
|
2504
2061
|
details: _context2.t0 instanceof Error ? _context2.t0.message : JSON.stringify(_context2.t0)
|
2505
2062
|
}
|
2506
2063
|
});
|
2507
|
-
case
|
2064
|
+
case 21:
|
2508
2065
|
case "end":
|
2509
2066
|
return _context2.stop();
|
2510
2067
|
}
|
2511
|
-
}, _callee2, null, [[
|
2068
|
+
}, _callee2, null, [[11, 18]]);
|
2512
2069
|
}));
|
2513
2070
|
return function (_x, _x2, _x3) {
|
2514
2071
|
return _ref.apply(this, arguments);
|
@@ -2530,6 +2087,46 @@ function isRetryable(error) {
|
|
2530
2087
|
return false;
|
2531
2088
|
}
|
2532
2089
|
|
2090
|
+
function _arrayWithHoles(r) {
|
2091
|
+
if (Array.isArray(r)) return r;
|
2092
|
+
}
|
2093
|
+
|
2094
|
+
function _iterableToArrayLimit(r, l) {
|
2095
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
2096
|
+
if (null != t) {
|
2097
|
+
var e,
|
2098
|
+
n,
|
2099
|
+
i,
|
2100
|
+
u,
|
2101
|
+
a = [],
|
2102
|
+
f = !0,
|
2103
|
+
o = !1;
|
2104
|
+
try {
|
2105
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
2106
|
+
if (Object(t) !== t) return;
|
2107
|
+
f = !1;
|
2108
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
2109
|
+
} catch (r) {
|
2110
|
+
o = !0, n = r;
|
2111
|
+
} finally {
|
2112
|
+
try {
|
2113
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
2114
|
+
} finally {
|
2115
|
+
if (o) throw n;
|
2116
|
+
}
|
2117
|
+
}
|
2118
|
+
return a;
|
2119
|
+
}
|
2120
|
+
}
|
2121
|
+
|
2122
|
+
function _nonIterableRest() {
|
2123
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
2124
|
+
}
|
2125
|
+
|
2126
|
+
function _slicedToArray(r, e) {
|
2127
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
2128
|
+
}
|
2129
|
+
|
2533
2130
|
var urlOf = function urlOf() {
|
2534
2131
|
var route = arguments.length <= 0 ? undefined : arguments[0];
|
2535
2132
|
var query = arguments.length <= 1 ? undefined : arguments[1];
|
@@ -2549,4 +2146,4 @@ var urlOf = function urlOf() {
|
|
2549
2146
|
return "".concat(route);
|
2550
2147
|
};
|
2551
2148
|
|
2552
|
-
export { Api, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, VAL_ENABLE_COOKIE_NAME, VAL_SESSION_COOKIE, VAL_STATE_COOKIE,
|
2149
|
+
export { Api, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, VAL_ENABLE_COOKIE_NAME, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, createValClient, remirrorToRichTextSource, richTextToRemirror, urlOf };
|