@coursebuilder/adapter-drizzle 0.5.2 → 1.0.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 (287) hide show
  1. package/dist/{chunk-QQA7STVO.js → chunk-3GONHHMY.js} +2 -2
  2. package/dist/{chunk-2UU2F4DM.js → chunk-6MRFUIH5.js} +6 -2
  3. package/dist/{chunk-XIGJFVUM.js → chunk-6YPHJWS2.js} +9 -2
  4. package/dist/{chunk-3NUCFLQJ.js → chunk-BLDW3QUS.js} +7 -3
  5. package/dist/{chunk-QP6YMUQX.js → chunk-DKJO4Y3K.js} +7 -3
  6. package/dist/{chunk-P4VXXTVA.js → chunk-EHRARBRS.js} +4 -1
  7. package/dist/{chunk-YVVXDJHI.js → chunk-ET3QAIY7.js} +9 -2
  8. package/dist/{chunk-27UC2HEP.js → chunk-FPAQINSA.js} +7 -3
  9. package/dist/{chunk-XJXCDN7B.js → chunk-HWIQUI7O.js} +8 -4
  10. package/dist/{chunk-4ZWS76VQ.js → chunk-KPBVZ44W.js} +7 -3
  11. package/dist/chunk-LPJ2P2KJ.js +2122 -0
  12. package/dist/{chunk-6ON2O6UD.js → chunk-MGZMGDQ5.js} +7 -3
  13. package/dist/{chunk-ZYQYJNLK.js → chunk-MOV5TUON.js} +409 -127
  14. package/dist/{chunk-KDEWFXEP.js → chunk-MP4CUWYC.js} +6 -2
  15. package/dist/{chunk-YMFPIZMO.js → chunk-OBUGOZKM.js} +2 -2
  16. package/dist/{chunk-EFVZ7IN4.js → chunk-PBTEHA7F.js} +2 -2
  17. package/dist/{chunk-GINRTL6J.js → chunk-WJWJ6E5Y.js} +6 -2
  18. package/dist/{chunk-YGRYHMCG.js → chunk-WPJZAYX7.js} +7 -3
  19. package/dist/{chunk-6SLQW6OM.js → chunk-YQNIXCD3.js} +5 -2
  20. package/dist/index.js +19 -20
  21. package/dist/lib/mysql/index.cjs +1889 -994
  22. package/dist/lib/mysql/index.cjs.map +1 -1
  23. package/dist/lib/mysql/index.d.cts +4641 -1889
  24. package/dist/lib/mysql/index.d.ts +4641 -1889
  25. package/dist/lib/mysql/index.js +19 -20
  26. package/dist/lib/mysql/schemas/auth/accounts.cjs +121 -97
  27. package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
  28. package/dist/lib/mysql/schemas/auth/accounts.js +10 -11
  29. package/dist/lib/mysql/schemas/auth/device-access-token.cjs +116 -89
  30. package/dist/lib/mysql/schemas/auth/device-access-token.cjs.map +1 -1
  31. package/dist/lib/mysql/schemas/auth/device-access-token.d.cts +16 -0
  32. package/dist/lib/mysql/schemas/auth/device-access-token.d.ts +16 -0
  33. package/dist/lib/mysql/schemas/auth/device-access-token.js +11 -12
  34. package/dist/lib/mysql/schemas/auth/device-verification.cjs +115 -91
  35. package/dist/lib/mysql/schemas/auth/device-verification.cjs.map +1 -1
  36. package/dist/lib/mysql/schemas/auth/device-verification.js +11 -12
  37. package/dist/lib/mysql/schemas/auth/profiles.cjs +254 -0
  38. package/dist/lib/mysql/schemas/auth/profiles.cjs.map +1 -0
  39. package/dist/lib/mysql/schemas/auth/profiles.d.cts +112 -0
  40. package/dist/lib/mysql/schemas/auth/profiles.d.ts +112 -0
  41. package/dist/lib/mysql/schemas/auth/profiles.js +20 -0
  42. package/dist/lib/mysql/schemas/auth/profiles.js.map +1 -0
  43. package/dist/lib/mysql/schemas/auth/role-permissions.cjs +112 -83
  44. package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
  45. package/dist/lib/mysql/schemas/auth/role-permissions.js +11 -12
  46. package/dist/lib/mysql/schemas/auth/roles.cjs +116 -83
  47. package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
  48. package/dist/lib/mysql/schemas/auth/roles.d.cts +16 -0
  49. package/dist/lib/mysql/schemas/auth/roles.d.ts +16 -0
  50. package/dist/lib/mysql/schemas/auth/roles.js +10 -11
  51. package/dist/lib/mysql/schemas/auth/sessions.cjs +111 -87
  52. package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
  53. package/dist/lib/mysql/schemas/auth/sessions.js +11 -12
  54. package/dist/lib/mysql/schemas/auth/user-permissions.cjs +116 -88
  55. package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
  56. package/dist/lib/mysql/schemas/auth/user-permissions.d.cts +16 -0
  57. package/dist/lib/mysql/schemas/auth/user-permissions.d.ts +16 -0
  58. package/dist/lib/mysql/schemas/auth/user-permissions.js +10 -11
  59. package/dist/lib/mysql/schemas/auth/user-prefs.cjs +120 -92
  60. package/dist/lib/mysql/schemas/auth/user-prefs.cjs.map +1 -1
  61. package/dist/lib/mysql/schemas/auth/user-prefs.d.cts +16 -0
  62. package/dist/lib/mysql/schemas/auth/user-prefs.d.ts +16 -0
  63. package/dist/lib/mysql/schemas/auth/user-prefs.js +10 -11
  64. package/dist/lib/mysql/schemas/auth/user-roles.cjs +119 -86
  65. package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
  66. package/dist/lib/mysql/schemas/auth/user-roles.d.cts +16 -0
  67. package/dist/lib/mysql/schemas/auth/user-roles.d.ts +16 -0
  68. package/dist/lib/mysql/schemas/auth/user-roles.js +10 -11
  69. package/dist/lib/mysql/schemas/auth/users.cjs +355 -223
  70. package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
  71. package/dist/lib/mysql/schemas/auth/users.d.cts +2 -0
  72. package/dist/lib/mysql/schemas/auth/users.d.ts +2 -0
  73. package/dist/lib/mysql/schemas/auth/users.js +10 -11
  74. package/dist/lib/mysql/schemas/commerce/coupon.cjs +155 -111
  75. package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
  76. package/dist/lib/mysql/schemas/commerce/coupon.d.cts +16 -0
  77. package/dist/lib/mysql/schemas/commerce/coupon.d.ts +16 -0
  78. package/dist/lib/mysql/schemas/commerce/coupon.js +10 -11
  79. package/dist/lib/mysql/schemas/commerce/merchant-account.cjs +5 -1
  80. package/dist/lib/mysql/schemas/commerce/merchant-account.cjs.map +1 -1
  81. package/dist/lib/mysql/schemas/commerce/merchant-account.d.cts +16 -0
  82. package/dist/lib/mysql/schemas/commerce/merchant-account.d.ts +16 -0
  83. package/dist/lib/mysql/schemas/commerce/merchant-account.js +1 -1
  84. package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs +218 -17
  85. package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs.map +1 -1
  86. package/dist/lib/mysql/schemas/commerce/merchant-charge.d.cts +33 -0
  87. package/dist/lib/mysql/schemas/commerce/merchant-charge.d.ts +33 -0
  88. package/dist/lib/mysql/schemas/commerce/merchant-charge.js +11 -4
  89. package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs +5 -1
  90. package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs.map +1 -1
  91. package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.cts +16 -0
  92. package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.ts +16 -0
  93. package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +1 -1
  94. package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs +5 -1
  95. package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs.map +1 -1
  96. package/dist/lib/mysql/schemas/commerce/merchant-customer.d.cts +16 -0
  97. package/dist/lib/mysql/schemas/commerce/merchant-customer.d.ts +16 -0
  98. package/dist/lib/mysql/schemas/commerce/merchant-customer.js +1 -1
  99. package/dist/lib/mysql/schemas/commerce/merchant-price.cjs +5 -1
  100. package/dist/lib/mysql/schemas/commerce/merchant-price.cjs.map +1 -1
  101. package/dist/lib/mysql/schemas/commerce/merchant-price.d.cts +16 -0
  102. package/dist/lib/mysql/schemas/commerce/merchant-price.d.ts +16 -0
  103. package/dist/lib/mysql/schemas/commerce/merchant-price.js +1 -1
  104. package/dist/lib/mysql/schemas/commerce/merchant-product.cjs +5 -1
  105. package/dist/lib/mysql/schemas/commerce/merchant-product.cjs.map +1 -1
  106. package/dist/lib/mysql/schemas/commerce/merchant-product.d.cts +16 -0
  107. package/dist/lib/mysql/schemas/commerce/merchant-product.d.ts +16 -0
  108. package/dist/lib/mysql/schemas/commerce/merchant-product.js +1 -1
  109. package/dist/lib/mysql/schemas/commerce/merchant-session.cjs +5 -1
  110. package/dist/lib/mysql/schemas/commerce/merchant-session.cjs.map +1 -1
  111. package/dist/lib/mysql/schemas/commerce/merchant-session.d.cts +16 -0
  112. package/dist/lib/mysql/schemas/commerce/merchant-session.d.ts +16 -0
  113. package/dist/lib/mysql/schemas/commerce/merchant-session.js +1 -1
  114. package/dist/lib/mysql/schemas/commerce/merchant-subscription.cjs +323 -0
  115. package/dist/lib/mysql/schemas/commerce/merchant-subscription.cjs.map +1 -0
  116. package/dist/lib/mysql/schemas/commerce/merchant-subscription.d.cts +161 -0
  117. package/dist/lib/mysql/schemas/commerce/merchant-subscription.d.ts +161 -0
  118. package/dist/lib/mysql/schemas/commerce/merchant-subscription.js +20 -0
  119. package/dist/lib/mysql/schemas/commerce/merchant-subscription.js.map +1 -0
  120. package/dist/lib/mysql/schemas/commerce/price.cjs +115 -79
  121. package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
  122. package/dist/lib/mysql/schemas/commerce/price.d.cts +16 -0
  123. package/dist/lib/mysql/schemas/commerce/price.d.ts +16 -0
  124. package/dist/lib/mysql/schemas/commerce/price.js +10 -11
  125. package/dist/lib/mysql/schemas/commerce/product.cjs +134 -94
  126. package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
  127. package/dist/lib/mysql/schemas/commerce/product.d.cts +16 -0
  128. package/dist/lib/mysql/schemas/commerce/product.d.ts +16 -0
  129. package/dist/lib/mysql/schemas/commerce/product.js +10 -11
  130. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +153 -117
  131. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
  132. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.cts +16 -0
  133. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.ts +16 -0
  134. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +11 -12
  135. package/dist/lib/mysql/schemas/commerce/purchase.cjs +307 -181
  136. package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
  137. package/dist/lib/mysql/schemas/commerce/purchase.d.cts +34 -0
  138. package/dist/lib/mysql/schemas/commerce/purchase.d.ts +34 -0
  139. package/dist/lib/mysql/schemas/commerce/purchase.js +10 -11
  140. package/dist/lib/mysql/schemas/commerce/subscription.cjs +351 -0
  141. package/dist/lib/mysql/schemas/commerce/subscription.cjs.map +1 -0
  142. package/dist/lib/mysql/schemas/commerce/subscription.d.cts +130 -0
  143. package/dist/lib/mysql/schemas/commerce/subscription.d.ts +130 -0
  144. package/dist/lib/mysql/schemas/commerce/subscription.js +20 -0
  145. package/dist/lib/mysql/schemas/commerce/subscription.js.map +1 -0
  146. package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs +116 -84
  147. package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs.map +1 -1
  148. package/dist/lib/mysql/schemas/commerce/upgradable-products.d.cts +16 -0
  149. package/dist/lib/mysql/schemas/commerce/upgradable-products.d.ts +16 -0
  150. package/dist/lib/mysql/schemas/commerce/upgradable-products.js +11 -12
  151. package/dist/lib/mysql/schemas/communication/comment.cjs +161 -92
  152. package/dist/lib/mysql/schemas/communication/comment.cjs.map +1 -1
  153. package/dist/lib/mysql/schemas/communication/comment.d.cts +17 -0
  154. package/dist/lib/mysql/schemas/communication/comment.d.ts +17 -0
  155. package/dist/lib/mysql/schemas/communication/comment.js +10 -11
  156. package/dist/lib/mysql/schemas/communication/communication-channel.cjs +5 -1
  157. package/dist/lib/mysql/schemas/communication/communication-channel.cjs.map +1 -1
  158. package/dist/lib/mysql/schemas/communication/communication-channel.d.cts +16 -0
  159. package/dist/lib/mysql/schemas/communication/communication-channel.d.ts +16 -0
  160. package/dist/lib/mysql/schemas/communication/communication-channel.js +1 -1
  161. package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs +3 -0
  162. package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs.map +1 -1
  163. package/dist/lib/mysql/schemas/communication/communication-preference-types.d.cts +16 -0
  164. package/dist/lib/mysql/schemas/communication/communication-preference-types.d.ts +16 -0
  165. package/dist/lib/mysql/schemas/communication/communication-preference-types.js +1 -1
  166. package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +189 -110
  167. package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
  168. package/dist/lib/mysql/schemas/communication/communication-preferences.d.cts +33 -0
  169. package/dist/lib/mysql/schemas/communication/communication-preferences.d.ts +33 -0
  170. package/dist/lib/mysql/schemas/communication/communication-preferences.js +10 -11
  171. package/dist/lib/mysql/schemas/content/content-contributions.cjs +199 -116
  172. package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
  173. package/dist/lib/mysql/schemas/content/content-contributions.d.cts +33 -0
  174. package/dist/lib/mysql/schemas/content/content-contributions.d.ts +33 -0
  175. package/dist/lib/mysql/schemas/content/content-contributions.js +10 -11
  176. package/dist/lib/mysql/schemas/content/content-resource-product.cjs +118 -79
  177. package/dist/lib/mysql/schemas/content/content-resource-product.cjs.map +1 -1
  178. package/dist/lib/mysql/schemas/content/content-resource-product.d.cts +16 -0
  179. package/dist/lib/mysql/schemas/content/content-resource-product.d.ts +16 -0
  180. package/dist/lib/mysql/schemas/content/content-resource-product.js +10 -11
  181. package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +128 -93
  182. package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
  183. package/dist/lib/mysql/schemas/content/content-resource-resource.d.cts +16 -0
  184. package/dist/lib/mysql/schemas/content/content-resource-resource.d.ts +16 -0
  185. package/dist/lib/mysql/schemas/content/content-resource-resource.js +10 -11
  186. package/dist/lib/mysql/schemas/content/content-resource-tag.cjs +140 -101
  187. package/dist/lib/mysql/schemas/content/content-resource-tag.cjs.map +1 -1
  188. package/dist/lib/mysql/schemas/content/content-resource-tag.d.cts +16 -0
  189. package/dist/lib/mysql/schemas/content/content-resource-tag.d.ts +16 -0
  190. package/dist/lib/mysql/schemas/content/content-resource-tag.js +10 -11
  191. package/dist/lib/mysql/schemas/content/content-resource-version.cjs +142 -107
  192. package/dist/lib/mysql/schemas/content/content-resource-version.cjs.map +1 -1
  193. package/dist/lib/mysql/schemas/content/content-resource-version.d.cts +16 -0
  194. package/dist/lib/mysql/schemas/content/content-resource-version.d.ts +16 -0
  195. package/dist/lib/mysql/schemas/content/content-resource-version.js +10 -11
  196. package/dist/lib/mysql/schemas/content/content-resource.cjs +260 -161
  197. package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
  198. package/dist/lib/mysql/schemas/content/content-resource.d.cts +33 -0
  199. package/dist/lib/mysql/schemas/content/content-resource.d.ts +33 -0
  200. package/dist/lib/mysql/schemas/content/content-resource.js +10 -11
  201. package/dist/lib/mysql/schemas/content/contribution-types.cjs +5 -1
  202. package/dist/lib/mysql/schemas/content/contribution-types.cjs.map +1 -1
  203. package/dist/lib/mysql/schemas/content/contribution-types.d.cts +16 -0
  204. package/dist/lib/mysql/schemas/content/contribution-types.d.ts +16 -0
  205. package/dist/lib/mysql/schemas/content/contribution-types.js +1 -1
  206. package/dist/lib/mysql/schemas/content/lesson-progress.cjs +8 -1
  207. package/dist/lib/mysql/schemas/content/lesson-progress.cjs.map +1 -1
  208. package/dist/lib/mysql/schemas/content/lesson-progress.d.cts +32 -0
  209. package/dist/lib/mysql/schemas/content/lesson-progress.d.ts +32 -0
  210. package/dist/lib/mysql/schemas/content/lesson-progress.js +1 -1
  211. package/dist/lib/mysql/schemas/content/resource-progress.cjs +8 -1
  212. package/dist/lib/mysql/schemas/content/resource-progress.cjs.map +1 -1
  213. package/dist/lib/mysql/schemas/content/resource-progress.d.cts +32 -0
  214. package/dist/lib/mysql/schemas/content/resource-progress.d.ts +32 -0
  215. package/dist/lib/mysql/schemas/content/resource-progress.js +1 -1
  216. package/dist/lib/mysql/schemas/content/tag-tag.cjs +121 -89
  217. package/dist/lib/mysql/schemas/content/tag-tag.cjs.map +1 -1
  218. package/dist/lib/mysql/schemas/content/tag-tag.d.cts +16 -0
  219. package/dist/lib/mysql/schemas/content/tag-tag.d.ts +16 -0
  220. package/dist/lib/mysql/schemas/content/tag-tag.js +10 -11
  221. package/dist/lib/mysql/schemas/content/tag.cjs +136 -100
  222. package/dist/lib/mysql/schemas/content/tag.cjs.map +1 -1
  223. package/dist/lib/mysql/schemas/content/tag.d.cts +16 -0
  224. package/dist/lib/mysql/schemas/content/tag.d.ts +16 -0
  225. package/dist/lib/mysql/schemas/content/tag.js +10 -11
  226. package/dist/lib/mysql/schemas/org/organization-membership-roles.cjs +339 -0
  227. package/dist/lib/mysql/schemas/org/organization-membership-roles.cjs.map +1 -0
  228. package/dist/lib/mysql/schemas/org/organization-membership-roles.d.cts +130 -0
  229. package/dist/lib/mysql/schemas/org/organization-membership-roles.d.ts +130 -0
  230. package/dist/lib/mysql/schemas/org/organization-membership-roles.js +20 -0
  231. package/dist/lib/mysql/schemas/org/organization-membership-roles.js.map +1 -0
  232. package/dist/lib/mysql/schemas/org/organization-memberships.cjs +420 -0
  233. package/dist/lib/mysql/schemas/org/organization-memberships.cjs.map +1 -0
  234. package/dist/lib/mysql/schemas/org/organization-memberships.d.cts +132 -0
  235. package/dist/lib/mysql/schemas/org/organization-memberships.d.ts +132 -0
  236. package/dist/lib/mysql/schemas/org/organization-memberships.js +20 -0
  237. package/dist/lib/mysql/schemas/org/organization-memberships.js.map +1 -0
  238. package/dist/lib/mysql/schemas/org/organizations.cjs +359 -0
  239. package/dist/lib/mysql/schemas/org/organizations.cjs.map +1 -0
  240. package/dist/lib/mysql/schemas/org/organizations.d.cts +98 -0
  241. package/dist/lib/mysql/schemas/org/organizations.d.ts +98 -0
  242. package/dist/lib/mysql/schemas/org/organizations.js +20 -0
  243. package/dist/lib/mysql/schemas/org/organizations.js.map +1 -0
  244. package/package.json +4 -3
  245. package/src/lib/mysql/index.ts +354 -26
  246. package/src/lib/mysql/schemas/auth/device-access-token.ts +3 -0
  247. package/src/lib/mysql/schemas/auth/profiles.ts +50 -0
  248. package/src/lib/mysql/schemas/auth/roles.ts +9 -1
  249. package/src/lib/mysql/schemas/auth/user-permissions.ts +2 -0
  250. package/src/lib/mysql/schemas/auth/user-prefs.ts +2 -0
  251. package/src/lib/mysql/schemas/auth/user-roles.ts +2 -0
  252. package/src/lib/mysql/schemas/auth/users.ts +11 -1
  253. package/src/lib/mysql/schemas/commerce/coupon.ts +2 -0
  254. package/src/lib/mysql/schemas/commerce/merchant-account.ts +3 -0
  255. package/src/lib/mysql/schemas/commerce/merchant-charge.ts +16 -0
  256. package/src/lib/mysql/schemas/commerce/merchant-coupon.ts +3 -0
  257. package/src/lib/mysql/schemas/commerce/merchant-customer.ts +2 -0
  258. package/src/lib/mysql/schemas/commerce/merchant-price.ts +3 -0
  259. package/src/lib/mysql/schemas/commerce/merchant-product.ts +3 -0
  260. package/src/lib/mysql/schemas/commerce/merchant-session.ts +8 -1
  261. package/src/lib/mysql/schemas/commerce/merchant-subscription.ts +64 -0
  262. package/src/lib/mysql/schemas/commerce/price.ts +3 -0
  263. package/src/lib/mysql/schemas/commerce/product.ts +3 -0
  264. package/src/lib/mysql/schemas/commerce/purchase-user-transfer.ts +3 -0
  265. package/src/lib/mysql/schemas/commerce/purchase.ts +22 -0
  266. package/src/lib/mysql/schemas/commerce/subscription.ts +69 -0
  267. package/src/lib/mysql/schemas/commerce/upgradable-products.ts +2 -0
  268. package/src/lib/mysql/schemas/communication/comment.ts +13 -0
  269. package/src/lib/mysql/schemas/communication/communication-channel.ts +2 -0
  270. package/src/lib/mysql/schemas/communication/communication-preference-types.ts +1 -0
  271. package/src/lib/mysql/schemas/communication/communication-preferences.ts +14 -0
  272. package/src/lib/mysql/schemas/content/content-contributions.ts +14 -0
  273. package/src/lib/mysql/schemas/content/content-resource-product.ts +2 -0
  274. package/src/lib/mysql/schemas/content/content-resource-resource.ts +2 -0
  275. package/src/lib/mysql/schemas/content/content-resource-tag.ts +2 -0
  276. package/src/lib/mysql/schemas/content/content-resource-version.ts +2 -0
  277. package/src/lib/mysql/schemas/content/content-resource.ts +17 -0
  278. package/src/lib/mysql/schemas/content/contribution-types.ts +2 -0
  279. package/src/lib/mysql/schemas/content/lesson-progress.ts +7 -0
  280. package/src/lib/mysql/schemas/content/resource-progress.ts +7 -0
  281. package/src/lib/mysql/schemas/content/tag-tag.ts +2 -0
  282. package/src/lib/mysql/schemas/content/tag.ts +2 -0
  283. package/src/lib/mysql/schemas/org/organization-membership-roles.ts +75 -0
  284. package/src/lib/mysql/schemas/org/organization-memberships.ts +75 -0
  285. package/src/lib/mysql/schemas/org/organizations.ts +50 -0
  286. package/dist/chunk-JW2PFVLO.js +0 -1468
  287. package/dist/chunk-SRTIWWLG.js +0 -96
@@ -1,36 +1,36 @@
1
1
  import {
2
2
  getLessonProgressSchema
3
- } from "./chunk-YVVXDJHI.js";
3
+ } from "./chunk-ET3QAIY7.js";
4
4
  import {
5
5
  getResourceProgressSchema
6
- } from "./chunk-XIGJFVUM.js";
6
+ } from "./chunk-6YPHJWS2.js";
7
7
  import {
8
8
  getPurchaseUserTransferRelationsSchema,
9
9
  getPurchaseUserTransferSchema
10
- } from "./chunk-XJXCDN7B.js";
10
+ } from "./chunk-HWIQUI7O.js";
11
11
  import {
12
12
  getUpgradableProductsRelationsSchema,
13
13
  getUpgradableProductsSchema
14
- } from "./chunk-27UC2HEP.js";
14
+ } from "./chunk-FPAQINSA.js";
15
+ import {
16
+ getVerificationTokensSchema
17
+ } from "./chunk-LERR6HQ3.js";
15
18
  import {
16
19
  getRolePermissionsRelationsSchema,
17
20
  getRolePermissionsSchema
18
- } from "./chunk-QQA7STVO.js";
21
+ } from "./chunk-3GONHHMY.js";
19
22
  import {
20
23
  getSessionRelationsSchema,
21
24
  getSessionsSchema
22
- } from "./chunk-EFVZ7IN4.js";
23
- import {
24
- getVerificationTokensSchema
25
- } from "./chunk-LERR6HQ3.js";
25
+ } from "./chunk-PBTEHA7F.js";
26
26
  import {
27
27
  getDeviceAccessTokenRelationsSchema,
28
28
  getDeviceAccessTokenSchema
29
- } from "./chunk-6SLQW6OM.js";
29
+ } from "./chunk-YQNIXCD3.js";
30
30
  import {
31
31
  getDeviceVerificationRelationsSchema,
32
32
  getDeviceVerificationSchema
33
- } from "./chunk-YMFPIZMO.js";
33
+ } from "./chunk-OBUGOZKM.js";
34
34
  import {
35
35
  getAccountsRelationsSchema,
36
36
  getAccountsSchema,
@@ -52,13 +52,27 @@ import {
52
52
  getContentResourceVersionSchema,
53
53
  getCouponRelationsSchema,
54
54
  getCouponSchema,
55
+ getMerchantChargeRelationsSchema,
56
+ getMerchantChargeSchema,
57
+ getMerchantSubscriptionRelationsSchema,
58
+ getMerchantSubscriptionSchema,
59
+ getOrganizationMembershipRolesRelationsSchema,
60
+ getOrganizationMembershipRolesSchema,
61
+ getOrganizationMembershipsRelationsSchema,
62
+ getOrganizationMembershipsSchema,
63
+ getOrganizationsRelationsSchema,
64
+ getOrganizationsSchema,
55
65
  getPriceSchema,
56
66
  getProductRelationsSchema2 as getProductRelationsSchema,
57
67
  getProductSchema,
68
+ getProfilesRelationsSchema,
69
+ getProfilesSchema,
58
70
  getPurchaseRelationsSchema,
59
71
  getPurchaseSchema,
60
72
  getRolesRelationsSchema,
61
73
  getRolesSchema,
74
+ getSubscriptionRelationsSchema,
75
+ getSubscriptionSchema,
62
76
  getTagRelationsSchema,
63
77
  getTagSchema,
64
78
  getTagTagRelationsSchema,
@@ -71,39 +85,35 @@ import {
71
85
  getUserRolesSchema,
72
86
  getUsersRelationsSchema,
73
87
  getUsersSchema
74
- } from "./chunk-JW2PFVLO.js";
88
+ } from "./chunk-LPJ2P2KJ.js";
75
89
  import {
76
90
  getContributionTypesRelationsSchema,
77
91
  getContributionTypesSchema
78
- } from "./chunk-KDEWFXEP.js";
92
+ } from "./chunk-MP4CUWYC.js";
79
93
  import {
80
94
  getCommunicationChannelSchema
81
- } from "./chunk-GINRTL6J.js";
95
+ } from "./chunk-WJWJ6E5Y.js";
82
96
  import {
83
97
  getCommunicationPreferenceTypesSchema
84
- } from "./chunk-P4VXXTVA.js";
98
+ } from "./chunk-EHRARBRS.js";
85
99
  import {
86
- getMerchantChargeRelationsSchema,
87
- getMerchantChargeSchema
88
- } from "./chunk-SRTIWWLG.js";
100
+ getMerchantSessionSchema
101
+ } from "./chunk-BLDW3QUS.js";
89
102
  import {
90
103
  getMerchantAccountSchema
91
- } from "./chunk-QP6YMUQX.js";
104
+ } from "./chunk-DKJO4Y3K.js";
92
105
  import {
93
106
  getMerchantCouponSchema
94
- } from "./chunk-YGRYHMCG.js";
107
+ } from "./chunk-WPJZAYX7.js";
95
108
  import {
96
109
  getMerchantCustomerSchema
97
- } from "./chunk-2UU2F4DM.js";
110
+ } from "./chunk-6MRFUIH5.js";
98
111
  import {
99
112
  getMerchantPriceSchema
100
- } from "./chunk-6ON2O6UD.js";
113
+ } from "./chunk-MGZMGDQ5.js";
101
114
  import {
102
115
  getMerchantProductSchema
103
- } from "./chunk-4ZWS76VQ.js";
104
- import {
105
- getMerchantSessionSchema
106
- } from "./chunk-3NUCFLQJ.js";
116
+ } from "./chunk-KPBVZ44W.js";
107
117
  import {
108
118
  getPermissionsRelationsSchema,
109
119
  getPermissionsSchema
@@ -8156,41 +8166,29 @@ var VideoResourceSchema = z2.object({
8156
8166
  ])
8157
8167
  });
8158
8168
 
8159
- // ../core/dist/chunk-CHYUPSYW.js
8160
- var userSchema = z2.object({
8161
- id: z2.string().max(255),
8162
- name: z2.string().max(255).optional().nullable(),
8163
- role: z2.enum([
8164
- "user",
8165
- "admin"
8166
- ]).default("user"),
8167
- email: z2.string().max(255).email(),
8168
- emailVerified: z2.coerce.date().nullable(),
8169
- image: z2.string().max(255).optional().nullable(),
8170
- createdAt: z2.coerce.date().nullable(),
8171
- roles: z2.array(z2.object({
8172
- id: z2.string(),
8173
- name: z2.string(),
8174
- description: z2.string().nullable(),
8175
- active: z2.boolean()
8176
- })).optional().default([])
8177
- });
8178
-
8179
- // ../core/dist/chunk-47RWEDJ6.js
8180
- var priceSchema = z2.object({
8169
+ // ../core/dist/chunk-LMH5A7OR.js
8170
+ var purchaseUserTransferSchema = z2.object({
8181
8171
  id: z2.string().max(191),
8182
- productId: z2.string().max(191).optional().nullable(),
8183
- nickname: z2.string().max(191).optional().nullable(),
8184
- status: z2.number().int().default(0),
8185
- unitAmount: z2.coerce.number().refine((value) => {
8186
- const decimalPlaces = value.toString().split(".")[1]?.length || 0;
8187
- return decimalPlaces <= 2;
8188
- }),
8172
+ transferState: z2.enum([
8173
+ "AVAILABLE",
8174
+ "INITIATED",
8175
+ "VERIFIED",
8176
+ "CANCELED",
8177
+ "EXPIRED",
8178
+ "CONFIRMED",
8179
+ "COMPLETED"
8180
+ ]).default("AVAILABLE"),
8181
+ purchaseId: z2.string().max(191),
8182
+ sourceUserId: z2.string().max(191),
8183
+ targetUserId: z2.string().max(191).optional().nullable(),
8189
8184
  createdAt: z2.date().nullable(),
8190
- fields: z2.record(z2.any()).default({})
8185
+ expiresAt: z2.date().nullable(),
8186
+ canceledAt: z2.date().nullable(),
8187
+ confirmedAt: z2.date().nullable(),
8188
+ completedAt: z2.date().nullable()
8191
8189
  });
8192
8190
 
8193
- // ../core/dist/chunk-6BXXN6IV.js
8191
+ // ../core/dist/chunk-SCKAG5RT.js
8194
8192
  var ContentResourceResourceSchema = z2.object({
8195
8193
  resourceId: z2.string(),
8196
8194
  resourceOfId: z2.string(),
@@ -8210,7 +8208,9 @@ var ContentResourceSchema = z2.object({
8210
8208
  createdAt: z2.coerce.date().nullable(),
8211
8209
  updatedAt: z2.coerce.date().nullable(),
8212
8210
  deletedAt: z2.coerce.date().nullable(),
8213
- resources: z2.array(ContentResourceResourceSchema).default([]).nullable()
8211
+ resources: z2.array(ContentResourceResourceSchema).default([]).nullable(),
8212
+ organizationId: z2.string().nullable(),
8213
+ createdByOrganizationMembershipId: z2.string().nullable()
8214
8214
  });
8215
8215
  var ContentResourceProductSchema = z2.object({
8216
8216
  resourceId: z2.string(),
@@ -8235,14 +8235,93 @@ var ResourceVisibilitySchema = z2.union([
8235
8235
  z2.literal("unlisted")
8236
8236
  ]);
8237
8237
 
8238
- // ../core/dist/chunk-LVVTCZ7P.js
8238
+ // ../core/dist/chunk-PG6VF2O6.js
8239
+ var resourceProgressSchema = z2.object({
8240
+ userId: z2.string().max(191),
8241
+ resourceId: z2.string().max(191).optional().nullable(),
8242
+ completedAt: z2.date().nullable()
8243
+ });
8244
+ var moduleProgressSchema = z2.object({
8245
+ completedLessons: z2.array(resourceProgressSchema),
8246
+ nextResource: ContentResourceSchema.partial().nullable(),
8247
+ percentCompleted: z2.number().default(0),
8248
+ completedLessonsCount: z2.number().default(0),
8249
+ totalLessonsCount: z2.number().default(0)
8250
+ });
8251
+
8252
+ // ../core/dist/chunk-DLQA3JMA.js
8253
+ var upgradableProductSchema = z2.object({
8254
+ upgradableToId: z2.string().max(255),
8255
+ upgradableFromId: z2.string().max(255),
8256
+ position: z2.number().default(0),
8257
+ metadata: z2.record(z2.any()).default({}),
8258
+ createdAt: z2.date().nullable(),
8259
+ updatedAt: z2.date().nullable(),
8260
+ deletedAt: z2.date().nullable()
8261
+ });
8262
+
8263
+ // ../core/dist/chunk-JZBK2DS3.js
8264
+ var userSchema = z2.object({
8265
+ id: z2.string().max(255),
8266
+ name: z2.string().max(255).optional().nullable(),
8267
+ role: z2.enum([
8268
+ "user",
8269
+ "admin"
8270
+ ]).default("user"),
8271
+ email: z2.string().max(255).email(),
8272
+ emailVerified: z2.coerce.date().nullish(),
8273
+ image: z2.string().max(255).optional().nullable(),
8274
+ createdAt: z2.coerce.date().nullish(),
8275
+ memberships: z2.array(z2.object({
8276
+ id: z2.string(),
8277
+ organizationId: z2.string()
8278
+ })).nullish().default([]),
8279
+ roles: z2.array(z2.object({
8280
+ id: z2.string(),
8281
+ name: z2.string(),
8282
+ description: z2.string().nullable(),
8283
+ active: z2.boolean(),
8284
+ createdAt: z2.coerce.date().nullish(),
8285
+ updatedAt: z2.coerce.date().nullish(),
8286
+ deletedAt: z2.coerce.date().nullish()
8287
+ })).optional().default([]),
8288
+ organizationRoles: z2.array(z2.object({
8289
+ id: z2.string(),
8290
+ organizationId: z2.string(),
8291
+ name: z2.string(),
8292
+ description: z2.string().nullable(),
8293
+ active: z2.boolean(),
8294
+ createdAt: z2.coerce.date().nullish(),
8295
+ updatedAt: z2.coerce.date().nullish(),
8296
+ deletedAt: z2.coerce.date().nullish()
8297
+ })).optional().default([])
8298
+ });
8299
+
8300
+ // ../core/dist/chunk-M7IDYIVK.js
8301
+ var priceSchema = z2.object({
8302
+ id: z2.string().max(191),
8303
+ productId: z2.string().max(191).optional().nullable(),
8304
+ organizationId: z2.string().max(191).optional().nullable(),
8305
+ nickname: z2.string().max(191).optional().nullable(),
8306
+ status: z2.number().int().default(0),
8307
+ unitAmount: z2.coerce.number().refine((value) => {
8308
+ const decimalPlaces = value.toString().split(".")[1]?.length || 0;
8309
+ return decimalPlaces <= 2;
8310
+ }),
8311
+ createdAt: z2.date().nullable(),
8312
+ fields: z2.record(z2.any()).default({})
8313
+ });
8314
+
8315
+ // ../core/dist/chunk-3PC5DXPZ.js
8239
8316
  var productSchema = z2.object({
8240
8317
  id: z2.string().max(191),
8318
+ organizationId: z2.string().max(191).optional().nullable(),
8241
8319
  name: z2.string().max(191),
8242
8320
  key: z2.string().max(191).optional().nullable(),
8243
8321
  type: z2.enum([
8244
8322
  "live",
8245
- "self-paced"
8323
+ "self-paced",
8324
+ "membership"
8246
8325
  ]).default("self-paced"),
8247
8326
  fields: z2.object({
8248
8327
  body: z2.string().nullable().optional(),
@@ -8279,7 +8358,7 @@ var NewProductSchema = z2.object({
8279
8358
  price: z2.coerce.number().gte(0).default(0)
8280
8359
  });
8281
8360
 
8282
- // ../core/dist/chunk-RCFZC3SN.js
8361
+ // ../core/dist/chunk-K4MXE7BY.js
8283
8362
  var couponSchema = z2.object({
8284
8363
  id: z2.string(),
8285
8364
  code: z2.string().max(191).optional().nullable(),
@@ -8298,10 +8377,11 @@ var couponSchema = z2.object({
8298
8377
  restrictedToProductId: z2.string().max(191).optional().nullable(),
8299
8378
  bulkPurchases: z2.array(z2.any()).default([]),
8300
8379
  redeemedBulkCouponPurchases: z2.array(z2.any()).default([]),
8301
- bulkPurchaseId: z2.string().max(191).optional().nullable()
8380
+ bulkPurchaseId: z2.string().max(191).optional().nullable(),
8381
+ organizationId: z2.string().max(191).optional().nullable()
8302
8382
  });
8303
8383
 
8304
- // ../core/dist/chunk-ACXDXYNY.js
8384
+ // ../core/dist/chunk-FH7M67MM.js
8305
8385
  var purchaseSchema = z2.object({
8306
8386
  id: z2.string().max(191),
8307
8387
  userId: z2.string().max(191).optional().nullable(),
@@ -8325,54 +8405,21 @@ var purchaseSchema = z2.object({
8325
8405
  fields: z2.record(z2.any()).default({}),
8326
8406
  user: userSchema.optional().nullable(),
8327
8407
  bulkCoupon: couponSchema.optional().nullable(),
8328
- product: productSchema.optional().nullable()
8408
+ product: productSchema.optional().nullable(),
8409
+ purchasedByorganizationMembershipId: z2.string().max(191).optional().nullable(),
8410
+ organizationId: z2.string().max(191).optional().nullable()
8329
8411
  });
8330
8412
 
8331
- // ../core/dist/chunk-LMH5A7OR.js
8332
- var purchaseUserTransferSchema = z2.object({
8413
+ // ../core/dist/chunk-SGE7BCRS.js
8414
+ var merchantChargeSchema = z2.object({
8333
8415
  id: z2.string().max(191),
8334
- transferState: z2.enum([
8335
- "AVAILABLE",
8336
- "INITIATED",
8337
- "VERIFIED",
8338
- "CANCELED",
8339
- "EXPIRED",
8340
- "CONFIRMED",
8341
- "COMPLETED"
8342
- ]).default("AVAILABLE"),
8343
- purchaseId: z2.string().max(191),
8344
- sourceUserId: z2.string().max(191),
8345
- targetUserId: z2.string().max(191).optional().nullable(),
8346
- createdAt: z2.date().nullable(),
8347
- expiresAt: z2.date().nullable(),
8348
- canceledAt: z2.date().nullable(),
8349
- confirmedAt: z2.date().nullable(),
8350
- completedAt: z2.date().nullable()
8351
- });
8352
-
8353
- // ../core/dist/chunk-6BTTEQD2.js
8354
- var resourceProgressSchema = z2.object({
8416
+ status: z2.number().int().default(0),
8417
+ identifier: z2.string().max(191),
8355
8418
  userId: z2.string().max(191),
8356
- resourceId: z2.string().max(191).optional().nullable(),
8357
- completedAt: z2.date().nullable()
8358
- });
8359
- var moduleProgressSchema = z2.object({
8360
- completedLessons: z2.array(resourceProgressSchema),
8361
- nextResource: ContentResourceSchema.partial().nullable(),
8362
- percentCompleted: z2.number().default(0),
8363
- completedLessonsCount: z2.number().default(0),
8364
- totalLessonsCount: z2.number().default(0)
8365
- });
8366
-
8367
- // ../core/dist/chunk-DLQA3JMA.js
8368
- var upgradableProductSchema = z2.object({
8369
- upgradableToId: z2.string().max(255),
8370
- upgradableFromId: z2.string().max(255),
8371
- position: z2.number().default(0),
8372
- metadata: z2.record(z2.any()).default({}),
8419
+ merchantAccountId: z2.string().max(191),
8420
+ merchantProductId: z2.string().max(191),
8373
8421
  createdAt: z2.date().nullable(),
8374
- updatedAt: z2.date().nullable(),
8375
- deletedAt: z2.date().nullable()
8422
+ merchantCustomerId: z2.string().max(191)
8376
8423
  });
8377
8424
 
8378
8425
  // ../core/dist/chunk-EDDT2FFU.js
@@ -8406,18 +8453,6 @@ var merchantProductSchema = z2.object({
8406
8453
  createdAt: z2.date().nullable()
8407
8454
  });
8408
8455
 
8409
- // ../core/dist/chunk-SGE7BCRS.js
8410
- var merchantChargeSchema = z2.object({
8411
- id: z2.string().max(191),
8412
- status: z2.number().int().default(0),
8413
- identifier: z2.string().max(191),
8414
- userId: z2.string().max(191),
8415
- merchantAccountId: z2.string().max(191),
8416
- merchantProductId: z2.string().max(191),
8417
- createdAt: z2.date().nullable(),
8418
- merchantCustomerId: z2.string().max(191)
8419
- });
8420
-
8421
8456
  // ../core/dist/chunk-256SROW3.js
8422
8457
  var merchantCouponSchema = z2.object({
8423
8458
  id: z2.string().max(191),
@@ -8440,6 +8475,71 @@ var merchantAccountSchema = z2.object({
8440
8475
  status: z2.number().int().default(0)
8441
8476
  });
8442
8477
 
8478
+ // ../core/dist/schemas/merchant-session.js
8479
+ var MerchantSessionSchema = z2.object({
8480
+ id: z2.string(),
8481
+ organizationId: z2.string().nullable(),
8482
+ identifier: z2.string(),
8483
+ merchantAccountId: z2.string()
8484
+ });
8485
+
8486
+ // ../core/dist/chunk-NCUZHHRE.js
8487
+ var MerchantSubscriptionSchema = z2.object({
8488
+ id: z2.string(),
8489
+ organizationId: z2.string().nullable(),
8490
+ merchantAccountId: z2.string(),
8491
+ status: z2.number().default(0),
8492
+ createdAt: z2.date().default(() => /* @__PURE__ */ new Date()),
8493
+ label: z2.string().nullable(),
8494
+ identifier: z2.string().nullable(),
8495
+ merchantCustomerId: z2.string(),
8496
+ merchantProductId: z2.string()
8497
+ });
8498
+
8499
+ // ../core/dist/chunk-KQ3HQRWM.js
8500
+ var OrganizationSchema = z2.object({
8501
+ id: z2.string(),
8502
+ name: z2.string().nullable(),
8503
+ fields: z2.record(z2.any()).default({}),
8504
+ image: z2.string().nullable(),
8505
+ createdAt: z2.date()
8506
+ });
8507
+
8508
+ // ../core/dist/schemas/organization-member.js
8509
+ var OrganizationMemberSchema = z2.object({
8510
+ id: z2.string(),
8511
+ organizationId: z2.string().optional(),
8512
+ role: z2.string().default("user"),
8513
+ invitedById: z2.string(),
8514
+ userId: z2.string(),
8515
+ fields: z2.record(z2.any()).default({}),
8516
+ createdAt: z2.date().default(() => /* @__PURE__ */ new Date()),
8517
+ organization: OrganizationSchema,
8518
+ user: userSchema
8519
+ });
8520
+
8521
+ // ../core/dist/schemas/subscription.js
8522
+ var SubscriptionSchema = z2.object({
8523
+ id: z2.string(),
8524
+ organizationId: z2.string().optional(),
8525
+ productId: z2.string(),
8526
+ createdAt: z2.date(),
8527
+ merchantSubscriptionId: z2.string(),
8528
+ status: z2.enum([
8529
+ "incomplete",
8530
+ "incomplete_expired",
8531
+ "trialing",
8532
+ "active",
8533
+ "past_due",
8534
+ "canceled",
8535
+ "unpaid",
8536
+ "paused"
8537
+ ]).default("active"),
8538
+ fields: z2.record(z2.any()).default({}),
8539
+ product: productSchema,
8540
+ merchantSubscription: MerchantSubscriptionSchema.optional()
8541
+ });
8542
+
8443
8543
  // ../core/dist/chunk-F32UWPXN.js
8444
8544
  var _a41;
8445
8545
  var _CourseBuilderError = (_a41 = class extends Error {
@@ -8640,7 +8740,19 @@ function getCourseBuilderSchema(mysqlTable) {
8640
8740
  tagTag: getTagTagSchema(mysqlTable),
8641
8741
  tagTagRelations: getTagTagRelationsSchema(mysqlTable),
8642
8742
  userPrefs: getUserPrefsSchema(mysqlTable),
8643
- userPrefsRelations: getUserPrefsRelationsSchema(mysqlTable)
8743
+ userPrefsRelations: getUserPrefsRelationsSchema(mysqlTable),
8744
+ organization: getOrganizationsSchema(mysqlTable),
8745
+ organizationRelations: getOrganizationsRelationsSchema(mysqlTable),
8746
+ organizationMemberships: getOrganizationMembershipsSchema(mysqlTable),
8747
+ organizationMembershipRelations: getOrganizationMembershipsRelationsSchema(mysqlTable),
8748
+ organizationMembershipRoles: getOrganizationMembershipRolesSchema(mysqlTable),
8749
+ organizationMembershipRolesRelations: getOrganizationMembershipRolesRelationsSchema(mysqlTable),
8750
+ merchantSubscription: getMerchantSubscriptionSchema(mysqlTable),
8751
+ merchantSubscriptionRelations: getMerchantSubscriptionRelationsSchema(mysqlTable),
8752
+ subscription: getSubscriptionSchema(mysqlTable),
8753
+ subscriptionRelations: getSubscriptionRelationsSchema(mysqlTable),
8754
+ profiles: getProfilesSchema(mysqlTable),
8755
+ profilesRelations: getProfilesRelationsSchema(mysqlTable)
8644
8756
  };
8645
8757
  }
8646
8758
  __name(getCourseBuilderSchema, "getCourseBuilderSchema");
@@ -8649,7 +8761,7 @@ function createTables(mySqlTable) {
8649
8761
  }
8650
8762
  __name(createTables, "createTables");
8651
8763
  function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn, paymentProvider) {
8652
- const { users, accounts, sessions, verificationTokens, contentResource, contentResourceResource, contentResourceProduct, purchases: purchaseTable, purchaseUserTransfer, coupon, merchantCoupon, merchantCharge, merchantAccount, merchantPrice, merchantCustomer, merchantSession, merchantProduct, prices, products, upgradableProducts, resourceProgress, comments } = createTables(tableFn);
8764
+ const { users, accounts, sessions, verificationTokens, contentResource, contentResourceResource, contentResourceProduct, purchases: purchaseTable, purchaseUserTransfer, coupon, merchantCoupon, merchantCharge, merchantAccount, merchantPrice, merchantCustomer, merchantSession, merchantProduct, prices, products, upgradableProducts, resourceProgress, comments, organization: organizationTable, organizationMemberships: organizationMembershipTable, organizationMembershipRoles: organizationMembershipRoleTable, roles: roleTable, merchantSubscription: merchantSubscriptionTable, subscription: subscriptionTable } = createTables(tableFn);
8653
8765
  const adapter = {
8654
8766
  client,
8655
8767
  async redeemFullPriceCoupon(options) {
@@ -8844,6 +8956,20 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn, paymentProvi
8844
8956
  }
8845
8957
  return parsedCoupon.data;
8846
8958
  },
8959
+ async createMerchantSession(options) {
8960
+ const id = `ms_${v4()}`;
8961
+ await client.insert(merchantSession).values({
8962
+ id,
8963
+ identifier: options.identifier,
8964
+ merchantAccountId: options.merchantAccountId,
8965
+ ...options.organizationId ? {
8966
+ organizationId: options.organizationId
8967
+ } : {}
8968
+ });
8969
+ return MerchantSessionSchema.parse(await client.query.merchantSession.findFirst({
8970
+ where: eq(merchantSession.id, id)
8971
+ }));
8972
+ },
8847
8973
  async createMerchantChargeAndPurchase(options) {
8848
8974
  const purchaseId = await client.transaction(async (trx) => {
8849
8975
  try {
@@ -8907,7 +9033,7 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn, paymentProvi
8907
9033
  }
8908
9034
  }
8909
9035
  const merchantSessionId = `ms_${v4()}`;
8910
- const newMerchantSession = await client.insert(merchantSession).values({
9036
+ await client.insert(merchantSession).values({
8911
9037
  id: merchantSessionId,
8912
9038
  identifier: checkoutSessionId,
8913
9039
  merchantAccountId
@@ -8919,7 +9045,7 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn, paymentProvi
8919
9045
  where: and(eq(merchantCoupon.identifier, appliedPPPStripeCouponId), eq(merchantCoupon.type, "ppp"))
8920
9046
  }) : null;
8921
9047
  const newPurchaseStatus = merchantCouponUsed?.type === "ppp" || pppMerchantCoupon ? "Restricted" : "Valid";
8922
- const newPurchase = await client.insert(purchaseTable).values({
9048
+ await client.insert(purchaseTable).values({
8923
9049
  id: purchaseId2,
8924
9050
  status: newPurchaseStatus,
8925
9051
  userId,
@@ -8933,7 +9059,7 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn, paymentProvi
8933
9059
  couponId: usedCouponId || null
8934
9060
  });
8935
9061
  const oneWeekInMilliseconds = 1e3 * 60 * 60 * 24 * 7;
8936
- const newPurchaseUserTransfer = await client.insert(purchaseUserTransfer).values({
9062
+ await client.insert(purchaseUserTransfer).values({
8937
9063
  id: `put_${v4()}`,
8938
9064
  purchaseId: purchaseId2,
8939
9065
  expiresAt: existingPurchase ? /* @__PURE__ */ new Date() : new Date(Date.now() + oneWeekInMilliseconds),
@@ -9099,7 +9225,8 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn, paymentProvi
9099
9225
  resource_id: z.string(),
9100
9226
  resource_type: z.enum([
9101
9227
  "lesson",
9102
- "exercise"
9228
+ "exercise",
9229
+ "post"
9103
9230
  ]),
9104
9231
  resource_slug: z.string().nullable(),
9105
9232
  completed_at: z.string().nullable().transform((val) => val ? new Date(val) : null)
@@ -9135,7 +9262,7 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn, paymentProvi
9135
9262
  LEFT JOIN ${resourceProgress} rp ON rp.resourceId = cr.id
9136
9263
  AND rp.userId = ${user.id}
9137
9264
  WHERE
9138
- cr.type IN ('lesson', 'exercise')
9265
+ cr.type IN ('lesson', 'exercise', 'post')
9139
9266
 
9140
9267
  `);
9141
9268
  const completedLessons = [];
@@ -10029,7 +10156,30 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn, paymentProvi
10029
10156
  ...data,
10030
10157
  id
10031
10158
  });
10032
- return await client.select().from(users).where(eq(users.id, id)).then((res) => res[0]);
10159
+ const personalOrganization = await adapter.createOrganization({
10160
+ name: `Personal (${data.email})`
10161
+ });
10162
+ if (!personalOrganization) {
10163
+ throw new Error("Failed to create personal organization");
10164
+ }
10165
+ const membership = await adapter.addMemberToOrganization({
10166
+ organizationId: personalOrganization.id,
10167
+ userId: id,
10168
+ invitedById: id
10169
+ });
10170
+ if (!membership) {
10171
+ throw new Error("Failed to add user to personal organization");
10172
+ }
10173
+ await adapter.addRoleForMember({
10174
+ organizationId: personalOrganization.id,
10175
+ memberId: membership.id,
10176
+ role: "owner"
10177
+ });
10178
+ const user = await adapter.getUser?.(id);
10179
+ if (!user) {
10180
+ throw new Error("Failed to get user");
10181
+ }
10182
+ return user;
10033
10183
  } catch (error) {
10034
10184
  console.error(error);
10035
10185
  throw error;
@@ -10111,6 +10261,138 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn, paymentProvi
10111
10261
  async unlinkAccount(account) {
10112
10262
  await client.delete(accounts).where(and(eq(accounts.providerAccountId, account.providerAccountId), eq(accounts.provider, account.provider)));
10113
10263
  return void 0;
10264
+ },
10265
+ createOrganization: async (options) => {
10266
+ const organizationId = crypto.randomUUID();
10267
+ await client.insert(organizationTable).values({
10268
+ ...options,
10269
+ id: organizationId
10270
+ });
10271
+ return adapter.getOrganization(organizationId);
10272
+ },
10273
+ getOrganization: async (organizationId) => {
10274
+ return OrganizationSchema.parse(await client.query.organization.findFirst({
10275
+ where: eq(organizationTable.id, organizationId)
10276
+ }));
10277
+ },
10278
+ addMemberToOrganization: async (options) => {
10279
+ const id = crypto.randomUUID();
10280
+ await client.insert(organizationMembershipTable).values({
10281
+ ...options,
10282
+ id
10283
+ });
10284
+ return OrganizationMemberSchema.parse(await client.query.organizationMemberships.findFirst({
10285
+ where: eq(organizationMembershipTable.id, id),
10286
+ with: {
10287
+ organization: true,
10288
+ user: true
10289
+ }
10290
+ }));
10291
+ },
10292
+ removeMemberFromOrganization: async (options) => {
10293
+ await client.delete(organizationMembershipTable).where(and(eq(organizationMembershipTable.organizationId, options.organizationId), eq(organizationMembershipTable.userId, options.userId)));
10294
+ },
10295
+ addRoleForMember: async (options) => {
10296
+ const existingRole = z.object({
10297
+ id: z.string()
10298
+ }).nullish().parse(await client.query.roles.findFirst({
10299
+ where: and(eq(roleTable.organizationId, options.organizationId), eq(roleTable.name, options.role))
10300
+ }));
10301
+ const roleId = existingRole?.id || crypto.randomUUID();
10302
+ if (!existingRole) {
10303
+ await client.insert(roleTable).values({
10304
+ name: options.role,
10305
+ organizationId: options.organizationId,
10306
+ id: roleId
10307
+ });
10308
+ }
10309
+ const currentOrgMembershipRole = await client.query.organizationMembershipRoles.findFirst({
10310
+ where: and(eq(organizationMembershipRoleTable.organizationMembershipId, options.memberId), eq(organizationMembershipRoleTable.roleId, roleId))
10311
+ });
10312
+ if (!currentOrgMembershipRole) {
10313
+ await client.insert(organizationMembershipRoleTable).values({
10314
+ organizationId: options.organizationId,
10315
+ organizationMembershipId: options.memberId,
10316
+ roleId
10317
+ });
10318
+ }
10319
+ },
10320
+ removeRoleForMember: async (options) => {
10321
+ const existingRole = z.object({
10322
+ id: z.string()
10323
+ }).nullable().parse(await client.query.roles.findFirst({
10324
+ where: and(eq(roleTable.organizationId, options.organizationId), eq(roleTable.name, options.role))
10325
+ }));
10326
+ const roleId = existingRole?.id;
10327
+ if (roleId) {
10328
+ await client.delete(organizationMembershipRoleTable).where(eq(organizationMembershipRoleTable.roleId, roleId));
10329
+ }
10330
+ },
10331
+ getMembershipsForUser: async (userId) => {
10332
+ return OrganizationMemberSchema.array().parse(await client.query.organizationMemberships.findMany({
10333
+ where: eq(organizationMembershipTable.userId, userId),
10334
+ with: {
10335
+ organization: true,
10336
+ user: true
10337
+ }
10338
+ }) || []);
10339
+ },
10340
+ getOrganizationMembers: async (organizationId) => {
10341
+ return OrganizationMemberSchema.array().parse(await client.query.organizationMemberships.findMany({
10342
+ where: eq(organizationMembershipTable.organizationId, organizationId)
10343
+ }) || []);
10344
+ },
10345
+ createSubscription: async (options) => {
10346
+ const id = `sub_${crypto.randomUUID()}`;
10347
+ await client.insert(subscriptionTable).values({
10348
+ ...options,
10349
+ id
10350
+ });
10351
+ return SubscriptionSchema.parse(await client.query.subscription.findFirst({
10352
+ where: eq(subscriptionTable.id, id),
10353
+ with: {
10354
+ product: true
10355
+ }
10356
+ }));
10357
+ },
10358
+ getMerchantSubscription: async (merchantSubscriptionId) => {
10359
+ return MerchantSubscriptionSchema.parse(await client.query.merchantSubscription.findFirst({
10360
+ where: eq(merchantSubscriptionTable.id, merchantSubscriptionId)
10361
+ }));
10362
+ },
10363
+ createMerchantSubscription: async (options) => {
10364
+ const id = crypto.randomUUID();
10365
+ await client.insert(merchantSubscriptionTable).values({
10366
+ ...options,
10367
+ id
10368
+ });
10369
+ return MerchantSubscriptionSchema.parse(await client.query.merchantSubscription.findFirst({
10370
+ where: eq(merchantSubscriptionTable.id, id)
10371
+ }));
10372
+ },
10373
+ updateMerchantSubscription: async (options) => {
10374
+ throw new Error("Not implemented");
10375
+ },
10376
+ deleteMerchantSubscription: async (merchantSubscriptionId) => {
10377
+ throw new Error("Not implemented");
10378
+ },
10379
+ getSubscriptionForStripeId: async (stripeSubscriptionId) => {
10380
+ const merchantSubscriptionParsed = MerchantSubscriptionSchema.safeParse(await client.query.merchantSubscription.findFirst({
10381
+ where: eq(merchantSubscriptionTable.identifier, stripeSubscriptionId)
10382
+ }));
10383
+ if (!merchantSubscriptionParsed.success) {
10384
+ throw new Error(`No merchant subscription found for stripe id ${stripeSubscriptionId} ${merchantSubscriptionParsed.error}`);
10385
+ }
10386
+ const subscriptionParsed = SubscriptionSchema.safeParse(await client.query.subscription.findFirst({
10387
+ where: eq(subscriptionTable.merchantSubscriptionId, merchantSubscriptionParsed.data.id),
10388
+ with: {
10389
+ product: true
10390
+ }
10391
+ }));
10392
+ if (!subscriptionParsed.success) {
10393
+ throw new Error(`No subscription found for merchant subscription ${merchantSubscriptionParsed.data.id} ${subscriptionParsed.error}`);
10394
+ }
10395
+ return subscriptionParsed.data;
10114
10396
  }
10115
10397
  };
10116
10398
  return adapter;
@@ -10123,4 +10405,4 @@ export {
10123
10405
  createTables,
10124
10406
  mySqlDrizzleAdapter
10125
10407
  };
10126
- //# sourceMappingURL=chunk-ZYQYJNLK.js.map
10408
+ //# sourceMappingURL=chunk-MOV5TUON.js.map