@scenid/react-formulator 0.5.0 → 0.5.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/index.cjs.js +143 -84
- package/dist/index.esm.js +143 -84
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -20279,90 +20279,149 @@ function requireCompiler () {
|
|
|
20279
20279
|
return compileTypeDefinition;
|
|
20280
20280
|
}()
|
|
20281
20281
|
}, {
|
|
20282
|
-
key: "
|
|
20282
|
+
key: "compileOptions",
|
|
20283
20283
|
value: function () {
|
|
20284
|
-
var
|
|
20285
|
-
var
|
|
20284
|
+
var _compileOptions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(options) {
|
|
20285
|
+
var res;
|
|
20286
20286
|
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
20287
20287
|
while (1) {
|
|
20288
20288
|
switch (_context9.prev = _context9.next) {
|
|
20289
|
+
case 0:
|
|
20290
|
+
if (!((0, _helpers.isObject)(options) && options.$ref !== undefined)) {
|
|
20291
|
+
_context9.next = 7;
|
|
20292
|
+
break;
|
|
20293
|
+
}
|
|
20294
|
+
|
|
20295
|
+
_context9.next = 3;
|
|
20296
|
+
return this.resolveRef(options.$ref);
|
|
20297
|
+
|
|
20298
|
+
case 3:
|
|
20299
|
+
res = _context9.sent;
|
|
20300
|
+
|
|
20301
|
+
if (!(0, _helpers.isObject)(res)) {
|
|
20302
|
+
_context9.next = 6;
|
|
20303
|
+
break;
|
|
20304
|
+
}
|
|
20305
|
+
|
|
20306
|
+
return _context9.abrupt("return", Object.keys(res));
|
|
20307
|
+
|
|
20308
|
+
case 6:
|
|
20309
|
+
return _context9.abrupt("return", res);
|
|
20310
|
+
|
|
20311
|
+
case 7:
|
|
20312
|
+
return _context9.abrupt("return", options);
|
|
20313
|
+
|
|
20314
|
+
case 8:
|
|
20315
|
+
case "end":
|
|
20316
|
+
return _context9.stop();
|
|
20317
|
+
}
|
|
20318
|
+
}
|
|
20319
|
+
}, _callee9, this);
|
|
20320
|
+
}));
|
|
20321
|
+
|
|
20322
|
+
function compileOptions(_x12) {
|
|
20323
|
+
return _compileOptions.apply(this, arguments);
|
|
20324
|
+
}
|
|
20325
|
+
|
|
20326
|
+
return compileOptions;
|
|
20327
|
+
}()
|
|
20328
|
+
}, {
|
|
20329
|
+
key: "compileField",
|
|
20330
|
+
value: function () {
|
|
20331
|
+
var _compileField = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(uncompiledField, name) {
|
|
20332
|
+
var field, prohibited, required, optional, type, defaultDef, options;
|
|
20333
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
20334
|
+
while (1) {
|
|
20335
|
+
switch (_context10.prev = _context10.next) {
|
|
20289
20336
|
case 0:
|
|
20290
20337
|
field = (0, _helpers.deepCopy)(uncompiledField);
|
|
20291
|
-
prohibited = field.prohibited, required = field.required, optional = field.optional, type = field.type, defaultDef = field["default"];
|
|
20338
|
+
prohibited = field.prohibited, required = field.required, optional = field.optional, type = field.type, defaultDef = field["default"], options = field.options;
|
|
20292
20339
|
|
|
20293
20340
|
if (!(type === undefined)) {
|
|
20294
|
-
|
|
20341
|
+
_context10.next = 4;
|
|
20295
20342
|
break;
|
|
20296
20343
|
}
|
|
20297
20344
|
|
|
20298
20345
|
throw new _Error.SchemaError("Field \"".concat(name, "\" is missing a type definition"));
|
|
20299
20346
|
|
|
20300
20347
|
case 4:
|
|
20301
|
-
|
|
20348
|
+
_context10.next = 6;
|
|
20302
20349
|
return this.compileTypeDefinition(type, name);
|
|
20303
20350
|
|
|
20304
20351
|
case 6:
|
|
20305
|
-
field.type =
|
|
20352
|
+
field.type = _context10.sent;
|
|
20306
20353
|
|
|
20307
20354
|
if (!(defaultDef !== undefined)) {
|
|
20308
|
-
|
|
20355
|
+
_context10.next = 11;
|
|
20309
20356
|
break;
|
|
20310
20357
|
}
|
|
20311
20358
|
|
|
20312
|
-
|
|
20359
|
+
_context10.next = 10;
|
|
20313
20360
|
return this.compileTypeDefinition(defaultDef, name);
|
|
20314
20361
|
|
|
20315
20362
|
case 10:
|
|
20316
|
-
field["default"] =
|
|
20363
|
+
field["default"] = _context10.sent;
|
|
20317
20364
|
|
|
20318
20365
|
case 11:
|
|
20319
|
-
if (!
|
|
20320
|
-
|
|
20366
|
+
if (!options) {
|
|
20367
|
+
_context10.next = 15;
|
|
20321
20368
|
break;
|
|
20322
20369
|
}
|
|
20323
20370
|
|
|
20324
|
-
|
|
20325
|
-
return this.
|
|
20371
|
+
_context10.next = 14;
|
|
20372
|
+
return this.compileOptions(options);
|
|
20326
20373
|
|
|
20327
20374
|
case 14:
|
|
20328
|
-
field.
|
|
20375
|
+
field.options = _context10.sent;
|
|
20329
20376
|
|
|
20330
20377
|
case 15:
|
|
20331
|
-
if (!(
|
|
20332
|
-
|
|
20378
|
+
if (!(prohibited !== undefined)) {
|
|
20379
|
+
_context10.next = 19;
|
|
20333
20380
|
break;
|
|
20334
20381
|
}
|
|
20335
20382
|
|
|
20336
|
-
|
|
20337
|
-
return this.compileRules(
|
|
20383
|
+
_context10.next = 18;
|
|
20384
|
+
return this.compileRules(prohibited, name);
|
|
20338
20385
|
|
|
20339
20386
|
case 18:
|
|
20340
|
-
field.
|
|
20387
|
+
field.prohibited = _context10.sent;
|
|
20341
20388
|
|
|
20342
20389
|
case 19:
|
|
20343
|
-
if (!(
|
|
20344
|
-
|
|
20390
|
+
if (!(required !== undefined)) {
|
|
20391
|
+
_context10.next = 23;
|
|
20345
20392
|
break;
|
|
20346
20393
|
}
|
|
20347
20394
|
|
|
20348
|
-
|
|
20349
|
-
return this.compileRules(
|
|
20395
|
+
_context10.next = 22;
|
|
20396
|
+
return this.compileRules(required, name);
|
|
20350
20397
|
|
|
20351
20398
|
case 22:
|
|
20352
|
-
field.
|
|
20399
|
+
field.required = _context10.sent;
|
|
20353
20400
|
|
|
20354
20401
|
case 23:
|
|
20355
|
-
|
|
20402
|
+
if (!(optional !== undefined)) {
|
|
20403
|
+
_context10.next = 27;
|
|
20404
|
+
break;
|
|
20405
|
+
}
|
|
20406
|
+
|
|
20407
|
+
_context10.next = 26;
|
|
20408
|
+
return this.compileRules(optional, name);
|
|
20409
|
+
|
|
20410
|
+
case 26:
|
|
20411
|
+
field.optional = _context10.sent;
|
|
20356
20412
|
|
|
20357
|
-
case
|
|
20413
|
+
case 27:
|
|
20414
|
+
return _context10.abrupt("return", field);
|
|
20415
|
+
|
|
20416
|
+
case 28:
|
|
20358
20417
|
case "end":
|
|
20359
|
-
return
|
|
20418
|
+
return _context10.stop();
|
|
20360
20419
|
}
|
|
20361
20420
|
}
|
|
20362
|
-
},
|
|
20421
|
+
}, _callee10, this);
|
|
20363
20422
|
}));
|
|
20364
20423
|
|
|
20365
|
-
function compileField(
|
|
20424
|
+
function compileField(_x13, _x14) {
|
|
20366
20425
|
return _compileField.apply(this, arguments);
|
|
20367
20426
|
}
|
|
20368
20427
|
|
|
@@ -20371,135 +20430,135 @@ function requireCompiler () {
|
|
|
20371
20430
|
}, {
|
|
20372
20431
|
key: "compileCatalog",
|
|
20373
20432
|
value: function () {
|
|
20374
|
-
var _compileCatalog = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
20433
|
+
var _compileCatalog = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(uncompiledCatalog) {
|
|
20375
20434
|
var _this2 = this;
|
|
20376
20435
|
|
|
20377
20436
|
var catalog, result;
|
|
20378
|
-
return _regenerator["default"].wrap(function
|
|
20437
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
20379
20438
|
while (1) {
|
|
20380
|
-
switch (
|
|
20439
|
+
switch (_context13.prev = _context13.next) {
|
|
20381
20440
|
case 0:
|
|
20382
20441
|
catalog = (0, _helpers.deepCopy)(uncompiledCatalog);
|
|
20383
20442
|
|
|
20384
20443
|
if ((0, _helpers.isObject)(catalog)) {
|
|
20385
|
-
|
|
20444
|
+
_context13.next = 3;
|
|
20386
20445
|
break;
|
|
20387
20446
|
}
|
|
20388
20447
|
|
|
20389
20448
|
throw new _Error.SchemaError("Invalid type of \"".concat((0, _typeof2["default"])(catalog), "\" for catalog."));
|
|
20390
20449
|
|
|
20391
20450
|
case 3:
|
|
20392
|
-
|
|
20451
|
+
_context13.next = 5;
|
|
20393
20452
|
return Promise.all(Object.entries(catalog).map( /*#__PURE__*/function () {
|
|
20394
|
-
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
20395
|
-
return _regenerator["default"].wrap(function
|
|
20453
|
+
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(e) {
|
|
20454
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
20396
20455
|
while (1) {
|
|
20397
|
-
switch (
|
|
20456
|
+
switch (_context12.prev = _context12.next) {
|
|
20398
20457
|
case 0:
|
|
20399
20458
|
if (!(0, _helpers.isObject)(e[1])) {
|
|
20400
|
-
|
|
20459
|
+
_context12.next = 2;
|
|
20401
20460
|
break;
|
|
20402
20461
|
}
|
|
20403
20462
|
|
|
20404
|
-
return
|
|
20463
|
+
return _context12.abrupt("return", (0, _defineProperty2["default"])({}, e[0], e[1]));
|
|
20405
20464
|
|
|
20406
20465
|
case 2:
|
|
20407
20466
|
if (Array.isArray(e[1])) {
|
|
20408
|
-
|
|
20467
|
+
_context12.next = 4;
|
|
20409
20468
|
break;
|
|
20410
20469
|
}
|
|
20411
20470
|
|
|
20412
20471
|
throw new _Error.SchemaError("Invalid type of \"".concat((0, _typeof2["default"])(e[1]), "\" for catalog at path \"").concat(e[0], "\"."));
|
|
20413
20472
|
|
|
20414
20473
|
case 4:
|
|
20415
|
-
|
|
20416
|
-
|
|
20417
|
-
|
|
20418
|
-
|
|
20474
|
+
_context12.t0 = _defineProperty2["default"];
|
|
20475
|
+
_context12.t1 = {};
|
|
20476
|
+
_context12.t2 = e[0];
|
|
20477
|
+
_context12.next = 9;
|
|
20419
20478
|
return Promise.all(e[1].map( /*#__PURE__*/function () {
|
|
20420
|
-
var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
20479
|
+
var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(ee) {
|
|
20421
20480
|
var res;
|
|
20422
|
-
return _regenerator["default"].wrap(function
|
|
20481
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
20423
20482
|
while (1) {
|
|
20424
|
-
switch (
|
|
20483
|
+
switch (_context11.prev = _context11.next) {
|
|
20425
20484
|
case 0:
|
|
20426
20485
|
if ((0, _helpers.isObject)(ee)) {
|
|
20427
|
-
|
|
20486
|
+
_context11.next = 2;
|
|
20428
20487
|
break;
|
|
20429
20488
|
}
|
|
20430
20489
|
|
|
20431
|
-
return
|
|
20490
|
+
return _context11.abrupt("return", ee);
|
|
20432
20491
|
|
|
20433
20492
|
case 2:
|
|
20434
20493
|
if (!(ee.$ref === undefined)) {
|
|
20435
|
-
|
|
20494
|
+
_context11.next = 4;
|
|
20436
20495
|
break;
|
|
20437
20496
|
}
|
|
20438
20497
|
|
|
20439
20498
|
throw new _Error.SchemaError("Objects inside a catalog Array need to define a $ref at path \"".concat(e[0], "\"."));
|
|
20440
20499
|
|
|
20441
20500
|
case 4:
|
|
20442
|
-
|
|
20501
|
+
_context11.next = 6;
|
|
20443
20502
|
return _this2.resolveRef(ee.$ref);
|
|
20444
20503
|
|
|
20445
20504
|
case 6:
|
|
20446
|
-
res =
|
|
20505
|
+
res = _context11.sent;
|
|
20447
20506
|
|
|
20448
20507
|
if (!(0, _helpers.isObject)(res)) {
|
|
20449
|
-
|
|
20508
|
+
_context11.next = 9;
|
|
20450
20509
|
break;
|
|
20451
20510
|
}
|
|
20452
20511
|
|
|
20453
|
-
return
|
|
20512
|
+
return _context11.abrupt("return", Object.keys(res));
|
|
20454
20513
|
|
|
20455
20514
|
case 9:
|
|
20456
|
-
return
|
|
20515
|
+
return _context11.abrupt("return", res);
|
|
20457
20516
|
|
|
20458
20517
|
case 10:
|
|
20459
20518
|
case "end":
|
|
20460
|
-
return
|
|
20519
|
+
return _context11.stop();
|
|
20461
20520
|
}
|
|
20462
20521
|
}
|
|
20463
|
-
},
|
|
20522
|
+
}, _callee11);
|
|
20464
20523
|
}));
|
|
20465
20524
|
|
|
20466
|
-
return function (
|
|
20525
|
+
return function (_x17) {
|
|
20467
20526
|
return _ref8.apply(this, arguments);
|
|
20468
20527
|
};
|
|
20469
20528
|
}()));
|
|
20470
20529
|
|
|
20471
20530
|
case 9:
|
|
20472
|
-
|
|
20473
|
-
return
|
|
20531
|
+
_context12.t3 = _context12.sent;
|
|
20532
|
+
return _context12.abrupt("return", (0, _context12.t0)(_context12.t1, _context12.t2, _context12.t3));
|
|
20474
20533
|
|
|
20475
20534
|
case 11:
|
|
20476
20535
|
case "end":
|
|
20477
|
-
return
|
|
20536
|
+
return _context12.stop();
|
|
20478
20537
|
}
|
|
20479
20538
|
}
|
|
20480
|
-
},
|
|
20539
|
+
}, _callee12);
|
|
20481
20540
|
}));
|
|
20482
20541
|
|
|
20483
|
-
return function (
|
|
20542
|
+
return function (_x16) {
|
|
20484
20543
|
return _ref6.apply(this, arguments);
|
|
20485
20544
|
};
|
|
20486
20545
|
}()));
|
|
20487
20546
|
|
|
20488
20547
|
case 5:
|
|
20489
|
-
result =
|
|
20490
|
-
return
|
|
20548
|
+
result = _context13.sent;
|
|
20549
|
+
return _context13.abrupt("return", result.reduce(function (l, r) {
|
|
20491
20550
|
return _objectSpread(_objectSpread({}, l), r);
|
|
20492
20551
|
}, {}));
|
|
20493
20552
|
|
|
20494
20553
|
case 7:
|
|
20495
20554
|
case "end":
|
|
20496
|
-
return
|
|
20555
|
+
return _context13.stop();
|
|
20497
20556
|
}
|
|
20498
20557
|
}
|
|
20499
|
-
},
|
|
20558
|
+
}, _callee13);
|
|
20500
20559
|
}));
|
|
20501
20560
|
|
|
20502
|
-
function compileCatalog(
|
|
20561
|
+
function compileCatalog(_x15) {
|
|
20503
20562
|
return _compileCatalog.apply(this, arguments);
|
|
20504
20563
|
}
|
|
20505
20564
|
|
|
@@ -20508,16 +20567,16 @@ function requireCompiler () {
|
|
|
20508
20567
|
}, {
|
|
20509
20568
|
key: "process",
|
|
20510
20569
|
value: function () {
|
|
20511
|
-
var _process = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
20570
|
+
var _process = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(schemaArg, resolver) {
|
|
20512
20571
|
var schema, catalog, properties, fieldNames, i, name, field;
|
|
20513
|
-
return _regenerator["default"].wrap(function
|
|
20572
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
20514
20573
|
while (1) {
|
|
20515
|
-
switch (
|
|
20574
|
+
switch (_context14.prev = _context14.next) {
|
|
20516
20575
|
case 0:
|
|
20517
20576
|
this.resolver = resolver;
|
|
20518
20577
|
|
|
20519
20578
|
if ((0, _helpers.isObject)(schemaArg)) {
|
|
20520
|
-
|
|
20579
|
+
_context14.next = 3;
|
|
20521
20580
|
break;
|
|
20522
20581
|
}
|
|
20523
20582
|
|
|
@@ -20530,15 +20589,15 @@ function requireCompiler () {
|
|
|
20530
20589
|
catalog = schema.catalog, properties = schema.properties;
|
|
20531
20590
|
|
|
20532
20591
|
if (!(catalog !== undefined)) {
|
|
20533
|
-
|
|
20592
|
+
_context14.next = 11;
|
|
20534
20593
|
break;
|
|
20535
20594
|
}
|
|
20536
20595
|
|
|
20537
|
-
|
|
20596
|
+
_context14.next = 10;
|
|
20538
20597
|
return this.compileCatalog(catalog);
|
|
20539
20598
|
|
|
20540
20599
|
case 10:
|
|
20541
|
-
schema.catalog =
|
|
20600
|
+
schema.catalog = _context14.sent;
|
|
20542
20601
|
|
|
20543
20602
|
case 11:
|
|
20544
20603
|
fieldNames = Object.keys(properties);
|
|
@@ -20546,35 +20605,35 @@ function requireCompiler () {
|
|
|
20546
20605
|
|
|
20547
20606
|
case 13:
|
|
20548
20607
|
if (!(i < fieldNames.length)) {
|
|
20549
|
-
|
|
20608
|
+
_context14.next = 22;
|
|
20550
20609
|
break;
|
|
20551
20610
|
}
|
|
20552
20611
|
|
|
20553
20612
|
name = fieldNames[i];
|
|
20554
20613
|
field = properties[name];
|
|
20555
|
-
|
|
20614
|
+
_context14.next = 18;
|
|
20556
20615
|
return this.compileField(field, name);
|
|
20557
20616
|
|
|
20558
20617
|
case 18:
|
|
20559
|
-
properties[name] =
|
|
20618
|
+
properties[name] = _context14.sent;
|
|
20560
20619
|
|
|
20561
20620
|
case 19:
|
|
20562
20621
|
i++;
|
|
20563
|
-
|
|
20622
|
+
_context14.next = 13;
|
|
20564
20623
|
break;
|
|
20565
20624
|
|
|
20566
20625
|
case 22:
|
|
20567
|
-
return
|
|
20626
|
+
return _context14.abrupt("return", schema);
|
|
20568
20627
|
|
|
20569
20628
|
case 23:
|
|
20570
20629
|
case "end":
|
|
20571
|
-
return
|
|
20630
|
+
return _context14.stop();
|
|
20572
20631
|
}
|
|
20573
20632
|
}
|
|
20574
|
-
},
|
|
20633
|
+
}, _callee14, this);
|
|
20575
20634
|
}));
|
|
20576
20635
|
|
|
20577
|
-
function process(
|
|
20636
|
+
function process(_x18, _x19) {
|
|
20578
20637
|
return _process.apply(this, arguments);
|
|
20579
20638
|
}
|
|
20580
20639
|
|
package/dist/index.esm.js
CHANGED
|
@@ -20211,90 +20211,149 @@ function requireCompiler () {
|
|
|
20211
20211
|
return compileTypeDefinition;
|
|
20212
20212
|
}()
|
|
20213
20213
|
}, {
|
|
20214
|
-
key: "
|
|
20214
|
+
key: "compileOptions",
|
|
20215
20215
|
value: function () {
|
|
20216
|
-
var
|
|
20217
|
-
var
|
|
20216
|
+
var _compileOptions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(options) {
|
|
20217
|
+
var res;
|
|
20218
20218
|
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
20219
20219
|
while (1) {
|
|
20220
20220
|
switch (_context9.prev = _context9.next) {
|
|
20221
|
+
case 0:
|
|
20222
|
+
if (!((0, _helpers.isObject)(options) && options.$ref !== undefined)) {
|
|
20223
|
+
_context9.next = 7;
|
|
20224
|
+
break;
|
|
20225
|
+
}
|
|
20226
|
+
|
|
20227
|
+
_context9.next = 3;
|
|
20228
|
+
return this.resolveRef(options.$ref);
|
|
20229
|
+
|
|
20230
|
+
case 3:
|
|
20231
|
+
res = _context9.sent;
|
|
20232
|
+
|
|
20233
|
+
if (!(0, _helpers.isObject)(res)) {
|
|
20234
|
+
_context9.next = 6;
|
|
20235
|
+
break;
|
|
20236
|
+
}
|
|
20237
|
+
|
|
20238
|
+
return _context9.abrupt("return", Object.keys(res));
|
|
20239
|
+
|
|
20240
|
+
case 6:
|
|
20241
|
+
return _context9.abrupt("return", res);
|
|
20242
|
+
|
|
20243
|
+
case 7:
|
|
20244
|
+
return _context9.abrupt("return", options);
|
|
20245
|
+
|
|
20246
|
+
case 8:
|
|
20247
|
+
case "end":
|
|
20248
|
+
return _context9.stop();
|
|
20249
|
+
}
|
|
20250
|
+
}
|
|
20251
|
+
}, _callee9, this);
|
|
20252
|
+
}));
|
|
20253
|
+
|
|
20254
|
+
function compileOptions(_x12) {
|
|
20255
|
+
return _compileOptions.apply(this, arguments);
|
|
20256
|
+
}
|
|
20257
|
+
|
|
20258
|
+
return compileOptions;
|
|
20259
|
+
}()
|
|
20260
|
+
}, {
|
|
20261
|
+
key: "compileField",
|
|
20262
|
+
value: function () {
|
|
20263
|
+
var _compileField = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(uncompiledField, name) {
|
|
20264
|
+
var field, prohibited, required, optional, type, defaultDef, options;
|
|
20265
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
20266
|
+
while (1) {
|
|
20267
|
+
switch (_context10.prev = _context10.next) {
|
|
20221
20268
|
case 0:
|
|
20222
20269
|
field = (0, _helpers.deepCopy)(uncompiledField);
|
|
20223
|
-
prohibited = field.prohibited, required = field.required, optional = field.optional, type = field.type, defaultDef = field["default"];
|
|
20270
|
+
prohibited = field.prohibited, required = field.required, optional = field.optional, type = field.type, defaultDef = field["default"], options = field.options;
|
|
20224
20271
|
|
|
20225
20272
|
if (!(type === undefined)) {
|
|
20226
|
-
|
|
20273
|
+
_context10.next = 4;
|
|
20227
20274
|
break;
|
|
20228
20275
|
}
|
|
20229
20276
|
|
|
20230
20277
|
throw new _Error.SchemaError("Field \"".concat(name, "\" is missing a type definition"));
|
|
20231
20278
|
|
|
20232
20279
|
case 4:
|
|
20233
|
-
|
|
20280
|
+
_context10.next = 6;
|
|
20234
20281
|
return this.compileTypeDefinition(type, name);
|
|
20235
20282
|
|
|
20236
20283
|
case 6:
|
|
20237
|
-
field.type =
|
|
20284
|
+
field.type = _context10.sent;
|
|
20238
20285
|
|
|
20239
20286
|
if (!(defaultDef !== undefined)) {
|
|
20240
|
-
|
|
20287
|
+
_context10.next = 11;
|
|
20241
20288
|
break;
|
|
20242
20289
|
}
|
|
20243
20290
|
|
|
20244
|
-
|
|
20291
|
+
_context10.next = 10;
|
|
20245
20292
|
return this.compileTypeDefinition(defaultDef, name);
|
|
20246
20293
|
|
|
20247
20294
|
case 10:
|
|
20248
|
-
field["default"] =
|
|
20295
|
+
field["default"] = _context10.sent;
|
|
20249
20296
|
|
|
20250
20297
|
case 11:
|
|
20251
|
-
if (!
|
|
20252
|
-
|
|
20298
|
+
if (!options) {
|
|
20299
|
+
_context10.next = 15;
|
|
20253
20300
|
break;
|
|
20254
20301
|
}
|
|
20255
20302
|
|
|
20256
|
-
|
|
20257
|
-
return this.
|
|
20303
|
+
_context10.next = 14;
|
|
20304
|
+
return this.compileOptions(options);
|
|
20258
20305
|
|
|
20259
20306
|
case 14:
|
|
20260
|
-
field.
|
|
20307
|
+
field.options = _context10.sent;
|
|
20261
20308
|
|
|
20262
20309
|
case 15:
|
|
20263
|
-
if (!(
|
|
20264
|
-
|
|
20310
|
+
if (!(prohibited !== undefined)) {
|
|
20311
|
+
_context10.next = 19;
|
|
20265
20312
|
break;
|
|
20266
20313
|
}
|
|
20267
20314
|
|
|
20268
|
-
|
|
20269
|
-
return this.compileRules(
|
|
20315
|
+
_context10.next = 18;
|
|
20316
|
+
return this.compileRules(prohibited, name);
|
|
20270
20317
|
|
|
20271
20318
|
case 18:
|
|
20272
|
-
field.
|
|
20319
|
+
field.prohibited = _context10.sent;
|
|
20273
20320
|
|
|
20274
20321
|
case 19:
|
|
20275
|
-
if (!(
|
|
20276
|
-
|
|
20322
|
+
if (!(required !== undefined)) {
|
|
20323
|
+
_context10.next = 23;
|
|
20277
20324
|
break;
|
|
20278
20325
|
}
|
|
20279
20326
|
|
|
20280
|
-
|
|
20281
|
-
return this.compileRules(
|
|
20327
|
+
_context10.next = 22;
|
|
20328
|
+
return this.compileRules(required, name);
|
|
20282
20329
|
|
|
20283
20330
|
case 22:
|
|
20284
|
-
field.
|
|
20331
|
+
field.required = _context10.sent;
|
|
20285
20332
|
|
|
20286
20333
|
case 23:
|
|
20287
|
-
|
|
20334
|
+
if (!(optional !== undefined)) {
|
|
20335
|
+
_context10.next = 27;
|
|
20336
|
+
break;
|
|
20337
|
+
}
|
|
20338
|
+
|
|
20339
|
+
_context10.next = 26;
|
|
20340
|
+
return this.compileRules(optional, name);
|
|
20341
|
+
|
|
20342
|
+
case 26:
|
|
20343
|
+
field.optional = _context10.sent;
|
|
20288
20344
|
|
|
20289
|
-
case
|
|
20345
|
+
case 27:
|
|
20346
|
+
return _context10.abrupt("return", field);
|
|
20347
|
+
|
|
20348
|
+
case 28:
|
|
20290
20349
|
case "end":
|
|
20291
|
-
return
|
|
20350
|
+
return _context10.stop();
|
|
20292
20351
|
}
|
|
20293
20352
|
}
|
|
20294
|
-
},
|
|
20353
|
+
}, _callee10, this);
|
|
20295
20354
|
}));
|
|
20296
20355
|
|
|
20297
|
-
function compileField(
|
|
20356
|
+
function compileField(_x13, _x14) {
|
|
20298
20357
|
return _compileField.apply(this, arguments);
|
|
20299
20358
|
}
|
|
20300
20359
|
|
|
@@ -20303,135 +20362,135 @@ function requireCompiler () {
|
|
|
20303
20362
|
}, {
|
|
20304
20363
|
key: "compileCatalog",
|
|
20305
20364
|
value: function () {
|
|
20306
|
-
var _compileCatalog = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
20365
|
+
var _compileCatalog = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(uncompiledCatalog) {
|
|
20307
20366
|
var _this2 = this;
|
|
20308
20367
|
|
|
20309
20368
|
var catalog, result;
|
|
20310
|
-
return _regenerator["default"].wrap(function
|
|
20369
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
20311
20370
|
while (1) {
|
|
20312
|
-
switch (
|
|
20371
|
+
switch (_context13.prev = _context13.next) {
|
|
20313
20372
|
case 0:
|
|
20314
20373
|
catalog = (0, _helpers.deepCopy)(uncompiledCatalog);
|
|
20315
20374
|
|
|
20316
20375
|
if ((0, _helpers.isObject)(catalog)) {
|
|
20317
|
-
|
|
20376
|
+
_context13.next = 3;
|
|
20318
20377
|
break;
|
|
20319
20378
|
}
|
|
20320
20379
|
|
|
20321
20380
|
throw new _Error.SchemaError("Invalid type of \"".concat((0, _typeof2["default"])(catalog), "\" for catalog."));
|
|
20322
20381
|
|
|
20323
20382
|
case 3:
|
|
20324
|
-
|
|
20383
|
+
_context13.next = 5;
|
|
20325
20384
|
return Promise.all(Object.entries(catalog).map( /*#__PURE__*/function () {
|
|
20326
|
-
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
20327
|
-
return _regenerator["default"].wrap(function
|
|
20385
|
+
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(e) {
|
|
20386
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
20328
20387
|
while (1) {
|
|
20329
|
-
switch (
|
|
20388
|
+
switch (_context12.prev = _context12.next) {
|
|
20330
20389
|
case 0:
|
|
20331
20390
|
if (!(0, _helpers.isObject)(e[1])) {
|
|
20332
|
-
|
|
20391
|
+
_context12.next = 2;
|
|
20333
20392
|
break;
|
|
20334
20393
|
}
|
|
20335
20394
|
|
|
20336
|
-
return
|
|
20395
|
+
return _context12.abrupt("return", (0, _defineProperty2["default"])({}, e[0], e[1]));
|
|
20337
20396
|
|
|
20338
20397
|
case 2:
|
|
20339
20398
|
if (Array.isArray(e[1])) {
|
|
20340
|
-
|
|
20399
|
+
_context12.next = 4;
|
|
20341
20400
|
break;
|
|
20342
20401
|
}
|
|
20343
20402
|
|
|
20344
20403
|
throw new _Error.SchemaError("Invalid type of \"".concat((0, _typeof2["default"])(e[1]), "\" for catalog at path \"").concat(e[0], "\"."));
|
|
20345
20404
|
|
|
20346
20405
|
case 4:
|
|
20347
|
-
|
|
20348
|
-
|
|
20349
|
-
|
|
20350
|
-
|
|
20406
|
+
_context12.t0 = _defineProperty2["default"];
|
|
20407
|
+
_context12.t1 = {};
|
|
20408
|
+
_context12.t2 = e[0];
|
|
20409
|
+
_context12.next = 9;
|
|
20351
20410
|
return Promise.all(e[1].map( /*#__PURE__*/function () {
|
|
20352
|
-
var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
20411
|
+
var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(ee) {
|
|
20353
20412
|
var res;
|
|
20354
|
-
return _regenerator["default"].wrap(function
|
|
20413
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
20355
20414
|
while (1) {
|
|
20356
|
-
switch (
|
|
20415
|
+
switch (_context11.prev = _context11.next) {
|
|
20357
20416
|
case 0:
|
|
20358
20417
|
if ((0, _helpers.isObject)(ee)) {
|
|
20359
|
-
|
|
20418
|
+
_context11.next = 2;
|
|
20360
20419
|
break;
|
|
20361
20420
|
}
|
|
20362
20421
|
|
|
20363
|
-
return
|
|
20422
|
+
return _context11.abrupt("return", ee);
|
|
20364
20423
|
|
|
20365
20424
|
case 2:
|
|
20366
20425
|
if (!(ee.$ref === undefined)) {
|
|
20367
|
-
|
|
20426
|
+
_context11.next = 4;
|
|
20368
20427
|
break;
|
|
20369
20428
|
}
|
|
20370
20429
|
|
|
20371
20430
|
throw new _Error.SchemaError("Objects inside a catalog Array need to define a $ref at path \"".concat(e[0], "\"."));
|
|
20372
20431
|
|
|
20373
20432
|
case 4:
|
|
20374
|
-
|
|
20433
|
+
_context11.next = 6;
|
|
20375
20434
|
return _this2.resolveRef(ee.$ref);
|
|
20376
20435
|
|
|
20377
20436
|
case 6:
|
|
20378
|
-
res =
|
|
20437
|
+
res = _context11.sent;
|
|
20379
20438
|
|
|
20380
20439
|
if (!(0, _helpers.isObject)(res)) {
|
|
20381
|
-
|
|
20440
|
+
_context11.next = 9;
|
|
20382
20441
|
break;
|
|
20383
20442
|
}
|
|
20384
20443
|
|
|
20385
|
-
return
|
|
20444
|
+
return _context11.abrupt("return", Object.keys(res));
|
|
20386
20445
|
|
|
20387
20446
|
case 9:
|
|
20388
|
-
return
|
|
20447
|
+
return _context11.abrupt("return", res);
|
|
20389
20448
|
|
|
20390
20449
|
case 10:
|
|
20391
20450
|
case "end":
|
|
20392
|
-
return
|
|
20451
|
+
return _context11.stop();
|
|
20393
20452
|
}
|
|
20394
20453
|
}
|
|
20395
|
-
},
|
|
20454
|
+
}, _callee11);
|
|
20396
20455
|
}));
|
|
20397
20456
|
|
|
20398
|
-
return function (
|
|
20457
|
+
return function (_x17) {
|
|
20399
20458
|
return _ref8.apply(this, arguments);
|
|
20400
20459
|
};
|
|
20401
20460
|
}()));
|
|
20402
20461
|
|
|
20403
20462
|
case 9:
|
|
20404
|
-
|
|
20405
|
-
return
|
|
20463
|
+
_context12.t3 = _context12.sent;
|
|
20464
|
+
return _context12.abrupt("return", (0, _context12.t0)(_context12.t1, _context12.t2, _context12.t3));
|
|
20406
20465
|
|
|
20407
20466
|
case 11:
|
|
20408
20467
|
case "end":
|
|
20409
|
-
return
|
|
20468
|
+
return _context12.stop();
|
|
20410
20469
|
}
|
|
20411
20470
|
}
|
|
20412
|
-
},
|
|
20471
|
+
}, _callee12);
|
|
20413
20472
|
}));
|
|
20414
20473
|
|
|
20415
|
-
return function (
|
|
20474
|
+
return function (_x16) {
|
|
20416
20475
|
return _ref6.apply(this, arguments);
|
|
20417
20476
|
};
|
|
20418
20477
|
}()));
|
|
20419
20478
|
|
|
20420
20479
|
case 5:
|
|
20421
|
-
result =
|
|
20422
|
-
return
|
|
20480
|
+
result = _context13.sent;
|
|
20481
|
+
return _context13.abrupt("return", result.reduce(function (l, r) {
|
|
20423
20482
|
return _objectSpread(_objectSpread({}, l), r);
|
|
20424
20483
|
}, {}));
|
|
20425
20484
|
|
|
20426
20485
|
case 7:
|
|
20427
20486
|
case "end":
|
|
20428
|
-
return
|
|
20487
|
+
return _context13.stop();
|
|
20429
20488
|
}
|
|
20430
20489
|
}
|
|
20431
|
-
},
|
|
20490
|
+
}, _callee13);
|
|
20432
20491
|
}));
|
|
20433
20492
|
|
|
20434
|
-
function compileCatalog(
|
|
20493
|
+
function compileCatalog(_x15) {
|
|
20435
20494
|
return _compileCatalog.apply(this, arguments);
|
|
20436
20495
|
}
|
|
20437
20496
|
|
|
@@ -20440,16 +20499,16 @@ function requireCompiler () {
|
|
|
20440
20499
|
}, {
|
|
20441
20500
|
key: "process",
|
|
20442
20501
|
value: function () {
|
|
20443
|
-
var _process = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
20502
|
+
var _process = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(schemaArg, resolver) {
|
|
20444
20503
|
var schema, catalog, properties, fieldNames, i, name, field;
|
|
20445
|
-
return _regenerator["default"].wrap(function
|
|
20504
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
20446
20505
|
while (1) {
|
|
20447
|
-
switch (
|
|
20506
|
+
switch (_context14.prev = _context14.next) {
|
|
20448
20507
|
case 0:
|
|
20449
20508
|
this.resolver = resolver;
|
|
20450
20509
|
|
|
20451
20510
|
if ((0, _helpers.isObject)(schemaArg)) {
|
|
20452
|
-
|
|
20511
|
+
_context14.next = 3;
|
|
20453
20512
|
break;
|
|
20454
20513
|
}
|
|
20455
20514
|
|
|
@@ -20462,15 +20521,15 @@ function requireCompiler () {
|
|
|
20462
20521
|
catalog = schema.catalog, properties = schema.properties;
|
|
20463
20522
|
|
|
20464
20523
|
if (!(catalog !== undefined)) {
|
|
20465
|
-
|
|
20524
|
+
_context14.next = 11;
|
|
20466
20525
|
break;
|
|
20467
20526
|
}
|
|
20468
20527
|
|
|
20469
|
-
|
|
20528
|
+
_context14.next = 10;
|
|
20470
20529
|
return this.compileCatalog(catalog);
|
|
20471
20530
|
|
|
20472
20531
|
case 10:
|
|
20473
|
-
schema.catalog =
|
|
20532
|
+
schema.catalog = _context14.sent;
|
|
20474
20533
|
|
|
20475
20534
|
case 11:
|
|
20476
20535
|
fieldNames = Object.keys(properties);
|
|
@@ -20478,35 +20537,35 @@ function requireCompiler () {
|
|
|
20478
20537
|
|
|
20479
20538
|
case 13:
|
|
20480
20539
|
if (!(i < fieldNames.length)) {
|
|
20481
|
-
|
|
20540
|
+
_context14.next = 22;
|
|
20482
20541
|
break;
|
|
20483
20542
|
}
|
|
20484
20543
|
|
|
20485
20544
|
name = fieldNames[i];
|
|
20486
20545
|
field = properties[name];
|
|
20487
|
-
|
|
20546
|
+
_context14.next = 18;
|
|
20488
20547
|
return this.compileField(field, name);
|
|
20489
20548
|
|
|
20490
20549
|
case 18:
|
|
20491
|
-
properties[name] =
|
|
20550
|
+
properties[name] = _context14.sent;
|
|
20492
20551
|
|
|
20493
20552
|
case 19:
|
|
20494
20553
|
i++;
|
|
20495
|
-
|
|
20554
|
+
_context14.next = 13;
|
|
20496
20555
|
break;
|
|
20497
20556
|
|
|
20498
20557
|
case 22:
|
|
20499
|
-
return
|
|
20558
|
+
return _context14.abrupt("return", schema);
|
|
20500
20559
|
|
|
20501
20560
|
case 23:
|
|
20502
20561
|
case "end":
|
|
20503
|
-
return
|
|
20562
|
+
return _context14.stop();
|
|
20504
20563
|
}
|
|
20505
20564
|
}
|
|
20506
|
-
},
|
|
20565
|
+
}, _callee14, this);
|
|
20507
20566
|
}));
|
|
20508
20567
|
|
|
20509
|
-
function process(
|
|
20568
|
+
function process(_x18, _x19) {
|
|
20510
20569
|
return _process.apply(this, arguments);
|
|
20511
20570
|
}
|
|
20512
20571
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scenid/react-formulator",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"repository": "https://dennykoch@bitbucket.org/scenid/react-formulator.git",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
47
47
|
"@rollup/plugin-node-resolve": "^13.2.1",
|
|
48
48
|
"@scenid/cloud-icons": "^2.6.0",
|
|
49
|
-
"@scenid/formulator": "^2.
|
|
49
|
+
"@scenid/formulator": "^2.2.0",
|
|
50
50
|
"@storybook/addon-actions": "^6.4.22",
|
|
51
51
|
"@storybook/addon-essentials": "^6.4.22",
|
|
52
52
|
"@storybook/addon-interactions": "^6.4.22",
|