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 @@
# 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');
});
});