zapier-platform-cli 15.19.0 → 16.1.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/oclif.manifest.json +2316 -1
- package/package.json +39 -32
- package/src/bin/run +4 -4
- package/src/bin/run.cmd +0 -3
- package/src/constants.js +2 -2
- package/src/generators/index.js +11 -11
- package/src/generators/templates/dynamic-dropdown/README.md +1 -1
- package/src/generators/templates/dynamic-dropdown/triggers/people.js +2 -2
- package/src/generators/templates/dynamic-dropdown/triggers/species.js +2 -2
- package/src/index.js +1 -1
- package/src/oclif/ZapierBaseCommand.js +52 -45
- package/src/oclif/buildFlags.js +14 -16
- package/src/oclif/commands/analytics.js +6 -6
- package/src/oclif/commands/build.js +6 -6
- package/src/oclif/commands/cache/clear.js +13 -13
- package/src/oclif/commands/canary/create.js +27 -20
- package/src/oclif/commands/canary/delete.js +26 -16
- package/src/oclif/commands/canary/list.js +5 -7
- package/src/oclif/commands/convert.js +16 -16
- package/src/oclif/commands/delete/version.js +6 -6
- package/src/oclif/commands/deprecate.js +10 -11
- package/src/oclif/commands/describe.js +5 -5
- package/src/oclif/commands/env/get.js +5 -5
- package/src/oclif/commands/env/set.js +11 -12
- package/src/oclif/commands/env/unset.js +9 -10
- package/src/oclif/commands/history.js +1 -0
- package/src/oclif/commands/init.js +12 -13
- package/src/oclif/commands/invoke.js +67 -69
- package/src/oclif/commands/jobs.js +1 -1
- package/src/oclif/commands/link.js +2 -2
- package/src/oclif/commands/login.js +15 -15
- package/src/oclif/commands/logout.js +1 -1
- package/src/oclif/commands/logs.js +9 -9
- package/src/oclif/commands/migrate.js +19 -22
- package/src/oclif/commands/promote.js +25 -27
- package/src/oclif/commands/push.js +2 -2
- package/src/oclif/commands/register.js +31 -32
- package/src/oclif/commands/scaffold.js +15 -17
- package/src/oclif/commands/team/add.js +12 -15
- package/src/oclif/commands/team/get.js +2 -2
- package/src/oclif/commands/team/remove.js +6 -6
- package/src/oclif/commands/test.js +8 -8
- package/src/oclif/commands/upload.js +1 -1
- package/src/oclif/commands/users/add.js +9 -11
- package/src/oclif/commands/users/get.js +7 -7
- package/src/oclif/commands/users/links.js +4 -4
- package/src/oclif/commands/users/remove.js +8 -9
- package/src/oclif/commands/validate.js +29 -21
- package/src/oclif/commands/versions.js +26 -1
- package/src/oclif/hooks/checkValidNodeVersion.js +1 -1
- package/src/oclif/hooks/deprecated.js +1 -1
- package/src/oclif/hooks/getAppRegistrationFieldChoices.js +4 -4
- package/src/oclif/hooks/renderMarkdownHelp.js +6 -7
- package/src/oclif/hooks/versionInfo.js +2 -2
- package/src/utils/analytics.js +20 -7
- package/src/utils/api.js +27 -30
- package/src/utils/ast.js +15 -15
- package/src/utils/auth-files-codegen.js +102 -99
- package/src/utils/build.js +27 -28
- package/src/utils/changelog.js +1 -1
- package/src/utils/check-missing-app-info.js +2 -2
- package/src/utils/convert.js +26 -20
- package/src/utils/credentials.js +1 -1
- package/src/utils/display.js +31 -8
- package/src/utils/files.js +3 -3
- package/src/utils/ignore.js +2 -2
- package/src/utils/local.js +1 -1
- package/src/utils/metadata.js +1 -1
- package/src/utils/misc.js +21 -22
- package/src/utils/promisify.js +1 -1
- package/src/utils/scaffold.js +12 -12
- package/src/utils/team.js +3 -3
- package/src/utils/xdg.js +3 -3
- package/src/version-store.js +1 -0
|
@@ -43,7 +43,7 @@ const authFileExport = (
|
|
|
43
43
|
connectionLabel = strLiteral('{{json.username}}'),
|
|
44
44
|
test = objProperty('test'),
|
|
45
45
|
authFields = [],
|
|
46
|
-
} = {}
|
|
46
|
+
} = {},
|
|
47
47
|
) => {
|
|
48
48
|
return exportStatement(
|
|
49
49
|
obj(
|
|
@@ -54,49 +54,49 @@ const authFileExport = (
|
|
|
54
54
|
objProperty('type', strLiteral(authType)),
|
|
55
55
|
...extraConfigProps,
|
|
56
56
|
comment(
|
|
57
|
-
"Define any input app's auth requires here. The user will be prompted to enter this info when they connect their account."
|
|
57
|
+
"Define any input app's auth requires here. The user will be prompted to enter this info when they connect their account.",
|
|
58
58
|
),
|
|
59
59
|
objProperty('fields', arr(...authFields)),
|
|
60
60
|
comment(
|
|
61
|
-
"The test method allows Zapier to verify that the credentials a user provides are valid. We'll execute this method whenever a user connects their account for the first time."
|
|
61
|
+
"The test method allows Zapier to verify that the credentials a user provides are valid. We'll execute this method whenever a user connects their account for the first time.",
|
|
62
62
|
),
|
|
63
63
|
test,
|
|
64
64
|
comment(
|
|
65
65
|
`This template string can access all the data returned from the auth test. If you return the test object, you'll access the returned data with a label like \`{{json.X}}\`. If you return \`response.data\` from your test, then your label can be \`{{X}}\`. This can also be a function that returns a label. That function has the standard args \`(${standardArgs.join(
|
|
66
|
-
', '
|
|
67
|
-
)})\` and data returned from the test can be accessed in \`bundle.inputData.X
|
|
66
|
+
', ',
|
|
67
|
+
)})\` and data returned from the test can be accessed in \`bundle.inputData.X\`.`,
|
|
68
68
|
),
|
|
69
|
-
objProperty('connectionLabel', connectionLabel)
|
|
70
|
-
)
|
|
69
|
+
objProperty('connectionLabel', connectionLabel),
|
|
70
|
+
),
|
|
71
71
|
),
|
|
72
72
|
objProperty('befores', arr(...beforeFuncNames)),
|
|
73
|
-
objProperty('afters', arr(...afterFuncNames))
|
|
74
|
-
)
|
|
73
|
+
objProperty('afters', arr(...afterFuncNames)),
|
|
74
|
+
),
|
|
75
75
|
);
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
const authTestFunc = (testUrl = strLiteral(authJsonUrl('me'))) =>
|
|
79
79
|
block(
|
|
80
80
|
comment(
|
|
81
|
-
'You want to make a request to an endpoint that is either specifically designed to test auth, or one that every user will have access to. eg: `/me`.'
|
|
81
|
+
'You want to make a request to an endpoint that is either specifically designed to test auth, or one that every user will have access to. eg: `/me`.',
|
|
82
82
|
),
|
|
83
83
|
comment(
|
|
84
|
-
'By returning the entire request object, you have access to the request and response data for testing purposes. Your connection label can access any data from the returned response using the `json.` prefix. eg: `{{json.username}}`.'
|
|
84
|
+
'By returning the entire request object, you have access to the request and response data for testing purposes. Your connection label can access any data from the returned response using the `json.` prefix. eg: `{{json.username}}`.',
|
|
85
85
|
),
|
|
86
|
-
fatArrowReturnFunctionDeclaration('test', standardArgs, zRequest(testUrl))
|
|
86
|
+
fatArrowReturnFunctionDeclaration('test', standardArgs, zRequest(testUrl)),
|
|
87
87
|
);
|
|
88
88
|
|
|
89
89
|
const handleBadResponsesFunc = (
|
|
90
90
|
funcName,
|
|
91
|
-
invalidInfo = 'username and/or password'
|
|
91
|
+
invalidInfo = 'username and/or password',
|
|
92
92
|
) =>
|
|
93
93
|
afterMiddlewareFunc(
|
|
94
94
|
funcName,
|
|
95
95
|
ifStatement(
|
|
96
96
|
'response.status === 401',
|
|
97
|
-
zResponseErr(strLiteral(`The ${invalidInfo} you supplied is incorrect`))
|
|
97
|
+
zResponseErr(strLiteral(`The ${invalidInfo} you supplied is incorrect`)),
|
|
98
98
|
),
|
|
99
|
-
returnStatement(RESPONSE_VAR)
|
|
99
|
+
returnStatement(RESPONSE_VAR),
|
|
100
100
|
);
|
|
101
101
|
|
|
102
102
|
const basicAuthFile = () => {
|
|
@@ -107,8 +107,8 @@ const basicAuthFile = () => {
|
|
|
107
107
|
authFileExport(
|
|
108
108
|
'basic',
|
|
109
109
|
'"basic" auth automatically creates "username" and "password" input fields. It also registers default middleware to create the authentication header.',
|
|
110
|
-
{ afterFuncNames: [badFuncName] }
|
|
111
|
-
)
|
|
110
|
+
{ afterFuncNames: [badFuncName] },
|
|
111
|
+
),
|
|
112
112
|
);
|
|
113
113
|
};
|
|
114
114
|
|
|
@@ -118,7 +118,7 @@ const basicAuthFile = () => {
|
|
|
118
118
|
const beforeMiddlewareFunc = (funcName, ...statements) =>
|
|
119
119
|
block(
|
|
120
120
|
comment(
|
|
121
|
-
"This function runs before every outbound request. You can have as many as you need. They'll need to each be registered in your index.js file."
|
|
121
|
+
"This function runs before every outbound request. You can have as many as you need. They'll need to each be registered in your index.js file.",
|
|
122
122
|
),
|
|
123
123
|
functionDeclaration(
|
|
124
124
|
funcName,
|
|
@@ -127,16 +127,16 @@ const beforeMiddlewareFunc = (funcName, ...statements) =>
|
|
|
127
127
|
// auto include the return if it's not here already
|
|
128
128
|
statements[statements.length - 1].includes('return')
|
|
129
129
|
? ''
|
|
130
|
-
: returnStatement('request')
|
|
131
|
-
)
|
|
130
|
+
: returnStatement('request'),
|
|
131
|
+
),
|
|
132
132
|
);
|
|
133
133
|
|
|
134
134
|
const afterMiddlewareFunc = (funcName, ...statements) =>
|
|
135
135
|
block(
|
|
136
136
|
comment(
|
|
137
|
-
"This function runs after every outbound request. You can use it to check for errors or modify the response. You can have as many as you need. They'll need to each be registered in your index.js file."
|
|
137
|
+
"This function runs after every outbound request. You can use it to check for errors or modify the response. You can have as many as you need. They'll need to each be registered in your index.js file.",
|
|
138
138
|
),
|
|
139
|
-
functionDeclaration(funcName, { args: afterMiddlewareArgs }, ...statements)
|
|
139
|
+
functionDeclaration(funcName, { args: afterMiddlewareArgs }, ...statements),
|
|
140
140
|
);
|
|
141
141
|
|
|
142
142
|
const includeBearerFunc = (funcName) =>
|
|
@@ -147,9 +147,9 @@ const includeBearerFunc = (funcName) =>
|
|
|
147
147
|
assignmentStatement(
|
|
148
148
|
'request.headers.Authorization',
|
|
149
149
|
// eslint-disable-next-line no-template-curly-in-string
|
|
150
|
-
interpLiteral('Bearer ${bundle.authData.access_token}')
|
|
151
|
-
)
|
|
152
|
-
)
|
|
150
|
+
interpLiteral('Bearer ${bundle.authData.access_token}'),
|
|
151
|
+
),
|
|
152
|
+
),
|
|
153
153
|
);
|
|
154
154
|
|
|
155
155
|
const tokenExchangeFunc = (
|
|
@@ -157,7 +157,7 @@ const tokenExchangeFunc = (
|
|
|
157
157
|
requestUrl,
|
|
158
158
|
bodyProps,
|
|
159
159
|
returnProps,
|
|
160
|
-
{ requestProps = [], returnComments = [] } = {}
|
|
160
|
+
{ requestProps = [], returnComments = [] } = {},
|
|
161
161
|
) =>
|
|
162
162
|
functionDeclaration(
|
|
163
163
|
funcName,
|
|
@@ -169,21 +169,21 @@ const tokenExchangeFunc = (
|
|
|
169
169
|
strLiteral(requestUrl),
|
|
170
170
|
objProperty('method', strLiteral('POST')),
|
|
171
171
|
objProperty('body', obj(...bodyProps)),
|
|
172
|
-
...requestProps
|
|
173
|
-
)
|
|
174
|
-
)
|
|
172
|
+
...requestProps,
|
|
173
|
+
),
|
|
174
|
+
),
|
|
175
175
|
),
|
|
176
176
|
comment(
|
|
177
177
|
"If you're using core v9.x or older, you should call response.throwForStatus() or verify response.status === 200 before you continue.",
|
|
178
|
-
1
|
|
178
|
+
1,
|
|
179
179
|
),
|
|
180
180
|
...returnComments,
|
|
181
|
-
returnStatement(obj(...returnProps))
|
|
181
|
+
returnStatement(obj(...returnProps)),
|
|
182
182
|
);
|
|
183
183
|
|
|
184
184
|
const oauth2TokenExchangeFunc = (
|
|
185
185
|
funcName,
|
|
186
|
-
{ path, grantType, bodyProps = [], returnComments = [] }
|
|
186
|
+
{ path, grantType, bodyProps = [], returnComments = [] },
|
|
187
187
|
) => {
|
|
188
188
|
return tokenExchangeFunc(
|
|
189
189
|
funcName,
|
|
@@ -209,12 +209,12 @@ const oauth2TokenExchangeFunc = (
|
|
|
209
209
|
obj(
|
|
210
210
|
objProperty(
|
|
211
211
|
'content-type',
|
|
212
|
-
strLiteral('application/x-www-form-urlencoded')
|
|
213
|
-
)
|
|
214
|
-
)
|
|
212
|
+
strLiteral('application/x-www-form-urlencoded'),
|
|
213
|
+
),
|
|
214
|
+
),
|
|
215
215
|
),
|
|
216
216
|
],
|
|
217
|
-
}
|
|
217
|
+
},
|
|
218
218
|
);
|
|
219
219
|
};
|
|
220
220
|
|
|
@@ -226,14 +226,14 @@ const getAccessTokenFunc = () => {
|
|
|
226
226
|
comment(
|
|
227
227
|
`Extra data can be pulled from the querystring. For instance:\n${objProperty(
|
|
228
228
|
'accountDomain',
|
|
229
|
-
'bundle.cleanedRequest.querystring.accountDomain'
|
|
230
|
-
)}
|
|
229
|
+
'bundle.cleanedRequest.querystring.accountDomain',
|
|
230
|
+
)}`,
|
|
231
231
|
),
|
|
232
232
|
],
|
|
233
233
|
grantType: 'authorization_code',
|
|
234
234
|
returnComments: [
|
|
235
235
|
comment(
|
|
236
|
-
'If your app does an app refresh, then `refresh_token` should be returned here as well'
|
|
236
|
+
'If your app does an app refresh, then `refresh_token` should be returned here as well',
|
|
237
237
|
),
|
|
238
238
|
],
|
|
239
239
|
});
|
|
@@ -247,7 +247,7 @@ const refreshTokenFunc = () => {
|
|
|
247
247
|
returnComments: [
|
|
248
248
|
comment('If the refresh token stays constant, no need to return it.'),
|
|
249
249
|
comment(
|
|
250
|
-
'If the refresh token does change, return it here to update the stored value in Zapier'
|
|
250
|
+
'If the refresh token does change, return it here to update the stored value in Zapier',
|
|
251
251
|
),
|
|
252
252
|
],
|
|
253
253
|
});
|
|
@@ -276,36 +276,36 @@ const oauth2AuthFile = () => {
|
|
|
276
276
|
obj(
|
|
277
277
|
objProperty(
|
|
278
278
|
'url',
|
|
279
|
-
strLiteral(authJsonUrl('oauth/authorize'))
|
|
279
|
+
strLiteral(authJsonUrl('oauth/authorize')),
|
|
280
280
|
),
|
|
281
281
|
objProperty(
|
|
282
282
|
'params',
|
|
283
283
|
obj(
|
|
284
284
|
objProperty(
|
|
285
285
|
'client_id',
|
|
286
|
-
strLiteral('{{process.env.CLIENT_ID}}')
|
|
286
|
+
strLiteral('{{process.env.CLIENT_ID}}'),
|
|
287
287
|
),
|
|
288
288
|
objProperty(
|
|
289
289
|
'state',
|
|
290
|
-
strLiteral('{{bundle.inputData.state}}')
|
|
290
|
+
strLiteral('{{bundle.inputData.state}}'),
|
|
291
291
|
),
|
|
292
292
|
objProperty(
|
|
293
293
|
'redirect_uri',
|
|
294
|
-
strLiteral('{{bundle.inputData.redirect_uri}}')
|
|
294
|
+
strLiteral('{{bundle.inputData.redirect_uri}}'),
|
|
295
295
|
),
|
|
296
|
-
objProperty('response_type', strLiteral('code'))
|
|
297
|
-
)
|
|
298
|
-
)
|
|
299
|
-
)
|
|
296
|
+
objProperty('response_type', strLiteral('code')),
|
|
297
|
+
),
|
|
298
|
+
),
|
|
299
|
+
),
|
|
300
300
|
),
|
|
301
301
|
objProperty(getOauthAccessTokenFuncName),
|
|
302
302
|
objProperty(refreshOath2AccessTokenFuncName),
|
|
303
|
-
objProperty('autoRefresh', 'true')
|
|
304
|
-
)
|
|
303
|
+
objProperty('autoRefresh', 'true'),
|
|
304
|
+
),
|
|
305
305
|
),
|
|
306
306
|
],
|
|
307
|
-
}
|
|
308
|
-
)
|
|
307
|
+
},
|
|
308
|
+
),
|
|
309
309
|
);
|
|
310
310
|
};
|
|
311
311
|
const customAuthFile = () => {
|
|
@@ -323,10 +323,10 @@ const customAuthFile = () => {
|
|
|
323
323
|
assignmentStatement('request.params.api_key', 'bundle.authData.apiKey'),
|
|
324
324
|
comment(
|
|
325
325
|
'If you want to include the API key in the header instead, uncomment this:',
|
|
326
|
-
1
|
|
326
|
+
1,
|
|
327
327
|
),
|
|
328
|
-
comment('request.headers.Authorization = bundle.authData.apiKey;')
|
|
329
|
-
)
|
|
328
|
+
comment('request.headers.Authorization = bundle.authData.apiKey;'),
|
|
329
|
+
),
|
|
330
330
|
),
|
|
331
331
|
authFileExport(
|
|
332
332
|
'custom',
|
|
@@ -338,11 +338,11 @@ const customAuthFile = () => {
|
|
|
338
338
|
obj(
|
|
339
339
|
objProperty('key', strLiteral('apiKey')),
|
|
340
340
|
objProperty('label', strLiteral('API Key')),
|
|
341
|
-
objProperty('required', 'true')
|
|
341
|
+
objProperty('required', 'true'),
|
|
342
342
|
),
|
|
343
343
|
],
|
|
344
|
-
}
|
|
345
|
-
)
|
|
344
|
+
},
|
|
345
|
+
),
|
|
346
346
|
);
|
|
347
347
|
};
|
|
348
348
|
|
|
@@ -352,15 +352,15 @@ const digestAuthFile = () => {
|
|
|
352
352
|
// special digest auth
|
|
353
353
|
authTestFunc(
|
|
354
354
|
strLiteral(
|
|
355
|
-
'https://httpbin.zapier-tooling.com/digest-auth/auth/myuser/mypass'
|
|
356
|
-
)
|
|
355
|
+
'https://httpbin.zapier-tooling.com/digest-auth/auth/myuser/mypass',
|
|
356
|
+
),
|
|
357
357
|
),
|
|
358
358
|
handleBadResponsesFunc(badFuncName),
|
|
359
359
|
authFileExport(
|
|
360
360
|
'digest',
|
|
361
361
|
'"digest" auth automatically creates "username" and "password" input fields. It also registers default middleware to create the authentication header.',
|
|
362
|
-
{ afterFuncNames: [badFuncName] }
|
|
363
|
-
)
|
|
362
|
+
{ afterFuncNames: [badFuncName] },
|
|
363
|
+
),
|
|
364
364
|
);
|
|
365
365
|
};
|
|
366
366
|
|
|
@@ -378,10 +378,10 @@ const sessionAuthFile = () => {
|
|
|
378
378
|
],
|
|
379
379
|
[
|
|
380
380
|
comment(
|
|
381
|
-
'FIXME: The `|| "secret"` below is just for demo purposes, you should remove it.'
|
|
381
|
+
'FIXME: The `|| "secret"` below is just for demo purposes, you should remove it.',
|
|
382
382
|
),
|
|
383
383
|
objProperty('sessionKey', 'response.data.sessionKey || "secret"'),
|
|
384
|
-
]
|
|
384
|
+
],
|
|
385
385
|
),
|
|
386
386
|
beforeMiddlewareFunc(
|
|
387
387
|
includeSessionKeyName,
|
|
@@ -390,9 +390,9 @@ const sessionAuthFile = () => {
|
|
|
390
390
|
assignmentStatement('request.headers', 'request.headers || {}'),
|
|
391
391
|
assignmentStatement(
|
|
392
392
|
"request.headers['X-API-Key']",
|
|
393
|
-
'bundle.authData.sessionKey'
|
|
394
|
-
)
|
|
395
|
-
)
|
|
393
|
+
'bundle.authData.sessionKey',
|
|
394
|
+
),
|
|
395
|
+
),
|
|
396
396
|
),
|
|
397
397
|
authFileExport(
|
|
398
398
|
'session',
|
|
@@ -404,24 +404,24 @@ const sessionAuthFile = () => {
|
|
|
404
404
|
obj(
|
|
405
405
|
objProperty('key', strLiteral('username')),
|
|
406
406
|
objProperty('label', strLiteral('Username')),
|
|
407
|
-
objProperty('required', 'true')
|
|
407
|
+
objProperty('required', 'true'),
|
|
408
408
|
),
|
|
409
409
|
obj(
|
|
410
410
|
objProperty('key', strLiteral('password')),
|
|
411
411
|
objProperty('label', strLiteral('Password')),
|
|
412
412
|
objProperty('required', 'true'),
|
|
413
413
|
comment('this lets the user enter masked data'),
|
|
414
|
-
objProperty('type', strLiteral('password'))
|
|
414
|
+
objProperty('type', strLiteral('password')),
|
|
415
415
|
),
|
|
416
416
|
],
|
|
417
417
|
extraConfigProps: [
|
|
418
418
|
objProperty(
|
|
419
419
|
'sessionConfig',
|
|
420
|
-
obj(objProperty('perform', getSessionKeyName))
|
|
420
|
+
obj(objProperty('perform', getSessionKeyName)),
|
|
421
421
|
),
|
|
422
422
|
],
|
|
423
|
-
}
|
|
424
|
-
)
|
|
423
|
+
},
|
|
424
|
+
),
|
|
425
425
|
);
|
|
426
426
|
};
|
|
427
427
|
// just different enough from oauth2 that it gets its own function
|
|
@@ -440,13 +440,13 @@ const oauth1TokenExchangeFunc = (funcName, url, ...authProperties) => {
|
|
|
440
440
|
obj(
|
|
441
441
|
objProperty('oauth_consumer_key', 'process.env.CLIENT_ID'),
|
|
442
442
|
objProperty('oauth_consumer_secret', 'process.env.CLIENT_SECRET'),
|
|
443
|
-
...authProperties
|
|
444
|
-
)
|
|
445
|
-
)
|
|
446
|
-
)
|
|
447
|
-
)
|
|
443
|
+
...authProperties,
|
|
444
|
+
),
|
|
445
|
+
),
|
|
446
|
+
),
|
|
447
|
+
),
|
|
448
448
|
),
|
|
449
|
-
returnStatement(`querystring.parse(${RESPONSE_VAR}.content)`)
|
|
449
|
+
returnStatement(`querystring.parse(${RESPONSE_VAR}.content)`),
|
|
450
450
|
);
|
|
451
451
|
};
|
|
452
452
|
const oauth1AuthFile = () => {
|
|
@@ -460,37 +460,37 @@ const oauth1AuthFile = () => {
|
|
|
460
460
|
block(
|
|
461
461
|
variableAssignmentDeclaration(
|
|
462
462
|
requestTokenVarName,
|
|
463
|
-
strLiteral('https://trello.com/1/OAuthGetRequestToken')
|
|
463
|
+
strLiteral('https://trello.com/1/OAuthGetRequestToken'),
|
|
464
464
|
),
|
|
465
465
|
variableAssignmentDeclaration(
|
|
466
466
|
accessTokenVarName,
|
|
467
|
-
strLiteral('https://trello.com/1/OAuthGetAccessToken')
|
|
467
|
+
strLiteral('https://trello.com/1/OAuthGetAccessToken'),
|
|
468
468
|
),
|
|
469
469
|
variableAssignmentDeclaration(
|
|
470
470
|
authorizeUrlVarName,
|
|
471
|
-
strLiteral('https://trello.com/1/OAuthAuthorizeToken')
|
|
472
|
-
)
|
|
471
|
+
strLiteral('https://trello.com/1/OAuthAuthorizeToken'),
|
|
472
|
+
),
|
|
473
473
|
),
|
|
474
474
|
oauth1TokenExchangeFunc(
|
|
475
475
|
getRequestTokenFuncName,
|
|
476
476
|
requestTokenVarName,
|
|
477
477
|
objProperty('oauth_signature_method', strLiteral('HMAC-SHA1')),
|
|
478
478
|
objProperty('oauth_callback', 'bundle.inputData.redirect_uri'),
|
|
479
|
-
comment("oauth_version: '1.0' // sometimes required")
|
|
479
|
+
comment("oauth_version: '1.0' // sometimes required"),
|
|
480
480
|
),
|
|
481
481
|
oauth1TokenExchangeFunc(
|
|
482
482
|
getOauthAccessTokenFuncName,
|
|
483
483
|
accessTokenVarName,
|
|
484
484
|
objProperty('oauth_token', 'bundle.inputData.oauth_token'),
|
|
485
485
|
objProperty('oauth_token_secret', 'bundle.inputData.oauth_token_secret'),
|
|
486
|
-
objProperty('oauth_verifier', 'bundle.inputData.oauth_verifier')
|
|
486
|
+
objProperty('oauth_verifier', 'bundle.inputData.oauth_verifier'),
|
|
487
487
|
),
|
|
488
488
|
beforeMiddlewareFunc(
|
|
489
489
|
includeAccessTokenFuncName,
|
|
490
490
|
ifStatement(
|
|
491
491
|
'bundle.authData && bundle.authData.oauth_token && bundle.authData.oauth_token_secret',
|
|
492
492
|
comment(
|
|
493
|
-
'Put your OAuth1 credentials in `req.auth`, Zapier will sign the request for you.'
|
|
493
|
+
'Put your OAuth1 credentials in `req.auth`, Zapier will sign the request for you.',
|
|
494
494
|
),
|
|
495
495
|
assignmentStatement(
|
|
496
496
|
'request.auth',
|
|
@@ -500,13 +500,13 @@ const oauth1AuthFile = () => {
|
|
|
500
500
|
objProperty('oauth_token', 'bundle.authData.oauth_token'),
|
|
501
501
|
objProperty(
|
|
502
502
|
'oauth_token_secret',
|
|
503
|
-
'bundle.authData.oauth_token_secret'
|
|
503
|
+
'bundle.authData.oauth_token_secret',
|
|
504
504
|
),
|
|
505
505
|
comment("oauth_version: '1.0', // sometimes required"),
|
|
506
|
-
objProperty('...(request.auth || {})')
|
|
507
|
-
)
|
|
508
|
-
)
|
|
509
|
-
)
|
|
506
|
+
objProperty('...(request.auth || {})'),
|
|
507
|
+
),
|
|
508
|
+
),
|
|
509
|
+
),
|
|
510
510
|
),
|
|
511
511
|
authTestFunc(strLiteral('https://api.trello.com/1/members/me/')),
|
|
512
512
|
authFileExport('oauth1', 'OAuth1 is an older form of OAuth', {
|
|
@@ -516,7 +516,7 @@ const oauth1AuthFile = () => {
|
|
|
516
516
|
'oauth1Config',
|
|
517
517
|
obj(
|
|
518
518
|
comment(
|
|
519
|
-
"We have to define getRequestToken and getAccessToken functions to explicitly parse the response like it has a form body here, since Trello responds 'text/plain' for the Content-Type header"
|
|
519
|
+
"We have to define getRequestToken and getAccessToken functions to explicitly parse the response like it has a form body here, since Trello responds 'text/plain' for the Content-Type header",
|
|
520
520
|
),
|
|
521
521
|
objProperty(getRequestTokenFuncName),
|
|
522
522
|
objProperty(getOauthAccessTokenFuncName),
|
|
@@ -529,18 +529,21 @@ const oauth1AuthFile = () => {
|
|
|
529
529
|
obj(
|
|
530
530
|
objProperty(
|
|
531
531
|
'oauth_token',
|
|
532
|
-
strLiteral('{{bundle.inputData.oauth_token}}')
|
|
532
|
+
strLiteral('{{bundle.inputData.oauth_token}}'),
|
|
533
|
+
),
|
|
534
|
+
objProperty(
|
|
535
|
+
'name',
|
|
536
|
+
strLiteral('Zapier/Trello OAuth1 Test'),
|
|
533
537
|
),
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
)
|
|
538
|
+
),
|
|
539
|
+
),
|
|
540
|
+
),
|
|
541
|
+
),
|
|
542
|
+
),
|
|
540
543
|
),
|
|
541
544
|
],
|
|
542
545
|
connectionLabel: strLiteral('{{username}}'),
|
|
543
|
-
})
|
|
546
|
+
}),
|
|
544
547
|
);
|
|
545
548
|
};
|
|
546
549
|
|
package/src/utils/build.js
CHANGED
|
@@ -99,7 +99,7 @@ const requiredFiles = (cwd, entryPoints) => {
|
|
|
99
99
|
.on('end', () => {
|
|
100
100
|
paths.sort();
|
|
101
101
|
resolve(paths);
|
|
102
|
-
})
|
|
102
|
+
}),
|
|
103
103
|
);
|
|
104
104
|
b.bundle();
|
|
105
105
|
});
|
|
@@ -152,10 +152,10 @@ const forceIncludeDumbPath = (appConfig, filePath) => {
|
|
|
152
152
|
filePath.endsWith(path.join('bin', 'linux-x64-node-14', 'deasync.node')) ||
|
|
153
153
|
filePath.endsWith(
|
|
154
154
|
// Special, for zapier-platform-legacy-scripting-runner
|
|
155
|
-
path.join('bin', `linux-x64-node-${nodeMajorVersion}`, 'deasync.node')
|
|
155
|
+
path.join('bin', `linux-x64-node-${nodeMajorVersion}`, 'deasync.node'),
|
|
156
156
|
) ||
|
|
157
157
|
filePath.match(
|
|
158
|
-
path.sep === '\\' ? /aws-sdk\\apis\\.*\.json/ : /aws-sdk\/apis\/.*\.json
|
|
158
|
+
path.sep === '\\' ? /aws-sdk\\apis\\.*\.json/ : /aws-sdk\/apis\/.*\.json/,
|
|
159
159
|
) ||
|
|
160
160
|
matchesConfigInclude
|
|
161
161
|
);
|
|
@@ -211,7 +211,7 @@ const makeZip = async (dir, zipPath, disableDependencyDetection) => {
|
|
|
211
211
|
paths = dumbPaths;
|
|
212
212
|
} else {
|
|
213
213
|
let finalPaths = smartPaths.concat(
|
|
214
|
-
dumbPaths.filter(forceIncludeDumbPath.bind(null, appConfig))
|
|
214
|
+
dumbPaths.filter(forceIncludeDumbPath.bind(null, appConfig)),
|
|
215
215
|
);
|
|
216
216
|
finalPaths = _.uniq(finalPaths);
|
|
217
217
|
finalPaths.sort();
|
|
@@ -257,7 +257,7 @@ const maybeNotifyAboutOutdated = () => {
|
|
|
257
257
|
// `build` won't run if package.json isn't there, so if we get to here we're good
|
|
258
258
|
const requiredVersion = _.get(
|
|
259
259
|
require(path.resolve('./package.json')),
|
|
260
|
-
`dependencies.${constants.PLATFORM_PACKAGE}
|
|
260
|
+
`dependencies.${constants.PLATFORM_PACKAGE}`,
|
|
261
261
|
);
|
|
262
262
|
|
|
263
263
|
if (requiredVersion) {
|
|
@@ -269,11 +269,11 @@ const maybeNotifyAboutOutdated = () => {
|
|
|
269
269
|
if (notifier.update && notifier.update.latest !== requiredVersion) {
|
|
270
270
|
notifier.notify({
|
|
271
271
|
message: `There's a newer version of ${colors.cyan(
|
|
272
|
-
constants.PLATFORM_PACKAGE
|
|
272
|
+
constants.PLATFORM_PACKAGE,
|
|
273
273
|
)} available.\nConsider updating the dependency in your\n${colors.cyan(
|
|
274
|
-
'package.json'
|
|
274
|
+
'package.json',
|
|
275
275
|
)} (${colors.grey(notifier.update.current)} → ${colors.green(
|
|
276
|
-
notifier.update.latest
|
|
276
|
+
notifier.update.latest,
|
|
277
277
|
)}) and then running ${colors.red('zapier test')}.`,
|
|
278
278
|
});
|
|
279
279
|
}
|
|
@@ -285,10 +285,9 @@ const maybeRunBuildScript = async (options = {}) => {
|
|
|
285
285
|
|
|
286
286
|
// Make sure we don't accidentally call the Zapier build hook inside itself
|
|
287
287
|
if (process.env.npm_lifecycle_event !== ZAPIER_BUILD_KEY) {
|
|
288
|
-
const pJson = require(
|
|
289
|
-
options.cwd || process.cwd(),
|
|
290
|
-
|
|
291
|
-
));
|
|
288
|
+
const pJson = require(
|
|
289
|
+
path.resolve(options.cwd || process.cwd(), 'package.json'),
|
|
290
|
+
);
|
|
292
291
|
|
|
293
292
|
if (_.get(pJson, ['scripts', ZAPIER_BUILD_KEY])) {
|
|
294
293
|
startSpinner(`Running ${ZAPIER_BUILD_KEY} script`);
|
|
@@ -314,7 +313,7 @@ const listWorkspaces = (workspaceRoot) => {
|
|
|
314
313
|
}
|
|
315
314
|
|
|
316
315
|
return (packageJson.workspaces || []).map((relpath) =>
|
|
317
|
-
path.resolve(workspaceRoot, relpath)
|
|
316
|
+
path.resolve(workspaceRoot, relpath),
|
|
318
317
|
);
|
|
319
318
|
};
|
|
320
319
|
|
|
@@ -332,7 +331,7 @@ const _buildFunc = async ({
|
|
|
332
331
|
const osTmpDir = await fse.realpath(os.tmpdir());
|
|
333
332
|
const tmpDir = path.join(
|
|
334
333
|
osTmpDir,
|
|
335
|
-
'zapier-' + crypto.randomBytes(4).toString('hex')
|
|
334
|
+
'zapier-' + crypto.randomBytes(4).toString('hex'),
|
|
336
335
|
);
|
|
337
336
|
debug('Using temp directory: ', tmpDir);
|
|
338
337
|
|
|
@@ -373,7 +372,7 @@ const _buildFunc = async ({
|
|
|
373
372
|
if (stat.isSymbolicLink()) {
|
|
374
373
|
const realPath = path.resolve(
|
|
375
374
|
path.dirname(src),
|
|
376
|
-
fse.readlinkSync(src)
|
|
375
|
+
fse.readlinkSync(src),
|
|
377
376
|
);
|
|
378
377
|
for (const workspace of workspaces) {
|
|
379
378
|
// Use minimatch to do glob pattern match. If match, it means the
|
|
@@ -408,11 +407,11 @@ const _buildFunc = async ({
|
|
|
408
407
|
const corePath = path.join(
|
|
409
408
|
tmpDir,
|
|
410
409
|
'node_modules',
|
|
411
|
-
constants.PLATFORM_PACKAGE
|
|
410
|
+
constants.PLATFORM_PACKAGE,
|
|
412
411
|
);
|
|
413
412
|
if (!fs.existsSync(corePath)) {
|
|
414
413
|
throw new Error(
|
|
415
|
-
'Could not install dependencies properly. Error log:\n' + output.stderr
|
|
414
|
+
'Could not install dependencies properly. Error log:\n' + output.stderr,
|
|
416
415
|
);
|
|
417
416
|
}
|
|
418
417
|
|
|
@@ -428,12 +427,12 @@ const _buildFunc = async ({
|
|
|
428
427
|
'node_modules',
|
|
429
428
|
constants.PLATFORM_PACKAGE,
|
|
430
429
|
'include',
|
|
431
|
-
'zapierwrapper.js'
|
|
432
|
-
)
|
|
430
|
+
'zapierwrapper.js',
|
|
431
|
+
),
|
|
433
432
|
);
|
|
434
433
|
await writeFile(
|
|
435
434
|
path.join(tmpDir, 'zapierwrapper.js'),
|
|
436
|
-
zapierWrapperBuf.toString()
|
|
435
|
+
zapierWrapperBuf.toString(),
|
|
437
436
|
);
|
|
438
437
|
|
|
439
438
|
if (printProgress) {
|
|
@@ -449,13 +448,13 @@ const _buildFunc = async ({
|
|
|
449
448
|
|
|
450
449
|
const fileWriteError = await writeFile(
|
|
451
450
|
path.join(tmpDir, 'definition.json'),
|
|
452
|
-
prettyJSONstringify(rawDefinition)
|
|
451
|
+
prettyJSONstringify(rawDefinition),
|
|
453
452
|
);
|
|
454
453
|
|
|
455
454
|
if (fileWriteError) {
|
|
456
455
|
debug('\nFile Write Error:\n', fileWriteError, '\n');
|
|
457
456
|
throw new Error(
|
|
458
|
-
`Unable to write ${tmpDir}/definition.json, please check file permissions
|
|
457
|
+
`Unable to write ${tmpDir}/definition.json, please check file permissions!`,
|
|
459
458
|
);
|
|
460
459
|
}
|
|
461
460
|
|
|
@@ -481,7 +480,7 @@ const _buildFunc = async ({
|
|
|
481
480
|
if (validationErrors.length) {
|
|
482
481
|
debug('\nErrors:\n', validationErrors, '\n');
|
|
483
482
|
throw new Error(
|
|
484
|
-
'We hit some validation errors, try running `zapier validate` to see them!'
|
|
483
|
+
'We hit some validation errors, try running `zapier validate` to see them!',
|
|
485
484
|
);
|
|
486
485
|
}
|
|
487
486
|
|
|
@@ -493,10 +492,10 @@ const _buildFunc = async ({
|
|
|
493
492
|
debug(
|
|
494
493
|
'\nErrors:\n',
|
|
495
494
|
prettyJSONstringify(styleChecksResponse.errors.results),
|
|
496
|
-
'\n'
|
|
495
|
+
'\n',
|
|
497
496
|
);
|
|
498
497
|
throw new Error(
|
|
499
|
-
'We hit some style validation errors, try running `zapier validate` to see them!'
|
|
498
|
+
'We hit some style validation errors, try running `zapier validate` to see them!',
|
|
500
499
|
);
|
|
501
500
|
}
|
|
502
501
|
if (printProgress) {
|
|
@@ -524,7 +523,7 @@ const _buildFunc = async ({
|
|
|
524
523
|
await makeSourceZip(
|
|
525
524
|
tmpDir,
|
|
526
525
|
path.join(wdir, sourceZipPath),
|
|
527
|
-
disableDependencyDetection
|
|
526
|
+
disableDependencyDetection,
|
|
528
527
|
);
|
|
529
528
|
|
|
530
529
|
if (printProgress) {
|
|
@@ -541,7 +540,7 @@ const _buildFunc = async ({
|
|
|
541
540
|
await runCommand(
|
|
542
541
|
'find',
|
|
543
542
|
['.', '-exec', 'touch', '-t', '201601010000', '{}', '+'],
|
|
544
|
-
{ cwd: tmpDir }
|
|
543
|
+
{ cwd: tmpDir },
|
|
545
544
|
);
|
|
546
545
|
}
|
|
547
546
|
|
|
@@ -561,7 +560,7 @@ const _buildFunc = async ({
|
|
|
561
560
|
|
|
562
561
|
const buildAndOrUpload = async (
|
|
563
562
|
{ build = false, upload = false } = {},
|
|
564
|
-
buildOpts
|
|
563
|
+
buildOpts,
|
|
565
564
|
) => {
|
|
566
565
|
if (!(build || upload)) {
|
|
567
566
|
throw new Error('must either build or upload');
|
package/src/utils/changelog.js
CHANGED
|
@@ -18,7 +18,7 @@ const getChangelogFromMarkdown = (version, markdown) => {
|
|
|
18
18
|
.split('\n');
|
|
19
19
|
|
|
20
20
|
let startingLine = lines.findIndex((line) =>
|
|
21
|
-
RegExp(`^#{1,4} .*${version.split('.').join('\\.')}`).test(line)
|
|
21
|
+
RegExp(`^#{1,4} .*${version.split('.').join('\\.')}`).test(line),
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
if (startingLine === -1) {
|