@headless-lms/adapter-db 0.1.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/LICENSE +21 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/client.d.ts +17 -0
- package/dist/client.js +11 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +22 -0
- package/dist/migrate.d.ts +7 -0
- package/dist/migrate.js +27 -0
- package/dist/migrate.js.map +1 -0
- package/dist/repositories/assets.d.ts +17 -0
- package/dist/repositories/assets.js +90 -0
- package/dist/repositories/assets.js.map +1 -0
- package/dist/repositories/automations.d.ts +30 -0
- package/dist/repositories/automations.js +165 -0
- package/dist/repositories/automations.js.map +1 -0
- package/dist/repositories/content.d.ts +52 -0
- package/dist/repositories/content.js +350 -0
- package/dist/repositories/content.js.map +1 -0
- package/dist/repositories/credentials.d.ts +25 -0
- package/dist/repositories/credentials.js +86 -0
- package/dist/repositories/credentials.js.map +1 -0
- package/dist/repositories/dashboard.d.ts +14 -0
- package/dist/repositories/dashboard.js +55 -0
- package/dist/repositories/dashboard.js.map +1 -0
- package/dist/repositories/discussion.d.ts +31 -0
- package/dist/repositories/discussion.js +201 -0
- package/dist/repositories/discussion.js.map +1 -0
- package/dist/repositories/entitlements.d.ts +23 -0
- package/dist/repositories/entitlements.js +129 -0
- package/dist/repositories/entitlements.js.map +1 -0
- package/dist/repositories/identity.d.ts +17 -0
- package/dist/repositories/identity.js +44 -0
- package/dist/repositories/identity.js.map +1 -0
- package/dist/repositories/integrations.d.ts +18 -0
- package/dist/repositories/integrations.js +65 -0
- package/dist/repositories/integrations.js.map +1 -0
- package/dist/repositories/learn.d.ts +19 -0
- package/dist/repositories/learn.js +54 -0
- package/dist/repositories/learn.js.map +1 -0
- package/dist/repositories/members.d.ts +16 -0
- package/dist/repositories/members.js +116 -0
- package/dist/repositories/members.js.map +1 -0
- package/dist/repositories/org-user-profile.d.ts +92 -0
- package/dist/repositories/org-user-profile.js +16 -0
- package/dist/repositories/org-user-profile.js.map +1 -0
- package/dist/repositories/organizations.d.ts +33 -0
- package/dist/repositories/organizations.js +198 -0
- package/dist/repositories/organizations.js.map +1 -0
- package/dist/repositories/outbox.d.ts +24 -0
- package/dist/repositories/outbox.js +56 -0
- package/dist/repositories/outbox.js.map +1 -0
- package/dist/repositories/pg-errors.d.ts +11 -0
- package/dist/repositories/pg-errors.js +15 -0
- package/dist/repositories/pg-errors.js.map +1 -0
- package/dist/repositories/progress.d.ts +18 -0
- package/dist/repositories/progress.js +59 -0
- package/dist/repositories/progress.js.map +1 -0
- package/dist/repositories/settings.d.ts +22 -0
- package/dist/repositories/settings.js +73 -0
- package/dist/repositories/settings.js.map +1 -0
- package/dist/repositories/students.d.ts +15 -0
- package/dist/repositories/students.js +83 -0
- package/dist/repositories/students.js.map +1 -0
- package/dist/schema/assets.d.ts +181 -0
- package/dist/schema/assets.js +24 -0
- package/dist/schema/assets.js.map +1 -0
- package/dist/schema/automations.d.ts +364 -0
- package/dist/schema/automations.js +42 -0
- package/dist/schema/automations.js.map +1 -0
- package/dist/schema/better-auth.d.ts +2311 -0
- package/dist/schema/better-auth.js +156 -0
- package/dist/schema/better-auth.js.map +1 -0
- package/dist/schema/content.d.ts +966 -0
- package/dist/schema/content.js +163 -0
- package/dist/schema/content.js.map +1 -0
- package/dist/schema/credentials.d.ts +113 -0
- package/dist/schema/credentials.js +15 -0
- package/dist/schema/credentials.js.map +1 -0
- package/dist/schema/discussion.d.ts +399 -0
- package/dist/schema/discussion.js +89 -0
- package/dist/schema/discussion.js.map +1 -0
- package/dist/schema/drift.d.ts +9 -0
- package/dist/schema/drift.js +1 -0
- package/dist/schema/entitlements.d.ts +147 -0
- package/dist/schema/entitlements.js +30 -0
- package/dist/schema/entitlements.js.map +1 -0
- package/dist/schema/identity.d.ts +130 -0
- package/dist/schema/identity.js +16 -0
- package/dist/schema/identity.js.map +1 -0
- package/dist/schema/index.d.ts +18 -0
- package/dist/schema/index.js +43 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/integrations.d.ts +149 -0
- package/dist/schema/integrations.js +25 -0
- package/dist/schema/integrations.js.map +1 -0
- package/dist/schema/organizations.d.ts +416 -0
- package/dist/schema/organizations.js +58 -0
- package/dist/schema/organizations.js.map +1 -0
- package/dist/schema/outbox.d.ts +166 -0
- package/dist/schema/outbox.js +19 -0
- package/dist/schema/outbox.js.map +1 -0
- package/dist/schema/progress.d.ts +166 -0
- package/dist/schema/progress.js +30 -0
- package/dist/schema/progress.js.map +1 -0
- package/dist/schema/settings.d.ts +115 -0
- package/dist/schema/settings.js +19 -0
- package/dist/schema/settings.js.map +1 -0
- package/dist/unit-of-work.d.ts +13 -0
- package/dist/unit-of-work.js +16 -0
- package/dist/unit-of-work.js.map +1 -0
- package/drizzle/0000_baseline.sql +526 -0
- package/drizzle/meta/0000_snapshot.json +3925 -0
- package/drizzle/meta/_journal.json +13 -0
- package/package.json +56 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entitlements.js","names":[],"sources":["../../src/schema/entitlements.ts"],"sourcesContent":["\nimport { pgTable, text, timestamp, primaryKey, foreignKey, unique } from 'drizzle-orm/pg-core';\nimport type { Entitlement } from '@headless-lms/core/schemas';\nimport { genId } from '@headless-lms/core/shared/id';\nimport { organizations, orgUsers } from './organizations.js';\nimport { contentItems } from './content.js';\nimport type { Expect, NoDrift } from './drift.js';\n\nexport const entitlements = pgTable(\n 'entitlements',\n {\n orgId: text('org_id')\n .notNull()\n .references(() => organizations.id),\n id: text('id')\n .notNull()\n .$defaultFn(() => genId('entitlement')),\n orgUserId: text('org_user_id').notNull(),\n contentId: text('content_id').notNull(),\n status: text('status', { enum: ['active', 'revoked'] })\n .notNull()\n .default('active'),\n // Free text: 'manual', 'import', integration ids, …\n source: text('source').notNull().default('manual'),\n grantedAt: timestamp('granted_at', { withTimezone: true }).notNull().defaultNow(),\n expiresAt: timestamp('expires_at', { withTimezone: true }), // null = lifetime\n },\n (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.id] }),\n // Grants die with their content: deleting the registry row cascades here.\n contentFk: foreignKey({\n columns: [t.orgId, t.contentId],\n foreignColumns: [contentItems.orgId, contentItems.id],\n }).onDelete('cascade'),\n // org_users is org-scoped (composite PK) — the FK must match both columns.\n // Grants die with their org user: deleting the org_users row cascades here.\n orgUserFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete('cascade'),\n // One grant per (org, org user, content).\n orgUserContentUq: unique().on(t.orgId, t.orgUserId, t.contentId),\n }),\n);\n\ntype _EntitlementsDrift = Expect<NoDrift<typeof entitlements.$inferSelect, Entitlement>>;\n"],"mappings":";;;;;AAQA,MAAa,eAAe,QAC1B,gBACA;CACE,OAAO,KAAK,QAAQ,CAAC,CAClB,QAAQ,CAAC,CACT,iBAAiB,cAAc,EAAE;CACpC,IAAI,KAAK,IAAI,CAAC,CACX,QAAQ,CAAC,CACT,iBAAiB,MAAM,aAAa,CAAC;CACxC,WAAW,KAAK,aAAa,CAAC,CAAC,QAAQ;CACvC,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,QAAQ,KAAK,UAAU,EAAE,MAAM,CAAC,UAAU,SAAS,EAAE,CAAC,CAAC,CACpD,QAAQ,CAAC,CACT,QAAQ,QAAQ;CAEnB,QAAQ,KAAK,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,QAAQ;CACjD,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW;CAChF,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC;AAC3D,IACC,OAAO;CACN,IAAI,WAAW,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;CAE3C,WAAW,WAAW;EACpB,SAAS,CAAC,EAAE,OAAO,EAAE,SAAS;EAC9B,gBAAgB,CAAC,aAAa,OAAO,aAAa,EAAE;CACtD,CAAC,CAAC,CAAC,SAAS,SAAS;CAGrB,WAAW,WAAW;EACpB,SAAS,CAAC,EAAE,OAAO,EAAE,SAAS;EAC9B,gBAAgB,CAAC,SAAS,OAAO,SAAS,EAAE;CAC9C,CAAC,CAAC,CAAC,SAAS,SAAS;CAErB,kBAAkB,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS;AACjE,EACF"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
//#region src/schema/identity.d.ts
|
|
2
|
+
declare const users: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
3
|
+
name: "users";
|
|
4
|
+
schema: undefined;
|
|
5
|
+
columns: {
|
|
6
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
7
|
+
name: "id";
|
|
8
|
+
tableName: "users";
|
|
9
|
+
dataType: "string";
|
|
10
|
+
columnType: "PgText";
|
|
11
|
+
data: string;
|
|
12
|
+
driverParam: string;
|
|
13
|
+
notNull: true;
|
|
14
|
+
hasDefault: true;
|
|
15
|
+
isPrimaryKey: true;
|
|
16
|
+
isAutoincrement: false;
|
|
17
|
+
hasRuntimeDefault: true;
|
|
18
|
+
enumValues: [string, ...string[]];
|
|
19
|
+
baseColumn: never;
|
|
20
|
+
identity: undefined;
|
|
21
|
+
generated: undefined;
|
|
22
|
+
}, {}, {}>;
|
|
23
|
+
externalId: import("drizzle-orm/pg-core").PgColumn<{
|
|
24
|
+
name: "external_id";
|
|
25
|
+
tableName: "users";
|
|
26
|
+
dataType: "string";
|
|
27
|
+
columnType: "PgText";
|
|
28
|
+
data: string;
|
|
29
|
+
driverParam: string;
|
|
30
|
+
notNull: false;
|
|
31
|
+
hasDefault: false;
|
|
32
|
+
isPrimaryKey: false;
|
|
33
|
+
isAutoincrement: false;
|
|
34
|
+
hasRuntimeDefault: false;
|
|
35
|
+
enumValues: [string, ...string[]];
|
|
36
|
+
baseColumn: never;
|
|
37
|
+
identity: undefined;
|
|
38
|
+
generated: undefined;
|
|
39
|
+
}, {}, {}>;
|
|
40
|
+
email: import("drizzle-orm/pg-core").PgColumn<{
|
|
41
|
+
name: "email";
|
|
42
|
+
tableName: "users";
|
|
43
|
+
dataType: "string";
|
|
44
|
+
columnType: "PgText";
|
|
45
|
+
data: string;
|
|
46
|
+
driverParam: string;
|
|
47
|
+
notNull: true;
|
|
48
|
+
hasDefault: false;
|
|
49
|
+
isPrimaryKey: false;
|
|
50
|
+
isAutoincrement: false;
|
|
51
|
+
hasRuntimeDefault: false;
|
|
52
|
+
enumValues: [string, ...string[]];
|
|
53
|
+
baseColumn: never;
|
|
54
|
+
identity: undefined;
|
|
55
|
+
generated: undefined;
|
|
56
|
+
}, {}, {}>;
|
|
57
|
+
firstName: import("drizzle-orm/pg-core").PgColumn<{
|
|
58
|
+
name: "first_name";
|
|
59
|
+
tableName: "users";
|
|
60
|
+
dataType: "string";
|
|
61
|
+
columnType: "PgText";
|
|
62
|
+
data: string;
|
|
63
|
+
driverParam: string;
|
|
64
|
+
notNull: false;
|
|
65
|
+
hasDefault: false;
|
|
66
|
+
isPrimaryKey: false;
|
|
67
|
+
isAutoincrement: false;
|
|
68
|
+
hasRuntimeDefault: false;
|
|
69
|
+
enumValues: [string, ...string[]];
|
|
70
|
+
baseColumn: never;
|
|
71
|
+
identity: undefined;
|
|
72
|
+
generated: undefined;
|
|
73
|
+
}, {}, {}>;
|
|
74
|
+
lastName: import("drizzle-orm/pg-core").PgColumn<{
|
|
75
|
+
name: "last_name";
|
|
76
|
+
tableName: "users";
|
|
77
|
+
dataType: "string";
|
|
78
|
+
columnType: "PgText";
|
|
79
|
+
data: string;
|
|
80
|
+
driverParam: string;
|
|
81
|
+
notNull: false;
|
|
82
|
+
hasDefault: false;
|
|
83
|
+
isPrimaryKey: false;
|
|
84
|
+
isAutoincrement: false;
|
|
85
|
+
hasRuntimeDefault: false;
|
|
86
|
+
enumValues: [string, ...string[]];
|
|
87
|
+
baseColumn: never;
|
|
88
|
+
identity: undefined;
|
|
89
|
+
generated: undefined;
|
|
90
|
+
}, {}, {}>;
|
|
91
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
92
|
+
name: "created_at";
|
|
93
|
+
tableName: "users";
|
|
94
|
+
dataType: "date";
|
|
95
|
+
columnType: "PgTimestamp";
|
|
96
|
+
data: Date;
|
|
97
|
+
driverParam: string;
|
|
98
|
+
notNull: true;
|
|
99
|
+
hasDefault: true;
|
|
100
|
+
isPrimaryKey: false;
|
|
101
|
+
isAutoincrement: false;
|
|
102
|
+
hasRuntimeDefault: false;
|
|
103
|
+
enumValues: undefined;
|
|
104
|
+
baseColumn: never;
|
|
105
|
+
identity: undefined;
|
|
106
|
+
generated: undefined;
|
|
107
|
+
}, {}, {}>;
|
|
108
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
109
|
+
name: "updated_at";
|
|
110
|
+
tableName: "users";
|
|
111
|
+
dataType: "date";
|
|
112
|
+
columnType: "PgTimestamp";
|
|
113
|
+
data: Date;
|
|
114
|
+
driverParam: string;
|
|
115
|
+
notNull: true;
|
|
116
|
+
hasDefault: true;
|
|
117
|
+
isPrimaryKey: false;
|
|
118
|
+
isAutoincrement: false;
|
|
119
|
+
hasRuntimeDefault: false;
|
|
120
|
+
enumValues: undefined;
|
|
121
|
+
baseColumn: never;
|
|
122
|
+
identity: undefined;
|
|
123
|
+
generated: undefined;
|
|
124
|
+
}, {}, {}>;
|
|
125
|
+
};
|
|
126
|
+
dialect: "pg";
|
|
127
|
+
}>;
|
|
128
|
+
//#endregion
|
|
129
|
+
export { users };
|
|
130
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
2
|
+
import { genId } from "@headless-lms/core/shared/id";
|
|
3
|
+
//#region src/schema/identity.ts
|
|
4
|
+
const users = pgTable("users", {
|
|
5
|
+
id: text("id").primaryKey().$defaultFn(() => genId("user")),
|
|
6
|
+
externalId: text("external_id").unique(),
|
|
7
|
+
email: text("email").notNull().unique(),
|
|
8
|
+
firstName: text("first_name"),
|
|
9
|
+
lastName: text("last_name"),
|
|
10
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
11
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => /* @__PURE__ */ new Date())
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { users };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","names":[],"sources":["../../src/schema/identity.ts"],"sourcesContent":["// identity tables — the person.\n//\n// One row per human, global, storing auth ID in `external_id`.\nimport { pgTable, text, timestamp } from 'drizzle-orm/pg-core';\nimport type { User } from '@headless-lms/core/schemas';\nimport { genId } from '@headless-lms/core/shared/id';\nimport type { Expect, NoDrift } from './drift.js';\n\nexport const users = pgTable('users', {\n id: text('id')\n .primaryKey()\n .$defaultFn(() => genId('user')),\n // auth engine's ID - e.g. better-auth.\n externalId: text('external_id').unique(),\n email: text('email').notNull().unique(),\n firstName: text('first_name'),\n lastName: text('last_name'),\n createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', { withTimezone: true })\n .notNull()\n .defaultNow()\n .$onUpdate(() => new Date()),\n});\n\ntype _UsersDrift = Expect<NoDrift<typeof users.$inferSelect, User>>;\n"],"mappings":";;;AAQA,MAAa,QAAQ,QAAQ,SAAS;CACpC,IAAI,KAAK,IAAI,CAAC,CACX,WAAW,CAAC,CACZ,iBAAiB,MAAM,MAAM,CAAC;CAEjC,YAAY,KAAK,aAAa,CAAC,CAAC,OAAO;CACvC,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO;CACtC,WAAW,KAAK,YAAY;CAC5B,UAAU,KAAK,WAAW;CAC1B,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW;CAChF,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CACvD,QAAQ,CAAC,CACT,WAAW,CAAC,CACZ,gCAAgB,IAAI,KAAK,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { invites, orgUsers, organizations } from "./organizations.js";
|
|
2
|
+
import { activities, activityAssets, contentItems, courses, downloadAssets, downloads, modules } from "./content.js";
|
|
3
|
+
import { entitlements } from "./entitlements.js";
|
|
4
|
+
import { progressRecords } from "./progress.js";
|
|
5
|
+
import { users } from "./identity.js";
|
|
6
|
+
import { assets } from "./assets.js";
|
|
7
|
+
import { credentials } from "./credentials.js";
|
|
8
|
+
import { connections } from "./integrations.js";
|
|
9
|
+
import { eventOutbox } from "./outbox.js";
|
|
10
|
+
import { automationRuns, automations } from "./automations.js";
|
|
11
|
+
import { settings } from "./settings.js";
|
|
12
|
+
import { commentReactions, commentReports, comments } from "./discussion.js";
|
|
13
|
+
declare namespace index_d_exports {
|
|
14
|
+
export { activities, activityAssets, assets, automationRuns, automations, commentReactions, commentReports, comments, connections, contentItems, courses, credentials, downloadAssets, downloads, entitlements, eventOutbox, invites, modules, orgUsers, organizations, progressRecords, settings, users };
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { activities, activityAssets, assets, automationRuns, automations, commentReactions, commentReports, comments, connections, contentItems, courses, credentials, downloadAssets, downloads, entitlements, eventOutbox, index_d_exports, invites, modules, orgUsers, organizations, progressRecords, settings, users };
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { users } from "./identity.js";
|
|
3
|
+
import { invites, orgUsers, organizations } from "./organizations.js";
|
|
4
|
+
import { assets } from "./assets.js";
|
|
5
|
+
import { activities, activityAssets, contentItems, courses, downloadAssets, downloads, modules } from "./content.js";
|
|
6
|
+
import { entitlements } from "./entitlements.js";
|
|
7
|
+
import { progressRecords } from "./progress.js";
|
|
8
|
+
import { credentials } from "./credentials.js";
|
|
9
|
+
import { connections } from "./integrations.js";
|
|
10
|
+
import { eventOutbox } from "./outbox.js";
|
|
11
|
+
import { automationRuns, automations } from "./automations.js";
|
|
12
|
+
import { settings } from "./settings.js";
|
|
13
|
+
import { commentReactions, commentReports, comments } from "./discussion.js";
|
|
14
|
+
//#region src/schema/index.ts
|
|
15
|
+
var schema_exports = /* @__PURE__ */ __exportAll({
|
|
16
|
+
activities: () => activities,
|
|
17
|
+
activityAssets: () => activityAssets,
|
|
18
|
+
assets: () => assets,
|
|
19
|
+
automationRuns: () => automationRuns,
|
|
20
|
+
automations: () => automations,
|
|
21
|
+
commentReactions: () => commentReactions,
|
|
22
|
+
commentReports: () => commentReports,
|
|
23
|
+
comments: () => comments,
|
|
24
|
+
connections: () => connections,
|
|
25
|
+
contentItems: () => contentItems,
|
|
26
|
+
courses: () => courses,
|
|
27
|
+
credentials: () => credentials,
|
|
28
|
+
downloadAssets: () => downloadAssets,
|
|
29
|
+
downloads: () => downloads,
|
|
30
|
+
entitlements: () => entitlements,
|
|
31
|
+
eventOutbox: () => eventOutbox,
|
|
32
|
+
invites: () => invites,
|
|
33
|
+
modules: () => modules,
|
|
34
|
+
orgUsers: () => orgUsers,
|
|
35
|
+
organizations: () => organizations,
|
|
36
|
+
progressRecords: () => progressRecords,
|
|
37
|
+
settings: () => settings,
|
|
38
|
+
users: () => users
|
|
39
|
+
});
|
|
40
|
+
//#endregion
|
|
41
|
+
export { activities, activityAssets, assets, automationRuns, automations, commentReactions, commentReports, comments, connections, contentItems, courses, credentials, downloadAssets, downloads, entitlements, eventOutbox, invites, modules, orgUsers, organizations, progressRecords, schema_exports, settings, users };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/schema/index.ts"],"sourcesContent":["// Centralized Drizzle schema. All domain tables live here, grouped by the\n// bounded context that owns them. Re-exported so drizzle-kit and the\n// repositories have a single import surface.\nexport * from './organizations.js';\nexport * from './content.js';\nexport * from './entitlements.js';\nexport * from './progress.js';\nexport * from './identity.js';\nexport * from './assets.js';\nexport * from './credentials.js';\nexport * from './integrations.js';\nexport * from './outbox.js';\nexport * from './automations.js';\nexport * from './settings.js';\nexport * from './discussion.js';\n"],"mappings":""}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
//#region src/schema/integrations.d.ts
|
|
2
|
+
declare const connections: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
3
|
+
name: "connections";
|
|
4
|
+
schema: undefined;
|
|
5
|
+
columns: {
|
|
6
|
+
orgId: import("drizzle-orm/pg-core").PgColumn<{
|
|
7
|
+
name: "org_id";
|
|
8
|
+
tableName: "connections";
|
|
9
|
+
dataType: "string";
|
|
10
|
+
columnType: "PgText";
|
|
11
|
+
data: string;
|
|
12
|
+
driverParam: string;
|
|
13
|
+
notNull: true;
|
|
14
|
+
hasDefault: false;
|
|
15
|
+
isPrimaryKey: false;
|
|
16
|
+
isAutoincrement: false;
|
|
17
|
+
hasRuntimeDefault: false;
|
|
18
|
+
enumValues: [string, ...string[]];
|
|
19
|
+
baseColumn: never;
|
|
20
|
+
identity: undefined;
|
|
21
|
+
generated: undefined;
|
|
22
|
+
}, {}, {}>;
|
|
23
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
24
|
+
name: "id";
|
|
25
|
+
tableName: "connections";
|
|
26
|
+
dataType: "string";
|
|
27
|
+
columnType: "PgText";
|
|
28
|
+
data: string;
|
|
29
|
+
driverParam: string;
|
|
30
|
+
notNull: true;
|
|
31
|
+
hasDefault: false;
|
|
32
|
+
isPrimaryKey: false;
|
|
33
|
+
isAutoincrement: false;
|
|
34
|
+
hasRuntimeDefault: false;
|
|
35
|
+
enumValues: [string, ...string[]];
|
|
36
|
+
baseColumn: never;
|
|
37
|
+
identity: undefined;
|
|
38
|
+
generated: undefined;
|
|
39
|
+
}, {}, {}>;
|
|
40
|
+
integrationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
41
|
+
name: "integration_id";
|
|
42
|
+
tableName: "connections";
|
|
43
|
+
dataType: "string";
|
|
44
|
+
columnType: "PgText";
|
|
45
|
+
data: string;
|
|
46
|
+
driverParam: string;
|
|
47
|
+
notNull: true;
|
|
48
|
+
hasDefault: false;
|
|
49
|
+
isPrimaryKey: false;
|
|
50
|
+
isAutoincrement: false;
|
|
51
|
+
hasRuntimeDefault: false;
|
|
52
|
+
enumValues: [string, ...string[]];
|
|
53
|
+
baseColumn: never;
|
|
54
|
+
identity: undefined;
|
|
55
|
+
generated: undefined;
|
|
56
|
+
}, {}, {}>;
|
|
57
|
+
config: import("drizzle-orm/pg-core").PgColumn<{
|
|
58
|
+
name: "config";
|
|
59
|
+
tableName: "connections";
|
|
60
|
+
dataType: "json";
|
|
61
|
+
columnType: "PgJsonb";
|
|
62
|
+
data: Record<string, import("@headless-lms/core/types").JsonValue>;
|
|
63
|
+
driverParam: unknown;
|
|
64
|
+
notNull: true;
|
|
65
|
+
hasDefault: true;
|
|
66
|
+
isPrimaryKey: false;
|
|
67
|
+
isAutoincrement: false;
|
|
68
|
+
hasRuntimeDefault: false;
|
|
69
|
+
enumValues: undefined;
|
|
70
|
+
baseColumn: never;
|
|
71
|
+
identity: undefined;
|
|
72
|
+
generated: undefined;
|
|
73
|
+
}, {}, {
|
|
74
|
+
$type: Record<string, import("@headless-lms/core/types").JsonValue>;
|
|
75
|
+
}>;
|
|
76
|
+
active: import("drizzle-orm/pg-core").PgColumn<{
|
|
77
|
+
name: "active";
|
|
78
|
+
tableName: "connections";
|
|
79
|
+
dataType: "boolean";
|
|
80
|
+
columnType: "PgBoolean";
|
|
81
|
+
data: boolean;
|
|
82
|
+
driverParam: boolean;
|
|
83
|
+
notNull: true;
|
|
84
|
+
hasDefault: true;
|
|
85
|
+
isPrimaryKey: false;
|
|
86
|
+
isAutoincrement: false;
|
|
87
|
+
hasRuntimeDefault: false;
|
|
88
|
+
enumValues: undefined;
|
|
89
|
+
baseColumn: never;
|
|
90
|
+
identity: undefined;
|
|
91
|
+
generated: undefined;
|
|
92
|
+
}, {}, {}>;
|
|
93
|
+
credentialRef: import("drizzle-orm/pg-core").PgColumn<{
|
|
94
|
+
name: "credential_ref";
|
|
95
|
+
tableName: "connections";
|
|
96
|
+
dataType: "string";
|
|
97
|
+
columnType: "PgText";
|
|
98
|
+
data: string;
|
|
99
|
+
driverParam: string;
|
|
100
|
+
notNull: true;
|
|
101
|
+
hasDefault: false;
|
|
102
|
+
isPrimaryKey: false;
|
|
103
|
+
isAutoincrement: false;
|
|
104
|
+
hasRuntimeDefault: false;
|
|
105
|
+
enumValues: [string, ...string[]];
|
|
106
|
+
baseColumn: never;
|
|
107
|
+
identity: undefined;
|
|
108
|
+
generated: undefined;
|
|
109
|
+
}, {}, {}>;
|
|
110
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
111
|
+
name: "created_at";
|
|
112
|
+
tableName: "connections";
|
|
113
|
+
dataType: "date";
|
|
114
|
+
columnType: "PgTimestamp";
|
|
115
|
+
data: Date;
|
|
116
|
+
driverParam: string;
|
|
117
|
+
notNull: true;
|
|
118
|
+
hasDefault: true;
|
|
119
|
+
isPrimaryKey: false;
|
|
120
|
+
isAutoincrement: false;
|
|
121
|
+
hasRuntimeDefault: false;
|
|
122
|
+
enumValues: undefined;
|
|
123
|
+
baseColumn: never;
|
|
124
|
+
identity: undefined;
|
|
125
|
+
generated: undefined;
|
|
126
|
+
}, {}, {}>;
|
|
127
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
128
|
+
name: "updated_at";
|
|
129
|
+
tableName: "connections";
|
|
130
|
+
dataType: "date";
|
|
131
|
+
columnType: "PgTimestamp";
|
|
132
|
+
data: Date;
|
|
133
|
+
driverParam: string;
|
|
134
|
+
notNull: true;
|
|
135
|
+
hasDefault: true;
|
|
136
|
+
isPrimaryKey: false;
|
|
137
|
+
isAutoincrement: false;
|
|
138
|
+
hasRuntimeDefault: false;
|
|
139
|
+
enumValues: undefined;
|
|
140
|
+
baseColumn: never;
|
|
141
|
+
identity: undefined;
|
|
142
|
+
generated: undefined;
|
|
143
|
+
}, {}, {}>;
|
|
144
|
+
};
|
|
145
|
+
dialect: "pg";
|
|
146
|
+
}>;
|
|
147
|
+
//#endregion
|
|
148
|
+
export { connections };
|
|
149
|
+
//# sourceMappingURL=integrations.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { organizations } from "./organizations.js";
|
|
2
|
+
import { credentials } from "./credentials.js";
|
|
3
|
+
import { boolean, foreignKey, jsonb, pgTable, primaryKey, text, timestamp, unique } from "drizzle-orm/pg-core";
|
|
4
|
+
//#region src/schema/integrations.ts
|
|
5
|
+
const connections = pgTable("connections", {
|
|
6
|
+
orgId: text("org_id").notNull().references(() => organizations.id),
|
|
7
|
+
id: text("id").notNull(),
|
|
8
|
+
integrationId: text("integration_id").notNull(),
|
|
9
|
+
config: jsonb("config").$type().notNull().default({}),
|
|
10
|
+
active: boolean("active").notNull().default(true),
|
|
11
|
+
credentialRef: text("credential_ref").notNull(),
|
|
12
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
13
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
14
|
+
}, (t) => ({
|
|
15
|
+
pk: primaryKey({ columns: [t.orgId, t.id] }),
|
|
16
|
+
onePerIntegration: unique().on(t.orgId, t.integrationId),
|
|
17
|
+
credentialFk: foreignKey({
|
|
18
|
+
columns: [t.orgId, t.credentialRef],
|
|
19
|
+
foreignColumns: [credentials.orgId, credentials.id]
|
|
20
|
+
})
|
|
21
|
+
}));
|
|
22
|
+
//#endregion
|
|
23
|
+
export { connections };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=integrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrations.js","names":[],"sources":["../../src/schema/integrations.ts"],"sourcesContent":["// integrations tables — an org's connections to external services. One\n// connection per integration per org; the secret itself lives in the\n// credentials table (secure credential store), referenced by credential_ref.\nimport {\n pgTable,\n text,\n boolean,\n jsonb,\n timestamp,\n primaryKey,\n foreignKey,\n unique,\n} from 'drizzle-orm/pg-core';\nimport type { Connection } from '@headless-lms/core/schemas';\nimport { organizations } from './organizations.js';\nimport { credentials } from './credentials.js';\nimport type { Expect, NoDrift } from './drift.js';\n\nexport const connections = pgTable(\n 'connections',\n {\n orgId: text('org_id')\n .notNull()\n .references(() => organizations.id),\n id: text('id').notNull(),\n integrationId: text('integration_id').notNull(),\n config: jsonb('config').$type<Connection['config']>().notNull().default({}),\n active: boolean('active').notNull().default(true),\n credentialRef: text('credential_ref').notNull(),\n createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),\n },\n (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.id] }),\n onePerIntegration: unique().on(t.orgId, t.integrationId),\n credentialFk: foreignKey({\n columns: [t.orgId, t.credentialRef],\n foreignColumns: [credentials.orgId, credentials.id],\n }),\n }),\n);\n\ntype _ConnectionsDrift = Expect<NoDrift<typeof connections.$inferSelect, Connection>>;\n"],"mappings":";;;;AAkBA,MAAa,cAAc,QACzB,eACA;CACE,OAAO,KAAK,QAAQ,CAAC,CAClB,QAAQ,CAAC,CACT,iBAAiB,cAAc,EAAE;CACpC,IAAI,KAAK,IAAI,CAAC,CAAC,QAAQ;CACvB,eAAe,KAAK,gBAAgB,CAAC,CAAC,QAAQ;CAC9C,QAAQ,MAAM,QAAQ,CAAC,CAAC,MAA4B,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;CAC1E,QAAQ,QAAQ,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,IAAI;CAChD,eAAe,KAAK,gBAAgB,CAAC,CAAC,QAAQ;CAC9C,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW;CAChF,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW;AAClF,IACC,OAAO;CACN,IAAI,WAAW,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;CAC3C,mBAAmB,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa;CACvD,cAAc,WAAW;EACvB,SAAS,CAAC,EAAE,OAAO,EAAE,aAAa;EAClC,gBAAgB,CAAC,YAAY,OAAO,YAAY,EAAE;CACpD,CAAC;AACH,EACF"}
|