@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,45 @@
|
|
|
1
|
+
import { defineEvent } from "@contractspec/lib.contracts";
|
|
2
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
3
|
+
|
|
4
|
+
//#region src/events/contact.event.ts
|
|
5
|
+
const ContactCreatedPayload = defineSchemaModel({
|
|
6
|
+
name: "ContactCreatedPayload",
|
|
7
|
+
description: "Payload when a contact is created",
|
|
8
|
+
fields: {
|
|
9
|
+
contactId: {
|
|
10
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
11
|
+
isOptional: false
|
|
12
|
+
},
|
|
13
|
+
email: {
|
|
14
|
+
type: ScalarTypeEnum.EmailAddress(),
|
|
15
|
+
isOptional: true
|
|
16
|
+
},
|
|
17
|
+
organizationId: {
|
|
18
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
19
|
+
isOptional: false
|
|
20
|
+
},
|
|
21
|
+
ownerId: {
|
|
22
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
23
|
+
isOptional: false
|
|
24
|
+
},
|
|
25
|
+
createdAt: {
|
|
26
|
+
type: ScalarTypeEnum.DateTime(),
|
|
27
|
+
isOptional: false
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const ContactCreatedEvent = defineEvent({
|
|
32
|
+
meta: {
|
|
33
|
+
key: "contact.created",
|
|
34
|
+
version: "1.0.0",
|
|
35
|
+
description: "A new contact has been created.",
|
|
36
|
+
stability: "stable",
|
|
37
|
+
owners: ["@crm-team"],
|
|
38
|
+
tags: ["contact", "created"]
|
|
39
|
+
},
|
|
40
|
+
payload: ContactCreatedPayload
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { ContactCreatedEvent };
|
|
45
|
+
//# sourceMappingURL=contact.event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact.event.js","names":[],"sources":["../../src/events/contact.event.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\n// ============ Contact Event Payloads ============\n\nconst ContactCreatedPayload = defineSchemaModel({\n name: 'ContactCreatedPayload',\n description: 'Payload when a contact is created',\n fields: {\n contactId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n email: { type: ScalarTypeEnum.EmailAddress(), isOptional: true },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const ContactCreatedEvent = defineEvent({\n meta: {\n key: 'contact.created',\n version: '1.0.0',\n description: 'A new contact has been created.',\n stability: 'stable',\n owners: ['@crm-team'],\n tags: ['contact', 'created'],\n },\n payload: ContactCreatedPayload,\n});\n"],"mappings":";;;;AAKA,MAAM,wBAAwB,kBAAkB;CAC9C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,OAAO;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAM;EAChE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAa,sBAAsB,YAAY;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM,CAAC,WAAW,UAAU;EAC7B;CACD,SAAS;CACV,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as _contractspec_lib_contracts9 from "@contractspec/lib.contracts";
|
|
2
|
+
import * as _contractspec_lib_schema356 from "@contractspec/lib.schema";
|
|
3
|
+
|
|
4
|
+
//#region src/events/deal.event.d.ts
|
|
5
|
+
declare const DealCreatedEvent: _contractspec_lib_contracts9.EventSpec<_contractspec_lib_schema356.SchemaModel<{
|
|
6
|
+
dealId: {
|
|
7
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
8
|
+
isOptional: false;
|
|
9
|
+
};
|
|
10
|
+
name: {
|
|
11
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
12
|
+
isOptional: false;
|
|
13
|
+
};
|
|
14
|
+
value: {
|
|
15
|
+
type: _contractspec_lib_schema356.FieldType<number, number>;
|
|
16
|
+
isOptional: false;
|
|
17
|
+
};
|
|
18
|
+
pipelineId: {
|
|
19
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
20
|
+
isOptional: false;
|
|
21
|
+
};
|
|
22
|
+
stageId: {
|
|
23
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
24
|
+
isOptional: false;
|
|
25
|
+
};
|
|
26
|
+
ownerId: {
|
|
27
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
28
|
+
isOptional: false;
|
|
29
|
+
};
|
|
30
|
+
createdAt: {
|
|
31
|
+
type: _contractspec_lib_schema356.FieldType<Date, string>;
|
|
32
|
+
isOptional: false;
|
|
33
|
+
};
|
|
34
|
+
}>>;
|
|
35
|
+
declare const DealMovedEvent: _contractspec_lib_contracts9.EventSpec<_contractspec_lib_schema356.SchemaModel<{
|
|
36
|
+
dealId: {
|
|
37
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
38
|
+
isOptional: false;
|
|
39
|
+
};
|
|
40
|
+
fromStageId: {
|
|
41
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
42
|
+
isOptional: false;
|
|
43
|
+
};
|
|
44
|
+
toStageId: {
|
|
45
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
46
|
+
isOptional: false;
|
|
47
|
+
};
|
|
48
|
+
movedBy: {
|
|
49
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
50
|
+
isOptional: false;
|
|
51
|
+
};
|
|
52
|
+
movedAt: {
|
|
53
|
+
type: _contractspec_lib_schema356.FieldType<Date, string>;
|
|
54
|
+
isOptional: false;
|
|
55
|
+
};
|
|
56
|
+
}>>;
|
|
57
|
+
declare const DealWonEvent: _contractspec_lib_contracts9.EventSpec<_contractspec_lib_schema356.SchemaModel<{
|
|
58
|
+
dealId: {
|
|
59
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
60
|
+
isOptional: false;
|
|
61
|
+
};
|
|
62
|
+
value: {
|
|
63
|
+
type: _contractspec_lib_schema356.FieldType<number, number>;
|
|
64
|
+
isOptional: false;
|
|
65
|
+
};
|
|
66
|
+
currency: {
|
|
67
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
68
|
+
isOptional: false;
|
|
69
|
+
};
|
|
70
|
+
contactId: {
|
|
71
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
72
|
+
isOptional: true;
|
|
73
|
+
};
|
|
74
|
+
companyId: {
|
|
75
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
76
|
+
isOptional: true;
|
|
77
|
+
};
|
|
78
|
+
ownerId: {
|
|
79
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
80
|
+
isOptional: false;
|
|
81
|
+
};
|
|
82
|
+
wonAt: {
|
|
83
|
+
type: _contractspec_lib_schema356.FieldType<Date, string>;
|
|
84
|
+
isOptional: false;
|
|
85
|
+
};
|
|
86
|
+
}>>;
|
|
87
|
+
declare const DealLostEvent: _contractspec_lib_contracts9.EventSpec<_contractspec_lib_schema356.SchemaModel<{
|
|
88
|
+
dealId: {
|
|
89
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
90
|
+
isOptional: false;
|
|
91
|
+
};
|
|
92
|
+
value: {
|
|
93
|
+
type: _contractspec_lib_schema356.FieldType<number, number>;
|
|
94
|
+
isOptional: false;
|
|
95
|
+
};
|
|
96
|
+
reason: {
|
|
97
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
98
|
+
isOptional: false;
|
|
99
|
+
};
|
|
100
|
+
ownerId: {
|
|
101
|
+
type: _contractspec_lib_schema356.FieldType<string, string>;
|
|
102
|
+
isOptional: false;
|
|
103
|
+
};
|
|
104
|
+
lostAt: {
|
|
105
|
+
type: _contractspec_lib_schema356.FieldType<Date, string>;
|
|
106
|
+
isOptional: false;
|
|
107
|
+
};
|
|
108
|
+
}>>;
|
|
109
|
+
//#endregion
|
|
110
|
+
export { DealCreatedEvent, DealLostEvent, DealMovedEvent, DealWonEvent };
|
|
111
|
+
//# sourceMappingURL=deal.event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deal.event.d.ts","names":[],"sources":["../../src/events/deal.event.ts"],"sourcesContent":[],"mappings":";;;;cAyDa,kBAAgB,4BAAA,CAAA,sCAAA;;UAU3B,2BAAA,CAAA;;EAVW,CAAA;EAUX,IAAA,EAAA;;;;;;;;;IAV2B,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAYhB,CAAA;EAUX,OAAA,EAAA;;;;;;;EAVyB,CAAA;EAAA,SAAA,EAAA;IAYd,IAAA,uCAUX,KAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;cAtBW,gBAAc,4BAAA,CAAA,sCAAA;;UAUzB,2BAAA,CAAA;;;;IAEuB,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAYZ,CAAA;EAUX,SAAA,EAAA;;;;;;;EAVwB,CAAA;EAAA,OAAA,EAAA;;;;;cAZb,cAAY,4BAAA,CAAA,sCAAA;;UAUvB,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEW,eAAa,4BAAA,CAAA,sCAAA;;UAUxB,2BAAA,CAAA"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { defineEvent } from "@contractspec/lib.contracts";
|
|
2
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
3
|
+
|
|
4
|
+
//#region src/events/deal.event.ts
|
|
5
|
+
const DealCreatedPayload = defineSchemaModel({
|
|
6
|
+
name: "DealCreatedPayload",
|
|
7
|
+
description: "Payload when a deal is created",
|
|
8
|
+
fields: {
|
|
9
|
+
dealId: {
|
|
10
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
11
|
+
isOptional: false
|
|
12
|
+
},
|
|
13
|
+
name: {
|
|
14
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
15
|
+
isOptional: false
|
|
16
|
+
},
|
|
17
|
+
value: {
|
|
18
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
19
|
+
isOptional: false
|
|
20
|
+
},
|
|
21
|
+
pipelineId: {
|
|
22
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
23
|
+
isOptional: false
|
|
24
|
+
},
|
|
25
|
+
stageId: {
|
|
26
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
27
|
+
isOptional: false
|
|
28
|
+
},
|
|
29
|
+
ownerId: {
|
|
30
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
31
|
+
isOptional: false
|
|
32
|
+
},
|
|
33
|
+
createdAt: {
|
|
34
|
+
type: ScalarTypeEnum.DateTime(),
|
|
35
|
+
isOptional: false
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const DealMovedPayload = defineSchemaModel({
|
|
40
|
+
name: "DealMovedEventPayload",
|
|
41
|
+
description: "Payload when a deal is moved to another stage",
|
|
42
|
+
fields: {
|
|
43
|
+
dealId: {
|
|
44
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
45
|
+
isOptional: false
|
|
46
|
+
},
|
|
47
|
+
fromStageId: {
|
|
48
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
49
|
+
isOptional: false
|
|
50
|
+
},
|
|
51
|
+
toStageId: {
|
|
52
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
53
|
+
isOptional: false
|
|
54
|
+
},
|
|
55
|
+
movedBy: {
|
|
56
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
57
|
+
isOptional: false
|
|
58
|
+
},
|
|
59
|
+
movedAt: {
|
|
60
|
+
type: ScalarTypeEnum.DateTime(),
|
|
61
|
+
isOptional: false
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const DealWonPayload = defineSchemaModel({
|
|
66
|
+
name: "DealWonEventPayload",
|
|
67
|
+
description: "Payload when a deal is won",
|
|
68
|
+
fields: {
|
|
69
|
+
dealId: {
|
|
70
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
71
|
+
isOptional: false
|
|
72
|
+
},
|
|
73
|
+
value: {
|
|
74
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
75
|
+
isOptional: false
|
|
76
|
+
},
|
|
77
|
+
currency: {
|
|
78
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
79
|
+
isOptional: false
|
|
80
|
+
},
|
|
81
|
+
contactId: {
|
|
82
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
83
|
+
isOptional: true
|
|
84
|
+
},
|
|
85
|
+
companyId: {
|
|
86
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
87
|
+
isOptional: true
|
|
88
|
+
},
|
|
89
|
+
ownerId: {
|
|
90
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
91
|
+
isOptional: false
|
|
92
|
+
},
|
|
93
|
+
wonAt: {
|
|
94
|
+
type: ScalarTypeEnum.DateTime(),
|
|
95
|
+
isOptional: false
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
const DealLostPayload = defineSchemaModel({
|
|
100
|
+
name: "DealLostEventPayload",
|
|
101
|
+
description: "Payload when a deal is lost",
|
|
102
|
+
fields: {
|
|
103
|
+
dealId: {
|
|
104
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
105
|
+
isOptional: false
|
|
106
|
+
},
|
|
107
|
+
value: {
|
|
108
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
109
|
+
isOptional: false
|
|
110
|
+
},
|
|
111
|
+
reason: {
|
|
112
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
113
|
+
isOptional: false
|
|
114
|
+
},
|
|
115
|
+
ownerId: {
|
|
116
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
117
|
+
isOptional: false
|
|
118
|
+
},
|
|
119
|
+
lostAt: {
|
|
120
|
+
type: ScalarTypeEnum.DateTime(),
|
|
121
|
+
isOptional: false
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
const DealCreatedEvent = defineEvent({
|
|
126
|
+
meta: {
|
|
127
|
+
key: "deal.created",
|
|
128
|
+
version: "1.0.0",
|
|
129
|
+
description: "A new deal has been created.",
|
|
130
|
+
stability: "stable",
|
|
131
|
+
owners: ["@crm-team"],
|
|
132
|
+
tags: ["deal", "created"]
|
|
133
|
+
},
|
|
134
|
+
payload: DealCreatedPayload
|
|
135
|
+
});
|
|
136
|
+
const DealMovedEvent = defineEvent({
|
|
137
|
+
meta: {
|
|
138
|
+
key: "deal.moved",
|
|
139
|
+
version: "1.0.0",
|
|
140
|
+
description: "A deal has been moved to a different stage.",
|
|
141
|
+
stability: "stable",
|
|
142
|
+
owners: ["@crm-team"],
|
|
143
|
+
tags: ["deal", "moved"]
|
|
144
|
+
},
|
|
145
|
+
payload: DealMovedPayload
|
|
146
|
+
});
|
|
147
|
+
const DealWonEvent = defineEvent({
|
|
148
|
+
meta: {
|
|
149
|
+
key: "deal.won",
|
|
150
|
+
version: "1.0.0",
|
|
151
|
+
description: "A deal has been won.",
|
|
152
|
+
stability: "stable",
|
|
153
|
+
owners: ["@crm-team"],
|
|
154
|
+
tags: ["deal", "won"]
|
|
155
|
+
},
|
|
156
|
+
payload: DealWonPayload
|
|
157
|
+
});
|
|
158
|
+
const DealLostEvent = defineEvent({
|
|
159
|
+
meta: {
|
|
160
|
+
key: "deal.lost",
|
|
161
|
+
version: "1.0.0",
|
|
162
|
+
description: "A deal has been lost.",
|
|
163
|
+
stability: "stable",
|
|
164
|
+
owners: ["@crm-team"],
|
|
165
|
+
tags: ["deal", "lost"]
|
|
166
|
+
},
|
|
167
|
+
payload: DealLostPayload
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
export { DealCreatedEvent, DealLostEvent, DealMovedEvent, DealWonEvent };
|
|
172
|
+
//# sourceMappingURL=deal.event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deal.event.js","names":[],"sources":["../../src/events/deal.event.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\n// ============ Deal Event Payloads ============\n\nconst DealCreatedPayload = defineSchemaModel({\n name: 'DealCreatedPayload',\n description: 'Payload when a deal is created',\n fields: {\n dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n pipelineId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst DealMovedPayload = defineSchemaModel({\n name: 'DealMovedEventPayload',\n description: 'Payload when a deal is moved to another stage',\n fields: {\n dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n fromStageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toStageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n movedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n movedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst DealWonPayload = defineSchemaModel({\n name: 'DealWonEventPayload',\n description: 'Payload when a deal is won',\n fields: {\n dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), 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 wonAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst DealLostPayload = defineSchemaModel({\n name: 'DealLostEventPayload',\n description: 'Payload when a deal is lost',\n fields: {\n dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n lostAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const DealCreatedEvent = defineEvent({\n meta: {\n key: 'deal.created',\n version: '1.0.0',\n description: 'A new deal has been created.',\n stability: 'stable',\n owners: ['@crm-team'],\n tags: ['deal', 'created'],\n },\n payload: DealCreatedPayload,\n});\n\nexport const DealMovedEvent = defineEvent({\n meta: {\n key: 'deal.moved',\n version: '1.0.0',\n description: 'A deal has been moved to a different stage.',\n stability: 'stable',\n owners: ['@crm-team'],\n tags: ['deal', 'moved'],\n },\n payload: DealMovedPayload,\n});\n\nexport const DealWonEvent = defineEvent({\n meta: {\n key: 'deal.won',\n version: '1.0.0',\n description: 'A deal has been won.',\n stability: 'stable',\n owners: ['@crm-team'],\n tags: ['deal', 'won'],\n },\n payload: DealWonPayload,\n});\n\nexport const DealLostEvent = defineEvent({\n meta: {\n key: 'deal.lost',\n version: '1.0.0',\n description: 'A deal has been lost.',\n stability: 'stable',\n owners: ['@crm-team'],\n tags: ['deal', 'lost'],\n },\n payload: DealLostPayload,\n});\n"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ovedEvent, DealWonEvent } from "./deal.event.js";
|
|
3
|
+
import { TaskCompletedEvent } from "./task.event.js";
|
|
4
|
+
export { ContactCreatedEvent, DealCreatedEvent, DealLostEvent, DealMovedEvent, DealWonEvent, TaskCompletedEvent };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ContactCreatedEvent } from "./contact.event.js";
|
|
2
|
+
import { DealCreatedEvent, DealLostEvent, DealMovedEvent, DealWonEvent } from "./deal.event.js";
|
|
3
|
+
import { TaskCompletedEvent } from "./task.event.js";
|
|
4
|
+
|
|
5
|
+
export { ContactCreatedEvent, DealCreatedEvent, DealLostEvent, DealMovedEvent, DealWonEvent, TaskCompletedEvent };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as _contractspec_lib_contracts19 from "@contractspec/lib.contracts";
|
|
2
|
+
import * as _contractspec_lib_schema384 from "@contractspec/lib.schema";
|
|
3
|
+
|
|
4
|
+
//#region src/events/task.event.d.ts
|
|
5
|
+
declare const TaskCompletedEvent: _contractspec_lib_contracts19.EventSpec<_contractspec_lib_schema384.SchemaModel<{
|
|
6
|
+
taskId: {
|
|
7
|
+
type: _contractspec_lib_schema384.FieldType<string, string>;
|
|
8
|
+
isOptional: false;
|
|
9
|
+
};
|
|
10
|
+
type: {
|
|
11
|
+
type: _contractspec_lib_schema384.FieldType<string, string>;
|
|
12
|
+
isOptional: false;
|
|
13
|
+
};
|
|
14
|
+
assignedTo: {
|
|
15
|
+
type: _contractspec_lib_schema384.FieldType<string, string>;
|
|
16
|
+
isOptional: false;
|
|
17
|
+
};
|
|
18
|
+
completedBy: {
|
|
19
|
+
type: _contractspec_lib_schema384.FieldType<string, string>;
|
|
20
|
+
isOptional: false;
|
|
21
|
+
};
|
|
22
|
+
completedAt: {
|
|
23
|
+
type: _contractspec_lib_schema384.FieldType<Date, string>;
|
|
24
|
+
isOptional: false;
|
|
25
|
+
};
|
|
26
|
+
}>>;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { TaskCompletedEvent };
|
|
29
|
+
//# sourceMappingURL=task.event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.event.d.ts","names":[],"sources":["../../src/events/task.event.ts"],"sourcesContent":[],"mappings":";;;;cAiBa,oBAAkB,6BAAA,CAAA,sCAAA;;UAU7B,2BAAA,CAAA;;EAVW,CAAA;EAUX,IAAA,EAAA;;;;;;;EAV6B,CAAA;EAAA,WAAA,EAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineEvent } from "@contractspec/lib.contracts";
|
|
2
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
3
|
+
|
|
4
|
+
//#region src/events/task.event.ts
|
|
5
|
+
const TaskCompletedPayload = defineSchemaModel({
|
|
6
|
+
name: "TaskCompletedPayload",
|
|
7
|
+
description: "Payload when a task is completed",
|
|
8
|
+
fields: {
|
|
9
|
+
taskId: {
|
|
10
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
11
|
+
isOptional: false
|
|
12
|
+
},
|
|
13
|
+
type: {
|
|
14
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
15
|
+
isOptional: false
|
|
16
|
+
},
|
|
17
|
+
assignedTo: {
|
|
18
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
19
|
+
isOptional: false
|
|
20
|
+
},
|
|
21
|
+
completedBy: {
|
|
22
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
23
|
+
isOptional: false
|
|
24
|
+
},
|
|
25
|
+
completedAt: {
|
|
26
|
+
type: ScalarTypeEnum.DateTime(),
|
|
27
|
+
isOptional: false
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const TaskCompletedEvent = defineEvent({
|
|
32
|
+
meta: {
|
|
33
|
+
key: "task.completed",
|
|
34
|
+
version: "1.0.0",
|
|
35
|
+
description: "A task has been completed.",
|
|
36
|
+
stability: "stable",
|
|
37
|
+
owners: ["@crm-team"],
|
|
38
|
+
tags: ["task", "lifecycle"]
|
|
39
|
+
},
|
|
40
|
+
payload: TaskCompletedPayload
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { TaskCompletedEvent };
|
|
45
|
+
//# sourceMappingURL=task.event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.event.js","names":[],"sources":["../../src/events/task.event.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\n// ============ Task Event Payloads ============\n\nconst TaskCompletedPayload = defineSchemaModel({\n name: 'TaskCompletedPayload',\n description: 'Payload when a task is completed',\n fields: {\n taskId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n assignedTo: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n completedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const TaskCompletedEvent = defineEvent({\n meta: {\n key: 'task.completed',\n version: '1.0.0',\n description: 'A task has been completed.',\n stability: 'stable',\n owners: ['@crm-team'],\n tags: ['task', 'lifecycle'],\n },\n payload: TaskCompletedPayload,\n});\n"],"mappings":";;;;AAKA,MAAM,uBAAuB,kBAAkB;CAC7C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACzE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC1E,aAAa;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACpE;CACF,CAAC;AAEF,MAAa,qBAAqB,YAAY;CAC5C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM,CAAC,QAAQ,YAAY;EAC5B;CACD,SAAS;CACV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";;;cAEM,SAiCJ,4BAAA,CAjCW"}
|
package/dist/example.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { defineExample } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/example.ts
|
|
4
|
+
const example = defineExample({
|
|
5
|
+
meta: {
|
|
6
|
+
key: "crm-pipeline",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
title: "CRM Pipeline",
|
|
9
|
+
description: "Sales CRM with contacts, companies, deals, pipelines, and tasks.",
|
|
10
|
+
kind: "template",
|
|
11
|
+
visibility: "public",
|
|
12
|
+
stability: "experimental",
|
|
13
|
+
owners: ["@platform.core"],
|
|
14
|
+
tags: [
|
|
15
|
+
"crm",
|
|
16
|
+
"sales",
|
|
17
|
+
"pipeline",
|
|
18
|
+
"deals"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
docs: { rootDocId: "docs.examples.crm-pipeline" },
|
|
22
|
+
entrypoints: {
|
|
23
|
+
packageName: "@contractspec/example.crm-pipeline",
|
|
24
|
+
feature: "./feature",
|
|
25
|
+
contracts: "./contracts",
|
|
26
|
+
presentations: "./presentations",
|
|
27
|
+
handlers: "./handlers",
|
|
28
|
+
docs: "./docs"
|
|
29
|
+
},
|
|
30
|
+
surfaces: {
|
|
31
|
+
templates: true,
|
|
32
|
+
sandbox: {
|
|
33
|
+
enabled: true,
|
|
34
|
+
modes: [
|
|
35
|
+
"playground",
|
|
36
|
+
"specs",
|
|
37
|
+
"builder",
|
|
38
|
+
"markdown",
|
|
39
|
+
"evolution"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
studio: {
|
|
43
|
+
enabled: true,
|
|
44
|
+
installable: true
|
|
45
|
+
},
|
|
46
|
+
mcp: { enabled: true }
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var example_default = example;
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { example_default as default };
|
|
53
|
+
//# sourceMappingURL=example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\nconst example = defineExample({\n meta: {\n key: 'crm-pipeline',\n version: '1.0.0',\n title: 'CRM Pipeline',\n description:\n 'Sales CRM with contacts, companies, deals, pipelines, and tasks.',\n kind: 'template',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.core'],\n tags: ['crm', 'sales', 'pipeline', 'deals'],\n },\n docs: {\n rootDocId: 'docs.examples.crm-pipeline',\n },\n entrypoints: {\n packageName: '@contractspec/example.crm-pipeline',\n feature: './feature',\n contracts: './contracts',\n presentations: './presentations',\n handlers: './handlers',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: {\n enabled: true,\n modes: ['playground', 'specs', 'builder', 'markdown', 'evolution'],\n },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n});\n\nexport default example;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAO;GAAS;GAAY;GAAQ;EAC5C;CACD,MAAM,EACJ,WAAW,8BACZ;CACD,aAAa;EACX,aAAa;EACb,SAAS;EACT,WAAW;EACX,eAAe;EACf,UAAU;EACV,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GACP,SAAS;GACT,OAAO;IAAC;IAAc;IAAS;IAAW;IAAY;IAAY;GACnE;EACD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF,CAAC;AAEF,sBAAe"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { DatabasePort } from "@contractspec/lib.runtime-sandbox";
|
|
2
|
+
|
|
3
|
+
//#region src/handlers/crm.handlers.d.ts
|
|
4
|
+
|
|
5
|
+
interface Deal {
|
|
6
|
+
id: string;
|
|
7
|
+
projectId: string;
|
|
8
|
+
name: string;
|
|
9
|
+
value: number;
|
|
10
|
+
currency: string;
|
|
11
|
+
pipelineId: string;
|
|
12
|
+
stageId: string;
|
|
13
|
+
status: 'OPEN' | 'WON' | 'LOST' | 'STALE';
|
|
14
|
+
contactId?: string;
|
|
15
|
+
companyId?: string;
|
|
16
|
+
ownerId: string;
|
|
17
|
+
expectedCloseDate?: Date;
|
|
18
|
+
wonSource?: string;
|
|
19
|
+
lostReason?: string;
|
|
20
|
+
notes?: string;
|
|
21
|
+
createdAt: Date;
|
|
22
|
+
updatedAt: Date;
|
|
23
|
+
}
|
|
24
|
+
interface Stage {
|
|
25
|
+
id: string;
|
|
26
|
+
pipelineId: string;
|
|
27
|
+
name: string;
|
|
28
|
+
position: number;
|
|
29
|
+
}
|
|
30
|
+
interface CreateDealInput {
|
|
31
|
+
name: string;
|
|
32
|
+
value: number;
|
|
33
|
+
currency?: string;
|
|
34
|
+
pipelineId: string;
|
|
35
|
+
stageId: string;
|
|
36
|
+
contactId?: string;
|
|
37
|
+
companyId?: string;
|
|
38
|
+
expectedCloseDate?: Date;
|
|
39
|
+
}
|
|
40
|
+
interface MoveDealInput {
|
|
41
|
+
dealId: string;
|
|
42
|
+
stageId: string;
|
|
43
|
+
}
|
|
44
|
+
interface WinDealInput {
|
|
45
|
+
dealId: string;
|
|
46
|
+
wonSource?: string;
|
|
47
|
+
notes?: string;
|
|
48
|
+
}
|
|
49
|
+
interface LoseDealInput {
|
|
50
|
+
dealId: string;
|
|
51
|
+
lostReason: string;
|
|
52
|
+
notes?: string;
|
|
53
|
+
}
|
|
54
|
+
interface ListDealsInput {
|
|
55
|
+
projectId: string;
|
|
56
|
+
pipelineId?: string;
|
|
57
|
+
stageId?: string;
|
|
58
|
+
status?: 'OPEN' | 'WON' | 'LOST' | 'all';
|
|
59
|
+
ownerId?: string;
|
|
60
|
+
search?: string;
|
|
61
|
+
limit?: number;
|
|
62
|
+
offset?: number;
|
|
63
|
+
}
|
|
64
|
+
interface ListDealsOutput {
|
|
65
|
+
deals: Deal[];
|
|
66
|
+
total: number;
|
|
67
|
+
totalValue: number;
|
|
68
|
+
}
|
|
69
|
+
declare function createCrmHandlers(db: DatabasePort): {
|
|
70
|
+
listDeals: (input: ListDealsInput) => Promise<ListDealsOutput>;
|
|
71
|
+
createDeal: (input: CreateDealInput, context: {
|
|
72
|
+
projectId: string;
|
|
73
|
+
ownerId: string;
|
|
74
|
+
}) => Promise<Deal>;
|
|
75
|
+
moveDeal: (input: MoveDealInput) => Promise<Deal>;
|
|
76
|
+
winDeal: (input: WinDealInput) => Promise<Deal>;
|
|
77
|
+
loseDeal: (input: LoseDealInput) => Promise<Deal>;
|
|
78
|
+
getDealsByStage: (input: {
|
|
79
|
+
projectId: string;
|
|
80
|
+
pipelineId: string;
|
|
81
|
+
}) => Promise<Record<string, Deal[]>>;
|
|
82
|
+
getPipelineStages: (input: {
|
|
83
|
+
pipelineId: string;
|
|
84
|
+
}) => Promise<Stage[]>;
|
|
85
|
+
};
|
|
86
|
+
type CrmHandlers = ReturnType<typeof createCrmHandlers>;
|
|
87
|
+
//#endregion
|
|
88
|
+
export { CreateDealInput, CrmHandlers, Deal, ListDealsInput, ListDealsOutput, LoseDealInput, MoveDealInput, Stage, WinDealInput, createCrmHandlers };
|
|
89
|
+
//# sourceMappingURL=crm.handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crm.handlers.d.ts","names":[],"sources":["../../src/handl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