@quillsql/node 0.3.3 → 0.3.5

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
+ const axios_1 = __importDefault(require("axios"));
16
+ /** This client is currently not used but is a good design pratice */
13
17
  class QuillServerClient {
14
18
  constructor(privateKey) {
15
19
  this.baseUrl = "";
@@ -17,12 +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 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();
24
+ return axios_1.default.post(`${this.baseUrl}/${route}`, payload, this.config);
26
25
  });
27
26
  }
28
27
  }
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 axios_1 = __importDefault(require("axios"));
13
17
  require("dotenv/config");
14
18
  const RunQueryProcesses_1 = require("./utils/RunQueryProcesses");
15
19
  const HOST = process.env.ENV === "development"
@@ -86,13 +90,8 @@ class QuillClass {
86
90
  }
87
91
  postQuill(path, payload) {
88
92
  return __awaiter(this, void 0, void 0, function* () {
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;
93
+ const response = yield axios_1.default.post(`${this.baseUrl}/sdk/${path}`, payload, this.config);
94
+ return response.data;
96
95
  });
97
96
  }
98
97
  close() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/node",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Quill's client SDK for node backends.",
5
5
  "main": "dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -26,6 +26,7 @@
26
26
  "typescript": "^5.3.3"
27
27
  },
28
28
  "dependencies": {
29
+ "axios": "^1.6.5",
29
30
  "dotenv": "^16.3.1",
30
31
  "pg": "^8.11.3",
31
32
  "redis": "^4.6.12",
@@ -1,3 +1,5 @@
1
+ import axios from "axios";
2
+
1
3
  /** This client is currently not used but is a good design pratice */
2
4
 
3
5
  class QuillServerClient {
@@ -14,15 +16,7 @@ class QuillServerClient {
14
16
  }
15
17
 
16
18
  public async postQuill(route: string, payload: any): Promise<any> {
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();
19
+ return axios.post(`${this.baseUrl}/${route}`, payload, this.config);
26
20
  }
27
21
  }
28
22
 
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 axios from "axios";
9
10
  import "dotenv/config";
10
11
  import {
11
12
  getTableSchema,
@@ -130,13 +131,12 @@ export default class QuillClass {
130
131
  path: string,
131
132
  payload: any
132
133
  ): Promise<QuillClientResponse> {
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;
134
+ const response = await axios.post(
135
+ `${this.baseUrl}/sdk/${path}`,
136
+ payload,
137
+ this.config
138
+ );
139
+ return response.data;
140
140
  }
141
141
 
142
142
  public async close() {