zapier-platform-cli 16.4.0 → 16.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.
@@ -649,6 +649,58 @@
649
649
  "jobs.js"
650
650
  ]
651
651
  },
652
+ "legacy": {
653
+ "aliases": [],
654
+ "args": {
655
+ "version": {
656
+ "description": "The version to mark as legacy.",
657
+ "name": "version",
658
+ "required": true
659
+ }
660
+ },
661
+ "description": "Mark a non-production version of your integration as legacy.\n\nUse this when an integration version is no longer recommended for new users, but you don't want to block existing users from using it.\n\nReasons why you might want to mark a version as legacy:\n- this version may be discontinued in the future\n- this version has bugs\n- a newer version has been released and you want to encourage users to upgrade\n\n",
662
+ "examples": [
663
+ "zapier legacy 1.2.3"
664
+ ],
665
+ "flags": {
666
+ "force": {
667
+ "char": "f",
668
+ "description": "Skip confirmation prompt. Use with caution.",
669
+ "name": "force",
670
+ "allowNo": false,
671
+ "type": "boolean"
672
+ },
673
+ "debug": {
674
+ "char": "d",
675
+ "description": "Show extra debugging output.",
676
+ "name": "debug",
677
+ "allowNo": false,
678
+ "type": "boolean"
679
+ },
680
+ "invokedFromAnotherCommand": {
681
+ "hidden": true,
682
+ "name": "invokedFromAnotherCommand",
683
+ "allowNo": false,
684
+ "type": "boolean"
685
+ }
686
+ },
687
+ "hasDynamicHelp": false,
688
+ "hiddenAliases": [],
689
+ "id": "legacy",
690
+ "pluginAlias": "zapier-platform-cli",
691
+ "pluginName": "zapier-platform-cli",
692
+ "pluginType": "core",
693
+ "strict": true,
694
+ "enableJsonFlag": false,
695
+ "skipValidInstallCheck": true,
696
+ "isESM": false,
697
+ "relativePath": [
698
+ "src",
699
+ "oclif",
700
+ "commands",
701
+ "legacy.js"
702
+ ]
703
+ },
652
704
  "link": {
653
705
  "aliases": [],
654
706
  "args": {},
@@ -1461,8 +1513,15 @@
1461
1513
  "versions": {
1462
1514
  "aliases": [],
1463
1515
  "args": {},
1464
- "description": "List the versions of your integration available for use in the Zapier editor.",
1516
+ "description": "List the versions of your integration available for use in Zapier automations.",
1465
1517
  "flags": {
1518
+ "all": {
1519
+ "char": "a",
1520
+ "description": "List all versions, including deprecated versions.",
1521
+ "name": "all",
1522
+ "allowNo": false,
1523
+ "type": "boolean"
1524
+ },
1466
1525
  "debug": {
1467
1526
  "char": "d",
1468
1527
  "description": "Show extra debugging output.",
@@ -1721,6 +1780,88 @@
1721
1780
  "list.js"
1722
1781
  ]
1723
1782
  },
1783
+ "delete:integration": {
1784
+ "aliases": [
1785
+ "delete:app"
1786
+ ],
1787
+ "args": {},
1788
+ "description": "Delete your integration (including all versions).\n\nThis only works if there are no active users or Zaps on any version. If you only want to delete certain versions, use the `zapier delete:version` command instead. It's unlikely that you'll be able to run this on an app that you've pushed publicly, since there are usually still users.",
1789
+ "flags": {
1790
+ "debug": {
1791
+ "char": "d",
1792
+ "description": "Show extra debugging output.",
1793
+ "name": "debug",
1794
+ "allowNo": false,
1795
+ "type": "boolean"
1796
+ },
1797
+ "invokedFromAnotherCommand": {
1798
+ "hidden": true,
1799
+ "name": "invokedFromAnotherCommand",
1800
+ "allowNo": false,
1801
+ "type": "boolean"
1802
+ }
1803
+ },
1804
+ "hasDynamicHelp": false,
1805
+ "hiddenAliases": [],
1806
+ "id": "delete:integration",
1807
+ "pluginAlias": "zapier-platform-cli",
1808
+ "pluginName": "zapier-platform-cli",
1809
+ "pluginType": "core",
1810
+ "strict": true,
1811
+ "enableJsonFlag": false,
1812
+ "skipValidInstallCheck": true,
1813
+ "isESM": false,
1814
+ "relativePath": [
1815
+ "src",
1816
+ "oclif",
1817
+ "commands",
1818
+ "delete",
1819
+ "integration.js"
1820
+ ]
1821
+ },
1822
+ "delete:version": {
1823
+ "aliases": [],
1824
+ "args": {
1825
+ "version": {
1826
+ "description": "Specify the version to delete. It must have no users or Zaps.",
1827
+ "name": "version",
1828
+ "required": true
1829
+ }
1830
+ },
1831
+ "description": "Delete a specific version of your integration.\n\nThis only works if there are no users or Zaps on that version. You will probably need to have run `zapier migrate` and `zapier deprecate` before this command will work.",
1832
+ "flags": {
1833
+ "debug": {
1834
+ "char": "d",
1835
+ "description": "Show extra debugging output.",
1836
+ "name": "debug",
1837
+ "allowNo": false,
1838
+ "type": "boolean"
1839
+ },
1840
+ "invokedFromAnotherCommand": {
1841
+ "hidden": true,
1842
+ "name": "invokedFromAnotherCommand",
1843
+ "allowNo": false,
1844
+ "type": "boolean"
1845
+ }
1846
+ },
1847
+ "hasDynamicHelp": false,
1848
+ "hiddenAliases": [],
1849
+ "id": "delete:version",
1850
+ "pluginAlias": "zapier-platform-cli",
1851
+ "pluginName": "zapier-platform-cli",
1852
+ "pluginType": "core",
1853
+ "strict": true,
1854
+ "enableJsonFlag": false,
1855
+ "skipValidInstallCheck": true,
1856
+ "isESM": false,
1857
+ "relativePath": [
1858
+ "src",
1859
+ "oclif",
1860
+ "commands",
1861
+ "delete",
1862
+ "version.js"
1863
+ ]
1864
+ },
1724
1865
  "env:get": {
1725
1866
  "aliases": [],
1726
1867
  "args": {
@@ -1897,88 +2038,6 @@
1897
2038
  "unset.js"
1898
2039
  ]
1899
2040
  },
1900
- "delete:integration": {
1901
- "aliases": [
1902
- "delete:app"
1903
- ],
1904
- "args": {},
1905
- "description": "Delete your integration (including all versions).\n\nThis only works if there are no active users or Zaps on any version. If you only want to delete certain versions, use the `zapier delete:version` command instead. It's unlikely that you'll be able to run this on an app that you've pushed publicly, since there are usually still users.",
1906
- "flags": {
1907
- "debug": {
1908
- "char": "d",
1909
- "description": "Show extra debugging output.",
1910
- "name": "debug",
1911
- "allowNo": false,
1912
- "type": "boolean"
1913
- },
1914
- "invokedFromAnotherCommand": {
1915
- "hidden": true,
1916
- "name": "invokedFromAnotherCommand",
1917
- "allowNo": false,
1918
- "type": "boolean"
1919
- }
1920
- },
1921
- "hasDynamicHelp": false,
1922
- "hiddenAliases": [],
1923
- "id": "delete:integration",
1924
- "pluginAlias": "zapier-platform-cli",
1925
- "pluginName": "zapier-platform-cli",
1926
- "pluginType": "core",
1927
- "strict": true,
1928
- "enableJsonFlag": false,
1929
- "skipValidInstallCheck": true,
1930
- "isESM": false,
1931
- "relativePath": [
1932
- "src",
1933
- "oclif",
1934
- "commands",
1935
- "delete",
1936
- "integration.js"
1937
- ]
1938
- },
1939
- "delete:version": {
1940
- "aliases": [],
1941
- "args": {
1942
- "version": {
1943
- "description": "Specify the version to delete. It must have no users or Zaps.",
1944
- "name": "version",
1945
- "required": true
1946
- }
1947
- },
1948
- "description": "Delete a specific version of your integration.\n\nThis only works if there are no users or Zaps on that version. You will probably need to have run `zapier migrate` and `zapier deprecate` before this command will work.",
1949
- "flags": {
1950
- "debug": {
1951
- "char": "d",
1952
- "description": "Show extra debugging output.",
1953
- "name": "debug",
1954
- "allowNo": false,
1955
- "type": "boolean"
1956
- },
1957
- "invokedFromAnotherCommand": {
1958
- "hidden": true,
1959
- "name": "invokedFromAnotherCommand",
1960
- "allowNo": false,
1961
- "type": "boolean"
1962
- }
1963
- },
1964
- "hasDynamicHelp": false,
1965
- "hiddenAliases": [],
1966
- "id": "delete:version",
1967
- "pluginAlias": "zapier-platform-cli",
1968
- "pluginName": "zapier-platform-cli",
1969
- "pluginType": "core",
1970
- "strict": true,
1971
- "enableJsonFlag": false,
1972
- "skipValidInstallCheck": true,
1973
- "isESM": false,
1974
- "relativePath": [
1975
- "src",
1976
- "oclif",
1977
- "commands",
1978
- "delete",
1979
- "version.js"
1980
- ]
1981
- },
1982
2041
  "team:add": {
1983
2042
  "aliases": [
1984
2043
  "team:invite"
@@ -2358,5 +2417,5 @@
2358
2417
  ]
2359
2418
  }
2360
2419
  },
2361
- "version": "16.4.0"
2420
+ "version": "16.5.1"
2362
2421
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zapier-platform-cli",
3
- "version": "16.4.0",
3
+ "version": "16.5.1",
4
4
  "description": "The CLI for managing integrations in Zapier Developer Platform.",
5
5
  "repository": "zapier/zapier-platform",
6
6
  "homepage": "https://platform.zapier.com/",
@@ -0,0 +1,61 @@
1
+ const BaseCommand = require('../ZapierBaseCommand');
2
+ const { Args, Flags } = require('@oclif/core');
3
+ const { buildFlags } = require('../buildFlags');
4
+
5
+ const { callAPI } = require('../../utils/api');
6
+
7
+ class LegacyCommand extends BaseCommand {
8
+ async perform() {
9
+ const app = await this.getWritableApp();
10
+ const { version } = this.args;
11
+
12
+ if (
13
+ !this.flags.force &&
14
+ !(await this.confirm(
15
+ 'Are you sure you want to mark this version as legacy? Existing Zaps and automations will continue to work, but users may not be able to create new Zaps or automations with this version.',
16
+ ))
17
+ ) {
18
+ this.log('\nCancelled, version is not marked as legacy.');
19
+ return;
20
+ }
21
+
22
+ this.log(
23
+ `\nPreparing to mark version ${version} your app "${app.title}" as legacy.\n`,
24
+ );
25
+ const url = `/apps/${app.id}/versions/${version}/legacy`;
26
+ this.startSpinner(`Making ${version} legacy`);
27
+ await callAPI(url, {
28
+ method: 'PUT',
29
+ });
30
+ this.stopSpinner();
31
+ }
32
+ }
33
+
34
+ LegacyCommand.flags = buildFlags({
35
+ commandFlags: {
36
+ force: Flags.boolean({
37
+ char: 'f',
38
+ description: 'Skip confirmation prompt. Use with caution.',
39
+ }),
40
+ },
41
+ });
42
+ LegacyCommand.args = {
43
+ version: Args.string({
44
+ description: 'The version to mark as legacy.',
45
+ required: true,
46
+ }),
47
+ };
48
+ LegacyCommand.examples = ['zapier legacy 1.2.3'];
49
+ LegacyCommand.description = `Mark a non-production version of your integration as legacy.
50
+
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.
52
+
53
+ Reasons why you might want to mark a version as legacy:
54
+ - this version may be discontinued in the future
55
+ - this version has bugs
56
+ - a newer version has been released and you want to encourage users to upgrade
57
+
58
+ `;
59
+ LegacyCommand.skipValidInstallCheck = true;
60
+
61
+ module.exports = LegacyCommand;
@@ -258,11 +258,6 @@ ${metadataPromptHelper}`);
258
258
 
259
259
  this.stopSpinner();
260
260
  this.log(' Promotion successful!');
261
- if (!this.flags.invokedFromAnotherCommand) {
262
- this.log(
263
- 'Optionally, run the `zapier migrate` command to move users to this version.',
264
- );
265
- }
266
261
  }
267
262
  }
268
263
 
@@ -1,5 +1,5 @@
1
1
  const colors = require('colors/safe');
2
-
2
+ const { Flags } = require('@oclif/core');
3
3
  const BaseCommand = require('../ZapierBaseCommand');
4
4
  const { buildFlags } = require('../buildFlags');
5
5
 
@@ -10,14 +10,23 @@ class VersionCommand extends BaseCommand {
10
10
  this.startSpinner('Loading versions');
11
11
  const { versions } = await listVersions();
12
12
  this.stopSpinner();
13
+ const rows = versions.map((v) => ({
14
+ ...v,
15
+ state: v.lifecycle.status,
16
+ }));
17
+
18
+ const visibleVersions = this.flags.all
19
+ ? rows
20
+ : rows.filter((v) => v.state !== 'deprecated');
13
21
 
14
22
  this.logTable({
15
- rows: versions,
23
+ rows: visibleVersions,
16
24
  headers: [
17
25
  ['Version', 'version'],
18
26
  ['Platform', 'platform_version'],
19
- ['Users', 'user_count'],
20
- ['Deployment', 'deployment'],
27
+ ['Zap Users', 'user_count'],
28
+ ['State', 'state'],
29
+ ['Legacy Date', 'legacy_date'],
21
30
  ['Deprecation Date', 'deprecation_date'],
22
31
  ['Timestamp', 'date'],
23
32
  ],
@@ -57,7 +66,15 @@ class VersionCommand extends BaseCommand {
57
66
  }
58
67
 
59
68
  VersionCommand.skipValidInstallCheck = true;
60
- VersionCommand.flags = buildFlags({ opts: { format: true } });
61
- VersionCommand.description = `List the versions of your integration available for use in the Zapier editor.`;
69
+ VersionCommand.flags = buildFlags({
70
+ commandFlags: {
71
+ all: Flags.boolean({
72
+ char: 'a',
73
+ description: `List all versions, including deprecated versions.`,
74
+ }),
75
+ },
76
+ opts: { format: true },
77
+ });
78
+ VersionCommand.description = `List the versions of your integration available for use in Zapier automations.`;
62
79
 
63
80
  module.exports = VersionCommand;
@@ -26,6 +26,7 @@ module.exports = {
26
26
  integrations: require('./commands/integrations'),
27
27
  invoke: require('./commands/invoke'),
28
28
  link: require('./commands/link'),
29
+ legacy: require('./commands/legacy'),
29
30
  login: require('./commands/login'),
30
31
  logs: require('./commands/logs'),
31
32
  logout: require('./commands/logout'),