@coursebuilder/adapter-drizzle 0.3.0 → 0.5.0
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.
- package/dist/{chunk-57CX5SOI.js → chunk-2UU2F4DM.js} +5 -4
- package/dist/{chunk-V23SCQL7.js → chunk-3NUCFLQJ.js} +2 -2
- package/dist/{chunk-Y7QZGEPT.js → chunk-4ZWS76VQ.js} +2 -2
- package/dist/{chunk-PPBEA4EM.js → chunk-6ON2O6UD.js} +2 -2
- package/dist/{chunk-QY4TPO7D.js → chunk-BM5UKWXI.js} +3 -3
- package/dist/{chunk-QMDE6HUA.js → chunk-CQNKTFXE.js} +3 -3
- package/dist/{chunk-4PJWD6YK.js → chunk-FRA4ZCRA.js} +462 -336
- package/dist/{chunk-J4LBG2TH.js → chunk-GINRTL6J.js} +2 -2
- package/dist/chunk-JZQ666KH.js +62 -0
- package/dist/{chunk-GLPDG7UE.js → chunk-KDEWFXEP.js} +2 -2
- package/dist/{chunk-MBB4GIJI.js → chunk-LERR6HQ3.js} +2 -2
- package/dist/{chunk-VDVCCU7D.js → chunk-LZHZDFNZ.js} +2 -2
- package/dist/{chunk-MCARHGE5.js → chunk-O6JECJRY.js} +4 -4
- package/dist/{chunk-BX5SO2JG.js → chunk-P4VXXTVA.js} +2 -2
- package/dist/{chunk-VXZRMVNY.js → chunk-QP6YMUQX.js} +2 -2
- package/dist/chunk-QTGVGIRO.js +54 -0
- package/dist/{chunk-ZD3R6UPJ.js → chunk-SRTIWWLG.js} +7 -7
- package/dist/{chunk-PIQXK2CY.js → chunk-TBM3AK3P.js} +3 -3
- package/dist/{chunk-FNYW3XKR.js → chunk-XIGJFVUM.js} +8 -8
- package/dist/{chunk-JKOYOL7A.js → chunk-YGRYHMCG.js} +2 -2
- package/dist/chunk-YVVXDJHI.js +56 -0
- package/dist/{chunk-J63FMGT7.js → chunk-Z245DYMP.js} +314 -190
- package/dist/index.js +22 -19
- package/dist/lib/mysql/index.cjs +1144 -774
- package/dist/lib/mysql/index.cjs.map +1 -1
- package/dist/lib/mysql/index.d.cts +2064 -1148
- package/dist/lib/mysql/index.d.ts +2064 -1148
- package/dist/lib/mysql/index.js +22 -19
- package/dist/lib/mysql/schemas/auth/accounts.cjs +85 -77
- package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/accounts.d.cts +17 -17
- package/dist/lib/mysql/schemas/auth/accounts.d.ts +17 -17
- package/dist/lib/mysql/schemas/auth/accounts.js +12 -12
- package/dist/lib/mysql/schemas/auth/device-access-token.cjs +214 -0
- package/dist/lib/mysql/schemas/auth/device-access-token.cjs.map +1 -0
- package/dist/lib/mysql/schemas/auth/device-access-token.d.cts +52 -0
- package/dist/lib/mysql/schemas/auth/device-access-token.d.ts +52 -0
- package/dist/lib/mysql/schemas/auth/device-access-token.js +22 -0
- package/dist/lib/mysql/schemas/auth/device-access-token.js.map +1 -0
- package/dist/lib/mysql/schemas/auth/device-verification.cjs +222 -0
- package/dist/lib/mysql/schemas/auth/device-verification.cjs.map +1 -0
- package/dist/lib/mysql/schemas/auth/device-verification.d.cts +88 -0
- package/dist/lib/mysql/schemas/auth/device-verification.d.ts +88 -0
- package/dist/lib/mysql/schemas/auth/device-verification.js +22 -0
- package/dist/lib/mysql/schemas/auth/device-verification.js.map +1 -0
- package/dist/lib/mysql/schemas/auth/permissions.cjs +1 -1
- package/dist/lib/mysql/schemas/auth/permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/permissions.d.cts +9 -9
- package/dist/lib/mysql/schemas/auth/permissions.d.ts +9 -9
- package/dist/lib/mysql/schemas/auth/permissions.js +1 -1
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs +74 -66
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/role-permissions.d.cts +10 -10
- package/dist/lib/mysql/schemas/auth/role-permissions.d.ts +10 -10
- package/dist/lib/mysql/schemas/auth/role-permissions.js +13 -13
- package/dist/lib/mysql/schemas/auth/roles.cjs +72 -64
- package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/roles.d.cts +10 -10
- package/dist/lib/mysql/schemas/auth/roles.d.ts +10 -10
- package/dist/lib/mysql/schemas/auth/roles.js +12 -12
- package/dist/lib/mysql/schemas/auth/sessions.cjs +75 -67
- package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/sessions.d.cts +6 -6
- package/dist/lib/mysql/schemas/auth/sessions.d.ts +6 -6
- package/dist/lib/mysql/schemas/auth/sessions.js +13 -13
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs +77 -69
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.d.cts +10 -10
- package/dist/lib/mysql/schemas/auth/user-permissions.d.ts +10 -10
- package/dist/lib/mysql/schemas/auth/user-permissions.js +12 -12
- package/dist/lib/mysql/schemas/auth/user-prefs.cjs +222 -0
- package/dist/lib/mysql/schemas/auth/user-prefs.cjs.map +1 -0
- package/dist/lib/mysql/schemas/auth/user-prefs.d.cts +100 -0
- package/dist/lib/mysql/schemas/auth/user-prefs.d.ts +100 -0
- package/dist/lib/mysql/schemas/auth/user-prefs.js +21 -0
- package/dist/lib/mysql/schemas/auth/user-prefs.js.map +1 -0
- package/dist/lib/mysql/schemas/auth/user-roles.cjs +77 -69
- package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-roles.d.cts +10 -10
- package/dist/lib/mysql/schemas/auth/user-roles.d.ts +10 -10
- package/dist/lib/mysql/schemas/auth/user-roles.js +12 -12
- package/dist/lib/mysql/schemas/auth/users.cjs +263 -180
- package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/users.d.cts +35 -21
- package/dist/lib/mysql/schemas/auth/users.d.ts +35 -21
- package/dist/lib/mysql/schemas/auth/users.js +12 -12
- package/dist/lib/mysql/schemas/auth/verification-tokens.cjs +1 -1
- package/dist/lib/mysql/schemas/auth/verification-tokens.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/verification-tokens.d.cts +5 -5
- package/dist/lib/mysql/schemas/auth/verification-tokens.d.ts +5 -5
- package/dist/lib/mysql/schemas/auth/verification-tokens.js +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.cjs +75 -65
- package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.d.cts +19 -19
- package/dist/lib/mysql/schemas/commerce/coupon.d.ts +19 -19
- package/dist/lib/mysql/schemas/commerce/coupon.js +12 -12
- package/dist/lib/mysql/schemas/commerce/merchant-account.cjs +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-account.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-account.d.cts +6 -6
- package/dist/lib/mysql/schemas/commerce/merchant-account.d.ts +6 -6
- package/dist/lib/mysql/schemas/commerce/merchant-account.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs +6 -5
- package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-charge.d.cts +13 -13
- package/dist/lib/mysql/schemas/commerce/merchant-charge.d.ts +13 -13
- package/dist/lib/mysql/schemas/commerce/merchant-charge.js +4 -4
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.cts +7 -7
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.ts +7 -7
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs +3 -2
- package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-customer.d.cts +7 -7
- package/dist/lib/mysql/schemas/commerce/merchant-customer.d.ts +7 -7
- package/dist/lib/mysql/schemas/commerce/merchant-customer.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-price.cjs +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-price.d.cts +8 -8
- package/dist/lib/mysql/schemas/commerce/merchant-price.d.ts +8 -8
- package/dist/lib/mysql/schemas/commerce/merchant-price.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-product.cjs +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-product.d.cts +7 -7
- package/dist/lib/mysql/schemas/commerce/merchant-product.d.ts +7 -7
- package/dist/lib/mysql/schemas/commerce/merchant-product.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-session.cjs +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-session.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-session.d.cts +4 -4
- package/dist/lib/mysql/schemas/commerce/merchant-session.d.ts +4 -4
- package/dist/lib/mysql/schemas/commerce/merchant-session.js +1 -1
- package/dist/lib/mysql/schemas/commerce/price.cjs +60 -52
- package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/price.d.cts +11 -11
- package/dist/lib/mysql/schemas/commerce/price.d.ts +11 -11
- package/dist/lib/mysql/schemas/commerce/price.js +12 -12
- package/dist/lib/mysql/schemas/commerce/product.cjs +75 -67
- package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/product.d.cts +13 -13
- package/dist/lib/mysql/schemas/commerce/product.d.ts +13 -13
- package/dist/lib/mysql/schemas/commerce/product.js +12 -12
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +105 -96
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.cts +15 -15
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.ts +15 -15
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +13 -13
- package/dist/lib/mysql/schemas/commerce/purchase.cjs +138 -128
- package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase.d.cts +25 -25
- package/dist/lib/mysql/schemas/commerce/purchase.d.ts +25 -25
- package/dist/lib/mysql/schemas/commerce/purchase.js +12 -12
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs +66 -58
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/upgradable-products.d.cts +11 -11
- package/dist/lib/mysql/schemas/commerce/upgradable-products.d.ts +11 -11
- package/dist/lib/mysql/schemas/commerce/upgradable-products.js +13 -13
- package/dist/lib/mysql/schemas/communication/comment.cjs +220 -0
- package/dist/lib/mysql/schemas/communication/comment.cjs.map +1 -0
- package/dist/lib/mysql/schemas/communication/comment.d.cts +100 -0
- package/dist/lib/mysql/schemas/communication/comment.d.ts +100 -0
- package/dist/lib/mysql/schemas/communication/comment.js +21 -0
- package/dist/lib/mysql/schemas/communication/comment.js.map +1 -0
- package/dist/lib/mysql/schemas/communication/communication-channel.cjs +1 -1
- package/dist/lib/mysql/schemas/communication/communication-channel.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-channel.d.cts +8 -8
- package/dist/lib/mysql/schemas/communication/communication-channel.d.ts +8 -8
- package/dist/lib/mysql/schemas/communication/communication-channel.js +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preference-types.d.cts +8 -8
- package/dist/lib/mysql/schemas/communication/communication-preference-types.d.ts +8 -8
- package/dist/lib/mysql/schemas/communication/communication-preference-types.js +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +99 -91
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.d.cts +16 -16
- package/dist/lib/mysql/schemas/communication/communication-preferences.d.ts +16 -16
- package/dist/lib/mysql/schemas/communication/communication-preferences.js +12 -12
- package/dist/lib/mysql/schemas/content/content-contributions.cjs +67 -59
- package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-contributions.d.cts +13 -13
- package/dist/lib/mysql/schemas/content/content-contributions.d.ts +13 -13
- package/dist/lib/mysql/schemas/content/content-contributions.js +12 -12
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs +61 -53
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-product.d.cts +11 -11
- package/dist/lib/mysql/schemas/content/content-resource-product.d.ts +11 -11
- package/dist/lib/mysql/schemas/content/content-resource-product.js +12 -12
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +58 -50
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.d.cts +11 -11
- package/dist/lib/mysql/schemas/content/content-resource-resource.d.ts +11 -11
- package/dist/lib/mysql/schemas/content/content-resource-resource.js +12 -12
- package/dist/lib/mysql/schemas/content/content-resource.cjs +114 -66
- package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource.d.cts +14 -13
- package/dist/lib/mysql/schemas/content/content-resource.d.ts +14 -13
- package/dist/lib/mysql/schemas/content/content-resource.js +12 -12
- package/dist/lib/mysql/schemas/content/contribution-types.cjs +1 -1
- package/dist/lib/mysql/schemas/content/contribution-types.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/contribution-types.d.cts +10 -10
- package/dist/lib/mysql/schemas/content/contribution-types.d.ts +10 -10
- package/dist/lib/mysql/schemas/content/contribution-types.js +1 -1
- package/dist/lib/mysql/schemas/content/lesson-progress.cjs +77 -0
- package/dist/lib/mysql/schemas/content/lesson-progress.cjs.map +1 -0
- package/dist/lib/mysql/schemas/content/lesson-progress.d.cts +132 -0
- package/dist/lib/mysql/schemas/content/lesson-progress.d.ts +132 -0
- package/dist/lib/mysql/schemas/content/lesson-progress.js +8 -0
- package/dist/lib/mysql/schemas/content/lesson-progress.js.map +1 -0
- package/dist/lib/mysql/schemas/content/resource-progress.cjs +7 -7
- package/dist/lib/mysql/schemas/content/resource-progress.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/resource-progress.d.cts +9 -9
- package/dist/lib/mysql/schemas/content/resource-progress.d.ts +9 -9
- package/dist/lib/mysql/schemas/content/resource-progress.js +1 -1
- package/package.json +5 -5
- package/src/lib/mysql/index.ts +186 -54
- package/src/lib/mysql/schemas/auth/accounts.ts +1 -1
- package/src/lib/mysql/schemas/auth/device-access-token.ts +40 -0
- package/src/lib/mysql/schemas/auth/device-verification.ts +48 -0
- package/src/lib/mysql/schemas/auth/permissions.ts +1 -1
- package/src/lib/mysql/schemas/auth/role-permissions.ts +1 -1
- package/src/lib/mysql/schemas/auth/roles.ts +1 -1
- package/src/lib/mysql/schemas/auth/sessions.ts +1 -1
- package/src/lib/mysql/schemas/auth/user-permissions.ts +1 -1
- package/src/lib/mysql/schemas/auth/user-prefs.ts +52 -0
- package/src/lib/mysql/schemas/auth/user-roles.ts +1 -1
- package/src/lib/mysql/schemas/auth/users.ts +14 -2
- package/src/lib/mysql/schemas/auth/verification-tokens.ts +1 -1
- package/src/lib/mysql/schemas/commerce/coupon.ts +6 -4
- package/src/lib/mysql/schemas/commerce/merchant-account.ts +1 -1
- package/src/lib/mysql/schemas/commerce/merchant-charge.ts +1 -1
- package/src/lib/mysql/schemas/commerce/merchant-coupon.ts +1 -1
- package/src/lib/mysql/schemas/commerce/merchant-customer.ts +3 -1
- package/src/lib/mysql/schemas/commerce/merchant-price.ts +1 -1
- package/src/lib/mysql/schemas/commerce/merchant-product.ts +1 -1
- package/src/lib/mysql/schemas/commerce/merchant-session.ts +1 -1
- package/src/lib/mysql/schemas/commerce/price.ts +1 -1
- package/src/lib/mysql/schemas/commerce/product.ts +1 -1
- package/src/lib/mysql/schemas/commerce/purchase-user-transfer.ts +1 -1
- package/src/lib/mysql/schemas/commerce/purchase.ts +5 -4
- package/src/lib/mysql/schemas/commerce/upgradable-products.ts +1 -1
- package/src/lib/mysql/schemas/communication/comment.ts +52 -0
- package/src/lib/mysql/schemas/communication/communication-channel.ts +1 -1
- package/src/lib/mysql/schemas/communication/communication-preference-types.ts +1 -1
- package/src/lib/mysql/schemas/communication/communication-preferences.ts +1 -1
- package/src/lib/mysql/schemas/content/content-contributions.ts +1 -1
- package/src/lib/mysql/schemas/content/content-resource-product.ts +1 -1
- package/src/lib/mysql/schemas/content/content-resource-resource.ts +1 -1
- package/src/lib/mysql/schemas/content/content-resource.ts +6 -2
- package/src/lib/mysql/schemas/content/contribution-types.ts +1 -1
- package/src/lib/mysql/schemas/content/lesson-progress.ts +39 -0
- package/src/lib/mysql/schemas/content/resource-progress.ts +6 -8
|
@@ -1,28 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getLessonProgressSchema
|
|
3
|
+
} from "./chunk-YVVXDJHI.js";
|
|
1
4
|
import {
|
|
2
5
|
getResourceProgressSchema
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XIGJFVUM.js";
|
|
7
|
+
import {
|
|
8
|
+
getPurchaseUserTransferRelationsSchema,
|
|
9
|
+
getPurchaseUserTransferSchema
|
|
10
|
+
} from "./chunk-CQNKTFXE.js";
|
|
4
11
|
import {
|
|
5
12
|
getUpgradableProductsRelationsSchema,
|
|
6
13
|
getUpgradableProductsSchema
|
|
7
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-BM5UKWXI.js";
|
|
8
15
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./chunk-
|
|
16
|
+
getRolePermissionsRelationsSchema,
|
|
17
|
+
getRolePermissionsSchema
|
|
18
|
+
} from "./chunk-O6JECJRY.js";
|
|
12
19
|
import {
|
|
13
20
|
getSessionRelationsSchema,
|
|
14
21
|
getSessionsSchema
|
|
15
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-TBM3AK3P.js";
|
|
16
23
|
import {
|
|
17
24
|
getVerificationTokensSchema
|
|
18
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-LERR6HQ3.js";
|
|
19
26
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} from "./chunk-
|
|
27
|
+
getDeviceAccessTokenRelationsSchema,
|
|
28
|
+
getDeviceAccessTokenSchema
|
|
29
|
+
} from "./chunk-QTGVGIRO.js";
|
|
30
|
+
import {
|
|
31
|
+
getDeviceVerificationRelationsSchema,
|
|
32
|
+
getDeviceVerificationSchema
|
|
33
|
+
} from "./chunk-JZQ666KH.js";
|
|
23
34
|
import {
|
|
24
35
|
getAccountsRelationsSchema,
|
|
25
36
|
getAccountsSchema,
|
|
37
|
+
getCommentRelationsSchema,
|
|
38
|
+
getCommentsSchema,
|
|
26
39
|
getCommunicationPreferencesRelationsSchema,
|
|
27
40
|
getCommunicationPreferencesSchema,
|
|
28
41
|
getContentContributionRelationsSchema,
|
|
@@ -44,47 +57,49 @@ import {
|
|
|
44
57
|
getRolesSchema,
|
|
45
58
|
getUserPermissionsRelationsSchema,
|
|
46
59
|
getUserPermissionsSchema,
|
|
60
|
+
getUserPrefsRelationsSchema,
|
|
61
|
+
getUserPrefsSchema,
|
|
47
62
|
getUserRolesRelationsSchema,
|
|
48
63
|
getUserRolesSchema,
|
|
49
64
|
getUsersRelationsSchema,
|
|
50
65
|
getUsersSchema
|
|
51
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-FRA4ZCRA.js";
|
|
52
67
|
import {
|
|
53
68
|
getContributionTypesRelationsSchema,
|
|
54
69
|
getContributionTypesSchema
|
|
55
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-KDEWFXEP.js";
|
|
56
71
|
import {
|
|
57
72
|
getCommunicationChannelSchema
|
|
58
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-GINRTL6J.js";
|
|
59
74
|
import {
|
|
60
75
|
getCommunicationPreferenceTypesSchema
|
|
61
|
-
} from "./chunk-
|
|
62
|
-
import {
|
|
63
|
-
getMerchantCouponSchema
|
|
64
|
-
} from "./chunk-JKOYOL7A.js";
|
|
65
|
-
import {
|
|
66
|
-
getMerchantPriceSchema
|
|
67
|
-
} from "./chunk-PPBEA4EM.js";
|
|
68
|
-
import {
|
|
69
|
-
getMerchantSessionSchema
|
|
70
|
-
} from "./chunk-V23SCQL7.js";
|
|
76
|
+
} from "./chunk-P4VXXTVA.js";
|
|
71
77
|
import {
|
|
72
78
|
getMerchantChargeRelationsSchema,
|
|
73
79
|
getMerchantChargeSchema
|
|
74
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-SRTIWWLG.js";
|
|
81
|
+
import {
|
|
82
|
+
getMerchantAccountSchema
|
|
83
|
+
} from "./chunk-QP6YMUQX.js";
|
|
84
|
+
import {
|
|
85
|
+
getMerchantCouponSchema
|
|
86
|
+
} from "./chunk-YGRYHMCG.js";
|
|
75
87
|
import {
|
|
76
88
|
getMerchantCustomerSchema
|
|
77
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-2UU2F4DM.js";
|
|
90
|
+
import {
|
|
91
|
+
getMerchantPriceSchema
|
|
92
|
+
} from "./chunk-6ON2O6UD.js";
|
|
78
93
|
import {
|
|
79
94
|
getMerchantProductSchema
|
|
80
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-4ZWS76VQ.js";
|
|
81
96
|
import {
|
|
82
|
-
|
|
83
|
-
} from "./chunk-
|
|
97
|
+
getMerchantSessionSchema
|
|
98
|
+
} from "./chunk-3NUCFLQJ.js";
|
|
84
99
|
import {
|
|
85
100
|
getPermissionsRelationsSchema,
|
|
86
101
|
getPermissionsSchema
|
|
87
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-LZHZDFNZ.js";
|
|
88
103
|
import {
|
|
89
104
|
__name
|
|
90
105
|
} from "./chunk-H736K5TN.js";
|
|
@@ -8108,26 +8123,38 @@ var z2 = /* @__PURE__ */ Object.freeze({
|
|
|
8108
8123
|
ZodError: ZodError2
|
|
8109
8124
|
});
|
|
8110
8125
|
|
|
8111
|
-
// ../core/dist/chunk-
|
|
8112
|
-
var
|
|
8126
|
+
// ../core/dist/chunk-CHYUPSYW.js
|
|
8127
|
+
var userSchema = z2.object({
|
|
8128
|
+
id: z2.string().max(255),
|
|
8129
|
+
name: z2.string().max(255).optional().nullable(),
|
|
8130
|
+
role: z2.enum([
|
|
8131
|
+
"user",
|
|
8132
|
+
"admin"
|
|
8133
|
+
]).default("user"),
|
|
8134
|
+
email: z2.string().max(255).email(),
|
|
8135
|
+
emailVerified: z2.coerce.date().nullable(),
|
|
8136
|
+
image: z2.string().max(255).optional().nullable(),
|
|
8137
|
+
createdAt: z2.coerce.date().nullable(),
|
|
8138
|
+
roles: z2.array(z2.object({
|
|
8139
|
+
id: z2.string(),
|
|
8140
|
+
name: z2.string(),
|
|
8141
|
+
description: z2.string().nullable(),
|
|
8142
|
+
active: z2.boolean()
|
|
8143
|
+
})).optional().default([])
|
|
8144
|
+
});
|
|
8145
|
+
|
|
8146
|
+
// ../core/dist/chunk-47RWEDJ6.js
|
|
8147
|
+
var priceSchema = z2.object({
|
|
8113
8148
|
id: z2.string().max(191),
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
"
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
"COMPLETED"
|
|
8122
|
-
]).default("AVAILABLE"),
|
|
8123
|
-
purchaseId: z2.string().max(191),
|
|
8124
|
-
sourceUserId: z2.string().max(191),
|
|
8125
|
-
targetUserId: z2.string().max(191).optional().nullable(),
|
|
8149
|
+
productId: z2.string().max(191).optional().nullable(),
|
|
8150
|
+
nickname: z2.string().max(191).optional().nullable(),
|
|
8151
|
+
status: z2.number().int().default(0),
|
|
8152
|
+
unitAmount: z2.coerce.number().refine((value) => {
|
|
8153
|
+
const decimalPlaces = value.toString().split(".")[1]?.length || 0;
|
|
8154
|
+
return decimalPlaces <= 2;
|
|
8155
|
+
}),
|
|
8126
8156
|
createdAt: z2.date().nullable(),
|
|
8127
|
-
|
|
8128
|
-
canceledAt: z2.date().nullable(),
|
|
8129
|
-
confirmedAt: z2.date().nullable(),
|
|
8130
|
-
completedAt: z2.date().nullable()
|
|
8157
|
+
fields: z2.record(z2.any()).default({})
|
|
8131
8158
|
});
|
|
8132
8159
|
|
|
8133
8160
|
// ../core/dist/chunk-YYIPQN6H.js
|
|
@@ -8174,111 +8201,6 @@ var ResourceVisibilitySchema = z2.union([
|
|
|
8174
8201
|
z2.literal("unlisted")
|
|
8175
8202
|
]);
|
|
8176
8203
|
|
|
8177
|
-
// ../core/dist/chunk-GCYJ74DO.js
|
|
8178
|
-
var resourceProgressSchema = z2.object({
|
|
8179
|
-
userId: z2.string().max(191),
|
|
8180
|
-
contentResourceId: z2.string().max(191).optional().nullable(),
|
|
8181
|
-
fields: z2.record(z2.any()).default({}),
|
|
8182
|
-
completedAt: z2.date().nullable(),
|
|
8183
|
-
updatedAt: z2.date().nullable(),
|
|
8184
|
-
createdAt: z2.date().nullable()
|
|
8185
|
-
});
|
|
8186
|
-
var moduleProgressSchema = z2.object({
|
|
8187
|
-
completedLessons: z2.array(resourceProgressSchema),
|
|
8188
|
-
nextResource: ContentResourceSchema.nullable(),
|
|
8189
|
-
percentCompleted: z2.number().default(0),
|
|
8190
|
-
completedLessonsCount: z2.number().default(0),
|
|
8191
|
-
totalLessonsCount: z2.number().default(0)
|
|
8192
|
-
});
|
|
8193
|
-
|
|
8194
|
-
// ../core/dist/chunk-DLQA3JMA.js
|
|
8195
|
-
var upgradableProductSchema = z2.object({
|
|
8196
|
-
upgradableToId: z2.string().max(255),
|
|
8197
|
-
upgradableFromId: z2.string().max(255),
|
|
8198
|
-
position: z2.number().default(0),
|
|
8199
|
-
metadata: z2.record(z2.any()).default({}),
|
|
8200
|
-
createdAt: z2.date().nullable(),
|
|
8201
|
-
updatedAt: z2.date().nullable(),
|
|
8202
|
-
deletedAt: z2.date().nullable()
|
|
8203
|
-
});
|
|
8204
|
-
|
|
8205
|
-
// ../core/dist/chunk-G22WGQ3G.js
|
|
8206
|
-
var VideoResourceSchema = z2.object({
|
|
8207
|
-
id: z2.string(),
|
|
8208
|
-
updatedAt: z2.string().optional(),
|
|
8209
|
-
createdAt: z2.string().optional(),
|
|
8210
|
-
title: z2.string().optional().nullable(),
|
|
8211
|
-
duration: z2.number().optional().nullable(),
|
|
8212
|
-
muxPlaybackId: z2.string().optional().nullable(),
|
|
8213
|
-
muxAssetId: z2.string().optional().nullable(),
|
|
8214
|
-
transcript: z2.string().optional().nullable(),
|
|
8215
|
-
transcriptWithScreenshots: z2.string().optional().nullable(),
|
|
8216
|
-
srt: z2.string().optional().nullable(),
|
|
8217
|
-
wordLevelSrt: z2.string().optional().nullable(),
|
|
8218
|
-
state: z2.enum([
|
|
8219
|
-
"new",
|
|
8220
|
-
"processing",
|
|
8221
|
-
"preparing",
|
|
8222
|
-
"ready",
|
|
8223
|
-
"errored"
|
|
8224
|
-
])
|
|
8225
|
-
});
|
|
8226
|
-
|
|
8227
|
-
// ../core/dist/chunk-PS6USEN7.js
|
|
8228
|
-
var merchantPriceSchema = z2.object({
|
|
8229
|
-
id: z2.string().max(191),
|
|
8230
|
-
merchantAccountId: z2.string().max(191),
|
|
8231
|
-
merchantProductId: z2.string().max(191),
|
|
8232
|
-
status: z2.number().int().default(0),
|
|
8233
|
-
identifier: z2.string().max(191).optional().nullable(),
|
|
8234
|
-
createdAt: z2.date(),
|
|
8235
|
-
priceId: z2.string().max(191).optional().nullable()
|
|
8236
|
-
});
|
|
8237
|
-
|
|
8238
|
-
// ../core/dist/chunk-DAG4HKGL.js
|
|
8239
|
-
var merchantProductSchema = z2.object({
|
|
8240
|
-
id: z2.string().max(191),
|
|
8241
|
-
merchantAccountId: z2.string().max(191),
|
|
8242
|
-
productId: z2.string().max(191),
|
|
8243
|
-
status: z2.number().int().default(0),
|
|
8244
|
-
identifier: z2.string().max(191).optional().nullable(),
|
|
8245
|
-
createdAt: z2.date().nullable()
|
|
8246
|
-
});
|
|
8247
|
-
|
|
8248
|
-
// ../core/dist/chunk-CHYUPSYW.js
|
|
8249
|
-
var userSchema = z2.object({
|
|
8250
|
-
id: z2.string().max(255),
|
|
8251
|
-
name: z2.string().max(255).optional().nullable(),
|
|
8252
|
-
role: z2.enum([
|
|
8253
|
-
"user",
|
|
8254
|
-
"admin"
|
|
8255
|
-
]).default("user"),
|
|
8256
|
-
email: z2.string().max(255).email(),
|
|
8257
|
-
emailVerified: z2.coerce.date().nullable(),
|
|
8258
|
-
image: z2.string().max(255).optional().nullable(),
|
|
8259
|
-
createdAt: z2.coerce.date().nullable(),
|
|
8260
|
-
roles: z2.array(z2.object({
|
|
8261
|
-
id: z2.string(),
|
|
8262
|
-
name: z2.string(),
|
|
8263
|
-
description: z2.string().nullable(),
|
|
8264
|
-
active: z2.boolean()
|
|
8265
|
-
})).optional().default([])
|
|
8266
|
-
});
|
|
8267
|
-
|
|
8268
|
-
// ../core/dist/chunk-47RWEDJ6.js
|
|
8269
|
-
var priceSchema = z2.object({
|
|
8270
|
-
id: z2.string().max(191),
|
|
8271
|
-
productId: z2.string().max(191).optional().nullable(),
|
|
8272
|
-
nickname: z2.string().max(191).optional().nullable(),
|
|
8273
|
-
status: z2.number().int().default(0),
|
|
8274
|
-
unitAmount: z2.coerce.number().refine((value) => {
|
|
8275
|
-
const decimalPlaces = value.toString().split(".")[1]?.length || 0;
|
|
8276
|
-
return decimalPlaces <= 2;
|
|
8277
|
-
}),
|
|
8278
|
-
createdAt: z2.date().nullable(),
|
|
8279
|
-
fields: z2.record(z2.any()).default({})
|
|
8280
|
-
});
|
|
8281
|
-
|
|
8282
8204
|
// ../core/dist/chunk-DGMGNBW7.js
|
|
8283
8205
|
var productSchema = z2.object({
|
|
8284
8206
|
id: z2.string().max(191),
|
|
@@ -8366,16 +8288,77 @@ var purchaseSchema = z2.object({
|
|
|
8366
8288
|
product: productSchema.optional().nullable()
|
|
8367
8289
|
});
|
|
8368
8290
|
|
|
8369
|
-
// ../core/dist/chunk-
|
|
8370
|
-
var
|
|
8291
|
+
// ../core/dist/chunk-LMH5A7OR.js
|
|
8292
|
+
var purchaseUserTransferSchema = z2.object({
|
|
8371
8293
|
id: z2.string().max(191),
|
|
8372
|
-
|
|
8373
|
-
|
|
8294
|
+
transferState: z2.enum([
|
|
8295
|
+
"AVAILABLE",
|
|
8296
|
+
"INITIATED",
|
|
8297
|
+
"VERIFIED",
|
|
8298
|
+
"CANCELED",
|
|
8299
|
+
"EXPIRED",
|
|
8300
|
+
"CONFIRMED",
|
|
8301
|
+
"COMPLETED"
|
|
8302
|
+
]).default("AVAILABLE"),
|
|
8303
|
+
purchaseId: z2.string().max(191),
|
|
8304
|
+
sourceUserId: z2.string().max(191),
|
|
8305
|
+
targetUserId: z2.string().max(191).optional().nullable(),
|
|
8306
|
+
createdAt: z2.date().nullable(),
|
|
8307
|
+
expiresAt: z2.date().nullable(),
|
|
8308
|
+
canceledAt: z2.date().nullable(),
|
|
8309
|
+
confirmedAt: z2.date().nullable(),
|
|
8310
|
+
completedAt: z2.date().nullable()
|
|
8311
|
+
});
|
|
8312
|
+
|
|
8313
|
+
// ../core/dist/chunk-K6G2HAJT.js
|
|
8314
|
+
var resourceProgressSchema = z2.object({
|
|
8374
8315
|
userId: z2.string().max(191),
|
|
8375
|
-
|
|
8376
|
-
|
|
8316
|
+
resourceId: z2.string().max(191).optional().nullable(),
|
|
8317
|
+
fields: z2.record(z2.any()).default({}),
|
|
8318
|
+
completedAt: z2.date().nullable(),
|
|
8319
|
+
updatedAt: z2.date().nullable(),
|
|
8320
|
+
createdAt: z2.date().nullable()
|
|
8321
|
+
});
|
|
8322
|
+
var moduleProgressSchema = z2.object({
|
|
8323
|
+
completedLessons: z2.array(resourceProgressSchema),
|
|
8324
|
+
nextResource: ContentResourceSchema.nullable(),
|
|
8325
|
+
percentCompleted: z2.number().default(0),
|
|
8326
|
+
completedLessonsCount: z2.number().default(0),
|
|
8327
|
+
totalLessonsCount: z2.number().default(0)
|
|
8328
|
+
});
|
|
8329
|
+
|
|
8330
|
+
// ../core/dist/chunk-DLQA3JMA.js
|
|
8331
|
+
var upgradableProductSchema = z2.object({
|
|
8332
|
+
upgradableToId: z2.string().max(255),
|
|
8333
|
+
upgradableFromId: z2.string().max(255),
|
|
8334
|
+
position: z2.number().default(0),
|
|
8335
|
+
metadata: z2.record(z2.any()).default({}),
|
|
8377
8336
|
createdAt: z2.date().nullable(),
|
|
8378
|
-
|
|
8337
|
+
updatedAt: z2.date().nullable(),
|
|
8338
|
+
deletedAt: z2.date().nullable()
|
|
8339
|
+
});
|
|
8340
|
+
|
|
8341
|
+
// ../core/dist/chunk-5QZXOTEH.js
|
|
8342
|
+
var VideoResourceSchema = z2.object({
|
|
8343
|
+
id: z2.string(),
|
|
8344
|
+
updatedAt: z2.string().optional(),
|
|
8345
|
+
createdAt: z2.string().optional(),
|
|
8346
|
+
title: z2.string().optional().nullable(),
|
|
8347
|
+
duration: z2.number().optional().nullable(),
|
|
8348
|
+
muxPlaybackId: z2.string().optional().nullable(),
|
|
8349
|
+
muxAssetId: z2.string().optional().nullable(),
|
|
8350
|
+
transcript: z2.string().optional().nullable(),
|
|
8351
|
+
transcriptWithScreenshots: z2.string().optional().nullable(),
|
|
8352
|
+
srt: z2.string().optional().nullable(),
|
|
8353
|
+
wordLevelSrt: z2.string().optional().nullable(),
|
|
8354
|
+
state: z2.enum([
|
|
8355
|
+
"new",
|
|
8356
|
+
"processing",
|
|
8357
|
+
"preparing",
|
|
8358
|
+
"ready",
|
|
8359
|
+
"errored",
|
|
8360
|
+
"deleted"
|
|
8361
|
+
])
|
|
8379
8362
|
});
|
|
8380
8363
|
|
|
8381
8364
|
// ../core/dist/chunk-EDDT2FFU.js
|
|
@@ -8388,6 +8371,39 @@ var merchantCustomerSchema = z2.object({
|
|
|
8388
8371
|
status: z2.number().int().default(0)
|
|
8389
8372
|
});
|
|
8390
8373
|
|
|
8374
|
+
// ../core/dist/chunk-PS6USEN7.js
|
|
8375
|
+
var merchantPriceSchema = z2.object({
|
|
8376
|
+
id: z2.string().max(191),
|
|
8377
|
+
merchantAccountId: z2.string().max(191),
|
|
8378
|
+
merchantProductId: z2.string().max(191),
|
|
8379
|
+
status: z2.number().int().default(0),
|
|
8380
|
+
identifier: z2.string().max(191).optional().nullable(),
|
|
8381
|
+
createdAt: z2.date(),
|
|
8382
|
+
priceId: z2.string().max(191).optional().nullable()
|
|
8383
|
+
});
|
|
8384
|
+
|
|
8385
|
+
// ../core/dist/chunk-DAG4HKGL.js
|
|
8386
|
+
var merchantProductSchema = z2.object({
|
|
8387
|
+
id: z2.string().max(191),
|
|
8388
|
+
merchantAccountId: z2.string().max(191),
|
|
8389
|
+
productId: z2.string().max(191),
|
|
8390
|
+
status: z2.number().int().default(0),
|
|
8391
|
+
identifier: z2.string().max(191).optional().nullable(),
|
|
8392
|
+
createdAt: z2.date().nullable()
|
|
8393
|
+
});
|
|
8394
|
+
|
|
8395
|
+
// ../core/dist/chunk-SGE7BCRS.js
|
|
8396
|
+
var merchantChargeSchema = z2.object({
|
|
8397
|
+
id: z2.string().max(191),
|
|
8398
|
+
status: z2.number().int().default(0),
|
|
8399
|
+
identifier: z2.string().max(191),
|
|
8400
|
+
userId: z2.string().max(191),
|
|
8401
|
+
merchantAccountId: z2.string().max(191),
|
|
8402
|
+
merchantProductId: z2.string().max(191),
|
|
8403
|
+
createdAt: z2.date().nullable(),
|
|
8404
|
+
merchantCustomerId: z2.string().max(191)
|
|
8405
|
+
});
|
|
8406
|
+
|
|
8391
8407
|
// ../core/dist/chunk-256SROW3.js
|
|
8392
8408
|
var merchantCouponSchema = z2.object({
|
|
8393
8409
|
id: z2.string().max(191),
|
|
@@ -8561,6 +8577,7 @@ function getCourseBuilderSchema(mysqlTable) {
|
|
|
8561
8577
|
verificationTokens: getVerificationTokensSchema(mysqlTable),
|
|
8562
8578
|
coupon: getCouponSchema(mysqlTable),
|
|
8563
8579
|
couponRelations: getCouponRelationsSchema(mysqlTable),
|
|
8580
|
+
lessonProgress: getLessonProgressSchema(mysqlTable),
|
|
8564
8581
|
merchantAccount: getMerchantAccountSchema(mysqlTable),
|
|
8565
8582
|
merchantCharge: getMerchantChargeSchema(mysqlTable),
|
|
8566
8583
|
merchantChargeRelations: getMerchantChargeRelationsSchema(mysqlTable),
|
|
@@ -8592,7 +8609,15 @@ function getCourseBuilderSchema(mysqlTable) {
|
|
|
8592
8609
|
upgradableProductsRelations: getUpgradableProductsRelationsSchema(mysqlTable),
|
|
8593
8610
|
contentResourceProduct: getContentResourceProductSchema(mysqlTable),
|
|
8594
8611
|
contentResourceProductRelations: getContentResourceProductRelationsSchema(mysqlTable),
|
|
8595
|
-
productRelations: getProductRelationsSchema(mysqlTable)
|
|
8612
|
+
productRelations: getProductRelationsSchema(mysqlTable),
|
|
8613
|
+
comments: getCommentsSchema(mysqlTable),
|
|
8614
|
+
commentsRelations: getCommentRelationsSchema(mysqlTable),
|
|
8615
|
+
deviceVerifications: getDeviceVerificationSchema(mysqlTable),
|
|
8616
|
+
deviceVerificationRelations: getDeviceVerificationRelationsSchema(mysqlTable),
|
|
8617
|
+
deviceAccessToken: getDeviceAccessTokenSchema(mysqlTable),
|
|
8618
|
+
deviceAccessTokenRelations: getDeviceAccessTokenRelationsSchema(mysqlTable),
|
|
8619
|
+
userPrefs: getUserPrefsSchema(mysqlTable),
|
|
8620
|
+
userPrefsRelations: getUserPrefsRelationsSchema(mysqlTable)
|
|
8596
8621
|
};
|
|
8597
8622
|
}
|
|
8598
8623
|
__name(getCourseBuilderSchema, "getCourseBuilderSchema");
|
|
@@ -8601,7 +8626,7 @@ function createTables(mySqlTable) {
|
|
|
8601
8626
|
}
|
|
8602
8627
|
__name(createTables, "createTables");
|
|
8603
8628
|
function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
8604
|
-
const { users, accounts, sessions, verificationTokens, contentResource, contentResourceResource, purchases: purchaseTable, purchaseUserTransfer, coupon, merchantCoupon, merchantCharge, merchantAccount, merchantPrice, merchantCustomer, merchantSession, merchantProduct, prices, products, upgradableProducts, resourceProgress } = createTables(tableFn);
|
|
8629
|
+
const { users, accounts, sessions, verificationTokens, contentResource, contentResourceResource, purchases: purchaseTable, purchaseUserTransfer, coupon, merchantCoupon, merchantCharge, merchantAccount, merchantPrice, merchantCustomer, merchantSession, merchantProduct, prices, products, upgradableProducts, resourceProgress, comments } = createTables(tableFn);
|
|
8605
8630
|
const adapter = {
|
|
8606
8631
|
client,
|
|
8607
8632
|
async redeemFullPriceCoupon(options) {
|
|
@@ -8738,7 +8763,7 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
8738
8763
|
throw new Error("No lessonId provided");
|
|
8739
8764
|
}
|
|
8740
8765
|
let lessonProgress = await client.query.resourceProgress.findFirst({
|
|
8741
|
-
where: and(eq(resourceProgress.userId, options.userId), eq(resourceProgress.
|
|
8766
|
+
where: and(eq(resourceProgress.userId, options.userId), eq(resourceProgress.resourceId, options.lessonId))
|
|
8742
8767
|
});
|
|
8743
8768
|
const now = /* @__PURE__ */ new Date();
|
|
8744
8769
|
if (lessonProgress) {
|
|
@@ -8746,18 +8771,18 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
8746
8771
|
await client.update(resourceProgress).set({
|
|
8747
8772
|
completedAt: now,
|
|
8748
8773
|
updatedAt: now
|
|
8749
|
-
}).where(eq(resourceProgress.
|
|
8774
|
+
}).where(eq(resourceProgress.resourceId, options.lessonId));
|
|
8750
8775
|
}
|
|
8751
8776
|
} else {
|
|
8752
8777
|
await client.insert(resourceProgress).values({
|
|
8753
8778
|
userId: options.userId,
|
|
8754
|
-
|
|
8779
|
+
resourceId: options.lessonId,
|
|
8755
8780
|
completedAt: now,
|
|
8756
8781
|
updatedAt: now
|
|
8757
8782
|
});
|
|
8758
8783
|
}
|
|
8759
8784
|
lessonProgress = await client.query.resourceProgress.findFirst({
|
|
8760
|
-
where: and(eq(resourceProgress.userId, options.userId), eq(resourceProgress.
|
|
8785
|
+
where: and(eq(resourceProgress.userId, options.userId), eq(resourceProgress.resourceId, options.lessonId))
|
|
8761
8786
|
});
|
|
8762
8787
|
const parsedLessonProgress = resourceProgressSchema.safeParse(lessonProgress);
|
|
8763
8788
|
if (!parsedLessonProgress.success) {
|
|
@@ -8777,9 +8802,14 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
8777
8802
|
});
|
|
8778
8803
|
if (!couponForIdOrCode)
|
|
8779
8804
|
return null;
|
|
8780
|
-
|
|
8805
|
+
const parsedCoupon = couponSchema.extend({
|
|
8781
8806
|
merchantCoupon: merchantCouponSchema
|
|
8782
|
-
}).
|
|
8807
|
+
}).safeParse(couponForIdOrCode);
|
|
8808
|
+
if (!parsedCoupon.success) {
|
|
8809
|
+
console.error("Error parsing coupon", JSON.stringify(parsedCoupon.error));
|
|
8810
|
+
return null;
|
|
8811
|
+
}
|
|
8812
|
+
return parsedCoupon.data;
|
|
8783
8813
|
},
|
|
8784
8814
|
async createMerchantChargeAndPurchase(options) {
|
|
8785
8815
|
const purchaseId = await client.transaction(async (trx) => {
|
|
@@ -8816,7 +8846,7 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
8816
8846
|
]))
|
|
8817
8847
|
}) || null);
|
|
8818
8848
|
const existingBulkCoupon = couponSchema.nullable().parse(await client.select().from(coupon).leftJoin(purchaseTable, and(eq(coupon.id, purchaseTable.bulkCouponId), eq(purchaseTable.userId, userId))).where(and(eq(coupon.restrictedToProductId, productId), eq(purchaseTable.userId, userId))).then((res) => {
|
|
8819
|
-
return res[0]?.
|
|
8849
|
+
return res[0]?.Coupon ?? null;
|
|
8820
8850
|
}));
|
|
8821
8851
|
const isBulkPurchase = quantity > 1 || Boolean(existingBulkCoupon) || options.bulk || Boolean(existingPurchase?.status === "Valid");
|
|
8822
8852
|
let bulkCouponId = null;
|
|
@@ -8928,7 +8958,13 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
8928
8958
|
};
|
|
8929
8959
|
},
|
|
8930
8960
|
async getCoupon(couponIdOrCode) {
|
|
8931
|
-
|
|
8961
|
+
const loadedCoupon = await client.query.coupon.findFirst({
|
|
8962
|
+
where: or(eq(coupon.id, couponIdOrCode), eq(coupon.code, couponIdOrCode))
|
|
8963
|
+
}) || null;
|
|
8964
|
+
logger.debug("loadedCoupon", {
|
|
8965
|
+
loadedCoupon
|
|
8966
|
+
});
|
|
8967
|
+
return couponSchema.nullable().parse(loadedCoupon);
|
|
8932
8968
|
},
|
|
8933
8969
|
async getCouponWithBulkPurchases(couponId) {
|
|
8934
8970
|
logger.debug("getCouponWithBulkPurchases", {
|
|
@@ -9001,22 +9037,67 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
9001
9037
|
return parsed.data;
|
|
9002
9038
|
},
|
|
9003
9039
|
async getModuleProgressForUser(userIdOrEmail, moduleIdOrSlug) {
|
|
9040
|
+
const ALLOWED_MODULE_RESOURCE_TYPES = [
|
|
9041
|
+
"lesson",
|
|
9042
|
+
"exercise",
|
|
9043
|
+
"solution"
|
|
9044
|
+
];
|
|
9045
|
+
const COUNTABLE_MODULE_RESOURCE_TYPES = [
|
|
9046
|
+
"lesson",
|
|
9047
|
+
"exercise"
|
|
9048
|
+
];
|
|
9004
9049
|
const module = await client.query.contentResource.findFirst({
|
|
9005
9050
|
where: or(eq(contentResource.id, moduleIdOrSlug), eq(sql`JSON_EXTRACT (${contentResource.fields}, "$.slug")`, moduleIdOrSlug)),
|
|
9006
9051
|
with: {
|
|
9007
9052
|
resources: {
|
|
9053
|
+
with: {
|
|
9054
|
+
resource: {
|
|
9055
|
+
with: {
|
|
9056
|
+
resources: {
|
|
9057
|
+
with: {
|
|
9058
|
+
resource: {
|
|
9059
|
+
with: {
|
|
9060
|
+
resources: {
|
|
9061
|
+
with: {
|
|
9062
|
+
resource: true
|
|
9063
|
+
}
|
|
9064
|
+
}
|
|
9065
|
+
}
|
|
9066
|
+
}
|
|
9067
|
+
},
|
|
9068
|
+
orderBy: asc(contentResourceResource.position)
|
|
9069
|
+
}
|
|
9070
|
+
}
|
|
9071
|
+
}
|
|
9072
|
+
},
|
|
9008
9073
|
orderBy: asc(contentResourceResource.position)
|
|
9009
9074
|
}
|
|
9010
9075
|
}
|
|
9011
9076
|
});
|
|
9012
9077
|
const parsedModule = ContentResourceSchema.parse(module);
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9078
|
+
function flattenResources(resources) {
|
|
9079
|
+
const result = [];
|
|
9080
|
+
function recurse(resources2) {
|
|
9081
|
+
for (const nestedResource of resources2) {
|
|
9082
|
+
const resource = nestedResource.resource;
|
|
9083
|
+
result.push(resource);
|
|
9084
|
+
if (resource.resources) {
|
|
9085
|
+
recurse(resource.resources);
|
|
9086
|
+
}
|
|
9087
|
+
}
|
|
9088
|
+
}
|
|
9089
|
+
__name(recurse, "recurse");
|
|
9090
|
+
recurse(resources);
|
|
9091
|
+
return result;
|
|
9092
|
+
}
|
|
9093
|
+
__name(flattenResources, "flattenResources");
|
|
9094
|
+
const allResources = parsedModule?.resources && flattenResources(parsedModule.resources);
|
|
9095
|
+
const filteredResources = allResources?.filter((resource) => {
|
|
9096
|
+
return ALLOWED_MODULE_RESOURCE_TYPES.includes(resource.type);
|
|
9016
9097
|
});
|
|
9017
|
-
const
|
|
9018
|
-
if (!
|
|
9019
|
-
console.error("Error parsing module resources",
|
|
9098
|
+
const parsedResources = z.array(ContentResourceSchema).safeParse(filteredResources);
|
|
9099
|
+
if (!parsedResources.success) {
|
|
9100
|
+
console.error("Error parsing module resources", parsedResources.error);
|
|
9020
9101
|
return {
|
|
9021
9102
|
completedLessons: [],
|
|
9022
9103
|
nextResource: null,
|
|
@@ -9025,10 +9106,25 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
9025
9106
|
totalLessonsCount: 0
|
|
9026
9107
|
};
|
|
9027
9108
|
}
|
|
9109
|
+
const progressResources = parsedResources.data.filter((r) => {
|
|
9110
|
+
return COUNTABLE_MODULE_RESOURCE_TYPES.includes(r.type);
|
|
9111
|
+
});
|
|
9112
|
+
const totalLessonsCount = progressResources.length;
|
|
9028
9113
|
const user = await client.query.users.findFirst({
|
|
9029
9114
|
where: or(eq(users.id, userIdOrEmail), eq(users.email, userIdOrEmail)),
|
|
9030
9115
|
with: {
|
|
9031
|
-
roles:
|
|
9116
|
+
roles: {
|
|
9117
|
+
with: {
|
|
9118
|
+
role: true
|
|
9119
|
+
}
|
|
9120
|
+
}
|
|
9121
|
+
}
|
|
9122
|
+
}).then(async (res) => {
|
|
9123
|
+
if (res) {
|
|
9124
|
+
return {
|
|
9125
|
+
...res,
|
|
9126
|
+
roles: res.roles.map((r) => r.role)
|
|
9127
|
+
};
|
|
9032
9128
|
}
|
|
9033
9129
|
});
|
|
9034
9130
|
if (!user) {
|
|
@@ -9038,15 +9134,27 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
9038
9134
|
nextResource: null,
|
|
9039
9135
|
percentCompleted: 0,
|
|
9040
9136
|
completedLessonsCount: 0,
|
|
9041
|
-
totalLessonsCount
|
|
9137
|
+
totalLessonsCount
|
|
9138
|
+
};
|
|
9139
|
+
}
|
|
9140
|
+
const parsedUser = userSchema.safeParse(user);
|
|
9141
|
+
if (!parsedUser.success) {
|
|
9142
|
+
console.error("Error parsing user", parsedUser.error);
|
|
9143
|
+
return {
|
|
9144
|
+
completedLessons: [],
|
|
9145
|
+
nextResource: null,
|
|
9146
|
+
percentCompleted: 0,
|
|
9147
|
+
completedLessonsCount: 0,
|
|
9148
|
+
totalLessonsCount
|
|
9042
9149
|
};
|
|
9043
9150
|
}
|
|
9044
|
-
const parsedUser = userSchema.parse(user);
|
|
9045
9151
|
const userProgress = await client.query.resourceProgress.findMany({
|
|
9046
|
-
where: and(eq(resourceProgress.userId, parsedUser.id), isNotNull(resourceProgress.completedAt), inArray(resourceProgress.
|
|
9152
|
+
where: and(eq(resourceProgress.userId, parsedUser.data.id), isNotNull(resourceProgress.completedAt), inArray(resourceProgress.resourceId, progressResources.map((r) => r.id))),
|
|
9047
9153
|
orderBy: asc(resourceProgress.completedAt)
|
|
9048
9154
|
});
|
|
9049
|
-
const nextResourceId =
|
|
9155
|
+
const nextResourceId = parsedResources.data.filter((r) => {
|
|
9156
|
+
return COUNTABLE_MODULE_RESOURCE_TYPES.includes(r.type);
|
|
9157
|
+
}).find((r) => !userProgress.find((p) => p.resourceId === r.id))?.id;
|
|
9050
9158
|
const nextResource = await client.query.contentResource.findFirst({
|
|
9051
9159
|
where: eq(contentResource.id, nextResourceId)
|
|
9052
9160
|
});
|
|
@@ -9059,16 +9167,16 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
9059
9167
|
nextResource: null,
|
|
9060
9168
|
percentCompleted: 0,
|
|
9061
9169
|
completedLessonsCount: 0,
|
|
9062
|
-
totalLessonsCount
|
|
9170
|
+
totalLessonsCount
|
|
9063
9171
|
};
|
|
9064
9172
|
}
|
|
9065
|
-
const percentCompleted = Math.round(parsedProgress.data.length /
|
|
9173
|
+
const percentCompleted = Math.round(parsedProgress.data.length / parsedResources.data.length * 100);
|
|
9066
9174
|
return {
|
|
9067
9175
|
completedLessons: parsedProgress.data,
|
|
9068
9176
|
nextResource: parsedNextResource,
|
|
9069
9177
|
percentCompleted,
|
|
9070
9178
|
completedLessonsCount: parsedProgress.data.length,
|
|
9071
|
-
totalLessonsCount
|
|
9179
|
+
totalLessonsCount
|
|
9072
9180
|
};
|
|
9073
9181
|
},
|
|
9074
9182
|
getLessonProgresses() {
|
|
@@ -9128,6 +9236,14 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
9128
9236
|
where: eq(products.id, productId)
|
|
9129
9237
|
}));
|
|
9130
9238
|
},
|
|
9239
|
+
async getPurchaseCountForProduct(productId) {
|
|
9240
|
+
return await client.query.purchases.findMany({
|
|
9241
|
+
where: and(eq(purchaseTable.productId, productId), inArray(purchaseTable.status, [
|
|
9242
|
+
"Valid",
|
|
9243
|
+
"Restricted"
|
|
9244
|
+
]))
|
|
9245
|
+
}).then((res) => res.length);
|
|
9246
|
+
},
|
|
9131
9247
|
async getPurchase(purchaseId) {
|
|
9132
9248
|
const purchase = await client.query.purchases.findFirst({
|
|
9133
9249
|
where: eq(purchaseTable.id, purchaseId)
|
|
@@ -9333,24 +9449,24 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
9333
9449
|
throw new Error("No lessonId provided");
|
|
9334
9450
|
}
|
|
9335
9451
|
let lessonProgress = await client.query.resourceProgress.findFirst({
|
|
9336
|
-
where: and(eq(resourceProgress.userId, options.userId), eq(resourceProgress.
|
|
9452
|
+
where: and(eq(resourceProgress.userId, options.userId), eq(resourceProgress.resourceId, options.lessonId))
|
|
9337
9453
|
});
|
|
9338
9454
|
const now = /* @__PURE__ */ new Date();
|
|
9339
9455
|
if (lessonProgress) {
|
|
9340
9456
|
await client.update(resourceProgress).set({
|
|
9341
9457
|
completedAt: lessonProgress.completedAt ? null : now,
|
|
9342
9458
|
updatedAt: now
|
|
9343
|
-
}).where(eq(resourceProgress.
|
|
9459
|
+
}).where(eq(resourceProgress.resourceId, options.lessonId));
|
|
9344
9460
|
} else {
|
|
9345
9461
|
await client.insert(resourceProgress).values({
|
|
9346
9462
|
userId: options.userId,
|
|
9347
|
-
|
|
9463
|
+
resourceId: options.lessonId,
|
|
9348
9464
|
completedAt: now,
|
|
9349
9465
|
updatedAt: now
|
|
9350
9466
|
});
|
|
9351
9467
|
}
|
|
9352
9468
|
lessonProgress = await client.query.resourceProgress.findFirst({
|
|
9353
|
-
where: and(eq(resourceProgress.userId, options.userId), eq(resourceProgress.
|
|
9469
|
+
where: and(eq(resourceProgress.userId, options.userId), eq(resourceProgress.resourceId, options.lessonId))
|
|
9354
9470
|
});
|
|
9355
9471
|
const parsedLessonProgress = resourceProgressSchema.safeParse(lessonProgress);
|
|
9356
9472
|
if (!parsedLessonProgress.success) {
|
|
@@ -9510,7 +9626,15 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
9510
9626
|
with: {
|
|
9511
9627
|
resources: {
|
|
9512
9628
|
with: {
|
|
9513
|
-
resource:
|
|
9629
|
+
resource: {
|
|
9630
|
+
with: {
|
|
9631
|
+
resources: {
|
|
9632
|
+
with: {
|
|
9633
|
+
resource: true
|
|
9634
|
+
}
|
|
9635
|
+
}
|
|
9636
|
+
}
|
|
9637
|
+
}
|
|
9514
9638
|
},
|
|
9515
9639
|
orderBy: asc(contentResourceResource.position)
|
|
9516
9640
|
}
|
|
@@ -9576,7 +9700,7 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
9576
9700
|
if (!dbAccount) {
|
|
9577
9701
|
return null;
|
|
9578
9702
|
}
|
|
9579
|
-
return dbAccount.
|
|
9703
|
+
return dbAccount.User;
|
|
9580
9704
|
},
|
|
9581
9705
|
async deleteSession(sessionToken) {
|
|
9582
9706
|
const session = await client.select().from(sessions).where(eq(sessions.sessionToken, sessionToken)).then((res) => res[0]) ?? null;
|
|
@@ -9628,4 +9752,4 @@ export {
|
|
|
9628
9752
|
createTables,
|
|
9629
9753
|
mySqlDrizzleAdapter
|
|
9630
9754
|
};
|
|
9631
|
-
//# sourceMappingURL=chunk-
|
|
9755
|
+
//# sourceMappingURL=chunk-Z245DYMP.js.map
|