@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 @@
|
|
|
1
|
+
{"version":3,"file":"entry-storage-testing.cjs","names":["isCompareAndSwap","isWatchable","sortableLeaf"],"sources":["../src/storage/testing/conformance.ts","../src/storage/testing/fake-redis.ts"],"sourcesContent":["/**\n * The shared storage conformance suite (ADR 0006). The test API is injected, so the suite runs under\n * vitest, `bun:test` or anything with the same `describe` / `test` / `expect` shape; nothing here\n * imports a test runner.\n *\n * The cases are the union of the products' suites plus the regression cases for every storage fix\n * the kit carries (empty segments, `$` / `#` / unicode keys, many keys, SCAN duplicates, `PSUBSCRIBE`\n * with glob characters, concurrent CAS, `{}` vs `[]`, legacy non-canonical values).\n *\n * @module\n */\n\nimport {\n isCompareAndSwap,\n isWatchable,\n type CompareAndSwapKvStorage,\n type KvStorage,\n type StorageChangeEvent,\n type WatchableKvStorage,\n} from \"../contract.ts\";\nimport { sortableLeaf } from \"../keys.ts\";\n\n/** The matchers the suite uses. vitest's and `bun:test`'s `expect` both satisfy it. */\nexport interface ConformanceMatchers {\n /** `Object.is` equality. */\n toBe(expected: unknown): void;\n /** Deep equality. */\n toEqual(expected: unknown): void;\n /** `=== null`. */\n toBeNull(): void;\n}\n\n/** The injected test API: pass `{ describe, test, expect }` from your runner. */\nexport interface ConformanceTestApi {\n /** Group tests. */\n describe(name: string, fn: () => void): void;\n /** Register one test (the third argument is the timeout in ms). */\n test(name: string, fn: () => Promise<void>, timeout?: number): void;\n /** Make an assertion. */\n expect(actual: unknown): ConformanceMatchers;\n}\n\n/** A factory producing a fresh, **empty** storage (or an empty namespace of one) for each test. */\nexport type MakeStorage = () => KvStorage | Promise<KvStorage>;\n\n/**\n * Write a value in a legacy, non-canonical stored form, bypassing the driver (e.g. a raw SQL\n * `INSERT` of `json` text with unsorted keys, a Mongo document with fields in insertion order).\n * Enables the legacy-value CAS case (ADR 0005).\n */\nexport type SeedLegacy = (storage: KvStorage, key: string, rawJson: string) => Promise<void>;\n\n/**\n * The optional capabilities the driver under test implements. Declare each one: a capability case\n * checks the declaration against the storage itself, so a driver that implements `compareAndSwap`\n * or `watch` without declaring it (or declares one it lacks) fails instead of silently skipping\n * cases. Pass `false` for a capability the driver doesn't have.\n */\nexport interface ConformanceCapabilities {\n /** Run the compare-and-swap cases (the storage must implement `compareAndSwap`). */\n compareAndSwap?: boolean;\n /**\n * Run the watch cases (the storage must implement `watch`). `settleMs` is how long to wait for\n * notifications to arrive (default 50 ms). `removals: false` is for watchers that report every\n * change as `update` (a {@link withWatch} storage, whose notifier gives only a key): a removal must\n * then still produce an event, of any type. Default `true`.\n */\n watch?: boolean | { settleMs?: number; removals?: boolean };\n}\n\n/** Options for {@link runStorageConformance}. */\nexport interface ConformanceOptions {\n /** The injected test API. */\n t: ConformanceTestApi;\n /** Capabilities to exercise. */\n capabilities?: ConformanceCapabilities;\n /** First segment of every key the suite writes (products pass their root, e.g. `\"whk\"`). Default `\"kit\"`. */\n keyRoot?: string;\n /** Per-test timeout in ms (live backends may need more than the runner default). */\n timeout?: number;\n /** Enables the legacy-value CAS case; see {@link SeedLegacy}. */\n seedLegacy?: SeedLegacy;\n}\n\n/** What a {@link ConformanceCase} receives. */\nexport interface ConformanceContext {\n /** A fresh storage from the factory. */\n storage: KvStorage;\n /** Build a key under the suite's root: `key(\"a\", \"b\")` → `\"<root>/a/b\"`. */\n key(...segments: string[]): string;\n /** The injected `expect`. */\n expect: ConformanceTestApi[\"expect\"];\n /** Wait for `ms` (watch notifications, eventual consistency). */\n settle(ms: number): Promise<void>;\n /** The options the suite runs with. */\n options: ConformanceOptions;\n}\n\n/** One named case. Products register extra suites as lists of these. */\nexport interface ConformanceCase {\n /** Test name. */\n name: string;\n /** The test body. */\n run(ctx: ConformanceContext): Promise<void>;\n}\n\n/** Resolve after `ms` milliseconds. */\nexport const settle = (ms: number): Promise<void> => new Promise((r) => setTimeout(r, ms));\n\n/** Narrow to {@link CompareAndSwapKvStorage} or throw a clear error. */\nexport function requireCompareAndSwap(storage: KvStorage): CompareAndSwapKvStorage {\n if (!isCompareAndSwap(storage)) throw new Error(\"storage has no compareAndSwap capability\");\n return storage;\n}\n\n/** Narrow to {@link WatchableKvStorage} or throw a clear error. */\nexport function requireWatchable(storage: KvStorage): WatchableKvStorage {\n if (!isWatchable(storage)) throw new Error(\"storage has no watch capability\");\n return storage;\n}\n\nconst sorted = (keys: string[]): string[] => [...keys].sort();\n\n/**\n * Register `describe(title, …)` with one test per case. Each test gets a fresh storage from `make`.\n * This is how products register their own extra suites next to {@link runStorageConformance}.\n */\nexport function runConformanceCases(\n title: string,\n cases: ConformanceCase[],\n make: MakeStorage,\n options: ConformanceOptions,\n): void {\n const { t, keyRoot = \"kit\", timeout } = options;\n t.describe(title, () => {\n for (const c of cases) {\n t.test(\n c.name,\n async () => {\n const storage = await make();\n try {\n await c.run({\n storage,\n key: (...segments) => [keyRoot, ...segments].join(\"/\"),\n expect: t.expect,\n settle,\n options,\n });\n } finally {\n await (storage as { close?: () => unknown }).close?.();\n }\n },\n timeout,\n );\n }\n });\n}\n\n/** The base-contract cases every driver must pass. */\nexport const contractCases: ConformanceCase[] = [\n {\n name: \"returns null for a missing key\",\n async run({ storage, key, expect }) {\n expect(await storage.getItem(key(\"missing\"))).toBeNull();\n },\n },\n {\n name: \"round-trips objects, arrays, primitives and empty containers\",\n async run({ storage, key, expect }) {\n const values: Record<string, unknown> = {\n object: { url: \"https://x.example/a?b=1\", tags: [\"a\", \"b\"], nested: { x: 1, y: null } },\n array: [\"a\", { b: [1, 2] }],\n string: \"hello\",\n number: 42.5,\n zero: 0,\n boolTrue: true,\n boolFalse: false,\n emptyObject: {},\n emptyArray: [],\n };\n for (const [k, v] of Object.entries(values)) await storage.setItem(key(\"v\", k), v);\n for (const [k, v] of Object.entries(values))\n expect(await storage.getItem(key(\"v\", k))).toEqual(v);\n expect(Array.isArray(await storage.getItem(key(\"v\", \"emptyArray\")))).toBe(true);\n expect(Array.isArray(await storage.getItem(key(\"v\", \"emptyObject\")))).toBe(false);\n },\n },\n {\n name: \"strings that look like JSON stay strings\",\n async run({ storage, key, expect }) {\n const values = [\"123\", \"true\", \"null\", '{\"a\":1}', '\"quoted\"', \"[1]\", \"\"];\n for (const [i, v] of values.entries()) await storage.setItem(key(\"str\", String(i)), v);\n for (const [i, v] of values.entries())\n expect(await storage.getItem(key(\"str\", String(i)))).toBe(v);\n },\n },\n {\n name: \"overwrites an existing key\",\n async run({ storage, key, expect }) {\n await storage.setItem(key(\"k\"), { v: 1 });\n await storage.setItem(key(\"k\"), { v: 2 });\n expect(await storage.getItem(key(\"k\"))).toEqual({ v: 2 });\n },\n },\n {\n name: \"removeItem deletes a key; removing a missing key is a no-op\",\n async run({ storage, key, expect }) {\n await storage.setItem(key(\"k\"), { v: 1 });\n await storage.removeItem(key(\"k\"));\n expect(await storage.getItem(key(\"k\"))).toBeNull();\n expect(await storage.getKeys(key(\"\"))).toEqual([]);\n expect(await storage.removeItem(key(\"nope\"))).toBe(undefined);\n },\n },\n {\n name: \"getKeys lists nested keys under a prefix, isolated from sibling prefixes\",\n async run({ storage, key, expect }) {\n await storage.setItem(key(\"app1\", \"a\"), 1);\n await storage.setItem(key(\"app1\", \"deep\", \"b\"), 2);\n await storage.setItem(key(\"app10\", \"c\"), 3);\n expect(sorted(await storage.getKeys(key(\"app1\", \"\")))).toEqual(\n sorted([key(\"app1\", \"a\"), key(\"app1\", \"deep\", \"b\")]),\n );\n expect(await storage.getKeys(key(\"app10\", \"\"))).toEqual([key(\"app10\", \"c\")]);\n expect(sorted(await storage.getKeys(key(\"app1\")))).toEqual(\n sorted([key(\"app1\", \"a\"), key(\"app1\", \"deep\", \"b\"), key(\"app10\", \"c\")]),\n );\n expect(await storage.getKeys(key(\"nothing\", \"\"))).toEqual([]);\n },\n },\n {\n name: \"keys are case- and accent-sensitive (no collation folding)\",\n async run({ storage, key, expect }) {\n await storage.setItem(key(\"t\", \"Acme\", \"x\"), { v: \"upper\" });\n await storage.setItem(key(\"t\", \"acme\", \"x\"), { v: \"lower\" });\n await storage.setItem(key(\"t\", \"acmé\", \"x\"), { v: \"accent\" });\n expect(await storage.getItem(key(\"t\", \"Acme\", \"x\"))).toEqual({ v: \"upper\" });\n expect(await storage.getItem(key(\"t\", \"acme\", \"x\"))).toEqual({ v: \"lower\" });\n expect(await storage.getItem(key(\"t\", \"acmé\", \"x\"))).toEqual({ v: \"accent\" });\n expect(await storage.getItem(key(\"t\", \"ACME\", \"x\"))).toBeNull();\n expect(await storage.getKeys(key(\"t\", \"Acme\", \"\"))).toEqual([key(\"t\", \"Acme\", \"x\")]);\n expect(await storage.getKeys(key(\"t\", \"acme\", \"\"))).toEqual([key(\"t\", \"acme\", \"x\")]);\n expect(await storage.getKeys(key(\"t\", \"A\"))).toEqual([key(\"t\", \"Acme\", \"x\")]);\n await storage.removeItem(key(\"t\", \"ACME\", \"x\"));\n expect(await storage.getItem(key(\"t\", \"Acme\", \"x\"))).toEqual({ v: \"upper\" });\n },\n },\n {\n name: \"case-distinct tenants are isolated\",\n async run({ storage, key, expect }) {\n for (const tenant of [\"Acme\", \"acme\", \"ACME\"]) {\n await storage.setItem(key(\"tenant\", tenant, \"item\"), { tenant });\n await storage.setItem(key(\"tenants\", tenant), tenant);\n }\n for (const tenant of [\"Acme\", \"acme\", \"ACME\"]) {\n expect(await storage.getItem(key(\"tenant\", tenant, \"item\"))).toEqual({ tenant });\n expect(await storage.getKeys(key(\"tenant\", tenant, \"\"))).toEqual([\n key(\"tenant\", tenant, \"item\"),\n ]);\n }\n expect(sorted(await storage.getKeys(key(\"tenants\", \"\")))).toEqual(\n sorted([\"Acme\", \"acme\", \"ACME\"].map((t) => key(\"tenants\", t))),\n );\n },\n },\n {\n name: \"LIKE / GLOB / Redis-glob / unstorage metacharacters in keys and prefixes are literal\",\n async run({ storage, key, expect }) {\n const specials = [\"%\", \"_\", \"!\", \"\\\\\", \"*\", \"?\", \"[\", \"]\", \":\", \"%25\", \"#\", \"$\", \"[x]\"];\n const keys = specials.map((c) => key(`x${c}y`, \"a\"));\n keys.push(key(\"xzy\", \"a\"), key(\"xay\", \"a\"), key(\"x\", \"y\", \"a\"), key(\"xy\", \"a\"));\n for (const k of keys) await storage.setItem(k, { k });\n for (const k of keys) expect(await storage.getItem(k)).toEqual({ k });\n for (const c of specials) {\n expect(sorted(await storage.getKeys(key(`x${c}y`, \"\")))).toEqual(\n keys.filter((k) => k.startsWith(key(`x${c}y`, \"\"))),\n );\n // A plain prefix ending mid-segment, right after the metacharacter.\n expect(sorted(await storage.getKeys(key(`x${c}`)))).toEqual(\n sorted(keys.filter((k) => k.startsWith(key(`x${c}`)))),\n );\n }\n expect(sorted(await storage.getKeys(key(\"x\")))).toEqual(sorted(keys));\n },\n },\n {\n name: \"keys with ? \\\\ ] : # % %25 stay distinct (no normalization)\",\n async run({ storage, key, expect }) {\n const keys = [\"a?b\", \"ab\", \"a\\\\b\", \"a:b\", \"a]b\", \"a#b\", \"a%b\", \"a%25b\", \"a/b\"].map((s) =>\n key(\"s\", s),\n );\n for (const [i, k] of keys.entries()) await storage.setItem(k, { i });\n for (const [i, k] of keys.entries()) expect(await storage.getItem(k)).toEqual({ i });\n expect(sorted(await storage.getKeys(key(\"s\", \"\")))).toEqual(sorted(keys));\n expect(await storage.getKeys(key(\"s\", \"a?\"))).toEqual([key(\"s\", \"a?b\")]);\n expect(await storage.getKeys(key(\"s\", \"a%25\"))).toEqual([key(\"s\", \"a%25b\")]);\n expect(await storage.getItem(key(\"s\", \"a%b\"))).toEqual({ i: 6 });\n },\n },\n {\n name: \"keys with $ (trailing, inner, alone) round-trip and are listed\",\n async run({ storage, key, expect }) {\n const keys = [\n key(\"d\", \"end$\"),\n key(\"d\", \"a$b\"),\n key(\"d\", \"$\"),\n key(\"d$\", \"x\"),\n key(\"d\", \"$$\"),\n ];\n for (const [i, k] of keys.entries()) await storage.setItem(k, i);\n for (const [i, k] of keys.entries()) expect(await storage.getItem(k)).toBe(i);\n expect(sorted(await storage.getKeys(key(\"d\")))).toEqual(sorted(keys));\n expect(await storage.getKeys(key(\"d$\", \"\"))).toEqual([key(\"d$\", \"x\")]);\n await storage.removeItem(key(\"d\", \"end$\"));\n expect(await storage.getItem(key(\"d\", \"end$\"))).toBeNull();\n },\n },\n {\n name: \"keys differing only by trailing spaces stay distinct\",\n async run({ storage, key, expect }) {\n const keys = [key(\"sp\", \"a\"), key(\"sp\", \"a \"), key(\"sp\", \"a \"), key(\"sp\", \"a\", \" \")];\n for (const [i, k] of keys.entries()) await storage.setItem(k, { i });\n for (const [i, k] of keys.entries()) expect(await storage.getItem(k)).toEqual({ i });\n expect(sorted(await storage.getKeys(key(\"sp\", \"\")))).toEqual(sorted(keys));\n expect(sorted(await storage.getKeys(key(\"sp\", \"a \")))).toEqual(\n sorted([key(\"sp\", \"a \"), key(\"sp\", \"a \")]),\n );\n await storage.removeItem(key(\"sp\", \"a \"));\n expect(await storage.getItem(key(\"sp\", \"a\"))).toEqual({ i: 0 });\n expect(await storage.getItem(key(\"sp\", \"a \"))).toBeNull();\n },\n },\n {\n name: \"unicode keys (emoji, CJK, NFC ≠ NFD) round-trip and stay distinct\",\n async run({ storage, key, expect }) {\n const nfc = \"café\";\n const nfd = \"café\";\n const keys = [\n key(\"u\", \"🚀\"),\n key(\"u\", \"日本語\"),\n key(\"u\", nfc),\n key(\"u\", nfd),\n key(\"u\", \"cafe\"),\n ];\n for (const [i, k] of keys.entries()) await storage.setItem(k, { i });\n for (const [i, k] of keys.entries()) expect(await storage.getItem(k)).toEqual({ i });\n expect(sorted(await storage.getKeys(key(\"u\", \"\")))).toEqual(sorted(keys));\n expect(await storage.getKeys(key(\"u\", \"日\"))).toEqual([key(\"u\", \"日本語\")]);\n },\n },\n {\n name: \"empty key segments are distinct keys (a//b ≠ a/b, trailing /)\",\n async run({ storage, key, expect }) {\n const keys = [\n key(\"e\", \"\", \"b\"),\n key(\"e\", \"b\"),\n key(\"e\", \"\"),\n key(\"e\", \"x\", \"\"),\n key(\"e\", \"x\"),\n ];\n for (const [i, k] of keys.entries()) await storage.setItem(k, { i });\n for (const [i, k] of keys.entries()) expect(await storage.getItem(k)).toEqual({ i });\n expect(sorted(await storage.getKeys(key(\"e\", \"\")))).toEqual(sorted(keys));\n expect(await storage.getKeys(key(\"e\", \"\", \"\"))).toEqual([key(\"e\", \"\", \"b\")]);\n expect(sorted(await storage.getKeys(key(\"e\", \"x\")))).toEqual(\n sorted([key(\"e\", \"x\", \"\"), key(\"e\", \"x\")]),\n );\n await storage.removeItem(key(\"e\", \"\", \"b\"));\n expect(await storage.getItem(key(\"e\", \"b\"))).toEqual({ i: 1 });\n },\n },\n {\n name: \"zero-padded sortable leaves list in chronological order once sorted\",\n async run({ storage, key, expect }) {\n const times = [1_700_000_000_123, 5, 1_700_000_000_122, 99_999, 1_600_000_000_000];\n for (const [i, ms] of times.entries())\n await storage.setItem(key(\"due\", sortableLeaf(ms, `id${i}`)), i);\n const listed = sorted(await storage.getKeys(key(\"due\", \"\")));\n expect(listed).toEqual(\n [...times.entries()]\n .sort(([, a], [, b]) => a - b)\n .map(([i, ms]) => key(\"due\", sortableLeaf(ms, `id${i}`))),\n );\n },\n },\n {\n name: \"lists many keys (pagination) without duplicates\",\n async run({ storage, key, expect }) {\n const keys = Array.from({ length: 250 }, (_, i) => key(\"bulk\", String(i).padStart(3, \"0\")));\n await Promise.all(keys.map((k, i) => storage.setItem(k, { i })));\n const listed = await storage.getKeys(key(\"bulk\", \"\"));\n expect(listed.length).toBe(250);\n expect(new Set(listed).size).toBe(250);\n expect(sorted(listed)).toEqual(keys);\n },\n },\n];\n\n/** The compare-and-swap cases (`capabilities.compareAndSwap`). */\nexport const compareAndSwapCases: ConformanceCase[] = [\n {\n name: \"swaps only when the expectation holds (absence, mismatch, match)\",\n async run({ storage, key, expect }) {\n const cas = requireCompareAndSwap(storage);\n const k = key(\"cas\");\n expect(\n await cas.compareAndSwap<unknown>({ key: k, expected: { v: 1 }, next: { v: 2 } }),\n ).toBe(false);\n expect(await cas.getItem(k)).toBeNull();\n expect(\n await cas.compareAndSwap<unknown>({ key: k, expected: null, next: { v: 1, tags: [\"a\"] } }),\n ).toBe(true);\n expect(await cas.compareAndSwap<unknown>({ key: k, expected: null, next: { v: 9 } })).toBe(\n false,\n );\n expect(\n await cas.compareAndSwap<unknown>({ key: k, expected: { v: 0 }, next: { v: 2 } }),\n ).toBe(false);\n expect(\n await cas.compareAndSwap<unknown>({ key: k, expected: { v: 1 }, next: { v: 2 } }),\n ).toBe(false);\n expect(\n await cas.compareAndSwap<unknown>({\n key: k,\n expected: { v: 1, tags: [\"a\"] },\n next: { v: 2 },\n }),\n ).toBe(true);\n expect(await cas.getItem(k)).toEqual({ v: 2 });\n },\n },\n {\n name: \"compares structurally: object key order is ignored, arrays are ordered\",\n async run({ storage, key, expect }) {\n const cas = requireCompareAndSwap(storage);\n const k = key(\"order\");\n await cas.setItem(k, { b: 1, a: { d: [1, 2], c: null } });\n expect(\n await cas.compareAndSwap<unknown>({\n key: k,\n expected: { a: { c: null, d: [2, 1] }, b: 1 },\n next: 0,\n }),\n ).toBe(false);\n expect(\n await cas.compareAndSwap<unknown>({\n key: k,\n expected: { a: { c: null, d: [1, 2] }, b: 1 },\n next: { n: 1 },\n }),\n ).toBe(true);\n expect(await cas.getItem(k)).toEqual({ n: 1 });\n },\n },\n {\n name: \"{} and [] are different values\",\n async run({ storage, key, expect }) {\n const cas = requireCompareAndSwap(storage);\n await cas.setItem(key(\"obj\"), {});\n await cas.setItem(key(\"arr\"), []);\n expect(await cas.compareAndSwap<unknown>({ key: key(\"obj\"), expected: [], next: 1 })).toBe(\n false,\n );\n expect(await cas.compareAndSwap<unknown>({ key: key(\"arr\"), expected: {}, next: 1 })).toBe(\n false,\n );\n expect(await cas.compareAndSwap<unknown>({ key: key(\"obj\"), expected: {}, next: 2 })).toBe(\n true,\n );\n expect(await cas.compareAndSwap<unknown>({ key: key(\"arr\"), expected: [], next: 3 })).toBe(\n true,\n );\n expect(await cas.getItem(key(\"obj\"))).toBe(2);\n expect(await cas.getItem(key(\"arr\"))).toBe(3);\n },\n },\n {\n name: \"swaps primitives\",\n async run({ storage, key, expect }) {\n const cas = requireCompareAndSwap(storage);\n await cas.setItem(key(\"p\"), \"a\");\n expect(await cas.compareAndSwap<unknown>({ key: key(\"p\"), expected: \"b\", next: \"c\" })).toBe(\n false,\n );\n expect(await cas.compareAndSwap<unknown>({ key: key(\"p\"), expected: \"a\", next: 7 })).toBe(\n true,\n );\n expect(await cas.compareAndSwap<unknown>({ key: key(\"p\"), expected: 7, next: false })).toBe(\n true,\n );\n expect(await cas.getItem(key(\"p\"))).toBe(false);\n },\n },\n {\n name: \"concurrent claims of an absent key: exactly one wins\",\n async run({ storage, key, expect }) {\n const cas = requireCompareAndSwap(storage);\n const results = await Promise.all(\n Array.from({ length: 8 }, (_, i) =>\n cas.compareAndSwap<unknown>({ key: key(\"claim\"), expected: null, next: { by: i } }),\n ),\n );\n expect(results.filter(Boolean).length).toBe(1);\n const winner = results.indexOf(true);\n expect(await cas.getItem(key(\"claim\"))).toEqual({ by: winner });\n },\n },\n {\n name: \"concurrent swaps from the same expectation: exactly one wins\",\n async run({ storage, key, expect }) {\n const cas = requireCompareAndSwap(storage);\n await cas.setItem(key(\"race\"), { n: 0, meta: { b: 1, a: 2 } });\n const results = await Promise.all(\n Array.from({ length: 8 }, (_, i) =>\n cas.compareAndSwap<unknown>({\n key: key(\"race\"),\n expected: { meta: { a: 2, b: 1 }, n: 0 },\n next: { n: i + 1 },\n }),\n ),\n );\n expect(results.filter(Boolean).length).toBe(1);\n },\n },\n {\n name: \"legacy non-canonical stored values: read, listed and swapped (ADR 0005)\",\n async run({ storage, key, expect, options }) {\n const seed = options.seedLegacy;\n if (!seed) return;\n const cas = requireCompareAndSwap(storage);\n const k = key(\"legacy\", \"v\");\n const value = { b: 1, a: { d: [1, { z: 1, y: 2 }], c: \"x\" } };\n await seed(storage, k, '{\"b\":1,\"a\":{\"d\":[1,{\"z\":1,\"y\":2}],\"c\":\"x\"}}');\n expect(await cas.getItem(k)).toEqual(value);\n expect(await cas.getKeys(key(\"legacy\", \"\"))).toEqual([k]);\n expect(await cas.compareAndSwap<unknown>({ key: k, expected: { b: 2 }, next: 0 })).toBe(\n false,\n );\n expect(await cas.compareAndSwap<unknown>({ key: k, expected: null, next: 0 })).toBe(false);\n expect(await cas.compareAndSwap<unknown>({ key: k, expected: value, next: { n: 1 } })).toBe(\n true,\n );\n expect(await cas.getItem(k)).toEqual({ n: 1 });\n // Concurrent swaps over a legacy value: still exactly one winner.\n const k2 = key(\"legacy\", \"race\");\n await seed(storage, k2, '{\"b\":1,\"a\":2}');\n const results = await Promise.all(\n Array.from({ length: 6 }, (_, i) =>\n cas.compareAndSwap<unknown>({ key: k2, expected: { a: 2, b: 1 }, next: { i } }),\n ),\n );\n expect(results.filter(Boolean).length).toBe(1);\n },\n },\n];\n\n/** The watch cases (`capabilities.watch`). */\nexport const watchCases: ConformanceCase[] = [\n {\n name: \"notifies updates and removals under the prefix only\",\n async run({ storage, key, expect, settle, options }) {\n const ms = settleMs(options);\n const watchable = requireWatchable(storage);\n const events: StorageChangeEvent[] = [];\n const off = await watchable.watch(key(\"w\", \"\"), (e) => events.push(e));\n await settle(ms);\n await watchable.setItem(key(\"w\", \"a\"), { v: 1 });\n await watchable.setItem(key(\"other\", \"b\"), { v: 1 });\n // Filesystem watchers coalesce a create immediately followed by a delete.\n await settle(ms);\n const beforeRemove = events.length;\n await watchable.removeItem(key(\"w\", \"a\"));\n await settle(ms);\n await off();\n expect(events.some((e) => e.type === \"update\" && e.key === key(\"w\", \"a\"))).toBe(true);\n if (reportsRemovals(options)) {\n expect(events.some((e) => e.type === \"remove\" && e.key === key(\"w\", \"a\"))).toBe(true);\n } else {\n expect(events.slice(beforeRemove).some((e) => e.key === key(\"w\", \"a\"))).toBe(true);\n }\n expect(events.every((e) => e.key.startsWith(key(\"w\", \"\")))).toBe(true);\n },\n },\n {\n name: \"a prefix with glob characters ([ ] * ? \\\\) matches literally\",\n async run({ storage, key, expect, settle, options }) {\n const ms = settleMs(options);\n const watchable = requireWatchable(storage);\n const prefix = key(\"g[x]*?\\\\\", \"\");\n const events: StorageChangeEvent[] = [];\n const off = await watchable.watch(prefix, (e) => events.push(e));\n await settle(ms);\n await watchable.setItem(`${prefix}a`, 1);\n await watchable.setItem(key(\"gx\", \"b\"), 1);\n await settle(ms);\n await off();\n expect(events.some((e) => e.type === \"update\" && e.key === `${prefix}a`)).toBe(true);\n expect(events.every((e) => e.key.startsWith(prefix))).toBe(true);\n },\n },\n {\n name: \"unsubscribe stops notifications\",\n async run({ storage, key, expect, settle, options }) {\n const ms = settleMs(options);\n const watchable = requireWatchable(storage);\n const events: StorageChangeEvent[] = [];\n const off = await watchable.watch(key(\"off\", \"\"), (e) => events.push(e));\n await settle(ms);\n await off();\n await settle(ms);\n await watchable.setItem(key(\"off\", \"a\"), 1);\n await settle(ms);\n expect(events.length).toBe(0);\n },\n },\n];\n\n/**\n * The declared capabilities match the storage: an undeclared `compareAndSwap` or `watch` would skip\n * those cases silently, and a declared one the storage lacks would fail them obscurely.\n */\nexport const capabilitiesCase: ConformanceCase = {\n name: \"declared capabilities match the storage\",\n async run({ storage, expect, options }) {\n const declared = options.capabilities ?? {};\n const problems: string[] = [];\n const check = (name: \"compareAndSwap\" | \"watch\", has: boolean): void => {\n const value = declared[name];\n if (value === undefined && has) {\n problems.push(\n `implements ${name} but capabilities.${name} is not declared (true to run its cases, false to skip)`,\n );\n } else if (value && !has) {\n problems.push(`declares capabilities.${name} but does not implement it`);\n }\n };\n check(\"compareAndSwap\", isCompareAndSwap(storage));\n check(\"watch\", isWatchable(storage));\n expect(problems).toEqual([]);\n },\n};\n\nconst settleMs = (options: ConformanceOptions): number => {\n const watch = options.capabilities?.watch;\n return typeof watch === \"object\" ? (watch.settleMs ?? 50) : 50;\n};\n\nconst reportsRemovals = (options: ConformanceOptions): boolean => {\n const watch = options.capabilities?.watch;\n return typeof watch === \"object\" ? watch.removals !== false : true;\n};\n\n/**\n * Register the full conformance suite for one driver: the base contract, plus the\n * compare-and-swap and watch cases when `capabilities` says the driver has them.\n *\n * @example\n * ```ts\n * import { describe, expect, test } from \"vitest\"; // or \"bun:test\"\n * import { runStorageConformance } from \"@xtandard/kit/storage/testing\";\n * import { createMemoryStorage } from \"@xtandard/kit/storage/memory\";\n *\n * runStorageConformance(\"memory\", () => createMemoryStorage(), {\n * t: { describe, test, expect },\n * capabilities: { compareAndSwap: true, watch: true },\n * keyRoot: \"whk\",\n * });\n * ```\n */\nexport function runStorageConformance(\n name: string,\n make: MakeStorage,\n options: ConformanceOptions,\n): void {\n runConformanceCases(\n `KvStorage contract: ${name}`,\n [capabilitiesCase, ...contractCases],\n make,\n options,\n );\n if (options.capabilities?.compareAndSwap) {\n runConformanceCases(`compareAndSwap: ${name}`, compareAndSwapCases, make, options);\n }\n if (options.capabilities?.watch) {\n runConformanceCases(`watch: ${name}`, watchCases, make, options);\n }\n}\n","/**\n * An in-memory node-redis look-alike for tests (semi-public): string and RedisJSON values, the kit\n * redis driver's Lua scripts emulated, sorted sets (`zAdd`/`zRem`/`zRangeByScore`), a SCAN that\n * yields keys more than once (as Redis may) and PSUBSCRIBE with real glob matching. Products run the\n * conformance suite on their wrapped redis driver with it, without a live server; a product's own\n * Lua scripts can be emulated through {@link FakeRedisOptions.eval}.\n *\n * @module\n */\n\nimport type { RedisLike, RedisStorageOptions } from \"../redis.ts\";\n\n/** The fake's state, exposed for assertions. */\nexport type FakeRedis = RedisLike & {\n /** String and RedisJSON values by full key. */\n strings: Map<string, string>;\n /** Every PSUBSCRIBE pattern received. */\n patterns: string[];\n /** Sorted sets: member → score, by key. */\n zsets: Map<string, Map<string, number>>;\n};\n\n/** Options for {@link fakeRedis}. */\nexport interface FakeRedisOptions {\n /**\n * Emulate a product's own Lua scripts: return a value to answer `EVAL`, or `undefined` to fall back\n * to the kit driver's scripts.\n */\n eval?: (script: string, keys: string[], args: string[], fake: FakeRedis) => unknown;\n}\n\n/** Redis glob → RegExp (backslash escapes, `*`, `?`, `[…]`). */\nfunction globToRegExp(glob: string): RegExp {\n let re = \"\";\n for (let i = 0; i < glob.length; i++) {\n const c = glob[i]!;\n if (c === \"\\\\\") re += `\\\\${glob[++i] ?? \"\"}`.replace(/\\\\([^\\w])/, (_, x: string) => `\\\\${x}`);\n else if (c === \"*\") re += \".*\";\n else if (c === \"?\") re += \".\";\n else if (c === \"[\") {\n const end = glob.indexOf(\"]\", i + 1);\n re += `[${glob.slice(i + 1, end).replace(/\\\\/g, \"\\\\\\\\\")}]`;\n i = end;\n } else re += c.replace(/[.+^${}()|\\\\/]/g, \"\\\\$&\");\n }\n return new RegExp(`^${re}$`, \"s\");\n}\n\n/**\n * An in-memory node-redis look-alike: string and RedisJSON values, the driver's two Lua scripts\n * emulated, a SCAN that yields every key twice (Redis may repeat keys), and PSUBSCRIBE with real\n * glob matching (so an unescaped prefix would miss events).\n */\nexport function fakeRedis(options: FakeRedisOptions = {}): FakeRedis {\n return makeFakeRedis(options);\n}\n\nfunction makeFakeRedis(options: FakeRedisOptions): RedisLike & {\n strings: Map<string, string>;\n patterns: string[];\n zsets: Map<string, Map<string, number>>;\n} {\n const strings = new Map<string, string>();\n const zsets = new Map<string, Map<string, number>>();\n const subs = new Set<{ re: RegExp; listener: (m: string, ch: string) => void }>();\n const patterns: string[] = [];\n const emit = (key: string, event: string) => {\n for (const s of subs) {\n const ch = `__keyspace@0__:${key}`;\n if (s.re.test(ch)) queueMicrotask(() => s.listener(event, ch));\n }\n };\n const self: RedisLike & {\n strings: Map<string, string>;\n patterns: string[];\n zsets: Map<string, Map<string, number>>;\n } = {\n strings,\n patterns,\n zsets,\n async zAdd(key, members) {\n const set = zsets.get(key) ?? new Map<string, number>();\n for (const m of [members].flat()) set.set(m.value, m.score);\n zsets.set(key, set);\n },\n async zRem(key, members) {\n for (const m of [members].flat()) zsets.get(key)?.delete(m);\n },\n async zRangeByScore(key, min, max) {\n const bound = (v: number | string) =>\n v === \"-inf\" ? -Infinity : v === \"+inf\" ? Infinity : Number(v);\n const lo = bound(min);\n const hi = bound(max);\n return [...(zsets.get(key) ?? new Map<string, number>())]\n .filter(([, score]) => score >= lo && score <= hi)\n .sort((a, b) => a[1] - b[1])\n .map(([member]) => member);\n },\n isOpen: false,\n on: () => self,\n async connect() {\n self.isOpen = true;\n },\n async quit() {\n self.isOpen = false;\n },\n async disconnect() {\n self.isOpen = false;\n },\n async get(key) {\n return strings.get(key) ?? null;\n },\n async set(key, value) {\n strings.set(key, value);\n emit(key, \"set\");\n },\n async del(key) {\n for (const k of [key].flat()) if (strings.delete(k)) emit(k, \"del\");\n },\n json: {\n async get(key) {\n const raw = strings.get(key);\n return raw === undefined ? null : JSON.parse(raw);\n },\n async set(key, _path, value) {\n strings.set(key, JSON.stringify(value));\n emit(key, \"json.set\");\n },\n },\n async eval(script, opts = {}) {\n const [key] = opts.keys ?? [];\n const args = opts.arguments ?? [];\n const custom = options.eval?.(script, opts.keys ?? [], args, self);\n if (custom !== undefined) return custom;\n const raw = strings.get(key!) ?? null;\n if (!script.includes(\"ARGV[4]\")) return raw;\n const [mode, expected, next] = args;\n if (mode === \"0\" ? raw !== null : raw !== expected) return 0;\n strings.set(key!, next!);\n emit(key!, \"set\");\n return 1;\n },\n async *scanIterator(opts = {}) {\n const re = globToRegExp(opts.MATCH ?? \"*\");\n const keys = [...strings.keys()].filter((k) => re.test(k));\n yield keys;\n yield keys.slice(0, 3); // SCAN may return a key more than once\n },\n duplicate() {\n const sub = fakeRedisSubscriber();\n return sub;\n },\n async pSubscribe() {},\n };\n function fakeRedisSubscriber(): RedisLike {\n return {\n ...self,\n isOpen: false,\n async connect() {},\n async pSubscribe(pattern, listener) {\n patterns.push(pattern);\n const entry = { re: globToRegExp(pattern), listener };\n subs.add(entry);\n this.disconnect = async () => {\n subs.delete(entry);\n };\n },\n };\n }\n return self;\n}\n\n/** Cast a fake to the `client` option type of the redis driver factories. */\nexport const asRedisClient = (c: RedisLike) =>\n c as unknown as NonNullable<RedisStorageOptions[\"client\"]>;\n"],"mappings":";;;;;;;;;;;;;;;AA2GA,MAAa,UAAU,OAA8B,IAAI,SAAS,MAAM,WAAW,GAAG,EAAE,CAAC;;AAGzF,SAAgB,sBAAsB,SAA6C;CACjF,IAAI,CAACA,aAAAA,iBAAiB,OAAO,GAAG,MAAM,IAAI,MAAM,0CAA0C;CAC1F,OAAO;AACT;;AAGA,SAAgB,iBAAiB,SAAwC;CACvE,IAAI,CAACC,aAAAA,YAAY,OAAO,GAAG,MAAM,IAAI,MAAM,iCAAiC;CAC5E,OAAO;AACT;AAEA,MAAM,UAAU,SAA6B,CAAC,GAAG,IAAI,EAAE,KAAK;;;;;AAM5D,SAAgB,oBACd,OACA,OACA,MACA,SACM;CACN,MAAM,EAAE,GAAG,UAAU,OAAO,YAAY;CACxC,EAAE,SAAS,aAAa;EACtB,KAAK,MAAM,KAAK,OACd,EAAE,KACA,EAAE,MACF,YAAY;GACV,MAAM,UAAU,MAAM,KAAK;GAC3B,IAAI;IACF,MAAM,EAAE,IAAI;KACV;KACA,MAAM,GAAG,aAAa,CAAC,SAAS,GAAG,QAAQ,EAAE,KAAK,GAAG;KACrD,QAAQ,EAAE;KACV;KACA;IACF,CAAC;GACH,UAAU;IACR,MAAO,QAAsC,QAAQ;GACvD;EACF,GACA,OACF;CAEJ,CAAC;AACH;;AAGA,MAAa,gBAAmC;CAC9C;EACE,MAAM;EACN,MAAM,IAAI,EAAE,SAAS,KAAK,UAAU;GAClC,OAAO,MAAM,QAAQ,QAAQ,IAAI,SAAS,CAAC,C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GACjE,IAAI,WAAW,KAAA,GAAW,OAAO;GACjC,MAAM,MAAM,QAAQ,IAAI,GAAI,KAAK;GACjC,IAAI,CAAC,OAAO,SAAS,SAAS,GAAG,OAAO;GACxC,MAAM,CAAC,MAAM,UAAU,QAAQ;GAC/B,IAAI,SAAS,MAAM,QAAQ,OAAO,QAAQ,UAAU,OAAO;GAC3D,QAAQ,IAAI,KAAM,IAAK;GACvB,KAAK,KAAM,KAAK;GAChB,OAAO;EACT;EACA,OAAO,aAAa,OAAO,CAAC,GAAG;GAC7B,MAAM,KAAK,aAAa,KAAK,SAAS,GAAG;GACzC,MAAM,OAAO,CAAC,GAAG,QAAQ,KAAK,CAAC,EAAE,QAAQ,MAAM,GAAG,KAAK,CAAC,CAAC;GACzD,MAAM;GACN,MAAM,KAAK,MAAM,GAAG,CAAC;EACvB;EACA,YAAY;GAEV,OADY,oBACH;EACX;EACA,MAAM,aAAa,CAAC;CACtB;CACA,SAAS,sBAAiC;EACxC,OAAO;GACL,GAAG;GACH,QAAQ;GACR,MAAM,UAAU,CAAC;GACjB,MAAM,WAAW,SAAS,UAAU;IAClC,SAAS,KAAK,OAAO;IACrB,MAAM,QAAQ;KAAE,IAAI,aAAa,OAAO;KAAG;IAAS;IACpD,KAAK,IAAI,KAAK;IACd,KAAK,aAAa,YAAY;KAC5B,KAAK,OAAO,KAAK;IACnB;GACF;EACF;CACF;CACA,OAAO;AACT;;AAGA,MAAa,iBAAiB,MAC5B"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { n as CompareAndSwapKvStorage, o as WatchableKvStorage, r as KvStorage } from "./contract-BvgtswLX.cjs";
|
|
2
|
+
import { a as RedisStorageOptions, i as RedisLike } from "./redis-B362ofBw.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/storage/testing/conformance.d.ts
|
|
5
|
+
/** The matchers the suite uses. vitest's and `bun:test`'s `expect` both satisfy it. */
|
|
6
|
+
interface ConformanceMatchers {
|
|
7
|
+
/** `Object.is` equality. */
|
|
8
|
+
toBe(expected: unknown): void;
|
|
9
|
+
/** Deep equality. */
|
|
10
|
+
toEqual(expected: unknown): void;
|
|
11
|
+
/** `=== null`. */
|
|
12
|
+
toBeNull(): void;
|
|
13
|
+
}
|
|
14
|
+
/** The injected test API: pass `{ describe, test, expect }` from your runner. */
|
|
15
|
+
interface ConformanceTestApi {
|
|
16
|
+
/** Group tests. */
|
|
17
|
+
describe(name: string, fn: () => void): void;
|
|
18
|
+
/** Register one test (the third argument is the timeout in ms). */
|
|
19
|
+
test(name: string, fn: () => Promise<void>, timeout?: number): void;
|
|
20
|
+
/** Make an assertion. */
|
|
21
|
+
expect(actual: unknown): ConformanceMatchers;
|
|
22
|
+
}
|
|
23
|
+
/** A factory producing a fresh, **empty** storage (or an empty namespace of one) for each test. */
|
|
24
|
+
type MakeStorage = () => KvStorage | Promise<KvStorage>;
|
|
25
|
+
/**
|
|
26
|
+
* Write a value in a legacy, non-canonical stored form, bypassing the driver (e.g. a raw SQL
|
|
27
|
+
* `INSERT` of `json` text with unsorted keys, a Mongo document with fields in insertion order).
|
|
28
|
+
* Enables the legacy-value CAS case (ADR 0005).
|
|
29
|
+
*/
|
|
30
|
+
type SeedLegacy = (storage: KvStorage, key: string, rawJson: string) => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* The optional capabilities the driver under test implements. Declare each one: a capability case
|
|
33
|
+
* checks the declaration against the storage itself, so a driver that implements `compareAndSwap`
|
|
34
|
+
* or `watch` without declaring it (or declares one it lacks) fails instead of silently skipping
|
|
35
|
+
* cases. Pass `false` for a capability the driver doesn't have.
|
|
36
|
+
*/
|
|
37
|
+
interface ConformanceCapabilities {
|
|
38
|
+
/** Run the compare-and-swap cases (the storage must implement `compareAndSwap`). */
|
|
39
|
+
compareAndSwap?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Run the watch cases (the storage must implement `watch`). `settleMs` is how long to wait for
|
|
42
|
+
* notifications to arrive (default 50 ms). `removals: false` is for watchers that report every
|
|
43
|
+
* change as `update` (a {@link withWatch} storage, whose notifier gives only a key): a removal must
|
|
44
|
+
* then still produce an event, of any type. Default `true`.
|
|
45
|
+
*/
|
|
46
|
+
watch?: boolean | {
|
|
47
|
+
settleMs?: number;
|
|
48
|
+
removals?: boolean;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** Options for {@link runStorageConformance}. */
|
|
52
|
+
interface ConformanceOptions {
|
|
53
|
+
/** The injected test API. */
|
|
54
|
+
t: ConformanceTestApi;
|
|
55
|
+
/** Capabilities to exercise. */
|
|
56
|
+
capabilities?: ConformanceCapabilities;
|
|
57
|
+
/** First segment of every key the suite writes (products pass their root, e.g. `"whk"`). Default `"kit"`. */
|
|
58
|
+
keyRoot?: string;
|
|
59
|
+
/** Per-test timeout in ms (live backends may need more than the runner default). */
|
|
60
|
+
timeout?: number;
|
|
61
|
+
/** Enables the legacy-value CAS case; see {@link SeedLegacy}. */
|
|
62
|
+
seedLegacy?: SeedLegacy;
|
|
63
|
+
}
|
|
64
|
+
/** What a {@link ConformanceCase} receives. */
|
|
65
|
+
interface ConformanceContext {
|
|
66
|
+
/** A fresh storage from the factory. */
|
|
67
|
+
storage: KvStorage;
|
|
68
|
+
/** Build a key under the suite's root: `key("a", "b")` → `"<root>/a/b"`. */
|
|
69
|
+
key(...segments: string[]): string;
|
|
70
|
+
/** The injected `expect`. */
|
|
71
|
+
expect: ConformanceTestApi["expect"];
|
|
72
|
+
/** Wait for `ms` (watch notifications, eventual consistency). */
|
|
73
|
+
settle(ms: number): Promise<void>;
|
|
74
|
+
/** The options the suite runs with. */
|
|
75
|
+
options: ConformanceOptions;
|
|
76
|
+
}
|
|
77
|
+
/** One named case. Products register extra suites as lists of these. */
|
|
78
|
+
interface ConformanceCase {
|
|
79
|
+
/** Test name. */
|
|
80
|
+
name: string;
|
|
81
|
+
/** The test body. */
|
|
82
|
+
run(ctx: ConformanceContext): Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
/** Resolve after `ms` milliseconds. */
|
|
85
|
+
declare const settle: (ms: number) => Promise<void>;
|
|
86
|
+
/** Narrow to {@link CompareAndSwapKvStorage} or throw a clear error. */
|
|
87
|
+
declare function requireCompareAndSwap(storage: KvStorage): CompareAndSwapKvStorage;
|
|
88
|
+
/** Narrow to {@link WatchableKvStorage} or throw a clear error. */
|
|
89
|
+
declare function requireWatchable(storage: KvStorage): WatchableKvStorage;
|
|
90
|
+
/**
|
|
91
|
+
* Register `describe(title, …)` with one test per case. Each test gets a fresh storage from `make`.
|
|
92
|
+
* This is how products register their own extra suites next to {@link runStorageConformance}.
|
|
93
|
+
*/
|
|
94
|
+
declare function runConformanceCases(title: string, cases: ConformanceCase[], make: MakeStorage, options: ConformanceOptions): void;
|
|
95
|
+
/** The base-contract cases every driver must pass. */
|
|
96
|
+
declare const contractCases: ConformanceCase[];
|
|
97
|
+
/** The compare-and-swap cases (`capabilities.compareAndSwap`). */
|
|
98
|
+
declare const compareAndSwapCases: ConformanceCase[];
|
|
99
|
+
/** The watch cases (`capabilities.watch`). */
|
|
100
|
+
declare const watchCases: ConformanceCase[];
|
|
101
|
+
/**
|
|
102
|
+
* The declared capabilities match the storage: an undeclared `compareAndSwap` or `watch` would skip
|
|
103
|
+
* those cases silently, and a declared one the storage lacks would fail them obscurely.
|
|
104
|
+
*/
|
|
105
|
+
declare const capabilitiesCase: ConformanceCase;
|
|
106
|
+
/**
|
|
107
|
+
* Register the full conformance suite for one driver: the base contract, plus the
|
|
108
|
+
* compare-and-swap and watch cases when `capabilities` says the driver has them.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* import { describe, expect, test } from "vitest"; // or "bun:test"
|
|
113
|
+
* import { runStorageConformance } from "@xtandard/kit/storage/testing";
|
|
114
|
+
* import { createMemoryStorage } from "@xtandard/kit/storage/memory";
|
|
115
|
+
*
|
|
116
|
+
* runStorageConformance("memory", () => createMemoryStorage(), {
|
|
117
|
+
* t: { describe, test, expect },
|
|
118
|
+
* capabilities: { compareAndSwap: true, watch: true },
|
|
119
|
+
* keyRoot: "whk",
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
declare function runStorageConformance(name: string, make: MakeStorage, options: ConformanceOptions): void;
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/storage/testing/fake-redis.d.ts
|
|
126
|
+
/** The fake's state, exposed for assertions. */
|
|
127
|
+
type FakeRedis = RedisLike & {
|
|
128
|
+
/** String and RedisJSON values by full key. */strings: Map<string, string>; /** Every PSUBSCRIBE pattern received. */
|
|
129
|
+
patterns: string[]; /** Sorted sets: member → score, by key. */
|
|
130
|
+
zsets: Map<string, Map<string, number>>;
|
|
131
|
+
};
|
|
132
|
+
/** Options for {@link fakeRedis}. */
|
|
133
|
+
interface FakeRedisOptions {
|
|
134
|
+
/**
|
|
135
|
+
* Emulate a product's own Lua scripts: return a value to answer `EVAL`, or `undefined` to fall back
|
|
136
|
+
* to the kit driver's scripts.
|
|
137
|
+
*/
|
|
138
|
+
eval?: (script: string, keys: string[], args: string[], fake: FakeRedis) => unknown;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* An in-memory node-redis look-alike: string and RedisJSON values, the driver's two Lua scripts
|
|
142
|
+
* emulated, a SCAN that yields every key twice (Redis may repeat keys), and PSUBSCRIBE with real
|
|
143
|
+
* glob matching (so an unescaped prefix would miss events).
|
|
144
|
+
*/
|
|
145
|
+
declare function fakeRedis(options?: FakeRedisOptions): FakeRedis;
|
|
146
|
+
/** Cast a fake to the `client` option type of the redis driver factories. */
|
|
147
|
+
declare const asRedisClient: (c: RedisLike) => NonNullable<RedisStorageOptions["client"]>;
|
|
148
|
+
//#endregion
|
|
149
|
+
export { type ConformanceCapabilities, type ConformanceCase, type ConformanceContext, type ConformanceMatchers, type ConformanceOptions, type ConformanceTestApi, type FakeRedis, type FakeRedisOptions, type MakeStorage, type SeedLegacy, asRedisClient, capabilitiesCase, compareAndSwapCases, contractCases, fakeRedis, requireCompareAndSwap, requireWatchable, runConformanceCases, runStorageConformance, settle, watchCases };
|
|
150
|
+
//# sourceMappingURL=entry-storage-testing.d.cts.map
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { n as CompareAndSwapKvStorage, o as WatchableKvStorage, r as KvStorage } from "./contract-BvgtswLX.mjs";
|
|
2
|
+
import { a as RedisStorageOptions, i as RedisLike } from "./redis-CahNAVTW.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/storage/testing/conformance.d.ts
|
|
5
|
+
/** The matchers the suite uses. vitest's and `bun:test`'s `expect` both satisfy it. */
|
|
6
|
+
interface ConformanceMatchers {
|
|
7
|
+
/** `Object.is` equality. */
|
|
8
|
+
toBe(expected: unknown): void;
|
|
9
|
+
/** Deep equality. */
|
|
10
|
+
toEqual(expected: unknown): void;
|
|
11
|
+
/** `=== null`. */
|
|
12
|
+
toBeNull(): void;
|
|
13
|
+
}
|
|
14
|
+
/** The injected test API: pass `{ describe, test, expect }` from your runner. */
|
|
15
|
+
interface ConformanceTestApi {
|
|
16
|
+
/** Group tests. */
|
|
17
|
+
describe(name: string, fn: () => void): void;
|
|
18
|
+
/** Register one test (the third argument is the timeout in ms). */
|
|
19
|
+
test(name: string, fn: () => Promise<void>, timeout?: number): void;
|
|
20
|
+
/** Make an assertion. */
|
|
21
|
+
expect(actual: unknown): ConformanceMatchers;
|
|
22
|
+
}
|
|
23
|
+
/** A factory producing a fresh, **empty** storage (or an empty namespace of one) for each test. */
|
|
24
|
+
type MakeStorage = () => KvStorage | Promise<KvStorage>;
|
|
25
|
+
/**
|
|
26
|
+
* Write a value in a legacy, non-canonical stored form, bypassing the driver (e.g. a raw SQL
|
|
27
|
+
* `INSERT` of `json` text with unsorted keys, a Mongo document with fields in insertion order).
|
|
28
|
+
* Enables the legacy-value CAS case (ADR 0005).
|
|
29
|
+
*/
|
|
30
|
+
type SeedLegacy = (storage: KvStorage, key: string, rawJson: string) => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* The optional capabilities the driver under test implements. Declare each one: a capability case
|
|
33
|
+
* checks the declaration against the storage itself, so a driver that implements `compareAndSwap`
|
|
34
|
+
* or `watch` without declaring it (or declares one it lacks) fails instead of silently skipping
|
|
35
|
+
* cases. Pass `false` for a capability the driver doesn't have.
|
|
36
|
+
*/
|
|
37
|
+
interface ConformanceCapabilities {
|
|
38
|
+
/** Run the compare-and-swap cases (the storage must implement `compareAndSwap`). */
|
|
39
|
+
compareAndSwap?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Run the watch cases (the storage must implement `watch`). `settleMs` is how long to wait for
|
|
42
|
+
* notifications to arrive (default 50 ms). `removals: false` is for watchers that report every
|
|
43
|
+
* change as `update` (a {@link withWatch} storage, whose notifier gives only a key): a removal must
|
|
44
|
+
* then still produce an event, of any type. Default `true`.
|
|
45
|
+
*/
|
|
46
|
+
watch?: boolean | {
|
|
47
|
+
settleMs?: number;
|
|
48
|
+
removals?: boolean;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** Options for {@link runStorageConformance}. */
|
|
52
|
+
interface ConformanceOptions {
|
|
53
|
+
/** The injected test API. */
|
|
54
|
+
t: ConformanceTestApi;
|
|
55
|
+
/** Capabilities to exercise. */
|
|
56
|
+
capabilities?: ConformanceCapabilities;
|
|
57
|
+
/** First segment of every key the suite writes (products pass their root, e.g. `"whk"`). Default `"kit"`. */
|
|
58
|
+
keyRoot?: string;
|
|
59
|
+
/** Per-test timeout in ms (live backends may need more than the runner default). */
|
|
60
|
+
timeout?: number;
|
|
61
|
+
/** Enables the legacy-value CAS case; see {@link SeedLegacy}. */
|
|
62
|
+
seedLegacy?: SeedLegacy;
|
|
63
|
+
}
|
|
64
|
+
/** What a {@link ConformanceCase} receives. */
|
|
65
|
+
interface ConformanceContext {
|
|
66
|
+
/** A fresh storage from the factory. */
|
|
67
|
+
storage: KvStorage;
|
|
68
|
+
/** Build a key under the suite's root: `key("a", "b")` → `"<root>/a/b"`. */
|
|
69
|
+
key(...segments: string[]): string;
|
|
70
|
+
/** The injected `expect`. */
|
|
71
|
+
expect: ConformanceTestApi["expect"];
|
|
72
|
+
/** Wait for `ms` (watch notifications, eventual consistency). */
|
|
73
|
+
settle(ms: number): Promise<void>;
|
|
74
|
+
/** The options the suite runs with. */
|
|
75
|
+
options: ConformanceOptions;
|
|
76
|
+
}
|
|
77
|
+
/** One named case. Products register extra suites as lists of these. */
|
|
78
|
+
interface ConformanceCase {
|
|
79
|
+
/** Test name. */
|
|
80
|
+
name: string;
|
|
81
|
+
/** The test body. */
|
|
82
|
+
run(ctx: ConformanceContext): Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
/** Resolve after `ms` milliseconds. */
|
|
85
|
+
declare const settle: (ms: number) => Promise<void>;
|
|
86
|
+
/** Narrow to {@link CompareAndSwapKvStorage} or throw a clear error. */
|
|
87
|
+
declare function requireCompareAndSwap(storage: KvStorage): CompareAndSwapKvStorage;
|
|
88
|
+
/** Narrow to {@link WatchableKvStorage} or throw a clear error. */
|
|
89
|
+
declare function requireWatchable(storage: KvStorage): WatchableKvStorage;
|
|
90
|
+
/**
|
|
91
|
+
* Register `describe(title, …)` with one test per case. Each test gets a fresh storage from `make`.
|
|
92
|
+
* This is how products register their own extra suites next to {@link runStorageConformance}.
|
|
93
|
+
*/
|
|
94
|
+
declare function runConformanceCases(title: string, cases: ConformanceCase[], make: MakeStorage, options: ConformanceOptions): void;
|
|
95
|
+
/** The base-contract cases every driver must pass. */
|
|
96
|
+
declare const contractCases: ConformanceCase[];
|
|
97
|
+
/** The compare-and-swap cases (`capabilities.compareAndSwap`). */
|
|
98
|
+
declare const compareAndSwapCases: ConformanceCase[];
|
|
99
|
+
/** The watch cases (`capabilities.watch`). */
|
|
100
|
+
declare const watchCases: ConformanceCase[];
|
|
101
|
+
/**
|
|
102
|
+
* The declared capabilities match the storage: an undeclared `compareAndSwap` or `watch` would skip
|
|
103
|
+
* those cases silently, and a declared one the storage lacks would fail them obscurely.
|
|
104
|
+
*/
|
|
105
|
+
declare const capabilitiesCase: ConformanceCase;
|
|
106
|
+
/**
|
|
107
|
+
* Register the full conformance suite for one driver: the base contract, plus the
|
|
108
|
+
* compare-and-swap and watch cases when `capabilities` says the driver has them.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* import { describe, expect, test } from "vitest"; // or "bun:test"
|
|
113
|
+
* import { runStorageConformance } from "@xtandard/kit/storage/testing";
|
|
114
|
+
* import { createMemoryStorage } from "@xtandard/kit/storage/memory";
|
|
115
|
+
*
|
|
116
|
+
* runStorageConformance("memory", () => createMemoryStorage(), {
|
|
117
|
+
* t: { describe, test, expect },
|
|
118
|
+
* capabilities: { compareAndSwap: true, watch: true },
|
|
119
|
+
* keyRoot: "whk",
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
declare function runStorageConformance(name: string, make: MakeStorage, options: ConformanceOptions): void;
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/storage/testing/fake-redis.d.ts
|
|
126
|
+
/** The fake's state, exposed for assertions. */
|
|
127
|
+
type FakeRedis = RedisLike & {
|
|
128
|
+
/** String and RedisJSON values by full key. */strings: Map<string, string>; /** Every PSUBSCRIBE pattern received. */
|
|
129
|
+
patterns: string[]; /** Sorted sets: member → score, by key. */
|
|
130
|
+
zsets: Map<string, Map<string, number>>;
|
|
131
|
+
};
|
|
132
|
+
/** Options for {@link fakeRedis}. */
|
|
133
|
+
interface FakeRedisOptions {
|
|
134
|
+
/**
|
|
135
|
+
* Emulate a product's own Lua scripts: return a value to answer `EVAL`, or `undefined` to fall back
|
|
136
|
+
* to the kit driver's scripts.
|
|
137
|
+
*/
|
|
138
|
+
eval?: (script: string, keys: string[], args: string[], fake: FakeRedis) => unknown;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* An in-memory node-redis look-alike: string and RedisJSON values, the driver's two Lua scripts
|
|
142
|
+
* emulated, a SCAN that yields every key twice (Redis may repeat keys), and PSUBSCRIBE with real
|
|
143
|
+
* glob matching (so an unescaped prefix would miss events).
|
|
144
|
+
*/
|
|
145
|
+
declare function fakeRedis(options?: FakeRedisOptions): FakeRedis;
|
|
146
|
+
/** Cast a fake to the `client` option type of the redis driver factories. */
|
|
147
|
+
declare const asRedisClient: (c: RedisLike) => NonNullable<RedisStorageOptions["client"]>;
|
|
148
|
+
//#endregion
|
|
149
|
+
export { type ConformanceCapabilities, type ConformanceCase, type ConformanceContext, type ConformanceMatchers, type ConformanceOptions, type ConformanceTestApi, type FakeRedis, type FakeRedisOptions, type MakeStorage, type SeedLegacy, asRedisClient, capabilitiesCase, compareAndSwapCases, contractCases, fakeRedis, requireCompareAndSwap, requireWatchable, runConformanceCases, runStorageConformance, settle, watchCases };
|
|
150
|
+
//# sourceMappingURL=entry-storage-testing.d.mts.map
|