@contractspec/example.marketplace 0.0.0-canary-20260113170453

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 (188) 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 +7 -0
  33. package/dist/example.d.ts.map +1 -0
  34. package/dist/example.js +58 -0
  35. package/dist/example.js.map +1 -0
  36. package/dist/handlers/index.d.ts +2 -0
  37. package/dist/handlers/index.js +3 -0
  38. package/dist/handlers/marketplace.handlers.d.ts +155 -0
  39. package/dist/handlers/marketplace.handlers.d.ts.map +1 -0
  40. package/dist/handlers/marketplace.handlers.js +329 -0
  41. package/dist/handlers/marketplace.handlers.js.map +1 -0
  42. package/dist/index.d.ts +31 -0
  43. package/dist/index.js +32 -0
  44. package/dist/marketplace.capability.d.ts +9 -0
  45. package/dist/marketplace.capability.d.ts.map +1 -0
  46. package/dist/marketplace.capability.js +34 -0
  47. package/dist/marketplace.capability.js.map +1 -0
  48. package/dist/marketplace.feature.d.ts +12 -0
  49. package/dist/marketplace.feature.d.ts.map +1 -0
  50. package/dist/marketplace.feature.js +315 -0
  51. package/dist/marketplace.feature.js.map +1 -0
  52. package/dist/order/index.d.ts +5 -0
  53. package/dist/order/index.js +6 -0
  54. package/dist/order/order.enum.d.ts +10 -0
  55. package/dist/order/order.enum.d.ts.map +1 -0
  56. package/dist/order/order.enum.js +22 -0
  57. package/dist/order/order.enum.js.map +1 -0
  58. package/dist/order/order.event.d.ts +145 -0
  59. package/dist/order/order.event.d.ts.map +1 -0
  60. package/dist/order/order.event.js +216 -0
  61. package/dist/order/order.event.js.map +1 -0
  62. package/dist/order/order.operations.d.ts +368 -0
  63. package/dist/order/order.operations.d.ts.map +1 -0
  64. package/dist/order/order.operations.js +119 -0
  65. package/dist/order/order.operations.js.map +1 -0
  66. package/dist/order/order.presentation.d.ts +9 -0
  67. package/dist/order/order.presentation.d.ts.map +1 -0
  68. package/dist/order/order.presentation.js +86 -0
  69. package/dist/order/order.presentation.js.map +1 -0
  70. package/dist/order/order.schema.d.ts +165 -0
  71. package/dist/order/order.schema.d.ts.map +1 -0
  72. package/dist/order/order.schema.js +155 -0
  73. package/dist/order/order.schema.js.map +1 -0
  74. package/dist/payout/index.d.ts +5 -0
  75. package/dist/payout/index.js +6 -0
  76. package/dist/payout/payout.enum.d.ts +10 -0
  77. package/dist/payout/payout.enum.d.ts.map +1 -0
  78. package/dist/payout/payout.enum.js +17 -0
  79. package/dist/payout/payout.enum.js.map +1 -0
  80. package/dist/payout/payout.event.d.ts +63 -0
  81. package/dist/payout/payout.event.d.ts.map +1 -0
  82. package/dist/payout/payout.event.js +92 -0
  83. package/dist/payout/payout.event.js.map +1 -0
  84. package/dist/payout/payout.operations.d.ts +97 -0
  85. package/dist/payout/payout.operations.d.ts.map +1 -0
  86. package/dist/payout/payout.operations.js +53 -0
  87. package/dist/payout/payout.operations.js.map +1 -0
  88. package/dist/payout/payout.presentation.d.ts +8 -0
  89. package/dist/payout/payout.presentation.d.ts.map +1 -0
  90. package/dist/payout/payout.presentation.js +60 -0
  91. package/dist/payout/payout.presentation.js.map +1 -0
  92. package/dist/payout/payout.schema.d.ts +157 -0
  93. package/dist/payout/payout.schema.d.ts.map +1 -0
  94. package/dist/payout/payout.schema.js +116 -0
  95. package/dist/payout/payout.schema.js.map +1 -0
  96. package/dist/product/index.d.ts +5 -0
  97. package/dist/product/index.js +6 -0
  98. package/dist/product/product.enum.d.ts +10 -0
  99. package/dist/product/product.enum.d.ts.map +1 -0
  100. package/dist/product/product.enum.js +18 -0
  101. package/dist/product/product.enum.js.map +1 -0
  102. package/dist/product/product.event.d.ts +73 -0
  103. package/dist/product/product.event.d.ts.map +1 -0
  104. package/dist/product/product.event.js +120 -0
  105. package/dist/product/product.event.js.map +1 -0
  106. package/dist/product/product.operations.d.ts +273 -0
  107. package/dist/product/product.operations.d.ts.map +1 -0
  108. package/dist/product/product.operations.js +108 -0
  109. package/dist/product/product.operations.js.map +1 -0
  110. package/dist/product/product.presentation.d.ts +9 -0
  111. package/dist/product/product.presentation.d.ts.map +1 -0
  112. package/dist/product/product.presentation.js +86 -0
  113. package/dist/product/product.presentation.js.map +1 -0
  114. package/dist/product/product.schema.d.ts +218 -0
  115. package/dist/product/product.schema.d.ts.map +1 -0
  116. package/dist/product/product.schema.js +176 -0
  117. package/dist/product/product.schema.js.map +1 -0
  118. package/dist/review/index.d.ts +5 -0
  119. package/dist/review/index.js +6 -0
  120. package/dist/review/review.enum.d.ts +10 -0
  121. package/dist/review/review.enum.d.ts.map +1 -0
  122. package/dist/review/review.enum.js +16 -0
  123. package/dist/review/review.enum.js.map +1 -0
  124. package/dist/review/review.event.d.ts +55 -0
  125. package/dist/review/review.event.d.ts.map +1 -0
  126. package/dist/review/review.event.js +84 -0
  127. package/dist/review/review.event.js.map +1 -0
  128. package/dist/review/review.operations.d.ts +237 -0
  129. package/dist/review/review.operations.d.ts.map +1 -0
  130. package/dist/review/review.operations.js +106 -0
  131. package/dist/review/review.operations.js.map +1 -0
  132. package/dist/review/review.presentation.d.ts +8 -0
  133. package/dist/review/review.presentation.d.ts.map +1 -0
  134. package/dist/review/review.presentation.js +60 -0
  135. package/dist/review/review.presentation.js.map +1 -0
  136. package/dist/review/review.schema.d.ts +190 -0
  137. package/dist/review/review.schema.d.ts.map +1 -0
  138. package/dist/review/review.schema.js +156 -0
  139. package/dist/review/review.schema.js.map +1 -0
  140. package/dist/seeders/index.d.ts +10 -0
  141. package/dist/seeders/index.d.ts.map +1 -0
  142. package/dist/seeders/index.js +18 -0
  143. package/dist/seeders/index.js.map +1 -0
  144. package/dist/store/index.d.ts +5 -0
  145. package/dist/store/index.js +6 -0
  146. package/dist/store/store.enum.d.ts +10 -0
  147. package/dist/store/store.enum.d.ts.map +1 -0
  148. package/dist/store/store.enum.js +16 -0
  149. package/dist/store/store.enum.js.map +1 -0
  150. package/dist/store/store.event.d.ts +51 -0
  151. package/dist/store/store.event.d.ts.map +1 -0
  152. package/dist/store/store.event.js +80 -0
  153. package/dist/store/store.event.js.map +1 -0
  154. package/dist/store/store.operations.d.ts +131 -0
  155. package/dist/store/store.operations.d.ts.map +1 -0
  156. package/dist/store/store.operations.js +61 -0
  157. package/dist/store/store.operations.js.map +1 -0
  158. package/dist/store/store.presentation.d.ts +8 -0
  159. package/dist/store/store.presentation.d.ts.map +1 -0
  160. package/dist/store/store.presentation.js +60 -0
  161. package/dist/store/store.presentation.js.map +1 -0
  162. package/dist/store/store.schema.d.ts +84 -0
  163. package/dist/store/store.schema.d.ts.map +1 -0
  164. package/dist/store/store.schema.js +93 -0
  165. package/dist/store/store.schema.js.map +1 -0
  166. package/dist/tests/operations.test-spec.d.ts +11 -0
  167. package/dist/tests/operations.test-spec.d.ts.map +1 -0
  168. package/dist/tests/operations.test-spec.js +152 -0
  169. package/dist/tests/operations.test-spec.js.map +1 -0
  170. package/dist/ui/MarketplaceDashboard.d.ts +7 -0
  171. package/dist/ui/MarketplaceDashboard.d.ts.map +1 -0
  172. package/dist/ui/MarketplaceDashboard.js +319 -0
  173. package/dist/ui/MarketplaceDashboard.js.map +1 -0
  174. package/dist/ui/hooks/index.d.ts +2 -0
  175. package/dist/ui/hooks/index.js +5 -0
  176. package/dist/ui/hooks/useMarketplaceData.d.ts +23 -0
  177. package/dist/ui/hooks/useMarketplaceData.d.ts.map +1 -0
  178. package/dist/ui/hooks/useMarketplaceData.js +64 -0
  179. package/dist/ui/hooks/useMarketplaceData.js.map +1 -0
  180. package/dist/ui/index.d.ts +6 -0
  181. package/dist/ui/index.js +6 -0
  182. package/dist/ui/renderers/index.d.ts +2 -0
  183. package/dist/ui/renderers/index.js +3 -0
  184. package/dist/ui/renderers/marketplace.markdown.d.ts +28 -0
  185. package/dist/ui/renderers/marketplace.markdown.d.ts.map +1 -0
  186. package/dist/ui/renderers/marketplace.markdown.js +244 -0
  187. package/dist/ui/renderers/marketplace.markdown.js.map +1 -0
  188. package/package.json +149 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payout.schema.js","names":[],"sources":["../../src/payout/payout.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { PayoutStatusEnum } from './payout.enum';\n\n/**\n * A payout to seller.\n */\nexport const PayoutModel = defineSchemaModel({\n name: 'PayoutModel',\n description: 'A payout to seller',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n payoutNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: PayoutStatusEnum, isOptional: false },\n grossAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n platformFees: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n netAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n periodStart: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n periodEnd: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n orderCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n paidAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\n/**\n * Input for listing payouts.\n */\nexport const ListPayoutsInputModel = defineSchemaModel({\n name: 'ListPayoutsInput',\n fields: {\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: PayoutStatusEnum, isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 20,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n});\n\n/**\n * Output for listing payouts.\n */\nexport const ListPayoutsOutputModel = defineSchemaModel({\n name: 'ListPayoutsOutput',\n fields: {\n payouts: { type: PayoutModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalPending: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n },\n});\n"],"mappings":";;;;;;;AAMA,MAAa,cAAc,kBAAkB;CAC3C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM;GAAkB,YAAY;GAAO;EACrD,aAAa;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACzE,cAAc;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EAC1E,WAAW;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACvE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,aAAa;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACnE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACjE,YAAY;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACjE,QAAQ;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAM;EAC9D;CACF,CAAC;;;;AAKF,MAAa,wBAAwB,kBAAkB;CACrD,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM;GAAkB,YAAY;GAAM;EACpD,OAAO;GACL,MAAM,eAAe,cAAc;GACnC,YAAY;GACZ,cAAc;GACf;EACD,QAAQ;GACN,MAAM,eAAe,cAAc;GACnC,YAAY;GACZ,cAAc;GACf;EACF;CACF,CAAC;;;;AAKF,MAAa,yBAAyB,kBAAkB;CACtD,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM;GAAa,SAAS;GAAM,YAAY;GAAO;EAChE,OAAO;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACjE,cAAc;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EAC3E;CACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ProductStatusEnum } from "./product.enum.js";
2
+ import { CreateProductInputModel, ListProductsInputModel, ListProductsOutputModel, ProductModel } from "./product.schema.js";
3
+ import { CreateProductContract, ListProductsContract } from "./product.operations.js";
4
+ import { InventoryUpdatedEvent, ProductCreatedEvent, ProductPublishedEvent } from "./product.event.js";
5
+ export { CreateProductContract, CreateProductInputModel, InventoryUpdatedEvent, ListProductsContract, ListProductsInputModel, ListProductsOutputModel, ProductCreatedEvent, ProductModel, ProductPublishedEvent, ProductStatusEnum };
@@ -0,0 +1,6 @@
1
+ import { ProductStatusEnum } from "./product.enum.js";
2
+ import { CreateProductInputModel, ListProductsInputModel, ListProductsOutputModel, ProductModel } from "./product.schema.js";
3
+ import { CreateProductContract, ListProductsContract } from "./product.operations.js";
4
+ import { InventoryUpdatedEvent, ProductCreatedEvent, ProductPublishedEvent } from "./product.event.js";
5
+
6
+ export { CreateProductContract, CreateProductInputModel, InventoryUpdatedEvent, ListProductsContract, ListProductsInputModel, ListProductsOutputModel, ProductCreatedEvent, ProductModel, ProductPublishedEvent, ProductStatusEnum };
@@ -0,0 +1,10 @@
1
+ import * as _contractspec_lib_schema161 from "@contractspec/lib.schema";
2
+
3
+ //#region src/product/product.enum.d.ts
4
+ /**
5
+ * Product status enum.
6
+ */
7
+ declare const ProductStatusEnum: _contractspec_lib_schema161.EnumType<[string, string, string, string, string, string]>;
8
+ //#endregion
9
+ export { ProductStatusEnum };
10
+ //# sourceMappingURL=product.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.enum.d.ts","names":[],"sources":["../../src/product/product.enum.ts"],"sourcesContent":[],"mappings":";;;;;;AAKa,cAAA,iBAOX,EAAA,2BAAA,CAP4B,QAAA,CAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { defineEnum } from "@contractspec/lib.schema";
2
+
3
+ //#region src/product/product.enum.ts
4
+ /**
5
+ * Product status enum.
6
+ */
7
+ const ProductStatusEnum = defineEnum("ProductStatus", [
8
+ "DRAFT",
9
+ "PENDING_REVIEW",
10
+ "ACTIVE",
11
+ "OUT_OF_STOCK",
12
+ "DISCONTINUED",
13
+ "REJECTED"
14
+ ]);
15
+
16
+ //#endregion
17
+ export { ProductStatusEnum };
18
+ //# sourceMappingURL=product.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.enum.js","names":[],"sources":["../../src/product/product.enum.ts"],"sourcesContent":["import { defineEnum } from '@contractspec/lib.schema';\n\n/**\n * Product status enum.\n */\nexport const ProductStatusEnum = defineEnum('ProductStatus', [\n 'DRAFT',\n 'PENDING_REVIEW',\n 'ACTIVE',\n 'OUT_OF_STOCK',\n 'DISCONTINUED',\n 'REJECTED',\n]);\n"],"mappings":";;;;;;AAKA,MAAa,oBAAoB,WAAW,iBAAiB;CAC3D;CACA;CACA;CACA;CACA;CACA;CACD,CAAC"}
@@ -0,0 +1,73 @@
1
+ import * as _contractspec_lib_contracts15 from "@contractspec/lib.contracts";
2
+ import * as _contractspec_lib_schema162 from "@contractspec/lib.schema";
3
+
4
+ //#region src/product/product.event.d.ts
5
+ declare const ProductCreatedEvent: _contractspec_lib_contracts15.EventSpec<_contractspec_lib_schema162.SchemaModel<{
6
+ productId: {
7
+ type: _contractspec_lib_schema162.FieldType<string, string>;
8
+ isOptional: false;
9
+ };
10
+ storeId: {
11
+ type: _contractspec_lib_schema162.FieldType<string, string>;
12
+ isOptional: false;
13
+ };
14
+ name: {
15
+ type: _contractspec_lib_schema162.FieldType<string, string>;
16
+ isOptional: false;
17
+ };
18
+ price: {
19
+ type: _contractspec_lib_schema162.FieldType<number, number>;
20
+ isOptional: false;
21
+ };
22
+ currency: {
23
+ type: _contractspec_lib_schema162.FieldType<string, string>;
24
+ isOptional: false;
25
+ };
26
+ timestamp: {
27
+ type: _contractspec_lib_schema162.FieldType<Date, string>;
28
+ isOptional: false;
29
+ };
30
+ }>>;
31
+ declare const ProductPublishedEvent: _contractspec_lib_contracts15.EventSpec<_contractspec_lib_schema162.SchemaModel<{
32
+ productId: {
33
+ type: _contractspec_lib_schema162.FieldType<string, string>;
34
+ isOptional: false;
35
+ };
36
+ storeId: {
37
+ type: _contractspec_lib_schema162.FieldType<string, string>;
38
+ isOptional: false;
39
+ };
40
+ timestamp: {
41
+ type: _contractspec_lib_schema162.FieldType<Date, string>;
42
+ isOptional: false;
43
+ };
44
+ }>>;
45
+ declare const InventoryUpdatedEvent: _contractspec_lib_contracts15.EventSpec<_contractspec_lib_schema162.SchemaModel<{
46
+ productId: {
47
+ type: _contractspec_lib_schema162.FieldType<string, string>;
48
+ isOptional: false;
49
+ };
50
+ variantId: {
51
+ type: _contractspec_lib_schema162.FieldType<string, string>;
52
+ isOptional: true;
53
+ };
54
+ previousQuantity: {
55
+ type: _contractspec_lib_schema162.FieldType<number, number>;
56
+ isOptional: false;
57
+ };
58
+ newQuantity: {
59
+ type: _contractspec_lib_schema162.FieldType<number, number>;
60
+ isOptional: false;
61
+ };
62
+ reason: {
63
+ type: _contractspec_lib_schema162.FieldType<string, string>;
64
+ isOptional: false;
65
+ };
66
+ timestamp: {
67
+ type: _contractspec_lib_schema162.FieldType<Date, string>;
68
+ isOptional: false;
69
+ };
70
+ }>>;
71
+ //#endregion
72
+ export { InventoryUpdatedEvent, ProductCreatedEvent, ProductPublishedEvent };
73
+ //# sourceMappingURL=product.event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.event.d.ts","names":[],"sources":["../../src/product/product.event.ts"],"sourcesContent":[],"mappings":";;;;cAuCa,qBAAmB,6BAAA,CAAA,sCAAA;;UAU9B,2BAAA,CAAA;;EAVW,CAAA;EAUX,OAAA,EAAA;;;;;;;;EAV8B,KAAA,EAAA;IAAA,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAYnB,UAAA,EAAA,KAAA;EAUX,CAAA;;;;;EAVgC,SAAA,EAAA;IAAA,IAAA,uCAAA,KAAA,EAAA,MAAA,CAAA;IAYrB,UAAA,EAAA,KAAA;EAUX,CAAA;;cAtBW,uBAAqB,6BAAA,CAAA,sCAAA;;UAUhC,2BAAA,CAAA;;;;IAEgC,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;cAArB,uBAAqB,6BAAA,CAAA,sCAAA;;UAUhC,2BAAA,CAAA"}
@@ -0,0 +1,120 @@
1
+ import { defineEvent } from "@contractspec/lib.contracts";
2
+ import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
3
+
4
+ //#region src/product/product.event.ts
5
+ const ProductCreatedPayload = defineSchemaModel({
6
+ name: "ProductCreatedEventPayload",
7
+ fields: {
8
+ productId: {
9
+ type: ScalarTypeEnum.String_unsecure(),
10
+ isOptional: false
11
+ },
12
+ storeId: {
13
+ type: ScalarTypeEnum.String_unsecure(),
14
+ isOptional: false
15
+ },
16
+ name: {
17
+ type: ScalarTypeEnum.String_unsecure(),
18
+ isOptional: false
19
+ },
20
+ price: {
21
+ type: ScalarTypeEnum.Float_unsecure(),
22
+ isOptional: false
23
+ },
24
+ currency: {
25
+ type: ScalarTypeEnum.String_unsecure(),
26
+ isOptional: false
27
+ },
28
+ timestamp: {
29
+ type: ScalarTypeEnum.DateTime(),
30
+ isOptional: false
31
+ }
32
+ }
33
+ });
34
+ const ProductPublishedPayload = defineSchemaModel({
35
+ name: "ProductPublishedEventPayload",
36
+ fields: {
37
+ productId: {
38
+ type: ScalarTypeEnum.String_unsecure(),
39
+ isOptional: false
40
+ },
41
+ storeId: {
42
+ type: ScalarTypeEnum.String_unsecure(),
43
+ isOptional: false
44
+ },
45
+ timestamp: {
46
+ type: ScalarTypeEnum.DateTime(),
47
+ isOptional: false
48
+ }
49
+ }
50
+ });
51
+ const InventoryUpdatedPayload = defineSchemaModel({
52
+ name: "InventoryUpdatedEventPayload",
53
+ fields: {
54
+ productId: {
55
+ type: ScalarTypeEnum.String_unsecure(),
56
+ isOptional: false
57
+ },
58
+ variantId: {
59
+ type: ScalarTypeEnum.String_unsecure(),
60
+ isOptional: true
61
+ },
62
+ previousQuantity: {
63
+ type: ScalarTypeEnum.Int_unsecure(),
64
+ isOptional: false
65
+ },
66
+ newQuantity: {
67
+ type: ScalarTypeEnum.Int_unsecure(),
68
+ isOptional: false
69
+ },
70
+ reason: {
71
+ type: ScalarTypeEnum.String_unsecure(),
72
+ isOptional: false
73
+ },
74
+ timestamp: {
75
+ type: ScalarTypeEnum.DateTime(),
76
+ isOptional: false
77
+ }
78
+ }
79
+ });
80
+ const ProductCreatedEvent = defineEvent({
81
+ meta: {
82
+ key: "marketplace.product.created",
83
+ version: "1.0.0",
84
+ description: "A new product has been created.",
85
+ stability: "experimental",
86
+ owners: ["@marketplace-team"],
87
+ tags: ["marketplace", "product"]
88
+ },
89
+ payload: ProductCreatedPayload
90
+ });
91
+ const ProductPublishedEvent = defineEvent({
92
+ meta: {
93
+ key: "marketplace.product.published",
94
+ version: "1.0.0",
95
+ description: "A product has been published.",
96
+ stability: "experimental",
97
+ owners: ["@marketplace-team"],
98
+ tags: ["marketplace", "product"]
99
+ },
100
+ payload: ProductPublishedPayload
101
+ });
102
+ const InventoryUpdatedEvent = defineEvent({
103
+ meta: {
104
+ key: "marketplace.inventory.updated",
105
+ version: "1.0.0",
106
+ description: "Product inventory has been updated.",
107
+ stability: "experimental",
108
+ owners: ["@marketplace-team"],
109
+ tags: [
110
+ "marketplace",
111
+ "product",
112
+ "inventory"
113
+ ]
114
+ },
115
+ payload: InventoryUpdatedPayload
116
+ });
117
+
118
+ //#endregion
119
+ export { InventoryUpdatedEvent, ProductCreatedEvent, ProductPublishedEvent };
120
+ //# sourceMappingURL=product.event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.event.js","names":[],"sources":["../../src/product/product.event.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\nconst ProductCreatedPayload = defineSchemaModel({\n name: 'ProductCreatedEventPayload',\n fields: {\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n price: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ProductPublishedPayload = defineSchemaModel({\n name: 'ProductPublishedEventPayload',\n fields: {\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst InventoryUpdatedPayload = defineSchemaModel({\n name: 'InventoryUpdatedEventPayload',\n fields: {\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n variantId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n previousQuantity: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n newQuantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const ProductCreatedEvent = defineEvent({\n meta: {\n key: 'marketplace.product.created',\n version: '1.0.0',\n description: 'A new product has been created.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'product'],\n },\n payload: ProductCreatedPayload,\n});\n\nexport const ProductPublishedEvent = defineEvent({\n meta: {\n key: 'marketplace.product.published',\n version: '1.0.0',\n description: 'A product has been published.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'product'],\n },\n payload: ProductPublishedPayload,\n});\n\nexport const InventoryUpdatedEvent = defineEvent({\n meta: {\n key: 'marketplace.inventory.updated',\n version: '1.0.0',\n description: 'Product inventory has been updated.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'product', 'inventory'],\n },\n payload: InventoryUpdatedPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,wBAAwB,kBAAkB;CAC9C,MAAM;CACN,QAAQ;EACN,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,OAAO;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACnE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,0BAA0B,kBAAkB;CAChD,MAAM;CACN,QAAQ;EACN,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,0BAA0B,kBAAkB;CAChD,MAAM;CACN,QAAQ;EACN,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,kBAAkB;GAChB,MAAM,eAAe,cAAc;GACnC,YAAY;GACb;EACD,aAAa;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACvE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAa,sBAAsB,YAAY;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,UAAU;EACjC;CACD,SAAS;CACV,CAAC;AAEF,MAAa,wBAAwB,YAAY;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,UAAU;EACjC;CACD,SAAS;CACV,CAAC;AAEF,MAAa,wBAAwB,YAAY;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAW;GAAY;EAC9C;CACD,SAAS;CACV,CAAC"}
@@ -0,0 +1,273 @@
1
+ import * as _contractspec_lib_contracts18 from "@contractspec/lib.contracts";
2
+ import * as _contractspec_lib_schema218 from "@contractspec/lib.schema";
3
+
4
+ //#region src/product/product.operations.d.ts
5
+ /**
6
+ * Create a new product listing.
7
+ */
8
+ declare const CreateProductContract: _contractspec_lib_contracts18.OperationSpec<_contractspec_lib_schema218.SchemaModel<{
9
+ storeId: {
10
+ type: _contractspec_lib_schema218.FieldType<string, string>;
11
+ isOptional: false;
12
+ };
13
+ name: {
14
+ type: _contractspec_lib_schema218.FieldType<string, string>;
15
+ isOptional: false;
16
+ };
17
+ slug: {
18
+ type: _contractspec_lib_schema218.FieldType<string, string>;
19
+ isOptional: false;
20
+ };
21
+ description: {
22
+ type: _contractspec_lib_schema218.FieldType<string, string>;
23
+ isOptional: true;
24
+ };
25
+ price: {
26
+ type: _contractspec_lib_schema218.FieldType<number, number>;
27
+ isOptional: false;
28
+ };
29
+ currency: {
30
+ type: _contractspec_lib_schema218.FieldType<string, string>;
31
+ isOptional: true;
32
+ };
33
+ quantity: {
34
+ type: _contractspec_lib_schema218.FieldType<number, number>;
35
+ isOptional: true;
36
+ };
37
+ categoryId: {
38
+ type: _contractspec_lib_schema218.FieldType<string, string>;
39
+ isOptional: true;
40
+ };
41
+ sku: {
42
+ type: _contractspec_lib_schema218.FieldType<string, string>;
43
+ isOptional: true;
44
+ };
45
+ }>, _contractspec_lib_schema218.SchemaModel<{
46
+ id: {
47
+ type: _contractspec_lib_schema218.FieldType<string, string>;
48
+ isOptional: false;
49
+ };
50
+ storeId: {
51
+ type: _contractspec_lib_schema218.FieldType<string, string>;
52
+ isOptional: false;
53
+ };
54
+ name: {
55
+ type: _contractspec_lib_schema218.FieldType<string, string>;
56
+ isOptional: false;
57
+ };
58
+ slug: {
59
+ type: _contractspec_lib_schema218.FieldType<string, string>;
60
+ isOptional: false;
61
+ };
62
+ description: {
63
+ type: _contractspec_lib_schema218.FieldType<string, string>;
64
+ isOptional: true;
65
+ };
66
+ status: {
67
+ type: _contractspec_lib_schema218.EnumType<[string, string, string, string, string, string]>;
68
+ isOptional: false;
69
+ };
70
+ price: {
71
+ type: _contractspec_lib_schema218.FieldType<number, number>;
72
+ isOptional: false;
73
+ };
74
+ currency: {
75
+ type: _contractspec_lib_schema218.FieldType<string, string>;
76
+ isOptional: false;
77
+ };
78
+ quantity: {
79
+ type: _contractspec_lib_schema218.FieldType<number, number>;
80
+ isOptional: false;
81
+ };
82
+ categoryId: {
83
+ type: _contractspec_lib_schema218.FieldType<string, string>;
84
+ isOptional: true;
85
+ };
86
+ primaryImageId: {
87
+ type: _contractspec_lib_schema218.FieldType<string, string>;
88
+ isOptional: true;
89
+ };
90
+ averageRating: {
91
+ type: _contractspec_lib_schema218.FieldType<number, number>;
92
+ isOptional: false;
93
+ };
94
+ totalSold: {
95
+ type: _contractspec_lib_schema218.FieldType<number, number>;
96
+ isOptional: false;
97
+ };
98
+ createdAt: {
99
+ type: _contractspec_lib_schema218.FieldType<Date, string>;
100
+ isOptional: false;
101
+ };
102
+ }>, {
103
+ key: string;
104
+ version: string;
105
+ when: string;
106
+ payload: _contractspec_lib_schema218.SchemaModel<{
107
+ id: {
108
+ type: _contractspec_lib_schema218.FieldType<string, string>;
109
+ isOptional: false;
110
+ };
111
+ storeId: {
112
+ type: _contractspec_lib_schema218.FieldType<string, string>;
113
+ isOptional: false;
114
+ };
115
+ name: {
116
+ type: _contractspec_lib_schema218.FieldType<string, string>;
117
+ isOptional: false;
118
+ };
119
+ slug: {
120
+ type: _contractspec_lib_schema218.FieldType<string, string>;
121
+ isOptional: false;
122
+ };
123
+ description: {
124
+ type: _contractspec_lib_schema218.FieldType<string, string>;
125
+ isOptional: true;
126
+ };
127
+ status: {
128
+ type: _contractspec_lib_schema218.EnumType<[string, string, string, string, string, string]>;
129
+ isOptional: false;
130
+ };
131
+ price: {
132
+ type: _contractspec_lib_schema218.FieldType<number, number>;
133
+ isOptional: false;
134
+ };
135
+ currency: {
136
+ type: _contractspec_lib_schema218.FieldType<string, string>;
137
+ isOptional: false;
138
+ };
139
+ quantity: {
140
+ type: _contractspec_lib_schema218.FieldType<number, number>;
141
+ isOptional: false;
142
+ };
143
+ categoryId: {
144
+ type: _contractspec_lib_schema218.FieldType<string, string>;
145
+ isOptional: true;
146
+ };
147
+ primaryImageId: {
148
+ type: _contractspec_lib_schema218.FieldType<string, string>;
149
+ isOptional: true;
150
+ };
151
+ averageRating: {
152
+ type: _contractspec_lib_schema218.FieldType<number, number>;
153
+ isOptional: false;
154
+ };
155
+ totalSold: {
156
+ type: _contractspec_lib_schema218.FieldType<number, number>;
157
+ isOptional: false;
158
+ };
159
+ createdAt: {
160
+ type: _contractspec_lib_schema218.FieldType<Date, string>;
161
+ isOptional: false;
162
+ };
163
+ }>;
164
+ }[]>;
165
+ /**
166
+ * List products with filters.
167
+ */
168
+ declare const ListProductsContract: _contractspec_lib_contracts18.OperationSpec<_contractspec_lib_schema218.SchemaModel<{
169
+ storeId: {
170
+ type: _contractspec_lib_schema218.FieldType<string, string>;
171
+ isOptional: true;
172
+ };
173
+ categoryId: {
174
+ type: _contractspec_lib_schema218.FieldType<string, string>;
175
+ isOptional: true;
176
+ };
177
+ status: {
178
+ type: _contractspec_lib_schema218.EnumType<[string, string, string, string, string, string]>;
179
+ isOptional: true;
180
+ };
181
+ search: {
182
+ type: _contractspec_lib_schema218.FieldType<string, string>;
183
+ isOptional: true;
184
+ };
185
+ minPrice: {
186
+ type: _contractspec_lib_schema218.FieldType<number, number>;
187
+ isOptional: true;
188
+ };
189
+ maxPrice: {
190
+ type: _contractspec_lib_schema218.FieldType<number, number>;
191
+ isOptional: true;
192
+ };
193
+ limit: {
194
+ type: _contractspec_lib_schema218.FieldType<number, number>;
195
+ isOptional: true;
196
+ defaultValue: number;
197
+ };
198
+ offset: {
199
+ type: _contractspec_lib_schema218.FieldType<number, number>;
200
+ isOptional: true;
201
+ defaultValue: number;
202
+ };
203
+ }>, _contractspec_lib_schema218.SchemaModel<{
204
+ products: {
205
+ type: _contractspec_lib_schema218.SchemaModel<{
206
+ id: {
207
+ type: _contractspec_lib_schema218.FieldType<string, string>;
208
+ isOptional: false;
209
+ };
210
+ storeId: {
211
+ type: _contractspec_lib_schema218.FieldType<string, string>;
212
+ isOptional: false;
213
+ };
214
+ name: {
215
+ type: _contractspec_lib_schema218.FieldType<string, string>;
216
+ isOptional: false;
217
+ };
218
+ slug: {
219
+ type: _contractspec_lib_schema218.FieldType<string, string>;
220
+ isOptional: false;
221
+ };
222
+ description: {
223
+ type: _contractspec_lib_schema218.FieldType<string, string>;
224
+ isOptional: true;
225
+ };
226
+ status: {
227
+ type: _contractspec_lib_schema218.EnumType<[string, string, string, string, string, string]>;
228
+ isOptional: false;
229
+ };
230
+ price: {
231
+ type: _contractspec_lib_schema218.FieldType<number, number>;
232
+ isOptional: false;
233
+ };
234
+ currency: {
235
+ type: _contractspec_lib_schema218.FieldType<string, string>;
236
+ isOptional: false;
237
+ };
238
+ quantity: {
239
+ type: _contractspec_lib_schema218.FieldType<number, number>;
240
+ isOptional: false;
241
+ };
242
+ categoryId: {
243
+ type: _contractspec_lib_schema218.FieldType<string, string>;
244
+ isOptional: true;
245
+ };
246
+ primaryImageId: {
247
+ type: _contractspec_lib_schema218.FieldType<string, string>;
248
+ isOptional: true;
249
+ };
250
+ averageRating: {
251
+ type: _contractspec_lib_schema218.FieldType<number, number>;
252
+ isOptional: false;
253
+ };
254
+ totalSold: {
255
+ type: _contractspec_lib_schema218.FieldType<number, number>;
256
+ isOptional: false;
257
+ };
258
+ createdAt: {
259
+ type: _contractspec_lib_schema218.FieldType<Date, string>;
260
+ isOptional: false;
261
+ };
262
+ }>;
263
+ isArray: true;
264
+ isOptional: false;
265
+ };
266
+ total: {
267
+ type: _contractspec_lib_schema218.FieldType<number, number>;
268
+ isOptional: false;
269
+ };
270
+ }>, undefined>;
271
+ //#endregion
272
+ export { CreateProductContract, ListProductsContract };
273
+ //# sourceMappingURL=product.operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.operations.d.ts","names":[],"sources":["../../src/product/product.operations.ts"],"sourcesContent":[],"mappings":";;;;;;;cAgBa,qDAAqB,0CAAA;EAArB,OAAA,EAAA;IAkDX,IAAA,EAAA,2BAAA,CAAA,SAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;;;EAlDgC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;UAAA,2BAAA,CAAA;;;;;;EAAA,CAAA;EAuDrB,IAAA,EAAA;IA8BX,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;+CA9B+B,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,IAAA;;;;;;;;;;;;;;;;;;;IAAA,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAApB,oDAAoB,0CAAA;;UA8B/B,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA9B+B,2BAAA,CAAA"}
@@ -0,0 +1,108 @@
1
+ import { CreateProductInputModel, ListProductsInputModel, ListProductsOutputModel, ProductModel } from "./product.schema.js";
2
+ import { defineCommand, defineQuery } from "@contractspec/lib.contracts/operations";
3
+
4
+ //#region src/product/product.operations.ts
5
+ const OWNERS = ["@example.marketplace"];
6
+ /**
7
+ * Create a new product listing.
8
+ */
9
+ const CreateProductContract = defineCommand({
10
+ meta: {
11
+ key: "marketplace.product.create",
12
+ version: "1.0.0",
13
+ stability: "stable",
14
+ owners: [...OWNERS],
15
+ tags: [
16
+ "marketplace",
17
+ "product",
18
+ "create"
19
+ ],
20
+ description: "Create a new product listing.",
21
+ goal: "Allow sellers to list products.",
22
+ context: "Product management."
23
+ },
24
+ io: {
25
+ input: CreateProductInputModel,
26
+ output: ProductModel
27
+ },
28
+ policy: { auth: "user" },
29
+ sideEffects: {
30
+ emits: [{
31
+ key: "marketplace.product.created",
32
+ version: "1.0.0",
33
+ when: "Product is created",
34
+ payload: ProductModel
35
+ }],
36
+ audit: ["marketplace.product.created"]
37
+ },
38
+ acceptance: {
39
+ scenarios: [{
40
+ key: "create-product-happy-path",
41
+ given: ["User is a seller"],
42
+ when: ["User creates a product listing"],
43
+ then: ["Product is created", "ProductCreated event is emitted"]
44
+ }],
45
+ examples: [{
46
+ key: "create-t-shirt",
47
+ input: {
48
+ title: "Classic T-Shirt",
49
+ price: 25,
50
+ stock: 100,
51
+ storeId: "store-123"
52
+ },
53
+ output: {
54
+ id: "prod-456",
55
+ title: "Classic T-Shirt",
56
+ status: "published"
57
+ }
58
+ }]
59
+ }
60
+ });
61
+ /**
62
+ * List products with filters.
63
+ */
64
+ const ListProductsContract = defineQuery({
65
+ meta: {
66
+ key: "marketplace.product.list",
67
+ version: "1.0.0",
68
+ stability: "stable",
69
+ owners: [...OWNERS],
70
+ tags: [
71
+ "marketplace",
72
+ "product",
73
+ "list"
74
+ ],
75
+ description: "List products with filters.",
76
+ goal: "Browse products on the marketplace.",
77
+ context: "Product catalog, search."
78
+ },
79
+ io: {
80
+ input: ListProductsInputModel,
81
+ output: ListProductsOutputModel
82
+ },
83
+ policy: { auth: "anonymous" },
84
+ acceptance: {
85
+ scenarios: [{
86
+ key: "list-products-happy-path",
87
+ given: ["Products exist"],
88
+ when: ["User searches for products"],
89
+ then: ["List of products is returned"]
90
+ }],
91
+ examples: [{
92
+ key: "search-t-shirts",
93
+ input: {
94
+ search: "t-shirt",
95
+ limit: 20
96
+ },
97
+ output: {
98
+ items: [],
99
+ total: 50,
100
+ hasMore: true
101
+ }
102
+ }]
103
+ }
104
+ });
105
+
106
+ //#endregion
107
+ export { CreateProductContract, ListProductsContract };
108
+ //# sourceMappingURL=product.operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.operations.js","names":[],"sources":["../../src/product/product.operations.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport {\n CreateProductInputModel,\n ListProductsInputModel,\n ListProductsOutputModel,\n ProductModel,\n} from './product.schema';\n\nconst OWNERS = ['@example.marketplace'] as const;\n\n/**\n * Create a new product listing.\n */\nexport const CreateProductContract = defineCommand({\n meta: {\n key: 'marketplace.product.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'product', 'create'],\n description: 'Create a new product listing.',\n goal: 'Allow sellers to list products.',\n context: 'Product management.',\n },\n io: { input: CreateProductInputModel, output: ProductModel },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'marketplace.product.created',\n version: '1.0.0',\n when: 'Product is created',\n payload: ProductModel,\n },\n ],\n audit: ['marketplace.product.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-product-happy-path',\n given: ['User is a seller'],\n when: ['User creates a product listing'],\n then: ['Product is created', 'ProductCreated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'create-t-shirt',\n input: {\n title: 'Classic T-Shirt',\n price: 25,\n stock: 100,\n storeId: 'store-123',\n },\n output: {\n id: 'prod-456',\n title: 'Classic T-Shirt',\n status: 'published',\n },\n },\n ],\n },\n});\n\n/**\n * List products with filters.\n */\nexport const ListProductsContract = defineQuery({\n meta: {\n key: 'marketplace.product.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'product', 'list'],\n description: 'List products with filters.',\n goal: 'Browse products on the marketplace.',\n context: 'Product catalog, search.',\n },\n io: { input: ListProductsInputModel, output: ListProductsOutputModel },\n policy: { auth: 'anonymous' },\n acceptance: {\n scenarios: [\n {\n key: 'list-products-happy-path',\n given: ['Products exist'],\n when: ['User searches for products'],\n then: ['List of products is returned'],\n },\n ],\n examples: [\n {\n key: 'search-t-shirts',\n input: { search: 't-shirt', limit: 20 },\n output: { items: [], total: 50, hasMore: true },\n },\n ],\n },\n});\n"],"mappings":";;;;AAWA,MAAM,SAAS,CAAC,uBAAuB;;;;AAKvC,MAAa,wBAAwB,cAAc;CACjD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAW;GAAS;EAC1C,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAyB,QAAQ;EAAc;CAC5D,QAAQ,EAAE,MAAM,QAAQ;CACxB,aAAa;EACX,OAAO,CACL;GACE,KAAK;GACL,SAAS;GACT,MAAM;GACN,SAAS;GACV,CACF;EACD,OAAO,CAAC,8BAA8B;EACvC;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,mBAAmB;GAC3B,MAAM,CAAC,iCAAiC;GACxC,MAAM,CAAC,sBAAsB,kCAAkC;GAChE,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IACL,OAAO;IACP,OAAO;IACP,OAAO;IACP,SAAS;IACV;GACD,QAAQ;IACN,IAAI;IACJ,OAAO;IACP,QAAQ;IACT;GACF,CACF;EACF;CACF,CAAC;;;;AAKF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAW;GAAO;EACxC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAwB,QAAQ;EAAyB;CACtE,QAAQ,EAAE,MAAM,aAAa;CAC7B,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,iBAAiB;GACzB,MAAM,CAAC,6BAA6B;GACpC,MAAM,CAAC,+BAA+B;GACvC,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,QAAQ;IAAW,OAAO;IAAI;GACvC,QAAQ;IAAE,OAAO,EAAE;IAAE,OAAO;IAAI,SAAS;IAAM;GAChD,CACF;EACF;CACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import * as _contractspec_lib_contracts20 from "@contractspec/lib.contracts";
2
+
3
+ //#region src/product/product.presentation.d.ts
4
+ declare const ProductCatalogPresentation: _contractspec_lib_contracts20.PresentationSpec;
5
+ declare const ProductDetailPresentation: _contractspec_lib_contracts20.PresentationSpec;
6
+ declare const ProductEditorPresentation: _contractspec_lib_contracts20.PresentationSpec;
7
+ //#endregion
8
+ export { ProductCatalogPresentation, ProductDetailPresentation, ProductEditorPresentation };
9
+ //# sourceMappingURL=product.presentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.presentation.d.ts","names":[],"sources":["../../src/product/product.presentation.ts"],"sourcesContent":[],"mappings":";;;cAGa,4BAuBX,6BAAA,CAvBqC;cAyB1B,2BAuBX,6BAAA,CAvBoC;cAyBzB,2BAuBX,6BAAA,CAvBoC"}