Keep-going: tree shares, health flags, CI, compose, timestamp Zapier action
Directory-tree encrypted share mock; /health reports mockVerae/nats; middleware OpenAPI extended; zappier receipt by jobId; activate Create Timestamp (local mock or hosted); GitHub Actions test:offline; compose builds zappier image; seed-demo.mjs. No Zapier login or live Verae required.
This commit is contained in:
parent
645a24909a
commit
5925e76c72
39 changed files with 514 additions and 33 deletions
54
packages/verae-activate/creates/timestamp.js
Normal file
54
packages/verae-activate/creates/timestamp.js
Normal 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' },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -11,6 +11,7 @@ const authentication = require('./authentication');
|
|||
const addNumbers = require('./creates/add_numbers');
|
||||
const echo = require('./creates/echo');
|
||||
const sha256Hash = require('./creates/sha256');
|
||||
const createTimestamp = require('./creates/timestamp');
|
||||
|
||||
module.exports = {
|
||||
version: require('./package.json').version,
|
||||
|
|
@ -20,5 +21,6 @@ module.exports = {
|
|||
[addNumbers.key]: addNumbers,
|
||||
[echo.key]: echo,
|
||||
[sha256Hash.key]: sha256Hash,
|
||||
[createTimestamp.key]: createTimestamp,
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ describe('verae-activate app', () => {
|
|||
assert.ok(App.creates.add_numbers);
|
||||
assert.ok(App.creates.echo);
|
||||
assert.ok(App.creates.sha256_hash);
|
||||
assert.ok(App.creates.create_timestamp);
|
||||
assert.equal(addNumbers.key, 'add_numbers');
|
||||
assert.ok(addNumbers.operation.inputFields.some((f) => f.key === 'number1'));
|
||||
assert.ok(addNumbers.operation.inputFields.some((f) => f.key === 'number2'));
|
||||
|
|
@ -65,6 +66,16 @@ describe('verae-activate app', () => {
|
|||
assert.equal(result.sum, 5);
|
||||
});
|
||||
|
||||
it('create timestamp local mock without API', async () => {
|
||||
const ts = require('../creates/timestamp');
|
||||
const out = await ts.operation.perform(
|
||||
{ request: async () => { throw new Error('no http'); } },
|
||||
{ inputData: { data: 'x' }, authData: {} },
|
||||
);
|
||||
assert.equal(out.mode, 'local-mock');
|
||||
assert.ok(out.jobId);
|
||||
});
|
||||
|
||||
it('sha256 hashes hello', async () => {
|
||||
const sha = require('../creates/sha256');
|
||||
const out = await sha.operation.perform({}, { inputData: { text: 'hello' }, authData: {} });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue