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
package/src/utils/api.js
CHANGED
|
@@ -32,7 +32,7 @@ const readCredentials = (explodeIfMissing = true) => {
|
|
|
32
32
|
return Promise.resolve(
|
|
33
33
|
readFile(
|
|
34
34
|
constants.AUTH_LOCATION,
|
|
35
|
-
`Please run \`${colors.cyan('zapier login')}
|
|
35
|
+
`Please run \`${colors.cyan('zapier login')}\`.`,
|
|
36
36
|
)
|
|
37
37
|
.then((buf) => {
|
|
38
38
|
return JSON.parse(buf.toString());
|
|
@@ -43,7 +43,7 @@ const readCredentials = (explodeIfMissing = true) => {
|
|
|
43
43
|
} else {
|
|
44
44
|
return {};
|
|
45
45
|
}
|
|
46
|
-
})
|
|
46
|
+
}),
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
};
|
|
@@ -54,7 +54,7 @@ const callAPI = async (
|
|
|
54
54
|
options,
|
|
55
55
|
rawError = false,
|
|
56
56
|
credentialsRequired = true,
|
|
57
|
-
returnStreamBody = false
|
|
57
|
+
returnStreamBody = false,
|
|
58
58
|
) => {
|
|
59
59
|
// temp manual enable while we're not all the way moved over
|
|
60
60
|
if (_.get(global, ['argOpts', 'debug'])) {
|
|
@@ -95,7 +95,7 @@ const callAPI = async (
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
debug(`>> ${requestOptions.method} ${requestOptions.url}`);
|
|
98
|
+
debug(`>> ${requestOptions.method} ${requestOptions.url || res.url}`);
|
|
99
99
|
|
|
100
100
|
if (requestOptions.body) {
|
|
101
101
|
const replacementStr = 'raw zip removed in logs';
|
|
@@ -149,7 +149,7 @@ const createCredentials = (username, password, totpCode) => {
|
|
|
149
149
|
},
|
|
150
150
|
},
|
|
151
151
|
// if totp is empty, we want a raw request so we can supress an error. If it's here, we want it to be "non-raw"
|
|
152
|
-
!totpCode
|
|
152
|
+
!totpCode,
|
|
153
153
|
);
|
|
154
154
|
};
|
|
155
155
|
|
|
@@ -162,22 +162,19 @@ const createCanary = async (versionFrom, versionTo, percent, duration) => {
|
|
|
162
162
|
method: 'POST',
|
|
163
163
|
body: {
|
|
164
164
|
percent,
|
|
165
|
-
duration
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
}
|
|
165
|
+
duration,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
);
|
|
169
|
+
};
|
|
170
170
|
|
|
171
171
|
const listCanaries = async () => {
|
|
172
172
|
const linkedAppId = (await getLinkedAppConfig(undefined, true))?.id;
|
|
173
173
|
|
|
174
|
-
return callAPI(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
)
|
|
180
|
-
}
|
|
174
|
+
return callAPI(`/apps/${linkedAppId}/canaries`, {
|
|
175
|
+
method: 'GET',
|
|
176
|
+
});
|
|
177
|
+
};
|
|
181
178
|
|
|
182
179
|
const deleteCanary = async (versionFrom, versionTo) => {
|
|
183
180
|
const linkedAppId = (await getLinkedAppConfig(undefined, true))?.id;
|
|
@@ -186,9 +183,9 @@ const deleteCanary = async (versionFrom, versionTo) => {
|
|
|
186
183
|
`/apps/${linkedAppId}/versions/${versionFrom}/canary-to/${versionTo}`,
|
|
187
184
|
{
|
|
188
185
|
method: 'DELETE',
|
|
189
|
-
}
|
|
190
|
-
)
|
|
191
|
-
}
|
|
186
|
+
},
|
|
187
|
+
);
|
|
188
|
+
};
|
|
192
189
|
|
|
193
190
|
/**
|
|
194
191
|
* read local `apprc` file
|
|
@@ -242,10 +239,10 @@ const getWritableApp = async () => {
|
|
|
242
239
|
if (!linkedAppConfig.id) {
|
|
243
240
|
throw new Error(
|
|
244
241
|
`This project hasn't yet been associated with an existing Zapier integration.\n\nIf it's a brand new integration, run \`${colors.cyan(
|
|
245
|
-
'zapier register'
|
|
242
|
+
'zapier register',
|
|
246
243
|
)}\`.\n\nIf this project already exists in your Zapier account, run \`${colors.cyan(
|
|
247
|
-
'zapier link'
|
|
248
|
-
)}\` instead
|
|
244
|
+
'zapier link',
|
|
245
|
+
)}\` instead.`,
|
|
249
246
|
);
|
|
250
247
|
}
|
|
251
248
|
|
|
@@ -261,7 +258,7 @@ const getWritableApp = async () => {
|
|
|
261
258
|
throw new Error(
|
|
262
259
|
`Your credentials are present, but invalid${
|
|
263
260
|
process.env.ZAPIER_BASE_ENDPOINT ? ' in this environment' : ''
|
|
264
|
-
}. Please run \`${colors.cyan('zapier login')}\` to resolve
|
|
261
|
+
}. Please run \`${colors.cyan('zapier login')}\` to resolve.`,
|
|
265
262
|
);
|
|
266
263
|
} else if (errOrRejectedResponse.status === 404) {
|
|
267
264
|
// if this fails, we know the issue is they can't see this app
|
|
@@ -272,9 +269,9 @@ const getWritableApp = async () => {
|
|
|
272
269
|
}). Try running \`${colors.cyan('zapier link')}\` to correct that.${
|
|
273
270
|
process.env.ZAPIER_BASE_ENDPOINT
|
|
274
271
|
? `\n\nFor local dev: make sure you've run \`${colors.cyan(
|
|
275
|
-
'zapier login'
|
|
272
|
+
'zapier login',
|
|
276
273
|
)}\` and \`${colors.cyan(
|
|
277
|
-
'zapier register'
|
|
274
|
+
'zapier register',
|
|
278
275
|
)}\` while providing ZAPIER_BASE_ENDPOINT.`
|
|
279
276
|
: ''
|
|
280
277
|
}`;
|
|
@@ -399,10 +396,10 @@ const downloadSourceZip = async (dst) => {
|
|
|
399
396
|
if (!linkedAppConfig.id) {
|
|
400
397
|
throw new Error(
|
|
401
398
|
`This project hasn't yet been associated with an existing Zapier integration.\n\nIf it's a brand new integration, run \`${colors.cyan(
|
|
402
|
-
'zapier register'
|
|
399
|
+
'zapier register',
|
|
403
400
|
)}\`.\n\nIf this project already exists in your Zapier account, run \`${colors.cyan(
|
|
404
|
-
'zapier link'
|
|
405
|
-
)}\` instead
|
|
401
|
+
'zapier link',
|
|
402
|
+
)}\` instead.`,
|
|
406
403
|
);
|
|
407
404
|
}
|
|
408
405
|
|
|
@@ -434,7 +431,7 @@ const upload = async (app, { skipValidation = false } = {}) => {
|
|
|
434
431
|
|
|
435
432
|
if (!fs.existsSync(fullZipPath)) {
|
|
436
433
|
throw new Error(
|
|
437
|
-
'Missing a built integration. Try running `zapier build` first.\nAlternatively, run `zapier push`, which will build and upload in one command.'
|
|
434
|
+
'Missing a built integration. Try running `zapier build` first.\nAlternatively, run `zapier push`, which will build and upload in one command.',
|
|
438
435
|
);
|
|
439
436
|
}
|
|
440
437
|
|
package/src/utils/ast.js
CHANGED
|
@@ -45,7 +45,7 @@ const importActionInJsApp = (codeStr, varName, path) => {
|
|
|
45
45
|
const newRequireStatement = j.variableDeclaration('const', [
|
|
46
46
|
j.variableDeclarator(
|
|
47
47
|
j.identifier(varName),
|
|
48
|
-
j.callExpression(j.identifier('require'), [j.literal(path)])
|
|
48
|
+
j.callExpression(j.identifier('require'), [j.literal(path)]),
|
|
49
49
|
),
|
|
50
50
|
]);
|
|
51
51
|
|
|
@@ -80,13 +80,13 @@ const registerActionInJsApp = (codeStr, property, varName) => {
|
|
|
80
80
|
const exportAssignment = root.find(j.AssignmentExpression, {
|
|
81
81
|
left: typeHelpers.memberExpression(
|
|
82
82
|
typeHelpers.identifier('module'),
|
|
83
|
-
typeHelpers.identifier('exports')
|
|
83
|
+
typeHelpers.identifier('exports'),
|
|
84
84
|
),
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
if (!exportAssignment.length) {
|
|
88
88
|
throw new Error(
|
|
89
|
-
'Nothing is exported from this file; unable to find an object to modify'
|
|
89
|
+
'Nothing is exported from this file; unable to find an object to modify',
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -115,14 +115,14 @@ const registerActionInJsApp = (codeStr, property, varName) => {
|
|
|
115
115
|
|
|
116
116
|
// check if this object already has the property at the top level
|
|
117
117
|
const existingProp = objToModify.properties.find(
|
|
118
|
-
(props) => props.key.name === property
|
|
118
|
+
(props) => props.key.name === property,
|
|
119
119
|
);
|
|
120
120
|
if (existingProp) {
|
|
121
121
|
// `triggers: myTriggers` means we shouldn't bother
|
|
122
122
|
const value = existingProp.value;
|
|
123
123
|
if (value.type !== 'ObjectExpression') {
|
|
124
124
|
throw new Error(
|
|
125
|
-
`Tried to edit the ${property} key, but the value wasn't an object
|
|
125
|
+
`Tried to edit the ${property} key, but the value wasn't an object`,
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
value.properties.push(newProperty);
|
|
@@ -131,8 +131,8 @@ const registerActionInJsApp = (codeStr, property, varName) => {
|
|
|
131
131
|
j.property(
|
|
132
132
|
'init',
|
|
133
133
|
j.identifier(property),
|
|
134
|
-
j.objectExpression([newProperty])
|
|
135
|
-
)
|
|
134
|
+
j.objectExpression([newProperty]),
|
|
135
|
+
),
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
138
|
|
|
@@ -151,7 +151,7 @@ const registerActionInJsApp = (codeStr, property, varName) => {
|
|
|
151
151
|
const importActionInTsApp = (
|
|
152
152
|
codeStr,
|
|
153
153
|
identifierName,
|
|
154
|
-
actionRelativeImportPath
|
|
154
|
+
actionRelativeImportPath,
|
|
155
155
|
) => {
|
|
156
156
|
const root = ts(codeStr);
|
|
157
157
|
|
|
@@ -159,7 +159,7 @@ const importActionInTsApp = (
|
|
|
159
159
|
|
|
160
160
|
const newImportStatement = j.importDeclaration(
|
|
161
161
|
[j.importDefaultSpecifier(j.identifier(identifierName))],
|
|
162
|
-
j.literal(actionRelativeImportPath)
|
|
162
|
+
j.literal(actionRelativeImportPath),
|
|
163
163
|
);
|
|
164
164
|
|
|
165
165
|
if (imports.length) {
|
|
@@ -197,8 +197,8 @@ const registerActionInTsApp = (codeStr, actionTypePlural, identifierName) => {
|
|
|
197
197
|
.find(ts.ObjectExpression)
|
|
198
198
|
.filter((path) =>
|
|
199
199
|
path.value.properties.some(
|
|
200
|
-
(prop) => prop.key && prop.key.name === 'platformVersion'
|
|
201
|
-
)
|
|
200
|
+
(prop) => prop.key && prop.key.name === 'platformVersion',
|
|
201
|
+
),
|
|
202
202
|
);
|
|
203
203
|
if (appObjectCandidates.length !== 1) {
|
|
204
204
|
throw new Error('Unable to find the app definition to modify');
|
|
@@ -209,13 +209,13 @@ const registerActionInTsApp = (codeStr, actionTypePlural, identifierName) => {
|
|
|
209
209
|
|
|
210
210
|
// Check if this object already has the actionType group inside it.
|
|
211
211
|
const existingProp = appObj.properties.find(
|
|
212
|
-
(props) => props.key.name === actionTypePlural
|
|
212
|
+
(props) => props.key.name === actionTypePlural,
|
|
213
213
|
);
|
|
214
214
|
if (existingProp) {
|
|
215
215
|
const value = existingProp.value;
|
|
216
216
|
if (value.type !== 'ObjectExpression') {
|
|
217
217
|
throw new Error(
|
|
218
|
-
`Tried to edit the ${actionTypePlural} key, but the value wasn't an object
|
|
218
|
+
`Tried to edit the ${actionTypePlural} key, but the value wasn't an object`,
|
|
219
219
|
);
|
|
220
220
|
}
|
|
221
221
|
value.properties.push(newProperty);
|
|
@@ -224,8 +224,8 @@ const registerActionInTsApp = (codeStr, actionTypePlural, identifierName) => {
|
|
|
224
224
|
j.property(
|
|
225
225
|
'init',
|
|
226
226
|
j.identifier(actionTypePlural),
|
|
227
|
-
j.objectExpression([newProperty])
|
|
228
|
-
)
|
|
227
|
+
j.objectExpression([newProperty]),
|
|
228
|
+
),
|
|
229
229
|
);
|
|
230
230
|
}
|
|
231
231
|
|