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.
This commit is contained in:
parent
10c663cc0c
commit
51ae79b75f
75 changed files with 1114 additions and 123 deletions
|
|
@ -10,6 +10,7 @@ const verifyTimestamp = require('./creates/verify_timestamp');
|
|||
const batchTimestamp = require('./creates/batch_timestamp');
|
||||
const addNumbers = require('./creates/add_numbers');
|
||||
const jobStatus = require('./searches/job_status');
|
||||
const hashLookup = require('./searches/hash_lookup');
|
||||
const timestampCompleted = require('./triggers/timestamp_completed');
|
||||
|
||||
/**
|
||||
|
|
@ -74,5 +75,6 @@ module.exports = {
|
|||
},
|
||||
searches: {
|
||||
[jobStatus.key]: jobStatus,
|
||||
[hashLookup.key]: hashLookup,
|
||||
},
|
||||
};
|
||||
|
|
|
|||
34
packages/verae-zapier/searches/hash_lookup.js
Normal file
34
packages/verae-zapier/searches/hash_lookup.js
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
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',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
@ -27,6 +27,7 @@ describe('verae-zapier app definition', () => {
|
|||
assert.ok(App.creates.verify_timestamp);
|
||||
assert.ok(App.creates.batch_timestamp);
|
||||
assert.ok(App.searches.job_status);
|
||||
assert.ok(App.searches.hash_lookup);
|
||||
assert.ok(App.triggers.timestamp_completed);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue