seahaven-door-unlock-api/scripts/blf-sync-local.ts
Adam Moussa bbc113497a
Some checks failed
Deploy / deploy (push) Has been cancelled
feat(3cx): sync office department blfs via xapi (PLAT-116) (#80)
* feat(3cx): sync office department BLFs via XAPI

Keep unlock and lockdown keys in the templates and write colleague plus shared-parking BLFs per extension so phones skip their own line.

* fix(3cx): preserve parking BLF IDs and fail the job on PATCH errors
2026-08-27 14:58:55 -04:00

21 lines
704 B
JavaScript

#!/usr/bin/env node
import { handler, type BlfSyncEvent } from "../lambda/blf-sync/blf-sync-handler";
process.env.THREE_CX_DOMAIN_SECRET ??= "afterhours-shift-manager/3cx-domain";
process.env.THREE_CX_CLIENT_ID_SECRET ??= "afterhours-shift-manager/3cx-client-id";
process.env.THREE_CX_CLIENT_SECRET_SECRET ??= "afterhours-shift-manager/3cx-client-secret";
const args = process.argv.slice(2);
const event: BlfSyncEvent = {
dryRun: !args.includes("--write"),
smokeExtension: args.find((a) => a.startsWith("--smoke="))?.slice("--smoke=".length),
};
if (event.dryRun === false) {
process.env.DRY_RUN = "false";
}
handler(event).catch((err) => {
console.error(String(err));
process.exit(1);
});