@headless-lms/core 0.4.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 (249) hide show
  1. package/dist/assets/events.d.ts +27 -21
  2. package/dist/assets/file-urls.d.ts +11 -7
  3. package/dist/assets/file-urls.js +14 -4
  4. package/dist/assets/file-urls.js.map +1 -1
  5. package/dist/assets/index.d.ts +4 -4
  6. package/dist/assets/index.js +3 -3
  7. package/dist/assets/ports.d.ts +34 -15
  8. package/dist/assets/service.d.ts +30 -14
  9. package/dist/assets/service.js +230 -56
  10. package/dist/assets/service.js.map +1 -1
  11. package/dist/automations/actions.js.map +1 -1
  12. package/dist/automations/catalog.js +69 -4
  13. package/dist/automations/catalog.js.map +1 -1
  14. package/dist/automations/community-derivations.js +16 -16
  15. package/dist/automations/community-derivations.js.map +1 -1
  16. package/dist/automations/community-mail.d.ts +34 -4
  17. package/dist/automations/community-mail.js +32 -4
  18. package/dist/automations/community-mail.js.map +1 -1
  19. package/dist/automations/event-permissions.d.ts +12 -0
  20. package/dist/automations/event-permissions.js +38 -0
  21. package/dist/automations/event-permissions.js.map +1 -0
  22. package/dist/automations/index.d.ts +2 -1
  23. package/dist/automations/index.js +2 -1
  24. package/dist/automations/notifications/applicable.d.ts +8 -0
  25. package/dist/automations/notifications/applicable.js +12 -0
  26. package/dist/automations/notifications/applicable.js.map +1 -0
  27. package/dist/automations/notifications/debounce.js +1 -1
  28. package/dist/automations/notifications/debounce.js.map +1 -1
  29. package/dist/automations/notifications/defaults.js +33 -3
  30. package/dist/automations/notifications/defaults.js.map +1 -1
  31. package/dist/automations/notifications/processor.js +3 -3
  32. package/dist/automations/notifications/processor.js.map +1 -1
  33. package/dist/automations/notifications/rules/content.js +60 -3
  34. package/dist/automations/notifications/rules/content.js.map +1 -1
  35. package/dist/automations/notifications/rules/discussion.js +29 -29
  36. package/dist/automations/notifications/rules/discussion.js.map +1 -1
  37. package/dist/automations/notifications/rules/entitlements.js +36 -9
  38. package/dist/automations/notifications/rules/entitlements.js.map +1 -1
  39. package/dist/automations/notifications/rules/events.d.ts +9 -0
  40. package/dist/automations/notifications/rules/events.js +27 -0
  41. package/dist/automations/notifications/rules/events.js.map +1 -0
  42. package/dist/automations/notifications/rules/organizations.js +17 -10
  43. package/dist/automations/notifications/rules/organizations.js.map +1 -1
  44. package/dist/automations/notifications/rules/recipients.js +0 -1
  45. package/dist/automations/notifications/rules/recipients.js.map +1 -1
  46. package/dist/automations/notifications/service.d.ts +8 -6
  47. package/dist/automations/notifications/service.js +13 -13
  48. package/dist/automations/notifications/service.js.map +1 -1
  49. package/dist/automations/notifications/types.js +94 -7
  50. package/dist/automations/notifications/types.js.map +1 -1
  51. package/dist/automations/ports.d.ts +30 -31
  52. package/dist/automations/service.d.ts +20 -17
  53. package/dist/automations/service.js +91 -62
  54. package/dist/automations/service.js.map +1 -1
  55. package/dist/content/event-sight.d.ts +11 -0
  56. package/dist/content/event-sight.js +11 -0
  57. package/dist/content/event-sight.js.map +1 -0
  58. package/dist/content/events.d.ts +413 -72
  59. package/dist/content/events.js +34 -1
  60. package/dist/content/events.js.map +1 -1
  61. package/dist/content/index.d.ts +6 -4
  62. package/dist/content/index.js +3 -1
  63. package/dist/content/jobs.d.ts +16 -0
  64. package/dist/content/jobs.js +37 -0
  65. package/dist/content/jobs.js.map +1 -0
  66. package/dist/content/model.d.ts +2 -2
  67. package/dist/content/notification-categories.d.ts +5 -4
  68. package/dist/content/notification-categories.js +15 -6
  69. package/dist/content/notification-categories.js.map +1 -1
  70. package/dist/content/ports.d.ts +113 -68
  71. package/dist/content/service.d.ts +99 -67
  72. package/dist/content/service.js +680 -139
  73. package/dist/content/service.js.map +1 -1
  74. package/dist/content/titles.d.ts +6 -3
  75. package/dist/content/titles.js +37 -24
  76. package/dist/content/titles.js.map +1 -1
  77. package/dist/content/types.d.ts +2 -2
  78. package/dist/discussion/authors.d.ts +4 -2
  79. package/dist/discussion/authors.js +9 -5
  80. package/dist/discussion/authors.js.map +1 -1
  81. package/dist/discussion/chats.d.ts +56 -37
  82. package/dist/discussion/chats.js +393 -161
  83. package/dist/discussion/chats.js.map +1 -1
  84. package/dist/discussion/events.d.ts +77 -39
  85. package/dist/discussion/events.js +41 -3
  86. package/dist/discussion/events.js.map +1 -1
  87. package/dist/discussion/index.d.ts +8 -5
  88. package/dist/discussion/index.js +5 -3
  89. package/dist/discussion/live.d.ts +106 -0
  90. package/dist/discussion/live.js +642 -0
  91. package/dist/discussion/live.js.map +1 -0
  92. package/dist/discussion/mentions.js +2 -2
  93. package/dist/discussion/mentions.js.map +1 -1
  94. package/dist/discussion/ports.d.ts +182 -100
  95. package/dist/discussion/ports.js.map +1 -1
  96. package/dist/discussion/posts.d.ts +45 -39
  97. package/dist/discussion/posts.js +268 -154
  98. package/dist/discussion/posts.js.map +1 -1
  99. package/dist/discussion/rules.d.ts +18 -0
  100. package/dist/discussion/rules.js +22 -0
  101. package/dist/discussion/rules.js.map +1 -0
  102. package/dist/discussion/service.d.ts +37 -31
  103. package/dist/discussion/service.js +252 -188
  104. package/dist/discussion/service.js.map +1 -1
  105. package/dist/discussion/subscriptions.d.ts +8 -8
  106. package/dist/discussion/subscriptions.js +29 -13
  107. package/dist/discussion/subscriptions.js.map +1 -1
  108. package/dist/discussion/titles.d.ts +4 -2
  109. package/dist/discussion/titles.js +27 -13
  110. package/dist/discussion/titles.js.map +1 -1
  111. package/dist/entitlements/events.d.ts +20 -20
  112. package/dist/entitlements/index.d.ts +4 -4
  113. package/dist/entitlements/index.js +2 -2
  114. package/dist/entitlements/model.d.ts +2 -2
  115. package/dist/entitlements/ports.d.ts +65 -39
  116. package/dist/entitlements/rules.d.ts +3 -6
  117. package/dist/entitlements/rules.js +5 -10
  118. package/dist/entitlements/rules.js.map +1 -1
  119. package/dist/entitlements/service.d.ts +40 -28
  120. package/dist/entitlements/service.js +370 -163
  121. package/dist/entitlements/service.js.map +1 -1
  122. package/dist/identity/devices.d.ts +3 -3
  123. package/dist/identity/devices.js +7 -5
  124. package/dist/identity/devices.js.map +1 -1
  125. package/dist/identity/events.d.ts +2 -2
  126. package/dist/identity/index.d.ts +2 -2
  127. package/dist/identity/index.js +2 -2
  128. package/dist/identity/notification-settings.d.ts +1 -1
  129. package/dist/identity/notification-settings.js +3 -2
  130. package/dist/identity/notification-settings.js.map +1 -1
  131. package/dist/identity/ports.d.ts +7 -7
  132. package/dist/identity/service.d.ts +8 -7
  133. package/dist/identity/service.js +17 -13
  134. package/dist/identity/service.js.map +1 -1
  135. package/dist/integrations/events.d.ts +3 -3
  136. package/dist/integrations/ports.d.ts +9 -8
  137. package/dist/integrations/service.d.ts +9 -8
  138. package/dist/integrations/service.js +33 -16
  139. package/dist/integrations/service.js.map +1 -1
  140. package/dist/organizations/default-roles.d.ts +22 -0
  141. package/dist/organizations/default-roles.js +89 -0
  142. package/dist/organizations/default-roles.js.map +1 -0
  143. package/dist/organizations/effective-permissions.d.ts +45 -0
  144. package/dist/organizations/effective-permissions.js +113 -0
  145. package/dist/organizations/effective-permissions.js.map +1 -0
  146. package/dist/organizations/events.d.ts +320 -181
  147. package/dist/organizations/events.js +90 -18
  148. package/dist/organizations/events.js.map +1 -1
  149. package/dist/organizations/index.d.ts +14 -10
  150. package/dist/organizations/index.js +7 -3
  151. package/dist/organizations/members.d.ts +66 -8
  152. package/dist/organizations/members.js.map +1 -1
  153. package/dist/organizations/notification-catalog.d.ts +31 -0
  154. package/dist/organizations/notification-catalog.js +32 -0
  155. package/dist/organizations/notification-catalog.js.map +1 -0
  156. package/dist/organizations/notification-categories.d.ts +6 -4
  157. package/dist/organizations/notification-categories.js +25 -10
  158. package/dist/organizations/notification-categories.js.map +1 -1
  159. package/dist/organizations/org-roles.d.ts +33 -0
  160. package/dist/organizations/org-roles.js +49 -0
  161. package/dist/organizations/org-roles.js.map +1 -0
  162. package/dist/organizations/permissions.d.ts +311 -0
  163. package/dist/organizations/permissions.js +327 -0
  164. package/dist/organizations/permissions.js.map +1 -0
  165. package/dist/organizations/ports.d.ts +184 -65
  166. package/dist/organizations/service.d.ts +102 -35
  167. package/dist/organizations/service.js +1245 -328
  168. package/dist/organizations/service.js.map +1 -1
  169. package/dist/organizations/testing.d.ts +18 -0
  170. package/dist/organizations/testing.js +37 -0
  171. package/dist/organizations/testing.js.map +1 -0
  172. package/dist/organizations/types.d.ts +5 -16
  173. package/dist/progress/events.d.ts +14 -14
  174. package/dist/progress/index.d.ts +2 -2
  175. package/dist/progress/ports.d.ts +11 -3
  176. package/dist/progress/service.d.ts +6 -5
  177. package/dist/progress/service.js +23 -8
  178. package/dist/progress/service.js.map +1 -1
  179. package/dist/reporting/admin/index.d.ts +6 -4
  180. package/dist/reporting/admin/model.d.ts +36 -3
  181. package/dist/reporting/admin/ports.d.ts +39 -14
  182. package/dist/reporting/admin/service.d.ts +32 -11
  183. package/dist/reporting/admin/service.js +102 -18
  184. package/dist/reporting/admin/service.js.map +1 -1
  185. package/dist/reporting/events/index.d.ts +27 -0
  186. package/dist/reporting/events/index.js +20 -0
  187. package/dist/reporting/events/index.js.map +1 -0
  188. package/dist/reporting/member/calendar.d.ts +11 -0
  189. package/dist/reporting/member/calendar.js +75 -0
  190. package/dist/reporting/member/calendar.js.map +1 -0
  191. package/dist/reporting/member/index.d.ts +3 -2
  192. package/dist/reporting/member/model.d.ts +26 -5
  193. package/dist/reporting/member/ports.d.ts +48 -29
  194. package/dist/reporting/member/service.d.ts +56 -29
  195. package/dist/reporting/member/service.js +328 -113
  196. package/dist/reporting/member/service.js.map +1 -1
  197. package/dist/shared/actor.d.ts +22 -3
  198. package/dist/shared/errors.d.ts +2 -1
  199. package/dist/shared/errors.js +3 -1
  200. package/dist/shared/errors.js.map +1 -1
  201. package/dist/shared/id.d.ts +4 -0
  202. package/dist/shared/id.js +4 -0
  203. package/dist/shared/id.js.map +1 -1
  204. package/dist/shared/logger.d.ts +2 -1
  205. package/dist/shared/logger.js +10 -1
  206. package/dist/shared/logger.js.map +1 -1
  207. package/dist/shared/ports.d.ts +25 -5
  208. package/dist/types/content.d.ts +2 -2
  209. package/dist/types/discussion.d.ts +4 -5
  210. package/dist/types/email-templates.d.ts +22 -3
  211. package/dist/types/entitlements.d.ts +2 -2
  212. package/dist/types/identity.d.ts +13 -16
  213. package/dist/types/index.d.ts +9 -9
  214. package/dist/types/index.js +2 -1
  215. package/dist/types/notifications.d.ts +4 -4
  216. package/dist/types/organizations.d.ts +3 -2
  217. package/dist/types/ports.d.ts +8 -1
  218. package/dist/types/ports.js +7 -1
  219. package/dist/types/ports.js.map +1 -0
  220. package/dist/types/schemas/assets.d.ts +5 -5
  221. package/dist/types/schemas/assets.js +4 -3
  222. package/dist/types/schemas/assets.js.map +1 -1
  223. package/dist/types/schemas/content.d.ts +537 -13
  224. package/dist/types/schemas/content.js +201 -7
  225. package/dist/types/schemas/content.js.map +1 -1
  226. package/dist/types/schemas/discussion.d.ts +282 -59
  227. package/dist/types/schemas/discussion.js +77 -3
  228. package/dist/types/schemas/discussion.js.map +1 -1
  229. package/dist/types/schemas/entitlements.d.ts +14 -1
  230. package/dist/types/schemas/entitlements.js +11 -4
  231. package/dist/types/schemas/entitlements.js.map +1 -1
  232. package/dist/types/schemas/index.d.ts +5 -5
  233. package/dist/types/schemas/index.js +5 -5
  234. package/dist/types/schemas/notifications.d.ts +13 -12
  235. package/dist/types/schemas/notifications.js +3 -2
  236. package/dist/types/schemas/notifications.js.map +1 -1
  237. package/dist/types/schemas/organizations.d.ts +96 -60
  238. package/dist/types/schemas/organizations.js +78 -27
  239. package/dist/types/schemas/organizations.js.map +1 -1
  240. package/dist/types/schemas/progress.d.ts +3 -4
  241. package/dist/types/schemas/progress.js +0 -1
  242. package/dist/types/schemas/progress.js.map +1 -1
  243. package/package.json +1 -1
  244. package/dist/organizations/access-scopes.d.ts +0 -19
  245. package/dist/organizations/access-scopes.js +0 -89
  246. package/dist/organizations/access-scopes.js.map +0 -1
  247. package/dist/organizations/roles.d.ts +0 -19
  248. package/dist/organizations/roles.js +0 -82
  249. package/dist/organizations/roles.js.map +0 -1
@@ -1,25 +1,101 @@
1
1
  import { z } from "zod";
2
2
  //#region src/types/schemas/organizations.d.ts
3
- declare const roleSchema: z.ZodEnum<{
4
- owner: "owner";
5
- admin: "admin";
6
- instructor: "instructor";
7
- moderator: "moderator";
8
- student: "student";
3
+ declare const levelSchema: z.ZodUnion<readonly [z.ZodLiteral<"org">, z.ZodLazy<z.ZodEnum<{
4
+ event: "event";
5
+ course: "course";
6
+ download: "download";
7
+ community: "community";
8
+ }>>]>;
9
+ type Level = z.infer<typeof levelSchema>;
10
+ declare const PERMISSION_KEYS: readonly ["organizations:read", "organizations:write", "api_keys:read", "api_keys:write", "api_keys:delete", "notification_categories:read", "notification_categories:write", "integrations:read", "integrations:write", "integrations:delete", "analytics:read", "people:read", "people:write", "people:delete", "roles:read", "roles:write", "roles:delete", "access:read", "access:write", "bundles:read", "bundles:write", "bundles:delete", "media:read", "media:write", "media:delete", "courses:read", "courses:write", "courses:delete", "courses:moderate", "progress:read", "downloads:read", "downloads:write", "downloads:delete", "communities:read", "communities:write", "communities:delete", "communities:moderate", "events:read", "events:write", "events:delete", "automations:read", "automations:write", "automations:delete"];
11
+ declare const permissionSchema: z.ZodEnum<{
12
+ "organizations:read": "organizations:read";
13
+ "organizations:write": "organizations:write";
14
+ "api_keys:read": "api_keys:read";
15
+ "api_keys:write": "api_keys:write";
16
+ "api_keys:delete": "api_keys:delete";
17
+ "notification_categories:read": "notification_categories:read";
18
+ "notification_categories:write": "notification_categories:write";
19
+ "integrations:read": "integrations:read";
20
+ "integrations:write": "integrations:write";
21
+ "integrations:delete": "integrations:delete";
22
+ "analytics:read": "analytics:read";
23
+ "people:read": "people:read";
24
+ "people:write": "people:write";
25
+ "people:delete": "people:delete";
26
+ "roles:read": "roles:read";
27
+ "roles:write": "roles:write";
28
+ "roles:delete": "roles:delete";
29
+ "access:read": "access:read";
30
+ "access:write": "access:write";
31
+ "bundles:read": "bundles:read";
32
+ "bundles:write": "bundles:write";
33
+ "bundles:delete": "bundles:delete";
34
+ "media:read": "media:read";
35
+ "media:write": "media:write";
36
+ "media:delete": "media:delete";
37
+ "courses:read": "courses:read";
38
+ "courses:write": "courses:write";
39
+ "courses:delete": "courses:delete";
40
+ "courses:moderate": "courses:moderate";
41
+ "progress:read": "progress:read";
42
+ "downloads:read": "downloads:read";
43
+ "downloads:write": "downloads:write";
44
+ "downloads:delete": "downloads:delete";
45
+ "communities:read": "communities:read";
46
+ "communities:write": "communities:write";
47
+ "communities:delete": "communities:delete";
48
+ "communities:moderate": "communities:moderate";
49
+ "events:read": "events:read";
50
+ "events:write": "events:write";
51
+ "events:delete": "events:delete";
52
+ "automations:read": "automations:read";
53
+ "automations:write": "automations:write";
54
+ "automations:delete": "automations:delete";
9
55
  }>;
10
- type Role = z.infer<typeof roleSchema>;
56
+ type Permission = z.infer<typeof permissionSchema>;
57
+ declare const roleKeySchema: z.ZodString;
58
+ type RoleKey = z.infer<typeof roleKeySchema>;
59
+ declare const orgRoleRowSchema: z.ZodObject<{
60
+ id: z.ZodString;
61
+ orgId: z.ZodString;
62
+ key: z.ZodString;
63
+ name: z.ZodNullable<z.ZodString>;
64
+ description: z.ZodNullable<z.ZodString>;
65
+ base: z.ZodString;
66
+ levels: z.ZodNullable<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"org">, z.ZodLazy<z.ZodEnum<{
67
+ event: "event";
68
+ course: "course";
69
+ download: "download";
70
+ community: "community";
71
+ }>>]>>>;
72
+ permissions: z.ZodRecord<z.ZodString, z.ZodBoolean>;
73
+ team: z.ZodNullable<z.ZodBoolean>;
74
+ createdAt: z.ZodCoercedDate<unknown>;
75
+ updatedAt: z.ZodCoercedDate<unknown>;
76
+ }, z.core.$strict>;
77
+ type OrgRoleRow = z.output<typeof orgRoleRowSchema>;
78
+ declare const roleAssignmentSchema: z.ZodObject<{
79
+ id: z.ZodString;
80
+ orgId: z.ZodString;
81
+ orgUserId: z.ZodString;
82
+ roleKey: z.ZodString;
83
+ contentId: z.ZodNullable<z.ZodString>;
84
+ contentType: z.ZodNullable<z.ZodLazy<z.ZodEnum<{
85
+ event: "event";
86
+ course: "course";
87
+ download: "download";
88
+ community: "community";
89
+ }>>>;
90
+ assignedBy: z.ZodString;
91
+ createdAt: z.ZodCoercedDate<unknown>;
92
+ }, z.core.$strict>;
93
+ type RoleAssignment = z.output<typeof roleAssignmentSchema>;
11
94
  declare const orgUserStatusSchema: z.ZodEnum<{
12
95
  active: "active";
13
96
  invited: "invited";
14
97
  }>;
15
98
  type OrgUserStatus = z.infer<typeof orgUserStatusSchema>;
16
- declare const inviteRoleSchema: z.ZodEnum<{
17
- admin: "admin";
18
- instructor: "instructor";
19
- moderator: "moderator";
20
- student: "student";
21
- }>;
22
- type InviteRole = z.infer<typeof inviteRoleSchema>;
23
99
  declare const organizationSchema: z.ZodObject<{
24
100
  id: z.ZodString;
25
101
  externalId: z.ZodNullable<z.ZodString>;
@@ -35,13 +111,6 @@ declare const orgUserSchema: z.ZodObject<{
35
111
  id: z.ZodString;
36
112
  orgId: z.ZodString;
37
113
  userId: z.ZodString;
38
- role: z.ZodEnum<{
39
- owner: "owner";
40
- admin: "admin";
41
- instructor: "instructor";
42
- moderator: "moderator";
43
- student: "student";
44
- }>;
45
114
  status: z.ZodEnum<{
46
115
  active: "active";
47
116
  invited: "invited";
@@ -63,17 +132,12 @@ declare const inviteSchema: z.ZodObject<{
63
132
  id: z.ZodString;
64
133
  orgId: z.ZodString;
65
134
  email: z.ZodEmail;
66
- role: z.ZodEnum<{
67
- admin: "admin";
68
- instructor: "instructor";
69
- moderator: "moderator";
70
- student: "student";
71
- }>;
135
+ roleKey: z.ZodString;
72
136
  status: z.ZodEnum<{
73
137
  pending: "pending";
138
+ canceled: "canceled";
74
139
  accepted: "accepted";
75
140
  rejected: "rejected";
76
- canceled: "canceled";
77
141
  }>;
78
142
  invitedBy: z.ZodString;
79
143
  tokenHash: z.ZodNullable<z.ZodString>;
@@ -92,25 +156,11 @@ type NewOrganizationInput = z.infer<typeof newOrganizationInputSchema>;
92
156
  declare const addOrgUserInputSchema: z.ZodObject<{
93
157
  orgId: z.ZodString;
94
158
  userId: z.ZodString;
95
- role: z.ZodEnum<{
96
- owner: "owner";
97
- admin: "admin";
98
- instructor: "instructor";
99
- moderator: "moderator";
100
- student: "student";
101
- }>;
102
159
  }, z.core.$strict>;
103
160
  type AddOrgUserInput = z.infer<typeof addOrgUserInputSchema>;
104
161
  declare const createOrgUserInputSchema: z.ZodObject<{
105
162
  orgId: z.ZodString;
106
163
  userId: z.ZodString;
107
- role: z.ZodEnum<{
108
- owner: "owner";
109
- admin: "admin";
110
- instructor: "instructor";
111
- moderator: "moderator";
112
- student: "student";
113
- }>;
114
164
  status: z.ZodOptional<z.ZodEnum<{
115
165
  active: "active";
116
166
  invited: "invited";
@@ -118,13 +168,6 @@ declare const createOrgUserInputSchema: z.ZodObject<{
118
168
  }, z.core.$strict>;
119
169
  type CreateOrgUserInput = z.infer<typeof createOrgUserInputSchema>;
120
170
  declare const updateOrgUserInputSchema: z.ZodObject<{
121
- role: z.ZodOptional<z.ZodEnum<{
122
- owner: "owner";
123
- admin: "admin";
124
- instructor: "instructor";
125
- moderator: "moderator";
126
- student: "student";
127
- }>>;
128
171
  status: z.ZodOptional<z.ZodEnum<{
129
172
  active: "active";
130
173
  invited: "invited";
@@ -132,26 +175,19 @@ declare const updateOrgUserInputSchema: z.ZodObject<{
132
175
  }, z.core.$strict>;
133
176
  type UpdateOrgUserInput = z.infer<typeof updateOrgUserInputSchema>;
134
177
  declare const createInviteInputSchema: z.ZodObject<{
135
- orgId: z.ZodString;
136
178
  email: z.ZodEmail;
137
- role: z.ZodEnum<{
138
- admin: "admin";
139
- instructor: "instructor";
140
- moderator: "moderator";
141
- student: "student";
142
- }>;
143
- inviterUserId: z.ZodString;
179
+ roleKey: z.ZodDefault<z.ZodString>;
144
180
  firstName: z.ZodOptional<z.ZodString>;
145
181
  lastName: z.ZodOptional<z.ZodString>;
146
182
  sendEmail: z.ZodOptional<z.ZodBoolean>;
147
183
  }, z.core.$strict>;
148
- type CreateInviteInput = z.infer<typeof createInviteInputSchema>;
184
+ type CreateInviteInput = z.input<typeof createInviteInputSchema>;
149
185
  declare const acceptInviteInputSchema: z.ZodObject<{
150
186
  token: z.ZodString;
151
- userId: z.ZodString;
187
+ authUserId: z.ZodString;
152
188
  email: z.ZodEmail;
153
189
  }, z.core.$strict>;
154
190
  type AcceptInviteInput = z.infer<typeof acceptInviteInputSchema>;
155
191
  //#endregion
156
- export { AcceptInviteInput, AddOrgUserInput, CreateInviteInput, CreateOrgUserInput, Invite, InviteInput, InviteRole, NewOrganizationInput, OrgUser, OrgUserInput, OrgUserProfile, OrgUserStatus, Organization, OrganizationInput, Role, UpdateOrgUserInput, acceptInviteInputSchema, addOrgUserInputSchema, createInviteInputSchema, createOrgUserInputSchema, inviteRoleSchema, inviteSchema, newOrganizationInputSchema, orgUserProfileSchema, orgUserSchema, orgUserStatusSchema, organizationSchema, roleSchema, updateOrgUserInputSchema };
192
+ export { AcceptInviteInput, AddOrgUserInput, CreateInviteInput, CreateOrgUserInput, Invite, InviteInput, Level, NewOrganizationInput, OrgRoleRow, OrgUser, OrgUserInput, OrgUserProfile, OrgUserStatus, Organization, OrganizationInput, PERMISSION_KEYS, Permission, RoleAssignment, RoleKey, UpdateOrgUserInput, acceptInviteInputSchema, addOrgUserInputSchema, createInviteInputSchema, createOrgUserInputSchema, inviteSchema, levelSchema, newOrganizationInputSchema, orgRoleRowSchema, orgUserProfileSchema, orgUserSchema, orgUserStatusSchema, organizationSchema, permissionSchema, roleAssignmentSchema, roleKeySchema, updateOrgUserInputSchema };
157
193
  //# sourceMappingURL=organizations.d.ts.map
@@ -1,20 +1,79 @@
1
1
  import { emailSchema, idSchema } from "./shared.js";
2
+ import { contentTypeSchema } from "./content.js";
2
3
  import { z } from "zod";
3
4
  //#region src/types/schemas/organizations.ts
4
- const roleSchema = z.enum([
5
- "owner",
6
- "admin",
7
- "instructor",
8
- "moderator",
9
- "student"
10
- ]);
5
+ const levelSchema = z.union([z.literal("org"), z.lazy(() => contentTypeSchema)]);
6
+ const PERMISSION_KEYS = [
7
+ "organizations:read",
8
+ "organizations:write",
9
+ "api_keys:read",
10
+ "api_keys:write",
11
+ "api_keys:delete",
12
+ "notification_categories:read",
13
+ "notification_categories:write",
14
+ "integrations:read",
15
+ "integrations:write",
16
+ "integrations:delete",
17
+ "analytics:read",
18
+ "people:read",
19
+ "people:write",
20
+ "people:delete",
21
+ "roles:read",
22
+ "roles:write",
23
+ "roles:delete",
24
+ "access:read",
25
+ "access:write",
26
+ "bundles:read",
27
+ "bundles:write",
28
+ "bundles:delete",
29
+ "media:read",
30
+ "media:write",
31
+ "media:delete",
32
+ "courses:read",
33
+ "courses:write",
34
+ "courses:delete",
35
+ "courses:moderate",
36
+ "progress:read",
37
+ "downloads:read",
38
+ "downloads:write",
39
+ "downloads:delete",
40
+ "communities:read",
41
+ "communities:write",
42
+ "communities:delete",
43
+ "communities:moderate",
44
+ "events:read",
45
+ "events:write",
46
+ "events:delete",
47
+ "automations:read",
48
+ "automations:write",
49
+ "automations:delete"
50
+ ];
51
+ const permissionSchema = z.enum(PERMISSION_KEYS);
52
+ const roleKeySchema = z.string().trim().min(1).max(64).regex(/^[a-z][a-zA-Z0-9_]*$/, "A role key starts with a lowercase letter and holds letters, digits and underscores");
53
+ const orgRoleRowSchema = z.object({
54
+ id: idSchema,
55
+ orgId: idSchema,
56
+ key: z.string(),
57
+ name: z.string().nullable(),
58
+ description: z.string().nullable(),
59
+ base: z.string(),
60
+ levels: z.array(levelSchema).nullable(),
61
+ permissions: z.record(z.string(), z.boolean()),
62
+ team: z.boolean().nullable(),
63
+ createdAt: z.coerce.date(),
64
+ updatedAt: z.coerce.date()
65
+ }).strict();
66
+ const roleAssignmentSchema = z.object({
67
+ id: idSchema,
68
+ orgId: idSchema,
69
+ orgUserId: idSchema,
70
+ roleKey: z.string(),
71
+ contentId: idSchema.nullable(),
72
+ contentType: z.lazy(() => contentTypeSchema).nullable(),
73
+ assignedBy: z.string(),
74
+ createdAt: z.coerce.date()
75
+ }).strict();
11
76
  const orgUserStatusSchema = z.enum(["invited", "active"]);
12
- const inviteRoleSchema = z.enum([
13
- "admin",
14
- "instructor",
15
- "moderator",
16
- "student"
17
- ]);
18
77
  const organizationSchema = z.object({
19
78
  id: idSchema,
20
79
  externalId: idSchema.nullable(),
@@ -28,7 +87,6 @@ const orgUserSchema = z.object({
28
87
  id: idSchema,
29
88
  orgId: idSchema,
30
89
  userId: idSchema,
31
- role: roleSchema,
32
90
  status: orgUserStatusSchema,
33
91
  createdAt: z.coerce.date(),
34
92
  updatedAt: z.coerce.date()
@@ -44,7 +102,7 @@ const inviteSchema = z.object({
44
102
  id: idSchema,
45
103
  orgId: idSchema,
46
104
  email: emailSchema,
47
- role: inviteRoleSchema,
105
+ roleKey: z.string(),
48
106
  status: z.enum([
49
107
  "pending",
50
108
  "accepted",
@@ -64,34 +122,27 @@ const newOrganizationInputSchema = z.object({
64
122
  }).strict();
65
123
  const addOrgUserInputSchema = z.object({
66
124
  orgId: idSchema,
67
- userId: idSchema,
68
- role: roleSchema
125
+ userId: idSchema
69
126
  }).strict();
70
127
  const createOrgUserInputSchema = z.object({
71
128
  orgId: idSchema,
72
129
  userId: idSchema,
73
- role: roleSchema,
74
- status: orgUserStatusSchema.optional()
75
- }).strict();
76
- const updateOrgUserInputSchema = z.object({
77
- role: roleSchema.optional(),
78
130
  status: orgUserStatusSchema.optional()
79
131
  }).strict();
132
+ const updateOrgUserInputSchema = z.object({ status: orgUserStatusSchema.optional() }).strict();
80
133
  const createInviteInputSchema = z.object({
81
- orgId: idSchema,
82
134
  email: emailSchema,
83
- role: inviteRoleSchema,
84
- inviterUserId: idSchema,
135
+ roleKey: roleKeySchema.default("member"),
85
136
  firstName: z.string().optional(),
86
137
  lastName: z.string().optional(),
87
138
  sendEmail: z.boolean().optional()
88
139
  }).strict();
89
140
  const acceptInviteInputSchema = z.object({
90
141
  token: z.string().trim().min(1),
91
- userId: idSchema,
142
+ authUserId: idSchema,
92
143
  email: emailSchema
93
144
  }).strict();
94
145
  //#endregion
95
- export { acceptInviteInputSchema, addOrgUserInputSchema, createInviteInputSchema, createOrgUserInputSchema, inviteRoleSchema, inviteSchema, newOrganizationInputSchema, orgUserProfileSchema, orgUserSchema, orgUserStatusSchema, organizationSchema, roleSchema, updateOrgUserInputSchema };
146
+ export { PERMISSION_KEYS, acceptInviteInputSchema, addOrgUserInputSchema, createInviteInputSchema, createOrgUserInputSchema, inviteSchema, levelSchema, newOrganizationInputSchema, orgRoleRowSchema, orgUserProfileSchema, orgUserSchema, orgUserStatusSchema, organizationSchema, permissionSchema, roleAssignmentSchema, roleKeySchema, updateOrgUserInputSchema };
96
147
 
97
148
  //# sourceMappingURL=organizations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"organizations.js","names":[],"sources":["../../../src/types/schemas/organizations.ts"],"sourcesContent":["import { z } from 'zod';\nimport { idSchema, emailSchema } from './shared.js';\n\nexport const roleSchema = z.enum(['owner', 'admin', 'instructor', 'moderator', 'student']);\nexport type Role = z.infer<typeof roleSchema>;\n\nexport const orgUserStatusSchema = z.enum(['invited', 'active']);\nexport type OrgUserStatus = z.infer<typeof orgUserStatusSchema>;\n\nexport const inviteRoleSchema = z.enum(['admin', 'instructor', 'moderator', 'student']);\nexport type InviteRole = z.infer<typeof inviteRoleSchema>;\n\nexport const organizationSchema = z\n .object({\n id: idSchema,\n externalId: idSchema.nullable(),\n name: z.string(),\n slug: z.string(),\n ownerId: idSchema,\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type Organization = z.output<typeof organizationSchema>;\nexport type OrganizationInput = z.input<typeof organizationSchema>;\n\nexport const orgUserSchema = z\n .object({\n id: idSchema,\n orgId: idSchema,\n userId: idSchema,\n role: roleSchema,\n status: orgUserStatusSchema,\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type OrgUser = z.output<typeof orgUserSchema>;\nexport type OrgUserInput = z.input<typeof orgUserSchema>;\n\nexport const orgUserProfileSchema = z\n .object({\n id: idSchema,\n firstName: z.string().nullable(),\n lastName: z.string().nullable(),\n email: emailSchema,\n image: z.string().nullable(),\n })\n .strict();\nexport type OrgUserProfile = z.infer<typeof orgUserProfileSchema>;\n\nexport const inviteSchema = z\n .object({\n id: idSchema,\n orgId: idSchema,\n email: emailSchema,\n role: inviteRoleSchema,\n status: z.enum(['pending', 'accepted', 'rejected', 'canceled']),\n invitedBy: idSchema,\n tokenHash: z.string().nullable(),\n expiresAt: z.coerce.date().nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type Invite = z.output<typeof inviteSchema>;\nexport type InviteInput = z.input<typeof inviteSchema>;\n\nexport const newOrganizationInputSchema = z\n .object({\n name: z.string(),\n slug: z.string(),\n logo: z.string().optional(),\n })\n .strict();\nexport type NewOrganizationInput = z.infer<typeof newOrganizationInputSchema>;\n\nexport const addOrgUserInputSchema = z\n .object({\n orgId: idSchema,\n userId: idSchema,\n role: roleSchema,\n })\n .strict();\nexport type AddOrgUserInput = z.infer<typeof addOrgUserInputSchema>;\n\nexport const createOrgUserInputSchema = z\n .object({\n orgId: idSchema,\n userId: idSchema,\n role: roleSchema,\n status: orgUserStatusSchema.optional(),\n })\n .strict();\nexport type CreateOrgUserInput = z.infer<typeof createOrgUserInputSchema>;\n\nexport const updateOrgUserInputSchema = z\n .object({\n role: roleSchema.optional(),\n status: orgUserStatusSchema.optional(),\n })\n .strict();\nexport type UpdateOrgUserInput = z.infer<typeof updateOrgUserInputSchema>;\n\nexport const createInviteInputSchema = z\n .object({\n orgId: idSchema,\n email: emailSchema,\n role: inviteRoleSchema,\n inviterUserId: idSchema,\n firstName: z.string().optional(),\n lastName: z.string().optional(),\n sendEmail: z.boolean().optional(),\n })\n .strict();\nexport type CreateInviteInput = z.infer<typeof createInviteInputSchema>;\n\nexport const acceptInviteInputSchema = z\n .object({\n token: z.string().trim().min(1),\n userId: idSchema,\n email: emailSchema,\n })\n .strict();\nexport type AcceptInviteInput = z.infer<typeof acceptInviteInputSchema>;\n"],"mappings":";;;AAGA,MAAa,aAAa,EAAE,KAAK;CAAC;CAAS;CAAS;CAAc;CAAa;AAAS,CAAC;AAGzF,MAAa,sBAAsB,EAAE,KAAK,CAAC,WAAW,QAAQ,CAAC;AAG/D,MAAa,mBAAmB,EAAE,KAAK;CAAC;CAAS;CAAc;CAAa;AAAS,CAAC;AAGtF,MAAa,qBAAqB,EAC/B,OAAO;CACN,IAAI;CACJ,YAAY,SAAS,SAAS;CAC9B,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO;CACf,SAAS;CACT,WAAW,EAAE,OAAO,KAAK;CACzB,WAAW,EAAE,OAAO,KAAK;AAC3B,CAAC,CAAC,CACD,OAAO;AAIV,MAAa,gBAAgB,EAC1B,OAAO;CACN,IAAI;CACJ,OAAO;CACP,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,WAAW,EAAE,OAAO,KAAK;CACzB,WAAW,EAAE,OAAO,KAAK;AAC3B,CAAC,CAAC,CACD,OAAO;AAIV,MAAa,uBAAuB,EACjC,OAAO;CACN,IAAI;CACJ,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;CAC9B,OAAO;CACP,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;AAC7B,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,eAAe,EACzB,OAAO;CACN,IAAI;CACJ,OAAO;CACP,OAAO;CACP,MAAM;CACN,QAAQ,EAAE,KAAK;EAAC;EAAW;EAAY;EAAY;CAAU,CAAC;CAC9D,WAAW;CACX,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,WAAW,EAAE,OAAO,KAAK,CAAC,CAAC,SAAS;CACpC,WAAW,EAAE,OAAO,KAAK;CACzB,WAAW,EAAE,OAAO,KAAK;AAC3B,CAAC,CAAC,CACD,OAAO;AAIV,MAAa,6BAA6B,EACvC,OAAO;CACN,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;AAC5B,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,wBAAwB,EAClC,OAAO;CACN,OAAO;CACP,QAAQ;CACR,MAAM;AACR,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,2BAA2B,EACrC,OAAO;CACN,OAAO;CACP,QAAQ;CACR,MAAM;CACN,QAAQ,oBAAoB,SAAS;AACvC,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,2BAA2B,EACrC,OAAO;CACN,MAAM,WAAW,SAAS;CAC1B,QAAQ,oBAAoB,SAAS;AACvC,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,0BAA0B,EACpC,OAAO;CACN,OAAO;CACP,OAAO;CACP,MAAM;CACN,eAAe;CACf,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;CAC9B,WAAW,EAAE,QAAQ,CAAC,CAAC,SAAS;AAClC,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,0BAA0B,EACpC,OAAO;CACN,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CAC9B,QAAQ;CACR,OAAO;AACT,CAAC,CAAC,CACD,OAAO"}
1
+ {"version":3,"file":"organizations.js","names":[],"sources":["../../../src/types/schemas/organizations.ts"],"sourcesContent":["import { z } from 'zod';\nimport { idSchema, emailSchema } from './shared.js';\nimport { contentTypeSchema } from './content.js';\n\nexport const levelSchema = z.union([z.literal('org'), z.lazy(() => contentTypeSchema)]);\nexport type Level = z.infer<typeof levelSchema>;\n\nexport const PERMISSION_KEYS = [\n 'organizations:read',\n 'organizations:write',\n 'api_keys:read',\n 'api_keys:write',\n 'api_keys:delete',\n 'notification_categories:read',\n 'notification_categories:write',\n 'integrations:read',\n 'integrations:write',\n 'integrations:delete',\n 'analytics:read',\n 'people:read',\n 'people:write',\n 'people:delete',\n 'roles:read',\n 'roles:write',\n 'roles:delete',\n 'access:read',\n 'access:write',\n 'bundles:read',\n 'bundles:write',\n 'bundles:delete',\n 'media:read',\n 'media:write',\n 'media:delete',\n 'courses:read',\n 'courses:write',\n 'courses:delete',\n 'courses:moderate',\n 'progress:read',\n 'downloads:read',\n 'downloads:write',\n 'downloads:delete',\n 'communities:read',\n 'communities:write',\n 'communities:delete',\n 'communities:moderate',\n 'events:read',\n 'events:write',\n 'events:delete',\n 'automations:read',\n 'automations:write',\n 'automations:delete',\n] as const;\n\nexport const permissionSchema = z.enum(PERMISSION_KEYS);\nexport type Permission = z.infer<typeof permissionSchema>;\n\nexport const roleKeySchema = z\n .string()\n .trim()\n .min(1)\n .max(64)\n .regex(\n /^[a-z][a-zA-Z0-9_]*$/,\n 'A role key starts with a lowercase letter and holds letters, digits and underscores',\n );\nexport type RoleKey = z.infer<typeof roleKeySchema>;\n\nexport const orgRoleRowSchema = z\n .object({\n id: idSchema,\n orgId: idSchema,\n key: z.string(),\n name: z.string().nullable(),\n description: z.string().nullable(),\n base: z.string(),\n levels: z.array(levelSchema).nullable(),\n permissions: z.record(z.string(), z.boolean()),\n team: z.boolean().nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type OrgRoleRow = z.output<typeof orgRoleRowSchema>;\n\nexport const roleAssignmentSchema = z\n .object({\n id: idSchema,\n orgId: idSchema,\n orgUserId: idSchema,\n roleKey: z.string(),\n contentId: idSchema.nullable(),\n contentType: z.lazy(() => contentTypeSchema).nullable(),\n assignedBy: z.string(),\n createdAt: z.coerce.date(),\n })\n .strict();\nexport type RoleAssignment = z.output<typeof roleAssignmentSchema>;\n\nexport const orgUserStatusSchema = z.enum(['invited', 'active']);\nexport type OrgUserStatus = z.infer<typeof orgUserStatusSchema>;\n\nexport const organizationSchema = z\n .object({\n id: idSchema,\n externalId: idSchema.nullable(),\n name: z.string(),\n slug: z.string(),\n ownerId: idSchema,\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type Organization = z.output<typeof organizationSchema>;\nexport type OrganizationInput = z.input<typeof organizationSchema>;\n\nexport const orgUserSchema = z\n .object({\n id: idSchema,\n orgId: idSchema,\n userId: idSchema,\n status: orgUserStatusSchema,\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type OrgUser = z.output<typeof orgUserSchema>;\nexport type OrgUserInput = z.input<typeof orgUserSchema>;\n\nexport const orgUserProfileSchema = z\n .object({\n id: idSchema,\n firstName: z.string().nullable(),\n lastName: z.string().nullable(),\n email: emailSchema,\n image: z.string().nullable(),\n })\n .strict();\nexport type OrgUserProfile = z.infer<typeof orgUserProfileSchema>;\n\nexport const inviteSchema = z\n .object({\n id: idSchema,\n orgId: idSchema,\n email: emailSchema,\n roleKey: z.string(),\n status: z.enum(['pending', 'accepted', 'rejected', 'canceled']),\n invitedBy: idSchema,\n tokenHash: z.string().nullable(),\n expiresAt: z.coerce.date().nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type Invite = z.output<typeof inviteSchema>;\nexport type InviteInput = z.input<typeof inviteSchema>;\n\nexport const newOrganizationInputSchema = z\n .object({\n name: z.string(),\n slug: z.string(),\n logo: z.string().optional(),\n })\n .strict();\nexport type NewOrganizationInput = z.infer<typeof newOrganizationInputSchema>;\n\nexport const addOrgUserInputSchema = z\n .object({\n orgId: idSchema,\n userId: idSchema,\n })\n .strict();\nexport type AddOrgUserInput = z.infer<typeof addOrgUserInputSchema>;\n\nexport const createOrgUserInputSchema = z\n .object({\n orgId: idSchema,\n userId: idSchema,\n status: orgUserStatusSchema.optional(),\n })\n .strict();\nexport type CreateOrgUserInput = z.infer<typeof createOrgUserInputSchema>;\n\nexport const updateOrgUserInputSchema = z\n .object({\n status: orgUserStatusSchema.optional(),\n })\n .strict();\nexport type UpdateOrgUserInput = z.infer<typeof updateOrgUserInputSchema>;\n\nexport const createInviteInputSchema = z\n .object({\n email: emailSchema,\n roleKey: roleKeySchema.default('member'),\n firstName: z.string().optional(),\n lastName: z.string().optional(),\n sendEmail: z.boolean().optional(),\n })\n .strict();\nexport type CreateInviteInput = z.input<typeof createInviteInputSchema>;\n\nexport const acceptInviteInputSchema = z\n .object({\n token: z.string().trim().min(1),\n authUserId: idSchema,\n email: emailSchema,\n })\n .strict();\nexport type AcceptInviteInput = z.infer<typeof acceptInviteInputSchema>;\n"],"mappings":";;;;AAIA,MAAa,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,KAAK,GAAG,EAAE,WAAW,iBAAiB,CAAC,CAAC;AAGtF,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,mBAAmB,EAAE,KAAK,eAAe;AAGtD,MAAa,gBAAgB,EAC1B,OAAO,CAAC,CACR,KAAK,CAAC,CACN,IAAI,CAAC,CAAC,CACN,IAAI,EAAE,CAAC,CACP,MACC,wBACA,qFACF;AAGF,MAAa,mBAAmB,EAC7B,OAAO;CACN,IAAI;CACJ,OAAO;CACP,KAAK,EAAE,OAAO;CACd,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;CAC1B,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,MAAM,EAAE,OAAO;CACf,QAAQ,EAAE,MAAM,WAAW,CAAC,CAAC,SAAS;CACtC,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;CAC7C,MAAM,EAAE,QAAQ,CAAC,CAAC,SAAS;CAC3B,WAAW,EAAE,OAAO,KAAK;CACzB,WAAW,EAAE,OAAO,KAAK;AAC3B,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,uBAAuB,EACjC,OAAO;CACN,IAAI;CACJ,OAAO;CACP,WAAW;CACX,SAAS,EAAE,OAAO;CAClB,WAAW,SAAS,SAAS;CAC7B,aAAa,EAAE,WAAW,iBAAiB,CAAC,CAAC,SAAS;CACtD,YAAY,EAAE,OAAO;CACrB,WAAW,EAAE,OAAO,KAAK;AAC3B,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,sBAAsB,EAAE,KAAK,CAAC,WAAW,QAAQ,CAAC;AAG/D,MAAa,qBAAqB,EAC/B,OAAO;CACN,IAAI;CACJ,YAAY,SAAS,SAAS;CAC9B,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO;CACf,SAAS;CACT,WAAW,EAAE,OAAO,KAAK;CACzB,WAAW,EAAE,OAAO,KAAK;AAC3B,CAAC,CAAC,CACD,OAAO;AAIV,MAAa,gBAAgB,EAC1B,OAAO;CACN,IAAI;CACJ,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,WAAW,EAAE,OAAO,KAAK;CACzB,WAAW,EAAE,OAAO,KAAK;AAC3B,CAAC,CAAC,CACD,OAAO;AAIV,MAAa,uBAAuB,EACjC,OAAO;CACN,IAAI;CACJ,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;CAC9B,OAAO;CACP,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;AAC7B,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,eAAe,EACzB,OAAO;CACN,IAAI;CACJ,OAAO;CACP,OAAO;CACP,SAAS,EAAE,OAAO;CAClB,QAAQ,EAAE,KAAK;EAAC;EAAW;EAAY;EAAY;CAAU,CAAC;CAC9D,WAAW;CACX,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,WAAW,EAAE,OAAO,KAAK,CAAC,CAAC,SAAS;CACpC,WAAW,EAAE,OAAO,KAAK;CACzB,WAAW,EAAE,OAAO,KAAK;AAC3B,CAAC,CAAC,CACD,OAAO;AAIV,MAAa,6BAA6B,EACvC,OAAO;CACN,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;AAC5B,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,wBAAwB,EAClC,OAAO;CACN,OAAO;CACP,QAAQ;AACV,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,2BAA2B,EACrC,OAAO;CACN,OAAO;CACP,QAAQ;CACR,QAAQ,oBAAoB,SAAS;AACvC,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,2BAA2B,EACrC,OAAO,EACN,QAAQ,oBAAoB,SAAS,EACvC,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,0BAA0B,EACpC,OAAO;CACN,OAAO;CACP,SAAS,cAAc,QAAQ,QAAQ;CACvC,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;CAC9B,WAAW,EAAE,QAAQ,CAAC,CAAC,SAAS;AAClC,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,0BAA0B,EACpC,OAAO;CACN,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CAC9B,YAAY;CACZ,OAAO;AACT,CAAC,CAAC,CACD,OAAO"}
@@ -2,9 +2,9 @@ import { JsonValue } from "../shared.js";
2
2
  import { z } from "zod";
3
3
  //#region src/types/schemas/progress.d.ts
4
4
  declare const progressTargetTypeSchema: z.ZodEnum<{
5
+ course: "course";
5
6
  activity: "activity";
6
7
  module: "module";
7
- course: "course";
8
8
  }>;
9
9
  type ProgressTargetType = z.infer<typeof progressTargetTypeSchema>;
10
10
  declare const progressRecordSchema: z.ZodObject<{
@@ -12,9 +12,9 @@ declare const progressRecordSchema: z.ZodObject<{
12
12
  orgId: z.ZodString;
13
13
  orgUserId: z.ZodString;
14
14
  targetType: z.ZodEnum<{
15
+ course: "course";
15
16
  activity: "activity";
16
17
  module: "module";
17
- course: "course";
18
18
  }>;
19
19
  targetId: z.ZodString;
20
20
  startedAt: z.ZodCoercedDate<unknown>;
@@ -28,9 +28,9 @@ type ProgressRecordInput = z.input<typeof progressRecordSchema>;
28
28
  declare const progressTargetSchema: z.ZodObject<{
29
29
  orgUserId: z.ZodString;
30
30
  targetType: z.ZodEnum<{
31
+ course: "course";
31
32
  activity: "activity";
32
33
  module: "module";
33
- course: "course";
34
34
  }>;
35
35
  targetId: z.ZodString;
36
36
  }, z.core.$strict>;
@@ -41,7 +41,6 @@ declare const progressReportItemSchema: z.ZodObject<{
41
41
  }, z.core.$catchall<z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
42
42
  type ProgressReportItem = z.infer<typeof progressReportItemSchema>;
43
43
  declare const reportProgressInputSchema: z.ZodObject<{
44
- orgUserId: z.ZodString;
45
44
  activityId: z.ZodString;
46
45
  reports: z.ZodArray<z.ZodObject<{
47
46
  asset: z.ZodOptional<z.ZodString>;
@@ -28,7 +28,6 @@ const progressReportItemSchema = z.object({
28
28
  completed: z.boolean().optional()
29
29
  }).catchall(jsonValueSchema);
30
30
  const reportProgressInputSchema = z.object({
31
- orgUserId: idSchema,
32
31
  activityId: idSchema,
33
32
  reports: z.array(progressReportItemSchema)
34
33
  }).strict();
@@ -1 +1 @@
1
- {"version":3,"file":"progress.js","names":[],"sources":["../../../src/types/schemas/progress.ts"],"sourcesContent":["import { z } from 'zod';\nimport { idSchema, jsonValueSchema } from './shared.js';\n\nexport const progressTargetTypeSchema = z.enum(['activity', 'module', 'course']);\nexport type ProgressTargetType = z.infer<typeof progressTargetTypeSchema>;\n\nexport const progressRecordSchema = z\n .object({\n id: idSchema,\n orgId: idSchema,\n orgUserId: idSchema,\n targetType: progressTargetTypeSchema,\n targetId: idSchema,\n startedAt: z.coerce.date(),\n position: jsonValueSchema.nullable(),\n completedAt: z.coerce.date().nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type ProgressRecord = z.output<typeof progressRecordSchema>;\nexport type ProgressRecordInput = z.input<typeof progressRecordSchema>;\n\nexport const progressTargetSchema = z\n .object({\n orgUserId: idSchema,\n targetType: progressTargetTypeSchema,\n targetId: idSchema,\n })\n .strict();\nexport type ProgressTarget = z.infer<typeof progressTargetSchema>;\n\nexport const progressReportItemSchema = z\n .object({\n asset: z.string().optional(),\n completed: z.boolean().optional(),\n })\n .catchall(jsonValueSchema);\nexport type ProgressReportItem = z.infer<typeof progressReportItemSchema>;\n\nexport const reportProgressInputSchema = z\n .object({\n orgUserId: idSchema,\n activityId: idSchema,\n reports: z.array(progressReportItemSchema),\n })\n .strict();\nexport type ReportProgressInput = z.infer<typeof reportProgressInputSchema>;\n"],"mappings":";;;AAGA,MAAa,2BAA2B,EAAE,KAAK;CAAC;CAAY;CAAU;AAAQ,CAAC;AAG/E,MAAa,uBAAuB,EACjC,OAAO;CACN,IAAI;CACJ,OAAO;CACP,WAAW;CACX,YAAY;CACZ,UAAU;CACV,WAAW,EAAE,OAAO,KAAK;CACzB,UAAU,gBAAgB,SAAS;CACnC,aAAa,EAAE,OAAO,KAAK,CAAC,CAAC,SAAS;CACtC,WAAW,EAAE,OAAO,KAAK;CACzB,WAAW,EAAE,OAAO,KAAK;AAC3B,CAAC,CAAC,CACD,OAAO;AAIV,MAAa,uBAAuB,EACjC,OAAO;CACN,WAAW;CACX,YAAY;CACZ,UAAU;AACZ,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,2BAA2B,EACrC,OAAO;CACN,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC3B,WAAW,EAAE,QAAQ,CAAC,CAAC,SAAS;AAClC,CAAC,CAAC,CACD,SAAS,eAAe;AAG3B,MAAa,4BAA4B,EACtC,OAAO;CACN,WAAW;CACX,YAAY;CACZ,SAAS,EAAE,MAAM,wBAAwB;AAC3C,CAAC,CAAC,CACD,OAAO"}
1
+ {"version":3,"file":"progress.js","names":[],"sources":["../../../src/types/schemas/progress.ts"],"sourcesContent":["import { z } from 'zod';\nimport { idSchema, jsonValueSchema } from './shared.js';\n\nexport const progressTargetTypeSchema = z.enum(['activity', 'module', 'course']);\nexport type ProgressTargetType = z.infer<typeof progressTargetTypeSchema>;\n\nexport const progressRecordSchema = z\n .object({\n id: idSchema,\n orgId: idSchema,\n orgUserId: idSchema,\n targetType: progressTargetTypeSchema,\n targetId: idSchema,\n startedAt: z.coerce.date(),\n position: jsonValueSchema.nullable(),\n completedAt: z.coerce.date().nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type ProgressRecord = z.output<typeof progressRecordSchema>;\nexport type ProgressRecordInput = z.input<typeof progressRecordSchema>;\n\nexport const progressTargetSchema = z\n .object({\n orgUserId: idSchema,\n targetType: progressTargetTypeSchema,\n targetId: idSchema,\n })\n .strict();\nexport type ProgressTarget = z.infer<typeof progressTargetSchema>;\n\nexport const progressReportItemSchema = z\n .object({\n asset: z.string().optional(),\n completed: z.boolean().optional(),\n })\n .catchall(jsonValueSchema);\nexport type ProgressReportItem = z.infer<typeof progressReportItemSchema>;\n\nexport const reportProgressInputSchema = z\n .object({\n activityId: idSchema,\n reports: z.array(progressReportItemSchema),\n })\n .strict();\nexport type ReportProgressInput = z.infer<typeof reportProgressInputSchema>;\n"],"mappings":";;;AAGA,MAAa,2BAA2B,EAAE,KAAK;CAAC;CAAY;CAAU;AAAQ,CAAC;AAG/E,MAAa,uBAAuB,EACjC,OAAO;CACN,IAAI;CACJ,OAAO;CACP,WAAW;CACX,YAAY;CACZ,UAAU;CACV,WAAW,EAAE,OAAO,KAAK;CACzB,UAAU,gBAAgB,SAAS;CACnC,aAAa,EAAE,OAAO,KAAK,CAAC,CAAC,SAAS;CACtC,WAAW,EAAE,OAAO,KAAK;CACzB,WAAW,EAAE,OAAO,KAAK;AAC3B,CAAC,CAAC,CACD,OAAO;AAIV,MAAa,uBAAuB,EACjC,OAAO;CACN,WAAW;CACX,YAAY;CACZ,UAAU;AACZ,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,2BAA2B,EACrC,OAAO;CACN,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC3B,WAAW,EAAE,QAAQ,CAAC,CAAC,SAAS;AAClC,CAAC,CAAC,CACD,SAAS,eAAe;AAG3B,MAAa,4BAA4B,EACtC,OAAO;CACN,YAAY;CACZ,SAAS,EAAE,MAAM,wBAAwB;AAC3C,CAAC,CAAC,CACD,OAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-lms/core",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -1,19 +0,0 @@
1
- import { Role } from "../types/schemas/organizations.js";
2
- import { Permission } from "./roles.js";
3
- //#region src/organizations/access-scopes.d.ts
4
- declare const ACCESS_SCOPES: readonly ["courses:read", "courses:write", "courses:delete", "downloads:read", "downloads:write", "downloads:delete", "bundles:read", "bundles:write", "bundles:delete", "media:read", "students:read", "students:invite", "access:read", "access:write", "analytics:read", "automations:read", "automations:write", "automations:delete", "comments:read", "comments:moderate", "communities:read", "communities:write", "communities:delete", "community_members:read", "community_members:write", "community_moderation:read", "community_moderation:write"];
5
- type AccessScope = (typeof ACCESS_SCOPES)[number];
6
- declare const SCOPE_PERMISSION: Record<AccessScope, Permission | null>;
7
- type ScopeOption = {
8
- scope: AccessScope;
9
- allowed: boolean;
10
- };
11
- declare function isAccessScope(value: string): value is AccessScope;
12
- declare function isDeleteScope(scope: AccessScope): boolean;
13
- declare function roleHoldsScope(role: Role, scope: AccessScope): boolean;
14
- declare function scopesForRole(role: Role): AccessScope[];
15
- declare function scopeOptions(role: Role): ScopeOption[];
16
- declare function assertRoleHoldsScopes(role: Role, scopes: readonly AccessScope[]): void;
17
- //#endregion
18
- export { ACCESS_SCOPES, AccessScope, SCOPE_PERMISSION, ScopeOption, assertRoleHoldsScopes, isAccessScope, isDeleteScope, roleHoldsScope, scopeOptions, scopesForRole };
19
- //# sourceMappingURL=access-scopes.d.ts.map
@@ -1,89 +0,0 @@
1
- import { ForbiddenError } from "../shared/errors.js";
2
- import { capability, isStaffRole } from "./roles.js";
3
- //#region src/organizations/access-scopes.ts
4
- const ACCESS_SCOPES = [
5
- "courses:read",
6
- "courses:write",
7
- "courses:delete",
8
- "downloads:read",
9
- "downloads:write",
10
- "downloads:delete",
11
- "bundles:read",
12
- "bundles:write",
13
- "bundles:delete",
14
- "media:read",
15
- "students:read",
16
- "students:invite",
17
- "access:read",
18
- "access:write",
19
- "analytics:read",
20
- "automations:read",
21
- "automations:write",
22
- "automations:delete",
23
- "comments:read",
24
- "comments:moderate",
25
- "communities:read",
26
- "communities:write",
27
- "communities:delete",
28
- "community_members:read",
29
- "community_members:write",
30
- "community_moderation:read",
31
- "community_moderation:write"
32
- ];
33
- const SCOPE_PERMISSION = {
34
- "courses:read": null,
35
- "courses:write": "create_course",
36
- "courses:delete": "create_course",
37
- "downloads:read": null,
38
- "downloads:write": "create_course",
39
- "downloads:delete": "create_course",
40
- "bundles:read": null,
41
- "bundles:write": "create_course",
42
- "bundles:delete": "create_course",
43
- "media:read": null,
44
- "students:read": "view_student_progress",
45
- "students:invite": "manage_users",
46
- "access:read": "view_student_progress",
47
- "access:write": "manage_users",
48
- "analytics:read": "view_student_progress",
49
- "automations:read": null,
50
- "automations:write": "manage_org_settings",
51
- "automations:delete": "manage_org_settings",
52
- "comments:read": null,
53
- "comments:moderate": "edit_assigned_course",
54
- "communities:read": null,
55
- "communities:write": "create_course",
56
- "communities:delete": "create_course",
57
- "community_members:read": null,
58
- "community_members:write": "moderate",
59
- "community_moderation:read": null,
60
- "community_moderation:write": "moderate"
61
- };
62
- function isAccessScope(value) {
63
- return ACCESS_SCOPES.includes(value);
64
- }
65
- function isDeleteScope(scope) {
66
- return scope.endsWith(":delete");
67
- }
68
- function roleHoldsScope(role, scope) {
69
- if (!isStaffRole(role)) return false;
70
- const permission = SCOPE_PERMISSION[scope];
71
- return permission === null || capability(role, permission) === true;
72
- }
73
- function scopesForRole(role) {
74
- return ACCESS_SCOPES.filter((scope) => roleHoldsScope(role, scope));
75
- }
76
- function scopeOptions(role) {
77
- return ACCESS_SCOPES.map((scope) => ({
78
- scope,
79
- allowed: roleHoldsScope(role, scope)
80
- }));
81
- }
82
- function assertRoleHoldsScopes(role, scopes) {
83
- const missing = scopes.filter((scope) => !roleHoldsScope(role, scope));
84
- if (missing.length > 0) throw new ForbiddenError(`Your role cannot grant ${missing.join(", ")}`);
85
- }
86
- //#endregion
87
- export { ACCESS_SCOPES, SCOPE_PERMISSION, assertRoleHoldsScopes, isAccessScope, isDeleteScope, roleHoldsScope, scopeOptions, scopesForRole };
88
-
89
- //# sourceMappingURL=access-scopes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"access-scopes.js","names":[],"sources":["../../src/organizations/access-scopes.ts"],"sourcesContent":["import { ForbiddenError } from '../shared/errors.js';\nimport { capability, isStaffRole, type Permission, type Role } from './roles.js';\n\nexport const ACCESS_SCOPES = [\n 'courses:read',\n 'courses:write',\n 'courses:delete',\n 'downloads:read',\n 'downloads:write',\n 'downloads:delete',\n 'bundles:read',\n 'bundles:write',\n 'bundles:delete',\n 'media:read',\n 'students:read',\n 'students:invite',\n 'access:read',\n 'access:write',\n 'analytics:read',\n 'automations:read',\n 'automations:write',\n 'automations:delete',\n 'comments:read',\n 'comments:moderate',\n 'communities:read',\n 'communities:write',\n 'communities:delete',\n 'community_members:read',\n 'community_members:write',\n 'community_moderation:read',\n 'community_moderation:write',\n] as const;\n\nexport type AccessScope = (typeof ACCESS_SCOPES)[number];\n\nexport const SCOPE_PERMISSION: Record<AccessScope, Permission | null> = {\n 'courses:read': null,\n 'courses:write': 'create_course',\n 'courses:delete': 'create_course',\n 'downloads:read': null,\n 'downloads:write': 'create_course',\n 'downloads:delete': 'create_course',\n 'bundles:read': null,\n 'bundles:write': 'create_course',\n 'bundles:delete': 'create_course',\n 'media:read': null,\n 'students:read': 'view_student_progress',\n 'students:invite': 'manage_users',\n 'access:read': 'view_student_progress',\n 'access:write': 'manage_users',\n 'analytics:read': 'view_student_progress',\n 'automations:read': null,\n 'automations:write': 'manage_org_settings',\n 'automations:delete': 'manage_org_settings',\n 'comments:read': null,\n 'comments:moderate': 'edit_assigned_course',\n 'communities:read': null,\n 'communities:write': 'create_course',\n 'communities:delete': 'create_course',\n 'community_members:read': null,\n 'community_members:write': 'moderate',\n 'community_moderation:read': null,\n 'community_moderation:write': 'moderate',\n};\n\nexport type ScopeOption = { scope: AccessScope; allowed: boolean };\n\nexport function isAccessScope(value: string): value is AccessScope {\n return (ACCESS_SCOPES as readonly string[]).includes(value);\n}\n\nexport function isDeleteScope(scope: AccessScope): boolean {\n return scope.endsWith(':delete');\n}\n\nexport function roleHoldsScope(role: Role, scope: AccessScope): boolean {\n if (!isStaffRole(role)) {\n return false;\n }\n const permission = SCOPE_PERMISSION[scope];\n return permission === null || capability(role, permission) === true;\n}\n\nexport function scopesForRole(role: Role): AccessScope[] {\n return ACCESS_SCOPES.filter((scope) => roleHoldsScope(role, scope));\n}\n\nexport function scopeOptions(role: Role): ScopeOption[] {\n return ACCESS_SCOPES.map((scope) => ({ scope, allowed: roleHoldsScope(role, scope) }));\n}\n\nexport function assertRoleHoldsScopes(role: Role, scopes: readonly AccessScope[]): void {\n const missing = scopes.filter((scope) => !roleHoldsScope(role, scope));\n if (missing.length > 0) {\n throw new ForbiddenError(`Your role cannot grant ${missing.join(', ')}`);\n }\n}\n"],"mappings":";;;AAGA,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAIA,MAAa,mBAA2D;CACtE,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,kBAAkB;CAClB,mBAAmB;CACnB,oBAAoB;CACpB,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,cAAc;CACd,iBAAiB;CACjB,mBAAmB;CACnB,eAAe;CACf,gBAAgB;CAChB,kBAAkB;CAClB,oBAAoB;CACpB,qBAAqB;CACrB,sBAAsB;CACtB,iBAAiB;CACjB,qBAAqB;CACrB,oBAAoB;CACpB,qBAAqB;CACrB,sBAAsB;CACtB,0BAA0B;CAC1B,2BAA2B;CAC3B,6BAA6B;CAC7B,8BAA8B;AAChC;AAIA,SAAgB,cAAc,OAAqC;CACjE,OAAQ,cAAoC,SAAS,KAAK;AAC5D;AAEA,SAAgB,cAAc,OAA6B;CACzD,OAAO,MAAM,SAAS,SAAS;AACjC;AAEA,SAAgB,eAAe,MAAY,OAA6B;CACtE,IAAI,CAAC,YAAY,IAAI,GACnB,OAAO;CAET,MAAM,aAAa,iBAAiB;CACpC,OAAO,eAAe,QAAQ,WAAW,MAAM,UAAU,MAAM;AACjE;AAEA,SAAgB,cAAc,MAA2B;CACvD,OAAO,cAAc,QAAQ,UAAU,eAAe,MAAM,KAAK,CAAC;AACpE;AAEA,SAAgB,aAAa,MAA2B;CACtD,OAAO,cAAc,KAAK,WAAW;EAAE;EAAO,SAAS,eAAe,MAAM,KAAK;CAAE,EAAE;AACvF;AAEA,SAAgB,sBAAsB,MAAY,QAAsC;CACtF,MAAM,UAAU,OAAO,QAAQ,UAAU,CAAC,eAAe,MAAM,KAAK,CAAC;CACrE,IAAI,QAAQ,SAAS,GACnB,MAAM,IAAI,eAAe,0BAA0B,QAAQ,KAAK,IAAI,GAAG;AAE3E"}
@@ -1,19 +0,0 @@
1
- import { Role } from "../types/schemas/organizations.js";
2
- import "../types/index.js";
3
- //#region src/organizations/roles.d.ts
4
- declare const ROLES: readonly ["owner", "admin", "instructor", "moderator", "student"];
5
- type StaffRole = 'owner' | 'admin' | 'instructor';
6
- declare const STAFF_ROLES: readonly ["owner", "admin", "instructor"];
7
- type TeamRole = Exclude<Role, 'student'>;
8
- declare function isRole(value: string): value is Role;
9
- declare function isStaffRole(value: string): value is StaffRole;
10
- declare function parseRole(value: string): Role;
11
- type Permission = 'manage_billing' | 'manage_org_settings' | 'manage_users' | 'create_course' | 'edit_assigned_course' | 'view_student_progress' | 'moderate' | 'consume_content';
12
- type Capability = true | 'assigned' | 'enrolled';
13
- declare function capability(role: Role, permission: Permission): Capability | false;
14
- declare function canModerate(role: Role): boolean;
15
- declare function normalizeRole(raw: string): Role;
16
- declare const STUDENT_ROLE = "student";
17
- //#endregion
18
- export { Capability, Permission, ROLES, type Role, STAFF_ROLES, STUDENT_ROLE, StaffRole, TeamRole, canModerate, capability, isRole, isStaffRole, normalizeRole, parseRole };
19
- //# sourceMappingURL=roles.d.ts.map