@coursebuilder/adapter-drizzle 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/dist/{chunk-QM6AYTGN.js → chunk-6CBAFOL3.js} +5 -7
  2. package/dist/{chunk-NCDVIRG4.js → chunk-AIDEJDKJ.js} +5 -7
  3. package/dist/{chunk-34QNODEZ.js → chunk-BRGTUNY2.js} +5 -7
  4. package/dist/{chunk-WULUGMHP.js → chunk-H4MXNDWO.js} +5 -7
  5. package/dist/{chunk-JWWIIUV3.js → chunk-ICL7XZ2Y.js} +5 -7
  6. package/dist/{chunk-SBGLYMAH.js → chunk-JD4KFACE.js} +5 -7
  7. package/dist/{chunk-VID6JINS.js → chunk-JQFZOCAU.js} +98 -45
  8. package/dist/{chunk-ZUKX3WXB.js → chunk-KI47TR7F.js} +5 -7
  9. package/dist/{chunk-FZHAOQVB.js → chunk-KVN3JV7C.js} +5 -7
  10. package/dist/{chunk-H7XEMCP4.js → chunk-MBQ3TMHH.js} +5 -7
  11. package/dist/chunk-NISOQSUL.js +47 -0
  12. package/dist/chunk-PUGK2AEH.js +746 -0
  13. package/dist/{chunk-ABVLEWR5.js → chunk-SFJM6FKE.js} +5 -7
  14. package/dist/{chunk-QRRP7Y2V.js → chunk-TA6VLEV5.js} +5 -7
  15. package/dist/{chunk-BZPXYS6A.js → chunk-TMQIGK3N.js} +5 -7
  16. package/dist/{chunk-VWMY6XV7.js → chunk-US2EXVMI.js} +5 -7
  17. package/dist/{chunk-KFQAWBFP.js → chunk-UY3DVPP3.js} +5 -7
  18. package/dist/{chunk-M5NL4CY4.js → chunk-VEFCDI73.js} +5 -7
  19. package/dist/{chunk-EFO2N6T7.js → chunk-VZABQCFH.js} +5 -7
  20. package/dist/index.d.ts +1 -29
  21. package/dist/index.js +19 -30
  22. package/dist/lib/mysql/index.cjs +967 -769
  23. package/dist/lib/mysql/index.cjs.map +1 -1
  24. package/dist/lib/mysql/index.d.ts +4649 -745
  25. package/dist/lib/mysql/index.js +21 -117
  26. package/dist/lib/mysql/schemas/auth/accounts.cjs +124 -22
  27. package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
  28. package/dist/lib/mysql/schemas/auth/accounts.d.ts +180 -178
  29. package/dist/lib/mysql/schemas/auth/accounts.js +5 -1
  30. package/dist/lib/mysql/schemas/auth/permissions.cjs +108 -14
  31. package/dist/lib/mysql/schemas/auth/permissions.cjs.map +1 -1
  32. package/dist/lib/mysql/schemas/auth/permissions.d.ts +96 -94
  33. package/dist/lib/mysql/schemas/auth/permissions.js +5 -1
  34. package/dist/lib/mysql/schemas/auth/role-permissions.cjs +146 -13
  35. package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
  36. package/dist/lib/mysql/schemas/auth/role-permissions.d.ts +85 -82
  37. package/dist/lib/mysql/schemas/auth/role-permissions.js +5 -1
  38. package/dist/lib/mysql/schemas/auth/roles.cjs +110 -14
  39. package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
  40. package/dist/lib/mysql/schemas/auth/roles.d.ts +96 -94
  41. package/dist/lib/mysql/schemas/auth/roles.js +5 -1
  42. package/dist/lib/mysql/schemas/auth/sessions.cjs +116 -10
  43. package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
  44. package/dist/lib/mysql/schemas/auth/sessions.d.ts +48 -46
  45. package/dist/lib/mysql/schemas/auth/sessions.js +6 -1
  46. package/dist/lib/mysql/schemas/auth/user-permissions.cjs +155 -15
  47. package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
  48. package/dist/lib/mysql/schemas/auth/user-permissions.d.ts +85 -82
  49. package/dist/lib/mysql/schemas/auth/user-permissions.js +5 -1
  50. package/dist/lib/mysql/schemas/auth/user-roles.cjs +151 -13
  51. package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
  52. package/dist/lib/mysql/schemas/auth/user-roles.d.ts +85 -82
  53. package/dist/lib/mysql/schemas/auth/user-roles.js +5 -1
  54. package/dist/lib/mysql/schemas/auth/users.cjs +310 -14
  55. package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
  56. package/dist/lib/mysql/schemas/auth/users.d.ts +101 -94
  57. package/dist/lib/mysql/schemas/auth/users.js +5 -1
  58. package/dist/lib/mysql/schemas/auth/verification-tokens.cjs +4 -6
  59. package/dist/lib/mysql/schemas/auth/verification-tokens.cjs.map +1 -1
  60. package/dist/lib/mysql/schemas/auth/verification-tokens.d.ts +55 -57
  61. package/dist/lib/mysql/schemas/auth/verification-tokens.js +1 -1
  62. package/dist/lib/mysql/schemas/commerce/coupon.cjs +4 -6
  63. package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
  64. package/dist/lib/mysql/schemas/commerce/coupon.d.ts +163 -165
  65. package/dist/lib/mysql/schemas/commerce/coupon.js +1 -1
  66. package/dist/lib/mysql/schemas/commerce/merchant-account.cjs +4 -6
  67. package/dist/lib/mysql/schemas/commerce/merchant-account.cjs.map +1 -1
  68. package/dist/lib/mysql/schemas/commerce/merchant-account.d.ts +67 -69
  69. package/dist/lib/mysql/schemas/commerce/merchant-account.js +1 -1
  70. package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs +4 -6
  71. package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs.map +1 -1
  72. package/dist/lib/mysql/schemas/commerce/merchant-charge.d.ts +103 -105
  73. package/dist/lib/mysql/schemas/commerce/merchant-charge.js +1 -1
  74. package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs +4 -6
  75. package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs.map +1 -1
  76. package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.ts +79 -81
  77. package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +1 -1
  78. package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs +4 -6
  79. package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs.map +1 -1
  80. package/dist/lib/mysql/schemas/commerce/merchant-customer.d.ts +79 -81
  81. package/dist/lib/mysql/schemas/commerce/merchant-customer.js +1 -1
  82. package/dist/lib/mysql/schemas/commerce/merchant-price.cjs +4 -6
  83. package/dist/lib/mysql/schemas/commerce/merchant-price.cjs.map +1 -1
  84. package/dist/lib/mysql/schemas/commerce/merchant-price.d.ts +91 -93
  85. package/dist/lib/mysql/schemas/commerce/merchant-price.js +1 -1
  86. package/dist/lib/mysql/schemas/commerce/merchant-product.cjs +4 -6
  87. package/dist/lib/mysql/schemas/commerce/merchant-product.cjs.map +1 -1
  88. package/dist/lib/mysql/schemas/commerce/merchant-product.d.ts +79 -81
  89. package/dist/lib/mysql/schemas/commerce/merchant-product.js +1 -1
  90. package/dist/lib/mysql/schemas/commerce/merchant-session.cjs +4 -6
  91. package/dist/lib/mysql/schemas/commerce/merchant-session.cjs.map +1 -1
  92. package/dist/lib/mysql/schemas/commerce/merchant-session.d.ts +43 -45
  93. package/dist/lib/mysql/schemas/commerce/merchant-session.js +1 -1
  94. package/dist/lib/mysql/schemas/commerce/price.cjs +4 -6
  95. package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
  96. package/dist/lib/mysql/schemas/commerce/price.d.ts +91 -93
  97. package/dist/lib/mysql/schemas/commerce/price.js +1 -1
  98. package/dist/lib/mysql/schemas/commerce/product.cjs +4 -6
  99. package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
  100. package/dist/lib/mysql/schemas/commerce/product.d.ts +91 -93
  101. package/dist/lib/mysql/schemas/commerce/product.js +1 -1
  102. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +4 -6
  103. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
  104. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.ts +127 -129
  105. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +1 -1
  106. package/dist/lib/mysql/schemas/commerce/purchase.cjs +4 -6
  107. package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
  108. package/dist/lib/mysql/schemas/commerce/purchase.d.ts +211 -213
  109. package/dist/lib/mysql/schemas/commerce/purchase.js +1 -1
  110. package/dist/lib/mysql/schemas/communication/communication-channel.cjs +4 -6
  111. package/dist/lib/mysql/schemas/communication/communication-channel.cjs.map +1 -1
  112. package/dist/lib/mysql/schemas/communication/communication-channel.d.ts +91 -93
  113. package/dist/lib/mysql/schemas/communication/communication-channel.js +1 -1
  114. package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs +4 -6
  115. package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs.map +1 -1
  116. package/dist/lib/mysql/schemas/communication/communication-preference-types.d.ts +91 -93
  117. package/dist/lib/mysql/schemas/communication/communication-preference-types.js +1 -1
  118. package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +192 -20
  119. package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
  120. package/dist/lib/mysql/schemas/communication/communication-preferences.d.ts +146 -142
  121. package/dist/lib/mysql/schemas/communication/communication-preferences.js +5 -1
  122. package/dist/lib/mysql/schemas/content/content-contributions.cjs +201 -17
  123. package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
  124. package/dist/lib/mysql/schemas/content/content-contributions.d.ts +110 -106
  125. package/dist/lib/mysql/schemas/content/content-contributions.js +5 -1
  126. package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +128 -18
  127. package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
  128. package/dist/lib/mysql/schemas/content/content-resource-resource.d.ts +97 -94
  129. package/dist/lib/mysql/schemas/content/content-resource-resource.js +5 -1
  130. package/dist/lib/mysql/schemas/content/content-resource.cjs +198 -18
  131. package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
  132. package/dist/lib/mysql/schemas/content/content-resource.d.ts +99 -94
  133. package/dist/lib/mysql/schemas/content/content-resource.js +5 -1
  134. package/dist/lib/mysql/schemas/content/contribution-types.cjs +113 -16
  135. package/dist/lib/mysql/schemas/content/contribution-types.cjs.map +1 -1
  136. package/dist/lib/mysql/schemas/content/contribution-types.d.ts +108 -106
  137. package/dist/lib/mysql/schemas/content/contribution-types.js +5 -1
  138. package/dist/lib/mysql/schemas/content/resource-progress.cjs +4 -6
  139. package/dist/lib/mysql/schemas/content/resource-progress.cjs.map +1 -1
  140. package/dist/lib/mysql/schemas/content/resource-progress.d.ts +79 -81
  141. package/dist/lib/mysql/schemas/content/resource-progress.js +1 -1
  142. package/dist/lib/pg.d.ts +1 -1
  143. package/dist/lib/sqlite.d.ts +1 -1
  144. package/dist/lib/utils.d.ts +1 -29
  145. package/package.json +1 -1
  146. package/src/lib/mysql/index.ts +95 -65
  147. package/src/lib/mysql/schemas/auth/accounts.ts +12 -3
  148. package/src/lib/mysql/schemas/auth/permissions.ts +10 -3
  149. package/src/lib/mysql/schemas/auth/role-permissions.ts +21 -3
  150. package/src/lib/mysql/schemas/auth/roles.ts +12 -3
  151. package/src/lib/mysql/schemas/auth/sessions.ts +12 -3
  152. package/src/lib/mysql/schemas/auth/user-permissions.ts +21 -3
  153. package/src/lib/mysql/schemas/auth/user-roles.ts +21 -3
  154. package/src/lib/mysql/schemas/auth/users.ts +26 -3
  155. package/src/lib/mysql/schemas/auth/verification-tokens.ts +2 -4
  156. package/src/lib/mysql/schemas/commerce/coupon.ts +2 -4
  157. package/src/lib/mysql/schemas/commerce/merchant-account.ts +2 -4
  158. package/src/lib/mysql/schemas/commerce/merchant-charge.ts +2 -4
  159. package/src/lib/mysql/schemas/commerce/merchant-coupon.ts +2 -4
  160. package/src/lib/mysql/schemas/commerce/merchant-customer.ts +2 -4
  161. package/src/lib/mysql/schemas/commerce/merchant-price.ts +2 -4
  162. package/src/lib/mysql/schemas/commerce/merchant-product.ts +2 -4
  163. package/src/lib/mysql/schemas/commerce/merchant-session.ts +2 -4
  164. package/src/lib/mysql/schemas/commerce/price.ts +2 -4
  165. package/src/lib/mysql/schemas/commerce/product.ts +2 -4
  166. package/src/lib/mysql/schemas/commerce/purchase-user-transfer.ts +2 -4
  167. package/src/lib/mysql/schemas/commerce/purchase.ts +2 -4
  168. package/src/lib/mysql/schemas/communication/communication-channel.ts +2 -4
  169. package/src/lib/mysql/schemas/communication/communication-preference-types.ts +20 -25
  170. package/src/lib/mysql/schemas/communication/communication-preferences.ts +30 -3
  171. package/src/lib/mysql/schemas/content/content-contributions.ts +31 -3
  172. package/src/lib/mysql/schemas/content/content-resource-resource.ts +23 -4
  173. package/src/lib/mysql/schemas/content/content-resource.ts +22 -4
  174. package/src/lib/mysql/schemas/content/contribution-types.ts +13 -3
  175. package/src/lib/mysql/schemas/content/resource-progress.ts +2 -4
  176. package/dist/chunk-7Z72PW3G.js +0 -60
  177. package/dist/chunk-C2G2KMWQ.js +0 -48
  178. package/dist/chunk-GJZCLS2Y.js +0 -29
  179. package/dist/chunk-HHQK736S.js +0 -40
  180. package/dist/chunk-I4NIW2NF.js +0 -46
  181. package/dist/chunk-IHQ3ARH4.js +0 -44
  182. package/dist/chunk-KEJBPPZC.js +0 -45
  183. package/dist/chunk-L3XBKPYA.js +0 -47
  184. package/dist/chunk-MHZHMZ5C.js +0 -47
  185. package/dist/chunk-MOO56C62.js +0 -46
  186. package/dist/chunk-RLTOQRJB.js +0 -40
  187. package/dist/chunk-SWOTLIQI.js +0 -46
  188. package/dist/chunk-XM4CEU6B.js +0 -54
@@ -0,0 +1,746 @@
1
+ import {
2
+ getCommunicationChannelSchema
3
+ } from "./chunk-6CBAFOL3.js";
4
+ import {
5
+ getCommunicationPreferenceTypesSchema
6
+ } from "./chunk-SFJM6FKE.js";
7
+ import {
8
+ __name
9
+ } from "./chunk-VNI36MMC.js";
10
+
11
+ // src/lib/mysql/schemas/communication/communication-preferences.ts
12
+ import { relations as relations12 } from "drizzle-orm";
13
+ import { boolean as boolean8, index as index12, mysqlEnum as mysqlEnum2, timestamp as timestamp11, varchar as varchar12 } from "drizzle-orm/mysql-core";
14
+
15
+ // src/lib/mysql/schemas/auth/users.ts
16
+ import { relations as relations11, sql as sql3 } from "drizzle-orm";
17
+ import { index as index11, mysqlEnum, timestamp as timestamp10, varchar as varchar11 } from "drizzle-orm/mysql-core";
18
+
19
+ // src/lib/mysql/schemas/content/content-contributions.ts
20
+ import { relations as relations4 } from "drizzle-orm";
21
+ import { boolean as boolean2, index as index4, timestamp as timestamp4, varchar as varchar4 } from "drizzle-orm/mysql-core";
22
+
23
+ // src/lib/mysql/schemas/content/content-resource.ts
24
+ import { relations as relations2, sql as sql2 } from "drizzle-orm";
25
+ import { index as index2, json as json2, timestamp as timestamp2, varchar as varchar2 } from "drizzle-orm/mysql-core";
26
+
27
+ // src/lib/mysql/schemas/content/content-resource-resource.ts
28
+ import { relations, sql } from "drizzle-orm";
29
+ import { double, index, json, primaryKey, timestamp, varchar } from "drizzle-orm/mysql-core";
30
+ function getContentResourceResourceSchema(mysqlTable) {
31
+ return mysqlTable("contentResourceResource", {
32
+ resourceOfId: varchar("resourceOfId", {
33
+ length: 255
34
+ }).notNull(),
35
+ resourceId: varchar("resourceId", {
36
+ length: 255
37
+ }).notNull(),
38
+ position: double("position").notNull().default(0),
39
+ metadata: json("fields").$type().default({}),
40
+ createdAt: timestamp("createdAt", {
41
+ mode: "date",
42
+ fsp: 3
43
+ }).default(sql`CURRENT_TIMESTAMP(3)`),
44
+ updatedAt: timestamp("updatedAt", {
45
+ mode: "date",
46
+ fsp: 3
47
+ }).default(sql`CURRENT_TIMESTAMP(3)`),
48
+ deletedAt: timestamp("deletedAt", {
49
+ mode: "date",
50
+ fsp: 3
51
+ })
52
+ }, (crr) => ({
53
+ pk: primaryKey({
54
+ columns: [
55
+ crr.resourceOfId,
56
+ crr.resourceId
57
+ ]
58
+ }),
59
+ contentResourceIdIdx: index("contentResourceId_idx").on(crr.resourceOfId),
60
+ resourceIdIdx: index("resourceId_idx").on(crr.resourceId)
61
+ }));
62
+ }
63
+ __name(getContentResourceResourceSchema, "getContentResourceResourceSchema");
64
+ function getContentResourceResourceRelationsSchema(mysqlTable) {
65
+ const contentResource = getContentResourceSchema(mysqlTable);
66
+ const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
67
+ return relations(contentResourceResource, ({ one }) => ({
68
+ resourceOf: one(contentResource, {
69
+ fields: [
70
+ contentResourceResource.resourceOfId
71
+ ],
72
+ references: [
73
+ contentResource.id
74
+ ],
75
+ relationName: "resourceOf"
76
+ }),
77
+ resource: one(contentResource, {
78
+ fields: [
79
+ contentResourceResource.resourceId
80
+ ],
81
+ references: [
82
+ contentResource.id
83
+ ],
84
+ relationName: "resource"
85
+ })
86
+ }));
87
+ }
88
+ __name(getContentResourceResourceRelationsSchema, "getContentResourceResourceRelationsSchema");
89
+
90
+ // src/lib/mysql/schemas/content/content-resource.ts
91
+ function getContentResourceSchema(mysqlTable) {
92
+ return mysqlTable("contentResource", {
93
+ id: varchar2("id", {
94
+ length: 255
95
+ }).notNull().primaryKey(),
96
+ type: varchar2("type", {
97
+ length: 255
98
+ }).notNull(),
99
+ createdById: varchar2("createdById", {
100
+ length: 255
101
+ }).notNull(),
102
+ fields: json2("fields").$type().default({}),
103
+ createdAt: timestamp2("createdAt", {
104
+ mode: "date",
105
+ fsp: 3
106
+ }).default(sql2`CURRENT_TIMESTAMP(3)`),
107
+ updatedAt: timestamp2("updatedAt", {
108
+ mode: "date",
109
+ fsp: 3
110
+ }).default(sql2`CURRENT_TIMESTAMP(3)`),
111
+ deletedAt: timestamp2("deletedAt", {
112
+ mode: "date",
113
+ fsp: 3
114
+ })
115
+ }, (cm) => ({
116
+ typeIdx: index2("type_idx").on(cm.type),
117
+ createdByIdx: index2("createdById_idx").on(cm.createdById),
118
+ createdAtIdx: index2("createdAt_idx").on(cm.createdAt)
119
+ }));
120
+ }
121
+ __name(getContentResourceSchema, "getContentResourceSchema");
122
+ function getContentResourceRelationsSchema(mysqlTable) {
123
+ const contentResource = getContentResourceSchema(mysqlTable);
124
+ const users = getUsersSchema(mysqlTable);
125
+ const contentContributions = getContentContributionsSchema(mysqlTable);
126
+ const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
127
+ return relations2(contentResource, ({ one, many }) => ({
128
+ createdBy: one(users, {
129
+ fields: [
130
+ contentResource.createdById
131
+ ],
132
+ references: [
133
+ users.id
134
+ ]
135
+ }),
136
+ contributions: many(contentContributions),
137
+ resources: many(contentResourceResource, {
138
+ relationName: "resourceOf"
139
+ }),
140
+ resourceOf: many(contentResourceResource, {
141
+ relationName: "resource"
142
+ })
143
+ }));
144
+ }
145
+ __name(getContentResourceRelationsSchema, "getContentResourceRelationsSchema");
146
+
147
+ // src/lib/mysql/schemas/content/contribution-types.ts
148
+ import { relations as relations3 } from "drizzle-orm";
149
+ import { boolean, index as index3, text, timestamp as timestamp3, varchar as varchar3 } from "drizzle-orm/mysql-core";
150
+ function getContributionTypesSchema(mysqlTable) {
151
+ return mysqlTable("contributionType", {
152
+ id: varchar3("id", {
153
+ length: 255
154
+ }).notNull().primaryKey(),
155
+ slug: varchar3("slug", {
156
+ length: 255
157
+ }).notNull().unique(),
158
+ name: varchar3("name", {
159
+ length: 255
160
+ }).notNull(),
161
+ description: text("description"),
162
+ active: boolean("active").notNull().default(true),
163
+ createdAt: timestamp3("createdAt", {
164
+ mode: "date",
165
+ fsp: 3
166
+ }).defaultNow(),
167
+ updatedAt: timestamp3("updatedAt", {
168
+ mode: "date",
169
+ fsp: 3
170
+ }).defaultNow(),
171
+ deletedAt: timestamp3("deletedAt", {
172
+ mode: "date",
173
+ fsp: 3
174
+ })
175
+ }, (ct) => ({
176
+ nameIdx: index3("name_idx").on(ct.name),
177
+ slugIdx: index3("slug_idx").on(ct.slug)
178
+ }));
179
+ }
180
+ __name(getContributionTypesSchema, "getContributionTypesSchema");
181
+ function getContributionTypesRelationsSchema(mysqlTable) {
182
+ const contributionTypes = getContributionTypesSchema(mysqlTable);
183
+ const contentContributions = getContentContributionsSchema(mysqlTable);
184
+ return relations3(contributionTypes, ({ many }) => ({
185
+ contributions: many(contentContributions)
186
+ }));
187
+ }
188
+ __name(getContributionTypesRelationsSchema, "getContributionTypesRelationsSchema");
189
+
190
+ // src/lib/mysql/schemas/content/content-contributions.ts
191
+ function getContentContributionsSchema(mysqlTable) {
192
+ return mysqlTable("contentContribution", {
193
+ id: varchar4("id", {
194
+ length: 255
195
+ }).notNull().primaryKey(),
196
+ userId: varchar4("userId", {
197
+ length: 255
198
+ }).notNull(),
199
+ contentId: varchar4("contentId", {
200
+ length: 255
201
+ }).notNull(),
202
+ contributionTypeId: varchar4("contributionTypeId", {
203
+ length: 255
204
+ }).notNull(),
205
+ active: boolean2("active").notNull().default(true),
206
+ createdAt: timestamp4("createdAt", {
207
+ mode: "date",
208
+ fsp: 3
209
+ }).defaultNow(),
210
+ updatedAt: timestamp4("updatedAt", {
211
+ mode: "date",
212
+ fsp: 3
213
+ }).defaultNow(),
214
+ deletedAt: timestamp4("deletedAt", {
215
+ mode: "date",
216
+ fsp: 3
217
+ })
218
+ }, (cc) => ({
219
+ userIdIdx: index4("userId_idx").on(cc.userId),
220
+ contentIdIdx: index4("contentId_idx").on(cc.contentId),
221
+ contributionTypeIdIdx: index4("contributionTypeId_idx").on(cc.contributionTypeId)
222
+ }));
223
+ }
224
+ __name(getContentContributionsSchema, "getContentContributionsSchema");
225
+ function getContentContributionRelationsSchema(mysqlTable) {
226
+ const contentContributions = getContentContributionsSchema(mysqlTable);
227
+ const users = getUsersSchema(mysqlTable);
228
+ const contentResource = getContentResourceSchema(mysqlTable);
229
+ const contributionTypes = getContributionTypesSchema(mysqlTable);
230
+ return relations4(contentContributions, ({ one }) => ({
231
+ user: one(users, {
232
+ fields: [
233
+ contentContributions.userId
234
+ ],
235
+ references: [
236
+ users.id
237
+ ]
238
+ }),
239
+ content: one(contentResource, {
240
+ fields: [
241
+ contentContributions.contentId
242
+ ],
243
+ references: [
244
+ contentResource.id
245
+ ]
246
+ }),
247
+ contributionType: one(contributionTypes, {
248
+ fields: [
249
+ contentContributions.contributionTypeId
250
+ ],
251
+ references: [
252
+ contributionTypes.id
253
+ ]
254
+ })
255
+ }));
256
+ }
257
+ __name(getContentContributionRelationsSchema, "getContentContributionRelationsSchema");
258
+
259
+ // src/lib/mysql/schemas/auth/accounts.ts
260
+ import { relations as relations5 } from "drizzle-orm";
261
+ import { index as index5, int, primaryKey as primaryKey2, text as text2, varchar as varchar5 } from "drizzle-orm/mysql-core";
262
+ function getAccountsSchema(mysqlTable) {
263
+ return mysqlTable("account", {
264
+ userId: varchar5("userId", {
265
+ length: 255
266
+ }).notNull(),
267
+ type: varchar5("type", {
268
+ length: 255
269
+ }).$type().notNull(),
270
+ provider: varchar5("provider", {
271
+ length: 255
272
+ }).notNull(),
273
+ providerAccountId: varchar5("providerAccountId", {
274
+ length: 255
275
+ }).notNull(),
276
+ refresh_token: text2("refresh_token"),
277
+ access_token: text2("access_token"),
278
+ oauth_token: text2("oauth_token"),
279
+ oauth_token_secret: text2("oauth_token_secret"),
280
+ expires_at: int("expires_at"),
281
+ token_type: varchar5("token_type", {
282
+ length: 255
283
+ }),
284
+ scope: varchar5("scope", {
285
+ length: 255
286
+ }),
287
+ id_token: text2("id_token"),
288
+ session_state: varchar5("session_state", {
289
+ length: 255
290
+ }),
291
+ refresh_token_expires_in: int("refresh_token_expires_in")
292
+ }, (account) => ({
293
+ pk: primaryKey2({
294
+ columns: [
295
+ account.provider,
296
+ account.providerAccountId
297
+ ]
298
+ }),
299
+ userIdIdx: index5("userId_idx").on(account.userId)
300
+ }));
301
+ }
302
+ __name(getAccountsSchema, "getAccountsSchema");
303
+ function getAccountsRelationsSchema(mysqlTable) {
304
+ const accounts = getAccountsSchema(mysqlTable);
305
+ const users = getUsersSchema(mysqlTable);
306
+ return relations5(accounts, ({ one }) => ({
307
+ user: one(users, {
308
+ fields: [
309
+ accounts.userId
310
+ ],
311
+ references: [
312
+ users.id
313
+ ]
314
+ })
315
+ }));
316
+ }
317
+ __name(getAccountsRelationsSchema, "getAccountsRelationsSchema");
318
+
319
+ // src/lib/mysql/schemas/auth/user-permissions.ts
320
+ import { relations as relations10 } from "drizzle-orm";
321
+ import { boolean as boolean7, index as index10, primaryKey as primaryKey5, timestamp as timestamp9, varchar as varchar10 } from "drizzle-orm/mysql-core";
322
+
323
+ // src/lib/mysql/schemas/auth/permissions.ts
324
+ import { relations as relations9 } from "drizzle-orm";
325
+ import { boolean as boolean6, index as index9, text as text4, timestamp as timestamp8, varchar as varchar9 } from "drizzle-orm/mysql-core";
326
+
327
+ // src/lib/mysql/schemas/auth/role-permissions.ts
328
+ import { relations as relations8 } from "drizzle-orm";
329
+ import { boolean as boolean5, index as index8, primaryKey as primaryKey4, timestamp as timestamp7, varchar as varchar8 } from "drizzle-orm/mysql-core";
330
+
331
+ // src/lib/mysql/schemas/auth/roles.ts
332
+ import { relations as relations7 } from "drizzle-orm";
333
+ import { boolean as boolean4, index as index7, text as text3, timestamp as timestamp6, varchar as varchar7 } from "drizzle-orm/mysql-core";
334
+
335
+ // src/lib/mysql/schemas/auth/user-roles.ts
336
+ import { relations as relations6 } from "drizzle-orm";
337
+ import { boolean as boolean3, index as index6, primaryKey as primaryKey3, timestamp as timestamp5, varchar as varchar6 } from "drizzle-orm/mysql-core";
338
+ function getUserRolesSchema(mysqlTable) {
339
+ return mysqlTable("userRole", {
340
+ userId: varchar6("userId", {
341
+ length: 255
342
+ }).notNull(),
343
+ roleId: varchar6("roleId", {
344
+ length: 255
345
+ }).notNull(),
346
+ active: boolean3("active").notNull().default(true),
347
+ createdAt: timestamp5("createdAt", {
348
+ mode: "date",
349
+ fsp: 3
350
+ }).defaultNow(),
351
+ updatedAt: timestamp5("updatedAt", {
352
+ mode: "date",
353
+ fsp: 3
354
+ }).defaultNow(),
355
+ deletedAt: timestamp5("deletedAt", {
356
+ mode: "date",
357
+ fsp: 3
358
+ })
359
+ }, (ur) => ({
360
+ pk: primaryKey3({
361
+ columns: [
362
+ ur.userId,
363
+ ur.roleId
364
+ ]
365
+ }),
366
+ userIdIdx: index6("userId_idx").on(ur.userId),
367
+ roleIdIdx: index6("roleId_idx").on(ur.roleId)
368
+ }));
369
+ }
370
+ __name(getUserRolesSchema, "getUserRolesSchema");
371
+ function getUserRolesRelationsSchema(mysqlTable) {
372
+ const userRoles = getUserRolesSchema(mysqlTable);
373
+ const users = getUsersSchema(mysqlTable);
374
+ const roles = getRolesSchema(mysqlTable);
375
+ return relations6(userRoles, ({ one }) => ({
376
+ user: one(users, {
377
+ fields: [
378
+ userRoles.userId
379
+ ],
380
+ references: [
381
+ users.id
382
+ ]
383
+ }),
384
+ role: one(roles, {
385
+ fields: [
386
+ userRoles.roleId
387
+ ],
388
+ references: [
389
+ roles.id
390
+ ]
391
+ })
392
+ }));
393
+ }
394
+ __name(getUserRolesRelationsSchema, "getUserRolesRelationsSchema");
395
+
396
+ // src/lib/mysql/schemas/auth/roles.ts
397
+ function getRolesSchema(mysqlTable) {
398
+ return mysqlTable("role", {
399
+ id: varchar7("id", {
400
+ length: 255
401
+ }).notNull().primaryKey(),
402
+ name: varchar7("name", {
403
+ length: 255
404
+ }).notNull().unique(),
405
+ description: text3("description"),
406
+ active: boolean4("active").notNull().default(true),
407
+ createdAt: timestamp6("createdAt", {
408
+ mode: "date",
409
+ fsp: 3
410
+ }).defaultNow(),
411
+ updatedAt: timestamp6("updatedAt", {
412
+ mode: "date",
413
+ fsp: 3
414
+ }).defaultNow(),
415
+ deletedAt: timestamp6("deletedAt", {
416
+ mode: "date",
417
+ fsp: 3
418
+ })
419
+ }, (role) => ({
420
+ nameIdx: index7("name_idx").on(role.name)
421
+ }));
422
+ }
423
+ __name(getRolesSchema, "getRolesSchema");
424
+ function getRolesRelationsSchema(mysqlTable) {
425
+ const roles = getRolesSchema(mysqlTable);
426
+ const userRoles = getUserRolesSchema(mysqlTable);
427
+ return relations7(roles, ({ many }) => ({
428
+ userRoles: many(userRoles)
429
+ }));
430
+ }
431
+ __name(getRolesRelationsSchema, "getRolesRelationsSchema");
432
+
433
+ // src/lib/mysql/schemas/auth/role-permissions.ts
434
+ function getRolePermissionsSchema(mysqlTable) {
435
+ return mysqlTable("rolePermission", {
436
+ roleId: varchar8("roleId", {
437
+ length: 255
438
+ }).notNull(),
439
+ permissionId: varchar8("permissionId", {
440
+ length: 255
441
+ }).notNull(),
442
+ active: boolean5("active").notNull().default(true),
443
+ createdAt: timestamp7("createdAt", {
444
+ mode: "date",
445
+ fsp: 3
446
+ }).defaultNow(),
447
+ updatedAt: timestamp7("updatedAt", {
448
+ mode: "date",
449
+ fsp: 3
450
+ }).defaultNow(),
451
+ deletedAt: timestamp7("deletedAt", {
452
+ mode: "date",
453
+ fsp: 3
454
+ })
455
+ }, (rp) => ({
456
+ pk: primaryKey4({
457
+ columns: [
458
+ rp.roleId,
459
+ rp.permissionId
460
+ ]
461
+ }),
462
+ roleIdIdx: index8("roleId_idx").on(rp.roleId),
463
+ permissionIdIdx: index8("permissionId_idx").on(rp.permissionId)
464
+ }));
465
+ }
466
+ __name(getRolePermissionsSchema, "getRolePermissionsSchema");
467
+ function getRolePermissionsRelationsSchema(mysqlTable) {
468
+ const permissions = getPermissionsSchema(mysqlTable);
469
+ const roles = getRolesSchema(mysqlTable);
470
+ const rolePermissions = getRolePermissionsSchema(mysqlTable);
471
+ return relations8(rolePermissions, ({ one }) => ({
472
+ role: one(roles, {
473
+ fields: [
474
+ rolePermissions.roleId
475
+ ],
476
+ references: [
477
+ roles.id
478
+ ]
479
+ }),
480
+ permission: one(permissions, {
481
+ fields: [
482
+ rolePermissions.permissionId
483
+ ],
484
+ references: [
485
+ permissions.id
486
+ ]
487
+ })
488
+ }));
489
+ }
490
+ __name(getRolePermissionsRelationsSchema, "getRolePermissionsRelationsSchema");
491
+
492
+ // src/lib/mysql/schemas/auth/permissions.ts
493
+ function getPermissionsSchema(mysqlTable) {
494
+ return mysqlTable("permission", {
495
+ id: varchar9("id", {
496
+ length: 255
497
+ }).notNull().primaryKey(),
498
+ name: varchar9("name", {
499
+ length: 255
500
+ }).notNull().unique(),
501
+ description: text4("description"),
502
+ active: boolean6("active").notNull().default(true),
503
+ createdAt: timestamp8("createdAt", {
504
+ mode: "date",
505
+ fsp: 3
506
+ }).defaultNow(),
507
+ updatedAt: timestamp8("updatedAt", {
508
+ mode: "date",
509
+ fsp: 3
510
+ }).defaultNow(),
511
+ deletedAt: timestamp8("deletedAt", {
512
+ mode: "date",
513
+ fsp: 3
514
+ })
515
+ }, (permission) => ({
516
+ nameIdx: index9("name_idx").on(permission.name)
517
+ }));
518
+ }
519
+ __name(getPermissionsSchema, "getPermissionsSchema");
520
+ function getPermissionsRelationsSchema(mysqlTable) {
521
+ return relations9(getPermissionsSchema(mysqlTable), ({ many }) => ({
522
+ rolePermissions: many(getRolePermissionsSchema(mysqlTable))
523
+ }));
524
+ }
525
+ __name(getPermissionsRelationsSchema, "getPermissionsRelationsSchema");
526
+
527
+ // src/lib/mysql/schemas/auth/user-permissions.ts
528
+ function getUserPermissionsSchema(mysqlTable) {
529
+ return mysqlTable("userPermission", {
530
+ userId: varchar10("userId", {
531
+ length: 255
532
+ }).notNull(),
533
+ permissionId: varchar10("permissionId", {
534
+ length: 255
535
+ }).notNull(),
536
+ active: boolean7("active").notNull().default(true),
537
+ createdAt: timestamp9("createdAt", {
538
+ mode: "date",
539
+ fsp: 3
540
+ }).defaultNow(),
541
+ updatedAt: timestamp9("updatedAt", {
542
+ mode: "date",
543
+ fsp: 3
544
+ }).defaultNow(),
545
+ deletedAt: timestamp9("deletedAt", {
546
+ mode: "date",
547
+ fsp: 3
548
+ })
549
+ }, (up) => ({
550
+ pk: primaryKey5({
551
+ columns: [
552
+ up.userId,
553
+ up.permissionId
554
+ ]
555
+ }),
556
+ userIdIdx: index10("userId_idx").on(up.userId),
557
+ permissionIdIdx: index10("permissionId_idx").on(up.permissionId)
558
+ }));
559
+ }
560
+ __name(getUserPermissionsSchema, "getUserPermissionsSchema");
561
+ function getUserPermissionsRelationsSchema(mysqlTable) {
562
+ const userPermissions = getUserPermissionsSchema(mysqlTable);
563
+ const users = getUsersSchema(mysqlTable);
564
+ const permissions = getPermissionsSchema(mysqlTable);
565
+ return relations10(userPermissions, ({ one }) => ({
566
+ user: one(users, {
567
+ fields: [
568
+ userPermissions.userId
569
+ ],
570
+ references: [
571
+ users.id
572
+ ]
573
+ }),
574
+ permission: one(permissions, {
575
+ fields: [
576
+ userPermissions.permissionId
577
+ ],
578
+ references: [
579
+ permissions.id
580
+ ]
581
+ })
582
+ }));
583
+ }
584
+ __name(getUserPermissionsRelationsSchema, "getUserPermissionsRelationsSchema");
585
+
586
+ // src/lib/mysql/schemas/auth/users.ts
587
+ function getUsersSchema(mysqlTable) {
588
+ return mysqlTable("user", {
589
+ id: varchar11("id", {
590
+ length: 255
591
+ }).notNull().primaryKey(),
592
+ name: varchar11("name", {
593
+ length: 255
594
+ }),
595
+ role: mysqlEnum("role", [
596
+ "user",
597
+ "admin"
598
+ ]).default("user"),
599
+ email: varchar11("email", {
600
+ length: 255
601
+ }).notNull().unique(),
602
+ emailVerified: timestamp10("emailVerified", {
603
+ mode: "date",
604
+ fsp: 3
605
+ }),
606
+ image: varchar11("image", {
607
+ length: 255
608
+ }),
609
+ createdAt: timestamp10("createdAt", {
610
+ mode: "date",
611
+ fsp: 3
612
+ }).default(sql3`CURRENT_TIMESTAMP(3)`)
613
+ }, (user) => ({
614
+ emailIdx: index11("email_idx").on(user.email),
615
+ roleIdx: index11("role_idx").on(user.role)
616
+ }));
617
+ }
618
+ __name(getUsersSchema, "getUsersSchema");
619
+ function getUsersRelationsSchema(mysqlTable) {
620
+ const users = getUsersSchema(mysqlTable);
621
+ const accounts = getAccountsSchema(mysqlTable);
622
+ const communicationPreferences = getCommunicationPreferencesSchema(mysqlTable);
623
+ const userRoles = getUserRolesSchema(mysqlTable);
624
+ const userPermissions = getUserPermissionsSchema(mysqlTable);
625
+ const contentContributions = getContentContributionsSchema(mysqlTable);
626
+ const contentResource = getContentResourceSchema(mysqlTable);
627
+ return relations11(users, ({ many }) => ({
628
+ accounts: many(accounts),
629
+ communicationPreferences: many(communicationPreferences),
630
+ userRoles: many(userRoles),
631
+ userPermissions: many(userPermissions),
632
+ contributions: many(contentContributions),
633
+ createdContent: many(contentResource)
634
+ }));
635
+ }
636
+ __name(getUsersRelationsSchema, "getUsersRelationsSchema");
637
+
638
+ // src/lib/mysql/schemas/communication/communication-preferences.ts
639
+ function getCommunicationPreferencesSchema(mysqlTable) {
640
+ return mysqlTable("communicationPreference", {
641
+ id: varchar12("id", {
642
+ length: 255
643
+ }).notNull().primaryKey(),
644
+ userId: varchar12("userId", {
645
+ length: 255
646
+ }).notNull(),
647
+ channelId: varchar12("channelId", {
648
+ length: 255
649
+ }).notNull(),
650
+ preferenceLevel: mysqlEnum2("preferenceLevel", [
651
+ "low",
652
+ "medium",
653
+ "high"
654
+ ]).notNull().default("medium"),
655
+ preferenceTypeId: varchar12("preferenceTypeId", {
656
+ length: 255
657
+ }).notNull(),
658
+ active: boolean8("active").notNull().default(true),
659
+ createdAt: timestamp11("createdAt", {
660
+ mode: "date",
661
+ fsp: 3
662
+ }).defaultNow(),
663
+ optInAt: timestamp11("optInAt", {
664
+ mode: "date",
665
+ fsp: 3
666
+ }),
667
+ optOutAt: timestamp11("optOutAt", {
668
+ mode: "date",
669
+ fsp: 3
670
+ }),
671
+ updatedAt: timestamp11("updatedAt", {
672
+ mode: "date",
673
+ fsp: 3
674
+ }).defaultNow(),
675
+ deletedAt: timestamp11("deletedAt", {
676
+ mode: "date",
677
+ fsp: 3
678
+ })
679
+ }, (cp) => ({
680
+ userIdIdx: index12("userId_idx").on(cp.userId),
681
+ preferenceTypeIdx: index12("preferenceTypeId_idx").on(cp.preferenceTypeId),
682
+ channelIdIdx: index12("channelId_idx").on(cp.channelId)
683
+ }));
684
+ }
685
+ __name(getCommunicationPreferencesSchema, "getCommunicationPreferencesSchema");
686
+ function getCommunicationPreferencesRelationsSchema(mysqlTable) {
687
+ const communicationPreferences = getCommunicationPreferencesSchema(mysqlTable);
688
+ const users = getUsersSchema(mysqlTable);
689
+ const communicationChannel = getCommunicationChannelSchema(mysqlTable);
690
+ const communicationPreferenceTypes = getCommunicationPreferenceTypesSchema(mysqlTable);
691
+ return relations12(communicationPreferences, ({ one }) => ({
692
+ user: one(users, {
693
+ fields: [
694
+ communicationPreferences.userId
695
+ ],
696
+ references: [
697
+ users.id
698
+ ]
699
+ }),
700
+ channel: one(communicationChannel, {
701
+ fields: [
702
+ communicationPreferences.channelId
703
+ ],
704
+ references: [
705
+ communicationChannel.id
706
+ ]
707
+ }),
708
+ preferenceType: one(communicationPreferenceTypes, {
709
+ fields: [
710
+ communicationPreferences.preferenceTypeId
711
+ ],
712
+ references: [
713
+ communicationPreferenceTypes.id
714
+ ]
715
+ })
716
+ }));
717
+ }
718
+ __name(getCommunicationPreferencesRelationsSchema, "getCommunicationPreferencesRelationsSchema");
719
+
720
+ export {
721
+ getCommunicationPreferencesSchema,
722
+ getCommunicationPreferencesRelationsSchema,
723
+ getContentResourceResourceSchema,
724
+ getContentResourceResourceRelationsSchema,
725
+ getContentResourceSchema,
726
+ getContentResourceRelationsSchema,
727
+ getContributionTypesSchema,
728
+ getContributionTypesRelationsSchema,
729
+ getContentContributionsSchema,
730
+ getContentContributionRelationsSchema,
731
+ getUserRolesSchema,
732
+ getUserRolesRelationsSchema,
733
+ getRolesSchema,
734
+ getRolesRelationsSchema,
735
+ getRolePermissionsSchema,
736
+ getRolePermissionsRelationsSchema,
737
+ getPermissionsSchema,
738
+ getPermissionsRelationsSchema,
739
+ getUserPermissionsSchema,
740
+ getUserPermissionsRelationsSchema,
741
+ getUsersSchema,
742
+ getUsersRelationsSchema,
743
+ getAccountsSchema,
744
+ getAccountsRelationsSchema
745
+ };
746
+ //# sourceMappingURL=chunk-PUGK2AEH.js.map