@headless-lms/core 0.1.0 → 0.3.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 +90 -9
  2. package/dist/assets/events.js +19 -3
  3. package/dist/assets/events.js.map +1 -1
  4. package/dist/assets/file-urls.d.ts +20 -0
  5. package/dist/assets/file-urls.js +25 -0
  6. package/dist/assets/file-urls.js.map +1 -0
  7. package/dist/assets/index.d.ts +5 -4
  8. package/dist/assets/index.js +3 -2
  9. package/dist/assets/model.d.ts +2 -2
  10. package/dist/assets/ports.d.ts +45 -15
  11. package/dist/assets/service.d.ts +39 -7
  12. package/dist/assets/service.js +292 -37
  13. package/dist/assets/service.js.map +1 -1
  14. package/dist/automations/actions.d.ts +12 -15
  15. package/dist/automations/actions.js +188 -30
  16. package/dist/automations/actions.js.map +1 -1
  17. package/dist/automations/catalog.d.ts +5 -1
  18. package/dist/automations/catalog.js +514 -197
  19. package/dist/automations/catalog.js.map +1 -1
  20. package/dist/automations/community-derivations.d.ts +14 -0
  21. package/dist/automations/community-derivations.js +439 -0
  22. package/dist/automations/community-derivations.js.map +1 -0
  23. package/dist/automations/community-mail.d.ts +112 -0
  24. package/dist/automations/community-mail.js +90 -0
  25. package/dist/automations/community-mail.js.map +1 -0
  26. package/dist/automations/community-notifications.d.ts +16 -0
  27. package/dist/automations/community-notifications.js +84 -0
  28. package/dist/automations/community-notifications.js.map +1 -0
  29. package/dist/automations/events.d.ts +74 -24
  30. package/dist/automations/events.js +5 -5
  31. package/dist/automations/events.js.map +1 -1
  32. package/dist/automations/index.d.ts +7 -5
  33. package/dist/automations/index.js +3 -2
  34. package/dist/automations/model.d.ts +20 -3
  35. package/dist/automations/model.js +36 -3
  36. package/dist/automations/model.js.map +1 -1
  37. package/dist/automations/ports.d.ts +27 -8
  38. package/dist/automations/schedule.d.ts +6 -0
  39. package/dist/automations/schedule.js +41 -0
  40. package/dist/automations/schedule.js.map +1 -0
  41. package/dist/automations/seeds.d.ts +17 -0
  42. package/dist/automations/seeds.js +235 -0
  43. package/dist/automations/seeds.js.map +1 -0
  44. package/dist/automations/service.d.ts +41 -6
  45. package/dist/automations/service.js +542 -59
  46. package/dist/automations/service.js.map +1 -1
  47. package/dist/automations/types.d.ts +2 -2
  48. package/dist/automations/webhook-signing.d.ts +7 -0
  49. package/dist/automations/webhook-signing.js +22 -0
  50. package/dist/automations/webhook-signing.js.map +1 -0
  51. package/dist/content/events.d.ts +1013 -25
  52. package/dist/content/events.js +168 -19
  53. package/dist/content/events.js.map +1 -1
  54. package/dist/content/index.d.ts +5 -5
  55. package/dist/content/index.js +2 -2
  56. package/dist/content/model.d.ts +2 -2
  57. package/dist/content/ports.d.ts +109 -25
  58. package/dist/content/service.d.ts +68 -23
  59. package/dist/content/service.js +647 -60
  60. package/dist/content/service.js.map +1 -1
  61. package/dist/content/types.d.ts +2 -2
  62. package/dist/discussion/authors.d.ts +10 -0
  63. package/dist/discussion/authors.js +23 -0
  64. package/dist/discussion/authors.js.map +1 -0
  65. package/dist/discussion/chats.d.ts +104 -0
  66. package/dist/discussion/chats.js +798 -0
  67. package/dist/discussion/chats.js.map +1 -0
  68. package/dist/discussion/events.d.ts +633 -14
  69. package/dist/discussion/events.js +134 -5
  70. package/dist/discussion/events.js.map +1 -1
  71. package/dist/discussion/index.d.ts +7 -3
  72. package/dist/discussion/index.js +4 -1
  73. package/dist/discussion/model.d.ts +1 -2
  74. package/dist/discussion/ports.d.ts +288 -27
  75. package/dist/discussion/ports.js +6 -1
  76. package/dist/discussion/ports.js.map +1 -0
  77. package/dist/discussion/posts.d.ts +103 -0
  78. package/dist/discussion/posts.js +723 -0
  79. package/dist/discussion/posts.js.map +1 -0
  80. package/dist/discussion/service.d.ts +33 -11
  81. package/dist/discussion/service.js +297 -81
  82. package/dist/discussion/service.js.map +1 -1
  83. package/dist/entitlements/events.d.ts +264 -13
  84. package/dist/entitlements/events.js +49 -5
  85. package/dist/entitlements/events.js.map +1 -1
  86. package/dist/entitlements/index.d.ts +5 -4
  87. package/dist/entitlements/index.js +2 -1
  88. package/dist/entitlements/model.d.ts +3 -2
  89. package/dist/entitlements/ports.d.ts +124 -11
  90. package/dist/entitlements/rules.d.ts +12 -0
  91. package/dist/entitlements/rules.js +17 -0
  92. package/dist/entitlements/rules.js.map +1 -0
  93. package/dist/entitlements/service.d.ts +54 -3
  94. package/dist/entitlements/service.js +473 -2
  95. package/dist/entitlements/service.js.map +1 -1
  96. package/dist/identity/access.d.ts +6 -0
  97. package/dist/identity/access.js +7 -0
  98. package/dist/identity/access.js.map +1 -0
  99. package/dist/identity/events.d.ts +17 -3
  100. package/dist/identity/events.js +12 -2
  101. package/dist/identity/events.js.map +1 -1
  102. package/dist/identity/index.d.ts +6 -4
  103. package/dist/identity/index.js +3 -1
  104. package/dist/identity/model.d.ts +2 -1
  105. package/dist/identity/notifications.d.ts +27 -0
  106. package/dist/identity/notifications.js +101 -0
  107. package/dist/identity/notifications.js.map +1 -0
  108. package/dist/identity/ports.d.ts +76 -3
  109. package/dist/identity/service.d.ts +17 -3
  110. package/dist/identity/service.js +73 -5
  111. package/dist/identity/service.js.map +1 -1
  112. package/dist/integrations/events.d.ts +27 -3
  113. package/dist/integrations/events.js +15 -3
  114. package/dist/integrations/events.js.map +1 -1
  115. package/dist/integrations/model.js +1 -1
  116. package/dist/integrations/model.js.map +1 -1
  117. package/dist/integrations/service.js +2 -2
  118. package/dist/integrations/service.js.map +1 -1
  119. package/dist/organizations/access-scopes.d.ts +19 -0
  120. package/dist/organizations/access-scopes.js +89 -0
  121. package/dist/organizations/access-scopes.js.map +1 -0
  122. package/dist/organizations/events.d.ts +234 -25
  123. package/dist/organizations/events.js +58 -9
  124. package/dist/organizations/events.js.map +1 -1
  125. package/dist/organizations/index.d.ts +8 -7
  126. package/dist/organizations/index.js +4 -3
  127. package/dist/organizations/members.d.ts +8 -5
  128. package/dist/organizations/members.js.map +1 -1
  129. package/dist/organizations/ports.d.ts +20 -21
  130. package/dist/organizations/roles.d.ts +6 -10
  131. package/dist/organizations/roles.js +19 -7
  132. package/dist/organizations/roles.js.map +1 -1
  133. package/dist/organizations/service.d.ts +28 -14
  134. package/dist/organizations/service.js +274 -105
  135. package/dist/organizations/service.js.map +1 -1
  136. package/dist/organizations/types.d.ts +2 -11
  137. package/dist/progress/events.d.ts +34 -2
  138. package/dist/progress/events.js +15 -2
  139. package/dist/progress/events.js.map +1 -1
  140. package/dist/progress/index.d.ts +2 -2
  141. package/dist/progress/ports.d.ts +6 -1
  142. package/dist/progress/service.d.ts +5 -3
  143. package/dist/progress/service.js +9 -3
  144. package/dist/progress/service.js.map +1 -1
  145. package/dist/reporting/admin/index.d.ts +4 -0
  146. package/dist/reporting/admin/index.js +2 -0
  147. package/dist/reporting/admin/model.d.ts +108 -0
  148. package/dist/reporting/admin/ports.d.ts +27 -0
  149. package/dist/reporting/admin/service.d.ts +22 -0
  150. package/dist/reporting/admin/service.js +38 -0
  151. package/dist/reporting/admin/service.js.map +1 -0
  152. package/dist/reporting/member/index.d.ts +5 -0
  153. package/dist/reporting/member/index.js +2 -0
  154. package/dist/reporting/member/model.d.ts +124 -0
  155. package/dist/reporting/member/ports.d.ts +45 -0
  156. package/dist/reporting/member/service.d.ts +73 -0
  157. package/dist/reporting/member/service.js +286 -0
  158. package/dist/reporting/member/service.js.map +1 -0
  159. package/dist/shared/actor.d.ts +9 -0
  160. package/dist/shared/errors.d.ts +7 -1
  161. package/dist/shared/errors.js +10 -1
  162. package/dist/shared/errors.js.map +1 -1
  163. package/dist/shared/events.d.ts +5 -3
  164. package/dist/shared/events.js +1 -0
  165. package/dist/shared/events.js.map +1 -1
  166. package/dist/shared/id.d.ts +12 -0
  167. package/dist/shared/id.js +13 -1
  168. package/dist/shared/id.js.map +1 -1
  169. package/dist/shared/mailer.d.ts +6 -1
  170. package/dist/shared/mailer.js.map +1 -1
  171. package/dist/shared/network.d.ts +10 -0
  172. package/dist/shared/network.js +211 -0
  173. package/dist/shared/network.js.map +1 -0
  174. package/dist/shared/settings.js.map +1 -1
  175. package/dist/types/assets.d.ts +2 -2
  176. package/dist/types/automations.d.ts +21 -2
  177. package/dist/types/content.d.ts +2 -2
  178. package/dist/types/discussion.d.ts +12 -3
  179. package/dist/types/email-templates.d.ts +124 -1
  180. package/dist/types/entitlements.d.ts +2 -2
  181. package/dist/types/events.d.ts +3 -3
  182. package/dist/types/identity.d.ts +48 -2
  183. package/dist/types/index.d.ts +10 -10
  184. package/dist/types/organizations.d.ts +2 -2
  185. package/dist/types/ports.d.ts +7 -1
  186. package/dist/types/schemas/assets.d.ts +67 -36
  187. package/dist/types/schemas/assets.js +19 -13
  188. package/dist/types/schemas/assets.js.map +1 -1
  189. package/dist/types/schemas/automations.d.ts +88 -4
  190. package/dist/types/schemas/automations.js +46 -6
  191. package/dist/types/schemas/automations.js.map +1 -1
  192. package/dist/types/schemas/content.d.ts +385 -20
  193. package/dist/types/schemas/content.js +178 -15
  194. package/dist/types/schemas/content.js.map +1 -1
  195. package/dist/types/schemas/credentials.js.map +1 -1
  196. package/dist/types/schemas/discussion.d.ts +379 -4
  197. package/dist/types/schemas/discussion.js +209 -7
  198. package/dist/types/schemas/discussion.js.map +1 -1
  199. package/dist/types/schemas/entitlements.d.ts +44 -4
  200. package/dist/types/schemas/entitlements.js +32 -4
  201. package/dist/types/schemas/entitlements.js.map +1 -1
  202. package/dist/types/schemas/identity.d.ts +115 -5
  203. package/dist/types/schemas/identity.js +59 -6
  204. package/dist/types/schemas/identity.js.map +1 -1
  205. package/dist/types/schemas/index.d.ts +9 -9
  206. package/dist/types/schemas/index.js +9 -9
  207. package/dist/types/schemas/integrations.js.map +1 -1
  208. package/dist/types/schemas/organizations.d.ts +27 -5
  209. package/dist/types/schemas/organizations.js +14 -7
  210. package/dist/types/schemas/organizations.js.map +1 -1
  211. package/dist/types/schemas/outbox.d.ts +1 -0
  212. package/dist/types/schemas/outbox.js +1 -0
  213. package/dist/types/schemas/outbox.js.map +1 -1
  214. package/dist/types/schemas/progress.d.ts +1 -0
  215. package/dist/types/schemas/progress.js +1 -0
  216. package/dist/types/schemas/progress.js.map +1 -1
  217. package/dist/types/schemas/settings.js.map +1 -1
  218. package/dist/types/schemas/shared.d.ts +4 -1
  219. package/dist/types/schemas/shared.js +7 -1
  220. package/dist/types/schemas/shared.js.map +1 -1
  221. package/dist/types/shared.d.ts +1 -1
  222. package/package.json +2 -2
  223. package/dist/reporting/dashboard/index.d.ts +0 -4
  224. package/dist/reporting/dashboard/index.js +0 -2
  225. package/dist/reporting/dashboard/model.d.ts +0 -14
  226. package/dist/reporting/dashboard/ports.d.ts +0 -13
  227. package/dist/reporting/dashboard/service.d.ts +0 -19
  228. package/dist/reporting/dashboard/service.js +0 -20
  229. package/dist/reporting/dashboard/service.js.map +0 -1
  230. package/dist/reporting/learn/index.d.ts +0 -5
  231. package/dist/reporting/learn/index.js +0 -2
  232. package/dist/reporting/learn/model.d.ts +0 -23
  233. package/dist/reporting/learn/ports.d.ts +0 -42
  234. package/dist/reporting/learn/service.d.ts +0 -48
  235. package/dist/reporting/learn/service.js +0 -111
  236. package/dist/reporting/learn/service.js.map +0 -1
  237. package/dist/reporting/students/index.d.ts +0 -4
  238. package/dist/reporting/students/index.js +0 -2
  239. package/dist/reporting/students/model.d.ts +0 -31
  240. package/dist/reporting/students/ports.d.ts +0 -13
  241. package/dist/reporting/students/ports.js +0 -1
  242. package/dist/reporting/students/service.d.ts +0 -19
  243. package/dist/reporting/students/service.js +0 -20
  244. package/dist/reporting/students/service.js.map +0 -1
  245. /package/dist/reporting/{dashboard → admin}/model.js +0 -0
  246. /package/dist/reporting/{dashboard → admin}/ports.js +0 -0
  247. /package/dist/reporting/{learn → member}/model.js +0 -0
  248. /package/dist/reporting/{learn → member}/ports.js +0 -0
  249. /package/dist/{reporting/students/model.js → shared/actor.js} +0 -0
@@ -1,3 +1,4 @@
1
+ import { ContentType } from "./schemas/content.js";
1
2
  //#region src/types/email-templates.d.ts
2
3
  /** Branding threaded into every template. */
3
4
  interface TemplateContext {
@@ -7,7 +8,6 @@ interface TemplateContext {
7
8
  baseUrl: string;
8
9
  /** Origin student-facing links resolve against (the student portal URL). */
9
10
  studentPortalUrl: string;
10
- logoUrl?: string;
11
11
  }
12
12
  /** A fully rendered email, ready for an EmailSender. */
13
13
  interface EmailContent {
@@ -32,12 +32,14 @@ interface EmailTemplateParams {
32
32
  passwordReset: {
33
33
  resetUrl: string;
34
34
  };
35
+ passwordChanged: Record<string, never>;
35
36
  emailVerification: {
36
37
  verifyUrl: string;
37
38
  };
38
39
  accessGranted: {
39
40
  contentTitle: string;
40
41
  contentId: string;
42
+ contentType: ContentType;
41
43
  };
42
44
  accessRevoked: {
43
45
  contentTitle: string;
@@ -45,6 +47,127 @@ interface EmailTemplateParams {
45
47
  courseCompleted: {
46
48
  courseTitle: string;
47
49
  };
50
+ welcomeToCommunity: {
51
+ communityTitle: string;
52
+ communityId: string;
53
+ spaceNames: string[];
54
+ };
55
+ membershipEndingSoon: {
56
+ communityTitle: string;
57
+ communityId: string;
58
+ expiresAt: string;
59
+ };
60
+ membershipEnded: {
61
+ communityTitle: string;
62
+ communityId: string;
63
+ };
64
+ newPostInSpace: {
65
+ spaceName: string;
66
+ postTitle: string;
67
+ authorName: string;
68
+ excerpt: string;
69
+ postId: string;
70
+ communityId: string;
71
+ };
72
+ yourPostWasPublished: {
73
+ postTitle: string;
74
+ spaceName: string;
75
+ postId: string;
76
+ communityId: string;
77
+ };
78
+ yourPostWasRemoved: {
79
+ postTitle: string;
80
+ spaceName: string;
81
+ spaceId: string;
82
+ communityId: string;
83
+ };
84
+ newCommentOnPost: {
85
+ postTitle: string;
86
+ commenterName: string;
87
+ excerpt: string;
88
+ commentId: string;
89
+ postId: string;
90
+ communityId: string;
91
+ };
92
+ replyToYourComment: {
93
+ postTitle: string;
94
+ commenterName: string;
95
+ excerpt: string;
96
+ commentId: string;
97
+ postId: string;
98
+ communityId: string;
99
+ };
100
+ yourCommentWasRemoved: {
101
+ postTitle: string;
102
+ postId: string;
103
+ communityId: string;
104
+ };
105
+ requestApproved: {
106
+ spaceName: string;
107
+ spaceId: string;
108
+ communityId: string;
109
+ };
110
+ requestDeclined: {
111
+ spaceName: string;
112
+ communityId: string;
113
+ };
114
+ invitedToSpace: {
115
+ spaceName: string;
116
+ inviterName: string;
117
+ spaceId: string;
118
+ communityId: string;
119
+ };
120
+ messageRequest: {
121
+ senderName: string;
122
+ excerpt: string;
123
+ chatId: string;
124
+ communityId: string;
125
+ };
126
+ newMessage: {
127
+ senderName: string;
128
+ chatTitle: string;
129
+ excerpt: string;
130
+ chatId: string;
131
+ communityId: string;
132
+ };
133
+ addedToGroupChat: {
134
+ adderName: string;
135
+ participantNames: string[];
136
+ chatId: string;
137
+ communityId: string;
138
+ };
139
+ youAreNowAModerator: {
140
+ communityTitles: string[];
141
+ };
142
+ digest: {
143
+ communityTitle: string;
144
+ communityId: string;
145
+ };
146
+ postAwaitingReview: {
147
+ spaceName: string;
148
+ postTitle: string;
149
+ authorName: string;
150
+ spaceId: string;
151
+ communityId: string;
152
+ };
153
+ joinRequest: {
154
+ spaceName: string;
155
+ memberName: string;
156
+ seatsLeft: string;
157
+ spaceId: string;
158
+ communityId: string;
159
+ };
160
+ somethingWasFlagged: {
161
+ spaceName: string;
162
+ excerpt: string;
163
+ reason: string;
164
+ spaceId: string;
165
+ communityId: string;
166
+ };
167
+ messageWasFlagged: {
168
+ reason: string;
169
+ communityId: string;
170
+ };
48
171
  }
49
172
  type EmailTemplateId = keyof EmailTemplateParams;
50
173
  /** Resolves a template + data to rendered content. Deployment-swappable;
@@ -1,3 +1,3 @@
1
1
  import { Page } from "./shared.js";
2
- import { Entitlement, EntitlementStatus, EntitlementsQuery, GrantEntitlementInput } from "./schemas/entitlements.js";
3
- export type { Entitlement, EntitlementStatus, EntitlementsQuery, GrantEntitlementInput, Page };
2
+ import { Entitlement, EntitlementStatus, EntitlementsQuery, GrantEntitlementInput, SpaceMember, SpaceMemberSource, SpaceMemberStatus } from "./schemas/entitlements.js";
3
+ export type { Entitlement, EntitlementStatus, EntitlementsQuery, GrantEntitlementInput, Page, SpaceMember, SpaceMemberSource, SpaceMemberStatus };
@@ -12,9 +12,9 @@ type EventParseResult<E extends DomainEvent> = {
12
12
  readonly success: false;
13
13
  readonly error: Error;
14
14
  };
15
- interface EventDefinition<E extends DomainEvent, TMakeData = E["data"]> {
16
- readonly type: E["type"];
17
- readonly version: E["version"];
15
+ interface EventDefinition<E extends DomainEvent, TMakeData = E['data']> {
16
+ readonly type: E['type'];
17
+ readonly version: E['version'];
18
18
  make(input: MakeEventInput<TMakeData>): ContractNewDomainEvent<E>;
19
19
  is(event: unknown): event is E;
20
20
  parse(event: unknown): E;
@@ -1,4 +1,4 @@
1
- import { CreateUserInput, ProvisionUserInput, UpdateUserInput } from "./schemas/identity.js";
1
+ import { CreateUserInput, Notification, NotificationKind, NotificationPreference, ProvisionUserInput, UpdateUserInput, UserProfile, UserProfileView } from "./schemas/identity.js";
2
2
  //#region src/types/identity.d.ts
3
3
  interface User {
4
4
  readonly id: string;
@@ -32,6 +32,52 @@ interface AccountProvisioner {
32
32
  delete(externalId: string): Promise<void>;
33
33
  }
34
34
  type UserId = string;
35
+ type HeaderBag = Record<string, string | string[] | undefined>;
36
+ type AccessGrant = {
37
+ userId: string;
38
+ orgId: string;
39
+ scopes: string[];
40
+ clientId: string;
41
+ };
42
+ type AccessRequest = {
43
+ method: string;
44
+ url: string;
45
+ headers: HeaderBag;
46
+ };
47
+ interface AccessTokenVerifier {
48
+ verifyAccess(request: AccessRequest): Promise<AccessGrant | null>;
49
+ }
50
+ type ConnectedApp = {
51
+ clientId: string;
52
+ name: string;
53
+ iconUrl: string | null;
54
+ scopes: string[];
55
+ connectedAt: Date;
56
+ };
57
+ type ApiKeySummary = {
58
+ id: string;
59
+ name: string | null;
60
+ start: string | null;
61
+ scopes: string[];
62
+ createdAt: Date;
63
+ lastUsedAt: Date | null;
64
+ };
65
+ type CreatedApiKey = ApiKeySummary & {
66
+ key: string;
67
+ };
68
+ type NewApiKey = {
69
+ authUserId: string;
70
+ orgId: string;
71
+ name: string;
72
+ scopes: string[];
73
+ };
74
+ interface AppAccessAdmin {
75
+ listConnectedApps(headers: HeaderBag, orgId: string): Promise<ConnectedApp[]>;
76
+ revokeConnectedApp(headers: HeaderBag, orgId: string, clientId: string): Promise<void>;
77
+ listApiKeys(headers: HeaderBag, orgId: string): Promise<ApiKeySummary[]>;
78
+ createApiKey(input: NewApiKey): Promise<CreatedApiKey>;
79
+ deleteApiKey(headers: HeaderBag, orgId: string, keyId: string): Promise<void>;
80
+ }
35
81
  //#endregion
36
- export { AccountProvisioner, ActiveSession, type CreateUserInput, type ProvisionUserInput, SessionVerifier, type UpdateUserInput, User, UserId };
82
+ export { AccessGrant, AccessRequest, AccessTokenVerifier, AccountProvisioner, ActiveSession, ApiKeySummary, AppAccessAdmin, ConnectedApp, type CreateUserInput, CreatedApiKey, HeaderBag, NewApiKey, type Notification, type NotificationKind, type NotificationPreference, type ProvisionUserInput, SessionVerifier, type UpdateUserInput, User, UserId, type UserProfile, type UserProfileView };
37
83
  //# sourceMappingURL=identity.d.ts.map
@@ -1,23 +1,23 @@
1
1
  import { ContractNewDomainEvent, DomainEvent, EventMetadata, JsonValue, NewDomainEvent, Page } from "./shared.js";
2
2
  import { EventDefinition, EventParseResult, MakeEventInput } from "./events.js";
3
3
  import { EmailMessage, EmailSender, Logger, ObjectStorage, PresignDownloadInput, PresignedUpload, StoredObjectInfo } from "./ports.js";
4
+ import { Activity, ActivityAsset, ActivitySettings, ActivityView, AddDownloadAssetInput, AddSpaceLinkInput, Bundle, BundleItem, Community, CommunitySettings, CommunityStatus, CommunityView, ContentItem, ContentType, Course, CourseSettings, CourseStatus, CourseView, CreateBundleInput, CreateCommunityInput, CreateCourseInput, CreateDownloadInput, CreateSpaceInput, DmSettings, Download, DownloadAsset, DownloadFile, DownloadStatus, DownloadView, ListBundlesQuery, ListCommunitiesQuery, ListCoursesQuery, ListDownloadsQuery, Module, PatchDmSettingsInput, ReorderDownloadAssetsInput, SaveActivityInput, SetSpaceTopicsInput, Space, SpaceAccessRule, SpaceDetail, SpaceLink, SpaceSettings, SpaceTopic, UpdateBundleInput, UpdateCommunityInput, UpdateCourseInput, UpdateDownloadInput, UpdateSpaceInput } from "./schemas/content.js";
4
5
  import { EmailContent, EmailTemplateId, EmailTemplateParams, TemplateContext, TemplateRenderer } from "./email-templates.js";
5
- import { CreateUserInput, ProvisionUserInput, UpdateUserInput } from "./schemas/identity.js";
6
- import { AccountProvisioner, ActiveSession, SessionVerifier, User, UserId } from "./identity.js";
7
- import { AcceptInviteInput, AddOrgUserInput, CreateInviteInput, CreateOrgUserInput, Invite, InviteInput, InviteRole, NewOrganizationInput, OrgUser, OrgUserInput, OrgUserProfile, OrgUserStatus, Organization, OrganizationInput, Role } from "./schemas/organizations.js";
6
+ import { CreateUserInput, Notification, NotificationKind, NotificationPreference, ProvisionUserInput, UpdateUserInput, UserProfile, UserProfileView } from "./schemas/identity.js";
7
+ import { AccessGrant, AccessRequest, AccessTokenVerifier, AccountProvisioner, ActiveSession, ApiKeySummary, AppAccessAdmin, ConnectedApp, CreatedApiKey, HeaderBag, NewApiKey, SessionVerifier, User, UserId } from "./identity.js";
8
+ import { AcceptInviteInput, AddOrgUserInput, CreateInviteInput, CreateOrgUserInput, Invite, InviteInput, InviteRole, NewOrganizationInput, OrgUser, OrgUserInput, OrgUserProfile, OrgUserStatus, Organization, OrganizationInput, Role, UpdateOrgUserInput } from "./schemas/organizations.js";
8
9
  import { CreateOrganizationInput, InviteId, OrgUserId, OrganizationId } from "./organizations.js";
9
- import { Activity, ActivityAsset, ActivityCommentsRule, ActivitySettings, AddDownloadAssetInput, ContentItem, ContentType, Course, CourseSettings, CourseStatus, CreateCourseInput, CreateDownloadInput, Download, DownloadAsset, DownloadStatus, ListCoursesQuery, ListDownloadsQuery, Module, ReorderDownloadAssetsInput, SaveActivityInput, UpdateCourseInput, UpdateDownloadInput } from "./schemas/content.js";
10
10
  import "./content.js";
11
- import { Entitlement, EntitlementStatus, EntitlementsQuery, GrantEntitlementInput } from "./schemas/entitlements.js";
11
+ import { Entitlement, EntitlementStatus, EntitlementsQuery, GrantEntitlementInput, SpaceMember, SpaceMemberSource, SpaceMemberStatus } from "./schemas/entitlements.js";
12
12
  import "./entitlements.js";
13
13
  import { ProgressRecord, ProgressRecordInput, ProgressReportItem, ProgressTarget, ProgressTargetType, ReportProgressInput } from "./schemas/progress.js";
14
14
  import { ProgressId } from "./progress.js";
15
- import { Asset, AssetKind, AssetStatus, AssetsQuery, DownloadTicket, RequestUploadInput, UploadTicket } from "./schemas/assets.js";
15
+ import { Asset, AssetKind, AssetSource, AssetStatus, AssetUrls, AssetView, AssetsQuery, RequestUploadInput, UploadTicket } from "./schemas/assets.js";
16
16
  import "./assets.js";
17
17
  import { ConfigureInput, ConnectInput, Connection, Validation } from "./schemas/integrations.js";
18
18
  import { Action, ActionContext, Integration } from "./integrations.js";
19
- import { Automation, AutomationAction, AutomationActionResult, AutomationRun, AutomationRunStatus, AutomationRunsQuery, AutomationTrigger, AvailableAction, AvailableActions, AvailableTriggers, CreateAutomationInput, UpdateAutomationInput } from "./schemas/automations.js";
20
- import { AutomationDispatch, AutomationEngine, AutomationExecutor } from "./automations.js";
21
- import { CommentListItem, CommentReaction, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, ListCommentsQuery, ReactionCounts, ReactionEmoji } from "./schemas/discussion.js";
19
+ import { Automation, AutomationAction, AutomationActionResult, AutomationKind, AutomationRun, AutomationRunStatus, AutomationRunsQuery, AutomationSource, AutomationTrigger, AutomationsQuery, AvailableAction, AvailableActions, AvailableTriggers, CreateAutomationInput, CreateWebhookInput, CreatedWebhook, DeliverWebhookInput, UpdateAutomationInput, UpdateWebhookInput, Webhook, WebhookSecret } from "./schemas/automations.js";
20
+ import { AutomationDispatch, AutomationEngine, AutomationExecutor, ScheduledAutomation, WebhookRequest, WebhookResponse, WebhookSender } from "./automations.js";
21
+ import { ActivityCommentsRule, BlockedUser, Chat, ChatKind, ChatLastMessage, ChatStatus, ChatUser, CommentFlagResolution, CommentListItem, CommentReaction, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, FlaggedComment, ListCommentsQuery, Message, MessageAttachment, MessageFile, MessageFlag, MessageFlagResolution, MessageReaction, MessageView, Post, PostBookmark, PostFlag, PostFlagResolution, PostFollow, PostReaction, PostStatus, PostView, ReactionCounts, ReactionEmoji } from "./schemas/discussion.js";
22
22
  import { Comment, CommentAuthor, CommentReport } from "./discussion.js";
23
- export { type AcceptInviteInput, AccountProvisioner, Action, ActionContext, ActiveSession, type Activity, type ActivityAsset, type ActivityCommentsRule, type ActivitySettings, type AddDownloadAssetInput, type AddOrgUserInput, type Asset, type AssetKind, type AssetStatus, type AssetsQuery, type Automation, type AutomationAction, type AutomationActionResult, AutomationDispatch, AutomationEngine, AutomationExecutor, type AutomationRun, type AutomationRunStatus, type AutomationRunsQuery, type AutomationTrigger, type AvailableAction, type AvailableActions, type AvailableTriggers, Comment, CommentAuthor, type CommentListItem, type CommentReaction, CommentReport, type CommentReportSummary, type CommentSettings, type CommentStatus, type CommentView, type CommentsConfig, type ConfigureInput, type ConnectInput, type Connection, type ContentItem, type ContentType, ContractNewDomainEvent, type Course, type CourseSettings, type CourseStatus, type CreateAutomationInput, type CreateCourseInput, type CreateDownloadInput, type CreateInviteInput, type CreateOrgUserInput, CreateOrganizationInput, type CreateUserInput, DomainEvent, type Download, type DownloadAsset, type DownloadStatus, type DownloadTicket, EmailContent, EmailMessage, EmailSender, EmailTemplateId, EmailTemplateParams, type Entitlement, type EntitlementStatus, type EntitlementsQuery, EventDefinition, EventMetadata, EventParseResult, type GrantEntitlementInput, Integration, type Invite, InviteId, type InviteInput, type InviteRole, JsonValue, type ListCommentsQuery, type ListCoursesQuery, type ListDownloadsQuery, Logger, MakeEventInput, type Module, NewDomainEvent, type NewOrganizationInput, ObjectStorage, type OrgUser, OrgUserId, type OrgUserInput, type OrgUserProfile, type OrgUserStatus, type Organization, OrganizationId, type OrganizationInput, Page, PresignDownloadInput, PresignedUpload, ProgressId, type ProgressRecord, type ProgressRecordInput, type ProgressReportItem, type ProgressTarget, type ProgressTargetType, type ProvisionUserInput, type ReactionCounts, type ReactionEmoji, type ReorderDownloadAssetsInput, type ReportProgressInput, type RequestUploadInput, type Role, type SaveActivityInput, SessionVerifier, StoredObjectInfo, TemplateContext, TemplateRenderer, type UpdateAutomationInput, type UpdateCourseInput, type UpdateDownloadInput, type UpdateUserInput, type UploadTicket, User, UserId, type Validation };
23
+ export { type AcceptInviteInput, AccessGrant, AccessRequest, AccessTokenVerifier, AccountProvisioner, Action, ActionContext, ActiveSession, type Activity, type ActivityAsset, type ActivityCommentsRule, type ActivitySettings, type ActivityView, type AddDownloadAssetInput, type AddOrgUserInput, type AddSpaceLinkInput, ApiKeySummary, AppAccessAdmin, type Asset, type AssetKind, type AssetSource, type AssetStatus, type AssetUrls, type AssetView, type AssetsQuery, type Automation, type AutomationAction, type AutomationActionResult, AutomationDispatch, AutomationEngine, AutomationExecutor, type AutomationKind, type AutomationRun, type AutomationRunStatus, type AutomationRunsQuery, type AutomationSource, type AutomationTrigger, type AutomationsQuery, type AvailableAction, type AvailableActions, type AvailableTriggers, type BlockedUser, type Bundle, type BundleItem, type Chat, type ChatKind, type ChatLastMessage, type ChatStatus, type ChatUser, Comment, CommentAuthor, type CommentFlagResolution, type CommentListItem, type CommentReaction, CommentReport, type CommentReportSummary, type CommentSettings, type CommentStatus, type CommentView, type CommentsConfig, type Community, type CommunitySettings, type CommunityStatus, type CommunityView, type ConfigureInput, type ConnectInput, ConnectedApp, type Connection, type ContentItem, type ContentType, ContractNewDomainEvent, type Course, type CourseSettings, type CourseStatus, type CourseView, type CreateAutomationInput, type CreateBundleInput, type CreateCommunityInput, type CreateCourseInput, type CreateDownloadInput, type CreateInviteInput, type CreateOrgUserInput, CreateOrganizationInput, type CreateSpaceInput, type CreateUserInput, type CreateWebhookInput, CreatedApiKey, type CreatedWebhook, type DeliverWebhookInput, type DmSettings, DomainEvent, type Download, type DownloadAsset, type DownloadFile, type DownloadStatus, type DownloadView, EmailContent, EmailMessage, EmailSender, EmailTemplateId, EmailTemplateParams, type Entitlement, type EntitlementStatus, type EntitlementsQuery, EventDefinition, EventMetadata, EventParseResult, type FlaggedComment, type GrantEntitlementInput, HeaderBag, Integration, type Invite, InviteId, type InviteInput, type InviteRole, JsonValue, type ListBundlesQuery, type ListCommentsQuery, type ListCommunitiesQuery, type ListCoursesQuery, type ListDownloadsQuery, Logger, MakeEventInput, type Message, type MessageAttachment, type MessageFile, type MessageFlag, type MessageFlagResolution, type MessageReaction, type MessageView, type Module, NewApiKey, NewDomainEvent, type NewOrganizationInput, type Notification, type NotificationKind, type NotificationPreference, ObjectStorage, type OrgUser, OrgUserId, type OrgUserInput, type OrgUserProfile, type OrgUserStatus, type Organization, OrganizationId, type OrganizationInput, Page, type PatchDmSettingsInput, type Post, type PostBookmark, type PostFlag, type PostFlagResolution, type PostFollow, type PostReaction, type PostStatus, type PostView, PresignDownloadInput, PresignedUpload, ProgressId, type ProgressRecord, type ProgressRecordInput, type ProgressReportItem, type ProgressTarget, type ProgressTargetType, type ProvisionUserInput, type ReactionCounts, type ReactionEmoji, type ReorderDownloadAssetsInput, type ReportProgressInput, type RequestUploadInput, type Role, type SaveActivityInput, ScheduledAutomation, SessionVerifier, type SetSpaceTopicsInput, type Space, type SpaceAccessRule, type SpaceDetail, type SpaceLink, type SpaceMember, type SpaceMemberSource, type SpaceMemberStatus, type SpaceSettings, type SpaceTopic, StoredObjectInfo, TemplateContext, TemplateRenderer, type UpdateAutomationInput, type UpdateBundleInput, type UpdateCommunityInput, type UpdateCourseInput, type UpdateDownloadInput, type UpdateOrgUserInput, type UpdateSpaceInput, type UpdateUserInput, type UpdateWebhookInput, type UploadTicket, User, UserId, type UserProfile, type UserProfileView, type Validation, type Webhook, WebhookRequest, WebhookResponse, type WebhookSecret, WebhookSender };
@@ -1,4 +1,4 @@
1
- import { AcceptInviteInput, AddOrgUserInput, CreateInviteInput, CreateOrgUserInput, Invite, InviteInput, InviteRole, NewOrganizationInput, OrgUser, OrgUserInput, OrgUserProfile, OrgUserStatus, Organization, OrganizationInput, Role } from "./schemas/organizations.js";
1
+ import { AcceptInviteInput, AddOrgUserInput, CreateInviteInput, CreateOrgUserInput, Invite, InviteInput, InviteRole, NewOrganizationInput, OrgUser, OrgUserInput, OrgUserProfile, OrgUserStatus, Organization, OrganizationInput, Role, UpdateOrgUserInput } from "./schemas/organizations.js";
2
2
  //#region src/types/organizations.d.ts
3
3
  type OrganizationId = string;
4
4
  type OrgUserId = string;
@@ -11,5 +11,5 @@ interface CreateOrganizationInput {
11
11
  ownerId: string;
12
12
  }
13
13
  //#endregion
14
- export { type AcceptInviteInput, type AddOrgUserInput, type CreateInviteInput, type CreateOrgUserInput, CreateOrganizationInput, type Invite, InviteId, type InviteInput, type InviteRole, type NewOrganizationInput, type OrgUser, OrgUserId, type OrgUserInput, type OrgUserProfile, type OrgUserStatus, type Organization, OrganizationId, type OrganizationInput, type Role };
14
+ export { type AcceptInviteInput, type AddOrgUserInput, type CreateInviteInput, type CreateOrgUserInput, CreateOrganizationInput, type Invite, InviteId, type InviteInput, type InviteRole, type NewOrganizationInput, type OrgUser, OrgUserId, type OrgUserInput, type OrgUserProfile, type OrgUserStatus, type Organization, OrganizationId, type OrganizationInput, type Role, type UpdateOrgUserInput };
15
15
  //# sourceMappingURL=organizations.d.ts.map
@@ -20,7 +20,7 @@ interface EmailSender {
20
20
  /** A presigned URL the browser uses to PUT a file straight to the store. */
21
21
  interface PresignedUpload {
22
22
  url: string;
23
- method: "PUT";
23
+ method: 'PUT';
24
24
  key: string;
25
25
  expiresInSeconds: number;
26
26
  /** Headers the client must send on the PUT (e.g. Content-Type). */
@@ -39,6 +39,7 @@ interface PresignDownloadInput {
39
39
  downloadFilename?: string;
40
40
  }
41
41
  interface ObjectStorage {
42
+ readonly uploadExpirySeconds: number;
42
43
  /** Presigned URL for a direct browser upload (temporary, expiring). */
43
44
  presignUpload(input: {
44
45
  key: string;
@@ -49,6 +50,11 @@ interface ObjectStorage {
49
50
  presignDownload(input: PresignDownloadInput): Promise<string>;
50
51
  /** Object metadata, or null if it does not exist. */
51
52
  stat(key: string): Promise<StoredObjectInfo | null>;
53
+ list(prefix: string): Promise<StoredObjectInfo[]>;
54
+ copy(input: {
55
+ from: string;
56
+ to: string;
57
+ }): Promise<void>;
52
58
  /** Permanently remove an object. */
53
59
  remove(key: string): Promise<void>;
54
60
  }
@@ -1,11 +1,17 @@
1
1
  import { z } from "zod";
2
2
  //#region src/types/schemas/assets.d.ts
3
3
  declare const assetKindSchema: z.ZodEnum<{
4
+ image: "image";
4
5
  video: "video";
5
- download: "download";
6
- content: "content";
6
+ audio: "audio";
7
+ document: "document";
7
8
  }>;
8
9
  type AssetKind = z.infer<typeof assetKindSchema>;
10
+ declare const assetSourceSchema: z.ZodEnum<{
11
+ library: "library";
12
+ member: "member";
13
+ }>;
14
+ type AssetSource = z.infer<typeof assetSourceSchema>;
9
15
  declare const assetStatusSchema: z.ZodEnum<{
10
16
  pending: "pending";
11
17
  ready: "ready";
@@ -16,9 +22,14 @@ declare const assetSchema: z.ZodObject<{
16
22
  id: z.ZodString;
17
23
  key: z.ZodString;
18
24
  kind: z.ZodEnum<{
25
+ image: "image";
19
26
  video: "video";
20
- download: "download";
21
- content: "content";
27
+ audio: "audio";
28
+ document: "document";
29
+ }>;
30
+ source: z.ZodEnum<{
31
+ library: "library";
32
+ member: "member";
22
33
  }>;
23
34
  filename: z.ZodString;
24
35
  contentType: z.ZodString;
@@ -29,17 +40,47 @@ declare const assetSchema: z.ZodObject<{
29
40
  }>;
30
41
  uploadedBy: z.ZodString;
31
42
  createdAt: z.ZodCoercedDate<unknown>;
43
+ updatedAt: z.ZodCoercedDate<unknown>;
32
44
  }, z.core.$strict>;
33
45
  type Asset = z.output<typeof assetSchema>;
34
46
  type AssetInput = z.input<typeof assetSchema>;
47
+ declare const assetViewSchema: z.ZodObject<{
48
+ orgId: z.ZodString;
49
+ id: z.ZodString;
50
+ key: z.ZodString;
51
+ kind: z.ZodEnum<{
52
+ image: "image";
53
+ video: "video";
54
+ audio: "audio";
55
+ document: "document";
56
+ }>;
57
+ source: z.ZodEnum<{
58
+ library: "library";
59
+ member: "member";
60
+ }>;
61
+ filename: z.ZodString;
62
+ contentType: z.ZodString;
63
+ size: z.ZodNumber;
64
+ status: z.ZodEnum<{
65
+ pending: "pending";
66
+ ready: "ready";
67
+ }>;
68
+ uploadedBy: z.ZodString;
69
+ createdAt: z.ZodCoercedDate<unknown>;
70
+ updatedAt: z.ZodCoercedDate<unknown>;
71
+ url: z.ZodNullable<z.ZodString>;
72
+ downloadUrl: z.ZodNullable<z.ZodString>;
73
+ }, z.core.$strict>;
74
+ type AssetView = z.output<typeof assetViewSchema>;
75
+ declare const assetUrlsSchema: z.ZodRecord<z.ZodString, z.ZodString>;
76
+ type AssetUrls = z.infer<typeof assetUrlsSchema>;
35
77
  declare const requestUploadInputSchema: z.ZodObject<{
36
78
  uploadedBy: z.ZodString;
37
79
  filename: z.ZodString;
38
80
  contentType: z.ZodString;
39
- kind: z.ZodEnum<{
40
- video: "video";
41
- download: "download";
42
- content: "content";
81
+ source: z.ZodEnum<{
82
+ library: "library";
83
+ member: "member";
43
84
  }>;
44
85
  }, z.core.$strict>;
45
86
  type RequestUploadInput = z.infer<typeof requestUploadInputSchema>;
@@ -49,9 +90,14 @@ declare const uploadTicketSchema: z.ZodObject<{
49
90
  id: z.ZodString;
50
91
  key: z.ZodString;
51
92
  kind: z.ZodEnum<{
93
+ image: "image";
52
94
  video: "video";
53
- download: "download";
54
- content: "content";
95
+ audio: "audio";
96
+ document: "document";
97
+ }>;
98
+ source: z.ZodEnum<{
99
+ library: "library";
100
+ member: "member";
55
101
  }>;
56
102
  filename: z.ZodString;
57
103
  contentType: z.ZodString;
@@ -62,6 +108,9 @@ declare const uploadTicketSchema: z.ZodObject<{
62
108
  }>;
63
109
  uploadedBy: z.ZodString;
64
110
  createdAt: z.ZodCoercedDate<unknown>;
111
+ updatedAt: z.ZodCoercedDate<unknown>;
112
+ url: z.ZodNullable<z.ZodString>;
113
+ downloadUrl: z.ZodNullable<z.ZodString>;
65
114
  }, z.core.$strict>;
66
115
  uploadUrl: z.ZodString;
67
116
  method: z.ZodLiteral<"PUT">;
@@ -69,41 +118,23 @@ declare const uploadTicketSchema: z.ZodObject<{
69
118
  headers: z.ZodRecord<z.ZodString, z.ZodString>;
70
119
  }, z.core.$strict>;
71
120
  type UploadTicket = z.infer<typeof uploadTicketSchema>;
72
- declare const downloadTicketSchema: z.ZodObject<{
73
- url: z.ZodString;
74
- asset: z.ZodObject<{
75
- orgId: z.ZodString;
76
- id: z.ZodString;
77
- key: z.ZodString;
78
- kind: z.ZodEnum<{
79
- video: "video";
80
- download: "download";
81
- content: "content";
82
- }>;
83
- filename: z.ZodString;
84
- contentType: z.ZodString;
85
- size: z.ZodNumber;
86
- status: z.ZodEnum<{
87
- pending: "pending";
88
- ready: "ready";
89
- }>;
90
- uploadedBy: z.ZodString;
91
- createdAt: z.ZodCoercedDate<unknown>;
92
- }, z.core.$strict>;
93
- }, z.core.$strict>;
94
- type DownloadTicket = z.infer<typeof downloadTicketSchema>;
95
121
  declare const assetsQuerySchema: z.ZodObject<{
96
122
  page: z.ZodNumber;
97
123
  pageSize: z.ZodNumber;
98
124
  search: z.ZodOptional<z.ZodString>;
99
125
  sort: z.ZodOptional<z.ZodString>;
100
126
  kind: z.ZodOptional<z.ZodEnum<{
127
+ image: "image";
101
128
  video: "video";
102
- download: "download";
103
- content: "content";
129
+ audio: "audio";
130
+ document: "document";
131
+ }>>;
132
+ source: z.ZodOptional<z.ZodEnum<{
133
+ library: "library";
134
+ member: "member";
104
135
  }>>;
105
136
  }, z.core.$strict>;
106
137
  type AssetsQuery = z.infer<typeof assetsQuerySchema>;
107
138
  //#endregion
108
- export { Asset, AssetInput, AssetKind, AssetStatus, AssetsQuery, DownloadTicket, RequestUploadInput, UploadTicket, assetKindSchema, assetSchema, assetStatusSchema, assetsQuerySchema, downloadTicketSchema, requestUploadInputSchema, uploadTicketSchema };
139
+ export { Asset, AssetInput, AssetKind, AssetSource, AssetStatus, AssetUrls, AssetView, AssetsQuery, RequestUploadInput, UploadTicket, assetKindSchema, assetSchema, assetSourceSchema, assetStatusSchema, assetUrlsSchema, assetViewSchema, assetsQuerySchema, requestUploadInputSchema, uploadTicketSchema };
109
140
  //# sourceMappingURL=assets.d.ts.map
@@ -2,48 +2,54 @@ import { idSchema } from "./shared.js";
2
2
  import { z } from "zod";
3
3
  //#region src/types/schemas/assets.ts
4
4
  const assetKindSchema = z.enum([
5
+ "image",
5
6
  "video",
6
- "download",
7
- "content"
7
+ "audio",
8
+ "document"
8
9
  ]);
10
+ const assetSourceSchema = z.enum(["library", "member"]);
9
11
  const assetStatusSchema = z.enum(["pending", "ready"]);
10
12
  const assetSchema = z.object({
11
13
  orgId: idSchema,
12
14
  id: idSchema,
13
15
  key: z.string().trim().min(1),
14
16
  kind: assetKindSchema,
17
+ source: assetSourceSchema,
15
18
  filename: z.string().trim().min(1),
16
19
  contentType: z.string().trim().min(1),
17
20
  size: z.number().int().min(0),
18
21
  status: assetStatusSchema,
19
22
  uploadedBy: idSchema,
20
- createdAt: z.coerce.date()
23
+ createdAt: z.coerce.date(),
24
+ updatedAt: z.coerce.date()
21
25
  }).strict();
26
+ const assetViewSchema = assetSchema.extend({
27
+ url: z.string().nullable(),
28
+ downloadUrl: z.string().nullable()
29
+ }).strict();
30
+ const assetUrlsSchema = z.record(idSchema, z.string());
22
31
  const requestUploadInputSchema = z.object({
23
32
  uploadedBy: idSchema,
24
- filename: z.string().trim().min(1),
25
- contentType: z.string().trim().min(1),
26
- kind: assetKindSchema
33
+ filename: z.string().trim().min(1).max(255),
34
+ contentType: z.string().trim().min(1).max(255),
35
+ source: assetSourceSchema
27
36
  }).strict();
28
37
  const uploadTicketSchema = z.object({
29
- asset: assetSchema,
38
+ asset: assetViewSchema,
30
39
  uploadUrl: z.string().trim().min(1),
31
40
  method: z.literal("PUT"),
32
41
  expiresInSeconds: z.number().int().positive(),
33
42
  headers: z.record(z.string(), z.string())
34
43
  }).strict();
35
- const downloadTicketSchema = z.object({
36
- url: z.string().trim().min(1),
37
- asset: assetSchema
38
- }).strict();
39
44
  const assetsQuerySchema = z.object({
40
45
  page: z.number().int().min(1),
41
46
  pageSize: z.number().int().min(1),
42
47
  search: z.string().optional(),
43
48
  sort: z.string().optional(),
44
- kind: assetKindSchema.optional()
49
+ kind: assetKindSchema.optional(),
50
+ source: assetSourceSchema.optional()
45
51
  }).strict();
46
52
  //#endregion
47
- export { assetKindSchema, assetSchema, assetStatusSchema, assetsQuerySchema, downloadTicketSchema, requestUploadInputSchema, uploadTicketSchema };
53
+ export { assetKindSchema, assetSchema, assetSourceSchema, assetStatusSchema, assetUrlsSchema, assetViewSchema, assetsQuerySchema, requestUploadInputSchema, uploadTicketSchema };
48
54
 
49
55
  //# sourceMappingURL=assets.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"assets.js","names":[],"sources":["../../../src/types/schemas/assets.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { idSchema } from \"./shared.js\";\n\nexport const assetKindSchema = z.enum([\"video\", \"download\", \"content\"]);\nexport type AssetKind = z.infer<typeof assetKindSchema>;\n\nexport const assetStatusSchema = z.enum([\"pending\", \"ready\"]);\nexport type AssetStatus = z.infer<typeof assetStatusSchema>;\n\nexport const assetSchema = z.object({\n orgId: idSchema,\n id: idSchema,\n key: z.string().trim().min(1),\n kind: assetKindSchema,\n filename: z.string().trim().min(1),\n contentType: z.string().trim().min(1),\n size: z.number().int().min(0),\n status: assetStatusSchema,\n uploadedBy: idSchema,\n createdAt: z.coerce.date(),\n}).strict();\nexport type Asset = z.output<typeof assetSchema>;\nexport type AssetInput = z.input<typeof assetSchema>;\n\nexport const requestUploadInputSchema = z.object({\n uploadedBy: idSchema,\n filename: z.string().trim().min(1),\n contentType: z.string().trim().min(1),\n kind: assetKindSchema,\n}).strict();\nexport type RequestUploadInput = z.infer<typeof requestUploadInputSchema>;\n\nexport const uploadTicketSchema = z.object({\n asset: assetSchema,\n uploadUrl: z.string().trim().min(1),\n method: z.literal(\"PUT\"),\n expiresInSeconds: z.number().int().positive(),\n headers: z.record(z.string(), z.string()),\n}).strict();\nexport type UploadTicket = z.infer<typeof uploadTicketSchema>;\n\nexport const downloadTicketSchema = z.object({\n url: z.string().trim().min(1),\n asset: assetSchema,\n}).strict();\nexport type DownloadTicket = z.infer<typeof downloadTicketSchema>;\n\nexport const assetsQuerySchema = z.object({\n page: z.number().int().min(1),\n pageSize: z.number().int().min(1),\n search: z.string().optional(),\n sort: z.string().optional(),\n kind: assetKindSchema.optional(),\n}).strict();\nexport type AssetsQuery = z.infer<typeof assetsQuerySchema>;\n"],"mappings":";;;AAGA,MAAa,kBAAkB,EAAE,KAAK;CAAC;CAAS;CAAY;AAAS,CAAC;AAGtE,MAAa,oBAAoB,EAAE,KAAK,CAAC,WAAW,OAAO,CAAC;AAG5D,MAAa,cAAc,EAAE,OAAO;CAClC,OAAO;CACP,IAAI;CACJ,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CAC5B,MAAM;CACN,UAAU,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CACjC,aAAa,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CACpC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;CAC5B,QAAQ;CACR,YAAY;CACZ,WAAW,EAAE,OAAO,KAAK;AAC3B,CAAC,CAAC,CAAC,OAAO;AAIV,MAAa,2BAA2B,EAAE,OAAO;CAC/C,YAAY;CACZ,UAAU,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CACjC,aAAa,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CACpC,MAAM;AACR,CAAC,CAAC,CAAC,OAAO;AAGV,MAAa,qBAAqB,EAAE,OAAO;CACzC,OAAO;CACP,WAAW,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CAClC,QAAQ,EAAE,QAAQ,KAAK;CACvB,kBAAkB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CAC5C,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;AAC1C,CAAC,CAAC,CAAC,OAAO;AAGV,MAAa,uBAAuB,EAAE,OAAO;CAC3C,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CAC5B,OAAO;AACT,CAAC,CAAC,CAAC,OAAO;AAGV,MAAa,oBAAoB,EAAE,OAAO;CACxC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;CAC5B,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;CAChC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;CAC1B,MAAM,gBAAgB,SAAS;AACjC,CAAC,CAAC,CAAC,OAAO"}
1
+ {"version":3,"file":"assets.js","names":[],"sources":["../../../src/types/schemas/assets.ts"],"sourcesContent":["import { z } from 'zod';\nimport { idSchema } from './shared.js';\n\nexport const assetKindSchema = z.enum(['image', 'video', 'audio', 'document']);\nexport type AssetKind = z.infer<typeof assetKindSchema>;\n\nexport const assetSourceSchema = z.enum(['library', 'member']);\nexport type AssetSource = z.infer<typeof assetSourceSchema>;\n\nexport const assetStatusSchema = z.enum(['pending', 'ready']);\nexport type AssetStatus = z.infer<typeof assetStatusSchema>;\n\nexport const assetSchema = z\n .object({\n orgId: idSchema,\n id: idSchema,\n key: z.string().trim().min(1),\n kind: assetKindSchema,\n source: assetSourceSchema,\n filename: z.string().trim().min(1),\n contentType: z.string().trim().min(1),\n size: z.number().int().min(0),\n status: assetStatusSchema,\n uploadedBy: idSchema,\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type Asset = z.output<typeof assetSchema>;\nexport type AssetInput = z.input<typeof assetSchema>;\n\nexport const assetViewSchema = assetSchema\n .extend({ url: z.string().nullable(), downloadUrl: z.string().nullable() })\n .strict();\nexport type AssetView = z.output<typeof assetViewSchema>;\n\nexport const assetUrlsSchema = z.record(idSchema, z.string());\nexport type AssetUrls = z.infer<typeof assetUrlsSchema>;\n\nexport const requestUploadInputSchema = z\n .object({\n uploadedBy: idSchema,\n filename: z.string().trim().min(1).max(255),\n contentType: z.string().trim().min(1).max(255),\n source: assetSourceSchema,\n })\n .strict();\nexport type RequestUploadInput = z.infer<typeof requestUploadInputSchema>;\n\nexport const uploadTicketSchema = z\n .object({\n asset: assetViewSchema,\n uploadUrl: z.string().trim().min(1),\n method: z.literal('PUT'),\n expiresInSeconds: z.number().int().positive(),\n headers: z.record(z.string(), z.string()),\n })\n .strict();\nexport type UploadTicket = z.infer<typeof uploadTicketSchema>;\n\nexport const assetsQuerySchema = z\n .object({\n page: z.number().int().min(1),\n pageSize: z.number().int().min(1),\n search: z.string().optional(),\n sort: z.string().optional(),\n kind: assetKindSchema.optional(),\n source: assetSourceSchema.optional(),\n })\n .strict();\nexport type AssetsQuery = z.infer<typeof assetsQuerySchema>;\n"],"mappings":";;;AAGA,MAAa,kBAAkB,EAAE,KAAK;CAAC;CAAS;CAAS;CAAS;AAAU,CAAC;AAG7E,MAAa,oBAAoB,EAAE,KAAK,CAAC,WAAW,QAAQ,CAAC;AAG7D,MAAa,oBAAoB,EAAE,KAAK,CAAC,WAAW,OAAO,CAAC;AAG5D,MAAa,cAAc,EACxB,OAAO;CACN,OAAO;CACP,IAAI;CACJ,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CAC5B,MAAM;CACN,QAAQ;CACR,UAAU,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CACjC,aAAa,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CACpC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;CAC5B,QAAQ;CACR,YAAY;CACZ,WAAW,EAAE,OAAO,KAAK;CACzB,WAAW,EAAE,OAAO,KAAK;AAC3B,CAAC,CAAC,CACD,OAAO;AAIV,MAAa,kBAAkB,YAC5B,OAAO;CAAE,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS;CAAG,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;AAAE,CAAC,CAAC,CAC1E,OAAO;AAGV,MAAa,kBAAkB,EAAE,OAAO,UAAU,EAAE,OAAO,CAAC;AAG5D,MAAa,2BAA2B,EACrC,OAAO;CACN,YAAY;CACZ,UAAU,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CAC1C,aAAa,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CAC7C,QAAQ;AACV,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,qBAAqB,EAC/B,OAAO;CACN,OAAO;CACP,WAAW,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CAClC,QAAQ,EAAE,QAAQ,KAAK;CACvB,kBAAkB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CAC5C,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;AAC1C,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,oBAAoB,EAC9B,OAAO;CACN,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;CAC5B,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;CAChC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;CAC1B,MAAM,gBAAgB,SAAS;CAC/B,QAAQ,kBAAkB,SAAS;AACrC,CAAC,CAAC,CACD,OAAO"}