@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,886 @@
|
|
|
1
|
+
import { f as PermissionsSubject, h as SubjectIdentity } from "./catalog-DA_d1SdC.cjs";
|
|
2
|
+
import { r as RoleMapper } from "./contract-BMiOmg2f.cjs";
|
|
3
|
+
import { r as BetterAuthSessionLike } from "./better-auth-Bp9YVyQa.cjs";
|
|
4
|
+
import { t as AnyPermissions } from "./engine-CGGVDCqi.cjs";
|
|
5
|
+
import * as v from "valibot";
|
|
6
|
+
|
|
7
|
+
//#region node_modules/better-call/dist/standard-schema.d.mts
|
|
8
|
+
/** The Standard Schema interface. */
|
|
9
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
10
|
+
/** The Standard Schema properties. */
|
|
11
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
12
|
+
}
|
|
13
|
+
declare namespace StandardSchemaV1 {
|
|
14
|
+
/** The Standard Schema properties interface. */
|
|
15
|
+
interface Props<Input = unknown, Output = Input> {
|
|
16
|
+
/** The version number of the standard. */
|
|
17
|
+
readonly version: 1;
|
|
18
|
+
/** The vendor name of the schema library. */
|
|
19
|
+
readonly vendor: string;
|
|
20
|
+
/** Validates unknown input values. */
|
|
21
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
22
|
+
/** Inferred types associated with the schema. */
|
|
23
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
24
|
+
}
|
|
25
|
+
/** The result interface of the validate function. */
|
|
26
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
27
|
+
/** The result interface if validation succeeds. */
|
|
28
|
+
interface SuccessResult<Output> {
|
|
29
|
+
/** The typed output value. */
|
|
30
|
+
readonly value: Output;
|
|
31
|
+
/** The non-existent issues. */
|
|
32
|
+
readonly issues?: undefined;
|
|
33
|
+
}
|
|
34
|
+
/** The result interface if validation fails. */
|
|
35
|
+
interface FailureResult {
|
|
36
|
+
/** The issues of failed validation. */
|
|
37
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
38
|
+
}
|
|
39
|
+
/** The issue interface of the failure output. */
|
|
40
|
+
interface Issue {
|
|
41
|
+
/** The error message of the issue. */
|
|
42
|
+
readonly message: string;
|
|
43
|
+
/** The path of the issue, if any. */
|
|
44
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
45
|
+
}
|
|
46
|
+
/** The path segment interface of the issue. */
|
|
47
|
+
interface PathSegment {
|
|
48
|
+
/** The key representing a path segment. */
|
|
49
|
+
readonly key: PropertyKey;
|
|
50
|
+
}
|
|
51
|
+
/** The Standard Schema types interface. */
|
|
52
|
+
interface Types<Input = unknown, Output = Input> {
|
|
53
|
+
/** The input type of the schema. */
|
|
54
|
+
readonly input: Input;
|
|
55
|
+
/** The output type of the schema. */
|
|
56
|
+
readonly output: Output;
|
|
57
|
+
}
|
|
58
|
+
/** Infers the input type of a Standard Schema. */
|
|
59
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
60
|
+
/** Infers the output type of a Standard Schema. */
|
|
61
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region node_modules/better-call/dist/error.d.mts
|
|
65
|
+
declare const statusCodes: {
|
|
66
|
+
OK: number;
|
|
67
|
+
CREATED: number;
|
|
68
|
+
ACCEPTED: number;
|
|
69
|
+
NO_CONTENT: number;
|
|
70
|
+
MULTIPLE_CHOICES: number;
|
|
71
|
+
MOVED_PERMANENTLY: number;
|
|
72
|
+
FOUND: number;
|
|
73
|
+
SEE_OTHER: number;
|
|
74
|
+
NOT_MODIFIED: number;
|
|
75
|
+
TEMPORARY_REDIRECT: number;
|
|
76
|
+
BAD_REQUEST: number;
|
|
77
|
+
UNAUTHORIZED: number;
|
|
78
|
+
PAYMENT_REQUIRED: number;
|
|
79
|
+
FORBIDDEN: number;
|
|
80
|
+
NOT_FOUND: number;
|
|
81
|
+
METHOD_NOT_ALLOWED: number;
|
|
82
|
+
NOT_ACCEPTABLE: number;
|
|
83
|
+
PROXY_AUTHENTICATION_REQUIRED: number;
|
|
84
|
+
REQUEST_TIMEOUT: number;
|
|
85
|
+
CONFLICT: number;
|
|
86
|
+
GONE: number;
|
|
87
|
+
LENGTH_REQUIRED: number;
|
|
88
|
+
PRECONDITION_FAILED: number;
|
|
89
|
+
PAYLOAD_TOO_LARGE: number;
|
|
90
|
+
URI_TOO_LONG: number;
|
|
91
|
+
UNSUPPORTED_MEDIA_TYPE: number;
|
|
92
|
+
RANGE_NOT_SATISFIABLE: number;
|
|
93
|
+
EXPECTATION_FAILED: number;
|
|
94
|
+
"I'M_A_TEAPOT": number;
|
|
95
|
+
MISDIRECTED_REQUEST: number;
|
|
96
|
+
UNPROCESSABLE_ENTITY: number;
|
|
97
|
+
LOCKED: number;
|
|
98
|
+
FAILED_DEPENDENCY: number;
|
|
99
|
+
TOO_EARLY: number;
|
|
100
|
+
UPGRADE_REQUIRED: number;
|
|
101
|
+
PRECONDITION_REQUIRED: number;
|
|
102
|
+
TOO_MANY_REQUESTS: number;
|
|
103
|
+
REQUEST_HEADER_FIELDS_TOO_LARGE: number;
|
|
104
|
+
UNAVAILABLE_FOR_LEGAL_REASONS: number;
|
|
105
|
+
INTERNAL_SERVER_ERROR: number;
|
|
106
|
+
NOT_IMPLEMENTED: number;
|
|
107
|
+
BAD_GATEWAY: number;
|
|
108
|
+
SERVICE_UNAVAILABLE: number;
|
|
109
|
+
GATEWAY_TIMEOUT: number;
|
|
110
|
+
HTTP_VERSION_NOT_SUPPORTED: number;
|
|
111
|
+
VARIANT_ALSO_NEGOTIATES: number;
|
|
112
|
+
INSUFFICIENT_STORAGE: number;
|
|
113
|
+
LOOP_DETECTED: number;
|
|
114
|
+
NOT_EXTENDED: number;
|
|
115
|
+
NETWORK_AUTHENTICATION_REQUIRED: number;
|
|
116
|
+
};
|
|
117
|
+
type Status = 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
118
|
+
declare class InternalAPIError extends Error {
|
|
119
|
+
status: keyof typeof statusCodes | Status;
|
|
120
|
+
body: ({
|
|
121
|
+
message?: string;
|
|
122
|
+
code?: string;
|
|
123
|
+
cause?: unknown;
|
|
124
|
+
} & Record<string, any>) | undefined;
|
|
125
|
+
headers: HeadersInit;
|
|
126
|
+
statusCode: number;
|
|
127
|
+
constructor(status?: keyof typeof statusCodes | Status, body?: ({
|
|
128
|
+
message?: string;
|
|
129
|
+
code?: string;
|
|
130
|
+
cause?: unknown;
|
|
131
|
+
} & Record<string, any>) | undefined, headers?: HeadersInit, statusCode?: number);
|
|
132
|
+
}
|
|
133
|
+
type APIError = InstanceType<typeof InternalAPIError>;
|
|
134
|
+
declare const APIError: new (status?: Status | "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED" | undefined, body?: ({
|
|
135
|
+
message?: string;
|
|
136
|
+
code?: string;
|
|
137
|
+
cause?: unknown;
|
|
138
|
+
} & Record<string, any>) | undefined, headers?: HeadersInit | undefined, statusCode?: number | undefined) => InternalAPIError & {
|
|
139
|
+
errorStack: string | undefined;
|
|
140
|
+
};
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region node_modules/better-call/dist/helper.d.mts
|
|
143
|
+
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
144
|
+
type IsEmptyObject<T> = keyof T extends never ? true : false;
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region node_modules/better-call/dist/middleware.d.mts
|
|
147
|
+
interface MiddlewareOptions extends Omit<EndpointOptions, "method"> {}
|
|
148
|
+
type MiddlewareInputContext<Options extends MiddlewareOptions> = InferBodyInput<Options> & InferQueryInput<Options> & InferRequestInput<Options> & InferHeadersInput<Options> & {
|
|
149
|
+
asResponse?: boolean;
|
|
150
|
+
returnHeaders?: boolean;
|
|
151
|
+
use?: MiddlewareHandler[];
|
|
152
|
+
};
|
|
153
|
+
type MiddlewareFunction = (...args: never[]) => Promise<unknown>;
|
|
154
|
+
type MiddlewareHandler = (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<unknown>;
|
|
155
|
+
type Middleware<Options extends MiddlewareOptions = MiddlewareOptions, Handler extends MiddlewareFunction = MiddlewareHandler> = Handler & {
|
|
156
|
+
options: Options;
|
|
157
|
+
};
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region node_modules/better-call/dist/openapi.d.mts
|
|
160
|
+
type OpenAPISchemaType = "string" | "number" | "integer" | "boolean" | "array" | "object";
|
|
161
|
+
interface OpenAPIParameter {
|
|
162
|
+
in: "query" | "path" | "header" | "cookie";
|
|
163
|
+
name?: string | undefined;
|
|
164
|
+
description?: string | undefined;
|
|
165
|
+
required?: boolean | undefined;
|
|
166
|
+
schema?: {
|
|
167
|
+
type: OpenAPISchemaType;
|
|
168
|
+
format?: string | undefined;
|
|
169
|
+
items?: {
|
|
170
|
+
type: OpenAPISchemaType;
|
|
171
|
+
} | undefined;
|
|
172
|
+
enum?: string[] | undefined;
|
|
173
|
+
minLength?: number | undefined;
|
|
174
|
+
description?: string | undefined;
|
|
175
|
+
default?: string | undefined;
|
|
176
|
+
example?: string | undefined;
|
|
177
|
+
} | undefined;
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region node_modules/better-call/dist/endpoint.d.mts
|
|
181
|
+
interface EndpointBaseOptions {
|
|
182
|
+
/**
|
|
183
|
+
* Query Schema
|
|
184
|
+
*/
|
|
185
|
+
query?: StandardSchemaV1;
|
|
186
|
+
/**
|
|
187
|
+
* Error Schema
|
|
188
|
+
*/
|
|
189
|
+
error?: StandardSchemaV1;
|
|
190
|
+
/**
|
|
191
|
+
* If true headers will be required to be passed in the context
|
|
192
|
+
*/
|
|
193
|
+
requireHeaders?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* If true request object will be required
|
|
196
|
+
*/
|
|
197
|
+
requireRequest?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Clone the request object from the router
|
|
200
|
+
*/
|
|
201
|
+
cloneRequest?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* If true the body will be undefined
|
|
204
|
+
*/
|
|
205
|
+
disableBody?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Endpoint metadata
|
|
208
|
+
*/
|
|
209
|
+
metadata?: {
|
|
210
|
+
/**
|
|
211
|
+
* Open API definition
|
|
212
|
+
*/
|
|
213
|
+
openapi?: {
|
|
214
|
+
summary?: string | undefined;
|
|
215
|
+
description?: string | undefined;
|
|
216
|
+
tags?: string[] | undefined;
|
|
217
|
+
operationId?: string | undefined;
|
|
218
|
+
parameters?: OpenAPIParameter[] | undefined;
|
|
219
|
+
requestBody?: {
|
|
220
|
+
content: {
|
|
221
|
+
"application/json": {
|
|
222
|
+
schema: {
|
|
223
|
+
type?: OpenAPISchemaType | undefined;
|
|
224
|
+
properties?: Record<string, any> | undefined;
|
|
225
|
+
required?: string[] | undefined;
|
|
226
|
+
$ref?: string | undefined;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
} | undefined;
|
|
231
|
+
responses?: {
|
|
232
|
+
[status: string]: {
|
|
233
|
+
description: string;
|
|
234
|
+
content?: {
|
|
235
|
+
"application/json"?: {
|
|
236
|
+
schema: {
|
|
237
|
+
type?: OpenAPISchemaType | undefined;
|
|
238
|
+
properties?: Record<string, any> | undefined;
|
|
239
|
+
required?: string[] | undefined;
|
|
240
|
+
$ref?: string | undefined;
|
|
241
|
+
};
|
|
242
|
+
} | undefined;
|
|
243
|
+
"text/plain"?: {
|
|
244
|
+
schema?: {
|
|
245
|
+
type?: OpenAPISchemaType | undefined;
|
|
246
|
+
properties?: Record<string, any> | undefined;
|
|
247
|
+
required?: string[] | undefined;
|
|
248
|
+
$ref?: string | undefined;
|
|
249
|
+
} | undefined;
|
|
250
|
+
} | undefined;
|
|
251
|
+
"text/html"?: {
|
|
252
|
+
schema?: {
|
|
253
|
+
type?: OpenAPISchemaType | undefined;
|
|
254
|
+
properties?: Record<string, any> | undefined;
|
|
255
|
+
required?: string[] | undefined;
|
|
256
|
+
$ref?: string | undefined;
|
|
257
|
+
} | undefined;
|
|
258
|
+
} | undefined;
|
|
259
|
+
} | undefined;
|
|
260
|
+
};
|
|
261
|
+
} | undefined;
|
|
262
|
+
} | undefined;
|
|
263
|
+
/**
|
|
264
|
+
* Infer body and query type from ts interface
|
|
265
|
+
*
|
|
266
|
+
* useful for generic and dynamic types
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```ts
|
|
270
|
+
* const endpoint = createEndpoint("/path", {
|
|
271
|
+
* method: "POST",
|
|
272
|
+
* body: z.record(z.string()),
|
|
273
|
+
* $Infer: {
|
|
274
|
+
* body: {} as {
|
|
275
|
+
* type: InferTypeFromOptions<Option> // custom type inference
|
|
276
|
+
* }
|
|
277
|
+
* }
|
|
278
|
+
* }, async(ctx)=>{
|
|
279
|
+
* const body = ctx.body
|
|
280
|
+
* })
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
$Infer?: {
|
|
284
|
+
/**
|
|
285
|
+
* Body
|
|
286
|
+
*/
|
|
287
|
+
body?: any;
|
|
288
|
+
/**
|
|
289
|
+
* Query
|
|
290
|
+
*/
|
|
291
|
+
query?: Record<string, any>;
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* If enabled, endpoint won't be exposed over a router
|
|
295
|
+
* @deprecated Use path-less endpoints instead
|
|
296
|
+
*/
|
|
297
|
+
SERVER_ONLY?: boolean;
|
|
298
|
+
/**
|
|
299
|
+
* If enabled, endpoint won't be exposed as an action to the client
|
|
300
|
+
* @deprecated Use path-less endpoints instead
|
|
301
|
+
*/
|
|
302
|
+
isAction?: boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Defines the places where the endpoint will be available
|
|
305
|
+
*
|
|
306
|
+
* Possible options:
|
|
307
|
+
* - `rpc` - the endpoint is exposed to the router, can be invoked directly and is available to the client
|
|
308
|
+
* - `server` - the endpoint is exposed to the router, can be invoked directly, but is not available to the client
|
|
309
|
+
* - `http` - the endpoint is only exposed to the router
|
|
310
|
+
* @default "rpc"
|
|
311
|
+
*/
|
|
312
|
+
scope?: "rpc" | "server" | "http";
|
|
313
|
+
/**
|
|
314
|
+
* List of allowed media types (MIME types) for the endpoint
|
|
315
|
+
*
|
|
316
|
+
* if provided, only the media types in the list will be allowed to be passed in the body
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* ```ts
|
|
320
|
+
* const endpoint = createEndpoint("/path", {
|
|
321
|
+
* method: "POST",
|
|
322
|
+
* allowedMediaTypes: ["application/json", "application/x-www-form-urlencoded"],
|
|
323
|
+
* }, async(ctx)=>{
|
|
324
|
+
* const body = ctx.body
|
|
325
|
+
* })
|
|
326
|
+
* ```
|
|
327
|
+
*/
|
|
328
|
+
allowedMediaTypes?: string[];
|
|
329
|
+
/**
|
|
330
|
+
* Extra metadata
|
|
331
|
+
*/
|
|
332
|
+
[key: string]: any;
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* List of middlewares to use
|
|
336
|
+
*/
|
|
337
|
+
use?: MiddlewareHandler[] | undefined;
|
|
338
|
+
/**
|
|
339
|
+
* A callback to run before any API error is throw or returned
|
|
340
|
+
*
|
|
341
|
+
* @param e - The API error
|
|
342
|
+
* @returns - The response to return
|
|
343
|
+
*/
|
|
344
|
+
onAPIError?: (e: APIError) => void | Promise<void>;
|
|
345
|
+
/**
|
|
346
|
+
* A callback to run before a validation error is thrown
|
|
347
|
+
* You can customize the validation error message by throwing your own APIError
|
|
348
|
+
*/
|
|
349
|
+
onValidationError?: ({
|
|
350
|
+
issues,
|
|
351
|
+
message
|
|
352
|
+
}: {
|
|
353
|
+
message: string;
|
|
354
|
+
issues: readonly StandardSchemaV1.Issue[];
|
|
355
|
+
}) => void | Promise<void>;
|
|
356
|
+
}
|
|
357
|
+
type EndpointBodyMethodOptions = {
|
|
358
|
+
/**
|
|
359
|
+
* Request Method
|
|
360
|
+
*/
|
|
361
|
+
method: "POST" | "PUT" | "DELETE" | "PATCH" | ("POST" | "PUT" | "DELETE" | "PATCH")[];
|
|
362
|
+
/**
|
|
363
|
+
* Body Schema
|
|
364
|
+
*/
|
|
365
|
+
body?: StandardSchemaV1;
|
|
366
|
+
} | {
|
|
367
|
+
/**
|
|
368
|
+
* Request Method
|
|
369
|
+
*/
|
|
370
|
+
method: "GET" | "HEAD" | ("GET" | "HEAD")[];
|
|
371
|
+
/**
|
|
372
|
+
* Body Schema
|
|
373
|
+
*/
|
|
374
|
+
body?: never;
|
|
375
|
+
} | {
|
|
376
|
+
/**
|
|
377
|
+
* Request Method
|
|
378
|
+
*/
|
|
379
|
+
method: "*";
|
|
380
|
+
/**
|
|
381
|
+
* Body Schema
|
|
382
|
+
*/
|
|
383
|
+
body?: StandardSchemaV1;
|
|
384
|
+
} | {
|
|
385
|
+
/**
|
|
386
|
+
* Request Method
|
|
387
|
+
*/
|
|
388
|
+
method: ("POST" | "PUT" | "DELETE" | "PATCH" | "GET" | "HEAD")[];
|
|
389
|
+
/**
|
|
390
|
+
* Body Schema
|
|
391
|
+
*/
|
|
392
|
+
body?: StandardSchemaV1;
|
|
393
|
+
};
|
|
394
|
+
type EndpointOptions = EndpointBaseOptions & EndpointBodyMethodOptions;
|
|
395
|
+
type StrictEndpoint<Path extends string, Options extends EndpointOptions, R = any> = {
|
|
396
|
+
(context: InputContext<Path, Options> & {
|
|
397
|
+
asResponse: true;
|
|
398
|
+
}): Promise<Response>;
|
|
399
|
+
(context: InputContext<Path, Options> & {
|
|
400
|
+
returnHeaders: true;
|
|
401
|
+
returnStatus: true;
|
|
402
|
+
}): Promise<{
|
|
403
|
+
headers: Headers;
|
|
404
|
+
status: number;
|
|
405
|
+
response: Awaited<R>;
|
|
406
|
+
}>;
|
|
407
|
+
(context: InputContext<Path, Options> & {
|
|
408
|
+
returnHeaders: true;
|
|
409
|
+
returnStatus: false;
|
|
410
|
+
}): Promise<{
|
|
411
|
+
headers: Headers;
|
|
412
|
+
response: Awaited<R>;
|
|
413
|
+
}>;
|
|
414
|
+
(context: InputContext<Path, Options> & {
|
|
415
|
+
returnHeaders: false;
|
|
416
|
+
returnStatus: true;
|
|
417
|
+
}): Promise<{
|
|
418
|
+
status: number;
|
|
419
|
+
response: Awaited<R>;
|
|
420
|
+
}>;
|
|
421
|
+
(context: InputContext<Path, Options> & {
|
|
422
|
+
returnHeaders: false;
|
|
423
|
+
returnStatus: false;
|
|
424
|
+
}): Promise<R>;
|
|
425
|
+
(context: InputContext<Path, Options> & {
|
|
426
|
+
returnHeaders: true;
|
|
427
|
+
}): Promise<{
|
|
428
|
+
headers: Headers;
|
|
429
|
+
response: Awaited<R>;
|
|
430
|
+
}>;
|
|
431
|
+
(context: InputContext<Path, Options> & {
|
|
432
|
+
returnStatus: true;
|
|
433
|
+
}): Promise<{
|
|
434
|
+
status: number;
|
|
435
|
+
response: Awaited<R>;
|
|
436
|
+
}>;
|
|
437
|
+
(context?: InputContext<Path, Options>): Promise<R>;
|
|
438
|
+
options: Options;
|
|
439
|
+
path: Path;
|
|
440
|
+
};
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region node_modules/rou3/dist/index.d.mts
|
|
443
|
+
type ExtractWildcards<TPath extends string, Count extends readonly unknown[] = []> = TPath extends `${string}**:${infer Rest}` ? Rest extends `${infer Param}/${infer Tail}` ? Param | ExtractWildcards<Tail, Count> : Rest : TPath extends `${string}*${infer Rest}` ? Rest extends `*` ? `_` : `${Count["length"]}` | ExtractWildcards<Rest, [...Count, unknown]> : TPath extends `${string}/${infer Rest}` ? ExtractWildcards<Rest, Count> : never;
|
|
444
|
+
type ExtractNamedParams<TPath extends string> = TPath extends `${infer _Start}:${infer Rest}` ? Rest extends `${infer Param}/${infer Tail}` ? Param | ExtractNamedParams<`/${Tail}`> : Rest extends `${infer Param}*${infer Tail}` ? Param | ExtractNamedParams<`/${Tail}`> : Rest : TPath extends `/${infer Rest}` ? ExtractNamedParams<Rest> : never;
|
|
445
|
+
type InferRouteParams<TPath extends string> = { [K in ExtractNamedParams<TPath> | ExtractWildcards<TPath>]: string };
|
|
446
|
+
/**
|
|
447
|
+
* Create a new router context.
|
|
448
|
+
*/
|
|
449
|
+
//#endregion
|
|
450
|
+
//#region node_modules/better-call/dist/context.d.mts
|
|
451
|
+
type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
452
|
+
type InferBodyInput<Options extends EndpointOptions | MiddlewareOptions, Body = (Options["metadata"] extends {
|
|
453
|
+
$Infer: {
|
|
454
|
+
body: infer B;
|
|
455
|
+
};
|
|
456
|
+
} ? B : Options["body"] extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Options["body"]> : undefined)> = undefined extends Body ? {
|
|
457
|
+
body?: Body;
|
|
458
|
+
} : {
|
|
459
|
+
body: Body;
|
|
460
|
+
};
|
|
461
|
+
type InferQueryInput<Options extends EndpointOptions | MiddlewareOptions, Query = (Options["metadata"] extends {
|
|
462
|
+
$Infer: {
|
|
463
|
+
query: infer Query;
|
|
464
|
+
};
|
|
465
|
+
} ? Query : Options["query"] extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Options["query"]> : Record<string, any> | undefined)> = undefined extends Query ? {
|
|
466
|
+
query?: Query;
|
|
467
|
+
} : {
|
|
468
|
+
query: Query;
|
|
469
|
+
};
|
|
470
|
+
type InferInputMethod<Options extends EndpointOptions, Method = (Options["method"] extends Array<any> ? Options["method"][number] | undefined : Options["method"] extends "*" ? HTTPMethod : Options["method"] | undefined)> = undefined extends Method ? {
|
|
471
|
+
method?: Method;
|
|
472
|
+
} : {
|
|
473
|
+
method: Method;
|
|
474
|
+
};
|
|
475
|
+
type TrailingWildcardKey<Path extends string> = Path extends `${infer Prefix}/*${"" | "/"}` ? Exclude<keyof InferRouteParams<Path>, keyof InferRouteParams<Prefix>> : never;
|
|
476
|
+
type RouteParams<Path extends string> = { [Key in keyof InferRouteParams<Path>]: Key extends TrailingWildcardKey<Path> ? InferRouteParams<Path>[Key] | undefined : InferRouteParams<Path>[Key] };
|
|
477
|
+
type InferParamInput<Path extends string> = string extends Path ? {
|
|
478
|
+
params?: Record<string, string | undefined>;
|
|
479
|
+
} : [Path] extends [never] ? {
|
|
480
|
+
params?: Record<string, string | undefined>;
|
|
481
|
+
} : IsEmptyObject<RouteParams<Path>> extends true ? {
|
|
482
|
+
params?: Record<string, string | undefined>;
|
|
483
|
+
} : {
|
|
484
|
+
params: Prettify<RouteParams<Path>>;
|
|
485
|
+
};
|
|
486
|
+
type InferRequestInput<Option extends EndpointOptions | MiddlewareOptions> = Option["requireRequest"] extends true ? {
|
|
487
|
+
request: Request;
|
|
488
|
+
} : {
|
|
489
|
+
request?: Request | undefined;
|
|
490
|
+
};
|
|
491
|
+
type InferHeadersInput<Option extends EndpointOptions | MiddlewareOptions> = Option["requireHeaders"] extends true ? {
|
|
492
|
+
headers: HeadersInit;
|
|
493
|
+
} : {
|
|
494
|
+
headers?: HeadersInit | undefined;
|
|
495
|
+
};
|
|
496
|
+
type InputContext<Path extends string, Options extends EndpointOptions> = InferBodyInput<Options> & InferInputMethod<Options> & InferQueryInput<Options> & InferParamInput<Path> & InferRequestInput<Options> & InferHeadersInput<Options> & {
|
|
497
|
+
asResponse?: boolean;
|
|
498
|
+
returnHeaders?: boolean;
|
|
499
|
+
returnStatus?: boolean;
|
|
500
|
+
use?: MiddlewareHandler[];
|
|
501
|
+
path?: string;
|
|
502
|
+
context?: Record<string, any>;
|
|
503
|
+
};
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/better-auth/error-codes.d.ts
|
|
506
|
+
/**
|
|
507
|
+
* Error codes shared by the better-auth server and client plugins (`error.code` on the client).
|
|
508
|
+
*
|
|
509
|
+
* @module
|
|
510
|
+
*/
|
|
511
|
+
declare const PERMISSIONS_ERROR_CODES: {
|
|
512
|
+
readonly PERMISSIONS_FORBIDDEN: {
|
|
513
|
+
readonly code: "PERMISSIONS_FORBIDDEN";
|
|
514
|
+
readonly message: "You are not allowed to manage permissions";
|
|
515
|
+
};
|
|
516
|
+
readonly PERMISSIONS_UNKNOWN_PERMISSION: {
|
|
517
|
+
readonly code: "PERMISSIONS_UNKNOWN_PERMISSION";
|
|
518
|
+
readonly message: "Unknown permission";
|
|
519
|
+
};
|
|
520
|
+
readonly PERMISSIONS_UNKNOWN_ROLE: {
|
|
521
|
+
readonly code: "PERMISSIONS_UNKNOWN_ROLE";
|
|
522
|
+
readonly message: "Unknown role";
|
|
523
|
+
};
|
|
524
|
+
readonly PERMISSIONS_INVALID_INPUT: {
|
|
525
|
+
readonly code: "PERMISSIONS_INVALID_INPUT";
|
|
526
|
+
readonly message: "Invalid input";
|
|
527
|
+
};
|
|
528
|
+
readonly PERMISSIONS_NOT_FOUND: {
|
|
529
|
+
readonly code: "PERMISSIONS_NOT_FOUND";
|
|
530
|
+
readonly message: "Not found";
|
|
531
|
+
};
|
|
532
|
+
readonly PERMISSIONS_READONLY: {
|
|
533
|
+
readonly code: "PERMISSIONS_READONLY";
|
|
534
|
+
readonly message: "Permissions are read-only";
|
|
535
|
+
};
|
|
536
|
+
readonly PERMISSIONS_NO_SUBJECT: {
|
|
537
|
+
readonly code: "PERMISSIONS_NO_SUBJECT";
|
|
538
|
+
readonly message: "No subject";
|
|
539
|
+
};
|
|
540
|
+
readonly PERMISSIONS_INVALID_RELATION: {
|
|
541
|
+
readonly code: "PERMISSIONS_INVALID_RELATION";
|
|
542
|
+
readonly message: "Invalid relation (not in the catalog's relation schema)";
|
|
543
|
+
};
|
|
544
|
+
};
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/better-auth/server.d.ts
|
|
547
|
+
/** Options for {@link permissions}. */
|
|
548
|
+
interface PermissionsPluginOptions<P extends AnyPermissions = AnyPermissions> {
|
|
549
|
+
/** The engine (`createPermissions(...)`). */
|
|
550
|
+
engine: P;
|
|
551
|
+
/**
|
|
552
|
+
* May this subject grant, revoke and read other subjects' grants? `subject.role` is the effective
|
|
553
|
+
* role. Default: the role is one of the catalog's `managerRoles`.
|
|
554
|
+
*/
|
|
555
|
+
canManage?(subject: PermissionsSubject, request: Request): boolean | Promise<boolean>;
|
|
556
|
+
/**
|
|
557
|
+
* Map the better-auth session to a subject. Default: `user.id`, the admin plugin's `user.role`
|
|
558
|
+
* (through `mapRole`), `name`, `email`, and `activeOrganizationId` as an attribute. Return `null`
|
|
559
|
+
* to treat the session as anonymous (401 on every endpoint).
|
|
560
|
+
*/
|
|
561
|
+
mapSubject?(session: BetterAuthSessionLike, request: Request): SubjectIdentity | null | Promise<SubjectIdentity | null>;
|
|
562
|
+
/** Rename better-auth roles to catalog roles (`{ user: "member" }`). Ignored with `mapSubject`. */
|
|
563
|
+
mapRole?: RoleMapper;
|
|
564
|
+
/** The caller's ReBAC subject for `/permissions/relation`. Default `user:{id}`. */
|
|
565
|
+
relationSubject?(subject: PermissionsSubject): string;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* The better-auth server plugin.
|
|
569
|
+
*
|
|
570
|
+
* @example
|
|
571
|
+
* ```ts
|
|
572
|
+
* import { betterAuth } from "better-auth";
|
|
573
|
+
* import { admin } from "better-auth/plugins";
|
|
574
|
+
* import { permissions } from "@xtandard/permissions/better-auth";
|
|
575
|
+
*
|
|
576
|
+
* export const auth = betterAuth({
|
|
577
|
+
* emailAndPassword: { enabled: true },
|
|
578
|
+
* plugins: [admin(), permissions({ engine: perms, mapRole: { user: "member" } })],
|
|
579
|
+
* });
|
|
580
|
+
* ```
|
|
581
|
+
*/
|
|
582
|
+
declare const permissions: <P extends AnyPermissions>(options: PermissionsPluginOptions<P>) => {
|
|
583
|
+
id: string;
|
|
584
|
+
endpoints: {
|
|
585
|
+
getPermissions: StrictEndpoint<"/permissions/me", {
|
|
586
|
+
method: "GET";
|
|
587
|
+
use: Middleware<MiddlewareOptions, (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<{
|
|
588
|
+
session: {
|
|
589
|
+
session: Record<string, any> & {
|
|
590
|
+
id: string;
|
|
591
|
+
createdAt: Date;
|
|
592
|
+
updatedAt: Date;
|
|
593
|
+
userId: string;
|
|
594
|
+
expiresAt: Date;
|
|
595
|
+
token: string;
|
|
596
|
+
ipAddress?: string | null | undefined;
|
|
597
|
+
userAgent?: string | null | undefined;
|
|
598
|
+
};
|
|
599
|
+
user: Record<string, any> & {
|
|
600
|
+
id: string;
|
|
601
|
+
createdAt: Date;
|
|
602
|
+
updatedAt: Date;
|
|
603
|
+
email: string;
|
|
604
|
+
emailVerified: boolean;
|
|
605
|
+
name: string;
|
|
606
|
+
image?: string | null | undefined;
|
|
607
|
+
};
|
|
608
|
+
};
|
|
609
|
+
}>>[];
|
|
610
|
+
metadata: {
|
|
611
|
+
openapi: {
|
|
612
|
+
operationId: string;
|
|
613
|
+
summary: string;
|
|
614
|
+
description: string;
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
}, {
|
|
618
|
+
subject: PermissionsSubject;
|
|
619
|
+
canManage: boolean;
|
|
620
|
+
snapshot: Awaited<ReturnType<P["snapshot"]>>;
|
|
621
|
+
}>;
|
|
622
|
+
checkPermission: StrictEndpoint<"/permissions/check", {
|
|
623
|
+
method: "POST";
|
|
624
|
+
use: Middleware<MiddlewareOptions, (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<{
|
|
625
|
+
session: {
|
|
626
|
+
session: Record<string, any> & {
|
|
627
|
+
id: string;
|
|
628
|
+
createdAt: Date;
|
|
629
|
+
updatedAt: Date;
|
|
630
|
+
userId: string;
|
|
631
|
+
expiresAt: Date;
|
|
632
|
+
token: string;
|
|
633
|
+
ipAddress?: string | null | undefined;
|
|
634
|
+
userAgent?: string | null | undefined;
|
|
635
|
+
};
|
|
636
|
+
user: Record<string, any> & {
|
|
637
|
+
id: string;
|
|
638
|
+
createdAt: Date;
|
|
639
|
+
updatedAt: Date;
|
|
640
|
+
email: string;
|
|
641
|
+
emailVerified: boolean;
|
|
642
|
+
name: string;
|
|
643
|
+
image?: string | null | undefined;
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
}>>[];
|
|
647
|
+
body: v.ObjectSchema<{
|
|
648
|
+
readonly path: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>;
|
|
649
|
+
readonly data: v.OptionalSchema<v.UnknownSchema, undefined>; /** Check another subject (manage only). Default: the caller. */
|
|
650
|
+
readonly subject: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>, undefined>;
|
|
651
|
+
}, undefined>;
|
|
652
|
+
metadata: {
|
|
653
|
+
openapi: {
|
|
654
|
+
operationId: string;
|
|
655
|
+
summary: string;
|
|
656
|
+
};
|
|
657
|
+
};
|
|
658
|
+
}, ReturnType<P["check"]>>;
|
|
659
|
+
checkRelation: StrictEndpoint<"/permissions/relation", {
|
|
660
|
+
method: "POST";
|
|
661
|
+
use: Middleware<MiddlewareOptions, (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<{
|
|
662
|
+
session: {
|
|
663
|
+
session: Record<string, any> & {
|
|
664
|
+
id: string;
|
|
665
|
+
createdAt: Date;
|
|
666
|
+
updatedAt: Date;
|
|
667
|
+
userId: string;
|
|
668
|
+
expiresAt: Date;
|
|
669
|
+
token: string;
|
|
670
|
+
ipAddress?: string | null | undefined;
|
|
671
|
+
userAgent?: string | null | undefined;
|
|
672
|
+
};
|
|
673
|
+
user: Record<string, any> & {
|
|
674
|
+
id: string;
|
|
675
|
+
createdAt: Date;
|
|
676
|
+
updatedAt: Date;
|
|
677
|
+
email: string;
|
|
678
|
+
emailVerified: boolean;
|
|
679
|
+
name: string;
|
|
680
|
+
image?: string | null | undefined;
|
|
681
|
+
};
|
|
682
|
+
};
|
|
683
|
+
}>>[];
|
|
684
|
+
body: v.ObjectSchema<{
|
|
685
|
+
readonly relation: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>;
|
|
686
|
+
readonly object: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>;
|
|
687
|
+
}, undefined>;
|
|
688
|
+
metadata: {
|
|
689
|
+
openapi: {
|
|
690
|
+
operationId: string;
|
|
691
|
+
summary: string;
|
|
692
|
+
};
|
|
693
|
+
};
|
|
694
|
+
}, import("@xtandard/lib/policy/rebac").RelationExplanation>;
|
|
695
|
+
listPermissionGrants: StrictEndpoint<"/permissions/list", {
|
|
696
|
+
method: "GET";
|
|
697
|
+
use: Middleware<MiddlewareOptions, (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<{
|
|
698
|
+
session: {
|
|
699
|
+
session: Record<string, any> & {
|
|
700
|
+
id: string;
|
|
701
|
+
createdAt: Date;
|
|
702
|
+
updatedAt: Date;
|
|
703
|
+
userId: string;
|
|
704
|
+
expiresAt: Date;
|
|
705
|
+
token: string;
|
|
706
|
+
ipAddress?: string | null | undefined;
|
|
707
|
+
userAgent?: string | null | undefined;
|
|
708
|
+
};
|
|
709
|
+
user: Record<string, any> & {
|
|
710
|
+
id: string;
|
|
711
|
+
createdAt: Date;
|
|
712
|
+
updatedAt: Date;
|
|
713
|
+
email: string;
|
|
714
|
+
emailVerified: boolean;
|
|
715
|
+
name: string;
|
|
716
|
+
image?: string | null | undefined;
|
|
717
|
+
};
|
|
718
|
+
};
|
|
719
|
+
}>>[];
|
|
720
|
+
query: v.OptionalSchema<v.ObjectSchema<{
|
|
721
|
+
readonly subject: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>, undefined>;
|
|
722
|
+
readonly permission: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>, undefined>;
|
|
723
|
+
readonly includeExpired: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.BooleanSchema<undefined>, v.PicklistSchema<["true", "false", "1", "0"], undefined>], undefined>, v.TransformAction<boolean | "0" | "1" | "true" | "false", boolean>]>, undefined>;
|
|
724
|
+
}, undefined>, undefined>;
|
|
725
|
+
metadata: {
|
|
726
|
+
openapi: {
|
|
727
|
+
operationId: string;
|
|
728
|
+
summary: string;
|
|
729
|
+
};
|
|
730
|
+
};
|
|
731
|
+
}, {
|
|
732
|
+
grants: Awaited<ReturnType<P["list"]>>;
|
|
733
|
+
}>;
|
|
734
|
+
grantPermission: StrictEndpoint<"/permissions/grant", {
|
|
735
|
+
method: "POST";
|
|
736
|
+
use: Middleware<MiddlewareOptions, (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<{
|
|
737
|
+
session: {
|
|
738
|
+
session: Record<string, any> & {
|
|
739
|
+
id: string;
|
|
740
|
+
createdAt: Date;
|
|
741
|
+
updatedAt: Date;
|
|
742
|
+
userId: string;
|
|
743
|
+
expiresAt: Date;
|
|
744
|
+
token: string;
|
|
745
|
+
ipAddress?: string | null | undefined;
|
|
746
|
+
userAgent?: string | null | undefined;
|
|
747
|
+
};
|
|
748
|
+
user: Record<string, any> & {
|
|
749
|
+
id: string;
|
|
750
|
+
createdAt: Date;
|
|
751
|
+
updatedAt: Date;
|
|
752
|
+
email: string;
|
|
753
|
+
emailVerified: boolean;
|
|
754
|
+
name: string;
|
|
755
|
+
image?: string | null | undefined;
|
|
756
|
+
};
|
|
757
|
+
};
|
|
758
|
+
}>>[];
|
|
759
|
+
body: v.ObjectSchema<{
|
|
760
|
+
readonly subject: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>;
|
|
761
|
+
readonly permission: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>;
|
|
762
|
+
readonly reason: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
763
|
+
readonly expiresAt: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>, undefined>;
|
|
764
|
+
}, undefined>;
|
|
765
|
+
metadata: {
|
|
766
|
+
openapi: {
|
|
767
|
+
operationId: string;
|
|
768
|
+
summary: string;
|
|
769
|
+
};
|
|
770
|
+
};
|
|
771
|
+
}, ReturnType<P["grant"]>>;
|
|
772
|
+
revokePermission: StrictEndpoint<"/permissions/revoke", {
|
|
773
|
+
method: "POST";
|
|
774
|
+
use: Middleware<MiddlewareOptions, (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<{
|
|
775
|
+
session: {
|
|
776
|
+
session: Record<string, any> & {
|
|
777
|
+
id: string;
|
|
778
|
+
createdAt: Date;
|
|
779
|
+
updatedAt: Date;
|
|
780
|
+
userId: string;
|
|
781
|
+
expiresAt: Date;
|
|
782
|
+
token: string;
|
|
783
|
+
ipAddress?: string | null | undefined;
|
|
784
|
+
userAgent?: string | null | undefined;
|
|
785
|
+
};
|
|
786
|
+
user: Record<string, any> & {
|
|
787
|
+
id: string;
|
|
788
|
+
createdAt: Date;
|
|
789
|
+
updatedAt: Date;
|
|
790
|
+
email: string;
|
|
791
|
+
emailVerified: boolean;
|
|
792
|
+
name: string;
|
|
793
|
+
image?: string | null | undefined;
|
|
794
|
+
};
|
|
795
|
+
};
|
|
796
|
+
}>>[];
|
|
797
|
+
body: v.ObjectSchema<{
|
|
798
|
+
readonly subject: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>;
|
|
799
|
+
readonly permission: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>;
|
|
800
|
+
readonly reason: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
801
|
+
}, undefined>;
|
|
802
|
+
metadata: {
|
|
803
|
+
openapi: {
|
|
804
|
+
operationId: string;
|
|
805
|
+
summary: string;
|
|
806
|
+
};
|
|
807
|
+
};
|
|
808
|
+
}, ReturnType<P["revoke"]>>;
|
|
809
|
+
listPermissionHistory: StrictEndpoint<"/permissions/history", {
|
|
810
|
+
method: "GET";
|
|
811
|
+
use: Middleware<MiddlewareOptions, (inputContext: MiddlewareInputContext<MiddlewareOptions>) => Promise<{
|
|
812
|
+
session: {
|
|
813
|
+
session: Record<string, any> & {
|
|
814
|
+
id: string;
|
|
815
|
+
createdAt: Date;
|
|
816
|
+
updatedAt: Date;
|
|
817
|
+
userId: string;
|
|
818
|
+
expiresAt: Date;
|
|
819
|
+
token: string;
|
|
820
|
+
ipAddress?: string | null | undefined;
|
|
821
|
+
userAgent?: string | null | undefined;
|
|
822
|
+
};
|
|
823
|
+
user: Record<string, any> & {
|
|
824
|
+
id: string;
|
|
825
|
+
createdAt: Date;
|
|
826
|
+
updatedAt: Date;
|
|
827
|
+
email: string;
|
|
828
|
+
emailVerified: boolean;
|
|
829
|
+
name: string;
|
|
830
|
+
image?: string | null | undefined;
|
|
831
|
+
};
|
|
832
|
+
};
|
|
833
|
+
}>>[];
|
|
834
|
+
query: v.OptionalSchema<v.ObjectSchema<{
|
|
835
|
+
readonly subject: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.NonEmptyAction<string, undefined>]>, undefined>;
|
|
836
|
+
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.NumberSchema<undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.DigitsAction<string, undefined>]>], undefined>, v.TransformAction<any, number>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 500, undefined>]>, undefined>;
|
|
837
|
+
readonly cursor: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
838
|
+
}, undefined>, undefined>;
|
|
839
|
+
metadata: {
|
|
840
|
+
openapi: {
|
|
841
|
+
operationId: string;
|
|
842
|
+
summary: string;
|
|
843
|
+
};
|
|
844
|
+
};
|
|
845
|
+
}, ReturnType<P["history"]>>;
|
|
846
|
+
};
|
|
847
|
+
$ERROR_CODES: {
|
|
848
|
+
readonly PERMISSIONS_FORBIDDEN: {
|
|
849
|
+
readonly code: "PERMISSIONS_FORBIDDEN";
|
|
850
|
+
readonly message: "You are not allowed to manage permissions";
|
|
851
|
+
};
|
|
852
|
+
readonly PERMISSIONS_UNKNOWN_PERMISSION: {
|
|
853
|
+
readonly code: "PERMISSIONS_UNKNOWN_PERMISSION";
|
|
854
|
+
readonly message: "Unknown permission";
|
|
855
|
+
};
|
|
856
|
+
readonly PERMISSIONS_UNKNOWN_ROLE: {
|
|
857
|
+
readonly code: "PERMISSIONS_UNKNOWN_ROLE";
|
|
858
|
+
readonly message: "Unknown role";
|
|
859
|
+
};
|
|
860
|
+
readonly PERMISSIONS_INVALID_INPUT: {
|
|
861
|
+
readonly code: "PERMISSIONS_INVALID_INPUT";
|
|
862
|
+
readonly message: "Invalid input";
|
|
863
|
+
};
|
|
864
|
+
readonly PERMISSIONS_NOT_FOUND: {
|
|
865
|
+
readonly code: "PERMISSIONS_NOT_FOUND";
|
|
866
|
+
readonly message: "Not found";
|
|
867
|
+
};
|
|
868
|
+
readonly PERMISSIONS_READONLY: {
|
|
869
|
+
readonly code: "PERMISSIONS_READONLY";
|
|
870
|
+
readonly message: "Permissions are read-only";
|
|
871
|
+
};
|
|
872
|
+
readonly PERMISSIONS_NO_SUBJECT: {
|
|
873
|
+
readonly code: "PERMISSIONS_NO_SUBJECT";
|
|
874
|
+
readonly message: "No subject";
|
|
875
|
+
};
|
|
876
|
+
readonly PERMISSIONS_INVALID_RELATION: {
|
|
877
|
+
readonly code: "PERMISSIONS_INVALID_RELATION";
|
|
878
|
+
readonly message: "Invalid relation (not in the catalog's relation schema)";
|
|
879
|
+
};
|
|
880
|
+
};
|
|
881
|
+
};
|
|
882
|
+
/** The plugin's type, for `$InferServerPlugin`. */
|
|
883
|
+
type PermissionsPlugin<P extends AnyPermissions = AnyPermissions> = ReturnType<typeof permissions<P>>;
|
|
884
|
+
//#endregion
|
|
885
|
+
export { PERMISSIONS_ERROR_CODES as i, PermissionsPluginOptions as n, permissions as r, PermissionsPlugin as t };
|
|
886
|
+
//# sourceMappingURL=server-C2F4H6bR.d.cts.map
|