@contractspec/example.service-business-os 1.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -0
  3. package/dist/client/client.operations.d.ts +65 -0
  4. package/dist/client/client.operations.d.ts.map +1 -0
  5. package/dist/client/client.operations.js +53 -0
  6. package/dist/client/client.operations.js.map +1 -0
  7. package/dist/client/client.schema.d.ts +68 -0
  8. package/dist/client/client.schema.d.ts.map +1 -0
  9. package/dist/client/client.schema.js +77 -0
  10. package/dist/client/client.schema.js.map +1 -0
  11. package/dist/client/index.d.ts +3 -0
  12. package/dist/client/index.js +4 -0
  13. package/dist/docs/index.d.ts +1 -0
  14. package/dist/docs/index.js +1 -0
  15. package/dist/docs/service-business-os.docblock.d.ts +1 -0
  16. package/dist/docs/service-business-os.docblock.js +109 -0
  17. package/dist/docs/service-business-os.docblock.js.map +1 -0
  18. package/dist/entities/index.d.ts +168 -0
  19. package/dist/entities/index.d.ts.map +1 -0
  20. package/dist/entities/index.js +289 -0
  21. package/dist/entities/index.js.map +1 -0
  22. package/dist/events.d.ts +337 -0
  23. package/dist/events.d.ts.map +1 -0
  24. package/dist/events.js +230 -0
  25. package/dist/events.js.map +1 -0
  26. package/dist/example.d.ts +37 -0
  27. package/dist/example.d.ts.map +1 -0
  28. package/dist/example.js +46 -0
  29. package/dist/example.js.map +1 -0
  30. package/dist/handlers/index.d.ts +17 -0
  31. package/dist/handlers/index.d.ts.map +1 -0
  32. package/dist/handlers/index.js +6 -0
  33. package/dist/handlers/index.js.map +1 -0
  34. package/dist/index.d.ts +18 -0
  35. package/dist/index.js +19 -0
  36. package/dist/invoice/index.d.ts +3 -0
  37. package/dist/invoice/index.js +4 -0
  38. package/dist/invoice/invoice.operations.d.ts +65 -0
  39. package/dist/invoice/invoice.operations.d.ts.map +1 -0
  40. package/dist/invoice/invoice.operations.js +57 -0
  41. package/dist/invoice/invoice.operations.js.map +1 -0
  42. package/dist/invoice/invoice.schema.d.ts +68 -0
  43. package/dist/invoice/invoice.schema.d.ts.map +1 -0
  44. package/dist/invoice/invoice.schema.js +77 -0
  45. package/dist/invoice/invoice.schema.js.map +1 -0
  46. package/dist/job/index.d.ts +3 -0
  47. package/dist/job/index.js +4 -0
  48. package/dist/job/job.operations.d.ts +238 -0
  49. package/dist/job/job.operations.d.ts.map +1 -0
  50. package/dist/job/job.operations.js +175 -0
  51. package/dist/job/job.operations.js.map +1 -0
  52. package/dist/job/job.schema.d.ts +85 -0
  53. package/dist/job/job.schema.d.ts.map +1 -0
  54. package/dist/job/job.schema.js +98 -0
  55. package/dist/job/job.schema.js.map +1 -0
  56. package/dist/operations/index.d.ts +16 -0
  57. package/dist/operations/index.js +17 -0
  58. package/dist/payment/index.d.ts +3 -0
  59. package/dist/payment/index.js +4 -0
  60. package/dist/payment/payment.operations.d.ts +61 -0
  61. package/dist/payment/payment.operations.d.ts.map +1 -0
  62. package/dist/payment/payment.operations.js +53 -0
  63. package/dist/payment/payment.operations.js.map +1 -0
  64. package/dist/payment/payment.schema.d.ts +64 -0
  65. package/dist/payment/payment.schema.d.ts.map +1 -0
  66. package/dist/payment/payment.schema.js +73 -0
  67. package/dist/payment/payment.schema.js.map +1 -0
  68. package/dist/presentations/index.d.ts +9 -0
  69. package/dist/presentations/index.d.ts.map +1 -0
  70. package/dist/presentations/index.js +18 -0
  71. package/dist/presentations/index.js.map +1 -0
  72. package/dist/presentations.d.ts +13 -0
  73. package/dist/presentations.d.ts.map +1 -0
  74. package/dist/presentations.js +179 -0
  75. package/dist/presentations.js.map +1 -0
  76. package/dist/quote/index.d.ts +3 -0
  77. package/dist/quote/index.js +4 -0
  78. package/dist/quote/quote.operations.d.ts +135 -0
  79. package/dist/quote/quote.operations.d.ts.map +1 -0
  80. package/dist/quote/quote.operations.js +99 -0
  81. package/dist/quote/quote.operations.js.map +1 -0
  82. package/dist/quote/quote.schema.d.ts +101 -0
  83. package/dist/quote/quote.schema.d.ts.map +1 -0
  84. package/dist/quote/quote.schema.js +114 -0
  85. package/dist/quote/quote.schema.js.map +1 -0
  86. package/dist/service.feature.d.ts +7 -0
  87. package/dist/service.feature.d.ts.map +1 -0
  88. package/dist/service.feature.js +164 -0
  89. package/dist/service.feature.js.map +1 -0
  90. package/package.json +108 -0
@@ -0,0 +1,77 @@
1
+ import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
2
+
3
+ //#region src/invoice/invoice.schema.ts
4
+ /**
5
+ * Invoice issued for a job.
6
+ */
7
+ const InvoiceModel = defineSchemaModel({
8
+ name: "Invoice",
9
+ description: "Invoice issued for a job",
10
+ fields: {
11
+ id: {
12
+ type: ScalarTypeEnum.String_unsecure(),
13
+ isOptional: false
14
+ },
15
+ jobId: {
16
+ type: ScalarTypeEnum.String_unsecure(),
17
+ isOptional: false
18
+ },
19
+ invoiceNumber: {
20
+ type: ScalarTypeEnum.String_unsecure(),
21
+ isOptional: false
22
+ },
23
+ amount: {
24
+ type: ScalarTypeEnum.Float_unsecure(),
25
+ isOptional: false
26
+ },
27
+ currency: {
28
+ type: ScalarTypeEnum.String_unsecure(),
29
+ isOptional: false
30
+ },
31
+ status: {
32
+ type: ScalarTypeEnum.String_unsecure(),
33
+ isOptional: false
34
+ },
35
+ dueDate: {
36
+ type: ScalarTypeEnum.DateTime(),
37
+ isOptional: true
38
+ },
39
+ issuedAt: {
40
+ type: ScalarTypeEnum.DateTime(),
41
+ isOptional: true
42
+ },
43
+ paidAt: {
44
+ type: ScalarTypeEnum.DateTime(),
45
+ isOptional: true
46
+ }
47
+ }
48
+ });
49
+ /**
50
+ * Input for issuing an invoice.
51
+ */
52
+ const IssueInvoiceInputModel = defineSchemaModel({
53
+ name: "IssueInvoiceInput",
54
+ description: "Input for issuing an invoice",
55
+ fields: {
56
+ jobId: {
57
+ type: ScalarTypeEnum.String_unsecure(),
58
+ isOptional: false
59
+ },
60
+ dueDate: {
61
+ type: ScalarTypeEnum.DateTime(),
62
+ isOptional: true
63
+ },
64
+ notes: {
65
+ type: ScalarTypeEnum.String_unsecure(),
66
+ isOptional: true
67
+ },
68
+ lineItems: {
69
+ type: ScalarTypeEnum.JSON(),
70
+ isOptional: true
71
+ }
72
+ }
73
+ });
74
+
75
+ //#endregion
76
+ export { InvoiceModel, IssueInvoiceInputModel };
77
+ //# sourceMappingURL=invoice.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice.schema.js","names":[],"sources":["../../src/invoice/invoice.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\n\n/**\n * Invoice issued for a job.\n */\nexport const InvoiceModel = defineSchemaModel({\n name: 'Invoice',\n description: 'Invoice issued for a job',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n invoiceNumber: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n dueDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n issuedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n paidAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\n/**\n * Input for issuing an invoice.\n */\nexport const IssueInvoiceInputModel = defineSchemaModel({\n name: 'IssueInvoiceInput',\n description: 'Input for issuing an invoice',\n fields: {\n jobId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n dueDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n notes: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n lineItems: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n"],"mappings":";;;;;;AAKA,MAAa,eAAe,kBAAkB;CAC5C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACpE,eAAe;GACb,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,QAAQ;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACpE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,SAAS;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAM;EAC9D,UAAU;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAM;EAC/D,QAAQ;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAM;EAC9D;CACF,CAAC;;;;AAKF,MAAa,yBAAyB,kBAAkB;CACtD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACpE,SAAS;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAM;EAC9D,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACnE,WAAW;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAM;EAC7D;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { CompleteJobInputModel, JobModel, ScheduleJobInputModel } from "./job.schema.js";
2
+ import { CompleteJobContract, ListJobsInputModel, ListJobsOperation, ListJobsOutputModel, ScheduleJobContract } from "./job.operations.js";
3
+ export { CompleteJobContract, CompleteJobInputModel, JobModel, ListJobsInputModel, ListJobsOperation, ListJobsOutputModel, ScheduleJobContract, ScheduleJobInputModel };
@@ -0,0 +1,4 @@
1
+ import { CompleteJobInputModel, JobModel, ScheduleJobInputModel } from "./job.schema.js";
2
+ import { CompleteJobContract, ListJobsInputModel, ListJobsOperation, ListJobsOutputModel, ScheduleJobContract } from "./job.operations.js";
3
+
4
+ export { CompleteJobContract, CompleteJobInputModel, JobModel, ListJobsInputModel, ListJobsOperation, ListJobsOutputModel, ScheduleJobContract, ScheduleJobInputModel };
@@ -0,0 +1,238 @@
1
+ import * as _contractspec_lib_schema343 from "@contractspec/lib.schema";
2
+ import * as _contractspec_lib_contracts13 from "@contractspec/lib.contracts";
3
+
4
+ //#region src/job/job.operations.d.ts
5
+ declare const ListJobsInputModel: _contractspec_lib_schema343.SchemaModel<{
6
+ status: {
7
+ type: _contractspec_lib_schema343.FieldType<string, string>;
8
+ isOptional: true;
9
+ };
10
+ clientId: {
11
+ type: _contractspec_lib_schema343.FieldType<string, string>;
12
+ isOptional: true;
13
+ };
14
+ limit: {
15
+ type: _contractspec_lib_schema343.FieldType<number, number>;
16
+ isOptional: true;
17
+ };
18
+ offset: {
19
+ type: _contractspec_lib_schema343.FieldType<number, number>;
20
+ isOptional: true;
21
+ };
22
+ }>;
23
+ declare const ListJobsOutputModel: _contractspec_lib_schema343.SchemaModel<{
24
+ jobs: {
25
+ type: _contractspec_lib_schema343.SchemaModel<{
26
+ id: {
27
+ type: _contractspec_lib_schema343.FieldType<string, string>;
28
+ isOptional: false;
29
+ };
30
+ quoteId: {
31
+ type: _contractspec_lib_schema343.FieldType<string, string>;
32
+ isOptional: false;
33
+ };
34
+ clientId: {
35
+ type: _contractspec_lib_schema343.FieldType<string, string>;
36
+ isOptional: false;
37
+ };
38
+ title: {
39
+ type: _contractspec_lib_schema343.FieldType<string, string>;
40
+ isOptional: false;
41
+ };
42
+ status: {
43
+ type: _contractspec_lib_schema343.FieldType<string, string>;
44
+ isOptional: false;
45
+ };
46
+ scheduledAt: {
47
+ type: _contractspec_lib_schema343.FieldType<Date, string>;
48
+ isOptional: true;
49
+ };
50
+ completedAt: {
51
+ type: _contractspec_lib_schema343.FieldType<Date, string>;
52
+ isOptional: true;
53
+ };
54
+ assignedTo: {
55
+ type: _contractspec_lib_schema343.FieldType<string, string>;
56
+ isOptional: true;
57
+ };
58
+ }>;
59
+ isOptional: false;
60
+ isList: boolean;
61
+ };
62
+ total: {
63
+ type: _contractspec_lib_schema343.FieldType<number, number>;
64
+ isOptional: false;
65
+ };
66
+ }>;
67
+ declare const ListJobsOperation: _contractspec_lib_contracts13.OperationSpec<_contractspec_lib_schema343.SchemaModel<{
68
+ status: {
69
+ type: _contractspec_lib_schema343.FieldType<string, string>;
70
+ isOptional: true;
71
+ };
72
+ clientId: {
73
+ type: _contractspec_lib_schema343.FieldType<string, string>;
74
+ isOptional: true;
75
+ };
76
+ limit: {
77
+ type: _contractspec_lib_schema343.FieldType<number, number>;
78
+ isOptional: true;
79
+ };
80
+ offset: {
81
+ type: _contractspec_lib_schema343.FieldType<number, number>;
82
+ isOptional: true;
83
+ };
84
+ }>, _contractspec_lib_schema343.SchemaModel<{
85
+ jobs: {
86
+ type: _contractspec_lib_schema343.SchemaModel<{
87
+ id: {
88
+ type: _contractspec_lib_schema343.FieldType<string, string>;
89
+ isOptional: false;
90
+ };
91
+ quoteId: {
92
+ type: _contractspec_lib_schema343.FieldType<string, string>;
93
+ isOptional: false;
94
+ };
95
+ clientId: {
96
+ type: _contractspec_lib_schema343.FieldType<string, string>;
97
+ isOptional: false;
98
+ };
99
+ title: {
100
+ type: _contractspec_lib_schema343.FieldType<string, string>;
101
+ isOptional: false;
102
+ };
103
+ status: {
104
+ type: _contractspec_lib_schema343.FieldType<string, string>;
105
+ isOptional: false;
106
+ };
107
+ scheduledAt: {
108
+ type: _contractspec_lib_schema343.FieldType<Date, string>;
109
+ isOptional: true;
110
+ };
111
+ completedAt: {
112
+ type: _contractspec_lib_schema343.FieldType<Date, string>;
113
+ isOptional: true;
114
+ };
115
+ assignedTo: {
116
+ type: _contractspec_lib_schema343.FieldType<string, string>;
117
+ isOptional: true;
118
+ };
119
+ }>;
120
+ isOptional: false;
121
+ isList: boolean;
122
+ };
123
+ total: {
124
+ type: _contractspec_lib_schema343.FieldType<number, number>;
125
+ isOptional: false;
126
+ };
127
+ }>, undefined>;
128
+ /**
129
+ * Schedule a job.
130
+ */
131
+ declare const ScheduleJobContract: _contractspec_lib_contracts13.OperationSpec<_contractspec_lib_schema343.SchemaModel<{
132
+ quoteId: {
133
+ type: _contractspec_lib_schema343.FieldType<string, string>;
134
+ isOptional: false;
135
+ };
136
+ scheduledAt: {
137
+ type: _contractspec_lib_schema343.FieldType<Date, string>;
138
+ isOptional: false;
139
+ };
140
+ assignedTo: {
141
+ type: _contractspec_lib_schema343.FieldType<string, string>;
142
+ isOptional: true;
143
+ };
144
+ location: {
145
+ type: _contractspec_lib_schema343.FieldType<unknown, unknown>;
146
+ isOptional: true;
147
+ };
148
+ title: {
149
+ type: _contractspec_lib_schema343.FieldType<string, string>;
150
+ isOptional: true;
151
+ };
152
+ }>, _contractspec_lib_schema343.SchemaModel<{
153
+ id: {
154
+ type: _contractspec_lib_schema343.FieldType<string, string>;
155
+ isOptional: false;
156
+ };
157
+ quoteId: {
158
+ type: _contractspec_lib_schema343.FieldType<string, string>;
159
+ isOptional: false;
160
+ };
161
+ clientId: {
162
+ type: _contractspec_lib_schema343.FieldType<string, string>;
163
+ isOptional: false;
164
+ };
165
+ title: {
166
+ type: _contractspec_lib_schema343.FieldType<string, string>;
167
+ isOptional: false;
168
+ };
169
+ status: {
170
+ type: _contractspec_lib_schema343.FieldType<string, string>;
171
+ isOptional: false;
172
+ };
173
+ scheduledAt: {
174
+ type: _contractspec_lib_schema343.FieldType<Date, string>;
175
+ isOptional: true;
176
+ };
177
+ completedAt: {
178
+ type: _contractspec_lib_schema343.FieldType<Date, string>;
179
+ isOptional: true;
180
+ };
181
+ assignedTo: {
182
+ type: _contractspec_lib_schema343.FieldType<string, string>;
183
+ isOptional: true;
184
+ };
185
+ }>, undefined>;
186
+ /**
187
+ * Complete a job.
188
+ */
189
+ declare const CompleteJobContract: _contractspec_lib_contracts13.OperationSpec<_contractspec_lib_schema343.SchemaModel<{
190
+ jobId: {
191
+ type: _contractspec_lib_schema343.FieldType<string, string>;
192
+ isOptional: false;
193
+ };
194
+ completedAt: {
195
+ type: _contractspec_lib_schema343.FieldType<Date, string>;
196
+ isOptional: true;
197
+ };
198
+ notes: {
199
+ type: _contractspec_lib_schema343.FieldType<string, string>;
200
+ isOptional: true;
201
+ };
202
+ }>, _contractspec_lib_schema343.SchemaModel<{
203
+ id: {
204
+ type: _contractspec_lib_schema343.FieldType<string, string>;
205
+ isOptional: false;
206
+ };
207
+ quoteId: {
208
+ type: _contractspec_lib_schema343.FieldType<string, string>;
209
+ isOptional: false;
210
+ };
211
+ clientId: {
212
+ type: _contractspec_lib_schema343.FieldType<string, string>;
213
+ isOptional: false;
214
+ };
215
+ title: {
216
+ type: _contractspec_lib_schema343.FieldType<string, string>;
217
+ isOptional: false;
218
+ };
219
+ status: {
220
+ type: _contractspec_lib_schema343.FieldType<string, string>;
221
+ isOptional: false;
222
+ };
223
+ scheduledAt: {
224
+ type: _contractspec_lib_schema343.FieldType<Date, string>;
225
+ isOptional: true;
226
+ };
227
+ completedAt: {
228
+ type: _contractspec_lib_schema343.FieldType<Date, string>;
229
+ isOptional: true;
230
+ };
231
+ assignedTo: {
232
+ type: _contractspec_lib_schema343.FieldType<string, string>;
233
+ isOptional: true;
234
+ };
235
+ }>, undefined>;
236
+ //#endregion
237
+ export { CompleteJobContract, ListJobsInputModel, ListJobsOperation, ListJobsOutputModel, ScheduleJobContract };
238
+ //# sourceMappingURL=job.operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job.operations.d.ts","names":[],"sources":["../../src/job/job.operations.ts"],"sourcesContent":[],"mappings":";;;;cAYa,gDAAkB;;UAS7B,2BAAA,CAAA;;EATW,CAAA;EASX,QAAA,EAAA;;;;;IAT6B,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAWlB,UAAA,EAAA,IAAA;EAOX,CAAA;;;;;;cAPW,iDAAmB;;;;cAO9B,2BAAA,CAAA;;;MAP8B,OAAA,EAAA;QASnB,IAAA,uCAiCX,CAAA,MAAA,EAAA,MAAA,CAAA;QAAA,UAAA,EAAA,KAAA;;;;yBAjC4B;MAAA,CAAA;;;;;;;;;;;;;;QAAA,IAAA,uCAAA,KAAA,EAAA,MAAA,CAAA;QAwCjB,UAqCX,EAAA,IAAA;MAAA,CAAA;;;;;;;IArC8B,MAAA,EAAA,OAAA;;;;;;;cAxCnB,iDAAiB,0CAAA;;UAiC5B,2BAAA,CAAA;;;EAO8B,QAAA,EAAA;IA0CnB,IAAA,uCAiCX,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,IAAA;;;;;EAjC8B,CAAA;;;;;;;;;cAlFF,2BAAA,CAAA;;;MAkFE,OAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA1CnB,mDAAmB,0CAAA;;UAqC9B,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;UArC8B,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0CnB,mDAAmB,0CAAA;;UAiC9B,2BAAA,CAAA;;;;;;;;;;;;;UAjC8B,2BAAA,CAAA"}
@@ -0,0 +1,175 @@
1
+ import { CompleteJobInputModel, JobModel, ScheduleJobInputModel } from "./job.schema.js";
2
+ import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
3
+ import { defineCommand, defineQuery } from "@contractspec/lib.contracts";
4
+
5
+ //#region src/job/job.operations.ts
6
+ const OWNERS = ["@examples.service-business-os"];
7
+ const ListJobsInputModel = defineSchemaModel({
8
+ name: "ListJobsInput",
9
+ description: "Input for listing jobs",
10
+ fields: {
11
+ status: {
12
+ type: ScalarTypeEnum.String_unsecure(),
13
+ isOptional: true
14
+ },
15
+ clientId: {
16
+ type: ScalarTypeEnum.String_unsecure(),
17
+ isOptional: true
18
+ },
19
+ limit: {
20
+ type: ScalarTypeEnum.Int_unsecure(),
21
+ isOptional: true
22
+ },
23
+ offset: {
24
+ type: ScalarTypeEnum.Int_unsecure(),
25
+ isOptional: true
26
+ }
27
+ }
28
+ });
29
+ const ListJobsOutputModel = defineSchemaModel({
30
+ name: "ListJobsOutput",
31
+ description: "Output for listing jobs",
32
+ fields: {
33
+ jobs: {
34
+ type: JobModel,
35
+ isOptional: false,
36
+ isList: true
37
+ },
38
+ total: {
39
+ type: ScalarTypeEnum.Int_unsecure(),
40
+ isOptional: false
41
+ }
42
+ }
43
+ });
44
+ const ListJobsOperation = defineQuery({
45
+ meta: {
46
+ key: "service.job.list",
47
+ version: 1,
48
+ stability: "stable",
49
+ owners: [...OWNERS],
50
+ tags: [
51
+ "service-business-os",
52
+ "job",
53
+ "list",
54
+ "query"
55
+ ],
56
+ description: "List all jobs with filtering",
57
+ goal: "Retrieve list of jobs",
58
+ context: "Job management"
59
+ },
60
+ io: {
61
+ input: ListJobsInputModel,
62
+ output: ListJobsOutputModel
63
+ },
64
+ policy: { auth: "user" },
65
+ acceptance: {
66
+ scenarios: [{
67
+ key: "list-jobs-happy-path",
68
+ given: ["Jobs exist"],
69
+ when: ["User lists jobs"],
70
+ then: ["List of jobs is returned"]
71
+ }],
72
+ examples: [{
73
+ key: "list-active",
74
+ input: {
75
+ status: "scheduled",
76
+ limit: 10
77
+ },
78
+ output: {
79
+ jobs: [],
80
+ total: 5
81
+ }
82
+ }]
83
+ }
84
+ });
85
+ /**
86
+ * Schedule a job.
87
+ */
88
+ const ScheduleJobContract = defineCommand({
89
+ meta: {
90
+ key: "service.job.schedule",
91
+ version: 1,
92
+ stability: "stable",
93
+ owners: [...OWNERS],
94
+ tags: [
95
+ "service-business-os",
96
+ "job",
97
+ "schedule"
98
+ ],
99
+ description: "Schedule a job.",
100
+ goal: "Schedule work.",
101
+ context: "Job scheduling."
102
+ },
103
+ io: {
104
+ input: ScheduleJobInputModel,
105
+ output: JobModel
106
+ },
107
+ policy: { auth: "user" },
108
+ acceptance: {
109
+ scenarios: [{
110
+ key: "schedule-job-happy-path",
111
+ given: ["Client exists"],
112
+ when: ["User schedules job"],
113
+ then: ["Job is created with status SCHEDULED"]
114
+ }],
115
+ examples: [{
116
+ key: "schedule-repair",
117
+ input: {
118
+ clientId: "client-123",
119
+ date: "2025-01-20T10:00:00Z",
120
+ type: "repair"
121
+ },
122
+ output: {
123
+ id: "job-456",
124
+ status: "scheduled"
125
+ }
126
+ }]
127
+ }
128
+ });
129
+ /**
130
+ * Complete a job.
131
+ */
132
+ const CompleteJobContract = defineCommand({
133
+ meta: {
134
+ key: "service.job.complete",
135
+ version: 1,
136
+ stability: "stable",
137
+ owners: [...OWNERS],
138
+ tags: [
139
+ "service-business-os",
140
+ "job",
141
+ "complete"
142
+ ],
143
+ description: "Mark a job as complete.",
144
+ goal: "Record job completion.",
145
+ context: "Job management."
146
+ },
147
+ io: {
148
+ input: CompleteJobInputModel,
149
+ output: JobModel
150
+ },
151
+ policy: { auth: "user" },
152
+ acceptance: {
153
+ scenarios: [{
154
+ key: "complete-job-happy-path",
155
+ given: ["Job is scheduled"],
156
+ when: ["User completes job"],
157
+ then: ["Job status becomes COMPLETED"]
158
+ }],
159
+ examples: [{
160
+ key: "mark-complete",
161
+ input: {
162
+ jobId: "job-456",
163
+ notes: "Done successfully"
164
+ },
165
+ output: {
166
+ id: "job-456",
167
+ status: "completed"
168
+ }
169
+ }]
170
+ }
171
+ });
172
+
173
+ //#endregion
174
+ export { CompleteJobContract, ListJobsInputModel, ListJobsOperation, ListJobsOutputModel, ScheduleJobContract };
175
+ //# sourceMappingURL=job.operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job.operations.js","names":[],"sources":["../../src/job/job.operations.ts"],"sourcesContent":["import { defineCommand, defineQuery } from '@contractspec/lib.contracts';\nimport { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport {\n JobModel,\n ScheduleJobInputModel,\n CompleteJobInputModel,\n} from './job.schema';\n\nconst OWNERS = ['@examples.service-business-os'] as const;\n\n// ============ List Jobs Query ============\n\nexport const ListJobsInputModel = defineSchemaModel({\n name: 'ListJobsInput',\n description: 'Input for listing jobs',\n fields: {\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n clientId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n offset: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n});\n\nexport const ListJobsOutputModel = defineSchemaModel({\n name: 'ListJobsOutput',\n description: 'Output for listing jobs',\n fields: {\n jobs: { type: JobModel, isOptional: false, isList: true },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nexport const ListJobsOperation = defineQuery({\n meta: {\n key: 'service.job.list',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['service-business-os', 'job', 'list', 'query'],\n description: 'List all jobs with filtering',\n goal: 'Retrieve list of jobs',\n context: 'Job management',\n },\n io: {\n input: ListJobsInputModel,\n output: ListJobsOutputModel,\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'list-jobs-happy-path',\n given: ['Jobs exist'],\n when: ['User lists jobs'],\n then: ['List of jobs is returned'],\n },\n ],\n examples: [\n {\n key: 'list-active',\n input: { status: 'scheduled', limit: 10 },\n output: { jobs: [], total: 5 },\n },\n ],\n },\n});\n\n// ============ Job Commands ============\n\n/**\n * Schedule a job.\n */\nexport const ScheduleJobContract = defineCommand({\n meta: {\n key: 'service.job.schedule',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['service-business-os', 'job', 'schedule'],\n description: 'Schedule a job.',\n goal: 'Schedule work.',\n context: 'Job scheduling.',\n },\n io: {\n input: ScheduleJobInputModel,\n output: JobModel,\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'schedule-job-happy-path',\n given: ['Client exists'],\n when: ['User schedules job'],\n then: ['Job is created with status SCHEDULED'],\n },\n ],\n examples: [\n {\n key: 'schedule-repair',\n input: {\n clientId: 'client-123',\n date: '2025-01-20T10:00:00Z',\n type: 'repair',\n },\n output: { id: 'job-456', status: 'scheduled' },\n },\n ],\n },\n});\n\n/**\n * Complete a job.\n */\nexport const CompleteJobContract = defineCommand({\n meta: {\n key: 'service.job.complete',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['service-business-os', 'job', 'complete'],\n description: 'Mark a job as complete.',\n goal: 'Record job completion.',\n context: 'Job management.',\n },\n io: {\n input: CompleteJobInputModel,\n output: JobModel,\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'complete-job-happy-path',\n given: ['Job is scheduled'],\n when: ['User completes job'],\n then: ['Job status becomes COMPLETED'],\n },\n ],\n examples: [\n {\n key: 'mark-complete',\n input: { jobId: 'job-456', notes: 'Done successfully' },\n output: { id: 'job-456', status: 'completed' },\n },\n ],\n },\n});\n"],"mappings":";;;;;AAQA,MAAM,SAAS,CAAC,gCAAgC;AAIhD,MAAa,qBAAqB,kBAAkB;CAClD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACpE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACtE,OAAO;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAM;EAChE,QAAQ;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAM;EAClE;CACF,CAAC;AAEF,MAAa,sBAAsB,kBAAkB;CACnD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,MAAM;GAAE,MAAM;GAAU,YAAY;GAAO,QAAQ;GAAM;EACzD,OAAO;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAa,oBAAoB,YAAY;CAC3C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAuB;GAAO;GAAQ;GAAQ;EACrD,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EAAE,MAAM,QAAQ;CACxB,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,aAAa;GACrB,MAAM,CAAC,kBAAkB;GACzB,MAAM,CAAC,2BAA2B;GACnC,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,QAAQ;IAAa,OAAO;IAAI;GACzC,QAAQ;IAAE,MAAM,EAAE;IAAE,OAAO;IAAG;GAC/B,CACF;EACF;CACF,CAAC;;;;AAOF,MAAa,sBAAsB,cAAc;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAuB;GAAO;GAAW;EAChD,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EAAE,MAAM,QAAQ;CACxB,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,gBAAgB;GACxB,MAAM,CAAC,qBAAqB;GAC5B,MAAM,CAAC,uCAAuC;GAC/C,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IACL,UAAU;IACV,MAAM;IACN,MAAM;IACP;GACD,QAAQ;IAAE,IAAI;IAAW,QAAQ;IAAa;GAC/C,CACF;EACF;CACF,CAAC;;;;AAKF,MAAa,sBAAsB,cAAc;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAuB;GAAO;GAAW;EAChD,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EAAE,MAAM,QAAQ;CACxB,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,mBAAmB;GAC3B,MAAM,CAAC,qBAAqB;GAC5B,MAAM,CAAC,+BAA+B;GACvC,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,OAAO;IAAW,OAAO;IAAqB;GACvD,QAAQ;IAAE,IAAI;IAAW,QAAQ;IAAa;GAC/C,CACF;EACF;CACF,CAAC"}
@@ -0,0 +1,85 @@
1
+ import * as _contractspec_lib_schema309 from "@contractspec/lib.schema";
2
+
3
+ //#region src/job/job.schema.d.ts
4
+ /**
5
+ * Scheduled job.
6
+ */
7
+ declare const JobModel: _contractspec_lib_schema309.SchemaModel<{
8
+ id: {
9
+ type: _contractspec_lib_schema309.FieldType<string, string>;
10
+ isOptional: false;
11
+ };
12
+ quoteId: {
13
+ type: _contractspec_lib_schema309.FieldType<string, string>;
14
+ isOptional: false;
15
+ };
16
+ clientId: {
17
+ type: _contractspec_lib_schema309.FieldType<string, string>;
18
+ isOptional: false;
19
+ };
20
+ title: {
21
+ type: _contractspec_lib_schema309.FieldType<string, string>;
22
+ isOptional: false;
23
+ };
24
+ status: {
25
+ type: _contractspec_lib_schema309.FieldType<string, string>;
26
+ isOptional: false;
27
+ };
28
+ scheduledAt: {
29
+ type: _contractspec_lib_schema309.FieldType<Date, string>;
30
+ isOptional: true;
31
+ };
32
+ completedAt: {
33
+ type: _contractspec_lib_schema309.FieldType<Date, string>;
34
+ isOptional: true;
35
+ };
36
+ assignedTo: {
37
+ type: _contractspec_lib_schema309.FieldType<string, string>;
38
+ isOptional: true;
39
+ };
40
+ }>;
41
+ /**
42
+ * Input for scheduling a job.
43
+ */
44
+ declare const ScheduleJobInputModel: _contractspec_lib_schema309.SchemaModel<{
45
+ quoteId: {
46
+ type: _contractspec_lib_schema309.FieldType<string, string>;
47
+ isOptional: false;
48
+ };
49
+ scheduledAt: {
50
+ type: _contractspec_lib_schema309.FieldType<Date, string>;
51
+ isOptional: false;
52
+ };
53
+ assignedTo: {
54
+ type: _contractspec_lib_schema309.FieldType<string, string>;
55
+ isOptional: true;
56
+ };
57
+ location: {
58
+ type: _contractspec_lib_schema309.FieldType<unknown, unknown>;
59
+ isOptional: true;
60
+ };
61
+ title: {
62
+ type: _contractspec_lib_schema309.FieldType<string, string>;
63
+ isOptional: true;
64
+ };
65
+ }>;
66
+ /**
67
+ * Input for completing a job.
68
+ */
69
+ declare const CompleteJobInputModel: _contractspec_lib_schema309.SchemaModel<{
70
+ jobId: {
71
+ type: _contractspec_lib_schema309.FieldType<string, string>;
72
+ isOptional: false;
73
+ };
74
+ completedAt: {
75
+ type: _contractspec_lib_schema309.FieldType<Date, string>;
76
+ isOptional: true;
77
+ };
78
+ notes: {
79
+ type: _contractspec_lib_schema309.FieldType<string, string>;
80
+ isOptional: true;
81
+ };
82
+ }>;
83
+ //#endregion
84
+ export { CompleteJobInputModel, JobModel, ScheduleJobInputModel };
85
+ //# sourceMappingURL=job.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job.schema.d.ts","names":[],"sources":["../../src/job/job.schema.ts"],"sourcesContent":[],"mappings":";;;;;;AAKa,cAAA,QAaX,8BAbmB,WAanB,CAAA;EAAA,EAAA,EAAA;UAAA,2BAAA,CAAA;;;;;;;;;;EAbmB,CAAA;EAkBR,KAAA,EAAA;IAUX,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;EAVgC,WAAA,EAAA;IAerB,IAAA,uCAQX,KAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,IAAA;;;;;EARgC,CAAA;;;;;;;;;cAfrB,mDAAqB;;UAUhC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;cAKW,mDAAqB;;UAQhC,2BAAA,CAAA"}