@contractspec/example.marketplace 3.7.6 → 3.8.2

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 (86) hide show
  1. package/README.md +64 -131
  2. package/dist/browser/entities/index.js +470 -470
  3. package/dist/browser/index.js +1257 -1019
  4. package/dist/browser/marketplace.feature.js +175 -0
  5. package/dist/browser/order/index.js +155 -155
  6. package/dist/browser/order/order.event.js +1 -1
  7. package/dist/browser/payout/index.js +71 -71
  8. package/dist/browser/payout/payout.event.js +1 -1
  9. package/dist/browser/product/index.js +104 -104
  10. package/dist/browser/product/product.event.js +1 -1
  11. package/dist/browser/review/index.js +75 -75
  12. package/dist/browser/review/review.event.js +1 -1
  13. package/dist/browser/store/index.js +68 -68
  14. package/dist/browser/store/store.event.js +1 -1
  15. package/dist/browser/ui/MarketplaceDashboard.js +328 -110
  16. package/dist/browser/ui/MarketplaceDashboard.visualizations.js +216 -0
  17. package/dist/browser/ui/hooks/index.js +1 -1
  18. package/dist/browser/ui/hooks/useMarketplaceData.js +1 -1
  19. package/dist/browser/ui/index.js +590 -359
  20. package/dist/browser/ui/renderers/index.js +190 -4
  21. package/dist/browser/ui/renderers/marketplace.markdown.js +190 -4
  22. package/dist/browser/visualizations/catalog.js +126 -0
  23. package/dist/browser/visualizations/index.js +183 -0
  24. package/dist/browser/visualizations/selectors.js +177 -0
  25. package/dist/entities/index.d.ts +110 -110
  26. package/dist/entities/index.js +470 -470
  27. package/dist/index.d.ts +4 -3
  28. package/dist/index.js +1257 -1019
  29. package/dist/marketplace.feature.js +175 -0
  30. package/dist/node/entities/index.js +470 -470
  31. package/dist/node/index.js +1257 -1019
  32. package/dist/node/marketplace.feature.js +175 -0
  33. package/dist/node/order/index.js +155 -155
  34. package/dist/node/order/order.event.js +1 -1
  35. package/dist/node/payout/index.js +71 -71
  36. package/dist/node/payout/payout.event.js +1 -1
  37. package/dist/node/product/index.js +104 -104
  38. package/dist/node/product/product.event.js +1 -1
  39. package/dist/node/review/index.js +75 -75
  40. package/dist/node/review/review.event.js +1 -1
  41. package/dist/node/store/index.js +68 -68
  42. package/dist/node/store/store.event.js +1 -1
  43. package/dist/node/ui/MarketplaceDashboard.js +328 -110
  44. package/dist/node/ui/MarketplaceDashboard.visualizations.js +216 -0
  45. package/dist/node/ui/hooks/index.js +1 -1
  46. package/dist/node/ui/hooks/useMarketplaceData.js +1 -1
  47. package/dist/node/ui/index.js +590 -359
  48. package/dist/node/ui/renderers/index.js +190 -4
  49. package/dist/node/ui/renderers/marketplace.markdown.js +190 -4
  50. package/dist/node/visualizations/catalog.js +126 -0
  51. package/dist/node/visualizations/index.js +183 -0
  52. package/dist/node/visualizations/selectors.js +177 -0
  53. package/dist/order/index.d.ts +2 -2
  54. package/dist/order/index.js +155 -155
  55. package/dist/order/order.event.js +1 -1
  56. package/dist/payout/index.d.ts +2 -2
  57. package/dist/payout/index.js +71 -71
  58. package/dist/payout/payout.event.js +1 -1
  59. package/dist/product/index.d.ts +2 -2
  60. package/dist/product/index.js +104 -104
  61. package/dist/product/product.event.js +1 -1
  62. package/dist/review/index.d.ts +2 -2
  63. package/dist/review/index.js +75 -75
  64. package/dist/review/review.event.js +1 -1
  65. package/dist/store/index.d.ts +2 -2
  66. package/dist/store/index.js +68 -68
  67. package/dist/store/store.event.js +1 -1
  68. package/dist/ui/MarketplaceDashboard.js +328 -110
  69. package/dist/ui/MarketplaceDashboard.visualizations.d.ts +5 -0
  70. package/dist/ui/MarketplaceDashboard.visualizations.js +217 -0
  71. package/dist/ui/hooks/index.d.ts +1 -1
  72. package/dist/ui/hooks/index.js +1 -1
  73. package/dist/ui/hooks/useMarketplaceData.js +1 -1
  74. package/dist/ui/index.d.ts +2 -2
  75. package/dist/ui/index.js +590 -359
  76. package/dist/ui/renderers/index.d.ts +1 -1
  77. package/dist/ui/renderers/index.js +190 -4
  78. package/dist/ui/renderers/marketplace.markdown.js +190 -4
  79. package/dist/visualizations/catalog.d.ts +10 -0
  80. package/dist/visualizations/catalog.js +127 -0
  81. package/dist/visualizations/index.d.ts +2 -0
  82. package/dist/visualizations/index.js +184 -0
  83. package/dist/visualizations/selectors.d.ts +11 -0
  84. package/dist/visualizations/selectors.js +178 -0
  85. package/dist/visualizations/selectors.test.d.ts +1 -0
  86. package/package.json +66 -10
@@ -1,3 +1,177 @@
1
+ // src/visualizations/catalog.ts
2
+ import {
3
+ defineVisualization,
4
+ VisualizationRegistry
5
+ } from "@contractspec/lib.contracts-spec/visualizations";
6
+ var ORDER_LIST_REF = {
7
+ key: "marketplace.order.list",
8
+ version: "1.0.0"
9
+ };
10
+ var PRODUCT_LIST_REF = {
11
+ key: "marketplace.product.list",
12
+ version: "1.0.0"
13
+ };
14
+ var META = {
15
+ version: "1.0.0",
16
+ domain: "marketplace",
17
+ stability: "experimental",
18
+ owners: ["@example.marketplace"],
19
+ tags: ["marketplace", "visualization", "commerce"]
20
+ };
21
+ var MarketplaceOrderStatusVisualization = defineVisualization({
22
+ meta: {
23
+ ...META,
24
+ key: "marketplace.visualization.order-status",
25
+ title: "Order Status Breakdown",
26
+ description: "Distribution of current order states.",
27
+ goal: "Expose delivery and backlog mix at a glance.",
28
+ context: "Marketplace operations overview."
29
+ },
30
+ source: { primary: ORDER_LIST_REF, resultPath: "data" },
31
+ visualization: {
32
+ kind: "pie",
33
+ nameDimension: "status",
34
+ valueMeasure: "orders",
35
+ dimensions: [
36
+ { key: "status", label: "Status", dataPath: "status", type: "category" }
37
+ ],
38
+ measures: [
39
+ { key: "orders", label: "Orders", dataPath: "orders", format: "number" }
40
+ ],
41
+ table: { caption: "Order counts by status." }
42
+ }
43
+ });
44
+ var MarketplaceCategoryValueVisualization = defineVisualization({
45
+ meta: {
46
+ ...META,
47
+ key: "marketplace.visualization.category-value",
48
+ title: "Category Value Comparison",
49
+ description: "Catalog value by product category derived from current pricing and stock.",
50
+ goal: "Compare where the marketplace catalog is concentrated.",
51
+ context: "Merchandising overview."
52
+ },
53
+ source: { primary: PRODUCT_LIST_REF, resultPath: "data" },
54
+ visualization: {
55
+ kind: "cartesian",
56
+ variant: "bar",
57
+ xDimension: "category",
58
+ yMeasures: ["catalogValue"],
59
+ dimensions: [
60
+ {
61
+ key: "category",
62
+ label: "Category",
63
+ dataPath: "category",
64
+ type: "category"
65
+ }
66
+ ],
67
+ measures: [
68
+ {
69
+ key: "catalogValue",
70
+ label: "Catalog Value",
71
+ dataPath: "catalogValue",
72
+ format: "currency",
73
+ color: "#1d4ed8"
74
+ }
75
+ ],
76
+ table: { caption: "Catalog value by product category." }
77
+ }
78
+ });
79
+ var MarketplaceOrderActivityVisualization = defineVisualization({
80
+ meta: {
81
+ ...META,
82
+ key: "marketplace.visualization.order-activity",
83
+ title: "Recent Order Activity",
84
+ description: "Daily order volume from recent order creation timestamps.",
85
+ goal: "Show recent order activity trends.",
86
+ context: "Commerce operations trend monitoring."
87
+ },
88
+ source: { primary: ORDER_LIST_REF, resultPath: "data" },
89
+ visualization: {
90
+ kind: "cartesian",
91
+ variant: "line",
92
+ xDimension: "day",
93
+ yMeasures: ["orders"],
94
+ dimensions: [{ key: "day", label: "Day", dataPath: "day", type: "time" }],
95
+ measures: [
96
+ {
97
+ key: "orders",
98
+ label: "Orders",
99
+ dataPath: "orders",
100
+ format: "number",
101
+ color: "#0f766e"
102
+ }
103
+ ],
104
+ table: { caption: "Daily order counts." }
105
+ }
106
+ });
107
+ var MarketplaceVisualizationSpecs = [
108
+ MarketplaceOrderStatusVisualization,
109
+ MarketplaceCategoryValueVisualization,
110
+ MarketplaceOrderActivityVisualization
111
+ ];
112
+ var MarketplaceVisualizationRegistry = new VisualizationRegistry([
113
+ ...MarketplaceVisualizationSpecs
114
+ ]);
115
+ var MarketplaceVisualizationRefs = MarketplaceVisualizationSpecs.map((spec) => ({
116
+ key: spec.meta.key,
117
+ version: spec.meta.version
118
+ }));
119
+
120
+ // src/visualizations/selectors.ts
121
+ function toDayKey(value) {
122
+ const date = value instanceof Date ? value : new Date(value);
123
+ return date.toISOString().slice(0, 10);
124
+ }
125
+ function createMarketplaceVisualizationItems(products, orders) {
126
+ const orderStatus = new Map;
127
+ const orderActivity = new Map;
128
+ const categoryValue = new Map;
129
+ for (const order of orders) {
130
+ orderStatus.set(order.status, (orderStatus.get(order.status) ?? 0) + 1);
131
+ const day = toDayKey(order.createdAt);
132
+ orderActivity.set(day, (orderActivity.get(day) ?? 0) + 1);
133
+ }
134
+ for (const product of products) {
135
+ const category = product.category ?? "Uncategorized";
136
+ categoryValue.set(category, (categoryValue.get(category) ?? 0) + product.price * product.stock);
137
+ }
138
+ return [
139
+ {
140
+ key: "marketplace-order-status",
141
+ spec: MarketplaceOrderStatusVisualization,
142
+ data: {
143
+ data: Array.from(orderStatus.entries()).map(([status, count]) => ({
144
+ status,
145
+ orders: count
146
+ }))
147
+ },
148
+ title: "Order Status Breakdown",
149
+ description: "Status mix across the current order set.",
150
+ height: 260
151
+ },
152
+ {
153
+ key: "marketplace-category-value",
154
+ spec: MarketplaceCategoryValueVisualization,
155
+ data: {
156
+ data: Array.from(categoryValue.entries()).sort(([, left], [, right]) => right - left).map(([category, value]) => ({
157
+ category,
158
+ catalogValue: value
159
+ }))
160
+ },
161
+ title: "Category Value Comparison",
162
+ description: "Derived from current product pricing and stock."
163
+ },
164
+ {
165
+ key: "marketplace-order-activity",
166
+ spec: MarketplaceOrderActivityVisualization,
167
+ data: {
168
+ data: Array.from(orderActivity.entries()).sort(([left], [right]) => left.localeCompare(right)).map(([day, count]) => ({ day, orders: count }))
169
+ },
170
+ title: "Recent Order Activity",
171
+ description: "Daily order count from current order history."
172
+ }
173
+ ];
174
+ }
1
175
  // src/marketplace.feature.ts
2
176
  import { defineFeature } from "@contractspec/lib.contracts-spec";
3
177
  var MarketplaceFeature = defineFeature({
@@ -117,6 +291,7 @@ var MarketplaceFeature = defineFeature({
117
291
  targets: ["react", "markdown"]
118
292
  }
119
293
  ],
294
+ visualizations: MarketplaceVisualizationRefs,
120
295
  capabilities: {
121
296
  requires: [
122
297
  { key: "identity", version: "1.0.0" },
@@ -13,62 +13,187 @@ var OrderStatusEnum = defineEnum("OrderStatus", [
13
13
  "DISPUTED"
14
14
  ]);
15
15
 
16
- // src/order/order.schema.ts
16
+ // src/order/order.event.ts
17
+ import { defineEvent } from "@contractspec/lib.contracts-spec";
17
18
  import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
18
- var OrderItemModel = defineSchemaModel({
19
- name: "OrderItemModel",
19
+ var OrderCreatedPayload = defineSchemaModel({
20
+ name: "OrderCreatedEventPayload",
20
21
  fields: {
21
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
22
- productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
23
- productName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
24
- unitPrice: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
25
- quantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
26
- subtotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
22
+ orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
23
+ orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
24
+ buyerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
25
+ storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
26
+ total: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
27
+ currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
28
+ itemCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
29
+ timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
27
30
  }
28
31
  });
29
- var OrderModel = defineSchemaModel({
30
- name: "OrderModel",
31
- description: "An order",
32
+ var OrderPaidPayload = defineSchemaModel({
33
+ name: "OrderPaidEventPayload",
34
+ fields: {
35
+ orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
36
+ orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
37
+ total: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
38
+ paymentMethod: {
39
+ type: ScalarTypeEnum.String_unsecure(),
40
+ isOptional: false
41
+ },
42
+ timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
43
+ }
44
+ });
45
+ var OrderStatusUpdatedPayload = defineSchemaModel({
46
+ name: "OrderStatusUpdatedEventPayload",
47
+ fields: {
48
+ orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
49
+ orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
50
+ previousStatus: {
51
+ type: ScalarTypeEnum.String_unsecure(),
52
+ isOptional: false
53
+ },
54
+ newStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
55
+ updatedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
56
+ timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
57
+ }
58
+ });
59
+ var OrderShippedPayload = defineSchemaModel({
60
+ name: "OrderShippedEventPayload",
61
+ fields: {
62
+ orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
63
+ orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
64
+ trackingNumber: {
65
+ type: ScalarTypeEnum.String_unsecure(),
66
+ isOptional: true
67
+ },
68
+ trackingUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
69
+ carrier: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
70
+ timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
71
+ }
72
+ });
73
+ var OrderCompletedPayload = defineSchemaModel({
74
+ name: "OrderCompletedEventPayload",
32
75
  fields: {
33
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
76
+ orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
34
77
  orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
35
78
  buyerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
36
79
  storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
37
- status: { type: OrderStatusEnum, isOptional: false },
38
- subtotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
39
- shippingTotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
40
- taxTotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
41
80
  total: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
42
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
81
+ sellerPayout: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
82
+ timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
83
+ }
84
+ });
85
+ var OrderCreatedEvent = defineEvent({
86
+ meta: {
87
+ key: "marketplace.order.created",
88
+ version: "1.0.0",
89
+ description: "A new order has been created.",
90
+ stability: "experimental",
91
+ owners: ["@marketplace-team"],
92
+ tags: ["marketplace", "order"]
93
+ },
94
+ payload: OrderCreatedPayload
95
+ });
96
+ var OrderPaidEvent = defineEvent({
97
+ meta: {
98
+ key: "marketplace.order.paid",
99
+ version: "1.0.0",
100
+ description: "An order has been paid.",
101
+ stability: "experimental",
102
+ owners: ["@marketplace-team"],
103
+ tags: ["marketplace", "order"]
104
+ },
105
+ payload: OrderPaidPayload
106
+ });
107
+ var OrderStatusUpdatedEvent = defineEvent({
108
+ meta: {
109
+ key: "marketplace.order.statusUpdated",
110
+ version: "1.0.0",
111
+ description: "An order status has been updated.",
112
+ stability: "experimental",
113
+ owners: ["@marketplace-team"],
114
+ tags: ["marketplace", "order"]
115
+ },
116
+ payload: OrderStatusUpdatedPayload
117
+ });
118
+ var OrderShippedEvent = defineEvent({
119
+ meta: {
120
+ key: "marketplace.order.shipped",
121
+ version: "1.0.0",
122
+ description: "An order has been shipped.",
123
+ stability: "experimental",
124
+ owners: ["@marketplace-team"],
125
+ tags: ["marketplace", "order"]
126
+ },
127
+ payload: OrderShippedPayload
128
+ });
129
+ var OrderCompletedEvent = defineEvent({
130
+ meta: {
131
+ key: "marketplace.order.completed",
132
+ version: "1.0.0",
133
+ description: "An order has been completed.",
134
+ stability: "experimental",
135
+ owners: ["@marketplace-team"],
136
+ tags: ["marketplace", "order"]
137
+ },
138
+ payload: OrderCompletedPayload
139
+ });
140
+
141
+ // src/order/order.schema.ts
142
+ import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
143
+ var OrderItemModel = defineSchemaModel2({
144
+ name: "OrderItemModel",
145
+ fields: {
146
+ id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
147
+ productId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
148
+ productName: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
149
+ unitPrice: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
150
+ quantity: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
151
+ subtotal: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false }
152
+ }
153
+ });
154
+ var OrderModel = defineSchemaModel2({
155
+ name: "OrderModel",
156
+ description: "An order",
157
+ fields: {
158
+ id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
159
+ orderNumber: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
160
+ buyerId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
161
+ storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
162
+ status: { type: OrderStatusEnum, isOptional: false },
163
+ subtotal: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
164
+ shippingTotal: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
165
+ taxTotal: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
166
+ total: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
167
+ currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
43
168
  items: { type: OrderItemModel, isArray: true, isOptional: true },
44
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
169
+ createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
45
170
  }
46
171
  });
47
- var CreateOrderInputModel = defineSchemaModel({
172
+ var CreateOrderInputModel = defineSchemaModel2({
48
173
  name: "CreateOrderInput",
49
174
  fields: {
50
- storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
175
+ storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
51
176
  items: {
52
- type: ScalarTypeEnum.JSON(),
177
+ type: ScalarTypeEnum2.JSON(),
53
178
  isOptional: false,
54
179
  description: "Array of {productId, variantId?, quantity}"
55
180
  },
56
- shippingAddress: { type: ScalarTypeEnum.JSON(), isOptional: true },
57
- billingAddress: { type: ScalarTypeEnum.JSON(), isOptional: true },
58
- buyerNote: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
181
+ shippingAddress: { type: ScalarTypeEnum2.JSON(), isOptional: true },
182
+ billingAddress: { type: ScalarTypeEnum2.JSON(), isOptional: true },
183
+ buyerNote: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
59
184
  }
60
185
  });
61
- var UpdateOrderStatusInputModel = defineSchemaModel({
186
+ var UpdateOrderStatusInputModel = defineSchemaModel2({
62
187
  name: "UpdateOrderStatusInput",
63
188
  fields: {
64
- orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
189
+ orderId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
65
190
  status: { type: OrderStatusEnum, isOptional: false },
66
191
  trackingNumber: {
67
- type: ScalarTypeEnum.String_unsecure(),
192
+ type: ScalarTypeEnum2.String_unsecure(),
68
193
  isOptional: true
69
194
  },
70
- trackingUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
71
- note: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
195
+ trackingUrl: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
196
+ note: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
72
197
  }
73
198
  });
74
199
 
@@ -166,131 +291,6 @@ var UpdateOrderStatusContract = defineCommand({
166
291
  ]
167
292
  }
168
293
  });
169
-
170
- // src/order/order.event.ts
171
- import { ScalarTypeEnum as ScalarTypeEnum2, defineSchemaModel as defineSchemaModel2 } from "@contractspec/lib.schema";
172
- import { defineEvent } from "@contractspec/lib.contracts-spec";
173
- var OrderCreatedPayload = defineSchemaModel2({
174
- name: "OrderCreatedEventPayload",
175
- fields: {
176
- orderId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
177
- orderNumber: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
178
- buyerId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
179
- storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
180
- total: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
181
- currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
182
- itemCount: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
183
- timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
184
- }
185
- });
186
- var OrderPaidPayload = defineSchemaModel2({
187
- name: "OrderPaidEventPayload",
188
- fields: {
189
- orderId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
190
- orderNumber: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
191
- total: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
192
- paymentMethod: {
193
- type: ScalarTypeEnum2.String_unsecure(),
194
- isOptional: false
195
- },
196
- timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
197
- }
198
- });
199
- var OrderStatusUpdatedPayload = defineSchemaModel2({
200
- name: "OrderStatusUpdatedEventPayload",
201
- fields: {
202
- orderId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
203
- orderNumber: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
204
- previousStatus: {
205
- type: ScalarTypeEnum2.String_unsecure(),
206
- isOptional: false
207
- },
208
- newStatus: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
209
- updatedBy: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
210
- timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
211
- }
212
- });
213
- var OrderShippedPayload = defineSchemaModel2({
214
- name: "OrderShippedEventPayload",
215
- fields: {
216
- orderId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
217
- orderNumber: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
218
- trackingNumber: {
219
- type: ScalarTypeEnum2.String_unsecure(),
220
- isOptional: true
221
- },
222
- trackingUrl: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
223
- carrier: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
224
- timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
225
- }
226
- });
227
- var OrderCompletedPayload = defineSchemaModel2({
228
- name: "OrderCompletedEventPayload",
229
- fields: {
230
- orderId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
231
- orderNumber: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
232
- buyerId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
233
- storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
234
- total: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
235
- sellerPayout: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
236
- timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
237
- }
238
- });
239
- var OrderCreatedEvent = defineEvent({
240
- meta: {
241
- key: "marketplace.order.created",
242
- version: "1.0.0",
243
- description: "A new order has been created.",
244
- stability: "experimental",
245
- owners: ["@marketplace-team"],
246
- tags: ["marketplace", "order"]
247
- },
248
- payload: OrderCreatedPayload
249
- });
250
- var OrderPaidEvent = defineEvent({
251
- meta: {
252
- key: "marketplace.order.paid",
253
- version: "1.0.0",
254
- description: "An order has been paid.",
255
- stability: "experimental",
256
- owners: ["@marketplace-team"],
257
- tags: ["marketplace", "order"]
258
- },
259
- payload: OrderPaidPayload
260
- });
261
- var OrderStatusUpdatedEvent = defineEvent({
262
- meta: {
263
- key: "marketplace.order.statusUpdated",
264
- version: "1.0.0",
265
- description: "An order status has been updated.",
266
- stability: "experimental",
267
- owners: ["@marketplace-team"],
268
- tags: ["marketplace", "order"]
269
- },
270
- payload: OrderStatusUpdatedPayload
271
- });
272
- var OrderShippedEvent = defineEvent({
273
- meta: {
274
- key: "marketplace.order.shipped",
275
- version: "1.0.0",
276
- description: "An order has been shipped.",
277
- stability: "experimental",
278
- owners: ["@marketplace-team"],
279
- tags: ["marketplace", "order"]
280
- },
281
- payload: OrderShippedPayload
282
- });
283
- var OrderCompletedEvent = defineEvent({
284
- meta: {
285
- key: "marketplace.order.completed",
286
- version: "1.0.0",
287
- description: "An order has been completed.",
288
- stability: "experimental",
289
- owners: ["@marketplace-team"],
290
- tags: ["marketplace", "order"]
291
- },
292
- payload: OrderCompletedPayload
293
- });
294
294
  export {
295
295
  UpdateOrderStatusInputModel,
296
296
  UpdateOrderStatusContract,
@@ -1,6 +1,6 @@
1
1
  // src/order/order.event.ts
2
- import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
3
2
  import { defineEvent } from "@contractspec/lib.contracts-spec";
3
+ import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
4
4
  var OrderCreatedPayload = defineSchemaModel({
5
5
  name: "OrderCreatedEventPayload",
6
6
  fields: {