Milestone 0: import zappier billing, Verae middleware, and Zapier research
Compose-ready workspace: packages/zappier (rate card, portal, Stripe), packages/verae-zapier-middleware (timestamp + NATS), packages/verae-zapier (CLI app), vendor/zapier-platform, and research/zapier vendor corpus. Gate 0 structure checks pass. Product code and research are not yet wired.
This commit is contained in:
commit
b4150c8250
1364 changed files with 6814366 additions and 0 deletions
|
|
@ -0,0 +1,65 @@
|
|||
import type { Bundle, ZObject } from 'zapier-platform-core';
|
||||
|
||||
import { zapierV1 } from '../lib/base.js';
|
||||
|
||||
const subscribe = async (z: ZObject, bundle: Bundle) => {
|
||||
const response = await z.request({
|
||||
url: zapierV1(bundle, '/webhooks/subscribe'),
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
||||
json: {
|
||||
targetUrl: bundle.targetUrl,
|
||||
event: 'timestamp.completed',
|
||||
},
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const unsubscribe = async (z: ZObject, bundle: Bundle) => {
|
||||
const hookId = bundle.subscribeData?.id;
|
||||
const response = await z.request({
|
||||
url: zapierV1(bundle, '/webhooks/unsubscribe'),
|
||||
method: 'DELETE',
|
||||
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
||||
json: { hookId },
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const perform = async (_z: ZObject, bundle: Bundle) => {
|
||||
const payload = bundle.cleanedRequest;
|
||||
if (!payload) return [];
|
||||
return Array.isArray(payload) ? payload : [payload];
|
||||
};
|
||||
|
||||
const performList = async () => [
|
||||
{
|
||||
id: 'sample-job',
|
||||
event: 'timestamp.completed',
|
||||
jobId: '550e8400-e29b-41d4-a716-446655440000',
|
||||
status: 'completed',
|
||||
result: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
|
||||
},
|
||||
];
|
||||
|
||||
export default {
|
||||
key: 'timestamp_completed',
|
||||
noun: 'Timestamp',
|
||||
display: {
|
||||
label: 'Timestamp Completed',
|
||||
description: 'Triggers when the middleware finishes a timestamp job (REST Hook).',
|
||||
},
|
||||
operation: {
|
||||
type: 'hook' as const,
|
||||
performSubscribe: subscribe,
|
||||
performUnsubscribe: unsubscribe,
|
||||
perform,
|
||||
performList,
|
||||
sample: {
|
||||
id: 'sample-job',
|
||||
event: 'timestamp.completed',
|
||||
jobId: '550e8400-e29b-41d4-a716-446655440000',
|
||||
status: 'completed',
|
||||
},
|
||||
},
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue