@xtandard/audit 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +386 -2
- package/bin/xtandard-audit.mjs +3 -0
- package/dist/basic-DU_nPrWV.mjs +176 -0
- package/dist/basic-DU_nPrWV.mjs.map +1 -0
- package/dist/basic-hcXnMF9X.cjs +199 -0
- package/dist/basic-hcXnMF9X.cjs.map +1 -0
- package/dist/canonical-BOgkrX9_.d.cts +17 -0
- package/dist/canonical-CL7gfwhb.d.mts +17 -0
- package/dist/chunk-D7D4PA-g.mjs +13 -0
- package/dist/cli.cjs +773 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +46 -0
- package/dist/cli.d.mts +46 -0
- package/dist/cli.mjs +762 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/context-BtR9k9Mt.d.mts +52 -0
- package/dist/context-CJM87uG8.d.cts +52 -0
- package/dist/context-shared-AgBWIRUQ.d.mts +29 -0
- package/dist/context-shared-CUq3cSpV.d.cts +29 -0
- package/dist/context-shared-CupikwQo.mjs +39 -0
- package/dist/context-shared-CupikwQo.mjs.map +1 -0
- package/dist/context-shared-X2ulHHSB.cjs +44 -0
- package/dist/context-shared-X2ulHHSB.cjs.map +1 -0
- package/dist/context.cjs +82 -0
- package/dist/context.cjs.map +1 -0
- package/dist/context.d.cts +2 -0
- package/dist/context.d.mts +2 -0
- package/dist/context.mjs +78 -0
- package/dist/context.mjs.map +1 -0
- package/dist/contract-BljSE-Hx.mjs +33 -0
- package/dist/contract-BljSE-Hx.mjs.map +1 -0
- package/dist/contract-BmwHIiMR.d.mts +150 -0
- package/dist/contract-CWJSYoJl.d.cts +150 -0
- package/dist/contract-Cht05WYQ.d.mts +159 -0
- package/dist/contract-CqYQzB6e.d.cts +49 -0
- package/dist/contract-DYvBNdnR.cjs +74 -0
- package/dist/contract-DYvBNdnR.cjs.map +1 -0
- package/dist/contract-DlTo4u2t.d.cts +30 -0
- package/dist/contract-DlTo4u2t.d.mts +30 -0
- package/dist/contract-DsVL5-gy.cjs +50 -0
- package/dist/contract-DsVL5-gy.cjs.map +1 -0
- package/dist/contract-isM9SjjQ.mjs +39 -0
- package/dist/contract-isM9SjjQ.mjs.map +1 -0
- package/dist/contract-pU3wGFmo.d.cts +159 -0
- package/dist/contract-yPNuFnVy.d.mts +49 -0
- package/dist/core-C0ceVOTk.d.cts +513 -0
- package/dist/core-CTr7dw0v.cjs +1725 -0
- package/dist/core-CTr7dw0v.cjs.map +1 -0
- package/dist/core-IdGEbYdM.mjs +1541 -0
- package/dist/core-IdGEbYdM.mjs.map +1 -0
- package/dist/core-KtEHRScZ.d.mts +513 -0
- package/dist/core.cjs +9 -0
- package/dist/core.d.cts +2 -0
- package/dist/core.d.mts +2 -0
- package/dist/core.mjs +2 -0
- package/dist/create-fetch-handler-1pXSEhGi.d.cts +311 -0
- package/dist/create-fetch-handler-BwQQ_IWf.mjs +2156 -0
- package/dist/create-fetch-handler-BwQQ_IWf.mjs.map +1 -0
- package/dist/create-fetch-handler-D8cTMVX9.cjs +2232 -0
- package/dist/create-fetch-handler-D8cTMVX9.cjs.map +1 -0
- package/dist/create-fetch-handler-zioPVS18.d.mts +311 -0
- package/dist/elysia-shared-C7geKqPP.mjs +55 -0
- package/dist/elysia-shared-C7geKqPP.mjs.map +1 -0
- package/dist/elysia-shared-DT4bfekR.d.cts +20 -0
- package/dist/elysia-shared-DXyAyGz_.cjs +66 -0
- package/dist/elysia-shared-DXyAyGz_.cjs.map +1 -0
- package/dist/elysia-shared-DoL5ab52.d.mts +20 -0
- package/dist/entry-auth-basic.cjs +5 -0
- package/dist/entry-auth-basic.d.cts +83 -0
- package/dist/entry-auth-basic.d.mts +83 -0
- package/dist/entry-auth-basic.mjs +2 -0
- package/dist/entry-auth-delegated.cjs +28 -0
- package/dist/entry-auth-delegated.cjs.map +1 -0
- package/dist/entry-auth-delegated.d.cts +36 -0
- package/dist/entry-auth-delegated.d.mts +36 -0
- package/dist/entry-auth-delegated.mjs +27 -0
- package/dist/entry-auth-delegated.mjs.map +1 -0
- package/dist/entry-auth-none.cjs +4 -0
- package/dist/entry-auth-none.d.cts +25 -0
- package/dist/entry-auth-none.d.mts +25 -0
- package/dist/entry-auth-none.mjs +2 -0
- package/dist/entry-authorization-delegated.cjs +28 -0
- package/dist/entry-authorization-delegated.cjs.map +1 -0
- package/dist/entry-authorization-delegated.d.cts +32 -0
- package/dist/entry-authorization-delegated.d.mts +32 -0
- package/dist/entry-authorization-delegated.mjs +27 -0
- package/dist/entry-authorization-delegated.mjs.map +1 -0
- package/dist/entry-authorization-none.cjs +3 -0
- package/dist/entry-authorization-none.d.cts +18 -0
- package/dist/entry-authorization-none.d.mts +18 -0
- package/dist/entry-authorization-none.mjs +2 -0
- package/dist/entry-authorization-roles.cjs +8 -0
- package/dist/entry-authorization-roles.d.cts +64 -0
- package/dist/entry-authorization-roles.d.mts +64 -0
- package/dist/entry-authorization-roles.mjs +3 -0
- package/dist/entry-bun.cjs +55 -0
- package/dist/entry-bun.cjs.map +1 -0
- package/dist/entry-bun.d.cts +29 -0
- package/dist/entry-bun.d.mts +29 -0
- package/dist/entry-bun.mjs +52 -0
- package/dist/entry-bun.mjs.map +1 -0
- package/dist/entry-drizzle-audit.cjs +191 -0
- package/dist/entry-drizzle-audit.cjs.map +1 -0
- package/dist/entry-drizzle-audit.d.cts +118 -0
- package/dist/entry-drizzle-audit.d.mts +118 -0
- package/dist/entry-drizzle-audit.mjs +186 -0
- package/dist/entry-drizzle-audit.mjs.map +1 -0
- package/dist/entry-drizzle-mysql.cjs +75 -0
- package/dist/entry-drizzle-mysql.cjs.map +1 -0
- package/dist/entry-drizzle-mysql.d.cts +42 -0
- package/dist/entry-drizzle-mysql.d.mts +42 -0
- package/dist/entry-drizzle-mysql.mjs +71 -0
- package/dist/entry-drizzle-mysql.mjs.map +1 -0
- package/dist/entry-drizzle-pg.cjs +82 -0
- package/dist/entry-drizzle-pg.cjs.map +1 -0
- package/dist/entry-drizzle-pg.d.cts +48 -0
- package/dist/entry-drizzle-pg.d.mts +48 -0
- package/dist/entry-drizzle-pg.mjs +78 -0
- package/dist/entry-drizzle-pg.mjs.map +1 -0
- package/dist/entry-drizzle-sqlite.cjs +71 -0
- package/dist/entry-drizzle-sqlite.cjs.map +1 -0
- package/dist/entry-drizzle-sqlite.d.cts +37 -0
- package/dist/entry-drizzle-sqlite.d.mts +37 -0
- package/dist/entry-drizzle-sqlite.mjs +67 -0
- package/dist/entry-drizzle-sqlite.mjs.map +1 -0
- package/dist/entry-elysia.cjs +112 -0
- package/dist/entry-elysia.cjs.map +1 -0
- package/dist/entry-elysia.d.cts +710 -0
- package/dist/entry-elysia.d.mts +710 -0
- package/dist/entry-elysia.mjs +109 -0
- package/dist/entry-elysia.mjs.map +1 -0
- package/dist/entry-elysia2.cjs +101 -0
- package/dist/entry-elysia2.cjs.map +1 -0
- package/dist/entry-elysia2.d.cts +905 -0
- package/dist/entry-elysia2.d.mts +905 -0
- package/dist/entry-elysia2.mjs +98 -0
- package/dist/entry-elysia2.mjs.map +1 -0
- package/dist/entry-express.cjs +90 -0
- package/dist/entry-express.cjs.map +1 -0
- package/dist/entry-express.d.cts +24 -0
- package/dist/entry-express.d.mts +24 -0
- package/dist/entry-express.mjs +88 -0
- package/dist/entry-express.mjs.map +1 -0
- package/dist/entry-hono.cjs +36 -0
- package/dist/entry-hono.cjs.map +1 -0
- package/dist/entry-hono.d.cts +24 -0
- package/dist/entry-hono.d.mts +24 -0
- package/dist/entry-hono.mjs +34 -0
- package/dist/entry-hono.mjs.map +1 -0
- package/dist/entry-hooks-log.cjs +22 -0
- package/dist/entry-hooks-log.cjs.map +1 -0
- package/dist/entry-hooks-log.d.cts +23 -0
- package/dist/entry-hooks-log.d.mts +23 -0
- package/dist/entry-hooks-log.mjs +21 -0
- package/dist/entry-hooks-log.mjs.map +1 -0
- package/dist/entry-sinks-console.cjs +43 -0
- package/dist/entry-sinks-console.cjs.map +1 -0
- package/dist/entry-sinks-console.d.cts +26 -0
- package/dist/entry-sinks-console.d.mts +26 -0
- package/dist/entry-sinks-console.mjs +41 -0
- package/dist/entry-sinks-console.mjs.map +1 -0
- package/dist/entry-sinks-datadog.cjs +97 -0
- package/dist/entry-sinks-datadog.cjs.map +1 -0
- package/dist/entry-sinks-datadog.d.cts +66 -0
- package/dist/entry-sinks-datadog.d.mts +66 -0
- package/dist/entry-sinks-datadog.mjs +91 -0
- package/dist/entry-sinks-datadog.mjs.map +1 -0
- package/dist/entry-sinks-file.cjs +100 -0
- package/dist/entry-sinks-file.cjs.map +1 -0
- package/dist/entry-sinks-file.d.cts +70 -0
- package/dist/entry-sinks-file.d.mts +70 -0
- package/dist/entry-sinks-file.mjs +97 -0
- package/dist/entry-sinks-file.mjs.map +1 -0
- package/dist/entry-sinks-http.cjs +63 -0
- package/dist/entry-sinks-http.cjs.map +1 -0
- package/dist/entry-sinks-http.d.cts +55 -0
- package/dist/entry-sinks-http.d.mts +55 -0
- package/dist/entry-sinks-http.mjs +60 -0
- package/dist/entry-sinks-http.mjs.map +1 -0
- package/dist/entry-sinks-s3.cjs +115 -0
- package/dist/entry-sinks-s3.cjs.map +1 -0
- package/dist/entry-sinks-s3.d.cts +79 -0
- package/dist/entry-sinks-s3.d.mts +79 -0
- package/dist/entry-sinks-s3.mjs +112 -0
- package/dist/entry-sinks-s3.mjs.map +1 -0
- package/dist/entry-sinks-splunk.cjs +80 -0
- package/dist/entry-sinks-splunk.cjs.map +1 -0
- package/dist/entry-sinks-splunk.d.cts +58 -0
- package/dist/entry-sinks-splunk.d.mts +58 -0
- package/dist/entry-sinks-splunk.mjs +77 -0
- package/dist/entry-sinks-splunk.mjs.map +1 -0
- package/dist/entry-sinks-webhook.cjs +130 -0
- package/dist/entry-sinks-webhook.cjs.map +1 -0
- package/dist/entry-sinks-webhook.d.cts +69 -0
- package/dist/entry-sinks-webhook.d.mts +69 -0
- package/dist/entry-sinks-webhook.mjs +125 -0
- package/dist/entry-sinks-webhook.mjs.map +1 -0
- package/dist/entry-sinks-xtandard-webhooks.cjs +64 -0
- package/dist/entry-sinks-xtandard-webhooks.cjs.map +1 -0
- package/dist/entry-sinks-xtandard-webhooks.d.cts +64 -0
- package/dist/entry-sinks-xtandard-webhooks.d.mts +64 -0
- package/dist/entry-sinks-xtandard-webhooks.mjs +63 -0
- package/dist/entry-sinks-xtandard-webhooks.mjs.map +1 -0
- package/dist/entry-storage-cloudflare-kv.cjs +47 -0
- package/dist/entry-storage-cloudflare-kv.cjs.map +1 -0
- package/dist/entry-storage-cloudflare-kv.d.cts +42 -0
- package/dist/entry-storage-cloudflare-kv.d.mts +42 -0
- package/dist/entry-storage-cloudflare-kv.mjs +46 -0
- package/dist/entry-storage-cloudflare-kv.mjs.map +1 -0
- package/dist/entry-storage-drizzle.cjs +228 -0
- package/dist/entry-storage-drizzle.cjs.map +1 -0
- package/dist/entry-storage-drizzle.d.cts +43 -0
- package/dist/entry-storage-drizzle.d.mts +43 -0
- package/dist/entry-storage-drizzle.mjs +227 -0
- package/dist/entry-storage-drizzle.mjs.map +1 -0
- package/dist/entry-storage-file.cjs +175 -0
- package/dist/entry-storage-file.cjs.map +1 -0
- package/dist/entry-storage-file.d.cts +41 -0
- package/dist/entry-storage-file.d.mts +41 -0
- package/dist/entry-storage-file.mjs +171 -0
- package/dist/entry-storage-file.mjs.map +1 -0
- package/dist/entry-storage-libsql.cjs +133 -0
- package/dist/entry-storage-libsql.cjs.map +1 -0
- package/dist/entry-storage-libsql.d.cts +60 -0
- package/dist/entry-storage-libsql.d.mts +60 -0
- package/dist/entry-storage-libsql.mjs +132 -0
- package/dist/entry-storage-libsql.mjs.map +1 -0
- package/dist/entry-storage-memory.cjs +3 -0
- package/dist/entry-storage-memory.d.cts +2 -0
- package/dist/entry-storage-memory.d.mts +2 -0
- package/dist/entry-storage-memory.mjs +2 -0
- package/dist/entry-storage-mongodb.cjs +306 -0
- package/dist/entry-storage-mongodb.cjs.map +1 -0
- package/dist/entry-storage-mongodb.d.cts +65 -0
- package/dist/entry-storage-mongodb.d.mts +65 -0
- package/dist/entry-storage-mongodb.mjs +304 -0
- package/dist/entry-storage-mongodb.mjs.map +1 -0
- package/dist/entry-storage-postgres.cjs +261 -0
- package/dist/entry-storage-postgres.cjs.map +1 -0
- package/dist/entry-storage-postgres.d.cts +66 -0
- package/dist/entry-storage-postgres.d.mts +66 -0
- package/dist/entry-storage-postgres.mjs +260 -0
- package/dist/entry-storage-postgres.mjs.map +1 -0
- package/dist/entry-storage-redis.cjs +223 -0
- package/dist/entry-storage-redis.cjs.map +1 -0
- package/dist/entry-storage-redis.d.cts +77 -0
- package/dist/entry-storage-redis.d.mts +77 -0
- package/dist/entry-storage-redis.mjs +221 -0
- package/dist/entry-storage-redis.mjs.map +1 -0
- package/dist/entry-storage-sqlite.cjs +85 -0
- package/dist/entry-storage-sqlite.cjs.map +1 -0
- package/dist/entry-storage-sqlite.d.cts +40 -0
- package/dist/entry-storage-sqlite.d.mts +40 -0
- package/dist/entry-storage-sqlite.mjs +84 -0
- package/dist/entry-storage-sqlite.mjs.map +1 -0
- package/dist/entry-storage-unstorage.cjs +57 -0
- package/dist/entry-storage-unstorage.cjs.map +1 -0
- package/dist/entry-storage-unstorage.d.cts +29 -0
- package/dist/entry-storage-unstorage.d.mts +29 -0
- package/dist/entry-storage-unstorage.mjs +56 -0
- package/dist/entry-storage-unstorage.mjs.map +1 -0
- package/dist/export-B9S-JeYl.mjs +239 -0
- package/dist/export-B9S-JeYl.mjs.map +1 -0
- package/dist/export-BZq0KCCn.d.mts +70 -0
- package/dist/export-DYfMd-ep.cjs +280 -0
- package/dist/export-DYfMd-ep.cjs.map +1 -0
- package/dist/export-Dh8T8I1p.d.cts +70 -0
- package/dist/index.cjs +279 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +286 -0
- package/dist/index.d.mts +284 -0
- package/dist/index.mjs +177 -0
- package/dist/index.mjs.map +1 -0
- package/dist/integrity-BHhjTBNk.cjs +614 -0
- package/dist/integrity-BHhjTBNk.cjs.map +1 -0
- package/dist/integrity-kfY2DNAi.mjs +483 -0
- package/dist/integrity-kfY2DNAi.mjs.map +1 -0
- package/dist/memory-CfykUo9W.cjs +155 -0
- package/dist/memory-CfykUo9W.cjs.map +1 -0
- package/dist/memory-DrR-Tlbf.d.mts +28 -0
- package/dist/memory-GG2Nba1D.mjs +150 -0
- package/dist/memory-GG2Nba1D.mjs.map +1 -0
- package/dist/memory-HpFdlMR_.d.cts +28 -0
- package/dist/none-Be7r6kHH.cjs +33 -0
- package/dist/none-Be7r6kHH.cjs.map +1 -0
- package/dist/none-CGmIIbI8.cjs +49 -0
- package/dist/none-CGmIIbI8.cjs.map +1 -0
- package/dist/none-CkV5mZsB.mjs +33 -0
- package/dist/none-CkV5mZsB.mjs.map +1 -0
- package/dist/none-DBeBeU0Z.mjs +23 -0
- package/dist/none-DBeBeU0Z.mjs.map +1 -0
- package/dist/query-ChGGtlA7.cjs +243 -0
- package/dist/query-ChGGtlA7.cjs.map +1 -0
- package/dist/query-LvZbyi37.mjs +172 -0
- package/dist/query-LvZbyi37.mjs.map +1 -0
- package/dist/react.css +1 -0
- package/dist/react.js +31936 -0
- package/dist/recorder-B3dG3jbd.d.mts +64 -0
- package/dist/recorder-CGY7HK29.d.cts +64 -0
- package/dist/roles-BARtYLSX.cjs +112 -0
- package/dist/roles-BARtYLSX.cjs.map +1 -0
- package/dist/roles-D7Pg89IJ.mjs +83 -0
- package/dist/roles-D7Pg89IJ.mjs.map +1 -0
- package/dist/schema-DmU7Wp0F.d.cts +251 -0
- package/dist/schema-DmU7Wp0F.d.mts +251 -0
- package/dist/schema.cjs +20 -0
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.cts +2 -0
- package/dist/schema.d.mts +2 -0
- package/dist/schema.mjs +17 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/shared-CJOyJKqT.d.mts +20 -0
- package/dist/shared-DSDY-V0n.mjs +100 -0
- package/dist/shared-DSDY-V0n.mjs.map +1 -0
- package/dist/shared-EANCdRqn.d.cts +20 -0
- package/dist/shared-OOAq-U4S.cjs +141 -0
- package/dist/shared-OOAq-U4S.cjs.map +1 -0
- package/dist/sql-B7b6HzGy.cjs +280 -0
- package/dist/sql-B7b6HzGy.cjs.map +1 -0
- package/dist/sql-COjPyn3F.mjs +209 -0
- package/dist/sql-COjPyn3F.mjs.map +1 -0
- package/dist/sqlite-event-log-BnoG8eos.cjs +184 -0
- package/dist/sqlite-event-log-BnoG8eos.cjs.map +1 -0
- package/dist/sqlite-event-log-nXmS2DS_.mjs +179 -0
- package/dist/sqlite-event-log-nXmS2DS_.mjs.map +1 -0
- package/dist/streams-CRuxOYcb.d.cts +124 -0
- package/dist/streams-DU0_gvI8.d.mts +124 -0
- package/dist/table-BcarDd10.d.cts +48 -0
- package/dist/table-BcarDd10.d.mts +48 -0
- package/dist/testing.cjs +189 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +103 -0
- package/dist/testing.d.mts +103 -0
- package/dist/testing.mjs +185 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/types-elysia2/adapters/bun.d.ts +47 -0
- package/dist/types-elysia2/adapters/context-shared.d.ts +40 -0
- package/dist/types-elysia2/adapters/elysia-shared.d.ts +36 -0
- package/dist/types-elysia2/adapters/elysia2.d.ts +588 -0
- package/dist/types-elysia2/auth/contract.d.ts +26 -0
- package/dist/types-elysia2/authorization/contract.d.ts +54 -0
- package/dist/types-elysia2/canonical.d.ts +25 -0
- package/dist/types-elysia2/context.d.ts +61 -0
- package/dist/types-elysia2/core.d.ts +232 -0
- package/dist/types-elysia2/duration.d.ts +26 -0
- package/dist/types-elysia2/entry-elysia2.d.ts +10 -0
- package/dist/types-elysia2/event-log.d.ts +33 -0
- package/dist/types-elysia2/export.d.ts +77 -0
- package/dist/types-elysia2/hooks/contract.d.ts +177 -0
- package/dist/types-elysia2/id.d.ts +27 -0
- package/dist/types-elysia2/integrity.d.ts +193 -0
- package/dist/types-elysia2/keys.d.ts +91 -0
- package/dist/types-elysia2/portal.d.ts +137 -0
- package/dist/types-elysia2/query.d.ts +88 -0
- package/dist/types-elysia2/schema.d.ts +247 -0
- package/dist/types-elysia2/server/base-path.d.ts +15 -0
- package/dist/types-elysia2/server/cors.d.ts +36 -0
- package/dist/types-elysia2/server/create-fetch-handler.d.ts +140 -0
- package/dist/types-elysia2/server/openapi.d.ts +25 -0
- package/dist/types-elysia2/server/render-index-html.d.ts +18 -0
- package/dist/types-elysia2/server/routes.d.ts +83 -0
- package/dist/types-elysia2/server/static-assets.d.ts +13 -0
- package/dist/types-elysia2/standard-schema.d.ts +100 -0
- package/dist/types-elysia2/storage/contract.d.ts +106 -0
- package/dist/types-elysia2/streams.d.ts +134 -0
- package/dist/types-elysia2/transforms.d.ts +56 -0
- package/dist/types-elysia2/validation.d.ts +48 -0
- package/dist/types-react/canonical.d.ts +25 -0
- package/dist/types-react/context.d.ts +61 -0
- package/dist/types-react/core.d.ts +232 -0
- package/dist/types-react/duration.d.ts +26 -0
- package/dist/types-react/event-log.d.ts +33 -0
- package/dist/types-react/hooks/contract.d.ts +177 -0
- package/dist/types-react/id.d.ts +27 -0
- package/dist/types-react/integrity.d.ts +193 -0
- package/dist/types-react/keys.d.ts +91 -0
- package/dist/types-react/query.d.ts +88 -0
- package/dist/types-react/react.d.ts +114 -0
- package/dist/types-react/schema.d.ts +247 -0
- package/dist/types-react/standard-schema.d.ts +100 -0
- package/dist/types-react/storage/contract.d.ts +106 -0
- package/dist/types-react/streams.d.ts +134 -0
- package/dist/types-react/transforms.d.ts +56 -0
- package/dist/types-react/ui/App.d.ts +36 -0
- package/dist/types-react/ui/api.d.ts +61 -0
- package/dist/types-react/ui/components/ActionFilter.d.ts +17 -0
- package/dist/types-react/ui/components/ExportMenu.d.ts +13 -0
- package/dist/types-react/ui/components/JsonCodeEditor.d.ts +12 -0
- package/dist/types-react/ui/components/ThemeToggle.d.ts +2 -0
- package/dist/types-react/ui/components/Toast.d.ts +16 -0
- package/dist/types-react/ui/components/audit-bits.d.ts +91 -0
- package/dist/types-react/ui/components/integrity-bits.d.ts +19 -0
- package/dist/types-react/ui/components/primitives.d.ts +50 -0
- package/dist/types-react/ui/components/ui-bits.d.ts +22 -0
- package/dist/types-react/ui/lib/filters.d.ts +70 -0
- package/dist/types-react/ui/lib/format.d.ts +82 -0
- package/dist/types-react/ui/lib/nav-guard.d.ts +20 -0
- package/dist/types-react/ui/lib/portal-container.d.ts +24 -0
- package/dist/types-react/ui/lib/utils.d.ts +3 -0
- package/dist/types-react/ui/theme.d.ts +40 -0
- package/dist/types-react/ui/types.d.ts +67 -0
- package/dist/types-react/ui/views/ActionsView.d.ts +10 -0
- package/dist/types-react/ui/views/EventDrawer.d.ts +15 -0
- package/dist/types-react/ui/views/EventsView.d.ts +10 -0
- package/dist/types-react/ui/views/IntegrityView.d.ts +10 -0
- package/dist/types-react/ui/views/OverviewView.d.ts +9 -0
- package/dist/types-react/ui/views/StreamsView.d.ts +10 -0
- package/dist/types-react/ui/views/TenantsView.d.ts +6 -0
- package/dist/types-react/validation.d.ts +48 -0
- package/dist/ui/assets/favicon-BSj8MPnj.svg +11 -0
- package/dist/ui/assets/index-B-qrQSOM.css +1 -0
- package/dist/ui/assets/index-CemlP5hR.js +244 -0
- package/dist/ui/index.html +15 -0
- package/dist/validation-DFrLESZD.mjs +150 -0
- package/dist/validation-DFrLESZD.mjs.map +1 -0
- package/dist/validation-lb0YXrxx.cjs +235 -0
- package/dist/validation-lb0YXrxx.cjs.map +1 -0
- package/dist/verify.cjs +14 -0
- package/dist/verify.d.cts +5 -0
- package/dist/verify.d.mts +5 -0
- package/dist/verify.mjs +3 -0
- package/package.json +610 -4
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core type definitions for `@xtandard/audit`.
|
|
3
|
+
*
|
|
4
|
+
* This module is **types only** — no runtime code beyond tiny guards and
|
|
5
|
+
* constants, no dependencies. It is safe to import from the record hot path and
|
|
6
|
+
* the zero-dependency verifier. Runtime validation (which pulls in `valibot`)
|
|
7
|
+
* lives in {@link ./validation}.
|
|
8
|
+
*
|
|
9
|
+
* Import from `@xtandard/audit/schema` (also re-exported by the root).
|
|
10
|
+
*
|
|
11
|
+
* @module schema
|
|
12
|
+
*/
|
|
13
|
+
/** JSON-serializable value, used for metadata, context, and catalog schemas. */
|
|
14
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
15
|
+
[key: string]: JsonValue | undefined;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A JSON object (the shape of `metadata`, `context`, and actor/target
|
|
19
|
+
* metadata). `undefined` members are allowed for ergonomics and dropped on
|
|
20
|
+
* serialization, exactly like `JSON.stringify`.
|
|
21
|
+
*/
|
|
22
|
+
export type JsonObject = {
|
|
23
|
+
[key: string]: JsonValue | undefined;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A duration for configuration options: either milliseconds as a number, or a
|
|
27
|
+
* human-friendly string such as `"5s"`, `"30m"`, `"2h"`, `"90d"`. Parsed by
|
|
28
|
+
* {@link ./duration.durationToMs}.
|
|
29
|
+
*/
|
|
30
|
+
export type AuditDuration = number | `${number}${"ms" | "s" | "m" | "h" | "d"}`;
|
|
31
|
+
/** Current schema version for stored records. */
|
|
32
|
+
export declare const SCHEMA_VERSION: 1;
|
|
33
|
+
/** Who performed the action. `id` is required; everything else is presentational. */
|
|
34
|
+
export interface AuditActor {
|
|
35
|
+
/** Stable identifier of the actor in the host's system (user id, API key id, …). */
|
|
36
|
+
id: string;
|
|
37
|
+
/** Kind of actor, e.g. `"user"`, `"api_key"`, `"system"`, `"support"`. Default `"user"`. */
|
|
38
|
+
type?: string;
|
|
39
|
+
/** Display name. */
|
|
40
|
+
name?: string;
|
|
41
|
+
/** Email, when the actor is a person. */
|
|
42
|
+
email?: string;
|
|
43
|
+
/** Arbitrary extra attributes. */
|
|
44
|
+
metadata?: JsonObject;
|
|
45
|
+
}
|
|
46
|
+
/** A resource the action was performed on. */
|
|
47
|
+
export interface AuditTarget {
|
|
48
|
+
/** Resource kind, e.g. `"invoice"`, `"user"`, `"team"`. */
|
|
49
|
+
type: string;
|
|
50
|
+
/** Stable identifier of the resource. */
|
|
51
|
+
id: string;
|
|
52
|
+
/** Display name. */
|
|
53
|
+
name?: string;
|
|
54
|
+
/** Arbitrary extra attributes. */
|
|
55
|
+
metadata?: JsonObject;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Where the action came from. Well-known keys are typed; any other JSON key is
|
|
59
|
+
* allowed (e.g. `sessionId`, `apiVersion`).
|
|
60
|
+
*/
|
|
61
|
+
export interface AuditContext {
|
|
62
|
+
/** Client IP address. */
|
|
63
|
+
ip?: string;
|
|
64
|
+
/** Client user agent. */
|
|
65
|
+
userAgent?: string;
|
|
66
|
+
/** Correlation id of the request that caused the event. */
|
|
67
|
+
requestId?: string;
|
|
68
|
+
/** Human-readable location (e.g. from GeoIP), if the host resolves one. */
|
|
69
|
+
location?: string;
|
|
70
|
+
[key: string]: JsonValue | undefined;
|
|
71
|
+
}
|
|
72
|
+
/** Outcome of the audited action. */
|
|
73
|
+
export type AuditOutcome = "success" | "failure";
|
|
74
|
+
/**
|
|
75
|
+
* The privacy-bearing sections of an event. Each is hashed separately (salted
|
|
76
|
+
* with the event id) so it can be erased without breaking the chain (ADR 0004,
|
|
77
|
+
* ADR 0011).
|
|
78
|
+
*/
|
|
79
|
+
export type AuditSection = "actor" | "targets" | "context" | "metadata" | "description";
|
|
80
|
+
/** All sections, in canonical order. */
|
|
81
|
+
export declare const AUDIT_SECTIONS: readonly AuditSection[];
|
|
82
|
+
/** Marker that replaces the content of an erased section. */
|
|
83
|
+
export declare const ERASED_MARKER: {
|
|
84
|
+
readonly $erased: true;
|
|
85
|
+
};
|
|
86
|
+
/** The tamper-evidence block carried by every stored event (ADR 0004). */
|
|
87
|
+
export interface AuditIntegrity {
|
|
88
|
+
/** Integrity format version. */
|
|
89
|
+
v: 1;
|
|
90
|
+
/** The previous event's `hash` in this tenant's chain (genesis for `seq` 1, or the prune base). */
|
|
91
|
+
prevHash: string;
|
|
92
|
+
/** This event's chain hash: SHA-256 over the canonical header. */
|
|
93
|
+
hash: string;
|
|
94
|
+
/** Per-section digests, salted with the event id. */
|
|
95
|
+
digests: Record<AuditSection, string>;
|
|
96
|
+
/** Sections erased after the fact (their content is the erasure marker; digests are kept). */
|
|
97
|
+
erased?: AuditSection[];
|
|
98
|
+
}
|
|
99
|
+
/** A stored, chained audit event. */
|
|
100
|
+
export interface AuditEvent {
|
|
101
|
+
/** `evt_` + 26-char time-sortable id (ADR 0010). */
|
|
102
|
+
id: string;
|
|
103
|
+
/** The tenant (customer organization) the event belongs to. */
|
|
104
|
+
tenant: string;
|
|
105
|
+
/** Position in the tenant's chain: contiguous from 1. */
|
|
106
|
+
seq: number;
|
|
107
|
+
/** What happened, e.g. `"invoice.paid"`, `"member.role_changed"`. */
|
|
108
|
+
action: string;
|
|
109
|
+
/** ISO-8601: when it happened (caller-supplied, or record time). */
|
|
110
|
+
occurredAt: string;
|
|
111
|
+
/** ISO-8601: when the log accepted it. */
|
|
112
|
+
recordedAt: string;
|
|
113
|
+
actor: AuditActor;
|
|
114
|
+
targets: AuditTarget[];
|
|
115
|
+
context: AuditContext;
|
|
116
|
+
/** Action-specific data (typed per action via `defineActions`). */
|
|
117
|
+
metadata: JsonObject;
|
|
118
|
+
outcome?: AuditOutcome;
|
|
119
|
+
/** Optional human-readable sentence ("Alice changed Bob's role to admin"). */
|
|
120
|
+
description?: string;
|
|
121
|
+
integrity: AuditIntegrity;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* What callers pass to `record()`. Everything the log derives itself (`seq`,
|
|
125
|
+
* `recordedAt`, `integrity`) is omitted; `id` and `occurredAt` are optional.
|
|
126
|
+
*/
|
|
127
|
+
export interface AuditEventInput<TAction extends string = string, TMetadata = JsonObject> {
|
|
128
|
+
/** Supply your own id for idempotent re-recording (same id + same content = no-op). */
|
|
129
|
+
id?: string;
|
|
130
|
+
tenant: string;
|
|
131
|
+
action: TAction;
|
|
132
|
+
/** ISO-8601 or `Date`. Defaults to now. */
|
|
133
|
+
occurredAt?: string | Date;
|
|
134
|
+
/** Defaults to the ambient request context's actor (see `@xtandard/audit/context`). */
|
|
135
|
+
actor?: AuditActor;
|
|
136
|
+
targets?: AuditTarget[];
|
|
137
|
+
/** Merged over the ambient request context (explicit keys win). */
|
|
138
|
+
context?: AuditContext;
|
|
139
|
+
metadata?: TMetadata;
|
|
140
|
+
outcome?: AuditOutcome;
|
|
141
|
+
description?: string;
|
|
142
|
+
}
|
|
143
|
+
/** A signed chain head (ADR 0004). */
|
|
144
|
+
export interface AuditCheckpoint {
|
|
145
|
+
/** Checkpoint format version. */
|
|
146
|
+
v: 1;
|
|
147
|
+
/** `chk_` + time-sortable id. */
|
|
148
|
+
id: string;
|
|
149
|
+
tenant: string;
|
|
150
|
+
/**
|
|
151
|
+
* `"head"`: signs the chain head at `seq`. `"base"`: anchors a pruned prefix —
|
|
152
|
+
* `hash` is the hash of the last pruned event, i.e. the `prevHash` the first
|
|
153
|
+
* retained event must carry.
|
|
154
|
+
*/
|
|
155
|
+
kind: "head" | "base";
|
|
156
|
+
seq: number;
|
|
157
|
+
hash: string;
|
|
158
|
+
/** ISO-8601 creation time. */
|
|
159
|
+
at: string;
|
|
160
|
+
/** Signing key id (matches a key in the JWKS). */
|
|
161
|
+
keyId: string;
|
|
162
|
+
/** Signature algorithm. */
|
|
163
|
+
alg: "Ed25519" | "HS256";
|
|
164
|
+
/** base64url signature over the canonical checkpoint minus `signature`. */
|
|
165
|
+
signature: string;
|
|
166
|
+
}
|
|
167
|
+
/** The current head of one tenant's chain. */
|
|
168
|
+
export interface ChainHead {
|
|
169
|
+
tenant: string;
|
|
170
|
+
/** Last assigned seq (0 when empty). */
|
|
171
|
+
seq: number;
|
|
172
|
+
/** Hash of the event at `seq` (genesis when empty). */
|
|
173
|
+
hash: string;
|
|
174
|
+
/** First retained seq after pruning (1 when never pruned). */
|
|
175
|
+
baseSeq?: number;
|
|
176
|
+
/** `prevHash` of the first retained event (genesis when never pruned). */
|
|
177
|
+
baseHash?: string;
|
|
178
|
+
/** ISO-8601 time of the last append. */
|
|
179
|
+
updatedAt?: string;
|
|
180
|
+
}
|
|
181
|
+
/** Tenant summary for listings. */
|
|
182
|
+
export interface AuditTenant {
|
|
183
|
+
key: string;
|
|
184
|
+
/** Events currently retained. */
|
|
185
|
+
count?: number;
|
|
186
|
+
head: ChainHead;
|
|
187
|
+
/** ISO-8601 time of the first event ever recorded. */
|
|
188
|
+
createdAt?: string;
|
|
189
|
+
}
|
|
190
|
+
/** Action catalog entry (documentation + UI; schemas live in code, ADR 0012). */
|
|
191
|
+
export interface ActionDefinition {
|
|
192
|
+
/** Dot-delimited name, e.g. `"invoice.paid"`. Allowed: `a-z A-Z 0-9 . _ - :`. */
|
|
193
|
+
name: string;
|
|
194
|
+
description?: string;
|
|
195
|
+
/** UI grouping label (e.g. `"Billing"`). */
|
|
196
|
+
group?: string;
|
|
197
|
+
/** Target types this action is expected to carry. Documentation only. */
|
|
198
|
+
targets?: string[];
|
|
199
|
+
/** JSON-Schema-ish description of `metadata`, for the UI. Documentation only. */
|
|
200
|
+
schema?: JsonValue;
|
|
201
|
+
/** Flagged in the UI; still recordable. */
|
|
202
|
+
deprecated?: boolean;
|
|
203
|
+
/** Where this entry came from: `"code"` (`defineActions`) or `"ui"`. */
|
|
204
|
+
source?: "code" | "ui";
|
|
205
|
+
createdAt?: string;
|
|
206
|
+
updatedAt?: string;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The query model (ADR 0007). All filters are AND-ed; list-valued filters are
|
|
210
|
+
* OR-ed within themselves.
|
|
211
|
+
*/
|
|
212
|
+
export interface AuditQuery {
|
|
213
|
+
/** Restrict to one tenant. Forced for portal principals. */
|
|
214
|
+
tenant?: string;
|
|
215
|
+
/** Exact action names, or families with a trailing `*` (`"invoice.*"`). */
|
|
216
|
+
actions?: string[];
|
|
217
|
+
/** Exclude these names / families. */
|
|
218
|
+
excludeActions?: string[];
|
|
219
|
+
actorId?: string;
|
|
220
|
+
actorType?: string;
|
|
221
|
+
targetType?: string;
|
|
222
|
+
targetId?: string;
|
|
223
|
+
outcome?: AuditOutcome;
|
|
224
|
+
/** Inclusive lower bound on `occurredAt` (ISO-8601). */
|
|
225
|
+
from?: string;
|
|
226
|
+
/** Exclusive upper bound on `occurredAt` (ISO-8601). */
|
|
227
|
+
to?: string;
|
|
228
|
+
/** Case-insensitive substring over action, actor, targets, description, metadata. */
|
|
229
|
+
search?: string;
|
|
230
|
+
/** Sort by `(occurredAt, id)`. Default `"desc"` (newest first). */
|
|
231
|
+
order?: "desc" | "asc";
|
|
232
|
+
/** Page size. Default 50, max 500. */
|
|
233
|
+
limit?: number;
|
|
234
|
+
/** Opaque keyset cursor from a previous page's `pageInfo.endCursor`. */
|
|
235
|
+
cursor?: string;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* One page of results — the `@xtandard/lib` `Paginated<T>` envelope shape, so a
|
|
239
|
+
* host can feed it to `createPaginator({ fetchCursor })` unchanged (ADR 0007).
|
|
240
|
+
*/
|
|
241
|
+
export interface AuditPage<T = AuditEvent> {
|
|
242
|
+
items: T[];
|
|
243
|
+
pageInfo: {
|
|
244
|
+
hasNextPage: boolean;
|
|
245
|
+
endCursor: string | null;
|
|
246
|
+
};
|
|
247
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendored [Standard Schema v1](https://standardschema.dev) types (type-only,
|
|
3
|
+
* zero runtime) plus the action-map helpers that give `record()` its compile-time
|
|
4
|
+
* typing (ADR 0012). Any compliant validator works: valibot, zod, arktype,
|
|
5
|
+
* effect schema, …
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { AuditOutcome, JsonObject, JsonValue } from "./schema.ts";
|
|
10
|
+
/** The Standard Schema v1 interface (vendored, type-only). */
|
|
11
|
+
export interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
12
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
13
|
+
}
|
|
14
|
+
export declare namespace StandardSchemaV1 {
|
|
15
|
+
interface Props<Input = unknown, Output = Input> {
|
|
16
|
+
readonly version: 1;
|
|
17
|
+
readonly vendor: string;
|
|
18
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
19
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
20
|
+
}
|
|
21
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
22
|
+
interface SuccessResult<Output> {
|
|
23
|
+
readonly value: Output;
|
|
24
|
+
readonly issues?: undefined;
|
|
25
|
+
}
|
|
26
|
+
interface FailureResult {
|
|
27
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
28
|
+
}
|
|
29
|
+
interface Issue {
|
|
30
|
+
readonly message: string;
|
|
31
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
32
|
+
}
|
|
33
|
+
interface PathSegment {
|
|
34
|
+
readonly key: PropertyKey;
|
|
35
|
+
}
|
|
36
|
+
interface Types<Input = unknown, Output = Input> {
|
|
37
|
+
readonly input: Input;
|
|
38
|
+
readonly output: Output;
|
|
39
|
+
}
|
|
40
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
41
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
42
|
+
}
|
|
43
|
+
/** One action's definition in code. */
|
|
44
|
+
export interface ActionSpec<TMetadata extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined> {
|
|
45
|
+
/** Validator for `metadata` (any Standard Schema). Omit for untyped metadata. */
|
|
46
|
+
metadata?: TMetadata;
|
|
47
|
+
description?: string;
|
|
48
|
+
/** UI grouping label. */
|
|
49
|
+
group?: string;
|
|
50
|
+
/** Target types this action carries (documentation; enforced when `strictTargets`). */
|
|
51
|
+
targets?: string[];
|
|
52
|
+
/** JSON-Schema-ish description of `metadata` for the UI catalog. */
|
|
53
|
+
schema?: JsonValue;
|
|
54
|
+
/** Default outcome when the caller does not pass one. */
|
|
55
|
+
outcome?: AuditOutcome;
|
|
56
|
+
deprecated?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** A map of action name → spec. */
|
|
59
|
+
export type ActionMap = Record<string, ActionSpec>;
|
|
60
|
+
/** The `metadata` input type of one action. */
|
|
61
|
+
export type ActionMetadataInput<TSpec> = TSpec extends ActionSpec<infer S> ? S extends StandardSchemaV1 ? StandardSchemaV1.InferInput<S> : JsonObject : JsonObject;
|
|
62
|
+
/**
|
|
63
|
+
* Declare the typed action catalog. Identity at runtime; preserves the literal
|
|
64
|
+
* types so `core.record()` can infer action names and metadata shapes.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* import * as v from "valibot";
|
|
69
|
+
* import { createAuditCore, defineActions } from "@xtandard/audit";
|
|
70
|
+
*
|
|
71
|
+
* const actions = defineActions({
|
|
72
|
+
* "invoice.paid": {
|
|
73
|
+
* metadata: v.object({ invoiceId: v.string(), amount: v.number() }),
|
|
74
|
+
* targets: ["invoice"],
|
|
75
|
+
* description: "An invoice was paid",
|
|
76
|
+
* },
|
|
77
|
+
* "member.removed": { targets: ["user"] },
|
|
78
|
+
* });
|
|
79
|
+
*
|
|
80
|
+
* const audit = createAuditCore({ storage, actions });
|
|
81
|
+
* await audit.record({
|
|
82
|
+
* tenant: "acme",
|
|
83
|
+
* action: "invoice.paid", // ← autocompletes; typos are compile errors
|
|
84
|
+
* actor: { id: "user_1" },
|
|
85
|
+
* metadata: { invoiceId: "inv_1", amount: 4200 }, // ← typed
|
|
86
|
+
* });
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function defineActions<const T extends ActionMap>(actions: T): T;
|
|
90
|
+
/** Run a Standard Schema validator; returns the output or the issue messages. */
|
|
91
|
+
export declare function runStandardSchema<T>(schema: StandardSchemaV1<unknown, T>, value: unknown): Promise<{
|
|
92
|
+
ok: true;
|
|
93
|
+
value: T;
|
|
94
|
+
} | {
|
|
95
|
+
ok: false;
|
|
96
|
+
issues: {
|
|
97
|
+
path: string;
|
|
98
|
+
message: string;
|
|
99
|
+
}[];
|
|
100
|
+
}>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage contracts. The base {@link AuditStorage} is intentionally tiny —
|
|
3
|
+
* four async methods — so users can bring their own backend. Optional
|
|
4
|
+
* capabilities (watch, transactions, compare-and-swap, and the audit-specific
|
|
5
|
+
* native event log) are separate interfaces that adapters may implement and the
|
|
6
|
+
* core feature-detects (ADR 0005).
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import type { AuditEvent } from "../schema.ts";
|
|
11
|
+
import type { NormalizedQuery } from "../query.ts";
|
|
12
|
+
/** The minimal key/value contract every storage backend must satisfy. */
|
|
13
|
+
export interface AuditStorage {
|
|
14
|
+
/** Read a value, or `null` if absent. */
|
|
15
|
+
getItem<T>(key: string): Promise<T | null>;
|
|
16
|
+
/** Write a value (overwriting any existing). */
|
|
17
|
+
setItem<T>(key: string, value: T): Promise<void>;
|
|
18
|
+
/** Delete a key (no-op if absent). */
|
|
19
|
+
removeItem(key: string): Promise<void>;
|
|
20
|
+
/** List all keys beginning with `prefix`. */
|
|
21
|
+
getKeys(prefix: string): Promise<string[]>;
|
|
22
|
+
}
|
|
23
|
+
/** A storage change event delivered to {@link WatchableAuditStorage.watch} callbacks. */
|
|
24
|
+
export interface StorageChangeEvent {
|
|
25
|
+
type: "update" | "remove";
|
|
26
|
+
key: string;
|
|
27
|
+
}
|
|
28
|
+
/** Storage that can push change notifications (e.g. Redis pub/sub, fs.watch). */
|
|
29
|
+
export interface WatchableAuditStorage extends AuditStorage {
|
|
30
|
+
/**
|
|
31
|
+
* Subscribe to changes under `prefix`. Resolves to an unsubscribe function.
|
|
32
|
+
*/
|
|
33
|
+
watch(prefix: string, callback: (event: StorageChangeEvent) => void): Promise<() => void>;
|
|
34
|
+
}
|
|
35
|
+
/** Storage that supports atomic multi-key transactions. */
|
|
36
|
+
export interface TransactionalAuditStorage extends AuditStorage {
|
|
37
|
+
transaction<T>(callback: (tx: AuditStorage) => Promise<T>): Promise<T>;
|
|
38
|
+
}
|
|
39
|
+
/** Storage that supports optimistic concurrency via compare-and-swap. */
|
|
40
|
+
export interface CompareAndSwapAuditStorage extends AuditStorage {
|
|
41
|
+
compareAndSwap<T>(input: {
|
|
42
|
+
key: string;
|
|
43
|
+
expected: T | null;
|
|
44
|
+
next: T;
|
|
45
|
+
}): Promise<boolean>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Thrown by {@link EventLogStorage.appendEvents} when the tenant's chain moved
|
|
49
|
+
* underneath the writer (another process appended first). The core re-reads the
|
|
50
|
+
* head, re-chains the batch, and retries.
|
|
51
|
+
*/
|
|
52
|
+
export declare class ChainConflictError extends Error {
|
|
53
|
+
constructor(tenant: string, expectedSeq: number);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Storage that stores and queries audit events **natively** (indexes, SQL
|
|
57
|
+
* `WHERE`, Mongo filters) instead of through the generic KV index fallback in
|
|
58
|
+
* the core (ADR 0005). Control data (catalog, heads, checkpoints, cursors) still
|
|
59
|
+
* lives in the KV methods.
|
|
60
|
+
*
|
|
61
|
+
* Contract:
|
|
62
|
+
* - `appendEvents` is atomic per call: either every event is stored or none,
|
|
63
|
+
* and it throws {@link ChainConflictError} when an event with the same
|
|
64
|
+
* `(tenant, seq)` exists or the tenant's last seq is not `expectedSeq`.
|
|
65
|
+
* - `queryEvents` honours every {@link NormalizedQuery} filter, sorts by
|
|
66
|
+
* `(occurredAt, id)` in `query.order`, starts strictly after `query.after`,
|
|
67
|
+
* and returns at most `query.limit` items plus whether more exist.
|
|
68
|
+
*/
|
|
69
|
+
export interface EventLogStorage extends AuditStorage {
|
|
70
|
+
appendEvents(tenant: string, events: AuditEvent[], options: {
|
|
71
|
+
expectedSeq: number;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
getEvent(tenant: string, id: string): Promise<AuditEvent | null>;
|
|
74
|
+
/** The event with the highest seq for the tenant, or null. */
|
|
75
|
+
lastEvent(tenant: string): Promise<AuditEvent | null>;
|
|
76
|
+
/** Events with `seq > afterSeq` ascending by seq, at most `limit`. */
|
|
77
|
+
eventsBySeq(tenant: string, options: {
|
|
78
|
+
afterSeq: number;
|
|
79
|
+
limit: number;
|
|
80
|
+
}): Promise<AuditEvent[]>;
|
|
81
|
+
queryEvents(query: NormalizedQuery): Promise<{
|
|
82
|
+
items: AuditEvent[];
|
|
83
|
+
hasMore: boolean;
|
|
84
|
+
}>;
|
|
85
|
+
/** Replace a stored event in place (same tenant/id/seq) — used by erasure. */
|
|
86
|
+
replaceEvent(event: AuditEvent): Promise<void>;
|
|
87
|
+
/** Delete every event of the tenant with `seq <= throughSeq`; resolves to the count removed. */
|
|
88
|
+
deleteEventsThrough(tenant: string, throughSeq: number): Promise<number>;
|
|
89
|
+
/** Count retained events (all tenants when `tenant` is omitted). */
|
|
90
|
+
countEvents(tenant?: string): Promise<number>;
|
|
91
|
+
/** Distinct tenants that have events. */
|
|
92
|
+
listEventTenants(): Promise<string[]>;
|
|
93
|
+
}
|
|
94
|
+
/** Runtime feature-detection: does this storage implement `watch`? */
|
|
95
|
+
export declare function isWatchable(storage: AuditStorage): storage is WatchableAuditStorage;
|
|
96
|
+
/** Runtime feature-detection: does this storage implement `transaction`? */
|
|
97
|
+
export declare function isTransactional(storage: AuditStorage): storage is TransactionalAuditStorage;
|
|
98
|
+
/** Runtime feature-detection: does this storage implement `compareAndSwap`? */
|
|
99
|
+
export declare function isCompareAndSwap(storage: AuditStorage): storage is CompareAndSwapAuditStorage;
|
|
100
|
+
/** Runtime feature-detection: does this storage implement the native event log? */
|
|
101
|
+
export declare function hasEventLog(storage: AuditStorage): storage is EventLogStorage;
|
|
102
|
+
/**
|
|
103
|
+
* Helper for adapters whose subpath requires an optional peer dependency. Throws
|
|
104
|
+
* a clear, actionable error when the peer is missing.
|
|
105
|
+
*/
|
|
106
|
+
export declare function requirePeer(name: string, subpath: string): never;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Streaming (ADR 0008): push events — and signed checkpoints — to SIEMs and
|
|
3
|
+
* sinks by **reading the log**, not by queueing on the record path.
|
|
4
|
+
*
|
|
5
|
+
* Each stream keeps one cursor per tenant (`aud/streams/{name}/cursors/{tenant}`
|
|
6
|
+
* = the last seq the sink acknowledged). A tick reads the next batch with
|
|
7
|
+
* `eventsBySeq`, applies the stream's filter, calls `sink.send`, and advances
|
|
8
|
+
* the cursor only after the sink resolved. At-least-once: sinks dedupe on
|
|
9
|
+
* `event.id`. Failures back off exponentially per (stream, tenant); nothing is
|
|
10
|
+
* dropped — the cursor simply does not move. Retention will not prune past the
|
|
11
|
+
* slowest cursor (the runner registers a retention floor on the core).
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import type { AuditCore } from "./core.ts";
|
|
16
|
+
import type { AuditCheckpoint, AuditDuration, AuditEvent, AuditQuery } from "./schema.ts";
|
|
17
|
+
import type { ActionMap } from "./standard-schema.ts";
|
|
18
|
+
/** One item a sink receives. */
|
|
19
|
+
export type StreamItem = {
|
|
20
|
+
kind: "event";
|
|
21
|
+
event: AuditEvent;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "checkpoint";
|
|
24
|
+
checkpoint: AuditCheckpoint;
|
|
25
|
+
};
|
|
26
|
+
/** A batch for one tenant. */
|
|
27
|
+
export interface StreamBatch {
|
|
28
|
+
stream: string;
|
|
29
|
+
tenant: string;
|
|
30
|
+
items: StreamItem[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A destination. `send` must resolve only once the batch is durably accepted
|
|
34
|
+
* (2xx, flushed, …) and throw otherwise — the cursor advances on resolve.
|
|
35
|
+
*/
|
|
36
|
+
export interface AuditSink {
|
|
37
|
+
/** Short kind label for the UI (`"http"`, `"datadog"`, …). */
|
|
38
|
+
readonly kind: string;
|
|
39
|
+
send(batch: StreamBatch): Promise<void>;
|
|
40
|
+
/** Optional cleanup on runner stop. */
|
|
41
|
+
close?(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
/** A stream definition. */
|
|
44
|
+
export interface StreamDefinition {
|
|
45
|
+
/** Unique name; the cursor key. Allowed: `a-z A-Z 0-9 . _ -`. */
|
|
46
|
+
name: string;
|
|
47
|
+
sink: AuditSink;
|
|
48
|
+
/** Only these tenants (default: all). */
|
|
49
|
+
tenants?: string[];
|
|
50
|
+
/** Only events matching this query's filters (tenant/pagination fields are ignored). */
|
|
51
|
+
filter?: Omit<AuditQuery, "tenant" | "limit" | "cursor" | "order">;
|
|
52
|
+
/** Also stream signed checkpoints (default `true`). */
|
|
53
|
+
checkpoints?: boolean;
|
|
54
|
+
/** Max items per `send`. Default 100. */
|
|
55
|
+
batchSize?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Where the stream starts the first time it runs: `"beginning"` (replay every retained log)
|
|
58
|
+
* or `"now"` (tenants that already exist start at their current head; tenants created later
|
|
59
|
+
* are streamed from their first event). Default `"now"`.
|
|
60
|
+
*/
|
|
61
|
+
startFrom?: "beginning" | "now";
|
|
62
|
+
}
|
|
63
|
+
/** Persisted per-tenant cursor state. */
|
|
64
|
+
export interface StreamCursor {
|
|
65
|
+
/** Last acknowledged seq. */
|
|
66
|
+
seq: number;
|
|
67
|
+
/** Last checkpoint id acknowledged (checkpoints are streamed in id order). */
|
|
68
|
+
checkpointId?: string;
|
|
69
|
+
failures: number;
|
|
70
|
+
lastError?: string;
|
|
71
|
+
lastErrorAt?: string;
|
|
72
|
+
nextAttemptAt?: string;
|
|
73
|
+
lastDeliveredAt?: string;
|
|
74
|
+
}
|
|
75
|
+
/** Runtime status of one stream (the admin UI's Streams view). */
|
|
76
|
+
export interface StreamStatus {
|
|
77
|
+
name: string;
|
|
78
|
+
kind: string;
|
|
79
|
+
tenants: {
|
|
80
|
+
tenant: string;
|
|
81
|
+
cursor: number;
|
|
82
|
+
headSeq: number;
|
|
83
|
+
lag: number;
|
|
84
|
+
failures: number;
|
|
85
|
+
lastError?: string;
|
|
86
|
+
lastErrorAt?: string;
|
|
87
|
+
nextAttemptAt?: string;
|
|
88
|
+
lastDeliveredAt?: string;
|
|
89
|
+
}[];
|
|
90
|
+
}
|
|
91
|
+
/** Options for {@link createStreamRunner}. */
|
|
92
|
+
export interface StreamRunnerOptions {
|
|
93
|
+
streams: StreamDefinition[];
|
|
94
|
+
/** Tick interval. Default `"2s"`. */
|
|
95
|
+
interval?: AuditDuration;
|
|
96
|
+
/** Max backoff between failed attempts. Default `"10m"`. */
|
|
97
|
+
maxBackoff?: AuditDuration;
|
|
98
|
+
/** Lease duration when several processes run streams (needs compare-and-swap storage). Default `"30s"`. */
|
|
99
|
+
lease?: AuditDuration;
|
|
100
|
+
/** Called on every failed send. Default `console.warn`. */
|
|
101
|
+
onError?: (error: unknown, info: {
|
|
102
|
+
stream: string;
|
|
103
|
+
tenant: string;
|
|
104
|
+
}) => void;
|
|
105
|
+
}
|
|
106
|
+
/** A started (or startable) stream runner. */
|
|
107
|
+
export interface StreamRunner {
|
|
108
|
+
start(): void;
|
|
109
|
+
stop(): Promise<void>;
|
|
110
|
+
/** Run one pass over every stream and tenant now (tests, cron triggers). */
|
|
111
|
+
tick(): Promise<void>;
|
|
112
|
+
status(): Promise<StreamStatus[]>;
|
|
113
|
+
/** Clear a tenant's backoff so the next tick retries immediately. */
|
|
114
|
+
retry(stream: string, tenant?: string): Promise<void>;
|
|
115
|
+
readonly streams: readonly StreamDefinition[];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Create a stream runner over a core. The panel creates and starts one when
|
|
119
|
+
* given `streams`; call `start()` yourself otherwise (timers are `unref`ed).
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* import { createStreamRunner } from "@xtandard/audit";
|
|
124
|
+
* import { httpSink } from "@xtandard/audit/sinks/http";
|
|
125
|
+
*
|
|
126
|
+
* const runner = createStreamRunner(audit, {
|
|
127
|
+
* streams: [{ name: "siem", sink: httpSink({ url: "https://siem.example/ingest" }) }],
|
|
128
|
+
* });
|
|
129
|
+
* runner.start();
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export declare function createStreamRunner<A extends ActionMap>(core: AuditCore<A>, options: StreamRunnerOptions): StreamRunner;
|
|
133
|
+
/** A sink that calls your function (tests, custom destinations). */
|
|
134
|
+
export declare function callbackSink(send: (batch: StreamBatch) => void | Promise<void>, kind?: string): AuditSink;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transforms run on every event **before** it is chained and stored, so the
|
|
3
|
+
* hash covers exactly what is kept: redact, mask, hash, or omit sensitive
|
|
4
|
+
* values. Ported from `drizzle-audit`'s transforms, generalized from row columns
|
|
5
|
+
* to dotted paths over the whole event (ADR 0009).
|
|
6
|
+
*
|
|
7
|
+
* Paths address the event: `"metadata.password"`, `"context.ip"`,
|
|
8
|
+
* `"actor.email"`, `"targets.*.name"` (`*` matches any key or array index).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { createAuditCore, redact, mask, hashValue, omit } from "@xtandard/audit";
|
|
13
|
+
*
|
|
14
|
+
* const audit = createAuditCore({
|
|
15
|
+
* storage,
|
|
16
|
+
* transforms: [
|
|
17
|
+
* redact("metadata.password", "metadata.token"),
|
|
18
|
+
* mask("actor.email"),
|
|
19
|
+
* hashValue("context.ip"),
|
|
20
|
+
* omit("metadata.rawRequest"),
|
|
21
|
+
* ],
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @module
|
|
26
|
+
*/
|
|
27
|
+
import type { AuditEvent } from "./schema.ts";
|
|
28
|
+
/** The event shape transforms see: fully resolved, not yet chained. */
|
|
29
|
+
export type TransformableEvent = Omit<AuditEvent, "integrity" | "seq" | "recordedAt"> & {
|
|
30
|
+
recordedAt?: string;
|
|
31
|
+
};
|
|
32
|
+
/** A transform: sync or async, returns the (possibly new) event. */
|
|
33
|
+
export type AuditTransform = (event: TransformableEvent) => TransformableEvent | Promise<TransformableEvent>;
|
|
34
|
+
/** Replacement value used by {@link redact}. */
|
|
35
|
+
export declare const REDACTED = "[REDACTED]";
|
|
36
|
+
/** Replace the values at `paths` with `"[REDACTED]"`. */
|
|
37
|
+
export declare function redact(...paths: string[]): AuditTransform;
|
|
38
|
+
/** Remove the values at `paths` entirely. */
|
|
39
|
+
export declare function omit(...paths: string[]): AuditTransform;
|
|
40
|
+
/**
|
|
41
|
+
* Partially mask string values: emails become `j***@e***.com`, short strings
|
|
42
|
+
* `****`, longer strings keep their last four characters.
|
|
43
|
+
*/
|
|
44
|
+
export declare function mask(...paths: string[]): AuditTransform;
|
|
45
|
+
/** The masking used by {@link mask}. */
|
|
46
|
+
export declare function maskValue(str: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Replace values with a SHA-256 digest (`sha256:…`). Pass a `salt` (a secret)
|
|
49
|
+
* to keep low-entropy values (emails, IPs) from being confirmed by brute force;
|
|
50
|
+
* equal inputs still produce equal digests, so you can correlate without storing.
|
|
51
|
+
*/
|
|
52
|
+
export declare function hashValue(paths: string | string[], options?: {
|
|
53
|
+
salt?: string;
|
|
54
|
+
}): AuditTransform;
|
|
55
|
+
/** Run transforms in order. */
|
|
56
|
+
export declare function applyTransforms(event: TransformableEvent, transforms: readonly AuditTransform[]): Promise<TransformableEvent>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type BaseLocationHook } from "wouter";
|
|
3
|
+
import type { AuditConfig, PanelAction } from "./types.ts";
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
__AUDIT_CONFIG__?: AuditConfig;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/** Everything a view needs from the shell. */
|
|
10
|
+
export interface ShellContext {
|
|
11
|
+
config: AuditConfig;
|
|
12
|
+
readonly: boolean;
|
|
13
|
+
portal: boolean;
|
|
14
|
+
/** Selected tenant; `""` = all tenants (admin only). Pinned in portal mode. */
|
|
15
|
+
tenant: string;
|
|
16
|
+
setTenant: (tenant: string) => void;
|
|
17
|
+
/** Navigate in-app (keeps the tenant context, consults the nav guard). */
|
|
18
|
+
go: (path: string, params?: Record<string, string>) => void;
|
|
19
|
+
can: (action: PanelAction) => boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The dashboard, wrapped in a wouter {@link Router}. `locationHook` + `base` make
|
|
23
|
+
* routing pluggable: the bundled SPA uses browser history (clean paths, served by
|
|
24
|
+
* the handler's SPA catch-all), while the embeddable defaults to hash routing so
|
|
25
|
+
* it never touches the host app's router. Pass a custom hook (e.g. memory) to override.
|
|
26
|
+
*/
|
|
27
|
+
export declare function App({ locationHook, base, logoUrl, initialTenant, showThemeToggle, }: {
|
|
28
|
+
locationHook?: BaseLocationHook;
|
|
29
|
+
base?: string;
|
|
30
|
+
/** Override the navbar logo image (otherwise taken from server `/config`). */
|
|
31
|
+
logoUrl?: string;
|
|
32
|
+
/** Pre-select a tenant when the URL doesn't name one (embed hosts). */
|
|
33
|
+
initialTenant?: string;
|
|
34
|
+
/** Show the system/light/dark switcher. Off when an embedding host owns the theme. */
|
|
35
|
+
showThemeToggle?: boolean;
|
|
36
|
+
}): React.ReactElement;
|