@headless-lms/adapter-db 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.
Files changed (123) hide show
  1. package/dist/client.d.ts +8 -2
  2. package/dist/client.js +10 -2
  3. package/dist/client.js.map +1 -1
  4. package/dist/index.d.ts +10 -4
  5. package/dist/index.js +9 -3
  6. package/dist/repositories/admin.d.ts +12 -4
  7. package/dist/repositories/admin.js +165 -23
  8. package/dist/repositories/admin.js.map +1 -1
  9. package/dist/repositories/assets.d.ts +2 -2
  10. package/dist/repositories/assets.js +11 -5
  11. package/dist/repositories/assets.js.map +1 -1
  12. package/dist/repositories/automations.d.ts +0 -1
  13. package/dist/repositories/automations.js +2 -18
  14. package/dist/repositories/automations.js.map +1 -1
  15. package/dist/repositories/chats.d.ts +14 -5
  16. package/dist/repositories/chats.js +194 -85
  17. package/dist/repositories/chats.js.map +1 -1
  18. package/dist/repositories/content.d.ts +24 -7
  19. package/dist/repositories/content.js +229 -48
  20. package/dist/repositories/content.js.map +1 -1
  21. package/dist/repositories/credentials.js +1 -1
  22. package/dist/repositories/devices.d.ts +17 -0
  23. package/dist/repositories/devices.js +75 -0
  24. package/dist/repositories/devices.js.map +1 -0
  25. package/dist/repositories/digest-runs.d.ts +14 -0
  26. package/dist/repositories/digest-runs.js +39 -0
  27. package/dist/repositories/digest-runs.js.map +1 -0
  28. package/dist/repositories/discussion.d.ts +7 -2
  29. package/dist/repositories/discussion.js +18 -7
  30. package/dist/repositories/discussion.js.map +1 -1
  31. package/dist/repositories/entitlements.d.ts +11 -9
  32. package/dist/repositories/entitlements.js +56 -59
  33. package/dist/repositories/entitlements.js.map +1 -1
  34. package/dist/repositories/event-reports.d.ts +16 -0
  35. package/dist/repositories/event-reports.js +199 -0
  36. package/dist/repositories/event-reports.js.map +1 -0
  37. package/dist/repositories/grant-covers.d.ts +4 -3
  38. package/dist/repositories/grant-covers.js +7 -4
  39. package/dist/repositories/grant-covers.js.map +1 -1
  40. package/dist/repositories/identity.js +1 -1
  41. package/dist/repositories/inserted-row.d.ts +5 -0
  42. package/dist/repositories/inserted-row.js +7 -0
  43. package/dist/repositories/inserted-row.js.map +1 -0
  44. package/dist/repositories/integrations.js +1 -1
  45. package/dist/repositories/member.d.ts +12 -4
  46. package/dist/repositories/member.js +19 -7
  47. package/dist/repositories/member.js.map +1 -1
  48. package/dist/repositories/members.d.ts +2 -5
  49. package/dist/repositories/members.js +39 -94
  50. package/dist/repositories/members.js.map +1 -1
  51. package/dist/repositories/mentions.d.ts +17 -0
  52. package/dist/repositories/mentions.js +55 -0
  53. package/dist/repositories/mentions.js.map +1 -0
  54. package/dist/repositories/notification-settings.d.ts +19 -0
  55. package/dist/repositories/notification-settings.js +67 -0
  56. package/dist/repositories/notification-settings.js.map +1 -0
  57. package/dist/repositories/notifications.d.ts +23 -16
  58. package/dist/repositories/notifications.js +152 -44
  59. package/dist/repositories/notifications.js.map +1 -1
  60. package/dist/repositories/org-user-profile.d.ts +0 -17
  61. package/dist/repositories/org-user-profile.js +0 -1
  62. package/dist/repositories/org-user-profile.js.map +1 -1
  63. package/dist/repositories/organizations.d.ts +4 -4
  64. package/dist/repositories/organizations.js +25 -47
  65. package/dist/repositories/organizations.js.map +1 -1
  66. package/dist/repositories/outbox.d.ts +5 -1
  67. package/dist/repositories/outbox.js +12 -3
  68. package/dist/repositories/outbox.js.map +1 -1
  69. package/dist/repositories/posts.d.ts +4 -8
  70. package/dist/repositories/posts.js +26 -29
  71. package/dist/repositories/posts.js.map +1 -1
  72. package/dist/repositories/progress.js +1 -1
  73. package/dist/repositories/roles.d.ts +35 -0
  74. package/dist/repositories/roles.js +244 -0
  75. package/dist/repositories/roles.js.map +1 -0
  76. package/dist/repositories/settings.js +1 -1
  77. package/dist/repositories/subscriptions.d.ts +18 -0
  78. package/dist/repositories/subscriptions.js +72 -0
  79. package/dist/repositories/subscriptions.js.map +1 -0
  80. package/dist/schema/assets.d.ts +17 -0
  81. package/dist/schema/assets.js +1 -0
  82. package/dist/schema/assets.js.map +1 -1
  83. package/dist/schema/automations.d.ts +524 -19
  84. package/dist/schema/automations.js +73 -7
  85. package/dist/schema/automations.js.map +1 -1
  86. package/dist/schema/content.d.ts +437 -3
  87. package/dist/schema/content.js +70 -3
  88. package/dist/schema/content.js.map +1 -1
  89. package/dist/schema/discussion.d.ts +295 -128
  90. package/dist/schema/discussion.js +63 -26
  91. package/dist/schema/discussion.js.map +1 -1
  92. package/dist/schema/identity.d.ts +109 -109
  93. package/dist/schema/identity.js +28 -70
  94. package/dist/schema/identity.js.map +1 -1
  95. package/dist/schema/index.d.ts +7 -6
  96. package/dist/schema/index.js +16 -7
  97. package/dist/schema/index.js.map +1 -1
  98. package/dist/schema/organizations.d.ts +5 -22
  99. package/dist/schema/organizations.js +1 -13
  100. package/dist/schema/organizations.js.map +1 -1
  101. package/dist/schema/roles.d.ts +369 -0
  102. package/dist/schema/roles.js +71 -0
  103. package/dist/schema/roles.js.map +1 -0
  104. package/drizzle/0011_digest_runs.sql +8 -0
  105. package/drizzle/0012_subscriptions.sql +16 -0
  106. package/drizzle/0013_mentions.sql +10 -0
  107. package/drizzle/0014_notification_settings_devices.sql +36 -0
  108. package/drizzle/0015_automations_drop_source.sql +2 -0
  109. package/drizzle/0016_notifications_automations.sql +48 -0
  110. package/drizzle/0017_configurable_roles.sql +38 -0
  111. package/drizzle/0018_messages_client_id.sql +2 -0
  112. package/drizzle/0019_events.sql +44 -0
  113. package/drizzle/meta/0011_snapshot.json +8868 -0
  114. package/drizzle/meta/0012_snapshot.json +8873 -0
  115. package/drizzle/meta/0013_snapshot.json +8943 -0
  116. package/drizzle/meta/0014_snapshot.json +9305 -0
  117. package/drizzle/meta/0015_snapshot.json +9270 -0
  118. package/drizzle/meta/0016_snapshot.json +9230 -0
  119. package/drizzle/meta/0017_snapshot.json +9518 -0
  120. package/drizzle/meta/0018_snapshot.json +9557 -0
  121. package/drizzle/meta/0019_snapshot.json +9919 -0
  122. package/drizzle/meta/_journal.json +63 -0
  123. package/package.json +2 -2
@@ -1,9 +1,8 @@
1
1
  import { assets } from "./assets.js";
2
2
  import { communities, spaces } from "./content.js";
3
- import { chats, comments, messages, posts } from "./discussion.js";
4
3
  import { orgUsers } from "./organizations.js";
5
- import { desc, sql } from "drizzle-orm";
6
- import { boolean, check, foreignKey, index, jsonb, pgTable, primaryKey, text, timestamp } from "drizzle-orm/pg-core";
4
+ import { sql } from "drizzle-orm";
5
+ import { boolean, check, foreignKey, index, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
7
6
  import { genId } from "@headless-lms/core/shared/id";
8
7
  //#region src/schema/identity.ts
9
8
  const users = pgTable("users", {
@@ -33,41 +32,16 @@ const userProfiles = pgTable("user_profiles", {
33
32
  imageCk: check("user_profiles_image_check", sql`(${t.imageAssetOrgId} is null) = (${t.imageAssetId} is null)`),
34
33
  imageIdx: index("user_profiles_image_idx").on(t.imageAssetOrgId, t.imageAssetId)
35
34
  }));
36
- const NOTIFICATION_KINDS = [
37
- "newPostInSpace",
38
- "newCommentOnPost",
39
- "replyToYourComment",
40
- "yourPostWasPublished",
41
- "yourPostWasRemoved",
42
- "yourCommentWasRemoved",
43
- "requestApproved",
44
- "requestDeclined",
45
- "invitedToSpace",
46
- "newMessage",
47
- "messageRequest",
48
- "addedToGroupChat",
49
- "youAreNowAModerator",
50
- "membershipEndingSoon",
51
- "welcomeToCommunity",
52
- "postAwaitingReview",
53
- "joinRequest",
54
- "somethingWasFlagged",
55
- "messageWasFlagged"
56
- ];
57
- const notifications = pgTable("notifications", {
35
+ const notificationSettings = pgTable("notification_settings", {
58
36
  orgId: text("org_id").notNull(),
59
- id: text("id").notNull().$defaultFn(() => genId("notification")),
37
+ id: text("id").notNull().$defaultFn(() => genId("notificationSetting")),
60
38
  userId: text("user_id").notNull(),
61
- kind: text("kind", { enum: NOTIFICATION_KINDS }).notNull(),
62
- actorOrgUserId: text("actor_org_user_id"),
63
39
  communityId: text("community_id"),
64
40
  spaceId: text("space_id"),
65
- postId: text("post_id"),
66
- commentId: text("comment_id"),
67
- chatId: text("chat_id"),
68
- messageId: text("message_id"),
69
- createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
70
- readAt: timestamp("read_at", { withTimezone: true })
41
+ category: text("category").notNull(),
42
+ channel: text("channel").notNull(),
43
+ enabled: boolean("enabled").notNull(),
44
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
71
45
  }, (t) => ({
72
46
  pk: primaryKey({ columns: [t.orgId, t.id] }),
73
47
  userFk: foreignKey({
@@ -82,51 +56,35 @@ const notifications = pgTable("notifications", {
82
56
  columns: [t.orgId, t.spaceId],
83
57
  foreignColumns: [spaces.orgId, spaces.id]
84
58
  }).onDelete("cascade"),
85
- postFk: foreignKey({
86
- columns: [t.orgId, t.postId],
87
- foreignColumns: [posts.orgId, posts.id]
88
- }).onDelete("cascade"),
89
- commentFk: foreignKey({
90
- columns: [t.orgId, t.commentId],
91
- foreignColumns: [comments.orgId, comments.id]
92
- }).onDelete("cascade"),
93
- chatFk: foreignKey({
94
- columns: [t.orgId, t.chatId],
95
- foreignColumns: [chats.orgId, chats.id]
96
- }).onDelete("cascade"),
97
- messageFk: foreignKey({
98
- columns: [t.orgId, t.messageId],
99
- foreignColumns: [messages.orgId, messages.id]
100
- }).onDelete("cascade"),
101
- listIdx: index("notifications_list_idx").on(t.orgId, t.userId, t.readAt, desc(t.createdAt)),
102
- feedIdx: index("notifications_feed_idx").on(t.orgId, t.userId, desc(t.createdAt), desc(t.id)),
103
- communityIdx: index("notifications_community_idx").on(t.orgId, t.communityId),
104
- spaceIdx: index("notifications_space_idx").on(t.orgId, t.spaceId),
105
- postIdx: index("notifications_post_idx").on(t.orgId, t.postId),
106
- commentIdx: index("notifications_comment_idx").on(t.orgId, t.commentId),
107
- chatIdx: index("notifications_chat_idx").on(t.orgId, t.chatId),
108
- messageIdx: index("notifications_message_idx").on(t.orgId, t.messageId)
59
+ settingIdx: uniqueIndex("notification_settings_setting_idx").on(t.orgId, t.userId, sql`coalesce(${t.communityId}, '')`, sql`coalesce(${t.spaceId}, '')`, t.category, t.channel),
60
+ switchedOnIdx: index("notification_settings_switched_on_idx").on(t.orgId, sql`coalesce(${t.communityId}, '')`, t.category, sql`coalesce(${t.spaceId}, '')`).where(sql`${t.enabled}`)
109
61
  }));
110
- const notificationPreferences = pgTable("notification_preferences", {
62
+ const devices = pgTable("devices", {
111
63
  orgId: text("org_id").notNull(),
64
+ id: text("id").notNull().$defaultFn(() => genId("device")),
112
65
  userId: text("user_id").notNull(),
113
- kind: text("kind", { enum: NOTIFICATION_KINDS }).notNull(),
114
- inApp: boolean("in_app").notNull(),
115
- email: boolean("email").notNull(),
66
+ provider: text("provider", { enum: [
67
+ "apns",
68
+ "fcm",
69
+ "webpush"
70
+ ] }).notNull(),
71
+ token: text("token").notNull(),
72
+ p256dh: text("p256dh"),
73
+ auth: text("auth"),
74
+ appId: text("app_id"),
75
+ environment: text("environment", { enum: ["production", "sandbox"] }),
116
76
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
117
- updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => /* @__PURE__ */ new Date())
77
+ lastSeenAt: timestamp("last_seen_at", { withTimezone: true }).notNull().defaultNow()
118
78
  }, (t) => ({
119
- pk: primaryKey({ columns: [
120
- t.orgId,
121
- t.userId,
122
- t.kind
123
- ] }),
79
+ pk: primaryKey({ columns: [t.orgId, t.id] }),
124
80
  userFk: foreignKey({
125
81
  columns: [t.orgId, t.userId],
126
82
  foreignColumns: [orgUsers.orgId, orgUsers.userId]
127
- }).onDelete("cascade")
83
+ }).onDelete("cascade"),
84
+ tokenIdx: uniqueIndex("devices_token_idx").on(t.orgId, t.provider, t.token),
85
+ userIdx: index("devices_user_idx").on(t.orgId, t.userId, t.lastSeenAt)
128
86
  }));
129
87
  //#endregion
130
- export { notificationPreferences, notifications, userProfiles, users };
88
+ export { devices, notificationSettings, userProfiles, users };
131
89
 
132
90
  //# sourceMappingURL=identity.js.map
@@ -1 +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 { desc, sql } from \"drizzle-orm\";\nimport {\n pgTable,\n text,\n jsonb,\n timestamp,\n boolean,\n foreignKey,\n check,\n index,\n primaryKey,\n} from \"drizzle-orm/pg-core\";\nimport type { Notification, User, UserProfile } from \"@headless-lms/core/schemas\";\nimport { genId } from \"@headless-lms/core/shared/id\";\nimport { assets } from \"./assets.js\";\nimport { orgUsers } from \"./organizations.js\";\nimport { communities, spaces } from \"./content.js\";\nimport { chats, comments, messages, posts } from \"./discussion.js\";\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\nexport const userProfiles = pgTable(\n \"user_profiles\",\n {\n userId: text(\"user_id\")\n .primaryKey()\n .references(() => users.id, { onDelete: \"cascade\" }),\n displayName: text(\"display_name\"),\n headline: text(\"headline\"),\n bio: text(\"bio\"),\n imageAssetOrgId: text(\"image_asset_org_id\"),\n imageAssetId: text(\"image_asset_id\"),\n extra: jsonb(\"extra\").$type<UserProfile[\"extra\"]>().notNull().default({}),\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 (t) => ({\n imageFk: foreignKey({\n columns: [t.imageAssetOrgId, t.imageAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n imageCk: check(\n \"user_profiles_image_check\",\n sql`(${t.imageAssetOrgId} is null) = (${t.imageAssetId} is null)`,\n ),\n imageIdx: index(\"user_profiles_image_idx\").on(t.imageAssetOrgId, t.imageAssetId),\n }),\n);\n\nconst NOTIFICATION_KINDS = [\n \"newPostInSpace\",\n \"newCommentOnPost\",\n \"replyToYourComment\",\n \"yourPostWasPublished\",\n \"yourPostWasRemoved\",\n \"yourCommentWasRemoved\",\n \"requestApproved\",\n \"requestDeclined\",\n \"invitedToSpace\",\n \"newMessage\",\n \"messageRequest\",\n \"addedToGroupChat\",\n \"youAreNowAModerator\",\n \"membershipEndingSoon\",\n \"welcomeToCommunity\",\n \"postAwaitingReview\",\n \"joinRequest\",\n \"somethingWasFlagged\",\n \"messageWasFlagged\",\n] as const;\n\nexport const notifications = pgTable(\n \"notifications\",\n {\n orgId: text(\"org_id\").notNull(),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"notification\")),\n userId: text(\"user_id\").notNull(),\n kind: text(\"kind\", { enum: NOTIFICATION_KINDS }).notNull(),\n actorOrgUserId: text(\"actor_org_user_id\"),\n communityId: text(\"community_id\"),\n spaceId: text(\"space_id\"),\n postId: text(\"post_id\"),\n commentId: text(\"comment_id\"),\n chatId: text(\"chat_id\"),\n messageId: text(\"message_id\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull().defaultNow(),\n readAt: timestamp(\"read_at\", { withTimezone: true }),\n },\n (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.id] }),\n userFk: foreignKey({\n columns: [t.orgId, t.userId],\n foreignColumns: [orgUsers.orgId, orgUsers.userId],\n }).onDelete(\"cascade\"),\n communityFk: foreignKey({\n columns: [t.orgId, t.communityId],\n foreignColumns: [communities.orgId, communities.id],\n }).onDelete(\"cascade\"),\n spaceFk: foreignKey({\n columns: [t.orgId, t.spaceId],\n foreignColumns: [spaces.orgId, spaces.id],\n }).onDelete(\"cascade\"),\n postFk: foreignKey({\n columns: [t.orgId, t.postId],\n foreignColumns: [posts.orgId, posts.id],\n }).onDelete(\"cascade\"),\n commentFk: foreignKey({\n columns: [t.orgId, t.commentId],\n foreignColumns: [comments.orgId, comments.id],\n }).onDelete(\"cascade\"),\n chatFk: foreignKey({\n columns: [t.orgId, t.chatId],\n foreignColumns: [chats.orgId, chats.id],\n }).onDelete(\"cascade\"),\n messageFk: foreignKey({\n columns: [t.orgId, t.messageId],\n foreignColumns: [messages.orgId, messages.id],\n }).onDelete(\"cascade\"),\n listIdx: index(\"notifications_list_idx\").on(t.orgId, t.userId, t.readAt, desc(t.createdAt)),\n feedIdx: index(\"notifications_feed_idx\").on(t.orgId, t.userId, desc(t.createdAt), desc(t.id)),\n communityIdx: index(\"notifications_community_idx\").on(t.orgId, t.communityId),\n spaceIdx: index(\"notifications_space_idx\").on(t.orgId, t.spaceId),\n postIdx: index(\"notifications_post_idx\").on(t.orgId, t.postId),\n commentIdx: index(\"notifications_comment_idx\").on(t.orgId, t.commentId),\n chatIdx: index(\"notifications_chat_idx\").on(t.orgId, t.chatId),\n messageIdx: index(\"notifications_message_idx\").on(t.orgId, t.messageId),\n }),\n);\n\nexport const notificationPreferences = pgTable(\n \"notification_preferences\",\n {\n orgId: text(\"org_id\").notNull(),\n userId: text(\"user_id\").notNull(),\n kind: text(\"kind\", { enum: NOTIFICATION_KINDS }).notNull(),\n inApp: boolean(\"in_app\").notNull(),\n email: boolean(\"email\").notNull(),\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 (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.userId, t.kind] }),\n userFk: foreignKey({\n columns: [t.orgId, t.userId],\n foreignColumns: [orgUsers.orgId, orgUsers.userId],\n }).onDelete(\"cascade\"),\n }),\n);\n\ntype _UsersDrift = Expect<NoDrift<typeof users.$inferSelect, User>>;\ntype _UserProfilesDrift = Expect<NoDrift<typeof userProfiles.$inferSelect, UserProfile>>;\ntype _NotificationsDrift = Expect<NoDrift<typeof notifications.$inferSelect, Notification>>;\n"],"mappings":";;;;;;;;AAuBA,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;AAED,MAAa,eAAe,QAC1B,iBACA;CACE,QAAQ,KAAK,SAAS,CAAC,CACpB,WAAW,CAAC,CACZ,iBAAiB,MAAM,IAAI,EAAE,UAAU,UAAU,CAAC;CACrD,aAAa,KAAK,cAAc;CAChC,UAAU,KAAK,UAAU;CACzB,KAAK,KAAK,KAAK;CACf,iBAAiB,KAAK,oBAAoB;CAC1C,cAAc,KAAK,gBAAgB;CACnC,OAAO,MAAM,OAAO,CAAC,CAAC,MAA4B,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;CACxE,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,C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S,MAAM,wBAAwB,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM;CAC7D,YAAY,MAAM,2BAA2B,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS;CACtE,SAAS,MAAM,wBAAwB,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM;CAC7D,YAAY,MAAM,2BAA2B,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS;AACxE,EACF;AAEA,MAAa,0BAA0B,QACrC,4BACA;CACE,OAAO,KAAK,QAAQ,CAAC,CAAC,QAAQ;CAC9B,QAAQ,KAAK,SAAS,CAAC,CAAC,QAAQ;CAChC,MAAM,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC,CAAC,CAAC,QAAQ;CACzD,OAAO,QAAQ,QAAQ,CAAC,CAAC,QAAQ;CACjC,OAAO,QAAQ,OAAO,CAAC,CAAC,QAAQ;CAChC,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,IACC,OAAO;CACN,IAAI,WAAW,EAAE,SAAS;EAAC,EAAE;EAAO,EAAE;EAAQ,EAAE;CAAI,EAAE,CAAC;CACvD,QAAQ,WAAW;EACjB,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM;EAC3B,gBAAgB,CAAC,SAAS,OAAO,SAAS,MAAM;CAClD,CAAC,CAAC,CAAC,SAAS,SAAS;AACvB,EACF"}
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 { sql } from \"drizzle-orm\";\nimport {\n pgTable,\n text,\n jsonb,\n timestamp,\n boolean,\n foreignKey,\n check,\n index,\n primaryKey,\n uniqueIndex,\n} from \"drizzle-orm/pg-core\";\nimport type { User, UserProfile } from \"@headless-lms/core/schemas\";\nimport { genId } from \"@headless-lms/core/shared/id\";\nimport { assets } from \"./assets.js\";\nimport { orgUsers } from \"./organizations.js\";\nimport { communities, spaces } from \"./content.js\";\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\nexport const userProfiles = pgTable(\n \"user_profiles\",\n {\n userId: text(\"user_id\")\n .primaryKey()\n .references(() => users.id, { onDelete: \"cascade\" }),\n displayName: text(\"display_name\"),\n headline: text(\"headline\"),\n bio: text(\"bio\"),\n imageAssetOrgId: text(\"image_asset_org_id\"),\n imageAssetId: text(\"image_asset_id\"),\n extra: jsonb(\"extra\").$type<UserProfile[\"extra\"]>().notNull().default({}),\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 (t) => ({\n imageFk: foreignKey({\n columns: [t.imageAssetOrgId, t.imageAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n imageCk: check(\n \"user_profiles_image_check\",\n sql`(${t.imageAssetOrgId} is null) = (${t.imageAssetId} is null)`,\n ),\n imageIdx: index(\"user_profiles_image_idx\").on(t.imageAssetOrgId, t.imageAssetId),\n }),\n);\n\nexport const notificationSettings = pgTable(\n \"notification_settings\",\n {\n orgId: text(\"org_id\").notNull(),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"notificationSetting\")),\n userId: text(\"user_id\").notNull(),\n communityId: text(\"community_id\"),\n spaceId: text(\"space_id\"),\n category: text(\"category\").notNull(),\n channel: text(\"channel\").notNull(),\n enabled: boolean(\"enabled\").notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true }).notNull().defaultNow(),\n },\n (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.id] }),\n userFk: foreignKey({\n columns: [t.orgId, t.userId],\n foreignColumns: [orgUsers.orgId, orgUsers.userId],\n }).onDelete(\"cascade\"),\n communityFk: foreignKey({\n columns: [t.orgId, t.communityId],\n foreignColumns: [communities.orgId, communities.id],\n }).onDelete(\"cascade\"),\n spaceFk: foreignKey({\n columns: [t.orgId, t.spaceId],\n foreignColumns: [spaces.orgId, spaces.id],\n }).onDelete(\"cascade\"),\n settingIdx: uniqueIndex(\"notification_settings_setting_idx\").on(\n t.orgId,\n t.userId,\n sql`coalesce(${t.communityId}, '')`,\n sql`coalesce(${t.spaceId}, '')`,\n t.category,\n t.channel,\n ),\n switchedOnIdx: index(\"notification_settings_switched_on_idx\")\n .on(t.orgId, sql`coalesce(${t.communityId}, '')`, t.category, sql`coalesce(${t.spaceId}, '')`)\n .where(sql`${t.enabled}`),\n }),\n);\n\nexport const devices = pgTable(\n \"devices\",\n {\n orgId: text(\"org_id\").notNull(),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"device\")),\n userId: text(\"user_id\").notNull(),\n provider: text(\"provider\", { enum: [\"apns\", \"fcm\", \"webpush\"] }).notNull(),\n token: text(\"token\").notNull(),\n p256dh: text(\"p256dh\"),\n auth: text(\"auth\"),\n appId: text(\"app_id\"),\n environment: text(\"environment\", { enum: [\"production\", \"sandbox\"] }),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull().defaultNow(),\n lastSeenAt: timestamp(\"last_seen_at\", { withTimezone: true }).notNull().defaultNow(),\n },\n (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.id] }),\n userFk: foreignKey({\n columns: [t.orgId, t.userId],\n foreignColumns: [orgUsers.orgId, orgUsers.userId],\n }).onDelete(\"cascade\"),\n tokenIdx: uniqueIndex(\"devices_token_idx\").on(t.orgId, t.provider, t.token),\n userIdx: index(\"devices_user_idx\").on(t.orgId, t.userId, t.lastSeenAt),\n }),\n);\n\ntype _UsersDrift = Expect<NoDrift<typeof users.$inferSelect, User>>;\ntype _UserProfilesDrift = Expect<NoDrift<typeof userProfiles.$inferSelect, UserProfile>>;\n"],"mappings":";;;;;;;AAuBA,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;AAED,MAAa,eAAe,QAC1B,iBACA;CACE,QAAQ,KAAK,SAAS,CAAC,CACpB,WAAW,CAAC,CACZ,iBAAiB,MAAM,IAAI,EAAE,UAAU,UAAU,CAAC;CACrD,aAAa,KAAK,cAAc;CAChC,UAAU,KAAK,UAAU;CACzB,KAAK,KAAK,KAAK;CACf,iBAAiB,KAAK,oBAAoB;CAC1C,cAAc,KAAK,gBAAgB;CACnC,OAAO,MAAM,OAAO,CAAC,CAAC,MAA4B,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;CACxE,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CAAC,QAAQ,CA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AO,EAAE,EAAE,EAAE,CAAC;CAC3C,QAAQ,WAAW;EACjB,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM;EAC3B,gBAAgB,CAAC,SAAS,OAAO,SAAS,MAAM;CAClD,CAAC,CAAC,CAAC,SAAS,SAAS;CACrB,UAAU,YAAY,mBAAmB,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK;CAC1E,SAAS,MAAM,kBAAkB,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU;AACvE,EACF"}
@@ -1,18 +1,19 @@
1
1
  import { invites, orgUsers, organizations } from "./organizations.js";
2
- import { activities, activityAssets, bundleItems, bundles, communities, contentItems, courses, downloadAssets, downloads, modules, spaceLinks, spaceTopics, spaces } from "./content.js";
2
+ import { activities, activityAssets, bundleItems, bundles, communities, contentItems, courses, downloadAssets, downloads, eventAssets, events, modules, spaceLinks, spaceTopics, spaces } from "./content.js";
3
3
  import { contentAccess, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, spaceMembers } from "./entitlements.js";
4
4
  import { progressRecords } from "./progress.js";
5
- import { notificationPreferences, notifications, userProfiles, users } from "./identity.js";
5
+ import { devices, notificationSettings, userProfiles, users } from "./identity.js";
6
6
  import { assets } from "./assets.js";
7
7
  import { credentials } from "./credentials.js";
8
8
  import { connections } from "./integrations.js";
9
9
  import { eventOutbox } from "./outbox.js";
10
- import { automationRuns, automations } from "./automations.js";
10
+ import { automationRuns, automations, notificationDeliveries, notifications } from "./automations.js";
11
11
  import { settings } from "./settings.js";
12
- import { blockedUsers, chatUsers, chats, commentFlags, commentReactions, comments, messageAttachments, messageFlags, messageReactions, messages, postBookmarks, postFlags, postFollows, postReactions, posts } from "./discussion.js";
12
+ import { blockedUsers, chatUsers, chats, commentFlags, commentReactions, comments, digestRuns, mentions, messageAttachments, messageFlags, messageReactions, messages, postBookmarks, postFlags, postReactions, posts, subscriptions } from "./discussion.js";
13
+ import { orgRoles, roleAssignments } from "./roles.js";
13
14
  declare namespace index_d_exports {
14
- export { activities, activityAssets, assets, automationRuns, automations, blockedUsers, bundleItems, bundles, chatUsers, chats, commentFlags, commentReactions, comments, communities, connections, contentAccess, contentItems, courses, credentials, downloadAssets, downloads, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, eventOutbox, invites, messageAttachments, messageFlags, messageReactions, messages, modules, notificationPreferences, notifications, orgUsers, organizations, postBookmarks, postFlags, postFollows, postReactions, posts, progressRecords, settings, spaceLinks, spaceMembers, spaceTopics, spaces, userProfiles, users };
15
+ export { activities, activityAssets, assets, automationRuns, automations, blockedUsers, bundleItems, bundles, chatUsers, chats, commentFlags, commentReactions, comments, communities, connections, contentAccess, contentItems, courses, credentials, devices, digestRuns, downloadAssets, downloads, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, eventAssets, eventOutbox, events, invites, mentions, messageAttachments, messageFlags, messageReactions, messages, modules, notificationDeliveries, notificationSettings, notifications, orgRoles, orgUsers, organizations, postBookmarks, postFlags, postReactions, posts, progressRecords, roleAssignments, settings, spaceLinks, spaceMembers, spaceTopics, spaces, subscriptions, userProfiles, users };
15
16
  }
16
17
  //#endregion
17
- export { activities, activityAssets, assets, automationRuns, automations, blockedUsers, bundleItems, bundles, chatUsers, chats, commentFlags, commentReactions, comments, communities, connections, contentAccess, contentItems, courses, credentials, downloadAssets, downloads, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, eventOutbox, index_d_exports, invites, messageAttachments, messageFlags, messageReactions, messages, modules, notificationPreferences, notifications, orgUsers, organizations, postBookmarks, postFlags, postFollows, postReactions, posts, progressRecords, settings, spaceLinks, spaceMembers, spaceTopics, spaces, userProfiles, users };
18
+ export { activities, activityAssets, assets, automationRuns, automations, blockedUsers, bundleItems, bundles, chatUsers, chats, commentFlags, commentReactions, comments, communities, connections, contentAccess, contentItems, courses, credentials, devices, digestRuns, downloadAssets, downloads, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, eventAssets, eventOutbox, events, index_d_exports, invites, mentions, messageAttachments, messageFlags, messageReactions, messages, modules, notificationDeliveries, notificationSettings, notifications, orgRoles, orgUsers, organizations, postBookmarks, postFlags, postReactions, posts, progressRecords, roleAssignments, settings, spaceLinks, spaceMembers, spaceTopics, spaces, subscriptions, userProfiles, users };
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1,16 +1,17 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
2
  import { assets } from "./assets.js";
3
- import { activities, activityAssets, bundleItems, bundles, communities, contentItems, courses, downloadAssets, downloads, modules, spaceLinks, spaceTopics, spaces } from "./content.js";
4
- import { blockedUsers, chatUsers, chats, commentFlags, commentReactions, comments, messageAttachments, messageFlags, messageReactions, messages, postBookmarks, postFlags, postFollows, postReactions, posts } from "./discussion.js";
5
- import { notificationPreferences, notifications, userProfiles, users } from "./identity.js";
3
+ import { activities, activityAssets, bundleItems, bundles, communities, contentItems, courses, downloadAssets, downloads, eventAssets, events, modules, spaceLinks, spaceTopics, spaces } from "./content.js";
4
+ import { devices, notificationSettings, userProfiles, users } from "./identity.js";
6
5
  import { invites, orgUsers, organizations } from "./organizations.js";
7
6
  import { contentAccess, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, spaceMembers } from "./entitlements.js";
8
7
  import { progressRecords } from "./progress.js";
9
8
  import { credentials } from "./credentials.js";
10
9
  import { connections } from "./integrations.js";
11
10
  import { eventOutbox } from "./outbox.js";
12
- import { automationRuns, automations } from "./automations.js";
11
+ import { automationRuns, automations, notificationDeliveries, notifications } from "./automations.js";
13
12
  import { settings } from "./settings.js";
13
+ import { blockedUsers, chatUsers, chats, commentFlags, commentReactions, comments, digestRuns, mentions, messageAttachments, messageFlags, messageReactions, messages, postBookmarks, postFlags, postReactions, posts, subscriptions } from "./discussion.js";
14
+ import { orgRoles, roleAssignments } from "./roles.js";
14
15
  //#region src/schema/index.ts
15
16
  var schema_exports = /* @__PURE__ */ __exportAll({
16
17
  activities: () => activities,
@@ -32,37 +33,45 @@ var schema_exports = /* @__PURE__ */ __exportAll({
32
33
  contentItems: () => contentItems,
33
34
  courses: () => courses,
34
35
  credentials: () => credentials,
36
+ devices: () => devices,
37
+ digestRuns: () => digestRuns,
35
38
  downloadAssets: () => downloadAssets,
36
39
  downloads: () => downloads,
37
40
  entitlementEndingSoonNotices: () => entitlementEndingSoonNotices,
38
41
  entitlementExpiryNotices: () => entitlementExpiryNotices,
39
42
  entitlements: () => entitlements,
43
+ eventAssets: () => eventAssets,
40
44
  eventOutbox: () => eventOutbox,
45
+ events: () => events,
41
46
  invites: () => invites,
47
+ mentions: () => mentions,
42
48
  messageAttachments: () => messageAttachments,
43
49
  messageFlags: () => messageFlags,
44
50
  messageReactions: () => messageReactions,
45
51
  messages: () => messages,
46
52
  modules: () => modules,
47
- notificationPreferences: () => notificationPreferences,
53
+ notificationDeliveries: () => notificationDeliveries,
54
+ notificationSettings: () => notificationSettings,
48
55
  notifications: () => notifications,
56
+ orgRoles: () => orgRoles,
49
57
  orgUsers: () => orgUsers,
50
58
  organizations: () => organizations,
51
59
  postBookmarks: () => postBookmarks,
52
60
  postFlags: () => postFlags,
53
- postFollows: () => postFollows,
54
61
  postReactions: () => postReactions,
55
62
  posts: () => posts,
56
63
  progressRecords: () => progressRecords,
64
+ roleAssignments: () => roleAssignments,
57
65
  settings: () => settings,
58
66
  spaceLinks: () => spaceLinks,
59
67
  spaceMembers: () => spaceMembers,
60
68
  spaceTopics: () => spaceTopics,
61
69
  spaces: () => spaces,
70
+ subscriptions: () => subscriptions,
62
71
  userProfiles: () => userProfiles,
63
72
  users: () => users
64
73
  });
65
74
  //#endregion
66
- export { activities, activityAssets, assets, automationRuns, automations, blockedUsers, bundleItems, bundles, chatUsers, chats, commentFlags, commentReactions, comments, communities, connections, contentAccess, contentItems, courses, credentials, downloadAssets, downloads, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, eventOutbox, invites, messageAttachments, messageFlags, messageReactions, messages, modules, notificationPreferences, notifications, orgUsers, organizations, postBookmarks, postFlags, postFollows, postReactions, posts, progressRecords, schema_exports, settings, spaceLinks, spaceMembers, spaceTopics, spaces, userProfiles, users };
75
+ export { activities, activityAssets, assets, automationRuns, automations, blockedUsers, bundleItems, bundles, chatUsers, chats, commentFlags, commentReactions, comments, communities, connections, contentAccess, contentItems, courses, credentials, devices, digestRuns, downloadAssets, downloads, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, eventAssets, eventOutbox, events, invites, mentions, messageAttachments, messageFlags, messageReactions, messages, modules, notificationDeliveries, notificationSettings, notifications, orgRoles, orgUsers, organizations, postBookmarks, postFlags, postReactions, posts, progressRecords, roleAssignments, schema_exports, settings, spaceLinks, spaceMembers, spaceTopics, spaces, subscriptions, userProfiles, users };
67
76
 
68
77
  //# sourceMappingURL=index.js.map
@@ -1 +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":""}
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\";\nexport * from \"./roles.js\";\n"],"mappings":""}
@@ -180,23 +180,6 @@ declare const orgUsers: import("drizzle-orm/pg-core").PgTableWithColumns<{
180
180
  identity: undefined;
181
181
  generated: undefined;
182
182
  }, {}, {}>;
183
- role: import("drizzle-orm/pg-core").PgColumn<{
184
- name: "role";
185
- tableName: "org_users";
186
- dataType: "string";
187
- columnType: "PgText";
188
- data: "student" | "owner" | "admin" | "instructor" | "moderator";
189
- driverParam: string;
190
- notNull: true;
191
- hasDefault: false;
192
- isPrimaryKey: false;
193
- isAutoincrement: false;
194
- hasRuntimeDefault: false;
195
- enumValues: ["owner", "admin", "instructor", "moderator", "student"];
196
- baseColumn: never;
197
- identity: undefined;
198
- generated: undefined;
199
- }, {}, {}>;
200
183
  status: import("drizzle-orm/pg-core").PgColumn<{
201
184
  name: "status";
202
185
  tableName: "org_users";
@@ -306,19 +289,19 @@ declare const invites: import("drizzle-orm/pg-core").PgTableWithColumns<{
306
289
  identity: undefined;
307
290
  generated: undefined;
308
291
  }, {}, {}>;
309
- role: import("drizzle-orm/pg-core").PgColumn<{
292
+ roleKey: import("drizzle-orm/pg-core").PgColumn<{
310
293
  name: "role";
311
294
  tableName: "invites";
312
295
  dataType: "string";
313
296
  columnType: "PgText";
314
- data: "student" | "admin" | "instructor" | "moderator";
297
+ data: string;
315
298
  driverParam: string;
316
299
  notNull: true;
317
- hasDefault: false;
300
+ hasDefault: true;
318
301
  isPrimaryKey: false;
319
302
  isAutoincrement: false;
320
303
  hasRuntimeDefault: false;
321
- enumValues: ["admin", "instructor", "moderator", "student"];
304
+ enumValues: [string, ...string[]];
322
305
  baseColumn: never;
323
306
  identity: undefined;
324
307
  generated: undefined;
@@ -328,7 +311,7 @@ declare const invites: import("drizzle-orm/pg-core").PgTableWithColumns<{
328
311
  tableName: "invites";
329
312
  dataType: "string";
330
313
  columnType: "PgText";
331
- data: "pending" | "accepted" | "rejected" | "canceled";
314
+ data: "pending" | "canceled" | "accepted" | "rejected";
332
315
  driverParam: string;
333
316
  notNull: true;
334
317
  hasDefault: false;
@@ -16,13 +16,6 @@ const orgUsers = pgTable("org_users", {
16
16
  orgId: text("org_id").notNull().references(() => organizations.id),
17
17
  id: text("id").notNull().$defaultFn(() => genId("orgUser")),
18
18
  userId: text("user_id").notNull().references(() => users.id),
19
- role: text("role", { enum: [
20
- "owner",
21
- "admin",
22
- "instructor",
23
- "moderator",
24
- "student"
25
- ] }).notNull(),
26
19
  status: text("status", { enum: ["invited", "active"] }).notNull().default("active"),
27
20
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
28
21
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => /* @__PURE__ */ new Date())
@@ -34,12 +27,7 @@ const invites = pgTable("invites", {
34
27
  orgId: text("org_id").notNull().references(() => organizations.id),
35
28
  id: text("id").notNull().$defaultFn(() => genId("invite")),
36
29
  email: text("email").notNull(),
37
- role: text("role", { enum: [
38
- "admin",
39
- "instructor",
40
- "moderator",
41
- "student"
42
- ] }).notNull(),
30
+ roleKey: text("role").notNull().default("member"),
43
31
  status: text("status", { enum: [
44
32
  "pending",
45
33
  "accepted",
@@ -1 +1 @@
1
- {"version":3,"file":"organizations.js","names":[],"sources":["../../src/schema/organizations.ts"],"sourcesContent":["import { sql } from \"drizzle-orm\";\nimport { pgTable, text, timestamp, primaryKey, unique, uniqueIndex } from \"drizzle-orm/pg-core\";\nimport type { Invite, Organization, OrgUser } from \"@headless-lms/core/schemas\";\nimport { genId } from \"@headless-lms/core/shared/id\";\nimport { users } from \"./identity.js\";\nimport type { Expect, NoDrift } from \"./drift.js\";\n\nexport const organizations = pgTable(\"organizations\", {\n id: text(\"id\")\n .primaryKey()\n .$defaultFn(() => genId(\"organization\")),\n // Links to the better-auth organization record.\n externalId: text(\"external_id\").unique(),\n name: text(\"name\").notNull(),\n slug: text(\"slug\").notNull().unique(),\n ownerId: text(\"owner_id\")\n .notNull()\n .references(() => users.id),\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\n// A person's link to an organization under one role\nexport const orgUsers = pgTable(\n \"org_users\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"orgUser\")),\n\n userId: text(\"user_id\")\n .notNull()\n .references(() => users.id),\n role: text(\"role\", {\n enum: [\"owner\", \"admin\", \"instructor\", \"moderator\", \"student\"],\n }).notNull(),\n // 'invited' from the moment an admin adds a student until they accept.\n // Staff rows are mirrored from an auth member record that only exists once\n // they have joined, so they are created 'active'.\n status: text(\"status\", { enum: [\"invited\", \"active\"] })\n .notNull()\n .default(\"active\"),\n\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 (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.id] }),\n userUq: unique().on(t.orgId, t.userId),\n }),\n);\n\nexport const invites = pgTable(\n \"invites\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"invite\")),\n email: text(\"email\").notNull(),\n role: text(\"role\", { enum: [\"admin\", \"instructor\", \"moderator\", \"student\"] }).notNull(),\n status: text(\"status\", {\n enum: [\"pending\", \"accepted\", \"rejected\", \"canceled\"],\n }).notNull(),\n invitedBy: text(\"invited_by\")\n .notNull()\n .references(() => users.id),\n tokenHash: text(\"token_hash\").unique(),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }),\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 (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.id] }),\n // One pending invite per (org, email) — the upsert's conflict target.\n pendingEmailUq: uniqueIndex(\"invites_pending_email_uq\")\n .on(t.orgId, t.email)\n .where(sql`${t.status} = 'pending'`),\n }),\n);\n\ntype _OrganizationsDrift = Expect<NoDrift<typeof organizations.$inferSelect, Organization>>;\ntype _OrgUsersDrift = Expect<NoDrift<typeof orgUsers.$inferSelect, OrgUser>>;\ntype _InvitesDrift = Expect<NoDrift<typeof invites.$inferSelect, Invite>>;\n"],"mappings":";;;;;AAOA,MAAa,gBAAgB,QAAQ,iBAAiB;CACpD,IAAI,KAAK,IAAI,CAAC,CACX,WAAW,CAAC,CACZ,iBAAiB,MAAM,cAAc,CAAC;CAEzC,YAAY,KAAK,aAAa,CAAC,CAAC,OAAO;CACvC,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO;CACpC,SAAS,KAAK,UAAU,CAAC,CACtB,QAAQ,CAAC,CACT,iBAAiB,MAAM,EAAE;CAC5B,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;AAGD,MAAa,WAAW,QACtB,aACA;CACE,OAAO,KAAK,QAAQ,CAAC,CAClB,QAAQ,CAAC,CACT,iBAAiB,cAAc,EAAE;CACpC,IAAI,KAAK,IAAI,CAAC,CACX,QAAQ,CAAC,CACT,iBAAiB,MAAM,SAAS,CAAC;CAEpC,QAAQ,KAAK,SAAS,CAAC,CACpB,QAAQ,CAAC,CACT,iBAAiB,MAAM,EAAE;CAC5B,MAAM,KAAK,QAAQ,EACjB,MAAM;EAAC;EAAS;EAAS;E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Ac,EAAE,cAAc,KAAK,CAAC,CAAC,CACvD,QAAQ,CAAC,CACT,WAAW,CAAC,CACZ,gCAAgB,IAAI,KAAK,CAAC;AAC/B,IACC,OAAO;CACN,IAAI,WAAW,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;CAE3C,gBAAgB,YAAY,0BAA0B,CAAC,CACpD,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CACpB,MAAM,GAAG,GAAG,EAAE,OAAO,aAAa;AACvC,EACF"}
1
+ {"version":3,"file":"organizations.js","names":[],"sources":["../../src/schema/organizations.ts"],"sourcesContent":["import { sql } from \"drizzle-orm\";\nimport { pgTable, text, timestamp, primaryKey, unique, uniqueIndex } from \"drizzle-orm/pg-core\";\nimport type { Invite, Organization, OrgUser } from \"@headless-lms/core/schemas\";\nimport { genId } from \"@headless-lms/core/shared/id\";\nimport { users } from \"./identity.js\";\nimport type { Expect, NoDrift } from \"./drift.js\";\n\nexport const organizations = pgTable(\"organizations\", {\n id: text(\"id\")\n .primaryKey()\n .$defaultFn(() => genId(\"organization\")),\n // Links to the better-auth organization record.\n externalId: text(\"external_id\").unique(),\n name: text(\"name\").notNull(),\n slug: text(\"slug\").notNull().unique(),\n ownerId: text(\"owner_id\")\n .notNull()\n .references(() => users.id),\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\n// A person's link to an organization\nexport const orgUsers = pgTable(\n \"org_users\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"orgUser\")),\n\n userId: text(\"user_id\")\n .notNull()\n .references(() => users.id),\n // 'invited' from the moment a person is invited until they accept.\n status: text(\"status\", { enum: [\"invited\", \"active\"] })\n .notNull()\n .default(\"active\"),\n\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 (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.id] }),\n userUq: unique().on(t.orgId, t.userId),\n }),\n);\n\nexport const invites = pgTable(\n \"invites\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"invite\")),\n email: text(\"email\").notNull(),\n roleKey: text(\"role\").notNull().default(\"member\"),\n status: text(\"status\", {\n enum: [\"pending\", \"accepted\", \"rejected\", \"canceled\"],\n }).notNull(),\n invitedBy: text(\"invited_by\")\n .notNull()\n .references(() => users.id),\n tokenHash: text(\"token_hash\").unique(),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }),\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 (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.id] }),\n // One pending invite per (org, email) — the upsert's conflict target.\n pendingEmailUq: uniqueIndex(\"invites_pending_email_uq\")\n .on(t.orgId, t.email)\n .where(sql`${t.status} = 'pending'`),\n }),\n);\n\ntype _OrganizationsDrift = Expect<NoDrift<typeof organizations.$inferSelect, Organization>>;\ntype _OrgUsersDrift = Expect<NoDrift<typeof orgUsers.$inferSelect, OrgUser>>;\ntype _InvitesDrift = Expect<NoDrift<typeof invites.$inferSelect, Invite>>;\n"],"mappings":";;;;;AAOA,MAAa,gBAAgB,QAAQ,iBAAiB;CACpD,IAAI,KAAK,IAAI,CAAC,CACX,WAAW,CAAC,CACZ,iBAAiB,MAAM,cAAc,CAAC;CAEzC,YAAY,KAAK,aAAa,CAAC,CAAC,OAAO;CACvC,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,MAAM,KAAK,MAAM,CAAC,CAA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