@lssm/example.crm-pipeline 0.0.0-canary-20251215234153 → 0.0.0-canary-20251216023757
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.log +10 -7
- package/CHANGELOG.md +8 -8
- package/dist/contracts/index.js +1 -1
- package/dist/deal/deal.contracts.js +1 -0
- package/dist/deal/deal.enum.js +1 -0
- package/dist/deal/deal.schema.js +1 -0
- package/dist/deal/index.js +1 -0
- package/dist/index.js +1 -1
- package/dist/presentations/pipeline.presentation.js +1 -1
- package/package.json +9 -3
- package/src/contracts/index.ts +3 -2
- package/src/deal/deal.contracts.ts +176 -0
- package/src/deal/deal.enum.ts +23 -0
- package/src/{contracts/deal.contracts.ts → deal/deal.schema.ts} +33 -185
- package/src/deal/index.ts +28 -0
- package/src/presentations/pipeline.presentation.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/contracts/deal.contracts.js +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -2,23 +2,25 @@ $ bun build:bundle && bun build:types
|
|
|
2
2
|
$ tsdown
|
|
3
3
|
[34mℹ[39m tsdown [2mv0.17.4[22m powered by rolldown [2mv1.0.0-beta.53[22m
|
|
4
4
|
[34mℹ[39m config file: [4m/home/runner/work/contractspec/contractspec/packages/examples/crm-pipeline/tsdown.config.js[24m
|
|
5
|
-
[34mℹ[39m entry: [34msrc/crm-pipeline.feature.ts, src/example.ts, src/index.ts, src/contracts/deal.contracts.ts, src/
|
|
5
|
+
[34mℹ[39m entry: [34msrc/crm-pipeline.feature.ts, src/example.ts, src/index.ts, src/contracts/index.ts, src/deal/deal.contracts.ts, src/deal/deal.enum.ts, src/deal/deal.schema.ts, src/deal/index.ts, src/docs/crm-pipeline.docblock.ts, src/docs/index.ts, src/entities/company.entity.ts, src/entities/contact.entity.ts, src/entities/deal.entity.ts, src/entities/index.ts, src/entities/task.entity.ts, src/events/contact.event.ts, src/events/deal.event.ts, src/events/index.ts, src/events/task.event.ts, src/handlers/deal.handlers.ts, src/handlers/index.ts, src/handlers/mock-data.ts, src/presentations/dashboard.presentation.ts, src/presentations/index.ts, src/presentations/pipeline.presentation.ts[39m
|
|
6
6
|
[34mℹ[39m target: [34mesnext[39m
|
|
7
7
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
8
8
|
[34mℹ[39m Build start
|
|
9
|
-
[34mℹ[39m [2mdist/[22m[
|
|
10
|
-
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m3.60 kB[22m [2m│ gzip: 1.10 kB[22m
|
|
9
|
+
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m3.66 kB[22m [2m│ gzip: 1.11 kB[22m
|
|
11
10
|
[34mℹ[39m [2mdist/[22m[1mhandlers/mock-data.js[22m [2m3.36 kB[22m [2m│ gzip: 0.97 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mdeal/deal.schema.js[22m [2m3.34 kB[22m [2m│ gzip: 0.70 kB[22m
|
|
12
12
|
[34mℹ[39m [2mdist/[22m[1mdocs/crm-pipeline.docblock.js[22m [2m3.31 kB[22m [2m│ gzip: 1.36 kB[22m
|
|
13
13
|
[34mℹ[39m [2mdist/[22m[1mentities/deal.entity.js[22m [2m2.52 kB[22m [2m│ gzip: 0.87 kB[22m
|
|
14
14
|
[34mℹ[39m [2mdist/[22m[1mentities/task.entity.js[22m [2m2.35 kB[22m [2m│ gzip: 0.81 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22m[1mdeal/deal.contracts.js[22m [2m2.26 kB[22m [2m│ gzip: 0.74 kB[22m
|
|
15
16
|
[34mℹ[39m [2mdist/[22m[1mevents/deal.event.js[22m [2m2.07 kB[22m [2m│ gzip: 0.50 kB[22m
|
|
16
17
|
[34mℹ[39m [2mdist/[22m[1mhandlers/deal.handlers.js[22m [2m1.85 kB[22m [2m│ gzip: 0.78 kB[22m
|
|
17
18
|
[34mℹ[39m [2mdist/[22m[1mentities/contact.entity.js[22m [2m1.68 kB[22m [2m│ gzip: 0.70 kB[22m
|
|
18
|
-
[34mℹ[39m [2mdist/[22m[1mpresentations/pipeline.presentation.js[22m [2m1.
|
|
19
|
+
[34mℹ[39m [2mdist/[22m[1mpresentations/pipeline.presentation.js[22m [2m1.48 kB[22m [2m│ gzip: 0.48 kB[22m
|
|
19
20
|
[34mℹ[39m [2mdist/[22m[1mcrm-pipeline.feature.js[22m [2m1.41 kB[22m [2m│ gzip: 0.44 kB[22m
|
|
20
21
|
[34mℹ[39m [2mdist/[22m[1mentities/company.entity.js[22m [2m1.35 kB[22m [2m│ gzip: 0.59 kB[22m
|
|
21
|
-
[34mℹ[39m [2mdist/[22m[1mcontracts/index.js[22m [2m0.
|
|
22
|
+
[34mℹ[39m [2mdist/[22m[1mcontracts/index.js[22m [2m0.90 kB[22m [2m│ gzip: 0.30 kB[22m
|
|
23
|
+
[34mℹ[39m [2mdist/[22m[1mdeal/index.js[22m [2m0.90 kB[22m [2m│ gzip: 0.30 kB[22m
|
|
22
24
|
[34mℹ[39m [2mdist/[22m[1mentities/index.js[22m [2m0.76 kB[22m [2m│ gzip: 0.33 kB[22m
|
|
23
25
|
[34mℹ[39m [2mdist/[22m[1mpresentations/dashboard.presentation.js[22m [2m0.74 kB[22m [2m│ gzip: 0.33 kB[22m
|
|
24
26
|
[34mℹ[39m [2mdist/[22m[1mhandlers/index.js[22m [2m0.60 kB[22m [2m│ gzip: 0.25 kB[22m
|
|
@@ -27,7 +29,8 @@ $ tsdown
|
|
|
27
29
|
[34mℹ[39m [2mdist/[22m[1mevents/task.event.js[22m [2m0.58 kB[22m [2m│ gzip: 0.29 kB[22m
|
|
28
30
|
[34mℹ[39m [2mdist/[22m[1mpresentations/index.js[22m [2m0.44 kB[22m [2m│ gzip: 0.17 kB[22m
|
|
29
31
|
[34mℹ[39m [2mdist/[22m[1mevents/index.js[22m [2m0.35 kB[22m [2m│ gzip: 0.17 kB[22m
|
|
32
|
+
[34mℹ[39m [2mdist/[22m[1mdeal/deal.enum.js[22m [2m0.21 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
30
33
|
[34mℹ[39m [2mdist/[22m[1mdocs/index.js[22m [2m0.04 kB[22m [2m│ gzip: 0.06 kB[22m
|
|
31
|
-
[34mℹ[39m
|
|
32
|
-
[32m✔[39m Build complete in [
|
|
34
|
+
[34mℹ[39m 25 files, total: 37.34 kB
|
|
35
|
+
[32m✔[39m Build complete in [32m62ms[39m
|
|
33
36
|
$ tsc --noEmit
|
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# @lssm/example.crm-pipeline
|
|
2
2
|
|
|
3
|
-
## 0.0.0-canary-
|
|
3
|
+
## 0.0.0-canary-20251216023757
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- 3086383: refactor: dependencies upgrade
|
|
8
8
|
- Updated dependencies [3086383]
|
|
9
|
-
- @lssm/lib.contracts@0.0.0-canary-
|
|
10
|
-
- @lssm/lib.schema@0.0.0-canary-
|
|
11
|
-
- @lssm/lib.jobs@0.0.0-canary-
|
|
12
|
-
- @lssm/lib.bus@0.0.0-canary-
|
|
13
|
-
- @lssm/lib.identity-rbac@0.0.0-canary-
|
|
14
|
-
- @lssm/module.audit-trail@0.0.0-canary-
|
|
15
|
-
- @lssm/module.notifications@0.0.0-canary-
|
|
9
|
+
- @lssm/lib.contracts@0.0.0-canary-20251216023757
|
|
10
|
+
- @lssm/lib.schema@0.0.0-canary-20251216023757
|
|
11
|
+
- @lssm/lib.jobs@0.0.0-canary-20251216023757
|
|
12
|
+
- @lssm/lib.bus@0.0.0-canary-20251216023757
|
|
13
|
+
- @lssm/lib.identity-rbac@0.0.0-canary-20251216023757
|
|
14
|
+
- @lssm/module.audit-trail@0.0.0-canary-20251216023757
|
|
15
|
+
- @lssm/module.notifications@0.0.0-canary-20251216023757
|
package/dist/contracts/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{DealStatusFilterEnum as e}from"../deal/deal.enum.js";import{CreateDealInputModel as t,DealLostPayloadModel as n,DealModel as r,DealMovedPayloadModel as i,DealWonPayloadModel as a,ListDealsInputModel as o,ListDealsOutputModel as s,LoseDealInputModel as c,MoveDealInputModel as l,WinDealInputModel as u}from"../deal/deal.schema.js";import{CreateDealContract as d,ListDealsContract as f,LoseDealContract as p,MoveDealContract as m,WinDealContract as h}from"../deal/deal.contracts.js";import"../deal/index.js";export{d as CreateDealContract,t as CreateDealInputModel,n as DealLostPayloadModel,r as DealModel,i as DealMovedPayloadModel,e as DealStatusFilterEnum,a as DealWonPayloadModel,f as ListDealsContract,o as ListDealsInputModel,s as ListDealsOutputModel,p as LoseDealContract,c as LoseDealInputModel,m as MoveDealContract,l as MoveDealInputModel,h as WinDealContract,u as WinDealInputModel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CreateDealInputModel as e,DealLostPayloadModel as t,DealModel as n,DealMovedPayloadModel as r,DealWonPayloadModel as i,ListDealsInputModel as a,ListDealsOutputModel as o,LoseDealInputModel as s,MoveDealInputModel as c,WinDealInputModel as l}from"./deal.schema.js";import{defineCommand as u,defineQuery as d}from"@lssm/lib.contracts/spec";const f=[`@example.crm-pipeline`],p=u({meta:{name:`crm.deal.create`,version:1,stability:`stable`,owners:[...f],tags:[`crm`,`deal`,`create`],description:`Create a new deal in the pipeline.`,goal:`Allow sales reps to create new opportunities.`,context:`Deal creation UI, quick add.`},io:{input:e,output:n},policy:{auth:`user`},sideEffects:{emits:[{name:`deal.created`,version:1,when:`Deal is created`,payload:n}],audit:[`deal.created`]}}),m=u({meta:{name:`crm.deal.move`,version:1,stability:`stable`,owners:[...f],tags:[`crm`,`deal`,`move`,`kanban`],description:`Move a deal to a different stage.`,goal:`Allow drag-and-drop stage movement in Kanban.`,context:`Pipeline Kanban view.`},io:{input:c,output:n},policy:{auth:`user`},sideEffects:{emits:[{name:`deal.moved`,version:1,when:`Deal stage changed`,payload:r}],audit:[`deal.moved`]}}),h=u({meta:{name:`crm.deal.win`,version:1,stability:`stable`,owners:[...f],tags:[`crm`,`deal`,`won`],description:`Mark a deal as won.`,goal:`Close a deal as successful.`,context:`Deal closing flow.`},io:{input:l,output:n},policy:{auth:`user`},sideEffects:{emits:[{name:`deal.won`,version:1,when:`Deal is won`,payload:i}],audit:[`deal.won`]}}),g=u({meta:{name:`crm.deal.lose`,version:1,stability:`stable`,owners:[...f],tags:[`crm`,`deal`,`lost`],description:`Mark a deal as lost.`,goal:`Close a deal as unsuccessful.`,context:`Deal closing flow.`},io:{input:s,output:n},policy:{auth:`user`},sideEffects:{emits:[{name:`deal.lost`,version:1,when:`Deal is lost`,payload:t}],audit:[`deal.lost`]}}),_=d({meta:{name:`crm.deal.list`,version:1,stability:`stable`,owners:[...f],tags:[`crm`,`deal`,`list`],description:`List deals with filters.`,goal:`Show pipeline, deal lists, dashboards.`,context:`Pipeline view, deal list.`},io:{input:a,output:o},policy:{auth:`user`}});export{p as CreateDealContract,_ as ListDealsContract,g as LoseDealContract,m as MoveDealContract,h as WinDealContract};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineEnum as e}from"@lssm/lib.schema";const t=e(`DealStatus`,[`OPEN`,`WON`,`LOST`,`STALE`]),n=e(`DealStatusFilter`,[`OPEN`,`WON`,`LOST`,`all`]);export{t as DealStatusEnum,n as DealStatusFilterEnum};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DealStatusEnum as e,DealStatusFilterEnum as t}from"./deal.enum.js";import{ScalarTypeEnum as n,defineSchemaModel as r}from"@lssm/lib.schema";const i=r({name:`Deal`,description:`A deal in the CRM pipeline`,fields:{id:{type:n.String_unsecure(),isOptional:!1},name:{type:n.String_unsecure(),isOptional:!1},value:{type:n.Float_unsecure(),isOptional:!1},currency:{type:n.String_unsecure(),isOptional:!1},pipelineId:{type:n.String_unsecure(),isOptional:!1},stageId:{type:n.String_unsecure(),isOptional:!1},status:{type:e,isOptional:!1},contactId:{type:n.String_unsecure(),isOptional:!0},companyId:{type:n.String_unsecure(),isOptional:!0},ownerId:{type:n.String_unsecure(),isOptional:!1},expectedCloseDate:{type:n.DateTime(),isOptional:!0},createdAt:{type:n.DateTime(),isOptional:!1},updatedAt:{type:n.DateTime(),isOptional:!1}}}),a=r({name:`CreateDealInput`,description:`Input for creating a deal`,fields:{name:{type:n.NonEmptyString(),isOptional:!1},value:{type:n.Float_unsecure(),isOptional:!1},currency:{type:n.String_unsecure(),isOptional:!0},pipelineId:{type:n.String_unsecure(),isOptional:!1},stageId:{type:n.String_unsecure(),isOptional:!1},contactId:{type:n.String_unsecure(),isOptional:!0},companyId:{type:n.String_unsecure(),isOptional:!0},expectedCloseDate:{type:n.DateTime(),isOptional:!0}}}),o=r({name:`MoveDealInput`,description:`Input for moving a deal to another stage`,fields:{dealId:{type:n.String_unsecure(),isOptional:!1},stageId:{type:n.String_unsecure(),isOptional:!1},position:{type:n.Int_unsecure(),isOptional:!0}}}),s=r({name:`DealMovedPayload`,fields:{dealId:{type:n.String_unsecure(),isOptional:!1},fromStage:{type:n.String_unsecure(),isOptional:!1},toStage:{type:n.String_unsecure(),isOptional:!1}}}),c=r({name:`WinDealInput`,description:`Input for marking a deal as won`,fields:{dealId:{type:n.String_unsecure(),isOptional:!1},wonSource:{type:n.String_unsecure(),isOptional:!0},notes:{type:n.String_unsecure(),isOptional:!0}}}),l=r({name:`DealWonPayload`,fields:{dealId:{type:n.String_unsecure(),isOptional:!1},value:{type:n.Float_unsecure(),isOptional:!1}}}),u=r({name:`LoseDealInput`,description:`Input for marking a deal as lost`,fields:{dealId:{type:n.String_unsecure(),isOptional:!1},lostReason:{type:n.String_unsecure(),isOptional:!1},notes:{type:n.String_unsecure(),isOptional:!0}}}),d=r({name:`DealLostPayload`,fields:{dealId:{type:n.String_unsecure(),isOptional:!1},reason:{type:n.String_unsecure(),isOptional:!1}}}),f=r({name:`ListDealsInput`,description:`Input for listing deals`,fields:{pipelineId:{type:n.String_unsecure(),isOptional:!0},stageId:{type:n.String_unsecure(),isOptional:!0},status:{type:t,isOptional:!0},ownerId:{type:n.String_unsecure(),isOptional:!0},search:{type:n.String_unsecure(),isOptional:!0},limit:{type:n.Int_unsecure(),isOptional:!0,defaultValue:20},offset:{type:n.Int_unsecure(),isOptional:!0,defaultValue:0}}}),p=r({name:`ListDealsOutput`,description:`Output for listing deals`,fields:{deals:{type:i,isArray:!0,isOptional:!1},total:{type:n.Int_unsecure(),isOptional:!1},totalValue:{type:n.Float_unsecure(),isOptional:!1}}});export{a as CreateDealInputModel,d as DealLostPayloadModel,i as DealModel,s as DealMovedPayloadModel,l as DealWonPayloadModel,f as ListDealsInputModel,p as ListDealsOutputModel,u as LoseDealInputModel,o as MoveDealInputModel,c as WinDealInputModel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DealStatusEnum as e,DealStatusFilterEnum as t}from"./deal.enum.js";import{CreateDealInputModel as n,DealLostPayloadModel as r,DealModel as i,DealMovedPayloadModel as a,DealWonPayloadModel as o,ListDealsInputModel as s,ListDealsOutputModel as c,LoseDealInputModel as l,MoveDealInputModel as u,WinDealInputModel as d}from"./deal.schema.js";import{CreateDealContract as f,ListDealsContract as p,LoseDealContract as m,MoveDealContract as h,WinDealContract as g}from"./deal.contracts.js";export{f as CreateDealContract,n as CreateDealInputModel,r as DealLostPayloadModel,i as DealModel,a as DealMovedPayloadModel,e as DealStatusEnum,t as DealStatusFilterEnum,o as DealWonPayloadModel,p as ListDealsContract,s as ListDealsInputModel,c as ListDealsOutputModel,m as LoseDealContract,l as LoseDealInputModel,h as MoveDealContract,u as MoveDealInputModel,g as WinDealContract,d as WinDealInputModel};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CrmPipelineFeature as e}from"./crm-pipeline.feature.js";import t from"./example.js";import{CompanyEntity as n,CompanySizeEnum as r}from"./entities/company.entity.js";import{ContactEntity as i,ContactStatusEnum as a}from"./entities/contact.entity.js";import{DealEntity as o,DealStatusEnum as s,PipelineEntity as c,StageEntity as l}from"./entities/deal.entity.js";import{ActivityEntity as u,TaskEntity as d,TaskPriorityEnum as f,TaskStatusEnum as p,TaskTypeEnum as m}from"./entities/task.entity.js";import{crmPipelineSchemaContribution as h}from"./entities/index.js";import{
|
|
1
|
+
import{CrmPipelineFeature as e}from"./crm-pipeline.feature.js";import t from"./example.js";import{CompanyEntity as n,CompanySizeEnum as r}from"./entities/company.entity.js";import{ContactEntity as i,ContactStatusEnum as a}from"./entities/contact.entity.js";import{DealEntity as o,DealStatusEnum as s,PipelineEntity as c,StageEntity as l}from"./entities/deal.entity.js";import{ActivityEntity as u,TaskEntity as d,TaskPriorityEnum as f,TaskStatusEnum as p,TaskTypeEnum as m}from"./entities/task.entity.js";import{crmPipelineSchemaContribution as h}from"./entities/index.js";import{DealStatusFilterEnum as g}from"./deal/deal.enum.js";import{CreateDealInputModel as _,DealLostPayloadModel as v,DealModel as y,DealMovedPayloadModel as b,DealWonPayloadModel as x,ListDealsInputModel as S,ListDealsOutputModel as C,LoseDealInputModel as w,MoveDealInputModel as T,WinDealInputModel as E}from"./deal/deal.schema.js";import{CreateDealContract as D,ListDealsContract as O,LoseDealContract as k,MoveDealContract as ee,WinDealContract as A}from"./deal/deal.contracts.js";import"./contracts/index.js";import{ContactCreatedEvent as j}from"./events/contact.event.js";import{DealCreatedEvent as M,DealLostEvent as N,DealMovedEvent as P,DealWonEvent as F}from"./events/deal.event.js";import{TaskCompletedEvent as I}from"./events/task.event.js";import"./events/index.js";import{MOCK_COMPANIES as L,MOCK_CONTACTS as R,MOCK_DEALS as z,MOCK_STAGES as B}from"./handlers/mock-data.js";import{mockCreateDealHandler as V,mockGetDealsByStageHandler as H,mockGetPipelineStagesHandler as U,mockListDealsHandler as W,mockLoseDealHandler as G,mockMoveDealHandler as K,mockWinDealHandler as q}from"./handlers/deal.handlers.js";import{CrmDashboardPresentation as J,PipelineMetricsPresentation as Y}from"./presentations/dashboard.presentation.js";import{DealCardPresentation as X,DealDetailPresentation as Z,DealListPresentation as Q,PipelineKanbanPresentation as $}from"./presentations/pipeline.presentation.js";import"./presentations/index.js";import"./docs/index.js";import{identityRbacSchemaContribution as te}from"@lssm/lib.identity-rbac";import{auditTrailSchemaContribution as ne}from"@lssm/module.audit-trail";import{notificationsSchemaContribution as re}from"@lssm/module.notifications";const ie={modules:[te,ne,re,h],provider:`postgresql`,outputPath:`./prisma/schema/generated.prisma`};export{u as ActivityEntity,n as CompanyEntity,r as CompanySizeEnum,j as ContactCreatedEvent,i as ContactEntity,a as ContactStatusEnum,D as CreateDealContract,_ as CreateDealInputModel,J as CrmDashboardPresentation,e as CrmPipelineFeature,X as DealCardPresentation,M as DealCreatedEvent,Z as DealDetailPresentation,o as DealEntity,Q as DealListPresentation,N as DealLostEvent,v as DealLostPayloadModel,y as DealModel,P as DealMovedEvent,b as DealMovedPayloadModel,s as DealStatusEnum,g as DealStatusFilterEnum,F as DealWonEvent,x as DealWonPayloadModel,O as ListDealsContract,S as ListDealsInputModel,C as ListDealsOutputModel,k as LoseDealContract,w as LoseDealInputModel,L as MOCK_COMPANIES,R as MOCK_CONTACTS,z as MOCK_DEALS,B as MOCK_STAGES,ee as MoveDealContract,T as MoveDealInputModel,c as PipelineEntity,$ as PipelineKanbanPresentation,Y as PipelineMetricsPresentation,l as StageEntity,I as TaskCompletedEvent,d as TaskEntity,f as TaskPriorityEnum,p as TaskStatusEnum,m as TaskTypeEnum,A as WinDealContract,E as WinDealInputModel,h as crmPipelineSchemaContribution,t as example,V as mockCreateDealHandler,H as mockGetDealsByStageHandler,U as mockGetPipelineStagesHandler,W as mockListDealsHandler,G as mockLoseDealHandler,K as mockMoveDealHandler,q as mockWinDealHandler,ie as schemaComposition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DealModel as e}from"../
|
|
1
|
+
import{DealModel as e}from"../deal/deal.schema.js";const t={meta:{name:`crm.pipeline.kanban`,version:1,description:`Kanban board view of deals organized by stage`,domain:`crm-pipeline`,owners:[`crm-team`],tags:[`pipeline`,`kanban`,`deals`]},source:{type:`component`,framework:`react`,componentKey:`PipelineKanbanView`,props:e},targets:[`react`,`markdown`],policy:{flags:[`crm.pipeline.enabled`]}},n={meta:{name:`crm.deal.list`,version:1,description:`List view of deals with value, status, and owner info`,domain:`crm-pipeline`,owners:[`crm-team`],tags:[`deal`,`list`]},source:{type:`component`,framework:`react`,componentKey:`DealListView`,props:e},targets:[`react`,`markdown`,`application/json`],policy:{flags:[`crm.deals.enabled`]}},r={meta:{name:`crm.deal.detail`,version:1,description:`Detailed view of a deal with activities, contacts, and history`,domain:`crm-pipeline`,owners:[`crm-team`],tags:[`deal`,`detail`]},source:{type:`component`,framework:`react`,componentKey:`DealDetailView`},targets:[`react`,`markdown`],policy:{flags:[`crm.deals.enabled`]}},i={meta:{name:`crm.deal.card`,version:1,description:`Compact deal card for kanban board display`,domain:`crm-pipeline`,owners:[`crm-team`],tags:[`deal`,`card`,`kanban`]},source:{type:`component`,framework:`react`,componentKey:`DealCard`,props:e},targets:[`react`],policy:{flags:[`crm.deals.enabled`]}};export{i as DealCardPresentation,r as DealDetailPresentation,n as DealListPresentation,t as PipelineKanbanPresentation};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/example.crm-pipeline",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251216023757",
|
|
4
4
|
"description": "CRM Pipeline - Contacts, Companies, Deals, Tasks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./src/index.ts",
|
|
10
10
|
"./contracts": "./src/contracts/index.ts",
|
|
11
|
-
"./contracts/deal.contracts": "./src/contracts/deal.contracts.ts",
|
|
12
11
|
"./crm-pipeline.feature": "./src/crm-pipeline.feature.ts",
|
|
12
|
+
"./deal": "./src/deal/index.ts",
|
|
13
|
+
"./deal/deal.contracts": "./src/deal/deal.contracts.ts",
|
|
14
|
+
"./deal/deal.enum": "./src/deal/deal.enum.ts",
|
|
15
|
+
"./deal/deal.schema": "./src/deal/deal.schema.ts",
|
|
13
16
|
"./docs": "./src/docs/index.ts",
|
|
14
17
|
"./docs/crm-pipeline.docblock": "./src/docs/crm-pipeline.docblock.ts",
|
|
15
18
|
"./entities": "./src/entities/index.ts",
|
|
@@ -62,8 +65,11 @@
|
|
|
62
65
|
"exports": {
|
|
63
66
|
".": "./dist/index.js",
|
|
64
67
|
"./contracts": "./dist/contracts/index.js",
|
|
65
|
-
"./contracts/deal.contracts": "./dist/contracts/deal.contracts.js",
|
|
66
68
|
"./crm-pipeline.feature": "./dist/crm-pipeline.feature.js",
|
|
69
|
+
"./deal": "./dist/deal/index.js",
|
|
70
|
+
"./deal/deal.contracts": "./dist/deal/deal.contracts.js",
|
|
71
|
+
"./deal/deal.enum": "./dist/deal/deal.enum.js",
|
|
72
|
+
"./deal/deal.schema": "./dist/deal/deal.schema.js",
|
|
67
73
|
"./docs": "./dist/docs/index.js",
|
|
68
74
|
"./docs/crm-pipeline.docblock": "./dist/docs/crm-pipeline.docblock.js",
|
|
69
75
|
"./entities": "./dist/entities/index.js",
|
package/src/contracts/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// Deal contracts and models
|
|
1
|
+
// Deal contracts and models - re-exports from deal domain
|
|
2
|
+
// Note: DealStatusEnum is exported from entities, not here (to avoid conflict)
|
|
2
3
|
export {
|
|
3
4
|
DealStatusFilterEnum,
|
|
4
5
|
DealModel,
|
|
@@ -16,4 +17,4 @@ export {
|
|
|
16
17
|
WinDealContract,
|
|
17
18
|
LoseDealContract,
|
|
18
19
|
ListDealsContract,
|
|
19
|
-
} from '
|
|
20
|
+
} from '../deal';
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { defineCommand, defineQuery } from '@lssm/lib.contracts/spec';
|
|
2
|
+
import {
|
|
3
|
+
DealModel,
|
|
4
|
+
CreateDealInputModel,
|
|
5
|
+
MoveDealInputModel,
|
|
6
|
+
DealMovedPayloadModel,
|
|
7
|
+
WinDealInputModel,
|
|
8
|
+
DealWonPayloadModel,
|
|
9
|
+
LoseDealInputModel,
|
|
10
|
+
DealLostPayloadModel,
|
|
11
|
+
ListDealsInputModel,
|
|
12
|
+
ListDealsOutputModel,
|
|
13
|
+
} from './deal.schema';
|
|
14
|
+
|
|
15
|
+
const OWNERS = ['@example.crm-pipeline'] as const;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Create a new deal.
|
|
19
|
+
*/
|
|
20
|
+
export const CreateDealContract = defineCommand({
|
|
21
|
+
meta: {
|
|
22
|
+
name: 'crm.deal.create',
|
|
23
|
+
version: 1,
|
|
24
|
+
stability: 'stable',
|
|
25
|
+
owners: [...OWNERS],
|
|
26
|
+
tags: ['crm', 'deal', 'create'],
|
|
27
|
+
description: 'Create a new deal in the pipeline.',
|
|
28
|
+
goal: 'Allow sales reps to create new opportunities.',
|
|
29
|
+
context: 'Deal creation UI, quick add.',
|
|
30
|
+
},
|
|
31
|
+
io: {
|
|
32
|
+
input: CreateDealInputModel,
|
|
33
|
+
output: DealModel,
|
|
34
|
+
},
|
|
35
|
+
policy: {
|
|
36
|
+
auth: 'user',
|
|
37
|
+
},
|
|
38
|
+
sideEffects: {
|
|
39
|
+
emits: [
|
|
40
|
+
{
|
|
41
|
+
name: 'deal.created',
|
|
42
|
+
version: 1,
|
|
43
|
+
when: 'Deal is created',
|
|
44
|
+
payload: DealModel,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
audit: ['deal.created'],
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Move deal to a different stage.
|
|
53
|
+
*/
|
|
54
|
+
export const MoveDealContract = defineCommand({
|
|
55
|
+
meta: {
|
|
56
|
+
name: 'crm.deal.move',
|
|
57
|
+
version: 1,
|
|
58
|
+
stability: 'stable',
|
|
59
|
+
owners: [...OWNERS],
|
|
60
|
+
tags: ['crm', 'deal', 'move', 'kanban'],
|
|
61
|
+
description: 'Move a deal to a different stage.',
|
|
62
|
+
goal: 'Allow drag-and-drop stage movement in Kanban.',
|
|
63
|
+
context: 'Pipeline Kanban view.',
|
|
64
|
+
},
|
|
65
|
+
io: {
|
|
66
|
+
input: MoveDealInputModel,
|
|
67
|
+
output: DealModel,
|
|
68
|
+
},
|
|
69
|
+
policy: {
|
|
70
|
+
auth: 'user',
|
|
71
|
+
},
|
|
72
|
+
sideEffects: {
|
|
73
|
+
emits: [
|
|
74
|
+
{
|
|
75
|
+
name: 'deal.moved',
|
|
76
|
+
version: 1,
|
|
77
|
+
when: 'Deal stage changed',
|
|
78
|
+
payload: DealMovedPayloadModel,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
audit: ['deal.moved'],
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Mark deal as won.
|
|
87
|
+
*/
|
|
88
|
+
export const WinDealContract = defineCommand({
|
|
89
|
+
meta: {
|
|
90
|
+
name: 'crm.deal.win',
|
|
91
|
+
version: 1,
|
|
92
|
+
stability: 'stable',
|
|
93
|
+
owners: [...OWNERS],
|
|
94
|
+
tags: ['crm', 'deal', 'won'],
|
|
95
|
+
description: 'Mark a deal as won.',
|
|
96
|
+
goal: 'Close a deal as successful.',
|
|
97
|
+
context: 'Deal closing flow.',
|
|
98
|
+
},
|
|
99
|
+
io: {
|
|
100
|
+
input: WinDealInputModel,
|
|
101
|
+
output: DealModel,
|
|
102
|
+
},
|
|
103
|
+
policy: {
|
|
104
|
+
auth: 'user',
|
|
105
|
+
},
|
|
106
|
+
sideEffects: {
|
|
107
|
+
emits: [
|
|
108
|
+
{
|
|
109
|
+
name: 'deal.won',
|
|
110
|
+
version: 1,
|
|
111
|
+
when: 'Deal is won',
|
|
112
|
+
payload: DealWonPayloadModel,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
audit: ['deal.won'],
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Mark deal as lost.
|
|
121
|
+
*/
|
|
122
|
+
export const LoseDealContract = defineCommand({
|
|
123
|
+
meta: {
|
|
124
|
+
name: 'crm.deal.lose',
|
|
125
|
+
version: 1,
|
|
126
|
+
stability: 'stable',
|
|
127
|
+
owners: [...OWNERS],
|
|
128
|
+
tags: ['crm', 'deal', 'lost'],
|
|
129
|
+
description: 'Mark a deal as lost.',
|
|
130
|
+
goal: 'Close a deal as unsuccessful.',
|
|
131
|
+
context: 'Deal closing flow.',
|
|
132
|
+
},
|
|
133
|
+
io: {
|
|
134
|
+
input: LoseDealInputModel,
|
|
135
|
+
output: DealModel,
|
|
136
|
+
},
|
|
137
|
+
policy: {
|
|
138
|
+
auth: 'user',
|
|
139
|
+
},
|
|
140
|
+
sideEffects: {
|
|
141
|
+
emits: [
|
|
142
|
+
{
|
|
143
|
+
name: 'deal.lost',
|
|
144
|
+
version: 1,
|
|
145
|
+
when: 'Deal is lost',
|
|
146
|
+
payload: DealLostPayloadModel,
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
audit: ['deal.lost'],
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* List deals in pipeline.
|
|
155
|
+
*/
|
|
156
|
+
export const ListDealsContract = defineQuery({
|
|
157
|
+
meta: {
|
|
158
|
+
name: 'crm.deal.list',
|
|
159
|
+
version: 1,
|
|
160
|
+
stability: 'stable',
|
|
161
|
+
owners: [...OWNERS],
|
|
162
|
+
tags: ['crm', 'deal', 'list'],
|
|
163
|
+
description: 'List deals with filters.',
|
|
164
|
+
goal: 'Show pipeline, deal lists, dashboards.',
|
|
165
|
+
context: 'Pipeline view, deal list.',
|
|
166
|
+
},
|
|
167
|
+
io: {
|
|
168
|
+
input: ListDealsInputModel,
|
|
169
|
+
output: ListDealsOutputModel,
|
|
170
|
+
},
|
|
171
|
+
policy: {
|
|
172
|
+
auth: 'user',
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineEnum } from '@lssm/lib.schema';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Deal status enum.
|
|
5
|
+
*/
|
|
6
|
+
export const DealStatusEnum = defineEnum('DealStatus', [
|
|
7
|
+
'OPEN',
|
|
8
|
+
'WON',
|
|
9
|
+
'LOST',
|
|
10
|
+
'STALE',
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Deal status filter enum.
|
|
15
|
+
*/
|
|
16
|
+
export const DealStatusFilterEnum = defineEnum('DealStatusFilter', [
|
|
17
|
+
'OPEN',
|
|
18
|
+
'WON',
|
|
19
|
+
'LOST',
|
|
20
|
+
'all',
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
|
|
@@ -1,29 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
defineSchemaModel,
|
|
4
|
-
ScalarTypeEnum,
|
|
5
|
-
defineEnum,
|
|
6
|
-
} from '@lssm/lib.schema';
|
|
7
|
-
|
|
8
|
-
const OWNERS = ['example.crm-pipeline'] as const;
|
|
9
|
-
|
|
10
|
-
// ============ Enums ============
|
|
11
|
-
|
|
12
|
-
const DealStatusSchemaEnum = defineEnum('DealStatus', [
|
|
13
|
-
'OPEN',
|
|
14
|
-
'WON',
|
|
15
|
-
'LOST',
|
|
16
|
-
'STALE',
|
|
17
|
-
]);
|
|
18
|
-
export const DealStatusFilterEnum = defineEnum('DealStatusFilter', [
|
|
19
|
-
'OPEN',
|
|
20
|
-
'WON',
|
|
21
|
-
'LOST',
|
|
22
|
-
'all',
|
|
23
|
-
]);
|
|
24
|
-
|
|
25
|
-
// ============ Schemas ============
|
|
1
|
+
import { defineSchemaModel, ScalarTypeEnum } from '@lssm/lib.schema';
|
|
2
|
+
import { DealStatusEnum, DealStatusFilterEnum } from './deal.enum';
|
|
26
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A deal in the CRM pipeline.
|
|
6
|
+
*/
|
|
27
7
|
export const DealModel = defineSchemaModel({
|
|
28
8
|
name: 'Deal',
|
|
29
9
|
description: 'A deal in the CRM pipeline',
|
|
@@ -34,7 +14,7 @@ export const DealModel = defineSchemaModel({
|
|
|
34
14
|
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
35
15
|
pipelineId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
36
16
|
stageId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
37
|
-
status: { type:
|
|
17
|
+
status: { type: DealStatusEnum, isOptional: false },
|
|
38
18
|
contactId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
39
19
|
companyId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
40
20
|
ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
@@ -44,6 +24,9 @@ export const DealModel = defineSchemaModel({
|
|
|
44
24
|
},
|
|
45
25
|
});
|
|
46
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Input for creating a deal.
|
|
29
|
+
*/
|
|
47
30
|
export const CreateDealInputModel = defineSchemaModel({
|
|
48
31
|
name: 'CreateDealInput',
|
|
49
32
|
description: 'Input for creating a deal',
|
|
@@ -59,6 +42,9 @@ export const CreateDealInputModel = defineSchemaModel({
|
|
|
59
42
|
},
|
|
60
43
|
});
|
|
61
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Input for moving a deal to another stage.
|
|
47
|
+
*/
|
|
62
48
|
export const MoveDealInputModel = defineSchemaModel({
|
|
63
49
|
name: 'MoveDealInput',
|
|
64
50
|
description: 'Input for moving a deal to another stage',
|
|
@@ -69,6 +55,9 @@ export const MoveDealInputModel = defineSchemaModel({
|
|
|
69
55
|
},
|
|
70
56
|
});
|
|
71
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Payload for deal moved event.
|
|
60
|
+
*/
|
|
72
61
|
export const DealMovedPayloadModel = defineSchemaModel({
|
|
73
62
|
name: 'DealMovedPayload',
|
|
74
63
|
fields: {
|
|
@@ -78,6 +67,9 @@ export const DealMovedPayloadModel = defineSchemaModel({
|
|
|
78
67
|
},
|
|
79
68
|
});
|
|
80
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Input for marking a deal as won.
|
|
72
|
+
*/
|
|
81
73
|
export const WinDealInputModel = defineSchemaModel({
|
|
82
74
|
name: 'WinDealInput',
|
|
83
75
|
description: 'Input for marking a deal as won',
|
|
@@ -88,6 +80,9 @@ export const WinDealInputModel = defineSchemaModel({
|
|
|
88
80
|
},
|
|
89
81
|
});
|
|
90
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Payload for deal won event.
|
|
85
|
+
*/
|
|
91
86
|
export const DealWonPayloadModel = defineSchemaModel({
|
|
92
87
|
name: 'DealWonPayload',
|
|
93
88
|
fields: {
|
|
@@ -96,6 +91,9 @@ export const DealWonPayloadModel = defineSchemaModel({
|
|
|
96
91
|
},
|
|
97
92
|
});
|
|
98
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Input for marking a deal as lost.
|
|
96
|
+
*/
|
|
99
97
|
export const LoseDealInputModel = defineSchemaModel({
|
|
100
98
|
name: 'LoseDealInput',
|
|
101
99
|
description: 'Input for marking a deal as lost',
|
|
@@ -106,6 +104,9 @@ export const LoseDealInputModel = defineSchemaModel({
|
|
|
106
104
|
},
|
|
107
105
|
});
|
|
108
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Payload for deal lost event.
|
|
109
|
+
*/
|
|
109
110
|
export const DealLostPayloadModel = defineSchemaModel({
|
|
110
111
|
name: 'DealLostPayload',
|
|
111
112
|
fields: {
|
|
@@ -114,6 +115,9 @@ export const DealLostPayloadModel = defineSchemaModel({
|
|
|
114
115
|
},
|
|
115
116
|
});
|
|
116
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Input for listing deals.
|
|
120
|
+
*/
|
|
117
121
|
export const ListDealsInputModel = defineSchemaModel({
|
|
118
122
|
name: 'ListDealsInput',
|
|
119
123
|
description: 'Input for listing deals',
|
|
@@ -136,6 +140,9 @@ export const ListDealsInputModel = defineSchemaModel({
|
|
|
136
140
|
},
|
|
137
141
|
});
|
|
138
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Output for listing deals.
|
|
145
|
+
*/
|
|
139
146
|
export const ListDealsOutputModel = defineSchemaModel({
|
|
140
147
|
name: 'ListDealsOutput',
|
|
141
148
|
description: 'Output for listing deals',
|
|
@@ -146,163 +153,4 @@ export const ListDealsOutputModel = defineSchemaModel({
|
|
|
146
153
|
},
|
|
147
154
|
});
|
|
148
155
|
|
|
149
|
-
// ============ Contracts ============
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Create a new deal.
|
|
153
|
-
*/
|
|
154
|
-
export const CreateDealContract = defineCommand({
|
|
155
|
-
meta: {
|
|
156
|
-
name: 'crm.deal.create',
|
|
157
|
-
version: 1,
|
|
158
|
-
stability: 'stable',
|
|
159
|
-
owners: [...OWNERS],
|
|
160
|
-
tags: ['crm', 'deal', 'create'],
|
|
161
|
-
description: 'Create a new deal in the pipeline.',
|
|
162
|
-
goal: 'Allow sales reps to create new opportunities.',
|
|
163
|
-
context: 'Deal creation UI, quick add.',
|
|
164
|
-
},
|
|
165
|
-
io: {
|
|
166
|
-
input: CreateDealInputModel,
|
|
167
|
-
output: DealModel,
|
|
168
|
-
},
|
|
169
|
-
policy: {
|
|
170
|
-
auth: 'user',
|
|
171
|
-
},
|
|
172
|
-
sideEffects: {
|
|
173
|
-
emits: [
|
|
174
|
-
{
|
|
175
|
-
name: 'deal.created',
|
|
176
|
-
version: 1,
|
|
177
|
-
when: 'Deal is created',
|
|
178
|
-
payload: DealModel,
|
|
179
|
-
},
|
|
180
|
-
],
|
|
181
|
-
audit: ['deal.created'],
|
|
182
|
-
},
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Move deal to a different stage.
|
|
187
|
-
*/
|
|
188
|
-
export const MoveDealContract = defineCommand({
|
|
189
|
-
meta: {
|
|
190
|
-
name: 'crm.deal.move',
|
|
191
|
-
version: 1,
|
|
192
|
-
stability: 'stable',
|
|
193
|
-
owners: [...OWNERS],
|
|
194
|
-
tags: ['crm', 'deal', 'move', 'kanban'],
|
|
195
|
-
description: 'Move a deal to a different stage.',
|
|
196
|
-
goal: 'Allow drag-and-drop stage movement in Kanban.',
|
|
197
|
-
context: 'Pipeline Kanban view.',
|
|
198
|
-
},
|
|
199
|
-
io: {
|
|
200
|
-
input: MoveDealInputModel,
|
|
201
|
-
output: DealModel,
|
|
202
|
-
},
|
|
203
|
-
policy: {
|
|
204
|
-
auth: 'user',
|
|
205
|
-
},
|
|
206
|
-
sideEffects: {
|
|
207
|
-
emits: [
|
|
208
|
-
{
|
|
209
|
-
name: 'deal.moved',
|
|
210
|
-
version: 1,
|
|
211
|
-
when: 'Deal stage changed',
|
|
212
|
-
payload: DealMovedPayloadModel,
|
|
213
|
-
},
|
|
214
|
-
],
|
|
215
|
-
audit: ['deal.moved'],
|
|
216
|
-
},
|
|
217
|
-
});
|
|
218
156
|
|
|
219
|
-
/**
|
|
220
|
-
* Mark deal as won.
|
|
221
|
-
*/
|
|
222
|
-
export const WinDealContract = defineCommand({
|
|
223
|
-
meta: {
|
|
224
|
-
name: 'crm.deal.win',
|
|
225
|
-
version: 1,
|
|
226
|
-
stability: 'stable',
|
|
227
|
-
owners: [...OWNERS],
|
|
228
|
-
tags: ['crm', 'deal', 'won'],
|
|
229
|
-
description: 'Mark a deal as won.',
|
|
230
|
-
goal: 'Close a deal as successful.',
|
|
231
|
-
context: 'Deal closing flow.',
|
|
232
|
-
},
|
|
233
|
-
io: {
|
|
234
|
-
input: WinDealInputModel,
|
|
235
|
-
output: DealModel,
|
|
236
|
-
},
|
|
237
|
-
policy: {
|
|
238
|
-
auth: 'user',
|
|
239
|
-
},
|
|
240
|
-
sideEffects: {
|
|
241
|
-
emits: [
|
|
242
|
-
{
|
|
243
|
-
name: 'deal.won',
|
|
244
|
-
version: 1,
|
|
245
|
-
when: 'Deal is won',
|
|
246
|
-
payload: DealWonPayloadModel,
|
|
247
|
-
},
|
|
248
|
-
],
|
|
249
|
-
audit: ['deal.won'],
|
|
250
|
-
},
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Mark deal as lost.
|
|
255
|
-
*/
|
|
256
|
-
export const LoseDealContract = defineCommand({
|
|
257
|
-
meta: {
|
|
258
|
-
name: 'crm.deal.lose',
|
|
259
|
-
version: 1,
|
|
260
|
-
stability: 'stable',
|
|
261
|
-
owners: [...OWNERS],
|
|
262
|
-
tags: ['crm', 'deal', 'lost'],
|
|
263
|
-
description: 'Mark a deal as lost.',
|
|
264
|
-
goal: 'Close a deal as unsuccessful.',
|
|
265
|
-
context: 'Deal closing flow.',
|
|
266
|
-
},
|
|
267
|
-
io: {
|
|
268
|
-
input: LoseDealInputModel,
|
|
269
|
-
output: DealModel,
|
|
270
|
-
},
|
|
271
|
-
policy: {
|
|
272
|
-
auth: 'user',
|
|
273
|
-
},
|
|
274
|
-
sideEffects: {
|
|
275
|
-
emits: [
|
|
276
|
-
{
|
|
277
|
-
name: 'deal.lost',
|
|
278
|
-
version: 1,
|
|
279
|
-
when: 'Deal is lost',
|
|
280
|
-
payload: DealLostPayloadModel,
|
|
281
|
-
},
|
|
282
|
-
],
|
|
283
|
-
audit: ['deal.lost'],
|
|
284
|
-
},
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* List deals in pipeline.
|
|
289
|
-
*/
|
|
290
|
-
export const ListDealsContract = defineQuery({
|
|
291
|
-
meta: {
|
|
292
|
-
name: 'crm.deal.list',
|
|
293
|
-
version: 1,
|
|
294
|
-
stability: 'stable',
|
|
295
|
-
owners: [...OWNERS],
|
|
296
|
-
tags: ['crm', 'deal', 'list'],
|
|
297
|
-
description: 'List deals with filters.',
|
|
298
|
-
goal: 'Show pipeline, deal lists, dashboards.',
|
|
299
|
-
context: 'Pipeline view, deal list.',
|
|
300
|
-
},
|
|
301
|
-
io: {
|
|
302
|
-
input: ListDealsInputModel,
|
|
303
|
-
output: ListDealsOutputModel,
|
|
304
|
-
},
|
|
305
|
-
policy: {
|
|
306
|
-
auth: 'user',
|
|
307
|
-
},
|
|
308
|
-
});
|