@xtandard/kit 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +71 -2
- package/bin/xtandard-kit.mjs +3 -0
- package/dist/base-path-BJugWLNO.cjs +42 -0
- package/dist/base-path-BJugWLNO.cjs.map +1 -0
- package/dist/base-path-CDb4In5E.mjs +31 -0
- package/dist/base-path-CDb4In5E.mjs.map +1 -0
- package/dist/basic-Qtriv0xS.mjs +176 -0
- package/dist/basic-Qtriv0xS.mjs.map +1 -0
- package/dist/basic-ZaO92-lB.cjs +199 -0
- package/dist/basic-ZaO92-lB.cjs.map +1 -0
- package/dist/bin.cjs +126 -0
- package/dist/bin.cjs.map +1 -0
- package/dist/bin.d.cts +20 -0
- package/dist/bin.d.mts +20 -0
- package/dist/bin.mjs +125 -0
- package/dist/bin.mjs.map +1 -0
- package/dist/cas-CuPSaXBV.cjs +23 -0
- package/dist/cas-CuPSaXBV.cjs.map +1 -0
- package/dist/cas-CzA-yECx.mjs +18 -0
- package/dist/cas-CzA-yECx.mjs.map +1 -0
- package/dist/chunk-DakpK96I.cjs +43 -0
- package/dist/contract-B3UPXXLx.d.cts +30 -0
- package/dist/contract-B3UPXXLx.d.mts +30 -0
- package/dist/contract-BDPNvjtp.d.mts +64 -0
- package/dist/contract-BEdfGTPs.mjs +85 -0
- package/dist/contract-BEdfGTPs.mjs.map +1 -0
- package/dist/contract-BIVzAn4f.d.cts +64 -0
- package/dist/contract-BvgtswLX.d.cts +75 -0
- package/dist/contract-BvgtswLX.d.mts +75 -0
- package/dist/contract-DUj9P3Vt.d.cts +72 -0
- package/dist/contract-DUj9P3Vt.d.mts +72 -0
- package/dist/contract-wAEMDmYG.cjs +132 -0
- package/dist/contract-wAEMDmYG.cjs.map +1 -0
- package/dist/drizzle-BElCHWri.d.mts +115 -0
- package/dist/drizzle-BXaQXCr0.cjs +232 -0
- package/dist/drizzle-BXaQXCr0.cjs.map +1 -0
- package/dist/drizzle-CEpahWQB.d.cts +115 -0
- package/dist/drizzle-DxnelsPT.mjs +197 -0
- package/dist/drizzle-DxnelsPT.mjs.map +1 -0
- package/dist/duration-7WpAK-xe.mjs +52 -0
- package/dist/duration-7WpAK-xe.mjs.map +1 -0
- package/dist/duration-DVA0Fzkx.cjs +63 -0
- package/dist/duration-DVA0Fzkx.cjs.map +1 -0
- package/dist/duration-FPwbmWIU.d.cts +35 -0
- package/dist/duration-FPwbmWIU.d.mts +35 -0
- package/dist/entry-adapters-bun.cjs +10 -0
- package/dist/entry-adapters-bun.cjs.map +1 -0
- package/dist/entry-adapters-bun.d.cts +10 -0
- package/dist/entry-adapters-bun.d.mts +10 -0
- package/dist/entry-adapters-bun.mjs +9 -0
- package/dist/entry-adapters-bun.mjs.map +1 -0
- package/dist/entry-adapters-elysia.cjs +54 -0
- package/dist/entry-adapters-elysia.cjs.map +1 -0
- package/dist/entry-adapters-elysia.d.cts +38 -0
- package/dist/entry-adapters-elysia.d.mts +38 -0
- package/dist/entry-adapters-elysia.mjs +53 -0
- package/dist/entry-adapters-elysia.mjs.map +1 -0
- package/dist/entry-adapters-express.cjs +27 -0
- package/dist/entry-adapters-express.cjs.map +1 -0
- package/dist/entry-adapters-express.d.cts +24 -0
- package/dist/entry-adapters-express.d.mts +24 -0
- package/dist/entry-adapters-express.mjs +26 -0
- package/dist/entry-adapters-express.mjs.map +1 -0
- package/dist/entry-adapters-hono.cjs +33 -0
- package/dist/entry-adapters-hono.cjs.map +1 -0
- package/dist/entry-adapters-hono.d.cts +36 -0
- package/dist/entry-adapters-hono.d.mts +36 -0
- package/dist/entry-adapters-hono.mjs +30 -0
- package/dist/entry-adapters-hono.mjs.map +1 -0
- package/dist/entry-adapters-next.cjs +19 -0
- package/dist/entry-adapters-next.cjs.map +1 -0
- package/dist/entry-adapters-next.d.cts +35 -0
- package/dist/entry-adapters-next.d.mts +35 -0
- package/dist/entry-adapters-next.mjs +18 -0
- package/dist/entry-adapters-next.mjs.map +1 -0
- package/dist/entry-adapters-node.cjs +7 -0
- package/dist/entry-adapters-node.d.cts +2 -0
- package/dist/entry-adapters-node.d.mts +2 -0
- package/dist/entry-adapters-node.mjs +2 -0
- package/dist/entry-auth-basic.cjs +5 -0
- package/dist/entry-auth-basic.d.cts +83 -0
- package/dist/entry-auth-basic.d.mts +83 -0
- package/dist/entry-auth-basic.mjs +2 -0
- package/dist/entry-auth-delegated.cjs +28 -0
- package/dist/entry-auth-delegated.cjs.map +1 -0
- package/dist/entry-auth-delegated.d.cts +36 -0
- package/dist/entry-auth-delegated.d.mts +36 -0
- package/dist/entry-auth-delegated.mjs +27 -0
- package/dist/entry-auth-delegated.mjs.map +1 -0
- package/dist/entry-auth-none.cjs +4 -0
- package/dist/entry-auth-none.d.cts +25 -0
- package/dist/entry-auth-none.d.mts +25 -0
- package/dist/entry-auth-none.mjs +2 -0
- package/dist/entry-auth.cjs +0 -0
- package/dist/entry-auth.d.cts +2 -0
- package/dist/entry-auth.d.mts +2 -0
- package/dist/entry-auth.mjs +1 -0
- package/dist/entry-authorization-delegated.cjs +27 -0
- package/dist/entry-authorization-delegated.cjs.map +1 -0
- package/dist/entry-authorization-delegated.d.cts +31 -0
- package/dist/entry-authorization-delegated.d.mts +31 -0
- package/dist/entry-authorization-delegated.mjs +26 -0
- package/dist/entry-authorization-delegated.mjs.map +1 -0
- package/dist/entry-authorization-none.cjs +3 -0
- package/dist/entry-authorization-none.d.cts +18 -0
- package/dist/entry-authorization-none.d.mts +18 -0
- package/dist/entry-authorization-none.mjs +2 -0
- package/dist/entry-authorization-roles.cjs +3 -0
- package/dist/entry-authorization-roles.d.cts +2 -0
- package/dist/entry-authorization-roles.d.mts +2 -0
- package/dist/entry-authorization-roles.mjs +2 -0
- package/dist/entry-authorization.cjs +35 -0
- package/dist/entry-authorization.cjs.map +1 -0
- package/dist/entry-authorization.d.cts +2 -0
- package/dist/entry-authorization.d.mts +2 -0
- package/dist/entry-authorization.mjs +34 -0
- package/dist/entry-authorization.mjs.map +1 -0
- package/dist/entry-build.cjs +481 -0
- package/dist/entry-build.cjs.map +1 -0
- package/dist/entry-build.d.cts +355 -0
- package/dist/entry-build.d.mts +355 -0
- package/dist/entry-build.mjs +460 -0
- package/dist/entry-build.mjs.map +1 -0
- package/dist/entry-cli.cjs +368 -0
- package/dist/entry-cli.cjs.map +1 -0
- package/dist/entry-cli.d.cts +275 -0
- package/dist/entry-cli.d.mts +275 -0
- package/dist/entry-cli.mjs +355 -0
- package/dist/entry-cli.mjs.map +1 -0
- package/dist/entry-drizzle-mysql.cjs +36 -0
- package/dist/entry-drizzle-mysql.cjs.map +1 -0
- package/dist/entry-drizzle-mysql.d.cts +55 -0
- package/dist/entry-drizzle-mysql.d.mts +55 -0
- package/dist/entry-drizzle-mysql.mjs +34 -0
- package/dist/entry-drizzle-mysql.mjs.map +1 -0
- package/dist/entry-drizzle-pg.cjs +38 -0
- package/dist/entry-drizzle-pg.cjs.map +1 -0
- package/dist/entry-drizzle-pg.d.cts +78 -0
- package/dist/entry-drizzle-pg.d.mts +78 -0
- package/dist/entry-drizzle-pg.mjs +36 -0
- package/dist/entry-drizzle-pg.mjs.map +1 -0
- package/dist/entry-drizzle-sqlite.cjs +20 -0
- package/dist/entry-drizzle-sqlite.cjs.map +1 -0
- package/dist/entry-drizzle-sqlite.d.cts +22 -0
- package/dist/entry-drizzle-sqlite.d.mts +22 -0
- package/dist/entry-drizzle-sqlite.mjs +19 -0
- package/dist/entry-drizzle-sqlite.mjs.map +1 -0
- package/dist/entry-hooks-log.cjs +32 -0
- package/dist/entry-hooks-log.cjs.map +1 -0
- package/dist/entry-hooks-log.d.cts +36 -0
- package/dist/entry-hooks-log.d.mts +36 -0
- package/dist/entry-hooks-log.mjs +31 -0
- package/dist/entry-hooks-log.mjs.map +1 -0
- package/dist/entry-hooks.cjs +10 -0
- package/dist/entry-hooks.d.cts +2 -0
- package/dist/entry-hooks.d.mts +2 -0
- package/dist/entry-hooks.mjs +2 -0
- package/dist/entry-server-router.cjs +235 -0
- package/dist/entry-server-router.cjs.map +1 -0
- package/dist/entry-server-router.d.cts +193 -0
- package/dist/entry-server-router.d.mts +193 -0
- package/dist/entry-server-router.mjs +228 -0
- package/dist/entry-server-router.mjs.map +1 -0
- package/dist/entry-server.cjs +344 -0
- package/dist/entry-server.cjs.map +1 -0
- package/dist/entry-server.d.cts +230 -0
- package/dist/entry-server.d.mts +230 -0
- package/dist/entry-server.mjs +322 -0
- package/dist/entry-server.mjs.map +1 -0
- package/dist/entry-site.cjs +1083 -0
- package/dist/entry-site.cjs.map +1 -0
- package/dist/entry-site.d.cts +336 -0
- package/dist/entry-site.d.mts +336 -0
- package/dist/entry-site.mjs +1060 -0
- package/dist/entry-site.mjs.map +1 -0
- package/dist/entry-storage-cloudflare-kv.cjs +51 -0
- package/dist/entry-storage-cloudflare-kv.cjs.map +1 -0
- package/dist/entry-storage-cloudflare-kv.d.cts +52 -0
- package/dist/entry-storage-cloudflare-kv.d.mts +52 -0
- package/dist/entry-storage-cloudflare-kv.mjs +50 -0
- package/dist/entry-storage-cloudflare-kv.mjs.map +1 -0
- package/dist/entry-storage-drizzle-internals.cjs +6 -0
- package/dist/entry-storage-drizzle-internals.d.cts +2 -0
- package/dist/entry-storage-drizzle-internals.d.mts +2 -0
- package/dist/entry-storage-drizzle-internals.mjs +2 -0
- package/dist/entry-storage-drizzle.cjs +4 -0
- package/dist/entry-storage-drizzle.d.cts +3 -0
- package/dist/entry-storage-drizzle.d.mts +3 -0
- package/dist/entry-storage-drizzle.mjs +2 -0
- package/dist/entry-storage-file.cjs +306 -0
- package/dist/entry-storage-file.cjs.map +1 -0
- package/dist/entry-storage-file.d.cts +76 -0
- package/dist/entry-storage-file.d.mts +76 -0
- package/dist/entry-storage-file.mjs +301 -0
- package/dist/entry-storage-file.mjs.map +1 -0
- package/dist/entry-storage-libsql-internals.cjs +7 -0
- package/dist/entry-storage-libsql-internals.d.cts +3 -0
- package/dist/entry-storage-libsql-internals.d.mts +3 -0
- package/dist/entry-storage-libsql-internals.mjs +3 -0
- package/dist/entry-storage-libsql.cjs +3 -0
- package/dist/entry-storage-libsql.d.cts +2 -0
- package/dist/entry-storage-libsql.d.mts +2 -0
- package/dist/entry-storage-libsql.mjs +2 -0
- package/dist/entry-storage-memory.cjs +78 -0
- package/dist/entry-storage-memory.cjs.map +1 -0
- package/dist/entry-storage-memory.d.cts +35 -0
- package/dist/entry-storage-memory.d.mts +35 -0
- package/dist/entry-storage-memory.mjs +77 -0
- package/dist/entry-storage-memory.mjs.map +1 -0
- package/dist/entry-storage-mongodb-internals.cjs +5 -0
- package/dist/entry-storage-mongodb-internals.d.cts +2 -0
- package/dist/entry-storage-mongodb-internals.d.mts +2 -0
- package/dist/entry-storage-mongodb-internals.mjs +2 -0
- package/dist/entry-storage-mongodb.cjs +3 -0
- package/dist/entry-storage-mongodb.d.cts +2 -0
- package/dist/entry-storage-mongodb.d.mts +2 -0
- package/dist/entry-storage-mongodb.mjs +2 -0
- package/dist/entry-storage-postgres-internals.cjs +6 -0
- package/dist/entry-storage-postgres-internals.d.cts +2 -0
- package/dist/entry-storage-postgres-internals.d.mts +2 -0
- package/dist/entry-storage-postgres-internals.mjs +2 -0
- package/dist/entry-storage-postgres.cjs +4 -0
- package/dist/entry-storage-postgres.d.cts +2 -0
- package/dist/entry-storage-postgres.d.mts +2 -0
- package/dist/entry-storage-postgres.mjs +2 -0
- package/dist/entry-storage-redis-internals.cjs +7 -0
- package/dist/entry-storage-redis-internals.d.cts +2 -0
- package/dist/entry-storage-redis-internals.d.mts +2 -0
- package/dist/entry-storage-redis-internals.mjs +2 -0
- package/dist/entry-storage-redis.cjs +4 -0
- package/dist/entry-storage-redis.d.cts +2 -0
- package/dist/entry-storage-redis.d.mts +2 -0
- package/dist/entry-storage-redis.mjs +2 -0
- package/dist/entry-storage-sqlite-internals.cjs +7 -0
- package/dist/entry-storage-sqlite-internals.d.cts +3 -0
- package/dist/entry-storage-sqlite-internals.d.mts +3 -0
- package/dist/entry-storage-sqlite-internals.mjs +3 -0
- package/dist/entry-storage-sqlite.cjs +3 -0
- package/dist/entry-storage-sqlite.d.cts +2 -0
- package/dist/entry-storage-sqlite.d.mts +2 -0
- package/dist/entry-storage-sqlite.mjs +2 -0
- package/dist/entry-storage-testing.cjs +801 -0
- package/dist/entry-storage-testing.cjs.map +1 -0
- package/dist/entry-storage-testing.d.cts +150 -0
- package/dist/entry-storage-testing.d.mts +150 -0
- package/dist/entry-storage-testing.mjs +790 -0
- package/dist/entry-storage-testing.mjs.map +1 -0
- package/dist/entry-storage-unstorage.cjs +78 -0
- package/dist/entry-storage-unstorage.cjs.map +1 -0
- package/dist/entry-storage-unstorage.d.cts +30 -0
- package/dist/entry-storage-unstorage.d.mts +30 -0
- package/dist/entry-storage-unstorage.mjs +77 -0
- package/dist/entry-storage-unstorage.mjs.map +1 -0
- package/dist/entry-storage.cjs +114 -0
- package/dist/entry-storage.cjs.map +1 -0
- package/dist/entry-storage.d.cts +152 -0
- package/dist/entry-storage.d.mts +152 -0
- package/dist/entry-storage.mjs +91 -0
- package/dist/entry-storage.mjs.map +1 -0
- package/dist/entry-testing.cjs +79 -0
- package/dist/entry-testing.cjs.map +1 -0
- package/dist/entry-testing.d.cts +55 -0
- package/dist/entry-testing.d.mts +55 -0
- package/dist/entry-testing.mjs +77 -0
- package/dist/entry-testing.mjs.map +1 -0
- package/dist/entry-tokens.cjs +4 -0
- package/dist/entry-tokens.d.cts +85 -0
- package/dist/entry-tokens.d.mts +85 -0
- package/dist/entry-tokens.mjs +2 -0
- package/dist/entry-ui-embed.cjs +131 -0
- package/dist/entry-ui-embed.cjs.map +1 -0
- package/dist/entry-ui-embed.d.cts +87 -0
- package/dist/entry-ui-embed.d.mts +87 -0
- package/dist/entry-ui-embed.mjs +127 -0
- package/dist/entry-ui-embed.mjs.map +1 -0
- package/dist/entry-ui.cjs +795 -0
- package/dist/entry-ui.cjs.map +1 -0
- package/dist/entry-ui.d.cts +574 -0
- package/dist/entry-ui.d.mts +574 -0
- package/dist/entry-ui.mjs +731 -0
- package/dist/entry-ui.mjs.map +1 -0
- package/dist/entry-util.cjs +145 -0
- package/dist/entry-util.cjs.map +1 -0
- package/dist/entry-util.d.cts +85 -0
- package/dist/entry-util.d.mts +85 -0
- package/dist/entry-util.mjs +130 -0
- package/dist/entry-util.mjs.map +1 -0
- package/dist/http-B_rTnLW9.cjs +235 -0
- package/dist/http-B_rTnLW9.cjs.map +1 -0
- package/dist/http-CxYM7kPT.d.mts +133 -0
- package/dist/http-DVdVI6kJ.mjs +164 -0
- package/dist/http-DVdVI6kJ.mjs.map +1 -0
- package/dist/http-XBVRk8uo.d.cts +133 -0
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -0
- package/dist/json-CCyzstIm.d.cts +44 -0
- package/dist/json-CCyzstIm.d.mts +44 -0
- package/dist/json-CM7TwYQ7.cjs +92 -0
- package/dist/json-CM7TwYQ7.cjs.map +1 -0
- package/dist/json-CmM1M5Kz.mjs +63 -0
- package/dist/json-CmM1M5Kz.mjs.map +1 -0
- package/dist/keys-Bwubabk0.mjs +73 -0
- package/dist/keys-Bwubabk0.mjs.map +1 -0
- package/dist/keys-DQrwxDKI.cjs +126 -0
- package/dist/keys-DQrwxDKI.cjs.map +1 -0
- package/dist/kv-sqlite-B6iTLOx2.d.cts +20 -0
- package/dist/kv-sqlite-CHOdIMJ-.cjs +77 -0
- package/dist/kv-sqlite-CHOdIMJ-.cjs.map +1 -0
- package/dist/kv-sqlite-DIIPfflJ.mjs +66 -0
- package/dist/kv-sqlite-DIIPfflJ.mjs.map +1 -0
- package/dist/kv-sqlite-Tx4UedJs.d.mts +20 -0
- package/dist/libsql-0160BubR.d.mts +65 -0
- package/dist/libsql-BZmRZIqt.d.cts +65 -0
- package/dist/libsql-CiBfVtbS.cjs +103 -0
- package/dist/libsql-CiBfVtbS.cjs.map +1 -0
- package/dist/libsql-CkOjQINi.mjs +86 -0
- package/dist/libsql-CkOjQINi.mjs.map +1 -0
- package/dist/mongodb--Cuj7V_9.cjs +150 -0
- package/dist/mongodb--Cuj7V_9.cjs.map +1 -0
- package/dist/mongodb-DGtsolQ2.d.cts +61 -0
- package/dist/mongodb-JMizy4Wg.mjs +127 -0
- package/dist/mongodb-JMizy4Wg.mjs.map +1 -0
- package/dist/mongodb-xGEU5Gwz.d.mts +61 -0
- package/dist/node-B1Djcwfi.d.cts +57 -0
- package/dist/node-B1Djcwfi.d.mts +57 -0
- package/dist/node-BYjocCbU.mjs +167 -0
- package/dist/node-BYjocCbU.mjs.map +1 -0
- package/dist/node-DFFqYRk-.cjs +201 -0
- package/dist/node-DFFqYRk-.cjs.map +1 -0
- package/dist/none-BEY7Kc_-.mjs +33 -0
- package/dist/none-BEY7Kc_-.mjs.map +1 -0
- package/dist/none-BoQ6-30P.cjs +33 -0
- package/dist/none-BoQ6-30P.cjs.map +1 -0
- package/dist/none-CHwVkQL-.cjs +49 -0
- package/dist/none-CHwVkQL-.cjs.map +1 -0
- package/dist/none-yu3qC47E.mjs +23 -0
- package/dist/none-yu3qC47E.mjs.map +1 -0
- package/dist/peer-BIjBFzwQ.cjs +56 -0
- package/dist/peer-BIjBFzwQ.cjs.map +1 -0
- package/dist/peer-CTHMzOdn.mjs +40 -0
- package/dist/peer-CTHMzOdn.mjs.map +1 -0
- package/dist/portal-container-CJIcau3B.mjs +610 -0
- package/dist/portal-container-CJIcau3B.mjs.map +1 -0
- package/dist/portal-container-Ca1NxrLE.cjs +774 -0
- package/dist/portal-container-Ca1NxrLE.cjs.map +1 -0
- package/dist/postgres-BJzxKBk0.d.cts +72 -0
- package/dist/postgres-CA8_XcAE.cjs +164 -0
- package/dist/postgres-CA8_XcAE.cjs.map +1 -0
- package/dist/postgres-RfQMgAsj.d.mts +72 -0
- package/dist/postgres-aDiBmNzr.mjs +135 -0
- package/dist/postgres-aDiBmNzr.mjs.map +1 -0
- package/dist/redis-B2AS4xAQ.cjs +259 -0
- package/dist/redis-B2AS4xAQ.cjs.map +1 -0
- package/dist/redis-B362ofBw.d.cts +159 -0
- package/dist/redis-CahNAVTW.d.mts +159 -0
- package/dist/redis-hdoKymfG.mjs +218 -0
- package/dist/redis-hdoKymfG.mjs.map +1 -0
- package/dist/roles-7JPrQXZa.mjs +46 -0
- package/dist/roles-7JPrQXZa.mjs.map +1 -0
- package/dist/roles-B_8QqJ3j.cjs +56 -0
- package/dist/roles-B_8QqJ3j.cjs.map +1 -0
- package/dist/roles-DLISB4T3.d.mts +41 -0
- package/dist/roles-DQbbtUPW.d.cts +41 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/scope-css-BN3jf0ly.cjs +315 -0
- package/dist/scope-css-BN3jf0ly.cjs.map +1 -0
- package/dist/scope-css-BuJfRCsE.mjs +256 -0
- package/dist/scope-css-BuJfRCsE.mjs.map +1 -0
- package/dist/scoped-BRoE1W1x.cjs +175 -0
- package/dist/scoped-BRoE1W1x.cjs.map +1 -0
- package/dist/scoped-cFBbotCh.mjs +164 -0
- package/dist/scoped-cFBbotCh.mjs.map +1 -0
- package/dist/sqlite-B2g1JJz1.d.cts +47 -0
- package/dist/sqlite-BIPIlxfj.d.mts +47 -0
- package/dist/sqlite-BntoYaXZ.cjs +79 -0
- package/dist/sqlite-BntoYaXZ.cjs.map +1 -0
- package/dist/sqlite-DYJDcu7p.mjs +62 -0
- package/dist/sqlite-DYJDcu7p.mjs.map +1 -0
- package/dist/table-BrioFSra.d.cts +11 -0
- package/dist/table-BrioFSra.d.mts +11 -0
- package/dist/theme-context-DzZ1otaD.d.cts +270 -0
- package/dist/theme-context-J65pythD.d.mts +270 -0
- package/dist/ui/styles.css +239 -0
- package/dist/util-Dnj5T-yw.mjs +39 -0
- package/dist/util-Dnj5T-yw.mjs.map +1 -0
- package/dist/util-dAnTK9x-.cjs +74 -0
- package/dist/util-dAnTK9x-.cjs.map +1 -0
- package/dist/validation-B-atP968.mjs +191 -0
- package/dist/validation-B-atP968.mjs.map +1 -0
- package/dist/validation-BJifGoB2.d.mts +122 -0
- package/dist/validation-DLnzBVJr.cjs +258 -0
- package/dist/validation-DLnzBVJr.cjs.map +1 -0
- package/dist/validation-tfV2qhbD.d.cts +122 -0
- package/package.json +715 -4
- package/tsconfig/assets.d.ts +21 -0
- package/tsconfig/base.json +21 -0
- package/tsconfig/react.json +9 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { t as durationToMs } from "./duration-7WpAK-xe.mjs";
|
|
2
|
+
//#region src/testing/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* Generic test helpers: a controllable clock and a collecting sink. The
|
|
5
|
+
* products build their own fixtures (`createTestWebhooks`, `createTestAudit`…)
|
|
6
|
+
* on top.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
const toMs = (at) => {
|
|
11
|
+
const ms = typeof at === "string" ? Date.parse(at) : at;
|
|
12
|
+
if (!Number.isFinite(ms)) throw new TypeError(`TestClock: invalid time ${String(at)}`);
|
|
13
|
+
return ms;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Create a {@link TestClock} starting at `start` (default: real now).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const clock = createTestClock("2026-01-01T00:00:00Z");
|
|
21
|
+
* clock.advance("1h");
|
|
22
|
+
* clock.iso(); // "2026-01-01T01:00:00.000Z"
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
function createTestClock(start = Date.now()) {
|
|
26
|
+
let t = toMs(start);
|
|
27
|
+
return {
|
|
28
|
+
now: () => t,
|
|
29
|
+
set: (at) => {
|
|
30
|
+
t = toMs(at);
|
|
31
|
+
},
|
|
32
|
+
advance: (by) => {
|
|
33
|
+
t += durationToMs(by);
|
|
34
|
+
},
|
|
35
|
+
iso: () => new Date(t).toISOString()
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Create a {@link CollectingSink}.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const sink = collectingSink<AuditEvent>();
|
|
44
|
+
* const stream = { kind: "collecting", send: (batch) => sink.push(...batch.events) };
|
|
45
|
+
* sink.failNext(2); // the next two sends reject
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
function collectingSink(options = {}) {
|
|
49
|
+
const items = [];
|
|
50
|
+
let failures = {
|
|
51
|
+
remaining: 0,
|
|
52
|
+
error: /* @__PURE__ */ new Error()
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
items,
|
|
56
|
+
async push(...received) {
|
|
57
|
+
if (failures.remaining > 0) {
|
|
58
|
+
failures.remaining--;
|
|
59
|
+
throw failures.error;
|
|
60
|
+
}
|
|
61
|
+
for (const item of received) items.push(options.clone ? structuredClone(item) : item);
|
|
62
|
+
},
|
|
63
|
+
failNext(n = 1, error = /* @__PURE__ */ new Error("collectingSink: simulated failure")) {
|
|
64
|
+
failures = {
|
|
65
|
+
remaining: n,
|
|
66
|
+
error
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
clear() {
|
|
70
|
+
items.length = 0;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { collectingSink, createTestClock };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=entry-testing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-testing.mjs","names":[],"sources":["../src/testing/index.ts"],"sourcesContent":["/**\n * Generic test helpers: a controllable clock and a collecting sink. The\n * products build their own fixtures (`createTestWebhooks`, `createTestAudit`…)\n * on top.\n *\n * @module\n */\n\nimport { durationToMs, type Duration } from \"../util/duration.ts\";\n\n/** A manually driven clock. */\nexport interface TestClock {\n /** Current time (unix ms) — pass `clock.now` as a `now` option. */\n now(): number;\n /** Set the time (ISO string or unix ms). */\n set(at: string | number): void;\n /** Move forward. */\n advance(by: Duration): void;\n /** Current time as ISO. */\n iso(): string;\n}\n\nconst toMs = (at: string | number): number => {\n const ms = typeof at === \"string\" ? Date.parse(at) : at;\n if (!Number.isFinite(ms)) throw new TypeError(`TestClock: invalid time ${String(at)}`);\n return ms;\n};\n\n/**\n * Create a {@link TestClock} starting at `start` (default: real now).\n *\n * @example\n * ```ts\n * const clock = createTestClock(\"2026-01-01T00:00:00Z\");\n * clock.advance(\"1h\");\n * clock.iso(); // \"2026-01-01T01:00:00.000Z\"\n * ```\n */\nexport function createTestClock(start: string | number = Date.now()): TestClock {\n let t = toMs(start);\n return {\n now: () => t,\n set: (at) => {\n t = toMs(at);\n },\n advance: (by) => {\n t += durationToMs(by);\n },\n iso: () => new Date(t).toISOString(),\n };\n}\n\n/** A sink that keeps everything it receives, with programmable failures. */\nexport interface CollectingSink<T> {\n /** Everything received so far, in order. */\n readonly items: T[];\n /** Receive items. Rejects instead while failures are programmed with {@link CollectingSink.failNext}. */\n push(...items: T[]): Promise<void>;\n /** Make the next `n` pushes reject with `error` (to exercise retry paths). */\n failNext(n?: number, error?: Error): void;\n /** Forget everything received. */\n clear(): void;\n}\n\n/** Options for {@link collectingSink}. */\nexport interface CollectingSinkOptions {\n /** Store a `structuredClone` of each item, so later mutation by the caller doesn't show. Default `false`. */\n clone?: boolean;\n}\n\n/**\n * Create a {@link CollectingSink}.\n *\n * @example\n * ```ts\n * const sink = collectingSink<AuditEvent>();\n * const stream = { kind: \"collecting\", send: (batch) => sink.push(...batch.events) };\n * sink.failNext(2); // the next two sends reject\n * ```\n */\nexport function collectingSink<T>(options: CollectingSinkOptions = {}): CollectingSink<T> {\n const items: T[] = [];\n let failures = { remaining: 0, error: new Error() };\n return {\n items,\n async push(...received) {\n if (failures.remaining > 0) {\n failures.remaining--;\n throw failures.error;\n }\n for (const item of received) items.push(options.clone ? structuredClone(item) : item);\n },\n failNext(n = 1, error = new Error(\"collectingSink: simulated failure\")) {\n failures = { remaining: n, error };\n },\n clear() {\n items.length = 0;\n },\n };\n}\n"],"mappings":";;;;;;;;;AAsBA,MAAM,QAAQ,OAAgC;CAC5C,MAAM,KAAK,OAAO,OAAO,WAAW,KAAK,MAAM,EAAE,IAAI;CACrD,IAAI,CAAC,OAAO,SAAS,EAAE,GAAG,MAAM,IAAI,UAAU,2BAA2B,OAAO,EAAE,GAAG;CACrF,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,gBAAgB,QAAyB,KAAK,IAAI,GAAc;CAC9E,IAAI,IAAI,KAAK,KAAK;CAClB,OAAO;EACL,WAAW;EACX,MAAM,OAAO;GACX,IAAI,KAAK,EAAE;EACb;EACA,UAAU,OAAO;GACf,KAAK,aAAa,EAAE;EACtB;EACA,WAAW,IAAI,KAAK,CAAC,EAAE,YAAY;CACrC;AACF;;;;;;;;;;;AA8BA,SAAgB,eAAkB,UAAiC,CAAC,GAAsB;CACxF,MAAM,QAAa,CAAC;CACpB,IAAI,WAAW;EAAE,WAAW;EAAG,uBAAO,IAAI,MAAM;CAAE;CAClD,OAAO;EACL;EACA,MAAM,KAAK,GAAG,UAAU;GACtB,IAAI,SAAS,YAAY,GAAG;IAC1B,SAAS;IACT,MAAM,SAAS;GACjB;GACA,KAAK,MAAM,QAAQ,UAAU,MAAM,KAAK,QAAQ,QAAQ,gBAAgB,IAAI,IAAI,IAAI;EACtF;EACA,SAAS,IAAI,GAAG,wBAAQ,IAAI,MAAM,mCAAmC,GAAG;GACtE,WAAW;IAAE,WAAW;IAAG;GAAM;EACnC;EACA,QAAQ;GACN,MAAM,SAAS;EACjB;CACF;AACF"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { t as Duration } from "./duration-FPwbmWIU.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/tokens/scoped.d.ts
|
|
4
|
+
/** Base class of every scoped-token error. Maps to HTTP 401 at the API layer. */
|
|
5
|
+
declare class TokenError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
/** One secret, or a rotation list (the first one signs, all of them verify). */
|
|
9
|
+
type TokenSecret = string | readonly string[];
|
|
10
|
+
/** Options for {@link createScopedTokens}. */
|
|
11
|
+
interface ScopedTokensOptions<Claims extends object> {
|
|
12
|
+
/** Token prefix, e.g. `"whpt_"`. A product's tokens depend on it, so it never changes. */
|
|
13
|
+
prefix: string;
|
|
14
|
+
/** Default lifetime when `create` gets no `expiresIn`. */
|
|
15
|
+
ttl: Duration;
|
|
16
|
+
/**
|
|
17
|
+
* Check the decoded payload and return the typed claims (without `exp`), or
|
|
18
|
+
* throw. Runs on `create` too, so a bad grant can't be minted. A thrown
|
|
19
|
+
* non-{@link TokenError} becomes `Invalid <label>: <message>`.
|
|
20
|
+
*/
|
|
21
|
+
validateClaims: (payload: Record<string, unknown>) => Claims;
|
|
22
|
+
/** Clock (unix ms). Default `Date.now`. */
|
|
23
|
+
now?: () => number;
|
|
24
|
+
/** How errors name the token: `"portal token"`, `"viewer token"`. Default `"token"`. */
|
|
25
|
+
label?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The `name` of the errors this instance throws (the products map
|
|
28
|
+
* `PortalTokenError` / `ViewerTokenError` to 401 by name). Default
|
|
29
|
+
* `"TokenError"`.
|
|
30
|
+
*/
|
|
31
|
+
errorName?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Per-call options for {@link ScopedTokens.create}. */
|
|
34
|
+
interface CreateTokenOptions {
|
|
35
|
+
/** Lifetime. Default: the instance `ttl`. */
|
|
36
|
+
expiresIn?: Duration;
|
|
37
|
+
/** Clock override (unix ms) for this call. */
|
|
38
|
+
now?: number;
|
|
39
|
+
}
|
|
40
|
+
/** A verified token: its claims and expiry. */
|
|
41
|
+
interface VerifiedToken<Claims> {
|
|
42
|
+
claims: Claims;
|
|
43
|
+
/** Expiry, unix epoch milliseconds. */
|
|
44
|
+
expiresAt: number;
|
|
45
|
+
}
|
|
46
|
+
/** What {@link createScopedTokens} returns. */
|
|
47
|
+
interface ScopedTokens<Claims extends object> {
|
|
48
|
+
/** The token prefix. */
|
|
49
|
+
readonly prefix: string;
|
|
50
|
+
/** Mint a token for `claims`. Call it server-side, after your own authentication. */
|
|
51
|
+
create(secret: TokenSecret, claims: Claims, options?: CreateTokenOptions): Promise<string>;
|
|
52
|
+
/** Verify format, signature, claims and expiry; throws {@link ScopedTokens.TokenError}. */
|
|
53
|
+
verify(secret: TokenSecret, token: string, options?: {
|
|
54
|
+
now?: number;
|
|
55
|
+
}): Promise<VerifiedToken<Claims>>;
|
|
56
|
+
/** True when `value` looks like one of these tokens (prefix only, no verification). */
|
|
57
|
+
matches(value: string): boolean;
|
|
58
|
+
/** The error class this instance throws (a {@link TokenError} subclass named `errorName`). */
|
|
59
|
+
readonly TokenError: new (message: string) => TokenError;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Create a product's scoped-token codec.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { createScopedTokens } from "@xtandard/kit/tokens";
|
|
67
|
+
*
|
|
68
|
+
* const portal = createScopedTokens({
|
|
69
|
+
* prefix: "whpt_",
|
|
70
|
+
* ttl: "7d",
|
|
71
|
+
* label: "portal token",
|
|
72
|
+
* errorName: "PortalTokenError",
|
|
73
|
+
* validateClaims: (p) => {
|
|
74
|
+
* if (typeof p.app !== "string" || !p.app) throw new Error("missing application");
|
|
75
|
+
* return { app: p.app };
|
|
76
|
+
* },
|
|
77
|
+
* });
|
|
78
|
+
* const token = await portal.create(secret, { app: "acme" });
|
|
79
|
+
* const { claims } = await portal.verify(secret, token); // { app: "acme" }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
declare function createScopedTokens<Claims extends object>(options: ScopedTokensOptions<Claims>): ScopedTokens<Claims>;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { type CreateTokenOptions, type ScopedTokens, type ScopedTokensOptions, TokenError, type TokenSecret, type VerifiedToken, createScopedTokens };
|
|
85
|
+
//# sourceMappingURL=entry-tokens.d.cts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { t as Duration } from "./duration-FPwbmWIU.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/tokens/scoped.d.ts
|
|
4
|
+
/** Base class of every scoped-token error. Maps to HTTP 401 at the API layer. */
|
|
5
|
+
declare class TokenError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
/** One secret, or a rotation list (the first one signs, all of them verify). */
|
|
9
|
+
type TokenSecret = string | readonly string[];
|
|
10
|
+
/** Options for {@link createScopedTokens}. */
|
|
11
|
+
interface ScopedTokensOptions<Claims extends object> {
|
|
12
|
+
/** Token prefix, e.g. `"whpt_"`. A product's tokens depend on it, so it never changes. */
|
|
13
|
+
prefix: string;
|
|
14
|
+
/** Default lifetime when `create` gets no `expiresIn`. */
|
|
15
|
+
ttl: Duration;
|
|
16
|
+
/**
|
|
17
|
+
* Check the decoded payload and return the typed claims (without `exp`), or
|
|
18
|
+
* throw. Runs on `create` too, so a bad grant can't be minted. A thrown
|
|
19
|
+
* non-{@link TokenError} becomes `Invalid <label>: <message>`.
|
|
20
|
+
*/
|
|
21
|
+
validateClaims: (payload: Record<string, unknown>) => Claims;
|
|
22
|
+
/** Clock (unix ms). Default `Date.now`. */
|
|
23
|
+
now?: () => number;
|
|
24
|
+
/** How errors name the token: `"portal token"`, `"viewer token"`. Default `"token"`. */
|
|
25
|
+
label?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The `name` of the errors this instance throws (the products map
|
|
28
|
+
* `PortalTokenError` / `ViewerTokenError` to 401 by name). Default
|
|
29
|
+
* `"TokenError"`.
|
|
30
|
+
*/
|
|
31
|
+
errorName?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Per-call options for {@link ScopedTokens.create}. */
|
|
34
|
+
interface CreateTokenOptions {
|
|
35
|
+
/** Lifetime. Default: the instance `ttl`. */
|
|
36
|
+
expiresIn?: Duration;
|
|
37
|
+
/** Clock override (unix ms) for this call. */
|
|
38
|
+
now?: number;
|
|
39
|
+
}
|
|
40
|
+
/** A verified token: its claims and expiry. */
|
|
41
|
+
interface VerifiedToken<Claims> {
|
|
42
|
+
claims: Claims;
|
|
43
|
+
/** Expiry, unix epoch milliseconds. */
|
|
44
|
+
expiresAt: number;
|
|
45
|
+
}
|
|
46
|
+
/** What {@link createScopedTokens} returns. */
|
|
47
|
+
interface ScopedTokens<Claims extends object> {
|
|
48
|
+
/** The token prefix. */
|
|
49
|
+
readonly prefix: string;
|
|
50
|
+
/** Mint a token for `claims`. Call it server-side, after your own authentication. */
|
|
51
|
+
create(secret: TokenSecret, claims: Claims, options?: CreateTokenOptions): Promise<string>;
|
|
52
|
+
/** Verify format, signature, claims and expiry; throws {@link ScopedTokens.TokenError}. */
|
|
53
|
+
verify(secret: TokenSecret, token: string, options?: {
|
|
54
|
+
now?: number;
|
|
55
|
+
}): Promise<VerifiedToken<Claims>>;
|
|
56
|
+
/** True when `value` looks like one of these tokens (prefix only, no verification). */
|
|
57
|
+
matches(value: string): boolean;
|
|
58
|
+
/** The error class this instance throws (a {@link TokenError} subclass named `errorName`). */
|
|
59
|
+
readonly TokenError: new (message: string) => TokenError;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Create a product's scoped-token codec.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { createScopedTokens } from "@xtandard/kit/tokens";
|
|
67
|
+
*
|
|
68
|
+
* const portal = createScopedTokens({
|
|
69
|
+
* prefix: "whpt_",
|
|
70
|
+
* ttl: "7d",
|
|
71
|
+
* label: "portal token",
|
|
72
|
+
* errorName: "PortalTokenError",
|
|
73
|
+
* validateClaims: (p) => {
|
|
74
|
+
* if (typeof p.app !== "string" || !p.app) throw new Error("missing application");
|
|
75
|
+
* return { app: p.app };
|
|
76
|
+
* },
|
|
77
|
+
* });
|
|
78
|
+
* const token = await portal.create(secret, { app: "acme" });
|
|
79
|
+
* const { claims } = await portal.verify(secret, token); // { app: "acme" }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
declare function createScopedTokens<Claims extends object>(options: ScopedTokensOptions<Claims>): ScopedTokens<Claims>;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { type CreateTokenOptions, type ScopedTokens, type ScopedTokensOptions, TokenError, type TokenSecret, type VerifiedToken, createScopedTokens };
|
|
85
|
+
//# sourceMappingURL=entry-tokens.d.mts.map
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("./chunk-DakpK96I.cjs");
|
|
3
|
+
const require_portal_container = require("./portal-container-Ca1NxrLE.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_chunk.__toESM(react);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let _tanstack_react_query = require("@tanstack/react-query");
|
|
8
|
+
let wouter_use_browser_location = require("wouter/use-browser-location");
|
|
9
|
+
let wouter_use_hash_location = require("wouter/use-hash-location");
|
|
10
|
+
let wouter_memory_location = require("wouter/memory-location");
|
|
11
|
+
//#region src/ui/embed.tsx
|
|
12
|
+
/**
|
|
13
|
+
* The React embed factory behind every product's `/react` export. {@link createEmbed} returns a
|
|
14
|
+
* `Dashboard` (the full admin) and a `TokenEmbed` (the same shell scoped by a portal/viewer token),
|
|
15
|
+
* sharing:
|
|
16
|
+
*
|
|
17
|
+
* - the API base set synchronously, so the first queries use it;
|
|
18
|
+
* - one theme per embed, resolved by `ThemeProvider` and applied to the wrapper (`data-theme`), never
|
|
19
|
+
* to the host document;
|
|
20
|
+
* - a fallback QueryClient singleton per embed factory;
|
|
21
|
+
* - Base UI portals pointed at the scoped wrapper;
|
|
22
|
+
* - routing as `hash` | `browser` | `memory` | a custom hook, where the memory router keeps its query
|
|
23
|
+
* string (`searchHook`) so scope params like `?tenant=` survive;
|
|
24
|
+
* - the token attached synchronously, with every query invalidated when the token changes;
|
|
25
|
+
* - `forcePortal` for the token component.
|
|
26
|
+
*
|
|
27
|
+
* @module
|
|
28
|
+
*/
|
|
29
|
+
/** Resolve an {@link EmbedRouting} to wouter hooks; `memory` is created once per mount. */
|
|
30
|
+
function useEmbedRouting(routing, routerBase = "") {
|
|
31
|
+
const memory = react.useMemo(() => (0, wouter_memory_location.memoryLocation)(), []);
|
|
32
|
+
return react.useMemo(() => {
|
|
33
|
+
if (typeof routing === "function") return {
|
|
34
|
+
hook: routing,
|
|
35
|
+
searchHook: void 0,
|
|
36
|
+
base: routerBase
|
|
37
|
+
};
|
|
38
|
+
if (routing === "browser") return {
|
|
39
|
+
hook: wouter_use_browser_location.useBrowserLocation,
|
|
40
|
+
searchHook: void 0,
|
|
41
|
+
base: routerBase
|
|
42
|
+
};
|
|
43
|
+
if (routing === "memory") return {
|
|
44
|
+
hook: memory.hook,
|
|
45
|
+
searchHook: memory.searchHook,
|
|
46
|
+
base: ""
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
hook: wouter_use_hash_location.useHashLocation,
|
|
50
|
+
searchHook: void 0,
|
|
51
|
+
base: ""
|
|
52
|
+
};
|
|
53
|
+
}, [
|
|
54
|
+
routing,
|
|
55
|
+
routerBase,
|
|
56
|
+
memory
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
/** Build a product's embed components from its `App`, scope class, API client and theme key. */
|
|
60
|
+
function createEmbed(options) {
|
|
61
|
+
const { App, scopeClass, api } = options;
|
|
62
|
+
if (!/^[A-Za-z_-][\w-]*$/.test(scopeClass)) throw new Error(`createEmbed: scopeClass must be a bare class name, got "${scopeClass}".`);
|
|
63
|
+
const themeStore = typeof options.themeKey === "string" ? require_portal_container.createThemeStore(options.themeKey) : options.themeKey;
|
|
64
|
+
let fallbackClient;
|
|
65
|
+
const getClient = () => fallbackClient ??= require_portal_container.createShellQueryClient();
|
|
66
|
+
function Shell({ apiBaseUrl = "", credentials, fetch: fetchImpl, queryClient, theme = "auto", className, routing = "hash", routerBase = "", logoUrl, forcePortal, ...rest }) {
|
|
67
|
+
api.setApiBase(apiBaseUrl, {
|
|
68
|
+
credentials,
|
|
69
|
+
fetch: fetchImpl
|
|
70
|
+
});
|
|
71
|
+
const client = queryClient ?? getClient();
|
|
72
|
+
const wrapperRef = react.useRef(null);
|
|
73
|
+
require_portal_container.setPortalContainerRef(wrapperRef);
|
|
74
|
+
const { hook, searchHook, base } = useEmbedRouting(routing, routerBase);
|
|
75
|
+
const appProps = rest;
|
|
76
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tanstack_react_query.QueryClientProvider, {
|
|
77
|
+
client,
|
|
78
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_portal_container.ThemeProvider, {
|
|
79
|
+
store: themeStore,
|
|
80
|
+
mode: theme,
|
|
81
|
+
children: (resolved) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
82
|
+
ref: wrapperRef,
|
|
83
|
+
"data-theme": resolved,
|
|
84
|
+
className: className ? `${scopeClass} ${className}` : scopeClass,
|
|
85
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_portal_container.ToastProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(App, {
|
|
86
|
+
...appProps,
|
|
87
|
+
locationHook: hook,
|
|
88
|
+
searchHook,
|
|
89
|
+
base,
|
|
90
|
+
logoUrl,
|
|
91
|
+
showThemeToggle: theme === "auto",
|
|
92
|
+
forcePortal
|
|
93
|
+
}) })
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
const Dashboard = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Shell, { ...props });
|
|
99
|
+
const TokenEmbed = ({ token, routing = options.tokenRouting ?? "memory", ...rest }) => {
|
|
100
|
+
api.setApiToken(token);
|
|
101
|
+
const client = rest.queryClient ?? getClient();
|
|
102
|
+
const previous = react.useRef(token);
|
|
103
|
+
react.useEffect(() => {
|
|
104
|
+
api.setApiToken(token);
|
|
105
|
+
if (previous.current === token) return;
|
|
106
|
+
previous.current = token;
|
|
107
|
+
client.invalidateQueries();
|
|
108
|
+
}, [token, client]);
|
|
109
|
+
react.useEffect(() => () => {
|
|
110
|
+
api.setApiToken(null);
|
|
111
|
+
}, []);
|
|
112
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Shell, {
|
|
113
|
+
...rest,
|
|
114
|
+
routing,
|
|
115
|
+
queryClient: client,
|
|
116
|
+
forcePortal: true
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
Dashboard.displayName = options.displayNames?.dashboard ?? "Dashboard";
|
|
120
|
+
TokenEmbed.displayName = options.displayNames?.token ?? "TokenEmbed";
|
|
121
|
+
return {
|
|
122
|
+
Dashboard,
|
|
123
|
+
TokenEmbed,
|
|
124
|
+
themeStore
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
exports.createEmbed = createEmbed;
|
|
129
|
+
exports.useEmbedRouting = useEmbedRouting;
|
|
130
|
+
|
|
131
|
+
//# sourceMappingURL=entry-ui-embed.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-ui-embed.cjs","names":["React","useBrowserLocation","useHashLocation","createThemeStore","createShellQueryClient","QueryClientProvider","ThemeProvider","ToastProvider"],"sources":["../src/ui/embed.tsx"],"sourcesContent":["/**\n * The React embed factory behind every product's `/react` export. {@link createEmbed} returns a\n * `Dashboard` (the full admin) and a `TokenEmbed` (the same shell scoped by a portal/viewer token),\n * sharing:\n *\n * - the API base set synchronously, so the first queries use it;\n * - one theme per embed, resolved by `ThemeProvider` and applied to the wrapper (`data-theme`), never\n * to the host document;\n * - a fallback QueryClient singleton per embed factory;\n * - Base UI portals pointed at the scoped wrapper;\n * - routing as `hash` | `browser` | `memory` | a custom hook, where the memory router keeps its query\n * string (`searchHook`) so scope params like `?tenant=` survive;\n * - the token attached synchronously, with every query invalidated when the token changes;\n * - `forcePortal` for the token component.\n *\n * @module\n */\n\nimport * as React from \"react\";\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport type { BaseLocationHook } from \"wouter\";\nimport { useHashLocation } from \"wouter/use-hash-location\";\nimport { useBrowserLocation } from \"wouter/use-browser-location\";\nimport { memoryLocation } from \"wouter/memory-location\";\nimport type { ApiClient, FetchLike } from \"./api-client.ts\";\nimport { createShellQueryClient, type ShellAppProps } from \"./boot.tsx\";\nimport { ToastProvider } from \"./components/Toast.tsx\";\nimport { setPortalContainerRef } from \"./lib/portal-container.ts\";\nimport { createThemeStore, type ThemeStore } from \"./theme.ts\";\nimport { ThemeProvider, type ThemeMode } from \"./theme-context.tsx\";\n\n/** Theme modes for an embed: `auto` (own toggle), `inherit` (follow the host), or a fixed theme. */\nexport type EmbedTheme = ThemeMode;\n\n/** How an embed routes between views. */\nexport type EmbedRouting = \"hash\" | \"browser\" | \"memory\" | BaseLocationHook;\n\n/** The props every embed component accepts (products add their own, e.g. `initialTenant`). */\nexport interface EmbedBaseProps {\n /** Where the panel API and `/config` are mounted (`\"/webhooks\"`, `\"https://admin.example.com/x\"`). */\n apiBaseUrl?: string;\n /**\n * `credentials` mode for API requests (default `\"same-origin\"`). For a cross-origin embed with\n * cookie auth, use `\"include\"` and enable `cors` on the panel.\n */\n credentials?: RequestCredentials;\n /** Custom `fetch` (inject headers, instrument calls). */\n fetch?: FetchLike;\n /** Bring your own QueryClient; a shared one is created otherwise. */\n queryClient?: QueryClient;\n /**\n * Theme handling. The embed never writes to the host document; it applies the resolved theme to\n * its own wrapper. `\"auto\"` (default) shows the panel's own switcher; `\"inherit\"` follows the host\n * page live; `\"light\"`/`\"dark\"` force one.\n */\n theme?: EmbedTheme;\n /** Extra className on the wrapper. */\n className?: string;\n /**\n * `\"hash\"` (default for the dashboard) never touches the host router; `\"browser\"` uses real paths\n * under `routerBase`; `\"memory\"` keeps everything in memory (query string included); or pass a\n * wouter location hook.\n */\n routing?: EmbedRouting;\n /** Base path for `routing: \"browser\"` (e.g. `\"/admin/webhooks\"`). */\n routerBase?: string;\n /** Navbar logo image URL (replaces the wordmark). Overrides server `/config`. */\n logoUrl?: string;\n}\n\n/** Props of the token component: {@link EmbedBaseProps} plus the token. */\nexport interface TokenEmbedBaseProps extends EmbedBaseProps {\n /** The portal/viewer token minted server-side, sent as `Authorization: Bearer …`. */\n token: string;\n}\n\n/** Options for {@link createEmbed}. */\nexport interface CreateEmbedOptions<P extends object> {\n /** The product's root component (the same one the SPA renders). */\n App: React.ComponentType<ShellAppProps & P>;\n /** The scope class the embed stylesheet is scoped under (`\"xtandard-webhooks\"`, no dot). */\n scopeClass: string;\n /** The product's API client. */\n api: Pick<ApiClient, \"setApiBase\" | \"setApiToken\">;\n /** The theme storage key (`\"xtandard-webhooks:theme\"`), or an existing store. */\n themeKey: string | ThemeStore;\n /** Default routing of the token component; `\"memory\"` by default. */\n tokenRouting?: EmbedRouting;\n /** Component display names (`{ dashboard: \"WebhooksDashboard\", token: \"WebhooksPortal\" }`). */\n displayNames?: { dashboard?: string; token?: string };\n}\n\n/** What {@link createEmbed} returns. */\nexport interface Embed<P extends object> {\n /** The full admin dashboard. */\n Dashboard: React.FC<EmbedBaseProps & P>;\n /** The token-scoped dashboard (portal / viewer). */\n TokenEmbed: React.FC<TokenEmbedBaseProps & P>;\n /** The theme store the embed uses (for re-exporting `getThemePref`/`setThemePref`). */\n themeStore: ThemeStore;\n}\n\n/** The wouter hooks for a routing strategy. */\ninterface ResolvedRouting {\n hook: BaseLocationHook;\n searchHook: (() => string) | undefined;\n base: string;\n}\n\n/** Resolve an {@link EmbedRouting} to wouter hooks; `memory` is created once per mount. */\nexport function useEmbedRouting(routing: EmbedRouting, routerBase = \"\"): ResolvedRouting {\n // The memory location is created once so its history (and query string, which carries the scope)\n // survives re-renders.\n const memory = React.useMemo(() => memoryLocation(), []);\n return React.useMemo(() => {\n if (typeof routing === \"function\")\n return { hook: routing, searchHook: undefined, base: routerBase };\n if (routing === \"browser\")\n return { hook: useBrowserLocation, searchHook: undefined, base: routerBase };\n if (routing === \"memory\") return { hook: memory.hook, searchHook: memory.searchHook, base: \"\" };\n return { hook: useHashLocation, searchHook: undefined, base: \"\" };\n }, [routing, routerBase, memory]);\n}\n\n/** Build a product's embed components from its `App`, scope class, API client and theme key. */\nexport function createEmbed<P extends object = object>(options: CreateEmbedOptions<P>): Embed<P> {\n const { App, scopeClass, api } = options;\n if (!/^[A-Za-z_-][\\w-]*$/.test(scopeClass)) {\n throw new Error(`createEmbed: scopeClass must be a bare class name, got \"${scopeClass}\".`);\n }\n const themeStore =\n typeof options.themeKey === \"string\" ? createThemeStore(options.themeKey) : options.themeKey;\n\n let fallbackClient: QueryClient | undefined;\n const getClient = () => (fallbackClient ??= createShellQueryClient());\n\n function Shell({\n apiBaseUrl = \"\",\n credentials,\n fetch: fetchImpl,\n queryClient,\n theme = \"auto\",\n className,\n routing = \"hash\",\n routerBase = \"\",\n logoUrl,\n forcePortal,\n ...rest\n }: EmbedBaseProps & { forcePortal?: boolean } & P): React.ReactElement {\n // Set the API base synchronously so child queries (run on mount) use it.\n api.setApiBase(apiBaseUrl, { credentials, fetch: fetchImpl });\n const client = queryClient ?? getClient();\n\n // Point Base UI portals (Select/Combobox popups, Dialogs) at the scoped wrapper: the embed\n // stylesheet is scoped, so anything portaled to document.body would be unstyled.\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n setPortalContainerRef(wrapperRef);\n\n const { hook, searchHook, base } = useEmbedRouting(routing, routerBase);\n const appProps = rest as unknown as P;\n\n return (\n <QueryClientProvider client={client}>\n <ThemeProvider store={themeStore} mode={theme}>\n {(resolved) => (\n <div\n ref={wrapperRef}\n data-theme={resolved}\n className={className ? `${scopeClass} ${className}` : scopeClass}\n >\n {/* Inside the wrapper so the toast region gets the scoped styles + theme. */}\n <ToastProvider>\n <App\n {...appProps}\n locationHook={hook}\n searchHook={searchHook}\n base={base}\n logoUrl={logoUrl}\n showThemeToggle={theme === \"auto\"}\n forcePortal={forcePortal}\n />\n </ToastProvider>\n </div>\n )}\n </ThemeProvider>\n </QueryClientProvider>\n );\n }\n\n const Dashboard: React.FC<EmbedBaseProps & P> = (props) => <Shell {...props} />;\n\n const TokenEmbed: React.FC<TokenEmbedBaseProps & P> = ({\n token,\n routing = options.tokenRouting ?? \"memory\",\n ...rest\n }) => {\n // Attach the token synchronously so the first queries send it; the effect keeps it current\n // when the host swaps tokens (re-mint on expiry).\n api.setApiToken(token);\n const client = rest.queryClient ?? getClient();\n const previous = React.useRef(token);\n React.useEffect(() => {\n api.setApiToken(token);\n if (previous.current === token) return;\n previous.current = token;\n // A new token may carry a different scope: refetch everything.\n void client.invalidateQueries();\n }, [token, client]);\n React.useEffect(\n () => () => {\n api.setApiToken(null);\n },\n [],\n );\n const shellProps = { ...rest, routing, queryClient: client, forcePortal: true };\n return <Shell {...(shellProps as EmbedBaseProps & { forcePortal: boolean } & P)} />;\n };\n\n Dashboard.displayName = options.displayNames?.dashboard ?? \"Dashboard\";\n TokenEmbed.displayName = options.displayNames?.token ?? \"TokenEmbed\";\n return { Dashboard, TokenEmbed, themeStore };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GA,SAAgB,gBAAgB,SAAuB,aAAa,IAAqB;CAGvF,MAAM,SAASA,MAAM,eAAA,GAAA,uBAAA,gBAA6B,GAAG,CAAC,CAAC;CACvD,OAAOA,MAAM,cAAc;EACzB,IAAI,OAAO,YAAY,YACrB,OAAO;GAAE,MAAM;GAAS,YAAY,KAAA;GAAW,MAAM;EAAW;EAClE,IAAI,YAAY,WACd,OAAO;GAAE,MAAMC,4BAAAA;GAAoB,YAAY,KAAA;GAAW,MAAM;EAAW;EAC7E,IAAI,YAAY,UAAU,OAAO;GAAE,MAAM,OAAO;GAAM,YAAY,OAAO;GAAY,MAAM;EAAG;EAC9F,OAAO;GAAE,MAAMC,yBAAAA;GAAiB,YAAY,KAAA;GAAW,MAAM;EAAG;CAClE,GAAG;EAAC;EAAS;EAAY;CAAM,CAAC;AAClC;;AAGA,SAAgB,YAAuC,SAA0C;CAC/F,MAAM,EAAE,KAAK,YAAY,QAAQ;CACjC,IAAI,CAAC,qBAAqB,KAAK,UAAU,GACvC,MAAM,IAAI,MAAM,2DAA2D,WAAW,GAAG;CAE3F,MAAM,aACJ,OAAO,QAAQ,aAAa,WAAWC,yBAAAA,iBAAiB,QAAQ,QAAQ,IAAI,QAAQ;CAEtF,IAAI;CACJ,MAAM,kBAAmB,mBAAmBC,yBAAAA,uBAAuB;CAEnE,SAAS,MAAM,EACb,aAAa,IACb,aACA,OAAO,WACP,aACA,QAAQ,QACR,WACA,UAAU,QACV,aAAa,IACb,SACA,aACA,GAAG,QACkE;EAErE,IAAI,WAAW,YAAY;GAAE;GAAa,OAAO;EAAU,CAAC;EAC5D,MAAM,SAAS,eAAe,UAAU;EAIxC,MAAM,aAAaJ,MAAM,OAAuB,IAAI;EACpD,yBAAA,sBAAsB,UAAU;EAEhC,MAAM,EAAE,MAAM,YAAY,SAAS,gBAAgB,SAAS,UAAU;EACtE,MAAM,WAAW;EAEjB,OACE,iBAAA,GAAA,kBAAA,KAACK,sBAAAA,qBAAD;GAA6B;aAC3B,iBAAA,GAAA,kBAAA,KAACC,yBAAAA,eAAD;IAAe,OAAO;IAAY,MAAM;eACpC,aACA,iBAAA,GAAA,kBAAA,KAAC,OAAD;KACE,KAAK;KACL,cAAY;KACZ,WAAW,YAAY,GAAG,WAAW,GAAG,cAAc;eAGtD,iBAAA,GAAA,kBAAA,KAACC,yBAAAA,eAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,KAAD;MACE,GAAI;MACJ,cAAc;MACF;MACN;MACG;MACT,iBAAiB,UAAU;MACd;KACd,CAAA,EACY,CAAA;IACZ,CAAA;GAEM,CAAA;EACI,CAAA;CAEzB;CAEA,MAAM,aAA2C,UAAU,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAO,GAAI,MAAQ,CAAA;CAE9E,MAAM,cAAiD,EACrD,OACA,UAAU,QAAQ,gBAAgB,UAClC,GAAG,WACC;EAGJ,IAAI,YAAY,KAAK;EACrB,MAAM,SAAS,KAAK,eAAe,UAAU;EAC7C,MAAM,WAAWP,MAAM,OAAO,KAAK;EACnC,MAAM,gBAAgB;GACpB,IAAI,YAAY,KAAK;GACrB,IAAI,SAAS,YAAY,OAAO;GAChC,SAAS,UAAU;GAEnB,OAAY,kBAAkB;EAChC,GAAG,CAAC,OAAO,MAAM,CAAC;EAClB,MAAM,sBACQ;GACV,IAAI,YAAY,IAAI;EACtB,GACA,CAAC,CACH;EAEA,OAAO,iBAAA,GAAA,kBAAA,KAAC,OAAD;GADc,GAAG;GAAM;GAAS,aAAa;GAAQ,aAAa;EACS,CAAA;CACpF;CAEA,UAAU,cAAc,QAAQ,cAAc,aAAa;CAC3D,WAAW,cAAc,QAAQ,cAAc,SAAS;CACxD,OAAO;EAAE;EAAW;EAAY;CAAW;AAC7C"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { O as FetchLike, S as ApiClient, h as ThemeStore, l as ShellAppProps, t as ThemeMode } from "./theme-context-DzZ1otaD.cjs";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { BaseLocationHook } from "wouter";
|
|
5
|
+
|
|
6
|
+
//#region src/ui/embed.d.ts
|
|
7
|
+
/** Theme modes for an embed: `auto` (own toggle), `inherit` (follow the host), or a fixed theme. */
|
|
8
|
+
type EmbedTheme = ThemeMode;
|
|
9
|
+
/** How an embed routes between views. */
|
|
10
|
+
type EmbedRouting = "hash" | "browser" | "memory" | BaseLocationHook;
|
|
11
|
+
/** The props every embed component accepts (products add their own, e.g. `initialTenant`). */
|
|
12
|
+
interface EmbedBaseProps {
|
|
13
|
+
/** Where the panel API and `/config` are mounted (`"/webhooks"`, `"https://admin.example.com/x"`). */
|
|
14
|
+
apiBaseUrl?: string;
|
|
15
|
+
/**
|
|
16
|
+
* `credentials` mode for API requests (default `"same-origin"`). For a cross-origin embed with
|
|
17
|
+
* cookie auth, use `"include"` and enable `cors` on the panel.
|
|
18
|
+
*/
|
|
19
|
+
credentials?: RequestCredentials;
|
|
20
|
+
/** Custom `fetch` (inject headers, instrument calls). */
|
|
21
|
+
fetch?: FetchLike;
|
|
22
|
+
/** Bring your own QueryClient; a shared one is created otherwise. */
|
|
23
|
+
queryClient?: QueryClient;
|
|
24
|
+
/**
|
|
25
|
+
* Theme handling. The embed never writes to the host document; it applies the resolved theme to
|
|
26
|
+
* its own wrapper. `"auto"` (default) shows the panel's own switcher; `"inherit"` follows the host
|
|
27
|
+
* page live; `"light"`/`"dark"` force one.
|
|
28
|
+
*/
|
|
29
|
+
theme?: EmbedTheme;
|
|
30
|
+
/** Extra className on the wrapper. */
|
|
31
|
+
className?: string;
|
|
32
|
+
/**
|
|
33
|
+
* `"hash"` (default for the dashboard) never touches the host router; `"browser"` uses real paths
|
|
34
|
+
* under `routerBase`; `"memory"` keeps everything in memory (query string included); or pass a
|
|
35
|
+
* wouter location hook.
|
|
36
|
+
*/
|
|
37
|
+
routing?: EmbedRouting;
|
|
38
|
+
/** Base path for `routing: "browser"` (e.g. `"/admin/webhooks"`). */
|
|
39
|
+
routerBase?: string;
|
|
40
|
+
/** Navbar logo image URL (replaces the wordmark). Overrides server `/config`. */
|
|
41
|
+
logoUrl?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Props of the token component: {@link EmbedBaseProps} plus the token. */
|
|
44
|
+
interface TokenEmbedBaseProps extends EmbedBaseProps {
|
|
45
|
+
/** The portal/viewer token minted server-side, sent as `Authorization: Bearer …`. */
|
|
46
|
+
token: string;
|
|
47
|
+
}
|
|
48
|
+
/** Options for {@link createEmbed}. */
|
|
49
|
+
interface CreateEmbedOptions<P extends object> {
|
|
50
|
+
/** The product's root component (the same one the SPA renders). */
|
|
51
|
+
App: React$1.ComponentType<ShellAppProps & P>;
|
|
52
|
+
/** The scope class the embed stylesheet is scoped under (`"xtandard-webhooks"`, no dot). */
|
|
53
|
+
scopeClass: string;
|
|
54
|
+
/** The product's API client. */
|
|
55
|
+
api: Pick<ApiClient, "setApiBase" | "setApiToken">;
|
|
56
|
+
/** The theme storage key (`"xtandard-webhooks:theme"`), or an existing store. */
|
|
57
|
+
themeKey: string | ThemeStore;
|
|
58
|
+
/** Default routing of the token component; `"memory"` by default. */
|
|
59
|
+
tokenRouting?: EmbedRouting;
|
|
60
|
+
/** Component display names (`{ dashboard: "WebhooksDashboard", token: "WebhooksPortal" }`). */
|
|
61
|
+
displayNames?: {
|
|
62
|
+
dashboard?: string;
|
|
63
|
+
token?: string;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** What {@link createEmbed} returns. */
|
|
67
|
+
interface Embed<P extends object> {
|
|
68
|
+
/** The full admin dashboard. */
|
|
69
|
+
Dashboard: React$1.FC<EmbedBaseProps & P>;
|
|
70
|
+
/** The token-scoped dashboard (portal / viewer). */
|
|
71
|
+
TokenEmbed: React$1.FC<TokenEmbedBaseProps & P>;
|
|
72
|
+
/** The theme store the embed uses (for re-exporting `getThemePref`/`setThemePref`). */
|
|
73
|
+
themeStore: ThemeStore;
|
|
74
|
+
}
|
|
75
|
+
/** The wouter hooks for a routing strategy. */
|
|
76
|
+
interface ResolvedRouting {
|
|
77
|
+
hook: BaseLocationHook;
|
|
78
|
+
searchHook: (() => string) | undefined;
|
|
79
|
+
base: string;
|
|
80
|
+
}
|
|
81
|
+
/** Resolve an {@link EmbedRouting} to wouter hooks; `memory` is created once per mount. */
|
|
82
|
+
declare function useEmbedRouting(routing: EmbedRouting, routerBase?: string): ResolvedRouting;
|
|
83
|
+
/** Build a product's embed components from its `App`, scope class, API client and theme key. */
|
|
84
|
+
declare function createEmbed<P extends object = object>(options: CreateEmbedOptions<P>): Embed<P>;
|
|
85
|
+
//#endregion
|
|
86
|
+
export { type CreateEmbedOptions, type Embed, type EmbedBaseProps, type EmbedRouting, type EmbedTheme, type TokenEmbedBaseProps, createEmbed, useEmbedRouting };
|
|
87
|
+
//# sourceMappingURL=entry-ui-embed.d.cts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { O as FetchLike, S as ApiClient, h as ThemeStore, l as ShellAppProps, t as ThemeMode } from "./theme-context-J65pythD.mjs";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { BaseLocationHook } from "wouter";
|
|
5
|
+
|
|
6
|
+
//#region src/ui/embed.d.ts
|
|
7
|
+
/** Theme modes for an embed: `auto` (own toggle), `inherit` (follow the host), or a fixed theme. */
|
|
8
|
+
type EmbedTheme = ThemeMode;
|
|
9
|
+
/** How an embed routes between views. */
|
|
10
|
+
type EmbedRouting = "hash" | "browser" | "memory" | BaseLocationHook;
|
|
11
|
+
/** The props every embed component accepts (products add their own, e.g. `initialTenant`). */
|
|
12
|
+
interface EmbedBaseProps {
|
|
13
|
+
/** Where the panel API and `/config` are mounted (`"/webhooks"`, `"https://admin.example.com/x"`). */
|
|
14
|
+
apiBaseUrl?: string;
|
|
15
|
+
/**
|
|
16
|
+
* `credentials` mode for API requests (default `"same-origin"`). For a cross-origin embed with
|
|
17
|
+
* cookie auth, use `"include"` and enable `cors` on the panel.
|
|
18
|
+
*/
|
|
19
|
+
credentials?: RequestCredentials;
|
|
20
|
+
/** Custom `fetch` (inject headers, instrument calls). */
|
|
21
|
+
fetch?: FetchLike;
|
|
22
|
+
/** Bring your own QueryClient; a shared one is created otherwise. */
|
|
23
|
+
queryClient?: QueryClient;
|
|
24
|
+
/**
|
|
25
|
+
* Theme handling. The embed never writes to the host document; it applies the resolved theme to
|
|
26
|
+
* its own wrapper. `"auto"` (default) shows the panel's own switcher; `"inherit"` follows the host
|
|
27
|
+
* page live; `"light"`/`"dark"` force one.
|
|
28
|
+
*/
|
|
29
|
+
theme?: EmbedTheme;
|
|
30
|
+
/** Extra className on the wrapper. */
|
|
31
|
+
className?: string;
|
|
32
|
+
/**
|
|
33
|
+
* `"hash"` (default for the dashboard) never touches the host router; `"browser"` uses real paths
|
|
34
|
+
* under `routerBase`; `"memory"` keeps everything in memory (query string included); or pass a
|
|
35
|
+
* wouter location hook.
|
|
36
|
+
*/
|
|
37
|
+
routing?: EmbedRouting;
|
|
38
|
+
/** Base path for `routing: "browser"` (e.g. `"/admin/webhooks"`). */
|
|
39
|
+
routerBase?: string;
|
|
40
|
+
/** Navbar logo image URL (replaces the wordmark). Overrides server `/config`. */
|
|
41
|
+
logoUrl?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Props of the token component: {@link EmbedBaseProps} plus the token. */
|
|
44
|
+
interface TokenEmbedBaseProps extends EmbedBaseProps {
|
|
45
|
+
/** The portal/viewer token minted server-side, sent as `Authorization: Bearer …`. */
|
|
46
|
+
token: string;
|
|
47
|
+
}
|
|
48
|
+
/** Options for {@link createEmbed}. */
|
|
49
|
+
interface CreateEmbedOptions<P extends object> {
|
|
50
|
+
/** The product's root component (the same one the SPA renders). */
|
|
51
|
+
App: React$1.ComponentType<ShellAppProps & P>;
|
|
52
|
+
/** The scope class the embed stylesheet is scoped under (`"xtandard-webhooks"`, no dot). */
|
|
53
|
+
scopeClass: string;
|
|
54
|
+
/** The product's API client. */
|
|
55
|
+
api: Pick<ApiClient, "setApiBase" | "setApiToken">;
|
|
56
|
+
/** The theme storage key (`"xtandard-webhooks:theme"`), or an existing store. */
|
|
57
|
+
themeKey: string | ThemeStore;
|
|
58
|
+
/** Default routing of the token component; `"memory"` by default. */
|
|
59
|
+
tokenRouting?: EmbedRouting;
|
|
60
|
+
/** Component display names (`{ dashboard: "WebhooksDashboard", token: "WebhooksPortal" }`). */
|
|
61
|
+
displayNames?: {
|
|
62
|
+
dashboard?: string;
|
|
63
|
+
token?: string;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** What {@link createEmbed} returns. */
|
|
67
|
+
interface Embed<P extends object> {
|
|
68
|
+
/** The full admin dashboard. */
|
|
69
|
+
Dashboard: React$1.FC<EmbedBaseProps & P>;
|
|
70
|
+
/** The token-scoped dashboard (portal / viewer). */
|
|
71
|
+
TokenEmbed: React$1.FC<TokenEmbedBaseProps & P>;
|
|
72
|
+
/** The theme store the embed uses (for re-exporting `getThemePref`/`setThemePref`). */
|
|
73
|
+
themeStore: ThemeStore;
|
|
74
|
+
}
|
|
75
|
+
/** The wouter hooks for a routing strategy. */
|
|
76
|
+
interface ResolvedRouting {
|
|
77
|
+
hook: BaseLocationHook;
|
|
78
|
+
searchHook: (() => string) | undefined;
|
|
79
|
+
base: string;
|
|
80
|
+
}
|
|
81
|
+
/** Resolve an {@link EmbedRouting} to wouter hooks; `memory` is created once per mount. */
|
|
82
|
+
declare function useEmbedRouting(routing: EmbedRouting, routerBase?: string): ResolvedRouting;
|
|
83
|
+
/** Build a product's embed components from its `App`, scope class, API client and theme key. */
|
|
84
|
+
declare function createEmbed<P extends object = object>(options: CreateEmbedOptions<P>): Embed<P>;
|
|
85
|
+
//#endregion
|
|
86
|
+
export { type CreateEmbedOptions, type Embed, type EmbedBaseProps, type EmbedRouting, type EmbedTheme, type TokenEmbedBaseProps, createEmbed, useEmbedRouting };
|
|
87
|
+
//# sourceMappingURL=entry-ui-embed.d.mts.map
|