zapier-platform-cli 18.4.0 → 18.5.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/package.json +4 -4
- package/src/app-templates.js +1 -0
- package/src/generators/index.js +3 -2
- package/src/generators/templates/README.template.md +9 -9
- package/src/generators/templates/line-items/README.md +16 -0
- package/src/generators/templates/line-items/creates/order.js +67 -0
- package/src/generators/templates/line-items/index.js +12 -0
- package/src/generators/templates/line-items/test/creates.test.js +30 -0
- package/src/oclif/ZapierBaseCommand.js +1 -1
- package/src/oclif/commands/analytics.js +1 -1
- package/src/oclif/commands/build.js +3 -3
- package/src/oclif/commands/cache/clear.js +5 -2
- package/src/oclif/commands/canary/create.js +7 -7
- package/src/oclif/commands/canary/delete.js +1 -1
- package/src/oclif/commands/canary/list.js +1 -1
- package/src/oclif/commands/convert.js +1 -1
- package/src/oclif/commands/delete/integration.js +1 -1
- package/src/oclif/commands/delete/version.js +1 -1
- package/src/oclif/commands/deprecate.js +4 -4
- package/src/oclif/commands/describe.js +3 -3
- package/src/oclif/commands/env/get.js +2 -2
- package/src/oclif/commands/env/set.js +3 -1
- package/src/oclif/commands/env/unset.js +1 -1
- package/src/oclif/commands/init.js +5 -5
- package/src/oclif/commands/integrations.js +2 -1
- package/src/oclif/commands/invoke/action.js +4 -2
- package/src/oclif/commands/invoke/auth/refresh.js +1 -1
- package/src/oclif/commands/invoke/index.js +9 -2
- package/src/oclif/commands/invoke/input-types.js +10 -2
- package/src/oclif/commands/invoke/prompts.js +238 -11
- package/src/oclif/commands/invoke/remote.js +41 -15
- package/src/oclif/commands/jobs.js +2 -2
- package/src/oclif/commands/legacy.js +1 -1
- package/src/oclif/commands/link.js +2 -2
- package/src/oclif/commands/logs.js +3 -3
- package/src/oclif/commands/migrate.js +10 -10
- package/src/oclif/commands/promote.js +5 -5
- package/src/oclif/commands/pull.js +1 -1
- package/src/oclif/commands/push.js +5 -2
- package/src/oclif/commands/register.js +8 -8
- package/src/oclif/commands/scaffold.js +4 -4
- package/src/oclif/commands/team/add.js +3 -3
- package/src/oclif/commands/team/get.js +2 -2
- package/src/oclif/commands/test.js +4 -4
- package/src/oclif/commands/upload.js +1 -1
- package/src/oclif/commands/users/add.js +3 -3
- package/src/oclif/commands/users/get.js +4 -4
- package/src/oclif/commands/users/links.js +1 -1
- package/src/oclif/commands/validate.js +5 -5
- package/src/oclif/commands/versions.js +1 -1
|
@@ -71,10 +71,43 @@ const getLabelForDynamicDropdown = (obj, preferredKey, fallbackKey) => {
|
|
|
71
71
|
*/
|
|
72
72
|
const getMissingRequiredInputFields = (inputData, inputFields) => {
|
|
73
73
|
return inputFields.filter(
|
|
74
|
-
(f) =>
|
|
74
|
+
(f) =>
|
|
75
|
+
f.required &&
|
|
76
|
+
!f.default &&
|
|
77
|
+
(inputData[f.key] == null || inputData[f.key] === ''),
|
|
75
78
|
);
|
|
76
79
|
};
|
|
77
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Finds required child fields (line items) that are missing values in any row.
|
|
83
|
+
* @param {Object} inputData - The current input data
|
|
84
|
+
* @param {Array<Object>} inputFields - Array of field definitions
|
|
85
|
+
* @returns {Array<Object>} Array of required child fields missing in at least one row
|
|
86
|
+
*/
|
|
87
|
+
const getMissingRequiredChildFields = (inputData, inputFields) => {
|
|
88
|
+
const missing = [];
|
|
89
|
+
for (const field of inputFields) {
|
|
90
|
+
if (!field.children || !field.children.length) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const items = inputData[field.key];
|
|
94
|
+
if (!Array.isArray(items)) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const requiredChildren = field.children.filter(
|
|
98
|
+
(c) => c.required && c.type !== 'copy' && !c.default,
|
|
99
|
+
);
|
|
100
|
+
for (const item of items) {
|
|
101
|
+
for (const c of requiredChildren) {
|
|
102
|
+
if (item[c.key] == null || item[c.key] === '') {
|
|
103
|
+
missing.push(c);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return missing;
|
|
109
|
+
};
|
|
110
|
+
|
|
78
111
|
/**
|
|
79
112
|
* Fetches choices for a dynamic dropdown field.
|
|
80
113
|
* @param {import('../../ZapierBaseCommand')} command - The command instance for prompting
|
|
@@ -324,7 +357,8 @@ const promptForField = async (command, context, field, invokeAction) => {
|
|
|
324
357
|
let nextPagingToken = null;
|
|
325
358
|
|
|
326
359
|
while (
|
|
327
|
-
|
|
360
|
+
answer == null ||
|
|
361
|
+
answer === '' ||
|
|
328
362
|
answer === '__next_page__' ||
|
|
329
363
|
answer === '__prev_page__'
|
|
330
364
|
) {
|
|
@@ -378,8 +412,12 @@ const promptForField = async (command, context, field, invokeAction) => {
|
|
|
378
412
|
}
|
|
379
413
|
return answer;
|
|
380
414
|
} else if (field.type === 'boolean') {
|
|
381
|
-
|
|
382
|
-
|
|
415
|
+
if (field.required) {
|
|
416
|
+
const yes = await command.confirm(message, false, false, true);
|
|
417
|
+
return yes ? 'yes' : 'no';
|
|
418
|
+
} else {
|
|
419
|
+
return await command.prompt(message + ' (yes/no)', { useStderr: true });
|
|
420
|
+
}
|
|
383
421
|
} else {
|
|
384
422
|
return await command.prompt(message, { useStderr: true });
|
|
385
423
|
}
|
|
@@ -400,6 +438,7 @@ const promptOrErrorForRequiredInputFields = async (
|
|
|
400
438
|
inputFields,
|
|
401
439
|
invokeAction,
|
|
402
440
|
) => {
|
|
441
|
+
// Check top-level required fields
|
|
403
442
|
const missingFields = getMissingRequiredInputFields(
|
|
404
443
|
context.inputData,
|
|
405
444
|
inputFields,
|
|
@@ -420,6 +459,49 @@ const promptOrErrorForRequiredInputFields = async (
|
|
|
420
459
|
);
|
|
421
460
|
}
|
|
422
461
|
}
|
|
462
|
+
|
|
463
|
+
// Check required child fields (line items) per row
|
|
464
|
+
const missingChildFields = getMissingRequiredChildFields(
|
|
465
|
+
context.inputData,
|
|
466
|
+
inputFields,
|
|
467
|
+
);
|
|
468
|
+
if (missingChildFields.length) {
|
|
469
|
+
if (context.nonInteractive || context.meta.isFillingDynamicDropdown) {
|
|
470
|
+
throw new Error(
|
|
471
|
+
"You're in non-interactive mode, so you must at least specify these required fields with --inputData: \n" +
|
|
472
|
+
missingChildFields
|
|
473
|
+
.map((f) => '* ' + formatFieldDisplay(f))
|
|
474
|
+
.join('\n'),
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
// Prompt per row for missing child fields
|
|
478
|
+
for (const field of inputFields) {
|
|
479
|
+
if (!field.children || !field.children.length) {
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
const items = context.inputData[field.key];
|
|
483
|
+
if (!Array.isArray(items)) {
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
const requiredChildren = field.children.filter(
|
|
487
|
+
(c) => c.required && c.type !== 'copy' && !c.default,
|
|
488
|
+
);
|
|
489
|
+
for (let i = 0; i < items.length; i++) {
|
|
490
|
+
for (const c of requiredChildren) {
|
|
491
|
+
if (items[i][c.key] == null || items[i][c.key] === '') {
|
|
492
|
+
const label = field.label || field.key;
|
|
493
|
+
console.error(`\n${label} (row ${i + 1}):`);
|
|
494
|
+
items[i][c.key] = await promptForField(
|
|
495
|
+
command,
|
|
496
|
+
context,
|
|
497
|
+
c,
|
|
498
|
+
invokeAction,
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
423
505
|
};
|
|
424
506
|
|
|
425
507
|
/**
|
|
@@ -451,8 +533,22 @@ const promptForInputFieldEdit = async (
|
|
|
451
533
|
} else {
|
|
452
534
|
name = f.key;
|
|
453
535
|
}
|
|
454
|
-
|
|
455
|
-
|
|
536
|
+
const currentValue = context.inputData[f.key];
|
|
537
|
+
if (currentValue != null && currentValue !== '') {
|
|
538
|
+
if (Array.isArray(currentValue)) {
|
|
539
|
+
const MAX_LEN = 60;
|
|
540
|
+
const csv = currentValue
|
|
541
|
+
.map((item) => `{${Object.values(item).join(',')}}`)
|
|
542
|
+
.join(', ');
|
|
543
|
+
const count = `(${currentValue.length} ${currentValue.length === 1 ? 'item' : 'items'})`;
|
|
544
|
+
if (csv.length <= MAX_LEN) {
|
|
545
|
+
name += ` [${csv}] ${count}`;
|
|
546
|
+
} else {
|
|
547
|
+
name += ` [${csv.slice(0, MAX_LEN)}...] ${count}`;
|
|
548
|
+
}
|
|
549
|
+
} else {
|
|
550
|
+
name += ` [current: "${currentValue}"]`;
|
|
551
|
+
}
|
|
456
552
|
} else if (f.default) {
|
|
457
553
|
name += ` [default: "${f.default}"]`;
|
|
458
554
|
}
|
|
@@ -479,12 +575,143 @@ const promptForInputFieldEdit = async (
|
|
|
479
575
|
}
|
|
480
576
|
|
|
481
577
|
const field = inputFields.find((f) => f.key === fieldKey);
|
|
482
|
-
|
|
483
|
-
command,
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
578
|
+
if (field.children && field.children.length) {
|
|
579
|
+
await promptForLineItemEdit(command, context, field, invokeAction);
|
|
580
|
+
} else {
|
|
581
|
+
context.inputData[fieldKey] = await promptForField(
|
|
582
|
+
command,
|
|
583
|
+
context,
|
|
584
|
+
field,
|
|
585
|
+
invokeAction,
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Prompts the user to add a new line item row by prompting for each child field.
|
|
593
|
+
* @param {import('../../ZapierBaseCommand')} command - The command instance
|
|
594
|
+
* @param {Object} context - The execution context
|
|
595
|
+
* @param {Object} field - The parent field definition with children
|
|
596
|
+
* @param {Function} invokeAction - Function to invoke actions
|
|
597
|
+
* @returns {Promise<Object>} The new row object
|
|
598
|
+
*/
|
|
599
|
+
const promptForNewLineItemRow = async (
|
|
600
|
+
command,
|
|
601
|
+
context,
|
|
602
|
+
field,
|
|
603
|
+
invokeAction,
|
|
604
|
+
) => {
|
|
605
|
+
const row = {};
|
|
606
|
+
for (const child of field.children) {
|
|
607
|
+
if (child.default) {
|
|
608
|
+
row[child.key] = child.default;
|
|
609
|
+
}
|
|
610
|
+
if (child.required) {
|
|
611
|
+
row[child.key] = await promptForField(
|
|
612
|
+
command,
|
|
613
|
+
context,
|
|
614
|
+
child,
|
|
615
|
+
invokeAction,
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
return row;
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Sub-menu for editing line item rows: add, edit, remove rows.
|
|
624
|
+
* @param {import('../../ZapierBaseCommand')} command - The command instance
|
|
625
|
+
* @param {Object} context - The execution context (inputData will be mutated)
|
|
626
|
+
* @param {Object} field - The parent field definition with children
|
|
627
|
+
* @param {Function} invokeAction - Function to invoke actions
|
|
628
|
+
* @returns {Promise<void>}
|
|
629
|
+
*/
|
|
630
|
+
const promptForLineItemEdit = async (command, context, field, invokeAction) => {
|
|
631
|
+
if (!Array.isArray(context.inputData[field.key])) {
|
|
632
|
+
context.inputData[field.key] = [];
|
|
633
|
+
}
|
|
634
|
+
const items = context.inputData[field.key];
|
|
635
|
+
const label = field.label || field.key;
|
|
636
|
+
|
|
637
|
+
while (true) {
|
|
638
|
+
const choices = [
|
|
639
|
+
{ name: '>>> BACK <<<', short: 'BACK', value: '__back__' },
|
|
640
|
+
{ name: '>>> ADD ITEM <<<', value: '__add__' },
|
|
641
|
+
];
|
|
642
|
+
for (let i = 0; i < items.length; i++) {
|
|
643
|
+
const parts = Object.entries(items[i])
|
|
644
|
+
.map(([k, v]) => `${k}: ${JSON.stringify(v)}`)
|
|
645
|
+
.join(', ');
|
|
646
|
+
choices.push({
|
|
647
|
+
name: parts ? `[${i}] {${parts}}` : `[${i}] Empty item - select to edit`,
|
|
648
|
+
value: `__select_${i}`,
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
const action = await command.promptWithList(
|
|
653
|
+
`${label} [${items.length} ${items.length === 1 ? 'item' : 'items'}]:`,
|
|
654
|
+
choices,
|
|
655
|
+
{ useStderr: true },
|
|
487
656
|
);
|
|
657
|
+
|
|
658
|
+
if (action === '__back__') {
|
|
659
|
+
break;
|
|
660
|
+
} else if (action === '__add__') {
|
|
661
|
+
const row = await promptForNewLineItemRow(
|
|
662
|
+
command,
|
|
663
|
+
context,
|
|
664
|
+
field,
|
|
665
|
+
invokeAction,
|
|
666
|
+
);
|
|
667
|
+
items.push(row);
|
|
668
|
+
} else if (action.startsWith('__select_')) {
|
|
669
|
+
const idx = parseInt(action.slice(9));
|
|
670
|
+
// Sub-menu loop for editing/deleting the selected item
|
|
671
|
+
while (true) {
|
|
672
|
+
const editChoices = [
|
|
673
|
+
{ name: '>>> BACK <<<', short: 'BACK', value: '__back__' },
|
|
674
|
+
];
|
|
675
|
+
for (const child of field.children) {
|
|
676
|
+
const current = items[idx] && items[idx][child.key];
|
|
677
|
+
let choiceName;
|
|
678
|
+
if (child.label) {
|
|
679
|
+
choiceName = `${child.label} (${child.key})`;
|
|
680
|
+
} else {
|
|
681
|
+
choiceName = child.key;
|
|
682
|
+
}
|
|
683
|
+
if (current != null) {
|
|
684
|
+
choiceName += ` [current: "${current}"]`;
|
|
685
|
+
}
|
|
686
|
+
editChoices.push({ name: choiceName, value: child.key });
|
|
687
|
+
}
|
|
688
|
+
editChoices.push({
|
|
689
|
+
name: '>>> DELETE ITEM <<<',
|
|
690
|
+
value: '__delete__',
|
|
691
|
+
});
|
|
692
|
+
|
|
693
|
+
const editAction = await command.promptWithList(
|
|
694
|
+
'Edit or delete the item?',
|
|
695
|
+
editChoices,
|
|
696
|
+
{ useStderr: true },
|
|
697
|
+
);
|
|
698
|
+
|
|
699
|
+
if (editAction === '__back__') {
|
|
700
|
+
break;
|
|
701
|
+
} else if (editAction === '__delete__') {
|
|
702
|
+
items.splice(idx, 1);
|
|
703
|
+
break;
|
|
704
|
+
} else {
|
|
705
|
+
const child = field.children.find((c) => c.key === editAction);
|
|
706
|
+
items[idx][editAction] = await promptForField(
|
|
707
|
+
command,
|
|
708
|
+
context,
|
|
709
|
+
child,
|
|
710
|
+
invokeAction,
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
488
715
|
}
|
|
489
716
|
};
|
|
490
717
|
|
|
@@ -37,22 +37,48 @@ const fetchInputFields = async (context) => {
|
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
alterDynamicFields: need.alter_dynamic_fields ?? false,
|
|
54
|
-
};
|
|
40
|
+
const mapNeed = (need) => ({
|
|
41
|
+
key: need.key,
|
|
42
|
+
type: FIELD_TYPE_MAP[need.type] || need.type,
|
|
43
|
+
required: need.required,
|
|
44
|
+
default: need.default,
|
|
45
|
+
choices: need.choices,
|
|
46
|
+
label: need.label,
|
|
47
|
+
helpText: need.help_text,
|
|
48
|
+
inputFormat: need.input_format,
|
|
49
|
+
dynamic: need.prefill,
|
|
50
|
+
list: need.list,
|
|
51
|
+
placeholder: need.placeholder,
|
|
52
|
+
alterDynamicFields: need.alter_dynamic_fields ?? false,
|
|
55
53
|
});
|
|
54
|
+
|
|
55
|
+
// Group child fields (those with parent_key) under their parent
|
|
56
|
+
const parentKeys = new Set(
|
|
57
|
+
responseData.needs.filter((n) => n.parent_key).map((n) => n.parent_key),
|
|
58
|
+
);
|
|
59
|
+
const fields = [];
|
|
60
|
+
const childrenByParent = {};
|
|
61
|
+
for (const need of responseData.needs) {
|
|
62
|
+
if (need.parent_key) {
|
|
63
|
+
if (!childrenByParent[need.parent_key]) {
|
|
64
|
+
childrenByParent[need.parent_key] = [];
|
|
65
|
+
}
|
|
66
|
+
childrenByParent[need.parent_key].push(mapNeed(need));
|
|
67
|
+
} else {
|
|
68
|
+
fields.push(mapNeed(need));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Add parent fields for any parent_key that doesn't have a corresponding
|
|
72
|
+
// top-level field in the response, then attach children
|
|
73
|
+
for (const parentKey of parentKeys) {
|
|
74
|
+
let parent = fields.find((f) => f.key === parentKey);
|
|
75
|
+
if (!parent) {
|
|
76
|
+
parent = { key: parentKey };
|
|
77
|
+
fields.push(parent);
|
|
78
|
+
}
|
|
79
|
+
parent.children = childrenByParent[parentKey];
|
|
80
|
+
}
|
|
81
|
+
return fields;
|
|
56
82
|
};
|
|
57
83
|
|
|
58
84
|
const fetchChoices = async (context, inputFieldKey) => {
|
|
@@ -75,12 +75,12 @@ class JobsCommand extends BaseCommand {
|
|
|
75
75
|
['Errors', 'error_message'],
|
|
76
76
|
],
|
|
77
77
|
emptyMessage:
|
|
78
|
-
'No recent migration or promotion jobs found. Try `zapier history` if you see older jobs.',
|
|
78
|
+
'No recent migration or promotion jobs found. Try `zapier-platform history` if you see older jobs.',
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
JobsCommand.examples = ['zapier jobs'];
|
|
83
|
+
JobsCommand.examples = ['zapier-platform jobs'];
|
|
84
84
|
JobsCommand.description = `Lists ongoing migration or promotion jobs for the current integration.
|
|
85
85
|
|
|
86
86
|
A job represents a background process that will be queued up when users execute a "migrate" or "promote" command for the current integration.
|
|
@@ -45,7 +45,7 @@ LegacyCommand.args = {
|
|
|
45
45
|
required: true,
|
|
46
46
|
}),
|
|
47
47
|
};
|
|
48
|
-
LegacyCommand.examples = ['zapier legacy 1.2.3'];
|
|
48
|
+
LegacyCommand.examples = ['zapier-platform legacy 1.2.3'];
|
|
49
49
|
LegacyCommand.description = `Mark a non-production version of your integration as legacy.
|
|
50
50
|
|
|
51
51
|
Use this when an integration version is no longer recommended for new users, but you don't want to block existing users from using it.
|
|
@@ -37,7 +37,7 @@ class LinkCommand extends BaseCommand {
|
|
|
37
37
|
this.startSpinner(`Setting up ${CURRENT_APP_FILE}`);
|
|
38
38
|
await writeLinkedAppConfig(chosenApp);
|
|
39
39
|
this.stopSpinner();
|
|
40
|
-
this.log(`Done! Now you can \`${cyan('zapier push')}\``);
|
|
40
|
+
this.log(`Done! Now you can \`${cyan('zapier-platform push')}\``);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -47,6 +47,6 @@ LinkCommand.description = `Link the current directory with an existing integrati
|
|
|
47
47
|
|
|
48
48
|
This command generates a \`${CURRENT_APP_FILE}\` file in the directory in which it's ran. This file ties this code to an integration and is referenced frequently during \`push\` and \`validate\` operations. This file should be checked into source control.
|
|
49
49
|
|
|
50
|
-
If you're starting an integration from scratch, use \`zapier init\` instead.`;
|
|
50
|
+
If you're starting an integration from scratch, use \`zapier-platform init\` instead.`;
|
|
51
51
|
|
|
52
52
|
module.exports = LinkCommand;
|
|
@@ -93,7 +93,7 @@ class LogsCommand extends BaseCommand {
|
|
|
93
93
|
rows: logs.reverse(), // oldest logs first
|
|
94
94
|
headers,
|
|
95
95
|
emptyMessage:
|
|
96
|
-
'No logs found. Try adding some `z.request()`, `z.console.log()` and doing a `zapier push`!\n',
|
|
96
|
+
'No logs found. Try adding some `z.request()`, `z.console.log()` and doing a `zapier-platform push`!\n',
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
if (hasLogs) {
|
|
@@ -102,7 +102,7 @@ class LogsCommand extends BaseCommand {
|
|
|
102
102
|
if (this.flags.type === 'http' && !this.flags.detailed) {
|
|
103
103
|
this.log(
|
|
104
104
|
grey(
|
|
105
|
-
' TIP: Use `zapier logs --type=http --detailed` to include response information.',
|
|
105
|
+
' TIP: Use `zapier-platform logs --type=http --detailed` to include response information.',
|
|
106
106
|
),
|
|
107
107
|
);
|
|
108
108
|
}
|
|
@@ -119,6 +119,6 @@ LogsCommand.description = `Print recent logs.
|
|
|
119
119
|
|
|
120
120
|
Logs are created when your integration is run as part of a Zap. They come from explicit calls to \`z.console.log()\`, usage of \`z.request()\`, and any runtime errors.
|
|
121
121
|
|
|
122
|
-
This won't show logs from running locally with \`zapier test\`, since those never hit our server.`;
|
|
122
|
+
This won't show logs from running locally with \`zapier-platform test\`, since those never hit our server.`;
|
|
123
123
|
|
|
124
124
|
module.exports = LogsCommand;
|
|
@@ -143,7 +143,7 @@ class MigrateCommand extends BaseCommand {
|
|
|
143
143
|
this.stopSpinner();
|
|
144
144
|
|
|
145
145
|
this.log(
|
|
146
|
-
`\nMigration successfully queued, check ${colors.bold.underline('zapier jobs')} to track the status. Migrations usually take between 5-10 minutes.`,
|
|
146
|
+
`\nMigration successfully queued, check ${colors.bold.underline('zapier-platform jobs')} to track the status. Migrations usually take between 5-10 minutes.`,
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
@@ -184,24 +184,24 @@ MigrateCommand.args = {
|
|
|
184
184
|
|
|
185
185
|
MigrateCommand.skipValidInstallCheck = true;
|
|
186
186
|
MigrateCommand.examples = [
|
|
187
|
-
'zapier migrate 1.0.0 1.0.1',
|
|
188
|
-
'zapier migrate 1.0.1 2.0.0 10',
|
|
189
|
-
'zapier migrate 2.0.0 2.0.1 --user=user@example.com',
|
|
190
|
-
'zapier migrate 2.0.0 2.0.1 --account=account@example.com',
|
|
187
|
+
'zapier-platform migrate 1.0.0 1.0.1',
|
|
188
|
+
'zapier-platform migrate 1.0.1 2.0.0 10',
|
|
189
|
+
'zapier-platform migrate 2.0.0 2.0.1 --user=user@example.com',
|
|
190
|
+
'zapier-platform migrate 2.0.0 2.0.1 --account=account@example.com',
|
|
191
191
|
];
|
|
192
192
|
MigrateCommand.description = `Migrate a percentage of users or a single user from one version of your integration to another.
|
|
193
193
|
|
|
194
|
-
Start a migration to move users between different versions of your integration. You may also "revert" by simply swapping the from/to verion strings in the command line arguments (i.e. \`zapier migrate 1.0.1 1.0.0\`).
|
|
194
|
+
Start a migration to move users between different versions of your integration. You may also "revert" by simply swapping the from/to verion strings in the command line arguments (i.e. \`zapier-platform migrate 1.0.1 1.0.0\`).
|
|
195
195
|
|
|
196
|
-
**Only use this command to migrate users between non-breaking versions, use \`zapier deprecate\` if you have breaking changes!**
|
|
196
|
+
**Only use this command to migrate users between non-breaking versions, use \`zapier-platform deprecate\` if you have breaking changes!**
|
|
197
197
|
|
|
198
|
-
Migration time varies based on the number of affected Zaps. Be patient and check \`zapier jobs\` to track the status. Or use \`zapier history\` if you want to see older jobs.
|
|
198
|
+
Migration time varies based on the number of affected Zaps. Be patient and check \`zapier-platform jobs\` to track the status. Or use \`zapier-platform history\` if you want to see older jobs.
|
|
199
199
|
|
|
200
200
|
Since a migration is only for non-breaking changes, users are not emailed about the update/migration. It will be a transparent process for them.
|
|
201
201
|
|
|
202
202
|
We recommend migrating a small subset of users first, via the percent argument, then watching error logs of the new version for any sort of odd behavior. When you feel confident there are no bugs, go ahead and migrate everyone. If you see unexpected errors, you can revert.
|
|
203
203
|
|
|
204
|
-
You can migrate a specific user's Zaps by using \`--user\` (i.e. \`zapier migrate 1.0.0 1.0.1 --user=user@example.com\`). This will migrate Zaps that are private for that user. Zaps that are
|
|
204
|
+
You can migrate a specific user's Zaps by using \`--user\` (i.e. \`zapier-platform migrate 1.0.0 1.0.1 --user=user@example.com\`). This will migrate Zaps that are private for that user. Zaps that are
|
|
205
205
|
|
|
206
206
|
- [shared across the team](https://help.zapier.com/hc/en-us/articles/8496277647629),
|
|
207
207
|
- [shared app connections](https://help.zapier.com/hc/en-us/articles/8496326497037-Share-app-connections-with-your-team), or
|
|
@@ -209,7 +209,7 @@ You can migrate a specific user's Zaps by using \`--user\` (i.e. \`zapier migrat
|
|
|
209
209
|
|
|
210
210
|
will **not** be migrated.
|
|
211
211
|
|
|
212
|
-
Alternatively, you can pass the \`--account\` flag, (i.e. \`zapier migrate 1.0.0 1.0.1 --account=account@example.com\`). This will migrate all Zaps owned by the user, Private & Shared, within all accounts for which the specified user is a member.
|
|
212
|
+
Alternatively, you can pass the \`--account\` flag, (i.e. \`zapier-platform migrate 1.0.0 1.0.1 --account=account@example.com\`). This will migrate all Zaps owned by the user, Private & Shared, within all accounts for which the specified user is a member.
|
|
213
213
|
|
|
214
214
|
**The \`--account\` flag should be used cautiously as it can break shared Zaps for other users in Team or Enterprise accounts.**
|
|
215
215
|
|
|
@@ -279,15 +279,15 @@ PromoteCommand.args = {
|
|
|
279
279
|
};
|
|
280
280
|
|
|
281
281
|
PromoteCommand.skipValidInstallCheck = true;
|
|
282
|
-
PromoteCommand.examples = ['zapier promote 1.0.0'];
|
|
282
|
+
PromoteCommand.examples = ['zapier-platform promote 1.0.0'];
|
|
283
283
|
PromoteCommand.description = `Promote a specific version to public access.
|
|
284
284
|
|
|
285
285
|
Promote an integration version into production (non-private) rotation, which means new users can use this integration version.
|
|
286
286
|
|
|
287
287
|
* This **does** mark the version as the official public version - all other versions & users are grandfathered.
|
|
288
|
-
* This does **NOT** build/upload or deploy a version to Zapier - you should \`zapier push\` first.
|
|
289
|
-
* This does **NOT** move old users over to this version - \`zapier migrate 1.0.0 1.0.1\` does that.
|
|
290
|
-
* This does **NOT** recommend old users stop using this version - \`zapier deprecate 1.0.0 2017-01-01\` does that.
|
|
288
|
+
* This does **NOT** build/upload or deploy a version to Zapier - you should \`zapier-platform push\` first.
|
|
289
|
+
* This does **NOT** move old users over to this version - \`zapier-platform migrate 1.0.0 1.0.1\` does that.
|
|
290
|
+
* This does **NOT** recommend old users stop using this version - \`zapier-platform deprecate 1.0.0 2017-01-01\` does that.
|
|
291
291
|
|
|
292
292
|
Promotes are an inherently safe operation for all existing users of your integration.
|
|
293
293
|
|
|
@@ -295,6 +295,6 @@ After a promotion, go to your developer platform to [close issues that were reso
|
|
|
295
295
|
|
|
296
296
|
If your integration is private and passes our integration checks, this will give you a URL to a form where you can fill in additional information for your integration to go public. After reviewing, the Zapier team will approve to make it public if there are no issues or decline with feedback.
|
|
297
297
|
|
|
298
|
-
Check \`zapier jobs\` to track the status of the promotion. Or use \`zapier history\` if you want to see older jobs.`;
|
|
298
|
+
Check \`zapier-platform jobs\` to track the status of the promotion. Or use \`zapier-platform history\` if you want to see older jobs.`;
|
|
299
299
|
|
|
300
300
|
module.exports = PromoteCommand;
|
|
@@ -58,7 +58,7 @@ PullCommand.description = `Retrieve and update your local integration files with
|
|
|
58
58
|
|
|
59
59
|
This command updates your local integration files with the promoted version (or latest version if not public). You will be prompted with a confirmation dialog before continuing if there any destructive file changes.
|
|
60
60
|
|
|
61
|
-
Zapier may release new versions of your integration with bug fixes or new features. In the event this occurs, you will be unable to do the following until your local files are updated by running \`zapier pull\`:
|
|
61
|
+
Zapier may release new versions of your integration with bug fixes or new features. In the event this occurs, you will be unable to do the following until your local files are updated by running \`zapier-platform pull\`:
|
|
62
62
|
|
|
63
63
|
* push to the promoted version
|
|
64
64
|
* promote a new version
|
|
@@ -56,9 +56,12 @@ PushCommand.flags = {
|
|
|
56
56
|
'Pass in a label to create a snapshot version of this integration for development and testing purposes. The version will be created as: 0.0.0-MY-LABEL',
|
|
57
57
|
}),
|
|
58
58
|
};
|
|
59
|
-
PushCommand.examples = [
|
|
59
|
+
PushCommand.examples = [
|
|
60
|
+
'zapier-platform push',
|
|
61
|
+
'zapier-platform push --snapshot MY-LABEL',
|
|
62
|
+
];
|
|
60
63
|
PushCommand.description = `Build and upload the current integration.
|
|
61
64
|
|
|
62
|
-
This command is the same as running \`zapier build\` and \`zapier upload\` in sequence. See those for more info.`;
|
|
65
|
+
This command is the same as running \`zapier-platform build\` and \`zapier-platform upload\` in sequence. See those for more info.`;
|
|
63
66
|
|
|
64
67
|
module.exports = PushCommand;
|
|
@@ -18,7 +18,7 @@ const {
|
|
|
18
18
|
|
|
19
19
|
class RegisterCommand extends ZapierBaseCommand {
|
|
20
20
|
/**
|
|
21
|
-
* Entry point function that runs when user runs `zapier register`
|
|
21
|
+
* Entry point function that runs when user runs `zapier-platform register`
|
|
22
22
|
*/
|
|
23
23
|
async perform() {
|
|
24
24
|
// Flag validation
|
|
@@ -73,7 +73,7 @@ class RegisterCommand extends ZapierBaseCommand {
|
|
|
73
73
|
await writeLinkedAppConfig(app, process.cwd());
|
|
74
74
|
this.stopSpinner();
|
|
75
75
|
this.log(
|
|
76
|
-
'\nFinished! Now that your integration is registered with Zapier, you can `zapier push`!',
|
|
76
|
+
'\nFinished! Now that your integration is registered with Zapier, you can `zapier-platform push`!',
|
|
77
77
|
);
|
|
78
78
|
break;
|
|
79
79
|
}
|
|
@@ -297,16 +297,16 @@ RegisterCommand.flags = buildFlags({
|
|
|
297
297
|
},
|
|
298
298
|
});
|
|
299
299
|
RegisterCommand.examples = [
|
|
300
|
-
'zapier register',
|
|
301
|
-
'zapier register "My Cool Integration"',
|
|
302
|
-
'zapier register "My Cool Integration" --desc "My Cool Integration helps you integrate your apps with the apps that you need." --no-subscribe',
|
|
303
|
-
'zapier register "My Cool Integration" --url "https://www.zapier.com" --audience private --role employee --category marketing-automation',
|
|
304
|
-
'zapier register --subscribe',
|
|
300
|
+
'zapier-platform register',
|
|
301
|
+
'zapier-platform register "My Cool Integration"',
|
|
302
|
+
'zapier-platform register "My Cool Integration" --desc "My Cool Integration helps you integrate your apps with the apps that you need." --no-subscribe',
|
|
303
|
+
'zapier-platform register "My Cool Integration" --url "https://www.zapier.com" --audience private --role employee --category marketing-automation',
|
|
304
|
+
'zapier-platform register --subscribe',
|
|
305
305
|
];
|
|
306
306
|
RegisterCommand.description = `Register a new integration in your account, or update the existing one if a \`${CURRENT_APP_FILE}\` file is found.
|
|
307
307
|
|
|
308
308
|
This command creates a new integration and links it in the \`./${CURRENT_APP_FILE}\` file. If \`${CURRENT_APP_FILE}\` already exists, it will ask you if you want to update the currently-linked integration, as opposed to creating a new one.
|
|
309
309
|
|
|
310
|
-
After registering a new integration, you can run \`zapier push\` to build and upload your integration for use in the Zapier editor. This will change \`${CURRENT_APP_FILE}\`, which identifies this directory as holding code for a specific integration.`;
|
|
310
|
+
After registering a new integration, you can run \`zapier-platform push\` to build and upload your integration for use in the Zapier editor. This will change \`${CURRENT_APP_FILE}\`, which identifies this directory as holding code for a specific integration.`;
|
|
311
311
|
|
|
312
312
|
module.exports = RegisterCommand;
|
|
@@ -203,10 +203,10 @@ ScaffoldCommand.flags = buildFlags({
|
|
|
203
203
|
});
|
|
204
204
|
|
|
205
205
|
ScaffoldCommand.examples = [
|
|
206
|
-
'zapier scaffold trigger contact',
|
|
207
|
-
'zapier scaffold search contact --dest=my_src/searches',
|
|
208
|
-
'zapier scaffold create contact --entry=src/index.js',
|
|
209
|
-
'zapier scaffold resource contact --force',
|
|
206
|
+
'zapier-platform scaffold trigger contact',
|
|
207
|
+
'zapier-platform scaffold search contact --dest=my_src/searches',
|
|
208
|
+
'zapier-platform scaffold create contact --entry=src/index.js',
|
|
209
|
+
'zapier-platform scaffold resource contact --force',
|
|
210
210
|
];
|
|
211
211
|
|
|
212
212
|
ScaffoldCommand.description = `Add a starting trigger, create, search, or resource to your integration.
|
|
@@ -83,9 +83,9 @@ These users come in three levels:
|
|
|
83
83
|
Team members can be freely added and removed.`;
|
|
84
84
|
|
|
85
85
|
TeamAddCommand.examples = [
|
|
86
|
-
'zapier team:add bruce@wayne.com admin',
|
|
87
|
-
'zapier team:add robin@wayne.com collaborator "Hey Robin, check out this app."',
|
|
88
|
-
'zapier team:add alfred@wayne.com subscriber "Hey Alfred, check out this app."',
|
|
86
|
+
'zapier-platform team:add bruce@wayne.com admin',
|
|
87
|
+
'zapier-platform team:add robin@wayne.com collaborator "Hey Robin, check out this app."',
|
|
88
|
+
'zapier-platform team:add alfred@wayne.com subscriber "Hey Alfred, check out this app."',
|
|
89
89
|
];
|
|
90
90
|
TeamAddCommand.aliases = ['team:invite'];
|
|
91
91
|
TeamAddCommand.skipValidInstallCheck = true;
|
|
@@ -34,7 +34,7 @@ class TeamListCommand extends ZapierBaseCommand {
|
|
|
34
34
|
|
|
35
35
|
this.log(
|
|
36
36
|
`To invite more team members, use the \`${cyan(
|
|
37
|
-
'zapier team:add',
|
|
37
|
+
'zapier-platform team:add',
|
|
38
38
|
)}\` command.`,
|
|
39
39
|
);
|
|
40
40
|
}
|
|
@@ -49,7 +49,7 @@ These users come in three levels:
|
|
|
49
49
|
* \`collaborator\`, who has read-only access for the app, and will receive periodic email updates. These updates include quarterly health scores and more.
|
|
50
50
|
* \`subscriber\`, who can't directly access the app, but will receive periodic email updates. These updates include quarterly health scores and more.
|
|
51
51
|
|
|
52
|
-
Use the \`zapier team:add\` and \`zapier team:remove\` commands to modify your team.
|
|
52
|
+
Use the \`zapier-platform team:add\` and \`zapier-platform team:remove\` commands to modify your team.
|
|
53
53
|
`;
|
|
54
54
|
TeamListCommand.aliases = ['team:list'];
|
|
55
55
|
TeamListCommand.skipValidInstallCheck = true;
|
|
@@ -73,7 +73,7 @@ TestCommand.flags = buildFlags({
|
|
|
73
73
|
commandFlags: {
|
|
74
74
|
'skip-validate': Flags.boolean({
|
|
75
75
|
description:
|
|
76
|
-
"Forgo running `zapier validate` before tests are run. This will speed up tests if you're modifying functionality of an existing integration rather than adding new actions.",
|
|
76
|
+
"Forgo running `zapier-platform validate` before tests are run. This will speed up tests if you're modifying functionality of an existing integration rather than adding new actions.",
|
|
77
77
|
}),
|
|
78
78
|
yarn: Flags.boolean({
|
|
79
79
|
description:
|
|
@@ -89,9 +89,9 @@ TestCommand.flags = buildFlags({
|
|
|
89
89
|
TestCommand.skipValidInstallCheck = false;
|
|
90
90
|
TestCommand.strict = false;
|
|
91
91
|
TestCommand.examples = [
|
|
92
|
-
'zapier test',
|
|
93
|
-
'zapier test --skip-validate -- -t 30000 --grep api',
|
|
94
|
-
'zapier test -- -fo --testNamePattern "auth pass"',
|
|
92
|
+
'zapier-platform test',
|
|
93
|
+
'zapier-platform test --skip-validate -- -t 30000 --grep api',
|
|
94
|
+
'zapier-platform test -- -fo --testNamePattern "auth pass"',
|
|
95
95
|
];
|
|
96
96
|
TestCommand.description = `Test your integration via the "test" script in your "package.json".
|
|
97
97
|
|
|
@@ -21,7 +21,7 @@ UploadCommand.description = `Upload the latest build of your integration to Zapi
|
|
|
21
21
|
|
|
22
22
|
This command sends both ${BUILD_PATH} and ${SOURCE_PATH} to Zapier for use.
|
|
23
23
|
|
|
24
|
-
Typically we recommend using \`zapier push\`, which does a build and upload, rather than \`upload\` by itself.
|
|
24
|
+
Typically we recommend using \`zapier-platform push\`, which does a build and upload, rather than \`upload\` by itself.
|
|
25
25
|
`;
|
|
26
26
|
|
|
27
27
|
module.exports = UploadCommand;
|