@lowdefy/connection-google-sheets 4.0.0-rc.1 → 4.0.0-rc.10
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/connections/GoogleSheet/GoogleSheetAppendMany/GoogleSheetAppendMany.js +3 -3
- package/dist/connections/GoogleSheet/GoogleSheetAppendOne/GoogleSheetAppendOne.js +3 -3
- package/dist/connections/GoogleSheet/GoogleSheetDeleteOne/GoogleSheetDeleteOne.js +3 -3
- package/dist/connections/GoogleSheet/GoogleSheetGetMany/GoogleSheetGetMany.js +3 -3
- package/dist/connections/GoogleSheet/GoogleSheetGetOne/GoogleSheetGetOne.js +3 -3
- package/dist/connections/GoogleSheet/GoogleSheetUpdateMany/GoogleSheetUpdateMany.js +3 -3
- package/dist/connections/GoogleSheet/GoogleSheetUpdateOne/GoogleSheetUpdateOne.js +3 -3
- package/dist/connections/GoogleSheet/cleanRows.js +1 -1
- package/dist/connections/GoogleSheet/getSheet.js +4 -4
- package/dist/connections/GoogleSheet/mingoAggregation.js +1 -1
- package/dist/connections/GoogleSheet/mingoFilter.js +1 -1
- package/dist/connections/GoogleSheet/transformTypes.js +3 -3
- package/package.json +9 -9
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/ import getSheet from '../getSheet.js';
|
|
16
16
|
import { transformWrite } from '../transformTypes.js';
|
|
17
17
|
import schema from './schema.js';
|
|
18
|
-
async function GoogleSheetAppendMany({ request
|
|
19
|
-
const { rows
|
|
20
|
-
const { raw
|
|
18
|
+
async function GoogleSheetAppendMany({ request, connection }) {
|
|
19
|
+
const { rows, options = {} } = request;
|
|
20
|
+
const { raw } = options;
|
|
21
21
|
const sheet = await getSheet({
|
|
22
22
|
connection
|
|
23
23
|
});
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
import cleanRows from '../cleanRows.js';
|
|
17
17
|
import { transformWrite } from '../transformTypes.js';
|
|
18
18
|
import schema from './schema.js';
|
|
19
|
-
async function GoogleSheetAppendOne({ request
|
|
20
|
-
const { row
|
|
21
|
-
const { raw
|
|
19
|
+
async function GoogleSheetAppendOne({ request, connection }) {
|
|
20
|
+
const { row, options = {} } = request;
|
|
21
|
+
const { raw } = options;
|
|
22
22
|
const sheet = await getSheet({
|
|
23
23
|
connection
|
|
24
24
|
});
|
|
@@ -17,9 +17,9 @@ import getSheet from '../getSheet.js';
|
|
|
17
17
|
import { transformRead } from '../transformTypes.js';
|
|
18
18
|
import mingoFilter from '../mingoFilter.js';
|
|
19
19
|
import schema from './schema.js';
|
|
20
|
-
async function GoogleSheetDeleteOne({ request
|
|
21
|
-
const { filter
|
|
22
|
-
const { limit
|
|
20
|
+
async function GoogleSheetDeleteOne({ request, connection }) {
|
|
21
|
+
const { filter, options = {} } = request;
|
|
22
|
+
const { limit, skip } = options;
|
|
23
23
|
const sheet = await getSheet({
|
|
24
24
|
connection
|
|
25
25
|
});
|
|
@@ -18,9 +18,9 @@ import { transformRead } from '../transformTypes.js';
|
|
|
18
18
|
import mingoAggregation from '../mingoAggregation.js';
|
|
19
19
|
import mingoFilter from '../mingoFilter.js';
|
|
20
20
|
import schema from './schema.js';
|
|
21
|
-
async function GoogleSheetGetMany({ request
|
|
22
|
-
const { filter
|
|
23
|
-
const { limit
|
|
21
|
+
async function GoogleSheetGetMany({ request, connection }) {
|
|
22
|
+
const { filter, pipeline, options = {} } = request;
|
|
23
|
+
const { limit, skip } = options;
|
|
24
24
|
const sheet = await getSheet({
|
|
25
25
|
connection
|
|
26
26
|
});
|
|
@@ -17,9 +17,9 @@ import getSheet from '../getSheet.js';
|
|
|
17
17
|
import { transformRead } from '../transformTypes.js';
|
|
18
18
|
import mingoFilter from '../mingoFilter.js';
|
|
19
19
|
import schema from './schema.js';
|
|
20
|
-
async function GoogleSheetGetOne({ request
|
|
21
|
-
const { filter
|
|
22
|
-
const { limit
|
|
20
|
+
async function GoogleSheetGetOne({ request, connection }) {
|
|
21
|
+
const { filter, options = {} } = request;
|
|
22
|
+
const { limit, skip } = options;
|
|
23
23
|
const sheet = await getSheet({
|
|
24
24
|
connection
|
|
25
25
|
});
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
import { transformRead, transformWrite } from '../transformTypes.js';
|
|
17
17
|
import mingoFilter from '../mingoFilter.js';
|
|
18
18
|
import schema from './schema.js';
|
|
19
|
-
async function GoogleSheetUpdateMany({ request
|
|
20
|
-
const { filter
|
|
21
|
-
const { limit
|
|
19
|
+
async function GoogleSheetUpdateMany({ request, connection }) {
|
|
20
|
+
const { filter, update, options = {} } = request;
|
|
21
|
+
const { limit, skip, raw } = options;
|
|
22
22
|
const sheet = await getSheet({
|
|
23
23
|
connection
|
|
24
24
|
});
|
|
@@ -17,9 +17,9 @@ import getSheet from '../getSheet.js';
|
|
|
17
17
|
import { transformRead, transformWrite } from '../transformTypes.js';
|
|
18
18
|
import mingoFilter from '../mingoFilter.js';
|
|
19
19
|
import schema from './schema.js';
|
|
20
|
-
async function GoogleSheetUpdateOne({ request
|
|
21
|
-
const { filter
|
|
22
|
-
const { limit
|
|
20
|
+
async function GoogleSheetUpdateOne({ request, connection }) {
|
|
21
|
+
const { filter, update, options = {} } = request;
|
|
22
|
+
const { limit, skip, upsert, raw } = options;
|
|
23
23
|
const sheet = await getSheet({
|
|
24
24
|
connection
|
|
25
25
|
});
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { GoogleSpreadsheet } from 'google-spreadsheet';
|
|
16
|
-
async function authenticate({ doc
|
|
16
|
+
async function authenticate({ doc, apiKey, client_email, private_key }) {
|
|
17
17
|
if (apiKey) {
|
|
18
18
|
doc.useApiKey(apiKey);
|
|
19
19
|
} else {
|
|
@@ -23,7 +23,7 @@ async function authenticate({ doc , apiKey , client_email , private_key }) {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
function getSheetFromDoc({ doc
|
|
26
|
+
function getSheetFromDoc({ doc, sheetId, sheetIndex }) {
|
|
27
27
|
let sheet;
|
|
28
28
|
if (sheetId) {
|
|
29
29
|
sheet = doc.sheetsById[sheetId];
|
|
@@ -38,8 +38,8 @@ function getSheetFromDoc({ doc , sheetId , sheetIndex }) {
|
|
|
38
38
|
}
|
|
39
39
|
return sheet;
|
|
40
40
|
}
|
|
41
|
-
async function getSheet({ connection
|
|
42
|
-
const { apiKey
|
|
41
|
+
async function getSheet({ connection }) {
|
|
42
|
+
const { apiKey, client_email, private_key, sheetId, sheetIndex, spreadsheetId } = connection;
|
|
43
43
|
const doc = new GoogleSpreadsheet(spreadsheetId);
|
|
44
44
|
await authenticate({
|
|
45
45
|
doc,
|
|
@@ -31,7 +31,7 @@ useOperators(OperatorType.EXPRESSION, expressionOperators.default || expressionO
|
|
|
31
31
|
useOperators(OperatorType.PIPELINE, pipelineOperators.default || pipelineOperators);
|
|
32
32
|
useOperators(OperatorType.QUERY, queryOperators.default || queryOperators);
|
|
33
33
|
useOperators(OperatorType.PROJECTION, projectionOperators.default || projectionOperators);
|
|
34
|
-
function mingoAggregation({ input =[]
|
|
34
|
+
function mingoAggregation({ input = [], pipeline = [] }) {
|
|
35
35
|
if (!type.isArray(input)) {
|
|
36
36
|
throw new Error('Mingo aggregation error. Argument "input" should be an array.');
|
|
37
37
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
import mingoAggregation from './mingoAggregation.js';
|
|
17
|
-
function mingoFilter({ input =[]
|
|
17
|
+
function mingoFilter({ input = [], filter = {} }) {
|
|
18
18
|
if (!type.isObject(filter)) {
|
|
19
19
|
throw new Error('Mingo filter error. Argument "filter" should be an object.');
|
|
20
20
|
}
|
|
@@ -52,7 +52,7 @@ const writeTransformers = {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
const transformObject = ({ transformers
|
|
55
|
+
const transformObject = ({ transformers, types })=>(object)=>{
|
|
56
56
|
Object.keys(object).forEach((key)=>{
|
|
57
57
|
if (types[key]) {
|
|
58
58
|
object[key] = transformers[types[key]](object[key]);
|
|
@@ -60,7 +60,7 @@ const transformObject = ({ transformers , types })=>(object)=>{
|
|
|
60
60
|
});
|
|
61
61
|
return object;
|
|
62
62
|
};
|
|
63
|
-
function transformRead({ input
|
|
63
|
+
function transformRead({ input, types = {} }) {
|
|
64
64
|
if (type.isObject(input)) {
|
|
65
65
|
return transformObject({
|
|
66
66
|
transformers: readTransformers,
|
|
@@ -75,7 +75,7 @@ function transformRead({ input , types ={} }) {
|
|
|
75
75
|
}
|
|
76
76
|
throw new Error(`transformRead received invalid input type ${type.typeOf(input)}.`);
|
|
77
77
|
}
|
|
78
|
-
function transformWrite({ input
|
|
78
|
+
function transformWrite({ input, types = {} }) {
|
|
79
79
|
if (type.isObject(input)) {
|
|
80
80
|
return transformObject({
|
|
81
81
|
transformers: writeTransformers,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/connection-google-sheets",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.10",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@lowdefy/helpers": "4.0.0-rc.
|
|
44
|
+
"@lowdefy/helpers": "4.0.0-rc.10",
|
|
45
45
|
"google-spreadsheet": "3.3.0",
|
|
46
46
|
"mingo": "6.2.1",
|
|
47
47
|
"moment": "2.29.4"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@jest/globals": "28.1.
|
|
51
|
-
"@lowdefy/ajv": "4.0.0-rc.
|
|
52
|
-
"@swc/cli": "0.1.
|
|
53
|
-
"@swc/core": "1.3.
|
|
54
|
-
"@swc/jest": "0.2.
|
|
55
|
-
"jest": "28.1.
|
|
50
|
+
"@jest/globals": "28.1.3",
|
|
51
|
+
"@lowdefy/ajv": "4.0.0-rc.10",
|
|
52
|
+
"@swc/cli": "0.1.62",
|
|
53
|
+
"@swc/core": "1.3.70",
|
|
54
|
+
"@swc/jest": "0.2.27",
|
|
55
|
+
"jest": "28.1.3"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "537af074f27770e32da9da8d48490f2eda94b406"
|
|
61
61
|
}
|