@shardworks/astrolabe-apparatus 0.1.268 → 0.1.269
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shardworks/astrolabe-apparatus",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.269",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"zod": "4.3.6",
|
|
23
|
-
"@shardworks/stacks-apparatus": "0.1.
|
|
24
|
-
"@shardworks/
|
|
25
|
-
"@shardworks/
|
|
26
|
-
"@shardworks/
|
|
27
|
-
"@shardworks/
|
|
28
|
-
"@shardworks/
|
|
29
|
-
"@shardworks/animator-apparatus": "0.1.
|
|
23
|
+
"@shardworks/stacks-apparatus": "0.1.269",
|
|
24
|
+
"@shardworks/clerk-apparatus": "0.1.269",
|
|
25
|
+
"@shardworks/spider-apparatus": "0.1.269",
|
|
26
|
+
"@shardworks/tools-apparatus": "0.1.269",
|
|
27
|
+
"@shardworks/fabricator-apparatus": "0.1.269",
|
|
28
|
+
"@shardworks/loom-apparatus": "0.1.269",
|
|
29
|
+
"@shardworks/animator-apparatus": "0.1.269"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "25.5.0",
|
|
33
|
-
"@shardworks/nexus-core": "0.1.
|
|
33
|
+
"@shardworks/nexus-core": "0.1.269"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"dist",
|
|
@@ -378,10 +378,9 @@
|
|
|
378
378
|
function fetchCostData(planId) {
|
|
379
379
|
var costEl = document.getElementById('cost-summary');
|
|
380
380
|
|
|
381
|
-
fetch('/api/rig/
|
|
381
|
+
fetch('/api/rig/for-writ?writId=' + encodeURIComponent(planId))
|
|
382
382
|
.then(function (r) { return r.json(); })
|
|
383
|
-
.then(function (
|
|
384
|
-
var rig = rigs.find(function (r) { return r.writId === planId; });
|
|
383
|
+
.then(function (rig) {
|
|
385
384
|
if (!rig) {
|
|
386
385
|
renderCostUnavailable(costEl);
|
|
387
386
|
return;
|
|
@@ -656,3 +656,55 @@ describe('astrolabe.js cost table delegates to window.NexusFormat', () => {
|
|
|
656
656
|
);
|
|
657
657
|
});
|
|
658
658
|
});
|
|
659
|
+
|
|
660
|
+
// ── Cost-panel rig lookup is not window-blind ────────────────────────
|
|
661
|
+
|
|
662
|
+
describe('astrolabe.js cost-panel rig lookup uses rig-for-writ', () => {
|
|
663
|
+
// Regression guard: the cost panel historically fetched
|
|
664
|
+
// `/api/rig/list?limit=100` and client-side `.find()`d the plan's rig by
|
|
665
|
+
// writId. Any plan whose rig had aged out of the newest 100 silently
|
|
666
|
+
// rendered "Cost data not available". The replacement endpoint
|
|
667
|
+
// `/api/rig/for-writ?writId=<planId>` does a direct server-side lookup
|
|
668
|
+
// with no list window. Pin the new endpoint in the cost-data function
|
|
669
|
+
// and forbid the legacy list-and-find form within that same function
|
|
670
|
+
// body — scoped so future legitimate list-view fetches elsewhere on
|
|
671
|
+
// this page are not pre-empted.
|
|
672
|
+
const fetchCostDataMatch = astrolabeJs.match(
|
|
673
|
+
/function fetchCostData\([\s\S]*?\n \}/,
|
|
674
|
+
);
|
|
675
|
+
const fetchCostDataBody = fetchCostDataMatch ? fetchCostDataMatch[0] : '';
|
|
676
|
+
|
|
677
|
+
it('extracts the fetchCostData function body from source', () => {
|
|
678
|
+
assert.ok(
|
|
679
|
+
fetchCostDataBody,
|
|
680
|
+
'should find fetchCostData function body in astrolabe.js',
|
|
681
|
+
);
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
it('fetches the rig directly via /api/rig/for-writ with an encoded writId', () => {
|
|
685
|
+
assert.match(
|
|
686
|
+
fetchCostDataBody,
|
|
687
|
+
/\/api\/rig\/for-writ\?writId=['"]?\s*\+\s*encodeURIComponent\(planId\)/,
|
|
688
|
+
'cost-data path must fetch /api/rig/for-writ?writId=<encodeURIComponent(planId)>',
|
|
689
|
+
);
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
it('does not fetch the windowed /api/rig/list?limit=100 in the cost path', () => {
|
|
693
|
+
assert.doesNotMatch(
|
|
694
|
+
fetchCostDataBody,
|
|
695
|
+
/\/api\/rig\/list\?limit=100/,
|
|
696
|
+
'cost-data path must not fetch the windowed rig list — it silently hides aged-out rigs',
|
|
697
|
+
);
|
|
698
|
+
});
|
|
699
|
+
|
|
700
|
+
it('does not client-side .find() over an array of rigs in the cost path', () => {
|
|
701
|
+
// The for-writ endpoint returns a single RigDoc | null, so there is
|
|
702
|
+
// no array to scan. A defensive .find() wrapper would be cargo-cult
|
|
703
|
+
// and would hide any future contract break.
|
|
704
|
+
assert.doesNotMatch(
|
|
705
|
+
fetchCostDataBody,
|
|
706
|
+
/rigs\.find\(/,
|
|
707
|
+
'cost-data path must not .find() over a rigs array — the for-writ endpoint is singular',
|
|
708
|
+
);
|
|
709
|
+
});
|
|
710
|
+
});
|