@contractspec/example.service-business-os 3.7.16 → 3.7.18

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 (82) hide show
  1. package/dist/browser/client/client.operations.js +1 -72
  2. package/dist/browser/client/client.schema.js +1 -31
  3. package/dist/browser/client/index.js +1 -74
  4. package/dist/browser/docs/index.js +5 -49
  5. package/dist/browser/docs/service-business-os.docblock.js +5 -49
  6. package/dist/browser/entities/index.js +1 -246
  7. package/dist/browser/events.js +1 -135
  8. package/dist/browser/example.js +1 -39
  9. package/dist/browser/handlers/index.js +1 -5
  10. package/dist/browser/index.js +1 -766
  11. package/dist/browser/invoice/index.js +1 -77
  12. package/dist/browser/invoice/invoice.operations.js +1 -75
  13. package/dist/browser/invoice/invoice.schema.js +1 -34
  14. package/dist/browser/job/index.js +1 -175
  15. package/dist/browser/job/job.operations.js +1 -172
  16. package/dist/browser/job/job.schema.js +1 -41
  17. package/dist/browser/operations/index.js +1 -506
  18. package/dist/browser/payment/index.js +1 -69
  19. package/dist/browser/payment/payment.operations.js +1 -67
  20. package/dist/browser/payment/payment.schema.js +1 -30
  21. package/dist/browser/presentations/index.js +1 -13
  22. package/dist/browser/presentations.js +1 -175
  23. package/dist/browser/quote/index.js +1 -122
  24. package/dist/browser/quote/quote.operations.js +1 -119
  25. package/dist/browser/quote/quote.schema.js +1 -45
  26. package/dist/browser/service-business-os.capability.js +1 -31
  27. package/dist/browser/service.feature.js +1 -85
  28. package/dist/client/client.operations.js +1 -72
  29. package/dist/client/client.schema.js +1 -31
  30. package/dist/client/index.js +1 -74
  31. package/dist/docs/index.js +5 -49
  32. package/dist/docs/service-business-os.docblock.js +5 -49
  33. package/dist/entities/index.js +1 -246
  34. package/dist/events.js +1 -135
  35. package/dist/example.js +1 -39
  36. package/dist/handlers/index.js +1 -5
  37. package/dist/index.js +1 -766
  38. package/dist/invoice/index.js +1 -77
  39. package/dist/invoice/invoice.operations.js +1 -75
  40. package/dist/invoice/invoice.schema.js +1 -34
  41. package/dist/job/index.js +1 -175
  42. package/dist/job/job.operations.js +1 -172
  43. package/dist/job/job.schema.js +1 -41
  44. package/dist/node/client/client.operations.js +1 -72
  45. package/dist/node/client/client.schema.js +1 -31
  46. package/dist/node/client/index.js +1 -74
  47. package/dist/node/docs/index.js +5 -49
  48. package/dist/node/docs/service-business-os.docblock.js +5 -49
  49. package/dist/node/entities/index.js +1 -246
  50. package/dist/node/events.js +1 -135
  51. package/dist/node/example.js +1 -39
  52. package/dist/node/handlers/index.js +1 -5
  53. package/dist/node/index.js +1 -766
  54. package/dist/node/invoice/index.js +1 -77
  55. package/dist/node/invoice/invoice.operations.js +1 -75
  56. package/dist/node/invoice/invoice.schema.js +1 -34
  57. package/dist/node/job/index.js +1 -175
  58. package/dist/node/job/job.operations.js +1 -172
  59. package/dist/node/job/job.schema.js +1 -41
  60. package/dist/node/operations/index.js +1 -506
  61. package/dist/node/payment/index.js +1 -69
  62. package/dist/node/payment/payment.operations.js +1 -67
  63. package/dist/node/payment/payment.schema.js +1 -30
  64. package/dist/node/presentations/index.js +1 -13
  65. package/dist/node/presentations.js +1 -175
  66. package/dist/node/quote/index.js +1 -122
  67. package/dist/node/quote/quote.operations.js +1 -119
  68. package/dist/node/quote/quote.schema.js +1 -45
  69. package/dist/node/service-business-os.capability.js +1 -31
  70. package/dist/node/service.feature.js +1 -85
  71. package/dist/operations/index.js +1 -506
  72. package/dist/payment/index.js +1 -69
  73. package/dist/payment/payment.operations.js +1 -67
  74. package/dist/payment/payment.schema.js +1 -30
  75. package/dist/presentations/index.js +1 -13
  76. package/dist/presentations.js +1 -175
  77. package/dist/quote/index.js +1 -122
  78. package/dist/quote/quote.operations.js +1 -119
  79. package/dist/quote/quote.schema.js +1 -45
  80. package/dist/service-business-os.capability.js +1 -31
  81. package/dist/service.feature.js +1 -85
  82. package/package.json +7 -7
@@ -1,506 +1 @@
1
- // src/client/client.schema.ts
2
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
3
- var ClientModel = defineSchemaModel({
4
- name: "Client",
5
- description: "Client profile",
6
- fields: {
7
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
8
- name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
9
- contactEmail: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
10
- phone: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
11
- orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
12
- ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
13
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
14
- }
15
- });
16
- var CreateClientInputModel = defineSchemaModel({
17
- name: "CreateClientInput",
18
- description: "Input for creating a client",
19
- fields: {
20
- name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
21
- contactEmail: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
22
- phone: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
23
- orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
24
- ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
25
- metadata: { type: ScalarTypeEnum.JSON(), isOptional: true }
26
- }
27
- });
28
-
29
- // src/client/client.operations.ts
30
- import { defineCommand } from "@contractspec/lib.contracts-spec";
31
- var OWNERS = ["@examples.service-business-os"];
32
- var CreateClientContract = defineCommand({
33
- meta: {
34
- key: "service.client.create",
35
- version: "1.0.0",
36
- stability: "stable",
37
- owners: [...OWNERS],
38
- tags: ["service-business-os", "client", "create"],
39
- description: "Create a new client.",
40
- goal: "Onboard clients.",
41
- context: "CRM."
42
- },
43
- io: {
44
- input: CreateClientInputModel,
45
- output: ClientModel
46
- },
47
- policy: { auth: "user" },
48
- acceptance: {
49
- scenarios: [
50
- {
51
- key: "create-client-happy-path",
52
- given: ["User is authenticated"],
53
- when: ["User creates a new client"],
54
- then: ["Client is created"]
55
- }
56
- ],
57
- examples: [
58
- {
59
- key: "create-basic",
60
- input: {
61
- name: "Acme Corp",
62
- email: "contact@acme.com",
63
- phone: "555-0123"
64
- },
65
- output: { id: "client-123", name: "Acme Corp" }
66
- }
67
- ]
68
- }
69
- });
70
- // src/invoice/invoice.schema.ts
71
- import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
72
- var InvoiceModel = defineSchemaModel2({
73
- name: "Invoice",
74
- description: "Invoice issued for a job",
75
- fields: {
76
- id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
77
- jobId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
78
- invoiceNumber: {
79
- type: ScalarTypeEnum2.String_unsecure(),
80
- isOptional: false
81
- },
82
- amount: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
83
- currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
84
- status: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
85
- dueDate: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
86
- issuedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
87
- paidAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true }
88
- }
89
- });
90
- var IssueInvoiceInputModel = defineSchemaModel2({
91
- name: "IssueInvoiceInput",
92
- description: "Input for issuing an invoice",
93
- fields: {
94
- jobId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
95
- dueDate: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
96
- notes: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
97
- lineItems: { type: ScalarTypeEnum2.JSON(), isOptional: true }
98
- }
99
- });
100
-
101
- // src/invoice/invoice.operations.ts
102
- import { defineCommand as defineCommand2 } from "@contractspec/lib.contracts-spec";
103
- var OWNERS2 = ["@examples.service-business-os"];
104
- var IssueInvoiceContract = defineCommand2({
105
- meta: {
106
- key: "service.invoice.issue",
107
- version: "1.0.0",
108
- stability: "stable",
109
- owners: [...OWNERS2],
110
- tags: ["service-business-os", "invoice", "issue"],
111
- description: "Issue an invoice for a job.",
112
- goal: "Bill clients.",
113
- context: "Billing."
114
- },
115
- io: {
116
- input: IssueInvoiceInputModel,
117
- output: InvoiceModel
118
- },
119
- policy: { auth: "user" },
120
- acceptance: {
121
- scenarios: [
122
- {
123
- key: "issue-invoice-happy-path",
124
- given: ["Job is complete"],
125
- when: ["User issues invoice"],
126
- then: ["Invoice is created and sent"]
127
- }
128
- ],
129
- examples: [
130
- {
131
- key: "issue-standard",
132
- input: {
133
- jobId: "job-123",
134
- dueDate: "2025-02-01",
135
- items: [{ description: "Service", amount: 100 }]
136
- },
137
- output: { id: "inv-456", status: "issued", total: 100 }
138
- }
139
- ]
140
- }
141
- });
142
- // src/job/job.schema.ts
143
- import { defineSchemaModel as defineSchemaModel3, ScalarTypeEnum as ScalarTypeEnum3 } from "@contractspec/lib.schema";
144
- var JobModel = defineSchemaModel3({
145
- name: "Job",
146
- description: "Scheduled job",
147
- fields: {
148
- id: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
149
- quoteId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
150
- clientId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
151
- title: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
152
- status: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
153
- scheduledAt: { type: ScalarTypeEnum3.DateTime(), isOptional: true },
154
- completedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: true },
155
- assignedTo: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true }
156
- }
157
- });
158
- var ScheduleJobInputModel = defineSchemaModel3({
159
- name: "ScheduleJobInput",
160
- description: "Input for scheduling a job",
161
- fields: {
162
- quoteId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
163
- scheduledAt: { type: ScalarTypeEnum3.DateTime(), isOptional: false },
164
- assignedTo: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
165
- location: { type: ScalarTypeEnum3.JSON(), isOptional: true },
166
- title: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true }
167
- }
168
- });
169
- var CompleteJobInputModel = defineSchemaModel3({
170
- name: "CompleteJobInput",
171
- description: "Input for completing a job",
172
- fields: {
173
- jobId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
174
- completedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: true },
175
- notes: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true }
176
- }
177
- });
178
-
179
- // src/job/job.operations.ts
180
- import { defineCommand as defineCommand3, defineQuery } from "@contractspec/lib.contracts-spec";
181
- import { defineSchemaModel as defineSchemaModel4, ScalarTypeEnum as ScalarTypeEnum4 } from "@contractspec/lib.schema";
182
- var OWNERS3 = ["@examples.service-business-os"];
183
- var ListJobsInputModel = defineSchemaModel4({
184
- name: "ListJobsInput",
185
- description: "Input for listing jobs",
186
- fields: {
187
- status: { type: ScalarTypeEnum4.String_unsecure(), isOptional: true },
188
- clientId: { type: ScalarTypeEnum4.String_unsecure(), isOptional: true },
189
- limit: { type: ScalarTypeEnum4.Int_unsecure(), isOptional: true },
190
- offset: { type: ScalarTypeEnum4.Int_unsecure(), isOptional: true }
191
- }
192
- });
193
- var ListJobsOutputModel = defineSchemaModel4({
194
- name: "ListJobsOutput",
195
- description: "Output for listing jobs",
196
- fields: {
197
- jobs: { type: JobModel, isOptional: false, isList: true },
198
- total: { type: ScalarTypeEnum4.Int_unsecure(), isOptional: false }
199
- }
200
- });
201
- var ListJobsOperation = defineQuery({
202
- meta: {
203
- key: "service.job.list",
204
- version: "1.0.0",
205
- stability: "stable",
206
- owners: [...OWNERS3],
207
- tags: ["service-business-os", "job", "list", "query"],
208
- description: "List all jobs with filtering",
209
- goal: "Retrieve list of jobs",
210
- context: "Job management"
211
- },
212
- io: {
213
- input: ListJobsInputModel,
214
- output: ListJobsOutputModel
215
- },
216
- policy: { auth: "user" },
217
- acceptance: {
218
- scenarios: [
219
- {
220
- key: "list-jobs-happy-path",
221
- given: ["Jobs exist"],
222
- when: ["User lists jobs"],
223
- then: ["List of jobs is returned"]
224
- }
225
- ],
226
- examples: [
227
- {
228
- key: "list-active",
229
- input: { status: "scheduled", limit: 10 },
230
- output: { jobs: [], total: 5 }
231
- }
232
- ]
233
- }
234
- });
235
- var ScheduleJobContract = defineCommand3({
236
- meta: {
237
- key: "service.job.schedule",
238
- version: "1.0.0",
239
- stability: "stable",
240
- owners: [...OWNERS3],
241
- tags: ["service-business-os", "job", "schedule"],
242
- description: "Schedule a job.",
243
- goal: "Schedule work.",
244
- context: "Job scheduling."
245
- },
246
- io: {
247
- input: ScheduleJobInputModel,
248
- output: JobModel
249
- },
250
- policy: { auth: "user" },
251
- acceptance: {
252
- scenarios: [
253
- {
254
- key: "schedule-job-happy-path",
255
- given: ["Client exists"],
256
- when: ["User schedules job"],
257
- then: ["Job is created with status SCHEDULED"]
258
- }
259
- ],
260
- examples: [
261
- {
262
- key: "schedule-repair",
263
- input: {
264
- clientId: "client-123",
265
- date: "2025-01-20T10:00:00Z",
266
- type: "repair"
267
- },
268
- output: { id: "job-456", status: "scheduled" }
269
- }
270
- ]
271
- }
272
- });
273
- var CompleteJobContract = defineCommand3({
274
- meta: {
275
- key: "service.job.complete",
276
- version: "1.0.0",
277
- stability: "stable",
278
- owners: [...OWNERS3],
279
- tags: ["service-business-os", "job", "complete"],
280
- description: "Mark a job as complete.",
281
- goal: "Record job completion.",
282
- context: "Job management."
283
- },
284
- io: {
285
- input: CompleteJobInputModel,
286
- output: JobModel
287
- },
288
- policy: { auth: "user" },
289
- acceptance: {
290
- scenarios: [
291
- {
292
- key: "complete-job-happy-path",
293
- given: ["Job is scheduled"],
294
- when: ["User completes job"],
295
- then: ["Job status becomes COMPLETED"]
296
- }
297
- ],
298
- examples: [
299
- {
300
- key: "mark-complete",
301
- input: { jobId: "job-456", notes: "Done successfully" },
302
- output: { id: "job-456", status: "completed" }
303
- }
304
- ]
305
- }
306
- });
307
- // src/payment/payment.schema.ts
308
- import { defineSchemaModel as defineSchemaModel5, ScalarTypeEnum as ScalarTypeEnum5 } from "@contractspec/lib.schema";
309
- var PaymentModel = defineSchemaModel5({
310
- name: "Payment",
311
- description: "Payment applied to invoice",
312
- fields: {
313
- id: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
314
- invoiceId: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
315
- amount: { type: ScalarTypeEnum5.Float_unsecure(), isOptional: false },
316
- currency: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
317
- method: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
318
- reference: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
319
- receivedAt: { type: ScalarTypeEnum5.DateTime(), isOptional: false }
320
- }
321
- });
322
- var RecordPaymentInputModel = defineSchemaModel5({
323
- name: "RecordPaymentInput",
324
- description: "Input for recording a payment",
325
- fields: {
326
- invoiceId: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
327
- amount: { type: ScalarTypeEnum5.Float_unsecure(), isOptional: false },
328
- method: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
329
- reference: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
330
- receivedAt: { type: ScalarTypeEnum5.DateTime(), isOptional: true }
331
- }
332
- });
333
-
334
- // src/payment/payment.operations.ts
335
- import { defineCommand as defineCommand4 } from "@contractspec/lib.contracts-spec";
336
- var OWNERS4 = ["@examples.service-business-os"];
337
- var RecordPaymentContract = defineCommand4({
338
- meta: {
339
- key: "service.payment.record",
340
- version: "1.0.0",
341
- stability: "stable",
342
- owners: [...OWNERS4],
343
- tags: ["service-business-os", "payment", "record"],
344
- description: "Record a payment.",
345
- goal: "Track payments.",
346
- context: "Billing."
347
- },
348
- io: {
349
- input: RecordPaymentInputModel,
350
- output: PaymentModel
351
- },
352
- policy: { auth: "user" },
353
- acceptance: {
354
- scenarios: [
355
- {
356
- key: "record-payment-happy-path",
357
- given: ["Invoice exists"],
358
- when: ["User records payment"],
359
- then: ["Payment is recorded"]
360
- }
361
- ],
362
- examples: [
363
- {
364
- key: "record-check",
365
- input: { invoiceId: "inv-456", amount: 100, method: "check" },
366
- output: { id: "pay-123", status: "completed" }
367
- }
368
- ]
369
- }
370
- });
371
- // src/quote/quote.schema.ts
372
- import { defineSchemaModel as defineSchemaModel6, ScalarTypeEnum as ScalarTypeEnum6 } from "@contractspec/lib.schema";
373
- var QuoteModel = defineSchemaModel6({
374
- name: "Quote",
375
- description: "Quote/proposal",
376
- fields: {
377
- id: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
378
- clientId: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
379
- title: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
380
- description: { type: ScalarTypeEnum6.String_unsecure(), isOptional: true },
381
- amount: { type: ScalarTypeEnum6.Float_unsecure(), isOptional: false },
382
- currency: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
383
- status: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
384
- validUntil: { type: ScalarTypeEnum6.DateTime(), isOptional: true },
385
- createdAt: { type: ScalarTypeEnum6.DateTime(), isOptional: false }
386
- }
387
- });
388
- var CreateQuoteInputModel = defineSchemaModel6({
389
- name: "CreateQuoteInput",
390
- description: "Input for creating a quote",
391
- fields: {
392
- clientId: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
393
- title: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
394
- description: { type: ScalarTypeEnum6.String_unsecure(), isOptional: true },
395
- amount: { type: ScalarTypeEnum6.Float_unsecure(), isOptional: false },
396
- currency: { type: ScalarTypeEnum6.String_unsecure(), isOptional: true },
397
- validUntil: { type: ScalarTypeEnum6.DateTime(), isOptional: true },
398
- orgId: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
399
- ownerId: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false }
400
- }
401
- });
402
- var AcceptQuoteInputModel = defineSchemaModel6({
403
- name: "AcceptQuoteInput",
404
- description: "Input for accepting a quote",
405
- fields: {
406
- quoteId: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
407
- acceptedBy: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
408
- notes: { type: ScalarTypeEnum6.String_unsecure(), isOptional: true }
409
- }
410
- });
411
-
412
- // src/quote/quote.operations.ts
413
- import { defineCommand as defineCommand5 } from "@contractspec/lib.contracts-spec";
414
- var OWNERS5 = ["@examples.service-business-os"];
415
- var CreateQuoteContract = defineCommand5({
416
- meta: {
417
- key: "service.quote.create",
418
- version: "1.0.0",
419
- stability: "stable",
420
- owners: [...OWNERS5],
421
- tags: ["service-business-os", "quote", "create"],
422
- description: "Create a quote/proposal.",
423
- goal: "Quote clients.",
424
- context: "Quote creation."
425
- },
426
- io: {
427
- input: CreateQuoteInputModel,
428
- output: QuoteModel
429
- },
430
- policy: { auth: "user" },
431
- acceptance: {
432
- scenarios: [
433
- {
434
- key: "create-quote-happy-path",
435
- given: ["Client exists"],
436
- when: ["User creates quote"],
437
- then: ["Quote is created"]
438
- }
439
- ],
440
- examples: [
441
- {
442
- key: "create-proposal",
443
- input: {
444
- clientId: "client-123",
445
- items: [{ description: "Project A", price: 5000 }]
446
- },
447
- output: { id: "quote-123", status: "draft", total: 5000 }
448
- }
449
- ]
450
- }
451
- });
452
- var AcceptQuoteContract = defineCommand5({
453
- meta: {
454
- key: "service.quote.accept",
455
- version: "1.0.0",
456
- stability: "stable",
457
- owners: [...OWNERS5],
458
- tags: ["service-business-os", "quote", "accept"],
459
- description: "Accept a quote.",
460
- goal: "Confirm quote.",
461
- context: "Quote acceptance."
462
- },
463
- io: {
464
- input: AcceptQuoteInputModel,
465
- output: QuoteModel
466
- },
467
- policy: { auth: "user" },
468
- acceptance: {
469
- scenarios: [
470
- {
471
- key: "accept-quote-happy-path",
472
- given: ["Quote is open"],
473
- when: ["Client accepts quote"],
474
- then: ["Quote status becomes ACCEPTED"]
475
- }
476
- ],
477
- examples: [
478
- {
479
- key: "client-accepts",
480
- input: { quoteId: "quote-123", signature: "John Doe" },
481
- output: { id: "quote-123", status: "accepted" }
482
- }
483
- ]
484
- }
485
- });
486
- export {
487
- ScheduleJobInputModel,
488
- ScheduleJobContract,
489
- RecordPaymentInputModel,
490
- RecordPaymentContract,
491
- QuoteModel,
492
- PaymentModel,
493
- JobModel,
494
- IssueInvoiceInputModel,
495
- IssueInvoiceContract,
496
- InvoiceModel,
497
- CreateQuoteInputModel,
498
- CreateQuoteContract,
499
- CreateClientInputModel,
500
- CreateClientContract,
501
- CompleteJobInputModel,
502
- CompleteJobContract,
503
- ClientModel,
504
- AcceptQuoteInputModel,
505
- AcceptQuoteContract
506
- };
1
+ import{defineSchemaModel as U,ScalarTypeEnum as C}from"@contractspec/lib.schema";var v=U({name:"Client",description:"Client profile",fields:{id:{type:C.String_unsecure(),isOptional:!1},name:{type:C.String_unsecure(),isOptional:!1},contactEmail:{type:C.String_unsecure(),isOptional:!0},phone:{type:C.String_unsecure(),isOptional:!0},orgId:{type:C.String_unsecure(),isOptional:!1},ownerId:{type:C.String_unsecure(),isOptional:!1},createdAt:{type:C.DateTime(),isOptional:!1}}}),A=U({name:"CreateClientInput",description:"Input for creating a client",fields:{name:{type:C.String_unsecure(),isOptional:!1},contactEmail:{type:C.String_unsecure(),isOptional:!0},phone:{type:C.String_unsecure(),isOptional:!0},orgId:{type:C.String_unsecure(),isOptional:!1},ownerId:{type:C.String_unsecure(),isOptional:!1},metadata:{type:C.JSON(),isOptional:!0}}});import{defineCommand as d}from"@contractspec/lib.contracts-spec";var h=["@examples.service-business-os"],V=d({meta:{key:"service.client.create",version:"1.0.0",stability:"stable",owners:[...h],tags:["service-business-os","client","create"],description:"Create a new client.",goal:"Onboard clients.",context:"CRM."},io:{input:A,output:v},policy:{auth:"user"},acceptance:{scenarios:[{key:"create-client-happy-path",given:["User is authenticated"],when:["User creates a new client"],then:["Client is created"]}],examples:[{key:"create-basic",input:{name:"Acme Corp",email:"contact@acme.com",phone:"555-0123"},output:{id:"client-123",name:"Acme Corp"}}]}});import{defineSchemaModel as X,ScalarTypeEnum as x}from"@contractspec/lib.schema";var g=X({name:"Invoice",description:"Invoice issued for a job",fields:{id:{type:x.String_unsecure(),isOptional:!1},jobId:{type:x.String_unsecure(),isOptional:!1},invoiceNumber:{type:x.String_unsecure(),isOptional:!1},amount:{type:x.Float_unsecure(),isOptional:!1},currency:{type:x.String_unsecure(),isOptional:!1},status:{type:x.String_unsecure(),isOptional:!1},dueDate:{type:x.DateTime(),isOptional:!0},issuedAt:{type:x.DateTime(),isOptional:!0},paidAt:{type:x.DateTime(),isOptional:!0}}}),k=X({name:"IssueInvoiceInput",description:"Input for issuing an invoice",fields:{jobId:{type:x.String_unsecure(),isOptional:!1},dueDate:{type:x.DateTime(),isOptional:!0},notes:{type:x.String_unsecure(),isOptional:!0},lineItems:{type:x.JSON(),isOptional:!0}}});import{defineCommand as i}from"@contractspec/lib.contracts-spec";var s=["@examples.service-business-os"],Y=i({meta:{key:"service.invoice.issue",version:"1.0.0",stability:"stable",owners:[...s],tags:["service-business-os","invoice","issue"],description:"Issue an invoice for a job.",goal:"Bill clients.",context:"Billing."},io:{input:k,output:g},policy:{auth:"user"},acceptance:{scenarios:[{key:"issue-invoice-happy-path",given:["Job is complete"],when:["User issues invoice"],then:["Invoice is created and sent"]}],examples:[{key:"issue-standard",input:{jobId:"job-123",dueDate:"2025-02-01",items:[{description:"Service",amount:100}]},output:{id:"inv-456",status:"issued",total:100}}]}});import{defineSchemaModel as G,ScalarTypeEnum as o}from"@contractspec/lib.schema";var J=G({name:"Job",description:"Scheduled job",fields:{id:{type:o.String_unsecure(),isOptional:!1},quoteId:{type:o.String_unsecure(),isOptional:!1},clientId:{type:o.String_unsecure(),isOptional:!1},title:{type:o.String_unsecure(),isOptional:!1},status:{type:o.String_unsecure(),isOptional:!1},scheduledAt:{type:o.DateTime(),isOptional:!0},completedAt:{type:o.DateTime(),isOptional:!0},assignedTo:{type:o.String_unsecure(),isOptional:!0}}}),w=G({name:"ScheduleJobInput",description:"Input for scheduling a job",fields:{quoteId:{type:o.String_unsecure(),isOptional:!1},scheduledAt:{type:o.DateTime(),isOptional:!1},assignedTo:{type:o.String_unsecure(),isOptional:!0},location:{type:o.JSON(),isOptional:!0},title:{type:o.String_unsecure(),isOptional:!0}}}),L=G({name:"CompleteJobInput",description:"Input for completing a job",fields:{jobId:{type:o.String_unsecure(),isOptional:!1},completedAt:{type:o.DateTime(),isOptional:!0},notes:{type:o.String_unsecure(),isOptional:!0}}});import{defineCommand as Z,defineQuery as r}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as _,ScalarTypeEnum as Q}from"@contractspec/lib.schema";var H=["@examples.service-business-os"],$=_({name:"ListJobsInput",description:"Input for listing jobs",fields:{status:{type:Q.String_unsecure(),isOptional:!0},clientId:{type:Q.String_unsecure(),isOptional:!0},limit:{type:Q.Int_unsecure(),isOptional:!0},offset:{type:Q.Int_unsecure(),isOptional:!0}}}),j=_({name:"ListJobsOutput",description:"Output for listing jobs",fields:{jobs:{type:J,isOptional:!1,isList:!0},total:{type:Q.Int_unsecure(),isOptional:!1}}}),u=r({meta:{key:"service.job.list",version:"1.0.0",stability:"stable",owners:[...H],tags:["service-business-os","job","list","query"],description:"List all jobs with filtering",goal:"Retrieve list of jobs",context:"Job management"},io:{input:$,output:j},policy:{auth:"user"},acceptance:{scenarios:[{key:"list-jobs-happy-path",given:["Jobs exist"],when:["User lists jobs"],then:["List of jobs is returned"]}],examples:[{key:"list-active",input:{status:"scheduled",limit:10},output:{jobs:[],total:5}}]}}),q=Z({meta:{key:"service.job.schedule",version:"1.0.0",stability:"stable",owners:[...H],tags:["service-business-os","job","schedule"],description:"Schedule a job.",goal:"Schedule work.",context:"Job scheduling."},io:{input:w,output:J},policy:{auth:"user"},acceptance:{scenarios:[{key:"schedule-job-happy-path",given:["Client exists"],when:["User schedules job"],then:["Job is created with status SCHEDULED"]}],examples:[{key:"schedule-repair",input:{clientId:"client-123",date:"2025-01-20T10:00:00Z",type:"repair"},output:{id:"job-456",status:"scheduled"}}]}}),b=Z({meta:{key:"service.job.complete",version:"1.0.0",stability:"stable",owners:[...H],tags:["service-business-os","job","complete"],description:"Mark a job as complete.",goal:"Record job completion.",context:"Job management."},io:{input:L,output:J},policy:{auth:"user"},acceptance:{scenarios:[{key:"complete-job-happy-path",given:["Job is scheduled"],when:["User completes job"],then:["Job status becomes COMPLETED"]}],examples:[{key:"mark-complete",input:{jobId:"job-456",notes:"Done successfully"},output:{id:"job-456",status:"completed"}}]}});import{defineSchemaModel as R,ScalarTypeEnum as I}from"@contractspec/lib.schema";var z=R({name:"Payment",description:"Payment applied to invoice",fields:{id:{type:I.String_unsecure(),isOptional:!1},invoiceId:{type:I.String_unsecure(),isOptional:!1},amount:{type:I.Float_unsecure(),isOptional:!1},currency:{type:I.String_unsecure(),isOptional:!1},method:{type:I.String_unsecure(),isOptional:!1},reference:{type:I.String_unsecure(),isOptional:!0},receivedAt:{type:I.DateTime(),isOptional:!1}}}),B=R({name:"RecordPaymentInput",description:"Input for recording a payment",fields:{invoiceId:{type:I.String_unsecure(),isOptional:!1},amount:{type:I.Float_unsecure(),isOptional:!1},method:{type:I.String_unsecure(),isOptional:!1},reference:{type:I.String_unsecure(),isOptional:!0},receivedAt:{type:I.DateTime(),isOptional:!0}}});import{defineCommand as p}from"@contractspec/lib.contracts-spec";var y=["@examples.service-business-os"],M=p({meta:{key:"service.payment.record",version:"1.0.0",stability:"stable",owners:[...y],tags:["service-business-os","payment","record"],description:"Record a payment.",goal:"Track payments.",context:"Billing."},io:{input:B,output:z},policy:{auth:"user"},acceptance:{scenarios:[{key:"record-payment-happy-path",given:["Invoice exists"],when:["User records payment"],then:["Payment is recorded"]}],examples:[{key:"record-check",input:{invoiceId:"inv-456",amount:100,method:"check"},output:{id:"pay-123",status:"completed"}}]}});import{defineSchemaModel as K,ScalarTypeEnum as t}from"@contractspec/lib.schema";var P=K({name:"Quote",description:"Quote/proposal",fields:{id:{type:t.String_unsecure(),isOptional:!1},clientId:{type:t.String_unsecure(),isOptional:!1},title:{type:t.String_unsecure(),isOptional:!1},description:{type:t.String_unsecure(),isOptional:!0},amount:{type:t.Float_unsecure(),isOptional:!1},currency:{type:t.String_unsecure(),isOptional:!1},status:{type:t.String_unsecure(),isOptional:!1},validUntil:{type:t.DateTime(),isOptional:!0},createdAt:{type:t.DateTime(),isOptional:!1}}}),D=K({name:"CreateQuoteInput",description:"Input for creating a quote",fields:{clientId:{type:t.String_unsecure(),isOptional:!1},title:{type:t.String_unsecure(),isOptional:!1},description:{type:t.String_unsecure(),isOptional:!0},amount:{type:t.Float_unsecure(),isOptional:!1},currency:{type:t.String_unsecure(),isOptional:!0},validUntil:{type:t.DateTime(),isOptional:!0},orgId:{type:t.String_unsecure(),isOptional:!1},ownerId:{type:t.String_unsecure(),isOptional:!1}}}),F=K({name:"AcceptQuoteInput",description:"Input for accepting a quote",fields:{quoteId:{type:t.String_unsecure(),isOptional:!1},acceptedBy:{type:t.String_unsecure(),isOptional:!1},notes:{type:t.String_unsecure(),isOptional:!0}}});import{defineCommand as O}from"@contractspec/lib.contracts-spec";var N=["@examples.service-business-os"],W=O({meta:{key:"service.quote.create",version:"1.0.0",stability:"stable",owners:[...N],tags:["service-business-os","quote","create"],description:"Create a quote/proposal.",goal:"Quote clients.",context:"Quote creation."},io:{input:D,output:P},policy:{auth:"user"},acceptance:{scenarios:[{key:"create-quote-happy-path",given:["Client exists"],when:["User creates quote"],then:["Quote is created"]}],examples:[{key:"create-proposal",input:{clientId:"client-123",items:[{description:"Project A",price:5000}]},output:{id:"quote-123",status:"draft",total:5000}}]}}),f=O({meta:{key:"service.quote.accept",version:"1.0.0",stability:"stable",owners:[...N],tags:["service-business-os","quote","accept"],description:"Accept a quote.",goal:"Confirm quote.",context:"Quote acceptance."},io:{input:F,output:P},policy:{auth:"user"},acceptance:{scenarios:[{key:"accept-quote-happy-path",given:["Quote is open"],when:["Client accepts quote"],then:["Quote status becomes ACCEPTED"]}],examples:[{key:"client-accepts",input:{quoteId:"quote-123",signature:"John Doe"},output:{id:"quote-123",status:"accepted"}}]}});export{w as ScheduleJobInputModel,q as ScheduleJobContract,B as RecordPaymentInputModel,M as RecordPaymentContract,P as QuoteModel,z as PaymentModel,J as JobModel,k as IssueInvoiceInputModel,Y as IssueInvoiceContract,g as InvoiceModel,D as CreateQuoteInputModel,W as CreateQuoteContract,A as CreateClientInputModel,V as CreateClientContract,L as CompleteJobInputModel,b as CompleteJobContract,v as ClientModel,F as AcceptQuoteInputModel,f as AcceptQuoteContract};
@@ -1,69 +1 @@
1
- // src/payment/payment.schema.ts
2
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
3
- var PaymentModel = defineSchemaModel({
4
- name: "Payment",
5
- description: "Payment applied to invoice",
6
- fields: {
7
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
8
- invoiceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
9
- amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
10
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
- method: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
12
- reference: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
13
- receivedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
14
- }
15
- });
16
- var RecordPaymentInputModel = defineSchemaModel({
17
- name: "RecordPaymentInput",
18
- description: "Input for recording a payment",
19
- fields: {
20
- invoiceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
21
- amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
22
- method: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
23
- reference: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
24
- receivedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
25
- }
26
- });
27
-
28
- // src/payment/payment.operations.ts
29
- import { defineCommand } from "@contractspec/lib.contracts-spec";
30
- var OWNERS = ["@examples.service-business-os"];
31
- var RecordPaymentContract = defineCommand({
32
- meta: {
33
- key: "service.payment.record",
34
- version: "1.0.0",
35
- stability: "stable",
36
- owners: [...OWNERS],
37
- tags: ["service-business-os", "payment", "record"],
38
- description: "Record a payment.",
39
- goal: "Track payments.",
40
- context: "Billing."
41
- },
42
- io: {
43
- input: RecordPaymentInputModel,
44
- output: PaymentModel
45
- },
46
- policy: { auth: "user" },
47
- acceptance: {
48
- scenarios: [
49
- {
50
- key: "record-payment-happy-path",
51
- given: ["Invoice exists"],
52
- when: ["User records payment"],
53
- then: ["Payment is recorded"]
54
- }
55
- ],
56
- examples: [
57
- {
58
- key: "record-check",
59
- input: { invoiceId: "inv-456", amount: 100, method: "check" },
60
- output: { id: "pay-123", status: "completed" }
61
- }
62
- ]
63
- }
64
- });
65
- export {
66
- RecordPaymentInputModel,
67
- RecordPaymentContract,
68
- PaymentModel
69
- };
1
+ import{defineSchemaModel as j,ScalarTypeEnum as P}from"@contractspec/lib.schema";var x=j({name:"Payment",description:"Payment applied to invoice",fields:{id:{type:P.String_unsecure(),isOptional:!1},invoiceId:{type:P.String_unsecure(),isOptional:!1},amount:{type:P.Float_unsecure(),isOptional:!1},currency:{type:P.String_unsecure(),isOptional:!1},method:{type:P.String_unsecure(),isOptional:!1},reference:{type:P.String_unsecure(),isOptional:!0},receivedAt:{type:P.DateTime(),isOptional:!1}}}),g=j({name:"RecordPaymentInput",description:"Input for recording a payment",fields:{invoiceId:{type:P.String_unsecure(),isOptional:!1},amount:{type:P.Float_unsecure(),isOptional:!1},method:{type:P.String_unsecure(),isOptional:!1},reference:{type:P.String_unsecure(),isOptional:!0},receivedAt:{type:P.DateTime(),isOptional:!0}}});import{defineCommand as k}from"@contractspec/lib.contracts-spec";var q=["@examples.service-business-os"],v=k({meta:{key:"service.payment.record",version:"1.0.0",stability:"stable",owners:[...q],tags:["service-business-os","payment","record"],description:"Record a payment.",goal:"Track payments.",context:"Billing."},io:{input:g,output:x},policy:{auth:"user"},acceptance:{scenarios:[{key:"record-payment-happy-path",given:["Invoice exists"],when:["User records payment"],then:["Payment is recorded"]}],examples:[{key:"record-check",input:{invoiceId:"inv-456",amount:100,method:"check"},output:{id:"pay-123",status:"completed"}}]}});export{g as RecordPaymentInputModel,v as RecordPaymentContract,x as PaymentModel};
@@ -1,67 +1 @@
1
- // src/payment/payment.schema.ts
2
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
3
- var PaymentModel = defineSchemaModel({
4
- name: "Payment",
5
- description: "Payment applied to invoice",
6
- fields: {
7
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
8
- invoiceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
9
- amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
10
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
- method: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
12
- reference: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
13
- receivedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
14
- }
15
- });
16
- var RecordPaymentInputModel = defineSchemaModel({
17
- name: "RecordPaymentInput",
18
- description: "Input for recording a payment",
19
- fields: {
20
- invoiceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
21
- amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
22
- method: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
23
- reference: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
24
- receivedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
25
- }
26
- });
27
-
28
- // src/payment/payment.operations.ts
29
- import { defineCommand } from "@contractspec/lib.contracts-spec";
30
- var OWNERS = ["@examples.service-business-os"];
31
- var RecordPaymentContract = defineCommand({
32
- meta: {
33
- key: "service.payment.record",
34
- version: "1.0.0",
35
- stability: "stable",
36
- owners: [...OWNERS],
37
- tags: ["service-business-os", "payment", "record"],
38
- description: "Record a payment.",
39
- goal: "Track payments.",
40
- context: "Billing."
41
- },
42
- io: {
43
- input: RecordPaymentInputModel,
44
- output: PaymentModel
45
- },
46
- policy: { auth: "user" },
47
- acceptance: {
48
- scenarios: [
49
- {
50
- key: "record-payment-happy-path",
51
- given: ["Invoice exists"],
52
- when: ["User records payment"],
53
- then: ["Payment is recorded"]
54
- }
55
- ],
56
- examples: [
57
- {
58
- key: "record-check",
59
- input: { invoiceId: "inv-456", amount: 100, method: "check" },
60
- output: { id: "pay-123", status: "completed" }
61
- }
62
- ]
63
- }
64
- });
65
- export {
66
- RecordPaymentContract
67
- };
1
+ import{defineSchemaModel as k,ScalarTypeEnum as j}from"@contractspec/lib.schema";var q=k({name:"Payment",description:"Payment applied to invoice",fields:{id:{type:j.String_unsecure(),isOptional:!1},invoiceId:{type:j.String_unsecure(),isOptional:!1},amount:{type:j.Float_unsecure(),isOptional:!1},currency:{type:j.String_unsecure(),isOptional:!1},method:{type:j.String_unsecure(),isOptional:!1},reference:{type:j.String_unsecure(),isOptional:!0},receivedAt:{type:j.DateTime(),isOptional:!1}}}),v=k({name:"RecordPaymentInput",description:"Input for recording a payment",fields:{invoiceId:{type:j.String_unsecure(),isOptional:!1},amount:{type:j.Float_unsecure(),isOptional:!1},method:{type:j.String_unsecure(),isOptional:!1},reference:{type:j.String_unsecure(),isOptional:!0},receivedAt:{type:j.DateTime(),isOptional:!0}}});import{defineCommand as w}from"@contractspec/lib.contracts-spec";var x=["@examples.service-business-os"],F=w({meta:{key:"service.payment.record",version:"1.0.0",stability:"stable",owners:[...x],tags:["service-business-os","payment","record"],description:"Record a payment.",goal:"Track payments.",context:"Billing."},io:{input:v,output:q},policy:{auth:"user"},acceptance:{scenarios:[{key:"record-payment-happy-path",given:["Invoice exists"],when:["User records payment"],then:["Payment is recorded"]}],examples:[{key:"record-check",input:{invoiceId:"inv-456",amount:100,method:"check"},output:{id:"pay-123",status:"completed"}}]}});export{F as RecordPaymentContract};