@headless-lms/adapter-db 0.2.0 → 0.4.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 (134) hide show
  1. package/dist/index.d.ts +12 -6
  2. package/dist/index.js +12 -6
  3. package/dist/repositories/admin.d.ts +23 -0
  4. package/dist/repositories/admin.js +393 -0
  5. package/dist/repositories/admin.js.map +1 -0
  6. package/dist/repositories/assets.d.ts +6 -3
  7. package/dist/repositories/assets.js +46 -9
  8. package/dist/repositories/assets.js.map +1 -1
  9. package/dist/repositories/automations.d.ts +5 -2
  10. package/dist/repositories/automations.js +29 -2
  11. package/dist/repositories/automations.js.map +1 -1
  12. package/dist/repositories/chats.d.ts +55 -0
  13. package/dist/repositories/chats.js +469 -0
  14. package/dist/repositories/chats.js.map +1 -0
  15. package/dist/repositories/content.d.ts +24 -1
  16. package/dist/repositories/content.js +316 -9
  17. package/dist/repositories/content.js.map +1 -1
  18. package/dist/repositories/devices.d.ts +17 -0
  19. package/dist/repositories/devices.js +75 -0
  20. package/dist/repositories/devices.js.map +1 -0
  21. package/dist/repositories/digest-runs.d.ts +14 -0
  22. package/dist/repositories/digest-runs.js +39 -0
  23. package/dist/repositories/digest-runs.js.map +1 -0
  24. package/dist/repositories/discussion.d.ts +16 -4
  25. package/dist/repositories/discussion.js +78 -18
  26. package/dist/repositories/discussion.js.map +1 -1
  27. package/dist/repositories/entitlements.d.ts +31 -9
  28. package/dist/repositories/entitlements.js +213 -17
  29. package/dist/repositories/entitlements.js.map +1 -1
  30. package/dist/repositories/grant-covers.d.ts +20 -0
  31. package/dist/repositories/grant-covers.js +55 -0
  32. package/dist/repositories/grant-covers.js.map +1 -0
  33. package/dist/repositories/identity.d.ts +4 -2
  34. package/dist/repositories/identity.js +32 -1
  35. package/dist/repositories/identity.js.map +1 -1
  36. package/dist/repositories/inserted-row.d.ts +5 -0
  37. package/dist/repositories/inserted-row.js +7 -0
  38. package/dist/repositories/inserted-row.js.map +1 -0
  39. package/dist/repositories/member.d.ts +16 -0
  40. package/dist/repositories/member.js +63 -0
  41. package/dist/repositories/member.js.map +1 -0
  42. package/dist/repositories/members.js +2 -2
  43. package/dist/repositories/members.js.map +1 -1
  44. package/dist/repositories/mentions.d.ts +17 -0
  45. package/dist/repositories/mentions.js +55 -0
  46. package/dist/repositories/mentions.js.map +1 -0
  47. package/dist/repositories/notification-settings.d.ts +19 -0
  48. package/dist/repositories/notification-settings.js +67 -0
  49. package/dist/repositories/notification-settings.js.map +1 -0
  50. package/dist/repositories/notifications.d.ts +30 -0
  51. package/dist/repositories/notifications.js +178 -0
  52. package/dist/repositories/notifications.js.map +1 -0
  53. package/dist/repositories/org-user-profile.d.ts +214 -1
  54. package/dist/repositories/org-user-profile.js +23 -2
  55. package/dist/repositories/org-user-profile.js.map +1 -1
  56. package/dist/repositories/organizations.d.ts +4 -2
  57. package/dist/repositories/organizations.js +23 -8
  58. package/dist/repositories/organizations.js.map +1 -1
  59. package/dist/repositories/pg-errors.js +3 -1
  60. package/dist/repositories/pg-errors.js.map +1 -1
  61. package/dist/repositories/posts.d.ts +35 -0
  62. package/dist/repositories/posts.js +252 -0
  63. package/dist/repositories/posts.js.map +1 -0
  64. package/dist/repositories/subscriptions.d.ts +18 -0
  65. package/dist/repositories/subscriptions.js +72 -0
  66. package/dist/repositories/subscriptions.js.map +1 -0
  67. package/dist/schema/assets.d.ts +19 -2
  68. package/dist/schema/assets.js +10 -4
  69. package/dist/schema/assets.js.map +1 -1
  70. package/dist/schema/automations.d.ts +545 -2
  71. package/dist/schema/automations.js +73 -3
  72. package/dist/schema/automations.js.map +1 -1
  73. package/dist/schema/better-auth.d.ts +1613 -238
  74. package/dist/schema/better-auth.js +107 -22
  75. package/dist/schema/better-auth.js.map +1 -1
  76. package/dist/schema/content.d.ts +642 -5
  77. package/dist/schema/content.js +119 -10
  78. package/dist/schema/content.js.map +1 -1
  79. package/dist/schema/discussion.d.ts +2182 -42
  80. package/dist/schema/discussion.js +461 -11
  81. package/dist/schema/discussion.js.map +1 -1
  82. package/dist/schema/entitlements.d.ts +432 -1
  83. package/dist/schema/entitlements.js +109 -4
  84. package/dist/schema/entitlements.js.map +1 -1
  85. package/dist/schema/identity.d.ts +517 -1
  86. package/dist/schema/identity.js +76 -2
  87. package/dist/schema/identity.js.map +1 -1
  88. package/dist/schema/index.d.ts +7 -7
  89. package/dist/schema/index.js +35 -8
  90. package/dist/schema/organizations.d.ts +4 -4
  91. package/dist/schema/organizations.js +2 -0
  92. package/dist/schema/organizations.js.map +1 -1
  93. package/drizzle/0003_community.sql +340 -0
  94. package/drizzle/0004_assets_sources.sql +1 -0
  95. package/drizzle/0005_notices_and_seed_index.sql +12 -0
  96. package/drizzle/0006_community_review_fixes.sql +24 -0
  97. package/drizzle/0007_notifications.sql +37 -0
  98. package/drizzle/0008_content_access.sql +13 -0
  99. package/drizzle/0009_community_indexes.sql +56 -0
  100. package/drizzle/0010_mcp_access.sql +114 -0
  101. package/drizzle/0011_digest_runs.sql +8 -0
  102. package/drizzle/0012_subscriptions.sql +16 -0
  103. package/drizzle/0013_mentions.sql +10 -0
  104. package/drizzle/0014_notification_settings_devices.sql +36 -0
  105. package/drizzle/0015_automations_drop_source.sql +2 -0
  106. package/drizzle/0016_notifications_automations.sql +48 -0
  107. package/drizzle/meta/0003_snapshot.json +7061 -0
  108. package/drizzle/meta/0004_snapshot.json +7068 -0
  109. package/drizzle/meta/0005_snapshot.json +7180 -0
  110. package/drizzle/meta/0006_snapshot.json +7298 -0
  111. package/drizzle/meta/0007_snapshot.json +7620 -0
  112. package/drizzle/meta/0008_snapshot.json +7666 -0
  113. package/drizzle/meta/0009_snapshot.json +8185 -0
  114. package/drizzle/meta/0010_snapshot.json +8813 -0
  115. package/drizzle/meta/0011_snapshot.json +8868 -0
  116. package/drizzle/meta/0012_snapshot.json +8873 -0
  117. package/drizzle/meta/0013_snapshot.json +8943 -0
  118. package/drizzle/meta/0014_snapshot.json +9305 -0
  119. package/drizzle/meta/0015_snapshot.json +9270 -0
  120. package/drizzle/meta/0016_snapshot.json +9230 -0
  121. package/drizzle/meta/_journal.json +99 -1
  122. package/package.json +2 -2
  123. package/dist/repositories/course-analytics.d.ts +0 -15
  124. package/dist/repositories/course-analytics.js +0 -137
  125. package/dist/repositories/course-analytics.js.map +0 -1
  126. package/dist/repositories/dashboard.d.ts +0 -14
  127. package/dist/repositories/dashboard.js +0 -57
  128. package/dist/repositories/dashboard.js.map +0 -1
  129. package/dist/repositories/learn.d.ts +0 -19
  130. package/dist/repositories/learn.js +0 -56
  131. package/dist/repositories/learn.js.map +0 -1
  132. package/dist/repositories/students.d.ts +0 -16
  133. package/dist/repositories/students.js +0 -160
  134. package/dist/repositories/students.js.map +0 -1
@@ -193,6 +193,437 @@ declare const entitlements: import("drizzle-orm/pg-core").PgTableWithColumns<{
193
193
  };
194
194
  dialect: "pg";
195
195
  }>;
196
+ declare const spaceMembers: import("drizzle-orm/pg-core").PgTableWithColumns<{
197
+ name: "space_members";
198
+ schema: undefined;
199
+ columns: {
200
+ orgId: import("drizzle-orm/pg-core").PgColumn<{
201
+ name: "org_id";
202
+ tableName: "space_members";
203
+ dataType: "string";
204
+ columnType: "PgText";
205
+ data: string;
206
+ driverParam: string;
207
+ notNull: true;
208
+ hasDefault: false;
209
+ isPrimaryKey: false;
210
+ isAutoincrement: false;
211
+ hasRuntimeDefault: false;
212
+ enumValues: [string, ...string[]];
213
+ baseColumn: never;
214
+ identity: undefined;
215
+ generated: undefined;
216
+ }, {}, {}>;
217
+ id: import("drizzle-orm/pg-core").PgColumn<{
218
+ name: "id";
219
+ tableName: "space_members";
220
+ dataType: "string";
221
+ columnType: "PgText";
222
+ data: string;
223
+ driverParam: string;
224
+ notNull: true;
225
+ hasDefault: true;
226
+ isPrimaryKey: false;
227
+ isAutoincrement: false;
228
+ hasRuntimeDefault: true;
229
+ enumValues: [string, ...string[]];
230
+ baseColumn: never;
231
+ identity: undefined;
232
+ generated: undefined;
233
+ }, {}, {}>;
234
+ communityId: import("drizzle-orm/pg-core").PgColumn<{
235
+ name: "community_id";
236
+ tableName: "space_members";
237
+ dataType: "string";
238
+ columnType: "PgText";
239
+ data: string;
240
+ driverParam: string;
241
+ notNull: true;
242
+ hasDefault: false;
243
+ isPrimaryKey: false;
244
+ isAutoincrement: false;
245
+ hasRuntimeDefault: false;
246
+ enumValues: [string, ...string[]];
247
+ baseColumn: never;
248
+ identity: undefined;
249
+ generated: undefined;
250
+ }, {}, {}>;
251
+ spaceId: import("drizzle-orm/pg-core").PgColumn<{
252
+ name: "space_id";
253
+ tableName: "space_members";
254
+ dataType: "string";
255
+ columnType: "PgText";
256
+ data: string;
257
+ driverParam: string;
258
+ notNull: true;
259
+ hasDefault: false;
260
+ isPrimaryKey: false;
261
+ isAutoincrement: false;
262
+ hasRuntimeDefault: false;
263
+ enumValues: [string, ...string[]];
264
+ baseColumn: never;
265
+ identity: undefined;
266
+ generated: undefined;
267
+ }, {}, {}>;
268
+ orgUserId: import("drizzle-orm/pg-core").PgColumn<{
269
+ name: "org_user_id";
270
+ tableName: "space_members";
271
+ dataType: "string";
272
+ columnType: "PgText";
273
+ data: string;
274
+ driverParam: string;
275
+ notNull: true;
276
+ hasDefault: false;
277
+ isPrimaryKey: false;
278
+ isAutoincrement: false;
279
+ hasRuntimeDefault: false;
280
+ enumValues: [string, ...string[]];
281
+ baseColumn: never;
282
+ identity: undefined;
283
+ generated: undefined;
284
+ }, {}, {}>;
285
+ status: import("drizzle-orm/pg-core").PgColumn<{
286
+ name: "status";
287
+ tableName: "space_members";
288
+ dataType: "string";
289
+ columnType: "PgText";
290
+ data: "invited" | "active" | "revoked" | "requested";
291
+ driverParam: string;
292
+ notNull: true;
293
+ hasDefault: false;
294
+ isPrimaryKey: false;
295
+ isAutoincrement: false;
296
+ hasRuntimeDefault: false;
297
+ enumValues: ["requested", "invited", "active", "revoked"];
298
+ baseColumn: never;
299
+ identity: undefined;
300
+ generated: undefined;
301
+ }, {}, {}>;
302
+ source: import("drizzle-orm/pg-core").PgColumn<{
303
+ name: "source";
304
+ tableName: "space_members";
305
+ dataType: "string";
306
+ columnType: "PgText";
307
+ data: "invite" | "manual" | "request";
308
+ driverParam: string;
309
+ notNull: true;
310
+ hasDefault: true;
311
+ isPrimaryKey: false;
312
+ isAutoincrement: false;
313
+ hasRuntimeDefault: false;
314
+ enumValues: ["request", "invite", "manual"];
315
+ baseColumn: never;
316
+ identity: undefined;
317
+ generated: undefined;
318
+ }, {}, {}>;
319
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
320
+ name: "created_at";
321
+ tableName: "space_members";
322
+ dataType: "date";
323
+ columnType: "PgTimestamp";
324
+ data: Date;
325
+ driverParam: string;
326
+ notNull: true;
327
+ hasDefault: true;
328
+ isPrimaryKey: false;
329
+ isAutoincrement: false;
330
+ hasRuntimeDefault: false;
331
+ enumValues: undefined;
332
+ baseColumn: never;
333
+ identity: undefined;
334
+ generated: undefined;
335
+ }, {}, {}>;
336
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
337
+ name: "updated_at";
338
+ tableName: "space_members";
339
+ dataType: "date";
340
+ columnType: "PgTimestamp";
341
+ data: Date;
342
+ driverParam: string;
343
+ notNull: true;
344
+ hasDefault: true;
345
+ isPrimaryKey: false;
346
+ isAutoincrement: false;
347
+ hasRuntimeDefault: false;
348
+ enumValues: undefined;
349
+ baseColumn: never;
350
+ identity: undefined;
351
+ generated: undefined;
352
+ }, {}, {}>;
353
+ };
354
+ dialect: "pg";
355
+ }>;
356
+ declare const entitlementExpiryNotices: import("drizzle-orm/pg-core").PgTableWithColumns<{
357
+ name: "entitlement_expiry_notices";
358
+ schema: undefined;
359
+ columns: {
360
+ orgId: import("drizzle-orm/pg-core").PgColumn<{
361
+ name: "org_id";
362
+ tableName: "entitlement_expiry_notices";
363
+ dataType: "string";
364
+ columnType: "PgText";
365
+ data: string;
366
+ driverParam: string;
367
+ notNull: true;
368
+ hasDefault: false;
369
+ isPrimaryKey: false;
370
+ isAutoincrement: false;
371
+ hasRuntimeDefault: false;
372
+ enumValues: [string, ...string[]];
373
+ baseColumn: never;
374
+ identity: undefined;
375
+ generated: undefined;
376
+ }, {}, {}>;
377
+ entitlementId: import("drizzle-orm/pg-core").PgColumn<{
378
+ name: "entitlement_id";
379
+ tableName: "entitlement_expiry_notices";
380
+ dataType: "string";
381
+ columnType: "PgText";
382
+ data: string;
383
+ driverParam: string;
384
+ notNull: true;
385
+ hasDefault: false;
386
+ isPrimaryKey: false;
387
+ isAutoincrement: false;
388
+ hasRuntimeDefault: false;
389
+ enumValues: [string, ...string[]];
390
+ baseColumn: never;
391
+ identity: undefined;
392
+ generated: undefined;
393
+ }, {}, {}>;
394
+ expiresAt: import("drizzle-orm/pg-core").PgColumn<{
395
+ name: "expires_at";
396
+ tableName: "entitlement_expiry_notices";
397
+ dataType: "date";
398
+ columnType: "PgTimestamp";
399
+ data: Date;
400
+ driverParam: string;
401
+ notNull: true;
402
+ hasDefault: false;
403
+ isPrimaryKey: false;
404
+ isAutoincrement: false;
405
+ hasRuntimeDefault: false;
406
+ enumValues: undefined;
407
+ baseColumn: never;
408
+ identity: undefined;
409
+ generated: undefined;
410
+ }, {}, {}>;
411
+ notifiedAt: import("drizzle-orm/pg-core").PgColumn<{
412
+ name: "notified_at";
413
+ tableName: "entitlement_expiry_notices";
414
+ dataType: "date";
415
+ columnType: "PgTimestamp";
416
+ data: Date;
417
+ driverParam: string;
418
+ notNull: true;
419
+ hasDefault: true;
420
+ isPrimaryKey: false;
421
+ isAutoincrement: false;
422
+ hasRuntimeDefault: false;
423
+ enumValues: undefined;
424
+ baseColumn: never;
425
+ identity: undefined;
426
+ generated: undefined;
427
+ }, {}, {}>;
428
+ };
429
+ dialect: "pg";
430
+ }>;
431
+ declare const entitlementEndingSoonNotices: import("drizzle-orm/pg-core").PgTableWithColumns<{
432
+ name: "entitlement_ending_soon_notices";
433
+ schema: undefined;
434
+ columns: {
435
+ orgId: import("drizzle-orm/pg-core").PgColumn<{
436
+ name: "org_id";
437
+ tableName: "entitlement_ending_soon_notices";
438
+ dataType: "string";
439
+ columnType: "PgText";
440
+ data: string;
441
+ driverParam: string;
442
+ notNull: true;
443
+ hasDefault: false;
444
+ isPrimaryKey: false;
445
+ isAutoincrement: false;
446
+ hasRuntimeDefault: false;
447
+ enumValues: [string, ...string[]];
448
+ baseColumn: never;
449
+ identity: undefined;
450
+ generated: undefined;
451
+ }, {}, {}>;
452
+ entitlementId: import("drizzle-orm/pg-core").PgColumn<{
453
+ name: "entitlement_id";
454
+ tableName: "entitlement_ending_soon_notices";
455
+ dataType: "string";
456
+ columnType: "PgText";
457
+ data: string;
458
+ driverParam: string;
459
+ notNull: true;
460
+ hasDefault: false;
461
+ isPrimaryKey: false;
462
+ isAutoincrement: false;
463
+ hasRuntimeDefault: false;
464
+ enumValues: [string, ...string[]];
465
+ baseColumn: never;
466
+ identity: undefined;
467
+ generated: undefined;
468
+ }, {}, {}>;
469
+ communityId: import("drizzle-orm/pg-core").PgColumn<{
470
+ name: "community_id";
471
+ tableName: "entitlement_ending_soon_notices";
472
+ dataType: "string";
473
+ columnType: "PgText";
474
+ data: string;
475
+ driverParam: string;
476
+ notNull: true;
477
+ hasDefault: false;
478
+ isPrimaryKey: false;
479
+ isAutoincrement: false;
480
+ hasRuntimeDefault: false;
481
+ enumValues: [string, ...string[]];
482
+ baseColumn: never;
483
+ identity: undefined;
484
+ generated: undefined;
485
+ }, {}, {}>;
486
+ expiresAt: import("drizzle-orm/pg-core").PgColumn<{
487
+ name: "expires_at";
488
+ tableName: "entitlement_ending_soon_notices";
489
+ dataType: "date";
490
+ columnType: "PgTimestamp";
491
+ data: Date;
492
+ driverParam: string;
493
+ notNull: true;
494
+ hasDefault: false;
495
+ isPrimaryKey: false;
496
+ isAutoincrement: false;
497
+ hasRuntimeDefault: false;
498
+ enumValues: undefined;
499
+ baseColumn: never;
500
+ identity: undefined;
501
+ generated: undefined;
502
+ }, {}, {}>;
503
+ notifiedAt: import("drizzle-orm/pg-core").PgColumn<{
504
+ name: "notified_at";
505
+ tableName: "entitlement_ending_soon_notices";
506
+ dataType: "date";
507
+ columnType: "PgTimestamp";
508
+ data: Date;
509
+ driverParam: string;
510
+ notNull: true;
511
+ hasDefault: true;
512
+ isPrimaryKey: false;
513
+ isAutoincrement: false;
514
+ hasRuntimeDefault: false;
515
+ enumValues: undefined;
516
+ baseColumn: never;
517
+ identity: undefined;
518
+ generated: undefined;
519
+ }, {}, {}>;
520
+ };
521
+ dialect: "pg";
522
+ }>;
523
+ declare const contentAccess: import("drizzle-orm/pg-core").PgViewWithSelection<"content_access", false, {
524
+ orgId: import("drizzle-orm/pg-core").PgColumn<{
525
+ name: "org_id";
526
+ tableName: "content_access";
527
+ dataType: "string";
528
+ columnType: "PgText";
529
+ data: string;
530
+ driverParam: string;
531
+ notNull: true;
532
+ hasDefault: false;
533
+ isPrimaryKey: false;
534
+ isAutoincrement: false;
535
+ hasRuntimeDefault: false;
536
+ enumValues: [string, ...string[]];
537
+ baseColumn: never;
538
+ identity: undefined;
539
+ generated: undefined;
540
+ }, {}, {}>;
541
+ orgUserId: import("drizzle-orm/pg-core").PgColumn<{
542
+ name: "org_user_id";
543
+ tableName: "content_access";
544
+ dataType: "string";
545
+ columnType: "PgText";
546
+ data: string;
547
+ driverParam: string;
548
+ notNull: true;
549
+ hasDefault: false;
550
+ isPrimaryKey: false;
551
+ isAutoincrement: false;
552
+ hasRuntimeDefault: false;
553
+ enumValues: [string, ...string[]];
554
+ baseColumn: never;
555
+ identity: undefined;
556
+ generated: undefined;
557
+ }, {}, {}>;
558
+ contentId: import("drizzle-orm/pg-core").PgColumn<{
559
+ name: "content_id";
560
+ tableName: "content_access";
561
+ dataType: "string";
562
+ columnType: "PgText";
563
+ data: string;
564
+ driverParam: string;
565
+ notNull: true;
566
+ hasDefault: false;
567
+ isPrimaryKey: false;
568
+ isAutoincrement: false;
569
+ hasRuntimeDefault: false;
570
+ enumValues: [string, ...string[]];
571
+ baseColumn: never;
572
+ identity: undefined;
573
+ generated: undefined;
574
+ }, {}, {}>;
575
+ entitlementId: import("drizzle-orm/pg-core").PgColumn<{
576
+ name: "entitlement_id";
577
+ tableName: "content_access";
578
+ dataType: "string";
579
+ columnType: "PgText";
580
+ data: string;
581
+ driverParam: string;
582
+ notNull: true;
583
+ hasDefault: false;
584
+ isPrimaryKey: false;
585
+ isAutoincrement: false;
586
+ hasRuntimeDefault: false;
587
+ enumValues: [string, ...string[]];
588
+ baseColumn: never;
589
+ identity: undefined;
590
+ generated: undefined;
591
+ }, {}, {}>;
592
+ grantedAt: import("drizzle-orm/pg-core").PgColumn<{
593
+ name: "granted_at";
594
+ tableName: "content_access";
595
+ dataType: "date";
596
+ columnType: "PgTimestamp";
597
+ data: Date;
598
+ driverParam: string;
599
+ notNull: true;
600
+ hasDefault: false;
601
+ isPrimaryKey: false;
602
+ isAutoincrement: false;
603
+ hasRuntimeDefault: false;
604
+ enumValues: undefined;
605
+ baseColumn: never;
606
+ identity: undefined;
607
+ generated: undefined;
608
+ }, {}, {}>;
609
+ expiresAt: import("drizzle-orm/pg-core").PgColumn<{
610
+ name: "expires_at";
611
+ tableName: "content_access";
612
+ dataType: "date";
613
+ columnType: "PgTimestamp";
614
+ data: Date;
615
+ driverParam: string;
616
+ notNull: false;
617
+ hasDefault: false;
618
+ isPrimaryKey: false;
619
+ isAutoincrement: false;
620
+ hasRuntimeDefault: false;
621
+ enumValues: undefined;
622
+ baseColumn: never;
623
+ identity: undefined;
624
+ generated: undefined;
625
+ }, {}, {}>;
626
+ }>;
196
627
  //#endregion
197
- export { entitlements };
628
+ export { contentAccess, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, spaceMembers };
198
629
  //# sourceMappingURL=entitlements.d.ts.map
@@ -1,7 +1,7 @@
1
+ import { bundles, communities, contentItems, spaces } from "./content.js";
1
2
  import { orgUsers, organizations } from "./organizations.js";
2
- import { bundles, contentItems } from "./content.js";
3
3
  import { sql } from "drizzle-orm";
4
- import { check, foreignKey, pgTable, primaryKey, text, timestamp, unique } from "drizzle-orm/pg-core";
4
+ import { check, foreignKey, index, pgTable, pgView, primaryKey, text, timestamp, unique } from "drizzle-orm/pg-core";
5
5
  import { genId } from "@headless-lms/core/shared/id";
6
6
  //#region src/schema/entitlements.ts
7
7
  const entitlements = pgTable("entitlements", {
@@ -32,9 +32,114 @@ const entitlements = pgTable("entitlements", {
32
32
  }).onDelete("cascade"),
33
33
  orgUserContentUq: unique().on(t.orgId, t.orgUserId, t.contentId),
34
34
  orgUserBundleUq: unique().on(t.orgId, t.orgUserId, t.bundleId),
35
- targetCk: check("entitlements_target_check", sql`num_nonnulls(${t.bundleId}, ${t.contentId}) = 1`)
35
+ targetCk: check("entitlements_target_check", sql`num_nonnulls(${t.bundleId}, ${t.contentId}) = 1`),
36
+ contentIdx: index("entitlements_content_idx").on(t.orgId, t.contentId),
37
+ bundleIdx: index("entitlements_bundle_idx").on(t.orgId, t.bundleId)
36
38
  }));
39
+ const spaceMembers = pgTable("space_members", {
40
+ orgId: text("org_id").notNull().references(() => organizations.id),
41
+ id: text("id").notNull().$defaultFn(() => genId("spaceMember")),
42
+ communityId: text("community_id").notNull(),
43
+ spaceId: text("space_id").notNull(),
44
+ orgUserId: text("org_user_id").notNull(),
45
+ status: text("status", { enum: [
46
+ "requested",
47
+ "invited",
48
+ "active",
49
+ "revoked"
50
+ ] }).notNull(),
51
+ source: text("source", { enum: [
52
+ "request",
53
+ "invite",
54
+ "manual"
55
+ ] }).notNull().default("request"),
56
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
57
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => /* @__PURE__ */ new Date())
58
+ }, (t) => ({
59
+ pk: primaryKey({ columns: [t.orgId, t.id] }),
60
+ memberUq: unique().on(t.orgId, t.spaceId, t.orgUserId),
61
+ communityFk: foreignKey({
62
+ columns: [t.orgId, t.communityId],
63
+ foreignColumns: [communities.orgId, communities.id]
64
+ }).onDelete("cascade"),
65
+ spaceFk: foreignKey({
66
+ columns: [
67
+ t.orgId,
68
+ t.spaceId,
69
+ t.communityId
70
+ ],
71
+ foreignColumns: [
72
+ spaces.orgId,
73
+ spaces.id,
74
+ spaces.communityId
75
+ ]
76
+ }).onDelete("cascade"),
77
+ orgUserFk: foreignKey({
78
+ columns: [t.orgId, t.orgUserId],
79
+ foreignColumns: [orgUsers.orgId, orgUsers.id]
80
+ }).onDelete("cascade"),
81
+ spaceIdx: index("space_members_space_idx").on(t.orgId, t.spaceId, t.status),
82
+ communityIdx: index("space_members_community_idx").on(t.orgId, t.communityId)
83
+ }));
84
+ const entitlementExpiryNotices = pgTable("entitlement_expiry_notices", {
85
+ orgId: text("org_id").notNull().references(() => organizations.id),
86
+ entitlementId: text("entitlement_id").notNull(),
87
+ expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
88
+ notifiedAt: timestamp("notified_at", { withTimezone: true }).notNull().defaultNow()
89
+ }, (t) => ({
90
+ pk: primaryKey({ columns: [
91
+ t.orgId,
92
+ t.entitlementId,
93
+ t.expiresAt
94
+ ] }),
95
+ entitlementFk: foreignKey({
96
+ columns: [t.orgId, t.entitlementId],
97
+ foreignColumns: [entitlements.orgId, entitlements.id]
98
+ }).onDelete("cascade")
99
+ }));
100
+ const entitlementEndingSoonNotices = pgTable("entitlement_ending_soon_notices", {
101
+ orgId: text("org_id").notNull().references(() => organizations.id),
102
+ entitlementId: text("entitlement_id").notNull(),
103
+ communityId: text("community_id").notNull(),
104
+ expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
105
+ notifiedAt: timestamp("notified_at", { withTimezone: true }).notNull().defaultNow()
106
+ }, (t) => ({
107
+ pk: primaryKey({ columns: [
108
+ t.orgId,
109
+ t.entitlementId,
110
+ t.communityId,
111
+ t.expiresAt
112
+ ] }),
113
+ entitlementFk: foreignKey({
114
+ columns: [t.orgId, t.entitlementId],
115
+ foreignColumns: [entitlements.orgId, entitlements.id]
116
+ }).onDelete("cascade"),
117
+ communityFk: foreignKey({
118
+ columns: [t.orgId, t.communityId],
119
+ foreignColumns: [communities.orgId, communities.id]
120
+ }).onDelete("cascade")
121
+ }));
122
+ const contentAccess = pgView("content_access", {
123
+ orgId: text("org_id").notNull(),
124
+ orgUserId: text("org_user_id").notNull(),
125
+ contentId: text("content_id").notNull(),
126
+ entitlementId: text("entitlement_id").notNull(),
127
+ grantedAt: timestamp("granted_at", { withTimezone: true }).notNull(),
128
+ expiresAt: timestamp("expires_at", { withTimezone: true })
129
+ }).as(sql`
130
+ select e.org_id, e.org_user_id, e.content_id, e.id as entitlement_id, e.granted_at, e.expires_at
131
+ from entitlements e
132
+ where e.content_id is not null
133
+ and e.status = 'active'
134
+ and (e.expires_at is null or e.expires_at > now())
135
+ union all
136
+ select e.org_id, e.org_user_id, bi.content_id, e.id as entitlement_id, e.granted_at, e.expires_at
137
+ from entitlements e
138
+ join bundle_items bi on bi.org_id = e.org_id and bi.bundle_id = e.bundle_id
139
+ where e.status = 'active'
140
+ and (e.expires_at is null or e.expires_at > now())
141
+ `);
37
142
  //#endregion
38
- export { entitlements };
143
+ export { contentAccess, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, spaceMembers };
39
144
 
40
145
  //# sourceMappingURL=entitlements.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entitlements.js","names":[],"sources":["../../src/schema/entitlements.ts"],"sourcesContent":["import { sql } from \"drizzle-orm\";\nimport {\n pgTable,\n text,\n timestamp,\n primaryKey,\n foreignKey,\n unique,\n check,\n} 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 { bundles, 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 bundleId: text(\"bundle_id\"),\n contentId: text(\"content_id\"),\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 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 // 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 // Grants die with their bundle, same as with their content.\n bundleFk: foreignKey({\n columns: [t.orgId, t.bundleId],\n foreignColumns: [bundles.orgId, bundles.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) and per (org, org user, bundle) —\n // the unused column is null, and nulls never collide, so each constraint\n // only sees grants of its own kind. Both are the upsert targets.\n orgUserContentUq: unique().on(t.orgId, t.orgUserId, t.contentId),\n orgUserBundleUq: unique().on(t.orgId, t.orgUserId, t.bundleId),\n // A grant targets exactly one of: a bundle or a content item.\n targetCk: check(\n \"entitlements_target_check\",\n sql`num_nonnulls(${t.bundleId}, ${t.contentId}) = 1`,\n ),\n }),\n);\n\ntype _EntitlementsDrift = Expect<NoDrift<typeof entitlements.$inferSelect, Entitlement>>;\n"],"mappings":";;;;;;AA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,EAAE,SAAS;EAC9B,gBAAgB,CAAC,SAAS,OAAO,SAAS,EAAE;CAC9C,CAAC,CAAC,CAAC,SAAS,SAAS;CAIrB,kBAAkB,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS;CAC/D,iBAAiB,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ;CAE7D,UAAU,MACR,6BACA,GAAG,gBAAgB,EAAE,SAAS,IAAI,EAAE,UAAU,MAChD;AACF,EACF"}
1
+ {"version":3,"file":"entitlements.js","names":[],"sources":["../../src/schema/entitlements.ts"],"sourcesContent":["import { sql } from \"drizzle-orm\";\nimport {\n pgTable,\n pgView,\n text,\n timestamp,\n primaryKey,\n foreignKey,\n unique,\n index,\n check,\n} from \"drizzle-orm/pg-core\";\nimport type { Entitlement, SpaceMember } from \"@headless-lms/core/schemas\";\nimport { genId } from \"@headless-lms/core/shared/id\";\nimport { organizations, orgUsers } from \"./organizations.js\";\nimport { bundles, communities, contentItems, spaces } 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 bundleId: text(\"bundle_id\"),\n contentId: text(\"content_id\"),\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 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 // 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 // Grants die with their bundle, same as with their content.\n bundleFk: foreignKey({\n columns: [t.orgId, t.bundleId],\n foreignColumns: [bundles.orgId, bundles.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) and per (org, org user, bundle) —\n // the unused column is null, and nulls never collide, so each constraint\n // only sees grants of its own kind. Both are the upsert targets.\n orgUserContentUq: unique().on(t.orgId, t.orgUserId, t.contentId),\n orgUserBundleUq: unique().on(t.orgId, t.orgUserId, t.bundleId),\n // A grant targets exactly one of: a bundle or a content item.\n targetCk: check(\n \"entitlements_target_check\",\n sql`num_nonnulls(${t.bundleId}, ${t.contentId}) = 1`,\n ),\n contentIdx: index(\"entitlements_content_idx\").on(t.orgId, t.contentId),\n bundleIdx: index(\"entitlements_bundle_idx\").on(t.orgId, t.bundleId),\n }),\n);\n\nexport const spaceMembers = pgTable(\n \"space_members\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"spaceMember\")),\n communityId: text(\"community_id\").notNull(),\n spaceId: text(\"space_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n status: text(\"status\", { enum: [\"requested\", \"invited\", \"active\", \"revoked\"] }).notNull(),\n source: text(\"source\", { enum: [\"request\", \"invite\", \"manual\"] })\n .notNull()\n .default(\"request\"),\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 memberUq: unique().on(t.orgId, t.spaceId, t.orgUserId),\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, t.communityId],\n foreignColumns: [spaces.orgId, spaces.id, spaces.communityId],\n }).onDelete(\"cascade\"),\n orgUserFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n spaceIdx: index(\"space_members_space_idx\").on(t.orgId, t.spaceId, t.status),\n communityIdx: index(\"space_members_community_idx\").on(t.orgId, t.communityId),\n }),\n);\n\nexport const entitlementExpiryNotices = pgTable(\n \"entitlement_expiry_notices\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n entitlementId: text(\"entitlement_id\").notNull(),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }).notNull(),\n notifiedAt: timestamp(\"notified_at\", { withTimezone: true }).notNull().defaultNow(),\n },\n (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.entitlementId, t.expiresAt] }),\n entitlementFk: foreignKey({\n columns: [t.orgId, t.entitlementId],\n foreignColumns: [entitlements.orgId, entitlements.id],\n }).onDelete(\"cascade\"),\n }),\n);\n\nexport const entitlementEndingSoonNotices = pgTable(\n \"entitlement_ending_soon_notices\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n entitlementId: text(\"entitlement_id\").notNull(),\n communityId: text(\"community_id\").notNull(),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }).notNull(),\n notifiedAt: timestamp(\"notified_at\", { withTimezone: true }).notNull().defaultNow(),\n },\n (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.entitlementId, t.communityId, t.expiresAt] }),\n entitlementFk: foreignKey({\n columns: [t.orgId, t.entitlementId],\n foreignColumns: [entitlements.orgId, entitlements.id],\n }).onDelete(\"cascade\"),\n communityFk: foreignKey({\n columns: [t.orgId, t.communityId],\n foreignColumns: [communities.orgId, communities.id],\n }).onDelete(\"cascade\"),\n }),\n);\n\n// The single definition of access: who can open which content item right now.\n// A bundle grant expands to the bundle's current items.\nexport const contentAccess = pgView(\"content_access\", {\n orgId: text(\"org_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n contentId: text(\"content_id\").notNull(),\n entitlementId: text(\"entitlement_id\").notNull(),\n grantedAt: timestamp(\"granted_at\", { withTimezone: true }).notNull(),\n expiresAt: timestamp(\"expires_at\", { withTimezone: true }),\n}).as(sql`\n select e.org_id, e.org_user_id, e.content_id, e.id as entitlement_id, e.granted_at, e.expires_at\n from entitlements e\n where e.content_id is not null\n and e.status = 'active'\n and (e.expires_at is null or e.expires_at > now())\n union all\n select e.org_id, e.org_user_id, bi.content_id, e.id as entitlement_id, e.granted_at, e.expires_at\n from entitlements e\n join bundle_items bi on bi.org_id = e.org_id and bi.bundle_id = e.bundle_id\n where e.status = 'active'\n and (e.expires_at is null or e.expires_at > now())\n`);\n\ntype _EntitlementsDrift = Expect<NoDrift<typeof entitlements.$inferSelect, Entitlement>>;\ntype _SpaceMembersDrift = Expect<NoDrift<typeof spaceMembers.$inferSelect, SpaceMember>>;\n"],"mappings":";;;;;;AAkBA,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,UAAU,KAAK,WAAW;CAC1B,WAAW,KAAK,YAAY;CAC5B,QAAQ,KAAK,UAAU,EAAE,MAAM,CAAC,UAAU,SAAS,EAAE,CAAC,CAAC,CACpD,QAAQ,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