@xtandard/permissions 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 +362 -2
- package/bin/xtandard-permissions.mjs +3 -0
- package/dist/better-auth-Bp9YVyQa.d.cts +56 -0
- package/dist/better-auth-DHyW5-yt.cjs +91 -0
- package/dist/better-auth-DHyW5-yt.cjs.map +1 -0
- package/dist/better-auth-NO40ZqSM.mjs +74 -0
- package/dist/better-auth-NO40ZqSM.mjs.map +1 -0
- package/dist/better-auth-NSXgt6ZU.d.mts +56 -0
- package/dist/catalog-DA_d1SdC.d.cts +153 -0
- package/dist/catalog-DJcJ3ycq.d.mts +153 -0
- package/dist/catalog.cjs +198 -0
- package/dist/catalog.cjs.map +1 -0
- package/dist/catalog.d.cts +3 -0
- package/dist/catalog.d.mts +3 -0
- package/dist/catalog.mjs +141 -0
- package/dist/catalog.mjs.map +1 -0
- package/dist/chunk-DakpK96I.cjs +43 -0
- package/dist/cli.cjs +548 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +28 -0
- package/dist/cli.d.mts +28 -0
- package/dist/cli.mjs +544 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/contract-BMiOmg2f.d.cts +50 -0
- package/dist/contract-Bpy8yPrS.cjs +70 -0
- package/dist/contract-Bpy8yPrS.cjs.map +1 -0
- package/dist/contract-CNgMXr2u.d.cts +46 -0
- package/dist/contract-CNgMXr2u.d.mts +46 -0
- package/dist/contract-CPmJVoRx.cjs +70 -0
- package/dist/contract-CPmJVoRx.cjs.map +1 -0
- package/dist/contract-D32H1t0u.d.mts +50 -0
- package/dist/contract-DTdTXZtJ.mjs +47 -0
- package/dist/contract-DTdTXZtJ.mjs.map +1 -0
- package/dist/contract-DUzgB-He.d.mts +375 -0
- package/dist/contract-Dk6d2ylD.d.cts +375 -0
- package/dist/contract-RMkmERhT.d.cts +2 -0
- package/dist/contract-RMkmERhT.d.mts +2 -0
- package/dist/contract-Yc5AZuvv.mjs +47 -0
- package/dist/contract-Yc5AZuvv.mjs.map +1 -0
- package/dist/create-fetch-handler-BHDU4chu.d.mts +77 -0
- package/dist/create-fetch-handler-BtX64_rS.d.cts +77 -0
- package/dist/create-fetch-handler-C-WyaRCR.cjs +653 -0
- package/dist/create-fetch-handler-C-WyaRCR.cjs.map +1 -0
- package/dist/create-fetch-handler-ojjpk1Iw.mjs +636 -0
- package/dist/create-fetch-handler-ojjpk1Iw.mjs.map +1 -0
- package/dist/elysia-shared-BM6cPoCU.mjs +78 -0
- package/dist/elysia-shared-BM6cPoCU.mjs.map +1 -0
- package/dist/elysia-shared-BUTFTeal.cjs +101 -0
- package/dist/elysia-shared-BUTFTeal.cjs.map +1 -0
- package/dist/elysia-shared-DtKViycb.d.cts +58 -0
- package/dist/elysia-shared-g8zsb_pU.d.mts +58 -0
- package/dist/engine-Bufv0TbD.mjs +574 -0
- package/dist/engine-Bufv0TbD.mjs.map +1 -0
- package/dist/engine-CGGVDCqi.d.cts +296 -0
- package/dist/engine-DpFIcbgh.d.mts +296 -0
- package/dist/engine-bMoz3iW-.cjs +587 -0
- package/dist/engine-bMoz3iW-.cjs.map +1 -0
- package/dist/entry-auth-basic.cjs +40 -0
- package/dist/entry-auth-basic.cjs.map +1 -0
- package/dist/entry-auth-basic.d.cts +24 -0
- package/dist/entry-auth-basic.d.mts +24 -0
- package/dist/entry-auth-basic.mjs +26 -0
- package/dist/entry-auth-basic.mjs.map +1 -0
- package/dist/entry-auth-better-auth.cjs +12 -0
- package/dist/entry-auth-better-auth.d.cts +5 -0
- package/dist/entry-auth-better-auth.d.mts +5 -0
- package/dist/entry-auth-better-auth.mjs +4 -0
- package/dist/entry-auth-delegated.cjs +8 -0
- package/dist/entry-auth-delegated.d.cts +2 -0
- package/dist/entry-auth-delegated.d.mts +2 -0
- package/dist/entry-auth-delegated.mjs +2 -0
- package/dist/entry-auth-jwt.cjs +116 -0
- package/dist/entry-auth-jwt.cjs.map +1 -0
- package/dist/entry-auth-jwt.d.cts +65 -0
- package/dist/entry-auth-jwt.d.mts +65 -0
- package/dist/entry-auth-jwt.mjs +108 -0
- package/dist/entry-auth-jwt.mjs.map +1 -0
- package/dist/entry-auth-none.cjs +14 -0
- package/dist/entry-auth-none.d.cts +2 -0
- package/dist/entry-auth-none.d.mts +2 -0
- package/dist/entry-auth-none.mjs +2 -0
- package/dist/entry-auth-session.cjs +82 -0
- package/dist/entry-auth-session.cjs.map +1 -0
- package/dist/entry-auth-session.d.cts +20 -0
- package/dist/entry-auth-session.d.mts +20 -0
- package/dist/entry-auth-session.mjs +75 -0
- package/dist/entry-auth-session.mjs.map +1 -0
- package/dist/entry-authorization-delegated.cjs +31 -0
- package/dist/entry-authorization-delegated.cjs.map +1 -0
- package/dist/entry-authorization-delegated.d.cts +27 -0
- package/dist/entry-authorization-delegated.d.mts +27 -0
- package/dist/entry-authorization-delegated.mjs +30 -0
- package/dist/entry-authorization-delegated.mjs.map +1 -0
- package/dist/entry-authorization-none.cjs +29 -0
- package/dist/entry-authorization-none.cjs.map +1 -0
- package/dist/entry-authorization-none.d.cts +17 -0
- package/dist/entry-authorization-none.d.mts +17 -0
- package/dist/entry-authorization-none.mjs +28 -0
- package/dist/entry-authorization-none.mjs.map +1 -0
- package/dist/entry-authorization-permissions.cjs +4 -0
- package/dist/entry-authorization-permissions.d.cts +49 -0
- package/dist/entry-authorization-permissions.d.mts +49 -0
- package/dist/entry-authorization-permissions.mjs +2 -0
- package/dist/entry-authorization-roles.cjs +9 -0
- package/dist/entry-authorization-roles.d.cts +37 -0
- package/dist/entry-authorization-roles.d.mts +37 -0
- package/dist/entry-authorization-roles.mjs +3 -0
- package/dist/entry-better-auth-client.cjs +31 -0
- package/dist/entry-better-auth-client.cjs.map +1 -0
- package/dist/entry-better-auth-client.d.cts +63 -0
- package/dist/entry-better-auth-client.d.mts +63 -0
- package/dist/entry-better-auth-client.mjs +29 -0
- package/dist/entry-better-auth-client.mjs.map +1 -0
- package/dist/entry-better-auth.cjs +289 -0
- package/dist/entry-better-auth.cjs.map +1 -0
- package/dist/entry-better-auth.d.cts +3 -0
- package/dist/entry-better-auth.d.mts +3 -0
- package/dist/entry-better-auth.mjs +284 -0
- package/dist/entry-better-auth.mjs.map +1 -0
- package/dist/entry-bridges-audit.cjs +106 -0
- package/dist/entry-bridges-audit.cjs.map +1 -0
- package/dist/entry-bridges-audit.d.cts +58 -0
- package/dist/entry-bridges-audit.d.mts +58 -0
- package/dist/entry-bridges-audit.mjs +105 -0
- package/dist/entry-bridges-audit.mjs.map +1 -0
- package/dist/entry-bridges-webhooks.cjs +90 -0
- package/dist/entry-bridges-webhooks.cjs.map +1 -0
- package/dist/entry-bridges-webhooks.d.cts +46 -0
- package/dist/entry-bridges-webhooks.d.mts +46 -0
- package/dist/entry-bridges-webhooks.mjs +88 -0
- package/dist/entry-bridges-webhooks.mjs.map +1 -0
- package/dist/entry-bun.cjs +33 -0
- package/dist/entry-bun.cjs.map +1 -0
- package/dist/entry-bun.d.cts +31 -0
- package/dist/entry-bun.d.mts +31 -0
- package/dist/entry-bun.mjs +30 -0
- package/dist/entry-bun.mjs.map +1 -0
- package/dist/entry-drizzle-mysql.cjs +34 -0
- package/dist/entry-drizzle-mysql.cjs.map +1 -0
- package/dist/entry-drizzle-mysql.d.cts +20 -0
- package/dist/entry-drizzle-mysql.d.mts +20 -0
- package/dist/entry-drizzle-mysql.mjs +33 -0
- package/dist/entry-drizzle-mysql.mjs.map +1 -0
- package/dist/entry-drizzle-pg.cjs +44 -0
- package/dist/entry-drizzle-pg.cjs.map +1 -0
- package/dist/entry-drizzle-pg.d.cts +20 -0
- package/dist/entry-drizzle-pg.d.mts +20 -0
- package/dist/entry-drizzle-pg.mjs +43 -0
- package/dist/entry-drizzle-pg.mjs.map +1 -0
- package/dist/entry-drizzle-sqlite.cjs +34 -0
- package/dist/entry-drizzle-sqlite.cjs.map +1 -0
- package/dist/entry-drizzle-sqlite.d.cts +15 -0
- package/dist/entry-drizzle-sqlite.d.mts +15 -0
- package/dist/entry-drizzle-sqlite.mjs +33 -0
- package/dist/entry-drizzle-sqlite.mjs.map +1 -0
- package/dist/entry-elysia.cjs +117 -0
- package/dist/entry-elysia.cjs.map +1 -0
- package/dist/entry-elysia.d.cts +446 -0
- package/dist/entry-elysia.d.mts +446 -0
- package/dist/entry-elysia.mjs +113 -0
- package/dist/entry-elysia.mjs.map +1 -0
- package/dist/entry-elysia2.cjs +117 -0
- package/dist/entry-elysia2.cjs.map +1 -0
- package/dist/entry-elysia2.d.cts +571 -0
- package/dist/entry-elysia2.d.mts +571 -0
- package/dist/entry-elysia2.mjs +113 -0
- package/dist/entry-elysia2.mjs.map +1 -0
- package/dist/entry-express.cjs +101 -0
- package/dist/entry-express.cjs.map +1 -0
- package/dist/entry-express.d.cts +36 -0
- package/dist/entry-express.d.mts +36 -0
- package/dist/entry-express.mjs +97 -0
- package/dist/entry-express.mjs.map +1 -0
- package/dist/entry-hono.cjs +63 -0
- package/dist/entry-hono.cjs.map +1 -0
- package/dist/entry-hono.d.cts +40 -0
- package/dist/entry-hono.d.mts +40 -0
- package/dist/entry-hono.mjs +60 -0
- package/dist/entry-hono.mjs.map +1 -0
- package/dist/entry-hooks-log.cjs +39 -0
- package/dist/entry-hooks-log.cjs.map +1 -0
- package/dist/entry-hooks-log.d.cts +19 -0
- package/dist/entry-hooks-log.d.mts +19 -0
- package/dist/entry-hooks-log.mjs +36 -0
- package/dist/entry-hooks-log.mjs.map +1 -0
- package/dist/entry-next.cjs +67 -0
- package/dist/entry-next.cjs.map +1 -0
- package/dist/entry-next.d.cts +60 -0
- package/dist/entry-next.d.mts +60 -0
- package/dist/entry-next.mjs +57 -0
- package/dist/entry-next.mjs.map +1 -0
- package/dist/entry-react.cjs +401 -0
- package/dist/entry-react.cjs.map +1 -0
- package/dist/entry-react.d.cts +206 -0
- package/dist/entry-react.d.mts +206 -0
- package/dist/entry-react.mjs +388 -0
- package/dist/entry-react.mjs.map +1 -0
- package/dist/entry-storage-cloudflare-kv.cjs +8 -0
- package/dist/entry-storage-cloudflare-kv.d.cts +2 -0
- package/dist/entry-storage-cloudflare-kv.d.mts +2 -0
- package/dist/entry-storage-cloudflare-kv.mjs +2 -0
- package/dist/entry-storage-drizzle.cjs +71 -0
- package/dist/entry-storage-drizzle.cjs.map +1 -0
- package/dist/entry-storage-drizzle.d.cts +27 -0
- package/dist/entry-storage-drizzle.d.mts +27 -0
- package/dist/entry-storage-drizzle.mjs +68 -0
- package/dist/entry-storage-drizzle.mjs.map +1 -0
- package/dist/entry-storage-file.cjs +54 -0
- package/dist/entry-storage-file.cjs.map +1 -0
- package/dist/entry-storage-file.d.cts +24 -0
- package/dist/entry-storage-file.d.mts +24 -0
- package/dist/entry-storage-file.mjs +46 -0
- package/dist/entry-storage-file.mjs.map +1 -0
- package/dist/entry-storage-libsql.cjs +64 -0
- package/dist/entry-storage-libsql.cjs.map +1 -0
- package/dist/entry-storage-libsql.d.cts +28 -0
- package/dist/entry-storage-libsql.d.mts +28 -0
- package/dist/entry-storage-libsql.mjs +61 -0
- package/dist/entry-storage-libsql.mjs.map +1 -0
- package/dist/entry-storage-memory.cjs +3 -0
- package/dist/entry-storage-memory.d.cts +25 -0
- package/dist/entry-storage-memory.d.mts +25 -0
- package/dist/entry-storage-memory.mjs +2 -0
- package/dist/entry-storage-mongodb.cjs +61 -0
- package/dist/entry-storage-mongodb.cjs.map +1 -0
- package/dist/entry-storage-mongodb.d.cts +25 -0
- package/dist/entry-storage-mongodb.d.mts +25 -0
- package/dist/entry-storage-mongodb.mjs +58 -0
- package/dist/entry-storage-mongodb.mjs.map +1 -0
- package/dist/entry-storage-postgres.cjs +62 -0
- package/dist/entry-storage-postgres.cjs.map +1 -0
- package/dist/entry-storage-postgres.d.cts +29 -0
- package/dist/entry-storage-postgres.d.mts +29 -0
- package/dist/entry-storage-postgres.mjs +58 -0
- package/dist/entry-storage-postgres.mjs.map +1 -0
- package/dist/entry-storage-redis.cjs +76 -0
- package/dist/entry-storage-redis.cjs.map +1 -0
- package/dist/entry-storage-redis.d.cts +29 -0
- package/dist/entry-storage-redis.d.mts +29 -0
- package/dist/entry-storage-redis.mjs +72 -0
- package/dist/entry-storage-redis.mjs.map +1 -0
- package/dist/entry-storage-sqlite.cjs +46 -0
- package/dist/entry-storage-sqlite.cjs.map +1 -0
- package/dist/entry-storage-sqlite.d.cts +22 -0
- package/dist/entry-storage-sqlite.d.mts +22 -0
- package/dist/entry-storage-sqlite.mjs +43 -0
- package/dist/entry-storage-sqlite.mjs.map +1 -0
- package/dist/entry-storage-unstorage.cjs +8 -0
- package/dist/entry-storage-unstorage.d.cts +2 -0
- package/dist/entry-storage-unstorage.d.mts +2 -0
- package/dist/entry-storage-unstorage.mjs +2 -0
- package/dist/error-codes-9MRMSSMQ.cjs +49 -0
- package/dist/error-codes-9MRMSSMQ.cjs.map +1 -0
- package/dist/error-codes-CCKuDDu7.mjs +44 -0
- package/dist/error-codes-CCKuDDu7.mjs.map +1 -0
- package/dist/errors-bL3XQLfE.mjs +54 -0
- package/dist/errors-bL3XQLfE.mjs.map +1 -0
- package/dist/errors-vVYic8gz.cjs +89 -0
- package/dist/errors-vVYic8gz.cjs.map +1 -0
- package/dist/events-AE4Ytqmz.d.cts +6 -0
- package/dist/events-AE4Ytqmz.d.mts +6 -0
- package/dist/events-DYZShrYB.mjs +15 -0
- package/dist/events-DYZShrYB.mjs.map +1 -0
- package/dist/events-FJ2K0wly.cjs +26 -0
- package/dist/events-FJ2K0wly.cjs.map +1 -0
- package/dist/guard-BOx5cnMP.mjs +141 -0
- package/dist/guard-BOx5cnMP.mjs.map +1 -0
- package/dist/guard-C3o7V14m.d.cts +62 -0
- package/dist/guard-DCbTnqPz.d.mts +62 -0
- package/dist/guard-nwdOYe90.cjs +188 -0
- package/dist/guard-nwdOYe90.cjs.map +1 -0
- package/dist/index-BVVgDSdq.d.cts +1 -0
- package/dist/index-BVVgDSdq.d.mts +1 -0
- package/dist/index.cjs +240 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +195 -0
- package/dist/index.d.mts +195 -0
- package/dist/index.mjs +60 -0
- package/dist/index.mjs.map +1 -0
- package/dist/kit-C7tepDB2.cjs +76 -0
- package/dist/kit-C7tepDB2.cjs.map +1 -0
- package/dist/kit-DMVBLBI9.d.mts +57 -0
- package/dist/kit-fzXHYb1l.mjs +65 -0
- package/dist/kit-fzXHYb1l.mjs.map +1 -0
- package/dist/kit-qAROuhOI.d.cts +57 -0
- package/dist/memory-BbBbbY8-.mjs +32 -0
- package/dist/memory-BbBbbY8-.mjs.map +1 -0
- package/dist/memory-knijqKw_.cjs +39 -0
- package/dist/memory-knijqKw_.cjs.map +1 -0
- package/dist/permissions-C9PjftY6.mjs +59 -0
- package/dist/permissions-C9PjftY6.mjs.map +1 -0
- package/dist/permissions-Cxri_P_k.cjs +70 -0
- package/dist/permissions-Cxri_P_k.cjs.map +1 -0
- package/dist/policy-BQmlo2lu.mjs +3 -0
- package/dist/policy-CGA6QD0a.d.mts +4 -0
- package/dist/policy-DFq_SYR3.d.cts +4 -0
- package/dist/react-embed.js +18710 -0
- package/dist/react.css +1 -0
- package/dist/relationships-BLYEJ9tc.cjs +907 -0
- package/dist/relationships-BLYEJ9tc.cjs.map +1 -0
- package/dist/relationships-BfLonEMI.mjs +756 -0
- package/dist/relationships-BfLonEMI.mjs.map +1 -0
- package/dist/roles-DBk4i8b5.mjs +69 -0
- package/dist/roles-DBk4i8b5.mjs.map +1 -0
- package/dist/roles-a8B5uZ35.cjs +104 -0
- package/dist/roles-a8B5uZ35.cjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/routes-DtRb3EO0.mjs +1001 -0
- package/dist/routes-DtRb3EO0.mjs.map +1 -0
- package/dist/routes-irNuuZqo.cjs +1049 -0
- package/dist/routes-irNuuZqo.cjs.map +1 -0
- package/dist/server-C2F4H6bR.d.cts +886 -0
- package/dist/server-CJ7AIJpO.d.mts +886 -0
- package/dist/table-DA98mVVT.d.cts +2 -0
- package/dist/table-DA98mVVT.d.mts +2 -0
- package/dist/testing.cjs +59 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +37 -0
- package/dist/testing.d.mts +37 -0
- package/dist/testing.mjs +57 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/types-elysia2/adapters/elysia-shared.d.ts +71 -0
- package/dist/types-elysia2/adapters/elysia2.d.ts +432 -0
- package/dist/types-elysia2/adapters/guard.d.ts +140 -0
- package/dist/types-elysia2/auth/contract.d.ts +9 -0
- package/dist/types-elysia2/auth-provider/contract.d.ts +57 -0
- package/dist/types-elysia2/auth-provider/kit.d.ts +57 -0
- package/dist/types-elysia2/authorization/contract.d.ts +53 -0
- package/dist/types-elysia2/authorization/permissions.d.ts +54 -0
- package/dist/types-elysia2/catalog.d.ts +197 -0
- package/dist/types-elysia2/engine.d.ts +192 -0
- package/dist/types-elysia2/entry-elysia2.d.ts +9 -0
- package/dist/types-elysia2/errors.d.ts +47 -0
- package/dist/types-elysia2/hooks/contract.d.ts +100 -0
- package/dist/types-elysia2/keys.d.ts +78 -0
- package/dist/types-elysia2/policy.d.ts +13 -0
- package/dist/types-elysia2/relationships.d.ts +162 -0
- package/dist/types-elysia2/schema.d.ts +299 -0
- package/dist/types-elysia2/server/cors.d.ts +8 -0
- package/dist/types-elysia2/server/create-fetch-handler.d.ts +87 -0
- package/dist/types-elysia2/server/openapi.d.ts +29 -0
- package/dist/types-elysia2/server/routes.d.ts +132 -0
- package/dist/types-elysia2/server/validation.d.ts +205 -0
- package/dist/types-elysia2/storage/contract.d.ts +18 -0
- package/dist/types-react/catalog.d.ts +197 -0
- package/dist/types-react/engine.d.ts +192 -0
- package/dist/types-react/entry-react-embed.d.ts +20 -0
- package/dist/types-react/errors.d.ts +47 -0
- package/dist/types-react/hooks/contract.d.ts +100 -0
- package/dist/types-react/keys.d.ts +78 -0
- package/dist/types-react/policy.d.ts +13 -0
- package/dist/types-react/react-embed.d.ts +37 -0
- package/dist/types-react/relationships.d.ts +162 -0
- package/dist/types-react/schema.d.ts +299 -0
- package/dist/types-react/storage/contract.d.ts +18 -0
- package/dist/types-react/ui/App.d.ts +23 -0
- package/dist/types-react/ui/api.d.ts +73 -0
- package/dist/types-react/ui/components/perm-bits.d.ts +64 -0
- package/dist/types-react/ui/lib/queries.d.ts +46 -0
- package/dist/types-react/ui/theme.d.ts +10 -0
- package/dist/types-react/ui/types.d.ts +109 -0
- package/dist/types-react/ui/views/CatalogView.d.ts +3 -0
- package/dist/types-react/ui/views/HistoryView.d.ts +6 -0
- package/dist/types-react/ui/views/PlaygroundView.d.ts +14 -0
- package/dist/types-react/ui/views/RelationshipsView.d.ts +6 -0
- package/dist/types-react/ui/views/SubjectDetailView.d.ts +7 -0
- package/dist/types-react/ui/views/SubjectsView.d.ts +6 -0
- package/dist/ui/apple-touch-icon.png +0 -0
- package/dist/ui/assets/index-DCPZRo-Z.css +1 -0
- package/dist/ui/assets/index-uXGOtyuj.js +104 -0
- package/dist/ui/favicon.ico +0 -0
- package/dist/ui/favicon.svg +15 -0
- package/dist/ui/index.html +20 -0
- package/package.json +587 -4
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("./chunk-DakpK96I.cjs");
|
|
3
|
+
let _xtandard_kit_storage_drizzle = require("@xtandard/kit/storage/drizzle");
|
|
4
|
+
_xtandard_kit_storage_drizzle = require_chunk.__toESM(_xtandard_kit_storage_drizzle, 1);
|
|
5
|
+
require("@xtandard/kit/storage/drizzle/internals");
|
|
6
|
+
//#region src/storage/drizzle.ts
|
|
7
|
+
/**
|
|
8
|
+
* Drizzle storage adapter — an {@link PermissionsStorage} over a
|
|
9
|
+
* **consumer-owned** Drizzle table and database. Unlike
|
|
10
|
+
* {@link ./postgres.createPostgresStorage} it issues **no DDL** (the table lives
|
|
11
|
+
* in your Drizzle schema + migrations) and **owns no connection** (it reuses the
|
|
12
|
+
* `db` you pass, and never closes it).
|
|
13
|
+
*
|
|
14
|
+
* Dialect-agnostic: works with Postgres, MySQL, and SQLite Drizzle databases
|
|
15
|
+
* (the dialect is read from the `db`, or set explicitly with `dialect`). Build
|
|
16
|
+
* the backing table with the matching factory —
|
|
17
|
+
* {@link ../drizzle/pg.pgPermissionsTable} /
|
|
18
|
+
* {@link ../drizzle/mysql.mysqlPermissionsTable} /
|
|
19
|
+
* {@link ../drizzle/sqlite.sqlitePermissionsTable} — whose fixed `key`/`value`
|
|
20
|
+
* columns this adapter reads and writes.
|
|
21
|
+
*
|
|
22
|
+
* - `getKeys` matches prefixes literally and case-sensitively: `LIKE … ESCAPE
|
|
23
|
+
* '!'` on Postgres/MySQL (a backslash escape is a syntax error on MySQL),
|
|
24
|
+
* `GLOB` on SQLite (whose `LIKE` folds ASCII case).
|
|
25
|
+
* - `compareAndSwap` is one conditional `UPDATE` (or a conflict-ignoring
|
|
26
|
+
* `INSERT` when absence is expected): `jsonb` equality on Postgres, `JSON`
|
|
27
|
+
* equality on MySQL, canonical-JSON text equality on SQLite (values are
|
|
28
|
+
* written with sorted object keys).
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { drizzle } from "drizzle-orm/node-postgres";
|
|
33
|
+
* import { createDrizzleStorage } from "@xtandard/permissions/storage/drizzle";
|
|
34
|
+
* import { pgPermissionsTable } from "@xtandard/permissions/drizzle/pg";
|
|
35
|
+
*
|
|
36
|
+
* export const permissionsKv = pgPermissionsTable(); // add to your schema + migrate
|
|
37
|
+
* const db = drizzle(pool); // your existing pool
|
|
38
|
+
* const storage = createDrizzleStorage({ db, table: permissionsKv });
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* The driver is `@xtandard/kit/storage/drizzle`. On MySQL, reads, removes and
|
|
42
|
+
* swaps match keys byte-exactly, and a write whose key differs from a stored
|
|
43
|
+
* key only by trailing spaces throws {@link KeyCollisionError} on a PAD SPACE
|
|
44
|
+
* (`utf8mb4_bin`) key column.
|
|
45
|
+
*
|
|
46
|
+
* @module
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Create a Drizzle-backed {@link DrizzlePermissionsStorage}. No DDL, no
|
|
50
|
+
* connection ownership.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { drizzle } from "drizzle-orm/node-postgres";
|
|
55
|
+
* import { createDrizzleStorage } from "@xtandard/permissions/storage/drizzle";
|
|
56
|
+
* import { pgPermissionsTable } from "@xtandard/permissions/drizzle/pg";
|
|
57
|
+
*
|
|
58
|
+
* export const permissionsKv = pgPermissionsTable(); // add to your schema + migrate
|
|
59
|
+
* const storage = createDrizzleStorage({ db: drizzle(pool), table: permissionsKv });
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
function createDrizzleStorage(options) {
|
|
63
|
+
return _xtandard_kit_storage_drizzle.createDrizzleStorage({
|
|
64
|
+
subpath: "@xtandard/permissions/storage/drizzle",
|
|
65
|
+
...options
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
exports.createDrizzleStorage = createDrizzleStorage;
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=entry-storage-drizzle.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-storage-drizzle.cjs","names":["kit"],"sources":["../src/storage/drizzle.ts"],"sourcesContent":["/**\n * Drizzle storage adapter — an {@link PermissionsStorage} over a\n * **consumer-owned** Drizzle table and database. Unlike\n * {@link ./postgres.createPostgresStorage} it issues **no DDL** (the table lives\n * in your Drizzle schema + migrations) and **owns no connection** (it reuses the\n * `db` you pass, and never closes it).\n *\n * Dialect-agnostic: works with Postgres, MySQL, and SQLite Drizzle databases\n * (the dialect is read from the `db`, or set explicitly with `dialect`). Build\n * the backing table with the matching factory —\n * {@link ../drizzle/pg.pgPermissionsTable} /\n * {@link ../drizzle/mysql.mysqlPermissionsTable} /\n * {@link ../drizzle/sqlite.sqlitePermissionsTable} — whose fixed `key`/`value`\n * columns this adapter reads and writes.\n *\n * - `getKeys` matches prefixes literally and case-sensitively: `LIKE … ESCAPE\n * '!'` on Postgres/MySQL (a backslash escape is a syntax error on MySQL),\n * `GLOB` on SQLite (whose `LIKE` folds ASCII case).\n * - `compareAndSwap` is one conditional `UPDATE` (or a conflict-ignoring\n * `INSERT` when absence is expected): `jsonb` equality on Postgres, `JSON`\n * equality on MySQL, canonical-JSON text equality on SQLite (values are\n * written with sorted object keys).\n *\n * @example\n * ```ts\n * import { drizzle } from \"drizzle-orm/node-postgres\";\n * import { createDrizzleStorage } from \"@xtandard/permissions/storage/drizzle\";\n * import { pgPermissionsTable } from \"@xtandard/permissions/drizzle/pg\";\n *\n * export const permissionsKv = pgPermissionsTable(); // add to your schema + migrate\n * const db = drizzle(pool); // your existing pool\n * const storage = createDrizzleStorage({ db, table: permissionsKv });\n * ```\n *\n * The driver is `@xtandard/kit/storage/drizzle`. On MySQL, reads, removes and\n * swaps match keys byte-exactly, and a write whose key differs from a stored\n * key only by trailing spaces throws {@link KeyCollisionError} on a PAD SPACE\n * (`utf8mb4_bin`) key column.\n *\n * @module\n */\n\nimport * as kit from \"@xtandard/kit/storage/drizzle\";\n\nexport {\n detectDrizzleDialect,\n affectedRows,\n type DrizzleLikeDatabase,\n} from \"@xtandard/kit/storage/drizzle/internals\";\nexport {\n KeyCollisionError,\n type DrizzleDialect,\n type DrizzleKvTable,\n type DrizzleStorageOptions,\n} from \"@xtandard/kit/storage/drizzle\";\n\n/**\n * A compare-and-swap capable storage over a Drizzle table. For push\n * change-notifications, compose it with `withWatch` + a change source (e.g.\n * `pgListenNotify`) — `watch` is orthogonal to the adapter.\n */\nexport type DrizzlePermissionsStorage = kit.DrizzleKvStorage;\n\n/**\n * Create a Drizzle-backed {@link DrizzlePermissionsStorage}. No DDL, no\n * connection ownership.\n *\n * @example\n * ```ts\n * import { drizzle } from \"drizzle-orm/node-postgres\";\n * import { createDrizzleStorage } from \"@xtandard/permissions/storage/drizzle\";\n * import { pgPermissionsTable } from \"@xtandard/permissions/drizzle/pg\";\n *\n * export const permissionsKv = pgPermissionsTable(); // add to your schema + migrate\n * const storage = createDrizzleStorage({ db: drizzle(pool), table: permissionsKv });\n * ```\n */\nexport function createDrizzleStorage(\n options: kit.DrizzleStorageOptions,\n): DrizzlePermissionsStorage {\n return kit.createDrizzleStorage({\n subpath: \"@xtandard/permissions/storage/drizzle\",\n ...options,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,SAAgB,qBACd,SAC2B;CAC3B,OAAOA,8BAAI,qBAAqB;EAC9B,SAAS;EACT,GAAG;CACL,CAAC;AACH"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as kit from "@xtandard/kit/storage/drizzle";
|
|
2
|
+
import { DrizzleDialect, DrizzleKvTable, DrizzleStorageOptions } from "@xtandard/kit/storage/drizzle";
|
|
3
|
+
//#region src/storage/drizzle.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A compare-and-swap capable storage over a Drizzle table. For push
|
|
6
|
+
* change-notifications, compose it with `withWatch` + a change source (e.g.
|
|
7
|
+
* `pgListenNotify`) — `watch` is orthogonal to the adapter.
|
|
8
|
+
*/
|
|
9
|
+
type DrizzlePermissionsStorage = kit.DrizzleKvStorage;
|
|
10
|
+
/**
|
|
11
|
+
* Create a Drizzle-backed {@link DrizzlePermissionsStorage}. No DDL, no
|
|
12
|
+
* connection ownership.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { drizzle } from "drizzle-orm/node-postgres";
|
|
17
|
+
* import { createDrizzleStorage } from "@xtandard/permissions/storage/drizzle";
|
|
18
|
+
* import { pgPermissionsTable } from "@xtandard/permissions/drizzle/pg";
|
|
19
|
+
*
|
|
20
|
+
* export const permissionsKv = pgPermissionsTable(); // add to your schema + migrate
|
|
21
|
+
* const storage = createDrizzleStorage({ db: drizzle(pool), table: permissionsKv });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare function createDrizzleStorage(options: kit.DrizzleStorageOptions): DrizzlePermissionsStorage;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { type DrizzleDialect, type DrizzleKvTable, type DrizzlePermissionsStorage, type DrizzleStorageOptions, createDrizzleStorage };
|
|
27
|
+
//# sourceMappingURL=entry-storage-drizzle.d.cts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as kit from "@xtandard/kit/storage/drizzle";
|
|
2
|
+
import { DrizzleDialect, DrizzleKvTable, DrizzleStorageOptions } from "@xtandard/kit/storage/drizzle";
|
|
3
|
+
//#region src/storage/drizzle.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A compare-and-swap capable storage over a Drizzle table. For push
|
|
6
|
+
* change-notifications, compose it with `withWatch` + a change source (e.g.
|
|
7
|
+
* `pgListenNotify`) — `watch` is orthogonal to the adapter.
|
|
8
|
+
*/
|
|
9
|
+
type DrizzlePermissionsStorage = kit.DrizzleKvStorage;
|
|
10
|
+
/**
|
|
11
|
+
* Create a Drizzle-backed {@link DrizzlePermissionsStorage}. No DDL, no
|
|
12
|
+
* connection ownership.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { drizzle } from "drizzle-orm/node-postgres";
|
|
17
|
+
* import { createDrizzleStorage } from "@xtandard/permissions/storage/drizzle";
|
|
18
|
+
* import { pgPermissionsTable } from "@xtandard/permissions/drizzle/pg";
|
|
19
|
+
*
|
|
20
|
+
* export const permissionsKv = pgPermissionsTable(); // add to your schema + migrate
|
|
21
|
+
* const storage = createDrizzleStorage({ db: drizzle(pool), table: permissionsKv });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare function createDrizzleStorage(options: kit.DrizzleStorageOptions): DrizzlePermissionsStorage;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { type DrizzleDialect, type DrizzleKvTable, type DrizzlePermissionsStorage, type DrizzleStorageOptions, createDrizzleStorage };
|
|
27
|
+
//# sourceMappingURL=entry-storage-drizzle.d.mts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as kit from "@xtandard/kit/storage/drizzle";
|
|
2
|
+
import "@xtandard/kit/storage/drizzle/internals";
|
|
3
|
+
//#region src/storage/drizzle.ts
|
|
4
|
+
/**
|
|
5
|
+
* Drizzle storage adapter — an {@link PermissionsStorage} over a
|
|
6
|
+
* **consumer-owned** Drizzle table and database. Unlike
|
|
7
|
+
* {@link ./postgres.createPostgresStorage} it issues **no DDL** (the table lives
|
|
8
|
+
* in your Drizzle schema + migrations) and **owns no connection** (it reuses the
|
|
9
|
+
* `db` you pass, and never closes it).
|
|
10
|
+
*
|
|
11
|
+
* Dialect-agnostic: works with Postgres, MySQL, and SQLite Drizzle databases
|
|
12
|
+
* (the dialect is read from the `db`, or set explicitly with `dialect`). Build
|
|
13
|
+
* the backing table with the matching factory —
|
|
14
|
+
* {@link ../drizzle/pg.pgPermissionsTable} /
|
|
15
|
+
* {@link ../drizzle/mysql.mysqlPermissionsTable} /
|
|
16
|
+
* {@link ../drizzle/sqlite.sqlitePermissionsTable} — whose fixed `key`/`value`
|
|
17
|
+
* columns this adapter reads and writes.
|
|
18
|
+
*
|
|
19
|
+
* - `getKeys` matches prefixes literally and case-sensitively: `LIKE … ESCAPE
|
|
20
|
+
* '!'` on Postgres/MySQL (a backslash escape is a syntax error on MySQL),
|
|
21
|
+
* `GLOB` on SQLite (whose `LIKE` folds ASCII case).
|
|
22
|
+
* - `compareAndSwap` is one conditional `UPDATE` (or a conflict-ignoring
|
|
23
|
+
* `INSERT` when absence is expected): `jsonb` equality on Postgres, `JSON`
|
|
24
|
+
* equality on MySQL, canonical-JSON text equality on SQLite (values are
|
|
25
|
+
* written with sorted object keys).
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { drizzle } from "drizzle-orm/node-postgres";
|
|
30
|
+
* import { createDrizzleStorage } from "@xtandard/permissions/storage/drizzle";
|
|
31
|
+
* import { pgPermissionsTable } from "@xtandard/permissions/drizzle/pg";
|
|
32
|
+
*
|
|
33
|
+
* export const permissionsKv = pgPermissionsTable(); // add to your schema + migrate
|
|
34
|
+
* const db = drizzle(pool); // your existing pool
|
|
35
|
+
* const storage = createDrizzleStorage({ db, table: permissionsKv });
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* The driver is `@xtandard/kit/storage/drizzle`. On MySQL, reads, removes and
|
|
39
|
+
* swaps match keys byte-exactly, and a write whose key differs from a stored
|
|
40
|
+
* key only by trailing spaces throws {@link KeyCollisionError} on a PAD SPACE
|
|
41
|
+
* (`utf8mb4_bin`) key column.
|
|
42
|
+
*
|
|
43
|
+
* @module
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* Create a Drizzle-backed {@link DrizzlePermissionsStorage}. No DDL, no
|
|
47
|
+
* connection ownership.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { drizzle } from "drizzle-orm/node-postgres";
|
|
52
|
+
* import { createDrizzleStorage } from "@xtandard/permissions/storage/drizzle";
|
|
53
|
+
* import { pgPermissionsTable } from "@xtandard/permissions/drizzle/pg";
|
|
54
|
+
*
|
|
55
|
+
* export const permissionsKv = pgPermissionsTable(); // add to your schema + migrate
|
|
56
|
+
* const storage = createDrizzleStorage({ db: drizzle(pool), table: permissionsKv });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
function createDrizzleStorage(options) {
|
|
60
|
+
return kit.createDrizzleStorage({
|
|
61
|
+
subpath: "@xtandard/permissions/storage/drizzle",
|
|
62
|
+
...options
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { createDrizzleStorage };
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=entry-storage-drizzle.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-storage-drizzle.mjs","names":[],"sources":["../src/storage/drizzle.ts"],"sourcesContent":["/**\n * Drizzle storage adapter — an {@link PermissionsStorage} over a\n * **consumer-owned** Drizzle table and database. Unlike\n * {@link ./postgres.createPostgresStorage} it issues **no DDL** (the table lives\n * in your Drizzle schema + migrations) and **owns no connection** (it reuses the\n * `db` you pass, and never closes it).\n *\n * Dialect-agnostic: works with Postgres, MySQL, and SQLite Drizzle databases\n * (the dialect is read from the `db`, or set explicitly with `dialect`). Build\n * the backing table with the matching factory —\n * {@link ../drizzle/pg.pgPermissionsTable} /\n * {@link ../drizzle/mysql.mysqlPermissionsTable} /\n * {@link ../drizzle/sqlite.sqlitePermissionsTable} — whose fixed `key`/`value`\n * columns this adapter reads and writes.\n *\n * - `getKeys` matches prefixes literally and case-sensitively: `LIKE … ESCAPE\n * '!'` on Postgres/MySQL (a backslash escape is a syntax error on MySQL),\n * `GLOB` on SQLite (whose `LIKE` folds ASCII case).\n * - `compareAndSwap` is one conditional `UPDATE` (or a conflict-ignoring\n * `INSERT` when absence is expected): `jsonb` equality on Postgres, `JSON`\n * equality on MySQL, canonical-JSON text equality on SQLite (values are\n * written with sorted object keys).\n *\n * @example\n * ```ts\n * import { drizzle } from \"drizzle-orm/node-postgres\";\n * import { createDrizzleStorage } from \"@xtandard/permissions/storage/drizzle\";\n * import { pgPermissionsTable } from \"@xtandard/permissions/drizzle/pg\";\n *\n * export const permissionsKv = pgPermissionsTable(); // add to your schema + migrate\n * const db = drizzle(pool); // your existing pool\n * const storage = createDrizzleStorage({ db, table: permissionsKv });\n * ```\n *\n * The driver is `@xtandard/kit/storage/drizzle`. On MySQL, reads, removes and\n * swaps match keys byte-exactly, and a write whose key differs from a stored\n * key only by trailing spaces throws {@link KeyCollisionError} on a PAD SPACE\n * (`utf8mb4_bin`) key column.\n *\n * @module\n */\n\nimport * as kit from \"@xtandard/kit/storage/drizzle\";\n\nexport {\n detectDrizzleDialect,\n affectedRows,\n type DrizzleLikeDatabase,\n} from \"@xtandard/kit/storage/drizzle/internals\";\nexport {\n KeyCollisionError,\n type DrizzleDialect,\n type DrizzleKvTable,\n type DrizzleStorageOptions,\n} from \"@xtandard/kit/storage/drizzle\";\n\n/**\n * A compare-and-swap capable storage over a Drizzle table. For push\n * change-notifications, compose it with `withWatch` + a change source (e.g.\n * `pgListenNotify`) — `watch` is orthogonal to the adapter.\n */\nexport type DrizzlePermissionsStorage = kit.DrizzleKvStorage;\n\n/**\n * Create a Drizzle-backed {@link DrizzlePermissionsStorage}. No DDL, no\n * connection ownership.\n *\n * @example\n * ```ts\n * import { drizzle } from \"drizzle-orm/node-postgres\";\n * import { createDrizzleStorage } from \"@xtandard/permissions/storage/drizzle\";\n * import { pgPermissionsTable } from \"@xtandard/permissions/drizzle/pg\";\n *\n * export const permissionsKv = pgPermissionsTable(); // add to your schema + migrate\n * const storage = createDrizzleStorage({ db: drizzle(pool), table: permissionsKv });\n * ```\n */\nexport function createDrizzleStorage(\n options: kit.DrizzleStorageOptions,\n): DrizzlePermissionsStorage {\n return kit.createDrizzleStorage({\n subpath: \"@xtandard/permissions/storage/drizzle\",\n ...options,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,SAAgB,qBACd,SAC2B;CAC3B,OAAO,IAAI,qBAAqB;EAC9B,SAAS;EACT,GAAG;CACL,CAAC;AACH"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("./chunk-DakpK96I.cjs");
|
|
3
|
+
let _xtandard_kit_storage_file = require("@xtandard/kit/storage/file");
|
|
4
|
+
_xtandard_kit_storage_file = require_chunk.__toESM(_xtandard_kit_storage_file, 1);
|
|
5
|
+
//#region src/storage/file.ts
|
|
6
|
+
/**
|
|
7
|
+
* File-system storage adapter. Persists each key as a JSON file under a base
|
|
8
|
+
* directory, mirroring the slash-delimited key layout (`perm/grants/…`) as a
|
|
9
|
+
* tree of nested directories with a `.json` extension on the leaf. Zero
|
|
10
|
+
* external dependencies — uses `node:fs/promises`, which works in both Bun and
|
|
11
|
+
* Node.
|
|
12
|
+
*
|
|
13
|
+
* Path segments are encoded ({@link encodeSegment}) so every key maps to a
|
|
14
|
+
* distinct, safe file name on any filesystem: `Acme` / `acme` / `acmé` never
|
|
15
|
+
* collide on case- or normalization-insensitive macOS/Windows volumes, and a
|
|
16
|
+
* key can never escape the base directory.
|
|
17
|
+
*
|
|
18
|
+
* Writes go to a temporary sibling file and are renamed into place, so a crash
|
|
19
|
+
* never leaves a half-written JSON file. `compareAndSwap` is serialized per key
|
|
20
|
+
* **within this process** (an in-process lock around read → compare → write);
|
|
21
|
+
* it is not safe across several processes sharing one directory — use a
|
|
22
|
+
* database driver for that.
|
|
23
|
+
*
|
|
24
|
+
* The driver is `@xtandard/kit/storage/file`: writes are atomic (temporary
|
|
25
|
+
* file + rename), `compareAndSwap` is serialized per key within one process,
|
|
26
|
+
* and empty key segments are distinct keys.
|
|
27
|
+
*
|
|
28
|
+
* @module
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Create a file-backed {@link FilePermissionsStorage}. `watch` is implemented
|
|
32
|
+
* via `fs.watch` on the base directory (recursive); it is best-effort and may
|
|
33
|
+
* coalesce or miss events on platforms without recursive-watch support.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { createFileStorage } from "@xtandard/permissions/storage/file";
|
|
38
|
+
*
|
|
39
|
+
* const storage = createFileStorage({ dir: "./data/permissions" });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
function createFileStorage(options) {
|
|
43
|
+
return _xtandard_kit_storage_file.createFileStorage(options);
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
Object.defineProperty(exports, "clearFileStorage", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function() {
|
|
49
|
+
return _xtandard_kit_storage_file.clearFileStorage;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
exports.createFileStorage = createFileStorage;
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=entry-storage-file.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-storage-file.cjs","names":["kit"],"sources":["../src/storage/file.ts"],"sourcesContent":["/**\n * File-system storage adapter. Persists each key as a JSON file under a base\n * directory, mirroring the slash-delimited key layout (`perm/grants/…`) as a\n * tree of nested directories with a `.json` extension on the leaf. Zero\n * external dependencies — uses `node:fs/promises`, which works in both Bun and\n * Node.\n *\n * Path segments are encoded ({@link encodeSegment}) so every key maps to a\n * distinct, safe file name on any filesystem: `Acme` / `acme` / `acmé` never\n * collide on case- or normalization-insensitive macOS/Windows volumes, and a\n * key can never escape the base directory.\n *\n * Writes go to a temporary sibling file and are renamed into place, so a crash\n * never leaves a half-written JSON file. `compareAndSwap` is serialized per key\n * **within this process** (an in-process lock around read → compare → write);\n * it is not safe across several processes sharing one directory — use a\n * database driver for that.\n *\n * The driver is `@xtandard/kit/storage/file`: writes are atomic (temporary\n * file + rename), `compareAndSwap` is serialized per key within one process,\n * and empty key segments are distinct keys.\n *\n * @module\n */\n\nimport * as kit from \"@xtandard/kit/storage/file\";\n\nexport { clearFileStorage, decodeSegment, encodeSegment } from \"@xtandard/kit/storage/file\";\n\n/** Options for {@link createFileStorage}. */\nexport type FileStorageOptions = kit.FileStorageOptions;\n\n/** The file storage: watchable and (in-process) compare-and-swap capable. */\nexport type FilePermissionsStorage = kit.FileKvStorage;\n\n/**\n * Create a file-backed {@link FilePermissionsStorage}. `watch` is implemented\n * via `fs.watch` on the base directory (recursive); it is best-effort and may\n * coalesce or miss events on platforms without recursive-watch support.\n *\n * @example\n * ```ts\n * import { createFileStorage } from \"@xtandard/permissions/storage/file\";\n *\n * const storage = createFileStorage({ dir: \"./data/permissions\" });\n * ```\n */\nexport function createFileStorage(options: FileStorageOptions): FilePermissionsStorage {\n return kit.createFileStorage(options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,kBAAkB,SAAqD;CACrF,OAAOA,2BAAI,kBAAkB,OAAO;AACtC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as kit from "@xtandard/kit/storage/file";
|
|
2
|
+
import { clearFileStorage } from "@xtandard/kit/storage/file";
|
|
3
|
+
|
|
4
|
+
//#region src/storage/file.d.ts
|
|
5
|
+
/** Options for {@link createFileStorage}. */
|
|
6
|
+
type FileStorageOptions = kit.FileStorageOptions;
|
|
7
|
+
/** The file storage: watchable and (in-process) compare-and-swap capable. */
|
|
8
|
+
type FilePermissionsStorage = kit.FileKvStorage;
|
|
9
|
+
/**
|
|
10
|
+
* Create a file-backed {@link FilePermissionsStorage}. `watch` is implemented
|
|
11
|
+
* via `fs.watch` on the base directory (recursive); it is best-effort and may
|
|
12
|
+
* coalesce or miss events on platforms without recursive-watch support.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { createFileStorage } from "@xtandard/permissions/storage/file";
|
|
17
|
+
*
|
|
18
|
+
* const storage = createFileStorage({ dir: "./data/permissions" });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare function createFileStorage(options: FileStorageOptions): FilePermissionsStorage;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { type FilePermissionsStorage, type FileStorageOptions, clearFileStorage, createFileStorage };
|
|
24
|
+
//# sourceMappingURL=entry-storage-file.d.cts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as kit from "@xtandard/kit/storage/file";
|
|
2
|
+
import { clearFileStorage } from "@xtandard/kit/storage/file";
|
|
3
|
+
|
|
4
|
+
//#region src/storage/file.d.ts
|
|
5
|
+
/** Options for {@link createFileStorage}. */
|
|
6
|
+
type FileStorageOptions = kit.FileStorageOptions;
|
|
7
|
+
/** The file storage: watchable and (in-process) compare-and-swap capable. */
|
|
8
|
+
type FilePermissionsStorage = kit.FileKvStorage;
|
|
9
|
+
/**
|
|
10
|
+
* Create a file-backed {@link FilePermissionsStorage}. `watch` is implemented
|
|
11
|
+
* via `fs.watch` on the base directory (recursive); it is best-effort and may
|
|
12
|
+
* coalesce or miss events on platforms without recursive-watch support.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { createFileStorage } from "@xtandard/permissions/storage/file";
|
|
17
|
+
*
|
|
18
|
+
* const storage = createFileStorage({ dir: "./data/permissions" });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare function createFileStorage(options: FileStorageOptions): FilePermissionsStorage;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { type FilePermissionsStorage, type FileStorageOptions, clearFileStorage, createFileStorage };
|
|
24
|
+
//# sourceMappingURL=entry-storage-file.d.mts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as kit from "@xtandard/kit/storage/file";
|
|
2
|
+
import { clearFileStorage } from "@xtandard/kit/storage/file";
|
|
3
|
+
//#region src/storage/file.ts
|
|
4
|
+
/**
|
|
5
|
+
* File-system storage adapter. Persists each key as a JSON file under a base
|
|
6
|
+
* directory, mirroring the slash-delimited key layout (`perm/grants/…`) as a
|
|
7
|
+
* tree of nested directories with a `.json` extension on the leaf. Zero
|
|
8
|
+
* external dependencies — uses `node:fs/promises`, which works in both Bun and
|
|
9
|
+
* Node.
|
|
10
|
+
*
|
|
11
|
+
* Path segments are encoded ({@link encodeSegment}) so every key maps to a
|
|
12
|
+
* distinct, safe file name on any filesystem: `Acme` / `acme` / `acmé` never
|
|
13
|
+
* collide on case- or normalization-insensitive macOS/Windows volumes, and a
|
|
14
|
+
* key can never escape the base directory.
|
|
15
|
+
*
|
|
16
|
+
* Writes go to a temporary sibling file and are renamed into place, so a crash
|
|
17
|
+
* never leaves a half-written JSON file. `compareAndSwap` is serialized per key
|
|
18
|
+
* **within this process** (an in-process lock around read → compare → write);
|
|
19
|
+
* it is not safe across several processes sharing one directory — use a
|
|
20
|
+
* database driver for that.
|
|
21
|
+
*
|
|
22
|
+
* The driver is `@xtandard/kit/storage/file`: writes are atomic (temporary
|
|
23
|
+
* file + rename), `compareAndSwap` is serialized per key within one process,
|
|
24
|
+
* and empty key segments are distinct keys.
|
|
25
|
+
*
|
|
26
|
+
* @module
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Create a file-backed {@link FilePermissionsStorage}. `watch` is implemented
|
|
30
|
+
* via `fs.watch` on the base directory (recursive); it is best-effort and may
|
|
31
|
+
* coalesce or miss events on platforms without recursive-watch support.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { createFileStorage } from "@xtandard/permissions/storage/file";
|
|
36
|
+
*
|
|
37
|
+
* const storage = createFileStorage({ dir: "./data/permissions" });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
function createFileStorage(options) {
|
|
41
|
+
return kit.createFileStorage(options);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { clearFileStorage, createFileStorage };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=entry-storage-file.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-storage-file.mjs","names":[],"sources":["../src/storage/file.ts"],"sourcesContent":["/**\n * File-system storage adapter. Persists each key as a JSON file under a base\n * directory, mirroring the slash-delimited key layout (`perm/grants/…`) as a\n * tree of nested directories with a `.json` extension on the leaf. Zero\n * external dependencies — uses `node:fs/promises`, which works in both Bun and\n * Node.\n *\n * Path segments are encoded ({@link encodeSegment}) so every key maps to a\n * distinct, safe file name on any filesystem: `Acme` / `acme` / `acmé` never\n * collide on case- or normalization-insensitive macOS/Windows volumes, and a\n * key can never escape the base directory.\n *\n * Writes go to a temporary sibling file and are renamed into place, so a crash\n * never leaves a half-written JSON file. `compareAndSwap` is serialized per key\n * **within this process** (an in-process lock around read → compare → write);\n * it is not safe across several processes sharing one directory — use a\n * database driver for that.\n *\n * The driver is `@xtandard/kit/storage/file`: writes are atomic (temporary\n * file + rename), `compareAndSwap` is serialized per key within one process,\n * and empty key segments are distinct keys.\n *\n * @module\n */\n\nimport * as kit from \"@xtandard/kit/storage/file\";\n\nexport { clearFileStorage, decodeSegment, encodeSegment } from \"@xtandard/kit/storage/file\";\n\n/** Options for {@link createFileStorage}. */\nexport type FileStorageOptions = kit.FileStorageOptions;\n\n/** The file storage: watchable and (in-process) compare-and-swap capable. */\nexport type FilePermissionsStorage = kit.FileKvStorage;\n\n/**\n * Create a file-backed {@link FilePermissionsStorage}. `watch` is implemented\n * via `fs.watch` on the base directory (recursive); it is best-effort and may\n * coalesce or miss events on platforms without recursive-watch support.\n *\n * @example\n * ```ts\n * import { createFileStorage } from \"@xtandard/permissions/storage/file\";\n *\n * const storage = createFileStorage({ dir: \"./data/permissions\" });\n * ```\n */\nexport function createFileStorage(options: FileStorageOptions): FilePermissionsStorage {\n return kit.createFileStorage(options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,kBAAkB,SAAqD;CACrF,OAAO,IAAI,kBAAkB,OAAO;AACtC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("./chunk-DakpK96I.cjs");
|
|
3
|
+
let _xtandard_kit_storage_libsql = require("@xtandard/kit/storage/libsql");
|
|
4
|
+
_xtandard_kit_storage_libsql = require_chunk.__toESM(_xtandard_kit_storage_libsql, 1);
|
|
5
|
+
//#region src/storage/libsql.ts
|
|
6
|
+
/**
|
|
7
|
+
* libSQL / [Turso](https://turso.tech) storage adapter built on the
|
|
8
|
+
* [`@libsql/client`](https://github.com/tursodatabase/libsql-client-ts) package
|
|
9
|
+
* (an optional peer dependency). It speaks the same SQL dialect as SQLite but
|
|
10
|
+
* works against a **remote, replicated, edge-distributed** database — or a local
|
|
11
|
+
* file / embedded replica — so it suits multi-node and edge runtimes where
|
|
12
|
+
* `bun:sqlite` (single-file, Bun-only) does not.
|
|
13
|
+
*
|
|
14
|
+
* Pass either a pre-constructed `client`, or `url` (+ optional `authToken`) to let
|
|
15
|
+
* the adapter construct one lazily on first use. Keys are stored verbatim as the
|
|
16
|
+
* primary key; namespace via a distinct `table` or a separate database.
|
|
17
|
+
*
|
|
18
|
+
* Values are stored as canonical JSON, so `compareAndSwap` is one atomic
|
|
19
|
+
* `UPDATE … WHERE value = ?` evaluated by the server.
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { createLibsqlStorage } from "@xtandard/permissions/storage/libsql";
|
|
23
|
+
*
|
|
24
|
+
* // Turso (remote):
|
|
25
|
+
* const storage = createLibsqlStorage({
|
|
26
|
+
* url: process.env.TURSO_DATABASE_URL!, // libsql://<db>-<org>.turso.io
|
|
27
|
+
* authToken: process.env.TURSO_AUTH_TOKEN!,
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* // Local file or embedded replica:
|
|
31
|
+
* // const storage = createLibsqlStorage({ url: "file:permissions.db" });
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* The driver is `@xtandard/kit/storage/libsql`.
|
|
35
|
+
*
|
|
36
|
+
* @module
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* Create a libSQL/Turso-backed {@link LibsqlPermissionsStorage}. The table is
|
|
40
|
+
* created on first use; connection (when constructed from `url`) is lazy and
|
|
41
|
+
* shared.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* import { createLibsqlStorage } from "@xtandard/permissions/storage/libsql";
|
|
46
|
+
*
|
|
47
|
+
* const storage = createLibsqlStorage({
|
|
48
|
+
* url: process.env.TURSO_DATABASE_URL!,
|
|
49
|
+
* authToken: process.env.TURSO_AUTH_TOKEN,
|
|
50
|
+
* });
|
|
51
|
+
* // process.on("SIGTERM", () => storage.close());
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
function createLibsqlStorage(options) {
|
|
55
|
+
return _xtandard_kit_storage_libsql.createLibsqlStorage({
|
|
56
|
+
subpath: "@xtandard/permissions/storage/libsql",
|
|
57
|
+
...options,
|
|
58
|
+
table: options.table ?? "xtandard_permissions_kv"
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.createLibsqlStorage = createLibsqlStorage;
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=entry-storage-libsql.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-storage-libsql.cjs","names":["kit"],"sources":["../src/storage/libsql.ts"],"sourcesContent":["/**\n * libSQL / [Turso](https://turso.tech) storage adapter built on the\n * [`@libsql/client`](https://github.com/tursodatabase/libsql-client-ts) package\n * (an optional peer dependency). It speaks the same SQL dialect as SQLite but\n * works against a **remote, replicated, edge-distributed** database — or a local\n * file / embedded replica — so it suits multi-node and edge runtimes where\n * `bun:sqlite` (single-file, Bun-only) does not.\n *\n * Pass either a pre-constructed `client`, or `url` (+ optional `authToken`) to let\n * the adapter construct one lazily on first use. Keys are stored verbatim as the\n * primary key; namespace via a distinct `table` or a separate database.\n *\n * Values are stored as canonical JSON, so `compareAndSwap` is one atomic\n * `UPDATE … WHERE value = ?` evaluated by the server.\n *\n * ```ts\n * import { createLibsqlStorage } from \"@xtandard/permissions/storage/libsql\";\n *\n * // Turso (remote):\n * const storage = createLibsqlStorage({\n * url: process.env.TURSO_DATABASE_URL!, // libsql://<db>-<org>.turso.io\n * authToken: process.env.TURSO_AUTH_TOKEN!,\n * });\n *\n * // Local file or embedded replica:\n * // const storage = createLibsqlStorage({ url: \"file:permissions.db\" });\n * ```\n *\n * The driver is `@xtandard/kit/storage/libsql`.\n *\n * @module\n */\n\nimport * as kit from \"@xtandard/kit/storage/libsql\";\n\nexport type { LibsqlClientLike } from \"@xtandard/kit/storage/libsql\";\n\n/** Options for {@link createLibsqlStorage}. `table` defaults to `\"xtandard_permissions_kv\"`. */\nexport type LibsqlStorageOptions = kit.LibsqlStorageOptions;\n\n/** A compare-and-swap capable storage backed by libSQL/Turso, plus `close()`. */\nexport type LibsqlPermissionsStorage = kit.LibsqlKvStorage;\n\n/**\n * Create a libSQL/Turso-backed {@link LibsqlPermissionsStorage}. The table is\n * created on first use; connection (when constructed from `url`) is lazy and\n * shared.\n *\n * @example\n * ```ts\n * import { createLibsqlStorage } from \"@xtandard/permissions/storage/libsql\";\n *\n * const storage = createLibsqlStorage({\n * url: process.env.TURSO_DATABASE_URL!,\n * authToken: process.env.TURSO_AUTH_TOKEN,\n * });\n * // process.on(\"SIGTERM\", () => storage.close());\n * ```\n */\nexport function createLibsqlStorage(options: LibsqlStorageOptions): LibsqlPermissionsStorage {\n return kit.createLibsqlStorage({\n subpath: \"@xtandard/permissions/storage/libsql\",\n ...options,\n table: options.table ?? \"xtandard_permissions_kv\",\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,SAAgB,oBAAoB,SAAyD;CAC3F,OAAOA,6BAAI,oBAAoB;EAC7B,SAAS;EACT,GAAG;EACH,OAAO,QAAQ,SAAS;CAC1B,CAAC;AACH"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as kit from "@xtandard/kit/storage/libsql";
|
|
2
|
+
import { LibsqlClientLike } from "@xtandard/kit/storage/libsql";
|
|
3
|
+
|
|
4
|
+
//#region src/storage/libsql.d.ts
|
|
5
|
+
/** Options for {@link createLibsqlStorage}. `table` defaults to `"xtandard_permissions_kv"`. */
|
|
6
|
+
type LibsqlStorageOptions = kit.LibsqlStorageOptions;
|
|
7
|
+
/** A compare-and-swap capable storage backed by libSQL/Turso, plus `close()`. */
|
|
8
|
+
type LibsqlPermissionsStorage = kit.LibsqlKvStorage;
|
|
9
|
+
/**
|
|
10
|
+
* Create a libSQL/Turso-backed {@link LibsqlPermissionsStorage}. The table is
|
|
11
|
+
* created on first use; connection (when constructed from `url`) is lazy and
|
|
12
|
+
* shared.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { createLibsqlStorage } from "@xtandard/permissions/storage/libsql";
|
|
17
|
+
*
|
|
18
|
+
* const storage = createLibsqlStorage({
|
|
19
|
+
* url: process.env.TURSO_DATABASE_URL!,
|
|
20
|
+
* authToken: process.env.TURSO_AUTH_TOKEN,
|
|
21
|
+
* });
|
|
22
|
+
* // process.on("SIGTERM", () => storage.close());
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function createLibsqlStorage(options: LibsqlStorageOptions): LibsqlPermissionsStorage;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { type LibsqlClientLike, type LibsqlPermissionsStorage, type LibsqlStorageOptions, createLibsqlStorage };
|
|
28
|
+
//# sourceMappingURL=entry-storage-libsql.d.cts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as kit from "@xtandard/kit/storage/libsql";
|
|
2
|
+
import { LibsqlClientLike } from "@xtandard/kit/storage/libsql";
|
|
3
|
+
|
|
4
|
+
//#region src/storage/libsql.d.ts
|
|
5
|
+
/** Options for {@link createLibsqlStorage}. `table` defaults to `"xtandard_permissions_kv"`. */
|
|
6
|
+
type LibsqlStorageOptions = kit.LibsqlStorageOptions;
|
|
7
|
+
/** A compare-and-swap capable storage backed by libSQL/Turso, plus `close()`. */
|
|
8
|
+
type LibsqlPermissionsStorage = kit.LibsqlKvStorage;
|
|
9
|
+
/**
|
|
10
|
+
* Create a libSQL/Turso-backed {@link LibsqlPermissionsStorage}. The table is
|
|
11
|
+
* created on first use; connection (when constructed from `url`) is lazy and
|
|
12
|
+
* shared.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { createLibsqlStorage } from "@xtandard/permissions/storage/libsql";
|
|
17
|
+
*
|
|
18
|
+
* const storage = createLibsqlStorage({
|
|
19
|
+
* url: process.env.TURSO_DATABASE_URL!,
|
|
20
|
+
* authToken: process.env.TURSO_AUTH_TOKEN,
|
|
21
|
+
* });
|
|
22
|
+
* // process.on("SIGTERM", () => storage.close());
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function createLibsqlStorage(options: LibsqlStorageOptions): LibsqlPermissionsStorage;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { type LibsqlClientLike, type LibsqlPermissionsStorage, type LibsqlStorageOptions, createLibsqlStorage };
|
|
28
|
+
//# sourceMappingURL=entry-storage-libsql.d.mts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as kit from "@xtandard/kit/storage/libsql";
|
|
2
|
+
//#region src/storage/libsql.ts
|
|
3
|
+
/**
|
|
4
|
+
* libSQL / [Turso](https://turso.tech) storage adapter built on the
|
|
5
|
+
* [`@libsql/client`](https://github.com/tursodatabase/libsql-client-ts) package
|
|
6
|
+
* (an optional peer dependency). It speaks the same SQL dialect as SQLite but
|
|
7
|
+
* works against a **remote, replicated, edge-distributed** database — or a local
|
|
8
|
+
* file / embedded replica — so it suits multi-node and edge runtimes where
|
|
9
|
+
* `bun:sqlite` (single-file, Bun-only) does not.
|
|
10
|
+
*
|
|
11
|
+
* Pass either a pre-constructed `client`, or `url` (+ optional `authToken`) to let
|
|
12
|
+
* the adapter construct one lazily on first use. Keys are stored verbatim as the
|
|
13
|
+
* primary key; namespace via a distinct `table` or a separate database.
|
|
14
|
+
*
|
|
15
|
+
* Values are stored as canonical JSON, so `compareAndSwap` is one atomic
|
|
16
|
+
* `UPDATE … WHERE value = ?` evaluated by the server.
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { createLibsqlStorage } from "@xtandard/permissions/storage/libsql";
|
|
20
|
+
*
|
|
21
|
+
* // Turso (remote):
|
|
22
|
+
* const storage = createLibsqlStorage({
|
|
23
|
+
* url: process.env.TURSO_DATABASE_URL!, // libsql://<db>-<org>.turso.io
|
|
24
|
+
* authToken: process.env.TURSO_AUTH_TOKEN!,
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Local file or embedded replica:
|
|
28
|
+
* // const storage = createLibsqlStorage({ url: "file:permissions.db" });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* The driver is `@xtandard/kit/storage/libsql`.
|
|
32
|
+
*
|
|
33
|
+
* @module
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Create a libSQL/Turso-backed {@link LibsqlPermissionsStorage}. The table is
|
|
37
|
+
* created on first use; connection (when constructed from `url`) is lazy and
|
|
38
|
+
* shared.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { createLibsqlStorage } from "@xtandard/permissions/storage/libsql";
|
|
43
|
+
*
|
|
44
|
+
* const storage = createLibsqlStorage({
|
|
45
|
+
* url: process.env.TURSO_DATABASE_URL!,
|
|
46
|
+
* authToken: process.env.TURSO_AUTH_TOKEN,
|
|
47
|
+
* });
|
|
48
|
+
* // process.on("SIGTERM", () => storage.close());
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
function createLibsqlStorage(options) {
|
|
52
|
+
return kit.createLibsqlStorage({
|
|
53
|
+
subpath: "@xtandard/permissions/storage/libsql",
|
|
54
|
+
...options,
|
|
55
|
+
table: options.table ?? "xtandard_permissions_kv"
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { createLibsqlStorage };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=entry-storage-libsql.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-storage-libsql.mjs","names":[],"sources":["../src/storage/libsql.ts"],"sourcesContent":["/**\n * libSQL / [Turso](https://turso.tech) storage adapter built on the\n * [`@libsql/client`](https://github.com/tursodatabase/libsql-client-ts) package\n * (an optional peer dependency). It speaks the same SQL dialect as SQLite but\n * works against a **remote, replicated, edge-distributed** database — or a local\n * file / embedded replica — so it suits multi-node and edge runtimes where\n * `bun:sqlite` (single-file, Bun-only) does not.\n *\n * Pass either a pre-constructed `client`, or `url` (+ optional `authToken`) to let\n * the adapter construct one lazily on first use. Keys are stored verbatim as the\n * primary key; namespace via a distinct `table` or a separate database.\n *\n * Values are stored as canonical JSON, so `compareAndSwap` is one atomic\n * `UPDATE … WHERE value = ?` evaluated by the server.\n *\n * ```ts\n * import { createLibsqlStorage } from \"@xtandard/permissions/storage/libsql\";\n *\n * // Turso (remote):\n * const storage = createLibsqlStorage({\n * url: process.env.TURSO_DATABASE_URL!, // libsql://<db>-<org>.turso.io\n * authToken: process.env.TURSO_AUTH_TOKEN!,\n * });\n *\n * // Local file or embedded replica:\n * // const storage = createLibsqlStorage({ url: \"file:permissions.db\" });\n * ```\n *\n * The driver is `@xtandard/kit/storage/libsql`.\n *\n * @module\n */\n\nimport * as kit from \"@xtandard/kit/storage/libsql\";\n\nexport type { LibsqlClientLike } from \"@xtandard/kit/storage/libsql\";\n\n/** Options for {@link createLibsqlStorage}. `table` defaults to `\"xtandard_permissions_kv\"`. */\nexport type LibsqlStorageOptions = kit.LibsqlStorageOptions;\n\n/** A compare-and-swap capable storage backed by libSQL/Turso, plus `close()`. */\nexport type LibsqlPermissionsStorage = kit.LibsqlKvStorage;\n\n/**\n * Create a libSQL/Turso-backed {@link LibsqlPermissionsStorage}. The table is\n * created on first use; connection (when constructed from `url`) is lazy and\n * shared.\n *\n * @example\n * ```ts\n * import { createLibsqlStorage } from \"@xtandard/permissions/storage/libsql\";\n *\n * const storage = createLibsqlStorage({\n * url: process.env.TURSO_DATABASE_URL!,\n * authToken: process.env.TURSO_AUTH_TOKEN,\n * });\n * // process.on(\"SIGTERM\", () => storage.close());\n * ```\n */\nexport function createLibsqlStorage(options: LibsqlStorageOptions): LibsqlPermissionsStorage {\n return kit.createLibsqlStorage({\n subpath: \"@xtandard/permissions/storage/libsql\",\n ...options,\n table: options.table ?? \"xtandard_permissions_kv\",\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,SAAgB,oBAAoB,SAAyD;CAC3F,OAAO,IAAI,oBAAoB;EAC7B,SAAS;EACT,GAAG;EACH,OAAO,QAAQ,SAAS;CAC1B,CAAC;AACH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as kit from "@xtandard/kit/storage/memory";
|
|
2
|
+
|
|
3
|
+
//#region src/storage/memory.d.ts
|
|
4
|
+
/** Options for {@link createMemoryStorage}. */
|
|
5
|
+
type MemoryStorageOptions = kit.MemoryStorageOptions;
|
|
6
|
+
/** The memory storage: watchable and compare-and-swap capable. */
|
|
7
|
+
type MemoryPermissionsStorage = kit.MemoryKvStorage;
|
|
8
|
+
/**
|
|
9
|
+
* Create an in-memory storage implementing both `watch` (callbacks fire on the
|
|
10
|
+
* next microtask after a write/remove) and `compareAndSwap` (structural
|
|
11
|
+
* equality; race-free in-process).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { createMemoryStorage } from "@xtandard/permissions/storage/memory";
|
|
16
|
+
*
|
|
17
|
+
* const storage = createMemoryStorage();
|
|
18
|
+
* // Optionally seed with pre-existing data:
|
|
19
|
+
* // const storage = createMemoryStorage({ initial: { "my-key": { value: 1 } } });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare function createMemoryStorage(options?: MemoryStorageOptions): MemoryPermissionsStorage;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { type MemoryPermissionsStorage, type MemoryStorageOptions, createMemoryStorage };
|
|
25
|
+
//# sourceMappingURL=entry-storage-memory.d.cts.map
|