@cosmicdrift/kumiko-bundled-features 0.411.0 → 0.413.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 (255) hide show
  1. package/dist/admin-shell/feature.d.ts +1 -1
  2. package/dist/agent-tools/agent-doc-lint.d.ts +9 -0
  3. package/dist/agent-tools/agent-doc-lint.js +42 -5
  4. package/dist/agent-tools/agent-manifest.d.ts +0 -1
  5. package/dist/agent-tools/agent-manifest.js +9 -99
  6. package/dist/agent-tools/api-docs/anchors.d.ts +14 -0
  7. package/dist/agent-tools/api-docs/anchors.js +49 -0
  8. package/dist/agent-tools/api-docs/check.d.ts +7 -0
  9. package/dist/agent-tools/api-docs/check.js +15 -0
  10. package/dist/agent-tools/api-docs/collect-events.d.ts +10 -0
  11. package/dist/agent-tools/api-docs/collect-events.js +90 -0
  12. package/dist/agent-tools/api-docs/collect.d.ts +15 -0
  13. package/dist/agent-tools/api-docs/collect.js +108 -0
  14. package/dist/agent-tools/api-docs/curl.d.ts +5 -0
  15. package/dist/agent-tools/api-docs/curl.js +24 -0
  16. package/dist/agent-tools/api-docs/error-table.d.ts +9 -0
  17. package/dist/agent-tools/api-docs/error-table.js +31 -0
  18. package/dist/agent-tools/api-docs/examples.d.ts +16 -0
  19. package/dist/agent-tools/api-docs/examples.js +25 -0
  20. package/dist/agent-tools/api-docs/generate.d.ts +19 -0
  21. package/dist/agent-tools/api-docs/generate.js +104 -0
  22. package/dist/agent-tools/api-docs/index-json.d.ts +15 -0
  23. package/dist/agent-tools/api-docs/index-json.js +6 -0
  24. package/dist/agent-tools/api-docs/index.d.ts +9 -0
  25. package/dist/agent-tools/api-docs/index.js +6 -0
  26. package/dist/agent-tools/api-docs/list-parameters.d.ts +61 -0
  27. package/dist/agent-tools/api-docs/list-parameters.js +28 -0
  28. package/dist/agent-tools/api-docs/markdown.d.ts +29 -0
  29. package/dist/agent-tools/api-docs/markdown.js +48 -0
  30. package/dist/agent-tools/api-docs/menu-path.d.ts +8 -0
  31. package/dist/agent-tools/api-docs/menu-path.js +60 -0
  32. package/dist/agent-tools/api-docs/model.d.ts +76 -0
  33. package/dist/agent-tools/api-docs/problems.d.ts +32 -0
  34. package/dist/agent-tools/api-docs/problems.js +28 -0
  35. package/dist/agent-tools/api-docs/render-events.d.ts +12 -0
  36. package/dist/agent-tools/api-docs/render-events.js +55 -0
  37. package/dist/agent-tools/api-docs/render-openapi.d.ts +10 -0
  38. package/dist/agent-tools/api-docs/render-openapi.js +170 -0
  39. package/dist/agent-tools/api-docs/render-overview.d.ts +11 -0
  40. package/dist/agent-tools/api-docs/render-overview.js +60 -0
  41. package/dist/agent-tools/api-docs/render-reference.d.ts +14 -0
  42. package/dist/agent-tools/api-docs/render-reference.js +50 -0
  43. package/dist/agent-tools/api-docs/render-tokens.d.ts +12 -0
  44. package/dist/agent-tools/api-docs/render-tokens.js +101 -0
  45. package/dist/agent-tools/api-docs/schema-fields.d.ts +16 -0
  46. package/dist/agent-tools/api-docs/schema-fields.js +141 -0
  47. package/dist/agent-tools/api-docs/section-ids.d.ts +25 -0
  48. package/dist/agent-tools/api-docs/section-ids.js +26 -0
  49. package/dist/agent-tools/api-docs/system-only.d.ts +5 -0
  50. package/dist/agent-tools/api-docs/system-only.js +7 -0
  51. package/dist/agent-tools/api-docs/texts/de.d.ts +123 -0
  52. package/dist/agent-tools/api-docs/texts/de.js +123 -0
  53. package/dist/agent-tools/api-docs/texts/en.d.ts +123 -0
  54. package/dist/agent-tools/api-docs/texts/en.js +123 -0
  55. package/dist/agent-tools/api-docs/texts/es.d.ts +123 -0
  56. package/dist/agent-tools/api-docs/texts/es.js +123 -0
  57. package/dist/agent-tools/api-docs/texts/fr.d.ts +123 -0
  58. package/dist/agent-tools/api-docs/texts/fr.js +123 -0
  59. package/dist/agent-tools/api-docs/texts/index.d.ts +14 -0
  60. package/dist/agent-tools/api-docs/texts/index.js +55 -0
  61. package/dist/agent-tools/api-docs/texts/it.d.ts +123 -0
  62. package/dist/agent-tools/api-docs/texts/it.js +123 -0
  63. package/dist/agent-tools/api-docs/texts/types.d.ts +18 -0
  64. package/dist/agent-tools/api-docs/texts/types.js +104 -0
  65. package/dist/agent-tools/api-docs/ui-writes.d.ts +12 -0
  66. package/dist/agent-tools/api-docs/ui-writes.js +73 -0
  67. package/dist/agent-tools/handler-schema.d.ts +5 -0
  68. package/dist/agent-tools/handler-schema.js +37 -0
  69. package/dist/agent-tools/index.d.ts +2 -1
  70. package/dist/agent-tools/index.js +2 -1
  71. package/dist/agent-tools/labels.d.ts +26 -0
  72. package/dist/agent-tools/labels.js +131 -0
  73. package/dist/auth-email-password/boot-rules.d.ts +7 -0
  74. package/dist/auth-email-password/boot-rules.js +7 -0
  75. package/dist/auth-email-password/feature.js +6 -13
  76. package/dist/auth-email-password/validate-options.d.ts +5 -0
  77. package/dist/auth-email-password/validate-options.js +15 -0
  78. package/dist/billing-foundation/boot-rules.d.ts +22 -0
  79. package/dist/billing-foundation/boot-rules.js +22 -0
  80. package/dist/billing-foundation/validate-options.js +56 -18
  81. package/dist/cap-overview/boot-rules.d.ts +12 -0
  82. package/dist/cap-overview/boot-rules.js +12 -0
  83. package/dist/cap-overview/feature.js +8 -3
  84. package/dist/documents/boot-rules.d.ts +12 -0
  85. package/dist/documents/boot-rules.js +12 -0
  86. package/dist/documents/feature.js +8 -3
  87. package/dist/file-derivatives/boot-rules.d.ts +7 -0
  88. package/dist/file-derivatives/boot-rules.js +7 -0
  89. package/dist/file-derivatives/feature.js +5 -2
  90. package/dist/folders/boot-rules.d.ts +7 -0
  91. package/dist/folders/boot-rules.js +7 -0
  92. package/dist/folders/feature.js +8 -5
  93. package/dist/helpdesk/boot-rules.d.ts +7 -0
  94. package/dist/helpdesk/boot-rules.js +7 -0
  95. package/dist/{contact → helpdesk}/challenge.js +2 -2
  96. package/dist/helpdesk/client/helpdesk-client-source.d.ts +1 -0
  97. package/dist/{contact/client/contact-client-source.js → helpdesk/client/helpdesk-client-source.js} +4 -4
  98. package/dist/helpdesk/client/helpdesk-website-client.d.ts +26 -0
  99. package/dist/helpdesk/client/helpdesk-website-client.js +1 -0
  100. package/dist/helpdesk/client/index.d.ts +2 -0
  101. package/dist/helpdesk/client/index.js +1 -0
  102. package/dist/{contact → helpdesk}/entity.d.ts +6 -6
  103. package/dist/{contact → helpdesk}/entity.js +31 -27
  104. package/dist/helpdesk/feature.d.ts +3 -0
  105. package/dist/{contact → helpdesk}/feature.js +43 -39
  106. package/dist/{contact → helpdesk}/handlers/attempts.d.ts +2 -2
  107. package/dist/helpdesk/handlers/challenge.query.d.ts +9 -0
  108. package/dist/{contact → helpdesk}/handlers/challenge.query.js +5 -5
  109. package/dist/helpdesk/handlers/forward-request.write.d.ts +9 -0
  110. package/dist/{contact → helpdesk}/handlers/forward-request.write.js +17 -15
  111. package/dist/{contact → helpdesk}/handlers/mark-done.write.d.ts +2 -2
  112. package/dist/{contact → helpdesk}/handlers/mark-done.write.js +8 -8
  113. package/dist/{contact → helpdesk}/handlers/notify-reporter-in-app.write.d.ts +2 -2
  114. package/dist/{contact → helpdesk}/handlers/notify-reporter-in-app.write.js +11 -11
  115. package/dist/{contact → helpdesk}/handlers/open-count.js +2 -2
  116. package/dist/{contact → helpdesk}/handlers/open-count.query.js +4 -4
  117. package/dist/{contact → helpdesk}/handlers/replies.query.js +6 -6
  118. package/dist/{contact → helpdesk}/handlers/reply.write.d.ts +4 -4
  119. package/dist/{contact → helpdesk}/handlers/reply.write.js +16 -16
  120. package/dist/helpdesk/handlers/report.write.d.ts +16 -0
  121. package/dist/{contact → helpdesk}/handlers/report.write.js +17 -17
  122. package/dist/helpdesk/handlers/request-delivery.query.d.ts +16 -0
  123. package/dist/{contact → helpdesk}/handlers/request-delivery.query.js +24 -24
  124. package/dist/{contact → helpdesk}/handlers/request-detail.query.d.ts +3 -3
  125. package/dist/{contact → helpdesk}/handlers/request-detail.query.js +10 -10
  126. package/dist/{contact → helpdesk}/handlers/request-list.query.js +2 -2
  127. package/dist/helpdesk/handlers/send-reply-mail.write.d.ts +8 -0
  128. package/dist/{contact → helpdesk}/handlers/send-reply-mail.write.js +15 -15
  129. package/dist/helpdesk/handlers/send-test.write.d.ts +5 -0
  130. package/dist/{contact → helpdesk}/handlers/send-test.write.js +10 -10
  131. package/dist/{contact → helpdesk}/handlers/submit.write.d.ts +4 -4
  132. package/dist/{contact → helpdesk}/handlers/submit.write.js +17 -17
  133. package/dist/{contact → helpdesk}/handlers/take-over-uploads.js +5 -5
  134. package/dist/{contact → helpdesk}/i18n.d.ts +1 -1
  135. package/dist/{contact → helpdesk}/i18n.js +78 -75
  136. package/dist/helpdesk/index.d.ts +5 -0
  137. package/dist/helpdesk/index.js +4 -0
  138. package/dist/{contact → helpdesk}/lib.d.ts +5 -5
  139. package/dist/{contact → helpdesk}/lib.js +16 -16
  140. package/dist/{contact → helpdesk}/mail.d.ts +20 -20
  141. package/dist/{contact → helpdesk}/mail.js +47 -47
  142. package/dist/{contact → helpdesk}/options.d.ts +6 -6
  143. package/dist/helpdesk/options.js +36 -0
  144. package/dist/helpdesk/panels.d.ts +2 -0
  145. package/dist/helpdesk/panels.js +21 -0
  146. package/dist/{contact → helpdesk}/payloads.d.ts +11 -11
  147. package/dist/{contact → helpdesk}/payloads.js +28 -28
  148. package/dist/helpdesk/screens.d.ts +5 -0
  149. package/dist/{contact → helpdesk}/screens.js +87 -87
  150. package/dist/{contact → helpdesk}/subject.js +3 -3
  151. package/dist/helpdesk/user-data-hooks.d.ts +3 -0
  152. package/dist/{contact → helpdesk}/user-data-hooks.js +15 -15
  153. package/dist/helpdesk/web/constants.d.ts +127 -0
  154. package/dist/helpdesk/web/constants.js +126 -0
  155. package/dist/helpdesk/web/index.d.ts +1 -0
  156. package/dist/helpdesk/web/index.js +1 -0
  157. package/dist/host-routing/boot-rules.d.ts +22 -0
  158. package/dist/host-routing/boot-rules.js +22 -0
  159. package/dist/host-routing/validate-options.js +35 -11
  160. package/dist/inbound-mail-foundation/entities.d.ts +84 -0
  161. package/dist/inbound-mail-foundation/entities.js +96 -71
  162. package/dist/inbound-mail-foundation/feature.js +2 -2
  163. package/dist/jobs/boot-rules.d.ts +7 -0
  164. package/dist/jobs/boot-rules.js +7 -0
  165. package/dist/jobs/feature.js +5 -2
  166. package/dist/legal-pages/boot-rules.d.ts +17 -0
  167. package/dist/legal-pages/boot-rules.js +17 -0
  168. package/dist/legal-pages/feature.js +5 -2
  169. package/dist/legal-pages/lib/validate-routes.js +11 -3
  170. package/dist/metrics/boot-rules.d.ts +12 -0
  171. package/dist/metrics/boot-rules.js +12 -0
  172. package/dist/metrics/validate.js +8 -2
  173. package/dist/notes-history/boot-rules.d.ts +7 -0
  174. package/dist/notes-history/boot-rules.js +7 -0
  175. package/dist/notes-history/feature.js +7 -4
  176. package/dist/personal-access-tokens/boot-rules.d.ts +7 -0
  177. package/dist/personal-access-tokens/boot-rules.js +7 -0
  178. package/dist/personal-access-tokens/feature.d.ts +1 -0
  179. package/dist/personal-access-tokens/feature.js +4 -2
  180. package/dist/personal-access-tokens/handlers/create.write.js +2 -2
  181. package/dist/personal-access-tokens/i18n.js +5 -1
  182. package/dist/personal-access-tokens/index.d.ts +4 -2
  183. package/dist/personal-access-tokens/index.js +29 -2
  184. package/dist/personal-access-tokens/scope-events-check.d.ts +3 -0
  185. package/dist/personal-access-tokens/scope-events-check.js +21 -0
  186. package/dist/personal-access-tokens/screens.js +8 -2
  187. package/dist/personal-access-tokens/web/constants.d.ts +1 -0
  188. package/dist/personal-access-tokens/web/constants.js +1 -0
  189. package/dist/personal-access-tokens/web/scopes.d.ts +2 -0
  190. package/dist/personal-access-tokens/web/scopes.js +12 -0
  191. package/dist/presence/boot-rules.d.ts +7 -0
  192. package/dist/presence/boot-rules.js +7 -0
  193. package/dist/presence/options.js +5 -1
  194. package/dist/readiness/boot-rules.d.ts +12 -0
  195. package/dist/readiness/boot-rules.js +12 -0
  196. package/dist/readiness/probe-boot-check.js +8 -3
  197. package/dist/shared/assert-no-where-rule-in-ownership-write.d.ts +1 -1
  198. package/dist/shared/assert-no-where-rule-in-ownership-write.js +11 -7
  199. package/dist/shared/boot-rules.d.ts +7 -0
  200. package/dist/shared/boot-rules.js +7 -0
  201. package/dist/subscription-mollie/boot-rules.d.ts +17 -0
  202. package/dist/subscription-mollie/boot-rules.js +17 -0
  203. package/dist/subscription-mollie/feature.js +13 -6
  204. package/dist/tags/boot-rules.d.ts +7 -0
  205. package/dist/tags/boot-rules.js +7 -0
  206. package/dist/tags/feature.js +8 -5
  207. package/dist/template-resolver/boot-rules.d.ts +17 -0
  208. package/dist/template-resolver/boot-rules.js +17 -0
  209. package/dist/template-resolver/feature.js +14 -5
  210. package/dist/tenant/boot-rules.d.ts +7 -0
  211. package/dist/tenant/boot-rules.js +7 -0
  212. package/dist/tenant/feature.js +5 -2
  213. package/kumiko-es-tables.json +4 -4
  214. package/package.json +29 -29
  215. package/src/agent-tools/changes.json +24 -0
  216. package/src/{contact → helpdesk}/changes.json +6 -0
  217. package/src/inbound-mail-foundation/changes.json +6 -0
  218. package/src/personal-access-tokens/changes.json +6 -0
  219. package/dist/contact/client/contact-client-source.d.ts +0 -1
  220. package/dist/contact/client/contact-website-client.d.ts +0 -26
  221. package/dist/contact/client/index.d.ts +0 -2
  222. package/dist/contact/client/index.js +0 -1
  223. package/dist/contact/feature.d.ts +0 -3
  224. package/dist/contact/handlers/challenge.query.d.ts +0 -9
  225. package/dist/contact/handlers/forward-request.write.d.ts +0 -9
  226. package/dist/contact/handlers/report.write.d.ts +0 -16
  227. package/dist/contact/handlers/request-delivery.query.d.ts +0 -16
  228. package/dist/contact/handlers/send-reply-mail.write.d.ts +0 -8
  229. package/dist/contact/handlers/send-test.write.d.ts +0 -5
  230. package/dist/contact/index.d.ts +0 -5
  231. package/dist/contact/index.js +0 -4
  232. package/dist/contact/options.js +0 -32
  233. package/dist/contact/panels.d.ts +0 -2
  234. package/dist/contact/panels.js +0 -21
  235. package/dist/contact/screens.d.ts +0 -5
  236. package/dist/contact/user-data-hooks.d.ts +0 -3
  237. package/dist/contact/web/constants.d.ts +0 -127
  238. package/dist/contact/web/constants.js +0 -126
  239. package/dist/contact/web/index.d.ts +0 -1
  240. package/dist/contact/web/index.js +0 -1
  241. /package/dist/{contact/client/contact-website-client.js → agent-tools/api-docs/model.js} +0 -0
  242. /package/dist/{contact → helpdesk}/challenge.d.ts +0 -0
  243. /package/dist/{contact → helpdesk}/handlers/access.d.ts +0 -0
  244. /package/dist/{contact → helpdesk}/handlers/access.js +0 -0
  245. /package/dist/{contact → helpdesk}/handlers/attempts.js +0 -0
  246. /package/dist/{contact → helpdesk}/handlers/open-count.d.ts +0 -0
  247. /package/dist/{contact → helpdesk}/handlers/open-count.query.d.ts +0 -0
  248. /package/dist/{contact → helpdesk}/handlers/replies.query.d.ts +0 -0
  249. /package/dist/{contact → helpdesk}/handlers/request-list.query.d.ts +0 -0
  250. /package/dist/{contact → helpdesk}/handlers/take-over-uploads.d.ts +0 -0
  251. /package/dist/{contact → helpdesk}/pow.d.ts +0 -0
  252. /package/dist/{contact → helpdesk}/pow.js +0 -0
  253. /package/dist/{contact → helpdesk}/subject.d.ts +0 -0
  254. /package/dist/{contact → helpdesk}/user-agent.d.ts +0 -0
  255. /package/dist/{contact → helpdesk}/user-agent.js +0 -0
@@ -1,4 +1,4 @@
1
- export type ContactNotifyReporterData = {
1
+ export type HelpdeskNotifyReporterData = {
2
2
  readonly kind: "notified" | "skipped";
3
3
  };
4
4
  export declare const notifyReporterInAppHandler: import("@cosmicdrift/kumiko-types/define-handler").WriteHandlerDefinition<"notify-reporter-in-app", import("zod").ZodObject<{
@@ -7,4 +7,4 @@ export declare const notifyReporterInAppHandler: import("@cosmicdrift/kumiko-typ
7
7
  userId: import("zod").ZodUUID;
8
8
  authorName: import("zod").ZodString;
9
9
  locale: import("zod").ZodOptional<import("zod").ZodString>;
10
- }, import("zod/v4/core").$strict>, ContactNotifyReporterData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined, undefined>;
10
+ }, import("zod/v4/core").$strict>, HelpdeskNotifyReporterData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined, undefined>;
@@ -1,35 +1,35 @@
1
1
  import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
2
2
  import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
3
3
  import { tenantMembershipsTable } from "../../tenant/index.js";
4
- import { contactDb, IN_APP_FEATURE, internalAccess, sendBestEffort } from "../lib.js";
5
- import { contactReplyInAppData, resolveContactMailLocale } from "../mail.js";
6
- import { ContactNotifyReporterInAppSchema } from "../payloads.js";
7
- import { CONTACT_NOTIFICATION_TYPES, contactIdempotencyKeys } from "../web/constants.js";
4
+ import { helpdeskDb, IN_APP_FEATURE, internalAccess, sendBestEffort } from "../lib.js";
5
+ import { helpdeskReplyInAppData, resolveHelpdeskMailLocale } from "../mail.js";
6
+ import { HelpdeskNotifyReporterInAppSchema } from "../payloads.js";
7
+ import { HELPDESK_NOTIFICATION_TYPES, helpdeskIdempotencyKeys } from "../web/constants.js";
8
8
  // Runs as the platform identity of the reporter's tenant, so the in-app note lands in that
9
9
  // tenant's inbox. The note names the author only; the answer itself goes by mail.
10
10
  export const notifyReporterInAppHandler = defineWriteHandler({
11
11
  name: "notify-reporter-in-app",
12
- schema: ContactNotifyReporterInAppSchema,
12
+ schema: HelpdeskNotifyReporterInAppSchema,
13
13
  access: internalAccess,
14
14
  agent: { expose: false },
15
- description: "Internal: adds an in-app note about a contact reply to a signed-in reporter in the reporter's own tenant; skipped when the reporter is no longer a member or in-app delivery is not mounted.",
15
+ description: "Internal: adds an in-app note about a helpdesk reply to a signed-in reporter in the reporter's own tenant; skipped when the reporter is no longer a member or in-app delivery is not mounted.",
16
16
  handler: async (event, ctx) => {
17
17
  const { userId, replyId, authorName, locale } = event.payload;
18
18
  if (!(await ctx.hasFeature(IN_APP_FEATURE)))
19
19
  return { isSuccess: true, data: { kind: "skipped" } };
20
- const membership = await fetchOne(contactDb(ctx), tenantMembershipsTable, {
20
+ const membership = await fetchOne(helpdeskDb(ctx), tenantMembershipsTable, {
21
21
  userId,
22
22
  tenantId: event.user.tenantId,
23
23
  });
24
24
  if (!membership)
25
25
  return { isSuccess: true, data: { kind: "skipped" } };
26
- await sendBestEffort(ctx, "reply in-app note", (notify) => notify(CONTACT_NOTIFICATION_TYPES.replyInApp, {
26
+ await sendBestEffort(ctx, "reply in-app note", (notify) => notify(HELPDESK_NOTIFICATION_TYPES.replyInApp, {
27
27
  route: { inApp: userId },
28
28
  recipientId: userId,
29
- data: contactReplyInAppData({ authorName, locale }),
30
- idempotencyKey: contactIdempotencyKeys.replyInApp(replyId),
29
+ data: helpdeskReplyInAppData({ authorName, locale }),
30
+ idempotencyKey: helpdeskIdempotencyKeys.replyInApp(replyId),
31
31
  priority: "normal",
32
- locale: resolveContactMailLocale(locale),
32
+ locale: resolveHelpdeskMailLocale(locale),
33
33
  }));
34
34
  return { isSuccess: true, data: { kind: "notified" } };
35
35
  },
@@ -1,9 +1,9 @@
1
1
  import { platformActor, requestExecutor } from "../lib.js";
2
- import { CONTACT_STATUS } from "../web/constants.js";
2
+ import { HELPDESK_STATUS } from "../web/constants.js";
3
3
  // Open means no answer yet; an answered request counts as handled even before it is marked done.
4
4
  export async function countOpenRequests(db) {
5
5
  const found = await requestExecutor.list({
6
- filter: { field: "status", op: "eq", value: CONTACT_STATUS.Open },
6
+ filter: { field: "status", op: "eq", value: HELPDESK_STATUS.Open },
7
7
  limit: 1,
8
8
  totalCount: true,
9
9
  }, platformActor(), db);
@@ -1,13 +1,13 @@
1
1
  import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
2
- import { adminAccess, contactDb } from "../lib.js";
3
- import { ContactEmptySchema } from "../payloads.js";
2
+ import { adminAccess, helpdeskDb } from "../lib.js";
3
+ import { HelpdeskEmptySchema } from "../payloads.js";
4
4
  import { countOpenRequests } from "./open-count.js";
5
5
  export const openCountQuery = defineQueryHandler({
6
6
  name: "open-count",
7
- schema: ContactEmptySchema,
7
+ schema: HelpdeskEmptySchema,
8
8
  access: adminAccess,
9
9
  description: "Counts the contact requests that still wait for a first answer, for the dashboard tile.",
10
10
  handler: async (_event, ctx) => {
11
- return { count: await countOpenRequests(contactDb(ctx)) };
11
+ return { count: await countOpenRequests(helpdeskDb(ctx)) };
12
12
  },
13
13
  });
@@ -1,19 +1,19 @@
1
1
  import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { NotFoundError } from "@cosmicdrift/kumiko-framework/errors";
3
- import { adminAccess, contactDb, listRepliesOf, platformActor, requestExecutor } from "../lib.js";
4
- import { ContactIdSchema } from "../payloads.js";
5
- import { CONTACT_REQUEST_ENTITY } from "../web/constants.js";
3
+ import { adminAccess, helpdeskDb, listRepliesOf, platformActor, requestExecutor } from "../lib.js";
4
+ import { HelpdeskIdSchema } from "../payloads.js";
5
+ import { HELPDESK_REQUEST_ENTITY } from "../web/constants.js";
6
6
  export const repliesQuery = defineQueryHandler({
7
7
  name: "replies",
8
- schema: ContactIdSchema,
8
+ schema: HelpdeskIdSchema,
9
9
  access: adminAccess,
10
10
  description: "Returns the answers SystemAdmins sent to one contact request (id, sent time, author name, message), oldest first, as flat rows for a related list; the request itself is not part of it.",
11
11
  handler: async (event, ctx) => {
12
- const db = contactDb(ctx);
12
+ const db = helpdeskDb(ctx);
13
13
  const { id } = event.payload;
14
14
  const request = await requestExecutor.detail({ id }, platformActor(), db);
15
15
  if (!request)
16
- throw new NotFoundError(CONTACT_REQUEST_ENTITY, id);
16
+ throw new NotFoundError(HELPDESK_REQUEST_ENTITY, id);
17
17
  const replies = await listRepliesOf(db, id);
18
18
  return {
19
19
  rows: replies.map((reply) => ({
@@ -1,12 +1,12 @@
1
- import { CONTACT_STATUS } from "../web/constants.ts";
2
- export type ContactReplyData = {
1
+ import { HELPDESK_STATUS } from "../web/constants.ts";
2
+ export type HelpdeskReplyData = {
3
3
  readonly kind: "replied";
4
4
  readonly id: string;
5
- readonly status: typeof CONTACT_STATUS.Answered | typeof CONTACT_STATUS.Done;
5
+ readonly status: typeof HELPDESK_STATUS.Answered | typeof HELPDESK_STATUS.Done;
6
6
  };
7
7
  export declare function createReplyHandler(): import("@cosmicdrift/kumiko-types/define-handler").WriteHandlerDefinition<"reply", import("zod").ZodObject<{
8
8
  requestId: import("zod").ZodUUID;
9
9
  message: import("zod").ZodString;
10
10
  fileIds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUUID>>;
11
11
  markDone: import("zod").ZodDefault<import("zod").ZodBoolean>;
12
- }, import("zod/v4/core").$strict>, ContactReplyData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined, undefined>;
12
+ }, import("zod/v4/core").$strict>, HelpdeskReplyData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined, undefined>;
@@ -2,9 +2,9 @@ import { createSystemUser, defineWriteHandler, } from "@cosmicdrift/kumiko-frame
2
2
  import { NotFoundError, UnprocessableError, writeFailure, } from "@cosmicdrift/kumiko-framework/errors";
3
3
  import { generateId } from "@cosmicdrift/kumiko-framework/utils";
4
4
  import { parseTenantId } from "@cosmicdrift/kumiko-types/identifiers";
5
- import { adminAccess, contactDb, loadUserLabel, pickReplyChannels, platformActor, replyExecutor, requestExecutor, sendBestEffort, } from "../lib.js";
6
- import { ContactReplySchema } from "../payloads.js";
7
- import { CONTACT_REPLY_CHANNELS, CONTACT_REPLY_ENTITY, CONTACT_REQUEST_ENTITY, CONTACT_STATUS, ContactErrors, ContactHandlers, ContactScreens, } from "../web/constants.js";
5
+ import { adminAccess, helpdeskDb, loadUserLabel, pickReplyChannels, platformActor, replyExecutor, requestExecutor, sendBestEffort, } from "../lib.js";
6
+ import { HelpdeskReplySchema } from "../payloads.js";
7
+ import { HELPDESK_REPLY_CHANNELS, HELPDESK_REPLY_ENTITY, HELPDESK_REQUEST_ENTITY, HELPDESK_STATUS, HelpdeskErrors, HelpdeskHandlers, HelpdeskScreens, } from "../web/constants.js";
8
8
  import { takeOverUploads } from "./take-over-uploads.js";
9
9
  async function noteReporterInApp(ctx, args) {
10
10
  const { request } = args;
@@ -13,7 +13,7 @@ async function noteReporterInApp(ctx, args) {
13
13
  if (!request.reporterUserId || tenantId === null)
14
14
  return;
15
15
  await sendBestEffort(ctx, "reply in-app note", async () => {
16
- const noted = await ctx.dispatch.writeAs(createSystemUser(tenantId), ContactHandlers.notifyReporterInApp, {
16
+ const noted = await ctx.dispatch.writeAs(createSystemUser(tenantId), HelpdeskHandlers.notifyReporterInApp, {
17
17
  replyId: args.replyId,
18
18
  requestId: request.id,
19
19
  userId: request.reporterUserId,
@@ -47,7 +47,7 @@ async function persistReply(ctx, db, args) {
47
47
  changes: {
48
48
  status: args.status,
49
49
  answeredAt: sentAt,
50
- ...(args.status === CONTACT_STATUS.Done && { closedAt: sentAt }),
50
+ ...(args.status === HELPDESK_STATUS.Done && { closedAt: sentAt }),
51
51
  replyCount: (request.replyCount ?? 0) + 1,
52
52
  },
53
53
  }, platformActor(), db);
@@ -55,41 +55,41 @@ async function persistReply(ctx, db, args) {
55
55
  }
56
56
  // The drawer variant the admin used is chosen by the reply channels, and pending uploads hang under that screen.
57
57
  function replyScreenFor(channels) {
58
- return channels === CONTACT_REPLY_CHANNELS.EmailAndInApp
59
- ? ContactScreens.reply
60
- : ContactScreens.replyMail;
58
+ return channels === HELPDESK_REPLY_CHANNELS.EmailAndInApp
59
+ ? HelpdeskScreens.reply
60
+ : HelpdeskScreens.replyMail;
61
61
  }
62
62
  export function createReplyHandler() {
63
63
  return defineWriteHandler({
64
64
  name: "reply",
65
- schema: ContactReplySchema,
65
+ schema: HelpdeskReplySchema,
66
66
  access: adminAccess,
67
67
  description: "A SystemAdmin answers a contact request: stores the reply (uploaded files are taken over into the system tenant), mails it to the reporter (Reply-To set, optional attachments, quoting the original request) and, for a signed-in reporter, adds an in-app note in the reporter's tenant. Marks the request answered, or done when markDone is set.",
68
68
  // The reply mail leaves the platform and cannot be recalled; reporter text may carry prompt injection.
69
69
  agent: { expose: false },
70
70
  handler: async (event, ctx) => {
71
71
  const { requestId, message, markDone } = event.payload;
72
- const db = contactDb(ctx);
72
+ const db = helpdeskDb(ctx);
73
73
  const request = await requestExecutor.detail({ id: requestId }, platformActor(), db);
74
74
  if (!request)
75
- return writeFailure(new NotFoundError(CONTACT_REQUEST_ENTITY, requestId));
75
+ return writeFailure(new NotFoundError(HELPDESK_REQUEST_ENTITY, requestId));
76
76
  const replyId = generateId();
77
77
  const reporterUserId = request.reporterUserId ?? undefined;
78
78
  const channels = await pickReplyChannels(ctx, reporterUserId);
79
79
  const uploaded = await takeOverUploads(ctx, {
80
80
  user: event.user,
81
81
  screen: replyScreenFor(channels),
82
- entityType: CONTACT_REPLY_ENTITY,
82
+ entityType: HELPDESK_REPLY_ENTITY,
83
83
  entityId: replyId,
84
84
  fileIds: event.payload.fileIds ?? [],
85
85
  });
86
86
  if (!uploaded.isSuccess) {
87
- return writeFailure(new UnprocessableError(ContactErrors.attachmentNotFound));
87
+ return writeFailure(new UnprocessableError(HelpdeskErrors.attachmentNotFound));
88
88
  }
89
89
  const fileIds = uploaded.data;
90
90
  const author = await loadUserLabel(db, event.user.id);
91
91
  const authorName = author?.name ?? event.user.id;
92
- const status = markDone ? CONTACT_STATUS.Done : CONTACT_STATUS.Answered;
92
+ const status = markDone ? HELPDESK_STATUS.Done : HELPDESK_STATUS.Answered;
93
93
  const failed = await persistReply(ctx, db, {
94
94
  replyId,
95
95
  request,
@@ -103,13 +103,13 @@ export function createReplyHandler() {
103
103
  if (failed !== null)
104
104
  return failed;
105
105
  await sendBestEffort(ctx, "reply mail", async () => {
106
- const sent = await ctx.dispatch.writeAs(platformActor(), ContactHandlers.sendReplyMail, {
106
+ const sent = await ctx.dispatch.writeAs(platformActor(), HelpdeskHandlers.sendReplyMail, {
107
107
  replyId,
108
108
  });
109
109
  if (!sent.isSuccess)
110
110
  throw new Error(sent.error.message);
111
111
  });
112
- if (channels === CONTACT_REPLY_CHANNELS.EmailAndInApp) {
112
+ if (channels === HELPDESK_REPLY_CHANNELS.EmailAndInApp) {
113
113
  await noteReporterInApp(ctx, { replyId, request, authorName });
114
114
  }
115
115
  return { isSuccess: true, data: { kind: "replied", id: replyId, status } };
@@ -0,0 +1,16 @@
1
+ import { type HelpdeskOptions, type HelpdeskSettings } from "../options.ts";
2
+ export type HelpdeskReportData = {
3
+ readonly kind: "reported";
4
+ readonly id: string;
5
+ };
6
+ export declare function createReportHandler(opts: HelpdeskOptions, settings: HelpdeskSettings): import("@cosmicdrift/kumiko-types/define-handler").WriteHandlerDefinition<"report", import("zod").ZodObject<{
7
+ kind: import("zod").ZodEnum<{
8
+ bug: "bug";
9
+ question: "question";
10
+ wish: "wish";
11
+ }>;
12
+ subject: import("zod").ZodString;
13
+ message: import("zod").ZodString;
14
+ phone: import("zod").ZodOptional<import("zod").ZodString>;
15
+ fileIds: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUUID>>;
16
+ }, import("zod/v4/core").$strict>, HelpdeskReportData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined, undefined>;
@@ -2,18 +2,18 @@ import { requestContext } from "@cosmicdrift/kumiko-framework/api";
2
2
  import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
3
3
  import { UnprocessableError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
4
4
  import { generateId } from "@cosmicdrift/kumiko-framework/utils";
5
- import { contactDb, loadTenantName, loadTenantPlan, loadUserLabel, normalizeEmail, phoneProblem, platformActor, requestExecutor, sendBestEffort, } from "../lib.js";
6
- import { contactConfirmationVariables, resolveContactMailLocale } from "../mail.js";
5
+ import { helpdeskDb, loadTenantName, loadTenantPlan, loadUserLabel, normalizeEmail, phoneProblem, platformActor, requestExecutor, sendBestEffort, } from "../lib.js";
6
+ import { helpdeskConfirmationVariables, resolveHelpdeskMailLocale } from "../mail.js";
7
7
  import { REPORT_RATE_LIMIT } from "../options.js";
8
- import { ContactReportSchema } from "../payloads.js";
8
+ import { HelpdeskReportSchema } from "../payloads.js";
9
9
  import { summarizeUserAgent } from "../user-agent.js";
10
- import { CONTACT_NOTIFICATION_TYPES, CONTACT_REQUEST_ENTITY, CONTACT_SOURCE, CONTACT_STATUS, CONTACT_UPLOAD_FIELD, ContactErrors, ContactHandlers, ContactScreens, contactIdempotencyKeys, } from "../web/constants.js";
10
+ import { HELPDESK_NOTIFICATION_TYPES, HELPDESK_REQUEST_ENTITY, HELPDESK_SOURCE, HELPDESK_STATUS, HELPDESK_UPLOAD_FIELD, HelpdeskErrors, HelpdeskHandlers, HelpdeskScreens, helpdeskIdempotencyKeys, } from "../web/constants.js";
11
11
  import { REPORT_ACCESS } from "./access.js";
12
12
  import { takeOverUploads } from "./take-over-uploads.js";
13
13
  export function createReportHandler(opts, settings) {
14
14
  return defineWriteHandler({
15
15
  name: "report",
16
- schema: ContactReportSchema,
16
+ schema: HelpdeskReportSchema,
17
17
  access: REPORT_ACCESS,
18
18
  rateLimit: REPORT_RATE_LIMIT,
19
19
  agent: { expose: false },
@@ -23,10 +23,10 @@ export function createReportHandler(opts, settings) {
23
23
  const phoneIssue = phoneProblem(settings.phone, payload.phone);
24
24
  if (phoneIssue !== null)
25
25
  return writeFailure(new UnprocessableError(phoneIssue));
26
- const db = contactDb(ctx);
26
+ const db = helpdeskDb(ctx);
27
27
  const reporter = await loadUserLabel(db, event.user.id);
28
28
  if (!reporter?.email) {
29
- return writeFailure(new UnprocessableError(ContactErrors.reporterEmailMissing));
29
+ return writeFailure(new UnprocessableError(HelpdeskErrors.reporterEmailMissing));
30
30
  }
31
31
  const tenantName = await loadTenantName(db, event.user.tenantId);
32
32
  const email = normalizeEmail(reporter.email);
@@ -35,8 +35,8 @@ export function createReportHandler(opts, settings) {
35
35
  const requestId = generateId();
36
36
  const uploaded = await takeOverUploads(ctx, {
37
37
  user: event.user,
38
- screen: ContactScreens.report,
39
- entityType: CONTACT_REQUEST_ENTITY,
38
+ screen: HelpdeskScreens.report,
39
+ entityType: HELPDESK_REQUEST_ENTITY,
40
40
  entityId: requestId,
41
41
  fileIds: payload.fileIds ?? [],
42
42
  });
@@ -46,8 +46,8 @@ export function createReportHandler(opts, settings) {
46
46
  const created = await requestExecutor.create({
47
47
  id: requestId,
48
48
  kind: payload.kind,
49
- status: CONTACT_STATUS.Open,
50
- source: CONTACT_SOURCE.Admin,
49
+ status: HELPDESK_STATUS.Open,
50
+ source: HELPDESK_SOURCE.Admin,
51
51
  subject: payload.subject,
52
52
  message: payload.message,
53
53
  name: reporter.name,
@@ -61,28 +61,28 @@ export function createReportHandler(opts, settings) {
61
61
  ...(opts.appVersion !== undefined && { appVersion: opts.appVersion }),
62
62
  ...(browser !== null && { browser }),
63
63
  submittedAt: ctx.tz.now(),
64
- ...(fileIds.length > 0 && { [CONTACT_UPLOAD_FIELD]: fileIds }),
64
+ ...(fileIds.length > 0 && { [HELPDESK_UPLOAD_FIELD]: fileIds }),
65
65
  fileCount: fileIds.length,
66
66
  replyCount: 0,
67
67
  }, platformActor(), db);
68
68
  if (!created.isSuccess)
69
69
  return created;
70
70
  await sendBestEffort(ctx, "forward request", async () => {
71
- const forwarded = await ctx.dispatch.writeAs(platformActor(), ContactHandlers.forwardRequest, { requestId });
71
+ const forwarded = await ctx.dispatch.writeAs(platformActor(), HelpdeskHandlers.forwardRequest, { requestId });
72
72
  if (!forwarded.isSuccess)
73
73
  throw new Error(forwarded.error.message);
74
74
  });
75
- await sendBestEffort(ctx, "confirmation mail", (notify) => notify(CONTACT_NOTIFICATION_TYPES.confirmation, {
75
+ await sendBestEffort(ctx, "confirmation mail", (notify) => notify(HELPDESK_NOTIFICATION_TYPES.confirmation, {
76
76
  route: { email },
77
77
  recipientId: requestId,
78
- data: contactConfirmationVariables({
78
+ data: helpdeskConfirmationVariables({
79
79
  appName: opts.appName,
80
80
  message: payload.message,
81
81
  locale: ctx.locale,
82
82
  }),
83
- idempotencyKey: contactIdempotencyKeys.confirmation(requestId),
83
+ idempotencyKey: helpdeskIdempotencyKeys.confirmation(requestId),
84
84
  priority: "normal",
85
- locale: resolveContactMailLocale(ctx.locale),
85
+ locale: resolveHelpdeskMailLocale(ctx.locale),
86
86
  }));
87
87
  return { isSuccess: true, data: { kind: "reported", id: requestId } };
88
88
  },
@@ -0,0 +1,16 @@
1
+ import type { HelpdeskOptions } from "../options.ts";
2
+ import { type HelpdeskDeliveryChannel, type HelpdeskDeliveryStatus } from "../web/constants.ts";
3
+ type DeliveryRow = {
4
+ readonly id: string;
5
+ readonly channel: HelpdeskDeliveryChannel;
6
+ readonly recipient: string;
7
+ readonly at: string;
8
+ readonly status: HelpdeskDeliveryStatus;
9
+ };
10
+ export declare function createRequestDeliveryQuery(opts: HelpdeskOptions): import("@cosmicdrift/kumiko-types/define-handler").QueryHandlerDefinition<"request-delivery", import("zod").ZodObject<{
11
+ id: import("zod").ZodUUID;
12
+ }, import("zod/v4/core").$strict>, {
13
+ rows: DeliveryRow[];
14
+ nextCursor: null;
15
+ }, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap>;
16
+ export {};
@@ -1,20 +1,20 @@
1
1
  import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { NotFoundError } from "@cosmicdrift/kumiko-framework/errors";
3
3
  import { parseTenantId } from "@cosmicdrift/kumiko-types/identifiers";
4
- import { adminAccess, contactDb, listRepliesOf, loadUserLabel, platformActor, requestExecutor, } from "../lib.js";
5
- import { ContactIdSchema } from "../payloads.js";
6
- import { CONTACT_DELIVERY_CHANNEL, CONTACT_DELIVERY_STATUS, CONTACT_REQUEST_ENTITY, ContactConfigKeys, contactIdempotencyKeys, } from "../web/constants.js";
4
+ import { adminAccess, helpdeskDb, listRepliesOf, loadUserLabel, platformActor, requestExecutor, } from "../lib.js";
5
+ import { HelpdeskIdSchema } from "../payloads.js";
6
+ import { HELPDESK_DELIVERY_CHANNEL, HELPDESK_DELIVERY_STATUS, HELPDESK_REQUEST_ENTITY, HelpdeskConfigKeys, helpdeskIdempotencyKeys, } from "../web/constants.js";
7
7
  import { loadAttemptsByKey, loadReadAtByKey } from "./attempts.js";
8
8
  function displayStatus(attemptStatus) {
9
9
  switch (attemptStatus) {
10
10
  case "sent":
11
- return CONTACT_DELIVERY_STATUS.Delivered;
11
+ return HELPDESK_DELIVERY_STATUS.Delivered;
12
12
  case "failed":
13
- return CONTACT_DELIVERY_STATUS.Failed;
13
+ return HELPDESK_DELIVERY_STATUS.Failed;
14
14
  case "skipped":
15
- return CONTACT_DELIVERY_STATUS.Skipped;
15
+ return HELPDESK_DELIVERY_STATUS.Skipped;
16
16
  default:
17
- return CONTACT_DELIVERY_STATUS.Pending;
17
+ return HELPDESK_DELIVERY_STATUS.Pending;
18
18
  }
19
19
  }
20
20
  function attemptsOf(attempts, key) {
@@ -27,35 +27,35 @@ function rowOf(attempt, channel, recipient, readAt) {
27
27
  channel,
28
28
  recipient,
29
29
  at: (read ? readAt : attempt.createdAt).toString(),
30
- status: read ? CONTACT_DELIVERY_STATUS.Read : displayStatus(attempt.status),
30
+ status: read ? HELPDESK_DELIVERY_STATUS.Read : displayStatus(attempt.status),
31
31
  };
32
32
  }
33
33
  async function adminRows(db, attempts, requestId) {
34
34
  const rows = [];
35
- for (const attempt of attemptsOf(attempts, contactIdempotencyKeys.admins(requestId))) {
35
+ for (const attempt of attemptsOf(attempts, helpdeskIdempotencyKeys.admins(requestId))) {
36
36
  const admin = attempt.recipientId ? await loadUserLabel(db, attempt.recipientId) : null;
37
- rows.push(rowOf(attempt, CONTACT_DELIVERY_CHANNEL.Email, `${admin?.name ?? "?"} (SystemAdmin)`, null));
37
+ rows.push(rowOf(attempt, HELPDESK_DELIVERY_CHANNEL.Email, `${admin?.name ?? "?"} (SystemAdmin)`, null));
38
38
  }
39
39
  return rows;
40
40
  }
41
41
  export function createRequestDeliveryQuery(opts) {
42
42
  return defineQueryHandler({
43
43
  name: "request-delivery",
44
- schema: ContactIdSchema,
44
+ schema: HelpdeskIdSchema,
45
45
  access: adminAccess,
46
46
  description: "Returns where one contact request went and how: the admin mails, the Telegram message and each answer as mail and in-app note, each with channel, recipient, time and delivery status (an in-app note shows as read with the time it was opened), as flat rows for a related list.",
47
47
  handler: async (event, ctx) => {
48
- const db = contactDb(ctx);
48
+ const db = helpdeskDb(ctx);
49
49
  const { id } = event.payload;
50
50
  const request = await requestExecutor.detail({ id }, platformActor(), db);
51
51
  if (!request)
52
- throw new NotFoundError(CONTACT_REQUEST_ENTITY, id);
52
+ throw new NotFoundError(HELPDESK_REQUEST_ENTITY, id);
53
53
  const replies = await listRepliesOf(db, id);
54
- const replyInAppKeys = replies.map((reply) => contactIdempotencyKeys.replyInApp(reply.id));
54
+ const replyInAppKeys = replies.map((reply) => helpdeskIdempotencyKeys.replyInApp(reply.id));
55
55
  const attempts = await loadAttemptsByKey(ctx, event.user, [
56
- contactIdempotencyKeys.admins(id),
57
- contactIdempotencyKeys.telegram(id),
58
- ...replies.map((reply) => contactIdempotencyKeys.reply(reply.id)),
56
+ helpdeskIdempotencyKeys.admins(id),
57
+ helpdeskIdempotencyKeys.telegram(id),
58
+ ...replies.map((reply) => helpdeskIdempotencyKeys.reply(reply.id)),
59
59
  ...replyInAppKeys,
60
60
  ]);
61
61
  const reporterTenantId = parseTenantId(request.reporterTenantId);
@@ -64,19 +64,19 @@ export function createRequestDeliveryQuery(opts) {
64
64
  : await loadReadAtByKey(ctx, reporterTenantId, replyInAppKeys);
65
65
  const rows = [...(await adminRows(db, attempts, id))];
66
66
  if (opts.telegram) {
67
- const chat = await ctx.config?.(ContactConfigKeys.telegramChat);
68
- for (const attempt of attemptsOf(attempts, contactIdempotencyKeys.telegram(id))) {
69
- rows.push(rowOf(attempt, CONTACT_DELIVERY_CHANNEL.Telegram, typeof chat === "string" ? chat : "", null));
67
+ const chat = await ctx.config?.(HelpdeskConfigKeys.telegramChat);
68
+ for (const attempt of attemptsOf(attempts, helpdeskIdempotencyKeys.telegram(id))) {
69
+ rows.push(rowOf(attempt, HELPDESK_DELIVERY_CHANNEL.Telegram, typeof chat === "string" ? chat : "", null));
70
70
  }
71
71
  }
72
72
  for (const reply of replies) {
73
- const mailKey = contactIdempotencyKeys.reply(reply.id);
73
+ const mailKey = helpdeskIdempotencyKeys.reply(reply.id);
74
74
  for (const attempt of attemptsOf(attempts, mailKey)) {
75
- rows.push(rowOf(attempt, CONTACT_DELIVERY_CHANNEL.ReplyEmail, request.name, null));
75
+ rows.push(rowOf(attempt, HELPDESK_DELIVERY_CHANNEL.ReplyEmail, request.name, null));
76
76
  }
77
- const inAppKey = contactIdempotencyKeys.replyInApp(reply.id);
77
+ const inAppKey = helpdeskIdempotencyKeys.replyInApp(reply.id);
78
78
  for (const attempt of attemptsOf(attempts, inAppKey)) {
79
- rows.push(rowOf(attempt, CONTACT_DELIVERY_CHANNEL.ReplyInApp, request.name, readAtByKey.get(inAppKey)));
79
+ rows.push(rowOf(attempt, HELPDESK_DELIVERY_CHANNEL.ReplyInApp, request.name, readAtByKey.get(inAppKey)));
80
80
  }
81
81
  }
82
82
  return { rows, nextCursor: null };
@@ -1,5 +1,5 @@
1
- import type { ContactOptions } from "../options.ts";
2
- export declare function createRequestDetailQuery(opts: ContactOptions): import("@cosmicdrift/kumiko-types/define-handler").QueryHandlerDefinition<"request-detail", import("zod").ZodObject<{
1
+ import type { HelpdeskOptions } from "../options.ts";
2
+ export declare function createRequestDetailQuery(opts: HelpdeskOptions): import("@cosmicdrift/kumiko-types/define-handler").QueryHandlerDefinition<"request-detail", import("zod").ZodObject<{
3
3
  id: import("zod").ZodUUID;
4
4
  }, import("zod/v4/core").$strict>, {
5
5
  id: string;
@@ -13,7 +13,7 @@ export declare function createRequestDetailQuery(opts: ContactOptions): import("
13
13
  deletedAt?: Temporal.Instant | null | undefined;
14
14
  deletedById?: string | null | undefined;
15
15
  replyTo: string | null;
16
- replyChannels: import("../web/constants.ts").ContactReplyChannels;
16
+ replyChannels: import("../web/constants.ts").HelpdeskReplyChannels;
17
17
  versionLabel: string | null;
18
18
  origin: "admin-report" | "website";
19
19
  answeredAt: Temporal.Instant | null;
@@ -1,20 +1,20 @@
1
1
  import { defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { NotFoundError } from "@cosmicdrift/kumiko-framework/errors";
3
- import { adminAccess, contactDb, loadUserLabel, pickReplyChannels, platformActor, requestExecutor, } from "../lib.js";
4
- import { ContactIdSchema } from "../payloads.js";
5
- import { CONTACT_ORIGIN, CONTACT_REQUEST_ENTITY, CONTACT_SOURCE, ContactConfigKeys, } from "../web/constants.js";
3
+ import { adminAccess, helpdeskDb, loadUserLabel, pickReplyChannels, platformActor, requestExecutor, } from "../lib.js";
4
+ import { HelpdeskIdSchema } from "../payloads.js";
5
+ import { HELPDESK_ORIGIN, HELPDESK_REQUEST_ENTITY, HELPDESK_SOURCE, HelpdeskConfigKeys, } from "../web/constants.js";
6
6
  export function createRequestDetailQuery(opts) {
7
7
  return defineQueryHandler({
8
8
  name: "request-detail",
9
- schema: ContactIdSchema,
9
+ schema: HelpdeskIdSchema,
10
10
  access: adminAccess,
11
11
  description: "Returns one contact request with its origin fields plus what the detail screen shows around it: the Reply-To address a reply goes out with (the caller's own email while none is configured), the channels a reply reaches the reporter on, the app version label and whether the request came from the website or the admin.",
12
12
  handler: async (event, ctx) => {
13
- const db = contactDb(ctx);
13
+ const db = helpdeskDb(ctx);
14
14
  const request = await requestExecutor.detail({ id: event.payload.id }, platformActor(), db);
15
15
  if (!request)
16
- throw new NotFoundError(CONTACT_REQUEST_ENTITY, event.payload.id);
17
- const configuredReplyTo = await ctx.config?.(ContactConfigKeys.replyTo);
16
+ throw new NotFoundError(HELPDESK_REQUEST_ENTITY, event.payload.id);
17
+ const configuredReplyTo = await ctx.config?.(HelpdeskConfigKeys.replyTo);
18
18
  const replyTo = typeof configuredReplyTo === "string" && configuredReplyTo !== ""
19
19
  ? configuredReplyTo
20
20
  : ((await loadUserLabel(db, event.user.id))?.email ?? null);
@@ -23,9 +23,9 @@ export function createRequestDetailQuery(opts) {
23
23
  replyTo,
24
24
  replyChannels: await pickReplyChannels(ctx, request.reporterUserId),
25
25
  versionLabel: opts.appVersion !== undefined ? `${opts.appName} ${opts.appVersion}` : null,
26
- origin: request.source === CONTACT_SOURCE.Admin
27
- ? CONTACT_ORIGIN.AdminReport
28
- : CONTACT_ORIGIN.Website,
26
+ origin: request.source === HELPDESK_SOURCE.Admin
27
+ ? HELPDESK_ORIGIN.AdminReport
28
+ : HELPDESK_ORIGIN.Website,
29
29
  };
30
30
  },
31
31
  });
@@ -1,8 +1,8 @@
1
1
  import { defineEntityListHandler, } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { adminAccess } from "../lib.js";
3
- import { CONTACT_REQUEST_ENTITY } from "../web/constants.js";
3
+ import { HELPDESK_REQUEST_ENTITY } from "../web/constants.js";
4
4
  export function createRequestListQuery(requestEntity) {
5
- return defineEntityListHandler(CONTACT_REQUEST_ENTITY, requestEntity, {
5
+ return defineEntityListHandler(HELPDESK_REQUEST_ENTITY, requestEntity, {
6
6
  access: adminAccess,
7
7
  description: "Lists contact requests for the SystemAdmin inbox: searchable, filterable by status, kind and source, newest first; the open named filter backs the dashboard tile.",
8
8
  });
@@ -0,0 +1,8 @@
1
+ import type { HelpdeskOptions } from "../options.ts";
2
+ export type HelpdeskSendReplyMailData = {
3
+ readonly kind: "sent";
4
+ readonly attachmentCount: number;
5
+ };
6
+ export declare function createSendReplyMailHandler(opts: HelpdeskOptions): import("@cosmicdrift/kumiko-types/define-handler").WriteHandlerDefinition<"send-reply-mail", import("zod").ZodObject<{
7
+ replyId: import("zod").ZodUUID;
8
+ }, import("zod/v4/core").$strict>, HelpdeskSendReplyMailData, import("@cosmicdrift/kumiko-types/event-type-map").KumikoEventTypeMap, undefined, undefined>;