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,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 @@
# session-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,61 @@
'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' });
const getSessionKey = async (z, bundle) => {
const response = await z.request({
url: 'https://httpbin.zapier-tooling.com/post',
method: 'POST',
body: {
username: bundle.authData.username,
password: bundle.authData.password,
},
});
// If you're using core v9.x or older, you should call response.throwForStatus()
// or verify response.status === 200 before you continue.
return {
// FIXME: The `|| "secret"` below is just for demo purposes, you should remove it.
sessionKey: response.data.sessionKey || 'secret',
};
};
module.exports = {
// "session" auth exchanges user data for a different session token (that may be
// periodically refreshed")
type: 'session',
sessionConfig: { perform: getSessionKey },
// Define any input app's auth requires here. The user will be prompted to enter
// this info when they connect their account.
fields: [
{ key: 'username', label: 'Username', required: true },
{
key: 'password',
label: 'Password',
required: true,
// this lets the user enter masked data
type: 'password',
},
],
// 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,14 @@
'use strict';
// 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 includeSessionKeyHeader = (request, z, bundle) => {
if (bundle.authData.sessionKey) {
request.headers = request.headers || {};
request.headers['X-API-Key'] = bundle.authData.sessionKey;
}
return request;
};
module.exports = { befores: [includeSessionKeyHeader], afters: [] };

View file

@ -0,0 +1,16 @@
{
"name": "session-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,37 @@
/* globals describe, it, expect */
const zapier = require('zapier-platform-core');
const App = require('../index');
const appTester = zapier.createAppTester(App);
describe('session auth app', () => {
it('has an exchange for username/password', async () => {
const bundle = {
authData: {
username: 'bryan',
password: 'hunter2',
},
};
const newAuthData = await appTester(
App.authentication.sessionConfig.perform,
bundle,
);
expect(newAuthData.sessionKey).toBe('secret');
});
it('has auth details added to every request', async () => {
const bundle = {
authData: {
sessionKey: 'secret',
},
};
const response = await appTester(App.authentication.test, bundle);
expect(response.status).toBe(200);
expect(response.request.headers['X-API-Key']).toBe('secret');
});
});