@voltro/plugin-audit 0.87.0 → 0.88.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.
package/dist/chain.js CHANGED
@@ -2,7 +2,7 @@ import { AUDIT_LOG_TABLE as e } from "./tableName.js";
2
2
  import { auditInvocationIdOf as t, hasConsistentAuditInvocationId as n } from "./invocationIdentity.js";
3
3
  import { and as r, column as i, eq as a, generateId as o, gt as s, isNotNull as c, isNull as l, lte as u, or as d } from "@voltro/database";
4
4
  import { createHash as f, createHmac as p, randomBytes as m } from "node:crypto";
5
- //#region src/chain.ts
5
+ // src/chain.ts
6
6
  var h = [
7
7
  "tag",
8
8
  "at",
@@ -201,5 +201,4 @@ var w = async (e, t = {}) => {
201
201
  keyed: !!process.env.VOLTRO_AUDIT_CHAIN_SECRET
202
202
  };
203
203
  };
204
- //#endregion
205
204
  export { x as auditRowHash, S as makeAuditChain, w as verifyAuditChain };
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { Cause as x, Effect as S } from "effect";
9
9
  import { anonymousSubject as C, definePlugin as w, pluginInstanceName as re, rawImpersonationMark as ie } from "@voltro/protocol";
10
10
  import { createLogger as T } from "@voltro/logger";
11
11
  import { eq as ae, generateId as E, registerRetention as D, resolveActorSnapshot as oe, retentionTtlMsFromEnv as O } from "@voltro/database";
12
- //#region src/index.ts
12
+ // src/index.ts
13
13
  var k = T({ scope: "@voltro/plugin-audit" }), A = 1e3, j = [], M = () => [...j], N = () => {
14
14
  j.length = 0;
15
15
  }, P = (e) => {
@@ -376,5 +376,4 @@ var k = T({ scope: "@voltro/plugin-audit" }), A = 1e3, j = [], M = () => [...j],
376
376
  ...n.recordQueries === !0 ? { interceptQuery: pe } : {}
377
377
  });
378
378
  };
379
- //#endregion
380
379
  export { t as AUDIT_LOG_TABLE, v as audit, o as auditByScope, s as auditBySubject, c as auditByTrace, l as auditEventToRow, y as auditInvocationIdentity, b as auditInvocationQuery, u as auditLogTable, d as auditLogTables, z as auditPlugin, n as auditRowHash, N as clearAuditBuffer, f as dataStoreAuditSink, r as makeAuditChain, M as readAuditBuffer, i as verifyAuditChain };
@@ -1,4 +1,4 @@
1
- //#region src/invocationIdentity.ts
1
+ // src/invocationIdentity.ts
2
2
  var e = (e) => {
3
3
  if (typeof e != "object" || !e || Array.isArray(e)) return null;
4
4
  let t = e.invocationId;
@@ -7,5 +7,4 @@ var e = (e) => {
7
7
  let n = t.outcome;
8
8
  return typeof n == "object" && n && !Array.isArray(n) && n.invocationId !== void 0 && e(n) === null ? !1 : (t.invocationId ?? null) === e(n);
9
9
  };
10
- //#endregion
11
10
  export { e as auditInvocationIdOf, t as hasConsistentAuditInvocationId };
@@ -1,7 +1,7 @@
1
1
  import { hasConsistentAuditInvocationId as e } from "./invocationIdentity.js";
2
2
  import { auditLogTable as t } from "./store.js";
3
3
  import { and as n, columnRef as r, eq as i, isNull as a, neq as o, or as s, queryFor as c } from "@voltro/database";
4
- //#region src/invocationQuery.ts
4
+ // src/invocationQuery.ts
5
5
  var l = (e, t) => s(i(e, r(t)), n(a(e), a(t))), u = () => c(t).as("audit").leftJoin(t.tableName, "completed", n(i("completed.invocationId", r("audit.id")), s(i("completed.status", "ok"), i("completed.status", "error")), i("completed.tag", r("audit.tag")), i("completed.traceId", r("audit.traceId")), i("completed.at", r("audit.at")), l("completed.subjectId", "audit.subjectId"), l("completed.tenantId", "audit.tenantId"), l("completed.scopeKey", "audit.scopeKey"))).where(s(o("audit.status", "unknown"), a("completed.id"))), d = (t) => {
6
6
  if (!e(t)) throw TypeError("Audit invocation lookup does not match its protected outcome");
7
7
  let n = t.id, r = t.invocationId;
@@ -10,5 +10,4 @@ var l = (e, t) => s(i(e, r(t)), n(a(e), a(t))), u = () => c(t).as("audit").leftJ
10
10
  if (t.status === "unknown" ? n !== r : n !== r + ":outcome") throw TypeError("Audit invocation receipt identity is inconsistent");
11
11
  return r;
12
12
  };
13
- //#endregion
14
13
  export { d as auditInvocationIdentity, u as auditInvocationQuery };
package/dist/mixin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineMixin as e, reference as t, requireActors as n, timestamp as r } from "@voltro/database";
2
- //#region src/mixin.ts
2
+ // src/mixin.ts
3
3
  var i = () => e({
4
4
  id: "voltro/audit",
5
5
  fields: {
@@ -13,5 +13,4 @@ var i = () => e({
13
13
  beforeUpdate: () => "audit.beforeUpdate: stamp updatedAt + updatedBy from ctx.actor"
14
14
  }
15
15
  });
16
- //#endregion
17
16
  export { i as audit };
@@ -1,4 +1,4 @@
1
- //#region src/redactionShape.ts
1
+ // src/redactionShape.ts
2
2
  var e = /^[A-Za-z_$][A-Za-z0-9_$]*$/, t = (e, t) => e === 0 || t <= 0 || e >= t ? `string(${e})` : `string(<${t})`, n = (n, r) => n.length <= 64 && e.test(n) ? n : `<key:${t(n.length, r)}>`, r = (e, i = 0, a = 16) => {
3
3
  if (e === null) return "null";
4
4
  if (e === void 0) return "undefined";
@@ -18,5 +18,4 @@ var e = /^[A-Za-z_$][A-Za-z0-9_$]*$/, t = (e, t) => e === 0 || t <= 0 || e >= t
18
18
  }
19
19
  return o;
20
20
  }, i = (e, t = 16) => ({ __redacted: r(e, 0, t) });
21
- //#endregion
22
21
  export { r as redactionShape, i as shapeRedaction };
package/dist/store.js CHANGED
@@ -4,7 +4,7 @@ import { auditRowHash as r, makeAuditChain as i } from "./chain.js";
4
4
  import { Effect as a, Result as o, Semaphore as s } from "effect";
5
5
  import { and as c, eq as l, generateId as u, id as d, integer as f, json as p, resolveActorSnapshot as m, scopeKeyOf as h, table as g, text as _, timestamp as v } from "@voltro/database";
6
6
  import { isDeepStrictEqual as y } from "node:util";
7
- //#region src/store.ts
7
+ // src/store.ts
8
8
  var b = g(e, {
9
9
  id: d({ prefix: "audit" }),
10
10
  tag: _(),
@@ -179,5 +179,4 @@ var b = g(e, {
179
179
  if (o.isFailure(e)) throw e.failure;
180
180
  });
181
181
  };
182
- //#endregion
183
182
  export { e as AUDIT_LOG_TABLE, D as assertAuditReceipt, T as auditByScope, E as auditBySubject, w as auditByTrace, S as auditEventToRow, b as auditLogTable, x as auditLogTables, O as dataStoreAuditSink };
package/dist/tableName.js CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/tableName.ts
1
+ // src/tableName.ts
2
2
  var e = "_voltro_audit_log";
3
- //#endregion
4
3
  export { e as AUDIT_LOG_TABLE };
@@ -1,6 +1,6 @@
1
1
  import { Schema as e } from "effect";
2
2
  import { Subject as t } from "@voltro/protocol";
3
- //#region src/transactionalCapture.ts
3
+ // src/transactionalCapture.ts
4
4
  var n = e.Struct({
5
5
  id: e.String,
6
6
  type: e.String,
@@ -97,5 +97,4 @@ var n = e.Struct({
97
97
  }, /* @__PURE__ */ new Set()))))
98
98
  };
99
99
  }, h = (e) => m(e, l), g = (e) => m(e, u), _ = (e) => m(e, d), v = (e) => m(e, f);
100
- //#endregion
101
100
  export { d as decodeAuditAdmissionIntent, u as decodeAuditFailureIntent, l as decodeAuditIntent, f as decodeAuditInvocationOutcomeIntent, _ as freezeAuditAdmissionIntent, g as freezeAuditFailureIntent, h as freezeAuditIntent, v as freezeAuditInvocationOutcomeIntent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/plugin-audit",
3
- "version": "0.87.0",
3
+ "version": "0.88.0",
4
4
  "description": "Audit plugin — ships the `audit()` schema mixin (createdAt/updatedAt/createdBy/updatedBy → Actor) plus an optional interceptor that records every mutation and action (queries on request) to a configurable sink (console / memory / datastore / custom function).",
5
5
  "keywords": [
6
6
  "voltro",
@@ -38,12 +38,12 @@
38
38
  "node": ">=24.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "@voltro/database": "0.87.0",
42
- "@voltro/logger": "0.87.0",
43
- "@voltro/protocol": "0.87.0"
41
+ "@voltro/database": "0.88.0",
42
+ "@voltro/logger": "0.88.0",
43
+ "@voltro/protocol": "0.88.0"
44
44
  },
45
45
  "peerDependencies": {
46
- "effect": "4.0.1"
46
+ "effect": "4.1.0"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"