@productcraft/trawl 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 +61 -0
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +606 -0
- package/dist/index.d.ts +606 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ProductCraft
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @productcraft/trawl
|
|
2
|
+
|
|
3
|
+
Typed Node.js / TypeScript client for **ProductCraft Trawl** — AI web
|
|
4
|
+
extraction. Hand Trawl a JSON Schema plus a natural-language description
|
|
5
|
+
(and optional seed URLs); a browser agent navigates the live web, extracts
|
|
6
|
+
data conforming to your schema, and the result is delivered to a
|
|
7
|
+
preconfigured HMAC-signed webhook.
|
|
8
|
+
|
|
9
|
+
Generated from the production OpenAPI spec, so every endpoint is reachable
|
|
10
|
+
and fully typed.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install @productcraft/trawl
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or use the umbrella package to get every ProductCraft surface from one
|
|
19
|
+
import: `npm install productcraft`.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { Trawl } from "@productcraft/trawl";
|
|
25
|
+
|
|
26
|
+
const trawl = new Trawl({ auth: { type: "apiKey", key: process.env.PCFT_KEY! } });
|
|
27
|
+
|
|
28
|
+
// Submit an extraction job (workspace-scoped).
|
|
29
|
+
const { data, error } = await trawl.client.POST(
|
|
30
|
+
"/v1/workspaces/{workspaceId}/jobs",
|
|
31
|
+
{
|
|
32
|
+
params: { path: { workspaceId: "ws_..." } },
|
|
33
|
+
body: {
|
|
34
|
+
description: "Extract the product title and price from each page.",
|
|
35
|
+
json_schema: {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: { title: { type: "string" }, price: { type: "number" } },
|
|
38
|
+
required: ["title"],
|
|
39
|
+
},
|
|
40
|
+
suggested_urls: ["https://example.com/product"],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
if (error) throw error;
|
|
46
|
+
console.log(data.id, data.status); // → "job_...", "queued"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Poll `GET /v1/workspaces/{workspaceId}/jobs/{id}` for the result, or
|
|
50
|
+
register a webhook (`POST /v1/workspaces/{workspaceId}/webhooks`) to have
|
|
51
|
+
the terminal result delivered to you. Job submission is rate-limited per
|
|
52
|
+
workspace (default 10/min); a `429` carries a `Retry-After` header.
|
|
53
|
+
|
|
54
|
+
## Auth
|
|
55
|
+
|
|
56
|
+
Pass a workspace API key (`pcft_live_*`) as `{ type: "apiKey", key }`. The
|
|
57
|
+
client sets `Authorization: Bearer <key>` on every request.
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@productcraft/core');
|
|
4
|
+
|
|
5
|
+
// src/index.ts
|
|
6
|
+
var Trawl = class {
|
|
7
|
+
/** The underlying typed client. v0 surface — every endpoint reachable. */
|
|
8
|
+
client;
|
|
9
|
+
constructor(config = {}) {
|
|
10
|
+
this.client = core.makeClient(core.PC_BASE_URL.trawl, config);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.Trawl = Trawl;
|
|
15
|
+
//# sourceMappingURL=index.cjs.map
|
|
16
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["makeClient","PC_BASE_URL"],"mappings":";;;;;AASO,IAAM,QAAN,MAAY;AAAA;AAAA,EAED,MAAA;AAAA,EAEhB,WAAA,CAAY,MAAA,GAAyB,EAAC,EAAG;AACvC,IAAA,IAAA,CAAK,MAAA,GAASA,eAAA,CAAkBC,gBAAA,CAAY,KAAA,EAAO,MAAM,CAAA;AAAA,EAC3D;AACF","file":"index.cjs","sourcesContent":["import type { paths } from \"./_generated.js\";\nimport { makeClient, PC_BASE_URL, type PCClientConfig } from \"@productcraft/core\";\n\n/**\n * Trawl — typed `openapi-fetch` client for every endpoint in\n * `Specs/trawl.json`. Reach for `client.GET(\"/v1/...\")` or\n * `client.POST(...)`; request / response types come from the\n * generated `paths` interface.\n */\nexport class Trawl {\n /** The underlying typed client. v0 surface — every endpoint reachable. */\n public readonly client: ReturnType<typeof makeClient<paths>>;\n\n constructor(config: PCClientConfig = {}) {\n this.client = makeClient<paths>(PC_BASE_URL.trawl, config);\n }\n}\n\nexport type { paths } from \"./_generated.js\";\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
import { makeClient, PCClientConfig } from '@productcraft/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file was auto-generated by openapi-typescript.
|
|
5
|
+
* Do not make direct changes to the file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface paths {
|
|
9
|
+
"/v1/workspaces/{workspace_id}/jobs": {
|
|
10
|
+
parameters: {
|
|
11
|
+
query?: never;
|
|
12
|
+
header?: never;
|
|
13
|
+
path?: never;
|
|
14
|
+
cookie?: never;
|
|
15
|
+
};
|
|
16
|
+
/** List trawl jobs (paginated, newest first) */
|
|
17
|
+
get: operations["JobController_list"];
|
|
18
|
+
put?: never;
|
|
19
|
+
/** Create (enqueue) a trawl job */
|
|
20
|
+
post: operations["JobController_create"];
|
|
21
|
+
delete?: never;
|
|
22
|
+
options?: never;
|
|
23
|
+
head?: never;
|
|
24
|
+
patch?: never;
|
|
25
|
+
trace?: never;
|
|
26
|
+
};
|
|
27
|
+
"/v1/workspaces/{workspace_id}/jobs/{id}": {
|
|
28
|
+
parameters: {
|
|
29
|
+
query?: never;
|
|
30
|
+
header?: never;
|
|
31
|
+
path?: never;
|
|
32
|
+
cookie?: never;
|
|
33
|
+
};
|
|
34
|
+
/** Get a single trawl job */
|
|
35
|
+
get: operations["JobController_get"];
|
|
36
|
+
put?: never;
|
|
37
|
+
post?: never;
|
|
38
|
+
delete?: never;
|
|
39
|
+
options?: never;
|
|
40
|
+
head?: never;
|
|
41
|
+
patch?: never;
|
|
42
|
+
trace?: never;
|
|
43
|
+
};
|
|
44
|
+
"/v1/workspaces/{workspace_id}/jobs/{id}/cancel": {
|
|
45
|
+
parameters: {
|
|
46
|
+
query?: never;
|
|
47
|
+
header?: never;
|
|
48
|
+
path?: never;
|
|
49
|
+
cookie?: never;
|
|
50
|
+
};
|
|
51
|
+
get?: never;
|
|
52
|
+
put?: never;
|
|
53
|
+
/** Cancel a queued or running trawl job */
|
|
54
|
+
post: operations["JobController_cancel"];
|
|
55
|
+
delete?: never;
|
|
56
|
+
options?: never;
|
|
57
|
+
head?: never;
|
|
58
|
+
patch?: never;
|
|
59
|
+
trace?: never;
|
|
60
|
+
};
|
|
61
|
+
"/v1/workspaces/{workspace_id}/webhooks": {
|
|
62
|
+
parameters: {
|
|
63
|
+
query?: never;
|
|
64
|
+
header?: never;
|
|
65
|
+
path?: never;
|
|
66
|
+
cookie?: never;
|
|
67
|
+
};
|
|
68
|
+
/** List webhooks for the workspace (secrets masked) */
|
|
69
|
+
get: operations["WebhookController_list"];
|
|
70
|
+
put?: never;
|
|
71
|
+
/** Create a workspace webhook. The response includes the signing secret in clear EXACTLY ONCE — copy it now. */
|
|
72
|
+
post: operations["WebhookController_create"];
|
|
73
|
+
delete?: never;
|
|
74
|
+
options?: never;
|
|
75
|
+
head?: never;
|
|
76
|
+
patch?: never;
|
|
77
|
+
trace?: never;
|
|
78
|
+
};
|
|
79
|
+
"/v1/workspaces/{workspace_id}/webhooks/{id}": {
|
|
80
|
+
parameters: {
|
|
81
|
+
query?: never;
|
|
82
|
+
header?: never;
|
|
83
|
+
path?: never;
|
|
84
|
+
cookie?: never;
|
|
85
|
+
};
|
|
86
|
+
/** Get a webhook (secret masked) */
|
|
87
|
+
get: operations["WebhookController_get"];
|
|
88
|
+
put?: never;
|
|
89
|
+
post?: never;
|
|
90
|
+
/** Delete a webhook */
|
|
91
|
+
delete: operations["WebhookController_remove"];
|
|
92
|
+
options?: never;
|
|
93
|
+
head?: never;
|
|
94
|
+
/** Update url / active flag (active=true clears auto-disable) */
|
|
95
|
+
patch: operations["WebhookController_update"];
|
|
96
|
+
trace?: never;
|
|
97
|
+
};
|
|
98
|
+
"/v1/workspaces/{workspace_id}/webhooks/{id}/deliveries": {
|
|
99
|
+
parameters: {
|
|
100
|
+
query?: never;
|
|
101
|
+
header?: never;
|
|
102
|
+
path?: never;
|
|
103
|
+
cookie?: never;
|
|
104
|
+
};
|
|
105
|
+
/** Recent delivery attempts for a webhook (default 50, max 200, newest first) */
|
|
106
|
+
get: operations["WebhookController_recentDeliveries"];
|
|
107
|
+
put?: never;
|
|
108
|
+
post?: never;
|
|
109
|
+
delete?: never;
|
|
110
|
+
options?: never;
|
|
111
|
+
head?: never;
|
|
112
|
+
patch?: never;
|
|
113
|
+
trace?: never;
|
|
114
|
+
};
|
|
115
|
+
"/v1/workspaces/{workspace_id}/webhooks/{id}/rotate-secret": {
|
|
116
|
+
parameters: {
|
|
117
|
+
query?: never;
|
|
118
|
+
header?: never;
|
|
119
|
+
path?: never;
|
|
120
|
+
cookie?: never;
|
|
121
|
+
};
|
|
122
|
+
get?: never;
|
|
123
|
+
put?: never;
|
|
124
|
+
/** Rotate the signing secret. Returns the new secret in clear EXACTLY ONCE. */
|
|
125
|
+
post: operations["WebhookController_rotateSecret"];
|
|
126
|
+
delete?: never;
|
|
127
|
+
options?: never;
|
|
128
|
+
head?: never;
|
|
129
|
+
patch?: never;
|
|
130
|
+
trace?: never;
|
|
131
|
+
};
|
|
132
|
+
"/v1/workspaces/{workspace_id}/webhooks/{id}/test": {
|
|
133
|
+
parameters: {
|
|
134
|
+
query?: never;
|
|
135
|
+
header?: never;
|
|
136
|
+
path?: never;
|
|
137
|
+
cookie?: never;
|
|
138
|
+
};
|
|
139
|
+
get?: never;
|
|
140
|
+
put?: never;
|
|
141
|
+
/** Fire a synthetic event to this webhook (asynchronous; check the destination logs) */
|
|
142
|
+
post: operations["WebhookController_fireTest"];
|
|
143
|
+
delete?: never;
|
|
144
|
+
options?: never;
|
|
145
|
+
head?: never;
|
|
146
|
+
patch?: never;
|
|
147
|
+
trace?: never;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
interface components {
|
|
151
|
+
schemas: {
|
|
152
|
+
CreateJobDto: {
|
|
153
|
+
/**
|
|
154
|
+
* @description Natural-language description of what to extract.
|
|
155
|
+
* @example Extract the product title and price from each page.
|
|
156
|
+
*/
|
|
157
|
+
description: string;
|
|
158
|
+
/**
|
|
159
|
+
* @description JSON Schema describing the shape of the extraction result. Must be a non-empty object with `type: "object"`.
|
|
160
|
+
* @example {
|
|
161
|
+
* "properties": {
|
|
162
|
+
* "title": {
|
|
163
|
+
* "type": "string"
|
|
164
|
+
* }
|
|
165
|
+
* },
|
|
166
|
+
* "required": [
|
|
167
|
+
* "title"
|
|
168
|
+
* ],
|
|
169
|
+
* "type": "object"
|
|
170
|
+
* }
|
|
171
|
+
*/
|
|
172
|
+
json_schema: Record<string, never>;
|
|
173
|
+
/** @description Maximum number of worker steps before the job stops. */
|
|
174
|
+
max_steps?: number;
|
|
175
|
+
/** @description Model tier the worker should use (e.g. `standard`, `pro`). */
|
|
176
|
+
model_tier?: string;
|
|
177
|
+
/** @description Seed URLs the worker should start from. */
|
|
178
|
+
suggested_urls?: string[];
|
|
179
|
+
/** @description Wall-clock timeout for the job, in seconds. */
|
|
180
|
+
timeout_s?: number;
|
|
181
|
+
/** @description Webhook id to notify when the job finishes. */
|
|
182
|
+
webhook_id?: string;
|
|
183
|
+
};
|
|
184
|
+
CreateWebhookDto: {
|
|
185
|
+
/** @description Disabled webhooks are never delivered to. */
|
|
186
|
+
active?: boolean;
|
|
187
|
+
/** @description Destination URL (https required in prod). */
|
|
188
|
+
url: string;
|
|
189
|
+
};
|
|
190
|
+
JobListPaginationDto: {
|
|
191
|
+
has_more: boolean;
|
|
192
|
+
next_cursor: string | null;
|
|
193
|
+
};
|
|
194
|
+
JobListResponseDto: {
|
|
195
|
+
data: components["schemas"]["JobResponseDto"][];
|
|
196
|
+
pagination: components["schemas"]["JobListPaginationDto"];
|
|
197
|
+
};
|
|
198
|
+
JobResponseDto: {
|
|
199
|
+
attempts: number;
|
|
200
|
+
completed_at: string | null;
|
|
201
|
+
created_at: string;
|
|
202
|
+
description: string;
|
|
203
|
+
enqueued_at: string;
|
|
204
|
+
error: string | null;
|
|
205
|
+
id: string;
|
|
206
|
+
json_schema: Record<string, never>;
|
|
207
|
+
max_steps: number;
|
|
208
|
+
model_tier: string;
|
|
209
|
+
result: Record<string, never> | null;
|
|
210
|
+
started_at: string | null;
|
|
211
|
+
/** @enum {string} */
|
|
212
|
+
status: "queued" | "running" | "succeeded" | "failed" | "cancelled";
|
|
213
|
+
suggested_urls: string[] | null;
|
|
214
|
+
timeout_s: number;
|
|
215
|
+
webhook_id: string | null;
|
|
216
|
+
workspace_id: string;
|
|
217
|
+
};
|
|
218
|
+
UpdateWebhookDto: {
|
|
219
|
+
/** @description Pause/resume the webhook. Setting active=true clears auto-disable. */
|
|
220
|
+
active?: boolean;
|
|
221
|
+
/** @description New destination URL. */
|
|
222
|
+
url?: string;
|
|
223
|
+
};
|
|
224
|
+
WebhookCreateResponseDto: {
|
|
225
|
+
active: boolean;
|
|
226
|
+
auto_disabled_at: string | null;
|
|
227
|
+
created_at: string;
|
|
228
|
+
failure_count: number;
|
|
229
|
+
first_failure_at: string | null;
|
|
230
|
+
id: string;
|
|
231
|
+
last_attempt_at: string | null;
|
|
232
|
+
last_status_code: number | null;
|
|
233
|
+
/** @description Plaintext signing secret returned EXACTLY ONCE on create + rotate. Persist immediately — it never appears on subsequent GETs. */
|
|
234
|
+
signing_secret: string;
|
|
235
|
+
url: string;
|
|
236
|
+
workspace_id: string;
|
|
237
|
+
};
|
|
238
|
+
WebhookListResponseDto: {
|
|
239
|
+
data: components["schemas"]["WebhookResponseDto"][];
|
|
240
|
+
};
|
|
241
|
+
WebhookResponseDto: {
|
|
242
|
+
active: boolean;
|
|
243
|
+
auto_disabled_at: string | null;
|
|
244
|
+
created_at: string;
|
|
245
|
+
failure_count: number;
|
|
246
|
+
first_failure_at: string | null;
|
|
247
|
+
id: string;
|
|
248
|
+
last_attempt_at: string | null;
|
|
249
|
+
last_status_code: number | null;
|
|
250
|
+
url: string;
|
|
251
|
+
workspace_id: string;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
responses: never;
|
|
255
|
+
parameters: never;
|
|
256
|
+
requestBodies: never;
|
|
257
|
+
headers: never;
|
|
258
|
+
pathItems: never;
|
|
259
|
+
}
|
|
260
|
+
interface operations {
|
|
261
|
+
JobController_list: {
|
|
262
|
+
parameters: {
|
|
263
|
+
query?: {
|
|
264
|
+
/** @description Filter by job status. */
|
|
265
|
+
status?: "queued" | "running" | "succeeded" | "failed" | "cancelled";
|
|
266
|
+
/** @description Opaque cursor for pagination. */
|
|
267
|
+
cursor?: string;
|
|
268
|
+
limit?: number;
|
|
269
|
+
};
|
|
270
|
+
header?: never;
|
|
271
|
+
path: {
|
|
272
|
+
workspace_id: string;
|
|
273
|
+
};
|
|
274
|
+
cookie?: never;
|
|
275
|
+
};
|
|
276
|
+
requestBody?: never;
|
|
277
|
+
responses: {
|
|
278
|
+
/** @description Page of jobs with pagination cursor. */
|
|
279
|
+
200: {
|
|
280
|
+
headers: {
|
|
281
|
+
[name: string]: unknown;
|
|
282
|
+
};
|
|
283
|
+
content: {
|
|
284
|
+
"application/json": components["schemas"]["JobListResponseDto"];
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
/** @description Caller lacks `trawl.list`, or workspace has not enabled the `trawl` service. */
|
|
288
|
+
403: {
|
|
289
|
+
headers: {
|
|
290
|
+
[name: string]: unknown;
|
|
291
|
+
};
|
|
292
|
+
content?: never;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
JobController_create: {
|
|
297
|
+
parameters: {
|
|
298
|
+
query?: never;
|
|
299
|
+
header?: {
|
|
300
|
+
/** @description Pass a key (1..256 chars, [A-Za-z0-9_\-:]) to make retries safe — replays return the original response for 24h. */
|
|
301
|
+
"Idempotency-Key"?: string;
|
|
302
|
+
};
|
|
303
|
+
path: {
|
|
304
|
+
workspace_id: string;
|
|
305
|
+
};
|
|
306
|
+
cookie?: never;
|
|
307
|
+
};
|
|
308
|
+
requestBody: {
|
|
309
|
+
content: {
|
|
310
|
+
"application/json": components["schemas"]["CreateJobDto"];
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
responses: {
|
|
314
|
+
/** @description Job created and queued. */
|
|
315
|
+
201: {
|
|
316
|
+
headers: {
|
|
317
|
+
[name: string]: unknown;
|
|
318
|
+
};
|
|
319
|
+
content: {
|
|
320
|
+
"application/json": components["schemas"]["JobResponseDto"];
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
/** @description Invalid JSON Schema (must be a non-empty `type: object`). */
|
|
324
|
+
400: {
|
|
325
|
+
headers: {
|
|
326
|
+
[name: string]: unknown;
|
|
327
|
+
};
|
|
328
|
+
content?: never;
|
|
329
|
+
};
|
|
330
|
+
/** @description Caller lacks `trawl.create`, or workspace has not enabled the `trawl` service. */
|
|
331
|
+
403: {
|
|
332
|
+
headers: {
|
|
333
|
+
[name: string]: unknown;
|
|
334
|
+
};
|
|
335
|
+
content?: never;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
JobController_get: {
|
|
340
|
+
parameters: {
|
|
341
|
+
query?: never;
|
|
342
|
+
header?: never;
|
|
343
|
+
path: {
|
|
344
|
+
workspace_id: string;
|
|
345
|
+
id: string;
|
|
346
|
+
};
|
|
347
|
+
cookie?: never;
|
|
348
|
+
};
|
|
349
|
+
requestBody?: never;
|
|
350
|
+
responses: {
|
|
351
|
+
/** @description Job row. */
|
|
352
|
+
200: {
|
|
353
|
+
headers: {
|
|
354
|
+
[name: string]: unknown;
|
|
355
|
+
};
|
|
356
|
+
content: {
|
|
357
|
+
"application/json": components["schemas"]["JobResponseDto"];
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
/** @description Job not found in this workspace. */
|
|
361
|
+
404: {
|
|
362
|
+
headers: {
|
|
363
|
+
[name: string]: unknown;
|
|
364
|
+
};
|
|
365
|
+
content?: never;
|
|
366
|
+
};
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
JobController_cancel: {
|
|
370
|
+
parameters: {
|
|
371
|
+
query?: never;
|
|
372
|
+
header?: never;
|
|
373
|
+
path: {
|
|
374
|
+
workspace_id: string;
|
|
375
|
+
id: string;
|
|
376
|
+
};
|
|
377
|
+
cookie?: never;
|
|
378
|
+
};
|
|
379
|
+
requestBody?: never;
|
|
380
|
+
responses: {
|
|
381
|
+
/** @description Job cancelled. */
|
|
382
|
+
200: {
|
|
383
|
+
headers: {
|
|
384
|
+
[name: string]: unknown;
|
|
385
|
+
};
|
|
386
|
+
content: {
|
|
387
|
+
"application/json": components["schemas"]["JobResponseDto"];
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
/** @description Job not found in this workspace. */
|
|
391
|
+
404: {
|
|
392
|
+
headers: {
|
|
393
|
+
[name: string]: unknown;
|
|
394
|
+
};
|
|
395
|
+
content?: never;
|
|
396
|
+
};
|
|
397
|
+
/** @description Job is already in a terminal state and cannot be cancelled. */
|
|
398
|
+
422: {
|
|
399
|
+
headers: {
|
|
400
|
+
[name: string]: unknown;
|
|
401
|
+
};
|
|
402
|
+
content?: never;
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
WebhookController_list: {
|
|
407
|
+
parameters: {
|
|
408
|
+
query?: never;
|
|
409
|
+
header?: never;
|
|
410
|
+
path: {
|
|
411
|
+
workspace_id: string;
|
|
412
|
+
};
|
|
413
|
+
cookie?: never;
|
|
414
|
+
};
|
|
415
|
+
requestBody?: never;
|
|
416
|
+
responses: {
|
|
417
|
+
200: {
|
|
418
|
+
headers: {
|
|
419
|
+
[name: string]: unknown;
|
|
420
|
+
};
|
|
421
|
+
content: {
|
|
422
|
+
"application/json": components["schemas"]["WebhookListResponseDto"];
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
WebhookController_create: {
|
|
428
|
+
parameters: {
|
|
429
|
+
query?: never;
|
|
430
|
+
header?: {
|
|
431
|
+
/** @description Stripe-style idempotency key. The signing secret is returned exactly once; a retry without this header creates a second webhook + secret. 24h TTL. */
|
|
432
|
+
"Idempotency-Key"?: string;
|
|
433
|
+
};
|
|
434
|
+
path: {
|
|
435
|
+
workspace_id: string;
|
|
436
|
+
};
|
|
437
|
+
cookie?: never;
|
|
438
|
+
};
|
|
439
|
+
requestBody: {
|
|
440
|
+
content: {
|
|
441
|
+
"application/json": components["schemas"]["CreateWebhookDto"];
|
|
442
|
+
};
|
|
443
|
+
};
|
|
444
|
+
responses: {
|
|
445
|
+
/** @description Webhook created. Includes plaintext `signing_secret` exactly once. */
|
|
446
|
+
201: {
|
|
447
|
+
headers: {
|
|
448
|
+
[name: string]: unknown;
|
|
449
|
+
};
|
|
450
|
+
content: {
|
|
451
|
+
"application/json": components["schemas"]["WebhookCreateResponseDto"];
|
|
452
|
+
};
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
WebhookController_get: {
|
|
457
|
+
parameters: {
|
|
458
|
+
query?: never;
|
|
459
|
+
header?: never;
|
|
460
|
+
path: {
|
|
461
|
+
workspace_id: string;
|
|
462
|
+
id: string;
|
|
463
|
+
};
|
|
464
|
+
cookie?: never;
|
|
465
|
+
};
|
|
466
|
+
requestBody?: never;
|
|
467
|
+
responses: {
|
|
468
|
+
200: {
|
|
469
|
+
headers: {
|
|
470
|
+
[name: string]: unknown;
|
|
471
|
+
};
|
|
472
|
+
content: {
|
|
473
|
+
"application/json": components["schemas"]["WebhookResponseDto"];
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
/** @description Webhook not found. */
|
|
477
|
+
404: {
|
|
478
|
+
headers: {
|
|
479
|
+
[name: string]: unknown;
|
|
480
|
+
};
|
|
481
|
+
content?: never;
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
WebhookController_remove: {
|
|
486
|
+
parameters: {
|
|
487
|
+
query?: never;
|
|
488
|
+
header?: never;
|
|
489
|
+
path: {
|
|
490
|
+
workspace_id: string;
|
|
491
|
+
id: string;
|
|
492
|
+
};
|
|
493
|
+
cookie?: never;
|
|
494
|
+
};
|
|
495
|
+
requestBody?: never;
|
|
496
|
+
responses: {
|
|
497
|
+
204: {
|
|
498
|
+
headers: {
|
|
499
|
+
[name: string]: unknown;
|
|
500
|
+
};
|
|
501
|
+
content?: never;
|
|
502
|
+
};
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
WebhookController_update: {
|
|
506
|
+
parameters: {
|
|
507
|
+
query?: never;
|
|
508
|
+
header?: never;
|
|
509
|
+
path: {
|
|
510
|
+
workspace_id: string;
|
|
511
|
+
id: string;
|
|
512
|
+
};
|
|
513
|
+
cookie?: never;
|
|
514
|
+
};
|
|
515
|
+
requestBody: {
|
|
516
|
+
content: {
|
|
517
|
+
"application/json": components["schemas"]["UpdateWebhookDto"];
|
|
518
|
+
};
|
|
519
|
+
};
|
|
520
|
+
responses: {
|
|
521
|
+
200: {
|
|
522
|
+
headers: {
|
|
523
|
+
[name: string]: unknown;
|
|
524
|
+
};
|
|
525
|
+
content: {
|
|
526
|
+
"application/json": components["schemas"]["WebhookResponseDto"];
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
};
|
|
530
|
+
};
|
|
531
|
+
WebhookController_recentDeliveries: {
|
|
532
|
+
parameters: {
|
|
533
|
+
query?: never;
|
|
534
|
+
header?: never;
|
|
535
|
+
path: {
|
|
536
|
+
workspace_id: string;
|
|
537
|
+
id: string;
|
|
538
|
+
};
|
|
539
|
+
cookie?: never;
|
|
540
|
+
};
|
|
541
|
+
requestBody?: never;
|
|
542
|
+
responses: {
|
|
543
|
+
/** @description Recent delivery attempts. */
|
|
544
|
+
200: {
|
|
545
|
+
headers: {
|
|
546
|
+
[name: string]: unknown;
|
|
547
|
+
};
|
|
548
|
+
content?: never;
|
|
549
|
+
};
|
|
550
|
+
};
|
|
551
|
+
};
|
|
552
|
+
WebhookController_rotateSecret: {
|
|
553
|
+
parameters: {
|
|
554
|
+
query?: never;
|
|
555
|
+
header?: never;
|
|
556
|
+
path: {
|
|
557
|
+
workspace_id: string;
|
|
558
|
+
id: string;
|
|
559
|
+
};
|
|
560
|
+
cookie?: never;
|
|
561
|
+
};
|
|
562
|
+
requestBody?: never;
|
|
563
|
+
responses: {
|
|
564
|
+
201: {
|
|
565
|
+
headers: {
|
|
566
|
+
[name: string]: unknown;
|
|
567
|
+
};
|
|
568
|
+
content?: never;
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
};
|
|
572
|
+
WebhookController_fireTest: {
|
|
573
|
+
parameters: {
|
|
574
|
+
query?: never;
|
|
575
|
+
header?: never;
|
|
576
|
+
path: {
|
|
577
|
+
workspace_id: string;
|
|
578
|
+
id: string;
|
|
579
|
+
};
|
|
580
|
+
cookie?: never;
|
|
581
|
+
};
|
|
582
|
+
requestBody?: never;
|
|
583
|
+
responses: {
|
|
584
|
+
202: {
|
|
585
|
+
headers: {
|
|
586
|
+
[name: string]: unknown;
|
|
587
|
+
};
|
|
588
|
+
content?: never;
|
|
589
|
+
};
|
|
590
|
+
};
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Trawl — typed `openapi-fetch` client for every endpoint in
|
|
596
|
+
* `Specs/trawl.json`. Reach for `client.GET("/v1/...")` or
|
|
597
|
+
* `client.POST(...)`; request / response types come from the
|
|
598
|
+
* generated `paths` interface.
|
|
599
|
+
*/
|
|
600
|
+
declare class Trawl {
|
|
601
|
+
/** The underlying typed client. v0 surface — every endpoint reachable. */
|
|
602
|
+
readonly client: ReturnType<typeof makeClient<paths>>;
|
|
603
|
+
constructor(config?: PCClientConfig);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
export { Trawl, type paths };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
import { makeClient, PCClientConfig } from '@productcraft/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file was auto-generated by openapi-typescript.
|
|
5
|
+
* Do not make direct changes to the file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface paths {
|
|
9
|
+
"/v1/workspaces/{workspace_id}/jobs": {
|
|
10
|
+
parameters: {
|
|
11
|
+
query?: never;
|
|
12
|
+
header?: never;
|
|
13
|
+
path?: never;
|
|
14
|
+
cookie?: never;
|
|
15
|
+
};
|
|
16
|
+
/** List trawl jobs (paginated, newest first) */
|
|
17
|
+
get: operations["JobController_list"];
|
|
18
|
+
put?: never;
|
|
19
|
+
/** Create (enqueue) a trawl job */
|
|
20
|
+
post: operations["JobController_create"];
|
|
21
|
+
delete?: never;
|
|
22
|
+
options?: never;
|
|
23
|
+
head?: never;
|
|
24
|
+
patch?: never;
|
|
25
|
+
trace?: never;
|
|
26
|
+
};
|
|
27
|
+
"/v1/workspaces/{workspace_id}/jobs/{id}": {
|
|
28
|
+
parameters: {
|
|
29
|
+
query?: never;
|
|
30
|
+
header?: never;
|
|
31
|
+
path?: never;
|
|
32
|
+
cookie?: never;
|
|
33
|
+
};
|
|
34
|
+
/** Get a single trawl job */
|
|
35
|
+
get: operations["JobController_get"];
|
|
36
|
+
put?: never;
|
|
37
|
+
post?: never;
|
|
38
|
+
delete?: never;
|
|
39
|
+
options?: never;
|
|
40
|
+
head?: never;
|
|
41
|
+
patch?: never;
|
|
42
|
+
trace?: never;
|
|
43
|
+
};
|
|
44
|
+
"/v1/workspaces/{workspace_id}/jobs/{id}/cancel": {
|
|
45
|
+
parameters: {
|
|
46
|
+
query?: never;
|
|
47
|
+
header?: never;
|
|
48
|
+
path?: never;
|
|
49
|
+
cookie?: never;
|
|
50
|
+
};
|
|
51
|
+
get?: never;
|
|
52
|
+
put?: never;
|
|
53
|
+
/** Cancel a queued or running trawl job */
|
|
54
|
+
post: operations["JobController_cancel"];
|
|
55
|
+
delete?: never;
|
|
56
|
+
options?: never;
|
|
57
|
+
head?: never;
|
|
58
|
+
patch?: never;
|
|
59
|
+
trace?: never;
|
|
60
|
+
};
|
|
61
|
+
"/v1/workspaces/{workspace_id}/webhooks": {
|
|
62
|
+
parameters: {
|
|
63
|
+
query?: never;
|
|
64
|
+
header?: never;
|
|
65
|
+
path?: never;
|
|
66
|
+
cookie?: never;
|
|
67
|
+
};
|
|
68
|
+
/** List webhooks for the workspace (secrets masked) */
|
|
69
|
+
get: operations["WebhookController_list"];
|
|
70
|
+
put?: never;
|
|
71
|
+
/** Create a workspace webhook. The response includes the signing secret in clear EXACTLY ONCE — copy it now. */
|
|
72
|
+
post: operations["WebhookController_create"];
|
|
73
|
+
delete?: never;
|
|
74
|
+
options?: never;
|
|
75
|
+
head?: never;
|
|
76
|
+
patch?: never;
|
|
77
|
+
trace?: never;
|
|
78
|
+
};
|
|
79
|
+
"/v1/workspaces/{workspace_id}/webhooks/{id}": {
|
|
80
|
+
parameters: {
|
|
81
|
+
query?: never;
|
|
82
|
+
header?: never;
|
|
83
|
+
path?: never;
|
|
84
|
+
cookie?: never;
|
|
85
|
+
};
|
|
86
|
+
/** Get a webhook (secret masked) */
|
|
87
|
+
get: operations["WebhookController_get"];
|
|
88
|
+
put?: never;
|
|
89
|
+
post?: never;
|
|
90
|
+
/** Delete a webhook */
|
|
91
|
+
delete: operations["WebhookController_remove"];
|
|
92
|
+
options?: never;
|
|
93
|
+
head?: never;
|
|
94
|
+
/** Update url / active flag (active=true clears auto-disable) */
|
|
95
|
+
patch: operations["WebhookController_update"];
|
|
96
|
+
trace?: never;
|
|
97
|
+
};
|
|
98
|
+
"/v1/workspaces/{workspace_id}/webhooks/{id}/deliveries": {
|
|
99
|
+
parameters: {
|
|
100
|
+
query?: never;
|
|
101
|
+
header?: never;
|
|
102
|
+
path?: never;
|
|
103
|
+
cookie?: never;
|
|
104
|
+
};
|
|
105
|
+
/** Recent delivery attempts for a webhook (default 50, max 200, newest first) */
|
|
106
|
+
get: operations["WebhookController_recentDeliveries"];
|
|
107
|
+
put?: never;
|
|
108
|
+
post?: never;
|
|
109
|
+
delete?: never;
|
|
110
|
+
options?: never;
|
|
111
|
+
head?: never;
|
|
112
|
+
patch?: never;
|
|
113
|
+
trace?: never;
|
|
114
|
+
};
|
|
115
|
+
"/v1/workspaces/{workspace_id}/webhooks/{id}/rotate-secret": {
|
|
116
|
+
parameters: {
|
|
117
|
+
query?: never;
|
|
118
|
+
header?: never;
|
|
119
|
+
path?: never;
|
|
120
|
+
cookie?: never;
|
|
121
|
+
};
|
|
122
|
+
get?: never;
|
|
123
|
+
put?: never;
|
|
124
|
+
/** Rotate the signing secret. Returns the new secret in clear EXACTLY ONCE. */
|
|
125
|
+
post: operations["WebhookController_rotateSecret"];
|
|
126
|
+
delete?: never;
|
|
127
|
+
options?: never;
|
|
128
|
+
head?: never;
|
|
129
|
+
patch?: never;
|
|
130
|
+
trace?: never;
|
|
131
|
+
};
|
|
132
|
+
"/v1/workspaces/{workspace_id}/webhooks/{id}/test": {
|
|
133
|
+
parameters: {
|
|
134
|
+
query?: never;
|
|
135
|
+
header?: never;
|
|
136
|
+
path?: never;
|
|
137
|
+
cookie?: never;
|
|
138
|
+
};
|
|
139
|
+
get?: never;
|
|
140
|
+
put?: never;
|
|
141
|
+
/** Fire a synthetic event to this webhook (asynchronous; check the destination logs) */
|
|
142
|
+
post: operations["WebhookController_fireTest"];
|
|
143
|
+
delete?: never;
|
|
144
|
+
options?: never;
|
|
145
|
+
head?: never;
|
|
146
|
+
patch?: never;
|
|
147
|
+
trace?: never;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
interface components {
|
|
151
|
+
schemas: {
|
|
152
|
+
CreateJobDto: {
|
|
153
|
+
/**
|
|
154
|
+
* @description Natural-language description of what to extract.
|
|
155
|
+
* @example Extract the product title and price from each page.
|
|
156
|
+
*/
|
|
157
|
+
description: string;
|
|
158
|
+
/**
|
|
159
|
+
* @description JSON Schema describing the shape of the extraction result. Must be a non-empty object with `type: "object"`.
|
|
160
|
+
* @example {
|
|
161
|
+
* "properties": {
|
|
162
|
+
* "title": {
|
|
163
|
+
* "type": "string"
|
|
164
|
+
* }
|
|
165
|
+
* },
|
|
166
|
+
* "required": [
|
|
167
|
+
* "title"
|
|
168
|
+
* ],
|
|
169
|
+
* "type": "object"
|
|
170
|
+
* }
|
|
171
|
+
*/
|
|
172
|
+
json_schema: Record<string, never>;
|
|
173
|
+
/** @description Maximum number of worker steps before the job stops. */
|
|
174
|
+
max_steps?: number;
|
|
175
|
+
/** @description Model tier the worker should use (e.g. `standard`, `pro`). */
|
|
176
|
+
model_tier?: string;
|
|
177
|
+
/** @description Seed URLs the worker should start from. */
|
|
178
|
+
suggested_urls?: string[];
|
|
179
|
+
/** @description Wall-clock timeout for the job, in seconds. */
|
|
180
|
+
timeout_s?: number;
|
|
181
|
+
/** @description Webhook id to notify when the job finishes. */
|
|
182
|
+
webhook_id?: string;
|
|
183
|
+
};
|
|
184
|
+
CreateWebhookDto: {
|
|
185
|
+
/** @description Disabled webhooks are never delivered to. */
|
|
186
|
+
active?: boolean;
|
|
187
|
+
/** @description Destination URL (https required in prod). */
|
|
188
|
+
url: string;
|
|
189
|
+
};
|
|
190
|
+
JobListPaginationDto: {
|
|
191
|
+
has_more: boolean;
|
|
192
|
+
next_cursor: string | null;
|
|
193
|
+
};
|
|
194
|
+
JobListResponseDto: {
|
|
195
|
+
data: components["schemas"]["JobResponseDto"][];
|
|
196
|
+
pagination: components["schemas"]["JobListPaginationDto"];
|
|
197
|
+
};
|
|
198
|
+
JobResponseDto: {
|
|
199
|
+
attempts: number;
|
|
200
|
+
completed_at: string | null;
|
|
201
|
+
created_at: string;
|
|
202
|
+
description: string;
|
|
203
|
+
enqueued_at: string;
|
|
204
|
+
error: string | null;
|
|
205
|
+
id: string;
|
|
206
|
+
json_schema: Record<string, never>;
|
|
207
|
+
max_steps: number;
|
|
208
|
+
model_tier: string;
|
|
209
|
+
result: Record<string, never> | null;
|
|
210
|
+
started_at: string | null;
|
|
211
|
+
/** @enum {string} */
|
|
212
|
+
status: "queued" | "running" | "succeeded" | "failed" | "cancelled";
|
|
213
|
+
suggested_urls: string[] | null;
|
|
214
|
+
timeout_s: number;
|
|
215
|
+
webhook_id: string | null;
|
|
216
|
+
workspace_id: string;
|
|
217
|
+
};
|
|
218
|
+
UpdateWebhookDto: {
|
|
219
|
+
/** @description Pause/resume the webhook. Setting active=true clears auto-disable. */
|
|
220
|
+
active?: boolean;
|
|
221
|
+
/** @description New destination URL. */
|
|
222
|
+
url?: string;
|
|
223
|
+
};
|
|
224
|
+
WebhookCreateResponseDto: {
|
|
225
|
+
active: boolean;
|
|
226
|
+
auto_disabled_at: string | null;
|
|
227
|
+
created_at: string;
|
|
228
|
+
failure_count: number;
|
|
229
|
+
first_failure_at: string | null;
|
|
230
|
+
id: string;
|
|
231
|
+
last_attempt_at: string | null;
|
|
232
|
+
last_status_code: number | null;
|
|
233
|
+
/** @description Plaintext signing secret returned EXACTLY ONCE on create + rotate. Persist immediately — it never appears on subsequent GETs. */
|
|
234
|
+
signing_secret: string;
|
|
235
|
+
url: string;
|
|
236
|
+
workspace_id: string;
|
|
237
|
+
};
|
|
238
|
+
WebhookListResponseDto: {
|
|
239
|
+
data: components["schemas"]["WebhookResponseDto"][];
|
|
240
|
+
};
|
|
241
|
+
WebhookResponseDto: {
|
|
242
|
+
active: boolean;
|
|
243
|
+
auto_disabled_at: string | null;
|
|
244
|
+
created_at: string;
|
|
245
|
+
failure_count: number;
|
|
246
|
+
first_failure_at: string | null;
|
|
247
|
+
id: string;
|
|
248
|
+
last_attempt_at: string | null;
|
|
249
|
+
last_status_code: number | null;
|
|
250
|
+
url: string;
|
|
251
|
+
workspace_id: string;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
responses: never;
|
|
255
|
+
parameters: never;
|
|
256
|
+
requestBodies: never;
|
|
257
|
+
headers: never;
|
|
258
|
+
pathItems: never;
|
|
259
|
+
}
|
|
260
|
+
interface operations {
|
|
261
|
+
JobController_list: {
|
|
262
|
+
parameters: {
|
|
263
|
+
query?: {
|
|
264
|
+
/** @description Filter by job status. */
|
|
265
|
+
status?: "queued" | "running" | "succeeded" | "failed" | "cancelled";
|
|
266
|
+
/** @description Opaque cursor for pagination. */
|
|
267
|
+
cursor?: string;
|
|
268
|
+
limit?: number;
|
|
269
|
+
};
|
|
270
|
+
header?: never;
|
|
271
|
+
path: {
|
|
272
|
+
workspace_id: string;
|
|
273
|
+
};
|
|
274
|
+
cookie?: never;
|
|
275
|
+
};
|
|
276
|
+
requestBody?: never;
|
|
277
|
+
responses: {
|
|
278
|
+
/** @description Page of jobs with pagination cursor. */
|
|
279
|
+
200: {
|
|
280
|
+
headers: {
|
|
281
|
+
[name: string]: unknown;
|
|
282
|
+
};
|
|
283
|
+
content: {
|
|
284
|
+
"application/json": components["schemas"]["JobListResponseDto"];
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
/** @description Caller lacks `trawl.list`, or workspace has not enabled the `trawl` service. */
|
|
288
|
+
403: {
|
|
289
|
+
headers: {
|
|
290
|
+
[name: string]: unknown;
|
|
291
|
+
};
|
|
292
|
+
content?: never;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
JobController_create: {
|
|
297
|
+
parameters: {
|
|
298
|
+
query?: never;
|
|
299
|
+
header?: {
|
|
300
|
+
/** @description Pass a key (1..256 chars, [A-Za-z0-9_\-:]) to make retries safe — replays return the original response for 24h. */
|
|
301
|
+
"Idempotency-Key"?: string;
|
|
302
|
+
};
|
|
303
|
+
path: {
|
|
304
|
+
workspace_id: string;
|
|
305
|
+
};
|
|
306
|
+
cookie?: never;
|
|
307
|
+
};
|
|
308
|
+
requestBody: {
|
|
309
|
+
content: {
|
|
310
|
+
"application/json": components["schemas"]["CreateJobDto"];
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
responses: {
|
|
314
|
+
/** @description Job created and queued. */
|
|
315
|
+
201: {
|
|
316
|
+
headers: {
|
|
317
|
+
[name: string]: unknown;
|
|
318
|
+
};
|
|
319
|
+
content: {
|
|
320
|
+
"application/json": components["schemas"]["JobResponseDto"];
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
/** @description Invalid JSON Schema (must be a non-empty `type: object`). */
|
|
324
|
+
400: {
|
|
325
|
+
headers: {
|
|
326
|
+
[name: string]: unknown;
|
|
327
|
+
};
|
|
328
|
+
content?: never;
|
|
329
|
+
};
|
|
330
|
+
/** @description Caller lacks `trawl.create`, or workspace has not enabled the `trawl` service. */
|
|
331
|
+
403: {
|
|
332
|
+
headers: {
|
|
333
|
+
[name: string]: unknown;
|
|
334
|
+
};
|
|
335
|
+
content?: never;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
JobController_get: {
|
|
340
|
+
parameters: {
|
|
341
|
+
query?: never;
|
|
342
|
+
header?: never;
|
|
343
|
+
path: {
|
|
344
|
+
workspace_id: string;
|
|
345
|
+
id: string;
|
|
346
|
+
};
|
|
347
|
+
cookie?: never;
|
|
348
|
+
};
|
|
349
|
+
requestBody?: never;
|
|
350
|
+
responses: {
|
|
351
|
+
/** @description Job row. */
|
|
352
|
+
200: {
|
|
353
|
+
headers: {
|
|
354
|
+
[name: string]: unknown;
|
|
355
|
+
};
|
|
356
|
+
content: {
|
|
357
|
+
"application/json": components["schemas"]["JobResponseDto"];
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
/** @description Job not found in this workspace. */
|
|
361
|
+
404: {
|
|
362
|
+
headers: {
|
|
363
|
+
[name: string]: unknown;
|
|
364
|
+
};
|
|
365
|
+
content?: never;
|
|
366
|
+
};
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
JobController_cancel: {
|
|
370
|
+
parameters: {
|
|
371
|
+
query?: never;
|
|
372
|
+
header?: never;
|
|
373
|
+
path: {
|
|
374
|
+
workspace_id: string;
|
|
375
|
+
id: string;
|
|
376
|
+
};
|
|
377
|
+
cookie?: never;
|
|
378
|
+
};
|
|
379
|
+
requestBody?: never;
|
|
380
|
+
responses: {
|
|
381
|
+
/** @description Job cancelled. */
|
|
382
|
+
200: {
|
|
383
|
+
headers: {
|
|
384
|
+
[name: string]: unknown;
|
|
385
|
+
};
|
|
386
|
+
content: {
|
|
387
|
+
"application/json": components["schemas"]["JobResponseDto"];
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
/** @description Job not found in this workspace. */
|
|
391
|
+
404: {
|
|
392
|
+
headers: {
|
|
393
|
+
[name: string]: unknown;
|
|
394
|
+
};
|
|
395
|
+
content?: never;
|
|
396
|
+
};
|
|
397
|
+
/** @description Job is already in a terminal state and cannot be cancelled. */
|
|
398
|
+
422: {
|
|
399
|
+
headers: {
|
|
400
|
+
[name: string]: unknown;
|
|
401
|
+
};
|
|
402
|
+
content?: never;
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
WebhookController_list: {
|
|
407
|
+
parameters: {
|
|
408
|
+
query?: never;
|
|
409
|
+
header?: never;
|
|
410
|
+
path: {
|
|
411
|
+
workspace_id: string;
|
|
412
|
+
};
|
|
413
|
+
cookie?: never;
|
|
414
|
+
};
|
|
415
|
+
requestBody?: never;
|
|
416
|
+
responses: {
|
|
417
|
+
200: {
|
|
418
|
+
headers: {
|
|
419
|
+
[name: string]: unknown;
|
|
420
|
+
};
|
|
421
|
+
content: {
|
|
422
|
+
"application/json": components["schemas"]["WebhookListResponseDto"];
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
WebhookController_create: {
|
|
428
|
+
parameters: {
|
|
429
|
+
query?: never;
|
|
430
|
+
header?: {
|
|
431
|
+
/** @description Stripe-style idempotency key. The signing secret is returned exactly once; a retry without this header creates a second webhook + secret. 24h TTL. */
|
|
432
|
+
"Idempotency-Key"?: string;
|
|
433
|
+
};
|
|
434
|
+
path: {
|
|
435
|
+
workspace_id: string;
|
|
436
|
+
};
|
|
437
|
+
cookie?: never;
|
|
438
|
+
};
|
|
439
|
+
requestBody: {
|
|
440
|
+
content: {
|
|
441
|
+
"application/json": components["schemas"]["CreateWebhookDto"];
|
|
442
|
+
};
|
|
443
|
+
};
|
|
444
|
+
responses: {
|
|
445
|
+
/** @description Webhook created. Includes plaintext `signing_secret` exactly once. */
|
|
446
|
+
201: {
|
|
447
|
+
headers: {
|
|
448
|
+
[name: string]: unknown;
|
|
449
|
+
};
|
|
450
|
+
content: {
|
|
451
|
+
"application/json": components["schemas"]["WebhookCreateResponseDto"];
|
|
452
|
+
};
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
WebhookController_get: {
|
|
457
|
+
parameters: {
|
|
458
|
+
query?: never;
|
|
459
|
+
header?: never;
|
|
460
|
+
path: {
|
|
461
|
+
workspace_id: string;
|
|
462
|
+
id: string;
|
|
463
|
+
};
|
|
464
|
+
cookie?: never;
|
|
465
|
+
};
|
|
466
|
+
requestBody?: never;
|
|
467
|
+
responses: {
|
|
468
|
+
200: {
|
|
469
|
+
headers: {
|
|
470
|
+
[name: string]: unknown;
|
|
471
|
+
};
|
|
472
|
+
content: {
|
|
473
|
+
"application/json": components["schemas"]["WebhookResponseDto"];
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
/** @description Webhook not found. */
|
|
477
|
+
404: {
|
|
478
|
+
headers: {
|
|
479
|
+
[name: string]: unknown;
|
|
480
|
+
};
|
|
481
|
+
content?: never;
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
WebhookController_remove: {
|
|
486
|
+
parameters: {
|
|
487
|
+
query?: never;
|
|
488
|
+
header?: never;
|
|
489
|
+
path: {
|
|
490
|
+
workspace_id: string;
|
|
491
|
+
id: string;
|
|
492
|
+
};
|
|
493
|
+
cookie?: never;
|
|
494
|
+
};
|
|
495
|
+
requestBody?: never;
|
|
496
|
+
responses: {
|
|
497
|
+
204: {
|
|
498
|
+
headers: {
|
|
499
|
+
[name: string]: unknown;
|
|
500
|
+
};
|
|
501
|
+
content?: never;
|
|
502
|
+
};
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
WebhookController_update: {
|
|
506
|
+
parameters: {
|
|
507
|
+
query?: never;
|
|
508
|
+
header?: never;
|
|
509
|
+
path: {
|
|
510
|
+
workspace_id: string;
|
|
511
|
+
id: string;
|
|
512
|
+
};
|
|
513
|
+
cookie?: never;
|
|
514
|
+
};
|
|
515
|
+
requestBody: {
|
|
516
|
+
content: {
|
|
517
|
+
"application/json": components["schemas"]["UpdateWebhookDto"];
|
|
518
|
+
};
|
|
519
|
+
};
|
|
520
|
+
responses: {
|
|
521
|
+
200: {
|
|
522
|
+
headers: {
|
|
523
|
+
[name: string]: unknown;
|
|
524
|
+
};
|
|
525
|
+
content: {
|
|
526
|
+
"application/json": components["schemas"]["WebhookResponseDto"];
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
};
|
|
530
|
+
};
|
|
531
|
+
WebhookController_recentDeliveries: {
|
|
532
|
+
parameters: {
|
|
533
|
+
query?: never;
|
|
534
|
+
header?: never;
|
|
535
|
+
path: {
|
|
536
|
+
workspace_id: string;
|
|
537
|
+
id: string;
|
|
538
|
+
};
|
|
539
|
+
cookie?: never;
|
|
540
|
+
};
|
|
541
|
+
requestBody?: never;
|
|
542
|
+
responses: {
|
|
543
|
+
/** @description Recent delivery attempts. */
|
|
544
|
+
200: {
|
|
545
|
+
headers: {
|
|
546
|
+
[name: string]: unknown;
|
|
547
|
+
};
|
|
548
|
+
content?: never;
|
|
549
|
+
};
|
|
550
|
+
};
|
|
551
|
+
};
|
|
552
|
+
WebhookController_rotateSecret: {
|
|
553
|
+
parameters: {
|
|
554
|
+
query?: never;
|
|
555
|
+
header?: never;
|
|
556
|
+
path: {
|
|
557
|
+
workspace_id: string;
|
|
558
|
+
id: string;
|
|
559
|
+
};
|
|
560
|
+
cookie?: never;
|
|
561
|
+
};
|
|
562
|
+
requestBody?: never;
|
|
563
|
+
responses: {
|
|
564
|
+
201: {
|
|
565
|
+
headers: {
|
|
566
|
+
[name: string]: unknown;
|
|
567
|
+
};
|
|
568
|
+
content?: never;
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
};
|
|
572
|
+
WebhookController_fireTest: {
|
|
573
|
+
parameters: {
|
|
574
|
+
query?: never;
|
|
575
|
+
header?: never;
|
|
576
|
+
path: {
|
|
577
|
+
workspace_id: string;
|
|
578
|
+
id: string;
|
|
579
|
+
};
|
|
580
|
+
cookie?: never;
|
|
581
|
+
};
|
|
582
|
+
requestBody?: never;
|
|
583
|
+
responses: {
|
|
584
|
+
202: {
|
|
585
|
+
headers: {
|
|
586
|
+
[name: string]: unknown;
|
|
587
|
+
};
|
|
588
|
+
content?: never;
|
|
589
|
+
};
|
|
590
|
+
};
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Trawl — typed `openapi-fetch` client for every endpoint in
|
|
596
|
+
* `Specs/trawl.json`. Reach for `client.GET("/v1/...")` or
|
|
597
|
+
* `client.POST(...)`; request / response types come from the
|
|
598
|
+
* generated `paths` interface.
|
|
599
|
+
*/
|
|
600
|
+
declare class Trawl {
|
|
601
|
+
/** The underlying typed client. v0 surface — every endpoint reachable. */
|
|
602
|
+
readonly client: ReturnType<typeof makeClient<paths>>;
|
|
603
|
+
constructor(config?: PCClientConfig);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
export { Trawl, type paths };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { makeClient, PC_BASE_URL } from '@productcraft/core';
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
var Trawl = class {
|
|
5
|
+
/** The underlying typed client. v0 surface — every endpoint reachable. */
|
|
6
|
+
client;
|
|
7
|
+
constructor(config = {}) {
|
|
8
|
+
this.client = makeClient(PC_BASE_URL.trawl, config);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { Trawl };
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AASO,IAAM,QAAN,MAAY;AAAA;AAAA,EAED,MAAA;AAAA,EAEhB,WAAA,CAAY,MAAA,GAAyB,EAAC,EAAG;AACvC,IAAA,IAAA,CAAK,MAAA,GAAS,UAAA,CAAkB,WAAA,CAAY,KAAA,EAAO,MAAM,CAAA;AAAA,EAC3D;AACF","file":"index.js","sourcesContent":["import type { paths } from \"./_generated.js\";\nimport { makeClient, PC_BASE_URL, type PCClientConfig } from \"@productcraft/core\";\n\n/**\n * Trawl — typed `openapi-fetch` client for every endpoint in\n * `Specs/trawl.json`. Reach for `client.GET(\"/v1/...\")` or\n * `client.POST(...)`; request / response types come from the\n * generated `paths` interface.\n */\nexport class Trawl {\n /** The underlying typed client. v0 surface — every endpoint reachable. */\n public readonly client: ReturnType<typeof makeClient<paths>>;\n\n constructor(config: PCClientConfig = {}) {\n this.client = makeClient<paths>(PC_BASE_URL.trawl, config);\n }\n}\n\nexport type { paths } from \"./_generated.js\";\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@productcraft/trawl",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "AI web-extraction — submit a JSON Schema + natural-language description, get schema-conforming data extracted from the live web and delivered to an HMAC-signed webhook via ProductCraft Trawl. Generated from the production OpenAPI spec.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist/**",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=18"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"productcraft",
|
|
26
|
+
"sdk",
|
|
27
|
+
"trawl",
|
|
28
|
+
"web-extraction",
|
|
29
|
+
"scraping"
|
|
30
|
+
],
|
|
31
|
+
"author": "ProductCraft",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/clauderanelagh/productcraft-node.git",
|
|
36
|
+
"directory": "packages/trawl"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/clauderanelagh/productcraft-node/tree/main/packages/trawl",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public",
|
|
41
|
+
"provenance": true
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"openapi-fetch": "^0.13.0",
|
|
45
|
+
"@productcraft/core": "^0.2.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsup"
|
|
49
|
+
}
|
|
50
|
+
}
|