@productcraft/trawl 0.1.3 → 0.2.1

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/README.md CHANGED
@@ -23,7 +23,8 @@ import: `npm install productcraft`.
23
23
  ```ts
24
24
  import { Trawl } from "@productcraft/trawl";
25
25
 
26
- const trawl = new Trawl({ auth: { type: "apiKey", key: process.env.PCFT_KEY! } });
26
+ // Reads PRODUCTCRAFT_API_KEY from the environment
27
+ const trawl = new Trawl();
27
28
 
28
29
  // Submit an extraction job (workspace-scoped).
29
30
  const { data, error } = await trawl.client.POST(
@@ -51,10 +52,23 @@ register a webhook (`POST /v1/workspaces/{workspaceId}/webhooks`) to have
51
52
  the terminal result delivered to you. Job submission is rate-limited per
52
53
  workspace (default 10/min); a `429` carries a `Retry-After` header.
53
54
 
55
+ ## Credentials from the environment
56
+
57
+ Server-side, omit `auth` and the client reads your workspace key from the environment:
58
+
59
+ ```bash
60
+ # .env
61
+ PRODUCTCRAFT_API_KEY=pcft_live_...
62
+ ```
63
+
64
+ - An explicit `auth` always wins over the environment.
65
+ - Hosts are never read from the environment. Override them in code with `baseUrl`.
66
+ - This is a server-only fallback. Never put a key in `NEXT_PUBLIC_*` or any other variable a bundler inlines into browser code.
67
+
54
68
  ## Auth
55
69
 
56
- Pass a workspace API key (`pcft_live_*`) as `{ type: "apiKey", key }`. The
57
- client sets `Authorization: Bearer <key>` on every request.
70
+ Pass a workspace API key (`pcft_live_*`) as `{ type: "apiKey", key }`, or omit
71
+ `auth` to use `PRODUCTCRAFT_API_KEY` (see above). The client sets `Authorization: Bearer <key>` on every request.
58
72
 
59
73
  ## License
60
74
 
package/dist/index.d.cts CHANGED
@@ -509,10 +509,16 @@ interface components {
509
509
  */
510
510
  message: string | string[];
511
511
  /**
512
- * @description HTTP status code echoed in the body. Spelled `statusCode` (camelCase) in every ProductCraft API.
512
+ * @deprecated
513
+ * @description Deprecated alias of `status_code`, same value. Kept so existing clients keep working; read `status_code`. Error responses carry `Deprecation: true` while it is sent.
513
514
  * @example 403
514
515
  */
515
- statusCode: number;
516
+ statusCode?: number;
517
+ /**
518
+ * @description HTTP status code echoed in the body (`status_code`). `statusCode` carries the same value as a deprecated alias.
519
+ * @example 403
520
+ */
521
+ status_code: number;
516
522
  };
517
523
  JobListPaginationDto: {
518
524
  has_more: boolean;
package/dist/index.d.ts CHANGED
@@ -509,10 +509,16 @@ interface components {
509
509
  */
510
510
  message: string | string[];
511
511
  /**
512
- * @description HTTP status code echoed in the body. Spelled `statusCode` (camelCase) in every ProductCraft API.
512
+ * @deprecated
513
+ * @description Deprecated alias of `status_code`, same value. Kept so existing clients keep working; read `status_code`. Error responses carry `Deprecation: true` while it is sent.
513
514
  * @example 403
514
515
  */
515
- statusCode: number;
516
+ statusCode?: number;
517
+ /**
518
+ * @description HTTP status code echoed in the body (`status_code`). `statusCode` carries the same value as a deprecated alias.
519
+ * @example 403
520
+ */
521
+ status_code: number;
516
522
  };
517
523
  JobListPaginationDto: {
518
524
  has_more: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@productcraft/trawl",
3
- "version": "0.1.3",
3
+ "version": "0.2.1",
4
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
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "openapi-fetch": "^0.13.0",
48
- "@productcraft/core": "^0.2.1"
48
+ "@productcraft/core": "^0.3.0"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsup"