@settlemint/dalp-sdk 3.1.19-main.36191544314 → 3.1.19-main.36200923876

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.
@@ -1,4 +1,5 @@
1
1
  import type { DalpFetch } from "../client/ssr-fetch.ts";
2
+ import type { DalpAuthSurface } from "../auth-surface.ts";
2
3
  import type { AuthGetApiKeyListResponse, AuthGetOrganizationListResponse, AuthPostApiKeyCreateData, AuthPostApiKeyCreateResponse, AuthPostApiKeyDeleteData, AuthPostApiKeyDeleteResponse, AuthPostOrganizationCreateData, AuthPostOrganizationCreateResponse, AuthPostOrganizationRemoveMemberData, AuthPostOrganizationRemoveMemberResponse, AuthPostRevokeOtherSessionsResponse, AuthPostRevokeSessionData, AuthPostRevokeSessionResponse, AuthPostTwoFactorDisableData, AuthPostTwoFactorDisableResponse, AuthPostTwoFactorEnableData, AuthPostTwoFactorEnableResponse, AuthPostTwoFactorVerifyBackupCodeData, AuthPostTwoFactorVerifyBackupCodeResponse, AuthPostTwoFactorVerifyTotpData, AuthPostTwoFactorVerifyTotpResponse, CreateOrganizationInvitationData, CreateOrganizationInvitationResponse, GetSessionResponse, ListUserSessionsResponse, Member, SetActiveOrganizationData, SetActiveOrganizationResponse } from "../generated/api-types.d.ts";
3
4
  import { Secret } from "../secret.ts";
4
5
  import type { CookieStoreShape } from "../transport/cookie-store.ts";
@@ -8,6 +9,7 @@ export interface DalpAuthClientConfig {
8
9
  readonly cookie?: string;
9
10
  readonly cookieStore?: CookieStoreShape;
10
11
  readonly organizationId?: string;
12
+ readonly authSurface?: DalpAuthSurface;
11
13
  readonly headers?: Record<string, string>;
12
14
  readonly fetch?: DalpFetch;
13
15
  }
@@ -0,0 +1,2 @@
1
+ export type DalpAuthSurface = "console" | "portal";
2
+ export declare const DALP_AUTH_SURFACE_HEADER = "X-Dalp-Auth-Surface";
package/dist/auth.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { createDalpAuthClient, makeDalpAuthClient } from "./auth/live.ts";
2
2
  export type { DalpAuthClient } from "./auth/live.ts";
3
3
  export { decodeDalpAuthClientConfig } from "./auth/client.ts";
4
+ export type { DalpAuthSurface } from "./auth-surface.ts";
4
5
  export type { DalpAuthClientConfig, DalpCliAuthClient, DalpAuthError, DalpAuthOperation, DalpAuthResult, DalpOrganizationInvitation, DalpOrganizationInvitationsQuery, DalpOrganizationMember, DalpOrganizationMembersQuery, DecodedDalpAuthClientConfig, } from "./auth/client.ts";
5
6
  export type { WalletAuthEndpointPath } from "./auth/wallet-plugins.ts";
package/dist/auth.js CHANGED
@@ -2,15 +2,16 @@ import {
2
2
  createDalpSdkConfigurationError2
3
3
  } from "./chunk-k3ntysxx.js";
4
4
  import {
5
+ DALP_AUTH_SURFACE_HEADER2,
5
6
  secret2,
6
7
  unwrapSecret,
7
8
  normalizeDalpBaseUrl
8
- } from "./chunk-s7tb7t3w.js";
9
+ } from "./chunk-cr1tms72.js";
9
10
  import {
10
11
  makeCookieStore2,
11
12
  createCookieStoreFetch2,
12
13
  SDK_USER_AGENT2
13
- } from "./chunk-gek87gsf.js";
14
+ } from "./chunk-2dkdz0h4.js";
14
15
 
15
16
  // src/auth/live.ts
16
17
  import { apiKeyClient } from "@better-auth/api-key/client";
@@ -81,6 +82,12 @@ function optionalHeaders(value) {
81
82
  }
82
83
  return headers;
83
84
  }
85
+ function optionalAuthSurface(value) {
86
+ if (value === undefined || value === "console" || value === "portal") {
87
+ return value;
88
+ }
89
+ throw new AuthConfigError("authSurface", 'must be "console" or "portal"');
90
+ }
84
91
  function optionalFetch(value) {
85
92
  if (value === undefined) {
86
93
  return;
@@ -110,6 +117,7 @@ function decodeAuthConfig(input) {
110
117
  const url = requiredUrl(raw.url);
111
118
  const cookieStore = optionalCookieStore(raw.cookieStore);
112
119
  const organizationId = optionalText(raw.organizationId, "organizationId");
120
+ const authSurface = optionalAuthSurface(raw.authSurface);
113
121
  const headers = optionalHeaders(raw.headers);
114
122
  const configuredFetch = optionalFetch(raw.fetch);
115
123
  return {
@@ -118,6 +126,7 @@ function decodeAuthConfig(input) {
118
126
  ...cookie === undefined ? {} : { cookie: secret2(cookie) },
119
127
  ...cookieStore === undefined ? {} : { cookieStore },
120
128
  ...organizationId === undefined ? {} : { organizationId },
129
+ ...authSurface === undefined ? {} : { authSurface },
121
130
  ...headers === undefined ? {} : { headers },
122
131
  ...configuredFetch === undefined ? {} : { fetch: configuredFetch }
123
132
  };
@@ -287,6 +296,9 @@ function authHeaders(config) {
287
296
  if (config.organizationId !== undefined) {
288
297
  headers["x-organization-id"] = config.organizationId;
289
298
  }
299
+ if (config.authSurface !== undefined) {
300
+ headers[DALP_AUTH_SURFACE_HEADER2] = config.authSurface;
301
+ }
290
302
  return headers;
291
303
  }
292
304
  function createConfiguredBetterAuthClient(config, cookieStore) {
@@ -4,7 +4,7 @@ import {
4
4
  sendRequest,
5
5
  createFetchExecutor,
6
6
  createTanstackFactories
7
- } from "./chunk-q46kfa96.js";
7
+ } from "./chunk-r5jaxdh6.js";
8
8
  import {
9
9
  buildProxy,
10
10
  findRoute
@@ -102,7 +102,7 @@ function createCookieStoreFetch2(cookieStore, fetchImpl = globalThis.fetch) {
102
102
  // package.json
103
103
  var package_default = {
104
104
  name: "@settlemint/dalp-sdk",
105
- version: "3.1.19-main.36191544314",
105
+ version: "3.1.19-main.36200923876",
106
106
  private: false,
107
107
  description: "Fully typed SDK for the DALP tokenization platform API",
108
108
  homepage: "https://settlemint.com",
@@ -2,6 +2,9 @@ import {
2
2
  createDalpSdkConfigurationError2
3
3
  } from "./chunk-k3ntysxx.js";
4
4
 
5
+ // src/auth-surface.ts
6
+ var DALP_AUTH_SURFACE_HEADER2 = "X-Dalp-Auth-Surface";
7
+
5
8
  // src/secret.ts
6
9
  var SECRET_REDACTION_MARKER2 = "[REDACTED]";
7
10
  var inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
@@ -60,4 +63,4 @@ function normalizeDalpBaseUrl(url) {
60
63
  return `${parsed.origin}${parsed.pathname.replace(/\/+$/, "")}`;
61
64
  }
62
65
 
63
- export { SECRET_REDACTION_MARKER2, Secret2, secret2, unwrapSecret, normalizeDalpBaseUrl };
66
+ export { DALP_AUTH_SURFACE_HEADER2, SECRET_REDACTION_MARKER2, Secret2, secret2, unwrapSecret, normalizeDalpBaseUrl };
@@ -3,11 +3,12 @@ import {
3
3
  createDalpSdkConfigurationError2
4
4
  } from "./chunk-k3ntysxx.js";
5
5
  import {
6
+ DALP_AUTH_SURFACE_HEADER2,
6
7
  Secret2,
7
8
  secret2,
8
9
  unwrapSecret,
9
10
  normalizeDalpBaseUrl
10
- } from "./chunk-s7tb7t3w.js";
11
+ } from "./chunk-cr1tms72.js";
11
12
 
12
13
  // src/errors/find-current-error.ts
13
14
  var readProperty = (target, key) => Reflect.get(target, key);
@@ -711,13 +712,17 @@ function createTransport(options) {
711
712
  requestHeaders: options.ssr.requestHeaders
712
713
  });
713
714
  const conditional = withConditionalRequests(sessionFetch);
715
+ const contextHeaders = createDalpContextHeaders2(options.context ?? {});
716
+ if (options.authSurface !== undefined) {
717
+ contextHeaders.set(DALP_AUTH_SURFACE_HEADER2, options.authSurface);
718
+ }
714
719
  return {
715
720
  baseUrl,
716
721
  fetch: conditional.fetch,
717
722
  conditionalRequests: conditional.store,
718
723
  credentials: runtime === "browser" ? "include" : "omit",
719
724
  apiKey,
720
- contextHeaders: createDalpContextHeaders2(options.context ?? {}),
725
+ contextHeaders,
721
726
  settlementTimeoutMs: options.settlementTimeoutMs
722
727
  };
723
728
  }
package/dist/effect.js CHANGED
@@ -8,8 +8,8 @@ import {
8
8
  streamRequest,
9
9
  sendRequest,
10
10
  queryKeyFor2
11
- } from "./chunk-q46kfa96.js";
12
- import"./chunk-s7tb7t3w.js";
11
+ } from "./chunk-r5jaxdh6.js";
12
+ import"./chunk-cr1tms72.js";
13
13
  import {
14
14
  buildProxy,
15
15
  findRoute
package/dist/index.d.ts CHANGED
@@ -21,3 +21,5 @@ export type { DalpApiErrorCode, DalpSdkLocalErrorCode } from "./errors/error-cod
21
21
  export type { DalpErrorCode, DalpRouteErrorCode } from "./generated/api-types.d.ts";
22
22
  export type { TransactionWaitFailureReason } from "./wait-for-transaction.ts";
23
23
  export { SDK_USER_AGENT, SDK_VERSION } from "./version.ts";
24
+ export { DALP_AUTH_SURFACE_HEADER } from "./auth-surface.ts";
25
+ export type { DalpAuthSurface } from "./auth-surface.ts";
package/dist/index.js CHANGED
@@ -19,21 +19,22 @@ import {
19
19
  RESERVED_STREAM_FAILURE_EVENT2,
20
20
  STREAM_FAILED_ERROR_CODE2,
21
21
  decodeEventStream2
22
- } from "./chunk-q46kfa96.js";
22
+ } from "./chunk-r5jaxdh6.js";
23
23
  import {
24
+ DALP_AUTH_SURFACE_HEADER2,
24
25
  SECRET_REDACTION_MARKER2,
25
26
  Secret2,
26
27
  secret2
27
- } from "./chunk-s7tb7t3w.js";
28
+ } from "./chunk-cr1tms72.js";
28
29
  import {
29
30
  makeCookieStore2,
30
31
  createCookieStoreFetch2,
31
32
  SDK_VERSION2,
32
33
  SDK_USER_AGENT2
33
- } from "./chunk-gek87gsf.js";
34
+ } from "./chunk-2dkdz0h4.js";
34
35
  import {
35
36
  buildDalpClient
36
- } from "./chunk-dedgrr2e.js";
37
+ } from "./chunk-084zg9fe.js";
37
38
 
38
39
  // src/proxy/client.ts
39
40
  function createDalpClient(options) {
@@ -132,6 +133,7 @@ var Webhook;
132
133
  })(Webhook ||= {});
133
134
  var WEBHOOK_MANIFEST_VERSION = Webhook.MANIFEST_VERSION;
134
135
  export {
136
+ DALP_AUTH_SURFACE_HEADER2 as DALP_AUTH_SURFACE_HEADER,
135
137
  DalpApiError2 as DalpApiError,
136
138
  DalpSdkError2 as DalpSdkError,
137
139
  MALFORMED_SUCCESS_ERROR_CODE2 as MALFORMED_SUCCESS_ERROR_CODE,
@@ -1,3 +1,4 @@
1
+ import { type DalpAuthSurface } from "../auth-surface.ts";
1
2
  import { Secret } from "../secret.ts";
2
3
  import { type DalpFetch } from "../client/ssr-fetch.ts";
3
4
  import { type ConditionalRequestStore } from "../client/conditional-request.ts";
@@ -19,6 +20,7 @@ export interface DalpSsrOptions {
19
20
  export interface CreateDalpClientOptions {
20
21
  readonly baseUrl: string | URL;
21
22
  readonly apiKey?: string | Secret;
23
+ readonly authSurface?: DalpAuthSurface;
22
24
  readonly context?: DalpClientContext;
23
25
  readonly fetch?: DalpFetch;
24
26
  readonly runtime?: "browser" | "server";
@@ -3,8 +3,8 @@ import {
3
3
  canonicalize2,
4
4
  queryKeyFor2,
5
5
  UI_SETTLEMENT_TIMEOUT_MS2
6
- } from "./chunk-q46kfa96.js";
7
- import"./chunk-s7tb7t3w.js";
6
+ } from "./chunk-r5jaxdh6.js";
7
+ import"./chunk-cr1tms72.js";
8
8
  export {
9
9
  UI_SETTLEMENT_TIMEOUT_MS2 as UI_SETTLEMENT_TIMEOUT_MS,
10
10
  canonicalize2 as canonicalize,