zapier-platform-cli 17.4.0 → 17.6.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 +208 -183
- package/package.json +1 -1
- package/src/generators/index.js +5 -5
- package/src/generators/templates/index.template.js +2 -5
- package/src/generators/templates/index.template.ts +2 -2
- package/src/oclif/commands/canary/create.js +53 -6
- package/src/oclif/commands/canary/list.js +4 -0
- package/src/oclif/commands/invoke.js +4 -0
- package/src/utils/api.js +2 -5
- package/src/utils/auth-files-codegen.js +213 -84
- package/src/utils/build.js +3 -0
- package/src/utils/codegen.js +2 -2
package/oclif.manifest.json
CHANGED
|
@@ -1705,6 +1705,88 @@
|
|
|
1705
1705
|
"clear.js"
|
|
1706
1706
|
]
|
|
1707
1707
|
},
|
|
1708
|
+
"delete:integration": {
|
|
1709
|
+
"aliases": [
|
|
1710
|
+
"delete:app"
|
|
1711
|
+
],
|
|
1712
|
+
"args": {},
|
|
1713
|
+
"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.",
|
|
1714
|
+
"flags": {
|
|
1715
|
+
"debug": {
|
|
1716
|
+
"char": "d",
|
|
1717
|
+
"description": "Show extra debugging output.",
|
|
1718
|
+
"name": "debug",
|
|
1719
|
+
"allowNo": false,
|
|
1720
|
+
"type": "boolean"
|
|
1721
|
+
},
|
|
1722
|
+
"invokedFromAnotherCommand": {
|
|
1723
|
+
"hidden": true,
|
|
1724
|
+
"name": "invokedFromAnotherCommand",
|
|
1725
|
+
"allowNo": false,
|
|
1726
|
+
"type": "boolean"
|
|
1727
|
+
}
|
|
1728
|
+
},
|
|
1729
|
+
"hasDynamicHelp": false,
|
|
1730
|
+
"hiddenAliases": [],
|
|
1731
|
+
"id": "delete:integration",
|
|
1732
|
+
"pluginAlias": "zapier-platform-cli",
|
|
1733
|
+
"pluginName": "zapier-platform-cli",
|
|
1734
|
+
"pluginType": "core",
|
|
1735
|
+
"strict": true,
|
|
1736
|
+
"enableJsonFlag": false,
|
|
1737
|
+
"skipValidInstallCheck": true,
|
|
1738
|
+
"isESM": false,
|
|
1739
|
+
"relativePath": [
|
|
1740
|
+
"src",
|
|
1741
|
+
"oclif",
|
|
1742
|
+
"commands",
|
|
1743
|
+
"delete",
|
|
1744
|
+
"integration.js"
|
|
1745
|
+
]
|
|
1746
|
+
},
|
|
1747
|
+
"delete:version": {
|
|
1748
|
+
"aliases": [],
|
|
1749
|
+
"args": {
|
|
1750
|
+
"version": {
|
|
1751
|
+
"description": "Specify the version to delete. It must have no users or Zaps.",
|
|
1752
|
+
"name": "version",
|
|
1753
|
+
"required": true
|
|
1754
|
+
}
|
|
1755
|
+
},
|
|
1756
|
+
"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.",
|
|
1757
|
+
"flags": {
|
|
1758
|
+
"debug": {
|
|
1759
|
+
"char": "d",
|
|
1760
|
+
"description": "Show extra debugging output.",
|
|
1761
|
+
"name": "debug",
|
|
1762
|
+
"allowNo": false,
|
|
1763
|
+
"type": "boolean"
|
|
1764
|
+
},
|
|
1765
|
+
"invokedFromAnotherCommand": {
|
|
1766
|
+
"hidden": true,
|
|
1767
|
+
"name": "invokedFromAnotherCommand",
|
|
1768
|
+
"allowNo": false,
|
|
1769
|
+
"type": "boolean"
|
|
1770
|
+
}
|
|
1771
|
+
},
|
|
1772
|
+
"hasDynamicHelp": false,
|
|
1773
|
+
"hiddenAliases": [],
|
|
1774
|
+
"id": "delete:version",
|
|
1775
|
+
"pluginAlias": "zapier-platform-cli",
|
|
1776
|
+
"pluginName": "zapier-platform-cli",
|
|
1777
|
+
"pluginType": "core",
|
|
1778
|
+
"strict": true,
|
|
1779
|
+
"enableJsonFlag": false,
|
|
1780
|
+
"skipValidInstallCheck": true,
|
|
1781
|
+
"isESM": false,
|
|
1782
|
+
"relativePath": [
|
|
1783
|
+
"src",
|
|
1784
|
+
"oclif",
|
|
1785
|
+
"commands",
|
|
1786
|
+
"delete",
|
|
1787
|
+
"version.js"
|
|
1788
|
+
]
|
|
1789
|
+
},
|
|
1708
1790
|
"canary:create": {
|
|
1709
1791
|
"aliases": [],
|
|
1710
1792
|
"args": {
|
|
@@ -1719,10 +1801,12 @@
|
|
|
1719
1801
|
"required": true
|
|
1720
1802
|
}
|
|
1721
1803
|
},
|
|
1722
|
-
"description": "Create a new canary deployment, diverting a specified percentage of traffic from one version to another for a specified duration.\n\nOnly one canary can be active at the same time. You can run `zapier canary:list` to check. If you would like to create a new canary with different parameters, you can wait for the canary to finish, or delete it using `zapier canary:delete a.b.c x.y.z`.\n\nNote: this is similar to `zapier migrate` but different in that this is temporary and will \"revert\" the changes once the specified duration is expired.\n\n**Only use this command to canary traffic between non-breaking versions!**",
|
|
1804
|
+
"description": "Create a new canary deployment, diverting a specified percentage of traffic from one version to another for a specified duration.\n\nOnly one canary can be active at the same time. You can run `zapier canary:list` to check. If you would like to create a new canary with different parameters, you can wait for the canary to finish, or delete it using `zapier canary:delete a.b.c x.y.z`.\n\nTo canary traffic for a specific user, use the --user flag.\n\nTo canary traffic for an entire account, use the --account-id. Note: this scenario is only permitted for Zapier staff.\n\nTo canary traffic for a specific user within a specific account, use both --user and --account-id flags.\n\nNote: this is similar to `zapier migrate` but different in that this is temporary and will \"revert\" the changes once the specified duration is expired.\n\n**Only use this command to canary traffic between non-breaking versions!**",
|
|
1723
1805
|
"examples": [
|
|
1724
|
-
"zapier canary:create 1.0.0 1.1.0 -p
|
|
1725
|
-
"zapier canary:create 2.0.0 2.1.0 --percent
|
|
1806
|
+
"zapier canary:create 1.0.0 1.1.0 -p 10 -d 3600",
|
|
1807
|
+
"zapier canary:create 2.0.0 2.1.0 --percent 25 --duration 1800 --user user@example.com",
|
|
1808
|
+
"zapier canary:create 2.0.0 2.1.0 -p 15 -d 7200 -a 12345 -u user@example.com",
|
|
1809
|
+
"zapier canary:create 2.0.0 2.1.0 -p 15 -d 7200 -a 12345"
|
|
1726
1810
|
],
|
|
1727
1811
|
"flags": {
|
|
1728
1812
|
"percent": {
|
|
@@ -1743,6 +1827,29 @@
|
|
|
1743
1827
|
"multiple": false,
|
|
1744
1828
|
"type": "option"
|
|
1745
1829
|
},
|
|
1830
|
+
"user": {
|
|
1831
|
+
"char": "u",
|
|
1832
|
+
"description": "Canary this user (email) across all accounts, unless `account-id` is specified.",
|
|
1833
|
+
"name": "user",
|
|
1834
|
+
"hasDynamicHelp": false,
|
|
1835
|
+
"multiple": false,
|
|
1836
|
+
"type": "option"
|
|
1837
|
+
},
|
|
1838
|
+
"account-id": {
|
|
1839
|
+
"char": "a",
|
|
1840
|
+
"description": "The account ID to target. If user is specified, only canary the user within this account. If user is not specified, then this argument is only permitted for Zapier staff.",
|
|
1841
|
+
"name": "account-id",
|
|
1842
|
+
"hasDynamicHelp": false,
|
|
1843
|
+
"multiple": false,
|
|
1844
|
+
"type": "option"
|
|
1845
|
+
},
|
|
1846
|
+
"force-include-all": {
|
|
1847
|
+
"char": "f",
|
|
1848
|
+
"description": "Overrides any default filters the canary system imposes. This argument is only permitted for Zapier staff.",
|
|
1849
|
+
"name": "force-include-all",
|
|
1850
|
+
"allowNo": false,
|
|
1851
|
+
"type": "boolean"
|
|
1852
|
+
},
|
|
1746
1853
|
"debug": {
|
|
1747
1854
|
"char": "d",
|
|
1748
1855
|
"description": "Show extra debugging output.",
|
|
@@ -1868,88 +1975,6 @@
|
|
|
1868
1975
|
"list.js"
|
|
1869
1976
|
]
|
|
1870
1977
|
},
|
|
1871
|
-
"delete:integration": {
|
|
1872
|
-
"aliases": [
|
|
1873
|
-
"delete:app"
|
|
1874
|
-
],
|
|
1875
|
-
"args": {},
|
|
1876
|
-
"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.",
|
|
1877
|
-
"flags": {
|
|
1878
|
-
"debug": {
|
|
1879
|
-
"char": "d",
|
|
1880
|
-
"description": "Show extra debugging output.",
|
|
1881
|
-
"name": "debug",
|
|
1882
|
-
"allowNo": false,
|
|
1883
|
-
"type": "boolean"
|
|
1884
|
-
},
|
|
1885
|
-
"invokedFromAnotherCommand": {
|
|
1886
|
-
"hidden": true,
|
|
1887
|
-
"name": "invokedFromAnotherCommand",
|
|
1888
|
-
"allowNo": false,
|
|
1889
|
-
"type": "boolean"
|
|
1890
|
-
}
|
|
1891
|
-
},
|
|
1892
|
-
"hasDynamicHelp": false,
|
|
1893
|
-
"hiddenAliases": [],
|
|
1894
|
-
"id": "delete:integration",
|
|
1895
|
-
"pluginAlias": "zapier-platform-cli",
|
|
1896
|
-
"pluginName": "zapier-platform-cli",
|
|
1897
|
-
"pluginType": "core",
|
|
1898
|
-
"strict": true,
|
|
1899
|
-
"enableJsonFlag": false,
|
|
1900
|
-
"skipValidInstallCheck": true,
|
|
1901
|
-
"isESM": false,
|
|
1902
|
-
"relativePath": [
|
|
1903
|
-
"src",
|
|
1904
|
-
"oclif",
|
|
1905
|
-
"commands",
|
|
1906
|
-
"delete",
|
|
1907
|
-
"integration.js"
|
|
1908
|
-
]
|
|
1909
|
-
},
|
|
1910
|
-
"delete:version": {
|
|
1911
|
-
"aliases": [],
|
|
1912
|
-
"args": {
|
|
1913
|
-
"version": {
|
|
1914
|
-
"description": "Specify the version to delete. It must have no users or Zaps.",
|
|
1915
|
-
"name": "version",
|
|
1916
|
-
"required": true
|
|
1917
|
-
}
|
|
1918
|
-
},
|
|
1919
|
-
"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.",
|
|
1920
|
-
"flags": {
|
|
1921
|
-
"debug": {
|
|
1922
|
-
"char": "d",
|
|
1923
|
-
"description": "Show extra debugging output.",
|
|
1924
|
-
"name": "debug",
|
|
1925
|
-
"allowNo": false,
|
|
1926
|
-
"type": "boolean"
|
|
1927
|
-
},
|
|
1928
|
-
"invokedFromAnotherCommand": {
|
|
1929
|
-
"hidden": true,
|
|
1930
|
-
"name": "invokedFromAnotherCommand",
|
|
1931
|
-
"allowNo": false,
|
|
1932
|
-
"type": "boolean"
|
|
1933
|
-
}
|
|
1934
|
-
},
|
|
1935
|
-
"hasDynamicHelp": false,
|
|
1936
|
-
"hiddenAliases": [],
|
|
1937
|
-
"id": "delete:version",
|
|
1938
|
-
"pluginAlias": "zapier-platform-cli",
|
|
1939
|
-
"pluginName": "zapier-platform-cli",
|
|
1940
|
-
"pluginType": "core",
|
|
1941
|
-
"strict": true,
|
|
1942
|
-
"enableJsonFlag": false,
|
|
1943
|
-
"skipValidInstallCheck": true,
|
|
1944
|
-
"isESM": false,
|
|
1945
|
-
"relativePath": [
|
|
1946
|
-
"src",
|
|
1947
|
-
"oclif",
|
|
1948
|
-
"commands",
|
|
1949
|
-
"delete",
|
|
1950
|
-
"version.js"
|
|
1951
|
-
]
|
|
1952
|
-
},
|
|
1953
1978
|
"env:get": {
|
|
1954
1979
|
"aliases": [],
|
|
1955
1980
|
"args": {
|
|
@@ -2126,9 +2151,9 @@
|
|
|
2126
2151
|
"unset.js"
|
|
2127
2152
|
]
|
|
2128
2153
|
},
|
|
2129
|
-
"
|
|
2154
|
+
"users:add": {
|
|
2130
2155
|
"aliases": [
|
|
2131
|
-
"
|
|
2156
|
+
"users:invite"
|
|
2132
2157
|
],
|
|
2133
2158
|
"args": {
|
|
2134
2159
|
"email": {
|
|
@@ -2136,28 +2161,24 @@
|
|
|
2136
2161
|
"name": "email",
|
|
2137
2162
|
"required": true
|
|
2138
2163
|
},
|
|
2139
|
-
"
|
|
2140
|
-
"description": "
|
|
2141
|
-
"name": "
|
|
2142
|
-
"options": [
|
|
2143
|
-
"admin",
|
|
2144
|
-
"collaborator",
|
|
2145
|
-
"subscriber"
|
|
2146
|
-
],
|
|
2147
|
-
"required": true
|
|
2148
|
-
},
|
|
2149
|
-
"message": {
|
|
2150
|
-
"description": "A message sent in the email to your team member, if you need to provide context. Wrap the message in quotes to ensure spaces get saved.",
|
|
2151
|
-
"name": "message"
|
|
2164
|
+
"version": {
|
|
2165
|
+
"description": "A version string (like 1.2.3). Optional, used only if you want to invite a user to a specific version instead of all versions.",
|
|
2166
|
+
"name": "version"
|
|
2152
2167
|
}
|
|
2153
2168
|
},
|
|
2154
|
-
"description": "Add a
|
|
2169
|
+
"description": "Add a user to some or all versions of your integration.\n\nWhen this command is run, we'll send an email to the user inviting them to try your integration. You can track the status of that invite using the `zapier users:get` command.\n\nInvited users will be able to see your integration's name, logo, and description. They'll also be able to create Zaps using any available triggers and actions.",
|
|
2155
2170
|
"examples": [
|
|
2156
|
-
"zapier
|
|
2157
|
-
"zapier
|
|
2158
|
-
"zapier team:add alfred@wayne.com subscriber \"Hey Alfred, check out this app.\""
|
|
2171
|
+
"zapier users:add bruce@wayne.com",
|
|
2172
|
+
"zapier users:add alfred@wayne.com 1.2.3"
|
|
2159
2173
|
],
|
|
2160
2174
|
"flags": {
|
|
2175
|
+
"force": {
|
|
2176
|
+
"char": "f",
|
|
2177
|
+
"description": "Skip confirmation. Useful for running programatically.",
|
|
2178
|
+
"name": "force",
|
|
2179
|
+
"allowNo": false,
|
|
2180
|
+
"type": "boolean"
|
|
2181
|
+
},
|
|
2161
2182
|
"debug": {
|
|
2162
2183
|
"char": "d",
|
|
2163
2184
|
"description": "Show extra debugging output.",
|
|
@@ -2174,7 +2195,7 @@
|
|
|
2174
2195
|
},
|
|
2175
2196
|
"hasDynamicHelp": false,
|
|
2176
2197
|
"hiddenAliases": [],
|
|
2177
|
-
"id": "
|
|
2198
|
+
"id": "users:add",
|
|
2178
2199
|
"pluginAlias": "zapier-platform-cli",
|
|
2179
2200
|
"pluginName": "zapier-platform-cli",
|
|
2180
2201
|
"pluginType": "core",
|
|
@@ -2186,16 +2207,16 @@
|
|
|
2186
2207
|
"src",
|
|
2187
2208
|
"oclif",
|
|
2188
2209
|
"commands",
|
|
2189
|
-
"
|
|
2210
|
+
"users",
|
|
2190
2211
|
"add.js"
|
|
2191
2212
|
]
|
|
2192
2213
|
},
|
|
2193
|
-
"
|
|
2214
|
+
"users:get": {
|
|
2194
2215
|
"aliases": [
|
|
2195
|
-
"
|
|
2216
|
+
"users:list"
|
|
2196
2217
|
],
|
|
2197
2218
|
"args": {},
|
|
2198
|
-
"description": "Get
|
|
2219
|
+
"description": "Get a list of users who have been invited to your integration.\n\nNote that this list of users is NOT a comprehensive list of everyone who is using your integration. It only includes users who were invited directly by email (using the `\u001b[36mzapier users:add\u001b[39m` command or the web UI). Users who joined by clicking links generated using the `\u001b[36mzapier user:links\u001b[39m` command won't show up here.",
|
|
2199
2220
|
"flags": {
|
|
2200
2221
|
"debug": {
|
|
2201
2222
|
"char": "d",
|
|
@@ -2229,7 +2250,7 @@
|
|
|
2229
2250
|
},
|
|
2230
2251
|
"hasDynamicHelp": false,
|
|
2231
2252
|
"hiddenAliases": [],
|
|
2232
|
-
"id": "
|
|
2253
|
+
"id": "users:get",
|
|
2233
2254
|
"pluginAlias": "zapier-platform-cli",
|
|
2234
2255
|
"pluginName": "zapier-platform-cli",
|
|
2235
2256
|
"pluginType": "core",
|
|
@@ -2241,16 +2262,14 @@
|
|
|
2241
2262
|
"src",
|
|
2242
2263
|
"oclif",
|
|
2243
2264
|
"commands",
|
|
2244
|
-
"
|
|
2265
|
+
"users",
|
|
2245
2266
|
"get.js"
|
|
2246
2267
|
]
|
|
2247
2268
|
},
|
|
2248
|
-
"
|
|
2249
|
-
"aliases": [
|
|
2250
|
-
"team:delete"
|
|
2251
|
-
],
|
|
2269
|
+
"users:links": {
|
|
2270
|
+
"aliases": [],
|
|
2252
2271
|
"args": {},
|
|
2253
|
-
"description": "
|
|
2272
|
+
"description": "Get a list of links that are used to invite users to your integration.",
|
|
2254
2273
|
"flags": {
|
|
2255
2274
|
"debug": {
|
|
2256
2275
|
"char": "d",
|
|
@@ -2259,6 +2278,22 @@
|
|
|
2259
2278
|
"allowNo": false,
|
|
2260
2279
|
"type": "boolean"
|
|
2261
2280
|
},
|
|
2281
|
+
"format": {
|
|
2282
|
+
"char": "f",
|
|
2283
|
+
"description": "Change the way structured data is presented. If \"json\" or \"raw\", you can pipe the output of the command into other tools, such as jq.",
|
|
2284
|
+
"name": "format",
|
|
2285
|
+
"default": "table",
|
|
2286
|
+
"hasDynamicHelp": false,
|
|
2287
|
+
"multiple": false,
|
|
2288
|
+
"options": [
|
|
2289
|
+
"plain",
|
|
2290
|
+
"json",
|
|
2291
|
+
"raw",
|
|
2292
|
+
"row",
|
|
2293
|
+
"table"
|
|
2294
|
+
],
|
|
2295
|
+
"type": "option"
|
|
2296
|
+
},
|
|
2262
2297
|
"invokedFromAnotherCommand": {
|
|
2263
2298
|
"hidden": true,
|
|
2264
2299
|
"name": "invokedFromAnotherCommand",
|
|
@@ -2268,7 +2303,7 @@
|
|
|
2268
2303
|
},
|
|
2269
2304
|
"hasDynamicHelp": false,
|
|
2270
2305
|
"hiddenAliases": [],
|
|
2271
|
-
"id": "
|
|
2306
|
+
"id": "users:links",
|
|
2272
2307
|
"pluginAlias": "zapier-platform-cli",
|
|
2273
2308
|
"pluginName": "zapier-platform-cli",
|
|
2274
2309
|
"pluginType": "core",
|
|
@@ -2280,34 +2315,26 @@
|
|
|
2280
2315
|
"src",
|
|
2281
2316
|
"oclif",
|
|
2282
2317
|
"commands",
|
|
2283
|
-
"
|
|
2284
|
-
"
|
|
2318
|
+
"users",
|
|
2319
|
+
"links.js"
|
|
2285
2320
|
]
|
|
2286
2321
|
},
|
|
2287
|
-
"users:
|
|
2322
|
+
"users:remove": {
|
|
2288
2323
|
"aliases": [
|
|
2289
|
-
"users:
|
|
2324
|
+
"users:delete"
|
|
2290
2325
|
],
|
|
2291
2326
|
"args": {
|
|
2292
2327
|
"email": {
|
|
2293
|
-
"description": "The user to be
|
|
2328
|
+
"description": "The user to be removed.",
|
|
2294
2329
|
"name": "email",
|
|
2295
2330
|
"required": true
|
|
2296
|
-
},
|
|
2297
|
-
"version": {
|
|
2298
|
-
"description": "A version string (like 1.2.3). Optional, used only if you want to invite a user to a specific version instead of all versions.",
|
|
2299
|
-
"name": "version"
|
|
2300
2331
|
}
|
|
2301
2332
|
},
|
|
2302
|
-
"description": "
|
|
2303
|
-
"examples": [
|
|
2304
|
-
"zapier users:add bruce@wayne.com",
|
|
2305
|
-
"zapier users:add alfred@wayne.com 1.2.3"
|
|
2306
|
-
],
|
|
2333
|
+
"description": "Remove a user from all versions of your integration.\n\nWhen this command is run, their Zaps will immediately turn off. They won't be able to use your app again until they're re-invited or it has gone public. In practice, this command isn't run often as it's very disruptive to users.",
|
|
2307
2334
|
"flags": {
|
|
2308
2335
|
"force": {
|
|
2309
2336
|
"char": "f",
|
|
2310
|
-
"description": "
|
|
2337
|
+
"description": "Skips confirmation. Useful for running programatically.",
|
|
2311
2338
|
"name": "force",
|
|
2312
2339
|
"allowNo": false,
|
|
2313
2340
|
"type": "boolean"
|
|
@@ -2328,7 +2355,7 @@
|
|
|
2328
2355
|
},
|
|
2329
2356
|
"hasDynamicHelp": false,
|
|
2330
2357
|
"hiddenAliases": [],
|
|
2331
|
-
"id": "users:
|
|
2358
|
+
"id": "users:remove",
|
|
2332
2359
|
"pluginAlias": "zapier-platform-cli",
|
|
2333
2360
|
"pluginName": "zapier-platform-cli",
|
|
2334
2361
|
"pluginType": "core",
|
|
@@ -2341,15 +2368,40 @@
|
|
|
2341
2368
|
"oclif",
|
|
2342
2369
|
"commands",
|
|
2343
2370
|
"users",
|
|
2344
|
-
"
|
|
2371
|
+
"remove.js"
|
|
2345
2372
|
]
|
|
2346
2373
|
},
|
|
2347
|
-
"
|
|
2374
|
+
"team:add": {
|
|
2348
2375
|
"aliases": [
|
|
2349
|
-
"
|
|
2376
|
+
"team:invite"
|
|
2377
|
+
],
|
|
2378
|
+
"args": {
|
|
2379
|
+
"email": {
|
|
2380
|
+
"description": "The user to be invited. If they don't have a Zapier account, they'll be prompted to create one.",
|
|
2381
|
+
"name": "email",
|
|
2382
|
+
"required": true
|
|
2383
|
+
},
|
|
2384
|
+
"role": {
|
|
2385
|
+
"description": "The level the invited team member should be at. Admins can edit everything and get email updates. Collaborators have read-access to the app and get email updates. Subscribers only get email updates.",
|
|
2386
|
+
"name": "role",
|
|
2387
|
+
"options": [
|
|
2388
|
+
"admin",
|
|
2389
|
+
"collaborator",
|
|
2390
|
+
"subscriber"
|
|
2391
|
+
],
|
|
2392
|
+
"required": true
|
|
2393
|
+
},
|
|
2394
|
+
"message": {
|
|
2395
|
+
"description": "A message sent in the email to your team member, if you need to provide context. Wrap the message in quotes to ensure spaces get saved.",
|
|
2396
|
+
"name": "message"
|
|
2397
|
+
}
|
|
2398
|
+
},
|
|
2399
|
+
"description": "Add a team member to your integration.\n\nThese users come in three levels:\n\n * `admin`, who can edit everything about the integration\n * `collaborator`, who has read-only access for the app, and will receive periodic email updates. These updates include quarterly health scores and more.\n * `subscriber`, who can't directly access the app, but will receive periodic email updates. These updates include quarterly health scores and more.\n\nTeam members can be freely added and removed.",
|
|
2400
|
+
"examples": [
|
|
2401
|
+
"zapier team:add bruce@wayne.com admin",
|
|
2402
|
+
"zapier team:add robin@wayne.com collaborator \"Hey Robin, check out this app.\"",
|
|
2403
|
+
"zapier team:add alfred@wayne.com subscriber \"Hey Alfred, check out this app.\""
|
|
2350
2404
|
],
|
|
2351
|
-
"args": {},
|
|
2352
|
-
"description": "Get a list of users who have been invited to your integration.\n\nNote that this list of users is NOT a comprehensive list of everyone who is using your integration. It only includes users who were invited directly by email (using the `\u001b[36mzapier users:add\u001b[39m` command or the web UI). Users who joined by clicking links generated using the `\u001b[36mzapier user:links\u001b[39m` command won't show up here.",
|
|
2353
2405
|
"flags": {
|
|
2354
2406
|
"debug": {
|
|
2355
2407
|
"char": "d",
|
|
@@ -2358,22 +2410,6 @@
|
|
|
2358
2410
|
"allowNo": false,
|
|
2359
2411
|
"type": "boolean"
|
|
2360
2412
|
},
|
|
2361
|
-
"format": {
|
|
2362
|
-
"char": "f",
|
|
2363
|
-
"description": "Change the way structured data is presented. If \"json\" or \"raw\", you can pipe the output of the command into other tools, such as jq.",
|
|
2364
|
-
"name": "format",
|
|
2365
|
-
"default": "table",
|
|
2366
|
-
"hasDynamicHelp": false,
|
|
2367
|
-
"multiple": false,
|
|
2368
|
-
"options": [
|
|
2369
|
-
"plain",
|
|
2370
|
-
"json",
|
|
2371
|
-
"raw",
|
|
2372
|
-
"row",
|
|
2373
|
-
"table"
|
|
2374
|
-
],
|
|
2375
|
-
"type": "option"
|
|
2376
|
-
},
|
|
2377
2413
|
"invokedFromAnotherCommand": {
|
|
2378
2414
|
"hidden": true,
|
|
2379
2415
|
"name": "invokedFromAnotherCommand",
|
|
@@ -2383,7 +2419,7 @@
|
|
|
2383
2419
|
},
|
|
2384
2420
|
"hasDynamicHelp": false,
|
|
2385
2421
|
"hiddenAliases": [],
|
|
2386
|
-
"id": "
|
|
2422
|
+
"id": "team:add",
|
|
2387
2423
|
"pluginAlias": "zapier-platform-cli",
|
|
2388
2424
|
"pluginName": "zapier-platform-cli",
|
|
2389
2425
|
"pluginType": "core",
|
|
@@ -2395,14 +2431,16 @@
|
|
|
2395
2431
|
"src",
|
|
2396
2432
|
"oclif",
|
|
2397
2433
|
"commands",
|
|
2398
|
-
"
|
|
2399
|
-
"
|
|
2434
|
+
"team",
|
|
2435
|
+
"add.js"
|
|
2400
2436
|
]
|
|
2401
2437
|
},
|
|
2402
|
-
"
|
|
2403
|
-
"aliases": [
|
|
2438
|
+
"team:get": {
|
|
2439
|
+
"aliases": [
|
|
2440
|
+
"team:list"
|
|
2441
|
+
],
|
|
2404
2442
|
"args": {},
|
|
2405
|
-
"description": "Get
|
|
2443
|
+
"description": "Get team members involved with your integration.\n\nThese users come in three levels:\n\n * `admin`, who can edit everything about the integration\n * `collaborator`, who has read-only access for the app, and will receive periodic email updates. These updates include quarterly health scores and more.\n * `subscriber`, who can't directly access the app, but will receive periodic email updates. These updates include quarterly health scores and more.\n\nUse the `zapier team:add` and `zapier team:remove` commands to modify your team.\n",
|
|
2406
2444
|
"flags": {
|
|
2407
2445
|
"debug": {
|
|
2408
2446
|
"char": "d",
|
|
@@ -2436,7 +2474,7 @@
|
|
|
2436
2474
|
},
|
|
2437
2475
|
"hasDynamicHelp": false,
|
|
2438
2476
|
"hiddenAliases": [],
|
|
2439
|
-
"id": "
|
|
2477
|
+
"id": "team:get",
|
|
2440
2478
|
"pluginAlias": "zapier-platform-cli",
|
|
2441
2479
|
"pluginName": "zapier-platform-cli",
|
|
2442
2480
|
"pluginType": "core",
|
|
@@ -2448,30 +2486,17 @@
|
|
|
2448
2486
|
"src",
|
|
2449
2487
|
"oclif",
|
|
2450
2488
|
"commands",
|
|
2451
|
-
"
|
|
2452
|
-
"
|
|
2489
|
+
"team",
|
|
2490
|
+
"get.js"
|
|
2453
2491
|
]
|
|
2454
2492
|
},
|
|
2455
|
-
"
|
|
2493
|
+
"team:remove": {
|
|
2456
2494
|
"aliases": [
|
|
2457
|
-
"
|
|
2495
|
+
"team:delete"
|
|
2458
2496
|
],
|
|
2459
|
-
"args": {
|
|
2460
|
-
|
|
2461
|
-
"description": "The user to be removed.",
|
|
2462
|
-
"name": "email",
|
|
2463
|
-
"required": true
|
|
2464
|
-
}
|
|
2465
|
-
},
|
|
2466
|
-
"description": "Remove a user from all versions of your integration.\n\nWhen this command is run, their Zaps will immediately turn off. They won't be able to use your app again until they're re-invited or it has gone public. In practice, this command isn't run often as it's very disruptive to users.",
|
|
2497
|
+
"args": {},
|
|
2498
|
+
"description": "Remove a team member from all versions of your integration.\n\nAdmins will immediately lose write access to the integration.\nCollaborators will immediately lose read access to the integration.\nSubscribers won't receive future email updates.",
|
|
2467
2499
|
"flags": {
|
|
2468
|
-
"force": {
|
|
2469
|
-
"char": "f",
|
|
2470
|
-
"description": "Skips confirmation. Useful for running programatically.",
|
|
2471
|
-
"name": "force",
|
|
2472
|
-
"allowNo": false,
|
|
2473
|
-
"type": "boolean"
|
|
2474
|
-
},
|
|
2475
2500
|
"debug": {
|
|
2476
2501
|
"char": "d",
|
|
2477
2502
|
"description": "Show extra debugging output.",
|
|
@@ -2488,7 +2513,7 @@
|
|
|
2488
2513
|
},
|
|
2489
2514
|
"hasDynamicHelp": false,
|
|
2490
2515
|
"hiddenAliases": [],
|
|
2491
|
-
"id": "
|
|
2516
|
+
"id": "team:remove",
|
|
2492
2517
|
"pluginAlias": "zapier-platform-cli",
|
|
2493
2518
|
"pluginName": "zapier-platform-cli",
|
|
2494
2519
|
"pluginType": "core",
|
|
@@ -2500,10 +2525,10 @@
|
|
|
2500
2525
|
"src",
|
|
2501
2526
|
"oclif",
|
|
2502
2527
|
"commands",
|
|
2503
|
-
"
|
|
2528
|
+
"team",
|
|
2504
2529
|
"remove.js"
|
|
2505
2530
|
]
|
|
2506
2531
|
}
|
|
2507
2532
|
},
|
|
2508
|
-
"version": "17.
|
|
2533
|
+
"version": "17.6.0"
|
|
2509
2534
|
}
|
package/package.json
CHANGED
package/src/generators/index.js
CHANGED
|
@@ -130,11 +130,11 @@ const authTypes = {
|
|
|
130
130
|
const writeGenericAuth = (gen) => {
|
|
131
131
|
const authType = authTypes[gen.options.template];
|
|
132
132
|
const content = authFilesCodegen[authType](gen.options.language);
|
|
133
|
-
const destPath =
|
|
134
|
-
gen.options.language === 'typescript'
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
const destPath = (key) =>
|
|
134
|
+
gen.options.language === 'typescript' ? `src/${key}.ts` : `${key}.js`;
|
|
135
|
+
Object.entries(content).forEach(([key, value]) => {
|
|
136
|
+
gen.fs.write(gen.destinationPath(destPath(key)), value);
|
|
137
|
+
});
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
const writeGenericAuthTest = (gen) => {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
<% if (hasAuth) { %>
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
befores = [],
|
|
5
|
-
afters = [],
|
|
6
|
-
} = require('./authentication');
|
|
2
|
+
const authentication = require('./authentication');
|
|
3
|
+
const { befores = [], afters = [] } = require('./middleware');
|
|
7
4
|
<% } %>
|
|
8
5
|
|
|
9
6
|
module.exports = {
|
|
@@ -2,8 +2,8 @@ import zapier, { defineApp } from 'zapier-platform-core';
|
|
|
2
2
|
|
|
3
3
|
import packageJson from '../package.json' with { type: 'json' };
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
5
|
+
import authentication from './authentication.js';
|
|
6
|
+
import { befores, afters } from './middleware.js';
|
|
7
7
|
|
|
8
8
|
export default defineApp({
|
|
9
9
|
version: packageJson.version,
|
|
@@ -8,6 +8,9 @@ class CanaryCreateCommand extends ZapierBaseCommand {
|
|
|
8
8
|
const { versionFrom, versionTo } = this.args;
|
|
9
9
|
const percent = this.flags.percent;
|
|
10
10
|
const duration = this.flags.duration;
|
|
11
|
+
const user = this.flags.user;
|
|
12
|
+
const accountId = this.flags['account-id'];
|
|
13
|
+
const forceIncludeAll = this.flags['force-include-all'];
|
|
11
14
|
|
|
12
15
|
this.validateVersions(versionFrom, versionTo);
|
|
13
16
|
this.validatePercent(percent);
|
|
@@ -25,13 +28,34 @@ If you would like to stop this canary now, run \`zapier canary:delete ${existing
|
|
|
25
28
|
return;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
let createCanaryMessage = `Creating canary deployment
|
|
29
32
|
- From version: ${versionFrom}
|
|
30
33
|
- To version: ${versionTo}
|
|
31
|
-
-
|
|
32
|
-
- Duration: ${duration} seconds
|
|
34
|
+
- Percentage: ${percent}%
|
|
35
|
+
- Duration: ${duration} seconds`;
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
const body = {
|
|
38
|
+
percent,
|
|
39
|
+
duration,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
if (user) {
|
|
43
|
+
body.user = user;
|
|
44
|
+
createCanaryMessage += `\n - User: ${user}`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (accountId) {
|
|
48
|
+
body.account_id = parseInt(accountId);
|
|
49
|
+
createCanaryMessage += `\n - Account ID: ${accountId}`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (forceIncludeAll) {
|
|
53
|
+
body.force_include_all = true;
|
|
54
|
+
createCanaryMessage += `\n - Force Include All: true`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
this.startSpinner(createCanaryMessage);
|
|
58
|
+
await createCanary(versionFrom, versionTo, body);
|
|
35
59
|
|
|
36
60
|
this.stopSpinner();
|
|
37
61
|
this.log('Canary deployment created successfully.');
|
|
@@ -71,6 +95,21 @@ CanaryCreateCommand.flags = buildFlags({
|
|
|
71
95
|
description: 'Duration of the canary in seconds',
|
|
72
96
|
required: true,
|
|
73
97
|
}),
|
|
98
|
+
user: Flags.string({
|
|
99
|
+
char: 'u',
|
|
100
|
+
description:
|
|
101
|
+
'Canary this user (email) across all accounts, unless `account-id` is specified.',
|
|
102
|
+
}),
|
|
103
|
+
'account-id': Flags.string({
|
|
104
|
+
char: 'a',
|
|
105
|
+
description:
|
|
106
|
+
'The account ID to target. If user is specified, only canary the user within this account. If user is not specified, then this argument is only permitted for Zapier staff.',
|
|
107
|
+
}),
|
|
108
|
+
'force-include-all': Flags.boolean({
|
|
109
|
+
char: 'f',
|
|
110
|
+
description:
|
|
111
|
+
'Overrides any default filters the canary system imposes. This argument is only permitted for Zapier staff.',
|
|
112
|
+
}),
|
|
74
113
|
},
|
|
75
114
|
});
|
|
76
115
|
|
|
@@ -89,13 +128,21 @@ CanaryCreateCommand.description = `Create a new canary deployment, diverting a s
|
|
|
89
128
|
|
|
90
129
|
Only one canary can be active at the same time. You can run \`zapier canary:list\` to check. If you would like to create a new canary with different parameters, you can wait for the canary to finish, or delete it using \`zapier canary:delete a.b.c x.y.z\`.
|
|
91
130
|
|
|
131
|
+
To canary traffic for a specific user, use the --user flag.
|
|
132
|
+
|
|
133
|
+
To canary traffic for an entire account, use the --account-id. Note: this scenario is only permitted for Zapier staff.
|
|
134
|
+
|
|
135
|
+
To canary traffic for a specific user within a specific account, use both --user and --account-id flags.
|
|
136
|
+
|
|
92
137
|
Note: this is similar to \`zapier migrate\` but different in that this is temporary and will "revert" the changes once the specified duration is expired.
|
|
93
138
|
|
|
94
139
|
**Only use this command to canary traffic between non-breaking versions!**`;
|
|
95
140
|
|
|
96
141
|
CanaryCreateCommand.examples = [
|
|
97
|
-
'zapier canary:create 1.0.0 1.1.0 -p
|
|
98
|
-
'zapier canary:create 2.0.0 2.1.0 --percent
|
|
142
|
+
'zapier canary:create 1.0.0 1.1.0 -p 10 -d 3600',
|
|
143
|
+
'zapier canary:create 2.0.0 2.1.0 --percent 25 --duration 1800 --user user@example.com',
|
|
144
|
+
'zapier canary:create 2.0.0 2.1.0 -p 15 -d 7200 -a 12345 -u user@example.com',
|
|
145
|
+
'zapier canary:create 2.0.0 2.1.0 -p 15 -d 7200 -a 12345',
|
|
99
146
|
];
|
|
100
147
|
CanaryCreateCommand.skipValidInstallCheck = true;
|
|
101
148
|
|
|
@@ -12,6 +12,8 @@ class CanaryListCommand extends ZapierBaseCommand {
|
|
|
12
12
|
to_version: c.to_version,
|
|
13
13
|
percent: c.percent,
|
|
14
14
|
seconds_remaining: c.until_timestamp - Math.floor(Date.now() / 1000),
|
|
15
|
+
user: c.user,
|
|
16
|
+
account_id: c.account_id,
|
|
15
17
|
}));
|
|
16
18
|
|
|
17
19
|
this.log(bold('Active Canaries') + '\n');
|
|
@@ -22,6 +24,8 @@ class CanaryListCommand extends ZapierBaseCommand {
|
|
|
22
24
|
['To Version', 'to_version'],
|
|
23
25
|
['Traffic Amount', 'percent'],
|
|
24
26
|
['Seconds Remaining', 'seconds_remaining'],
|
|
27
|
+
['User', 'user'],
|
|
28
|
+
['Account ID', 'account_id'],
|
|
25
29
|
],
|
|
26
30
|
emptyMessage: grey(`No active canary deployments found.`),
|
|
27
31
|
});
|
|
@@ -982,6 +982,7 @@ class InvokeCommand extends BaseCommand {
|
|
|
982
982
|
method: methodName,
|
|
983
983
|
bundle: {
|
|
984
984
|
inputData,
|
|
985
|
+
inputDataRaw: inputData, // At this point, inputData hasn't been transformed yet
|
|
985
986
|
authData,
|
|
986
987
|
meta,
|
|
987
988
|
},
|
|
@@ -1013,6 +1014,8 @@ class InvokeCommand extends BaseCommand {
|
|
|
1013
1014
|
);
|
|
1014
1015
|
}
|
|
1015
1016
|
|
|
1017
|
+
// Preserve original inputData as inputDataRaw before type resolution
|
|
1018
|
+
const inputDataRaw = { ...inputData };
|
|
1016
1019
|
inputData = resolveInputDataTypes(inputData, inputFields, timezone);
|
|
1017
1020
|
methodName = `${actionTypePlural}.${action.key}.operation.perform`;
|
|
1018
1021
|
|
|
@@ -1022,6 +1025,7 @@ class InvokeCommand extends BaseCommand {
|
|
|
1022
1025
|
method: methodName,
|
|
1023
1026
|
bundle: {
|
|
1024
1027
|
inputData,
|
|
1028
|
+
inputDataRaw,
|
|
1025
1029
|
authData,
|
|
1026
1030
|
meta,
|
|
1027
1031
|
},
|
package/src/utils/api.js
CHANGED
|
@@ -154,17 +154,14 @@ const createCredentials = (username, password, totpCode) => {
|
|
|
154
154
|
);
|
|
155
155
|
};
|
|
156
156
|
|
|
157
|
-
const createCanary = async (versionFrom, versionTo,
|
|
157
|
+
const createCanary = async (versionFrom, versionTo, body) => {
|
|
158
158
|
const linkedAppId = (await getLinkedAppConfig(undefined, true))?.id;
|
|
159
159
|
|
|
160
160
|
return callAPI(
|
|
161
161
|
`/apps/${linkedAppId}/versions/${versionFrom}/canary-to/${versionTo}`,
|
|
162
162
|
{
|
|
163
163
|
method: 'POST',
|
|
164
|
-
body
|
|
165
|
-
percent,
|
|
166
|
-
duration,
|
|
167
|
-
},
|
|
164
|
+
body,
|
|
168
165
|
},
|
|
169
166
|
);
|
|
170
167
|
};
|
|
@@ -50,8 +50,6 @@ const authFileExport = (
|
|
|
50
50
|
authType,
|
|
51
51
|
authDescription,
|
|
52
52
|
{
|
|
53
|
-
beforeFuncNames = [],
|
|
54
|
-
afterFuncNames = [],
|
|
55
53
|
extraConfigProps = [],
|
|
56
54
|
connectionLabel = strLiteral('{{json.username}}'),
|
|
57
55
|
test = objProperty('test'),
|
|
@@ -85,14 +83,37 @@ const authFileExport = (
|
|
|
85
83
|
? objTS('Authentication', ...configProps)
|
|
86
84
|
: obj(...configProps);
|
|
87
85
|
|
|
88
|
-
return exportStatement(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
return exportStatement(configObj, language);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const middlewareFileExport = (
|
|
90
|
+
language,
|
|
91
|
+
{ beforeFuncNames = [], afterFuncNames = [] },
|
|
92
|
+
) => {
|
|
93
|
+
const exportConst = language === 'typescript';
|
|
94
|
+
return language === 'typescript'
|
|
95
|
+
? [
|
|
96
|
+
// for Typescript, export the befores and afters separately as consts
|
|
97
|
+
variableAssignmentDeclaration(
|
|
98
|
+
'befores',
|
|
99
|
+
arr(...beforeFuncNames),
|
|
100
|
+
exportConst,
|
|
101
|
+
),
|
|
102
|
+
variableAssignmentDeclaration(
|
|
103
|
+
'afters',
|
|
104
|
+
arr(...afterFuncNames),
|
|
105
|
+
exportConst,
|
|
106
|
+
),
|
|
107
|
+
]
|
|
108
|
+
: [
|
|
109
|
+
// for Javascript, export the befores and afters together using module.exports
|
|
110
|
+
exportStatement(
|
|
111
|
+
obj(
|
|
112
|
+
objProperty('befores', arr(...beforeFuncNames)),
|
|
113
|
+
objProperty('afters', arr(...afterFuncNames)),
|
|
114
|
+
),
|
|
115
|
+
),
|
|
116
|
+
];
|
|
96
117
|
};
|
|
97
118
|
|
|
98
119
|
const authTestFunc = (language, testUrl = strLiteral(authJsonUrl('me'))) =>
|
|
@@ -126,15 +147,12 @@ const handleBadResponsesFunc = (
|
|
|
126
147
|
);
|
|
127
148
|
|
|
128
149
|
const basicAuthFile = (language) => {
|
|
129
|
-
const badFuncName = 'handleBadResponses';
|
|
130
150
|
const fileInput = [
|
|
131
151
|
authTestFunc(language),
|
|
132
|
-
handleBadResponsesFunc(badFuncName, language),
|
|
133
152
|
authFileExport(
|
|
134
153
|
language,
|
|
135
154
|
'basic',
|
|
136
155
|
'"basic" auth automatically creates "username" and "password" input fields. It also registers default middleware to create the authentication header.',
|
|
137
|
-
{ afterFuncNames: [badFuncName] },
|
|
138
156
|
),
|
|
139
157
|
];
|
|
140
158
|
return language === 'typescript'
|
|
@@ -142,6 +160,27 @@ const basicAuthFile = (language) => {
|
|
|
142
160
|
: file(...fileInput);
|
|
143
161
|
};
|
|
144
162
|
|
|
163
|
+
const basicMiddlewareFile = (language) => {
|
|
164
|
+
const badFuncName = 'handleBadResponses';
|
|
165
|
+
const fileInput = [
|
|
166
|
+
handleBadResponsesFunc(badFuncName, language),
|
|
167
|
+
...middlewareFileExport(language, {
|
|
168
|
+
beforeFuncNames: [],
|
|
169
|
+
afterFuncNames: [badFuncName],
|
|
170
|
+
}),
|
|
171
|
+
];
|
|
172
|
+
return language === 'typescript'
|
|
173
|
+
? fileTS(standardTypes, ...fileInput)
|
|
174
|
+
: file(...fileInput);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const basicFiles = (language) => {
|
|
178
|
+
return {
|
|
179
|
+
middleware: basicMiddlewareFile(language),
|
|
180
|
+
authentication: basicAuthFile(language),
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
|
|
145
184
|
/**
|
|
146
185
|
* boilerplate for a "before" middleware. No need to return the requst at the end
|
|
147
186
|
*/
|
|
@@ -274,6 +313,7 @@ const getAccessTokenFunc = (language) => {
|
|
|
274
313
|
'If your app does an app refresh, then `refresh_token` should be returned here as well',
|
|
275
314
|
),
|
|
276
315
|
],
|
|
316
|
+
language,
|
|
277
317
|
});
|
|
278
318
|
};
|
|
279
319
|
|
|
@@ -288,23 +328,20 @@ const refreshTokenFunc = (language) => {
|
|
|
288
328
|
'If the refresh token does change, return it here to update the stored value in Zapier',
|
|
289
329
|
),
|
|
290
330
|
],
|
|
331
|
+
language,
|
|
291
332
|
});
|
|
292
333
|
};
|
|
293
334
|
|
|
294
335
|
const oauth2AuthFile = (language) => {
|
|
295
|
-
const bearerFuncName = 'includeBearerToken';
|
|
296
336
|
const fileInput = [
|
|
297
337
|
getAccessTokenFunc(language),
|
|
298
338
|
refreshTokenFunc(language),
|
|
299
|
-
includeBearerFunc(bearerFuncName, language),
|
|
300
339
|
authTestFunc(language),
|
|
301
340
|
authFileExport(
|
|
302
341
|
language,
|
|
303
342
|
'oauth2',
|
|
304
343
|
'OAuth2 is a web authentication standard. There are a lot of configuration options that will fit most any situation.',
|
|
305
344
|
{
|
|
306
|
-
beforeFuncNames: [bearerFuncName],
|
|
307
|
-
afterFuncNames: [],
|
|
308
345
|
extraConfigProps: [
|
|
309
346
|
objProperty(
|
|
310
347
|
'oauth2Config',
|
|
@@ -351,11 +388,55 @@ const oauth2AuthFile = (language) => {
|
|
|
351
388
|
? fileTS(standardTypes, ...fileInput)
|
|
352
389
|
: file(...fileInput);
|
|
353
390
|
};
|
|
391
|
+
|
|
392
|
+
const oauth2MiddlewareFile = (language) => {
|
|
393
|
+
const bearerFuncName = 'includeBearerToken';
|
|
394
|
+
const fileInput = [
|
|
395
|
+
includeBearerFunc(bearerFuncName, language),
|
|
396
|
+
...middlewareFileExport(language, {
|
|
397
|
+
beforeFuncNames: [bearerFuncName],
|
|
398
|
+
afterFuncNames: [],
|
|
399
|
+
}),
|
|
400
|
+
];
|
|
401
|
+
return language === 'typescript'
|
|
402
|
+
? fileTS(standardTypes, ...fileInput)
|
|
403
|
+
: file(...fileInput);
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
const oauth2Files = (language) => {
|
|
407
|
+
return {
|
|
408
|
+
middleware: oauth2MiddlewareFile(language),
|
|
409
|
+
authentication: oauth2AuthFile(language),
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
|
|
354
413
|
const customAuthFile = (language) => {
|
|
414
|
+
const fileInput = [
|
|
415
|
+
authTestFunc(language),
|
|
416
|
+
authFileExport(
|
|
417
|
+
language,
|
|
418
|
+
'custom',
|
|
419
|
+
'"custom" is the catch-all auth type. The user supplies some info and Zapier can make authenticated requests with it',
|
|
420
|
+
{
|
|
421
|
+
authFields: [
|
|
422
|
+
obj(
|
|
423
|
+
objProperty('key', strLiteral('apiKey')),
|
|
424
|
+
objProperty('label', strLiteral('API Key')),
|
|
425
|
+
objProperty('required', 'true'),
|
|
426
|
+
),
|
|
427
|
+
],
|
|
428
|
+
},
|
|
429
|
+
),
|
|
430
|
+
];
|
|
431
|
+
return language === 'typescript'
|
|
432
|
+
? fileTS(standardTypes, ...fileInput)
|
|
433
|
+
: file(...fileInput);
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
const customMiddlewareFile = (language) => {
|
|
355
437
|
const includeApiKeyFuncName = 'includeApiKey';
|
|
356
438
|
const handleResponseFuncName = 'handleBadResponses';
|
|
357
439
|
const fileInput = [
|
|
358
|
-
authTestFunc(language),
|
|
359
440
|
handleBadResponsesFunc(handleResponseFuncName, language, 'API Key'),
|
|
360
441
|
beforeMiddlewareFunc(
|
|
361
442
|
includeApiKeyFuncName,
|
|
@@ -372,30 +453,24 @@ const customAuthFile = (language) => {
|
|
|
372
453
|
comment('request.headers.Authorization = bundle.authData.apiKey;'),
|
|
373
454
|
),
|
|
374
455
|
),
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
{
|
|
380
|
-
beforeFuncNames: [includeApiKeyFuncName],
|
|
381
|
-
afterFuncNames: [handleResponseFuncName],
|
|
382
|
-
authFields: [
|
|
383
|
-
obj(
|
|
384
|
-
objProperty('key', strLiteral('apiKey')),
|
|
385
|
-
objProperty('label', strLiteral('API Key')),
|
|
386
|
-
objProperty('required', 'true'),
|
|
387
|
-
),
|
|
388
|
-
],
|
|
389
|
-
},
|
|
390
|
-
),
|
|
456
|
+
...middlewareFileExport(language, {
|
|
457
|
+
beforeFuncNames: [includeApiKeyFuncName],
|
|
458
|
+
afterFuncNames: [handleResponseFuncName],
|
|
459
|
+
}),
|
|
391
460
|
];
|
|
392
461
|
return language === 'typescript'
|
|
393
462
|
? fileTS(standardTypes, ...fileInput)
|
|
394
463
|
: file(...fileInput);
|
|
395
464
|
};
|
|
396
465
|
|
|
466
|
+
const customFiles = (language) => {
|
|
467
|
+
return {
|
|
468
|
+
middleware: customMiddlewareFile(language),
|
|
469
|
+
authentication: customAuthFile(language),
|
|
470
|
+
};
|
|
471
|
+
};
|
|
472
|
+
|
|
397
473
|
const digestAuthFile = (language) => {
|
|
398
|
-
const badFuncName = 'handleBadResponses';
|
|
399
474
|
const fileInput = [
|
|
400
475
|
// special digest auth
|
|
401
476
|
authTestFunc(
|
|
@@ -404,12 +479,10 @@ const digestAuthFile = (language) => {
|
|
|
404
479
|
'https://httpbin.zapier-tooling.com/digest-auth/auth/myuser/mypass',
|
|
405
480
|
),
|
|
406
481
|
),
|
|
407
|
-
handleBadResponsesFunc(badFuncName, language),
|
|
408
482
|
authFileExport(
|
|
409
483
|
language,
|
|
410
484
|
'digest',
|
|
411
485
|
'"digest" auth automatically creates "username" and "password" input fields. It also registers default middleware to create the authentication header.',
|
|
412
|
-
{ afterFuncNames: [badFuncName] },
|
|
413
486
|
),
|
|
414
487
|
];
|
|
415
488
|
return language === 'typescript'
|
|
@@ -417,9 +490,29 @@ const digestAuthFile = (language) => {
|
|
|
417
490
|
: file(...fileInput);
|
|
418
491
|
};
|
|
419
492
|
|
|
493
|
+
const digestMiddlewareFile = (language) => {
|
|
494
|
+
const badFuncName = 'handleBadResponses';
|
|
495
|
+
const fileInput = [
|
|
496
|
+
handleBadResponsesFunc(badFuncName, language),
|
|
497
|
+
...middlewareFileExport(language, {
|
|
498
|
+
beforeFuncNames: [],
|
|
499
|
+
afterFuncNames: [badFuncName],
|
|
500
|
+
}),
|
|
501
|
+
];
|
|
502
|
+
return language === 'typescript'
|
|
503
|
+
? fileTS(standardTypes, ...fileInput)
|
|
504
|
+
: file(...fileInput);
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
const digestFiles = (language) => {
|
|
508
|
+
return {
|
|
509
|
+
middleware: digestMiddlewareFile(language),
|
|
510
|
+
authentication: digestAuthFile(language),
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
|
|
420
514
|
const sessionAuthFile = (language) => {
|
|
421
515
|
const getSessionKeyName = 'getSessionKey';
|
|
422
|
-
const includeSessionKeyName = 'includeSessionKeyHeader';
|
|
423
516
|
const fileInput = [
|
|
424
517
|
authTestFunc(language),
|
|
425
518
|
tokenExchangeFunc(
|
|
@@ -437,25 +530,11 @@ const sessionAuthFile = (language) => {
|
|
|
437
530
|
objProperty('sessionKey', 'response.data.sessionKey || "secret"'),
|
|
438
531
|
],
|
|
439
532
|
),
|
|
440
|
-
beforeMiddlewareFunc(
|
|
441
|
-
includeSessionKeyName,
|
|
442
|
-
language,
|
|
443
|
-
ifStatement(
|
|
444
|
-
'bundle.authData.sessionKey',
|
|
445
|
-
assignmentStatement('request.headers', 'request.headers || {}'),
|
|
446
|
-
assignmentStatement(
|
|
447
|
-
"request.headers['X-API-Key']",
|
|
448
|
-
'bundle.authData.sessionKey',
|
|
449
|
-
),
|
|
450
|
-
),
|
|
451
|
-
),
|
|
452
533
|
authFileExport(
|
|
453
534
|
language,
|
|
454
535
|
'session',
|
|
455
536
|
'"session" auth exchanges user data for a different session token (that may be periodically refreshed")',
|
|
456
537
|
{
|
|
457
|
-
beforeFuncNames: [includeSessionKeyName],
|
|
458
|
-
afterFuncNames: [],
|
|
459
538
|
authFields: [
|
|
460
539
|
obj(
|
|
461
540
|
objProperty('key', strLiteral('username')),
|
|
@@ -484,6 +563,38 @@ const sessionAuthFile = (language) => {
|
|
|
484
563
|
: file(...fileInput);
|
|
485
564
|
};
|
|
486
565
|
|
|
566
|
+
const sessionMiddlewareFile = (language) => {
|
|
567
|
+
const includeSessionKeyName = 'includeSessionKeyHeader';
|
|
568
|
+
const fileInput = [
|
|
569
|
+
beforeMiddlewareFunc(
|
|
570
|
+
includeSessionKeyName,
|
|
571
|
+
language,
|
|
572
|
+
ifStatement(
|
|
573
|
+
'bundle.authData.sessionKey',
|
|
574
|
+
assignmentStatement('request.headers', 'request.headers || {}'),
|
|
575
|
+
assignmentStatement(
|
|
576
|
+
"request.headers['X-API-Key']",
|
|
577
|
+
'bundle.authData.sessionKey',
|
|
578
|
+
),
|
|
579
|
+
),
|
|
580
|
+
),
|
|
581
|
+
...middlewareFileExport(language, {
|
|
582
|
+
beforeFuncNames: [includeSessionKeyName],
|
|
583
|
+
afterFuncNames: [],
|
|
584
|
+
}),
|
|
585
|
+
];
|
|
586
|
+
return language === 'typescript'
|
|
587
|
+
? fileTS(standardTypes, ...fileInput)
|
|
588
|
+
: file(...fileInput);
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
const sessionFiles = (language) => {
|
|
592
|
+
return {
|
|
593
|
+
middleware: sessionMiddlewareFile(language),
|
|
594
|
+
authentication: sessionAuthFile(language),
|
|
595
|
+
};
|
|
596
|
+
};
|
|
597
|
+
|
|
487
598
|
// just different enough from oauth2 that it gets its own function
|
|
488
599
|
const oauth1TokenExchangeFunc = (
|
|
489
600
|
funcName,
|
|
@@ -520,7 +631,6 @@ const oauth1AuthFile = (language) => {
|
|
|
520
631
|
const accessTokenVarName = 'ACCESS_TOKEN_URL';
|
|
521
632
|
const authorizeUrlVarName = 'AUTHORIZE_URL';
|
|
522
633
|
const getRequestTokenFuncName = 'getRequestToken';
|
|
523
|
-
const includeAccessTokenFuncName = 'includeAccessToken';
|
|
524
634
|
const fileInput = [
|
|
525
635
|
variableAssignmentDeclaration('querystring', "require('querystring')"),
|
|
526
636
|
block(
|
|
@@ -553,33 +663,8 @@ const oauth1AuthFile = (language) => {
|
|
|
553
663
|
objProperty('oauth_token_secret', 'bundle.inputData.oauth_token_secret'),
|
|
554
664
|
objProperty('oauth_verifier', 'bundle.inputData.oauth_verifier'),
|
|
555
665
|
),
|
|
556
|
-
beforeMiddlewareFunc(
|
|
557
|
-
includeAccessTokenFuncName,
|
|
558
|
-
language,
|
|
559
|
-
ifStatement(
|
|
560
|
-
'bundle.authData && bundle.authData.oauth_token && bundle.authData.oauth_token_secret',
|
|
561
|
-
comment(
|
|
562
|
-
'Put your OAuth1 credentials in `req.auth`, Zapier will sign the request for you.',
|
|
563
|
-
),
|
|
564
|
-
assignmentStatement(
|
|
565
|
-
'request.auth',
|
|
566
|
-
obj(
|
|
567
|
-
objProperty('oauth_consumer_key', 'process.env.CLIENT_ID'),
|
|
568
|
-
objProperty('oauth_consumer_secret', 'process.env.CLIENT_SECRET'),
|
|
569
|
-
objProperty('oauth_token', 'bundle.authData.oauth_token'),
|
|
570
|
-
objProperty(
|
|
571
|
-
'oauth_token_secret',
|
|
572
|
-
'bundle.authData.oauth_token_secret',
|
|
573
|
-
),
|
|
574
|
-
comment("oauth_version: '1.0', // sometimes required"),
|
|
575
|
-
objProperty('...(request.auth || {})'),
|
|
576
|
-
),
|
|
577
|
-
),
|
|
578
|
-
),
|
|
579
|
-
),
|
|
580
666
|
authTestFunc(language, strLiteral('https://api.trello.com/1/members/me/')),
|
|
581
667
|
authFileExport(language, 'oauth1', 'OAuth1 is an older form of OAuth', {
|
|
582
|
-
beforeFuncNames: [includeAccessTokenFuncName],
|
|
583
668
|
extraConfigProps: [
|
|
584
669
|
objProperty(
|
|
585
670
|
'oauth1Config',
|
|
@@ -619,11 +704,55 @@ const oauth1AuthFile = (language) => {
|
|
|
619
704
|
: file(...fileInput);
|
|
620
705
|
};
|
|
621
706
|
|
|
707
|
+
const oauth1MiddlewareFile = (language) => {
|
|
708
|
+
const includeAccessTokenFuncName = 'includeAccessToken';
|
|
709
|
+
const fileInput = [
|
|
710
|
+
beforeMiddlewareFunc(
|
|
711
|
+
includeAccessTokenFuncName,
|
|
712
|
+
language,
|
|
713
|
+
ifStatement(
|
|
714
|
+
'bundle.authData && bundle.authData.oauth_token && bundle.authData.oauth_token_secret',
|
|
715
|
+
comment(
|
|
716
|
+
'Put your OAuth1 credentials in `req.auth`, Zapier will sign the request for you.',
|
|
717
|
+
),
|
|
718
|
+
assignmentStatement(
|
|
719
|
+
'request.auth',
|
|
720
|
+
obj(
|
|
721
|
+
objProperty('oauth_consumer_key', 'process.env.CLIENT_ID'),
|
|
722
|
+
objProperty('oauth_consumer_secret', 'process.env.CLIENT_SECRET'),
|
|
723
|
+
objProperty('oauth_token', 'bundle.authData.oauth_token'),
|
|
724
|
+
objProperty(
|
|
725
|
+
'oauth_token_secret',
|
|
726
|
+
'bundle.authData.oauth_token_secret',
|
|
727
|
+
),
|
|
728
|
+
comment("oauth_version: '1.0', // sometimes required"),
|
|
729
|
+
objProperty('...(request.auth || {})'),
|
|
730
|
+
),
|
|
731
|
+
),
|
|
732
|
+
),
|
|
733
|
+
),
|
|
734
|
+
...middlewareFileExport(language, {
|
|
735
|
+
beforeFuncNames: [includeAccessTokenFuncName],
|
|
736
|
+
afterFuncNames: [],
|
|
737
|
+
}),
|
|
738
|
+
];
|
|
739
|
+
return language === 'typescript'
|
|
740
|
+
? fileTS(standardTypes, ...fileInput)
|
|
741
|
+
: file(...fileInput);
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
const oauth1Files = (language) => {
|
|
745
|
+
return {
|
|
746
|
+
middleware: oauth1MiddlewareFile(language),
|
|
747
|
+
authentication: oauth1AuthFile(language),
|
|
748
|
+
};
|
|
749
|
+
};
|
|
750
|
+
|
|
622
751
|
module.exports = {
|
|
623
|
-
basic:
|
|
624
|
-
custom:
|
|
625
|
-
digest:
|
|
626
|
-
oauth1:
|
|
627
|
-
oauth2:
|
|
628
|
-
session:
|
|
752
|
+
basic: basicFiles,
|
|
753
|
+
custom: customFiles,
|
|
754
|
+
digest: digestFiles,
|
|
755
|
+
oauth1: oauth1Files,
|
|
756
|
+
oauth2: oauth2Files,
|
|
757
|
+
session: sessionFiles,
|
|
629
758
|
};
|
package/src/utils/build.js
CHANGED
|
@@ -75,6 +75,9 @@ const findRequiredFiles = async (workingDir, entryPoints) => {
|
|
|
75
75
|
write: false, // no need to write outfile
|
|
76
76
|
absWorkingDir: workingDir,
|
|
77
77
|
tsconfigRaw: '{}',
|
|
78
|
+
loader: {
|
|
79
|
+
'.node': 'file',
|
|
80
|
+
},
|
|
78
81
|
});
|
|
79
82
|
|
|
80
83
|
let relPaths = Object.keys(result.metafile.inputs);
|
package/src/utils/codegen.js
CHANGED
|
@@ -49,8 +49,8 @@ const objProperty = (key, value, satisfiesType) => {
|
|
|
49
49
|
return `'${key}': ${value}${satisfiesType ? ` satisfies ${satisfiesType}` : ''}`;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
const variableAssignmentDeclaration = (varName, value) =>
|
|
53
|
-
|
|
52
|
+
const variableAssignmentDeclaration = (varName, value, exportConst = false) =>
|
|
53
|
+
`${exportConst ? 'export const' : 'const'} ${varName} = ${value}`;
|
|
54
54
|
|
|
55
55
|
const fatArrowReturnFunctionDeclaration = (varname, args, statement) =>
|
|
56
56
|
`const ${varname} = (${args.join(', ')}) => ${statement}`;
|