@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 @@
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,\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,\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,\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_schema838 from "@contractspec/lib.schema";
2
+ import * as _contractspec_lib_contracts12 from "@contractspec/lib.contracts";
3
+
4
+ //#region src/product/product.operations.d.ts
5
+ /**
6
+ * Create a new product listing.
7
+ */
8
+ declare const CreateProductContract: _contractspec_lib_contracts12.OperationSpec<_contractspec_lib_schema838.SchemaModel<{
9
+ storeId: {
10
+ type: _contractspec_lib_schema838.FieldType<string, string>;
11
+ isOptional: false;
12
+ };
13
+ name: {
14
+ type: _contractspec_lib_schema838.FieldType<string, string>;
15
+ isOptional: false;
16
+ };
17
+ slug: {
18
+ type: _contractspec_lib_schema838.FieldType<string, string>;
19
+ isOptional: false;
20
+ };
21
+ description: {
22
+ type: _contractspec_lib_schema838.FieldType<string, string>;
23
+ isOptional: true;
24
+ };
25
+ price: {
26
+ type: _contractspec_lib_schema838.FieldType<number, number>;
27
+ isOptional: false;
28
+ };
29
+ currency: {
30
+ type: _contractspec_lib_schema838.FieldType<string, string>;
31
+ isOptional: true;
32
+ };
33
+ quantity: {
34
+ type: _contractspec_lib_schema838.FieldType<number, number>;
35
+ isOptional: true;
36
+ };
37
+ categoryId: {
38
+ type: _contractspec_lib_schema838.FieldType<string, string>;
39
+ isOptional: true;
40
+ };
41
+ sku: {
42
+ type: _contractspec_lib_schema838.FieldType<string, string>;
43
+ isOptional: true;
44
+ };
45
+ }>, _contractspec_lib_schema838.SchemaModel<{
46
+ id: {
47
+ type: _contractspec_lib_schema838.FieldType<string, string>;
48
+ isOptional: false;
49
+ };
50
+ storeId: {
51
+ type: _contractspec_lib_schema838.FieldType<string, string>;
52
+ isOptional: false;
53
+ };
54
+ name: {
55
+ type: _contractspec_lib_schema838.FieldType<string, string>;
56
+ isOptional: false;
57
+ };
58
+ slug: {
59
+ type: _contractspec_lib_schema838.FieldType<string, string>;
60
+ isOptional: false;
61
+ };
62
+ description: {
63
+ type: _contractspec_lib_schema838.FieldType<string, string>;
64
+ isOptional: true;
65
+ };
66
+ status: {
67
+ type: _contractspec_lib_schema838.EnumType<[string, string, string, string, string, string]>;
68
+ isOptional: false;
69
+ };
70
+ price: {
71
+ type: _contractspec_lib_schema838.FieldType<number, number>;
72
+ isOptional: false;
73
+ };
74
+ currency: {
75
+ type: _contractspec_lib_schema838.FieldType<string, string>;
76
+ isOptional: false;
77
+ };
78
+ quantity: {
79
+ type: _contractspec_lib_schema838.FieldType<number, number>;
80
+ isOptional: false;
81
+ };
82
+ categoryId: {
83
+ type: _contractspec_lib_schema838.FieldType<string, string>;
84
+ isOptional: true;
85
+ };
86
+ primaryImageId: {
87
+ type: _contractspec_lib_schema838.FieldType<string, string>;
88
+ isOptional: true;
89
+ };
90
+ averageRating: {
91
+ type: _contractspec_lib_schema838.FieldType<number, number>;
92
+ isOptional: false;
93
+ };
94
+ totalSold: {
95
+ type: _contractspec_lib_schema838.FieldType<number, number>;
96
+ isOptional: false;
97
+ };
98
+ createdAt: {
99
+ type: _contractspec_lib_schema838.FieldType<Date, string>;
100
+ isOptional: false;
101
+ };
102
+ }>, {
103
+ key: string;
104
+ version: number;
105
+ when: string;
106
+ payload: _contractspec_lib_schema838.SchemaModel<{
107
+ id: {
108
+ type: _contractspec_lib_schema838.FieldType<string, string>;
109
+ isOptional: false;
110
+ };
111
+ storeId: {
112
+ type: _contractspec_lib_schema838.FieldType<string, string>;
113
+ isOptional: false;
114
+ };
115
+ name: {
116
+ type: _contractspec_lib_schema838.FieldType<string, string>;
117
+ isOptional: false;
118
+ };
119
+ slug: {
120
+ type: _contractspec_lib_schema838.FieldType<string, string>;
121
+ isOptional: false;
122
+ };
123
+ description: {
124
+ type: _contractspec_lib_schema838.FieldType<string, string>;
125
+ isOptional: true;
126
+ };
127
+ status: {
128
+ type: _contractspec_lib_schema838.EnumType<[string, string, string, string, string, string]>;
129
+ isOptional: false;
130
+ };
131
+ price: {
132
+ type: _contractspec_lib_schema838.FieldType<number, number>;
133
+ isOptional: false;
134
+ };
135
+ currency: {
136
+ type: _contractspec_lib_schema838.FieldType<string, string>;
137
+ isOptional: false;
138
+ };
139
+ quantity: {
140
+ type: _contractspec_lib_schema838.FieldType<number, number>;
141
+ isOptional: false;
142
+ };
143
+ categoryId: {
144
+ type: _contractspec_lib_schema838.FieldType<string, string>;
145
+ isOptional: true;
146
+ };
147
+ primaryImageId: {
148
+ type: _contractspec_lib_schema838.FieldType<string, string>;
149
+ isOptional: true;
150
+ };
151
+ averageRating: {
152
+ type: _contractspec_lib_schema838.FieldType<number, number>;
153
+ isOptional: false;
154
+ };
155
+ totalSold: {
156
+ type: _contractspec_lib_schema838.FieldType<number, number>;
157
+ isOptional: false;
158
+ };
159
+ createdAt: {
160
+ type: _contractspec_lib_schema838.FieldType<Date, string>;
161
+ isOptional: false;
162
+ };
163
+ }>;
164
+ }[]>;
165
+ /**
166
+ * List products with filters.
167
+ */
168
+ declare const ListProductsContract: _contractspec_lib_contracts12.OperationSpec<_contractspec_lib_schema838.SchemaModel<{
169
+ storeId: {
170
+ type: _contractspec_lib_schema838.FieldType<string, string>;
171
+ isOptional: true;
172
+ };
173
+ categoryId: {
174
+ type: _contractspec_lib_schema838.FieldType<string, string>;
175
+ isOptional: true;
176
+ };
177
+ status: {
178
+ type: _contractspec_lib_schema838.EnumType<[string, string, string, string, string, string]>;
179
+ isOptional: true;
180
+ };
181
+ search: {
182
+ type: _contractspec_lib_schema838.FieldType<string, string>;
183
+ isOptional: true;
184
+ };
185
+ minPrice: {
186
+ type: _contractspec_lib_schema838.FieldType<number, number>;
187
+ isOptional: true;
188
+ };
189
+ maxPrice: {
190
+ type: _contractspec_lib_schema838.FieldType<number, number>;
191
+ isOptional: true;
192
+ };
193
+ limit: {
194
+ type: _contractspec_lib_schema838.FieldType<number, number>;
195
+ isOptional: true;
196
+ defaultValue: number;
197
+ };
198
+ offset: {
199
+ type: _contractspec_lib_schema838.FieldType<number, number>;
200
+ isOptional: true;
201
+ defaultValue: number;
202
+ };
203
+ }>, _contractspec_lib_schema838.SchemaModel<{
204
+ products: {
205
+ type: _contractspec_lib_schema838.SchemaModel<{
206
+ id: {
207
+ type: _contractspec_lib_schema838.FieldType<string, string>;
208
+ isOptional: false;
209
+ };
210
+ storeId: {
211
+ type: _contractspec_lib_schema838.FieldType<string, string>;
212
+ isOptional: false;
213
+ };
214
+ name: {
215
+ type: _contractspec_lib_schema838.FieldType<string, string>;
216
+ isOptional: false;
217
+ };
218
+ slug: {
219
+ type: _contractspec_lib_schema838.FieldType<string, string>;
220
+ isOptional: false;
221
+ };
222
+ description: {
223
+ type: _contractspec_lib_schema838.FieldType<string, string>;
224
+ isOptional: true;
225
+ };
226
+ status: {
227
+ type: _contractspec_lib_schema838.EnumType<[string, string, string, string, string, string]>;
228
+ isOptional: false;
229
+ };
230
+ price: {
231
+ type: _contractspec_lib_schema838.FieldType<number, number>;
232
+ isOptional: false;
233
+ };
234
+ currency: {
235
+ type: _contractspec_lib_schema838.FieldType<string, string>;
236
+ isOptional: false;
237
+ };
238
+ quantity: {
239
+ type: _contractspec_lib_schema838.FieldType<number, number>;
240
+ isOptional: false;
241
+ };
242
+ categoryId: {
243
+ type: _contractspec_lib_schema838.FieldType<string, string>;
244
+ isOptional: true;
245
+ };
246
+ primaryImageId: {
247
+ type: _contractspec_lib_schema838.FieldType<string, string>;
248
+ isOptional: true;
249
+ };
250
+ averageRating: {
251
+ type: _contractspec_lib_schema838.FieldType<number, number>;
252
+ isOptional: false;
253
+ };
254
+ totalSold: {
255
+ type: _contractspec_lib_schema838.FieldType<number, number>;
256
+ isOptional: false;
257
+ };
258
+ createdAt: {
259
+ type: _contractspec_lib_schema838.FieldType<Date, string>;
260
+ isOptional: false;
261
+ };
262
+ }>;
263
+ isArray: true;
264
+ isOptional: false;
265
+ };
266
+ total: {
267
+ type: _contractspec_lib_schema838.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,
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,
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,
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,\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,\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,\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 { PresentationSpec } from "@contractspec/lib.contracts";
2
+
3
+ //#region src/product/product.presentation.d.ts
4
+ declare const ProductCatalogPresentation: PresentationSpec;
5
+ declare const ProductDetailPresentation: PresentationSpec;
6
+ declare const ProductEditorPresentation: 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":";;;cAIa,4BAA4B;cAyB5B,2BAA2B;AAzB3B,cAkDA,yBAlD4B,EAkDD,gBA3BvC"}
@@ -0,0 +1,86 @@
1
+ import { ProductModel } from "./product.schema.js";
2
+ import { StabilityEnum } from "@contractspec/lib.contracts";
3
+
4
+ //#region src/product/product.presentation.ts
5
+ const ProductCatalogPresentation = {
6
+ meta: {
7
+ key: "marketplace.product.catalog",
8
+ version: 1,
9
+ title: "Product Catalog",
10
+ description: "Product catalog with search and filters",
11
+ domain: "marketplace",
12
+ owners: ["@marketplace-team"],
13
+ tags: [
14
+ "marketplace",
15
+ "product",
16
+ "catalog"
17
+ ],
18
+ stability: StabilityEnum.Experimental,
19
+ goal: "Enable users to browse and search for products.",
20
+ context: "The primary shopping interface."
21
+ },
22
+ source: {
23
+ type: "component",
24
+ framework: "react",
25
+ componentKey: "ProductCatalog",
26
+ props: ProductModel
27
+ },
28
+ targets: ["react", "markdown"],
29
+ policy: { flags: ["marketplace.products.enabled"] }
30
+ };
31
+ const ProductDetailPresentation = {
32
+ meta: {
33
+ key: "marketplace.product.detail",
34
+ version: 1,
35
+ title: "Product Details",
36
+ description: "Product detail page with images and reviews",
37
+ domain: "marketplace",
38
+ owners: ["@marketplace-team"],
39
+ tags: [
40
+ "marketplace",
41
+ "product",
42
+ "detail"
43
+ ],
44
+ stability: StabilityEnum.Experimental,
45
+ goal: "Provide comprehensive information about a specific product.",
46
+ context: "Product showcase including images, descriptions, and ratings."
47
+ },
48
+ source: {
49
+ type: "component",
50
+ framework: "react",
51
+ componentKey: "ProductDetail",
52
+ props: ProductModel
53
+ },
54
+ targets: ["react", "markdown"],
55
+ policy: { flags: ["marketplace.products.enabled"] }
56
+ };
57
+ const ProductEditorPresentation = {
58
+ meta: {
59
+ key: "marketplace.product.editor",
60
+ version: 1,
61
+ title: "Product Editor",
62
+ description: "Product editor for sellers",
63
+ domain: "marketplace",
64
+ owners: ["@marketplace-team"],
65
+ tags: [
66
+ "marketplace",
67
+ "product",
68
+ "editor"
69
+ ],
70
+ stability: StabilityEnum.Experimental,
71
+ goal: "Allow sellers to create and modify product listings.",
72
+ context: "Management tool for store owners."
73
+ },
74
+ source: {
75
+ type: "component",
76
+ framework: "react",
77
+ componentKey: "ProductEditor",
78
+ props: ProductModel
79
+ },
80
+ targets: ["react"],
81
+ policy: { flags: ["marketplace.seller.enabled"] }
82
+ };
83
+
84
+ //#endregion
85
+ export { ProductCatalogPresentation, ProductDetailPresentation, ProductEditorPresentation };
86
+ //# sourceMappingURL=product.presentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.presentation.js","names":["ProductCatalogPresentation: PresentationSpec","ProductDetailPresentation: PresentationSpec","ProductEditorPresentation: PresentationSpec"],"sources":["../../src/product/product.presentation.ts"],"sourcesContent":["import type { PresentationSpec } from '@contractspec/lib.contracts';\nimport { StabilityEnum } from '@contractspec/lib.contracts';\nimport { ProductModel } from './product.schema';\n\nexport const ProductCatalogPresentation: PresentationSpec = {\n meta: {\n key: 'marketplace.product.catalog',\n version: 1,\n title: 'Product Catalog',\n description: 'Product catalog with search and filters',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'product', 'catalog'],\n stability: StabilityEnum.Experimental,\n goal: 'Enable users to browse and search for products.',\n context: 'The primary shopping interface.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ProductCatalog',\n props: ProductModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.products.enabled'],\n },\n};\n\nexport const ProductDetailPresentation: PresentationSpec = {\n meta: {\n key: 'marketplace.product.detail',\n version: 1,\n title: 'Product Details',\n description: 'Product detail page with images and reviews',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'product', 'detail'],\n stability: StabilityEnum.Experimental,\n goal: 'Provide comprehensive information about a specific product.',\n context: 'Product showcase including images, descriptions, and ratings.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ProductDetail',\n props: ProductModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.products.enabled'],\n },\n};\n\nexport const ProductEditorPresentation: PresentationSpec = {\n meta: {\n key: 'marketplace.product.editor',\n version: 1,\n title: 'Product Editor',\n description: 'Product editor for sellers',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'product', 'editor'],\n stability: StabilityEnum.Experimental,\n goal: 'Allow sellers to create and modify product listings.',\n context: 'Management tool for store owners.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ProductEditor',\n props: ProductModel,\n },\n targets: ['react'],\n policy: {\n flags: ['marketplace.seller.enabled'],\n },\n};\n"],"mappings":";;;;AAIA,MAAaA,6BAA+C;CAC1D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAW;GAAU;EAC3C,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,+BAA+B,EACxC;CACF;AAED,MAAaC,4BAA8C;CACzD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAW;GAAS;EAC1C,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,+BAA+B,EACxC;CACF;AAED,MAAaC,4BAA8C;CACzD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAW;GAAS;EAC1C,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,6BAA6B,EACtC;CACF"}