@coursebuilder/adapter-drizzle 1.0.6 → 1.0.7
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-3RQH7IPC.js +78 -0
- package/dist/chunk-6XFVP2Q4.js +101 -0
- package/dist/chunk-7223HR2E.js +112 -0
- package/dist/chunk-DP6YPJZ4.js +12764 -0
- package/dist/chunk-JX53ECWI.js +2143 -0
- package/dist/chunk-LV3LIBNU.js +12764 -0
- package/dist/chunk-O4PMFTPJ.js +79 -0
- package/dist/chunk-OK4NHV6Z.js +58 -0
- package/dist/chunk-P76GFFVH.js +49 -0
- package/dist/chunk-UIQCNODZ.js +100 -0
- package/dist/chunk-XM5PWOCV.js +63 -0
- package/dist/index.js +1 -1
- package/dist/lib/mysql/index.cjs +123 -123
- package/dist/lib/mysql/index.cjs.map +1 -1
- package/dist/lib/mysql/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getRolesSchema
|
|
3
|
+
} from "./chunk-JX53ECWI.js";
|
|
4
|
+
import {
|
|
5
|
+
getPermissionsSchema
|
|
6
|
+
} from "./chunk-UWUDJCJM.js";
|
|
7
|
+
import {
|
|
8
|
+
__name
|
|
9
|
+
} from "./chunk-2X5XVNDN.js";
|
|
10
|
+
|
|
11
|
+
// src/lib/mysql/schemas/auth/role-permissions.ts
|
|
12
|
+
import { relations } from "drizzle-orm";
|
|
13
|
+
import { boolean, index, primaryKey, timestamp, varchar } from "drizzle-orm/mysql-core";
|
|
14
|
+
function getRolePermissionsSchema(mysqlTable) {
|
|
15
|
+
return mysqlTable("RolePermission", {
|
|
16
|
+
roleId: varchar("roleId", {
|
|
17
|
+
length: 255
|
|
18
|
+
}).notNull(),
|
|
19
|
+
permissionId: varchar("permissionId", {
|
|
20
|
+
length: 255
|
|
21
|
+
}).notNull(),
|
|
22
|
+
active: boolean("active").notNull().default(true),
|
|
23
|
+
createdAt: timestamp("createdAt", {
|
|
24
|
+
mode: "date",
|
|
25
|
+
fsp: 3
|
|
26
|
+
}).defaultNow(),
|
|
27
|
+
updatedAt: timestamp("updatedAt", {
|
|
28
|
+
mode: "date",
|
|
29
|
+
fsp: 3
|
|
30
|
+
}).defaultNow(),
|
|
31
|
+
deletedAt: timestamp("deletedAt", {
|
|
32
|
+
mode: "date",
|
|
33
|
+
fsp: 3
|
|
34
|
+
})
|
|
35
|
+
}, (rp) => ({
|
|
36
|
+
pk: primaryKey({
|
|
37
|
+
columns: [
|
|
38
|
+
rp.roleId,
|
|
39
|
+
rp.permissionId
|
|
40
|
+
]
|
|
41
|
+
}),
|
|
42
|
+
roleIdIdx: index("roleId_idx").on(rp.roleId),
|
|
43
|
+
permissionIdIdx: index("permissionId_idx").on(rp.permissionId)
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
__name(getRolePermissionsSchema, "getRolePermissionsSchema");
|
|
47
|
+
function getRolePermissionsRelationsSchema(mysqlTable) {
|
|
48
|
+
const permissions = getPermissionsSchema(mysqlTable);
|
|
49
|
+
const roles = getRolesSchema(mysqlTable);
|
|
50
|
+
const rolePermissions = getRolePermissionsSchema(mysqlTable);
|
|
51
|
+
return relations(rolePermissions, ({ one }) => ({
|
|
52
|
+
role: one(roles, {
|
|
53
|
+
fields: [
|
|
54
|
+
rolePermissions.roleId
|
|
55
|
+
],
|
|
56
|
+
references: [
|
|
57
|
+
roles.id
|
|
58
|
+
],
|
|
59
|
+
relationName: "role"
|
|
60
|
+
}),
|
|
61
|
+
permission: one(permissions, {
|
|
62
|
+
fields: [
|
|
63
|
+
rolePermissions.permissionId
|
|
64
|
+
],
|
|
65
|
+
references: [
|
|
66
|
+
permissions.id
|
|
67
|
+
],
|
|
68
|
+
relationName: "permission"
|
|
69
|
+
})
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
__name(getRolePermissionsRelationsSchema, "getRolePermissionsRelationsSchema");
|
|
73
|
+
|
|
74
|
+
export {
|
|
75
|
+
getRolePermissionsSchema,
|
|
76
|
+
getRolePermissionsRelationsSchema
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=chunk-3RQH7IPC.js.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getContentResourceSchema,
|
|
3
|
+
getUsersSchema
|
|
4
|
+
} from "./chunk-JX53ECWI.js";
|
|
5
|
+
import {
|
|
6
|
+
__name
|
|
7
|
+
} from "./chunk-2X5XVNDN.js";
|
|
8
|
+
|
|
9
|
+
// src/lib/mysql/schemas/communication/question-response.ts
|
|
10
|
+
import { relations, sql } from "drizzle-orm";
|
|
11
|
+
import { index, json, timestamp, uniqueIndex, varchar } from "drizzle-orm/mysql-core";
|
|
12
|
+
function getQuestionResponseSchema(mysqlTable) {
|
|
13
|
+
return mysqlTable("QuestionResponse", {
|
|
14
|
+
id: varchar("id", {
|
|
15
|
+
length: 255
|
|
16
|
+
}).notNull().primaryKey(),
|
|
17
|
+
surveyId: varchar("surveyId", {
|
|
18
|
+
length: 255
|
|
19
|
+
}).notNull(),
|
|
20
|
+
questionId: varchar("questionId", {
|
|
21
|
+
length: 255
|
|
22
|
+
}).notNull(),
|
|
23
|
+
respondentKey: varchar("respondentKey", {
|
|
24
|
+
length: 255
|
|
25
|
+
}),
|
|
26
|
+
surveySessionId: varchar("surveySessionId", {
|
|
27
|
+
length: 255
|
|
28
|
+
}),
|
|
29
|
+
userId: varchar("userId", {
|
|
30
|
+
length: 255
|
|
31
|
+
}),
|
|
32
|
+
emailListSubscriberId: varchar("emailListSubscriberId", {
|
|
33
|
+
length: 255
|
|
34
|
+
}),
|
|
35
|
+
fields: json("fields").$type().default({}),
|
|
36
|
+
createdAt: timestamp("createdAt", {
|
|
37
|
+
mode: "date",
|
|
38
|
+
fsp: 3
|
|
39
|
+
}).default(sql`CURRENT_TIMESTAMP(3)`),
|
|
40
|
+
updatedAt: timestamp("updatedAt", {
|
|
41
|
+
mode: "date",
|
|
42
|
+
fsp: 3
|
|
43
|
+
}).default(sql`CURRENT_TIMESTAMP(3)`),
|
|
44
|
+
deletedAt: timestamp("deletedAt", {
|
|
45
|
+
mode: "date",
|
|
46
|
+
fsp: 3
|
|
47
|
+
})
|
|
48
|
+
}, (qr) => ({
|
|
49
|
+
surveyIdIdx: index("surveyId_idx").on(qr.surveyId),
|
|
50
|
+
questionIdIdx: index("questionId_idx").on(qr.questionId),
|
|
51
|
+
respondentKeyIdx: index("respondent_key_idx").on(qr.respondentKey),
|
|
52
|
+
surveySessionIdIdx: index("survey_session_id_idx").on(qr.surveySessionId),
|
|
53
|
+
userIdIdx: index("userId_idx").on(qr.userId),
|
|
54
|
+
emailListSubscriberIdIdx: index("emailListSubscriberId_idx").on(qr.emailListSubscriberId),
|
|
55
|
+
surveySubscriberIdx: index("survey_subscriber_idx").on(qr.surveyId, qr.emailListSubscriberId),
|
|
56
|
+
surveyQuestionRespondentIdx: uniqueIndex("survey_question_respondent_unique").on(qr.surveyId, qr.questionId, qr.respondentKey)
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
__name(getQuestionResponseSchema, "getQuestionResponseSchema");
|
|
60
|
+
function getQuestionResponseRelationsSchema(mysqlTable, overrides = {}) {
|
|
61
|
+
const questionResponse = getQuestionResponseSchema(mysqlTable);
|
|
62
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
63
|
+
const users = resolveUsersSchema(mysqlTable);
|
|
64
|
+
const contentResource = getContentResourceSchema(mysqlTable);
|
|
65
|
+
return relations(questionResponse, ({ one }) => ({
|
|
66
|
+
user: one(users, {
|
|
67
|
+
fields: [
|
|
68
|
+
questionResponse.userId
|
|
69
|
+
],
|
|
70
|
+
references: [
|
|
71
|
+
users.id
|
|
72
|
+
],
|
|
73
|
+
relationName: "questionResponseUser"
|
|
74
|
+
}),
|
|
75
|
+
survey: one(contentResource, {
|
|
76
|
+
fields: [
|
|
77
|
+
questionResponse.surveyId
|
|
78
|
+
],
|
|
79
|
+
references: [
|
|
80
|
+
contentResource.id
|
|
81
|
+
],
|
|
82
|
+
relationName: "questionResponseSurvey"
|
|
83
|
+
}),
|
|
84
|
+
question: one(contentResource, {
|
|
85
|
+
fields: [
|
|
86
|
+
questionResponse.questionId
|
|
87
|
+
],
|
|
88
|
+
references: [
|
|
89
|
+
contentResource.id
|
|
90
|
+
],
|
|
91
|
+
relationName: "questionResponseQuestion"
|
|
92
|
+
})
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
__name(getQuestionResponseRelationsSchema, "getQuestionResponseRelationsSchema");
|
|
96
|
+
|
|
97
|
+
export {
|
|
98
|
+
getQuestionResponseSchema,
|
|
99
|
+
getQuestionResponseRelationsSchema
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=chunk-6XFVP2Q4.js.map
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getPurchaseSchema,
|
|
3
|
+
getUsersSchema
|
|
4
|
+
} from "./chunk-JX53ECWI.js";
|
|
5
|
+
import {
|
|
6
|
+
__name
|
|
7
|
+
} from "./chunk-2X5XVNDN.js";
|
|
8
|
+
|
|
9
|
+
// src/lib/mysql/schemas/commerce/purchase-user-transfer.ts
|
|
10
|
+
import { relations, sql } from "drizzle-orm";
|
|
11
|
+
import { index, mysqlEnum, primaryKey, timestamp, varchar } from "drizzle-orm/mysql-core";
|
|
12
|
+
function getPurchaseUserTransferSchema(mysqlTable) {
|
|
13
|
+
return mysqlTable("PurchaseUserTransfer", {
|
|
14
|
+
id: varchar("id", {
|
|
15
|
+
length: 191
|
|
16
|
+
}).notNull(),
|
|
17
|
+
transferState: mysqlEnum("transferState", [
|
|
18
|
+
"AVAILABLE",
|
|
19
|
+
"INITIATED",
|
|
20
|
+
"VERIFIED",
|
|
21
|
+
"CANCELED",
|
|
22
|
+
"EXPIRED",
|
|
23
|
+
"CONFIRMED",
|
|
24
|
+
"COMPLETED"
|
|
25
|
+
]).default("AVAILABLE").notNull(),
|
|
26
|
+
purchaseId: varchar("purchaseId", {
|
|
27
|
+
length: 191
|
|
28
|
+
}).notNull(),
|
|
29
|
+
organizationId: varchar("organizationId", {
|
|
30
|
+
length: 191
|
|
31
|
+
}),
|
|
32
|
+
sourceUserId: varchar("sourceUserId", {
|
|
33
|
+
length: 191
|
|
34
|
+
}).notNull(),
|
|
35
|
+
targetUserId: varchar("targetUserId", {
|
|
36
|
+
length: 191
|
|
37
|
+
}),
|
|
38
|
+
createdAt: timestamp("createdAt", {
|
|
39
|
+
mode: "date",
|
|
40
|
+
fsp: 3
|
|
41
|
+
}).default(sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
42
|
+
expiresAt: timestamp("expiresAt", {
|
|
43
|
+
mode: "date",
|
|
44
|
+
fsp: 3
|
|
45
|
+
}),
|
|
46
|
+
canceledAt: timestamp("canceledAt", {
|
|
47
|
+
mode: "date",
|
|
48
|
+
fsp: 3
|
|
49
|
+
}),
|
|
50
|
+
confirmedAt: timestamp("confirmedAt", {
|
|
51
|
+
mode: "date",
|
|
52
|
+
fsp: 3
|
|
53
|
+
}),
|
|
54
|
+
completedAt: timestamp("completedAt", {
|
|
55
|
+
mode: "date",
|
|
56
|
+
fsp: 3
|
|
57
|
+
})
|
|
58
|
+
}, (table) => {
|
|
59
|
+
return {
|
|
60
|
+
purchaseUserTransferId: primaryKey({
|
|
61
|
+
columns: [
|
|
62
|
+
table.id
|
|
63
|
+
],
|
|
64
|
+
name: "PurchaseUserTransfer_id"
|
|
65
|
+
}),
|
|
66
|
+
organizationIdIdx: index("organizationId_idx").on(table.organizationId)
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
__name(getPurchaseUserTransferSchema, "getPurchaseUserTransferSchema");
|
|
71
|
+
function getPurchaseUserTransferRelationsSchema(mysqlTable, overrides = {}) {
|
|
72
|
+
const purchaseUserTransfer = getPurchaseUserTransferSchema(mysqlTable);
|
|
73
|
+
const resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema;
|
|
74
|
+
const user = resolveUsersSchema(mysqlTable);
|
|
75
|
+
const purchase = getPurchaseSchema(mysqlTable);
|
|
76
|
+
return relations(purchaseUserTransfer, ({ one }) => ({
|
|
77
|
+
sourceUser: one(user, {
|
|
78
|
+
fields: [
|
|
79
|
+
purchaseUserTransfer.sourceUserId
|
|
80
|
+
],
|
|
81
|
+
references: [
|
|
82
|
+
user.id
|
|
83
|
+
],
|
|
84
|
+
relationName: "sourceUser"
|
|
85
|
+
}),
|
|
86
|
+
targetUser: one(user, {
|
|
87
|
+
fields: [
|
|
88
|
+
purchaseUserTransfer.targetUserId
|
|
89
|
+
],
|
|
90
|
+
references: [
|
|
91
|
+
user.id
|
|
92
|
+
],
|
|
93
|
+
relationName: "targetUser"
|
|
94
|
+
}),
|
|
95
|
+
purchase: one(purchase, {
|
|
96
|
+
fields: [
|
|
97
|
+
purchaseUserTransfer.purchaseId
|
|
98
|
+
],
|
|
99
|
+
references: [
|
|
100
|
+
purchase.id
|
|
101
|
+
],
|
|
102
|
+
relationName: "purchase"
|
|
103
|
+
})
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
__name(getPurchaseUserTransferRelationsSchema, "getPurchaseUserTransferRelationsSchema");
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
getPurchaseUserTransferSchema,
|
|
110
|
+
getPurchaseUserTransferRelationsSchema
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=chunk-7223HR2E.js.map
|