@quillsql/node 0.4.8 → 0.5.0
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/dist/index.d.ts +1 -0
- package/dist/index.js +5 -3
- package/dist/models/Quill.d.ts +1 -1
- package/dist/utils/RunQueryProcesses.js +4 -3
- package/examples/node-server/app.ts +1 -1
- package/package.json +1 -1
- package/src/index.ts +7 -3
- package/src/models/Quill.ts +1 -1
- package/src/utils/RunQueryProcesses.ts +5 -4
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -103,7 +103,7 @@ class Quill {
|
|
|
103
103
|
databaseType.toLowerCase() !== pkDatabaseType.toLowerCase()) {
|
|
104
104
|
return {
|
|
105
105
|
dbMismatched: true,
|
|
106
|
-
|
|
106
|
+
backendDatabaseType: pkDatabaseType,
|
|
107
107
|
queryResults: [],
|
|
108
108
|
};
|
|
109
109
|
}
|
|
@@ -144,8 +144,10 @@ class Quill {
|
|
|
144
144
|
return yield this.targetConnection.query(query);
|
|
145
145
|
})));
|
|
146
146
|
results = Object.assign(Object.assign({}, results), { queryResults });
|
|
147
|
-
if (runQueryConfig === null || runQueryConfig === void 0 ? void 0 : runQueryConfig.
|
|
148
|
-
results = Object.assign(Object.assign({}, results), { queryResults:
|
|
147
|
+
if (runQueryConfig === null || runQueryConfig === void 0 ? void 0 : runQueryConfig.fieldsToRemove) {
|
|
148
|
+
results = Object.assign(Object.assign({}, results), { queryResults: queryResults.map((queryResult) => {
|
|
149
|
+
return (0, RunQueryProcesses_1.removeFields)(queryResult, runQueryConfig.fieldsToRemove);
|
|
150
|
+
}) });
|
|
149
151
|
}
|
|
150
152
|
if (runQueryConfig === null || runQueryConfig === void 0 ? void 0 : runQueryConfig.convertDatatypes) {
|
|
151
153
|
results = queryResults.map((result) => {
|
package/dist/models/Quill.d.ts
CHANGED
|
@@ -11,13 +11,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.mapQueries = exports.removeFields = void 0;
|
|
13
13
|
function removeFields(queryResults, fieldsToRemove) {
|
|
14
|
-
const fields = queryResults.fields.filter((field) => fieldsToRemove.includes(field.name));
|
|
15
|
-
const rows = queryResults.map((row) => {
|
|
14
|
+
const fields = queryResults.fields.filter((field) => !fieldsToRemove.includes(field.name));
|
|
15
|
+
const rows = queryResults.rows.map((row) => {
|
|
16
16
|
fieldsToRemove.forEach((field) => {
|
|
17
17
|
delete row[field];
|
|
18
18
|
});
|
|
19
|
-
return
|
|
19
|
+
return row;
|
|
20
20
|
});
|
|
21
|
+
return { fields, rows };
|
|
21
22
|
}
|
|
22
23
|
exports.removeFields = removeFields;
|
|
23
24
|
function mapQueries(queries, targetConnection) {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -171,7 +171,7 @@ export class Quill {
|
|
|
171
171
|
) {
|
|
172
172
|
return {
|
|
173
173
|
dbMismatched: true,
|
|
174
|
-
|
|
174
|
+
backendDatabaseType: pkDatabaseType,
|
|
175
175
|
queryResults: [],
|
|
176
176
|
};
|
|
177
177
|
}
|
|
@@ -221,10 +221,12 @@ export class Quill {
|
|
|
221
221
|
})
|
|
222
222
|
);
|
|
223
223
|
results = { ...results, queryResults };
|
|
224
|
-
if (runQueryConfig?.
|
|
224
|
+
if (runQueryConfig?.fieldsToRemove) {
|
|
225
225
|
results = {
|
|
226
226
|
...results,
|
|
227
|
-
queryResults:
|
|
227
|
+
queryResults: queryResults.map((queryResult) => {
|
|
228
|
+
return removeFields(queryResult, runQueryConfig.fieldsToRemove!);
|
|
229
|
+
}),
|
|
228
230
|
};
|
|
229
231
|
}
|
|
230
232
|
if (runQueryConfig?.convertDatatypes) {
|
|
@@ -303,3 +305,5 @@ module.exports.getColumnInfoBySchemaByDatabase =
|
|
|
303
305
|
module.exports.connectToDatabase = connectToDatabase;
|
|
304
306
|
module.exports.runQueryByDatabase = runQueryByDatabase;
|
|
305
307
|
module.exports.DatabaseType = DatabaseType;
|
|
308
|
+
|
|
309
|
+
export { QuillQueryParams as QuillRequest } from "./models/Quill";
|
package/src/models/Quill.ts
CHANGED
|
@@ -58,7 +58,7 @@ export interface AdditionalProcessing {
|
|
|
58
58
|
schema?: string;
|
|
59
59
|
schemaNames?: string[];
|
|
60
60
|
table?: string;
|
|
61
|
-
|
|
61
|
+
fieldsToRemove?: string[];
|
|
62
62
|
arrayToMap?: { arrayName: string; field: string };
|
|
63
63
|
overridePost?: boolean;
|
|
64
64
|
convertDatatypes?: boolean;
|
|
@@ -8,15 +8,16 @@ interface TableSchemaInfo {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export function removeFields(queryResults: any, fieldsToRemove: string[]): any {
|
|
11
|
-
const fields = queryResults.fields.filter(
|
|
12
|
-
fieldsToRemove.includes(field.name)
|
|
11
|
+
const fields = queryResults.fields.filter(
|
|
12
|
+
(field: { name: any }) => !fieldsToRemove.includes(field.name)
|
|
13
13
|
);
|
|
14
|
-
const rows = queryResults.map((row: any) => {
|
|
14
|
+
const rows = queryResults.rows.map((row: any) => {
|
|
15
15
|
fieldsToRemove.forEach((field) => {
|
|
16
16
|
delete row[field];
|
|
17
17
|
});
|
|
18
|
-
return
|
|
18
|
+
return row;
|
|
19
19
|
});
|
|
20
|
+
return { fields, rows };
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export async function mapQueries(
|