@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,142 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/learn.d.ts
3
+ /** Courses the authenticated student is actively enrolled in (published only). */
4
+ declare const LearnCourses: z.ZodArray<z.ZodObject<{
5
+ orgId: z.ZodString;
6
+ id: z.ZodString;
7
+ type: z.ZodLiteral<"course">;
8
+ title: z.ZodString;
9
+ slug: z.ZodString;
10
+ description: z.ZodString;
11
+ status: z.ZodEnum<{
12
+ draft: "draft";
13
+ published: "published";
14
+ }>;
15
+ category: z.ZodString;
16
+ thumbnailAssetId: z.ZodNullable<z.ZodString>;
17
+ settings: z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>;
18
+ createdAt: z.ZodCoercedDate<unknown>;
19
+ updatedAt: z.ZodCoercedDate<unknown>;
20
+ }, z.core.$strict>>;
21
+ type LearnCourses = z.infer<typeof LearnCourses>;
22
+ /** One enrolled course's module→activity tree (published activities only). */
23
+ declare const LearnModules: z.ZodArray<z.ZodObject<{
24
+ orgId: z.ZodString;
25
+ id: z.ZodString;
26
+ courseId: z.ZodString;
27
+ title: z.ZodString;
28
+ seq: z.ZodNumber;
29
+ createdAt: z.ZodCoercedDate<unknown>;
30
+ updatedAt: z.ZodCoercedDate<unknown>;
31
+ }, z.core.$strict>>;
32
+ type LearnModules = z.infer<typeof LearnModules>;
33
+ declare const LearnCourseIdParam: z.ZodObject<{
34
+ courseId: z.ZodString;
35
+ }, z.core.$strip>;
36
+ type LearnCourseIdParam = z.infer<typeof LearnCourseIdParam>;
37
+ /** Downloads the authenticated student is actively entitled to (published only). */
38
+ declare const LearnDownloads: z.ZodArray<z.ZodObject<{
39
+ orgId: z.ZodString;
40
+ id: z.ZodString;
41
+ type: z.ZodLiteral<"download">;
42
+ title: z.ZodString;
43
+ slug: z.ZodString;
44
+ description: z.ZodString;
45
+ status: z.ZodEnum<{
46
+ draft: "draft";
47
+ published: "published";
48
+ }>;
49
+ category: z.ZodString;
50
+ thumbnailAssetId: z.ZodNullable<z.ZodString>;
51
+ createdAt: z.ZodCoercedDate<unknown>;
52
+ updatedAt: z.ZodCoercedDate<unknown>;
53
+ }, z.core.$strict>>;
54
+ type LearnDownloads = z.infer<typeof LearnDownloads>;
55
+ /** One entitled download plus its ordered assets. */
56
+ declare const LearnDownload: z.ZodObject<{
57
+ download: z.ZodObject<{
58
+ orgId: z.ZodString;
59
+ id: z.ZodString;
60
+ type: z.ZodLiteral<"download">;
61
+ title: z.ZodString;
62
+ slug: z.ZodString;
63
+ description: z.ZodString;
64
+ status: z.ZodEnum<{
65
+ draft: "draft";
66
+ published: "published";
67
+ }>;
68
+ category: z.ZodString;
69
+ thumbnailAssetId: z.ZodNullable<z.ZodString>;
70
+ createdAt: z.ZodCoercedDate<unknown>;
71
+ updatedAt: z.ZodCoercedDate<unknown>;
72
+ }, z.core.$strict>;
73
+ assets: z.ZodArray<z.ZodObject<{
74
+ orgId: z.ZodString;
75
+ id: z.ZodString;
76
+ downloadId: z.ZodString;
77
+ assetId: z.ZodString;
78
+ seq: z.ZodNumber;
79
+ displayName: z.ZodNullable<z.ZodString>;
80
+ }, z.core.$strict>>;
81
+ }, z.core.$strip>;
82
+ type LearnDownload = z.infer<typeof LearnDownload>;
83
+ /** The portal org's public identity — the student surface themes against it. */
84
+ declare const LearnOrg: z.ZodObject<{
85
+ id: z.ZodString;
86
+ name: z.ZodString;
87
+ slug: z.ZodString;
88
+ }, z.core.$strip>;
89
+ type LearnOrg = z.infer<typeof LearnOrg>;
90
+ /** Who the caller is within the session's org. The session cookie identifies
91
+ * an auth user; the learner surface is keyed on `org_users.id`. */
92
+ declare const LearnViewer: z.ZodObject<{
93
+ orgUserId: z.ZodString;
94
+ role: z.ZodEnum<{
95
+ owner: "owner";
96
+ admin: "admin";
97
+ instructor: "instructor";
98
+ student: "student";
99
+ }>;
100
+ }, z.core.$strip>;
101
+ type LearnViewer = z.infer<typeof LearnViewer>;
102
+ /** One reported fact — never a decision. `asset` names the subject within the
103
+ * activity (absent = the activity itself); `completed` is the learner's
104
+ * activity-level claim. Every other field is the asset type's own vocabulary,
105
+ * passed through opaquely. */
106
+ declare const ProgressReportItem: z.ZodObject<{
107
+ asset: z.ZodOptional<z.ZodString>;
108
+ completed: z.ZodOptional<z.ZodBoolean>;
109
+ }, z.core.$catchall<z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>>;
110
+ type ProgressReportItem = z.infer<typeof ProgressReportItem>;
111
+ /** The report envelope: the target (key names the content type) and a batch of
112
+ * items. `[]` is a bare touch — it creates the record. */
113
+ declare const ReportProgress: z.ZodObject<{
114
+ activity: z.ZodString;
115
+ reports: z.ZodArray<z.ZodObject<{
116
+ asset: z.ZodOptional<z.ZodString>;
117
+ completed: z.ZodOptional<z.ZodBoolean>;
118
+ }, z.core.$catchall<z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>>>;
119
+ }, z.core.$strip>;
120
+ type ReportProgress = z.infer<typeof ReportProgress>;
121
+ /** The reported target's state after the service decided. */
122
+ declare const ProgressStatus: z.ZodObject<{
123
+ status: z.ZodEnum<{
124
+ completed: "completed";
125
+ "in-progress": "in-progress";
126
+ }>;
127
+ }, z.core.$strip>;
128
+ type ProgressStatus = z.infer<typeof ProgressStatus>;
129
+ /** Per-course progress, derived on read against current structure. */
130
+ declare const CourseProgress: z.ZodObject<{
131
+ activities: z.ZodRecord<z.ZodString, z.ZodEnum<{
132
+ completed: "completed";
133
+ "in-progress": "in-progress";
134
+ }>>;
135
+ percent: z.ZodInt;
136
+ completed: z.ZodBoolean;
137
+ positions: z.ZodRecord<z.ZodString, z.ZodUnknown>;
138
+ }, z.core.$strip>;
139
+ type CourseProgress = z.infer<typeof CourseProgress>;
140
+ //#endregion
141
+ export { CourseProgress, LearnCourseIdParam, LearnCourses, LearnDownload, LearnDownloads, LearnModules, LearnOrg, LearnViewer, ProgressReportItem, ProgressStatus, ReportProgress };
142
+ //# sourceMappingURL=learn.d.ts.map
@@ -0,0 +1,58 @@
1
+ import { OrgRole } from "./shared.js";
2
+ import { Course } from "./content.js";
3
+ import { Download, DownloadAsset } from "./downloads.js";
4
+ import { Module } from "./activities.js";
5
+ import { z } from "zod";
6
+ import { progressReportItemSchema } from "@headless-lms/core/schemas";
7
+ //#region src/http/schemas/learn.ts
8
+ /** Courses the authenticated student is actively enrolled in (published only). */
9
+ const LearnCourses = z.array(Course);
10
+ /** One enrolled course's module→activity tree (published activities only). */
11
+ const LearnModules = z.array(Module);
12
+ const LearnCourseIdParam = z.object({ courseId: z.string() });
13
+ /** Downloads the authenticated student is actively entitled to (published only). */
14
+ const LearnDownloads = z.array(Download);
15
+ /** One entitled download plus its ordered assets. */
16
+ const LearnDownload = z.object({
17
+ download: Download,
18
+ assets: z.array(DownloadAsset)
19
+ });
20
+ /** The portal org's public identity — the student surface themes against it. */
21
+ const LearnOrg = z.object({
22
+ id: z.string(),
23
+ name: z.string(),
24
+ slug: z.string()
25
+ });
26
+ /** Who the caller is within the session's org. The session cookie identifies
27
+ * an auth user; the learner surface is keyed on `org_users.id`. */
28
+ const LearnViewer = z.object({
29
+ orgUserId: z.string(),
30
+ role: OrgRole
31
+ });
32
+ /** One reported fact — never a decision. `asset` names the subject within the
33
+ * activity (absent = the activity itself); `completed` is the learner's
34
+ * activity-level claim. Every other field is the asset type's own vocabulary,
35
+ * passed through opaquely. */
36
+ const ProgressReportItem = progressReportItemSchema;
37
+ /** The report envelope: the target (key names the content type) and a batch of
38
+ * items. `[]` is a bare touch — it creates the record. */
39
+ const ReportProgress = z.object({
40
+ activity: z.string(),
41
+ reports: z.array(ProgressReportItem)
42
+ });
43
+ /** The reported target's state after the service decided. */
44
+ const ProgressStatus = z.object({ status: z.enum(["in-progress", "completed"]) });
45
+ /** Per-course progress, derived on read against current structure. */
46
+ const CourseProgress = z.object({
47
+ /** Keyed by activity id; absent key = not started. */
48
+ activities: z.record(z.string(), z.enum(["in-progress", "completed"])),
49
+ /** Integer 0–100, completed ÷ current activities, rounded. */
50
+ percent: z.int().min(0).max(100),
51
+ completed: z.boolean(),
52
+ /** Keyed by activity id: the per-asset reported state map (opaque). */
53
+ positions: z.record(z.string(), z.unknown())
54
+ });
55
+ //#endregion
56
+ export { CourseProgress, LearnCourseIdParam, LearnCourses, LearnDownload, LearnDownloads, LearnModules, LearnOrg, LearnViewer, ProgressReportItem, ProgressStatus, ReportProgress };
57
+
58
+ //# sourceMappingURL=learn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"learn.js","names":[],"sources":["../../../src/http/schemas/learn.ts"],"sourcesContent":["// Learn resource schemas — the student-facing read surface. Reuses the Course\n// and Module payloads (identical wire shape to the back-office API, including\n// the opaque activity `settings` blob) so one renderer path serves both.\nimport { z } from \"zod\";\nimport { progressReportItemSchema } from \"@headless-lms/core/schemas\";\nimport { Course } from \"./content.js\";\nimport { Module } from \"./activities.js\";\nimport { Download, DownloadAsset } from \"./downloads.js\";\nimport { OrgRole } from \"./shared.js\";\n\n/** Courses the authenticated student is actively enrolled in (published only). */\nexport const LearnCourses = z.array(Course);\nexport type LearnCourses = z.infer<typeof LearnCourses>;\n\n/** One enrolled course's module→activity tree (published activities only). */\nexport const LearnModules = z.array(Module);\nexport type LearnModules = z.infer<typeof LearnModules>;\n\nexport const LearnCourseIdParam = z.object({ courseId: z.string() });\nexport type LearnCourseIdParam = z.infer<typeof LearnCourseIdParam>;\n\n/** Downloads the authenticated student is actively entitled to (published only). */\nexport const LearnDownloads = z.array(Download);\nexport type LearnDownloads = z.infer<typeof LearnDownloads>;\n\n/** One entitled download plus its ordered assets. */\nexport const LearnDownload = z.object({\n download: Download,\n assets: z.array(DownloadAsset),\n});\nexport type LearnDownload = z.infer<typeof LearnDownload>;\n\n/** The portal org's public identity — the student surface themes against it. */\nexport const LearnOrg = z.object({\n id: z.string(),\n name: z.string(),\n slug: z.string(),\n});\nexport type LearnOrg = z.infer<typeof LearnOrg>;\n\n/** Who the caller is within the session's org. The session cookie identifies\n * an auth user; the learner surface is keyed on `org_users.id`. */\nexport const LearnViewer = z.object({\n orgUserId: z.string(),\n role: OrgRole,\n});\nexport type LearnViewer = z.infer<typeof LearnViewer>;\n\n/** One reported fact — never a decision. `asset` names the subject within the\n * activity (absent = the activity itself); `completed` is the learner's\n * activity-level claim. Every other field is the asset type's own vocabulary,\n * passed through opaquely. */\nexport const ProgressReportItem = progressReportItemSchema;\nexport type ProgressReportItem = z.infer<typeof ProgressReportItem>;\n\n/** The report envelope: the target (key names the content type) and a batch of\n * items. `[]` is a bare touch — it creates the record. */\nexport const ReportProgress = z.object({\n activity: z.string(),\n reports: z.array(ProgressReportItem),\n});\nexport type ReportProgress = z.infer<typeof ReportProgress>;\n\n/** The reported target's state after the service decided. */\nexport const ProgressStatus = z.object({\n status: z.enum([\"in-progress\", \"completed\"]),\n});\nexport type ProgressStatus = z.infer<typeof ProgressStatus>;\n\n/** Per-course progress, derived on read against current structure. */\nexport const CourseProgress = z.object({\n /** Keyed by activity id; absent key = not started. */\n activities: z.record(z.string(), z.enum([\"in-progress\", \"completed\"])),\n /** Integer 0–100, completed ÷ current activities, rounded. */\n percent: z.int().min(0).max(100),\n completed: z.boolean(),\n /** Keyed by activity id: the per-asset reported state map (opaque). */\n positions: z.record(z.string(), z.unknown()),\n});\nexport type CourseProgress = z.infer<typeof CourseProgress>;\n\n"],"mappings":";;;;;;;;AAWA,MAAa,eAAe,EAAE,MAAM,MAAM;;AAI1C,MAAa,eAAe,EAAE,MAAM,MAAM;AAG1C,MAAa,qBAAqB,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;;AAInE,MAAa,iBAAiB,EAAE,MAAM,QAAQ;;AAI9C,MAAa,gBAAgB,EAAE,OAAO;CACpC,UAAU;CACV,QAAQ,EAAE,MAAM,aAAa;AAC/B,CAAC;;AAID,MAAa,WAAW,EAAE,OAAO;CAC/B,IAAI,EAAE,OAAO;CACb,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO;AACjB,CAAC;;;AAKD,MAAa,cAAc,EAAE,OAAO;CAClC,WAAW,EAAE,OAAO;CACpB,MAAM;AACR,CAAC;;;;;AAOD,MAAa,qBAAqB;;;AAKlC,MAAa,iBAAiB,EAAE,OAAO;CACrC,UAAU,EAAE,OAAO;CACnB,SAAS,EAAE,MAAM,kBAAkB;AACrC,CAAC;;AAID,MAAa,iBAAiB,EAAE,OAAO,EACrC,QAAQ,EAAE,KAAK,CAAC,eAAe,WAAW,CAAC,EAC7C,CAAC;;AAID,MAAa,iBAAiB,EAAE,OAAO;;CAErC,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,eAAe,WAAW,CAAC,CAAC;;CAErE,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CAC/B,WAAW,EAAE,QAAQ;;CAErB,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,88 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/members.d.ts
3
+ /** Org-scoped roles, mirrored from better-auth's organization plugin. */
4
+ declare const Role: z.ZodEnum<{
5
+ owner: "owner";
6
+ admin: "admin";
7
+ instructor: "instructor";
8
+ }>;
9
+ type Role = z.infer<typeof Role>;
10
+ declare const MemberStatus: z.ZodEnum<{
11
+ active: "active";
12
+ invited: "invited";
13
+ }>;
14
+ type MemberStatus = z.infer<typeof MemberStatus>;
15
+ declare const Member: z.ZodObject<{
16
+ id: z.ZodString;
17
+ firstName: z.ZodNullable<z.ZodString>;
18
+ lastName: z.ZodNullable<z.ZodString>;
19
+ email: z.ZodString;
20
+ image: z.ZodNullable<z.ZodString>;
21
+ role: z.ZodEnum<{
22
+ owner: "owner";
23
+ admin: "admin";
24
+ instructor: "instructor";
25
+ }>;
26
+ status: z.ZodEnum<{
27
+ active: "active";
28
+ invited: "invited";
29
+ }>;
30
+ joinedAt: z.ZodNullable<z.ZodString>;
31
+ invitedAt: z.ZodNullable<z.ZodString>;
32
+ }, z.core.$strip>;
33
+ type Member = z.infer<typeof Member>;
34
+ declare const MembersQuery: 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
+ role: z.ZodOptional<z.ZodEnum<{
40
+ owner: "owner";
41
+ admin: "admin";
42
+ instructor: "instructor";
43
+ }>>;
44
+ status: z.ZodOptional<z.ZodEnum<{
45
+ active: "active";
46
+ invited: "invited";
47
+ }>>;
48
+ }, z.core.$strip>;
49
+ type MembersQuery = z.infer<typeof MembersQuery>;
50
+ declare const MembersPage: z.ZodObject<{
51
+ rows: z.ZodArray<z.ZodObject<{
52
+ id: z.ZodString;
53
+ firstName: z.ZodNullable<z.ZodString>;
54
+ lastName: z.ZodNullable<z.ZodString>;
55
+ email: z.ZodString;
56
+ image: z.ZodNullable<z.ZodString>;
57
+ role: z.ZodEnum<{
58
+ owner: "owner";
59
+ admin: "admin";
60
+ instructor: "instructor";
61
+ }>;
62
+ status: z.ZodEnum<{
63
+ active: "active";
64
+ invited: "invited";
65
+ }>;
66
+ joinedAt: z.ZodNullable<z.ZodString>;
67
+ invitedAt: z.ZodNullable<z.ZodString>;
68
+ }, z.core.$strip>>;
69
+ total: z.ZodNumber;
70
+ page: z.ZodNumber;
71
+ pageSize: z.ZodNumber;
72
+ }, z.core.$strip>;
73
+ type MembersPage = z.infer<typeof MembersPage>;
74
+ declare const UpdateMemberRole: z.ZodObject<{
75
+ role: z.ZodEnum<{
76
+ owner: "owner";
77
+ admin: "admin";
78
+ instructor: "instructor";
79
+ }>;
80
+ }, z.core.$strip>;
81
+ type UpdateMemberRole = z.infer<typeof UpdateMemberRole>;
82
+ declare const MemberIdParam: z.ZodObject<{
83
+ id: z.ZodString;
84
+ }, z.core.$strip>;
85
+ type MemberIdParam = z.infer<typeof MemberIdParam>;
86
+ //#endregion
87
+ export { Member, MemberIdParam, MemberStatus, MembersPage, MembersQuery, Role, UpdateMemberRole };
88
+ //# sourceMappingURL=members.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { ListQuery, OrgUserProfileSchema, paginated } from "./shared.js";
2
+ import { z } from "zod";
3
+ //#region src/http/schemas/members.ts
4
+ /** Org-scoped roles, mirrored from better-auth's organization plugin. */
5
+ const Role = z.enum([
6
+ "owner",
7
+ "admin",
8
+ "instructor"
9
+ ]);
10
+ const MemberStatus = z.enum(["active", "invited"]);
11
+ const Member = OrgUserProfileSchema.extend({
12
+ role: Role,
13
+ status: MemberStatus,
14
+ joinedAt: z.string().nullable(),
15
+ invitedAt: z.string().nullable()
16
+ });
17
+ const MembersQuery = ListQuery.extend({
18
+ role: Role.optional(),
19
+ status: MemberStatus.optional()
20
+ });
21
+ const MembersPage = paginated(Member);
22
+ const UpdateMemberRole = z.object({ role: Role });
23
+ const MemberIdParam = z.object({ id: z.string() });
24
+ //#endregion
25
+ export { Member, MemberIdParam, MemberStatus, MembersPage, MembersQuery, Role, UpdateMemberRole };
26
+
27
+ //# sourceMappingURL=members.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"members.js","names":[],"sources":["../../../src/http/schemas/members.ts"],"sourcesContent":["// Team (org members) resource schemas.\nimport { z } from \"zod\";\nimport { ListQuery, paginated, OrgUserProfileSchema } from \"./shared.js\";\n\n/** Org-scoped roles, mirrored from better-auth's organization plugin. */\nexport const Role = z.enum([\"owner\", \"admin\", \"instructor\"]);\nexport type Role = z.infer<typeof Role>;\n\nexport const MemberStatus = z.enum([\"active\", \"invited\"]);\nexport type MemberStatus = z.infer<typeof MemberStatus>;\n\nexport const Member = OrgUserProfileSchema.extend({\n role: Role,\n status: MemberStatus,\n joinedAt: z.string().nullable(),\n invitedAt: z.string().nullable(),\n});\nexport type Member = z.infer<typeof Member>;\n\nexport const MembersQuery = ListQuery.extend({\n role: Role.optional(),\n status: MemberStatus.optional(),\n});\nexport type MembersQuery = z.infer<typeof MembersQuery>;\n\nexport const MembersPage = paginated(Member);\nexport type MembersPage = z.infer<typeof MembersPage>;\n\nexport const UpdateMemberRole = z.object({ role: Role });\nexport type UpdateMemberRole = z.infer<typeof UpdateMemberRole>;\n\nexport const MemberIdParam = z.object({ id: z.string() });\nexport type MemberIdParam = z.infer<typeof MemberIdParam>;\n"],"mappings":";;;;AAKA,MAAa,OAAO,EAAE,KAAK;CAAC;CAAS;CAAS;AAAY,CAAC;AAG3D,MAAa,eAAe,EAAE,KAAK,CAAC,UAAU,SAAS,CAAC;AAGxD,MAAa,SAAS,qBAAqB,OAAO;CAChD,MAAM;CACN,QAAQ;CACR,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;CAC9B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;AACjC,CAAC;AAGD,MAAa,eAAe,UAAU,OAAO;CAC3C,MAAM,KAAK,SAAS;CACpB,QAAQ,aAAa,SAAS;AAChC,CAAC;AAGD,MAAa,cAAc,UAAU,MAAM;AAG3C,MAAa,mBAAmB,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAGvD,MAAa,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/organizations.d.ts
3
+ declare const Organization: z.ZodObject<{
4
+ id: z.ZodString;
5
+ name: z.ZodString;
6
+ slug: z.ZodString;
7
+ createdAt: z.ZodString;
8
+ }, z.core.$strip>;
9
+ type Organization = z.infer<typeof Organization>;
10
+ declare const CreateOrganization: z.ZodObject<{
11
+ name: z.ZodString;
12
+ slug: z.ZodString;
13
+ }, z.core.$strip>;
14
+ type CreateOrganization = z.infer<typeof CreateOrganization>;
15
+ declare const UpdateOrganization: z.ZodObject<{
16
+ name: z.ZodString;
17
+ slug: z.ZodString;
18
+ }, z.core.$strip>;
19
+ type UpdateOrganization = z.infer<typeof UpdateOrganization>;
20
+ //#endregion
21
+ export { CreateOrganization, Organization, UpdateOrganization };
22
+ //# sourceMappingURL=organizations.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/organizations.ts
3
+ const Organization = z.object({
4
+ id: z.string(),
5
+ name: z.string(),
6
+ slug: z.string(),
7
+ createdAt: z.string()
8
+ });
9
+ const CreateOrganization = z.object({
10
+ name: z.string().min(1),
11
+ slug: z.string().min(1)
12
+ });
13
+ const UpdateOrganization = z.object({
14
+ name: z.string().min(1).max(100),
15
+ slug: z.string().min(1).max(50).regex(/^[a-z0-9-]+$/, "Use lowercase letters, numbers, and hyphens only")
16
+ });
17
+ //#endregion
18
+ export { CreateOrganization, Organization, UpdateOrganization };
19
+
20
+ //# sourceMappingURL=organizations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.js","names":[],"sources":["../../../src/http/schemas/organizations.ts"],"sourcesContent":["// Organization resource schemas. Org creation is served by the API's own\n// `/api/organizations` route (which drives Better Auth under the hood), so the\n// created org is part of the typed contract and SDK — not the auth namespace.\nimport { z } from \"zod\";\n\nexport const Organization = z.object({\n id: z.string(),\n name: z.string(),\n slug: z.string(),\n createdAt: z.string(),\n});\nexport type Organization = z.infer<typeof Organization>;\n\nexport const CreateOrganization = z.object({\n name: z.string().min(1),\n slug: z.string().min(1),\n});\nexport type CreateOrganization = z.infer<typeof CreateOrganization>;\n\n// Update the active organization's profile. Slug must stay URL-safe (Better Auth\n// enforces uniqueness); both fields are sent together from the settings form.\nexport const UpdateOrganization = z.object({\n name: z.string().min(1).max(100),\n slug: z\n .string()\n .min(1)\n .max(50)\n .regex(/^[a-z0-9-]+$/, \"Use lowercase letters, numbers, and hyphens only\"),\n});\nexport type UpdateOrganization = z.infer<typeof UpdateOrganization>;\n"],"mappings":";;AAKA,MAAa,eAAe,EAAE,OAAO;CACnC,IAAI,EAAE,OAAO;CACb,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO;CACf,WAAW,EAAE,OAAO;AACtB,CAAC;AAGD,MAAa,qBAAqB,EAAE,OAAO;CACzC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACtB,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AACxB,CAAC;AAKD,MAAa,qBAAqB,EAAE,OAAO;CACzC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CAC/B,MAAM,EACH,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,IAAI,EAAE,CAAC,CACP,MAAM,gBAAgB,kDAAkD;AAC7E,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/settings.d.ts
3
+ /** A namespace's values. The owning domain defines the shape; the contract
4
+ * carries it opaquely so a new namespace needs no contract change. */
5
+ declare const SettingsValue: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6
+ type SettingsValue = z.infer<typeof SettingsValue>;
7
+ declare const ScopeSettings: z.ZodObject<{
8
+ scopeId: z.ZodString;
9
+ namespaces: z.ZodRecord<z.ZodString, z.ZodAny>;
10
+ }, z.core.$strip>;
11
+ type ScopeSettings = z.infer<typeof ScopeSettings>;
12
+ declare const SettingsScopeParam: z.ZodObject<{
13
+ scopeId: z.ZodString;
14
+ }, z.core.$strip>;
15
+ declare const SettingsNamespaceParam: z.ZodObject<{
16
+ scopeId: z.ZodString;
17
+ namespace: z.ZodString;
18
+ }, z.core.$strip>;
19
+ /** Partial by definition — the server shallow-merges it into the stored value. */
20
+ declare const PatchSettings: z.ZodRecord<z.ZodString, z.ZodUnknown>;
21
+ //#endregion
22
+ export { PatchSettings, ScopeSettings, SettingsNamespaceParam, SettingsScopeParam, SettingsValue };
23
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/settings.ts
3
+ /** A namespace's values. The owning domain defines the shape; the contract
4
+ * carries it opaquely so a new namespace needs no contract change. */
5
+ const SettingsValue = z.record(z.string(), z.unknown());
6
+ const ScopeSettings = z.object({
7
+ scopeId: z.string(),
8
+ namespaces: z.record(z.string(), z.any())
9
+ });
10
+ const SettingsScopeParam = z.object({ scopeId: z.string() });
11
+ const SettingsNamespaceParam = z.object({
12
+ scopeId: z.string(),
13
+ namespace: z.string()
14
+ });
15
+ /** Partial by definition — the server shallow-merges it into the stored value. */
16
+ const PatchSettings = SettingsValue;
17
+ //#endregion
18
+ export { PatchSettings, ScopeSettings, SettingsNamespaceParam, SettingsScopeParam, SettingsValue };
19
+
20
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","names":[],"sources":["../../../src/http/schemas/settings.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/** A namespace's values. The owning domain defines the shape; the contract\n * carries it opaquely so a new namespace needs no contract change. */\nexport const SettingsValue = z.record(z.string(), z.unknown());\nexport type SettingsValue = z.infer<typeof SettingsValue>;\n\n\nexport const ScopeSettings = z.object({\n scopeId: z.string(),\n namespaces: z.record(z.string(), z.any()),\n});\nexport type ScopeSettings = z.infer<typeof ScopeSettings>;\n\nexport const SettingsScopeParam = z.object({ scopeId: z.string() });\nexport const SettingsNamespaceParam = z.object({\n scopeId: z.string(),\n namespace: z.string(),\n});\n\n/** Partial by definition — the server shallow-merges it into the stored value. */\nexport const PatchSettings = SettingsValue;\n"],"mappings":";;;;AAIA,MAAa,gBAAgB,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAI7D,MAAa,gBAAgB,EAAE,OAAO;CACpC,SAAS,EAAE,OAAO;CAClB,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAC1C,CAAC;AAGD,MAAa,qBAAqB,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAClE,MAAa,yBAAyB,EAAE,OAAO;CAC7C,SAAS,EAAE,OAAO;CAClB,WAAW,EAAE,OAAO;AACtB,CAAC;;AAGD,MAAa,gBAAgB"}
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/shared.d.ts
3
+ /** Fails typecheck when a schema and its domain type drift apart. */
4
+ type Matches<A, _B extends A> = true;
5
+ /** Uniform error envelope returned by every non-2xx response. */
6
+ declare const ErrorBody: z.ZodObject<{
7
+ error: z.ZodString;
8
+ message: z.ZodOptional<z.ZodString>;
9
+ }, z.core.$strip>;
10
+ type ErrorBody = z.infer<typeof ErrorBody>;
11
+ /**
12
+ * Common list query for page-based collections. `z.coerce` because query-string
13
+ * values arrive as strings; defaults make the params optional for callers.
14
+ */
15
+ declare const ListQuery: z.ZodObject<{
16
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
17
+ pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
18
+ search: z.ZodOptional<z.ZodString>;
19
+ sort: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>;
21
+ type ListQuery = z.infer<typeof ListQuery>;
22
+ /** Wrap a row schema into the standard paginated envelope. */
23
+ declare function paginated<T extends z.ZodTypeAny>(row: T): z.ZodObject<{
24
+ rows: z.ZodArray<T>;
25
+ total: z.ZodNumber;
26
+ page: z.ZodNumber;
27
+ pageSize: z.ZodNumber;
28
+ }, z.core.$strip>;
29
+ /** All four org roles. `members.ts` exports a staff-only three-value `Role`;
30
+ * this is the full set, used wherever a learner can also appear. */
31
+ declare const OrgRole: z.ZodEnum<{
32
+ owner: "owner";
33
+ admin: "admin";
34
+ instructor: "instructor";
35
+ student: "student";
36
+ }>;
37
+ type OrgRole = z.infer<typeof OrgRole>;
38
+ /** Mirrors UserProfile in @headless-lms/core/types — keyed on the auth user id. */
39
+ declare const UserProfileSchema: z.ZodObject<{
40
+ id: z.ZodString;
41
+ name: z.ZodString;
42
+ email: z.ZodString;
43
+ image: z.ZodNullable<z.ZodString>;
44
+ }, z.core.$strip>;
45
+ type UserProfileSchema = z.infer<typeof UserProfileSchema>;
46
+ /** Mirrors OrgUserProfile in @headless-lms/core/types — keyed on org_users.id. */
47
+ declare const OrgUserProfileSchema: z.ZodObject<{
48
+ id: z.ZodString;
49
+ firstName: z.ZodNullable<z.ZodString>;
50
+ lastName: z.ZodNullable<z.ZodString>;
51
+ email: z.ZodString;
52
+ image: z.ZodNullable<z.ZodString>;
53
+ }, z.core.$strip>;
54
+ type OrgUserProfileSchema = z.infer<typeof OrgUserProfileSchema>;
55
+ //#endregion
56
+ export { ErrorBody, ListQuery, Matches, OrgRole, OrgUserProfileSchema, UserProfileSchema, paginated };
57
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/shared.ts
3
+ /** Uniform error envelope returned by every non-2xx response. */
4
+ const ErrorBody = z.object({
5
+ error: z.string(),
6
+ message: z.string().optional()
7
+ });
8
+ /**
9
+ * Common list query for page-based collections. `z.coerce` because query-string
10
+ * values arrive as strings; defaults make the params optional for callers.
11
+ */
12
+ const ListQuery = z.object({
13
+ page: z.coerce.number().int().min(1).default(1),
14
+ pageSize: z.coerce.number().int().min(1).max(100).default(20),
15
+ search: z.string().trim().optional(),
16
+ /** Sort field, optionally prefixed with `-` for descending (e.g. `-updatedAt`). */
17
+ sort: z.string().optional()
18
+ });
19
+ /** Wrap a row schema into the standard paginated envelope. */
20
+ function paginated(row) {
21
+ return z.object({
22
+ rows: z.array(row),
23
+ total: z.number().int(),
24
+ page: z.number().int(),
25
+ pageSize: z.number().int()
26
+ });
27
+ }
28
+ /** All four org roles. `members.ts` exports a staff-only three-value `Role`;
29
+ * this is the full set, used wherever a learner can also appear. */
30
+ const OrgRole = z.enum([
31
+ "owner",
32
+ "admin",
33
+ "instructor",
34
+ "student"
35
+ ]);
36
+ /** Mirrors UserProfile in @headless-lms/core/types — keyed on the auth user id. */
37
+ const UserProfileSchema = z.object({
38
+ id: z.string(),
39
+ name: z.string(),
40
+ email: z.string(),
41
+ image: z.string().nullable()
42
+ });
43
+ /** Mirrors OrgUserProfile in @headless-lms/core/types — keyed on org_users.id. */
44
+ const OrgUserProfileSchema = z.object({
45
+ id: z.string(),
46
+ firstName: z.string().nullable(),
47
+ lastName: z.string().nullable(),
48
+ email: z.string(),
49
+ image: z.string().nullable()
50
+ });
51
+ //#endregion
52
+ export { ErrorBody, ListQuery, OrgRole, OrgUserProfileSchema, UserProfileSchema, paginated };
53
+
54
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","names":[],"sources":["../../../src/http/schemas/shared.ts"],"sourcesContent":["// Shared contract primitives reused across resource contracts.\nimport { z } from \"zod\";\n\n/** Fails typecheck when a schema and its domain type drift apart. */\nexport type Matches<A, _B extends A> = true;\n\n/** Uniform error envelope returned by every non-2xx response. */\nexport const ErrorBody = z.object({\n error: z.string(),\n message: z.string().optional(),\n});\nexport type ErrorBody = z.infer<typeof ErrorBody>;\n\n/**\n * Common list query for page-based collections. `z.coerce` because query-string\n * values arrive as strings; defaults make the params optional for callers.\n */\nexport const ListQuery = z.object({\n page: z.coerce.number().int().min(1).default(1),\n pageSize: z.coerce.number().int().min(1).max(100).default(20),\n search: z.string().trim().optional(),\n /** Sort field, optionally prefixed with `-` for descending (e.g. `-updatedAt`). */\n sort: z.string().optional(),\n});\nexport type ListQuery = z.infer<typeof ListQuery>;\n\n/** Wrap a row schema into the standard paginated envelope. */\nexport function paginated<T extends z.ZodTypeAny>(row: T) {\n return z.object({\n rows: z.array(row),\n total: z.number().int(),\n page: z.number().int(),\n pageSize: z.number().int(),\n });\n}\n\n/** All four org roles. `members.ts` exports a staff-only three-value `Role`;\n * this is the full set, used wherever a learner can also appear. */\nexport const OrgRole = z.enum([\"owner\", \"admin\", \"instructor\", \"student\"]);\nexport type OrgRole = z.infer<typeof OrgRole>;\n\n/** Mirrors UserProfile in @headless-lms/core/types — keyed on the auth user id. */\nexport const UserProfileSchema = z.object({\n id: z.string(),\n name: z.string(),\n email: z.string(),\n image: z.string().nullable(),\n});\nexport type UserProfileSchema = z.infer<typeof UserProfileSchema>;\n\n/** Mirrors OrgUserProfile in @headless-lms/core/types — keyed on org_users.id. */\nexport const OrgUserProfileSchema = z.object({\n id: z.string(),\n firstName: z.string().nullable(),\n lastName: z.string().nullable(),\n email: z.string(),\n image: z.string().nullable(),\n});\nexport type OrgUserProfileSchema = z.infer<typeof OrgUserProfileSchema>;\n"],"mappings":";;;AAOA,MAAa,YAAY,EAAE,OAAO;CAChC,OAAO,EAAE,OAAO;CAChB,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;AAC/B,CAAC;;;;;AAOD,MAAa,YAAY,EAAE,OAAO;CAChC,MAAM,EAAE,OAAO,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;CAC9C,UAAU,EAAE,OAAO,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE;CAC5D,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS;;CAEnC,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;AAC5B,CAAC;;AAID,SAAgB,UAAkC,KAAQ;CACxD,OAAO,EAAE,OAAO;EACd,MAAM,EAAE,MAAM,GAAG;EACjB,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI;EACtB,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI;EACrB,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI;CAC3B,CAAC;AACH;;;AAIA,MAAa,UAAU,EAAE,KAAK;CAAC;CAAS;CAAS;CAAc;AAAS,CAAC;;AAIzE,MAAa,oBAAoB,EAAE,OAAO;CACxC,IAAI,EAAE,OAAO;CACb,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO;CAChB,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;AAC7B,CAAC;;AAID,MAAa,uBAAuB,EAAE,OAAO;CAC3C,IAAI,EAAE,OAAO;CACb,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;CAC9B,OAAO,EAAE,OAAO;CAChB,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;AAC7B,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { z } from "zod";
2
+ //#region src/http/schemas/students.d.ts
3
+ declare const OrgUserStatus: z.ZodEnum<{
4
+ active: "active";
5
+ invited: "invited";
6
+ }>;
7
+ type OrgUserStatus = z.infer<typeof OrgUserStatus>;
8
+ declare const Student: z.ZodObject<{
9
+ id: z.ZodString;
10
+ firstName: z.ZodNullable<z.ZodString>;
11
+ lastName: z.ZodNullable<z.ZodString>;
12
+ email: z.ZodString;
13
+ image: z.ZodNullable<z.ZodString>;
14
+ entitlementCount: z.ZodNumber;
15
+ avgProgress: z.ZodNumber;
16
+ status: z.ZodEnum<{
17
+ active: "active";
18
+ invited: "invited";
19
+ }>;
20
+ joinedAt: z.ZodString;
21
+ lastActiveAt: z.ZodNullable<z.ZodString>;
22
+ }, z.core.$strip>;
23
+ type Student = z.infer<typeof Student>;
24
+ declare const StudentsQuery: z.ZodObject<{
25
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
26
+ pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
27
+ search: z.ZodOptional<z.ZodString>;
28
+ sort: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strip>;
30
+ type StudentsQuery = z.infer<typeof StudentsQuery>;
31
+ declare const StudentsPage: z.ZodObject<{
32
+ rows: z.ZodArray<z.ZodObject<{
33
+ id: z.ZodString;
34
+ firstName: z.ZodNullable<z.ZodString>;
35
+ lastName: z.ZodNullable<z.ZodString>;
36
+ email: z.ZodString;
37
+ image: z.ZodNullable<z.ZodString>;
38
+ entitlementCount: z.ZodNumber;
39
+ avgProgress: z.ZodNumber;
40
+ status: z.ZodEnum<{
41
+ active: "active";
42
+ invited: "invited";
43
+ }>;
44
+ joinedAt: z.ZodString;
45
+ lastActiveAt: z.ZodNullable<z.ZodString>;
46
+ }, z.core.$strip>>;
47
+ total: z.ZodNumber;
48
+ page: z.ZodNumber;
49
+ pageSize: z.ZodNumber;
50
+ }, z.core.$strip>;
51
+ type StudentsPage = z.infer<typeof StudentsPage>;
52
+ declare const StudentIdParam: z.ZodObject<{
53
+ id: z.ZodString;
54
+ }, z.core.$strip>;
55
+ type StudentIdParam = z.infer<typeof StudentIdParam>;
56
+ declare const UpdateStudentBody: z.ZodObject<{
57
+ firstName: z.ZodString;
58
+ lastName: z.ZodString;
59
+ email: z.ZodString;
60
+ }, z.core.$strip>;
61
+ type UpdateStudentBody = z.infer<typeof UpdateStudentBody>;
62
+ //#endregion
63
+ export { OrgUserStatus, Student, StudentIdParam, StudentsPage, StudentsQuery, UpdateStudentBody };
64
+ //# sourceMappingURL=students.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { ListQuery, OrgUserProfileSchema, paginated } from "./shared.js";
2
+ import { z } from "zod";
3
+ //#region src/http/schemas/students.ts
4
+ const OrgUserStatus = z.enum(["invited", "active"]);
5
+ const Student = OrgUserProfileSchema.extend({
6
+ entitlementCount: z.number().int(),
7
+ /** 0–100, averaged across active entitlements. */
8
+ avgProgress: z.number().int(),
9
+ /** `invited` means an admin added them and they have not accepted yet. */
10
+ status: OrgUserStatus,
11
+ joinedAt: z.string(),
12
+ lastActiveAt: z.string().nullable()
13
+ });
14
+ const StudentsQuery = ListQuery;
15
+ const StudentsPage = paginated(Student);
16
+ const StudentIdParam = z.object({ id: z.string() });
17
+ const UpdateStudentBody = z.object({
18
+ firstName: z.string().trim().min(1),
19
+ lastName: z.string().trim().min(1),
20
+ email: z.string().email()
21
+ });
22
+ //#endregion
23
+ export { OrgUserStatus, Student, StudentIdParam, StudentsPage, StudentsQuery, UpdateStudentBody };
24
+
25
+ //# sourceMappingURL=students.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"students.js","names":[],"sources":["../../../src/http/schemas/students.ts"],"sourcesContent":["// Students resource schemas.\nimport { z } from \"zod\";\nimport { ListQuery, paginated, OrgUserProfileSchema } from \"./shared.js\";\n\nexport const OrgUserStatus = z.enum([\"invited\", \"active\"]);\nexport type OrgUserStatus = z.infer<typeof OrgUserStatus>;\n\nexport const Student = OrgUserProfileSchema.extend({\n entitlementCount: z.number().int(),\n /** 0–100, averaged across active entitlements. */\n avgProgress: z.number().int(),\n /** `invited` means an admin added them and they have not accepted yet. */\n status: OrgUserStatus,\n joinedAt: z.string(),\n lastActiveAt: z.string().nullable(),\n});\nexport type Student = z.infer<typeof Student>;\n\nexport const StudentsQuery = ListQuery;\nexport type StudentsQuery = z.infer<typeof StudentsQuery>;\n\nexport const StudentsPage = paginated(Student);\nexport type StudentsPage = z.infer<typeof StudentsPage>;\n\nexport const StudentIdParam = z.object({ id: z.string() });\nexport type StudentIdParam = z.infer<typeof StudentIdParam>;\n\n// Every field is a correction to what an admin typed, so all three are sent\n// together — the form edits the whole profile, not one attribute at a time.\nexport const UpdateStudentBody = z.object({\n firstName: z.string().trim().min(1),\n lastName: z.string().trim().min(1),\n email: z.string().email(),\n});\nexport type UpdateStudentBody = z.infer<typeof UpdateStudentBody>;\n"],"mappings":";;;AAIA,MAAa,gBAAgB,EAAE,KAAK,CAAC,WAAW,QAAQ,CAAC;AAGzD,MAAa,UAAU,qBAAqB,OAAO;CACjD,kBAAkB,EAAE,OAAO,CAAC,CAAC,IAAI;;CAEjC,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI;;CAE5B,QAAQ;CACR,UAAU,EAAE,OAAO;CACnB,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS;AACpC,CAAC;AAGD,MAAa,gBAAgB;AAG7B,MAAa,eAAe,UAAU,OAAO;AAG7C,MAAa,iBAAiB,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAKzD,MAAa,oBAAoB,EAAE,OAAO;CACxC,WAAW,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CAClC,UAAU,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CACjC,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM;AAC1B,CAAC"}