@quillsql/node 0.3.0 → 0.3.2

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,41 +1,32 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const _1 = __importDefault(require("."));
16
- require("dotenv/config");
17
- const HOST = process.env.ENV === "development"
18
- ? "http://localhost:8080"
19
- : "https://quill-344421.uc.r.appspot.com";
20
- describe("Quill", () => {
21
- let quill;
22
- beforeEach(() => {
23
- quill = new _1.default(process.env.QUILL_PRIVATE_KEY, process.env.DB_URL);
24
- });
25
- afterAll(() => {
26
- jest.restoreAllMocks();
27
- });
28
- describe("query", () => {
29
- it("org - should return ", () => __awaiter(void 0, void 0, void 0, function* () {
30
- const metadata = {
31
- task: "orgs",
32
- clientId: "62cda15d7c9fcca7bc0a3689",
33
- };
34
- const result = yield quill.query({
35
- orgId: "2",
36
- metadata,
37
- });
38
- // TODO - add assertions
39
- }));
40
- });
41
- });
2
+ // import Quill from ".";
3
+ // import "dotenv/config";
4
+ // const HOST =
5
+ // process.env.ENV === "development"
6
+ // ? "http://localhost:8080"
7
+ // : "https://quill-344421.uc.r.appspot.com";
8
+ // describe("Quill", () => {
9
+ // let quill: Quill;
10
+ // beforeEach(() => {
11
+ // quill = new Quill(
12
+ // process.env.QUILL_PRIVATE_KEY as string,
13
+ // process.env.DB_URL as string
14
+ // );
15
+ // });
16
+ // afterAll(() => {
17
+ // jest.restoreAllMocks();
18
+ // });
19
+ // describe("query", () => {
20
+ // it("org - should return ", async () => {
21
+ // const metadata = {
22
+ // task: "orgs",
23
+ // clientId: "62cda15d7c9fcca7bc0a3689",
24
+ // };
25
+ // const result = await quill.query({
26
+ // orgId: "2",
27
+ // metadata,
28
+ // });
29
+ // // TODO - add assertions
30
+ // });
31
+ // });
32
+ // });
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ const HOST = process.env.ENV === "development"
22
22
  /**
23
23
  * Quill - Fullstack API Platform for Dashboards and Reporting.
24
24
  */
25
- class Quill {
25
+ class QuillClass {
26
26
  constructor(privateKey, databaseConnectionString, cache = {}) {
27
27
  this.ssl = { rejectUnauthorized: false };
28
28
  this.baseUrl = HOST;
@@ -100,4 +100,10 @@ class Quill {
100
100
  });
101
101
  }
102
102
  }
103
- exports.default = Quill;
103
+ exports.default = QuillClass;
104
+ const Quill = ({ privateKey, databaseConnectionString, cache, }) => {
105
+ return new QuillClass(privateKey, databaseConnectionString, cache);
106
+ };
107
+ module.exports = Quill;
108
+ module.exports.Quill = Quill;
109
+ module.exports.default = Quill;
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@quillsql/node",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Quill's client SDK for node backends.",
5
5
  "main": "dist/index.js",
6
+ "module": "./dist/index.js",
6
7
  "scripts": {
7
8
  "build": "tsc --outDir dist",
8
9
  "start:dev": "nodemon ./examples/node-server/app.ts",
@@ -1,36 +1,36 @@
1
- import Quill from ".";
2
- import "dotenv/config";
1
+ // import Quill from ".";
2
+ // import "dotenv/config";
3
3
 
4
- const HOST =
5
- process.env.ENV === "development"
6
- ? "http://localhost:8080"
7
- : "https://quill-344421.uc.r.appspot.com";
4
+ // const HOST =
5
+ // process.env.ENV === "development"
6
+ // ? "http://localhost:8080"
7
+ // : "https://quill-344421.uc.r.appspot.com";
8
8
 
9
- describe("Quill", () => {
10
- let quill: Quill;
9
+ // describe("Quill", () => {
10
+ // let quill: Quill;
11
11
 
12
- beforeEach(() => {
13
- quill = new Quill(
14
- process.env.QUILL_PRIVATE_KEY as string,
15
- process.env.DB_URL as string
16
- );
17
- });
12
+ // beforeEach(() => {
13
+ // quill = new Quill(
14
+ // process.env.QUILL_PRIVATE_KEY as string,
15
+ // process.env.DB_URL as string
16
+ // );
17
+ // });
18
18
 
19
- afterAll(() => {
20
- jest.restoreAllMocks();
21
- });
19
+ // afterAll(() => {
20
+ // jest.restoreAllMocks();
21
+ // });
22
22
 
23
- describe("query", () => {
24
- it("org - should return ", async () => {
25
- const metadata = {
26
- task: "orgs",
27
- clientId: "62cda15d7c9fcca7bc0a3689",
28
- };
29
- const result = await quill.query({
30
- orgId: "2",
31
- metadata,
32
- });
33
- // TODO - add assertions
34
- });
35
- });
36
- });
23
+ // describe("query", () => {
24
+ // it("org - should return ", async () => {
25
+ // const metadata = {
26
+ // task: "orgs",
27
+ // clientId: "62cda15d7c9fcca7bc0a3689",
28
+ // };
29
+ // const result = await quill.query({
30
+ // orgId: "2",
31
+ // metadata,
32
+ // });
33
+ // // TODO - add assertions
34
+ // });
35
+ // });
36
+ // });
package/src/index.ts CHANGED
@@ -22,7 +22,8 @@ const HOST =
22
22
  /**
23
23
  * Quill - Fullstack API Platform for Dashboards and Reporting.
24
24
  */
25
- export default class Quill {
25
+
26
+ export default class QuillClass {
26
27
  // Configure cached connection pools with the given config.
27
28
  private connectionString;
28
29
  private ssl = { rejectUnauthorized: false };
@@ -142,3 +143,19 @@ export default class Quill {
142
143
  await this.targetPool.close();
143
144
  }
144
145
  }
146
+
147
+ const Quill = ({
148
+ privateKey,
149
+ databaseConnectionString,
150
+ cache,
151
+ }: {
152
+ privateKey: string;
153
+ databaseConnectionString: string;
154
+ cache?: Partial<CacheCredentials>;
155
+ }) => {
156
+ return new QuillClass(privateKey, databaseConnectionString, cache);
157
+ };
158
+
159
+ module.exports = Quill;
160
+ module.exports.Quill = Quill;
161
+ module.exports.default = Quill;