qumra-engine 2.0.38 → 2.0.39

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.
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.prepareDataMiddleware = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
4
8
  const prepareDataMiddleware = (req, res, next) => {
5
9
  const parsedUrl = res.locals.parsedUrl;
6
10
  // ✅ تخطي الرندر في production لبعض المسارات
@@ -25,23 +29,19 @@ const prepareDataMiddleware = (req, res, next) => {
25
29
  });
26
30
  const qdid = req.cookies.qdid || "";
27
31
  const authorization = req.cookies.authorization || "";
28
- fetch(api, {
29
- method: "POST",
32
+ axios_1.default
33
+ .post(api, { url: parsedUrl.fullUrl }, // ← body مباشرة هنا
34
+ {
30
35
  headers: {
31
36
  "Content-Type": "application/json",
32
- Cookie: `qdid=${qdid}; authorization=${authorization}`,
37
+ authorization: authorization,
38
+ qdid: qdid,
33
39
  },
34
- body: JSON.stringify({ url: parsedUrl.fullUrl }),
35
40
  })
36
41
  .then((engineResponse) => {
37
- if (!engineResponse.ok) {
38
- throw new Error("Engine response not OK");
39
- }
40
- return engineResponse.json();
41
- })
42
- .then((data) => {
43
- // تم تخزين النتيجة داخل res.locals.render
44
- res.locals.render = data.data;
42
+ // axios لا يستخدم .ok ولا .json()
43
+ // البيانات موجودة مباشرة في engineResponse.data
44
+ res.locals.render = engineResponse.data?.data;
45
45
  next();
46
46
  })
47
47
  .catch((err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qumra-engine",
3
- "version": "2.0.38",
3
+ "version": "2.0.39",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -8,6 +8,7 @@
8
8
  "pub": "tsc && npm version patch && npm publish"
9
9
  },
10
10
  "dependencies": {
11
+ "axios": "^1.10.0",
11
12
  "chalk": "^5.4.1",
12
13
  "colord": "^2.9.3",
13
14
  "cookie-parser": "^1.4.7",