@coursebuilder/adapter-drizzle 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3889,6 +3889,16 @@ var z2 = /* @__PURE__ */ Object.freeze({
|
|
|
3889
3889
|
ZodError
|
|
3890
3890
|
});
|
|
3891
3891
|
|
|
3892
|
+
// ../core/dist/chunk-NH6Z6YIN.js
|
|
3893
|
+
var resourceProgressSchema = z.object({
|
|
3894
|
+
userId: z.string().max(191),
|
|
3895
|
+
contentResourceId: z.string().max(191).optional().nullable(),
|
|
3896
|
+
metadata: z.record(z.any()).default({}),
|
|
3897
|
+
completedAt: z.date().nullable(),
|
|
3898
|
+
updatedAt: z.date().nullable(),
|
|
3899
|
+
createdAt: z.date().nullable()
|
|
3900
|
+
});
|
|
3901
|
+
|
|
3892
3902
|
// ../core/dist/chunk-N2FP5B4I.js
|
|
3893
3903
|
var upgradableProductSchema = z.object({
|
|
3894
3904
|
upgradableToId: z.string().length(255),
|
|
@@ -3922,6 +3932,19 @@ var VideoResourceSchema = z.object({
|
|
|
3922
3932
|
])
|
|
3923
3933
|
});
|
|
3924
3934
|
|
|
3935
|
+
// ../core/dist/chunk-NTKCZFHE.js
|
|
3936
|
+
var merchantCouponSchema = z.object({
|
|
3937
|
+
id: z.string().max(191),
|
|
3938
|
+
identifier: z.string().max(191).optional().nullable(),
|
|
3939
|
+
status: z.number().int().default(0),
|
|
3940
|
+
merchantAccountId: z.string().max(191),
|
|
3941
|
+
percentageDiscount: z.coerce.number().refine((value) => {
|
|
3942
|
+
const decimalPlaces = value.toString().split(".")[1]?.length || 0;
|
|
3943
|
+
return decimalPlaces <= 2;
|
|
3944
|
+
}),
|
|
3945
|
+
type: z.string().max(191).optional().nullable()
|
|
3946
|
+
});
|
|
3947
|
+
|
|
3925
3948
|
// ../core/dist/chunk-BRSSFQ7G.js
|
|
3926
3949
|
var merchantCustomerSchema = z.object({
|
|
3927
3950
|
id: z.string().max(191),
|
|
@@ -4050,16 +4073,6 @@ var purchaseUserTransferSchema = z.object({
|
|
|
4050
4073
|
completedAt: z.date().nullable()
|
|
4051
4074
|
});
|
|
4052
4075
|
|
|
4053
|
-
// ../core/dist/chunk-NH6Z6YIN.js
|
|
4054
|
-
var resourceProgressSchema = z.object({
|
|
4055
|
-
userId: z.string().max(191),
|
|
4056
|
-
contentResourceId: z.string().max(191).optional().nullable(),
|
|
4057
|
-
metadata: z.record(z.any()).default({}),
|
|
4058
|
-
completedAt: z.date().nullable(),
|
|
4059
|
-
updatedAt: z.date().nullable(),
|
|
4060
|
-
createdAt: z.date().nullable()
|
|
4061
|
-
});
|
|
4062
|
-
|
|
4063
4076
|
// ../core/dist/chunk-AYRXRIAF.js
|
|
4064
4077
|
var merchantChargeSchema = z.object({
|
|
4065
4078
|
id: z.string().length(191),
|
|
@@ -4072,19 +4085,6 @@ var merchantChargeSchema = z.object({
|
|
|
4072
4085
|
merchantCustomerId: z.string().length(191)
|
|
4073
4086
|
});
|
|
4074
4087
|
|
|
4075
|
-
// ../core/dist/chunk-NTKCZFHE.js
|
|
4076
|
-
var merchantCouponSchema = z.object({
|
|
4077
|
-
id: z.string().max(191),
|
|
4078
|
-
identifier: z.string().max(191).optional().nullable(),
|
|
4079
|
-
status: z.number().int().default(0),
|
|
4080
|
-
merchantAccountId: z.string().max(191),
|
|
4081
|
-
percentageDiscount: z.coerce.number().refine((value) => {
|
|
4082
|
-
const decimalPlaces = value.toString().split(".")[1]?.length || 0;
|
|
4083
|
-
return decimalPlaces <= 2;
|
|
4084
|
-
}),
|
|
4085
|
-
type: z.string().max(191).optional().nullable()
|
|
4086
|
-
});
|
|
4087
|
-
|
|
4088
4088
|
// src/lib/mysql/index.ts
|
|
4089
4089
|
function getCourseBuilderSchema(mysqlTable) {
|
|
4090
4090
|
return {
|
|
@@ -4550,7 +4550,7 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
4550
4550
|
},
|
|
4551
4551
|
async getContentResource(data) {
|
|
4552
4552
|
const resource = await client.query.contentResource.findFirst({
|
|
4553
|
-
where: eq(contentResource.id, data),
|
|
4553
|
+
where: or(eq(contentResource.id, data), eq(sql`JSON_EXTRACT (${contentResource.fields}, "$.slug")`, `${data}`)),
|
|
4554
4554
|
with: {
|
|
4555
4555
|
resources: {
|
|
4556
4556
|
with: {
|
|
@@ -4676,4 +4676,4 @@ export {
|
|
|
4676
4676
|
createTables,
|
|
4677
4677
|
mySqlDrizzleAdapter
|
|
4678
4678
|
};
|
|
4679
|
-
//# sourceMappingURL=chunk-
|
|
4679
|
+
//# sourceMappingURL=chunk-MCFL2YV4.js.map
|
package/dist/index.js
CHANGED
package/dist/lib/mysql/index.cjs
CHANGED
|
@@ -7914,6 +7914,16 @@ var z2 = /* @__PURE__ */ Object.freeze({
|
|
|
7914
7914
|
ZodError: ZodError2
|
|
7915
7915
|
});
|
|
7916
7916
|
|
|
7917
|
+
// ../core/dist/chunk-NH6Z6YIN.js
|
|
7918
|
+
var resourceProgressSchema = z2.object({
|
|
7919
|
+
userId: z2.string().max(191),
|
|
7920
|
+
contentResourceId: z2.string().max(191).optional().nullable(),
|
|
7921
|
+
metadata: z2.record(z2.any()).default({}),
|
|
7922
|
+
completedAt: z2.date().nullable(),
|
|
7923
|
+
updatedAt: z2.date().nullable(),
|
|
7924
|
+
createdAt: z2.date().nullable()
|
|
7925
|
+
});
|
|
7926
|
+
|
|
7917
7927
|
// ../core/dist/chunk-N2FP5B4I.js
|
|
7918
7928
|
var upgradableProductSchema = z2.object({
|
|
7919
7929
|
upgradableToId: z2.string().length(255),
|
|
@@ -7947,6 +7957,19 @@ var VideoResourceSchema = z2.object({
|
|
|
7947
7957
|
])
|
|
7948
7958
|
});
|
|
7949
7959
|
|
|
7960
|
+
// ../core/dist/chunk-NTKCZFHE.js
|
|
7961
|
+
var merchantCouponSchema = z2.object({
|
|
7962
|
+
id: z2.string().max(191),
|
|
7963
|
+
identifier: z2.string().max(191).optional().nullable(),
|
|
7964
|
+
status: z2.number().int().default(0),
|
|
7965
|
+
merchantAccountId: z2.string().max(191),
|
|
7966
|
+
percentageDiscount: z2.coerce.number().refine((value) => {
|
|
7967
|
+
const decimalPlaces = value.toString().split(".")[1]?.length || 0;
|
|
7968
|
+
return decimalPlaces <= 2;
|
|
7969
|
+
}),
|
|
7970
|
+
type: z2.string().max(191).optional().nullable()
|
|
7971
|
+
});
|
|
7972
|
+
|
|
7950
7973
|
// ../core/dist/chunk-BRSSFQ7G.js
|
|
7951
7974
|
var merchantCustomerSchema = z2.object({
|
|
7952
7975
|
id: z2.string().max(191),
|
|
@@ -8075,16 +8098,6 @@ var purchaseUserTransferSchema = z2.object({
|
|
|
8075
8098
|
completedAt: z2.date().nullable()
|
|
8076
8099
|
});
|
|
8077
8100
|
|
|
8078
|
-
// ../core/dist/chunk-NH6Z6YIN.js
|
|
8079
|
-
var resourceProgressSchema = z2.object({
|
|
8080
|
-
userId: z2.string().max(191),
|
|
8081
|
-
contentResourceId: z2.string().max(191).optional().nullable(),
|
|
8082
|
-
metadata: z2.record(z2.any()).default({}),
|
|
8083
|
-
completedAt: z2.date().nullable(),
|
|
8084
|
-
updatedAt: z2.date().nullable(),
|
|
8085
|
-
createdAt: z2.date().nullable()
|
|
8086
|
-
});
|
|
8087
|
-
|
|
8088
8101
|
// ../core/dist/chunk-AYRXRIAF.js
|
|
8089
8102
|
var merchantChargeSchema = z2.object({
|
|
8090
8103
|
id: z2.string().length(191),
|
|
@@ -8097,19 +8110,6 @@ var merchantChargeSchema = z2.object({
|
|
|
8097
8110
|
merchantCustomerId: z2.string().length(191)
|
|
8098
8111
|
});
|
|
8099
8112
|
|
|
8100
|
-
// ../core/dist/chunk-NTKCZFHE.js
|
|
8101
|
-
var merchantCouponSchema = z2.object({
|
|
8102
|
-
id: z2.string().max(191),
|
|
8103
|
-
identifier: z2.string().max(191).optional().nullable(),
|
|
8104
|
-
status: z2.number().int().default(0),
|
|
8105
|
-
merchantAccountId: z2.string().max(191),
|
|
8106
|
-
percentageDiscount: z2.coerce.number().refine((value) => {
|
|
8107
|
-
const decimalPlaces = value.toString().split(".")[1]?.length || 0;
|
|
8108
|
-
return decimalPlaces <= 2;
|
|
8109
|
-
}),
|
|
8110
|
-
type: z2.string().max(191).optional().nullable()
|
|
8111
|
-
});
|
|
8112
|
-
|
|
8113
8113
|
// ../core/dist/schemas/content-resource-schema.js
|
|
8114
8114
|
var ContentResourceResourceSchema = z2.object({
|
|
8115
8115
|
resourceId: z2.string(),
|
|
@@ -10122,7 +10122,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core31.mysqlTable) {
|
|
|
10122
10122
|
},
|
|
10123
10123
|
async getContentResource(data) {
|
|
10124
10124
|
const resource = await client.query.contentResource.findFirst({
|
|
10125
|
-
where: (0, import_drizzle_orm26.eq)(contentResource.id, data),
|
|
10125
|
+
where: (0, import_drizzle_orm26.or)((0, import_drizzle_orm26.eq)(contentResource.id, data), (0, import_drizzle_orm26.eq)(import_drizzle_orm26.sql`JSON_EXTRACT (${contentResource.fields}, "$.slug")`, `${data}`)),
|
|
10126
10126
|
with: {
|
|
10127
10127
|
resources: {
|
|
10128
10128
|
with: {
|