@quillsql/node 0.1.3 → 0.1.6

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.
Files changed (4) hide show
  1. package/index.js +4 -12
  2. package/index.ts +5 -14
  3. package/package.json +4 -3
  4. package/test.js +0 -8
package/index.js CHANGED
@@ -14,16 +14,9 @@ var PgError = require("pg-error");
14
14
  Connection.prototype.parseE = PgError.parse;
15
15
  Connection.prototype.parseN = PgError.parse;
16
16
  module.exports = ({ publicKey, privateKey, databaseConnectionString, stagingDatabaseConnectionString, }) => {
17
- if (!publicKey) {
18
- throw new Error("No publicKey provided");
19
- }
20
- if (!privateKey) {
21
- throw new Error("No privateKey provided");
22
- }
23
- if (!databaseConnectionString) {
24
- throw new Error("No databaseConnectionString provided");
25
- }
26
- const pool = new Pool({ connectionString: databaseConnectionString });
17
+ const pool = new Pool({
18
+ connectionString: databaseConnectionString,
19
+ });
27
20
  const stagingPool = new Pool({
28
21
  connectionString: stagingDatabaseConnectionString,
29
22
  });
@@ -31,14 +24,13 @@ module.exports = ({ publicKey, privateKey, databaseConnectionString, stagingData
31
24
  query: ({ orgId, query, filters, task, id, data, environment, }) => __awaiter(void 0, void 0, void 0, function* () {
32
25
  const targetPool = environment === "STAGING" ? stagingPool : pool;
33
26
  if (task === "query") {
34
- const response = yield axios.post("https://quill-344421.uc.r.appspot.com/validate", { query }, {
27
+ const response = yield axios.post("https://quill-344421.uc.r.appspot.com/validate", { query: "select * from transactions limit 10;" }, {
35
28
  params: {
36
29
  publicKey,
37
30
  orgId,
38
31
  },
39
32
  headers: {
40
33
  Authorization: `Bearer ${privateKey}`,
41
- environment,
42
34
  },
43
35
  });
44
36
  try {
package/index.ts CHANGED
@@ -15,7 +15,7 @@ interface QuillQueryParams {
15
15
  orgId: string;
16
16
  task: string;
17
17
  query?: string;
18
- filters?: string;
18
+ filters?: any[];
19
19
  id?: string;
20
20
  data?: object;
21
21
  environment?: string;
@@ -27,17 +27,9 @@ module.exports = ({
27
27
  databaseConnectionString,
28
28
  stagingDatabaseConnectionString,
29
29
  }: QuillConfig) => {
30
- if (!publicKey) {
31
- throw new Error("No publicKey provided");
32
- }
33
- if (!privateKey) {
34
- throw new Error("No privateKey provided");
35
- }
36
- if (!databaseConnectionString) {
37
- throw new Error("No databaseConnectionString provided");
38
- }
39
-
40
- const pool = new Pool({ connectionString: databaseConnectionString });
30
+ const pool = new Pool({
31
+ connectionString: databaseConnectionString,
32
+ });
41
33
  const stagingPool = new Pool({
42
34
  connectionString: stagingDatabaseConnectionString,
43
35
  });
@@ -57,7 +49,7 @@ module.exports = ({
57
49
  if (task === "query") {
58
50
  const response = await axios.post(
59
51
  "https://quill-344421.uc.r.appspot.com/validate",
60
- { query },
52
+ { query: "select * from transactions limit 10;" },
61
53
  {
62
54
  params: {
63
55
  publicKey,
@@ -65,7 +57,6 @@ module.exports = ({
65
57
  },
66
58
  headers: {
67
59
  Authorization: `Bearer ${privateKey}`,
68
- environment,
69
60
  },
70
61
  }
71
62
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/node",
3
- "version": "0.1.3",
3
+ "version": "0.1.6",
4
4
  "description": "Quill SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -10,8 +10,9 @@
10
10
  "author": "Quill",
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "axios": "^0.21.1",
14
- "pg": "^8.6.0",
13
+ "axios": "^0.21.4",
14
+ "dotenv": "^16.3.1",
15
+ "pg": "^8.11.1",
15
16
  "pg-error": "^1.1.0"
16
17
  },
17
18
  "devDependencies": {
package/test.js DELETED
@@ -1,8 +0,0 @@
1
- const quill = require("./index")({
2
- publicKey: process.env.QULL_PUBLIC_KEY,
3
- privateKey: process.env.QUILL_PRIVATE_KEY,
4
- databaseConnectionString: process.env.POSTGRES_STAGING_READ,
5
- stagingDatabaseConnectionString: process.env.POSTGRES_STAGING_READ,
6
- });
7
-
8
- quill.query({ task: "query", query: "select * from transactions" });