@qcobro/common 1.11.3 → 1.12.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 (173) hide show
  1. package/dist/config.d.ts +307 -0
  2. package/dist/config.d.ts.map +1 -0
  3. package/{src/config.ts → dist/config.js} +123 -154
  4. package/dist/config.js.map +1 -0
  5. package/dist/errors/ValidationError.d.ts +27 -0
  6. package/dist/errors/ValidationError.d.ts.map +1 -0
  7. package/dist/errors/ValidationError.js +52 -0
  8. package/dist/errors/ValidationError.js.map +1 -0
  9. package/{src/errors/index.ts → dist/errors/index.d.ts} +1 -0
  10. package/dist/errors/index.d.ts.map +1 -0
  11. package/dist/errors/index.js +2 -0
  12. package/dist/errors/index.js.map +1 -0
  13. package/dist/index.d.ts +19 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/{src/index.ts → dist/index.js} +2 -5
  16. package/dist/index.js.map +1 -0
  17. package/dist/schemas/agentTemplates.d.ts +73 -0
  18. package/dist/schemas/agentTemplates.d.ts.map +1 -0
  19. package/dist/schemas/agentTemplates.js +90 -0
  20. package/dist/schemas/agentTemplates.js.map +1 -0
  21. package/dist/schemas/apiKeys.d.ts +17 -0
  22. package/dist/schemas/apiKeys.d.ts.map +1 -0
  23. package/{src/schemas/apiKeys.ts → dist/schemas/apiKeys.js} +11 -16
  24. package/dist/schemas/apiKeys.js.map +1 -0
  25. package/dist/schemas/auth.d.ts +74 -0
  26. package/dist/schemas/auth.d.ts.map +1 -0
  27. package/dist/schemas/auth.js +53 -0
  28. package/dist/schemas/auth.js.map +1 -0
  29. package/dist/schemas/campaigns.d.ts +61 -0
  30. package/dist/schemas/campaigns.d.ts.map +1 -0
  31. package/{src/schemas/campaigns.ts → dist/schemas/campaigns.js} +20 -32
  32. package/dist/schemas/campaigns.js.map +1 -0
  33. package/dist/schemas/contactLog.d.ts +121 -0
  34. package/dist/schemas/contactLog.d.ts.map +1 -0
  35. package/dist/schemas/contactLog.js +83 -0
  36. package/dist/schemas/contactLog.js.map +1 -0
  37. package/dist/schemas/dispatch.d.ts +51 -0
  38. package/dist/schemas/dispatch.d.ts.map +1 -0
  39. package/{src/schemas/dispatch.ts → dist/schemas/dispatch.js} +55 -61
  40. package/dist/schemas/dispatch.js.map +1 -0
  41. package/dist/schemas/email.d.ts +38 -0
  42. package/dist/schemas/email.d.ts.map +1 -0
  43. package/dist/schemas/email.js +34 -0
  44. package/dist/schemas/email.js.map +1 -0
  45. package/dist/schemas/index.d.ts +16 -0
  46. package/dist/schemas/index.d.ts.map +1 -0
  47. package/{src/schemas/index.ts → dist/schemas/index.js} +1 -0
  48. package/dist/schemas/index.js.map +1 -0
  49. package/dist/schemas/insight.d.ts +25 -0
  50. package/dist/schemas/insight.d.ts.map +1 -0
  51. package/{src/schemas/insight.ts → dist/schemas/insight.js} +6 -9
  52. package/dist/schemas/insight.js.map +1 -0
  53. package/dist/schemas/portfolios.d.ts +65 -0
  54. package/dist/schemas/portfolios.d.ts.map +1 -0
  55. package/dist/schemas/portfolios.js +40 -0
  56. package/dist/schemas/portfolios.js.map +1 -0
  57. package/dist/schemas/userSettings.d.ts +25 -0
  58. package/dist/schemas/userSettings.d.ts.map +1 -0
  59. package/{src/schemas/userSettings.ts → dist/schemas/userSettings.js} +4 -9
  60. package/dist/schemas/userSettings.js.map +1 -0
  61. package/dist/schemas/users.d.ts +7 -0
  62. package/dist/schemas/users.d.ts.map +1 -0
  63. package/dist/schemas/users.js +6 -0
  64. package/dist/schemas/users.js.map +1 -0
  65. package/dist/schemas/voiceEvent.d.ts +37 -0
  66. package/dist/schemas/voiceEvent.d.ts.map +1 -0
  67. package/dist/schemas/voiceEvent.js +35 -0
  68. package/dist/schemas/voiceEvent.js.map +1 -0
  69. package/dist/schemas/whatsApp.d.ts +76 -0
  70. package/dist/schemas/whatsApp.d.ts.map +1 -0
  71. package/dist/schemas/whatsApp.js +85 -0
  72. package/dist/schemas/whatsApp.js.map +1 -0
  73. package/dist/schemas/workspaceSettings.d.ts +27 -0
  74. package/dist/schemas/workspaceSettings.d.ts.map +1 -0
  75. package/{src/schemas/workspaceSettings.ts → dist/schemas/workspaceSettings.js} +6 -11
  76. package/dist/schemas/workspaceSettings.js.map +1 -0
  77. package/dist/schemas/workspaces.d.ts +50 -0
  78. package/dist/schemas/workspaces.d.ts.map +1 -0
  79. package/dist/schemas/workspaces.js +36 -0
  80. package/dist/schemas/workspaces.js.map +1 -0
  81. package/dist/types/agentTemplates.d.ts +119 -0
  82. package/dist/types/agentTemplates.d.ts.map +1 -0
  83. package/dist/types/agentTemplates.js +2 -0
  84. package/dist/types/agentTemplates.js.map +1 -0
  85. package/dist/types/campaigns.d.ts +257 -0
  86. package/dist/types/campaigns.d.ts.map +1 -0
  87. package/dist/types/campaigns.js +2 -0
  88. package/dist/types/campaigns.js.map +1 -0
  89. package/dist/types/dispatch.d.ts +168 -0
  90. package/dist/types/dispatch.d.ts.map +1 -0
  91. package/dist/types/dispatch.js +8 -0
  92. package/dist/types/dispatch.js.map +1 -0
  93. package/dist/types/email.d.ts +65 -0
  94. package/dist/types/email.d.ts.map +1 -0
  95. package/dist/types/email.js +7 -0
  96. package/dist/types/email.js.map +1 -0
  97. package/{src/types/engine.ts → dist/types/engine.d.ts} +23 -46
  98. package/dist/types/engine.d.ts.map +1 -0
  99. package/dist/types/engine.js +10 -0
  100. package/dist/types/engine.js.map +1 -0
  101. package/dist/types/index.d.ts +12 -0
  102. package/dist/types/index.d.ts.map +1 -0
  103. package/{src/types/index.ts → dist/types/index.js} +1 -0
  104. package/dist/types/index.js.map +1 -0
  105. package/{src/types/insight.ts → dist/types/insight.d.ts} +10 -8
  106. package/dist/types/insight.d.ts.map +1 -0
  107. package/dist/types/insight.js +2 -0
  108. package/dist/types/insight.js.map +1 -0
  109. package/dist/types/portfolios.d.ts +153 -0
  110. package/dist/types/portfolios.d.ts.map +1 -0
  111. package/dist/types/portfolios.js +2 -0
  112. package/dist/types/portfolios.js.map +1 -0
  113. package/dist/types/userSettings.d.ts +25 -0
  114. package/dist/types/userSettings.d.ts.map +1 -0
  115. package/dist/types/userSettings.js +2 -0
  116. package/dist/types/userSettings.js.map +1 -0
  117. package/dist/types/voiceApplication.d.ts +32 -0
  118. package/dist/types/voiceApplication.d.ts.map +1 -0
  119. package/dist/types/voiceApplication.js +7 -0
  120. package/dist/types/voiceApplication.js.map +1 -0
  121. package/dist/types/whatsApp.d.ts +97 -0
  122. package/dist/types/whatsApp.d.ts.map +1 -0
  123. package/dist/types/whatsApp.js +2 -0
  124. package/dist/types/whatsApp.js.map +1 -0
  125. package/dist/types/workspaceSettings.d.ts +26 -0
  126. package/dist/types/workspaceSettings.d.ts.map +1 -0
  127. package/dist/types/workspaceSettings.js +2 -0
  128. package/dist/types/workspaceSettings.js.map +1 -0
  129. package/dist/utils/index.d.ts +4 -0
  130. package/dist/utils/index.d.ts.map +1 -0
  131. package/dist/utils/index.js +4 -0
  132. package/dist/utils/index.js.map +1 -0
  133. package/{src/utils/outreach.ts → dist/utils/outreach.d.ts} +17 -32
  134. package/dist/utils/outreach.d.ts.map +1 -0
  135. package/dist/utils/outreach.js +116 -0
  136. package/dist/utils/outreach.js.map +1 -0
  137. package/dist/utils/time.d.ts +25 -0
  138. package/dist/utils/time.d.ts.map +1 -0
  139. package/dist/utils/time.js +52 -0
  140. package/dist/utils/time.js.map +1 -0
  141. package/dist/utils/withErrorHandlingAndValidation.d.ts +18 -0
  142. package/dist/utils/withErrorHandlingAndValidation.d.ts.map +1 -0
  143. package/{src/utils/withErrorHandlingAndValidation.ts → dist/utils/withErrorHandlingAndValidation.js} +9 -15
  144. package/dist/utils/withErrorHandlingAndValidation.js.map +1 -0
  145. package/package.json +4 -1
  146. package/CHANGELOG.md +0 -115
  147. package/src/config.test.ts +0 -19
  148. package/src/errors/ValidationError.test.ts +0 -38
  149. package/src/errors/ValidationError.ts +0 -68
  150. package/src/schemas/agentTemplates.ts +0 -100
  151. package/src/schemas/apiKeys.test.ts +0 -38
  152. package/src/schemas/auth.ts +0 -76
  153. package/src/schemas/contactLog.ts +0 -96
  154. package/src/schemas/email.ts +0 -37
  155. package/src/schemas/portfolios.ts +0 -49
  156. package/src/schemas/users.ts +0 -7
  157. package/src/schemas/voiceEvent.ts +0 -45
  158. package/src/schemas/whatsApp.ts +0 -101
  159. package/src/schemas/workspaces.ts +0 -53
  160. package/src/types/agentTemplates.ts +0 -104
  161. package/src/types/campaigns.ts +0 -210
  162. package/src/types/dispatch.ts +0 -160
  163. package/src/types/email.ts +0 -66
  164. package/src/types/portfolios.ts +0 -128
  165. package/src/types/userSettings.ts +0 -21
  166. package/src/types/voiceApplication.ts +0 -29
  167. package/src/types/whatsApp.ts +0 -82
  168. package/src/types/workspaceSettings.ts +0 -22
  169. package/src/utils/index.ts +0 -14
  170. package/src/utils/outreach.test.ts +0 -83
  171. package/src/utils/time.ts +0 -66
  172. package/src/utils/withErrorHandlingAndValidation.test.ts +0 -33
  173. package/tsconfig.json +0 -9
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Types for the bidirectional EMAIL channel: the per-gestión email thread (stored in the
3
+ * gestión `channelData`, the email analog of the voice transcript) and the autopilot
4
+ * decision contract used by `ingestEmailReply`.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.js","sourceRoot":"","sources":["../../src/types/email.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -6,68 +6,45 @@
6
6
  * The channel-dispatch ports (`OutboundCallClient`, `SmsClient`, `NumberSelector`)
7
7
  * are reused from `./dispatch.js` — channel emulators implement those interfaces.
8
8
  */
9
-
10
9
  /** Injectable time source so window/scheduling math is deterministic under test. */
11
10
  export interface Clock {
12
- now(): Date;
11
+ now(): Date;
13
12
  }
14
-
15
13
  /** Channels the engine can dispatch (the subset `dispatchOutreach` supports). */
16
14
  export type EngineChannel = "VOICE_AI" | "VOICE_PRERECORDED" | "SMS" | "EMAIL" | "WHATSAPP";
17
-
18
15
  /** Why a campaign was not dispatched at all this tick. */
19
- export type CampaignSkipReason =
20
- | "not_active"
21
- | "out_of_window"
22
- | "channel_not_configured"
23
- | "channel_not_supported"
24
- | "empty_number_pool"
25
- | "voice_not_synced";
26
-
16
+ export type CampaignSkipReason = "not_active" | "out_of_window" | "channel_not_configured" | "channel_not_supported" | "empty_number_pool" | "voice_not_synced";
27
17
  /** The outcome of considering a single account during a tick. */
28
- export type AccountDecision =
29
- | "dispatched"
30
- | "dispatch_failed"
31
- | "no_phone"
32
- | "no_email"
33
- | "intent_suppressed"
34
- | "account_suppressed"
35
- | "promise_suppressed"
36
- | "lifetime_cap"
37
- | "daily_cap"
38
- | "budget_exhausted";
39
-
18
+ export type AccountDecision = "dispatched" | "dispatch_failed" | "no_phone" | "no_email" | "intent_suppressed" | "account_suppressed" | "promise_suppressed" | "lifetime_cap" | "daily_cap" | "budget_exhausted";
40
19
  /** Per-account line in the tick report. */
41
20
  export interface AccountDecisionEntry {
42
- portfolioAccountId: string;
43
- decision: AccountDecision;
44
- /** Provider ref when `decision === "dispatched"`. */
45
- providerRef?: string;
21
+ portfolioAccountId: string;
22
+ decision: AccountDecision;
23
+ /** Provider ref when `decision === "dispatched"`. */
24
+ providerRef?: string;
46
25
  }
47
-
48
26
  /** Per-campaign section of the tick report. */
49
27
  export interface CampaignTickReport {
50
- campaignId: string;
51
- inWindow: boolean;
52
- /** Set when the whole campaign was skipped (status/window/readiness). */
53
- skipReason?: CampaignSkipReason;
54
- decisions: AccountDecisionEntry[];
55
- dispatched: number;
56
- suppressed: number;
57
- skipped: number;
58
- /** Set when the engine auto-completed the campaign this tick. */
59
- completed?: boolean;
28
+ campaignId: string;
29
+ inWindow: boolean;
30
+ /** Set when the whole campaign was skipped (status/window/readiness). */
31
+ skipReason?: CampaignSkipReason;
32
+ decisions: AccountDecisionEntry[];
33
+ dispatched: number;
34
+ suppressed: number;
35
+ skipped: number;
36
+ /** Set when the engine auto-completed the campaign this tick. */
37
+ completed?: boolean;
60
38
  }
61
-
62
39
  /** Per-channel token-bucket usage for a tick. */
63
40
  export interface ChannelUsage {
64
- dispatched: number;
65
- budget: number;
41
+ dispatched: number;
42
+ budget: number;
66
43
  }
67
-
68
44
  /** The full result of one engine tick — logged in production, asserted in tests. */
69
45
  export interface TickReport {
70
- at: string;
71
- campaigns: CampaignTickReport[];
72
- channelUsage: Partial<Record<EngineChannel, ChannelUsage>>;
46
+ at: string;
47
+ campaigns: CampaignTickReport[];
48
+ channelUsage: Partial<Record<EngineChannel, ChannelUsage>>;
73
49
  }
50
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/types/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oFAAoF;AACpF,MAAM,WAAW,KAAK;IACpB,GAAG,IAAI,IAAI,CAAC;CACb;AAED,iFAAiF;AACjF,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,mBAAmB,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,CAAC;AAE5F,0DAA0D;AAC1D,MAAM,MAAM,kBAAkB,GAC1B,YAAY,GACZ,eAAe,GACf,wBAAwB,GACxB,uBAAuB,GACvB,mBAAmB,GACnB,kBAAkB,CAAC;AAEvB,iEAAiE;AACjE,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,iBAAiB,GACjB,UAAU,GACV,UAAU,GACV,mBAAmB,GACnB,oBAAoB,GACpB,oBAAoB,GACpB,cAAc,GACd,WAAW,GACX,kBAAkB,CAAC;AAEvB,2CAA2C;AAC3C,MAAM,WAAW,oBAAoB;IACnC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,eAAe,CAAC;IAC1B,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,+CAA+C;AAC/C,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,yEAAyE;IACzE,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,SAAS,EAAE,oBAAoB,EAAE,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC;CAC5D"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Campaigns-engine contracts: the injectable clock and the TickReport.
3
+ *
4
+ * These are provider- and DB-agnostic so the engine's decision logic is testable
5
+ * with an injected clock and asserted against the report, with no live services.
6
+ * The channel-dispatch ports (`OutboundCallClient`, `SmsClient`, `NumberSelector`)
7
+ * are reused from `./dispatch.js` — channel emulators implement those interfaces.
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/types/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,12 @@
1
+ export * from "./portfolios.js";
2
+ export * from "./workspaceSettings.js";
3
+ export * from "./userSettings.js";
4
+ export * from "./agentTemplates.js";
5
+ export * from "./campaigns.js";
6
+ export * from "./voiceApplication.js";
7
+ export * from "./dispatch.js";
8
+ export * from "./email.js";
9
+ export * from "./whatsApp.js";
10
+ export * from "./engine.js";
11
+ export * from "./insight.js";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -9,3 +9,4 @@ export * from "./email.js";
9
9
  export * from "./whatsApp.js";
10
10
  export * from "./engine.js";
11
11
  export * from "./insight.js";
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -1,20 +1,22 @@
1
1
  import type { TranscriptLine } from "../schemas/voiceEvent.js";
2
2
  import type { GestionInsight } from "../schemas/insight.js";
3
-
4
3
  /** What the insight generator receives to analyze one gestión. */
5
4
  export interface InsightRequest {
6
- transcript: TranscriptLine[];
7
- /** Language to write the analysis in (e.g. account preferred language). */
8
- language?: string;
9
- /** Light grounding context; never required. */
10
- context?: { customerName?: string; outstandingBalance?: number };
5
+ transcript: TranscriptLine[];
6
+ /** Language to write the analysis in (e.g. account preferred language). */
7
+ language?: string;
8
+ /** Light grounding context; never required. */
9
+ context?: {
10
+ customerName?: string;
11
+ outstandingBalance?: number;
12
+ };
11
13
  }
12
-
13
14
  /**
14
15
  * Port for producing a gestión's structured analysis from its transcript. The
15
16
  * production adapter wraps an LLM (provider from `qcobro.json` `ai`); tests inject a
16
17
  * stub. Reached through the tRPC context like other service ports.
17
18
  */
18
19
  export interface InsightGenerator {
19
- analyze(req: InsightRequest): Promise<GestionInsight>;
20
+ analyze(req: InsightRequest): Promise<GestionInsight>;
20
21
  }
22
+ //# sourceMappingURL=insight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insight.d.ts","sourceRoot":"","sources":["../../src/types/insight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,kEAAkE;AAClE,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAClE;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACvD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=insight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insight.js","sourceRoot":"","sources":["../../src/types/insight.ts"],"names":[],"mappings":""}
@@ -0,0 +1,153 @@
1
+ import type { AccountRowInput, CreatePortfolioInput, UpdatePortfolioInput, DeletePortfolioInput } from "../schemas/portfolios.js";
2
+ export interface PortfolioRecord {
3
+ id: string;
4
+ workspaceRef: string;
5
+ name: string;
6
+ clientId: string;
7
+ accountCount: number;
8
+ totalOutstandingBalance: number;
9
+ recoveredAmount: number;
10
+ archivedAt: Date | null;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ }
14
+ export interface PortfolioAccountRecord {
15
+ id: string;
16
+ portfolioId: string;
17
+ externalId: string;
18
+ fullName: string;
19
+ phone: string | null;
20
+ preferredLanguage: string | null;
21
+ bestTimeToCall: string | null;
22
+ customerSegment: string | null;
23
+ principalAmount: number;
24
+ termsAmount: number;
25
+ termsFrequency: string | null;
26
+ termsLength: number;
27
+ outstandingBalance: number;
28
+ daysPastDue: number;
29
+ missedInstallments: number;
30
+ lastPaymentDate: Date | null;
31
+ lastPaymentAmount: number | null;
32
+ negotiationOptions: string | null;
33
+ archivedAt: Date | null;
34
+ createdAt: Date;
35
+ updatedAt: Date;
36
+ }
37
+ export interface SyncResult {
38
+ created: number;
39
+ updated: number;
40
+ archived: number;
41
+ total: number;
42
+ }
43
+ export interface PortfolioClient {
44
+ portfolio: {
45
+ findMany(args: {
46
+ where?: {
47
+ workspaceRef?: string;
48
+ archivedAt?: Date | null;
49
+ };
50
+ orderBy?: {
51
+ createdAt: "asc" | "desc";
52
+ };
53
+ }): Promise<PortfolioRecord[]>;
54
+ findFirstOrThrow(args: {
55
+ where: {
56
+ id: string;
57
+ workspaceRef: string;
58
+ };
59
+ }): Promise<PortfolioRecord>;
60
+ create(args: {
61
+ data: Omit<PortfolioRecord, "id" | "accountCount" | "recoveredAmount" | "archivedAt" | "createdAt" | "updatedAt"> & {
62
+ accountCount?: number;
63
+ recoveredAmount?: number;
64
+ };
65
+ }): Promise<PortfolioRecord>;
66
+ update(args: {
67
+ where: {
68
+ id: string;
69
+ };
70
+ data: Partial<Omit<PortfolioRecord, "id" | "createdAt" | "updatedAt">>;
71
+ }): Promise<PortfolioRecord>;
72
+ delete(args: {
73
+ where: {
74
+ id: string;
75
+ };
76
+ }): Promise<PortfolioRecord>;
77
+ };
78
+ portfolioAccount: {
79
+ findMany(args: {
80
+ where: {
81
+ portfolioId: string;
82
+ archivedAt?: null;
83
+ };
84
+ select?: {
85
+ externalId: boolean;
86
+ };
87
+ orderBy?: {
88
+ fullName: "asc" | "desc";
89
+ };
90
+ take?: number;
91
+ skip?: number;
92
+ }): Promise<PortfolioAccountRecord[]>;
93
+ count(args: {
94
+ where: {
95
+ portfolioId: string;
96
+ archivedAt?: null;
97
+ };
98
+ }): Promise<number>;
99
+ aggregate(args: {
100
+ where: {
101
+ portfolioId: string;
102
+ archivedAt?: null;
103
+ };
104
+ _sum: {
105
+ outstandingBalance: boolean;
106
+ };
107
+ }): Promise<{
108
+ _sum: {
109
+ outstandingBalance: number | null;
110
+ };
111
+ }>;
112
+ create(args: {
113
+ data: Omit<PortfolioAccountRecord, "id" | "archivedAt" | "createdAt" | "updatedAt"> & {
114
+ archivedAt?: Date | null;
115
+ };
116
+ }): Promise<PortfolioAccountRecord>;
117
+ update(args: {
118
+ where: {
119
+ portfolioId_externalId: {
120
+ portfolioId: string;
121
+ externalId: string;
122
+ };
123
+ };
124
+ data: Partial<Omit<PortfolioAccountRecord, "id" | "portfolioId" | "externalId" | "createdAt" | "updatedAt">>;
125
+ }): Promise<PortfolioAccountRecord>;
126
+ updateMany(args: {
127
+ where: {
128
+ portfolioId: string;
129
+ externalId: {
130
+ in: string[];
131
+ };
132
+ };
133
+ data: {
134
+ archivedAt: Date;
135
+ };
136
+ }): Promise<{
137
+ count: number;
138
+ }>;
139
+ };
140
+ paymentPromise: {
141
+ updateMany(args: {
142
+ where: Record<string, unknown>;
143
+ data: {
144
+ status: "EXPIRED";
145
+ };
146
+ }): Promise<{
147
+ count: number;
148
+ }>;
149
+ };
150
+ $transaction<T>(fn: (tx: PortfolioClient) => Promise<T>): Promise<T>;
151
+ }
152
+ export type { CreatePortfolioInput, UpdatePortfolioInput, DeletePortfolioInput, AccountRowInput };
153
+ //# sourceMappingURL=portfolios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portfolios.d.ts","sourceRoot":"","sources":["../../src/types/portfolios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,o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sB,EAAE;oBAAE,WAAW,EAAE,MAAM,CAAC;oBAAC,UAAU,EAAE,MAAM,CAAA;iBAAE,CAAA;aAAE,CAAC;YAC/E,IAAI,EAAE,OAAO,CACX,IAAI,CACF,sBAAsB,EACtB,IAAI,GAAG,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,WAAW,CAChE,CACF,CAAC;SACH,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;QAEpC,UAAU,CAAC,IAAI,EAAE;YACf,KAAK,EAAE;gBAAE,WAAW,EAAE,MAAM,CAAC;gBAAC,UAAU,EAAE;oBAAE,EAAE,EAAE,MAAM,EAAE,CAAA;iBAAE,CAAA;aAAE,CAAC;YAC7D,IAAI,EAAE;gBAAE,UAAU,EAAE,IAAI,CAAA;aAAE,CAAC;SAC5B,GAAG,OAAO,CAAC;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAChC,CAAC;IAIF,cAAc,EAAE;QACd,UAAU,CAAC,IAAI,EAAE;YACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC/B,IAAI,EAAE;gBAAE,MAAM,EAAE,SAAS,CAAA;aAAE,CAAC;SAC7B,GAAG,OAAO,CAAC;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAChC,CAAC;IAEF,YAAY,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,eAAe,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACtE;AAED,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=portfolios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portfolios.js","sourceRoot":"","sources":["../../src/types/portfolios.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import type { Language } from "../schemas/userSettings.js";
2
+ export interface UserSettingsRecord {
3
+ userRef: string;
4
+ language: Language;
5
+ createdAt: Date;
6
+ updatedAt: Date;
7
+ }
8
+ /** The DB surface the user-settings functions need (tests inject a stub). */
9
+ export interface UserSettingsClient {
10
+ userSettings: {
11
+ findUnique(args: {
12
+ where: {
13
+ userRef: string;
14
+ };
15
+ }): Promise<UserSettingsRecord | null>;
16
+ upsert(args: {
17
+ where: {
18
+ userRef: string;
19
+ };
20
+ create: Record<string, unknown>;
21
+ update: Record<string, unknown>;
22
+ }): Promise<UserSettingsRecord>;
23
+ };
24
+ }
25
+ //# sourceMappingURL=userSettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userSettings.d.ts","sourceRoot":"","sources":["../../src/types/userSettings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAE3D,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE;QACZ,UAAU,CAAC,IAAI,EAAE;YAAE,KAAK,EAAE;gBAAE,OAAO,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;QAErF,MAAM,CAAC,IAAI,EAAE;YACX,KAAK,EAAE;gBAAE,OAAO,EAAE,MAAM,CAAA;aAAE,CAAC;YAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACjC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;KACjC,CAAC;CACH"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=userSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userSettings.js","sourceRoot":"","sources":["../../src/types/userSettings.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Port for syncing VOICE_AI agent templates to an external voice-application
3
+ * provider (Fonoster Autopilot). Kept provider-agnostic so service functions
4
+ * depend on this interface and tests inject a stub — no live SDK in unit tests.
5
+ */
6
+ /** Domain-level inputs the engine needs to (re)build a voice application. */
7
+ export interface VoiceApplicationInput {
8
+ /** Application name (maps to VoiceAiConfig.fonosterAppName). */
9
+ name: string;
10
+ /** Provider voice id (e.g. an ElevenLabs voice id). */
11
+ voice: string;
12
+ /** The AI agent's persona/instructions. */
13
+ systemPrompt: string;
14
+ /** The opening line spoken to the contact; optional — falls back to the autopilot
15
+ * template's default greeting when the agent has no scripted first message. */
16
+ firstMessage?: string;
17
+ /** Language code (e.g. `es`, `en`). */
18
+ language: string;
19
+ }
20
+ export interface VoiceApplicationClient {
21
+ /** Create the remote application; resolves with its provider ref. */
22
+ createApplication(input: VoiceApplicationInput): Promise<{
23
+ ref: string;
24
+ }>;
25
+ /** Update an existing remote application by ref. */
26
+ updateApplication(ref: string, input: VoiceApplicationInput): Promise<{
27
+ ref: string;
28
+ }>;
29
+ /** Delete the remote application by ref (best-effort cleanup). */
30
+ deleteApplication(ref: string): Promise<void>;
31
+ }
32
+ //# sourceMappingURL=voiceApplication.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voiceApplication.d.ts","sourceRoot":"","sources":["../../src/types/voiceApplication.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACpC,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB;mFAC+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,qEAAqE;IACrE,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1E,oDAAoD;IACpD,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvF,kEAAkE;IAClE,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Port for syncing VOICE_AI agent templates to an external voice-application
3
+ * provider (Fonoster Autopilot). Kept provider-agnostic so service functions
4
+ * depend on this interface and tests inject a stub — no live SDK in unit tests.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=voiceApplication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voiceApplication.js","sourceRoot":"","sources":["../../src/types/voiceApplication.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,97 @@
1
+ import type { WhatsAppCapabilities } from "../schemas/whatsApp.js";
2
+ /** One message in a WhatsApp conversation thread. */
3
+ export interface WhatsAppThreadMessage {
4
+ direction: "outbound" | "inbound";
5
+ /** "agent" for outbound; the customer's E.164 number for inbound. */
6
+ from: string;
7
+ at: string;
8
+ body: string;
9
+ metaMessageId?: string;
10
+ }
11
+ /** The per-gestión WhatsApp conversation thread stored in `channelData.whatsAppThread`. */
12
+ export interface WhatsAppThread {
13
+ customerPhone: string;
14
+ messages: WhatsAppThreadMessage[];
15
+ agentReplyCount: number;
16
+ /** ISO timestamp of the customer's last inbound message — drives the 24 h window check. */
17
+ lastCustomerMessageAt: string;
18
+ }
19
+ /**
20
+ * DB record + client surfaces for the per-workspace WhatsApp integration. The
21
+ * `accessToken` is encrypted at rest (cloak) and MUST NOT be returned to clients —
22
+ * read procedures project to {@link WhatsAppIntegrationView}.
23
+ */
24
+ export interface WhatsAppIntegrationRecord {
25
+ id: string;
26
+ workspaceRef: string;
27
+ wabaId: string;
28
+ /** Tenant secret — encrypted at rest; never serialized to the client. */
29
+ accessToken: string;
30
+ verifyToken: string;
31
+ /** Meta template-send language for this workspace (e.g. `es_DO`). */
32
+ defaultLanguage: string;
33
+ createdAt: Date;
34
+ updatedAt: Date;
35
+ }
36
+ /** Client-safe projection of the integration (no secret). */
37
+ export interface WhatsAppIntegrationView {
38
+ connected: boolean;
39
+ wabaId: string;
40
+ verifyToken: string;
41
+ defaultLanguage: string;
42
+ }
43
+ export interface WhatsAppSenderNumberRecord {
44
+ id: string;
45
+ workspaceRef: string;
46
+ phoneNumberId: string;
47
+ displayNumber: string;
48
+ label: string;
49
+ /** Cached from Meta quality callbacks: GREEN | YELLOW | RED | null (unknown). */
50
+ qualityRating: string | null;
51
+ capabilities: WhatsAppCapabilities;
52
+ createdAt: Date;
53
+ updatedAt: Date;
54
+ }
55
+ /** The DB surface the WhatsApp integration functions need (tests inject a stub). */
56
+ export interface WhatsAppIntegrationClient {
57
+ whatsAppIntegration: {
58
+ findUnique(args: {
59
+ where: {
60
+ workspaceRef: string;
61
+ };
62
+ }): Promise<WhatsAppIntegrationRecord | null>;
63
+ findFirst(args: {
64
+ where: {
65
+ verifyToken: string;
66
+ };
67
+ }): Promise<WhatsAppIntegrationRecord | null>;
68
+ upsert(args: {
69
+ where: {
70
+ workspaceRef: string;
71
+ };
72
+ create: Record<string, unknown>;
73
+ update: Record<string, unknown>;
74
+ }): Promise<WhatsAppIntegrationRecord>;
75
+ };
76
+ whatsAppSenderNumber: {
77
+ findUnique(args: {
78
+ where: {
79
+ phoneNumberId: string;
80
+ };
81
+ }): Promise<WhatsAppSenderNumberRecord | null>;
82
+ findMany(args: {
83
+ where: {
84
+ workspaceRef: string;
85
+ };
86
+ }): Promise<WhatsAppSenderNumberRecord[]>;
87
+ create(args: {
88
+ data: Record<string, unknown>;
89
+ }): Promise<WhatsAppSenderNumberRecord>;
90
+ delete(args: {
91
+ where: {
92
+ phoneNumberId: string;
93
+ };
94
+ }): Promise<WhatsAppSenderNumberRecord>;
95
+ };
96
+ }
97
+ //# sourceMappingURL=whatsApp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsApp.d.ts","sourceRoot":"","sources":["../../src/types/whatsApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,qDAAqD;AACrD,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,UAAU,GAAG,SAAS,CAAC;IAClC,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,2FAA2F;AAC3F,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,2FAA2F;IAC3F,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,6DAA6D;AAC7D,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,M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AAE,MAAM,CAAA;aAAE,CAAA;SAAE,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAAC;QAC3F,MAAM,CAAC,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;QACrF,MAAM,CAAC,IAAI,EAAE;YAAE,KAAK,EAAE;gBAAE,aAAa,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;KACzF,CAAC;CACH"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=whatsApp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsApp.js","sourceRoot":"","sources":["../../src/types/whatsApp.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import type { Currency } from "../schemas/workspaceSettings.js";
2
+ export interface WorkspaceSettingsRecord {
3
+ workspaceRef: string;
4
+ currency: Currency;
5
+ timezone: string;
6
+ createdAt: Date;
7
+ updatedAt: Date;
8
+ }
9
+ /** The DB surface the workspace-settings functions need (tests inject a stub). */
10
+ export interface WorkspaceSettingsClient {
11
+ workspaceSettings: {
12
+ findUnique(args: {
13
+ where: {
14
+ workspaceRef: string;
15
+ };
16
+ }): Promise<WorkspaceSettingsRecord | null>;
17
+ upsert(args: {
18
+ where: {
19
+ workspaceRef: string;
20
+ };
21
+ create: Record<string, unknown>;
22
+ update: Record<string, unknown>;
23
+ }): Promise<WorkspaceSettingsRecord>;
24
+ };
25
+ }
26
+ //# sourceMappingURL=workspaceSettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaceSettings.d.ts","sourceRoot":"","sources":["../../src/types/workspaceSettings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,kFAAkF;AAClF,MAAM,WAAW,uBAAuB;IACtC,iBAAiB,EAAE;QACjB,UAAU,CAAC,IAAI,EAAE;YAAE,KAAK,EAAE;gBAAE,YAAY,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC;QAE/F,MAAM,CAAC,IAAI,EAAE;YACX,KAAK,EAAE;gBAAE,YAAY,EAAE,MAAM,CAAA;aAAE,CAAC;YAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACjC,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;KACtC,CAAC;CACH"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=workspaceSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaceSettings.js","sourceRoot":"","sources":["../../src/types/workspaceSettings.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export { withErrorHandlingAndValidation } from "./withErrorHandlingAndValidation.js";
2
+ export { renderTemplate, extractTemplateTokens, buildOutreachContext, pickRandomNumber } from "./outreach.js";
3
+ export { localParts, localDateString, isSameLocalDay, localWeekdayISO, localTimeHHMM } from "./time.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,aAAa,EACd,MAAM,WAAW,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { withErrorHandlingAndValidation } from "./withErrorHandlingAndValidation.js";
2
+ export { renderTemplate, extractTemplateTokens, buildOutreachContext, pickRandomNumber } from "./outreach.js";
3
+ export { localParts, localDateString, isSameLocalDay, localWeekdayISO, localTimeHHMM } from "./time.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,aAAa,EACd,MAAM,WAAW,CAAC"}