@medusajs/medusa 2.0.5-preview-20241121120155 → 2.0.5-preview-20241121180154

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ exports.POST = void 0;
4
4
  const core_flows_1 = require("@medusajs/core-flows");
5
5
  const helpers_1 = require("../../helpers");
6
6
  const POST = async (req, res) => {
7
- const workflow = (0, core_flows_1.updateCartCustomerWorkflow)(req.scope);
7
+ const workflow = (0, core_flows_1.transferCartCustomerWorkflow)(req.scope);
8
8
  await workflow.run({
9
9
  input: {
10
10
  id: req.params.id,
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../src/api/store/carts/[id]/customer/route.ts"],"names":[],"mappings":";;;AAAA,qDAAiE;AAOjE,2CAA2C;AAEpC,MAAM,IAAI,GAAG,KAAK,EACvB,GAA+B,EAC/B,GAAgD,EAChD,EAAE;IACF,MAAM,QAAQ,GAAG,IAAA,uCAA0B,EAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAEtD,MAAM,QAAQ,CAAC,GAAG,CAAC;QACjB,KAAK,EAAE;YACL,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE;YACjB,WAAW,EAAE,GAAG,CAAC,YAAY,EAAE,QAAQ;SACxC;KACF,CAAC,CAAA;IAEF,MAAM,IAAI,GAAG,MAAM,IAAA,qBAAW,EAC5B,GAAG,CAAC,MAAM,CAAC,EAAE,EACb,GAAG,CAAC,KAAK,EACT,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAC7B,CAAA;IAED,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;AAChC,CAAC,CAAA;AApBY,QAAA,IAAI,QAoBhB"}
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../src/api/store/carts/[id]/customer/route.ts"],"names":[],"mappings":";;;AAAA,qDAAmE;AAOnE,2CAA2C;AAEpC,MAAM,IAAI,GAAG,KAAK,EACvB,GAA+B,EAC/B,GAAgD,EAChD,EAAE;IACF,MAAM,QAAQ,GAAG,IAAA,yCAA4B,EAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAExD,MAAM,QAAQ,CAAC,GAAG,CAAC;QACjB,KAAK,EAAE;YACL,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE;YACjB,WAAW,EAAE,GAAG,CAAC,YAAY,EAAE,QAAQ;SACxC;KACF,CAAC,CAAA;IAEF,MAAM,IAAI,GAAG,MAAM,IAAA,qBAAW,EAC5B,GAAG,CAAC,MAAM,CAAC,EAAE,EACb,GAAG,CAAC,KAAK,EACT,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAC7B,CAAA;IAED,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;AAChC,CAAC,CAAA;AApBY,QAAA,IAAI,QAoBhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/api/store/orders/[id]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAGrD,eAAO,MAAM,GAAG,QACT,aAAa,OACb,cAAc,CAAC,SAAS,CAAC,kBAAkB,CAAC,kBAWlD,CAAA"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/api/store/orders/[id]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAGrD,eAAO,MAAM,GAAG,QACT,aAAa,OACb,cAAc,CAAC,SAAS,CAAC,kBAAkB,CAAC,kBAclD,CAAA"}
@@ -9,6 +9,9 @@ const GET = async (req, res) => {
9
9
  input: {
10
10
  fields: req.remoteQueryConfig.fields,
11
11
  order_id: req.params.id,
12
+ filters: {
13
+ is_draft_order: false,
14
+ },
12
15
  },
13
16
  });
14
17
  res.status(200).json({ order: result });
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../src/api/store/orders/[id]/route.ts"],"names":[],"mappings":";;;AAAA,qDAA6D;AAI7D,0FAA0F;AACnF,MAAM,GAAG,GAAG,KAAK,EACtB,GAAkB,EAClB,GAAiD,EACjD,EAAE;IACF,MAAM,QAAQ,GAAG,IAAA,mCAAsB,EAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAClD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC;QACpC,KAAK,EAAE;YACL,MAAM,EAAE,GAAG,CAAC,iBAAiB,CAAC,MAAM;YACpC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE;SACxB;KACF,CAAC,CAAA;IAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAA8B,EAAE,CAAC,CAAA;AACjE,CAAC,CAAA;AAbY,QAAA,GAAG,OAaf"}
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../src/api/store/orders/[id]/route.ts"],"names":[],"mappings":";;;AAAA,qDAA6D;AAI7D,0FAA0F;AACnF,MAAM,GAAG,GAAG,KAAK,EACtB,GAAkB,EAClB,GAAiD,EACjD,EAAE;IACF,MAAM,QAAQ,GAAG,IAAA,mCAAsB,EAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAClD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC;QACpC,KAAK,EAAE;YACL,MAAM,EAAE,GAAG,CAAC,iBAAiB,CAAC,MAAM;YACpC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE;YACvB,OAAO,EAAE;gBACP,cAAc,EAAE,KAAK;aACtB;SACF;KACF,CAAC,CAAA;IAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAA8B,EAAE,CAAC,CAAA;AACjE,CAAC,CAAA;AAhBY,QAAA,GAAG,OAgBf"}
@@ -1 +1 @@
1
- {"version":3,"file":"middlewares.d.ts","sourceRoot":"","sources":["../../../../src/api/store/orders/middlewares.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEhB,MAAM,0BAA0B,CAAA;AAWjC,eAAO,MAAM,2BAA2B,EAAE,eAAe,EA6CxD,CAAA"}
1
+ {"version":3,"file":"middlewares.d.ts","sourceRoot":"","sources":["../../../../src/api/store/orders/middlewares.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAEhB,MAAM,0BAA0B,CAAA;AAUjC,eAAO,MAAM,2BAA2B,EAAE,eAAe,EA6CxD,CAAA"}
@@ -24,9 +24,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.storeOrderRoutesMiddlewares = void 0;
27
+ const framework_1 = require("@medusajs/framework");
27
28
  const http_1 = require("@medusajs/framework/http");
28
29
  const authenticate_middleware_1 = require("../../../utils/middlewares/authenticate-middleware");
29
- const framework_1 = require("@medusajs/framework");
30
30
  const QueryConfig = __importStar(require("./query-config"));
31
31
  const validators_1 = require("./validators");
32
32
  exports.storeOrderRoutesMiddlewares = [
@@ -1 +1 @@
1
- {"version":3,"file":"middlewares.js","sourceRoot":"","sources":["../../../../src/api/store/orders/middlewares.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAGiC;AACjC,gGAAiF;AACjF,mDAA+D;AAC/D,4DAA6C;AAC7C,6CAKqB;AAER,QAAA,2BAA2B,GAAsB;IAC5D;QACE,MAAM,EAAE,CAAC,KAAK,CAAC;QACf,OAAO,EAAE,eAAe;QACxB,WAAW,EAAE;YACX,IAAA,sCAAY,EAAC,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAC/C,IAAA,qCAAyB,EACvB,iCAAoB,EACpB,WAAW,CAAC,wBAAwB,CACrC;SACF;KACF;IACD;QACE,MAAM,EAAE,CAAC,KAAK,CAAC;QACf,OAAO,EAAE,mBAAmB;QAC5B,WAAW,EAAE;YACX,IAAA,qCAAyB,EACvB,gCAAmB,EACnB,WAAW,CAAC,4BAA4B,CACzC;SACF;KACF;IACD;QACE,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,OAAO,EAAE,oCAAoC;QAC7C,WAAW,EAAE;YACX,IAAA,sCAAY,EAAC,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAC/C,IAAA,+BAAwB,EAAC,sCAAyB,CAAC;YACnD,IAAA,qCAAyB,EACvB,gCAAmB,EACnB,WAAW,CAAC,4BAA4B,CACzC;SACF;KACF;IACD;QACE,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,OAAO,EAAE,mCAAmC;QAC5C,WAAW,EAAE;YACX,IAAA,+BAAwB,EAAC,qCAAwB,CAAC;YAClD,IAAA,qCAAyB,EACvB,gCAAmB,EACnB,WAAW,CAAC,4BAA4B,CACzC;SACF;KACF;CACF,CAAA"}
1
+ {"version":3,"file":"middlewares.js","sourceRoot":"","sources":["../../../../src/api/store/orders/middlewares.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA+D;AAC/D,mDAGiC;AACjC,gGAAiF;AACjF,4DAA6C;AAC7C,6CAKqB;AAER,QAAA,2BAA2B,GAAsB;IAC5D;QACE,MAAM,EAAE,CAAC,KAAK,CAAC;QACf,OAAO,EAAE,eAAe;QACxB,WAAW,EAAE;YACX,IAAA,sCAAY,EAAC,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAC/C,IAAA,qCAAyB,EACvB,iCAAoB,EACpB,WAAW,CAAC,wBAAwB,CACrC;SACF;KACF;IACD;QACE,MAAM,EAAE,CAAC,KAAK,CAAC;QACf,OAAO,EAAE,mBAAmB;QAC5B,WAAW,EAAE;YACX,IAAA,qCAAyB,EACvB,gCAAmB,EACnB,WAAW,CAAC,4BAA4B,CACzC;SACF;KACF;IACD;QACE,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,OAAO,EAAE,oCAAoC;QAC7C,WAAW,EAAE;YACX,IAAA,sCAAY,EAAC,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAC/C,IAAA,+BAAwB,EAAC,sCAAyB,CAAC;YACnD,IAAA,qCAAyB,EACvB,gCAAmB,EACnB,WAAW,CAAC,4BAA4B,CACzC;SACF;KACF;IACD;QACE,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,OAAO,EAAE,mCAAmC;QAC5C,WAAW,EAAE;YACX,IAAA,+BAAwB,EAAC,qCAAwB,CAAC;YAClD,IAAA,qCAAyB,EACvB,gCAAmB,EACnB,WAAW,CAAC,4BAA4B,CACzC;SACF;KACF;CACF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/api/store/orders/route.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACf,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,SAAS,EAAY,MAAM,2BAA2B,CAAA;AAE/D,eAAO,MAAM,GAAG,QACT,0BAA0B,CAAC,SAAS,CAAC,iBAAiB,CAAC,OACvD,cAAc,CAAC,SAAS,CAAC,sBAAsB,CAAC,kBA6BtD,CAAA"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/api/store/orders/route.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACf,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,SAAS,EAAY,MAAM,2BAA2B,CAAA;AAE/D,eAAO,MAAM,GAAG,QACT,0BAA0B,CAAC,SAAS,CAAC,iBAAiB,CAAC,OACvD,cAAc,CAAC,SAAS,CAAC,sBAAsB,CAAC,kBA8BtD,CAAA"}
@@ -6,6 +6,7 @@ const GET = async (req, res) => {
6
6
  const variables = {
7
7
  filters: {
8
8
  ...req.filterableFields,
9
+ is_draft_order: false,
9
10
  customer_id: req.auth_context.actor_id,
10
11
  },
11
12
  ...req.remoteQueryConfig.pagination,
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../src/api/store/orders/route.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAOrD,MAAM,GAAG,GAAG,KAAK,EACtB,GAA4D,EAC5D,GAAqD,EACrD,EAAE;IACF,MAAM,SAAS,GAAG;QAChB,OAAO,EAAE;YACP,GAAG,GAAG,CAAC,gBAAgB;YACvB,WAAW,EAAE,GAAG,CAAC,YAAY,CAAC,QAAQ;SACvC;QACD,GAAG,GAAG,CAAC,iBAAiB,CAAC,UAAU;KACpC,CAAA;IAED,MAAM,QAAQ,GAAG,IAAA,kCAAqB,EAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACjD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC;QACpC,KAAK,EAAE;YACL,MAAM,EAAE,GAAG,CAAC,iBAAiB,CAAC,MAAM;YACpC,SAAS;SACV;KACF,CAAC,CAAA;IAEF,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,MAG1B,CAAA;IAED,GAAG,CAAC,IAAI,CAAC;QACP,MAAM,EAAE,IAAyC;QACjD,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,MAAM,EAAE,QAAQ,CAAC,IAAI;QACrB,KAAK,EAAE,QAAQ,CAAC,IAAI;KACrB,CAAC,CAAA;AACJ,CAAC,CAAA;AA/BY,QAAA,GAAG,OA+Bf"}
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../src/api/store/orders/route.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAOrD,MAAM,GAAG,GAAG,KAAK,EACtB,GAA4D,EAC5D,GAAqD,EACrD,EAAE;IACF,MAAM,SAAS,GAAG;QAChB,OAAO,EAAE;YACP,GAAG,GAAG,CAAC,gBAAgB;YACvB,cAAc,EAAE,KAAK;YACrB,WAAW,EAAE,GAAG,CAAC,YAAY,CAAC,QAAQ;SACvC;QACD,GAAG,GAAG,CAAC,iBAAiB,CAAC,UAAU;KACpC,CAAA;IAED,MAAM,QAAQ,GAAG,IAAA,kCAAqB,EAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACjD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC;QACpC,KAAK,EAAE;YACL,MAAM,EAAE,GAAG,CAAC,iBAAiB,CAAC,MAAM;YACpC,SAAS;SACV;KACF,CAAC,CAAA;IAEF,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,MAG1B,CAAA;IAED,GAAG,CAAC,IAAI,CAAC;QACP,MAAM,EAAE,IAAyC;QACjD,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,MAAM,EAAE,QAAQ,CAAC,IAAI;QACrB,KAAK,EAAE,QAAQ,CAAC,IAAI;KACrB,CAAC,CAAA;AACJ,CAAC,CAAA;AAhCY,QAAA,GAAG,OAgCf"}
@@ -1 +1 @@
1
- {"version":3,"file":"middlewares.d.ts","sourceRoot":"","sources":["../../../../src/api/store/products/middlewares.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,eAAe,EAEhB,MAAM,0BAA0B,CAAA;AAYjC,eAAO,MAAM,6BAA6B,EAAE,eAAe,EAwE1D,CAAA"}
1
+ {"version":3,"file":"middlewares.d.ts","sourceRoot":"","sources":["../../../../src/api/store/products/middlewares.ts"],"names":[],"mappings":"AACA,OAAO,EAML,eAAe,EAEhB,MAAM,0BAA0B,CAAA;AAYjC,eAAO,MAAM,6BAA6B,EAAE,eAAe,EA8E1D,CAAA"}
@@ -24,10 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.storeProductRoutesMiddlewares = void 0;
27
- const utils_1 = require("@medusajs/framework/utils");
27
+ const framework_1 = require("@medusajs/framework");
28
28
  const http_1 = require("@medusajs/framework/http");
29
+ const utils_1 = require("@medusajs/framework/utils");
29
30
  const middlewares_1 = require("../../utils/middlewares");
30
- const framework_1 = require("@medusajs/framework");
31
31
  const helpers_1 = require("./helpers");
32
32
  const QueryConfig = __importStar(require("./query-config"));
33
33
  const validators_1 = require("./validators");
@@ -36,6 +36,9 @@ exports.storeProductRoutesMiddlewares = [
36
36
  method: ["GET"],
37
37
  matcher: "/store/products",
38
38
  middlewares: [
39
+ (0, http_1.authenticate)("customer", ["session", "bearer"], {
40
+ allowUnauthenticated: true,
41
+ }),
39
42
  (0, framework_1.validateAndTransformQuery)(validators_1.StoreGetProductsParams, QueryConfig.listProductQueryConfig),
40
43
  (0, middlewares_1.filterByValidSalesChannels)(),
41
44
  (0, http_1.setContext)({
@@ -68,6 +71,9 @@ exports.storeProductRoutesMiddlewares = [
68
71
  method: ["GET"],
69
72
  matcher: "/store/products/:id",
70
73
  middlewares: [
74
+ (0, http_1.authenticate)("customer", ["session", "bearer"], {
75
+ allowUnauthenticated: true,
76
+ }),
71
77
  (0, framework_1.validateAndTransformQuery)(validators_1.StoreGetProductsParams, QueryConfig.retrieveProductQueryConfig),
72
78
  (0, http_1.applyParamsAsFilters)({ id: "id" }),
73
79
  (0, middlewares_1.filterByValidSalesChannels)(),
@@ -1 +1 @@
1
- {"version":3,"file":"middlewares.js","sourceRoot":"","sources":["../../../../src/api/store/products/middlewares.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAoE;AACpE,mDAOiC;AACjC,yDAKgC;AAChC,mDAA+D;AAC/D,uCAAqD;AACrD,4DAA6C;AAC7C,6CAAqD;AAExC,QAAA,6BAA6B,GAAsB;IAC9D;QACE,MAAM,EAAE,CAAC,KAAK,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AC7C,CAAC;YACF,IAAA,2BAAoB,EAAC;gBACnB,UAAU,EAAE,uBAAuB;gBACnC,UAAU,EAAE,YAAY;gBACxB,eAAe,EAAE,kBAAkB;aACpC,CAAC;YACF,IAAA,0BAAmB,EAAC;gBAClB,MAAM,EAAE,qBAAa,CAAC,SAAS;gBAC/B,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAgB,EAAE,EAAE;oBACzC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;wBAC5D,OAAM;oBACR,CAAC;oBAED,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;gBAChD,CAAC;aACF,CAAC;YACF,IAAA,qCAAuB,GAAE;YACzB,IAAA,+BAAiB,GAAE;YACnB,IAAA,2BAAa,GAAE;YACf,IAAA,wBAAiB,EAAC,CAAC,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;SACxE;KACF;CACF,CAAA"}
1
+ {"version":3,"file":"middlewares.js","sourceRoot":"","sources":["../../../../src/api/store/products/middlewares.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA+D;AAC/D,mDAQiC;AACjC,qDAAoE;AACpE,yDAKgC;AAChC,uCAAqD;AACrD,4DAA6C;AAC7C,6CAAqD;AAExC,QAAA,6BAA6B,GAAsB;IAC9D;QACE,MAAM,EAAE,CAAC,KAAK,CAAC;QACf,OAAO,EAAE,iBAAiB;QAC1B,WAAW,EAAE;YACX,IAAA,mBAAY,EAAC,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE;gBAC9C,oBAAoB,EAAE,IAAI;aAC3B,CAAC;YACF,IAAA,qCAAyB,EACvB,mCAAsB,EACtB,WAAW,CAAC,sBAAsB,CACnC;YACD,IAAA,wCAA0B,GAAE;YAC5B,I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C;gBACnB,UAAU,EAAE,uBAAuB;gBACnC,UAAU,EAAE,YAAY;gBACxB,eAAe,EAAE,kBAAkB;aACpC,CAAC;YACF,IAAA,0BAAmB,EAAC;gBAClB,MAAM,EAAE,qBAAa,CAAC,SAAS;gBAC/B,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAgB,EAAE,EAAE;oBACzC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;wBAC5D,OAAM;oBACR,CAAC;oBAED,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;gBAChD,CAAC;aACF,CAAC;YACF,IAAA,qCAAuB,GAAE;YACzB,IAAA,+BAAiB,GAAE;YACnB,IAAA,2BAAa,GAAE;YACf,IAAA,wBAAiB,EAAC,CAAC,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;SACxE;KACF;CACF,CAAA"}
@@ -1,4 +1,4 @@
1
- import { NextFunction } from "express";
2
1
  import { AuthenticatedMedusaRequest } from "@medusajs/framework/http";
2
+ import { NextFunction } from "express";
3
3
  export declare function setPricingContext(): (req: AuthenticatedMedusaRequest, _: any, next: NextFunction) => Promise<void>;
4
4
  //# sourceMappingURL=set-pricing-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"set-pricing-context.d.ts","sourceRoot":"","sources":["../../../../../src/api/utils/middlewares/products/set-pricing-context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EACL,0BAA0B,EAG3B,MAAM,0BAA0B,CAAA;AAEjC,wBAAgB,iBAAiB,UACZ,0BAA0B,gBAAW,YAAY,mBA+CrE"}
1
+ {"version":3,"file":"set-pricing-context.d.ts","sourceRoot":"","sources":["../../../../../src/api/utils/middlewares/products/set-pricing-context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAG3B,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,wBAAgB,iBAAiB,UACZ,0BAA0B,gBAAW,YAAY,mBA+CrE"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setPricingContext = setPricingContext;
4
- const utils_1 = require("@medusajs/framework/utils");
5
4
  const http_1 = require("@medusajs/framework/http");
5
+ const utils_1 = require("@medusajs/framework/utils");
6
6
  function setPricingContext() {
7
7
  return async (req, _, next) => {
8
8
  const withCalculatedPrice = req.remoteQueryConfig.fields.some((field) => field.startsWith("variants.calculated_price"));
@@ -24,8 +24,8 @@ function setPricingContext() {
24
24
  currency_code: region.currency_code,
25
25
  };
26
26
  // Find all the customer groups the customer is a part of and set
27
- if (req.user?.customer_id) {
28
- const customerGroups = await (0, http_1.refetchEntities)("customer_group", { customer_id: req.user?.customer_id }, req.scope, ["id"]);
27
+ if (req.auth_context?.actor_id) {
28
+ const customerGroups = await (0, http_1.refetchEntities)("customer_group", { customers: { id: req.auth_context.actor_id } }, req.scope, ["id"]);
29
29
  pricingContext.customer_group_id = customerGroups.map((cg) => cg.id);
30
30
  }
31
31
  req.pricingContext = pricingContext;
@@ -1 +1 @@
1
- {"version":3,"file":"set-pricing-context.js","sourceRoot":"","sources":["../../../../../src/api/utils/middlewares/products/set-pricing-context.ts"],"names":[],"mappings":";;AASA,8CAgDC;AAxDD,qDAAuD;AAEvD,mDAIiC;AAEjC,SAAgB,iBAAiB;IAC/B,OAAO,KAAK,EAAE,GAA+B,EAAE,CAAC,EAAE,IAAkB,EAAE,EAAE;QACtE,MAAM,mBAAmB,GAAG,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CACtE,KAAK,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAC9C,CAAA;QACD,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACzB,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;QAED,uDAAuD;QACvD,MAAM,MAAM,GAAG,MAAM,IAAA,oBAAa,EAChC,QAAQ,EACR,GAAG,CAAC,gBAAgB,CAAC,SAAU,EAC/B,GAAG,CAAC,KAAK,EACT,CAAC,IAAI,EAAE,eAAe,CAAC,CACxB,CAAA;QAED,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC;gBACH,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,kBAAkB,GAAG,CAAC,gBAAgB,CAAC,SAAS,gDAAgD,CACjG,CAAA;YACH,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,IAAI,CAAC,CAAC,CAAC,CAAA;YAChB,CAAC;QACH,CAAC;QAED,MAAM,cAAc,GAAyB;YAC3C,SAAS,EAAE,MAAM,CAAC,EAAE;YACpB,aAAa,EAAE,MAAM,CAAC,aAAa;SACpC,CAAA;QAED,iEAAiE;QACjE,IAAI,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC;YAC1B,MAAM,cAAc,GAAG,MAAM,IAAA,sBAAe,EAC1C,gBAAgB,EAChB,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,EACtC,GAAG,CAAC,KAAK,EACT,CAAC,IAAI,CAAC,CACP,CAAA;YAED,cAAc,CAAC,iBAAiB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;QACtE,CAAC;QAED,GAAG,CAAC,cAAc,GAAG,cAAc,CAAA;QACnC,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"set-pricing-context.js","sourceRoot":"","sources":["../../../../../src/api/utils/middlewares/products/set-pricing-context.ts"],"names":[],"mappings":";;AASA,8CA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,iBAAiB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;QACtE,CAAC;QAED,GAAG,CAAC,cAAc,GAAG,cAAc,CAAA;QACnC,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/medusa",
3
- "version": "2.0.5-preview-20241121120155",
3
+ "version": "2.0.5-preview-20241121180154",
4
4
  "description": "Building blocks for digital commerce",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -43,7 +43,7 @@
43
43
  "test": "jest --silent --bail --maxWorkers=50% --forceExit"
44
44
  },
45
45
  "devDependencies": {
46
- "@medusajs/framework": "2.0.5-preview-20241121120155",
46
+ "@medusajs/framework": "2.0.5-preview-20241121180154",
47
47
  "@opentelemetry/api": "^1.9.0",
48
48
  "@opentelemetry/instrumentation": "^0.53.0",
49
49
  "@opentelemetry/instrumentation-pg": "^0.44.0",
@@ -62,49 +62,49 @@
62
62
  "dependencies": {
63
63
  "@inquirer/checkbox": "^2.3.11",
64
64
  "@inquirer/input": "^2.2.9",
65
- "@medusajs/admin-bundler": "2.0.5-preview-20241121120155",
66
- "@medusajs/api-key": "2.0.5-preview-20241121120155",
67
- "@medusajs/auth": "2.0.5-preview-20241121120155",
68
- "@medusajs/auth-emailpass": "2.0.5-preview-20241121120155",
69
- "@medusajs/auth-github": "2.0.5-preview-20241121120155",
70
- "@medusajs/auth-google": "2.0.5-preview-20241121120155",
71
- "@medusajs/cache-inmemory": "2.0.5-preview-20241121120155",
72
- "@medusajs/cache-redis": "2.0.5-preview-20241121120155",
73
- "@medusajs/cart": "2.0.5-preview-20241121120155",
74
- "@medusajs/core-flows": "2.0.5-preview-20241121120155",
75
- "@medusajs/currency": "2.0.5-preview-20241121120155",
76
- "@medusajs/customer": "2.0.5-preview-20241121120155",
77
- "@medusajs/event-bus-local": "2.0.5-preview-20241121120155",
78
- "@medusajs/event-bus-redis": "2.0.5-preview-20241121120155",
79
- "@medusajs/file": "2.0.5-preview-20241121120155",
80
- "@medusajs/file-local": "2.0.5-preview-20241121120155",
81
- "@medusajs/file-s3": "2.0.5-preview-20241121120155",
82
- "@medusajs/fulfillment": "2.0.5-preview-20241121120155",
83
- "@medusajs/fulfillment-manual": "2.0.5-preview-20241121120155",
84
- "@medusajs/index": "2.0.5-preview-20241121120155",
85
- "@medusajs/inventory": "2.0.5-preview-20241121120155",
86
- "@medusajs/link-modules": "2.0.5-preview-20241121120155",
87
- "@medusajs/locking": "2.0.5-preview-20241121120155",
88
- "@medusajs/locking-postgres": "2.0.5-preview-20241121120155",
89
- "@medusajs/locking-redis": "2.0.5-preview-20241121120155",
90
- "@medusajs/notification": "2.0.5-preview-20241121120155",
91
- "@medusajs/notification-local": "2.0.5-preview-20241121120155",
92
- "@medusajs/notification-sendgrid": "2.0.5-preview-20241121120155",
93
- "@medusajs/order": "2.0.5-preview-20241121120155",
94
- "@medusajs/payment": "2.0.5-preview-20241121120155",
95
- "@medusajs/payment-stripe": "2.0.5-preview-20241121120155",
96
- "@medusajs/pricing": "2.0.5-preview-20241121120155",
97
- "@medusajs/product": "2.0.5-preview-20241121120155",
98
- "@medusajs/promotion": "2.0.5-preview-20241121120155",
99
- "@medusajs/region": "2.0.5-preview-20241121120155",
100
- "@medusajs/sales-channel": "2.0.5-preview-20241121120155",
101
- "@medusajs/stock-location": "2.0.5-preview-20241121120155",
102
- "@medusajs/store": "2.0.5-preview-20241121120155",
103
- "@medusajs/tax": "2.0.5-preview-20241121120155",
104
- "@medusajs/telemetry": "2.0.5-preview-20241121120155",
105
- "@medusajs/user": "2.0.5-preview-20241121120155",
106
- "@medusajs/workflow-engine-inmemory": "2.0.5-preview-20241121120155",
107
- "@medusajs/workflow-engine-redis": "2.0.5-preview-20241121120155",
65
+ "@medusajs/admin-bundler": "2.0.5-preview-20241121180154",
66
+ "@medusajs/api-key": "2.0.5-preview-20241121180154",
67
+ "@medusajs/auth": "2.0.5-preview-20241121180154",
68
+ "@medusajs/auth-emailpass": "2.0.5-preview-20241121180154",
69
+ "@medusajs/auth-github": "2.0.5-preview-20241121180154",
70
+ "@medusajs/auth-google": "2.0.5-preview-20241121180154",
71
+ "@medusajs/cache-inmemory": "2.0.5-preview-20241121180154",
72
+ "@medusajs/cache-redis": "2.0.5-preview-20241121180154",
73
+ "@medusajs/cart": "2.0.5-preview-20241121180154",
74
+ "@medusajs/core-flows": "2.0.5-preview-20241121180154",
75
+ "@medusajs/currency": "2.0.5-preview-20241121180154",
76
+ "@medusajs/customer": "2.0.5-preview-20241121180154",
77
+ "@medusajs/event-bus-local": "2.0.5-preview-20241121180154",
78
+ "@medusajs/event-bus-redis": "2.0.5-preview-20241121180154",
79
+ "@medusajs/file": "2.0.5-preview-20241121180154",
80
+ "@medusajs/file-local": "2.0.5-preview-20241121180154",
81
+ "@medusajs/file-s3": "2.0.5-preview-20241121180154",
82
+ "@medusajs/fulfillment": "2.0.5-preview-20241121180154",
83
+ "@medusajs/fulfillment-manual": "2.0.5-preview-20241121180154",
84
+ "@medusajs/index": "2.0.5-preview-20241121180154",
85
+ "@medusajs/inventory": "2.0.5-preview-20241121180154",
86
+ "@medusajs/link-modules": "2.0.5-preview-20241121180154",
87
+ "@medusajs/locking": "2.0.5-preview-20241121180154",
88
+ "@medusajs/locking-postgres": "2.0.5-preview-20241121180154",
89
+ "@medusajs/locking-redis": "2.0.5-preview-20241121180154",
90
+ "@medusajs/notification": "2.0.5-preview-20241121180154",
91
+ "@medusajs/notification-local": "2.0.5-preview-20241121180154",
92
+ "@medusajs/notification-sendgrid": "2.0.5-preview-20241121180154",
93
+ "@medusajs/order": "2.0.5-preview-20241121180154",
94
+ "@medusajs/payment": "2.0.5-preview-20241121180154",
95
+ "@medusajs/payment-stripe": "2.0.5-preview-20241121180154",
96
+ "@medusajs/pricing": "2.0.5-preview-20241121180154",
97
+ "@medusajs/product": "2.0.5-preview-20241121180154",
98
+ "@medusajs/promotion": "2.0.5-preview-20241121180154",
99
+ "@medusajs/region": "2.0.5-preview-20241121180154",
100
+ "@medusajs/sales-channel": "2.0.5-preview-20241121180154",
101
+ "@medusajs/stock-location": "2.0.5-preview-20241121180154",
102
+ "@medusajs/store": "2.0.5-preview-20241121180154",
103
+ "@medusajs/tax": "2.0.5-preview-20241121180154",
104
+ "@medusajs/telemetry": "2.0.5-preview-20241121180154",
105
+ "@medusajs/user": "2.0.5-preview-20241121180154",
106
+ "@medusajs/workflow-engine-inmemory": "2.0.5-preview-20241121180154",
107
+ "@medusajs/workflow-engine-redis": "2.0.5-preview-20241121180154",
108
108
  "@swc/core": "1.5.7",
109
109
  "@swc/helpers": "^0.5.11",
110
110
  "@types/express": "^4.17.17",
@@ -125,7 +125,7 @@
125
125
  "zod": "3.22.4"
126
126
  },
127
127
  "peerDependencies": {
128
- "@medusajs/framework": "2.0.5-preview-20241121120155",
128
+ "@medusajs/framework": "2.0.5-preview-20241121180154",
129
129
  "@mikro-orm/core": "5.9.7",
130
130
  "@mikro-orm/knex": "5.9.7",
131
131
  "@mikro-orm/migrations": "5.9.7",