Astra 0598704: 26D AP/AR/GL fixes verified live, payments, subledger accounting, edge cases, learned navigation, consultant step import (059870495533)
2d71dc3 verified Download automation/scripts/check-nav.ts from EnergyVenom/patchwise-agent-studio: direct link, hf CLI and curl.
- Browser
- Download file 2.38 kB
-
https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/automation/scripts/check-nav.ts
- Command line
-
hf download hf://spaces/EnergyVenom/patchwise-agent-studio/automation/scripts/check-nav.ts
-
curl -L -o check-nav.ts https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/automation/scripts/check-nav.ts
2.38 kB
| /* Checks the navigation-link parsing and matching (src/fusion/nav.ts) without a browser: `npx tsx scripts/check-nav.ts`. */ | |
| import assert from 'node:assert/strict'; | |
| import { LEARNED_PATH, navLink, parseLearnedLinks, parseNavLinks } from '../src/fusion/nav'; | |
| const url = 'https://pod.fa.ocs.oraclecloud.com/fscmUI/faces/FuseOverview?fndGlobalItemNodeId=itemNode_procurement_purchase_orders'; | |
| const links = parseNavLinks(JSON.stringify({ 'Procurement > Purchase Orders': url, 'Payables > Invoices': 'http://x/fscmUI/a', 'nogroup': url, 'A > B': 5 })); | |
| assert.deepEqual(Object.keys(links), ['Procurement > Purchase Orders']); // http, no "A > B" form and non-strings dropped | |
| assert.equal(navLink(links, 'Procurement', 'Purchase Orders'), url); | |
| assert.equal(navLink(links, ' procurement ', 'PURCHASE orders'), url); // case and spacing do not matter | |
| assert.equal(navLink(links, 'Procurement', 'Purchase Order'), null); // no guessing | |
| assert.equal(navLink(links, 'Payables', 'Invoices'), null); | |
| // bad input is ignored | |
| assert.deepEqual(parseNavLinks(undefined), {}); | |
| assert.deepEqual(parseNavLinks('not json'), {}); | |
| assert.deepEqual(parseNavLinks('[1,2]'), {}); | |
| assert.deepEqual(parseNavLinks('null'), {}); | |
| // learned links: relative, same shape as a work area's own address, anything else dropped | |
| const path = '/fscmUI/faces/FndOverview?fndGlobalItemNodeId=itemNode_receivables_billing'; | |
| const learned = parseLearnedLinks(JSON.stringify({ | |
| 'Receivables > Billing': path, 'A > B': 'https://evil.example.com/fscmUI/faces/FndOverview?fndGlobalItemNodeId=itemNode_x', | |
| 'C > D': '//evil.example.com/fscmUI/faces/FndOverview?fndGlobalItemNodeId=itemNode_x', 'E > F': '/fscmUI/faces/FndOverview?other=1', | |
| 'G > H': '/fscmUI/faces/FndOverview?fndGlobalItemNodeId=itemNode_x&y=1', 'I > J': '/fscmUI/../x/faces/F?fndGlobalItemNodeId=itemNode_x', 'nogroup': path, 'K > L': 7 })); | |
| assert.deepEqual(learned, { 'Receivables > Billing': path }); | |
| assert.equal(navLink(learned, ' receivables ', 'BILLING'), path); // the same matching as a consultant's links | |
| assert.ok(LEARNED_PATH.test(path) && !LEARNED_PATH.test(`https://x${path}`)); | |
| assert.deepEqual(parseLearnedLinks(undefined), {}); | |
| assert.deepEqual(parseLearnedLinks('not json'), {}); | |
| assert.deepEqual(parseLearnedLinks('[1]'), {}); | |
| console.log('nav: all checks pass'); | |