deepline 0.1.50 → 0.1.52

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/dist/cli/index.js CHANGED
@@ -218,9 +218,20 @@ function resolveConfig(options) {
218
218
  };
219
219
  }
220
220
 
221
+ // src/release.ts
222
+ var SDK_RELEASE = {
223
+ version: "0.1.52",
224
+ apiContract: "2026-05-stripe-promo-checkout",
225
+ supportPolicy: {
226
+ latest: "0.1.52",
227
+ minimumSupported: "0.1.40",
228
+ deprecatedBelow: "0.1.40"
229
+ }
230
+ };
231
+
221
232
  // src/version.ts
222
- var SDK_VERSION = "0.1.50";
223
- var SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
233
+ var SDK_VERSION = SDK_RELEASE.version;
234
+ var SDK_API_CONTRACT = SDK_RELEASE.apiContract;
224
235
 
225
236
  // ../shared_libs/play-runtime/coordinator-headers.ts
226
237
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
@@ -195,9 +195,20 @@ function resolveConfig(options) {
195
195
  };
196
196
  }
197
197
 
198
+ // src/release.ts
199
+ var SDK_RELEASE = {
200
+ version: "0.1.52",
201
+ apiContract: "2026-05-stripe-promo-checkout",
202
+ supportPolicy: {
203
+ latest: "0.1.52",
204
+ minimumSupported: "0.1.40",
205
+ deprecatedBelow: "0.1.40"
206
+ }
207
+ };
208
+
198
209
  // src/version.ts
199
- var SDK_VERSION = "0.1.50";
200
- var SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
210
+ var SDK_VERSION = SDK_RELEASE.version;
211
+ var SDK_API_CONTRACT = SDK_RELEASE.apiContract;
201
212
 
202
213
  // ../shared_libs/play-runtime/coordinator-headers.ts
203
214
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
package/dist/index.d.mts CHANGED
@@ -1541,8 +1541,8 @@ declare class DeeplineClient {
1541
1541
  }>;
1542
1542
  }
1543
1543
 
1544
- declare const SDK_VERSION = "0.1.50";
1545
- declare const SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
1544
+ declare const SDK_VERSION: string;
1545
+ declare const SDK_API_CONTRACT: string;
1546
1546
 
1547
1547
  /**
1548
1548
  * Base error class for all Deepline SDK errors.
package/dist/index.d.ts CHANGED
@@ -1541,8 +1541,8 @@ declare class DeeplineClient {
1541
1541
  }>;
1542
1542
  }
1543
1543
 
1544
- declare const SDK_VERSION = "0.1.50";
1545
- declare const SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
1544
+ declare const SDK_VERSION: string;
1545
+ declare const SDK_API_CONTRACT: string;
1546
1546
 
1547
1547
  /**
1548
1548
  * Base error class for all Deepline SDK errors.
package/dist/index.js CHANGED
@@ -214,9 +214,20 @@ function resolveConfig(options) {
214
214
  };
215
215
  }
216
216
 
217
+ // src/release.ts
218
+ var SDK_RELEASE = {
219
+ version: "0.1.52",
220
+ apiContract: "2026-05-stripe-promo-checkout",
221
+ supportPolicy: {
222
+ latest: "0.1.52",
223
+ minimumSupported: "0.1.40",
224
+ deprecatedBelow: "0.1.40"
225
+ }
226
+ };
227
+
217
228
  // src/version.ts
218
- var SDK_VERSION = "0.1.50";
219
- var SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
229
+ var SDK_VERSION = SDK_RELEASE.version;
230
+ var SDK_API_CONTRACT = SDK_RELEASE.apiContract;
220
231
 
221
232
  // ../shared_libs/play-runtime/coordinator-headers.ts
222
233
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
package/dist/index.mjs CHANGED
@@ -168,9 +168,20 @@ function resolveConfig(options) {
168
168
  };
169
169
  }
170
170
 
171
+ // src/release.ts
172
+ var SDK_RELEASE = {
173
+ version: "0.1.52",
174
+ apiContract: "2026-05-stripe-promo-checkout",
175
+ supportPolicy: {
176
+ latest: "0.1.52",
177
+ minimumSupported: "0.1.40",
178
+ deprecatedBelow: "0.1.40"
179
+ }
180
+ };
181
+
171
182
  // src/version.ts
172
- var SDK_VERSION = "0.1.50";
173
- var SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
183
+ var SDK_VERSION = SDK_RELEASE.version;
184
+ var SDK_API_CONTRACT = SDK_RELEASE.apiContract;
174
185
 
175
186
  // ../shared_libs/play-runtime/coordinator-headers.ts
176
187
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
@@ -2372,6 +2372,56 @@ function canonicalizeJson(value: unknown): string {
2372
2372
  return `{${keys.map((k) => `${JSON.stringify(k)}:${canonicalizeJson(obj[k])}`).join(',')}}`;
2373
2373
  }
2374
2374
 
2375
+ type WorkerFetchResponse = {
2376
+ ok: boolean;
2377
+ status: number;
2378
+ statusText: string;
2379
+ url: string;
2380
+ headers: Record<string, string>;
2381
+ bodyText: string;
2382
+ json: unknown | null;
2383
+ };
2384
+
2385
+ function normalizeFetchHeaders(
2386
+ headers: RequestInit['headers'],
2387
+ ): Record<string, string> {
2388
+ if (!headers) return {};
2389
+ if (headers instanceof Headers) {
2390
+ return Object.fromEntries(
2391
+ [...headers.entries()].map(([key, value]) => [key.toLowerCase(), value]),
2392
+ );
2393
+ }
2394
+ if (Array.isArray(headers)) {
2395
+ return Object.fromEntries(
2396
+ headers.map(([key, value]) => [key.toLowerCase(), value]),
2397
+ );
2398
+ }
2399
+ return Object.fromEntries(
2400
+ Object.entries(headers).map(([key, value]) => [
2401
+ key.toLowerCase(),
2402
+ String(value),
2403
+ ]),
2404
+ );
2405
+ }
2406
+
2407
+ function fetchBodyIdentity(body: RequestInit['body']): string | null {
2408
+ if (body === undefined || body === null) return null;
2409
+ if (typeof body === 'string') return body;
2410
+ if (body instanceof URLSearchParams) return body.toString();
2411
+ throw new Error(
2412
+ 'ctx.fetch(...) in the Workers backend only supports string or URLSearchParams request bodies for durable identity.',
2413
+ );
2414
+ }
2415
+
2416
+ function parseFetchJsonOrNull(bodyText: string): unknown | null {
2417
+ if (!bodyText.trim()) return null;
2418
+ try {
2419
+ return JSON.parse(bodyText) as unknown;
2420
+ } catch {
2421
+ return null;
2422
+ }
2423
+ }
2424
+
2375
2425
  // ---------------------------------------------------------------------------
2376
2426
  // Streaming CSV parser. Pipes a `ReadableStream<Uint8Array>` from R2 through
2377
2427
  // a TextDecoder + line buffer + RFC-4180-ish state machine, yielding chunks
@@ -4435,10 +4485,46 @@ function createMinimalWorkerCtx(
4435
4485
  }
4436
4486
  });
4437
4487
  },
4438
- fetch(): never {
4439
- throw new Error(
4440
- 'ctx.fetch is not implemented in the Workers backend yet.',
4441
- );
4488
+ async fetch(
4489
+ key: string,
4490
+ input: string | URL,
4491
+ init: RequestInit = {},
4492
+ options?: { staleAfterSeconds?: number },
4493
+ ): Promise<WorkerFetchResponse> {
4494
+ assertNotAborted(abortSignal);
4495
+ const normalizedKey = normalizeContextKey(key, 'fetch');
4496
+ const url = input.toString();
4497
+ const method = (init.method ?? 'GET').toUpperCase();
4498
+ const safeHeaders = normalizeFetchHeaders(init.headers);
4499
+ const body = fetchBodyIdentity(init.body);
4500
+ const hasIdempotencyKey =
4501
+ safeHeaders['idempotency-key'] !== undefined ||
4502
+ safeHeaders['x-idempotency-key'] !== undefined;
4503
+ if (method !== 'GET' && method !== 'HEAD' && !hasIdempotencyKey) {
4504
+ throw new Error(
4505
+ `ctx.fetch(${method} ${url}) needs an Idempotency-Key header. Durable plays can replay after waits/retries; add an idempotency key or wrap the side effect in a Deepline integration tool.`,
4506
+ );
4507
+ }
4508
+ const receiptKey = `fetch:${normalizedKey}:${await hashJson({
4509
+ body,
4510
+ method,
4511
+ safeHeaders,
4512
+ url,
4513
+ })}${staleRuntimeSuffix(options?.staleAfterSeconds)}`;
4514
+ return await executeWithRuntimeReceipt(receiptKey, async () => {
4515
+ const response = await fetch(url, init);
4516
+ assertNotAborted(abortSignal);
4517
+ const bodyText = await response.text();
4518
+ return {
4519
+ ok: response.ok,
4520
+ status: response.status,
4521
+ statusText: response.statusText,
4522
+ url: response.url,
4523
+ headers: Object.fromEntries(response.headers.entries()),
4524
+ bodyText,
4525
+ json: parseFetchJsonOrNull(bodyText),
4526
+ };
4527
+ });
4442
4528
  },
4443
4529
  async waitForEvent(
4444
4530
  eventType: string,
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Single source of truth for SDK release metadata.
3
+ *
4
+ * Edit THIS file to bump the SDK version, advance the support window, or rev
5
+ * the SDK/API contract identifier. Everything else derives from these values:
6
+ *
7
+ * - `sdk/src/version.ts` re-exports `SDK_VERSION` and `SDK_API_CONTRACT`.
8
+ * - `src/lib/sdk/release-policy.ts` re-exports `SDK_RELEASE_POLICY`.
9
+ * - `sdk/package.json` `version` is stamped from `SDK_RELEASE.version` by
10
+ * `scripts/sync-sdk-package-version.ts`, which runs as part of
11
+ * `bun run sdk:build`.
12
+ * - `contracts/sdk-api.manifest.json` is regenerated at build time from
13
+ * `src/lib/sdk/api-routes.ts` and the apiContract here; the hash in
14
+ * `contracts/sdk-api.manifest.hash` is the invariant that lands in git.
15
+ *
16
+ * Human editors should ONLY touch this file when releasing or changing
17
+ * compatibility policy. Every other location is derived and any drift is a
18
+ * `check:sdk-release-readiness` failure with a one-shot fix command.
19
+ */
20
+
21
+ export type SdkReleaseChannel = 'latest' | 'next' | 'beta';
22
+
23
+ export type SdkSupportPolicy = {
24
+ /** Newest published deepline SDK/CLI on npm. */
25
+ latest: string;
26
+ /**
27
+ * Anything strictly below this returns `status: "unsupported"` from
28
+ * `/api/v2/sdk/compat` and the CLI must hard-fail with the update command.
29
+ * Only advance after the support window closes.
30
+ */
31
+ minimumSupported: string;
32
+ /**
33
+ * Anything strictly below this returns `status: "deprecated"` (still works,
34
+ * warns). Advance when a release becomes the new floor.
35
+ */
36
+ deprecatedBelow: string;
37
+ };
38
+
39
+ export type SdkRelease = {
40
+ /** Version published to npm; the only place humans should bump it. */
41
+ version: string;
42
+ /**
43
+ * SDK/API contract identifier. Bump on incompatible protocol or schema
44
+ * changes between the installed SDK/CLI and the Deepline backend.
45
+ * See `docs/sdk-runtime-compatibility.md`.
46
+ */
47
+ apiContract: string;
48
+ /** Public support policy reported by `/api/v2/sdk/compat`. */
49
+ supportPolicy: SdkSupportPolicy;
50
+ };
51
+
52
+ export const SDK_RELEASE = {
53
+ version: '0.1.52',
54
+ apiContract: '2026-05-stripe-promo-checkout',
55
+ supportPolicy: {
56
+ latest: '0.1.52',
57
+ minimumSupported: '0.1.40',
58
+ deprecatedBelow: '0.1.40',
59
+ },
60
+ } as const satisfies SdkRelease;
@@ -1,2 +1,6 @@
1
- export const SDK_VERSION = "0.1.50";
2
- export const SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
1
+ // Derived from sdk/src/release.ts. Do not edit by hand.
2
+ // Bump the version in sdk/src/release.ts; this file follows.
3
+ import { SDK_RELEASE } from './release.js';
4
+
5
+ export const SDK_VERSION: string = SDK_RELEASE.version;
6
+ export const SDK_API_CONTRACT: string = SDK_RELEASE.apiContract;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,11 +38,12 @@
38
38
  "node": ">=18"
39
39
  },
40
40
  "scripts": {
41
- "build": "tsup",
42
- "dev": "tsup --watch",
41
+ "sync-version": "bun ../scripts/sync-sdk-package-version.ts",
42
+ "build": "bun ../scripts/sync-sdk-package-version.ts && tsup",
43
+ "dev": "bun ../scripts/sync-sdk-package-version.ts && tsup --watch",
43
44
  "typecheck": "tsc --noEmit --declaration false --declarationMap false",
44
- "prepack": "tsup",
45
- "prepublishOnly": "tsup"
45
+ "prepack": "bun ../scripts/sync-sdk-package-version.ts && tsup",
46
+ "prepublishOnly": "bun ../scripts/sync-sdk-package-version.ts && tsup"
46
47
  },
47
48
  "dependencies": {
48
49
  "@types/node": "^20.0.0",