@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,301 @@
|
|
|
1
|
+
import { i as deepEqual } from "./json-CmM1M5Kz.mjs";
|
|
2
|
+
import { mkdir, readFile, readdir, realpath, rename, rm, rmdir, unlink, writeFile } from "node:fs/promises";
|
|
3
|
+
import { existsSync, watch } from "node:fs";
|
|
4
|
+
import { dirname, join, relative, sep } from "node:path";
|
|
5
|
+
//#region src/storage/file.ts
|
|
6
|
+
/**
|
|
7
|
+
* File-system storage driver. Persists each key as a JSON file under a base directory, mirroring the
|
|
8
|
+
* `/`-delimited key layout as nested directories with a `.json` leaf. Zero dependencies
|
|
9
|
+
* (`node:fs/promises`, which works in Bun and Node).
|
|
10
|
+
*
|
|
11
|
+
* - Segments are encoded ({@link encodeSegment}) so every key maps to a distinct, safe file name on
|
|
12
|
+
* any filesystem: `Acme` / `acme` / `acmé` never collide on case- or normalization-insensitive
|
|
13
|
+
* volumes, a key can never escape the base directory, and an empty segment (`a//b`) is `%`.
|
|
14
|
+
* - Writes go to a temporary sibling and are renamed into place, so a crash never leaves a
|
|
15
|
+
* half-written file.
|
|
16
|
+
* - `compareAndSwap` is serialized per key **within this process** (an in-process lock around read →
|
|
17
|
+
* compare → write). It is not safe across processes sharing one directory; use a database driver
|
|
18
|
+
* for that.
|
|
19
|
+
* - Stores written before segment encoding (the "legacy" layout of raw segment names) are handled by
|
|
20
|
+
* the `legacy` option: ignore them, warn once, or read through to them; {@link migrateFileStorage}
|
|
21
|
+
* moves them to the encoded layout once.
|
|
22
|
+
*
|
|
23
|
+
* @module
|
|
24
|
+
*/
|
|
25
|
+
/** Suffix appended to the leaf file of every stored key. */
|
|
26
|
+
const JSON_SUFFIX = ".json";
|
|
27
|
+
/**
|
|
28
|
+
* Encode one key segment as a file name that survives case-insensitive and
|
|
29
|
+
* normalization-insensitive filesystems and never escapes its directory: uppercase letters become
|
|
30
|
+
* `^` + the lowercase letter, `^` becomes `^^`, bytes outside `[a-z0-9._~!@,=+-]` become `%XX` (of
|
|
31
|
+
* the UTF-8 encoding, so `é` never folds with `e`), a leading `.` is `%2E` (no `.`, `..` or
|
|
32
|
+
* dotfiles) and the empty segment is a lone `%`.
|
|
33
|
+
*/
|
|
34
|
+
function encodeSegment(segment) {
|
|
35
|
+
if (segment === "") return "%";
|
|
36
|
+
let out = "";
|
|
37
|
+
for (const byte of new TextEncoder().encode(segment)) {
|
|
38
|
+
const ch = String.fromCharCode(byte);
|
|
39
|
+
if (byte >= 65 && byte <= 90) out += `^${ch.toLowerCase()}`;
|
|
40
|
+
else if (ch === "^") out += "^^";
|
|
41
|
+
else if (/[a-z0-9._~!@,=+-]/.test(ch) && !(ch === "." && out === "")) out += ch;
|
|
42
|
+
else out += `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
/** Reverse {@link encodeSegment}. */
|
|
47
|
+
function decodeSegment(name) {
|
|
48
|
+
if (name === "%") return "";
|
|
49
|
+
const bytes = [];
|
|
50
|
+
for (let i = 0; i < name.length; i++) {
|
|
51
|
+
const ch = name[i];
|
|
52
|
+
if (ch === "^") {
|
|
53
|
+
const next = name[++i] ?? "";
|
|
54
|
+
bytes.push((next === "^" ? "^" : next.toUpperCase()).charCodeAt(0));
|
|
55
|
+
} else if (ch === "%") {
|
|
56
|
+
bytes.push(Number.parseInt(name.slice(i + 1, i + 3), 16));
|
|
57
|
+
i += 2;
|
|
58
|
+
} else bytes.push(ch.charCodeAt(0));
|
|
59
|
+
}
|
|
60
|
+
return new TextDecoder().decode(new Uint8Array(bytes));
|
|
61
|
+
}
|
|
62
|
+
/** Whether `name` is a file name {@link encodeSegment} produces (not a legacy raw segment). */
|
|
63
|
+
const isEncoded = (name) => encodeSegment(decodeSegment(name)) === name;
|
|
64
|
+
/** The encoded path of `key` under `dir`. */
|
|
65
|
+
const keyToPath = (dir, key) => join(dir, ...key.split("/").map(encodeSegment)) + JSON_SUFFIX;
|
|
66
|
+
/**
|
|
67
|
+
* The legacy (raw segment) path of `key`, when it differs from the encoded one. Keys with an empty
|
|
68
|
+
* segment have none: the legacy layout collapsed `a//b` onto `a/b`, so reading through would alias
|
|
69
|
+
* another key.
|
|
70
|
+
*/
|
|
71
|
+
function legacyPath(dir, key) {
|
|
72
|
+
const segments = key.split("/");
|
|
73
|
+
if (segments.includes("")) return void 0;
|
|
74
|
+
const path = join(dir, ...segments) + JSON_SUFFIX;
|
|
75
|
+
return path === keyToPath(dir, key) ? void 0 : path;
|
|
76
|
+
}
|
|
77
|
+
/** The `dir`-relative segments of a `.json` leaf under `dir`, or `null`. */
|
|
78
|
+
function leafSegments(dir, filePath) {
|
|
79
|
+
const rel = relative(dir, filePath);
|
|
80
|
+
if (rel === "" || rel.startsWith("..") || !rel.endsWith(JSON_SUFFIX)) return null;
|
|
81
|
+
return rel.slice(0, -5).split(sep);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The key of a leaf: `{ key, legacy: false }` in the encoded layout, `{ key, legacy: true }` when
|
|
85
|
+
* some segment is a raw legacy name (raw segments are taken verbatim; encoded ones, such as the
|
|
86
|
+
* all-lowercase `app`, decode to themselves), or `null` for a non-leaf.
|
|
87
|
+
*/
|
|
88
|
+
function leafKey(dir, filePath) {
|
|
89
|
+
const segments = leafSegments(dir, filePath);
|
|
90
|
+
if (!segments) return null;
|
|
91
|
+
const legacy = !segments.every(isEncoded);
|
|
92
|
+
return {
|
|
93
|
+
key: segments.map((s) => legacy && !isEncoded(s) ? s : decodeSegment(s)).join("/"),
|
|
94
|
+
legacy
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Whether `path` (under `dir`) exists with exactly this spelling. On a case-insensitive filesystem
|
|
99
|
+
* `app/acme.json` would otherwise open the legacy `app/Acme.json` (and vice versa); `realpath`
|
|
100
|
+
* returns the on-disk spelling.
|
|
101
|
+
*/
|
|
102
|
+
async function existsExactly(dir, path) {
|
|
103
|
+
try {
|
|
104
|
+
return relative(await realpath(dir), await realpath(path)) === relative(dir, path);
|
|
105
|
+
} catch {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** Recursively collect every `.json` leaf file path under `root`. */
|
|
110
|
+
async function walk(root) {
|
|
111
|
+
const out = [];
|
|
112
|
+
let entries;
|
|
113
|
+
try {
|
|
114
|
+
entries = await readdir(root, { withFileTypes: true });
|
|
115
|
+
} catch (err) {
|
|
116
|
+
if (err.code === "ENOENT") return out;
|
|
117
|
+
throw err;
|
|
118
|
+
}
|
|
119
|
+
for (const entry of entries) {
|
|
120
|
+
const name = entry.name.toString();
|
|
121
|
+
const full = join(root, name);
|
|
122
|
+
if (entry.isDirectory()) out.push(...await walk(full));
|
|
123
|
+
else if (entry.isFile() && name.endsWith(JSON_SUFFIX)) out.push(full);
|
|
124
|
+
}
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
127
|
+
async function readIfExists(path) {
|
|
128
|
+
try {
|
|
129
|
+
return await readFile(path, "utf8");
|
|
130
|
+
} catch (err) {
|
|
131
|
+
if (err.code === "ENOENT") return null;
|
|
132
|
+
throw err;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async function unlinkIfExists(path) {
|
|
136
|
+
try {
|
|
137
|
+
await unlink(path);
|
|
138
|
+
} catch (err) {
|
|
139
|
+
if (err.code !== "ENOENT") throw err;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const defaultOnLegacy = (dir) => {
|
|
143
|
+
console.warn(`[@xtandard/kit] storage/file: ${dir} has files in the legacy (unencoded) layout, which are ignored; run migrateFileStorage({ dir }) once to move them.`);
|
|
144
|
+
};
|
|
145
|
+
let tmpCounter = 0;
|
|
146
|
+
/**
|
|
147
|
+
* Create a file-backed {@link FileKvStorage}. Values are pretty-printed JSON. `watch` uses a
|
|
148
|
+
* recursive `fs.watch` on the base directory; it is best-effort and may coalesce or miss events on
|
|
149
|
+
* platforms without recursive-watch support. A `rename` event is reported as `remove` only when the
|
|
150
|
+
* file is actually gone.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* import { createFileStorage } from "@xtandard/kit/storage/file";
|
|
155
|
+
*
|
|
156
|
+
* const storage = createFileStorage({ dir: "./data" });
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
function createFileStorage(options) {
|
|
160
|
+
const { dir, legacy = "ignore", onLegacy = defaultOnLegacy } = options;
|
|
161
|
+
const readThrough = legacy === "read-through";
|
|
162
|
+
let warnedLegacy = false;
|
|
163
|
+
/** Per-key promise chains: every write to a key runs after the previous one. */
|
|
164
|
+
const locks = /* @__PURE__ */ new Map();
|
|
165
|
+
function withLock(key, fn) {
|
|
166
|
+
const run = (locks.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
167
|
+
const tail = run.catch(() => {});
|
|
168
|
+
locks.set(key, tail);
|
|
169
|
+
tail.then(() => {
|
|
170
|
+
if (locks.get(key) === tail) locks.delete(key);
|
|
171
|
+
});
|
|
172
|
+
return run;
|
|
173
|
+
}
|
|
174
|
+
async function legacyIfExists(key) {
|
|
175
|
+
if (!readThrough) return void 0;
|
|
176
|
+
const path = legacyPath(dir, key);
|
|
177
|
+
return path && await existsExactly(dir, path) ? path : void 0;
|
|
178
|
+
}
|
|
179
|
+
async function read(key) {
|
|
180
|
+
const path = keyToPath(dir, key);
|
|
181
|
+
let raw = await readIfExists(path);
|
|
182
|
+
if (raw !== null && readThrough && !await existsExactly(dir, path)) raw = null;
|
|
183
|
+
if (raw === null) {
|
|
184
|
+
const path = await legacyIfExists(key);
|
|
185
|
+
if (path) raw = await readIfExists(path);
|
|
186
|
+
}
|
|
187
|
+
return raw === null ? null : JSON.parse(raw);
|
|
188
|
+
}
|
|
189
|
+
async function removeLegacy(key) {
|
|
190
|
+
const path = await legacyIfExists(key);
|
|
191
|
+
if (path) await unlinkIfExists(path);
|
|
192
|
+
}
|
|
193
|
+
async function write(key, value) {
|
|
194
|
+
const path = keyToPath(dir, key);
|
|
195
|
+
await mkdir(dirname(path), { recursive: true });
|
|
196
|
+
const tmp = `${path}.${process.pid}.${tmpCounter++}.tmp`;
|
|
197
|
+
await writeFile(tmp, JSON.stringify(value, null, 2), "utf8");
|
|
198
|
+
await rename(tmp, path);
|
|
199
|
+
await removeLegacy(key);
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
getItem: read,
|
|
203
|
+
async setItem(key, value) {
|
|
204
|
+
await withLock(key, () => write(key, value));
|
|
205
|
+
},
|
|
206
|
+
async removeItem(key) {
|
|
207
|
+
await withLock(key, async () => {
|
|
208
|
+
await unlinkIfExists(keyToPath(dir, key));
|
|
209
|
+
await removeLegacy(key);
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
async getKeys(prefix) {
|
|
213
|
+
const out = /* @__PURE__ */ new Set();
|
|
214
|
+
for (const file of await walk(dir)) {
|
|
215
|
+
const leaf = leafKey(dir, file);
|
|
216
|
+
if (!leaf) continue;
|
|
217
|
+
if (leaf.legacy && !readThrough) {
|
|
218
|
+
if (legacy === "warn" && !warnedLegacy) {
|
|
219
|
+
warnedLegacy = true;
|
|
220
|
+
onLegacy(dir);
|
|
221
|
+
}
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (leaf.key.startsWith(prefix)) out.add(leaf.key);
|
|
225
|
+
}
|
|
226
|
+
return [...out];
|
|
227
|
+
},
|
|
228
|
+
async compareAndSwap(input) {
|
|
229
|
+
return withLock(input.key, async () => {
|
|
230
|
+
if (!deepEqual(await read(input.key), input.expected)) return false;
|
|
231
|
+
await write(input.key, input.next);
|
|
232
|
+
return true;
|
|
233
|
+
});
|
|
234
|
+
},
|
|
235
|
+
async watch(prefix, callback) {
|
|
236
|
+
await mkdir(dir, { recursive: true });
|
|
237
|
+
const watcher = watch(dir, { recursive: true }, (eventType, filename) => {
|
|
238
|
+
if (!filename) return;
|
|
239
|
+
const full = join(dir, filename.toString());
|
|
240
|
+
const leaf = leafKey(dir, full);
|
|
241
|
+
if (!leaf || leaf.legacy && !readThrough || !leaf.key.startsWith(prefix)) return;
|
|
242
|
+
callback({
|
|
243
|
+
type: eventType === "rename" && !existsSync(full) ? "remove" : "update",
|
|
244
|
+
key: leaf.key
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
return () => watcher.close();
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* One-time upgrade of a store in the legacy layout (raw key segments as file names, so keys
|
|
253
|
+
* differing only by case shared a file on case-insensitive filesystems). Moves every leaf that is
|
|
254
|
+
* not in the encoded layout to its {@link encodeSegment} path and removes the emptied directories.
|
|
255
|
+
* Idempotent; run it with no writer on the store. Resolves how many keys moved.
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* import { migrateFileStorage } from "@xtandard/kit/storage/file";
|
|
260
|
+
*
|
|
261
|
+
* await migrateFileStorage({ dir: "./data" });
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
async function migrateFileStorage(options) {
|
|
265
|
+
const { dir } = options;
|
|
266
|
+
let moved = 0;
|
|
267
|
+
const emptied = /* @__PURE__ */ new Set();
|
|
268
|
+
for (const file of await walk(dir)) {
|
|
269
|
+
const leaf = leafKey(dir, file);
|
|
270
|
+
if (!leaf?.legacy) continue;
|
|
271
|
+
const target = keyToPath(dir, leaf.key);
|
|
272
|
+
await mkdir(dirname(target), { recursive: true });
|
|
273
|
+
await writeFile(target, await readFile(file, "utf8"), "utf8");
|
|
274
|
+
await unlink(file);
|
|
275
|
+
emptied.add(dirname(file));
|
|
276
|
+
moved++;
|
|
277
|
+
}
|
|
278
|
+
for (let d of [...emptied].sort((a, b) => b.length - a.length)) while (d !== dir && !relative(dir, d).startsWith("..")) {
|
|
279
|
+
try {
|
|
280
|
+
await rmdir(d);
|
|
281
|
+
} catch {
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
d = dirname(d);
|
|
285
|
+
}
|
|
286
|
+
return { moved };
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Delete every file written by a {@link createFileStorage} instance by removing its base directory.
|
|
290
|
+
* Exposed for tests and cleanup tooling.
|
|
291
|
+
*/
|
|
292
|
+
async function clearFileStorage(options) {
|
|
293
|
+
await rm(options.dir, {
|
|
294
|
+
recursive: true,
|
|
295
|
+
force: true
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
//#endregion
|
|
299
|
+
export { clearFileStorage, createFileStorage, decodeSegment, encodeSegment, migrateFileStorage };
|
|
300
|
+
|
|
301
|
+
//# sourceMappingURL=entry-storage-file.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-storage-file.mjs","names":["fsWatch"],"sources":["../src/storage/file.ts"],"sourcesContent":["/**\n * File-system storage driver. Persists each key as a JSON file under a base directory, mirroring the\n * `/`-delimited key layout as nested directories with a `.json` leaf. Zero dependencies\n * (`node:fs/promises`, which works in Bun and Node).\n *\n * - Segments are encoded ({@link encodeSegment}) so every key maps to a distinct, safe file name on\n * any filesystem: `Acme` / `acme` / `acmé` never collide on case- or normalization-insensitive\n * volumes, a key can never escape the base directory, and an empty segment (`a//b`) is `%`.\n * - Writes go to a temporary sibling and are renamed into place, so a crash never leaves a\n * half-written file.\n * - `compareAndSwap` is serialized per key **within this process** (an in-process lock around read →\n * compare → write). It is not safe across processes sharing one directory; use a database driver\n * for that.\n * - Stores written before segment encoding (the \"legacy\" layout of raw segment names) are handled by\n * the `legacy` option: ignore them, warn once, or read through to them; {@link migrateFileStorage}\n * moves them to the encoded layout once.\n *\n * @module\n */\n\nimport { existsSync, watch as fsWatch } from \"node:fs\";\nimport type { Dirent } from \"node:fs\";\nimport {\n mkdir,\n readdir,\n readFile,\n realpath,\n rename,\n rm,\n rmdir,\n unlink,\n writeFile,\n} from \"node:fs/promises\";\nimport { dirname, join, relative, sep } from \"node:path\";\nimport { deepEqual } from \"../internal/json.ts\";\nimport type {\n CompareAndSwapInput,\n CompareAndSwapKvStorage,\n StorageChangeEvent,\n WatchableKvStorage,\n} from \"./contract.ts\";\n\n/**\n * How {@link createFileStorage} treats leaves in the legacy (pre-encoding, raw segment) layout:\n *\n * - `\"ignore\"` (default): they are invisible;\n * - `\"warn\"`: invisible, and `onLegacy` is called once (by default a `console.warn` that points at\n * {@link migrateFileStorage});\n * - `\"read-through\"`: `getItem` falls back to the legacy file when the encoded one is missing,\n * `getKeys` lists legacy leaves too, and the next write or remove of that key deletes the legacy\n * file.\n */\nexport type FileLegacyMode = \"ignore\" | \"warn\" | \"read-through\";\n\n/** Options for {@link createFileStorage}. */\nexport interface FileStorageOptions {\n /** Base directory under which key files are written. Created on demand. */\n dir: string;\n /** How to treat leaves in the legacy raw-segment layout. Default `\"ignore\"`. */\n legacy?: FileLegacyMode;\n /**\n * Called once per storage instance when `legacy: \"warn\"` meets a legacy leaf. Products pass their\n * own message (it names the product and the release that wrote the legacy layout).\n */\n onLegacy?: (dir: string) => void;\n}\n\n/** The file storage: watchable and (in-process) compare-and-swap capable. */\nexport type FileKvStorage = WatchableKvStorage & CompareAndSwapKvStorage;\n\n/** Suffix appended to the leaf file of every stored key. */\nconst JSON_SUFFIX = \".json\";\n\n/**\n * Encode one key segment as a file name that survives case-insensitive and\n * normalization-insensitive filesystems and never escapes its directory: uppercase letters become\n * `^` + the lowercase letter, `^` becomes `^^`, bytes outside `[a-z0-9._~!@,=+-]` become `%XX` (of\n * the UTF-8 encoding, so `é` never folds with `e`), a leading `.` is `%2E` (no `.`, `..` or\n * dotfiles) and the empty segment is a lone `%`.\n */\nexport function encodeSegment(segment: string): string {\n if (segment === \"\") return \"%\";\n let out = \"\";\n for (const byte of new TextEncoder().encode(segment)) {\n const ch = String.fromCharCode(byte);\n if (byte >= 0x41 && byte <= 0x5a) out += `^${ch.toLowerCase()}`;\n else if (ch === \"^\") out += \"^^\";\n else if (/[a-z0-9._~!@,=+-]/.test(ch) && !(ch === \".\" && out === \"\")) out += ch;\n else out += `%${byte.toString(16).toUpperCase().padStart(2, \"0\")}`;\n }\n return out;\n}\n\n/** Reverse {@link encodeSegment}. */\nexport function decodeSegment(name: string): string {\n if (name === \"%\") return \"\";\n const bytes: number[] = [];\n for (let i = 0; i < name.length; i++) {\n const ch = name[i] as string;\n if (ch === \"^\") {\n const next = name[++i] ?? \"\";\n bytes.push((next === \"^\" ? \"^\" : next.toUpperCase()).charCodeAt(0));\n } else if (ch === \"%\") {\n bytes.push(Number.parseInt(name.slice(i + 1, i + 3), 16));\n i += 2;\n } else bytes.push(ch.charCodeAt(0));\n }\n return new TextDecoder().decode(new Uint8Array(bytes));\n}\n\n/** Whether `name` is a file name {@link encodeSegment} produces (not a legacy raw segment). */\nconst isEncoded = (name: string): boolean => encodeSegment(decodeSegment(name)) === name;\n\n/** The encoded path of `key` under `dir`. */\nconst keyToPath = (dir: string, key: string): string =>\n join(dir, ...key.split(\"/\").map(encodeSegment)) + JSON_SUFFIX;\n\n/**\n * The legacy (raw segment) path of `key`, when it differs from the encoded one. Keys with an empty\n * segment have none: the legacy layout collapsed `a//b` onto `a/b`, so reading through would alias\n * another key.\n */\nfunction legacyPath(dir: string, key: string): string | undefined {\n const segments = key.split(\"/\");\n if (segments.includes(\"\")) return undefined;\n const path = join(dir, ...segments) + JSON_SUFFIX;\n return path === keyToPath(dir, key) ? undefined : path;\n}\n\n/** The `dir`-relative segments of a `.json` leaf under `dir`, or `null`. */\nfunction leafSegments(dir: string, filePath: string): string[] | null {\n const rel = relative(dir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || !rel.endsWith(JSON_SUFFIX)) return null;\n return rel.slice(0, -JSON_SUFFIX.length).split(sep);\n}\n\n/**\n * The key of a leaf: `{ key, legacy: false }` in the encoded layout, `{ key, legacy: true }` when\n * some segment is a raw legacy name (raw segments are taken verbatim; encoded ones, such as the\n * all-lowercase `app`, decode to themselves), or `null` for a non-leaf.\n */\nfunction leafKey(dir: string, filePath: string): { key: string; legacy: boolean } | null {\n const segments = leafSegments(dir, filePath);\n if (!segments) return null;\n const legacy = !segments.every(isEncoded);\n return {\n key: segments.map((s) => (legacy && !isEncoded(s) ? s : decodeSegment(s))).join(\"/\"),\n legacy,\n };\n}\n\n/**\n * Whether `path` (under `dir`) exists with exactly this spelling. On a case-insensitive filesystem\n * `app/acme.json` would otherwise open the legacy `app/Acme.json` (and vice versa); `realpath`\n * returns the on-disk spelling.\n */\nasync function existsExactly(dir: string, path: string): Promise<boolean> {\n try {\n return relative(await realpath(dir), await realpath(path)) === relative(dir, path);\n } catch {\n return false;\n }\n}\n\n/** Recursively collect every `.json` leaf file path under `root`. */\nasync function walk(root: string): Promise<string[]> {\n const out: string[] = [];\n let entries: Dirent[];\n try {\n entries = (await readdir(root, { withFileTypes: true })) as Dirent[];\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return out;\n throw err;\n }\n for (const entry of entries) {\n const name = entry.name.toString();\n const full = join(root, name);\n if (entry.isDirectory()) out.push(...(await walk(full)));\n else if (entry.isFile() && name.endsWith(JSON_SUFFIX)) out.push(full);\n }\n return out;\n}\n\nasync function readIfExists(path: string): Promise<string | null> {\n try {\n return await readFile(path, \"utf8\");\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return null;\n throw err;\n }\n}\n\nasync function unlinkIfExists(path: string): Promise<void> {\n try {\n await unlink(path);\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== \"ENOENT\") throw err;\n }\n}\n\nconst defaultOnLegacy = (dir: string): void => {\n console.warn(\n `[@xtandard/kit] storage/file: ${dir} has files in the legacy (unencoded) layout, which are ` +\n \"ignored; run migrateFileStorage({ dir }) once to move them.\",\n );\n};\n\nlet tmpCounter = 0;\n\n/**\n * Create a file-backed {@link FileKvStorage}. Values are pretty-printed JSON. `watch` uses a\n * recursive `fs.watch` on the base directory; it is best-effort and may coalesce or miss events on\n * platforms without recursive-watch support. A `rename` event is reported as `remove` only when the\n * file is actually gone.\n *\n * @example\n * ```ts\n * import { createFileStorage } from \"@xtandard/kit/storage/file\";\n *\n * const storage = createFileStorage({ dir: \"./data\" });\n * ```\n */\nexport function createFileStorage(options: FileStorageOptions): FileKvStorage {\n const { dir, legacy = \"ignore\", onLegacy = defaultOnLegacy } = options;\n const readThrough = legacy === \"read-through\";\n let warnedLegacy = false;\n /** Per-key promise chains: every write to a key runs after the previous one. */\n const locks = new Map<string, Promise<unknown>>();\n\n function withLock<T>(key: string, fn: () => Promise<T>): Promise<T> {\n const run = (locks.get(key) ?? Promise.resolve()).then(fn, fn);\n const tail = run.catch(() => {});\n locks.set(key, tail);\n void tail.then(() => {\n if (locks.get(key) === tail) locks.delete(key);\n });\n return run;\n }\n\n async function legacyIfExists(key: string): Promise<string | undefined> {\n if (!readThrough) return undefined;\n const path = legacyPath(dir, key);\n return path && (await existsExactly(dir, path)) ? path : undefined;\n }\n\n async function read<T>(key: string): Promise<T | null> {\n const path = keyToPath(dir, key);\n let raw = await readIfExists(path);\n // With legacy files around, the encoded path may resolve to a legacy file of another case.\n if (raw !== null && readThrough && !(await existsExactly(dir, path))) raw = null;\n if (raw === null) {\n const path = await legacyIfExists(key);\n if (path) raw = await readIfExists(path);\n }\n return raw === null ? null : (JSON.parse(raw) as T);\n }\n\n async function removeLegacy(key: string): Promise<void> {\n const path = await legacyIfExists(key);\n if (path) await unlinkIfExists(path);\n }\n\n async function write(key: string, value: unknown): Promise<void> {\n const path = keyToPath(dir, key);\n await mkdir(dirname(path), { recursive: true });\n // Write-then-rename: readers never observe a partially written file.\n const tmp = `${path}.${process.pid}.${tmpCounter++}.tmp`;\n await writeFile(tmp, JSON.stringify(value, null, 2), \"utf8\");\n await rename(tmp, path);\n await removeLegacy(key);\n }\n\n return {\n getItem: read,\n\n async setItem<T>(key: string, value: T): Promise<void> {\n await withLock(key, () => write(key, value));\n },\n\n async removeItem(key: string): Promise<void> {\n await withLock(key, async () => {\n await unlinkIfExists(keyToPath(dir, key));\n await removeLegacy(key);\n });\n },\n\n async getKeys(prefix: string): Promise<string[]> {\n // A Set: in read-through mode a legacy leaf and its encoded twin are the same key.\n const out = new Set<string>();\n for (const file of await walk(dir)) {\n const leaf = leafKey(dir, file);\n if (!leaf) continue;\n if (leaf.legacy && !readThrough) {\n if (legacy === \"warn\" && !warnedLegacy) {\n warnedLegacy = true;\n onLegacy(dir);\n }\n continue;\n }\n if (leaf.key.startsWith(prefix)) out.add(leaf.key);\n }\n return [...out];\n },\n\n async compareAndSwap<T>(input: CompareAndSwapInput<T>): Promise<boolean> {\n return withLock(input.key, async () => {\n if (!deepEqual(await read<T>(input.key), input.expected)) return false;\n await write(input.key, input.next);\n return true;\n });\n },\n\n async watch(\n prefix: string,\n callback: (event: StorageChangeEvent) => void,\n ): Promise<() => void> {\n // Ensure the watched root exists so fs.watch does not throw on a fresh dir.\n await mkdir(dir, { recursive: true });\n const watcher = fsWatch(dir, { recursive: true }, (eventType, filename) => {\n if (!filename) return;\n const full = join(dir, filename.toString());\n const leaf = leafKey(dir, full);\n if (!leaf || (leaf.legacy && !readThrough) || !leaf.key.startsWith(prefix)) return;\n // `rename` covers creation, deletion and our write-then-rename: report \"remove\" only when\n // the file is actually gone.\n const type: StorageChangeEvent[\"type\"] =\n eventType === \"rename\" && !existsSync(full) ? \"remove\" : \"update\";\n callback({ type, key: leaf.key });\n });\n return () => watcher.close();\n },\n };\n}\n\n/**\n * One-time upgrade of a store in the legacy layout (raw key segments as file names, so keys\n * differing only by case shared a file on case-insensitive filesystems). Moves every leaf that is\n * not in the encoded layout to its {@link encodeSegment} path and removes the emptied directories.\n * Idempotent; run it with no writer on the store. Resolves how many keys moved.\n *\n * @example\n * ```ts\n * import { migrateFileStorage } from \"@xtandard/kit/storage/file\";\n *\n * await migrateFileStorage({ dir: \"./data\" });\n * ```\n */\nexport async function migrateFileStorage(\n options: Pick<FileStorageOptions, \"dir\">,\n): Promise<{ moved: number }> {\n const { dir } = options;\n let moved = 0;\n const emptied = new Set<string>();\n for (const file of await walk(dir)) {\n const leaf = leafKey(dir, file);\n if (!leaf?.legacy) continue;\n const target = keyToPath(dir, leaf.key);\n await mkdir(dirname(target), { recursive: true });\n await writeFile(target, await readFile(file, \"utf8\"), \"utf8\");\n await unlink(file);\n emptied.add(dirname(file));\n moved++;\n }\n // Remove legacy directories left empty, deepest first, up to (not including) dir.\n for (let d of [...emptied].sort((a, b) => b.length - a.length)) {\n while (d !== dir && !relative(dir, d).startsWith(\"..\")) {\n try {\n await rmdir(d);\n } catch {\n break; // not empty (or already gone)\n }\n d = dirname(d);\n }\n }\n return { moved };\n}\n\n/**\n * Delete every file written by a {@link createFileStorage} instance by removing its base directory.\n * Exposed for tests and cleanup tooling.\n */\nexport async function clearFileStorage(options: Pick<FileStorageOptions, \"dir\">): Promise<void> {\n await rm(options.dir, { recursive: true, force: true });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,MAAM,cAAc;;;;;;;;AASpB,SAAgB,cAAc,SAAyB;CACrD,IAAI,YAAY,IAAI,OAAO;CAC3B,IAAI,MAAM;CACV,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE,OAAO,OAAO,GAAG;EACpD,MAAM,KAAK,OAAO,aAAa,IAAI;EACnC,IAAI,QAAQ,MAAQ,QAAQ,IAAM,OAAO,IAAI,GAAG,YAAY;OACvD,IAAI,OAAO,KAAK,OAAO;OACvB,IAAI,oBAAoB,KAAK,EAAE,KAAK,EAAE,OAAO,OAAO,QAAQ,KAAK,OAAO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@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_kv_sqlite = require("./kv-sqlite-CHOdIMJ-.cjs");
|
|
3
|
+
const require_libsql = require("./libsql-CiBfVtbS.cjs");
|
|
4
|
+
exports.libsqlConnection = require_libsql.libsqlConnection;
|
|
5
|
+
exports.libsqlExecutor = require_libsql.libsqlExecutor;
|
|
6
|
+
exports.sqliteKvSchema = require_kv_sqlite.sqliteKvSchema;
|
|
7
|
+
exports.sqliteKvStorage = require_kv_sqlite.sqliteKvStorage;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { i as sqliteKvStorage, n as SqliteRow, r as sqliteKvSchema, t as SqliteExecutor } from "./kv-sqlite-B6iTLOx2.cjs";
|
|
2
|
+
import { n as LibsqlConnection, o as libsqlConnection, s as libsqlExecutor, t as LibsqlClientLike } from "./libsql-BZmRZIqt.cjs";
|
|
3
|
+
export { type LibsqlClientLike, type LibsqlConnection, type SqliteExecutor, type SqliteRow, libsqlConnection, libsqlExecutor, sqliteKvSchema, sqliteKvStorage };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { i as sqliteKvStorage, n as SqliteRow, r as sqliteKvSchema, t as SqliteExecutor } from "./kv-sqlite-Tx4UedJs.mjs";
|
|
2
|
+
import { n as LibsqlConnection, o as libsqlConnection, s as libsqlExecutor, t as LibsqlClientLike } from "./libsql-0160BubR.mjs";
|
|
3
|
+
export { type LibsqlClientLike, type LibsqlConnection, type SqliteExecutor, type SqliteRow, libsqlConnection, libsqlExecutor, sqliteKvSchema, sqliteKvStorage };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_json = require("./json-CM7TwYQ7.cjs");
|
|
3
|
+
//#region src/storage/memory.ts
|
|
4
|
+
/**
|
|
5
|
+
* In-memory storage driver. Zero deps; for tests, dev and single-process apps. Values are
|
|
6
|
+
* deep-cloned on write and read so callers cannot mutate stored state by reference.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
const clone = (value) => value === void 0 ? value : structuredClone(value);
|
|
11
|
+
/**
|
|
12
|
+
* Create an in-memory {@link MemoryKvStorage}. `watch` callbacks fire on the next microtask after a
|
|
13
|
+
* write or remove; `compareAndSwap` compares structurally (own properties, key order ignored) and
|
|
14
|
+
* is race-free in-process.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { createMemoryStorage } from "@xtandard/kit/storage/memory";
|
|
19
|
+
*
|
|
20
|
+
* const storage = createMemoryStorage({ initial: { "app/config": { theme: "dark" } } });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function createMemoryStorage(options = {}) {
|
|
24
|
+
const map = /* @__PURE__ */ new Map();
|
|
25
|
+
for (const [key, value] of Object.entries(options.initial ?? {})) map.set(key, clone(value));
|
|
26
|
+
const { onWrite } = options;
|
|
27
|
+
const watchers = /* @__PURE__ */ new Set();
|
|
28
|
+
const notify = (event) => {
|
|
29
|
+
for (const w of watchers) if (event.key.startsWith(w.prefix)) queueMicrotask(() => w.cb(event));
|
|
30
|
+
};
|
|
31
|
+
async function write(key, value) {
|
|
32
|
+
map.set(key, clone(value));
|
|
33
|
+
notify({
|
|
34
|
+
type: "update",
|
|
35
|
+
key
|
|
36
|
+
});
|
|
37
|
+
await onWrite?.(key, clone(value));
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
async getItem(key) {
|
|
41
|
+
return map.has(key) ? clone(map.get(key)) : null;
|
|
42
|
+
},
|
|
43
|
+
async setItem(key, value) {
|
|
44
|
+
await write(key, value);
|
|
45
|
+
},
|
|
46
|
+
async removeItem(key) {
|
|
47
|
+
if (map.delete(key)) notify({
|
|
48
|
+
type: "remove",
|
|
49
|
+
key
|
|
50
|
+
});
|
|
51
|
+
await onWrite?.(key, null);
|
|
52
|
+
},
|
|
53
|
+
async getKeys(prefix) {
|
|
54
|
+
const out = [];
|
|
55
|
+
for (const key of map.keys()) if (key.startsWith(prefix)) out.push(key);
|
|
56
|
+
return out;
|
|
57
|
+
},
|
|
58
|
+
async watch(prefix, cb) {
|
|
59
|
+
const entry = {
|
|
60
|
+
prefix,
|
|
61
|
+
cb
|
|
62
|
+
};
|
|
63
|
+
watchers.add(entry);
|
|
64
|
+
return () => {
|
|
65
|
+
watchers.delete(entry);
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
async compareAndSwap(input) {
|
|
69
|
+
if (!require_json.deepEqual(map.has(input.key) ? map.get(input.key) : null, input.expected)) return false;
|
|
70
|
+
await write(input.key, input.next);
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
exports.createMemoryStorage = createMemoryStorage;
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=entry-storage-memory.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-storage-memory.cjs","names":["deepEqual"],"sources":["../src/storage/memory.ts"],"sourcesContent":["/**\n * In-memory storage driver. Zero deps; for tests, dev and single-process apps. Values are\n * deep-cloned on write and read so callers cannot mutate stored state by reference.\n *\n * @module\n */\n\nimport { deepEqual } from \"../internal/json.ts\";\nimport type {\n CompareAndSwapInput,\n CompareAndSwapKvStorage,\n StorageChangeEvent,\n WatchableKvStorage,\n} from \"./contract.ts\";\n\n/**\n * A write hook (ADR 0004): called after every successful write with the key and the new value, or\n * `null` after a remove (whether or not the key existed). Products mirror keys into their own\n * indexes with it (wh mirrors due keys for `claimDue`). An error thrown by the hook rejects the\n * write call; the write itself has already happened.\n */\nexport type MemoryWriteHook = (key: string, value: unknown) => void | Promise<void>;\n\n/** Options for {@link createMemoryStorage}. */\nexport interface MemoryStorageOptions {\n /** Optional seed data (key → value). Seeding does not call `onWrite`. */\n initial?: Record<string, unknown>;\n /** Called after every write and remove; see {@link MemoryWriteHook}. */\n onWrite?: MemoryWriteHook;\n}\n\n/** The memory storage: watchable and compare-and-swap capable. */\nexport type MemoryKvStorage = WatchableKvStorage & CompareAndSwapKvStorage;\n\nconst clone = <T>(value: T): T => (value === undefined ? value : structuredClone(value));\n\n/**\n * Create an in-memory {@link MemoryKvStorage}. `watch` callbacks fire on the next microtask after a\n * write or remove; `compareAndSwap` compares structurally (own properties, key order ignored) and\n * is race-free in-process.\n *\n * @example\n * ```ts\n * import { createMemoryStorage } from \"@xtandard/kit/storage/memory\";\n *\n * const storage = createMemoryStorage({ initial: { \"app/config\": { theme: \"dark\" } } });\n * ```\n */\nexport function createMemoryStorage(options: MemoryStorageOptions = {}): MemoryKvStorage {\n const map = new Map<string, unknown>();\n for (const [key, value] of Object.entries(options.initial ?? {})) map.set(key, clone(value));\n const { onWrite } = options;\n\n const watchers = new Set<{ prefix: string; cb: (event: StorageChangeEvent) => void }>();\n const notify = (event: StorageChangeEvent): void => {\n for (const w of watchers) if (event.key.startsWith(w.prefix)) queueMicrotask(() => w.cb(event));\n };\n\n async function write(key: string, value: unknown): Promise<void> {\n map.set(key, clone(value));\n notify({ type: \"update\", key });\n await onWrite?.(key, clone(value));\n }\n\n return {\n async getItem<T>(key: string): Promise<T | null> {\n return map.has(key) ? clone(map.get(key) as T) : null;\n },\n async setItem<T>(key: string, value: T): Promise<void> {\n await write(key, value);\n },\n async removeItem(key: string): Promise<void> {\n if (map.delete(key)) notify({ type: \"remove\", key });\n await onWrite?.(key, null);\n },\n async getKeys(prefix: string): Promise<string[]> {\n const out: string[] = [];\n for (const key of map.keys()) if (key.startsWith(prefix)) out.push(key);\n return out;\n },\n async watch(prefix, cb): Promise<() => void> {\n const entry = { prefix, cb };\n watchers.add(entry);\n return () => {\n watchers.delete(entry);\n };\n },\n async compareAndSwap<T>(input: CompareAndSwapInput<T>): Promise<boolean> {\n const current = map.has(input.key) ? map.get(input.key) : null;\n if (!deepEqual(current, input.expected))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AG;GAC3B,SAAS,IAAI,KAAK;GAClB,aAAa;IACX,SAAS,OAAO,KAAK;GACvB;EACF;EACA,MAAM,eAAkB,OAAiD;GAEvE,IAAI,CAACA,aAAAA,UADW,IAAI,IAAI,MAAM,GAAG,IAAI,IAAI,IAAI,MAAM,GAAG,IAAI,MAClC,MAAM,QAAQ,GAAG,OAAO;GAChD,MAAM,MAAM,MAAM,KAAK,MAAM,IAAI;GACjC,OAAO;EACT;CACF;AACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { n as CompareAndSwapKvStorage, o as WatchableKvStorage } from "./contract-BvgtswLX.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/storage/memory.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A write hook (ADR 0004): called after every successful write with the key and the new value, or
|
|
6
|
+
* `null` after a remove (whether or not the key existed). Products mirror keys into their own
|
|
7
|
+
* indexes with it (wh mirrors due keys for `claimDue`). An error thrown by the hook rejects the
|
|
8
|
+
* write call; the write itself has already happened.
|
|
9
|
+
*/
|
|
10
|
+
type MemoryWriteHook = (key: string, value: unknown) => void | Promise<void>;
|
|
11
|
+
/** Options for {@link createMemoryStorage}. */
|
|
12
|
+
interface MemoryStorageOptions {
|
|
13
|
+
/** Optional seed data (key → value). Seeding does not call `onWrite`. */
|
|
14
|
+
initial?: Record<string, unknown>;
|
|
15
|
+
/** Called after every write and remove; see {@link MemoryWriteHook}. */
|
|
16
|
+
onWrite?: MemoryWriteHook;
|
|
17
|
+
}
|
|
18
|
+
/** The memory storage: watchable and compare-and-swap capable. */
|
|
19
|
+
type MemoryKvStorage = WatchableKvStorage & CompareAndSwapKvStorage;
|
|
20
|
+
/**
|
|
21
|
+
* Create an in-memory {@link MemoryKvStorage}. `watch` callbacks fire on the next microtask after a
|
|
22
|
+
* write or remove; `compareAndSwap` compares structurally (own properties, key order ignored) and
|
|
23
|
+
* is race-free in-process.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { createMemoryStorage } from "@xtandard/kit/storage/memory";
|
|
28
|
+
*
|
|
29
|
+
* const storage = createMemoryStorage({ initial: { "app/config": { theme: "dark" } } });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare function createMemoryStorage(options?: MemoryStorageOptions): MemoryKvStorage;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { type MemoryKvStorage, type MemoryStorageOptions, type MemoryWriteHook, createMemoryStorage };
|
|
35
|
+
//# sourceMappingURL=entry-storage-memory.d.cts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { n as CompareAndSwapKvStorage, o as WatchableKvStorage } from "./contract-BvgtswLX.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/storage/memory.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A write hook (ADR 0004): called after every successful write with the key and the new value, or
|
|
6
|
+
* `null` after a remove (whether or not the key existed). Products mirror keys into their own
|
|
7
|
+
* indexes with it (wh mirrors due keys for `claimDue`). An error thrown by the hook rejects the
|
|
8
|
+
* write call; the write itself has already happened.
|
|
9
|
+
*/
|
|
10
|
+
type MemoryWriteHook = (key: string, value: unknown) => void | Promise<void>;
|
|
11
|
+
/** Options for {@link createMemoryStorage}. */
|
|
12
|
+
interface MemoryStorageOptions {
|
|
13
|
+
/** Optional seed data (key → value). Seeding does not call `onWrite`. */
|
|
14
|
+
initial?: Record<string, unknown>;
|
|
15
|
+
/** Called after every write and remove; see {@link MemoryWriteHook}. */
|
|
16
|
+
onWrite?: MemoryWriteHook;
|
|
17
|
+
}
|
|
18
|
+
/** The memory storage: watchable and compare-and-swap capable. */
|
|
19
|
+
type MemoryKvStorage = WatchableKvStorage & CompareAndSwapKvStorage;
|
|
20
|
+
/**
|
|
21
|
+
* Create an in-memory {@link MemoryKvStorage}. `watch` callbacks fire on the next microtask after a
|
|
22
|
+
* write or remove; `compareAndSwap` compares structurally (own properties, key order ignored) and
|
|
23
|
+
* is race-free in-process.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { createMemoryStorage } from "@xtandard/kit/storage/memory";
|
|
28
|
+
*
|
|
29
|
+
* const storage = createMemoryStorage({ initial: { "app/config": { theme: "dark" } } });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare function createMemoryStorage(options?: MemoryStorageOptions): MemoryKvStorage;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { type MemoryKvStorage, type MemoryStorageOptions, type MemoryWriteHook, createMemoryStorage };
|
|
35
|
+
//# sourceMappingURL=entry-storage-memory.d.mts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { i as deepEqual } from "./json-CmM1M5Kz.mjs";
|
|
2
|
+
//#region src/storage/memory.ts
|
|
3
|
+
/**
|
|
4
|
+
* In-memory storage driver. Zero deps; for tests, dev and single-process apps. Values are
|
|
5
|
+
* deep-cloned on write and read so callers cannot mutate stored state by reference.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
const clone = (value) => value === void 0 ? value : structuredClone(value);
|
|
10
|
+
/**
|
|
11
|
+
* Create an in-memory {@link MemoryKvStorage}. `watch` callbacks fire on the next microtask after a
|
|
12
|
+
* write or remove; `compareAndSwap` compares structurally (own properties, key order ignored) and
|
|
13
|
+
* is race-free in-process.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { createMemoryStorage } from "@xtandard/kit/storage/memory";
|
|
18
|
+
*
|
|
19
|
+
* const storage = createMemoryStorage({ initial: { "app/config": { theme: "dark" } } });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function createMemoryStorage(options = {}) {
|
|
23
|
+
const map = /* @__PURE__ */ new Map();
|
|
24
|
+
for (const [key, value] of Object.entries(options.initial ?? {})) map.set(key, clone(value));
|
|
25
|
+
const { onWrite } = options;
|
|
26
|
+
const watchers = /* @__PURE__ */ new Set();
|
|
27
|
+
const notify = (event) => {
|
|
28
|
+
for (const w of watchers) if (event.key.startsWith(w.prefix)) queueMicrotask(() => w.cb(event));
|
|
29
|
+
};
|
|
30
|
+
async function write(key, value) {
|
|
31
|
+
map.set(key, clone(value));
|
|
32
|
+
notify({
|
|
33
|
+
type: "update",
|
|
34
|
+
key
|
|
35
|
+
});
|
|
36
|
+
await onWrite?.(key, clone(value));
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
async getItem(key) {
|
|
40
|
+
return map.has(key) ? clone(map.get(key)) : null;
|
|
41
|
+
},
|
|
42
|
+
async setItem(key, value) {
|
|
43
|
+
await write(key, value);
|
|
44
|
+
},
|
|
45
|
+
async removeItem(key) {
|
|
46
|
+
if (map.delete(key)) notify({
|
|
47
|
+
type: "remove",
|
|
48
|
+
key
|
|
49
|
+
});
|
|
50
|
+
await onWrite?.(key, null);
|
|
51
|
+
},
|
|
52
|
+
async getKeys(prefix) {
|
|
53
|
+
const out = [];
|
|
54
|
+
for (const key of map.keys()) if (key.startsWith(prefix)) out.push(key);
|
|
55
|
+
return out;
|
|
56
|
+
},
|
|
57
|
+
async watch(prefix, cb) {
|
|
58
|
+
const entry = {
|
|
59
|
+
prefix,
|
|
60
|
+
cb
|
|
61
|
+
};
|
|
62
|
+
watchers.add(entry);
|
|
63
|
+
return () => {
|
|
64
|
+
watchers.delete(entry);
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
async compareAndSwap(input) {
|
|
68
|
+
if (!deepEqual(map.has(input.key) ? map.get(input.key) : null, input.expected)) return false;
|
|
69
|
+
await write(input.key, input.next);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { createMemoryStorage };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=entry-storage-memory.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-storage-memory.mjs","names":[],"sources":["../src/storage/memory.ts"],"sourcesContent":["/**\n * In-memory storage driver. Zero deps; for tests, dev and single-process apps. Values are\n * deep-cloned on write and read so callers cannot mutate stored state by reference.\n *\n * @module\n */\n\nimport { deepEqual } from \"../internal/json.ts\";\nimport type {\n CompareAndSwapInput,\n CompareAndSwapKvStorage,\n StorageChangeEvent,\n WatchableKvStorage,\n} from \"./contract.ts\";\n\n/**\n * A write hook (ADR 0004): called after every successful write with the key and the new value, or\n * `null` after a remove (whether or not the key existed). Products mirror keys into their own\n * indexes with it (wh mirrors due keys for `claimDue`). An error thrown by the hook rejects the\n * write call; the write itself has already happened.\n */\nexport type MemoryWriteHook = (key: string, value: unknown) => void | Promise<void>;\n\n/** Options for {@link createMemoryStorage}. */\nexport interface MemoryStorageOptions {\n /** Optional seed data (key → value). Seeding does not call `onWrite`. */\n initial?: Record<string, unknown>;\n /** Called after every write and remove; see {@link MemoryWriteHook}. */\n onWrite?: MemoryWriteHook;\n}\n\n/** The memory storage: watchable and compare-and-swap capable. */\nexport type MemoryKvStorage = WatchableKvStorage & CompareAndSwapKvStorage;\n\nconst clone = <T>(value: T): T => (value === undefined ? value : structuredClone(value));\n\n/**\n * Create an in-memory {@link MemoryKvStorage}. `watch` callbacks fire on the next microtask after a\n * write or remove; `compareAndSwap` compares structurally (own properties, key order ignored) and\n * is race-free in-process.\n *\n * @example\n * ```ts\n * import { createMemoryStorage } from \"@xtandard/kit/storage/memory\";\n *\n * const storage = createMemoryStorage({ initial: { \"app/config\": { theme: \"dark\" } } });\n * ```\n */\nexport function createMemoryStorage(options: MemoryStorageOptions = {}): MemoryKvStorage {\n const map = new Map<string, unknown>();\n for (const [key, value] of Object.entries(options.initial ?? {})) map.set(key, clone(value));\n const { onWrite } = options;\n\n const watchers = new Set<{ prefix: string; cb: (event: StorageChangeEvent) => void }>();\n const notify = (event: StorageChangeEvent): void => {\n for (const w of watchers) if (event.key.startsWith(w.prefix)) queueMicrotask(() => w.cb(event));\n };\n\n async function write(key: string, value: unknown): Promise<void> {\n map.set(key, clone(value));\n notify({ type: \"update\", key });\n await onWrite?.(key, clone(value));\n }\n\n return {\n async getItem<T>(key: string): Promise<T | null> {\n return map.has(key) ? clone(map.get(key) as T) : null;\n },\n async setItem<T>(key: string, value: T): Promise<void> {\n await write(key, value);\n },\n async removeItem(key: string): Promise<void> {\n if (map.delete(key)) notify({ type: \"remove\", key });\n await onWrite?.(key, null);\n },\n async getKeys(prefix: string): Promise<string[]> {\n const out: string[] = [];\n for (const key of map.keys()) if (key.startsWith(prefix)) out.push(key);\n return out;\n },\n async watch(prefix, cb): Promise<() => void> {\n const entry = { prefix, cb };\n watchers.add(entry);\n return () => {\n watchers.delete(entry);\n };\n },\n async compareAndSwap<T>(input: CompareAndSwapInput<T>): Promise<boolean> {\n const current = map.has(input.key) ? map.get(input.key) : null;\n if (!deepEqual(current, input.expected)) return false;\n await write(input.key, input.next);\n return true;\n },\n };\n}\n"],"mappings":";;;;;;;;AAkCA,MAAM,SAAY,UAAiB,UAAU,KAAA,IAAY,QAAQ,gBAAgB,KAAK;;;;;;;;;;;;;AActF,SAAgB,oBAAoB,UAAgC,CAAC,GAAoB;CACvF,MAAM,sBAAM,IAAI,IAAqB;CACrC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,WAAW,CAAC,CAAC,GAAG,IAAI,IAAI,KAAK,MAAM,KAAK,CAAC;CAC3F,MAAM,EAAE,YAAY;CAEpB,MAAM,2BAAW,IAAI,IAAiE;CACtF,MAAM,UAAU,UAAoC;EAClD,KAAK,MAAM,KAAK,UAAU,IAAI,MAAM,IAAI,WAAW,EAAE,MAAM,GAAG,qBAAqB,EAAE,GAAG,KAAK,CAAC;CAChG;CAEA,eAAe,MAAM,KAAa,OAA+B;EAC/D,IAAI,IAAI,KAAK,MAAM,KAAK,CAAC;EACzB,OAAO;GAAE,MAAM;GAAU;EAAI,CAAC;EAC9B,MAAM,UAAU,KAAK,MAAM,KAAK,CAAC;CACnC;CAEA,OAAO;EACL,MAAM,QAAW,KAAgC;GAC/C,OAAO,IAAI,IAAI,GAAG,IAAI,MAAM,IAAI,IAAI,GAAG,CAAM,IAAI;EACnD;EACA,MAAM,QAAW,KAAa,OAAyB;GACrD,MAAM,MAAM,KAAK,KAAK;EACxB;EACA,MAAM,WAAW,KAA4B;GAC3C,IAAI,IAAI,OAAO,GAAG,GAAG,OAAO;IAAE,MAAM;IAAU;GAAI,CAAC;GACnD,MAAM,UAAU,KAAK,IAAI;EAC3B;EACA,MAAM,QAAQ,QAAmC;GAC/C,MAAM,MAAgB,CAAC;GACvB,KAAK,MAAM,OAAO,IAAI,KAAK,GAAG,IAAI,IAAI,WAAW,MAAM,GAAG,IAAI,KAAK,GAAG;GACtE,OAAO;EACT;EACA,MAAM,MAAM,QAAQ,IAAyB;GAC3C,MAAM,QAAQ;IAAE;IAAQ;GAAG;GAC3B,SAAS,IAAI,KAAK;GAClB,aAAa;IACX,SAAS,OAAO,KAAK;GACvB;EACF;EACA,MAAM,eAAkB,OAAiD;GAEvE,IAAI,CAAC,UADW,IAAI,IAAI,MAAM,GAAG,IAAI,IAAI,IAAI,MAAM,GAAG,IAAI,MAClC,MAAM,QAAQ,GAAG,OAAO;GAChD,MAAM,MAAM,MAAM,KAAK,MAAM,IAAI;GACjC,OAAO;EACT;CACF;AACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_mongodb = require("./mongodb--Cuj7V_9.cjs");
|
|
3
|
+
exports.isDuplicateKey = require_mongodb.isDuplicateKey;
|
|
4
|
+
exports.mongoConnection = require_mongodb.mongoConnection;
|
|
5
|
+
exports.mongoKvStorage = require_mongodb.mongoKvStorage;
|