zapier-platform-cli 12.2.1 → 13.0.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/README-source.md +39 -39
- package/README.md +61 -65
- package/oclif.manifest.json +1 -1
- package/package.json +25 -25
- package/scaffold/create.template.js +2 -2
- package/scaffold/resource.template.js +2 -2
- package/scaffold/search.template.js +2 -2
- package/scaffold/trigger.template.js +2 -2
- package/src/constants.js +1 -1
- package/src/generators/templates/README.template.md +1 -1
- package/src/generators/templates/callback/README.md +1 -1
- package/src/generators/templates/files/README.md +1 -1
- package/src/oclif/commands/convert.js +27 -64
- package/src/oclif/commands/promote.js +1 -1
- package/src/utils/build.js +1 -0
- package/src/version-store.js +1 -1
package/README.md
CHANGED
|
@@ -16,17 +16,17 @@ Zapier is a platform for creating integrations and workflows. This CLI is your g
|
|
|
16
16
|
|
|
17
17
|
You may find docs duplicate or outdated across the Zapier site. The most up-to-date contents are always available on GitHub:
|
|
18
18
|
|
|
19
|
-
- [Latest CLI Docs](https://github.com/zapier/zapier-platform/blob/
|
|
20
|
-
- [Latest CLI Reference](https://github.com/zapier/zapier-platform/blob/
|
|
21
|
-
- [Latest Schema Docs](https://github.com/zapier/zapier-platform/blob/
|
|
19
|
+
- [Latest CLI Docs](https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md)
|
|
20
|
+
- [Latest CLI Reference](https://github.com/zapier/zapier-platform/blob/main/packages/cli/docs/cli.md)
|
|
21
|
+
- [Latest Schema Docs](https://github.com/zapier/zapier-platform/blob/main/packages/schema/docs/build/schema.md)
|
|
22
22
|
|
|
23
|
-
Our code is updated frequently. To see a full list of changes, look no further than [the CHANGELOG](https://github.com/zapier/zapier-platform/blob/
|
|
23
|
+
Our code is updated frequently. To see a full list of changes, look no further than [the CHANGELOG](https://github.com/zapier/zapier-platform/blob/main/CHANGELOG.md).
|
|
24
24
|
|
|
25
|
-
This doc describes the latest CLI version (**
|
|
25
|
+
This doc describes the latest CLI version (**13.0.0**), as of this writing. If you're using an older version of the CLI, you may want to check out these historical releases:
|
|
26
26
|
|
|
27
|
-
- CLI Docs: [
|
|
28
|
-
- CLI Reference: [
|
|
29
|
-
- Schema Docs: [
|
|
27
|
+
- CLI Docs: [11.3.3](https://github.com/zapier/zapier-platform/blob/zapier-platform-cli@11.3.3/packages/cli/README.md), [10.2.0](https://github.com/zapier/zapier-platform/blob/zapier-platform-cli@10.2.0/packages/cli/README.md), [9.7.3](https://github.com/zapier/zapier-platform/blob/zapier-platform-cli@9.7.3/packages/cli/README.md)
|
|
28
|
+
- CLI Reference: [11.3.3](https://github.com/zapier/zapier-platform/blob/zapier-platform-cli@11.3.3/packages/cli/docs/cli.md), [10.2.0](https://github.com/zapier/zapier-platform/blob/zapier-platform-cli@10.2.0/packages/cli/docs/cli.md), [9.7.3](https://github.com/zapier/zapier-platform/blob/zapier-platform-cli@9.7.3/packages/cli/docs/cli.md)
|
|
29
|
+
- Schema Docs: [11.3.3](https://github.com/zapier/zapier-platform/blob/zapier-platform-schema@11.3.3/packages/schema/docs/build/schema.md), [10.2.0](https://github.com/zapier/zapier-platform/blob/zapier-platform-schema@10.2.0/packages/schema/docs/build/schema.md), [9.7.3](https://github.com/zapier/zapier-platform/blob/zapier-platform-schema@9.7.3/packages/schema/docs/build/schema.md)
|
|
30
30
|
|
|
31
31
|
## Table of Contents
|
|
32
32
|
|
|
@@ -157,7 +157,7 @@ This doc describes the latest CLI version (**12.2.1**), as of this writing. If y
|
|
|
157
157
|
> Note: this document uses "app" while modern Zapier nomenclature refers instead to "integrations". In both cases, the phrase refers to your code that connects your API with Zapier.
|
|
158
158
|
|
|
159
159
|
A CLI App is an implementation of your app's API. You build a Node.js application
|
|
160
|
-
that exports a single object ([JSON Schema](https://github.com/zapier/zapier-platform/blob/
|
|
160
|
+
that exports a single object ([JSON Schema](https://github.com/zapier/zapier-platform/blob/main/packages/schema/docs/build/schema.md#appschema)) and upload it to Zapier.
|
|
161
161
|
Zapier introspects that definition to find out what your app is capable of and
|
|
162
162
|
what options to present end users in the Zap Editor.
|
|
163
163
|
|
|
@@ -186,15 +186,15 @@ Zapier Platform CLI is designed to be used by development teams who collaborate
|
|
|
186
186
|
|
|
187
187
|
### Requirements
|
|
188
188
|
|
|
189
|
-
All Zapier CLI apps are run using Node.js `
|
|
189
|
+
All Zapier CLI apps are run using Node.js `v16`.
|
|
190
190
|
|
|
191
|
-
You can develop using any version of Node you'd like, but your eventual code must be compatible with `
|
|
191
|
+
You can develop using any version of Node you'd like, but your eventual code must be compatible with `v16`. If you're using features not yet available in `v16`, you can transpile your code to a compatible format with [Babel](https://babeljs.io/) (or similar).
|
|
192
192
|
|
|
193
|
-
To ensure stability for our users, we strongly encourage you run tests on `
|
|
193
|
+
To ensure stability for our users, we strongly encourage you run tests on `v16` sometime before your code reaches users. This can be done multiple ways.
|
|
194
194
|
|
|
195
|
-
Firstly, by using a CI tool (like [Travis CI](https://travis-ci.org/) or [Circle CI](https://circleci.com/), which are free for open source projects). We provide a sample [.travis.yml](https://github.com/zapier/zapier-platform/blob/
|
|
195
|
+
Firstly, by using a CI tool (like [Travis CI](https://travis-ci.org/) or [Circle CI](https://circleci.com/), which are free for open source projects). We provide a sample [.travis.yml](https://github.com/zapier/zapier-platform/blob/main/example-apps/trigger/.travis.yml) file in our template apps to get you started.
|
|
196
196
|
|
|
197
|
-
Alternatively, you can change your local node version with tools such as [nvm](https://github.com/nvm-sh/nvm#installation-and-update). Then you can either swap to that version with `nvm use
|
|
197
|
+
Alternatively, you can change your local node version with tools such as [nvm](https://github.com/nvm-sh/nvm#installation-and-update). Then you can either swap to that version with `nvm use v16`, or do `nvm exec v16 zapier test` so you can run tests without having to switch versions while developing.
|
|
198
198
|
|
|
199
199
|
|
|
200
200
|
### Quick Setup Guide
|
|
@@ -223,7 +223,7 @@ cd example-app
|
|
|
223
223
|
npm install
|
|
224
224
|
```
|
|
225
225
|
|
|
226
|
-
> Note: When you run `zapier init`, you'll be presented with a list of templates to start with. Pick the one that matches a feature you'll need (such as "dynamic-dropdown" for an integration with [dynamic dropdown fields](#dynamic-dropdowns)), or select "minimal" for an integration with only the essentials. [View more example apps here](https://github.com/zapier/zapier-platform/tree/
|
|
226
|
+
> Note: When you run `zapier init`, you'll be presented with a list of templates to start with. Pick the one that matches a feature you'll need (such as "dynamic-dropdown" for an integration with [dynamic dropdown fields](#dynamic-dropdowns)), or select "minimal" for an integration with only the essentials. [View more example apps here](https://github.com/zapier/zapier-platform/tree/main/example-apps).
|
|
227
227
|
|
|
228
228
|
You should now have a working local app. You can run several local commands to try it out.
|
|
229
229
|
|
|
@@ -452,7 +452,7 @@ When a user authenticates to your application through Zapier, a "connection" is
|
|
|
452
452
|
|
|
453
453
|
Useful if your app requires two pieces of information to authenticate: `username` and `password`, which only the end user can provide. By default, Zapier will do the standard Basic authentication base64 header encoding for you (via an automatically registered middleware).
|
|
454
454
|
|
|
455
|
-
> To create a new integration with basic authentication, run `zapier init [your app name] --template basic-auth`. You can also review an example of that code [here](https://github.com/zapier/zapier-platform/tree/
|
|
455
|
+
> To create a new integration with basic authentication, run `zapier init [your app name] --template basic-auth`. You can also review an example of that code [here](https://github.com/zapier/zapier-platform/tree/main/example-apps/basic-auth).
|
|
456
456
|
|
|
457
457
|
If your app uses Basic auth with an encoded API key rather than a username and password, like `Authorization: Basic APIKEYHERE:x`, consider the [Custom](#custom) authentication method instead.
|
|
458
458
|
|
|
@@ -469,7 +469,7 @@ const authentication = {
|
|
|
469
469
|
|
|
470
470
|
const App = {
|
|
471
471
|
// ...
|
|
472
|
-
authentication
|
|
472
|
+
authentication,
|
|
473
473
|
// ...
|
|
474
474
|
};
|
|
475
475
|
|
|
@@ -481,7 +481,7 @@ const App = {
|
|
|
481
481
|
|
|
482
482
|
The setup and user experience of Digest Auth is identical to Basic Auth. Users provide Zapier their username and password, and Zapier handles all the nonce and quality of protection details automatically.
|
|
483
483
|
|
|
484
|
-
> To create a new integration with digest authentication, run `zapier init [your app name] --template digest-auth`. You can also review an example of that code [here](https://github.com/zapier/zapier-platform/tree/
|
|
484
|
+
> To create a new integration with digest authentication, run `zapier init [your app name] --template digest-auth`. You can also review an example of that code [here](https://github.com/zapier/zapier-platform/tree/main/example-apps/digest-auth).
|
|
485
485
|
|
|
486
486
|
> Limitation: Currently, MD5-sess and SHA are not implemented. Only the MD5 algorithm is supported. In addition, server nonces are not reused. That means for every `z.request` call, Zapier will send an additional request beforehand to get the server nonce.
|
|
487
487
|
|
|
@@ -504,7 +504,7 @@ const authentication = {
|
|
|
504
504
|
|
|
505
505
|
const App = {
|
|
506
506
|
// ...
|
|
507
|
-
authentication
|
|
507
|
+
authentication,
|
|
508
508
|
// ...
|
|
509
509
|
};
|
|
510
510
|
|
|
@@ -514,15 +514,14 @@ const App = {
|
|
|
514
514
|
|
|
515
515
|
Custom auth is most commonly used for apps that authenticate with API keys, although it also provides flexibility for any unusual authentication setup. You'll likely provide some custom `beforeRequest` middleware or a `requestTemplate` (see [Making HTTP Requests](#making-http-requests)) to pass in data returned from the authentication process, most commonly by adding/computing needed headers.
|
|
516
516
|
|
|
517
|
-
> To create a new integration with custom authentication, run `zapier init [your app name] --template custom-auth`. You can also review an example of that code [here](https://github.com/zapier/zapier-platform/tree/
|
|
517
|
+
> To create a new integration with custom authentication, run `zapier init [your app name] --template custom-auth`. You can also review an example of that code [here](https://github.com/zapier/zapier-platform/tree/main/example-apps/custom-auth).
|
|
518
518
|
|
|
519
519
|
```js
|
|
520
520
|
const authentication = {
|
|
521
521
|
type: 'custom',
|
|
522
522
|
// "test" could also be a function
|
|
523
523
|
test: {
|
|
524
|
-
url:
|
|
525
|
-
'https://{{bundle.authData.subdomain}}.example.com/api/accounts/me.json',
|
|
524
|
+
url: 'https://{{bundle.authData.subdomain}}.example.com/api/accounts/me.json',
|
|
526
525
|
},
|
|
527
526
|
fields: [
|
|
528
527
|
{
|
|
@@ -551,7 +550,7 @@ const addApiKeyToHeader = (request, z, bundle) => {
|
|
|
551
550
|
|
|
552
551
|
const App = {
|
|
553
552
|
// ...
|
|
554
|
-
authentication
|
|
553
|
+
authentication,
|
|
555
554
|
beforeRequest: [addApiKeyToHeader],
|
|
556
555
|
// ...
|
|
557
556
|
};
|
|
@@ -562,7 +561,7 @@ const App = {
|
|
|
562
561
|
|
|
563
562
|
Session auth gives you the ability to exchange some user-provided data for some authentication data; for example, username and password for a session key. It can be used to implement almost any authentication method that uses that pattern - for example, alternative OAuth flows.
|
|
564
563
|
|
|
565
|
-
> To create a new integration with session authentication, run `zapier init [your app name] --template session-auth`. You can also review an example of that code [here](https://github.com/zapier/zapier-platform/tree/
|
|
564
|
+
> To create a new integration with session authentication, run `zapier init [your app name] --template session-auth`. You can also review an example of that code [here](https://github.com/zapier/zapier-platform/tree/main/example-apps/session-auth).
|
|
566
565
|
|
|
567
566
|
```js
|
|
568
567
|
const getSessionKey = async (z, bundle) => {
|
|
@@ -623,7 +622,7 @@ const includeSessionKeyHeader = (request, z, bundle) => {
|
|
|
623
622
|
|
|
624
623
|
const App = {
|
|
625
624
|
// ...
|
|
626
|
-
authentication
|
|
625
|
+
authentication,
|
|
627
626
|
beforeRequest: [includeSessionKeyHeader],
|
|
628
627
|
// ...
|
|
629
628
|
};
|
|
@@ -638,7 +637,7 @@ For Session auth, the function that fetches the additional authentication data n
|
|
|
638
637
|
|
|
639
638
|
Zapier's OAuth1 implementation matches [Twitter](https://developer.twitter.com/en/docs/tutorials/authenticating-with-twitter-api-for-enterprise/authentication-method-overview#oauth1.0a) and [Trello](https://developer.atlassian.com/cloud/trello/guides/rest-api/authorization/#using-basic-oauth) implementations of the 3-legged OAuth flow.
|
|
640
639
|
|
|
641
|
-
> To create a new integration with OAuth1, run `zapier init [your app name] --template oauth1-trello`. You can also check out [oauth1-trello](https://github.com/zapier/zapier-platform/tree/
|
|
640
|
+
> To create a new integration with OAuth1, run `zapier init [your app name] --template oauth1-trello`. You can also check out [oauth1-trello](https://github.com/zapier/zapier-platform/tree/main/example-apps/oauth1-trello), [oauth1-tumblr](https://github.com/zapier/zapier-platform/tree/main/example-apps/oauth1-tumblr), and [oauth1-twitter](https://github.com/zapier/zapier-platform/tree/main/example-apps/oauth1-twitter) for working example apps with OAuth1.
|
|
642
641
|
|
|
643
642
|
The flow works like this:
|
|
644
643
|
|
|
@@ -741,7 +740,7 @@ const includeAccessToken = (req, z, bundle) => {
|
|
|
741
740
|
|
|
742
741
|
const App = {
|
|
743
742
|
// ...
|
|
744
|
-
authentication
|
|
743
|
+
authentication,
|
|
745
744
|
beforeRequest: [includeAccessToken],
|
|
746
745
|
// ...
|
|
747
746
|
};
|
|
@@ -758,7 +757,7 @@ Also, `authentication.oauth1Config.getAccessToken` has access to the additional
|
|
|
758
757
|
|
|
759
758
|
Zapier's OAuth2 implementation is based on the `authorization_code` flow, similar to [GitHub](https://developer.github.com/v3/oauth/) and [Facebook](https://developers.facebook.com/docs/authentication/server-side/).
|
|
760
759
|
|
|
761
|
-
> To create a new integration with OAuth2, run `zapier init [your app name] --template oauth2`. You can also check out [our working example app](https://github.com/zapier/zapier-platform/tree/
|
|
760
|
+
> To create a new integration with OAuth2, run `zapier init [your app name] --template oauth2`. You can also check out [our working example app](https://github.com/zapier/zapier-platform/tree/main/example-apps/oauth2).
|
|
762
761
|
|
|
763
762
|
If your app's OAuth2 flow uses a different grant type, such as `client_credentials`, try using [Session auth](#session) instead.
|
|
764
763
|
|
|
@@ -794,16 +793,14 @@ Your auth definition would look something like this:
|
|
|
794
793
|
const authentication = {
|
|
795
794
|
type: 'oauth2',
|
|
796
795
|
test: {
|
|
797
|
-
url:
|
|
798
|
-
'https://{{bundle.authData.subdomain}}.example.com/api/accounts/me.json',
|
|
796
|
+
url: 'https://{{bundle.authData.subdomain}}.example.com/api/accounts/me.json',
|
|
799
797
|
},
|
|
800
798
|
// you can provide additional fields for inclusion in authData
|
|
801
799
|
oauth2Config: {
|
|
802
800
|
// "authorizeUrl" could also be a function returning a string url
|
|
803
801
|
authorizeUrl: {
|
|
804
802
|
method: 'GET',
|
|
805
|
-
url:
|
|
806
|
-
'https://{{bundle.inputData.subdomain}}.example.com/api/oauth2/authorize',
|
|
803
|
+
url: 'https://{{bundle.inputData.subdomain}}.example.com/api/oauth2/authorize',
|
|
807
804
|
params: {
|
|
808
805
|
client_id: '{{process.env.CLIENT_ID}}',
|
|
809
806
|
state: '{{bundle.inputData.state}}',
|
|
@@ -815,8 +812,7 @@ const authentication = {
|
|
|
815
812
|
// "getAccessToken" could also be a function returning an object
|
|
816
813
|
getAccessToken: {
|
|
817
814
|
method: 'POST',
|
|
818
|
-
url:
|
|
819
|
-
'https://{{bundle.inputData.subdomain}}.example.com/api/v2/oauth2/token',
|
|
815
|
+
url: 'https://{{bundle.inputData.subdomain}}.example.com/api/v2/oauth2/token',
|
|
820
816
|
body: {
|
|
821
817
|
code: '{{bundle.inputData.code}}',
|
|
822
818
|
client_id: '{{process.env.CLIENT_ID}}',
|
|
@@ -850,7 +846,7 @@ const addBearerHeader = (request, z, bundle) => {
|
|
|
850
846
|
|
|
851
847
|
const App = {
|
|
852
848
|
// ...
|
|
853
|
-
authentication
|
|
849
|
+
authentication,
|
|
854
850
|
beforeRequest: [addBearerHeader],
|
|
855
851
|
// ...
|
|
856
852
|
};
|
|
@@ -915,10 +911,10 @@ This will generate the resource file and add the necessary statements to the `in
|
|
|
915
911
|
A resource has a few basic properties. The first is the `key`, which allows Zapier to identify the resource on our backend.
|
|
916
912
|
The second is the `noun`, the user-friendly name of the resource that is presented to users throughout the Zapier UI.
|
|
917
913
|
|
|
918
|
-
> Check out [this working example app](https://github.com/zapier/zapier-platform/tree/
|
|
914
|
+
> Check out [this working example app](https://github.com/zapier/zapier-platform/tree/main/example-apps/resource) to see resources in action.
|
|
919
915
|
|
|
920
916
|
After those, there is a set of optional properties that tell Zapier what methods can be performed on the resource.
|
|
921
|
-
The complete list of available methods can be found in the [Resource Schema Docs](https://github.com/zapier/zapier-platform/blob/
|
|
917
|
+
The complete list of available methods can be found in the [Resource Schema Docs](https://github.com/zapier/zapier-platform/blob/main/packages/schema/docs/build/schema.md#resourceschema).
|
|
922
918
|
For now, let's focus on two:
|
|
923
919
|
|
|
924
920
|
* `list` - Tells Zapier how to fetch a set of this resource. This becomes a Trigger in the Zapier Editor.
|
|
@@ -945,7 +941,7 @@ const Recipe = {
|
|
|
945
941
|
|
|
946
942
|
```
|
|
947
943
|
|
|
948
|
-
The method is made up of two properties, a `display` and an `operation`. The `display` property ([schema](https://github.com/zapier/zapier-platform/blob/
|
|
944
|
+
The method is made up of two properties, a `display` and an `operation`. The `display` property ([schema](https://github.com/zapier/zapier-platform/blob/main/packages/schema/docs/build/schema.md#basicdisplayschema)) holds the info needed to present the method as an available Trigger in the Zapier Editor. The `operation` ([schema](https://github.com/zapier/zapier-platform/blob/main/packages/schema/docs/build/schema.md#resourceschema)) provides the implementation to make the API call.
|
|
949
945
|
|
|
950
946
|
Adding a create method looks very similar.
|
|
951
947
|
|
|
@@ -1017,10 +1013,10 @@ const App = {
|
|
|
1017
1013
|
|
|
1018
1014
|
```
|
|
1019
1015
|
|
|
1020
|
-
You can find more details on the definition for each by looking at the [Trigger Schema](https://github.com/zapier/zapier-platform/blob/
|
|
1021
|
-
[Search Schema](https://github.com/zapier/zapier-platform/blob/
|
|
1016
|
+
You can find more details on the definition for each by looking at the [Trigger Schema](https://github.com/zapier/zapier-platform/blob/main/packages/schema/docs/build/schema.md#triggerschema),
|
|
1017
|
+
[Search Schema](https://github.com/zapier/zapier-platform/blob/main/packages/schema/docs/build/schema.md#searchschema), and [Create Schema](https://github.com/zapier/zapier-platform/blob/main/packages/schema/docs/build/schema.md#createschema).
|
|
1022
1018
|
|
|
1023
|
-
> To create a new integration with a premade trigger, search, or create, run `zapier init [your app name]` and select from the list that appears. You can also check out our working example apps [here](https://github.com/zapier/zapier-platform/tree/
|
|
1019
|
+
> To create a new integration with a premade trigger, search, or create, run `zapier init [your app name]` and select from the list that appears. You can also check out our working example apps [here](https://github.com/zapier/zapier-platform/tree/main/example-apps).
|
|
1024
1020
|
|
|
1025
1021
|
> To add a trigger, search, or create to an existing integration, run `zapier scaffold [trigger|search|create] [noun]` to create the necessary files to your project. For example, `zapier scaffold trigger post` will create a new trigger called "New Post".
|
|
1026
1022
|
### Return Types
|
|
@@ -1099,7 +1095,7 @@ Notably, fields come in different types, which may look and act differently in t
|
|
|
1099
1095
|
| `password` | Displays entered characters as hidden, accepts text input. Does not accept input from previous steps. |
|
|
1100
1096
|
| `copy` | Does not allow users enter data. Shows the value of the Markdown-formatted Help Text for the field as a rich text note in the Zap editor. Good for important notices to users. |
|
|
1101
1097
|
|
|
1102
|
-
You can find more details on the different field schema options at [our Field Schema](https://github.com/zapier/zapier-platform/blob/
|
|
1098
|
+
You can find more details on the different field schema options at [our Field Schema](https://github.com/zapier/zapier-platform/blob/main/packages/schema/docs/build/schema.md#fieldschema).
|
|
1103
1099
|
|
|
1104
1100
|
### Custom/Dynamic Fields
|
|
1105
1101
|
|
|
@@ -1494,7 +1490,7 @@ You can see examples of computed fields in the [OAuth2](#oauth2) or [Session Aut
|
|
|
1494
1490
|
|
|
1495
1491
|
### Nested & Children (Line Item) Fields
|
|
1496
1492
|
|
|
1497
|
-
When your action needs to accept an array of items, you can include an input field with the `children` attribute. The `children` attribute accepts a list of [fields](https://github.com/zapier/zapier-platform/blob/
|
|
1493
|
+
When your action needs to accept an array of items, you can include an input field with the `children` attribute. The `children` attribute accepts a list of [fields](https://github.com/zapier/zapier-platform/blob/main/packages/schema/docs/build/schema.md#fieldschema) that can be input for each item in this array.
|
|
1498
1494
|
|
|
1499
1495
|
```js
|
|
1500
1496
|
const App = {
|
|
@@ -1540,7 +1536,7 @@ Output Fields are optional, but can be used to:
|
|
|
1540
1536
|
- Define friendly labels for the returned fields. By default, we will *humanize* for example `my_key` as *My Key*.
|
|
1541
1537
|
- Make sure that custom fields that may not be found in every live sample and - since they're custom to the connected account - cannot be defined in the static sample, can still be mapped.
|
|
1542
1538
|
|
|
1543
|
-
The [schema](https://github.com/zapier/zapier-platform/blob/
|
|
1539
|
+
The [schema](https://github.com/zapier/zapier-platform/blob/main/packages/schema/docs/build/schema.md#fieldschema) for `outputFields` is shared with `inputFields` but only the `key` and `required` properties are relevant.
|
|
1544
1540
|
|
|
1545
1541
|
Custom/Dynamic Output Fields are defined in the same way as [Custom/Dynamic Input Fields](#customdynamic-fields).
|
|
1546
1542
|
|
|
@@ -1896,7 +1892,7 @@ module.exports = {
|
|
|
1896
1892
|
};
|
|
1897
1893
|
```
|
|
1898
1894
|
|
|
1899
|
-
Read more in the [REST hook example](https://github.com/zapier/zapier-platform/blob/
|
|
1895
|
+
Read more in the [REST hook example](https://github.com/zapier/zapier-platform/blob/main/example-apps/rest-hooks/triggers/recipe.js).
|
|
1900
1896
|
|
|
1901
1897
|
### `bundle.subscribeData`
|
|
1902
1898
|
|
|
@@ -1904,7 +1900,7 @@ Read more in the [REST hook example](https://github.com/zapier/zapier-platform/b
|
|
|
1904
1900
|
|
|
1905
1901
|
This is an object that contains the data you returned from the `performSubscribe` function. It should contain whatever information you need send a `DELETE` request to your server to stop sending webhooks to Zapier.
|
|
1906
1902
|
|
|
1907
|
-
Read more in the [REST hook example](https://github.com/zapier/zapier-platform/blob/
|
|
1903
|
+
Read more in the [REST hook example](https://github.com/zapier/zapier-platform/blob/main/example-apps/rest-hooks/triggers/recipe.js).
|
|
1908
1904
|
|
|
1909
1905
|
## Environment
|
|
1910
1906
|
|
|
@@ -2212,7 +2208,7 @@ Here is the full request lifecycle when you call `z.request({...})`:
|
|
|
2212
2208
|
|
|
2213
2209
|
The resulting response object is returned from `z.request()`.
|
|
2214
2210
|
|
|
2215
|
-
> Example App: check out https://github.com/zapier/zapier-platform/tree/
|
|
2211
|
+
> Example App: check out https://github.com/zapier/zapier-platform/tree/main/example-apps/middleware for a working example app using HTTP middleware.
|
|
2216
2212
|
|
|
2217
2213
|
#### Error Response Handling
|
|
2218
2214
|
|
|
@@ -2259,7 +2255,7 @@ This behavior has changed periodically across major versions, which changes how/
|
|
|
2259
2255
|
|
|
2260
2256
|

|
|
2261
2257
|
|
|
2262
|
-
Ensure you're handling errors correctly for your platform version. The latest released version is **
|
|
2258
|
+
Ensure you're handling errors correctly for your platform version. The latest released version is **13.0.0**.
|
|
2263
2259
|
|
|
2264
2260
|
### HTTP Request Options
|
|
2265
2261
|
|
|
@@ -2402,7 +2398,7 @@ const App = {
|
|
|
2402
2398
|
// don't forget to register hydrators here!
|
|
2403
2399
|
// it can be imported from any module
|
|
2404
2400
|
hydrators: {
|
|
2405
|
-
getMovieDetails
|
|
2401
|
+
getMovieDetails,
|
|
2406
2402
|
},
|
|
2407
2403
|
|
|
2408
2404
|
triggers: {
|
|
@@ -2544,7 +2540,7 @@ module.exports = App;
|
|
|
2544
2540
|
|
|
2545
2541
|
```
|
|
2546
2542
|
|
|
2547
|
-
> To create a new integration for handling files, run `zapier init [your app name] --template files`. You can also check out our working example app [here](https://github.com/zapier/zapier-platform/tree/
|
|
2543
|
+
> To create a new integration for handling files, run `zapier init [your app name] --template files`. You can also check out our working example app [here](https://github.com/zapier/zapier-platform/tree/main/example-apps/files).
|
|
2548
2544
|
|
|
2549
2545
|
|
|
2550
2546
|
## Logging
|
|
@@ -2914,7 +2910,7 @@ This makes it straightforward to integrate into your testing interface. For exam
|
|
|
2914
2910
|
```yaml
|
|
2915
2911
|
language: node_js
|
|
2916
2912
|
node_js:
|
|
2917
|
-
- "
|
|
2913
|
+
- "v16"
|
|
2918
2914
|
before_script: npm install -g zapier-platform-cli
|
|
2919
2915
|
script: CLIENT_ID=1234 CLIENT_SECRET=abcd zapier test
|
|
2920
2916
|
```
|
|
@@ -3097,17 +3093,17 @@ zapier push
|
|
|
3097
3093
|
|
|
3098
3094
|
There are a lot of details left out - check out the full example app for a working setup.
|
|
3099
3095
|
|
|
3100
|
-
> To create a new integration with Babel, run `zapier init [your app name] --template babel`. You can also check out our working example app [here](https://github.com/zapier/zapier-platform/tree/
|
|
3096
|
+
> To create a new integration with Babel, run `zapier init [your app name] --template babel`. You can also check out our working example app [here](https://github.com/zapier/zapier-platform/tree/main/example-apps/babel).
|
|
3101
3097
|
|
|
3102
3098
|
## FAQs
|
|
3103
3099
|
|
|
3104
3100
|
### Why doesn't Zapier support newer versions of Node.js?
|
|
3105
3101
|
|
|
3106
|
-
We run your code on AWS Lambda, which only supports a few [versions](https://docs.aws.amazon.com/lambda/latest/dg/programming-model.html) of Node
|
|
3102
|
+
We run your code on AWS Lambda, which only supports a few [versions](https://docs.aws.amazon.com/lambda/latest/dg/programming-model.html) of Node. Sometimes that doesn't include the latest version. Additionally, with thousands of apps running on the Zapier platform, we have to be sure upgrading to the latest Node version will not have a negative impact.
|
|
3107
3103
|
|
|
3108
3104
|
### How do I manually set the Node.js version to run my app with?
|
|
3109
3105
|
|
|
3110
|
-
Update your `zapier-platform-core` dependency in `package.json`. Each major version ties to a specific version of Node.js. You can find the mapping [here](https://github.com/zapier/zapier-platform/blob/
|
|
3106
|
+
Update your `zapier-platform-core` dependency in `package.json`. Each major version ties to a specific version of Node.js. You can find the mapping [here](https://github.com/zapier/zapier-platform/blob/main/packages/cli/src/version-store.js). We only support the version(s) supported by [AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/programming-model.html).
|
|
3111
3107
|
|
|
3112
3108
|
**IMPORTANT CAVEAT**: AWS periodically deprecates Node versions as they reach EOL. They announce this[on their blog](https://aws.amazon.com/blogs/developer/node-js-6-is-approaching-end-of-life-upgrade-your-aws-lambda-functions-to-the-node-js-10-lts/). Similar info and dates are available on [github](https://github.com/nodejs/Release). Well before this date, we'll have a version of `core` that targets the newer Node version.
|
|
3113
3109
|
|
|
@@ -3310,7 +3306,7 @@ const performWithoutAsync = (z, bundle) => {
|
|
|
3310
3306
|
return z.request(
|
|
3311
3307
|
'https://5ae7ad3547436a00143e104d.mockapi.io/api/recipes',
|
|
3312
3308
|
{
|
|
3313
|
-
params: { cursor
|
|
3309
|
+
params: { cursor }, // if cursor is null, it's ignored here
|
|
3314
3310
|
}
|
|
3315
3311
|
);
|
|
3316
3312
|
})
|
|
@@ -3336,7 +3332,7 @@ const performWithAsync = async (z, bundle) => {
|
|
|
3336
3332
|
{
|
|
3337
3333
|
// if cursor is null, it's sent as an empty query
|
|
3338
3334
|
// param and should be ignored by the server
|
|
3339
|
-
params: { cursor
|
|
3335
|
+
params: { cursor },
|
|
3340
3336
|
}
|
|
3341
3337
|
);
|
|
3342
3338
|
|
|
@@ -3350,7 +3346,7 @@ const performWithAsync = async (z, bundle) => {
|
|
|
3350
3346
|
|
|
3351
3347
|
Cursors are stored per-zap and last about an hour. Per the above, make sure to only include the cursor if `bundle.meta.page !== 0`, so you don't accidentally reuse a cursor from a previous poll.
|
|
3352
3348
|
|
|
3353
|
-
Lastly, you need to set `canPaginate` to `true` in your polling definition (per the [schema](https://github.com/zapier/zapier-platform/blob/
|
|
3349
|
+
Lastly, you need to set `canPaginate` to `true` in your polling definition (per the [schema](https://github.com/zapier/zapier-platform/blob/main/packages/schema/docs/build/schema.md#basicpollingoperationschema)) for the `z.cursor` methods to work as expected.
|
|
3354
3350
|
|
|
3355
3351
|
<a id="dedup"></a>
|
|
3356
3352
|
### How does deduplication work?
|
|
@@ -3384,9 +3380,9 @@ InvalidParameterValueException An error occurred (InvalidParameterValueException
|
|
|
3384
3380
|
|
|
3385
3381
|
... then you need to update your `zapier-platform-core` dependency to a non-deprecated version that uses a newer version of Node.js. Complete the following instructions as soon as possible:
|
|
3386
3382
|
|
|
3387
|
-
1. Edit `package.json` to depend on a later major version of `zapier-platform-core`. There's a list of all breaking changes (marked with a :exclamation:) in the [changelog](https://github.com/zapier/zapier-platform/blob/
|
|
3383
|
+
1. Edit `package.json` to depend on a later major version of `zapier-platform-core`. There's a list of all breaking changes (marked with a :exclamation:) in the [changelog](https://github.com/zapier/zapier-platform/blob/main/CHANGELOG.md).
|
|
3388
3384
|
2. Increment the `version` property in `package.json`
|
|
3389
|
-
3. Ensure you're using version `
|
|
3385
|
+
3. Ensure you're using version `v16` (or greater) of node locally (`node -v`). Use [nvm](https://github.com/nvm-sh/nvm) to use a different one if need be.
|
|
3390
3386
|
4. Run `rm -rf node_modules && npm i` to get a fresh copy of everything
|
|
3391
3387
|
5. Run `zapier test` to ensure your tests still pass
|
|
3392
3388
|
6. Run `zapier push`
|
|
@@ -3437,9 +3433,9 @@ Follow those instructions to enable completion for `zapier` commands and flags!
|
|
|
3437
3433
|
|
|
3438
3434
|
The Zapier Platform consists of 3 npm packages that are released simultaneously.
|
|
3439
3435
|
|
|
3440
|
-
- [`zapier-platform-cli`](https://github.com/zapier/zapier-platform/tree/
|
|
3441
|
-
- [`zapier-platform-core`](https://github.com/zapier/zapier-platform/tree/
|
|
3442
|
-
- [`zapier-platform-schema`](https://github.com/zapier/zapier-platform/tree/
|
|
3436
|
+
- [`zapier-platform-cli`](https://github.com/zapier/zapier-platform/tree/main/packages/cli) is the code that powers the `zapier` command. You use it most commonly with the `test`, `scaffold`, and `push` commands. It's installed with `npm install -g zapier-platform-cli` and does not correspond to a particular app.
|
|
3437
|
+
- [`zapier-platform-core`](https://github.com/zapier/zapier-platform/tree/main/packages/core) is what allows your app to interact with Zapier. It holds the `z` object and app tester code. Your app depends on a specific version of `zapier-platform-core` in the `package.json` file. It's installed via `npm install` along with the rest of your app's dependencies.
|
|
3438
|
+
- [`zapier-platform-schema`](https://github.com/zapier/zapier-platform/tree/main/packages/schema) enforces app structure behind the scenes. It's a dependency of `core`, so it will be installed automatically.
|
|
3443
3439
|
|
|
3444
3440
|
To learn more about the structure of the code (especially if you're interested in contributing), check out the `ARCHITECTURE.md` file(s).
|
|
3445
3441
|
|
|
@@ -3447,12 +3443,12 @@ To learn more about the structure of the code (especially if you're interested i
|
|
|
3447
3443
|
|
|
3448
3444
|
The Zapier platform and its tools are under active development. While you don't need to install every release, we release new versions because they are better than the last. We do our best to adhere to [Semantic Versioning](https://semver.org/) wherein we won't break your code unless there's a `major` release. Otherwise, we're just fixing bugs (`patch`) and adding features (`minor`).
|
|
3449
3445
|
|
|
3450
|
-
Broadly speaking, all releases will continue to work indefinitely. While you never *have* to upgrade your app's `zapier-platform-core` dependency, we recommend keeping an eye on the [changelog](https://github.com/zapier/zapier-platform/blob/
|
|
3446
|
+
Broadly speaking, all releases will continue to work indefinitely. While you never *have* to upgrade your app's `zapier-platform-core` dependency, we recommend keeping an eye on the [changelog](https://github.com/zapier/zapier-platform/blob/main/CHANGELOG.md) to see what new features and bug fixes are available.
|
|
3451
3447
|
|
|
3452
3448
|
For more info about which Node versions are supported, see [the faq](#how-do-i-manually-set-the-nodejs-version-to-run-my-app-with).
|
|
3453
3449
|
|
|
3454
3450
|
<!-- TODO: if we decouple releases, change this -->
|
|
3455
|
-
The most recently released version of `cli` and `core` is **
|
|
3451
|
+
The most recently released version of `cli` and `core` is **13.0.0**. You can see the versions you're working with by running `zapier -v`.
|
|
3456
3452
|
|
|
3457
3453
|
To update `cli`, run `npm install -g zapier-platform-cli`.
|
|
3458
3454
|
|
|
@@ -3468,4 +3464,4 @@ You can get help by either emailing `partners@zapier.com` or by [joining our dev
|
|
|
3468
3464
|
|
|
3469
3465
|
## Developing on the CLI
|
|
3470
3466
|
|
|
3471
|
-
See [CONTRIBUTING.md](https://github.com/zapier/zapier-platform/blob/
|
|
3467
|
+
See [CONTRIBUTING.md](https://github.com/zapier/zapier-platform/blob/main/CONTRIBUTING.md).
|