@quillsql/node 0.1.4 → 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.
- package/index.js +4 -3
- package/index.ts +5 -4
- package/package.json +4 -3
- package/test.js +0 -8
package/index.js
CHANGED
|
@@ -14,7 +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
|
-
const pool = new Pool({
|
|
17
|
+
const pool = new Pool({
|
|
18
|
+
connectionString: databaseConnectionString,
|
|
19
|
+
});
|
|
18
20
|
const stagingPool = new Pool({
|
|
19
21
|
connectionString: stagingDatabaseConnectionString,
|
|
20
22
|
});
|
|
@@ -22,14 +24,13 @@ module.exports = ({ publicKey, privateKey, databaseConnectionString, stagingData
|
|
|
22
24
|
query: ({ orgId, query, filters, task, id, data, environment, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
25
|
const targetPool = environment === "STAGING" ? stagingPool : pool;
|
|
24
26
|
if (task === "query") {
|
|
25
|
-
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;" }, {
|
|
26
28
|
params: {
|
|
27
29
|
publicKey,
|
|
28
30
|
orgId,
|
|
29
31
|
},
|
|
30
32
|
headers: {
|
|
31
33
|
Authorization: `Bearer ${privateKey}`,
|
|
32
|
-
environment,
|
|
33
34
|
},
|
|
34
35
|
});
|
|
35
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?:
|
|
18
|
+
filters?: any[];
|
|
19
19
|
id?: string;
|
|
20
20
|
data?: object;
|
|
21
21
|
environment?: string;
|
|
@@ -27,7 +27,9 @@ module.exports = ({
|
|
|
27
27
|
databaseConnectionString,
|
|
28
28
|
stagingDatabaseConnectionString,
|
|
29
29
|
}: QuillConfig) => {
|
|
30
|
-
const pool = new Pool({
|
|
30
|
+
const pool = new Pool({
|
|
31
|
+
connectionString: databaseConnectionString,
|
|
32
|
+
});
|
|
31
33
|
const stagingPool = new Pool({
|
|
32
34
|
connectionString: stagingDatabaseConnectionString,
|
|
33
35
|
});
|
|
@@ -47,7 +49,7 @@ module.exports = ({
|
|
|
47
49
|
if (task === "query") {
|
|
48
50
|
const response = await axios.post(
|
|
49
51
|
"https://quill-344421.uc.r.appspot.com/validate",
|
|
50
|
-
{ query },
|
|
52
|
+
{ query: "select * from transactions limit 10;" },
|
|
51
53
|
{
|
|
52
54
|
params: {
|
|
53
55
|
publicKey,
|
|
@@ -55,7 +57,6 @@ module.exports = ({
|
|
|
55
57
|
},
|
|
56
58
|
headers: {
|
|
57
59
|
Authorization: `Bearer ${privateKey}`,
|
|
58
|
-
environment,
|
|
59
60
|
},
|
|
60
61
|
}
|
|
61
62
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillsql/node",
|
|
3
|
-
"version": "0.1.
|
|
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.
|
|
14
|
-
"
|
|
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" });
|