@contractspec/example.marketplace 3.7.6 → 3.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -131
- package/dist/browser/entities/index.js +470 -470
- package/dist/browser/index.js +1257 -1019
- package/dist/browser/marketplace.feature.js +175 -0
- package/dist/browser/order/index.js +155 -155
- package/dist/browser/order/order.event.js +1 -1
- package/dist/browser/payout/index.js +71 -71
- package/dist/browser/payout/payout.event.js +1 -1
- package/dist/browser/product/index.js +104 -104
- package/dist/browser/product/product.event.js +1 -1
- package/dist/browser/review/index.js +75 -75
- package/dist/browser/review/review.event.js +1 -1
- package/dist/browser/store/index.js +68 -68
- package/dist/browser/store/store.event.js +1 -1
- package/dist/browser/ui/MarketplaceDashboard.js +328 -110
- package/dist/browser/ui/MarketplaceDashboard.visualizations.js +216 -0
- package/dist/browser/ui/hooks/index.js +1 -1
- package/dist/browser/ui/hooks/useMarketplaceData.js +1 -1
- package/dist/browser/ui/index.js +590 -359
- package/dist/browser/ui/renderers/index.js +190 -4
- package/dist/browser/ui/renderers/marketplace.markdown.js +190 -4
- package/dist/browser/visualizations/catalog.js +126 -0
- package/dist/browser/visualizations/index.js +183 -0
- package/dist/browser/visualizations/selectors.js +177 -0
- package/dist/entities/index.d.ts +110 -110
- package/dist/entities/index.js +470 -470
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1257 -1019
- package/dist/marketplace.feature.js +175 -0
- package/dist/node/entities/index.js +470 -470
- package/dist/node/index.js +1257 -1019
- package/dist/node/marketplace.feature.js +175 -0
- package/dist/node/order/index.js +155 -155
- package/dist/node/order/order.event.js +1 -1
- package/dist/node/payout/index.js +71 -71
- package/dist/node/payout/payout.event.js +1 -1
- package/dist/node/product/index.js +104 -104
- package/dist/node/product/product.event.js +1 -1
- package/dist/node/review/index.js +75 -75
- package/dist/node/review/review.event.js +1 -1
- package/dist/node/store/index.js +68 -68
- package/dist/node/store/store.event.js +1 -1
- package/dist/node/ui/MarketplaceDashboard.js +328 -110
- package/dist/node/ui/MarketplaceDashboard.visualizations.js +216 -0
- package/dist/node/ui/hooks/index.js +1 -1
- package/dist/node/ui/hooks/useMarketplaceData.js +1 -1
- package/dist/node/ui/index.js +590 -359
- package/dist/node/ui/renderers/index.js +190 -4
- package/dist/node/ui/renderers/marketplace.markdown.js +190 -4
- package/dist/node/visualizations/catalog.js +126 -0
- package/dist/node/visualizations/index.js +183 -0
- package/dist/node/visualizations/selectors.js +177 -0
- package/dist/order/index.d.ts +2 -2
- package/dist/order/index.js +155 -155
- package/dist/order/order.event.js +1 -1
- package/dist/payout/index.d.ts +2 -2
- package/dist/payout/index.js +71 -71
- package/dist/payout/payout.event.js +1 -1
- package/dist/product/index.d.ts +2 -2
- package/dist/product/index.js +104 -104
- package/dist/product/product.event.js +1 -1
- package/dist/review/index.d.ts +2 -2
- package/dist/review/index.js +75 -75
- package/dist/review/review.event.js +1 -1
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +68 -68
- package/dist/store/store.event.js +1 -1
- package/dist/ui/MarketplaceDashboard.js +328 -110
- package/dist/ui/MarketplaceDashboard.visualizations.d.ts +5 -0
- package/dist/ui/MarketplaceDashboard.visualizations.js +217 -0
- package/dist/ui/hooks/index.d.ts +1 -1
- package/dist/ui/hooks/index.js +1 -1
- package/dist/ui/hooks/useMarketplaceData.js +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +590 -359
- package/dist/ui/renderers/index.d.ts +1 -1
- package/dist/ui/renderers/index.js +190 -4
- package/dist/ui/renderers/marketplace.markdown.js +190 -4
- package/dist/visualizations/catalog.d.ts +10 -0
- package/dist/visualizations/catalog.js +127 -0
- package/dist/visualizations/index.d.ts +2 -0
- package/dist/visualizations/index.js +184 -0
- package/dist/visualizations/selectors.d.ts +11 -0
- package/dist/visualizations/selectors.js +178 -0
- package/dist/visualizations/selectors.test.d.ts +1 -0
- package/package.json +66 -10
|
@@ -8,50 +8,102 @@ var PayoutStatusEnum = defineEnum("PayoutStatus", [
|
|
|
8
8
|
"CANCELLED"
|
|
9
9
|
]);
|
|
10
10
|
|
|
11
|
-
// src/payout/payout.
|
|
11
|
+
// src/payout/payout.event.ts
|
|
12
|
+
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
12
13
|
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
13
|
-
var
|
|
14
|
-
name: "
|
|
15
|
-
description: "A payout to seller",
|
|
14
|
+
var PayoutCreatedPayload = defineSchemaModel({
|
|
15
|
+
name: "PayoutCreatedEventPayload",
|
|
16
16
|
fields: {
|
|
17
|
-
|
|
17
|
+
payoutId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
18
18
|
payoutNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
19
19
|
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
20
|
-
status: { type: PayoutStatusEnum, isOptional: false },
|
|
21
|
-
grossAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
22
|
-
platformFees: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
23
20
|
netAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
24
21
|
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
25
|
-
periodStart: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
26
|
-
periodEnd: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
27
22
|
orderCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
28
|
-
|
|
29
|
-
paidAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
23
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
30
24
|
}
|
|
31
25
|
});
|
|
32
|
-
var
|
|
33
|
-
name: "
|
|
26
|
+
var PayoutPaidPayload = defineSchemaModel({
|
|
27
|
+
name: "PayoutPaidEventPayload",
|
|
34
28
|
fields: {
|
|
29
|
+
payoutId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
30
|
+
payoutNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
35
31
|
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
32
|
+
netAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
33
|
+
paymentReference: {
|
|
34
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
35
|
+
isOptional: true
|
|
36
|
+
},
|
|
37
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
var PayoutCreatedEvent = defineEvent({
|
|
41
|
+
meta: {
|
|
42
|
+
key: "marketplace.payout.created",
|
|
43
|
+
version: "1.0.0",
|
|
44
|
+
description: "A payout has been created.",
|
|
45
|
+
stability: "experimental",
|
|
46
|
+
owners: ["@marketplace-team"],
|
|
47
|
+
tags: ["marketplace", "payout"]
|
|
48
|
+
},
|
|
49
|
+
payload: PayoutCreatedPayload
|
|
50
|
+
});
|
|
51
|
+
var PayoutPaidEvent = defineEvent({
|
|
52
|
+
meta: {
|
|
53
|
+
key: "marketplace.payout.paid",
|
|
54
|
+
version: "1.0.0",
|
|
55
|
+
description: "A payout has been sent.",
|
|
56
|
+
stability: "experimental",
|
|
57
|
+
owners: ["@marketplace-team"],
|
|
58
|
+
tags: ["marketplace", "payout"]
|
|
59
|
+
},
|
|
60
|
+
payload: PayoutPaidPayload
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// src/payout/payout.schema.ts
|
|
64
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
65
|
+
var PayoutModel = defineSchemaModel2({
|
|
66
|
+
name: "PayoutModel",
|
|
67
|
+
description: "A payout to seller",
|
|
68
|
+
fields: {
|
|
69
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
70
|
+
payoutNumber: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
71
|
+
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
72
|
+
status: { type: PayoutStatusEnum, isOptional: false },
|
|
73
|
+
grossAmount: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
|
|
74
|
+
platformFees: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
|
|
75
|
+
netAmount: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
|
|
76
|
+
currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
77
|
+
periodStart: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
78
|
+
periodEnd: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
79
|
+
orderCount: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
80
|
+
createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
81
|
+
paidAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true }
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
var ListPayoutsInputModel = defineSchemaModel2({
|
|
85
|
+
name: "ListPayoutsInput",
|
|
86
|
+
fields: {
|
|
87
|
+
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
36
88
|
status: { type: PayoutStatusEnum, isOptional: true },
|
|
37
89
|
limit: {
|
|
38
|
-
type:
|
|
90
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
39
91
|
isOptional: true,
|
|
40
92
|
defaultValue: 20
|
|
41
93
|
},
|
|
42
94
|
offset: {
|
|
43
|
-
type:
|
|
95
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
44
96
|
isOptional: true,
|
|
45
97
|
defaultValue: 0
|
|
46
98
|
}
|
|
47
99
|
}
|
|
48
100
|
});
|
|
49
|
-
var ListPayoutsOutputModel =
|
|
101
|
+
var ListPayoutsOutputModel = defineSchemaModel2({
|
|
50
102
|
name: "ListPayoutsOutput",
|
|
51
103
|
fields: {
|
|
52
104
|
payouts: { type: PayoutModel, isArray: true, isOptional: false },
|
|
53
|
-
total: { type:
|
|
54
|
-
totalPending: { type:
|
|
105
|
+
total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
106
|
+
totalPending: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false }
|
|
55
107
|
}
|
|
56
108
|
});
|
|
57
109
|
|
|
@@ -89,58 +141,6 @@ var ListPayoutsContract = defineQuery({
|
|
|
89
141
|
]
|
|
90
142
|
}
|
|
91
143
|
});
|
|
92
|
-
|
|
93
|
-
// src/payout/payout.event.ts
|
|
94
|
-
import { ScalarTypeEnum as ScalarTypeEnum2, defineSchemaModel as defineSchemaModel2 } from "@contractspec/lib.schema";
|
|
95
|
-
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
96
|
-
var PayoutCreatedPayload = defineSchemaModel2({
|
|
97
|
-
name: "PayoutCreatedEventPayload",
|
|
98
|
-
fields: {
|
|
99
|
-
payoutId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
100
|
-
payoutNumber: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
101
|
-
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
102
|
-
netAmount: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
|
|
103
|
-
currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
104
|
-
orderCount: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
105
|
-
timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
var PayoutPaidPayload = defineSchemaModel2({
|
|
109
|
-
name: "PayoutPaidEventPayload",
|
|
110
|
-
fields: {
|
|
111
|
-
payoutId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
112
|
-
payoutNumber: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
113
|
-
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
114
|
-
netAmount: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
|
|
115
|
-
paymentReference: {
|
|
116
|
-
type: ScalarTypeEnum2.String_unsecure(),
|
|
117
|
-
isOptional: true
|
|
118
|
-
},
|
|
119
|
-
timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
var PayoutCreatedEvent = defineEvent({
|
|
123
|
-
meta: {
|
|
124
|
-
key: "marketplace.payout.created",
|
|
125
|
-
version: "1.0.0",
|
|
126
|
-
description: "A payout has been created.",
|
|
127
|
-
stability: "experimental",
|
|
128
|
-
owners: ["@marketplace-team"],
|
|
129
|
-
tags: ["marketplace", "payout"]
|
|
130
|
-
},
|
|
131
|
-
payload: PayoutCreatedPayload
|
|
132
|
-
});
|
|
133
|
-
var PayoutPaidEvent = defineEvent({
|
|
134
|
-
meta: {
|
|
135
|
-
key: "marketplace.payout.paid",
|
|
136
|
-
version: "1.0.0",
|
|
137
|
-
description: "A payout has been sent.",
|
|
138
|
-
stability: "experimental",
|
|
139
|
-
owners: ["@marketplace-team"],
|
|
140
|
-
tags: ["marketplace", "payout"]
|
|
141
|
-
},
|
|
142
|
-
payload: PayoutPaidPayload
|
|
143
|
-
});
|
|
144
144
|
export {
|
|
145
145
|
PayoutStatusEnum,
|
|
146
146
|
PayoutPaidEvent,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/payout/payout.event.ts
|
|
2
|
-
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
3
2
|
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
3
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
4
4
|
var PayoutCreatedPayload = defineSchemaModel({
|
|
5
5
|
name: "PayoutCreatedEventPayload",
|
|
6
6
|
fields: {
|
|
@@ -9,71 +9,141 @@ var ProductStatusEnum = defineEnum("ProductStatus", [
|
|
|
9
9
|
"REJECTED"
|
|
10
10
|
]);
|
|
11
11
|
|
|
12
|
-
// src/product/product.
|
|
12
|
+
// src/product/product.event.ts
|
|
13
|
+
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
13
14
|
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
14
|
-
var
|
|
15
|
-
name: "
|
|
16
|
-
description: "A product listing",
|
|
15
|
+
var ProductCreatedPayload = defineSchemaModel({
|
|
16
|
+
name: "ProductCreatedEventPayload",
|
|
17
17
|
fields: {
|
|
18
|
-
|
|
18
|
+
productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
19
19
|
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
20
20
|
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
21
|
-
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
22
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
23
|
-
status: { type: ProductStatusEnum, isOptional: false },
|
|
24
21
|
price: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
25
22
|
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
var ProductPublishedPayload = defineSchemaModel({
|
|
27
|
+
name: "ProductPublishedEventPayload",
|
|
28
|
+
fields: {
|
|
29
|
+
productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
30
|
+
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
31
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var InventoryUpdatedPayload = defineSchemaModel({
|
|
35
|
+
name: "InventoryUpdatedEventPayload",
|
|
36
|
+
fields: {
|
|
37
|
+
productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
38
|
+
variantId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
39
|
+
previousQuantity: {
|
|
40
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
41
|
+
isOptional: false
|
|
42
|
+
},
|
|
43
|
+
newQuantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
44
|
+
reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
45
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var ProductCreatedEvent = defineEvent({
|
|
49
|
+
meta: {
|
|
50
|
+
key: "marketplace.product.created",
|
|
51
|
+
version: "1.0.0",
|
|
52
|
+
description: "A new product has been created.",
|
|
53
|
+
stability: "experimental",
|
|
54
|
+
owners: ["@marketplace-team"],
|
|
55
|
+
tags: ["marketplace", "product"]
|
|
56
|
+
},
|
|
57
|
+
payload: ProductCreatedPayload
|
|
58
|
+
});
|
|
59
|
+
var ProductPublishedEvent = defineEvent({
|
|
60
|
+
meta: {
|
|
61
|
+
key: "marketplace.product.published",
|
|
62
|
+
version: "1.0.0",
|
|
63
|
+
description: "A product has been published.",
|
|
64
|
+
stability: "experimental",
|
|
65
|
+
owners: ["@marketplace-team"],
|
|
66
|
+
tags: ["marketplace", "product"]
|
|
67
|
+
},
|
|
68
|
+
payload: ProductPublishedPayload
|
|
69
|
+
});
|
|
70
|
+
var InventoryUpdatedEvent = defineEvent({
|
|
71
|
+
meta: {
|
|
72
|
+
key: "marketplace.inventory.updated",
|
|
73
|
+
version: "1.0.0",
|
|
74
|
+
description: "Product inventory has been updated.",
|
|
75
|
+
stability: "experimental",
|
|
76
|
+
owners: ["@marketplace-team"],
|
|
77
|
+
tags: ["marketplace", "product", "inventory"]
|
|
78
|
+
},
|
|
79
|
+
payload: InventoryUpdatedPayload
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// src/product/product.schema.ts
|
|
83
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
84
|
+
var ProductModel = defineSchemaModel2({
|
|
85
|
+
name: "ProductModel",
|
|
86
|
+
description: "A product listing",
|
|
87
|
+
fields: {
|
|
88
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
89
|
+
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
90
|
+
name: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
91
|
+
slug: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
92
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
93
|
+
status: { type: ProductStatusEnum, isOptional: false },
|
|
94
|
+
price: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
|
|
95
|
+
currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
96
|
+
quantity: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
97
|
+
categoryId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
28
98
|
primaryImageId: {
|
|
29
|
-
type:
|
|
99
|
+
type: ScalarTypeEnum2.String_unsecure(),
|
|
30
100
|
isOptional: true
|
|
31
101
|
},
|
|
32
|
-
averageRating: { type:
|
|
33
|
-
totalSold: { type:
|
|
34
|
-
createdAt: { type:
|
|
102
|
+
averageRating: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
|
|
103
|
+
totalSold: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
104
|
+
createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
35
105
|
}
|
|
36
106
|
});
|
|
37
|
-
var CreateProductInputModel =
|
|
107
|
+
var CreateProductInputModel = defineSchemaModel2({
|
|
38
108
|
name: "CreateProductInput",
|
|
39
109
|
fields: {
|
|
40
|
-
storeId: { type:
|
|
41
|
-
name: { type:
|
|
42
|
-
slug: { type:
|
|
43
|
-
description: { type:
|
|
44
|
-
price: { type:
|
|
45
|
-
currency: { type:
|
|
46
|
-
quantity: { type:
|
|
47
|
-
categoryId: { type:
|
|
48
|
-
sku: { type:
|
|
110
|
+
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
111
|
+
name: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
112
|
+
slug: { type: ScalarTypeEnum2.NonEmptyString(), isOptional: false },
|
|
113
|
+
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
114
|
+
price: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
|
|
115
|
+
currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
116
|
+
quantity: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
117
|
+
categoryId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
118
|
+
sku: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
|
|
49
119
|
}
|
|
50
120
|
});
|
|
51
|
-
var ListProductsInputModel =
|
|
121
|
+
var ListProductsInputModel = defineSchemaModel2({
|
|
52
122
|
name: "ListProductsInput",
|
|
53
123
|
fields: {
|
|
54
|
-
storeId: { type:
|
|
55
|
-
categoryId: { type:
|
|
124
|
+
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
125
|
+
categoryId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
56
126
|
status: { type: ProductStatusEnum, isOptional: true },
|
|
57
|
-
search: { type:
|
|
58
|
-
minPrice: { type:
|
|
59
|
-
maxPrice: { type:
|
|
127
|
+
search: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
128
|
+
minPrice: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: true },
|
|
129
|
+
maxPrice: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: true },
|
|
60
130
|
limit: {
|
|
61
|
-
type:
|
|
131
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
62
132
|
isOptional: true,
|
|
63
133
|
defaultValue: 20
|
|
64
134
|
},
|
|
65
135
|
offset: {
|
|
66
|
-
type:
|
|
136
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
67
137
|
isOptional: true,
|
|
68
138
|
defaultValue: 0
|
|
69
139
|
}
|
|
70
140
|
}
|
|
71
141
|
});
|
|
72
|
-
var ListProductsOutputModel =
|
|
142
|
+
var ListProductsOutputModel = defineSchemaModel2({
|
|
73
143
|
name: "ListProductsOutput",
|
|
74
144
|
fields: {
|
|
75
145
|
products: { type: ProductModel, isArray: true, isOptional: false },
|
|
76
|
-
total: { type:
|
|
146
|
+
total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false }
|
|
77
147
|
}
|
|
78
148
|
});
|
|
79
149
|
|
|
@@ -165,76 +235,6 @@ var ListProductsContract = defineQuery({
|
|
|
165
235
|
]
|
|
166
236
|
}
|
|
167
237
|
});
|
|
168
|
-
|
|
169
|
-
// src/product/product.event.ts
|
|
170
|
-
import { ScalarTypeEnum as ScalarTypeEnum2, defineSchemaModel as defineSchemaModel2 } from "@contractspec/lib.schema";
|
|
171
|
-
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
172
|
-
var ProductCreatedPayload = defineSchemaModel2({
|
|
173
|
-
name: "ProductCreatedEventPayload",
|
|
174
|
-
fields: {
|
|
175
|
-
productId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
176
|
-
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
177
|
-
name: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
178
|
-
price: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
|
|
179
|
-
currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
180
|
-
timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
var ProductPublishedPayload = defineSchemaModel2({
|
|
184
|
-
name: "ProductPublishedEventPayload",
|
|
185
|
-
fields: {
|
|
186
|
-
productId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
187
|
-
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
188
|
-
timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
var InventoryUpdatedPayload = defineSchemaModel2({
|
|
192
|
-
name: "InventoryUpdatedEventPayload",
|
|
193
|
-
fields: {
|
|
194
|
-
productId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
195
|
-
variantId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
196
|
-
previousQuantity: {
|
|
197
|
-
type: ScalarTypeEnum2.Int_unsecure(),
|
|
198
|
-
isOptional: false
|
|
199
|
-
},
|
|
200
|
-
newQuantity: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
201
|
-
reason: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
202
|
-
timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
var ProductCreatedEvent = defineEvent({
|
|
206
|
-
meta: {
|
|
207
|
-
key: "marketplace.product.created",
|
|
208
|
-
version: "1.0.0",
|
|
209
|
-
description: "A new product has been created.",
|
|
210
|
-
stability: "experimental",
|
|
211
|
-
owners: ["@marketplace-team"],
|
|
212
|
-
tags: ["marketplace", "product"]
|
|
213
|
-
},
|
|
214
|
-
payload: ProductCreatedPayload
|
|
215
|
-
});
|
|
216
|
-
var ProductPublishedEvent = defineEvent({
|
|
217
|
-
meta: {
|
|
218
|
-
key: "marketplace.product.published",
|
|
219
|
-
version: "1.0.0",
|
|
220
|
-
description: "A product has been published.",
|
|
221
|
-
stability: "experimental",
|
|
222
|
-
owners: ["@marketplace-team"],
|
|
223
|
-
tags: ["marketplace", "product"]
|
|
224
|
-
},
|
|
225
|
-
payload: ProductPublishedPayload
|
|
226
|
-
});
|
|
227
|
-
var InventoryUpdatedEvent = defineEvent({
|
|
228
|
-
meta: {
|
|
229
|
-
key: "marketplace.inventory.updated",
|
|
230
|
-
version: "1.0.0",
|
|
231
|
-
description: "Product inventory has been updated.",
|
|
232
|
-
stability: "experimental",
|
|
233
|
-
owners: ["@marketplace-team"],
|
|
234
|
-
tags: ["marketplace", "product", "inventory"]
|
|
235
|
-
},
|
|
236
|
-
payload: InventoryUpdatedPayload
|
|
237
|
-
});
|
|
238
238
|
export {
|
|
239
239
|
ProductStatusEnum,
|
|
240
240
|
ProductPublishedEvent,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/product/product.event.ts
|
|
2
|
-
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
3
2
|
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
3
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
4
4
|
var ProductCreatedPayload = defineSchemaModel({
|
|
5
5
|
name: "ProductCreatedEventPayload",
|
|
6
6
|
fields: {
|
|
@@ -7,63 +7,110 @@ var ReviewStatusEnum = defineEnum("ReviewStatus", [
|
|
|
7
7
|
"FLAGGED"
|
|
8
8
|
]);
|
|
9
9
|
|
|
10
|
-
// src/review/review.
|
|
10
|
+
// src/review/review.event.ts
|
|
11
|
+
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
11
12
|
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
12
|
-
var
|
|
13
|
-
name: "
|
|
14
|
-
description: "A customer review",
|
|
13
|
+
var ReviewCreatedPayload = defineSchemaModel({
|
|
14
|
+
name: "ReviewCreatedEventPayload",
|
|
15
15
|
fields: {
|
|
16
|
-
|
|
16
|
+
reviewId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
17
17
|
productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
18
18
|
storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
19
19
|
authorId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
20
20
|
rating: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
21
|
-
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
22
|
-
content: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
23
|
-
status: { type: ReviewStatusEnum, isOptional: false },
|
|
24
21
|
isVerifiedPurchase: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
var ReviewRespondedPayload = defineSchemaModel({
|
|
26
|
+
name: "ReviewRespondedEventPayload",
|
|
27
|
+
fields: {
|
|
28
|
+
reviewId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
29
|
+
responseId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
30
|
+
authorId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
31
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var ReviewCreatedEvent = defineEvent({
|
|
35
|
+
meta: {
|
|
36
|
+
key: "marketplace.review.created",
|
|
37
|
+
version: "1.0.0",
|
|
38
|
+
description: "A review has been created.",
|
|
39
|
+
stability: "experimental",
|
|
40
|
+
owners: ["@marketplace-team"],
|
|
41
|
+
tags: ["marketplace", "review"]
|
|
42
|
+
},
|
|
43
|
+
payload: ReviewCreatedPayload
|
|
44
|
+
});
|
|
45
|
+
var ReviewRespondedEvent = defineEvent({
|
|
46
|
+
meta: {
|
|
47
|
+
key: "marketplace.review.responded",
|
|
48
|
+
version: "1.0.0",
|
|
49
|
+
description: "A seller has responded to a review.",
|
|
50
|
+
stability: "experimental",
|
|
51
|
+
owners: ["@marketplace-team"],
|
|
52
|
+
tags: ["marketplace", "review"]
|
|
53
|
+
},
|
|
54
|
+
payload: ReviewRespondedPayload
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// src/review/review.schema.ts
|
|
58
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
59
|
+
var ReviewModel = defineSchemaModel2({
|
|
60
|
+
name: "ReviewModel",
|
|
61
|
+
description: "A customer review",
|
|
62
|
+
fields: {
|
|
63
|
+
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
64
|
+
productId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
65
|
+
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
66
|
+
authorId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
67
|
+
rating: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
68
|
+
title: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
69
|
+
content: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
70
|
+
status: { type: ReviewStatusEnum, isOptional: false },
|
|
71
|
+
isVerifiedPurchase: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
|
|
72
|
+
helpfulCount: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
73
|
+
hasResponse: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
|
|
74
|
+
createdAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
28
75
|
}
|
|
29
76
|
});
|
|
30
|
-
var CreateReviewInputModel =
|
|
77
|
+
var CreateReviewInputModel = defineSchemaModel2({
|
|
31
78
|
name: "CreateReviewInput",
|
|
32
79
|
fields: {
|
|
33
|
-
productId: { type:
|
|
34
|
-
storeId: { type:
|
|
35
|
-
orderId: { type:
|
|
36
|
-
rating: { type:
|
|
37
|
-
title: { type:
|
|
38
|
-
content: { type:
|
|
80
|
+
productId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
81
|
+
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
82
|
+
orderId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
83
|
+
rating: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
84
|
+
title: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
85
|
+
content: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
|
|
39
86
|
}
|
|
40
87
|
});
|
|
41
|
-
var ListReviewsInputModel =
|
|
88
|
+
var ListReviewsInputModel = defineSchemaModel2({
|
|
42
89
|
name: "ListReviewsInput",
|
|
43
90
|
fields: {
|
|
44
|
-
productId: { type:
|
|
45
|
-
storeId: { type:
|
|
91
|
+
productId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
92
|
+
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
46
93
|
status: { type: ReviewStatusEnum, isOptional: true },
|
|
47
|
-
minRating: { type:
|
|
94
|
+
minRating: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
48
95
|
limit: {
|
|
49
|
-
type:
|
|
96
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
50
97
|
isOptional: true,
|
|
51
98
|
defaultValue: 20
|
|
52
99
|
},
|
|
53
100
|
offset: {
|
|
54
|
-
type:
|
|
101
|
+
type: ScalarTypeEnum2.Int_unsecure(),
|
|
55
102
|
isOptional: true,
|
|
56
103
|
defaultValue: 0
|
|
57
104
|
}
|
|
58
105
|
}
|
|
59
106
|
});
|
|
60
|
-
var ListReviewsOutputModel =
|
|
107
|
+
var ListReviewsOutputModel = defineSchemaModel2({
|
|
61
108
|
name: "ListReviewsOutput",
|
|
62
109
|
fields: {
|
|
63
110
|
reviews: { type: ReviewModel, isArray: true, isOptional: false },
|
|
64
|
-
total: { type:
|
|
65
|
-
averageRating: { type:
|
|
66
|
-
ratingDistribution: { type:
|
|
111
|
+
total: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
112
|
+
averageRating: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
|
|
113
|
+
ratingDistribution: { type: ScalarTypeEnum2.JSON(), isOptional: false }
|
|
67
114
|
}
|
|
68
115
|
});
|
|
69
116
|
|
|
@@ -146,53 +193,6 @@ var ListReviewsContract = defineQuery({
|
|
|
146
193
|
]
|
|
147
194
|
}
|
|
148
195
|
});
|
|
149
|
-
|
|
150
|
-
// src/review/review.event.ts
|
|
151
|
-
import { ScalarTypeEnum as ScalarTypeEnum2, defineSchemaModel as defineSchemaModel2 } from "@contractspec/lib.schema";
|
|
152
|
-
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
153
|
-
var ReviewCreatedPayload = defineSchemaModel2({
|
|
154
|
-
name: "ReviewCreatedEventPayload",
|
|
155
|
-
fields: {
|
|
156
|
-
reviewId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
157
|
-
productId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
158
|
-
storeId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
159
|
-
authorId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
160
|
-
rating: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
161
|
-
isVerifiedPurchase: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
|
|
162
|
-
timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
var ReviewRespondedPayload = defineSchemaModel2({
|
|
166
|
-
name: "ReviewRespondedEventPayload",
|
|
167
|
-
fields: {
|
|
168
|
-
reviewId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
169
|
-
responseId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
170
|
-
authorId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
171
|
-
timestamp: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
var ReviewCreatedEvent = defineEvent({
|
|
175
|
-
meta: {
|
|
176
|
-
key: "marketplace.review.created",
|
|
177
|
-
version: "1.0.0",
|
|
178
|
-
description: "A review has been created.",
|
|
179
|
-
stability: "experimental",
|
|
180
|
-
owners: ["@marketplace-team"],
|
|
181
|
-
tags: ["marketplace", "review"]
|
|
182
|
-
},
|
|
183
|
-
payload: ReviewCreatedPayload
|
|
184
|
-
});
|
|
185
|
-
var ReviewRespondedEvent = defineEvent({
|
|
186
|
-
meta: {
|
|
187
|
-
key: "marketplace.review.responded",
|
|
188
|
-
version: "1.0.0",
|
|
189
|
-
description: "A seller has responded to a review.",
|
|
190
|
-
stability: "experimental",
|
|
191
|
-
owners: ["@marketplace-team"],
|
|
192
|
-
tags: ["marketplace", "review"]
|
|
193
|
-
},
|
|
194
|
-
payload: ReviewRespondedPayload
|
|
195
|
-
});
|
|
196
196
|
export {
|
|
197
197
|
ReviewStatusEnum,
|
|
198
198
|
ReviewRespondedEvent,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/review/review.event.ts
|
|
2
|
-
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
3
2
|
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
3
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
4
4
|
var ReviewCreatedPayload = defineSchemaModel({
|
|
5
5
|
name: "ReviewCreatedEventPayload",
|
|
6
6
|
fields: {
|