const identityUrl = process.env.DECISIOQ_IDENTITY_URL || "https://identity.vinquery.com/connect/token"; const catalogUrl = process.env.DECISIOQ_DKS_URL || "https://dks.vinquery.com"; const decisionServiceUrl = process.env.DECISIOQ_DDE_URL || "https://dde.vinquery.com"; const audience = process.env.DECISIOQ_AUDIENCE || "vinquery:api:decisioq"; async function main(): Promise { const tokenResponse = await fetch(identityUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ clientId: process.env.DECISIOQ_CLIENT_ID, clientSecret: process.env.DECISIOQ_CLIENT_SECRET, audience }) }); const { jwtToken } = (await tokenResponse.json()) as { jwtToken: string }; await fetch(`${catalogUrl}/decisioncatalog/decisions/AUTO-REPR-070`, { headers: { Authorization: `Bearer ${jwtToken}` } }); const payload = (await import("../auto-repr-070-execute.json", { assert: { type: "json" } })).default; const decisionResponse = await fetch(`${decisionServiceUrl}/api/v1/decide`, { method: "POST", headers: { Authorization: `Bearer ${jwtToken}`, "Content-Type": "application/json", "X-Correlation-Id": "auto-repr-070-demo-001" }, body: JSON.stringify(payload) }); console.log(JSON.stringify(await decisionResponse.json(), null, 2)); } main().catch((error) => { console.error(error); process.exit(1); });