capdag 0.153.347 → 0.158.370
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/build-browser.js +15 -15
- package/{cap-graph-renderer.js → cap-fab-renderer.js} +78 -78
- package/capdag.js +455 -23
- package/capdag.test.js +26 -26
- package/package.json +2 -2
package/capdag.test.js
CHANGED
|
@@ -8,7 +8,7 @@ const {
|
|
|
8
8
|
Cap, MediaSpec, MediaSpecError, MediaSpecErrorCodes,
|
|
9
9
|
resolveMediaUrn, buildExtensionIndex, mediaUrnsForExtension, getExtensionMappings,
|
|
10
10
|
CartridgeInfo, CartridgeCapSummary, CartridgeSuggestion, CartridgeRepoClient, CartridgeRepoServer,
|
|
11
|
-
|
|
11
|
+
CapFabEdge, CapFabStats, CapFab,
|
|
12
12
|
StdinSource, StdinSourceKind,
|
|
13
13
|
validateNoMediaSpecRedefinitionSync,
|
|
14
14
|
CapArgumentValue, CapArg, ArgSource, validateCapArgs, ValidationError,
|
|
@@ -1144,12 +1144,12 @@ function test110_multipleExtensions() {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
|
|
1146
1146
|
// ============================================================================
|
|
1147
|
-
//
|
|
1147
|
+
// cap_fab: browse-mode API used by cap-fab-renderer.js
|
|
1148
1148
|
//
|
|
1149
1149
|
// The renderer builds its browse graph by:
|
|
1150
|
-
// const
|
|
1151
|
-
// for each cap in /api/capabilities:
|
|
1152
|
-
// ... then reads
|
|
1150
|
+
// const capFab = new CapFab();
|
|
1151
|
+
// for each cap in /api/capabilities: capFab.addCap(cap, 'registry');
|
|
1152
|
+
// ... then reads capFab.edges / getOutgoing(urn) / etc.
|
|
1153
1153
|
//
|
|
1154
1154
|
// These tests lock in that specific contract. They do NOT cover
|
|
1155
1155
|
// buildFromRegistries / CapMatrix / CapBlock — all deleted with the dead
|
|
@@ -1158,8 +1158,8 @@ function test110_multipleExtensions() {
|
|
|
1158
1158
|
|
|
1159
1159
|
// Add a cap and check it becomes an edge with from/to nodes and carries the
|
|
1160
1160
|
// registry name we passed. This is exactly the shape the renderer depends on.
|
|
1161
|
-
function
|
|
1162
|
-
const graph = new
|
|
1161
|
+
function testCapFabAddCapPopulatesEdgesAndNodes() {
|
|
1162
|
+
const graph = new CapFab();
|
|
1163
1163
|
const cap = makeGraphCap('media:pdf', 'media:textable', 'PDF to Text');
|
|
1164
1164
|
graph.addCap(cap, 'registry');
|
|
1165
1165
|
|
|
@@ -1176,8 +1176,8 @@ function testCapGraphAddCapPopulatesEdgesAndNodes() {
|
|
|
1176
1176
|
|
|
1177
1177
|
// getOutgoing takes a concrete source URN and returns edges whose from_spec
|
|
1178
1178
|
// the source conforms to. It must NOT be a plain string lookup.
|
|
1179
|
-
function
|
|
1180
|
-
const graph = new
|
|
1179
|
+
function testCapFabGetOutgoingConformsToMatching() {
|
|
1180
|
+
const graph = new CapFab();
|
|
1181
1181
|
graph.addCap(makeGraphCap('media:textable', 'media:embedding-vector', 'Embed text'), 'registry');
|
|
1182
1182
|
|
|
1183
1183
|
// 'media:txt;textable' conforms to 'media:textable' — renderer relies on
|
|
@@ -1197,8 +1197,8 @@ function testCapGraphGetOutgoingConformsToMatching() {
|
|
|
1197
1197
|
|
|
1198
1198
|
// Each edge must carry the registry name it was added with. This is how
|
|
1199
1199
|
// the renderer colours/groups edges by provenance in browse mode.
|
|
1200
|
-
function
|
|
1201
|
-
const graph = new
|
|
1200
|
+
function testCapFabDistinctRegistryNames() {
|
|
1201
|
+
const graph = new CapFab();
|
|
1202
1202
|
graph.addCap(makeGraphCap('media:pdf', 'media:textable', 'PDF to Text'), 'providers');
|
|
1203
1203
|
graph.addCap(makeGraphCap('media:textable', 'media:embedding-vector', 'Embed'), 'cartridges');
|
|
1204
1204
|
|
|
@@ -3665,7 +3665,7 @@ function assertThrowsWithCode(fn, expectedCode) {
|
|
|
3665
3665
|
}
|
|
3666
3666
|
|
|
3667
3667
|
// ============================================================================
|
|
3668
|
-
// cap-
|
|
3668
|
+
// cap-fab-renderer helpers — pure functions that do not require a DOM.
|
|
3669
3669
|
// The renderer class itself needs cytoscape + DOM and is exercised by hand
|
|
3670
3670
|
// in the browser; these tests cover the pure data transforms underneath it.
|
|
3671
3671
|
// ============================================================================
|
|
@@ -3688,7 +3688,7 @@ const {
|
|
|
3688
3688
|
validateResolvedMachinePayload: rendererValidateResolvedMachinePayload,
|
|
3689
3689
|
validateStrandStep: rendererValidateStrandStep,
|
|
3690
3690
|
validateBodyOutcome: rendererValidateBodyOutcome,
|
|
3691
|
-
} = require('./cap-
|
|
3691
|
+
} = require('./cap-fab-renderer.js');
|
|
3692
3692
|
|
|
3693
3693
|
// The renderer module reads its dependencies off `window` or `global` at
|
|
3694
3694
|
// call time (it is browser-first). Node has no window, so we install the
|
|
@@ -3700,7 +3700,7 @@ if (typeof global.TaggedUrn === 'undefined') {
|
|
|
3700
3700
|
if (typeof global.MediaUrn === 'undefined') global.MediaUrn = MediaUrn;
|
|
3701
3701
|
if (typeof global.CapUrn === 'undefined') global.CapUrn = CapUrn;
|
|
3702
3702
|
if (typeof global.Cap === 'undefined') global.Cap = Cap;
|
|
3703
|
-
if (typeof global.
|
|
3703
|
+
if (typeof global.CapFab === 'undefined') global.CapFab = CapFab;
|
|
3704
3704
|
// Reference the top-of-file destructured createCap via the module export.
|
|
3705
3705
|
if (typeof global.createCap === 'undefined') {
|
|
3706
3706
|
global.createCap = require('./capdag.js').createCap;
|
|
@@ -5369,13 +5369,13 @@ async function runTests() {
|
|
|
5369
5369
|
runTest('TEST109: extensions_with_metadata_and_validation', test109_extensionsWithMetadataAndValidation);
|
|
5370
5370
|
runTest('TEST110: multiple_extensions', test110_multipleExtensions);
|
|
5371
5371
|
|
|
5372
|
-
// cap-
|
|
5372
|
+
// cap-fab-renderer.js uses CapFab in browse mode (static registry from
|
|
5373
5373
|
// /api/capabilities). These tests guard the minimal API the renderer relies
|
|
5374
|
-
// on: new
|
|
5375
|
-
console.log('\n---
|
|
5376
|
-
runTest('
|
|
5377
|
-
runTest('
|
|
5378
|
-
runTest('
|
|
5374
|
+
// on: new CapFab(), addCap(cap, registryName), getEdges(), getOutgoing().
|
|
5375
|
+
console.log('\n--- cap_fab (browse-mode API used by cap-fab-renderer) ---');
|
|
5376
|
+
runTest('cap_fab: add_cap_populates_edges_and_nodes', testCapFabAddCapPopulatesEdgesAndNodes);
|
|
5377
|
+
runTest('cap_fab: get_outgoing_conforms_to_matching', testCapFabGetOutgoingConformsToMatching);
|
|
5378
|
+
runTest('cap_fab: distinct_registry_names_recorded_per_edge', testCapFabDistinctRegistryNames);
|
|
5379
5379
|
|
|
5380
5380
|
// caller.rs: TEST156-TEST159
|
|
5381
5381
|
console.log('\n--- caller.rs (StdinSource) ---');
|
|
@@ -5591,8 +5591,8 @@ async function runTests() {
|
|
|
5591
5591
|
runTest('REGISTRY: capRegistryClient_construction', testMachine_capRegistryClient_construction);
|
|
5592
5592
|
runTest('REGISTRY: capRegistryEntry_defaults', testMachine_capRegistryEntry_defaults);
|
|
5593
5593
|
|
|
5594
|
-
// cap-
|
|
5595
|
-
console.log('\n--- cap-
|
|
5594
|
+
// cap-fab-renderer pure helpers (no DOM dependency)
|
|
5595
|
+
console.log('\n--- cap-fab-renderer helpers ---');
|
|
5596
5596
|
runTest('RENDERER: cardinalityLabel_allFourCases', testRenderer_cardinalityLabel_allFourCases);
|
|
5597
5597
|
runTest('RENDERER: cardinalityLabel_usesUnicodeArrow', testRenderer_cardinalityLabel_usesUnicodeArrow);
|
|
5598
5598
|
runTest('RENDERER: cardinalityFromCap_findsStdinArg', testRenderer_cardinalityFromCap_findsStdinArgNotFirstArg);
|
|
@@ -5606,7 +5606,7 @@ async function runTests() {
|
|
|
5606
5606
|
runTest('RENDERER: mediaNodeLabel_rejectsUrnDerived', testRenderer_mediaNodeLabel_rejectsUrnDerivedLabels);
|
|
5607
5607
|
runTest('RENDERER: buildBrowse_rejectsMissingMediaTitles', testRenderer_buildBrowseGraphData_rejectsMissingMediaTitles);
|
|
5608
5608
|
|
|
5609
|
-
console.log('\n--- cap-
|
|
5609
|
+
console.log('\n--- cap-fab-renderer strand builder ---');
|
|
5610
5610
|
runTest('RENDERER: validateStrandStep_unknownVariant', testRenderer_validateStrandStep_rejectsUnknownVariant);
|
|
5611
5611
|
runTest('RENDERER: validateStrandStep_booleanIsSequence', testRenderer_validateStrandStep_requiresBooleanIsSequence);
|
|
5612
5612
|
runTest('RENDERER: classifyStrandCapSteps_simple', testRenderer_classifyStrandCapSteps_capFlags);
|
|
@@ -5625,7 +5625,7 @@ async function runTests() {
|
|
|
5625
5625
|
runTest('RENDERER: collapseStrand_plainCapDistinctTarget', testRenderer_collapseStrand_plainCapDistinctTargetNoMerge);
|
|
5626
5626
|
runTest('RENDERER: validateStrand_missingSourceSpec', testRenderer_validateStrandPayload_missingSourceSpec);
|
|
5627
5627
|
|
|
5628
|
-
console.log('\n--- cap-
|
|
5628
|
+
console.log('\n--- cap-fab-renderer run builder ---');
|
|
5629
5629
|
runTest('RENDERER: validateBodyOutcome_negativeIndex', testRenderer_validateBodyOutcome_rejectsNegativeIndex);
|
|
5630
5630
|
runTest('RENDERER: buildRun_pagesSuccessesAndFailures', testRenderer_buildRunGraphData_pagesSuccessesAndFailures);
|
|
5631
5631
|
runTest('RENDERER: buildRun_failureWithoutFailedCap', testRenderer_buildRunGraphData_failureWithoutFailedCapRendersFullTrace);
|
|
@@ -5635,7 +5635,7 @@ async function runTests() {
|
|
|
5635
5635
|
runTest('RENDERER: buildRun_unclosedForeachNoMerge', testRenderer_buildRunGraphData_unclosedForeachSuccessNoMerge);
|
|
5636
5636
|
runTest('RENDERER: buildRun_closedForeachMerges', testRenderer_buildRunGraphData_closedForeachSuccessMergesAtCollectTarget);
|
|
5637
5637
|
|
|
5638
|
-
console.log('\n--- cap-
|
|
5638
|
+
console.log('\n--- cap-fab-renderer editor-graph builder ---');
|
|
5639
5639
|
runTest('RENDERER: validateEditorGraph_unknownKind', testRenderer_validateEditorGraphPayload_rejectsUnknownKind);
|
|
5640
5640
|
runTest('RENDERER: buildEditorGraph_collapsesCapsIntoEdges', testRenderer_buildEditorGraphData_collapsesCapsIntoLabeledEdges);
|
|
5641
5641
|
runTest('RENDERER: buildEditorGraph_loopEdgeGetsClass', testRenderer_buildEditorGraphData_loopMarkedEdgeGetsLoopClass);
|
|
@@ -5643,7 +5643,7 @@ async function runTests() {
|
|
|
5643
5643
|
runTest('RENDERER: buildEditorGraph_incompleteCapDropped', testRenderer_buildEditorGraphData_capWithoutCompleteArgsIsDropped);
|
|
5644
5644
|
runTest('RENDERER: buildEditorGraph_rejectsEdgeMissingSrc', testRenderer_buildEditorGraphData_rejectsEdgeWithMissingSource);
|
|
5645
5645
|
|
|
5646
|
-
console.log('\n--- cap-
|
|
5646
|
+
console.log('\n--- cap-fab-renderer resolved-machine builder ---');
|
|
5647
5647
|
runTest('RENDERER: buildResolvedMachine_singleStrandLinear', testRenderer_buildResolvedMachineGraphData_singleStrandLinearChain);
|
|
5648
5648
|
runTest('RENDERER: buildResolvedMachine_loopGetsLoopClass', testRenderer_buildResolvedMachineGraphData_loopEdgeGetsLoopClass);
|
|
5649
5649
|
runTest('RENDERER: buildResolvedMachine_fanInOneEdgePerSrc', testRenderer_buildResolvedMachineGraphData_fanInProducesEdgePerAssignment);
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"capdag.js",
|
|
13
|
-
"cap-
|
|
13
|
+
"cap-fab-renderer.js",
|
|
14
14
|
"build-browser.js",
|
|
15
15
|
"capdag.test.js",
|
|
16
16
|
"machine.pegjs",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"pretest": "npm run build:parser",
|
|
41
41
|
"test": "node capdag.test.js"
|
|
42
42
|
},
|
|
43
|
-
"version": "0.
|
|
43
|
+
"version": "0.158.370"
|
|
44
44
|
}
|