@settlemint/dalp-sdk 3.1.11-main.33619587697 → 3.1.11-main.33620866191

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-xv87cs3r.js";
5
+ } from "./chunk-5b5hvt5k.js";
6
6
  import {
7
7
  normalizeDalpBaseUrl,
8
8
  secret,
package/dist/bundler.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createDalpClient
3
- } from "./chunk-6e14srpf.js";
3
+ } from "./chunk-5twx9k9k.js";
4
4
  import"./chunk-f4t1bm86.js";
5
- import"./chunk-armnnx1b.js";
6
- import"./chunk-n1t0v5gf.js";
5
+ import"./chunk-mrfkqrht.js";
6
+ import"./chunk-tejm2xza.js";
7
7
  import"./chunk-h12fatty.js";
8
8
  import"./chunk-y0d2c7kp.js";
9
9
 
@@ -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.33619587697",
105
+ version: "3.1.11-main.33620866191",
106
106
  private: false,
107
107
  description: "Fully typed SDK for the DALP tokenization platform API",
108
108
  homepage: "https://settlemint.com",
@@ -8,10 +8,10 @@ import {
8
8
  createTransport,
9
9
  sendRequest,
10
10
  streamRequest
11
- } from "./chunk-armnnx1b.js";
11
+ } from "./chunk-mrfkqrht.js";
12
12
  import {
13
13
  data
14
- } from "./chunk-n1t0v5gf.js";
14
+ } from "./chunk-tejm2xza.js";
15
15
 
16
16
  // src/proxy/client.ts
17
17
  function createDalpClient(options) {
@@ -508,7 +508,6 @@ function withConditionalRequests(base) {
508
508
  }
509
509
 
510
510
  // src/proxy/flat-args.ts
511
- var QUERY_ONLY_METHODS = new Set(["GET", "HEAD", "DELETE"]);
512
511
  function splitFlatArgs(route, input) {
513
512
  const source = input === null || input === undefined || typeof input !== "object" ? {} : input;
514
513
  const path = {};
@@ -525,10 +524,19 @@ function splitFlatArgs(route, input) {
525
524
  if (missing.length > 0) {
526
525
  throw new TypeError(`Missing path parameter${missing.length === 1 ? "" : "s"} ${missing.map((name) => `\`${name}\``).join(", ")} for ${route.method} ${route.path}`);
527
526
  }
528
- if (QUERY_ONLY_METHODS.has(route.method)) {
527
+ if (!route.hasPayload) {
529
528
  return { path, query: rest, body: undefined };
530
529
  }
531
- return { path, query: {}, body: Object.keys(rest).length === 0 ? undefined : rest };
530
+ if (input === null || input === undefined) {
531
+ return { path, query: {}, body: undefined };
532
+ }
533
+ for (const name of route.bodyParams) {
534
+ const value = path[name];
535
+ if (value !== undefined) {
536
+ rest[name] = value;
537
+ }
538
+ }
539
+ return { path, query: {}, body: rest };
532
540
  }
533
541
  function buildPath(route, path) {
534
542
  return route.path.replaceAll(/:([A-Za-z0-9_]+)/gu, (_match, name) => {
@@ -602,17 +610,8 @@ function createTransport(options) {
602
610
  settlementTimeoutMs: options.settlementTimeoutMs
603
611
  };
604
612
  }
605
- function prepareRequest(transport, route, input, options) {
606
- const split = splitFlatArgs(route, input);
607
- const query = serializeDalpQuery(split.query);
608
- const url = `${transport.baseUrl}/api/v2${buildPath(route, split.path)}${query === "" ? "" : `?${query}`}`;
613
+ function callHeaders(transport, options) {
609
614
  const headers = new Headers({ Accept: "application/json" });
610
- if (split.body !== undefined) {
611
- headers.set("Content-Type", "application/json");
612
- }
613
- if (route.queueBacked) {
614
- headers.set("Prefer", `wait=${String(DEFAULT_PREFER_WAIT_SECONDS)}`);
615
- }
616
615
  if (transport.apiKey !== undefined) {
617
616
  headers.set("X-Api-Key", unwrapSecret(transport.apiKey));
618
617
  }
@@ -625,13 +624,29 @@ function prepareRequest(transport, route, input, options) {
625
624
  for (const [name, value] of Object.entries(extra)) {
626
625
  headers.set(name, value);
627
626
  }
627
+ return headers;
628
+ }
629
+ function prepareRequest(transport, route, input, options) {
630
+ const split = splitFlatArgs(route, input);
631
+ const query = serializeDalpQuery(split.query);
632
+ const url = `${transport.baseUrl}/api/v2${buildPath(route, split.path)}${query === "" ? "" : `?${query}`}`;
633
+ const headers = callHeaders(transport, options);
634
+ if (split.body !== undefined) {
635
+ headers.set("Content-Type", "application/json");
636
+ }
637
+ if (route.queueBacked) {
638
+ headers.set("Prefer", `wait=${String(DEFAULT_PREFER_WAIT_SECONDS)}`);
639
+ }
628
640
  return {
629
641
  url,
630
642
  method: route.method,
631
643
  headers,
632
- body: split.body === undefined ? undefined : JSON.stringify(split.body)
644
+ body: split.body === undefined ? undefined : JSON.stringify(split.body, wireValue)
633
645
  };
634
646
  }
647
+ function wireValue(_key, value) {
648
+ return typeof value === "bigint" ? value.toString() : value;
649
+ }
635
650
  function readString(source, key) {
636
651
  if (source === null || typeof source !== "object") {
637
652
  return;
@@ -743,7 +758,7 @@ async function resolveSettlement(transport, payload, options, now = Date.now, sl
743
758
  await sleep(POLL_INTERVAL_MS);
744
759
  const response = await transport.fetch(statusUrl, {
745
760
  method: "GET",
746
- headers: transport.contextHeaders,
761
+ headers: callHeaders(transport, options),
747
762
  credentials: transport.credentials,
748
763
  ...options?.signal === undefined ? {} : { signal: options.signal }
749
764
  });