@quillsql/node 0.2.0 → 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 -10
  2. package/index.ts +14 -14
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -81,17 +81,7 @@ module.exports = ({ publicKey, privateKey, databaseConnectionString, stagingData
81
81
  return response.data;
82
82
  }
83
83
  if (task === "item") {
84
- const response = yield axios.post("https://quill-344421.uc.r.appspot.com/validate", { query }, {
85
- params: {
86
- publicKey,
87
- orgId,
88
- },
89
- headers: {
90
- Authorization: `Bearer ${privateKey}`,
91
- },
92
- });
93
84
  try {
94
- const queryResult = yield targetPool.query(response.data.query);
95
85
  const resp = yield axios.get("https://quill-344421.uc.r.appspot.com/selfhostitem", {
96
86
  params: {
97
87
  id,
@@ -102,6 +92,16 @@ module.exports = ({ publicKey, privateKey, databaseConnectionString, stagingData
102
92
  Authorization: `Bearer ${privateKey}`,
103
93
  },
104
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);
105
105
  return Object.assign(Object.assign({}, resp.data), { rows: queryResult.rows, fields: queryResult.fields });
106
106
  }
107
107
  catch (err) {
package/index.ts CHANGED
@@ -150,21 +150,7 @@ module.exports = ({
150
150
  }
151
151
 
152
152
  if (task === "item") {
153
- const response = await axios.post(
154
- "https://quill-344421.uc.r.appspot.com/validate",
155
- { query },
156
- {
157
- params: {
158
- publicKey,
159
- orgId,
160
- },
161
- headers: {
162
- Authorization: `Bearer ${privateKey}`,
163
- },
164
- }
165
- );
166
153
  try {
167
- const queryResult = await targetPool.query(response.data.query);
168
154
  const resp = await axios.get(
169
155
  "https://quill-344421.uc.r.appspot.com/selfhostitem",
170
156
  {
@@ -178,6 +164,20 @@ module.exports = ({
178
164
  },
179
165
  }
180
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);
181
181
  return {
182
182
  ...resp.data,
183
183
  rows: queryResult.rows,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/node",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Quill SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {