@pipedream/google_drive 0.3.3 → 0.4.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/actions/add-file-sharing-preference/add-file-sharing-preference.mjs +83 -0
- package/actions/copy-file/copy-file.mjs +34 -0
- package/actions/create-file/create-file.mjs +242 -0
- package/actions/create-file-from-template/create-file-from-template.mjs +98 -0
- package/actions/create-file-from-text/create-file-from-text.mjs +67 -0
- package/actions/create-folder/create-folder.mjs +54 -0
- package/actions/create-shared-drive/create-shared-drive.mjs +25 -0
- package/actions/delete-file/delete-file.mjs +37 -0
- package/actions/delete-shared-drive/delete-shared-drive.mjs +30 -0
- package/actions/download-file/download-file.mjs +120 -0
- package/actions/find-file/find-file.mjs +35 -0
- package/actions/find-folder/find-folder.mjs +38 -0
- package/actions/get-folder-id-for-path/get-folder-id-for-path.mjs +62 -0
- package/actions/get-shared-drive/get-shared-drive.mjs +37 -0
- package/actions/google-mime-types.mjs +19 -0
- package/actions/google-workspace-export-formats.mjs +74 -0
- package/actions/language-codes.mjs +742 -0
- package/actions/move-file/move-file.mjs +52 -0
- package/actions/move-file-to-trash/move-file-to-trash.mjs +41 -0
- package/actions/replace-file/replace-file.mjs +90 -0
- package/actions/search-shared-drives/search-shared-drives.mjs +34 -0
- package/actions/update-file/update-file.mjs +164 -0
- package/actions/update-shared-drive/update-shared-drive.mjs +77 -0
- package/actions/upload-file/upload-file.mjs +89 -0
- package/constants.mjs +190 -0
- package/google_drive.app.mjs +1429 -0
- package/package.json +23 -20
- package/pnpm-lock.yaml +393 -0
- package/sources/changes-to-specific-files/changes-to-specific-files.mjs +226 -0
- package/sources/changes-to-specific-files-shared-drive/changes-to-specific-files-shared-drive.mjs +110 -0
- package/sources/common-webhook.mjs +201 -0
- package/sources/new-files-instant/new-files-instant.mjs +95 -0
- package/sources/new-or-modified-comments/new-or-modified-comments.mjs +104 -0
- package/sources/new-or-modified-files/new-or-modified-files.mjs +66 -0
- package/sources/new-or-modified-folders/new-or-modified-folders.mjs +86 -0
- package/sources/new-shared-drive/new-shared-drive.mjs +68 -0
- package/utils.mjs +247 -0
- package/LICENSE +0 -7
- package/google_drive.app.js +0 -212
- package/sources/changes-to-specific-files/changes-to-specific-files.js +0 -226
- package/sources/new-or-modified-files/new-or-modified-files.js +0 -213
package/package.json
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
"name": "@pipedream/google_drive",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Pipedream Google_drive Components",
|
|
5
|
+
"main": "google_drive.app.mjs",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pipedream",
|
|
8
|
+
"google_drive"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://pipedream.com/apps/google_drive",
|
|
11
|
+
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@googleapis/drive": "^2.3.0",
|
|
15
|
+
"@pipedream/platform": "^0.9.0",
|
|
16
|
+
"axios": "^0.21.1",
|
|
17
|
+
"mime-db": "^1.51.0",
|
|
18
|
+
"uuid": "^8.3.2"
|
|
19
|
+
},
|
|
20
|
+
"gitHead": "e12480b94cc03bed4808ebc6b13e7fdb3a1ba535",
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/pnpm-lock.yaml
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
lockfileVersion: 5.4
|
|
2
|
+
|
|
3
|
+
specifiers:
|
|
4
|
+
'@googleapis/drive': ^2.3.0
|
|
5
|
+
'@pipedream/platform': ^0.9.0
|
|
6
|
+
axios: ^0.21.1
|
|
7
|
+
mime-db: ^1.51.0
|
|
8
|
+
uuid: ^8.3.2
|
|
9
|
+
|
|
10
|
+
dependencies:
|
|
11
|
+
'@googleapis/drive': 2.3.0
|
|
12
|
+
'@pipedream/platform': 0.9.0
|
|
13
|
+
axios: 0.21.4
|
|
14
|
+
mime-db: 1.52.0
|
|
15
|
+
uuid: 8.3.2
|
|
16
|
+
|
|
17
|
+
packages:
|
|
18
|
+
|
|
19
|
+
/@googleapis/drive/2.3.0:
|
|
20
|
+
resolution: {integrity: sha512-uXLF2qc1Hzee25acyEEmyfwbyw1nI2hjUde7pTNOc3K4OkVlPdq08+e7x+hdlUkQPazmqhtbPmWWm2HNAek9+A==}
|
|
21
|
+
engines: {node: '>=10.0.0'}
|
|
22
|
+
dependencies:
|
|
23
|
+
googleapis-common: 5.1.0
|
|
24
|
+
transitivePeerDependencies:
|
|
25
|
+
- encoding
|
|
26
|
+
- supports-color
|
|
27
|
+
dev: false
|
|
28
|
+
|
|
29
|
+
/@pipedream/platform/0.9.0:
|
|
30
|
+
resolution: {integrity: sha512-d8gcWQi9qkjeMz/Cr/oRQ3h2LOEouxxsb3dPPCZDcAL/w0I3BywvUzr4/wmWENORilwKUZZs+wWmmj5BT0zMIQ==}
|
|
31
|
+
dependencies:
|
|
32
|
+
axios: 0.19.2
|
|
33
|
+
fp-ts: 2.12.1
|
|
34
|
+
io-ts: 2.2.16_fp-ts@2.12.1
|
|
35
|
+
transitivePeerDependencies:
|
|
36
|
+
- supports-color
|
|
37
|
+
dev: false
|
|
38
|
+
|
|
39
|
+
/abort-controller/3.0.0:
|
|
40
|
+
resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==}
|
|
41
|
+
engines: {node: '>=6.5'}
|
|
42
|
+
dependencies:
|
|
43
|
+
event-target-shim: 5.0.1
|
|
44
|
+
dev: false
|
|
45
|
+
|
|
46
|
+
/agent-base/6.0.2:
|
|
47
|
+
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
|
|
48
|
+
engines: {node: '>= 6.0.0'}
|
|
49
|
+
dependencies:
|
|
50
|
+
debug: 4.3.4
|
|
51
|
+
transitivePeerDependencies:
|
|
52
|
+
- supports-color
|
|
53
|
+
dev: false
|
|
54
|
+
|
|
55
|
+
/arrify/2.0.1:
|
|
56
|
+
resolution: {integrity: sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==}
|
|
57
|
+
engines: {node: '>=8'}
|
|
58
|
+
dev: false
|
|
59
|
+
|
|
60
|
+
/axios/0.19.2:
|
|
61
|
+
resolution: {integrity: sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==}
|
|
62
|
+
deprecated: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
|
|
63
|
+
dependencies:
|
|
64
|
+
follow-redirects: 1.5.10
|
|
65
|
+
transitivePeerDependencies:
|
|
66
|
+
- supports-color
|
|
67
|
+
dev: false
|
|
68
|
+
|
|
69
|
+
/axios/0.21.4:
|
|
70
|
+
resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==}
|
|
71
|
+
dependencies:
|
|
72
|
+
follow-redirects: 1.15.0
|
|
73
|
+
transitivePeerDependencies:
|
|
74
|
+
- debug
|
|
75
|
+
dev: false
|
|
76
|
+
|
|
77
|
+
/base64-js/1.5.1:
|
|
78
|
+
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
|
79
|
+
dev: false
|
|
80
|
+
|
|
81
|
+
/bignumber.js/9.0.2:
|
|
82
|
+
resolution: {integrity: sha512-GAcQvbpsM0pUb0zw1EI0KhQEZ+lRwR5fYaAp3vPOYuP7aDvGy6cVN6XHLauvF8SOga2y0dcLcjt3iQDTSEliyw==}
|
|
83
|
+
dev: false
|
|
84
|
+
|
|
85
|
+
/buffer-equal-constant-time/1.0.1:
|
|
86
|
+
resolution: {integrity: sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=}
|
|
87
|
+
dev: false
|
|
88
|
+
|
|
89
|
+
/call-bind/1.0.2:
|
|
90
|
+
resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==}
|
|
91
|
+
dependencies:
|
|
92
|
+
function-bind: 1.1.1
|
|
93
|
+
get-intrinsic: 1.1.1
|
|
94
|
+
dev: false
|
|
95
|
+
|
|
96
|
+
/debug/3.1.0:
|
|
97
|
+
resolution: {integrity: sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==}
|
|
98
|
+
peerDependencies:
|
|
99
|
+
supports-color: '*'
|
|
100
|
+
peerDependenciesMeta:
|
|
101
|
+
supports-color:
|
|
102
|
+
optional: true
|
|
103
|
+
dependencies:
|
|
104
|
+
ms: 2.0.0
|
|
105
|
+
dev: false
|
|
106
|
+
|
|
107
|
+
/debug/4.3.4:
|
|
108
|
+
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
|
|
109
|
+
engines: {node: '>=6.0'}
|
|
110
|
+
peerDependencies:
|
|
111
|
+
supports-color: '*'
|
|
112
|
+
peerDependenciesMeta:
|
|
113
|
+
supports-color:
|
|
114
|
+
optional: true
|
|
115
|
+
dependencies:
|
|
116
|
+
ms: 2.1.2
|
|
117
|
+
dev: false
|
|
118
|
+
|
|
119
|
+
/ecdsa-sig-formatter/1.0.11:
|
|
120
|
+
resolution: {integrity: sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==}
|
|
121
|
+
dependencies:
|
|
122
|
+
safe-buffer: 5.2.1
|
|
123
|
+
dev: false
|
|
124
|
+
|
|
125
|
+
/event-target-shim/5.0.1:
|
|
126
|
+
resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==}
|
|
127
|
+
engines: {node: '>=6'}
|
|
128
|
+
dev: false
|
|
129
|
+
|
|
130
|
+
/extend/3.0.2:
|
|
131
|
+
resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==}
|
|
132
|
+
dev: false
|
|
133
|
+
|
|
134
|
+
/fast-text-encoding/1.0.3:
|
|
135
|
+
resolution: {integrity: sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==}
|
|
136
|
+
dev: false
|
|
137
|
+
|
|
138
|
+
/follow-redirects/1.15.0:
|
|
139
|
+
resolution: {integrity: sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==}
|
|
140
|
+
engines: {node: '>=4.0'}
|
|
141
|
+
peerDependencies:
|
|
142
|
+
debug: '*'
|
|
143
|
+
peerDependenciesMeta:
|
|
144
|
+
debug:
|
|
145
|
+
optional: true
|
|
146
|
+
dev: false
|
|
147
|
+
|
|
148
|
+
/follow-redirects/1.5.10:
|
|
149
|
+
resolution: {integrity: sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==}
|
|
150
|
+
engines: {node: '>=4.0'}
|
|
151
|
+
dependencies:
|
|
152
|
+
debug: 3.1.0
|
|
153
|
+
transitivePeerDependencies:
|
|
154
|
+
- supports-color
|
|
155
|
+
dev: false
|
|
156
|
+
|
|
157
|
+
/fp-ts/2.12.1:
|
|
158
|
+
resolution: {integrity: sha512-oxvgqUYR6O9VkKXrxkJ0NOyU0FrE705MeqgBUMEPWyTu6Pwn768cJbHChw2XOBlgFLKfIHxjr2OOBFpv2mUGZw==}
|
|
159
|
+
dev: false
|
|
160
|
+
|
|
161
|
+
/function-bind/1.1.1:
|
|
162
|
+
resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==}
|
|
163
|
+
dev: false
|
|
164
|
+
|
|
165
|
+
/gaxios/4.3.3:
|
|
166
|
+
resolution: {integrity: sha512-gSaYYIO1Y3wUtdfHmjDUZ8LWaxJQpiavzbF5Kq53akSzvmVg0RfyOcFDbO1KJ/KCGRFz2qG+lS81F0nkr7cRJA==}
|
|
167
|
+
engines: {node: '>=10'}
|
|
168
|
+
dependencies:
|
|
169
|
+
abort-controller: 3.0.0
|
|
170
|
+
extend: 3.0.2
|
|
171
|
+
https-proxy-agent: 5.0.1
|
|
172
|
+
is-stream: 2.0.1
|
|
173
|
+
node-fetch: 2.6.7
|
|
174
|
+
transitivePeerDependencies:
|
|
175
|
+
- encoding
|
|
176
|
+
- supports-color
|
|
177
|
+
dev: false
|
|
178
|
+
|
|
179
|
+
/gcp-metadata/4.3.1:
|
|
180
|
+
resolution: {integrity: sha512-x850LS5N7V1F3UcV7PoupzGsyD6iVwTVvsh3tbXfkctZnBnjW5yu5z1/3k3SehF7TyoTIe78rJs02GMMy+LF+A==}
|
|
181
|
+
engines: {node: '>=10'}
|
|
182
|
+
dependencies:
|
|
183
|
+
gaxios: 4.3.3
|
|
184
|
+
json-bigint: 1.0.0
|
|
185
|
+
transitivePeerDependencies:
|
|
186
|
+
- encoding
|
|
187
|
+
- supports-color
|
|
188
|
+
dev: false
|
|
189
|
+
|
|
190
|
+
/get-intrinsic/1.1.1:
|
|
191
|
+
resolution: {integrity: sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==}
|
|
192
|
+
dependencies:
|
|
193
|
+
function-bind: 1.1.1
|
|
194
|
+
has: 1.0.3
|
|
195
|
+
has-symbols: 1.0.3
|
|
196
|
+
dev: false
|
|
197
|
+
|
|
198
|
+
/google-auth-library/7.14.1:
|
|
199
|
+
resolution: {integrity: sha512-5Rk7iLNDFhFeBYc3s8l1CqzbEBcdhwR193RlD4vSNFajIcINKI8W8P0JLmBpwymHqqWbX34pJDQu39cSy/6RsA==}
|
|
200
|
+
engines: {node: '>=10'}
|
|
201
|
+
dependencies:
|
|
202
|
+
arrify: 2.0.1
|
|
203
|
+
base64-js: 1.5.1
|
|
204
|
+
ecdsa-sig-formatter: 1.0.11
|
|
205
|
+
fast-text-encoding: 1.0.3
|
|
206
|
+
gaxios: 4.3.3
|
|
207
|
+
gcp-metadata: 4.3.1
|
|
208
|
+
gtoken: 5.3.2
|
|
209
|
+
jws: 4.0.0
|
|
210
|
+
lru-cache: 6.0.0
|
|
211
|
+
transitivePeerDependencies:
|
|
212
|
+
- encoding
|
|
213
|
+
- supports-color
|
|
214
|
+
dev: false
|
|
215
|
+
|
|
216
|
+
/google-p12-pem/3.1.4:
|
|
217
|
+
resolution: {integrity: sha512-HHuHmkLgwjdmVRngf5+gSmpkyaRI6QmOg77J8tkNBHhNEI62sGHyw4/+UkgyZEI7h84NbWprXDJ+sa3xOYFvTg==}
|
|
218
|
+
engines: {node: '>=10'}
|
|
219
|
+
hasBin: true
|
|
220
|
+
dependencies:
|
|
221
|
+
node-forge: 1.3.1
|
|
222
|
+
dev: false
|
|
223
|
+
|
|
224
|
+
/googleapis-common/5.1.0:
|
|
225
|
+
resolution: {integrity: sha512-RXrif+Gzhq1QAzfjxulbGvAY3FPj8zq/CYcvgjzDbaBNCD6bUl+86I7mUs4DKWHGruuK26ijjR/eDpWIDgNROA==}
|
|
226
|
+
engines: {node: '>=10.10.0'}
|
|
227
|
+
dependencies:
|
|
228
|
+
extend: 3.0.2
|
|
229
|
+
gaxios: 4.3.3
|
|
230
|
+
google-auth-library: 7.14.1
|
|
231
|
+
qs: 6.10.3
|
|
232
|
+
url-template: 2.0.8
|
|
233
|
+
uuid: 8.3.2
|
|
234
|
+
transitivePeerDependencies:
|
|
235
|
+
- encoding
|
|
236
|
+
- supports-color
|
|
237
|
+
dev: false
|
|
238
|
+
|
|
239
|
+
/gtoken/5.3.2:
|
|
240
|
+
resolution: {integrity: sha512-gkvEKREW7dXWF8NV8pVrKfW7WqReAmjjkMBh6lNCCGOM4ucS0r0YyXXl0r/9Yj8wcW/32ISkfc8h5mPTDbtifQ==}
|
|
241
|
+
engines: {node: '>=10'}
|
|
242
|
+
dependencies:
|
|
243
|
+
gaxios: 4.3.3
|
|
244
|
+
google-p12-pem: 3.1.4
|
|
245
|
+
jws: 4.0.0
|
|
246
|
+
transitivePeerDependencies:
|
|
247
|
+
- encoding
|
|
248
|
+
- supports-color
|
|
249
|
+
dev: false
|
|
250
|
+
|
|
251
|
+
/has-symbols/1.0.3:
|
|
252
|
+
resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==}
|
|
253
|
+
engines: {node: '>= 0.4'}
|
|
254
|
+
dev: false
|
|
255
|
+
|
|
256
|
+
/has/1.0.3:
|
|
257
|
+
resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==}
|
|
258
|
+
engines: {node: '>= 0.4.0'}
|
|
259
|
+
dependencies:
|
|
260
|
+
function-bind: 1.1.1
|
|
261
|
+
dev: false
|
|
262
|
+
|
|
263
|
+
/https-proxy-agent/5.0.1:
|
|
264
|
+
resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
|
|
265
|
+
engines: {node: '>= 6'}
|
|
266
|
+
dependencies:
|
|
267
|
+
agent-base: 6.0.2
|
|
268
|
+
debug: 4.3.4
|
|
269
|
+
transitivePeerDependencies:
|
|
270
|
+
- supports-color
|
|
271
|
+
dev: false
|
|
272
|
+
|
|
273
|
+
/io-ts/2.2.16_fp-ts@2.12.1:
|
|
274
|
+
resolution: {integrity: sha512-y5TTSa6VP6le0hhmIyN0dqEXkrZeJLeC5KApJq6VLci3UEKF80lZ+KuoUs02RhBxNWlrqSNxzfI7otLX1Euv8Q==}
|
|
275
|
+
peerDependencies:
|
|
276
|
+
fp-ts: ^2.5.0
|
|
277
|
+
dependencies:
|
|
278
|
+
fp-ts: 2.12.1
|
|
279
|
+
dev: false
|
|
280
|
+
|
|
281
|
+
/is-stream/2.0.1:
|
|
282
|
+
resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==}
|
|
283
|
+
engines: {node: '>=8'}
|
|
284
|
+
dev: false
|
|
285
|
+
|
|
286
|
+
/json-bigint/1.0.0:
|
|
287
|
+
resolution: {integrity: sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==}
|
|
288
|
+
dependencies:
|
|
289
|
+
bignumber.js: 9.0.2
|
|
290
|
+
dev: false
|
|
291
|
+
|
|
292
|
+
/jwa/2.0.0:
|
|
293
|
+
resolution: {integrity: sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==}
|
|
294
|
+
dependencies:
|
|
295
|
+
buffer-equal-constant-time: 1.0.1
|
|
296
|
+
ecdsa-sig-formatter: 1.0.11
|
|
297
|
+
safe-buffer: 5.2.1
|
|
298
|
+
dev: false
|
|
299
|
+
|
|
300
|
+
/jws/4.0.0:
|
|
301
|
+
resolution: {integrity: sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==}
|
|
302
|
+
dependencies:
|
|
303
|
+
jwa: 2.0.0
|
|
304
|
+
safe-buffer: 5.2.1
|
|
305
|
+
dev: false
|
|
306
|
+
|
|
307
|
+
/lru-cache/6.0.0:
|
|
308
|
+
resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}
|
|
309
|
+
engines: {node: '>=10'}
|
|
310
|
+
dependencies:
|
|
311
|
+
yallist: 4.0.0
|
|
312
|
+
dev: false
|
|
313
|
+
|
|
314
|
+
/mime-db/1.52.0:
|
|
315
|
+
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
|
|
316
|
+
engines: {node: '>= 0.6'}
|
|
317
|
+
dev: false
|
|
318
|
+
|
|
319
|
+
/ms/2.0.0:
|
|
320
|
+
resolution: {integrity: sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=}
|
|
321
|
+
dev: false
|
|
322
|
+
|
|
323
|
+
/ms/2.1.2:
|
|
324
|
+
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
|
325
|
+
dev: false
|
|
326
|
+
|
|
327
|
+
/node-fetch/2.6.7:
|
|
328
|
+
resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==}
|
|
329
|
+
engines: {node: 4.x || >=6.0.0}
|
|
330
|
+
peerDependencies:
|
|
331
|
+
encoding: ^0.1.0
|
|
332
|
+
peerDependenciesMeta:
|
|
333
|
+
encoding:
|
|
334
|
+
optional: true
|
|
335
|
+
dependencies:
|
|
336
|
+
whatwg-url: 5.0.0
|
|
337
|
+
dev: false
|
|
338
|
+
|
|
339
|
+
/node-forge/1.3.1:
|
|
340
|
+
resolution: {integrity: sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==}
|
|
341
|
+
engines: {node: '>= 6.13.0'}
|
|
342
|
+
dev: false
|
|
343
|
+
|
|
344
|
+
/object-inspect/1.12.0:
|
|
345
|
+
resolution: {integrity: sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==}
|
|
346
|
+
dev: false
|
|
347
|
+
|
|
348
|
+
/qs/6.10.3:
|
|
349
|
+
resolution: {integrity: sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==}
|
|
350
|
+
engines: {node: '>=0.6'}
|
|
351
|
+
dependencies:
|
|
352
|
+
side-channel: 1.0.4
|
|
353
|
+
dev: false
|
|
354
|
+
|
|
355
|
+
/safe-buffer/5.2.1:
|
|
356
|
+
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
|
|
357
|
+
dev: false
|
|
358
|
+
|
|
359
|
+
/side-channel/1.0.4:
|
|
360
|
+
resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==}
|
|
361
|
+
dependencies:
|
|
362
|
+
call-bind: 1.0.2
|
|
363
|
+
get-intrinsic: 1.1.1
|
|
364
|
+
object-inspect: 1.12.0
|
|
365
|
+
dev: false
|
|
366
|
+
|
|
367
|
+
/tr46/0.0.3:
|
|
368
|
+
resolution: {integrity: sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=}
|
|
369
|
+
dev: false
|
|
370
|
+
|
|
371
|
+
/url-template/2.0.8:
|
|
372
|
+
resolution: {integrity: sha1-/FZaPMy/93MMd19WQflVV5FDnyE=}
|
|
373
|
+
dev: false
|
|
374
|
+
|
|
375
|
+
/uuid/8.3.2:
|
|
376
|
+
resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
|
|
377
|
+
hasBin: true
|
|
378
|
+
dev: false
|
|
379
|
+
|
|
380
|
+
/webidl-conversions/3.0.1:
|
|
381
|
+
resolution: {integrity: sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=}
|
|
382
|
+
dev: false
|
|
383
|
+
|
|
384
|
+
/whatwg-url/5.0.0:
|
|
385
|
+
resolution: {integrity: sha1-lmRU6HZUYuN2RNNib2dCzotwll0=}
|
|
386
|
+
dependencies:
|
|
387
|
+
tr46: 0.0.3
|
|
388
|
+
webidl-conversions: 3.0.1
|
|
389
|
+
dev: false
|
|
390
|
+
|
|
391
|
+
/yallist/4.0.0:
|
|
392
|
+
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
|
|
393
|
+
dev: false
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import cronParser from "cron-parser";
|
|
2
|
+
import includes from "lodash/includes.js";
|
|
3
|
+
import { v4 as uuid } from "uuid";
|
|
4
|
+
|
|
5
|
+
import { MY_DRIVE_VALUE } from "../../constants.mjs";
|
|
6
|
+
|
|
7
|
+
import changesToSpecificFiles from "../changes-to-specific-files-shared-drive/changes-to-specific-files-shared-drive.mjs";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This source uses the Google Drive API's
|
|
11
|
+
* {@link https://developers.google.com/drive/api/v3/reference/files/watch files: watch}
|
|
12
|
+
* endpoint to subscribe to changes to specific files in the user's drive.
|
|
13
|
+
*/
|
|
14
|
+
export default {
|
|
15
|
+
...changesToSpecificFiles,
|
|
16
|
+
key: "google_drive-changes-to-specific-files",
|
|
17
|
+
name: "Changes to Specific Files",
|
|
18
|
+
description: "Watches for changes to specific files, emitting an event any time a change is made to one of those files. To watch for changes to [shared drive](https://support.google.com/a/users/answer/9310351) files, use the **Changes to Specific Files (Shared Drive)** source instead.",
|
|
19
|
+
version: "0.0.19",
|
|
20
|
+
type: "source",
|
|
21
|
+
// Dedupe events based on the "x-goog-message-number" header for the target channel:
|
|
22
|
+
// https://developers.google.com/drive/api/v3/push#making-watch-requests
|
|
23
|
+
dedupe: "unique",
|
|
24
|
+
props: {
|
|
25
|
+
...changesToSpecificFiles.props,
|
|
26
|
+
drive: {
|
|
27
|
+
type: "string",
|
|
28
|
+
label: "Drive",
|
|
29
|
+
description: "Defaults to `My Drive`. To use a [Shared Drive](https://support.google.com/a/users/answer/9310351), use the **Changes to Specific Files (Shared Drive)** source instead.",
|
|
30
|
+
optional: true,
|
|
31
|
+
default: MY_DRIVE_VALUE,
|
|
32
|
+
},
|
|
33
|
+
updateTypes: {
|
|
34
|
+
propDefinition: [
|
|
35
|
+
changesToSpecificFiles.props.googleDrive,
|
|
36
|
+
"updateTypes",
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
hooks: {
|
|
41
|
+
...changesToSpecificFiles.hooks,
|
|
42
|
+
async activate() {
|
|
43
|
+
// Called when a component is created or updated. Handles all the logic
|
|
44
|
+
// for starting and stopping watch notifications tied to the desired
|
|
45
|
+
// files.
|
|
46
|
+
|
|
47
|
+
// You can pass the same channel ID in watch requests for multiple files, so
|
|
48
|
+
// our channel ID is fixed for this component to simplify the state we have to
|
|
49
|
+
// keep track of.
|
|
50
|
+
const channelID = this._getChannelID() || uuid();
|
|
51
|
+
|
|
52
|
+
// Subscriptions are keyed on Google's resourceID, "an opaque value that
|
|
53
|
+
// identifies the watched resource". This value is included in request
|
|
54
|
+
// headers, allowing us to look up the watched resource.
|
|
55
|
+
let subscriptions = this._getSubscriptions() || {};
|
|
56
|
+
|
|
57
|
+
const files = this.files;
|
|
58
|
+
for (const fileID of files) {
|
|
59
|
+
const {
|
|
60
|
+
expiration,
|
|
61
|
+
resourceId,
|
|
62
|
+
} = await this.googleDrive.activateFileHook(
|
|
63
|
+
channelID,
|
|
64
|
+
this.http.endpoint,
|
|
65
|
+
fileID,
|
|
66
|
+
);
|
|
67
|
+
// The fileID must be kept with the subscription metadata so we can
|
|
68
|
+
// renew the watch request for this specific file when it expires.
|
|
69
|
+
subscriptions[resourceId] = {
|
|
70
|
+
expiration,
|
|
71
|
+
fileID,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Save metadata on the subscription so we can stop / renew later
|
|
76
|
+
this._setSubscriptions(subscriptions);
|
|
77
|
+
this._setChannelID(channelID);
|
|
78
|
+
},
|
|
79
|
+
async deactivate() {
|
|
80
|
+
const channelID = this._getChannelID();
|
|
81
|
+
if (!channelID) {
|
|
82
|
+
console.log(
|
|
83
|
+
"Channel not found, cannot stop notifications for non-existent channel",
|
|
84
|
+
);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const subscriptions = this._getSubscriptions() || {};
|
|
89
|
+
for (const resourceId of Object.keys(subscriptions)) {
|
|
90
|
+
await this.googleDrive.stopNotifications(channelID, resourceId);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Reset DB state
|
|
94
|
+
this._setSubscriptions({});
|
|
95
|
+
this._setChannelID(null);
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
methods: {
|
|
99
|
+
...changesToSpecificFiles.methods,
|
|
100
|
+
_getSubscriptions() {
|
|
101
|
+
return this.db.get("subscriptions") || {};
|
|
102
|
+
},
|
|
103
|
+
_setSubscriptions(subscriptions) {
|
|
104
|
+
this.db.set("subscriptions", subscriptions);
|
|
105
|
+
},
|
|
106
|
+
_getNextTimerEventTimestamp(event) {
|
|
107
|
+
if (event.cron) {
|
|
108
|
+
return cronParser
|
|
109
|
+
.parseExpression(event.cron)
|
|
110
|
+
.next()
|
|
111
|
+
.getTime();
|
|
112
|
+
}
|
|
113
|
+
if (event.interval_seconds) {
|
|
114
|
+
return Date.now() + event.interval_seconds * 1000;
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
async renewFileSubscriptions(event) {
|
|
118
|
+
// Assume subscription & channelID may all be undefined at
|
|
119
|
+
// this point Handle their absence appropriately.
|
|
120
|
+
const subscriptions = this._getSubscriptions() || {};
|
|
121
|
+
const channelID = this._getChannelID() || uuid();
|
|
122
|
+
|
|
123
|
+
const nextRunTimestamp = this._getNextTimerEventTimestamp(event);
|
|
124
|
+
|
|
125
|
+
for (const [
|
|
126
|
+
currentResourceId,
|
|
127
|
+
metadata,
|
|
128
|
+
] of Object.entries(subscriptions)) {
|
|
129
|
+
const { fileID } = metadata;
|
|
130
|
+
|
|
131
|
+
const subscription = {
|
|
132
|
+
...metadata,
|
|
133
|
+
resourceId: currentResourceId,
|
|
134
|
+
};
|
|
135
|
+
const {
|
|
136
|
+
expiration,
|
|
137
|
+
resourceId,
|
|
138
|
+
} = await this.googleDrive.renewFileSubscription(
|
|
139
|
+
subscription,
|
|
140
|
+
this.http.endpoint,
|
|
141
|
+
channelID,
|
|
142
|
+
fileID,
|
|
143
|
+
nextRunTimestamp,
|
|
144
|
+
);
|
|
145
|
+
subscriptions[resourceId] = {
|
|
146
|
+
expiration,
|
|
147
|
+
fileID,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
this._setSubscriptions(subscriptions);
|
|
151
|
+
this._setChannelID(channelID);
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
async run(event) {
|
|
155
|
+
// This function is polymorphic: it can be triggered as a cron job, to make sure we renew
|
|
156
|
+
// watch requests for specific files, or via HTTP request (the change payloads from Google)
|
|
157
|
+
|
|
158
|
+
// Component was invoked by timer
|
|
159
|
+
if (event.timestamp) {
|
|
160
|
+
return this.renewFileSubscriptions(event);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const channelID = this._getChannelID();
|
|
164
|
+
let subscriptions = this._getSubscriptions() || {};
|
|
165
|
+
|
|
166
|
+
const { headers } = event;
|
|
167
|
+
|
|
168
|
+
if (
|
|
169
|
+
!headers["x-goog-resource-state"] ||
|
|
170
|
+
!headers["x-goog-resource-id"] ||
|
|
171
|
+
!headers["x-goog-resource-uri"] ||
|
|
172
|
+
!headers["x-goog-message-number"]
|
|
173
|
+
) {
|
|
174
|
+
console.log("Request missing necessary headers: ", headers);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const incomingChannelID = headers["x-goog-channel-id"];
|
|
179
|
+
if (incomingChannelID !== channelID) {
|
|
180
|
+
console.log(
|
|
181
|
+
`Channel ID of ${incomingChannelID} not equal to deployed component channel of ${channelID}`,
|
|
182
|
+
);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (subscriptions[headers["x-goog-resource-id"]] === undefined) {
|
|
187
|
+
console.log(
|
|
188
|
+
`Resource ID of ${headers["x-goog-resource-id"]} not currently being tracked. Exiting`,
|
|
189
|
+
);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (!includes(this.updateTypes, headers["x-goog-resource-state"])) {
|
|
194
|
+
console.log(
|
|
195
|
+
`Update type ${headers["x-goog-resource-state"]} not in list of updates to watch: `,
|
|
196
|
+
this.updateTypes,
|
|
197
|
+
);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// We observed false positives where a single change to a document would trigger two changes:
|
|
202
|
+
// one to "properties" and another to "content,properties". But changes to properties
|
|
203
|
+
// alone are legitimate, most users just won't want this source to emit in those cases.
|
|
204
|
+
// If x-goog-changed is _only_ set to "properties", only move on if the user set the prop
|
|
205
|
+
if (
|
|
206
|
+
!this.watchForPropertiesChanges &&
|
|
207
|
+
headers["x-goog-changed"] === "properties"
|
|
208
|
+
) {
|
|
209
|
+
console.log(
|
|
210
|
+
"Change to properties only, which this component is set to ignore. Exiting",
|
|
211
|
+
);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const file = await this.googleDrive.getFileMetadata(
|
|
216
|
+
headers["x-goog-resource-uri"],
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
if (!file || !Object.keys(file).length) {
|
|
220
|
+
console.log("No file metadata returned, nothing to emit");
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
this.processChange(file, headers);
|
|
225
|
+
},
|
|
226
|
+
};
|