Skip to content

Commit c32118f

Browse files
committed
wip
1 parent 14e2c37 commit c32118f

15 files changed

Lines changed: 818 additions & 112 deletions

File tree

packages/b2c-tooling-sdk/.c8rc.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
22
"all": true,
33
"src": ["src"],
4-
"exclude": ["src/clients/*.generated.ts", "test/**", "**/*.d.ts", "src/**/*types.ts", "src/operations/pipeline/generator/pipelets/**"],
4+
"exclude": [
5+
"src/clients/*.generated.ts",
6+
"test/**",
7+
"**/*.d.ts",
8+
"src/**/*types.ts",
9+
"src/operations/pipeline/generator/pipelets/**"
10+
],
511
"reporter": ["text", "text-summary", "html", "lcov"],
612
"report-dir": "coverage",
713
"check-coverage": true,
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import { parsePipeline, analyzePipeline } from './src/operations/pipeline/index.js';
2+
import * as fs from 'fs';
3+
4+
const xml = fs.readFileSync('/Users/clavery/code/sitegenesis/app_storefront_pipelines/cartridge/pipelines/Product.xml', 'utf-8');
5+
6+
async function main() {
7+
const pipeline = await parsePipeline(xml, 'Product');
8+
9+
// Find GetProduct start node
10+
let getProductStartId: string | undefined;
11+
for (const [id, node] of pipeline.nodes) {
12+
if (node.type === 'start' && node.name === 'GetProduct') {
13+
getProductStartId = id;
14+
console.log('GetProduct start node:', id);
15+
console.log(' transitions:', JSON.stringify(node.transitions, null, 2));
16+
break;
17+
}
18+
}
19+
20+
// Trace the path from GetProduct start
21+
if (getProductStartId) {
22+
console.log('\n=== Tracing GetProduct path ===');
23+
let currentId = getProductStartId;
24+
const visited = new Set<string>();
25+
26+
while (currentId && !visited.has(currentId)) {
27+
visited.add(currentId);
28+
const node = pipeline.nodes.get(currentId);
29+
if (!node) break;
30+
31+
console.log(`\nNode ${currentId}: ${node.type}`);
32+
if (node.type === 'decision') {
33+
console.log(' condition:', (node as any).condition);
34+
}
35+
if (node.type === 'pipelet') {
36+
console.log(' pipeletName:', (node as any).pipeletName);
37+
console.log(' hasErrorBranch:', (node as any).hasErrorBranch);
38+
}
39+
if (node.type === 'interaction') {
40+
console.log(' template:', (node as any).templateName);
41+
}
42+
if (node.type === 'end') {
43+
console.log(' name:', (node as any).name);
44+
}
45+
console.log(' transitions:', JSON.stringify(node.transitions, null, 2));
46+
47+
// Follow first/default transition
48+
currentId = node.transitions[0]?.targetId;
49+
}
50+
}
51+
52+
// Find all interaction nodes with error/notfound
53+
console.log('\n=== Interaction nodes with error/notfound ===');
54+
for (const [id, node] of pipeline.nodes) {
55+
if (node.type === 'interaction' && (node as any).templateName === 'error/notfound') {
56+
console.log('Found error/notfound:', id);
57+
// Find what leads to this node
58+
for (const [srcId, srcNode] of pipeline.nodes) {
59+
for (const t of srcNode.transitions) {
60+
if (t.targetId === id) {
61+
console.log(` <- from ${srcId} (${srcNode.type})`);
62+
}
63+
}
64+
}
65+
}
66+
}
67+
68+
// Run analysis
69+
console.log('\n=== Analysis ===');
70+
const analysis = analyzePipeline(pipeline);
71+
console.log('Total warnings:', analysis.warnings.length);
72+
for (const w of analysis.warnings) {
73+
console.log(' ', w);
74+
}
75+
}
76+
77+
main().catch(console.error);
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { parsePipeline, analyzePipeline } from './src/operations/pipeline/index.js';
2+
import * as fs from 'fs';
3+
4+
const xml = fs.readFileSync('/Users/clavery/code/sitegenesis/app_storefront_pipelines/cartridge/pipelines/Product.xml', 'utf-8');
5+
6+
async function main() {
7+
const pipeline = await parsePipeline(xml, 'Product');
8+
9+
// Trace node_22 path
10+
console.log('=== Tracing node_22 path (error path) ===');
11+
let currentId: string | undefined = 'node_22';
12+
const visited = new Set<string>();
13+
14+
while (currentId && !visited.has(currentId)) {
15+
visited.add(currentId);
16+
const node = pipeline.nodes.get(currentId);
17+
if (!node) {
18+
console.log(`Node ${currentId}: NOT FOUND`);
19+
break;
20+
}
21+
22+
console.log(`\nNode ${currentId}: ${node.type}`);
23+
if (node.type === 'interaction') {
24+
console.log(' template:', (node as any).templateName);
25+
}
26+
console.log(' transitions:', JSON.stringify(node.transitions, null, 2));
27+
28+
currentId = node.transitions[0]?.targetId;
29+
}
30+
31+
// Check decision node_13 transitions
32+
console.log('\n=== Decision node_13 analysis ===');
33+
const decisionNode = pipeline.nodes.get('node_13');
34+
console.log('Decision transitions:', JSON.stringify(decisionNode?.transitions, null, 2));
35+
36+
// Check what node_17 is (the other transition from Product.productSet decision)
37+
console.log('\n=== node_17 (from Product.productSet no path) ===');
38+
let curr: string | undefined = 'node_17';
39+
const vis2 = new Set<string>();
40+
while (curr && !vis2.has(curr)) {
41+
vis2.add(curr);
42+
const n = pipeline.nodes.get(curr);
43+
if (!n) break;
44+
const transStr = n.transitions.map(t => `-> ${t.targetId} (${t.connector || 'default'})`).join(', ');
45+
console.log(`${curr}: ${n.type}`, transStr);
46+
curr = n.transitions[0]?.targetId;
47+
}
48+
}
49+
50+
main().catch(console.error);

0 commit comments

Comments
 (0)