@contractspec/example.marketplace 1.57.0 → 1.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/dist/browser/docs/index.js +103 -0
  2. package/dist/browser/docs/marketplace.docblock.js +103 -0
  3. package/dist/browser/entities/index.js +721 -0
  4. package/dist/browser/entities/order.js +167 -0
  5. package/dist/browser/entities/payout.js +142 -0
  6. package/dist/browser/entities/product.js +152 -0
  7. package/dist/browser/entities/review.js +129 -0
  8. package/dist/browser/entities/store.js +97 -0
  9. package/dist/browser/example.js +42 -0
  10. package/dist/browser/handlers/index.js +303 -0
  11. package/dist/browser/handlers/marketplace.handlers.js +303 -0
  12. package/dist/browser/index.js +2016 -0
  13. package/dist/browser/marketplace.capability.js +40 -0
  14. package/dist/browser/marketplace.feature.js +137 -0
  15. package/dist/browser/order/index.js +307 -0
  16. package/dist/browser/order/order.enum.js +17 -0
  17. package/dist/browser/order/order.event.js +131 -0
  18. package/dist/browser/order/order.operations.js +172 -0
  19. package/dist/browser/order/order.presentation.js +153 -0
  20. package/dist/browser/order/order.schema.js +79 -0
  21. package/dist/browser/payout/index.js +152 -0
  22. package/dist/browser/payout/payout.enum.js +12 -0
  23. package/dist/browser/payout/payout.event.js +55 -0
  24. package/dist/browser/payout/payout.operations.js +94 -0
  25. package/dist/browser/payout/payout.presentation.js +111 -0
  26. package/dist/browser/payout/payout.schema.js +61 -0
  27. package/dist/browser/product/index.js +249 -0
  28. package/dist/browser/product/product.enum.js +13 -0
  29. package/dist/browser/product/product.event.js +74 -0
  30. package/dist/browser/product/product.operations.js +171 -0
  31. package/dist/browser/product/product.presentation.js +158 -0
  32. package/dist/browser/product/product.schema.js +84 -0
  33. package/dist/browser/review/index.js +206 -0
  34. package/dist/browser/review/review.enum.js +11 -0
  35. package/dist/browser/review/review.event.js +50 -0
  36. package/dist/browser/review/review.operations.js +152 -0
  37. package/dist/browser/review/review.presentation.js +123 -0
  38. package/dist/browser/review/review.schema.js +74 -0
  39. package/dist/browser/seeders/index.js +12 -0
  40. package/dist/browser/store/index.js +142 -0
  41. package/dist/browser/store/store.enum.js +11 -0
  42. package/dist/browser/store/store.event.js +52 -0
  43. package/dist/browser/store/store.operations.js +88 -0
  44. package/dist/browser/store/store.presentation.js +94 -0
  45. package/dist/browser/store/store.schema.js +43 -0
  46. package/dist/browser/tests/operations.test-spec.js +139 -0
  47. package/dist/browser/ui/MarketplaceDashboard.js +418 -0
  48. package/dist/browser/ui/hooks/index.js +59 -0
  49. package/dist/browser/ui/hooks/useMarketplaceData.js +56 -0
  50. package/dist/browser/ui/index.js +668 -0
  51. package/dist/browser/ui/renderers/index.js +248 -0
  52. package/dist/browser/ui/renderers/marketplace.markdown.js +248 -0
  53. package/dist/docs/index.d.ts +2 -1
  54. package/dist/docs/index.d.ts.map +1 -0
  55. package/dist/docs/index.js +104 -1
  56. package/dist/docs/marketplace.docblock.d.ts +2 -1
  57. package/dist/docs/marketplace.docblock.d.ts.map +1 -0
  58. package/dist/docs/marketplace.docblock.js +46 -57
  59. package/dist/entities/index.d.ts +302 -307
  60. package/dist/entities/index.d.ts.map +1 -1
  61. package/dist/entities/index.js +719 -43
  62. package/dist/entities/order.d.ts +77 -82
  63. package/dist/entities/order.d.ts.map +1 -1
  64. package/dist/entities/order.js +162 -167
  65. package/dist/entities/payout.d.ts +64 -69
  66. package/dist/entities/payout.d.ts.map +1 -1
  67. package/dist/entities/payout.js +137 -156
  68. package/dist/entities/product.d.ts +69 -74
  69. package/dist/entities/product.d.ts.map +1 -1
  70. package/dist/entities/product.js +148 -156
  71. package/dist/entities/review.d.ts +55 -60
  72. package/dist/entities/review.d.ts.map +1 -1
  73. package/dist/entities/review.js +124 -146
  74. package/dist/entities/store.d.ts +40 -45
  75. package/dist/entities/store.d.ts.map +1 -1
  76. package/dist/entities/store.js +94 -106
  77. package/dist/example.d.ts +2 -6
  78. package/dist/example.d.ts.map +1 -1
  79. package/dist/example.js +41 -55
  80. package/dist/handlers/index.d.ts +2 -2
  81. package/dist/handlers/index.d.ts.map +1 -0
  82. package/dist/handlers/index.js +304 -3
  83. package/dist/handlers/marketplace.handlers.d.ts +138 -137
  84. package/dist/handlers/marketplace.handlers.d.ts.map +1 -1
  85. package/dist/handlers/marketplace.handlers.js +284 -309
  86. package/dist/index.d.ts +13 -31
  87. package/dist/index.d.ts.map +1 -0
  88. package/dist/index.js +2017 -32
  89. package/dist/marketplace.capability.d.ts +3 -8
  90. package/dist/marketplace.capability.d.ts.map +1 -1
  91. package/dist/marketplace.capability.js +41 -34
  92. package/dist/marketplace.feature.d.ts +1 -6
  93. package/dist/marketplace.feature.d.ts.map +1 -1
  94. package/dist/marketplace.feature.js +136 -313
  95. package/dist/node/docs/index.js +103 -0
  96. package/dist/node/docs/marketplace.docblock.js +103 -0
  97. package/dist/node/entities/index.js +721 -0
  98. package/dist/node/entities/order.js +167 -0
  99. package/dist/node/entities/payout.js +142 -0
  100. package/dist/node/entities/product.js +152 -0
  101. package/dist/node/entities/review.js +129 -0
  102. package/dist/node/entities/store.js +97 -0
  103. package/dist/node/example.js +42 -0
  104. package/dist/node/handlers/index.js +303 -0
  105. package/dist/node/handlers/marketplace.handlers.js +303 -0
  106. package/dist/node/index.js +2016 -0
  107. package/dist/node/marketplace.capability.js +40 -0
  108. package/dist/node/marketplace.feature.js +137 -0
  109. package/dist/node/order/index.js +307 -0
  110. package/dist/node/order/order.enum.js +17 -0
  111. package/dist/node/order/order.event.js +131 -0
  112. package/dist/node/order/order.operations.js +172 -0
  113. package/dist/node/order/order.presentation.js +153 -0
  114. package/dist/node/order/order.schema.js +79 -0
  115. package/dist/node/payout/index.js +152 -0
  116. package/dist/node/payout/payout.enum.js +12 -0
  117. package/dist/node/payout/payout.event.js +55 -0
  118. package/dist/node/payout/payout.operations.js +94 -0
  119. package/dist/node/payout/payout.presentation.js +111 -0
  120. package/dist/node/payout/payout.schema.js +61 -0
  121. package/dist/node/product/index.js +249 -0
  122. package/dist/node/product/product.enum.js +13 -0
  123. package/dist/node/product/product.event.js +74 -0
  124. package/dist/node/product/product.operations.js +171 -0
  125. package/dist/node/product/product.presentation.js +158 -0
  126. package/dist/node/product/product.schema.js +84 -0
  127. package/dist/node/review/index.js +206 -0
  128. package/dist/node/review/review.enum.js +11 -0
  129. package/dist/node/review/review.event.js +50 -0
  130. package/dist/node/review/review.operations.js +152 -0
  131. package/dist/node/review/review.presentation.js +123 -0
  132. package/dist/node/review/review.schema.js +74 -0
  133. package/dist/node/seeders/index.js +12 -0
  134. package/dist/node/store/index.js +142 -0
  135. package/dist/node/store/store.enum.js +11 -0
  136. package/dist/node/store/store.event.js +52 -0
  137. package/dist/node/store/store.operations.js +88 -0
  138. package/dist/node/store/store.presentation.js +94 -0
  139. package/dist/node/store/store.schema.js +43 -0
  140. package/dist/node/tests/operations.test-spec.js +139 -0
  141. package/dist/node/ui/MarketplaceDashboard.js +418 -0
  142. package/dist/node/ui/hooks/index.js +59 -0
  143. package/dist/node/ui/hooks/useMarketplaceData.js +56 -0
  144. package/dist/node/ui/index.js +668 -0
  145. package/dist/node/ui/renderers/index.js +248 -0
  146. package/dist/node/ui/renderers/marketplace.markdown.js +248 -0
  147. package/dist/order/index.d.ts +8 -5
  148. package/dist/order/index.d.ts.map +1 -0
  149. package/dist/order/index.js +307 -5
  150. package/dist/order/order.enum.d.ts +1 -6
  151. package/dist/order/order.enum.d.ts.map +1 -1
  152. package/dist/order/order.enum.js +16 -20
  153. package/dist/order/order.event.d.ts +133 -139
  154. package/dist/order/order.event.d.ts.map +1 -1
  155. package/dist/order/order.event.js +121 -205
  156. package/dist/order/order.operations.d.ts +291 -297
  157. package/dist/order/order.operations.d.ts.map +1 -1
  158. package/dist/order/order.operations.js +169 -115
  159. package/dist/order/order.presentation.d.ts +3 -8
  160. package/dist/order/order.presentation.d.ts.map +1 -1
  161. package/dist/order/order.presentation.js +149 -81
  162. package/dist/order/order.schema.d.ts +143 -148
  163. package/dist/order/order.schema.d.ts.map +1 -1
  164. package/dist/order/order.schema.js +75 -150
  165. package/dist/payout/index.d.ts +8 -5
  166. package/dist/payout/index.d.ts.map +1 -0
  167. package/dist/payout/index.js +152 -5
  168. package/dist/payout/payout.enum.d.ts +1 -6
  169. package/dist/payout/payout.enum.d.ts.map +1 -1
  170. package/dist/payout/payout.enum.js +11 -15
  171. package/dist/payout/payout.event.d.ts +54 -60
  172. package/dist/payout/payout.event.d.ts.map +1 -1
  173. package/dist/payout/payout.event.js +51 -87
  174. package/dist/payout/payout.operations.d.ts +82 -88
  175. package/dist/payout/payout.operations.d.ts.map +1 -1
  176. package/dist/payout/payout.operations.js +92 -50
  177. package/dist/payout/payout.presentation.d.ts +2 -7
  178. package/dist/payout/payout.presentation.d.ts.map +1 -1
  179. package/dist/payout/payout.presentation.js +108 -56
  180. package/dist/payout/payout.schema.d.ts +139 -144
  181. package/dist/payout/payout.schema.d.ts.map +1 -1
  182. package/dist/payout/payout.schema.js +58 -112
  183. package/dist/product/index.d.ts +8 -5
  184. package/dist/product/index.d.ts.map +1 -0
  185. package/dist/product/index.js +249 -5
  186. package/dist/product/product.enum.d.ts +1 -6
  187. package/dist/product/product.enum.d.ts.map +1 -1
  188. package/dist/product/product.enum.js +12 -16
  189. package/dist/product/product.event.d.ts +63 -69
  190. package/dist/product/product.event.d.ts.map +1 -1
  191. package/dist/product/product.event.js +68 -113
  192. package/dist/product/product.operations.d.ts +225 -231
  193. package/dist/product/product.operations.d.ts.map +1 -1
  194. package/dist/product/product.operations.js +168 -104
  195. package/dist/product/product.presentation.d.ts +3 -8
  196. package/dist/product/product.presentation.d.ts.map +1 -1
  197. package/dist/product/product.presentation.js +154 -81
  198. package/dist/product/product.schema.d.ts +196 -201
  199. package/dist/product/product.schema.d.ts.map +1 -1
  200. package/dist/product/product.schema.js +80 -171
  201. package/dist/review/index.d.ts +8 -5
  202. package/dist/review/index.d.ts.map +1 -0
  203. package/dist/review/index.js +206 -5
  204. package/dist/review/review.enum.d.ts +1 -6
  205. package/dist/review/review.enum.d.ts.map +1 -1
  206. package/dist/review/review.enum.js +10 -14
  207. package/dist/review/review.event.d.ts +46 -52
  208. package/dist/review/review.event.d.ts.map +1 -1
  209. package/dist/review/review.event.js +46 -79
  210. package/dist/review/review.operations.d.ts +190 -196
  211. package/dist/review/review.operations.d.ts.map +1 -1
  212. package/dist/review/review.operations.js +149 -102
  213. package/dist/review/review.presentation.d.ts +2 -7
  214. package/dist/review/review.presentation.d.ts.map +1 -1
  215. package/dist/review/review.presentation.js +120 -56
  216. package/dist/review/review.schema.d.ts +164 -169
  217. package/dist/review/review.schema.d.ts.map +1 -1
  218. package/dist/review/review.schema.js +70 -151
  219. package/dist/seeders/index.d.ts +4 -8
  220. package/dist/seeders/index.d.ts.map +1 -1
  221. package/dist/seeders/index.js +11 -16
  222. package/dist/store/index.d.ts +8 -5
  223. package/dist/store/index.d.ts.map +1 -0
  224. package/dist/store/index.js +142 -5
  225. package/dist/store/store.enum.d.ts +1 -6
  226. package/dist/store/store.enum.d.ts.map +1 -1
  227. package/dist/store/store.enum.js +10 -14
  228. package/dist/store/store.event.d.ts +42 -48
  229. package/dist/store/store.event.d.ts.map +1 -1
  230. package/dist/store/store.event.js +48 -75
  231. package/dist/store/store.operations.d.ts +98 -104
  232. package/dist/store/store.operations.d.ts.map +1 -1
  233. package/dist/store/store.operations.js +86 -58
  234. package/dist/store/store.presentation.d.ts +2 -7
  235. package/dist/store/store.presentation.d.ts.map +1 -1
  236. package/dist/store/store.presentation.js +91 -56
  237. package/dist/store/store.schema.d.ts +70 -75
  238. package/dist/store/store.schema.d.ts.map +1 -1
  239. package/dist/store/store.schema.js +41 -90
  240. package/dist/tests/operations.test-spec.d.ts +5 -10
  241. package/dist/tests/operations.test-spec.d.ts.map +1 -1
  242. package/dist/tests/operations.test-spec.js +134 -146
  243. package/dist/ui/MarketplaceDashboard.d.ts +1 -6
  244. package/dist/ui/MarketplaceDashboard.d.ts.map +1 -1
  245. package/dist/ui/MarketplaceDashboard.js +413 -313
  246. package/dist/ui/hooks/index.d.ts +2 -2
  247. package/dist/ui/hooks/index.d.ts.map +1 -0
  248. package/dist/ui/hooks/index.js +59 -4
  249. package/dist/ui/hooks/useMarketplaceData.d.ts +16 -20
  250. package/dist/ui/hooks/useMarketplaceData.d.ts.map +1 -1
  251. package/dist/ui/hooks/useMarketplaceData.js +53 -60
  252. package/dist/ui/index.d.ts +7 -6
  253. package/dist/ui/index.d.ts.map +1 -0
  254. package/dist/ui/index.js +668 -5
  255. package/dist/ui/renderers/index.d.ts +2 -2
  256. package/dist/ui/renderers/index.d.ts.map +1 -0
  257. package/dist/ui/renderers/index.js +249 -3
  258. package/dist/ui/renderers/marketplace.markdown.d.ts +13 -14
  259. package/dist/ui/renderers/marketplace.markdown.d.ts.map +1 -1
  260. package/dist/ui/renderers/marketplace.markdown.js +241 -236
  261. package/package.json +528 -109
  262. package/dist/docs/marketplace.docblock.js.map +0 -1
  263. package/dist/entities/index.js.map +0 -1
  264. package/dist/entities/order.js.map +0 -1
  265. package/dist/entities/payout.js.map +0 -1
  266. package/dist/entities/product.js.map +0 -1
  267. package/dist/entities/review.js.map +0 -1
  268. package/dist/entities/store.js.map +0 -1
  269. package/dist/example.js.map +0 -1
  270. package/dist/handlers/marketplace.handlers.js.map +0 -1
  271. package/dist/marketplace.capability.js.map +0 -1
  272. package/dist/marketplace.feature.js.map +0 -1
  273. package/dist/order/order.enum.js.map +0 -1
  274. package/dist/order/order.event.js.map +0 -1
  275. package/dist/order/order.operations.js.map +0 -1
  276. package/dist/order/order.presentation.js.map +0 -1
  277. package/dist/order/order.schema.js.map +0 -1
  278. package/dist/payout/payout.enum.js.map +0 -1
  279. package/dist/payout/payout.event.js.map +0 -1
  280. package/dist/payout/payout.operations.js.map +0 -1
  281. package/dist/payout/payout.presentation.js.map +0 -1
  282. package/dist/payout/payout.schema.js.map +0 -1
  283. package/dist/product/product.enum.js.map +0 -1
  284. package/dist/product/product.event.js.map +0 -1
  285. package/dist/product/product.operations.js.map +0 -1
  286. package/dist/product/product.presentation.js.map +0 -1
  287. package/dist/product/product.schema.js.map +0 -1
  288. package/dist/review/review.enum.js.map +0 -1
  289. package/dist/review/review.event.js.map +0 -1
  290. package/dist/review/review.operations.js.map +0 -1
  291. package/dist/review/review.presentation.js.map +0 -1
  292. package/dist/review/review.schema.js.map +0 -1
  293. package/dist/seeders/index.js.map +0 -1
  294. package/dist/store/store.enum.js.map +0 -1
  295. package/dist/store/store.event.js.map +0 -1
  296. package/dist/store/store.operations.js.map +0 -1
  297. package/dist/store/store.presentation.js.map +0 -1
  298. package/dist/store/store.schema.js.map +0 -1
  299. package/dist/tests/operations.test-spec.js.map +0 -1
  300. package/dist/ui/MarketplaceDashboard.js.map +0 -1
  301. package/dist/ui/hooks/useMarketplaceData.js.map +0 -1
  302. package/dist/ui/renderers/marketplace.markdown.js.map +0 -1
@@ -1,116 +1,62 @@
1
- import { PayoutStatusEnum } from "./payout.enum.js";
2
- import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
1
+ // @bun
2
+ // src/payout/payout.enum.ts
3
+ import { defineEnum } from "@contractspec/lib.schema";
4
+ var PayoutStatusEnum = defineEnum("PayoutStatus", [
5
+ "PENDING",
6
+ "PROCESSING",
7
+ "PAID",
8
+ "FAILED",
9
+ "CANCELLED"
10
+ ]);
3
11
 
4
- //#region src/payout/payout.schema.ts
5
- /**
6
- * A payout to seller.
7
- */
8
- const PayoutModel = defineSchemaModel({
9
- name: "PayoutModel",
10
- description: "A payout to seller",
11
- fields: {
12
- id: {
13
- type: ScalarTypeEnum.String_unsecure(),
14
- isOptional: false
15
- },
16
- payoutNumber: {
17
- type: ScalarTypeEnum.String_unsecure(),
18
- isOptional: false
19
- },
20
- storeId: {
21
- type: ScalarTypeEnum.String_unsecure(),
22
- isOptional: false
23
- },
24
- status: {
25
- type: PayoutStatusEnum,
26
- isOptional: false
27
- },
28
- grossAmount: {
29
- type: ScalarTypeEnum.Float_unsecure(),
30
- isOptional: false
31
- },
32
- platformFees: {
33
- type: ScalarTypeEnum.Float_unsecure(),
34
- isOptional: false
35
- },
36
- netAmount: {
37
- type: ScalarTypeEnum.Float_unsecure(),
38
- isOptional: false
39
- },
40
- currency: {
41
- type: ScalarTypeEnum.String_unsecure(),
42
- isOptional: false
43
- },
44
- periodStart: {
45
- type: ScalarTypeEnum.DateTime(),
46
- isOptional: false
47
- },
48
- periodEnd: {
49
- type: ScalarTypeEnum.DateTime(),
50
- isOptional: false
51
- },
52
- orderCount: {
53
- type: ScalarTypeEnum.Int_unsecure(),
54
- isOptional: false
55
- },
56
- createdAt: {
57
- type: ScalarTypeEnum.DateTime(),
58
- isOptional: false
59
- },
60
- paidAt: {
61
- type: ScalarTypeEnum.DateTime(),
62
- isOptional: true
63
- }
64
- }
12
+ // src/payout/payout.schema.ts
13
+ import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
14
+ var PayoutModel = defineSchemaModel({
15
+ name: "PayoutModel",
16
+ description: "A payout to seller",
17
+ fields: {
18
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
19
+ payoutNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
20
+ storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
21
+ status: { type: PayoutStatusEnum, isOptional: false },
22
+ grossAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
23
+ platformFees: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
24
+ netAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
25
+ currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
26
+ periodStart: { type: ScalarTypeEnum.DateTime(), isOptional: false },
27
+ periodEnd: { type: ScalarTypeEnum.DateTime(), isOptional: false },
28
+ orderCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
29
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
30
+ paidAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
31
+ }
65
32
  });
66
- /**
67
- * Input for listing payouts.
68
- */
69
- const ListPayoutsInputModel = defineSchemaModel({
70
- name: "ListPayoutsInput",
71
- fields: {
72
- storeId: {
73
- type: ScalarTypeEnum.String_unsecure(),
74
- isOptional: false
75
- },
76
- status: {
77
- type: PayoutStatusEnum,
78
- isOptional: true
79
- },
80
- limit: {
81
- type: ScalarTypeEnum.Int_unsecure(),
82
- isOptional: true,
83
- defaultValue: 20
84
- },
85
- offset: {
86
- type: ScalarTypeEnum.Int_unsecure(),
87
- isOptional: true,
88
- defaultValue: 0
89
- }
90
- }
33
+ var ListPayoutsInputModel = defineSchemaModel({
34
+ name: "ListPayoutsInput",
35
+ fields: {
36
+ storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
37
+ status: { type: PayoutStatusEnum, isOptional: true },
38
+ limit: {
39
+ type: ScalarTypeEnum.Int_unsecure(),
40
+ isOptional: true,
41
+ defaultValue: 20
42
+ },
43
+ offset: {
44
+ type: ScalarTypeEnum.Int_unsecure(),
45
+ isOptional: true,
46
+ defaultValue: 0
47
+ }
48
+ }
91
49
  });
92
- /**
93
- * Output for listing payouts.
94
- */
95
- const ListPayoutsOutputModel = defineSchemaModel({
96
- name: "ListPayoutsOutput",
97
- fields: {
98
- payouts: {
99
- type: PayoutModel,
100
- isArray: true,
101
- isOptional: false
102
- },
103
- total: {
104
- type: ScalarTypeEnum.Int_unsecure(),
105
- isOptional: false
106
- },
107
- totalPending: {
108
- type: ScalarTypeEnum.Float_unsecure(),
109
- isOptional: false
110
- }
111
- }
50
+ var ListPayoutsOutputModel = defineSchemaModel({
51
+ name: "ListPayoutsOutput",
52
+ fields: {
53
+ payouts: { type: PayoutModel, isArray: true, isOptional: false },
54
+ total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
55
+ totalPending: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
56
+ }
112
57
  });
113
-
114
- //#endregion
115
- export { ListPayoutsInputModel, ListPayoutsOutputModel, PayoutModel };
116
- //# sourceMappingURL=payout.schema.js.map
58
+ export {
59
+ PayoutModel,
60
+ ListPayoutsOutputModel,
61
+ ListPayoutsInputModel
62
+ };
@@ -1,5 +1,8 @@
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 };
1
+ /**
2
+ * Product domain - Product listing management.
3
+ */
4
+ export { ProductStatusEnum } from './product.enum';
5
+ export { ProductModel, CreateProductInputModel, ListProductsInputModel, ListProductsOutputModel, } from './product.schema';
6
+ export { CreateProductContract, ListProductsContract, } from './product.operations';
7
+ export { ProductCreatedEvent, ProductPublishedEvent, InventoryUpdatedEvent, } from './product.event';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/product/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC"}
@@ -1,6 +1,250 @@
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";
1
+ // @bun
2
+ // src/product/product.enum.ts
3
+ import { defineEnum } from "@contractspec/lib.schema";
4
+ var ProductStatusEnum = defineEnum("ProductStatus", [
5
+ "DRAFT",
6
+ "PENDING_REVIEW",
7
+ "ACTIVE",
8
+ "OUT_OF_STOCK",
9
+ "DISCONTINUED",
10
+ "REJECTED"
11
+ ]);
5
12
 
6
- export { CreateProductContract, CreateProductInputModel, InventoryUpdatedEvent, ListProductsContract, ListProductsInputModel, ListProductsOutputModel, ProductCreatedEvent, ProductModel, ProductPublishedEvent, ProductStatusEnum };
13
+ // src/product/product.schema.ts
14
+ import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
15
+ var ProductModel = defineSchemaModel({
16
+ name: "ProductModel",
17
+ description: "A product listing",
18
+ fields: {
19
+ id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
20
+ storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
21
+ name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
22
+ slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
23
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
24
+ status: { type: ProductStatusEnum, isOptional: false },
25
+ price: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
26
+ currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
27
+ quantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
28
+ categoryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
29
+ primaryImageId: {
30
+ type: ScalarTypeEnum.String_unsecure(),
31
+ isOptional: true
32
+ },
33
+ averageRating: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
34
+ totalSold: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
35
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
36
+ }
37
+ });
38
+ var CreateProductInputModel = defineSchemaModel({
39
+ name: "CreateProductInput",
40
+ fields: {
41
+ storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
42
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
43
+ slug: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
44
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
45
+ price: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
46
+ currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
47
+ quantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
48
+ categoryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
49
+ sku: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
50
+ }
51
+ });
52
+ var ListProductsInputModel = defineSchemaModel({
53
+ name: "ListProductsInput",
54
+ fields: {
55
+ storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
56
+ categoryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
57
+ status: { type: ProductStatusEnum, isOptional: true },
58
+ search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
59
+ minPrice: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },
60
+ maxPrice: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },
61
+ limit: {
62
+ type: ScalarTypeEnum.Int_unsecure(),
63
+ isOptional: true,
64
+ defaultValue: 20
65
+ },
66
+ offset: {
67
+ type: ScalarTypeEnum.Int_unsecure(),
68
+ isOptional: true,
69
+ defaultValue: 0
70
+ }
71
+ }
72
+ });
73
+ var ListProductsOutputModel = defineSchemaModel({
74
+ name: "ListProductsOutput",
75
+ fields: {
76
+ products: { type: ProductModel, isArray: true, isOptional: false },
77
+ total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
78
+ }
79
+ });
80
+
81
+ // src/product/product.operations.ts
82
+ import {
83
+ defineCommand,
84
+ defineQuery
85
+ } from "@contractspec/lib.contracts/operations";
86
+ var OWNERS = ["@example.marketplace"];
87
+ var CreateProductContract = defineCommand({
88
+ meta: {
89
+ key: "marketplace.product.create",
90
+ version: "1.0.0",
91
+ stability: "stable",
92
+ owners: [...OWNERS],
93
+ tags: ["marketplace", "product", "create"],
94
+ description: "Create a new product listing.",
95
+ goal: "Allow sellers to list products.",
96
+ context: "Product management."
97
+ },
98
+ io: { input: CreateProductInputModel, output: ProductModel },
99
+ policy: { auth: "user" },
100
+ sideEffects: {
101
+ emits: [
102
+ {
103
+ key: "marketplace.product.created",
104
+ version: "1.0.0",
105
+ when: "Product is created",
106
+ payload: ProductModel
107
+ }
108
+ ],
109
+ audit: ["marketplace.product.created"]
110
+ },
111
+ acceptance: {
112
+ scenarios: [
113
+ {
114
+ key: "create-product-happy-path",
115
+ given: ["User is a seller"],
116
+ when: ["User creates a product listing"],
117
+ then: ["Product is created", "ProductCreated event is emitted"]
118
+ }
119
+ ],
120
+ examples: [
121
+ {
122
+ key: "create-t-shirt",
123
+ input: {
124
+ title: "Classic T-Shirt",
125
+ price: 25,
126
+ stock: 100,
127
+ storeId: "store-123"
128
+ },
129
+ output: {
130
+ id: "prod-456",
131
+ title: "Classic T-Shirt",
132
+ status: "published"
133
+ }
134
+ }
135
+ ]
136
+ }
137
+ });
138
+ var ListProductsContract = defineQuery({
139
+ meta: {
140
+ key: "marketplace.product.list",
141
+ version: "1.0.0",
142
+ stability: "stable",
143
+ owners: [...OWNERS],
144
+ tags: ["marketplace", "product", "list"],
145
+ description: "List products with filters.",
146
+ goal: "Browse products on the marketplace.",
147
+ context: "Product catalog, search."
148
+ },
149
+ io: { input: ListProductsInputModel, output: ListProductsOutputModel },
150
+ policy: { auth: "anonymous" },
151
+ acceptance: {
152
+ scenarios: [
153
+ {
154
+ key: "list-products-happy-path",
155
+ given: ["Products exist"],
156
+ when: ["User searches for products"],
157
+ then: ["List of products is returned"]
158
+ }
159
+ ],
160
+ examples: [
161
+ {
162
+ key: "search-t-shirts",
163
+ input: { search: "t-shirt", limit: 20 },
164
+ output: { items: [], total: 50, hasMore: true }
165
+ }
166
+ ]
167
+ }
168
+ });
169
+
170
+ // src/product/product.event.ts
171
+ import { ScalarTypeEnum as ScalarTypeEnum2, defineSchemaModel as defineSchemaModel2 } from "@contractspec/lib.schema";
172
+ import { defineEvent } from "@contractspec/lib.contracts";
173
+ var ProductCreatedPayload = defineSchemaModel2({
174
+ name: "ProductCreatedEventPayload",
175
+ fields: {
176
+ productId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
177
+ storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
178
+ name: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
179
+ price: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
180
+ currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
181
+ timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
182
+ }
183
+ });
184
+ var ProductPublishedPayload = defineSchemaModel2({
185
+ name: "ProductPublishedEventPayload",
186
+ fields: {
187
+ productId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
188
+ storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
189
+ timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
190
+ }
191
+ });
192
+ var InventoryUpdatedPayload = defineSchemaModel2({
193
+ name: "InventoryUpdatedEventPayload",
194
+ fields: {
195
+ productId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
196
+ variantId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
197
+ previousQuantity: {
198
+ type: ScalarTypeEnum2.Int_unsecure(),
199
+ isOptional: false
200
+ },
201
+ newQuantity: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
202
+ reason: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
203
+ timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
204
+ }
205
+ });
206
+ var ProductCreatedEvent = defineEvent({
207
+ meta: {
208
+ key: "marketplace.product.created",
209
+ version: "1.0.0",
210
+ description: "A new product has been created.",
211
+ stability: "experimental",
212
+ owners: ["@marketplace-team"],
213
+ tags: ["marketplace", "product"]
214
+ },
215
+ payload: ProductCreatedPayload
216
+ });
217
+ var ProductPublishedEvent = defineEvent({
218
+ meta: {
219
+ key: "marketplace.product.published",
220
+ version: "1.0.0",
221
+ description: "A product has been published.",
222
+ stability: "experimental",
223
+ owners: ["@marketplace-team"],
224
+ tags: ["marketplace", "product"]
225
+ },
226
+ payload: ProductPublishedPayload
227
+ });
228
+ var InventoryUpdatedEvent = defineEvent({
229
+ meta: {
230
+ key: "marketplace.inventory.updated",
231
+ version: "1.0.0",
232
+ description: "Product inventory has been updated.",
233
+ stability: "experimental",
234
+ owners: ["@marketplace-team"],
235
+ tags: ["marketplace", "product", "inventory"]
236
+ },
237
+ payload: InventoryUpdatedPayload
238
+ });
239
+ export {
240
+ ProductStatusEnum,
241
+ ProductPublishedEvent,
242
+ ProductModel,
243
+ ProductCreatedEvent,
244
+ ListProductsOutputModel,
245
+ ListProductsInputModel,
246
+ ListProductsContract,
247
+ InventoryUpdatedEvent,
248
+ CreateProductInputModel,
249
+ CreateProductContract
250
+ };
@@ -1,10 +1,5 @@
1
- import * as _contractspec_lib_schema0 from "@contractspec/lib.schema";
2
-
3
- //#region src/product/product.enum.d.ts
4
1
  /**
5
2
  * Product status enum.
6
3
  */
7
- declare const ProductStatusEnum: _contractspec_lib_schema0.EnumType<[string, string, string, string, string, string]>;
8
- //#endregion
9
- export { ProductStatusEnum };
4
+ export declare const ProductStatusEnum: import("@contractspec/lib.schema").EnumType<[string, string, string, string, string, string]>;
10
5
  //# sourceMappingURL=product.enum.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.enum.d.ts","names":[],"sources":["../../src/product/product.enum.ts"],"mappings":";;;;;;cAKa,iBAAA,EAOX,yBAAA,CAP4B,QAAA"}
1
+ {"version":3,"file":"product.enum.d.ts","sourceRoot":"","sources":["../../src/product/product.enum.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,iBAAiB,+FAO5B,CAAC"}
@@ -1,18 +1,14 @@
1
+ // @bun
2
+ // src/product/product.enum.ts
1
3
  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"
4
+ var ProductStatusEnum = defineEnum("ProductStatus", [
5
+ "DRAFT",
6
+ "PENDING_REVIEW",
7
+ "ACTIVE",
8
+ "OUT_OF_STOCK",
9
+ "DISCONTINUED",
10
+ "REJECTED"
14
11
  ]);
15
-
16
- //#endregion
17
- export { ProductStatusEnum };
18
- //# sourceMappingURL=product.enum.js.map
12
+ export {
13
+ ProductStatusEnum
14
+ };
@@ -1,73 +1,67 @@
1
- import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
2
- import * as _contractspec_lib_schema0 from "@contractspec/lib.schema";
3
-
4
- //#region src/product/product.event.d.ts
5
- declare const ProductCreatedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
6
- productId: {
7
- type: _contractspec_lib_schema0.FieldType<string, string>;
8
- isOptional: false;
9
- };
10
- storeId: {
11
- type: _contractspec_lib_schema0.FieldType<string, string>;
12
- isOptional: false;
13
- };
14
- name: {
15
- type: _contractspec_lib_schema0.FieldType<string, string>;
16
- isOptional: false;
17
- };
18
- price: {
19
- type: _contractspec_lib_schema0.FieldType<number, number>;
20
- isOptional: false;
21
- };
22
- currency: {
23
- type: _contractspec_lib_schema0.FieldType<string, string>;
24
- isOptional: false;
25
- };
26
- timestamp: {
27
- type: _contractspec_lib_schema0.FieldType<Date, string>;
28
- isOptional: false;
29
- };
1
+ export declare const ProductCreatedEvent: import("@contractspec/lib.contracts").EventSpec<import("@contractspec/lib.schema").SchemaModel<{
2
+ productId: {
3
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
4
+ isOptional: false;
5
+ };
6
+ storeId: {
7
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
8
+ isOptional: false;
9
+ };
10
+ name: {
11
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
12
+ isOptional: false;
13
+ };
14
+ price: {
15
+ type: import("@contractspec/lib.schema").FieldType<number, number>;
16
+ isOptional: false;
17
+ };
18
+ currency: {
19
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
20
+ isOptional: false;
21
+ };
22
+ timestamp: {
23
+ type: import("@contractspec/lib.schema").FieldType<Date, string>;
24
+ isOptional: false;
25
+ };
30
26
  }>>;
31
- declare const ProductPublishedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
32
- productId: {
33
- type: _contractspec_lib_schema0.FieldType<string, string>;
34
- isOptional: false;
35
- };
36
- storeId: {
37
- type: _contractspec_lib_schema0.FieldType<string, string>;
38
- isOptional: false;
39
- };
40
- timestamp: {
41
- type: _contractspec_lib_schema0.FieldType<Date, string>;
42
- isOptional: false;
43
- };
27
+ export declare const ProductPublishedEvent: import("@contractspec/lib.contracts").EventSpec<import("@contractspec/lib.schema").SchemaModel<{
28
+ productId: {
29
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
30
+ isOptional: false;
31
+ };
32
+ storeId: {
33
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
34
+ isOptional: false;
35
+ };
36
+ timestamp: {
37
+ type: import("@contractspec/lib.schema").FieldType<Date, string>;
38
+ isOptional: false;
39
+ };
44
40
  }>>;
45
- declare const InventoryUpdatedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
46
- productId: {
47
- type: _contractspec_lib_schema0.FieldType<string, string>;
48
- isOptional: false;
49
- };
50
- variantId: {
51
- type: _contractspec_lib_schema0.FieldType<string, string>;
52
- isOptional: true;
53
- };
54
- previousQuantity: {
55
- type: _contractspec_lib_schema0.FieldType<number, number>;
56
- isOptional: false;
57
- };
58
- newQuantity: {
59
- type: _contractspec_lib_schema0.FieldType<number, number>;
60
- isOptional: false;
61
- };
62
- reason: {
63
- type: _contractspec_lib_schema0.FieldType<string, string>;
64
- isOptional: false;
65
- };
66
- timestamp: {
67
- type: _contractspec_lib_schema0.FieldType<Date, string>;
68
- isOptional: false;
69
- };
41
+ export declare const InventoryUpdatedEvent: import("@contractspec/lib.contracts").EventSpec<import("@contractspec/lib.schema").SchemaModel<{
42
+ productId: {
43
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
44
+ isOptional: false;
45
+ };
46
+ variantId: {
47
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
48
+ isOptional: true;
49
+ };
50
+ previousQuantity: {
51
+ type: import("@contractspec/lib.schema").FieldType<number, number>;
52
+ isOptional: false;
53
+ };
54
+ newQuantity: {
55
+ type: import("@contractspec/lib.schema").FieldType<number, number>;
56
+ isOptional: false;
57
+ };
58
+ reason: {
59
+ type: import("@contractspec/lib.schema").FieldType<string, string>;
60
+ isOptional: false;
61
+ };
62
+ timestamp: {
63
+ type: import("@contractspec/lib.schema").FieldType<Date, string>;
64
+ isOptional: false;
65
+ };
70
66
  }>>;
71
- //#endregion
72
- export { InventoryUpdatedEvent, ProductCreatedEvent, ProductPublishedEvent };
73
67
  //# sourceMappingURL=product.event.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.event.d.ts","names":[],"sources":["../../src/product/product.event.ts"],"mappings":";;;;cAuCa,mBAAA,EAAmB,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAU9B,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;cAEW,qBAAA,EAAqB,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAUhC,yBAAA,CAAA,SAAA;;;;;;;;;;;;cAEW,qBAAA,EAAqB,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAUhC,yBAAA,CAAA,SAAA"}
1
+ {"version":3,"file":"product.event.d.ts","sourceRoot":"","sources":["../../src/product/product.event.ts"],"names":[],"mappings":"AAuCA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;GAU9B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;GAUhC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;GAUhC,CAAC"}