@pipe0/client 0.0.24 → 0.0.26
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/CHANGELOG.md +13 -0
- package/dist/generated/openapi.types.d.mts +11624 -0
- package/dist/generated/openapi.types.d.mts.map +1 -0
- package/dist/generated/types.d.mts +16 -0
- package/dist/generated/types.d.mts.map +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +3 -0
- package/dist/pipe0.d.mts +341 -0
- package/dist/pipe0.d.mts.map +1 -0
- package/dist/pipe0.mjs +195 -0
- package/dist/pipe0.mjs.map +1 -0
- package/package.json +8 -7
- package/dist/generated/openapi.types.d.ts +0 -11165
- package/dist/generated/openapi.types.js +0 -5
- package/dist/generated/types.d.ts +0 -15
- package/dist/generated/types.js +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/pipe0.d.ts +0 -333
- package/dist/pipe0.js +0 -275
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { paths } from "./openapi.types.js";
|
|
2
|
-
export type ClientPipesRequest = paths["/v1/pipes/run"]["post"]["requestBody"]["content"]["application/json"];
|
|
3
|
-
export type ClientPipesPayload = ClientPipesRequest["pipes"][number];
|
|
4
|
-
export type ClientPipesPayloadMap = {
|
|
5
|
-
[K in ClientPipesPayload["pipe_id"]]: Extract<ClientPipesPayload, {
|
|
6
|
-
pipe_id: K;
|
|
7
|
-
}>;
|
|
8
|
-
};
|
|
9
|
-
export type ClientSearchRequest = paths["/v1/search/run"]["post"]["requestBody"]["content"]["application/json"];
|
|
10
|
-
export type ClientSearchPayload = ClientSearchRequest["search"];
|
|
11
|
-
export type ClientSearchPayloadMap = {
|
|
12
|
-
[K in ClientSearchPayload["search_id"]]: Extract<ClientSearchPayload, {
|
|
13
|
-
search_id: K;
|
|
14
|
-
}>;
|
|
15
|
-
};
|
package/dist/generated/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
package/dist/pipe0.d.ts
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
import { type Client } from "openapi-fetch";
|
|
2
|
-
import type { paths } from "./generated/openapi.types.js";
|
|
3
|
-
export type PipesRequest = paths["/v1/pipes/run"]["post"]["requestBody"]["content"]["application/json"];
|
|
4
|
-
export type PipesResponse = paths["/v1/pipes/check/{run_id}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
5
|
-
export type SearchesRequest = paths["/v1/searches/run"]["post"]["requestBody"]["content"]["application/json"];
|
|
6
|
-
export type SearchesResponse = paths["/v1/searches/check/{run_id}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
7
|
-
export type SearchRequest = paths["/v1/search/run"]["post"]["requestBody"]["content"]["application/json"];
|
|
8
|
-
export type SearchResponse = paths["/v1/search/check/{run_id}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
9
|
-
export declare class Pipe0TimeoutError extends Error {
|
|
10
|
-
readonly runId?: string | undefined;
|
|
11
|
-
constructor(message: string, runId?: string | undefined);
|
|
12
|
-
}
|
|
13
|
-
export declare class Pipe0AbortError extends Error {
|
|
14
|
-
readonly runId?: string | undefined;
|
|
15
|
-
constructor(message: string, runId?: string | undefined);
|
|
16
|
-
}
|
|
17
|
-
export declare class Pipe0BatchError extends Error {
|
|
18
|
-
readonly errors: Array<{
|
|
19
|
-
batchIndex: number;
|
|
20
|
-
error: Error;
|
|
21
|
-
}>;
|
|
22
|
-
readonly successfulBatches: PipesResponse[];
|
|
23
|
-
constructor(message: string, errors: Array<{
|
|
24
|
-
batchIndex: number;
|
|
25
|
-
error: Error;
|
|
26
|
-
}>, successfulBatches: PipesResponse[]);
|
|
27
|
-
}
|
|
28
|
-
export declare class Pipe0TaskError extends Error {
|
|
29
|
-
readonly responseBody?: unknown | undefined;
|
|
30
|
-
constructor(message: string, responseBody?: unknown | undefined);
|
|
31
|
-
}
|
|
32
|
-
export declare class Pipe0ServerError extends Error {
|
|
33
|
-
constructor(message: string);
|
|
34
|
-
}
|
|
35
|
-
export interface BatchOptions {
|
|
36
|
-
/**
|
|
37
|
-
* Callback invoked on each poll for any batch
|
|
38
|
-
*/
|
|
39
|
-
onPoll?: (_batchIndex: number, _response: PipesResponse) => void;
|
|
40
|
-
/**
|
|
41
|
-
* Callback invoked when each batch completes
|
|
42
|
-
*/
|
|
43
|
-
onBatchComplete?: (_batchIndex: number, _result: PipesResponse) => void;
|
|
44
|
-
/**
|
|
45
|
-
* Whether to stop all batches if one fails
|
|
46
|
-
* @default true
|
|
47
|
-
*/
|
|
48
|
-
stopOnError?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* AbortSignal to cancel all batch operations
|
|
51
|
-
*/
|
|
52
|
-
signal?: AbortSignal;
|
|
53
|
-
}
|
|
54
|
-
export interface Pipe0Options {
|
|
55
|
-
apiKey?: string;
|
|
56
|
-
baseUrl?: string;
|
|
57
|
-
credentials?: RequestInit["credentials"];
|
|
58
|
-
/**
|
|
59
|
-
* Default timeout for polling operations in milliseconds
|
|
60
|
-
* @default 900000 (15 minutes)
|
|
61
|
-
*/
|
|
62
|
-
pollingTimeoutMs?: number;
|
|
63
|
-
/**
|
|
64
|
-
* Default polling interval in milliseconds
|
|
65
|
-
* @default 1000 (1 second)
|
|
66
|
-
*/
|
|
67
|
-
minPollingIntervalMs?: number;
|
|
68
|
-
/**
|
|
69
|
-
* Maximum polling interval in milliseconds (for exponential backoff)
|
|
70
|
-
* @default 3000 (3 seconds)
|
|
71
|
-
*/
|
|
72
|
-
maxPollingIntervalMs?: number;
|
|
73
|
-
/**
|
|
74
|
-
* Default batch size for large payloads
|
|
75
|
-
* @default 100
|
|
76
|
-
*/
|
|
77
|
-
defaultBatchSize?: number;
|
|
78
|
-
/**
|
|
79
|
-
* Maximum number of concurrent batch requests
|
|
80
|
-
* @default 5
|
|
81
|
-
*/
|
|
82
|
-
maxConcurrentBatches?: number;
|
|
83
|
-
}
|
|
84
|
-
export declare class Pipe0 {
|
|
85
|
-
client: Client<paths, `${string}/${string}`>;
|
|
86
|
-
private apiKey?;
|
|
87
|
-
private pollingTimeoutMs;
|
|
88
|
-
private minPollingIntervalMs;
|
|
89
|
-
private maxPollingIntervalMs;
|
|
90
|
-
private defaultBatchSize;
|
|
91
|
-
private maxConcurrentBatches;
|
|
92
|
-
constructor(options?: Pipe0Options);
|
|
93
|
-
/**
|
|
94
|
-
* Centralized logic to poll until a task completes, fails, or times out.
|
|
95
|
-
*/
|
|
96
|
-
private _pollUntilComplete;
|
|
97
|
-
pipes: {
|
|
98
|
-
/**
|
|
99
|
-
* Create and immediately wait for completion (convenience method)
|
|
100
|
-
*/
|
|
101
|
-
pipe: (payload: PipesRequest, options?: {
|
|
102
|
-
onPoll?: (_response: PipesResponse) => unknown;
|
|
103
|
-
signal?: AbortSignal;
|
|
104
|
-
}) => Promise<PipesResponse>;
|
|
105
|
-
/**
|
|
106
|
-
* Create a pipes task but don't want for it. Use this method if you want to fire and forget.
|
|
107
|
-
*/
|
|
108
|
-
create: (payload: PipesRequest) => Promise<string>;
|
|
109
|
-
/**
|
|
110
|
-
* Check the status of a pipes task manually.
|
|
111
|
-
*/
|
|
112
|
-
check: (runId: string) => Promise<{
|
|
113
|
-
id: string;
|
|
114
|
-
organization_id: string;
|
|
115
|
-
order: (number | string)[];
|
|
116
|
-
field_definitions: {
|
|
117
|
-
[key: string]: {
|
|
118
|
-
type: "string" | "number" | "boolean" | "json" | "unknown";
|
|
119
|
-
label: string;
|
|
120
|
-
added_by: {
|
|
121
|
-
ref: ("prompt:run@1" | "company:newssummary:website@1" | "company:techstack:builtwith@1" | "company:websiteurl:email@1" | "company:funding:leadmagic@1" | "people:workemail:waterfall@1" | "people:email:iswork@1" | "people:name:split@1" | "people:name:join@1" | "people:validate:email:zerobounce@1" | "people:email:validate:zerobounce@2" | "people:mobilenumber:workemail:waterfall@1" | "company:overview@1" | "company:overview@2" | "json:extract@1" | "email:write@1" | "message:write@1" | "email:send:resend@1" | "email:send:gmail@1" | "message:send:slack@1" | "template:fill@1" | "contact:create:resend@1" | "people:match:role:waterfall@1" | "people:identity:amplemarket@1" | "company:identity@2" | "people:match:amplemarket@1" | "people:phone:profile:waterfall@1" | "people:personalemail:profile:waterfall@1" | "people:profile:waterfall@1" | "people:profileurl:email:waterfall@1" | "people:profileurl:name@1" | "people:email:validate:zerobounce@1" | "people:email:validate:millionverifier@1" | "people:phone:workemail:waterfall@1" | "fields:merge@1" | "field:slugify@1" | "field:domainify@1" | "website:scrape:firecrawl@1" | "website:scrapelist:firecrawl@1" | "website:extract:firecrawl@1" | "website:maplinks:firecrawl@1" | "sheet:row:append@1" | "sheet:row:expandappend@1" | "company:lookalikes:companyenrich@1" | "company:match:logodev@1" | "people:posts:crustdata@1" | "company:match:crustdata@1" | "people:profile:workemail:crustdata@1" | "people:workemail:profileurl:waterfall@1" | "people:identity:email:waterfall@1" | "sheet:row:append:sheet@1" | "company:identity@1" | "people:professionalprofile:waterfall@1" | "people:professionalprofileurl:name@1" | "people:professionalprofileurl:email:waterfall@1" | "people:mobilenumber:professionalprofile:waterfall@1") | "input";
|
|
122
|
-
config_hash: string | null;
|
|
123
|
-
pipe_index: number | null;
|
|
124
|
-
};
|
|
125
|
-
format: "json_object" | "json_list" | "json_list_string" | "url" | "website_url" | "profile_url" | "email" | "datetime" | "currency" | "date" | "phone" | "markdown" | "text" | "int" | "decimal" | "address_line_1" | "zip_code" | "percent" | null;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
errors: {
|
|
129
|
-
code: string;
|
|
130
|
-
message: string;
|
|
131
|
-
path?: string;
|
|
132
|
-
}[];
|
|
133
|
-
records: {
|
|
134
|
-
[key: string]: {
|
|
135
|
-
id: number | string;
|
|
136
|
-
fields: {
|
|
137
|
-
[key: string]: {
|
|
138
|
-
value: string | number | boolean | null | {
|
|
139
|
-
[key: string]: unknown;
|
|
140
|
-
} | unknown[];
|
|
141
|
-
status: "completed" | "failed" | "pending" | "queued" | "processing" | "no_result" | "skipped";
|
|
142
|
-
type: "string" | "number" | "boolean" | "json" | "unknown";
|
|
143
|
-
reason: {
|
|
144
|
-
code: string;
|
|
145
|
-
summary: string;
|
|
146
|
-
message: string;
|
|
147
|
-
} | null;
|
|
148
|
-
claimed_by: {
|
|
149
|
-
ref: "prompt:run@1" | "company:newssummary:website@1" | "company:techstack:builtwith@1" | "company:websiteurl:email@1" | "company:funding:leadmagic@1" | "people:workemail:waterfall@1" | "people:email:iswork@1" | "people:name:split@1" | "people:name:join@1" | "people:validate:email:zerobounce@1" | "people:email:validate:zerobounce@2" | "people:mobilenumber:workemail:waterfall@1" | "company:overview@1" | "company:overview@2" | "json:extract@1" | "email:write@1" | "message:write@1" | "email:send:resend@1" | "email:send:gmail@1" | "message:send:slack@1" | "template:fill@1" | "contact:create:resend@1" | "people:match:role:waterfall@1" | "people:identity:amplemarket@1" | "company:identity@2" | "people:match:amplemarket@1" | "people:phone:profile:waterfall@1" | "people:personalemail:profile:waterfall@1" | "people:profile:waterfall@1" | "people:profileurl:email:waterfall@1" | "people:profileurl:name@1" | "people:email:validate:zerobounce@1" | "people:email:validate:millionverifier@1" | "people:phone:workemail:waterfall@1" | "fields:merge@1" | "field:slugify@1" | "field:domainify@1" | "website:scrape:firecrawl@1" | "website:scrapelist:firecrawl@1" | "website:extract:firecrawl@1" | "website:maplinks:firecrawl@1" | "sheet:row:append@1" | "sheet:row:expandappend@1" | "company:lookalikes:companyenrich@1" | "company:match:logodev@1" | "people:posts:crustdata@1" | "company:match:crustdata@1" | "people:profile:workemail:crustdata@1" | "people:workemail:profileurl:waterfall@1" | "people:identity:email:waterfall@1" | "sheet:row:append:sheet@1" | "company:identity@1" | "people:professionalprofile:waterfall@1" | "people:professionalprofileurl:name@1" | "people:professionalprofileurl:email:waterfall@1" | "people:mobilenumber:professionalprofile:waterfall@1" | "input" | null;
|
|
150
|
-
config_hash: string | null;
|
|
151
|
-
};
|
|
152
|
-
resolved_by: {
|
|
153
|
-
ref: "prompt:run@1" | "company:newssummary:website@1" | "company:techstack:builtwith@1" | "company:websiteurl:email@1" | "company:funding:leadmagic@1" | "people:workemail:waterfall@1" | "people:email:iswork@1" | "people:name:split@1" | "people:name:join@1" | "people:validate:email:zerobounce@1" | "people:email:validate:zerobounce@2" | "people:mobilenumber:workemail:waterfall@1" | "company:overview@1" | "company:overview@2" | "json:extract@1" | "email:write@1" | "message:write@1" | "email:send:resend@1" | "email:send:gmail@1" | "message:send:slack@1" | "template:fill@1" | "contact:create:resend@1" | "people:match:role:waterfall@1" | "people:identity:amplemarket@1" | "company:identity@2" | "people:match:amplemarket@1" | "people:phone:profile:waterfall@1" | "people:personalemail:profile:waterfall@1" | "people:profile:waterfall@1" | "people:profileurl:email:waterfall@1" | "people:profileurl:name@1" | "people:email:validate:zerobounce@1" | "people:email:validate:millionverifier@1" | "people:phone:workemail:waterfall@1" | "fields:merge@1" | "field:slugify@1" | "field:domainify@1" | "website:scrape:firecrawl@1" | "website:scrapelist:firecrawl@1" | "website:extract:firecrawl@1" | "website:maplinks:firecrawl@1" | "sheet:row:append@1" | "sheet:row:expandappend@1" | "company:lookalikes:companyenrich@1" | "company:match:logodev@1" | "people:posts:crustdata@1" | "company:match:crustdata@1" | "people:profile:workemail:crustdata@1" | "people:workemail:profileurl:waterfall@1" | "people:identity:email:waterfall@1" | "sheet:row:append:sheet@1" | "company:identity@1" | "people:professionalprofile:waterfall@1" | "people:professionalprofileurl:name@1" | "people:professionalprofileurl:email:waterfall@1" | "people:mobilenumber:professionalprofile:waterfall@1" | "input" | "system" | null;
|
|
154
|
-
environment: "production" | "sandbox" | null;
|
|
155
|
-
config_hash: string | null;
|
|
156
|
-
input_hash: string | null;
|
|
157
|
-
} | null;
|
|
158
|
-
widgets?: {
|
|
159
|
-
display_value?: {
|
|
160
|
-
label?: string;
|
|
161
|
-
};
|
|
162
|
-
entity_logo?: {
|
|
163
|
-
image_url: string;
|
|
164
|
-
entity: string;
|
|
165
|
-
};
|
|
166
|
-
location_indicator?: {
|
|
167
|
-
emoji: string;
|
|
168
|
-
};
|
|
169
|
-
avatar?: {
|
|
170
|
-
image_url: string;
|
|
171
|
-
name: string;
|
|
172
|
-
};
|
|
173
|
-
waterfall?: {
|
|
174
|
-
attempted_providers: {
|
|
175
|
-
provider: "pipe0" | "findymail" | "crustdata" | "hunter" | "zerobounce" | "millionverifier" | "googlemaps" | "gemini" | "leadmagic" | "builtwith" | "perplexity" | "serper" | "icypeas" | "prospeo" | "clado" | "resend" | "slack" | "gmail" | "firecrawl" | "exa" | "openai" | "companyenrich" | "logodev" | "amplemarket";
|
|
176
|
-
}[];
|
|
177
|
-
available_providers: ("pipe0" | "findymail" | "crustdata" | "hunter" | "zerobounce" | "millionverifier" | "googlemaps" | "gemini" | "leadmagic" | "builtwith" | "perplexity" | "serper" | "icypeas" | "prospeo" | "clado" | "resend" | "slack" | "gmail" | "firecrawl" | "exa" | "openai" | "companyenrich" | "logodev" | "amplemarket")[];
|
|
178
|
-
successful_provider?: "pipe0" | "findymail" | "crustdata" | "hunter" | "zerobounce" | "millionverifier" | "googlemaps" | "gemini" | "leadmagic" | "builtwith" | "perplexity" | "serper" | "icypeas" | "prospeo" | "clado" | "resend" | "slack" | "gmail" | "firecrawl" | "exa" | "openai" | "companyenrich" | "logodev" | "amplemarket";
|
|
179
|
-
};
|
|
180
|
-
icon?: {
|
|
181
|
-
key: "linkedin" | "job";
|
|
182
|
-
};
|
|
183
|
-
action_summary?: {
|
|
184
|
-
result_status: "completed" | "failed";
|
|
185
|
-
};
|
|
186
|
-
sources?: {
|
|
187
|
-
list: {
|
|
188
|
-
source: string;
|
|
189
|
-
description?: string;
|
|
190
|
-
url: string;
|
|
191
|
-
}[];
|
|
192
|
-
};
|
|
193
|
-
confidence?: {
|
|
194
|
-
numeric: number;
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
format: "json_object" | "json_list" | "json_list_string" | "url" | "website_url" | "profile_url" | "email" | "datetime" | "currency" | "date" | "phone" | "markdown" | "text" | "int" | "decimal" | "address_line_1" | "zip_code" | "percent" | null;
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
};
|
|
201
|
-
};
|
|
202
|
-
status: "completed" | "failed" | "pending" | "processing";
|
|
203
|
-
}>;
|
|
204
|
-
waitUntilComplete: (runId: string | Promise<string>, options?: {
|
|
205
|
-
/**
|
|
206
|
-
* Callback invoked on each poll with the current status
|
|
207
|
-
*/
|
|
208
|
-
onPoll?: (_response: PipesResponse) => unknown;
|
|
209
|
-
/**
|
|
210
|
-
* AbortSignal to cancel the polling operation
|
|
211
|
-
*/
|
|
212
|
-
signal?: AbortSignal;
|
|
213
|
-
}) => Promise<PipesResponse>;
|
|
214
|
-
/**
|
|
215
|
-
* Process a large payload by batching the input array
|
|
216
|
-
* @param payload - The pipe request payload with a large input array
|
|
217
|
-
* @param options - Batching options
|
|
218
|
-
* @returns Array of completed batch responses
|
|
219
|
-
*/
|
|
220
|
-
pipeInBatches: (payload: PipesRequest, { stopOnError, ...options }?: BatchOptions) => Promise<PipesResponse[]>;
|
|
221
|
-
};
|
|
222
|
-
searches: {
|
|
223
|
-
/**
|
|
224
|
-
* Create and immediately wait for completion (convenience method)
|
|
225
|
-
*/
|
|
226
|
-
search: (payload: SearchesRequest, options?: {
|
|
227
|
-
onPoll?: (_response: SearchesResponse) => unknown;
|
|
228
|
-
signal?: AbortSignal;
|
|
229
|
-
}) => Promise<SearchesResponse>;
|
|
230
|
-
/**
|
|
231
|
-
* Create a searches task but don't wait for it.
|
|
232
|
-
* Use this if you want fire and forget.
|
|
233
|
-
*/
|
|
234
|
-
create: (payload: SearchesRequest) => Promise<string>;
|
|
235
|
-
/**
|
|
236
|
-
* Check the status of a search task manually.
|
|
237
|
-
*/
|
|
238
|
-
check: (runId: string) => Promise<{
|
|
239
|
-
id: string;
|
|
240
|
-
status: "completed" | "failed" | "pending" | "processing";
|
|
241
|
-
results: {
|
|
242
|
-
[key: string]: {
|
|
243
|
-
value: string | number | boolean | null | {
|
|
244
|
-
[key: string]: unknown;
|
|
245
|
-
} | unknown[];
|
|
246
|
-
status: "completed" | "failed" | "pending" | "queued" | "processing" | "no_result" | "skipped";
|
|
247
|
-
type?: "string" | "number" | "boolean" | "json" | "unknown";
|
|
248
|
-
format?: "json_object" | "json_list" | "json_list_string" | "url" | "website_url" | "profile_url" | "email" | "datetime" | "currency" | "date" | "phone" | "markdown" | "text" | "int" | "decimal" | "address_line_1" | "zip_code" | "percent" | null;
|
|
249
|
-
resolved_by?: {
|
|
250
|
-
ref: "prompt:run@1" | "company:newssummary:website@1" | "company:techstack:builtwith@1" | "company:websiteurl:email@1" | "company:funding:leadmagic@1" | "people:workemail:waterfall@1" | "people:email:iswork@1" | "people:name:split@1" | "people:name:join@1" | "people:validate:email:zerobounce@1" | "people:email:validate:zerobounce@2" | "people:mobilenumber:workemail:waterfall@1" | "company:overview@1" | "company:overview@2" | "json:extract@1" | "email:write@1" | "message:write@1" | "email:send:resend@1" | "email:send:gmail@1" | "message:send:slack@1" | "template:fill@1" | "contact:create:resend@1" | "people:match:role:waterfall@1" | "people:identity:amplemarket@1" | "company:identity@2" | "people:match:amplemarket@1" | "people:phone:profile:waterfall@1" | "people:personalemail:profile:waterfall@1" | "people:profile:waterfall@1" | "people:profileurl:email:waterfall@1" | "people:profileurl:name@1" | "people:email:validate:zerobounce@1" | "people:email:validate:millionverifier@1" | "people:phone:workemail:waterfall@1" | "fields:merge@1" | "field:slugify@1" | "field:domainify@1" | "website:scrape:firecrawl@1" | "website:scrapelist:firecrawl@1" | "website:extract:firecrawl@1" | "website:maplinks:firecrawl@1" | "sheet:row:append@1" | "sheet:row:expandappend@1" | "company:lookalikes:companyenrich@1" | "company:match:logodev@1" | "people:posts:crustdata@1" | "company:match:crustdata@1" | "people:profile:workemail:crustdata@1" | "people:workemail:profileurl:waterfall@1" | "people:identity:email:waterfall@1" | "sheet:row:append:sheet@1" | "company:identity@1" | "people:professionalprofile:waterfall@1" | "people:professionalprofileurl:name@1" | "people:professionalprofileurl:email:waterfall@1" | "people:mobilenumber:professionalprofile:waterfall@1" | "input" | "system" | null;
|
|
251
|
-
environment: "production" | "sandbox" | null;
|
|
252
|
-
config_hash: string | null;
|
|
253
|
-
input_hash: string | null;
|
|
254
|
-
} | null;
|
|
255
|
-
widgets?: {
|
|
256
|
-
display_value?: {
|
|
257
|
-
label?: string;
|
|
258
|
-
};
|
|
259
|
-
entity_logo?: {
|
|
260
|
-
image_url: string;
|
|
261
|
-
entity: string;
|
|
262
|
-
};
|
|
263
|
-
location_indicator?: {
|
|
264
|
-
emoji: string;
|
|
265
|
-
};
|
|
266
|
-
avatar?: {
|
|
267
|
-
image_url: string;
|
|
268
|
-
name: string;
|
|
269
|
-
};
|
|
270
|
-
waterfall?: {
|
|
271
|
-
attempted_providers: {
|
|
272
|
-
provider: "pipe0" | "findymail" | "crustdata" | "hunter" | "zerobounce" | "millionverifier" | "googlemaps" | "gemini" | "leadmagic" | "builtwith" | "perplexity" | "serper" | "icypeas" | "prospeo" | "clado" | "resend" | "slack" | "gmail" | "firecrawl" | "exa" | "openai" | "companyenrich" | "logodev" | "amplemarket";
|
|
273
|
-
}[];
|
|
274
|
-
available_providers: ("pipe0" | "findymail" | "crustdata" | "hunter" | "zerobounce" | "millionverifier" | "googlemaps" | "gemini" | "leadmagic" | "builtwith" | "perplexity" | "serper" | "icypeas" | "prospeo" | "clado" | "resend" | "slack" | "gmail" | "firecrawl" | "exa" | "openai" | "companyenrich" | "logodev" | "amplemarket")[];
|
|
275
|
-
successful_provider?: "pipe0" | "findymail" | "crustdata" | "hunter" | "zerobounce" | "millionverifier" | "googlemaps" | "gemini" | "leadmagic" | "builtwith" | "perplexity" | "serper" | "icypeas" | "prospeo" | "clado" | "resend" | "slack" | "gmail" | "firecrawl" | "exa" | "openai" | "companyenrich" | "logodev" | "amplemarket";
|
|
276
|
-
};
|
|
277
|
-
icon?: {
|
|
278
|
-
key: "linkedin" | "job";
|
|
279
|
-
};
|
|
280
|
-
action_summary?: {
|
|
281
|
-
result_status: "completed" | "failed";
|
|
282
|
-
};
|
|
283
|
-
sources?: {
|
|
284
|
-
list: {
|
|
285
|
-
source: string;
|
|
286
|
-
description?: string;
|
|
287
|
-
url: string;
|
|
288
|
-
}[];
|
|
289
|
-
};
|
|
290
|
-
confidence?: {
|
|
291
|
-
numeric: number;
|
|
292
|
-
};
|
|
293
|
-
};
|
|
294
|
-
} | null;
|
|
295
|
-
}[];
|
|
296
|
-
search_statuses: {
|
|
297
|
-
search: {
|
|
298
|
-
ref: "people:profiles:icypeas@1" | "companies:profiles:icypeas@1" | "people:profiles:clado@1" | "people:profiles:clado@2" | "people:employees:leadmagic@1" | "companies:profiles:exa@1" | "people:profiles:exa@1" | "companies:profiles:crustdata@1" | "people:profiles:crustdata@1";
|
|
299
|
-
};
|
|
300
|
-
status: "pending" | "processing" | "failed" | "completed";
|
|
301
|
-
errors: {
|
|
302
|
-
code: string;
|
|
303
|
-
message: string;
|
|
304
|
-
path?: string;
|
|
305
|
-
}[];
|
|
306
|
-
meta: {
|
|
307
|
-
providers?: {
|
|
308
|
-
clado?: {
|
|
309
|
-
pagination: {
|
|
310
|
-
search_id?: string;
|
|
311
|
-
offset?: number;
|
|
312
|
-
};
|
|
313
|
-
};
|
|
314
|
-
crustdata?: {
|
|
315
|
-
pagination: {
|
|
316
|
-
cursor: string | null;
|
|
317
|
-
};
|
|
318
|
-
};
|
|
319
|
-
};
|
|
320
|
-
};
|
|
321
|
-
}[];
|
|
322
|
-
organizationId: string;
|
|
323
|
-
}>;
|
|
324
|
-
/**
|
|
325
|
-
* Poll until the search completes or fails.
|
|
326
|
-
*/
|
|
327
|
-
waitUntilComplete: (runId: string | Promise<string>, options?: {
|
|
328
|
-
onPoll?: (_response: SearchesResponse) => unknown;
|
|
329
|
-
signal?: AbortSignal;
|
|
330
|
-
}) => Promise<SearchesResponse>;
|
|
331
|
-
};
|
|
332
|
-
private sleep;
|
|
333
|
-
}
|
package/dist/pipe0.js
DELETED
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
import createFetchClient, {} from "openapi-fetch";
|
|
2
|
-
export class Pipe0TimeoutError extends Error {
|
|
3
|
-
runId;
|
|
4
|
-
constructor(message, runId) {
|
|
5
|
-
super(message);
|
|
6
|
-
this.runId = runId;
|
|
7
|
-
this.name = "Pipe0TimeoutError";
|
|
8
|
-
this.runId = runId;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
export class Pipe0AbortError extends Error {
|
|
12
|
-
runId;
|
|
13
|
-
constructor(message, runId) {
|
|
14
|
-
super(message);
|
|
15
|
-
this.runId = runId;
|
|
16
|
-
this.name = "Pipe0AbortError";
|
|
17
|
-
this.runId = runId;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export class Pipe0BatchError extends Error {
|
|
21
|
-
errors;
|
|
22
|
-
successfulBatches;
|
|
23
|
-
constructor(message, errors, successfulBatches) {
|
|
24
|
-
super(message);
|
|
25
|
-
this.errors = errors;
|
|
26
|
-
this.successfulBatches = successfulBatches;
|
|
27
|
-
this.name = "Pipe0BatchError";
|
|
28
|
-
this.errors = errors;
|
|
29
|
-
this.successfulBatches = successfulBatches;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export class Pipe0TaskError extends Error {
|
|
33
|
-
responseBody;
|
|
34
|
-
constructor(message, responseBody) {
|
|
35
|
-
super(message);
|
|
36
|
-
this.responseBody = responseBody;
|
|
37
|
-
this.name = "Pipe0TaskError";
|
|
38
|
-
this.responseBody = responseBody;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export class Pipe0ServerError extends Error {
|
|
42
|
-
constructor(message) {
|
|
43
|
-
super(message);
|
|
44
|
-
this.name = "Pipe0ServerError";
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
export class Pipe0 {
|
|
48
|
-
client;
|
|
49
|
-
apiKey;
|
|
50
|
-
pollingTimeoutMs;
|
|
51
|
-
minPollingIntervalMs;
|
|
52
|
-
maxPollingIntervalMs;
|
|
53
|
-
defaultBatchSize;
|
|
54
|
-
maxConcurrentBatches;
|
|
55
|
-
constructor(options = {}) {
|
|
56
|
-
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
|
57
|
-
this.apiKey = options.apiKey ?? process.env.PIPE0_API_KEY;
|
|
58
|
-
this.pollingTimeoutMs = options.pollingTimeoutMs ?? 900000;
|
|
59
|
-
this.minPollingIntervalMs = options.minPollingIntervalMs ?? 1000;
|
|
60
|
-
this.maxPollingIntervalMs =
|
|
61
|
-
options.maxPollingIntervalMs ?? this.minPollingIntervalMs * 3;
|
|
62
|
-
this.defaultBatchSize = options.defaultBatchSize ?? 100;
|
|
63
|
-
this.maxConcurrentBatches = options.maxConcurrentBatches ?? 5;
|
|
64
|
-
const headers = {};
|
|
65
|
-
if (this.apiKey) {
|
|
66
|
-
headers.Authorization = `Bearer ${this.apiKey}`;
|
|
67
|
-
}
|
|
68
|
-
this.client = createFetchClient({
|
|
69
|
-
baseUrl: options.baseUrl ?? "https://api.pipe0.com",
|
|
70
|
-
credentials: options.credentials
|
|
71
|
-
? options.credentials
|
|
72
|
-
: options.baseUrl
|
|
73
|
-
? "same-origin"
|
|
74
|
-
: "include",
|
|
75
|
-
headers,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Centralized logic to poll until a task completes, fails, or times out.
|
|
80
|
-
*/
|
|
81
|
-
async _pollUntilComplete(runId, checkFn, taskType, options = {}) {
|
|
82
|
-
const resolvedRunId = await runId;
|
|
83
|
-
const timeout = this.pollingTimeoutMs;
|
|
84
|
-
const initialInterval = this.minPollingIntervalMs;
|
|
85
|
-
const maxInterval = this.maxPollingIntervalMs;
|
|
86
|
-
// We can hardcode backoff for simplicity since it's the only logic
|
|
87
|
-
const useBackoff = true;
|
|
88
|
-
const startTime = Date.now();
|
|
89
|
-
let currentInterval = initialInterval;
|
|
90
|
-
while (true) {
|
|
91
|
-
if (Date.now() - startTime >= timeout) {
|
|
92
|
-
throw new Pipe0TimeoutError(`${taskType} polling timed out after ${timeout}ms`, resolvedRunId);
|
|
93
|
-
}
|
|
94
|
-
if (options.signal?.aborted) {
|
|
95
|
-
throw new Pipe0AbortError(`${taskType} polling was aborted`, resolvedRunId);
|
|
96
|
-
}
|
|
97
|
-
const polledResponse = await checkFn(resolvedRunId);
|
|
98
|
-
if (options.onPoll) {
|
|
99
|
-
await options.onPoll(polledResponse);
|
|
100
|
-
}
|
|
101
|
-
if (polledResponse.status === "completed") {
|
|
102
|
-
return polledResponse;
|
|
103
|
-
}
|
|
104
|
-
if (polledResponse.status === "failed") {
|
|
105
|
-
throw new Pipe0TaskError(`${taskType} failed with status: ${polledResponse.status}`, polledResponse);
|
|
106
|
-
}
|
|
107
|
-
await this.sleep(currentInterval, options.signal);
|
|
108
|
-
if (useBackoff) {
|
|
109
|
-
currentInterval = Math.min(currentInterval * 1.1, maxInterval);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
pipes = {
|
|
114
|
-
/**
|
|
115
|
-
* Create and immediately wait for completion (convenience method)
|
|
116
|
-
*/
|
|
117
|
-
pipe: async (payload, options = {}) => {
|
|
118
|
-
return this.pipes.waitUntilComplete(await this.pipes.create(payload), options);
|
|
119
|
-
},
|
|
120
|
-
/**
|
|
121
|
-
* Create a pipes task but don't want for it. Use this method if you want to fire and forget.
|
|
122
|
-
*/
|
|
123
|
-
create: async (payload) => {
|
|
124
|
-
const response = await this.client.POST("/v1/pipes/run", {
|
|
125
|
-
body: payload,
|
|
126
|
-
});
|
|
127
|
-
if (response.error) {
|
|
128
|
-
throw new Pipe0ServerError(JSON.stringify(response.error));
|
|
129
|
-
}
|
|
130
|
-
return response.data.id;
|
|
131
|
-
},
|
|
132
|
-
/**
|
|
133
|
-
* Check the status of a pipes task manually.
|
|
134
|
-
*/
|
|
135
|
-
check: async (runId) => {
|
|
136
|
-
const response = await this.client.GET("/v1/pipes/check/{run_id}", {
|
|
137
|
-
params: { path: { run_id: runId } },
|
|
138
|
-
});
|
|
139
|
-
if (response.error) {
|
|
140
|
-
throw new Pipe0ServerError(JSON.stringify(response.error));
|
|
141
|
-
}
|
|
142
|
-
return response.data;
|
|
143
|
-
},
|
|
144
|
-
waitUntilComplete: async (runId, options = {}) => {
|
|
145
|
-
return this._pollUntilComplete(runId, this.pipes.check, "Pipe", options);
|
|
146
|
-
},
|
|
147
|
-
/**
|
|
148
|
-
* Process a large payload by batching the input array
|
|
149
|
-
* @param payload - The pipe request payload with a large input array
|
|
150
|
-
* @param options - Batching options
|
|
151
|
-
* @returns Array of completed batch responses
|
|
152
|
-
*/
|
|
153
|
-
pipeInBatches: async (payload, { stopOnError = true, ...options } = {}) => {
|
|
154
|
-
const batchSize = this.defaultBatchSize;
|
|
155
|
-
const maxConcurrency = this.maxConcurrentBatches;
|
|
156
|
-
// Extract and validate input array
|
|
157
|
-
if (!Array.isArray(payload.input)) {
|
|
158
|
-
throw new Error("payload.input must be an array for batched operations");
|
|
159
|
-
}
|
|
160
|
-
const inputArray = payload.input;
|
|
161
|
-
const totalItems = inputArray.length;
|
|
162
|
-
// Create batches
|
|
163
|
-
const batches = [];
|
|
164
|
-
for (let i = 0; i < totalItems; i += batchSize) {
|
|
165
|
-
const batchInput = inputArray.slice(i, i + batchSize);
|
|
166
|
-
batches.push({
|
|
167
|
-
...payload,
|
|
168
|
-
input: batchInput,
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
// Process batches with concurrency control
|
|
172
|
-
const resultsArr = [];
|
|
173
|
-
const errors = [];
|
|
174
|
-
for (let i = 0; i < batches.length; i += maxConcurrency) {
|
|
175
|
-
if (options.signal?.aborted) {
|
|
176
|
-
throw new Pipe0AbortError("Batch operation was aborted");
|
|
177
|
-
}
|
|
178
|
-
const batchGroup = batches.slice(i, i + maxConcurrency);
|
|
179
|
-
const batchPromises = batchGroup.map(async (batch, groupIndex) => {
|
|
180
|
-
const batchIndex = i + groupIndex;
|
|
181
|
-
try {
|
|
182
|
-
// Create and wait for batch
|
|
183
|
-
const runId = await this.pipes.create(batch);
|
|
184
|
-
const result = await this.pipes.waitUntilComplete(runId, {
|
|
185
|
-
signal: options.signal,
|
|
186
|
-
onPoll: options.onPoll
|
|
187
|
-
? (response) => options.onPoll(batchIndex, response)
|
|
188
|
-
: undefined,
|
|
189
|
-
});
|
|
190
|
-
if (options.onBatchComplete) {
|
|
191
|
-
options.onBatchComplete(batchIndex, result);
|
|
192
|
-
}
|
|
193
|
-
return { batchIndex, result };
|
|
194
|
-
}
|
|
195
|
-
catch (error) {
|
|
196
|
-
const err = error instanceof Error ? error : new Error(String(error));
|
|
197
|
-
errors.push({ batchIndex, error: err });
|
|
198
|
-
if (stopOnError) {
|
|
199
|
-
throw new Pipe0BatchError(`Batch ${batchIndex} failed and stopOnError is enabled`, errors, resultsArr);
|
|
200
|
-
}
|
|
201
|
-
return { batchIndex, result: null };
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
const batchResults = await Promise.all(batchPromises);
|
|
205
|
-
// Collect results in order
|
|
206
|
-
for (const { result } of batchResults) {
|
|
207
|
-
if (result) {
|
|
208
|
-
resultsArr.push(result);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
// If any errors occurred and stopOnError wasn't enabled, throw at the end
|
|
213
|
-
if (errors.length > 0) {
|
|
214
|
-
throw new Pipe0BatchError(`${errors.length} batch(es) failed out of ${batches.length} total`, errors, resultsArr);
|
|
215
|
-
}
|
|
216
|
-
return resultsArr;
|
|
217
|
-
},
|
|
218
|
-
};
|
|
219
|
-
searches = {
|
|
220
|
-
/**
|
|
221
|
-
* Create and immediately wait for completion (convenience method)
|
|
222
|
-
*/
|
|
223
|
-
search: async (payload, options = {}) => {
|
|
224
|
-
return this.searches.waitUntilComplete(await this.searches.create(payload), options);
|
|
225
|
-
},
|
|
226
|
-
/**
|
|
227
|
-
* Create a searches task but don't wait for it.
|
|
228
|
-
* Use this if you want fire and forget.
|
|
229
|
-
*/
|
|
230
|
-
create: async (payload) => {
|
|
231
|
-
const response = await this.client.POST("/v1/searches/run", {
|
|
232
|
-
body: payload,
|
|
233
|
-
});
|
|
234
|
-
if (response.error) {
|
|
235
|
-
throw new Pipe0ServerError(JSON.stringify(response.error));
|
|
236
|
-
}
|
|
237
|
-
return response.data.id;
|
|
238
|
-
},
|
|
239
|
-
/**
|
|
240
|
-
* Check the status of a search task manually.
|
|
241
|
-
*/
|
|
242
|
-
check: async (runId) => {
|
|
243
|
-
const response = await this.client.GET("/v1/searches/check/{run_id}", {
|
|
244
|
-
params: { path: { run_id: runId } },
|
|
245
|
-
});
|
|
246
|
-
if (response.error) {
|
|
247
|
-
throw new Pipe0ServerError(JSON.stringify(response.error));
|
|
248
|
-
}
|
|
249
|
-
return response.data;
|
|
250
|
-
},
|
|
251
|
-
/**
|
|
252
|
-
* Poll until the search completes or fails.
|
|
253
|
-
*/
|
|
254
|
-
waitUntilComplete: async (runId, options = {}) => {
|
|
255
|
-
return this._pollUntilComplete(runId, this.searches.check, "Search", options);
|
|
256
|
-
},
|
|
257
|
-
};
|
|
258
|
-
sleep(ms, signal) {
|
|
259
|
-
return new Promise((resolve, reject) => {
|
|
260
|
-
const timeout = setTimeout(resolve, ms);
|
|
261
|
-
if (signal) {
|
|
262
|
-
const onAbort = () => {
|
|
263
|
-
clearTimeout(timeout);
|
|
264
|
-
reject(new Pipe0AbortError("Sleep was aborted"));
|
|
265
|
-
};
|
|
266
|
-
if (signal.aborted) {
|
|
267
|
-
clearTimeout(timeout);
|
|
268
|
-
reject(new Pipe0AbortError("Sleep was aborted"));
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
}
|