@contractspec/example.crm-pipeline 0.0.0-canary-20260113170453
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.
- package/.turbo/turbo-build$colon$bundle.log +172 -0
- package/.turbo/turbo-build.log +173 -0
- package/CHANGELOG.md +436 -0
- package/LICENSE +21 -0
- package/README.md +139 -0
- package/dist/crm-pipeline.feature.d.ts +12 -0
- package/dist/crm-pipeline.feature.d.ts.map +1 -0
- package/dist/crm-pipeline.feature.js +166 -0
- package/dist/crm-pipeline.feature.js.map +1 -0
- package/dist/deal/deal.enum.d.ts +14 -0
- package/dist/deal/deal.enum.d.ts.map +1 -0
- package/dist/deal/deal.enum.js +25 -0
- package/dist/deal/deal.enum.js.map +1 -0
- package/dist/deal/deal.operation.d.ts +513 -0
- package/dist/deal/deal.operation.d.ts.map +1 -0
- package/dist/deal/deal.operation.js +270 -0
- package/dist/deal/deal.operation.js.map +1 -0
- package/dist/deal/deal.schema.d.ts +300 -0
- package/dist/deal/deal.schema.d.ts.map +1 -0
- package/dist/deal/deal.schema.js +286 -0
- package/dist/deal/deal.schema.js.map +1 -0
- package/dist/deal/deal.test-spec.d.ts +8 -0
- package/dist/deal/deal.test-spec.d.ts.map +1 -0
- package/dist/deal/deal.test-spec.js +65 -0
- package/dist/deal/deal.test-spec.js.map +1 -0
- package/dist/deal/index.d.ts +4 -0
- package/dist/deal/index.js +5 -0
- package/dist/docs/crm-pipeline.docblock.d.ts +1 -0
- package/dist/docs/crm-pipeline.docblock.js +100 -0
- package/dist/docs/crm-pipeline.docblock.js.map +1 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/entities/company.entity.d.ts +40 -0
- package/dist/entities/company.entity.d.ts.map +1 -0
- package/dist/entities/company.entity.js +63 -0
- package/dist/entities/company.entity.js.map +1 -0
- package/dist/entities/contact.entity.d.ts +44 -0
- package/dist/entities/contact.entity.d.ts.map +1 -0
- package/dist/entities/contact.entity.js +78 -0
- package/dist/entities/contact.entity.js.map +1 -0
- package/dist/entities/deal.entity.d.ts +73 -0
- package/dist/entities/deal.entity.d.ts.map +1 -0
- package/dist/entities/deal.entity.js +120 -0
- package/dist/entities/deal.entity.js.map +1 -0
- package/dist/entities/index.d.ts +15 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +33 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/task.entity.d.ts +65 -0
- package/dist/entities/task.entity.d.ts.map +1 -0
- package/dist/entities/task.entity.js +129 -0
- package/dist/entities/task.entity.js.map +1 -0
- package/dist/events/contact.event.d.ts +29 -0
- package/dist/events/contact.event.d.ts.map +1 -0
- package/dist/events/contact.event.js +45 -0
- package/dist/events/contact.event.js.map +1 -0
- package/dist/events/deal.event.d.ts +111 -0
- package/dist/events/deal.event.d.ts.map +1 -0
- package/dist/events/deal.event.js +172 -0
- package/dist/events/deal.event.js.map +1 -0
- package/dist/events/index.d.ts +4 -0
- package/dist/events/index.js +5 -0
- package/dist/events/task.event.d.ts +29 -0
- package/dist/events/task.event.d.ts.map +1 -0
- package/dist/events/task.event.js +45 -0
- package/dist/events/task.event.js.map +1 -0
- package/dist/example.d.ts +7 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +53 -0
- package/dist/example.js.map +1 -0
- package/dist/handlers/crm.handlers.d.ts +89 -0
- package/dist/handlers/crm.handlers.d.ts.map +1 -0
- package/dist/handlers/crm.handlers.js +172 -0
- package/dist/handlers/crm.handlers.js.map +1 -0
- package/dist/handlers/deal.handlers.d.ts +94 -0
- package/dist/handlers/deal.handlers.d.ts.map +1 -0
- package/dist/handlers/deal.handlers.js +120 -0
- package/dist/handlers/deal.handlers.js.map +1 -0
- package/dist/handlers/index.d.ts +4 -0
- package/dist/handlers/index.js +5 -0
- package/dist/handlers/mock-data.d.ts +49 -0
- package/dist/handlers/mock-data.d.ts.map +1 -0
- package/dist/handlers/mock-data.js +188 -0
- package/dist/handlers/mock-data.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/operations/index.d.ts +5 -0
- package/dist/operations/index.js +6 -0
- package/dist/presentations/dashboard.presentation.d.ts +14 -0
- package/dist/presentations/dashboard.presentation.d.ts.map +1 -0
- package/dist/presentations/dashboard.presentation.js +62 -0
- package/dist/presentations/dashboard.presentation.js.map +1 -0
- package/dist/presentations/index.d.ts +3 -0
- package/dist/presentations/index.js +4 -0
- package/dist/presentations/pipeline.presentation.d.ts +22 -0
- package/dist/presentations/pipeline.presentation.d.ts.map +1 -0
- package/dist/presentations/pipeline.presentation.js +122 -0
- package/dist/presentations/pipeline.presentation.js.map +1 -0
- package/dist/seeders/index.d.ts +10 -0
- package/dist/seeders/index.d.ts.map +1 -0
- package/dist/seeders/index.js +47 -0
- package/dist/seeders/index.js.map +1 -0
- package/dist/shared/overlay-types.d.ts +34 -0
- package/dist/shared/overlay-types.d.ts.map +1 -0
- package/dist/shared/overlay-types.js +0 -0
- package/dist/ui/CrmDashboard.d.ts +7 -0
- package/dist/ui/CrmDashboard.d.ts.map +1 -0
- package/dist/ui/CrmDashboard.js +304 -0
- package/dist/ui/CrmDashboard.js.map +1 -0
- package/dist/ui/CrmDealCard.d.ts +15 -0
- package/dist/ui/CrmDealCard.d.ts.map +1 -0
- package/dist/ui/CrmDealCard.js +49 -0
- package/dist/ui/CrmDealCard.js.map +1 -0
- package/dist/ui/CrmPipelineBoard.d.ts +23 -0
- package/dist/ui/CrmPipelineBoard.d.ts.map +1 -0
- package/dist/ui/CrmPipelineBoard.js +98 -0
- package/dist/ui/CrmPipelineBoard.js.map +1 -0
- package/dist/ui/hooks/index.d.ts +3 -0
- package/dist/ui/hooks/index.js +6 -0
- package/dist/ui/hooks/useDealList.d.ts +35 -0
- package/dist/ui/hooks/useDealList.d.ts.map +1 -0
- package/dist/ui/hooks/useDealList.js +94 -0
- package/dist/ui/hooks/useDealList.js.map +1 -0
- package/dist/ui/hooks/useDealMutations.d.ts +26 -0
- package/dist/ui/hooks/useDealMutations.d.ts.map +1 -0
- package/dist/ui/hooks/useDealMutations.js +159 -0
- package/dist/ui/hooks/useDealMutations.js.map +1 -0
- package/dist/ui/index.d.ts +14 -0
- package/dist/ui/index.js +15 -0
- package/dist/ui/modals/CreateDealModal.d.ts +33 -0
- package/dist/ui/modals/CreateDealModal.d.ts.map +1 -0
- package/dist/ui/modals/CreateDealModal.js +183 -0
- package/dist/ui/modals/CreateDealModal.js.map +1 -0
- package/dist/ui/modals/DealActionsModal.d.ts +51 -0
- package/dist/ui/modals/DealActionsModal.d.ts.map +1 -0
- package/dist/ui/modals/DealActionsModal.js +372 -0
- package/dist/ui/modals/DealActionsModal.js.map +1 -0
- package/dist/ui/modals/index.d.ts +3 -0
- package/dist/ui/modals/index.js +4 -0
- package/dist/ui/overlays/demo-overlays.d.ts +19 -0
- package/dist/ui/overlays/demo-overlays.d.ts.map +1 -0
- package/dist/ui/overlays/demo-overlays.js +68 -0
- package/dist/ui/overlays/demo-overlays.js.map +1 -0
- package/dist/ui/overlays/index.d.ts +2 -0
- package/dist/ui/overlays/index.js +3 -0
- package/dist/ui/renderers/index.d.ts +3 -0
- package/dist/ui/renderers/index.js +4 -0
- package/dist/ui/renderers/pipeline.markdown.d.ts +23 -0
- package/dist/ui/renderers/pipeline.markdown.d.ts.map +1 -0
- package/dist/ui/renderers/pipeline.markdown.js +118 -0
- package/dist/ui/renderers/pipeline.markdown.js.map +1 -0
- package/dist/ui/renderers/pipeline.renderer.d.ts +9 -0
- package/dist/ui/renderers/pipeline.renderer.d.ts.map +1 -0
- package/dist/ui/renderers/pipeline.renderer.js +28 -0
- package/dist/ui/renderers/pipeline.renderer.js.map +1 -0
- package/example.ts +1 -0
- package/package.json +127 -0
- package/src/crm-pipeline.feature.ts +100 -0
- package/src/deal/deal.enum.ts +21 -0
- package/src/deal/deal.operation.ts +291 -0
- package/src/deal/deal.schema.ts +154 -0
- package/src/deal/deal.test-spec.ts +55 -0
- package/src/deal/index.ts +26 -0
- package/src/docs/crm-pipeline.docblock.ts +98 -0
- package/src/docs/index.ts +1 -0
- package/src/entities/company.entity.ts +77 -0
- package/src/entities/contact.entity.ts +93 -0
- package/src/entities/deal.entity.ts +160 -0
- package/src/entities/index.ts +45 -0
- package/src/entities/task.entity.ts +137 -0
- package/src/events/contact.event.ts +31 -0
- package/src/events/deal.event.ts +104 -0
- package/src/events/index.ts +3 -0
- package/src/events/task.event.ts +28 -0
- package/src/example.ts +38 -0
- package/src/handlers/crm.handlers.ts +415 -0
- package/src/handlers/deal.handlers.ts +253 -0
- package/src/handlers/index.ts +30 -0
- package/src/handlers/mock-data.ts +198 -0
- package/src/index.ts +32 -0
- package/src/operations/index.ts +20 -0
- package/src/presentations/dashboard.presentation.ts +59 -0
- package/src/presentations/index.ts +2 -0
- package/src/presentations/pipeline.presentation.ts +117 -0
- package/src/seeders/index.ts +35 -0
- package/src/shared/overlay-types.ts +39 -0
- package/src/ui/CrmDashboard.tsx +311 -0
- package/src/ui/CrmDealCard.tsx +83 -0
- package/src/ui/CrmPipelineBoard.tsx +136 -0
- package/src/ui/hooks/index.ts +10 -0
- package/src/ui/hooks/useDealList.ts +113 -0
- package/src/ui/hooks/useDealMutations.ts +174 -0
- package/src/ui/index.ts +18 -0
- package/src/ui/modals/CreateDealModal.tsx +239 -0
- package/src/ui/modals/DealActionsModal.tsx +424 -0
- package/src/ui/modals/index.ts +2 -0
- package/src/ui/overlays/demo-overlays.ts +68 -0
- package/src/ui/overlays/index.ts +1 -0
- package/src/ui/renderers/index.ts +6 -0
- package/src/ui/renderers/pipeline.markdown.ts +198 -0
- package/src/ui/renderers/pipeline.renderer.tsx +35 -0
- package/tsconfig.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.js +7 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { DealStatusEnum, DealStatusFilterEnum } from "./deal.enum.js";
|
|
2
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
3
|
+
|
|
4
|
+
//#region src/deal/deal.schema.ts
|
|
5
|
+
/**
|
|
6
|
+
* A deal in the CRM pipeline.
|
|
7
|
+
*/
|
|
8
|
+
const DealModel = defineSchemaModel({
|
|
9
|
+
name: "Deal",
|
|
10
|
+
description: "A deal in the CRM pipeline",
|
|
11
|
+
fields: {
|
|
12
|
+
id: {
|
|
13
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
14
|
+
isOptional: false
|
|
15
|
+
},
|
|
16
|
+
name: {
|
|
17
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
18
|
+
isOptional: false
|
|
19
|
+
},
|
|
20
|
+
value: {
|
|
21
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
22
|
+
isOptional: false
|
|
23
|
+
},
|
|
24
|
+
currency: {
|
|
25
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
26
|
+
isOptional: false
|
|
27
|
+
},
|
|
28
|
+
pipelineId: {
|
|
29
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
30
|
+
isOptional: false
|
|
31
|
+
},
|
|
32
|
+
stageId: {
|
|
33
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
34
|
+
isOptional: false
|
|
35
|
+
},
|
|
36
|
+
status: {
|
|
37
|
+
type: DealStatusEnum,
|
|
38
|
+
isOptional: false
|
|
39
|
+
},
|
|
40
|
+
contactId: {
|
|
41
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
42
|
+
isOptional: true
|
|
43
|
+
},
|
|
44
|
+
companyId: {
|
|
45
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
46
|
+
isOptional: true
|
|
47
|
+
},
|
|
48
|
+
ownerId: {
|
|
49
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
50
|
+
isOptional: false
|
|
51
|
+
},
|
|
52
|
+
expectedCloseDate: {
|
|
53
|
+
type: ScalarTypeEnum.DateTime(),
|
|
54
|
+
isOptional: true
|
|
55
|
+
},
|
|
56
|
+
createdAt: {
|
|
57
|
+
type: ScalarTypeEnum.DateTime(),
|
|
58
|
+
isOptional: false
|
|
59
|
+
},
|
|
60
|
+
updatedAt: {
|
|
61
|
+
type: ScalarTypeEnum.DateTime(),
|
|
62
|
+
isOptional: false
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
/**
|
|
67
|
+
* Input for creating a deal.
|
|
68
|
+
*/
|
|
69
|
+
const CreateDealInputModel = defineSchemaModel({
|
|
70
|
+
name: "CreateDealInput",
|
|
71
|
+
description: "Input for creating a deal",
|
|
72
|
+
fields: {
|
|
73
|
+
name: {
|
|
74
|
+
type: ScalarTypeEnum.NonEmptyString(),
|
|
75
|
+
isOptional: false
|
|
76
|
+
},
|
|
77
|
+
value: {
|
|
78
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
79
|
+
isOptional: false
|
|
80
|
+
},
|
|
81
|
+
currency: {
|
|
82
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
83
|
+
isOptional: true
|
|
84
|
+
},
|
|
85
|
+
pipelineId: {
|
|
86
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
87
|
+
isOptional: false
|
|
88
|
+
},
|
|
89
|
+
stageId: {
|
|
90
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
91
|
+
isOptional: false
|
|
92
|
+
},
|
|
93
|
+
contactId: {
|
|
94
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
95
|
+
isOptional: true
|
|
96
|
+
},
|
|
97
|
+
companyId: {
|
|
98
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
99
|
+
isOptional: true
|
|
100
|
+
},
|
|
101
|
+
expectedCloseDate: {
|
|
102
|
+
type: ScalarTypeEnum.DateTime(),
|
|
103
|
+
isOptional: true
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
/**
|
|
108
|
+
* Input for moving a deal to another stage.
|
|
109
|
+
*/
|
|
110
|
+
const MoveDealInputModel = defineSchemaModel({
|
|
111
|
+
name: "MoveDealInput",
|
|
112
|
+
description: "Input for moving a deal to another stage",
|
|
113
|
+
fields: {
|
|
114
|
+
dealId: {
|
|
115
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
116
|
+
isOptional: false
|
|
117
|
+
},
|
|
118
|
+
stageId: {
|
|
119
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
120
|
+
isOptional: false
|
|
121
|
+
},
|
|
122
|
+
position: {
|
|
123
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
124
|
+
isOptional: true
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
/**
|
|
129
|
+
* Payload for deal moved event.
|
|
130
|
+
*/
|
|
131
|
+
const DealMovedPayloadModel = defineSchemaModel({
|
|
132
|
+
name: "DealMovedPayload",
|
|
133
|
+
fields: {
|
|
134
|
+
dealId: {
|
|
135
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
136
|
+
isOptional: false
|
|
137
|
+
},
|
|
138
|
+
fromStage: {
|
|
139
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
140
|
+
isOptional: false
|
|
141
|
+
},
|
|
142
|
+
toStage: {
|
|
143
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
144
|
+
isOptional: false
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
/**
|
|
149
|
+
* Input for marking a deal as won.
|
|
150
|
+
*/
|
|
151
|
+
const WinDealInputModel = defineSchemaModel({
|
|
152
|
+
name: "WinDealInput",
|
|
153
|
+
description: "Input for marking a deal as won",
|
|
154
|
+
fields: {
|
|
155
|
+
dealId: {
|
|
156
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
157
|
+
isOptional: false
|
|
158
|
+
},
|
|
159
|
+
wonSource: {
|
|
160
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
161
|
+
isOptional: true
|
|
162
|
+
},
|
|
163
|
+
notes: {
|
|
164
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
165
|
+
isOptional: true
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
* Payload for deal won event.
|
|
171
|
+
*/
|
|
172
|
+
const DealWonPayloadModel = defineSchemaModel({
|
|
173
|
+
name: "DealWonPayload",
|
|
174
|
+
fields: {
|
|
175
|
+
dealId: {
|
|
176
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
177
|
+
isOptional: false
|
|
178
|
+
},
|
|
179
|
+
value: {
|
|
180
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
181
|
+
isOptional: false
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
/**
|
|
186
|
+
* Input for marking a deal as lost.
|
|
187
|
+
*/
|
|
188
|
+
const LoseDealInputModel = defineSchemaModel({
|
|
189
|
+
name: "LoseDealInput",
|
|
190
|
+
description: "Input for marking a deal as lost",
|
|
191
|
+
fields: {
|
|
192
|
+
dealId: {
|
|
193
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
194
|
+
isOptional: false
|
|
195
|
+
},
|
|
196
|
+
lostReason: {
|
|
197
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
198
|
+
isOptional: false
|
|
199
|
+
},
|
|
200
|
+
notes: {
|
|
201
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
202
|
+
isOptional: true
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
/**
|
|
207
|
+
* Payload for deal lost event.
|
|
208
|
+
*/
|
|
209
|
+
const DealLostPayloadModel = defineSchemaModel({
|
|
210
|
+
name: "DealLostPayload",
|
|
211
|
+
fields: {
|
|
212
|
+
dealId: {
|
|
213
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
214
|
+
isOptional: false
|
|
215
|
+
},
|
|
216
|
+
reason: {
|
|
217
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
218
|
+
isOptional: false
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
/**
|
|
223
|
+
* Input for listing deals.
|
|
224
|
+
*/
|
|
225
|
+
const ListDealsInputModel = defineSchemaModel({
|
|
226
|
+
name: "ListDealsInput",
|
|
227
|
+
description: "Input for listing deals",
|
|
228
|
+
fields: {
|
|
229
|
+
pipelineId: {
|
|
230
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
231
|
+
isOptional: true
|
|
232
|
+
},
|
|
233
|
+
stageId: {
|
|
234
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
235
|
+
isOptional: true
|
|
236
|
+
},
|
|
237
|
+
status: {
|
|
238
|
+
type: DealStatusFilterEnum,
|
|
239
|
+
isOptional: true
|
|
240
|
+
},
|
|
241
|
+
ownerId: {
|
|
242
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
243
|
+
isOptional: true
|
|
244
|
+
},
|
|
245
|
+
search: {
|
|
246
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
247
|
+
isOptional: true
|
|
248
|
+
},
|
|
249
|
+
limit: {
|
|
250
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
251
|
+
isOptional: true,
|
|
252
|
+
defaultValue: 20
|
|
253
|
+
},
|
|
254
|
+
offset: {
|
|
255
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
256
|
+
isOptional: true,
|
|
257
|
+
defaultValue: 0
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
/**
|
|
262
|
+
* Output for listing deals.
|
|
263
|
+
*/
|
|
264
|
+
const ListDealsOutputModel = defineSchemaModel({
|
|
265
|
+
name: "ListDealsOutput",
|
|
266
|
+
description: "Output for listing deals",
|
|
267
|
+
fields: {
|
|
268
|
+
deals: {
|
|
269
|
+
type: DealModel,
|
|
270
|
+
isArray: true,
|
|
271
|
+
isOptional: false
|
|
272
|
+
},
|
|
273
|
+
total: {
|
|
274
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
275
|
+
isOptional: false
|
|
276
|
+
},
|
|
277
|
+
totalValue: {
|
|
278
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
279
|
+
isOptional: false
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
//#endregion
|
|
285
|
+
export { CreateDealInputModel, DealLostPayloadModel, DealModel, DealMovedPayloadModel, DealWonPayloadModel, ListDealsInputModel, ListDealsOutputModel, LoseDealInputModel, MoveDealInputModel, WinDealInputModel };
|
|
286
|
+
//# sourceMappingURL=deal.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deal.schema.js","names":[],"sources":["../../src/deal/deal.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { DealStatusEnum, DealStatusFilterEnum } from './deal.enum';\n\n/**\n * A deal in the CRM pipeline.\n */\nexport const DealModel = defineSchemaModel({\n name: 'Deal',\n description: 'A deal in the CRM pipeline',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n pipelineId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: DealStatusEnum, isOptional: false },\n contactId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n companyId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n expectedCloseDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Input for creating a deal.\n */\nexport const CreateDealInputModel = defineSchemaModel({\n name: 'CreateDealInput',\n description: 'Input for creating a deal',\n fields: {\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n pipelineId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n contactId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n companyId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n expectedCloseDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\n/**\n * Input for moving a deal to another stage.\n */\nexport const MoveDealInputModel = defineSchemaModel({\n name: 'MoveDealInput',\n description: 'Input for moving a deal to another stage',\n fields: {\n dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n position: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n});\n\n/**\n * Payload for deal moved event.\n */\nexport const DealMovedPayloadModel = defineSchemaModel({\n name: 'DealMovedPayload',\n fields: {\n dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n fromStage: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toStage: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\n/**\n * Input for marking a deal as won.\n */\nexport const WinDealInputModel = defineSchemaModel({\n name: 'WinDealInput',\n description: 'Input for marking a deal as won',\n fields: {\n dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n wonSource: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\n/**\n * Payload for deal won event.\n */\nexport const DealWonPayloadModel = defineSchemaModel({\n name: 'DealWonPayload',\n fields: {\n dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n },\n});\n\n/**\n * Input for marking a deal as lost.\n */\nexport const LoseDealInputModel = defineSchemaModel({\n name: 'LoseDealInput',\n description: 'Input for marking a deal as lost',\n fields: {\n dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n lostReason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\n/**\n * Payload for deal lost event.\n */\nexport const DealLostPayloadModel = defineSchemaModel({\n name: 'DealLostPayload',\n fields: {\n dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\n/**\n * Input for listing deals.\n */\nexport const ListDealsInputModel = defineSchemaModel({\n name: 'ListDealsInput',\n description: 'Input for listing deals',\n fields: {\n pipelineId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: DealStatusFilterEnum, isOptional: true },\n ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 20,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n});\n\n/**\n * Output for listing deals.\n */\nexport const ListDealsOutputModel = defineSchemaModel({\n name: 'ListDealsOutput',\n description: 'Output for listing deals',\n fields: {\n deals: { type: DealModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalValue: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n },\n});\n"],"mappings":"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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as _contractspec_lib_contracts6 from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/deal/deal.test-spec.d.ts
|
|
4
|
+
declare const dealListTest: _contractspec_lib_contracts6.TestSpec;
|
|
5
|
+
declare const dealMoveTest: _contractspec_lib_contracts6.TestSpec;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { dealListTest, dealMoveTest };
|
|
8
|
+
//# sourceMappingURL=deal.test-spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deal.test-spec.d.ts","names":[],"sources":["../../src/deal/deal.test-spec.ts"],"sourcesContent":[],"mappings":";;;cAEa,cAyBX,4BAAA,CAzBuB;cA2BZ,cAyBX,4BAAA,CAzBuB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { defineTestSpec } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/deal/deal.test-spec.ts
|
|
4
|
+
const dealListTest = defineTestSpec({
|
|
5
|
+
meta: {
|
|
6
|
+
key: "test.crm.deal.list",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
owners: ["@example.crm-pipeline"],
|
|
9
|
+
description: "Test for listing deals",
|
|
10
|
+
stability: "stable",
|
|
11
|
+
tags: ["test"]
|
|
12
|
+
},
|
|
13
|
+
target: {
|
|
14
|
+
type: "operation",
|
|
15
|
+
operation: {
|
|
16
|
+
key: "crm.deal.list",
|
|
17
|
+
version: "1.0.0"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
scenarios: [{
|
|
21
|
+
key: "success",
|
|
22
|
+
when: { operation: { key: "crm.deal.list" } },
|
|
23
|
+
then: [{
|
|
24
|
+
type: "expectOutput",
|
|
25
|
+
match: {}
|
|
26
|
+
}]
|
|
27
|
+
}, {
|
|
28
|
+
key: "error",
|
|
29
|
+
when: { operation: { key: "crm.deal.list" } },
|
|
30
|
+
then: [{ type: "expectError" }]
|
|
31
|
+
}]
|
|
32
|
+
});
|
|
33
|
+
const dealMoveTest = defineTestSpec({
|
|
34
|
+
meta: {
|
|
35
|
+
key: "test.crm.deal.move",
|
|
36
|
+
version: "1.0.0",
|
|
37
|
+
owners: ["@example.crm-pipeline"],
|
|
38
|
+
description: "Test for moving deal",
|
|
39
|
+
stability: "stable",
|
|
40
|
+
tags: ["test"]
|
|
41
|
+
},
|
|
42
|
+
target: {
|
|
43
|
+
type: "operation",
|
|
44
|
+
operation: {
|
|
45
|
+
key: "crm.deal.move",
|
|
46
|
+
version: "1.0.0"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
scenarios: [{
|
|
50
|
+
key: "success",
|
|
51
|
+
when: { operation: { key: "crm.deal.move" } },
|
|
52
|
+
then: [{
|
|
53
|
+
type: "expectOutput",
|
|
54
|
+
match: {}
|
|
55
|
+
}]
|
|
56
|
+
}, {
|
|
57
|
+
key: "error",
|
|
58
|
+
when: { operation: { key: "crm.deal.move" } },
|
|
59
|
+
then: [{ type: "expectError" }]
|
|
60
|
+
}]
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { dealListTest, dealMoveTest };
|
|
65
|
+
//# sourceMappingURL=deal.test-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deal.test-spec.js","names":[],"sources":["../../src/deal/deal.test-spec.ts"],"sourcesContent":["import { defineTestSpec } from '@contractspec/lib.contracts';\n\nexport const dealListTest = defineTestSpec({\n meta: {\n key: 'test.crm.deal.list',\n version: '1.0.0',\n owners: ['@example.crm-pipeline'],\n description: 'Test for listing deals',\n stability: 'stable',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'crm.deal.list', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'crm.deal.list' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'crm.deal.list' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n\nexport const dealMoveTest = defineTestSpec({\n meta: {\n key: 'test.crm.deal.move',\n version: '1.0.0',\n owners: ['@example.crm-pipeline'],\n description: 'Test for moving deal',\n stability: 'stable',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'crm.deal.move', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'crm.deal.move' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'crm.deal.move' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n"],"mappings":";;;AAEA,MAAa,eAAe,eAAe;CACzC,MAAM;EACJ,KAAK;EACL,SAAS;EACT,QAAQ,CAAC,wBAAwB;EACjC,aAAa;EACb,WAAW;EACX,MAAM,CAAC,OAAO;EACf;CACD,QAAQ;EACN,MAAM;EACN,WAAW;GAAE,KAAK;GAAiB,SAAS;GAAS;EACtD;CACD,WAAW,CACT;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE;EAC7C,MAAM,CAAC;GAAE,MAAM;GAAgB,OAAO,EAAE;GAAE,CAAC;EAC5C,EACD;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE;EAC7C,MAAM,CAAC,EAAE,MAAM,eAAe,CAAC;EAChC,CACF;CACF,CAAC;AAEF,MAAa,eAAe,eAAe;CACzC,MAAM;EACJ,KAAK;EACL,SAAS;EACT,QAAQ,CAAC,wBAAwB;EACjC,aAAa;EACb,WAAW;EACX,MAAM,CAAC,OAAO;EACf;CACD,QAAQ;EACN,MAAM;EACN,WAAW;GAAE,KAAK;GAAiB,SAAS;GAAS;EACtD;CACD,WAAW,CACT;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE;EAC7C,MAAM,CAAC;GAAE,MAAM;GAAgB,OAAO,EAAE;GAAE,CAAC;EAC5C,EACD;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE;EAC7C,MAAM,CAAC,EAAE,MAAM,eAAe,CAAC;EAChC,CACF;CACF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DealStatusEnum, DealStatusFilterEnum } from "./deal.enum.js";
|
|
2
|
+
import { CreateDealContract, ListDealsContract, LoseDealContract, MoveDealContract, WinDealContract } from "./deal.operation.js";
|
|
3
|
+
import { CreateDealInputModel, DealLostPayloadModel, DealModel, DealMovedPayloadModel, DealWonPayloadModel, ListDealsInputModel, ListDealsOutputModel, LoseDealInputModel, MoveDealInputModel, WinDealInputModel } from "./deal.schema.js";
|
|
4
|
+
export { CreateDealContract, CreateDealInputModel, DealLostPayloadModel, DealModel, DealMovedPayloadModel, DealStatusEnum, DealStatusFilterEnum, DealWonPayloadModel, ListDealsContract, ListDealsInputModel, ListDealsOutputModel, LoseDealContract, LoseDealInputModel, MoveDealContract, MoveDealInputModel, WinDealContract, WinDealInputModel };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DealStatusEnum, DealStatusFilterEnum } from "./deal.enum.js";
|
|
2
|
+
import { CreateDealInputModel, DealLostPayloadModel, DealModel, DealMovedPayloadModel, DealWonPayloadModel, ListDealsInputModel, ListDealsOutputModel, LoseDealInputModel, MoveDealInputModel, WinDealInputModel } from "./deal.schema.js";
|
|
3
|
+
import { CreateDealContract, ListDealsContract, LoseDealContract, MoveDealContract, WinDealContract } from "./deal.operation.js";
|
|
4
|
+
|
|
5
|
+
export { CreateDealContract, CreateDealInputModel, DealLostPayloadModel, DealModel, DealMovedPayloadModel, DealStatusEnum, DealStatusFilterEnum, DealWonPayloadModel, ListDealsContract, ListDealsInputModel, ListDealsOutputModel, LoseDealContract, LoseDealInputModel, MoveDealContract, MoveDealInputModel, WinDealContract, WinDealInputModel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
2
|
+
|
|
3
|
+
//#region src/docs/crm-pipeline.docblock.ts
|
|
4
|
+
registerDocBlocks([
|
|
5
|
+
{
|
|
6
|
+
id: "docs.examples.crm-pipeline.goal",
|
|
7
|
+
title: "CRM Pipeline — Goal",
|
|
8
|
+
summary: "Deals, stages, contacts, companies, and tasks with auditable stage movement.",
|
|
9
|
+
kind: "goal",
|
|
10
|
+
visibility: "public",
|
|
11
|
+
route: "/docs/examples/crm-pipeline/goal",
|
|
12
|
+
tags: ["crm", "goal"],
|
|
13
|
+
body: `## Why it matters
|
|
14
|
+
- Regenerable CRM flow for deals/stages without code drift.
|
|
15
|
+
- Ensures stage movement, tasks, and contacts stay aligned across surfaces.
|
|
16
|
+
|
|
17
|
+
## Business/Product goal
|
|
18
|
+
- Give sales teams a governed pipeline with auditable moves and notifications.
|
|
19
|
+
- Allow experimentation (feature flags) on stage definitions and task flows.
|
|
20
|
+
|
|
21
|
+
## Success criteria
|
|
22
|
+
- Stage/state changes emit events and remain declarative in spec.
|
|
23
|
+
- PII (contacts) is scoped/redacted in presentations.`
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "docs.examples.crm-pipeline.usage",
|
|
27
|
+
title: "CRM Pipeline — Usage",
|
|
28
|
+
summary: "How to seed, extend, and regenerate the CRM pipeline.",
|
|
29
|
+
kind: "usage",
|
|
30
|
+
visibility: "public",
|
|
31
|
+
route: "/docs/examples/crm-pipeline/usage",
|
|
32
|
+
tags: ["crm", "usage"],
|
|
33
|
+
body: `## Setup
|
|
34
|
+
1) Seed (if available) or create pipeline stages, deals, contacts, companies, tasks.
|
|
35
|
+
2) Configure Notifications for stage changes/tasks; set policy.pii for contact data.
|
|
36
|
+
|
|
37
|
+
## Extend & regenerate
|
|
38
|
+
1) Adjust stage schema/order, deal fields, task fields in the spec.
|
|
39
|
+
2) Regenerate to sync UI/API/events; ensure kanban/action buttons update.
|
|
40
|
+
3) Use Feature Flags to trial new stages or SLA rules.
|
|
41
|
+
|
|
42
|
+
## Guardrails
|
|
43
|
+
- Emit events for stage moves and task completions; log to Audit Trail.
|
|
44
|
+
- Keep required fields enforced in contracts; avoid freeform state.
|
|
45
|
+
- Redact contact PII in markdown/JSON outputs.`
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "docs.examples.crm-pipeline.reference",
|
|
49
|
+
title: "CRM Pipeline — Reference",
|
|
50
|
+
summary: "Entities, contracts, events, and presentations for the CRM template.",
|
|
51
|
+
kind: "reference",
|
|
52
|
+
visibility: "public",
|
|
53
|
+
route: "/docs/examples/crm-pipeline",
|
|
54
|
+
tags: ["crm", "reference"],
|
|
55
|
+
body: `## Entities
|
|
56
|
+
- Contact, Company, Deal, Pipeline, Stage, Task.
|
|
57
|
+
|
|
58
|
+
## Contracts
|
|
59
|
+
- deal/create, stage/move, contact/company CRUD, task create/complete.
|
|
60
|
+
|
|
61
|
+
## Events
|
|
62
|
+
- deal.created, stage.moved, task.completed, contact.updated.
|
|
63
|
+
|
|
64
|
+
## Presentations
|
|
65
|
+
- Pipelines/kanban, deal detail, contact/company profiles, task lists.
|
|
66
|
+
|
|
67
|
+
## Notes
|
|
68
|
+
- Stage definitions should be declarative; enforce via spec and regeneration.
|
|
69
|
+
- Use Notifications for deal/task updates; Audit Trail for state changes.`
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "docs.examples.crm-pipeline.constraints",
|
|
73
|
+
title: "CRM Pipeline — Constraints & Safety",
|
|
74
|
+
summary: "Internal guardrails for stages, PII, and regeneration semantics in the CRM template.",
|
|
75
|
+
kind: "reference",
|
|
76
|
+
visibility: "internal",
|
|
77
|
+
route: "/docs/examples/crm-pipeline/constraints",
|
|
78
|
+
tags: [
|
|
79
|
+
"crm",
|
|
80
|
+
"constraints",
|
|
81
|
+
"internal"
|
|
82
|
+
],
|
|
83
|
+
body: `## Constraints
|
|
84
|
+
- Stage definitions/order must remain declarative; no imperative overrides in code.
|
|
85
|
+
- Events to emit: deal.created, stage.moved, task.completed, contact.updated (minimum).
|
|
86
|
+
- Regeneration should not alter stage semantics without explicit spec change.
|
|
87
|
+
|
|
88
|
+
## PII
|
|
89
|
+
- Mark contact/company PII (emails, phones) for redaction in presentations.
|
|
90
|
+
- Ensure MCP/web outputs avoid raw PII when not needed.
|
|
91
|
+
|
|
92
|
+
## Verification
|
|
93
|
+
- Add fixtures for stage move rules and SLA/task changes.
|
|
94
|
+
- Ensure Audit/Notifications remain wired for stage and task events.
|
|
95
|
+
- Use Feature Flags for experimental stages/SLAs; default safe/off.`
|
|
96
|
+
}
|
|
97
|
+
]);
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
//# sourceMappingURL=crm-pipeline.docblock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crm-pipeline.docblock.js","names":[],"sources":["../../src/docs/crm-pipeline.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@contractspec/lib.contracts/docs';\nimport { registerDocBlocks } from '@contractspec/lib.contracts/docs';\n\nconst crmPipelineDocBlocks: DocBlock[] = [\n {\n id: 'docs.examples.crm-pipeline.goal',\n title: 'CRM Pipeline — Goal',\n summary:\n 'Deals, stages, contacts, companies, and tasks with auditable stage movement.',\n kind: 'goal',\n visibility: 'public',\n route: '/docs/examples/crm-pipeline/goal',\n tags: ['crm', 'goal'],\n body: `## Why it matters\n- Regenerable CRM flow for deals/stages without code drift.\n- Ensures stage movement, tasks, and contacts stay aligned across surfaces.\n\n## Business/Product goal\n- Give sales teams a governed pipeline with auditable moves and notifications.\n- Allow experimentation (feature flags) on stage definitions and task flows.\n\n## Success criteria\n- Stage/state changes emit events and remain declarative in spec.\n- PII (contacts) is scoped/redacted in presentations.`,\n },\n {\n id: 'docs.examples.crm-pipeline.usage',\n title: 'CRM Pipeline — Usage',\n summary: 'How to seed, extend, and regenerate the CRM pipeline.',\n kind: 'usage',\n visibility: 'public',\n route: '/docs/examples/crm-pipeline/usage',\n tags: ['crm', 'usage'],\n body: `## Setup\n1) Seed (if available) or create pipeline stages, deals, contacts, companies, tasks.\n2) Configure Notifications for stage changes/tasks; set policy.pii for contact data.\n\n## Extend & regenerate\n1) Adjust stage schema/order, deal fields, task fields in the spec.\n2) Regenerate to sync UI/API/events; ensure kanban/action buttons update.\n3) Use Feature Flags to trial new stages or SLA rules.\n\n## Guardrails\n- Emit events for stage moves and task completions; log to Audit Trail.\n- Keep required fields enforced in contracts; avoid freeform state.\n- Redact contact PII in markdown/JSON outputs.`,\n },\n {\n id: 'docs.examples.crm-pipeline.reference',\n title: 'CRM Pipeline — Reference',\n summary:\n 'Entities, contracts, events, and presentations for the CRM template.',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/examples/crm-pipeline',\n tags: ['crm', 'reference'],\n body: `## Entities\n- Contact, Company, Deal, Pipeline, Stage, Task.\n\n## Contracts\n- deal/create, stage/move, contact/company CRUD, task create/complete.\n\n## Events\n- deal.created, stage.moved, task.completed, contact.updated.\n\n## Presentations\n- Pipelines/kanban, deal detail, contact/company profiles, task lists.\n\n## Notes\n- Stage definitions should be declarative; enforce via spec and regeneration.\n- Use Notifications for deal/task updates; Audit Trail for state changes.`,\n },\n {\n id: 'docs.examples.crm-pipeline.constraints',\n title: 'CRM Pipeline — Constraints & Safety',\n summary:\n 'Internal guardrails for stages, PII, and regeneration semantics in the CRM template.',\n kind: 'reference',\n visibility: 'internal',\n route: '/docs/examples/crm-pipeline/constraints',\n tags: ['crm', 'constraints', 'internal'],\n body: `## Constraints\n- Stage definitions/order must remain declarative; no imperative overrides in code.\n- Events to emit: deal.created, stage.moved, task.completed, contact.updated (minimum).\n- Regeneration should not alter stage semantics without explicit spec change.\n\n## PII\n- Mark contact/company PII (emails, phones) for redaction in presentations.\n- Ensure MCP/web outputs avoid raw PII when not needed.\n\n## Verification\n- Add fixtures for stage move rules and SLA/task changes.\n- Ensure Audit/Notifications remain wired for stage and task events.\n- Use Feature Flags for experimental stages/SLAs; default safe/off.`,\n },\n];\n\nregisterDocBlocks(crmPipelineDocBlocks);\n"],"mappings":";;;AAiGA,kBA9FyC;CACvC;EACE,IAAI;EACJ,OAAO;EACP,SACE;EACF,MAAM;EACN,YAAY;EACZ,OAAO;EACP,MAAM,CAAC,OAAO,OAAO;EACrB,MAAM;;;;;;;;;;;EAWP;CACD;EACE,IAAI;EACJ,OAAO;EACP,SAAS;EACT,MAAM;EACN,YAAY;EACZ,OAAO;EACP,MAAM,CAAC,OAAO,QAAQ;EACtB,MAAM;;;;;;;;;;;;;EAaP;CACD;EACE,IAAI;EACJ,OAAO;EACP,SACE;EACF,MAAM;EACN,YAAY;EACZ,OAAO;EACP,MAAM,CAAC,OAAO,YAAY;EAC1B,MAAM;;;;;;;;;;;;;;;EAeP;CACD;EACE,IAAI;EACJ,OAAO;EACP,SACE;EACF,MAAM;EACN,YAAY;EACZ,OAAO;EACP,MAAM;GAAC;GAAO;GAAe;GAAW;EACxC,MAAM;;;;;;;;;;;;;EAaP;CACF,CAEsC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./crm-pipeline.docblock.js";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as _contractspec_lib_schema250 from "@contractspec/lib.schema";
|
|
2
|
+
|
|
3
|
+
//#region src/entities/company.entity.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Company size enum.
|
|
6
|
+
*/
|
|
7
|
+
declare const CompanySizeEnum: _contractspec_lib_schema250.EntityEnumDef;
|
|
8
|
+
/**
|
|
9
|
+
* Company entity - organization/account.
|
|
10
|
+
*/
|
|
11
|
+
declare const CompanyEntity: _contractspec_lib_schema250.EntitySpec<{
|
|
12
|
+
id: _contractspec_lib_schema250.EntityScalarField;
|
|
13
|
+
name: _contractspec_lib_schema250.EntityScalarField;
|
|
14
|
+
domain: _contractspec_lib_schema250.EntityScalarField;
|
|
15
|
+
website: _contractspec_lib_schema250.EntityScalarField;
|
|
16
|
+
industry: _contractspec_lib_schema250.EntityScalarField;
|
|
17
|
+
size: _contractspec_lib_schema250.EntityEnumField;
|
|
18
|
+
employeeCount: _contractspec_lib_schema250.EntityScalarField;
|
|
19
|
+
annualRevenue: _contractspec_lib_schema250.EntityScalarField;
|
|
20
|
+
organizationId: _contractspec_lib_schema250.EntityScalarField;
|
|
21
|
+
ownerId: _contractspec_lib_schema250.EntityScalarField;
|
|
22
|
+
phone: _contractspec_lib_schema250.EntityScalarField;
|
|
23
|
+
email: _contractspec_lib_schema250.EntityScalarField;
|
|
24
|
+
address: _contractspec_lib_schema250.EntityScalarField;
|
|
25
|
+
city: _contractspec_lib_schema250.EntityScalarField;
|
|
26
|
+
state: _contractspec_lib_schema250.EntityScalarField;
|
|
27
|
+
country: _contractspec_lib_schema250.EntityScalarField;
|
|
28
|
+
postalCode: _contractspec_lib_schema250.EntityScalarField;
|
|
29
|
+
linkedInUrl: _contractspec_lib_schema250.EntityScalarField;
|
|
30
|
+
description: _contractspec_lib_schema250.EntityScalarField;
|
|
31
|
+
tags: _contractspec_lib_schema250.EntityScalarField;
|
|
32
|
+
customFields: _contractspec_lib_schema250.EntityScalarField;
|
|
33
|
+
createdAt: _contractspec_lib_schema250.EntityScalarField;
|
|
34
|
+
updatedAt: _contractspec_lib_schema250.EntityScalarField;
|
|
35
|
+
contacts: _contractspec_lib_schema250.EntityRelationField;
|
|
36
|
+
deals: _contractspec_lib_schema250.EntityRelationField;
|
|
37
|
+
}>;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { CompanyEntity, CompanySizeEnum };
|
|
40
|
+
//# sourceMappingURL=company.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"company.entity.d.ts","names":[],"sources":["../../src/entities/company.entity.ts"],"sourcesContent":[],"mappings":";;;;;;AAUa,cAAA,eAKX,EAAA,2BAAA,CAL0B,aAK1B;AAKF;;;cAAa,2CAAa;MAwDxB,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;0DAxDwB;EAAA,QAAA,iDAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineEntity, defineEntityEnum, field, index } from "@contractspec/lib.schema";
|
|
2
|
+
|
|
3
|
+
//#region src/entities/company.entity.ts
|
|
4
|
+
/**
|
|
5
|
+
* Company size enum.
|
|
6
|
+
*/
|
|
7
|
+
const CompanySizeEnum = defineEntityEnum({
|
|
8
|
+
name: "CompanySize",
|
|
9
|
+
values: [
|
|
10
|
+
"STARTUP",
|
|
11
|
+
"SMALL",
|
|
12
|
+
"MEDIUM",
|
|
13
|
+
"LARGE",
|
|
14
|
+
"ENTERPRISE"
|
|
15
|
+
],
|
|
16
|
+
schema: "crm",
|
|
17
|
+
description: "Size category of a company."
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Company entity - organization/account.
|
|
21
|
+
*/
|
|
22
|
+
const CompanyEntity = defineEntity({
|
|
23
|
+
name: "Company",
|
|
24
|
+
description: "A company/organization in the CRM.",
|
|
25
|
+
schema: "crm",
|
|
26
|
+
map: "company",
|
|
27
|
+
fields: {
|
|
28
|
+
id: field.id({ description: "Unique company ID" }),
|
|
29
|
+
name: field.string({ description: "Company name" }),
|
|
30
|
+
domain: field.string({
|
|
31
|
+
isOptional: true,
|
|
32
|
+
description: "Website domain"
|
|
33
|
+
}),
|
|
34
|
+
website: field.url({ isOptional: true }),
|
|
35
|
+
industry: field.string({ isOptional: true }),
|
|
36
|
+
size: field.enum("CompanySize", { isOptional: true }),
|
|
37
|
+
employeeCount: field.int({ isOptional: true }),
|
|
38
|
+
annualRevenue: field.decimal({ isOptional: true }),
|
|
39
|
+
organizationId: field.foreignKey(),
|
|
40
|
+
ownerId: field.foreignKey({ description: "Account owner" }),
|
|
41
|
+
phone: field.string({ isOptional: true }),
|
|
42
|
+
email: field.email({ isOptional: true }),
|
|
43
|
+
address: field.string({ isOptional: true }),
|
|
44
|
+
city: field.string({ isOptional: true }),
|
|
45
|
+
state: field.string({ isOptional: true }),
|
|
46
|
+
country: field.string({ isOptional: true }),
|
|
47
|
+
postalCode: field.string({ isOptional: true }),
|
|
48
|
+
linkedInUrl: field.url({ isOptional: true }),
|
|
49
|
+
description: field.string({ isOptional: true }),
|
|
50
|
+
tags: field.string({ isArray: true }),
|
|
51
|
+
customFields: field.json({ isOptional: true }),
|
|
52
|
+
createdAt: field.createdAt(),
|
|
53
|
+
updatedAt: field.updatedAt(),
|
|
54
|
+
contacts: field.hasMany("Contact"),
|
|
55
|
+
deals: field.hasMany("Deal")
|
|
56
|
+
},
|
|
57
|
+
indexes: [index.on(["organizationId", "ownerId"]), index.on(["domain"])],
|
|
58
|
+
enums: [CompanySizeEnum]
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
export { CompanyEntity, CompanySizeEnum };
|
|
63
|
+
//# sourceMappingURL=company.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"company.entity.js","names":[],"sources":["../../src/entities/company.entity.ts"],"sourcesContent":["import {\n defineEntity,\n defineEntityEnum,\n field,\n index,\n} from '@contractspec/lib.schema';\n\n/**\n * Company size enum.\n */\nexport const CompanySizeEnum = defineEntityEnum({\n name: 'CompanySize',\n values: ['STARTUP', 'SMALL', 'MEDIUM', 'LARGE', 'ENTERPRISE'] as const,\n schema: 'crm',\n description: 'Size category of a company.',\n});\n\n/**\n * Company entity - organization/account.\n */\nexport const CompanyEntity = defineEntity({\n name: 'Company',\n description: 'A company/organization in the CRM.',\n schema: 'crm',\n map: 'company',\n fields: {\n id: field.id({ description: 'Unique company ID' }),\n\n // Basic info\n name: field.string({ description: 'Company name' }),\n domain: field.string({ isOptional: true, description: 'Website domain' }),\n website: field.url({ isOptional: true }),\n\n // Industry\n industry: field.string({ isOptional: true }),\n\n // Size\n size: field.enum('CompanySize', { isOptional: true }),\n employeeCount: field.int({ isOptional: true }),\n annualRevenue: field.decimal({ isOptional: true }),\n\n // Ownership\n organizationId: field.foreignKey(),\n ownerId: field.foreignKey({ description: 'Account owner' }),\n\n // Contact info\n phone: field.string({ isOptional: true }),\n email: field.email({ isOptional: true }),\n\n // Address\n address: field.string({ isOptional: true }),\n city: field.string({ isOptional: true }),\n state: field.string({ isOptional: true }),\n country: field.string({ isOptional: true }),\n postalCode: field.string({ isOptional: true }),\n\n // Social\n linkedInUrl: field.url({ isOptional: true }),\n\n // Notes\n description: field.string({ isOptional: true }),\n tags: field.string({ isArray: true }),\n\n // Custom fields\n customFields: field.json({ isOptional: true }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n\n // Relations\n contacts: field.hasMany('Contact'),\n deals: field.hasMany('Deal'),\n },\n indexes: [index.on(['organizationId', 'ownerId']), index.on(['domain'])],\n enums: [CompanySizeEnum],\n});\n"],"mappings":";;;;;;AAUA,MAAa,kBAAkB,iBAAiB;CAC9C,MAAM;CACN,QAAQ;EAAC;EAAW;EAAS;EAAU;EAAS;EAAa;CAC7D,QAAQ;CACR,aAAa;CACd,CAAC;;;;AAKF,MAAa,gBAAgB,aAAa;CACxC,MAAM;CACN,aAAa;CACb,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,IAAI,MAAM,GAAG,EAAE,aAAa,qBAAqB,CAAC;EAGlD,MAAM,MAAM,OAAO,EAAE,aAAa,gBAAgB,CAAC;EACnD,QAAQ,MAAM,OAAO;GAAE,YAAY;GAAM,aAAa;GAAkB,CAAC;EACzE,SAAS,MAAM,IAAI,EAAE,YAAY,MAAM,CAAC;EAGxC,UAAU,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAG5C,MAAM,MAAM,KAAK,eAAe,EAAE,YAAY,MAAM,CAAC;EACrD,eAAe,MAAM,IAAI,EAAE,YAAY,MAAM,CAAC;EAC9C,eAAe,MAAM,QAAQ,EAAE,YAAY,MAAM,CAAC;EAGlD,gBAAgB,MAAM,YAAY;EAClC,SAAS,MAAM,WAAW,EAAE,aAAa,iBAAiB,CAAC;EAG3D,OAAO,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EACzC,OAAO,MAAM,MAAM,EAAE,YAAY,MAAM,CAAC;EAGxC,SAAS,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAC3C,MAAM,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EACxC,OAAO,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EACzC,SAAS,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAC3C,YAAY,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAG9C,aAAa,MAAM,IAAI,EAAE,YAAY,MAAM,CAAC;EAG5C,aAAa,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAC/C,MAAM,MAAM,OAAO,EAAE,SAAS,MAAM,CAAC;EAGrC,cAAc,MAAM,KAAK,EAAE,YAAY,MAAM,CAAC;EAG9C,WAAW,MAAM,WAAW;EAC5B,WAAW,MAAM,WAAW;EAG5B,UAAU,MAAM,QAAQ,UAAU;EAClC,OAAO,MAAM,QAAQ,OAAO;EAC7B;CACD,SAAS,CAAC,MAAM,GAAG,CAAC,kBAAkB,UAAU,CAAC,EAAE,MAAM,GAAG,CAAC,SAAS,CAAC,CAAC;CACxE,OAAO,CAAC,gBAAgB;CACzB,CAAC"}
|