@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,84 @@
1
+ import { defineEvent } from "@contractspec/lib.contracts";
2
+ import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
3
+
4
+ //#region src/review/review.event.ts
5
+ const ReviewCreatedPayload = defineSchemaModel({
6
+ name: "ReviewCreatedEventPayload",
7
+ fields: {
8
+ reviewId: {
9
+ type: ScalarTypeEnum.String_unsecure(),
10
+ isOptional: false
11
+ },
12
+ productId: {
13
+ type: ScalarTypeEnum.String_unsecure(),
14
+ isOptional: true
15
+ },
16
+ storeId: {
17
+ type: ScalarTypeEnum.String_unsecure(),
18
+ isOptional: true
19
+ },
20
+ authorId: {
21
+ type: ScalarTypeEnum.String_unsecure(),
22
+ isOptional: false
23
+ },
24
+ rating: {
25
+ type: ScalarTypeEnum.Int_unsecure(),
26
+ isOptional: false
27
+ },
28
+ isVerifiedPurchase: {
29
+ type: ScalarTypeEnum.Boolean(),
30
+ isOptional: false
31
+ },
32
+ timestamp: {
33
+ type: ScalarTypeEnum.DateTime(),
34
+ isOptional: false
35
+ }
36
+ }
37
+ });
38
+ const ReviewRespondedPayload = defineSchemaModel({
39
+ name: "ReviewRespondedEventPayload",
40
+ fields: {
41
+ reviewId: {
42
+ type: ScalarTypeEnum.String_unsecure(),
43
+ isOptional: false
44
+ },
45
+ responseId: {
46
+ type: ScalarTypeEnum.String_unsecure(),
47
+ isOptional: false
48
+ },
49
+ authorId: {
50
+ type: ScalarTypeEnum.String_unsecure(),
51
+ isOptional: false
52
+ },
53
+ timestamp: {
54
+ type: ScalarTypeEnum.DateTime(),
55
+ isOptional: false
56
+ }
57
+ }
58
+ });
59
+ const ReviewCreatedEvent = defineEvent({
60
+ meta: {
61
+ key: "marketplace.review.created",
62
+ version: "1.0.0",
63
+ description: "A review has been created.",
64
+ stability: "experimental",
65
+ owners: ["@marketplace-team"],
66
+ tags: ["marketplace", "review"]
67
+ },
68
+ payload: ReviewCreatedPayload
69
+ });
70
+ const ReviewRespondedEvent = defineEvent({
71
+ meta: {
72
+ key: "marketplace.review.responded",
73
+ version: "1.0.0",
74
+ description: "A seller has responded to a review.",
75
+ stability: "experimental",
76
+ owners: ["@marketplace-team"],
77
+ tags: ["marketplace", "review"]
78
+ },
79
+ payload: ReviewRespondedPayload
80
+ });
81
+
82
+ //#endregion
83
+ export { ReviewCreatedEvent, ReviewRespondedEvent };
84
+ //# sourceMappingURL=review.event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review.event.js","names":[],"sources":["../../src/review/review.event.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\nconst ReviewCreatedPayload = defineSchemaModel({\n name: 'ReviewCreatedEventPayload',\n fields: {\n reviewId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n authorId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n rating: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n isVerifiedPurchase: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ReviewRespondedPayload = defineSchemaModel({\n name: 'ReviewRespondedEventPayload',\n fields: {\n reviewId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n responseId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n authorId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const ReviewCreatedEvent = defineEvent({\n meta: {\n key: 'marketplace.review.created',\n version: '1.0.0',\n description: 'A review has been created.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'review'],\n },\n payload: ReviewCreatedPayload,\n});\n\nexport const ReviewRespondedEvent = defineEvent({\n meta: {\n key: 'marketplace.review.responded',\n version: '1.0.0',\n description: 'A seller has responded to a review.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'review'],\n },\n payload: ReviewRespondedPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,uBAAuB,kBAAkB;CAC7C,MAAM;CACN,QAAQ;EACN,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACrE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,QAAQ;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EAClE,oBAAoB;GAAE,MAAM,eAAe,SAAS;GAAE,YAAY;GAAO;EACzE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,yBAAyB,kBAAkB;CAC/C,MAAM;CACN,QAAQ;EACN,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACzE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAa,qBAAqB,YAAY;CAC5C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,SAAS;EAChC;CACD,SAAS;CACV,CAAC;AAEF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,SAAS;EAChC;CACD,SAAS;CACV,CAAC"}
@@ -0,0 +1,237 @@
1
+ import * as _contractspec_lib_contracts28 from "@contractspec/lib.contracts";
2
+ import * as _contractspec_lib_schema387 from "@contractspec/lib.schema";
3
+
4
+ //#region src/review/review.operations.d.ts
5
+ /**
6
+ * Create a product/store review.
7
+ */
8
+ declare const CreateReviewContract: _contractspec_lib_contracts28.OperationSpec<_contractspec_lib_schema387.SchemaModel<{
9
+ productId: {
10
+ type: _contractspec_lib_schema387.FieldType<string, string>;
11
+ isOptional: true;
12
+ };
13
+ storeId: {
14
+ type: _contractspec_lib_schema387.FieldType<string, string>;
15
+ isOptional: true;
16
+ };
17
+ orderId: {
18
+ type: _contractspec_lib_schema387.FieldType<string, string>;
19
+ isOptional: true;
20
+ };
21
+ rating: {
22
+ type: _contractspec_lib_schema387.FieldType<number, number>;
23
+ isOptional: false;
24
+ };
25
+ title: {
26
+ type: _contractspec_lib_schema387.FieldType<string, string>;
27
+ isOptional: true;
28
+ };
29
+ content: {
30
+ type: _contractspec_lib_schema387.FieldType<string, string>;
31
+ isOptional: true;
32
+ };
33
+ }>, _contractspec_lib_schema387.SchemaModel<{
34
+ id: {
35
+ type: _contractspec_lib_schema387.FieldType<string, string>;
36
+ isOptional: false;
37
+ };
38
+ productId: {
39
+ type: _contractspec_lib_schema387.FieldType<string, string>;
40
+ isOptional: true;
41
+ };
42
+ storeId: {
43
+ type: _contractspec_lib_schema387.FieldType<string, string>;
44
+ isOptional: true;
45
+ };
46
+ authorId: {
47
+ type: _contractspec_lib_schema387.FieldType<string, string>;
48
+ isOptional: false;
49
+ };
50
+ rating: {
51
+ type: _contractspec_lib_schema387.FieldType<number, number>;
52
+ isOptional: false;
53
+ };
54
+ title: {
55
+ type: _contractspec_lib_schema387.FieldType<string, string>;
56
+ isOptional: true;
57
+ };
58
+ content: {
59
+ type: _contractspec_lib_schema387.FieldType<string, string>;
60
+ isOptional: true;
61
+ };
62
+ status: {
63
+ type: _contractspec_lib_schema387.EnumType<[string, string, string, string]>;
64
+ isOptional: false;
65
+ };
66
+ isVerifiedPurchase: {
67
+ type: _contractspec_lib_schema387.FieldType<boolean, boolean>;
68
+ isOptional: false;
69
+ };
70
+ helpfulCount: {
71
+ type: _contractspec_lib_schema387.FieldType<number, number>;
72
+ isOptional: false;
73
+ };
74
+ hasResponse: {
75
+ type: _contractspec_lib_schema387.FieldType<boolean, boolean>;
76
+ isOptional: false;
77
+ };
78
+ createdAt: {
79
+ type: _contractspec_lib_schema387.FieldType<Date, string>;
80
+ isOptional: false;
81
+ };
82
+ }>, {
83
+ key: string;
84
+ version: string;
85
+ when: string;
86
+ payload: _contractspec_lib_schema387.SchemaModel<{
87
+ id: {
88
+ type: _contractspec_lib_schema387.FieldType<string, string>;
89
+ isOptional: false;
90
+ };
91
+ productId: {
92
+ type: _contractspec_lib_schema387.FieldType<string, string>;
93
+ isOptional: true;
94
+ };
95
+ storeId: {
96
+ type: _contractspec_lib_schema387.FieldType<string, string>;
97
+ isOptional: true;
98
+ };
99
+ authorId: {
100
+ type: _contractspec_lib_schema387.FieldType<string, string>;
101
+ isOptional: false;
102
+ };
103
+ rating: {
104
+ type: _contractspec_lib_schema387.FieldType<number, number>;
105
+ isOptional: false;
106
+ };
107
+ title: {
108
+ type: _contractspec_lib_schema387.FieldType<string, string>;
109
+ isOptional: true;
110
+ };
111
+ content: {
112
+ type: _contractspec_lib_schema387.FieldType<string, string>;
113
+ isOptional: true;
114
+ };
115
+ status: {
116
+ type: _contractspec_lib_schema387.EnumType<[string, string, string, string]>;
117
+ isOptional: false;
118
+ };
119
+ isVerifiedPurchase: {
120
+ type: _contractspec_lib_schema387.FieldType<boolean, boolean>;
121
+ isOptional: false;
122
+ };
123
+ helpfulCount: {
124
+ type: _contractspec_lib_schema387.FieldType<number, number>;
125
+ isOptional: false;
126
+ };
127
+ hasResponse: {
128
+ type: _contractspec_lib_schema387.FieldType<boolean, boolean>;
129
+ isOptional: false;
130
+ };
131
+ createdAt: {
132
+ type: _contractspec_lib_schema387.FieldType<Date, string>;
133
+ isOptional: false;
134
+ };
135
+ }>;
136
+ }[]>;
137
+ /**
138
+ * List reviews with filters.
139
+ */
140
+ declare const ListReviewsContract: _contractspec_lib_contracts28.OperationSpec<_contractspec_lib_schema387.SchemaModel<{
141
+ productId: {
142
+ type: _contractspec_lib_schema387.FieldType<string, string>;
143
+ isOptional: true;
144
+ };
145
+ storeId: {
146
+ type: _contractspec_lib_schema387.FieldType<string, string>;
147
+ isOptional: true;
148
+ };
149
+ status: {
150
+ type: _contractspec_lib_schema387.EnumType<[string, string, string, string]>;
151
+ isOptional: true;
152
+ };
153
+ minRating: {
154
+ type: _contractspec_lib_schema387.FieldType<number, number>;
155
+ isOptional: true;
156
+ };
157
+ limit: {
158
+ type: _contractspec_lib_schema387.FieldType<number, number>;
159
+ isOptional: true;
160
+ defaultValue: number;
161
+ };
162
+ offset: {
163
+ type: _contractspec_lib_schema387.FieldType<number, number>;
164
+ isOptional: true;
165
+ defaultValue: number;
166
+ };
167
+ }>, _contractspec_lib_schema387.SchemaModel<{
168
+ reviews: {
169
+ type: _contractspec_lib_schema387.SchemaModel<{
170
+ id: {
171
+ type: _contractspec_lib_schema387.FieldType<string, string>;
172
+ isOptional: false;
173
+ };
174
+ productId: {
175
+ type: _contractspec_lib_schema387.FieldType<string, string>;
176
+ isOptional: true;
177
+ };
178
+ storeId: {
179
+ type: _contractspec_lib_schema387.FieldType<string, string>;
180
+ isOptional: true;
181
+ };
182
+ authorId: {
183
+ type: _contractspec_lib_schema387.FieldType<string, string>;
184
+ isOptional: false;
185
+ };
186
+ rating: {
187
+ type: _contractspec_lib_schema387.FieldType<number, number>;
188
+ isOptional: false;
189
+ };
190
+ title: {
191
+ type: _contractspec_lib_schema387.FieldType<string, string>;
192
+ isOptional: true;
193
+ };
194
+ content: {
195
+ type: _contractspec_lib_schema387.FieldType<string, string>;
196
+ isOptional: true;
197
+ };
198
+ status: {
199
+ type: _contractspec_lib_schema387.EnumType<[string, string, string, string]>;
200
+ isOptional: false;
201
+ };
202
+ isVerifiedPurchase: {
203
+ type: _contractspec_lib_schema387.FieldType<boolean, boolean>;
204
+ isOptional: false;
205
+ };
206
+ helpfulCount: {
207
+ type: _contractspec_lib_schema387.FieldType<number, number>;
208
+ isOptional: false;
209
+ };
210
+ hasResponse: {
211
+ type: _contractspec_lib_schema387.FieldType<boolean, boolean>;
212
+ isOptional: false;
213
+ };
214
+ createdAt: {
215
+ type: _contractspec_lib_schema387.FieldType<Date, string>;
216
+ isOptional: false;
217
+ };
218
+ }>;
219
+ isArray: true;
220
+ isOptional: false;
221
+ };
222
+ total: {
223
+ type: _contractspec_lib_schema387.FieldType<number, number>;
224
+ isOptional: false;
225
+ };
226
+ averageRating: {
227
+ type: _contractspec_lib_schema387.FieldType<number, number>;
228
+ isOptional: false;
229
+ };
230
+ ratingDistribution: {
231
+ type: _contractspec_lib_schema387.FieldType<unknown, unknown>;
232
+ isOptional: false;
233
+ };
234
+ }>, undefined>;
235
+ //#endregion
236
+ export { CreateReviewContract, ListReviewsContract };
237
+ //# sourceMappingURL=review.operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review.operations.d.ts","names":[],"sources":["../../src/review/review.operations.ts"],"sourcesContent":[],"mappings":";;;;;;;cAgBa,oDAAoB,0CAAA;EAApB,SAAA,EAAA;IAyCX,IAAA,EAAA,2BAAA,CAAA,SAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;EAzC+B,OAAA,EAAA;;;;;;;;;;;;;;;;;;UAAA,2BAAA,CAAA;;;;;;;;;;;EAAA,QAAA,EAAA;IA8CpB,IAAA,uCA8BX,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;IA9B8B,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;;;;;;;;;;;;EAAA,WAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAnB,mDAAmB,0CAAA;;UA8B9B,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA9B8B,2BAAA,CAAA"}
@@ -0,0 +1,106 @@
1
+ import { CreateReviewInputModel, ListReviewsInputModel, ListReviewsOutputModel, ReviewModel } from "./review.schema.js";
2
+ import { defineCommand, defineQuery } from "@contractspec/lib.contracts/operations";
3
+
4
+ //#region src/review/review.operations.ts
5
+ const OWNERS = ["@example.marketplace"];
6
+ /**
7
+ * Create a product/store review.
8
+ */
9
+ const CreateReviewContract = defineCommand({
10
+ meta: {
11
+ key: "marketplace.review.create",
12
+ version: "1.0.0",
13
+ stability: "stable",
14
+ owners: [...OWNERS],
15
+ tags: [
16
+ "marketplace",
17
+ "review",
18
+ "create"
19
+ ],
20
+ description: "Create a product/store review.",
21
+ goal: "Allow buyers to leave feedback.",
22
+ context: "Post-purchase."
23
+ },
24
+ io: {
25
+ input: CreateReviewInputModel,
26
+ output: ReviewModel
27
+ },
28
+ policy: { auth: "user" },
29
+ sideEffects: {
30
+ emits: [{
31
+ key: "marketplace.review.created",
32
+ version: "1.0.0",
33
+ when: "Review is created",
34
+ payload: ReviewModel
35
+ }],
36
+ audit: ["marketplace.review.created"]
37
+ },
38
+ acceptance: {
39
+ scenarios: [{
40
+ key: "create-review-happy-path",
41
+ given: ["User purchased product"],
42
+ when: ["User leaves a review"],
43
+ then: ["Review is created", "ReviewCreated event is emitted"]
44
+ }],
45
+ examples: [{
46
+ key: "create-5-star",
47
+ input: {
48
+ productId: "prod-456",
49
+ rating: 5,
50
+ comment: "Great product!"
51
+ },
52
+ output: {
53
+ id: "rev-789",
54
+ status: "published"
55
+ }
56
+ }]
57
+ }
58
+ });
59
+ /**
60
+ * List reviews with filters.
61
+ */
62
+ const ListReviewsContract = defineQuery({
63
+ meta: {
64
+ key: "marketplace.review.list",
65
+ version: "1.0.0",
66
+ stability: "stable",
67
+ owners: [...OWNERS],
68
+ tags: [
69
+ "marketplace",
70
+ "review",
71
+ "list"
72
+ ],
73
+ description: "List reviews with filters.",
74
+ goal: "Display product/store reviews.",
75
+ context: "Product page, store page."
76
+ },
77
+ io: {
78
+ input: ListReviewsInputModel,
79
+ output: ListReviewsOutputModel
80
+ },
81
+ policy: { auth: "anonymous" },
82
+ acceptance: {
83
+ scenarios: [{
84
+ key: "list-reviews-happy-path",
85
+ given: ["Product has reviews"],
86
+ when: ["User views reviews"],
87
+ then: ["List of reviews is returned"]
88
+ }],
89
+ examples: [{
90
+ key: "list-product-reviews",
91
+ input: {
92
+ productId: "prod-456",
93
+ limit: 10
94
+ },
95
+ output: {
96
+ items: [],
97
+ total: 10,
98
+ hasMore: false
99
+ }
100
+ }]
101
+ }
102
+ });
103
+
104
+ //#endregion
105
+ export { CreateReviewContract, ListReviewsContract };
106
+ //# sourceMappingURL=review.operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review.operations.js","names":[],"sources":["../../src/review/review.operations.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport {\n CreateReviewInputModel,\n ListReviewsInputModel,\n ListReviewsOutputModel,\n ReviewModel,\n} from './review.schema';\n\nconst OWNERS = ['@example.marketplace'] as const;\n\n/**\n * Create a product/store review.\n */\nexport const CreateReviewContract = defineCommand({\n meta: {\n key: 'marketplace.review.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'review', 'create'],\n description: 'Create a product/store review.',\n goal: 'Allow buyers to leave feedback.',\n context: 'Post-purchase.',\n },\n io: { input: CreateReviewInputModel, output: ReviewModel },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'marketplace.review.created',\n version: '1.0.0',\n when: 'Review is created',\n payload: ReviewModel,\n },\n ],\n audit: ['marketplace.review.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-review-happy-path',\n given: ['User purchased product'],\n when: ['User leaves a review'],\n then: ['Review is created', 'ReviewCreated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'create-5-star',\n input: { productId: 'prod-456', rating: 5, comment: 'Great product!' },\n output: { id: 'rev-789', status: 'published' },\n },\n ],\n },\n});\n\n/**\n * List reviews with filters.\n */\nexport const ListReviewsContract = defineQuery({\n meta: {\n key: 'marketplace.review.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'review', 'list'],\n description: 'List reviews with filters.',\n goal: 'Display product/store reviews.',\n context: 'Product page, store page.',\n },\n io: { input: ListReviewsInputModel, output: ListReviewsOutputModel },\n policy: { auth: 'anonymous' },\n acceptance: {\n scenarios: [\n {\n key: 'list-reviews-happy-path',\n given: ['Product has reviews'],\n when: ['User views reviews'],\n then: ['List of reviews is returned'],\n },\n ],\n examples: [\n {\n key: 'list-product-reviews',\n input: { productId: 'prod-456', limit: 10 },\n output: { items: [], total: 10, hasMore: false },\n },\n ],\n },\n});\n"],"mappings":";;;;AAWA,MAAM,SAAS,CAAC,uBAAuB;;;;AAKvC,MAAa,uBAAuB,cAAc;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAU;GAAS;EACzC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAwB,QAAQ;EAAa;CAC1D,QAAQ,EAAE,MAAM,QAAQ;CACxB,aAAa;EACX,OAAO,CACL;GACE,KAAK;GACL,SAAS;GACT,MAAM;GACN,SAAS;GACV,CACF;EACD,OAAO,CAAC,6BAA6B;EACtC;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,yBAAyB;GACjC,MAAM,CAAC,uBAAuB;GAC9B,MAAM,CAAC,qBAAqB,iCAAiC;GAC9D,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,WAAW;IAAY,QAAQ;IAAG,SAAS;IAAkB;GACtE,QAAQ;IAAE,IAAI;IAAW,QAAQ;IAAa;GAC/C,CACF;EACF;CACF,CAAC;;;;AAKF,MAAa,sBAAsB,YAAY;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAU;GAAO;EACvC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAuB,QAAQ;EAAwB;CACpE,QAAQ,EAAE,MAAM,aAAa;CAC7B,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,sBAAsB;GAC9B,MAAM,CAAC,qBAAqB;GAC5B,MAAM,CAAC,8BAA8B;GACtC,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,WAAW;IAAY,OAAO;IAAI;GAC3C,QAAQ;IAAE,OAAO,EAAE;IAAE,OAAO;IAAI,SAAS;IAAO;GACjD,CACF;EACF;CACF,CAAC"}
@@ -0,0 +1,8 @@
1
+ import * as _contractspec_lib_contracts30 from "@contractspec/lib.contracts";
2
+
3
+ //#region src/review/review.presentation.d.ts
4
+ declare const ReviewListPresentation: _contractspec_lib_contracts30.PresentationSpec;
5
+ declare const ReviewFormPresentation: _contractspec_lib_contracts30.PresentationSpec;
6
+ //#endregion
7
+ export { ReviewFormPresentation, ReviewListPresentation };
8
+ //# sourceMappingURL=review.presentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review.presentation.d.ts","names":[],"sources":["../../src/review/review.presentation.ts"],"sourcesContent":[],"mappings":";;;cAGa,wBAuBX,6BAAA,CAvBiC;cAyBtB,wBAuBX,6BAAA,CAvBiC"}
@@ -0,0 +1,60 @@
1
+ import { ReviewModel } from "./review.schema.js";
2
+ import { StabilityEnum, definePresentation } from "@contractspec/lib.contracts";
3
+
4
+ //#region src/review/review.presentation.ts
5
+ const ReviewListPresentation = definePresentation({
6
+ meta: {
7
+ key: "marketplace.review.list",
8
+ version: "1.0.0",
9
+ title: "Review List",
10
+ description: "List of product reviews",
11
+ domain: "marketplace",
12
+ owners: ["@marketplace-team"],
13
+ tags: [
14
+ "marketplace",
15
+ "review",
16
+ "list"
17
+ ],
18
+ stability: StabilityEnum.Experimental,
19
+ goal: "Show users reviews and ratings for a product.",
20
+ context: "Displayed on the product detail page."
21
+ },
22
+ source: {
23
+ type: "component",
24
+ framework: "react",
25
+ componentKey: "ReviewList",
26
+ props: ReviewModel
27
+ },
28
+ targets: ["react", "markdown"],
29
+ policy: { flags: ["marketplace.reviews.enabled"] }
30
+ });
31
+ const ReviewFormPresentation = definePresentation({
32
+ meta: {
33
+ key: "marketplace.review.form",
34
+ version: "1.0.0",
35
+ title: "Review Form",
36
+ description: "Form for submitting product reviews",
37
+ domain: "marketplace",
38
+ owners: ["@marketplace-team"],
39
+ tags: [
40
+ "marketplace",
41
+ "review",
42
+ "form"
43
+ ],
44
+ stability: StabilityEnum.Experimental,
45
+ goal: "Enable users to submit their feedback and rating for a purchase.",
46
+ context: "Used in the user order history or product page."
47
+ },
48
+ source: {
49
+ type: "component",
50
+ framework: "react",
51
+ componentKey: "ReviewForm",
52
+ props: ReviewModel
53
+ },
54
+ targets: ["react"],
55
+ policy: { flags: ["marketplace.reviews.enabled"] }
56
+ });
57
+
58
+ //#endregion
59
+ export { ReviewFormPresentation, ReviewListPresentation };
60
+ //# sourceMappingURL=review.presentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review.presentation.js","names":[],"sources":["../../src/review/review.presentation.ts"],"sourcesContent":["import { definePresentation, StabilityEnum } from '@contractspec/lib.contracts';\nimport { ReviewModel } from './review.schema';\n\nexport const ReviewListPresentation = definePresentation({\n meta: {\n key: 'marketplace.review.list',\n version: '1.0.0',\n title: 'Review List',\n description: 'List of product reviews',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'review', 'list'],\n stability: StabilityEnum.Experimental,\n goal: 'Show users reviews and ratings for a product.',\n context: 'Displayed on the product detail page.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ReviewList',\n props: ReviewModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.reviews.enabled'],\n },\n});\n\nexport const ReviewFormPresentation = definePresentation({\n meta: {\n key: 'marketplace.review.form',\n version: '1.0.0',\n title: 'Review Form',\n description: 'Form for submitting product reviews',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'review', 'form'],\n stability: StabilityEnum.Experimental,\n goal: 'Enable users to submit their feedback and rating for a purchase.',\n context: 'Used in the user order history or product page.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ReviewForm',\n props: ReviewModel,\n },\n targets: ['react'],\n policy: {\n flags: ['marketplace.reviews.enabled'],\n },\n});\n"],"mappings":";;;;AAGA,MAAa,yBAAyB,mBAAmB;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAU;GAAO;EACvC,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,8BAA8B,EACvC;CACF,CAAC;AAEF,MAAa,yBAAyB,mBAAmB;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAU;GAAO;EACvC,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,8BAA8B,EACvC;CACF,CAAC"}