chore(debug): TEMP probe Ford leaf parts endpoints
This commit is contained in:
@@ -1824,11 +1824,23 @@ export class PL24FordLegacyService {
|
||||
sgj = JSON.parse(sg as string);
|
||||
} catch {}
|
||||
const subs = sgj?.subgroups || [];
|
||||
const withUrl = subs.filter((x: any) => x.jsonUrl).length;
|
||||
this.logger.warn(`FORD-MAP L3 subs=${subs.length} withJsonUrl=${withUrl} firstObj=${JSON.stringify(subs[0])}`);
|
||||
// try to fetch parts for a leaf (jsonUrl null) — probe candidate endpoints
|
||||
const leaf = subs.find((x: any) => !x.jsonUrl) || subs[0];
|
||||
if (leaf) this.logger.warn(`FORD-MAP leaf keys=${Object.keys(leaf).join(",")} id=${leaf.id} url=${leaf.url}`);
|
||||
const realLeaf = subs.find((x: any) => x.subheader !== true && x.id) || subs[0];
|
||||
this.logger.warn(`FORD-MAP L3 subs=${subs.length} realLeaf id=${realLeaf?.id} cap="${realLeaf?.caption}" subheader=${realLeaf?.subheader}`);
|
||||
// probe candidate parts endpoints for the leaf, derived from the json-sub-group URL
|
||||
if (realLeaf?.id) {
|
||||
const base = mgs[0].jsonUrl as string; // json-sub-group.action?catCode=...&mainGroupId=...&sharedCatCode=...
|
||||
const cands = [
|
||||
base.replace("json-sub-group.action", "json-bom.action") + `&subGroupId=${realLeaf.id}`,
|
||||
base.replace("json-sub-group.action", "json-bom-detail.action") + `&subGroupId=${realLeaf.id}`,
|
||||
base.replace("json-sub-group.action", "bom.action") + `&subGroupId=${realLeaf.id}`,
|
||||
`${base}&subGroupId=${realLeaf.id}`,
|
||||
];
|
||||
for (const cu of cands) {
|
||||
const pr = await this.fetchP4Page(cu, serviceName, false);
|
||||
const act = cu.match(/\/([a-z-]+\.action)/i)?.[1];
|
||||
this.logger.warn(`FORD-MAP parts-probe ${act}+subGroupId: len=${pr?.length} head=${pr?.slice(0, 140).replace(/\s+/g, " ")}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user