Initial import of verae-activate from zapier monorepo

This commit is contained in:
George Lambert 2026-09-11 13:37:28 -04:00
commit 803d2360b4
12 changed files with 1363 additions and 0 deletions

57
authentication.js Normal file
View file

@ -0,0 +1,57 @@
/**
* Connection for the activate-now Zapier app.
*
* No live Verae or zappier server is required. The test always succeeds so a
* developer can push and run Add Numbers before billing or timestamping is wired.
*
* Optional later: set ZAPPIER_API_BASE + api_key to send Add Numbers through
* packages/zappier POST /v1/add.
*
* @module authentication
*/
/**
* @param {object} z
* @param {object} bundle
* @returns {Promise<{ok: boolean, mode: string, label: string}>}
*/
const testAuth = async (z, bundle) => {
const base = (bundle.authData.api_base || process.env.ZAPPIER_API_BASE || '').replace(/\/$/, '');
const key = bundle.authData.api_key || '';
if (base && key) {
const response = await z.request({
url: `${base}/v1/status`,
headers: { 'x-api-key': key },
});
return {
ok: true,
mode: 'hosted',
label: response.data?.status === 'ok' ? 'zappier' : 'hosted',
};
}
return { ok: true, mode: 'local', label: 'Verae Time (Add Numbers)' };
};
module.exports = {
type: 'custom',
fields: [
{
key: 'api_key',
type: 'string',
required: false,
label: 'API Key (optional)',
helpText:
'Leave blank for Add Numbers (runs inside Zapier). Later, paste a key from your zappier portal. See https://github.com/zapier/zapier-platform#authentication',
},
{
key: 'api_base',
type: 'string',
required: false,
label: 'API base URL (optional)',
helpText:
'Example: https://your-host.example.com — only needed when routing Add Numbers to hosted /v1/add.',
},
],
test: testAuth,
connectionLabel: '{{label}}',
};