Reconstruye el Webhook Messenger nativo de SAP B1 (FP2605) para clientes que aun no estan en esa version: captura eventos via SBO_SP_PostTransactionNotice, provisiona UserTables OEVC/EVC1/OEVN/EVN1 y despacha CloudEvents al mismo endpoint que el messenger real. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
// Exporta el body real de creación (Service Layer: UserTablesMD/UserFieldsMD)
|
|
// de cada una de las 4 UserTables a un archivo JSON en json/user-tables/ —
|
|
// útil para revisar el payload exacto, o para postearlo a mano (Postman,
|
|
// curl, tools/sl.http) sin correr `npm run provision`.
|
|
//
|
|
// Se genera a partir de src/provisioning/table-definitions.ts (única fuente
|
|
// de verdad) — si el esquema cambia ahí, correr de nuevo este script para
|
|
// regenerar los JSON.
|
|
//
|
|
// Uso: npx tsx scripts/export-table-json.ts
|
|
|
|
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { TABLE_DEFINITIONS } from '../src/provisioning/table-definitions.ts';
|
|
import { toUserFieldPayload, toUserTablePayload } from '../src/provisioning/payloads.ts';
|
|
|
|
const outDir = fileURLToPath(new URL('../json/user-tables/', import.meta.url));
|
|
mkdirSync(outDir, { recursive: true });
|
|
|
|
for (const definition of TABLE_DEFINITIONS) {
|
|
const payload = {
|
|
table: toUserTablePayload(definition),
|
|
fields: definition.fields.map((field) => toUserFieldPayload(definition.tableName, field)),
|
|
};
|
|
|
|
const filePath = `${outDir}${definition.tableName}.json`;
|
|
writeFileSync(filePath, `${JSON.stringify(payload, null, 2)}\n`);
|
|
console.log(`Exportado: ${filePath}`);
|
|
}
|