@giveitsmaller/sdk 0.22.0 → 0.25.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/dist/merge.js CHANGED
@@ -26,7 +26,7 @@
26
26
  * assets both fail fast so the caller saves bandwidth on typo'd composes.
27
27
  */
28
28
  import { uploadSource, jobOutputSource } from './types.js';
29
- import { GislConfigError, GislNetworkError, GislPerInputOptionsNotSupportedError, GislTimeoutError, GislUndeclaredAssetError, GislUnusedAssetError, SseEndedWithoutTerminal, } from './errors.js';
29
+ import { GislConfigError, GislNetworkError, GislPerInputOptionsNotSupportedError, GislTimeoutError, GislUndeclaredAssetError, GislUnusedAssetError, GislStreamHostNotDeclaredError, SseEndedWithoutTerminal, } from './errors.js';
30
30
  import { _cappedProbeTimeoutMs, _checkAborted, _consumeSseToTerminal, _detectCompressMedia, _parseMaxWait, _pollToTerminal, _projectResult, } from './builder.js';
31
31
  import { Handle } from './handle.js';
32
32
  /**
@@ -445,7 +445,17 @@ export class MergeBuilder {
445
445
  // TDqmkWpX: poll-fallback ONLY on a clean SSE stream-end or a typed
446
446
  // transport error; rethrow everything else (timeout, abort, API, an
447
447
  // onProgress callback throw, anything unexpected) so it isn't masked.
448
- if (!(err instanceof SseEndedWithoutTerminal || err instanceof GislNetworkError)) {
448
+ if (!(err instanceof SseEndedWithoutTerminal ||
449
+ err instanceof GislNetworkError ||
450
+ // VUozk5Bc: no stream host is DECLARED for this configuration (a
451
+ // configuration nothing declares; both named environments resolve as of
452
+ // contracts v2.195.0). That is not a failure to recover from,
453
+ // it is SSE being unavailable here, and polling is a working
454
+ // transport. Failing hard instead would strand every caller on a host
455
+ // nobody has declared yet. A DIRECT `streamEvents` caller still gets
456
+ // the hard error — they asked for the stream specifically; a `run()`
457
+ // caller asked for a result.
458
+ err instanceof GislStreamHostNotDeclaredError)) {
449
459
  throw err;
450
460
  }
451
461
  }
package/dist/sse.d.ts CHANGED
@@ -6,7 +6,29 @@ import type { GislSseEvent, GislSseParseFailure } from './types.js';
6
6
  * - Chunk boundary buffering (events split across chunks)
7
7
  * - Multi-line `data:` fields (concatenated with newlines)
8
8
  * - Comment lines (`:` prefix) used as keep-alives
9
- * - `retry:` field (ignored, SDK manages its own reconnection)
9
+ * - `id:` and `retry:` fields — IGNORED, and neither is surfaced on
10
+ * `GislSseEvent`
11
+ *
12
+ * 🔴 THIS SDK DOES NOT RECONNECT. It opens ONE stream and yields frames until
13
+ * the server ends it, the caller breaks, or the signal aborts. There is no
14
+ * retry loop, no backoff, and **no `Last-Event-ID` resumption** — so a dropped
15
+ * connection loses every event published while it was down, and the server
16
+ * cannot replay them.
17
+ *
18
+ * ⚠️ AN EARLIER VERSION OF THIS LINE READ "ignored, SDK manages its own
19
+ * reconnection", WHICH IS FALSE AND SAYS THE OPPOSITE OF THE TRUTH. A reader
20
+ * meeting it concluded retries were handled here. The poll-fallback in `run()`
21
+ * is a DIFFERENT TRANSPORT — it abandons the stream and polls
22
+ * `getWorkflowStatus` — not a reconnection, and it exists only on the
23
+ * ergonomic path. A direct `streamEvents` caller gets no recovery of any kind.
24
+ *
25
+ * ⇒ If you need to survive a drop, wrap this in your own loop AND reconcile
26
+ * the terminal state via `getWorkflowStatus` afterwards, because the gap is
27
+ * unrecoverable from the stream alone. See `docs/typescript/sse.md`.
28
+ *
29
+ * PHP and Python have carried this disclaimer since B2.2; TypeScript is the
30
+ * reference implementation both mirror and was the only one asserting the
31
+ * opposite (hub audit, 2026-08-29).
10
32
  *
11
33
  * `opts.signal` (optional): when it aborts, the underlying body reader is
12
34
  * cancelled. This is the ONLY way to promptly stop a stream parked on a
package/dist/sse.js CHANGED
@@ -5,7 +5,29 @@
5
5
  * - Chunk boundary buffering (events split across chunks)
6
6
  * - Multi-line `data:` fields (concatenated with newlines)
7
7
  * - Comment lines (`:` prefix) used as keep-alives
8
- * - `retry:` field (ignored, SDK manages its own reconnection)
8
+ * - `id:` and `retry:` fields — IGNORED, and neither is surfaced on
9
+ * `GislSseEvent`
10
+ *
11
+ * 🔴 THIS SDK DOES NOT RECONNECT. It opens ONE stream and yields frames until
12
+ * the server ends it, the caller breaks, or the signal aborts. There is no
13
+ * retry loop, no backoff, and **no `Last-Event-ID` resumption** — so a dropped
14
+ * connection loses every event published while it was down, and the server
15
+ * cannot replay them.
16
+ *
17
+ * ⚠️ AN EARLIER VERSION OF THIS LINE READ "ignored, SDK manages its own
18
+ * reconnection", WHICH IS FALSE AND SAYS THE OPPOSITE OF THE TRUTH. A reader
19
+ * meeting it concluded retries were handled here. The poll-fallback in `run()`
20
+ * is a DIFFERENT TRANSPORT — it abandons the stream and polls
21
+ * `getWorkflowStatus` — not a reconnection, and it exists only on the
22
+ * ergonomic path. A direct `streamEvents` caller gets no recovery of any kind.
23
+ *
24
+ * ⇒ If you need to survive a drop, wrap this in your own loop AND reconcile
25
+ * the terminal state via `getWorkflowStatus` afterwards, because the gap is
26
+ * unrecoverable from the stream alone. See `docs/typescript/sse.md`.
27
+ *
28
+ * PHP and Python have carried this disclaimer since B2.2; TypeScript is the
29
+ * reference implementation both mirror and was the only one asserting the
30
+ * opposite (hub audit, 2026-08-29).
9
31
  *
10
32
  * `opts.signal` (optional): when it aborts, the underlying body reader is
11
33
  * cancelled. This is the ONLY way to promptly stop a stream parked on a
@@ -172,7 +194,10 @@ export async function* parseSseStream(response, opts = {}) {
172
194
  dataLines.push(fieldValue);
173
195
  break;
174
196
  case 'retry':
175
- // Ignored — SDK manages its own polling/reconnection
197
+ // Ignored — and NOT because something else honours it. This SDK
198
+ // never reconnects, so a server-suggested retry interval has no
199
+ // consumer here. (Was "SDK manages its own polling/reconnection",
200
+ // which claimed a behaviour that does not exist.)
176
201
  break;
177
202
  }
178
203
  }
package/dist/types.d.ts CHANGED
@@ -2,6 +2,24 @@ import type { OperationType, OperationsSchemaResponse, OperationCapability, Outp
2
2
  import type { JobInputV2RoleEnum, NotifyConfig } from '@giveitsmaller/contracts/openapi';
3
3
  export interface GislClientConfig {
4
4
  baseUrl: string;
5
+ /**
6
+ * Host for the **SSE event stream** (`streamEvents`). The stream is served
7
+ * from a SECOND public entry point, separate from `baseUrl`: the API host
8
+ * fronts an integration with no response-streaming mode.
9
+ *
10
+ * Setting this moves the stream and **nothing else** — uploads,
11
+ * workflow-create and downloads keep using `baseUrl`. That is the reason it
12
+ * exists as its own field rather than being expressed by overriding
13
+ * `baseUrl`, which moves every call.
14
+ *
15
+ * When omitted, `gisl.create()` resolves it from the `environment` against
16
+ * the contract-declared stream hosts. It is **never derived from `baseUrl`**
17
+ * — if nothing declares a stream host for your configuration, `streamEvents`
18
+ * throws `GislStreamHostNotDeclaredError` rather than silently reusing the
19
+ * API host, and `run()` falls back to polling. See
20
+ * `ENVIRONMENT_STREAM_ENDPOINTS`.
21
+ */
22
+ streamBaseUrl?: string;
5
23
  apiKey?: string;
6
24
  headers?: Record<string, string>;
7
25
  timeout?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giveitsmaller/sdk",
3
- "version": "0.22.0",
3
+ "version": "0.25.0",
4
4
  "description": "Node.js SDK for the GISL (Give It Smaller) file compression and processing API",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "node": ">=18"
32
32
  },
33
33
  "dependencies": {
34
- "@giveitsmaller/contracts": "^0.65.0"
34
+ "@giveitsmaller/contracts": "^0.69.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^22",
@@ -47,5 +47,13 @@
47
47
  "test": "vitest run",
48
48
  "test:parity": "vitest run tests/parity",
49
49
  "parity:update": "UPDATE_PARITY_FIXTURES=1 vitest run tests/parity"
50
+ },
51
+ "homepage": "https://docs.giveitsmaller.com",
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git+https://github.com/giveitsmaller/typescript-sdk.git"
55
+ },
56
+ "bugs": {
57
+ "url": "https://github.com/giveitsmaller/typescript-sdk/issues"
50
58
  }
51
59
  }