master-zapier-plan-draft/packages/verae-zapier/searches/hash_lookup.js
George Lambert 51ae79b75f Milestone 3: NATS wait (gate 9), hash lookup, zappier timestamp, NS1 tunnel
Wait-via-NATS returns completed or pending+jobId (GATE 9). Mock SHA256
idempotent register + GET /hashes/{sha256}. Zappier commercial edge has
POST /v1/timestamp and hash-lookup. GATE 12 smoke (signup + wait) passes.

NS1 NATS is 127.0.0.1:4222 on 70.88.205.138; SSH tunnel :14222. Local
nats-server -js used for isolated tests. Activate app adds Echo Text.

Learned: JetStream on NS1 is loopback-only; do not bind 4222 public.
2026-09-09 02:54:02 -04:00

34 lines
916 B
JavaScript

const base = () => process.env.MIDDLEWARE_BASE_URL || 'http://127.0.0.1:3100';
const perform = async (z, bundle) => {
try {
const response = await z.request({
method: 'GET',
url: `${base()}/zapier/v1/hashes/${encodeURIComponent(bundle.inputData.sha256)}`,
});
return [response.data];
} catch (err) {
if (err.status === 404) return [];
throw err;
}
};
module.exports = {
key: 'hash_lookup',
noun: 'Timestamp',
display: {
label: 'Find Timestamp by SHA256',
description: 'Looks up an existing timestamp for a SHA256 hex digest (mock/middleware).',
},
operation: {
inputFields: [
{ key: 'sha256', label: 'SHA256', type: 'string', required: true },
],
perform,
sample: {
sha256: '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824',
exists: true,
jobId: '550e8400-e29b-41d4-a716-446655440000',
},
},
};