@lowdefy/connection-google-sheets 4.0.0-rc.9 → 4.0.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.
- package/dist/connections/GoogleSheet/GoogleSheet.js +1 -1
- package/dist/connections/GoogleSheet/GoogleSheetAppendMany/GoogleSheetAppendMany.js +4 -4
- package/dist/connections/GoogleSheet/GoogleSheetAppendMany/schema.js +1 -1
- package/dist/connections/GoogleSheet/GoogleSheetAppendOne/GoogleSheetAppendOne.js +4 -4
- package/dist/connections/GoogleSheet/GoogleSheetAppendOne/schema.js +1 -1
- package/dist/connections/GoogleSheet/GoogleSheetDeleteOne/GoogleSheetDeleteOne.js +4 -4
- package/dist/connections/GoogleSheet/GoogleSheetDeleteOne/schema.js +1 -1
- package/dist/connections/GoogleSheet/GoogleSheetGetMany/GoogleSheetGetMany.js +4 -4
- package/dist/connections/GoogleSheet/GoogleSheetGetMany/schema.js +1 -1
- package/dist/connections/GoogleSheet/GoogleSheetGetOne/GoogleSheetGetOne.js +5 -5
- package/dist/connections/GoogleSheet/GoogleSheetGetOne/schema.js +1 -1
- package/dist/connections/GoogleSheet/GoogleSheetUpdateMany/GoogleSheetUpdateMany.js +4 -4
- package/dist/connections/GoogleSheet/GoogleSheetUpdateMany/schema.js +1 -1
- package/dist/connections/GoogleSheet/GoogleSheetUpdateOne/GoogleSheetUpdateOne.js +4 -4
- package/dist/connections/GoogleSheet/GoogleSheetUpdateOne/schema.js +1 -1
- package/dist/connections/GoogleSheet/cleanRows.js +2 -2
- package/dist/connections/GoogleSheet/getSheet.js +7 -7
- package/dist/connections/GoogleSheet/mingoAggregation.js +18 -18
- package/dist/connections/GoogleSheet/mingoFilter.js +2 -2
- package/dist/connections/GoogleSheet/schema.js +1 -1
- package/dist/connections/GoogleSheet/transformTypes.js +4 -4
- package/dist/connections.js +1 -1
- package/dist/types.js +1 -1
- package/package.json +15 -17
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
});
|
|
@@ -38,7 +38,7 @@ async function GoogleSheetGetOne({ request , connection }) {
|
|
|
38
38
|
filter
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
return rows[0]
|
|
41
|
+
return rows[0] ?? null;
|
|
42
42
|
}
|
|
43
43
|
GoogleSheetGetOne.schema = schema;
|
|
44
44
|
GoogleSheetGetOne.meta = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
function cleanRow(row) {
|
|
17
17
|
// eslint-disable-next-line no-unused-vars
|
|
18
|
-
const { _sheet
|
|
18
|
+
const { _sheet, ...rest } = row;
|
|
19
19
|
return {
|
|
20
20
|
...rest
|
|
21
21
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,17 +13,17 @@
|
|
|
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 {
|
|
20
20
|
await doc.useServiceAccountAuth({
|
|
21
|
-
client_email
|
|
22
|
-
private_key
|
|
21
|
+
client_email,
|
|
22
|
+
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,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,23 +15,23 @@
|
|
|
15
15
|
*/ import { type } from '@lowdefy/helpers';
|
|
16
16
|
import mingo from 'mingo';
|
|
17
17
|
// TODO: fix build to work with:
|
|
18
|
-
|
|
19
|
-
import { useOperators, OperatorType } from 'mingo/core.js';
|
|
20
|
-
import * as accumulatorOperators from 'mingo/operators/accumulator/index.js';
|
|
21
|
-
import * as expressionOperators from 'mingo/operators/expression/index.js';
|
|
22
|
-
import * as pipelineOperators from 'mingo/operators/pipeline/index.js';
|
|
23
|
-
import * as queryOperators from 'mingo/operators/query/index.js';
|
|
24
|
-
import * as projectionOperators from 'mingo/operators/projection/index.js';
|
|
25
|
-
// "import * as" is returning different object structures when the connection is being
|
|
26
|
-
// imported in the build or when running the tests.
|
|
27
|
-
// So we check for the a default object with all the named exports, otherwise the
|
|
28
|
-
// returned object has all the named exports.
|
|
29
|
-
useOperators(OperatorType.ACCUMULATOR, accumulatorOperators.default || accumulatorOperators);
|
|
30
|
-
useOperators(OperatorType.EXPRESSION, expressionOperators.default || expressionOperators);
|
|
31
|
-
useOperators(OperatorType.PIPELINE, pipelineOperators.default || pipelineOperators);
|
|
32
|
-
useOperators(OperatorType.QUERY, queryOperators.default || queryOperators);
|
|
33
|
-
useOperators(OperatorType.PROJECTION, projectionOperators.default || projectionOperators);
|
|
34
|
-
function mingoAggregation({ input =[]
|
|
18
|
+
import 'mingo/init/system';
|
|
19
|
+
// import { useOperators, OperatorType } from 'mingo/core.js';
|
|
20
|
+
// import * as accumulatorOperators from 'mingo/operators/accumulator/index.js';
|
|
21
|
+
// import * as expressionOperators from 'mingo/operators/expression/index.js';
|
|
22
|
+
// import * as pipelineOperators from 'mingo/operators/pipeline/index.js';
|
|
23
|
+
// import * as queryOperators from 'mingo/operators/query/index.js';
|
|
24
|
+
// import * as projectionOperators from 'mingo/operators/projection/index.js';
|
|
25
|
+
// // "import * as" is returning different object structures when the connection is being
|
|
26
|
+
// // imported in the build or when running the tests.
|
|
27
|
+
// // So we check for the a default object with all the named exports, otherwise the
|
|
28
|
+
// // returned object has all the named exports.
|
|
29
|
+
// useOperators(OperatorType.ACCUMULATOR, accumulatorOperators.default || accumulatorOperators);
|
|
30
|
+
// useOperators(OperatorType.EXPRESSION, expressionOperators.default || expressionOperators);
|
|
31
|
+
// useOperators(OperatorType.PIPELINE, pipelineOperators.default || pipelineOperators);
|
|
32
|
+
// useOperators(OperatorType.QUERY, queryOperators.default || queryOperators);
|
|
33
|
+
// useOperators(OperatorType.PROJECTION, projectionOperators.default || projectionOperators);
|
|
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
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2024 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -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/dist/connections.js
CHANGED
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/connection-google-sheets",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -34,28 +34,26 @@
|
|
|
34
34
|
"files": [
|
|
35
35
|
"dist/*"
|
|
36
36
|
],
|
|
37
|
-
"scripts": {
|
|
38
|
-
"build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start --copy-files",
|
|
39
|
-
"clean": "rm -rf dist",
|
|
40
|
-
"prepublishOnly": "pnpm build",
|
|
41
|
-
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
|
|
42
|
-
},
|
|
43
37
|
"dependencies": {
|
|
44
|
-
"@lowdefy/helpers": "4.0.
|
|
38
|
+
"@lowdefy/helpers": "4.0.1",
|
|
45
39
|
"google-spreadsheet": "3.3.0",
|
|
46
|
-
"mingo": "6.
|
|
40
|
+
"mingo": "6.4.9",
|
|
47
41
|
"moment": "2.29.4"
|
|
48
42
|
},
|
|
49
43
|
"devDependencies": {
|
|
50
|
-
"@jest/globals": "28.1.
|
|
51
|
-
"@lowdefy/ajv": "4.0.
|
|
52
|
-
"@swc/cli": "0.1.
|
|
53
|
-
"@swc/core": "1.3.
|
|
54
|
-
"@swc/jest": "0.2.
|
|
55
|
-
"jest": "28.1.
|
|
44
|
+
"@jest/globals": "28.1.3",
|
|
45
|
+
"@lowdefy/ajv": "4.0.1",
|
|
46
|
+
"@swc/cli": "0.1.63",
|
|
47
|
+
"@swc/core": "1.3.99",
|
|
48
|
+
"@swc/jest": "0.2.29",
|
|
49
|
+
"jest": "28.1.3"
|
|
56
50
|
},
|
|
57
51
|
"publishConfig": {
|
|
58
52
|
"access": "public"
|
|
59
53
|
},
|
|
60
|
-
"
|
|
61
|
-
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start --copy-files",
|
|
56
|
+
"clean": "rm -rf dist",
|
|
57
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
|
|
58
|
+
}
|
|
59
|
+
}
|