@coursebuilder/adapter-drizzle 0.0.4 → 0.0.6

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 (196) hide show
  1. package/dist/{chunk-RMRO5TA7.js → chunk-22KIKVBY.js} +2 -2
  2. package/dist/chunk-4HDU7QIB.js +747 -0
  3. package/dist/{chunk-QM6AYTGN.js → chunk-6CBAFOL3.js} +5 -7
  4. package/dist/{chunk-NCDVIRG4.js → chunk-AIDEJDKJ.js} +5 -7
  5. package/dist/{chunk-34QNODEZ.js → chunk-BRGTUNY2.js} +5 -7
  6. package/dist/{chunk-VID6JINS.js → chunk-FRNVLW7N.js} +690 -330
  7. package/dist/{chunk-LLWSIKQV.js → chunk-GFUUJRX7.js} +1 -1
  8. package/dist/{chunk-WULUGMHP.js → chunk-H4MXNDWO.js} +5 -7
  9. package/dist/{chunk-JWWIIUV3.js → chunk-ICL7XZ2Y.js} +5 -7
  10. package/dist/{chunk-SBGLYMAH.js → chunk-JD4KFACE.js} +5 -7
  11. package/dist/{chunk-ZUKX3WXB.js → chunk-KI47TR7F.js} +5 -7
  12. package/dist/{chunk-FZHAOQVB.js → chunk-KVN3JV7C.js} +5 -7
  13. package/dist/{chunk-H7XEMCP4.js → chunk-MBQ3TMHH.js} +5 -7
  14. package/dist/chunk-PFN4YUQZ.js +47 -0
  15. package/dist/{chunk-ABVLEWR5.js → chunk-SFJM6FKE.js} +5 -7
  16. package/dist/{chunk-QRRP7Y2V.js → chunk-TA6VLEV5.js} +5 -7
  17. package/dist/{chunk-BZPXYS6A.js → chunk-TMQIGK3N.js} +5 -7
  18. package/dist/{chunk-VWMY6XV7.js → chunk-US2EXVMI.js} +5 -7
  19. package/dist/{chunk-KFQAWBFP.js → chunk-UY3DVPP3.js} +5 -7
  20. package/dist/{chunk-M5NL4CY4.js → chunk-VEFCDI73.js} +5 -7
  21. package/dist/{chunk-EFO2N6T7.js → chunk-VZABQCFH.js} +5 -7
  22. package/dist/index.d.ts +1 -31
  23. package/dist/index.js +21 -32
  24. package/dist/lib/mysql/index.cjs +1606 -1100
  25. package/dist/lib/mysql/index.cjs.map +1 -1
  26. package/dist/lib/mysql/index.d.ts +4649 -745
  27. package/dist/lib/mysql/index.js +21 -117
  28. package/dist/lib/mysql/schemas/auth/accounts.cjs +125 -22
  29. package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
  30. package/dist/lib/mysql/schemas/auth/accounts.d.ts +180 -178
  31. package/dist/lib/mysql/schemas/auth/accounts.js +5 -1
  32. package/dist/lib/mysql/schemas/auth/permissions.cjs +108 -14
  33. package/dist/lib/mysql/schemas/auth/permissions.cjs.map +1 -1
  34. package/dist/lib/mysql/schemas/auth/permissions.d.ts +96 -94
  35. package/dist/lib/mysql/schemas/auth/permissions.js +5 -1
  36. package/dist/lib/mysql/schemas/auth/role-permissions.cjs +146 -13
  37. package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
  38. package/dist/lib/mysql/schemas/auth/role-permissions.d.ts +85 -82
  39. package/dist/lib/mysql/schemas/auth/role-permissions.js +5 -1
  40. package/dist/lib/mysql/schemas/auth/roles.cjs +110 -14
  41. package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
  42. package/dist/lib/mysql/schemas/auth/roles.d.ts +96 -94
  43. package/dist/lib/mysql/schemas/auth/roles.js +5 -1
  44. package/dist/lib/mysql/schemas/auth/sessions.cjs +117 -10
  45. package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
  46. package/dist/lib/mysql/schemas/auth/sessions.d.ts +48 -46
  47. package/dist/lib/mysql/schemas/auth/sessions.js +6 -1
  48. package/dist/lib/mysql/schemas/auth/user-permissions.cjs +156 -15
  49. package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
  50. package/dist/lib/mysql/schemas/auth/user-permissions.d.ts +85 -82
  51. package/dist/lib/mysql/schemas/auth/user-permissions.js +5 -1
  52. package/dist/lib/mysql/schemas/auth/user-roles.cjs +152 -13
  53. package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
  54. package/dist/lib/mysql/schemas/auth/user-roles.d.ts +85 -82
  55. package/dist/lib/mysql/schemas/auth/user-roles.js +5 -1
  56. package/dist/lib/mysql/schemas/auth/users.cjs +311 -14
  57. package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
  58. package/dist/lib/mysql/schemas/auth/users.d.ts +101 -94
  59. package/dist/lib/mysql/schemas/auth/users.js +5 -1
  60. package/dist/lib/mysql/schemas/auth/verification-tokens.cjs +4 -6
  61. package/dist/lib/mysql/schemas/auth/verification-tokens.cjs.map +1 -1
  62. package/dist/lib/mysql/schemas/auth/verification-tokens.d.ts +55 -57
  63. package/dist/lib/mysql/schemas/auth/verification-tokens.js +1 -1
  64. package/dist/lib/mysql/schemas/commerce/coupon.cjs +4 -6
  65. package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
  66. package/dist/lib/mysql/schemas/commerce/coupon.d.ts +163 -165
  67. package/dist/lib/mysql/schemas/commerce/coupon.js +1 -1
  68. package/dist/lib/mysql/schemas/commerce/merchant-account.cjs +4 -6
  69. package/dist/lib/mysql/schemas/commerce/merchant-account.cjs.map +1 -1
  70. package/dist/lib/mysql/schemas/commerce/merchant-account.d.ts +67 -69
  71. package/dist/lib/mysql/schemas/commerce/merchant-account.js +1 -1
  72. package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs +4 -6
  73. package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs.map +1 -1
  74. package/dist/lib/mysql/schemas/commerce/merchant-charge.d.ts +103 -105
  75. package/dist/lib/mysql/schemas/commerce/merchant-charge.js +1 -1
  76. package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs +4 -6
  77. package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs.map +1 -1
  78. package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.ts +79 -81
  79. package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +1 -1
  80. package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs +4 -6
  81. package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs.map +1 -1
  82. package/dist/lib/mysql/schemas/commerce/merchant-customer.d.ts +79 -81
  83. package/dist/lib/mysql/schemas/commerce/merchant-customer.js +1 -1
  84. package/dist/lib/mysql/schemas/commerce/merchant-price.cjs +4 -6
  85. package/dist/lib/mysql/schemas/commerce/merchant-price.cjs.map +1 -1
  86. package/dist/lib/mysql/schemas/commerce/merchant-price.d.ts +91 -93
  87. package/dist/lib/mysql/schemas/commerce/merchant-price.js +1 -1
  88. package/dist/lib/mysql/schemas/commerce/merchant-product.cjs +4 -6
  89. package/dist/lib/mysql/schemas/commerce/merchant-product.cjs.map +1 -1
  90. package/dist/lib/mysql/schemas/commerce/merchant-product.d.ts +79 -81
  91. package/dist/lib/mysql/schemas/commerce/merchant-product.js +1 -1
  92. package/dist/lib/mysql/schemas/commerce/merchant-session.cjs +4 -6
  93. package/dist/lib/mysql/schemas/commerce/merchant-session.cjs.map +1 -1
  94. package/dist/lib/mysql/schemas/commerce/merchant-session.d.ts +43 -45
  95. package/dist/lib/mysql/schemas/commerce/merchant-session.js +1 -1
  96. package/dist/lib/mysql/schemas/commerce/price.cjs +4 -6
  97. package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
  98. package/dist/lib/mysql/schemas/commerce/price.d.ts +91 -93
  99. package/dist/lib/mysql/schemas/commerce/price.js +1 -1
  100. package/dist/lib/mysql/schemas/commerce/product.cjs +4 -6
  101. package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
  102. package/dist/lib/mysql/schemas/commerce/product.d.ts +91 -93
  103. package/dist/lib/mysql/schemas/commerce/product.js +1 -1
  104. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +4 -6
  105. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
  106. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.ts +127 -129
  107. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +1 -1
  108. package/dist/lib/mysql/schemas/commerce/purchase.cjs +4 -6
  109. package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
  110. package/dist/lib/mysql/schemas/commerce/purchase.d.ts +211 -213
  111. package/dist/lib/mysql/schemas/commerce/purchase.js +1 -1
  112. package/dist/lib/mysql/schemas/communication/communication-channel.cjs +4 -6
  113. package/dist/lib/mysql/schemas/communication/communication-channel.cjs.map +1 -1
  114. package/dist/lib/mysql/schemas/communication/communication-channel.d.ts +91 -93
  115. package/dist/lib/mysql/schemas/communication/communication-channel.js +1 -1
  116. package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs +4 -6
  117. package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs.map +1 -1
  118. package/dist/lib/mysql/schemas/communication/communication-preference-types.d.ts +91 -93
  119. package/dist/lib/mysql/schemas/communication/communication-preference-types.js +1 -1
  120. package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +193 -20
  121. package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
  122. package/dist/lib/mysql/schemas/communication/communication-preferences.d.ts +146 -142
  123. package/dist/lib/mysql/schemas/communication/communication-preferences.js +5 -1
  124. package/dist/lib/mysql/schemas/content/content-contributions.cjs +202 -17
  125. package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
  126. package/dist/lib/mysql/schemas/content/content-contributions.d.ts +110 -106
  127. package/dist/lib/mysql/schemas/content/content-contributions.js +5 -1
  128. package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +128 -18
  129. package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
  130. package/dist/lib/mysql/schemas/content/content-resource-resource.d.ts +97 -94
  131. package/dist/lib/mysql/schemas/content/content-resource-resource.js +5 -1
  132. package/dist/lib/mysql/schemas/content/content-resource.cjs +199 -18
  133. package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
  134. package/dist/lib/mysql/schemas/content/content-resource.d.ts +99 -94
  135. package/dist/lib/mysql/schemas/content/content-resource.js +5 -1
  136. package/dist/lib/mysql/schemas/content/contribution-types.cjs +113 -16
  137. package/dist/lib/mysql/schemas/content/contribution-types.cjs.map +1 -1
  138. package/dist/lib/mysql/schemas/content/contribution-types.d.ts +108 -106
  139. package/dist/lib/mysql/schemas/content/contribution-types.js +5 -1
  140. package/dist/lib/mysql/schemas/content/resource-progress.cjs +4 -6
  141. package/dist/lib/mysql/schemas/content/resource-progress.cjs.map +1 -1
  142. package/dist/lib/mysql/schemas/content/resource-progress.d.ts +79 -81
  143. package/dist/lib/mysql/schemas/content/resource-progress.js +1 -1
  144. package/dist/lib/pg.d.ts +1 -1
  145. package/dist/lib/sqlite.cjs.map +1 -1
  146. package/dist/lib/sqlite.d.ts +45 -46
  147. package/dist/lib/sqlite.js +2 -2
  148. package/dist/lib/utils.cjs.map +1 -1
  149. package/dist/lib/utils.d.ts +1 -31
  150. package/dist/lib/utils.js +1 -1
  151. package/package.json +9 -5
  152. package/src/index.ts +1 -1
  153. package/src/lib/mysql/index.ts +115 -77
  154. package/src/lib/mysql/schemas/auth/accounts.ts +12 -3
  155. package/src/lib/mysql/schemas/auth/permissions.ts +10 -3
  156. package/src/lib/mysql/schemas/auth/role-permissions.ts +21 -3
  157. package/src/lib/mysql/schemas/auth/roles.ts +12 -3
  158. package/src/lib/mysql/schemas/auth/sessions.ts +12 -3
  159. package/src/lib/mysql/schemas/auth/user-permissions.ts +21 -3
  160. package/src/lib/mysql/schemas/auth/user-roles.ts +21 -3
  161. package/src/lib/mysql/schemas/auth/users.ts +27 -3
  162. package/src/lib/mysql/schemas/auth/verification-tokens.ts +2 -4
  163. package/src/lib/mysql/schemas/commerce/coupon.ts +2 -4
  164. package/src/lib/mysql/schemas/commerce/merchant-account.ts +2 -4
  165. package/src/lib/mysql/schemas/commerce/merchant-charge.ts +2 -4
  166. package/src/lib/mysql/schemas/commerce/merchant-coupon.ts +2 -4
  167. package/src/lib/mysql/schemas/commerce/merchant-customer.ts +2 -4
  168. package/src/lib/mysql/schemas/commerce/merchant-price.ts +2 -4
  169. package/src/lib/mysql/schemas/commerce/merchant-product.ts +2 -4
  170. package/src/lib/mysql/schemas/commerce/merchant-session.ts +2 -4
  171. package/src/lib/mysql/schemas/commerce/price.ts +2 -4
  172. package/src/lib/mysql/schemas/commerce/product.ts +2 -4
  173. package/src/lib/mysql/schemas/commerce/purchase-user-transfer.ts +2 -4
  174. package/src/lib/mysql/schemas/commerce/purchase.ts +2 -4
  175. package/src/lib/mysql/schemas/communication/communication-channel.ts +2 -4
  176. package/src/lib/mysql/schemas/communication/communication-preference-types.ts +20 -25
  177. package/src/lib/mysql/schemas/communication/communication-preferences.ts +30 -3
  178. package/src/lib/mysql/schemas/content/content-contributions.ts +31 -3
  179. package/src/lib/mysql/schemas/content/content-resource-resource.ts +23 -4
  180. package/src/lib/mysql/schemas/content/content-resource.ts +22 -4
  181. package/src/lib/mysql/schemas/content/contribution-types.ts +13 -3
  182. package/src/lib/mysql/schemas/content/resource-progress.ts +2 -4
  183. package/src/lib/utils.ts +1 -1
  184. package/dist/chunk-7Z72PW3G.js +0 -60
  185. package/dist/chunk-C2G2KMWQ.js +0 -48
  186. package/dist/chunk-GJZCLS2Y.js +0 -29
  187. package/dist/chunk-HHQK736S.js +0 -40
  188. package/dist/chunk-I4NIW2NF.js +0 -46
  189. package/dist/chunk-IHQ3ARH4.js +0 -44
  190. package/dist/chunk-KEJBPPZC.js +0 -45
  191. package/dist/chunk-L3XBKPYA.js +0 -47
  192. package/dist/chunk-MHZHMZ5C.js +0 -47
  193. package/dist/chunk-MOO56C62.js +0 -46
  194. package/dist/chunk-RLTOQRJB.js +0 -40
  195. package/dist/chunk-SWOTLIQI.js +0 -46
  196. package/dist/chunk-XM4CEU6B.js +0 -54
@@ -22,54 +22,35 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
22
  var mysql_exports = {};
23
23
  __export(mysql_exports, {
24
24
  createTables: () => createTables,
25
- getAccountsSchema: () => getAccountsSchema,
26
- getCommunicationChannelSchema: () => getCommunicationChannelSchema,
27
- getCommunicationPreferenceTypesSchema: () => getCommunicationPreferenceTypesSchema,
28
- getCommunicationPreferencesSchema: () => getCommunicationPreferencesSchema,
29
- getContentContributionsSchema: () => getContentContributionsSchema,
30
- getContentResourceResourceSchema: () => getContentResourceResourceSchema,
31
- getContentResourceSchema: () => getContentResourceSchema,
32
- getContributionTypesSchema: () => getContributionTypesSchema,
33
- getCouponSchema: () => getCouponSchema,
34
- getMerchantAccountSchema: () => getMerchantAccountSchema,
35
- getMerchantChargeSchema: () => getMerchantChargeSchema,
36
- getMerchantCouponSchema: () => getMerchantCouponSchema,
37
- getMerchantCustomerSchema: () => getMerchantCustomerSchema,
38
- getMerchantPriceSchema: () => getMerchantPriceSchema,
39
- getMerchantProductSchema: () => getMerchantProductSchema,
40
- getMerchantSessionSchema: () => getMerchantSessionSchema,
41
- getPermissionsSchema: () => getPermissionsSchema,
42
- getPriceSchema: () => getPriceSchema,
43
- getProductSchema: () => getProductSchema,
44
- getPurchaseSchema: () => getPurchaseSchema,
45
- getPurchaseUserTransferSchema: () => getPurchaseUserTransferSchema,
46
- getResourceProgressSchema: () => getResourceProgressSchema,
47
- getRolePermissionsSchema: () => getRolePermissionsSchema,
48
- getRolesSchema: () => getRolesSchema,
49
- getSessionsSchema: () => getSessionsSchema,
50
- getUserPermissionsSchema: () => getUserPermissionsSchema,
51
- getUserRolesSchema: () => getUserRolesSchema,
52
- getUsersSchema: () => getUsersSchema,
53
- getVerificationTokensSchema: () => getVerificationTokensSchema,
25
+ getCourseBuilderSchema: () => getCourseBuilderSchema,
54
26
  mySqlDrizzleAdapter: () => mySqlDrizzleAdapter
55
27
  });
56
28
  module.exports = __toCommonJS(mysql_exports);
57
29
  var import_date_fns = require("date-fns");
58
- var import_drizzle_orm15 = require("drizzle-orm");
30
+ var import_drizzle_orm25 = require("drizzle-orm");
59
31
  var import_mysql_core30 = require("drizzle-orm/mysql-core");
60
32
 
61
- // ../../node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs
33
+ // ../core/dist/chunk-DFHEFTJZ.js
34
+ var __defProp2 = Object.defineProperty;
35
+ var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
36
+ value,
37
+ configurable: true
38
+ }), "__name");
39
+
40
+ // ../core/dist/chunk-EK2ZQYRJ.js
62
41
  var util;
63
42
  (function(util2) {
64
43
  util2.assertEqual = (val) => val;
65
44
  function assertIs(_arg) {
66
45
  }
67
46
  __name(assertIs, "assertIs");
47
+ __name2(assertIs, "assertIs");
68
48
  util2.assertIs = assertIs;
69
49
  function assertNever(_x) {
70
50
  throw new Error();
71
51
  }
72
52
  __name(assertNever, "assertNever");
53
+ __name2(assertNever, "assertNever");
73
54
  util2.assertNever = assertNever;
74
55
  util2.arrayToEnum = (items) => {
75
56
  const obj = {};
@@ -112,6 +93,7 @@ var util;
112
93
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
113
94
  }
114
95
  __name(joinValues, "joinValues");
96
+ __name2(joinValues, "joinValues");
115
97
  util2.joinValues = joinValues;
116
98
  util2.jsonStringifyReplacer = (_, value) => {
117
99
  if (typeof value === "bigint") {
@@ -126,7 +108,6 @@ var objectUtil;
126
108
  return {
127
109
  ...first,
128
110
  ...second
129
- // second overwrites first
130
111
  };
131
112
  };
132
113
  })(objectUtil || (objectUtil = {}));
@@ -152,7 +133,7 @@ var ZodParsedType = util.arrayToEnum([
152
133
  "map",
153
134
  "set"
154
135
  ]);
155
- var getParsedType = /* @__PURE__ */ __name((data) => {
136
+ var getParsedType = /* @__PURE__ */ __name2((data) => {
156
137
  const t = typeof data;
157
138
  switch (t) {
158
139
  case "undefined":
@@ -211,19 +192,25 @@ var ZodIssueCode = util.arrayToEnum([
211
192
  "not_multiple_of",
212
193
  "not_finite"
213
194
  ]);
214
- var quotelessJson = /* @__PURE__ */ __name((obj) => {
195
+ var quotelessJson = /* @__PURE__ */ __name2((obj) => {
215
196
  const json8 = JSON.stringify(obj, null, 2);
216
197
  return json8.replace(/"([^"]+)":/g, "$1:");
217
198
  }, "quotelessJson");
218
- var ZodError = class extends Error {
199
+ var ZodError = /* @__PURE__ */ __name(class extends Error {
219
200
  constructor(issues) {
220
201
  super();
221
202
  this.issues = [];
222
203
  this.addIssue = (sub) => {
223
- this.issues = [...this.issues, sub];
204
+ this.issues = [
205
+ ...this.issues,
206
+ sub
207
+ ];
224
208
  };
225
209
  this.addIssues = (subs = []) => {
226
- this.issues = [...this.issues, ...subs];
210
+ this.issues = [
211
+ ...this.issues,
212
+ ...subs
213
+ ];
227
214
  };
228
215
  const actualProto = new.target.prototype;
229
216
  if (Object.setPrototypeOf) {
@@ -241,8 +228,10 @@ var ZodError = class extends Error {
241
228
  const mapper = _mapper || function(issue) {
242
229
  return issue.message;
243
230
  };
244
- const fieldErrors = { _errors: [] };
245
- const processError = /* @__PURE__ */ __name((error) => {
231
+ const fieldErrors = {
232
+ _errors: []
233
+ };
234
+ const processError = /* @__PURE__ */ __name2((error) => {
246
235
  for (const issue of error.issues) {
247
236
  if (issue.code === "invalid_union") {
248
237
  issue.unionErrors.map(processError);
@@ -259,9 +248,13 @@ var ZodError = class extends Error {
259
248
  const el = issue.path[i];
260
249
  const terminal = i === issue.path.length - 1;
261
250
  if (!terminal) {
262
- curr[el] = curr[el] || { _errors: [] };
251
+ curr[el] = curr[el] || {
252
+ _errors: []
253
+ };
263
254
  } else {
264
- curr[el] = curr[el] || { _errors: [] };
255
+ curr[el] = curr[el] || {
256
+ _errors: []
257
+ };
265
258
  curr[el]._errors.push(mapper(issue));
266
259
  }
267
260
  curr = curr[el];
@@ -293,18 +286,21 @@ var ZodError = class extends Error {
293
286
  formErrors.push(mapper(sub));
294
287
  }
295
288
  }
296
- return { formErrors, fieldErrors };
289
+ return {
290
+ formErrors,
291
+ fieldErrors
292
+ };
297
293
  }
298
294
  get formErrors() {
299
295
  return this.flatten();
300
296
  }
301
- };
302
- __name(ZodError, "ZodError");
297
+ }, "ZodError");
298
+ __name2(ZodError, "ZodError");
303
299
  ZodError.create = (issues) => {
304
300
  const error = new ZodError(issues);
305
301
  return error;
306
302
  };
307
- var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
303
+ var errorMap = /* @__PURE__ */ __name2((issue, _ctx) => {
308
304
  let message;
309
305
  switch (issue.code) {
310
306
  case ZodIssueCode.invalid_type:
@@ -400,20 +396,27 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
400
396
  message = _ctx.defaultError;
401
397
  util.assertNever(issue);
402
398
  }
403
- return { message };
399
+ return {
400
+ message
401
+ };
404
402
  }, "errorMap");
405
403
  var overrideErrorMap = errorMap;
406
404
  function setErrorMap(map) {
407
405
  overrideErrorMap = map;
408
406
  }
409
407
  __name(setErrorMap, "setErrorMap");
408
+ __name2(setErrorMap, "setErrorMap");
410
409
  function getErrorMap() {
411
410
  return overrideErrorMap;
412
411
  }
413
412
  __name(getErrorMap, "getErrorMap");
414
- var makeIssue = /* @__PURE__ */ __name((params) => {
413
+ __name2(getErrorMap, "getErrorMap");
414
+ var makeIssue = /* @__PURE__ */ __name2((params) => {
415
415
  const { data, path, errorMaps, issueData } = params;
416
- const fullPath = [...path, ...issueData.path || []];
416
+ const fullPath = [
417
+ ...path,
418
+ ...issueData.path || []
419
+ ];
417
420
  const fullIssue = {
418
421
  ...issueData,
419
422
  path: fullPath
@@ -421,7 +424,10 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
421
424
  let errorMessage = "";
422
425
  const maps = errorMaps.filter((m) => !!m).slice().reverse();
423
426
  for (const map of maps) {
424
- errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
427
+ errorMessage = map(fullIssue, {
428
+ data,
429
+ defaultError: errorMessage
430
+ }).message;
425
431
  }
426
432
  return {
427
433
  ...issueData,
@@ -440,13 +446,13 @@ function addIssueToContext(ctx, issueData) {
440
446
  ctx.schemaErrorMap,
441
447
  getErrorMap(),
442
448
  errorMap
443
- // then global default map
444
449
  ].filter((x) => !!x)
445
450
  });
446
451
  ctx.common.issues.push(issue);
447
452
  }
448
453
  __name(addIssueToContext, "addIssueToContext");
449
- var ParseStatus = class {
454
+ __name2(addIssueToContext, "addIssueToContext");
455
+ var ParseStatus = /* @__PURE__ */ __name(class {
450
456
  constructor() {
451
457
  this.value = "valid";
452
458
  }
@@ -467,7 +473,10 @@ var ParseStatus = class {
467
473
  status.dirty();
468
474
  arrayValue.push(s.value);
469
475
  }
470
- return { status: status.value, value: arrayValue };
476
+ return {
477
+ status: status.value,
478
+ value: arrayValue
479
+ };
471
480
  }
472
481
  static async mergeObjectAsync(status, pairs) {
473
482
  const syncPairs = [];
@@ -495,25 +504,36 @@ var ParseStatus = class {
495
504
  finalObject[key.value] = value.value;
496
505
  }
497
506
  }
498
- return { status: status.value, value: finalObject };
507
+ return {
508
+ status: status.value,
509
+ value: finalObject
510
+ };
499
511
  }
500
- };
501
- __name(ParseStatus, "ParseStatus");
512
+ }, "ParseStatus");
513
+ __name2(ParseStatus, "ParseStatus");
502
514
  var INVALID = Object.freeze({
503
515
  status: "aborted"
504
516
  });
505
- var DIRTY = /* @__PURE__ */ __name((value) => ({ status: "dirty", value }), "DIRTY");
506
- var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
507
- var isAborted = /* @__PURE__ */ __name((x) => x.status === "aborted", "isAborted");
508
- var isDirty = /* @__PURE__ */ __name((x) => x.status === "dirty", "isDirty");
509
- var isValid = /* @__PURE__ */ __name((x) => x.status === "valid", "isValid");
510
- var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
517
+ var DIRTY = /* @__PURE__ */ __name2((value) => ({
518
+ status: "dirty",
519
+ value
520
+ }), "DIRTY");
521
+ var OK = /* @__PURE__ */ __name2((value) => ({
522
+ status: "valid",
523
+ value
524
+ }), "OK");
525
+ var isAborted = /* @__PURE__ */ __name2((x) => x.status === "aborted", "isAborted");
526
+ var isDirty = /* @__PURE__ */ __name2((x) => x.status === "dirty", "isDirty");
527
+ var isValid = /* @__PURE__ */ __name2((x) => x.status === "valid", "isValid");
528
+ var isAsync = /* @__PURE__ */ __name2((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
511
529
  var errorUtil;
512
530
  (function(errorUtil2) {
513
- errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
531
+ errorUtil2.errToObj = (message) => typeof message === "string" ? {
532
+ message
533
+ } : message || {};
514
534
  errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
515
535
  })(errorUtil || (errorUtil = {}));
516
- var ParseInputLazyPath = class {
536
+ var ParseInputLazyPath = /* @__PURE__ */ __name(class {
517
537
  constructor(parent, value, path, key) {
518
538
  this._cachedPath = [];
519
539
  this.parent = parent;
@@ -531,11 +551,14 @@ var ParseInputLazyPath = class {
531
551
  }
532
552
  return this._cachedPath;
533
553
  }
534
- };
535
- __name(ParseInputLazyPath, "ParseInputLazyPath");
536
- var handleResult = /* @__PURE__ */ __name((ctx, result) => {
554
+ }, "ParseInputLazyPath");
555
+ __name2(ParseInputLazyPath, "ParseInputLazyPath");
556
+ var handleResult = /* @__PURE__ */ __name2((ctx, result) => {
537
557
  if (isValid(result)) {
538
- return { success: true, data: result.value };
558
+ return {
559
+ success: true,
560
+ data: result.value
561
+ };
539
562
  } else {
540
563
  if (!ctx.common.issues.length) {
541
564
  throw new Error("Validation failed but no issues detected.");
@@ -560,19 +583,32 @@ function processCreateParams(params) {
560
583
  throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
561
584
  }
562
585
  if (errorMap2)
563
- return { errorMap: errorMap2, description };
564
- const customMap = /* @__PURE__ */ __name((iss, ctx) => {
586
+ return {
587
+ errorMap: errorMap2,
588
+ description
589
+ };
590
+ const customMap = /* @__PURE__ */ __name2((iss, ctx) => {
565
591
  if (iss.code !== "invalid_type")
566
- return { message: ctx.defaultError };
592
+ return {
593
+ message: ctx.defaultError
594
+ };
567
595
  if (typeof ctx.data === "undefined") {
568
- return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
596
+ return {
597
+ message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError
598
+ };
569
599
  }
570
- return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
600
+ return {
601
+ message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError
602
+ };
571
603
  }, "customMap");
572
- return { errorMap: customMap, description };
604
+ return {
605
+ errorMap: customMap,
606
+ description
607
+ };
573
608
  }
574
609
  __name(processCreateParams, "processCreateParams");
575
- var ZodType = class {
610
+ __name2(processCreateParams, "processCreateParams");
611
+ var ZodType = /* @__PURE__ */ __name(class {
576
612
  constructor(def) {
577
613
  this.spa = this.safeParseAsync;
578
614
  this._def = def;
@@ -661,7 +697,11 @@ var ZodType = class {
661
697
  data,
662
698
  parsedType: getParsedType(data)
663
699
  };
664
- const result = this._parseSync({ data, path: ctx.path, parent: ctx });
700
+ const result = this._parseSync({
701
+ data,
702
+ path: ctx.path,
703
+ parent: ctx
704
+ });
665
705
  return handleResult(ctx, result);
666
706
  }
667
707
  async parseAsync(data, params) {
@@ -683,14 +723,20 @@ var ZodType = class {
683
723
  data,
684
724
  parsedType: getParsedType(data)
685
725
  };
686
- const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
726
+ const maybeAsyncResult = this._parse({
727
+ data,
728
+ path: ctx.path,
729
+ parent: ctx
730
+ });
687
731
  const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
688
732
  return handleResult(ctx, result);
689
733
  }
690
734
  refine(check, message) {
691
- const getIssueProperties = /* @__PURE__ */ __name((val) => {
735
+ const getIssueProperties = /* @__PURE__ */ __name2((val) => {
692
736
  if (typeof message === "string" || typeof message === "undefined") {
693
- return { message };
737
+ return {
738
+ message
739
+ };
694
740
  } else if (typeof message === "function") {
695
741
  return message(val);
696
742
  } else {
@@ -699,7 +745,7 @@ var ZodType = class {
699
745
  }, "getIssueProperties");
700
746
  return this._refinement((val, ctx) => {
701
747
  const result = check(val);
702
- const setError = /* @__PURE__ */ __name(() => ctx.addIssue({
748
+ const setError = /* @__PURE__ */ __name2(() => ctx.addIssue({
703
749
  code: ZodIssueCode.custom,
704
750
  ...getIssueProperties(val)
705
751
  }), "setError");
@@ -735,7 +781,10 @@ var ZodType = class {
735
781
  return new ZodEffects({
736
782
  schema: this,
737
783
  typeName: ZodFirstPartyTypeKind.ZodEffects,
738
- effect: { type: "refinement", refinement }
784
+ effect: {
785
+ type: "refinement",
786
+ refinement
787
+ }
739
788
  });
740
789
  }
741
790
  superRefine(refinement) {
@@ -757,7 +806,10 @@ var ZodType = class {
757
806
  return ZodPromise.create(this, this._def);
758
807
  }
759
808
  or(option) {
760
- return ZodUnion.create([this, option], this._def);
809
+ return ZodUnion.create([
810
+ this,
811
+ option
812
+ ], this._def);
761
813
  }
762
814
  and(incoming) {
763
815
  return ZodIntersection.create(this, incoming, this._def);
@@ -767,7 +819,10 @@ var ZodType = class {
767
819
  ...processCreateParams(this._def),
768
820
  schema: this,
769
821
  typeName: ZodFirstPartyTypeKind.ZodEffects,
770
- effect: { type: "transform", transform }
822
+ effect: {
823
+ type: "transform",
824
+ transform
825
+ }
771
826
  });
772
827
  }
773
828
  default(def) {
@@ -814,8 +869,8 @@ var ZodType = class {
814
869
  isNullable() {
815
870
  return this.safeParse(null).success;
816
871
  }
817
- };
818
- __name(ZodType, "ZodType");
872
+ }, "ZodType");
873
+ __name2(ZodType, "ZodType");
819
874
  var cuidRegex = /^c[^\s-]{8,}$/i;
820
875
  var cuid2Regex = /^[a-z][a-z0-9]*$/;
821
876
  var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
@@ -825,7 +880,7 @@ var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
825
880
  var emojiRegex;
826
881
  var ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
827
882
  var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
828
- var datetimeRegex = /* @__PURE__ */ __name((args) => {
883
+ var datetimeRegex = /* @__PURE__ */ __name2((args) => {
829
884
  if (args.precision) {
830
885
  if (args.offset) {
831
886
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
@@ -856,7 +911,8 @@ function isValidIP(ip, version) {
856
911
  return false;
857
912
  }
858
913
  __name(isValidIP, "isValidIP");
859
- var ZodString = class extends ZodType {
914
+ __name2(isValidIP, "isValidIP");
915
+ var ZodString = /* @__PURE__ */ __name(class extends ZodType {
860
916
  _parse(input) {
861
917
  if (this._def.coerce) {
862
918
  input.data = String(input.data);
@@ -864,15 +920,11 @@ var ZodString = class extends ZodType {
864
920
  const parsedType = this._getType(input);
865
921
  if (parsedType !== ZodParsedType.string) {
866
922
  const ctx2 = this._getOrReturnCtx(input);
867
- addIssueToContext(
868
- ctx2,
869
- {
870
- code: ZodIssueCode.invalid_type,
871
- expected: ZodParsedType.string,
872
- received: ctx2.parsedType
873
- }
874
- //
875
- );
923
+ addIssueToContext(ctx2, {
924
+ code: ZodIssueCode.invalid_type,
925
+ expected: ZodParsedType.string,
926
+ received: ctx2.parsedType
927
+ });
876
928
  return INVALID;
877
929
  }
878
930
  const status = new ParseStatus();
@@ -1024,7 +1076,10 @@ var ZodString = class extends ZodType {
1024
1076
  ctx = this._getOrReturnCtx(input, ctx);
1025
1077
  addIssueToContext(ctx, {
1026
1078
  code: ZodIssueCode.invalid_string,
1027
- validation: { includes: check.value, position: check.position },
1079
+ validation: {
1080
+ includes: check.value,
1081
+ position: check.position
1082
+ },
1028
1083
  message: check.message
1029
1084
  });
1030
1085
  status.dirty();
@@ -1038,7 +1093,9 @@ var ZodString = class extends ZodType {
1038
1093
  ctx = this._getOrReturnCtx(input, ctx);
1039
1094
  addIssueToContext(ctx, {
1040
1095
  code: ZodIssueCode.invalid_string,
1041
- validation: { startsWith: check.value },
1096
+ validation: {
1097
+ startsWith: check.value
1098
+ },
1042
1099
  message: check.message
1043
1100
  });
1044
1101
  status.dirty();
@@ -1048,7 +1105,9 @@ var ZodString = class extends ZodType {
1048
1105
  ctx = this._getOrReturnCtx(input, ctx);
1049
1106
  addIssueToContext(ctx, {
1050
1107
  code: ZodIssueCode.invalid_string,
1051
- validation: { endsWith: check.value },
1108
+ validation: {
1109
+ endsWith: check.value
1110
+ },
1052
1111
  message: check.message
1053
1112
  });
1054
1113
  status.dirty();
@@ -1078,7 +1137,10 @@ var ZodString = class extends ZodType {
1078
1137
  util.assertNever(check);
1079
1138
  }
1080
1139
  }
1081
- return { status: status.value, value: input.data };
1140
+ return {
1141
+ status: status.value,
1142
+ value: input.data
1143
+ };
1082
1144
  }
1083
1145
  _regex(regex, validation, message) {
1084
1146
  return this.refinement((data) => regex.test(data), {
@@ -1090,32 +1152,59 @@ var ZodString = class extends ZodType {
1090
1152
  _addCheck(check) {
1091
1153
  return new ZodString({
1092
1154
  ...this._def,
1093
- checks: [...this._def.checks, check]
1155
+ checks: [
1156
+ ...this._def.checks,
1157
+ check
1158
+ ]
1094
1159
  });
1095
1160
  }
1096
1161
  email(message) {
1097
- return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
1162
+ return this._addCheck({
1163
+ kind: "email",
1164
+ ...errorUtil.errToObj(message)
1165
+ });
1098
1166
  }
1099
1167
  url(message) {
1100
- return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
1168
+ return this._addCheck({
1169
+ kind: "url",
1170
+ ...errorUtil.errToObj(message)
1171
+ });
1101
1172
  }
1102
1173
  emoji(message) {
1103
- return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
1174
+ return this._addCheck({
1175
+ kind: "emoji",
1176
+ ...errorUtil.errToObj(message)
1177
+ });
1104
1178
  }
1105
1179
  uuid(message) {
1106
- return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
1180
+ return this._addCheck({
1181
+ kind: "uuid",
1182
+ ...errorUtil.errToObj(message)
1183
+ });
1107
1184
  }
1108
1185
  cuid(message) {
1109
- return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
1186
+ return this._addCheck({
1187
+ kind: "cuid",
1188
+ ...errorUtil.errToObj(message)
1189
+ });
1110
1190
  }
1111
1191
  cuid2(message) {
1112
- return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
1192
+ return this._addCheck({
1193
+ kind: "cuid2",
1194
+ ...errorUtil.errToObj(message)
1195
+ });
1113
1196
  }
1114
1197
  ulid(message) {
1115
- return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
1198
+ return this._addCheck({
1199
+ kind: "ulid",
1200
+ ...errorUtil.errToObj(message)
1201
+ });
1116
1202
  }
1117
1203
  ip(options) {
1118
- return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
1204
+ return this._addCheck({
1205
+ kind: "ip",
1206
+ ...errorUtil.errToObj(options)
1207
+ });
1119
1208
  }
1120
1209
  datetime(options) {
1121
1210
  var _a;
@@ -1185,28 +1274,43 @@ var ZodString = class extends ZodType {
1185
1274
  });
1186
1275
  }
1187
1276
  /**
1188
- * @deprecated Use z.string().min(1) instead.
1189
- * @see {@link ZodString.min}
1190
- */
1277
+ * @deprecated Use z.string().min(1) instead.
1278
+ * @see {@link ZodString.min}
1279
+ */
1191
1280
  nonempty(message) {
1192
1281
  return this.min(1, errorUtil.errToObj(message));
1193
1282
  }
1194
1283
  trim() {
1195
1284
  return new ZodString({
1196
1285
  ...this._def,
1197
- checks: [...this._def.checks, { kind: "trim" }]
1286
+ checks: [
1287
+ ...this._def.checks,
1288
+ {
1289
+ kind: "trim"
1290
+ }
1291
+ ]
1198
1292
  });
1199
1293
  }
1200
1294
  toLowerCase() {
1201
1295
  return new ZodString({
1202
1296
  ...this._def,
1203
- checks: [...this._def.checks, { kind: "toLowerCase" }]
1297
+ checks: [
1298
+ ...this._def.checks,
1299
+ {
1300
+ kind: "toLowerCase"
1301
+ }
1302
+ ]
1204
1303
  });
1205
1304
  }
1206
1305
  toUpperCase() {
1207
1306
  return new ZodString({
1208
1307
  ...this._def,
1209
- checks: [...this._def.checks, { kind: "toUpperCase" }]
1308
+ checks: [
1309
+ ...this._def.checks,
1310
+ {
1311
+ kind: "toUpperCase"
1312
+ }
1313
+ ]
1210
1314
  });
1211
1315
  }
1212
1316
  get isDatetime() {
@@ -1256,8 +1360,8 @@ var ZodString = class extends ZodType {
1256
1360
  }
1257
1361
  return max;
1258
1362
  }
1259
- };
1260
- __name(ZodString, "ZodString");
1363
+ }, "ZodString");
1364
+ __name2(ZodString, "ZodString");
1261
1365
  ZodString.create = (params) => {
1262
1366
  var _a;
1263
1367
  return new ZodString({
@@ -1276,7 +1380,8 @@ function floatSafeRemainder(val, step) {
1276
1380
  return valInt % stepInt / Math.pow(10, decCount);
1277
1381
  }
1278
1382
  __name(floatSafeRemainder, "floatSafeRemainder");
1279
- var ZodNumber = class extends ZodType {
1383
+ __name2(floatSafeRemainder, "floatSafeRemainder");
1384
+ var ZodNumber = /* @__PURE__ */ __name(class extends ZodType {
1280
1385
  constructor() {
1281
1386
  super(...arguments);
1282
1387
  this.min = this.gte;
@@ -1362,7 +1467,10 @@ var ZodNumber = class extends ZodType {
1362
1467
  util.assertNever(check);
1363
1468
  }
1364
1469
  }
1365
- return { status: status.value, value: input.data };
1470
+ return {
1471
+ status: status.value,
1472
+ value: input.data
1473
+ };
1366
1474
  }
1367
1475
  gte(value, message) {
1368
1476
  return this.setLimit("min", value, true, errorUtil.toString(message));
@@ -1393,7 +1501,10 @@ var ZodNumber = class extends ZodType {
1393
1501
  _addCheck(check) {
1394
1502
  return new ZodNumber({
1395
1503
  ...this._def,
1396
- checks: [...this._def.checks, check]
1504
+ checks: [
1505
+ ...this._def.checks,
1506
+ check
1507
+ ]
1397
1508
  });
1398
1509
  }
1399
1510
  int(message) {
@@ -1498,8 +1609,8 @@ var ZodNumber = class extends ZodType {
1498
1609
  }
1499
1610
  return Number.isFinite(min) && Number.isFinite(max);
1500
1611
  }
1501
- };
1502
- __name(ZodNumber, "ZodNumber");
1612
+ }, "ZodNumber");
1613
+ __name2(ZodNumber, "ZodNumber");
1503
1614
  ZodNumber.create = (params) => {
1504
1615
  return new ZodNumber({
1505
1616
  checks: [],
@@ -1508,7 +1619,7 @@ ZodNumber.create = (params) => {
1508
1619
  ...processCreateParams(params)
1509
1620
  });
1510
1621
  };
1511
- var ZodBigInt = class extends ZodType {
1622
+ var ZodBigInt = /* @__PURE__ */ __name(class extends ZodType {
1512
1623
  constructor() {
1513
1624
  super(...arguments);
1514
1625
  this.min = this.gte;
@@ -1571,7 +1682,10 @@ var ZodBigInt = class extends ZodType {
1571
1682
  util.assertNever(check);
1572
1683
  }
1573
1684
  }
1574
- return { status: status.value, value: input.data };
1685
+ return {
1686
+ status: status.value,
1687
+ value: input.data
1688
+ };
1575
1689
  }
1576
1690
  gte(value, message) {
1577
1691
  return this.setLimit("min", value, true, errorUtil.toString(message));
@@ -1602,7 +1716,10 @@ var ZodBigInt = class extends ZodType {
1602
1716
  _addCheck(check) {
1603
1717
  return new ZodBigInt({
1604
1718
  ...this._def,
1605
- checks: [...this._def.checks, check]
1719
+ checks: [
1720
+ ...this._def.checks,
1721
+ check
1722
+ ]
1606
1723
  });
1607
1724
  }
1608
1725
  positive(message) {
@@ -1664,8 +1781,8 @@ var ZodBigInt = class extends ZodType {
1664
1781
  }
1665
1782
  return max;
1666
1783
  }
1667
- };
1668
- __name(ZodBigInt, "ZodBigInt");
1784
+ }, "ZodBigInt");
1785
+ __name2(ZodBigInt, "ZodBigInt");
1669
1786
  ZodBigInt.create = (params) => {
1670
1787
  var _a;
1671
1788
  return new ZodBigInt({
@@ -1675,7 +1792,7 @@ ZodBigInt.create = (params) => {
1675
1792
  ...processCreateParams(params)
1676
1793
  });
1677
1794
  };
1678
- var ZodBoolean = class extends ZodType {
1795
+ var ZodBoolean = /* @__PURE__ */ __name(class extends ZodType {
1679
1796
  _parse(input) {
1680
1797
  if (this._def.coerce) {
1681
1798
  input.data = Boolean(input.data);
@@ -1692,8 +1809,8 @@ var ZodBoolean = class extends ZodType {
1692
1809
  }
1693
1810
  return OK(input.data);
1694
1811
  }
1695
- };
1696
- __name(ZodBoolean, "ZodBoolean");
1812
+ }, "ZodBoolean");
1813
+ __name2(ZodBoolean, "ZodBoolean");
1697
1814
  ZodBoolean.create = (params) => {
1698
1815
  return new ZodBoolean({
1699
1816
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
@@ -1701,7 +1818,7 @@ ZodBoolean.create = (params) => {
1701
1818
  ...processCreateParams(params)
1702
1819
  });
1703
1820
  };
1704
- var ZodDate = class extends ZodType {
1821
+ var ZodDate = /* @__PURE__ */ __name(class extends ZodType {
1705
1822
  _parse(input) {
1706
1823
  if (this._def.coerce) {
1707
1824
  input.data = new Date(input.data);
@@ -1764,7 +1881,10 @@ var ZodDate = class extends ZodType {
1764
1881
  _addCheck(check) {
1765
1882
  return new ZodDate({
1766
1883
  ...this._def,
1767
- checks: [...this._def.checks, check]
1884
+ checks: [
1885
+ ...this._def.checks,
1886
+ check
1887
+ ]
1768
1888
  });
1769
1889
  }
1770
1890
  min(minDate, message) {
@@ -1801,8 +1921,8 @@ var ZodDate = class extends ZodType {
1801
1921
  }
1802
1922
  return max != null ? new Date(max) : null;
1803
1923
  }
1804
- };
1805
- __name(ZodDate, "ZodDate");
1924
+ }, "ZodDate");
1925
+ __name2(ZodDate, "ZodDate");
1806
1926
  ZodDate.create = (params) => {
1807
1927
  return new ZodDate({
1808
1928
  checks: [],
@@ -1811,7 +1931,7 @@ ZodDate.create = (params) => {
1811
1931
  ...processCreateParams(params)
1812
1932
  });
1813
1933
  };
1814
- var ZodSymbol = class extends ZodType {
1934
+ var ZodSymbol = /* @__PURE__ */ __name(class extends ZodType {
1815
1935
  _parse(input) {
1816
1936
  const parsedType = this._getType(input);
1817
1937
  if (parsedType !== ZodParsedType.symbol) {
@@ -1825,15 +1945,15 @@ var ZodSymbol = class extends ZodType {
1825
1945
  }
1826
1946
  return OK(input.data);
1827
1947
  }
1828
- };
1829
- __name(ZodSymbol, "ZodSymbol");
1948
+ }, "ZodSymbol");
1949
+ __name2(ZodSymbol, "ZodSymbol");
1830
1950
  ZodSymbol.create = (params) => {
1831
1951
  return new ZodSymbol({
1832
1952
  typeName: ZodFirstPartyTypeKind.ZodSymbol,
1833
1953
  ...processCreateParams(params)
1834
1954
  });
1835
1955
  };
1836
- var ZodUndefined = class extends ZodType {
1956
+ var ZodUndefined = /* @__PURE__ */ __name(class extends ZodType {
1837
1957
  _parse(input) {
1838
1958
  const parsedType = this._getType(input);
1839
1959
  if (parsedType !== ZodParsedType.undefined) {
@@ -1847,15 +1967,15 @@ var ZodUndefined = class extends ZodType {
1847
1967
  }
1848
1968
  return OK(input.data);
1849
1969
  }
1850
- };
1851
- __name(ZodUndefined, "ZodUndefined");
1970
+ }, "ZodUndefined");
1971
+ __name2(ZodUndefined, "ZodUndefined");
1852
1972
  ZodUndefined.create = (params) => {
1853
1973
  return new ZodUndefined({
1854
1974
  typeName: ZodFirstPartyTypeKind.ZodUndefined,
1855
1975
  ...processCreateParams(params)
1856
1976
  });
1857
1977
  };
1858
- var ZodNull = class extends ZodType {
1978
+ var ZodNull = /* @__PURE__ */ __name(class extends ZodType {
1859
1979
  _parse(input) {
1860
1980
  const parsedType = this._getType(input);
1861
1981
  if (parsedType !== ZodParsedType.null) {
@@ -1869,15 +1989,15 @@ var ZodNull = class extends ZodType {
1869
1989
  }
1870
1990
  return OK(input.data);
1871
1991
  }
1872
- };
1873
- __name(ZodNull, "ZodNull");
1992
+ }, "ZodNull");
1993
+ __name2(ZodNull, "ZodNull");
1874
1994
  ZodNull.create = (params) => {
1875
1995
  return new ZodNull({
1876
1996
  typeName: ZodFirstPartyTypeKind.ZodNull,
1877
1997
  ...processCreateParams(params)
1878
1998
  });
1879
1999
  };
1880
- var ZodAny = class extends ZodType {
2000
+ var ZodAny = /* @__PURE__ */ __name(class extends ZodType {
1881
2001
  constructor() {
1882
2002
  super(...arguments);
1883
2003
  this._any = true;
@@ -1885,15 +2005,15 @@ var ZodAny = class extends ZodType {
1885
2005
  _parse(input) {
1886
2006
  return OK(input.data);
1887
2007
  }
1888
- };
1889
- __name(ZodAny, "ZodAny");
2008
+ }, "ZodAny");
2009
+ __name2(ZodAny, "ZodAny");
1890
2010
  ZodAny.create = (params) => {
1891
2011
  return new ZodAny({
1892
2012
  typeName: ZodFirstPartyTypeKind.ZodAny,
1893
2013
  ...processCreateParams(params)
1894
2014
  });
1895
2015
  };
1896
- var ZodUnknown = class extends ZodType {
2016
+ var ZodUnknown = /* @__PURE__ */ __name(class extends ZodType {
1897
2017
  constructor() {
1898
2018
  super(...arguments);
1899
2019
  this._unknown = true;
@@ -1901,15 +2021,15 @@ var ZodUnknown = class extends ZodType {
1901
2021
  _parse(input) {
1902
2022
  return OK(input.data);
1903
2023
  }
1904
- };
1905
- __name(ZodUnknown, "ZodUnknown");
2024
+ }, "ZodUnknown");
2025
+ __name2(ZodUnknown, "ZodUnknown");
1906
2026
  ZodUnknown.create = (params) => {
1907
2027
  return new ZodUnknown({
1908
2028
  typeName: ZodFirstPartyTypeKind.ZodUnknown,
1909
2029
  ...processCreateParams(params)
1910
2030
  });
1911
2031
  };
1912
- var ZodNever = class extends ZodType {
2032
+ var ZodNever = /* @__PURE__ */ __name(class extends ZodType {
1913
2033
  _parse(input) {
1914
2034
  const ctx = this._getOrReturnCtx(input);
1915
2035
  addIssueToContext(ctx, {
@@ -1919,15 +2039,15 @@ var ZodNever = class extends ZodType {
1919
2039
  });
1920
2040
  return INVALID;
1921
2041
  }
1922
- };
1923
- __name(ZodNever, "ZodNever");
2042
+ }, "ZodNever");
2043
+ __name2(ZodNever, "ZodNever");
1924
2044
  ZodNever.create = (params) => {
1925
2045
  return new ZodNever({
1926
2046
  typeName: ZodFirstPartyTypeKind.ZodNever,
1927
2047
  ...processCreateParams(params)
1928
2048
  });
1929
2049
  };
1930
- var ZodVoid = class extends ZodType {
2050
+ var ZodVoid = /* @__PURE__ */ __name(class extends ZodType {
1931
2051
  _parse(input) {
1932
2052
  const parsedType = this._getType(input);
1933
2053
  if (parsedType !== ZodParsedType.undefined) {
@@ -1941,15 +2061,15 @@ var ZodVoid = class extends ZodType {
1941
2061
  }
1942
2062
  return OK(input.data);
1943
2063
  }
1944
- };
1945
- __name(ZodVoid, "ZodVoid");
2064
+ }, "ZodVoid");
2065
+ __name2(ZodVoid, "ZodVoid");
1946
2066
  ZodVoid.create = (params) => {
1947
2067
  return new ZodVoid({
1948
2068
  typeName: ZodFirstPartyTypeKind.ZodVoid,
1949
2069
  ...processCreateParams(params)
1950
2070
  });
1951
2071
  };
1952
- var ZodArray = class extends ZodType {
2072
+ var ZodArray = /* @__PURE__ */ __name(class extends ZodType {
1953
2073
  _parse(input) {
1954
2074
  const { ctx, status } = this._processInputParams(input);
1955
2075
  const def = this._def;
@@ -2004,13 +2124,17 @@ var ZodArray = class extends ZodType {
2004
2124
  }
2005
2125
  }
2006
2126
  if (ctx.common.async) {
2007
- return Promise.all([...ctx.data].map((item, i) => {
2127
+ return Promise.all([
2128
+ ...ctx.data
2129
+ ].map((item, i) => {
2008
2130
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2009
2131
  })).then((result2) => {
2010
2132
  return ParseStatus.mergeArray(status, result2);
2011
2133
  });
2012
2134
  }
2013
- const result = [...ctx.data].map((item, i) => {
2135
+ const result = [
2136
+ ...ctx.data
2137
+ ].map((item, i) => {
2014
2138
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2015
2139
  });
2016
2140
  return ParseStatus.mergeArray(status, result);
@@ -2021,26 +2145,35 @@ var ZodArray = class extends ZodType {
2021
2145
  min(minLength, message) {
2022
2146
  return new ZodArray({
2023
2147
  ...this._def,
2024
- minLength: { value: minLength, message: errorUtil.toString(message) }
2148
+ minLength: {
2149
+ value: minLength,
2150
+ message: errorUtil.toString(message)
2151
+ }
2025
2152
  });
2026
2153
  }
2027
2154
  max(maxLength, message) {
2028
2155
  return new ZodArray({
2029
2156
  ...this._def,
2030
- maxLength: { value: maxLength, message: errorUtil.toString(message) }
2157
+ maxLength: {
2158
+ value: maxLength,
2159
+ message: errorUtil.toString(message)
2160
+ }
2031
2161
  });
2032
2162
  }
2033
2163
  length(len, message) {
2034
2164
  return new ZodArray({
2035
2165
  ...this._def,
2036
- exactLength: { value: len, message: errorUtil.toString(message) }
2166
+ exactLength: {
2167
+ value: len,
2168
+ message: errorUtil.toString(message)
2169
+ }
2037
2170
  });
2038
2171
  }
2039
2172
  nonempty(message) {
2040
2173
  return this.min(1, message);
2041
2174
  }
2042
- };
2043
- __name(ZodArray, "ZodArray");
2175
+ }, "ZodArray");
2176
+ __name2(ZodArray, "ZodArray");
2044
2177
  ZodArray.create = (schema, params) => {
2045
2178
  return new ZodArray({
2046
2179
  type: schema,
@@ -2078,7 +2211,8 @@ function deepPartialify(schema) {
2078
2211
  }
2079
2212
  }
2080
2213
  __name(deepPartialify, "deepPartialify");
2081
- var ZodObject = class extends ZodType {
2214
+ __name2(deepPartialify, "deepPartialify");
2215
+ var ZodObject = /* @__PURE__ */ __name(class extends ZodType {
2082
2216
  constructor() {
2083
2217
  super(...arguments);
2084
2218
  this._cached = null;
@@ -2090,7 +2224,10 @@ var ZodObject = class extends ZodType {
2090
2224
  return this._cached;
2091
2225
  const shape = this._def.shape();
2092
2226
  const keys = util.objectKeys(shape);
2093
- return this._cached = { shape, keys };
2227
+ return this._cached = {
2228
+ shape,
2229
+ keys
2230
+ };
2094
2231
  }
2095
2232
  _parse(input) {
2096
2233
  const parsedType = this._getType(input);
@@ -2118,7 +2255,10 @@ var ZodObject = class extends ZodType {
2118
2255
  const keyValidator = shape[key];
2119
2256
  const value = ctx.data[key];
2120
2257
  pairs.push({
2121
- key: { status: "valid", value: key },
2258
+ key: {
2259
+ status: "valid",
2260
+ value: key
2261
+ },
2122
2262
  value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
2123
2263
  alwaysSet: key in ctx.data
2124
2264
  });
@@ -2128,8 +2268,14 @@ var ZodObject = class extends ZodType {
2128
2268
  if (unknownKeys === "passthrough") {
2129
2269
  for (const key of extraKeys) {
2130
2270
  pairs.push({
2131
- key: { status: "valid", value: key },
2132
- value: { status: "valid", value: ctx.data[key] }
2271
+ key: {
2272
+ status: "valid",
2273
+ value: key
2274
+ },
2275
+ value: {
2276
+ status: "valid",
2277
+ value: ctx.data[key]
2278
+ }
2133
2279
  });
2134
2280
  }
2135
2281
  } else if (unknownKeys === "strict") {
@@ -2150,11 +2296,11 @@ var ZodObject = class extends ZodType {
2150
2296
  for (const key of extraKeys) {
2151
2297
  const value = ctx.data[key];
2152
2298
  pairs.push({
2153
- key: { status: "valid", value: key },
2154
- value: catchall._parse(
2155
- new ParseInputLazyPath(ctx, value, ctx.path, key)
2156
- //, ctx.child(key), value, getParsedType(value)
2157
- ),
2299
+ key: {
2300
+ status: "valid",
2301
+ value: key
2302
+ },
2303
+ value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
2158
2304
  alwaysSet: key in ctx.data
2159
2305
  });
2160
2306
  }
@@ -2240,10 +2386,10 @@ var ZodObject = class extends ZodType {
2240
2386
  });
2241
2387
  }
2242
2388
  /**
2243
- * Prior to zod@1.0.12 there was a bug in the
2244
- * inferred type of merged objects. Please
2245
- * upgrade if you are experiencing issues.
2246
- */
2389
+ * Prior to zod@1.0.12 there was a bug in the
2390
+ * inferred type of merged objects. Please
2391
+ * upgrade if you are experiencing issues.
2392
+ */
2247
2393
  merge(merging) {
2248
2394
  const merged = new ZodObject({
2249
2395
  unknownKeys: merging._def.unknownKeys,
@@ -2292,7 +2438,9 @@ var ZodObject = class extends ZodType {
2292
2438
  // return merged;
2293
2439
  // }
2294
2440
  setKey(key, schema) {
2295
- return this.augment({ [key]: schema });
2441
+ return this.augment({
2442
+ [key]: schema
2443
+ });
2296
2444
  }
2297
2445
  // merge<Incoming extends AnyZodObject>(
2298
2446
  // merging: Incoming
@@ -2346,8 +2494,8 @@ var ZodObject = class extends ZodType {
2346
2494
  });
2347
2495
  }
2348
2496
  /**
2349
- * @deprecated
2350
- */
2497
+ * @deprecated
2498
+ */
2351
2499
  deepPartial() {
2352
2500
  return deepPartialify(this);
2353
2501
  }
@@ -2388,8 +2536,8 @@ var ZodObject = class extends ZodType {
2388
2536
  keyof() {
2389
2537
  return createZodEnum(util.objectKeys(this.shape));
2390
2538
  }
2391
- };
2392
- __name(ZodObject, "ZodObject");
2539
+ }, "ZodObject");
2540
+ __name2(ZodObject, "ZodObject");
2393
2541
  ZodObject.create = (shape, params) => {
2394
2542
  return new ZodObject({
2395
2543
  shape: () => shape,
@@ -2417,7 +2565,7 @@ ZodObject.lazycreate = (shape, params) => {
2417
2565
  ...processCreateParams(params)
2418
2566
  });
2419
2567
  };
2420
- var ZodUnion = class extends ZodType {
2568
+ var ZodUnion = /* @__PURE__ */ __name(class extends ZodType {
2421
2569
  _parse(input) {
2422
2570
  const { ctx } = this._processInputParams(input);
2423
2571
  const options = this._def.options;
@@ -2441,6 +2589,7 @@ var ZodUnion = class extends ZodType {
2441
2589
  return INVALID;
2442
2590
  }
2443
2591
  __name(handleResults, "handleResults");
2592
+ __name2(handleResults, "handleResults");
2444
2593
  if (ctx.common.async) {
2445
2594
  return Promise.all(options.map(async (option) => {
2446
2595
  const childCtx = {
@@ -2480,7 +2629,10 @@ var ZodUnion = class extends ZodType {
2480
2629
  if (result.status === "valid") {
2481
2630
  return result;
2482
2631
  } else if (result.status === "dirty" && !dirty) {
2483
- dirty = { result, ctx: childCtx };
2632
+ dirty = {
2633
+ result,
2634
+ ctx: childCtx
2635
+ };
2484
2636
  }
2485
2637
  if (childCtx.common.issues.length) {
2486
2638
  issues.push(childCtx.common.issues);
@@ -2501,8 +2653,8 @@ var ZodUnion = class extends ZodType {
2501
2653
  get options() {
2502
2654
  return this._def.options;
2503
2655
  }
2504
- };
2505
- __name(ZodUnion, "ZodUnion");
2656
+ }, "ZodUnion");
2657
+ __name2(ZodUnion, "ZodUnion");
2506
2658
  ZodUnion.create = (types, params) => {
2507
2659
  return new ZodUnion({
2508
2660
  options: types,
@@ -2510,13 +2662,15 @@ ZodUnion.create = (types, params) => {
2510
2662
  ...processCreateParams(params)
2511
2663
  });
2512
2664
  };
2513
- var getDiscriminator = /* @__PURE__ */ __name((type) => {
2665
+ var getDiscriminator = /* @__PURE__ */ __name2((type) => {
2514
2666
  if (type instanceof ZodLazy) {
2515
2667
  return getDiscriminator(type.schema);
2516
2668
  } else if (type instanceof ZodEffects) {
2517
2669
  return getDiscriminator(type.innerType());
2518
2670
  } else if (type instanceof ZodLiteral) {
2519
- return [type.value];
2671
+ return [
2672
+ type.value
2673
+ ];
2520
2674
  } else if (type instanceof ZodEnum) {
2521
2675
  return type.options;
2522
2676
  } else if (type instanceof ZodNativeEnum) {
@@ -2524,14 +2678,18 @@ var getDiscriminator = /* @__PURE__ */ __name((type) => {
2524
2678
  } else if (type instanceof ZodDefault) {
2525
2679
  return getDiscriminator(type._def.innerType);
2526
2680
  } else if (type instanceof ZodUndefined) {
2527
- return [void 0];
2681
+ return [
2682
+ void 0
2683
+ ];
2528
2684
  } else if (type instanceof ZodNull) {
2529
- return [null];
2685
+ return [
2686
+ null
2687
+ ];
2530
2688
  } else {
2531
2689
  return null;
2532
2690
  }
2533
2691
  }, "getDiscriminator");
2534
- var ZodDiscriminatedUnion = class extends ZodType {
2692
+ var ZodDiscriminatedUnion = /* @__PURE__ */ __name(class extends ZodType {
2535
2693
  _parse(input) {
2536
2694
  const { ctx } = this._processInputParams(input);
2537
2695
  if (ctx.parsedType !== ZodParsedType.object) {
@@ -2549,7 +2707,9 @@ var ZodDiscriminatedUnion = class extends ZodType {
2549
2707
  addIssueToContext(ctx, {
2550
2708
  code: ZodIssueCode.invalid_union_discriminator,
2551
2709
  options: Array.from(this.optionsMap.keys()),
2552
- path: [discriminator]
2710
+ path: [
2711
+ discriminator
2712
+ ]
2553
2713
  });
2554
2714
  return INVALID;
2555
2715
  }
@@ -2577,13 +2737,13 @@ var ZodDiscriminatedUnion = class extends ZodType {
2577
2737
  return this._def.optionsMap;
2578
2738
  }
2579
2739
  /**
2580
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2581
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2582
- * have a different value for each object in the union.
2583
- * @param discriminator the name of the discriminator property
2584
- * @param types an array of object schemas
2585
- * @param params
2586
- */
2740
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2741
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2742
+ * have a different value for each object in the union.
2743
+ * @param discriminator the name of the discriminator property
2744
+ * @param types an array of object schemas
2745
+ * @param params
2746
+ */
2587
2747
  static create(discriminator, options, params) {
2588
2748
  const optionsMap = /* @__PURE__ */ new Map();
2589
2749
  for (const type of options) {
@@ -2606,28 +2766,41 @@ var ZodDiscriminatedUnion = class extends ZodType {
2606
2766
  ...processCreateParams(params)
2607
2767
  });
2608
2768
  }
2609
- };
2610
- __name(ZodDiscriminatedUnion, "ZodDiscriminatedUnion");
2769
+ }, "ZodDiscriminatedUnion");
2770
+ __name2(ZodDiscriminatedUnion, "ZodDiscriminatedUnion");
2611
2771
  function mergeValues(a, b) {
2612
2772
  const aType = getParsedType(a);
2613
2773
  const bType = getParsedType(b);
2614
2774
  if (a === b) {
2615
- return { valid: true, data: a };
2775
+ return {
2776
+ valid: true,
2777
+ data: a
2778
+ };
2616
2779
  } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
2617
2780
  const bKeys = util.objectKeys(b);
2618
2781
  const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
2619
- const newObj = { ...a, ...b };
2782
+ const newObj = {
2783
+ ...a,
2784
+ ...b
2785
+ };
2620
2786
  for (const key of sharedKeys) {
2621
2787
  const sharedValue = mergeValues(a[key], b[key]);
2622
2788
  if (!sharedValue.valid) {
2623
- return { valid: false };
2789
+ return {
2790
+ valid: false
2791
+ };
2624
2792
  }
2625
2793
  newObj[key] = sharedValue.data;
2626
2794
  }
2627
- return { valid: true, data: newObj };
2795
+ return {
2796
+ valid: true,
2797
+ data: newObj
2798
+ };
2628
2799
  } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
2629
2800
  if (a.length !== b.length) {
2630
- return { valid: false };
2801
+ return {
2802
+ valid: false
2803
+ };
2631
2804
  }
2632
2805
  const newArray = [];
2633
2806
  for (let index16 = 0; index16 < a.length; index16++) {
@@ -2635,22 +2808,33 @@ function mergeValues(a, b) {
2635
2808
  const itemB = b[index16];
2636
2809
  const sharedValue = mergeValues(itemA, itemB);
2637
2810
  if (!sharedValue.valid) {
2638
- return { valid: false };
2811
+ return {
2812
+ valid: false
2813
+ };
2639
2814
  }
2640
2815
  newArray.push(sharedValue.data);
2641
2816
  }
2642
- return { valid: true, data: newArray };
2817
+ return {
2818
+ valid: true,
2819
+ data: newArray
2820
+ };
2643
2821
  } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
2644
- return { valid: true, data: a };
2822
+ return {
2823
+ valid: true,
2824
+ data: a
2825
+ };
2645
2826
  } else {
2646
- return { valid: false };
2827
+ return {
2828
+ valid: false
2829
+ };
2647
2830
  }
2648
2831
  }
2649
2832
  __name(mergeValues, "mergeValues");
2650
- var ZodIntersection = class extends ZodType {
2833
+ __name2(mergeValues, "mergeValues");
2834
+ var ZodIntersection = /* @__PURE__ */ __name(class extends ZodType {
2651
2835
  _parse(input) {
2652
2836
  const { status, ctx } = this._processInputParams(input);
2653
- const handleParsed = /* @__PURE__ */ __name((parsedLeft, parsedRight) => {
2837
+ const handleParsed = /* @__PURE__ */ __name2((parsedLeft, parsedRight) => {
2654
2838
  if (isAborted(parsedLeft) || isAborted(parsedRight)) {
2655
2839
  return INVALID;
2656
2840
  }
@@ -2664,7 +2848,10 @@ var ZodIntersection = class extends ZodType {
2664
2848
  if (isDirty(parsedLeft) || isDirty(parsedRight)) {
2665
2849
  status.dirty();
2666
2850
  }
2667
- return { status: status.value, value: merged.data };
2851
+ return {
2852
+ status: status.value,
2853
+ value: merged.data
2854
+ };
2668
2855
  }, "handleParsed");
2669
2856
  if (ctx.common.async) {
2670
2857
  return Promise.all([
@@ -2691,8 +2878,8 @@ var ZodIntersection = class extends ZodType {
2691
2878
  }));
2692
2879
  }
2693
2880
  }
2694
- };
2695
- __name(ZodIntersection, "ZodIntersection");
2881
+ }, "ZodIntersection");
2882
+ __name2(ZodIntersection, "ZodIntersection");
2696
2883
  ZodIntersection.create = (left, right, params) => {
2697
2884
  return new ZodIntersection({
2698
2885
  left,
@@ -2701,7 +2888,7 @@ ZodIntersection.create = (left, right, params) => {
2701
2888
  ...processCreateParams(params)
2702
2889
  });
2703
2890
  };
2704
- var ZodTuple = class extends ZodType {
2891
+ var ZodTuple = /* @__PURE__ */ __name(class extends ZodType {
2705
2892
  _parse(input) {
2706
2893
  const { status, ctx } = this._processInputParams(input);
2707
2894
  if (ctx.parsedType !== ZodParsedType.array) {
@@ -2733,7 +2920,9 @@ var ZodTuple = class extends ZodType {
2733
2920
  });
2734
2921
  status.dirty();
2735
2922
  }
2736
- const items = [...ctx.data].map((item, itemIndex) => {
2923
+ const items = [
2924
+ ...ctx.data
2925
+ ].map((item, itemIndex) => {
2737
2926
  const schema = this._def.items[itemIndex] || this._def.rest;
2738
2927
  if (!schema)
2739
2928
  return null;
@@ -2756,8 +2945,8 @@ var ZodTuple = class extends ZodType {
2756
2945
  rest
2757
2946
  });
2758
2947
  }
2759
- };
2760
- __name(ZodTuple, "ZodTuple");
2948
+ }, "ZodTuple");
2949
+ __name2(ZodTuple, "ZodTuple");
2761
2950
  ZodTuple.create = (schemas, params) => {
2762
2951
  if (!Array.isArray(schemas)) {
2763
2952
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
@@ -2769,7 +2958,7 @@ ZodTuple.create = (schemas, params) => {
2769
2958
  ...processCreateParams(params)
2770
2959
  });
2771
2960
  };
2772
- var ZodRecord = class extends ZodType {
2961
+ var ZodRecord = /* @__PURE__ */ __name(class extends ZodType {
2773
2962
  get keySchema() {
2774
2963
  return this._def.keyType;
2775
2964
  }
@@ -2820,9 +3009,9 @@ var ZodRecord = class extends ZodType {
2820
3009
  ...processCreateParams(second)
2821
3010
  });
2822
3011
  }
2823
- };
2824
- __name(ZodRecord, "ZodRecord");
2825
- var ZodMap = class extends ZodType {
3012
+ }, "ZodRecord");
3013
+ __name2(ZodRecord, "ZodRecord");
3014
+ var ZodMap = /* @__PURE__ */ __name(class extends ZodType {
2826
3015
  get keySchema() {
2827
3016
  return this._def.keyType;
2828
3017
  }
@@ -2841,10 +3030,18 @@ var ZodMap = class extends ZodType {
2841
3030
  }
2842
3031
  const keyType = this._def.keyType;
2843
3032
  const valueType = this._def.valueType;
2844
- const pairs = [...ctx.data.entries()].map(([key, value], index16) => {
3033
+ const pairs = [
3034
+ ...ctx.data.entries()
3035
+ ].map(([key, value], index16) => {
2845
3036
  return {
2846
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index16, "key"])),
2847
- value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index16, "value"]))
3037
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [
3038
+ index16,
3039
+ "key"
3040
+ ])),
3041
+ value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [
3042
+ index16,
3043
+ "value"
3044
+ ]))
2848
3045
  };
2849
3046
  });
2850
3047
  if (ctx.common.async) {
@@ -2861,7 +3058,10 @@ var ZodMap = class extends ZodType {
2861
3058
  }
2862
3059
  finalMap.set(key.value, value.value);
2863
3060
  }
2864
- return { status: status.value, value: finalMap };
3061
+ return {
3062
+ status: status.value,
3063
+ value: finalMap
3064
+ };
2865
3065
  });
2866
3066
  } else {
2867
3067
  const finalMap = /* @__PURE__ */ new Map();
@@ -2876,11 +3076,14 @@ var ZodMap = class extends ZodType {
2876
3076
  }
2877
3077
  finalMap.set(key.value, value.value);
2878
3078
  }
2879
- return { status: status.value, value: finalMap };
3079
+ return {
3080
+ status: status.value,
3081
+ value: finalMap
3082
+ };
2880
3083
  }
2881
3084
  }
2882
- };
2883
- __name(ZodMap, "ZodMap");
3085
+ }, "ZodMap");
3086
+ __name2(ZodMap, "ZodMap");
2884
3087
  ZodMap.create = (keyType, valueType, params) => {
2885
3088
  return new ZodMap({
2886
3089
  valueType,
@@ -2889,7 +3092,7 @@ ZodMap.create = (keyType, valueType, params) => {
2889
3092
  ...processCreateParams(params)
2890
3093
  });
2891
3094
  };
2892
- var ZodSet = class extends ZodType {
3095
+ var ZodSet = /* @__PURE__ */ __name(class extends ZodType {
2893
3096
  _parse(input) {
2894
3097
  const { status, ctx } = this._processInputParams(input);
2895
3098
  if (ctx.parsedType !== ZodParsedType.set) {
@@ -2937,10 +3140,16 @@ var ZodSet = class extends ZodType {
2937
3140
  status.dirty();
2938
3141
  parsedSet.add(element.value);
2939
3142
  }
2940
- return { status: status.value, value: parsedSet };
3143
+ return {
3144
+ status: status.value,
3145
+ value: parsedSet
3146
+ };
2941
3147
  }
2942
3148
  __name(finalizeSet, "finalizeSet");
2943
- const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
3149
+ __name2(finalizeSet, "finalizeSet");
3150
+ const elements = [
3151
+ ...ctx.data.values()
3152
+ ].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
2944
3153
  if (ctx.common.async) {
2945
3154
  return Promise.all(elements).then((elements2) => finalizeSet(elements2));
2946
3155
  } else {
@@ -2950,13 +3159,19 @@ var ZodSet = class extends ZodType {
2950
3159
  min(minSize, message) {
2951
3160
  return new ZodSet({
2952
3161
  ...this._def,
2953
- minSize: { value: minSize, message: errorUtil.toString(message) }
3162
+ minSize: {
3163
+ value: minSize,
3164
+ message: errorUtil.toString(message)
3165
+ }
2954
3166
  });
2955
3167
  }
2956
3168
  max(maxSize, message) {
2957
3169
  return new ZodSet({
2958
3170
  ...this._def,
2959
- maxSize: { value: maxSize, message: errorUtil.toString(message) }
3171
+ maxSize: {
3172
+ value: maxSize,
3173
+ message: errorUtil.toString(message)
3174
+ }
2960
3175
  });
2961
3176
  }
2962
3177
  size(size, message) {
@@ -2965,8 +3180,8 @@ var ZodSet = class extends ZodType {
2965
3180
  nonempty(message) {
2966
3181
  return this.min(1, message);
2967
3182
  }
2968
- };
2969
- __name(ZodSet, "ZodSet");
3183
+ }, "ZodSet");
3184
+ __name2(ZodSet, "ZodSet");
2970
3185
  ZodSet.create = (valueType, params) => {
2971
3186
  return new ZodSet({
2972
3187
  valueType,
@@ -2976,7 +3191,7 @@ ZodSet.create = (valueType, params) => {
2976
3191
  ...processCreateParams(params)
2977
3192
  });
2978
3193
  };
2979
- var ZodFunction = class extends ZodType {
3194
+ var ZodFunction = /* @__PURE__ */ __name(class extends ZodType {
2980
3195
  constructor() {
2981
3196
  super(...arguments);
2982
3197
  this.validate = this.implement;
@@ -3008,6 +3223,7 @@ var ZodFunction = class extends ZodType {
3008
3223
  });
3009
3224
  }
3010
3225
  __name(makeArgsIssue, "makeArgsIssue");
3226
+ __name2(makeArgsIssue, "makeArgsIssue");
3011
3227
  function makeReturnsIssue(returns, error) {
3012
3228
  return makeIssue({
3013
3229
  data: returns,
@@ -3025,7 +3241,10 @@ var ZodFunction = class extends ZodType {
3025
3241
  });
3026
3242
  }
3027
3243
  __name(makeReturnsIssue, "makeReturnsIssue");
3028
- const params = { errorMap: ctx.common.contextualErrorMap };
3244
+ __name2(makeReturnsIssue, "makeReturnsIssue");
3245
+ const params = {
3246
+ errorMap: ctx.common.contextualErrorMap
3247
+ };
3029
3248
  const fn = ctx.data;
3030
3249
  if (this._def.returns instanceof ZodPromise) {
3031
3250
  const me = this;
@@ -3047,12 +3266,16 @@ var ZodFunction = class extends ZodType {
3047
3266
  return OK(function(...args) {
3048
3267
  const parsedArgs = me._def.args.safeParse(args, params);
3049
3268
  if (!parsedArgs.success) {
3050
- throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
3269
+ throw new ZodError([
3270
+ makeArgsIssue(args, parsedArgs.error)
3271
+ ]);
3051
3272
  }
3052
3273
  const result = Reflect.apply(fn, this, parsedArgs.data);
3053
3274
  const parsedReturns = me._def.returns.safeParse(result, params);
3054
3275
  if (!parsedReturns.success) {
3055
- throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3276
+ throw new ZodError([
3277
+ makeReturnsIssue(result, parsedReturns.error)
3278
+ ]);
3056
3279
  }
3057
3280
  return parsedReturns.data;
3058
3281
  });
@@ -3092,19 +3315,23 @@ var ZodFunction = class extends ZodType {
3092
3315
  ...processCreateParams(params)
3093
3316
  });
3094
3317
  }
3095
- };
3096
- __name(ZodFunction, "ZodFunction");
3097
- var ZodLazy = class extends ZodType {
3318
+ }, "ZodFunction");
3319
+ __name2(ZodFunction, "ZodFunction");
3320
+ var ZodLazy = /* @__PURE__ */ __name(class extends ZodType {
3098
3321
  get schema() {
3099
3322
  return this._def.getter();
3100
3323
  }
3101
3324
  _parse(input) {
3102
3325
  const { ctx } = this._processInputParams(input);
3103
3326
  const lazySchema = this._def.getter();
3104
- return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
3327
+ return lazySchema._parse({
3328
+ data: ctx.data,
3329
+ path: ctx.path,
3330
+ parent: ctx
3331
+ });
3105
3332
  }
3106
- };
3107
- __name(ZodLazy, "ZodLazy");
3333
+ }, "ZodLazy");
3334
+ __name2(ZodLazy, "ZodLazy");
3108
3335
  ZodLazy.create = (getter, params) => {
3109
3336
  return new ZodLazy({
3110
3337
  getter,
@@ -3112,7 +3339,7 @@ ZodLazy.create = (getter, params) => {
3112
3339
  ...processCreateParams(params)
3113
3340
  });
3114
3341
  };
3115
- var ZodLiteral = class extends ZodType {
3342
+ var ZodLiteral = /* @__PURE__ */ __name(class extends ZodType {
3116
3343
  _parse(input) {
3117
3344
  if (input.data !== this._def.value) {
3118
3345
  const ctx = this._getOrReturnCtx(input);
@@ -3123,13 +3350,16 @@ var ZodLiteral = class extends ZodType {
3123
3350
  });
3124
3351
  return INVALID;
3125
3352
  }
3126
- return { status: "valid", value: input.data };
3353
+ return {
3354
+ status: "valid",
3355
+ value: input.data
3356
+ };
3127
3357
  }
3128
3358
  get value() {
3129
3359
  return this._def.value;
3130
3360
  }
3131
- };
3132
- __name(ZodLiteral, "ZodLiteral");
3361
+ }, "ZodLiteral");
3362
+ __name2(ZodLiteral, "ZodLiteral");
3133
3363
  ZodLiteral.create = (value, params) => {
3134
3364
  return new ZodLiteral({
3135
3365
  value,
@@ -3145,7 +3375,8 @@ function createZodEnum(values, params) {
3145
3375
  });
3146
3376
  }
3147
3377
  __name(createZodEnum, "createZodEnum");
3148
- var ZodEnum = class extends ZodType {
3378
+ __name2(createZodEnum, "createZodEnum");
3379
+ var ZodEnum = /* @__PURE__ */ __name(class extends ZodType {
3149
3380
  _parse(input) {
3150
3381
  if (typeof input.data !== "string") {
3151
3382
  const ctx = this._getOrReturnCtx(input);
@@ -3199,10 +3430,10 @@ var ZodEnum = class extends ZodType {
3199
3430
  exclude(values) {
3200
3431
  return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
3201
3432
  }
3202
- };
3203
- __name(ZodEnum, "ZodEnum");
3433
+ }, "ZodEnum");
3434
+ __name2(ZodEnum, "ZodEnum");
3204
3435
  ZodEnum.create = createZodEnum;
3205
- var ZodNativeEnum = class extends ZodType {
3436
+ var ZodNativeEnum = /* @__PURE__ */ __name(class extends ZodType {
3206
3437
  _parse(input) {
3207
3438
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
3208
3439
  const ctx = this._getOrReturnCtx(input);
@@ -3229,8 +3460,8 @@ var ZodNativeEnum = class extends ZodType {
3229
3460
  get enum() {
3230
3461
  return this._def.values;
3231
3462
  }
3232
- };
3233
- __name(ZodNativeEnum, "ZodNativeEnum");
3463
+ }, "ZodNativeEnum");
3464
+ __name2(ZodNativeEnum, "ZodNativeEnum");
3234
3465
  ZodNativeEnum.create = (values, params) => {
3235
3466
  return new ZodNativeEnum({
3236
3467
  values,
@@ -3238,7 +3469,7 @@ ZodNativeEnum.create = (values, params) => {
3238
3469
  ...processCreateParams(params)
3239
3470
  });
3240
3471
  };
3241
- var ZodPromise = class extends ZodType {
3472
+ var ZodPromise = /* @__PURE__ */ __name(class extends ZodType {
3242
3473
  unwrap() {
3243
3474
  return this._def.type;
3244
3475
  }
@@ -3260,8 +3491,8 @@ var ZodPromise = class extends ZodType {
3260
3491
  });
3261
3492
  }));
3262
3493
  }
3263
- };
3264
- __name(ZodPromise, "ZodPromise");
3494
+ }, "ZodPromise");
3495
+ __name2(ZodPromise, "ZodPromise");
3265
3496
  ZodPromise.create = (schema, params) => {
3266
3497
  return new ZodPromise({
3267
3498
  type: schema,
@@ -3269,7 +3500,7 @@ ZodPromise.create = (schema, params) => {
3269
3500
  ...processCreateParams(params)
3270
3501
  });
3271
3502
  };
3272
- var ZodEffects = class extends ZodType {
3503
+ var ZodEffects = /* @__PURE__ */ __name(class extends ZodType {
3273
3504
  innerType() {
3274
3505
  return this._def.schema;
3275
3506
  }
@@ -3318,7 +3549,7 @@ var ZodEffects = class extends ZodType {
3318
3549
  }
3319
3550
  }
3320
3551
  if (effect.type === "refinement") {
3321
- const executeRefinement = /* @__PURE__ */ __name((acc) => {
3552
+ const executeRefinement = /* @__PURE__ */ __name2((acc) => {
3322
3553
  const result = effect.refinement(acc, checkCtx);
3323
3554
  if (ctx.common.async) {
3324
3555
  return Promise.resolve(result);
@@ -3339,15 +3570,25 @@ var ZodEffects = class extends ZodType {
3339
3570
  if (inner.status === "dirty")
3340
3571
  status.dirty();
3341
3572
  executeRefinement(inner.value);
3342
- return { status: status.value, value: inner.value };
3573
+ return {
3574
+ status: status.value,
3575
+ value: inner.value
3576
+ };
3343
3577
  } else {
3344
- return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
3578
+ return this._def.schema._parseAsync({
3579
+ data: ctx.data,
3580
+ path: ctx.path,
3581
+ parent: ctx
3582
+ }).then((inner) => {
3345
3583
  if (inner.status === "aborted")
3346
3584
  return INVALID;
3347
3585
  if (inner.status === "dirty")
3348
3586
  status.dirty();
3349
3587
  return executeRefinement(inner.value).then(() => {
3350
- return { status: status.value, value: inner.value };
3588
+ return {
3589
+ status: status.value,
3590
+ value: inner.value
3591
+ };
3351
3592
  });
3352
3593
  });
3353
3594
  }
@@ -3365,19 +3606,29 @@ var ZodEffects = class extends ZodType {
3365
3606
  if (result instanceof Promise) {
3366
3607
  throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
3367
3608
  }
3368
- return { status: status.value, value: result };
3609
+ return {
3610
+ status: status.value,
3611
+ value: result
3612
+ };
3369
3613
  } else {
3370
- return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
3614
+ return this._def.schema._parseAsync({
3615
+ data: ctx.data,
3616
+ path: ctx.path,
3617
+ parent: ctx
3618
+ }).then((base) => {
3371
3619
  if (!isValid(base))
3372
3620
  return base;
3373
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
3621
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
3622
+ status: status.value,
3623
+ value: result
3624
+ }));
3374
3625
  });
3375
3626
  }
3376
3627
  }
3377
3628
  util.assertNever(effect);
3378
3629
  }
3379
- };
3380
- __name(ZodEffects, "ZodEffects");
3630
+ }, "ZodEffects");
3631
+ __name2(ZodEffects, "ZodEffects");
3381
3632
  ZodEffects.create = (schema, effect, params) => {
3382
3633
  return new ZodEffects({
3383
3634
  schema,
@@ -3389,12 +3640,15 @@ ZodEffects.create = (schema, effect, params) => {
3389
3640
  ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
3390
3641
  return new ZodEffects({
3391
3642
  schema,
3392
- effect: { type: "preprocess", transform: preprocess },
3643
+ effect: {
3644
+ type: "preprocess",
3645
+ transform: preprocess
3646
+ },
3393
3647
  typeName: ZodFirstPartyTypeKind.ZodEffects,
3394
3648
  ...processCreateParams(params)
3395
3649
  });
3396
3650
  };
3397
- var ZodOptional = class extends ZodType {
3651
+ var ZodOptional = /* @__PURE__ */ __name(class extends ZodType {
3398
3652
  _parse(input) {
3399
3653
  const parsedType = this._getType(input);
3400
3654
  if (parsedType === ZodParsedType.undefined) {
@@ -3405,8 +3659,8 @@ var ZodOptional = class extends ZodType {
3405
3659
  unwrap() {
3406
3660
  return this._def.innerType;
3407
3661
  }
3408
- };
3409
- __name(ZodOptional, "ZodOptional");
3662
+ }, "ZodOptional");
3663
+ __name2(ZodOptional, "ZodOptional");
3410
3664
  ZodOptional.create = (type, params) => {
3411
3665
  return new ZodOptional({
3412
3666
  innerType: type,
@@ -3414,7 +3668,7 @@ ZodOptional.create = (type, params) => {
3414
3668
  ...processCreateParams(params)
3415
3669
  });
3416
3670
  };
3417
- var ZodNullable = class extends ZodType {
3671
+ var ZodNullable = /* @__PURE__ */ __name(class extends ZodType {
3418
3672
  _parse(input) {
3419
3673
  const parsedType = this._getType(input);
3420
3674
  if (parsedType === ZodParsedType.null) {
@@ -3425,8 +3679,8 @@ var ZodNullable = class extends ZodType {
3425
3679
  unwrap() {
3426
3680
  return this._def.innerType;
3427
3681
  }
3428
- };
3429
- __name(ZodNullable, "ZodNullable");
3682
+ }, "ZodNullable");
3683
+ __name2(ZodNullable, "ZodNullable");
3430
3684
  ZodNullable.create = (type, params) => {
3431
3685
  return new ZodNullable({
3432
3686
  innerType: type,
@@ -3434,7 +3688,7 @@ ZodNullable.create = (type, params) => {
3434
3688
  ...processCreateParams(params)
3435
3689
  });
3436
3690
  };
3437
- var ZodDefault = class extends ZodType {
3691
+ var ZodDefault = /* @__PURE__ */ __name(class extends ZodType {
3438
3692
  _parse(input) {
3439
3693
  const { ctx } = this._processInputParams(input);
3440
3694
  let data = ctx.data;
@@ -3450,8 +3704,8 @@ var ZodDefault = class extends ZodType {
3450
3704
  removeDefault() {
3451
3705
  return this._def.innerType;
3452
3706
  }
3453
- };
3454
- __name(ZodDefault, "ZodDefault");
3707
+ }, "ZodDefault");
3708
+ __name2(ZodDefault, "ZodDefault");
3455
3709
  ZodDefault.create = (type, params) => {
3456
3710
  return new ZodDefault({
3457
3711
  innerType: type,
@@ -3460,7 +3714,7 @@ ZodDefault.create = (type, params) => {
3460
3714
  ...processCreateParams(params)
3461
3715
  });
3462
3716
  };
3463
- var ZodCatch = class extends ZodType {
3717
+ var ZodCatch = /* @__PURE__ */ __name(class extends ZodType {
3464
3718
  _parse(input) {
3465
3719
  const { ctx } = this._processInputParams(input);
3466
3720
  const newCtx = {
@@ -3504,8 +3758,8 @@ var ZodCatch = class extends ZodType {
3504
3758
  removeCatch() {
3505
3759
  return this._def.innerType;
3506
3760
  }
3507
- };
3508
- __name(ZodCatch, "ZodCatch");
3761
+ }, "ZodCatch");
3762
+ __name2(ZodCatch, "ZodCatch");
3509
3763
  ZodCatch.create = (type, params) => {
3510
3764
  return new ZodCatch({
3511
3765
  innerType: type,
@@ -3514,7 +3768,7 @@ ZodCatch.create = (type, params) => {
3514
3768
  ...processCreateParams(params)
3515
3769
  });
3516
3770
  };
3517
- var ZodNaN = class extends ZodType {
3771
+ var ZodNaN = /* @__PURE__ */ __name(class extends ZodType {
3518
3772
  _parse(input) {
3519
3773
  const parsedType = this._getType(input);
3520
3774
  if (parsedType !== ZodParsedType.nan) {
@@ -3526,10 +3780,13 @@ var ZodNaN = class extends ZodType {
3526
3780
  });
3527
3781
  return INVALID;
3528
3782
  }
3529
- return { status: "valid", value: input.data };
3783
+ return {
3784
+ status: "valid",
3785
+ value: input.data
3786
+ };
3530
3787
  }
3531
- };
3532
- __name(ZodNaN, "ZodNaN");
3788
+ }, "ZodNaN");
3789
+ __name2(ZodNaN, "ZodNaN");
3533
3790
  ZodNaN.create = (params) => {
3534
3791
  return new ZodNaN({
3535
3792
  typeName: ZodFirstPartyTypeKind.ZodNaN,
@@ -3537,7 +3794,7 @@ ZodNaN.create = (params) => {
3537
3794
  });
3538
3795
  };
3539
3796
  var BRAND = Symbol("zod_brand");
3540
- var ZodBranded = class extends ZodType {
3797
+ var ZodBranded = /* @__PURE__ */ __name(class extends ZodType {
3541
3798
  _parse(input) {
3542
3799
  const { ctx } = this._processInputParams(input);
3543
3800
  const data = ctx.data;
@@ -3550,13 +3807,13 @@ var ZodBranded = class extends ZodType {
3550
3807
  unwrap() {
3551
3808
  return this._def.type;
3552
3809
  }
3553
- };
3554
- __name(ZodBranded, "ZodBranded");
3555
- var ZodPipeline = class extends ZodType {
3810
+ }, "ZodBranded");
3811
+ __name2(ZodBranded, "ZodBranded");
3812
+ var ZodPipeline = /* @__PURE__ */ __name(class extends ZodType {
3556
3813
  _parse(input) {
3557
3814
  const { status, ctx } = this._processInputParams(input);
3558
3815
  if (ctx.common.async) {
3559
- const handleAsync = /* @__PURE__ */ __name(async () => {
3816
+ const handleAsync = /* @__PURE__ */ __name2(async () => {
3560
3817
  const inResult = await this._def.in._parseAsync({
3561
3818
  data: ctx.data,
3562
3819
  path: ctx.path,
@@ -3606,9 +3863,9 @@ var ZodPipeline = class extends ZodType {
3606
3863
  typeName: ZodFirstPartyTypeKind.ZodPipeline
3607
3864
  });
3608
3865
  }
3609
- };
3610
- __name(ZodPipeline, "ZodPipeline");
3611
- var ZodReadonly = class extends ZodType {
3866
+ }, "ZodPipeline");
3867
+ __name2(ZodPipeline, "ZodPipeline");
3868
+ var ZodReadonly = /* @__PURE__ */ __name(class extends ZodType {
3612
3869
  _parse(input) {
3613
3870
  const result = this._def.innerType._parse(input);
3614
3871
  if (isValid(result)) {
@@ -3616,8 +3873,8 @@ var ZodReadonly = class extends ZodType {
3616
3873
  }
3617
3874
  return result;
3618
3875
  }
3619
- };
3620
- __name(ZodReadonly, "ZodReadonly");
3876
+ }, "ZodReadonly");
3877
+ __name2(ZodReadonly, "ZodReadonly");
3621
3878
  ZodReadonly.create = (type, params) => {
3622
3879
  return new ZodReadonly({
3623
3880
  innerType: type,
@@ -3625,15 +3882,23 @@ ZodReadonly.create = (type, params) => {
3625
3882
  ...processCreateParams(params)
3626
3883
  });
3627
3884
  };
3628
- var custom = /* @__PURE__ */ __name((check, params = {}, fatal) => {
3885
+ var custom = /* @__PURE__ */ __name2((check, params = {}, fatal) => {
3629
3886
  if (check)
3630
3887
  return ZodAny.create().superRefine((data, ctx) => {
3631
3888
  var _a, _b;
3632
3889
  if (!check(data)) {
3633
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3890
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? {
3891
+ message: params
3892
+ } : params;
3634
3893
  const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
3635
- const p2 = typeof p === "string" ? { message: p } : p;
3636
- ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
3894
+ const p2 = typeof p === "string" ? {
3895
+ message: p
3896
+ } : p;
3897
+ ctx.addIssue({
3898
+ code: "custom",
3899
+ ...p2,
3900
+ fatal: _fatal
3901
+ });
3637
3902
  }
3638
3903
  });
3639
3904
  return ZodAny.create();
@@ -3680,7 +3945,7 @@ var ZodFirstPartyTypeKind;
3680
3945
  ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
3681
3946
  ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
3682
3947
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
3683
- var instanceOfType = /* @__PURE__ */ __name((cls, params = {
3948
+ var instanceOfType = /* @__PURE__ */ __name2((cls, params = {
3684
3949
  message: `Input not instance of ${cls.name}`
3685
3950
  }) => custom((data) => data instanceof cls, params), "instanceOfType");
3686
3951
  var stringType = ZodString.create;
@@ -3717,18 +3982,30 @@ var optionalType = ZodOptional.create;
3717
3982
  var nullableType = ZodNullable.create;
3718
3983
  var preprocessType = ZodEffects.createWithPreprocess;
3719
3984
  var pipelineType = ZodPipeline.create;
3720
- var ostring = /* @__PURE__ */ __name(() => stringType().optional(), "ostring");
3721
- var onumber = /* @__PURE__ */ __name(() => numberType().optional(), "onumber");
3722
- var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean");
3985
+ var ostring = /* @__PURE__ */ __name2(() => stringType().optional(), "ostring");
3986
+ var onumber = /* @__PURE__ */ __name2(() => numberType().optional(), "onumber");
3987
+ var oboolean = /* @__PURE__ */ __name2(() => booleanType().optional(), "oboolean");
3723
3988
  var coerce = {
3724
- string: (arg) => ZodString.create({ ...arg, coerce: true }),
3725
- number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
3989
+ string: (arg) => ZodString.create({
3990
+ ...arg,
3991
+ coerce: true
3992
+ }),
3993
+ number: (arg) => ZodNumber.create({
3994
+ ...arg,
3995
+ coerce: true
3996
+ }),
3726
3997
  boolean: (arg) => ZodBoolean.create({
3727
3998
  ...arg,
3728
3999
  coerce: true
3729
4000
  }),
3730
- bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
3731
- date: (arg) => ZodDate.create({ ...arg, coerce: true })
4001
+ bigint: (arg) => ZodBigInt.create({
4002
+ ...arg,
4003
+ coerce: true
4004
+ }),
4005
+ date: (arg) => ZodDate.create({
4006
+ ...arg,
4007
+ coerce: true
4008
+ })
3732
4009
  };
3733
4010
  var NEVER = INVALID;
3734
4011
  var z = /* @__PURE__ */ Object.freeze({
@@ -3847,11 +4124,11 @@ var z = /* @__PURE__ */ Object.freeze({
3847
4124
  ZodError
3848
4125
  });
3849
4126
 
3850
- // ../core/schemas/video-resource.js
4127
+ // ../core/dist/schemas/video-resource.js
3851
4128
  var VideoResourceSchema = z.object({
3852
- _id: z.string(),
3853
- _updatedAt: z.string().optional(),
3854
- _createdAt: z.string().optional(),
4129
+ id: z.string(),
4130
+ updatedAt: z.string().optional(),
4131
+ createdAt: z.string().optional(),
3855
4132
  title: z.string().optional().nullable(),
3856
4133
  duration: z.number().optional().nullable(),
3857
4134
  muxPlaybackId: z.string().optional().nullable(),
@@ -3870,61 +4147,57 @@ var VideoResourceSchema = z.object({
3870
4147
  });
3871
4148
 
3872
4149
  // src/lib/mysql/schemas/auth/accounts.ts
4150
+ var import_drizzle_orm12 = require("drizzle-orm");
4151
+ var import_mysql_core14 = require("drizzle-orm/mysql-core");
4152
+
4153
+ // src/lib/mysql/schemas/auth/users.ts
4154
+ var import_drizzle_orm11 = require("drizzle-orm");
4155
+ var import_mysql_core13 = require("drizzle-orm/mysql-core");
4156
+
4157
+ // src/lib/mysql/schemas/communication/communication-preferences.ts
4158
+ var import_drizzle_orm = require("drizzle-orm");
4159
+ var import_mysql_core3 = require("drizzle-orm/mysql-core");
4160
+
4161
+ // src/lib/mysql/schemas/communication/communication-channel.ts
3873
4162
  var import_mysql_core = require("drizzle-orm/mysql-core");
3874
- var getAccountsSchema = /* @__PURE__ */ __name((mysqlTable) => {
3875
- const accounts = mysqlTable("account", {
3876
- userId: (0, import_mysql_core.varchar)("userId", {
3877
- length: 255
3878
- }).notNull(),
3879
- type: (0, import_mysql_core.varchar)("type", {
3880
- length: 255
3881
- }).$type().notNull(),
3882
- provider: (0, import_mysql_core.varchar)("provider", {
4163
+ function getCommunicationChannelSchema(mysqlTable) {
4164
+ return mysqlTable("communicationChannel", {
4165
+ id: (0, import_mysql_core.varchar)("id", {
3883
4166
  length: 255
3884
- }).notNull(),
3885
- providerAccountId: (0, import_mysql_core.varchar)("providerAccountId", {
4167
+ }).notNull().primaryKey(),
4168
+ name: (0, import_mysql_core.varchar)("name", {
3886
4169
  length: 255
3887
4170
  }).notNull(),
3888
- refresh_token: (0, import_mysql_core.text)("refresh_token"),
3889
- access_token: (0, import_mysql_core.text)("access_token"),
3890
- oauth_token: (0, import_mysql_core.text)("oauth_token"),
3891
- oauth_token_secret: (0, import_mysql_core.text)("oauth_token_secret"),
3892
- expires_at: (0, import_mysql_core.int)("expires_at"),
3893
- token_type: (0, import_mysql_core.varchar)("token_type", {
4171
+ description: (0, import_mysql_core.text)("description"),
4172
+ active: (0, import_mysql_core.boolean)("active").notNull().default(true),
4173
+ createdAt: (0, import_mysql_core.timestamp)("createdAt", {
4174
+ mode: "date",
4175
+ fsp: 3
4176
+ }).defaultNow(),
4177
+ updatedAt: (0, import_mysql_core.timestamp)("updatedAt", {
4178
+ mode: "date",
4179
+ fsp: 3
4180
+ }).defaultNow(),
4181
+ deletedAt: (0, import_mysql_core.timestamp)("deletedAt", {
4182
+ mode: "date",
4183
+ fsp: 3
4184
+ })
4185
+ }, (cc) => ({
4186
+ nameIdx: (0, import_mysql_core.index)("name_idx").on(cc.name)
4187
+ }));
4188
+ }
4189
+ __name(getCommunicationChannelSchema, "getCommunicationChannelSchema");
4190
+
4191
+ // src/lib/mysql/schemas/communication/communication-preference-types.ts
4192
+ var import_mysql_core2 = require("drizzle-orm/mysql-core");
4193
+ function getCommunicationPreferenceTypesSchema(mysqlTable) {
4194
+ return mysqlTable("communicationPreferenceType", {
4195
+ id: (0, import_mysql_core2.varchar)("id", {
3894
4196
  length: 255
3895
- }),
3896
- scope: (0, import_mysql_core.varchar)("scope", {
4197
+ }).notNull().primaryKey(),
4198
+ name: (0, import_mysql_core2.varchar)("name", {
3897
4199
  length: 255
3898
- }),
3899
- id_token: (0, import_mysql_core.text)("id_token"),
3900
- session_state: (0, import_mysql_core.varchar)("session_state", {
3901
- length: 255
3902
- }),
3903
- refresh_token_expires_in: (0, import_mysql_core.int)("refresh_token_expires_in")
3904
- }, (account) => ({
3905
- pk: (0, import_mysql_core.primaryKey)({
3906
- columns: [
3907
- account.provider,
3908
- account.providerAccountId
3909
- ]
3910
- }),
3911
- userIdIdx: (0, import_mysql_core.index)("userId_idx").on(account.userId)
3912
- }));
3913
- return {
3914
- accounts
3915
- };
3916
- }, "getAccountsSchema");
3917
-
3918
- // src/lib/mysql/schemas/auth/permissions.ts
3919
- var import_mysql_core2 = require("drizzle-orm/mysql-core");
3920
- var getPermissionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
3921
- const permissions = mysqlTable("permission", {
3922
- id: (0, import_mysql_core2.varchar)("id", {
3923
- length: 255
3924
- }).notNull().primaryKey(),
3925
- name: (0, import_mysql_core2.varchar)("name", {
3926
- length: 255
3927
- }).notNull().unique(),
4200
+ }).notNull(),
3928
4201
  description: (0, import_mysql_core2.text)("description"),
3929
4202
  active: (0, import_mysql_core2.boolean)("active").notNull().default(true),
3930
4203
  createdAt: (0, import_mysql_core2.timestamp)("createdAt", {
@@ -3934,27 +4207,33 @@ var getPermissionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
3934
4207
  updatedAt: (0, import_mysql_core2.timestamp)("updatedAt", {
3935
4208
  mode: "date",
3936
4209
  fsp: 3
3937
- }).defaultNow(),
4210
+ }),
3938
4211
  deletedAt: (0, import_mysql_core2.timestamp)("deletedAt", {
3939
4212
  mode: "date",
3940
4213
  fsp: 3
3941
4214
  })
3942
- }, (permission) => ({
3943
- nameIdx: (0, import_mysql_core2.index)("name_idx").on(permission.name)
3944
- }));
3945
- return {
3946
- permissions
3947
- };
3948
- }, "getPermissionsSchema");
4215
+ });
4216
+ }
4217
+ __name(getCommunicationPreferenceTypesSchema, "getCommunicationPreferenceTypesSchema");
3949
4218
 
3950
- // src/lib/mysql/schemas/auth/role-permissions.ts
3951
- var import_mysql_core3 = require("drizzle-orm/mysql-core");
3952
- var getRolePermissionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
3953
- const rolePermissions = mysqlTable("rolePermission", {
3954
- roleId: (0, import_mysql_core3.varchar)("roleId", {
4219
+ // src/lib/mysql/schemas/communication/communication-preferences.ts
4220
+ function getCommunicationPreferencesSchema(mysqlTable) {
4221
+ return mysqlTable("communicationPreference", {
4222
+ id: (0, import_mysql_core3.varchar)("id", {
4223
+ length: 255
4224
+ }).notNull().primaryKey(),
4225
+ userId: (0, import_mysql_core3.varchar)("userId", {
4226
+ length: 255
4227
+ }).notNull(),
4228
+ channelId: (0, import_mysql_core3.varchar)("channelId", {
3955
4229
  length: 255
3956
4230
  }).notNull(),
3957
- permissionId: (0, import_mysql_core3.varchar)("permissionId", {
4231
+ preferenceLevel: (0, import_mysql_core3.mysqlEnum)("preferenceLevel", [
4232
+ "low",
4233
+ "medium",
4234
+ "high"
4235
+ ]).notNull().default("medium"),
4236
+ preferenceTypeId: (0, import_mysql_core3.varchar)("preferenceTypeId", {
3958
4237
  length: 255
3959
4238
  }).notNull(),
3960
4239
  active: (0, import_mysql_core3.boolean)("active").notNull().default(true),
@@ -3962,6 +4241,14 @@ var getRolePermissionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
3962
4241
  mode: "date",
3963
4242
  fsp: 3
3964
4243
  }).defaultNow(),
4244
+ optInAt: (0, import_mysql_core3.timestamp)("optInAt", {
4245
+ mode: "date",
4246
+ fsp: 3
4247
+ }),
4248
+ optOutAt: (0, import_mysql_core3.timestamp)("optOutAt", {
4249
+ mode: "date",
4250
+ fsp: 3
4251
+ }),
3965
4252
  updatedAt: (0, import_mysql_core3.timestamp)("updatedAt", {
3966
4253
  mode: "date",
3967
4254
  fsp: 3
@@ -3970,84 +4257,190 @@ var getRolePermissionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
3970
4257
  mode: "date",
3971
4258
  fsp: 3
3972
4259
  })
3973
- }, (rp) => ({
3974
- pk: (0, import_mysql_core3.primaryKey)({
3975
- columns: [
3976
- rp.roleId,
3977
- rp.permissionId
4260
+ }, (cp) => ({
4261
+ userIdIdx: (0, import_mysql_core3.index)("userId_idx").on(cp.userId),
4262
+ preferenceTypeIdx: (0, import_mysql_core3.index)("preferenceTypeId_idx").on(cp.preferenceTypeId),
4263
+ channelIdIdx: (0, import_mysql_core3.index)("channelId_idx").on(cp.channelId)
4264
+ }));
4265
+ }
4266
+ __name(getCommunicationPreferencesSchema, "getCommunicationPreferencesSchema");
4267
+ function getCommunicationPreferencesRelationsSchema(mysqlTable) {
4268
+ const communicationPreferences = getCommunicationPreferencesSchema(mysqlTable);
4269
+ const users = getUsersSchema(mysqlTable);
4270
+ const communicationChannel = getCommunicationChannelSchema(mysqlTable);
4271
+ const communicationPreferenceTypes = getCommunicationPreferenceTypesSchema(mysqlTable);
4272
+ return (0, import_drizzle_orm.relations)(communicationPreferences, ({ one }) => ({
4273
+ user: one(users, {
4274
+ fields: [
4275
+ communicationPreferences.userId
4276
+ ],
4277
+ references: [
4278
+ users.id
4279
+ ]
4280
+ }),
4281
+ channel: one(communicationChannel, {
4282
+ fields: [
4283
+ communicationPreferences.channelId
4284
+ ],
4285
+ references: [
4286
+ communicationChannel.id
3978
4287
  ]
3979
4288
  }),
3980
- roleIdIdx: (0, import_mysql_core3.index)("roleId_idx").on(rp.roleId),
3981
- permissionIdIdx: (0, import_mysql_core3.index)("permissionId_idx").on(rp.permissionId)
4289
+ preferenceType: one(communicationPreferenceTypes, {
4290
+ fields: [
4291
+ communicationPreferences.preferenceTypeId
4292
+ ],
4293
+ references: [
4294
+ communicationPreferenceTypes.id
4295
+ ]
4296
+ })
3982
4297
  }));
3983
- return {
3984
- rolePermissions
3985
- };
3986
- }, "getRolePermissionsSchema");
4298
+ }
4299
+ __name(getCommunicationPreferencesRelationsSchema, "getCommunicationPreferencesRelationsSchema");
3987
4300
 
3988
- // src/lib/mysql/schemas/auth/roles.ts
4301
+ // src/lib/mysql/schemas/content/content-contributions.ts
4302
+ var import_drizzle_orm5 = require("drizzle-orm");
4303
+ var import_mysql_core7 = require("drizzle-orm/mysql-core");
4304
+
4305
+ // src/lib/mysql/schemas/content/content-resource.ts
4306
+ var import_drizzle_orm3 = require("drizzle-orm");
4307
+ var import_mysql_core5 = require("drizzle-orm/mysql-core");
4308
+
4309
+ // src/lib/mysql/schemas/content/content-resource-resource.ts
4310
+ var import_drizzle_orm2 = require("drizzle-orm");
3989
4311
  var import_mysql_core4 = require("drizzle-orm/mysql-core");
3990
- var getRolesSchema = /* @__PURE__ */ __name((mysqlTable) => {
3991
- const roles = mysqlTable("role", {
3992
- id: (0, import_mysql_core4.varchar)("id", {
4312
+ function getContentResourceResourceSchema(mysqlTable) {
4313
+ return mysqlTable("contentResourceResource", {
4314
+ resourceOfId: (0, import_mysql_core4.varchar)("resourceOfId", {
3993
4315
  length: 255
3994
- }).notNull().primaryKey(),
3995
- name: (0, import_mysql_core4.varchar)("name", {
4316
+ }).notNull(),
4317
+ resourceId: (0, import_mysql_core4.varchar)("resourceId", {
3996
4318
  length: 255
3997
- }).notNull().unique(),
3998
- description: (0, import_mysql_core4.text)("description"),
3999
- active: (0, import_mysql_core4.boolean)("active").notNull().default(true),
4319
+ }).notNull(),
4320
+ position: (0, import_mysql_core4.double)("position").notNull().default(0),
4321
+ metadata: (0, import_mysql_core4.json)("fields").$type().default({}),
4000
4322
  createdAt: (0, import_mysql_core4.timestamp)("createdAt", {
4001
4323
  mode: "date",
4002
4324
  fsp: 3
4003
- }).defaultNow(),
4325
+ }).default(import_drizzle_orm2.sql`CURRENT_TIMESTAMP(3)`),
4004
4326
  updatedAt: (0, import_mysql_core4.timestamp)("updatedAt", {
4005
4327
  mode: "date",
4006
4328
  fsp: 3
4007
- }).defaultNow(),
4329
+ }).default(import_drizzle_orm2.sql`CURRENT_TIMESTAMP(3)`),
4008
4330
  deletedAt: (0, import_mysql_core4.timestamp)("deletedAt", {
4009
4331
  mode: "date",
4010
4332
  fsp: 3
4011
4333
  })
4012
- }, (role) => ({
4013
- nameIdx: (0, import_mysql_core4.index)("name_idx").on(role.name)
4334
+ }, (crr) => ({
4335
+ pk: (0, import_mysql_core4.primaryKey)({
4336
+ columns: [
4337
+ crr.resourceOfId,
4338
+ crr.resourceId
4339
+ ]
4340
+ }),
4341
+ contentResourceIdIdx: (0, import_mysql_core4.index)("contentResourceId_idx").on(crr.resourceOfId),
4342
+ resourceIdIdx: (0, import_mysql_core4.index)("resourceId_idx").on(crr.resourceId)
4014
4343
  }));
4015
- return {
4016
- roles
4017
- };
4018
- }, "getRolesSchema");
4344
+ }
4345
+ __name(getContentResourceResourceSchema, "getContentResourceResourceSchema");
4346
+ function getContentResourceResourceRelationsSchema(mysqlTable) {
4347
+ const contentResource = getContentResourceSchema(mysqlTable);
4348
+ const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
4349
+ return (0, import_drizzle_orm2.relations)(contentResourceResource, ({ one }) => ({
4350
+ resourceOf: one(contentResource, {
4351
+ fields: [
4352
+ contentResourceResource.resourceOfId
4353
+ ],
4354
+ references: [
4355
+ contentResource.id
4356
+ ],
4357
+ relationName: "resourceOf"
4358
+ }),
4359
+ resource: one(contentResource, {
4360
+ fields: [
4361
+ contentResourceResource.resourceId
4362
+ ],
4363
+ references: [
4364
+ contentResource.id
4365
+ ],
4366
+ relationName: "resource"
4367
+ })
4368
+ }));
4369
+ }
4370
+ __name(getContentResourceResourceRelationsSchema, "getContentResourceResourceRelationsSchema");
4019
4371
 
4020
- // src/lib/mysql/schemas/auth/sessions.ts
4021
- var import_mysql_core5 = require("drizzle-orm/mysql-core");
4022
- var getSessionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
4023
- const sessions = mysqlTable("session", {
4024
- sessionToken: (0, import_mysql_core5.varchar)("sessionToken", {
4372
+ // src/lib/mysql/schemas/content/content-resource.ts
4373
+ function getContentResourceSchema(mysqlTable) {
4374
+ return mysqlTable("contentResource", {
4375
+ id: (0, import_mysql_core5.varchar)("id", {
4025
4376
  length: 255
4026
4377
  }).notNull().primaryKey(),
4027
- userId: (0, import_mysql_core5.varchar)("userId", {
4378
+ type: (0, import_mysql_core5.varchar)("type", {
4028
4379
  length: 255
4029
4380
  }).notNull(),
4030
- expires: (0, import_mysql_core5.timestamp)("expires", {
4031
- mode: "date"
4032
- }).notNull()
4033
- }, (session) => ({
4034
- userIdIdx: (0, import_mysql_core5.index)("userId_idx").on(session.userId)
4381
+ createdById: (0, import_mysql_core5.varchar)("createdById", {
4382
+ length: 255
4383
+ }).notNull(),
4384
+ fields: (0, import_mysql_core5.json)("fields").$type().default({}),
4385
+ createdAt: (0, import_mysql_core5.timestamp)("createdAt", {
4386
+ mode: "date",
4387
+ fsp: 3
4388
+ }).default(import_drizzle_orm3.sql`CURRENT_TIMESTAMP(3)`),
4389
+ updatedAt: (0, import_mysql_core5.timestamp)("updatedAt", {
4390
+ mode: "date",
4391
+ fsp: 3
4392
+ }).default(import_drizzle_orm3.sql`CURRENT_TIMESTAMP(3)`),
4393
+ deletedAt: (0, import_mysql_core5.timestamp)("deletedAt", {
4394
+ mode: "date",
4395
+ fsp: 3
4396
+ })
4397
+ }, (cm) => ({
4398
+ typeIdx: (0, import_mysql_core5.index)("type_idx").on(cm.type),
4399
+ createdByIdx: (0, import_mysql_core5.index)("createdById_idx").on(cm.createdById),
4400
+ createdAtIdx: (0, import_mysql_core5.index)("createdAt_idx").on(cm.createdAt)
4035
4401
  }));
4036
- return {
4037
- sessions
4038
- };
4039
- }, "getSessionsSchema");
4402
+ }
4403
+ __name(getContentResourceSchema, "getContentResourceSchema");
4404
+ function getContentResourceRelationsSchema(mysqlTable) {
4405
+ const contentResource = getContentResourceSchema(mysqlTable);
4406
+ const users = getUsersSchema(mysqlTable);
4407
+ const contentContributions = getContentContributionsSchema(mysqlTable);
4408
+ const contentResourceResource = getContentResourceResourceSchema(mysqlTable);
4409
+ return (0, import_drizzle_orm3.relations)(contentResource, ({ one, many }) => ({
4410
+ createdBy: one(users, {
4411
+ fields: [
4412
+ contentResource.createdById
4413
+ ],
4414
+ references: [
4415
+ users.id
4416
+ ]
4417
+ }),
4418
+ contributions: many(contentContributions),
4419
+ resources: many(contentResourceResource, {
4420
+ relationName: "resourceOf"
4421
+ }),
4422
+ resourceOf: many(contentResourceResource, {
4423
+ relationName: "resource"
4424
+ })
4425
+ }));
4426
+ }
4427
+ __name(getContentResourceRelationsSchema, "getContentResourceRelationsSchema");
4040
4428
 
4041
- // src/lib/mysql/schemas/auth/user-permissions.ts
4429
+ // src/lib/mysql/schemas/content/contribution-types.ts
4430
+ var import_drizzle_orm4 = require("drizzle-orm");
4042
4431
  var import_mysql_core6 = require("drizzle-orm/mysql-core");
4043
- var getUserPermissionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
4044
- const userPermissions = mysqlTable("userPermission", {
4045
- userId: (0, import_mysql_core6.varchar)("userId", {
4432
+ function getContributionTypesSchema(mysqlTable) {
4433
+ return mysqlTable("contributionType", {
4434
+ id: (0, import_mysql_core6.varchar)("id", {
4046
4435
  length: 255
4047
- }).notNull(),
4048
- permissionId: (0, import_mysql_core6.varchar)("permissionId", {
4436
+ }).notNull().primaryKey(),
4437
+ slug: (0, import_mysql_core6.varchar)("slug", {
4438
+ length: 255
4439
+ }).notNull().unique(),
4440
+ name: (0, import_mysql_core6.varchar)("name", {
4049
4441
  length: 255
4050
4442
  }).notNull(),
4443
+ description: (0, import_mysql_core6.text)("description"),
4051
4444
  active: (0, import_mysql_core6.boolean)("active").notNull().default(true),
4052
4445
  createdAt: (0, import_mysql_core6.timestamp)("createdAt", {
4053
4446
  mode: "date",
@@ -4061,29 +4454,34 @@ var getUserPermissionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
4061
4454
  mode: "date",
4062
4455
  fsp: 3
4063
4456
  })
4064
- }, (up) => ({
4065
- pk: (0, import_mysql_core6.primaryKey)({
4066
- columns: [
4067
- up.userId,
4068
- up.permissionId
4069
- ]
4070
- }),
4071
- userIdIdx: (0, import_mysql_core6.index)("userId_idx").on(up.userId),
4072
- permissionIdIdx: (0, import_mysql_core6.index)("permissionId_idx").on(up.permissionId)
4457
+ }, (ct) => ({
4458
+ nameIdx: (0, import_mysql_core6.index)("name_idx").on(ct.name),
4459
+ slugIdx: (0, import_mysql_core6.index)("slug_idx").on(ct.slug)
4073
4460
  }));
4074
- return {
4075
- userPermissions
4076
- };
4077
- }, "getUserPermissionsSchema");
4461
+ }
4462
+ __name(getContributionTypesSchema, "getContributionTypesSchema");
4463
+ function getContributionTypesRelationsSchema(mysqlTable) {
4464
+ const contributionTypes = getContributionTypesSchema(mysqlTable);
4465
+ const contentContributions = getContentContributionsSchema(mysqlTable);
4466
+ return (0, import_drizzle_orm4.relations)(contributionTypes, ({ many }) => ({
4467
+ contributions: many(contentContributions)
4468
+ }));
4469
+ }
4470
+ __name(getContributionTypesRelationsSchema, "getContributionTypesRelationsSchema");
4078
4471
 
4079
- // src/lib/mysql/schemas/auth/user-roles.ts
4080
- var import_mysql_core7 = require("drizzle-orm/mysql-core");
4081
- var getUserRolesSchema = /* @__PURE__ */ __name((mysqlTable) => {
4082
- const userRoles = mysqlTable("userRole", {
4472
+ // src/lib/mysql/schemas/content/content-contributions.ts
4473
+ function getContentContributionsSchema(mysqlTable) {
4474
+ return mysqlTable("contentContribution", {
4475
+ id: (0, import_mysql_core7.varchar)("id", {
4476
+ length: 255
4477
+ }).notNull().primaryKey(),
4083
4478
  userId: (0, import_mysql_core7.varchar)("userId", {
4084
4479
  length: 255
4085
4480
  }).notNull(),
4086
- roleId: (0, import_mysql_core7.varchar)("roleId", {
4481
+ contentId: (0, import_mysql_core7.varchar)("contentId", {
4482
+ length: 255
4483
+ }).notNull(),
4484
+ contributionTypeId: (0, import_mysql_core7.varchar)("contributionTypeId", {
4087
4485
  length: 255
4088
4486
  }).notNull(),
4089
4487
  active: (0, import_mysql_core7.boolean)("active").notNull().default(true),
@@ -4099,166 +4497,562 @@ var getUserRolesSchema = /* @__PURE__ */ __name((mysqlTable) => {
4099
4497
  mode: "date",
4100
4498
  fsp: 3
4101
4499
  })
4500
+ }, (cc) => ({
4501
+ userIdIdx: (0, import_mysql_core7.index)("userId_idx").on(cc.userId),
4502
+ contentIdIdx: (0, import_mysql_core7.index)("contentId_idx").on(cc.contentId),
4503
+ contributionTypeIdIdx: (0, import_mysql_core7.index)("contributionTypeId_idx").on(cc.contributionTypeId)
4504
+ }));
4505
+ }
4506
+ __name(getContentContributionsSchema, "getContentContributionsSchema");
4507
+ function getContentContributionRelationsSchema(mysqlTable) {
4508
+ const contentContributions = getContentContributionsSchema(mysqlTable);
4509
+ const users = getUsersSchema(mysqlTable);
4510
+ const contentResource = getContentResourceSchema(mysqlTable);
4511
+ const contributionTypes = getContributionTypesSchema(mysqlTable);
4512
+ return (0, import_drizzle_orm5.relations)(contentContributions, ({ one }) => ({
4513
+ user: one(users, {
4514
+ fields: [
4515
+ contentContributions.userId
4516
+ ],
4517
+ references: [
4518
+ users.id
4519
+ ]
4520
+ }),
4521
+ content: one(contentResource, {
4522
+ fields: [
4523
+ contentContributions.contentId
4524
+ ],
4525
+ references: [
4526
+ contentResource.id
4527
+ ]
4528
+ }),
4529
+ contributionType: one(contributionTypes, {
4530
+ fields: [
4531
+ contentContributions.contributionTypeId
4532
+ ],
4533
+ references: [
4534
+ contributionTypes.id
4535
+ ]
4536
+ })
4537
+ }));
4538
+ }
4539
+ __name(getContentContributionRelationsSchema, "getContentContributionRelationsSchema");
4540
+
4541
+ // src/lib/mysql/schemas/auth/user-permissions.ts
4542
+ var import_drizzle_orm10 = require("drizzle-orm");
4543
+ var import_mysql_core12 = require("drizzle-orm/mysql-core");
4544
+
4545
+ // src/lib/mysql/schemas/auth/permissions.ts
4546
+ var import_drizzle_orm9 = require("drizzle-orm");
4547
+ var import_mysql_core11 = require("drizzle-orm/mysql-core");
4548
+
4549
+ // src/lib/mysql/schemas/auth/role-permissions.ts
4550
+ var import_drizzle_orm8 = require("drizzle-orm");
4551
+ var import_mysql_core10 = require("drizzle-orm/mysql-core");
4552
+
4553
+ // src/lib/mysql/schemas/auth/roles.ts
4554
+ var import_drizzle_orm7 = require("drizzle-orm");
4555
+ var import_mysql_core9 = require("drizzle-orm/mysql-core");
4556
+
4557
+ // src/lib/mysql/schemas/auth/user-roles.ts
4558
+ var import_drizzle_orm6 = require("drizzle-orm");
4559
+ var import_mysql_core8 = require("drizzle-orm/mysql-core");
4560
+ function getUserRolesSchema(mysqlTable) {
4561
+ return mysqlTable("userRole", {
4562
+ userId: (0, import_mysql_core8.varchar)("userId", {
4563
+ length: 255
4564
+ }).notNull(),
4565
+ roleId: (0, import_mysql_core8.varchar)("roleId", {
4566
+ length: 255
4567
+ }).notNull(),
4568
+ active: (0, import_mysql_core8.boolean)("active").notNull().default(true),
4569
+ createdAt: (0, import_mysql_core8.timestamp)("createdAt", {
4570
+ mode: "date",
4571
+ fsp: 3
4572
+ }).defaultNow(),
4573
+ updatedAt: (0, import_mysql_core8.timestamp)("updatedAt", {
4574
+ mode: "date",
4575
+ fsp: 3
4576
+ }).defaultNow(),
4577
+ deletedAt: (0, import_mysql_core8.timestamp)("deletedAt", {
4578
+ mode: "date",
4579
+ fsp: 3
4580
+ })
4102
4581
  }, (ur) => ({
4103
- pk: (0, import_mysql_core7.primaryKey)({
4582
+ pk: (0, import_mysql_core8.primaryKey)({
4104
4583
  columns: [
4105
4584
  ur.userId,
4106
4585
  ur.roleId
4107
4586
  ]
4108
4587
  }),
4109
- userIdIdx: (0, import_mysql_core7.index)("userId_idx").on(ur.userId),
4110
- roleIdIdx: (0, import_mysql_core7.index)("roleId_idx").on(ur.roleId)
4588
+ userIdIdx: (0, import_mysql_core8.index)("userId_idx").on(ur.userId),
4589
+ roleIdIdx: (0, import_mysql_core8.index)("roleId_idx").on(ur.roleId)
4111
4590
  }));
4112
- return {
4113
- userRoles
4114
- };
4115
- }, "getUserRolesSchema");
4591
+ }
4592
+ __name(getUserRolesSchema, "getUserRolesSchema");
4593
+ function getUserRolesRelationsSchema(mysqlTable) {
4594
+ const userRoles = getUserRolesSchema(mysqlTable);
4595
+ const users = getUsersSchema(mysqlTable);
4596
+ const roles = getRolesSchema(mysqlTable);
4597
+ return (0, import_drizzle_orm6.relations)(userRoles, ({ one }) => ({
4598
+ user: one(users, {
4599
+ fields: [
4600
+ userRoles.userId
4601
+ ],
4602
+ references: [
4603
+ users.id
4604
+ ]
4605
+ }),
4606
+ role: one(roles, {
4607
+ fields: [
4608
+ userRoles.roleId
4609
+ ],
4610
+ references: [
4611
+ roles.id
4612
+ ]
4613
+ })
4614
+ }));
4615
+ }
4616
+ __name(getUserRolesRelationsSchema, "getUserRolesRelationsSchema");
4116
4617
 
4117
- // src/lib/mysql/schemas/auth/users.ts
4118
- var import_drizzle_orm = require("drizzle-orm");
4119
- var import_mysql_core8 = require("drizzle-orm/mysql-core");
4120
- function getUsersSchema(mysqlTable) {
4121
- const users = mysqlTable("user", {
4122
- id: (0, import_mysql_core8.varchar)("id", {
4618
+ // src/lib/mysql/schemas/auth/roles.ts
4619
+ function getRolesSchema(mysqlTable) {
4620
+ return mysqlTable("role", {
4621
+ id: (0, import_mysql_core9.varchar)("id", {
4123
4622
  length: 255
4124
4623
  }).notNull().primaryKey(),
4125
- name: (0, import_mysql_core8.varchar)("name", {
4126
- length: 255
4127
- }),
4128
- role: (0, import_mysql_core8.mysqlEnum)("role", [
4129
- "user",
4130
- "admin"
4131
- ]).default("user"),
4132
- email: (0, import_mysql_core8.varchar)("email", {
4624
+ name: (0, import_mysql_core9.varchar)("name", {
4133
4625
  length: 255
4134
4626
  }).notNull().unique(),
4135
- emailVerified: (0, import_mysql_core8.timestamp)("emailVerified", {
4627
+ description: (0, import_mysql_core9.text)("description"),
4628
+ active: (0, import_mysql_core9.boolean)("active").notNull().default(true),
4629
+ createdAt: (0, import_mysql_core9.timestamp)("createdAt", {
4136
4630
  mode: "date",
4137
4631
  fsp: 3
4138
- }),
4139
- image: (0, import_mysql_core8.varchar)("image", {
4140
- length: 255
4141
- }),
4142
- createdAt: (0, import_mysql_core8.timestamp)("createdAt", {
4632
+ }).defaultNow(),
4633
+ updatedAt: (0, import_mysql_core9.timestamp)("updatedAt", {
4143
4634
  mode: "date",
4144
4635
  fsp: 3
4145
- }).default(import_drizzle_orm.sql`CURRENT_TIMESTAMP(3)`)
4146
- }, (user) => ({
4147
- emailIdx: (0, import_mysql_core8.index)("email_idx").on(user.email),
4148
- roleIdx: (0, import_mysql_core8.index)("role_idx").on(user.role)
4636
+ }).defaultNow(),
4637
+ deletedAt: (0, import_mysql_core9.timestamp)("deletedAt", {
4638
+ mode: "date",
4639
+ fsp: 3
4640
+ })
4641
+ }, (role) => ({
4642
+ nameIdx: (0, import_mysql_core9.index)("name_idx").on(role.name)
4149
4643
  }));
4150
- return {
4151
- users
4152
- };
4153
4644
  }
4154
- __name(getUsersSchema, "getUsersSchema");
4645
+ __name(getRolesSchema, "getRolesSchema");
4646
+ function getRolesRelationsSchema(mysqlTable) {
4647
+ const roles = getRolesSchema(mysqlTable);
4648
+ const userRoles = getUserRolesSchema(mysqlTable);
4649
+ return (0, import_drizzle_orm7.relations)(roles, ({ many }) => ({
4650
+ userRoles: many(userRoles)
4651
+ }));
4652
+ }
4653
+ __name(getRolesRelationsSchema, "getRolesRelationsSchema");
4155
4654
 
4156
- // src/lib/mysql/schemas/auth/verification-tokens.ts
4157
- var import_mysql_core9 = require("drizzle-orm/mysql-core");
4158
- var getVerificationTokensSchema = /* @__PURE__ */ __name((mysqlTable) => {
4159
- const verificationTokens = mysqlTable("verificationToken", {
4160
- identifier: (0, import_mysql_core9.varchar)("identifier", {
4655
+ // src/lib/mysql/schemas/auth/role-permissions.ts
4656
+ function getRolePermissionsSchema(mysqlTable) {
4657
+ return mysqlTable("rolePermission", {
4658
+ roleId: (0, import_mysql_core10.varchar)("roleId", {
4161
4659
  length: 255
4162
4660
  }).notNull(),
4163
- token: (0, import_mysql_core9.varchar)("token", {
4661
+ permissionId: (0, import_mysql_core10.varchar)("permissionId", {
4164
4662
  length: 255
4165
4663
  }).notNull(),
4166
- expires: (0, import_mysql_core9.timestamp)("expires", {
4167
- mode: "date"
4168
- }).notNull(),
4169
- createdAt: (0, import_mysql_core9.timestamp)("createdAt", {
4664
+ active: (0, import_mysql_core10.boolean)("active").notNull().default(true),
4665
+ createdAt: (0, import_mysql_core10.timestamp)("createdAt", {
4170
4666
  mode: "date",
4171
4667
  fsp: 3
4172
- }).defaultNow()
4173
- }, (vt) => ({
4174
- pk: (0, import_mysql_core9.primaryKey)({
4668
+ }).defaultNow(),
4669
+ updatedAt: (0, import_mysql_core10.timestamp)("updatedAt", {
4670
+ mode: "date",
4671
+ fsp: 3
4672
+ }).defaultNow(),
4673
+ deletedAt: (0, import_mysql_core10.timestamp)("deletedAt", {
4674
+ mode: "date",
4675
+ fsp: 3
4676
+ })
4677
+ }, (rp) => ({
4678
+ pk: (0, import_mysql_core10.primaryKey)({
4175
4679
  columns: [
4176
- vt.identifier,
4177
- vt.token
4680
+ rp.roleId,
4681
+ rp.permissionId
4682
+ ]
4683
+ }),
4684
+ roleIdIdx: (0, import_mysql_core10.index)("roleId_idx").on(rp.roleId),
4685
+ permissionIdIdx: (0, import_mysql_core10.index)("permissionId_idx").on(rp.permissionId)
4686
+ }));
4687
+ }
4688
+ __name(getRolePermissionsSchema, "getRolePermissionsSchema");
4689
+ function getRolePermissionsRelationsSchema(mysqlTable) {
4690
+ const permissions = getPermissionsSchema(mysqlTable);
4691
+ const roles = getRolesSchema(mysqlTable);
4692
+ const rolePermissions = getRolePermissionsSchema(mysqlTable);
4693
+ return (0, import_drizzle_orm8.relations)(rolePermissions, ({ one }) => ({
4694
+ role: one(roles, {
4695
+ fields: [
4696
+ rolePermissions.roleId
4697
+ ],
4698
+ references: [
4699
+ roles.id
4700
+ ]
4701
+ }),
4702
+ permission: one(permissions, {
4703
+ fields: [
4704
+ rolePermissions.permissionId
4705
+ ],
4706
+ references: [
4707
+ permissions.id
4178
4708
  ]
4179
4709
  })
4180
4710
  }));
4181
- return {
4182
- verificationTokens
4183
- };
4184
- }, "getVerificationTokensSchema");
4711
+ }
4712
+ __name(getRolePermissionsRelationsSchema, "getRolePermissionsRelationsSchema");
4185
4713
 
4186
- // src/lib/mysql/schemas/commerce/coupon.ts
4187
- var import_drizzle_orm2 = require("drizzle-orm");
4188
- var import_mysql_core10 = require("drizzle-orm/mysql-core");
4189
- var getCouponSchema = /* @__PURE__ */ __name((mysqlTable) => {
4190
- const coupon = mysqlTable("coupons", {
4191
- id: (0, import_mysql_core10.varchar)("id", {
4714
+ // src/lib/mysql/schemas/auth/permissions.ts
4715
+ function getPermissionsSchema(mysqlTable) {
4716
+ return mysqlTable("permission", {
4717
+ id: (0, import_mysql_core11.varchar)("id", {
4718
+ length: 255
4719
+ }).notNull().primaryKey(),
4720
+ name: (0, import_mysql_core11.varchar)("name", {
4721
+ length: 255
4722
+ }).notNull().unique(),
4723
+ description: (0, import_mysql_core11.text)("description"),
4724
+ active: (0, import_mysql_core11.boolean)("active").notNull().default(true),
4725
+ createdAt: (0, import_mysql_core11.timestamp)("createdAt", {
4726
+ mode: "date",
4727
+ fsp: 3
4728
+ }).defaultNow(),
4729
+ updatedAt: (0, import_mysql_core11.timestamp)("updatedAt", {
4730
+ mode: "date",
4731
+ fsp: 3
4732
+ }).defaultNow(),
4733
+ deletedAt: (0, import_mysql_core11.timestamp)("deletedAt", {
4734
+ mode: "date",
4735
+ fsp: 3
4736
+ })
4737
+ }, (permission) => ({
4738
+ nameIdx: (0, import_mysql_core11.index)("name_idx").on(permission.name)
4739
+ }));
4740
+ }
4741
+ __name(getPermissionsSchema, "getPermissionsSchema");
4742
+ function getPermissionsRelationsSchema(mysqlTable) {
4743
+ return (0, import_drizzle_orm9.relations)(getPermissionsSchema(mysqlTable), ({ many }) => ({
4744
+ rolePermissions: many(getRolePermissionsSchema(mysqlTable))
4745
+ }));
4746
+ }
4747
+ __name(getPermissionsRelationsSchema, "getPermissionsRelationsSchema");
4748
+
4749
+ // src/lib/mysql/schemas/auth/user-permissions.ts
4750
+ function getUserPermissionsSchema(mysqlTable) {
4751
+ return mysqlTable("userPermission", {
4752
+ userId: (0, import_mysql_core12.varchar)("userId", {
4753
+ length: 255
4754
+ }).notNull(),
4755
+ permissionId: (0, import_mysql_core12.varchar)("permissionId", {
4756
+ length: 255
4757
+ }).notNull(),
4758
+ active: (0, import_mysql_core12.boolean)("active").notNull().default(true),
4759
+ createdAt: (0, import_mysql_core12.timestamp)("createdAt", {
4760
+ mode: "date",
4761
+ fsp: 3
4762
+ }).defaultNow(),
4763
+ updatedAt: (0, import_mysql_core12.timestamp)("updatedAt", {
4764
+ mode: "date",
4765
+ fsp: 3
4766
+ }).defaultNow(),
4767
+ deletedAt: (0, import_mysql_core12.timestamp)("deletedAt", {
4768
+ mode: "date",
4769
+ fsp: 3
4770
+ })
4771
+ }, (up) => ({
4772
+ pk: (0, import_mysql_core12.primaryKey)({
4773
+ columns: [
4774
+ up.userId,
4775
+ up.permissionId
4776
+ ]
4777
+ }),
4778
+ userIdIdx: (0, import_mysql_core12.index)("userId_idx").on(up.userId),
4779
+ permissionIdIdx: (0, import_mysql_core12.index)("permissionId_idx").on(up.permissionId)
4780
+ }));
4781
+ }
4782
+ __name(getUserPermissionsSchema, "getUserPermissionsSchema");
4783
+ function getUserPermissionsRelationsSchema(mysqlTable) {
4784
+ const userPermissions = getUserPermissionsSchema(mysqlTable);
4785
+ const users = getUsersSchema(mysqlTable);
4786
+ const permissions = getPermissionsSchema(mysqlTable);
4787
+ return (0, import_drizzle_orm10.relations)(userPermissions, ({ one }) => ({
4788
+ user: one(users, {
4789
+ fields: [
4790
+ userPermissions.userId
4791
+ ],
4792
+ references: [
4793
+ users.id
4794
+ ]
4795
+ }),
4796
+ permission: one(permissions, {
4797
+ fields: [
4798
+ userPermissions.permissionId
4799
+ ],
4800
+ references: [
4801
+ permissions.id
4802
+ ]
4803
+ })
4804
+ }));
4805
+ }
4806
+ __name(getUserPermissionsRelationsSchema, "getUserPermissionsRelationsSchema");
4807
+
4808
+ // src/lib/mysql/schemas/auth/users.ts
4809
+ function getUsersSchema(mysqlTable) {
4810
+ return mysqlTable("user", {
4811
+ id: (0, import_mysql_core13.varchar)("id", {
4812
+ length: 255
4813
+ }).notNull().primaryKey(),
4814
+ name: (0, import_mysql_core13.varchar)("name", {
4815
+ length: 255
4816
+ }),
4817
+ role: (0, import_mysql_core13.mysqlEnum)("role", [
4818
+ "user",
4819
+ "admin"
4820
+ ]).default("user"),
4821
+ email: (0, import_mysql_core13.varchar)("email", {
4822
+ length: 255
4823
+ }).notNull().unique(),
4824
+ emailVerified: (0, import_mysql_core13.timestamp)("emailVerified", {
4825
+ mode: "date",
4826
+ fsp: 3
4827
+ }),
4828
+ image: (0, import_mysql_core13.varchar)("image", {
4829
+ length: 255
4830
+ }),
4831
+ createdAt: (0, import_mysql_core13.timestamp)("createdAt", {
4832
+ mode: "date",
4833
+ fsp: 3
4834
+ }).default(import_drizzle_orm11.sql`CURRENT_TIMESTAMP(3)`)
4835
+ }, (user) => ({
4836
+ emailIdx: (0, import_mysql_core13.index)("email_idx").on(user.email),
4837
+ roleIdx: (0, import_mysql_core13.index)("role_idx").on(user.role),
4838
+ createdAtIdx: (0, import_mysql_core13.index)("created_at_idx").on(user.createdAt)
4839
+ }));
4840
+ }
4841
+ __name(getUsersSchema, "getUsersSchema");
4842
+ function getUsersRelationsSchema(mysqlTable) {
4843
+ const users = getUsersSchema(mysqlTable);
4844
+ const accounts = getAccountsSchema(mysqlTable);
4845
+ const communicationPreferences = getCommunicationPreferencesSchema(mysqlTable);
4846
+ const userRoles = getUserRolesSchema(mysqlTable);
4847
+ const userPermissions = getUserPermissionsSchema(mysqlTable);
4848
+ const contentContributions = getContentContributionsSchema(mysqlTable);
4849
+ const contentResource = getContentResourceSchema(mysqlTable);
4850
+ return (0, import_drizzle_orm11.relations)(users, ({ many }) => ({
4851
+ accounts: many(accounts),
4852
+ communicationPreferences: many(communicationPreferences),
4853
+ userRoles: many(userRoles),
4854
+ userPermissions: many(userPermissions),
4855
+ contributions: many(contentContributions),
4856
+ createdContent: many(contentResource)
4857
+ }));
4858
+ }
4859
+ __name(getUsersRelationsSchema, "getUsersRelationsSchema");
4860
+
4861
+ // src/lib/mysql/schemas/auth/accounts.ts
4862
+ function getAccountsSchema(mysqlTable) {
4863
+ return mysqlTable("account", {
4864
+ userId: (0, import_mysql_core14.varchar)("userId", {
4865
+ length: 255
4866
+ }).notNull(),
4867
+ type: (0, import_mysql_core14.varchar)("type", {
4868
+ length: 255
4869
+ }).$type().notNull(),
4870
+ provider: (0, import_mysql_core14.varchar)("provider", {
4871
+ length: 255
4872
+ }).notNull(),
4873
+ providerAccountId: (0, import_mysql_core14.varchar)("providerAccountId", {
4874
+ length: 255
4875
+ }).notNull(),
4876
+ refresh_token: (0, import_mysql_core14.text)("refresh_token"),
4877
+ access_token: (0, import_mysql_core14.text)("access_token"),
4878
+ oauth_token: (0, import_mysql_core14.text)("oauth_token"),
4879
+ oauth_token_secret: (0, import_mysql_core14.text)("oauth_token_secret"),
4880
+ expires_at: (0, import_mysql_core14.int)("expires_at"),
4881
+ token_type: (0, import_mysql_core14.varchar)("token_type", {
4882
+ length: 255
4883
+ }),
4884
+ scope: (0, import_mysql_core14.varchar)("scope", {
4885
+ length: 255
4886
+ }),
4887
+ id_token: (0, import_mysql_core14.text)("id_token"),
4888
+ session_state: (0, import_mysql_core14.varchar)("session_state", {
4889
+ length: 255
4890
+ }),
4891
+ refresh_token_expires_in: (0, import_mysql_core14.int)("refresh_token_expires_in")
4892
+ }, (account) => ({
4893
+ pk: (0, import_mysql_core14.primaryKey)({
4894
+ columns: [
4895
+ account.provider,
4896
+ account.providerAccountId
4897
+ ]
4898
+ }),
4899
+ userIdIdx: (0, import_mysql_core14.index)("userId_idx").on(account.userId)
4900
+ }));
4901
+ }
4902
+ __name(getAccountsSchema, "getAccountsSchema");
4903
+ function getAccountsRelationsSchema(mysqlTable) {
4904
+ const accounts = getAccountsSchema(mysqlTable);
4905
+ const users = getUsersSchema(mysqlTable);
4906
+ return (0, import_drizzle_orm12.relations)(accounts, ({ one }) => ({
4907
+ user: one(users, {
4908
+ fields: [
4909
+ accounts.userId
4910
+ ],
4911
+ references: [
4912
+ users.id
4913
+ ]
4914
+ })
4915
+ }));
4916
+ }
4917
+ __name(getAccountsRelationsSchema, "getAccountsRelationsSchema");
4918
+
4919
+ // src/lib/mysql/schemas/auth/sessions.ts
4920
+ var import_drizzle_orm13 = require("drizzle-orm");
4921
+ var import_mysql_core15 = require("drizzle-orm/mysql-core");
4922
+ function getSessionsSchema(mysqlTable) {
4923
+ return mysqlTable("session", {
4924
+ sessionToken: (0, import_mysql_core15.varchar)("sessionToken", {
4925
+ length: 255
4926
+ }).notNull().primaryKey(),
4927
+ userId: (0, import_mysql_core15.varchar)("userId", {
4928
+ length: 255
4929
+ }).notNull(),
4930
+ expires: (0, import_mysql_core15.timestamp)("expires", {
4931
+ mode: "date"
4932
+ }).notNull()
4933
+ }, (session) => ({
4934
+ userIdIdx: (0, import_mysql_core15.index)("userId_idx").on(session.userId)
4935
+ }));
4936
+ }
4937
+ __name(getSessionsSchema, "getSessionsSchema");
4938
+ function getSessionRelationsSchema(mysqlTable) {
4939
+ const sessions = getSessionsSchema(mysqlTable);
4940
+ const users = getUsersSchema(mysqlTable);
4941
+ return (0, import_drizzle_orm13.relations)(sessions, ({ one }) => ({
4942
+ user: one(users, {
4943
+ fields: [
4944
+ sessions.userId
4945
+ ],
4946
+ references: [
4947
+ users.id
4948
+ ]
4949
+ })
4950
+ }));
4951
+ }
4952
+ __name(getSessionRelationsSchema, "getSessionRelationsSchema");
4953
+
4954
+ // src/lib/mysql/schemas/auth/verification-tokens.ts
4955
+ var import_mysql_core16 = require("drizzle-orm/mysql-core");
4956
+ function getVerificationTokensSchema(mysqlTable) {
4957
+ return mysqlTable("verificationToken", {
4958
+ identifier: (0, import_mysql_core16.varchar)("identifier", {
4959
+ length: 255
4960
+ }).notNull(),
4961
+ token: (0, import_mysql_core16.varchar)("token", {
4962
+ length: 255
4963
+ }).notNull(),
4964
+ expires: (0, import_mysql_core16.timestamp)("expires", {
4965
+ mode: "date"
4966
+ }).notNull(),
4967
+ createdAt: (0, import_mysql_core16.timestamp)("createdAt", {
4968
+ mode: "date",
4969
+ fsp: 3
4970
+ }).defaultNow()
4971
+ }, (vt) => ({
4972
+ pk: (0, import_mysql_core16.primaryKey)({
4973
+ columns: [
4974
+ vt.identifier,
4975
+ vt.token
4976
+ ]
4977
+ })
4978
+ }));
4979
+ }
4980
+ __name(getVerificationTokensSchema, "getVerificationTokensSchema");
4981
+
4982
+ // src/lib/mysql/schemas/commerce/coupon.ts
4983
+ var import_drizzle_orm14 = require("drizzle-orm");
4984
+ var import_mysql_core17 = require("drizzle-orm/mysql-core");
4985
+ function getCouponSchema(mysqlTable) {
4986
+ return mysqlTable("coupons", {
4987
+ id: (0, import_mysql_core17.varchar)("id", {
4192
4988
  length: 191
4193
4989
  }).notNull(),
4194
- code: (0, import_mysql_core10.varchar)("code", {
4990
+ code: (0, import_mysql_core17.varchar)("code", {
4195
4991
  length: 191
4196
4992
  }),
4197
- createdAt: (0, import_mysql_core10.datetime)("createdAt", {
4993
+ createdAt: (0, import_mysql_core17.datetime)("createdAt", {
4198
4994
  mode: "string",
4199
4995
  fsp: 3
4200
- }).default(import_drizzle_orm2.sql`CURRENT_TIMESTAMP(3)`).notNull(),
4201
- expires: (0, import_mysql_core10.datetime)("expires", {
4996
+ }).default(import_drizzle_orm14.sql`CURRENT_TIMESTAMP(3)`).notNull(),
4997
+ expires: (0, import_mysql_core17.datetime)("expires", {
4202
4998
  mode: "string",
4203
4999
  fsp: 3
4204
5000
  }),
4205
- metadata: (0, import_mysql_core10.json)("fields").$type().default({}),
4206
- maxUses: (0, import_mysql_core10.int)("maxUses").default(-1).notNull(),
4207
- default: (0, import_mysql_core10.tinyint)("default").default(0).notNull(),
4208
- merchantCouponId: (0, import_mysql_core10.varchar)("merchantCouponId", {
5001
+ metadata: (0, import_mysql_core17.json)("fields").$type().default({}),
5002
+ maxUses: (0, import_mysql_core17.int)("maxUses").default(-1).notNull(),
5003
+ default: (0, import_mysql_core17.tinyint)("default").default(0).notNull(),
5004
+ merchantCouponId: (0, import_mysql_core17.varchar)("merchantCouponId", {
4209
5005
  length: 191
4210
5006
  }),
4211
- status: (0, import_mysql_core10.int)("status").default(0).notNull(),
4212
- usedCount: (0, import_mysql_core10.int)("usedCount").default(0).notNull(),
4213
- percentageDiscount: (0, import_mysql_core10.decimal)("percentageDiscount", {
5007
+ status: (0, import_mysql_core17.int)("status").default(0).notNull(),
5008
+ usedCount: (0, import_mysql_core17.int)("usedCount").default(0).notNull(),
5009
+ percentageDiscount: (0, import_mysql_core17.decimal)("percentageDiscount", {
4214
5010
  precision: 3,
4215
5011
  scale: 2
4216
5012
  }).notNull(),
4217
- restrictedToProductId: (0, import_mysql_core10.varchar)("restrictedToProductId", {
5013
+ restrictedToProductId: (0, import_mysql_core17.varchar)("restrictedToProductId", {
4218
5014
  length: 191
4219
5015
  }),
4220
- bulkPurchaseId: (0, import_mysql_core10.varchar)("bulkPurchaseId", {
5016
+ bulkPurchaseId: (0, import_mysql_core17.varchar)("bulkPurchaseId", {
4221
5017
  length: 191
4222
5018
  })
4223
5019
  }, (table) => {
4224
5020
  return {
4225
- couponId: (0, import_mysql_core10.primaryKey)({
5021
+ couponId: (0, import_mysql_core17.primaryKey)({
4226
5022
  columns: [
4227
5023
  table.id
4228
5024
  ],
4229
5025
  name: "Coupon_id"
4230
5026
  }),
4231
- couponBulkPurchaseIdKey: (0, import_mysql_core10.unique)("Coupon_bulkPurchaseId_key").on(table.bulkPurchaseId),
4232
- couponCodeKey: (0, import_mysql_core10.unique)("Coupon_code_key").on(table.code)
5027
+ couponBulkPurchaseIdKey: (0, import_mysql_core17.unique)("Coupon_bulkPurchaseId_key").on(table.bulkPurchaseId),
5028
+ couponCodeKey: (0, import_mysql_core17.unique)("Coupon_code_key").on(table.code)
4233
5029
  };
4234
5030
  });
4235
- return {
4236
- coupon
4237
- };
4238
- }, "getCouponSchema");
5031
+ }
5032
+ __name(getCouponSchema, "getCouponSchema");
4239
5033
 
4240
5034
  // src/lib/mysql/schemas/commerce/merchant-account.ts
4241
- var import_drizzle_orm3 = require("drizzle-orm");
4242
- var import_mysql_core11 = require("drizzle-orm/mysql-core");
4243
- var getMerchantAccountSchema = /* @__PURE__ */ __name((mysqlTable) => {
4244
- const merchantAccount = mysqlTable("merchantAccounts", {
4245
- id: (0, import_mysql_core11.varchar)("id", {
5035
+ var import_drizzle_orm15 = require("drizzle-orm");
5036
+ var import_mysql_core18 = require("drizzle-orm/mysql-core");
5037
+ function getMerchantAccountSchema(mysqlTable) {
5038
+ return mysqlTable("merchantAccounts", {
5039
+ id: (0, import_mysql_core18.varchar)("id", {
4246
5040
  length: 191
4247
5041
  }).notNull(),
4248
- status: (0, import_mysql_core11.int)("status").default(0).notNull(),
4249
- createdAt: (0, import_mysql_core11.datetime)("createdAt", {
5042
+ status: (0, import_mysql_core18.int)("status").default(0).notNull(),
5043
+ createdAt: (0, import_mysql_core18.datetime)("createdAt", {
4250
5044
  mode: "string",
4251
5045
  fsp: 3
4252
- }).default(import_drizzle_orm3.sql`CURRENT_TIMESTAMP(3)`).notNull(),
4253
- label: (0, import_mysql_core11.varchar)("label", {
5046
+ }).default(import_drizzle_orm15.sql`CURRENT_TIMESTAMP(3)`).notNull(),
5047
+ label: (0, import_mysql_core18.varchar)("label", {
4254
5048
  length: 191
4255
5049
  }),
4256
- identifier: (0, import_mysql_core11.varchar)("identifier", {
5050
+ identifier: (0, import_mysql_core18.varchar)("identifier", {
4257
5051
  length: 191
4258
5052
  })
4259
5053
  }, (table) => {
4260
5054
  return {
4261
- merchantAccountId: (0, import_mysql_core11.primaryKey)({
5055
+ merchantAccountId: (0, import_mysql_core18.primaryKey)({
4262
5056
  columns: [
4263
5057
  table.id
4264
5058
  ],
@@ -4266,225 +5060,213 @@ var getMerchantAccountSchema = /* @__PURE__ */ __name((mysqlTable) => {
4266
5060
  })
4267
5061
  };
4268
5062
  });
4269
- return {
4270
- merchantAccount
4271
- };
4272
- }, "getMerchantAccountSchema");
5063
+ }
5064
+ __name(getMerchantAccountSchema, "getMerchantAccountSchema");
4273
5065
 
4274
5066
  // src/lib/mysql/schemas/commerce/merchant-charge.ts
4275
- var import_drizzle_orm4 = require("drizzle-orm");
4276
- var import_mysql_core12 = require("drizzle-orm/mysql-core");
4277
- var getMerchantChargeSchema = /* @__PURE__ */ __name((mysqlTable) => {
4278
- const merchantCharge = mysqlTable("merchantCharges", {
4279
- id: (0, import_mysql_core12.varchar)("id", {
5067
+ var import_drizzle_orm16 = require("drizzle-orm");
5068
+ var import_mysql_core19 = require("drizzle-orm/mysql-core");
5069
+ function getMerchantChargeSchema(mysqlTable) {
5070
+ return mysqlTable("merchantCharges", {
5071
+ id: (0, import_mysql_core19.varchar)("id", {
4280
5072
  length: 191
4281
5073
  }).notNull(),
4282
- status: (0, import_mysql_core12.int)("status").default(0).notNull(),
4283
- identifier: (0, import_mysql_core12.varchar)("identifier", {
5074
+ status: (0, import_mysql_core19.int)("status").default(0).notNull(),
5075
+ identifier: (0, import_mysql_core19.varchar)("identifier", {
4284
5076
  length: 191
4285
5077
  }).notNull(),
4286
- userId: (0, import_mysql_core12.varchar)("userId", {
5078
+ userId: (0, import_mysql_core19.varchar)("userId", {
4287
5079
  length: 191
4288
5080
  }).notNull(),
4289
- merchantAccountId: (0, import_mysql_core12.varchar)("merchantAccountId", {
5081
+ merchantAccountId: (0, import_mysql_core19.varchar)("merchantAccountId", {
4290
5082
  length: 191
4291
5083
  }).notNull(),
4292
- merchantProductId: (0, import_mysql_core12.varchar)("merchantProductId", {
5084
+ merchantProductId: (0, import_mysql_core19.varchar)("merchantProductId", {
4293
5085
  length: 191
4294
5086
  }).notNull(),
4295
- createdAt: (0, import_mysql_core12.datetime)("createdAt", {
5087
+ createdAt: (0, import_mysql_core19.datetime)("createdAt", {
4296
5088
  mode: "string",
4297
5089
  fsp: 3
4298
- }).default(import_drizzle_orm4.sql`CURRENT_TIMESTAMP(3)`).notNull(),
4299
- merchantCustomerId: (0, import_mysql_core12.varchar)("merchantCustomerId", {
5090
+ }).default(import_drizzle_orm16.sql`CURRENT_TIMESTAMP(3)`).notNull(),
5091
+ merchantCustomerId: (0, import_mysql_core19.varchar)("merchantCustomerId", {
4300
5092
  length: 191
4301
5093
  }).notNull()
4302
5094
  }, (table) => {
4303
5095
  return {
4304
- merchantChargeId: (0, import_mysql_core12.primaryKey)({
5096
+ merchantChargeId: (0, import_mysql_core19.primaryKey)({
4305
5097
  columns: [
4306
5098
  table.id
4307
5099
  ],
4308
5100
  name: "MerchantCharge_id"
4309
5101
  }),
4310
- merchantChargeIdentifierKey: (0, import_mysql_core12.unique)("MerchantCharge_identifier_key").on(table.identifier)
5102
+ merchantChargeIdentifierKey: (0, import_mysql_core19.unique)("MerchantCharge_identifier_key").on(table.identifier)
4311
5103
  };
4312
5104
  });
4313
- return {
4314
- merchantCharge
4315
- };
4316
- }, "getMerchantChargeSchema");
5105
+ }
5106
+ __name(getMerchantChargeSchema, "getMerchantChargeSchema");
4317
5107
 
4318
5108
  // src/lib/mysql/schemas/commerce/merchant-coupon.ts
4319
- var import_mysql_core13 = require("drizzle-orm/mysql-core");
4320
- var getMerchantCouponSchema = /* @__PURE__ */ __name((mysqlTable) => {
4321
- const merchantCoupon = mysqlTable("merchantCoupons", {
4322
- id: (0, import_mysql_core13.varchar)("id", {
5109
+ var import_mysql_core20 = require("drizzle-orm/mysql-core");
5110
+ function getMerchantCouponSchema(mysqlTable) {
5111
+ return mysqlTable("merchantCoupons", {
5112
+ id: (0, import_mysql_core20.varchar)("id", {
4323
5113
  length: 191
4324
5114
  }).notNull(),
4325
- identifier: (0, import_mysql_core13.varchar)("identifier", {
5115
+ identifier: (0, import_mysql_core20.varchar)("identifier", {
4326
5116
  length: 191
4327
5117
  }),
4328
- status: (0, import_mysql_core13.int)("status").default(0).notNull(),
4329
- merchantAccountId: (0, import_mysql_core13.varchar)("merchantAccountId", {
5118
+ status: (0, import_mysql_core20.int)("status").default(0).notNull(),
5119
+ merchantAccountId: (0, import_mysql_core20.varchar)("merchantAccountId", {
4330
5120
  length: 191
4331
5121
  }).notNull(),
4332
- percentageDiscount: (0, import_mysql_core13.decimal)("percentageDiscount", {
5122
+ percentageDiscount: (0, import_mysql_core20.decimal)("percentageDiscount", {
4333
5123
  precision: 3,
4334
5124
  scale: 2
4335
5125
  }).notNull(),
4336
- type: (0, import_mysql_core13.varchar)("type", {
5126
+ type: (0, import_mysql_core20.varchar)("type", {
4337
5127
  length: 191
4338
5128
  })
4339
5129
  }, (table) => {
4340
5130
  return {
4341
- merchantCouponId: (0, import_mysql_core13.primaryKey)({
5131
+ merchantCouponId: (0, import_mysql_core20.primaryKey)({
4342
5132
  columns: [
4343
5133
  table.id
4344
5134
  ],
4345
5135
  name: "MerchantCoupon_id"
4346
5136
  }),
4347
- merchantCouponIdentifierKey: (0, import_mysql_core13.unique)("MerchantCoupon_identifier_key").on(table.identifier)
5137
+ merchantCouponIdentifierKey: (0, import_mysql_core20.unique)("MerchantCoupon_identifier_key").on(table.identifier)
4348
5138
  };
4349
5139
  });
4350
- return {
4351
- merchantCoupon
4352
- };
4353
- }, "getMerchantCouponSchema");
5140
+ }
5141
+ __name(getMerchantCouponSchema, "getMerchantCouponSchema");
4354
5142
 
4355
5143
  // src/lib/mysql/schemas/commerce/merchant-customer.ts
4356
- var import_drizzle_orm5 = require("drizzle-orm");
4357
- var import_mysql_core14 = require("drizzle-orm/mysql-core");
4358
- var getMerchantCustomerSchema = /* @__PURE__ */ __name((mysqlTable) => {
4359
- const merchantCustomer = mysqlTable("merchantCustomers", {
4360
- id: (0, import_mysql_core14.varchar)("id", {
5144
+ var import_drizzle_orm17 = require("drizzle-orm");
5145
+ var import_mysql_core21 = require("drizzle-orm/mysql-core");
5146
+ function getMerchantCustomerSchema(mysqlTable) {
5147
+ return mysqlTable("merchantCustomers", {
5148
+ id: (0, import_mysql_core21.varchar)("id", {
4361
5149
  length: 191
4362
5150
  }).notNull(),
4363
- userId: (0, import_mysql_core14.varchar)("userId", {
5151
+ userId: (0, import_mysql_core21.varchar)("userId", {
4364
5152
  length: 191
4365
5153
  }).notNull(),
4366
- merchantAccountId: (0, import_mysql_core14.varchar)("merchantAccountId", {
5154
+ merchantAccountId: (0, import_mysql_core21.varchar)("merchantAccountId", {
4367
5155
  length: 191
4368
5156
  }).notNull(),
4369
- identifier: (0, import_mysql_core14.varchar)("identifier", {
5157
+ identifier: (0, import_mysql_core21.varchar)("identifier", {
4370
5158
  length: 191
4371
5159
  }).notNull(),
4372
- createdAt: (0, import_mysql_core14.datetime)("createdAt", {
5160
+ createdAt: (0, import_mysql_core21.datetime)("createdAt", {
4373
5161
  mode: "string",
4374
5162
  fsp: 3
4375
- }).default(import_drizzle_orm5.sql`CURRENT_TIMESTAMP(3)`).notNull(),
4376
- status: (0, import_mysql_core14.int)("status").default(0)
5163
+ }).default(import_drizzle_orm17.sql`CURRENT_TIMESTAMP(3)`).notNull(),
5164
+ status: (0, import_mysql_core21.int)("status").default(0)
4377
5165
  }, (table) => {
4378
5166
  return {
4379
- merchantCustomerId: (0, import_mysql_core14.primaryKey)({
5167
+ merchantCustomerId: (0, import_mysql_core21.primaryKey)({
4380
5168
  columns: [
4381
5169
  table.id
4382
5170
  ],
4383
5171
  name: "MerchantCustomer_id"
4384
5172
  }),
4385
- merchantCustomerIdentifierKey: (0, import_mysql_core14.unique)("MerchantCustomer_identifier_key").on(table.identifier)
5173
+ merchantCustomerIdentifierKey: (0, import_mysql_core21.unique)("MerchantCustomer_identifier_key").on(table.identifier)
4386
5174
  };
4387
5175
  });
4388
- return {
4389
- merchantCustomer
4390
- };
4391
- }, "getMerchantCustomerSchema");
5176
+ }
5177
+ __name(getMerchantCustomerSchema, "getMerchantCustomerSchema");
4392
5178
 
4393
5179
  // src/lib/mysql/schemas/commerce/merchant-price.ts
4394
- var import_drizzle_orm6 = require("drizzle-orm");
4395
- var import_mysql_core15 = require("drizzle-orm/mysql-core");
4396
- var getMerchantPriceSchema = /* @__PURE__ */ __name((mysqlTable) => {
4397
- const merchantPrice = mysqlTable("merchantPrices", {
4398
- id: (0, import_mysql_core15.varchar)("id", {
5180
+ var import_drizzle_orm18 = require("drizzle-orm");
5181
+ var import_mysql_core22 = require("drizzle-orm/mysql-core");
5182
+ function getMerchantPriceSchema(mysqlTable) {
5183
+ return mysqlTable("merchantPrices", {
5184
+ id: (0, import_mysql_core22.varchar)("id", {
4399
5185
  length: 191
4400
5186
  }).notNull(),
4401
- merchantAccountId: (0, import_mysql_core15.varchar)("merchantAccountId", {
5187
+ merchantAccountId: (0, import_mysql_core22.varchar)("merchantAccountId", {
4402
5188
  length: 191
4403
5189
  }).notNull(),
4404
- merchantProductId: (0, import_mysql_core15.varchar)("merchantProductId", {
5190
+ merchantProductId: (0, import_mysql_core22.varchar)("merchantProductId", {
4405
5191
  length: 191
4406
5192
  }).notNull(),
4407
- status: (0, import_mysql_core15.int)("status").default(0),
4408
- identifier: (0, import_mysql_core15.varchar)("identifier", {
5193
+ status: (0, import_mysql_core22.int)("status").default(0),
5194
+ identifier: (0, import_mysql_core22.varchar)("identifier", {
4409
5195
  length: 191
4410
5196
  }),
4411
- createdAt: (0, import_mysql_core15.datetime)("createdAt", {
5197
+ createdAt: (0, import_mysql_core22.datetime)("createdAt", {
4412
5198
  mode: "string",
4413
5199
  fsp: 3
4414
- }).default(import_drizzle_orm6.sql`CURRENT_TIMESTAMP(3)`).notNull(),
4415
- priceId: (0, import_mysql_core15.varchar)("priceId", {
5200
+ }).default(import_drizzle_orm18.sql`CURRENT_TIMESTAMP(3)`).notNull(),
5201
+ priceId: (0, import_mysql_core22.varchar)("priceId", {
4416
5202
  length: 191
4417
5203
  })
4418
5204
  }, (table) => {
4419
5205
  return {
4420
- merchantPriceId: (0, import_mysql_core15.primaryKey)({
5206
+ merchantPriceId: (0, import_mysql_core22.primaryKey)({
4421
5207
  columns: [
4422
5208
  table.id
4423
5209
  ],
4424
5210
  name: "MerchantPrice_id"
4425
5211
  }),
4426
- merchantPriceIdentifierKey: (0, import_mysql_core15.unique)("MerchantPrice_identifier_key").on(table.identifier)
5212
+ merchantPriceIdentifierKey: (0, import_mysql_core22.unique)("MerchantPrice_identifier_key").on(table.identifier)
4427
5213
  };
4428
5214
  });
4429
- return {
4430
- merchantPrice
4431
- };
4432
- }, "getMerchantPriceSchema");
5215
+ }
5216
+ __name(getMerchantPriceSchema, "getMerchantPriceSchema");
4433
5217
 
4434
5218
  // src/lib/mysql/schemas/commerce/merchant-product.ts
4435
- var import_drizzle_orm7 = require("drizzle-orm");
4436
- var import_mysql_core16 = require("drizzle-orm/mysql-core");
4437
- var getMerchantProductSchema = /* @__PURE__ */ __name((mysqlTable) => {
4438
- const merchantProduct = mysqlTable("merchantProducts", {
4439
- id: (0, import_mysql_core16.varchar)("id", {
5219
+ var import_drizzle_orm19 = require("drizzle-orm");
5220
+ var import_mysql_core23 = require("drizzle-orm/mysql-core");
5221
+ function getMerchantProductSchema(mysqlTable) {
5222
+ return mysqlTable("merchantProducts", {
5223
+ id: (0, import_mysql_core23.varchar)("id", {
4440
5224
  length: 191
4441
5225
  }).notNull(),
4442
- merchantAccountId: (0, import_mysql_core16.varchar)("merchantAccountId", {
5226
+ merchantAccountId: (0, import_mysql_core23.varchar)("merchantAccountId", {
4443
5227
  length: 191
4444
5228
  }).notNull(),
4445
- productId: (0, import_mysql_core16.varchar)("productId", {
5229
+ productId: (0, import_mysql_core23.varchar)("productId", {
4446
5230
  length: 191
4447
5231
  }).notNull(),
4448
- status: (0, import_mysql_core16.int)("status").default(0).notNull(),
4449
- identifier: (0, import_mysql_core16.varchar)("identifier", {
5232
+ status: (0, import_mysql_core23.int)("status").default(0).notNull(),
5233
+ identifier: (0, import_mysql_core23.varchar)("identifier", {
4450
5234
  length: 191
4451
5235
  }),
4452
- createdAt: (0, import_mysql_core16.datetime)("createdAt", {
5236
+ createdAt: (0, import_mysql_core23.datetime)("createdAt", {
4453
5237
  mode: "string",
4454
5238
  fsp: 3
4455
- }).default(import_drizzle_orm7.sql`CURRENT_TIMESTAMP(3)`).notNull()
5239
+ }).default(import_drizzle_orm19.sql`CURRENT_TIMESTAMP(3)`).notNull()
4456
5240
  }, (table) => {
4457
5241
  return {
4458
- merchantProductId: (0, import_mysql_core16.primaryKey)({
5242
+ merchantProductId: (0, import_mysql_core23.primaryKey)({
4459
5243
  columns: [
4460
5244
  table.id
4461
5245
  ],
4462
5246
  name: "MerchantProduct_id"
4463
5247
  }),
4464
- merchantProductIdentifierKey: (0, import_mysql_core16.unique)("MerchantProduct_identifier_key").on(table.identifier)
5248
+ merchantProductIdentifierKey: (0, import_mysql_core23.unique)("MerchantProduct_identifier_key").on(table.identifier)
4465
5249
  };
4466
5250
  });
4467
- return {
4468
- merchantProduct
4469
- };
4470
- }, "getMerchantProductSchema");
5251
+ }
5252
+ __name(getMerchantProductSchema, "getMerchantProductSchema");
4471
5253
 
4472
5254
  // src/lib/mysql/schemas/commerce/merchant-session.ts
4473
- var import_mysql_core17 = require("drizzle-orm/mysql-core");
4474
- var getMerchantSessionSchema = /* @__PURE__ */ __name((mysqlTable) => {
4475
- const merchantSession = mysqlTable("merchantSessions", {
4476
- id: (0, import_mysql_core17.varchar)("id", {
5255
+ var import_mysql_core24 = require("drizzle-orm/mysql-core");
5256
+ function getMerchantSessionSchema(mysqlTable) {
5257
+ return mysqlTable("merchantSessions", {
5258
+ id: (0, import_mysql_core24.varchar)("id", {
4477
5259
  length: 191
4478
5260
  }).notNull(),
4479
- identifier: (0, import_mysql_core17.varchar)("identifier", {
5261
+ identifier: (0, import_mysql_core24.varchar)("identifier", {
4480
5262
  length: 191
4481
5263
  }).notNull(),
4482
- merchantAccountId: (0, import_mysql_core17.varchar)("merchantAccountId", {
5264
+ merchantAccountId: (0, import_mysql_core24.varchar)("merchantAccountId", {
4483
5265
  length: 191
4484
5266
  }).notNull()
4485
5267
  }, (table) => {
4486
5268
  return {
4487
- merchantSessionId: (0, import_mysql_core17.primaryKey)({
5269
+ merchantSessionId: (0, import_mysql_core24.primaryKey)({
4488
5270
  columns: [
4489
5271
  table.id
4490
5272
  ],
@@ -4492,38 +5274,36 @@ var getMerchantSessionSchema = /* @__PURE__ */ __name((mysqlTable) => {
4492
5274
  })
4493
5275
  };
4494
5276
  });
4495
- return {
4496
- merchantSession
4497
- };
4498
- }, "getMerchantSessionSchema");
5277
+ }
5278
+ __name(getMerchantSessionSchema, "getMerchantSessionSchema");
4499
5279
 
4500
5280
  // src/lib/mysql/schemas/commerce/price.ts
4501
- var import_drizzle_orm8 = require("drizzle-orm");
4502
- var import_mysql_core18 = require("drizzle-orm/mysql-core");
4503
- var getPriceSchema = /* @__PURE__ */ __name((mysqlTable) => {
4504
- const price = mysqlTable("prices", {
4505
- id: (0, import_mysql_core18.varchar)("id", {
5281
+ var import_drizzle_orm20 = require("drizzle-orm");
5282
+ var import_mysql_core25 = require("drizzle-orm/mysql-core");
5283
+ function getPriceSchema(mysqlTable) {
5284
+ return mysqlTable("prices", {
5285
+ id: (0, import_mysql_core25.varchar)("id", {
4506
5286
  length: 191
4507
5287
  }).notNull(),
4508
- productId: (0, import_mysql_core18.varchar)("productId", {
5288
+ productId: (0, import_mysql_core25.varchar)("productId", {
4509
5289
  length: 191
4510
5290
  }),
4511
- nickname: (0, import_mysql_core18.varchar)("nickname", {
5291
+ nickname: (0, import_mysql_core25.varchar)("nickname", {
4512
5292
  length: 191
4513
5293
  }),
4514
- status: (0, import_mysql_core18.int)("status").default(0).notNull(),
4515
- unitAmount: (0, import_mysql_core18.decimal)("unitAmount", {
5294
+ status: (0, import_mysql_core25.int)("status").default(0).notNull(),
5295
+ unitAmount: (0, import_mysql_core25.decimal)("unitAmount", {
4516
5296
  precision: 10,
4517
5297
  scale: 2
4518
5298
  }).notNull(),
4519
- createdAt: (0, import_mysql_core18.datetime)("createdAt", {
5299
+ createdAt: (0, import_mysql_core25.datetime)("createdAt", {
4520
5300
  mode: "string",
4521
5301
  fsp: 3
4522
- }).default(import_drizzle_orm8.sql`CURRENT_TIMESTAMP(3)`).notNull(),
4523
- metadata: (0, import_mysql_core18.json)("fields").$type().default({})
5302
+ }).default(import_drizzle_orm20.sql`CURRENT_TIMESTAMP(3)`).notNull(),
5303
+ metadata: (0, import_mysql_core25.json)("fields").$type().default({})
4524
5304
  }, (table) => {
4525
5305
  return {
4526
- priceId: (0, import_mysql_core18.primaryKey)({
5306
+ priceId: (0, import_mysql_core25.primaryKey)({
4527
5307
  columns: [
4528
5308
  table.id
4529
5309
  ],
@@ -4531,35 +5311,33 @@ var getPriceSchema = /* @__PURE__ */ __name((mysqlTable) => {
4531
5311
  })
4532
5312
  };
4533
5313
  });
4534
- return {
4535
- price
4536
- };
4537
- }, "getPriceSchema");
5314
+ }
5315
+ __name(getPriceSchema, "getPriceSchema");
4538
5316
 
4539
5317
  // src/lib/mysql/schemas/commerce/product.ts
4540
- var import_drizzle_orm9 = require("drizzle-orm");
4541
- var import_mysql_core19 = require("drizzle-orm/mysql-core");
4542
- var getProductSchema = /* @__PURE__ */ __name((mysqlTable) => {
4543
- const product = mysqlTable("products", {
4544
- id: (0, import_mysql_core19.varchar)("id", {
5318
+ var import_drizzle_orm21 = require("drizzle-orm");
5319
+ var import_mysql_core26 = require("drizzle-orm/mysql-core");
5320
+ function getProductSchema(mysqlTable) {
5321
+ return mysqlTable("products", {
5322
+ id: (0, import_mysql_core26.varchar)("id", {
4545
5323
  length: 191
4546
5324
  }).notNull(),
4547
- name: (0, import_mysql_core19.varchar)("name", {
5325
+ name: (0, import_mysql_core26.varchar)("name", {
4548
5326
  length: 191
4549
5327
  }).notNull(),
4550
- key: (0, import_mysql_core19.varchar)("key", {
5328
+ key: (0, import_mysql_core26.varchar)("key", {
4551
5329
  length: 191
4552
5330
  }),
4553
- metadata: (0, import_mysql_core19.json)("fields").$type().default({}),
4554
- createdAt: (0, import_mysql_core19.datetime)("createdAt", {
5331
+ metadata: (0, import_mysql_core26.json)("fields").$type().default({}),
5332
+ createdAt: (0, import_mysql_core26.datetime)("createdAt", {
4555
5333
  mode: "string",
4556
5334
  fsp: 3
4557
- }).default(import_drizzle_orm9.sql`CURRENT_TIMESTAMP(3)`).notNull(),
4558
- status: (0, import_mysql_core19.int)("status").default(0).notNull(),
4559
- quantityAvailable: (0, import_mysql_core19.int)("quantityAvailable").default(-1).notNull()
5335
+ }).default(import_drizzle_orm21.sql`CURRENT_TIMESTAMP(3)`).notNull(),
5336
+ status: (0, import_mysql_core26.int)("status").default(0).notNull(),
5337
+ quantityAvailable: (0, import_mysql_core26.int)("quantityAvailable").default(-1).notNull()
4560
5338
  }, (table) => {
4561
5339
  return {
4562
- productId: (0, import_mysql_core19.primaryKey)({
5340
+ productId: (0, import_mysql_core26.primaryKey)({
4563
5341
  columns: [
4564
5342
  table.id
4565
5343
  ],
@@ -4567,92 +5345,18 @@ var getProductSchema = /* @__PURE__ */ __name((mysqlTable) => {
4567
5345
  })
4568
5346
  };
4569
5347
  });
4570
- return {
4571
- product
4572
- };
4573
- }, "getProductSchema");
4574
-
4575
- // src/lib/mysql/schemas/commerce/purchase.ts
4576
- var import_drizzle_orm10 = require("drizzle-orm");
4577
- var import_mysql_core20 = require("drizzle-orm/mysql-core");
4578
- var getPurchaseSchema = /* @__PURE__ */ __name((mysqlTable) => {
4579
- const purchase = mysqlTable("purchases", {
4580
- id: (0, import_mysql_core20.varchar)("id", {
4581
- length: 191
4582
- }).notNull(),
4583
- userId: (0, import_mysql_core20.varchar)("userId", {
4584
- length: 191
4585
- }),
4586
- createdAt: (0, import_mysql_core20.datetime)("createdAt", {
4587
- mode: "string",
4588
- fsp: 3
4589
- }).default(import_drizzle_orm10.sql`CURRENT_TIMESTAMP(3)`).notNull(),
4590
- totalAmount: (0, import_mysql_core20.decimal)("totalAmount", {
4591
- precision: 65,
4592
- scale: 30
4593
- }).notNull(),
4594
- ipAddress: (0, import_mysql_core20.varchar)("ip_address", {
4595
- length: 191
4596
- }),
4597
- city: (0, import_mysql_core20.varchar)("city", {
4598
- length: 191
4599
- }),
4600
- state: (0, import_mysql_core20.varchar)("state", {
4601
- length: 191
4602
- }),
4603
- country: (0, import_mysql_core20.varchar)("country", {
4604
- length: 191
4605
- }),
4606
- couponId: (0, import_mysql_core20.varchar)("couponId", {
4607
- length: 191
4608
- }),
4609
- productId: (0, import_mysql_core20.varchar)("productId", {
4610
- length: 191
4611
- }).notNull(),
4612
- merchantChargeId: (0, import_mysql_core20.varchar)("merchantChargeId", {
4613
- length: 191
4614
- }),
4615
- upgradedFromId: (0, import_mysql_core20.varchar)("upgradedFromId", {
4616
- length: 191
4617
- }),
4618
- status: (0, import_mysql_core20.varchar)("status", {
4619
- length: 191
4620
- }).default("Valid").notNull(),
4621
- bulkCouponId: (0, import_mysql_core20.varchar)("bulkCouponId", {
4622
- length: 191
4623
- }),
4624
- merchantSessionId: (0, import_mysql_core20.varchar)("merchantSessionId", {
4625
- length: 191
4626
- }),
4627
- redeemedBulkCouponId: (0, import_mysql_core20.varchar)("redeemedBulkCouponId", {
4628
- length: 191
4629
- }),
4630
- metadata: (0, import_mysql_core20.json)("fields").$type().default({})
4631
- }, (table) => {
4632
- return {
4633
- purchaseId: (0, import_mysql_core20.primaryKey)({
4634
- columns: [
4635
- table.id
4636
- ],
4637
- name: "Purchase_id"
4638
- }),
4639
- purchaseUpgradedFromIdKey: (0, import_mysql_core20.unique)("Purchase_upgradedFromId_key").on(table.upgradedFromId)
4640
- };
4641
- });
4642
- return {
4643
- purchase
4644
- };
4645
- }, "getPurchaseSchema");
5348
+ }
5349
+ __name(getProductSchema, "getProductSchema");
4646
5350
 
4647
5351
  // src/lib/mysql/schemas/commerce/purchase-user-transfer.ts
4648
- var import_drizzle_orm11 = require("drizzle-orm");
4649
- var import_mysql_core21 = require("drizzle-orm/mysql-core");
4650
- var getPurchaseUserTransferSchema = /* @__PURE__ */ __name((mysqlTable) => {
4651
- const purchaseUserTransfer = mysqlTable("purchaseUserTransfers", {
4652
- id: (0, import_mysql_core21.varchar)("id", {
5352
+ var import_drizzle_orm22 = require("drizzle-orm");
5353
+ var import_mysql_core27 = require("drizzle-orm/mysql-core");
5354
+ function getPurchaseUserTransferSchema(mysqlTable) {
5355
+ return mysqlTable("purchaseUserTransfers", {
5356
+ id: (0, import_mysql_core27.varchar)("id", {
4653
5357
  length: 191
4654
5358
  }).notNull(),
4655
- transferState: (0, import_mysql_core21.mysqlEnum)("transferState", [
5359
+ transferState: (0, import_mysql_core27.mysqlEnum)("transferState", [
4656
5360
  "AVAILABLE",
4657
5361
  "INITIATED",
4658
5362
  "VERIFIED",
@@ -4661,38 +5365,38 @@ var getPurchaseUserTransferSchema = /* @__PURE__ */ __name((mysqlTable) => {
4661
5365
  "CONFIRMED",
4662
5366
  "COMPLETED"
4663
5367
  ]).default("AVAILABLE").notNull(),
4664
- purchaseId: (0, import_mysql_core21.varchar)("purchaseId", {
5368
+ purchaseId: (0, import_mysql_core27.varchar)("purchaseId", {
4665
5369
  length: 191
4666
5370
  }).notNull(),
4667
- sourceUserId: (0, import_mysql_core21.varchar)("sourceUserId", {
5371
+ sourceUserId: (0, import_mysql_core27.varchar)("sourceUserId", {
4668
5372
  length: 191
4669
5373
  }).notNull(),
4670
- targetUserId: (0, import_mysql_core21.varchar)("targetUserId", {
5374
+ targetUserId: (0, import_mysql_core27.varchar)("targetUserId", {
4671
5375
  length: 191
4672
5376
  }),
4673
- createdAt: (0, import_mysql_core21.datetime)("createdAt", {
5377
+ createdAt: (0, import_mysql_core27.datetime)("createdAt", {
4674
5378
  mode: "string",
4675
5379
  fsp: 3
4676
- }).default(import_drizzle_orm11.sql`CURRENT_TIMESTAMP(3)`).notNull(),
4677
- expiresAt: (0, import_mysql_core21.datetime)("expiresAt", {
5380
+ }).default(import_drizzle_orm22.sql`CURRENT_TIMESTAMP(3)`).notNull(),
5381
+ expiresAt: (0, import_mysql_core27.datetime)("expiresAt", {
4678
5382
  mode: "string",
4679
5383
  fsp: 3
4680
5384
  }),
4681
- canceledAt: (0, import_mysql_core21.datetime)("canceledAt", {
5385
+ canceledAt: (0, import_mysql_core27.datetime)("canceledAt", {
4682
5386
  mode: "string",
4683
5387
  fsp: 3
4684
5388
  }),
4685
- confirmedAt: (0, import_mysql_core21.datetime)("confirmedAt", {
5389
+ confirmedAt: (0, import_mysql_core27.datetime)("confirmedAt", {
4686
5390
  mode: "string",
4687
5391
  fsp: 3
4688
5392
  }),
4689
- completedAt: (0, import_mysql_core21.datetime)("completedAt", {
5393
+ completedAt: (0, import_mysql_core27.datetime)("completedAt", {
4690
5394
  mode: "string",
4691
5395
  fsp: 3
4692
5396
  })
4693
5397
  }, (table) => {
4694
5398
  return {
4695
- purchaseUserTransferId: (0, import_mysql_core21.primaryKey)({
5399
+ purchaseUserTransferId: (0, import_mysql_core27.primaryKey)({
4696
5400
  columns: [
4697
5401
  table.id
4698
5402
  ],
@@ -4700,282 +5404,84 @@ var getPurchaseUserTransferSchema = /* @__PURE__ */ __name((mysqlTable) => {
4700
5404
  })
4701
5405
  };
4702
5406
  });
4703
- return {
4704
- purchaseUserTransfer
4705
- };
4706
- }, "getPurchaseUserTransferSchema");
4707
-
4708
- // src/lib/mysql/schemas/communication/communication-channel.ts
4709
- var import_mysql_core22 = require("drizzle-orm/mysql-core");
4710
- var getCommunicationChannelSchema = /* @__PURE__ */ __name((mysqlTable) => {
4711
- const communicationChannel = mysqlTable("communicationChannel", {
4712
- id: (0, import_mysql_core22.varchar)("id", {
4713
- length: 255
4714
- }).notNull().primaryKey(),
4715
- name: (0, import_mysql_core22.varchar)("name", {
4716
- length: 255
4717
- }).notNull(),
4718
- description: (0, import_mysql_core22.text)("description"),
4719
- active: (0, import_mysql_core22.boolean)("active").notNull().default(true),
4720
- createdAt: (0, import_mysql_core22.timestamp)("createdAt", {
4721
- mode: "date",
4722
- fsp: 3
4723
- }).defaultNow(),
4724
- updatedAt: (0, import_mysql_core22.timestamp)("updatedAt", {
4725
- mode: "date",
4726
- fsp: 3
4727
- }).defaultNow(),
4728
- deletedAt: (0, import_mysql_core22.timestamp)("deletedAt", {
4729
- mode: "date",
4730
- fsp: 3
4731
- })
4732
- }, (cc) => ({
4733
- nameIdx: (0, import_mysql_core22.index)("name_idx").on(cc.name)
4734
- }));
4735
- return {
4736
- communicationChannel
4737
- };
4738
- }, "getCommunicationChannelSchema");
5407
+ }
5408
+ __name(getPurchaseUserTransferSchema, "getPurchaseUserTransferSchema");
4739
5409
 
4740
- // src/lib/mysql/schemas/communication/communication-preference-types.ts
4741
- var import_mysql_core23 = require("drizzle-orm/mysql-core");
4742
- var getCommunicationPreferenceTypesSchema = /* @__PURE__ */ __name((mysqlTable) => {
4743
- const communicationPreferenceTypes = mysqlTable("communicationPreferenceType", {
4744
- id: (0, import_mysql_core23.varchar)("id", {
4745
- length: 255
4746
- }).notNull().primaryKey(),
4747
- name: (0, import_mysql_core23.varchar)("name", {
4748
- length: 255
5410
+ // src/lib/mysql/schemas/commerce/purchase.ts
5411
+ var import_drizzle_orm23 = require("drizzle-orm");
5412
+ var import_mysql_core28 = require("drizzle-orm/mysql-core");
5413
+ function getPurchaseSchema(mysqlTable) {
5414
+ return mysqlTable("purchases", {
5415
+ id: (0, import_mysql_core28.varchar)("id", {
5416
+ length: 191
4749
5417
  }).notNull(),
4750
- description: (0, import_mysql_core23.text)("description"),
4751
- active: (0, import_mysql_core23.boolean)("active").notNull().default(true),
4752
- createdAt: (0, import_mysql_core23.timestamp)("createdAt", {
4753
- mode: "date",
4754
- fsp: 3
4755
- }).defaultNow(),
4756
- updatedAt: (0, import_mysql_core23.timestamp)("updatedAt", {
4757
- mode: "date",
4758
- fsp: 3
5418
+ userId: (0, import_mysql_core28.varchar)("userId", {
5419
+ length: 191
4759
5420
  }),
4760
- deletedAt: (0, import_mysql_core23.timestamp)("deletedAt", {
4761
- mode: "date",
5421
+ createdAt: (0, import_mysql_core28.datetime)("createdAt", {
5422
+ mode: "string",
4762
5423
  fsp: 3
4763
- })
4764
- });
4765
- return {
4766
- communicationPreferenceTypes
4767
- };
4768
- }, "getCommunicationPreferenceTypesSchema");
4769
-
4770
- // src/lib/mysql/schemas/communication/communication-preferences.ts
4771
- var import_mysql_core24 = require("drizzle-orm/mysql-core");
4772
- var getCommunicationPreferencesSchema = /* @__PURE__ */ __name((mysqlTable) => {
4773
- const communicationPreferences = mysqlTable("communicationPreference", {
4774
- id: (0, import_mysql_core24.varchar)("id", {
4775
- length: 255
4776
- }).notNull().primaryKey(),
4777
- userId: (0, import_mysql_core24.varchar)("userId", {
4778
- length: 255
4779
- }).notNull(),
4780
- channelId: (0, import_mysql_core24.varchar)("channelId", {
4781
- length: 255
4782
- }).notNull(),
4783
- preferenceLevel: (0, import_mysql_core24.mysqlEnum)("preferenceLevel", [
4784
- "low",
4785
- "medium",
4786
- "high"
4787
- ]).notNull().default("medium"),
4788
- preferenceTypeId: (0, import_mysql_core24.varchar)("preferenceTypeId", {
4789
- length: 255
5424
+ }).default(import_drizzle_orm23.sql`CURRENT_TIMESTAMP(3)`).notNull(),
5425
+ totalAmount: (0, import_mysql_core28.decimal)("totalAmount", {
5426
+ precision: 65,
5427
+ scale: 30
4790
5428
  }).notNull(),
4791
- active: (0, import_mysql_core24.boolean)("active").notNull().default(true),
4792
- createdAt: (0, import_mysql_core24.timestamp)("createdAt", {
4793
- mode: "date",
4794
- fsp: 3
4795
- }).defaultNow(),
4796
- optInAt: (0, import_mysql_core24.timestamp)("optInAt", {
4797
- mode: "date",
4798
- fsp: 3
5429
+ ipAddress: (0, import_mysql_core28.varchar)("ip_address", {
5430
+ length: 191
4799
5431
  }),
4800
- optOutAt: (0, import_mysql_core24.timestamp)("optOutAt", {
4801
- mode: "date",
4802
- fsp: 3
5432
+ city: (0, import_mysql_core28.varchar)("city", {
5433
+ length: 191
4803
5434
  }),
4804
- updatedAt: (0, import_mysql_core24.timestamp)("updatedAt", {
4805
- mode: "date",
4806
- fsp: 3
4807
- }).defaultNow(),
4808
- deletedAt: (0, import_mysql_core24.timestamp)("deletedAt", {
4809
- mode: "date",
4810
- fsp: 3
4811
- })
4812
- }, (cp) => ({
4813
- userIdIdx: (0, import_mysql_core24.index)("userId_idx").on(cp.userId),
4814
- preferenceTypeIdx: (0, import_mysql_core24.index)("preferenceTypeId_idx").on(cp.preferenceTypeId),
4815
- channelIdIdx: (0, import_mysql_core24.index)("channelId_idx").on(cp.channelId)
4816
- }));
4817
- return {
4818
- communicationPreferences
4819
- };
4820
- }, "getCommunicationPreferencesSchema");
4821
-
4822
- // src/lib/mysql/schemas/content/content-contributions.ts
4823
- var import_mysql_core25 = require("drizzle-orm/mysql-core");
4824
- var getContentContributionsSchema = /* @__PURE__ */ __name((mysqlTable) => {
4825
- const contentContributions = mysqlTable("contentContribution", {
4826
- id: (0, import_mysql_core25.varchar)("id", {
4827
- length: 255
4828
- }).notNull().primaryKey(),
4829
- userId: (0, import_mysql_core25.varchar)("userId", {
4830
- length: 255
4831
- }).notNull(),
4832
- contentId: (0, import_mysql_core25.varchar)("contentId", {
4833
- length: 255
4834
- }).notNull(),
4835
- contributionTypeId: (0, import_mysql_core25.varchar)("contributionTypeId", {
4836
- length: 255
4837
- }).notNull(),
4838
- active: (0, import_mysql_core25.boolean)("active").notNull().default(true),
4839
- createdAt: (0, import_mysql_core25.timestamp)("createdAt", {
4840
- mode: "date",
4841
- fsp: 3
4842
- }).defaultNow(),
4843
- updatedAt: (0, import_mysql_core25.timestamp)("updatedAt", {
4844
- mode: "date",
4845
- fsp: 3
4846
- }).defaultNow(),
4847
- deletedAt: (0, import_mysql_core25.timestamp)("deletedAt", {
4848
- mode: "date",
4849
- fsp: 3
4850
- })
4851
- }, (cc) => ({
4852
- userIdIdx: (0, import_mysql_core25.index)("userId_idx").on(cc.userId),
4853
- contentIdIdx: (0, import_mysql_core25.index)("contentId_idx").on(cc.contentId),
4854
- contributionTypeIdIdx: (0, import_mysql_core25.index)("contributionTypeId_idx").on(cc.contributionTypeId)
4855
- }));
4856
- return {
4857
- contentContributions
4858
- };
4859
- }, "getContentContributionsSchema");
4860
-
4861
- // src/lib/mysql/schemas/content/content-resource.ts
4862
- var import_drizzle_orm12 = require("drizzle-orm");
4863
- var import_mysql_core26 = require("drizzle-orm/mysql-core");
4864
- var getContentResourceSchema = /* @__PURE__ */ __name((mysqlTable) => {
4865
- const contentResource = mysqlTable("contentResource", {
4866
- id: (0, import_mysql_core26.varchar)("id", {
4867
- length: 255
4868
- }).notNull().primaryKey(),
4869
- type: (0, import_mysql_core26.varchar)("type", {
4870
- length: 255
4871
- }).notNull(),
4872
- createdById: (0, import_mysql_core26.varchar)("createdById", {
4873
- length: 255
4874
- }).notNull(),
4875
- fields: (0, import_mysql_core26.json)("fields").$type().default({}),
4876
- createdAt: (0, import_mysql_core26.timestamp)("createdAt", {
4877
- mode: "date",
4878
- fsp: 3
4879
- }).default(import_drizzle_orm12.sql`CURRENT_TIMESTAMP(3)`),
4880
- updatedAt: (0, import_mysql_core26.timestamp)("updatedAt", {
4881
- mode: "date",
4882
- fsp: 3
4883
- }).default(import_drizzle_orm12.sql`CURRENT_TIMESTAMP(3)`),
4884
- deletedAt: (0, import_mysql_core26.timestamp)("deletedAt", {
4885
- mode: "date",
4886
- fsp: 3
4887
- })
4888
- }, (cm) => ({
4889
- typeIdx: (0, import_mysql_core26.index)("type_idx").on(cm.type),
4890
- createdByIdx: (0, import_mysql_core26.index)("createdById_idx").on(cm.createdById),
4891
- createdAtIdx: (0, import_mysql_core26.index)("createdAt_idx").on(cm.createdAt)
4892
- }));
4893
- return {
4894
- contentResource
4895
- };
4896
- }, "getContentResourceSchema");
4897
-
4898
- // src/lib/mysql/schemas/content/content-resource-resource.ts
4899
- var import_drizzle_orm13 = require("drizzle-orm");
4900
- var import_mysql_core27 = require("drizzle-orm/mysql-core");
4901
- var getContentResourceResourceSchema = /* @__PURE__ */ __name((mysqlTable) => {
4902
- const contentResourceResource = mysqlTable("contentResourceResource", {
4903
- resourceOfId: (0, import_mysql_core27.varchar)("resourceOfId", {
4904
- length: 255
4905
- }).notNull(),
4906
- resourceId: (0, import_mysql_core27.varchar)("resourceId", {
4907
- length: 255
4908
- }).notNull(),
4909
- position: (0, import_mysql_core27.double)("position").notNull().default(0),
4910
- metadata: (0, import_mysql_core27.json)("fields").$type().default({}),
4911
- createdAt: (0, import_mysql_core27.timestamp)("createdAt", {
4912
- mode: "date",
4913
- fsp: 3
4914
- }).default(import_drizzle_orm13.sql`CURRENT_TIMESTAMP(3)`),
4915
- updatedAt: (0, import_mysql_core27.timestamp)("updatedAt", {
4916
- mode: "date",
4917
- fsp: 3
4918
- }).default(import_drizzle_orm13.sql`CURRENT_TIMESTAMP(3)`),
4919
- deletedAt: (0, import_mysql_core27.timestamp)("deletedAt", {
4920
- mode: "date",
4921
- fsp: 3
4922
- })
4923
- }, (crr) => ({
4924
- pk: (0, import_mysql_core27.primaryKey)({
4925
- columns: [
4926
- crr.resourceOfId,
4927
- crr.resourceId
4928
- ]
5435
+ state: (0, import_mysql_core28.varchar)("state", {
5436
+ length: 191
4929
5437
  }),
4930
- contentResourceIdIdx: (0, import_mysql_core27.index)("contentResourceId_idx").on(crr.resourceOfId),
4931
- resourceIdIdx: (0, import_mysql_core27.index)("resourceId_idx").on(crr.resourceId)
4932
- }));
4933
- return {
4934
- contentResourceResource
4935
- };
4936
- }, "getContentResourceResourceSchema");
4937
-
4938
- // src/lib/mysql/schemas/content/contribution-types.ts
4939
- var import_mysql_core28 = require("drizzle-orm/mysql-core");
4940
- var getContributionTypesSchema = /* @__PURE__ */ __name((mysqlTable) => {
4941
- const contributionTypes = mysqlTable("contributionType", {
4942
- id: (0, import_mysql_core28.varchar)("id", {
4943
- length: 255
4944
- }).notNull().primaryKey(),
4945
- slug: (0, import_mysql_core28.varchar)("slug", {
4946
- length: 255
4947
- }).notNull().unique(),
4948
- name: (0, import_mysql_core28.varchar)("name", {
4949
- length: 255
5438
+ country: (0, import_mysql_core28.varchar)("country", {
5439
+ length: 191
5440
+ }),
5441
+ couponId: (0, import_mysql_core28.varchar)("couponId", {
5442
+ length: 191
5443
+ }),
5444
+ productId: (0, import_mysql_core28.varchar)("productId", {
5445
+ length: 191
4950
5446
  }).notNull(),
4951
- description: (0, import_mysql_core28.text)("description"),
4952
- active: (0, import_mysql_core28.boolean)("active").notNull().default(true),
4953
- createdAt: (0, import_mysql_core28.timestamp)("createdAt", {
4954
- mode: "date",
4955
- fsp: 3
4956
- }).defaultNow(),
4957
- updatedAt: (0, import_mysql_core28.timestamp)("updatedAt", {
4958
- mode: "date",
4959
- fsp: 3
4960
- }).defaultNow(),
4961
- deletedAt: (0, import_mysql_core28.timestamp)("deletedAt", {
4962
- mode: "date",
4963
- fsp: 3
4964
- })
4965
- }, (ct) => ({
4966
- nameIdx: (0, import_mysql_core28.index)("name_idx").on(ct.name),
4967
- slugIdx: (0, import_mysql_core28.index)("slug_idx").on(ct.slug)
4968
- }));
4969
- return {
4970
- contributionTypes
4971
- };
4972
- }, "getContributionTypesSchema");
5447
+ merchantChargeId: (0, import_mysql_core28.varchar)("merchantChargeId", {
5448
+ length: 191
5449
+ }),
5450
+ upgradedFromId: (0, import_mysql_core28.varchar)("upgradedFromId", {
5451
+ length: 191
5452
+ }),
5453
+ status: (0, import_mysql_core28.varchar)("status", {
5454
+ length: 191
5455
+ }).default("Valid").notNull(),
5456
+ bulkCouponId: (0, import_mysql_core28.varchar)("bulkCouponId", {
5457
+ length: 191
5458
+ }),
5459
+ merchantSessionId: (0, import_mysql_core28.varchar)("merchantSessionId", {
5460
+ length: 191
5461
+ }),
5462
+ redeemedBulkCouponId: (0, import_mysql_core28.varchar)("redeemedBulkCouponId", {
5463
+ length: 191
5464
+ }),
5465
+ metadata: (0, import_mysql_core28.json)("fields").$type().default({})
5466
+ }, (table) => {
5467
+ return {
5468
+ purchaseId: (0, import_mysql_core28.primaryKey)({
5469
+ columns: [
5470
+ table.id
5471
+ ],
5472
+ name: "Purchase_id"
5473
+ }),
5474
+ purchaseUpgradedFromIdKey: (0, import_mysql_core28.unique)("Purchase_upgradedFromId_key").on(table.upgradedFromId)
5475
+ };
5476
+ });
5477
+ }
5478
+ __name(getPurchaseSchema, "getPurchaseSchema");
4973
5479
 
4974
5480
  // src/lib/mysql/schemas/content/resource-progress.ts
4975
- var import_drizzle_orm14 = require("drizzle-orm");
5481
+ var import_drizzle_orm24 = require("drizzle-orm");
4976
5482
  var import_mysql_core29 = require("drizzle-orm/mysql-core");
4977
- var getResourceProgressSchema = /* @__PURE__ */ __name((mysqlTable) => {
4978
- const resourceProgress = mysqlTable("resourceProgresses", {
5483
+ function getResourceProgressSchema(mysqlTable) {
5484
+ return mysqlTable("resourceProgresses", {
4979
5485
  userId: (0, import_mysql_core29.varchar)("userId", {
4980
5486
  length: 191
4981
5487
  }).notNull(),
@@ -4994,7 +5500,7 @@ var getResourceProgressSchema = /* @__PURE__ */ __name((mysqlTable) => {
4994
5500
  createdAt: (0, import_mysql_core29.datetime)("createdAt", {
4995
5501
  mode: "string",
4996
5502
  fsp: 3
4997
- }).default(import_drizzle_orm14.sql`CURRENT_TIMESTAMP(3)`).notNull()
5503
+ }).default(import_drizzle_orm24.sql`CURRENT_TIMESTAMP(3)`).notNull()
4998
5504
  }, (crp) => {
4999
5505
  return {
5000
5506
  userIdLessonIdIdx: (0, import_mysql_core29.index)("crp_userId_contentResourceId_idx").on(crp.userId, crp.contentResourceId),
@@ -5008,34 +5514,60 @@ var getResourceProgressSchema = /* @__PURE__ */ __name((mysqlTable) => {
5008
5514
  userIdIdx: (0, import_mysql_core29.index)("resourceId_idx").on(crp.userId)
5009
5515
  };
5010
5516
  });
5011
- return {
5012
- resourceProgress
5013
- };
5014
- }, "getResourceProgressSchema");
5517
+ }
5518
+ __name(getResourceProgressSchema, "getResourceProgressSchema");
5015
5519
 
5016
5520
  // src/lib/mysql/index.ts
5017
- function createTables(mySqlTable) {
5521
+ function getCourseBuilderSchema(mysqlTable) {
5018
5522
  return {
5019
- users: getUsersSchema(mySqlTable).users,
5020
- accounts: getAccountsSchema(mySqlTable).accounts,
5021
- sessions: getSessionsSchema(mySqlTable).sessions,
5022
- verificationTokens: getVerificationTokensSchema(mySqlTable).verificationTokens,
5023
- contentResource: getContentResourceSchema(mySqlTable).contentResource,
5024
- contentResourceResource: getContentResourceResourceSchema(mySqlTable).contentResourceResource,
5025
- purchase: getPurchaseSchema(mySqlTable).purchase,
5026
- price: getPriceSchema(mySqlTable).price,
5027
- product: getProductSchema(mySqlTable).product,
5028
- purchaseUserTransfer: getPurchaseUserTransferSchema(mySqlTable).purchaseUserTransfer,
5029
- merchantSession: getMerchantSessionSchema(mySqlTable).merchantSession,
5030
- merchantProduct: getMerchantProductSchema(mySqlTable).merchantProduct,
5031
- merchantPrice: getMerchantPriceSchema(mySqlTable).merchantPrice,
5032
- merchantCustomer: getMerchantCustomerSchema(mySqlTable).merchantCustomer,
5033
- merchantCoupon: getMerchantCouponSchema(mySqlTable).merchantCoupon,
5034
- merchantCharge: getMerchantChargeSchema(mySqlTable).merchantCharge,
5035
- merchantAccount: getMerchantAccountSchema(mySqlTable).merchantAccount,
5036
- coupon: getCouponSchema(mySqlTable).coupon
5523
+ accounts: getAccountsSchema(mysqlTable),
5524
+ accountsRelations: getAccountsRelationsSchema(mysqlTable),
5525
+ permissions: getPermissionsSchema(mysqlTable),
5526
+ permissionsRelations: getPermissionsRelationsSchema(mysqlTable),
5527
+ rolePermissions: getRolePermissionsSchema(mysqlTable),
5528
+ rolePermissionsRelations: getRolePermissionsRelationsSchema(mysqlTable),
5529
+ roles: getRolesSchema(mysqlTable),
5530
+ rolesRelations: getRolesRelationsSchema(mysqlTable),
5531
+ sessions: getSessionsSchema(mysqlTable),
5532
+ sessionsRelations: getSessionRelationsSchema(mysqlTable),
5533
+ userPermissions: getUserPermissionsSchema(mysqlTable),
5534
+ userPermissionsRelations: getUserPermissionsRelationsSchema(mysqlTable),
5535
+ userRoles: getUserRolesSchema(mysqlTable),
5536
+ userRolesRelations: getUserRolesRelationsSchema(mysqlTable),
5537
+ users: getUsersSchema(mysqlTable),
5538
+ usersRelations: getUsersRelationsSchema(mysqlTable),
5539
+ verificationTokens: getVerificationTokensSchema(mysqlTable),
5540
+ coupon: getCouponSchema(mysqlTable),
5541
+ merchantAccount: getMerchantAccountSchema(mysqlTable),
5542
+ merchantCharge: getMerchantChargeSchema(mysqlTable),
5543
+ merchantCoupon: getMerchantCouponSchema(mysqlTable),
5544
+ merchantCustomer: getMerchantCustomerSchema(mysqlTable),
5545
+ merchantPrice: getMerchantPriceSchema(mysqlTable),
5546
+ merchantProduct: getMerchantProductSchema(mysqlTable),
5547
+ merchantSession: getMerchantSessionSchema(mysqlTable),
5548
+ price: getPriceSchema(mysqlTable),
5549
+ product: getProductSchema(mysqlTable),
5550
+ purchase: getPurchaseSchema(mysqlTable),
5551
+ purchaseUserTransfer: getPurchaseUserTransferSchema(mysqlTable),
5552
+ communicationChannel: getCommunicationChannelSchema(mysqlTable),
5553
+ communicationPreferenceTypes: getCommunicationPreferenceTypesSchema(mysqlTable),
5554
+ communicationPreferences: getCommunicationPreferencesSchema(mysqlTable),
5555
+ communicationPreferencesRelations: getCommunicationPreferencesRelationsSchema(mysqlTable),
5556
+ contentContributions: getContentContributionsSchema(mysqlTable),
5557
+ contentContributionRelations: getContentContributionRelationsSchema(mysqlTable),
5558
+ contentResource: getContentResourceSchema(mysqlTable),
5559
+ contentResourceRelations: getContentResourceRelationsSchema(mysqlTable),
5560
+ contentResourceResource: getContentResourceResourceSchema(mysqlTable),
5561
+ contentResourceResourceRelations: getContentResourceResourceRelationsSchema(mysqlTable),
5562
+ contributionTypes: getContributionTypesSchema(mysqlTable),
5563
+ contributionTypesRelations: getContributionTypesRelationsSchema(mysqlTable),
5564
+ resourceProgress: getResourceProgressSchema(mysqlTable)
5037
5565
  };
5038
5566
  }
5567
+ __name(getCourseBuilderSchema, "getCourseBuilderSchema");
5568
+ function createTables(mySqlTable) {
5569
+ return getCourseBuilderSchema(mySqlTable);
5570
+ }
5039
5571
  __name(createTables, "createTables");
5040
5572
  function mySqlDrizzleAdapter(client, tableFn = import_mysql_core30.mysqlTable) {
5041
5573
  const { users, accounts, sessions, verificationTokens, contentResource, contentResourceResource, purchase, purchaseUserTransfer, coupon, merchantCoupon, merchantCharge, merchantAccount, merchantPrice, merchantCustomer, merchantSession, merchantProduct, price, product } = createTables(tableFn);
@@ -5044,24 +5576,24 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core30.mysqlTable) {
5044
5576
  if (!options.id) {
5045
5577
  throw new Error("No content resource id.");
5046
5578
  }
5047
- const currentResource = await client.select().from(contentResource).where((0, import_drizzle_orm15.eq)(contentResource.id, options.id)).then((res) => res[0]);
5579
+ const currentResource = await client.select().from(contentResource).where((0, import_drizzle_orm25.eq)(contentResource.id, options.id)).then((res) => res[0]);
5048
5580
  await client.update(contentResource).set({
5049
5581
  fields: {
5050
5582
  ...currentResource.fields,
5051
5583
  ...options.fields
5052
5584
  }
5053
- }).where((0, import_drizzle_orm15.eq)(contentResource.id, options.id));
5054
- return await client.select().from(contentResource).where((0, import_drizzle_orm15.eq)(contentResource.id, options.id)).then((res) => res[0]);
5585
+ }).where((0, import_drizzle_orm25.eq)(contentResource.id, options.id));
5586
+ return await client.select().from(contentResource).where((0, import_drizzle_orm25.eq)(contentResource.id, options.id)).then((res) => res[0]);
5055
5587
  },
5056
5588
  async getVideoResource(id) {
5057
5589
  if (!id) {
5058
5590
  throw new Error("videoResourceId is required");
5059
5591
  }
5060
- const query = import_drizzle_orm15.sql`
5592
+ const query = import_drizzle_orm25.sql`
5061
5593
  SELECT
5062
- id as _id,
5063
- CAST(updatedAt AS DATETIME) as _updatedAt,
5064
- CAST(createdAt AS DATETIME) as _createdAt,
5594
+ id as id,
5595
+ CAST(updatedAt AS DATETIME) as updatedAt,
5596
+ CAST(createdAt AS DATETIME) as createdAt,
5065
5597
  JSON_EXTRACT (${contentResource.fields}, "$.state") AS state,
5066
5598
  JSON_EXTRACT (${contentResource.fields}, "$.duration") AS duration,
5067
5599
  JSON_EXTRACT (${contentResource.fields}, "$.muxPlaybackId") AS muxPlaybackId,
@@ -5088,10 +5620,10 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core30.mysqlTable) {
5088
5620
  ...data,
5089
5621
  id
5090
5622
  });
5091
- return await client.select().from(contentResource).where((0, import_drizzle_orm15.eq)(contentResource.id, id)).then((res) => res[0]);
5623
+ return await client.select().from(contentResource).where((0, import_drizzle_orm25.eq)(contentResource.id, id)).then((res) => res[0]);
5092
5624
  },
5093
5625
  async getContentResource(data) {
5094
- return await client.select().from(contentResource).where((0, import_drizzle_orm15.eq)(contentResource.id, data)).then((res) => res[0]) ?? null;
5626
+ return await client.select().from(contentResource).where((0, import_drizzle_orm25.eq)(contentResource.id, data)).then((res) => res[0]) ?? null;
5095
5627
  },
5096
5628
  async createUser(data) {
5097
5629
  const id = crypto.randomUUID();
@@ -5099,57 +5631,57 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core30.mysqlTable) {
5099
5631
  ...data,
5100
5632
  id
5101
5633
  });
5102
- return await client.select().from(users).where((0, import_drizzle_orm15.eq)(users.id, id)).then((res) => res[0]);
5634
+ return await client.select().from(users).where((0, import_drizzle_orm25.eq)(users.id, id)).then((res) => res[0]);
5103
5635
  },
5104
5636
  async getUser(data) {
5105
- return await client.select().from(users).where((0, import_drizzle_orm15.eq)(users.id, data)).then((res) => res[0]) ?? null;
5637
+ return await client.select().from(users).where((0, import_drizzle_orm25.eq)(users.id, data)).then((res) => res[0]) ?? null;
5106
5638
  },
5107
5639
  async getUserByEmail(data) {
5108
- return await client.select().from(users).where((0, import_drizzle_orm15.eq)(users.email, data)).then((res) => res[0]) ?? null;
5640
+ return await client.select().from(users).where((0, import_drizzle_orm25.eq)(users.email, data)).then((res) => res[0]) ?? null;
5109
5641
  },
5110
5642
  async createSession(data) {
5111
5643
  await client.insert(sessions).values(data);
5112
- return await client.select().from(sessions).where((0, import_drizzle_orm15.eq)(sessions.sessionToken, data.sessionToken)).then((res) => res[0]);
5644
+ return await client.select().from(sessions).where((0, import_drizzle_orm25.eq)(sessions.sessionToken, data.sessionToken)).then((res) => res[0]);
5113
5645
  },
5114
5646
  async getSessionAndUser(data) {
5115
5647
  return await client.select({
5116
5648
  session: sessions,
5117
5649
  user: users
5118
- }).from(sessions).where((0, import_drizzle_orm15.eq)(sessions.sessionToken, data)).innerJoin(users, (0, import_drizzle_orm15.eq)(users.id, sessions.userId)).then((res) => res[0]) ?? null;
5650
+ }).from(sessions).where((0, import_drizzle_orm25.eq)(sessions.sessionToken, data)).innerJoin(users, (0, import_drizzle_orm25.eq)(users.id, sessions.userId)).then((res) => res[0]) ?? null;
5119
5651
  },
5120
5652
  async updateUser(data) {
5121
5653
  if (!data.id) {
5122
5654
  throw new Error("No user id.");
5123
5655
  }
5124
- await client.update(users).set(data).where((0, import_drizzle_orm15.eq)(users.id, data.id));
5125
- return await client.select().from(users).where((0, import_drizzle_orm15.eq)(users.id, data.id)).then((res) => res[0]);
5656
+ await client.update(users).set(data).where((0, import_drizzle_orm25.eq)(users.id, data.id));
5657
+ return await client.select().from(users).where((0, import_drizzle_orm25.eq)(users.id, data.id)).then((res) => res[0]);
5126
5658
  },
5127
5659
  async updateSession(data) {
5128
- await client.update(sessions).set(data).where((0, import_drizzle_orm15.eq)(sessions.sessionToken, data.sessionToken));
5129
- return await client.select().from(sessions).where((0, import_drizzle_orm15.eq)(sessions.sessionToken, data.sessionToken)).then((res) => res[0]);
5660
+ await client.update(sessions).set(data).where((0, import_drizzle_orm25.eq)(sessions.sessionToken, data.sessionToken));
5661
+ return await client.select().from(sessions).where((0, import_drizzle_orm25.eq)(sessions.sessionToken, data.sessionToken)).then((res) => res[0]);
5130
5662
  },
5131
5663
  async linkAccount(rawAccount) {
5132
5664
  await client.insert(accounts).values(rawAccount);
5133
5665
  },
5134
5666
  async getUserByAccount(account) {
5135
- const dbAccount = await client.select().from(accounts).where((0, import_drizzle_orm15.and)((0, import_drizzle_orm15.eq)(accounts.providerAccountId, account.providerAccountId), (0, import_drizzle_orm15.eq)(accounts.provider, account.provider))).leftJoin(users, (0, import_drizzle_orm15.eq)(accounts.userId, users.id)).then((res) => res[0]) ?? null;
5667
+ const dbAccount = await client.select().from(accounts).where((0, import_drizzle_orm25.and)((0, import_drizzle_orm25.eq)(accounts.providerAccountId, account.providerAccountId), (0, import_drizzle_orm25.eq)(accounts.provider, account.provider))).leftJoin(users, (0, import_drizzle_orm25.eq)(accounts.userId, users.id)).then((res) => res[0]) ?? null;
5136
5668
  if (!dbAccount) {
5137
5669
  return null;
5138
5670
  }
5139
5671
  return dbAccount.user;
5140
5672
  },
5141
5673
  async deleteSession(sessionToken) {
5142
- const session = await client.select().from(sessions).where((0, import_drizzle_orm15.eq)(sessions.sessionToken, sessionToken)).then((res) => res[0]) ?? null;
5143
- await client.delete(sessions).where((0, import_drizzle_orm15.eq)(sessions.sessionToken, sessionToken));
5674
+ const session = await client.select().from(sessions).where((0, import_drizzle_orm25.eq)(sessions.sessionToken, sessionToken)).then((res) => res[0]) ?? null;
5675
+ await client.delete(sessions).where((0, import_drizzle_orm25.eq)(sessions.sessionToken, sessionToken));
5144
5676
  return session;
5145
5677
  },
5146
5678
  async createVerificationToken(token) {
5147
5679
  await client.insert(verificationTokens).values(token);
5148
- return await client.select().from(verificationTokens).where((0, import_drizzle_orm15.eq)(verificationTokens.identifier, token.identifier)).then((res) => res[0]);
5680
+ return await client.select().from(verificationTokens).where((0, import_drizzle_orm25.eq)(verificationTokens.identifier, token.identifier)).then((res) => res[0]);
5149
5681
  },
5150
5682
  async useVerificationToken(token) {
5151
5683
  try {
5152
- const deletedToken = await client.select().from(verificationTokens).where((0, import_drizzle_orm15.and)((0, import_drizzle_orm15.eq)(verificationTokens.identifier, token.identifier), (0, import_drizzle_orm15.eq)(verificationTokens.token, token.token))).then((res) => res[0]) ?? null;
5684
+ const deletedToken = await client.select().from(verificationTokens).where((0, import_drizzle_orm25.and)((0, import_drizzle_orm25.eq)(verificationTokens.identifier, token.identifier), (0, import_drizzle_orm25.eq)(verificationTokens.token, token.token))).then((res) => res[0]) ?? null;
5153
5685
  if (deletedToken?.createdAt) {
5154
5686
  const TIMEOUT_IN_SECONDS = 90;
5155
5687
  const expireMultipleClicks = (0, import_date_fns.addSeconds)(deletedToken.createdAt, TIMEOUT_IN_SECONDS);
@@ -5158,7 +5690,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core30.mysqlTable) {
5158
5690
  const { id: _, ...verificationToken } = token;
5159
5691
  return deletedToken;
5160
5692
  } else {
5161
- await client.delete(verificationTokens).where((0, import_drizzle_orm15.and)((0, import_drizzle_orm15.eq)(verificationTokens.identifier, token.identifier), (0, import_drizzle_orm15.eq)(verificationTokens.token, token.token)));
5693
+ await client.delete(verificationTokens).where((0, import_drizzle_orm25.and)((0, import_drizzle_orm25.eq)(verificationTokens.identifier, token.identifier), (0, import_drizzle_orm25.eq)(verificationTokens.token, token.token)));
5162
5694
  return deletedToken;
5163
5695
  }
5164
5696
  }
@@ -5168,12 +5700,14 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core30.mysqlTable) {
5168
5700
  }
5169
5701
  },
5170
5702
  async deleteUser(id) {
5171
- const user = await client.select().from(users).where((0, import_drizzle_orm15.eq)(users.id, id)).then((res) => res[0] ?? null);
5172
- await client.delete(users).where((0, import_drizzle_orm15.eq)(users.id, id));
5703
+ const user = await client.select().from(users).where((0, import_drizzle_orm25.eq)(users.id, id)).then((res) => res[0] ?? null);
5704
+ await client.delete(users).where((0, import_drizzle_orm25.eq)(users.id, id));
5705
+ await client.delete(sessions).where((0, import_drizzle_orm25.eq)(sessions.userId, id));
5706
+ await client.delete(accounts).where((0, import_drizzle_orm25.eq)(accounts.userId, id));
5173
5707
  return user;
5174
5708
  },
5175
5709
  async unlinkAccount(account) {
5176
- await client.delete(accounts).where((0, import_drizzle_orm15.and)((0, import_drizzle_orm15.eq)(accounts.providerAccountId, account.providerAccountId), (0, import_drizzle_orm15.eq)(accounts.provider, account.provider)));
5710
+ await client.delete(accounts).where((0, import_drizzle_orm25.and)((0, import_drizzle_orm25.eq)(accounts.providerAccountId, account.providerAccountId), (0, import_drizzle_orm25.eq)(accounts.provider, account.provider)));
5177
5711
  return void 0;
5178
5712
  }
5179
5713
  };
@@ -5182,35 +5716,7 @@ __name(mySqlDrizzleAdapter, "mySqlDrizzleAdapter");
5182
5716
  // Annotate the CommonJS export names for ESM import in node:
5183
5717
  0 && (module.exports = {
5184
5718
  createTables,
5185
- getAccountsSchema,
5186
- getCommunicationChannelSchema,
5187
- getCommunicationPreferenceTypesSchema,
5188
- getCommunicationPreferencesSchema,
5189
- getContentContributionsSchema,
5190
- getContentResourceResourceSchema,
5191
- getContentResourceSchema,
5192
- getContributionTypesSchema,
5193
- getCouponSchema,
5194
- getMerchantAccountSchema,
5195
- getMerchantChargeSchema,
5196
- getMerchantCouponSchema,
5197
- getMerchantCustomerSchema,
5198
- getMerchantPriceSchema,
5199
- getMerchantProductSchema,
5200
- getMerchantSessionSchema,
5201
- getPermissionsSchema,
5202
- getPriceSchema,
5203
- getProductSchema,
5204
- getPurchaseSchema,
5205
- getPurchaseUserTransferSchema,
5206
- getResourceProgressSchema,
5207
- getRolePermissionsSchema,
5208
- getRolesSchema,
5209
- getSessionsSchema,
5210
- getUserPermissionsSchema,
5211
- getUserRolesSchema,
5212
- getUsersSchema,
5213
- getVerificationTokensSchema,
5719
+ getCourseBuilderSchema,
5214
5720
  mySqlDrizzleAdapter
5215
5721
  });
5216
5722
  //# sourceMappingURL=index.cjs.map