Milestone 0: import zappier billing, Verae middleware, and Zapier research

Compose-ready workspace: packages/zappier (rate card, portal, Stripe),
packages/verae-zapier-middleware (timestamp + NATS), packages/verae-zapier
(CLI app), vendor/zapier-platform, and research/zapier vendor corpus.

Gate 0 structure checks pass. Product code and research are not yet wired.
This commit is contained in:
George Lambert 2026-09-09 02:37:36 -04:00
commit b4150c8250
1364 changed files with 6814366 additions and 0 deletions

View file

@ -0,0 +1,13 @@
{
"presets": [
[
"env",
{
"targets": {
"node": 6
}
}
]
],
"plugins": ["transform-regenerator", "add-module-exports"]
}

View file

@ -0,0 +1,7 @@
build
docs
node_modules
*.log
.environment
lib
.env

View file

@ -0,0 +1,7 @@
language: node_js
node_js:
- 8.10.0
before_script: 'npm install -g zapier-platform-cli && zapier build'
script: 'zapier test'
notifications:
email: false

View file

@ -0,0 +1,16 @@
# "Babel" Example App For Zapier Platform
[![Build Status](https://travis-ci.org/zapier/zapier-platform-example-app-babel.svg?branch=main)](https://travis-ci.org/zapier/zapier-platform-example-app-babel)
A barebones app that has a resource defined. This is mainly a proof-of-concept for using features not yet available in node v12.x.
Run this:
```bash
npm run zapier-dev # compiles live
zapier-platform test
```
`zapier-platform build` works as a non-watch command that calls the `npm run _zapier-build` hook, and `zapier-platform push` will make a fresh build using that hook as well.
> We recommend using the zapier-platform-cli and `zapier-platform init .`  to create an app - youll be presented with a list of currently available templates to start with.

View file

@ -0,0 +1,3 @@
global._babelPolyfill || require('babel-polyfill');
module.exports = require('./lib');

View file

@ -0,0 +1,37 @@
{
"name": "zapier-platform-example-app-babel",
"version": "1.0.0",
"description": "An example app for the Zapier platform.",
"repository": "zapier/zapier-platform-example-app-babel",
"homepage": "https://zapier.com/",
"author": "Bryan Helmig <bryan@zapier.com>",
"license": "BSD-3-Clause",
"main": "index.js",
"scripts": {
"zapier-build": "rm -rf lib && babel src --out-dir lib",
"zapier-dev": "rm -rf lib && babel src --out-dir lib --watch",
"prepare": "npm run zapier-build",
"pretest": "npm run zapier-build",
"test": "mocha --recursive lib/test --require babel-polyfill",
"_zapier-build": "npm run zapier-build"
},
"engines": {
"node": ">=8.10.0",
"npm": ">=5.6.0"
},
"dependencies": {
"babel-polyfill": "6.26.0",
"zapier-platform-core": "19.1.0"
},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-core": "6.26.0",
"babel-eslint": "8.2.3",
"babel-plugin-add-module-exports": "0.2.1",
"babel-plugin-transform-regenerator": "6.26.0",
"babel-preset-env": "1.6.1",
"mocha": "^5.2.0",
"should": "^13.2.1"
},
"private": true
}

View file

@ -0,0 +1,21 @@
const test = async (z /*, bundle */) => {
// Normally you want to make a request to an endpoint that is either specifically designed to test auth, or one that
// every user will have access to, such as an account or profile endpoint like /me.
// In this example, we'll hit httpbin, which validates the Authorization Header against the arguments passed in the URL path
const response = await z.request({
url: 'https://auth-json-server.zapier-staging.com/me',
});
return response;
};
const Authentication = {
type: 'basic',
// The test method allows Zapier to verify that the credentials a user provides are valid. We'll execute this
// method whenever a user connects their account for the first time.
test,
// assuming "username" is a key returned from the test
connectionLabel: '{{username}}',
};
export default Authentication;

View file

@ -0,0 +1,27 @@
import Authentication from './authentication';
import Recipe from './resources/recipe';
import { version } from '../package.json';
import { version as platformVersion } from 'zapier-platform-core';
const App = {
version,
platformVersion,
authentication: Authentication,
beforeRequest: [],
afterResponse: [],
resources: {
[Recipe.key]: Recipe,
},
triggers: {},
searches: {},
creates: {},
};
export default App;

View file

@ -0,0 +1,168 @@
const _sharedBaseUrl = 'https://auth-json-server.zapier-staging.com';
const getRecipe = async (z, bundle) => {
const response = await z.request({
url: `${_sharedBaseUrl}/recipes/${bundle.inputData.id}`,
});
return response.data;
};
const listRecipes = async (z, bundle) => {
const response = await z.request({
url: _sharedBaseUrl + '/recipes',
params: {
style: bundle.inputData.style,
},
});
return response.data;
};
const createRecipe = async (z, bundle) => {
const response = await z.request({
url: _sharedBaseUrl + '/recipes',
method: 'POST',
body: {
name: bundle.inputData.name,
directions: bundle.inputData.directions,
authorId: bundle.inputData.authorId,
},
headers: {
'content-type': 'application/json',
},
});
return response.data;
};
const searchRecipe = async (z, bundle) => {
const response = await z.request({
url: _sharedBaseUrl + '/recipes',
params: {
nameSearch: bundle.inputData.name,
},
});
const matchingRecipes = response.data;
// Only return the first matching recipe
if (matchingRecipes && matchingRecipes.length) {
return matchingRecipes[0];
}
return [];
};
const sample = {
id: 1,
createdAt: 1472069465,
name: 'Best Spagetti Ever',
authorId: 1,
directions: '1. Boil Noodles\n2.Serve with sauce',
style: 'italian',
};
// This file exports a Recipe resource. The definition below contains all of the keys available,
// and implements the list and create methods.
const Recipe = {
key: 'recipe',
noun: 'Recipe',
// The get method is used by Zapier to fetch a complete representation of a record. This is helpful when the HTTP
// response from a create call only return an ID, or a search that only returns a minimuml representation of the
// record. Zapier will follow these up with the get() to retrieve the entire object.
get: {
display: {
label: 'Get Recipe',
description: 'Gets a recipe.',
},
operation: {
inputFields: [{ key: 'id', required: true }],
perform: getRecipe,
sample,
},
},
// The list method on this resource becomes a Trigger on the app. Zapier will use polling to watch for new records
list: {
display: {
label: 'New Recipe',
description: 'Trigger when a new recipe is added.',
},
operation: {
inputFields: [
{
key: 'style',
type: 'string',
helpText: 'Explain what style of cuisine this is.',
},
],
perform: listRecipes,
sample,
},
},
// If your app supports webhooks, you can define a hook method instead of a list method.
// Zapier will turn this into a webhook Trigger on the app.
// hook: {
//
// },
create: {
display: {
label: 'Create Recipe',
description: 'Creates a new recipe.',
},
operation: {
inputFields: [
{ key: 'name', required: true, type: 'string' },
{
key: 'directions',
required: true,
type: 'text',
helpText: 'Explain how should one make the recipe, step by step.',
},
{
key: 'authorId',
required: true,
type: 'integer',
label: 'Author ID',
},
{
key: 'style',
required: false,
type: 'string',
helpText: 'Explain what style of cuisine this is.',
},
],
perform: createRecipe,
sample,
},
},
search: {
display: {
label: 'Find Recipe',
description: 'Finds an existing recipe by name.',
},
operation: {
inputFields: [{ key: 'name', required: true, type: 'string' }],
perform: searchRecipe,
sample,
},
},
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
// returned records, and have obviously dummy values that we can show to any user.
sample,
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
// field definitions. The result will be used to augment the sample.
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{ key: 'id', label: 'ID' },
{ key: 'createdAt', label: 'Created At' },
{ key: 'name', label: 'Name' },
{ key: 'directions', label: 'Directions' },
{ key: 'authorId', label: 'Author ID' },
{ key: 'style', label: 'Style' },
],
};
export default Recipe;

View file

@ -0,0 +1,33 @@
/* globals describe, it */
import should from 'should';
import zapier from 'zapier-platform-core';
import App from '../index';
const appTester = zapier.createAppTester(App);
describe('My Test', () => {
it('should test the auth succeeds', async () => {
const bundle = {
authData: {
username: 'user',
password: 'secret',
},
};
const response = await appTester(App.authentication.test, bundle);
should(response.status).eql(200);
response.request.headers.Authorization.should.eql('Basic dXNlcjpzZWNyZXQ=');
});
it('should test the auth fails', () => {
const bundle = {
authData: {
username: 'user',
password: 'boom',
},
};
return appTester(App.authentication.test, bundle).should.be.rejected();
});
});

View file

@ -0,0 +1,63 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/
dist/
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# environment variables file
.env
.environment
# next.js build output
.next

View file

@ -0,0 +1,34 @@
# basic-auth-typescript
This Zapier integration project is generated by the `zapier-platform init` CLI command.
These are what you normally do next:
```bash
# Install dependencies
npm install # or you can use yarn
# Run tests
zapier-platform test
# Register the integration on Zapier if you haven't
zapier-platform register "App Title"
# Or you can link to an existing integration on Zapier
zapier-platform link
# Push it to Zapier
zapier-platform push
```
Then, to add more features, you can use the `zapier-platform scaffold` command, for example:
```bash
# Add a trigger
zapier-platform scaffold trigger contact
# Add an action
zapier-platform scaffold create contact
```
Find out more on the latest docs: https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md.

View file

@ -0,0 +1,22 @@
{
"name": "basic-auth-typescript",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "npm run build && vitest --run",
"clean": "rimraf ./dist ./build",
"build": "npm run clean && tsc",
"_zapier-build": "npm run build"
},
"dependencies": {
"zapier-platform-core": "19.1.0"
},
"devDependencies": {
"rimraf": "^5.0.10",
"typescript": "5.6.2",
"vitest": "^2.1.2"
},
"private": true,
"exports": "./dist/index.js",
"type": "module"
}

View file

@ -0,0 +1,32 @@
import type { ZObject, Bundle, Authentication } from 'zapier-platform-core';
// You want to make a request to an endpoint that is either specifically designed
// to test auth, or one that every user will have access to. eg: `/me`.
// By returning the entire request object, you have access to the request and
// response data for testing purposes. Your connection label can access any data
// from the returned response using the `json.` prefix. eg: `{{json.username}}`.
const test = (z: ZObject, bundle: Bundle) =>
z.request({ url: 'https://auth-json-server.zapier-staging.com/me' });
export default {
// "basic" auth automatically creates "username" and "password" input fields. It
// also registers default middleware to create the authentication header.
type: 'basic',
// Define any input app's auth requires here. The user will be prompted to enter
// this info when they connect their account.
fields: [],
// The test method allows Zapier to verify that the credentials a user provides
// are valid. We'll execute this method whenever a user connects their account for
// the first time.
test,
// This template string can access all the data returned from the auth test. If
// you return the test object, you'll access the returned data with a label like
// `{{json.X}}`. If you return `response.data` from your test, then your label can
// be `{{X}}`. This can also be a function that returns a label. That function has
// the standard args `(z: ZObject, bundle: Bundle)` and data returned from the
// test can be accessed in `bundle.inputData.X`.
connectionLabel: '{{json.username}}',
} satisfies Authentication;

View file

@ -0,0 +1,21 @@
import zapier, { defineApp } from 'zapier-platform-core';
import packageJson from '../package.json' with { type: 'json' };
import authentication from './authentication.js';
import { befores, afters } from './middleware.js';
export default defineApp({
version: packageJson.version,
platformVersion: zapier.version,
authentication,
beforeRequest: [...befores],
afterResponse: [...afters],
// Add your triggers here for them to show up!
triggers: {},
// Add your creates here for them to show up!
creates: {},
});

View file

@ -0,0 +1,21 @@
import type { ZObject, Bundle, Authentication } from 'zapier-platform-core';
// This function runs after every outbound request. You can use it to check for
// errors or modify the response. You can have as many as you need. They'll need
// to each be registered in your index.js file.
const handleBadResponses = (response, z: ZObject, bundle: Bundle) => {
if (response.status === 401) {
throw new z.errors.Error(
// This message is surfaced to the user
'The username and/or password you supplied is incorrect',
'AuthenticationError',
response.status,
);
}
return response;
};
export const befores = [];
export const afters = [handleBadResponses];

View file

@ -0,0 +1,42 @@
import { describe, expect, it } from 'vitest';
import zapier from 'zapier-platform-core';
import App from '../index.js';
const appTester = zapier.createAppTester(App);
describe('basic auth', () => {
it('automatically has Authorize Header add', async () => {
const bundle = {
authData: {
username: 'user',
password: 'secret',
},
};
const response = await appTester(App.authentication.test, bundle);
expect(response.status).toBe(200);
expect(response.request.headers.Authorization).toBe(
'Basic dXNlcjpzZWNyZXQ=',
);
});
it('fails on bad auth', async () => {
const bundle = {
authData: {
username: 'user',
password: 'badpwd',
},
};
try {
await appTester(App.authentication.test, bundle);
} catch (err) {
expect(err.message).toContain(
'The username and/or password you supplied is incorrect',
);
return;
}
throw new Error('appTester should have thrown');
});
});

View file

@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"esModuleInterop": true,
"noUncheckedIndexedAccess": true,
"isolatedModules": true,
"noImplicitAny": false,
"skipLibCheck": true,
"outDir": "./dist",
"rootDir": "./src",
"strict": true
},
"include": ["./src/**/*.ts"],
"exclude": ["./**/*.test.ts"]
}

View file

@ -0,0 +1,63 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/
dist/
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# environment variables file
.env
.environment
# next.js build output
.next

View file

@ -0,0 +1,34 @@
# basic-auth
This Zapier integration project is generated by the `zapier-platform init` CLI command.
These are what you normally do next:
```bash
# Install dependencies
npm install # or you can use yarn
# Run tests
zapier-platform test
# Register the integration on Zapier if you haven't
zapier-platform register "App Title"
# Or you can link to an existing integration on Zapier
zapier-platform link
# Push it to Zapier
zapier-platform push
```
Then, to add more features, you can use the `zapier-platform scaffold` command, for example:
```bash
# Add a trigger
zapier-platform scaffold trigger contact
# Add an action
zapier-platform scaffold create contact
```
Find out more on the latest docs: https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md.

View file

@ -0,0 +1,32 @@
'use strict';
// You want to make a request to an endpoint that is either specifically designed
// to test auth, or one that every user will have access to. eg: `/me`.
// By returning the entire request object, you have access to the request and
// response data for testing purposes. Your connection label can access any data
// from the returned response using the `json.` prefix. eg: `{{json.username}}`.
const test = (z, bundle) =>
z.request({ url: 'https://auth-json-server.zapier-staging.com/me' });
module.exports = {
// "basic" auth automatically creates "username" and "password" input fields. It
// also registers default middleware to create the authentication header.
type: 'basic',
// Define any input app's auth requires here. The user will be prompted to enter
// this info when they connect their account.
fields: [],
// The test method allows Zapier to verify that the credentials a user provides
// are valid. We'll execute this method whenever a user connects their account for
// the first time.
test,
// This template string can access all the data returned from the auth test. If
// you return the test object, you'll access the returned data with a label like
// `{{json.X}}`. If you return `response.data` from your test, then your label can
// be `{{X}}`. This can also be a function that returns a label. That function has
// the standard args `(z, bundle)` and data returned from the test can be accessed
// in `bundle.inputData.X`.
connectionLabel: '{{json.username}}',
};

View file

@ -0,0 +1,26 @@
const authentication = require('./authentication');
const { befores = [], afters = [] } = require('./middleware');
module.exports = {
// This is just shorthand to reference the installed dependencies you have.
// Zapier will need to know these before we can upload.
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
authentication,
beforeRequest: [...befores],
afterResponse: [...afters],
// If you want your trigger to show up, you better include it here!
triggers: {},
// If you want your searches to show up, you better include it here!
searches: {},
// If you want your creates to show up, you better include it here!
creates: {},
resources: {},
};

View file

@ -0,0 +1,19 @@
'use strict';
// This function runs after every outbound request. You can use it to check for
// errors or modify the response. You can have as many as you need. They'll need
// to each be registered in your index.js file.
const handleBadResponses = (response, z, bundle) => {
if (response.status === 401) {
throw new z.errors.Error(
// This message is surfaced to the user
'The username and/or password you supplied is incorrect',
'AuthenticationError',
response.status,
);
}
return response;
};
module.exports = { befores: [], afters: [handleBadResponses] };

View file

@ -0,0 +1,16 @@
{
"name": "basic-auth",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "jest --testTimeout 10000"
},
"dependencies": {
"zapier-platform-core": "19.1.0"
},
"devDependencies": {
"jest": "^29.6.0"
},
"private": true
}

View file

@ -0,0 +1,43 @@
/* globals describe, it, expect */
const zapier = require('zapier-platform-core');
const App = require('../index');
const appTester = zapier.createAppTester(App);
describe('basic auth', () => {
it('automatically has Authorize Header add', async () => {
const bundle = {
authData: {
username: 'user',
password: 'secret',
},
};
const response = await appTester(App.authentication.test, bundle);
expect(response.status).toBe(200);
expect(response.request.headers.Authorization).toBe(
'Basic dXNlcjpzZWNyZXQ=',
);
});
it('fails on bad auth', async () => {
const bundle = {
authData: {
username: 'user',
password: 'badpwd',
},
};
try {
await appTester(App.authentication.test, bundle);
} catch (err) {
expect(err.message).toContain(
'The username and/or password you supplied is incorrect',
);
return;
}
throw new Error('appTester should have thrown');
});
});

View file

@ -0,0 +1,62 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# environment variables file
.env
.environment
# next.js build output
.next

View file

@ -0,0 +1,30 @@
# callback
This Zapier integration project is generated by the `zapier-platform init` CLI command.
These are what you normally do next:
```bash
# Install dependencies
npm install # or you can use yarn
# Run tests
zapier-platform test
# Register the integration on Zapier if you haven't
zapier-platform register "App Title"
# Or you can link to an existing integration on Zapier
zapier-platform link
# Push it to Zapier
zapier-platform push
```
Find out more on the latest docs: https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md.
# The "Callback" Template
This example has a create showcasing the `performResume` callback function.
Find out more in the docs: https://github.com/zapier/zapier-platform/blob/main/packages/cli#zgeneratecallbackurl.

View file

@ -0,0 +1,73 @@
// We recommend writing your creates separate like this and rolling them
// into the App definition at the end.
module.exports = {
key: 'prediction',
// You'll want to provide some helpful display labels and descriptions
// for users. Zapier will put them into the UX.
noun: 'Prediction',
display: {
label: 'Create Prediction',
description: 'Creates a new prediction.',
},
// `operation` is where the business logic goes.
operation: {
inputFields: [
{
key: 'question',
required: true,
type: 'string',
helpText: 'Provide a "Yes" or "No" question to ask the Magic 8-Ball.',
},
],
perform: (z, bundle) => {
const promise = z.request({
url: 'https://auth-json-server.zapier-staging.com/magic',
method: 'POST',
body: {
callbackUrl: z.generateCallbackUrl(),
},
headers: {
'content-type': 'application/json',
// This is NOT how you normally do authentication. This is just to demo how to write a create here.
// Refer to this doc to set up authentication:
// https://docs.zapier.com/platform/reference/cli-docs#authentication
'X-API-Key': 'secret',
},
});
return promise.then((response) => ({ ...response.data, extra: 'data' }));
},
performResume: (z, bundle) => {
// The original output from perform is available in bundle.outputData.
// The data POSTed to the callbackUrl is in bundle.cleanedRequest.
// The full request object corresponding to bundle.cleanedRequest can be found in bundle.rawRequest.
const { extra, ...originalOutput } = bundle.outputData;
// The following line will return an object containing the contents of the original API response to the
// request from the perform function merged with the contents of the new request from the API.
return { ...originalOutput, ...bundle.cleanedRequest };
},
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
// returned records, and have obviously dummy values that we can show to any user.
sample: {
callbackUrl: 'http://zapier.com/hooks/catch/-1234/abcdef/',
status: 'success',
result: 'Ask again later.',
},
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
// field definitions. The result will be used to augment the sample.
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{ key: 'callbackUrl', label: 'Callback URL' },
{ key: 'status', label: 'Status' },
{ key: 'result', label: 'Predicted Result' },
],
},
};

View file

@ -0,0 +1,17 @@
const prediction = require('./creates/prediction');
// Now we can roll up all our behaviors in an App.
const App = {
// This is just shorthand to reference the installed dependencies you have. Zapier will
// need to know these before we can upload
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
// If you want your creates to show up, you better include it here!
creates: {
[prediction.key]: prediction,
},
};
// Finally, export the app.
module.exports = App;

View file

@ -0,0 +1,16 @@
{
"name": "callback",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "jest --testTimeout 10000"
},
"dependencies": {
"zapier-platform-core": "19.1.0"
},
"devDependencies": {
"jest": "^25.5.3"
},
"private": true
}

View file

@ -0,0 +1,46 @@
/* globals describe, expect, test */
const zapier = require('zapier-platform-core');
const App = require('../index');
const appTester = zapier.createAppTester(App);
zapier.tools.env.inject();
describe('creates', () => {
test('perform function returns intermediate data', async () => {
const bundle = { inputData: { question: 'Will this work?' } };
const result = await appTester(
App.creates.prediction.operation.perform,
bundle,
);
expect(result).toMatchObject({
status: '...thinking...',
callbackUrl: 'https://auth-json-server.zapier-staging.com/echo',
extra: 'data',
});
});
test('performResume function returns "final" data', async () => {
const bundle = {
outputData: {
callbackUrl: 'https://auth-json-server.zapier-staging.com/echo',
status: '...thinking...',
extra: 'data',
},
cleanedRequest: {
status: 'success',
result: 'Ask again later.',
},
};
const result = await appTester(
App.creates.prediction.operation.performResume,
bundle,
);
expect(result).toMatchObject({
status: 'success',
result: 'Ask again later.',
callbackUrl: 'https://auth-json-server.zapier-staging.com/echo',
});
});
});

View file

@ -0,0 +1,6 @@
build
docs
node_modules
*.log
.environment
.env

View file

@ -0,0 +1,7 @@
language: node_js
node_js:
- 8.10.0
before_script: 'npm install -g zapier-platform-cli'
script: 'zapier test'
notifications:
email: false

View file

@ -0,0 +1,7 @@
# "Create" Example App For Zapier Platform
[![Build Status](https://travis-ci.org/zapier/zapier-platform-example-app-create.svg?branch=main)](https://travis-ci.org/zapier/zapier-platform-example-app-create)
A barebones app that has a create defined.
> We recommend using the zapier-platform-cli and `zapier-platform init .`  to create an app - youll be presented with a list of currently available templates to start with.

View file

@ -0,0 +1,80 @@
// We recommend writing your creates separate like this and rolling them
// into the App definition at the end.
module.exports = {
key: 'recipe',
// You'll want to provide some helpful display labels and descriptions
// for users. Zapier will put them into the UX.
noun: 'Recipe',
display: {
label: 'Create Recipe',
description: 'Creates a new recipe.',
},
// `operation` is where the business logic goes.
operation: {
inputFields: [
{ key: 'name', required: true, type: 'string' },
{
key: 'directions',
required: true,
type: 'text',
helpText: 'Explain how should one make the recipe, step by step.',
},
{ key: 'authorId', required: true, type: 'integer', label: 'Author ID' },
{
key: 'style',
required: false,
type: 'string',
helpText: 'Explain what style of cuisine this is.',
},
],
perform: (z, bundle) => {
const promise = z.request({
url: 'https://auth-json-server.zapier-staging.com/recipes',
method: 'POST',
body: {
name: bundle.inputData.name,
directions: bundle.inputData.directions,
authorId: bundle.inputData.authorId,
style: bundle.inputData.style,
},
headers: {
'content-type': 'application/json',
// This is NOT how you normally do authentication. This is just to demo how to write a create here.
// Refer to this doc to set up authentication:
// https://docs.zapier.com/platform/reference/cli-docs#authentication
'X-API-Key': 'secret',
},
});
return promise.then((response) => response.data);
},
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
// returned records, and have obviously dummy values that we can show to any user.
sample: {
id: 1,
createdAt: 1472069465,
name: 'Best Spagetti Ever',
authorId: 1,
directions: '1. Boil Noodles\n2.Serve with sauce',
style: 'italian',
},
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
// field definitions. The result will be used to augment the sample.
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{ key: 'id', label: 'ID' },
{ key: 'createdAt', label: 'Created At' },
{ key: 'name', label: 'Name' },
{ key: 'directions', label: 'Directions' },
{ key: 'authorId', label: 'Author ID' },
{ key: 'style', label: 'Style' },
],
},
};

View file

@ -0,0 +1,29 @@
const recipe = require('./creates/recipe');
// Now we can roll up all our behaviors in an App.
const App = {
// This is just shorthand to reference the installed dependencies you have. Zapier will
// need to know these before we can upload
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
beforeRequest: [],
afterResponse: [],
resources: {},
// If you want your trigger to show up, you better include it here!
triggers: {},
// If you want your searches to show up, you better include it here!
searches: {},
// If you want your creates to show up, you better include it here!
creates: {
[recipe.key]: recipe,
},
};
// Finally, export the app.
module.exports = App;

View file

@ -0,0 +1,25 @@
{
"name": "zapier-platform-example-app-create",
"version": "1.0.0",
"description": "An example app for the Zapier platform.",
"repository": "zapier/zapier-platform-example-app-create",
"homepage": "https://zapier.com/",
"author": "Bryan Helmig <bryan@zapier.com>",
"license": "BSD-3-Clause",
"main": "index.js",
"scripts": {
"test": "mocha --recursive"
},
"engines": {
"node": ">=8.10.0",
"npm": ">=5.6.0"
},
"dependencies": {
"zapier-platform-core": "19.1.0"
},
"devDependencies": {
"mocha": "^5.2.0",
"should": "^13.2.0"
},
"private": true
}

View file

@ -0,0 +1,29 @@
/* globals describe, it */
require('should');
const zapier = require('zapier-platform-core');
const App = require('../index');
const appTester = zapier.createAppTester(App);
describe('creates', () => {
describe('create recipe create', () => {
it('should create a new recipe', (done) => {
const bundle = {
inputData: {
name: 'Smith Family Recipe',
directions: '1. Order out :)',
authorId: 1,
},
};
appTester(App.creates.recipe.operation.perform, bundle)
.then((result) => {
result.should.have.property('name');
done();
})
.catch(done);
});
});
});

View file

@ -0,0 +1,63 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/
dist/
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# environment variables file
.env
.environment
# next.js build output
.next

View file

@ -0,0 +1,34 @@
# custom-auth-typescript
This Zapier integration project is generated by the `zapier-platform init` CLI command.
These are what you normally do next:
```bash
# Install dependencies
npm install # or you can use yarn
# Run tests
zapier-platform test
# Register the integration on Zapier if you haven't
zapier-platform register "App Title"
# Or you can link to an existing integration on Zapier
zapier-platform link
# Push it to Zapier
zapier-platform push
```
Then, to add more features, you can use the `zapier-platform scaffold` command, for example:
```bash
# Add a trigger
zapier-platform scaffold trigger contact
# Add an action
zapier-platform scaffold create contact
```
Find out more on the latest docs: https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md.

View file

@ -0,0 +1,22 @@
{
"name": "custom-auth-typescript",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "npm run build && vitest --run",
"clean": "rimraf ./dist ./build",
"build": "npm run clean && tsc",
"_zapier-build": "npm run build"
},
"dependencies": {
"zapier-platform-core": "19.1.0"
},
"devDependencies": {
"rimraf": "^5.0.10",
"typescript": "5.6.2",
"vitest": "^2.1.2"
},
"private": true,
"exports": "./dist/index.js",
"type": "module"
}

View file

@ -0,0 +1,32 @@
import type { ZObject, Bundle, Authentication } from 'zapier-platform-core';
// You want to make a request to an endpoint that is either specifically designed
// to test auth, or one that every user will have access to. eg: `/me`.
// By returning the entire request object, you have access to the request and
// response data for testing purposes. Your connection label can access any data
// from the returned response using the `json.` prefix. eg: `{{json.username}}`.
const test = (z: ZObject, bundle: Bundle) =>
z.request({ url: 'https://auth-json-server.zapier-staging.com/me' });
export default {
// "custom" is the catch-all auth type. The user supplies some info and Zapier can
// make authenticated requests with it
type: 'custom',
// Define any input app's auth requires here. The user will be prompted to enter
// this info when they connect their account.
fields: [{ key: 'apiKey', label: 'API Key', required: true }],
// The test method allows Zapier to verify that the credentials a user provides
// are valid. We'll execute this method whenever a user connects their account for
// the first time.
test,
// This template string can access all the data returned from the auth test. If
// you return the test object, you'll access the returned data with a label like
// `{{json.X}}`. If you return `response.data` from your test, then your label can
// be `{{X}}`. This can also be a function that returns a label. That function has
// the standard args `(z: ZObject, bundle: Bundle)` and data returned from the
// test can be accessed in `bundle.inputData.X`.
connectionLabel: '{{json.username}}',
} satisfies Authentication;

View file

@ -0,0 +1,21 @@
import zapier, { defineApp } from 'zapier-platform-core';
import packageJson from '../package.json' with { type: 'json' };
import authentication from './authentication.js';
import { befores, afters } from './middleware.js';
export default defineApp({
version: packageJson.version,
platformVersion: zapier.version,
authentication,
beforeRequest: [...befores],
afterResponse: [...afters],
// Add your triggers here for them to show up!
triggers: {},
// Add your creates here for them to show up!
creates: {},
});

View file

@ -0,0 +1,36 @@
import type { ZObject, Bundle, Authentication } from 'zapier-platform-core';
// This function runs after every outbound request. You can use it to check for
// errors or modify the response. You can have as many as you need. They'll need
// to each be registered in your index.js file.
const handleBadResponses = (response, z: ZObject, bundle: Bundle) => {
if (response.status === 401) {
throw new z.errors.Error(
// This message is surfaced to the user
'The API Key you supplied is incorrect',
'AuthenticationError',
response.status,
);
}
return response;
};
// This function runs before every outbound request. You can have as many as you
// need. They'll need to each be registered in your index.js file.
const includeApiKey = (request, z: ZObject, bundle: Bundle) => {
if (bundle.authData.apiKey) {
// Use these lines to include the API key in the querystring
request.params = request.params || {};
request.params.api_key = bundle.authData.apiKey;
// If you want to include the API key in the header instead, uncomment this:
// request.headers.Authorization = bundle.authData.apiKey;
}
return request;
};
export const befores = [includeApiKey];
export const afters = [handleBadResponses];

View file

@ -0,0 +1,34 @@
import { describe, expect, it } from 'vitest';
import zapier from 'zapier-platform-core';
import App from '../index.js';
const appTester = zapier.createAppTester(App);
describe('custom auth', () => {
it('passes authentication and returns json', async () => {
const bundle = {
authData: {
apiKey: 'secret',
},
};
const response = await appTester(App.authentication.test, bundle);
expect(response.data).toHaveProperty('username');
});
it('fails on bad auth', async () => {
const bundle = {
authData: {
apiKey: 'bad',
},
};
try {
await appTester(App.authentication.test, bundle);
} catch (error) {
expect(error.message).toContain('The API Key you supplied is incorrect');
return;
}
throw new Error('appTester should have thrown');
});
});

View file

@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"esModuleInterop": true,
"noUncheckedIndexedAccess": true,
"isolatedModules": true,
"noImplicitAny": false,
"skipLibCheck": true,
"outDir": "./dist",
"rootDir": "./src",
"strict": true
},
"include": ["./src/**/*.ts"],
"exclude": ["./**/*.test.ts"]
}

View file

@ -0,0 +1,63 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/
dist/
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# environment variables file
.env
.environment
# next.js build output
.next

View file

@ -0,0 +1,34 @@
# custom-auth
This Zapier integration project is generated by the `zapier-platform init` CLI command.
These are what you normally do next:
```bash
# Install dependencies
npm install # or you can use yarn
# Run tests
zapier-platform test
# Register the integration on Zapier if you haven't
zapier-platform register "App Title"
# Or you can link to an existing integration on Zapier
zapier-platform link
# Push it to Zapier
zapier-platform push
```
Then, to add more features, you can use the `zapier-platform scaffold` command, for example:
```bash
# Add a trigger
zapier-platform scaffold trigger contact
# Add an action
zapier-platform scaffold create contact
```
Find out more on the latest docs: https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md.

View file

@ -0,0 +1,32 @@
'use strict';
// You want to make a request to an endpoint that is either specifically designed
// to test auth, or one that every user will have access to. eg: `/me`.
// By returning the entire request object, you have access to the request and
// response data for testing purposes. Your connection label can access any data
// from the returned response using the `json.` prefix. eg: `{{json.username}}`.
const test = (z, bundle) =>
z.request({ url: 'https://auth-json-server.zapier-staging.com/me' });
module.exports = {
// "custom" is the catch-all auth type. The user supplies some info and Zapier can
// make authenticated requests with it
type: 'custom',
// Define any input app's auth requires here. The user will be prompted to enter
// this info when they connect their account.
fields: [{ key: 'apiKey', label: 'API Key', required: true }],
// The test method allows Zapier to verify that the credentials a user provides
// are valid. We'll execute this method whenever a user connects their account for
// the first time.
test,
// This template string can access all the data returned from the auth test. If
// you return the test object, you'll access the returned data with a label like
// `{{json.X}}`. If you return `response.data` from your test, then your label can
// be `{{X}}`. This can also be a function that returns a label. That function has
// the standard args `(z, bundle)` and data returned from the test can be accessed
// in `bundle.inputData.X`.
connectionLabel: '{{json.username}}',
};

View file

@ -0,0 +1,26 @@
const authentication = require('./authentication');
const { befores = [], afters = [] } = require('./middleware');
module.exports = {
// This is just shorthand to reference the installed dependencies you have.
// Zapier will need to know these before we can upload.
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
authentication,
beforeRequest: [...befores],
afterResponse: [...afters],
// If you want your trigger to show up, you better include it here!
triggers: {},
// If you want your searches to show up, you better include it here!
searches: {},
// If you want your creates to show up, you better include it here!
creates: {},
resources: {},
};

View file

@ -0,0 +1,34 @@
'use strict';
// This function runs after every outbound request. You can use it to check for
// errors or modify the response. You can have as many as you need. They'll need
// to each be registered in your index.js file.
const handleBadResponses = (response, z, bundle) => {
if (response.status === 401) {
throw new z.errors.Error(
// This message is surfaced to the user
'The API Key you supplied is incorrect',
'AuthenticationError',
response.status,
);
}
return response;
};
// This function runs before every outbound request. You can have as many as you
// need. They'll need to each be registered in your index.js file.
const includeApiKey = (request, z, bundle) => {
if (bundle.authData.apiKey) {
// Use these lines to include the API key in the querystring
request.params = request.params || {};
request.params.api_key = bundle.authData.apiKey;
// If you want to include the API key in the header instead, uncomment this:
// request.headers.Authorization = bundle.authData.apiKey;
}
return request;
};
module.exports = { befores: [includeApiKey], afters: [handleBadResponses] };

View file

@ -0,0 +1,16 @@
{
"name": "custom-auth",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "jest --testTimeout 10000"
},
"dependencies": {
"zapier-platform-core": "19.1.0"
},
"devDependencies": {
"jest": "^29.6.0"
},
"private": true
}

View file

@ -0,0 +1,35 @@
/* globals describe, it, expect */
const zapier = require('zapier-platform-core');
const App = require('../index');
const appTester = zapier.createAppTester(App);
describe('custom auth', () => {
it('passes authentication and returns json', async () => {
const bundle = {
authData: {
apiKey: 'secret',
},
};
const response = await appTester(App.authentication.test, bundle);
expect(response.data).toHaveProperty('username');
});
it('fails on bad auth', async () => {
const bundle = {
authData: {
apiKey: 'bad',
},
};
try {
await appTester(App.authentication.test, bundle);
} catch (error) {
expect(error.message).toContain('The API Key you supplied is incorrect');
return;
}
throw new Error('appTester should have thrown');
});
});

View file

@ -0,0 +1,63 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/
dist/
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# environment variables file
.env
.environment
# next.js build output
.next

View file

@ -0,0 +1,34 @@
# digest-auth-typescript
This Zapier integration project is generated by the `zapier-platform init` CLI command.
These are what you normally do next:
```bash
# Install dependencies
npm install # or you can use yarn
# Run tests
zapier-platform test
# Register the integration on Zapier if you haven't
zapier-platform register "App Title"
# Or you can link to an existing integration on Zapier
zapier-platform link
# Push it to Zapier
zapier-platform push
```
Then, to add more features, you can use the `zapier-platform scaffold` command, for example:
```bash
# Add a trigger
zapier-platform scaffold trigger contact
# Add an action
zapier-platform scaffold create contact
```
Find out more on the latest docs: https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md.

View file

@ -0,0 +1,22 @@
{
"name": "digest-auth-typescript",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "npm run build && vitest --run",
"clean": "rimraf ./dist ./build",
"build": "npm run clean && tsc",
"_zapier-build": "npm run build"
},
"dependencies": {
"zapier-platform-core": "19.1.0"
},
"devDependencies": {
"rimraf": "^5.0.10",
"typescript": "5.6.2",
"vitest": "^2.1.2"
},
"private": true,
"exports": "./dist/index.js",
"type": "module"
}

View file

@ -0,0 +1,34 @@
import type { ZObject, Bundle, Authentication } from 'zapier-platform-core';
// You want to make a request to an endpoint that is either specifically designed
// to test auth, or one that every user will have access to. eg: `/me`.
// By returning the entire request object, you have access to the request and
// response data for testing purposes. Your connection label can access any data
// from the returned response using the `json.` prefix. eg: `{{json.username}}`.
const test = (z: ZObject, bundle: Bundle) =>
z.request({
url: 'https://httpbin.zapier-tooling.com/digest-auth/auth/myuser/mypass',
});
export default {
// "digest" auth automatically creates "username" and "password" input fields. It
// also registers default middleware to create the authentication header.
type: 'digest',
// Define any input app's auth requires here. The user will be prompted to enter
// this info when they connect their account.
fields: [],
// The test method allows Zapier to verify that the credentials a user provides
// are valid. We'll execute this method whenever a user connects their account for
// the first time.
test,
// This template string can access all the data returned from the auth test. If
// you return the test object, you'll access the returned data with a label like
// `{{json.X}}`. If you return `response.data` from your test, then your label can
// be `{{X}}`. This can also be a function that returns a label. That function has
// the standard args `(z: ZObject, bundle: Bundle)` and data returned from the
// test can be accessed in `bundle.inputData.X`.
connectionLabel: '{{json.username}}',
} satisfies Authentication;

View file

@ -0,0 +1,21 @@
import zapier, { defineApp } from 'zapier-platform-core';
import packageJson from '../package.json' with { type: 'json' };
import authentication from './authentication.js';
import { befores, afters } from './middleware.js';
export default defineApp({
version: packageJson.version,
platformVersion: zapier.version,
authentication,
beforeRequest: [...befores],
afterResponse: [...afters],
// Add your triggers here for them to show up!
triggers: {},
// Add your creates here for them to show up!
creates: {},
});

View file

@ -0,0 +1,21 @@
import type { ZObject, Bundle, Authentication } from 'zapier-platform-core';
// This function runs after every outbound request. You can use it to check for
// errors or modify the response. You can have as many as you need. They'll need
// to each be registered in your index.js file.
const handleBadResponses = (response, z: ZObject, bundle: Bundle) => {
if (response.status === 401) {
throw new z.errors.Error(
// This message is surfaced to the user
'The username and/or password you supplied is incorrect',
'AuthenticationError',
response.status,
);
}
return response;
};
export const befores = [];
export const afters = [handleBadResponses];

View file

@ -0,0 +1,43 @@
import { describe, expect, it } from 'vitest';
import zapier from 'zapier-platform-core';
import App from '../index.js';
const appTester = zapier.createAppTester(App);
describe('digest auth', () => {
it('correctly authenticates', async () => {
// Try changing the values of username or password to see how the test method behaves
const bundle = {
authData: {
username: 'myuser',
password: 'mypass',
},
};
const response = await appTester(App.authentication.test, bundle);
expect(response.status).toBe(200);
expect(response.data.authorized).toBe(true);
expect(response.data.user).toBe('myuser');
});
it('fails on bad auth', async () => {
// Try changing the values of username or password to see how the test method behaves
const bundle = {
authData: {
username: 'user',
password: 'badpwd',
},
};
try {
await appTester(App.authentication.test, bundle);
} catch (err) {
expect(err.message).toContain(
'The username and/or password you supplied is incorrect',
);
return;
}
throw new Error('appTester should have thrown');
});
});

View file

@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"esModuleInterop": true,
"noUncheckedIndexedAccess": true,
"isolatedModules": true,
"noImplicitAny": false,
"skipLibCheck": true,
"outDir": "./dist",
"rootDir": "./src",
"strict": true
},
"include": ["./src/**/*.ts"],
"exclude": ["./**/*.test.ts"]
}

View file

@ -0,0 +1,63 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/
dist/
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# environment variables file
.env
.environment
# next.js build output
.next

View file

@ -0,0 +1,34 @@
# digest-auth
This Zapier integration project is generated by the `zapier-platform init` CLI command.
These are what you normally do next:
```bash
# Install dependencies
npm install # or you can use yarn
# Run tests
zapier-platform test
# Register the integration on Zapier if you haven't
zapier-platform register "App Title"
# Or you can link to an existing integration on Zapier
zapier-platform link
# Push it to Zapier
zapier-platform push
```
Then, to add more features, you can use the `zapier-platform scaffold` command, for example:
```bash
# Add a trigger
zapier-platform scaffold trigger contact
# Add an action
zapier-platform scaffold create contact
```
Find out more on the latest docs: https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md.

View file

@ -0,0 +1,34 @@
'use strict';
// You want to make a request to an endpoint that is either specifically designed
// to test auth, or one that every user will have access to. eg: `/me`.
// By returning the entire request object, you have access to the request and
// response data for testing purposes. Your connection label can access any data
// from the returned response using the `json.` prefix. eg: `{{json.username}}`.
const test = (z, bundle) =>
z.request({
url: 'https://httpbin.zapier-tooling.com/digest-auth/auth/myuser/mypass',
});
module.exports = {
// "digest" auth automatically creates "username" and "password" input fields. It
// also registers default middleware to create the authentication header.
type: 'digest',
// Define any input app's auth requires here. The user will be prompted to enter
// this info when they connect their account.
fields: [],
// The test method allows Zapier to verify that the credentials a user provides
// are valid. We'll execute this method whenever a user connects their account for
// the first time.
test,
// This template string can access all the data returned from the auth test. If
// you return the test object, you'll access the returned data with a label like
// `{{json.X}}`. If you return `response.data` from your test, then your label can
// be `{{X}}`. This can also be a function that returns a label. That function has
// the standard args `(z, bundle)` and data returned from the test can be accessed
// in `bundle.inputData.X`.
connectionLabel: '{{json.username}}',
};

View file

@ -0,0 +1,26 @@
const authentication = require('./authentication');
const { befores = [], afters = [] } = require('./middleware');
module.exports = {
// This is just shorthand to reference the installed dependencies you have.
// Zapier will need to know these before we can upload.
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
authentication,
beforeRequest: [...befores],
afterResponse: [...afters],
// If you want your trigger to show up, you better include it here!
triggers: {},
// If you want your searches to show up, you better include it here!
searches: {},
// If you want your creates to show up, you better include it here!
creates: {},
resources: {},
};

View file

@ -0,0 +1,19 @@
'use strict';
// This function runs after every outbound request. You can use it to check for
// errors or modify the response. You can have as many as you need. They'll need
// to each be registered in your index.js file.
const handleBadResponses = (response, z, bundle) => {
if (response.status === 401) {
throw new z.errors.Error(
// This message is surfaced to the user
'The username and/or password you supplied is incorrect',
'AuthenticationError',
response.status,
);
}
return response;
};
module.exports = { befores: [], afters: [handleBadResponses] };

View file

@ -0,0 +1,16 @@
{
"name": "digest-auth",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "jest --testTimeout 10000"
},
"dependencies": {
"zapier-platform-core": "19.1.0"
},
"devDependencies": {
"jest": "^29.6.0"
},
"private": true
}

View file

@ -0,0 +1,44 @@
/* globals describe, it, expect */
const zapier = require('zapier-platform-core');
const App = require('../index');
const appTester = zapier.createAppTester(App);
describe('digest auth', () => {
it('correctly authenticates', async () => {
// Try changing the values of username or password to see how the test method behaves
const bundle = {
authData: {
username: 'myuser',
password: 'mypass',
},
};
const response = await appTester(App.authentication.test, bundle);
expect(response.status).toBe(200);
expect(response.data.authorized).toBe(true);
expect(response.data.user).toBe('myuser');
});
it('fails on bad auth', async () => {
// Try changing the values of username or password to see how the test method behaves
const bundle = {
authData: {
username: 'user',
password: 'badpwd',
},
};
try {
await appTester(App.authentication.test, bundle);
} catch (err) {
expect(err.message).toContain(
'The username and/or password you supplied is incorrect',
);
return;
}
throw new Error('appTester should have thrown');
});
});

View file

@ -0,0 +1,63 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/
dist/
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# environment variables file
.env
.environment
# next.js build output
.next

View file

@ -0,0 +1,142 @@
# dynamic-dropdown
This Zapier integration project is generated by the `zapier-platform init` CLI command.
These are what you normally do next:
```bash
# Install dependencies
npm install # or you can use pnpm or yarn
# Run tests
zapier-platform test
# Register the integration on Zapier if you haven't
zapier-platform register "App Title"
# Or you can link to an existing integration on Zapier
zapier-platform link
# Push it to Zapier
zapier-platform push
```
Then, to add more features, you can use the `zapier-platform scaffold` command, for example:
```bash
# Add a trigger
zapier-platform scaffold trigger contact
# Add an action
zapier-platform scaffold create contact
```
Find out more on the latest docs: https://docs.zapier.com/platform
# dynamic-dropdown
This example integration demonstrates how to create **dynamic dropdowns** (also known as dynamic choices) in Zapier integrations.
## Dynamic Dropdown Patterns
There are two ways to implement dynamic dropdowns:
### 1. Trigger-based (Legacy Pattern)
Uses a separate trigger to fetch choices. Reference it with the `dynamic` property:
```javascript
{
key: 'species_id',
type: 'integer',
label: 'Species',
dynamic: 'species.id.name', // Format: "triggerKey.idField.labelField"
}
```
The trigger (`species`) fetches data, and Zapier uses `id` for the value and `name` for the display label.
### 2. Perform-based (New Pattern)
Uses a function to fetch choices directly. Define it with `choices.perform`:
```javascript
{
key: 'planet_id',
type: 'integer',
label: 'Home Planet',
resource: 'planet', // Explicit resource linking (see below)
choices: {
perform: getPlanetChoices,
},
}
```
#### Resource Linking
The `resource` property explicitly links an input field to a resource. This is particularly important for perform-based dropdowns since they don't have a `dynamic` property to derive the resource from.
```javascript
{
key: 'spreadsheet_id',
resource: 'spreadsheet',
choices: { perform: getSpreadsheets },
}
```
The perform function must return:
```javascript
{
results: [
{ id: '1', label: 'Tatooine' },
{ id: '2', label: 'Alderaan' },
],
paging_token: 'https://api.example.com/planets?page=2', // or null if no more pages
}
```
#### Pagination Support
The perform function receives `bundle.meta.paging_token` for subsequent page requests:
```javascript
const getPlanetChoices = async (z, bundle) => {
// First request: paging_token is undefined
// Subsequent requests: paging_token is the value you returned previously
const url = bundle.meta.paging_token || 'https://api.example.com/planets';
const response = await z.request({ url });
return {
results: response.data.results.map((item) => ({
id: item.id,
label: item.name,
})),
// Return null when there are no more pages
paging_token: response.data.next,
};
};
```
## This Example
This integration uses the [Star Wars API](https://swapi.dev/) to demonstrate:
- **Species dropdown** - Trigger-based pattern using the `species` trigger
- **Planet dropdown** - Perform-based pattern with pagination and explicit `resource` linking
## Getting Started
```bash
# Install dependencies
npm install
# Run tests
zapier-platform test
# Push to Zapier
zapier-platform push
```
Find out more on the latest docs: https://docs.zapier.com/platform

View file

@ -0,0 +1,12 @@
const people = require('./triggers/people');
const species = require('./triggers/species');
module.exports = {
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
triggers: {
[people.key]: people,
[species.key]: species,
},
};

View file

@ -0,0 +1,16 @@
{
"name": "dynamic-dropdown",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "jest --testTimeout 10000"
},
"dependencies": {
"zapier-platform-core": "19.1.0"
},
"devDependencies": {
"jest": "^29.6.0"
},
"private": true,
"main": "index.js"
}

View file

@ -0,0 +1,44 @@
/* globals describe, expect, test */
const zapier = require('zapier-platform-core');
const App = require('../index');
const appTester = zapier.createAppTester(App);
zapier.tools.env.inject();
describe('triggers', () => {
test('species', async () => {
const bundle = {
inputData: {},
meta: {},
};
const results = await appTester(
App.triggers.species.operation.perform,
bundle,
);
expect(results.length).toBeGreaterThan(1);
const firstSpecies = results[0];
expect(firstSpecies.id).toBe(1);
expect(firstSpecies.name).toBe('Human');
});
test('people', async () => {
const bundle = {
inputData: {
species: 1,
},
};
const results = await appTester(
App.triggers.people.operation.perform,
bundle,
);
expect(results.length).toBeGreaterThan(1);
const firstPerson = results[0];
expect(firstPerson.id).toBe(1);
expect(firstPerson.name).toBe('Luke Skywalker');
});
});

View file

@ -0,0 +1,120 @@
const { extractID } = require('../utils');
/**
* PERFORM-BASED choices WITH PAGINATION (NEW pattern)
* Fetches planets from the Star Wars API with pagination support.
*
* - bundle.meta.paging_token is a full URL from the previous response
* - Return paging_token as the API's next page URL (or null if no more pages)
*
* MUST return: { results: [...], paging_token: string|null }
*/
const getPlanetChoices = async (z, bundle) => {
// paging_token is a full URL to the next page (from SWAPI's "next" field)
// First page: paging_token is undefined/null, use default URL
const url = bundle.meta.paging_token || 'https://swapi.dev/api/planets/';
const response = await z.request({ url });
const data = response.data;
// SWAPI returns: { results: [...], next: "url" or null }
return {
results: data.results.map((planet) => ({
id: extractID(planet.url),
label: planet.name,
})),
// Return SWAPI's next URL as our paging_token
paging_token: data.next,
};
};
// Fetches a list of records from the endpoint
const perform = async (z, bundle) => {
// Ideally, we should poll through all the pages of results, but in this
// example we're going to omit that part. Thus, this trigger only "see" the
// people in their first page of results.
const response = await z.request({ url: 'https://swapi.info/api/people/' });
let peopleArray = response.data;
if (bundle.inputData.species_id) {
// The Zap's setup has requested a specific species of person. Since the
// API/endpoint can't perform the filtering, we'll perform it here, within
// the integration, and return the matching objects/records back to Zapier.
peopleArray = peopleArray.filter((person) => {
let speciesID;
if (!person.species || !person.species.length) {
speciesID = 1; // Assume human if species is not provided
} else {
speciesID = extractID(person.species[0]);
}
return speciesID === bundle.inputData.species_id;
});
}
if (bundle.inputData.planet_id) {
// The Zap's setup has requested a specific home planet. Filter people by
// homeworld (SWAPI people have a homeworld URL).
peopleArray = peopleArray.filter((person) => {
if (!person.homeworld) return false;
const homeworldID = extractID(person.homeworld);
return homeworldID === bundle.inputData.planet_id;
});
}
return peopleArray.map((person) => {
person.id = extractID(person.url);
return person;
});
};
module.exports = {
key: 'people',
noun: 'person',
display: {
label: 'New Person',
description: 'Triggers when a new person is added.',
},
operation: {
inputFields: [
// TRIGGER-BASED dynamic dropdown (legacy pattern)
// Uses a separate trigger to fetch choices
{
key: 'species_id',
type: 'integer',
label: 'Species (trigger-based)',
helpText:
'Filter by species. Uses trigger-based dynamic dropdown (dynamic: "species.id.name").',
dynamic: 'species.id.name',
altersDynamicFields: true,
},
// PERFORM-BASED dynamic dropdown WITH PAGINATION (new pattern)
// Uses a function to fetch choices directly
{
key: 'planet_id',
type: 'integer',
label: 'Home Planet (perform-based)',
helpText:
'Filter by home planet. Uses perform-based dynamic dropdown with pagination support.',
resource: 'planet', // Explicit resource linking for perform-based dropdowns
choices: {
perform: getPlanetChoices,
},
},
],
perform,
sample: {
id: '1',
name: 'Luke Skywalker',
birth_year: '19 BBY',
eye_color: 'Blue',
gender: 'Male',
hair_color: 'Blond',
height: '172',
mass: '77',
skin_color: 'Fair',
created: '2014-12-09T13:50:51.644000Z',
edited: '2014-12-10T13:52:43.172000Z',
},
},
};

View file

@ -0,0 +1,41 @@
const { extractID } = require('../utils');
// Fetches a list of records from the endpoint
const perform = async (z, bundle) => {
const request = {
url: 'https://swapi.info/api/species/',
params: {},
};
// This API returns things in "pages" of results
if (bundle.meta.page) {
request.params.page = 1 + bundle.meta.page;
}
const response = await z.request(request);
const speciesArray = response.data;
return speciesArray.map((species) => {
species.id = extractID(species.url);
return species;
});
};
module.exports = {
key: 'species',
noun: 'Species',
display: {
label: 'List of Species',
description:
'This is a hidden trigger, and is used in a Dynamic Dropdown of another trigger.',
hidden: true,
},
operation: {
// Since this is a "hidden" trigger, there aren't any inputFields needed
perform,
// The folowing is a "hint" to the Zap Editor that this trigger returns data
// "in pages", and that the UI should display an option to "load more" to
// the human.
canPaginate: true,
},
};

View file

@ -0,0 +1,12 @@
// Some handy stuff that's used in various places
// Extract the numeric ID from a URL like 'https://swapi.dev/api/people/1/'
const extractID = (urlString) => {
const match = urlString.match(/\/(\d+)\/?$/);
if (match) {
return parseInt(match[1]);
}
throw new Error(`ID not found in URL: ${urlString}`);
};
module.exports = { extractID };

View file

@ -0,0 +1,62 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# environment variables file
.env
.environment
# next.js build output
.next

View file

@ -0,0 +1,30 @@
# files
This Zapier integration project is generated by the `zapier-platform init` CLI command.
These are what you normally do next:
```bash
# Install dependencies
npm install # or you can use yarn
# Run tests
zapier-platform test
# Register the integration on Zapier if you haven't
zapier-platform register "App Title"
# Or you can link to an existing integration on Zapier
zapier-platform link
# Push it to Zapier
zapier-platform push
```
Find out more on the latest docs: https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md.
# The "files" Template
This example has a trigger and a create showcasing file handling.
Find out more in the docs: https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md#stashing-files.

View file

@ -0,0 +1,64 @@
const http = require('https'); // require('http') if your URL is not https
const FormData = require('form-data');
// Getting a stream directly from http. This only works on core 10+. For core
// 9.x compatible code, see uploadFile_v9.js.
const makeDownloadStream = (url) =>
new Promise((resolve, reject) => {
http
.request(url, (res) => {
// We can risk missing the first n bytes if we don't pause!
res.pause();
resolve(res);
})
.on('error', reject)
.end();
});
const perform = async (z, bundle) => {
// bundle.inputData.file will in fact be an URL where the file data can be
// downloaded from which we do via a stream
const stream = await makeDownloadStream(bundle.inputData.file, z);
const form = new FormData();
form.append('filename', bundle.inputData.filename);
form.append('file', stream);
// All set! Resume the stream
stream.resume();
const response = await z.request({
url: 'https://auth-json-server.zapier-staging.com/upload',
method: 'POST',
body: form,
headers: {
// DO NOT do auth like this! We do this here because this is a file
// uploading example so the auth is not the point.
'x-api-key': 'secret',
},
});
return response.data;
};
module.exports = {
key: 'uploadFile_v10',
noun: 'File',
display: {
label: 'Upload File v10',
description: 'Uploads a file. Only works on zapier-platform-core v10+.',
},
operation: {
inputFields: [
{ key: 'filename', required: true, type: 'string', label: 'Filename' },
{ key: 'file', required: true, type: 'file', label: 'File' },
],
perform,
sample: {
id: 1,
filename: 'example.pdf',
file: 'SAMPLE FILE',
},
},
};

View file

@ -0,0 +1,80 @@
const { randomBytes } = require('crypto');
const fs = require('fs');
const os = require('os');
const path = require('path');
const fetch = require('node-fetch');
const FormData = require('form-data');
// Download the HTTP URL to a local temporary file, and make a readable stream
// from it. This should work compatibly for all core versions. But if you're
// using core v10+, we recommend to use the implementation of uploadFile_v10.js.
const makeDownloadStream = async (url) => {
// Create a temp file to store the downloaded file
const filename = randomBytes(16).toString('hex');
const tmpFilePath = path.join(os.tmpdir(), filename);
const dest = fs.createWriteStream(tmpFilePath);
const response = await fetch(url);
// Download the file to the temp file. When finished, open a readable stream
// from that temp file.
return new Promise((resolve, reject) => {
response.body
.pipe(dest)
.on('close', () => {
const stream = fs.createReadStream(tmpFilePath).on('close', () => {
// Delete the file once the stream is read
fs.unlinkSync(tmpFilePath);
});
resolve(stream);
})
.on('error', reject);
});
};
const perform = async (z, bundle) => {
const form = new FormData();
form.append('filename', bundle.inputData.filename);
// bundle.inputData.file will in fact be an URL where the file data can be
// downloaded from which we do via a stream
const stream = await makeDownloadStream(bundle.inputData.file, z);
form.append('file', stream);
const response = await z.request({
url: 'https://auth-json-server.zapier-staging.com/upload',
method: 'POST',
body: form,
headers: {
// DO NOT do auth like this! We do this here because this is a file
// uploading example so the auth is not the point.
'x-api-key': 'secret',
},
});
return response.json;
};
module.exports = {
key: 'uploadFile_v9',
noun: 'File',
display: {
label: 'Upload File v9',
description:
'Uploads a file. Compatible with all versions of zapier-platform-core.',
},
operation: {
inputFields: [
{ key: 'filename', required: true, type: 'string', label: 'Filename' },
{ key: 'file', required: true, type: 'file', label: 'File' },
],
perform,
sample: {
id: 1,
filename: 'example.pdf',
file: 'SAMPLE FILE',
},
},
};

View file

@ -0,0 +1,16 @@
module.exports = {
downloadFile: async (z, bundle) => {
// Use standard auth to request the file
const filePromise = z.request({
url: bundle.inputData.url,
raw: true,
});
// When `raw` is true, the result of z.request() can be passed to
// z.stashFile(). z.stashFile() will upload the file to a Zapier-owned S3
// bucket and return a promise of an S3 URL that allows Zapier to get the
// file without auth. If your file URL is permanently publicly available,
// you may skip z.stashFile() and return that URL directly here.
return z.stashFile(filePromise);
},
};

View file

@ -0,0 +1,25 @@
const hydrators = require('./hydrators');
const newFile = require('./triggers/newFile');
const uploadFileV10 = require('./creates/uploadFile_v10');
const uploadFileV9 = require('./creates/uploadFile_v9');
module.exports = {
// This is just shorthand to reference the installed dependencies you have.
// Zapier will need to know these before we can upload.
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
// Any hydrators go here
hydrators,
// If you want your triggers to show up, you better include it here!
triggers: {
[newFile.key]: newFile,
},
// If you want your creates to show up, you better include it here!
creates: {
[uploadFileV10.key]: uploadFileV10,
[uploadFileV9.key]: uploadFileV9,
},
};

View file

@ -0,0 +1,17 @@
{
"name": "files",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "jest --testTimeout 10000"
},
"dependencies": {
"zapier-platform-core": "19.1.0",
"form-data": "4.0.0"
},
"devDependencies": {
"jest": "^26.6.3"
},
"private": true
}

View file

@ -0,0 +1,60 @@
/* globals describe, expect, test */
const zapier = require('zapier-platform-core');
const App = require('../index');
const appTester = zapier.createAppTester(App);
zapier.tools.env.inject();
const CORE_VERSION = zapier.version.split('.').map((s) => parseInt(s));
const FILE_URL =
'https://cdn.zapier.com/storage/files/f6679cf77afeaf6b8426de8d7b9642fc.pdf';
// This is what you get when doing `curl <FILE_URL> | sha1sum`
const EXPECTED_SHA1 = '3cf58b42a0fb1b7cc58de8110096841ece967530';
describe('uploadFile', () => {
test('upload file v10', async () => {
if (CORE_VERSION[0] < 10) {
console.warn(
`skipped because this only works on core v10+ and you're on ${zapier.version}`,
);
return;
}
const bundle = {
inputData: {
filename: 'sample.pdf',
// in production, this will be an hydration URL to the selected file's data
file: FILE_URL,
},
};
const result = await appTester(
App.creates.uploadFile_v10.operation.perform,
bundle,
);
expect(result.filename).toBe('sample.pdf');
expect(result.file.sha1).toBe(EXPECTED_SHA1);
});
test('upload file v9', async () => {
const bundle = {
inputData: {
filename: 'sample.pdf',
// in production, this will be an hydration URL to the selected file's data
file: FILE_URL,
},
};
const result = await appTester(
App.creates.uploadFile_v9.operation.perform,
bundle,
);
expect(result.filename).toBe('sample.pdf');
expect(result.file.sha1).toBe(EXPECTED_SHA1);
});
});

View file

@ -0,0 +1,27 @@
/* globals describe, expect, test */
const zapier = require('zapier-platform-core');
const App = require('../index');
const appTester = zapier.createAppTester(App);
zapier.tools.env.inject();
describe('downloadFile', () => {
test('download file', async () => {
if (!process.env.ZAPIER_DEPLOY_KEY) {
console.warn('skipped as ZAPIER_DEPLOY_KEY is not defined');
return;
}
const bundle = {
inputData: {
url: 'https://httpbin.zapier-tooling.com/xml',
},
};
const url = await appTester(App.hydrators.downloadFile, bundle);
expect(url).toContain(
'https://zapier-dev-files.s3.amazonaws.com/cli-platform/',
);
});
});

View file

@ -0,0 +1,26 @@
/* globals describe, expect, test */
const zapier = require('zapier-platform-core');
const App = require('../index');
const appTester = zapier.createAppTester(App);
zapier.tools.env.inject();
describe('newFile', () => {
test('fetch files', async () => {
const bundle = {};
const results = await appTester(
App.triggers.newFile.operation.perform,
bundle,
);
expect(results.length).toBeGreaterThan(0);
// The 'hydrate|||' thing how Zapier represents dehydrated data
const firstFile = results[0];
expect(firstFile).toEqual({
id: expect.stringMatching(/^https:/),
file: expect.stringMatching(/^hydrate\|\|\|/),
});
});
});

View file

@ -0,0 +1,46 @@
const hydrators = require('../hydrators');
const perform = (z, bundle) => {
// In reality you're more likely to get file info from a remote server. Here
// we're hard coding some links just to demonstrate.
const fileURLs = [
'https://httpbin.zapier-tooling.com/image/png',
'https://httpbin.zapier-tooling.com/image/jpeg',
'https://httpbin.zapier-tooling.com/xml',
];
return fileURLs.map((fileURL) => {
const fileInfo = {
id: fileURL,
// Make it possible to get the actual file contents if necessary. No need
// to make the request to download files now when the trigger is run.
file: z.dehydrateFile(hydrators.downloadFile, { url: fileURL }),
};
return fileInfo;
});
};
// We recommend writing your triggers separate like this and rolling them into
// the App definition at the end.
module.exports = {
key: 'newFile',
// You'll want to provide some helpful display labels and descriptions
// for users. Zapier will put them into the UX.
noun: 'File',
display: {
label: 'New File',
description: 'Triggers when a new file is added.',
},
// `operation` is where the business logic goes.
operation: {
perform,
sample: {
id: 'https://example.com/file.txt',
file: 'content',
},
},
};

View file

@ -0,0 +1,6 @@
build
docs
node_modules
*.log
.environment
.env

View file

@ -0,0 +1,7 @@
language: node_js
node_js:
- 8.10.0
before_script: 'npm install -g zapier-platform-cli'
script: 'zapier test'
notifications:
email: false

View file

@ -0,0 +1,5 @@
# zapier-platform-example-app-github
An example app that helps kickstart your journey as a Zapier [developer](https://developer.zapier.com/). Once logged in, you can see the tutorial itself [here](https://developer.zapier.com/cli-guide/introduction).
You can learn more about the CLI [here](https://github.com/zapier/zapier-platform/blob/main/packages/cli/README.md).

View file

@ -0,0 +1,89 @@
const getAccessToken = async (z, bundle) => {
const response = await z.request({
url: 'https://github.com/login/oauth/access_token',
method: 'POST',
body: {
client_id: process.env.CLIENT_ID,
client_secret: process.env.CLIENT_SECRET,
grant_type: 'authorization_code',
code: bundle.inputData.code,
// Extra data can be pulled from the querystring. For instance:
// 'accountDomain': bundle.cleanedRequest.querystring.accountDomain
},
headers: {
'content-type': 'application/x-www-form-urlencoded',
Accept: 'application/json',
},
});
// If you're using core v9.x or older, you should call response.throwForStatus()
// or verify response.status === 200 before you continue.
// This function should return `access_token`.
// If your app does an app refresh, then `refresh_token` should be returned here
// as well
return {
access_token: response.data.access_token,
};
};
// This function runs before every outbound request. You can have as many as you
// need. They'll need to each be registered in your index.js file.
const includeBearerToken = (request, z, bundle) => {
if (bundle.authData.access_token) {
request.headers.Authorization = `Bearer ${bundle.authData.access_token}`;
}
return request;
};
// You want to make a request to an endpoint that is either specifically designed
// to test auth, or one that every user will have access to. eg: `/me`.
// By returning the entire request object, you have access to the request and
// response data for testing purposes. Your connection label can access any data
// from the returned response using the `json.` prefix. eg: `{{json.username}}`.
const test = async (z, bundle) => {
const response = await z.request({ url: 'https://api.github.com/user' });
return response;
};
module.exports = {
config: {
// OAuth2 is a web authentication standard. There are a lot of configuration
// options that will fit most any situation.
type: 'oauth2',
oauth2Config: {
authorizeUrl: {
url: 'https://github.com/login/oauth/authorize',
params: {
client_id: '{{process.env.CLIENT_ID}}',
state: '{{bundle.inputData.state}}',
redirect_uri: '{{bundle.inputData.redirect_uri}}',
response_type: 'code',
},
},
getAccessToken,
},
// Define any input app's auth requires here. The user will be prompted to enter
// this info when they connect their account.
fields: [],
// The test method allows Zapier to verify that the credentials a user provides
// are valid. We'll execute this method whenever a user connects their account for
// the first time.
test,
// This template string can access all the data returned from the auth test. If
// you return the test object, you'll access the returned data with a label like
// `{{json.X}}`. If you return `response.data` from your test, then your label can
// be `{{X}}`. This can also be a function that returns a label. That function has
// the standard args `(z, bundle)` and data returned from the test can be accessed
// in `bundle.inputData.X`.
connectionLabel: '{{json.login}}',
},
befores: [includeBearerToken],
afters: [],
};

View file

@ -0,0 +1,38 @@
const sample = require('../samples/sample_issue');
const createIssue = (z, bundle) => {
const responsePromise = z.request({
method: 'POST',
url: `https://api.github.com/repos/${bundle.inputData.repo}/issues`,
body: {
title: bundle.inputData.title,
body: bundle.inputData.body,
},
});
return responsePromise.then((response) => response.data);
};
module.exports = {
key: 'issue',
noun: 'Issue',
display: {
label: 'Create Issue',
description: 'Creates an issue.',
},
operation: {
inputFields: [
{
key: 'repo',
label: 'Repo',
required: true,
dynamic: 'repo.full_name.full_name',
},
{ key: 'title', label: 'Title', required: true },
{ key: 'body', label: 'Body', required: false },
],
perform: createIssue,
sample: sample,
},
};

View file

@ -0,0 +1,41 @@
const repoTrigger = require('./triggers/repo');
const issueCreate = require('./creates/issue');
const issueTrigger = require('./triggers/issue');
const {
config: authentication,
befores = [],
afters = [],
} = require('./authentication');
const App = {
// This is just shorthand to reference the installed dependencies you have. Zapier will
// need to know these before we can upload
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
authentication,
// beforeRequest & afterResponse are optional hooks into the provided HTTP client
beforeRequest: [...befores],
afterResponse: [...afters],
// If you want to define optional resources to simplify creation of triggers, searches, creates - do that here!
resources: {},
// If you want your trigger to show up, you better include it here!
triggers: {
[repoTrigger.key]: repoTrigger,
[issueTrigger.key]: issueTrigger,
},
// If you want your searches to show up, you better include it here!
searches: {},
// If you want your creates to show up, you better include it here!
creates: {
[issueCreate.key]: issueCreate,
},
};
// Finally, export the app.
module.exports = App;

View file

@ -0,0 +1,24 @@
{
"name": "zapier-platform-example-app-github",
"version": "1.0.0",
"description": "An example app for the Zapier platform.",
"repository": "zapier/zapier-platform-app-github-example",
"homepage": "https://zapier.com/developer",
"author": "Zane Lyon <zane.lyon@zapier.com>",
"license": "BSD-3-Clause",
"main": "index.js",
"scripts": {
"test": "jest --testTimeout 10000"
},
"engines": {
"node": "8.10.0",
"npm": ">=5.6.0"
},
"dependencies": {
"zapier-platform-core": "19.1.0"
},
"devDependencies": {
"jest": "^26.6.3",
"nock": "^13.1.3"
}
}

View file

@ -0,0 +1,159 @@
module.exports = {
id: 1,
url: 'https://api.github.com/repos/octocat/Hello-World/issues/1347',
repository_url: 'https://api.github.com/repos/octocat/Hello-World',
labels_url:
'https://api.github.com/repos/octocat/Hello-World/issues/1347/labels{/name}',
comments_url:
'https://api.github.com/repos/octocat/Hello-World/issues/1347/comments',
events_url:
'https://api.github.com/repos/octocat/Hello-World/issues/1347/events',
html_url: 'https://github.com/octocat/Hello-World/issues/1347',
number: 1347,
state: 'open',
title: 'Found a bug',
body: "I'm having a problem with this.",
user: {
login: 'octocat',
id: 1,
avatar_url: 'https://github.com/images/error/octocat_happy.gif',
gravatar_id: '',
url: 'https://api.github.com/users/octocat',
html_url: 'https://github.com/octocat',
followers_url: 'https://api.github.com/users/octocat/followers',
following_url:
'https://api.github.com/users/octocat/following{/other_user}',
gists_url: 'https://api.github.com/users/octocat/gists{/gist_id}',
starred_url: 'https://api.github.com/users/octocat/starred{/owner}{/repo}',
subscriptions_url: 'https://api.github.com/users/octocat/subscriptions',
organizations_url: 'https://api.github.com/users/octocat/orgs',
repos_url: 'https://api.github.com/users/octocat/repos',
events_url: 'https://api.github.com/users/octocat/events{/privacy}',
received_events_url: 'https://api.github.com/users/octocat/received_events',
type: 'User',
site_admin: false,
},
labels: [
{
id: 208045946,
url: 'https://api.github.com/repos/octocat/Hello-World/labels/bug',
name: 'bug',
color: 'f29513',
default: true,
},
],
assignee: {
login: 'octocat',
id: 1,
avatar_url: 'https://github.com/images/error/octocat_happy.gif',
gravatar_id: '',
url: 'https://api.github.com/users/octocat',
html_url: 'https://github.com/octocat',
followers_url: 'https://api.github.com/users/octocat/followers',
following_url:
'https://api.github.com/users/octocat/following{/other_user}',
gists_url: 'https://api.github.com/users/octocat/gists{/gist_id}',
starred_url: 'https://api.github.com/users/octocat/starred{/owner}{/repo}',
subscriptions_url: 'https://api.github.com/users/octocat/subscriptions',
organizations_url: 'https://api.github.com/users/octocat/orgs',
repos_url: 'https://api.github.com/users/octocat/repos',
events_url: 'https://api.github.com/users/octocat/events{/privacy}',
received_events_url: 'https://api.github.com/users/octocat/received_events',
type: 'User',
site_admin: false,
},
assignees: [
{
login: 'octocat',
id: 1,
avatar_url: 'https://github.com/images/error/octocat_happy.gif',
gravatar_id: '',
url: 'https://api.github.com/users/octocat',
html_url: 'https://github.com/octocat',
followers_url: 'https://api.github.com/users/octocat/followers',
following_url:
'https://api.github.com/users/octocat/following{/other_user}',
gists_url: 'https://api.github.com/users/octocat/gists{/gist_id}',
starred_url:
'https://api.github.com/users/octocat/starred{/owner}{/repo}',
subscriptions_url: 'https://api.github.com/users/octocat/subscriptions',
organizations_url: 'https://api.github.com/users/octocat/orgs',
repos_url: 'https://api.github.com/users/octocat/repos',
events_url: 'https://api.github.com/users/octocat/events{/privacy}',
received_events_url:
'https://api.github.com/users/octocat/received_events',
type: 'User',
site_admin: false,
},
],
milestone: {
url: 'https://api.github.com/repos/octocat/Hello-World/milestones/1',
html_url: 'https://github.com/octocat/Hello-World/milestones/v1.0',
labels_url:
'https://api.github.com/repos/octocat/Hello-World/milestones/1/labels',
id: 1002604,
number: 1,
state: 'open',
title: 'v1.0',
description: 'Tracking milestone for version 1.0',
creator: {
login: 'octocat',
id: 1,
avatar_url: 'https://github.com/images/error/octocat_happy.gif',
gravatar_id: '',
url: 'https://api.github.com/users/octocat',
html_url: 'https://github.com/octocat',
followers_url: 'https://api.github.com/users/octocat/followers',
following_url:
'https://api.github.com/users/octocat/following{/other_user}',
gists_url: 'https://api.github.com/users/octocat/gists{/gist_id}',
starred_url:
'https://api.github.com/users/octocat/starred{/owner}{/repo}',
subscriptions_url: 'https://api.github.com/users/octocat/subscriptions',
organizations_url: 'https://api.github.com/users/octocat/orgs',
repos_url: 'https://api.github.com/users/octocat/repos',
events_url: 'https://api.github.com/users/octocat/events{/privacy}',
received_events_url:
'https://api.github.com/users/octocat/received_events',
type: 'User',
site_admin: false,
},
open_issues: 4,
closed_issues: 8,
created_at: '2011-04-10T20:09:31Z',
updated_at: '2014-03-03T18:58:10Z',
closed_at: '2013-02-12T13:22:01Z',
due_on: '2012-10-09T23:39:01Z',
},
locked: false,
comments: 0,
pull_request: {
url: 'https://api.github.com/repos/octocat/Hello-World/pulls/1347',
html_url: 'https://github.com/octocat/Hello-World/pull/1347',
diff_url: 'https://github.com/octocat/Hello-World/pull/1347.diff',
patch_url: 'https://github.com/octocat/Hello-World/pull/1347.patch',
},
closed_at: null,
created_at: '2011-04-22T13:33:48Z',
updated_at: '2011-04-22T13:33:48Z',
closed_by: {
login: 'octocat',
id: 1,
avatar_url: 'https://github.com/images/error/octocat_happy.gif',
gravatar_id: '',
url: 'https://api.github.com/users/octocat',
html_url: 'https://github.com/octocat',
followers_url: 'https://api.github.com/users/octocat/followers',
following_url:
'https://api.github.com/users/octocat/following{/other_user}',
gists_url: 'https://api.github.com/users/octocat/gists{/gist_id}',
starred_url: 'https://api.github.com/users/octocat/starred{/owner}{/repo}',
subscriptions_url: 'https://api.github.com/users/octocat/subscriptions',
organizations_url: 'https://api.github.com/users/octocat/orgs',
repos_url: 'https://api.github.com/users/octocat/repos',
events_url: 'https://api.github.com/users/octocat/events{/privacy}',
received_events_url: 'https://api.github.com/users/octocat/received_events',
type: 'User',
site_admin: false,
},
};

View file

@ -0,0 +1,126 @@
module.exports = {
id: 1296269,
owner: {
login: 'octocat',
id: 1,
avatar_url: 'https://github.com/images/error/octocat_happy.gif',
gravatar_id: '',
url: 'https://api.github.com/users/octocat',
html_url: 'https://github.com/octocat',
followers_url: 'https://api.github.com/users/octocat/followers',
following_url:
'https://api.github.com/users/octocat/following{/other_user}',
gists_url: 'https://api.github.com/users/octocat/gists{/gist_id}',
starred_url: 'https://api.github.com/users/octocat/starred{/owner}{/repo}',
subscriptions_url: 'https://api.github.com/users/octocat/subscriptions',
organizations_url: 'https://api.github.com/users/octocat/orgs',
repos_url: 'https://api.github.com/users/octocat/repos',
events_url: 'https://api.github.com/users/octocat/events{/privacy}',
received_events_url: 'https://api.github.com/users/octocat/received_events',
type: 'User',
site_admin: false,
},
name: 'Hello-World',
full_name: 'octocat/Hello-World',
description: 'This your first repo!',
private: false,
fork: false,
url: 'https://api.github.com/repos/octocat/Hello-World',
html_url: 'https://github.com/octocat/Hello-World',
archive_url:
'https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}',
assignees_url:
'https://api.github.com/repos/octocat/Hello-World/assignees{/user}',
blobs_url: 'https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}',
branches_url:
'https://api.github.com/repos/octocat/Hello-World/branches{/branch}',
clone_url: 'https://github.com/octocat/Hello-World.git',
collaborators_url:
'https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}',
comments_url:
'https://api.github.com/repos/octocat/Hello-World/comments{/number}',
commits_url: 'https://api.github.com/repos/octocat/Hello-World/commits{/sha}',
compare_url:
'https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}',
contents_url:
'https://api.github.com/repos/octocat/Hello-World/contents/{+path}',
contributors_url:
'https://api.github.com/repos/octocat/Hello-World/contributors',
deployments_url:
'https://api.github.com/repos/octocat/Hello-World/deployments',
downloads_url: 'https://api.github.com/repos/octocat/Hello-World/downloads',
events_url: 'https://api.github.com/repos/octocat/Hello-World/events',
forks_url: 'https://api.github.com/repos/octocat/Hello-World/forks',
git_commits_url:
'https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}',
git_refs_url:
'https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}',
git_tags_url:
'https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}',
git_url: 'git:github.com/octocat/Hello-World.git',
hooks_url: 'https://api.github.com/repos/octocat/Hello-World/hooks',
issue_comment_url:
'https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}',
issue_events_url:
'https://api.github.com/repos/octocat/Hello-World/issues/events{/number}',
issues_url:
'https://api.github.com/repos/octocat/Hello-World/issues{/number}',
keys_url: 'https://api.github.com/repos/octocat/Hello-World/keys{/key_id}',
labels_url: 'https://api.github.com/repos/octocat/Hello-World/labels{/name}',
languages_url: 'https://api.github.com/repos/octocat/Hello-World/languages',
merges_url: 'https://api.github.com/repos/octocat/Hello-World/merges',
milestones_url:
'https://api.github.com/repos/octocat/Hello-World/milestones{/number}',
mirror_url: 'git:git.example.com/octocat/Hello-World',
notifications_url:
'https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}',
pulls_url: 'https://api.github.com/repos/octocat/Hello-World/pulls{/number}',
releases_url:
'https://api.github.com/repos/octocat/Hello-World/releases{/id}',
ssh_url: 'git@github.com:octocat/Hello-World.git',
stargazers_url: 'https://api.github.com/repos/octocat/Hello-World/stargazers',
statuses_url:
'https://api.github.com/repos/octocat/Hello-World/statuses/{sha}',
subscribers_url:
'https://api.github.com/repos/octocat/Hello-World/subscribers',
subscription_url:
'https://api.github.com/repos/octocat/Hello-World/subscription',
svn_url: 'https://svn.github.com/octocat/Hello-World',
tags_url: 'https://api.github.com/repos/octocat/Hello-World/tags',
teams_url: 'https://api.github.com/repos/octocat/Hello-World/teams',
trees_url: 'https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}',
homepage: 'https://github.com',
language: null,
forks_count: 9,
stargazers_count: 80,
watchers_count: 80,
size: 108,
default_branch: 'master',
open_issues_count: 0,
topics: ['octocat', 'atom', 'electron', 'API'],
has_issues: true,
has_wiki: true,
has_pages: false,
has_downloads: true,
archived: false,
pushed_at: '2011-01-26T19:06:43Z',
created_at: '2011-01-26T19:01:12Z',
updated_at: '2011-01-26T19:14:43Z',
permissions: {
admin: false,
push: false,
pull: true,
},
allow_rebase_merge: true,
allow_squash_merge: true,
allow_merge_commit: true,
subscribers_count: 42,
network_count: 0,
license: {
key: 'mit',
name: 'MIT License',
spdx_id: 'MIT',
url: 'https://api.github.com/licenses/mit',
html_url: 'https://choosealicense.com/licenses/mit/',
},
};

View file

@ -0,0 +1,110 @@
/* globals describe, it, expect, beforeAll, beforeEach, afterEach */
const zapier = require('zapier-platform-core');
const nock = require('nock');
zapier.tools.env.inject(); // read from the .env file
const App = require('../index');
const appTester = zapier.createAppTester(App);
// Only here so the tests out of the box.
// You should create a `.env` file and populate it with the necessarily configuration
// it should look like:
/*
CLIENT_ID=1234
CLIENT_SECRET=asdf
*/
// then you can delete the following 2 lines
process.env.CLIENT_ID = process.env.CLIENT_ID || '1234';
process.env.CLIENT_SECRET = process.env.CLIENT_SECRET || 'asdf';
describe('oauth2 app', () => {
beforeAll(() => {
// It's a good idea to store your Client ID and Secret in the environment rather than in code.
if (!(process.env.CLIENT_ID && process.env.CLIENT_SECRET)) {
throw new Error(
`Before running the tests, make sure CLIENT_ID and CLIENT_SECRET are available in the environment.`,
);
}
});
afterEach(() => {
nock.cleanAll();
});
it('generates an authorize URL', async () => {
const bundle = {
// In production, these will be generated by Zapier and set automatically
inputData: {
state: '4444',
redirect_uri: 'https://zapier.com/',
},
environment: {
CLIENT_ID: process.env.CLIENT_ID,
CLIENT_SECRET: process.env.CLIENT_SECRET,
},
};
const authorizeUrl = await appTester(
App.authentication.oauth2Config.authorizeUrl,
bundle,
);
expect(authorizeUrl).toBe(
'https://github.com/login/oauth/authorize?client_id=1234&state=4444&redirect_uri=https%3A%2F%2Fzapier.com%2F&response_type=code',
);
});
});
describe('getAccessToken', () => {
beforeEach(async () => {
nock('https://github.com/login/oauth')
.post('/access_token')
.reply(200, { access_token: 'someAccessToken' });
});
afterEach(() => {
nock.cleanAll();
});
it('returns the expected tokens', async () => {
const result = await appTester(
App.authentication.oauth2Config.getAccessToken,
);
expect(result.access_token).toBe('someAccessToken');
});
});
describe('testAuth', () => {
const bundle = {
// In production, these will be generated by Zapier and set automatically
inputData: {
state: '4444',
redirect_uri: 'https://zapier.com/',
},
environment: {
CLIENT_ID: process.env.CLIENT_ID,
CLIENT_SECRET: process.env.CLIENT_SECRET,
},
};
beforeEach(async () => {
nock('https://api.github.com')
.get('/user')
.reply(200, {
json: {
login: 'myLogin',
},
});
});
afterEach(() => {
nock.cleanAll();
});
it('returns the expected info', async () => {
const result = await appTester(App.authentication.test, bundle);
expect(result.data.json.login).toBe('myLogin');
});
});

View file

@ -0,0 +1,59 @@
const sample = require('../samples/sample_issue');
const triggerIssue = (z, bundle) => {
const responsePromise = z.request({
method: 'GET',
url: `https://api.github.com/repos/${bundle.inputData.repo}/issues`,
params: {
filter: bundle.inputData.filter,
state: bundle.inputData.state,
sort: 'updated',
direction: 'desc',
},
});
return responsePromise.then((response) => response.data);
};
module.exports = {
key: 'issue',
noun: 'Issue',
display: {
label: 'New Issue',
description: 'Triggers on a new issue.',
},
operation: {
inputFields: [
{
key: 'repo',
label: 'Repo',
required: true,
dynamic: 'repo.full_name.full_name',
},
{
key: 'filter',
required: false,
label: 'Filter',
choices: {
assigned: 'assigned',
created: 'created',
mentioned: 'mentioned',
subscribed: 'subscribed',
all: 'all',
},
helpText: 'Default is "assigned"',
},
{
key: 'state',
required: false,
label: 'State',
choices: { open: 'open', closed: 'closed', all: 'all' },
helpText: 'Default is "open"',
},
],
perform: triggerIssue,
sample: sample,
},
};

View file

@ -0,0 +1,26 @@
const sample = require('../samples/sample_repo_list');
const triggerRepo = (z, bundle) => {
const responsePromise = z.request({
url: 'https://api.github.com/user/repos?per_page=100',
});
return responsePromise.then((response) => response.data);
};
module.exports = {
key: 'repo',
noun: 'Repo',
display: {
label: 'Get Repo',
hidden: true,
description:
'The only purpose of this trigger is to populate the dropdown list of repos in the UI, thus, it is hidden.',
},
operation: {
inputFields: [],
perform: triggerRepo,
sample: sample,
},
};

View file

@ -0,0 +1,66 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/
dist/
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# environment variables file
.env
.environment
# next.js build output
.next
.pnpm-store/

Some files were not shown because too many files have changed in this diff Show more