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