@secondlayer/shared 6.4.4 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,40 +0,0 @@
1
- import { createRequire } from "node:module";
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
-
17
- // src/db/queries/provisioning-audit.ts
18
- async function recordProvisioningAudit(db, input) {
19
- const row = {
20
- tenant_id: input.tenantId ?? null,
21
- tenant_slug: input.tenantSlug ?? null,
22
- account_id: input.accountId ?? null,
23
- actor: input.actor,
24
- event: input.event,
25
- status: input.status,
26
- detail: input.detail ?? null,
27
- error: input.error ?? null
28
- };
29
- await db.insertInto("provisioning_audit_log").values(row).execute();
30
- }
31
- async function listAuditForTenant(db, tenantId, limit = 50) {
32
- return db.selectFrom("provisioning_audit_log").selectAll().where("tenant_id", "=", tenantId).orderBy("created_at", "desc").limit(limit).execute();
33
- }
34
- export {
35
- recordProvisioningAudit,
36
- listAuditForTenant
37
- };
38
-
39
- //# debugId=DF2744A82ED5118E64756E2164756E21
40
- //# sourceMappingURL=provisioning-audit.js.map
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/db/queries/provisioning-audit.ts"],
4
- "sourcesContent": [
5
- "import type { Kysely } from \"kysely\";\nimport type {\n\tDatabase,\n\tInsertProvisioningAuditLog,\n\tProvisioningAuditEvent,\n\tProvisioningAuditLog,\n\tProvisioningAuditStatus,\n} from \"../types.ts\";\n\n/**\n * Provisioning audit trail — every lifecycle event that mutates a tenant\n * lands here. Write on both happy and sad paths so we can reconstruct\n * what was attempted and what failed.\n *\n * `actor` is the logical source (e.g. `account:<uuid>`, `worker:tenant-health`,\n * `admin:<uuid>`). Keep it grep-able — this is the only breadcrumb when\n * something goes sideways.\n */\n\nexport interface AuditInput {\n\ttenantId?: string | null;\n\ttenantSlug?: string | null;\n\taccountId?: string | null;\n\tactor: string;\n\tevent: ProvisioningAuditEvent;\n\tstatus: ProvisioningAuditStatus;\n\tdetail?: unknown;\n\terror?: string;\n}\n\nexport async function recordProvisioningAudit(\n\tdb: Kysely<Database>,\n\tinput: AuditInput,\n): Promise<void> {\n\tconst row: InsertProvisioningAuditLog = {\n\t\ttenant_id: input.tenantId ?? null,\n\t\ttenant_slug: input.tenantSlug ?? null,\n\t\taccount_id: input.accountId ?? null,\n\t\tactor: input.actor,\n\t\tevent: input.event,\n\t\tstatus: input.status,\n\t\tdetail: input.detail ?? null,\n\t\terror: input.error ?? null,\n\t};\n\tawait db.insertInto(\"provisioning_audit_log\").values(row).execute();\n}\n\nexport async function listAuditForTenant(\n\tdb: Kysely<Database>,\n\ttenantId: string,\n\tlimit = 50,\n): Promise<ProvisioningAuditLog[]> {\n\treturn db\n\t\t.selectFrom(\"provisioning_audit_log\")\n\t\t.selectAll()\n\t\t.where(\"tenant_id\", \"=\", tenantId)\n\t\t.orderBy(\"created_at\", \"desc\")\n\t\t.limit(limit)\n\t\t.execute();\n}\n"
6
- ],
7
- "mappings": ";;;;;;;;;;;;;;;;;AA8BA,eAAsB,uBAAuB,CAC5C,IACA,OACgB;AAAA,EAChB,MAAM,MAAkC;AAAA,IACvC,WAAW,MAAM,YAAY;AAAA,IAC7B,aAAa,MAAM,cAAc;AAAA,IACjC,YAAY,MAAM,aAAa;AAAA,IAC/B,OAAO,MAAM;AAAA,IACb,OAAO,MAAM;AAAA,IACb,QAAQ,MAAM;AAAA,IACd,QAAQ,MAAM,UAAU;AAAA,IACxB,OAAO,MAAM,SAAS;AAAA,EACvB;AAAA,EACA,MAAM,GAAG,WAAW,wBAAwB,EAAE,OAAO,GAAG,EAAE,QAAQ;AAAA;AAGnE,eAAsB,kBAAkB,CACvC,IACA,UACA,QAAQ,IAC0B;AAAA,EAClC,OAAO,GACL,WAAW,wBAAwB,EACnC,UAAU,EACV,MAAM,aAAa,KAAK,QAAQ,EAChC,QAAQ,cAAc,MAAM,EAC5B,MAAM,KAAK,EACX,QAAQ;AAAA;",
8
- "debugId": "DF2744A82ED5118E64756E2164756E21",
9
- "names": []
10
- }