@headless-lms/server 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +48 -0
  3. package/dist/app/container.d.ts +124 -0
  4. package/dist/app/container.js +312 -0
  5. package/dist/app/container.js.map +1 -0
  6. package/dist/app/db.d.ts +2 -0
  7. package/dist/app/db.js +2 -0
  8. package/dist/app/integrations.d.ts +7 -0
  9. package/dist/app/integrations.js +44 -0
  10. package/dist/app/integrations.js.map +1 -0
  11. package/dist/app/notifications.d.ts +7 -0
  12. package/dist/app/notifications.js +23 -0
  13. package/dist/app/notifications.js.map +1 -0
  14. package/dist/http/config.d.ts +25 -0
  15. package/dist/http/config.js +1 -0
  16. package/dist/http/fastify.d.ts +35 -0
  17. package/dist/http/plugins/auth.d.ts +11 -0
  18. package/dist/http/plugins/auth.js +47 -0
  19. package/dist/http/plugins/auth.js.map +1 -0
  20. package/dist/http/plugins/cors.d.ts +7 -0
  21. package/dist/http/plugins/cors.js +22 -0
  22. package/dist/http/plugins/cors.js.map +1 -0
  23. package/dist/http/plugins/error-handler.d.ts +6 -0
  24. package/dist/http/plugins/error-handler.js +64 -0
  25. package/dist/http/plugins/error-handler.js.map +1 -0
  26. package/dist/http/plugins/openapi.d.ts +7 -0
  27. package/dist/http/plugins/openapi.js +63 -0
  28. package/dist/http/plugins/openapi.js.map +1 -0
  29. package/dist/http/routes/activities.d.ts +7 -0
  30. package/dist/http/routes/activities.js +163 -0
  31. package/dist/http/routes/activities.js.map +1 -0
  32. package/dist/http/routes/assets.d.ts +7 -0
  33. package/dist/http/routes/assets.js +168 -0
  34. package/dist/http/routes/assets.js.map +1 -0
  35. package/dist/http/routes/automations.d.ts +7 -0
  36. package/dist/http/routes/automations.js +158 -0
  37. package/dist/http/routes/automations.js.map +1 -0
  38. package/dist/http/routes/courses.d.ts +7 -0
  39. package/dist/http/routes/courses.js +130 -0
  40. package/dist/http/routes/courses.js.map +1 -0
  41. package/dist/http/routes/dashboard.d.ts +7 -0
  42. package/dist/http/routes/dashboard.js +42 -0
  43. package/dist/http/routes/dashboard.js.map +1 -0
  44. package/dist/http/routes/discussion.d.ts +7 -0
  45. package/dist/http/routes/discussion.js +122 -0
  46. package/dist/http/routes/discussion.js.map +1 -0
  47. package/dist/http/routes/downloads.d.ts +7 -0
  48. package/dist/http/routes/downloads.js +208 -0
  49. package/dist/http/routes/downloads.js.map +1 -0
  50. package/dist/http/routes/entitlements.d.ts +7 -0
  51. package/dist/http/routes/entitlements.js +69 -0
  52. package/dist/http/routes/entitlements.js.map +1 -0
  53. package/dist/http/routes/identity.d.ts +6 -0
  54. package/dist/http/routes/identity.js +6 -0
  55. package/dist/http/routes/identity.js.map +1 -0
  56. package/dist/http/routes/integrations.d.ts +7 -0
  57. package/dist/http/routes/integrations.js +210 -0
  58. package/dist/http/routes/integrations.js.map +1 -0
  59. package/dist/http/routes/learn/assets.d.ts +8 -0
  60. package/dist/http/routes/learn/assets.js +32 -0
  61. package/dist/http/routes/learn/assets.js.map +1 -0
  62. package/dist/http/routes/learn/comments.d.ts +7 -0
  63. package/dist/http/routes/learn/comments.js +175 -0
  64. package/dist/http/routes/learn/comments.js.map +1 -0
  65. package/dist/http/routes/learn/courses.d.ts +7 -0
  66. package/dist/http/routes/learn/courses.js +75 -0
  67. package/dist/http/routes/learn/courses.js.map +1 -0
  68. package/dist/http/routes/learn/downloads.d.ts +7 -0
  69. package/dist/http/routes/learn/downloads.js +76 -0
  70. package/dist/http/routes/learn/downloads.js.map +1 -0
  71. package/dist/http/routes/learn/index.d.ts +7 -0
  72. package/dist/http/routes/learn/index.js +19 -0
  73. package/dist/http/routes/learn/index.js.map +1 -0
  74. package/dist/http/routes/learn/org.d.ts +7 -0
  75. package/dist/http/routes/learn/org.js +50 -0
  76. package/dist/http/routes/learn/org.js.map +1 -0
  77. package/dist/http/routes/learn/progress.d.ts +7 -0
  78. package/dist/http/routes/learn/progress.js +63 -0
  79. package/dist/http/routes/learn/progress.js.map +1 -0
  80. package/dist/http/routes/organizations.d.ts +7 -0
  81. package/dist/http/routes/organizations.js +219 -0
  82. package/dist/http/routes/organizations.js.map +1 -0
  83. package/dist/http/routes/progress.d.ts +6 -0
  84. package/dist/http/routes/progress.js +6 -0
  85. package/dist/http/routes/progress.js.map +1 -0
  86. package/dist/http/routes/students.d.ts +7 -0
  87. package/dist/http/routes/students.js +125 -0
  88. package/dist/http/routes/students.js.map +1 -0
  89. package/dist/http/routes.d.ts +7 -0
  90. package/dist/http/routes.js +37 -0
  91. package/dist/http/routes.js.map +1 -0
  92. package/dist/http/schemas/activities.d.ts +69 -0
  93. package/dist/http/schemas/activities.js +25 -0
  94. package/dist/http/schemas/activities.js.map +1 -0
  95. package/dist/http/schemas/assets.d.ts +142 -0
  96. package/dist/http/schemas/assets.js +24 -0
  97. package/dist/http/schemas/assets.js.map +1 -0
  98. package/dist/http/schemas/automations.d.ts +154 -0
  99. package/dist/http/schemas/automations.js +26 -0
  100. package/dist/http/schemas/automations.js.map +1 -0
  101. package/dist/http/schemas/content.d.ts +113 -0
  102. package/dist/http/schemas/content.js +29 -0
  103. package/dist/http/schemas/content.js.map +1 -0
  104. package/dist/http/schemas/dashboard.d.ts +26 -0
  105. package/dist/http/schemas/dashboard.js +18 -0
  106. package/dist/http/schemas/dashboard.js.map +1 -0
  107. package/dist/http/schemas/discussion.d.ts +340 -0
  108. package/dist/http/schemas/discussion.js +78 -0
  109. package/dist/http/schemas/discussion.js.map +1 -0
  110. package/dist/http/schemas/downloads.d.ts +110 -0
  111. package/dist/http/schemas/downloads.js +34 -0
  112. package/dist/http/schemas/downloads.js.map +1 -0
  113. package/dist/http/schemas/entitlements.d.ts +97 -0
  114. package/dist/http/schemas/entitlements.js +41 -0
  115. package/dist/http/schemas/entitlements.js.map +1 -0
  116. package/dist/http/schemas/index.d.ts +17 -0
  117. package/dist/http/schemas/index.js +17 -0
  118. package/dist/http/schemas/integrations.d.ts +93 -0
  119. package/dist/http/schemas/integrations.js +47 -0
  120. package/dist/http/schemas/integrations.js.map +1 -0
  121. package/dist/http/schemas/invites.d.ts +95 -0
  122. package/dist/http/schemas/invites.js +62 -0
  123. package/dist/http/schemas/invites.js.map +1 -0
  124. package/dist/http/schemas/learn.d.ts +142 -0
  125. package/dist/http/schemas/learn.js +58 -0
  126. package/dist/http/schemas/learn.js.map +1 -0
  127. package/dist/http/schemas/members.d.ts +88 -0
  128. package/dist/http/schemas/members.js +27 -0
  129. package/dist/http/schemas/members.js.map +1 -0
  130. package/dist/http/schemas/organizations.d.ts +22 -0
  131. package/dist/http/schemas/organizations.js +20 -0
  132. package/dist/http/schemas/organizations.js.map +1 -0
  133. package/dist/http/schemas/settings.d.ts +23 -0
  134. package/dist/http/schemas/settings.js +20 -0
  135. package/dist/http/schemas/settings.js.map +1 -0
  136. package/dist/http/schemas/shared.d.ts +57 -0
  137. package/dist/http/schemas/shared.js +54 -0
  138. package/dist/http/schemas/shared.js.map +1 -0
  139. package/dist/http/schemas/students.d.ts +64 -0
  140. package/dist/http/schemas/students.js +25 -0
  141. package/dist/http/schemas/students.js.map +1 -0
  142. package/dist/http/scope.d.ts +22 -0
  143. package/dist/http/scope.js +28 -0
  144. package/dist/http/scope.js.map +1 -0
  145. package/dist/http/server.d.ts +8 -0
  146. package/dist/http/server.js +33 -0
  147. package/dist/http/server.js.map +1 -0
  148. package/dist/http/web-bridge.d.ts +9 -0
  149. package/dist/http/web-bridge.js +27 -0
  150. package/dist/http/web-bridge.js.map +1 -0
  151. package/dist/index.d.ts +15 -0
  152. package/dist/index.js +16 -0
  153. package/dist/index.js.map +1 -0
  154. package/package.json +56 -0
@@ -0,0 +1,37 @@
1
+ import { coursesRoutes } from "./routes/courses.js";
2
+ import { downloadsRoutes } from "./routes/downloads.js";
3
+ import { learnRoutes } from "./routes/learn/index.js";
4
+ import { discussionRoutes } from "./routes/discussion.js";
5
+ import { activitiesRoutes } from "./routes/activities.js";
6
+ import { studentsRoutes } from "./routes/students.js";
7
+ import { entitlementsRoutes } from "./routes/entitlements.js";
8
+ import { automationsRoutes } from "./routes/automations.js";
9
+ import { organizationsRoutes } from "./routes/organizations.js";
10
+ import { dashboardRoutes } from "./routes/dashboard.js";
11
+ import { assetsRoutes } from "./routes/assets.js";
12
+ import { integrationsRoutes } from "./routes/integrations.js";
13
+ //#region src/http/routes.ts
14
+ function registerRoutes(app, container) {
15
+ app.get("/health", async () => ({ status: "ok" }));
16
+ app.register(async (instance) => {
17
+ await organizationsRoutes(instance, container);
18
+ });
19
+ app.register(async (instance) => {
20
+ instance.addHook("onRequest", instance.requireOrgSession);
21
+ await coursesRoutes(instance, container);
22
+ await downloadsRoutes(instance, container);
23
+ await learnRoutes(instance, container);
24
+ await discussionRoutes(instance, container);
25
+ await activitiesRoutes(instance, container);
26
+ await studentsRoutes(instance, container);
27
+ await entitlementsRoutes(instance, container);
28
+ await automationsRoutes(instance, container);
29
+ await dashboardRoutes(instance, container);
30
+ await assetsRoutes(instance, container);
31
+ await integrationsRoutes(instance, container);
32
+ });
33
+ }
34
+ //#endregion
35
+ export { registerRoutes };
36
+
37
+ //# sourceMappingURL=routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.js","names":[],"sources":["../../src/http/routes.ts"],"sourcesContent":["import type { FastifyInstance } from 'fastify';\nimport type { Container } from '../app/container.js';\nimport { coursesRoutes } from './routes/courses.js';\nimport { downloadsRoutes } from './routes/downloads.js';\nimport { learnRoutes } from './routes/learn/index.js';\nimport { discussionRoutes } from './routes/discussion.js';\nimport { activitiesRoutes } from './routes/activities.js';\nimport { studentsRoutes } from './routes/students.js';\nimport { entitlementsRoutes } from './routes/entitlements.js';\nimport { automationsRoutes } from './routes/automations.js';\nimport { organizationsRoutes } from './routes/organizations.js';\nimport { dashboardRoutes } from './routes/dashboard.js';\nimport { assetsRoutes } from './routes/assets.js';\nimport { integrationsRoutes } from './routes/integrations.js';\n\nexport function registerRoutes(\n app: FastifyInstance,\n container: Container,\n): void {\n app.get('/health', async () => ({ status: 'ok' }));\n\n app.register(async (instance) => {\n // instance.addHook('onRequest', instance.requireSession);\n await organizationsRoutes(instance, container);\n });\n\n app.register(async (instance) => {\n instance.addHook('onRequest', instance.requireOrgSession);\n await coursesRoutes(instance, container);\n await downloadsRoutes(instance, container);\n await learnRoutes(instance, container);\n await discussionRoutes(instance, container);\n await activitiesRoutes(instance, container);\n await studentsRoutes(instance, container);\n await entitlementsRoutes(instance, container);\n await automationsRoutes(instance, container);\n await dashboardRoutes(instance, container);\n await assetsRoutes(instance, container);\n await integrationsRoutes(instance, container);\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,SAAgB,eACd,KACA,WACM;CACN,IAAI,IAAI,WAAW,aAAa,EAAE,QAAQ,KAAK,EAAE;CAEjD,IAAI,SAAS,OAAO,aAAa;EAE/B,MAAM,oBAAoB,UAAU,SAAS;CAC/C,CAAC;CAED,IAAI,SAAS,OAAO,aAAa;EAC/B,SAAS,QAAQ,aAAa,SAAS,iBAAiB;EACxD,MAAM,cAAc,UAAU,SAAS;EACvC,MAAM,gBAAgB,UAAU,SAAS;EACzC,MAAM,YAAY,UAAU,SAAS;EACrC,MAAM,iBAAiB,UAAU,SAAS;EAC1C,MAAM,iBAAiB,UAAU,SAAS;EAC1C,MAAM,eAAe,UAAU,SAAS;EACxC,MAAM,mBAAmB,UAAU,SAAS;EAC5C,MAAM,kBAAkB,UAAU,SAAS;EAC3C,MAAM,gBAAgB,UAAU,SAAS;EACzC,MAAM,aAAa,UAAU,SAAS;EACtC,MAAM,mBAAmB,UAAU,SAAS;CAC9C,CAAC;AACH"}
@@ -0,0 +1,69 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/activities.d.ts
3
+ declare const Activity: z.ZodObject<{
4
+ orgId: z.ZodString;
5
+ id: z.ZodString;
6
+ moduleId: z.ZodString;
7
+ courseId: z.ZodString;
8
+ seq: z.ZodNumber;
9
+ settings: z.ZodNullable<z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
10
+ createdAt: z.ZodCoercedDate<unknown>;
11
+ updatedAt: z.ZodCoercedDate<unknown>;
12
+ }, z.core.$strict>;
13
+ type Activity = z.infer<typeof Activity>;
14
+ declare const Module: z.ZodObject<{
15
+ orgId: z.ZodString;
16
+ id: z.ZodString;
17
+ courseId: z.ZodString;
18
+ title: z.ZodString;
19
+ seq: z.ZodNumber;
20
+ createdAt: z.ZodCoercedDate<unknown>;
21
+ updatedAt: z.ZodCoercedDate<unknown>;
22
+ }, z.core.$strict>;
23
+ type Module = z.infer<typeof Module>;
24
+ /** Module/activity-write endpoints return the full, reordered module list. */
25
+ declare const ModuleList: z.ZodArray<z.ZodObject<{
26
+ orgId: z.ZodString;
27
+ id: z.ZodString;
28
+ courseId: z.ZodString;
29
+ title: z.ZodString;
30
+ seq: z.ZodNumber;
31
+ createdAt: z.ZodCoercedDate<unknown>;
32
+ updatedAt: z.ZodCoercedDate<unknown>;
33
+ }, z.core.$strict>>;
34
+ type ModuleList = z.infer<typeof ModuleList>;
35
+ declare const CourseIdPathParam: z.ZodObject<{
36
+ courseId: z.ZodString;
37
+ }, z.core.$strip>;
38
+ type CourseIdPathParam = z.infer<typeof CourseIdPathParam>;
39
+ declare const ModulePathParam: z.ZodObject<{
40
+ courseId: z.ZodString;
41
+ moduleId: z.ZodString;
42
+ }, z.core.$strip>;
43
+ type ModulePathParam = z.infer<typeof ModulePathParam>;
44
+ declare const ActivityPathParam: z.ZodObject<{
45
+ courseId: z.ZodString;
46
+ moduleId: z.ZodString;
47
+ activityId: z.ZodString;
48
+ }, z.core.$strip>;
49
+ type ActivityPathParam = z.infer<typeof ActivityPathParam>;
50
+ declare const CreateModule: z.ZodObject<{
51
+ title: z.ZodString;
52
+ }, z.core.$strip>;
53
+ type CreateModule = z.infer<typeof CreateModule>;
54
+ declare const UpdateModule: z.ZodObject<{
55
+ title: z.ZodString;
56
+ }, z.core.$strip>;
57
+ type UpdateModule = z.infer<typeof UpdateModule>;
58
+ declare const ReorderInput: z.ZodObject<{
59
+ orderedIds: z.ZodArray<z.ZodString>;
60
+ }, z.core.$strip>;
61
+ type ReorderInput = z.infer<typeof ReorderInput>;
62
+ declare const SaveActivity: z.ZodObject<{
63
+ settings: z.ZodOptional<z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
64
+ assetIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
65
+ }, z.core.$strict>;
66
+ type SaveActivity = z.infer<typeof SaveActivity>;
67
+ //#endregion
68
+ export { Activity, ActivityPathParam, CourseIdPathParam, CreateModule, Module, ModuleList, ModulePathParam, ReorderInput, SaveActivity, UpdateModule };
69
+ //# sourceMappingURL=activities.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ import { activitySchema, moduleSchema, saveActivityInputSchema } from "@headless-lms/core/schemas";
3
+ //#region src/http/schemas/activities.ts
4
+ const Activity = activitySchema;
5
+ const Module = moduleSchema;
6
+ /** Module/activity-write endpoints return the full, reordered module list. */
7
+ const ModuleList = z.array(Module);
8
+ const CourseIdPathParam = z.object({ courseId: z.string() });
9
+ const ModulePathParam = z.object({
10
+ courseId: z.string(),
11
+ moduleId: z.string()
12
+ });
13
+ const ActivityPathParam = z.object({
14
+ courseId: z.string(),
15
+ moduleId: z.string(),
16
+ activityId: z.string()
17
+ });
18
+ const CreateModule = z.object({ title: z.string().min(1) });
19
+ const UpdateModule = z.object({ title: z.string().min(1) });
20
+ const ReorderInput = z.object({ orderedIds: z.array(z.string()) });
21
+ const SaveActivity = saveActivityInputSchema;
22
+ //#endregion
23
+ export { Activity, ActivityPathParam, CourseIdPathParam, CreateModule, Module, ModuleList, ModulePathParam, ReorderInput, SaveActivity, UpdateModule };
24
+
25
+ //# sourceMappingURL=activities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activities.js","names":[],"sources":["../../../src/http/schemas/activities.ts"],"sourcesContent":["// Course modules + activities resource schemas. A module holds an ordered list\n// of activities directly; each activity is a uniform, orderable unit placing an\n// opaque settings blob at a position (`seq`) with a set of linked assets.\nimport { z } from \"zod\";\nimport {\n activitySchema,\n moduleSchema,\n saveActivityInputSchema,\n} from \"@headless-lms/core/schemas\";\n\nexport const Activity = activitySchema;\nexport type Activity = z.infer<typeof Activity>;\n\nexport const Module = moduleSchema;\nexport type Module = z.infer<typeof Module>;\n\n/** Module/activity-write endpoints return the full, reordered module list. */\nexport const ModuleList = z.array(Module);\nexport type ModuleList = z.infer<typeof ModuleList>;\n\nexport const CourseIdPathParam = z.object({ courseId: z.string() });\nexport type CourseIdPathParam = z.infer<typeof CourseIdPathParam>;\n\nexport const ModulePathParam = z.object({ courseId: z.string(), moduleId: z.string() });\nexport type ModulePathParam = z.infer<typeof ModulePathParam>;\n\nexport const ActivityPathParam = z.object({\n courseId: z.string(),\n moduleId: z.string(),\n activityId: z.string(),\n});\nexport type ActivityPathParam = z.infer<typeof ActivityPathParam>;\n\nexport const CreateModule = z.object({ title: z.string().min(1) });\nexport type CreateModule = z.infer<typeof CreateModule>;\n\nexport const UpdateModule = z.object({ title: z.string().min(1) });\nexport type UpdateModule = z.infer<typeof UpdateModule>;\n\nexport const ReorderInput = z.object({ orderedIds: z.array(z.string()) });\nexport type ReorderInput = z.infer<typeof ReorderInput>;\n\nexport const SaveActivity = saveActivityInputSchema;\nexport type SaveActivity = z.infer<typeof SaveActivity>;\n"],"mappings":";;;AAUA,MAAa,WAAW;AAGxB,MAAa,SAAS;;AAItB,MAAa,aAAa,EAAE,MAAM,MAAM;AAGxC,MAAa,oBAAoB,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AAGlE,MAAa,kBAAkB,EAAE,OAAO;CAAE,UAAU,EAAE,OAAO;CAAG,UAAU,EAAE,OAAO;AAAE,CAAC;AAGtF,MAAa,oBAAoB,EAAE,OAAO;CACxC,UAAU,EAAE,OAAO;CACnB,UAAU,EAAE,OAAO;CACnB,YAAY,EAAE,OAAO;AACvB,CAAC;AAGD,MAAa,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAGjE,MAAa,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAGjE,MAAa,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;AAGxE,MAAa,eAAe"}
@@ -0,0 +1,142 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/assets.d.ts
3
+ declare const AssetKind: z.ZodEnum<{
4
+ download: "download";
5
+ video: "video";
6
+ content: "content";
7
+ }>;
8
+ type AssetKind = z.infer<typeof AssetKind>;
9
+ declare const AssetStatus: z.ZodEnum<{
10
+ pending: "pending";
11
+ ready: "ready";
12
+ }>;
13
+ type AssetStatus = z.infer<typeof AssetStatus>;
14
+ declare const Asset: z.ZodObject<{
15
+ orgId: z.ZodString;
16
+ id: z.ZodString;
17
+ key: z.ZodString;
18
+ kind: z.ZodEnum<{
19
+ download: "download";
20
+ video: "video";
21
+ content: "content";
22
+ }>;
23
+ filename: z.ZodString;
24
+ contentType: z.ZodString;
25
+ size: z.ZodNumber;
26
+ status: z.ZodEnum<{
27
+ pending: "pending";
28
+ ready: "ready";
29
+ }>;
30
+ uploadedBy: z.ZodString;
31
+ createdAt: z.ZodCoercedDate<unknown>;
32
+ }, z.core.$strict>;
33
+ type Asset = z.infer<typeof Asset>;
34
+ declare const AssetsQuery: z.ZodObject<{
35
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
36
+ pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
37
+ search: z.ZodOptional<z.ZodString>;
38
+ sort: z.ZodOptional<z.ZodString>;
39
+ kind: z.ZodOptional<z.ZodEnum<{
40
+ download: "download";
41
+ video: "video";
42
+ content: "content";
43
+ }>>;
44
+ }, z.core.$strip>;
45
+ type AssetsQuery = z.infer<typeof AssetsQuery>;
46
+ declare const AssetsPage: z.ZodObject<{
47
+ rows: z.ZodArray<z.ZodObject<{
48
+ orgId: z.ZodString;
49
+ id: z.ZodString;
50
+ key: z.ZodString;
51
+ kind: z.ZodEnum<{
52
+ download: "download";
53
+ video: "video";
54
+ content: "content";
55
+ }>;
56
+ filename: z.ZodString;
57
+ contentType: z.ZodString;
58
+ size: z.ZodNumber;
59
+ status: z.ZodEnum<{
60
+ pending: "pending";
61
+ ready: "ready";
62
+ }>;
63
+ uploadedBy: z.ZodString;
64
+ createdAt: z.ZodCoercedDate<unknown>;
65
+ }, z.core.$strict>>;
66
+ total: z.ZodNumber;
67
+ page: z.ZodNumber;
68
+ pageSize: z.ZodNumber;
69
+ }, z.core.$strip>;
70
+ type AssetsPage = z.infer<typeof AssetsPage>;
71
+ declare const AssetIdParam: z.ZodObject<{
72
+ id: z.ZodString;
73
+ }, z.core.$strip>;
74
+ type AssetIdParam = z.infer<typeof AssetIdParam>;
75
+ /** Register an asset and get a presigned upload URL. */
76
+ declare const RequestUpload: z.ZodObject<{
77
+ filename: z.ZodString;
78
+ contentType: z.ZodString;
79
+ kind: z.ZodEnum<{
80
+ download: "download";
81
+ video: "video";
82
+ content: "content";
83
+ }>;
84
+ }, z.core.$strip>;
85
+ type RequestUpload = z.infer<typeof RequestUpload>;
86
+ declare const UploadTicket: z.ZodObject<{
87
+ asset: z.ZodObject<{
88
+ orgId: z.ZodString;
89
+ id: z.ZodString;
90
+ key: z.ZodString;
91
+ kind: z.ZodEnum<{
92
+ download: "download";
93
+ video: "video";
94
+ content: "content";
95
+ }>;
96
+ filename: z.ZodString;
97
+ contentType: z.ZodString;
98
+ size: z.ZodNumber;
99
+ status: z.ZodEnum<{
100
+ pending: "pending";
101
+ ready: "ready";
102
+ }>;
103
+ uploadedBy: z.ZodString;
104
+ createdAt: z.ZodCoercedDate<unknown>;
105
+ }, z.core.$strict>;
106
+ uploadUrl: z.ZodString;
107
+ method: z.ZodLiteral<"PUT">;
108
+ expiresInSeconds: z.ZodNumber;
109
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
110
+ }, z.core.$strict>;
111
+ type UploadTicket = z.infer<typeof UploadTicket>;
112
+ /** Optional override of the download filename (Content-Disposition). */
113
+ declare const RequestDownload: z.ZodObject<{
114
+ filename: z.ZodOptional<z.ZodString>;
115
+ }, z.core.$strip>;
116
+ type RequestDownload = z.infer<typeof RequestDownload>;
117
+ declare const DownloadTicket: z.ZodObject<{
118
+ url: z.ZodString;
119
+ asset: z.ZodObject<{
120
+ orgId: z.ZodString;
121
+ id: z.ZodString;
122
+ key: z.ZodString;
123
+ kind: z.ZodEnum<{
124
+ download: "download";
125
+ video: "video";
126
+ content: "content";
127
+ }>;
128
+ filename: z.ZodString;
129
+ contentType: z.ZodString;
130
+ size: z.ZodNumber;
131
+ status: z.ZodEnum<{
132
+ pending: "pending";
133
+ ready: "ready";
134
+ }>;
135
+ uploadedBy: z.ZodString;
136
+ createdAt: z.ZodCoercedDate<unknown>;
137
+ }, z.core.$strict>;
138
+ }, z.core.$strict>;
139
+ type DownloadTicket = z.infer<typeof DownloadTicket>;
140
+ //#endregion
141
+ export { Asset, AssetIdParam, AssetKind, AssetStatus, AssetsPage, AssetsQuery, DownloadTicket, RequestDownload, RequestUpload, UploadTicket };
142
+ //# sourceMappingURL=assets.d.ts.map
@@ -0,0 +1,24 @@
1
+ import { ListQuery, paginated } from "./shared.js";
2
+ import { z } from "zod";
3
+ import { assetKindSchema, assetSchema, assetStatusSchema, downloadTicketSchema, uploadTicketSchema } from "@headless-lms/core/schemas";
4
+ //#region src/http/schemas/assets.ts
5
+ const AssetKind = assetKindSchema;
6
+ const AssetStatus = assetStatusSchema;
7
+ const Asset = assetSchema;
8
+ const AssetsQuery = ListQuery.extend({ kind: AssetKind.optional() });
9
+ const AssetsPage = paginated(Asset);
10
+ const AssetIdParam = z.object({ id: z.string() });
11
+ /** Register an asset and get a presigned upload URL. */
12
+ const RequestUpload = z.object({
13
+ filename: z.string().min(1),
14
+ contentType: z.string().min(1),
15
+ kind: AssetKind
16
+ });
17
+ const UploadTicket = uploadTicketSchema;
18
+ /** Optional override of the download filename (Content-Disposition). */
19
+ const RequestDownload = z.object({ filename: z.string().optional() });
20
+ const DownloadTicket = downloadTicketSchema;
21
+ //#endregion
22
+ export { Asset, AssetIdParam, AssetKind, AssetStatus, AssetsPage, AssetsQuery, DownloadTicket, RequestDownload, RequestUpload, UploadTicket };
23
+
24
+ //# sourceMappingURL=assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.js","names":[],"sources":["../../../src/http/schemas/assets.ts"],"sourcesContent":["// Assets (media library) resource schemas. An Asset is a tracked object in\n// private storage; files are uploaded via a presigned PUT and served via a\n// presigned GET. Domain objects (e.g. a lesson) reference an asset by id.\n// The Asset payload shape is owned by @headless-lms/core/schemas; route-local\n// schemas define endpoint-only concerns such as params and pagination.\nimport { z } from \"zod\";\nimport {\n assetKindSchema,\n assetSchema,\n assetStatusSchema,\n downloadTicketSchema,\n uploadTicketSchema,\n} from \"@headless-lms/core/schemas\";\nimport { ListQuery, paginated } from \"./shared.js\";\n\nexport const AssetKind = assetKindSchema;\nexport type AssetKind = z.infer<typeof AssetKind>;\n\nexport const AssetStatus = assetStatusSchema;\nexport type AssetStatus = z.infer<typeof AssetStatus>;\n\nexport const Asset = assetSchema;\nexport type Asset = z.infer<typeof Asset>;\n\nexport const AssetsQuery = ListQuery.extend({ kind: AssetKind.optional() });\nexport type AssetsQuery = z.infer<typeof AssetsQuery>;\n\nexport const AssetsPage = paginated(Asset);\nexport type AssetsPage = z.infer<typeof AssetsPage>;\n\nexport const AssetIdParam = z.object({ id: z.string() });\nexport type AssetIdParam = z.infer<typeof AssetIdParam>;\n\n/** Register an asset and get a presigned upload URL. */\nexport const RequestUpload = z.object({\n filename: z.string().min(1),\n contentType: z.string().min(1),\n kind: AssetKind,\n});\nexport type RequestUpload = z.infer<typeof RequestUpload>;\n\nexport const UploadTicket = uploadTicketSchema;\nexport type UploadTicket = z.infer<typeof UploadTicket>;\n\n/** Optional override of the download filename (Content-Disposition). */\nexport const RequestDownload = z.object({ filename: z.string().optional() });\nexport type RequestDownload = z.infer<typeof RequestDownload>;\n\nexport const DownloadTicket = downloadTicketSchema;\nexport type DownloadTicket = z.infer<typeof DownloadTicket>;\n"],"mappings":";;;;AAeA,MAAa,YAAY;AAGzB,MAAa,cAAc;AAG3B,MAAa,QAAQ;AAGrB,MAAa,cAAc,UAAU,OAAO,EAAE,MAAM,UAAU,SAAS,EAAE,CAAC;AAG1E,MAAa,aAAa,UAAU,KAAK;AAGzC,MAAa,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;AAIvD,MAAa,gBAAgB,EAAE,OAAO;CACpC,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC1B,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC7B,MAAM;AACR,CAAC;AAGD,MAAa,eAAe;;AAI5B,MAAa,kBAAkB,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC;AAG3E,MAAa,iBAAiB"}
@@ -0,0 +1,154 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/automations.d.ts
3
+ /** One step of an automation: which action, and its input per that action's inputSchema. */
4
+ declare const AutomationAction: z.ZodObject<{
5
+ type: z.ZodString;
6
+ input: z.ZodRecord<z.ZodString, z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
7
+ }, z.core.$strict>;
8
+ type AutomationAction = z.infer<typeof AutomationAction>;
9
+ /** A domain event type, e.g. `entitlement.created`. */
10
+ declare const AutomationTrigger: z.ZodString;
11
+ type AutomationTrigger = z.infer<typeof AutomationTrigger>;
12
+ declare const Automation: z.ZodObject<{
13
+ orgId: z.ZodString;
14
+ id: z.ZodString;
15
+ name: z.ZodString;
16
+ description: z.ZodNullable<z.ZodString>;
17
+ trigger: z.ZodString;
18
+ actions: z.ZodArray<z.ZodObject<{
19
+ type: z.ZodString;
20
+ input: z.ZodRecord<z.ZodString, z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
21
+ }, z.core.$strict>>;
22
+ enabled: z.ZodBoolean;
23
+ createdAt: z.ZodCoercedDate<unknown>;
24
+ updatedAt: z.ZodCoercedDate<unknown>;
25
+ }, z.core.$strict>;
26
+ type Automation = z.infer<typeof Automation>;
27
+ declare const CreateAutomationBody: z.ZodObject<{
28
+ name: z.ZodString;
29
+ description: z.ZodOptional<z.ZodString>;
30
+ trigger: z.ZodString;
31
+ actions: z.ZodArray<z.ZodObject<{
32
+ type: z.ZodString;
33
+ input: z.ZodRecord<z.ZodString, z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
34
+ }, z.core.$strict>>;
35
+ }, z.core.$strict>;
36
+ type CreateAutomationBody = z.infer<typeof CreateAutomationBody>;
37
+ declare const UpdateAutomationBody: z.ZodObject<{
38
+ name: z.ZodOptional<z.ZodString>;
39
+ description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
40
+ trigger: z.ZodOptional<z.ZodString>;
41
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
42
+ type: z.ZodString;
43
+ input: z.ZodRecord<z.ZodString, z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
44
+ }, z.core.$strict>>>;
45
+ enabled: z.ZodOptional<z.ZodBoolean>;
46
+ }, z.core.$strict>;
47
+ type UpdateAutomationBody = z.infer<typeof UpdateAutomationBody>;
48
+ declare const AutomationIdParam: z.ZodObject<{
49
+ id: z.ZodString;
50
+ }, z.core.$strip>;
51
+ type AutomationIdParam = z.infer<typeof AutomationIdParam>;
52
+ /** An action an automation can use: a built-in type (`sendEmail`) or a loaded
53
+ * integration's own (`<integrationId>.<actionId>`). */
54
+ declare const AvailableAction: z.ZodObject<{
55
+ type: z.ZodString;
56
+ description: z.ZodString;
57
+ inputSchema: z.ZodRecord<z.ZodString, z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
58
+ source: z.ZodString;
59
+ }, z.core.$strict>;
60
+ type AvailableAction = z.infer<typeof AvailableAction>;
61
+ /** Which domain events an automation can react to. */
62
+ declare const AvailableTriggers: z.ZodObject<{
63
+ triggers: z.ZodArray<z.ZodObject<{
64
+ type: z.ZodString;
65
+ description: z.ZodString;
66
+ }, z.core.$strict>>;
67
+ }, z.core.$strict>;
68
+ type AvailableTriggers = z.infer<typeof AvailableTriggers>;
69
+ declare const AutomationRunStatus: z.ZodEnum<{
70
+ completed: "completed";
71
+ running: "running";
72
+ failed: "failed";
73
+ }>;
74
+ type AutomationRunStatus = z.infer<typeof AutomationRunStatus>;
75
+ declare const AutomationActionResult: z.ZodObject<{
76
+ index: z.ZodNumber;
77
+ type: z.ZodString;
78
+ status: z.ZodEnum<{
79
+ completed: "completed";
80
+ failed: "failed";
81
+ }>;
82
+ error: z.ZodOptional<z.ZodString>;
83
+ }, z.core.$strict>;
84
+ type AutomationActionResult = z.infer<typeof AutomationActionResult>;
85
+ declare const AutomationRun: z.ZodObject<{
86
+ orgId: z.ZodString;
87
+ id: z.ZodString;
88
+ automationId: z.ZodString;
89
+ trigger: z.ZodString;
90
+ eventId: z.ZodString;
91
+ event: z.ZodType<import("@headless-lms/core/types").DomainEvent<unknown, string, number>, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").DomainEvent<unknown, string, number>, unknown>>;
92
+ status: z.ZodEnum<{
93
+ completed: "completed";
94
+ running: "running";
95
+ failed: "failed";
96
+ }>;
97
+ actionResults: z.ZodArray<z.ZodObject<{
98
+ index: z.ZodNumber;
99
+ type: z.ZodString;
100
+ status: z.ZodEnum<{
101
+ completed: "completed";
102
+ failed: "failed";
103
+ }>;
104
+ error: z.ZodOptional<z.ZodString>;
105
+ }, z.core.$strict>>;
106
+ startedAt: z.ZodCoercedDate<unknown>;
107
+ finishedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
108
+ }, z.core.$strict>;
109
+ type AutomationRun = z.infer<typeof AutomationRun>;
110
+ declare const AutomationRunsQuery: z.ZodObject<{
111
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
112
+ pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
113
+ search: z.ZodOptional<z.ZodString>;
114
+ sort: z.ZodOptional<z.ZodString>;
115
+ status: z.ZodOptional<z.ZodEnum<{
116
+ completed: "completed";
117
+ running: "running";
118
+ failed: "failed";
119
+ }>>;
120
+ }, z.core.$strip>;
121
+ type AutomationRunsQuery = z.infer<typeof AutomationRunsQuery>;
122
+ declare const AutomationRunsPage: z.ZodObject<{
123
+ rows: z.ZodArray<z.ZodObject<{
124
+ orgId: z.ZodString;
125
+ id: z.ZodString;
126
+ automationId: z.ZodString;
127
+ trigger: z.ZodString;
128
+ eventId: z.ZodString;
129
+ event: z.ZodType<import("@headless-lms/core/types").DomainEvent<unknown, string, number>, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").DomainEvent<unknown, string, number>, unknown>>;
130
+ status: z.ZodEnum<{
131
+ completed: "completed";
132
+ running: "running";
133
+ failed: "failed";
134
+ }>;
135
+ actionResults: z.ZodArray<z.ZodObject<{
136
+ index: z.ZodNumber;
137
+ type: z.ZodString;
138
+ status: z.ZodEnum<{
139
+ completed: "completed";
140
+ failed: "failed";
141
+ }>;
142
+ error: z.ZodOptional<z.ZodString>;
143
+ }, z.core.$strict>>;
144
+ startedAt: z.ZodCoercedDate<unknown>;
145
+ finishedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
146
+ }, z.core.$strict>>;
147
+ total: z.ZodNumber;
148
+ page: z.ZodNumber;
149
+ pageSize: z.ZodNumber;
150
+ }, z.core.$strip>;
151
+ type AutomationRunsPage = z.infer<typeof AutomationRunsPage>;
152
+ //#endregion
153
+ export { Automation, AutomationAction, AutomationActionResult, AutomationIdParam, AutomationRun, AutomationRunStatus, AutomationRunsPage, AutomationRunsQuery, AutomationTrigger, AvailableAction, AvailableTriggers, CreateAutomationBody, UpdateAutomationBody };
154
+ //# sourceMappingURL=automations.d.ts.map
@@ -0,0 +1,26 @@
1
+ import { ListQuery, paginated } from "./shared.js";
2
+ import { z } from "zod";
3
+ import { automationActionResultSchema, automationActionSchema, automationRunSchema, automationRunStatusSchema, automationSchema, automationTriggerSchema, availableActionSchema, availableTriggersSchema, createAutomationInputSchema, updateAutomationInputSchema } from "@headless-lms/core/schemas";
4
+ //#region src/http/schemas/automations.ts
5
+ /** One step of an automation: which action, and its input per that action's inputSchema. */
6
+ const AutomationAction = automationActionSchema;
7
+ /** A domain event type, e.g. `entitlement.created`. */
8
+ const AutomationTrigger = automationTriggerSchema;
9
+ const Automation = automationSchema;
10
+ const CreateAutomationBody = createAutomationInputSchema;
11
+ const UpdateAutomationBody = updateAutomationInputSchema;
12
+ const AutomationIdParam = z.object({ id: z.string() });
13
+ /** An action an automation can use: a built-in type (`sendEmail`) or a loaded
14
+ * integration's own (`<integrationId>.<actionId>`). */
15
+ const AvailableAction = availableActionSchema;
16
+ /** Which domain events an automation can react to. */
17
+ const AvailableTriggers = availableTriggersSchema;
18
+ const AutomationRunStatus = automationRunStatusSchema;
19
+ const AutomationActionResult = automationActionResultSchema;
20
+ const AutomationRun = automationRunSchema;
21
+ const AutomationRunsQuery = ListQuery.extend({ status: AutomationRunStatus.optional() });
22
+ const AutomationRunsPage = paginated(AutomationRun);
23
+ //#endregion
24
+ export { Automation, AutomationAction, AutomationActionResult, AutomationIdParam, AutomationRun, AutomationRunStatus, AutomationRunsPage, AutomationRunsQuery, AutomationTrigger, AvailableAction, AvailableTriggers, CreateAutomationBody, UpdateAutomationBody };
25
+
26
+ //# sourceMappingURL=automations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automations.js","names":[],"sources":["../../../src/http/schemas/automations.ts"],"sourcesContent":["// Automations resource schemas. An automation matches a trigger (a domain\n// event type) against enabled rules and runs an ordered list of actions;\n// every run is recorded. Payload shapes are owned by\n// @headless-lms/core/schemas; route-local schemas define endpoint-only\n// concerns such as params and pagination envelopes.\nimport { z } from \"zod\";\nimport {\n automationActionResultSchema,\n automationActionSchema,\n automationRunSchema,\n automationRunStatusSchema,\n automationSchema,\n automationTriggerSchema,\n availableActionSchema,\n availableTriggersSchema,\n createAutomationInputSchema,\n updateAutomationInputSchema,\n} from \"@headless-lms/core/schemas\";\nimport { ListQuery, paginated } from \"./shared.js\";\n\n/** One step of an automation: which action, and its input per that action's inputSchema. */\nexport const AutomationAction = automationActionSchema;\nexport type AutomationAction = z.infer<typeof AutomationAction>;\n\n/** A domain event type, e.g. `entitlement.created`. */\nexport const AutomationTrigger = automationTriggerSchema;\nexport type AutomationTrigger = z.infer<typeof AutomationTrigger>;\n\nexport const Automation = automationSchema;\nexport type Automation = z.infer<typeof Automation>;\n\nexport const CreateAutomationBody = createAutomationInputSchema;\nexport type CreateAutomationBody = z.infer<typeof CreateAutomationBody>;\n\nexport const UpdateAutomationBody = updateAutomationInputSchema;\nexport type UpdateAutomationBody = z.infer<typeof UpdateAutomationBody>;\n\nexport const AutomationIdParam = z.object({ id: z.string() });\nexport type AutomationIdParam = z.infer<typeof AutomationIdParam>;\n\n/** An action an automation can use: a built-in type (`sendEmail`) or a loaded\n * integration's own (`<integrationId>.<actionId>`). */\nexport const AvailableAction = availableActionSchema;\nexport type AvailableAction = z.infer<typeof AvailableAction>;\n\n/** Which domain events an automation can react to. */\nexport const AvailableTriggers = availableTriggersSchema;\nexport type AvailableTriggers = z.infer<typeof AvailableTriggers>;\n\nexport const AutomationRunStatus = automationRunStatusSchema;\nexport type AutomationRunStatus = z.infer<typeof AutomationRunStatus>;\n\nexport const AutomationActionResult = automationActionResultSchema;\nexport type AutomationActionResult = z.infer<typeof AutomationActionResult>;\n\nexport const AutomationRun = automationRunSchema;\nexport type AutomationRun = z.infer<typeof AutomationRun>;\n\nexport const AutomationRunsQuery = ListQuery.extend({\n status: AutomationRunStatus.optional(),\n});\nexport type AutomationRunsQuery = z.infer<typeof AutomationRunsQuery>;\n\nexport const AutomationRunsPage = paginated(AutomationRun);\nexport type AutomationRunsPage = z.infer<typeof AutomationRunsPage>;\n"],"mappings":";;;;;AAqBA,MAAa,mBAAmB;;AAIhC,MAAa,oBAAoB;AAGjC,MAAa,aAAa;AAG1B,MAAa,uBAAuB;AAGpC,MAAa,uBAAuB;AAGpC,MAAa,oBAAoB,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;;AAK5D,MAAa,kBAAkB;;AAI/B,MAAa,oBAAoB;AAGjC,MAAa,sBAAsB;AAGnC,MAAa,yBAAyB;AAGtC,MAAa,gBAAgB;AAG7B,MAAa,sBAAsB,UAAU,OAAO,EAClD,QAAQ,oBAAoB,SAAS,EACvC,CAAC;AAGD,MAAa,qBAAqB,UAAU,aAAa"}
@@ -0,0 +1,113 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/content.d.ts
3
+ declare const CourseStatus: z.ZodEnum<{
4
+ draft: "draft";
5
+ published: "published";
6
+ }>;
7
+ type CourseStatus = z.infer<typeof CourseStatus>;
8
+ declare const CourseSettings: z.ZodObject<{
9
+ transcriptDownloads: z.ZodBoolean;
10
+ comments: z.ZodOptional<z.ZodObject<{
11
+ enabled: z.ZodBoolean;
12
+ threaded: z.ZodBoolean;
13
+ requireReview: z.ZodBoolean;
14
+ reactions: z.ZodBoolean;
15
+ }, z.core.$strict>>;
16
+ }, z.core.$strict>;
17
+ type CourseSettings = z.infer<typeof CourseSettings>;
18
+ declare const PatchCourseSettings: z.ZodObject<{
19
+ transcriptDownloads: z.ZodOptional<z.ZodBoolean>;
20
+ comments: z.ZodOptional<z.ZodOptional<z.ZodObject<{
21
+ enabled: z.ZodBoolean;
22
+ threaded: z.ZodBoolean;
23
+ requireReview: z.ZodBoolean;
24
+ reactions: z.ZodBoolean;
25
+ }, z.core.$strict>>>;
26
+ }, z.core.$strict>;
27
+ type PatchCourseSettings = z.infer<typeof PatchCourseSettings>;
28
+ declare const Course: z.ZodObject<{
29
+ orgId: z.ZodString;
30
+ id: z.ZodString;
31
+ type: z.ZodLiteral<"course">;
32
+ title: z.ZodString;
33
+ slug: z.ZodString;
34
+ description: z.ZodString;
35
+ status: z.ZodEnum<{
36
+ draft: "draft";
37
+ published: "published";
38
+ }>;
39
+ category: z.ZodString;
40
+ thumbnailAssetId: z.ZodNullable<z.ZodString>;
41
+ settings: z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>;
42
+ createdAt: z.ZodCoercedDate<unknown>;
43
+ updatedAt: z.ZodCoercedDate<unknown>;
44
+ }, z.core.$strict>;
45
+ type Course = z.infer<typeof Course>;
46
+ declare const CreateCourse: z.ZodObject<{
47
+ title: z.ZodString;
48
+ description: z.ZodDefault<z.ZodString>;
49
+ category: z.ZodDefault<z.ZodString>;
50
+ }, z.core.$strip>;
51
+ type CreateCourse = z.infer<typeof CreateCourse>;
52
+ declare const UpdateCourse: z.ZodObject<{
53
+ title: z.ZodOptional<z.ZodString>;
54
+ description: z.ZodOptional<z.ZodDefault<z.ZodString>>;
55
+ category: z.ZodOptional<z.ZodDefault<z.ZodString>>;
56
+ status: z.ZodOptional<z.ZodEnum<{
57
+ draft: "draft";
58
+ published: "published";
59
+ }>>;
60
+ thumbnailAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
+ settings: z.ZodOptional<z.ZodObject<{
62
+ transcriptDownloads: z.ZodOptional<z.ZodBoolean>;
63
+ comments: z.ZodOptional<z.ZodOptional<z.ZodObject<{
64
+ enabled: z.ZodBoolean;
65
+ threaded: z.ZodBoolean;
66
+ requireReview: z.ZodBoolean;
67
+ reactions: z.ZodBoolean;
68
+ }, z.core.$strict>>>;
69
+ }, z.core.$strict>>;
70
+ }, z.core.$strip>;
71
+ type UpdateCourse = z.infer<typeof UpdateCourse>;
72
+ declare const CoursesQuery: z.ZodObject<{
73
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
74
+ pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
75
+ search: z.ZodOptional<z.ZodString>;
76
+ sort: z.ZodOptional<z.ZodString>;
77
+ status: z.ZodOptional<z.ZodEnum<{
78
+ draft: "draft";
79
+ published: "published";
80
+ }>>;
81
+ category: z.ZodOptional<z.ZodString>;
82
+ }, z.core.$strip>;
83
+ type CoursesQuery = z.infer<typeof CoursesQuery>;
84
+ declare const CoursesPage: z.ZodObject<{
85
+ rows: z.ZodArray<z.ZodObject<{
86
+ orgId: z.ZodString;
87
+ id: z.ZodString;
88
+ type: z.ZodLiteral<"course">;
89
+ title: z.ZodString;
90
+ slug: z.ZodString;
91
+ description: z.ZodString;
92
+ status: z.ZodEnum<{
93
+ draft: "draft";
94
+ published: "published";
95
+ }>;
96
+ category: z.ZodString;
97
+ thumbnailAssetId: z.ZodNullable<z.ZodString>;
98
+ settings: z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>;
99
+ createdAt: z.ZodCoercedDate<unknown>;
100
+ updatedAt: z.ZodCoercedDate<unknown>;
101
+ }, z.core.$strict>>;
102
+ total: z.ZodNumber;
103
+ page: z.ZodNumber;
104
+ pageSize: z.ZodNumber;
105
+ }, z.core.$strip>;
106
+ type CoursesPage = z.infer<typeof CoursesPage>;
107
+ declare const CourseIdParam: z.ZodObject<{
108
+ id: z.ZodString;
109
+ }, z.core.$strip>;
110
+ type CourseIdParam = z.infer<typeof CourseIdParam>;
111
+ //#endregion
112
+ export { Course, CourseIdParam, CourseSettings, CourseStatus, CoursesPage, CoursesQuery, CreateCourse, PatchCourseSettings, UpdateCourse };
113
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1,29 @@
1
+ import { ListQuery, paginated } from "./shared.js";
2
+ import { z } from "zod";
3
+ import { courseSchema, courseSettingsSchema, courseStatusSchema } from "@headless-lms/core/schemas";
4
+ //#region src/http/schemas/content.ts
5
+ const CourseStatus = courseStatusSchema;
6
+ const CourseSettings = courseSettingsSchema;
7
+ const PatchCourseSettings = CourseSettings.partial();
8
+ const Course = courseSchema;
9
+ const CreateCourse = z.object({
10
+ title: z.string().min(1),
11
+ description: z.string().default(""),
12
+ category: z.string().default("")
13
+ });
14
+ const UpdateCourse = CreateCourse.partial().extend({
15
+ status: CourseStatus.optional(),
16
+ /** null clears the cover. */
17
+ thumbnailAssetId: z.string().nullable().optional(),
18
+ settings: CourseSettings.partial().optional()
19
+ });
20
+ const CoursesQuery = ListQuery.extend({
21
+ status: CourseStatus.optional(),
22
+ category: z.string().optional()
23
+ });
24
+ const CoursesPage = paginated(Course);
25
+ const CourseIdParam = z.object({ id: z.string() });
26
+ //#endregion
27
+ export { Course, CourseIdParam, CourseSettings, CourseStatus, CoursesPage, CoursesQuery, CreateCourse, PatchCourseSettings, UpdateCourse };
28
+
29
+ //# sourceMappingURL=content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.js","names":[],"sources":["../../../src/http/schemas/content.ts"],"sourcesContent":["// Content resource schemas (courses). The Course payload shape is owned by\n// @headless-lms/core/schemas; route-local schemas define endpoint-only\n// concerns such as defaults, params, and pagination envelopes.\nimport { z } from \"zod\";\nimport {\n courseSchema,\n courseSettingsSchema,\n courseStatusSchema,\n} from \"@headless-lms/core/schemas\";\nimport { ListQuery, paginated } from \"./shared.js\";\n\nexport const CourseStatus = courseStatusSchema;\nexport type CourseStatus = z.infer<typeof CourseStatus>;\n\nexport const CourseSettings = courseSettingsSchema;\nexport type CourseSettings = z.infer<typeof CourseSettings>;\n\nexport const PatchCourseSettings = CourseSettings.partial();\nexport type PatchCourseSettings = z.infer<typeof PatchCourseSettings>;\n\nexport const Course = courseSchema;\nexport type Course = z.infer<typeof Course>;\n\nexport const CreateCourse = z.object({\n title: z.string().min(1),\n description: z.string().default(\"\"),\n category: z.string().default(\"\"),\n});\nexport type CreateCourse = z.infer<typeof CreateCourse>;\n\nexport const UpdateCourse = CreateCourse.partial().extend({\n status: CourseStatus.optional(),\n /** null clears the cover. */\n thumbnailAssetId: z.string().nullable().optional(),\n settings: CourseSettings.partial().optional(),\n});\nexport type UpdateCourse = z.infer<typeof UpdateCourse>;\n\nexport const CoursesQuery = ListQuery.extend({\n status: CourseStatus.optional(),\n category: z.string().optional(),\n});\nexport type CoursesQuery = z.infer<typeof CoursesQuery>;\n\nexport const CoursesPage = paginated(Course);\nexport type CoursesPage = z.infer<typeof CoursesPage>;\n\nexport const CourseIdParam = z.object({ id: z.string() });\nexport type CourseIdParam = z.infer<typeof CourseIdParam>;\n"],"mappings":";;;;AAWA,MAAa,eAAe;AAG5B,MAAa,iBAAiB;AAG9B,MAAa,sBAAsB,eAAe,QAAQ;AAG1D,MAAa,SAAS;AAGtB,MAAa,eAAe,EAAE,OAAO;CACnC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACvB,aAAa,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE;CAClC,UAAU,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE;AACjC,CAAC;AAGD,MAAa,eAAe,aAAa,QAAQ,CAAC,CAAC,OAAO;CACxD,QAAQ,aAAa,SAAS;;CAE9B,kBAAkB,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACjD,UAAU,eAAe,QAAQ,CAAC,CAAC,SAAS;AAC9C,CAAC;AAGD,MAAa,eAAe,UAAU,OAAO;CAC3C,QAAQ,aAAa,SAAS;CAC9B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;AAChC,CAAC;AAGD,MAAa,cAAc,UAAU,MAAM;AAG3C,MAAa,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC"}