zapier-platform-cli 16.3.0 → 16.4.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 +136 -118
- package/package.json +1 -1
- package/src/generators/index.js +1 -0
- package/src/generators/templates/openai/README.md +3 -0
- package/src/generators/templates/openai/authentication.js +46 -0
- package/src/generators/templates/openai/constants.js +10 -0
- package/src/generators/templates/openai/creates/chat_completion.js +164 -0
- package/src/generators/templates/openai/creates/index.js +7 -0
- package/src/generators/templates/openai/dynamic_dropdowns/index.js +7 -0
- package/src/generators/templates/openai/dynamic_dropdowns/list_models.js +24 -0
- package/src/generators/templates/openai/index.js +33 -0
- package/src/generators/templates/openai/middleware.js +50 -0
- package/src/generators/templates/openai/samples/chat.json +29 -0
- package/src/generators/templates/openai/test/authentication.test.js +66 -0
- package/src/generators/templates/openai/test/chat_completion.test.js +150 -0
- package/src/generators/templates/openai/test/list_models.test.js +51 -0
- package/src/oclif/ZapierBaseCommand.js +1 -1
- package/src/oclif/commands/deprecate.js +42 -8
- package/src/oclif/commands/invoke.js +279 -15
- package/src/utils/api.js +9 -0
- package/src/utils/local.js +266 -2
package/oclif.manifest.json
CHANGED
|
@@ -178,11 +178,18 @@
|
|
|
178
178
|
"required": true
|
|
179
179
|
}
|
|
180
180
|
},
|
|
181
|
-
"description": "Mark a non-production version of your integration as deprecated, with removal by a certain date.\n\nUse this when an integration version will not be supported or start breaking at a known date.\n\nZapier will send
|
|
181
|
+
"description": "Mark a non-production version of your integration as deprecated, with removal by a certain date.\n\nUse this when an integration version will not be supported or start breaking at a known date.\n\nZapier will immediately send emails warning users of the deprecation if a date less than 30 days in the future is set, otherwise the emails will be sent exactly 30 days before the configured deprecation date.\n\nThere are other side effects: they'll start seeing it as \"Deprecated\" in the UI, and once the deprecation date arrives, if the Zaps weren't updated, they'll be paused and the users will be emailed again explaining what happened.\n\nDo not use deprecation if you only have non-breaking changes, such as:\n- Fixing help text\n- Adding new triggers/actions\n- Improving existing functionality\n- other bug fixes that don't break existing automations.",
|
|
182
182
|
"examples": [
|
|
183
183
|
"zapier deprecate 1.2.3 2011-10-01"
|
|
184
184
|
],
|
|
185
185
|
"flags": {
|
|
186
|
+
"force": {
|
|
187
|
+
"char": "f",
|
|
188
|
+
"description": "Skip confirmation prompt. Use with caution.",
|
|
189
|
+
"name": "force",
|
|
190
|
+
"allowNo": false,
|
|
191
|
+
"type": "boolean"
|
|
192
|
+
},
|
|
186
193
|
"debug": {
|
|
187
194
|
"char": "d",
|
|
188
195
|
"description": "Show extra debugging output.",
|
|
@@ -349,6 +356,7 @@
|
|
|
349
356
|
"minimal",
|
|
350
357
|
"oauth1-trello",
|
|
351
358
|
"oauth2",
|
|
359
|
+
"openai",
|
|
352
360
|
"search-or-create",
|
|
353
361
|
"session-auth",
|
|
354
362
|
"typescript"
|
|
@@ -458,7 +466,7 @@
|
|
|
458
466
|
"name": "actionKey"
|
|
459
467
|
}
|
|
460
468
|
},
|
|
461
|
-
"description": "Invoke an auth operation, a trigger, or a create/search action locally.\n\nThis command emulates how Zapier production environment would invoke your integration. It runs code locally, so you can use this command to quickly test your integration without deploying it to Zapier. This is especially useful for debugging and development.\n\nThis command loads environment variables and `authData` from the `.env` file in the current directory. If you don't have a `.env` file yet, you can use the `zapier invoke auth start` command to help you initialize it, or you can manually create it.\n\nThe `zapier invoke auth start` subcommand will prompt you for the necessary auth fields and save them to the `.env` file. For OAuth2, it will start a local HTTP server, open the authorization URL in the browser, wait for the OAuth2 redirect, and get the access token.\n\nEach line in the `.env` file should follow one of these formats:\n\n* `VAR_NAME=VALUE` for environment variables\n* `authData_FIELD_KEY=VALUE` for auth data fields\n\nFor example, a `.env` file for an OAuth2 integration might look like this:\n\n```\nCLIENT_ID='your_client_id'\nCLIENT_SECRET='your_client_secret'\nauthData_access_token='1234567890'\nauthData_refresh_token='abcdefg'\nauthData_account_name='zapier'\n```\n\nTo test if the auth data is correct, run either one of these:\n\n```\nzapier invoke auth test # invokes authentication.test method\nzapier invoke auth label # invokes authentication.test and renders connection label\n```\n\nTo refresh stale auth data for OAuth2 or session auth, run `zapier invoke auth refresh
|
|
469
|
+
"description": "Invoke an auth operation, a trigger, or a create/search action locally.\n\nThis command emulates how Zapier production environment would invoke your integration. It runs code locally, so you can use this command to quickly test your integration without deploying it to Zapier. This is especially useful for debugging and development.\n\nWhy use this command?\n\n* Fast feedback loop: Write code and run this command to verify if it works immediately\n* Step-by-step debugging: Running locally means you can use a debugger to step through your code\n* Untruncated logs: View complete logs and errors in your terminal\n\n### Authentication\n\nYou can supply the authentcation data in two ways: Load from the local `.env` file or use the (experimental) `--authentication-id` flag.\n\n#### The local `.env` file\n\nThis command loads environment variables and `authData` from the `.env` file in the current directory. If you don't have a `.env` file yet, you can use the `zapier invoke auth start` command to help you initialize it, or you can manually create it.\n\nThe `zapier invoke auth start` subcommand will prompt you for the necessary auth fields and save them to the `.env` file. For OAuth2, it will start a local HTTP server, open the authorization URL in the browser, wait for the OAuth2 redirect, and get the access token.\n\nEach line in the `.env` file should follow one of these formats:\n\n* `VAR_NAME=VALUE` for environment variables\n* `authData_FIELD_KEY=VALUE` for auth data fields\n\nFor example, a `.env` file for an OAuth2 integration might look like this:\n\n```\nCLIENT_ID='your_client_id'\nCLIENT_SECRET='your_client_secret'\nauthData_access_token='1234567890'\nauthData_refresh_token='abcdefg'\nauthData_account_name='zapier'\n```\n\n\n#### The `--authentication-id` flag (EXPERIMENTAL)\n\nSetting up local auth data can be troublesome. You'd have to configure your app server to allow localhost redirect URIs or use a port forwarding tool. This is sometimes not easy to get right.\n\nThe `--authentication-id` flag (`-a` for short) gives you an alternative (and perhaps easier) way to supply your auth data. You can use `-a` to specify an existing production authentication/connection. The available authentications can be found at https://zapier.com/app/assets/connections. Check https://zpr.io/z8SjFTdnTFZ2 for more instructions.\n\nWhen `-a -` is specified, such as `zapier invoke auth test -a -`, the command will interactively prompt you to select one of your available authentications.\n\nIf you know your authentication ID, you can specify it directly, such as `zapier invoke auth test -a 123456`.\n\n#### Testing authentication\n\nTo test if the auth data is correct, run either one of these:\n\n```\nzapier invoke auth test # invokes authentication.test method\nzapier invoke auth label # invokes authentication.test and renders connection label\n```\n\nTo refresh stale auth data for OAuth2 or session auth, run `zapier invoke auth refresh`. Note that refreshing is only applicable for local auth data in the `.env` file.\n\n### Invoking a trigger or an action\n\nOnce you have the correct auth data, you can test an trigger, a search, or a create action. For example, here's how you invoke a trigger with the key `new_recipe`:\n\n```\nzapier invoke trigger new_recipe\n```\n\nTo add input data, use the `--inputData` flag (`-i` for short). The input data can come from the command directly, a file, or stdin. See **EXAMPLES** below.\n\nWhen you miss any command arguments, such as ACTIONTYPE or ACTIONKEY, the command will prompt you interactively. If you don't want to get interactive prompts, use the `--non-interactive` flag.\n\nThe `--debug` flag will show you the HTTP request logs and any console logs you have in your code.\n\n### Limitations\n\nThe following is a non-exhaustive list of current limitations and may be supported in the future:\n\n- Hook triggers, including REST hook subscribe/unsubscribe\n- Line items\n- Output hydration\n- File upload\n- Dynamic dropdown pagination\n- Function-based connection label\n- Buffered create actions\n- Search-or-create actions\n- Search-powered fields\n- Field choices\n- autoRefresh for OAuth2 and session auth\n",
|
|
462
470
|
"examples": [
|
|
463
471
|
"zapier invoke",
|
|
464
472
|
"zapier invoke auth start",
|
|
@@ -467,8 +475,10 @@
|
|
|
467
475
|
"zapier invoke auth label",
|
|
468
476
|
"zapier invoke trigger new_recipe",
|
|
469
477
|
"zapier invoke create add_recipe --inputData '{\"title\": \"Pancakes\"}'",
|
|
470
|
-
"zapier invoke search find_recipe -i @file.json",
|
|
471
|
-
"cat file.json | zapier invoke trigger new_recipe -i @-"
|
|
478
|
+
"zapier invoke search find_recipe -i @file.json --non-interactive",
|
|
479
|
+
"cat file.json | zapier invoke trigger new_recipe -i @-",
|
|
480
|
+
"zapier invoke search find_ticket --authentication-id 12345",
|
|
481
|
+
"zapier invoke create add_ticket -a -"
|
|
472
482
|
],
|
|
473
483
|
"flags": {
|
|
474
484
|
"inputData": {
|
|
@@ -545,6 +555,14 @@
|
|
|
545
555
|
"multiple": false,
|
|
546
556
|
"type": "option"
|
|
547
557
|
},
|
|
558
|
+
"authentication-id": {
|
|
559
|
+
"char": "a",
|
|
560
|
+
"description": "EXPERIMENTAL: Instead of using the local .env file, use the production authentication data with the given authentication ID (aka the \"app connection\" on Zapier). Find them at https://zapier.com/app/assets/connections (https://zpr.io/z8SjFTdnTFZ2 for instructions) or specify '-' to interactively select one from your available authentications. When specified, the code will still run locally, but all outgoing requests will be proxied through Zapier with the production auth data.",
|
|
561
|
+
"name": "authentication-id",
|
|
562
|
+
"hasDynamicHelp": false,
|
|
563
|
+
"multiple": false,
|
|
564
|
+
"type": "option"
|
|
565
|
+
},
|
|
548
566
|
"debug": {
|
|
549
567
|
"char": "d",
|
|
550
568
|
"description": "Show extra debugging output.",
|
|
@@ -1540,13 +1558,44 @@
|
|
|
1540
1558
|
"clear.js"
|
|
1541
1559
|
]
|
|
1542
1560
|
},
|
|
1543
|
-
"
|
|
1544
|
-
"aliases": [
|
|
1545
|
-
|
|
1561
|
+
"canary:create": {
|
|
1562
|
+
"aliases": [],
|
|
1563
|
+
"args": {
|
|
1564
|
+
"versionFrom": {
|
|
1565
|
+
"description": "Version to route traffic from",
|
|
1566
|
+
"name": "versionFrom",
|
|
1567
|
+
"required": true
|
|
1568
|
+
},
|
|
1569
|
+
"versionTo": {
|
|
1570
|
+
"description": "Version to canary traffic to",
|
|
1571
|
+
"name": "versionTo",
|
|
1572
|
+
"required": true
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
"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!**",
|
|
1576
|
+
"examples": [
|
|
1577
|
+
"zapier canary:create 1.0.0 1.1.0 -p 25 -d 720",
|
|
1578
|
+
"zapier canary:create 2.0.0 2.1.0 --percent 50 --duration 300"
|
|
1546
1579
|
],
|
|
1547
|
-
"args": {},
|
|
1548
|
-
"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.",
|
|
1549
1580
|
"flags": {
|
|
1581
|
+
"percent": {
|
|
1582
|
+
"char": "p",
|
|
1583
|
+
"description": "Percent of traffic to route to new version",
|
|
1584
|
+
"name": "percent",
|
|
1585
|
+
"required": true,
|
|
1586
|
+
"hasDynamicHelp": false,
|
|
1587
|
+
"multiple": false,
|
|
1588
|
+
"type": "option"
|
|
1589
|
+
},
|
|
1590
|
+
"duration": {
|
|
1591
|
+
"char": "d",
|
|
1592
|
+
"description": "Duration of the canary in seconds",
|
|
1593
|
+
"name": "duration",
|
|
1594
|
+
"required": true,
|
|
1595
|
+
"hasDynamicHelp": false,
|
|
1596
|
+
"multiple": false,
|
|
1597
|
+
"type": "option"
|
|
1598
|
+
},
|
|
1550
1599
|
"debug": {
|
|
1551
1600
|
"char": "d",
|
|
1552
1601
|
"description": "Show extra debugging output.",
|
|
@@ -1563,7 +1612,7 @@
|
|
|
1563
1612
|
},
|
|
1564
1613
|
"hasDynamicHelp": false,
|
|
1565
1614
|
"hiddenAliases": [],
|
|
1566
|
-
"id": "
|
|
1615
|
+
"id": "canary:create",
|
|
1567
1616
|
"pluginAlias": "zapier-platform-cli",
|
|
1568
1617
|
"pluginName": "zapier-platform-cli",
|
|
1569
1618
|
"pluginType": "core",
|
|
@@ -1575,20 +1624,54 @@
|
|
|
1575
1624
|
"src",
|
|
1576
1625
|
"oclif",
|
|
1577
1626
|
"commands",
|
|
1578
|
-
"
|
|
1579
|
-
"
|
|
1627
|
+
"canary",
|
|
1628
|
+
"create.js"
|
|
1580
1629
|
]
|
|
1581
1630
|
},
|
|
1582
|
-
"delete
|
|
1631
|
+
"canary:delete": {
|
|
1583
1632
|
"aliases": [],
|
|
1584
1633
|
"args": {
|
|
1585
|
-
"
|
|
1586
|
-
"description": "
|
|
1587
|
-
"name": "
|
|
1634
|
+
"versionFrom": {
|
|
1635
|
+
"description": "Version to route traffic from",
|
|
1636
|
+
"name": "versionFrom",
|
|
1637
|
+
"required": true
|
|
1638
|
+
},
|
|
1639
|
+
"versionTo": {
|
|
1640
|
+
"description": "Version canary traffic is routed to",
|
|
1641
|
+
"name": "versionTo",
|
|
1588
1642
|
"required": true
|
|
1589
1643
|
}
|
|
1590
1644
|
},
|
|
1591
|
-
"description": "Delete
|
|
1645
|
+
"description": "Delete an active canary deployment",
|
|
1646
|
+
"examples": [
|
|
1647
|
+
"zapier canary:delete 1.0.0 1.1.0"
|
|
1648
|
+
],
|
|
1649
|
+
"flags": {},
|
|
1650
|
+
"hasDynamicHelp": false,
|
|
1651
|
+
"hiddenAliases": [],
|
|
1652
|
+
"id": "canary:delete",
|
|
1653
|
+
"pluginAlias": "zapier-platform-cli",
|
|
1654
|
+
"pluginName": "zapier-platform-cli",
|
|
1655
|
+
"pluginType": "core",
|
|
1656
|
+
"strict": true,
|
|
1657
|
+
"enableJsonFlag": false,
|
|
1658
|
+
"skipValidInstallCheck": true,
|
|
1659
|
+
"isESM": false,
|
|
1660
|
+
"relativePath": [
|
|
1661
|
+
"src",
|
|
1662
|
+
"oclif",
|
|
1663
|
+
"commands",
|
|
1664
|
+
"canary",
|
|
1665
|
+
"delete.js"
|
|
1666
|
+
]
|
|
1667
|
+
},
|
|
1668
|
+
"canary:list": {
|
|
1669
|
+
"aliases": [],
|
|
1670
|
+
"args": {},
|
|
1671
|
+
"description": "List all active canary deployments",
|
|
1672
|
+
"examples": [
|
|
1673
|
+
"zapier canary:list"
|
|
1674
|
+
],
|
|
1592
1675
|
"flags": {
|
|
1593
1676
|
"debug": {
|
|
1594
1677
|
"char": "d",
|
|
@@ -1597,6 +1680,22 @@
|
|
|
1597
1680
|
"allowNo": false,
|
|
1598
1681
|
"type": "boolean"
|
|
1599
1682
|
},
|
|
1683
|
+
"format": {
|
|
1684
|
+
"char": "f",
|
|
1685
|
+
"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.",
|
|
1686
|
+
"name": "format",
|
|
1687
|
+
"default": "table",
|
|
1688
|
+
"hasDynamicHelp": false,
|
|
1689
|
+
"multiple": false,
|
|
1690
|
+
"options": [
|
|
1691
|
+
"plain",
|
|
1692
|
+
"json",
|
|
1693
|
+
"raw",
|
|
1694
|
+
"row",
|
|
1695
|
+
"table"
|
|
1696
|
+
],
|
|
1697
|
+
"type": "option"
|
|
1698
|
+
},
|
|
1600
1699
|
"invokedFromAnotherCommand": {
|
|
1601
1700
|
"hidden": true,
|
|
1602
1701
|
"name": "invokedFromAnotherCommand",
|
|
@@ -1606,7 +1705,7 @@
|
|
|
1606
1705
|
},
|
|
1607
1706
|
"hasDynamicHelp": false,
|
|
1608
1707
|
"hiddenAliases": [],
|
|
1609
|
-
"id": "
|
|
1708
|
+
"id": "canary:list",
|
|
1610
1709
|
"pluginAlias": "zapier-platform-cli",
|
|
1611
1710
|
"pluginName": "zapier-platform-cli",
|
|
1612
1711
|
"pluginType": "core",
|
|
@@ -1618,8 +1717,8 @@
|
|
|
1618
1717
|
"src",
|
|
1619
1718
|
"oclif",
|
|
1620
1719
|
"commands",
|
|
1621
|
-
"
|
|
1622
|
-
"
|
|
1720
|
+
"canary",
|
|
1721
|
+
"list.js"
|
|
1623
1722
|
]
|
|
1624
1723
|
},
|
|
1625
1724
|
"env:get": {
|
|
@@ -1798,44 +1897,13 @@
|
|
|
1798
1897
|
"unset.js"
|
|
1799
1898
|
]
|
|
1800
1899
|
},
|
|
1801
|
-
"
|
|
1802
|
-
"aliases": [
|
|
1803
|
-
|
|
1804
|
-
"versionFrom": {
|
|
1805
|
-
"description": "Version to route traffic from",
|
|
1806
|
-
"name": "versionFrom",
|
|
1807
|
-
"required": true
|
|
1808
|
-
},
|
|
1809
|
-
"versionTo": {
|
|
1810
|
-
"description": "Version to canary traffic to",
|
|
1811
|
-
"name": "versionTo",
|
|
1812
|
-
"required": true
|
|
1813
|
-
}
|
|
1814
|
-
},
|
|
1815
|
-
"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!**",
|
|
1816
|
-
"examples": [
|
|
1817
|
-
"zapier canary:create 1.0.0 1.1.0 -p 25 -d 720",
|
|
1818
|
-
"zapier canary:create 2.0.0 2.1.0 --percent 50 --duration 300"
|
|
1900
|
+
"delete:integration": {
|
|
1901
|
+
"aliases": [
|
|
1902
|
+
"delete:app"
|
|
1819
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.",
|
|
1820
1906
|
"flags": {
|
|
1821
|
-
"percent": {
|
|
1822
|
-
"char": "p",
|
|
1823
|
-
"description": "Percent of traffic to route to new version",
|
|
1824
|
-
"name": "percent",
|
|
1825
|
-
"required": true,
|
|
1826
|
-
"hasDynamicHelp": false,
|
|
1827
|
-
"multiple": false,
|
|
1828
|
-
"type": "option"
|
|
1829
|
-
},
|
|
1830
|
-
"duration": {
|
|
1831
|
-
"char": "d",
|
|
1832
|
-
"description": "Duration of the canary in seconds",
|
|
1833
|
-
"name": "duration",
|
|
1834
|
-
"required": true,
|
|
1835
|
-
"hasDynamicHelp": false,
|
|
1836
|
-
"multiple": false,
|
|
1837
|
-
"type": "option"
|
|
1838
|
-
},
|
|
1839
1907
|
"debug": {
|
|
1840
1908
|
"char": "d",
|
|
1841
1909
|
"description": "Show extra debugging output.",
|
|
@@ -1852,7 +1920,7 @@
|
|
|
1852
1920
|
},
|
|
1853
1921
|
"hasDynamicHelp": false,
|
|
1854
1922
|
"hiddenAliases": [],
|
|
1855
|
-
"id": "
|
|
1923
|
+
"id": "delete:integration",
|
|
1856
1924
|
"pluginAlias": "zapier-platform-cli",
|
|
1857
1925
|
"pluginName": "zapier-platform-cli",
|
|
1858
1926
|
"pluginType": "core",
|
|
@@ -1864,54 +1932,20 @@
|
|
|
1864
1932
|
"src",
|
|
1865
1933
|
"oclif",
|
|
1866
1934
|
"commands",
|
|
1867
|
-
"
|
|
1868
|
-
"
|
|
1935
|
+
"delete",
|
|
1936
|
+
"integration.js"
|
|
1869
1937
|
]
|
|
1870
1938
|
},
|
|
1871
|
-
"
|
|
1939
|
+
"delete:version": {
|
|
1872
1940
|
"aliases": [],
|
|
1873
1941
|
"args": {
|
|
1874
|
-
"
|
|
1875
|
-
"description": "
|
|
1876
|
-
"name": "
|
|
1877
|
-
"required": true
|
|
1878
|
-
},
|
|
1879
|
-
"versionTo": {
|
|
1880
|
-
"description": "Version canary traffic is routed to",
|
|
1881
|
-
"name": "versionTo",
|
|
1942
|
+
"version": {
|
|
1943
|
+
"description": "Specify the version to delete. It must have no users or Zaps.",
|
|
1944
|
+
"name": "version",
|
|
1882
1945
|
"required": true
|
|
1883
1946
|
}
|
|
1884
1947
|
},
|
|
1885
|
-
"description": "Delete
|
|
1886
|
-
"examples": [
|
|
1887
|
-
"zapier canary:delete 1.0.0 1.1.0"
|
|
1888
|
-
],
|
|
1889
|
-
"flags": {},
|
|
1890
|
-
"hasDynamicHelp": false,
|
|
1891
|
-
"hiddenAliases": [],
|
|
1892
|
-
"id": "canary:delete",
|
|
1893
|
-
"pluginAlias": "zapier-platform-cli",
|
|
1894
|
-
"pluginName": "zapier-platform-cli",
|
|
1895
|
-
"pluginType": "core",
|
|
1896
|
-
"strict": true,
|
|
1897
|
-
"enableJsonFlag": false,
|
|
1898
|
-
"skipValidInstallCheck": true,
|
|
1899
|
-
"isESM": false,
|
|
1900
|
-
"relativePath": [
|
|
1901
|
-
"src",
|
|
1902
|
-
"oclif",
|
|
1903
|
-
"commands",
|
|
1904
|
-
"canary",
|
|
1905
|
-
"delete.js"
|
|
1906
|
-
]
|
|
1907
|
-
},
|
|
1908
|
-
"canary:list": {
|
|
1909
|
-
"aliases": [],
|
|
1910
|
-
"args": {},
|
|
1911
|
-
"description": "List all active canary deployments",
|
|
1912
|
-
"examples": [
|
|
1913
|
-
"zapier canary:list"
|
|
1914
|
-
],
|
|
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.",
|
|
1915
1949
|
"flags": {
|
|
1916
1950
|
"debug": {
|
|
1917
1951
|
"char": "d",
|
|
@@ -1920,22 +1954,6 @@
|
|
|
1920
1954
|
"allowNo": false,
|
|
1921
1955
|
"type": "boolean"
|
|
1922
1956
|
},
|
|
1923
|
-
"format": {
|
|
1924
|
-
"char": "f",
|
|
1925
|
-
"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.",
|
|
1926
|
-
"name": "format",
|
|
1927
|
-
"default": "table",
|
|
1928
|
-
"hasDynamicHelp": false,
|
|
1929
|
-
"multiple": false,
|
|
1930
|
-
"options": [
|
|
1931
|
-
"plain",
|
|
1932
|
-
"json",
|
|
1933
|
-
"raw",
|
|
1934
|
-
"row",
|
|
1935
|
-
"table"
|
|
1936
|
-
],
|
|
1937
|
-
"type": "option"
|
|
1938
|
-
},
|
|
1939
1957
|
"invokedFromAnotherCommand": {
|
|
1940
1958
|
"hidden": true,
|
|
1941
1959
|
"name": "invokedFromAnotherCommand",
|
|
@@ -1945,7 +1963,7 @@
|
|
|
1945
1963
|
},
|
|
1946
1964
|
"hasDynamicHelp": false,
|
|
1947
1965
|
"hiddenAliases": [],
|
|
1948
|
-
"id": "
|
|
1966
|
+
"id": "delete:version",
|
|
1949
1967
|
"pluginAlias": "zapier-platform-cli",
|
|
1950
1968
|
"pluginName": "zapier-platform-cli",
|
|
1951
1969
|
"pluginType": "core",
|
|
@@ -1957,8 +1975,8 @@
|
|
|
1957
1975
|
"src",
|
|
1958
1976
|
"oclif",
|
|
1959
1977
|
"commands",
|
|
1960
|
-
"
|
|
1961
|
-
"
|
|
1978
|
+
"delete",
|
|
1979
|
+
"version.js"
|
|
1962
1980
|
]
|
|
1963
1981
|
},
|
|
1964
1982
|
"team:add": {
|
|
@@ -2340,5 +2358,5 @@
|
|
|
2340
2358
|
]
|
|
2341
2359
|
}
|
|
2342
2360
|
},
|
|
2343
|
-
"version": "16.
|
|
2361
|
+
"version": "16.4.0"
|
|
2344
2362
|
}
|
package/package.json
CHANGED
package/src/generators/index.js
CHANGED
|
@@ -201,6 +201,7 @@ const TEMPLATE_ROUTES = {
|
|
|
201
201
|
minimal: writeForMinimalTemplate,
|
|
202
202
|
'oauth1-trello': writeForAuthTemplate,
|
|
203
203
|
oauth2: writeForAuthTemplate,
|
|
204
|
+
openai: writeForStandaloneTemplate,
|
|
204
205
|
'search-or-create': writeForStandaloneTemplate,
|
|
205
206
|
'session-auth': writeForAuthTemplate,
|
|
206
207
|
typescript: writeForStandaloneTypeScriptTemplate,
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# OpenAI
|
|
2
|
+
|
|
3
|
+
This Zapier integration project is generated by the `zapier init` CLI command. This integration in particular is using the OpenAI API to generate responses to prompts from users. For this integration, there is a `constants.js` file that will allow you to swap out the base URL and version of the API to swap if you are using an OpenAI compatible API to get started.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const { API_URL } = require('./constants');
|
|
2
|
+
// You want to make a request to an endpoint that is either specifically designed
|
|
3
|
+
// to test auth, or one that every user will have access to. eg: `/me`.
|
|
4
|
+
// By returning the entire request object, you have access to the request and
|
|
5
|
+
// response data for testing purposes. Your connection label can access any data
|
|
6
|
+
// from the returned response using the `json.` prefix. eg: `{{json.username}}`.
|
|
7
|
+
const test = (z, bundle) => z.request({ url: `${API_URL}/me` });
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
// "custom" is the catch-all auth type. The user supplies some info and Zapier can
|
|
11
|
+
// make authenticated requests with it
|
|
12
|
+
type: 'custom',
|
|
13
|
+
|
|
14
|
+
// Define any input app's auth requires here. The user will be prompted to enter
|
|
15
|
+
// this info when they connect their account.
|
|
16
|
+
fields: [
|
|
17
|
+
{
|
|
18
|
+
key: 'api_key',
|
|
19
|
+
label: 'API Key',
|
|
20
|
+
required: true,
|
|
21
|
+
helpText:
|
|
22
|
+
'Generate an API Key in your [Platform settings page](https://platform.openai.com/api-keys).',
|
|
23
|
+
},
|
|
24
|
+
// This field is optional and can be removed if not needed
|
|
25
|
+
{
|
|
26
|
+
key: 'organization_id',
|
|
27
|
+
required: false,
|
|
28
|
+
label: 'Organization ID',
|
|
29
|
+
helpText:
|
|
30
|
+
'**Optional** Only required if your OpenAI account belongs to multiple organizations. If not using OpenAI, this field will be disregarded. If your OpenAI account belongs to multiple organizations, optionally add the [Organization ID](https://platform.openai.com/account/org-settings) that this connection should use. If left blank, your [default organization](https://platform.openai.com/account/api-keys) will be used.',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
|
|
34
|
+
// The test method allows Zapier to verify that the credentials a user provides
|
|
35
|
+
// are valid. We'll execute this method whenever a user connects their account for
|
|
36
|
+
// the first time.
|
|
37
|
+
test,
|
|
38
|
+
|
|
39
|
+
// This template string can access all the data returned from the auth test. If
|
|
40
|
+
// you return the test object, you'll access the returned data with a label like
|
|
41
|
+
// `{{json.X}}`. If you return `response.data` from your test, then your label can
|
|
42
|
+
// be `{{X}}`. This can also be a function that returns a label. That function has
|
|
43
|
+
// the standard args `(z, bundle)` and data returned from the test can be accessed
|
|
44
|
+
// in `bundle.inputData.X`.
|
|
45
|
+
connectionLabel: '{{json.email}}',
|
|
46
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
const { API_URL, DEFAULT_MODEL } = require('../constants');
|
|
3
|
+
|
|
4
|
+
const sample = require('../samples/chat.json');
|
|
5
|
+
|
|
6
|
+
async function getAdvancedFields(_z, bundle) {
|
|
7
|
+
if (bundle.inputData.show_advanced === true) {
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
key: 'info_advanced',
|
|
11
|
+
type: 'copy',
|
|
12
|
+
helpText:
|
|
13
|
+
"The following fields are for advanced users and should be used with caution as they may affect performance. In most cases, the default options are sufficient. If you'd like to explore these options further, you can [learn more here](https://help.zapier.com/hc/en-us/articles/22497191078797).",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: 'developer_message',
|
|
17
|
+
label: 'Developer/System Message',
|
|
18
|
+
type: 'text',
|
|
19
|
+
helpText:
|
|
20
|
+
'Instructions to the model that are prioritized ahead of user messages, following [chain of command](https://cdn.openai.com/spec/model-spec-2024-05-08.html#follow-the-chain-of-command).',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: 'temperature',
|
|
24
|
+
label: 'Temperature',
|
|
25
|
+
type: 'number',
|
|
26
|
+
helpText:
|
|
27
|
+
'Higher values mean the model will take more risks. Try 0.9 for more creative applications, and 0 for ones with a well-defined answer.\n\nUse a decimal between 0 and 1.',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
key: 'max_completion_tokens',
|
|
31
|
+
label: 'Maximum Length',
|
|
32
|
+
type: 'integer',
|
|
33
|
+
helpText: 'The maximum number of tokens for the completion.',
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function perform(z, bundle) {
|
|
41
|
+
const {
|
|
42
|
+
user_message,
|
|
43
|
+
model,
|
|
44
|
+
files,
|
|
45
|
+
developer_message,
|
|
46
|
+
temperature,
|
|
47
|
+
max_completion_tokens,
|
|
48
|
+
} = bundle.inputData;
|
|
49
|
+
|
|
50
|
+
const developerMessage = {
|
|
51
|
+
role: 'developer',
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
type: 'text',
|
|
55
|
+
text: developer_message || 'You are a helpful assistant.',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const userMessage = {
|
|
61
|
+
role: 'user',
|
|
62
|
+
content: [
|
|
63
|
+
{
|
|
64
|
+
type: 'text',
|
|
65
|
+
text: user_message,
|
|
66
|
+
},
|
|
67
|
+
...(files
|
|
68
|
+
? files.map((file) => ({
|
|
69
|
+
type: 'image_url',
|
|
70
|
+
image_url: {
|
|
71
|
+
url: file,
|
|
72
|
+
},
|
|
73
|
+
}))
|
|
74
|
+
: []),
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const messages = [developerMessage, userMessage];
|
|
79
|
+
|
|
80
|
+
const response = await z.request({
|
|
81
|
+
url: `${API_URL}/chat/completions`,
|
|
82
|
+
method: 'POST',
|
|
83
|
+
body: JSON.stringify({
|
|
84
|
+
model,
|
|
85
|
+
messages,
|
|
86
|
+
temperature,
|
|
87
|
+
max_completion_tokens,
|
|
88
|
+
}),
|
|
89
|
+
});
|
|
90
|
+
return response.data;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
module.exports = {
|
|
94
|
+
key: 'chat_completion',
|
|
95
|
+
noun: 'Chat',
|
|
96
|
+
display: {
|
|
97
|
+
label: 'Chat Completion',
|
|
98
|
+
description: 'Sends a Chat to OpenAI and generates a Completion.',
|
|
99
|
+
},
|
|
100
|
+
operation: {
|
|
101
|
+
perform,
|
|
102
|
+
inputFields: [
|
|
103
|
+
{
|
|
104
|
+
key: 'info_data_usage',
|
|
105
|
+
type: 'copy',
|
|
106
|
+
helpText:
|
|
107
|
+
"Data sent to OpenAI through this Zap is via an API. Under OpenAI's [API data usage policy](https://openai.com/policies/api-data-usage-policies), OpenAI will not use API-submitted data to train or improve their models unless you explicitly decide to share your data with them for that purpose (such as by opting in). For more information, please review OpenAI's article about [when/how data may be used to improve model performance](https://help.openai.com/en/articles/5722486-how-your-data-is-used-to-improve-model-performance).",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
key: 'user_message',
|
|
111
|
+
label: 'User Message',
|
|
112
|
+
type: 'text',
|
|
113
|
+
helpText:
|
|
114
|
+
"Instructions that request some output from the model. Similar to messages you'd type in [ChatGPT](https://chatgpt.com) as an end user.",
|
|
115
|
+
required: true,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: 'files',
|
|
119
|
+
label: 'Images',
|
|
120
|
+
type: 'file',
|
|
121
|
+
helpText: 'Images to include along with your message.',
|
|
122
|
+
list: true,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
key: 'model',
|
|
126
|
+
label: 'Model',
|
|
127
|
+
type: 'string',
|
|
128
|
+
required: true,
|
|
129
|
+
default: DEFAULT_MODEL, // Optional to default to a specific model for most users
|
|
130
|
+
dynamic: 'list_models.id.name',
|
|
131
|
+
altersDynamicFields: false,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
key: 'show_advanced',
|
|
135
|
+
label: 'Show Advanced Options',
|
|
136
|
+
type: 'boolean',
|
|
137
|
+
default: 'false',
|
|
138
|
+
altersDynamicFields: true,
|
|
139
|
+
},
|
|
140
|
+
getAdvancedFields,
|
|
141
|
+
],
|
|
142
|
+
// Rename some of the output fields to be more descriptive for a user
|
|
143
|
+
outputFields: [
|
|
144
|
+
{ key: 'id', type: 'string', label: 'Completion ID' },
|
|
145
|
+
{ key: 'model', type: 'string', label: 'Model' },
|
|
146
|
+
{
|
|
147
|
+
key: 'usage__prompt_tokens',
|
|
148
|
+
type: 'number',
|
|
149
|
+
label: 'Usage: Prompt Tokens',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
key: 'usage__completion_tokens',
|
|
153
|
+
type: 'number',
|
|
154
|
+
label: 'Usage: Completion Tokens',
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
key: 'usage__total_tokens',
|
|
158
|
+
type: 'number',
|
|
159
|
+
label: 'Usage: Total Tokens',
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
sample,
|
|
163
|
+
},
|
|
164
|
+
};
|