qumra-engine 2.0.38 → 2.0.40

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 لبعض المسارات
@@ -24,24 +28,25 @@ const prepareDataMiddleware = (req, res, next) => {
24
28
  authorization: req.cookies.authorization || "",
25
29
  });
26
30
  const qdid = req.cookies.qdid || "";
27
- const authorization = req.cookies.authorization || "";
28
- fetch(api, {
29
- method: "POST",
31
+ const Authorization = req.cookies.authorization || "";
32
+ console.log({
33
+ "Content-Type": "application/json",
34
+ Authorization,
35
+ "qdid": qdid,
36
+ });
37
+ axios_1.default
38
+ .post(api, { url: parsedUrl.fullUrl }, // ← body مباشرة هنا
39
+ {
30
40
  headers: {
31
41
  "Content-Type": "application/json",
32
- Cookie: `qdid=${qdid}; authorization=${authorization}`,
42
+ Authorization,
43
+ "qdid": qdid,
33
44
  },
34
- body: JSON.stringify({ url: parsedUrl.fullUrl }),
35
45
  })
36
46
  .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;
47
+ // axios لا يستخدم .ok ولا .json()
48
+ // البيانات موجودة مباشرة في engineResponse.data
49
+ res.locals.render = engineResponse.data?.data;
45
50
  next();
46
51
  })
47
52
  .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.40",
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",