yaml-flow 4.0.0 → 5.0.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/browser/board-livegraph-runtime.js +1453 -0
- package/browser/board-livegraph-runtime.js.map +1 -0
- package/browser/card-compute.js +36 -17
- package/browser/live-cards.js +848 -109
- package/browser/live-cards.schema.json +46 -21
- package/dist/board-livegraph-runtime/index.cjs +1448 -0
- package/dist/board-livegraph-runtime/index.cjs.map +1 -0
- package/dist/board-livegraph-runtime/index.d.cts +101 -0
- package/dist/board-livegraph-runtime/index.d.ts +101 -0
- package/dist/board-livegraph-runtime/index.js +1441 -0
- package/dist/board-livegraph-runtime/index.js.map +1 -0
- package/dist/card-compute/index.cjs +159 -44
- package/dist/card-compute/index.cjs.map +1 -1
- package/dist/card-compute/index.d.cts +36 -11
- package/dist/card-compute/index.d.ts +36 -11
- package/dist/card-compute/index.js +156 -44
- package/dist/card-compute/index.js.map +1 -1
- package/dist/cli/board-live-cards-cli.cjs +476 -105
- package/dist/cli/board-live-cards-cli.cjs.map +1 -1
- package/dist/cli/board-live-cards-cli.d.cts +8 -16
- package/dist/cli/board-live-cards-cli.d.ts +8 -16
- package/dist/cli/board-live-cards-cli.js +476 -106
- package/dist/cli/board-live-cards-cli.js.map +1 -1
- package/dist/continuous-event-graph/index.cjs +74 -33
- package/dist/continuous-event-graph/index.cjs.map +1 -1
- package/dist/continuous-event-graph/index.d.cts +7 -23
- package/dist/continuous-event-graph/index.d.ts +7 -23
- package/dist/continuous-event-graph/index.js +73 -32
- package/dist/continuous-event-graph/index.js.map +1 -1
- package/dist/index.cjs +1440 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.js +1434 -56
- package/dist/index.js.map +1 -1
- package/dist/journal-DRfJiheM.d.cts +28 -0
- package/dist/journal-NLYuqege.d.ts +28 -0
- package/dist/{journal-B_2JnBMF.d.ts → live-cards-bridge-Or7fdEJV.d.ts} +5 -32
- package/dist/{journal-BJDjWb5Q.d.cts → live-cards-bridge-vGJ6tMzN.d.cts} +5 -32
- package/dist/schedule-CMcZe5Ny.d.ts +21 -0
- package/dist/schedule-CiucyCan.d.cts +21 -0
- package/examples/browser/boards/portfolio-tracker/cards/holdings-table.json +1 -1
- package/examples/browser/boards/portfolio-tracker/cards/portfolio-form.json +3 -3
- package/examples/browser/boards/portfolio-tracker/cards/portfolio-value.json +1 -1
- package/examples/browser/boards/portfolio-tracker/cards/price-fetch.json +3 -3
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker-task-executor.cjs +96 -0
- package/examples/browser/boards/portfolio-tracker/portfolio-tracker.js +33 -5
- package/examples/browser/livecards-browser/index.html +37 -684
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/holdings-table.json +1 -1
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +3 -3
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +1 -1
- package/examples/cli/step-machine-cli/portfolio-tracker/cards/price-fetch.json +3 -3
- package/examples/cli/step-machine-cli/portfolio-tracker/handlers/update-holdings-cli.js +2 -2
- package/examples/example-board/board.yaml +23 -0
- package/examples/example-board/bootstrap_payload.json +1 -0
- package/examples/example-board/cards/card-chain-region-alert.json +39 -0
- package/examples/example-board/cards/card-chain-region-totals.json +26 -0
- package/examples/example-board/cards/card-chain-top-region.json +24 -0
- package/examples/example-board/cards/card-ex-actions.json +32 -0
- package/examples/example-board/cards/card-ex-chart.json +30 -0
- package/examples/example-board/cards/card-ex-filter.json +36 -0
- package/examples/example-board/cards/card-ex-filtered-by-preference.json +59 -0
- package/examples/example-board/cards/card-ex-form.json +91 -0
- package/examples/example-board/cards/card-ex-list.json +22 -0
- package/examples/example-board/cards/card-ex-markdown.json +17 -0
- package/examples/example-board/cards/card-ex-metric.json +19 -0
- package/examples/example-board/cards/card-ex-narrative.json +36 -0
- package/examples/example-board/cards/card-ex-source-http.json +28 -0
- package/examples/example-board/cards/card-ex-source.json +21 -0
- package/examples/example-board/cards/card-ex-status.json +35 -0
- package/examples/example-board/cards/card-ex-table.json +30 -0
- package/examples/example-board/cards/card-ex-todo.json +29 -0
- package/examples/example-board/demo-chat-handler.js +69 -0
- package/examples/example-board/demo-server.js +87 -0
- package/examples/example-board/demo-shell-browser.html +806 -0
- package/examples/example-board/demo-shell-with-server.html +280 -0
- package/examples/example-board/demo-shell.html +62 -0
- package/examples/example-board/demo-task-executor.js +255 -0
- package/examples/example-board/mock.db +15 -0
- package/examples/example-board/reusable-board-runtime-client.js +265 -0
- package/examples/example-board/reusable-runtime-artifacts-adapter.js +233 -0
- package/examples/example-board/reusable-server-runtime.js +1284 -0
- package/examples/index.html +16 -9
- package/examples/npm-libs/continuous-event-graph/live-cards-board.ts +17 -17
- package/examples/npm-libs/continuous-event-graph/live-portfolio-dashboard.ts +23 -23
- package/examples/step-machine-cli/portfolio-tracker/cards/holdings-table.json +1 -1
- package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-form.json +3 -3
- package/examples/step-machine-cli/portfolio-tracker/cards/portfolio-value.json +1 -1
- package/examples/step-machine-cli/portfolio-tracker/cards/price-fetch.json +1 -1
- package/examples/step-machine-cli/portfolio-tracker/portfolio-tracker-task-executor.cjs +96 -0
- package/package.json +16 -2
- package/schema/card-runtime.schema.json +25 -0
- package/schema/live-cards.schema.json +46 -21
- package/browser/ingest-board.js +0 -296
- package/examples/ingest.js +0 -733
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var addFormats = require('ajv-formats');
|
|
4
|
-
var crypto$1 = require('crypto');
|
|
5
4
|
var child_process = require('child_process');
|
|
6
|
-
var
|
|
5
|
+
var jsonata2 = require('jsonata');
|
|
7
6
|
|
|
8
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
8
|
|
|
10
9
|
var addFormats__default = /*#__PURE__*/_interopDefault(addFormats);
|
|
11
|
-
var
|
|
10
|
+
var jsonata2__default = /*#__PURE__*/_interopDefault(jsonata2);
|
|
12
11
|
|
|
13
12
|
var __create = Object.create;
|
|
14
13
|
var __defProp = Object.defineProperty;
|
|
@@ -6421,6 +6420,814 @@ var require_ajv = __commonJS({
|
|
|
6421
6420
|
}
|
|
6422
6421
|
});
|
|
6423
6422
|
|
|
6423
|
+
// node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js
|
|
6424
|
+
var require_dynamicAnchor = __commonJS({
|
|
6425
|
+
"node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js"(exports$1) {
|
|
6426
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6427
|
+
exports$1.dynamicAnchor = void 0;
|
|
6428
|
+
var codegen_1 = require_codegen();
|
|
6429
|
+
var names_1 = require_names();
|
|
6430
|
+
var compile_1 = require_compile();
|
|
6431
|
+
var ref_1 = require_ref();
|
|
6432
|
+
var def = {
|
|
6433
|
+
keyword: "$dynamicAnchor",
|
|
6434
|
+
schemaType: "string",
|
|
6435
|
+
code: (cxt) => dynamicAnchor(cxt, cxt.schema)
|
|
6436
|
+
};
|
|
6437
|
+
function dynamicAnchor(cxt, anchor) {
|
|
6438
|
+
const { gen, it } = cxt;
|
|
6439
|
+
it.schemaEnv.root.dynamicAnchors[anchor] = true;
|
|
6440
|
+
const v = (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`;
|
|
6441
|
+
const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt);
|
|
6442
|
+
gen.if((0, codegen_1._)`!${v}`, () => gen.assign(v, validate));
|
|
6443
|
+
}
|
|
6444
|
+
exports$1.dynamicAnchor = dynamicAnchor;
|
|
6445
|
+
function _getValidate(cxt) {
|
|
6446
|
+
const { schemaEnv, schema, self } = cxt.it;
|
|
6447
|
+
const { root, baseId, localRefs, meta } = schemaEnv.root;
|
|
6448
|
+
const { schemaId } = self.opts;
|
|
6449
|
+
const sch = new compile_1.SchemaEnv({ schema, schemaId, root, baseId, localRefs, meta });
|
|
6450
|
+
compile_1.compileSchema.call(self, sch);
|
|
6451
|
+
return (0, ref_1.getValidate)(cxt, sch);
|
|
6452
|
+
}
|
|
6453
|
+
exports$1.default = def;
|
|
6454
|
+
}
|
|
6455
|
+
});
|
|
6456
|
+
|
|
6457
|
+
// node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js
|
|
6458
|
+
var require_dynamicRef = __commonJS({
|
|
6459
|
+
"node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js"(exports$1) {
|
|
6460
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6461
|
+
exports$1.dynamicRef = void 0;
|
|
6462
|
+
var codegen_1 = require_codegen();
|
|
6463
|
+
var names_1 = require_names();
|
|
6464
|
+
var ref_1 = require_ref();
|
|
6465
|
+
var def = {
|
|
6466
|
+
keyword: "$dynamicRef",
|
|
6467
|
+
schemaType: "string",
|
|
6468
|
+
code: (cxt) => dynamicRef(cxt, cxt.schema)
|
|
6469
|
+
};
|
|
6470
|
+
function dynamicRef(cxt, ref) {
|
|
6471
|
+
const { gen, keyword, it } = cxt;
|
|
6472
|
+
if (ref[0] !== "#")
|
|
6473
|
+
throw new Error(`"${keyword}" only supports hash fragment reference`);
|
|
6474
|
+
const anchor = ref.slice(1);
|
|
6475
|
+
if (it.allErrors) {
|
|
6476
|
+
_dynamicRef();
|
|
6477
|
+
} else {
|
|
6478
|
+
const valid = gen.let("valid", false);
|
|
6479
|
+
_dynamicRef(valid);
|
|
6480
|
+
cxt.ok(valid);
|
|
6481
|
+
}
|
|
6482
|
+
function _dynamicRef(valid) {
|
|
6483
|
+
if (it.schemaEnv.root.dynamicAnchors[anchor]) {
|
|
6484
|
+
const v = gen.let("_v", (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`);
|
|
6485
|
+
gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid));
|
|
6486
|
+
} else {
|
|
6487
|
+
_callRef(it.validateName, valid)();
|
|
6488
|
+
}
|
|
6489
|
+
}
|
|
6490
|
+
function _callRef(validate, valid) {
|
|
6491
|
+
return valid ? () => gen.block(() => {
|
|
6492
|
+
(0, ref_1.callRef)(cxt, validate);
|
|
6493
|
+
gen.let(valid, true);
|
|
6494
|
+
}) : () => (0, ref_1.callRef)(cxt, validate);
|
|
6495
|
+
}
|
|
6496
|
+
}
|
|
6497
|
+
exports$1.dynamicRef = dynamicRef;
|
|
6498
|
+
exports$1.default = def;
|
|
6499
|
+
}
|
|
6500
|
+
});
|
|
6501
|
+
|
|
6502
|
+
// node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js
|
|
6503
|
+
var require_recursiveAnchor = __commonJS({
|
|
6504
|
+
"node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js"(exports$1) {
|
|
6505
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6506
|
+
var dynamicAnchor_1 = require_dynamicAnchor();
|
|
6507
|
+
var util_1 = require_util();
|
|
6508
|
+
var def = {
|
|
6509
|
+
keyword: "$recursiveAnchor",
|
|
6510
|
+
schemaType: "boolean",
|
|
6511
|
+
code(cxt) {
|
|
6512
|
+
if (cxt.schema)
|
|
6513
|
+
(0, dynamicAnchor_1.dynamicAnchor)(cxt, "");
|
|
6514
|
+
else
|
|
6515
|
+
(0, util_1.checkStrictMode)(cxt.it, "$recursiveAnchor: false is ignored");
|
|
6516
|
+
}
|
|
6517
|
+
};
|
|
6518
|
+
exports$1.default = def;
|
|
6519
|
+
}
|
|
6520
|
+
});
|
|
6521
|
+
|
|
6522
|
+
// node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js
|
|
6523
|
+
var require_recursiveRef = __commonJS({
|
|
6524
|
+
"node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js"(exports$1) {
|
|
6525
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6526
|
+
var dynamicRef_1 = require_dynamicRef();
|
|
6527
|
+
var def = {
|
|
6528
|
+
keyword: "$recursiveRef",
|
|
6529
|
+
schemaType: "string",
|
|
6530
|
+
code: (cxt) => (0, dynamicRef_1.dynamicRef)(cxt, cxt.schema)
|
|
6531
|
+
};
|
|
6532
|
+
exports$1.default = def;
|
|
6533
|
+
}
|
|
6534
|
+
});
|
|
6535
|
+
|
|
6536
|
+
// node_modules/ajv/dist/vocabularies/dynamic/index.js
|
|
6537
|
+
var require_dynamic = __commonJS({
|
|
6538
|
+
"node_modules/ajv/dist/vocabularies/dynamic/index.js"(exports$1) {
|
|
6539
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6540
|
+
var dynamicAnchor_1 = require_dynamicAnchor();
|
|
6541
|
+
var dynamicRef_1 = require_dynamicRef();
|
|
6542
|
+
var recursiveAnchor_1 = require_recursiveAnchor();
|
|
6543
|
+
var recursiveRef_1 = require_recursiveRef();
|
|
6544
|
+
var dynamic = [dynamicAnchor_1.default, dynamicRef_1.default, recursiveAnchor_1.default, recursiveRef_1.default];
|
|
6545
|
+
exports$1.default = dynamic;
|
|
6546
|
+
}
|
|
6547
|
+
});
|
|
6548
|
+
|
|
6549
|
+
// node_modules/ajv/dist/vocabularies/validation/dependentRequired.js
|
|
6550
|
+
var require_dependentRequired = __commonJS({
|
|
6551
|
+
"node_modules/ajv/dist/vocabularies/validation/dependentRequired.js"(exports$1) {
|
|
6552
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6553
|
+
var dependencies_1 = require_dependencies();
|
|
6554
|
+
var def = {
|
|
6555
|
+
keyword: "dependentRequired",
|
|
6556
|
+
type: "object",
|
|
6557
|
+
schemaType: "object",
|
|
6558
|
+
error: dependencies_1.error,
|
|
6559
|
+
code: (cxt) => (0, dependencies_1.validatePropertyDeps)(cxt)
|
|
6560
|
+
};
|
|
6561
|
+
exports$1.default = def;
|
|
6562
|
+
}
|
|
6563
|
+
});
|
|
6564
|
+
|
|
6565
|
+
// node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js
|
|
6566
|
+
var require_dependentSchemas = __commonJS({
|
|
6567
|
+
"node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js"(exports$1) {
|
|
6568
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6569
|
+
var dependencies_1 = require_dependencies();
|
|
6570
|
+
var def = {
|
|
6571
|
+
keyword: "dependentSchemas",
|
|
6572
|
+
type: "object",
|
|
6573
|
+
schemaType: "object",
|
|
6574
|
+
code: (cxt) => (0, dependencies_1.validateSchemaDeps)(cxt)
|
|
6575
|
+
};
|
|
6576
|
+
exports$1.default = def;
|
|
6577
|
+
}
|
|
6578
|
+
});
|
|
6579
|
+
|
|
6580
|
+
// node_modules/ajv/dist/vocabularies/validation/limitContains.js
|
|
6581
|
+
var require_limitContains = __commonJS({
|
|
6582
|
+
"node_modules/ajv/dist/vocabularies/validation/limitContains.js"(exports$1) {
|
|
6583
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6584
|
+
var util_1 = require_util();
|
|
6585
|
+
var def = {
|
|
6586
|
+
keyword: ["maxContains", "minContains"],
|
|
6587
|
+
type: "array",
|
|
6588
|
+
schemaType: "number",
|
|
6589
|
+
code({ keyword, parentSchema, it }) {
|
|
6590
|
+
if (parentSchema.contains === void 0) {
|
|
6591
|
+
(0, util_1.checkStrictMode)(it, `"${keyword}" without "contains" is ignored`);
|
|
6592
|
+
}
|
|
6593
|
+
}
|
|
6594
|
+
};
|
|
6595
|
+
exports$1.default = def;
|
|
6596
|
+
}
|
|
6597
|
+
});
|
|
6598
|
+
|
|
6599
|
+
// node_modules/ajv/dist/vocabularies/next.js
|
|
6600
|
+
var require_next = __commonJS({
|
|
6601
|
+
"node_modules/ajv/dist/vocabularies/next.js"(exports$1) {
|
|
6602
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6603
|
+
var dependentRequired_1 = require_dependentRequired();
|
|
6604
|
+
var dependentSchemas_1 = require_dependentSchemas();
|
|
6605
|
+
var limitContains_1 = require_limitContains();
|
|
6606
|
+
var next2 = [dependentRequired_1.default, dependentSchemas_1.default, limitContains_1.default];
|
|
6607
|
+
exports$1.default = next2;
|
|
6608
|
+
}
|
|
6609
|
+
});
|
|
6610
|
+
|
|
6611
|
+
// node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js
|
|
6612
|
+
var require_unevaluatedProperties = __commonJS({
|
|
6613
|
+
"node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js"(exports$1) {
|
|
6614
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6615
|
+
var codegen_1 = require_codegen();
|
|
6616
|
+
var util_1 = require_util();
|
|
6617
|
+
var names_1 = require_names();
|
|
6618
|
+
var error = {
|
|
6619
|
+
message: "must NOT have unevaluated properties",
|
|
6620
|
+
params: ({ params }) => (0, codegen_1._)`{unevaluatedProperty: ${params.unevaluatedProperty}}`
|
|
6621
|
+
};
|
|
6622
|
+
var def = {
|
|
6623
|
+
keyword: "unevaluatedProperties",
|
|
6624
|
+
type: "object",
|
|
6625
|
+
schemaType: ["boolean", "object"],
|
|
6626
|
+
trackErrors: true,
|
|
6627
|
+
error,
|
|
6628
|
+
code(cxt) {
|
|
6629
|
+
const { gen, schema, data, errsCount, it } = cxt;
|
|
6630
|
+
if (!errsCount)
|
|
6631
|
+
throw new Error("ajv implementation error");
|
|
6632
|
+
const { allErrors, props } = it;
|
|
6633
|
+
if (props instanceof codegen_1.Name) {
|
|
6634
|
+
gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key))));
|
|
6635
|
+
} else if (props !== true) {
|
|
6636
|
+
gen.forIn("key", data, (key) => props === void 0 ? unevaluatedPropCode(key) : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key)));
|
|
6637
|
+
}
|
|
6638
|
+
it.props = true;
|
|
6639
|
+
cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
|
|
6640
|
+
function unevaluatedPropCode(key) {
|
|
6641
|
+
if (schema === false) {
|
|
6642
|
+
cxt.setParams({ unevaluatedProperty: key });
|
|
6643
|
+
cxt.error();
|
|
6644
|
+
if (!allErrors)
|
|
6645
|
+
gen.break();
|
|
6646
|
+
return;
|
|
6647
|
+
}
|
|
6648
|
+
if (!(0, util_1.alwaysValidSchema)(it, schema)) {
|
|
6649
|
+
const valid = gen.name("valid");
|
|
6650
|
+
cxt.subschema({
|
|
6651
|
+
keyword: "unevaluatedProperties",
|
|
6652
|
+
dataProp: key,
|
|
6653
|
+
dataPropType: util_1.Type.Str
|
|
6654
|
+
}, valid);
|
|
6655
|
+
if (!allErrors)
|
|
6656
|
+
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
6657
|
+
}
|
|
6658
|
+
}
|
|
6659
|
+
function unevaluatedDynamic(evaluatedProps, key) {
|
|
6660
|
+
return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key}]`;
|
|
6661
|
+
}
|
|
6662
|
+
function unevaluatedStatic(evaluatedProps, key) {
|
|
6663
|
+
const ps = [];
|
|
6664
|
+
for (const p in evaluatedProps) {
|
|
6665
|
+
if (evaluatedProps[p] === true)
|
|
6666
|
+
ps.push((0, codegen_1._)`${key} !== ${p}`);
|
|
6667
|
+
}
|
|
6668
|
+
return (0, codegen_1.and)(...ps);
|
|
6669
|
+
}
|
|
6670
|
+
}
|
|
6671
|
+
};
|
|
6672
|
+
exports$1.default = def;
|
|
6673
|
+
}
|
|
6674
|
+
});
|
|
6675
|
+
|
|
6676
|
+
// node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js
|
|
6677
|
+
var require_unevaluatedItems = __commonJS({
|
|
6678
|
+
"node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js"(exports$1) {
|
|
6679
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6680
|
+
var codegen_1 = require_codegen();
|
|
6681
|
+
var util_1 = require_util();
|
|
6682
|
+
var error = {
|
|
6683
|
+
message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
|
|
6684
|
+
params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
|
|
6685
|
+
};
|
|
6686
|
+
var def = {
|
|
6687
|
+
keyword: "unevaluatedItems",
|
|
6688
|
+
type: "array",
|
|
6689
|
+
schemaType: ["boolean", "object"],
|
|
6690
|
+
error,
|
|
6691
|
+
code(cxt) {
|
|
6692
|
+
const { gen, schema, data, it } = cxt;
|
|
6693
|
+
const items = it.items || 0;
|
|
6694
|
+
if (items === true)
|
|
6695
|
+
return;
|
|
6696
|
+
const len = gen.const("len", (0, codegen_1._)`${data}.length`);
|
|
6697
|
+
if (schema === false) {
|
|
6698
|
+
cxt.setParams({ len: items });
|
|
6699
|
+
cxt.fail((0, codegen_1._)`${len} > ${items}`);
|
|
6700
|
+
} else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
|
|
6701
|
+
const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items}`);
|
|
6702
|
+
gen.if((0, codegen_1.not)(valid), () => validateItems(valid, items));
|
|
6703
|
+
cxt.ok(valid);
|
|
6704
|
+
}
|
|
6705
|
+
it.items = true;
|
|
6706
|
+
function validateItems(valid, from) {
|
|
6707
|
+
gen.forRange("i", from, len, (i) => {
|
|
6708
|
+
cxt.subschema({ keyword: "unevaluatedItems", dataProp: i, dataPropType: util_1.Type.Num }, valid);
|
|
6709
|
+
if (!it.allErrors)
|
|
6710
|
+
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
6711
|
+
});
|
|
6712
|
+
}
|
|
6713
|
+
}
|
|
6714
|
+
};
|
|
6715
|
+
exports$1.default = def;
|
|
6716
|
+
}
|
|
6717
|
+
});
|
|
6718
|
+
|
|
6719
|
+
// node_modules/ajv/dist/vocabularies/unevaluated/index.js
|
|
6720
|
+
var require_unevaluated = __commonJS({
|
|
6721
|
+
"node_modules/ajv/dist/vocabularies/unevaluated/index.js"(exports$1) {
|
|
6722
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6723
|
+
var unevaluatedProperties_1 = require_unevaluatedProperties();
|
|
6724
|
+
var unevaluatedItems_1 = require_unevaluatedItems();
|
|
6725
|
+
var unevaluated = [unevaluatedProperties_1.default, unevaluatedItems_1.default];
|
|
6726
|
+
exports$1.default = unevaluated;
|
|
6727
|
+
}
|
|
6728
|
+
});
|
|
6729
|
+
|
|
6730
|
+
// node_modules/ajv/dist/vocabularies/draft2020.js
|
|
6731
|
+
var require_draft2020 = __commonJS({
|
|
6732
|
+
"node_modules/ajv/dist/vocabularies/draft2020.js"(exports$1) {
|
|
6733
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6734
|
+
var core_1 = require_core2();
|
|
6735
|
+
var validation_1 = require_validation();
|
|
6736
|
+
var applicator_1 = require_applicator();
|
|
6737
|
+
var dynamic_1 = require_dynamic();
|
|
6738
|
+
var next_1 = require_next();
|
|
6739
|
+
var unevaluated_1 = require_unevaluated();
|
|
6740
|
+
var format_1 = require_format2();
|
|
6741
|
+
var metadata_1 = require_metadata();
|
|
6742
|
+
var draft2020Vocabularies = [
|
|
6743
|
+
dynamic_1.default,
|
|
6744
|
+
core_1.default,
|
|
6745
|
+
validation_1.default,
|
|
6746
|
+
(0, applicator_1.default)(true),
|
|
6747
|
+
format_1.default,
|
|
6748
|
+
metadata_1.metadataVocabulary,
|
|
6749
|
+
metadata_1.contentVocabulary,
|
|
6750
|
+
next_1.default,
|
|
6751
|
+
unevaluated_1.default
|
|
6752
|
+
];
|
|
6753
|
+
exports$1.default = draft2020Vocabularies;
|
|
6754
|
+
}
|
|
6755
|
+
});
|
|
6756
|
+
|
|
6757
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/schema.json
|
|
6758
|
+
var require_schema = __commonJS({
|
|
6759
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/schema.json"(exports$1, module) {
|
|
6760
|
+
module.exports = {
|
|
6761
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
6762
|
+
$id: "https://json-schema.org/draft/2020-12/schema",
|
|
6763
|
+
$vocabulary: {
|
|
6764
|
+
"https://json-schema.org/draft/2020-12/vocab/core": true,
|
|
6765
|
+
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
|
|
6766
|
+
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
|
|
6767
|
+
"https://json-schema.org/draft/2020-12/vocab/validation": true,
|
|
6768
|
+
"https://json-schema.org/draft/2020-12/vocab/meta-data": true,
|
|
6769
|
+
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
|
|
6770
|
+
"https://json-schema.org/draft/2020-12/vocab/content": true
|
|
6771
|
+
},
|
|
6772
|
+
$dynamicAnchor: "meta",
|
|
6773
|
+
title: "Core and Validation specifications meta-schema",
|
|
6774
|
+
allOf: [
|
|
6775
|
+
{ $ref: "meta/core" },
|
|
6776
|
+
{ $ref: "meta/applicator" },
|
|
6777
|
+
{ $ref: "meta/unevaluated" },
|
|
6778
|
+
{ $ref: "meta/validation" },
|
|
6779
|
+
{ $ref: "meta/meta-data" },
|
|
6780
|
+
{ $ref: "meta/format-annotation" },
|
|
6781
|
+
{ $ref: "meta/content" }
|
|
6782
|
+
],
|
|
6783
|
+
type: ["object", "boolean"],
|
|
6784
|
+
$comment: "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",
|
|
6785
|
+
properties: {
|
|
6786
|
+
definitions: {
|
|
6787
|
+
$comment: '"definitions" has been replaced by "$defs".',
|
|
6788
|
+
type: "object",
|
|
6789
|
+
additionalProperties: { $dynamicRef: "#meta" },
|
|
6790
|
+
deprecated: true,
|
|
6791
|
+
default: {}
|
|
6792
|
+
},
|
|
6793
|
+
dependencies: {
|
|
6794
|
+
$comment: '"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',
|
|
6795
|
+
type: "object",
|
|
6796
|
+
additionalProperties: {
|
|
6797
|
+
anyOf: [{ $dynamicRef: "#meta" }, { $ref: "meta/validation#/$defs/stringArray" }]
|
|
6798
|
+
},
|
|
6799
|
+
deprecated: true,
|
|
6800
|
+
default: {}
|
|
6801
|
+
},
|
|
6802
|
+
$recursiveAnchor: {
|
|
6803
|
+
$comment: '"$recursiveAnchor" has been replaced by "$dynamicAnchor".',
|
|
6804
|
+
$ref: "meta/core#/$defs/anchorString",
|
|
6805
|
+
deprecated: true
|
|
6806
|
+
},
|
|
6807
|
+
$recursiveRef: {
|
|
6808
|
+
$comment: '"$recursiveRef" has been replaced by "$dynamicRef".',
|
|
6809
|
+
$ref: "meta/core#/$defs/uriReferenceString",
|
|
6810
|
+
deprecated: true
|
|
6811
|
+
}
|
|
6812
|
+
}
|
|
6813
|
+
};
|
|
6814
|
+
}
|
|
6815
|
+
});
|
|
6816
|
+
|
|
6817
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json
|
|
6818
|
+
var require_applicator2 = __commonJS({
|
|
6819
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json"(exports$1, module) {
|
|
6820
|
+
module.exports = {
|
|
6821
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
6822
|
+
$id: "https://json-schema.org/draft/2020-12/meta/applicator",
|
|
6823
|
+
$vocabulary: {
|
|
6824
|
+
"https://json-schema.org/draft/2020-12/vocab/applicator": true
|
|
6825
|
+
},
|
|
6826
|
+
$dynamicAnchor: "meta",
|
|
6827
|
+
title: "Applicator vocabulary meta-schema",
|
|
6828
|
+
type: ["object", "boolean"],
|
|
6829
|
+
properties: {
|
|
6830
|
+
prefixItems: { $ref: "#/$defs/schemaArray" },
|
|
6831
|
+
items: { $dynamicRef: "#meta" },
|
|
6832
|
+
contains: { $dynamicRef: "#meta" },
|
|
6833
|
+
additionalProperties: { $dynamicRef: "#meta" },
|
|
6834
|
+
properties: {
|
|
6835
|
+
type: "object",
|
|
6836
|
+
additionalProperties: { $dynamicRef: "#meta" },
|
|
6837
|
+
default: {}
|
|
6838
|
+
},
|
|
6839
|
+
patternProperties: {
|
|
6840
|
+
type: "object",
|
|
6841
|
+
additionalProperties: { $dynamicRef: "#meta" },
|
|
6842
|
+
propertyNames: { format: "regex" },
|
|
6843
|
+
default: {}
|
|
6844
|
+
},
|
|
6845
|
+
dependentSchemas: {
|
|
6846
|
+
type: "object",
|
|
6847
|
+
additionalProperties: { $dynamicRef: "#meta" },
|
|
6848
|
+
default: {}
|
|
6849
|
+
},
|
|
6850
|
+
propertyNames: { $dynamicRef: "#meta" },
|
|
6851
|
+
if: { $dynamicRef: "#meta" },
|
|
6852
|
+
then: { $dynamicRef: "#meta" },
|
|
6853
|
+
else: { $dynamicRef: "#meta" },
|
|
6854
|
+
allOf: { $ref: "#/$defs/schemaArray" },
|
|
6855
|
+
anyOf: { $ref: "#/$defs/schemaArray" },
|
|
6856
|
+
oneOf: { $ref: "#/$defs/schemaArray" },
|
|
6857
|
+
not: { $dynamicRef: "#meta" }
|
|
6858
|
+
},
|
|
6859
|
+
$defs: {
|
|
6860
|
+
schemaArray: {
|
|
6861
|
+
type: "array",
|
|
6862
|
+
minItems: 1,
|
|
6863
|
+
items: { $dynamicRef: "#meta" }
|
|
6864
|
+
}
|
|
6865
|
+
}
|
|
6866
|
+
};
|
|
6867
|
+
}
|
|
6868
|
+
});
|
|
6869
|
+
|
|
6870
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json
|
|
6871
|
+
var require_unevaluated2 = __commonJS({
|
|
6872
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json"(exports$1, module) {
|
|
6873
|
+
module.exports = {
|
|
6874
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
6875
|
+
$id: "https://json-schema.org/draft/2020-12/meta/unevaluated",
|
|
6876
|
+
$vocabulary: {
|
|
6877
|
+
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true
|
|
6878
|
+
},
|
|
6879
|
+
$dynamicAnchor: "meta",
|
|
6880
|
+
title: "Unevaluated applicator vocabulary meta-schema",
|
|
6881
|
+
type: ["object", "boolean"],
|
|
6882
|
+
properties: {
|
|
6883
|
+
unevaluatedItems: { $dynamicRef: "#meta" },
|
|
6884
|
+
unevaluatedProperties: { $dynamicRef: "#meta" }
|
|
6885
|
+
}
|
|
6886
|
+
};
|
|
6887
|
+
}
|
|
6888
|
+
});
|
|
6889
|
+
|
|
6890
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json
|
|
6891
|
+
var require_content = __commonJS({
|
|
6892
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json"(exports$1, module) {
|
|
6893
|
+
module.exports = {
|
|
6894
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
6895
|
+
$id: "https://json-schema.org/draft/2020-12/meta/content",
|
|
6896
|
+
$vocabulary: {
|
|
6897
|
+
"https://json-schema.org/draft/2020-12/vocab/content": true
|
|
6898
|
+
},
|
|
6899
|
+
$dynamicAnchor: "meta",
|
|
6900
|
+
title: "Content vocabulary meta-schema",
|
|
6901
|
+
type: ["object", "boolean"],
|
|
6902
|
+
properties: {
|
|
6903
|
+
contentEncoding: { type: "string" },
|
|
6904
|
+
contentMediaType: { type: "string" },
|
|
6905
|
+
contentSchema: { $dynamicRef: "#meta" }
|
|
6906
|
+
}
|
|
6907
|
+
};
|
|
6908
|
+
}
|
|
6909
|
+
});
|
|
6910
|
+
|
|
6911
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json
|
|
6912
|
+
var require_core3 = __commonJS({
|
|
6913
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json"(exports$1, module) {
|
|
6914
|
+
module.exports = {
|
|
6915
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
6916
|
+
$id: "https://json-schema.org/draft/2020-12/meta/core",
|
|
6917
|
+
$vocabulary: {
|
|
6918
|
+
"https://json-schema.org/draft/2020-12/vocab/core": true
|
|
6919
|
+
},
|
|
6920
|
+
$dynamicAnchor: "meta",
|
|
6921
|
+
title: "Core vocabulary meta-schema",
|
|
6922
|
+
type: ["object", "boolean"],
|
|
6923
|
+
properties: {
|
|
6924
|
+
$id: {
|
|
6925
|
+
$ref: "#/$defs/uriReferenceString",
|
|
6926
|
+
$comment: "Non-empty fragments not allowed.",
|
|
6927
|
+
pattern: "^[^#]*#?$"
|
|
6928
|
+
},
|
|
6929
|
+
$schema: { $ref: "#/$defs/uriString" },
|
|
6930
|
+
$ref: { $ref: "#/$defs/uriReferenceString" },
|
|
6931
|
+
$anchor: { $ref: "#/$defs/anchorString" },
|
|
6932
|
+
$dynamicRef: { $ref: "#/$defs/uriReferenceString" },
|
|
6933
|
+
$dynamicAnchor: { $ref: "#/$defs/anchorString" },
|
|
6934
|
+
$vocabulary: {
|
|
6935
|
+
type: "object",
|
|
6936
|
+
propertyNames: { $ref: "#/$defs/uriString" },
|
|
6937
|
+
additionalProperties: {
|
|
6938
|
+
type: "boolean"
|
|
6939
|
+
}
|
|
6940
|
+
},
|
|
6941
|
+
$comment: {
|
|
6942
|
+
type: "string"
|
|
6943
|
+
},
|
|
6944
|
+
$defs: {
|
|
6945
|
+
type: "object",
|
|
6946
|
+
additionalProperties: { $dynamicRef: "#meta" }
|
|
6947
|
+
}
|
|
6948
|
+
},
|
|
6949
|
+
$defs: {
|
|
6950
|
+
anchorString: {
|
|
6951
|
+
type: "string",
|
|
6952
|
+
pattern: "^[A-Za-z_][-A-Za-z0-9._]*$"
|
|
6953
|
+
},
|
|
6954
|
+
uriString: {
|
|
6955
|
+
type: "string",
|
|
6956
|
+
format: "uri"
|
|
6957
|
+
},
|
|
6958
|
+
uriReferenceString: {
|
|
6959
|
+
type: "string",
|
|
6960
|
+
format: "uri-reference"
|
|
6961
|
+
}
|
|
6962
|
+
}
|
|
6963
|
+
};
|
|
6964
|
+
}
|
|
6965
|
+
});
|
|
6966
|
+
|
|
6967
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json
|
|
6968
|
+
var require_format_annotation = __commonJS({
|
|
6969
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json"(exports$1, module) {
|
|
6970
|
+
module.exports = {
|
|
6971
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
6972
|
+
$id: "https://json-schema.org/draft/2020-12/meta/format-annotation",
|
|
6973
|
+
$vocabulary: {
|
|
6974
|
+
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true
|
|
6975
|
+
},
|
|
6976
|
+
$dynamicAnchor: "meta",
|
|
6977
|
+
title: "Format vocabulary meta-schema for annotation results",
|
|
6978
|
+
type: ["object", "boolean"],
|
|
6979
|
+
properties: {
|
|
6980
|
+
format: { type: "string" }
|
|
6981
|
+
}
|
|
6982
|
+
};
|
|
6983
|
+
}
|
|
6984
|
+
});
|
|
6985
|
+
|
|
6986
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json
|
|
6987
|
+
var require_meta_data = __commonJS({
|
|
6988
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json"(exports$1, module) {
|
|
6989
|
+
module.exports = {
|
|
6990
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
6991
|
+
$id: "https://json-schema.org/draft/2020-12/meta/meta-data",
|
|
6992
|
+
$vocabulary: {
|
|
6993
|
+
"https://json-schema.org/draft/2020-12/vocab/meta-data": true
|
|
6994
|
+
},
|
|
6995
|
+
$dynamicAnchor: "meta",
|
|
6996
|
+
title: "Meta-data vocabulary meta-schema",
|
|
6997
|
+
type: ["object", "boolean"],
|
|
6998
|
+
properties: {
|
|
6999
|
+
title: {
|
|
7000
|
+
type: "string"
|
|
7001
|
+
},
|
|
7002
|
+
description: {
|
|
7003
|
+
type: "string"
|
|
7004
|
+
},
|
|
7005
|
+
default: true,
|
|
7006
|
+
deprecated: {
|
|
7007
|
+
type: "boolean",
|
|
7008
|
+
default: false
|
|
7009
|
+
},
|
|
7010
|
+
readOnly: {
|
|
7011
|
+
type: "boolean",
|
|
7012
|
+
default: false
|
|
7013
|
+
},
|
|
7014
|
+
writeOnly: {
|
|
7015
|
+
type: "boolean",
|
|
7016
|
+
default: false
|
|
7017
|
+
},
|
|
7018
|
+
examples: {
|
|
7019
|
+
type: "array",
|
|
7020
|
+
items: true
|
|
7021
|
+
}
|
|
7022
|
+
}
|
|
7023
|
+
};
|
|
7024
|
+
}
|
|
7025
|
+
});
|
|
7026
|
+
|
|
7027
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json
|
|
7028
|
+
var require_validation2 = __commonJS({
|
|
7029
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json"(exports$1, module) {
|
|
7030
|
+
module.exports = {
|
|
7031
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
7032
|
+
$id: "https://json-schema.org/draft/2020-12/meta/validation",
|
|
7033
|
+
$vocabulary: {
|
|
7034
|
+
"https://json-schema.org/draft/2020-12/vocab/validation": true
|
|
7035
|
+
},
|
|
7036
|
+
$dynamicAnchor: "meta",
|
|
7037
|
+
title: "Validation vocabulary meta-schema",
|
|
7038
|
+
type: ["object", "boolean"],
|
|
7039
|
+
properties: {
|
|
7040
|
+
type: {
|
|
7041
|
+
anyOf: [
|
|
7042
|
+
{ $ref: "#/$defs/simpleTypes" },
|
|
7043
|
+
{
|
|
7044
|
+
type: "array",
|
|
7045
|
+
items: { $ref: "#/$defs/simpleTypes" },
|
|
7046
|
+
minItems: 1,
|
|
7047
|
+
uniqueItems: true
|
|
7048
|
+
}
|
|
7049
|
+
]
|
|
7050
|
+
},
|
|
7051
|
+
const: true,
|
|
7052
|
+
enum: {
|
|
7053
|
+
type: "array",
|
|
7054
|
+
items: true
|
|
7055
|
+
},
|
|
7056
|
+
multipleOf: {
|
|
7057
|
+
type: "number",
|
|
7058
|
+
exclusiveMinimum: 0
|
|
7059
|
+
},
|
|
7060
|
+
maximum: {
|
|
7061
|
+
type: "number"
|
|
7062
|
+
},
|
|
7063
|
+
exclusiveMaximum: {
|
|
7064
|
+
type: "number"
|
|
7065
|
+
},
|
|
7066
|
+
minimum: {
|
|
7067
|
+
type: "number"
|
|
7068
|
+
},
|
|
7069
|
+
exclusiveMinimum: {
|
|
7070
|
+
type: "number"
|
|
7071
|
+
},
|
|
7072
|
+
maxLength: { $ref: "#/$defs/nonNegativeInteger" },
|
|
7073
|
+
minLength: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
|
|
7074
|
+
pattern: {
|
|
7075
|
+
type: "string",
|
|
7076
|
+
format: "regex"
|
|
7077
|
+
},
|
|
7078
|
+
maxItems: { $ref: "#/$defs/nonNegativeInteger" },
|
|
7079
|
+
minItems: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
|
|
7080
|
+
uniqueItems: {
|
|
7081
|
+
type: "boolean",
|
|
7082
|
+
default: false
|
|
7083
|
+
},
|
|
7084
|
+
maxContains: { $ref: "#/$defs/nonNegativeInteger" },
|
|
7085
|
+
minContains: {
|
|
7086
|
+
$ref: "#/$defs/nonNegativeInteger",
|
|
7087
|
+
default: 1
|
|
7088
|
+
},
|
|
7089
|
+
maxProperties: { $ref: "#/$defs/nonNegativeInteger" },
|
|
7090
|
+
minProperties: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
|
|
7091
|
+
required: { $ref: "#/$defs/stringArray" },
|
|
7092
|
+
dependentRequired: {
|
|
7093
|
+
type: "object",
|
|
7094
|
+
additionalProperties: {
|
|
7095
|
+
$ref: "#/$defs/stringArray"
|
|
7096
|
+
}
|
|
7097
|
+
}
|
|
7098
|
+
},
|
|
7099
|
+
$defs: {
|
|
7100
|
+
nonNegativeInteger: {
|
|
7101
|
+
type: "integer",
|
|
7102
|
+
minimum: 0
|
|
7103
|
+
},
|
|
7104
|
+
nonNegativeIntegerDefault0: {
|
|
7105
|
+
$ref: "#/$defs/nonNegativeInteger",
|
|
7106
|
+
default: 0
|
|
7107
|
+
},
|
|
7108
|
+
simpleTypes: {
|
|
7109
|
+
enum: ["array", "boolean", "integer", "null", "number", "object", "string"]
|
|
7110
|
+
},
|
|
7111
|
+
stringArray: {
|
|
7112
|
+
type: "array",
|
|
7113
|
+
items: { type: "string" },
|
|
7114
|
+
uniqueItems: true,
|
|
7115
|
+
default: []
|
|
7116
|
+
}
|
|
7117
|
+
}
|
|
7118
|
+
};
|
|
7119
|
+
}
|
|
7120
|
+
});
|
|
7121
|
+
|
|
7122
|
+
// node_modules/ajv/dist/refs/json-schema-2020-12/index.js
|
|
7123
|
+
var require_json_schema_2020_12 = __commonJS({
|
|
7124
|
+
"node_modules/ajv/dist/refs/json-schema-2020-12/index.js"(exports$1) {
|
|
7125
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7126
|
+
var metaSchema = require_schema();
|
|
7127
|
+
var applicator = require_applicator2();
|
|
7128
|
+
var unevaluated = require_unevaluated2();
|
|
7129
|
+
var content = require_content();
|
|
7130
|
+
var core = require_core3();
|
|
7131
|
+
var format = require_format_annotation();
|
|
7132
|
+
var metadata = require_meta_data();
|
|
7133
|
+
var validation = require_validation2();
|
|
7134
|
+
var META_SUPPORT_DATA = ["/properties"];
|
|
7135
|
+
function addMetaSchema2020($data) {
|
|
7136
|
+
[
|
|
7137
|
+
metaSchema,
|
|
7138
|
+
applicator,
|
|
7139
|
+
unevaluated,
|
|
7140
|
+
content,
|
|
7141
|
+
core,
|
|
7142
|
+
with$data(this, format),
|
|
7143
|
+
metadata,
|
|
7144
|
+
with$data(this, validation)
|
|
7145
|
+
].forEach((sch) => this.addMetaSchema(sch, void 0, false));
|
|
7146
|
+
return this;
|
|
7147
|
+
function with$data(ajv, sch) {
|
|
7148
|
+
return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch;
|
|
7149
|
+
}
|
|
7150
|
+
}
|
|
7151
|
+
exports$1.default = addMetaSchema2020;
|
|
7152
|
+
}
|
|
7153
|
+
});
|
|
7154
|
+
|
|
7155
|
+
// node_modules/ajv/dist/2020.js
|
|
7156
|
+
var require__ = __commonJS({
|
|
7157
|
+
"node_modules/ajv/dist/2020.js"(exports$1, module) {
|
|
7158
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7159
|
+
exports$1.MissingRefError = exports$1.ValidationError = exports$1.CodeGen = exports$1.Name = exports$1.nil = exports$1.stringify = exports$1.str = exports$1._ = exports$1.KeywordCxt = exports$1.Ajv2020 = void 0;
|
|
7160
|
+
var core_1 = require_core();
|
|
7161
|
+
var draft2020_1 = require_draft2020();
|
|
7162
|
+
var discriminator_1 = require_discriminator();
|
|
7163
|
+
var json_schema_2020_12_1 = require_json_schema_2020_12();
|
|
7164
|
+
var META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema";
|
|
7165
|
+
var Ajv20202 = class extends core_1.default {
|
|
7166
|
+
constructor(opts = {}) {
|
|
7167
|
+
super({
|
|
7168
|
+
...opts,
|
|
7169
|
+
dynamicRef: true,
|
|
7170
|
+
next: true,
|
|
7171
|
+
unevaluated: true
|
|
7172
|
+
});
|
|
7173
|
+
}
|
|
7174
|
+
_addVocabularies() {
|
|
7175
|
+
super._addVocabularies();
|
|
7176
|
+
draft2020_1.default.forEach((v) => this.addVocabulary(v));
|
|
7177
|
+
if (this.opts.discriminator)
|
|
7178
|
+
this.addKeyword(discriminator_1.default);
|
|
7179
|
+
}
|
|
7180
|
+
_addDefaultMetaSchema() {
|
|
7181
|
+
super._addDefaultMetaSchema();
|
|
7182
|
+
const { $data, meta } = this.opts;
|
|
7183
|
+
if (!meta)
|
|
7184
|
+
return;
|
|
7185
|
+
json_schema_2020_12_1.default.call(this, $data);
|
|
7186
|
+
this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
|
|
7187
|
+
}
|
|
7188
|
+
defaultMeta() {
|
|
7189
|
+
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : void 0);
|
|
7190
|
+
}
|
|
7191
|
+
};
|
|
7192
|
+
exports$1.Ajv2020 = Ajv20202;
|
|
7193
|
+
module.exports = exports$1 = Ajv20202;
|
|
7194
|
+
module.exports.Ajv2020 = Ajv20202;
|
|
7195
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7196
|
+
exports$1.default = Ajv20202;
|
|
7197
|
+
var validate_1 = require_validate();
|
|
7198
|
+
Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function() {
|
|
7199
|
+
return validate_1.KeywordCxt;
|
|
7200
|
+
} });
|
|
7201
|
+
var codegen_1 = require_codegen();
|
|
7202
|
+
Object.defineProperty(exports$1, "_", { enumerable: true, get: function() {
|
|
7203
|
+
return codegen_1._;
|
|
7204
|
+
} });
|
|
7205
|
+
Object.defineProperty(exports$1, "str", { enumerable: true, get: function() {
|
|
7206
|
+
return codegen_1.str;
|
|
7207
|
+
} });
|
|
7208
|
+
Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function() {
|
|
7209
|
+
return codegen_1.stringify;
|
|
7210
|
+
} });
|
|
7211
|
+
Object.defineProperty(exports$1, "nil", { enumerable: true, get: function() {
|
|
7212
|
+
return codegen_1.nil;
|
|
7213
|
+
} });
|
|
7214
|
+
Object.defineProperty(exports$1, "Name", { enumerable: true, get: function() {
|
|
7215
|
+
return codegen_1.Name;
|
|
7216
|
+
} });
|
|
7217
|
+
Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function() {
|
|
7218
|
+
return codegen_1.CodeGen;
|
|
7219
|
+
} });
|
|
7220
|
+
var validation_error_1 = require_validation_error();
|
|
7221
|
+
Object.defineProperty(exports$1, "ValidationError", { enumerable: true, get: function() {
|
|
7222
|
+
return validation_error_1.default;
|
|
7223
|
+
} });
|
|
7224
|
+
var ref_error_1 = require_ref_error();
|
|
7225
|
+
Object.defineProperty(exports$1, "MissingRefError", { enumerable: true, get: function() {
|
|
7226
|
+
return ref_error_1.default;
|
|
7227
|
+
} });
|
|
7228
|
+
}
|
|
7229
|
+
});
|
|
7230
|
+
|
|
6424
7231
|
// src/step-machine/reducer.ts
|
|
6425
7232
|
function applyStepResult(flow, state, stepName, stepResult) {
|
|
6426
7233
|
const stepConfig = flow.steps[stepName];
|
|
@@ -10071,9 +10878,11 @@ var MemoryJournal = class {
|
|
|
10071
10878
|
return this.buffer.length;
|
|
10072
10879
|
}
|
|
10073
10880
|
};
|
|
10881
|
+
|
|
10882
|
+
// src/continuous-event-graph/reactive.ts
|
|
10074
10883
|
function computeDataHash(data) {
|
|
10075
10884
|
const json = stableStringify(data);
|
|
10076
|
-
return
|
|
10885
|
+
return fnv1a64Hex(json);
|
|
10077
10886
|
}
|
|
10078
10887
|
function stableStringify(value) {
|
|
10079
10888
|
if (value === null || value === void 0 || typeof value !== "object") {
|
|
@@ -10086,13 +10895,49 @@ function stableStringify(value) {
|
|
|
10086
10895
|
const keys = Object.keys(obj).sort();
|
|
10087
10896
|
return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
|
|
10088
10897
|
}
|
|
10898
|
+
function fnv1a64Hex(input) {
|
|
10899
|
+
let hash = 0xcbf29ce484222325n;
|
|
10900
|
+
const prime = 0x100000001b3n;
|
|
10901
|
+
const mod = 0xffffffffffffffffn;
|
|
10902
|
+
for (let i = 0; i < input.length; i++) {
|
|
10903
|
+
hash ^= BigInt(input.charCodeAt(i));
|
|
10904
|
+
hash = hash * prime & mod;
|
|
10905
|
+
}
|
|
10906
|
+
return hash.toString(16).padStart(16, "0");
|
|
10907
|
+
}
|
|
10908
|
+
function base64UrlEncode(input) {
|
|
10909
|
+
if (typeof Buffer !== "undefined") {
|
|
10910
|
+
return Buffer.from(input, "utf8").toString("base64url");
|
|
10911
|
+
}
|
|
10912
|
+
if (typeof btoa === "function") {
|
|
10913
|
+
const bytes = new TextEncoder().encode(input);
|
|
10914
|
+
let binary = "";
|
|
10915
|
+
for (const b of bytes) binary += String.fromCharCode(b);
|
|
10916
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
10917
|
+
}
|
|
10918
|
+
throw new Error("No base64 encoder available in this runtime");
|
|
10919
|
+
}
|
|
10920
|
+
function base64UrlDecode(input) {
|
|
10921
|
+
if (typeof Buffer !== "undefined") {
|
|
10922
|
+
return Buffer.from(input, "base64url").toString("utf8");
|
|
10923
|
+
}
|
|
10924
|
+
if (typeof atob === "function") {
|
|
10925
|
+
const base64 = input.replace(/-/g, "+").replace(/_/g, "/");
|
|
10926
|
+
const padded = base64 + "=".repeat((4 - base64.length % 4) % 4);
|
|
10927
|
+
const binary = atob(padded);
|
|
10928
|
+
const bytes = new Uint8Array(binary.length);
|
|
10929
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
10930
|
+
return new TextDecoder().decode(bytes);
|
|
10931
|
+
}
|
|
10932
|
+
throw new Error("No base64 decoder available in this runtime");
|
|
10933
|
+
}
|
|
10089
10934
|
function encodeCallbackToken(taskName) {
|
|
10090
10935
|
const payload = JSON.stringify({ t: taskName, n: Date.now().toString(36) + Math.random().toString(36).slice(2, 6) });
|
|
10091
|
-
return
|
|
10936
|
+
return base64UrlEncode(payload);
|
|
10092
10937
|
}
|
|
10093
10938
|
function decodeCallbackToken(token) {
|
|
10094
10939
|
try {
|
|
10095
|
-
const payload = JSON.parse(
|
|
10940
|
+
const payload = JSON.parse(base64UrlDecode(token));
|
|
10096
10941
|
if (typeof payload?.t === "string") return { taskName: payload.t };
|
|
10097
10942
|
return null;
|
|
10098
10943
|
} catch {
|
|
@@ -10702,13 +11547,11 @@ function createNoopHandler(getResolve, staticData) {
|
|
|
10702
11547
|
var live_cards_schema_default = {
|
|
10703
11548
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
10704
11549
|
$id: "https://nsreehari.github.io/boards/live-cards.schema.json",
|
|
10705
|
-
title: "LiveCards Node Schema",
|
|
10706
|
-
description: "Schema for Card and ExternalSource nodes in the LiveCards Board/Canvas engine",
|
|
10707
11550
|
definitions: {
|
|
10708
11551
|
bind_ref: {
|
|
10709
|
-
description: "A
|
|
11552
|
+
description: "A card data path reference, e.g. 'card_data.raw_quotes' or 'requires.upstream'",
|
|
10710
11553
|
type: "string",
|
|
10711
|
-
pattern: "^(
|
|
11554
|
+
pattern: "^(card_data|requires|fetched_sources|computed_values)(\\.|$)"
|
|
10712
11555
|
},
|
|
10713
11556
|
bind_or_literal: {
|
|
10714
11557
|
description: "A literal value or a bind reference object",
|
|
@@ -10777,7 +11620,7 @@ var live_cards_schema_default = {
|
|
|
10777
11620
|
]
|
|
10778
11621
|
},
|
|
10779
11622
|
input: {
|
|
10780
|
-
description: "
|
|
11623
|
+
description: "card_data.path, literal, array of inputs, or nested compute_expr",
|
|
10781
11624
|
oneOf: [
|
|
10782
11625
|
{ type: "string" },
|
|
10783
11626
|
{ type: "number" },
|
|
@@ -10813,18 +11656,18 @@ var live_cards_schema_default = {
|
|
|
10813
11656
|
required: ["bindTo", "src"],
|
|
10814
11657
|
properties: {
|
|
10815
11658
|
bindTo: { type: "string", description: "Token name published downstream" },
|
|
10816
|
-
src: { type: "string", description: "Path to read value from (
|
|
11659
|
+
src: { type: "string", description: "Path to read value from (card_data.*, requires.*, fetched_sources.*, computed_values.*)" }
|
|
10817
11660
|
}
|
|
10818
11661
|
},
|
|
10819
|
-
description: "Explicit bindings exposing computed
|
|
11662
|
+
description: "Explicit bindings exposing computed or card_data values downstream as named tokens"
|
|
10820
11663
|
},
|
|
10821
11664
|
compute_step: {
|
|
10822
|
-
description: "A single ordered compute step: reads
|
|
11665
|
+
description: "A single ordered compute step: reads card_data.*/requires.*/computed_values.*, writes to computed_values[bindTo]",
|
|
10823
11666
|
type: "object",
|
|
10824
11667
|
required: ["bindTo", "expr"],
|
|
10825
11668
|
properties: {
|
|
10826
11669
|
bindTo: { type: "string", description: "Key in computed_values to write result" },
|
|
10827
|
-
expr: { type: "string", description: "JSONata expression evaluated against {
|
|
11670
|
+
expr: { type: "string", description: "JSONata expression evaluated against { card_data, requires, fetched_sources, computed_values }" }
|
|
10828
11671
|
}
|
|
10829
11672
|
},
|
|
10830
11673
|
source_def: {
|
|
@@ -10833,7 +11676,7 @@ var live_cards_schema_default = {
|
|
|
10833
11676
|
required: ["bindTo"],
|
|
10834
11677
|
additionalProperties: true,
|
|
10835
11678
|
properties: {
|
|
10836
|
-
bindTo: { type: "string", description: "Key under
|
|
11679
|
+
bindTo: { type: "string", description: "Key under fetched_sources.* available in compute expressions" },
|
|
10837
11680
|
outputFile: { type: "string", description: "Board-relative path the executor writes its JSON result to. Presence of this file signals delivery." },
|
|
10838
11681
|
optionalForCompletionGating: { type: "boolean", default: false, description: "When true this source does not gate card completion. Default false when absent, so sources are completion-gating by default." },
|
|
10839
11682
|
timeout: { type: "integer", minimum: 0, default: 12e4, description: "Executor/script timeout in ms. Default: 120 000 (2 min)." },
|
|
@@ -10861,19 +11704,17 @@ var live_cards_schema_default = {
|
|
|
10861
11704
|
"text",
|
|
10862
11705
|
"markdown",
|
|
10863
11706
|
"custom",
|
|
10864
|
-
"file-upload",
|
|
10865
|
-
"chat",
|
|
10866
11707
|
"actions"
|
|
10867
11708
|
]
|
|
10868
11709
|
},
|
|
10869
11710
|
label: { type: "string", description: "Heading above this element" },
|
|
10870
11711
|
className: { type: "string", description: "Bootstrap grid class, e.g. 'col-12 col-md-6'" },
|
|
10871
|
-
visible: { type: "string", description: "
|
|
11712
|
+
visible: { type: "string", description: "card_data/requires/fetched_sources/computed_values path \u2014 element shown only if truthy" },
|
|
10872
11713
|
data: {
|
|
10873
11714
|
type: "object",
|
|
10874
11715
|
properties: {
|
|
10875
|
-
bind: { $ref: "#/definitions/bind_ref", description: "
|
|
10876
|
-
writeTo: { $ref: "#/definitions/bind_ref", description: "
|
|
11716
|
+
bind: { $ref: "#/definitions/bind_ref", description: "card_data/requires/fetched_sources/computed_values path to read data from" },
|
|
11717
|
+
writeTo: { $ref: "#/definitions/bind_ref", description: "card_data path for user input (form, filter, todo, notes)" },
|
|
10877
11718
|
columns: { type: "array", items: { type: "string" }, description: "table: visible columns" },
|
|
10878
11719
|
maxRows: { type: "integer", description: "table/list: max rows to display" },
|
|
10879
11720
|
sortable: { type: "boolean", default: true, description: "table: enable click-to-sort" },
|
|
@@ -10906,7 +11747,7 @@ var live_cards_schema_default = {
|
|
|
10906
11747
|
label: { type: "string" },
|
|
10907
11748
|
style: { type: "string", description: "Bootstrap button variant, e.g. 'success', 'outline-danger'" },
|
|
10908
11749
|
size: { type: "string", default: "sm" },
|
|
10909
|
-
disabled: { oneOf: [{ type: "boolean" }, { type: "string", description: "
|
|
11750
|
+
disabled: { oneOf: [{ type: "boolean" }, { type: "string", description: "card_data/requires/fetched_sources/computed_values path \u2014 truthy = disabled" }] }
|
|
10910
11751
|
}
|
|
10911
11752
|
}
|
|
10912
11753
|
}
|
|
@@ -10966,14 +11807,39 @@ var live_cards_schema_default = {
|
|
|
10966
11807
|
provides: { $ref: "#/definitions/provides" },
|
|
10967
11808
|
meta: { $ref: "#/definitions/meta" },
|
|
10968
11809
|
view: { $ref: "#/definitions/view" },
|
|
10969
|
-
|
|
11810
|
+
card_data: {
|
|
10970
11811
|
type: "object",
|
|
10971
|
-
|
|
11812
|
+
description: "Authored card data supplied in the card definition",
|
|
10972
11813
|
properties: {
|
|
10973
|
-
|
|
10974
|
-
|
|
10975
|
-
|
|
10976
|
-
|
|
11814
|
+
files: {
|
|
11815
|
+
type: "array",
|
|
11816
|
+
description: "Optional uploaded-file metadata maintained by host handlers. Stored name is normalized and serial-prefixed (for example 001-my_file.pdf).",
|
|
11817
|
+
items: {
|
|
11818
|
+
type: "object",
|
|
11819
|
+
required: ["name", "stored_name"],
|
|
11820
|
+
properties: {
|
|
11821
|
+
name: { type: "string", minLength: 1 },
|
|
11822
|
+
stored_name: {
|
|
11823
|
+
type: "string",
|
|
11824
|
+
minLength: 5,
|
|
11825
|
+
maxLength: 32,
|
|
11826
|
+
pattern: "^[0-9]{3,}-[a-z0-9._-]+$"
|
|
11827
|
+
},
|
|
11828
|
+
size: {
|
|
11829
|
+
oneOf: [
|
|
11830
|
+
{ type: "integer", minimum: 0 },
|
|
11831
|
+
{ type: "null" }
|
|
11832
|
+
]
|
|
11833
|
+
},
|
|
11834
|
+
mime_type: { type: "string" },
|
|
11835
|
+
path: { type: "string", pattern: "^[^\\s]+/files/[0-9]{3,}-[a-z0-9._-]+$" },
|
|
11836
|
+
uploaded_at: { type: "string", format: "date-time" }
|
|
11837
|
+
},
|
|
11838
|
+
additionalProperties: false
|
|
11839
|
+
}
|
|
11840
|
+
}
|
|
11841
|
+
},
|
|
11842
|
+
additionalProperties: true
|
|
10977
11843
|
},
|
|
10978
11844
|
sources: {
|
|
10979
11845
|
type: "array",
|
|
@@ -10982,7 +11848,7 @@ var live_cards_schema_default = {
|
|
|
10982
11848
|
},
|
|
10983
11849
|
compute: {
|
|
10984
11850
|
type: "array",
|
|
10985
|
-
description: "Ordered array of compute steps. Each reads
|
|
11851
|
+
description: "Ordered array of compute steps. Each reads card_data.*/requires.*/fetched_sources.*/computed_values.* and writes to ephemeral computed_values[bindTo].",
|
|
10986
11852
|
items: { $ref: "#/definitions/compute_step" }
|
|
10987
11853
|
}
|
|
10988
11854
|
}
|
|
@@ -10991,6 +11857,57 @@ var live_cards_schema_default = {
|
|
|
10991
11857
|
// src/card-compute/schema-validator.ts
|
|
10992
11858
|
var import_ajv3 = __toESM(require_ajv());
|
|
10993
11859
|
var _compiled3 = null;
|
|
11860
|
+
var NAMESPACE_REFERENCE_RE = /\b(card_data|requires|fetched_sources|computed_values|sources)\b/g;
|
|
11861
|
+
var ROOT_PATH_NAMESPACE_RE = /^\s*(card_data|requires|fetched_sources|computed_values|sources)(\.|$)/;
|
|
11862
|
+
function referencedNamespaces(expression) {
|
|
11863
|
+
const namespaces = /* @__PURE__ */ new Set();
|
|
11864
|
+
let match;
|
|
11865
|
+
NAMESPACE_REFERENCE_RE.lastIndex = 0;
|
|
11866
|
+
while ((match = NAMESPACE_REFERENCE_RE.exec(expression)) !== null) {
|
|
11867
|
+
namespaces.add(match[1]);
|
|
11868
|
+
}
|
|
11869
|
+
return namespaces;
|
|
11870
|
+
}
|
|
11871
|
+
function parseRootPathNamespace(pathValue) {
|
|
11872
|
+
const match = ROOT_PATH_NAMESPACE_RE.exec(pathValue);
|
|
11873
|
+
return match ? match[1] : null;
|
|
11874
|
+
}
|
|
11875
|
+
function validateJsonataExprWithNamespaces(expr, path, allowedNamespaces, errors) {
|
|
11876
|
+
try {
|
|
11877
|
+
jsonata2__default.default(expr);
|
|
11878
|
+
} catch (err) {
|
|
11879
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
11880
|
+
errors.push(`${path}: invalid JSONata expression (${message})`);
|
|
11881
|
+
return;
|
|
11882
|
+
}
|
|
11883
|
+
const usedNamespaces = referencedNamespaces(expr);
|
|
11884
|
+
for (const namespace of usedNamespaces) {
|
|
11885
|
+
if (!allowedNamespaces.has(namespace)) {
|
|
11886
|
+
errors.push(`${path}: disallowed namespace "${namespace}" in expression`);
|
|
11887
|
+
}
|
|
11888
|
+
}
|
|
11889
|
+
}
|
|
11890
|
+
function walkViewPathReferences(value, path, errors) {
|
|
11891
|
+
if (Array.isArray(value)) {
|
|
11892
|
+
value.forEach((entry, index) => {
|
|
11893
|
+
walkViewPathReferences(entry, `${path}/${index}`, errors);
|
|
11894
|
+
});
|
|
11895
|
+
return;
|
|
11896
|
+
}
|
|
11897
|
+
if (typeof value === "string") {
|
|
11898
|
+
const rootNamespace = parseRootPathNamespace(value);
|
|
11899
|
+
if (!rootNamespace) return;
|
|
11900
|
+
if (!(/* @__PURE__ */ new Set(["card_data", "requires", "fetched_sources", "computed_values"])).has(rootNamespace)) {
|
|
11901
|
+
errors.push(`${path}: disallowed namespace "${rootNamespace}" in view reference`);
|
|
11902
|
+
}
|
|
11903
|
+
return;
|
|
11904
|
+
}
|
|
11905
|
+
if (!value || typeof value !== "object") return;
|
|
11906
|
+
const record = value;
|
|
11907
|
+
for (const [key, next2] of Object.entries(record)) {
|
|
11908
|
+
walkViewPathReferences(next2, `${path}/${key}`, errors);
|
|
11909
|
+
}
|
|
11910
|
+
}
|
|
10994
11911
|
function getValidator3() {
|
|
10995
11912
|
if (_compiled3) return _compiled3;
|
|
10996
11913
|
const ajv = new import_ajv3.default({ allErrors: true });
|
|
@@ -11008,6 +11925,42 @@ function validateLiveCardSchema(node) {
|
|
|
11008
11925
|
});
|
|
11009
11926
|
return { ok: false, errors };
|
|
11010
11927
|
}
|
|
11928
|
+
function validateLiveCardRuntimeExpressions(node) {
|
|
11929
|
+
const errors = [];
|
|
11930
|
+
if (!node || typeof node !== "object" || Array.isArray(node)) {
|
|
11931
|
+
return { ok: true, errors: [] };
|
|
11932
|
+
}
|
|
11933
|
+
const asRecord = node;
|
|
11934
|
+
const compute = asRecord.compute;
|
|
11935
|
+
if (Array.isArray(compute)) {
|
|
11936
|
+
compute.forEach((step, i) => {
|
|
11937
|
+
if (!step || typeof step !== "object" || Array.isArray(step)) return;
|
|
11938
|
+
const expr = step.expr;
|
|
11939
|
+
if (typeof expr !== "string" || expr.trim().length === 0) return;
|
|
11940
|
+
validateJsonataExprWithNamespaces(
|
|
11941
|
+
expr,
|
|
11942
|
+
`/compute/${i}/expr`,
|
|
11943
|
+
/* @__PURE__ */ new Set(["card_data", "requires", "fetched_sources", "computed_values"]),
|
|
11944
|
+
errors
|
|
11945
|
+
);
|
|
11946
|
+
});
|
|
11947
|
+
}
|
|
11948
|
+
const view = asRecord.view;
|
|
11949
|
+
if (view && typeof view === "object" && !Array.isArray(view)) {
|
|
11950
|
+
walkViewPathReferences(view, "/view", errors);
|
|
11951
|
+
}
|
|
11952
|
+
return { ok: errors.length === 0, errors };
|
|
11953
|
+
}
|
|
11954
|
+
function validateLiveCard(node) {
|
|
11955
|
+
return validateLiveCardDefinition(node);
|
|
11956
|
+
}
|
|
11957
|
+
function validateLiveCardDefinition(node) {
|
|
11958
|
+
const schema = validateLiveCardSchema(node);
|
|
11959
|
+
if (!schema.ok) return schema;
|
|
11960
|
+
const runtime = validateLiveCardRuntimeExpressions(node);
|
|
11961
|
+
if (!runtime.ok) return { ok: false, errors: runtime.errors };
|
|
11962
|
+
return { ok: true, errors: [] };
|
|
11963
|
+
}
|
|
11011
11964
|
|
|
11012
11965
|
// src/card-compute/index.ts
|
|
11013
11966
|
function deepGet(obj, path) {
|
|
@@ -11031,18 +11984,18 @@ function deepSet(obj, path, value) {
|
|
|
11031
11984
|
}
|
|
11032
11985
|
async function run(node, options) {
|
|
11033
11986
|
if (!node?.compute?.length) return node;
|
|
11034
|
-
if (!node.
|
|
11987
|
+
if (!node.card_data) node.card_data = {};
|
|
11035
11988
|
node.computed_values = {};
|
|
11036
11989
|
node._sourcesData = options?.sourcesData ?? {};
|
|
11037
11990
|
const ctx = {
|
|
11038
|
-
|
|
11991
|
+
card_data: node.card_data,
|
|
11039
11992
|
requires: node.requires ?? {},
|
|
11040
|
-
|
|
11993
|
+
fetched_sources: node._sourcesData,
|
|
11041
11994
|
computed_values: node.computed_values
|
|
11042
11995
|
};
|
|
11043
11996
|
for (const step of node.compute) {
|
|
11044
11997
|
try {
|
|
11045
|
-
const val = await
|
|
11998
|
+
const val = await jsonata2__default.default(step.expr).evaluate(ctx);
|
|
11046
11999
|
deepSet(node.computed_values, step.bindTo, val);
|
|
11047
12000
|
ctx.computed_values = node.computed_values;
|
|
11048
12001
|
} catch (err) {
|
|
@@ -11053,16 +12006,16 @@ async function run(node, options) {
|
|
|
11053
12006
|
}
|
|
11054
12007
|
async function evalExpr(expr, node) {
|
|
11055
12008
|
const ctx = {
|
|
11056
|
-
|
|
12009
|
+
card_data: node.card_data ?? {},
|
|
11057
12010
|
requires: node.requires ?? {},
|
|
11058
|
-
|
|
12011
|
+
fetched_sources: node._sourcesData ?? {},
|
|
11059
12012
|
computed_values: node.computed_values ?? {}
|
|
11060
12013
|
};
|
|
11061
|
-
return
|
|
12014
|
+
return jsonata2__default.default(expr).evaluate(ctx);
|
|
11062
12015
|
}
|
|
11063
12016
|
function resolve(node, path) {
|
|
11064
|
-
if (path.startsWith("
|
|
11065
|
-
return deepGet(node._sourcesData ?? {}, path.slice("
|
|
12017
|
+
if (path.startsWith("fetched_sources.")) {
|
|
12018
|
+
return deepGet(node._sourcesData ?? {}, path.slice("fetched_sources.".length));
|
|
11066
12019
|
}
|
|
11067
12020
|
return deepGet(node, path);
|
|
11068
12021
|
}
|
|
@@ -11082,8 +12035,7 @@ var VALID_ELEMENT_KINDS = /* @__PURE__ */ new Set([
|
|
|
11082
12035
|
"markdown",
|
|
11083
12036
|
"custom"
|
|
11084
12037
|
]);
|
|
11085
|
-
var
|
|
11086
|
-
var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "state", "compute", "sources"]);
|
|
12038
|
+
var ALLOWED_KEYS = /* @__PURE__ */ new Set(["id", "meta", "requires", "provides", "view", "card_data", "compute", "sources"]);
|
|
11087
12039
|
function validateNode(node) {
|
|
11088
12040
|
const errors = [];
|
|
11089
12041
|
if (!node || typeof node !== "object" || Array.isArray(node)) {
|
|
@@ -11094,13 +12046,8 @@ function validateNode(node) {
|
|
|
11094
12046
|
for (const key of Object.keys(n)) {
|
|
11095
12047
|
if (!ALLOWED_KEYS.has(key)) errors.push(`Unknown top-level key: "${key}"`);
|
|
11096
12048
|
}
|
|
11097
|
-
if (n.
|
|
11098
|
-
errors.push("
|
|
11099
|
-
} else {
|
|
11100
|
-
const state = n.state;
|
|
11101
|
-
if (state.status != null && !VALID_STATUSES.has(state.status)) {
|
|
11102
|
-
errors.push(`state.status: must be one of: ${[...VALID_STATUSES].join(", ")}`);
|
|
11103
|
-
}
|
|
12049
|
+
if (n.card_data == null || typeof n.card_data !== "object" || Array.isArray(n.card_data)) {
|
|
12050
|
+
errors.push("card_data: required, must be an object");
|
|
11104
12051
|
}
|
|
11105
12052
|
if (n.meta != null) {
|
|
11106
12053
|
if (typeof n.meta !== "object" || Array.isArray(n.meta)) {
|
|
@@ -11189,11 +12136,21 @@ function validateNode(node) {
|
|
|
11189
12136
|
}
|
|
11190
12137
|
return { ok: errors.length === 0, errors };
|
|
11191
12138
|
}
|
|
12139
|
+
function enrichSources(sources, context) {
|
|
12140
|
+
if (!sources || sources.length === 0) return [];
|
|
12141
|
+
return sources.map((src) => ({
|
|
12142
|
+
...src,
|
|
12143
|
+
_requires: context.requires ?? {},
|
|
12144
|
+
_sourcesData: context.sourcesData ?? {},
|
|
12145
|
+
_computed_values: context.computed_values ?? {}
|
|
12146
|
+
}));
|
|
12147
|
+
}
|
|
11192
12148
|
var CardCompute = {
|
|
11193
12149
|
run,
|
|
11194
12150
|
eval: evalExpr,
|
|
11195
12151
|
resolve,
|
|
11196
|
-
validate: validateNode
|
|
12152
|
+
validate: validateNode,
|
|
12153
|
+
enrichSources
|
|
11197
12154
|
};
|
|
11198
12155
|
|
|
11199
12156
|
// src/continuous-event-graph/live-cards-bridge.ts
|
|
@@ -11229,7 +12186,7 @@ function liveCardsToReactiveGraph(input, options = {}) {
|
|
|
11229
12186
|
const allTokens = /* @__PURE__ */ new Set();
|
|
11230
12187
|
const tokenToCardId = /* @__PURE__ */ new Map();
|
|
11231
12188
|
for (const card of cards) {
|
|
11232
|
-
for (const binding of card.provides ?? [{ bindTo: card.id, src:
|
|
12189
|
+
for (const binding of card.provides ?? [{ bindTo: card.id, src: "card_data" }]) {
|
|
11233
12190
|
allTokens.add(binding.bindTo);
|
|
11234
12191
|
tokenToCardId.set(binding.bindTo, card.id);
|
|
11235
12192
|
}
|
|
@@ -11243,7 +12200,7 @@ function liveCardsToReactiveGraph(input, options = {}) {
|
|
|
11243
12200
|
}
|
|
11244
12201
|
tasks[card.id] = {
|
|
11245
12202
|
requires: requires.length > 0 ? requires : void 0,
|
|
11246
|
-
provides: (card.provides ?? [{ bindTo: card.id, src:
|
|
12203
|
+
provides: (card.provides ?? [{ bindTo: card.id, src: "card_data" }]).map((p) => p.bindTo),
|
|
11247
12204
|
taskHandlers: [card.id],
|
|
11248
12205
|
description: card.meta?.title ?? card.id
|
|
11249
12206
|
};
|
|
@@ -11295,9 +12252,9 @@ function buildSourceHandler(card, sourceHandlers, defaultSourceHandler, sharedSt
|
|
|
11295
12252
|
};
|
|
11296
12253
|
}
|
|
11297
12254
|
return async (input) => {
|
|
11298
|
-
const
|
|
11299
|
-
sharedState.set(card.id,
|
|
11300
|
-
getResolve()(input.callbackToken,
|
|
12255
|
+
const data = { ...card.card_data };
|
|
12256
|
+
sharedState.set(card.id, data);
|
|
12257
|
+
getResolve()(input.callbackToken, data);
|
|
11301
12258
|
return "task-initiated";
|
|
11302
12259
|
};
|
|
11303
12260
|
}
|
|
@@ -11320,7 +12277,7 @@ function buildCardHandler(card, cardHandlers, sharedState, _cardMap, tokenToCard
|
|
|
11320
12277
|
}
|
|
11321
12278
|
const computeNode = {
|
|
11322
12279
|
id: card.id,
|
|
11323
|
-
|
|
12280
|
+
card_data: { ...card.card_data },
|
|
11324
12281
|
requires: requiresData,
|
|
11325
12282
|
compute: card.compute
|
|
11326
12283
|
};
|
|
@@ -11332,15 +12289,252 @@ function buildCardHandler(card, cardHandlers, sharedState, _cardMap, tokenToCard
|
|
|
11332
12289
|
resultData[bindTo] = CardCompute.resolve(computeNode, src);
|
|
11333
12290
|
}
|
|
11334
12291
|
} else {
|
|
11335
|
-
resultData = { ...computeNode.
|
|
12292
|
+
resultData = { ...computeNode.card_data, ...computeNode.computed_values };
|
|
11336
12293
|
}
|
|
11337
|
-
const resultState = { ...computeNode.
|
|
12294
|
+
const resultState = { ...computeNode.card_data, ...computeNode.computed_values };
|
|
11338
12295
|
sharedState.set(card.id, resultState);
|
|
11339
12296
|
getResolve()(input.callbackToken, resultData);
|
|
11340
12297
|
return "task-initiated";
|
|
11341
12298
|
};
|
|
11342
12299
|
}
|
|
11343
12300
|
|
|
12301
|
+
// src/board-livegraph-runtime/index.ts
|
|
12302
|
+
function deepClone(value) {
|
|
12303
|
+
return JSON.parse(JSON.stringify(value));
|
|
12304
|
+
}
|
|
12305
|
+
function toTaskConfig(card) {
|
|
12306
|
+
const provides = card.provides && card.provides.length > 0 ? card.provides.map((p) => p.bindTo) : [card.id];
|
|
12307
|
+
return {
|
|
12308
|
+
requires: card.requires && card.requires.length > 0 ? [...card.requires] : void 0,
|
|
12309
|
+
provides,
|
|
12310
|
+
taskHandlers: [card.id],
|
|
12311
|
+
description: card.meta?.title ?? card.id
|
|
12312
|
+
};
|
|
12313
|
+
}
|
|
12314
|
+
function buildTokenProviders(cards) {
|
|
12315
|
+
const tokenToCardId = /* @__PURE__ */ new Map();
|
|
12316
|
+
for (const [cardId, card] of cards.entries()) {
|
|
12317
|
+
const bindings = card.provides && card.provides.length > 0 ? card.provides : [{ bindTo: cardId, src: "card_data" }];
|
|
12318
|
+
for (const binding of bindings) tokenToCardId.set(binding.bindTo, cardId);
|
|
12319
|
+
}
|
|
12320
|
+
return tokenToCardId;
|
|
12321
|
+
}
|
|
12322
|
+
function validateRequires(cards, changedCardId) {
|
|
12323
|
+
const tokenProviders = buildTokenProviders(cards);
|
|
12324
|
+
const card = cards.get(changedCardId);
|
|
12325
|
+
if (!card) return;
|
|
12326
|
+
for (const req of card.requires ?? []) {
|
|
12327
|
+
if (!tokenProviders.has(req)) {
|
|
12328
|
+
throw new Error(`Card "${changedCardId}" requires token "${req}" but no card provides it`);
|
|
12329
|
+
}
|
|
12330
|
+
}
|
|
12331
|
+
}
|
|
12332
|
+
function createBoardLiveGraphRuntime(input, options = {}) {
|
|
12333
|
+
const boardMeta = Array.isArray(input) ? {} : {
|
|
12334
|
+
id: input.id,
|
|
12335
|
+
title: input.title,
|
|
12336
|
+
mode: input.mode,
|
|
12337
|
+
positions: input.positions,
|
|
12338
|
+
settings: input.settings
|
|
12339
|
+
};
|
|
12340
|
+
const initialCards = Array.isArray(input) ? input : input.nodes;
|
|
12341
|
+
const cards = /* @__PURE__ */ new Map();
|
|
12342
|
+
for (const card of initialCards) {
|
|
12343
|
+
if (cards.has(card.id)) throw new Error(`Duplicate card ID: "${card.id}"`);
|
|
12344
|
+
cards.set(card.id, deepClone(card));
|
|
12345
|
+
}
|
|
12346
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
12347
|
+
const taskExecutor = options.taskExecutor;
|
|
12348
|
+
const sourceAdapters = options.sourceAdapters ?? {};
|
|
12349
|
+
const defaultSourceAdapter = options.defaultSourceAdapter;
|
|
12350
|
+
let graphRef = null;
|
|
12351
|
+
const notifyListeners = (events, graph2) => {
|
|
12352
|
+
const update = {
|
|
12353
|
+
events,
|
|
12354
|
+
graph: graph2,
|
|
12355
|
+
nodes: getRenderableNodes()
|
|
12356
|
+
};
|
|
12357
|
+
for (const listener of listeners) listener(update);
|
|
12358
|
+
};
|
|
12359
|
+
const makeHandler = (cardId) => {
|
|
12360
|
+
return async (inputArgs) => {
|
|
12361
|
+
const card = cards.get(cardId);
|
|
12362
|
+
if (!card) return "task-initiate-failure";
|
|
12363
|
+
const requiresData = {};
|
|
12364
|
+
for (const token of card.requires ?? []) {
|
|
12365
|
+
const upstream = inputArgs.state[token];
|
|
12366
|
+
if (!upstream || typeof upstream !== "object") continue;
|
|
12367
|
+
const providesData2 = upstream.provides_data;
|
|
12368
|
+
if (!providesData2 || typeof providesData2 !== "object") continue;
|
|
12369
|
+
if (!Object.prototype.hasOwnProperty.call(providesData2, token)) continue;
|
|
12370
|
+
requiresData[token] = providesData2[token];
|
|
12371
|
+
}
|
|
12372
|
+
const sourcesData = {};
|
|
12373
|
+
if (card.sources && card.sources.length > 0) {
|
|
12374
|
+
const adapter = sourceAdapters[cardId] ?? defaultSourceAdapter;
|
|
12375
|
+
const fetched = taskExecutor ? await taskExecutor({ card, input: inputArgs }) : adapter ? await adapter({ card, input: inputArgs }) : void 0;
|
|
12376
|
+
if (fetched && typeof fetched === "object") {
|
|
12377
|
+
for (const src of card.sources) {
|
|
12378
|
+
if (Object.prototype.hasOwnProperty.call(fetched, src.bindTo)) {
|
|
12379
|
+
sourcesData[src.bindTo] = fetched[src.bindTo];
|
|
12380
|
+
} else if (card.sources.length === 1) {
|
|
12381
|
+
sourcesData[src.bindTo] = fetched;
|
|
12382
|
+
}
|
|
12383
|
+
}
|
|
12384
|
+
}
|
|
12385
|
+
}
|
|
12386
|
+
const computeNode = {
|
|
12387
|
+
id: card.id,
|
|
12388
|
+
card_data: deepClone(card.card_data ?? {}),
|
|
12389
|
+
requires: requiresData,
|
|
12390
|
+
sources: card.sources,
|
|
12391
|
+
compute: card.compute
|
|
12392
|
+
};
|
|
12393
|
+
computeNode._sourcesData = sourcesData;
|
|
12394
|
+
if (computeNode.compute && computeNode.compute.length > 0) {
|
|
12395
|
+
await CardCompute.run(computeNode, { sourcesData });
|
|
12396
|
+
}
|
|
12397
|
+
const providesData = {};
|
|
12398
|
+
if (card.provides && card.provides.length > 0) {
|
|
12399
|
+
for (const { bindTo, src } of card.provides) {
|
|
12400
|
+
providesData[bindTo] = CardCompute.resolve(computeNode, src);
|
|
12401
|
+
}
|
|
12402
|
+
} else {
|
|
12403
|
+
providesData[card.id] = {
|
|
12404
|
+
...computeNode.card_data ?? {},
|
|
12405
|
+
...computeNode.computed_values ?? {},
|
|
12406
|
+
...computeNode._sourcesData ?? {}
|
|
12407
|
+
};
|
|
12408
|
+
}
|
|
12409
|
+
const resultData = {
|
|
12410
|
+
provides_data: providesData,
|
|
12411
|
+
card_data: computeNode.card_data ?? {},
|
|
12412
|
+
computed_values: computeNode.computed_values ?? {},
|
|
12413
|
+
fetched_sources: sourcesData,
|
|
12414
|
+
requires: requiresData
|
|
12415
|
+
};
|
|
12416
|
+
graphRef?.resolveCallback(inputArgs.callbackToken, resultData);
|
|
12417
|
+
return "task-initiated";
|
|
12418
|
+
};
|
|
12419
|
+
};
|
|
12420
|
+
const tasks = {};
|
|
12421
|
+
const handlers = {};
|
|
12422
|
+
for (const [cardId, card] of cards.entries()) {
|
|
12423
|
+
validateRequires(cards, cardId);
|
|
12424
|
+
tasks[cardId] = toTaskConfig(card);
|
|
12425
|
+
handlers[cardId] = makeHandler(cardId);
|
|
12426
|
+
}
|
|
12427
|
+
const config = {
|
|
12428
|
+
id: boardMeta.id ?? `browser-board-${Date.now()}`,
|
|
12429
|
+
settings: {
|
|
12430
|
+
completion: "manual",
|
|
12431
|
+
execution_mode: "eligibility-mode",
|
|
12432
|
+
...boardMeta.settings ?? {},
|
|
12433
|
+
...options.graphSettings ?? {}
|
|
12434
|
+
},
|
|
12435
|
+
tasks
|
|
12436
|
+
};
|
|
12437
|
+
const userOnDrain = options.reactiveOptions?.onDrain;
|
|
12438
|
+
const graph = createReactiveGraph(
|
|
12439
|
+
config,
|
|
12440
|
+
{
|
|
12441
|
+
...options.reactiveOptions ?? {},
|
|
12442
|
+
handlers,
|
|
12443
|
+
onDrain: (events, live, scheduleResult) => {
|
|
12444
|
+
userOnDrain?.(events, live, scheduleResult);
|
|
12445
|
+
notifyListeners(events, live);
|
|
12446
|
+
}
|
|
12447
|
+
},
|
|
12448
|
+
options.executionId
|
|
12449
|
+
);
|
|
12450
|
+
graphRef = graph;
|
|
12451
|
+
function getRenderableNodes() {
|
|
12452
|
+
const live = graph.getState();
|
|
12453
|
+
const out = [];
|
|
12454
|
+
for (const [cardId, baseCard] of cards.entries()) {
|
|
12455
|
+
const data = live.state.tasks[cardId]?.data;
|
|
12456
|
+
const runtimeState = live.state.tasks[cardId];
|
|
12457
|
+
const mergedCardData = {
|
|
12458
|
+
...baseCard.card_data ?? {},
|
|
12459
|
+
...data && typeof data.card_data === "object" ? data.card_data : {}
|
|
12460
|
+
};
|
|
12461
|
+
const cardStatus = runtimeState?.status === "running" ? "loading" : runtimeState?.status;
|
|
12462
|
+
const cardDataForView = {
|
|
12463
|
+
...mergedCardData,
|
|
12464
|
+
...cardStatus ? { status: cardStatus } : {},
|
|
12465
|
+
...runtimeState?.lastUpdated ? { lastRun: runtimeState.lastUpdated } : {},
|
|
12466
|
+
...runtimeState?.status === "failed" && runtimeState.error ? { error: runtimeState.error } : {}
|
|
12467
|
+
};
|
|
12468
|
+
out.push({
|
|
12469
|
+
id: cardId,
|
|
12470
|
+
card: deepClone(baseCard),
|
|
12471
|
+
card_data: cardDataForView,
|
|
12472
|
+
fetched_sources: data && typeof data.fetched_sources === "object" ? deepClone(data.fetched_sources) : {},
|
|
12473
|
+
requires: data && typeof data.requires === "object" ? deepClone(data.requires) : {},
|
|
12474
|
+
computed_values: data && typeof data.computed_values === "object" ? deepClone(data.computed_values) : {},
|
|
12475
|
+
runtime_state: runtimeState ? deepClone(runtimeState) : {}
|
|
12476
|
+
});
|
|
12477
|
+
}
|
|
12478
|
+
return out;
|
|
12479
|
+
}
|
|
12480
|
+
const runtime = {
|
|
12481
|
+
getGraph: () => graph,
|
|
12482
|
+
getState: () => graph.getState(),
|
|
12483
|
+
getSchedule: () => graph.getSchedule(),
|
|
12484
|
+
getNodes: () => getRenderableNodes(),
|
|
12485
|
+
getBoard: () => ({
|
|
12486
|
+
...boardMeta,
|
|
12487
|
+
nodes: getRenderableNodes()
|
|
12488
|
+
}),
|
|
12489
|
+
subscribe(listener) {
|
|
12490
|
+
listeners.add(listener);
|
|
12491
|
+
listener({ events: [], graph: graph.getState(), nodes: getRenderableNodes() });
|
|
12492
|
+
return () => listeners.delete(listener);
|
|
12493
|
+
},
|
|
12494
|
+
addCard(card) {
|
|
12495
|
+
if (cards.has(card.id)) throw new Error(`Card "${card.id}" already exists`);
|
|
12496
|
+
cards.set(card.id, deepClone(card));
|
|
12497
|
+
validateRequires(cards, card.id);
|
|
12498
|
+
graph.registerHandler(card.id, makeHandler(card.id));
|
|
12499
|
+
graph.addNode(card.id, toTaskConfig(card));
|
|
12500
|
+
},
|
|
12501
|
+
upsertCard(card) {
|
|
12502
|
+
cards.set(card.id, deepClone(card));
|
|
12503
|
+
validateRequires(cards, card.id);
|
|
12504
|
+
graph.registerHandler(card.id, makeHandler(card.id));
|
|
12505
|
+
graph.addNode(card.id, toTaskConfig(card));
|
|
12506
|
+
},
|
|
12507
|
+
removeCard(cardId) {
|
|
12508
|
+
cards.delete(cardId);
|
|
12509
|
+
graph.unregisterHandler(cardId);
|
|
12510
|
+
graph.removeNode(cardId);
|
|
12511
|
+
},
|
|
12512
|
+
patchCardState(cardId, patch) {
|
|
12513
|
+
const card = cards.get(cardId);
|
|
12514
|
+
if (!card) throw new Error(`Card "${cardId}" not found`);
|
|
12515
|
+
card.card_data = { ...card.card_data ?? {}, ...patch };
|
|
12516
|
+
graph.retrigger(cardId);
|
|
12517
|
+
},
|
|
12518
|
+
retrigger(cardId) {
|
|
12519
|
+
graph.retrigger(cardId);
|
|
12520
|
+
},
|
|
12521
|
+
retriggerAll() {
|
|
12522
|
+
graph.retriggerAll(Array.from(cards.keys()));
|
|
12523
|
+
},
|
|
12524
|
+
push(event) {
|
|
12525
|
+
graph.push(event);
|
|
12526
|
+
},
|
|
12527
|
+
pushAll(events) {
|
|
12528
|
+
graph.pushAll(events);
|
|
12529
|
+
},
|
|
12530
|
+
dispose() {
|
|
12531
|
+
listeners.clear();
|
|
12532
|
+
graph.dispose();
|
|
12533
|
+
}
|
|
12534
|
+
};
|
|
12535
|
+
return runtime;
|
|
12536
|
+
}
|
|
12537
|
+
|
|
11344
12538
|
// src/inference/core.ts
|
|
11345
12539
|
var DEFAULT_THRESHOLD = 0.5;
|
|
11346
12540
|
var DEFAULT_SYSTEM_PROMPT = `You are a workflow completion analyzer. Given a graph of tasks with their current states, evidence, and inference hints, determine which tasks appear to be completed based on the available evidence.
|
|
@@ -11592,6 +12786,190 @@ function createHttpAdapter(opts) {
|
|
|
11592
12786
|
};
|
|
11593
12787
|
}
|
|
11594
12788
|
|
|
12789
|
+
// schema/board-status.schema.json
|
|
12790
|
+
var board_status_schema_default = {
|
|
12791
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
12792
|
+
$id: "https://yaml-flow.dev/schema/board-status.schema.json",
|
|
12793
|
+
title: "Board Status Object",
|
|
12794
|
+
type: "object",
|
|
12795
|
+
additionalProperties: false,
|
|
12796
|
+
required: ["schema_version", "meta", "summary", "cards"],
|
|
12797
|
+
properties: {
|
|
12798
|
+
schema_version: {
|
|
12799
|
+
type: "string",
|
|
12800
|
+
const: "v1"
|
|
12801
|
+
},
|
|
12802
|
+
meta: {
|
|
12803
|
+
type: "object",
|
|
12804
|
+
additionalProperties: false,
|
|
12805
|
+
required: ["board"],
|
|
12806
|
+
properties: {
|
|
12807
|
+
board: {
|
|
12808
|
+
type: "object",
|
|
12809
|
+
additionalProperties: false,
|
|
12810
|
+
required: ["path"],
|
|
12811
|
+
properties: {
|
|
12812
|
+
path: { type: "string" }
|
|
12813
|
+
}
|
|
12814
|
+
}
|
|
12815
|
+
}
|
|
12816
|
+
},
|
|
12817
|
+
summary: {
|
|
12818
|
+
type: "object",
|
|
12819
|
+
additionalProperties: false,
|
|
12820
|
+
required: ["card_count", "completed", "eligible", "pending", "blocked", "unresolved"],
|
|
12821
|
+
properties: {
|
|
12822
|
+
card_count: { type: "integer", minimum: 0 },
|
|
12823
|
+
completed: { type: "integer", minimum: 0 },
|
|
12824
|
+
eligible: { type: "integer", minimum: 0 },
|
|
12825
|
+
pending: { type: "integer", minimum: 0 },
|
|
12826
|
+
blocked: { type: "integer", minimum: 0 },
|
|
12827
|
+
unresolved: { type: "integer", minimum: 0 },
|
|
12828
|
+
failed: { type: "integer", minimum: 0 },
|
|
12829
|
+
in_progress: { type: "integer", minimum: 0 },
|
|
12830
|
+
orphan_cards: { type: "integer", minimum: 0 },
|
|
12831
|
+
topology: {
|
|
12832
|
+
type: "object",
|
|
12833
|
+
additionalProperties: false,
|
|
12834
|
+
required: ["edge_count", "max_fan_out_card", "max_fan_out"],
|
|
12835
|
+
properties: {
|
|
12836
|
+
edge_count: { type: "integer", minimum: 0 },
|
|
12837
|
+
max_fan_out_card: { type: ["string", "null"] },
|
|
12838
|
+
max_fan_out: { type: "integer", minimum: 0 }
|
|
12839
|
+
}
|
|
12840
|
+
}
|
|
12841
|
+
}
|
|
12842
|
+
},
|
|
12843
|
+
cards: {
|
|
12844
|
+
type: "array",
|
|
12845
|
+
items: {
|
|
12846
|
+
type: "object",
|
|
12847
|
+
additionalProperties: false,
|
|
12848
|
+
required: [
|
|
12849
|
+
"name",
|
|
12850
|
+
"status",
|
|
12851
|
+
"requires",
|
|
12852
|
+
"requires_satisfied",
|
|
12853
|
+
"requires_missing",
|
|
12854
|
+
"provides_declared",
|
|
12855
|
+
"provides_runtime",
|
|
12856
|
+
"blocked_by",
|
|
12857
|
+
"unblocks",
|
|
12858
|
+
"runtime"
|
|
12859
|
+
],
|
|
12860
|
+
properties: {
|
|
12861
|
+
name: { type: "string" },
|
|
12862
|
+
status: { type: "string" },
|
|
12863
|
+
error: {
|
|
12864
|
+
type: "object",
|
|
12865
|
+
additionalProperties: false,
|
|
12866
|
+
required: ["message"],
|
|
12867
|
+
properties: {
|
|
12868
|
+
message: { type: "string" },
|
|
12869
|
+
code: { type: "string" },
|
|
12870
|
+
at: { type: ["string", "null"] },
|
|
12871
|
+
source: { type: "string" }
|
|
12872
|
+
}
|
|
12873
|
+
},
|
|
12874
|
+
requires: { type: "array", items: { type: "string" } },
|
|
12875
|
+
requires_satisfied: { type: "array", items: { type: "string" } },
|
|
12876
|
+
requires_missing: { type: "array", items: { type: "string" } },
|
|
12877
|
+
provides_declared: { type: "array", items: { type: "string" } },
|
|
12878
|
+
provides_runtime: { type: "array", items: { type: "string" } },
|
|
12879
|
+
blocked_by: { type: "array", items: { type: "string" } },
|
|
12880
|
+
unblocks: { type: "array", items: { type: "string" } },
|
|
12881
|
+
runtime: {
|
|
12882
|
+
type: "object",
|
|
12883
|
+
additionalProperties: false,
|
|
12884
|
+
required: [
|
|
12885
|
+
"attempt_count",
|
|
12886
|
+
"restart_count",
|
|
12887
|
+
"in_progress_since",
|
|
12888
|
+
"last_transition_at",
|
|
12889
|
+
"last_completed_at",
|
|
12890
|
+
"last_restarted_at",
|
|
12891
|
+
"status_age_ms"
|
|
12892
|
+
],
|
|
12893
|
+
properties: {
|
|
12894
|
+
attempt_count: { type: "integer", minimum: 0 },
|
|
12895
|
+
restart_count: { type: "integer", minimum: 0 },
|
|
12896
|
+
in_progress_since: { type: ["string", "null"] },
|
|
12897
|
+
last_transition_at: { type: ["string", "null"] },
|
|
12898
|
+
last_completed_at: { type: ["string", "null"] },
|
|
12899
|
+
last_restarted_at: { type: ["string", "null"] },
|
|
12900
|
+
status_age_ms: { type: ["integer", "null"], minimum: 0 }
|
|
12901
|
+
}
|
|
12902
|
+
}
|
|
12903
|
+
}
|
|
12904
|
+
}
|
|
12905
|
+
}
|
|
12906
|
+
}
|
|
12907
|
+
};
|
|
12908
|
+
|
|
12909
|
+
// schema/card-runtime.schema.json
|
|
12910
|
+
var card_runtime_schema_default = {
|
|
12911
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
12912
|
+
$id: "https://yaml-flow.dev/schema/card-runtime.schema.json",
|
|
12913
|
+
title: "Card Runtime Computed Artifact",
|
|
12914
|
+
description: "Published per-card runtime artifact written to runtime-out/cards/<card-id>.computed.json. Contains only values produced by the compute step.",
|
|
12915
|
+
type: "object",
|
|
12916
|
+
required: ["schema_version", "card_id", "computed_values"],
|
|
12917
|
+
additionalProperties: false,
|
|
12918
|
+
properties: {
|
|
12919
|
+
schema_version: {
|
|
12920
|
+
type: "string",
|
|
12921
|
+
const: "v1",
|
|
12922
|
+
description: "Artifact schema version."
|
|
12923
|
+
},
|
|
12924
|
+
card_id: {
|
|
12925
|
+
type: "string",
|
|
12926
|
+
description: "The ID of the card this artifact belongs to."
|
|
12927
|
+
},
|
|
12928
|
+
computed_values: {
|
|
12929
|
+
type: "object",
|
|
12930
|
+
description: "Key/value map of outputs produced by the card's JSONata compute steps.",
|
|
12931
|
+
additionalProperties: true
|
|
12932
|
+
}
|
|
12933
|
+
}
|
|
12934
|
+
};
|
|
12935
|
+
|
|
12936
|
+
// src/runtime-artifacts/schema-validator.ts
|
|
12937
|
+
var import__ = __toESM(require__());
|
|
12938
|
+
var boardStatusValidator = null;
|
|
12939
|
+
var cardRuntimeValidator = null;
|
|
12940
|
+
function createAjv() {
|
|
12941
|
+
const ajv = new import__.default({ allErrors: true, strict: false });
|
|
12942
|
+
addFormats__default.default(ajv);
|
|
12943
|
+
return ajv;
|
|
12944
|
+
}
|
|
12945
|
+
function toValidationResult(validate) {
|
|
12946
|
+
const errors = (validate.errors ?? []).map((error) => {
|
|
12947
|
+
const instancePath = error.instancePath || "/";
|
|
12948
|
+
return `${instancePath}: ${error.message ?? "unknown error"}`;
|
|
12949
|
+
});
|
|
12950
|
+
return { ok: false, errors };
|
|
12951
|
+
}
|
|
12952
|
+
function getBoardStatusValidator() {
|
|
12953
|
+
if (boardStatusValidator) return boardStatusValidator;
|
|
12954
|
+
boardStatusValidator = createAjv().compile(board_status_schema_default);
|
|
12955
|
+
return boardStatusValidator;
|
|
12956
|
+
}
|
|
12957
|
+
function getCardRuntimeValidator() {
|
|
12958
|
+
if (cardRuntimeValidator) return cardRuntimeValidator;
|
|
12959
|
+
cardRuntimeValidator = createAjv().compile(card_runtime_schema_default);
|
|
12960
|
+
return cardRuntimeValidator;
|
|
12961
|
+
}
|
|
12962
|
+
function validateBoardStatusSchema(statusObject) {
|
|
12963
|
+
const validate = getBoardStatusValidator();
|
|
12964
|
+
if (validate(statusObject)) return { ok: true, errors: [] };
|
|
12965
|
+
return toValidationResult(validate);
|
|
12966
|
+
}
|
|
12967
|
+
function validateCardRuntimeSchema(cardRuntimeObject) {
|
|
12968
|
+
const validate = getCardRuntimeValidator();
|
|
12969
|
+
if (validate(cardRuntimeObject)) return { ok: true, errors: [] };
|
|
12970
|
+
return toValidationResult(validate);
|
|
12971
|
+
}
|
|
12972
|
+
|
|
11595
12973
|
exports.COMPLETION_STRATEGIES = COMPLETION_STRATEGIES;
|
|
11596
12974
|
exports.CONFLICT_STRATEGIES = CONFLICT_STRATEGIES;
|
|
11597
12975
|
exports.CardCompute = CardCompute;
|
|
@@ -11620,6 +12998,7 @@ exports.buildInferencePrompt = buildInferencePrompt;
|
|
|
11620
12998
|
exports.checkCircuitBreaker = checkCircuitBreaker;
|
|
11621
12999
|
exports.computeAvailableOutputs = computeAvailableOutputs;
|
|
11622
13000
|
exports.computeStepInput = computeStepInput;
|
|
13001
|
+
exports.createBoardLiveGraphRuntime = createBoardLiveGraphRuntime;
|
|
11623
13002
|
exports.createCallbackHandler = createCallbackHandler;
|
|
11624
13003
|
exports.createCliAdapter = createCliAdapter;
|
|
11625
13004
|
exports.createDefaultGraphEngineStore = createDefaultGraphEngineStore;
|
|
@@ -11681,10 +13060,15 @@ exports.resolveVariables = resolveVariables;
|
|
|
11681
13060
|
exports.restore = restore;
|
|
11682
13061
|
exports.schedule = schedule;
|
|
11683
13062
|
exports.snapshot = snapshot;
|
|
13063
|
+
exports.validateBoardStatusSchema = validateBoardStatusSchema;
|
|
13064
|
+
exports.validateCardRuntimeSchema = validateCardRuntimeSchema;
|
|
11684
13065
|
exports.validateFlowSchema = validateFlowSchema;
|
|
11685
13066
|
exports.validateGraph = validateGraph;
|
|
11686
13067
|
exports.validateGraphConfig = validateGraphConfig;
|
|
11687
13068
|
exports.validateGraphSchema = validateGraphSchema;
|
|
13069
|
+
exports.validateLiveCard = validateLiveCard;
|
|
13070
|
+
exports.validateLiveCardDefinition = validateLiveCardDefinition;
|
|
13071
|
+
exports.validateLiveCardRuntimeExpressions = validateLiveCardRuntimeExpressions;
|
|
11688
13072
|
exports.validateLiveCardSchema = validateLiveCardSchema;
|
|
11689
13073
|
exports.validateLiveGraph = validateLiveGraph;
|
|
11690
13074
|
exports.validateReactiveGraph = validateReactiveGraph;
|