@settlemint/dalp-sdk 3.1.11-main.33694353394 → 3.1.11-main.33695505848
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 +1 -1
- package/dist/{chunk-w84xtxaz.js → chunk-dsf5k3zm.js} +1 -1
- package/dist/effect.d.ts +22 -5
- package/dist/effect.js +3 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/auth.js
CHANGED
|
@@ -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.
|
|
105
|
+
version: "3.1.11-main.33695505848",
|
|
106
106
|
private: false,
|
|
107
107
|
description: "Fully typed SDK for the DALP tokenization platform API",
|
|
108
108
|
homepage: "https://settlemint.com",
|
package/dist/effect.d.ts
CHANGED
|
@@ -35,15 +35,32 @@ export declare class DalpRequestError extends Error {
|
|
|
35
35
|
constructor(routeId: string, cause: unknown);
|
|
36
36
|
}
|
|
37
37
|
/** The Effect-shaped mirror of `DalpApi`. */
|
|
38
|
-
export type DalpEffectApi =
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
export type DalpEffectApi = DalpEffectApiNode<DalpApi>;
|
|
39
|
+
/**
|
|
40
|
+
* A stream leaf answers with its frame sequence rather than one body, so it is
|
|
41
|
+
* matched before the promise leaf: its call signature returns an `AsyncIterable`
|
|
42
|
+
* and would otherwise fall through to the recursive branch, which maps a call
|
|
43
|
+
* signature to an object with no keys and leaves the route uncallable.
|
|
44
|
+
*/
|
|
41
45
|
type DalpEffectApiNode<T> = {
|
|
42
|
-
readonly [K in keyof T]: T[K] extends (
|
|
46
|
+
readonly [K in keyof T]: T[K] extends (...args: infer Args) => AsyncIterable<infer Frame> ? (...args: Args) => Effect.Effect<AsyncIterable<Frame>, DalpRequestError> : T[K] extends (...args: infer Args) => Promise<infer A> ? (...args: Args) => Effect.Effect<A, DalpRequestError> : DalpEffectApiNode<T[K]>;
|
|
43
47
|
};
|
|
48
|
+
/** The routes that answer with `text/event-stream`, named by the route table. */
|
|
49
|
+
export type DalpStreamingRouteId = {
|
|
50
|
+
[Id in DalpRouteId]: DalpRouteTypes[Id]["streaming"] extends true ? Id : never;
|
|
51
|
+
}[DalpRouteId];
|
|
44
52
|
export interface DalpEffectClient {
|
|
45
53
|
readonly api: DalpEffectApi;
|
|
46
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Two signatures rather than one conditional return type. A caller generic over
|
|
56
|
+
* the streaming routes has to resolve the frame sequence from its own
|
|
57
|
+
* constraint, and a conditional keyed on `Id` stays unresolved until `Id` is a
|
|
58
|
+
* single route, which is what pushed every such caller into an assertion.
|
|
59
|
+
*/
|
|
60
|
+
readonly execute: {
|
|
61
|
+
<Id extends DalpStreamingRouteId>(routeId: Id, input?: DalpRouteTypes[Id]["request"], options?: CallOptions): Effect.Effect<AsyncIterable<DalpRouteTypes[Id]["response"]>, DalpRequestError>;
|
|
62
|
+
<Id extends DalpRouteId>(routeId: Id, input?: DalpRouteTypes[Id]["request"], options?: CallOptions): Effect.Effect<DalpRouteTypes[Id]["response"], DalpRequestError>;
|
|
63
|
+
};
|
|
47
64
|
}
|
|
48
65
|
/** Create the Effect client. Same routes, same transport, different channel. */
|
|
49
66
|
export declare function createDalpEffectClient(options: CreateDalpClientOptions): DalpEffectClient;
|
package/dist/effect.js
CHANGED
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
DalpApiError,
|
|
7
7
|
createTransport,
|
|
8
8
|
queryKeyFor,
|
|
9
|
-
sendRequest
|
|
9
|
+
sendRequest,
|
|
10
|
+
streamRequest
|
|
10
11
|
} from "./chunk-mrfkqrht.js";
|
|
11
12
|
import {
|
|
12
13
|
data
|
|
@@ -39,7 +40,7 @@ function runRoute(transport, route, id, input, options) {
|
|
|
39
40
|
const signal = options?.signal ?? controller.signal;
|
|
40
41
|
const run = async () => {
|
|
41
42
|
try {
|
|
42
|
-
resume(Effect.succeed(await sendRequest(transport, route, input, { ...options, signal })));
|
|
43
|
+
resume(Effect.succeed(route.serializer === "sse" ? streamRequest(transport, route, input, { ...options, signal }) : await sendRequest(transport, route, input, { ...options, signal })));
|
|
43
44
|
} catch (error) {
|
|
44
45
|
resume(Effect.fail(new DalpRequestError(id, error)));
|
|
45
46
|
}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED