34 lines
916 B
JavaScript
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',
|
|
},
|
|
},
|
|
};
|