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/oauth1-tumblr/.gitignore
vendored
Normal file
6
vendor/zapier-platform/example-apps/oauth1-tumblr/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
build
|
||||
docs
|
||||
node_modules
|
||||
*.log
|
||||
.environment
|
||||
.env
|
||||
7
vendor/zapier-platform/example-apps/oauth1-tumblr/.travis.yml
vendored
Normal file
7
vendor/zapier-platform/example-apps/oauth1-tumblr/.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
|
||||
5
vendor/zapier-platform/example-apps/oauth1-tumblr/README.md
vendored
Normal file
5
vendor/zapier-platform/example-apps/oauth1-tumblr/README.md
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# "OAuth1" Tumblr Example App For Zapier Platform
|
||||
|
||||
Requires CLI **7.5.0** and above! A barebones app that has OAuth1 setup, using Tumblr for example.
|
||||
|
||||
> We recommend using the zapier-platform-cli and `zapier-platform init . --template=oauth1-tumblr` to create an app.
|
||||
76
vendor/zapier-platform/example-apps/oauth1-tumblr/authentication.js
vendored
Normal file
76
vendor/zapier-platform/example-apps/oauth1-tumblr/authentication.js
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
const _ = require('lodash');
|
||||
|
||||
const REQUEST_TOKEN_URL = 'https://www.tumblr.com/oauth/request_token';
|
||||
const ACCESS_TOKEN_URL = 'https://www.tumblr.com/oauth/access_token';
|
||||
const AUTHORIZE_URL = 'https://www.tumblr.com/oauth/authorize';
|
||||
|
||||
const getConnectionLabel = (z, bundle) => {
|
||||
try {
|
||||
return bundle.inputData.response.user.name;
|
||||
} catch (err) {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
const config = {
|
||||
type: 'oauth1',
|
||||
oauth1Config: {
|
||||
getRequestToken: {
|
||||
url: REQUEST_TOKEN_URL,
|
||||
method: 'POST',
|
||||
auth: {
|
||||
oauth_consumer_key: '{{process.env.CLIENT_ID}}',
|
||||
oauth_consumer_secret: '{{process.env.CLIENT_SECRET}}',
|
||||
oauth_signature_method: 'HMAC-SHA1',
|
||||
oauth_callback: '{{bundle.inputData.redirect_uri}}',
|
||||
},
|
||||
},
|
||||
authorizeUrl: {
|
||||
url: AUTHORIZE_URL,
|
||||
params: {
|
||||
oauth_token: '{{bundle.inputData.oauth_token}}',
|
||||
},
|
||||
},
|
||||
getAccessToken: {
|
||||
url: ACCESS_TOKEN_URL,
|
||||
method: 'POST',
|
||||
auth: {
|
||||
oauth_consumer_key: '{{process.env.CLIENT_ID}}',
|
||||
oauth_consumer_secret: '{{process.env.CLIENT_SECRET}}',
|
||||
oauth_token: '{{bundle.inputData.oauth_token}}',
|
||||
oauth_token_secret: '{{bundle.inputData.oauth_token_secret}}',
|
||||
oauth_verifier: '{{bundle.inputData.oauth_verifier}}',
|
||||
},
|
||||
},
|
||||
},
|
||||
test: {
|
||||
url: 'https://api.tumblr.com/v2/user/info',
|
||||
},
|
||||
connectionLabel: getConnectionLabel,
|
||||
};
|
||||
|
||||
// A middleware that is run before z.request() actually makes the request. Here we're
|
||||
// adding necessary OAuth1 parameters to `auth` property of the request object.
|
||||
const includeAccessToken = (req, z, bundle) => {
|
||||
if (
|
||||
bundle.authData &&
|
||||
bundle.authData.oauth_token &&
|
||||
bundle.authData.oauth_token_secret
|
||||
) {
|
||||
// Just put your OAuth1 credentials in req.auth, Zapier will sign the request for
|
||||
// you.
|
||||
req.auth = req.auth || {};
|
||||
_.defaults(req.auth, {
|
||||
oauth_consumer_key: process.env.CLIENT_ID,
|
||||
oauth_consumer_secret: process.env.CLIENT_SECRET,
|
||||
oauth_token: bundle.authData.oauth_token,
|
||||
oauth_token_secret: bundle.authData.oauth_token_secret,
|
||||
});
|
||||
}
|
||||
return req;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
config,
|
||||
includeAccessToken,
|
||||
};
|
||||
34
vendor/zapier-platform/example-apps/oauth1-tumblr/index.js
vendored
Normal file
34
vendor/zapier-platform/example-apps/oauth1-tumblr/index.js
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
const LikeTrigger = require('./triggers/like');
|
||||
const authentication = require('./authentication');
|
||||
|
||||
// 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,
|
||||
|
||||
authentication: authentication.config,
|
||||
|
||||
// beforeRequest & afterResponse are optional hooks into the provided HTTP client
|
||||
beforeRequest: [authentication.includeAccessToken],
|
||||
|
||||
afterResponse: [],
|
||||
|
||||
// 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: {
|
||||
[LikeTrigger.key]: LikeTrigger,
|
||||
},
|
||||
|
||||
// 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: {},
|
||||
};
|
||||
|
||||
// Finally, export the app.
|
||||
module.exports = App;
|
||||
25
vendor/zapier-platform/example-apps/oauth1-tumblr/package.json
vendored
Normal file
25
vendor/zapier-platform/example-apps/oauth1-tumblr/package.json
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "zapier-platform-example-app-oauth1-tumblr",
|
||||
"version": "1.0.0",
|
||||
"description": "Tumblr OAuth V1 Example",
|
||||
"repository": "zapier/zapier-platform-example-app-oauth1-tumblr",
|
||||
"homepage": "https://zapier.com/",
|
||||
"author": "Chang-Hung Liang <chang-hung.liang@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
|
||||
}
|
||||
21
vendor/zapier-platform/example-apps/oauth1-tumblr/test/index.js
vendored
Normal file
21
vendor/zapier-platform/example-apps/oauth1-tumblr/test/index.js
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/* globals describe, it */
|
||||
|
||||
require('should');
|
||||
|
||||
// Uncomment and use this to make test calls into your app:
|
||||
|
||||
// const zapier = require('zapier-platform-core');
|
||||
// const App = require('../index');
|
||||
// const appTester = zapier.createAppTester(App);
|
||||
|
||||
describe('My App', () => {
|
||||
it('should test something', (done) => {
|
||||
const x = 1;
|
||||
x.should.eql(1);
|
||||
|
||||
// const bundle = { inputData: {} };
|
||||
// const results = appTester(App.triggers.SOME_TRIGGER.operation.perform, bundle);
|
||||
// results.length.should.eql(3);
|
||||
done();
|
||||
});
|
||||
});
|
||||
35
vendor/zapier-platform/example-apps/oauth1-tumblr/triggers/like.js
vendored
Normal file
35
vendor/zapier-platform/example-apps/oauth1-tumblr/triggers/like.js
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
const perform = async (z, bundle) => {
|
||||
const url = 'https://api.tumblr.com/v2/user/likes';
|
||||
const response = await z.request(url);
|
||||
const result = response.data;
|
||||
return result.response.liked_posts || [];
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
key: 'like',
|
||||
noun: 'Like',
|
||||
|
||||
display: {
|
||||
label: 'New Like',
|
||||
description: 'Triggers when you like a post.',
|
||||
},
|
||||
|
||||
operation: {
|
||||
perform,
|
||||
sample: {
|
||||
blog_name: 'citriccomics',
|
||||
id: 3507845453,
|
||||
post_url: 'https://citriccomics.tumblr.com/post/3507845453',
|
||||
type: 'text',
|
||||
date: '2011-02-25 20:27:00 GMT',
|
||||
timestamp: 1298665620,
|
||||
state: 'published',
|
||||
format: 'html',
|
||||
reblog_key: 'b0baQtsl',
|
||||
tags: ['tumblrize', 'milky dog', 'mini comic'],
|
||||
note_count: 14,
|
||||
title: 'Milky Dog',
|
||||
body: '<p>Example body.</p>',
|
||||
},
|
||||
},
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue