@headless-lms/server 0.1.0 → 0.2.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 (101) hide show
  1. package/README.md +1 -1
  2. package/dist/app/container.d.ts +7 -3
  3. package/dist/app/container.js +57 -26
  4. package/dist/app/container.js.map +1 -1
  5. package/dist/app/notifications.js +4 -1
  6. package/dist/app/notifications.js.map +1 -1
  7. package/dist/http/plugins/error-handler.d.ts +1 -1
  8. package/dist/http/plugins/error-handler.js +15 -4
  9. package/dist/http/plugins/error-handler.js.map +1 -1
  10. package/dist/http/plugins/openapi.js +25 -22
  11. package/dist/http/plugins/openapi.js.map +1 -1
  12. package/dist/http/routes/activities.js +34 -2
  13. package/dist/http/routes/activities.js.map +1 -1
  14. package/dist/http/routes/assets.js +4 -0
  15. package/dist/http/routes/assets.js.map +1 -1
  16. package/dist/http/routes/automations.js +32 -8
  17. package/dist/http/routes/automations.js.map +1 -1
  18. package/dist/http/routes/bundles.d.ts +7 -0
  19. package/dist/http/routes/bundles.js +170 -0
  20. package/dist/http/routes/bundles.js.map +1 -0
  21. package/dist/http/routes/course-analytics.d.ts +7 -0
  22. package/dist/http/routes/course-analytics.js +58 -0
  23. package/dist/http/routes/course-analytics.js.map +1 -0
  24. package/dist/http/routes/courses.js +8 -8
  25. package/dist/http/routes/courses.js.map +1 -1
  26. package/dist/http/routes/dashboard.js +2 -2
  27. package/dist/http/routes/dashboard.js.map +1 -1
  28. package/dist/http/routes/discussion.js +1 -1
  29. package/dist/http/routes/discussion.js.map +1 -1
  30. package/dist/http/routes/downloads.js +10 -10
  31. package/dist/http/routes/downloads.js.map +1 -1
  32. package/dist/http/routes/integrations.js.map +1 -1
  33. package/dist/http/routes/learn/assets.js +1 -1
  34. package/dist/http/routes/learn/assets.js.map +1 -1
  35. package/dist/http/routes/learn/comments.js +7 -7
  36. package/dist/http/routes/learn/comments.js.map +1 -1
  37. package/dist/http/routes/learn/courses.js +26 -3
  38. package/dist/http/routes/learn/courses.js.map +1 -1
  39. package/dist/http/routes/learn/downloads.js +3 -3
  40. package/dist/http/routes/learn/downloads.js.map +1 -1
  41. package/dist/http/routes/learn/org.js +2 -2
  42. package/dist/http/routes/learn/org.js.map +1 -1
  43. package/dist/http/routes/learn/progress.js +2 -2
  44. package/dist/http/routes/learn/progress.js.map +1 -1
  45. package/dist/http/routes/organizations.js.map +1 -1
  46. package/dist/http/routes/students.js +27 -6
  47. package/dist/http/routes/students.js.map +1 -1
  48. package/dist/http/routes/webhooks.d.ts +7 -0
  49. package/dist/http/routes/webhooks.js +159 -0
  50. package/dist/http/routes/webhooks.js.map +1 -0
  51. package/dist/http/routes.js +6 -0
  52. package/dist/http/routes.js.map +1 -1
  53. package/dist/http/schemas/activities.d.ts +34 -1
  54. package/dist/http/schemas/activities.js +7 -2
  55. package/dist/http/schemas/activities.js.map +1 -1
  56. package/dist/http/schemas/assets.d.ts +11 -7
  57. package/dist/http/schemas/assets.js.map +1 -1
  58. package/dist/http/schemas/automations.d.ts +75 -8
  59. package/dist/http/schemas/automations.js +13 -2
  60. package/dist/http/schemas/automations.js.map +1 -1
  61. package/dist/http/schemas/bundles.d.ts +63 -0
  62. package/dist/http/schemas/bundles.js +23 -0
  63. package/dist/http/schemas/bundles.js.map +1 -0
  64. package/dist/http/schemas/content.d.ts +18 -11
  65. package/dist/http/schemas/content.js +1 -2
  66. package/dist/http/schemas/content.js.map +1 -1
  67. package/dist/http/schemas/course-analytics.d.ts +29 -0
  68. package/dist/http/schemas/course-analytics.js +21 -0
  69. package/dist/http/schemas/course-analytics.js.map +1 -0
  70. package/dist/http/schemas/dashboard.js.map +1 -1
  71. package/dist/http/schemas/discussion.d.ts +9 -9
  72. package/dist/http/schemas/discussion.js.map +1 -1
  73. package/dist/http/schemas/downloads.d.ts +2 -0
  74. package/dist/http/schemas/downloads.js.map +1 -1
  75. package/dist/http/schemas/entitlements.d.ts +14 -6
  76. package/dist/http/schemas/entitlements.js +4 -2
  77. package/dist/http/schemas/entitlements.js.map +1 -1
  78. package/dist/http/schemas/index.d.ts +6 -4
  79. package/dist/http/schemas/index.js +6 -4
  80. package/dist/http/schemas/integrations.d.ts +4 -4
  81. package/dist/http/schemas/integrations.js.map +1 -1
  82. package/dist/http/schemas/invites.js +2 -1
  83. package/dist/http/schemas/invites.js.map +1 -1
  84. package/dist/http/schemas/learn.d.ts +11 -1
  85. package/dist/http/schemas/learn.js.map +1 -1
  86. package/dist/http/schemas/members.js.map +1 -1
  87. package/dist/http/schemas/organizations.js.map +1 -1
  88. package/dist/http/schemas/settings.js.map +1 -1
  89. package/dist/http/schemas/shared.d.ts +1 -0
  90. package/dist/http/schemas/shared.js +3 -1
  91. package/dist/http/schemas/shared.js.map +1 -1
  92. package/dist/http/schemas/students.d.ts +30 -2
  93. package/dist/http/schemas/students.js +21 -2
  94. package/dist/http/schemas/students.js.map +1 -1
  95. package/dist/http/server.js +4 -2
  96. package/dist/http/server.js.map +1 -1
  97. package/dist/index.d.ts +2 -2
  98. package/dist/index.js.map +1 -1
  99. package/dist/package.js +6 -0
  100. package/dist/package.js.map +1 -0
  101. package/package.json +5 -5
@@ -21,6 +21,34 @@ declare const Student: z.ZodObject<{
21
21
  lastActiveAt: z.ZodNullable<z.ZodString>;
22
22
  }, z.core.$strip>;
23
23
  type Student = z.infer<typeof Student>;
24
+ declare const StudentCourseProgress: z.ZodObject<{
25
+ courseId: z.ZodString;
26
+ title: z.ZodString;
27
+ totalActivities: z.ZodNumber;
28
+ completedActivities: z.ZodNumber;
29
+ progress: z.ZodNumber;
30
+ startedAt: z.ZodNullable<z.ZodString>;
31
+ lastActivityAt: z.ZodNullable<z.ZodString>;
32
+ completedAt: z.ZodNullable<z.ZodString>;
33
+ }, z.core.$strip>;
34
+ type StudentCourseProgress = z.infer<typeof StudentCourseProgress>;
35
+ declare const StudentAnalytics: z.ZodObject<{
36
+ enrolled: z.ZodNumber;
37
+ started: z.ZodNumber;
38
+ completed: z.ZodNumber;
39
+ avgProgress: z.ZodNumber;
40
+ courses: z.ZodArray<z.ZodObject<{
41
+ courseId: z.ZodString;
42
+ title: z.ZodString;
43
+ totalActivities: z.ZodNumber;
44
+ completedActivities: z.ZodNumber;
45
+ progress: z.ZodNumber;
46
+ startedAt: z.ZodNullable<z.ZodString>;
47
+ lastActivityAt: z.ZodNullable<z.ZodString>;
48
+ completedAt: z.ZodNullable<z.ZodString>;
49
+ }, z.core.$strip>>;
50
+ }, z.core.$strip>;
51
+ type StudentAnalytics = z.infer<typeof StudentAnalytics>;
24
52
  declare const StudentsQuery: z.ZodObject<{
25
53
  page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
26
54
  pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
@@ -56,9 +84,9 @@ type StudentIdParam = z.infer<typeof StudentIdParam>;
56
84
  declare const UpdateStudentBody: z.ZodObject<{
57
85
  firstName: z.ZodString;
58
86
  lastName: z.ZodString;
59
- email: z.ZodString;
87
+ email: z.ZodEmail;
60
88
  }, z.core.$strip>;
61
89
  type UpdateStudentBody = z.infer<typeof UpdateStudentBody>;
62
90
  //#endregion
63
- export { OrgUserStatus, Student, StudentIdParam, StudentsPage, StudentsQuery, UpdateStudentBody };
91
+ export { OrgUserStatus, Student, StudentAnalytics, StudentCourseProgress, StudentIdParam, StudentsPage, StudentsQuery, UpdateStudentBody };
64
92
  //# sourceMappingURL=students.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { ListQuery, OrgUserProfileSchema, paginated } from "./shared.js";
2
2
  import { z } from "zod";
3
+ import { emailSchema } from "@headless-lms/core/schemas";
3
4
  //#region src/http/schemas/students.ts
4
5
  const OrgUserStatus = z.enum(["invited", "active"]);
5
6
  const Student = OrgUserProfileSchema.extend({
@@ -11,15 +12,33 @@ const Student = OrgUserProfileSchema.extend({
11
12
  joinedAt: z.string(),
12
13
  lastActiveAt: z.string().nullable()
13
14
  });
15
+ const StudentCourseProgress = z.object({
16
+ courseId: z.string(),
17
+ title: z.string(),
18
+ totalActivities: z.number().int(),
19
+ completedActivities: z.number().int(),
20
+ /** 0–100, completed published activities over the course's total. */
21
+ progress: z.number().int(),
22
+ startedAt: z.string().nullable(),
23
+ lastActivityAt: z.string().nullable(),
24
+ completedAt: z.string().nullable()
25
+ });
26
+ const StudentAnalytics = z.object({
27
+ enrolled: z.number().int(),
28
+ started: z.number().int(),
29
+ completed: z.number().int(),
30
+ avgProgress: z.number().int(),
31
+ courses: z.array(StudentCourseProgress)
32
+ });
14
33
  const StudentsQuery = ListQuery;
15
34
  const StudentsPage = paginated(Student);
16
35
  const StudentIdParam = z.object({ id: z.string() });
17
36
  const UpdateStudentBody = z.object({
18
37
  firstName: z.string().trim().min(1),
19
38
  lastName: z.string().trim().min(1),
20
- email: z.string().email()
39
+ email: emailSchema
21
40
  });
22
41
  //#endregion
23
- export { OrgUserStatus, Student, StudentIdParam, StudentsPage, StudentsQuery, UpdateStudentBody };
42
+ export { OrgUserStatus, Student, StudentAnalytics, StudentCourseProgress, StudentIdParam, StudentsPage, StudentsQuery, UpdateStudentBody };
24
43
 
25
44
  //# sourceMappingURL=students.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"students.js","names":[],"sources":["../../../src/http/schemas/students.ts"],"sourcesContent":["// Students resource schemas.\nimport { z } from 'zod';\nimport { emailSchema } from '@headless-lms/core/schemas';\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 StudentCourseProgress = z.object({\n courseId: z.string(),\n title: z.string(),\n totalActivities: z.number().int(),\n completedActivities: z.number().int(),\n /** 0–100, completed published activities over the course's total. */\n progress: z.number().int(),\n startedAt: z.string().nullable(),\n lastActivityAt: z.string().nullable(),\n completedAt: z.string().nullable(),\n});\nexport type StudentCourseProgress = z.infer<typeof StudentCourseProgress>;\n\nexport const StudentAnalytics = z.object({\n enrolled: z.number().int(),\n started: z.number().int(),\n completed: z.number().int(),\n avgProgress: z.number().int(),\n courses: z.array(StudentCourseProgress),\n});\nexport type StudentAnalytics = z.infer<typeof StudentAnalytics>;\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: emailSchema,\n});\nexport type UpdateStudentBody = z.infer<typeof UpdateStudentBody>;\n"],"mappings":";;;;AAKA,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,wBAAwB,EAAE,OAAO;CAC5C,UAAU,EAAE,OAAO;CACnB,OAAO,EAAE,OAAO;CAChB,iBAAiB,EAAE,OAAO,CAAC,CAAC,IAAI;CAChC,qBAAqB,EAAE,OAAO,CAAC,CAAC,IAAI;;CAEpC,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI;CACzB,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,gBAAgB,EAAE,OAAO,CAAC,CAAC,SAAS;CACpC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;AACnC,CAAC;AAGD,MAAa,mBAAmB,EAAE,OAAO;CACvC,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI;CACzB,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI;CACxB,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI;CAC1B,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI;CAC5B,SAAS,EAAE,MAAM,qBAAqB;AACxC,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;AACT,CAAC"}
@@ -9,9 +9,11 @@ import { serializerCompiler, validatorCompiler } from "fastify-type-provider-zod
9
9
  async function buildServer(config, container) {
10
10
  const app = Fastify({
11
11
  loggerInstance: container.loggerInstance,
12
- disableRequestLogging: config.requestLogging === false
12
+ disableRequestLogging: config.requestLogging === false,
13
+ requestIdHeader: "x-request-id"
13
14
  });
14
- app.addHook("onRequest", (request, _reply, done) => {
15
+ app.addHook("onRequest", (request, reply, done) => {
16
+ reply.header("x-request-id", request.id);
15
17
  container.requestContext.run({ reqId: request.id }, done);
16
18
  });
17
19
  app.setValidatorCompiler(validatorCompiler);
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","names":[],"sources":["../../src/http/server.ts"],"sourcesContent":["import Fastify, { type FastifyBaseLogger, type FastifyInstance } from 'fastify';\nimport { serializerCompiler, validatorCompiler } from 'fastify-type-provider-zod';\nimport type { Container } from '../app/container.js';\nimport type { ServerConfig } from './config.js';\nimport { registerCors } from './plugins/cors.js';\nimport { registerOpenApi } from './plugins/openapi.js';\nimport { registerAuth } from './plugins/auth.js';\nimport { errorHandler } from './plugins/error-handler.js';\nimport { registerRoutes } from './routes.js';\n\nexport async function buildServer(\n config: ServerConfig,\n container: Container,\n): Promise<FastifyInstance> {\n // One log stream for the whole process: HTTP shares the container's pino root.\n // Widened to FastifyBaseLogger so the instance keeps the default logger\n // generic (a concrete pino type would ripple through every plugin signature).\n const app = Fastify({\n loggerInstance: container.loggerInstance as FastifyBaseLogger,\n // Fastify's own request/response pair per call — noisy in a dev console,\n // useful as an access log in production. Our own logs are unaffected.\n disableRequestLogging: config.requestLogging === false,\n });\n\n // Enter the request-scoped log context: every line logged inside this\n // request's async scope carries its reqId (and orgId once resolveScope runs),\n // wherever it is emitted.\n app.addHook('onRequest', (request, _reply, done) => {\n container.requestContext.run({ reqId: request.id }, done);\n });\n\n // Validate + serialize request/response bodies from the shared Zod contract.\n app.setValidatorCompiler(validatorCompiler);\n app.setSerializerCompiler(serializerCompiler);\n app.setErrorHandler(errorHandler);\n\n registerCors(app, config);\n registerOpenApi(app, config);\n registerAuth(app, container);\n\n registerRoutes(app, container);\n\n // Drain + stop the outbox relay and the automation engine on shutdown.\n // Harmless when neither was started (gen-openapi boots this app with\n // ready() + close() only).\n app.addHook('onClose', async () => {\n await container.outboxRelay.stop();\n await container.automationEngine.stop();\n });\n\n return app;\n}\n"],"mappings":";;;;;;;;AAUA,eAAsB,YACpB,QACA,WAC0B;CAI1B,MAAM,MAAM,QAAQ;EAClB,gBAAgB,UAAU;EAG1B,uBAAuB,OAAO,mBAAmB;CACnD,CAAC;CAKD,IAAI,QAAQ,cAAc,SAAS,QAAQ,SAAS;EAClD,UAAU,eAAe,IAAI,EAAE,OAAO,QAAQ,GAAG,GAAG,IAAI;CAC1D,CAAC;CAGD,IAAI,qBAAqB,iBAAiB;CAC1C,IAAI,sBAAsB,kBAAkB;CAC5C,IAAI,gBAAgB,YAAY;CAEhC,aAAa,KAAK,MAAM;CACxB,gBAAgB,KAAK,MAAM;CAC3B,aAAa,KAAK,SAAS;CAE3B,eAAe,KAAK,SAAS;CAK7B,IAAI,QAAQ,WAAW,YAAY;EACjC,MAAM,UAAU,YAAY,KAAK;EACjC,MAAM,UAAU,iBAAiB,KAAK;CACxC,CAAC;CAED,OAAO;AACT"}
1
+ {"version":3,"file":"server.js","names":[],"sources":["../../src/http/server.ts"],"sourcesContent":["import Fastify, { type FastifyBaseLogger, type FastifyInstance } from 'fastify';\nimport { serializerCompiler, validatorCompiler } from 'fastify-type-provider-zod';\nimport type { Container } from '../app/container.js';\nimport type { ServerConfig } from './config.js';\nimport { registerCors } from './plugins/cors.js';\nimport { registerOpenApi } from './plugins/openapi.js';\nimport { registerAuth } from './plugins/auth.js';\nimport { errorHandler } from './plugins/error-handler.js';\nimport { registerRoutes } from './routes.js';\n\nexport async function buildServer(\n config: ServerConfig,\n container: Container,\n): Promise<FastifyInstance> {\n // One log stream for the whole process: HTTP shares the container's pino root.\n // Widened to FastifyBaseLogger so the instance keeps the default logger\n // generic (a concrete pino type would ripple through every plugin signature).\n const app = Fastify({\n loggerInstance: container.loggerInstance as FastifyBaseLogger,\n // Fastify's own request/response pair per call — noisy in a dev console,\n // useful as an access log in production. Our own logs are unaffected.\n disableRequestLogging: config.requestLogging === false,\n // Adopt the caller's correlation id when it sends one, so one id joins\n // the client's log line to this process's.\n requestIdHeader: 'x-request-id',\n });\n\n // Enter the request-scoped log context: every line logged inside this\n // request's async scope carries its reqId (and orgId once resolveScope runs),\n // wherever it is emitted. The id is echoed on the response so callers can\n // quote it when reporting a failure.\n app.addHook('onRequest', (request, reply, done) => {\n reply.header('x-request-id', request.id);\n container.requestContext.run({ reqId: request.id }, done);\n });\n\n // Validate + serialize request/response bodies from the shared Zod contract.\n app.setValidatorCompiler(validatorCompiler);\n app.setSerializerCompiler(serializerCompiler);\n app.setErrorHandler(errorHandler);\n\n registerCors(app, config);\n registerOpenApi(app, config);\n registerAuth(app, container);\n\n registerRoutes(app, container);\n\n // Drain + stop the outbox relay and the automation engine on shutdown.\n // Harmless when neither was started (gen-openapi boots this app with\n // ready() + close() only).\n app.addHook('onClose', async () => {\n await container.outboxRelay.stop();\n await container.automationEngine.stop();\n });\n\n return app;\n}\n"],"mappings":";;;;;;;;AAUA,eAAsB,YACpB,QACA,WAC0B;CAI1B,MAAM,MAAM,QAAQ;EAClB,gBAAgB,UAAU;EAG1B,uBAAuB,OAAO,mBAAmB;EAGjD,iBAAiB;CACnB,CAAC;CAMD,IAAI,QAAQ,cAAc,SAAS,OAAO,SAAS;EACjD,MAAM,OAAO,gBAAgB,QAAQ,EAAE;EACvC,UAAU,eAAe,IAAI,EAAE,OAAO,QAAQ,GAAG,GAAG,IAAI;CAC1D,CAAC;CAGD,IAAI,qBAAqB,iBAAiB;CAC1C,IAAI,sBAAsB,kBAAkB;CAC5C,IAAI,gBAAgB,YAAY;CAEhC,aAAa,KAAK,MAAM;CACxB,gBAAgB,KAAK,MAAM;CAC3B,aAAa,KAAK,SAAS;CAE3B,eAAe,KAAK,SAAS;CAK7B,IAAI,QAAQ,WAAW,YAAY;EACjC,MAAM,UAAU,YAAY,KAAK;EACjC,MAAM,UAAU,iBAAiB,KAAK;CACxC,CAAC;CAED,OAAO;AACT"}
package/dist/index.d.ts CHANGED
@@ -5,11 +5,11 @@ import { ServerConfig } from "./http/config.js";
5
5
  import { buildServer } from "./http/server.js";
6
6
  import { runMigrations } from "@headless-lms/adapter-db";
7
7
  import { InlineAutomationEngine } from "@headless-lms/adapter-defaults/workflows";
8
- import { AutomationEngine } from "@headless-lms/core/automations";
8
+ import { AutomationEngine, WebhookSender } from "@headless-lms/core/automations";
9
9
  import { Mailer } from "@headless-lms/core/shared/mailer";
10
10
  import { EmailMessage, EmailSender, ObjectStorage } from "@headless-lms/core/shared/ports";
11
11
  //#region src/index.d.ts
12
12
  declare function createContainer(config: ServerConfig, options?: BuildContainerOptions): Promise<Container>;
13
13
  //#endregion
14
- export { type AdapterOverrides, type AuthUser, type AutomationEngine, type BuildContainerOptions, type Container, type Config as ContainerConfig, type EmailMessage, type EmailSender, InlineAutomationEngine, type LoggingConfig, type Mailer, type ObjectStorage, type ServerConfig, buildServer, createContainer, loadIntegrations, runMigrations };
14
+ export { type AdapterOverrides, type AuthUser, type AutomationEngine, type BuildContainerOptions, type Container, type Config as ContainerConfig, type EmailMessage, type EmailSender, InlineAutomationEngine, type LoggingConfig, type Mailer, type ObjectStorage, type ServerConfig, type WebhookSender, buildServer, createContainer, loadIntegrations, runMigrations };
15
15
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// Public surface of @headless-lms/server. Installations compose these:\n// const container = await createContainer(config, { pluginsDir, adapters })\n// const app = await buildServer(config, container)\nimport {\n buildContainer,\n type BuildContainerOptions,\n type Container,\n} from './app/container.js';\nimport type { ServerConfig } from './http/config.js';\n\nexport { buildServer } from './http/server.js';\nexport { loadIntegrations } from './app/integrations.js';\nexport { InlineAutomationEngine } from '@headless-lms/adapter-defaults/workflows';\n// Operational functions consumed by the @headless-lms/cli bin.\nexport { runMigrations } from '@headless-lms/adapter-db';\nexport type { ServerConfig } from './http/config.js';\n// Re-exporting AuthUser also pulls its module into any program that imports\n// this file (directly or via the workspace path mapping), which is what\n// applies its ambient `declare module \"fastify\"` augmentation\n// (FastifyRequest.authUser/orgId, FastifyInstance.requireOrgSession) —\n// otherwise nothing imports fastify.d.ts and the augmentation never loads.\nexport type { AuthUser } from './http/fastify.js';\nexport type {\n Config as ContainerConfig,\n Container,\n AdapterOverrides,\n BuildContainerOptions,\n LoggingConfig,\n} from './app/container.js';\nexport type { EmailSender, EmailMessage, ObjectStorage } from '@headless-lms/core/shared/ports';\nexport type { Mailer } from '@headless-lms/core/shared/mailer';\nexport type { AutomationEngine } from '@headless-lms/core/automations';\n\nexport async function createContainer(\n config: ServerConfig,\n options?: BuildContainerOptions,\n): Promise<Container> {\n return buildContainer(\n { ...config.container, deliveryExpirySeconds: config.deliveryExpirySeconds },\n options,\n );\n}\n"],"mappings":";;;;;;AAiCA,eAAsB,gBACpB,QACA,SACoB;CACpB,OAAO,eACL;EAAE,GAAG,OAAO;EAAW,uBAAuB,OAAO;CAAsB,GAC3E,OACF;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// Public surface of @headless-lms/server. Installations compose these:\n// const container = await createContainer(config, { pluginsDir, adapters })\n// const app = await buildServer(config, container)\nimport { buildContainer, type BuildContainerOptions, type Container } from './app/container.js';\nimport type { ServerConfig } from './http/config.js';\n\nexport { buildServer } from './http/server.js';\nexport { loadIntegrations } from './app/integrations.js';\nexport { InlineAutomationEngine } from '@headless-lms/adapter-defaults/workflows';\n// Operational functions consumed by the @headless-lms/cli bin.\nexport { runMigrations } from '@headless-lms/adapter-db';\nexport type { ServerConfig } from './http/config.js';\n// Re-exporting AuthUser also pulls its module into any program that imports\n// this file (directly or via the workspace path mapping), which is what\n// applies its ambient `declare module \"fastify\"` augmentation\n// (FastifyRequest.authUser/orgId, FastifyInstance.requireOrgSession) —\n// otherwise nothing imports fastify.d.ts and the augmentation never loads.\nexport type { AuthUser } from './http/fastify.js';\nexport type {\n Config as ContainerConfig,\n Container,\n AdapterOverrides,\n BuildContainerOptions,\n LoggingConfig,\n} from './app/container.js';\nexport type { EmailSender, EmailMessage, ObjectStorage } from '@headless-lms/core/shared/ports';\nexport type { Mailer } from '@headless-lms/core/shared/mailer';\nexport type { AutomationEngine, WebhookSender } from '@headless-lms/core/automations';\n\nexport async function createContainer(\n config: ServerConfig,\n options?: BuildContainerOptions,\n): Promise<Container> {\n return buildContainer(\n { ...config.container, deliveryExpirySeconds: config.deliveryExpirySeconds },\n options,\n );\n}\n"],"mappings":";;;;;;AA6BA,eAAsB,gBACpB,QACA,SACoB;CACpB,OAAO,eACL;EAAE,GAAG,OAAO;EAAW,uBAAuB,OAAO;CAAsB,GAC3E,OACF;AACF"}
@@ -0,0 +1,6 @@
1
+ //#region package.json
2
+ var version = "0.2.0";
3
+ //#endregion
4
+ export { version };
5
+
6
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-lms/server",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,10 +21,10 @@
21
21
  "fastify": "^5.2.0",
22
22
  "fastify-type-provider-zod": "^7.0.0",
23
23
  "zod": "4.4.3",
24
- "@headless-lms/adapter-auth": "0.1.0",
25
- "@headless-lms/adapter-defaults": "0.1.0",
26
- "@headless-lms/core": "0.1.0",
27
- "@headless-lms/adapter-db": "0.1.0"
24
+ "@headless-lms/adapter-auth": "0.2.0",
25
+ "@headless-lms/adapter-db": "0.2.0",
26
+ "@headless-lms/adapter-defaults": "0.2.0",
27
+ "@headless-lms/core": "0.2.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^22.10.2",