@contractspec/example.marketplace 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 (152) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +141 -0
  3. package/dist/docs/index.d.ts +1 -0
  4. package/dist/docs/index.js +1 -0
  5. package/dist/docs/marketplace.docblock.d.ts +1 -0
  6. package/dist/docs/marketplace.docblock.js +115 -0
  7. package/dist/docs/marketplace.docblock.js.map +1 -0
  8. package/dist/entities/index.d.ts +309 -0
  9. package/dist/entities/index.d.ts.map +1 -0
  10. package/dist/entities/index.js +46 -0
  11. package/dist/entities/index.js.map +1 -0
  12. package/dist/entities/order.d.ts +105 -0
  13. package/dist/entities/order.d.ts.map +1 -0
  14. package/dist/entities/order.js +173 -0
  15. package/dist/entities/order.js.map +1 -0
  16. package/dist/entities/payout.d.ts +92 -0
  17. package/dist/entities/payout.d.ts.map +1 -0
  18. package/dist/entities/payout.js +162 -0
  19. package/dist/entities/payout.js.map +1 -0
  20. package/dist/entities/product.d.ts +93 -0
  21. package/dist/entities/product.d.ts.map +1 -0
  22. package/dist/entities/product.js +161 -0
  23. package/dist/entities/product.js.map +1 -0
  24. package/dist/entities/review.d.ts +83 -0
  25. package/dist/entities/review.d.ts.map +1 -0
  26. package/dist/entities/review.js +152 -0
  27. package/dist/entities/review.js.map +1 -0
  28. package/dist/entities/store.d.ts +60 -0
  29. package/dist/entities/store.d.ts.map +1 -0
  30. package/dist/entities/store.js +110 -0
  31. package/dist/entities/store.js.map +1 -0
  32. package/dist/example.d.ts +40 -0
  33. package/dist/example.d.ts.map +1 -0
  34. package/dist/example.js +51 -0
  35. package/dist/example.js.map +1 -0
  36. package/dist/index.d.ts +26 -0
  37. package/dist/index.js +27 -0
  38. package/dist/marketplace.feature.d.ts +12 -0
  39. package/dist/marketplace.feature.d.ts.map +1 -0
  40. package/dist/marketplace.feature.js +310 -0
  41. package/dist/marketplace.feature.js.map +1 -0
  42. package/dist/order/index.d.ts +5 -0
  43. package/dist/order/index.js +6 -0
  44. package/dist/order/order.enum.d.ts +10 -0
  45. package/dist/order/order.enum.d.ts.map +1 -0
  46. package/dist/order/order.enum.js +22 -0
  47. package/dist/order/order.enum.js.map +1 -0
  48. package/dist/order/order.event.d.ts +145 -0
  49. package/dist/order/order.event.d.ts.map +1 -0
  50. package/dist/order/order.event.js +216 -0
  51. package/dist/order/order.event.js.map +1 -0
  52. package/dist/order/order.operations.d.ts +368 -0
  53. package/dist/order/order.operations.d.ts.map +1 -0
  54. package/dist/order/order.operations.js +119 -0
  55. package/dist/order/order.operations.js.map +1 -0
  56. package/dist/order/order.presentation.d.ts +9 -0
  57. package/dist/order/order.presentation.d.ts.map +1 -0
  58. package/dist/order/order.presentation.js +86 -0
  59. package/dist/order/order.presentation.js.map +1 -0
  60. package/dist/order/order.schema.d.ts +165 -0
  61. package/dist/order/order.schema.d.ts.map +1 -0
  62. package/dist/order/order.schema.js +155 -0
  63. package/dist/order/order.schema.js.map +1 -0
  64. package/dist/payout/index.d.ts +5 -0
  65. package/dist/payout/index.js +6 -0
  66. package/dist/payout/payout.enum.d.ts +10 -0
  67. package/dist/payout/payout.enum.d.ts.map +1 -0
  68. package/dist/payout/payout.enum.js +17 -0
  69. package/dist/payout/payout.enum.js.map +1 -0
  70. package/dist/payout/payout.event.d.ts +63 -0
  71. package/dist/payout/payout.event.d.ts.map +1 -0
  72. package/dist/payout/payout.event.js +92 -0
  73. package/dist/payout/payout.event.js.map +1 -0
  74. package/dist/payout/payout.operations.d.ts +97 -0
  75. package/dist/payout/payout.operations.d.ts.map +1 -0
  76. package/dist/payout/payout.operations.js +53 -0
  77. package/dist/payout/payout.operations.js.map +1 -0
  78. package/dist/payout/payout.presentation.d.ts +8 -0
  79. package/dist/payout/payout.presentation.d.ts.map +1 -0
  80. package/dist/payout/payout.presentation.js +60 -0
  81. package/dist/payout/payout.presentation.js.map +1 -0
  82. package/dist/payout/payout.schema.d.ts +157 -0
  83. package/dist/payout/payout.schema.d.ts.map +1 -0
  84. package/dist/payout/payout.schema.js +116 -0
  85. package/dist/payout/payout.schema.js.map +1 -0
  86. package/dist/product/index.d.ts +5 -0
  87. package/dist/product/index.js +6 -0
  88. package/dist/product/product.enum.d.ts +10 -0
  89. package/dist/product/product.enum.d.ts.map +1 -0
  90. package/dist/product/product.enum.js +18 -0
  91. package/dist/product/product.enum.js.map +1 -0
  92. package/dist/product/product.event.d.ts +73 -0
  93. package/dist/product/product.event.d.ts.map +1 -0
  94. package/dist/product/product.event.js +120 -0
  95. package/dist/product/product.event.js.map +1 -0
  96. package/dist/product/product.operations.d.ts +273 -0
  97. package/dist/product/product.operations.d.ts.map +1 -0
  98. package/dist/product/product.operations.js +108 -0
  99. package/dist/product/product.operations.js.map +1 -0
  100. package/dist/product/product.presentation.d.ts +9 -0
  101. package/dist/product/product.presentation.d.ts.map +1 -0
  102. package/dist/product/product.presentation.js +86 -0
  103. package/dist/product/product.presentation.js.map +1 -0
  104. package/dist/product/product.schema.d.ts +218 -0
  105. package/dist/product/product.schema.d.ts.map +1 -0
  106. package/dist/product/product.schema.js +176 -0
  107. package/dist/product/product.schema.js.map +1 -0
  108. package/dist/review/index.d.ts +5 -0
  109. package/dist/review/index.js +6 -0
  110. package/dist/review/review.enum.d.ts +10 -0
  111. package/dist/review/review.enum.d.ts.map +1 -0
  112. package/dist/review/review.enum.js +16 -0
  113. package/dist/review/review.enum.js.map +1 -0
  114. package/dist/review/review.event.d.ts +55 -0
  115. package/dist/review/review.event.d.ts.map +1 -0
  116. package/dist/review/review.event.js +84 -0
  117. package/dist/review/review.event.js.map +1 -0
  118. package/dist/review/review.operations.d.ts +237 -0
  119. package/dist/review/review.operations.d.ts.map +1 -0
  120. package/dist/review/review.operations.js +106 -0
  121. package/dist/review/review.operations.js.map +1 -0
  122. package/dist/review/review.presentation.d.ts +8 -0
  123. package/dist/review/review.presentation.d.ts.map +1 -0
  124. package/dist/review/review.presentation.js +60 -0
  125. package/dist/review/review.presentation.js.map +1 -0
  126. package/dist/review/review.schema.d.ts +190 -0
  127. package/dist/review/review.schema.d.ts.map +1 -0
  128. package/dist/review/review.schema.js +156 -0
  129. package/dist/review/review.schema.js.map +1 -0
  130. package/dist/store/index.d.ts +5 -0
  131. package/dist/store/index.js +6 -0
  132. package/dist/store/store.enum.d.ts +10 -0
  133. package/dist/store/store.enum.d.ts.map +1 -0
  134. package/dist/store/store.enum.js +16 -0
  135. package/dist/store/store.enum.js.map +1 -0
  136. package/dist/store/store.event.d.ts +51 -0
  137. package/dist/store/store.event.d.ts.map +1 -0
  138. package/dist/store/store.event.js +80 -0
  139. package/dist/store/store.event.js.map +1 -0
  140. package/dist/store/store.operations.d.ts +131 -0
  141. package/dist/store/store.operations.d.ts.map +1 -0
  142. package/dist/store/store.operations.js +61 -0
  143. package/dist/store/store.operations.js.map +1 -0
  144. package/dist/store/store.presentation.d.ts +8 -0
  145. package/dist/store/store.presentation.d.ts.map +1 -0
  146. package/dist/store/store.presentation.js +60 -0
  147. package/dist/store/store.presentation.js.map +1 -0
  148. package/dist/store/store.schema.d.ts +84 -0
  149. package/dist/store/store.schema.d.ts.map +1 -0
  150. package/dist/store/store.schema.js +93 -0
  151. package/dist/store/store.schema.js.map +1 -0
  152. package/package.json +141 -0
@@ -0,0 +1,368 @@
1
+ import * as _contractspec_lib_schema391 from "@contractspec/lib.schema";
2
+ import * as _contractspec_lib_contracts4 from "@contractspec/lib.contracts";
3
+
4
+ //#region src/order/order.operations.d.ts
5
+ /**
6
+ * Create a new order.
7
+ */
8
+ declare const CreateOrderContract: _contractspec_lib_contracts4.OperationSpec<_contractspec_lib_schema391.SchemaModel<{
9
+ storeId: {
10
+ type: _contractspec_lib_schema391.FieldType<string, string>;
11
+ isOptional: false;
12
+ };
13
+ items: {
14
+ type: _contractspec_lib_schema391.FieldType<unknown, unknown>;
15
+ isOptional: false;
16
+ description: string;
17
+ };
18
+ shippingAddress: {
19
+ type: _contractspec_lib_schema391.FieldType<unknown, unknown>;
20
+ isOptional: true;
21
+ };
22
+ billingAddress: {
23
+ type: _contractspec_lib_schema391.FieldType<unknown, unknown>;
24
+ isOptional: true;
25
+ };
26
+ buyerNote: {
27
+ type: _contractspec_lib_schema391.FieldType<string, string>;
28
+ isOptional: true;
29
+ };
30
+ }>, _contractspec_lib_schema391.SchemaModel<{
31
+ id: {
32
+ type: _contractspec_lib_schema391.FieldType<string, string>;
33
+ isOptional: false;
34
+ };
35
+ orderNumber: {
36
+ type: _contractspec_lib_schema391.FieldType<string, string>;
37
+ isOptional: false;
38
+ };
39
+ buyerId: {
40
+ type: _contractspec_lib_schema391.FieldType<string, string>;
41
+ isOptional: false;
42
+ };
43
+ storeId: {
44
+ type: _contractspec_lib_schema391.FieldType<string, string>;
45
+ isOptional: false;
46
+ };
47
+ status: {
48
+ type: _contractspec_lib_schema391.EnumType<[string, string, string, string, string, string, string, string, string, string]>;
49
+ isOptional: false;
50
+ };
51
+ subtotal: {
52
+ type: _contractspec_lib_schema391.FieldType<number, number>;
53
+ isOptional: false;
54
+ };
55
+ shippingTotal: {
56
+ type: _contractspec_lib_schema391.FieldType<number, number>;
57
+ isOptional: false;
58
+ };
59
+ taxTotal: {
60
+ type: _contractspec_lib_schema391.FieldType<number, number>;
61
+ isOptional: false;
62
+ };
63
+ total: {
64
+ type: _contractspec_lib_schema391.FieldType<number, number>;
65
+ isOptional: false;
66
+ };
67
+ currency: {
68
+ type: _contractspec_lib_schema391.FieldType<string, string>;
69
+ isOptional: false;
70
+ };
71
+ items: {
72
+ type: _contractspec_lib_schema391.SchemaModel<{
73
+ id: {
74
+ type: _contractspec_lib_schema391.FieldType<string, string>;
75
+ isOptional: false;
76
+ };
77
+ productId: {
78
+ type: _contractspec_lib_schema391.FieldType<string, string>;
79
+ isOptional: false;
80
+ };
81
+ productName: {
82
+ type: _contractspec_lib_schema391.FieldType<string, string>;
83
+ isOptional: false;
84
+ };
85
+ unitPrice: {
86
+ type: _contractspec_lib_schema391.FieldType<number, number>;
87
+ isOptional: false;
88
+ };
89
+ quantity: {
90
+ type: _contractspec_lib_schema391.FieldType<number, number>;
91
+ isOptional: false;
92
+ };
93
+ subtotal: {
94
+ type: _contractspec_lib_schema391.FieldType<number, number>;
95
+ isOptional: false;
96
+ };
97
+ }>;
98
+ isArray: true;
99
+ isOptional: true;
100
+ };
101
+ createdAt: {
102
+ type: _contractspec_lib_schema391.FieldType<Date, string>;
103
+ isOptional: false;
104
+ };
105
+ }>, {
106
+ key: string;
107
+ version: number;
108
+ when: string;
109
+ payload: _contractspec_lib_schema391.SchemaModel<{
110
+ id: {
111
+ type: _contractspec_lib_schema391.FieldType<string, string>;
112
+ isOptional: false;
113
+ };
114
+ orderNumber: {
115
+ type: _contractspec_lib_schema391.FieldType<string, string>;
116
+ isOptional: false;
117
+ };
118
+ buyerId: {
119
+ type: _contractspec_lib_schema391.FieldType<string, string>;
120
+ isOptional: false;
121
+ };
122
+ storeId: {
123
+ type: _contractspec_lib_schema391.FieldType<string, string>;
124
+ isOptional: false;
125
+ };
126
+ status: {
127
+ type: _contractspec_lib_schema391.EnumType<[string, string, string, string, string, string, string, string, string, string]>;
128
+ isOptional: false;
129
+ };
130
+ subtotal: {
131
+ type: _contractspec_lib_schema391.FieldType<number, number>;
132
+ isOptional: false;
133
+ };
134
+ shippingTotal: {
135
+ type: _contractspec_lib_schema391.FieldType<number, number>;
136
+ isOptional: false;
137
+ };
138
+ taxTotal: {
139
+ type: _contractspec_lib_schema391.FieldType<number, number>;
140
+ isOptional: false;
141
+ };
142
+ total: {
143
+ type: _contractspec_lib_schema391.FieldType<number, number>;
144
+ isOptional: false;
145
+ };
146
+ currency: {
147
+ type: _contractspec_lib_schema391.FieldType<string, string>;
148
+ isOptional: false;
149
+ };
150
+ items: {
151
+ type: _contractspec_lib_schema391.SchemaModel<{
152
+ id: {
153
+ type: _contractspec_lib_schema391.FieldType<string, string>;
154
+ isOptional: false;
155
+ };
156
+ productId: {
157
+ type: _contractspec_lib_schema391.FieldType<string, string>;
158
+ isOptional: false;
159
+ };
160
+ productName: {
161
+ type: _contractspec_lib_schema391.FieldType<string, string>;
162
+ isOptional: false;
163
+ };
164
+ unitPrice: {
165
+ type: _contractspec_lib_schema391.FieldType<number, number>;
166
+ isOptional: false;
167
+ };
168
+ quantity: {
169
+ type: _contractspec_lib_schema391.FieldType<number, number>;
170
+ isOptional: false;
171
+ };
172
+ subtotal: {
173
+ type: _contractspec_lib_schema391.FieldType<number, number>;
174
+ isOptional: false;
175
+ };
176
+ }>;
177
+ isArray: true;
178
+ isOptional: true;
179
+ };
180
+ createdAt: {
181
+ type: _contractspec_lib_schema391.FieldType<Date, string>;
182
+ isOptional: false;
183
+ };
184
+ }>;
185
+ }[]>;
186
+ /**
187
+ * Update order status.
188
+ */
189
+ declare const UpdateOrderStatusContract: _contractspec_lib_contracts4.OperationSpec<_contractspec_lib_schema391.SchemaModel<{
190
+ orderId: {
191
+ type: _contractspec_lib_schema391.FieldType<string, string>;
192
+ isOptional: false;
193
+ };
194
+ status: {
195
+ type: _contractspec_lib_schema391.EnumType<[string, string, string, string, string, string, string, string, string, string]>;
196
+ isOptional: false;
197
+ };
198
+ trackingNumber: {
199
+ type: _contractspec_lib_schema391.FieldType<string, string>;
200
+ isOptional: true;
201
+ };
202
+ trackingUrl: {
203
+ type: _contractspec_lib_schema391.FieldType<string, string>;
204
+ isOptional: true;
205
+ };
206
+ note: {
207
+ type: _contractspec_lib_schema391.FieldType<string, string>;
208
+ isOptional: true;
209
+ };
210
+ }>, _contractspec_lib_schema391.SchemaModel<{
211
+ id: {
212
+ type: _contractspec_lib_schema391.FieldType<string, string>;
213
+ isOptional: false;
214
+ };
215
+ orderNumber: {
216
+ type: _contractspec_lib_schema391.FieldType<string, string>;
217
+ isOptional: false;
218
+ };
219
+ buyerId: {
220
+ type: _contractspec_lib_schema391.FieldType<string, string>;
221
+ isOptional: false;
222
+ };
223
+ storeId: {
224
+ type: _contractspec_lib_schema391.FieldType<string, string>;
225
+ isOptional: false;
226
+ };
227
+ status: {
228
+ type: _contractspec_lib_schema391.EnumType<[string, string, string, string, string, string, string, string, string, string]>;
229
+ isOptional: false;
230
+ };
231
+ subtotal: {
232
+ type: _contractspec_lib_schema391.FieldType<number, number>;
233
+ isOptional: false;
234
+ };
235
+ shippingTotal: {
236
+ type: _contractspec_lib_schema391.FieldType<number, number>;
237
+ isOptional: false;
238
+ };
239
+ taxTotal: {
240
+ type: _contractspec_lib_schema391.FieldType<number, number>;
241
+ isOptional: false;
242
+ };
243
+ total: {
244
+ type: _contractspec_lib_schema391.FieldType<number, number>;
245
+ isOptional: false;
246
+ };
247
+ currency: {
248
+ type: _contractspec_lib_schema391.FieldType<string, string>;
249
+ isOptional: false;
250
+ };
251
+ items: {
252
+ type: _contractspec_lib_schema391.SchemaModel<{
253
+ id: {
254
+ type: _contractspec_lib_schema391.FieldType<string, string>;
255
+ isOptional: false;
256
+ };
257
+ productId: {
258
+ type: _contractspec_lib_schema391.FieldType<string, string>;
259
+ isOptional: false;
260
+ };
261
+ productName: {
262
+ type: _contractspec_lib_schema391.FieldType<string, string>;
263
+ isOptional: false;
264
+ };
265
+ unitPrice: {
266
+ type: _contractspec_lib_schema391.FieldType<number, number>;
267
+ isOptional: false;
268
+ };
269
+ quantity: {
270
+ type: _contractspec_lib_schema391.FieldType<number, number>;
271
+ isOptional: false;
272
+ };
273
+ subtotal: {
274
+ type: _contractspec_lib_schema391.FieldType<number, number>;
275
+ isOptional: false;
276
+ };
277
+ }>;
278
+ isArray: true;
279
+ isOptional: true;
280
+ };
281
+ createdAt: {
282
+ type: _contractspec_lib_schema391.FieldType<Date, string>;
283
+ isOptional: false;
284
+ };
285
+ }>, {
286
+ key: string;
287
+ version: number;
288
+ when: string;
289
+ payload: _contractspec_lib_schema391.SchemaModel<{
290
+ id: {
291
+ type: _contractspec_lib_schema391.FieldType<string, string>;
292
+ isOptional: false;
293
+ };
294
+ orderNumber: {
295
+ type: _contractspec_lib_schema391.FieldType<string, string>;
296
+ isOptional: false;
297
+ };
298
+ buyerId: {
299
+ type: _contractspec_lib_schema391.FieldType<string, string>;
300
+ isOptional: false;
301
+ };
302
+ storeId: {
303
+ type: _contractspec_lib_schema391.FieldType<string, string>;
304
+ isOptional: false;
305
+ };
306
+ status: {
307
+ type: _contractspec_lib_schema391.EnumType<[string, string, string, string, string, string, string, string, string, string]>;
308
+ isOptional: false;
309
+ };
310
+ subtotal: {
311
+ type: _contractspec_lib_schema391.FieldType<number, number>;
312
+ isOptional: false;
313
+ };
314
+ shippingTotal: {
315
+ type: _contractspec_lib_schema391.FieldType<number, number>;
316
+ isOptional: false;
317
+ };
318
+ taxTotal: {
319
+ type: _contractspec_lib_schema391.FieldType<number, number>;
320
+ isOptional: false;
321
+ };
322
+ total: {
323
+ type: _contractspec_lib_schema391.FieldType<number, number>;
324
+ isOptional: false;
325
+ };
326
+ currency: {
327
+ type: _contractspec_lib_schema391.FieldType<string, string>;
328
+ isOptional: false;
329
+ };
330
+ items: {
331
+ type: _contractspec_lib_schema391.SchemaModel<{
332
+ id: {
333
+ type: _contractspec_lib_schema391.FieldType<string, string>;
334
+ isOptional: false;
335
+ };
336
+ productId: {
337
+ type: _contractspec_lib_schema391.FieldType<string, string>;
338
+ isOptional: false;
339
+ };
340
+ productName: {
341
+ type: _contractspec_lib_schema391.FieldType<string, string>;
342
+ isOptional: false;
343
+ };
344
+ unitPrice: {
345
+ type: _contractspec_lib_schema391.FieldType<number, number>;
346
+ isOptional: false;
347
+ };
348
+ quantity: {
349
+ type: _contractspec_lib_schema391.FieldType<number, number>;
350
+ isOptional: false;
351
+ };
352
+ subtotal: {
353
+ type: _contractspec_lib_schema391.FieldType<number, number>;
354
+ isOptional: false;
355
+ };
356
+ }>;
357
+ isArray: true;
358
+ isOptional: true;
359
+ };
360
+ createdAt: {
361
+ type: _contractspec_lib_schema391.FieldType<Date, string>;
362
+ isOptional: false;
363
+ };
364
+ }>;
365
+ }[]>;
366
+ //#endregion
367
+ export { CreateOrderContract, UpdateOrderStatusContract };
368
+ //# sourceMappingURL=order.operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.operations.d.ts","names":[],"sources":["../../src/order/order.operations.ts"],"sourcesContent":[],"mappings":";;;;;;;cAYa,kDAAmB,0CAAA;EAAnB,OAAA,EAAA;IA4CX,IAAA,EAAA,2BAAA,CAAA,SAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;IA5C8B,WAAA,EAAA,MAAA;;;;;;;;;;;;;;;;UAAA,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;+CAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAiDnB,CAAA;EA6CX,QAAA,EAAA;;;;;+CA7CoC,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA,GAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAzB,wDAAyB,0CAAA;;UA6CpC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;UA7CoC,2BAAA,CAAA"}
@@ -0,0 +1,119 @@
1
+ import { CreateOrderInputModel, OrderModel, UpdateOrderStatusInputModel } from "./order.schema.js";
2
+ import { defineCommand } from "@contractspec/lib.contracts/operations";
3
+
4
+ //#region src/order/order.operations.ts
5
+ const OWNERS = ["@example.marketplace"];
6
+ /**
7
+ * Create a new order.
8
+ */
9
+ const CreateOrderContract = defineCommand({
10
+ meta: {
11
+ key: "marketplace.order.create",
12
+ version: 1,
13
+ stability: "stable",
14
+ owners: [...OWNERS],
15
+ tags: [
16
+ "marketplace",
17
+ "order",
18
+ "create"
19
+ ],
20
+ description: "Create a new order.",
21
+ goal: "Allow buyers to purchase products.",
22
+ context: "Checkout flow."
23
+ },
24
+ io: {
25
+ input: CreateOrderInputModel,
26
+ output: OrderModel
27
+ },
28
+ policy: { auth: "user" },
29
+ sideEffects: {
30
+ emits: [{
31
+ key: "marketplace.order.created",
32
+ version: 1,
33
+ when: "Order is created",
34
+ payload: OrderModel
35
+ }],
36
+ audit: ["marketplace.order.created"]
37
+ },
38
+ acceptance: {
39
+ scenarios: [{
40
+ key: "create-order-happy-path",
41
+ given: ["User is authenticated"],
42
+ when: ["User creates order with valid items"],
43
+ then: ["Order is created", "OrderCreated event is emitted"]
44
+ }],
45
+ examples: [{
46
+ key: "create-basic-order",
47
+ input: {
48
+ storeId: "store-123",
49
+ items: [{
50
+ productId: "prod-456",
51
+ quantity: 1,
52
+ unitPrice: 100
53
+ }]
54
+ },
55
+ output: {
56
+ id: "order-789",
57
+ status: "pending",
58
+ total: 100
59
+ }
60
+ }]
61
+ }
62
+ });
63
+ /**
64
+ * Update order status.
65
+ */
66
+ const UpdateOrderStatusContract = defineCommand({
67
+ meta: {
68
+ key: "marketplace.order.updateStatus",
69
+ version: 1,
70
+ stability: "stable",
71
+ owners: [...OWNERS],
72
+ tags: [
73
+ "marketplace",
74
+ "order",
75
+ "status"
76
+ ],
77
+ description: "Update order status.",
78
+ goal: "Track order fulfillment.",
79
+ context: "Order management."
80
+ },
81
+ io: {
82
+ input: UpdateOrderStatusInputModel,
83
+ output: OrderModel
84
+ },
85
+ policy: { auth: "user" },
86
+ sideEffects: {
87
+ emits: [{
88
+ key: "marketplace.order.statusUpdated",
89
+ version: 1,
90
+ when: "Status changes",
91
+ payload: OrderModel
92
+ }],
93
+ audit: ["marketplace.order.statusUpdated"]
94
+ },
95
+ acceptance: {
96
+ scenarios: [{
97
+ key: "update-status-happy-path",
98
+ given: ["Order exists"],
99
+ when: ["Seller updates order status"],
100
+ then: ["Status is updated", "OrderStatusUpdated event is emitted"]
101
+ }],
102
+ examples: [{
103
+ key: "mark-shipped",
104
+ input: {
105
+ orderId: "order-789",
106
+ status: "shipped",
107
+ trackingNumber: "TRACK123"
108
+ },
109
+ output: {
110
+ id: "order-789",
111
+ status: "shipped"
112
+ }
113
+ }]
114
+ }
115
+ });
116
+
117
+ //#endregion
118
+ export { CreateOrderContract, UpdateOrderStatusContract };
119
+ //# sourceMappingURL=order.operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.operations.js","names":[],"sources":["../../src/order/order.operations.ts"],"sourcesContent":["import { defineCommand } from '@contractspec/lib.contracts/operations';\nimport {\n OrderModel,\n CreateOrderInputModel,\n UpdateOrderStatusInputModel,\n} from './order.schema';\n\nconst OWNERS = ['@example.marketplace'] as const;\n\n/**\n * Create a new order.\n */\nexport const CreateOrderContract = defineCommand({\n meta: {\n key: 'marketplace.order.create',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'order', 'create'],\n description: 'Create a new order.',\n goal: 'Allow buyers to purchase products.',\n context: 'Checkout flow.',\n },\n io: { input: CreateOrderInputModel, output: OrderModel },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'marketplace.order.created',\n version: 1,\n when: 'Order is created',\n payload: OrderModel,\n },\n ],\n audit: ['marketplace.order.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-order-happy-path',\n given: ['User is authenticated'],\n when: ['User creates order with valid items'],\n then: ['Order is created', 'OrderCreated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'create-basic-order',\n input: {\n storeId: 'store-123',\n items: [{ productId: 'prod-456', quantity: 1, unitPrice: 100 }],\n },\n output: { id: 'order-789', status: 'pending', total: 100 },\n },\n ],\n },\n});\n\n/**\n * Update order status.\n */\nexport const UpdateOrderStatusContract = defineCommand({\n meta: {\n key: 'marketplace.order.updateStatus',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'order', 'status'],\n description: 'Update order status.',\n goal: 'Track order fulfillment.',\n context: 'Order management.',\n },\n io: { input: UpdateOrderStatusInputModel, output: OrderModel },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'marketplace.order.statusUpdated',\n version: 1,\n when: 'Status changes',\n payload: OrderModel,\n },\n ],\n audit: ['marketplace.order.statusUpdated'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'update-status-happy-path',\n given: ['Order exists'],\n when: ['Seller updates order status'],\n then: ['Status is updated', 'OrderStatusUpdated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'mark-shipped',\n input: {\n orderId: 'order-789',\n status: 'shipped',\n trackingNumber: 'TRACK123',\n },\n output: { id: 'order-789', status: 'shipped' },\n },\n ],\n },\n});\n"],"mappings":";;;;AAOA,MAAM,SAAS,CAAC,uBAAuB;;;;AAKvC,MAAa,sBAAsB,cAAc;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAS;GAAS;EACxC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAuB,QAAQ;EAAY;CACxD,QAAQ,EAAE,MAAM,QAAQ;CACxB,aAAa;EACX,OAAO,CACL;GACE,KAAK;GACL,SAAS;GACT,MAAM;GACN,SAAS;GACV,CACF;EACD,OAAO,CAAC,4BAA4B;EACrC;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,wBAAwB;GAChC,MAAM,CAAC,sCAAsC;GAC7C,MAAM,CAAC,oBAAoB,gCAAgC;GAC5D,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IACL,SAAS;IACT,OAAO,CAAC;KAAE,WAAW;KAAY,UAAU;KAAG,WAAW;KAAK,CAAC;IAChE;GACD,QAAQ;IAAE,IAAI;IAAa,QAAQ;IAAW,OAAO;IAAK;GAC3D,CACF;EACF;CACF,CAAC;;;;AAKF,MAAa,4BAA4B,cAAc;CACrD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAS;GAAS;EACxC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAA6B,QAAQ;EAAY;CAC9D,QAAQ,EAAE,MAAM,QAAQ;CACxB,aAAa;EACX,OAAO,CACL;GACE,KAAK;GACL,SAAS;GACT,MAAM;GACN,SAAS;GACV,CACF;EACD,OAAO,CAAC,kCAAkC;EAC3C;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,eAAe;GACvB,MAAM,CAAC,8BAA8B;GACrC,MAAM,CAAC,qBAAqB,sCAAsC;GACnE,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IACL,SAAS;IACT,QAAQ;IACR,gBAAgB;IACjB;GACD,QAAQ;IAAE,IAAI;IAAa,QAAQ;IAAW;GAC/C,CACF;EACF;CACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { PresentationSpec } from "@contractspec/lib.contracts";
2
+
3
+ //#region src/order/order.presentation.d.ts
4
+ declare const OrderListPresentation: PresentationSpec;
5
+ declare const OrderDetailPresentation: PresentationSpec;
6
+ declare const CheckoutPresentation: PresentationSpec;
7
+ //#endregion
8
+ export { CheckoutPresentation, OrderDetailPresentation, OrderListPresentation };
9
+ //# sourceMappingURL=order.presentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.presentation.d.ts","names":[],"sources":["../../src/order/order.presentation.ts"],"sourcesContent":[],"mappings":";;;cAIa,uBAAuB;cAyBvB,yBAAyB;AAzBzB,cAmDA,oBAnDuB,EAmDD,gBA5BlC"}
@@ -0,0 +1,86 @@
1
+ import { OrderModel } from "./order.schema.js";
2
+ import { StabilityEnum } from "@contractspec/lib.contracts";
3
+
4
+ //#region src/order/order.presentation.ts
5
+ const OrderListPresentation = {
6
+ meta: {
7
+ key: "marketplace.order.list",
8
+ version: 1,
9
+ title: "Order List",
10
+ description: "List of orders with status and tracking",
11
+ domain: "marketplace",
12
+ owners: ["@marketplace-team"],
13
+ tags: [
14
+ "marketplace",
15
+ "order",
16
+ "list"
17
+ ],
18
+ stability: StabilityEnum.Experimental,
19
+ goal: "Provide a comprehensive view of all orders for the user.",
20
+ context: "Used in the buyer and seller dashboards to track order progress."
21
+ },
22
+ source: {
23
+ type: "component",
24
+ framework: "react",
25
+ componentKey: "OrderList",
26
+ props: OrderModel
27
+ },
28
+ targets: ["react", "markdown"],
29
+ policy: { flags: ["marketplace.orders.enabled"] }
30
+ };
31
+ const OrderDetailPresentation = {
32
+ meta: {
33
+ key: "marketplace.order.detail",
34
+ version: 1,
35
+ title: "Order Details",
36
+ description: "Order detail with items and shipping info",
37
+ domain: "marketplace",
38
+ owners: ["@marketplace-team"],
39
+ tags: [
40
+ "marketplace",
41
+ "order",
42
+ "detail"
43
+ ],
44
+ stability: StabilityEnum.Experimental,
45
+ goal: "Display all details of a single order.",
46
+ context: "Accessed from the order list to see specific items, shipping, and payment details."
47
+ },
48
+ source: {
49
+ type: "component",
50
+ framework: "react",
51
+ componentKey: "OrderDetail",
52
+ props: OrderModel
53
+ },
54
+ targets: ["react", "markdown"],
55
+ policy: { flags: ["marketplace.orders.enabled"] }
56
+ };
57
+ const CheckoutPresentation = {
58
+ meta: {
59
+ key: "marketplace.checkout",
60
+ version: 1,
61
+ title: "Checkout",
62
+ description: "Checkout flow with cart and payment",
63
+ domain: "marketplace",
64
+ owners: ["@marketplace-team"],
65
+ tags: [
66
+ "marketplace",
67
+ "checkout",
68
+ "cart"
69
+ ],
70
+ stability: StabilityEnum.Experimental,
71
+ goal: "Guide the user through the payment and order confirmation process.",
72
+ context: "The final stage of the purchasing journey."
73
+ },
74
+ source: {
75
+ type: "component",
76
+ framework: "react",
77
+ componentKey: "Checkout",
78
+ props: OrderModel
79
+ },
80
+ targets: ["react"],
81
+ policy: { flags: ["marketplace.checkout.enabled"] }
82
+ };
83
+
84
+ //#endregion
85
+ export { CheckoutPresentation, OrderDetailPresentation, OrderListPresentation };
86
+ //# sourceMappingURL=order.presentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.presentation.js","names":["OrderListPresentation: PresentationSpec","OrderDetailPresentation: PresentationSpec","CheckoutPresentation: PresentationSpec"],"sources":["../../src/order/order.presentation.ts"],"sourcesContent":["import type { PresentationSpec } from '@contractspec/lib.contracts';\nimport { StabilityEnum } from '@contractspec/lib.contracts';\nimport { OrderModel } from './order.schema';\n\nexport const OrderListPresentation: PresentationSpec = {\n meta: {\n key: 'marketplace.order.list',\n version: 1,\n title: 'Order List',\n description: 'List of orders with status and tracking',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'order', 'list'],\n stability: StabilityEnum.Experimental,\n goal: 'Provide a comprehensive view of all orders for the user.',\n context: 'Used in the buyer and seller dashboards to track order progress.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'OrderList',\n props: OrderModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.orders.enabled'],\n },\n};\n\nexport const OrderDetailPresentation: PresentationSpec = {\n meta: {\n key: 'marketplace.order.detail',\n version: 1,\n title: 'Order Details',\n description: 'Order detail with items and shipping info',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'order', 'detail'],\n stability: StabilityEnum.Experimental,\n goal: 'Display all details of a single order.',\n context:\n 'Accessed from the order list to see specific items, shipping, and payment details.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'OrderDetail',\n props: OrderModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.orders.enabled'],\n },\n};\n\nexport const CheckoutPresentation: PresentationSpec = {\n meta: {\n key: 'marketplace.checkout',\n version: 1,\n title: 'Checkout',\n description: 'Checkout flow with cart and payment',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'checkout', 'cart'],\n stability: StabilityEnum.Experimental,\n goal: 'Guide the user through the payment and order confirmation process.',\n context: 'The final stage of the purchasing journey.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'Checkout',\n props: OrderModel,\n },\n targets: ['react'],\n policy: {\n flags: ['marketplace.checkout.enabled'],\n },\n};\n"],"mappings":";;;;AAIA,MAAaA,wBAA0C;CACrD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAS;GAAO;EACtC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,6BAA6B,EACtC;CACF;AAED,MAAaC,0BAA4C;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAS;GAAS;EACxC,WAAW,cAAc;EACzB,MAAM;EACN,SACE;EACH;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,6BAA6B,EACtC;CACF;AAED,MAAaC,uBAAyC;CACpD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAY;GAAO;EACzC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,QAAQ;CAClB,QAAQ,EACN,OAAO,CAAC,+BAA+B,EACxC;CACF"}