@settlemint/dalp-sdk 3.1.11-main.33738278203 → 3.1.11-main.33739619708

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/auth.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  SDK_USER_AGENT,
3
3
  createCookieStoreFetch,
4
4
  makeCookieStore
5
- } from "./chunk-dtr3z6t9.js";
5
+ } from "./chunk-bsnrq4gn.js";
6
6
  import {
7
7
  normalizeDalpBaseUrl,
8
8
  secret,
package/dist/bundler.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createDalpClient
3
- } from "./chunk-vw4bccje.js";
3
+ } from "./chunk-n0b075da.js";
4
4
  import"./chunk-f4t1bm86.js";
5
- import"./chunk-gpezyfx3.js";
5
+ import"./chunk-def7rqy6.js";
6
6
  import"./chunk-fjnq61hj.js";
7
7
  import"./chunk-0m709wz4.js";
8
8
  import"./chunk-h12fatty.js";
@@ -102,7 +102,7 @@ function createCookieStoreFetch(cookieStore, fetchImpl = globalThis.fetch) {
102
102
  // package.json
103
103
  var package_default = {
104
104
  name: "@settlemint/dalp-sdk",
105
- version: "3.1.11-main.33738278203",
105
+ version: "3.1.11-main.33739619708",
106
106
  private: false,
107
107
  description: "Fully typed SDK for the DALP tokenization platform API",
108
108
  homepage: "https://settlemint.com",
@@ -786,6 +786,8 @@ async function resolveSettlement(transport, payload, options, now = Date.now, sl
786
786
  }
787
787
 
788
788
  // src/proxy/sse.ts
789
+ var RESERVED_STREAM_FAILURE_EVENT = "effect/httpapi/stream/failure";
790
+ var STREAM_FAILED_ERROR_CODE = "sdk.stream.FAILED";
789
791
  function parseFrame(raw) {
790
792
  try {
791
793
  return JSON.parse(raw.data);
@@ -793,6 +795,20 @@ function parseFrame(raw) {
793
795
  return raw.data;
794
796
  }
795
797
  }
798
+ function dispatchFrame(raw) {
799
+ if (raw.event === RESERVED_STREAM_FAILURE_EVENT) {
800
+ throw makeDalpApiError(new DalpSdkError({
801
+ code: STREAM_FAILED_ERROR_CODE,
802
+ category: "dependency",
803
+ retryable: true,
804
+ message: "The DALP API stream failed before it completed.",
805
+ why: "The route ended the stream with its reserved failure event, so the remaining frames were never sent.",
806
+ fix: "Retry the stream. If it fails again, read the route's logs for the failure the server recorded.",
807
+ details: { cause: raw.data }
808
+ }));
809
+ }
810
+ return parseFrame(raw);
811
+ }
796
812
  function readBlock(block) {
797
813
  let event = "message";
798
814
  const data = [];
@@ -834,7 +850,7 @@ async function* decodeEventStream(body) {
834
850
  const raw = readBlock(buffer.slice(0, boundary));
835
851
  buffer = buffer.slice(boundary + 2);
836
852
  if (raw !== undefined) {
837
- yield parseFrame(raw);
853
+ yield dispatchFrame(raw);
838
854
  }
839
855
  boundary = buffer.indexOf(`
840
856
 
@@ -843,7 +859,7 @@ async function* decodeEventStream(body) {
843
859
  }
844
860
  const trailing = readBlock(buffer);
845
861
  if (trailing !== undefined) {
846
- yield parseFrame(trailing);
862
+ yield dispatchFrame(trailing);
847
863
  }
848
864
  } finally {
849
865
  await reader.cancel().catch(() => {});
@@ -927,4 +943,4 @@ function createTanstackFactories(transport) {
927
943
  };
928
944
  }
929
945
 
930
- export { DalpApiError, isDalpApiError, findDalpSdkError, makeDalpApiError, createDalpContextHeaders, createTransport, DEFAULT_SETTLEMENT_TIMEOUT_MS, SettlementTimeoutError, SettlementFailedError, streamRequest, sendRequest, createFetchExecutor, canonicalize, queryKeyFor, UI_SETTLEMENT_TIMEOUT_MS, createTanstackFactories };
946
+ export { DalpApiError, isDalpApiError, findDalpSdkError, makeDalpApiError, createDalpContextHeaders, createTransport, DEFAULT_SETTLEMENT_TIMEOUT_MS, SettlementTimeoutError, SettlementFailedError, RESERVED_STREAM_FAILURE_EVENT, STREAM_FAILED_ERROR_CODE, decodeEventStream, streamRequest, sendRequest, createFetchExecutor, canonicalize, queryKeyFor, UI_SETTLEMENT_TIMEOUT_MS, createTanstackFactories };
@@ -8,7 +8,7 @@ import {
8
8
  createTransport,
9
9
  sendRequest,
10
10
  streamRequest
11
- } from "./chunk-gpezyfx3.js";
11
+ } from "./chunk-def7rqy6.js";
12
12
  import {
13
13
  data
14
14
  } from "./chunk-0m709wz4.js";
package/dist/effect.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  queryKeyFor,
9
9
  sendRequest,
10
10
  streamRequest
11
- } from "./chunk-gpezyfx3.js";
11
+ } from "./chunk-def7rqy6.js";
12
12
  import"./chunk-fjnq61hj.js";
13
13
  import {
14
14
  data
package/dist/index.d.ts CHANGED
@@ -27,6 +27,7 @@ export type { Webhook } from "./webhook-events.ts";
27
27
  export { DEFAULT_SETTLEMENT_TIMEOUT_MS, SettlementFailedError, SettlementTimeoutError } from "./proxy/settlement.ts";
28
28
  export type { SettlementHandle } from "./proxy/settlement.ts";
29
29
  export type { CallOptions } from "./proxy/builder.ts";
30
+ export { decodeEventStream, RESERVED_STREAM_FAILURE_EVENT, STREAM_FAILED_ERROR_CODE } from "./proxy/sse.ts";
30
31
  export { createDalpSdkConfigurationError, DalpSdkError } from "./errors/sdk-error.ts";
31
32
  export { DalpApiError, findDalpSdkError, isDalpApiError, makeDalpApiError } from "./errors/api-error.ts";
32
33
  export { SDK_USER_AGENT, SDK_VERSION } from "./version.ts";
package/dist/index.js CHANGED
@@ -3,21 +3,24 @@ import {
3
3
  SDK_VERSION,
4
4
  createCookieStoreFetch,
5
5
  makeCookieStore
6
- } from "./chunk-dtr3z6t9.js";
6
+ } from "./chunk-bsnrq4gn.js";
7
7
  import {
8
8
  createDalpClient
9
- } from "./chunk-vw4bccje.js";
9
+ } from "./chunk-n0b075da.js";
10
10
  import"./chunk-f4t1bm86.js";
11
11
  import {
12
12
  DEFAULT_SETTLEMENT_TIMEOUT_MS,
13
13
  DalpApiError,
14
+ RESERVED_STREAM_FAILURE_EVENT,
15
+ STREAM_FAILED_ERROR_CODE,
14
16
  SettlementFailedError,
15
17
  SettlementTimeoutError,
16
18
  createDalpContextHeaders,
19
+ decodeEventStream,
17
20
  findDalpSdkError,
18
21
  isDalpApiError,
19
22
  makeDalpApiError
20
- } from "./chunk-gpezyfx3.js";
23
+ } from "./chunk-def7rqy6.js";
21
24
  import"./chunk-fjnq61hj.js";
22
25
  import"./chunk-0m709wz4.js";
23
26
  import {
@@ -125,9 +128,11 @@ export {
125
128
  DEFAULT_SETTLEMENT_TIMEOUT_MS,
126
129
  DalpApiError,
127
130
  DalpSdkError,
131
+ RESERVED_STREAM_FAILURE_EVENT,
128
132
  SDK_USER_AGENT,
129
133
  SDK_VERSION,
130
134
  SECRET_REDACTION_MARKER,
135
+ STREAM_FAILED_ERROR_CODE,
131
136
  Secret,
132
137
  SettlementFailedError,
133
138
  SettlementTimeoutError,
@@ -138,6 +143,7 @@ export {
138
143
  createDalpClient,
139
144
  createDalpContextHeaders,
140
145
  createDalpSdkConfigurationError,
146
+ decodeEventStream,
141
147
  findDalpSdkError,
142
148
  isDalpApiError,
143
149
  makeCookieStore,
@@ -13,15 +13,37 @@
13
13
  * before its terminal frame is a fact the caller has to see, and a reconnect
14
14
  * hidden here would replace that fact with a silent gap in the sequence.
15
15
  *
16
+ * One event name is not a frame. When a route's stream fails, the server ends
17
+ * it with a block whose `event:` line is the reserved failure name, and whose
18
+ * `data:` line is a serialized description of the failure. The reader raises it
19
+ * as a `DalpApiError`, so a caller sees the failure rather than a frame that
20
+ * looks like a payload and is not one.
21
+ *
16
22
  * @module
17
23
  */
18
24
  import type { CallOptions } from "./builder.ts";
19
25
  import type { RouteRow } from "../routes/types.ts";
20
26
  import { type Transport } from "./transport.ts";
27
+ /**
28
+ * The event name the Effect HTTP API server writes when a route's stream fails.
29
+ *
30
+ * `HttpApiBuilder` owns the name and keeps it private, so the value is repeated
31
+ * here rather than imported. `tests/unit/effect-client.test.ts` pins it against
32
+ * the literal Effect publishes on its OpenAPI stream metadata.
33
+ */
34
+ export declare const RESERVED_STREAM_FAILURE_EVENT = "effect/httpapi/stream/failure";
35
+ /**
36
+ * The stable code raised when a route ends its stream with the reserved event.
37
+ *
38
+ * Consumers classify on this code, so it lives beside the throw rather than
39
+ * being copied into every reader of the error.
40
+ */
41
+ export declare const STREAM_FAILED_ERROR_CODE = "sdk.stream.FAILED";
21
42
  /**
22
43
  * Decode a byte stream into dispatched SSE events.
23
44
  *
24
45
  * @yields Each dispatched event, parsed as JSON when it is JSON.
46
+ * @throws A `DalpApiError` when the route ends the stream with its reserved failure event.
25
47
  */
26
48
  export declare function decodeEventStream(body: ReadableStream<Uint8Array>): AsyncGenerator<unknown>;
27
49
  /**
@@ -2,7 +2,7 @@ import {
2
2
  UI_SETTLEMENT_TIMEOUT_MS,
3
3
  canonicalize,
4
4
  queryKeyFor
5
- } from "./chunk-gpezyfx3.js";
5
+ } from "./chunk-def7rqy6.js";
6
6
  import"./chunk-fjnq61hj.js";
7
7
  import"./chunk-h12fatty.js";
8
8
  import"./chunk-y0d2c7kp.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@settlemint/dalp-sdk",
3
- "version": "3.1.11-main.33738278203",
3
+ "version": "3.1.11-main.33739619708",
4
4
  "private": false,
5
5
  "description": "Fully typed SDK for the DALP tokenization platform API",
6
6
  "homepage": "https://settlemint.com",