@gorth-io/structure 0.0.0-alpha.5

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.
Files changed (345) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -0
  3. package/dist/cores/ably/ai-transport/index.cjs +1 -0
  4. package/dist/cores/ably/ai-transport/index.d.cts +1 -0
  5. package/dist/cores/ably/ai-transport/index.d.ts +1 -0
  6. package/dist/cores/ably/ai-transport/index.js +1 -0
  7. package/dist/cores/ably/ai-transport/react/index.cjs +1 -0
  8. package/dist/cores/ably/ai-transport/react/index.d.cts +1 -0
  9. package/dist/cores/ably/ai-transport/react/index.d.ts +1 -0
  10. package/dist/cores/ably/ai-transport/react/index.js +1 -0
  11. package/dist/cores/ably/chat/index.cjs +1 -0
  12. package/dist/cores/ably/chat/index.d.cts +1 -0
  13. package/dist/cores/ably/chat/index.d.ts +1 -0
  14. package/dist/cores/ably/chat/index.js +1 -0
  15. package/dist/cores/ably/chat/react/index.cjs +1 -0
  16. package/dist/cores/ably/chat/react/index.d.cts +1 -0
  17. package/dist/cores/ably/chat/react/index.d.ts +1 -0
  18. package/dist/cores/ably/chat/react/index.js +1 -0
  19. package/dist/cores/ably/index.cjs +1 -0
  20. package/dist/cores/ably/index.d.cts +1 -0
  21. package/dist/cores/ably/index.d.ts +1 -0
  22. package/dist/cores/ably/index.js +1 -0
  23. package/dist/cores/ably/liveobjects/index.cjs +1 -0
  24. package/dist/cores/ably/liveobjects/index.d.cts +1 -0
  25. package/dist/cores/ably/liveobjects/index.d.ts +1 -0
  26. package/dist/cores/ably/liveobjects/index.js +1 -0
  27. package/dist/cores/ably/liveobjects/react/index.cjs +1 -0
  28. package/dist/cores/ably/liveobjects/react/index.d.cts +1 -0
  29. package/dist/cores/ably/liveobjects/react/index.d.ts +1 -0
  30. package/dist/cores/ably/liveobjects/react/index.js +1 -0
  31. package/dist/cores/ably/modular/index.cjs +1 -0
  32. package/dist/cores/ably/modular/index.d.cts +1 -0
  33. package/dist/cores/ably/modular/index.d.ts +1 -0
  34. package/dist/cores/ably/modular/index.js +1 -0
  35. package/dist/cores/ably/push/index.cjs +1 -0
  36. package/dist/cores/ably/push/index.d.cts +2 -0
  37. package/dist/cores/ably/push/index.d.ts +2 -0
  38. package/dist/cores/ably/push/index.js +1 -0
  39. package/dist/cores/ably/react/index.cjs +1 -0
  40. package/dist/cores/ably/react/index.d.cts +1 -0
  41. package/dist/cores/ably/react/index.d.ts +1 -0
  42. package/dist/cores/ably/react/index.js +1 -0
  43. package/dist/cores/ably/spaces/index.cjs +1 -0
  44. package/dist/cores/ably/spaces/index.d.cts +3 -0
  45. package/dist/cores/ably/spaces/index.d.ts +3 -0
  46. package/dist/cores/ably/spaces/index.js +1 -0
  47. package/dist/cores/axios.cjs +1 -0
  48. package/dist/cores/axios.d.cts +3 -0
  49. package/dist/cores/axios.d.ts +3 -0
  50. package/dist/cores/axios.js +1 -0
  51. package/dist/cores/graphql/index.cjs +1 -0
  52. package/dist/cores/graphql/index.d.cts +1 -0
  53. package/dist/cores/graphql/index.d.ts +1 -0
  54. package/dist/cores/graphql/index.js +1 -0
  55. package/dist/cores/graphql/request.cjs +1 -0
  56. package/dist/cores/graphql/request.d.cts +1 -0
  57. package/dist/cores/graphql/request.d.ts +1 -0
  58. package/dist/cores/graphql/request.js +1 -0
  59. package/dist/cores/graphql/tag.cjs +1 -0
  60. package/dist/cores/graphql/tag.d.cts +1 -0
  61. package/dist/cores/graphql/tag.d.ts +1 -0
  62. package/dist/cores/graphql/tag.js +1 -0
  63. package/dist/cores/index.cjs +0 -0
  64. package/dist/cores/index.d.cts +1 -0
  65. package/dist/cores/index.d.ts +1 -0
  66. package/dist/cores/index.js +1 -0
  67. package/dist/cores/jose.cjs +1 -0
  68. package/dist/cores/jose.d.cts +1 -0
  69. package/dist/cores/jose.d.ts +1 -0
  70. package/dist/cores/jose.js +1 -0
  71. package/dist/cores/pg.cjs +1 -0
  72. package/dist/cores/pg.d.cts +3 -0
  73. package/dist/cores/pg.d.ts +3 -0
  74. package/dist/cores/pg.js +2 -0
  75. package/dist/cores/pg.js.map +1 -0
  76. package/dist/cores/postgres.cjs +1 -0
  77. package/dist/cores/postgres.d.cts +2 -0
  78. package/dist/cores/postgres.d.ts +2 -0
  79. package/dist/cores/postgres.js +2 -0
  80. package/dist/cores/postgres.js.map +1 -0
  81. package/dist/cores/supabase/index.cjs +1 -0
  82. package/dist/cores/supabase/index.d.cts +1 -0
  83. package/dist/cores/supabase/index.d.ts +1 -0
  84. package/dist/cores/supabase/index.js +1 -0
  85. package/dist/cores/supabase/postgrest.cjs +1 -0
  86. package/dist/cores/supabase/postgrest.d.cts +1 -0
  87. package/dist/cores/supabase/postgrest.d.ts +1 -0
  88. package/dist/cores/supabase/postgrest.js +1 -0
  89. package/dist/cores/supabase/server.cjs +1 -0
  90. package/dist/cores/supabase/server.d.cts +1 -0
  91. package/dist/cores/supabase/server.d.ts +1 -0
  92. package/dist/cores/supabase/server.js +1 -0
  93. package/dist/cores/supabase/ssr.cjs +1 -0
  94. package/dist/cores/supabase/ssr.d.cts +1 -0
  95. package/dist/cores/supabase/ssr.d.ts +1 -0
  96. package/dist/cores/supabase/ssr.js +1 -0
  97. package/dist/cores/uuid.cjs +1 -0
  98. package/dist/cores/uuid.d.cts +1 -0
  99. package/dist/cores/uuid.d.ts +1 -0
  100. package/dist/cores/uuid.js +1 -0
  101. package/dist/cores/zod.cjs +1 -0
  102. package/dist/cores/zod.d.cts +3 -0
  103. package/dist/cores/zod.d.ts +3 -0
  104. package/dist/cores/zod.js +1 -0
  105. package/dist/formatter-MMKFBkro.d.cts +12 -0
  106. package/dist/formatter-MMKFBkro.d.cts.map +1 -0
  107. package/dist/formatter-vjbCoK9k.d.ts +12 -0
  108. package/dist/formatter-vjbCoK9k.d.ts.map +1 -0
  109. package/dist/index.cjs +1 -0
  110. package/dist/index.d.cts +6 -0
  111. package/dist/index.d.ts +6 -0
  112. package/dist/index.js +1 -0
  113. package/dist/interface-BFsLlmGy.d.ts +1 -0
  114. package/dist/interface-BR9QNgXO.d.cts +283 -0
  115. package/dist/interface-BR9QNgXO.d.cts.map +1 -0
  116. package/dist/interface-ii8DV63k.d.ts +283 -0
  117. package/dist/interface-ii8DV63k.d.ts.map +1 -0
  118. package/dist/interface-weqBVeUf.d.cts +1 -0
  119. package/dist/lib/permission.cjs +0 -0
  120. package/dist/lib/permission.d.cts +1 -0
  121. package/dist/lib/permission.d.ts +1 -0
  122. package/dist/lib/permission.js +1 -0
  123. package/dist/modules/auth/client/index.cjs +1 -0
  124. package/dist/modules/auth/client/index.d.cts +5 -0
  125. package/dist/modules/auth/client/index.d.ts +5 -0
  126. package/dist/modules/auth/client/index.js +1 -0
  127. package/dist/modules/auth/client/retry.cjs +1 -0
  128. package/dist/modules/auth/client/retry.d.cts +11 -0
  129. package/dist/modules/auth/client/retry.d.cts.map +1 -0
  130. package/dist/modules/auth/client/retry.d.ts +11 -0
  131. package/dist/modules/auth/client/retry.d.ts.map +1 -0
  132. package/dist/modules/auth/client/retry.js +2 -0
  133. package/dist/modules/auth/client/retry.js.map +1 -0
  134. package/dist/modules/auth/interface.cjs +1 -0
  135. package/dist/modules/auth/interface.d.cts +8 -0
  136. package/dist/modules/auth/interface.d.cts.map +1 -0
  137. package/dist/modules/auth/interface.d.ts +8 -0
  138. package/dist/modules/auth/interface.d.ts.map +1 -0
  139. package/dist/modules/auth/interface.js +2 -0
  140. package/dist/modules/auth/interface.js.map +1 -0
  141. package/dist/modules/auth/policy.cjs +1 -0
  142. package/dist/modules/auth/policy.d.cts +15 -0
  143. package/dist/modules/auth/policy.d.cts.map +1 -0
  144. package/dist/modules/auth/policy.d.ts +15 -0
  145. package/dist/modules/auth/policy.d.ts.map +1 -0
  146. package/dist/modules/auth/policy.js +2 -0
  147. package/dist/modules/auth/policy.js.map +1 -0
  148. package/dist/modules/auth/server/crypto.cjs +1 -0
  149. package/dist/modules/auth/server/crypto.d.cts +3 -0
  150. package/dist/modules/auth/server/crypto.d.cts.map +1 -0
  151. package/dist/modules/auth/server/crypto.d.ts +3 -0
  152. package/dist/modules/auth/server/crypto.d.ts.map +1 -0
  153. package/dist/modules/auth/server/crypto.js +2 -0
  154. package/dist/modules/auth/server/crypto.js.map +1 -0
  155. package/dist/modules/auth/server/grant-guard.cjs +1 -0
  156. package/dist/modules/auth/server/grant-guard.d.cts +6 -0
  157. package/dist/modules/auth/server/grant-guard.d.cts.map +1 -0
  158. package/dist/modules/auth/server/grant-guard.d.ts +6 -0
  159. package/dist/modules/auth/server/grant-guard.d.ts.map +1 -0
  160. package/dist/modules/auth/server/grant-guard.js +2 -0
  161. package/dist/modules/auth/server/grant-guard.js.map +1 -0
  162. package/dist/modules/auth/server/identity-cache.cjs +1 -0
  163. package/dist/modules/auth/server/identity-cache.d.cts +8 -0
  164. package/dist/modules/auth/server/identity-cache.d.cts.map +1 -0
  165. package/dist/modules/auth/server/identity-cache.d.ts +8 -0
  166. package/dist/modules/auth/server/identity-cache.d.ts.map +1 -0
  167. package/dist/modules/auth/server/identity-cache.js +2 -0
  168. package/dist/modules/auth/server/identity-cache.js.map +1 -0
  169. package/dist/modules/auth/server/identity.cjs +1 -0
  170. package/dist/modules/auth/server/identity.d.cts +5 -0
  171. package/dist/modules/auth/server/identity.d.cts.map +1 -0
  172. package/dist/modules/auth/server/identity.d.ts +5 -0
  173. package/dist/modules/auth/server/identity.d.ts.map +1 -0
  174. package/dist/modules/auth/server/identity.js +2 -0
  175. package/dist/modules/auth/server/identity.js.map +1 -0
  176. package/dist/modules/auth/server/index.cjs +1 -0
  177. package/dist/modules/auth/server/index.d.cts +12 -0
  178. package/dist/modules/auth/server/index.d.ts +12 -0
  179. package/dist/modules/auth/server/index.js +1 -0
  180. package/dist/modules/auth/server/interface.cjs +0 -0
  181. package/dist/modules/auth/server/interface.d.cts +3 -0
  182. package/dist/modules/auth/server/interface.d.ts +3 -0
  183. package/dist/modules/auth/server/interface.js +1 -0
  184. package/dist/modules/auth/server/logout.cjs +1 -0
  185. package/dist/modules/auth/server/logout.d.cts +10 -0
  186. package/dist/modules/auth/server/logout.d.cts.map +1 -0
  187. package/dist/modules/auth/server/logout.d.ts +10 -0
  188. package/dist/modules/auth/server/logout.d.ts.map +1 -0
  189. package/dist/modules/auth/server/logout.js +2 -0
  190. package/dist/modules/auth/server/logout.js.map +1 -0
  191. package/dist/modules/auth/server/proof.cjs +1 -0
  192. package/dist/modules/auth/server/proof.d.cts +6 -0
  193. package/dist/modules/auth/server/proof.d.cts.map +1 -0
  194. package/dist/modules/auth/server/proof.d.ts +6 -0
  195. package/dist/modules/auth/server/proof.d.ts.map +1 -0
  196. package/dist/modules/auth/server/proof.js +2 -0
  197. package/dist/modules/auth/server/proof.js.map +1 -0
  198. package/dist/modules/auth/server/resource.cjs +1 -0
  199. package/dist/modules/auth/server/resource.d.cts +10 -0
  200. package/dist/modules/auth/server/resource.d.cts.map +1 -0
  201. package/dist/modules/auth/server/resource.d.ts +10 -0
  202. package/dist/modules/auth/server/resource.d.ts.map +1 -0
  203. package/dist/modules/auth/server/resource.js +2 -0
  204. package/dist/modules/auth/server/resource.js.map +1 -0
  205. package/dist/modules/auth/server/revocation.cjs +1 -0
  206. package/dist/modules/auth/server/revocation.d.cts +4 -0
  207. package/dist/modules/auth/server/revocation.d.cts.map +1 -0
  208. package/dist/modules/auth/server/revocation.d.ts +4 -0
  209. package/dist/modules/auth/server/revocation.d.ts.map +1 -0
  210. package/dist/modules/auth/server/revocation.js +2 -0
  211. package/dist/modules/auth/server/revocation.js.map +1 -0
  212. package/dist/modules/common/admin.cjs +1 -0
  213. package/dist/modules/common/admin.d.cts +4 -0
  214. package/dist/modules/common/admin.d.cts.map +1 -0
  215. package/dist/modules/common/admin.d.ts +4 -0
  216. package/dist/modules/common/admin.d.ts.map +1 -0
  217. package/dist/modules/common/admin.js +2 -0
  218. package/dist/modules/common/admin.js.map +1 -0
  219. package/dist/modules/common/client.cjs +1 -0
  220. package/dist/modules/common/client.d.cts +118 -0
  221. package/dist/modules/common/client.d.cts.map +1 -0
  222. package/dist/modules/common/client.d.ts +118 -0
  223. package/dist/modules/common/client.d.ts.map +1 -0
  224. package/dist/modules/common/client.js +2 -0
  225. package/dist/modules/common/client.js.map +1 -0
  226. package/dist/modules/common/index.cjs +1 -0
  227. package/dist/modules/common/index.d.cts +6 -0
  228. package/dist/modules/common/index.d.ts +6 -0
  229. package/dist/modules/common/index.js +1 -0
  230. package/dist/modules/common/realtime.cjs +0 -0
  231. package/dist/modules/common/realtime.d.cts +2 -0
  232. package/dist/modules/common/realtime.d.ts +2 -0
  233. package/dist/modules/common/realtime.js +1 -0
  234. package/dist/modules/common/upload.cjs +1 -0
  235. package/dist/modules/common/upload.d.cts +4 -0
  236. package/dist/modules/common/upload.d.cts.map +1 -0
  237. package/dist/modules/common/upload.d.ts +4 -0
  238. package/dist/modules/common/upload.d.ts.map +1 -0
  239. package/dist/modules/common/upload.js +2 -0
  240. package/dist/modules/common/upload.js.map +1 -0
  241. package/dist/modules/desktop/index.cjs +1 -0
  242. package/dist/modules/desktop/index.d.cts +6 -0
  243. package/dist/modules/desktop/index.d.ts +6 -0
  244. package/dist/modules/desktop/index.js +1 -0
  245. package/dist/modules/desktop/interface.cjs +0 -0
  246. package/dist/modules/desktop/interface.d.cts +2 -0
  247. package/dist/modules/desktop/interface.d.ts +2 -0
  248. package/dist/modules/desktop/interface.js +1 -0
  249. package/dist/modules/desktop/rpc.cjs +1 -0
  250. package/dist/modules/desktop/rpc.d.cts +7 -0
  251. package/dist/modules/desktop/rpc.d.cts.map +1 -0
  252. package/dist/modules/desktop/rpc.d.ts +7 -0
  253. package/dist/modules/desktop/rpc.d.ts.map +1 -0
  254. package/dist/modules/desktop/rpc.js +2 -0
  255. package/dist/modules/desktop/rpc.js.map +1 -0
  256. package/dist/modules/desktop/shortcut.cjs +1 -0
  257. package/dist/modules/desktop/shortcut.d.cts +6 -0
  258. package/dist/modules/desktop/shortcut.d.cts.map +1 -0
  259. package/dist/modules/desktop/shortcut.d.ts +6 -0
  260. package/dist/modules/desktop/shortcut.d.ts.map +1 -0
  261. package/dist/modules/desktop/shortcut.js +2 -0
  262. package/dist/modules/desktop/shortcut.js.map +1 -0
  263. package/dist/modules/http/caller.cjs +1 -0
  264. package/dist/modules/http/caller.d.cts +18 -0
  265. package/dist/modules/http/caller.d.cts.map +1 -0
  266. package/dist/modules/http/caller.d.ts +18 -0
  267. package/dist/modules/http/caller.d.ts.map +1 -0
  268. package/dist/modules/http/caller.js +2 -0
  269. package/dist/modules/http/caller.js.map +1 -0
  270. package/dist/modules/http/error.cjs +1 -0
  271. package/dist/modules/http/error.d.cts +2 -0
  272. package/dist/modules/http/error.d.ts +2 -0
  273. package/dist/modules/http/error.js +2 -0
  274. package/dist/modules/http/error.js.map +1 -0
  275. package/dist/modules/http/fetcher.cjs +1 -0
  276. package/dist/modules/http/fetcher.d.cts +6 -0
  277. package/dist/modules/http/fetcher.d.cts.map +1 -0
  278. package/dist/modules/http/fetcher.d.ts +6 -0
  279. package/dist/modules/http/fetcher.d.ts.map +1 -0
  280. package/dist/modules/http/fetcher.js +2 -0
  281. package/dist/modules/http/fetcher.js.map +1 -0
  282. package/dist/modules/http/index.cjs +1 -0
  283. package/dist/modules/http/index.d.cts +5 -0
  284. package/dist/modules/http/index.d.ts +5 -0
  285. package/dist/modules/http/index.js +1 -0
  286. package/dist/modules/http/response.cjs +1 -0
  287. package/dist/modules/http/response.d.cts +6 -0
  288. package/dist/modules/http/response.d.cts.map +1 -0
  289. package/dist/modules/http/response.d.ts +6 -0
  290. package/dist/modules/http/response.d.ts.map +1 -0
  291. package/dist/modules/http/response.js +2 -0
  292. package/dist/modules/http/response.js.map +1 -0
  293. package/dist/modules/supabase/express/client.cjs +1 -0
  294. package/dist/modules/supabase/express/client.d.cts +3 -0
  295. package/dist/modules/supabase/express/client.d.cts.map +1 -0
  296. package/dist/modules/supabase/express/client.d.ts +3 -0
  297. package/dist/modules/supabase/express/client.d.ts.map +1 -0
  298. package/dist/modules/supabase/express/client.js +2 -0
  299. package/dist/modules/supabase/express/client.js.map +1 -0
  300. package/dist/modules/supabase/express/index.cjs +1 -0
  301. package/dist/modules/supabase/express/index.d.cts +3 -0
  302. package/dist/modules/supabase/express/index.d.ts +3 -0
  303. package/dist/modules/supabase/express/index.js +1 -0
  304. package/dist/modules/supabase/express/server.cjs +1 -0
  305. package/dist/modules/supabase/express/server.d.cts +2 -0
  306. package/dist/modules/supabase/express/server.d.ts +2 -0
  307. package/dist/modules/supabase/express/server.js +1 -0
  308. package/dist/modules/supabase/next/client.cjs +1 -0
  309. package/dist/modules/supabase/next/client.d.cts +60 -0
  310. package/dist/modules/supabase/next/client.d.cts.map +1 -0
  311. package/dist/modules/supabase/next/client.d.ts +60 -0
  312. package/dist/modules/supabase/next/client.d.ts.map +1 -0
  313. package/dist/modules/supabase/next/client.js +2 -0
  314. package/dist/modules/supabase/next/client.js.map +1 -0
  315. package/dist/modules/supabase/next/index.cjs +1 -0
  316. package/dist/modules/supabase/next/index.d.cts +5 -0
  317. package/dist/modules/supabase/next/index.d.ts +5 -0
  318. package/dist/modules/supabase/next/index.js +1 -0
  319. package/dist/modules/supabase/next/middleware.cjs +1 -0
  320. package/dist/modules/supabase/next/middleware.d.cts +2 -0
  321. package/dist/modules/supabase/next/middleware.d.cts.map +1 -0
  322. package/dist/modules/supabase/next/middleware.d.ts +2 -0
  323. package/dist/modules/supabase/next/middleware.d.ts.map +1 -0
  324. package/dist/modules/supabase/next/middleware.js +2 -0
  325. package/dist/modules/supabase/next/middleware.js.map +1 -0
  326. package/dist/modules/supabase/next/server.cjs +1 -0
  327. package/dist/modules/supabase/next/server.d.cts +61 -0
  328. package/dist/modules/supabase/next/server.d.cts.map +1 -0
  329. package/dist/modules/supabase/next/server.d.ts +61 -0
  330. package/dist/modules/supabase/next/server.d.ts.map +1 -0
  331. package/dist/modules/supabase/next/server.js +2 -0
  332. package/dist/modules/supabase/next/server.js.map +1 -0
  333. package/dist/rolldown-runtime-BocRIvOZ.cjs +1 -0
  334. package/dist/utils/formatter.cjs +1 -0
  335. package/dist/utils/formatter.d.cts +2 -0
  336. package/dist/utils/formatter.d.ts +2 -0
  337. package/dist/utils/formatter.js +2 -0
  338. package/dist/utils/formatter.js.map +1 -0
  339. package/dist/utils/interface.cjs +0 -0
  340. package/dist/utils/interface.d.cts +2 -0
  341. package/dist/utils/interface.d.ts +2 -0
  342. package/dist/utils/interface.js +1 -0
  343. package/docs/auth.md +183 -0
  344. package/docs/modules.md +36 -0
  345. package/package.json +189 -0
@@ -0,0 +1,2 @@
1
+ function e(e){return{subject:e.sub,name:e.name,email:e.email,emailVerified:e.email_verified,username:e.preferred_username,image:e.picture}}function t(e){return e instanceof Date?e.getTime():typeof e==`string`?Date.parse(e):e}function n(e,t,n,r){return{status:e,body:JSON.stringify({error:{message:t,code:n,data:{code:r,httpStatus:e}}})}}function r(e){if(!e.trim())return``;let t=e.split(`+`).map(e=>e.trim()),n=t.pop().replace(/^Arrow/,``);if(!/^(?:[a-z0-9,./;[\]\\-]|Tab|Space|Plus|Enter|Backspace|Delete|Escape|Up|Down|Left|Right|F(?:[1-9]|1[0-9]|2[0-4]))$/i.test(n))throw Error(`Choose a letter, number, function key or navigation key.`);let r=[`CmdOrCtrl`,`Ctrl`,`Alt`,`Shift`,`Super`];if(t.some(e=>!r.includes(e))||new Set(t).size!==t.length||!t.some(e=>[`CmdOrCtrl`,`Ctrl`,`Alt`,`Super`].includes(e))&&!/^F\d+$/i.test(n))throw Error(`Use Command/Control, Alt, or a function key.`);let i=[`Tab`,`Space`,`Plus`,`Enter`,`Backspace`,`Delete`,`Escape`,`Up`,`Down`,`Left`,`Right`];return[...r.filter(e=>t.includes(e)),i.find(e=>e.toLowerCase()===n.toLowerCase())??n.toUpperCase()].join(`+`)}function i(e,t){return e.replace(`CmdOrCtrl`,t?`Super`:`Ctrl`).split(`+`).sort().join(`+`)}function a(e){let t=new Headers;for(let[n,r]of Object.entries(e.headers))if(r!=null&&r!==!1)for(let e of Array.isArray(r)?r:[r])t.append(n,String(e));for(let e of(t.get(`connection`)??``).split(`,`))e.trim()&&t.delete(e.trim());for(let e of[`content-length`,`content-encoding`,`transfer-encoding`,`connection`,`keep-alive`,`trailer`,`upgrade`,`proxy-authenticate`,`proxy-authorization`])t.delete(e);return t}function o(e,t){if(e===void 0)return null;if(typeof e==`string`||e instanceof Blob||e instanceof ReadableStream||e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)){let t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),t}if(e instanceof URLSearchParams||e instanceof FormData)return e;if(typeof e==`object`&&e&&`pipe`in e)throw TypeError(`Supply mapBody for a Node stream`);return t.has(`content-type`)||t.set(`content-type`,`application/json`),JSON.stringify(e)}export{t as formatEpochMilliseconds,e as formatOAuthIdentity,o as formatResponseBody,a as formatResponseHeaders,n as formatRpcFailure,r as normalizeAccelerator,i as shortcutIdentity};
2
+ //# sourceMappingURL=formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.js","names":["formatOAuthIdentity","data","formatEpochMilliseconds","value","formatRpcFailure","label","status","normalizeAccelerator","parts","part","key","order","names","shortcutIdentity","accelerator","isMac","formatResponseHeaders","headers","name","response","item","formatResponseBody","bytes"],"sources":["../../src/utils/formatter.ts"],"sourcesContent":["import type {\n AuthIdentity,\n DesktopRpcResponse,\n OAuthIdentityClaims,\n} from \"@/utils/interface\";\nimport type { AxiosResponse } from \"axios\";\n\n/** Call only after provider identity validation. Never project authorization roles. */\nexport function formatOAuthIdentity(data: OAuthIdentityClaims): AuthIdentity {\n return {\n subject: data.sub,\n name: data.name,\n email: data.email,\n emailVerified: data.email_verified,\n username: data.preferred_username,\n image: data.picture,\n };\n}\n\nexport function formatEpochMilliseconds(value: Date | string | number): number {\n return value instanceof Date\n ? value.getTime()\n : typeof value === \"string\"\n ? Date.parse(value)\n : value;\n}\n\nexport function formatRpcFailure(\n status: number,\n message: string,\n code: number,\n label: string,\n): DesktopRpcResponse {\n return {\n status,\n body: JSON.stringify({\n error: { message, code, data: { code: label, httpStatus: status } },\n }),\n };\n}\n\nexport function normalizeAccelerator(value: string): string {\n if (!value.trim()) return \"\";\n const parts = value.split(\"+\").map((part) => part.trim());\n const key = parts.pop()!.replace(/^Arrow/, \"\");\n if (\n !/^(?:[a-z0-9,./;[\\]\\\\-]|Tab|Space|Plus|Enter|Backspace|Delete|Escape|Up|Down|Left|Right|F(?:[1-9]|1[0-9]|2[0-4]))$/i.test(\n key,\n )\n )\n throw new Error(\"Choose a letter, number, function key or navigation key.\");\n const order = [\"CmdOrCtrl\", \"Ctrl\", \"Alt\", \"Shift\", \"Super\"];\n if (\n parts.some((part) => !order.includes(part)) ||\n new Set(parts).size !== parts.length ||\n (!parts.some((part) =>\n [\"CmdOrCtrl\", \"Ctrl\", \"Alt\", \"Super\"].includes(part),\n ) &&\n !/^F\\d+$/i.test(key))\n )\n throw new Error(\"Use Command/Control, Alt, or a function key.\");\n const names = [\n \"Tab\",\n \"Space\",\n \"Plus\",\n \"Enter\",\n \"Backspace\",\n \"Delete\",\n \"Escape\",\n \"Up\",\n \"Down\",\n \"Left\",\n \"Right\",\n ];\n return [\n ...order.filter((part) => parts.includes(part)),\n names.find((part) => part.toLowerCase() === key.toLowerCase()) ??\n key.toUpperCase(),\n ].join(\"+\");\n}\n\nexport function shortcutIdentity(accelerator: string, isMac: boolean): string {\n return accelerator\n .replace(\"CmdOrCtrl\", isMac ? \"Super\" : \"Ctrl\")\n .split(\"+\")\n .sort()\n .join(\"+\");\n}\n\nexport function formatResponseHeaders(response: AxiosResponse<unknown>) {\n const headers = new Headers();\n for (const [name, value] of Object.entries(response.headers)) {\n if (value === undefined || value === null || value === false) continue;\n for (const item of Array.isArray(value) ? value : [value])\n headers.append(name, String(item));\n }\n for (const name of (headers.get(\"connection\") ?? \"\").split(\",\")) {\n if (name.trim()) headers.delete(name.trim());\n }\n // Axios may have decompressed or reserialized the payload. These wire headers\n // would otherwise make the downstream browser decode/count it a second time.\n for (const name of [\n \"content-length\",\n \"content-encoding\",\n \"transfer-encoding\",\n \"connection\",\n \"keep-alive\",\n \"trailer\",\n \"upgrade\",\n \"proxy-authenticate\",\n \"proxy-authorization\",\n ])\n headers.delete(name);\n return headers;\n}\n\nexport function formatResponseBody(\n data: unknown,\n headers: Headers,\n): BodyInit | null {\n if (data === undefined) return null;\n if (\n typeof data === \"string\" ||\n data instanceof Blob ||\n data instanceof ReadableStream\n )\n return data;\n if (data instanceof ArrayBuffer) return data;\n if (ArrayBuffer.isView(data)) {\n const bytes = new Uint8Array(data.byteLength);\n bytes.set(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));\n return bytes;\n }\n if (data instanceof URLSearchParams || data instanceof FormData) return data;\n if (typeof data === \"object\" && data !== null && \"pipe\" in data)\n throw new TypeError(\"Supply mapBody for a Node stream\");\n if (!headers.has(\"content-type\"))\n headers.set(\"content-type\", \"application/json\");\n return JSON.stringify(data);\n}\n"],"mappings":"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"}
File without changes
@@ -0,0 +1,2 @@
1
+ import { A as LogoutVerifierOptions, B as SupabaseAnyClient, C as DesktopRpcRequest, D as IdentityCacheInput, E as FetcherOptions, F as ResourceAuthOptions, H as UploadUtils, I as SessionGrantGuardOptions, L as Shortcut, M as OAuthIdentityValidatorOptions, N as ProofStorage, O as IdentityCacheOptions, P as RealtimeUtils, R as ShortcutDefinition, S as DesktopRpcPolicy, T as DesktopRpcTransportOptions, U as VerifiedLogout, V as UploadInput, W as WebResponseOptions, _ as CallerToastOptions, a as AuthIdentity, b as DefaultSchema, c as AuthRetryOptions, d as AuthSessionBinding, f as CallerErrorOptions, g as CallerResponseHandler, h as CallerRequestOptions, i as AuthFreshnessInput, j as OAuthIdentityClaims, k as LogoutStorage, l as AuthRevocation, m as CallerOptions, n as AuthErrorCode, o as AuthPolicy, p as CallerMethodOptions, r as AuthFreshness, s as AuthRetryInput, t as AuthCookieInput, u as AuthRevocationIdentity, v as CommonCookieMethods, w as DesktopRpcResponse, x as DesktopRpcHandlerOptions, y as DatabaseSchema, z as ShortcutPolicy } from "../interface-BR9QNgXO.cjs";
2
+ export { AuthCookieInput, AuthErrorCode, AuthFreshness, AuthFreshnessInput, AuthIdentity, AuthPolicy, AuthRetryInput, AuthRetryOptions, AuthRevocation, AuthRevocationIdentity, AuthSessionBinding, CallerErrorOptions, CallerMethodOptions, CallerOptions, CallerRequestOptions, CallerResponseHandler, CallerToastOptions, CommonCookieMethods, DatabaseSchema, DefaultSchema, DesktopRpcHandlerOptions, DesktopRpcPolicy, DesktopRpcRequest, DesktopRpcResponse, DesktopRpcTransportOptions, FetcherOptions, IdentityCacheInput, IdentityCacheOptions, LogoutStorage, LogoutVerifierOptions, OAuthIdentityClaims, OAuthIdentityValidatorOptions, ProofStorage, RealtimeUtils, ResourceAuthOptions, SessionGrantGuardOptions, Shortcut, ShortcutDefinition, ShortcutPolicy, SupabaseAnyClient, UploadInput, UploadUtils, VerifiedLogout, WebResponseOptions };
@@ -0,0 +1,2 @@
1
+ import { A as LogoutVerifierOptions, B as SupabaseAnyClient, C as DesktopRpcRequest, D as IdentityCacheInput, E as FetcherOptions, F as ResourceAuthOptions, H as UploadUtils, I as SessionGrantGuardOptions, L as Shortcut, M as OAuthIdentityValidatorOptions, N as ProofStorage, O as IdentityCacheOptions, P as RealtimeUtils, R as ShortcutDefinition, S as DesktopRpcPolicy, T as DesktopRpcTransportOptions, U as VerifiedLogout, V as UploadInput, W as WebResponseOptions, _ as CallerToastOptions, a as AuthIdentity, b as DefaultSchema, c as AuthRetryOptions, d as AuthSessionBinding, f as CallerErrorOptions, g as CallerResponseHandler, h as CallerRequestOptions, i as AuthFreshnessInput, j as OAuthIdentityClaims, k as LogoutStorage, l as AuthRevocation, m as CallerOptions, n as AuthErrorCode, o as AuthPolicy, p as CallerMethodOptions, r as AuthFreshness, s as AuthRetryInput, t as AuthCookieInput, u as AuthRevocationIdentity, v as CommonCookieMethods, w as DesktopRpcResponse, x as DesktopRpcHandlerOptions, y as DatabaseSchema, z as ShortcutPolicy } from "../interface-ii8DV63k.js";
2
+ export { AuthCookieInput, AuthErrorCode, AuthFreshness, AuthFreshnessInput, AuthIdentity, AuthPolicy, AuthRetryInput, AuthRetryOptions, AuthRevocation, AuthRevocationIdentity, AuthSessionBinding, CallerErrorOptions, CallerMethodOptions, CallerOptions, CallerRequestOptions, CallerResponseHandler, CallerToastOptions, CommonCookieMethods, DatabaseSchema, DefaultSchema, DesktopRpcHandlerOptions, DesktopRpcPolicy, DesktopRpcRequest, DesktopRpcResponse, DesktopRpcTransportOptions, FetcherOptions, IdentityCacheInput, IdentityCacheOptions, LogoutStorage, LogoutVerifierOptions, OAuthIdentityClaims, OAuthIdentityValidatorOptions, ProofStorage, RealtimeUtils, ResourceAuthOptions, SessionGrantGuardOptions, Shortcut, ShortcutDefinition, ShortcutPolicy, SupabaseAnyClient, UploadInput, UploadUtils, VerifiedLogout, WebResponseOptions };
@@ -0,0 +1 @@
1
+ export{};
package/docs/auth.md ADDED
@@ -0,0 +1,183 @@
1
+ # Native Better Auth integration
2
+
3
+ Targets the installed Better Auth 1.7 SDK. Applications own `betterAuth({...})`,
4
+ provider configuration, keys, trusted origins, database schemas/adapters,
5
+ business permissions, cookies and routing. This package never reads env or
6
+ connects to a database.
7
+
8
+ SSO uses the official OAuth Provider; relying-party web apps use Generic OAuth
9
+ with native account/session/verification storage. Electron uses the official
10
+ Electron SDK with its app backend. Do not create another OAuth/session engine
11
+ inside Structure or use an ID token as a service access token.
12
+
13
+ ## App-owned SDK and required peer
14
+
15
+ `better-auth` is a **required peer dependency** (`^1.7`), not a runtime
16
+ dependency installed and re-exported by Structure. The package pins 1.7 in its
17
+ development dependencies only for builds and integration tests.
18
+
19
+ Every consuming application must declare its own direct `better-auth`
20
+ dependency, including Electron main and both runtimes of a split client/server
21
+ application. A package manager may auto-install peers, so the peer declaration
22
+ does not by itself enforce a direct dependency in the application's manifest.
23
+
24
+ ```sh
25
+ bun add better-auth@1.7
26
+ ```
27
+
28
+ Import native APIs directly:
29
+
30
+ ```ts
31
+ import { betterAuth } from "better-auth";
32
+ import { createAuthClient } from "better-auth/react";
33
+ import { genericOAuth } from "better-auth/plugins/generic-oauth";
34
+ import { requestToResourceInput, verifyAccessTokenRequest } from "better-auth/oauth2";
35
+ ```
36
+
37
+ The `cores/auth` and `cores/auth/*` namespaces are retired and explicitly
38
+ blocked by the export map. There are no compatibility re-exports. Native
39
+ adapters, cookies, integrations and plugins must use their official package
40
+ paths (for example `better-auth/adapters/drizzle`, `better-auth/cookies` and
41
+ `better-auth/next-js`).
42
+
43
+ Install optional features only in the app that uses them: OAuth Provider,
44
+ enterprise SSO, Infra, SCIM, Stripe or Electron use their owning
45
+ `@better-auth/*` package directly. Structure no longer depends on any of
46
+ those feature packages. This is a breaking export change; publish a new
47
+ breaking release/tag and update consumers deliberately.
48
+
49
+ SDK clients use `signIn.social({ provider: configuredProviderId })` in 1.7;
50
+ Generic OAuth does not need an invented `genericOAuthClient` plugin.
51
+ `nextCookies` is server integration, not a renderer/client export.
52
+
53
+ ## Modules retained because current apps use them
54
+
55
+ - `modules/auth/client`: `createAuthRetry`, `waitForAuthOperation`,
56
+ `AuthError`, configurable freshness/policy helpers. SDK owns session renewal;
57
+ retry only coalesces app-provided refresh/read callbacks, retries once after
58
+ 401, and fences late refresh results after reset/dispose.
59
+ - `modules/auth/server`: origin/return-path checks, SHA-256 fingerprints,
60
+ `createResourceAuth`, `createProofReplayStore`, `createLogoutVerifier`
61
+ and policy. API verification delegates to official
62
+ `verifyAccessTokenRequest`; persistent proof/revocation and local permissions
63
+ remain app-owned adapters.
64
+ - Signed back-channel logout is still used by the apps. Signature, issuer,
65
+ audience, typ, expiry, event and replay checks cannot be removed just because
66
+ app sessions are now native.
67
+
68
+ ## New reusable helpers
69
+
70
+ ### Identity cache
71
+
72
+ `createIdentityCache<Value>({ load, key?, maxAgeMs?, capacity?, maxPending?, now? })`
73
+ extracts the repeated UserInfo coalescing/cache logic. Default TTL is 120 seconds,
74
+ with 512 entries/pending operations; applications may override both.
75
+
76
+ ```ts
77
+ import { createIdentityCache } from "@gorth/structure/modules/auth/server";
78
+
79
+ const profiles = createIdentityCache({
80
+ load: loadValidatedActiveProfile,
81
+ maxAgeMs: applicationIdentityMaxAgeMs,
82
+ });
83
+ const profile = await profiles.get(accessToken, { fresh: sensitive, signal });
84
+ await profiles.forget(accessToken); // invalidate when revoking this grant
85
+ profiles.clear(); // invalidate this factory on teardown/global invalidation
86
+ ```
87
+
88
+ The loader owns endpoint allowlisting, timeout, schema/status validation and
89
+ safe rejection classification. Return immutable identity data. The default key
90
+ is a SHA-256 fingerprint; raw credentials are not Map keys. Do not pass a raw
91
+ token-returning custom `key` callback. A transient failure never returns expired
92
+ identity data. Fresh calls bypass the cache and coalesce a currently running
93
+ check. TTL starts before networking; already-stale results are not cached.
94
+ Cancellation aborts only the waiter, not other callers' shared check.
95
+ Invalidation fences older responses, including pending key derivation on clear.
96
+
97
+ This is an **identity-only process-local cache**, not an authorization or
98
+ distributed session/refresh/replay store. Every protected operation still checks
99
+ token expiry/audience/scopes, durable revocation and local permissions. Sensitive
100
+ operations can force an online check. Cache contents contain no tokens.
101
+
102
+ ### Native identity validator
103
+
104
+ `createOAuthIdentityValidator({ providerId, subject, allowed? })` supplies
105
+ `user.validateUserInfo`. The caller selects its additional user subject field;
106
+ the helper accepts only that provider's SDK OAuth lifecycle with a matching
107
+ non-empty `profile.sub`. Optional `allowed(profile)` implements app-owned
108
+ identity status policy. Errors are safe identifiers, not provider payloads.
109
+
110
+ It does not verify/decode JWTs or create users. SDK verification must be enabled
111
+ in app provider configuration. Mutable email/username/SSO roles are never used
112
+ to link identities or elevate local roles. Profile mapping, defaults and schema
113
+ remain app-owned.
114
+
115
+ ### Session grant guard
116
+
117
+ `createSessionGrantGuard({ read, assertAllowed, now? }).run(operation, signal?)`
118
+ surrounds a native SDK credential-access operation, for example
119
+ `auth.api.getAccessToken`. `read` returns an authoritative existing native
120
+ session binding (`id, userId, subject, sid?, expiresAt`); `assertAllowed` checks
121
+ durable revocation and local permissions.
122
+
123
+ The guard checks before/after the operation and rejects missing, expired,
124
+ revoked, cancelled or changed session/account bindings. It adds no session
125
+ storage, token refresh, encryption or cookie format. Use it **before** sending
126
+ the next upstream proxy request. It cannot undo a side effect or a request
127
+ already dispatched, and does not revoke provider tokens itself. Multi-instance
128
+ race prevention still needs the app's durable session/revocation fences.
129
+ SDK handles token rotation; app handles grant revocation on local sign-out.
130
+
131
+ ### Revocation matching
132
+
133
+ `matchesAuthRevocation(marker, identity, now?)` is a pure predicate for
134
+ already-validated receipts. Both `sid` and subject must match when supplied;
135
+ a subject-only event covers sessions issued through the end of that JWT issuance
136
+ second, not future independent logins. All timestamps are epoch milliseconds.
137
+ Expired markers do not match. Signature verification, durable receipt uniqueness,
138
+ atomic session invalidation and retention remain with existing verifier/adapters.
139
+
140
+ ## Breaking legacy removal
141
+
142
+ Removed runtime modules: custom OAuth/PKCE engine, custom session store/refresh
143
+ engine, discovery/JWKS snapshot cache, session-bound transport, BFF HMAC,
144
+ endpoint/schema helpers used only by those engines, purpose-bound JWE cipher,
145
+ custom UI auth store/session adapter and loopback desktop login orchestration.
146
+ Their dependent types, formatters, exports and package-only obsolete tests are
147
+ removed too. Do not create fallback shims.
148
+
149
+ Use native Generic OAuth, getSession/useSession/signOut/getAccessToken and
150
+ `@better-auth/electron` instead. Do not migrate old ciphertext into native
151
+ storage without an app-owned explicit migration.
152
+
153
+ Active runtime imports in the ten apps and SSO were inspected and retained.
154
+ Some **legacy consumer tests**, however, still exercise removed APIs:
155
+
156
+ - Chat `tests/auth.test.ts`: custom OAuth/session contracts.
157
+ - Browser and Launcher `tests/vitest/auth-timeout.test.ts`: `createDesktopLogin`.
158
+
159
+ These must be replaced with native SDK tests before their next package update;
160
+ they cannot continue to import intentionally deleted APIs. Archived `pkg`
161
+ sources/docs can also mention them. No app, installed package, DB or SSO
162
+ registration was modified in this package-only change.
163
+
164
+ Publish as a **major release** because exports were intentionally removed.
165
+ Version/tag/publication remains owner-controlled; current package version was
166
+ not silently bumped. Publish and refresh consumer lockfiles before adopting new
167
+ helpers. Other infrastructure modules (HTTP, desktop RPC/shortcuts, Supabase)
168
+ are preserved rather than assuming auth migration makes them obsolete.
169
+
170
+ ## Verification
171
+
172
+ `pnpm verify` checks types, runtime tests, ESM/CJS build and public exports.
173
+ Tests cover SDK-native social login/account-selection/PKCE using an isolated
174
+ memory adapter, identity cache races, freshness, logout, grants, audience/scopes,
175
+ DPoP, browser-safe helper graphs, HTTP and desktop infrastructure.
176
+ Fixtures are not production adapters or a live browser/cloud end-to-end test.
177
+
178
+ References:
179
+
180
+ - [Generic OAuth](https://better-auth.com/docs/plugins/generic-oauth)
181
+ - [Session management](https://better-auth.com/docs/concepts/session-management)
182
+ - [OAuth Provider](https://better-auth.com/docs/plugins/oauth-provider)
183
+ - [Electron integration](https://better-auth.com/docs/integrations/electron)
@@ -0,0 +1,36 @@
1
+ # Shared modules
2
+
3
+ See [auth.md](auth.md) for SDK boundaries and breaking legacy removals.
4
+
5
+ | Module | Responsibility |
6
+ | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
7
+ | `modules/auth/client` | Framework-independent request retry coordination and freshness decisions |
8
+ | `modules/auth/server` | Identity cache/validator, native-session grant guard, revocation predicate, origin checks, native SDK resource verification and signed logout |
9
+ | `modules/http` | Injected Axios fetcher/caller, validation, safe errors, Web Response conversion |
10
+ | `modules/desktop` | Framework-free RPC packets and shortcut validation; not an auth engine |
11
+ | `modules/common` | Supabase admin/client/realtime/upload helpers |
12
+ | `modules/supabase/next` | Supabase SSR integration |
13
+ | `modules/supabase/express` | Supabase server/client integration |
14
+
15
+ All configuration, credentials, adapters, callbacks, runtime platform objects
16
+ and service destinations are supplied by the owning app. No module reads env,
17
+ connects to DB on import, creates a configured Better Auth instance, opens a
18
+ listener, or imports UI. Reusable contracts live in `src/utils/interface.ts`;
19
+ pure formatting lives in `src/utils/formatter.ts`. Internal module imports use
20
+ `@/` and async logic uses async/await with try/catch/finally.
21
+
22
+ HTTP callers retain injected runtime adapters (including desktop XHR) and do
23
+ not change QUIC/network settings. Caller mutations must opt into unsafe retries;
24
+ auth endpoints do not retry implicitly. Web Response conversion preserves
25
+ individual Set-Cookie, status and Location headers, and removes stale wire
26
+ encoding/length/hop-by-hop headers. Custom error mapping/notifications are app
27
+ callbacks, not UI package dependencies.
28
+
29
+ Desktop RPC still requires app-owned IPC sender/frame validation and trusted
30
+ preload transport. Shortcut policies/registration/persistence stay in the app.
31
+ Supabase credentials/RLS/ownership remain app responsibilities.
32
+
33
+ Use `pnpm verify` before releasing. The app-owned Better Auth SDK peer and direct
34
+ import requirements are listed in auth.md. GitHub distribution remains private-to-npm;
35
+ pin consumers to a tested release commit/tag. No app dependency or DB/cloud state
36
+ is changed by building this package.
package/package.json ADDED
@@ -0,0 +1,189 @@
1
+ {
2
+ "name": "@gorth-io/structure",
3
+ "version": "0.0.0-alpha.5",
4
+ "description": "",
5
+ "type": "module",
6
+ "author": "Gorthenburg",
7
+ "license": "GORTH",
8
+ "private": false,
9
+ "keywords": [
10
+ "gorth",
11
+ "supabase",
12
+ "ably",
13
+ "postgres",
14
+ "graphql",
15
+ "better-auth",
16
+ "client",
17
+ "server",
18
+ "desktop"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/gorth-io/base-structure.git"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "registry": "https://registry.npmjs.org"
27
+ },
28
+ "main": "./dist/index.cjs",
29
+ "module": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "files": [
32
+ "dist",
33
+ "docs/auth.md",
34
+ "docs/modules.md"
35
+ ],
36
+ "engines": {
37
+ "node": "24.x"
38
+ },
39
+ "packageManager": "bun@1.4.4",
40
+ "exports": {
41
+ "./utils/*": {
42
+ "types": "./dist/utils/*.d.ts",
43
+ "import": "./dist/utils/*.js",
44
+ "require": "./dist/utils/*.cjs"
45
+ },
46
+ "./modules/http": {
47
+ "types": "./dist/modules/http/index.d.ts",
48
+ "import": "./dist/modules/http/index.js",
49
+ "require": "./dist/modules/http/index.cjs"
50
+ },
51
+ "./modules/desktop": {
52
+ "types": "./dist/modules/desktop/index.d.ts",
53
+ "import": "./dist/modules/desktop/index.js",
54
+ "require": "./dist/modules/desktop/index.cjs"
55
+ },
56
+ "./modules/auth/client": {
57
+ "types": "./dist/modules/auth/client/index.d.ts",
58
+ "import": "./dist/modules/auth/client/index.js",
59
+ "require": "./dist/modules/auth/client/index.cjs"
60
+ },
61
+ "./modules/auth/server": {
62
+ "types": "./dist/modules/auth/server/index.d.ts",
63
+ "import": "./dist/modules/auth/server/index.js",
64
+ "require": "./dist/modules/auth/server/index.cjs"
65
+ },
66
+ ".": {
67
+ "types": "./dist/index.d.ts",
68
+ "import": "./dist/index.js",
69
+ "require": "./dist/index.cjs"
70
+ },
71
+ "./lib/*": {
72
+ "types": "./dist/lib/*.d.ts",
73
+ "import": "./dist/lib/*.js",
74
+ "require": "./dist/lib/*.cjs"
75
+ },
76
+ "./modules/*": {
77
+ "types": "./dist/modules/*.d.ts",
78
+ "import": "./dist/modules/*.js",
79
+ "require": "./dist/modules/*.cjs"
80
+ },
81
+ "./modules/*/*": {
82
+ "types": "./dist/modules/*/*.d.ts",
83
+ "import": "./dist/modules/*/*.js",
84
+ "require": "./dist/modules/*/*.cjs"
85
+ },
86
+ "./modules/*/*/*": {
87
+ "types": "./dist/modules/*/*/*.d.ts",
88
+ "import": "./dist/modules/*/*/*.js",
89
+ "require": "./dist/modules/*/*/*.cjs"
90
+ },
91
+ "./cores/*": {
92
+ "types": "./dist/cores/*.d.ts",
93
+ "import": "./dist/cores/*.js",
94
+ "require": "./dist/cores/*.cjs"
95
+ },
96
+ "./cores/*/*": {
97
+ "types": "./dist/cores/*/*.d.ts",
98
+ "import": "./dist/cores/*/*.js",
99
+ "require": "./dist/cores/*/*.cjs"
100
+ },
101
+ "./cores/*/*/*": {
102
+ "types": "./dist/cores/*/*/*.d.ts",
103
+ "import": "./dist/cores/*/*/*.js",
104
+ "require": "./dist/cores/*/*/*.cjs"
105
+ },
106
+ "./cores/auth": null,
107
+ "./cores/auth/*": null
108
+ },
109
+ "typesVersions": {
110
+ "*": {
111
+ "utils/*": [
112
+ "dist/utils/*.d.ts"
113
+ ],
114
+ "modules/http": [
115
+ "dist/modules/http/index.d.ts"
116
+ ],
117
+ "modules/desktop": [
118
+ "dist/modules/desktop/index.d.ts"
119
+ ],
120
+ "modules/auth/client": [
121
+ "dist/modules/auth/client/index.d.ts"
122
+ ],
123
+ "modules/auth/server": [
124
+ "dist/modules/auth/server/index.d.ts"
125
+ ],
126
+ "cores/*": [
127
+ "dist/cores/*.d.ts"
128
+ ],
129
+ "cores/*/*": [
130
+ "dist/cores/*/*.d.ts"
131
+ ],
132
+ "cores/*/*/*": [
133
+ "dist/cores/*/*/*.d.ts"
134
+ ],
135
+ "common/*": [
136
+ "dist/common/*.d.ts"
137
+ ],
138
+ "*": [
139
+ "dist/index.d.ts"
140
+ ]
141
+ }
142
+ },
143
+ "scripts": {
144
+ "build": "tsdown --minify",
145
+ "prepack": "bun run build",
146
+ "verify": "bun verify",
147
+ "dev": "tsdown --format esm,cjs --dts --out-dir dist --watch",
148
+ "lint": "eslint",
149
+ "format": "prettier --write \"**/*.{ts,tsx}\"",
150
+ "typecheck": "tsc --noEmit",
151
+ "update": "bun update",
152
+ "test": "node --import tsx --test tests/*.test.ts",
153
+ "test:types": "tsc --project tsconfig.test.json",
154
+ "test:exports": "node --test tests/auth-exports.test.mjs"
155
+ },
156
+ "dependencies": {
157
+ "@ably/ai-transport": "^0.11.0",
158
+ "@ably/chat": "^2.0.0",
159
+ "@ably/spaces": "^0.6.0",
160
+ "@supabase/postgrest-js": "^2.118.0",
161
+ "@supabase/server": "^1.9.2",
162
+ "@supabase/ssr": "^0.12.7",
163
+ "@supabase/supabase-js": "^2.118.0",
164
+ "ably": "^2.30.0",
165
+ "axios": "^1.21.0",
166
+ "graphql": "^16.14.2",
167
+ "graphql-request": "^7.4.0",
168
+ "graphql-tag": "^2.12.7",
169
+ "jose": "^6.2.15",
170
+ "pg": "^8.23.1",
171
+ "postgres": "^4.0.0",
172
+ "uuid": "^14.0.3",
173
+ "zod": "^4.6.7"
174
+ },
175
+ "devDependencies": {
176
+ "@types/node": "^26.6.6",
177
+ "@types/pg": "^8.23.1",
178
+ "better-auth": "1.7.15",
179
+ "eslint": "^9.39.5",
180
+ "prettier": "^3.9.10",
181
+ "tsdown": "^0.23.4",
182
+ "tsx": "^4.23.15",
183
+ "typescript": "^5.9.3",
184
+ "vitest": "^5.1.0"
185
+ },
186
+ "peerDependencies": {
187
+ "better-auth": "^1.7.15"
188
+ }
189
+ }