@quillsql/node 0.3.2 → 0.3.4
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.
|
@@ -12,8 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const axios_1 = __importDefault(require("axios"));
|
|
16
15
|
/** This client is currently not used but is a good design pratice */
|
|
16
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
17
17
|
class QuillServerClient {
|
|
18
18
|
constructor(privateKey) {
|
|
19
19
|
this.baseUrl = "";
|
|
@@ -21,7 +21,12 @@ class QuillServerClient {
|
|
|
21
21
|
}
|
|
22
22
|
postQuill(route, payload) {
|
|
23
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
|
|
24
|
+
const response = yield (0, node_fetch_1.default)(`${this.baseUrl}/${route}`, {
|
|
25
|
+
method: "POST",
|
|
26
|
+
headers: Object.assign(Object.assign({}, this.config.headers), { "Content-Type": "application/json" }),
|
|
27
|
+
body: JSON.stringify(payload),
|
|
28
|
+
});
|
|
29
|
+
return response.json();
|
|
25
30
|
});
|
|
26
31
|
}
|
|
27
32
|
}
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const CachedPools_1 = require("./db/CachedPools");
|
|
16
|
-
const
|
|
16
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
17
17
|
require("dotenv/config");
|
|
18
18
|
const RunQueryProcesses_1 = require("./utils/RunQueryProcesses");
|
|
19
19
|
const HOST = process.env.ENV === "development"
|
|
@@ -90,8 +90,13 @@ class QuillClass {
|
|
|
90
90
|
}
|
|
91
91
|
postQuill(path, payload) {
|
|
92
92
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
const response = yield
|
|
94
|
-
|
|
93
|
+
const response = yield (0, node_fetch_1.default)(`${this.baseUrl}/sdk/${path}`, {
|
|
94
|
+
method: "POST",
|
|
95
|
+
headers: this.config.headers,
|
|
96
|
+
body: JSON.stringify(payload),
|
|
97
|
+
});
|
|
98
|
+
const data = yield response.json();
|
|
99
|
+
return data;
|
|
95
100
|
});
|
|
96
101
|
}
|
|
97
102
|
close() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillsql/node",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Quill's client SDK for node backends.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"typescript": "^5.3.3"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"axios": "^1.6.5",
|
|
30
29
|
"dotenv": "^16.3.1",
|
|
30
|
+
"node-fetch": "^3.3.2",
|
|
31
31
|
"pg": "^8.11.3",
|
|
32
32
|
"redis": "^4.6.12",
|
|
33
33
|
"ts-jest": "^29.1.1"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
|
|
3
1
|
/** This client is currently not used but is a good design pratice */
|
|
2
|
+
import fetch from "node-fetch";
|
|
4
3
|
|
|
5
4
|
class QuillServerClient {
|
|
6
5
|
private baseUrl: string;
|
|
@@ -16,7 +15,15 @@ class QuillServerClient {
|
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
public async postQuill(route: string, payload: any): Promise<any> {
|
|
19
|
-
|
|
18
|
+
const response = await fetch(`${this.baseUrl}/${route}`, {
|
|
19
|
+
method: "POST",
|
|
20
|
+
headers: {
|
|
21
|
+
...this.config.headers,
|
|
22
|
+
"Content-Type": "application/json",
|
|
23
|
+
},
|
|
24
|
+
body: JSON.stringify(payload),
|
|
25
|
+
});
|
|
26
|
+
return response.json();
|
|
20
27
|
}
|
|
21
28
|
}
|
|
22
29
|
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
QuillQueryParams,
|
|
7
7
|
} from "./models/Quill";
|
|
8
8
|
import { CachedPool } from "./db/CachedPools";
|
|
9
|
-
import
|
|
9
|
+
import fetch from "node-fetch";
|
|
10
10
|
import "dotenv/config";
|
|
11
11
|
import {
|
|
12
12
|
getTableSchema,
|
|
@@ -131,12 +131,13 @@ export default class QuillClass {
|
|
|
131
131
|
path: string,
|
|
132
132
|
payload: any
|
|
133
133
|
): Promise<QuillClientResponse> {
|
|
134
|
-
const response = await
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
);
|
|
139
|
-
|
|
134
|
+
const response = await fetch(`${this.baseUrl}/sdk/${path}`, {
|
|
135
|
+
method: "POST",
|
|
136
|
+
headers: this.config.headers,
|
|
137
|
+
body: JSON.stringify(payload),
|
|
138
|
+
});
|
|
139
|
+
const data = await response.json();
|
|
140
|
+
return data as QuillClientResponse;
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
public async close() {
|