Initial import of verae-activate from zapier monorepo

This commit is contained in:
George Lambert 2026-09-11 14:59:35 -04:00
commit 132616d74b
12 changed files with 1367 additions and 0 deletions

54
creates/timestamp.js Normal file
View file

@ -0,0 +1,54 @@
/**
* Create Timestamp hosted if api_base+api_key, else local mock job.
* @module creates/timestamp
*/
const { randomUUID } = require('node:crypto');
const perform = async (z, bundle) => {
const data = String(bundle.inputData.data ?? '');
const sha256 = bundle.inputData.sha256;
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({
method: 'POST',
url: `${base}/v1/timestamp`,
headers: { 'x-api-key': key, 'content-type': 'application/json' },
body: { data, sha256, hashAlg: bundle.inputData.hashAlg },
});
return { ...(response.data || {}), mode: 'hosted' };
}
return {
jobId: randomUUID(),
sha256: sha256 || null,
existing: false,
mode: 'local-mock',
note: 'No API configured — mock jobId only. Set API base + key to hit zappier /v1/timestamp.',
};
};
module.exports = {
key: 'create_timestamp',
noun: 'Timestamp',
display: {
label: 'Create Timestamp',
description: 'Registers data/SHA256. Local mock if no API; hosted zappier when connected.',
},
operation: {
cleanInputData: false,
inputFields: [
{ key: 'data', label: 'Data', type: 'text', required: false },
{ key: 'sha256', label: 'SHA256 hex', type: 'string', required: false },
{ key: 'hashAlg', label: 'Hash algorithm', type: 'string', required: false, default: 'SHA256' },
],
perform,
sample: { jobId: '00000000-0000-4000-8000-000000000000', existing: false, mode: 'local-mock' },
outputFields: [
{ key: 'jobId', type: 'string' },
{ key: 'sha256', type: 'string' },
{ key: 'existing', type: 'boolean' },
{ key: 'mode', type: 'string' },
],
},
};