@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,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tamper evidence (ADR 0004): per-tenant hash chains with salted per-section
|
|
3
|
+
* digests, signed checkpoints, and a pure verifier.
|
|
4
|
+
*
|
|
5
|
+
* ```txt
|
|
6
|
+
* digest(section) = "sha256:" + hex(SHA-256(id + "\n" + canonical(section)))
|
|
7
|
+
* header = { v, id, tenant, seq, action, occurredAt, recordedAt,
|
|
8
|
+
* outcome, prevHash, digests }
|
|
9
|
+
* hash = "sha256:" + hex(SHA-256(canonical(header)))
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Zero dependencies — Web Crypto only — so it runs in Bun, Node ≥ 20, Deno,
|
|
13
|
+
* browsers and Workers, and is what an auditor runs (`@xtandard/audit/verify`).
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import type { AuditCheckpoint, AuditEvent, AuditSection, JsonValue } from "./schema.ts";
|
|
18
|
+
/** `prevHash` of the first event of every chain. */
|
|
19
|
+
export declare const GENESIS_HASH: string;
|
|
20
|
+
/** `"sha256:" + hex(SHA-256(utf8(text)))`. */
|
|
21
|
+
export declare function sha256(text: string): Promise<string>;
|
|
22
|
+
/** base64url without padding. */
|
|
23
|
+
export declare function base64urlEncode(bytes: Uint8Array): string;
|
|
24
|
+
/** Decode base64url (with or without padding). */
|
|
25
|
+
export declare function base64urlDecode(value: string): Uint8Array;
|
|
26
|
+
/** An event before it is sealed into the chain. */
|
|
27
|
+
export type UnsealedEvent = Omit<AuditEvent, "integrity">;
|
|
28
|
+
/** The JSON value of one section of an event, as hashed. */
|
|
29
|
+
export declare function sectionValue(event: UnsealedEvent, section: AuditSection): JsonValue;
|
|
30
|
+
/** Salted digest of one section's value. */
|
|
31
|
+
export declare function sectionDigest(eventId: string, value: JsonValue): Promise<string>;
|
|
32
|
+
/** Compute every section digest of an (unerased) event. */
|
|
33
|
+
export declare function computeDigests(event: UnsealedEvent): Promise<Record<AuditSection, string>>;
|
|
34
|
+
/** The chained header for an event (what `hash` is computed over). */
|
|
35
|
+
export declare function chainHeader(event: UnsealedEvent, prevHash: string, digests: Record<AuditSection, string>): JsonValue;
|
|
36
|
+
/** Seal an event: compute its digests and its chain hash linked to `prevHash`. */
|
|
37
|
+
export declare function sealEvent(event: UnsealedEvent, prevHash: string): Promise<AuditEvent>;
|
|
38
|
+
/** Seal a batch for one tenant, linking each event to the previous one. */
|
|
39
|
+
export declare function sealChain(events: UnsealedEvent[], prevHash: string): Promise<AuditEvent[]>;
|
|
40
|
+
/** Why verification failed at a given point. */
|
|
41
|
+
export type VerifyIssueKind = "digest-mismatch" | "hash-mismatch" | "link-mismatch" | "seq-gap" | "tenant-mismatch" | "bad-signature" | "checkpoint-mismatch" | "unknown-key" | "unjustified-erasure" | "malformed";
|
|
42
|
+
/** One verification failure. */
|
|
43
|
+
export interface VerifyIssue {
|
|
44
|
+
kind: VerifyIssueKind;
|
|
45
|
+
seq?: number;
|
|
46
|
+
eventId?: string;
|
|
47
|
+
checkpointId?: string;
|
|
48
|
+
section?: AuditSection;
|
|
49
|
+
message: string;
|
|
50
|
+
}
|
|
51
|
+
/** Result of {@link verifyChain}. */
|
|
52
|
+
export interface VerifyReport {
|
|
53
|
+
/** True when no issue was found. */
|
|
54
|
+
ok: boolean;
|
|
55
|
+
tenant: string | null;
|
|
56
|
+
/** Events checked. */
|
|
57
|
+
checked: number;
|
|
58
|
+
/** First and last seq checked (null when empty). */
|
|
59
|
+
fromSeq: number | null;
|
|
60
|
+
toSeq: number | null;
|
|
61
|
+
/** Hash of the last checked event. */
|
|
62
|
+
headHash: string | null;
|
|
63
|
+
/**
|
|
64
|
+
* How the start of the range is anchored: `"genesis"` (seq 1),
|
|
65
|
+
* `"checkpoint"` (a verified checkpoint covers `fromSeq - 1`, or a `base`
|
|
66
|
+
* checkpoint), or `"unanchored"` (the first `prevHash` is trusted as given).
|
|
67
|
+
*/
|
|
68
|
+
anchor: "genesis" | "checkpoint" | "unanchored" | "none";
|
|
69
|
+
/** Whether links between events were checked (false for non-contiguous subsets). */
|
|
70
|
+
linksChecked: boolean;
|
|
71
|
+
/** Checkpoints whose signature and hash were verified. */
|
|
72
|
+
checkpointsVerified: number;
|
|
73
|
+
/**
|
|
74
|
+
* The highest seq covered by a verified checkpoint, or null. Events after it
|
|
75
|
+
* are internally consistent but not yet anchored by a signature.
|
|
76
|
+
*/
|
|
77
|
+
signedThrough: number | null;
|
|
78
|
+
/** Sections reported as erased (content removed, digest kept). */
|
|
79
|
+
erased: {
|
|
80
|
+
seq: number;
|
|
81
|
+
eventId: string;
|
|
82
|
+
sections: AuditSection[];
|
|
83
|
+
}[];
|
|
84
|
+
issues: VerifyIssue[];
|
|
85
|
+
}
|
|
86
|
+
/** A key able to verify checkpoint signatures. */
|
|
87
|
+
export interface AuditVerificationKey {
|
|
88
|
+
keyId: string;
|
|
89
|
+
alg: AuditCheckpoint["alg"];
|
|
90
|
+
verify(data: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
91
|
+
}
|
|
92
|
+
/** Options for {@link verifyChain}. */
|
|
93
|
+
export interface VerifyChainOptions {
|
|
94
|
+
/** Checkpoints to check against the events (and whose signatures to verify). */
|
|
95
|
+
checkpoints?: AuditCheckpoint[];
|
|
96
|
+
/** Keys to verify checkpoint signatures with. Without keys, signatures are not checked. */
|
|
97
|
+
keys?: AuditVerificationKey[];
|
|
98
|
+
/**
|
|
99
|
+
* Treat the events as a contiguous range (default `true`): check seq
|
|
100
|
+
* continuity and `prevHash` links. Set `false` for filtered subsets — each
|
|
101
|
+
* event is then verified on its own.
|
|
102
|
+
*/
|
|
103
|
+
contiguous?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Require every erased section to be justified by a chained
|
|
106
|
+
* `audit_log.erased` event (default `true`). The `erased` list itself is not
|
|
107
|
+
* covered by the hash, so this is what stops "erase" from being a way to
|
|
108
|
+
* silently replace content (ADR 0011). Set `false` when verifying a range
|
|
109
|
+
* that ends before the erasure records, or when self-audit is disabled.
|
|
110
|
+
*/
|
|
111
|
+
requireErasureRecords?: boolean;
|
|
112
|
+
}
|
|
113
|
+
/** Re-derive one event's digests and hash; returns the issues found. */
|
|
114
|
+
export declare function verifyEvent(event: AuditEvent): Promise<VerifyIssue[]>;
|
|
115
|
+
/**
|
|
116
|
+
* Verify a tenant's events (and optionally checkpoints). Pure: it trusts
|
|
117
|
+
* nothing but the data passed in and the keys.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* import { verifyChain, keysFromJwks } from "@xtandard/audit/verify";
|
|
122
|
+
*
|
|
123
|
+
* const report = await verifyChain(events, {
|
|
124
|
+
* checkpoints,
|
|
125
|
+
* keys: await keysFromJwks(jwks),
|
|
126
|
+
* });
|
|
127
|
+
* if (!report.ok) console.error(report.issues);
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export declare function verifyChain(events: AuditEvent[], options?: VerifyChainOptions): Promise<VerifyReport>;
|
|
131
|
+
/**
|
|
132
|
+
* Check that every erased section is justified by a chained `audit_log.erased`
|
|
133
|
+
* event among `events` (ADR 0011).
|
|
134
|
+
*/
|
|
135
|
+
export declare function erasureIssues(erased: VerifyReport["erased"], events: Iterable<AuditEvent>): VerifyIssue[];
|
|
136
|
+
/** Signs checkpoints. Implement your own (KMS, HSM) or use the built-ins. */
|
|
137
|
+
export interface AuditSigner {
|
|
138
|
+
keyId: string;
|
|
139
|
+
alg: AuditCheckpoint["alg"];
|
|
140
|
+
sign(data: Uint8Array): Promise<Uint8Array>;
|
|
141
|
+
/** The public verification key as a JWK (asymmetric signers only), for the JWKS route. */
|
|
142
|
+
publicJwk?(): Promise<JsonWebKey | null>;
|
|
143
|
+
/** A verification key for this signer (used by `core.verify`). */
|
|
144
|
+
verificationKey(): Promise<AuditVerificationKey>;
|
|
145
|
+
}
|
|
146
|
+
/** The bytes a checkpoint signature covers: canonical JSON of everything but `signature`. */
|
|
147
|
+
export declare function checkpointSigningBytes(cp: Omit<AuditCheckpoint, "signature">): Uint8Array;
|
|
148
|
+
/** Sign an unsigned checkpoint. */
|
|
149
|
+
export declare function signCheckpoint(signer: AuditSigner, unsigned: Omit<AuditCheckpoint, "signature" | "keyId" | "alg">): Promise<AuditCheckpoint>;
|
|
150
|
+
/** Verify one checkpoint's signature with a key. */
|
|
151
|
+
export declare function verifyCheckpointSignature(cp: AuditCheckpoint, key: AuditVerificationKey): Promise<boolean>;
|
|
152
|
+
/** RFC 7638 JWK thumbprint (base64url SHA-256) of an Ed25519 public key. */
|
|
153
|
+
export declare function jwkThumbprint(jwk: JsonWebKey): Promise<string>;
|
|
154
|
+
/** A JWK with its key id. */
|
|
155
|
+
export type AuditJwk = JsonWebKey & {
|
|
156
|
+
kid?: string;
|
|
157
|
+
};
|
|
158
|
+
/** Generate an Ed25519 key pair as JWKs (store `privateJwk` as a secret). */
|
|
159
|
+
export declare function generateSigningKeyPair(): Promise<{
|
|
160
|
+
keyId: string;
|
|
161
|
+
privateJwk: AuditJwk;
|
|
162
|
+
publicJwk: AuditJwk;
|
|
163
|
+
}>;
|
|
164
|
+
/** A verification key from an Ed25519 public JWK. */
|
|
165
|
+
export declare function ed25519VerificationKey(jwk: AuditJwk, keyId?: string): Promise<AuditVerificationKey>;
|
|
166
|
+
/**
|
|
167
|
+
* An Ed25519 signer from a private JWK (from {@link generateSigningKeyPair} or
|
|
168
|
+
* `xtandard-audit keygen`). The public half is served as a JWKS so customers
|
|
169
|
+
* can verify checkpoints themselves.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* import { ed25519Signer } from "@xtandard/audit";
|
|
174
|
+
*
|
|
175
|
+
* const signer = await ed25519Signer(JSON.parse(process.env.AUDIT_SIGNING_KEY!));
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
export declare function ed25519Signer(privateJwk: AuditJwk, options?: {
|
|
179
|
+
keyId?: string;
|
|
180
|
+
}): Promise<AuditSigner>;
|
|
181
|
+
/** A verification key for {@link hmacSigner} checkpoints (needs the secret). */
|
|
182
|
+
export declare function hmacVerificationKey(secret: string, keyId?: string): AuditVerificationKey;
|
|
183
|
+
/**
|
|
184
|
+
* A symmetric HMAC-SHA256 signer: simplest setup, but only holders of the
|
|
185
|
+
* secret can verify — prefer {@link ed25519Signer} when customers verify.
|
|
186
|
+
*/
|
|
187
|
+
export declare function hmacSigner(secret: string, options?: {
|
|
188
|
+
keyId?: string;
|
|
189
|
+
}): AuditSigner;
|
|
190
|
+
/** Verification keys from a JWKS document (`GET {basePath}/api/integrity/keys`). */
|
|
191
|
+
export declare function keysFromJwks(jwks: {
|
|
192
|
+
keys: AuditJwk[];
|
|
193
|
+
}): Promise<AuditVerificationKey[]>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage key layout for `@xtandard/audit`.
|
|
3
|
+
*
|
|
4
|
+
* Control data always lives in these KV keys. Events live here too on drivers
|
|
5
|
+
* without the native {@link ./storage/contract.EventLogStorage} capability (the
|
|
6
|
+
* generic fallback, ADR 0005). Pure string helpers — no dependencies.
|
|
7
|
+
*
|
|
8
|
+
* ```txt
|
|
9
|
+
* aud/tenants -> string[] index
|
|
10
|
+
* aud/actions -> string[] index (catalog)
|
|
11
|
+
* aud/actions/{name} -> ActionDefinition
|
|
12
|
+
* aud/t/{tenant}/head -> ChainHead
|
|
13
|
+
* aud/t/{tenant}/checkpoints/{chk id} -> AuditCheckpoint (time-sortable id)
|
|
14
|
+
* aud/streams/{stream}/cursors/{tenant} -> StreamCursor
|
|
15
|
+
* aud/streams/{stream}/meta -> { startedAt }
|
|
16
|
+
* aud/streams/{stream}/lease -> StreamLease
|
|
17
|
+
*
|
|
18
|
+
* — generic event log (KV fallback only) —
|
|
19
|
+
* aud/t/{tenant}/events/{seq 12} -> AuditEvent
|
|
20
|
+
* aud/t/{tenant}/ids/{event id} -> seq
|
|
21
|
+
* aud/t/{tenant}/ix/time/{ms 13}~{id} -> seq
|
|
22
|
+
* aud/t/{tenant}/ix/actor/{actorId}/{ms 13}~{id} -> seq
|
|
23
|
+
* aud/t/{tenant}/ix/action/{action}/{ms 13}~{id} -> seq
|
|
24
|
+
* aud/t/{tenant}/ix/target/{type}/{id}/{ms 13}~{id} -> seq
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Zero-padded numbers make lexicographic key order equal numeric order, so a
|
|
28
|
+
* sorted `getKeys` scan yields events by seq (or by occurredAt for the `ix/`
|
|
29
|
+
* indexes) on every backend. Free-form segments (tenant, actor id, action,
|
|
30
|
+
* target type/id) are `encodeURIComponent`-escaped so `/` and `~` cannot break
|
|
31
|
+
* the layout.
|
|
32
|
+
*
|
|
33
|
+
* @module
|
|
34
|
+
*/
|
|
35
|
+
/** Root namespace segment for all keys. */
|
|
36
|
+
export declare const ROOT = "aud";
|
|
37
|
+
/** Zero-pad a seq to 12 digits. */
|
|
38
|
+
export declare const padSeq: (seq: number) => string;
|
|
39
|
+
/** Zero-pad epoch millis to 13 digits. */
|
|
40
|
+
export declare const padMs: (ms: number) => string;
|
|
41
|
+
/** Index of all tenant keys. */
|
|
42
|
+
export declare const tenantsKey: () => string;
|
|
43
|
+
/** Action catalog index. */
|
|
44
|
+
export declare const actionsKey: () => string;
|
|
45
|
+
/** One action catalog entry. */
|
|
46
|
+
export declare const actionKey: (name: string) => string;
|
|
47
|
+
/** Prefix under which everything belonging to one tenant lives. */
|
|
48
|
+
export declare const tenantPrefix: (tenant: string) => string;
|
|
49
|
+
/** The tenant's chain head. */
|
|
50
|
+
export declare const headKey: (tenant: string) => string;
|
|
51
|
+
/** Prefix of the tenant's checkpoints. */
|
|
52
|
+
export declare const checkpointsPrefix: (tenant: string) => string;
|
|
53
|
+
/** One checkpoint. */
|
|
54
|
+
export declare const checkpointKey: (tenant: string, id: string) => string;
|
|
55
|
+
/** Prefix of a stream's per-tenant cursors. */
|
|
56
|
+
export declare const streamCursorsPrefix: (stream: string) => string;
|
|
57
|
+
/** One stream cursor. */
|
|
58
|
+
export declare const streamCursorKey: (stream: string, tenant: string) => string;
|
|
59
|
+
/** A stream's metadata (first-run marker). */
|
|
60
|
+
export declare const streamMetaKey: (stream: string) => string;
|
|
61
|
+
/** A stream's runner lease. */
|
|
62
|
+
export declare const streamLeaseKey: (stream: string) => string;
|
|
63
|
+
/** Prefix of the tenant's events (by seq). */
|
|
64
|
+
export declare const eventsPrefix: (tenant: string) => string;
|
|
65
|
+
/** One event, keyed by seq. */
|
|
66
|
+
export declare const eventKey: (tenant: string, seq: number) => string;
|
|
67
|
+
/** Event id → seq. */
|
|
68
|
+
export declare const eventIdKey: (tenant: string, id: string) => string;
|
|
69
|
+
/** Prefix of a tenant's secondary indexes. */
|
|
70
|
+
export declare const indexRoot: (tenant: string) => string;
|
|
71
|
+
/** Time index prefix. */
|
|
72
|
+
export declare const timeIndexPrefix: (tenant: string) => string;
|
|
73
|
+
/** Actor index prefix. */
|
|
74
|
+
export declare const actorIndexPrefix: (tenant: string, actorId: string) => string;
|
|
75
|
+
/** Action index prefix. */
|
|
76
|
+
export declare const actionIndexPrefix: (tenant: string, action: string) => string;
|
|
77
|
+
/** Target index prefix. */
|
|
78
|
+
export declare const targetIndexPrefix: (tenant: string, type: string, id: string) => string;
|
|
79
|
+
/** The `{ms}~{id}` leaf of every index key. */
|
|
80
|
+
export declare const indexLeaf: (occurredAtMs: number, id: string) => string;
|
|
81
|
+
/** Parse an index key's leaf back into `(occurredAtMs, id)`. */
|
|
82
|
+
export declare const parseIndexLeaf: (key: string) => {
|
|
83
|
+
ms: number;
|
|
84
|
+
id: string;
|
|
85
|
+
} | null;
|
|
86
|
+
/** Parse a seq from an event key. */
|
|
87
|
+
export declare const parseEventKey: (key: string) => number | null;
|
|
88
|
+
/** Extract the trailing segment from a key. */
|
|
89
|
+
export declare const lastSegment: (key: string) => string;
|
|
90
|
+
/** Decode an escaped key segment. */
|
|
91
|
+
export declare const decodeSegment: (segment: string) => string;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portal tokens — the credential behind the embeddable, customer-facing audit
|
|
3
|
+
* log viewer (ADR 0006).
|
|
4
|
+
*
|
|
5
|
+
* A portal token is a compact HMAC-signed grant scoping its bearer to exactly
|
|
6
|
+
* **one tenant** for a limited time, optionally narrowed by a **view filter**
|
|
7
|
+
* (hide operator-only actions, or show a member only their own events). The
|
|
8
|
+
* host mints tokens server-side with {@link createPortalToken} (the portal
|
|
9
|
+
* secret never reaches a browser) and hands them to its frontend; the panel
|
|
10
|
+
* handler verifies them with {@link verifyPortalToken}, force-scopes every
|
|
11
|
+
* request to the token's tenant, and AND-s the filter into every query and
|
|
12
|
+
* export (see {@link scopeQueryToPortal}).
|
|
13
|
+
*
|
|
14
|
+
* Wire format:
|
|
15
|
+
*
|
|
16
|
+
* ```txt
|
|
17
|
+
* audpt_<base64url(JSON { tenant, exp, filter? })>.<base64url(HMAC-SHA256(secret, payloadPart))>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Zero dependencies (Web Crypto only). The portal secret is an **arbitrary
|
|
21
|
+
* string** — it is fed to the HMAC as raw UTF-8 bytes.
|
|
22
|
+
*
|
|
23
|
+
* @module
|
|
24
|
+
*/
|
|
25
|
+
import type { AuditAction } from "./authorization/contract.ts";
|
|
26
|
+
import type { AuditDuration, AuditEvent, AuditQuery } from "./schema.ts";
|
|
27
|
+
/** Prefix of every portal token. */
|
|
28
|
+
export declare const PORTAL_TOKEN_PREFIX = "audpt_";
|
|
29
|
+
/**
|
|
30
|
+
* The default portal grant: browse, export and verify the tenant's own log,
|
|
31
|
+
* and read the action catalog. Nothing mutating.
|
|
32
|
+
*/
|
|
33
|
+
export declare const DEFAULT_PORTAL_ACTIONS: readonly AuditAction[];
|
|
34
|
+
/**
|
|
35
|
+
* A server-side view filter carried inside a portal token. Every field is
|
|
36
|
+
* AND-ed into every query, export and single-event read the bearer makes; a
|
|
37
|
+
* client parameter can only narrow it, never widen it.
|
|
38
|
+
*/
|
|
39
|
+
export interface PortalFilter {
|
|
40
|
+
/** Only these actions (exact names or `"invoice.*"` families). */
|
|
41
|
+
actions?: string[];
|
|
42
|
+
/** Never these actions (exact names or families) — e.g. `["support.*"]`. */
|
|
43
|
+
excludeActions?: string[];
|
|
44
|
+
/** Only events by this actor (a member sees their own activity). */
|
|
45
|
+
actorId?: string;
|
|
46
|
+
/** Only events touching a target of this type. */
|
|
47
|
+
targetType?: string;
|
|
48
|
+
/** Only events touching a target with this id. */
|
|
49
|
+
targetId?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Thrown by {@link verifyPortalToken} for any invalid token — malformed,
|
|
53
|
+
* bad signature, or expired. Maps to HTTP 401 at the API layer.
|
|
54
|
+
*/
|
|
55
|
+
export declare class PortalTokenError extends Error {
|
|
56
|
+
constructor(message: string);
|
|
57
|
+
}
|
|
58
|
+
/** Options for {@link createPortalToken}. */
|
|
59
|
+
export interface PortalTokenOptions {
|
|
60
|
+
/** Token lifetime. Default `"1h"` (an audit portal is a read session). */
|
|
61
|
+
expiresIn?: AuditDuration;
|
|
62
|
+
/** Server-side view filter (see {@link PortalFilter}). */
|
|
63
|
+
filter?: PortalFilter;
|
|
64
|
+
}
|
|
65
|
+
/** What a verified token grants. */
|
|
66
|
+
export interface PortalGrant {
|
|
67
|
+
/** The tenant the token is scoped to. */
|
|
68
|
+
tenant: string;
|
|
69
|
+
/** Expiry, unix epoch milliseconds. */
|
|
70
|
+
expiresAt: number;
|
|
71
|
+
/** The token's view filter, when it has one. */
|
|
72
|
+
filter?: PortalFilter;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Mint a portal token granting read access to `tenant`'s log until
|
|
76
|
+
* `expiresIn` elapses (default 1 hour). Call this **server-side** — anyone
|
|
77
|
+
* holding the portal secret can mint tokens for any tenant.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* import { createPortalToken } from "@xtandard/audit";
|
|
82
|
+
*
|
|
83
|
+
* // In the host app's session-guarded route:
|
|
84
|
+
* const token = await createPortalToken(process.env.PORTAL_SECRET!, user.orgId, {
|
|
85
|
+
* expiresIn: "30m",
|
|
86
|
+
* filter: { excludeActions: ["support.*"] },
|
|
87
|
+
* });
|
|
88
|
+
* // Hand `token` to the frontend for <AuditPortal token={token} />.
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export declare function createPortalToken(secret: string, tenant: string, options?: PortalTokenOptions): Promise<string>;
|
|
92
|
+
/**
|
|
93
|
+
* Verify a portal token: format, signature (constant time), then expiry.
|
|
94
|
+
* Returns the grant on success; throws {@link PortalTokenError} otherwise.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* import { verifyPortalToken } from "@xtandard/audit";
|
|
99
|
+
*
|
|
100
|
+
* const { tenant, filter } = await verifyPortalToken(secret, token);
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function verifyPortalToken(secret: string, token: string): Promise<PortalGrant>;
|
|
104
|
+
/**
|
|
105
|
+
* Intersect two action include-lists (each an OR of exact names and families).
|
|
106
|
+
* Returns the narrowest list matching exactly what both match; `[]` means
|
|
107
|
+
* "nothing matches".
|
|
108
|
+
*/
|
|
109
|
+
export declare function intersectActions(a: string[], b: string[]): string[];
|
|
110
|
+
/** The result of applying a portal filter to a client query. */
|
|
111
|
+
export type ScopedQuery =
|
|
112
|
+
/** The query to run (tenant forced, filter AND-ed in). */
|
|
113
|
+
{
|
|
114
|
+
query: AuditQuery;
|
|
115
|
+
empty: false;
|
|
116
|
+
}
|
|
117
|
+
/** The client asked for something outside the token's view: the answer is an empty result. */
|
|
118
|
+
| {
|
|
119
|
+
query: AuditQuery;
|
|
120
|
+
empty: true;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Force a client query into a portal grant: the tenant is the token's, and
|
|
124
|
+
* every filter field is AND-ed in. A client parameter can only **narrow** the
|
|
125
|
+
* view — action lists are intersected, exclusions are unioned, and a client
|
|
126
|
+
* `actorId` / `targetType` / `targetId` that differs from the token's makes
|
|
127
|
+
* the result empty (`empty: true`) instead of widening it.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* const { query, empty } = scopeQueryToPortal(clientQuery, grant);
|
|
132
|
+
* const page = empty ? { items: [], pageInfo: { hasNextPage: false, endCursor: null } } : await audit.query(query);
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export declare function scopeQueryToPortal(query: AuditQuery, grant: PortalGrant): ScopedQuery;
|
|
136
|
+
/** Is `event` inside the grant's view (its tenant, and its filter)? */
|
|
137
|
+
export declare function portalCanSee(event: AuditEvent, grant: PortalGrant): boolean;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The query model's runtime half (ADR 0007): normalization, the opaque keyset
|
|
3
|
+
* cursor, and the in-memory matcher shared by the memory driver and the generic
|
|
4
|
+
* KV fallback. Native drivers compile a {@link NormalizedQuery} to their own
|
|
5
|
+
* query language and must agree with {@link matchesQuery} (the conformance
|
|
6
|
+
* suite checks that).
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import type { AuditEvent, AuditOutcome, AuditQuery } from "./schema.ts";
|
|
11
|
+
/** Default page size. */
|
|
12
|
+
export declare const DEFAULT_QUERY_LIMIT = 50;
|
|
13
|
+
/** Maximum page size. */
|
|
14
|
+
export declare const MAX_QUERY_LIMIT = 500;
|
|
15
|
+
/** A keyset position: the `(occurredAt, id)` of the last item of a page. */
|
|
16
|
+
export interface QueryPosition {
|
|
17
|
+
occurredAt: string;
|
|
18
|
+
id: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A validated, defaulted query — what storage drivers receive. List filters
|
|
22
|
+
* are split into exact names and `prefix.` families; `search` is lower-cased.
|
|
23
|
+
*/
|
|
24
|
+
export interface NormalizedQuery {
|
|
25
|
+
tenant?: string;
|
|
26
|
+
/** Exact action names to include (OR). Empty = no constraint unless `actionPrefixes` set. */
|
|
27
|
+
actions: string[];
|
|
28
|
+
/** Action families (`"invoice."` for `"invoice.*"`) to include (OR with `actions`). */
|
|
29
|
+
actionPrefixes: string[];
|
|
30
|
+
excludeActions: string[];
|
|
31
|
+
excludeActionPrefixes: string[];
|
|
32
|
+
actorId?: string;
|
|
33
|
+
actorType?: string;
|
|
34
|
+
targetType?: string;
|
|
35
|
+
targetId?: string;
|
|
36
|
+
outcome?: AuditOutcome;
|
|
37
|
+
from?: string;
|
|
38
|
+
to?: string;
|
|
39
|
+
/** Lower-cased search needle. */
|
|
40
|
+
search?: string;
|
|
41
|
+
order: "desc" | "asc";
|
|
42
|
+
limit: number;
|
|
43
|
+
/** Start strictly after this position (decoded cursor). */
|
|
44
|
+
after?: QueryPosition;
|
|
45
|
+
}
|
|
46
|
+
/** Thrown for a malformed cursor or an invalid query value. Maps to HTTP 400. */
|
|
47
|
+
export declare class QueryError extends Error {
|
|
48
|
+
constructor(message: string);
|
|
49
|
+
}
|
|
50
|
+
/** Encode a keyset position as an opaque cursor. */
|
|
51
|
+
export declare function encodeCursor(position: QueryPosition): string;
|
|
52
|
+
/** Decode an opaque cursor; throws {@link QueryError} when malformed. */
|
|
53
|
+
export declare function decodeCursor(cursor: string): QueryPosition;
|
|
54
|
+
/** Validate and default a query. */
|
|
55
|
+
export declare function normalizeQuery(query?: AuditQuery): NormalizedQuery;
|
|
56
|
+
/** Does an action name pass the include/exclude lists? */
|
|
57
|
+
export declare function actionMatches(action: string, q: NormalizedQuery): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* The lower-cased text `search` matches against: action, actor id/name/email,
|
|
60
|
+
* target types/ids/names, description, and the JSON of metadata. Native
|
|
61
|
+
* drivers store this as a denormalized column/field.
|
|
62
|
+
*/
|
|
63
|
+
export declare function searchText(event: AuditEvent): string;
|
|
64
|
+
/** Compare two events by `(occurredAt, id)` ascending. */
|
|
65
|
+
export declare function compareEvents(a: QueryPosition, b: QueryPosition): number;
|
|
66
|
+
/** Is `event` strictly after `position` in the query's order? */
|
|
67
|
+
export declare function isAfter(event: QueryPosition, position: QueryPosition, order: "desc" | "asc"): boolean;
|
|
68
|
+
/** Does `event` satisfy every filter of `q` (ignoring pagination)? */
|
|
69
|
+
export declare function matchesQuery(event: AuditEvent, q: NormalizedQuery): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Apply a normalized query to an in-memory list: filter, sort, keyset, limit.
|
|
72
|
+
* Used by the memory driver and the KV fallback.
|
|
73
|
+
*/
|
|
74
|
+
export declare function applyQuery(events: Iterable<AuditEvent>, q: NormalizedQuery): {
|
|
75
|
+
items: AuditEvent[];
|
|
76
|
+
hasMore: boolean;
|
|
77
|
+
};
|
|
78
|
+
/** Build the page envelope from driver results. */
|
|
79
|
+
export declare function toPage(result: {
|
|
80
|
+
items: AuditEvent[];
|
|
81
|
+
hasMore: boolean;
|
|
82
|
+
}): {
|
|
83
|
+
items: AuditEvent[];
|
|
84
|
+
pageInfo: {
|
|
85
|
+
hasNextPage: boolean;
|
|
86
|
+
endCursor: string | null;
|
|
87
|
+
};
|
|
88
|
+
};
|