@pithy-sh/audit 0.1.3 → 0.1.5

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/actions.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  /**
2
4
  * Author a capability's action constants. The taxonomy is **federated**: each capability owns and
3
5
  * exports its own `domain/reason` action codes (`auth/login`, `entitlement/granted`) and adds them
package/dist/actions.js CHANGED
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { AuditInvalidEventError } from "./error/errors.js";
2
4
  import { AuditAction } from "@pithy-sh/core/src/audit/auditEvent";
3
5
  //#region src/actions.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { type Capability } from "@pithy-sh/core/src/capability/capability";
2
4
  import { z } from "zod";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { auditTables } from "./data/tables.js";
2
4
  import { auditAdminRoutes } from "./http/guards.js";
3
5
  import { registerAuditRoutes } from "./http/routes.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import type { D1Database } from "@cloudflare/workers-types";
2
4
  import type { AuditEventInput } from "@pithy-sh/core/src/audit/auditEvent";
3
5
  import { type AuditRecorderOptions } from "../recorder";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { auditDatabase } from "../data/tables.js";
2
4
  import { recordAuditEvent } from "../recorder.js";
3
5
  //#region src/cli/emitFromCLI.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import type { AuditActorType, AuditMetadata } from "@pithy-sh/core/src/audit/auditEvent";
2
4
  /** The user-scoped slice: who is behind a `cfut_*` token. `clients.user()` satisfies it. */
3
5
  export interface CfUserActorSource {
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { messageOf } from "@pithy-sh/core/src/error/pithyError";
2
4
  //#region src/cli/resolveActor.ts
3
5
  /** The fallback actor when resolution can't attribute the action: `system`, with a note (never fatal). */
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { z } from "zod";
2
4
  /**
3
5
  * The `pithy_audit_events` table — one row per recorded security-relevant action. One Zod object is
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { AuditAction, AuditActorType, AuditMetadata, AuditOutcome, AuditSeverity } from "@pithy-sh/core/src/audit/auditEvent";
2
4
  import { z } from "zod";
3
5
  import { SQLiteDate, sqliteJson } from "@pithy-sh/core/src/data/codecs";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import type { D1Database } from "@cloudflare/workers-types";
2
4
  import { type DatabaseSchema } from "@pithy-sh/core/src/data/db";
3
5
  import type { Kysely } from "kysely";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { AuditEventRow } from "./auditEvent.js";
2
4
  import { createDatabase } from "@pithy-sh/core/src/data/db";
3
5
  //#region src/data/tables.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { PithyError } from "@pithy-sh/core/src/error/pithyError";
2
4
  import type { MessageParams } from "@pithy-sh/core/src/i18n/catalog";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { PithyError } from "@pithy-sh/core/src/error/pithyError";
2
4
  //#region src/error/errors.ts
3
5
  /** An audit event failed validation against the `AuditEvent` schema (bad action, outcome, or actor). */
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import type { AdminRoute } from "@pithy-sh/core/src/controlPlane/discovery/adminRoute";
2
4
  import type { ControlPlaneScope } from "@pithy-sh/core/src/controlPlane/scope/scope";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  //#region src/http/guards.ts
2
4
  /**
3
5
  * Audit's control-plane scopes, and the admin surface a manifest advertises.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { z } from "zod";
2
4
  /**
3
5
  * One event as the listing shows it — everything but the network identifiers and the metadata bag.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { AuditActorType, AuditMetadata, AuditOutcome, AuditSeverity } from "@pithy-sh/core/src/audit/auditEvent";
2
4
  import { z } from "zod";
3
5
  //#region src/http/responses.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import type { PithyHonoEnv } from "@pithy-sh/core/src/capability/capability";
2
4
  import type { ControlPlaneScope } from "@pithy-sh/core/src/controlPlane/scope/scope";
3
5
  import type { VerificationStrategy } from "@pithy-sh/core/src/http/verification";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { AuditTrailActions } from "../actions.js";
2
4
  import { AUDIT_EVENT_DETAIL_READ_SCOPE, AUDIT_TRAIL_READ_SCOPE } from "./guards.js";
3
5
  import { pageAuditEvents, readAuditEvent } from "../query.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { z } from "zod";
2
4
  /** One event's id in the path. */
3
5
  export declare const AuditEventIdParam: z.ZodObject<{
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { AuditAction, AuditActorType, AuditOutcome, AuditSeverity } from "@pithy-sh/core/src/audit/auditEvent";
2
4
  import { z } from "zod";
3
5
  import { MAX_PAGE_SIZE } from "@pithy-sh/core/src/data/cursor";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import type { AuditEventRow } from "../data/auditEvent";
2
4
  import type { AuditEventDetailView, AuditEventView } from "./responses";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  //#region src/http/views.ts
2
4
  /**
3
5
  * What a management client is shown of an audit event — decided here, once, rather than by whichever
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  /**
2
4
  * The package entrypoint — the surface `pithy add audit` wires into `pithy.config.ts`. Deliberately
3
5
  * narrow: the capability factory, the recorder/query seams an app reads the trail with, the federated
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { AuditTrailActions, defineAuditActions } from "./actions.js";
2
4
  import { AuditEventRow } from "./data/auditEvent.js";
3
5
  import { auditDatabase } from "./data/tables.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import type { Migration } from "kysely/migration";
2
4
  /**
3
5
  * Create the `pithy_audit_events` table in the configured audit database (the `DB` binding by
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  //#region src/migrations/0001_init.ts
2
4
  /**
3
5
  * Create the `pithy_audit_events` table in the configured audit database (the `DB` binding by
package/dist/query.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import type { AuditActorType, AuditOutcome, AuditSeverity } from "@pithy-sh/core/src/audit/auditEvent";
2
4
  import { AuditEventRow } from "./data/auditEvent";
3
5
  import type { AuditDatabase } from "./data/tables";
package/dist/query.js CHANGED
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { AuditEventRow } from "./data/auditEvent.js";
2
4
  import { SQLiteDate } from "@pithy-sh/core/src/data/codecs";
3
5
  import { decodeCursor, pageLimit, toPage } from "@pithy-sh/core/src/data/cursor";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { type AuditEventInput } from "@pithy-sh/core/src/audit/auditEvent";
2
4
  import type { AuditEmit } from "@pithy-sh/core/src/audit/recorder";
3
5
  import { type D1RetryOptions } from "@pithy-sh/core/src/data/withD1Retry";
package/dist/recorder.js CHANGED
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { AuditInvalidEventError, AuditWriteFailedError } from "./error/errors.js";
2
4
  import { AuditMetadataColumn } from "./data/auditEvent.js";
3
5
  import { AuditEvent } from "@pithy-sh/core/src/audit/auditEvent";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { type SeedSet } from "@pithy-sh/core/src/seed/seed";
2
4
  /**
3
5
  * A handful of example audit events — the durable, queryable trail the licensed dashboard reads. They
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  import { AuditEventRow } from "../data/auditEvent.js";
2
4
  import { EXAMPLE_ADA, EXAMPLE_ALAN, EXAMPLE_GRACE } from "@pithy-sh/core/src/seed/exampleIdentities";
3
5
  import { d1SeedGroup, defineSeed } from "@pithy-sh/core/src/seed/seed";
@@ -1,5 +1,7 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  /** This package's npm name — the join key against a release feed. */
2
4
  export declare const PACKAGE_NAME = "@pithy-sh/audit";
3
5
  /** This package's version, stamped from its own package.json at generation time. */
4
- export declare const PACKAGE_VERSION = "0.1.3";
6
+ export declare const PACKAGE_VERSION = "0.1.5";
5
7
  //# sourceMappingURL=version.generated.d.ts.map
@@ -1,7 +1,9 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: FSL-1.1-MIT
1
3
  //#region src/version.generated.ts
2
4
  /** This package's npm name — the join key against a release feed. */
3
5
  const PACKAGE_NAME = "@pithy-sh/audit";
4
6
  /** This package's version, stamped from its own package.json at generation time. */
5
- const PACKAGE_VERSION = "0.1.3";
7
+ const PACKAGE_VERSION = "0.1.5";
6
8
  //#endregion
7
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.1.3",
3
+ "version": "0.1.5",
4
4
  "license": "FSL-1.1-MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  }
26
26
  },
27
27
  "scripts": {
28
- "build": "tsdown && tsc -p tsconfig.build.json",
28
+ "build": "tsdown && tsc -p tsconfig.build.json && bun ../../tooling/build/src/stampDeclarations.ts",
29
29
  "typecheck": "tsc -p tsconfig.json",
30
30
  "test": "vitest run",
31
31
  "test:node": "vitest run --project=node",
@@ -36,8 +36,8 @@
36
36
  "dependencies": {
37
37
  "@cloudflare/workers-types": "^5.20260729.1",
38
38
  "@hono/zod-validator": "^0.9.0",
39
- "@pithy-sh/cloudflare": "^0.1.3",
40
- "@pithy-sh/core": "^0.1.3"
39
+ "@pithy-sh/cloudflare": "^0.1.5",
40
+ "@pithy-sh/core": "^0.2.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@cloudflare/vitest-plugin": "^1.0.0",
@@ -13,4 +13,4 @@
13
13
  export const PACKAGE_NAME = "@pithy-sh/audit";
14
14
 
15
15
  /** This package's version, stamped from its own package.json at generation time. */
16
- export const PACKAGE_VERSION = "0.1.3";
16
+ export const PACKAGE_VERSION = "0.1.5";