// mssql's events entrypoint, launched by the node's runtime beside its tools and provisioner // (novox/hq ADR 0198). The database lifecycle events are EMITTED from the provisioner, where // the lifecycle actually happens (novox/hq ADR 0041/0042): // module.mssql.database.provisioned — a consumer's database + login/user was created // module.mssql.database.deprovisioned — that database was removed // Here in the runtime we react to them, keeping a lightweight audit trail of who was granted a // database and who lost one — observability the provider itself is best placed to log. import { on } from "@novox/mesh-sdk/events"; interface DatabaseEvent { consumer: string; database: string; user?: string; } await on("database.provisioned", async (e) => { console.log(`[mssql] database provisioned for ${e.body.consumer} (db ${e.body.database})`); }); await on("database.deprovisioned", async (e) => { console.log(`[mssql] database deprovisioned for ${e.body.consumer} (db ${e.body.database})`); }); console.log("[mssql] auditing database lifecycle events");