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:
commit
b4150c8250
1364 changed files with 6814366 additions and 0 deletions
6
vendor/zapier-platform/example-apps/create/.gitignore
vendored
Normal file
6
vendor/zapier-platform/example-apps/create/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
build
|
||||
docs
|
||||
node_modules
|
||||
*.log
|
||||
.environment
|
||||
.env
|
||||
7
vendor/zapier-platform/example-apps/create/.travis.yml
vendored
Normal file
7
vendor/zapier-platform/example-apps/create/.travis.yml
vendored
Normal 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
|
||||
7
vendor/zapier-platform/example-apps/create/README.md
vendored
Normal file
7
vendor/zapier-platform/example-apps/create/README.md
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# "Create" Example App For Zapier Platform
|
||||
|
||||
[](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 - you’ll be presented with a list of currently available templates to start with.
|
||||
80
vendor/zapier-platform/example-apps/create/creates/recipe.js
vendored
Normal file
80
vendor/zapier-platform/example-apps/create/creates/recipe.js
vendored
Normal 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' },
|
||||
],
|
||||
},
|
||||
};
|
||||
29
vendor/zapier-platform/example-apps/create/index.js
vendored
Normal file
29
vendor/zapier-platform/example-apps/create/index.js
vendored
Normal 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;
|
||||
25
vendor/zapier-platform/example-apps/create/package.json
vendored
Normal file
25
vendor/zapier-platform/example-apps/create/package.json
vendored
Normal 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
|
||||
}
|
||||
29
vendor/zapier-platform/example-apps/create/test/creates.js
vendored
Normal file
29
vendor/zapier-platform/example-apps/create/test/creates.js
vendored
Normal 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);
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue