create-mithaq 0.0.0-stage → 0.1.1

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 (357) hide show
  1. package/LICENSE +22 -0
  2. package/LICENSES/payload.txt +22 -0
  3. package/LICENSES/ponytail.txt +21 -0
  4. package/index.js +127 -0
  5. package/package.json +19 -4
  6. package/template/apps/asas-platform/components.json +25 -0
  7. package/template/apps/asas-platform/gitignore +3 -0
  8. package/template/apps/asas-platform/package.json +55 -0
  9. package/template/apps/asas-platform/public/favicon.svg +1 -0
  10. package/template/apps/asas-platform/src/api.ts +147 -0
  11. package/template/apps/asas-platform/src/auth-frame.tsx +150 -0
  12. package/template/apps/asas-platform/src/components/mithaq/cells.tsx +112 -0
  13. package/template/apps/asas-platform/src/components/mithaq/controls.tsx +650 -0
  14. package/template/apps/asas-platform/src/components/mithaq/field-shell.tsx +53 -0
  15. package/template/apps/asas-platform/src/components/mithaq/filter-operators.ts +108 -0
  16. package/template/apps/asas-platform/src/components/mithaq/form.tsx +1467 -0
  17. package/template/apps/asas-platform/src/components/mithaq/list-columns.tsx +108 -0
  18. package/template/apps/asas-platform/src/components/mithaq/list-filters.tsx +368 -0
  19. package/template/apps/asas-platform/src/components/mithaq/list-pagination.tsx +153 -0
  20. package/template/apps/asas-platform/src/components/mithaq/list-query.ts +432 -0
  21. package/template/apps/asas-platform/src/components/mithaq/list-selection.tsx +74 -0
  22. package/template/apps/asas-platform/src/components/mithaq/list.tsx +865 -0
  23. package/template/apps/asas-platform/src/components/mithaq/nav.tsx +871 -0
  24. package/template/apps/asas-platform/src/components/mithaq/nodes.tsx +1024 -0
  25. package/template/apps/asas-platform/src/components/mithaq/relationship-cell.tsx +127 -0
  26. package/template/apps/asas-platform/src/components/mithaq/relationship-control.tsx +400 -0
  27. package/template/apps/asas-platform/src/components/mithaq/rich-text-nodes.ts +6 -0
  28. package/template/apps/asas-platform/src/components/mithaq/rich-text.tsx +1083 -0
  29. package/template/apps/asas-platform/src/components/mithaq/upload.tsx +686 -0
  30. package/template/apps/asas-platform/src/components/ui/accordion.tsx +74 -0
  31. package/template/apps/asas-platform/src/components/ui/alert-dialog.tsx +185 -0
  32. package/template/apps/asas-platform/src/components/ui/avatar.tsx +106 -0
  33. package/template/apps/asas-platform/src/components/ui/badge.tsx +48 -0
  34. package/template/apps/asas-platform/src/components/ui/breadcrumb.tsx +124 -0
  35. package/template/apps/asas-platform/src/components/ui/button-group.tsx +87 -0
  36. package/template/apps/asas-platform/src/components/ui/button.tsx +55 -0
  37. package/template/apps/asas-platform/src/components/ui/calendar.tsx +223 -0
  38. package/template/apps/asas-platform/src/components/ui/card.tsx +102 -0
  39. package/template/apps/asas-platform/src/components/ui/chart.tsx +371 -0
  40. package/template/apps/asas-platform/src/components/ui/checkbox.tsx +28 -0
  41. package/template/apps/asas-platform/src/components/ui/collapsible.tsx +19 -0
  42. package/template/apps/asas-platform/src/components/ui/combobox.tsx +308 -0
  43. package/template/apps/asas-platform/src/components/ui/dialog.tsx +158 -0
  44. package/template/apps/asas-platform/src/components/ui/direction.tsx +6 -0
  45. package/template/apps/asas-platform/src/components/ui/directional-icon.tsx +20 -0
  46. package/template/apps/asas-platform/src/components/ui/drawer.tsx +216 -0
  47. package/template/apps/asas-platform/src/components/ui/dropdown-menu.tsx +267 -0
  48. package/template/apps/asas-platform/src/components/ui/field.tsx +236 -0
  49. package/template/apps/asas-platform/src/components/ui/input-group.tsx +155 -0
  50. package/template/apps/asas-platform/src/components/ui/input-otp.tsx +84 -0
  51. package/template/apps/asas-platform/src/components/ui/input.tsx +19 -0
  52. package/template/apps/asas-platform/src/components/ui/label.tsx +19 -0
  53. package/template/apps/asas-platform/src/components/ui/popover.tsx +90 -0
  54. package/template/apps/asas-platform/src/components/ui/radio-group.tsx +37 -0
  55. package/template/apps/asas-platform/src/components/ui/resizable.tsx +47 -0
  56. package/template/apps/asas-platform/src/components/ui/scroll-area.tsx +54 -0
  57. package/template/apps/asas-platform/src/components/ui/select.tsx +204 -0
  58. package/template/apps/asas-platform/src/components/ui/separator.tsx +24 -0
  59. package/template/apps/asas-platform/src/components/ui/sheet.tsx +139 -0
  60. package/template/apps/asas-platform/src/components/ui/sidebar.tsx +714 -0
  61. package/template/apps/asas-platform/src/components/ui/skeleton.tsx +13 -0
  62. package/template/apps/asas-platform/src/components/ui/slider.tsx +55 -0
  63. package/template/apps/asas-platform/src/components/ui/spinner.tsx +10 -0
  64. package/template/apps/asas-platform/src/components/ui/switch.tsx +29 -0
  65. package/template/apps/asas-platform/src/components/ui/table.tsx +115 -0
  66. package/template/apps/asas-platform/src/components/ui/tabs.tsx +79 -0
  67. package/template/apps/asas-platform/src/components/ui/textarea.tsx +17 -0
  68. package/template/apps/asas-platform/src/components/ui/toggle-group.tsx +89 -0
  69. package/template/apps/asas-platform/src/components/ui/toggle.tsx +44 -0
  70. package/template/apps/asas-platform/src/components/ui/tooltip.tsx +63 -0
  71. package/template/apps/asas-platform/src/copy.ts +1 -0
  72. package/template/apps/asas-platform/src/hooks/use-mobile.ts +19 -0
  73. package/template/apps/asas-platform/src/lib/utils.ts +1 -0
  74. package/template/apps/asas-platform/src/links.ts +38 -0
  75. package/template/apps/asas-platform/src/locale-switch.tsx +26 -0
  76. package/template/apps/asas-platform/src/redirect.ts +1 -0
  77. package/template/apps/asas-platform/src/request-headers.ts +11 -0
  78. package/template/apps/asas-platform/src/routeTree.gen.ts +181 -0
  79. package/template/apps/asas-platform/src/router.tsx +7 -0
  80. package/template/apps/asas-platform/src/routes/(screens)/platform/files.ts +4 -0
  81. package/template/apps/asas-platform/src/routes/(screens)/platform/screen.json +3609 -0
  82. package/template/apps/asas-platform/src/routes/(screens)/platform/types.ts +145 -0
  83. package/template/apps/asas-platform/src/routes/(screens)/platform.$.tsx +17 -0
  84. package/template/apps/asas-platform/src/routes/(screens)/platform.index.tsx +10 -0
  85. package/template/apps/asas-platform/src/routes/(screens)/platform.tsx +13 -0
  86. package/template/apps/asas-platform/src/routes/__root.tsx +95 -0
  87. package/template/apps/asas-platform/src/routes/api/$.ts +30 -0
  88. package/template/apps/asas-platform/src/routes/auth.sign-in.tsx +72 -0
  89. package/template/apps/asas-platform/src/routes/unauthorized.tsx +122 -0
  90. package/template/apps/asas-platform/src/screen-form.tsx +34 -0
  91. package/template/apps/asas-platform/src/screen-list.tsx +139 -0
  92. package/template/apps/asas-platform/src/screen-names.ts +10 -0
  93. package/template/apps/asas-platform/src/screens.tsx +868 -0
  94. package/template/apps/asas-platform/src/server.ts +20 -0
  95. package/template/apps/asas-platform/src/slide.ts +22 -0
  96. package/template/apps/asas-platform/src/start.ts +42 -0
  97. package/template/apps/asas-platform/src/styles.css +200 -0
  98. package/template/apps/asas-platform/src/theme.ts +2 -0
  99. package/template/apps/asas-platform/tsconfig.json +19 -0
  100. package/template/apps/asas-platform/vite.config.ts +26 -0
  101. package/template/apps/asas-tanstack/components.json +25 -0
  102. package/template/apps/asas-tanstack/gitignore +3 -0
  103. package/template/apps/asas-tanstack/package.json +56 -0
  104. package/template/apps/asas-tanstack/public/favicon.svg +1 -0
  105. package/template/apps/asas-tanstack/src/api.ts +147 -0
  106. package/template/apps/asas-tanstack/src/auth-frame.tsx +150 -0
  107. package/template/apps/asas-tanstack/src/components/mithaq/cells.tsx +112 -0
  108. package/template/apps/asas-tanstack/src/components/mithaq/controls.tsx +650 -0
  109. package/template/apps/asas-tanstack/src/components/mithaq/field-shell.tsx +53 -0
  110. package/template/apps/asas-tanstack/src/components/mithaq/filter-operators.ts +108 -0
  111. package/template/apps/asas-tanstack/src/components/mithaq/form.tsx +1467 -0
  112. package/template/apps/asas-tanstack/src/components/mithaq/list-columns.tsx +108 -0
  113. package/template/apps/asas-tanstack/src/components/mithaq/list-filters.tsx +368 -0
  114. package/template/apps/asas-tanstack/src/components/mithaq/list-pagination.tsx +153 -0
  115. package/template/apps/asas-tanstack/src/components/mithaq/list-query.ts +432 -0
  116. package/template/apps/asas-tanstack/src/components/mithaq/list-selection.tsx +74 -0
  117. package/template/apps/asas-tanstack/src/components/mithaq/list.tsx +865 -0
  118. package/template/apps/asas-tanstack/src/components/mithaq/nav.tsx +871 -0
  119. package/template/apps/asas-tanstack/src/components/mithaq/nodes.tsx +1024 -0
  120. package/template/apps/asas-tanstack/src/components/mithaq/relationship-cell.tsx +127 -0
  121. package/template/apps/asas-tanstack/src/components/mithaq/relationship-control.tsx +400 -0
  122. package/template/apps/asas-tanstack/src/components/mithaq/rich-text-nodes.ts +6 -0
  123. package/template/apps/asas-tanstack/src/components/mithaq/rich-text.tsx +1083 -0
  124. package/template/apps/asas-tanstack/src/components/mithaq/upload.tsx +686 -0
  125. package/template/apps/asas-tanstack/src/components/ui/accordion.tsx +10 -0
  126. package/template/apps/asas-tanstack/src/components/ui/alert-dialog.tsx +173 -0
  127. package/template/apps/asas-tanstack/src/components/ui/avatar.tsx +104 -0
  128. package/template/apps/asas-tanstack/src/components/ui/badge.tsx +48 -0
  129. package/template/apps/asas-tanstack/src/components/ui/breadcrumb.tsx +125 -0
  130. package/template/apps/asas-tanstack/src/components/ui/button-group.tsx +87 -0
  131. package/template/apps/asas-tanstack/src/components/ui/button.tsx +56 -0
  132. package/template/apps/asas-tanstack/src/components/ui/calendar.tsx +223 -0
  133. package/template/apps/asas-tanstack/src/components/ui/card.tsx +94 -0
  134. package/template/apps/asas-tanstack/src/components/ui/chart.tsx +369 -0
  135. package/template/apps/asas-tanstack/src/components/ui/checkbox.tsx +27 -0
  136. package/template/apps/asas-tanstack/src/components/ui/collapsible.tsx +19 -0
  137. package/template/apps/asas-tanstack/src/components/ui/combobox.tsx +300 -0
  138. package/template/apps/asas-tanstack/src/components/ui/dialog.tsx +149 -0
  139. package/template/apps/asas-tanstack/src/components/ui/direction.tsx +5 -0
  140. package/template/apps/asas-tanstack/src/components/ui/directional-icon.tsx +20 -0
  141. package/template/apps/asas-tanstack/src/components/ui/drawer.tsx +215 -0
  142. package/template/apps/asas-tanstack/src/components/ui/dropdown-menu.tsx +267 -0
  143. package/template/apps/asas-tanstack/src/components/ui/field.tsx +225 -0
  144. package/template/apps/asas-tanstack/src/components/ui/input-group.tsx +147 -0
  145. package/template/apps/asas-tanstack/src/components/ui/input-otp.tsx +20 -0
  146. package/template/apps/asas-tanstack/src/components/ui/input.tsx +20 -0
  147. package/template/apps/asas-tanstack/src/components/ui/label.tsx +18 -0
  148. package/template/apps/asas-tanstack/src/components/ui/popover.tsx +50 -0
  149. package/template/apps/asas-tanstack/src/components/ui/radio-group.tsx +10 -0
  150. package/template/apps/asas-tanstack/src/components/ui/resizable.tsx +47 -0
  151. package/template/apps/asas-tanstack/src/components/ui/scroll-area.tsx +52 -0
  152. package/template/apps/asas-tanstack/src/components/ui/select.tsx +190 -0
  153. package/template/apps/asas-tanstack/src/components/ui/separator.tsx +23 -0
  154. package/template/apps/asas-tanstack/src/components/ui/sheet.tsx +127 -0
  155. package/template/apps/asas-tanstack/src/components/ui/sidebar.tsx +716 -0
  156. package/template/apps/asas-tanstack/src/components/ui/skeleton.tsx +13 -0
  157. package/template/apps/asas-tanstack/src/components/ui/slider.tsx +13 -0
  158. package/template/apps/asas-tanstack/src/components/ui/spinner.tsx +11 -0
  159. package/template/apps/asas-tanstack/src/components/ui/switch.tsx +8 -0
  160. package/template/apps/asas-tanstack/src/components/ui/table.tsx +119 -0
  161. package/template/apps/asas-tanstack/src/components/ui/tabs.tsx +80 -0
  162. package/template/apps/asas-tanstack/src/components/ui/textarea.tsx +18 -0
  163. package/template/apps/asas-tanstack/src/components/ui/toggle-group.tsx +8 -0
  164. package/template/apps/asas-tanstack/src/components/ui/toggle.tsx +44 -0
  165. package/template/apps/asas-tanstack/src/components/ui/tooltip.tsx +68 -0
  166. package/template/apps/asas-tanstack/src/copy.ts +870 -0
  167. package/template/apps/asas-tanstack/src/hooks/use-mobile.ts +19 -0
  168. package/template/apps/asas-tanstack/src/lib/utils.ts +6 -0
  169. package/template/apps/asas-tanstack/src/links.ts +38 -0
  170. package/template/apps/asas-tanstack/src/locale-switch.tsx +26 -0
  171. package/template/apps/asas-tanstack/src/quiet-abort.ts +25 -0
  172. package/template/apps/asas-tanstack/src/redirect.ts +20 -0
  173. package/template/apps/asas-tanstack/src/request-headers.ts +11 -0
  174. package/template/apps/asas-tanstack/src/routeTree.gen.ts +382 -0
  175. package/template/apps/asas-tanstack/src/router.tsx +7 -0
  176. package/template/apps/asas-tanstack/src/routes/(screens)/dashboard/files.ts +4 -0
  177. package/template/apps/asas-tanstack/src/routes/(screens)/dashboard/screen.json +3883 -0
  178. package/template/apps/asas-tanstack/src/routes/(screens)/dashboard/types.ts +158 -0
  179. package/template/apps/asas-tanstack/src/routes/(screens)/dashboard.$.tsx +17 -0
  180. package/template/apps/asas-tanstack/src/routes/(screens)/dashboard.index.tsx +10 -0
  181. package/template/apps/asas-tanstack/src/routes/(screens)/dashboard.tsx +13 -0
  182. package/template/apps/asas-tanstack/src/routes/(screens)/portal/files.ts +4 -0
  183. package/template/apps/asas-tanstack/src/routes/(screens)/portal/screen.json +1800 -0
  184. package/template/apps/asas-tanstack/src/routes/(screens)/portal/types.ts +92 -0
  185. package/template/apps/asas-tanstack/src/routes/(screens)/portal.$.tsx +17 -0
  186. package/template/apps/asas-tanstack/src/routes/(screens)/portal.index.tsx +10 -0
  187. package/template/apps/asas-tanstack/src/routes/(screens)/portal.tsx +13 -0
  188. package/template/apps/asas-tanstack/src/routes/__root.tsx +99 -0
  189. package/template/apps/asas-tanstack/src/routes/api/$.ts +11 -0
  190. package/template/apps/asas-tanstack/src/routes/auth.accept-invitation.tsx +101 -0
  191. package/template/apps/asas-tanstack/src/routes/auth.forgot-password.tsx +94 -0
  192. package/template/apps/asas-tanstack/src/routes/auth.handoff.ts +39 -0
  193. package/template/apps/asas-tanstack/src/routes/auth.reset-password.tsx +109 -0
  194. package/template/apps/asas-tanstack/src/routes/auth.sign-in.tsx +86 -0
  195. package/template/apps/asas-tanstack/src/routes/auth.sign-up.tsx +122 -0
  196. package/template/apps/asas-tanstack/src/routes/index.tsx +142 -0
  197. package/template/apps/asas-tanstack/src/routes/unauthorized.tsx +122 -0
  198. package/template/apps/asas-tanstack/src/screen-form.tsx +34 -0
  199. package/template/apps/asas-tanstack/src/screen-list.tsx +139 -0
  200. package/template/apps/asas-tanstack/src/screen-names.ts +10 -0
  201. package/template/apps/asas-tanstack/src/screens.tsx +868 -0
  202. package/template/apps/asas-tanstack/src/server.ts +16 -0
  203. package/template/apps/asas-tanstack/src/slide.ts +22 -0
  204. package/template/apps/asas-tanstack/src/start.ts +57 -0
  205. package/template/apps/asas-tanstack/src/styles.css +159 -0
  206. package/template/apps/asas-tanstack/src/theme.ts +5 -0
  207. package/template/apps/asas-tanstack/tsconfig.json +19 -0
  208. package/template/apps/asas-tanstack/vite.config.ts +28 -0
  209. package/template/package.json +16 -0
  210. package/template/templates/asas/.env.example +16 -0
  211. package/template/templates/asas/components.json +22 -0
  212. package/template/templates/asas/mithaq.hints.json +25 -0
  213. package/template/templates/asas/package.json +38 -0
  214. package/template/templates/asas/src/asas.ts +93 -0
  215. package/template/templates/asas/src/audit-log/audit-log.ts +187 -0
  216. package/template/templates/asas/src/audit-log/sink.ts +89 -0
  217. package/template/templates/asas/src/audit-log/ui/activity.tsx +243 -0
  218. package/template/templates/asas/src/courses/courses.ts +612 -0
  219. package/template/templates/asas/src/courses/ui/archive-button.tsx +25 -0
  220. package/template/templates/asas/src/courses/ui/fee-cell.tsx +19 -0
  221. package/template/templates/asas/src/courses/ui/no-courses-on-offer.tsx +11 -0
  222. package/template/templates/asas/src/courses/ui/no-courses.tsx +13 -0
  223. package/template/templates/asas/src/courses/ui/on-offer.ts +6 -0
  224. package/template/templates/asas/src/courses/ui/status-cell.tsx +31 -0
  225. package/template/templates/asas/src/enrollments/enrollments.ts +137 -0
  226. package/template/templates/asas/src/enrollments/ui/session-cell.tsx +65 -0
  227. package/template/templates/asas/src/kayan/auth/user/account.access.ts +8 -0
  228. package/template/templates/asas/src/kayan/auth/user/account.ts +31 -0
  229. package/template/templates/asas/src/kayan/auth/user/index.ts +18 -0
  230. package/template/templates/asas/src/kayan/auth/user/invitation.access.ts +4 -0
  231. package/template/templates/asas/src/kayan/auth/user/invitation.ts +27 -0
  232. package/template/templates/asas/src/kayan/auth/user/member.access.ts +10 -0
  233. package/template/templates/asas/src/kayan/auth/user/member.screens.ts +37 -0
  234. package/template/templates/asas/src/kayan/auth/user/member.ts +25 -0
  235. package/template/templates/asas/src/kayan/auth/user/organization.access.ts +20 -0
  236. package/template/templates/asas/src/kayan/auth/user/organization.screens.ts +37 -0
  237. package/template/templates/asas/src/kayan/auth/user/organization.ts +24 -0
  238. package/template/templates/asas/src/kayan/auth/user/organizationRole.access.ts +8 -0
  239. package/template/templates/asas/src/kayan/auth/user/organizationRole.ts +25 -0
  240. package/template/templates/asas/src/kayan/auth/user/session.access.ts +8 -0
  241. package/template/templates/asas/src/kayan/auth/user/session.ts +28 -0
  242. package/template/templates/asas/src/kayan/auth/user/user.access.ts +29 -0
  243. package/template/templates/asas/src/kayan/auth/user/user.screens.ts +45 -0
  244. package/template/templates/asas/src/kayan/auth/user/user.ts +31 -0
  245. package/template/templates/asas/src/kayan/auth/user/verification.access.ts +8 -0
  246. package/template/templates/asas/src/kayan/auth/user/verification.ts +23 -0
  247. package/template/templates/asas/src/local-users/local-users.ts +143 -0
  248. package/template/templates/asas/src/media/media.ts +137 -0
  249. package/template/templates/asas/src/media/ui/preview.tsx +143 -0
  250. package/template/templates/asas/src/member-roles/member-roles.ts +207 -0
  251. package/template/templates/asas/src/messages/account.json +106 -0
  252. package/template/templates/asas/src/messages/auditLog.json +186 -0
  253. package/template/templates/asas/src/messages/courses.json +270 -0
  254. package/template/templates/asas/src/messages/enrollments.json +42 -0
  255. package/template/templates/asas/src/messages/invitation.json +66 -0
  256. package/template/templates/asas/src/messages/localUsers.json +42 -0
  257. package/template/templates/asas/src/messages/media.json +66 -0
  258. package/template/templates/asas/src/messages/member.json +42 -0
  259. package/template/templates/asas/src/messages/memberRoles.json +42 -0
  260. package/template/templates/asas/src/messages/mithaq.json +170 -0
  261. package/template/templates/asas/src/messages/organization.json +50 -0
  262. package/template/templates/asas/src/messages/organizationRole.json +50 -0
  263. package/template/templates/asas/src/messages/roles.json +58 -0
  264. package/template/templates/asas/src/messages/session.json +82 -0
  265. package/template/templates/asas/src/messages/sessions.json +106 -0
  266. package/template/templates/asas/src/messages/settings.json +66 -0
  267. package/template/templates/asas/src/messages/tags.json +38 -0
  268. package/template/templates/asas/src/messages/user.json +90 -0
  269. package/template/templates/asas/src/messages/verification.json +50 -0
  270. package/template/templates/asas/src/migrations/20260920080701_parched_tombstone/migration.sql +177 -0
  271. package/template/templates/asas/src/migrations/20260920080701_parched_tombstone/snapshot.json +2169 -0
  272. package/template/templates/asas/src/migrations/20260920230505_zippy_ben_urich/migration.sql +1 -0
  273. package/template/templates/asas/src/migrations/20260920230505_zippy_ben_urich/snapshot.json +2182 -0
  274. package/template/templates/asas/src/migrations/20260920231219_slim_retro_girl/migration.sql +20 -0
  275. package/template/templates/asas/src/migrations/20260920231219_slim_retro_girl/snapshot.json +2409 -0
  276. package/template/templates/asas/src/migrations/20260922082945_military_ironclad/migration.sql +15 -0
  277. package/template/templates/asas/src/migrations/20260922082945_military_ironclad/snapshot.json +2627 -0
  278. package/template/templates/asas/src/migrations/20260922112630_bitter_chat/migration.sql +5 -0
  279. package/template/templates/asas/src/migrations/20260922112630_bitter_chat/snapshot.json +2691 -0
  280. package/template/templates/asas/src/migrations/20260923235915_foamy_rachel_grey/migration.sql +8 -0
  281. package/template/templates/asas/src/migrations/20260923235915_foamy_rachel_grey/snapshot.json +2795 -0
  282. package/template/templates/asas/src/migrations/20260926145709_clean_the_initiative/migration.sql +3 -0
  283. package/template/templates/asas/src/migrations/20260926145709_clean_the_initiative/snapshot.json +2834 -0
  284. package/template/templates/asas/src/migrations/20260927212525_bent_prowler/migration.sql +9 -0
  285. package/template/templates/asas/src/migrations/20260927212525_bent_prowler/snapshot.json +2870 -0
  286. package/template/templates/asas/src/migrations/20260927223441_tranquil_bromley/migration.sql +1 -0
  287. package/template/templates/asas/src/migrations/20260927223441_tranquil_bromley/snapshot.json +2881 -0
  288. package/template/templates/asas/src/migrations/20260928030047_outgoing_wraith/migration.sql +15 -0
  289. package/template/templates/asas/src/migrations/20260928030047_outgoing_wraith/snapshot.json +3073 -0
  290. package/template/templates/asas/src/migrations/20260929024407_grey_morlun/migration.sql +21 -0
  291. package/template/templates/asas/src/migrations/20260929024407_grey_morlun/snapshot.json +3098 -0
  292. package/template/templates/asas/src/migrations/20260929130530_bored_jackal/migration.sql +21 -0
  293. package/template/templates/asas/src/migrations/20260929130530_bored_jackal/snapshot.json +3124 -0
  294. package/template/templates/asas/src/migrations/20260930102924_material_newton_destine/migration.sql +32 -0
  295. package/template/templates/asas/src/migrations/20260930102924_material_newton_destine/snapshot.json +3324 -0
  296. package/template/templates/asas/src/migrations/20261003022353_clumsy_taskmaster/migration.sql +2 -0
  297. package/template/templates/asas/src/migrations/20261003022353_clumsy_taskmaster/snapshot.json +3350 -0
  298. package/template/templates/asas/src/migrations/20261003143249_premium_red_shift/migration.sql +21 -0
  299. package/template/templates/asas/src/migrations/20261003143249_premium_red_shift/snapshot.json +3635 -0
  300. package/template/templates/asas/src/migrations/20261008215349_square_norrin_radd/migration.sql +8 -0
  301. package/template/templates/asas/src/migrations/20261008215349_square_norrin_radd/snapshot.json +3635 -0
  302. package/template/templates/asas/src/migrations/20261008230204_many_scarecrow/migration.sql +18 -0
  303. package/template/templates/asas/src/migrations/20261008230204_many_scarecrow/snapshot.json +3635 -0
  304. package/template/templates/asas/src/migrations/20261010005521_elite_giant_girl/migration.sql +18 -0
  305. package/template/templates/asas/src/migrations/20261010005521_elite_giant_girl/snapshot.json +3635 -0
  306. package/template/templates/asas/src/migrations/20261010120822_needy_thunderbolt/migration.sql +11 -0
  307. package/template/templates/asas/src/migrations/20261010120822_needy_thunderbolt/snapshot.json +3667 -0
  308. package/template/templates/asas/src/migrations/20261012000752_organization_ownership/migration.sql +48 -0
  309. package/template/templates/asas/src/migrations/20261012000752_organization_ownership/snapshot.json +3891 -0
  310. package/template/templates/asas/src/migrations/drizzle.config.ts +11 -0
  311. package/template/templates/asas/src/migrations/schema.ts +29 -0
  312. package/template/templates/asas/src/mithaq.ts +406 -0
  313. package/template/templates/asas/src/pages.ts +74 -0
  314. package/template/templates/asas/src/platform-http.ts +96 -0
  315. package/template/templates/asas/src/rich-text-nodes.ts +11 -0
  316. package/template/templates/asas/src/roles/grants.ts +47 -0
  317. package/template/templates/asas/src/roles/roles.ts +184 -0
  318. package/template/templates/asas/src/roles/ui/role-form.tsx +226 -0
  319. package/template/templates/asas/src/roles/ui/roles.tsx +166 -0
  320. package/template/templates/asas/src/roles.ts +16 -0
  321. package/template/templates/asas/src/seed.ts +325 -0
  322. package/template/templates/asas/src/sessions/sessions.ts +155 -0
  323. package/template/templates/asas/src/settings/settings.ts +69 -0
  324. package/template/templates/asas/src/statements.ts +11 -0
  325. package/template/templates/asas/src/steps/expected-updated-at.ts +41 -0
  326. package/template/templates/asas/src/storage/defaults.ts +156 -0
  327. package/template/templates/asas/src/storage/index.ts +95 -0
  328. package/template/templates/asas/src/storage/local.ts +143 -0
  329. package/template/templates/asas/src/storage/r2.ts +5 -0
  330. package/template/templates/asas/src/storage/s3.ts +91 -0
  331. package/template/templates/asas/src/storage/uploadthing.ts +59 -0
  332. package/template/templates/asas/src/tags/tags.ts +80 -0
  333. package/template/templates/asas/src/tenant-access.ts +221 -0
  334. package/template/templates/asas/src/tenant-roles.ts +262 -0
  335. package/template/templates/asas/src/ui/app-shell.tsx +260 -0
  336. package/template/templates/asas/src/ui/kpi-card.tsx +25 -0
  337. package/template/templates/asas/src/ui/record-page.tsx +50 -0
  338. package/template/templates/asas/src/ui/rich-text-nodes.tsx +15 -0
  339. package/template/templates/asas/src/ui/screen-nav.tsx +28 -0
  340. package/template/templates/asas/src/ui/session-labels.tsx +36 -0
  341. package/template/templates/asas/src/ui/table-page.tsx +9 -0
  342. package/template/templates/asas/src/ui/top-shell.tsx +60 -0
  343. package/template/templates/asas/src/ui-dashboard/dashboard.tsx +294 -0
  344. package/template/templates/asas/src/ui-dashboard/members.tsx +630 -0
  345. package/template/templates/asas/src/ui-dashboard/theme-provider.tsx +10 -0
  346. package/template/templates/asas/src/ui-dashboard/versions.tsx +432 -0
  347. package/template/templates/asas/src/ui-platform/home.tsx +63 -0
  348. package/template/templates/asas/src/ui-platform/organization-actions.tsx +114 -0
  349. package/template/templates/asas/src/ui-platform/record-page.tsx +30 -0
  350. package/template/templates/asas/src/ui-platform/role-cells.tsx +52 -0
  351. package/template/templates/asas/src/ui-platform/user-actions.tsx +251 -0
  352. package/template/templates/asas/src/ui-portal/home.tsx +77 -0
  353. package/template/templates/asas/src/ui-portal/page.tsx +11 -0
  354. package/template/templates/auth/package.json +14 -0
  355. package/template/templates/auth/src/index.ts +690 -0
  356. package/template/templates/auth/src/platform-roles.ts +87 -0
  357. package/README.md +0 -3
@@ -0,0 +1,16 @@
1
+ import handler, { createServerEntry } from '@tanstack/react-start/server-entry'
2
+ import { withQuietAbort } from './quiet-abort.ts'
3
+
4
+ // A production start connects once before handing on any request, and `connect()` refuses to
5
+ // start while a migration is unapplied; a refused start exits 1. NODE_ENV is read off `process`
6
+ // so Vite cannot replace it at build time, and a built server started without
7
+ // `NODE_ENV=production` never connects, which would push into the deploy's database.
8
+ const { env } = process
9
+ if (env.NODE_ENV === 'production') {
10
+ await (await import('asas')).asas.connect().catch((error: unknown) => {
11
+ console.error(error)
12
+ process.exit(1)
13
+ })
14
+ }
15
+
16
+ export default createServerEntry({ fetch: (request: Request) => handler.fetch(withQuietAbort(request)) })
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The provider's own session read, which refreshes a session past its `updateAge` and forwards the cookie.
3
+ * Run it before the actor is resolved: a read that refreshes the row first leaves this one nothing due.
4
+ */
5
+ export const slide = async ({
6
+ strategies,
7
+ headers,
8
+ setResponseHeader,
9
+ }: {
10
+ strategies: readonly unknown[]
11
+ headers: Headers
12
+ setResponseHeader: (name: 'set-cookie', value: string[]) => void
13
+ }) => {
14
+ const cookies: string[] = []
15
+ for (const strategy of strategies) {
16
+ const read = (strategy as { server?: { api?: { getSession?: (args: object) => Promise<{ headers: Headers }> } } }).server?.api?.getSession
17
+ if (read) cookies.push(...(await read({ headers, returnHeaders: true })).headers.getSetCookie())
18
+ }
19
+ // Set once with every strategy's cookies: a second set replaces the first.
20
+ if (cookies.length) setResponseHeader('set-cookie', cookies)
21
+ }
22
+ // mithaq-admin b06d8d335d306c07556f8f2b81fba20ba7ded198 bc0221e1088103f8638e0333b84aafb6b326e3991a187ced198bce2d090ecbe9
@@ -0,0 +1,57 @@
1
+ import { createCsrfMiddleware, createMiddleware, createStart } from '@tanstack/react-start'
2
+ import { dirOf, localeCookie, localeOf } from './copy.ts'
3
+
4
+ // The locale is resolved once per request, before any route runs, because the document's `lang`
5
+ // and `dir` are written before a loader exists. Nothing here imports
6
+ // `@tanstack/react-start/server`: both builds reach this entry, so it would put server code in the client.
7
+
8
+ /** No `decodeURIComponent`: the only caller refuses every value but two ASCII names. */
9
+ const cookieOf = (header: string | null, name: string): string | undefined =>
10
+ header
11
+ ?.split(';')
12
+ .map((one) => one.trim().split('='))
13
+ .find(([key]) => key === name)
14
+ ?.slice(1)
15
+ .join('=')
16
+
17
+ /**
18
+ * The request's locale and direction, off the `locale` cookie alone: `Accept-Language` is not a
19
+ * choice the viewer made.
20
+ */
21
+ const locale = createMiddleware({ type: 'request' }).server(({ request, next }) => {
22
+ const asked = localeOf(cookieOf(request.headers.get('cookie'), localeCookie))
23
+ return next({ context: { locale: asked, dir: dirOf(asked) } })
24
+ })
25
+
26
+ /** Refuses a server function reached from outside the page; page renders and `/api` are untouched. */
27
+ const csrf = createCsrfMiddleware({ filter: (ctx) => ctx.handlerType === 'serverFn' })
28
+
29
+ /**
30
+ * `/admin` answers a 308 to the same path under `/dashboard`, so a saved link still lands with its
31
+ * method and body. The location is a path, never a URL, so the request's host header never reaches it.
32
+ */
33
+ const moved = createMiddleware({ type: 'request' }).server(({ request, next }) => {
34
+ const url = new URL(request.url)
35
+ if (!/^\/admin(\/|$)/.test(url.pathname)) return next()
36
+ return new Response(null, { status: 308, headers: { location: `/dashboard${url.pathname.slice('/admin'.length)}${url.search}` } })
37
+ })
38
+
39
+ /**
40
+ * Only this origin may frame this app's pages, so no other site can lay it under its own page and
41
+ * steer a click. First, so it covers every other middleware's answer; rebuilt, since a redirect's
42
+ * headers are immutable.
43
+ */
44
+ const framing = createMiddleware({ type: 'request' }).server(async ({ next }) => {
45
+ const result = await next()
46
+ const answer = result.response
47
+ const html = answer.headers.get('content-type')?.startsWith('text/html') === true
48
+ if (answer.headers.has('content-security-policy') && !html) return result
49
+ const headers = new Headers(answer.headers)
50
+ if (!headers.has('content-security-policy')) headers.set('content-security-policy', "frame-ancestors 'self'")
51
+ // No HTML answer is cached: each is drawn for one request's session and locale, so a page
52
+ // someone signed out of must not come back from the cache on Back.
53
+ if (html) headers.set('cache-control', 'no-store')
54
+ return { ...result, response: new Response(answer.body, { status: answer.status, statusText: answer.statusText, headers }) }
55
+ })
56
+
57
+ export const startInstance = createStart(() => ({ requestMiddleware: [framing, moved, csrf, locale] }))
@@ -0,0 +1,159 @@
1
+ /* Theme copied wholesale from tanstack-business:apps/web/src/styles.css:
2
+ imports, custom-variant, :root and .dark variables, the @theme inline
3
+ block and the @layer base rules, unchanged. Only the @source line below
4
+ differs, pointing at this project's template instead of TB's monorepo.
5
+ Tailwind finds this app's own files, the copied `src/components/mithaq`
6
+ among them, without one. */
7
+ @import 'tailwindcss';
8
+ @import 'tw-animate-css';
9
+ @import 'shadcn/tailwind.css';
10
+ @import '@fontsource-variable/raleway';
11
+ @import '@fontsource/ibm-plex-sans-arabic';
12
+
13
+ /* The project's own shells, pages and components, which the screens load
14
+ through the same linked package (`templates/asas/src/ui/app-shell.tsx`). */
15
+ @source '../node_modules/asas/src';
16
+
17
+ @custom-variant dark (&:is(.dark *));
18
+
19
+ :root {
20
+ --background: oklch(1 0 0);
21
+ --foreground: oklch(0.147 0.004 49.25);
22
+ --card: oklch(1 0 0);
23
+ --card-foreground: oklch(0.147 0.004 49.25);
24
+ --popover: oklch(1 0 0);
25
+ --popover-foreground: oklch(0.147 0.004 49.25);
26
+ --primary: oklch(0.216 0.006 56.043);
27
+ --primary-foreground: oklch(0.985 0.001 106.423);
28
+ --secondary: oklch(0.97 0.001 106.424);
29
+ --secondary-foreground: oklch(0.216 0.006 56.043);
30
+ --muted: oklch(0.97 0.001 106.424);
31
+ --muted-foreground: oklch(0.553 0.013 58.071);
32
+ --accent: oklch(0.97 0.001 106.424);
33
+ --accent-foreground: oklch(0.216 0.006 56.043);
34
+ /* Darker than the preset's red 600, which is 4.0:1 on the pale red fill the destructive button and menu item draw it on and 3.3:1 on its hover; this is 5.9:1 on the fill and 4.9:1 on the hover. */
35
+ --destructive: oklch(0.48 0.2 27.5);
36
+ --border: oklch(0.923 0.003 48.717);
37
+ --input: oklch(0.923 0.003 48.717);
38
+ --ring: oklch(0.709 0.01 56.259);
39
+ --chart-1: oklch(0.646 0.222 41.116);
40
+ --chart-2: oklch(0.6 0.118 184.704);
41
+ --chart-3: oklch(0.398 0.07 227.392);
42
+ --chart-4: oklch(0.828 0.189 84.429);
43
+ --chart-5: oklch(0.769 0.188 70.08);
44
+ --radius: 0.625rem;
45
+ --sidebar: oklch(0.985 0.001 106.423);
46
+ --sidebar-foreground: oklch(0.147 0.004 49.25);
47
+ --sidebar-primary: oklch(0.216 0.006 56.043);
48
+ --sidebar-primary-foreground: oklch(0.985 0.001 106.423);
49
+ --sidebar-accent: oklch(0.97 0.001 106.424);
50
+ --sidebar-accent-foreground: oklch(0.216 0.006 56.043);
51
+ --sidebar-border: oklch(0.923 0.003 48.717);
52
+ --sidebar-ring: oklch(0.709 0.01 56.259);
53
+ }
54
+
55
+ .dark {
56
+ --background: oklch(0.147 0.004 49.25);
57
+ --foreground: oklch(0.985 0.001 106.423);
58
+ --card: oklch(0.216 0.006 56.043);
59
+ --card-foreground: oklch(0.985 0.001 106.423);
60
+ --popover: oklch(0.216 0.006 56.043);
61
+ --popover-foreground: oklch(0.985 0.001 106.423);
62
+ --primary: oklch(0.923 0.003 48.717);
63
+ --primary-foreground: oklch(0.216 0.006 56.043);
64
+ --secondary: oklch(0.268 0.007 34.298);
65
+ --secondary-foreground: oklch(0.985 0.001 106.423);
66
+ --muted: oklch(0.268 0.007 34.298);
67
+ --muted-foreground: oklch(0.709 0.01 56.259);
68
+ --accent: oklch(0.268 0.007 34.298);
69
+ --accent-foreground: oklch(0.985 0.001 106.423);
70
+ --destructive: oklch(0.704 0.191 22.216);
71
+ --border: oklch(1 0 0 / 10%);
72
+ --input: oklch(1 0 0 / 15%);
73
+ --ring: oklch(0.553 0.013 58.071);
74
+ --chart-1: oklch(0.488 0.243 264.376);
75
+ --chart-2: oklch(0.696 0.17 162.48);
76
+ --chart-3: oklch(0.769 0.188 70.08);
77
+ --chart-4: oklch(0.627 0.265 303.9);
78
+ --chart-5: oklch(0.645 0.246 16.439);
79
+ --sidebar: oklch(0.216 0.006 56.043);
80
+ --sidebar-foreground: oklch(0.985 0.001 106.423);
81
+ --sidebar-primary: oklch(0.488 0.243 264.376);
82
+ --sidebar-primary-foreground: oklch(0.985 0.001 106.423);
83
+ --sidebar-accent: oklch(0.268 0.007 34.298);
84
+ --sidebar-accent-foreground: oklch(0.985 0.001 106.423);
85
+ --sidebar-border: oklch(1 0 0 / 10%);
86
+ --sidebar-ring: oklch(0.553 0.013 58.071);
87
+ }
88
+
89
+ @theme inline {
90
+ --font-sans: 'IBM Plex Sans Arabic', 'Raleway', sans-serif;
91
+ --color-sidebar-ring: var(--sidebar-ring);
92
+ --color-sidebar-border: var(--sidebar-border);
93
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
94
+ --color-sidebar-accent: var(--sidebar-accent);
95
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
96
+ --color-sidebar-primary: var(--sidebar-primary);
97
+ --color-sidebar-foreground: var(--sidebar-foreground);
98
+ --color-sidebar: var(--sidebar);
99
+ --color-chart-5: var(--chart-5);
100
+ --color-chart-4: var(--chart-4);
101
+ --color-chart-3: var(--chart-3);
102
+ --color-chart-2: var(--chart-2);
103
+ --color-chart-1: var(--chart-1);
104
+ --color-ring: var(--ring);
105
+ --color-input: var(--input);
106
+ --color-border: var(--border);
107
+ --color-destructive: var(--destructive);
108
+ --color-accent-foreground: var(--accent-foreground);
109
+ --color-accent: var(--accent);
110
+ --color-muted-foreground: var(--muted-foreground);
111
+ --color-muted: var(--muted);
112
+ --color-secondary-foreground: var(--secondary-foreground);
113
+ --color-secondary: var(--secondary);
114
+ --color-primary-foreground: var(--primary-foreground);
115
+ --color-primary: var(--primary);
116
+ --color-popover-foreground: var(--popover-foreground);
117
+ --color-popover: var(--popover);
118
+ --color-card-foreground: var(--card-foreground);
119
+ --color-card: var(--card);
120
+ --color-foreground: var(--foreground);
121
+ --color-background: var(--background);
122
+ --radius-sm: calc(var(--radius) - 4px);
123
+ --radius-md: calc(var(--radius) - 2px);
124
+ --radius-lg: var(--radius);
125
+ --radius-xl: calc(var(--radius) + 4px);
126
+ --radius-2xl: calc(var(--radius) + 8px);
127
+ --radius-3xl: calc(var(--radius) + 12px);
128
+ --radius-4xl: calc(var(--radius) + 16px);
129
+ }
130
+
131
+ @layer base {
132
+ * {
133
+ @apply border-border outline-ring/50;
134
+ }
135
+ body {
136
+ @apply font-sans bg-background text-foreground;
137
+ }
138
+ html {
139
+ @apply font-sans;
140
+ }
141
+ }
142
+
143
+ /* Fix: Make dropdown menu roots not affect layout */
144
+ [data-slot='dropdown-menu'] {
145
+ display: contents;
146
+ }
147
+
148
+ /* Fix: Ensure sidebar menu action dropdowns don't affect layout */
149
+ /* Fix: Ensure sidebar menu action dropdowns don't affect layout
150
+ Note: This was causing issues with SidebarMenuAction positioning. Removing display: contents from trigger.
151
+ */
152
+ /* [data-sidebar='menu-item'] > [data-slot='dropdown-menu-trigger'] {
153
+ display: contents;
154
+ } */
155
+
156
+ /* Fix: Ensure sidebar footer content spans full width */
157
+ [data-sidebar='footer'] [data-slot='dropdown-menu-trigger'] {
158
+ width: 100%;
159
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Where the chosen theme is remembered. The React provider and the blocking head script both
3
+ * read it, and disagreeing would flash the wrong theme on first paint.
4
+ */
5
+ export const themeStorageKey = 'vite-ui-theme'
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2024",
4
+ "lib": ["es2024", "dom", "dom.iterable"],
5
+ "module": "preserve",
6
+ "moduleResolution": "bundler",
7
+ "jsx": "react-jsx",
8
+ "strict": true,
9
+ "noUncheckedIndexedAccess": true,
10
+ "noEmit": true,
11
+ "skipLibCheck": true,
12
+ "erasableSyntaxOnly": true,
13
+ "allowImportingTsExtensions": true,
14
+ "resolveJsonModule": true,
15
+ "types": ["node", "vite/client"],
16
+ "paths": { "@/*": ["./src/*"] }
17
+ },
18
+ "include": ["src/**/*.ts", "src/**/*.tsx", "vite.config.ts", "../../templates/asas/src/ui/*.tsx", "../../templates/asas/src/ui-*/*.tsx", "../../templates/asas/src/*/ui/*.tsx"]
19
+ }
@@ -0,0 +1,28 @@
1
+ import tailwindcss from '@tailwindcss/vite'
2
+ import { tanstackStart } from '@tanstack/react-start/plugin/vite'
3
+ import viteReact from '@vitejs/plugin-react'
4
+ import { defineConfig } from 'vite'
5
+ import { fileURLToPath } from 'node:url'
6
+
7
+ export default defineConfig({
8
+ // An alias rather than `resolve.tsconfigPaths`, which applies only to files the nearest
9
+ // tsconfig claims: the project's shells in `templates/asas/src` import `@/` too.
10
+ // `^@/` and not `@`, so `@tanstack/*` is left alone.
11
+ resolve: { alias: [{ find: /^@\//, replacement: fileURLToPath(new URL('./src/', import.meta.url)) }] },
12
+ plugins: [
13
+ tailwindcss(),
14
+ // `mithaq generate screens` writes `types.ts` and `files.ts` beside the route files, and neither is a route.
15
+ tanstackStart({ router: { routeFileIgnorePattern: '^(files|types)\\.ts$' } }),
16
+ viteReact(),
17
+ ],
18
+ environments: {
19
+ ssr: {
20
+ // `asas` and `mithaq` stay external: the drizzle adapter imports `drizzle-kit/api-postgres`
21
+ // behind a `webpackIgnore` comment Vite does not honour, and bundled, the build fails on
22
+ // drizzle's optional peers. The dev server reads `resolve.external`, the build reads
23
+ // `build.rollupOptions.external`, so both are set.
24
+ resolve: { external: ['asas', 'mithaq'] },
25
+ build: { rollupOptions: { external: [/^asas$/, /^mithaq(\/|$)/] } },
26
+ },
27
+ },
28
+ })
@@ -0,0 +1,16 @@
1
+ {
2
+ "private": true,
3
+ "type": "module",
4
+ "packageManager": "bun@1.3.14",
5
+ "engines": {
6
+ "node": ">=24"
7
+ },
8
+ "workspaces": [
9
+ "templates/*",
10
+ "apps/*"
11
+ ],
12
+ "devDependencies": {
13
+ "typescript": "^7.0.2",
14
+ "@types/node": "^24.12.3"
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ # The settings a development machine runs with (`README.md` "Environment").
2
+ # create-mithaq writes a copy as `.env` here, in `apps/asas-tanstack` and in
3
+ # `apps/asas-platform`, with the same fresh secrets in each. `bun <file>` (and
4
+ # so `bun run seed`), `bun -e` and the apps' Vite read it; the `mithaq` bin,
5
+ # which runs under Node, does not. A variable the shell already sets wins.
6
+ DATABASE_URL=postgres://postgres:postgres@localhost:5432/mithaq
7
+ # 32 characters at least. Unset, every POST under /api/auth/local answers 503.
8
+ LOCAL_AUTH_SECRET=
9
+ BETTER_AUTH_SECRET=
10
+ BETTER_AUTH_URL=http://localhost:5173
11
+ PLATFORM_URL=http://localhost:5174
12
+ # Required in production; development defaults them, the secret to a new
13
+ # random one on every start.
14
+ # STORAGE_SECRET=
15
+ # STORAGE_PREFIX=mithaq/asas
16
+ # STORAGE_ADAPTER=local
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "base-maia",
4
+ "rsc": false,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "",
8
+ "css": "",
9
+ "baseColor": "stone",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "iconLibrary": "hugeicons",
14
+ "rtl": true,
15
+ "aliases": {
16
+ "components": "@/components",
17
+ "utils": "@/lib/utils",
18
+ "ui": "@/components/ui",
19
+ "lib": "@/lib",
20
+ "hooks": "@/hooks"
21
+ }
22
+ }
@@ -0,0 +1,25 @@
1
+ [
2
+ { "type": "rename", "kind": "column", "from": ["public", "tags", "name"], "to": ["public", "tags", "name_en"] },
3
+ { "type": "create", "kind": "column", "entity": ["public", "tags", "name_ar"] },
4
+ { "type": "rename", "kind": "index", "from": ["public", "tags", "tags_name_index"], "to": ["public", "tags", "tags_name_en_index"] },
5
+ { "type": "create", "kind": "index", "entity": ["public", "tags", "tags_name_ar_index"] },
6
+ { "type": "rename", "kind": "column", "from": ["public", "audit_log", "tenant_id"], "to": ["public", "audit_log", "organization_id"] },
7
+ { "type": "rename", "kind": "column", "from": ["public", "courses", "tenant_id"], "to": ["public", "courses", "organization_id"] },
8
+ { "type": "rename", "kind": "column", "from": ["public", "enrollments", "tenant_id"], "to": ["public", "enrollments", "organization_id"] },
9
+ { "type": "rename", "kind": "column", "from": ["public", "media", "tenant_id"], "to": ["public", "media", "organization_id"] },
10
+ { "type": "rename", "kind": "column", "from": ["public", "member_roles", "tenant_id"], "to": ["public", "member_roles", "organization_id"] },
11
+ { "type": "rename", "kind": "column", "from": ["public", "roles", "tenant_id"], "to": ["public", "roles", "organization_id"] },
12
+ { "type": "rename", "kind": "column", "from": ["public", "course_sessions", "tenant_id"], "to": ["public", "course_sessions", "organization_id"] },
13
+ { "type": "rename", "kind": "column", "from": ["public", "settings", "tenant_id"], "to": ["public", "settings", "organization_id"] },
14
+ { "type": "rename", "kind": "column", "from": ["public", "tags", "tenant_id"], "to": ["public", "tags", "organization_id"] },
15
+ { "type": "rename", "kind": "unique", "from": ["public", "settings", "settings_tenant_id_key"], "to": ["public", "settings", "settings_organization_id_key"] },
16
+ { "type": "rename", "kind": "foreign key", "from": ["public", "audit_log", "audit_log_tenant_id_organization_id_fkey"], "to": ["public", "audit_log", "audit_log_organization_id_organization_id_fkey"] },
17
+ { "type": "rename", "kind": "foreign key", "from": ["public", "courses", "courses_tenant_id_organization_id_fkey"], "to": ["public", "courses", "courses_organization_id_organization_id_fkey"] },
18
+ { "type": "rename", "kind": "foreign key", "from": ["public", "enrollments", "enrollments_tenant_id_organization_id_fkey"], "to": ["public", "enrollments", "enrollments_organization_id_organization_id_fkey"] },
19
+ { "type": "rename", "kind": "foreign key", "from": ["public", "media", "media_tenant_id_organization_id_fkey"], "to": ["public", "media", "media_organization_id_organization_id_fkey"] },
20
+ { "type": "rename", "kind": "foreign key", "from": ["public", "member_roles", "member_roles_tenant_id_organization_id_fkey"], "to": ["public", "member_roles", "member_roles_organization_id_organization_id_fkey"] },
21
+ { "type": "rename", "kind": "foreign key", "from": ["public", "roles", "roles_tenant_id_organization_id_fkey"], "to": ["public", "roles", "roles_organization_id_organization_id_fkey"] },
22
+ { "type": "rename", "kind": "foreign key", "from": ["public", "course_sessions", "course_sessions_tenant_id_organization_id_fkey"], "to": ["public", "course_sessions", "course_sessions_organization_id_organization_id_fkey"] },
23
+ { "type": "rename", "kind": "foreign key", "from": ["public", "settings", "settings_tenant_id_organization_id_fkey"], "to": ["public", "settings", "settings_organization_id_organization_id_fkey"] },
24
+ { "type": "rename", "kind": "foreign key", "from": ["public", "tags", "tags_tenant_id_organization_id_fkey"], "to": ["public", "tags", "tags_organization_id_organization_id_fkey"] }
25
+ ]
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "asas",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "seed": "bun src/seed.ts"
8
+ },
9
+ "exports": {
10
+ ".": "./src/asas.ts",
11
+ "./ui-dashboard/*": "./src/ui-dashboard/*",
12
+ "./audit-log/*": "./src/audit-log/*",
13
+ "./messages/*": "./src/messages/*",
14
+ "./package.json": "./package.json"
15
+ },
16
+ "dependencies": {
17
+ "@asas/auth": "*",
18
+ "@orpc/openapi": "1.15.1",
19
+ "@orpc/server": "1.15.1",
20
+ "aws4fetch": "1.0.20",
21
+ "better-auth": "1.7.4",
22
+ "drizzle-orm": "1.0.0-rc.4",
23
+ "file-type": "22.0.1",
24
+ "image-dimensions": "2.5.1",
25
+ "jose": "6.2.12",
26
+ "mithaq": "*",
27
+ "zod": "^4.6.5"
28
+ },
29
+ "devDependencies": {
30
+ "@tanstack/react-query": "^5.104.0",
31
+ "@types/pg": "^8.15.6",
32
+ "@types/react": "^19.3.0",
33
+ "lucide-react": "^1.16.0",
34
+ "mithaq-admin": "*",
35
+ "react": "^19.3.0",
36
+ "recharts": "3.8.0"
37
+ }
38
+ }
@@ -0,0 +1,93 @@
1
+ import { providerStatements } from '@asas/auth'
2
+ // Written by `mithaq generate auth`: one key per plugin the vocabulary names,
3
+ // and `core` for the four Better Auth ships without one. Spreading the keys is
4
+ // what keeps this list from naming eight files, and a project that drops the
5
+ // organization plugin drops one spread.
6
+ import { betterAuth } from './kayan/auth/user/index.ts'
7
+ import { user } from './kayan/auth/user/user.ts'
8
+ import { auditLog } from './audit-log/audit-log.ts'
9
+ import { courses } from './courses/courses.ts'
10
+ import { enrollments } from './enrollments/enrollments.ts'
11
+ import { localUsers } from './local-users/local-users.ts'
12
+ import { memberRoles } from './member-roles/member-roles.ts'
13
+ import { roles } from './roles/roles.ts'
14
+ import { sessions } from './sessions/sessions.ts'
15
+ import { tags } from './tags/tags.ts'
16
+ import { settings } from './settings/settings.ts'
17
+ import { media } from './media/media.ts'
18
+ import { fetchHttp, Notice } from 'mithaq'
19
+ import { orpcHttp } from 'mithaq/orpc'
20
+ import { buildAsas, requestContext } from './mithaq.ts'
21
+ import { platformHttp } from './platform-http.ts'
22
+ import { projectStatements } from './statements.ts'
23
+ import { superAdmin } from './tenant-access.ts'
24
+
25
+ export const asas = buildAsas({
26
+ kayan: [
27
+ ...betterAuth.core,
28
+ ...betterAuth.organization,
29
+ localUsers,
30
+ roles,
31
+ memberRoles,
32
+ tags,
33
+ media,
34
+ courses,
35
+ sessions,
36
+ enrollments,
37
+ auditLog,
38
+ ],
39
+ global: [settings],
40
+ // The HTTP layer, a list the handler asks in order. `orpcHttp()` is first
41
+ // because it owns `/api/rpc`, where a typed client would reach the build, and
42
+ // because `asas.router` is the first plug's. It also claims `/api`, so the
43
+ // plain plug behind it answers only what oRPC's own OpenAPI arm matched
44
+ // nothing for; it is listed so a build that drops the typed client keeps plain
45
+ // HTTP by deleting one line. Core picks no plug of its own, so a build that
46
+ // leaves `http` out is refused.
47
+ // Each plug is handed the same context function, so a step reads the same
48
+ // bag whichever plug served it.
49
+ // The platform's rename of an organization sits between them, before the
50
+ // plain plug would read `/api/platform/*` as a kayan's route.
51
+ // A fault either plug answers 500 is written to this project's log, the
52
+ // console, as `fetchHttp`'s default does; the oRPC plug takes no default.
53
+ http: [
54
+ orpcHttp({ context: (request, actor) => ({ actor, ...requestContext(request) }), onError: (error) => console.error(error) }),
55
+ platformHttp(),
56
+ fetchHttp({ context: requestContext }),
57
+ ],
58
+ // Better Auth's own actions, which no declaration of this project derives.
59
+ // They join the catalog under the resources they name, so a role holds
60
+ // `invitation.cancel` or `user.impersonate` exactly as it holds
61
+ // `courses.find`, and the hooks in @asas/auth ask for them under whichever
62
+ // store this project turned on. `organization.rename` is this project's own,
63
+ // the key the platform's rename route asks, which is neither the
64
+ // provider's `organization.update` nor the managed kayan's, both of which
65
+ // share that name. The project's own keys beside a kayan's operations are
66
+ // listed with the role form that offers them.
67
+ statements: { ...providerStatements, organization: [...providerStatements.organization, 'rename'], ...projectStatements },
68
+ // `onError` hears a strategy that threw and an access target that could not
69
+ // answer, which the build reports nowhere of its own. The console is this
70
+ // project's log; a project with an error tracker names it here. A `Notice`
71
+ // is expected, such as the build of a local auth kayan with no mailer, and
72
+ // prints as its one line; anything else prints with its stack.
73
+ //
74
+ // `admin.access` is the answer `/api/access` reports as `canAccessAdmin`:
75
+ // `true` for a super admin in the platform app, `false` for every other
76
+ // actor. The local `unlock` endpoint asks the same answer of the caller local
77
+ // auth alone resolves, which is never a Better Auth super admin, so it stays
78
+ // closed.
79
+ //
80
+ // The administrator is a super admin in the platform app and nobody else: the
81
+ // one who verifies a local sign-up. A kayan with no callback of its own falls
82
+ // to this answer, so every table Better Auth alone writes closes itself.
83
+ auth: { admin: { kayan: user, access: superAdmin }, onError: (error) => console.error(error instanceof Notice ? error.message : error) },
84
+ })
85
+
86
+ // The platform slug, the screen the platform app serves, the reader that
87
+ // answers the platform roles, and the tenant app's link to the platform, for a
88
+ // host.
89
+ export { PLATFORM, PLATFORM_SCREEN, assignedRoles, platformEntry } from './tenant-access.ts'
90
+ // What the platform app wraps every request it serves in, whether a request is
91
+ // one of those, and where each app is served: re-exported here so a host reaches
92
+ // the one instance of the store behind it through the same module the build reads.
93
+ export { asPlatform, onPlatform, platformURL, tenantURL } from '@asas/auth'