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