Initial import of verae-zapier-app from zapier monorepo
This commit is contained in:
commit
c19bccd652
16 changed files with 618 additions and 0 deletions
2
creates/add_numbers.js
Normal file
2
creates/add_numbers.js
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/** Re-export activate-now Add Numbers so this package stays self-contained. */
|
||||
module.exports = require('../../verae-activate/creates/add_numbers');
|
||||
39
creates/batch_timestamp.js
Normal file
39
creates/batch_timestamp.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
const base = () => process.env.MIDDLEWARE_BASE_URL || 'http://127.0.0.1:3100';
|
||||
|
||||
const perform = async (z, bundle) => {
|
||||
const items = (bundle.inputData.items || '')
|
||||
.split('\n')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean)
|
||||
.map((data) => ({ data }));
|
||||
|
||||
const response = await z.request({
|
||||
method: 'POST',
|
||||
url: `${base()}/zapier/v1/timestamp/batch`,
|
||||
body: { items },
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
key: 'batch_timestamp',
|
||||
noun: 'Timestamp',
|
||||
display: {
|
||||
label: 'Create Batch Timestamps',
|
||||
description: 'Submit multiple data lines for timestamping (paid plans).',
|
||||
},
|
||||
operation: {
|
||||
inputFields: [
|
||||
{
|
||||
key: 'items',
|
||||
label: 'Data Lines',
|
||||
type: 'text',
|
||||
required: true,
|
||||
helpText: 'One payload per line.',
|
||||
},
|
||||
],
|
||||
perform,
|
||||
sample: { jobIds: ['id-1', 'id-2'] },
|
||||
outputFields: [{ key: 'jobIds', label: 'Job IDs' }],
|
||||
},
|
||||
};
|
||||
37
creates/create_timestamp.js
Normal file
37
creates/create_timestamp.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
const base = () => process.env.MIDDLEWARE_BASE_URL || 'http://127.0.0.1:3100';
|
||||
|
||||
const perform = async (z, bundle) => {
|
||||
const response = await z.request({
|
||||
method: 'POST',
|
||||
url: `${base()}/zapier/v1/timestamp`,
|
||||
body: {
|
||||
data: bundle.inputData.data,
|
||||
hashAlg: bundle.inputData.hashAlg || undefined,
|
||||
},
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
key: 'create_timestamp',
|
||||
noun: 'Timestamp',
|
||||
display: {
|
||||
label: 'Create Timestamp (Async)',
|
||||
description: 'Submits data for timestamping and returns a job ID.',
|
||||
},
|
||||
operation: {
|
||||
inputFields: [
|
||||
{ key: 'data', label: 'Data', type: 'string', required: true },
|
||||
{
|
||||
key: 'hashAlg',
|
||||
label: 'Hash Algorithm',
|
||||
type: 'string',
|
||||
required: false,
|
||||
default: 'SHA256',
|
||||
},
|
||||
],
|
||||
perform,
|
||||
sample: { jobId: '550e8400-e29b-41d4-a716-446655440000' },
|
||||
outputFields: [{ key: 'jobId', label: 'Job ID' }],
|
||||
},
|
||||
};
|
||||
54
creates/timestamp_and_wait.js
Normal file
54
creates/timestamp_and_wait.js
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
const base = () => process.env.MIDDLEWARE_BASE_URL || 'http://127.0.0.1:3100';
|
||||
|
||||
const perform = async (z, bundle) => {
|
||||
const response = await z.request({
|
||||
method: 'POST',
|
||||
url: `${base()}/zapier/v1/timestamp/wait`,
|
||||
body: {
|
||||
data: bundle.inputData.data,
|
||||
hashAlg: bundle.inputData.hashAlg || undefined,
|
||||
},
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
key: 'timestamp_and_wait',
|
||||
noun: 'Timestamp',
|
||||
display: {
|
||||
label: 'Create Timestamp and Wait',
|
||||
description:
|
||||
'Submits data for blockchain timestamping and waits for the certificate.',
|
||||
},
|
||||
operation: {
|
||||
inputFields: [
|
||||
{
|
||||
key: 'data',
|
||||
label: 'Data',
|
||||
type: 'string',
|
||||
required: true,
|
||||
helpText: 'Content to timestamp on the blockchain.',
|
||||
},
|
||||
{
|
||||
key: 'hashAlg',
|
||||
label: 'Hash Algorithm',
|
||||
type: 'string',
|
||||
required: false,
|
||||
default: 'SHA256',
|
||||
},
|
||||
],
|
||||
perform,
|
||||
sample: {
|
||||
id: '550e8400-e29b-41d4-a716-446655440000',
|
||||
status: 'completed',
|
||||
result: 'mock-cert-example',
|
||||
completedAt: '2023-01-01T12:05:00Z',
|
||||
},
|
||||
outputFields: [
|
||||
{ key: 'id', label: 'Job ID' },
|
||||
{ key: 'status', label: 'Status' },
|
||||
{ key: 'result', label: 'Certificate' },
|
||||
{ key: 'completedAt', label: 'Completed At', type: 'datetime' },
|
||||
],
|
||||
},
|
||||
};
|
||||
36
creates/verify_timestamp.js
Normal file
36
creates/verify_timestamp.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
const base = () => process.env.MIDDLEWARE_BASE_URL || 'http://127.0.0.1:3100';
|
||||
|
||||
const perform = async (z, bundle) => {
|
||||
const response = await z.request({
|
||||
method: 'POST',
|
||||
url: `${base()}/zapier/v1/verify`,
|
||||
body: { certificate: bundle.inputData.certificate },
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
key: 'verify_timestamp',
|
||||
noun: 'Verification',
|
||||
display: {
|
||||
label: 'Verify Timestamp',
|
||||
description: 'Verify a timestamp certificate.',
|
||||
},
|
||||
operation: {
|
||||
inputFields: [
|
||||
{
|
||||
key: 'certificate',
|
||||
label: 'Certificate',
|
||||
type: 'text',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
perform,
|
||||
sample: { valid: true, timestamp: '2023-01-01T12:00:00Z', blockIndex: 42 },
|
||||
outputFields: [
|
||||
{ key: 'valid', label: 'Valid', type: 'boolean' },
|
||||
{ key: 'timestamp', label: 'Timestamp', type: 'datetime' },
|
||||
{ key: 'blockIndex', label: 'Block Index', type: 'integer' },
|
||||
],
|
||||
},
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue