@patchbay-nebius/agent 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +66 -2
- package/dist/chunk-JVXVCXNZ.js +2356 -0
- package/dist/chunk-JVXVCXNZ.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +360 -0
- package/dist/cli.js.map +1 -0
- package/dist/fixtures/typeform-pipedrive/attempt-1/README.md +41 -0
- package/dist/fixtures/typeform-pipedrive/attempt-1/src/connector.test.ts +111 -0
- package/dist/fixtures/typeform-pipedrive/attempt-1/src/connector.ts +93 -0
- package/dist/fixtures/typeform-pipedrive/attempt-1/src/fixtures.ts +173 -0
- package/dist/fixtures/typeform-pipedrive/final/README.md +41 -0
- package/dist/fixtures/typeform-pipedrive/final/src/connector.test.ts +111 -0
- package/dist/fixtures/typeform-pipedrive/final/src/connector.ts +94 -0
- package/dist/fixtures/typeform-pipedrive/final/src/fixtures.ts +173 -0
- package/dist/fixtures/typeform-pipedrive/meta.json +192 -0
- package/dist/fixtures/typeform-pipedrive/run.json +444 -0
- package/dist/index.d.ts +302 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/package.json +61 -4
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
{
|
|
2
|
+
"prompt": "When someone submits our Typeform contact form, create the lead in Pipedrive as organization, person and deal.",
|
|
3
|
+
"origin": "fixture",
|
|
4
|
+
"events": [
|
|
5
|
+
{
|
|
6
|
+
"type": "mode",
|
|
7
|
+
"mode": "live"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"type": "step",
|
|
11
|
+
"step": "plan",
|
|
12
|
+
"status": "start"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"type": "plan",
|
|
16
|
+
"plan": {
|
|
17
|
+
"summary": "On every Typeform form_response webhook, create a Pipedrive organization (if a company was given), a person linked to it, and a deal for that person.",
|
|
18
|
+
"source": {
|
|
19
|
+
"app": "Typeform",
|
|
20
|
+
"trigger": "form_response webhook",
|
|
21
|
+
"docsQuery": "Typeform webhooks form_response payload answers field ref"
|
|
22
|
+
},
|
|
23
|
+
"target": {
|
|
24
|
+
"app": "Pipedrive",
|
|
25
|
+
"action": "create organization, person and deal",
|
|
26
|
+
"docsQuery": "Pipedrive API v1 add person add deal add organization request body api token"
|
|
27
|
+
},
|
|
28
|
+
"fieldMapping": [
|
|
29
|
+
{
|
|
30
|
+
"from": "answer with field ref lead_name (text)",
|
|
31
|
+
"to": "person.name"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"from": "answer with field ref lead_email (email)",
|
|
35
|
+
"to": "person.email[0].value"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"from": "answer with field ref lead_phone (phone_number)",
|
|
39
|
+
"to": "person.phone[0].value"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"from": "answer with field ref lead_company (text)",
|
|
43
|
+
"to": "organization.name, deal title"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"assumptions": [
|
|
47
|
+
"Field refs are configurable because every Typeform form uses different refs.",
|
|
48
|
+
"Webhook signature verification happens before the connector is called.",
|
|
49
|
+
"Every submission is a new lead; no deduplication against existing persons."
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"type": "step",
|
|
55
|
+
"step": "plan",
|
|
56
|
+
"status": "done",
|
|
57
|
+
"detail": "On every Typeform form_response webhook, create a Pipedrive organization (if a company was given), a person linked to it, and a deal for that person."
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"type": "step",
|
|
61
|
+
"step": "research",
|
|
62
|
+
"status": "start"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"type": "log",
|
|
66
|
+
"step": "research",
|
|
67
|
+
"message": "Searched \"Typeform webhooks form_response payload answers field ref\": 5 results"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"type": "log",
|
|
71
|
+
"step": "research",
|
|
72
|
+
"message": "Searched \"Pipedrive API v1 add person add deal add organization request body api token\": 5 results"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"type": "log",
|
|
76
|
+
"step": "research",
|
|
77
|
+
"message": "Extracted 4 documentation pages"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"type": "sources",
|
|
81
|
+
"sources": [
|
|
82
|
+
{
|
|
83
|
+
"title": "Webhooks payload | Typeform Developer Platform",
|
|
84
|
+
"url": "https://www.typeform.com/developers/webhooks/example-payload/",
|
|
85
|
+
"official": true
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"title": "Webhooks | Typeform Developer Platform",
|
|
89
|
+
"url": "https://www.typeform.com/developers/webhooks/",
|
|
90
|
+
"official": true
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"title": "Persons - Pipedrive API Reference",
|
|
94
|
+
"url": "https://developers.pipedrive.com/docs/api/v1/Persons",
|
|
95
|
+
"official": true
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"title": "Deals - Pipedrive API Reference",
|
|
99
|
+
"url": "https://developers.pipedrive.com/docs/api/v1/Deals",
|
|
100
|
+
"official": true
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"type": "spec",
|
|
106
|
+
"spec": {
|
|
107
|
+
"source": {
|
|
108
|
+
"app": "Typeform",
|
|
109
|
+
"role": "source",
|
|
110
|
+
"method": "POST",
|
|
111
|
+
"url": "(your webhook endpoint)",
|
|
112
|
+
"auth": {
|
|
113
|
+
"type": "none",
|
|
114
|
+
"envVar": "TYPEFORM_WEBHOOK_SECRET"
|
|
115
|
+
},
|
|
116
|
+
"example": {
|
|
117
|
+
"event_id": "01H...",
|
|
118
|
+
"event_type": "form_response",
|
|
119
|
+
"form_response": {
|
|
120
|
+
"form_id": "lT4Z3j",
|
|
121
|
+
"token": "a3a12ec67a1365927098a606107fac15",
|
|
122
|
+
"submitted_at": "2026-10-01T09:00:00Z",
|
|
123
|
+
"answers": [
|
|
124
|
+
{
|
|
125
|
+
"type": "text",
|
|
126
|
+
"field": {
|
|
127
|
+
"id": "f1",
|
|
128
|
+
"ref": "lead_name",
|
|
129
|
+
"type": "short_text"
|
|
130
|
+
},
|
|
131
|
+
"text": "Ada Lovelace"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"type": "email",
|
|
135
|
+
"field": {
|
|
136
|
+
"id": "f2",
|
|
137
|
+
"ref": "lead_email",
|
|
138
|
+
"type": "email"
|
|
139
|
+
},
|
|
140
|
+
"email": "ada@example.com"
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"docsUrl": "https://www.typeform.com/developers/webhooks/example-payload/",
|
|
146
|
+
"notes": [
|
|
147
|
+
"Each answer carries its value under a key named after its type (text, email, phone_number, ...).",
|
|
148
|
+
"Answers are matched by field.ref, which the form owner can set; field ids are generated."
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
"target": [
|
|
152
|
+
{
|
|
153
|
+
"app": "Pipedrive",
|
|
154
|
+
"role": "target",
|
|
155
|
+
"method": "POST",
|
|
156
|
+
"url": "https://api.pipedrive.com/v1/organizations",
|
|
157
|
+
"auth": {
|
|
158
|
+
"type": "header",
|
|
159
|
+
"name": "x-api-token",
|
|
160
|
+
"envVar": "PIPEDRIVE_API_TOKEN"
|
|
161
|
+
},
|
|
162
|
+
"example": {
|
|
163
|
+
"name": "Analytical Engines Ltd"
|
|
164
|
+
},
|
|
165
|
+
"responseExample": {
|
|
166
|
+
"success": true,
|
|
167
|
+
"data": {
|
|
168
|
+
"id": 11
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"docsUrl": "https://developers.pipedrive.com/docs/api/v1/Organizations",
|
|
172
|
+
"notes": [
|
|
173
|
+
"Only call when a company was answered."
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"app": "Pipedrive",
|
|
178
|
+
"role": "target",
|
|
179
|
+
"method": "POST",
|
|
180
|
+
"url": "https://api.pipedrive.com/v1/persons",
|
|
181
|
+
"auth": {
|
|
182
|
+
"type": "header",
|
|
183
|
+
"name": "x-api-token",
|
|
184
|
+
"envVar": "PIPEDRIVE_API_TOKEN"
|
|
185
|
+
},
|
|
186
|
+
"example": {
|
|
187
|
+
"name": "Ada Lovelace",
|
|
188
|
+
"email": [
|
|
189
|
+
{
|
|
190
|
+
"value": "ada@example.com",
|
|
191
|
+
"primary": true,
|
|
192
|
+
"label": "work"
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
"org_id": 11
|
|
196
|
+
},
|
|
197
|
+
"responseExample": {
|
|
198
|
+
"success": true,
|
|
199
|
+
"data": {
|
|
200
|
+
"id": 22
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
"docsUrl": "https://developers.pipedrive.com/docs/api/v1/Persons",
|
|
204
|
+
"notes": [
|
|
205
|
+
"email and phone are arrays of { value, primary, label }.",
|
|
206
|
+
"The API token can be sent as the x-api-token header instead of the api_token query parameter."
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"app": "Pipedrive",
|
|
211
|
+
"role": "target",
|
|
212
|
+
"method": "POST",
|
|
213
|
+
"url": "https://api.pipedrive.com/v1/deals",
|
|
214
|
+
"auth": {
|
|
215
|
+
"type": "header",
|
|
216
|
+
"name": "x-api-token",
|
|
217
|
+
"envVar": "PIPEDRIVE_API_TOKEN"
|
|
218
|
+
},
|
|
219
|
+
"example": {
|
|
220
|
+
"title": "Website lead: Analytical Engines Ltd",
|
|
221
|
+
"person_id": 22,
|
|
222
|
+
"org_id": 11
|
|
223
|
+
},
|
|
224
|
+
"responseExample": {
|
|
225
|
+
"success": true,
|
|
226
|
+
"data": {
|
|
227
|
+
"id": 33
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"docsUrl": "https://developers.pipedrive.com/docs/api/v1/Deals",
|
|
231
|
+
"notes": [
|
|
232
|
+
"title is required. Link both person_id and org_id so the deal shows up on the organization."
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"type": "step",
|
|
240
|
+
"step": "research",
|
|
241
|
+
"status": "done",
|
|
242
|
+
"detail": "4 endpoints from 4 pages"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"type": "step",
|
|
246
|
+
"step": "generate",
|
|
247
|
+
"status": "start"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"type": "files",
|
|
251
|
+
"attempt": 1,
|
|
252
|
+
"files": [
|
|
253
|
+
{
|
|
254
|
+
"path": "src/connector.ts",
|
|
255
|
+
"content": "export interface ConnectorConfig {\n /** Pipedrive personal API token (env: PIPEDRIVE_API_TOKEN). */\n pipedriveApiToken: string\n /** Defaults to https://api.pipedrive.com/v1 */\n pipedriveBaseUrl?: string\n /** Typeform field refs that hold the lead's data. */\n fieldRefs: { name: string; email: string; company?: string; phone?: string }\n /** Prefix for the deal title, e.g. \"Website lead\". */\n dealTitlePrefix?: string\n fetch?: typeof fetch\n}\n\nexport interface TypeformAnswer {\n type: string\n field: { id: string; ref: string; type: string }\n text?: string\n email?: string\n phone_number?: string\n}\n\nexport interface TypeformWebhook {\n event_id: string\n event_type: 'form_response'\n form_response: {\n form_id: string\n token: string\n submitted_at: string\n answers: TypeformAnswer[]\n }\n}\n\nexport interface HandleResult {\n personId: number\n organizationId: number | null\n dealId: number\n}\n\ninterface PipedriveResponse {\n success: boolean\n data?: { id: number }\n error?: string\n}\n\nexport async function handle(payload: TypeformWebhook, config: ConnectorConfig): Promise<HandleResult> {\n if (payload?.event_type !== 'form_response') {\n throw new Error(`Unsupported Typeform event: ${String(payload?.event_type)}`)\n }\n const answers = payload.form_response.answers ?? []\n const name = answerValue(answers, config.fieldRefs.name)\n const email = answerValue(answers, config.fieldRefs.email)\n if (!name) throw new Error(`Missing required answer for field ref \"${config.fieldRefs.name}\" (name)`)\n if (!email) throw new Error(`Missing required answer for field ref \"${config.fieldRefs.email}\" (email)`)\n const company = config.fieldRefs.company ? answerValue(answers, config.fieldRefs.company) : undefined\n const phone = config.fieldRefs.phone ? answerValue(answers, config.fieldRefs.phone) : undefined\n\n const organizationId = company ? (await post(config, '/organizations', { name: company })).id : null\n\n const person = await post(config, '/persons', {\n name,\n email: [{ value: email, primary: true, label: 'work' }],\n ...(phone ? { phone: [{ value: phone, primary: true, label: 'work' }] } : {}),\n ...(organizationId ? { org_id: organizationId } : {}),\n })\n\n const deal = await post(config, '/deals', {\n title: `${config.dealTitlePrefix ?? 'Typeform lead'}: ${company ?? name}`,\n person_id: person.id,\n })\n\n return { personId: person.id, organizationId, dealId: deal.id }\n}\n\nfunction answerValue(answers: TypeformAnswer[], ref: string): string | undefined {\n const answer = answers.find((a) => a.field?.ref === ref)\n if (!answer) return undefined\n const value = answer.email ?? answer.phone_number ?? answer.text\n return value?.trim() || undefined\n}\n\nasync function post(config: ConnectorConfig, path: string, body: Record<string, unknown>): Promise<{ id: number }> {\n const doFetch = config.fetch ?? fetch\n const url = `${config.pipedriveBaseUrl ?? 'https://api.pipedrive.com/v1'}${path}`\n const res = await doFetch(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${config.pipedriveApiToken}` },\n body: JSON.stringify(body),\n })\n const data = (await res.json().catch(() => ({}))) as PipedriveResponse\n if (!res.ok || !data.success || !data.data) {\n throw new Error(`Pipedrive POST ${path} failed with ${res.status}: ${data.error ?? 'no error message'}`)\n }\n return data.data\n}\n"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"path": "src/connector.test.ts",
|
|
259
|
+
"content": "import { describe, it, expect, vi } from 'vitest'\nimport { handle, type ConnectorConfig, type TypeformWebhook } from './connector'\nimport { SOURCE_EXAMPLE, contractFetch } from './fixtures'\n\nfunction fakeFetch(responses: Record<string, { status?: number; body: unknown }>) {\n return vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {\n const url = String(input)\n const path = Object.keys(responses).find((p) => url.endsWith(p))\n const response = path ? responses[path] : undefined\n if (!response) throw new Error(`unexpected request to ${url} ${init?.method}`)\n return new Response(JSON.stringify(response.body), { status: response.status ?? 201 })\n })\n}\n\nconst ok = (id: number) => ({ body: { success: true, data: { id } } })\n\nfunction payload(overrides: Partial<Record<'name' | 'email' | 'company' | 'phone', string | null>> = {}): TypeformWebhook {\n const values = { name: 'Ada Lovelace', email: 'ada@example.com', company: 'Analytical Engines Ltd', phone: '+44 20 7946 0000', ...overrides }\n const answers = [\n values.name !== null && { type: 'text', field: { id: 'f1', ref: 'lead_name', type: 'short_text' }, text: values.name },\n values.email !== null && { type: 'email', field: { id: 'f2', ref: 'lead_email', type: 'email' }, email: values.email },\n values.company !== null && { type: 'text', field: { id: 'f3', ref: 'lead_company', type: 'short_text' }, text: values.company },\n values.phone !== null && { type: 'phone_number', field: { id: 'f4', ref: 'lead_phone', type: 'phone_number' }, phone_number: values.phone },\n ].filter(Boolean) as TypeformWebhook['form_response']['answers']\n return {\n event_id: 'evt_1',\n event_type: 'form_response',\n form_response: { form_id: 'frm_1', token: 'tok_1', submitted_at: '2026-10-01T09:00:00Z', answers },\n }\n}\n\nfunction config(fetch: typeof globalThis.fetch): ConnectorConfig {\n return {\n pipedriveApiToken: 'test-token',\n fieldRefs: { name: 'lead_name', email: 'lead_email', company: 'lead_company', phone: 'lead_phone' },\n dealTitlePrefix: 'Website lead',\n fetch,\n }\n}\n\ndescribe('handle', () => {\n it('creates organization, person and deal with the mapped fields', async () => {\n const fetch = fakeFetch({ '/organizations': ok(11), '/persons': ok(22), '/deals': ok(33) })\n const result = await handle(payload(), config(fetch))\n\n expect(result).toEqual({ personId: 22, organizationId: 11, dealId: 33 })\n const bodies = fetch.mock.calls.map(([url, init]) => [String(url), JSON.parse(String(init?.body))])\n expect(bodies).toEqual([\n ['https://api.pipedrive.com/v1/organizations', { name: 'Analytical Engines Ltd' }],\n ['https://api.pipedrive.com/v1/persons', {\n name: 'Ada Lovelace',\n email: [{ value: 'ada@example.com', primary: true, label: 'work' }],\n phone: [{ value: '+44 20 7946 0000', primary: true, label: 'work' }],\n org_id: 11,\n }],\n ['https://api.pipedrive.com/v1/deals', { title: 'Website lead: Analytical Engines Ltd', person_id: 22, org_id: 11 }],\n ])\n })\n\n it('authenticates every call with the x-api-token header', async () => {\n const fetch = fakeFetch({ '/organizations': ok(1), '/persons': ok(2), '/deals': ok(3) })\n await handle(payload(), config(fetch))\n for (const [, init] of fetch.mock.calls) {\n expect(new Headers(init?.headers).get('x-api-token')).toBe('test-token')\n expect(init?.method).toBe('POST')\n }\n })\n\n it('skips the organization when no company was answered', async () => {\n const fetch = fakeFetch({ '/persons': ok(2), '/deals': ok(3) })\n const result = await handle(payload({ company: null }), config(fetch))\n expect(result.organizationId).toBeNull()\n expect(fetch).toHaveBeenCalledTimes(2)\n const deal = JSON.parse(String(fetch.mock.calls[1]?.[1]?.body))\n expect(deal).toEqual({ title: 'Website lead: Ada Lovelace', person_id: 2 })\n })\n\n it('rejects a response without an email answer', async () => {\n const fetch = fakeFetch({})\n await expect(handle(payload({ email: null }), config(fetch))).rejects.toThrow(/lead_email/)\n expect(fetch).not.toHaveBeenCalled()\n })\n\n it('surfaces Pipedrive errors with status and endpoint', async () => {\n const fetch = fakeFetch({\n '/organizations': ok(1),\n '/persons': { status: 401, body: { success: false, error: 'unauthorized access' } },\n })\n await expect(handle(payload(), config(fetch))).rejects.toThrow('Pipedrive POST /persons failed with 401: unauthorized access')\n })\n\n it('ignores events that are not form responses', async () => {\n const fetch = fakeFetch({})\n const event = { ...payload(), event_type: 'form_deleted' } as unknown as TypeformWebhook\n await expect(handle(event, config(fetch))).rejects.toThrow(/Unsupported Typeform event/)\n })\n})\n\ndescribe('contract', () => {\n it('handles the documented Typeform payload against the documented Pipedrive responses', async () => {\n const { fetch, calls } = contractFetch()\n const result = await handle(SOURCE_EXAMPLE as unknown as TypeformWebhook, {\n pipedriveApiToken: 'contract-token',\n fieldRefs: { name: 'lead_name', email: 'lead_email' },\n fetch,\n })\n expect(result.personId).toBeGreaterThan(0)\n expect(result.dealId).toBeGreaterThan(0)\n expect(calls.map((c) => c.url)).toEqual(['https://api.pipedrive.com/v1/persons', 'https://api.pipedrive.com/v1/deals'])\n })\n})\n"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"path": "README.md",
|
|
263
|
+
"content": "# Typeform → Pipedrive connector\n\nTurns a Typeform `form_response` webhook into a Pipedrive organization, person and deal.\n\n## Configuration\n\n| Env var | Used as | Notes |\n| --- | --- | --- |\n| `PIPEDRIVE_API_TOKEN` | `pipedriveApiToken` | Personal API token, sent as the `x-api-token` header |\n\n`fieldRefs` maps your Typeform field refs to the lead fields. `name` and `email` are required; `company` and `phone` are optional.\n\n## Usage\n\n```ts\nimport { handle } from './src/connector'\n\nexport async function POST(request: Request) {\n const payload = await request.json()\n const result = await handle(payload, {\n pipedriveApiToken: process.env.PIPEDRIVE_API_TOKEN!,\n fieldRefs: { name: 'lead_name', email: 'lead_email', company: 'lead_company', phone: 'lead_phone' },\n dealTitlePrefix: 'Website lead',\n })\n return Response.json(result)\n}\n```\n\n## Behaviour\n\n1. Reads the answers by field ref, rejects the event when name or email is missing.\n2. Creates an organization when a company was answered (`POST /v1/organizations`).\n3. Creates the person with email and phone, linked to the organization (`POST /v1/persons`).\n4. Creates a deal for the person (`POST /v1/deals`).\n\nAny non-2xx or `success: false` response throws with the status code and endpoint, so the webhook caller can retry.\n\n## Assumptions\n\n- Typeform webhook signature verification happens before `handle` is called.\n- Every submission is a new lead; the connector does not search for existing persons.\n"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"path": "src/fixtures.ts",
|
|
267
|
+
"content": "// Written by patchbay from the API documentation. Regenerated on every attempt, do not edit.\n// Source: https://www.typeform.com/developers/webhooks/example-payload/\n// Source: https://developers.pipedrive.com/docs/api/v1/Organizations\n// Source: https://developers.pipedrive.com/docs/api/v1/Persons\n// Source: https://developers.pipedrive.com/docs/api/v1/Deals\n\n/** Example payload of the source event, as documented. */\nexport const SOURCE_EXAMPLE = {\n \"event_id\": \"01H...\",\n \"event_type\": \"form_response\",\n \"form_response\": {\n \"form_id\": \"lT4Z3j\",\n \"token\": \"a3a12ec67a1365927098a606107fac15\",\n \"submitted_at\": \"2026-10-01T09:00:00Z\",\n \"answers\": [\n {\n \"type\": \"text\",\n \"field\": {\n \"id\": \"f1\",\n \"ref\": \"lead_name\",\n \"type\": \"short_text\"\n },\n \"text\": \"Ada Lovelace\"\n },\n {\n \"type\": \"email\",\n \"field\": {\n \"id\": \"f2\",\n \"ref\": \"lead_email\",\n \"type\": \"email\"\n },\n \"email\": \"ada@example.com\"\n }\n ]\n }\n}\n\nexport interface DocumentedEndpoint {\n method: string\n /** As documented; may contain placeholders such as {id}, :id, <id> or a region host like usX. */\n url: string\n response: unknown\n}\n\n/** Target endpoints the connector may call, in the documented order, with their documented responses. */\nexport const TARGET_ENDPOINTS: DocumentedEndpoint[] = [\n {\n \"method\": \"POST\",\n \"url\": \"https://api.pipedrive.com/v1/organizations\",\n \"response\": {\n \"success\": true,\n \"data\": {\n \"id\": 11\n }\n }\n },\n {\n \"method\": \"POST\",\n \"url\": \"https://api.pipedrive.com/v1/persons\",\n \"response\": {\n \"success\": true,\n \"data\": {\n \"id\": 22\n }\n }\n },\n {\n \"method\": \"POST\",\n \"url\": \"https://api.pipedrive.com/v1/deals\",\n \"response\": {\n \"success\": true,\n \"data\": {\n \"id\": 33\n }\n }\n }\n]\n\nexport interface RecordedCall {\n method: string\n url: string\n /** The request body exactly as sent (usually a JSON string). */\n body: string | undefined\n /** The body parsed as JSON, or undefined when it is not JSON. */\n json: unknown\n headers: Headers\n}\n\n/** The documented endpoint a request matches, placeholders and region subdomains included. */\nexport function findEndpoint(method: string, url: string): DocumentedEndpoint | undefined {\n return TARGET_ENDPOINTS.find((endpoint) => endpoint.method === method.toUpperCase() && urlMatches(endpoint.url, url))\n}\n\n/**\n * A fake fetch that answers every documented endpoint with its documented response and\n * rejects anything else. Use it in the contract test:\n *\n * const { fetch, calls } = contractFetch()\n * await handle(SOURCE_EXAMPLE as MyInput, { ...config, fetch })\n * expect(calls.length).toBeGreaterThan(0)\n */\nexport function contractFetch(): { fetch: typeof fetch; calls: RecordedCall[] } {\n return fakeFetch((request) => {\n const endpoint = findEndpoint(request.method, request.url)\n if (!endpoint) throw new Error(`contract: ${request.method} ${request.url} is not a documented endpoint`)\n return jsonResponse(endpoint.response)\n })\n}\n\n/**\n * A correctly typed fake fetch for every other test. The handler receives the recorded\n * request: { method, url, body (string as sent), json (parsed body), headers (Headers) }.\n *\n * const { fetch, calls } = fakeFetch((req) => req.url.endsWith('/deals') ? jsonResponse({ id: 1 }, 201) : jsonResponse({}, 404))\n */\nexport function fakeFetch(\n handler: (request: RecordedCall) => Response | Promise<Response>,\n): { fetch: typeof fetch; calls: RecordedCall[] } {\n const calls: RecordedCall[] = []\n const fake = async (input: string | URL | Request, init: RequestInit = {}): Promise<Response> => {\n const url = input instanceof Request ? input.url : String(input)\n const method = (init.method ?? (input instanceof Request ? input.method : 'GET')).toUpperCase()\n const body = typeof init.body === 'string' ? init.body : init.body == null ? undefined : String(init.body)\n const call: RecordedCall = { method, url, body, json: parseJson(body), headers: new Headers(init.headers) }\n calls.push(call)\n return handler(call)\n }\n return { fetch: fake as typeof fetch, calls }\n}\n\nconst STATUS_TEXT: Record<number, string> = {\n 200: 'OK', 201: 'Created', 202: 'Accepted', 204: 'No Content',\n 400: 'Bad Request', 401: 'Unauthorized', 403: 'Forbidden', 404: 'Not Found', 409: 'Conflict',\n 422: 'Unprocessable Entity', 429: 'Too Many Requests',\n 500: 'Internal Server Error', 502: 'Bad Gateway', 503: 'Service Unavailable',\n}\n\n/** A JSON Response with the standard status text, e.g. jsonResponse({ error: 'nope' }, 401) -> \"401 Unauthorized\". */\nexport function jsonResponse(body: unknown, status = 200): Response {\n const init = { status, statusText: STATUS_TEXT[status] ?? '', headers: { 'Content-Type': 'application/json' } }\n return new Response(status === 204 ? null : JSON.stringify(body), init)\n}\n\nfunction parseJson(raw: string | undefined): unknown {\n if (raw === undefined) return undefined\n try {\n return JSON.parse(raw)\n } catch {\n return undefined\n }\n}\n\nfunction urlMatches(template: string, actual: string): boolean {\n const t = splitUrl(template)\n const a = splitUrl(actual)\n if (!t || !a) return false\n const tHost = t.host.split('.')\n const aHost = a.host.split('.')\n if (tHost.slice(-2).join('.') !== aHost.slice(-2).join('.')) return false\n const tPath = t.path.replace(/\\/+$/, '').split('/')\n const aPath = a.path.replace(/\\/+$/, '').split('/')\n if (tPath.length !== aPath.length) return false\n return tPath.every((segment, i) => isPlaceholder(segment) || segment === aPath[i])\n}\n\nfunction splitUrl(url: string): { host: string; path: string } | null {\n const match = url.match(/^https?:\\/\\/([^/?#]+)([^?#]*)/i)\n return match ? { host: (match[1] ?? '').toLowerCase(), path: match[2] || '/' } : null\n}\n\nfunction isPlaceholder(segment: string): boolean {\n return /^\\{[^}]+\\}$|^:[A-Za-z_]\\w*$|^<[^>]+>$/.test(segment)\n}\n"
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"type": "step",
|
|
273
|
+
"step": "generate",
|
|
274
|
+
"status": "done",
|
|
275
|
+
"detail": "src/connector.ts, src/connector.test.ts, README.md"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"type": "log",
|
|
279
|
+
"step": "generate",
|
|
280
|
+
"message": "Wrote src/fixtures.ts from the documented example payload and responses"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"type": "step",
|
|
284
|
+
"step": "verify",
|
|
285
|
+
"status": "start"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"type": "log",
|
|
289
|
+
"step": "verify",
|
|
290
|
+
"message": "Reusing prepared sandbox image (node 22, typescript, vitest)"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"type": "log",
|
|
294
|
+
"step": "verify",
|
|
295
|
+
"message": "Forking checkpoint with 4 files, network off"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"type": "tests",
|
|
299
|
+
"attempt": 1,
|
|
300
|
+
"report": {
|
|
301
|
+
"typecheckOk": true,
|
|
302
|
+
"typecheckOutput": "",
|
|
303
|
+
"passed": 5,
|
|
304
|
+
"failed": 2,
|
|
305
|
+
"total": 7,
|
|
306
|
+
"failures": [
|
|
307
|
+
{
|
|
308
|
+
"name": "handle creates organization, person and deal with the mapped fields",
|
|
309
|
+
"message": "AssertionError: expected [ [ …(2) ], [ …(2) ], [ …(2) ] ] to deeply equal [ [ …(2) ], [ …(2) ], [ …(2) ] ]\n at /work/src/connector.test.ts:48:20\n at processTicksAndRejections (node:internal/process/task_queues:104:5)\n at file:///C:/Users/vogel/Desktop/patchbay/node_modules/@vitest/runner/dist/chunk-artifact.js:1903:20"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"name": "handle authenticates every call with the x-api-token header",
|
|
313
|
+
"message": "AssertionError: expected null to be 'test-token' // Object.is equality\n at /work/src/connector.test.ts:64:61\n at processTicksAndRejections (node:internal/process/task_queues:104:5)\n at file:///C:/Users/vogel/Desktop/patchbay/node_modules/@vitest/runner/dist/chunk-artifact.js:1903:20"
|
|
314
|
+
}
|
|
315
|
+
],
|
|
316
|
+
"durationMs": 199.913818359375,
|
|
317
|
+
"ranOn": "replay",
|
|
318
|
+
"passedNames": [
|
|
319
|
+
"handle skips the organization when no company was answered",
|
|
320
|
+
"handle rejects a response without an email answer",
|
|
321
|
+
"handle surfaces Pipedrive errors with status and endpoint",
|
|
322
|
+
"handle ignores events that are not form responses",
|
|
323
|
+
"contract handles the documented Typeform payload against the documented Pipedrive responses"
|
|
324
|
+
],
|
|
325
|
+
"contract": "passed"
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"type": "log",
|
|
330
|
+
"step": "verify",
|
|
331
|
+
"message": "Attempt 1 failed (2 tests, typecheck ok), repairing"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"type": "files",
|
|
335
|
+
"attempt": 2,
|
|
336
|
+
"files": [
|
|
337
|
+
{
|
|
338
|
+
"path": "src/connector.ts",
|
|
339
|
+
"content": "export interface ConnectorConfig {\n /** Pipedrive personal API token (env: PIPEDRIVE_API_TOKEN). */\n pipedriveApiToken: string\n /** Defaults to https://api.pipedrive.com/v1 */\n pipedriveBaseUrl?: string\n /** Typeform field refs that hold the lead's data. */\n fieldRefs: { name: string; email: string; company?: string; phone?: string }\n /** Prefix for the deal title, e.g. \"Website lead\". */\n dealTitlePrefix?: string\n fetch?: typeof fetch\n}\n\nexport interface TypeformAnswer {\n type: string\n field: { id: string; ref: string; type: string }\n text?: string\n email?: string\n phone_number?: string\n}\n\nexport interface TypeformWebhook {\n event_id: string\n event_type: 'form_response'\n form_response: {\n form_id: string\n token: string\n submitted_at: string\n answers: TypeformAnswer[]\n }\n}\n\nexport interface HandleResult {\n personId: number\n organizationId: number | null\n dealId: number\n}\n\ninterface PipedriveResponse {\n success: boolean\n data?: { id: number }\n error?: string\n}\n\nexport async function handle(payload: TypeformWebhook, config: ConnectorConfig): Promise<HandleResult> {\n if (payload?.event_type !== 'form_response') {\n throw new Error(`Unsupported Typeform event: ${String(payload?.event_type)}`)\n }\n const answers = payload.form_response.answers ?? []\n const name = answerValue(answers, config.fieldRefs.name)\n const email = answerValue(answers, config.fieldRefs.email)\n if (!name) throw new Error(`Missing required answer for field ref \"${config.fieldRefs.name}\" (name)`)\n if (!email) throw new Error(`Missing required answer for field ref \"${config.fieldRefs.email}\" (email)`)\n const company = config.fieldRefs.company ? answerValue(answers, config.fieldRefs.company) : undefined\n const phone = config.fieldRefs.phone ? answerValue(answers, config.fieldRefs.phone) : undefined\n\n const organizationId = company ? (await post(config, '/organizations', { name: company })).id : null\n\n const person = await post(config, '/persons', {\n name,\n email: [{ value: email, primary: true, label: 'work' }],\n ...(phone ? { phone: [{ value: phone, primary: true, label: 'work' }] } : {}),\n ...(organizationId ? { org_id: organizationId } : {}),\n })\n\n const deal = await post(config, '/deals', {\n title: `${config.dealTitlePrefix ?? 'Typeform lead'}: ${company ?? name}`,\n person_id: person.id,\n ...(organizationId ? { org_id: organizationId } : {}),\n })\n\n return { personId: person.id, organizationId, dealId: deal.id }\n}\n\nfunction answerValue(answers: TypeformAnswer[], ref: string): string | undefined {\n const answer = answers.find((a) => a.field?.ref === ref)\n if (!answer) return undefined\n const value = answer.email ?? answer.phone_number ?? answer.text\n return value?.trim() || undefined\n}\n\nasync function post(config: ConnectorConfig, path: string, body: Record<string, unknown>): Promise<{ id: number }> {\n const doFetch = config.fetch ?? fetch\n const url = `${config.pipedriveBaseUrl ?? 'https://api.pipedrive.com/v1'}${path}`\n const res = await doFetch(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json', 'x-api-token': config.pipedriveApiToken },\n body: JSON.stringify(body),\n })\n const data = (await res.json().catch(() => ({}))) as PipedriveResponse\n if (!res.ok || !data.success || !data.data) {\n throw new Error(`Pipedrive POST ${path} failed with ${res.status}: ${data.error ?? 'no error message'}`)\n }\n return data.data\n}\n"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"path": "src/connector.test.ts",
|
|
343
|
+
"content": "import { describe, it, expect, vi } from 'vitest'\nimport { handle, type ConnectorConfig, type TypeformWebhook } from './connector'\nimport { SOURCE_EXAMPLE, contractFetch } from './fixtures'\n\nfunction fakeFetch(responses: Record<string, { status?: number; body: unknown }>) {\n return vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {\n const url = String(input)\n const path = Object.keys(responses).find((p) => url.endsWith(p))\n const response = path ? responses[path] : undefined\n if (!response) throw new Error(`unexpected request to ${url} ${init?.method}`)\n return new Response(JSON.stringify(response.body), { status: response.status ?? 201 })\n })\n}\n\nconst ok = (id: number) => ({ body: { success: true, data: { id } } })\n\nfunction payload(overrides: Partial<Record<'name' | 'email' | 'company' | 'phone', string | null>> = {}): TypeformWebhook {\n const values = { name: 'Ada Lovelace', email: 'ada@example.com', company: 'Analytical Engines Ltd', phone: '+44 20 7946 0000', ...overrides }\n const answers = [\n values.name !== null && { type: 'text', field: { id: 'f1', ref: 'lead_name', type: 'short_text' }, text: values.name },\n values.email !== null && { type: 'email', field: { id: 'f2', ref: 'lead_email', type: 'email' }, email: values.email },\n values.company !== null && { type: 'text', field: { id: 'f3', ref: 'lead_company', type: 'short_text' }, text: values.company },\n values.phone !== null && { type: 'phone_number', field: { id: 'f4', ref: 'lead_phone', type: 'phone_number' }, phone_number: values.phone },\n ].filter(Boolean) as TypeformWebhook['form_response']['answers']\n return {\n event_id: 'evt_1',\n event_type: 'form_response',\n form_response: { form_id: 'frm_1', token: 'tok_1', submitted_at: '2026-10-01T09:00:00Z', answers },\n }\n}\n\nfunction config(fetch: typeof globalThis.fetch): ConnectorConfig {\n return {\n pipedriveApiToken: 'test-token',\n fieldRefs: { name: 'lead_name', email: 'lead_email', company: 'lead_company', phone: 'lead_phone' },\n dealTitlePrefix: 'Website lead',\n fetch,\n }\n}\n\ndescribe('handle', () => {\n it('creates organization, person and deal with the mapped fields', async () => {\n const fetch = fakeFetch({ '/organizations': ok(11), '/persons': ok(22), '/deals': ok(33) })\n const result = await handle(payload(), config(fetch))\n\n expect(result).toEqual({ personId: 22, organizationId: 11, dealId: 33 })\n const bodies = fetch.mock.calls.map(([url, init]) => [String(url), JSON.parse(String(init?.body))])\n expect(bodies).toEqual([\n ['https://api.pipedrive.com/v1/organizations', { name: 'Analytical Engines Ltd' }],\n ['https://api.pipedrive.com/v1/persons', {\n name: 'Ada Lovelace',\n email: [{ value: 'ada@example.com', primary: true, label: 'work' }],\n phone: [{ value: '+44 20 7946 0000', primary: true, label: 'work' }],\n org_id: 11,\n }],\n ['https://api.pipedrive.com/v1/deals', { title: 'Website lead: Analytical Engines Ltd', person_id: 22, org_id: 11 }],\n ])\n })\n\n it('authenticates every call with the x-api-token header', async () => {\n const fetch = fakeFetch({ '/organizations': ok(1), '/persons': ok(2), '/deals': ok(3) })\n await handle(payload(), config(fetch))\n for (const [, init] of fetch.mock.calls) {\n expect(new Headers(init?.headers).get('x-api-token')).toBe('test-token')\n expect(init?.method).toBe('POST')\n }\n })\n\n it('skips the organization when no company was answered', async () => {\n const fetch = fakeFetch({ '/persons': ok(2), '/deals': ok(3) })\n const result = await handle(payload({ company: null }), config(fetch))\n expect(result.organizationId).toBeNull()\n expect(fetch).toHaveBeenCalledTimes(2)\n const deal = JSON.parse(String(fetch.mock.calls[1]?.[1]?.body))\n expect(deal).toEqual({ title: 'Website lead: Ada Lovelace', person_id: 2 })\n })\n\n it('rejects a response without an email answer', async () => {\n const fetch = fakeFetch({})\n await expect(handle(payload({ email: null }), config(fetch))).rejects.toThrow(/lead_email/)\n expect(fetch).not.toHaveBeenCalled()\n })\n\n it('surfaces Pipedrive errors with status and endpoint', async () => {\n const fetch = fakeFetch({\n '/organizations': ok(1),\n '/persons': { status: 401, body: { success: false, error: 'unauthorized access' } },\n })\n await expect(handle(payload(), config(fetch))).rejects.toThrow('Pipedrive POST /persons failed with 401: unauthorized access')\n })\n\n it('ignores events that are not form responses', async () => {\n const fetch = fakeFetch({})\n const event = { ...payload(), event_type: 'form_deleted' } as unknown as TypeformWebhook\n await expect(handle(event, config(fetch))).rejects.toThrow(/Unsupported Typeform event/)\n })\n})\n\ndescribe('contract', () => {\n it('handles the documented Typeform payload against the documented Pipedrive responses', async () => {\n const { fetch, calls } = contractFetch()\n const result = await handle(SOURCE_EXAMPLE as unknown as TypeformWebhook, {\n pipedriveApiToken: 'contract-token',\n fieldRefs: { name: 'lead_name', email: 'lead_email' },\n fetch,\n })\n expect(result.personId).toBeGreaterThan(0)\n expect(result.dealId).toBeGreaterThan(0)\n expect(calls.map((c) => c.url)).toEqual(['https://api.pipedrive.com/v1/persons', 'https://api.pipedrive.com/v1/deals'])\n })\n})\n"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"path": "README.md",
|
|
347
|
+
"content": "# Typeform → Pipedrive connector\n\nTurns a Typeform `form_response` webhook into a Pipedrive organization, person and deal.\n\n## Configuration\n\n| Env var | Used as | Notes |\n| --- | --- | --- |\n| `PIPEDRIVE_API_TOKEN` | `pipedriveApiToken` | Personal API token, sent as the `x-api-token` header |\n\n`fieldRefs` maps your Typeform field refs to the lead fields. `name` and `email` are required; `company` and `phone` are optional.\n\n## Usage\n\n```ts\nimport { handle } from './src/connector'\n\nexport async function POST(request: Request) {\n const payload = await request.json()\n const result = await handle(payload, {\n pipedriveApiToken: process.env.PIPEDRIVE_API_TOKEN!,\n fieldRefs: { name: 'lead_name', email: 'lead_email', company: 'lead_company', phone: 'lead_phone' },\n dealTitlePrefix: 'Website lead',\n })\n return Response.json(result)\n}\n```\n\n## Behaviour\n\n1. Reads the answers by field ref, rejects the event when name or email is missing.\n2. Creates an organization when a company was answered (`POST /v1/organizations`).\n3. Creates the person with email and phone, linked to the organization (`POST /v1/persons`).\n4. Creates a deal for the person (`POST /v1/deals`).\n\nAny non-2xx or `success: false` response throws with the status code and endpoint, so the webhook caller can retry.\n\n## Assumptions\n\n- Typeform webhook signature verification happens before `handle` is called.\n- Every submission is a new lead; the connector does not search for existing persons.\n"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"path": "src/fixtures.ts",
|
|
351
|
+
"content": "// Written by patchbay from the API documentation. Regenerated on every attempt, do not edit.\n// Source: https://www.typeform.com/developers/webhooks/example-payload/\n// Source: https://developers.pipedrive.com/docs/api/v1/Organizations\n// Source: https://developers.pipedrive.com/docs/api/v1/Persons\n// Source: https://developers.pipedrive.com/docs/api/v1/Deals\n\n/** Example payload of the source event, as documented. */\nexport const SOURCE_EXAMPLE = {\n \"event_id\": \"01H...\",\n \"event_type\": \"form_response\",\n \"form_response\": {\n \"form_id\": \"lT4Z3j\",\n \"token\": \"a3a12ec67a1365927098a606107fac15\",\n \"submitted_at\": \"2026-10-01T09:00:00Z\",\n \"answers\": [\n {\n \"type\": \"text\",\n \"field\": {\n \"id\": \"f1\",\n \"ref\": \"lead_name\",\n \"type\": \"short_text\"\n },\n \"text\": \"Ada Lovelace\"\n },\n {\n \"type\": \"email\",\n \"field\": {\n \"id\": \"f2\",\n \"ref\": \"lead_email\",\n \"type\": \"email\"\n },\n \"email\": \"ada@example.com\"\n }\n ]\n }\n}\n\nexport interface DocumentedEndpoint {\n method: string\n /** As documented; may contain placeholders such as {id}, :id, <id> or a region host like usX. */\n url: string\n response: unknown\n}\n\n/** Target endpoints the connector may call, in the documented order, with their documented responses. */\nexport const TARGET_ENDPOINTS: DocumentedEndpoint[] = [\n {\n \"method\": \"POST\",\n \"url\": \"https://api.pipedrive.com/v1/organizations\",\n \"response\": {\n \"success\": true,\n \"data\": {\n \"id\": 11\n }\n }\n },\n {\n \"method\": \"POST\",\n \"url\": \"https://api.pipedrive.com/v1/persons\",\n \"response\": {\n \"success\": true,\n \"data\": {\n \"id\": 22\n }\n }\n },\n {\n \"method\": \"POST\",\n \"url\": \"https://api.pipedrive.com/v1/deals\",\n \"response\": {\n \"success\": true,\n \"data\": {\n \"id\": 33\n }\n }\n }\n]\n\nexport interface RecordedCall {\n method: string\n url: string\n /** The request body exactly as sent (usually a JSON string). */\n body: string | undefined\n /** The body parsed as JSON, or undefined when it is not JSON. */\n json: unknown\n headers: Headers\n}\n\n/** The documented endpoint a request matches, placeholders and region subdomains included. */\nexport function findEndpoint(method: string, url: string): DocumentedEndpoint | undefined {\n return TARGET_ENDPOINTS.find((endpoint) => endpoint.method === method.toUpperCase() && urlMatches(endpoint.url, url))\n}\n\n/**\n * A fake fetch that answers every documented endpoint with its documented response and\n * rejects anything else. Use it in the contract test:\n *\n * const { fetch, calls } = contractFetch()\n * await handle(SOURCE_EXAMPLE as MyInput, { ...config, fetch })\n * expect(calls.length).toBeGreaterThan(0)\n */\nexport function contractFetch(): { fetch: typeof fetch; calls: RecordedCall[] } {\n return fakeFetch((request) => {\n const endpoint = findEndpoint(request.method, request.url)\n if (!endpoint) throw new Error(`contract: ${request.method} ${request.url} is not a documented endpoint`)\n return jsonResponse(endpoint.response)\n })\n}\n\n/**\n * A correctly typed fake fetch for every other test. The handler receives the recorded\n * request: { method, url, body (string as sent), json (parsed body), headers (Headers) }.\n *\n * const { fetch, calls } = fakeFetch((req) => req.url.endsWith('/deals') ? jsonResponse({ id: 1 }, 201) : jsonResponse({}, 404))\n */\nexport function fakeFetch(\n handler: (request: RecordedCall) => Response | Promise<Response>,\n): { fetch: typeof fetch; calls: RecordedCall[] } {\n const calls: RecordedCall[] = []\n const fake = async (input: string | URL | Request, init: RequestInit = {}): Promise<Response> => {\n const url = input instanceof Request ? input.url : String(input)\n const method = (init.method ?? (input instanceof Request ? input.method : 'GET')).toUpperCase()\n const body = typeof init.body === 'string' ? init.body : init.body == null ? undefined : String(init.body)\n const call: RecordedCall = { method, url, body, json: parseJson(body), headers: new Headers(init.headers) }\n calls.push(call)\n return handler(call)\n }\n return { fetch: fake as typeof fetch, calls }\n}\n\nconst STATUS_TEXT: Record<number, string> = {\n 200: 'OK', 201: 'Created', 202: 'Accepted', 204: 'No Content',\n 400: 'Bad Request', 401: 'Unauthorized', 403: 'Forbidden', 404: 'Not Found', 409: 'Conflict',\n 422: 'Unprocessable Entity', 429: 'Too Many Requests',\n 500: 'Internal Server Error', 502: 'Bad Gateway', 503: 'Service Unavailable',\n}\n\n/** A JSON Response with the standard status text, e.g. jsonResponse({ error: 'nope' }, 401) -> \"401 Unauthorized\". */\nexport function jsonResponse(body: unknown, status = 200): Response {\n const init = { status, statusText: STATUS_TEXT[status] ?? '', headers: { 'Content-Type': 'application/json' } }\n return new Response(status === 204 ? null : JSON.stringify(body), init)\n}\n\nfunction parseJson(raw: string | undefined): unknown {\n if (raw === undefined) return undefined\n try {\n return JSON.parse(raw)\n } catch {\n return undefined\n }\n}\n\nfunction urlMatches(template: string, actual: string): boolean {\n const t = splitUrl(template)\n const a = splitUrl(actual)\n if (!t || !a) return false\n const tHost = t.host.split('.')\n const aHost = a.host.split('.')\n if (tHost.slice(-2).join('.') !== aHost.slice(-2).join('.')) return false\n const tPath = t.path.replace(/\\/+$/, '').split('/')\n const aPath = a.path.replace(/\\/+$/, '').split('/')\n if (tPath.length !== aPath.length) return false\n return tPath.every((segment, i) => isPlaceholder(segment) || segment === aPath[i])\n}\n\nfunction splitUrl(url: string): { host: string; path: string } | null {\n const match = url.match(/^https?:\\/\\/([^/?#]+)([^?#]*)/i)\n return match ? { host: (match[1] ?? '').toLowerCase(), path: match[2] || '/' } : null\n}\n\nfunction isPlaceholder(segment: string): boolean {\n return /^\\{[^}]+\\}$|^:[A-Za-z_]\\w*$|^<[^>]+>$/.test(segment)\n}\n"
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"type": "log",
|
|
357
|
+
"step": "verify",
|
|
358
|
+
"message": "Forking checkpoint with 4 files, network off"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"type": "tests",
|
|
362
|
+
"attempt": 2,
|
|
363
|
+
"report": {
|
|
364
|
+
"typecheckOk": true,
|
|
365
|
+
"typecheckOutput": "",
|
|
366
|
+
"passed": 7,
|
|
367
|
+
"failed": 0,
|
|
368
|
+
"total": 7,
|
|
369
|
+
"failures": [],
|
|
370
|
+
"durationMs": 202.9775390625,
|
|
371
|
+
"ranOn": "replay",
|
|
372
|
+
"passedNames": [
|
|
373
|
+
"handle creates organization, person and deal with the mapped fields",
|
|
374
|
+
"handle authenticates every call with the x-api-token header",
|
|
375
|
+
"handle skips the organization when no company was answered",
|
|
376
|
+
"handle rejects a response without an email answer",
|
|
377
|
+
"handle surfaces Pipedrive errors with status and endpoint",
|
|
378
|
+
"handle ignores events that are not form responses",
|
|
379
|
+
"contract handles the documented Typeform payload against the documented Pipedrive responses"
|
|
380
|
+
],
|
|
381
|
+
"contract": "passed"
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
"type": "step",
|
|
386
|
+
"step": "verify",
|
|
387
|
+
"status": "done",
|
|
388
|
+
"detail": "7/7 tests after 2 attempts"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"type": "step",
|
|
392
|
+
"step": "package",
|
|
393
|
+
"status": "start"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"type": "result",
|
|
397
|
+
"ok": true,
|
|
398
|
+
"attempts": 2,
|
|
399
|
+
"files": [
|
|
400
|
+
{
|
|
401
|
+
"path": "src/connector.ts",
|
|
402
|
+
"content": "export interface ConnectorConfig {\n /** Pipedrive personal API token (env: PIPEDRIVE_API_TOKEN). */\n pipedriveApiToken: string\n /** Defaults to https://api.pipedrive.com/v1 */\n pipedriveBaseUrl?: string\n /** Typeform field refs that hold the lead's data. */\n fieldRefs: { name: string; email: string; company?: string; phone?: string }\n /** Prefix for the deal title, e.g. \"Website lead\". */\n dealTitlePrefix?: string\n fetch?: typeof fetch\n}\n\nexport interface TypeformAnswer {\n type: string\n field: { id: string; ref: string; type: string }\n text?: string\n email?: string\n phone_number?: string\n}\n\nexport interface TypeformWebhook {\n event_id: string\n event_type: 'form_response'\n form_response: {\n form_id: string\n token: string\n submitted_at: string\n answers: TypeformAnswer[]\n }\n}\n\nexport interface HandleResult {\n personId: number\n organizationId: number | null\n dealId: number\n}\n\ninterface PipedriveResponse {\n success: boolean\n data?: { id: number }\n error?: string\n}\n\nexport async function handle(payload: TypeformWebhook, config: ConnectorConfig): Promise<HandleResult> {\n if (payload?.event_type !== 'form_response') {\n throw new Error(`Unsupported Typeform event: ${String(payload?.event_type)}`)\n }\n const answers = payload.form_response.answers ?? []\n const name = answerValue(answers, config.fieldRefs.name)\n const email = answerValue(answers, config.fieldRefs.email)\n if (!name) throw new Error(`Missing required answer for field ref \"${config.fieldRefs.name}\" (name)`)\n if (!email) throw new Error(`Missing required answer for field ref \"${config.fieldRefs.email}\" (email)`)\n const company = config.fieldRefs.company ? answerValue(answers, config.fieldRefs.company) : undefined\n const phone = config.fieldRefs.phone ? answerValue(answers, config.fieldRefs.phone) : undefined\n\n const organizationId = company ? (await post(config, '/organizations', { name: company })).id : null\n\n const person = await post(config, '/persons', {\n name,\n email: [{ value: email, primary: true, label: 'work' }],\n ...(phone ? { phone: [{ value: phone, primary: true, label: 'work' }] } : {}),\n ...(organizationId ? { org_id: organizationId } : {}),\n })\n\n const deal = await post(config, '/deals', {\n title: `${config.dealTitlePrefix ?? 'Typeform lead'}: ${company ?? name}`,\n person_id: person.id,\n ...(organizationId ? { org_id: organizationId } : {}),\n })\n\n return { personId: person.id, organizationId, dealId: deal.id }\n}\n\nfunction answerValue(answers: TypeformAnswer[], ref: string): string | undefined {\n const answer = answers.find((a) => a.field?.ref === ref)\n if (!answer) return undefined\n const value = answer.email ?? answer.phone_number ?? answer.text\n return value?.trim() || undefined\n}\n\nasync function post(config: ConnectorConfig, path: string, body: Record<string, unknown>): Promise<{ id: number }> {\n const doFetch = config.fetch ?? fetch\n const url = `${config.pipedriveBaseUrl ?? 'https://api.pipedrive.com/v1'}${path}`\n const res = await doFetch(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json', 'x-api-token': config.pipedriveApiToken },\n body: JSON.stringify(body),\n })\n const data = (await res.json().catch(() => ({}))) as PipedriveResponse\n if (!res.ok || !data.success || !data.data) {\n throw new Error(`Pipedrive POST ${path} failed with ${res.status}: ${data.error ?? 'no error message'}`)\n }\n return data.data\n}\n"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"path": "src/connector.test.ts",
|
|
406
|
+
"content": "import { describe, it, expect, vi } from 'vitest'\nimport { handle, type ConnectorConfig, type TypeformWebhook } from './connector'\nimport { SOURCE_EXAMPLE, contractFetch } from './fixtures'\n\nfunction fakeFetch(responses: Record<string, { status?: number; body: unknown }>) {\n return vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {\n const url = String(input)\n const path = Object.keys(responses).find((p) => url.endsWith(p))\n const response = path ? responses[path] : undefined\n if (!response) throw new Error(`unexpected request to ${url} ${init?.method}`)\n return new Response(JSON.stringify(response.body), { status: response.status ?? 201 })\n })\n}\n\nconst ok = (id: number) => ({ body: { success: true, data: { id } } })\n\nfunction payload(overrides: Partial<Record<'name' | 'email' | 'company' | 'phone', string | null>> = {}): TypeformWebhook {\n const values = { name: 'Ada Lovelace', email: 'ada@example.com', company: 'Analytical Engines Ltd', phone: '+44 20 7946 0000', ...overrides }\n const answers = [\n values.name !== null && { type: 'text', field: { id: 'f1', ref: 'lead_name', type: 'short_text' }, text: values.name },\n values.email !== null && { type: 'email', field: { id: 'f2', ref: 'lead_email', type: 'email' }, email: values.email },\n values.company !== null && { type: 'text', field: { id: 'f3', ref: 'lead_company', type: 'short_text' }, text: values.company },\n values.phone !== null && { type: 'phone_number', field: { id: 'f4', ref: 'lead_phone', type: 'phone_number' }, phone_number: values.phone },\n ].filter(Boolean) as TypeformWebhook['form_response']['answers']\n return {\n event_id: 'evt_1',\n event_type: 'form_response',\n form_response: { form_id: 'frm_1', token: 'tok_1', submitted_at: '2026-10-01T09:00:00Z', answers },\n }\n}\n\nfunction config(fetch: typeof globalThis.fetch): ConnectorConfig {\n return {\n pipedriveApiToken: 'test-token',\n fieldRefs: { name: 'lead_name', email: 'lead_email', company: 'lead_company', phone: 'lead_phone' },\n dealTitlePrefix: 'Website lead',\n fetch,\n }\n}\n\ndescribe('handle', () => {\n it('creates organization, person and deal with the mapped fields', async () => {\n const fetch = fakeFetch({ '/organizations': ok(11), '/persons': ok(22), '/deals': ok(33) })\n const result = await handle(payload(), config(fetch))\n\n expect(result).toEqual({ personId: 22, organizationId: 11, dealId: 33 })\n const bodies = fetch.mock.calls.map(([url, init]) => [String(url), JSON.parse(String(init?.body))])\n expect(bodies).toEqual([\n ['https://api.pipedrive.com/v1/organizations', { name: 'Analytical Engines Ltd' }],\n ['https://api.pipedrive.com/v1/persons', {\n name: 'Ada Lovelace',\n email: [{ value: 'ada@example.com', primary: true, label: 'work' }],\n phone: [{ value: '+44 20 7946 0000', primary: true, label: 'work' }],\n org_id: 11,\n }],\n ['https://api.pipedrive.com/v1/deals', { title: 'Website lead: Analytical Engines Ltd', person_id: 22, org_id: 11 }],\n ])\n })\n\n it('authenticates every call with the x-api-token header', async () => {\n const fetch = fakeFetch({ '/organizations': ok(1), '/persons': ok(2), '/deals': ok(3) })\n await handle(payload(), config(fetch))\n for (const [, init] of fetch.mock.calls) {\n expect(new Headers(init?.headers).get('x-api-token')).toBe('test-token')\n expect(init?.method).toBe('POST')\n }\n })\n\n it('skips the organization when no company was answered', async () => {\n const fetch = fakeFetch({ '/persons': ok(2), '/deals': ok(3) })\n const result = await handle(payload({ company: null }), config(fetch))\n expect(result.organizationId).toBeNull()\n expect(fetch).toHaveBeenCalledTimes(2)\n const deal = JSON.parse(String(fetch.mock.calls[1]?.[1]?.body))\n expect(deal).toEqual({ title: 'Website lead: Ada Lovelace', person_id: 2 })\n })\n\n it('rejects a response without an email answer', async () => {\n const fetch = fakeFetch({})\n await expect(handle(payload({ email: null }), config(fetch))).rejects.toThrow(/lead_email/)\n expect(fetch).not.toHaveBeenCalled()\n })\n\n it('surfaces Pipedrive errors with status and endpoint', async () => {\n const fetch = fakeFetch({\n '/organizations': ok(1),\n '/persons': { status: 401, body: { success: false, error: 'unauthorized access' } },\n })\n await expect(handle(payload(), config(fetch))).rejects.toThrow('Pipedrive POST /persons failed with 401: unauthorized access')\n })\n\n it('ignores events that are not form responses', async () => {\n const fetch = fakeFetch({})\n const event = { ...payload(), event_type: 'form_deleted' } as unknown as TypeformWebhook\n await expect(handle(event, config(fetch))).rejects.toThrow(/Unsupported Typeform event/)\n })\n})\n\ndescribe('contract', () => {\n it('handles the documented Typeform payload against the documented Pipedrive responses', async () => {\n const { fetch, calls } = contractFetch()\n const result = await handle(SOURCE_EXAMPLE as unknown as TypeformWebhook, {\n pipedriveApiToken: 'contract-token',\n fieldRefs: { name: 'lead_name', email: 'lead_email' },\n fetch,\n })\n expect(result.personId).toBeGreaterThan(0)\n expect(result.dealId).toBeGreaterThan(0)\n expect(calls.map((c) => c.url)).toEqual(['https://api.pipedrive.com/v1/persons', 'https://api.pipedrive.com/v1/deals'])\n })\n})\n"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"path": "README.md",
|
|
410
|
+
"content": "# Typeform → Pipedrive connector\n\nTurns a Typeform `form_response` webhook into a Pipedrive organization, person and deal.\n\n## Configuration\n\n| Env var | Used as | Notes |\n| --- | --- | --- |\n| `PIPEDRIVE_API_TOKEN` | `pipedriveApiToken` | Personal API token, sent as the `x-api-token` header |\n\n`fieldRefs` maps your Typeform field refs to the lead fields. `name` and `email` are required; `company` and `phone` are optional.\n\n## Usage\n\n```ts\nimport { handle } from './src/connector'\n\nexport async function POST(request: Request) {\n const payload = await request.json()\n const result = await handle(payload, {\n pipedriveApiToken: process.env.PIPEDRIVE_API_TOKEN!,\n fieldRefs: { name: 'lead_name', email: 'lead_email', company: 'lead_company', phone: 'lead_phone' },\n dealTitlePrefix: 'Website lead',\n })\n return Response.json(result)\n}\n```\n\n## Behaviour\n\n1. Reads the answers by field ref, rejects the event when name or email is missing.\n2. Creates an organization when a company was answered (`POST /v1/organizations`).\n3. Creates the person with email and phone, linked to the organization (`POST /v1/persons`).\n4. Creates a deal for the person (`POST /v1/deals`).\n\nAny non-2xx or `success: false` response throws with the status code and endpoint, so the webhook caller can retry.\n\n## Assumptions\n\n- Typeform webhook signature verification happens before `handle` is called.\n- Every submission is a new lead; the connector does not search for existing persons.\n"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"path": "src/fixtures.ts",
|
|
414
|
+
"content": "// Written by patchbay from the API documentation. Regenerated on every attempt, do not edit.\n// Source: https://www.typeform.com/developers/webhooks/example-payload/\n// Source: https://developers.pipedrive.com/docs/api/v1/Organizations\n// Source: https://developers.pipedrive.com/docs/api/v1/Persons\n// Source: https://developers.pipedrive.com/docs/api/v1/Deals\n\n/** Example payload of the source event, as documented. */\nexport const SOURCE_EXAMPLE = {\n \"event_id\": \"01H...\",\n \"event_type\": \"form_response\",\n \"form_response\": {\n \"form_id\": \"lT4Z3j\",\n \"token\": \"a3a12ec67a1365927098a606107fac15\",\n \"submitted_at\": \"2026-10-01T09:00:00Z\",\n \"answers\": [\n {\n \"type\": \"text\",\n \"field\": {\n \"id\": \"f1\",\n \"ref\": \"lead_name\",\n \"type\": \"short_text\"\n },\n \"text\": \"Ada Lovelace\"\n },\n {\n \"type\": \"email\",\n \"field\": {\n \"id\": \"f2\",\n \"ref\": \"lead_email\",\n \"type\": \"email\"\n },\n \"email\": \"ada@example.com\"\n }\n ]\n }\n}\n\nexport interface DocumentedEndpoint {\n method: string\n /** As documented; may contain placeholders such as {id}, :id, <id> or a region host like usX. */\n url: string\n response: unknown\n}\n\n/** Target endpoints the connector may call, in the documented order, with their documented responses. */\nexport const TARGET_ENDPOINTS: DocumentedEndpoint[] = [\n {\n \"method\": \"POST\",\n \"url\": \"https://api.pipedrive.com/v1/organizations\",\n \"response\": {\n \"success\": true,\n \"data\": {\n \"id\": 11\n }\n }\n },\n {\n \"method\": \"POST\",\n \"url\": \"https://api.pipedrive.com/v1/persons\",\n \"response\": {\n \"success\": true,\n \"data\": {\n \"id\": 22\n }\n }\n },\n {\n \"method\": \"POST\",\n \"url\": \"https://api.pipedrive.com/v1/deals\",\n \"response\": {\n \"success\": true,\n \"data\": {\n \"id\": 33\n }\n }\n }\n]\n\nexport interface RecordedCall {\n method: string\n url: string\n /** The request body exactly as sent (usually a JSON string). */\n body: string | undefined\n /** The body parsed as JSON, or undefined when it is not JSON. */\n json: unknown\n headers: Headers\n}\n\n/** The documented endpoint a request matches, placeholders and region subdomains included. */\nexport function findEndpoint(method: string, url: string): DocumentedEndpoint | undefined {\n return TARGET_ENDPOINTS.find((endpoint) => endpoint.method === method.toUpperCase() && urlMatches(endpoint.url, url))\n}\n\n/**\n * A fake fetch that answers every documented endpoint with its documented response and\n * rejects anything else. Use it in the contract test:\n *\n * const { fetch, calls } = contractFetch()\n * await handle(SOURCE_EXAMPLE as MyInput, { ...config, fetch })\n * expect(calls.length).toBeGreaterThan(0)\n */\nexport function contractFetch(): { fetch: typeof fetch; calls: RecordedCall[] } {\n return fakeFetch((request) => {\n const endpoint = findEndpoint(request.method, request.url)\n if (!endpoint) throw new Error(`contract: ${request.method} ${request.url} is not a documented endpoint`)\n return jsonResponse(endpoint.response)\n })\n}\n\n/**\n * A correctly typed fake fetch for every other test. The handler receives the recorded\n * request: { method, url, body (string as sent), json (parsed body), headers (Headers) }.\n *\n * const { fetch, calls } = fakeFetch((req) => req.url.endsWith('/deals') ? jsonResponse({ id: 1 }, 201) : jsonResponse({}, 404))\n */\nexport function fakeFetch(\n handler: (request: RecordedCall) => Response | Promise<Response>,\n): { fetch: typeof fetch; calls: RecordedCall[] } {\n const calls: RecordedCall[] = []\n const fake = async (input: string | URL | Request, init: RequestInit = {}): Promise<Response> => {\n const url = input instanceof Request ? input.url : String(input)\n const method = (init.method ?? (input instanceof Request ? input.method : 'GET')).toUpperCase()\n const body = typeof init.body === 'string' ? init.body : init.body == null ? undefined : String(init.body)\n const call: RecordedCall = { method, url, body, json: parseJson(body), headers: new Headers(init.headers) }\n calls.push(call)\n return handler(call)\n }\n return { fetch: fake as typeof fetch, calls }\n}\n\nconst STATUS_TEXT: Record<number, string> = {\n 200: 'OK', 201: 'Created', 202: 'Accepted', 204: 'No Content',\n 400: 'Bad Request', 401: 'Unauthorized', 403: 'Forbidden', 404: 'Not Found', 409: 'Conflict',\n 422: 'Unprocessable Entity', 429: 'Too Many Requests',\n 500: 'Internal Server Error', 502: 'Bad Gateway', 503: 'Service Unavailable',\n}\n\n/** A JSON Response with the standard status text, e.g. jsonResponse({ error: 'nope' }, 401) -> \"401 Unauthorized\". */\nexport function jsonResponse(body: unknown, status = 200): Response {\n const init = { status, statusText: STATUS_TEXT[status] ?? '', headers: { 'Content-Type': 'application/json' } }\n return new Response(status === 204 ? null : JSON.stringify(body), init)\n}\n\nfunction parseJson(raw: string | undefined): unknown {\n if (raw === undefined) return undefined\n try {\n return JSON.parse(raw)\n } catch {\n return undefined\n }\n}\n\nfunction urlMatches(template: string, actual: string): boolean {\n const t = splitUrl(template)\n const a = splitUrl(actual)\n if (!t || !a) return false\n const tHost = t.host.split('.')\n const aHost = a.host.split('.')\n if (tHost.slice(-2).join('.') !== aHost.slice(-2).join('.')) return false\n const tPath = t.path.replace(/\\/+$/, '').split('/')\n const aPath = a.path.replace(/\\/+$/, '').split('/')\n if (tPath.length !== aPath.length) return false\n return tPath.every((segment, i) => isPlaceholder(segment) || segment === aPath[i])\n}\n\nfunction splitUrl(url: string): { host: string; path: string } | null {\n const match = url.match(/^https?:\\/\\/([^/?#]+)([^?#]*)/i)\n return match ? { host: (match[1] ?? '').toLowerCase(), path: match[2] || '/' } : null\n}\n\nfunction isPlaceholder(segment: string): boolean {\n return /^\\{[^}]+\\}$|^:[A-Za-z_]\\w*$|^<[^>]+>$/.test(segment)\n}\n"
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
"report": {
|
|
418
|
+
"typecheckOk": true,
|
|
419
|
+
"typecheckOutput": "",
|
|
420
|
+
"passed": 7,
|
|
421
|
+
"failed": 0,
|
|
422
|
+
"total": 7,
|
|
423
|
+
"failures": [],
|
|
424
|
+
"durationMs": 202.9775390625,
|
|
425
|
+
"ranOn": "replay",
|
|
426
|
+
"passedNames": [
|
|
427
|
+
"handle creates organization, person and deal with the mapped fields",
|
|
428
|
+
"handle authenticates every call with the x-api-token header",
|
|
429
|
+
"handle skips the organization when no company was answered",
|
|
430
|
+
"handle rejects a response without an email answer",
|
|
431
|
+
"handle surfaces Pipedrive errors with status and endpoint",
|
|
432
|
+
"handle ignores events that are not form responses",
|
|
433
|
+
"contract handles the documented Typeform payload against the documented Pipedrive responses"
|
|
434
|
+
],
|
|
435
|
+
"contract": "passed"
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"type": "step",
|
|
440
|
+
"step": "package",
|
|
441
|
+
"status": "done"
|
|
442
|
+
}
|
|
443
|
+
]
|
|
444
|
+
}
|