@xtandard/kit 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 +71 -2
- package/bin/xtandard-kit.mjs +3 -0
- package/dist/base-path-BJugWLNO.cjs +42 -0
- package/dist/base-path-BJugWLNO.cjs.map +1 -0
- package/dist/base-path-CDb4In5E.mjs +31 -0
- package/dist/base-path-CDb4In5E.mjs.map +1 -0
- package/dist/basic-Qtriv0xS.mjs +176 -0
- package/dist/basic-Qtriv0xS.mjs.map +1 -0
- package/dist/basic-ZaO92-lB.cjs +199 -0
- package/dist/basic-ZaO92-lB.cjs.map +1 -0
- package/dist/bin.cjs +126 -0
- package/dist/bin.cjs.map +1 -0
- package/dist/bin.d.cts +20 -0
- package/dist/bin.d.mts +20 -0
- package/dist/bin.mjs +125 -0
- package/dist/bin.mjs.map +1 -0
- package/dist/cas-CuPSaXBV.cjs +23 -0
- package/dist/cas-CuPSaXBV.cjs.map +1 -0
- package/dist/cas-CzA-yECx.mjs +18 -0
- package/dist/cas-CzA-yECx.mjs.map +1 -0
- package/dist/chunk-DakpK96I.cjs +43 -0
- package/dist/contract-B3UPXXLx.d.cts +30 -0
- package/dist/contract-B3UPXXLx.d.mts +30 -0
- package/dist/contract-BDPNvjtp.d.mts +64 -0
- package/dist/contract-BEdfGTPs.mjs +85 -0
- package/dist/contract-BEdfGTPs.mjs.map +1 -0
- package/dist/contract-BIVzAn4f.d.cts +64 -0
- package/dist/contract-BvgtswLX.d.cts +75 -0
- package/dist/contract-BvgtswLX.d.mts +75 -0
- package/dist/contract-DUj9P3Vt.d.cts +72 -0
- package/dist/contract-DUj9P3Vt.d.mts +72 -0
- package/dist/contract-wAEMDmYG.cjs +132 -0
- package/dist/contract-wAEMDmYG.cjs.map +1 -0
- package/dist/drizzle-BElCHWri.d.mts +115 -0
- package/dist/drizzle-BXaQXCr0.cjs +232 -0
- package/dist/drizzle-BXaQXCr0.cjs.map +1 -0
- package/dist/drizzle-CEpahWQB.d.cts +115 -0
- package/dist/drizzle-DxnelsPT.mjs +197 -0
- package/dist/drizzle-DxnelsPT.mjs.map +1 -0
- package/dist/duration-7WpAK-xe.mjs +52 -0
- package/dist/duration-7WpAK-xe.mjs.map +1 -0
- package/dist/duration-DVA0Fzkx.cjs +63 -0
- package/dist/duration-DVA0Fzkx.cjs.map +1 -0
- package/dist/duration-FPwbmWIU.d.cts +35 -0
- package/dist/duration-FPwbmWIU.d.mts +35 -0
- package/dist/entry-adapters-bun.cjs +10 -0
- package/dist/entry-adapters-bun.cjs.map +1 -0
- package/dist/entry-adapters-bun.d.cts +10 -0
- package/dist/entry-adapters-bun.d.mts +10 -0
- package/dist/entry-adapters-bun.mjs +9 -0
- package/dist/entry-adapters-bun.mjs.map +1 -0
- package/dist/entry-adapters-elysia.cjs +54 -0
- package/dist/entry-adapters-elysia.cjs.map +1 -0
- package/dist/entry-adapters-elysia.d.cts +38 -0
- package/dist/entry-adapters-elysia.d.mts +38 -0
- package/dist/entry-adapters-elysia.mjs +53 -0
- package/dist/entry-adapters-elysia.mjs.map +1 -0
- package/dist/entry-adapters-express.cjs +27 -0
- package/dist/entry-adapters-express.cjs.map +1 -0
- package/dist/entry-adapters-express.d.cts +24 -0
- package/dist/entry-adapters-express.d.mts +24 -0
- package/dist/entry-adapters-express.mjs +26 -0
- package/dist/entry-adapters-express.mjs.map +1 -0
- package/dist/entry-adapters-hono.cjs +33 -0
- package/dist/entry-adapters-hono.cjs.map +1 -0
- package/dist/entry-adapters-hono.d.cts +36 -0
- package/dist/entry-adapters-hono.d.mts +36 -0
- package/dist/entry-adapters-hono.mjs +30 -0
- package/dist/entry-adapters-hono.mjs.map +1 -0
- package/dist/entry-adapters-next.cjs +19 -0
- package/dist/entry-adapters-next.cjs.map +1 -0
- package/dist/entry-adapters-next.d.cts +35 -0
- package/dist/entry-adapters-next.d.mts +35 -0
- package/dist/entry-adapters-next.mjs +18 -0
- package/dist/entry-adapters-next.mjs.map +1 -0
- package/dist/entry-adapters-node.cjs +7 -0
- package/dist/entry-adapters-node.d.cts +2 -0
- package/dist/entry-adapters-node.d.mts +2 -0
- package/dist/entry-adapters-node.mjs +2 -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-auth.cjs +0 -0
- package/dist/entry-auth.d.cts +2 -0
- package/dist/entry-auth.d.mts +2 -0
- package/dist/entry-auth.mjs +1 -0
- package/dist/entry-authorization-delegated.cjs +27 -0
- package/dist/entry-authorization-delegated.cjs.map +1 -0
- package/dist/entry-authorization-delegated.d.cts +31 -0
- package/dist/entry-authorization-delegated.d.mts +31 -0
- package/dist/entry-authorization-delegated.mjs +26 -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 +3 -0
- package/dist/entry-authorization-roles.d.cts +2 -0
- package/dist/entry-authorization-roles.d.mts +2 -0
- package/dist/entry-authorization-roles.mjs +2 -0
- package/dist/entry-authorization.cjs +35 -0
- package/dist/entry-authorization.cjs.map +1 -0
- package/dist/entry-authorization.d.cts +2 -0
- package/dist/entry-authorization.d.mts +2 -0
- package/dist/entry-authorization.mjs +34 -0
- package/dist/entry-authorization.mjs.map +1 -0
- package/dist/entry-build.cjs +481 -0
- package/dist/entry-build.cjs.map +1 -0
- package/dist/entry-build.d.cts +355 -0
- package/dist/entry-build.d.mts +355 -0
- package/dist/entry-build.mjs +460 -0
- package/dist/entry-build.mjs.map +1 -0
- package/dist/entry-cli.cjs +368 -0
- package/dist/entry-cli.cjs.map +1 -0
- package/dist/entry-cli.d.cts +275 -0
- package/dist/entry-cli.d.mts +275 -0
- package/dist/entry-cli.mjs +355 -0
- package/dist/entry-cli.mjs.map +1 -0
- package/dist/entry-drizzle-mysql.cjs +36 -0
- package/dist/entry-drizzle-mysql.cjs.map +1 -0
- package/dist/entry-drizzle-mysql.d.cts +55 -0
- package/dist/entry-drizzle-mysql.d.mts +55 -0
- package/dist/entry-drizzle-mysql.mjs +34 -0
- package/dist/entry-drizzle-mysql.mjs.map +1 -0
- package/dist/entry-drizzle-pg.cjs +38 -0
- package/dist/entry-drizzle-pg.cjs.map +1 -0
- package/dist/entry-drizzle-pg.d.cts +78 -0
- package/dist/entry-drizzle-pg.d.mts +78 -0
- package/dist/entry-drizzle-pg.mjs +36 -0
- package/dist/entry-drizzle-pg.mjs.map +1 -0
- package/dist/entry-drizzle-sqlite.cjs +20 -0
- package/dist/entry-drizzle-sqlite.cjs.map +1 -0
- package/dist/entry-drizzle-sqlite.d.cts +22 -0
- package/dist/entry-drizzle-sqlite.d.mts +22 -0
- package/dist/entry-drizzle-sqlite.mjs +19 -0
- package/dist/entry-drizzle-sqlite.mjs.map +1 -0
- package/dist/entry-hooks-log.cjs +32 -0
- package/dist/entry-hooks-log.cjs.map +1 -0
- package/dist/entry-hooks-log.d.cts +36 -0
- package/dist/entry-hooks-log.d.mts +36 -0
- package/dist/entry-hooks-log.mjs +31 -0
- package/dist/entry-hooks-log.mjs.map +1 -0
- package/dist/entry-hooks.cjs +10 -0
- package/dist/entry-hooks.d.cts +2 -0
- package/dist/entry-hooks.d.mts +2 -0
- package/dist/entry-hooks.mjs +2 -0
- package/dist/entry-server-router.cjs +235 -0
- package/dist/entry-server-router.cjs.map +1 -0
- package/dist/entry-server-router.d.cts +193 -0
- package/dist/entry-server-router.d.mts +193 -0
- package/dist/entry-server-router.mjs +228 -0
- package/dist/entry-server-router.mjs.map +1 -0
- package/dist/entry-server.cjs +344 -0
- package/dist/entry-server.cjs.map +1 -0
- package/dist/entry-server.d.cts +230 -0
- package/dist/entry-server.d.mts +230 -0
- package/dist/entry-server.mjs +322 -0
- package/dist/entry-server.mjs.map +1 -0
- package/dist/entry-site.cjs +1083 -0
- package/dist/entry-site.cjs.map +1 -0
- package/dist/entry-site.d.cts +336 -0
- package/dist/entry-site.d.mts +336 -0
- package/dist/entry-site.mjs +1060 -0
- package/dist/entry-site.mjs.map +1 -0
- package/dist/entry-storage-cloudflare-kv.cjs +51 -0
- package/dist/entry-storage-cloudflare-kv.cjs.map +1 -0
- package/dist/entry-storage-cloudflare-kv.d.cts +52 -0
- package/dist/entry-storage-cloudflare-kv.d.mts +52 -0
- package/dist/entry-storage-cloudflare-kv.mjs +50 -0
- package/dist/entry-storage-cloudflare-kv.mjs.map +1 -0
- package/dist/entry-storage-drizzle-internals.cjs +6 -0
- package/dist/entry-storage-drizzle-internals.d.cts +2 -0
- package/dist/entry-storage-drizzle-internals.d.mts +2 -0
- package/dist/entry-storage-drizzle-internals.mjs +2 -0
- package/dist/entry-storage-drizzle.cjs +4 -0
- package/dist/entry-storage-drizzle.d.cts +3 -0
- package/dist/entry-storage-drizzle.d.mts +3 -0
- package/dist/entry-storage-drizzle.mjs +2 -0
- package/dist/entry-storage-file.cjs +306 -0
- package/dist/entry-storage-file.cjs.map +1 -0
- package/dist/entry-storage-file.d.cts +76 -0
- package/dist/entry-storage-file.d.mts +76 -0
- package/dist/entry-storage-file.mjs +301 -0
- package/dist/entry-storage-file.mjs.map +1 -0
- package/dist/entry-storage-libsql-internals.cjs +7 -0
- package/dist/entry-storage-libsql-internals.d.cts +3 -0
- package/dist/entry-storage-libsql-internals.d.mts +3 -0
- package/dist/entry-storage-libsql-internals.mjs +3 -0
- package/dist/entry-storage-libsql.cjs +3 -0
- package/dist/entry-storage-libsql.d.cts +2 -0
- package/dist/entry-storage-libsql.d.mts +2 -0
- package/dist/entry-storage-libsql.mjs +2 -0
- package/dist/entry-storage-memory.cjs +78 -0
- package/dist/entry-storage-memory.cjs.map +1 -0
- package/dist/entry-storage-memory.d.cts +35 -0
- package/dist/entry-storage-memory.d.mts +35 -0
- package/dist/entry-storage-memory.mjs +77 -0
- package/dist/entry-storage-memory.mjs.map +1 -0
- package/dist/entry-storage-mongodb-internals.cjs +5 -0
- package/dist/entry-storage-mongodb-internals.d.cts +2 -0
- package/dist/entry-storage-mongodb-internals.d.mts +2 -0
- package/dist/entry-storage-mongodb-internals.mjs +2 -0
- package/dist/entry-storage-mongodb.cjs +3 -0
- package/dist/entry-storage-mongodb.d.cts +2 -0
- package/dist/entry-storage-mongodb.d.mts +2 -0
- package/dist/entry-storage-mongodb.mjs +2 -0
- package/dist/entry-storage-postgres-internals.cjs +6 -0
- package/dist/entry-storage-postgres-internals.d.cts +2 -0
- package/dist/entry-storage-postgres-internals.d.mts +2 -0
- package/dist/entry-storage-postgres-internals.mjs +2 -0
- package/dist/entry-storage-postgres.cjs +4 -0
- package/dist/entry-storage-postgres.d.cts +2 -0
- package/dist/entry-storage-postgres.d.mts +2 -0
- package/dist/entry-storage-postgres.mjs +2 -0
- package/dist/entry-storage-redis-internals.cjs +7 -0
- package/dist/entry-storage-redis-internals.d.cts +2 -0
- package/dist/entry-storage-redis-internals.d.mts +2 -0
- package/dist/entry-storage-redis-internals.mjs +2 -0
- package/dist/entry-storage-redis.cjs +4 -0
- package/dist/entry-storage-redis.d.cts +2 -0
- package/dist/entry-storage-redis.d.mts +2 -0
- package/dist/entry-storage-redis.mjs +2 -0
- package/dist/entry-storage-sqlite-internals.cjs +7 -0
- package/dist/entry-storage-sqlite-internals.d.cts +3 -0
- package/dist/entry-storage-sqlite-internals.d.mts +3 -0
- package/dist/entry-storage-sqlite-internals.mjs +3 -0
- package/dist/entry-storage-sqlite.cjs +3 -0
- package/dist/entry-storage-sqlite.d.cts +2 -0
- package/dist/entry-storage-sqlite.d.mts +2 -0
- package/dist/entry-storage-sqlite.mjs +2 -0
- package/dist/entry-storage-testing.cjs +801 -0
- package/dist/entry-storage-testing.cjs.map +1 -0
- package/dist/entry-storage-testing.d.cts +150 -0
- package/dist/entry-storage-testing.d.mts +150 -0
- package/dist/entry-storage-testing.mjs +790 -0
- package/dist/entry-storage-testing.mjs.map +1 -0
- package/dist/entry-storage-unstorage.cjs +78 -0
- package/dist/entry-storage-unstorage.cjs.map +1 -0
- package/dist/entry-storage-unstorage.d.cts +30 -0
- package/dist/entry-storage-unstorage.d.mts +30 -0
- package/dist/entry-storage-unstorage.mjs +77 -0
- package/dist/entry-storage-unstorage.mjs.map +1 -0
- package/dist/entry-storage.cjs +114 -0
- package/dist/entry-storage.cjs.map +1 -0
- package/dist/entry-storage.d.cts +152 -0
- package/dist/entry-storage.d.mts +152 -0
- package/dist/entry-storage.mjs +91 -0
- package/dist/entry-storage.mjs.map +1 -0
- package/dist/entry-testing.cjs +79 -0
- package/dist/entry-testing.cjs.map +1 -0
- package/dist/entry-testing.d.cts +55 -0
- package/dist/entry-testing.d.mts +55 -0
- package/dist/entry-testing.mjs +77 -0
- package/dist/entry-testing.mjs.map +1 -0
- package/dist/entry-tokens.cjs +4 -0
- package/dist/entry-tokens.d.cts +85 -0
- package/dist/entry-tokens.d.mts +85 -0
- package/dist/entry-tokens.mjs +2 -0
- package/dist/entry-ui-embed.cjs +131 -0
- package/dist/entry-ui-embed.cjs.map +1 -0
- package/dist/entry-ui-embed.d.cts +87 -0
- package/dist/entry-ui-embed.d.mts +87 -0
- package/dist/entry-ui-embed.mjs +127 -0
- package/dist/entry-ui-embed.mjs.map +1 -0
- package/dist/entry-ui.cjs +795 -0
- package/dist/entry-ui.cjs.map +1 -0
- package/dist/entry-ui.d.cts +574 -0
- package/dist/entry-ui.d.mts +574 -0
- package/dist/entry-ui.mjs +731 -0
- package/dist/entry-ui.mjs.map +1 -0
- package/dist/entry-util.cjs +145 -0
- package/dist/entry-util.cjs.map +1 -0
- package/dist/entry-util.d.cts +85 -0
- package/dist/entry-util.d.mts +85 -0
- package/dist/entry-util.mjs +130 -0
- package/dist/entry-util.mjs.map +1 -0
- package/dist/http-B_rTnLW9.cjs +235 -0
- package/dist/http-B_rTnLW9.cjs.map +1 -0
- package/dist/http-CxYM7kPT.d.mts +133 -0
- package/dist/http-DVdVI6kJ.mjs +164 -0
- package/dist/http-DVdVI6kJ.mjs.map +1 -0
- package/dist/http-XBVRk8uo.d.cts +133 -0
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -0
- package/dist/json-CCyzstIm.d.cts +44 -0
- package/dist/json-CCyzstIm.d.mts +44 -0
- package/dist/json-CM7TwYQ7.cjs +92 -0
- package/dist/json-CM7TwYQ7.cjs.map +1 -0
- package/dist/json-CmM1M5Kz.mjs +63 -0
- package/dist/json-CmM1M5Kz.mjs.map +1 -0
- package/dist/keys-Bwubabk0.mjs +73 -0
- package/dist/keys-Bwubabk0.mjs.map +1 -0
- package/dist/keys-DQrwxDKI.cjs +126 -0
- package/dist/keys-DQrwxDKI.cjs.map +1 -0
- package/dist/kv-sqlite-B6iTLOx2.d.cts +20 -0
- package/dist/kv-sqlite-CHOdIMJ-.cjs +77 -0
- package/dist/kv-sqlite-CHOdIMJ-.cjs.map +1 -0
- package/dist/kv-sqlite-DIIPfflJ.mjs +66 -0
- package/dist/kv-sqlite-DIIPfflJ.mjs.map +1 -0
- package/dist/kv-sqlite-Tx4UedJs.d.mts +20 -0
- package/dist/libsql-0160BubR.d.mts +65 -0
- package/dist/libsql-BZmRZIqt.d.cts +65 -0
- package/dist/libsql-CiBfVtbS.cjs +103 -0
- package/dist/libsql-CiBfVtbS.cjs.map +1 -0
- package/dist/libsql-CkOjQINi.mjs +86 -0
- package/dist/libsql-CkOjQINi.mjs.map +1 -0
- package/dist/mongodb--Cuj7V_9.cjs +150 -0
- package/dist/mongodb--Cuj7V_9.cjs.map +1 -0
- package/dist/mongodb-DGtsolQ2.d.cts +61 -0
- package/dist/mongodb-JMizy4Wg.mjs +127 -0
- package/dist/mongodb-JMizy4Wg.mjs.map +1 -0
- package/dist/mongodb-xGEU5Gwz.d.mts +61 -0
- package/dist/node-B1Djcwfi.d.cts +57 -0
- package/dist/node-B1Djcwfi.d.mts +57 -0
- package/dist/node-BYjocCbU.mjs +167 -0
- package/dist/node-BYjocCbU.mjs.map +1 -0
- package/dist/node-DFFqYRk-.cjs +201 -0
- package/dist/node-DFFqYRk-.cjs.map +1 -0
- package/dist/none-BEY7Kc_-.mjs +33 -0
- package/dist/none-BEY7Kc_-.mjs.map +1 -0
- package/dist/none-BoQ6-30P.cjs +33 -0
- package/dist/none-BoQ6-30P.cjs.map +1 -0
- package/dist/none-CHwVkQL-.cjs +49 -0
- package/dist/none-CHwVkQL-.cjs.map +1 -0
- package/dist/none-yu3qC47E.mjs +23 -0
- package/dist/none-yu3qC47E.mjs.map +1 -0
- package/dist/peer-BIjBFzwQ.cjs +56 -0
- package/dist/peer-BIjBFzwQ.cjs.map +1 -0
- package/dist/peer-CTHMzOdn.mjs +40 -0
- package/dist/peer-CTHMzOdn.mjs.map +1 -0
- package/dist/portal-container-CJIcau3B.mjs +610 -0
- package/dist/portal-container-CJIcau3B.mjs.map +1 -0
- package/dist/portal-container-Ca1NxrLE.cjs +774 -0
- package/dist/portal-container-Ca1NxrLE.cjs.map +1 -0
- package/dist/postgres-BJzxKBk0.d.cts +72 -0
- package/dist/postgres-CA8_XcAE.cjs +164 -0
- package/dist/postgres-CA8_XcAE.cjs.map +1 -0
- package/dist/postgres-RfQMgAsj.d.mts +72 -0
- package/dist/postgres-aDiBmNzr.mjs +135 -0
- package/dist/postgres-aDiBmNzr.mjs.map +1 -0
- package/dist/redis-B2AS4xAQ.cjs +259 -0
- package/dist/redis-B2AS4xAQ.cjs.map +1 -0
- package/dist/redis-B362ofBw.d.cts +159 -0
- package/dist/redis-CahNAVTW.d.mts +159 -0
- package/dist/redis-hdoKymfG.mjs +218 -0
- package/dist/redis-hdoKymfG.mjs.map +1 -0
- package/dist/roles-7JPrQXZa.mjs +46 -0
- package/dist/roles-7JPrQXZa.mjs.map +1 -0
- package/dist/roles-B_8QqJ3j.cjs +56 -0
- package/dist/roles-B_8QqJ3j.cjs.map +1 -0
- package/dist/roles-DLISB4T3.d.mts +41 -0
- package/dist/roles-DQbbtUPW.d.cts +41 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/scope-css-BN3jf0ly.cjs +315 -0
- package/dist/scope-css-BN3jf0ly.cjs.map +1 -0
- package/dist/scope-css-BuJfRCsE.mjs +256 -0
- package/dist/scope-css-BuJfRCsE.mjs.map +1 -0
- package/dist/scoped-BRoE1W1x.cjs +175 -0
- package/dist/scoped-BRoE1W1x.cjs.map +1 -0
- package/dist/scoped-cFBbotCh.mjs +164 -0
- package/dist/scoped-cFBbotCh.mjs.map +1 -0
- package/dist/sqlite-B2g1JJz1.d.cts +47 -0
- package/dist/sqlite-BIPIlxfj.d.mts +47 -0
- package/dist/sqlite-BntoYaXZ.cjs +79 -0
- package/dist/sqlite-BntoYaXZ.cjs.map +1 -0
- package/dist/sqlite-DYJDcu7p.mjs +62 -0
- package/dist/sqlite-DYJDcu7p.mjs.map +1 -0
- package/dist/table-BrioFSra.d.cts +11 -0
- package/dist/table-BrioFSra.d.mts +11 -0
- package/dist/theme-context-DzZ1otaD.d.cts +270 -0
- package/dist/theme-context-J65pythD.d.mts +270 -0
- package/dist/ui/styles.css +239 -0
- package/dist/util-Dnj5T-yw.mjs +39 -0
- package/dist/util-Dnj5T-yw.mjs.map +1 -0
- package/dist/util-dAnTK9x-.cjs +74 -0
- package/dist/util-dAnTK9x-.cjs.map +1 -0
- package/dist/validation-B-atP968.mjs +191 -0
- package/dist/validation-B-atP968.mjs.map +1 -0
- package/dist/validation-BJifGoB2.d.mts +122 -0
- package/dist/validation-DLnzBVJr.cjs +258 -0
- package/dist/validation-DLnzBVJr.cjs.map +1 -0
- package/dist/validation-tfV2qhbD.d.cts +122 -0
- package/package.json +715 -4
- package/tsconfig/assets.d.ts +21 -0
- package/tsconfig/base.json +21 -0
- package/tsconfig/react.json +9 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { i as canonicalJson, n as JsonValue, o as deepEqual, r as canonical, s as parseJsonValue, t as JsonObject } from "./json-CCyzstIm.cjs";
|
|
2
|
+
import { a as TransactionalKvStorage, c as isTransactional, i as StorageChangeEvent, l as isWatchable, n as CompareAndSwapKvStorage, o as WatchableKvStorage, r as KvStorage, s as isCompareAndSwap, t as CompareAndSwapInput } from "./contract-BvgtswLX.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/storage/watch.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A change source. Called with a `notify` callback: wire your source to invoke it (optionally with
|
|
7
|
+
* the changed key) on every change, and return an unsubscribe function (sync or async).
|
|
8
|
+
*/
|
|
9
|
+
type WatchSubscribe = (notify: (key?: string) => void) => (() => void | Promise<void>) | Promise<() => void | Promise<void>>;
|
|
10
|
+
/**
|
|
11
|
+
* Wrap a storage so it implements {@link WatchableKvStorage} using `subscribe` as the change
|
|
12
|
+
* source. The wrapper delegates every other member to `storage` and only adds `watch`; keys outside
|
|
13
|
+
* the watched `prefix` are filtered out. A notification without a key is delivered as an `update`
|
|
14
|
+
* of the prefix itself (enough to trigger a refresh).
|
|
15
|
+
*
|
|
16
|
+
* The wrapper inherits from `storage` **and** carries every member of `storage` (own, inherited and
|
|
17
|
+
* class methods, bound to `storage`) as an own enumerable property, so `{ ...withWatch(s, sub) }`
|
|
18
|
+
* keeps the methods (the copies' `Object.create`-only wrapper lost them on spread).
|
|
19
|
+
*/
|
|
20
|
+
declare function withWatch<S extends KvStorage>(storage: S, subscribe: WatchSubscribe): S & WatchableKvStorage;
|
|
21
|
+
/**
|
|
22
|
+
* A dedicated notification client for {@link pgListenNotify}, satisfied by a `pg` `Client`. A
|
|
23
|
+
* `Pool` won't do (it rotates connections); use a `Client` you `connect()`.
|
|
24
|
+
*/
|
|
25
|
+
interface PgNotificationClient {
|
|
26
|
+
/** Run a statement (`LISTEN`/`UNLISTEN`). */
|
|
27
|
+
query(sql: string): Promise<unknown>;
|
|
28
|
+
/** Register the notification listener. */
|
|
29
|
+
on(event: "notification", listener: (msg: {
|
|
30
|
+
channel: string;
|
|
31
|
+
payload?: string;
|
|
32
|
+
}) => void): void;
|
|
33
|
+
/** Remove the notification listener. */
|
|
34
|
+
removeListener(event: "notification", listener: (msg: {
|
|
35
|
+
channel: string;
|
|
36
|
+
payload?: string;
|
|
37
|
+
}) => void): void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A {@link WatchSubscribe} backed by Postgres `LISTEN`/`NOTIFY`. Pair it with {@link withWatch} for
|
|
41
|
+
* the postgres or drizzle-over-pg drivers. Your migration owns the trigger that `pg_notify`s
|
|
42
|
+
* `channel` with the changed key as payload; this only `LISTEN`s.
|
|
43
|
+
*
|
|
44
|
+
* The channel is a parameter: products pass the channel they document (`"xtandard_webhooks"`, …).
|
|
45
|
+
* The neutral default is `"xtandard_kv"`.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { Client } from "pg";
|
|
50
|
+
* const listener = new Client({ connectionString: process.env.DATABASE_URL });
|
|
51
|
+
* await listener.connect();
|
|
52
|
+
* const storage = withWatch(base, pgListenNotify(listener, "xtandard_webhooks"));
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
declare function pgListenNotify(client: PgNotificationClient, channel?: string): WatchSubscribe;
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/storage/util.d.ts
|
|
58
|
+
/**
|
|
59
|
+
* Helpers shared by the storage drivers: identifier validation and literal-prefix escaping for SQL
|
|
60
|
+
* `LIKE … ESCAPE '!'`, SQLite `GLOB`, Redis `MATCH`/`PSUBSCRIBE` globs and regular expressions.
|
|
61
|
+
* The canonical-JSON and equality helpers live in `src/internal/json.ts` and are re-exported from
|
|
62
|
+
* `@xtandard/kit/storage`.
|
|
63
|
+
*
|
|
64
|
+
* @module
|
|
65
|
+
*/
|
|
66
|
+
/** Identifiers the drivers are willing to interpolate into DDL and queries unquoted. */
|
|
67
|
+
declare const SAFE_IDENTIFIER: RegExp;
|
|
68
|
+
/**
|
|
69
|
+
* Throw unless `name` is a safe SQL identifier (`[a-zA-Z_][a-zA-Z0-9_]*`). Returns `name` so it can
|
|
70
|
+
* be used inline. `what` names the identifier in the error (`"table"`, `"column"`, …).
|
|
71
|
+
*/
|
|
72
|
+
declare function assertIdentifier(name: string, what?: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Escape a literal prefix for `LIKE … ESCAPE '!'`. `!` (not `\`) because a backslash inside a string
|
|
75
|
+
* literal is itself an escape on MySQL, which makes `ESCAPE '\'` a syntax error there; `!` means
|
|
76
|
+
* the same on every dialect.
|
|
77
|
+
*/
|
|
78
|
+
declare const escapeLike: (literal: string) => string;
|
|
79
|
+
/**
|
|
80
|
+
* Escape a literal prefix for SQLite `GLOB` (case-sensitive and index-usable, unlike SQLite's
|
|
81
|
+
* `LIKE`, which folds ASCII case). `*`, `?` and `[` are wrapped in a one-character class; `]`
|
|
82
|
+
* outside a class is already literal.
|
|
83
|
+
*/
|
|
84
|
+
declare const escapeGlob: (literal: string) => string;
|
|
85
|
+
/** Escape a literal prefix for a Redis glob (`SCAN … MATCH`, `PSUBSCRIBE`). */
|
|
86
|
+
declare const escapeRedisGlob: (literal: string) => string;
|
|
87
|
+
/** Escape a literal string for embedding in a regular expression. */
|
|
88
|
+
declare const escapeRegex: (literal: string) => string;
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/storage/keys.d.ts
|
|
91
|
+
/**
|
|
92
|
+
* Generic key-layout helpers. Products keep their own layouts (`whk/…`, `aud/…`); these are the
|
|
93
|
+
* pieces every layout reuses:
|
|
94
|
+
*
|
|
95
|
+
* - {@link encodeSegment} / {@link decodeSegment} escape a free-form segment so `/` and `~` cannot
|
|
96
|
+
* break the layout;
|
|
97
|
+
* - {@link lastSegment} reads a key's trailing segment back (decoded);
|
|
98
|
+
* - {@link padMillis} and {@link sortableLeaf} / {@link parseSortableLeaf} build zero-padded
|
|
99
|
+
* `<millis>~<id>` leaves whose lexicographic order is chronological on every backend.
|
|
100
|
+
*
|
|
101
|
+
* @module
|
|
102
|
+
*/
|
|
103
|
+
/**
|
|
104
|
+
* Escape a free-form key segment: `encodeURIComponent`, plus `~` → `%7E` (`~` is the separator of
|
|
105
|
+
* {@link sortableLeaf}).
|
|
106
|
+
*/
|
|
107
|
+
declare const encodeSegment: (segment: string) => string;
|
|
108
|
+
/** Reverse {@link encodeSegment} (also decodes plain `encodeURIComponent` output). */
|
|
109
|
+
declare const decodeSegment: (segment: string) => string;
|
|
110
|
+
/** The trailing `/`-separated segment of `key`, decoded with {@link decodeSegment}. */
|
|
111
|
+
declare const lastSegment: (key: string) => string;
|
|
112
|
+
/**
|
|
113
|
+
* Zero-pad epoch milliseconds (default 13 digits, enough until the year 2286) so the
|
|
114
|
+
* lexicographic order of the strings is the numeric order. Negative values clamp to 0 and
|
|
115
|
+
* fractions are truncated.
|
|
116
|
+
*/
|
|
117
|
+
declare const padMillis: (ms: number, width?: number) => string;
|
|
118
|
+
/**
|
|
119
|
+
* A sortable leaf `<padded millis>~<id>`: listing a prefix and sorting the keys yields them in time
|
|
120
|
+
* order (ties broken by `id`). The `id` is used verbatim, so it must not contain `/`; encode
|
|
121
|
+
* free-form ids with {@link encodeSegment} first.
|
|
122
|
+
*/
|
|
123
|
+
declare const sortableLeaf: (ms: number, id: string, width?: number) => string;
|
|
124
|
+
/**
|
|
125
|
+
* Parse a {@link sortableLeaf} (or a key ending in one) back into `{ ms, id }`. Returns `null` when
|
|
126
|
+
* the trailing segment has no `~`, the millis are not a number, or the id is empty. The id is
|
|
127
|
+
* returned verbatim (not decoded).
|
|
128
|
+
*/
|
|
129
|
+
declare function parseSortableLeaf(keyOrLeaf: string): {
|
|
130
|
+
ms: number;
|
|
131
|
+
id: string;
|
|
132
|
+
} | null;
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/internal/peer.d.ts
|
|
135
|
+
/**
|
|
136
|
+
* Optional-peer helpers shared by every subpath that needs a driver, framework or tool package.
|
|
137
|
+
*
|
|
138
|
+
* @module
|
|
139
|
+
*/
|
|
140
|
+
/**
|
|
141
|
+
* Throw a clear, actionable error for a missing optional peer. The message names the package to
|
|
142
|
+
* install (what the user needs) and the kit subpath that asked for it.
|
|
143
|
+
*/
|
|
144
|
+
declare function requirePeer(name: string, subpath: string): never;
|
|
145
|
+
/**
|
|
146
|
+
* `import(name)` an optional peer, turning a module-not-found error into {@link requirePeer}'s
|
|
147
|
+
* message. Other errors (a broken install, a throwing module) propagate unchanged.
|
|
148
|
+
*/
|
|
149
|
+
declare function importPeer<T>(name: string, subpath: string, load: () => Promise<T>): Promise<T>;
|
|
150
|
+
//#endregion
|
|
151
|
+
export { type CompareAndSwapInput, type CompareAndSwapKvStorage, type JsonObject, type JsonValue, type KvStorage, type PgNotificationClient, SAFE_IDENTIFIER, type StorageChangeEvent, type TransactionalKvStorage, type WatchSubscribe, type WatchableKvStorage, assertIdentifier, canonical, canonicalJson, decodeSegment, deepEqual, encodeSegment, escapeGlob, escapeLike, escapeRedisGlob, escapeRegex, importPeer, isCompareAndSwap, isTransactional, isWatchable, lastSegment, padMillis, parseJsonValue, parseSortableLeaf, pgListenNotify, requirePeer, sortableLeaf, withWatch };
|
|
152
|
+
//# sourceMappingURL=entry-storage.d.cts.map
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { i as canonicalJson, n as JsonValue, o as deepEqual, r as canonical, s as parseJsonValue, t as JsonObject } from "./json-CCyzstIm.mjs";
|
|
2
|
+
import { a as TransactionalKvStorage, c as isTransactional, i as StorageChangeEvent, l as isWatchable, n as CompareAndSwapKvStorage, o as WatchableKvStorage, r as KvStorage, s as isCompareAndSwap, t as CompareAndSwapInput } from "./contract-BvgtswLX.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/storage/watch.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A change source. Called with a `notify` callback: wire your source to invoke it (optionally with
|
|
7
|
+
* the changed key) on every change, and return an unsubscribe function (sync or async).
|
|
8
|
+
*/
|
|
9
|
+
type WatchSubscribe = (notify: (key?: string) => void) => (() => void | Promise<void>) | Promise<() => void | Promise<void>>;
|
|
10
|
+
/**
|
|
11
|
+
* Wrap a storage so it implements {@link WatchableKvStorage} using `subscribe` as the change
|
|
12
|
+
* source. The wrapper delegates every other member to `storage` and only adds `watch`; keys outside
|
|
13
|
+
* the watched `prefix` are filtered out. A notification without a key is delivered as an `update`
|
|
14
|
+
* of the prefix itself (enough to trigger a refresh).
|
|
15
|
+
*
|
|
16
|
+
* The wrapper inherits from `storage` **and** carries every member of `storage` (own, inherited and
|
|
17
|
+
* class methods, bound to `storage`) as an own enumerable property, so `{ ...withWatch(s, sub) }`
|
|
18
|
+
* keeps the methods (the copies' `Object.create`-only wrapper lost them on spread).
|
|
19
|
+
*/
|
|
20
|
+
declare function withWatch<S extends KvStorage>(storage: S, subscribe: WatchSubscribe): S & WatchableKvStorage;
|
|
21
|
+
/**
|
|
22
|
+
* A dedicated notification client for {@link pgListenNotify}, satisfied by a `pg` `Client`. A
|
|
23
|
+
* `Pool` won't do (it rotates connections); use a `Client` you `connect()`.
|
|
24
|
+
*/
|
|
25
|
+
interface PgNotificationClient {
|
|
26
|
+
/** Run a statement (`LISTEN`/`UNLISTEN`). */
|
|
27
|
+
query(sql: string): Promise<unknown>;
|
|
28
|
+
/** Register the notification listener. */
|
|
29
|
+
on(event: "notification", listener: (msg: {
|
|
30
|
+
channel: string;
|
|
31
|
+
payload?: string;
|
|
32
|
+
}) => void): void;
|
|
33
|
+
/** Remove the notification listener. */
|
|
34
|
+
removeListener(event: "notification", listener: (msg: {
|
|
35
|
+
channel: string;
|
|
36
|
+
payload?: string;
|
|
37
|
+
}) => void): void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A {@link WatchSubscribe} backed by Postgres `LISTEN`/`NOTIFY`. Pair it with {@link withWatch} for
|
|
41
|
+
* the postgres or drizzle-over-pg drivers. Your migration owns the trigger that `pg_notify`s
|
|
42
|
+
* `channel` with the changed key as payload; this only `LISTEN`s.
|
|
43
|
+
*
|
|
44
|
+
* The channel is a parameter: products pass the channel they document (`"xtandard_webhooks"`, …).
|
|
45
|
+
* The neutral default is `"xtandard_kv"`.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { Client } from "pg";
|
|
50
|
+
* const listener = new Client({ connectionString: process.env.DATABASE_URL });
|
|
51
|
+
* await listener.connect();
|
|
52
|
+
* const storage = withWatch(base, pgListenNotify(listener, "xtandard_webhooks"));
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
declare function pgListenNotify(client: PgNotificationClient, channel?: string): WatchSubscribe;
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/storage/util.d.ts
|
|
58
|
+
/**
|
|
59
|
+
* Helpers shared by the storage drivers: identifier validation and literal-prefix escaping for SQL
|
|
60
|
+
* `LIKE … ESCAPE '!'`, SQLite `GLOB`, Redis `MATCH`/`PSUBSCRIBE` globs and regular expressions.
|
|
61
|
+
* The canonical-JSON and equality helpers live in `src/internal/json.ts` and are re-exported from
|
|
62
|
+
* `@xtandard/kit/storage`.
|
|
63
|
+
*
|
|
64
|
+
* @module
|
|
65
|
+
*/
|
|
66
|
+
/** Identifiers the drivers are willing to interpolate into DDL and queries unquoted. */
|
|
67
|
+
declare const SAFE_IDENTIFIER: RegExp;
|
|
68
|
+
/**
|
|
69
|
+
* Throw unless `name` is a safe SQL identifier (`[a-zA-Z_][a-zA-Z0-9_]*`). Returns `name` so it can
|
|
70
|
+
* be used inline. `what` names the identifier in the error (`"table"`, `"column"`, …).
|
|
71
|
+
*/
|
|
72
|
+
declare function assertIdentifier(name: string, what?: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Escape a literal prefix for `LIKE … ESCAPE '!'`. `!` (not `\`) because a backslash inside a string
|
|
75
|
+
* literal is itself an escape on MySQL, which makes `ESCAPE '\'` a syntax error there; `!` means
|
|
76
|
+
* the same on every dialect.
|
|
77
|
+
*/
|
|
78
|
+
declare const escapeLike: (literal: string) => string;
|
|
79
|
+
/**
|
|
80
|
+
* Escape a literal prefix for SQLite `GLOB` (case-sensitive and index-usable, unlike SQLite's
|
|
81
|
+
* `LIKE`, which folds ASCII case). `*`, `?` and `[` are wrapped in a one-character class; `]`
|
|
82
|
+
* outside a class is already literal.
|
|
83
|
+
*/
|
|
84
|
+
declare const escapeGlob: (literal: string) => string;
|
|
85
|
+
/** Escape a literal prefix for a Redis glob (`SCAN … MATCH`, `PSUBSCRIBE`). */
|
|
86
|
+
declare const escapeRedisGlob: (literal: string) => string;
|
|
87
|
+
/** Escape a literal string for embedding in a regular expression. */
|
|
88
|
+
declare const escapeRegex: (literal: string) => string;
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/storage/keys.d.ts
|
|
91
|
+
/**
|
|
92
|
+
* Generic key-layout helpers. Products keep their own layouts (`whk/…`, `aud/…`); these are the
|
|
93
|
+
* pieces every layout reuses:
|
|
94
|
+
*
|
|
95
|
+
* - {@link encodeSegment} / {@link decodeSegment} escape a free-form segment so `/` and `~` cannot
|
|
96
|
+
* break the layout;
|
|
97
|
+
* - {@link lastSegment} reads a key's trailing segment back (decoded);
|
|
98
|
+
* - {@link padMillis} and {@link sortableLeaf} / {@link parseSortableLeaf} build zero-padded
|
|
99
|
+
* `<millis>~<id>` leaves whose lexicographic order is chronological on every backend.
|
|
100
|
+
*
|
|
101
|
+
* @module
|
|
102
|
+
*/
|
|
103
|
+
/**
|
|
104
|
+
* Escape a free-form key segment: `encodeURIComponent`, plus `~` → `%7E` (`~` is the separator of
|
|
105
|
+
* {@link sortableLeaf}).
|
|
106
|
+
*/
|
|
107
|
+
declare const encodeSegment: (segment: string) => string;
|
|
108
|
+
/** Reverse {@link encodeSegment} (also decodes plain `encodeURIComponent` output). */
|
|
109
|
+
declare const decodeSegment: (segment: string) => string;
|
|
110
|
+
/** The trailing `/`-separated segment of `key`, decoded with {@link decodeSegment}. */
|
|
111
|
+
declare const lastSegment: (key: string) => string;
|
|
112
|
+
/**
|
|
113
|
+
* Zero-pad epoch milliseconds (default 13 digits, enough until the year 2286) so the
|
|
114
|
+
* lexicographic order of the strings is the numeric order. Negative values clamp to 0 and
|
|
115
|
+
* fractions are truncated.
|
|
116
|
+
*/
|
|
117
|
+
declare const padMillis: (ms: number, width?: number) => string;
|
|
118
|
+
/**
|
|
119
|
+
* A sortable leaf `<padded millis>~<id>`: listing a prefix and sorting the keys yields them in time
|
|
120
|
+
* order (ties broken by `id`). The `id` is used verbatim, so it must not contain `/`; encode
|
|
121
|
+
* free-form ids with {@link encodeSegment} first.
|
|
122
|
+
*/
|
|
123
|
+
declare const sortableLeaf: (ms: number, id: string, width?: number) => string;
|
|
124
|
+
/**
|
|
125
|
+
* Parse a {@link sortableLeaf} (or a key ending in one) back into `{ ms, id }`. Returns `null` when
|
|
126
|
+
* the trailing segment has no `~`, the millis are not a number, or the id is empty. The id is
|
|
127
|
+
* returned verbatim (not decoded).
|
|
128
|
+
*/
|
|
129
|
+
declare function parseSortableLeaf(keyOrLeaf: string): {
|
|
130
|
+
ms: number;
|
|
131
|
+
id: string;
|
|
132
|
+
} | null;
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/internal/peer.d.ts
|
|
135
|
+
/**
|
|
136
|
+
* Optional-peer helpers shared by every subpath that needs a driver, framework or tool package.
|
|
137
|
+
*
|
|
138
|
+
* @module
|
|
139
|
+
*/
|
|
140
|
+
/**
|
|
141
|
+
* Throw a clear, actionable error for a missing optional peer. The message names the package to
|
|
142
|
+
* install (what the user needs) and the kit subpath that asked for it.
|
|
143
|
+
*/
|
|
144
|
+
declare function requirePeer(name: string, subpath: string): never;
|
|
145
|
+
/**
|
|
146
|
+
* `import(name)` an optional peer, turning a module-not-found error into {@link requirePeer}'s
|
|
147
|
+
* message. Other errors (a broken install, a throwing module) propagate unchanged.
|
|
148
|
+
*/
|
|
149
|
+
declare function importPeer<T>(name: string, subpath: string, load: () => Promise<T>): Promise<T>;
|
|
150
|
+
//#endregion
|
|
151
|
+
export { type CompareAndSwapInput, type CompareAndSwapKvStorage, type JsonObject, type JsonValue, type KvStorage, type PgNotificationClient, SAFE_IDENTIFIER, type StorageChangeEvent, type TransactionalKvStorage, type WatchSubscribe, type WatchableKvStorage, assertIdentifier, canonical, canonicalJson, decodeSegment, deepEqual, encodeSegment, escapeGlob, escapeLike, escapeRedisGlob, escapeRegex, importPeer, isCompareAndSwap, isTransactional, isWatchable, lastSegment, padMillis, parseJsonValue, parseSortableLeaf, pgListenNotify, requirePeer, sortableLeaf, withWatch };
|
|
152
|
+
//# sourceMappingURL=entry-storage.d.mts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { r as requirePeer, t as importPeer } from "./peer-CTHMzOdn.mjs";
|
|
2
|
+
import { a as parseSortableLeaf, c as isTransactional, i as padMillis, l as isWatchable, n as encodeSegment, o as sortableLeaf, r as lastSegment, s as isCompareAndSwap, t as decodeSegment } from "./keys-Bwubabk0.mjs";
|
|
3
|
+
import { a as escapeRedisGlob, i as escapeLike, n as assertIdentifier, o as escapeRegex, r as escapeGlob, t as SAFE_IDENTIFIER } from "./util-Dnj5T-yw.mjs";
|
|
4
|
+
import { a as parseJsonValue, i as deepEqual, n as canonicalJson, t as canonical } from "./json-CmM1M5Kz.mjs";
|
|
5
|
+
//#region src/storage/watch.ts
|
|
6
|
+
/**
|
|
7
|
+
* Wrap a storage so it implements {@link WatchableKvStorage} using `subscribe` as the change
|
|
8
|
+
* source. The wrapper delegates every other member to `storage` and only adds `watch`; keys outside
|
|
9
|
+
* the watched `prefix` are filtered out. A notification without a key is delivered as an `update`
|
|
10
|
+
* of the prefix itself (enough to trigger a refresh).
|
|
11
|
+
*
|
|
12
|
+
* The wrapper inherits from `storage` **and** carries every member of `storage` (own, inherited and
|
|
13
|
+
* class methods, bound to `storage`) as an own enumerable property, so `{ ...withWatch(s, sub) }`
|
|
14
|
+
* keeps the methods (the copies' `Object.create`-only wrapper lost them on spread).
|
|
15
|
+
*/
|
|
16
|
+
function withWatch(storage, subscribe) {
|
|
17
|
+
const watchable = Object.create(storage);
|
|
18
|
+
for (const name of memberNames(storage)) {
|
|
19
|
+
if (name === "watch") continue;
|
|
20
|
+
const value = storage[name];
|
|
21
|
+
Object.defineProperty(watchable, name, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
...typeof value === "function" ? {
|
|
25
|
+
value: value.bind(storage),
|
|
26
|
+
writable: true
|
|
27
|
+
} : {
|
|
28
|
+
get: () => storage[name],
|
|
29
|
+
set: (next) => {
|
|
30
|
+
storage[name] = next;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
Object.defineProperty(watchable, "watch", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true,
|
|
39
|
+
value: (prefix, callback) => {
|
|
40
|
+
const notify = (key) => {
|
|
41
|
+
if (key !== void 0 && key !== "" && !key.startsWith(prefix)) return;
|
|
42
|
+
callback({
|
|
43
|
+
type: "update",
|
|
44
|
+
key: key || prefix
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
return Promise.resolve(subscribe(notify));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return watchable;
|
|
51
|
+
}
|
|
52
|
+
/** Every string-keyed member reachable from `obj`, up to (not including) `Object.prototype`. */
|
|
53
|
+
function memberNames(obj) {
|
|
54
|
+
const names = /* @__PURE__ */ new Set();
|
|
55
|
+
for (let o = obj; o && o !== Object.prototype; o = Object.getPrototypeOf(o)) for (const name of Object.getOwnPropertyNames(o)) if (name !== "constructor") names.add(name);
|
|
56
|
+
return names;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A {@link WatchSubscribe} backed by Postgres `LISTEN`/`NOTIFY`. Pair it with {@link withWatch} for
|
|
60
|
+
* the postgres or drizzle-over-pg drivers. Your migration owns the trigger that `pg_notify`s
|
|
61
|
+
* `channel` with the changed key as payload; this only `LISTEN`s.
|
|
62
|
+
*
|
|
63
|
+
* The channel is a parameter: products pass the channel they document (`"xtandard_webhooks"`, …).
|
|
64
|
+
* The neutral default is `"xtandard_kv"`.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* import { Client } from "pg";
|
|
69
|
+
* const listener = new Client({ connectionString: process.env.DATABASE_URL });
|
|
70
|
+
* await listener.connect();
|
|
71
|
+
* const storage = withWatch(base, pgListenNotify(listener, "xtandard_webhooks"));
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
function pgListenNotify(client, channel = "xtandard_kv") {
|
|
75
|
+
const quoted = `"${channel.replace(/"/g, "\"\"")}"`;
|
|
76
|
+
return async (notify) => {
|
|
77
|
+
const listener = (msg) => {
|
|
78
|
+
if (msg.channel === channel) notify(msg.payload);
|
|
79
|
+
};
|
|
80
|
+
client.on("notification", listener);
|
|
81
|
+
await client.query(`LISTEN ${quoted}`);
|
|
82
|
+
return async () => {
|
|
83
|
+
client.removeListener("notification", listener);
|
|
84
|
+
await client.query(`UNLISTEN ${quoted}`);
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { SAFE_IDENTIFIER, assertIdentifier, canonical, canonicalJson, decodeSegment, deepEqual, encodeSegment, escapeGlob, escapeLike, escapeRedisGlob, escapeRegex, importPeer, isCompareAndSwap, isTransactional, isWatchable, lastSegment, padMillis, parseJsonValue, parseSortableLeaf, pgListenNotify, requirePeer, sortableLeaf, withWatch };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=entry-storage.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-storage.mjs","names":[],"sources":["../src/storage/watch.ts"],"sourcesContent":["/**\n * Composable change notifications. `watch` is orthogonal to which storage you use, so instead of\n * baking it into each driver, {@link withWatch} wraps *any* {@link KvStorage} with a\n * {@link WatchSubscribe} source you provide: Postgres `LISTEN`/`NOTIFY` ({@link pgListenNotify}),\n * Redis pub/sub, an ORM after-write hook, a websocket, an `EventEmitter`…\n *\n * @example\n * ```ts\n * import { pgListenNotify, withWatch } from \"@xtandard/kit/storage\";\n * import { createDrizzleStorage } from \"@xtandard/kit/storage/drizzle\";\n *\n * const storage = withWatch(createDrizzleStorage({ db, table }), pgListenNotify(listener, \"my_channel\"));\n * ```\n *\n * @module\n */\n\nimport type { KvStorage, StorageChangeEvent, WatchableKvStorage } from \"./contract.ts\";\n\n/**\n * A change source. Called with a `notify` callback: wire your source to invoke it (optionally with\n * the changed key) on every change, and return an unsubscribe function (sync or async).\n */\nexport type WatchSubscribe = (\n notify: (key?: string) => void,\n) => (() => void | Promise<void>) | Promise<() => void | Promise<void>>;\n\n/**\n * Wrap a storage so it implements {@link WatchableKvStorage} using `subscribe` as the change\n * source. The wrapper delegates every other member to `storage` and only adds `watch`; keys outside\n * the watched `prefix` are filtered out. A notification without a key is delivered as an `update`\n * of the prefix itself (enough to trigger a refresh).\n *\n * The wrapper inherits from `storage` **and** carries every member of `storage` (own, inherited and\n * class methods, bound to `storage`) as an own enumerable property, so `{ ...withWatch(s, sub) }`\n * keeps the methods (the copies' `Object.create`-only wrapper lost them on spread).\n */\nexport function withWatch<S extends KvStorage>(\n storage: S,\n subscribe: WatchSubscribe,\n): S & WatchableKvStorage {\n const watchable = Object.create(storage) as S & WatchableKvStorage;\n for (const name of memberNames(storage)) {\n if (name === \"watch\") continue;\n const value = (storage as Record<string, unknown>)[name];\n Object.defineProperty(watchable, name, {\n enumerable: true,\n configurable: true,\n ...(typeof value === \"function\"\n ? { value: (value as (...args: unknown[]) => unknown).bind(storage), writable: true }\n : {\n get: () => (storage as Record<string, unknown>)[name],\n set: (next: unknown) => {\n (storage as Record<string, unknown>)[name] = next;\n },\n }),\n });\n }\n Object.defineProperty(watchable, \"watch\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: (prefix: string, callback: (event: StorageChangeEvent) => void) => {\n const notify = (key?: string): void => {\n if (key !== undefined && key !== \"\" && !key.startsWith(prefix)) return;\n callback({ type: \"update\", key: key || prefix });\n };\n return Promise.resolve(subscribe(notify));\n },\n });\n return watchable;\n}\n\n/** Every string-keyed member reachable from `obj`, up to (not including) `Object.prototype`. */\nfunction memberNames(obj: object): Set<string> {\n const names = new Set<string>();\n for (let o: object | null = obj; o && o !== Object.prototype; o = Object.getPrototypeOf(o)) {\n for (const name of Object.getOwnPropertyNames(o)) if (name !== \"constructor\") names.add(name);\n }\n return names;\n}\n\n/**\n * A dedicated notification client for {@link pgListenNotify}, satisfied by a `pg` `Client`. A\n * `Pool` won't do (it rotates connections); use a `Client` you `connect()`.\n */\nexport interface PgNotificationClient {\n /** Run a statement (`LISTEN`/`UNLISTEN`). */\n query(sql: string): Promise<unknown>;\n /** Register the notification listener. */\n on(event: \"notification\", listener: (msg: { channel: string; payload?: string }) => void): void;\n /** Remove the notification listener. */\n removeListener(\n event: \"notification\",\n listener: (msg: { channel: string; payload?: string }) => void,\n ): void;\n}\n\n/**\n * A {@link WatchSubscribe} backed by Postgres `LISTEN`/`NOTIFY`. Pair it with {@link withWatch} for\n * the postgres or drizzle-over-pg drivers. Your migration owns the trigger that `pg_notify`s\n * `channel` with the changed key as payload; this only `LISTEN`s.\n *\n * The channel is a parameter: products pass the channel they document (`\"xtandard_webhooks\"`, …).\n * The neutral default is `\"xtandard_kv\"`.\n *\n * @example\n * ```ts\n * import { Client } from \"pg\";\n * const listener = new Client({ connectionString: process.env.DATABASE_URL });\n * await listener.connect();\n * const storage = withWatch(base, pgListenNotify(listener, \"xtandard_webhooks\"));\n * ```\n */\nexport function pgListenNotify(\n client: PgNotificationClient,\n channel = \"xtandard_kv\",\n): WatchSubscribe {\n const quoted = `\"${channel.replace(/\"/g, '\"\"')}\"`;\n return async (notify) => {\n const listener = (msg: { channel: string; payload?: string }): void => {\n if (msg.channel === channel) notify(msg.payload);\n };\n client.on(\"notification\", listener);\n await client.query(`LISTEN ${quoted}`);\n return async () => {\n client.removeListener(\"notification\", listener);\n await client.query(`UNLISTEN ${quoted}`);\n };\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqCA,SAAgB,UACd,SACA,WACwB;CACxB,MAAM,YAAY,OAAO,OAAO,OAAO;CACvC,KAAK,MAAM,QAAQ,YAAY,OAAO,GAAG;EACvC,IAAI,SAAS,SAAS;EACtB,MAAM,QAAS,QAAoC;EACnD,OAAO,eAAe,WAAW,MAAM;GACrC,YAAY;GACZ,cAAc;GACd,GAAI,OAAO,UAAU,aACjB;IAAE,OAAQ,MAA0C,KAAK,OAAO;IAAG,UAAU;GAAK,IAClF;IACE,WAAY,QAAoC;IAChD,MAAM,SAAkB;KACtB,QAAqC,QAAQ;IAC/C;GACF;EACN,CAAC;CACH;CACA,OAAO,eAAe,WAAW,SAAS;EACxC,YAAY;EACZ,cAAc;EACd,UAAU;EACV,QAAQ,QAAgB,aAAkD;GACxE,MAAM,UAAU,QAAuB;IACrC,IAAI,QAAQ,KAAA,KAAa,QAAQ,MAAM,CAAC,IAAI,WAAW,MAAM,GAAG;IAChE,SAAS;KAAE,MAAM;KAAU,KAAK,OAAO;IAAO,CAAC;GACjD;GACA,OAAO,QAAQ,QAAQ,UAAU,MAAM,CAAC;EAC1C;CACF,CAAC;CACD,OAAO;AACT;;AAGA,SAAS,YAAY,KAA0B;CAC7C,MAAM,wBAAQ,IAAI,IAAY;CAC9B,KAAK,IAAI,IAAmB,KAAK,KAAK,MAAM,OAAO,WAAW,IAAI,OAAO,eAAe,CAAC,GACvF,KAAK,MAAM,QAAQ,OAAO,oBAAoB,CAAC,GAAG,IAAI,SAAS,eAAe,MAAM,IAAI,IAAI;CAE9F,OAAO;AACT;;;;;;;;;;;;;;;;;AAkCA,SAAgB,eACd,QACA,UAAU,eACM;CAChB,MAAM,SAAS,IAAI,QAAQ,QAAQ,MAAM,MAAI,EAAE;CAC/C,OAAO,OAAO,WAAW;EACvB,MAAM,YAAY,QAAqD;GACrE,IAAI,IAAI,YAAY,SAAS,OAAO,IAAI,OAAO;EACjD;EACA,OAAO,GAAG,gBAAgB,QAAQ;EAClC,MAAM,OAAO,MAAM,UAAU,QAAQ;EACrC,OAAO,YAAY;GACjB,OAAO,eAAe,gBAAgB,QAAQ;GAC9C,MAAM,OAAO,MAAM,YAAY,QAAQ;EACzC;CACF;AACF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_duration = require("./duration-DVA0Fzkx.cjs");
|
|
3
|
+
//#region src/testing/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Generic test helpers: a controllable clock and a collecting sink. The
|
|
6
|
+
* products build their own fixtures (`createTestWebhooks`, `createTestAudit`…)
|
|
7
|
+
* on top.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
const toMs = (at) => {
|
|
12
|
+
const ms = typeof at === "string" ? Date.parse(at) : at;
|
|
13
|
+
if (!Number.isFinite(ms)) throw new TypeError(`TestClock: invalid time ${String(at)}`);
|
|
14
|
+
return ms;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Create a {@link TestClock} starting at `start` (default: real now).
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const clock = createTestClock("2026-01-01T00:00:00Z");
|
|
22
|
+
* clock.advance("1h");
|
|
23
|
+
* clock.iso(); // "2026-01-01T01:00:00.000Z"
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
function createTestClock(start = Date.now()) {
|
|
27
|
+
let t = toMs(start);
|
|
28
|
+
return {
|
|
29
|
+
now: () => t,
|
|
30
|
+
set: (at) => {
|
|
31
|
+
t = toMs(at);
|
|
32
|
+
},
|
|
33
|
+
advance: (by) => {
|
|
34
|
+
t += require_duration.durationToMs(by);
|
|
35
|
+
},
|
|
36
|
+
iso: () => new Date(t).toISOString()
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create a {@link CollectingSink}.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const sink = collectingSink<AuditEvent>();
|
|
45
|
+
* const stream = { kind: "collecting", send: (batch) => sink.push(...batch.events) };
|
|
46
|
+
* sink.failNext(2); // the next two sends reject
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
function collectingSink(options = {}) {
|
|
50
|
+
const items = [];
|
|
51
|
+
let failures = {
|
|
52
|
+
remaining: 0,
|
|
53
|
+
error: /* @__PURE__ */ new Error()
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
items,
|
|
57
|
+
async push(...received) {
|
|
58
|
+
if (failures.remaining > 0) {
|
|
59
|
+
failures.remaining--;
|
|
60
|
+
throw failures.error;
|
|
61
|
+
}
|
|
62
|
+
for (const item of received) items.push(options.clone ? structuredClone(item) : item);
|
|
63
|
+
},
|
|
64
|
+
failNext(n = 1, error = /* @__PURE__ */ new Error("collectingSink: simulated failure")) {
|
|
65
|
+
failures = {
|
|
66
|
+
remaining: n,
|
|
67
|
+
error
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
clear() {
|
|
71
|
+
items.length = 0;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
exports.collectingSink = collectingSink;
|
|
77
|
+
exports.createTestClock = createTestClock;
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=entry-testing.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-testing.cjs","names":["durationToMs"],"sources":["../src/testing/index.ts"],"sourcesContent":["/**\n * Generic test helpers: a controllable clock and a collecting sink. The\n * products build their own fixtures (`createTestWebhooks`, `createTestAudit`…)\n * on top.\n *\n * @module\n */\n\nimport { durationToMs, type Duration } from \"../util/duration.ts\";\n\n/** A manually driven clock. */\nexport interface TestClock {\n /** Current time (unix ms) — pass `clock.now` as a `now` option. */\n now(): number;\n /** Set the time (ISO string or unix ms). */\n set(at: string | number): void;\n /** Move forward. */\n advance(by: Duration): void;\n /** Current time as ISO. */\n iso(): string;\n}\n\nconst toMs = (at: string | number): number => {\n const ms = typeof at === \"string\" ? Date.parse(at) : at;\n if (!Number.isFinite(ms)) throw new TypeError(`TestClock: invalid time ${String(at)}`);\n return ms;\n};\n\n/**\n * Create a {@link TestClock} starting at `start` (default: real now).\n *\n * @example\n * ```ts\n * const clock = createTestClock(\"2026-01-01T00:00:00Z\");\n * clock.advance(\"1h\");\n * clock.iso(); // \"2026-01-01T01:00:00.000Z\"\n * ```\n */\nexport function createTestClock(start: string | number = Date.now()): TestClock {\n let t = toMs(start);\n return {\n now: () => t,\n set: (at) => {\n t = toMs(at);\n },\n advance: (by) => {\n t += durationToMs(by);\n },\n iso: () => new Date(t).toISOString(),\n };\n}\n\n/** A sink that keeps everything it receives, with programmable failures. */\nexport interface CollectingSink<T> {\n /** Everything received so far, in order. */\n readonly items: T[];\n /** Receive items. Rejects instead while failures are programmed with {@link CollectingSink.failNext}. */\n push(...items: T[]): Promise<void>;\n /** Make the next `n` pushes reject with `error` (to exercise retry paths). */\n failNext(n?: number, error?: Error): void;\n /** Forget everything received. */\n clear(): void;\n}\n\n/** Options for {@link collectingSink}. */\nexport interface CollectingSinkOptions {\n /** Store a `structuredClone` of each item, so later mutation by the caller doesn't show. Default `false`. */\n clone?: boolean;\n}\n\n/**\n * Create a {@link CollectingSink}.\n *\n * @example\n * ```ts\n * const sink = collectingSink<AuditEvent>();\n * const stream = { kind: \"collecting\", send: (batch) => sink.push(...batch.events) };\n * sink.failNext(2); // the next two sends reject\n * ```\n */\nexport function collectingSink<T>(options: CollectingSinkOptions = {}): CollectingSink<T> {\n const items: T[] = [];\n let failures = { remaining: 0, error: new Error() };\n return {\n items,\n async push(...received) {\n if (failures.remaining > 0) {\n failures.remaining--;\n throw failures.error;\n }\n for (const item of received) items.push(options.clone ? structuredClone(item) : item);\n },\n failNext(n = 1, error = new Error(\"collectingSink: simulated failure\")) {\n failures = { remaining: n, error };\n },\n clear() {\n items.length = 0;\n },\n };\n}\n"],"mappings":";;;;;;;;;;AAsBA,MAAM,QAAQ,OAAgC;CAC5C,MAAM,KAAK,OAAO,OAAO,WAAW,KAAK,MAAM,EAAE,IAAI;CACrD,IAAI,CAAC,OAAO,SAAS,EAAE,GAAG,MAAM,IAAI,UAAU,2BAA2B,OAAO,EAAE,GAAG;CACrF,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,gBAAgB,QAAyB,KAAK,IAAI,GAAc;CAC9E,IAAI,IAAI,KAAK,KAAK;CAClB,OAAO;EACL,WAAW;EACX,MAAM,OAAO;GACX,IAAI,KAAK,EAAE;EACb;EACA,UAAU,OAAO;GACf,KAAKA,iBAAAA,aAAa,EAAE;EACtB;EACA,WAAW,IAAI,KAAK,CAAC,EAAE,YAAY;CACrC;AACF;;;;;;;;;;;AA8BA,SAAgB,eAAkB,UAAiC,CAAC,GAAsB;CACxF,MAAM,QAAa,CAAC;CACpB,IAAI,WAAW;EAAE,WAAW;EAAG,uBAAO,IAAI,MAAM;CAAE;CAClD,OAAO;EACL;EACA,MAAM,KAAK,GAAG,UAAU;GACtB,IAAI,SAAS,YAAY,GAAG;IAC1B,SAAS;IACT,MAAM,SAAS;GACjB;GACA,KAAK,MAAM,QAAQ,UAAU,MAAM,KAAK,QAAQ,QAAQ,gBAAgB,IAAI,IAAI,IAAI;EACtF;EACA,SAAS,IAAI,GAAG,wBAAQ,IAAI,MAAM,mCAAmC,GAAG;GACtE,WAAW;IAAE,WAAW;IAAG;GAAM;EACnC;EACA,QAAQ;GACN,MAAM,SAAS;EACjB;CACF;AACF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { t as Duration } from "./duration-FPwbmWIU.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/testing/index.d.ts
|
|
4
|
+
/** A manually driven clock. */
|
|
5
|
+
interface TestClock {
|
|
6
|
+
/** Current time (unix ms) — pass `clock.now` as a `now` option. */
|
|
7
|
+
now(): number;
|
|
8
|
+
/** Set the time (ISO string or unix ms). */
|
|
9
|
+
set(at: string | number): void;
|
|
10
|
+
/** Move forward. */
|
|
11
|
+
advance(by: Duration): void;
|
|
12
|
+
/** Current time as ISO. */
|
|
13
|
+
iso(): string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a {@link TestClock} starting at `start` (default: real now).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const clock = createTestClock("2026-01-01T00:00:00Z");
|
|
21
|
+
* clock.advance("1h");
|
|
22
|
+
* clock.iso(); // "2026-01-01T01:00:00.000Z"
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function createTestClock(start?: string | number): TestClock;
|
|
26
|
+
/** A sink that keeps everything it receives, with programmable failures. */
|
|
27
|
+
interface CollectingSink<T> {
|
|
28
|
+
/** Everything received so far, in order. */
|
|
29
|
+
readonly items: T[];
|
|
30
|
+
/** Receive items. Rejects instead while failures are programmed with {@link CollectingSink.failNext}. */
|
|
31
|
+
push(...items: T[]): Promise<void>;
|
|
32
|
+
/** Make the next `n` pushes reject with `error` (to exercise retry paths). */
|
|
33
|
+
failNext(n?: number, error?: Error): void;
|
|
34
|
+
/** Forget everything received. */
|
|
35
|
+
clear(): void;
|
|
36
|
+
}
|
|
37
|
+
/** Options for {@link collectingSink}. */
|
|
38
|
+
interface CollectingSinkOptions {
|
|
39
|
+
/** Store a `structuredClone` of each item, so later mutation by the caller doesn't show. Default `false`. */
|
|
40
|
+
clone?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a {@link CollectingSink}.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const sink = collectingSink<AuditEvent>();
|
|
48
|
+
* const stream = { kind: "collecting", send: (batch) => sink.push(...batch.events) };
|
|
49
|
+
* sink.failNext(2); // the next two sends reject
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
declare function collectingSink<T>(options?: CollectingSinkOptions): CollectingSink<T>;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { type CollectingSink, type CollectingSinkOptions, type TestClock, collectingSink, createTestClock };
|
|
55
|
+
//# sourceMappingURL=entry-testing.d.cts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { t as Duration } from "./duration-FPwbmWIU.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/testing/index.d.ts
|
|
4
|
+
/** A manually driven clock. */
|
|
5
|
+
interface TestClock {
|
|
6
|
+
/** Current time (unix ms) — pass `clock.now` as a `now` option. */
|
|
7
|
+
now(): number;
|
|
8
|
+
/** Set the time (ISO string or unix ms). */
|
|
9
|
+
set(at: string | number): void;
|
|
10
|
+
/** Move forward. */
|
|
11
|
+
advance(by: Duration): void;
|
|
12
|
+
/** Current time as ISO. */
|
|
13
|
+
iso(): string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a {@link TestClock} starting at `start` (default: real now).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const clock = createTestClock("2026-01-01T00:00:00Z");
|
|
21
|
+
* clock.advance("1h");
|
|
22
|
+
* clock.iso(); // "2026-01-01T01:00:00.000Z"
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function createTestClock(start?: string | number): TestClock;
|
|
26
|
+
/** A sink that keeps everything it receives, with programmable failures. */
|
|
27
|
+
interface CollectingSink<T> {
|
|
28
|
+
/** Everything received so far, in order. */
|
|
29
|
+
readonly items: T[];
|
|
30
|
+
/** Receive items. Rejects instead while failures are programmed with {@link CollectingSink.failNext}. */
|
|
31
|
+
push(...items: T[]): Promise<void>;
|
|
32
|
+
/** Make the next `n` pushes reject with `error` (to exercise retry paths). */
|
|
33
|
+
failNext(n?: number, error?: Error): void;
|
|
34
|
+
/** Forget everything received. */
|
|
35
|
+
clear(): void;
|
|
36
|
+
}
|
|
37
|
+
/** Options for {@link collectingSink}. */
|
|
38
|
+
interface CollectingSinkOptions {
|
|
39
|
+
/** Store a `structuredClone` of each item, so later mutation by the caller doesn't show. Default `false`. */
|
|
40
|
+
clone?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a {@link CollectingSink}.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const sink = collectingSink<AuditEvent>();
|
|
48
|
+
* const stream = { kind: "collecting", send: (batch) => sink.push(...batch.events) };
|
|
49
|
+
* sink.failNext(2); // the next two sends reject
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
declare function collectingSink<T>(options?: CollectingSinkOptions): CollectingSink<T>;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { type CollectingSink, type CollectingSinkOptions, type TestClock, collectingSink, createTestClock };
|
|
55
|
+
//# sourceMappingURL=entry-testing.d.mts.map
|