@openfn/language-mssql 3.1.2 → 4.0.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.cjs +9 -5
- package/dist/index.js +9 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -105,6 +105,7 @@ function createConnection(state) {
|
|
|
105
105
|
resolve({ ...state, connection });
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
|
+
connection.connect();
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
111
|
function execute(...operations) {
|
|
@@ -145,13 +146,16 @@ function flattenRows(state, rows) {
|
|
|
145
146
|
return { ...state, response: { body: data } };
|
|
146
147
|
}
|
|
147
148
|
function composeNextState(state, rows) {
|
|
148
|
-
|
|
149
|
+
let rowObj = {};
|
|
150
|
+
const flattenedRows = [];
|
|
149
151
|
rows.forEach((row) => {
|
|
150
|
-
row.
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
rowObj = row.reduce(
|
|
153
|
+
(o, col) => Object.assign(o, { [col.metadata.colName]: col.value }),
|
|
154
|
+
{}
|
|
155
|
+
);
|
|
156
|
+
flattenedRows.push(rowObj);
|
|
153
157
|
});
|
|
154
|
-
return { ...state, response: {
|
|
158
|
+
return { ...state, response: { rowCount: rows.length, rows: flattenedRows } };
|
|
155
159
|
}
|
|
156
160
|
function queryHandler(state, query, callback, options) {
|
|
157
161
|
const { connection } = state;
|
package/dist/index.js
CHANGED
|
@@ -79,6 +79,7 @@ function createConnection(state) {
|
|
|
79
79
|
resolve({ ...state, connection });
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
|
+
connection.connect();
|
|
82
83
|
});
|
|
83
84
|
}
|
|
84
85
|
function execute(...operations) {
|
|
@@ -119,13 +120,16 @@ function flattenRows(state, rows) {
|
|
|
119
120
|
return { ...state, response: { body: data } };
|
|
120
121
|
}
|
|
121
122
|
function composeNextState(state, rows) {
|
|
122
|
-
|
|
123
|
+
let rowObj = {};
|
|
124
|
+
const flattenedRows = [];
|
|
123
125
|
rows.forEach((row) => {
|
|
124
|
-
row.
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
rowObj = row.reduce(
|
|
127
|
+
(o, col) => Object.assign(o, { [col.metadata.colName]: col.value }),
|
|
128
|
+
{}
|
|
129
|
+
);
|
|
130
|
+
flattenedRows.push(rowObj);
|
|
127
131
|
});
|
|
128
|
-
return { ...state, response: {
|
|
132
|
+
return { ...state, response: { rowCount: rows.length, rows: flattenedRows } };
|
|
129
133
|
}
|
|
130
134
|
function queryHandler(state, query, callback, options) {
|
|
131
135
|
const { connection } = state;
|