@lowdefy/connection-google-sheets 0.0.0-experimental-20231123101256
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/LICENSE +201 -0
- package/dist/connections/GoogleSheet/GoogleSheet.js +34 -0
- package/dist/connections/GoogleSheet/GoogleSheetAppendMany/GoogleSheetAppendMany.js +39 -0
- package/dist/connections/GoogleSheet/GoogleSheetAppendMany/schema.js +56 -0
- package/dist/connections/GoogleSheet/GoogleSheetAppendOne/GoogleSheetAppendOne.js +41 -0
- package/dist/connections/GoogleSheet/GoogleSheetAppendOne/schema.js +49 -0
- package/dist/connections/GoogleSheet/GoogleSheetDeleteOne/GoogleSheetDeleteOne.js +55 -0
- package/dist/connections/GoogleSheet/GoogleSheetDeleteOne/schema.js +56 -0
- package/dist/connections/GoogleSheet/GoogleSheetGetMany/GoogleSheetGetMany.js +55 -0
- package/dist/connections/GoogleSheet/GoogleSheetGetMany/schema.js +57 -0
- package/dist/connections/GoogleSheet/GoogleSheetGetOne/GoogleSheetGetOne.js +48 -0
- package/dist/connections/GoogleSheet/GoogleSheetGetOne/schema.js +50 -0
- package/dist/connections/GoogleSheet/GoogleSheetUpdateMany/GoogleSheetUpdateMany.js +62 -0
- package/dist/connections/GoogleSheet/GoogleSheetUpdateMany/schema.js +72 -0
- package/dist/connections/GoogleSheet/GoogleSheetUpdateOne/GoogleSheetUpdateOne.js +74 -0
- package/dist/connections/GoogleSheet/GoogleSheetUpdateOne/schema.js +79 -0
- package/dist/connections/GoogleSheet/cleanRows.js +32 -0
- package/dist/connections/GoogleSheet/getSheet.js +57 -0
- package/dist/connections/GoogleSheet/mingoAggregation.js +44 -0
- package/dist/connections/GoogleSheet/mingoFilter.js +34 -0
- package/dist/connections/GoogleSheet/schema.js +110 -0
- package/dist/connections/GoogleSheet/transformTypes.js +93 -0
- package/dist/connections.js +15 -0
- package/dist/types.js +19 -0
- package/package.json +59 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
import moment from 'moment';
|
|
17
|
+
const readTransformers = {
|
|
18
|
+
string: (value)=>value,
|
|
19
|
+
number: (value)=>{
|
|
20
|
+
const number = Number(value);
|
|
21
|
+
if (isNaN(number)) return null;
|
|
22
|
+
return number;
|
|
23
|
+
},
|
|
24
|
+
boolean: (value)=>value === 'TRUE',
|
|
25
|
+
date: (value)=>{
|
|
26
|
+
const date = moment.utc(value);
|
|
27
|
+
if (!date.isValid()) return null;
|
|
28
|
+
return date.toDate();
|
|
29
|
+
},
|
|
30
|
+
json: (value)=>{
|
|
31
|
+
try {
|
|
32
|
+
return JSON.parse(value);
|
|
33
|
+
} catch (_) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const writeTransformers = {
|
|
39
|
+
string: (value)=>value,
|
|
40
|
+
number: (value)=>type.isNumber(value) ? value.toString() : value,
|
|
41
|
+
boolean: (value)=>{
|
|
42
|
+
if (value === true) return 'TRUE';
|
|
43
|
+
if (value === false) return 'FALSE';
|
|
44
|
+
return value;
|
|
45
|
+
},
|
|
46
|
+
date: (value)=>type.isDate(value) ? value.toISOString() : value,
|
|
47
|
+
json: (value)=>{
|
|
48
|
+
try {
|
|
49
|
+
return JSON.stringify(value);
|
|
50
|
+
} catch (_) {
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const transformObject = ({ transformers, types })=>(object)=>{
|
|
56
|
+
Object.keys(object).forEach((key)=>{
|
|
57
|
+
if (types[key]) {
|
|
58
|
+
object[key] = transformers[types[key]](object[key]);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return object;
|
|
62
|
+
};
|
|
63
|
+
function transformRead({ input, types = {} }) {
|
|
64
|
+
if (type.isObject(input)) {
|
|
65
|
+
return transformObject({
|
|
66
|
+
transformers: readTransformers,
|
|
67
|
+
types
|
|
68
|
+
})(input);
|
|
69
|
+
}
|
|
70
|
+
if (type.isArray(input)) {
|
|
71
|
+
return input.map((obj)=>transformObject({
|
|
72
|
+
transformers: readTransformers,
|
|
73
|
+
types
|
|
74
|
+
})(obj));
|
|
75
|
+
}
|
|
76
|
+
throw new Error(`transformRead received invalid input type ${type.typeOf(input)}.`);
|
|
77
|
+
}
|
|
78
|
+
function transformWrite({ input, types = {} }) {
|
|
79
|
+
if (type.isObject(input)) {
|
|
80
|
+
return transformObject({
|
|
81
|
+
transformers: writeTransformers,
|
|
82
|
+
types
|
|
83
|
+
})(input);
|
|
84
|
+
}
|
|
85
|
+
if (type.isArray(input)) {
|
|
86
|
+
return input.map((obj)=>transformObject({
|
|
87
|
+
transformers: writeTransformers,
|
|
88
|
+
types
|
|
89
|
+
})(obj));
|
|
90
|
+
}
|
|
91
|
+
throw new Error(`transformWrite received invalid input type ${type.typeOf(input)}.`);
|
|
92
|
+
}
|
|
93
|
+
export { transformRead, transformWrite };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export { default as GoogleSheet } from './connections/GoogleSheet/GoogleSheet.js';
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* eslint-disable import/namespace */ /*
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import * as connections from './connections.js';
|
|
16
|
+
export default {
|
|
17
|
+
connections: Object.keys(connections),
|
|
18
|
+
requests: Object.keys(connections).map((connection)=>Object.keys(connections[connection].requests)).flat()
|
|
19
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lowdefy/connection-google-sheets",
|
|
3
|
+
"version": "0.0.0-experimental-20231123101256",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"description": "",
|
|
6
|
+
"homepage": "https://lowdefy.com",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"lowdefy",
|
|
9
|
+
"lowdefy connection",
|
|
10
|
+
"lowdefy plugin"
|
|
11
|
+
],
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/lowdefy/lowdefy/issues"
|
|
14
|
+
},
|
|
15
|
+
"contributors": [
|
|
16
|
+
{
|
|
17
|
+
"name": "Sam Tolmay",
|
|
18
|
+
"url": "https://github.com/SamTolmay"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "Gerrie van Wyk",
|
|
22
|
+
"url": "https://github.com/Gervwyk"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/lowdefy/lowdefy.git"
|
|
28
|
+
},
|
|
29
|
+
"type": "module",
|
|
30
|
+
"exports": {
|
|
31
|
+
"./connections": "./dist/connections.js",
|
|
32
|
+
"./types": "./dist/types.js"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist/*"
|
|
36
|
+
],
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@lowdefy/helpers": "0.0.0-experimental-20231123101256",
|
|
39
|
+
"google-spreadsheet": "3.3.0",
|
|
40
|
+
"mingo": "6.4.9",
|
|
41
|
+
"moment": "2.29.4"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@jest/globals": "28.1.3",
|
|
45
|
+
"@lowdefy/ajv": "0.0.0-experimental-20231123101256",
|
|
46
|
+
"@swc/cli": "0.1.63",
|
|
47
|
+
"@swc/core": "1.3.99",
|
|
48
|
+
"@swc/jest": "0.2.29",
|
|
49
|
+
"jest": "28.1.3"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
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
|
+
}
|