@contractspec/example.crm-pipeline 3.7.6 → 3.7.10

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 (130) hide show
  1. package/.turbo/turbo-build.log +45 -42
  2. package/AGENTS.md +51 -33
  3. package/CHANGELOG.md +36 -0
  4. package/README.md +67 -148
  5. package/dist/browser/docs/crm-pipeline.docblock.js +1 -1
  6. package/dist/browser/docs/index.js +1 -1
  7. package/dist/browser/events/contact.event.js +1 -1
  8. package/dist/browser/events/deal.event.js +1 -1
  9. package/dist/browser/events/index.js +3 -3
  10. package/dist/browser/events/task.event.js +1 -1
  11. package/dist/browser/handlers/crm.handlers.js +13 -2
  12. package/dist/browser/handlers/index.js +13 -2
  13. package/dist/browser/index.js +680 -447
  14. package/dist/browser/ui/CrmDashboard.js +574 -352
  15. package/dist/browser/ui/CrmDealCard.js +5 -5
  16. package/dist/browser/ui/CrmPipelineBoard.js +13 -13
  17. package/dist/browser/ui/hooks/index.js +21 -10
  18. package/dist/browser/ui/hooks/useDealList.js +20 -9
  19. package/dist/browser/ui/hooks/useDealMutations.js +1 -1
  20. package/dist/browser/ui/index.js +683 -450
  21. package/dist/browser/ui/modals/CreateDealModal.js +12 -12
  22. package/dist/browser/ui/modals/DealActionsModal.js +21 -21
  23. package/dist/browser/ui/modals/index.js +33 -33
  24. package/dist/browser/ui/renderers/index.js +140 -118
  25. package/dist/browser/ui/renderers/pipeline.markdown.js +13 -2
  26. package/dist/browser/ui/renderers/pipeline.renderer.js +108 -97
  27. package/dist/browser/ui/tables/DealListTab.js +390 -0
  28. package/dist/deal/index.d.ts +2 -2
  29. package/dist/docs/crm-pipeline.docblock.js +1 -1
  30. package/dist/docs/index.js +1 -1
  31. package/dist/events/contact.event.js +1 -1
  32. package/dist/events/deal.event.js +1 -1
  33. package/dist/events/index.js +3 -3
  34. package/dist/events/task.event.js +1 -1
  35. package/dist/handlers/crm.handlers.d.ts +2 -0
  36. package/dist/handlers/crm.handlers.js +13 -2
  37. package/dist/handlers/index.d.ts +2 -2
  38. package/dist/handlers/index.js +13 -2
  39. package/dist/index.d.ts +3 -3
  40. package/dist/index.js +680 -447
  41. package/dist/node/docs/crm-pipeline.docblock.js +1 -1
  42. package/dist/node/docs/index.js +1 -1
  43. package/dist/node/events/contact.event.js +1 -1
  44. package/dist/node/events/deal.event.js +1 -1
  45. package/dist/node/events/index.js +3 -3
  46. package/dist/node/events/task.event.js +1 -1
  47. package/dist/node/handlers/crm.handlers.js +13 -2
  48. package/dist/node/handlers/index.js +13 -2
  49. package/dist/node/index.js +680 -447
  50. package/dist/node/ui/CrmDashboard.js +574 -352
  51. package/dist/node/ui/CrmDealCard.js +5 -5
  52. package/dist/node/ui/CrmPipelineBoard.js +13 -13
  53. package/dist/node/ui/hooks/index.js +21 -10
  54. package/dist/node/ui/hooks/useDealList.js +20 -9
  55. package/dist/node/ui/hooks/useDealMutations.js +1 -1
  56. package/dist/node/ui/index.js +683 -450
  57. package/dist/node/ui/modals/CreateDealModal.js +12 -12
  58. package/dist/node/ui/modals/DealActionsModal.js +21 -21
  59. package/dist/node/ui/modals/index.js +33 -33
  60. package/dist/node/ui/renderers/index.js +140 -118
  61. package/dist/node/ui/renderers/pipeline.markdown.js +13 -2
  62. package/dist/node/ui/renderers/pipeline.renderer.js +108 -97
  63. package/dist/node/ui/tables/DealListTab.js +390 -0
  64. package/dist/operations/index.d.ts +1 -1
  65. package/dist/ui/CrmDashboard.js +574 -352
  66. package/dist/ui/CrmDealCard.js +5 -5
  67. package/dist/ui/CrmPipelineBoard.js +13 -13
  68. package/dist/ui/hooks/index.d.ts +2 -2
  69. package/dist/ui/hooks/index.js +21 -10
  70. package/dist/ui/hooks/useDealList.d.ts +8 -2
  71. package/dist/ui/hooks/useDealList.js +20 -9
  72. package/dist/ui/hooks/useDealMutations.d.ts +9 -0
  73. package/dist/ui/hooks/useDealMutations.js +1 -1
  74. package/dist/ui/index.d.ts +3 -3
  75. package/dist/ui/index.js +683 -450
  76. package/dist/ui/modals/CreateDealModal.js +12 -12
  77. package/dist/ui/modals/DealActionsModal.js +21 -21
  78. package/dist/ui/modals/index.js +33 -33
  79. package/dist/ui/renderers/index.d.ts +1 -1
  80. package/dist/ui/renderers/index.js +140 -118
  81. package/dist/ui/renderers/pipeline.markdown.js +13 -2
  82. package/dist/ui/renderers/pipeline.renderer.d.ts +1 -1
  83. package/dist/ui/renderers/pipeline.renderer.js +108 -97
  84. package/dist/ui/tables/DealListTab.d.ts +20 -0
  85. package/dist/ui/tables/DealListTab.js +391 -0
  86. package/dist/ui/tables/DealListTab.smoke.test.d.ts +1 -0
  87. package/package.json +29 -14
  88. package/src/crm-pipeline.feature.ts +86 -86
  89. package/src/deal/deal.enum.ts +8 -8
  90. package/src/deal/deal.operation.ts +255 -255
  91. package/src/deal/deal.schema.ts +92 -92
  92. package/src/deal/deal.test-spec.ts +48 -48
  93. package/src/deal/index.ts +17 -19
  94. package/src/docs/crm-pipeline.docblock.ts +44 -44
  95. package/src/entities/company.entity.ts +52 -52
  96. package/src/entities/contact.entity.ts +67 -67
  97. package/src/entities/deal.entity.ts +134 -134
  98. package/src/entities/index.ts +27 -27
  99. package/src/entities/task.entity.ts +105 -105
  100. package/src/events/contact.event.ts +22 -22
  101. package/src/events/deal.event.ts +77 -77
  102. package/src/events/task.event.ts +19 -19
  103. package/src/example.ts +32 -32
  104. package/src/handlers/crm.handlers.ts +375 -357
  105. package/src/handlers/deal.handlers.ts +179 -179
  106. package/src/handlers/index.ts +18 -19
  107. package/src/handlers/mock-data.ts +167 -167
  108. package/src/index.ts +11 -11
  109. package/src/operations/index.ts +16 -16
  110. package/src/presentations/dashboard.presentation.ts +45 -45
  111. package/src/presentations/pipeline.presentation.ts +90 -90
  112. package/src/seeders/index.ts +26 -26
  113. package/src/shared/overlay-types.ts +23 -23
  114. package/src/ui/CrmDashboard.tsx +210 -279
  115. package/src/ui/CrmDealCard.tsx +64 -64
  116. package/src/ui/CrmPipelineBoard.tsx +105 -105
  117. package/src/ui/hooks/index.ts +3 -3
  118. package/src/ui/hooks/useDealList.ts +113 -85
  119. package/src/ui/hooks/useDealMutations.ts +151 -150
  120. package/src/ui/index.ts +5 -10
  121. package/src/ui/modals/CreateDealModal.tsx +217 -217
  122. package/src/ui/modals/DealActionsModal.tsx +390 -390
  123. package/src/ui/overlays/demo-overlays.ts +43 -43
  124. package/src/ui/renderers/index.ts +4 -3
  125. package/src/ui/renderers/pipeline.markdown.ts +165 -165
  126. package/src/ui/renderers/pipeline.renderer.tsx +17 -16
  127. package/src/ui/tables/DealListTab.smoke.test.tsx +149 -0
  128. package/src/ui/tables/DealListTab.tsx +276 -0
  129. package/tsconfig.json +7 -8
  130. package/tsdown.config.js +7 -3
@@ -1,137 +1,137 @@
1
1
  import {
2
- defineEntity,
3
- defineEntityEnum,
4
- field,
5
- index,
2
+ defineEntity,
3
+ defineEntityEnum,
4
+ field,
5
+ index,
6
6
  } from '@contractspec/lib.schema';
7
7
 
8
8
  /**
9
9
  * Task type enum.
10
10
  */
11
11
  export const TaskTypeEnum = defineEntityEnum({
12
- name: 'TaskType',
13
- values: ['CALL', 'EMAIL', 'MEETING', 'TODO', 'FOLLOW_UP', 'OTHER'] as const,
14
- schema: 'crm',
15
- description: 'Type of CRM task.',
12
+ name: 'TaskType',
13
+ values: ['CALL', 'EMAIL', 'MEETING', 'TODO', 'FOLLOW_UP', 'OTHER'] as const,
14
+ schema: 'crm',
15
+ description: 'Type of CRM task.',
16
16
  });
17
17
 
18
18
  /**
19
19
  * Task priority enum.
20
20
  */
21
21
  export const TaskPriorityEnum = defineEntityEnum({
22
- name: 'TaskPriority',
23
- values: ['LOW', 'NORMAL', 'HIGH', 'URGENT'] as const,
24
- schema: 'crm',
25
- description: 'Priority of a task.',
22
+ name: 'TaskPriority',
23
+ values: ['LOW', 'NORMAL', 'HIGH', 'URGENT'] as const,
24
+ schema: 'crm',
25
+ description: 'Priority of a task.',
26
26
  });
27
27
 
28
28
  /**
29
29
  * Task status enum.
30
30
  */
31
31
  export const TaskStatusEnum = defineEntityEnum({
32
- name: 'TaskStatus',
33
- values: ['PENDING', 'IN_PROGRESS', 'COMPLETED', 'CANCELLED'] as const,
34
- schema: 'crm',
35
- description: 'Status of a task.',
32
+ name: 'TaskStatus',
33
+ values: ['PENDING', 'IN_PROGRESS', 'COMPLETED', 'CANCELLED'] as const,
34
+ schema: 'crm',
35
+ description: 'Status of a task.',
36
36
  });
37
37
 
38
38
  /**
39
39
  * Task entity - follow-up activities.
40
40
  */
41
41
  export const TaskEntity = defineEntity({
42
- name: 'Task',
43
- description: 'A task or follow-up activity.',
44
- schema: 'crm',
45
- map: 'task',
46
- fields: {
47
- id: field.id(),
48
- title: field.string({ description: 'Task title' }),
49
- description: field.string({ isOptional: true }),
50
-
51
- // Type and priority
52
- type: field.enum('TaskType', { default: 'TODO' }),
53
- priority: field.enum('TaskPriority', { default: 'NORMAL' }),
54
- status: field.enum('TaskStatus', { default: 'PENDING' }),
55
-
56
- // Schedule
57
- dueDate: field.dateTime({ isOptional: true }),
58
- reminderAt: field.dateTime({ isOptional: true }),
59
-
60
- // Associations (polymorphic)
61
- contactId: field.string({ isOptional: true }),
62
- dealId: field.string({ isOptional: true }),
63
- companyId: field.string({ isOptional: true }),
64
-
65
- // Ownership
66
- organizationId: field.foreignKey(),
67
- assignedTo: field.foreignKey({ description: 'User assigned to this task' }),
68
- createdBy: field.foreignKey(),
69
-
70
- // Completion
71
- completedAt: field.dateTime({ isOptional: true }),
72
- completedBy: field.string({ isOptional: true }),
73
-
74
- // Timestamps
75
- createdAt: field.createdAt(),
76
- updatedAt: field.updatedAt(),
77
-
78
- // Relations
79
- contact: field.belongsTo('Contact', ['contactId'], ['id']),
80
- deal: field.belongsTo('Deal', ['dealId'], ['id']),
81
- company: field.belongsTo('Company', ['companyId'], ['id']),
82
- },
83
- indexes: [
84
- index.on(['organizationId', 'assignedTo', 'status']),
85
- index.on(['dueDate', 'status']),
86
- index.on(['contactId']),
87
- index.on(['dealId']),
88
- ],
89
- enums: [TaskTypeEnum, TaskPriorityEnum, TaskStatusEnum],
42
+ name: 'Task',
43
+ description: 'A task or follow-up activity.',
44
+ schema: 'crm',
45
+ map: 'task',
46
+ fields: {
47
+ id: field.id(),
48
+ title: field.string({ description: 'Task title' }),
49
+ description: field.string({ isOptional: true }),
50
+
51
+ // Type and priority
52
+ type: field.enum('TaskType', { default: 'TODO' }),
53
+ priority: field.enum('TaskPriority', { default: 'NORMAL' }),
54
+ status: field.enum('TaskStatus', { default: 'PENDING' }),
55
+
56
+ // Schedule
57
+ dueDate: field.dateTime({ isOptional: true }),
58
+ reminderAt: field.dateTime({ isOptional: true }),
59
+
60
+ // Associations (polymorphic)
61
+ contactId: field.string({ isOptional: true }),
62
+ dealId: field.string({ isOptional: true }),
63
+ companyId: field.string({ isOptional: true }),
64
+
65
+ // Ownership
66
+ organizationId: field.foreignKey(),
67
+ assignedTo: field.foreignKey({ description: 'User assigned to this task' }),
68
+ createdBy: field.foreignKey(),
69
+
70
+ // Completion
71
+ completedAt: field.dateTime({ isOptional: true }),
72
+ completedBy: field.string({ isOptional: true }),
73
+
74
+ // Timestamps
75
+ createdAt: field.createdAt(),
76
+ updatedAt: field.updatedAt(),
77
+
78
+ // Relations
79
+ contact: field.belongsTo('Contact', ['contactId'], ['id']),
80
+ deal: field.belongsTo('Deal', ['dealId'], ['id']),
81
+ company: field.belongsTo('Company', ['companyId'], ['id']),
82
+ },
83
+ indexes: [
84
+ index.on(['organizationId', 'assignedTo', 'status']),
85
+ index.on(['dueDate', 'status']),
86
+ index.on(['contactId']),
87
+ index.on(['dealId']),
88
+ ],
89
+ enums: [TaskTypeEnum, TaskPriorityEnum, TaskStatusEnum],
90
90
  });
91
91
 
92
92
  /**
93
93
  * Activity entity - interaction history.
94
94
  */
95
95
  export const ActivityEntity = defineEntity({
96
- name: 'Activity',
97
- description: 'An activity/interaction logged in the CRM.',
98
- schema: 'crm',
99
- map: 'activity',
100
- fields: {
101
- id: field.id(),
102
- type: field.enum('TaskType'),
103
- subject: field.string(),
104
- description: field.string({ isOptional: true }),
105
-
106
- // Associations
107
- contactId: field.string({ isOptional: true }),
108
- dealId: field.string({ isOptional: true }),
109
- companyId: field.string({ isOptional: true }),
110
-
111
- // Ownership
112
- organizationId: field.foreignKey(),
113
- performedBy: field.foreignKey(),
114
-
115
- // Outcome
116
- outcome: field.string({ isOptional: true }),
117
-
118
- // Timing
119
- occurredAt: field.dateTime(),
120
- duration: field.int({
121
- isOptional: true,
122
- description: 'Duration in minutes',
123
- }),
124
-
125
- // Timestamps
126
- createdAt: field.createdAt(),
127
-
128
- // Relations
129
- contact: field.belongsTo('Contact', ['contactId'], ['id']),
130
- deal: field.belongsTo('Deal', ['dealId'], ['id']),
131
- company: field.belongsTo('Company', ['companyId'], ['id']),
132
- },
133
- indexes: [
134
- index.on(['contactId', 'occurredAt']),
135
- index.on(['dealId', 'occurredAt']),
136
- ],
96
+ name: 'Activity',
97
+ description: 'An activity/interaction logged in the CRM.',
98
+ schema: 'crm',
99
+ map: 'activity',
100
+ fields: {
101
+ id: field.id(),
102
+ type: field.enum('TaskType'),
103
+ subject: field.string(),
104
+ description: field.string({ isOptional: true }),
105
+
106
+ // Associations
107
+ contactId: field.string({ isOptional: true }),
108
+ dealId: field.string({ isOptional: true }),
109
+ companyId: field.string({ isOptional: true }),
110
+
111
+ // Ownership
112
+ organizationId: field.foreignKey(),
113
+ performedBy: field.foreignKey(),
114
+
115
+ // Outcome
116
+ outcome: field.string({ isOptional: true }),
117
+
118
+ // Timing
119
+ occurredAt: field.dateTime(),
120
+ duration: field.int({
121
+ isOptional: true,
122
+ description: 'Duration in minutes',
123
+ }),
124
+
125
+ // Timestamps
126
+ createdAt: field.createdAt(),
127
+
128
+ // Relations
129
+ contact: field.belongsTo('Contact', ['contactId'], ['id']),
130
+ deal: field.belongsTo('Deal', ['dealId'], ['id']),
131
+ company: field.belongsTo('Company', ['companyId'], ['id']),
132
+ },
133
+ indexes: [
134
+ index.on(['contactId', 'occurredAt']),
135
+ index.on(['dealId', 'occurredAt']),
136
+ ],
137
137
  });
@@ -1,31 +1,31 @@
1
- import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';
2
1
  import { defineEvent } from '@contractspec/lib.contracts-spec';
2
+ import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
3
3
 
4
4
  // ============ Contact Event Payloads ============
5
5
 
6
6
  const ContactCreatedPayload = defineSchemaModel({
7
- name: 'ContactCreatedPayload',
8
- description: 'Payload when a contact is created',
9
- fields: {
10
- contactId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
- email: { type: ScalarTypeEnum.EmailAddress(), isOptional: true },
12
- organizationId: {
13
- type: ScalarTypeEnum.String_unsecure(),
14
- isOptional: false,
15
- },
16
- ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
17
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
18
- },
7
+ name: 'ContactCreatedPayload',
8
+ description: 'Payload when a contact is created',
9
+ fields: {
10
+ contactId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
+ email: { type: ScalarTypeEnum.EmailAddress(), isOptional: true },
12
+ organizationId: {
13
+ type: ScalarTypeEnum.String_unsecure(),
14
+ isOptional: false,
15
+ },
16
+ ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
17
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
18
+ },
19
19
  });
20
20
 
21
21
  export const ContactCreatedEvent = defineEvent({
22
- meta: {
23
- key: 'contact.created',
24
- version: '1.0.0',
25
- description: 'A new contact has been created.',
26
- stability: 'stable',
27
- owners: ['@crm-team'],
28
- tags: ['contact', 'created'],
29
- },
30
- payload: ContactCreatedPayload,
22
+ meta: {
23
+ key: 'contact.created',
24
+ version: '1.0.0',
25
+ description: 'A new contact has been created.',
26
+ stability: 'stable',
27
+ owners: ['@crm-team'],
28
+ tags: ['contact', 'created'],
29
+ },
30
+ payload: ContactCreatedPayload,
31
31
  });
@@ -1,104 +1,104 @@
1
- import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';
2
1
  import { defineEvent } from '@contractspec/lib.contracts-spec';
2
+ import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
3
3
 
4
4
  // ============ Deal Event Payloads ============
5
5
 
6
6
  const DealCreatedPayload = defineSchemaModel({
7
- name: 'DealCreatedPayload',
8
- description: 'Payload when a deal is created',
9
- fields: {
10
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
- name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
12
- value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
13
- pipelineId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
14
- stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
15
- ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
16
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
17
- },
7
+ name: 'DealCreatedPayload',
8
+ description: 'Payload when a deal is created',
9
+ fields: {
10
+ dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
12
+ value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
13
+ pipelineId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
14
+ stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
15
+ ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
16
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
17
+ },
18
18
  });
19
19
 
20
20
  const DealMovedPayload = defineSchemaModel({
21
- name: 'DealMovedEventPayload',
22
- description: 'Payload when a deal is moved to another stage',
23
- fields: {
24
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
25
- fromStageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
26
- toStageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
27
- movedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
28
- movedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
29
- },
21
+ name: 'DealMovedEventPayload',
22
+ description: 'Payload when a deal is moved to another stage',
23
+ fields: {
24
+ dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
25
+ fromStageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
26
+ toStageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
27
+ movedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
28
+ movedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
29
+ },
30
30
  });
31
31
 
32
32
  const DealWonPayload = defineSchemaModel({
33
- name: 'DealWonEventPayload',
34
- description: 'Payload when a deal is won',
35
- fields: {
36
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
37
- value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
38
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
39
- contactId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
40
- companyId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
41
- ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
42
- wonAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
43
- },
33
+ name: 'DealWonEventPayload',
34
+ description: 'Payload when a deal is won',
35
+ fields: {
36
+ dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
37
+ value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
38
+ currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
39
+ contactId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
40
+ companyId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
41
+ ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
42
+ wonAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
43
+ },
44
44
  });
45
45
 
46
46
  const DealLostPayload = defineSchemaModel({
47
- name: 'DealLostEventPayload',
48
- description: 'Payload when a deal is lost',
49
- fields: {
50
- dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
51
- value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
52
- reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
53
- ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
54
- lostAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
55
- },
47
+ name: 'DealLostEventPayload',
48
+ description: 'Payload when a deal is lost',
49
+ fields: {
50
+ dealId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
51
+ value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
52
+ reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
53
+ ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
54
+ lostAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
55
+ },
56
56
  });
57
57
 
58
58
  export const DealCreatedEvent = defineEvent({
59
- meta: {
60
- key: 'deal.created',
61
- version: '1.0.0',
62
- description: 'A new deal has been created.',
63
- stability: 'stable',
64
- owners: ['@crm-team'],
65
- tags: ['deal', 'created'],
66
- },
67
- payload: DealCreatedPayload,
59
+ meta: {
60
+ key: 'deal.created',
61
+ version: '1.0.0',
62
+ description: 'A new deal has been created.',
63
+ stability: 'stable',
64
+ owners: ['@crm-team'],
65
+ tags: ['deal', 'created'],
66
+ },
67
+ payload: DealCreatedPayload,
68
68
  });
69
69
 
70
70
  export const DealMovedEvent = defineEvent({
71
- meta: {
72
- key: 'deal.moved',
73
- version: '1.0.0',
74
- description: 'A deal has been moved to a different stage.',
75
- stability: 'stable',
76
- owners: ['@crm-team'],
77
- tags: ['deal', 'moved'],
78
- },
79
- payload: DealMovedPayload,
71
+ meta: {
72
+ key: 'deal.moved',
73
+ version: '1.0.0',
74
+ description: 'A deal has been moved to a different stage.',
75
+ stability: 'stable',
76
+ owners: ['@crm-team'],
77
+ tags: ['deal', 'moved'],
78
+ },
79
+ payload: DealMovedPayload,
80
80
  });
81
81
 
82
82
  export const DealWonEvent = defineEvent({
83
- meta: {
84
- key: 'deal.won',
85
- version: '1.0.0',
86
- description: 'A deal has been won.',
87
- stability: 'stable',
88
- owners: ['@crm-team'],
89
- tags: ['deal', 'won'],
90
- },
91
- payload: DealWonPayload,
83
+ meta: {
84
+ key: 'deal.won',
85
+ version: '1.0.0',
86
+ description: 'A deal has been won.',
87
+ stability: 'stable',
88
+ owners: ['@crm-team'],
89
+ tags: ['deal', 'won'],
90
+ },
91
+ payload: DealWonPayload,
92
92
  });
93
93
 
94
94
  export const DealLostEvent = defineEvent({
95
- meta: {
96
- key: 'deal.lost',
97
- version: '1.0.0',
98
- description: 'A deal has been lost.',
99
- stability: 'stable',
100
- owners: ['@crm-team'],
101
- tags: ['deal', 'lost'],
102
- },
103
- payload: DealLostPayload,
95
+ meta: {
96
+ key: 'deal.lost',
97
+ version: '1.0.0',
98
+ description: 'A deal has been lost.',
99
+ stability: 'stable',
100
+ owners: ['@crm-team'],
101
+ tags: ['deal', 'lost'],
102
+ },
103
+ payload: DealLostPayload,
104
104
  });
@@ -1,28 +1,28 @@
1
- import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';
2
1
  import { defineEvent } from '@contractspec/lib.contracts-spec';
2
+ import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
3
3
 
4
4
  // ============ Task Event Payloads ============
5
5
 
6
6
  const TaskCompletedPayload = defineSchemaModel({
7
- name: 'TaskCompletedPayload',
8
- description: 'Payload when a task is completed',
9
- fields: {
10
- taskId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
- type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
12
- assignedTo: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
13
- completedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
14
- completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
15
- },
7
+ name: 'TaskCompletedPayload',
8
+ description: 'Payload when a task is completed',
9
+ fields: {
10
+ taskId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
+ type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
12
+ assignedTo: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
13
+ completedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
14
+ completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
15
+ },
16
16
  });
17
17
 
18
18
  export const TaskCompletedEvent = defineEvent({
19
- meta: {
20
- key: 'task.completed',
21
- version: '1.0.0',
22
- description: 'A task has been completed.',
23
- stability: 'stable',
24
- owners: ['@crm-team'],
25
- tags: ['task', 'lifecycle'],
26
- },
27
- payload: TaskCompletedPayload,
19
+ meta: {
20
+ key: 'task.completed',
21
+ version: '1.0.0',
22
+ description: 'A task has been completed.',
23
+ stability: 'stable',
24
+ owners: ['@crm-team'],
25
+ tags: ['task', 'lifecycle'],
26
+ },
27
+ payload: TaskCompletedPayload,
28
28
  });
package/src/example.ts CHANGED
@@ -1,38 +1,38 @@
1
1
  import { defineExample } from '@contractspec/lib.contracts-spec';
2
2
 
3
3
  const example = defineExample({
4
- meta: {
5
- key: 'crm-pipeline',
6
- version: '1.0.0',
7
- title: 'CRM Pipeline',
8
- description:
9
- 'Sales CRM with contacts, companies, deals, pipelines, and tasks.',
10
- kind: 'template',
11
- visibility: 'public',
12
- stability: 'experimental',
13
- owners: ['@platform.core'],
14
- tags: ['crm', 'sales', 'pipeline', 'deals'],
15
- },
16
- docs: {
17
- rootDocId: 'docs.examples.crm-pipeline',
18
- },
19
- entrypoints: {
20
- packageName: '@contractspec/example.crm-pipeline',
21
- feature: './feature',
22
- contracts: './contracts',
23
- presentations: './presentations',
24
- handlers: './handlers',
25
- docs: './docs',
26
- },
27
- surfaces: {
28
- templates: true,
29
- sandbox: {
30
- enabled: true,
31
- modes: ['playground', 'specs', 'builder', 'markdown', 'evolution'],
32
- },
33
- studio: { enabled: true, installable: true },
34
- mcp: { enabled: true },
35
- },
4
+ meta: {
5
+ key: 'crm-pipeline',
6
+ version: '1.0.0',
7
+ title: 'CRM Pipeline',
8
+ description:
9
+ 'Sales CRM with contacts, companies, deals, pipelines, and tasks.',
10
+ kind: 'template',
11
+ visibility: 'public',
12
+ stability: 'experimental',
13
+ owners: ['@platform.core'],
14
+ tags: ['crm', 'sales', 'pipeline', 'deals'],
15
+ },
16
+ docs: {
17
+ rootDocId: 'docs.examples.crm-pipeline',
18
+ },
19
+ entrypoints: {
20
+ packageName: '@contractspec/example.crm-pipeline',
21
+ feature: './feature',
22
+ contracts: './contracts',
23
+ presentations: './presentations',
24
+ handlers: './handlers',
25
+ docs: './docs',
26
+ },
27
+ surfaces: {
28
+ templates: true,
29
+ sandbox: {
30
+ enabled: true,
31
+ modes: ['playground', 'specs', 'builder', 'markdown', 'evolution'],
32
+ },
33
+ studio: { enabled: true, installable: true },
34
+ mcp: { enabled: true },
35
+ },
36
36
  });
37
37
 
38
38
  export default example;