@mercurjs/framework 1.5.0 → 1.5.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/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/algolia/algolia-product.d.ts +3 -3
- package/dist/types/algolia/algolia-product.js +1 -1
- package/dist/types/algolia/index.d.ts +1 -0
- package/dist/types/algolia/index.d.ts.map +1 -1
- package/dist/types/algolia/index.js +1 -0
- package/dist/types/algolia/index.js.map +1 -1
- package/dist/types/algolia/module.d.ts +22 -0
- package/dist/types/algolia/module.d.ts.map +1 -0
- package/dist/types/algolia/module.js +5 -0
- package/dist/types/algolia/module.js.map +1 -0
- package/dist/types/requests/events.d.ts +2 -1
- package/dist/types/requests/events.d.ts.map +1 -1
- package/dist/types/requests/events.js +1 -0
- package/dist/types/requests/events.js.map +1 -1
- package/dist/utils/hosts.d.ts +3 -3
- package/dist/utils/hosts.d.ts.map +1 -1
- package/dist/utils/middlewares/check-ownership.d.ts +16 -7
- package/dist/utils/middlewares/check-ownership.d.ts.map +1 -1
- package/dist/utils/middlewares/check-ownership.js +25 -17
- package/dist/utils/middlewares/check-ownership.js.map +1 -1
- package/dist/workflows/update-product-status.d.ts +1 -1
- package/dist/workflows/update-product-status.d.ts.map +1 -1
- package/dist/workflows/update-product-status.js +11 -5
- package/dist/workflows/update-product-status.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/links/index.ts","../src/links/link-entrypoints.ts","../src/links/linkables.ts","../src/modules/index.ts","../src/types/index.ts","../src/types/algolia/algolia-entity.ts","../src/types/algolia/algolia-product.ts","../src/types/algolia/algolia-review.ts","../src/types/algolia/events.ts","../src/types/algolia/index-types.ts","../src/types/algolia/index.ts","../src/types/attribute/common.ts","../src/types/attribute/index.ts","../src/types/attribute/mutations.ts","../src/types/brand/index.ts","../src/types/brand/mutations.ts","../src/types/commission/common.ts","../src/types/commission/index.ts","../src/types/commission/mutations.ts","../src/types/configuration/common.ts","../src/types/configuration/index.ts","../src/types/configuration/mutations.ts","../src/types/marketplace/common.ts","../src/types/marketplace/events.ts","../src/types/marketplace/index.ts","../src/types/marketplace/mutations.ts","../src/types/order-return-request/common.ts","../src/types/order-return-request/index.ts","../src/types/order-return-request/mutations.ts","../src/types/payment-stripe-connect/index.ts","../src/types/payout/common.ts","../src/types/payout/events.ts","../src/types/payout/index.ts","../src/types/payout/mutations.ts","../src/types/payout/provider.ts","../src/types/requests/common.ts","../src/types/requests/events.ts","../src/types/requests/humanize_types.ts","../src/types/requests/index.ts","../src/types/requests/mutations.ts","../src/types/reviews/common.ts","../src/types/reviews/index.ts","../src/types/reviews/mutatations.ts","../src/types/seller/common.ts","../src/types/seller/events.ts","../src/types/seller/index.ts","../src/types/seller/mutations.ts","../src/types/split-order-payment/common.ts","../src/types/split-order-payment/index.ts","../src/types/split-order-payment/mutations.ts","../src/types/wishlist/common.ts","../src/types/wishlist/index.ts","../src/types/wishlist/mutations.ts","../src/utils/admin.ts","../src/utils/configuration.ts","../src/utils/hosts.ts","../src/utils/index.ts","../src/utils/money.ts","../src/utils/seller.ts","../src/utils/store.ts","../src/utils/middlewares/apply-reference-filter.ts","../src/utils/middlewares/check-customer-ownership.ts","../src/utils/middlewares/check-ownership.ts","../src/utils/middlewares/filter-by-seller-id.ts","../src/utils/middlewares/index.ts","../src/workflows/emit-multiple-events-step.ts","../src/workflows/index.ts","../src/workflows/update-product-status.ts"],"version":"5.9.3"}
|
|
1
|
+
{"root":["../src/index.ts","../src/links/index.ts","../src/links/link-entrypoints.ts","../src/links/linkables.ts","../src/modules/index.ts","../src/types/index.ts","../src/types/algolia/algolia-entity.ts","../src/types/algolia/algolia-product.ts","../src/types/algolia/algolia-review.ts","../src/types/algolia/events.ts","../src/types/algolia/index-types.ts","../src/types/algolia/index.ts","../src/types/algolia/module.ts","../src/types/attribute/common.ts","../src/types/attribute/index.ts","../src/types/attribute/mutations.ts","../src/types/brand/index.ts","../src/types/brand/mutations.ts","../src/types/commission/common.ts","../src/types/commission/index.ts","../src/types/commission/mutations.ts","../src/types/configuration/common.ts","../src/types/configuration/index.ts","../src/types/configuration/mutations.ts","../src/types/marketplace/common.ts","../src/types/marketplace/events.ts","../src/types/marketplace/index.ts","../src/types/marketplace/mutations.ts","../src/types/order-return-request/common.ts","../src/types/order-return-request/index.ts","../src/types/order-return-request/mutations.ts","../src/types/payment-stripe-connect/index.ts","../src/types/payout/common.ts","../src/types/payout/events.ts","../src/types/payout/index.ts","../src/types/payout/mutations.ts","../src/types/payout/provider.ts","../src/types/requests/common.ts","../src/types/requests/events.ts","../src/types/requests/humanize_types.ts","../src/types/requests/index.ts","../src/types/requests/mutations.ts","../src/types/reviews/common.ts","../src/types/reviews/index.ts","../src/types/reviews/mutatations.ts","../src/types/seller/common.ts","../src/types/seller/events.ts","../src/types/seller/index.ts","../src/types/seller/mutations.ts","../src/types/split-order-payment/common.ts","../src/types/split-order-payment/index.ts","../src/types/split-order-payment/mutations.ts","../src/types/wishlist/common.ts","../src/types/wishlist/index.ts","../src/types/wishlist/mutations.ts","../src/utils/admin.ts","../src/utils/configuration.ts","../src/utils/hosts.ts","../src/utils/index.ts","../src/utils/money.ts","../src/utils/seller.ts","../src/utils/store.ts","../src/utils/middlewares/apply-reference-filter.ts","../src/utils/middlewares/check-customer-ownership.ts","../src/utils/middlewares/check-ownership.ts","../src/utils/middlewares/filter-by-seller-id.ts","../src/utils/middlewares/index.ts","../src/workflows/emit-multiple-events-step.ts","../src/workflows/index.ts","../src/workflows/update-product-status.ts"],"version":"5.9.3"}
|
|
@@ -218,7 +218,7 @@ export declare const AlgoliaVariantValidator: z.ZodObject<{
|
|
|
218
218
|
weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
219
219
|
length: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
220
220
|
height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
221
|
-
|
|
221
|
+
width: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
222
222
|
variant_rank: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
223
223
|
options: z.ZodArray<z.ZodObject<{
|
|
224
224
|
id: z.ZodString;
|
|
@@ -303,10 +303,10 @@ export declare const AlgoliaVariantValidator: z.ZodObject<{
|
|
|
303
303
|
mid_code?: string | null | undefined;
|
|
304
304
|
weight?: number | null | undefined;
|
|
305
305
|
height?: number | null | undefined;
|
|
306
|
+
width?: number | null | undefined;
|
|
306
307
|
origin_country?: string | null | undefined;
|
|
307
308
|
material?: string | null | undefined;
|
|
308
309
|
ups?: string | null | undefined;
|
|
309
|
-
wifth?: number | null | undefined;
|
|
310
310
|
variant_rank?: number | null | undefined;
|
|
311
311
|
}, {
|
|
312
312
|
id: string;
|
|
@@ -338,10 +338,10 @@ export declare const AlgoliaVariantValidator: z.ZodObject<{
|
|
|
338
338
|
mid_code?: string | null | undefined;
|
|
339
339
|
weight?: number | null | undefined;
|
|
340
340
|
height?: number | null | undefined;
|
|
341
|
+
width?: number | null | undefined;
|
|
341
342
|
origin_country?: string | null | undefined;
|
|
342
343
|
material?: string | null | undefined;
|
|
343
344
|
ups?: string | null | undefined;
|
|
344
|
-
wifth?: number | null | undefined;
|
|
345
345
|
variant_rank?: number | null | undefined;
|
|
346
346
|
}>;
|
|
347
347
|
//# sourceMappingURL=algolia-product.d.ts.map
|
|
@@ -89,7 +89,7 @@ exports.AlgoliaVariantValidator = zod_1.z.object({
|
|
|
89
89
|
weight: zod_1.z.number().nullish(),
|
|
90
90
|
length: zod_1.z.number().nullish(),
|
|
91
91
|
height: zod_1.z.number().nullish(),
|
|
92
|
-
|
|
92
|
+
width: zod_1.z.number().nullish(),
|
|
93
93
|
variant_rank: zod_1.z.number().nullish(),
|
|
94
94
|
options: zod_1.z.array(zod_1.z.object({
|
|
95
95
|
id: zod_1.z.string(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/algolia/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/algolia/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA"}
|
|
@@ -19,4 +19,5 @@ __exportStar(require("./algolia-entity"), exports);
|
|
|
19
19
|
__exportStar(require("./algolia-product"), exports);
|
|
20
20
|
__exportStar(require("./algolia-review"), exports);
|
|
21
21
|
__exportStar(require("./events"), exports);
|
|
22
|
+
__exportStar(require("./module"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/algolia/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,mDAAgC;AAChC,oDAAiC;AACjC,mDAAgC;AAChC,2CAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/algolia/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,mDAAgC;AAChC,oDAAiC;AACjC,mDAAgC;AAChC,2CAAwB;AACxB,2CAAwB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IndexType } from './index-types';
|
|
2
|
+
export declare const ALGOLIA_MODULE = "algolia";
|
|
3
|
+
export type AlgoliaSearchResult<T> = {
|
|
4
|
+
hits: T[];
|
|
5
|
+
nbHits: number;
|
|
6
|
+
page: number;
|
|
7
|
+
nbPages: number;
|
|
8
|
+
hitsPerPage: number;
|
|
9
|
+
facets?: Record<string, Record<string, number>>;
|
|
10
|
+
facets_stats?: Record<string, {
|
|
11
|
+
min: number;
|
|
12
|
+
max: number;
|
|
13
|
+
avg: number;
|
|
14
|
+
sum: number;
|
|
15
|
+
}>;
|
|
16
|
+
processingTimeMS: number;
|
|
17
|
+
query: string;
|
|
18
|
+
};
|
|
19
|
+
export interface IAlgoliaModuleService {
|
|
20
|
+
search<T = Record<string, unknown>>(indexName: IndexType, params: Record<string, unknown>): Promise<AlgoliaSearchResult<T>>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/types/algolia/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,eAAO,MAAM,cAAc,YAAY,CAAA;AAEvC,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;IACnC,IAAI,EAAE,CAAC,EAAE,CAAA;IACT,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACrF,gBAAgB,EAAE,MAAM,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAA;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/types/algolia/module.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAG,SAAS,CAAA"}
|
|
@@ -21,7 +21,8 @@ export declare enum ProductRequestUpdatedEvent {
|
|
|
21
21
|
CREATED = "requests.product.created",
|
|
22
22
|
ACCEPTED = "requests.product.accepted",
|
|
23
23
|
REJECTED = "requests.product.rejected",
|
|
24
|
-
TO_CREATE = "requests.product.to_create"
|
|
24
|
+
TO_CREATE = "requests.product.to_create",
|
|
25
|
+
DELETED = "requests.product.deleted"
|
|
25
26
|
}
|
|
26
27
|
export declare enum ProductUpdateRequestUpdatedEvent {
|
|
27
28
|
CREATED = "requests.product_update.created",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/types/requests/events.ts"],"names":[],"mappings":"AAAA,oBAAY,gCAAgC;IAC1C,QAAQ,6BAA6B;IACrC,QAAQ,6BAA6B;CACtC;AAED,oBAAY,aAAa;IACvB,OAAO,4BAA4B;IACnC,SAAS,8BAA8B;CACxC;AAED,oBAAY,cAAc;IACxB,OAAO,uBAAuB;CAC/B;AAED,oBAAY,kCAAkC;IAC5C,QAAQ,uCAAuC;IAC/C,QAAQ,uCAAuC;CAChD;AAED,oBAAY,oCAAoC;IAC9C,QAAQ,yCAAyC;IACjD,QAAQ,yCAAyC;CAClD;AAED,oBAAY,0BAA0B;IACpC,OAAO,6BAA6B;IACpC,QAAQ,8BAA8B;IACtC,QAAQ,8BAA8B;IACtC,SAAS,+BAA+B;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/types/requests/events.ts"],"names":[],"mappings":"AAAA,oBAAY,gCAAgC;IAC1C,QAAQ,6BAA6B;IACrC,QAAQ,6BAA6B;CACtC;AAED,oBAAY,aAAa;IACvB,OAAO,4BAA4B;IACnC,SAAS,8BAA8B;CACxC;AAED,oBAAY,cAAc;IACxB,OAAO,uBAAuB;CAC/B;AAED,oBAAY,kCAAkC;IAC5C,QAAQ,uCAAuC;IAC/C,QAAQ,uCAAuC;CAChD;AAED,oBAAY,oCAAoC;IAC9C,QAAQ,yCAAyC;IACjD,QAAQ,yCAAyC;CAClD;AAED,oBAAY,0BAA0B;IACpC,OAAO,6BAA6B;IACpC,QAAQ,8BAA8B;IACtC,QAAQ,8BAA8B;IACtC,SAAS,+BAA+B;IACxC,OAAO,6BAA6B;CACrC;AAED,oBAAY,gCAAgC;IAC1C,OAAO,oCAAoC;IAC3C,QAAQ,qCAAqC;IAC7C,QAAQ,qCAAqC;IAC7C,SAAS,sCAAsC;CAChD;AAED,oBAAY,uCAAuC;IACjD,SAAS,8CAA8C;CACxD;AAED,oBAAY,qBAAqB;IAC/B,OAAO,+BAA+B;CACvC;AAED,oBAAY,8BAA8B;IACxC,QAAQ,mCAAmC;IAC3C,QAAQ,mCAAmC;CAC5C;AAED,oBAAY,6BAA6B;IACvC,QAAQ,kCAAkC;IAC1C,QAAQ,kCAAkC;CAC3C;AAED,oBAAY,+BAA+B;IACzC,OAAO,4BAA4B;CACpC"}
|
|
@@ -31,6 +31,7 @@ var ProductRequestUpdatedEvent;
|
|
|
31
31
|
ProductRequestUpdatedEvent["ACCEPTED"] = "requests.product.accepted";
|
|
32
32
|
ProductRequestUpdatedEvent["REJECTED"] = "requests.product.rejected";
|
|
33
33
|
ProductRequestUpdatedEvent["TO_CREATE"] = "requests.product.to_create";
|
|
34
|
+
ProductRequestUpdatedEvent["DELETED"] = "requests.product.deleted";
|
|
34
35
|
})(ProductRequestUpdatedEvent || (exports.ProductRequestUpdatedEvent = ProductRequestUpdatedEvent = {}));
|
|
35
36
|
var ProductUpdateRequestUpdatedEvent;
|
|
36
37
|
(function (ProductUpdateRequestUpdatedEvent) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/types/requests/events.ts"],"names":[],"mappings":";;;AAAA,IAAY,gCAGX;AAHD,WAAY,gCAAgC;IAC1C,yEAAqC,CAAA;IACrC,yEAAqC,CAAA;AACvC,CAAC,EAHW,gCAAgC,gDAAhC,gCAAgC,QAG3C;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oDAAmC,CAAA;IACnC,wDAAuC,CAAA;AACzC,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAED,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,gDAA8B,CAAA;AAChC,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAED,IAAY,kCAGX;AAHD,WAAY,kCAAkC;IAC5C,qFAA+C,CAAA;IAC/C,qFAA+C,CAAA;AACjD,CAAC,EAHW,kCAAkC,kDAAlC,kCAAkC,QAG7C;AAED,IAAY,oCAGX;AAHD,WAAY,oCAAoC;IAC9C,yFAAiD,CAAA;IACjD,yFAAiD,CAAA;AACnD,CAAC,EAHW,oCAAoC,oDAApC,oCAAoC,QAG/C;AAED,IAAY,
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/types/requests/events.ts"],"names":[],"mappings":";;;AAAA,IAAY,gCAGX;AAHD,WAAY,gCAAgC;IAC1C,yEAAqC,CAAA;IACrC,yEAAqC,CAAA;AACvC,CAAC,EAHW,gCAAgC,gDAAhC,gCAAgC,QAG3C;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oDAAmC,CAAA;IACnC,wDAAuC,CAAA;AACzC,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAED,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,gDAA8B,CAAA;AAChC,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAED,IAAY,kCAGX;AAHD,WAAY,kCAAkC;IAC5C,qFAA+C,CAAA;IAC/C,qFAA+C,CAAA;AACjD,CAAC,EAHW,kCAAkC,kDAAlC,kCAAkC,QAG7C;AAED,IAAY,oCAGX;AAHD,WAAY,oCAAoC;IAC9C,yFAAiD,CAAA;IACjD,yFAAiD,CAAA;AACnD,CAAC,EAHW,oCAAoC,oDAApC,oCAAoC,QAG/C;AAED,IAAY,0BAMX;AAND,WAAY,0BAA0B;IACpC,kEAAoC,CAAA;IACpC,oEAAsC,CAAA;IACtC,oEAAsC,CAAA;IACtC,sEAAwC,CAAA;IACxC,kEAAoC,CAAA;AACtC,CAAC,EANW,0BAA0B,0CAA1B,0BAA0B,QAMrC;AAED,IAAY,gCAKX;AALD,WAAY,gCAAgC;IAC1C,+EAA2C,CAAA;IAC3C,iFAA6C,CAAA;IAC7C,iFAA6C,CAAA;IAC7C,mFAA+C,CAAA;AACjD,CAAC,EALW,gCAAgC,gDAAhC,gCAAgC,QAK3C;AAED,IAAY,uCAEX;AAFD,WAAY,uCAAuC;IACjD,kGAAuD,CAAA;AACzD,CAAC,EAFW,uCAAuC,uDAAvC,uCAAuC,QAElD;AAED,IAAY,qBAEX;AAFD,WAAY,qBAAqB;IAC/B,+DAAsC,CAAA;AACxC,CAAC,EAFW,qBAAqB,qCAArB,qBAAqB,QAEhC;AAED,IAAY,8BAGX;AAHD,WAAY,8BAA8B;IACxC,6EAA2C,CAAA;IAC3C,6EAA2C,CAAA;AAC7C,CAAC,EAHW,8BAA8B,8CAA9B,8BAA8B,QAGzC;AAED,IAAY,6BAGX;AAHD,WAAY,6BAA6B;IACvC,2EAA0C,CAAA;IAC1C,2EAA0C,CAAA;AAC5C,CAAC,EAHW,6BAA6B,6CAA7B,6BAA6B,QAGxC;AAED,IAAY,+BAEX;AAFD,WAAY,+BAA+B;IACzC,sEAAmC,CAAA;AACrC,CAAC,EAFW,+BAA+B,+CAA/B,+BAA+B,QAE1C"}
|
package/dist/utils/hosts.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare const actorTypeToHost: {
|
|
|
18
18
|
seller: Hosts;
|
|
19
19
|
user: Hosts;
|
|
20
20
|
};
|
|
21
|
-
export declare const buildHostAddress: (hostType: Hosts, path?: string) => import("url").URL;
|
|
22
|
-
export declare const buildResetPasswordUrl: (hostType: Hosts, token?: string) => import("url").URL;
|
|
23
|
-
export declare const buildInviteUrl: (token: string) => import("url").URL;
|
|
21
|
+
export declare const buildHostAddress: (hostType: Hosts, path?: string) => import("node:url").URL;
|
|
22
|
+
export declare const buildResetPasswordUrl: (hostType: Hosts, token?: string) => import("node:url").URL;
|
|
23
|
+
export declare const buildInviteUrl: (token: string) => import("node:url").URL;
|
|
24
24
|
//# sourceMappingURL=hosts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosts.d.ts","sourceRoot":"","sources":["../../src/utils/hosts.ts"],"names":[],"mappings":"AAAA,oBAAY,KAAK;IACf,YAAY,qBAAqB;IACjC,UAAU,mBAAmB;IAC7B,OAAO,gBAAgB;CACxB;AAED,eAAO,MAAM,YAAY;;;;CAIxB,CAAA;AAED,eAAO,MAAM,2BAA2B;;;;CAIvC,CAAA;AAED,eAAO,MAAM,eAAe;;;;CAI3B,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,UAAU,KAAK,EAAE,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"hosts.d.ts","sourceRoot":"","sources":["../../src/utils/hosts.ts"],"names":[],"mappings":"AAAA,oBAAY,KAAK;IACf,YAAY,qBAAqB;IACjC,UAAU,mBAAmB;IAC7B,OAAO,gBAAgB;CACxB;AAED,eAAO,MAAM,YAAY;;;;CAIxB,CAAA;AAED,eAAO,MAAM,2BAA2B;;;;CAIvC,CAAA;AAED,eAAO,MAAM,eAAe;;;;CAI3B,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,UAAU,KAAK,EAAE,OAAO,MAAM,2BAE9D,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,UAAU,KAAK,EAAE,QAAQ,MAAM,2BAQpE,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,2BAK3C,CAAA"}
|
|
@@ -3,32 +3,41 @@ import { AuthenticatedMedusaRequest, MedusaResponse } from '@medusajs/framework'
|
|
|
3
3
|
type CheckResourceOwnershipByResourceIdOptions<Body> = {
|
|
4
4
|
entryPoint: string;
|
|
5
5
|
filterField?: string;
|
|
6
|
-
resourceId?: (req: AuthenticatedMedusaRequest<Body>) => string;
|
|
6
|
+
resourceId?: (req: AuthenticatedMedusaRequest<Body>) => string | string[];
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* Middleware that verifies if the authenticated member owns/has access to the requested resource.
|
|
9
|
+
* Middleware that verifies if the authenticated member owns/has access to the requested resource(s).
|
|
10
10
|
* This is done by checking if the member's seller ID matches the resource's seller ID.
|
|
11
|
+
* Supports both single resource ID and arrays of resource IDs.
|
|
11
12
|
*
|
|
12
13
|
* @param options - Configuration options for the ownership check
|
|
13
14
|
* @param options.entryPoint - The entity type to verify ownership of (e.g. 'seller_product', 'service_zone')
|
|
14
15
|
* @param options.filterField - Field used to filter/lookup the resource (defaults to 'id')
|
|
15
|
-
* @param options.
|
|
16
|
+
* @param options.resourceId - Function to extract resource ID(s) from the request (defaults to req.params.id)
|
|
16
17
|
*
|
|
17
|
-
* @throws {MedusaError} If the member does not own the
|
|
18
|
+
* @throws {MedusaError} If the member does not own any of the resources
|
|
18
19
|
*
|
|
19
20
|
* @example
|
|
20
|
-
* // Basic usage - check ownership of vendor product
|
|
21
|
-
* app.use(
|
|
21
|
+
* // Basic usage - check ownership of single vendor product
|
|
22
|
+
* app.use(checkResourceOwnershipByResourceId({
|
|
22
23
|
* entryPoint: 'seller_product'
|
|
23
24
|
* }))
|
|
24
25
|
*
|
|
25
26
|
* @example
|
|
26
27
|
* // Custom field usage - check ownership of service zone
|
|
27
|
-
* app.use(
|
|
28
|
+
* app.use(checkResourceOwnershipByResourceId({
|
|
28
29
|
* entryPoint: 'service_zone',
|
|
29
30
|
* filterField: 'service_zone_id',
|
|
30
31
|
* resourceId: (req) => req.params.zone_id
|
|
31
32
|
* }))
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Batch usage - check ownership of multiple promotions
|
|
36
|
+
* app.use(checkResourceOwnershipByResourceId({
|
|
37
|
+
* entryPoint: 'seller_promotion',
|
|
38
|
+
* filterField: 'promotion_id',
|
|
39
|
+
* resourceId: (req) => [...(req.body.add || []), ...(req.body.remove || [])]
|
|
40
|
+
* }))
|
|
32
41
|
*/
|
|
33
42
|
export declare const checkResourceOwnershipByResourceId: <Body>({ entryPoint, filterField, resourceId }: CheckResourceOwnershipByResourceIdOptions<Body>) => (req: AuthenticatedMedusaRequest<Body>, res: MedusaResponse, next: NextFunction) => Promise<void>;
|
|
34
43
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-ownership.d.ts","sourceRoot":"","sources":["../../../src/utils/middlewares/check-ownership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAMhF,KAAK,yCAAyC,CAAC,IAAI,IAAI;IACrD,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,0BAA0B,CAAC,IAAI,CAAC,KAAK,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"check-ownership.d.ts","sourceRoot":"","sources":["../../../src/utils/middlewares/check-ownership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAMhF,KAAK,yCAAyC,CAAC,IAAI,IAAI;IACrD,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,0BAA0B,CAAC,IAAI,CAAC,KAAK,MAAM,GAAG,MAAM,EAAE,CAAA;CAC1E,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,kCAAkC,GAAI,IAAI,EAAE,yCAItD,yCAAyC,CAAC,IAAI,CAAC,MAE9C,KAAK,0BAA0B,CAAC,IAAI,CAAC,EACrC,KAAK,cAAc,EACnB,MAAM,YAAY,kBA4CrB,CAAA"}
|
|
@@ -3,29 +3,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.checkResourceOwnershipByResourceId = void 0;
|
|
4
4
|
const utils_1 = require("@medusajs/framework/utils");
|
|
5
5
|
/**
|
|
6
|
-
* Middleware that verifies if the authenticated member owns/has access to the requested resource.
|
|
6
|
+
* Middleware that verifies if the authenticated member owns/has access to the requested resource(s).
|
|
7
7
|
* This is done by checking if the member's seller ID matches the resource's seller ID.
|
|
8
|
+
* Supports both single resource ID and arrays of resource IDs.
|
|
8
9
|
*
|
|
9
10
|
* @param options - Configuration options for the ownership check
|
|
10
11
|
* @param options.entryPoint - The entity type to verify ownership of (e.g. 'seller_product', 'service_zone')
|
|
11
12
|
* @param options.filterField - Field used to filter/lookup the resource (defaults to 'id')
|
|
12
|
-
* @param options.
|
|
13
|
+
* @param options.resourceId - Function to extract resource ID(s) from the request (defaults to req.params.id)
|
|
13
14
|
*
|
|
14
|
-
* @throws {MedusaError} If the member does not own the
|
|
15
|
+
* @throws {MedusaError} If the member does not own any of the resources
|
|
15
16
|
*
|
|
16
17
|
* @example
|
|
17
|
-
* // Basic usage - check ownership of vendor product
|
|
18
|
-
* app.use(
|
|
18
|
+
* // Basic usage - check ownership of single vendor product
|
|
19
|
+
* app.use(checkResourceOwnershipByResourceId({
|
|
19
20
|
* entryPoint: 'seller_product'
|
|
20
21
|
* }))
|
|
21
22
|
*
|
|
22
23
|
* @example
|
|
23
24
|
* // Custom field usage - check ownership of service zone
|
|
24
|
-
* app.use(
|
|
25
|
+
* app.use(checkResourceOwnershipByResourceId({
|
|
25
26
|
* entryPoint: 'service_zone',
|
|
26
27
|
* filterField: 'service_zone_id',
|
|
27
28
|
* resourceId: (req) => req.params.zone_id
|
|
28
29
|
* }))
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Batch usage - check ownership of multiple promotions
|
|
33
|
+
* app.use(checkResourceOwnershipByResourceId({
|
|
34
|
+
* entryPoint: 'seller_promotion',
|
|
35
|
+
* filterField: 'promotion_id',
|
|
36
|
+
* resourceId: (req) => [...(req.body.add || []), ...(req.body.remove || [])]
|
|
37
|
+
* }))
|
|
29
38
|
*/
|
|
30
39
|
const checkResourceOwnershipByResourceId = ({ entryPoint, filterField = 'id', resourceId = (req) => req.params.id }) => {
|
|
31
40
|
return async (req, res, next) => {
|
|
@@ -37,22 +46,21 @@ const checkResourceOwnershipByResourceId = ({ entryPoint, filterField = 'id', re
|
|
|
37
46
|
id: req.auth_context.actor_id
|
|
38
47
|
}
|
|
39
48
|
}, { throwIfKeyNotFound: true });
|
|
40
|
-
const
|
|
41
|
-
const
|
|
49
|
+
const ids = resourceId(req);
|
|
50
|
+
const idArray = Array.isArray(ids) ? ids : [ids];
|
|
51
|
+
if (idArray.length === 0) {
|
|
52
|
+
next();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const { data: resources } = await query.graph({
|
|
42
56
|
entity: entryPoint,
|
|
43
57
|
fields: ['seller_id'],
|
|
44
58
|
filters: {
|
|
45
|
-
[filterField]:
|
|
59
|
+
[filterField]: idArray,
|
|
60
|
+
seller_id: member.seller.id
|
|
46
61
|
}
|
|
47
62
|
});
|
|
48
|
-
if (
|
|
49
|
-
res.status(404).json({
|
|
50
|
-
message: `${entryPoint} with ${filterField}: ${id} not found`,
|
|
51
|
-
type: utils_1.MedusaError.Types.NOT_FOUND
|
|
52
|
-
});
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (member.seller.id !== resource.seller_id) {
|
|
63
|
+
if (resources.length !== idArray.length) {
|
|
56
64
|
res.status(403).json({
|
|
57
65
|
message: 'You are not allowed to perform this action',
|
|
58
66
|
type: utils_1.MedusaError.Types.NOT_ALLOWED
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-ownership.js","sourceRoot":"","sources":["../../../src/utils/middlewares/check-ownership.ts"],"names":[],"mappings":";;;AAGA,qDAGkC;AAQlC
|
|
1
|
+
{"version":3,"file":"check-ownership.js","sourceRoot":"","sources":["../../../src/utils/middlewares/check-ownership.ts"],"names":[],"mappings":";;;AAGA,qDAGkC;AAQlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACI,MAAM,kCAAkC,GAAG,CAAO,EACvD,UAAU,EACV,WAAW,GAAG,IAAI,EAClB,UAAU,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EACa,EAAE,EAAE;IACpD,OAAO,KAAK,EACV,GAAqC,EACrC,GAAmB,EACnB,IAAkB,EAClB,EAAE;QACF,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,iCAAyB,CAAC,KAAK,CAAC,CAAA;QAEhE,MAAM,EACJ,IAAI,EAAE,CAAC,MAAM,CAAC,EACf,GAAG,MAAM,KAAK,CAAC,KAAK,CACnB;YACE,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,CAAC,WAAW,CAAC;YACrB,OAAO,EAAE;gBACP,EAAE,EAAE,GAAG,CAAC,YAAY,CAAC,QAAQ;aAC9B;SACF,EACD,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAC7B,CAAA;QAED,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;QAC3B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QAEhD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,EAAE,CAAA;YACN,OAAM;QACR,CAAC;QAED,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC;YAC5C,MAAM,EAAE,UAAU;YAClB,MAAM,EAAE,CAAC,WAAW,CAAC;YACrB,OAAO,EAAE;gBACP,CAAC,WAAW,CAAC,EAAE,OAAO;gBACtB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;aAC5B;SACF,CAAC,CAAA;QAEF,IAAI,SAAS,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;YACxC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE,4CAA4C;gBACrD,IAAI,EAAE,mBAAW,CAAC,KAAK,CAAC,WAAW;aACpC,CAAC,CAAA;YACF,OAAM;QACR,CAAC;QAED,IAAI,EAAE,CAAA;IACR,CAAC,CAAA;AACH,CAAC,CAAA;AApDY,QAAA,kCAAkC,sCAoD9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-product-status.d.ts","sourceRoot":"","sources":["../../src/workflows/update-product-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,aAAa,EAAE,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"update-product-status.d.ts","sourceRoot":"","sources":["../../src/workflows/update-product-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAUlE,eAAO,MAAM,uBAAuB;QAEd,MAAM;YAAU,aAAa;wCAkBlD,CAAA;AAED,eAAO,MAAM,2BAA2B;QAEf,MAAM;YAAU,aAAa;4CAGrD,CAAA"}
|
|
@@ -3,16 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateProductStatusWorkflow = exports.updateProductStatusStep = void 0;
|
|
4
4
|
const utils_1 = require("@medusajs/framework/utils");
|
|
5
5
|
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
6
|
-
|
|
6
|
+
const events_1 = require("../types/algolia/events");
|
|
7
|
+
exports.updateProductStatusStep = (0, workflows_sdk_1.createStep)('update-product-status', async (input, { container }) => {
|
|
7
8
|
const service = container.resolve(utils_1.Modules.PRODUCT);
|
|
8
|
-
const knex = container.resolve(
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const knex = container.resolve('__pg_connection__');
|
|
10
|
+
const eventBus = container.resolve(utils_1.Modules.EVENT_BUS);
|
|
11
|
+
await knex('product').where('id', input.id).update({
|
|
12
|
+
status: input.status
|
|
11
13
|
});
|
|
12
14
|
const product = await service.retrieveProduct(input.id);
|
|
15
|
+
await eventBus.emit({
|
|
16
|
+
name: events_1.AlgoliaEvents.PRODUCTS_CHANGED,
|
|
17
|
+
data: { ids: [input.id] }
|
|
18
|
+
});
|
|
13
19
|
return new workflows_sdk_1.StepResponse(product, product.id);
|
|
14
20
|
});
|
|
15
|
-
exports.updateProductStatusWorkflow = (0, workflows_sdk_1.createWorkflow)(
|
|
21
|
+
exports.updateProductStatusWorkflow = (0, workflows_sdk_1.createWorkflow)('update-product-status', function (input) {
|
|
16
22
|
return new workflows_sdk_1.WorkflowResponse((0, exports.updateProductStatusStep)(input));
|
|
17
23
|
});
|
|
18
24
|
//# sourceMappingURL=update-product-status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-product-status.js","sourceRoot":"","sources":["../../src/workflows/update-product-status.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"update-product-status.js","sourceRoot":"","sources":["../../src/workflows/update-product-status.ts"],"names":[],"mappings":";;;AAAA,qDAAkE;AAClE,2DAKgC;AAEhC,oDAAuD;AAE1C,QAAA,uBAAuB,GAAG,IAAA,0BAAU,EAC/C,uBAAuB,EACvB,KAAK,EAAE,KAA4C,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IACpE,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,eAAO,CAAC,OAAO,CAAC,CAAA;IAClD,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACnD,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,eAAO,CAAC,SAAS,CAAC,CAAA;IAErD,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC;QACjD,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,CAAC,CAAA;IAEF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAEvD,MAAM,QAAQ,CAAC,IAAI,CAAC;QAClB,IAAI,EAAE,sBAAa,CAAC,gBAAgB;QACpC,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE;KAC1B,CAAC,CAAA;IAEF,OAAO,IAAI,4BAAY,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAA;AAC9C,CAAC,CACF,CAAA;AAEY,QAAA,2BAA2B,GAAG,IAAA,8BAAc,EACvD,uBAAuB,EACvB,UAAU,KAA4C;IACpD,OAAO,IAAI,gCAAgB,CAAC,IAAA,+BAAuB,EAAC,KAAK,CAAC,CAAC,CAAA;AAC7D,CAAC,CACF,CAAA"}
|