@contractspec/example.crm-pipeline 3.7.17 → 3.7.18

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 (135) hide show
  1. package/.turbo/turbo-build.log +135 -135
  2. package/CHANGELOG.md +20 -0
  3. package/dist/browser/crm-pipeline.feature.js +1 -82
  4. package/dist/browser/deal/deal.enum.js +1 -18
  5. package/dist/browser/deal/deal.operation.js +1 -396
  6. package/dist/browser/deal/deal.schema.js +1 -141
  7. package/dist/browser/deal/deal.test-spec.js +1 -58
  8. package/dist/browser/deal/index.js +1 -408
  9. package/dist/browser/docs/crm-pipeline.docblock.js +5 -49
  10. package/dist/browser/docs/index.js +5 -49
  11. package/dist/browser/entities/company.entity.js +1 -52
  12. package/dist/browser/entities/contact.entity.js +1 -66
  13. package/dist/browser/entities/deal.entity.js +1 -107
  14. package/dist/browser/entities/index.js +1 -343
  15. package/dist/browser/entities/task.entity.js +1 -99
  16. package/dist/browser/events/contact.event.js +1 -31
  17. package/dist/browser/events/deal.event.js +1 -101
  18. package/dist/browser/events/index.js +1 -158
  19. package/dist/browser/events/task.event.js +1 -28
  20. package/dist/browser/example.js +1 -39
  21. package/dist/browser/handlers/crm.handlers.js +2 -171
  22. package/dist/browser/handlers/deal.handlers.js +1 -293
  23. package/dist/browser/handlers/index.js +2 -467
  24. package/dist/browser/handlers/mock-data.js +1 -165
  25. package/dist/browser/index.js +8 -3461
  26. package/dist/browser/operations/index.js +1 -407
  27. package/dist/browser/presentations/dashboard.presentation.js +1 -55
  28. package/dist/browser/presentations/index.js +1 -290
  29. package/dist/browser/presentations/pipeline.presentation.js +1 -236
  30. package/dist/browser/seeders/index.js +1 -22
  31. package/dist/browser/ui/CrmDashboard.js +1 -1547
  32. package/dist/browser/ui/CrmDealCard.js +1 -50
  33. package/dist/browser/ui/CrmPipelineBoard.js +1 -160
  34. package/dist/browser/ui/hooks/index.js +1 -197
  35. package/dist/browser/ui/hooks/useDealList.js +1 -95
  36. package/dist/browser/ui/hooks/useDealMutations.js +1 -100
  37. package/dist/browser/ui/index.js +4 -2205
  38. package/dist/browser/ui/modals/CreateDealModal.js +1 -211
  39. package/dist/browser/ui/modals/DealActionsModal.js +1 -428
  40. package/dist/browser/ui/modals/index.js +1 -638
  41. package/dist/browser/ui/overlays/demo-overlays.js +1 -55
  42. package/dist/browser/ui/overlays/index.js +1 -55
  43. package/dist/browser/ui/renderers/index.js +4 -849
  44. package/dist/browser/ui/renderers/pipeline.markdown.js +4 -575
  45. package/dist/browser/ui/renderers/pipeline.renderer.js +1 -275
  46. package/dist/browser/ui/tables/DealListTab.js +1 -390
  47. package/dist/crm-pipeline.feature.js +1 -82
  48. package/dist/deal/deal.enum.js +1 -18
  49. package/dist/deal/deal.operation.js +1 -396
  50. package/dist/deal/deal.schema.js +1 -141
  51. package/dist/deal/deal.test-spec.js +1 -58
  52. package/dist/deal/index.js +1 -408
  53. package/dist/docs/crm-pipeline.docblock.js +5 -49
  54. package/dist/docs/index.js +5 -49
  55. package/dist/entities/company.entity.js +1 -52
  56. package/dist/entities/contact.entity.js +1 -66
  57. package/dist/entities/deal.entity.js +1 -107
  58. package/dist/entities/index.js +1 -343
  59. package/dist/entities/task.entity.js +1 -99
  60. package/dist/events/contact.event.js +1 -31
  61. package/dist/events/deal.event.js +1 -101
  62. package/dist/events/index.js +1 -158
  63. package/dist/events/task.event.js +1 -28
  64. package/dist/example.js +1 -39
  65. package/dist/handlers/crm.handlers.js +2 -171
  66. package/dist/handlers/deal.handlers.js +1 -293
  67. package/dist/handlers/index.js +2 -467
  68. package/dist/handlers/mock-data.js +1 -165
  69. package/dist/index.js +8 -3461
  70. package/dist/node/crm-pipeline.feature.js +1 -82
  71. package/dist/node/deal/deal.enum.js +1 -18
  72. package/dist/node/deal/deal.operation.js +1 -396
  73. package/dist/node/deal/deal.schema.js +1 -141
  74. package/dist/node/deal/deal.test-spec.js +1 -58
  75. package/dist/node/deal/index.js +1 -408
  76. package/dist/node/docs/crm-pipeline.docblock.js +5 -49
  77. package/dist/node/docs/index.js +5 -49
  78. package/dist/node/entities/company.entity.js +1 -52
  79. package/dist/node/entities/contact.entity.js +1 -66
  80. package/dist/node/entities/deal.entity.js +1 -107
  81. package/dist/node/entities/index.js +1 -343
  82. package/dist/node/entities/task.entity.js +1 -99
  83. package/dist/node/events/contact.event.js +1 -31
  84. package/dist/node/events/deal.event.js +1 -101
  85. package/dist/node/events/index.js +1 -158
  86. package/dist/node/events/task.event.js +1 -28
  87. package/dist/node/example.js +1 -39
  88. package/dist/node/handlers/crm.handlers.js +2 -171
  89. package/dist/node/handlers/deal.handlers.js +1 -293
  90. package/dist/node/handlers/index.js +2 -467
  91. package/dist/node/handlers/mock-data.js +1 -165
  92. package/dist/node/index.js +8 -3461
  93. package/dist/node/operations/index.js +1 -407
  94. package/dist/node/presentations/dashboard.presentation.js +1 -55
  95. package/dist/node/presentations/index.js +1 -290
  96. package/dist/node/presentations/pipeline.presentation.js +1 -236
  97. package/dist/node/seeders/index.js +1 -22
  98. package/dist/node/ui/CrmDashboard.js +1 -1547
  99. package/dist/node/ui/CrmDealCard.js +1 -50
  100. package/dist/node/ui/CrmPipelineBoard.js +1 -160
  101. package/dist/node/ui/hooks/index.js +1 -197
  102. package/dist/node/ui/hooks/useDealList.js +1 -95
  103. package/dist/node/ui/hooks/useDealMutations.js +1 -100
  104. package/dist/node/ui/index.js +4 -2205
  105. package/dist/node/ui/modals/CreateDealModal.js +1 -211
  106. package/dist/node/ui/modals/DealActionsModal.js +1 -428
  107. package/dist/node/ui/modals/index.js +1 -638
  108. package/dist/node/ui/overlays/demo-overlays.js +1 -55
  109. package/dist/node/ui/overlays/index.js +1 -55
  110. package/dist/node/ui/renderers/index.js +4 -849
  111. package/dist/node/ui/renderers/pipeline.markdown.js +4 -575
  112. package/dist/node/ui/renderers/pipeline.renderer.js +1 -275
  113. package/dist/node/ui/tables/DealListTab.js +1 -390
  114. package/dist/operations/index.js +1 -407
  115. package/dist/presentations/dashboard.presentation.js +1 -55
  116. package/dist/presentations/index.js +1 -290
  117. package/dist/presentations/pipeline.presentation.js +1 -236
  118. package/dist/seeders/index.js +1 -22
  119. package/dist/ui/CrmDashboard.js +1 -1547
  120. package/dist/ui/CrmDealCard.js +1 -50
  121. package/dist/ui/CrmPipelineBoard.js +1 -160
  122. package/dist/ui/hooks/index.js +1 -197
  123. package/dist/ui/hooks/useDealList.js +1 -95
  124. package/dist/ui/hooks/useDealMutations.js +1 -100
  125. package/dist/ui/index.js +4 -2205
  126. package/dist/ui/modals/CreateDealModal.js +1 -211
  127. package/dist/ui/modals/DealActionsModal.js +1 -428
  128. package/dist/ui/modals/index.js +1 -638
  129. package/dist/ui/overlays/demo-overlays.js +1 -55
  130. package/dist/ui/overlays/index.js +1 -55
  131. package/dist/ui/renderers/index.js +4 -849
  132. package/dist/ui/renderers/pipeline.markdown.js +4 -575
  133. package/dist/ui/renderers/pipeline.renderer.js +1 -275
  134. package/dist/ui/tables/DealListTab.js +1 -390
  135. package/package.json +13 -13
@@ -1,294 +1,2 @@
1
1
  // @bun
2
- // src/handlers/mock-data.ts
3
- var MOCK_STAGES = [
4
- { id: "stage-1", name: "Lead", position: 1, pipelineId: "pipeline-1" },
5
- { id: "stage-2", name: "Qualified", position: 2, pipelineId: "pipeline-1" },
6
- { id: "stage-3", name: "Proposal", position: 3, pipelineId: "pipeline-1" },
7
- { id: "stage-4", name: "Negotiation", position: 4, pipelineId: "pipeline-1" },
8
- { id: "stage-5", name: "Closed", position: 5, pipelineId: "pipeline-1" }
9
- ];
10
- var MOCK_DEALS = [
11
- {
12
- id: "deal-1",
13
- name: "Enterprise License - Acme Corp",
14
- value: 75000,
15
- currency: "USD",
16
- pipelineId: "pipeline-1",
17
- stageId: "stage-3",
18
- status: "OPEN",
19
- contactId: "contact-1",
20
- companyId: "company-1",
21
- ownerId: "user-1",
22
- expectedCloseDate: new Date("2024-05-15T00:00:00Z"),
23
- createdAt: new Date("2024-02-01T10:00:00Z"),
24
- updatedAt: new Date("2024-04-10T14:30:00Z")
25
- },
26
- {
27
- id: "deal-2",
28
- name: "Startup Plan - TechStart Inc",
29
- value: 12000,
30
- currency: "USD",
31
- pipelineId: "pipeline-1",
32
- stageId: "stage-2",
33
- status: "OPEN",
34
- contactId: "contact-2",
35
- companyId: "company-2",
36
- ownerId: "user-2",
37
- expectedCloseDate: new Date("2024-04-30T00:00:00Z"),
38
- createdAt: new Date("2024-03-15T09:00:00Z"),
39
- updatedAt: new Date("2024-04-08T11:15:00Z")
40
- },
41
- {
42
- id: "deal-3",
43
- name: "Professional Services - Global Ltd",
44
- value: 45000,
45
- currency: "USD",
46
- pipelineId: "pipeline-1",
47
- stageId: "stage-4",
48
- status: "OPEN",
49
- contactId: "contact-3",
50
- companyId: "company-3",
51
- ownerId: "user-1",
52
- expectedCloseDate: new Date("2024-04-20T00:00:00Z"),
53
- createdAt: new Date("2024-01-20T08:00:00Z"),
54
- updatedAt: new Date("2024-04-12T16:45:00Z")
55
- },
56
- {
57
- id: "deal-4",
58
- name: "Annual Contract - SmallBiz Co",
59
- value: 8500,
60
- currency: "USD",
61
- pipelineId: "pipeline-1",
62
- stageId: "stage-1",
63
- status: "OPEN",
64
- contactId: "contact-4",
65
- companyId: "company-4",
66
- ownerId: "user-3",
67
- createdAt: new Date("2024-04-05T12:00:00Z"),
68
- updatedAt: new Date("2024-04-05T12:00:00Z")
69
- },
70
- {
71
- id: "deal-5",
72
- name: "Custom Integration - MegaCorp",
73
- value: 125000,
74
- currency: "USD",
75
- pipelineId: "pipeline-1",
76
- stageId: "stage-5",
77
- status: "WON",
78
- contactId: "contact-5",
79
- companyId: "company-5",
80
- ownerId: "user-1",
81
- expectedCloseDate: new Date("2024-03-31T00:00:00Z"),
82
- createdAt: new Date("2023-11-10T10:00:00Z"),
83
- updatedAt: new Date("2024-03-28T09:00:00Z")
84
- },
85
- {
86
- id: "deal-6",
87
- name: "Pilot Project - NewCo",
88
- value: 5000,
89
- currency: "USD",
90
- pipelineId: "pipeline-1",
91
- stageId: "stage-2",
92
- status: "LOST",
93
- contactId: "contact-6",
94
- companyId: "company-6",
95
- ownerId: "user-2",
96
- createdAt: new Date("2024-01-15T14:00:00Z"),
97
- updatedAt: new Date("2024-02-28T10:30:00Z")
98
- }
99
- ];
100
- var MOCK_COMPANIES = [
101
- {
102
- id: "company-1",
103
- name: "Acme Corporation",
104
- domain: "acme.com",
105
- industry: "Technology",
106
- size: "1000-5000",
107
- website: "https://acme.com",
108
- createdAt: new Date("2024-01-01T00:00:00Z")
109
- },
110
- {
111
- id: "company-2",
112
- name: "TechStart Inc",
113
- domain: "techstart.io",
114
- industry: "Software",
115
- size: "10-50",
116
- website: "https://techstart.io",
117
- createdAt: new Date("2024-02-15T00:00:00Z")
118
- },
119
- {
120
- id: "company-3",
121
- name: "Global Ltd",
122
- domain: "global.com",
123
- industry: "Consulting",
124
- size: "500-1000",
125
- website: "https://global.com",
126
- createdAt: new Date("2023-12-01T00:00:00Z")
127
- }
128
- ];
129
- var MOCK_CONTACTS = [
130
- {
131
- id: "contact-1",
132
- firstName: "John",
133
- lastName: "Smith",
134
- email: "john.smith@acme.com",
135
- phone: "+1-555-0101",
136
- title: "VP of Engineering",
137
- companyId: "company-1",
138
- createdAt: new Date("2024-01-05T00:00:00Z")
139
- },
140
- {
141
- id: "contact-2",
142
- firstName: "Sarah",
143
- lastName: "Johnson",
144
- email: "sarah@techstart.io",
145
- phone: "+1-555-0102",
146
- title: "CEO",
147
- companyId: "company-2",
148
- createdAt: new Date("2024-02-20T00:00:00Z")
149
- },
150
- {
151
- id: "contact-3",
152
- firstName: "Michael",
153
- lastName: "Brown",
154
- email: "michael.brown@global.com",
155
- phone: "+1-555-0103",
156
- title: "CTO",
157
- companyId: "company-3",
158
- createdAt: new Date("2023-12-10T00:00:00Z")
159
- }
160
- ];
161
-
162
- // src/handlers/deal.handlers.ts
163
- async function mockListDealsHandler(input) {
164
- const {
165
- pipelineId,
166
- stageId,
167
- status,
168
- ownerId,
169
- search,
170
- limit = 20,
171
- offset = 0
172
- } = input;
173
- let filtered = [...MOCK_DEALS];
174
- if (pipelineId) {
175
- filtered = filtered.filter((d) => d.pipelineId === pipelineId);
176
- }
177
- if (stageId) {
178
- filtered = filtered.filter((d) => d.stageId === stageId);
179
- }
180
- if (status && status !== "all") {
181
- filtered = filtered.filter((d) => d.status === status);
182
- }
183
- if (ownerId) {
184
- filtered = filtered.filter((d) => d.ownerId === ownerId);
185
- }
186
- if (search) {
187
- const q = search.toLowerCase();
188
- filtered = filtered.filter((d) => d.name.toLowerCase().includes(q));
189
- }
190
- filtered.sort((a, b) => b.value - a.value);
191
- const total = filtered.length;
192
- const totalValue = filtered.reduce((sum, d) => sum + d.value, 0);
193
- const deals = filtered.slice(offset, offset + limit);
194
- return {
195
- deals,
196
- total,
197
- totalValue
198
- };
199
- }
200
- async function mockCreateDealHandler(input, context) {
201
- const now = new Date;
202
- const deal = {
203
- id: `deal-${Date.now()}`,
204
- name: input.name,
205
- value: input.value,
206
- currency: input.currency ?? "USD",
207
- pipelineId: input.pipelineId,
208
- stageId: input.stageId,
209
- status: "OPEN",
210
- contactId: input.contactId,
211
- companyId: input.companyId,
212
- ownerId: context.ownerId,
213
- expectedCloseDate: input.expectedCloseDate,
214
- createdAt: now,
215
- updatedAt: now
216
- };
217
- MOCK_DEALS.push(deal);
218
- return deal;
219
- }
220
- async function mockMoveDealHandler(input) {
221
- const dealIndex = MOCK_DEALS.findIndex((d) => d.id === input.dealId);
222
- if (dealIndex === -1) {
223
- throw new Error("NOT_FOUND");
224
- }
225
- const deal = MOCK_DEALS[dealIndex];
226
- if (!deal) {
227
- throw new Error("NOT_FOUND");
228
- }
229
- const stage = MOCK_STAGES.find((s) => s.id === input.stageId);
230
- if (!stage) {
231
- throw new Error("INVALID_STAGE");
232
- }
233
- const updatedDeal = {
234
- ...deal,
235
- stageId: input.stageId,
236
- updatedAt: new Date
237
- };
238
- MOCK_DEALS[dealIndex] = updatedDeal;
239
- return updatedDeal;
240
- }
241
- async function mockWinDealHandler(input) {
242
- const dealIndex = MOCK_DEALS.findIndex((d) => d.id === input.dealId);
243
- if (dealIndex === -1) {
244
- throw new Error("NOT_FOUND");
245
- }
246
- const deal = MOCK_DEALS[dealIndex];
247
- if (!deal) {
248
- throw new Error("NOT_FOUND");
249
- }
250
- const updatedDeal = {
251
- ...deal,
252
- status: "WON",
253
- updatedAt: new Date
254
- };
255
- MOCK_DEALS[dealIndex] = updatedDeal;
256
- return updatedDeal;
257
- }
258
- async function mockLoseDealHandler(input) {
259
- const dealIndex = MOCK_DEALS.findIndex((d) => d.id === input.dealId);
260
- if (dealIndex === -1) {
261
- throw new Error("NOT_FOUND");
262
- }
263
- const deal = MOCK_DEALS[dealIndex];
264
- if (!deal) {
265
- throw new Error("NOT_FOUND");
266
- }
267
- const updatedDeal = {
268
- ...deal,
269
- status: "LOST",
270
- updatedAt: new Date
271
- };
272
- MOCK_DEALS[dealIndex] = updatedDeal;
273
- return updatedDeal;
274
- }
275
- async function mockGetDealsByStageHandler(input) {
276
- const deals = MOCK_DEALS.filter((d) => d.pipelineId === input.pipelineId && d.status === "OPEN");
277
- const grouped = {};
278
- for (const stage of MOCK_STAGES) {
279
- grouped[stage.id] = deals.filter((d) => d.stageId === stage.id);
280
- }
281
- return grouped;
282
- }
283
- async function mockGetPipelineStagesHandler(input) {
284
- return MOCK_STAGES.filter((s) => s.pipelineId === input.pipelineId);
285
- }
286
- export {
287
- mockWinDealHandler,
288
- mockMoveDealHandler,
289
- mockLoseDealHandler,
290
- mockListDealsHandler,
291
- mockGetPipelineStagesHandler,
292
- mockGetDealsByStageHandler,
293
- mockCreateDealHandler
294
- };
2
+ var U=[{id:"stage-1",name:"Lead",position:1,pipelineId:"pipeline-1"},{id:"stage-2",name:"Qualified",position:2,pipelineId:"pipeline-1"},{id:"stage-3",name:"Proposal",position:3,pipelineId:"pipeline-1"},{id:"stage-4",name:"Negotiation",position:4,pipelineId:"pipeline-1"},{id:"stage-5",name:"Closed",position:5,pipelineId:"pipeline-1"}],N=[{id:"deal-1",name:"Enterprise License - Acme Corp",value:75000,currency:"USD",pipelineId:"pipeline-1",stageId:"stage-3",status:"OPEN",contactId:"contact-1",companyId:"company-1",ownerId:"user-1",expectedCloseDate:new Date("2024-05-15T00:00:00Z"),createdAt:new Date("2024-02-01T10:00:00Z"),updatedAt:new Date("2024-04-10T14:30:00Z")},{id:"deal-2",name:"Startup Plan - TechStart Inc",value:12000,currency:"USD",pipelineId:"pipeline-1",stageId:"stage-2",status:"OPEN",contactId:"contact-2",companyId:"company-2",ownerId:"user-2",expectedCloseDate:new Date("2024-04-30T00:00:00Z"),createdAt:new Date("2024-03-15T09:00:00Z"),updatedAt:new Date("2024-04-08T11:15:00Z")},{id:"deal-3",name:"Professional Services - Global Ltd",value:45000,currency:"USD",pipelineId:"pipeline-1",stageId:"stage-4",status:"OPEN",contactId:"contact-3",companyId:"company-3",ownerId:"user-1",expectedCloseDate:new Date("2024-04-20T00:00:00Z"),createdAt:new Date("2024-01-20T08:00:00Z"),updatedAt:new Date("2024-04-12T16:45:00Z")},{id:"deal-4",name:"Annual Contract - SmallBiz Co",value:8500,currency:"USD",pipelineId:"pipeline-1",stageId:"stage-1",status:"OPEN",contactId:"contact-4",companyId:"company-4",ownerId:"user-3",createdAt:new Date("2024-04-05T12:00:00Z"),updatedAt:new Date("2024-04-05T12:00:00Z")},{id:"deal-5",name:"Custom Integration - MegaCorp",value:125000,currency:"USD",pipelineId:"pipeline-1",stageId:"stage-5",status:"WON",contactId:"contact-5",companyId:"company-5",ownerId:"user-1",expectedCloseDate:new Date("2024-03-31T00:00:00Z"),createdAt:new Date("2023-11-10T10:00:00Z"),updatedAt:new Date("2024-03-28T09:00:00Z")},{id:"deal-6",name:"Pilot Project - NewCo",value:5000,currency:"USD",pipelineId:"pipeline-1",stageId:"stage-2",status:"LOST",contactId:"contact-6",companyId:"company-6",ownerId:"user-2",createdAt:new Date("2024-01-15T14:00:00Z"),updatedAt:new Date("2024-02-28T10:30:00Z")}],q=[{id:"company-1",name:"Acme Corporation",domain:"acme.com",industry:"Technology",size:"1000-5000",website:"https://acme.com",createdAt:new Date("2024-01-01T00:00:00Z")},{id:"company-2",name:"TechStart Inc",domain:"techstart.io",industry:"Software",size:"10-50",website:"https://techstart.io",createdAt:new Date("2024-02-15T00:00:00Z")},{id:"company-3",name:"Global Ltd",domain:"global.com",industry:"Consulting",size:"500-1000",website:"https://global.com",createdAt:new Date("2023-12-01T00:00:00Z")}],v=[{id:"contact-1",firstName:"John",lastName:"Smith",email:"john.smith@acme.com",phone:"+1-555-0101",title:"VP of Engineering",companyId:"company-1",createdAt:new Date("2024-01-05T00:00:00Z")},{id:"contact-2",firstName:"Sarah",lastName:"Johnson",email:"sarah@techstart.io",phone:"+1-555-0102",title:"CEO",companyId:"company-2",createdAt:new Date("2024-02-20T00:00:00Z")},{id:"contact-3",firstName:"Michael",lastName:"Brown",email:"michael.brown@global.com",phone:"+1-555-0103",title:"CTO",companyId:"company-3",createdAt:new Date("2023-12-10T00:00:00Z")}];async function h(j){let{pipelineId:z,stageId:F,status:B,ownerId:P,search:Q,limit:X=20,offset:W=0}=j,H=[...N];if(z)H=H.filter((J)=>J.pipelineId===z);if(F)H=H.filter((J)=>J.stageId===F);if(B&&B!=="all")H=H.filter((J)=>J.status===B);if(P)H=H.filter((J)=>J.ownerId===P);if(Q){let J=Q.toLowerCase();H=H.filter((R)=>R.name.toLowerCase().includes(J))}H.sort((J,R)=>R.value-J.value);let Y=H.length,Z=H.reduce((J,R)=>J+R.value,0);return{deals:H.slice(W,W+X),total:Y,totalValue:Z}}async function k(j,z){let F=new Date,B={id:`deal-${Date.now()}`,name:j.name,value:j.value,currency:j.currency??"USD",pipelineId:j.pipelineId,stageId:j.stageId,status:"OPEN",contactId:j.contactId,companyId:j.companyId,ownerId:z.ownerId,expectedCloseDate:j.expectedCloseDate,createdAt:F,updatedAt:F};return N.push(B),B}async function T(j){let z=N.findIndex((Q)=>Q.id===j.dealId);if(z===-1)throw Error("NOT_FOUND");let F=N[z];if(!F)throw Error("NOT_FOUND");if(!U.find((Q)=>Q.id===j.stageId))throw Error("INVALID_STAGE");let P={...F,stageId:j.stageId,updatedAt:new Date};return N[z]=P,P}async function b(j){let z=N.findIndex((P)=>P.id===j.dealId);if(z===-1)throw Error("NOT_FOUND");let F=N[z];if(!F)throw Error("NOT_FOUND");let B={...F,status:"WON",updatedAt:new Date};return N[z]=B,B}async function m(j){let z=N.findIndex((P)=>P.id===j.dealId);if(z===-1)throw Error("NOT_FOUND");let F=N[z];if(!F)throw Error("NOT_FOUND");let B={...F,status:"LOST",updatedAt:new Date};return N[z]=B,B}async function w(j){let z=N.filter((B)=>B.pipelineId===j.pipelineId&&B.status==="OPEN"),F={};for(let B of U)F[B.id]=z.filter((P)=>P.stageId===B.id);return F}async function G(j){return U.filter((z)=>z.pipelineId===j.pipelineId)}export{b as mockWinDealHandler,T as mockMoveDealHandler,m as mockLoseDealHandler,h as mockListDealsHandler,G as mockGetPipelineStagesHandler,w as mockGetDealsByStageHandler,k as mockCreateDealHandler};