@contractspec/example.service-business-os 3.7.6 → 3.7.7

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.
@@ -68,117 +68,74 @@ var CreateClientContract = defineCommand({
68
68
  ]
69
69
  }
70
70
  });
71
- // src/quote/quote.schema.ts
71
+ // src/invoice/invoice.schema.ts
72
72
  import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
73
- var QuoteModel = defineSchemaModel2({
74
- name: "Quote",
75
- description: "Quote/proposal",
73
+ var InvoiceModel = defineSchemaModel2({
74
+ name: "Invoice",
75
+ description: "Invoice issued for a job",
76
76
  fields: {
77
77
  id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
78
- clientId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
79
- title: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
80
- description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
78
+ jobId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
79
+ invoiceNumber: {
80
+ type: ScalarTypeEnum2.String_unsecure(),
81
+ isOptional: false
82
+ },
81
83
  amount: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
82
84
  currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
83
85
  status: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
84
- validUntil: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
85
- createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
86
+ dueDate: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
87
+ issuedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
88
+ paidAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true }
86
89
  }
87
90
  });
88
- var CreateQuoteInputModel = defineSchemaModel2({
89
- name: "CreateQuoteInput",
90
- description: "Input for creating a quote",
91
- fields: {
92
- clientId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
93
- title: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
94
- description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
95
- amount: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
96
- currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
97
- validUntil: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
98
- orgId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
99
- ownerId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
100
- }
101
- });
102
- var AcceptQuoteInputModel = defineSchemaModel2({
103
- name: "AcceptQuoteInput",
104
- description: "Input for accepting a quote",
91
+ var IssueInvoiceInputModel = defineSchemaModel2({
92
+ name: "IssueInvoiceInput",
93
+ description: "Input for issuing an invoice",
105
94
  fields: {
106
- quoteId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
107
- acceptedBy: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
108
- notes: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
95
+ jobId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
96
+ dueDate: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
97
+ notes: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
98
+ lineItems: { type: ScalarTypeEnum2.JSON(), isOptional: true }
109
99
  }
110
100
  });
111
101
 
112
- // src/quote/quote.operations.ts
102
+ // src/invoice/invoice.operations.ts
113
103
  import { defineCommand as defineCommand2 } from "@contractspec/lib.contracts-spec";
114
104
  var OWNERS2 = ["@examples.service-business-os"];
115
- var CreateQuoteContract = defineCommand2({
105
+ var IssueInvoiceContract = defineCommand2({
116
106
  meta: {
117
- key: "service.quote.create",
107
+ key: "service.invoice.issue",
118
108
  version: "1.0.0",
119
109
  stability: "stable",
120
110
  owners: [...OWNERS2],
121
- tags: ["service-business-os", "quote", "create"],
122
- description: "Create a quote/proposal.",
123
- goal: "Quote clients.",
124
- context: "Quote creation."
111
+ tags: ["service-business-os", "invoice", "issue"],
112
+ description: "Issue an invoice for a job.",
113
+ goal: "Bill clients.",
114
+ context: "Billing."
125
115
  },
126
116
  io: {
127
- input: CreateQuoteInputModel,
128
- output: QuoteModel
117
+ input: IssueInvoiceInputModel,
118
+ output: InvoiceModel
129
119
  },
130
120
  policy: { auth: "user" },
131
121
  acceptance: {
132
122
  scenarios: [
133
123
  {
134
- key: "create-quote-happy-path",
135
- given: ["Client exists"],
136
- when: ["User creates quote"],
137
- then: ["Quote is created"]
124
+ key: "issue-invoice-happy-path",
125
+ given: ["Job is complete"],
126
+ when: ["User issues invoice"],
127
+ then: ["Invoice is created and sent"]
138
128
  }
139
129
  ],
140
130
  examples: [
141
131
  {
142
- key: "create-proposal",
132
+ key: "issue-standard",
143
133
  input: {
144
- clientId: "client-123",
145
- items: [{ description: "Project A", price: 5000 }]
134
+ jobId: "job-123",
135
+ dueDate: "2025-02-01",
136
+ items: [{ description: "Service", amount: 100 }]
146
137
  },
147
- output: { id: "quote-123", status: "draft", total: 5000 }
148
- }
149
- ]
150
- }
151
- });
152
- var AcceptQuoteContract = defineCommand2({
153
- meta: {
154
- key: "service.quote.accept",
155
- version: "1.0.0",
156
- stability: "stable",
157
- owners: [...OWNERS2],
158
- tags: ["service-business-os", "quote", "accept"],
159
- description: "Accept a quote.",
160
- goal: "Confirm quote.",
161
- context: "Quote acceptance."
162
- },
163
- io: {
164
- input: AcceptQuoteInputModel,
165
- output: QuoteModel
166
- },
167
- policy: { auth: "user" },
168
- acceptance: {
169
- scenarios: [
170
- {
171
- key: "accept-quote-happy-path",
172
- given: ["Quote is open"],
173
- when: ["Client accepts quote"],
174
- then: ["Quote status becomes ACCEPTED"]
175
- }
176
- ],
177
- examples: [
178
- {
179
- key: "client-accepts",
180
- input: { quoteId: "quote-123", signature: "John Doe" },
181
- output: { id: "quote-123", status: "accepted" }
138
+ output: { id: "inv-456", status: "issued", total: 100 }
182
139
  }
183
140
  ]
184
141
  }
@@ -348,138 +305,181 @@ var CompleteJobContract = defineCommand3({
348
305
  ]
349
306
  }
350
307
  });
351
- // src/invoice/invoice.schema.ts
308
+ // src/payment/payment.schema.ts
352
309
  import { defineSchemaModel as defineSchemaModel5, ScalarTypeEnum as ScalarTypeEnum5 } from "@contractspec/lib.schema";
353
- var InvoiceModel = defineSchemaModel5({
354
- name: "Invoice",
355
- description: "Invoice issued for a job",
310
+ var PaymentModel = defineSchemaModel5({
311
+ name: "Payment",
312
+ description: "Payment applied to invoice",
356
313
  fields: {
357
314
  id: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
358
- jobId: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
359
- invoiceNumber: {
360
- type: ScalarTypeEnum5.String_unsecure(),
361
- isOptional: false
362
- },
315
+ invoiceId: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
363
316
  amount: { type: ScalarTypeEnum5.Float_unsecure(), isOptional: false },
364
317
  currency: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
365
- status: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
366
- dueDate: { type: ScalarTypeEnum5.DateTime(), isOptional: true },
367
- issuedAt: { type: ScalarTypeEnum5.DateTime(), isOptional: true },
368
- paidAt: { type: ScalarTypeEnum5.DateTime(), isOptional: true }
318
+ method: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
319
+ reference: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
320
+ receivedAt: { type: ScalarTypeEnum5.DateTime(), isOptional: false }
369
321
  }
370
322
  });
371
- var IssueInvoiceInputModel = defineSchemaModel5({
372
- name: "IssueInvoiceInput",
373
- description: "Input for issuing an invoice",
323
+ var RecordPaymentInputModel = defineSchemaModel5({
324
+ name: "RecordPaymentInput",
325
+ description: "Input for recording a payment",
374
326
  fields: {
375
- jobId: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
376
- dueDate: { type: ScalarTypeEnum5.DateTime(), isOptional: true },
377
- notes: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
378
- lineItems: { type: ScalarTypeEnum5.JSON(), isOptional: true }
327
+ invoiceId: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
328
+ amount: { type: ScalarTypeEnum5.Float_unsecure(), isOptional: false },
329
+ method: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
330
+ reference: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
331
+ receivedAt: { type: ScalarTypeEnum5.DateTime(), isOptional: true }
379
332
  }
380
333
  });
381
334
 
382
- // src/invoice/invoice.operations.ts
335
+ // src/payment/payment.operations.ts
383
336
  import { defineCommand as defineCommand4 } from "@contractspec/lib.contracts-spec";
384
337
  var OWNERS4 = ["@examples.service-business-os"];
385
- var IssueInvoiceContract = defineCommand4({
338
+ var RecordPaymentContract = defineCommand4({
386
339
  meta: {
387
- key: "service.invoice.issue",
340
+ key: "service.payment.record",
388
341
  version: "1.0.0",
389
342
  stability: "stable",
390
343
  owners: [...OWNERS4],
391
- tags: ["service-business-os", "invoice", "issue"],
392
- description: "Issue an invoice for a job.",
393
- goal: "Bill clients.",
344
+ tags: ["service-business-os", "payment", "record"],
345
+ description: "Record a payment.",
346
+ goal: "Track payments.",
394
347
  context: "Billing."
395
348
  },
396
349
  io: {
397
- input: IssueInvoiceInputModel,
398
- output: InvoiceModel
350
+ input: RecordPaymentInputModel,
351
+ output: PaymentModel
399
352
  },
400
353
  policy: { auth: "user" },
401
354
  acceptance: {
402
355
  scenarios: [
403
356
  {
404
- key: "issue-invoice-happy-path",
405
- given: ["Job is complete"],
406
- when: ["User issues invoice"],
407
- then: ["Invoice is created and sent"]
357
+ key: "record-payment-happy-path",
358
+ given: ["Invoice exists"],
359
+ when: ["User records payment"],
360
+ then: ["Payment is recorded"]
408
361
  }
409
362
  ],
410
363
  examples: [
411
364
  {
412
- key: "issue-standard",
413
- input: {
414
- jobId: "job-123",
415
- dueDate: "2025-02-01",
416
- items: [{ description: "Service", amount: 100 }]
417
- },
418
- output: { id: "inv-456", status: "issued", total: 100 }
365
+ key: "record-check",
366
+ input: { invoiceId: "inv-456", amount: 100, method: "check" },
367
+ output: { id: "pay-123", status: "completed" }
419
368
  }
420
369
  ]
421
370
  }
422
371
  });
423
- // src/payment/payment.schema.ts
372
+ // src/quote/quote.schema.ts
424
373
  import { defineSchemaModel as defineSchemaModel6, ScalarTypeEnum as ScalarTypeEnum6 } from "@contractspec/lib.schema";
425
- var PaymentModel = defineSchemaModel6({
426
- name: "Payment",
427
- description: "Payment applied to invoice",
374
+ var QuoteModel = defineSchemaModel6({
375
+ name: "Quote",
376
+ description: "Quote/proposal",
428
377
  fields: {
429
378
  id: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
430
- invoiceId: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
379
+ clientId: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
380
+ title: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
381
+ description: { type: ScalarTypeEnum6.String_unsecure(), isOptional: true },
431
382
  amount: { type: ScalarTypeEnum6.Float_unsecure(), isOptional: false },
432
383
  currency: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
433
- method: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
434
- reference: { type: ScalarTypeEnum6.String_unsecure(), isOptional: true },
435
- receivedAt: { type: ScalarTypeEnum6.DateTime(), isOptional: false }
384
+ status: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
385
+ validUntil: { type: ScalarTypeEnum6.DateTime(), isOptional: true },
386
+ createdAt: { type: ScalarTypeEnum6.DateTime(), isOptional: false }
436
387
  }
437
388
  });
438
- var RecordPaymentInputModel = defineSchemaModel6({
439
- name: "RecordPaymentInput",
440
- description: "Input for recording a payment",
389
+ var CreateQuoteInputModel = defineSchemaModel6({
390
+ name: "CreateQuoteInput",
391
+ description: "Input for creating a quote",
441
392
  fields: {
442
- invoiceId: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
393
+ clientId: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
394
+ title: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
395
+ description: { type: ScalarTypeEnum6.String_unsecure(), isOptional: true },
443
396
  amount: { type: ScalarTypeEnum6.Float_unsecure(), isOptional: false },
444
- method: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
445
- reference: { type: ScalarTypeEnum6.String_unsecure(), isOptional: true },
446
- receivedAt: { type: ScalarTypeEnum6.DateTime(), isOptional: true }
397
+ currency: { type: ScalarTypeEnum6.String_unsecure(), isOptional: true },
398
+ validUntil: { type: ScalarTypeEnum6.DateTime(), isOptional: true },
399
+ orgId: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
400
+ ownerId: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false }
401
+ }
402
+ });
403
+ var AcceptQuoteInputModel = defineSchemaModel6({
404
+ name: "AcceptQuoteInput",
405
+ description: "Input for accepting a quote",
406
+ fields: {
407
+ quoteId: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
408
+ acceptedBy: { type: ScalarTypeEnum6.String_unsecure(), isOptional: false },
409
+ notes: { type: ScalarTypeEnum6.String_unsecure(), isOptional: true }
447
410
  }
448
411
  });
449
412
 
450
- // src/payment/payment.operations.ts
413
+ // src/quote/quote.operations.ts
451
414
  import { defineCommand as defineCommand5 } from "@contractspec/lib.contracts-spec";
452
415
  var OWNERS5 = ["@examples.service-business-os"];
453
- var RecordPaymentContract = defineCommand5({
416
+ var CreateQuoteContract = defineCommand5({
454
417
  meta: {
455
- key: "service.payment.record",
418
+ key: "service.quote.create",
456
419
  version: "1.0.0",
457
420
  stability: "stable",
458
421
  owners: [...OWNERS5],
459
- tags: ["service-business-os", "payment", "record"],
460
- description: "Record a payment.",
461
- goal: "Track payments.",
462
- context: "Billing."
422
+ tags: ["service-business-os", "quote", "create"],
423
+ description: "Create a quote/proposal.",
424
+ goal: "Quote clients.",
425
+ context: "Quote creation."
463
426
  },
464
427
  io: {
465
- input: RecordPaymentInputModel,
466
- output: PaymentModel
428
+ input: CreateQuoteInputModel,
429
+ output: QuoteModel
467
430
  },
468
431
  policy: { auth: "user" },
469
432
  acceptance: {
470
433
  scenarios: [
471
434
  {
472
- key: "record-payment-happy-path",
473
- given: ["Invoice exists"],
474
- when: ["User records payment"],
475
- then: ["Payment is recorded"]
435
+ key: "create-quote-happy-path",
436
+ given: ["Client exists"],
437
+ when: ["User creates quote"],
438
+ then: ["Quote is created"]
476
439
  }
477
440
  ],
478
441
  examples: [
479
442
  {
480
- key: "record-check",
481
- input: { invoiceId: "inv-456", amount: 100, method: "check" },
482
- output: { id: "pay-123", status: "completed" }
443
+ key: "create-proposal",
444
+ input: {
445
+ clientId: "client-123",
446
+ items: [{ description: "Project A", price: 5000 }]
447
+ },
448
+ output: { id: "quote-123", status: "draft", total: 5000 }
449
+ }
450
+ ]
451
+ }
452
+ });
453
+ var AcceptQuoteContract = defineCommand5({
454
+ meta: {
455
+ key: "service.quote.accept",
456
+ version: "1.0.0",
457
+ stability: "stable",
458
+ owners: [...OWNERS5],
459
+ tags: ["service-business-os", "quote", "accept"],
460
+ description: "Accept a quote.",
461
+ goal: "Confirm quote.",
462
+ context: "Quote acceptance."
463
+ },
464
+ io: {
465
+ input: AcceptQuoteInputModel,
466
+ output: QuoteModel
467
+ },
468
+ policy: { auth: "user" },
469
+ acceptance: {
470
+ scenarios: [
471
+ {
472
+ key: "accept-quote-happy-path",
473
+ given: ["Quote is open"],
474
+ when: ["Client accepts quote"],
475
+ then: ["Quote status becomes ACCEPTED"]
476
+ }
477
+ ],
478
+ examples: [
479
+ {
480
+ key: "client-accepts",
481
+ input: { quoteId: "quote-123", signature: "John Doe" },
482
+ output: { id: "quote-123", status: "accepted" }
483
483
  }
484
484
  ]
485
485
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Payment domain - Payment management.
3
3
  */
4
- export { PaymentModel, RecordPaymentInputModel } from './payment.schema';
5
4
  export { RecordPaymentContract } from './payment.operations';
5
+ export { PaymentModel, RecordPaymentInputModel } from './payment.schema';
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Quote domain - Quote/proposal management.
3
3
  */
4
- export { QuoteModel, CreateQuoteInputModel, AcceptQuoteInputModel, } from './quote.schema';
5
- export { CreateQuoteContract, AcceptQuoteContract } from './quote.operations';
4
+ export { AcceptQuoteContract, CreateQuoteContract } from './quote.operations';
5
+ export { AcceptQuoteInputModel, CreateQuoteInputModel, QuoteModel, } from './quote.schema';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/example.service-business-os",
3
- "version": "3.7.6",
3
+ "version": "3.7.7",
4
4
  "description": "Service Business OS example (clients, quotes, jobs, invoices) for ContractSpec",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -13,14 +13,14 @@
13
13
  "dev": "contractspec-bun-build dev",
14
14
  "clean": "rimraf dist .turbo",
15
15
  "lint": "bun lint:fix",
16
- "lint:fix": "eslint src --fix",
17
- "lint:check": "eslint src",
16
+ "lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
17
+ "lint:check": "biome check .",
18
18
  "prebuild": "contractspec-bun-build prebuild",
19
19
  "typecheck": "tsc --noEmit"
20
20
  },
21
21
  "dependencies": {
22
22
  "@contractspec/lib.schema": "3.7.6",
23
- "@contractspec/lib.contracts-spec": "3.7.6"
23
+ "@contractspec/lib.contracts-spec": "4.0.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@contractspec/tool.typescript": "3.7.6",