@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,289 +1,247 @@
1
- import { defineEntity, defineEntityEnum, field, index } from "@contractspec/lib.schema";
2
-
3
- //#region src/entities/index.ts
4
- const schema = "lssm_service_os";
5
- const QuoteStatusEnum = defineEntityEnum({
6
- name: "QuoteStatus",
7
- schema,
8
- values: [
9
- "DRAFT",
10
- "SENT",
11
- "ACCEPTED",
12
- "REJECTED",
13
- "EXPIRED"
14
- ],
15
- description: "Lifecycle for quotes/proposals."
1
+ // @bun
2
+ // src/entities/index.ts
3
+ import {
4
+ defineEntity,
5
+ defineEntityEnum,
6
+ field,
7
+ index
8
+ } from "@contractspec/lib.schema";
9
+ var schema = "lssm_service_os";
10
+ var QuoteStatusEnum = defineEntityEnum({
11
+ name: "QuoteStatus",
12
+ schema,
13
+ values: ["DRAFT", "SENT", "ACCEPTED", "REJECTED", "EXPIRED"],
14
+ description: "Lifecycle for quotes/proposals."
16
15
  });
17
- const JobStatusEnum = defineEntityEnum({
18
- name: "JobStatus",
19
- schema,
20
- values: [
21
- "SCHEDULED",
22
- "IN_PROGRESS",
23
- "COMPLETED",
24
- "CANCELLED"
25
- ],
26
- description: "Lifecycle for service jobs/interventions."
16
+ var JobStatusEnum = defineEntityEnum({
17
+ name: "JobStatus",
18
+ schema,
19
+ values: ["SCHEDULED", "IN_PROGRESS", "COMPLETED", "CANCELLED"],
20
+ description: "Lifecycle for service jobs/interventions."
27
21
  });
28
- const InvoiceStatusEnum = defineEntityEnum({
29
- name: "InvoiceStatus",
30
- schema,
31
- values: [
32
- "DRAFT",
33
- "SENT",
34
- "PAID",
35
- "OVERDUE",
36
- "CANCELLED"
37
- ],
38
- description: "Lifecycle for invoices."
22
+ var InvoiceStatusEnum = defineEntityEnum({
23
+ name: "InvoiceStatus",
24
+ schema,
25
+ values: ["DRAFT", "SENT", "PAID", "OVERDUE", "CANCELLED"],
26
+ description: "Lifecycle for invoices."
39
27
  });
40
- const PaymentMethodEnum = defineEntityEnum({
41
- name: "PaymentMethod",
42
- schema,
43
- values: [
44
- "CARD",
45
- "BANK_TRANSFER",
46
- "CASH",
47
- "CHECK"
48
- ],
49
- description: "Payment method used."
28
+ var PaymentMethodEnum = defineEntityEnum({
29
+ name: "PaymentMethod",
30
+ schema,
31
+ values: ["CARD", "BANK_TRANSFER", "CASH", "CHECK"],
32
+ description: "Payment method used."
50
33
  });
51
- const ClientEntity = defineEntity({
52
- name: "Client",
53
- description: "Customer organization or individual.",
54
- schema,
55
- map: "client",
56
- fields: {
57
- id: field.id({ description: "Unique client identifier" }),
58
- name: field.string({ description: "Client display name" }),
59
- contactEmail: field.string({
60
- description: "Primary contact email",
61
- isOptional: true
62
- }),
63
- phone: field.string({
64
- description: "Primary phone",
65
- isOptional: true
66
- }),
67
- address: field.json({
68
- description: "Mailing address",
69
- isOptional: true
70
- }),
71
- industry: field.string({
72
- description: "Industry/vertical",
73
- isOptional: true
74
- }),
75
- orgId: field.string({ description: "Owning organization" }),
76
- ownerId: field.string({ description: "Account owner" }),
77
- metadata: field.json({
78
- description: "Additional metadata",
79
- isOptional: true
80
- }),
81
- createdAt: field.createdAt(),
82
- updatedAt: field.updatedAt(),
83
- quotes: field.hasMany("Quote"),
84
- jobs: field.hasMany("Job")
85
- },
86
- indexes: [
87
- index.on(["orgId"]),
88
- index.on(["ownerId"]),
89
- index.on(["name"])
90
- ]
34
+ var ClientEntity = defineEntity({
35
+ name: "Client",
36
+ description: "Customer organization or individual.",
37
+ schema,
38
+ map: "client",
39
+ fields: {
40
+ id: field.id({ description: "Unique client identifier" }),
41
+ name: field.string({ description: "Client display name" }),
42
+ contactEmail: field.string({
43
+ description: "Primary contact email",
44
+ isOptional: true
45
+ }),
46
+ phone: field.string({ description: "Primary phone", isOptional: true }),
47
+ address: field.json({ description: "Mailing address", isOptional: true }),
48
+ industry: field.string({
49
+ description: "Industry/vertical",
50
+ isOptional: true
51
+ }),
52
+ orgId: field.string({ description: "Owning organization" }),
53
+ ownerId: field.string({ description: "Account owner" }),
54
+ metadata: field.json({
55
+ description: "Additional metadata",
56
+ isOptional: true
57
+ }),
58
+ createdAt: field.createdAt(),
59
+ updatedAt: field.updatedAt(),
60
+ quotes: field.hasMany("Quote"),
61
+ jobs: field.hasMany("Job")
62
+ },
63
+ indexes: [index.on(["orgId"]), index.on(["ownerId"]), index.on(["name"])]
91
64
  });
92
- const QuoteEntity = defineEntity({
93
- name: "Quote",
94
- description: "Proposal/quote for a job.",
95
- schema,
96
- map: "quote",
97
- fields: {
98
- id: field.id({ description: "Unique quote identifier" }),
99
- clientId: field.foreignKey({ description: "Client receiving quote" }),
100
- title: field.string({ description: "Quote title" }),
101
- description: field.string({
102
- description: "Work summary",
103
- isOptional: true
104
- }),
105
- amount: field.float({ description: "Total quoted amount" }),
106
- currency: field.string({
107
- description: "Currency code",
108
- default: "\"USD\""
109
- }),
110
- status: field.enum("QuoteStatus", {
111
- description: "Quote status",
112
- default: "DRAFT"
113
- }),
114
- validUntil: field.dateTime({
115
- description: "Expiration date",
116
- isOptional: true
117
- }),
118
- terms: field.string({
119
- description: "Payment/engagement terms",
120
- isOptional: true
121
- }),
122
- orgId: field.string({ description: "Owning organization" }),
123
- ownerId: field.string({ description: "Account owner" }),
124
- createdAt: field.createdAt(),
125
- updatedAt: field.updatedAt(),
126
- client: field.belongsTo("Client", ["clientId"], ["id"], { onDelete: "Cascade" }),
127
- jobs: field.hasMany("Job")
128
- },
129
- enums: [QuoteStatusEnum],
130
- indexes: [
131
- index.on(["orgId", "status"]),
132
- index.on(["clientId"]),
133
- index.on(["validUntil"])
134
- ]
65
+ var QuoteEntity = defineEntity({
66
+ name: "Quote",
67
+ description: "Proposal/quote for a job.",
68
+ schema,
69
+ map: "quote",
70
+ fields: {
71
+ id: field.id({ description: "Unique quote identifier" }),
72
+ clientId: field.foreignKey({ description: "Client receiving quote" }),
73
+ title: field.string({ description: "Quote title" }),
74
+ description: field.string({
75
+ description: "Work summary",
76
+ isOptional: true
77
+ }),
78
+ amount: field.float({ description: "Total quoted amount" }),
79
+ currency: field.string({ description: "Currency code", default: '"USD"' }),
80
+ status: field.enum("QuoteStatus", {
81
+ description: "Quote status",
82
+ default: "DRAFT"
83
+ }),
84
+ validUntil: field.dateTime({
85
+ description: "Expiration date",
86
+ isOptional: true
87
+ }),
88
+ terms: field.string({
89
+ description: "Payment/engagement terms",
90
+ isOptional: true
91
+ }),
92
+ orgId: field.string({ description: "Owning organization" }),
93
+ ownerId: field.string({ description: "Account owner" }),
94
+ createdAt: field.createdAt(),
95
+ updatedAt: field.updatedAt(),
96
+ client: field.belongsTo("Client", ["clientId"], ["id"], {
97
+ onDelete: "Cascade"
98
+ }),
99
+ jobs: field.hasMany("Job")
100
+ },
101
+ enums: [QuoteStatusEnum],
102
+ indexes: [
103
+ index.on(["orgId", "status"]),
104
+ index.on(["clientId"]),
105
+ index.on(["validUntil"])
106
+ ]
135
107
  });
136
- const JobEntity = defineEntity({
137
- name: "Job",
138
- description: "Service job/intervention derived from an accepted quote.",
139
- schema,
140
- map: "job",
141
- fields: {
142
- id: field.id({ description: "Unique job identifier" }),
143
- quoteId: field.foreignKey({ description: "Source quote" }),
144
- clientId: field.foreignKey({ description: "Client receiving service" }),
145
- title: field.string({ description: "Job title" }),
146
- status: field.enum("JobStatus", {
147
- description: "Job status",
148
- default: "SCHEDULED"
149
- }),
150
- scheduledAt: field.dateTime({
151
- description: "Scheduled start date/time",
152
- isOptional: true
153
- }),
154
- completedAt: field.dateTime({
155
- description: "Completion timestamp",
156
- isOptional: true
157
- }),
158
- assignedTo: field.string({
159
- description: "Assignee/technician user ID",
160
- isOptional: true
161
- }),
162
- location: field.json({
163
- description: "Location details",
164
- isOptional: true
165
- }),
166
- notes: field.string({
167
- description: "Internal notes",
168
- isOptional: true
169
- }),
170
- orgId: field.string({ description: "Owning organization" }),
171
- createdAt: field.createdAt(),
172
- updatedAt: field.updatedAt(),
173
- quote: field.belongsTo("Quote", ["quoteId"], ["id"], { onDelete: "SetNull" }),
174
- client: field.belongsTo("Client", ["clientId"], ["id"], { onDelete: "Cascade" }),
175
- invoices: field.hasMany("Invoice")
176
- },
177
- enums: [JobStatusEnum],
178
- indexes: [
179
- index.on(["orgId", "status"]),
180
- index.on(["clientId"]),
181
- index.on(["assignedTo", "status"]),
182
- index.on(["scheduledAt"])
183
- ]
108
+ var JobEntity = defineEntity({
109
+ name: "Job",
110
+ description: "Service job/intervention derived from an accepted quote.",
111
+ schema,
112
+ map: "job",
113
+ fields: {
114
+ id: field.id({ description: "Unique job identifier" }),
115
+ quoteId: field.foreignKey({ description: "Source quote" }),
116
+ clientId: field.foreignKey({ description: "Client receiving service" }),
117
+ title: field.string({ description: "Job title" }),
118
+ status: field.enum("JobStatus", {
119
+ description: "Job status",
120
+ default: "SCHEDULED"
121
+ }),
122
+ scheduledAt: field.dateTime({
123
+ description: "Scheduled start date/time",
124
+ isOptional: true
125
+ }),
126
+ completedAt: field.dateTime({
127
+ description: "Completion timestamp",
128
+ isOptional: true
129
+ }),
130
+ assignedTo: field.string({
131
+ description: "Assignee/technician user ID",
132
+ isOptional: true
133
+ }),
134
+ location: field.json({ description: "Location details", isOptional: true }),
135
+ notes: field.string({ description: "Internal notes", isOptional: true }),
136
+ orgId: field.string({ description: "Owning organization" }),
137
+ createdAt: field.createdAt(),
138
+ updatedAt: field.updatedAt(),
139
+ quote: field.belongsTo("Quote", ["quoteId"], ["id"], {
140
+ onDelete: "SetNull"
141
+ }),
142
+ client: field.belongsTo("Client", ["clientId"], ["id"], {
143
+ onDelete: "Cascade"
144
+ }),
145
+ invoices: field.hasMany("Invoice")
146
+ },
147
+ enums: [JobStatusEnum],
148
+ indexes: [
149
+ index.on(["orgId", "status"]),
150
+ index.on(["clientId"]),
151
+ index.on(["assignedTo", "status"]),
152
+ index.on(["scheduledAt"])
153
+ ]
184
154
  });
185
- const InvoiceEntity = defineEntity({
186
- name: "Invoice",
187
- description: "Invoice issued for a completed job.",
188
- schema,
189
- map: "invoice",
190
- fields: {
191
- id: field.id({ description: "Unique invoice identifier" }),
192
- jobId: field.foreignKey({ description: "Related job" }),
193
- invoiceNumber: field.string({
194
- description: "Invoice number",
195
- isUnique: true
196
- }),
197
- amount: field.decimal({ description: "Invoice amount" }),
198
- currency: field.string({
199
- description: "Currency code",
200
- default: "\"USD\""
201
- }),
202
- status: field.enum("InvoiceStatus", {
203
- description: "Invoice status",
204
- default: "DRAFT"
205
- }),
206
- dueDate: field.dateTime({
207
- description: "Due date",
208
- isOptional: true
209
- }),
210
- issuedAt: field.dateTime({
211
- description: "Issued timestamp",
212
- isOptional: true
213
- }),
214
- paidAt: field.dateTime({
215
- description: "Paid timestamp",
216
- isOptional: true
217
- }),
218
- orgId: field.string({ description: "Owning organization" }),
219
- notes: field.string({
220
- description: "Invoice notes",
221
- isOptional: true
222
- }),
223
- metadata: field.json({
224
- description: "Metadata",
225
- isOptional: true
226
- }),
227
- createdAt: field.createdAt(),
228
- updatedAt: field.updatedAt(),
229
- job: field.belongsTo("Job", ["jobId"], ["id"], { onDelete: "Cascade" }),
230
- payments: field.hasMany("Payment")
231
- },
232
- enums: [InvoiceStatusEnum],
233
- indexes: [
234
- index.on(["invoiceNumber"]),
235
- index.on(["orgId", "status"]),
236
- index.on(["dueDate"])
237
- ]
155
+ var InvoiceEntity = defineEntity({
156
+ name: "Invoice",
157
+ description: "Invoice issued for a completed job.",
158
+ schema,
159
+ map: "invoice",
160
+ fields: {
161
+ id: field.id({ description: "Unique invoice identifier" }),
162
+ jobId: field.foreignKey({ description: "Related job" }),
163
+ invoiceNumber: field.string({
164
+ description: "Invoice number",
165
+ isUnique: true
166
+ }),
167
+ amount: field.decimal({ description: "Invoice amount" }),
168
+ currency: field.string({ description: "Currency code", default: '"USD"' }),
169
+ status: field.enum("InvoiceStatus", {
170
+ description: "Invoice status",
171
+ default: "DRAFT"
172
+ }),
173
+ dueDate: field.dateTime({ description: "Due date", isOptional: true }),
174
+ issuedAt: field.dateTime({
175
+ description: "Issued timestamp",
176
+ isOptional: true
177
+ }),
178
+ paidAt: field.dateTime({ description: "Paid timestamp", isOptional: true }),
179
+ orgId: field.string({ description: "Owning organization" }),
180
+ notes: field.string({ description: "Invoice notes", isOptional: true }),
181
+ metadata: field.json({ description: "Metadata", isOptional: true }),
182
+ createdAt: field.createdAt(),
183
+ updatedAt: field.updatedAt(),
184
+ job: field.belongsTo("Job", ["jobId"], ["id"], { onDelete: "Cascade" }),
185
+ payments: field.hasMany("Payment")
186
+ },
187
+ enums: [InvoiceStatusEnum],
188
+ indexes: [
189
+ index.on(["invoiceNumber"]),
190
+ index.on(["orgId", "status"]),
191
+ index.on(["dueDate"])
192
+ ]
238
193
  });
239
- const PaymentEntity = defineEntity({
240
- name: "Payment",
241
- description: "Payment received for an invoice.",
242
- schema,
243
- map: "payment",
244
- fields: {
245
- id: field.id({ description: "Unique payment identifier" }),
246
- invoiceId: field.foreignKey({ description: "Invoice being paid" }),
247
- amount: field.decimal({ description: "Payment amount" }),
248
- currency: field.string({
249
- description: "Currency code",
250
- default: "\"USD\""
251
- }),
252
- method: field.enum("PaymentMethod", { description: "Payment method" }),
253
- reference: field.string({
254
- description: "Payment reference/transaction ID",
255
- isOptional: true
256
- }),
257
- receivedAt: field.dateTime({ description: "When payment was received" }),
258
- orgId: field.string({ description: "Owning organization" }),
259
- createdAt: field.createdAt(),
260
- invoice: field.belongsTo("Invoice", ["invoiceId"], ["id"], { onDelete: "Cascade" })
261
- },
262
- enums: [PaymentMethodEnum],
263
- indexes: [
264
- index.on(["invoiceId"]),
265
- index.on(["orgId"]),
266
- index.on(["receivedAt"])
267
- ]
194
+ var PaymentEntity = defineEntity({
195
+ name: "Payment",
196
+ description: "Payment received for an invoice.",
197
+ schema,
198
+ map: "payment",
199
+ fields: {
200
+ id: field.id({ description: "Unique payment identifier" }),
201
+ invoiceId: field.foreignKey({ description: "Invoice being paid" }),
202
+ amount: field.decimal({ description: "Payment amount" }),
203
+ currency: field.string({ description: "Currency code", default: '"USD"' }),
204
+ method: field.enum("PaymentMethod", { description: "Payment method" }),
205
+ reference: field.string({
206
+ description: "Payment reference/transaction ID",
207
+ isOptional: true
208
+ }),
209
+ receivedAt: field.dateTime({ description: "When payment was received" }),
210
+ orgId: field.string({ description: "Owning organization" }),
211
+ createdAt: field.createdAt(),
212
+ invoice: field.belongsTo("Invoice", ["invoiceId"], ["id"], {
213
+ onDelete: "Cascade"
214
+ })
215
+ },
216
+ enums: [PaymentMethodEnum],
217
+ indexes: [
218
+ index.on(["invoiceId"]),
219
+ index.on(["orgId"]),
220
+ index.on(["receivedAt"])
221
+ ]
268
222
  });
269
- const serviceBusinessEntities = [
270
- ClientEntity,
271
- QuoteEntity,
272
- JobEntity,
273
- InvoiceEntity,
274
- PaymentEntity
223
+ var serviceBusinessEntities = [
224
+ ClientEntity,
225
+ QuoteEntity,
226
+ JobEntity,
227
+ InvoiceEntity,
228
+ PaymentEntity
275
229
  ];
276
- const serviceBusinessSchemaContribution = {
277
- moduleId: "@contractspec/example.service-business-os",
278
- entities: serviceBusinessEntities,
279
- enums: [
280
- QuoteStatusEnum,
281
- JobStatusEnum,
282
- InvoiceStatusEnum,
283
- PaymentMethodEnum
284
- ]
230
+ var serviceBusinessSchemaContribution = {
231
+ moduleId: "@contractspec/example.service-business-os",
232
+ entities: serviceBusinessEntities,
233
+ enums: [QuoteStatusEnum, JobStatusEnum, InvoiceStatusEnum, PaymentMethodEnum]
234
+ };
235
+ export {
236
+ serviceBusinessSchemaContribution,
237
+ serviceBusinessEntities,
238
+ QuoteStatusEnum,
239
+ QuoteEntity,
240
+ PaymentMethodEnum,
241
+ PaymentEntity,
242
+ JobStatusEnum,
243
+ JobEntity,
244
+ InvoiceStatusEnum,
245
+ InvoiceEntity,
246
+ ClientEntity
285
247
  };
286
-
287
- //#endregion
288
- export { ClientEntity, InvoiceEntity, InvoiceStatusEnum, JobEntity, JobStatusEnum, PaymentEntity, PaymentMethodEnum, QuoteEntity, QuoteStatusEnum, serviceBusinessEntities, serviceBusinessSchemaContribution };
289
- //# sourceMappingURL=index.js.map