@quillsql/node 0.1.9 → 0.2.1

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 (3) hide show
  1. package/index.js +10 -12
  2. package/index.ts +14 -16
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -24,9 +24,7 @@ module.exports = ({ publicKey, privateKey, databaseConnectionString, stagingData
24
24
  query: ({ orgId, metadata, environment }) => __awaiter(void 0, void 0, void 0, function* () {
25
25
  const targetPool = environment === "STAGING" ? stagingPool : pool;
26
26
  const { task, query, id } = metadata;
27
- console.log("0");
28
27
  if (task === "query") {
29
- console.log("1");
30
28
  const response = yield axios.post("https://quill-344421.uc.r.appspot.com/validate", { query: query }, {
31
29
  params: {
32
30
  publicKey,
@@ -83,17 +81,7 @@ module.exports = ({ publicKey, privateKey, databaseConnectionString, stagingData
83
81
  return response.data;
84
82
  }
85
83
  if (task === "item") {
86
- const response = yield axios.post("https://quill-344421.uc.r.appspot.com/validate", { query }, {
87
- params: {
88
- publicKey,
89
- orgId,
90
- },
91
- headers: {
92
- Authorization: `Bearer ${privateKey}`,
93
- },
94
- });
95
84
  try {
96
- const queryResult = yield targetPool.query(response.data.query);
97
85
  const resp = yield axios.get("https://quill-344421.uc.r.appspot.com/selfhostitem", {
98
86
  params: {
99
87
  id,
@@ -104,6 +92,16 @@ module.exports = ({ publicKey, privateKey, databaseConnectionString, stagingData
104
92
  Authorization: `Bearer ${privateKey}`,
105
93
  },
106
94
  });
95
+ const response = yield axios.post("https://quill-344421.uc.r.appspot.com/validate", { query: resp.data.queryString }, {
96
+ params: {
97
+ publicKey,
98
+ orgId,
99
+ },
100
+ headers: {
101
+ Authorization: `Bearer ${privateKey}`,
102
+ },
103
+ });
104
+ const queryResult = yield targetPool.query(response.data.query);
107
105
  return Object.assign(Object.assign({}, resp.data), { rows: queryResult.rows, fields: queryResult.fields });
108
106
  }
109
107
  catch (err) {
package/index.ts CHANGED
@@ -74,10 +74,8 @@ module.exports = ({
74
74
  query: async ({ orgId, metadata, environment }: QuillQueryParams) => {
75
75
  const targetPool = environment === "STAGING" ? stagingPool : pool;
76
76
  const { task, query, id } = metadata;
77
- console.log("0");
78
77
 
79
78
  if (task === "query") {
80
- console.log("1");
81
79
  const response = await axios.post(
82
80
  "https://quill-344421.uc.r.appspot.com/validate",
83
81
  { query: query },
@@ -152,21 +150,7 @@ module.exports = ({
152
150
  }
153
151
 
154
152
  if (task === "item") {
155
- const response = await axios.post(
156
- "https://quill-344421.uc.r.appspot.com/validate",
157
- { query },
158
- {
159
- params: {
160
- publicKey,
161
- orgId,
162
- },
163
- headers: {
164
- Authorization: `Bearer ${privateKey}`,
165
- },
166
- }
167
- );
168
153
  try {
169
- const queryResult = await targetPool.query(response.data.query);
170
154
  const resp = await axios.get(
171
155
  "https://quill-344421.uc.r.appspot.com/selfhostitem",
172
156
  {
@@ -180,6 +164,20 @@ module.exports = ({
180
164
  },
181
165
  }
182
166
  );
167
+ const response = await axios.post(
168
+ "https://quill-344421.uc.r.appspot.com/validate",
169
+ { query: resp.data.queryString },
170
+ {
171
+ params: {
172
+ publicKey,
173
+ orgId,
174
+ },
175
+ headers: {
176
+ Authorization: `Bearer ${privateKey}`,
177
+ },
178
+ }
179
+ );
180
+ const queryResult = await targetPool.query(response.data.query);
183
181
  return {
184
182
  ...resp.data,
185
183
  rows: queryResult.rows,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/node",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "description": "Quill SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {