@contractspec/example.service-business-os 3.7.17 → 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 +5 -5
@@ -1,78 +1,2 @@
1
1
  // @bun
2
- // src/invoice/invoice.schema.ts
3
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
4
- var InvoiceModel = defineSchemaModel({
5
- name: "Invoice",
6
- description: "Invoice issued for a job",
7
- fields: {
8
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
9
- jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
10
- invoiceNumber: {
11
- type: ScalarTypeEnum.String_unsecure(),
12
- isOptional: false
13
- },
14
- amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
15
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
16
- status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
17
- dueDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },
18
- issuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
19
- paidAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
20
- }
21
- });
22
- var IssueInvoiceInputModel = defineSchemaModel({
23
- name: "IssueInvoiceInput",
24
- description: "Input for issuing an invoice",
25
- fields: {
26
- jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
27
- dueDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },
28
- notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
29
- lineItems: { type: ScalarTypeEnum.JSON(), isOptional: true }
30
- }
31
- });
32
-
33
- // src/invoice/invoice.operations.ts
34
- import { defineCommand } from "@contractspec/lib.contracts-spec";
35
- var OWNERS = ["@examples.service-business-os"];
36
- var IssueInvoiceContract = defineCommand({
37
- meta: {
38
- key: "service.invoice.issue",
39
- version: "1.0.0",
40
- stability: "stable",
41
- owners: [...OWNERS],
42
- tags: ["service-business-os", "invoice", "issue"],
43
- description: "Issue an invoice for a job.",
44
- goal: "Bill clients.",
45
- context: "Billing."
46
- },
47
- io: {
48
- input: IssueInvoiceInputModel,
49
- output: InvoiceModel
50
- },
51
- policy: { auth: "user" },
52
- acceptance: {
53
- scenarios: [
54
- {
55
- key: "issue-invoice-happy-path",
56
- given: ["Job is complete"],
57
- when: ["User issues invoice"],
58
- then: ["Invoice is created and sent"]
59
- }
60
- ],
61
- examples: [
62
- {
63
- key: "issue-standard",
64
- input: {
65
- jobId: "job-123",
66
- dueDate: "2025-02-01",
67
- items: [{ description: "Service", amount: 100 }]
68
- },
69
- output: { id: "inv-456", status: "issued", total: 100 }
70
- }
71
- ]
72
- }
73
- });
74
- export {
75
- IssueInvoiceInputModel,
76
- IssueInvoiceContract,
77
- InvoiceModel
78
- };
2
+ import{defineSchemaModel as g,ScalarTypeEnum as I}from"@contractspec/lib.schema";var x=g({name:"Invoice",description:"Invoice issued for a job",fields:{id:{type:I.String_unsecure(),isOptional:!1},jobId:{type:I.String_unsecure(),isOptional:!1},invoiceNumber:{type:I.String_unsecure(),isOptional:!1},amount:{type:I.Float_unsecure(),isOptional:!1},currency:{type:I.String_unsecure(),isOptional:!1},status:{type:I.String_unsecure(),isOptional:!1},dueDate:{type:I.DateTime(),isOptional:!0},issuedAt:{type:I.DateTime(),isOptional:!0},paidAt:{type:I.DateTime(),isOptional:!0}}}),v=g({name:"IssueInvoiceInput",description:"Input for issuing an invoice",fields:{jobId:{type:I.String_unsecure(),isOptional:!1},dueDate:{type:I.DateTime(),isOptional:!0},notes:{type:I.String_unsecure(),isOptional:!0},lineItems:{type:I.JSON(),isOptional:!0}}});import{defineCommand as j}from"@contractspec/lib.contracts-spec";var k=["@examples.service-business-os"],o=j({meta:{key:"service.invoice.issue",version:"1.0.0",stability:"stable",owners:[...k],tags:["service-business-os","invoice","issue"],description:"Issue an invoice for a job.",goal:"Bill clients.",context:"Billing."},io:{input:v,output:x},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}}]}});export{v as IssueInvoiceInputModel,o as IssueInvoiceContract,x as InvoiceModel};
@@ -1,76 +1,2 @@
1
1
  // @bun
2
- // src/invoice/invoice.schema.ts
3
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
4
- var InvoiceModel = defineSchemaModel({
5
- name: "Invoice",
6
- description: "Invoice issued for a job",
7
- fields: {
8
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
9
- jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
10
- invoiceNumber: {
11
- type: ScalarTypeEnum.String_unsecure(),
12
- isOptional: false
13
- },
14
- amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
15
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
16
- status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
17
- dueDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },
18
- issuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
19
- paidAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
20
- }
21
- });
22
- var IssueInvoiceInputModel = defineSchemaModel({
23
- name: "IssueInvoiceInput",
24
- description: "Input for issuing an invoice",
25
- fields: {
26
- jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
27
- dueDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },
28
- notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
29
- lineItems: { type: ScalarTypeEnum.JSON(), isOptional: true }
30
- }
31
- });
32
-
33
- // src/invoice/invoice.operations.ts
34
- import { defineCommand } from "@contractspec/lib.contracts-spec";
35
- var OWNERS = ["@examples.service-business-os"];
36
- var IssueInvoiceContract = defineCommand({
37
- meta: {
38
- key: "service.invoice.issue",
39
- version: "1.0.0",
40
- stability: "stable",
41
- owners: [...OWNERS],
42
- tags: ["service-business-os", "invoice", "issue"],
43
- description: "Issue an invoice for a job.",
44
- goal: "Bill clients.",
45
- context: "Billing."
46
- },
47
- io: {
48
- input: IssueInvoiceInputModel,
49
- output: InvoiceModel
50
- },
51
- policy: { auth: "user" },
52
- acceptance: {
53
- scenarios: [
54
- {
55
- key: "issue-invoice-happy-path",
56
- given: ["Job is complete"],
57
- when: ["User issues invoice"],
58
- then: ["Invoice is created and sent"]
59
- }
60
- ],
61
- examples: [
62
- {
63
- key: "issue-standard",
64
- input: {
65
- jobId: "job-123",
66
- dueDate: "2025-02-01",
67
- items: [{ description: "Service", amount: 100 }]
68
- },
69
- output: { id: "inv-456", status: "issued", total: 100 }
70
- }
71
- ]
72
- }
73
- });
74
- export {
75
- IssueInvoiceContract
76
- };
2
+ import{defineSchemaModel as k,ScalarTypeEnum as j}from"@contractspec/lib.schema";var q=k({name:"Invoice",description:"Invoice issued for a job",fields:{id:{type:j.String_unsecure(),isOptional:!1},jobId:{type:j.String_unsecure(),isOptional:!1},invoiceNumber:{type:j.String_unsecure(),isOptional:!1},amount:{type:j.Float_unsecure(),isOptional:!1},currency:{type:j.String_unsecure(),isOptional:!1},status:{type:j.String_unsecure(),isOptional:!1},dueDate:{type:j.DateTime(),isOptional:!0},issuedAt:{type:j.DateTime(),isOptional:!0},paidAt:{type:j.DateTime(),isOptional:!0}}}),w=k({name:"IssueInvoiceInput",description:"Input for issuing an invoice",fields:{jobId:{type:j.String_unsecure(),isOptional:!1},dueDate:{type:j.DateTime(),isOptional:!0},notes:{type:j.String_unsecure(),isOptional:!0},lineItems:{type:j.JSON(),isOptional:!0}}});import{defineCommand as x}from"@contractspec/lib.contracts-spec";var z=["@examples.service-business-os"],G=x({meta:{key:"service.invoice.issue",version:"1.0.0",stability:"stable",owners:[...z],tags:["service-business-os","invoice","issue"],description:"Issue an invoice for a job.",goal:"Bill clients.",context:"Billing."},io:{input:w,output:q},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}}]}});export{G as IssueInvoiceContract};
@@ -1,35 +1,2 @@
1
1
  // @bun
2
- // src/invoice/invoice.schema.ts
3
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
4
- var InvoiceModel = defineSchemaModel({
5
- name: "Invoice",
6
- description: "Invoice issued for a job",
7
- fields: {
8
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
9
- jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
10
- invoiceNumber: {
11
- type: ScalarTypeEnum.String_unsecure(),
12
- isOptional: false
13
- },
14
- amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
15
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
16
- status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
17
- dueDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },
18
- issuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
19
- paidAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
20
- }
21
- });
22
- var IssueInvoiceInputModel = defineSchemaModel({
23
- name: "IssueInvoiceInput",
24
- description: "Input for issuing an invoice",
25
- fields: {
26
- jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
27
- dueDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },
28
- notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
29
- lineItems: { type: ScalarTypeEnum.JSON(), isOptional: true }
30
- }
31
- });
32
- export {
33
- IssueInvoiceInputModel,
34
- InvoiceModel
35
- };
2
+ import{defineSchemaModel as k,ScalarTypeEnum as j}from"@contractspec/lib.schema";var w=k({name:"Invoice",description:"Invoice issued for a job",fields:{id:{type:j.String_unsecure(),isOptional:!1},jobId:{type:j.String_unsecure(),isOptional:!1},invoiceNumber:{type:j.String_unsecure(),isOptional:!1},amount:{type:j.Float_unsecure(),isOptional:!1},currency:{type:j.String_unsecure(),isOptional:!1},status:{type:j.String_unsecure(),isOptional:!1},dueDate:{type:j.DateTime(),isOptional:!0},issuedAt:{type:j.DateTime(),isOptional:!0},paidAt:{type:j.DateTime(),isOptional:!0}}}),x=k({name:"IssueInvoiceInput",description:"Input for issuing an invoice",fields:{jobId:{type:j.String_unsecure(),isOptional:!1},dueDate:{type:j.DateTime(),isOptional:!0},notes:{type:j.String_unsecure(),isOptional:!0},lineItems:{type:j.JSON(),isOptional:!0}}});export{x as IssueInvoiceInputModel,w as InvoiceModel};
package/dist/job/index.js CHANGED
@@ -1,176 +1,2 @@
1
1
  // @bun
2
- // src/job/job.schema.ts
3
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
4
- var JobModel = defineSchemaModel({
5
- name: "Job",
6
- description: "Scheduled job",
7
- fields: {
8
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
9
- quoteId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
10
- clientId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
- title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
12
- status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
13
- scheduledAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
14
- completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
15
- assignedTo: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
16
- }
17
- });
18
- var ScheduleJobInputModel = defineSchemaModel({
19
- name: "ScheduleJobInput",
20
- description: "Input for scheduling a job",
21
- fields: {
22
- quoteId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
23
- scheduledAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
24
- assignedTo: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
25
- location: { type: ScalarTypeEnum.JSON(), isOptional: true },
26
- title: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
27
- }
28
- });
29
- var CompleteJobInputModel = defineSchemaModel({
30
- name: "CompleteJobInput",
31
- description: "Input for completing a job",
32
- fields: {
33
- jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
34
- completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
35
- notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
36
- }
37
- });
38
-
39
- // src/job/job.operations.ts
40
- import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
41
- import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
42
- var OWNERS = ["@examples.service-business-os"];
43
- var ListJobsInputModel = defineSchemaModel2({
44
- name: "ListJobsInput",
45
- description: "Input for listing jobs",
46
- fields: {
47
- status: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
48
- clientId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
49
- limit: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
50
- offset: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true }
51
- }
52
- });
53
- var ListJobsOutputModel = defineSchemaModel2({
54
- name: "ListJobsOutput",
55
- description: "Output for listing jobs",
56
- fields: {
57
- jobs: { type: JobModel, isOptional: false, isList: true },
58
- total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false }
59
- }
60
- });
61
- var ListJobsOperation = defineQuery({
62
- meta: {
63
- key: "service.job.list",
64
- version: "1.0.0",
65
- stability: "stable",
66
- owners: [...OWNERS],
67
- tags: ["service-business-os", "job", "list", "query"],
68
- description: "List all jobs with filtering",
69
- goal: "Retrieve list of jobs",
70
- context: "Job management"
71
- },
72
- io: {
73
- input: ListJobsInputModel,
74
- output: ListJobsOutputModel
75
- },
76
- policy: { auth: "user" },
77
- acceptance: {
78
- scenarios: [
79
- {
80
- key: "list-jobs-happy-path",
81
- given: ["Jobs exist"],
82
- when: ["User lists jobs"],
83
- then: ["List of jobs is returned"]
84
- }
85
- ],
86
- examples: [
87
- {
88
- key: "list-active",
89
- input: { status: "scheduled", limit: 10 },
90
- output: { jobs: [], total: 5 }
91
- }
92
- ]
93
- }
94
- });
95
- var ScheduleJobContract = defineCommand({
96
- meta: {
97
- key: "service.job.schedule",
98
- version: "1.0.0",
99
- stability: "stable",
100
- owners: [...OWNERS],
101
- tags: ["service-business-os", "job", "schedule"],
102
- description: "Schedule a job.",
103
- goal: "Schedule work.",
104
- context: "Job scheduling."
105
- },
106
- io: {
107
- input: ScheduleJobInputModel,
108
- output: JobModel
109
- },
110
- policy: { auth: "user" },
111
- acceptance: {
112
- scenarios: [
113
- {
114
- key: "schedule-job-happy-path",
115
- given: ["Client exists"],
116
- when: ["User schedules job"],
117
- then: ["Job is created with status SCHEDULED"]
118
- }
119
- ],
120
- examples: [
121
- {
122
- key: "schedule-repair",
123
- input: {
124
- clientId: "client-123",
125
- date: "2025-01-20T10:00:00Z",
126
- type: "repair"
127
- },
128
- output: { id: "job-456", status: "scheduled" }
129
- }
130
- ]
131
- }
132
- });
133
- var CompleteJobContract = defineCommand({
134
- meta: {
135
- key: "service.job.complete",
136
- version: "1.0.0",
137
- stability: "stable",
138
- owners: [...OWNERS],
139
- tags: ["service-business-os", "job", "complete"],
140
- description: "Mark a job as complete.",
141
- goal: "Record job completion.",
142
- context: "Job management."
143
- },
144
- io: {
145
- input: CompleteJobInputModel,
146
- output: JobModel
147
- },
148
- policy: { auth: "user" },
149
- acceptance: {
150
- scenarios: [
151
- {
152
- key: "complete-job-happy-path",
153
- given: ["Job is scheduled"],
154
- when: ["User completes job"],
155
- then: ["Job status becomes COMPLETED"]
156
- }
157
- ],
158
- examples: [
159
- {
160
- key: "mark-complete",
161
- input: { jobId: "job-456", notes: "Done successfully" },
162
- output: { id: "job-456", status: "completed" }
163
- }
164
- ]
165
- }
166
- });
167
- export {
168
- ScheduleJobInputModel,
169
- ScheduleJobContract,
170
- ListJobsOutputModel,
171
- ListJobsOperation,
172
- ListJobsInputModel,
173
- JobModel,
174
- CompleteJobInputModel,
175
- CompleteJobContract
176
- };
2
+ import{defineSchemaModel as C,ScalarTypeEnum as J}from"@contractspec/lib.schema";var x=C({name:"Job",description:"Scheduled job",fields:{id:{type:J.String_unsecure(),isOptional:!1},quoteId:{type:J.String_unsecure(),isOptional:!1},clientId:{type:J.String_unsecure(),isOptional:!1},title:{type:J.String_unsecure(),isOptional:!1},status:{type:J.String_unsecure(),isOptional:!1},scheduledAt:{type:J.DateTime(),isOptional:!0},completedAt:{type:J.DateTime(),isOptional:!0},assignedTo:{type:J.String_unsecure(),isOptional:!0}}}),L=C({name:"ScheduleJobInput",description:"Input for scheduling a job",fields:{quoteId:{type:J.String_unsecure(),isOptional:!1},scheduledAt:{type:J.DateTime(),isOptional:!1},assignedTo:{type:J.String_unsecure(),isOptional:!0},location:{type:J.JSON(),isOptional:!0},title:{type:J.String_unsecure(),isOptional:!0}}}),k=C({name:"CompleteJobInput",description:"Input for completing a job",fields:{jobId:{type:J.String_unsecure(),isOptional:!1},completedAt:{type:J.DateTime(),isOptional:!0},notes:{type:J.String_unsecure(),isOptional:!0}}});import{defineCommand as t,defineQuery as A}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as v,ScalarTypeEnum as g}from"@contractspec/lib.schema";var q=["@examples.service-business-os"],w=v({name:"ListJobsInput",description:"Input for listing jobs",fields:{status:{type:g.String_unsecure(),isOptional:!0},clientId:{type:g.String_unsecure(),isOptional:!0},limit:{type:g.Int_unsecure(),isOptional:!0},offset:{type:g.Int_unsecure(),isOptional:!0}}}),z=v({name:"ListJobsOutput",description:"Output for listing jobs",fields:{jobs:{type:x,isOptional:!1,isList:!0},total:{type:g.Int_unsecure(),isOptional:!1}}}),B=A({meta:{key:"service.job.list",version:"1.0.0",stability:"stable",owners:[...q],tags:["service-business-os","job","list","query"],description:"List all jobs with filtering",goal:"Retrieve list of jobs",context:"Job management"},io:{input:w,output:z},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}}]}}),D=t({meta:{key:"service.job.schedule",version:"1.0.0",stability:"stable",owners:[...q],tags:["service-business-os","job","schedule"],description:"Schedule a job.",goal:"Schedule work.",context:"Job scheduling."},io:{input:L,output:x},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"}}]}}),F=t({meta:{key:"service.job.complete",version:"1.0.0",stability:"stable",owners:[...q],tags:["service-business-os","job","complete"],description:"Mark a job as complete.",goal:"Record job completion.",context:"Job management."},io:{input:k,output:x},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"}}]}});export{L as ScheduleJobInputModel,D as ScheduleJobContract,z as ListJobsOutputModel,B as ListJobsOperation,w as ListJobsInputModel,x as JobModel,k as CompleteJobInputModel,F as CompleteJobContract};
@@ -1,173 +1,2 @@
1
1
  // @bun
2
- // src/job/job.schema.ts
3
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
4
- var JobModel = defineSchemaModel({
5
- name: "Job",
6
- description: "Scheduled job",
7
- fields: {
8
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
9
- quoteId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
10
- clientId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
- title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
12
- status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
13
- scheduledAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
14
- completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
15
- assignedTo: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
16
- }
17
- });
18
- var ScheduleJobInputModel = defineSchemaModel({
19
- name: "ScheduleJobInput",
20
- description: "Input for scheduling a job",
21
- fields: {
22
- quoteId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
23
- scheduledAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
24
- assignedTo: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
25
- location: { type: ScalarTypeEnum.JSON(), isOptional: true },
26
- title: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
27
- }
28
- });
29
- var CompleteJobInputModel = defineSchemaModel({
30
- name: "CompleteJobInput",
31
- description: "Input for completing a job",
32
- fields: {
33
- jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
34
- completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
35
- notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
36
- }
37
- });
38
-
39
- // src/job/job.operations.ts
40
- import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
41
- import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
42
- var OWNERS = ["@examples.service-business-os"];
43
- var ListJobsInputModel = defineSchemaModel2({
44
- name: "ListJobsInput",
45
- description: "Input for listing jobs",
46
- fields: {
47
- status: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
48
- clientId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
49
- limit: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
50
- offset: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true }
51
- }
52
- });
53
- var ListJobsOutputModel = defineSchemaModel2({
54
- name: "ListJobsOutput",
55
- description: "Output for listing jobs",
56
- fields: {
57
- jobs: { type: JobModel, isOptional: false, isList: true },
58
- total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false }
59
- }
60
- });
61
- var ListJobsOperation = defineQuery({
62
- meta: {
63
- key: "service.job.list",
64
- version: "1.0.0",
65
- stability: "stable",
66
- owners: [...OWNERS],
67
- tags: ["service-business-os", "job", "list", "query"],
68
- description: "List all jobs with filtering",
69
- goal: "Retrieve list of jobs",
70
- context: "Job management"
71
- },
72
- io: {
73
- input: ListJobsInputModel,
74
- output: ListJobsOutputModel
75
- },
76
- policy: { auth: "user" },
77
- acceptance: {
78
- scenarios: [
79
- {
80
- key: "list-jobs-happy-path",
81
- given: ["Jobs exist"],
82
- when: ["User lists jobs"],
83
- then: ["List of jobs is returned"]
84
- }
85
- ],
86
- examples: [
87
- {
88
- key: "list-active",
89
- input: { status: "scheduled", limit: 10 },
90
- output: { jobs: [], total: 5 }
91
- }
92
- ]
93
- }
94
- });
95
- var ScheduleJobContract = defineCommand({
96
- meta: {
97
- key: "service.job.schedule",
98
- version: "1.0.0",
99
- stability: "stable",
100
- owners: [...OWNERS],
101
- tags: ["service-business-os", "job", "schedule"],
102
- description: "Schedule a job.",
103
- goal: "Schedule work.",
104
- context: "Job scheduling."
105
- },
106
- io: {
107
- input: ScheduleJobInputModel,
108
- output: JobModel
109
- },
110
- policy: { auth: "user" },
111
- acceptance: {
112
- scenarios: [
113
- {
114
- key: "schedule-job-happy-path",
115
- given: ["Client exists"],
116
- when: ["User schedules job"],
117
- then: ["Job is created with status SCHEDULED"]
118
- }
119
- ],
120
- examples: [
121
- {
122
- key: "schedule-repair",
123
- input: {
124
- clientId: "client-123",
125
- date: "2025-01-20T10:00:00Z",
126
- type: "repair"
127
- },
128
- output: { id: "job-456", status: "scheduled" }
129
- }
130
- ]
131
- }
132
- });
133
- var CompleteJobContract = defineCommand({
134
- meta: {
135
- key: "service.job.complete",
136
- version: "1.0.0",
137
- stability: "stable",
138
- owners: [...OWNERS],
139
- tags: ["service-business-os", "job", "complete"],
140
- description: "Mark a job as complete.",
141
- goal: "Record job completion.",
142
- context: "Job management."
143
- },
144
- io: {
145
- input: CompleteJobInputModel,
146
- output: JobModel
147
- },
148
- policy: { auth: "user" },
149
- acceptance: {
150
- scenarios: [
151
- {
152
- key: "complete-job-happy-path",
153
- given: ["Job is scheduled"],
154
- when: ["User completes job"],
155
- then: ["Job status becomes COMPLETED"]
156
- }
157
- ],
158
- examples: [
159
- {
160
- key: "mark-complete",
161
- input: { jobId: "job-456", notes: "Done successfully" },
162
- output: { id: "job-456", status: "completed" }
163
- }
164
- ]
165
- }
166
- });
167
- export {
168
- ScheduleJobContract,
169
- ListJobsOutputModel,
170
- ListJobsOperation,
171
- ListJobsInputModel,
172
- CompleteJobContract
173
- };
2
+ import{defineSchemaModel as w,ScalarTypeEnum as k}from"@contractspec/lib.schema";var v=w({name:"Job",description:"Scheduled job",fields:{id:{type:k.String_unsecure(),isOptional:!1},quoteId:{type:k.String_unsecure(),isOptional:!1},clientId:{type:k.String_unsecure(),isOptional:!1},title:{type:k.String_unsecure(),isOptional:!1},status:{type:k.String_unsecure(),isOptional:!1},scheduledAt:{type:k.DateTime(),isOptional:!0},completedAt:{type:k.DateTime(),isOptional:!0},assignedTo:{type:k.String_unsecure(),isOptional:!0}}}),z=w({name:"ScheduleJobInput",description:"Input for scheduling a job",fields:{quoteId:{type:k.String_unsecure(),isOptional:!1},scheduledAt:{type:k.DateTime(),isOptional:!1},assignedTo:{type:k.String_unsecure(),isOptional:!0},location:{type:k.JSON(),isOptional:!0},title:{type:k.String_unsecure(),isOptional:!0}}}),A=w({name:"CompleteJobInput",description:"Input for completing a job",fields:{jobId:{type:k.String_unsecure(),isOptional:!1},completedAt:{type:k.DateTime(),isOptional:!0},notes:{type:k.String_unsecure(),isOptional:!0}}});import{defineCommand as B,defineQuery as F}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as D,ScalarTypeEnum as q}from"@contractspec/lib.schema";var x=["@examples.service-business-os"],G=D({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}}}),H=D({name:"ListJobsOutput",description:"Output for listing jobs",fields:{jobs:{type:v,isOptional:!1,isList:!0},total:{type:q.Int_unsecure(),isOptional:!1}}}),Y=F({meta:{key:"service.job.list",version:"1.0.0",stability:"stable",owners:[...x],tags:["service-business-os","job","list","query"],description:"List all jobs with filtering",goal:"Retrieve list of jobs",context:"Job management"},io:{input:G,output:H},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}}]}}),Z=B({meta:{key:"service.job.schedule",version:"1.0.0",stability:"stable",owners:[...x],tags:["service-business-os","job","schedule"],description:"Schedule a job.",goal:"Schedule work.",context:"Job scheduling."},io:{input:z,output:v},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({meta:{key:"service.job.complete",version:"1.0.0",stability:"stable",owners:[...x],tags:["service-business-os","job","complete"],description:"Mark a job as complete.",goal:"Record job completion.",context:"Job management."},io:{input:A,output:v},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"}}]}});export{Z as ScheduleJobContract,H as ListJobsOutputModel,Y as ListJobsOperation,G as ListJobsInputModel,_ as CompleteJobContract};
@@ -1,42 +1,2 @@
1
1
  // @bun
2
- // src/job/job.schema.ts
3
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
4
- var JobModel = defineSchemaModel({
5
- name: "Job",
6
- description: "Scheduled job",
7
- fields: {
8
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
9
- quoteId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
10
- clientId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
- title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
12
- status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
13
- scheduledAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
14
- completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
15
- assignedTo: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
16
- }
17
- });
18
- var ScheduleJobInputModel = defineSchemaModel({
19
- name: "ScheduleJobInput",
20
- description: "Input for scheduling a job",
21
- fields: {
22
- quoteId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
23
- scheduledAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
24
- assignedTo: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
25
- location: { type: ScalarTypeEnum.JSON(), isOptional: true },
26
- title: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
27
- }
28
- });
29
- var CompleteJobInputModel = defineSchemaModel({
30
- name: "CompleteJobInput",
31
- description: "Input for completing a job",
32
- fields: {
33
- jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
34
- completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
35
- notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
36
- }
37
- });
38
- export {
39
- ScheduleJobInputModel,
40
- JobModel,
41
- CompleteJobInputModel
42
- };
2
+ import{defineSchemaModel as q,ScalarTypeEnum as k}from"@contractspec/lib.schema";var w=q({name:"Job",description:"Scheduled job",fields:{id:{type:k.String_unsecure(),isOptional:!1},quoteId:{type:k.String_unsecure(),isOptional:!1},clientId:{type:k.String_unsecure(),isOptional:!1},title:{type:k.String_unsecure(),isOptional:!1},status:{type:k.String_unsecure(),isOptional:!1},scheduledAt:{type:k.DateTime(),isOptional:!0},completedAt:{type:k.DateTime(),isOptional:!0},assignedTo:{type:k.String_unsecure(),isOptional:!0}}}),x=q({name:"ScheduleJobInput",description:"Input for scheduling a job",fields:{quoteId:{type:k.String_unsecure(),isOptional:!1},scheduledAt:{type:k.DateTime(),isOptional:!1},assignedTo:{type:k.String_unsecure(),isOptional:!0},location:{type:k.JSON(),isOptional:!0},title:{type:k.String_unsecure(),isOptional:!0}}}),z=q({name:"CompleteJobInput",description:"Input for completing a job",fields:{jobId:{type:k.String_unsecure(),isOptional:!1},completedAt:{type:k.DateTime(),isOptional:!0},notes:{type:k.String_unsecure(),isOptional:!0}}});export{x as ScheduleJobInputModel,w as JobModel,z as CompleteJobInputModel};