@medusajs/framework 2.21.0 → 2.21.1-preview-20260917150924

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.
@@ -0,0 +1,36 @@
1
+ import { RequestHandler } from "express";
2
+ /**
3
+ * What {@link allowSearchIndexes} adds to the request. Only `POST /store/search`
4
+ * reads it, so it is intersected into that route's request rather than carried
5
+ * by every `MedusaRequest`.
6
+ */
7
+ export type AllowedSearchIndexes = {
8
+ allowedSearchIndexes?: string[];
9
+ };
10
+ /**
11
+ * Creates a middleware that opts search indexes into `POST /store/search`.
12
+ *
13
+ * Nothing is searchable there until a middleware allows it: which of a store's
14
+ * indexes a storefront may reach is a decision the store makes server-side, so
15
+ * it is never something the request can ask for.
16
+ *
17
+ * Several middlewares can each contribute, so a plugin can expose its own index
18
+ * without discarding what the app allowed.
19
+ *
20
+ * @param indexes - The names of the indexes to expose. Accepts both single names
21
+ * and arrays of names.
22
+ *
23
+ * @example
24
+ * import { allowSearchIndexes, defineMiddlewares } from "@medusajs/framework/http"
25
+ *
26
+ * export default defineMiddlewares({
27
+ * routes: [
28
+ * {
29
+ * matcher: "/store/search",
30
+ * middlewares: [allowSearchIndexes("product")],
31
+ * },
32
+ * ],
33
+ * })
34
+ */
35
+ export declare const allowSearchIndexes: (...indexes: (string | string[])[]) => RequestHandler;
36
+ //# sourceMappingURL=allow-search-indexes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allow-search-indexes.d.ts","sourceRoot":"","sources":["../../../src/http/middlewares/allow-search-indexes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,SAAS,CAAA;AAGtD;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;CAChC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,kBAAkB,GAC7B,GAAG,SAAS,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,KAChC,cAeF,CAAA"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allowSearchIndexes = void 0;
4
+ /**
5
+ * Creates a middleware that opts search indexes into `POST /store/search`.
6
+ *
7
+ * Nothing is searchable there until a middleware allows it: which of a store's
8
+ * indexes a storefront may reach is a decision the store makes server-side, so
9
+ * it is never something the request can ask for.
10
+ *
11
+ * Several middlewares can each contribute, so a plugin can expose its own index
12
+ * without discarding what the app allowed.
13
+ *
14
+ * @param indexes - The names of the indexes to expose. Accepts both single names
15
+ * and arrays of names.
16
+ *
17
+ * @example
18
+ * import { allowSearchIndexes, defineMiddlewares } from "@medusajs/framework/http"
19
+ *
20
+ * export default defineMiddlewares({
21
+ * routes: [
22
+ * {
23
+ * matcher: "/store/search",
24
+ * middlewares: [allowSearchIndexes("product")],
25
+ * },
26
+ * ],
27
+ * })
28
+ */
29
+ const allowSearchIndexes = (...indexes) => {
30
+ const indexesToAllow = indexes.flat();
31
+ return ((req, _res, next) => {
32
+ req.allowedSearchIndexes = [
33
+ ...(req.allowedSearchIndexes ?? []),
34
+ ...indexesToAllow,
35
+ ];
36
+ next();
37
+ });
38
+ };
39
+ exports.allowSearchIndexes = allowSearchIndexes;
40
+ //# sourceMappingURL=allow-search-indexes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allow-search-indexes.js","sourceRoot":"","sources":["../../../src/http/middlewares/allow-search-indexes.ts"],"names":[],"mappings":";;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACI,MAAM,kBAAkB,GAAG,CAChC,GAAG,OAA8B,EACjB,EAAE;IAClB,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,EAAE,CAAA;IAErC,OAAO,CAAC,CACN,GAAyC,EACzC,IAAoB,EACpB,IAAkB,EACZ,EAAE;QACR,GAAG,CAAC,oBAAoB,GAAG;YACzB,GAAG,CAAC,GAAG,CAAC,oBAAoB,IAAI,EAAE,CAAC;YACnC,GAAG,cAAc;SAClB,CAAA;QAED,IAAI,EAAE,CAAA;IACR,CAAC,CAA8B,CAAA;AACjC,CAAC,CAAA;AAjBY,QAAA,kBAAkB,sBAiB9B"}
@@ -1,4 +1,5 @@
1
1
  export * from "./allow-fields-middleware";
2
+ export * from "./allow-search-indexes";
2
3
  export * from "./apply-default-filters";
3
4
  export * from "./apply-locale";
4
5
  export * from "./apply-params-as-filters";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/http/middlewares/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,8BAA8B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/http/middlewares/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,8BAA8B,CAAA"}
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./allow-fields-middleware"), exports);
18
+ __exportStar(require("./allow-search-indexes"), exports);
18
19
  __exportStar(require("./apply-default-filters"), exports);
19
20
  __exportStar(require("./apply-locale"), exports);
20
21
  __exportStar(require("./apply-params-as-filters"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/middlewares/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAAyC;AACzC,0DAAuC;AACvC,iDAA8B;AAC9B,4DAAyC;AACzC,4DAAyC;AACzC,sDAAmC;AACnC,yDAAsC;AACtC,kDAA+B;AAC/B,wDAAqC;AACrC,gDAA6B;AAC7B,+DAA4C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/middlewares/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAAyC;AACzC,yDAAsC;AACtC,0DAAuC;AACvC,iDAA8B;AAC9B,4DAAyC;AACzC,4DAAyC;AACzC,sDAAmC;AACnC,yDAAsC;AACtC,kDAA+B;AAC/B,wDAAqC;AACrC,gDAA6B;AAC7B,+DAA4C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/framework",
3
- "version": "2.21.0",
3
+ "version": "2.21.1-preview-20260917150924",
4
4
  "description": "Framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -75,18 +75,18 @@
75
75
  "test": "../../../node_modules/.bin/jest --bail --forceExit --testPathPattern=src"
76
76
  },
77
77
  "devDependencies": {
78
- "@medusajs/cli": "2.21.0"
78
+ "@medusajs/cli": "2.21.1-preview-20260917150924"
79
79
  },
80
80
  "dependencies": {
81
81
  "@aws-sdk/client-dynamodb": "^3.980.0",
82
82
  "@jercle/yargonaut": "^1.1.5",
83
- "@medusajs/deps": "2.21.0",
84
- "@medusajs/modules-sdk": "2.21.0",
85
- "@medusajs/orchestration": "2.21.0",
86
- "@medusajs/telemetry": "2.21.0",
87
- "@medusajs/types": "2.21.0",
88
- "@medusajs/utils": "2.21.0",
89
- "@medusajs/workflows-sdk": "2.21.0",
83
+ "@medusajs/deps": "2.21.1-preview-20260917150924",
84
+ "@medusajs/modules-sdk": "2.21.1-preview-20260917150924",
85
+ "@medusajs/orchestration": "2.21.1-preview-20260917150924",
86
+ "@medusajs/telemetry": "2.21.1-preview-20260917150924",
87
+ "@medusajs/types": "2.21.1-preview-20260917150924",
88
+ "@medusajs/utils": "2.21.1-preview-20260917150924",
89
+ "@medusajs/workflows-sdk": "2.21.1-preview-20260917150924",
90
90
  "@types/express": "^4.17.21",
91
91
  "chokidar": "^4.0.3",
92
92
  "compression": "^1.8.1",
@@ -106,7 +106,7 @@
106
106
  "zod-validation-error": "5.0.0"
107
107
  },
108
108
  "peerDependencies": {
109
- "@medusajs/cli": "2.21.0",
109
+ "@medusajs/cli": "2.21.1-preview-20260917150924",
110
110
  "ioredis": "^5.4.1"
111
111
  },
112
112
  "peerDependenciesMeta": {