@pithy-sh/audit 0.9.7 → 0.10.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/capability.d.ts.map +1 -1
- package/dist/capability.js +2 -1
- package/dist/purge/contribution.d.ts +6 -1
- package/dist/purge/contribution.d.ts.map +1 -1
- package/dist/purge/contribution.js +10 -3
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.d.ts.map +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +3 -3
- package/src/capability.ts +2 -1
- package/src/purge/contribution.ts +9 -2
- package/src/version.generated.ts +1 -1
package/dist/capability.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,0CAA0C,CAAC;AAQ7F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsBxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAWzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;iBAiB8B,CAAC;AACvD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC;AACvD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE3D,8EAA8E;AAC9E,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,gFAAgF;IAChF,aAAa,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,MAAM,GAAE,gBAAqB,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,0CAA0C,CAAC;AAQ7F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsBxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAWzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;iBAiB8B,CAAC;AACvD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC;AACvD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE3D,8EAA8E;AAC9E,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,gFAAgF;IAChF,aAAa,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,MAAM,GAAE,gBAAqB,GAAG,eAAe,CAiLpE;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,IAAI,eAAe,CAEvF"}
|
package/dist/capability.js
CHANGED
|
@@ -14,7 +14,7 @@ import { audit_0003_call_index } from "./migrations/0003_call_index.js";
|
|
|
14
14
|
import { audit_0004_request_index } from "./migrations/0004_request_index.js";
|
|
15
15
|
import { audit_0005_chain } from "./migrations/0005_chain.js";
|
|
16
16
|
import { audit_0006_sinks } from "./migrations/0006_sinks.js";
|
|
17
|
-
import { auditUserPurge } from "./purge/contribution.js";
|
|
17
|
+
import { AUDIT_MESSAGES, auditUserPurge } from "./purge/contribution.js";
|
|
18
18
|
import { recordAuditEvent } from "./recorder.js";
|
|
19
19
|
import { auditExampleSeed } from "./seeds/example.js";
|
|
20
20
|
import { shipBindings } from "./ship/queue.js";
|
|
@@ -132,6 +132,7 @@ function audit(config = {}) {
|
|
|
132
132
|
} },
|
|
133
133
|
seeds: [auditExampleSeed],
|
|
134
134
|
purge: [auditUserPurge(resolved.database)],
|
|
135
|
+
messages: AUDIT_MESSAGES,
|
|
135
136
|
auditRecorder: (env) => {
|
|
136
137
|
const log = createWorkerLogger({ name: "audit" });
|
|
137
138
|
const binding = env[resolved.database];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: FSL-1.1-MIT
|
|
3
3
|
import type { RetainingPurgeContribution } from "@pithy-sh/core/src/capability/purge";
|
|
4
|
+
import type { LocaleCatalogs } from "@pithy-sh/core/src/i18n/catalog";
|
|
4
5
|
/**
|
|
5
|
-
* What a person's purge means for `@pithy-sh/audit
|
|
6
|
+
* What a person's purge means for `@pithy-sh/audit`: **nothing is erased, and the export says so and why.**
|
|
6
7
|
*
|
|
7
8
|
* The audit trail is the record of who acted — who signed in, who changed a role, who deleted an organization — and
|
|
8
9
|
* it is what a security review or a dispute is read against. A trail that forgot an actor on request would answer
|
|
@@ -16,6 +17,10 @@ import type { RetainingPurgeContribution } from "@pithy-sh/core/src/capability/p
|
|
|
16
17
|
export declare const AUDIT_PURGE_SUMMARY = "Keeps every audit event where the user is the actor.";
|
|
17
18
|
/** Why, in the sentence the person is told. */
|
|
18
19
|
export declare const AUDIT_RETENTION_BASIS = "Kept as the record of who did what, which a security review or a dispute is read against.";
|
|
20
|
+
/** The catalog key that translates {@link AUDIT_RETENTION_BASIS}. */
|
|
21
|
+
export declare const AUDIT_RETENTION_BASIS_KEY = "audit/purge.retained";
|
|
22
|
+
/** This capability's own English, contributed as its `messages`: the basis, under its key. */
|
|
23
|
+
export declare const AUDIT_MESSAGES: LocaleCatalogs;
|
|
19
24
|
/** The user contribution `audit()` declares, over the D1 binding its config names. */
|
|
20
25
|
export declare function auditUserPurge(database?: string): RetainingPurgeContribution;
|
|
21
26
|
//# sourceMappingURL=contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contribution.d.ts","sourceRoot":"","sources":["../../src/purge/contribution.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"contribution.d.ts","sourceRoot":"","sources":["../../src/purge/contribution.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGtE;;;;;;;;;;GAUG;AAEH,yDAAyD;AACzD,eAAO,MAAM,mBAAmB,yDAAyD,CAAC;AAE1F,+CAA+C;AAC/C,eAAO,MAAM,qBAAqB,8FAC2D,CAAC;AAE9F,qEAAqE;AACrE,eAAO,MAAM,yBAAyB,yBAAyB,CAAC;AAEhE,8FAA8F;AAC9F,eAAO,MAAM,cAAc,EAAE,cAA+E,CAAC;AAE7G,sFAAsF;AACtF,wBAAgB,cAAc,CAAC,QAAQ,SAAO,GAAG,0BAA0B,CAW1E"}
|
|
@@ -4,7 +4,7 @@ import { AuditEventRow } from "../data/auditEvent.js";
|
|
|
4
4
|
import { personRowsExport } from "@pithy-sh/core/src/capability/personRows";
|
|
5
5
|
//#region src/purge/contribution.ts
|
|
6
6
|
/**
|
|
7
|
-
* What a person's purge means for `@pithy-sh/audit
|
|
7
|
+
* What a person's purge means for `@pithy-sh/audit`: **nothing is erased, and the export says so and why.**
|
|
8
8
|
*
|
|
9
9
|
* The audit trail is the record of who acted — who signed in, who changed a role, who deleted an organization — and
|
|
10
10
|
* it is what a security review or a dispute is read against. A trail that forgot an actor on request would answer
|
|
@@ -18,12 +18,19 @@ import { personRowsExport } from "@pithy-sh/core/src/capability/personRows";
|
|
|
18
18
|
const AUDIT_PURGE_SUMMARY = "Keeps every audit event where the user is the actor.";
|
|
19
19
|
/** Why, in the sentence the person is told. */
|
|
20
20
|
const AUDIT_RETENTION_BASIS = "Kept as the record of who did what, which a security review or a dispute is read against.";
|
|
21
|
+
/** The catalog key that translates {@link AUDIT_RETENTION_BASIS}. */
|
|
22
|
+
const AUDIT_RETENTION_BASIS_KEY = "audit/purge.retained";
|
|
23
|
+
/** This capability's own English, contributed as its `messages`: the basis, under its key. */
|
|
24
|
+
const AUDIT_MESSAGES = { en: { [AUDIT_RETENTION_BASIS_KEY]: AUDIT_RETENTION_BASIS } };
|
|
21
25
|
/** The user contribution `audit()` declares, over the D1 binding its config names. */
|
|
22
26
|
function auditUserPurge(database = "DB") {
|
|
23
27
|
return {
|
|
24
28
|
subject: "user",
|
|
25
29
|
summary: AUDIT_PURGE_SUMMARY,
|
|
26
|
-
retain: {
|
|
30
|
+
retain: {
|
|
31
|
+
basis: AUDIT_RETENTION_BASIS,
|
|
32
|
+
basisKey: AUDIT_RETENTION_BASIS_KEY
|
|
33
|
+
},
|
|
27
34
|
export: personRowsExport({
|
|
28
35
|
capability: "audit",
|
|
29
36
|
database,
|
|
@@ -38,4 +45,4 @@ function auditUserPurge(database = "DB") {
|
|
|
38
45
|
};
|
|
39
46
|
}
|
|
40
47
|
//#endregion
|
|
41
|
-
export { AUDIT_PURGE_SUMMARY, AUDIT_RETENTION_BASIS, auditUserPurge };
|
|
48
|
+
export { AUDIT_MESSAGES, AUDIT_PURGE_SUMMARY, AUDIT_RETENTION_BASIS, AUDIT_RETENTION_BASIS_KEY, auditUserPurge };
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
/** This package's npm name — the join key against a release feed. */
|
|
4
4
|
export declare const PACKAGE_NAME = "@pithy-sh/audit";
|
|
5
5
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
6
|
-
export declare const PACKAGE_VERSION = "0.
|
|
6
|
+
export declare const PACKAGE_VERSION = "0.10.0";
|
|
7
7
|
//# sourceMappingURL=version.generated.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.generated.d.ts","sourceRoot":"","sources":["../src/version.generated.ts"],"names":[],"mappings":"AAWA,qEAAqE;AACrE,eAAO,MAAM,YAAY,oBAAoB,CAAC;AAE9C,oFAAoF;AACpF,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"version.generated.d.ts","sourceRoot":"","sources":["../src/version.generated.ts"],"names":[],"mappings":"AAWA,qEAAqE;AACrE,eAAO,MAAM,YAAY,oBAAoB,CAAC;AAE9C,oFAAoF;AACpF,eAAO,MAAM,eAAe,WAAW,CAAC"}
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
/** This package's npm name — the join key against a release feed. */
|
|
5
5
|
const PACKAGE_NAME = "@pithy-sh/audit";
|
|
6
6
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
7
|
-
const PACKAGE_VERSION = "0.
|
|
7
|
+
const PACKAGE_VERSION = "0.10.0";
|
|
8
8
|
//#endregion
|
|
9
9
|
export { PACKAGE_NAME, PACKAGE_VERSION };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pithy-sh/audit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"license": "FSL-1.1-MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@hono/zod-validator": "^0.9.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@pithy-sh/core": "^0.
|
|
42
|
-
"@pithy-sh/secrets": "^0.6.
|
|
41
|
+
"@pithy-sh/core": "^0.25.0",
|
|
42
|
+
"@pithy-sh/secrets": "^0.6.13",
|
|
43
43
|
"hono": "^4.13.2",
|
|
44
44
|
"kysely": "^0.29.0",
|
|
45
45
|
"zod": "^4.4.0"
|
package/src/capability.ts
CHANGED
|
@@ -25,7 +25,7 @@ import { audit_0003_call_index } from "./migrations/0003_call_index";
|
|
|
25
25
|
import { audit_0004_request_index } from "./migrations/0004_request_index";
|
|
26
26
|
import { audit_0005_chain } from "./migrations/0005_chain";
|
|
27
27
|
import { audit_0006_sinks } from "./migrations/0006_sinks";
|
|
28
|
-
import { auditUserPurge } from "./purge/contribution";
|
|
28
|
+
import { AUDIT_MESSAGES, auditUserPurge } from "./purge/contribution";
|
|
29
29
|
import { recordAuditEvent } from "./recorder";
|
|
30
30
|
import { auditExampleSeed } from "./seeds/example";
|
|
31
31
|
import { auditShipConsumer } from "./ship/consumer";
|
|
@@ -184,6 +184,7 @@ export function audit(config: AuditConfigInput = {}): AuditCapability {
|
|
|
184
184
|
// Every event where a person is the actor is kept through their purge, as the record of who acted, and exported
|
|
185
185
|
// on an access request with the basis that keeps it.
|
|
186
186
|
purge: [auditUserPurge(resolved.database)],
|
|
187
|
+
messages: AUDIT_MESSAGES,
|
|
187
188
|
// The same recorder for code with no request — a Workflow step, which has `env` and nothing else.
|
|
188
189
|
// Built over the binding this config names, stamped with the env's own origin, and non-fatal on the same
|
|
189
190
|
// terms as the middleware's: a missing binding or a failed insert drops the event and logs it, and the
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
import { personRowsExport } from "@pithy-sh/core/src/capability/personRows";
|
|
5
5
|
import type { RetainingPurgeContribution } from "@pithy-sh/core/src/capability/purge";
|
|
6
|
+
import type { LocaleCatalogs } from "@pithy-sh/core/src/i18n/catalog";
|
|
6
7
|
import { AuditEventRow } from "../data/auditEvent";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
|
-
* What a person's purge means for `@pithy-sh/audit
|
|
10
|
+
* What a person's purge means for `@pithy-sh/audit`: **nothing is erased, and the export says so and why.**
|
|
10
11
|
*
|
|
11
12
|
* The audit trail is the record of who acted — who signed in, who changed a role, who deleted an organization — and
|
|
12
13
|
* it is what a security review or a dispute is read against. A trail that forgot an actor on request would answer
|
|
@@ -24,12 +25,18 @@ export const AUDIT_PURGE_SUMMARY = "Keeps every audit event where the user is th
|
|
|
24
25
|
export const AUDIT_RETENTION_BASIS =
|
|
25
26
|
"Kept as the record of who did what, which a security review or a dispute is read against.";
|
|
26
27
|
|
|
28
|
+
/** The catalog key that translates {@link AUDIT_RETENTION_BASIS}. */
|
|
29
|
+
export const AUDIT_RETENTION_BASIS_KEY = "audit/purge.retained";
|
|
30
|
+
|
|
31
|
+
/** This capability's own English, contributed as its `messages`: the basis, under its key. */
|
|
32
|
+
export const AUDIT_MESSAGES: LocaleCatalogs = { en: { [AUDIT_RETENTION_BASIS_KEY]: AUDIT_RETENTION_BASIS } };
|
|
33
|
+
|
|
27
34
|
/** The user contribution `audit()` declares, over the D1 binding its config names. */
|
|
28
35
|
export function auditUserPurge(database = "DB"): RetainingPurgeContribution {
|
|
29
36
|
return {
|
|
30
37
|
subject: "user",
|
|
31
38
|
summary: AUDIT_PURGE_SUMMARY,
|
|
32
|
-
retain: { basis: AUDIT_RETENTION_BASIS },
|
|
39
|
+
retain: { basis: AUDIT_RETENTION_BASIS, basisKey: AUDIT_RETENTION_BASIS_KEY },
|
|
33
40
|
export: personRowsExport({
|
|
34
41
|
capability: "audit",
|
|
35
42
|
database,
|
package/src/version.generated.ts
CHANGED