@mercurjs/b2c-core 1.5.0 → 1.5.1
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/.medusa/server/src/api/admin/inventory-items/[id]/location-levels/[location_id]/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/inventory-items/[id]/location-levels/[location_id]/route.js +36 -0
- package/.medusa/server/src/api/admin/notifications/route.js +8 -8
- package/.medusa/server/src/api/admin/sellers/validators.d.ts +2 -2
- package/.medusa/server/src/api/admin/sellers/validators.js +9 -7
- package/.medusa/server/src/api/store/carts/[id]/promotions/route.js +3 -4
- package/.medusa/server/src/api/store/middlewares.js +11 -9
- package/.medusa/server/src/api/store/products/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/store/products/middlewares.js +13 -0
- package/.medusa/server/src/api/store/products/search/route.d.ts +81 -0
- package/.medusa/server/src/api/store/products/search/route.js +170 -0
- package/.medusa/server/src/api/store/products/validators.d.ts +36 -0
- package/.medusa/server/src/api/store/products/validators.js +17 -0
- package/.medusa/server/src/api/store/wishlist/middlewares.d.ts +1 -1
- package/.medusa/server/src/api/store/wishlist/middlewares.js +47 -25
- package/.medusa/server/src/api/store/wishlist/{[id]/product → product}/[reference_id]/route.d.ts +3 -9
- package/.medusa/server/src/api/store/wishlist/product/[reference_id]/route.js +65 -0
- package/.medusa/server/src/api/store/wishlist/route.d.ts +789 -28
- package/.medusa/server/src/api/store/wishlist/route.js +817 -37
- package/.medusa/server/src/api/vendor/campaigns/validators.js +4 -4
- package/.medusa/server/src/api/vendor/inventory-items/[id]/location-levels/[location_id]/route.js +2 -5
- package/.medusa/server/src/api/vendor/inventory-items/[id]/location-levels/batch/route.js +2 -2
- package/.medusa/server/src/api/vendor/orders/validators.d.ts +4 -4
- package/.medusa/server/src/api/vendor/payout-account/route.js +3 -2
- package/.medusa/server/src/api/vendor/price-lists/[id]/prices/route.d.ts +2 -2
- package/.medusa/server/src/api/vendor/price-lists/[id]/prices/route.js +2 -2
- package/.medusa/server/src/api/vendor/price-lists/route.d.ts +1 -1
- package/.medusa/server/src/api/vendor/price-lists/route.js +27 -8
- package/.medusa/server/src/api/vendor/product-collections/middlewares.js +2 -2
- package/.medusa/server/src/api/vendor/product-collections/route.d.ts +18 -0
- package/.medusa/server/src/api/vendor/product-collections/route.js +19 -1
- package/.medusa/server/src/api/vendor/product-collections/validators.d.ts +404 -15
- package/.medusa/server/src/api/vendor/product-collections/validators.js +18 -3
- package/.medusa/server/src/api/vendor/product-tags/route.d.ts +4 -1
- package/.medusa/server/src/api/vendor/product-tags/route.js +8 -8
- package/.medusa/server/src/api/vendor/products/route.d.ts +8 -2
- package/.medusa/server/src/api/vendor/products/route.js +28 -20
- package/.medusa/server/src/api/vendor/products/utils.d.ts +20 -1
- package/.medusa/server/src/api/vendor/products/utils.js +81 -5
- package/.medusa/server/src/api/vendor/products/validators.d.ts +60 -0
- package/.medusa/server/src/api/vendor/products/validators.js +8 -2
- package/.medusa/server/src/api/vendor/promotions/route.d.ts +86 -2
- package/.medusa/server/src/api/vendor/promotions/route.js +116 -7
- package/.medusa/server/src/api/vendor/promotions/validators.d.ts +237 -38
- package/.medusa/server/src/api/vendor/promotions/validators.js +23 -5
- package/.medusa/server/src/api/vendor/shipping-profiles/route.d.ts +31 -2
- package/.medusa/server/src/api/vendor/shipping-profiles/route.js +61 -10
- package/.medusa/server/src/api/vendor/shipping-profiles/validators.d.ts +92 -3
- package/.medusa/server/src/api/vendor/shipping-profiles/validators.js +10 -2
- package/.medusa/server/src/api/vendor/stock-locations/validators.d.ts +10 -10
- package/.medusa/server/src/links/wishlist-product.js +3 -3
- package/.medusa/server/src/modules/seller/utils.d.ts +1 -1
- package/.medusa/server/src/modules/seller/utils.js +37 -10
- package/.medusa/server/src/shared/infra/http/utils/products.js +8 -2
- package/.medusa/server/src/workflows/attribute/steps/validate-attribute-value.js +7 -3
- package/.medusa/server/src/workflows/attribute/utils/products-updated-handler.d.ts +3 -3
- package/.medusa/server/src/workflows/attribute/utils/products-updated-handler.js +17 -15
- package/.medusa/server/src/workflows/hooks/fetch-shipping-option-pricing-context.d.ts +1 -0
- package/.medusa/server/src/workflows/hooks/fetch-shipping-option-pricing-context.js +97 -0
- package/.medusa/server/src/workflows/promotions/steps/index.d.ts +2 -0
- package/.medusa/server/src/workflows/promotions/steps/index.js +3 -1
- package/.medusa/server/src/workflows/promotions/steps/inject-seller-product-rule.d.ts +6 -0
- package/.medusa/server/src/workflows/promotions/steps/inject-seller-product-rule.js +40 -0
- package/.medusa/server/src/workflows/promotions/steps/verify-seller-product-rule-deletion.d.ts +9 -0
- package/.medusa/server/src/workflows/promotions/steps/verify-seller-product-rule-deletion.js +27 -0
- package/.medusa/server/src/workflows/promotions/steps/verify-vendor-target-promotion-rules.d.ts +5 -0
- package/.medusa/server/src/workflows/promotions/steps/verify-vendor-target-promotion-rules.js +27 -11
- package/.medusa/server/src/workflows/promotions/workflows/batch-vendor-promotion-rules.js +5 -1
- package/.medusa/server/src/workflows/promotions/workflows/create-vendor-promotion.js +4 -3
- package/.medusa/server/src/workflows/seller/steps/validate-products-to-import.d.ts +5 -0
- package/package.json +1 -1
- package/.medusa/server/src/api/store/wishlist/[id]/product/[reference_id]/route.js +0 -61
|
@@ -1,25 +1,414 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { VendorGetProductCategoriesProductsParams } from '../product-categories/validators';
|
|
3
|
-
export type
|
|
4
|
-
export declare const
|
|
3
|
+
export type VendorGetProductCollectionParamsType = z.infer<typeof VendorGetProductCollectionParams>;
|
|
4
|
+
export declare const VendorGetProductCollectionParams: z.ZodObject<{
|
|
5
5
|
fields: z.ZodOptional<z.ZodString>;
|
|
6
|
-
} & {
|
|
7
|
-
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
8
|
-
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
9
|
-
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
10
|
-
with_deleted: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean | undefined, unknown>;
|
|
11
6
|
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
offset: number;
|
|
13
|
-
limit: number;
|
|
14
|
-
order?: string | undefined;
|
|
15
7
|
fields?: string | undefined;
|
|
16
|
-
with_deleted?: boolean | undefined;
|
|
17
8
|
}, {
|
|
18
|
-
order?: string | undefined;
|
|
19
9
|
fields?: string | undefined;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
}>;
|
|
11
|
+
export declare const VendorGetProductCollectionsParamsFields: z.ZodObject<{
|
|
12
|
+
q: z.ZodOptional<z.ZodString>;
|
|
13
|
+
id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
14
|
+
title: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
15
|
+
handle: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
16
|
+
created_at: z.ZodOptional<z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
17
|
+
$gte: z.ZodOptional<z.ZodString>;
|
|
18
|
+
$lte: z.ZodOptional<z.ZodString>;
|
|
19
|
+
$gt: z.ZodOptional<z.ZodString>;
|
|
20
|
+
$lt: z.ZodOptional<z.ZodString>;
|
|
21
|
+
$eq: z.ZodOptional<z.ZodString>;
|
|
22
|
+
$ne: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
$gte?: string | undefined;
|
|
25
|
+
$lte?: string | undefined;
|
|
26
|
+
$gt?: string | undefined;
|
|
27
|
+
$lt?: string | undefined;
|
|
28
|
+
$eq?: string | undefined;
|
|
29
|
+
$ne?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
$gte?: string | undefined;
|
|
32
|
+
$lte?: string | undefined;
|
|
33
|
+
$gt?: string | undefined;
|
|
34
|
+
$lt?: string | undefined;
|
|
35
|
+
$eq?: string | undefined;
|
|
36
|
+
$ne?: string | undefined;
|
|
37
|
+
}>>, {
|
|
38
|
+
$gte?: string | undefined;
|
|
39
|
+
$lte?: string | undefined;
|
|
40
|
+
$gt?: string | undefined;
|
|
41
|
+
$lt?: string | undefined;
|
|
42
|
+
$eq?: string | undefined;
|
|
43
|
+
$ne?: string | undefined;
|
|
44
|
+
} | undefined, unknown>>;
|
|
45
|
+
updated_at: z.ZodOptional<z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
46
|
+
$gte: z.ZodOptional<z.ZodString>;
|
|
47
|
+
$lte: z.ZodOptional<z.ZodString>;
|
|
48
|
+
$gt: z.ZodOptional<z.ZodString>;
|
|
49
|
+
$lt: z.ZodOptional<z.ZodString>;
|
|
50
|
+
$eq: z.ZodOptional<z.ZodString>;
|
|
51
|
+
$ne: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
$gte?: string | undefined;
|
|
54
|
+
$lte?: string | undefined;
|
|
55
|
+
$gt?: string | undefined;
|
|
56
|
+
$lt?: string | undefined;
|
|
57
|
+
$eq?: string | undefined;
|
|
58
|
+
$ne?: string | undefined;
|
|
59
|
+
}, {
|
|
60
|
+
$gte?: string | undefined;
|
|
61
|
+
$lte?: string | undefined;
|
|
62
|
+
$gt?: string | undefined;
|
|
63
|
+
$lt?: string | undefined;
|
|
64
|
+
$eq?: string | undefined;
|
|
65
|
+
$ne?: string | undefined;
|
|
66
|
+
}>>, {
|
|
67
|
+
$gte?: string | undefined;
|
|
68
|
+
$lte?: string | undefined;
|
|
69
|
+
$gt?: string | undefined;
|
|
70
|
+
$lt?: string | undefined;
|
|
71
|
+
$eq?: string | undefined;
|
|
72
|
+
$ne?: string | undefined;
|
|
73
|
+
} | undefined, unknown>>;
|
|
74
|
+
deleted_at: z.ZodOptional<z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
75
|
+
$gte: z.ZodOptional<z.ZodString>;
|
|
76
|
+
$lte: z.ZodOptional<z.ZodString>;
|
|
77
|
+
$gt: z.ZodOptional<z.ZodString>;
|
|
78
|
+
$lt: z.ZodOptional<z.ZodString>;
|
|
79
|
+
$eq: z.ZodOptional<z.ZodString>;
|
|
80
|
+
$ne: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
$gte?: string | undefined;
|
|
83
|
+
$lte?: string | undefined;
|
|
84
|
+
$gt?: string | undefined;
|
|
85
|
+
$lt?: string | undefined;
|
|
86
|
+
$eq?: string | undefined;
|
|
87
|
+
$ne?: string | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
$gte?: string | undefined;
|
|
90
|
+
$lte?: string | undefined;
|
|
91
|
+
$gt?: string | undefined;
|
|
92
|
+
$lt?: string | undefined;
|
|
93
|
+
$eq?: string | undefined;
|
|
94
|
+
$ne?: string | undefined;
|
|
95
|
+
}>>, {
|
|
96
|
+
$gte?: string | undefined;
|
|
97
|
+
$lte?: string | undefined;
|
|
98
|
+
$gt?: string | undefined;
|
|
99
|
+
$lt?: string | undefined;
|
|
100
|
+
$eq?: string | undefined;
|
|
101
|
+
$ne?: string | undefined;
|
|
102
|
+
} | undefined, unknown>>;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
id?: string | string[] | undefined;
|
|
105
|
+
created_at?: {
|
|
106
|
+
$gte?: string | undefined;
|
|
107
|
+
$lte?: string | undefined;
|
|
108
|
+
$gt?: string | undefined;
|
|
109
|
+
$lt?: string | undefined;
|
|
110
|
+
$eq?: string | undefined;
|
|
111
|
+
$ne?: string | undefined;
|
|
112
|
+
} | undefined;
|
|
113
|
+
updated_at?: {
|
|
114
|
+
$gte?: string | undefined;
|
|
115
|
+
$lte?: string | undefined;
|
|
116
|
+
$gt?: string | undefined;
|
|
117
|
+
$lt?: string | undefined;
|
|
118
|
+
$eq?: string | undefined;
|
|
119
|
+
$ne?: string | undefined;
|
|
120
|
+
} | undefined;
|
|
121
|
+
deleted_at?: {
|
|
122
|
+
$gte?: string | undefined;
|
|
123
|
+
$lte?: string | undefined;
|
|
124
|
+
$gt?: string | undefined;
|
|
125
|
+
$lt?: string | undefined;
|
|
126
|
+
$eq?: string | undefined;
|
|
127
|
+
$ne?: string | undefined;
|
|
128
|
+
} | undefined;
|
|
129
|
+
handle?: string | string[] | undefined;
|
|
130
|
+
title?: string | string[] | undefined;
|
|
131
|
+
q?: string | undefined;
|
|
132
|
+
}, {
|
|
133
|
+
id?: string | string[] | undefined;
|
|
134
|
+
created_at?: unknown;
|
|
135
|
+
updated_at?: unknown;
|
|
136
|
+
deleted_at?: unknown;
|
|
137
|
+
handle?: string | string[] | undefined;
|
|
138
|
+
title?: string | string[] | undefined;
|
|
139
|
+
q?: string | undefined;
|
|
140
|
+
}>;
|
|
141
|
+
export type VendorGetProductCollectionsParamsType = z.infer<typeof VendorGetProductCollectionsParams>;
|
|
142
|
+
export declare const VendorGetProductCollectionsParams: z.ZodObject<{} & {
|
|
143
|
+
[x: string]: any;
|
|
144
|
+
$and: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodObject<{
|
|
145
|
+
q: z.ZodOptional<z.ZodString>;
|
|
146
|
+
id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
147
|
+
title: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
148
|
+
handle: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
149
|
+
created_at: z.ZodOptional<z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
150
|
+
$gte: z.ZodOptional<z.ZodString>;
|
|
151
|
+
$lte: z.ZodOptional<z.ZodString>;
|
|
152
|
+
$gt: z.ZodOptional<z.ZodString>;
|
|
153
|
+
$lt: z.ZodOptional<z.ZodString>;
|
|
154
|
+
$eq: z.ZodOptional<z.ZodString>;
|
|
155
|
+
$ne: z.ZodOptional<z.ZodString>;
|
|
156
|
+
}, "strip", z.ZodTypeAny, {
|
|
157
|
+
$gte?: string | undefined;
|
|
158
|
+
$lte?: string | undefined;
|
|
159
|
+
$gt?: string | undefined;
|
|
160
|
+
$lt?: string | undefined;
|
|
161
|
+
$eq?: string | undefined;
|
|
162
|
+
$ne?: string | undefined;
|
|
163
|
+
}, {
|
|
164
|
+
$gte?: string | undefined;
|
|
165
|
+
$lte?: string | undefined;
|
|
166
|
+
$gt?: string | undefined;
|
|
167
|
+
$lt?: string | undefined;
|
|
168
|
+
$eq?: string | undefined;
|
|
169
|
+
$ne?: string | undefined;
|
|
170
|
+
}>>, {
|
|
171
|
+
$gte?: string | undefined;
|
|
172
|
+
$lte?: string | undefined;
|
|
173
|
+
$gt?: string | undefined;
|
|
174
|
+
$lt?: string | undefined;
|
|
175
|
+
$eq?: string | undefined;
|
|
176
|
+
$ne?: string | undefined;
|
|
177
|
+
} | undefined, unknown>>;
|
|
178
|
+
updated_at: z.ZodOptional<z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
179
|
+
$gte: z.ZodOptional<z.ZodString>;
|
|
180
|
+
$lte: z.ZodOptional<z.ZodString>;
|
|
181
|
+
$gt: z.ZodOptional<z.ZodString>;
|
|
182
|
+
$lt: z.ZodOptional<z.ZodString>;
|
|
183
|
+
$eq: z.ZodOptional<z.ZodString>;
|
|
184
|
+
$ne: z.ZodOptional<z.ZodString>;
|
|
185
|
+
}, "strip", z.ZodTypeAny, {
|
|
186
|
+
$gte?: string | undefined;
|
|
187
|
+
$lte?: string | undefined;
|
|
188
|
+
$gt?: string | undefined;
|
|
189
|
+
$lt?: string | undefined;
|
|
190
|
+
$eq?: string | undefined;
|
|
191
|
+
$ne?: string | undefined;
|
|
192
|
+
}, {
|
|
193
|
+
$gte?: string | undefined;
|
|
194
|
+
$lte?: string | undefined;
|
|
195
|
+
$gt?: string | undefined;
|
|
196
|
+
$lt?: string | undefined;
|
|
197
|
+
$eq?: string | undefined;
|
|
198
|
+
$ne?: string | undefined;
|
|
199
|
+
}>>, {
|
|
200
|
+
$gte?: string | undefined;
|
|
201
|
+
$lte?: string | undefined;
|
|
202
|
+
$gt?: string | undefined;
|
|
203
|
+
$lt?: string | undefined;
|
|
204
|
+
$eq?: string | undefined;
|
|
205
|
+
$ne?: string | undefined;
|
|
206
|
+
} | undefined, unknown>>;
|
|
207
|
+
deleted_at: z.ZodOptional<z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
208
|
+
$gte: z.ZodOptional<z.ZodString>;
|
|
209
|
+
$lte: z.ZodOptional<z.ZodString>;
|
|
210
|
+
$gt: z.ZodOptional<z.ZodString>;
|
|
211
|
+
$lt: z.ZodOptional<z.ZodString>;
|
|
212
|
+
$eq: z.ZodOptional<z.ZodString>;
|
|
213
|
+
$ne: z.ZodOptional<z.ZodString>;
|
|
214
|
+
}, "strip", z.ZodTypeAny, {
|
|
215
|
+
$gte?: string | undefined;
|
|
216
|
+
$lte?: string | undefined;
|
|
217
|
+
$gt?: string | undefined;
|
|
218
|
+
$lt?: string | undefined;
|
|
219
|
+
$eq?: string | undefined;
|
|
220
|
+
$ne?: string | undefined;
|
|
221
|
+
}, {
|
|
222
|
+
$gte?: string | undefined;
|
|
223
|
+
$lte?: string | undefined;
|
|
224
|
+
$gt?: string | undefined;
|
|
225
|
+
$lt?: string | undefined;
|
|
226
|
+
$eq?: string | undefined;
|
|
227
|
+
$ne?: string | undefined;
|
|
228
|
+
}>>, {
|
|
229
|
+
$gte?: string | undefined;
|
|
230
|
+
$lte?: string | undefined;
|
|
231
|
+
$gt?: string | undefined;
|
|
232
|
+
$lt?: string | undefined;
|
|
233
|
+
$eq?: string | undefined;
|
|
234
|
+
$ne?: string | undefined;
|
|
235
|
+
} | undefined, unknown>>;
|
|
236
|
+
}, "strip", z.ZodTypeAny, {
|
|
237
|
+
id?: string | string[] | undefined;
|
|
238
|
+
created_at?: {
|
|
239
|
+
$gte?: string | undefined;
|
|
240
|
+
$lte?: string | undefined;
|
|
241
|
+
$gt?: string | undefined;
|
|
242
|
+
$lt?: string | undefined;
|
|
243
|
+
$eq?: string | undefined;
|
|
244
|
+
$ne?: string | undefined;
|
|
245
|
+
} | undefined;
|
|
246
|
+
updated_at?: {
|
|
247
|
+
$gte?: string | undefined;
|
|
248
|
+
$lte?: string | undefined;
|
|
249
|
+
$gt?: string | undefined;
|
|
250
|
+
$lt?: string | undefined;
|
|
251
|
+
$eq?: string | undefined;
|
|
252
|
+
$ne?: string | undefined;
|
|
253
|
+
} | undefined;
|
|
254
|
+
deleted_at?: {
|
|
255
|
+
$gte?: string | undefined;
|
|
256
|
+
$lte?: string | undefined;
|
|
257
|
+
$gt?: string | undefined;
|
|
258
|
+
$lt?: string | undefined;
|
|
259
|
+
$eq?: string | undefined;
|
|
260
|
+
$ne?: string | undefined;
|
|
261
|
+
} | undefined;
|
|
262
|
+
handle?: string | string[] | undefined;
|
|
263
|
+
title?: string | string[] | undefined;
|
|
264
|
+
q?: string | undefined;
|
|
265
|
+
}, {
|
|
266
|
+
id?: string | string[] | undefined;
|
|
267
|
+
created_at?: unknown;
|
|
268
|
+
updated_at?: unknown;
|
|
269
|
+
deleted_at?: unknown;
|
|
270
|
+
handle?: string | string[] | undefined;
|
|
271
|
+
title?: string | string[] | undefined;
|
|
272
|
+
q?: string | undefined;
|
|
273
|
+
}>, "many">>>;
|
|
274
|
+
$or: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodObject<{
|
|
275
|
+
q: z.ZodOptional<z.ZodString>;
|
|
276
|
+
id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
277
|
+
title: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
278
|
+
handle: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
279
|
+
created_at: z.ZodOptional<z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
280
|
+
$gte: z.ZodOptional<z.ZodString>;
|
|
281
|
+
$lte: z.ZodOptional<z.ZodString>;
|
|
282
|
+
$gt: z.ZodOptional<z.ZodString>;
|
|
283
|
+
$lt: z.ZodOptional<z.ZodString>;
|
|
284
|
+
$eq: z.ZodOptional<z.ZodString>;
|
|
285
|
+
$ne: z.ZodOptional<z.ZodString>;
|
|
286
|
+
}, "strip", z.ZodTypeAny, {
|
|
287
|
+
$gte?: string | undefined;
|
|
288
|
+
$lte?: string | undefined;
|
|
289
|
+
$gt?: string | undefined;
|
|
290
|
+
$lt?: string | undefined;
|
|
291
|
+
$eq?: string | undefined;
|
|
292
|
+
$ne?: string | undefined;
|
|
293
|
+
}, {
|
|
294
|
+
$gte?: string | undefined;
|
|
295
|
+
$lte?: string | undefined;
|
|
296
|
+
$gt?: string | undefined;
|
|
297
|
+
$lt?: string | undefined;
|
|
298
|
+
$eq?: string | undefined;
|
|
299
|
+
$ne?: string | undefined;
|
|
300
|
+
}>>, {
|
|
301
|
+
$gte?: string | undefined;
|
|
302
|
+
$lte?: string | undefined;
|
|
303
|
+
$gt?: string | undefined;
|
|
304
|
+
$lt?: string | undefined;
|
|
305
|
+
$eq?: string | undefined;
|
|
306
|
+
$ne?: string | undefined;
|
|
307
|
+
} | undefined, unknown>>;
|
|
308
|
+
updated_at: z.ZodOptional<z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
309
|
+
$gte: z.ZodOptional<z.ZodString>;
|
|
310
|
+
$lte: z.ZodOptional<z.ZodString>;
|
|
311
|
+
$gt: z.ZodOptional<z.ZodString>;
|
|
312
|
+
$lt: z.ZodOptional<z.ZodString>;
|
|
313
|
+
$eq: z.ZodOptional<z.ZodString>;
|
|
314
|
+
$ne: z.ZodOptional<z.ZodString>;
|
|
315
|
+
}, "strip", z.ZodTypeAny, {
|
|
316
|
+
$gte?: string | undefined;
|
|
317
|
+
$lte?: string | undefined;
|
|
318
|
+
$gt?: string | undefined;
|
|
319
|
+
$lt?: string | undefined;
|
|
320
|
+
$eq?: string | undefined;
|
|
321
|
+
$ne?: string | undefined;
|
|
322
|
+
}, {
|
|
323
|
+
$gte?: string | undefined;
|
|
324
|
+
$lte?: string | undefined;
|
|
325
|
+
$gt?: string | undefined;
|
|
326
|
+
$lt?: string | undefined;
|
|
327
|
+
$eq?: string | undefined;
|
|
328
|
+
$ne?: string | undefined;
|
|
329
|
+
}>>, {
|
|
330
|
+
$gte?: string | undefined;
|
|
331
|
+
$lte?: string | undefined;
|
|
332
|
+
$gt?: string | undefined;
|
|
333
|
+
$lt?: string | undefined;
|
|
334
|
+
$eq?: string | undefined;
|
|
335
|
+
$ne?: string | undefined;
|
|
336
|
+
} | undefined, unknown>>;
|
|
337
|
+
deleted_at: z.ZodOptional<z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
338
|
+
$gte: z.ZodOptional<z.ZodString>;
|
|
339
|
+
$lte: z.ZodOptional<z.ZodString>;
|
|
340
|
+
$gt: z.ZodOptional<z.ZodString>;
|
|
341
|
+
$lt: z.ZodOptional<z.ZodString>;
|
|
342
|
+
$eq: z.ZodOptional<z.ZodString>;
|
|
343
|
+
$ne: z.ZodOptional<z.ZodString>;
|
|
344
|
+
}, "strip", z.ZodTypeAny, {
|
|
345
|
+
$gte?: string | undefined;
|
|
346
|
+
$lte?: string | undefined;
|
|
347
|
+
$gt?: string | undefined;
|
|
348
|
+
$lt?: string | undefined;
|
|
349
|
+
$eq?: string | undefined;
|
|
350
|
+
$ne?: string | undefined;
|
|
351
|
+
}, {
|
|
352
|
+
$gte?: string | undefined;
|
|
353
|
+
$lte?: string | undefined;
|
|
354
|
+
$gt?: string | undefined;
|
|
355
|
+
$lt?: string | undefined;
|
|
356
|
+
$eq?: string | undefined;
|
|
357
|
+
$ne?: string | undefined;
|
|
358
|
+
}>>, {
|
|
359
|
+
$gte?: string | undefined;
|
|
360
|
+
$lte?: string | undefined;
|
|
361
|
+
$gt?: string | undefined;
|
|
362
|
+
$lt?: string | undefined;
|
|
363
|
+
$eq?: string | undefined;
|
|
364
|
+
$ne?: string | undefined;
|
|
365
|
+
} | undefined, unknown>>;
|
|
366
|
+
}, "strip", z.ZodTypeAny, {
|
|
367
|
+
id?: string | string[] | undefined;
|
|
368
|
+
created_at?: {
|
|
369
|
+
$gte?: string | undefined;
|
|
370
|
+
$lte?: string | undefined;
|
|
371
|
+
$gt?: string | undefined;
|
|
372
|
+
$lt?: string | undefined;
|
|
373
|
+
$eq?: string | undefined;
|
|
374
|
+
$ne?: string | undefined;
|
|
375
|
+
} | undefined;
|
|
376
|
+
updated_at?: {
|
|
377
|
+
$gte?: string | undefined;
|
|
378
|
+
$lte?: string | undefined;
|
|
379
|
+
$gt?: string | undefined;
|
|
380
|
+
$lt?: string | undefined;
|
|
381
|
+
$eq?: string | undefined;
|
|
382
|
+
$ne?: string | undefined;
|
|
383
|
+
} | undefined;
|
|
384
|
+
deleted_at?: {
|
|
385
|
+
$gte?: string | undefined;
|
|
386
|
+
$lte?: string | undefined;
|
|
387
|
+
$gt?: string | undefined;
|
|
388
|
+
$lt?: string | undefined;
|
|
389
|
+
$eq?: string | undefined;
|
|
390
|
+
$ne?: string | undefined;
|
|
391
|
+
} | undefined;
|
|
392
|
+
handle?: string | string[] | undefined;
|
|
393
|
+
title?: string | string[] | undefined;
|
|
394
|
+
q?: string | undefined;
|
|
395
|
+
}, {
|
|
396
|
+
id?: string | string[] | undefined;
|
|
397
|
+
created_at?: unknown;
|
|
398
|
+
updated_at?: unknown;
|
|
399
|
+
deleted_at?: unknown;
|
|
400
|
+
handle?: string | string[] | undefined;
|
|
401
|
+
title?: string | string[] | undefined;
|
|
402
|
+
q?: string | undefined;
|
|
403
|
+
}>, "many">>>;
|
|
404
|
+
}, "strip", z.ZodTypeAny, {
|
|
405
|
+
[x: string]: any;
|
|
406
|
+
$and?: unknown;
|
|
407
|
+
$or?: unknown;
|
|
408
|
+
}, {
|
|
409
|
+
[x: string]: any;
|
|
410
|
+
$and?: unknown;
|
|
411
|
+
$or?: unknown;
|
|
23
412
|
}>;
|
|
24
413
|
export type VendorGetProductCollectionsProductsParamsType = z.infer<typeof VendorGetProductCategoriesProductsParams>;
|
|
25
414
|
export declare const VendorGetProductCollectionsProductsParams: z.ZodObject<{
|
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VendorGetProductCollectionsProductsParams = exports.VendorGetProductCollectionsParams = void 0;
|
|
3
|
+
exports.VendorGetProductCollectionsProductsParams = exports.VendorGetProductCollectionsParams = exports.VendorGetProductCollectionsParamsFields = exports.VendorGetProductCollectionParams = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_1 = require("@medusajs/medusa/api/utils/common-validators/common");
|
|
4
6
|
const validators_1 = require("@medusajs/medusa/api/utils/validators");
|
|
7
|
+
const utils_1 = require("../../../shared/infra/http/utils");
|
|
8
|
+
exports.VendorGetProductCollectionParams = (0, validators_1.createSelectParams)();
|
|
9
|
+
exports.VendorGetProductCollectionsParamsFields = zod_1.z.object({
|
|
10
|
+
q: zod_1.z.string().optional(),
|
|
11
|
+
id: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
12
|
+
title: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
13
|
+
handle: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
14
|
+
created_at: utils_1.dateFilterSchema,
|
|
15
|
+
updated_at: utils_1.dateFilterSchema,
|
|
16
|
+
deleted_at: utils_1.dateFilterSchema
|
|
17
|
+
});
|
|
5
18
|
exports.VendorGetProductCollectionsParams = (0, validators_1.createFindParams)({
|
|
6
19
|
limit: 20,
|
|
7
20
|
offset: 0
|
|
8
|
-
})
|
|
21
|
+
})
|
|
22
|
+
.merge(exports.VendorGetProductCollectionsParamsFields)
|
|
23
|
+
.merge((0, common_1.applyAndAndOrOperators)(exports.VendorGetProductCollectionsParamsFields));
|
|
9
24
|
exports.VendorGetProductCollectionsProductsParams = (0, validators_1.createFindParams)({
|
|
10
25
|
offset: 0,
|
|
11
26
|
limit: 10
|
|
12
27
|
});
|
|
13
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdG9ycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9hcGkvdmVuZG9yL3Byb2R1Y3QtY29sbGVjdGlvbnMvdmFsaWRhdG9ycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2QkFBdUI7QUFFdkIsZ0ZBQTRGO0FBQzVGLHNFQUc4QztBQUU5Qyw0REFBbUU7QUFNdEQsUUFBQSxnQ0FBZ0MsR0FBRyxJQUFBLCtCQUFrQixHQUFFLENBQUE7QUFFdkQsUUFBQSx1Q0FBdUMsR0FBRyxPQUFDLENBQUMsTUFBTSxDQUFDO0lBQzlELENBQUMsRUFBRSxPQUFDLENBQUMsTUFBTSxFQUFFLENBQUMsUUFBUSxFQUFFO0lBQ3hCLEVBQUUsRUFBRSxPQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsT0FBQyxDQUFDLE1BQU0sRUFBRSxFQUFFLE9BQUMsQ0FBQyxLQUFLLENBQUMsT0FBQyxDQUFDLE1BQU0sRUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDLFFBQVEsRUFBRTtJQUN6RCxLQUFLLEVBQUUsT0FBQyxDQUFDLEtBQUssQ0FBQyxDQUFDLE9BQUMsQ0FBQyxNQUFNLEVBQUUsRUFBRSxPQUFDLENBQUMsS0FBSyxDQUFDLE9BQUMsQ0FBQyxNQUFNLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxRQUFRLEVBQUU7SUFDNUQsTUFBTSxFQUFFLE9BQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxPQUFDLENBQUMsTUFBTSxFQUFFLEVBQUUsT0FBQyxDQUFDLEtBQUssQ0FBQyxPQUFDLENBQUMsTUFBTSxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUMsUUFBUSxFQUFFO0lBQzdELFVBQVUsRUFBRSx3QkFBZ0I7SUFDNUIsVUFBVSxFQUFFLHdCQUFnQjtJQUM1QixVQUFVLEVBQUUsd0JBQWdCO0NBQzdCLENBQUMsQ0FBQTtBQUtXLFFBQUEsaUNBQWlDLEdBQUcsSUFBQSw2QkFBZ0IsRUFBQztJQUNoRSxLQUFLLEVBQUUsRUFBRTtJQUNULE1BQU0sRUFBRSxDQUFDO0NBQ1YsQ0FBQztLQUNDLEtBQUssQ0FBQywrQ0FBdUMsQ0FBQztLQUM5QyxLQUFLLENBQUMsSUFBQSwrQkFBc0IsRUFBQywrQ0FBdUMsQ0FBQyxDQUFDLENBQUE7QUFLNUQsUUFBQSx5Q0FBeUMsR0FBRyxJQUFBLDZCQUFnQixFQUFDO0lBQ3hFLE1BQU0sRUFBRSxDQUFDO0lBQ1QsS0FBSyxFQUFFLEVBQUU7Q0FDVixDQUFDLENBQUEifQ==
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AuthenticatedMedusaRequest, MedusaResponse } from '@medusajs/framework';
|
|
2
|
+
import { HttpTypes } from '@medusajs/framework/types';
|
|
2
3
|
/**
|
|
3
4
|
* @oas [get] /vendor/product-tags
|
|
4
5
|
* operationId: "VendorListProductTags"
|
|
@@ -50,4 +51,6 @@ import { AuthenticatedMedusaRequest, MedusaResponse } from '@medusajs/framework'
|
|
|
50
51
|
* - api_token: []
|
|
51
52
|
* - cookie_auth: []
|
|
52
53
|
*/
|
|
53
|
-
export declare const GET: (req: AuthenticatedMedusaRequest, res: MedusaResponse
|
|
54
|
+
export declare const GET: (req: AuthenticatedMedusaRequest, res: MedusaResponse<HttpTypes.PaginatedResponse<{
|
|
55
|
+
product_tags: HttpTypes.AdminProductTag[];
|
|
56
|
+
}>>) => Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GET = void 0;
|
|
4
|
-
const
|
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
5
5
|
/**
|
|
6
6
|
* @oas [get] /vendor/product-tags
|
|
7
7
|
* operationId: "VendorListProductTags"
|
|
@@ -54,19 +54,19 @@ const framework_1 = require("@medusajs/framework");
|
|
|
54
54
|
* - cookie_auth: []
|
|
55
55
|
*/
|
|
56
56
|
const GET = async (req, res) => {
|
|
57
|
-
const
|
|
57
|
+
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
58
|
+
const { data: product_tags, metadata } = await query.graph({
|
|
58
59
|
entity: 'product_tag',
|
|
59
|
-
idOrFilter: req.filterableFields,
|
|
60
|
-
scope: req.scope,
|
|
61
60
|
fields: req.queryConfig.fields,
|
|
61
|
+
filters: req.filterableFields,
|
|
62
62
|
pagination: req.queryConfig.pagination
|
|
63
63
|
});
|
|
64
64
|
res.json({
|
|
65
65
|
product_tags,
|
|
66
|
-
count: metadata?.count,
|
|
67
|
-
offset: metadata?.skip,
|
|
68
|
-
limit: metadata?.take
|
|
66
|
+
count: metadata?.count ?? product_tags.length,
|
|
67
|
+
offset: metadata?.skip ?? req.queryConfig.pagination?.skip ?? 0,
|
|
68
|
+
limit: metadata?.take ?? req.queryConfig.pagination?.take ?? 0
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
71
|
exports.GET = GET;
|
|
72
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
72
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUuanMiLCJzb3VyY2VSb290IjoiIiwic291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QztLQUMvRCxDQUFDLENBQUE7QUFDSixDQUFDLENBQUE7QUFuQlksUUFBQSxHQUFHLE9BbUJmIn0=
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AuthenticatedMedusaRequest, MedusaRequest, MedusaResponse } from
|
|
2
|
-
import { VendorCreateProductType, VendorGetProductParamsType } from
|
|
1
|
+
import { AuthenticatedMedusaRequest, MedusaRequest, MedusaResponse } from '@medusajs/framework';
|
|
2
|
+
import { VendorCreateProductType, VendorGetProductParamsType } from './validators';
|
|
3
3
|
/**
|
|
4
4
|
* @oas [get] /vendor/products
|
|
5
5
|
* operationId: "VendorListProducts"
|
|
@@ -7,6 +7,12 @@ import { VendorCreateProductType, VendorGetProductParamsType } from "./validator
|
|
|
7
7
|
* description: "Retrieves a list of products for the authenticated vendor."
|
|
8
8
|
* x-authenticated: true
|
|
9
9
|
* parameters:
|
|
10
|
+
* - name: q
|
|
11
|
+
* in: query
|
|
12
|
+
* schema:
|
|
13
|
+
* type: string
|
|
14
|
+
* required: false
|
|
15
|
+
* description: Search term to filter products by title or ID.
|
|
10
16
|
* - name: offset
|
|
11
17
|
* in: query
|
|
12
18
|
* schema:
|
|
@@ -13,6 +13,12 @@ const utils_3 = require("./utils");
|
|
|
13
13
|
* description: "Retrieves a list of products for the authenticated vendor."
|
|
14
14
|
* x-authenticated: true
|
|
15
15
|
* parameters:
|
|
16
|
+
* - name: q
|
|
17
|
+
* in: query
|
|
18
|
+
* schema:
|
|
19
|
+
* type: string
|
|
20
|
+
* required: false
|
|
21
|
+
* description: Search term to filter products by title or ID.
|
|
16
22
|
* - name: offset
|
|
17
23
|
* in: query
|
|
18
24
|
* schema:
|
|
@@ -66,14 +72,13 @@ const utils_3 = require("./utils");
|
|
|
66
72
|
*/
|
|
67
73
|
const GET = async (req, res) => {
|
|
68
74
|
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
69
|
-
const { productIds, count } = await (0, utils_3.filterProductsBySeller)(req.scope, req.filterableFields.seller_id, req.queryConfig.pagination?.skip || 0, req.queryConfig.pagination?.take || 10, req.filterableFields.sales_channel_id, req.queryConfig.pagination?.order);
|
|
70
|
-
const { seller_id, ...filters } = req.filterableFields;
|
|
75
|
+
const { productIds, count } = await (0, utils_3.filterProductsBySeller)(req.scope, req.filterableFields.seller_id, req.queryConfig.pagination?.skip || 0, req.queryConfig.pagination?.take || 10, req.filterableFields.sales_channel_id, req.queryConfig.pagination?.order, req.filterableFields.q);
|
|
71
76
|
const { data: sellerProducts } = await query.graph({
|
|
72
|
-
entity:
|
|
77
|
+
entity: 'product',
|
|
73
78
|
fields: req.queryConfig.fields,
|
|
74
79
|
filters: {
|
|
75
|
-
...
|
|
76
|
-
id: productIds
|
|
80
|
+
...(0, utils_1.omitDeep)(req.filterableFields, ['q', 'seller_id']),
|
|
81
|
+
id: { $in: productIds }
|
|
77
82
|
},
|
|
78
83
|
pagination: {
|
|
79
84
|
order: req.queryConfig.pagination?.order
|
|
@@ -118,19 +123,22 @@ exports.GET = GET;
|
|
|
118
123
|
const POST = async (req, res) => {
|
|
119
124
|
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
120
125
|
const seller = await (0, utils_2.fetchSellerByAuthActorId)(req.auth_context?.actor_id, req.scope);
|
|
121
|
-
const { additional_data, ...validatedBody } = req.validatedBody;
|
|
122
|
-
const
|
|
126
|
+
const { additional_data, variants_images, ...validatedBody } = req.validatedBody;
|
|
127
|
+
const mergedImages = (0, utils_3.mergeVariantImages)(validatedBody.images, variants_images);
|
|
128
|
+
const { result: [createdProduct] } = await core_flows_1.createProductsWorkflow.run({
|
|
123
129
|
container: req.scope,
|
|
124
130
|
input: {
|
|
125
131
|
products: [
|
|
126
132
|
{
|
|
127
133
|
...validatedBody,
|
|
128
|
-
|
|
129
|
-
|
|
134
|
+
images: mergedImages.length ? mergedImages : undefined,
|
|
135
|
+
status: validatedBody.status === 'draft' ? 'draft' : 'proposed'
|
|
136
|
+
}
|
|
130
137
|
],
|
|
131
|
-
additional_data: { ...additional_data, seller_id: seller.id }
|
|
132
|
-
}
|
|
138
|
+
additional_data: { ...additional_data, seller_id: seller.id }
|
|
139
|
+
}
|
|
133
140
|
});
|
|
141
|
+
await (0, utils_3.assignVariantImages)(req.scope, variants_images, createdProduct);
|
|
134
142
|
const eventBus = req.scope.resolve(utils_1.Modules.EVENT_BUS);
|
|
135
143
|
await eventBus.emit({
|
|
136
144
|
name: framework_1.ProductRequestUpdatedEvent.TO_CREATE,
|
|
@@ -139,21 +147,21 @@ const POST = async (req, res) => {
|
|
|
139
147
|
data: {
|
|
140
148
|
data: {
|
|
141
149
|
...createdProduct,
|
|
142
|
-
product_id: createdProduct.id
|
|
150
|
+
product_id: createdProduct.id
|
|
143
151
|
},
|
|
144
152
|
submitter_id: req.auth_context.actor_id,
|
|
145
|
-
type:
|
|
146
|
-
status: createdProduct.status ===
|
|
147
|
-
}
|
|
148
|
-
}
|
|
153
|
+
type: 'product',
|
|
154
|
+
status: createdProduct.status === 'draft' ? 'draft' : 'pending'
|
|
155
|
+
}
|
|
156
|
+
}
|
|
149
157
|
});
|
|
150
158
|
const product_id = createdProduct.id;
|
|
151
|
-
const { data: [product]
|
|
152
|
-
entity:
|
|
159
|
+
const { data: [product] } = await query.graph({
|
|
160
|
+
entity: 'product',
|
|
153
161
|
fields: req.queryConfig.fields,
|
|
154
|
-
filters: { id: product_id }
|
|
162
|
+
filters: { id: product_id }
|
|
155
163
|
}, { throwIfKeyNotFound: true });
|
|
156
164
|
res.status(201).json({ product });
|
|
157
165
|
};
|
|
158
166
|
exports.POST = POST;
|
|
159
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
167
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL3ZlbmRvci9wcm9kdWN0cy9yb3V0ZS50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