@xtandard/audit 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +384 -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 +31935 -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-Cd-mcIwC.css +1 -0
- package/dist/ui/assets/index-DUAgpiot.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,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base-path helpers. The panel can be mounted under any prefix (`/audit`,
|
|
3
|
+
* `/admin/audit`, ...). These normalize the configured base path and strip it
|
|
4
|
+
* from incoming request paths so routing is prefix-agnostic.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
/** Normalize a base path to either `""` (root) or `/segment` with no trailing slash. */
|
|
9
|
+
export declare function normalizeBasePath(basePath: string | undefined): string;
|
|
10
|
+
/**
|
|
11
|
+
* Strip the (normalized) base path from a pathname. Returns a path that always
|
|
12
|
+
* starts with `/`. If the pathname does not start with the base path it is
|
|
13
|
+
* returned unchanged (the host framework may already have stripped the mount).
|
|
14
|
+
*/
|
|
15
|
+
export declare function stripBasePath(pathname: string, basePath: string): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-independent CORS for the mounted panel. When `auditPanel` /
|
|
3
|
+
* `createFetchHandler` is given a `cors` option, the handler answers `OPTIONS`
|
|
4
|
+
* preflights itself and attaches `Access-Control-*` headers to every response —
|
|
5
|
+
* so a **cross-origin embed** (portal on `app.example.com`, panel on
|
|
6
|
+
* `api.example.com`) works even if the host framework's CORS middleware does not
|
|
7
|
+
* wrap the mounted sub-handler.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
/** CORS configuration for the panel handler. */
|
|
12
|
+
export interface AuditCorsOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Allowed origin(s): a single origin (`"https://app.example.com"`), `"*"`, a
|
|
15
|
+
* list, or a predicate `(origin) => boolean`. With `credentials: true`, `"*"`
|
|
16
|
+
* is echoed back as the caller's exact origin (the browser forbids `*` +
|
|
17
|
+
* credentials).
|
|
18
|
+
*/
|
|
19
|
+
origin: string | string[] | ((origin: string) => boolean);
|
|
20
|
+
/** Send `Access-Control-Allow-Credentials: true` (needed for cookie auth). Default `false`. */
|
|
21
|
+
credentials?: boolean;
|
|
22
|
+
/** Allowed methods advertised in preflight. Default `GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS`. */
|
|
23
|
+
methods?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* Allowed request headers advertised in preflight. Default: reflect the
|
|
26
|
+
* request's `Access-Control-Request-Headers`, falling back to
|
|
27
|
+
* `Content-Type, Authorization`.
|
|
28
|
+
*/
|
|
29
|
+
headers?: string[];
|
|
30
|
+
/** `Access-Control-Max-Age` (seconds) for the preflight cache. */
|
|
31
|
+
maxAge?: number;
|
|
32
|
+
}
|
|
33
|
+
/** Attach `Access-Control-*` headers to `response` for an allowed cross-origin request. */
|
|
34
|
+
export declare function applyCorsHeaders(request: Request, response: Response, cors: AuditCorsOptions): Response;
|
|
35
|
+
/** Build the `204` response for a CORS preflight (`OPTIONS`). */
|
|
36
|
+
export declare function preflightResponse(request: Request, cors: AuditCorsOptions): Response;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The web-standard fetch handler at the heart of every framework adapter and the
|
|
3
|
+
* standalone app. Composes auth/authorization (plus portal-token scoping), the
|
|
4
|
+
* JSON admin API, static-asset serving, and SPA fallback into a single
|
|
5
|
+
* `(request: Request) => Promise<Response>` — and, by default, starts the
|
|
6
|
+
* stream runner (when `streams` are declared) and the retention maintenance
|
|
7
|
+
* timer, so mounting the panel is all it takes to operate the log.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import type { AuthProvider } from "../auth/contract.ts";
|
|
12
|
+
import type { AuthorizationProvider } from "../authorization/contract.ts";
|
|
13
|
+
import { type AuditCore, type RetentionOptions } from "../core.ts";
|
|
14
|
+
import type { HookErrorReporter, AuditHooksInput } from "../hooks/contract.ts";
|
|
15
|
+
import type { AuditSigner } from "../integrity.ts";
|
|
16
|
+
import type { AuditDuration } from "../schema.ts";
|
|
17
|
+
import type { ActionMap } from "../standard-schema.ts";
|
|
18
|
+
import type { AuditStorage } from "../storage/contract.ts";
|
|
19
|
+
import { type StreamDefinition, type StreamRunner, type StreamRunnerOptions } from "../streams.ts";
|
|
20
|
+
import type { AuditTransform } from "../transforms.ts";
|
|
21
|
+
import { type AuditCorsOptions } from "./cors.ts";
|
|
22
|
+
import { type AuditPortalOptions } from "./routes.ts";
|
|
23
|
+
/** Options for the panel handler (shared by every framework adapter). */
|
|
24
|
+
export interface AuditPanelOptions {
|
|
25
|
+
/**
|
|
26
|
+
* Where the log lives. Required unless a prebuilt `core` is supplied (which
|
|
27
|
+
* carries its own storage as the source of truth).
|
|
28
|
+
*/
|
|
29
|
+
storage?: AuditStorage;
|
|
30
|
+
/** Mount prefix, e.g. `"/audit"`. Default `""` (root). */
|
|
31
|
+
basePath?: string;
|
|
32
|
+
/** Authentication provider. Default: anonymous (no auth). */
|
|
33
|
+
auth?: AuthProvider;
|
|
34
|
+
/** Authorization provider. Default: allow all. */
|
|
35
|
+
authorization?: AuthorizationProvider;
|
|
36
|
+
/**
|
|
37
|
+
* Portal-token composition: requests bearing a valid `audpt_…` token act as a
|
|
38
|
+
* portal principal scoped to the token's tenant and view filter. Mint tokens
|
|
39
|
+
* server-side with `createPortalToken`. See {@link ./routes.AuditPortalOptions}.
|
|
40
|
+
*/
|
|
41
|
+
portal?: AuditPortalOptions;
|
|
42
|
+
/** Block all mutating operations (`423`) when true. */
|
|
43
|
+
readonly?: boolean;
|
|
44
|
+
/** UI title shown in the page and bootstrap config. */
|
|
45
|
+
title?: string;
|
|
46
|
+
/** Logo image URL shown in the navbar in place of the title wordmark. */
|
|
47
|
+
logoUrl?: string;
|
|
48
|
+
/** Override the directory the bundled UI is served from (defaults to `./ui` beside this module). */
|
|
49
|
+
uiDir?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Reuse an existing core instead of constructing one — typed
|
|
52
|
+
* (`createAuditCore({ actions })`) or not. The panel only records untyped
|
|
53
|
+
* input over HTTP (validated at runtime by the core's catalog), so any action
|
|
54
|
+
* map is accepted here.
|
|
55
|
+
*/
|
|
56
|
+
core?: AuditCore<any>;
|
|
57
|
+
/**
|
|
58
|
+
* Control-plane hooks (see {@link ../hooks/contract.AuditHooks}). Ignored
|
|
59
|
+
* when `core` is supplied — configure hooks on that core instead.
|
|
60
|
+
*/
|
|
61
|
+
hooks?: AuditHooksInput;
|
|
62
|
+
/** Reporter for errors thrown by `after` hooks. Default: `console.warn`. Ignored with `core`. */
|
|
63
|
+
onHookError?: HookErrorReporter;
|
|
64
|
+
/**
|
|
65
|
+
* Retention policy (see {@link ../core.RetentionOptions}). Ignored when a
|
|
66
|
+
* prebuilt `core` is supplied — configure it on that core instead. Pruning
|
|
67
|
+
* runs on the `maintenance` timer and via `POST /api/prune`.
|
|
68
|
+
*/
|
|
69
|
+
retention?: RetentionOptions;
|
|
70
|
+
/** Checkpoint signer (`ed25519Signer` / `hmacSigner`). Ignored with `core`. */
|
|
71
|
+
signer?: AuditSigner;
|
|
72
|
+
/** Typed action catalog from `defineActions`. Ignored with `core`. */
|
|
73
|
+
actions?: ActionMap;
|
|
74
|
+
/** Redact / mask / hash / omit before chaining. Ignored with `core`. */
|
|
75
|
+
transforms?: AuditTransform[];
|
|
76
|
+
/**
|
|
77
|
+
* Enable CORS on the handler itself — answers `OPTIONS` preflights and attaches
|
|
78
|
+
* `Access-Control-*` headers to every response, so a **cross-origin** portal
|
|
79
|
+
* embed works regardless of the host framework. See {@link ./cors.AuditCorsOptions}.
|
|
80
|
+
*/
|
|
81
|
+
cors?: AuditCorsOptions;
|
|
82
|
+
/**
|
|
83
|
+
* SIEM / archive streams (ADR 0008). The panel creates a stream runner over
|
|
84
|
+
* them (status + retry in the UI) and **starts** it unless `streamRunner`
|
|
85
|
+
* is `false`.
|
|
86
|
+
*/
|
|
87
|
+
streams?: StreamDefinition[];
|
|
88
|
+
/**
|
|
89
|
+
* Stream-runner tuning, or `false` to not start it in this process
|
|
90
|
+
* (split deployments where `xtandard-audit serve` elsewhere runs the
|
|
91
|
+
* streams). The runner is still created so the UI shows lag and errors.
|
|
92
|
+
*/
|
|
93
|
+
streamRunner?: Omit<StreamRunnerOptions, "streams"> | false;
|
|
94
|
+
/**
|
|
95
|
+
* Periodic retention: run `core.prune()` every `interval` (default `"1h"`)
|
|
96
|
+
* when the core has a `retention` policy. `false` disables the timer
|
|
97
|
+
* (prune from a cron with `xtandard-audit prune` instead).
|
|
98
|
+
*/
|
|
99
|
+
maintenance?: {
|
|
100
|
+
interval?: AuditDuration;
|
|
101
|
+
} | false;
|
|
102
|
+
}
|
|
103
|
+
/** Return shape of {@link createFetchHandler}. */
|
|
104
|
+
export interface CreateFetchHandlerResult {
|
|
105
|
+
/** Web-standard request handler. */
|
|
106
|
+
fetch(request: Request): Promise<Response>;
|
|
107
|
+
/** The underlying core (handy for `record()`, tests, CLI, and standalone wiring). */
|
|
108
|
+
core: AuditCore<ActionMap>;
|
|
109
|
+
/** The stream runner (started unless `streamRunner: false`), or `null` without `streams`. */
|
|
110
|
+
streams: StreamRunner | null;
|
|
111
|
+
/**
|
|
112
|
+
* The admin API as an OpenAPI 3.1 document (also served at `{basePath}/api/openapi.json`).
|
|
113
|
+
* Merge it into your host app's docs — e.g. Elysia `@elysiajs/openapi` `references`.
|
|
114
|
+
*/
|
|
115
|
+
openapi(): Record<string, unknown>;
|
|
116
|
+
/** Stop the stream runner and the maintenance timer (graceful shutdown, tests). */
|
|
117
|
+
close(): Promise<void>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Build the panel fetch handler.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* import { createFetchHandler, ed25519Signer } from "@xtandard/audit";
|
|
125
|
+
* import { createMemoryStorage } from "@xtandard/audit/storage/memory";
|
|
126
|
+
*
|
|
127
|
+
* const { fetch, core } = createFetchHandler({
|
|
128
|
+
* storage: createMemoryStorage(),
|
|
129
|
+
* basePath: "/audit",
|
|
130
|
+
* title: "Acme Audit Log",
|
|
131
|
+
* signer: await ed25519Signer(JSON.parse(process.env.AUDIT_SIGNING_KEY!)),
|
|
132
|
+
* retention: { maxAge: "365d" },
|
|
133
|
+
* });
|
|
134
|
+
*
|
|
135
|
+
* Bun.serve({ port: 3000, fetch });
|
|
136
|
+
* // Elsewhere in the app:
|
|
137
|
+
* await core.record({ tenant: "acme", action: "invoice.paid", actor: { id: "user_1" } });
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
export declare function createFetchHandler(options: AuditPanelOptions): CreateFetchHandlerResult;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAPI 3.1 description of the panel's JSON API (`docs/HTTP_API.md`).
|
|
3
|
+
*
|
|
4
|
+
* Exposed two ways, mirroring the sibling panels:
|
|
5
|
+
* - served at `GET {basePath}/api/openapi.json` for standalone tools (Scalar,
|
|
6
|
+
* Swagger UI, Postman, codegen);
|
|
7
|
+
* - returned by `createFetchHandler(...).openapi()` so you can MERGE it into
|
|
8
|
+
* your host app's OpenAPI document (e.g. Elysia `@elysiajs/openapi`
|
|
9
|
+
* `references`, or Hono's OpenAPI).
|
|
10
|
+
*
|
|
11
|
+
* Hand-authored — no generation dependency (flags precedent).
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
/** Options for {@link buildOpenApiDocument}. */
|
|
16
|
+
export interface OpenApiOptions {
|
|
17
|
+
/** Mount prefix used in the `servers` url (e.g. `"/audit"`). */
|
|
18
|
+
basePath?: string;
|
|
19
|
+
/** Document title. */
|
|
20
|
+
title?: string;
|
|
21
|
+
/** Document version (defaults to the package's API version). */
|
|
22
|
+
version?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Build the OpenAPI 3.1 document for the panel API. Pure — safe to call anywhere. */
|
|
25
|
+
export declare function buildOpenApiDocument(options?: OpenApiOptions): Record<string, unknown>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders the SPA `index.html`: injects a `<base>` tag so relative asset URLs
|
|
3
|
+
* resolve under any mount path, and a bootstrap `window.__AUDIT_CONFIG__`
|
|
4
|
+
* blob. Falls back to a minimal built-in page when the UI bundle is absent
|
|
5
|
+
* (e.g. before `bun run build:ui`, or in headless tests).
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/** Bootstrap config injected into the page and exposed at `/config`. */
|
|
10
|
+
export interface BootstrapConfig {
|
|
11
|
+
title: string;
|
|
12
|
+
basePath: string;
|
|
13
|
+
readonly: boolean;
|
|
14
|
+
/** Optional logo image URL shown in the navbar in place of the title wordmark. */
|
|
15
|
+
logoUrl?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Read, inject into, and return the SPA index HTML (or a fallback). */
|
|
18
|
+
export declare function renderIndexHtml(uiDir: string, config: BootstrapConfig): Promise<string>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON admin API (the contract is `docs/HTTP_API.md`). A tiny method+pattern
|
|
3
|
+
* router over {@link AuditCore}, wired to authentication, authorization, and
|
|
4
|
+
* portal-token scoping. Returns `null` for non-API paths so the caller can fall
|
|
5
|
+
* through to static-asset / SPA handling.
|
|
6
|
+
*
|
|
7
|
+
* The customer **portal** is not a separate route set — a request bearing a
|
|
8
|
+
* valid `Authorization: Bearer audpt_…` token hits this same API force-scoped
|
|
9
|
+
* to the token's tenant, its allowed actions, and its view filter (the host's
|
|
10
|
+
* own auth/authorization providers are bypassed for portal principals; portal
|
|
11
|
+
* scoping wins, ADR 0006).
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import type { AuthProvider } from "../auth/contract.ts";
|
|
16
|
+
import { type AuthorizationProvider, type AuditAction } from "../authorization/contract.ts";
|
|
17
|
+
import { type AuditCore } from "../core.ts";
|
|
18
|
+
import { type ExportFormat } from "../export.ts";
|
|
19
|
+
import { DEFAULT_PORTAL_ACTIONS } from "../portal.ts";
|
|
20
|
+
import type { AuditQuery } from "../schema.ts";
|
|
21
|
+
import type { StreamRunner } from "../streams.ts";
|
|
22
|
+
export { DEFAULT_PORTAL_ACTIONS };
|
|
23
|
+
/**
|
|
24
|
+
* Portal composition for the panel: when set, requests bearing a valid
|
|
25
|
+
* `audpt_…` token act as a portal principal scoped to the token's tenant and
|
|
26
|
+
* view filter.
|
|
27
|
+
*/
|
|
28
|
+
export interface AuditPortalOptions {
|
|
29
|
+
/** The HMAC secret portal tokens are minted with (`createPortalToken`). */
|
|
30
|
+
secret: string;
|
|
31
|
+
/**
|
|
32
|
+
* Actions a portal principal may perform (always confined to the token's
|
|
33
|
+
* tenant). Defaults to {@link DEFAULT_PORTAL_ACTIONS}.
|
|
34
|
+
*/
|
|
35
|
+
allow?: AuditAction[];
|
|
36
|
+
}
|
|
37
|
+
/** The bootstrap config served at `/config` (and injected into the SPA). */
|
|
38
|
+
export interface PanelConfig {
|
|
39
|
+
title: string;
|
|
40
|
+
basePath: string;
|
|
41
|
+
readonly: boolean;
|
|
42
|
+
logoUrl?: string;
|
|
43
|
+
/** True for portal-token principals: the UI renders the portal chrome. */
|
|
44
|
+
portal: boolean;
|
|
45
|
+
/** The portal principal's tenant. */
|
|
46
|
+
tenant?: string;
|
|
47
|
+
principal: {
|
|
48
|
+
id: string;
|
|
49
|
+
name?: string;
|
|
50
|
+
email?: string;
|
|
51
|
+
} | null;
|
|
52
|
+
/** Actions this principal may perform (the UI hides what it cannot do). */
|
|
53
|
+
allowed: AuditAction[];
|
|
54
|
+
features: {
|
|
55
|
+
signer: boolean;
|
|
56
|
+
streams: boolean;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** Everything the API router needs. */
|
|
60
|
+
export interface ApiContext {
|
|
61
|
+
core: AuditCore;
|
|
62
|
+
auth: AuthProvider;
|
|
63
|
+
authorization: AuthorizationProvider;
|
|
64
|
+
title: string;
|
|
65
|
+
readonly: boolean;
|
|
66
|
+
basePath: string;
|
|
67
|
+
logoUrl?: string;
|
|
68
|
+
/** Portal-token composition (see {@link AuditPortalOptions}). */
|
|
69
|
+
portal?: AuditPortalOptions;
|
|
70
|
+
/** The panel's stream runner (status + retry routes), or `null`. */
|
|
71
|
+
streams: StreamRunner | null;
|
|
72
|
+
}
|
|
73
|
+
/** The query model as URL parameters (docs/HTTP_API.md "Query parameters"). */
|
|
74
|
+
export declare function parseQueryParams(params: URLSearchParams): AuditQuery;
|
|
75
|
+
/** `attachment; filename="<tenant>-audit-<date>.<ext>"`, with a filesystem-safe tenant. */
|
|
76
|
+
export declare function exportFilename(tenant: string, format: ExportFormat, now: number): string;
|
|
77
|
+
/**
|
|
78
|
+
* Handle an API request. `path` is already base-path-stripped. Returns a
|
|
79
|
+
* `Response` for API/config routes, or `null` if the path is not an API route.
|
|
80
|
+
*/
|
|
81
|
+
export declare function handleApiRequest(request: Request, path: string, ctx: ApiContext): Promise<Response | null>;
|
|
82
|
+
/** Map domain errors to HTTP responses (docs/HTTP_API.md "Errors"). */
|
|
83
|
+
export declare function mapError(err: unknown): Response;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serves the bundled SPA's static assets from the UI output directory. Maps file
|
|
3
|
+
* extensions to content types and guards against path traversal.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
/** True if the path has a file extension (so a miss should 404 rather than fall through to the SPA). */
|
|
8
|
+
export declare function looksLikeAsset(path: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Try to serve `path` (base-path-stripped, leading `/`) as a static file from
|
|
11
|
+
* `uiDir`. Returns a `Response`, or `null` if the file does not exist.
|
|
12
|
+
*/
|
|
13
|
+
export declare function serveStaticAsset(uiDir: string, path: string): Promise<Response | null>;
|