@contractspec/example.crm-pipeline 1.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +97 -0
  2. package/.turbo/turbo-build.log +98 -0
  3. package/CHANGELOG.md +246 -0
  4. package/LICENSE +21 -0
  5. package/README.md +139 -0
  6. package/dist/crm-pipeline.feature.d.ts +12 -0
  7. package/dist/crm-pipeline.feature.d.ts.map +1 -0
  8. package/dist/crm-pipeline.feature.js +159 -0
  9. package/dist/crm-pipeline.feature.js.map +1 -0
  10. package/dist/deal/deal.enum.d.ts +14 -0
  11. package/dist/deal/deal.enum.d.ts.map +1 -0
  12. package/dist/deal/deal.enum.js +25 -0
  13. package/dist/deal/deal.enum.js.map +1 -0
  14. package/dist/deal/deal.operation.d.ts +513 -0
  15. package/dist/deal/deal.operation.d.ts.map +1 -0
  16. package/dist/deal/deal.operation.js +270 -0
  17. package/dist/deal/deal.operation.js.map +1 -0
  18. package/dist/deal/deal.schema.d.ts +300 -0
  19. package/dist/deal/deal.schema.d.ts.map +1 -0
  20. package/dist/deal/deal.schema.js +286 -0
  21. package/dist/deal/deal.schema.js.map +1 -0
  22. package/dist/deal/index.d.ts +4 -0
  23. package/dist/deal/index.js +5 -0
  24. package/dist/docs/crm-pipeline.docblock.d.ts +1 -0
  25. package/dist/docs/crm-pipeline.docblock.js +100 -0
  26. package/dist/docs/crm-pipeline.docblock.js.map +1 -0
  27. package/dist/docs/index.d.ts +1 -0
  28. package/dist/docs/index.js +1 -0
  29. package/dist/entities/company.entity.d.ts +40 -0
  30. package/dist/entities/company.entity.d.ts.map +1 -0
  31. package/dist/entities/company.entity.js +63 -0
  32. package/dist/entities/company.entity.js.map +1 -0
  33. package/dist/entities/contact.entity.d.ts +44 -0
  34. package/dist/entities/contact.entity.d.ts.map +1 -0
  35. package/dist/entities/contact.entity.js +78 -0
  36. package/dist/entities/contact.entity.js.map +1 -0
  37. package/dist/entities/deal.entity.d.ts +73 -0
  38. package/dist/entities/deal.entity.d.ts.map +1 -0
  39. package/dist/entities/deal.entity.js +120 -0
  40. package/dist/entities/deal.entity.js.map +1 -0
  41. package/dist/entities/index.d.ts +15 -0
  42. package/dist/entities/index.d.ts.map +1 -0
  43. package/dist/entities/index.js +33 -0
  44. package/dist/entities/index.js.map +1 -0
  45. package/dist/entities/task.entity.d.ts +65 -0
  46. package/dist/entities/task.entity.d.ts.map +1 -0
  47. package/dist/entities/task.entity.js +129 -0
  48. package/dist/entities/task.entity.js.map +1 -0
  49. package/dist/events/contact.event.d.ts +29 -0
  50. package/dist/events/contact.event.d.ts.map +1 -0
  51. package/dist/events/contact.event.js +45 -0
  52. package/dist/events/contact.event.js.map +1 -0
  53. package/dist/events/deal.event.d.ts +111 -0
  54. package/dist/events/deal.event.d.ts.map +1 -0
  55. package/dist/events/deal.event.js +172 -0
  56. package/dist/events/deal.event.js.map +1 -0
  57. package/dist/events/index.d.ts +4 -0
  58. package/dist/events/index.js +5 -0
  59. package/dist/events/task.event.d.ts +29 -0
  60. package/dist/events/task.event.d.ts.map +1 -0
  61. package/dist/events/task.event.js +45 -0
  62. package/dist/events/task.event.js.map +1 -0
  63. package/dist/example.d.ts +37 -0
  64. package/dist/example.d.ts.map +1 -0
  65. package/dist/example.js +46 -0
  66. package/dist/example.js.map +1 -0
  67. package/dist/handlers/deal.handlers.d.ts +94 -0
  68. package/dist/handlers/deal.handlers.d.ts.map +1 -0
  69. package/dist/handlers/deal.handlers.js +120 -0
  70. package/dist/handlers/deal.handlers.js.map +1 -0
  71. package/dist/handlers/index.d.ts +3 -0
  72. package/dist/handlers/index.js +4 -0
  73. package/dist/handlers/mock-data.d.ts +49 -0
  74. package/dist/handlers/mock-data.d.ts.map +1 -0
  75. package/dist/handlers/mock-data.js +188 -0
  76. package/dist/handlers/mock-data.js.map +1 -0
  77. package/dist/index.d.ts +34 -0
  78. package/dist/index.d.ts.map +1 -0
  79. package/dist/index.js +43 -0
  80. package/dist/index.js.map +1 -0
  81. package/dist/operations/index.d.ts +5 -0
  82. package/dist/operations/index.js +6 -0
  83. package/dist/presentations/dashboard.presentation.d.ts +15 -0
  84. package/dist/presentations/dashboard.presentation.d.ts.map +1 -0
  85. package/dist/presentations/dashboard.presentation.js +59 -0
  86. package/dist/presentations/dashboard.presentation.js.map +1 -0
  87. package/dist/presentations/index.d.ts +3 -0
  88. package/dist/presentations/index.js +4 -0
  89. package/dist/presentations/pipeline.presentation.d.ts +23 -0
  90. package/dist/presentations/pipeline.presentation.d.ts.map +1 -0
  91. package/dist/presentations/pipeline.presentation.js +119 -0
  92. package/dist/presentations/pipeline.presentation.js.map +1 -0
  93. package/example.ts +1 -0
  94. package/package.json +105 -0
  95. package/src/crm-pipeline.feature.ts +96 -0
  96. package/src/deal/deal.enum.ts +21 -0
  97. package/src/deal/deal.operation.ts +291 -0
  98. package/src/deal/deal.schema.ts +154 -0
  99. package/src/deal/index.ts +26 -0
  100. package/src/docs/crm-pipeline.docblock.ts +98 -0
  101. package/src/docs/index.ts +1 -0
  102. package/src/entities/company.entity.ts +77 -0
  103. package/src/entities/contact.entity.ts +93 -0
  104. package/src/entities/deal.entity.ts +160 -0
  105. package/src/entities/index.ts +45 -0
  106. package/src/entities/task.entity.ts +137 -0
  107. package/src/events/contact.event.ts +31 -0
  108. package/src/events/deal.event.ts +104 -0
  109. package/src/events/index.ts +3 -0
  110. package/src/events/task.event.ts +28 -0
  111. package/src/example.ts +30 -0
  112. package/src/handlers/deal.handlers.ts +253 -0
  113. package/src/handlers/index.ts +27 -0
  114. package/src/handlers/mock-data.ts +198 -0
  115. package/src/index.ts +31 -0
  116. package/src/operations/index.ts +20 -0
  117. package/src/presentations/dashboard.presentation.ts +60 -0
  118. package/src/presentations/index.ts +2 -0
  119. package/src/presentations/pipeline.presentation.ts +118 -0
  120. package/tsconfig.json +10 -0
  121. package/tsconfig.tsbuildinfo +1 -0
  122. package/tsdown.config.js +7 -0
@@ -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,\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_schema356 from "@contractspec/lib.schema";
2
+ import * as _contractspec_lib_contracts5 from "@contractspec/lib.contracts";
3
+
4
+ //#region src/events/deal.event.d.ts
5
+ declare const DealCreatedEvent: _contractspec_lib_contracts5.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_contracts5.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_contracts5.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_contracts5.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 { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
2
+ import { defineEvent } from "@contractspec/lib.contracts";
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,
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,
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,
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,
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,\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,\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,\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,\n description: 'A deal has been lost.',\n stability: 'stable',\n owners: ['@crm-team'],\n tags: ['deal', 'lost'],\n },\n payload: DealLostPayload,\n});\n"],"mappings":"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"}
@@ -0,0 +1,4 @@
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
+ 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_schema384 from "@contractspec/lib.schema";
2
+ import * as _contractspec_lib_contracts9 from "@contractspec/lib.contracts";
3
+
4
+ //#region src/events/task.event.d.ts
5
+ declare const TaskCompletedEvent: _contractspec_lib_contracts9.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,4BAAA,CAAA,sCAAA;;UAU7B,2BAAA,CAAA;;EAVW,CAAA;EAUX,IAAA,EAAA;;;;;;;EAV6B,CAAA;EAAA,WAAA,EAAA"}
@@ -0,0 +1,45 @@
1
+ import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
2
+ import { defineEvent } from "@contractspec/lib.contracts";
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,
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,\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,37 @@
1
+ //#region src/example.d.ts
2
+ declare const example: {
3
+ readonly id: "crm-pipeline";
4
+ readonly title: "CRM Pipeline";
5
+ readonly summary: "Sales CRM with contacts, companies, deals, pipelines, and tasks.";
6
+ readonly tags: readonly ["crm", "sales", "pipeline", "deals"];
7
+ readonly kind: "template";
8
+ readonly visibility: "public";
9
+ readonly docs: {
10
+ readonly rootDocId: "docs.examples.crm-pipeline";
11
+ };
12
+ readonly entrypoints: {
13
+ readonly packageName: "@contractspec/example.crm-pipeline";
14
+ readonly feature: "./feature";
15
+ readonly contracts: "./contracts";
16
+ readonly presentations: "./presentations";
17
+ readonly handlers: "./handlers";
18
+ readonly docs: "./docs";
19
+ };
20
+ readonly surfaces: {
21
+ readonly templates: true;
22
+ readonly sandbox: {
23
+ readonly enabled: true;
24
+ readonly modes: readonly ["playground", "specs", "builder", "markdown", "evolution"];
25
+ };
26
+ readonly studio: {
27
+ readonly enabled: true;
28
+ readonly installable: true;
29
+ };
30
+ readonly mcp: {
31
+ readonly enabled: true;
32
+ };
33
+ };
34
+ };
35
+ //#endregion
36
+ export { example as default };
37
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";cAAM;EAAA,SAAA,EA2BI,EAAA,cAAA"}
@@ -0,0 +1,46 @@
1
+ //#region src/example.ts
2
+ const example = {
3
+ id: "crm-pipeline",
4
+ title: "CRM Pipeline",
5
+ summary: "Sales CRM with contacts, companies, deals, pipelines, and tasks.",
6
+ tags: [
7
+ "crm",
8
+ "sales",
9
+ "pipeline",
10
+ "deals"
11
+ ],
12
+ kind: "template",
13
+ visibility: "public",
14
+ docs: { rootDocId: "docs.examples.crm-pipeline" },
15
+ entrypoints: {
16
+ packageName: "@contractspec/example.crm-pipeline",
17
+ feature: "./feature",
18
+ contracts: "./contracts",
19
+ presentations: "./presentations",
20
+ handlers: "./handlers",
21
+ docs: "./docs"
22
+ },
23
+ surfaces: {
24
+ templates: true,
25
+ sandbox: {
26
+ enabled: true,
27
+ modes: [
28
+ "playground",
29
+ "specs",
30
+ "builder",
31
+ "markdown",
32
+ "evolution"
33
+ ]
34
+ },
35
+ studio: {
36
+ enabled: true,
37
+ installable: true
38
+ },
39
+ mcp: { enabled: true }
40
+ }
41
+ };
42
+ var example_default = example;
43
+
44
+ //#endregion
45
+ export { example_default as default };
46
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["const example = {\n id: 'crm-pipeline',\n title: 'CRM Pipeline',\n summary: 'Sales CRM with contacts, companies, deals, pipelines, and tasks.',\n tags: ['crm', 'sales', 'pipeline', 'deals'],\n kind: 'template',\n visibility: 'public',\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} as const;\n\nexport default example;\n"],"mappings":";AAAA,MAAM,UAAU;CACd,IAAI;CACJ,OAAO;CACP,SAAS;CACT,MAAM;EAAC;EAAO;EAAS;EAAY;EAAQ;CAC3C,MAAM;CACN,YAAY;CACZ,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;AAED,sBAAe"}
@@ -0,0 +1,94 @@
1
+ import { MockStage } from "./mock-data.js";
2
+
3
+ //#region src/handlers/deal.handlers.d.ts
4
+ interface Deal {
5
+ id: string;
6
+ name: string;
7
+ value: number;
8
+ currency: string;
9
+ pipelineId: string;
10
+ stageId: string;
11
+ status: 'OPEN' | 'WON' | 'LOST' | 'STALE';
12
+ contactId?: string;
13
+ companyId?: string;
14
+ ownerId: string;
15
+ expectedCloseDate?: Date;
16
+ createdAt: Date;
17
+ updatedAt: Date;
18
+ }
19
+ interface CreateDealInput {
20
+ name: string;
21
+ value: number;
22
+ currency?: string;
23
+ pipelineId: string;
24
+ stageId: string;
25
+ contactId?: string;
26
+ companyId?: string;
27
+ expectedCloseDate?: Date;
28
+ }
29
+ interface MoveDealInput {
30
+ dealId: string;
31
+ stageId: string;
32
+ position?: number;
33
+ }
34
+ interface WinDealInput {
35
+ dealId: string;
36
+ wonSource?: string;
37
+ notes?: string;
38
+ }
39
+ interface LoseDealInput {
40
+ dealId: string;
41
+ lostReason: string;
42
+ notes?: string;
43
+ }
44
+ interface ListDealsInput {
45
+ pipelineId?: string;
46
+ stageId?: string;
47
+ status?: 'OPEN' | 'WON' | 'LOST' | 'all';
48
+ ownerId?: string;
49
+ search?: string;
50
+ limit?: number;
51
+ offset?: number;
52
+ }
53
+ interface ListDealsOutput {
54
+ deals: Deal[];
55
+ total: number;
56
+ totalValue: number;
57
+ }
58
+ /**
59
+ * Mock handler for ListDealsContract
60
+ */
61
+ declare function mockListDealsHandler(input: ListDealsInput): Promise<ListDealsOutput>;
62
+ /**
63
+ * Mock handler for CreateDealContract
64
+ */
65
+ declare function mockCreateDealHandler(input: CreateDealInput, context: {
66
+ ownerId: string;
67
+ }): Promise<Deal>;
68
+ /**
69
+ * Mock handler for MoveDealContract
70
+ */
71
+ declare function mockMoveDealHandler(input: MoveDealInput): Promise<Deal>;
72
+ /**
73
+ * Mock handler for WinDealContract
74
+ */
75
+ declare function mockWinDealHandler(input: WinDealInput): Promise<Deal>;
76
+ /**
77
+ * Mock handler for LoseDealContract
78
+ */
79
+ declare function mockLoseDealHandler(input: LoseDealInput): Promise<Deal>;
80
+ /**
81
+ * Get deals grouped by stage for Kanban view
82
+ */
83
+ declare function mockGetDealsByStageHandler(input: {
84
+ pipelineId: string;
85
+ }): Promise<Record<string, Deal[]>>;
86
+ /**
87
+ * Get pipeline stages
88
+ */
89
+ declare function mockGetPipelineStagesHandler(input: {
90
+ pipelineId: string;
91
+ }): Promise<MockStage[]>;
92
+ //#endregion
93
+ export { CreateDealInput, Deal, ListDealsInput, ListDealsOutput, LoseDealInput, MoveDealInput, WinDealInput, mockCreateDealHandler, mockGetDealsByStageHandler, mockGetPipelineStagesHandler, mockListDealsHandler, mockLoseDealHandler, mockMoveDealHandler, mockWinDealHandler };
94
+ //# sourceMappingURL=deal.handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deal.handlers.d.ts","names":[],"sources":["../../src/handlers/deal.handlers.ts"],"sourcesContent":[],"mappings":";;;UAMiB,IAAA;;;EAAA,KAAA,EAAI,MAAA;EAWC,QAAA,EAAA,MAAA;EACT,UAAA,EAAA,MAAA;EACA,OAAA,EAAA,MAAA;EAAI,MAAA,EAAA,MAAA,GAAA,KAAA,GAAA,MAAA,GAAA,OAAA;EAGA,SAAA,CAAA,EAAA,MAAe;EAWf,SAAA,CAAA,EAAA,MAAa;EAMb,OAAA,EAAA,MAAY;EAMZ,iBAAa,CAAA,EA5BR,IA4BQ;EAMb,SAAA,EAjCJ,IAiCI;EAUA,SAAA,EA1CJ,IA0CI;AASjB;AACS,UAjDQ,eAAA,CAiDR;EACE,IAAA,EAAA,MAAA;EAAR,KAAA,EAAA,MAAA;EAAO,QAAA,CAAA,EAAA,MAAA;EAmDY,UAAA,EAAA,MAAA;EACb,OAAA,EAAA,MAAA;EAEE,SAAA,CAAA,EAAA,MAAA;EAAR,SAAA,CAAA,EAAA,MAAA;EAAO,iBAAA,CAAA,EAhGY,IAgGZ;AA2BV;AAAiD,UAxHhC,aAAA,CAwHgC;EAAwB,MAAA,EAAA,MAAA;EAAR,OAAA,EAAA,MAAA;EAAO,QAAA,CAAA,EAAA,MAAA;AA6BxE;AAAgD,UA/I/B,YAAA,CA+I+B;EAAuB,MAAA,EAAA,MAAA;EAAR,SAAA,CAAA,EAAA,MAAA;EAAO,KAAA,CAAA,EAAA,MAAA;AAwBtE;AAAiD,UAjKhC,aAAA,CAiKgC;EAAwB,MAAA,EAAA,MAAA;EAAR,UAAA,EAAA,MAAA;EAAO,KAAA,CAAA,EAAA,MAAA;AAwBxE;AAE2B,UArLV,cAAA,CAqLU;EAAf,UAAA,CAAA,EAAA,MAAA;EAAR,OAAA,CAAA,EAAA,MAAA;EAAO,MAAA,CAAA,EAAA,MAAA,GAAA,KAAA,GAAA,MAAA,GAAA,KAAA;EAgBW,OAAA,CAAA,EAAA,MAAA;;;;;UA3LL,eAAA;SACR;;;;;;;iBAQa,oBAAA,QACb,iBACN,QAAQ;;;;iBAmDW,qBAAA,QACb;;IAEN,QAAQ;;;;iBA2BW,mBAAA,QAA2B,gBAAgB,QAAQ;;;;iBA6BnD,kBAAA,QAA0B,eAAe,QAAQ;;;;iBAwBjD,mBAAA,QAA2B,gBAAgB,QAAQ;;;;iBAwBnD,0BAAA;;IAElB,QAAQ,eAAe;;;;iBAgBL,4BAAA;;IAErB,QAFiD,SAAA"}