@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,33 @@
|
|
|
1
|
+
//#region src/authorization/contract.ts
|
|
2
|
+
/** Every action, in a stable order (the UI and `/config` `allowed` use it). */
|
|
3
|
+
const ALL_ACTIONS = [
|
|
4
|
+
"tenant:read",
|
|
5
|
+
"event:read",
|
|
6
|
+
"event:record",
|
|
7
|
+
"event:export",
|
|
8
|
+
"event:erase",
|
|
9
|
+
"integrity:read",
|
|
10
|
+
"integrity:checkpoint",
|
|
11
|
+
"action:read",
|
|
12
|
+
"action:update",
|
|
13
|
+
"action:delete",
|
|
14
|
+
"retention:prune",
|
|
15
|
+
"stream:read",
|
|
16
|
+
"stream:retry"
|
|
17
|
+
];
|
|
18
|
+
/** Actions that mutate state — blocked (`423`) when the panel is readonly. */
|
|
19
|
+
const MUTATING_ACTIONS = new Set([
|
|
20
|
+
"event:record",
|
|
21
|
+
"event:erase",
|
|
22
|
+
"integrity:checkpoint",
|
|
23
|
+
"action:update",
|
|
24
|
+
"action:delete",
|
|
25
|
+
"retention:prune",
|
|
26
|
+
"stream:retry"
|
|
27
|
+
]);
|
|
28
|
+
/** True if the action mutates state. */
|
|
29
|
+
const isMutatingAction = (action) => MUTATING_ACTIONS.has(action);
|
|
30
|
+
//#endregion
|
|
31
|
+
export { MUTATING_ACTIONS as n, isMutatingAction as r, ALL_ACTIONS as t };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=contract-BljSE-Hx.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-BljSE-Hx.mjs","names":[],"sources":["../src/authorization/contract.ts"],"sourcesContent":["/**\n * Authorization contract. Answers: \"Can this principal perform this action on\n * this resource?\"\n *\n * Every admin API route consults the {@link AuthorizationProvider} (portal\n * principals excepted — their token's scope is the whole grant). Ships\n * `none`/`roles`/`delegated` implementations.\n *\n * @module\n */\n\nimport type { Principal } from \"../auth/contract.ts\";\n\n/** The full set of authorizable actions. */\nexport type AuditAction =\n | \"tenant:read\"\n | \"event:read\"\n | \"event:record\"\n | \"event:export\"\n | \"event:erase\"\n | \"integrity:read\"\n | \"integrity:checkpoint\"\n | \"action:read\"\n | \"action:update\"\n | \"action:delete\"\n | \"retention:prune\"\n | \"stream:read\"\n | \"stream:retry\";\n\n/**\n * The resource an action targets. An absent `tenant` / `name` means \"across\n * all\" (listings, the cross-tenant event search, a global prune).\n */\nexport type AuditResource =\n | { type: \"tenant\"; tenant?: string }\n | { type: \"event\"; tenant?: string; eventId?: string }\n | { type: \"integrity\"; tenant: string }\n | { type: \"action\"; name?: string }\n | { type: \"retention\"; tenant?: string }\n | { type: \"stream\"; name?: string };\n\n/** Input passed to {@link AuthorizationProvider.authorize}. */\nexport interface AuthorizeInput {\n principal: Principal | null;\n action: AuditAction;\n resource: AuditResource;\n request: Request;\n}\n\n/** Decides whether an action is permitted. */\nexport interface AuthorizationProvider {\n authorize(input: AuthorizeInput): Promise<boolean>;\n}\n\n/** Every action, in a stable order (the UI and `/config` `allowed` use it). */\nexport const ALL_ACTIONS: readonly AuditAction[] = [\n \"tenant:read\",\n \"event:read\",\n \"event:record\",\n \"event:export\",\n \"event:erase\",\n \"integrity:read\",\n \"integrity:checkpoint\",\n \"action:read\",\n \"action:update\",\n \"action:delete\",\n \"retention:prune\",\n \"stream:read\",\n \"stream:retry\",\n];\n\n/** Actions that mutate state — blocked (`423`) when the panel is readonly. */\nexport const MUTATING_ACTIONS: ReadonlySet<AuditAction> = new Set<AuditAction>([\n \"event:record\",\n \"event:erase\",\n \"integrity:checkpoint\",\n \"action:update\",\n \"action:delete\",\n \"retention:prune\",\n \"stream:retry\",\n]);\n\n/** True if the action mutates state. */\nexport const isMutatingAction = (action: AuditAction): boolean => MUTATING_ACTIONS.has(action);\n"],"mappings":";;AAuDA,MAAa,cAAsC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAa,mBAA6C,IAAI,IAAiB;CAC7E;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;AAGD,MAAa,oBAAoB,WAAiC,iBAAiB,IAAI,MAAM"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { f as AuditQuery, s as AuditEvent, u as AuditOutcome } from "./schema-DmU7Wp0F.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/query.d.ts
|
|
4
|
+
/** Default page size. */
|
|
5
|
+
declare const DEFAULT_QUERY_LIMIT = 50;
|
|
6
|
+
/** Maximum page size. */
|
|
7
|
+
declare const MAX_QUERY_LIMIT = 500;
|
|
8
|
+
/** A keyset position: the `(occurredAt, id)` of the last item of a page. */
|
|
9
|
+
interface QueryPosition {
|
|
10
|
+
occurredAt: string;
|
|
11
|
+
id: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A validated, defaulted query — what storage drivers receive. List filters
|
|
15
|
+
* are split into exact names and `prefix.` families; `search` is lower-cased.
|
|
16
|
+
*/
|
|
17
|
+
interface NormalizedQuery {
|
|
18
|
+
tenant?: string;
|
|
19
|
+
/** Exact action names to include (OR). Empty = no constraint unless `actionPrefixes` set. */
|
|
20
|
+
actions: string[];
|
|
21
|
+
/** Action families (`"invoice."` for `"invoice.*"`) to include (OR with `actions`). */
|
|
22
|
+
actionPrefixes: string[];
|
|
23
|
+
excludeActions: string[];
|
|
24
|
+
excludeActionPrefixes: string[];
|
|
25
|
+
actorId?: string;
|
|
26
|
+
actorType?: string;
|
|
27
|
+
targetType?: string;
|
|
28
|
+
targetId?: string;
|
|
29
|
+
outcome?: AuditOutcome;
|
|
30
|
+
from?: string;
|
|
31
|
+
to?: string;
|
|
32
|
+
/** Lower-cased search needle. */
|
|
33
|
+
search?: string;
|
|
34
|
+
order: "desc" | "asc";
|
|
35
|
+
limit: number;
|
|
36
|
+
/** Start strictly after this position (decoded cursor). */
|
|
37
|
+
after?: QueryPosition;
|
|
38
|
+
}
|
|
39
|
+
/** Thrown for a malformed cursor or an invalid query value. Maps to HTTP 400. */
|
|
40
|
+
declare class QueryError extends Error {
|
|
41
|
+
constructor(message: string);
|
|
42
|
+
}
|
|
43
|
+
/** Encode a keyset position as an opaque cursor. */
|
|
44
|
+
declare function encodeCursor(position: QueryPosition): string;
|
|
45
|
+
/** Decode an opaque cursor; throws {@link QueryError} when malformed. */
|
|
46
|
+
declare function decodeCursor(cursor: string): QueryPosition;
|
|
47
|
+
/** Validate and default a query. */
|
|
48
|
+
declare function normalizeQuery(query?: AuditQuery): NormalizedQuery;
|
|
49
|
+
/** Does `event` satisfy every filter of `q` (ignoring pagination)? */
|
|
50
|
+
declare function matchesQuery(event: AuditEvent, q: NormalizedQuery): boolean;
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/storage/contract.d.ts
|
|
53
|
+
/** The minimal key/value contract every storage backend must satisfy. */
|
|
54
|
+
interface AuditStorage {
|
|
55
|
+
/** Read a value, or `null` if absent. */
|
|
56
|
+
getItem<T>(key: string): Promise<T | null>;
|
|
57
|
+
/** Write a value (overwriting any existing). */
|
|
58
|
+
setItem<T>(key: string, value: T): Promise<void>;
|
|
59
|
+
/** Delete a key (no-op if absent). */
|
|
60
|
+
removeItem(key: string): Promise<void>;
|
|
61
|
+
/** List all keys beginning with `prefix`. */
|
|
62
|
+
getKeys(prefix: string): Promise<string[]>;
|
|
63
|
+
}
|
|
64
|
+
/** A storage change event delivered to {@link WatchableAuditStorage.watch} callbacks. */
|
|
65
|
+
interface StorageChangeEvent {
|
|
66
|
+
type: "update" | "remove";
|
|
67
|
+
key: string;
|
|
68
|
+
}
|
|
69
|
+
/** Storage that can push change notifications (e.g. Redis pub/sub, fs.watch). */
|
|
70
|
+
interface WatchableAuditStorage extends AuditStorage {
|
|
71
|
+
/**
|
|
72
|
+
* Subscribe to changes under `prefix`. Resolves to an unsubscribe function.
|
|
73
|
+
*/
|
|
74
|
+
watch(prefix: string, callback: (event: StorageChangeEvent) => void): Promise<() => void>;
|
|
75
|
+
}
|
|
76
|
+
/** Storage that supports atomic multi-key transactions. */
|
|
77
|
+
interface TransactionalAuditStorage extends AuditStorage {
|
|
78
|
+
transaction<T>(callback: (tx: AuditStorage) => Promise<T>): Promise<T>;
|
|
79
|
+
}
|
|
80
|
+
/** Storage that supports optimistic concurrency via compare-and-swap. */
|
|
81
|
+
interface CompareAndSwapAuditStorage extends AuditStorage {
|
|
82
|
+
compareAndSwap<T>(input: {
|
|
83
|
+
key: string;
|
|
84
|
+
expected: T | null;
|
|
85
|
+
next: T;
|
|
86
|
+
}): Promise<boolean>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Thrown by {@link EventLogStorage.appendEvents} when the tenant's chain moved
|
|
90
|
+
* underneath the writer (another process appended first). The core re-reads the
|
|
91
|
+
* head, re-chains the batch, and retries.
|
|
92
|
+
*/
|
|
93
|
+
declare class ChainConflictError extends Error {
|
|
94
|
+
constructor(tenant: string, expectedSeq: number);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Storage that stores and queries audit events **natively** (indexes, SQL
|
|
98
|
+
* `WHERE`, Mongo filters) instead of through the generic KV index fallback in
|
|
99
|
+
* the core (ADR 0005). Control data (catalog, heads, checkpoints, cursors) still
|
|
100
|
+
* lives in the KV methods.
|
|
101
|
+
*
|
|
102
|
+
* Contract:
|
|
103
|
+
* - `appendEvents` is atomic per call: either every event is stored or none,
|
|
104
|
+
* and it throws {@link ChainConflictError} when an event with the same
|
|
105
|
+
* `(tenant, seq)` exists or the tenant's last seq is not `expectedSeq`.
|
|
106
|
+
* - `queryEvents` honours every {@link NormalizedQuery} filter, sorts by
|
|
107
|
+
* `(occurredAt, id)` in `query.order`, starts strictly after `query.after`,
|
|
108
|
+
* and returns at most `query.limit` items plus whether more exist.
|
|
109
|
+
*/
|
|
110
|
+
interface EventLogStorage extends AuditStorage {
|
|
111
|
+
appendEvents(tenant: string, events: AuditEvent[], options: {
|
|
112
|
+
expectedSeq: number;
|
|
113
|
+
}): Promise<void>;
|
|
114
|
+
getEvent(tenant: string, id: string): Promise<AuditEvent | null>;
|
|
115
|
+
/** The event with the highest seq for the tenant, or null. */
|
|
116
|
+
lastEvent(tenant: string): Promise<AuditEvent | null>;
|
|
117
|
+
/** Events with `seq > afterSeq` ascending by seq, at most `limit`. */
|
|
118
|
+
eventsBySeq(tenant: string, options: {
|
|
119
|
+
afterSeq: number;
|
|
120
|
+
limit: number;
|
|
121
|
+
}): Promise<AuditEvent[]>;
|
|
122
|
+
queryEvents(query: NormalizedQuery): Promise<{
|
|
123
|
+
items: AuditEvent[];
|
|
124
|
+
hasMore: boolean;
|
|
125
|
+
}>;
|
|
126
|
+
/** Replace a stored event in place (same tenant/id/seq) — used by erasure. */
|
|
127
|
+
replaceEvent(event: AuditEvent): Promise<void>;
|
|
128
|
+
/** Delete every event of the tenant with `seq <= throughSeq`; resolves to the count removed. */
|
|
129
|
+
deleteEventsThrough(tenant: string, throughSeq: number): Promise<number>;
|
|
130
|
+
/** Count retained events (all tenants when `tenant` is omitted). */
|
|
131
|
+
countEvents(tenant?: string): Promise<number>;
|
|
132
|
+
/** Distinct tenants that have events. */
|
|
133
|
+
listEventTenants(): Promise<string[]>;
|
|
134
|
+
}
|
|
135
|
+
/** Runtime feature-detection: does this storage implement `watch`? */
|
|
136
|
+
declare function isWatchable(storage: AuditStorage): storage is WatchableAuditStorage;
|
|
137
|
+
/** Runtime feature-detection: does this storage implement `transaction`? */
|
|
138
|
+
declare function isTransactional(storage: AuditStorage): storage is TransactionalAuditStorage;
|
|
139
|
+
/** Runtime feature-detection: does this storage implement `compareAndSwap`? */
|
|
140
|
+
declare function isCompareAndSwap(storage: AuditStorage): storage is CompareAndSwapAuditStorage;
|
|
141
|
+
/** Runtime feature-detection: does this storage implement the native event log? */
|
|
142
|
+
declare function hasEventLog(storage: AuditStorage): storage is EventLogStorage;
|
|
143
|
+
/**
|
|
144
|
+
* Helper for adapters whose subpath requires an optional peer dependency. Throws
|
|
145
|
+
* a clear, actionable error when the peer is missing.
|
|
146
|
+
*/
|
|
147
|
+
declare function requirePeer(name: string, subpath: string): never;
|
|
148
|
+
//#endregion
|
|
149
|
+
export { QueryPosition as _, StorageChangeEvent as a, matchesQuery as b, hasEventLog as c, isWatchable as d, requirePeer as f, QueryError as g, NormalizedQuery as h, EventLogStorage as i, isCompareAndSwap as l, MAX_QUERY_LIMIT as m, ChainConflictError as n, TransactionalAuditStorage as o, DEFAULT_QUERY_LIMIT as p, CompareAndSwapAuditStorage as r, WatchableAuditStorage as s, AuditStorage as t, isTransactional as u, decodeCursor as v, normalizeQuery as x, encodeCursor as y };
|
|
150
|
+
//# sourceMappingURL=contract-BmwHIiMR.d.mts.map
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { f as AuditQuery, s as AuditEvent, u as AuditOutcome } from "./schema-DmU7Wp0F.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/query.d.ts
|
|
4
|
+
/** Default page size. */
|
|
5
|
+
declare const DEFAULT_QUERY_LIMIT = 50;
|
|
6
|
+
/** Maximum page size. */
|
|
7
|
+
declare const MAX_QUERY_LIMIT = 500;
|
|
8
|
+
/** A keyset position: the `(occurredAt, id)` of the last item of a page. */
|
|
9
|
+
interface QueryPosition {
|
|
10
|
+
occurredAt: string;
|
|
11
|
+
id: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A validated, defaulted query — what storage drivers receive. List filters
|
|
15
|
+
* are split into exact names and `prefix.` families; `search` is lower-cased.
|
|
16
|
+
*/
|
|
17
|
+
interface NormalizedQuery {
|
|
18
|
+
tenant?: string;
|
|
19
|
+
/** Exact action names to include (OR). Empty = no constraint unless `actionPrefixes` set. */
|
|
20
|
+
actions: string[];
|
|
21
|
+
/** Action families (`"invoice."` for `"invoice.*"`) to include (OR with `actions`). */
|
|
22
|
+
actionPrefixes: string[];
|
|
23
|
+
excludeActions: string[];
|
|
24
|
+
excludeActionPrefixes: string[];
|
|
25
|
+
actorId?: string;
|
|
26
|
+
actorType?: string;
|
|
27
|
+
targetType?: string;
|
|
28
|
+
targetId?: string;
|
|
29
|
+
outcome?: AuditOutcome;
|
|
30
|
+
from?: string;
|
|
31
|
+
to?: string;
|
|
32
|
+
/** Lower-cased search needle. */
|
|
33
|
+
search?: string;
|
|
34
|
+
order: "desc" | "asc";
|
|
35
|
+
limit: number;
|
|
36
|
+
/** Start strictly after this position (decoded cursor). */
|
|
37
|
+
after?: QueryPosition;
|
|
38
|
+
}
|
|
39
|
+
/** Thrown for a malformed cursor or an invalid query value. Maps to HTTP 400. */
|
|
40
|
+
declare class QueryError extends Error {
|
|
41
|
+
constructor(message: string);
|
|
42
|
+
}
|
|
43
|
+
/** Encode a keyset position as an opaque cursor. */
|
|
44
|
+
declare function encodeCursor(position: QueryPosition): string;
|
|
45
|
+
/** Decode an opaque cursor; throws {@link QueryError} when malformed. */
|
|
46
|
+
declare function decodeCursor(cursor: string): QueryPosition;
|
|
47
|
+
/** Validate and default a query. */
|
|
48
|
+
declare function normalizeQuery(query?: AuditQuery): NormalizedQuery;
|
|
49
|
+
/** Does `event` satisfy every filter of `q` (ignoring pagination)? */
|
|
50
|
+
declare function matchesQuery(event: AuditEvent, q: NormalizedQuery): boolean;
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/storage/contract.d.ts
|
|
53
|
+
/** The minimal key/value contract every storage backend must satisfy. */
|
|
54
|
+
interface AuditStorage {
|
|
55
|
+
/** Read a value, or `null` if absent. */
|
|
56
|
+
getItem<T>(key: string): Promise<T | null>;
|
|
57
|
+
/** Write a value (overwriting any existing). */
|
|
58
|
+
setItem<T>(key: string, value: T): Promise<void>;
|
|
59
|
+
/** Delete a key (no-op if absent). */
|
|
60
|
+
removeItem(key: string): Promise<void>;
|
|
61
|
+
/** List all keys beginning with `prefix`. */
|
|
62
|
+
getKeys(prefix: string): Promise<string[]>;
|
|
63
|
+
}
|
|
64
|
+
/** A storage change event delivered to {@link WatchableAuditStorage.watch} callbacks. */
|
|
65
|
+
interface StorageChangeEvent {
|
|
66
|
+
type: "update" | "remove";
|
|
67
|
+
key: string;
|
|
68
|
+
}
|
|
69
|
+
/** Storage that can push change notifications (e.g. Redis pub/sub, fs.watch). */
|
|
70
|
+
interface WatchableAuditStorage extends AuditStorage {
|
|
71
|
+
/**
|
|
72
|
+
* Subscribe to changes under `prefix`. Resolves to an unsubscribe function.
|
|
73
|
+
*/
|
|
74
|
+
watch(prefix: string, callback: (event: StorageChangeEvent) => void): Promise<() => void>;
|
|
75
|
+
}
|
|
76
|
+
/** Storage that supports atomic multi-key transactions. */
|
|
77
|
+
interface TransactionalAuditStorage extends AuditStorage {
|
|
78
|
+
transaction<T>(callback: (tx: AuditStorage) => Promise<T>): Promise<T>;
|
|
79
|
+
}
|
|
80
|
+
/** Storage that supports optimistic concurrency via compare-and-swap. */
|
|
81
|
+
interface CompareAndSwapAuditStorage extends AuditStorage {
|
|
82
|
+
compareAndSwap<T>(input: {
|
|
83
|
+
key: string;
|
|
84
|
+
expected: T | null;
|
|
85
|
+
next: T;
|
|
86
|
+
}): Promise<boolean>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Thrown by {@link EventLogStorage.appendEvents} when the tenant's chain moved
|
|
90
|
+
* underneath the writer (another process appended first). The core re-reads the
|
|
91
|
+
* head, re-chains the batch, and retries.
|
|
92
|
+
*/
|
|
93
|
+
declare class ChainConflictError extends Error {
|
|
94
|
+
constructor(tenant: string, expectedSeq: number);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Storage that stores and queries audit events **natively** (indexes, SQL
|
|
98
|
+
* `WHERE`, Mongo filters) instead of through the generic KV index fallback in
|
|
99
|
+
* the core (ADR 0005). Control data (catalog, heads, checkpoints, cursors) still
|
|
100
|
+
* lives in the KV methods.
|
|
101
|
+
*
|
|
102
|
+
* Contract:
|
|
103
|
+
* - `appendEvents` is atomic per call: either every event is stored or none,
|
|
104
|
+
* and it throws {@link ChainConflictError} when an event with the same
|
|
105
|
+
* `(tenant, seq)` exists or the tenant's last seq is not `expectedSeq`.
|
|
106
|
+
* - `queryEvents` honours every {@link NormalizedQuery} filter, sorts by
|
|
107
|
+
* `(occurredAt, id)` in `query.order`, starts strictly after `query.after`,
|
|
108
|
+
* and returns at most `query.limit` items plus whether more exist.
|
|
109
|
+
*/
|
|
110
|
+
interface EventLogStorage extends AuditStorage {
|
|
111
|
+
appendEvents(tenant: string, events: AuditEvent[], options: {
|
|
112
|
+
expectedSeq: number;
|
|
113
|
+
}): Promise<void>;
|
|
114
|
+
getEvent(tenant: string, id: string): Promise<AuditEvent | null>;
|
|
115
|
+
/** The event with the highest seq for the tenant, or null. */
|
|
116
|
+
lastEvent(tenant: string): Promise<AuditEvent | null>;
|
|
117
|
+
/** Events with `seq > afterSeq` ascending by seq, at most `limit`. */
|
|
118
|
+
eventsBySeq(tenant: string, options: {
|
|
119
|
+
afterSeq: number;
|
|
120
|
+
limit: number;
|
|
121
|
+
}): Promise<AuditEvent[]>;
|
|
122
|
+
queryEvents(query: NormalizedQuery): Promise<{
|
|
123
|
+
items: AuditEvent[];
|
|
124
|
+
hasMore: boolean;
|
|
125
|
+
}>;
|
|
126
|
+
/** Replace a stored event in place (same tenant/id/seq) — used by erasure. */
|
|
127
|
+
replaceEvent(event: AuditEvent): Promise<void>;
|
|
128
|
+
/** Delete every event of the tenant with `seq <= throughSeq`; resolves to the count removed. */
|
|
129
|
+
deleteEventsThrough(tenant: string, throughSeq: number): Promise<number>;
|
|
130
|
+
/** Count retained events (all tenants when `tenant` is omitted). */
|
|
131
|
+
countEvents(tenant?: string): Promise<number>;
|
|
132
|
+
/** Distinct tenants that have events. */
|
|
133
|
+
listEventTenants(): Promise<string[]>;
|
|
134
|
+
}
|
|
135
|
+
/** Runtime feature-detection: does this storage implement `watch`? */
|
|
136
|
+
declare function isWatchable(storage: AuditStorage): storage is WatchableAuditStorage;
|
|
137
|
+
/** Runtime feature-detection: does this storage implement `transaction`? */
|
|
138
|
+
declare function isTransactional(storage: AuditStorage): storage is TransactionalAuditStorage;
|
|
139
|
+
/** Runtime feature-detection: does this storage implement `compareAndSwap`? */
|
|
140
|
+
declare function isCompareAndSwap(storage: AuditStorage): storage is CompareAndSwapAuditStorage;
|
|
141
|
+
/** Runtime feature-detection: does this storage implement the native event log? */
|
|
142
|
+
declare function hasEventLog(storage: AuditStorage): storage is EventLogStorage;
|
|
143
|
+
/**
|
|
144
|
+
* Helper for adapters whose subpath requires an optional peer dependency. Throws
|
|
145
|
+
* a clear, actionable error when the peer is missing.
|
|
146
|
+
*/
|
|
147
|
+
declare function requirePeer(name: string, subpath: string): never;
|
|
148
|
+
//#endregion
|
|
149
|
+
export { QueryPosition as _, StorageChangeEvent as a, matchesQuery as b, hasEventLog as c, isWatchable as d, requirePeer as f, QueryError as g, NormalizedQuery as h, EventLogStorage as i, isCompareAndSwap as l, MAX_QUERY_LIMIT as m, ChainConflictError as n, TransactionalAuditStorage as o, DEFAULT_QUERY_LIMIT as p, CompareAndSwapAuditStorage as r, WatchableAuditStorage as s, AuditStorage as t, isTransactional as u, decodeCursor as v, normalizeQuery as x, encodeCursor as y };
|
|
150
|
+
//# sourceMappingURL=contract-CWJSYoJl.d.cts.map
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { f as AuditQuery, i as AuditCheckpoint, n as ActionDefinition, p as AuditSection, s as AuditEvent } from "./schema-DmU7Wp0F.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/hooks/contract.d.ts
|
|
4
|
+
/** Who performed a control-plane operation (from the authenticated principal). */
|
|
5
|
+
interface HookActor {
|
|
6
|
+
id: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Event delivered to {@link AuditHooks.before} — the *proposed* mutation,
|
|
12
|
+
* before it commits. Throw from the handler to deny it.
|
|
13
|
+
*/
|
|
14
|
+
type BeforeEvent = {
|
|
15
|
+
/** The record gate (quota, policy). Runs once per `record`/`recordMany` call per tenant. */type: "event.record";
|
|
16
|
+
tenant: string;
|
|
17
|
+
actions: string[];
|
|
18
|
+
count: number;
|
|
19
|
+
} | {
|
|
20
|
+
type: "event.erase";
|
|
21
|
+
tenant: string;
|
|
22
|
+
eventId: string;
|
|
23
|
+
sections: AuditSection[];
|
|
24
|
+
reason?: string;
|
|
25
|
+
actor: HookActor | null;
|
|
26
|
+
} | {
|
|
27
|
+
type: "events.export";
|
|
28
|
+
tenant: string;
|
|
29
|
+
query: AuditQuery;
|
|
30
|
+
format: string;
|
|
31
|
+
actor: HookActor | null;
|
|
32
|
+
} | {
|
|
33
|
+
type: "events.prune";
|
|
34
|
+
tenant: string;
|
|
35
|
+
throughSeq: number;
|
|
36
|
+
actor: HookActor | null;
|
|
37
|
+
} | {
|
|
38
|
+
type: "action.upsert";
|
|
39
|
+
action: ActionDefinition;
|
|
40
|
+
actor: HookActor | null;
|
|
41
|
+
} | {
|
|
42
|
+
type: "action.delete";
|
|
43
|
+
name: string;
|
|
44
|
+
actor: HookActor | null;
|
|
45
|
+
} | {
|
|
46
|
+
type: "checkpoint.create";
|
|
47
|
+
tenant: string;
|
|
48
|
+
actor: HookActor | null;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Event delivered to {@link AuditHooks.after} — the *committed* mutation.
|
|
52
|
+
*/
|
|
53
|
+
type AfterEvent = {
|
|
54
|
+
type: "events.recorded";
|
|
55
|
+
tenant: string;
|
|
56
|
+
events: AuditEvent[];
|
|
57
|
+
at: string;
|
|
58
|
+
} | {
|
|
59
|
+
type: "event.erased";
|
|
60
|
+
tenant: string;
|
|
61
|
+
event: AuditEvent;
|
|
62
|
+
sections: AuditSection[];
|
|
63
|
+
at: string;
|
|
64
|
+
} | {
|
|
65
|
+
type: "events.exported";
|
|
66
|
+
tenant: string;
|
|
67
|
+
query: AuditQuery;
|
|
68
|
+
format: string;
|
|
69
|
+
at: string;
|
|
70
|
+
} | {
|
|
71
|
+
/** Retention removed a prefix of the chain; `base` anchors what remains. */type: "events.pruned";
|
|
72
|
+
tenant: string;
|
|
73
|
+
throughSeq: number;
|
|
74
|
+
count: number;
|
|
75
|
+
base: AuditCheckpoint | null;
|
|
76
|
+
at: string;
|
|
77
|
+
} | {
|
|
78
|
+
type: "action.upserted";
|
|
79
|
+
action: ActionDefinition;
|
|
80
|
+
at: string;
|
|
81
|
+
} | {
|
|
82
|
+
type: "action.deleted";
|
|
83
|
+
name: string;
|
|
84
|
+
action: ActionDefinition;
|
|
85
|
+
at: string;
|
|
86
|
+
} | {
|
|
87
|
+
type: "checkpoint.created";
|
|
88
|
+
tenant: string;
|
|
89
|
+
checkpoint: AuditCheckpoint;
|
|
90
|
+
at: string;
|
|
91
|
+
};
|
|
92
|
+
/** The discriminant strings of {@link BeforeEvent} / {@link AfterEvent}. */
|
|
93
|
+
type BeforeEventType = BeforeEvent["type"];
|
|
94
|
+
type AfterEventType = AfterEvent["type"];
|
|
95
|
+
/**
|
|
96
|
+
* Thrown from a {@link AuditHooks.before} handler to **deny** a mutation with
|
|
97
|
+
* a clean HTTP status (default `403`). Any thrown error denies the mutation,
|
|
98
|
+
* but a plain `Error` maps to `500` at the API layer (treated as an unexpected
|
|
99
|
+
* bug); throw this to signal a deliberate policy rejection (`403`, or a custom
|
|
100
|
+
* `status` such as `409`/`422`).
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* before(event) {
|
|
105
|
+
* if (event.type === "event.record" && overQuota(event.tenant)) {
|
|
106
|
+
* throw new HookDeniedError("Monthly audit quota exceeded.", { status: 429 });
|
|
107
|
+
* }
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
declare class HookDeniedError extends Error {
|
|
112
|
+
/** HTTP status the API layer should respond with. Default `403`. */
|
|
113
|
+
readonly status: number;
|
|
114
|
+
constructor(message: string, options?: {
|
|
115
|
+
status?: number;
|
|
116
|
+
cause?: unknown;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A control-plane hook. Implement `before`, `after`, or both. Pass one — or an
|
|
121
|
+
* array — to {@link ../core.createAuditCore} via `hooks`.
|
|
122
|
+
*/
|
|
123
|
+
interface AuditHooks {
|
|
124
|
+
/**
|
|
125
|
+
* Runs before a mutation commits. **Throw to deny** (the error propagates to
|
|
126
|
+
* the caller; its message is the reason). Return/resolve to allow. Must not
|
|
127
|
+
* mutate the event payload.
|
|
128
|
+
*/
|
|
129
|
+
before?(event: BeforeEvent): void | Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Runs after a mutation commits. For side effects only. Errors are isolated
|
|
132
|
+
* and reported via `onHookError` — they never fail the (already committed)
|
|
133
|
+
* operation.
|
|
134
|
+
*/
|
|
135
|
+
after?(event: AfterEvent): void | Promise<void>;
|
|
136
|
+
}
|
|
137
|
+
/** Accepts a single hook, an array, or nothing. */
|
|
138
|
+
type AuditHooksInput = AuditHooks | readonly AuditHooks[] | undefined;
|
|
139
|
+
/** Reports an error thrown by an `after` hook. */
|
|
140
|
+
type HookErrorReporter = (error: unknown, event: AfterEvent) => void;
|
|
141
|
+
/** Normalize the `hooks` option into a flat array (empty when unset). */
|
|
142
|
+
declare function normalizeHooks(input: AuditHooksInput): AuditHooks[];
|
|
143
|
+
/**
|
|
144
|
+
* Run every `before` hook sequentially, in order. The first hook to throw
|
|
145
|
+
* aborts: the error propagates to the caller (denying the mutation) and no
|
|
146
|
+
* later hook runs. A no-op when there are no `before` hooks.
|
|
147
|
+
*/
|
|
148
|
+
declare function runBefore(hooks: AuditHooks[], event: BeforeEvent): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Run every `after` hook, isolating failures. The mutation has already
|
|
151
|
+
* committed, so a throwing hook must not fail the operation — its error is
|
|
152
|
+
* routed to `onError` and swallowed. Remaining hooks still run.
|
|
153
|
+
*/
|
|
154
|
+
declare function runAfter(hooks: AuditHooks[], event: AfterEvent, onError: HookErrorReporter): Promise<void>;
|
|
155
|
+
/** Default `after`-hook error reporter: warn, but never throw. */
|
|
156
|
+
declare const defaultHookErrorReporter: HookErrorReporter;
|
|
157
|
+
//#endregion
|
|
158
|
+
export { BeforeEvent as a, HookDeniedError as c, normalizeHooks as d, runAfter as f, AuditHooksInput as i, HookErrorReporter as l, AfterEventType as n, BeforeEventType as o, runBefore as p, AuditHooks as r, HookActor as s, AfterEvent as t, defaultHookErrorReporter as u };
|
|
159
|
+
//# sourceMappingURL=contract-Cht05WYQ.d.mts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { n as Principal } from "./contract-DlTo4u2t.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/authorization/contract.d.ts
|
|
4
|
+
/** The full set of authorizable actions. */
|
|
5
|
+
type AuditAction = "tenant:read" | "event:read" | "event:record" | "event:export" | "event:erase" | "integrity:read" | "integrity:checkpoint" | "action:read" | "action:update" | "action:delete" | "retention:prune" | "stream:read" | "stream:retry";
|
|
6
|
+
/**
|
|
7
|
+
* The resource an action targets. An absent `tenant` / `name` means "across
|
|
8
|
+
* all" (listings, the cross-tenant event search, a global prune).
|
|
9
|
+
*/
|
|
10
|
+
type AuditResource = {
|
|
11
|
+
type: "tenant";
|
|
12
|
+
tenant?: string;
|
|
13
|
+
} | {
|
|
14
|
+
type: "event";
|
|
15
|
+
tenant?: string;
|
|
16
|
+
eventId?: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: "integrity";
|
|
19
|
+
tenant: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: "action";
|
|
22
|
+
name?: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: "retention";
|
|
25
|
+
tenant?: string;
|
|
26
|
+
} | {
|
|
27
|
+
type: "stream";
|
|
28
|
+
name?: string;
|
|
29
|
+
};
|
|
30
|
+
/** Input passed to {@link AuthorizationProvider.authorize}. */
|
|
31
|
+
interface AuthorizeInput {
|
|
32
|
+
principal: Principal | null;
|
|
33
|
+
action: AuditAction;
|
|
34
|
+
resource: AuditResource;
|
|
35
|
+
request: Request;
|
|
36
|
+
}
|
|
37
|
+
/** Decides whether an action is permitted. */
|
|
38
|
+
interface AuthorizationProvider {
|
|
39
|
+
authorize(input: AuthorizeInput): Promise<boolean>;
|
|
40
|
+
}
|
|
41
|
+
/** Every action, in a stable order (the UI and `/config` `allowed` use it). */
|
|
42
|
+
declare const ALL_ACTIONS: readonly AuditAction[];
|
|
43
|
+
/** Actions that mutate state — blocked (`423`) when the panel is readonly. */
|
|
44
|
+
declare const MUTATING_ACTIONS: ReadonlySet<AuditAction>;
|
|
45
|
+
/** True if the action mutates state. */
|
|
46
|
+
declare const isMutatingAction: (action: AuditAction) => boolean;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { AuthorizeInput as a, AuthorizationProvider as i, AuditAction as n, MUTATING_ACTIONS as o, AuditResource as r, isMutatingAction as s, ALL_ACTIONS as t };
|
|
49
|
+
//# sourceMappingURL=contract-CqYQzB6e.d.cts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//#region src/storage/contract.ts
|
|
2
|
+
/**
|
|
3
|
+
* Thrown by {@link EventLogStorage.appendEvents} when the tenant's chain moved
|
|
4
|
+
* underneath the writer (another process appended first). The core re-reads the
|
|
5
|
+
* head, re-chains the batch, and retries.
|
|
6
|
+
*/
|
|
7
|
+
var ChainConflictError = class extends Error {
|
|
8
|
+
constructor(tenant, expectedSeq) {
|
|
9
|
+
super(`Chain conflict for tenant "${tenant}": expected head seq ${expectedSeq}`);
|
|
10
|
+
this.name = "ChainConflictError";
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
/** Runtime feature-detection: does this storage implement `watch`? */
|
|
14
|
+
function isWatchable(storage) {
|
|
15
|
+
return typeof storage.watch === "function";
|
|
16
|
+
}
|
|
17
|
+
/** Runtime feature-detection: does this storage implement `transaction`? */
|
|
18
|
+
function isTransactional(storage) {
|
|
19
|
+
return typeof storage.transaction === "function";
|
|
20
|
+
}
|
|
21
|
+
/** Runtime feature-detection: does this storage implement `compareAndSwap`? */
|
|
22
|
+
function isCompareAndSwap(storage) {
|
|
23
|
+
return typeof storage.compareAndSwap === "function";
|
|
24
|
+
}
|
|
25
|
+
/** Runtime feature-detection: does this storage implement the native event log? */
|
|
26
|
+
function hasEventLog(storage) {
|
|
27
|
+
return typeof storage.appendEvents === "function";
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Helper for adapters whose subpath requires an optional peer dependency. Throws
|
|
31
|
+
* a clear, actionable error when the peer is missing.
|
|
32
|
+
*/
|
|
33
|
+
function requirePeer(name, subpath) {
|
|
34
|
+
throw new Error(`@xtandard/audit/${subpath} requires the "${name}" package. Install it with: bun add ${name}`);
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
Object.defineProperty(exports, "ChainConflictError", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function() {
|
|
40
|
+
return ChainConflictError;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "hasEventLog", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function() {
|
|
46
|
+
return hasEventLog;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "isCompareAndSwap", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function() {
|
|
52
|
+
return isCompareAndSwap;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "isTransactional", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function() {
|
|
58
|
+
return isTransactional;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "isWatchable", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function() {
|
|
64
|
+
return isWatchable;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "requirePeer", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function() {
|
|
70
|
+
return requirePeer;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=contract-DYvBNdnR.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-DYvBNdnR.cjs","names":[],"sources":["../src/storage/contract.ts"],"sourcesContent":["/**\n * Storage contracts. The base {@link AuditStorage} is intentionally tiny —\n * four async methods — so users can bring their own backend. Optional\n * capabilities (watch, transactions, compare-and-swap, and the audit-specific\n * native event log) are separate interfaces that adapters may implement and the\n * core feature-detects (ADR 0005).\n *\n * @module\n */\n\nimport type { AuditEvent } from \"../schema.ts\";\nimport type { NormalizedQuery } from \"../query.ts\";\n\n/** The minimal key/value contract every storage backend must satisfy. */\nexport interface AuditStorage {\n /** Read a value, or `null` if absent. */\n getItem<T>(key: string): Promise<T | null>;\n /** Write a value (overwriting any existing). */\n setItem<T>(key: string, value: T): Promise<void>;\n /** Delete a key (no-op if absent). */\n removeItem(key: string): Promise<void>;\n /** List all keys beginning with `prefix`. */\n getKeys(prefix: string): Promise<string[]>;\n}\n\n/** A storage change event delivered to {@link WatchableAuditStorage.watch} callbacks. */\nexport interface StorageChangeEvent {\n type: \"update\" | \"remove\";\n key: string;\n}\n\n/** Storage that can push change notifications (e.g. Redis pub/sub, fs.watch). */\nexport interface WatchableAuditStorage extends AuditStorage {\n /**\n * Subscribe to changes under `prefix`. Resolves to an unsubscribe function.\n */\n watch(prefix: string, callback: (event: StorageChangeEvent) => void): Promise<() => void>;\n}\n\n/** Storage that supports atomic multi-key transactions. */\nexport interface TransactionalAuditStorage extends AuditStorage {\n transaction<T>(callback: (tx: AuditStorage) => Promise<T>): Promise<T>;\n}\n\n/** Storage that supports optimistic concurrency via compare-and-swap. */\nexport interface CompareAndSwapAuditStorage extends AuditStorage {\n compareAndSwap<T>(input: { key: string; expected: T | null; next: T }): Promise<boolean>;\n}\n\n/**\n * Thrown by {@link EventLogStorage.appendEvents} when the tenant's chain moved\n * underneath the writer (another process appended first). The core re-reads the\n * head, re-chains the batch, and retries.\n */\nexport class ChainConflictError extends Error {\n constructor(tenant: string, expectedSeq: number) {\n super(`Chain conflict for tenant \"${tenant}\": expected head seq ${expectedSeq}`);\n this.name = \"ChainConflictError\";\n }\n}\n\n/**\n * Storage that stores and queries audit events **natively** (indexes, SQL\n * `WHERE`, Mongo filters) instead of through the generic KV index fallback in\n * the core (ADR 0005). Control data (catalog, heads, checkpoints, cursors) still\n * lives in the KV methods.\n *\n * Contract:\n * - `appendEvents` is atomic per call: either every event is stored or none,\n * and it throws {@link ChainConflictError} when an event with the same\n * `(tenant, seq)` exists or the tenant's last seq is not `expectedSeq`.\n * - `queryEvents` honours every {@link NormalizedQuery} filter, sorts by\n * `(occurredAt, id)` in `query.order`, starts strictly after `query.after`,\n * and returns at most `query.limit` items plus whether more exist.\n */\nexport interface EventLogStorage extends AuditStorage {\n appendEvents(\n tenant: string,\n events: AuditEvent[],\n options: { expectedSeq: number },\n ): Promise<void>;\n getEvent(tenant: string, id: string): Promise<AuditEvent | null>;\n /** The event with the highest seq for the tenant, or null. */\n lastEvent(tenant: string): Promise<AuditEvent | null>;\n /** Events with `seq > afterSeq` ascending by seq, at most `limit`. */\n eventsBySeq(tenant: string, options: { afterSeq: number; limit: number }): Promise<AuditEvent[]>;\n queryEvents(query: NormalizedQuery): Promise<{ items: AuditEvent[]; hasMore: boolean }>;\n /** Replace a stored event in place (same tenant/id/seq) — used by erasure. */\n replaceEvent(event: AuditEvent): Promise<void>;\n /** Delete every event of the tenant with `seq <= throughSeq`; resolves to the count removed. */\n deleteEventsThrough(tenant: string, throughSeq: number): Promise<number>;\n /** Count retained events (all tenants when `tenant` is omitted). */\n countEvents(tenant?: string): Promise<number>;\n /** Distinct tenants that have events. */\n listEventTenants(): Promise<string[]>;\n}\n\n/** Runtime feature-detection: does this storage implement `watch`? */\nexport function isWatchable(storage: AuditStorage): storage is WatchableAuditStorage {\n return typeof (storage as Partial<WatchableAuditStorage>).watch === \"function\";\n}\n\n/** Runtime feature-detection: does this storage implement `transaction`? */\nexport function isTransactional(storage: AuditStorage): storage is TransactionalAuditStorage {\n return typeof (storage as Partial<TransactionalAuditStorage>).transaction === \"function\";\n}\n\n/** Runtime feature-detection: does this storage implement `compareAndSwap`? */\nexport function isCompareAndSwap(storage: AuditStorage): storage is CompareAndSwapAuditStorage {\n return typeof (storage as Partial<CompareAndSwapAuditStorage>).compareAndSwap === \"function\";\n}\n\n/** Runtime feature-detection: does this storage implement the native event log? */\nexport function hasEventLog(storage: AuditStorage): storage is EventLogStorage {\n return typeof (storage as Partial<EventLogStorage>).appendEvents === \"function\";\n}\n\n/**\n * Helper for adapters whose subpath requires an optional peer dependency. Throws\n * a clear, actionable error when the peer is missing.\n */\nexport function requirePeer(name: string, subpath: string): never {\n throw new Error(\n `@xtandard/audit/${subpath} requires the \"${name}\" package. Install it with: bun add ${name}`,\n );\n}\n"],"mappings":";;;;;;AAsDA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,YAAY,QAAgB,aAAqB;EAC/C,MAAM,8BAA8B,OAAO,uBAAuB,aAAa;EAC/E,KAAK,OAAO;CACd;AACF;;AAuCA,SAAgB,YAAY,SAAyD;CACnF,OAAO,OAAQ,QAA2C,UAAU;AACtE;;AAGA,SAAgB,gBAAgB,SAA6D;CAC3F,OAAO,OAAQ,QAA+C,gBAAgB;AAChF;;AAGA,SAAgB,iBAAiB,SAA8D;CAC7F,OAAO,OAAQ,QAAgD,mBAAmB;AACpF;;AAGA,SAAgB,YAAY,SAAmD;CAC7E,OAAO,OAAQ,QAAqC,iBAAiB;AACvE;;;;;AAMA,SAAgB,YAAY,MAAc,SAAwB;CAChE,MAAM,IAAI,MACR,mBAAmB,QAAQ,iBAAiB,KAAK,sCAAsC,MACzF;AACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/auth/contract.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Authentication contract. Answers: "Who is this request from?"
|
|
4
|
+
*
|
|
5
|
+
* `@xtandard/audit` ships `none`/`basic`/`delegated` implementations, but any
|
|
6
|
+
* object satisfying {@link AuthProvider} works — bring your own.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/** An authenticated identity. */
|
|
11
|
+
interface Principal {
|
|
12
|
+
id: string;
|
|
13
|
+
email?: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
roles?: string[];
|
|
16
|
+
metadata?: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** Authenticates an incoming web-standard {@link Request}. */
|
|
19
|
+
interface AuthProvider {
|
|
20
|
+
/** Resolve the principal, or `null` if the request is unauthenticated. */
|
|
21
|
+
authenticate(request: Request): Promise<Principal | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Optional: build a `Response` that prompts for credentials (e.g. a 401 with a
|
|
24
|
+
* `WWW-Authenticate` header). When omitted, the server returns a plain 401.
|
|
25
|
+
*/
|
|
26
|
+
challenge?(request: Request): Response | undefined;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Principal as n, AuthProvider as t };
|
|
30
|
+
//# sourceMappingURL=contract-DlTo4u2t.d.cts.map
|