@contractspec/example.service-business-os 1.56.1 → 1.58.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.
- package/dist/browser/client/client.operations.js +72 -0
- package/dist/browser/client/client.schema.js +31 -0
- package/dist/browser/client/index.js +74 -0
- package/dist/browser/docs/index.js +96 -0
- package/dist/browser/docs/service-business-os.docblock.js +96 -0
- package/dist/browser/entities/index.js +246 -0
- package/dist/browser/events.js +135 -0
- package/dist/browser/example.js +39 -0
- package/dist/browser/handlers/index.js +5 -0
- package/dist/browser/index.js +752 -0
- package/dist/browser/invoice/index.js +77 -0
- package/dist/browser/invoice/invoice.operations.js +75 -0
- package/dist/browser/invoice/invoice.schema.js +34 -0
- package/dist/browser/job/index.js +175 -0
- package/dist/browser/job/job.operations.js +172 -0
- package/dist/browser/job/job.schema.js +41 -0
- package/dist/browser/operations/index.js +506 -0
- package/dist/browser/payment/index.js +69 -0
- package/dist/browser/payment/payment.operations.js +67 -0
- package/dist/browser/payment/payment.schema.js +30 -0
- package/dist/browser/presentations/index.js +13 -0
- package/dist/browser/presentations.js +172 -0
- package/dist/browser/quote/index.js +122 -0
- package/dist/browser/quote/quote.operations.js +119 -0
- package/dist/browser/quote/quote.schema.js +45 -0
- package/dist/browser/service-business-os.capability.js +28 -0
- package/dist/browser/service.feature.js +74 -0
- package/dist/client/client.operations.d.ts +54 -60
- package/dist/client/client.operations.d.ts.map +1 -1
- package/dist/client/client.operations.js +71 -51
- package/dist/client/client.schema.d.ts +54 -59
- package/dist/client/client.schema.d.ts.map +1 -1
- package/dist/client/client.schema.js +30 -75
- package/dist/client/index.d.ts +6 -3
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +74 -3
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +97 -1
- package/dist/docs/service-business-os.docblock.d.ts +2 -1
- package/dist/docs/service-business-os.docblock.d.ts.map +1 -0
- package/dist/docs/service-business-os.docblock.js +52 -64
- package/dist/entities/index.d.ts +156 -161
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +236 -278
- package/dist/events.d.ts +253 -259
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +123 -217
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +37 -50
- package/dist/handlers/index.d.ts +11 -16
- package/dist/handlers/index.d.ts.map +1 -1
- package/dist/handlers/index.js +5 -5
- package/dist/index.d.ts +13 -18
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +752 -18
- package/dist/invoice/index.d.ts +6 -3
- package/dist/invoice/index.d.ts.map +1 -0
- package/dist/invoice/index.js +77 -3
- package/dist/invoice/invoice.operations.d.ts +54 -60
- package/dist/invoice/invoice.operations.d.ts.map +1 -1
- package/dist/invoice/invoice.operations.js +74 -55
- package/dist/invoice/invoice.schema.d.ts +54 -59
- package/dist/invoice/invoice.schema.d.ts.map +1 -1
- package/dist/invoice/invoice.schema.js +33 -75
- package/dist/job/index.d.ts +6 -3
- package/dist/job/index.d.ts.map +1 -0
- package/dist/job/index.js +175 -3
- package/dist/job/job.operations.d.ts +220 -226
- package/dist/job/job.operations.d.ts.map +1 -1
- package/dist/job/job.operations.js +167 -169
- package/dist/job/job.schema.d.ts +67 -72
- package/dist/job/job.schema.d.ts.map +1 -1
- package/dist/job/job.schema.js +39 -95
- package/dist/node/client/client.operations.js +72 -0
- package/dist/node/client/client.schema.js +31 -0
- package/dist/node/client/index.js +74 -0
- package/dist/node/docs/index.js +96 -0
- package/dist/node/docs/service-business-os.docblock.js +96 -0
- package/dist/node/entities/index.js +246 -0
- package/dist/node/events.js +135 -0
- package/dist/node/example.js +39 -0
- package/dist/node/handlers/index.js +5 -0
- package/dist/node/index.js +752 -0
- package/dist/node/invoice/index.js +77 -0
- package/dist/node/invoice/invoice.operations.js +75 -0
- package/dist/node/invoice/invoice.schema.js +34 -0
- package/dist/node/job/index.js +175 -0
- package/dist/node/job/job.operations.js +172 -0
- package/dist/node/job/job.schema.js +41 -0
- package/dist/node/operations/index.js +506 -0
- package/dist/node/payment/index.js +69 -0
- package/dist/node/payment/payment.operations.js +67 -0
- package/dist/node/payment/payment.schema.js +30 -0
- package/dist/node/presentations/index.js +13 -0
- package/dist/node/presentations.js +172 -0
- package/dist/node/quote/index.js +122 -0
- package/dist/node/quote/quote.operations.js +119 -0
- package/dist/node/quote/quote.schema.js +45 -0
- package/dist/node/service-business-os.capability.js +28 -0
- package/dist/node/service.feature.js +74 -0
- package/dist/operations/index.d.ts +6 -16
- package/dist/operations/index.d.ts.map +1 -0
- package/dist/operations/index.js +506 -16
- package/dist/payment/index.d.ts +6 -3
- package/dist/payment/index.d.ts.map +1 -0
- package/dist/payment/index.js +69 -3
- package/dist/payment/payment.operations.d.ts +50 -56
- package/dist/payment/payment.operations.d.ts.map +1 -1
- package/dist/payment/payment.operations.js +66 -51
- package/dist/payment/payment.schema.d.ts +50 -55
- package/dist/payment/payment.schema.d.ts.map +1 -1
- package/dist/payment/payment.schema.js +29 -71
- package/dist/presentations/index.d.ts +1 -4
- package/dist/presentations/index.d.ts.map +1 -1
- package/dist/presentations/index.js +13 -17
- package/dist/presentations.d.ts +7 -12
- package/dist/presentations.d.ts.map +1 -1
- package/dist/presentations.js +166 -172
- package/dist/quote/index.d.ts +6 -3
- package/dist/quote/index.d.ts.map +1 -0
- package/dist/quote/index.js +122 -3
- package/dist/quote/quote.operations.d.ts +120 -126
- package/dist/quote/quote.operations.d.ts.map +1 -1
- package/dist/quote/quote.operations.js +117 -96
- package/dist/quote/quote.schema.d.ts +83 -88
- package/dist/quote/quote.schema.d.ts.map +1 -1
- package/dist/quote/quote.schema.js +43 -111
- package/dist/service-business-os.capability.d.ts +2 -7
- package/dist/service-business-os.capability.d.ts.map +1 -1
- package/dist/service-business-os.capability.js +29 -29
- package/dist/service.feature.d.ts +1 -6
- package/dist/service.feature.d.ts.map +1 -1
- package/dist/service.feature.js +73 -164
- package/package.json +301 -64
- package/dist/client/client.operations.js.map +0 -1
- package/dist/client/client.schema.js.map +0 -1
- package/dist/docs/service-business-os.docblock.js.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/events.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/index.js.map +0 -1
- package/dist/invoice/invoice.operations.js.map +0 -1
- package/dist/invoice/invoice.schema.js.map +0 -1
- package/dist/job/job.operations.js.map +0 -1
- package/dist/job/job.schema.js.map +0 -1
- package/dist/payment/payment.operations.js.map +0 -1
- package/dist/payment/payment.schema.js.map +0 -1
- package/dist/presentations/index.js.map +0 -1
- package/dist/presentations.js.map +0 -1
- package/dist/quote/quote.operations.js.map +0 -1
- package/dist/quote/quote.schema.js.map +0 -1
- package/dist/service-business-os.capability.js.map +0 -1
- package/dist/service.feature.js.map +0 -1
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// src/presentations.ts
|
|
2
|
+
import { definePresentation, StabilityEnum } from "@contractspec/lib.contracts";
|
|
3
|
+
var ServiceDashboardPresentation = definePresentation({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "service-business-os.dashboard",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
title: "Service Dashboard",
|
|
8
|
+
description: "Service business dashboard with overview metrics",
|
|
9
|
+
domain: "services",
|
|
10
|
+
owners: ["@service-os"],
|
|
11
|
+
tags: ["services", "dashboard"],
|
|
12
|
+
stability: StabilityEnum.Experimental,
|
|
13
|
+
goal: "Overview of service business metrics",
|
|
14
|
+
context: "Service home page"
|
|
15
|
+
},
|
|
16
|
+
source: {
|
|
17
|
+
type: "component",
|
|
18
|
+
framework: "react",
|
|
19
|
+
componentKey: "ServiceDashboard"
|
|
20
|
+
},
|
|
21
|
+
targets: ["react", "markdown"],
|
|
22
|
+
policy: {
|
|
23
|
+
flags: ["service.dashboard.enabled"]
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
var ClientListPresentation = definePresentation({
|
|
27
|
+
meta: {
|
|
28
|
+
key: "service-business-os.client.list",
|
|
29
|
+
version: "1.0.0",
|
|
30
|
+
title: "Client List",
|
|
31
|
+
description: "List of service clients",
|
|
32
|
+
domain: "services",
|
|
33
|
+
owners: ["@service-os"],
|
|
34
|
+
tags: ["services", "clients", "list"],
|
|
35
|
+
stability: StabilityEnum.Experimental,
|
|
36
|
+
goal: "Browse and manage service clients",
|
|
37
|
+
context: "Client management"
|
|
38
|
+
},
|
|
39
|
+
source: {
|
|
40
|
+
type: "component",
|
|
41
|
+
framework: "react",
|
|
42
|
+
componentKey: "ClientList"
|
|
43
|
+
},
|
|
44
|
+
targets: ["react", "markdown"],
|
|
45
|
+
policy: {
|
|
46
|
+
flags: ["service.clients.enabled"]
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var QuoteListPresentation = definePresentation({
|
|
50
|
+
meta: {
|
|
51
|
+
key: "service-business-os.quote.list",
|
|
52
|
+
version: "1.0.0",
|
|
53
|
+
title: "Quote List",
|
|
54
|
+
description: "List of quotes with status",
|
|
55
|
+
domain: "services",
|
|
56
|
+
owners: ["@service-os"],
|
|
57
|
+
tags: ["services", "quotes", "list"],
|
|
58
|
+
stability: StabilityEnum.Experimental,
|
|
59
|
+
goal: "Track and manage quotes",
|
|
60
|
+
context: "Quote management"
|
|
61
|
+
},
|
|
62
|
+
source: {
|
|
63
|
+
type: "component",
|
|
64
|
+
framework: "react",
|
|
65
|
+
componentKey: "QuoteList"
|
|
66
|
+
},
|
|
67
|
+
targets: ["react", "markdown"],
|
|
68
|
+
policy: {
|
|
69
|
+
flags: ["service.quotes.enabled"]
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
var QuoteDetailPresentation = definePresentation({
|
|
73
|
+
meta: {
|
|
74
|
+
key: "service-business-os.quote.detail",
|
|
75
|
+
version: "1.0.0",
|
|
76
|
+
title: "Quote Details",
|
|
77
|
+
description: "Quote detail with line items",
|
|
78
|
+
domain: "services",
|
|
79
|
+
owners: ["@service-os"],
|
|
80
|
+
tags: ["services", "quote", "detail"],
|
|
81
|
+
stability: StabilityEnum.Experimental,
|
|
82
|
+
goal: "View and edit quote details",
|
|
83
|
+
context: "Quote inspection"
|
|
84
|
+
},
|
|
85
|
+
source: {
|
|
86
|
+
type: "component",
|
|
87
|
+
framework: "react",
|
|
88
|
+
componentKey: "QuoteDetail"
|
|
89
|
+
},
|
|
90
|
+
targets: ["react", "markdown"],
|
|
91
|
+
policy: {
|
|
92
|
+
flags: ["service.quotes.enabled"]
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
var JobBoardPresentation = definePresentation({
|
|
96
|
+
meta: {
|
|
97
|
+
key: "service-business-os.job.board",
|
|
98
|
+
version: "1.0.0",
|
|
99
|
+
title: "Job Board",
|
|
100
|
+
description: "Job board with kanban view",
|
|
101
|
+
domain: "services",
|
|
102
|
+
owners: ["@service-os"],
|
|
103
|
+
tags: ["services", "jobs", "board", "kanban"],
|
|
104
|
+
stability: StabilityEnum.Experimental,
|
|
105
|
+
goal: "Visual job management",
|
|
106
|
+
context: "Field service scheduling"
|
|
107
|
+
},
|
|
108
|
+
source: {
|
|
109
|
+
type: "component",
|
|
110
|
+
framework: "react",
|
|
111
|
+
componentKey: "JobBoard"
|
|
112
|
+
},
|
|
113
|
+
targets: ["react"],
|
|
114
|
+
policy: {
|
|
115
|
+
flags: ["service.jobs.enabled"]
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
var InvoiceListPresentation = definePresentation({
|
|
119
|
+
meta: {
|
|
120
|
+
key: "service-business-os.invoice.list",
|
|
121
|
+
version: "1.0.0",
|
|
122
|
+
title: "Invoice List",
|
|
123
|
+
description: "List of invoices with payment status",
|
|
124
|
+
domain: "services",
|
|
125
|
+
owners: ["@service-os"],
|
|
126
|
+
tags: ["services", "invoices", "list"],
|
|
127
|
+
stability: StabilityEnum.Experimental,
|
|
128
|
+
goal: "Track invoices and payments",
|
|
129
|
+
context: "Billing management"
|
|
130
|
+
},
|
|
131
|
+
source: {
|
|
132
|
+
type: "component",
|
|
133
|
+
framework: "react",
|
|
134
|
+
componentKey: "InvoiceList"
|
|
135
|
+
},
|
|
136
|
+
targets: ["react", "markdown"],
|
|
137
|
+
policy: {
|
|
138
|
+
flags: ["service.invoices.enabled"]
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
var PaymentListPresentation = definePresentation({
|
|
142
|
+
meta: {
|
|
143
|
+
key: "service-business-os.payment.list",
|
|
144
|
+
version: "1.0.0",
|
|
145
|
+
title: "Payment List",
|
|
146
|
+
description: "List of payments received",
|
|
147
|
+
domain: "services",
|
|
148
|
+
owners: ["@service-os"],
|
|
149
|
+
tags: ["services", "payments", "list"],
|
|
150
|
+
stability: StabilityEnum.Experimental,
|
|
151
|
+
goal: "Track received payments",
|
|
152
|
+
context: "Payment reconciliation"
|
|
153
|
+
},
|
|
154
|
+
source: {
|
|
155
|
+
type: "component",
|
|
156
|
+
framework: "react",
|
|
157
|
+
componentKey: "PaymentList"
|
|
158
|
+
},
|
|
159
|
+
targets: ["react", "markdown"],
|
|
160
|
+
policy: {
|
|
161
|
+
flags: ["service.payments.enabled"]
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
export {
|
|
165
|
+
ServiceDashboardPresentation,
|
|
166
|
+
QuoteListPresentation,
|
|
167
|
+
QuoteDetailPresentation,
|
|
168
|
+
PaymentListPresentation,
|
|
169
|
+
JobBoardPresentation,
|
|
170
|
+
InvoiceListPresentation,
|
|
171
|
+
ClientListPresentation
|
|
172
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// src/quote/quote.schema.ts
|
|
2
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
3
|
+
var QuoteModel = defineSchemaModel({
|
|
4
|
+
name: "Quote",
|
|
5
|
+
description: "Quote/proposal",
|
|
6
|
+
fields: {
|
|
7
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
8
|
+
clientId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
+
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
11
|
+
amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
12
|
+
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
13
|
+
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
14
|
+
validUntil: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
15
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var CreateQuoteInputModel = defineSchemaModel({
|
|
19
|
+
name: "CreateQuoteInput",
|
|
20
|
+
description: "Input for creating a quote",
|
|
21
|
+
fields: {
|
|
22
|
+
clientId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
23
|
+
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
25
|
+
amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
26
|
+
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
27
|
+
validUntil: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
28
|
+
orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
29
|
+
ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
var AcceptQuoteInputModel = defineSchemaModel({
|
|
33
|
+
name: "AcceptQuoteInput",
|
|
34
|
+
description: "Input for accepting a quote",
|
|
35
|
+
fields: {
|
|
36
|
+
quoteId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
37
|
+
acceptedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
38
|
+
notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// src/quote/quote.operations.ts
|
|
43
|
+
import { defineCommand } from "@contractspec/lib.contracts";
|
|
44
|
+
var OWNERS = ["@examples.service-business-os"];
|
|
45
|
+
var CreateQuoteContract = defineCommand({
|
|
46
|
+
meta: {
|
|
47
|
+
key: "service.quote.create",
|
|
48
|
+
version: "1.0.0",
|
|
49
|
+
stability: "stable",
|
|
50
|
+
owners: [...OWNERS],
|
|
51
|
+
tags: ["service-business-os", "quote", "create"],
|
|
52
|
+
description: "Create a quote/proposal.",
|
|
53
|
+
goal: "Quote clients.",
|
|
54
|
+
context: "Quote creation."
|
|
55
|
+
},
|
|
56
|
+
io: {
|
|
57
|
+
input: CreateQuoteInputModel,
|
|
58
|
+
output: QuoteModel
|
|
59
|
+
},
|
|
60
|
+
policy: { auth: "user" },
|
|
61
|
+
acceptance: {
|
|
62
|
+
scenarios: [
|
|
63
|
+
{
|
|
64
|
+
key: "create-quote-happy-path",
|
|
65
|
+
given: ["Client exists"],
|
|
66
|
+
when: ["User creates quote"],
|
|
67
|
+
then: ["Quote is created"]
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
examples: [
|
|
71
|
+
{
|
|
72
|
+
key: "create-proposal",
|
|
73
|
+
input: {
|
|
74
|
+
clientId: "client-123",
|
|
75
|
+
items: [{ description: "Project A", price: 5000 }]
|
|
76
|
+
},
|
|
77
|
+
output: { id: "quote-123", status: "draft", total: 5000 }
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
var AcceptQuoteContract = defineCommand({
|
|
83
|
+
meta: {
|
|
84
|
+
key: "service.quote.accept",
|
|
85
|
+
version: "1.0.0",
|
|
86
|
+
stability: "stable",
|
|
87
|
+
owners: [...OWNERS],
|
|
88
|
+
tags: ["service-business-os", "quote", "accept"],
|
|
89
|
+
description: "Accept a quote.",
|
|
90
|
+
goal: "Confirm quote.",
|
|
91
|
+
context: "Quote acceptance."
|
|
92
|
+
},
|
|
93
|
+
io: {
|
|
94
|
+
input: AcceptQuoteInputModel,
|
|
95
|
+
output: QuoteModel
|
|
96
|
+
},
|
|
97
|
+
policy: { auth: "user" },
|
|
98
|
+
acceptance: {
|
|
99
|
+
scenarios: [
|
|
100
|
+
{
|
|
101
|
+
key: "accept-quote-happy-path",
|
|
102
|
+
given: ["Quote is open"],
|
|
103
|
+
when: ["Client accepts quote"],
|
|
104
|
+
then: ["Quote status becomes ACCEPTED"]
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
examples: [
|
|
108
|
+
{
|
|
109
|
+
key: "client-accepts",
|
|
110
|
+
input: { quoteId: "quote-123", signature: "John Doe" },
|
|
111
|
+
output: { id: "quote-123", status: "accepted" }
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
export {
|
|
117
|
+
QuoteModel,
|
|
118
|
+
CreateQuoteInputModel,
|
|
119
|
+
CreateQuoteContract,
|
|
120
|
+
AcceptQuoteInputModel,
|
|
121
|
+
AcceptQuoteContract
|
|
122
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// src/quote/quote.schema.ts
|
|
2
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
3
|
+
var QuoteModel = defineSchemaModel({
|
|
4
|
+
name: "Quote",
|
|
5
|
+
description: "Quote/proposal",
|
|
6
|
+
fields: {
|
|
7
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
8
|
+
clientId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
+
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
11
|
+
amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
12
|
+
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
13
|
+
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
14
|
+
validUntil: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
15
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var CreateQuoteInputModel = defineSchemaModel({
|
|
19
|
+
name: "CreateQuoteInput",
|
|
20
|
+
description: "Input for creating a quote",
|
|
21
|
+
fields: {
|
|
22
|
+
clientId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
23
|
+
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
25
|
+
amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
26
|
+
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
27
|
+
validUntil: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
28
|
+
orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
29
|
+
ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
var AcceptQuoteInputModel = defineSchemaModel({
|
|
33
|
+
name: "AcceptQuoteInput",
|
|
34
|
+
description: "Input for accepting a quote",
|
|
35
|
+
fields: {
|
|
36
|
+
quoteId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
37
|
+
acceptedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
38
|
+
notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// src/quote/quote.operations.ts
|
|
43
|
+
import { defineCommand } from "@contractspec/lib.contracts";
|
|
44
|
+
var OWNERS = ["@examples.service-business-os"];
|
|
45
|
+
var CreateQuoteContract = defineCommand({
|
|
46
|
+
meta: {
|
|
47
|
+
key: "service.quote.create",
|
|
48
|
+
version: "1.0.0",
|
|
49
|
+
stability: "stable",
|
|
50
|
+
owners: [...OWNERS],
|
|
51
|
+
tags: ["service-business-os", "quote", "create"],
|
|
52
|
+
description: "Create a quote/proposal.",
|
|
53
|
+
goal: "Quote clients.",
|
|
54
|
+
context: "Quote creation."
|
|
55
|
+
},
|
|
56
|
+
io: {
|
|
57
|
+
input: CreateQuoteInputModel,
|
|
58
|
+
output: QuoteModel
|
|
59
|
+
},
|
|
60
|
+
policy: { auth: "user" },
|
|
61
|
+
acceptance: {
|
|
62
|
+
scenarios: [
|
|
63
|
+
{
|
|
64
|
+
key: "create-quote-happy-path",
|
|
65
|
+
given: ["Client exists"],
|
|
66
|
+
when: ["User creates quote"],
|
|
67
|
+
then: ["Quote is created"]
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
examples: [
|
|
71
|
+
{
|
|
72
|
+
key: "create-proposal",
|
|
73
|
+
input: {
|
|
74
|
+
clientId: "client-123",
|
|
75
|
+
items: [{ description: "Project A", price: 5000 }]
|
|
76
|
+
},
|
|
77
|
+
output: { id: "quote-123", status: "draft", total: 5000 }
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
var AcceptQuoteContract = defineCommand({
|
|
83
|
+
meta: {
|
|
84
|
+
key: "service.quote.accept",
|
|
85
|
+
version: "1.0.0",
|
|
86
|
+
stability: "stable",
|
|
87
|
+
owners: [...OWNERS],
|
|
88
|
+
tags: ["service-business-os", "quote", "accept"],
|
|
89
|
+
description: "Accept a quote.",
|
|
90
|
+
goal: "Confirm quote.",
|
|
91
|
+
context: "Quote acceptance."
|
|
92
|
+
},
|
|
93
|
+
io: {
|
|
94
|
+
input: AcceptQuoteInputModel,
|
|
95
|
+
output: QuoteModel
|
|
96
|
+
},
|
|
97
|
+
policy: { auth: "user" },
|
|
98
|
+
acceptance: {
|
|
99
|
+
scenarios: [
|
|
100
|
+
{
|
|
101
|
+
key: "accept-quote-happy-path",
|
|
102
|
+
given: ["Quote is open"],
|
|
103
|
+
when: ["Client accepts quote"],
|
|
104
|
+
then: ["Quote status becomes ACCEPTED"]
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
examples: [
|
|
108
|
+
{
|
|
109
|
+
key: "client-accepts",
|
|
110
|
+
input: { quoteId: "quote-123", signature: "John Doe" },
|
|
111
|
+
output: { id: "quote-123", status: "accepted" }
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
export {
|
|
117
|
+
CreateQuoteContract,
|
|
118
|
+
AcceptQuoteContract
|
|
119
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/quote/quote.schema.ts
|
|
2
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
3
|
+
var QuoteModel = defineSchemaModel({
|
|
4
|
+
name: "Quote",
|
|
5
|
+
description: "Quote/proposal",
|
|
6
|
+
fields: {
|
|
7
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
8
|
+
clientId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
+
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
11
|
+
amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
12
|
+
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
13
|
+
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
14
|
+
validUntil: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
15
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var CreateQuoteInputModel = defineSchemaModel({
|
|
19
|
+
name: "CreateQuoteInput",
|
|
20
|
+
description: "Input for creating a quote",
|
|
21
|
+
fields: {
|
|
22
|
+
clientId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
23
|
+
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
25
|
+
amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
26
|
+
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
27
|
+
validUntil: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
28
|
+
orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
29
|
+
ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
var AcceptQuoteInputModel = defineSchemaModel({
|
|
33
|
+
name: "AcceptQuoteInput",
|
|
34
|
+
description: "Input for accepting a quote",
|
|
35
|
+
fields: {
|
|
36
|
+
quoteId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
37
|
+
acceptedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
38
|
+
notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
QuoteModel,
|
|
43
|
+
CreateQuoteInputModel,
|
|
44
|
+
AcceptQuoteInputModel
|
|
45
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/service-business-os.capability.ts
|
|
2
|
+
import { defineCapability, StabilityEnum } from "@contractspec/lib.contracts";
|
|
3
|
+
var QuotesCapability = defineCapability({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "quotes",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
kind: "api",
|
|
8
|
+
stability: StabilityEnum.Experimental,
|
|
9
|
+
description: "Quote generation and management for service businesses",
|
|
10
|
+
owners: ["platform.core"],
|
|
11
|
+
tags: ["quotes", "service", "business"]
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
var InvoicesCapability = defineCapability({
|
|
15
|
+
meta: {
|
|
16
|
+
key: "invoices",
|
|
17
|
+
version: "1.0.0",
|
|
18
|
+
kind: "api",
|
|
19
|
+
stability: StabilityEnum.Experimental,
|
|
20
|
+
description: "Invoice creation and payment tracking",
|
|
21
|
+
owners: ["platform.finance"],
|
|
22
|
+
tags: ["invoices", "billing"]
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
QuotesCapability,
|
|
27
|
+
InvoicesCapability
|
|
28
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// src/service.feature.ts
|
|
2
|
+
import { defineFeature } from "@contractspec/lib.contracts";
|
|
3
|
+
var ServiceBusinessFeature = defineFeature({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "service-business-os",
|
|
6
|
+
title: "Service Business OS",
|
|
7
|
+
description: "Quotes → jobs → invoices → payments for field services and agencies.",
|
|
8
|
+
domain: "services",
|
|
9
|
+
owners: ["@service-os"],
|
|
10
|
+
tags: ["services", "quotes", "jobs", "invoices", "payments"],
|
|
11
|
+
stability: "experimental",
|
|
12
|
+
version: "1.0.0"
|
|
13
|
+
},
|
|
14
|
+
operations: [
|
|
15
|
+
{ key: "service.client.create", version: "1.0.0" },
|
|
16
|
+
{ key: "service.quote.create", version: "1.0.0" },
|
|
17
|
+
{ key: "service.quote.accept", version: "1.0.0" },
|
|
18
|
+
{ key: "service.job.schedule", version: "1.0.0" },
|
|
19
|
+
{ key: "service.job.complete", version: "1.0.0" },
|
|
20
|
+
{ key: "service.invoice.issue", version: "1.0.0" },
|
|
21
|
+
{ key: "service.payment.record", version: "1.0.0" },
|
|
22
|
+
{ key: "service.job.list", version: "1.0.0" }
|
|
23
|
+
],
|
|
24
|
+
events: [
|
|
25
|
+
{ key: "service.quote.sent", version: "1.0.0" },
|
|
26
|
+
{ key: "service.quote.accepted", version: "1.0.0" },
|
|
27
|
+
{ key: "service.job.scheduled", version: "1.0.0" },
|
|
28
|
+
{ key: "service.job.completed", version: "1.0.0" },
|
|
29
|
+
{ key: "service.invoice.issued", version: "1.0.0" },
|
|
30
|
+
{ key: "service.payment.received", version: "1.0.0" }
|
|
31
|
+
],
|
|
32
|
+
presentations: [
|
|
33
|
+
{ key: "service-business-os.dashboard", version: "1.0.0" },
|
|
34
|
+
{ key: "service-business-os.client.list", version: "1.0.0" },
|
|
35
|
+
{ key: "service-business-os.quote.list", version: "1.0.0" },
|
|
36
|
+
{ key: "service-business-os.quote.detail", version: "1.0.0" },
|
|
37
|
+
{ key: "service-business-os.job.board", version: "1.0.0" },
|
|
38
|
+
{ key: "service-business-os.invoice.list", version: "1.0.0" },
|
|
39
|
+
{ key: "service-business-os.payment.list", version: "1.0.0" }
|
|
40
|
+
],
|
|
41
|
+
presentationsTargets: [
|
|
42
|
+
{
|
|
43
|
+
key: "service-business-os.dashboard",
|
|
44
|
+
version: "1.0.0",
|
|
45
|
+
targets: ["react", "markdown"]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
key: "service-business-os.quote.list",
|
|
49
|
+
version: "1.0.0",
|
|
50
|
+
targets: ["react", "markdown"]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: "service-business-os.invoice.list",
|
|
54
|
+
version: "1.0.0",
|
|
55
|
+
targets: ["react", "markdown"]
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
capabilities: {
|
|
59
|
+
requires: [
|
|
60
|
+
{ key: "identity", version: "1.0.0" },
|
|
61
|
+
{ key: "audit-trail", version: "1.0.0" },
|
|
62
|
+
{ key: "notifications", version: "1.0.0" },
|
|
63
|
+
{ key: "files", version: "1.0.0" }
|
|
64
|
+
],
|
|
65
|
+
provides: [
|
|
66
|
+
{ key: "quotes", version: "1.0.0" },
|
|
67
|
+
{ key: "jobs", version: "1.0.0" },
|
|
68
|
+
{ key: "invoices", version: "1.0.0" }
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
export {
|
|
73
|
+
ServiceBusinessFeature
|
|
74
|
+
};
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { CompleteJobInputModel, JobModel, ScheduleJobInputModel } from "../job/job.schema.js";
|
|
8
|
-
import { CompleteJobContract, ScheduleJobContract } from "../job/job.operations.js";
|
|
9
|
-
import "../job/index.js";
|
|
10
|
-
import { InvoiceModel, IssueInvoiceInputModel } from "../invoice/invoice.schema.js";
|
|
11
|
-
import { IssueInvoiceContract } from "../invoice/invoice.operations.js";
|
|
12
|
-
import "../invoice/index.js";
|
|
13
|
-
import { PaymentModel, RecordPaymentInputModel } from "../payment/payment.schema.js";
|
|
14
|
-
import { RecordPaymentContract } from "../payment/payment.operations.js";
|
|
15
|
-
import "../payment/index.js";
|
|
16
|
-
export { AcceptQuoteContract, AcceptQuoteInputModel, ClientModel, CompleteJobContract, CompleteJobInputModel, CreateClientContract, CreateClientInputModel, CreateQuoteContract, CreateQuoteInputModel, InvoiceModel, IssueInvoiceContract, IssueInvoiceInputModel, JobModel, PaymentModel, QuoteModel, RecordPaymentContract, RecordPaymentInputModel, ScheduleJobContract, ScheduleJobInputModel };
|
|
1
|
+
export { ClientModel, CreateClientInputModel, CreateClientContract, } from '../client';
|
|
2
|
+
export { QuoteModel, CreateQuoteInputModel, AcceptQuoteInputModel, CreateQuoteContract, AcceptQuoteContract, } from '../quote';
|
|
3
|
+
export { JobModel, ScheduleJobInputModel, CompleteJobInputModel, ScheduleJobContract, CompleteJobContract, } from '../job';
|
|
4
|
+
export { InvoiceModel, IssueInvoiceInputModel, IssueInvoiceContract, } from '../invoice';
|
|
5
|
+
export { PaymentModel, RecordPaymentInputModel, RecordPaymentContract, } from '../payment';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/operations/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,QAAQ,EACR,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,YAAY,CAAC"}
|