@contractspec/example.service-business-os 1.56.1 → 1.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/browser/client/client.operations.js +72 -0
  2. package/dist/browser/client/client.schema.js +31 -0
  3. package/dist/browser/client/index.js +74 -0
  4. package/dist/browser/docs/index.js +96 -0
  5. package/dist/browser/docs/service-business-os.docblock.js +96 -0
  6. package/dist/browser/entities/index.js +246 -0
  7. package/dist/browser/events.js +135 -0
  8. package/dist/browser/example.js +39 -0
  9. package/dist/browser/handlers/index.js +5 -0
  10. package/dist/browser/index.js +752 -0
  11. package/dist/browser/invoice/index.js +77 -0
  12. package/dist/browser/invoice/invoice.operations.js +75 -0
  13. package/dist/browser/invoice/invoice.schema.js +34 -0
  14. package/dist/browser/job/index.js +175 -0
  15. package/dist/browser/job/job.operations.js +172 -0
  16. package/dist/browser/job/job.schema.js +41 -0
  17. package/dist/browser/operations/index.js +506 -0
  18. package/dist/browser/payment/index.js +69 -0
  19. package/dist/browser/payment/payment.operations.js +67 -0
  20. package/dist/browser/payment/payment.schema.js +30 -0
  21. package/dist/browser/presentations/index.js +13 -0
  22. package/dist/browser/presentations.js +172 -0
  23. package/dist/browser/quote/index.js +122 -0
  24. package/dist/browser/quote/quote.operations.js +119 -0
  25. package/dist/browser/quote/quote.schema.js +45 -0
  26. package/dist/browser/service-business-os.capability.js +28 -0
  27. package/dist/browser/service.feature.js +74 -0
  28. package/dist/client/client.operations.d.ts +54 -60
  29. package/dist/client/client.operations.d.ts.map +1 -1
  30. package/dist/client/client.operations.js +71 -51
  31. package/dist/client/client.schema.d.ts +54 -59
  32. package/dist/client/client.schema.d.ts.map +1 -1
  33. package/dist/client/client.schema.js +30 -75
  34. package/dist/client/index.d.ts +6 -3
  35. package/dist/client/index.d.ts.map +1 -0
  36. package/dist/client/index.js +74 -3
  37. package/dist/docs/index.d.ts +2 -1
  38. package/dist/docs/index.d.ts.map +1 -0
  39. package/dist/docs/index.js +97 -1
  40. package/dist/docs/service-business-os.docblock.d.ts +2 -1
  41. package/dist/docs/service-business-os.docblock.d.ts.map +1 -0
  42. package/dist/docs/service-business-os.docblock.js +52 -64
  43. package/dist/entities/index.d.ts +156 -161
  44. package/dist/entities/index.d.ts.map +1 -1
  45. package/dist/entities/index.js +236 -278
  46. package/dist/events.d.ts +253 -259
  47. package/dist/events.d.ts.map +1 -1
  48. package/dist/events.js +123 -217
  49. package/dist/example.d.ts +2 -6
  50. package/dist/example.d.ts.map +1 -1
  51. package/dist/example.js +37 -50
  52. package/dist/handlers/index.d.ts +11 -16
  53. package/dist/handlers/index.d.ts.map +1 -1
  54. package/dist/handlers/index.js +5 -5
  55. package/dist/index.d.ts +13 -18
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +752 -18
  58. package/dist/invoice/index.d.ts +6 -3
  59. package/dist/invoice/index.d.ts.map +1 -0
  60. package/dist/invoice/index.js +77 -3
  61. package/dist/invoice/invoice.operations.d.ts +54 -60
  62. package/dist/invoice/invoice.operations.d.ts.map +1 -1
  63. package/dist/invoice/invoice.operations.js +74 -55
  64. package/dist/invoice/invoice.schema.d.ts +54 -59
  65. package/dist/invoice/invoice.schema.d.ts.map +1 -1
  66. package/dist/invoice/invoice.schema.js +33 -75
  67. package/dist/job/index.d.ts +6 -3
  68. package/dist/job/index.d.ts.map +1 -0
  69. package/dist/job/index.js +175 -3
  70. package/dist/job/job.operations.d.ts +220 -226
  71. package/dist/job/job.operations.d.ts.map +1 -1
  72. package/dist/job/job.operations.js +167 -169
  73. package/dist/job/job.schema.d.ts +67 -72
  74. package/dist/job/job.schema.d.ts.map +1 -1
  75. package/dist/job/job.schema.js +39 -95
  76. package/dist/node/client/client.operations.js +72 -0
  77. package/dist/node/client/client.schema.js +31 -0
  78. package/dist/node/client/index.js +74 -0
  79. package/dist/node/docs/index.js +96 -0
  80. package/dist/node/docs/service-business-os.docblock.js +96 -0
  81. package/dist/node/entities/index.js +246 -0
  82. package/dist/node/events.js +135 -0
  83. package/dist/node/example.js +39 -0
  84. package/dist/node/handlers/index.js +5 -0
  85. package/dist/node/index.js +752 -0
  86. package/dist/node/invoice/index.js +77 -0
  87. package/dist/node/invoice/invoice.operations.js +75 -0
  88. package/dist/node/invoice/invoice.schema.js +34 -0
  89. package/dist/node/job/index.js +175 -0
  90. package/dist/node/job/job.operations.js +172 -0
  91. package/dist/node/job/job.schema.js +41 -0
  92. package/dist/node/operations/index.js +506 -0
  93. package/dist/node/payment/index.js +69 -0
  94. package/dist/node/payment/payment.operations.js +67 -0
  95. package/dist/node/payment/payment.schema.js +30 -0
  96. package/dist/node/presentations/index.js +13 -0
  97. package/dist/node/presentations.js +172 -0
  98. package/dist/node/quote/index.js +122 -0
  99. package/dist/node/quote/quote.operations.js +119 -0
  100. package/dist/node/quote/quote.schema.js +45 -0
  101. package/dist/node/service-business-os.capability.js +28 -0
  102. package/dist/node/service.feature.js +74 -0
  103. package/dist/operations/index.d.ts +6 -16
  104. package/dist/operations/index.d.ts.map +1 -0
  105. package/dist/operations/index.js +506 -16
  106. package/dist/payment/index.d.ts +6 -3
  107. package/dist/payment/index.d.ts.map +1 -0
  108. package/dist/payment/index.js +69 -3
  109. package/dist/payment/payment.operations.d.ts +50 -56
  110. package/dist/payment/payment.operations.d.ts.map +1 -1
  111. package/dist/payment/payment.operations.js +66 -51
  112. package/dist/payment/payment.schema.d.ts +50 -55
  113. package/dist/payment/payment.schema.d.ts.map +1 -1
  114. package/dist/payment/payment.schema.js +29 -71
  115. package/dist/presentations/index.d.ts +1 -4
  116. package/dist/presentations/index.d.ts.map +1 -1
  117. package/dist/presentations/index.js +13 -17
  118. package/dist/presentations.d.ts +7 -12
  119. package/dist/presentations.d.ts.map +1 -1
  120. package/dist/presentations.js +166 -172
  121. package/dist/quote/index.d.ts +6 -3
  122. package/dist/quote/index.d.ts.map +1 -0
  123. package/dist/quote/index.js +122 -3
  124. package/dist/quote/quote.operations.d.ts +120 -126
  125. package/dist/quote/quote.operations.d.ts.map +1 -1
  126. package/dist/quote/quote.operations.js +117 -96
  127. package/dist/quote/quote.schema.d.ts +83 -88
  128. package/dist/quote/quote.schema.d.ts.map +1 -1
  129. package/dist/quote/quote.schema.js +43 -111
  130. package/dist/service-business-os.capability.d.ts +2 -7
  131. package/dist/service-business-os.capability.d.ts.map +1 -1
  132. package/dist/service-business-os.capability.js +29 -29
  133. package/dist/service.feature.d.ts +1 -6
  134. package/dist/service.feature.d.ts.map +1 -1
  135. package/dist/service.feature.js +73 -164
  136. package/package.json +301 -64
  137. package/dist/client/client.operations.js.map +0 -1
  138. package/dist/client/client.schema.js.map +0 -1
  139. package/dist/docs/service-business-os.docblock.js.map +0 -1
  140. package/dist/entities/index.js.map +0 -1
  141. package/dist/events.js.map +0 -1
  142. package/dist/example.js.map +0 -1
  143. package/dist/handlers/index.js.map +0 -1
  144. package/dist/invoice/invoice.operations.js.map +0 -1
  145. package/dist/invoice/invoice.schema.js.map +0 -1
  146. package/dist/job/job.operations.js.map +0 -1
  147. package/dist/job/job.schema.js.map +0 -1
  148. package/dist/payment/payment.operations.js.map +0 -1
  149. package/dist/payment/payment.schema.js.map +0 -1
  150. package/dist/presentations/index.js.map +0 -1
  151. package/dist/presentations.js.map +0 -1
  152. package/dist/quote/quote.operations.js.map +0 -1
  153. package/dist/quote/quote.schema.js.map +0 -1
  154. package/dist/service-business-os.capability.js.map +0 -1
  155. package/dist/service.feature.js.map +0 -1
@@ -1,53 +1,73 @@
1
- import { ClientModel, CreateClientInputModel } from "./client.schema.js";
2
- import { defineCommand } from "@contractspec/lib.contracts";
3
-
4
- //#region src/client/client.operations.ts
5
- const OWNERS = ["@examples.service-business-os"];
6
- /**
7
- * Create a new client.
8
- */
9
- const CreateClientContract = defineCommand({
10
- meta: {
11
- key: "service.client.create",
12
- version: "1.0.0",
13
- stability: "stable",
14
- owners: [...OWNERS],
15
- tags: [
16
- "service-business-os",
17
- "client",
18
- "create"
19
- ],
20
- description: "Create a new client.",
21
- goal: "Onboard clients.",
22
- context: "CRM."
23
- },
24
- io: {
25
- input: CreateClientInputModel,
26
- output: ClientModel
27
- },
28
- policy: { auth: "user" },
29
- acceptance: {
30
- scenarios: [{
31
- key: "create-client-happy-path",
32
- given: ["User is authenticated"],
33
- when: ["User creates a new client"],
34
- then: ["Client is created"]
35
- }],
36
- examples: [{
37
- key: "create-basic",
38
- input: {
39
- name: "Acme Corp",
40
- email: "contact@acme.com",
41
- phone: "555-0123"
42
- },
43
- output: {
44
- id: "client-123",
45
- name: "Acme Corp"
46
- }
47
- }]
48
- }
1
+ // @bun
2
+ // src/client/client.schema.ts
3
+ import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
4
+ var ClientModel = defineSchemaModel({
5
+ name: "Client",
6
+ description: "Client profile",
7
+ fields: {
8
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
9
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
10
+ contactEmail: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
11
+ phone: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
12
+ orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
13
+ ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
14
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
15
+ }
16
+ });
17
+ var CreateClientInputModel = defineSchemaModel({
18
+ name: "CreateClientInput",
19
+ description: "Input for creating a client",
20
+ fields: {
21
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
22
+ contactEmail: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
23
+ phone: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
24
+ orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
25
+ ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
26
+ metadata: { type: ScalarTypeEnum.JSON(), isOptional: true }
27
+ }
49
28
  });
50
29
 
51
- //#endregion
52
- export { CreateClientContract };
53
- //# sourceMappingURL=client.operations.js.map
30
+ // src/client/client.operations.ts
31
+ import { defineCommand } from "@contractspec/lib.contracts";
32
+ var OWNERS = ["@examples.service-business-os"];
33
+ var CreateClientContract = defineCommand({
34
+ meta: {
35
+ key: "service.client.create",
36
+ version: "1.0.0",
37
+ stability: "stable",
38
+ owners: [...OWNERS],
39
+ tags: ["service-business-os", "client", "create"],
40
+ description: "Create a new client.",
41
+ goal: "Onboard clients.",
42
+ context: "CRM."
43
+ },
44
+ io: {
45
+ input: CreateClientInputModel,
46
+ output: ClientModel
47
+ },
48
+ policy: { auth: "user" },
49
+ acceptance: {
50
+ scenarios: [
51
+ {
52
+ key: "create-client-happy-path",
53
+ given: ["User is authenticated"],
54
+ when: ["User creates a new client"],
55
+ then: ["Client is created"]
56
+ }
57
+ ],
58
+ examples: [
59
+ {
60
+ key: "create-basic",
61
+ input: {
62
+ name: "Acme Corp",
63
+ email: "contact@acme.com",
64
+ phone: "555-0123"
65
+ },
66
+ output: { id: "client-123", name: "Acme Corp" }
67
+ }
68
+ ]
69
+ }
70
+ });
71
+ export {
72
+ CreateClientContract
73
+ };
@@ -1,68 +1,63 @@
1
- import * as _contractspec_lib_schema279 from "@contractspec/lib.schema";
2
-
3
- //#region src/client/client.schema.d.ts
4
1
  /**
5
2
  * Client profile.
6
3
  */
7
- declare const ClientModel: _contractspec_lib_schema279.SchemaModel<{
8
- id: {
9
- type: _contractspec_lib_schema279.FieldType<string, string>;
10
- isOptional: false;
11
- };
12
- name: {
13
- type: _contractspec_lib_schema279.FieldType<string, string>;
14
- isOptional: false;
15
- };
16
- contactEmail: {
17
- type: _contractspec_lib_schema279.FieldType<string, string>;
18
- isOptional: true;
19
- };
20
- phone: {
21
- type: _contractspec_lib_schema279.FieldType<string, string>;
22
- isOptional: true;
23
- };
24
- orgId: {
25
- type: _contractspec_lib_schema279.FieldType<string, string>;
26
- isOptional: false;
27
- };
28
- ownerId: {
29
- type: _contractspec_lib_schema279.FieldType<string, string>;
30
- isOptional: false;
31
- };
32
- createdAt: {
33
- type: _contractspec_lib_schema279.FieldType<Date, string>;
34
- isOptional: false;
35
- };
4
+ export declare const ClientModel: import("@contractspec/lib.schema").SchemaModel<{
5
+ id: {
6
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
7
+ isOptional: false;
8
+ };
9
+ name: {
10
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
11
+ isOptional: false;
12
+ };
13
+ contactEmail: {
14
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
15
+ isOptional: true;
16
+ };
17
+ phone: {
18
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
19
+ isOptional: true;
20
+ };
21
+ orgId: {
22
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
23
+ isOptional: false;
24
+ };
25
+ ownerId: {
26
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
27
+ isOptional: false;
28
+ };
29
+ createdAt: {
30
+ type: import("@contractspec/lib.schema").FieldType<Date, string>;
31
+ isOptional: false;
32
+ };
36
33
  }>;
37
34
  /**
38
35
  * Input for creating a client.
39
36
  */
40
- declare const CreateClientInputModel: _contractspec_lib_schema279.SchemaModel<{
41
- name: {
42
- type: _contractspec_lib_schema279.FieldType<string, string>;
43
- isOptional: false;
44
- };
45
- contactEmail: {
46
- type: _contractspec_lib_schema279.FieldType<string, string>;
47
- isOptional: true;
48
- };
49
- phone: {
50
- type: _contractspec_lib_schema279.FieldType<string, string>;
51
- isOptional: true;
52
- };
53
- orgId: {
54
- type: _contractspec_lib_schema279.FieldType<string, string>;
55
- isOptional: false;
56
- };
57
- ownerId: {
58
- type: _contractspec_lib_schema279.FieldType<string, string>;
59
- isOptional: false;
60
- };
61
- metadata: {
62
- type: _contractspec_lib_schema279.FieldType<unknown, unknown>;
63
- isOptional: true;
64
- };
37
+ export declare const CreateClientInputModel: import("@contractspec/lib.schema").SchemaModel<{
38
+ name: {
39
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
40
+ isOptional: false;
41
+ };
42
+ contactEmail: {
43
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
44
+ isOptional: true;
45
+ };
46
+ phone: {
47
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
48
+ isOptional: true;
49
+ };
50
+ orgId: {
51
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
52
+ isOptional: false;
53
+ };
54
+ ownerId: {
55
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
56
+ isOptional: false;
57
+ };
58
+ metadata: {
59
+ type: import("@contractspec/lib.schema").FieldType<unknown, unknown>;
60
+ isOptional: true;
61
+ };
65
62
  }>;
66
- //#endregion
67
- export { ClientModel, CreateClientInputModel };
68
63
  //# sourceMappingURL=client.schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.schema.d.ts","names":[],"sources":["../../src/client/client.schema.ts"],"sourcesContent":[],"mappings":";;;;;;AAKa,cAAA,WAYX,8BAZsB,WAYtB,CAAA;EAAA,EAAA,EAAA;UAAA,2BAAA,CAAA;;;;;;;;IAZsB,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAiBX,UAAA,EAAA,IAAA;EAWX,CAAA;;;;;;+CAXiC,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;;;;;;;;cAAtB,oDAAsB;;UAWjC,2BAAA,CAAA"}
1
+ {"version":3,"file":"client.schema.d.ts","sourceRoot":"","sources":["../../src/client/client.schema.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYtB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;EAWjC,CAAC"}
@@ -1,77 +1,32 @@
1
- import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
2
-
3
- //#region src/client/client.schema.ts
4
- /**
5
- * Client profile.
6
- */
7
- const ClientModel = defineSchemaModel({
8
- name: "Client",
9
- description: "Client profile",
10
- fields: {
11
- id: {
12
- type: ScalarTypeEnum.String_unsecure(),
13
- isOptional: false
14
- },
15
- name: {
16
- type: ScalarTypeEnum.String_unsecure(),
17
- isOptional: false
18
- },
19
- contactEmail: {
20
- type: ScalarTypeEnum.String_unsecure(),
21
- isOptional: true
22
- },
23
- phone: {
24
- type: ScalarTypeEnum.String_unsecure(),
25
- isOptional: true
26
- },
27
- orgId: {
28
- type: ScalarTypeEnum.String_unsecure(),
29
- isOptional: false
30
- },
31
- ownerId: {
32
- type: ScalarTypeEnum.String_unsecure(),
33
- isOptional: false
34
- },
35
- createdAt: {
36
- type: ScalarTypeEnum.DateTime(),
37
- isOptional: false
38
- }
39
- }
1
+ // @bun
2
+ // src/client/client.schema.ts
3
+ import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
4
+ var ClientModel = defineSchemaModel({
5
+ name: "Client",
6
+ description: "Client profile",
7
+ fields: {
8
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
9
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
10
+ contactEmail: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
11
+ phone: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
12
+ orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
13
+ ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
14
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
15
+ }
40
16
  });
41
- /**
42
- * Input for creating a client.
43
- */
44
- const CreateClientInputModel = defineSchemaModel({
45
- name: "CreateClientInput",
46
- description: "Input for creating a client",
47
- fields: {
48
- name: {
49
- type: ScalarTypeEnum.String_unsecure(),
50
- isOptional: false
51
- },
52
- contactEmail: {
53
- type: ScalarTypeEnum.String_unsecure(),
54
- isOptional: true
55
- },
56
- phone: {
57
- type: ScalarTypeEnum.String_unsecure(),
58
- isOptional: true
59
- },
60
- orgId: {
61
- type: ScalarTypeEnum.String_unsecure(),
62
- isOptional: false
63
- },
64
- ownerId: {
65
- type: ScalarTypeEnum.String_unsecure(),
66
- isOptional: false
67
- },
68
- metadata: {
69
- type: ScalarTypeEnum.JSON(),
70
- isOptional: true
71
- }
72
- }
17
+ var CreateClientInputModel = defineSchemaModel({
18
+ name: "CreateClientInput",
19
+ description: "Input for creating a client",
20
+ fields: {
21
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
22
+ contactEmail: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
23
+ phone: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
24
+ orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
25
+ ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
26
+ metadata: { type: ScalarTypeEnum.JSON(), isOptional: true }
27
+ }
73
28
  });
74
-
75
- //#endregion
76
- export { ClientModel, CreateClientInputModel };
77
- //# sourceMappingURL=client.schema.js.map
29
+ export {
30
+ CreateClientInputModel,
31
+ ClientModel
32
+ };
@@ -1,3 +1,6 @@
1
- import { CreateClientContract } from "./client.operations.js";
2
- import { ClientModel, CreateClientInputModel } from "./client.schema.js";
3
- export { ClientModel, CreateClientContract, CreateClientInputModel };
1
+ /**
2
+ * Client domain - Client management.
3
+ */
4
+ export { ClientModel, CreateClientInputModel } from './client.schema';
5
+ export { CreateClientContract } from './client.operations';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,4 +1,75 @@
1
- import { ClientModel, CreateClientInputModel } from "./client.schema.js";
2
- import { CreateClientContract } from "./client.operations.js";
1
+ // @bun
2
+ // src/client/client.schema.ts
3
+ import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
4
+ var ClientModel = defineSchemaModel({
5
+ name: "Client",
6
+ description: "Client profile",
7
+ fields: {
8
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
9
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
10
+ contactEmail: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
11
+ phone: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
12
+ orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
13
+ ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
14
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
15
+ }
16
+ });
17
+ var CreateClientInputModel = defineSchemaModel({
18
+ name: "CreateClientInput",
19
+ description: "Input for creating a client",
20
+ fields: {
21
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
22
+ contactEmail: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
23
+ phone: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
24
+ orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
25
+ ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
26
+ metadata: { type: ScalarTypeEnum.JSON(), isOptional: true }
27
+ }
28
+ });
3
29
 
4
- export { ClientModel, CreateClientContract, CreateClientInputModel };
30
+ // src/client/client.operations.ts
31
+ import { defineCommand } from "@contractspec/lib.contracts";
32
+ var OWNERS = ["@examples.service-business-os"];
33
+ var CreateClientContract = defineCommand({
34
+ meta: {
35
+ key: "service.client.create",
36
+ version: "1.0.0",
37
+ stability: "stable",
38
+ owners: [...OWNERS],
39
+ tags: ["service-business-os", "client", "create"],
40
+ description: "Create a new client.",
41
+ goal: "Onboard clients.",
42
+ context: "CRM."
43
+ },
44
+ io: {
45
+ input: CreateClientInputModel,
46
+ output: ClientModel
47
+ },
48
+ policy: { auth: "user" },
49
+ acceptance: {
50
+ scenarios: [
51
+ {
52
+ key: "create-client-happy-path",
53
+ given: ["User is authenticated"],
54
+ when: ["User creates a new client"],
55
+ then: ["Client is created"]
56
+ }
57
+ ],
58
+ examples: [
59
+ {
60
+ key: "create-basic",
61
+ input: {
62
+ name: "Acme Corp",
63
+ email: "contact@acme.com",
64
+ phone: "555-0123"
65
+ },
66
+ output: { id: "client-123", name: "Acme Corp" }
67
+ }
68
+ ]
69
+ }
70
+ });
71
+ export {
72
+ CreateClientInputModel,
73
+ CreateClientContract,
74
+ ClientModel
75
+ };
@@ -1 +1,2 @@
1
- export { };
1
+ import './service-business-os.docblock';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/docs/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC"}
@@ -1 +1,97 @@
1
- import "./service-business-os.docblock.js";
1
+ // @bun
2
+ // src/docs/service-business-os.docblock.ts
3
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
4
+ var serviceBusinessDocBlocks = [
5
+ {
6
+ id: "docs.examples.service-business-os",
7
+ title: "Service Business OS",
8
+ summary: "Field/service business flow from client intake to quote, job scheduling, invoicing, and payments with notifications and audit trail.",
9
+ kind: "reference",
10
+ visibility: "public",
11
+ route: "/docs/examples/service-business-os",
12
+ tags: ["services", "quotes", "jobs", "invoices", "payments"],
13
+ body: `## Flows
14
+
15
+ 1) **Client intake** \u2192 create client, capture contact + owner.
16
+ 2) **Quote** \u2192 draft, send, accept/reject (events + notifications).
17
+ 3) **Job** \u2192 schedule, assign technician, complete with notes and attachments.
18
+ 4) **Invoice** \u2192 issue after completion, track status.
19
+ 5) **Payment** \u2192 record payment and emit analytics/audit.
20
+
21
+ ## Modules reused
22
+ - Identity/RBAC for org + roles
23
+ - Files for attachments (proposals, receipts)
24
+ - Notifications for quote sent/accepted, job reminders, overdue invoices
25
+ - Jobs for reminder/schedule tasks
26
+ - Audit trail for all lifecycle changes
27
+
28
+ ## Presentations
29
+ - Dashboard, client list, quote list/detail, job board, invoice list, payment list (React + Markdown targets).
30
+ `
31
+ },
32
+ {
33
+ id: "docs.examples.service-business-os.goal",
34
+ title: "Service Business OS \u2014 Goal",
35
+ summary: "Why this field-service OS exists and outcomes it targets.",
36
+ kind: "goal",
37
+ visibility: "public",
38
+ route: "/docs/examples/service-business-os/goal",
39
+ tags: ["services", "goal"],
40
+ body: `## Why it matters
41
+ - Provides a regenerable, end-to-end service lifecycle (client \u2192 quote \u2192 job \u2192 invoice \u2192 payment).
42
+ - Keeps pricing, scheduling, invoicing, and payments consistent across surfaces.
43
+
44
+ ## Business/Product goal
45
+ - Deliver auditable quotes/jobs/invoices with notifications and reminders.
46
+ - Support attachments and PII-safe flows; stage new payment rules via feature flags.
47
+
48
+ ## Success criteria
49
+ - Spec changes regenerate UI/API/events cleanly across lifecycle steps.
50
+ - Audit/Notifications/Jobs remain wired for every mutation.`
51
+ },
52
+ {
53
+ id: "docs.examples.service-business-os.usage",
54
+ title: "Service Business OS \u2014 Usage",
55
+ summary: "How to operate, extend, and regenerate the service OS safely.",
56
+ kind: "usage",
57
+ visibility: "public",
58
+ route: "/docs/examples/service-business-os/usage",
59
+ tags: ["services", "usage"],
60
+ body: `## Setup
61
+ 1) Seed (if provided) or create client \u2192 quote \u2192 job \u2192 invoice \u2192 payment via UI.
62
+ 2) Configure Files for attachments and Notifications for quote/job/invoice events.
63
+
64
+ ## Extend & regenerate
65
+ 1) Adjust schemas: quote line items, job statuses, invoice terms, payment methods.
66
+ 2) Regenerate to sync UI/API/events; mark PII paths in policy.
67
+ 3) Use Feature Flags to trial new payment rules or reminder cadences.
68
+
69
+ ## Guardrails
70
+ - Emit events for quote accepted/rejected, job scheduled/completed, invoice overdue, payment recorded.
71
+ - Keep pricing/tax rules explicit in spec; avoid implicit handler math.
72
+ - Use Audit Trail for lifecycle mutations; schedule reminders via Jobs.`
73
+ },
74
+ {
75
+ id: "docs.examples.service-business-os.constraints",
76
+ title: "Service Business OS \u2014 Constraints & Safety",
77
+ summary: "Internal guardrails for quotes/jobs/invoices/payments and regeneration safety.",
78
+ kind: "reference",
79
+ visibility: "internal",
80
+ route: "/docs/examples/service-business-os/constraints",
81
+ tags: ["services", "constraints", "internal"],
82
+ body: `## Constraints
83
+ - Commission/tax/payment rules must be explicit in spec; no hidden handler math.
84
+ - Events to emit: quote.sent/accepted/rejected, job.scheduled/completed, invoice.issued/overdue, payment.recorded.
85
+ - Regeneration must not alter payment semantics without reviewed spec changes.
86
+
87
+ ## PII & Attachments
88
+ - Mark PII paths (client contact, address); redact in markdown/JSON.
89
+ - Files (quotes, receipts) should use presigned URLs with scoped access.
90
+
91
+ ## Verification
92
+ - Add fixtures for quote/job/invoice state transitions.
93
+ - Ensure Notifications/Audit/Jobs wiring persists after regeneration.
94
+ - Use Feature Flags to trial new payment rules/reminder cadences; default safe/off.`
95
+ }
96
+ ];
97
+ registerDocBlocks(serviceBusinessDocBlocks);
@@ -1 +1,2 @@
1
- export { };
1
+ export {};
2
+ //# sourceMappingURL=service-business-os.docblock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-business-os.docblock.d.ts","sourceRoot":"","sources":["../../src/docs/service-business-os.docblock.ts"],"names":[],"mappings":""}