@settlemint/dalp-sdk 3.1.26-main.37880349055 → 3.1.26-main.37889168299

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,6 +1,6 @@
1
1
  import type { DalpFetch } from "../client/ssr-fetch.ts";
2
2
  import type { DalpAuthSurface } from "../auth-surface.ts";
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
+ 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.ts";
4
4
  import { Secret } from "../secret.ts";
5
5
  import type { CookieStoreShape } from "../transport/cookie-store.ts";
6
6
  import type { DalpRuntime } from "../runtime.ts";
@@ -1,5 +1,8 @@
1
- import { type AuthenticationResponseJSON, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RegistrationResponseJSON } from "@better-auth/passkey/client";
1
+ import { passkeyClient, type AuthenticationResponseJSON, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RegistrationResponseJSON } from "@better-auth/passkey/client";
2
2
  export interface DalpPasskeyCeremony {
3
3
  readonly authenticate: (options: PublicKeyCredentialRequestOptionsJSON) => Promise<AuthenticationResponseJSON>;
4
4
  readonly register: (options: PublicKeyCredentialCreationOptionsJSON) => Promise<RegistrationResponseJSON>;
5
5
  }
6
+ type PasskeyClientPlugin = ReturnType<typeof passkeyClient>;
7
+ export declare function ceremonyPasskeyClient(ceremony: DalpPasskeyCeremony): PasskeyClientPlugin;
8
+ export {};
package/dist/auth.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  makeCookieStore2,
18
18
  createCookieStoreFetch2,
19
19
  SDK_USER_AGENT2
20
- } from "./chunk-9rbjydg2.js";
20
+ } from "./chunk-vmnykr0c.js";
21
21
  import {
22
22
  normalizeDalpBaseUrl
23
23
  } from "./chunk-h9e65x5z.js";
@@ -18,7 +18,8 @@ async function verifyWebhook2(input) {
18
18
  }
19
19
  let sawMalformedBody = false;
20
20
  let sawReplayStoreFailure = false;
21
- for (const candidate of Array.isArray(input.secret) ? input.secret : [input.secret]) {
21
+ const candidates = typeof input.secret === "string" ? [input.secret] : input.secret;
22
+ for (const candidate of candidates) {
22
23
  if (!matchesSignature(candidate, rawText, headers)) {
23
24
  continue;
24
25
  }
@@ -4,7 +4,7 @@ import {
4
4
  sendRequest,
5
5
  createFetchExecutor,
6
6
  createTanstackFactories
7
- } from "./chunk-1v2g817d.js";
7
+ } from "./chunk-vnbszer8.js";
8
8
  import {
9
9
  buildProxy,
10
10
  findRoute
@@ -26,7 +26,7 @@ function buildDalpClient(options, table) {
26
26
  conditionalRequests: transport.conditionalRequests,
27
27
  execute: async (routeId, input, callOptions) => {
28
28
  const route = routeFor(routeId);
29
- return route.serializer === "sse" ? streamRequest(transport, route, routeId, { flat: input }, callOptions) : await sendRequest(transport, route, routeId, { flat: input }, callOptions);
29
+ return route.serializer === "sse" ? streamRequest(transport, route, routeId, { flat: input }, callOptions) : sendRequest(transport, route, routeId, { flat: input }, callOptions);
30
30
  },
31
31
  sendParts: async (routeId, parts, callOptions) => sendRequest(transport, routeFor(routeId), routeId, { parts }, callOptions),
32
32
  streamParts: (routeId, parts, callOptions) => streamRequest(transport, routeFor(routeId), routeId, { parts }, callOptions)
@@ -54,9 +54,8 @@ function makeCookieStore2(initialHeader = "") {
54
54
  };
55
55
  }
56
56
  var getSetCookieHeaders = (headers) => {
57
- const { getSetCookie } = headers;
58
- if (getSetCookie !== undefined) {
59
- return getSetCookie.call(headers);
57
+ if ("getSetCookie" in headers && typeof headers.getSetCookie === "function") {
58
+ return headers.getSetCookie();
60
59
  }
61
60
  const value = headers.get("set-cookie");
62
61
  return value === null ? [] : splitCombinedSetCookie(value);
@@ -107,7 +106,7 @@ function createCookieStoreFetch2(cookieStore, fetchImpl = globalThis.fetch) {
107
106
  // package.json
108
107
  var package_default = {
109
108
  name: "@settlemint/dalp-sdk",
110
- version: "3.1.26-main.37880349055",
109
+ version: "3.1.26-main.37889168299",
111
110
  private: false,
112
111
  description: "Fully typed SDK for the DALP tokenization platform API",
113
112
  homepage: "https://settlemint.com",
@@ -132,71 +131,85 @@ var package_default = {
132
131
  exports: {
133
132
  "./package.json": "./package.json",
134
133
  "./server-proxy": {
134
+ "dalp-source": "./src/server-proxy.ts",
135
135
  types: "./dist/server-proxy.d.ts",
136
136
  import: "./dist/server-proxy.js",
137
137
  default: "./dist/server-proxy.js"
138
138
  },
139
139
  "./runtime-exports": {
140
+ "dalp-source": "./src/runtime-exports.ts",
140
141
  types: "./dist/runtime-exports.d.ts",
141
142
  import: "./dist/runtime-exports.js",
142
143
  default: "./dist/runtime-exports.js"
143
144
  },
144
145
  ".": {
146
+ "dalp-source": "./src/index.ts",
145
147
  types: "./dist/index.d.ts",
146
148
  import: "./dist/index.js",
147
149
  default: "./dist/index.js"
148
150
  },
149
151
  "./types": {
152
+ "dalp-source": "./src/types.ts",
150
153
  types: "./dist/types.d.ts",
151
154
  import: "./dist/types.js",
152
155
  default: "./dist/types.js"
153
156
  },
154
157
  "./scalars": {
158
+ "dalp-source": "./src/scalars/index.ts",
155
159
  types: "./dist/scalars/index.d.ts",
156
160
  import: "./dist/scalars/index.js",
157
161
  default: "./dist/scalars/index.js"
158
162
  },
159
163
  "./react-query": {
164
+ "dalp-source": "./src/react-query.ts",
160
165
  types: "./dist/react-query.d.ts",
161
166
  import: "./dist/react-query.js",
162
167
  default: "./dist/react-query.js"
163
168
  },
164
169
  "./auth": {
170
+ "dalp-source": "./src/auth.ts",
165
171
  types: "./dist/auth.d.ts",
166
172
  import: "./dist/auth.js",
167
173
  default: "./dist/auth.js"
168
174
  },
169
175
  "./verify-webhook": {
176
+ "dalp-source": "./src/verify-webhook.ts",
170
177
  types: "./dist/verify-webhook.d.ts",
171
178
  import: "./dist/verify-webhook.js",
172
179
  default: "./dist/verify-webhook.js"
173
180
  },
174
181
  "./wait-for-transaction": {
182
+ "dalp-source": "./src/wait-for-transaction.ts",
175
183
  types: "./dist/wait-for-transaction.d.ts",
176
184
  import: "./dist/wait-for-transaction.js",
177
185
  default: "./dist/wait-for-transaction.js"
178
186
  },
179
187
  "./sdk-error": {
188
+ "dalp-source": "./src/errors/sdk-error.ts",
180
189
  types: "./dist/errors/sdk-error.d.ts",
181
190
  import: "./dist/errors/sdk-error.js",
182
191
  default: "./dist/errors/sdk-error.js"
183
192
  },
184
193
  "./sign-webhook-receipt": {
194
+ "dalp-source": "./src/sign-webhook-receipt.ts",
185
195
  types: "./dist/sign-webhook-receipt.d.ts",
186
196
  import: "./dist/sign-webhook-receipt.js",
187
197
  default: "./dist/sign-webhook-receipt.js"
188
198
  },
189
199
  "./effect": {
200
+ "dalp-source": "./src/effect.ts",
190
201
  types: "./dist/effect.d.ts",
191
202
  import: "./dist/effect.js",
192
203
  default: "./dist/effect.js"
193
204
  },
194
205
  "./routes": {
206
+ "dalp-source": "./src/routes/index.ts",
195
207
  types: "./dist/routes/index.d.ts",
196
208
  import: "./dist/routes/index.js",
197
209
  default: "./dist/routes/index.js"
198
210
  },
199
211
  "./routes/console": {
212
+ "dalp-source": "./src/routes/console.ts",
200
213
  types: "./dist/routes/console.d.ts",
201
214
  import: "./dist/routes/console.js",
202
215
  default: "./dist/routes/console.js"
@@ -206,19 +219,16 @@ var package_default = {
206
219
  access: "public"
207
220
  },
208
221
  scripts: {
222
+ lint: "taskguard oxlint --deny-warnings .",
209
223
  build: "taskguard bun scripts/build.ts",
210
224
  codegen: "taskguard bun scripts/codegen.ts",
211
225
  publint: "publint run --strict --pack bun",
212
226
  attw: 'archive=$(bun pm pack --destination "$PWD" --quiet | tail -n 1) && attw "$archive" --profile esm-only; code=$?; rm -f "$archive"; exit $code',
213
227
  publish: 'cp ../LICENSE . && bun run --cwd .. publish-if-absent "$PWD"',
214
228
  prepack: "cp ../LICENSE .",
215
- test: "taskguard bun --bun vitest run --config node_modules/@tools/vitest-config/vitest.config.mjs --configLoader native --project unit --testTimeout 30000 tests/unit",
216
- "test:coverage": "taskguard bun --bun vitest run --config node_modules/@tools/vitest-config/vitest.config.mjs --configLoader native --project unit --testTimeout 30000 tests/unit --coverage",
217
- lint: "taskguard oxlint --deny-warnings .",
218
- typecheck: "taskguard tsc -p .",
219
- "codegen:webhook-events-sdk": "taskguard bun scripts/generate-webhook-events-sdk.ts",
220
- "typecheck:tools": "taskguard tsc --noEmit -p scripts/tsconfig.json",
221
- "typecheck:generated": "taskguard tsc -p tsconfig.generated-types.json"
229
+ test: "taskguard bun test --preload @testkit/effect-bun-test/preload --conditions dalp-source --isolate ./tests/unit",
230
+ "test:coverage": "taskguard sh -c 'bun test --preload @testkit/effect-bun-test/preload --conditions dalp-source --isolate --coverage --coverage-reporter=lcov ./tests/unit && coverage-floor'",
231
+ "codegen:webhook-events-sdk": "taskguard bun scripts/generate-webhook-events-sdk.ts"
222
232
  },
223
233
  dependencies: {
224
234
  "@better-auth/api-key": "1.7.7",
@@ -236,15 +246,14 @@ var package_default = {
236
246
  "@kernel/evm": "workspace:*",
237
247
  "@kernel/json": "workspace:*",
238
248
  "@tanstack/react-query": "5.104.1",
249
+ "@testkit/effect-bun-test": "workspace:*",
239
250
  "@tools/typescript-config": "workspace:*",
240
- "@tools/vitest-config": "workspace:*",
241
251
  "@types/bun": "1.4.2",
242
252
  "@wire/http-contract": "workspace:*",
243
253
  "abort-controller": "3.0.0",
244
254
  effect: "4.0.0",
245
255
  publint: "0.3.25",
246
256
  typescript: "7.0.2",
247
- vitest: "5.0.3",
248
257
  "whatwg-fetch": "3.6.20",
249
258
  zod: "4.6.5"
250
259
  },
@@ -221,7 +221,9 @@ function appendQueryValue(search, path, value) {
221
221
  }
222
222
  return;
223
223
  }
224
- search.append(path, String(value));
224
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
225
+ search.append(path, String(value));
226
+ }
225
227
  }
226
228
  function serializeDalpQuery(query) {
227
229
  const search = new URLSearchParams;
@@ -652,6 +654,9 @@ function splitRequestInput(route, input) {
652
654
  }
653
655
  var PATH_PARAMETER = /:([A-Za-z0-9_]+)/gu;
654
656
  function encodePathValue(value) {
657
+ if (typeof value === "object" && value !== null) {
658
+ throw new TypeError("DALP path parameters must be strings, numbers, booleans, or null");
659
+ }
655
660
  return encodeURIComponent(typeof value === "string" ? value : String(value));
656
661
  }
657
662
  function buildPath(route, path) {
package/dist/effect.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as Effect from "effect/Effect";
2
- import type { DalpApi, DalpRouteId, DalpRouteTypes } from "./generated/api-types.d.ts";
2
+ import type { DalpApi, DalpRouteId, DalpRouteTypes } from "./generated/api-types.ts";
3
3
  import { type CallOptions } from "./proxy/builder.ts";
4
4
  import { type CreateDalpClientOptions } from "./proxy/transport.ts";
5
5
  import { DalpApiError } from "./errors/api-error.ts";
@@ -35,4 +35,4 @@ export interface DalpEffectClient {
35
35
  export declare function createDalpEffectClient(options: CreateDalpClientOptions): DalpEffectClient;
36
36
  export type { CallOptions } from "./proxy/builder.ts";
37
37
  export type { CreateDalpClientOptions } from "./proxy/transport.ts";
38
- export type { DalpRouteId, DalpRouteTypes } from "./generated/api-types.d.ts";
38
+ export type { DalpRouteId, DalpRouteTypes } from "./generated/api-types.ts";
package/dist/effect.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  streamRequest,
9
9
  sendRequest,
10
10
  queryKeyFor2
11
- } from "./chunk-1v2g817d.js";
11
+ } from "./chunk-vnbszer8.js";
12
12
  import"./chunk-hcpk89xj.js";
13
13
  import {
14
14
  buildProxy,
@@ -1,8 +1,18 @@
1
- import type { DalpErrorCode, DalpRouteErrorCode, DalpRouteId } from "../generated/api-types.d.ts";
1
+ import type { DalpErrorCode, DalpRouteErrorCode, DalpRouteId } from "../generated/api-types.ts";
2
2
  import { type DalpApiError } from "./api-error.ts";
3
3
  export type DalpSdkLocalErrorCode = "DALP_SDK_ERROR" | "sdk.transport.REQUEST_FAILED" | "sdk.transport.MALFORMED_RESPONSE" | "sdk.transport.UNPUBLISHED_ERROR_CODE" | "sdk.transport.UNVERIFIED_ERROR_CODE" | `sdk.transport.HTTP_${number}` | "sdk.response.MALFORMED_SUCCESS" | "sdk.stream.FAILED" | "sdk.stream.UNREADABLE_BODY" | "sdk.scalar.BIG_DECIMAL_INVALID" | "sdk.scalar.EVM_ADDRESS_INVALID" | "sdk.scalar.ORGANIZATION_ID_INVALID" | "sdk.scalar.TOKEN_DECIMALS_INVALID";
4
4
  export type DalpApiErrorCode = DalpErrorCode | DalpSdkLocalErrorCode;
5
5
  export declare const isDalpErrorCode: (code: string) => code is DalpErrorCode;
6
6
  export declare const isDalpSdkLocalErrorCode: (code: string) => code is DalpSdkLocalErrorCode;
7
7
  export declare const isDalpApiErrorCode: (code: string) => code is DalpApiErrorCode;
8
+ export type RouteErrorCodeCheck = {
9
+ readonly kind: "published";
10
+ readonly code: DalpErrorCode;
11
+ } | {
12
+ readonly kind: "unpublished";
13
+ } | {
14
+ readonly kind: "unverified";
15
+ };
16
+ export declare function checkRouteErrorCode(routeId: string, code: string): Promise<RouteErrorCodeCheck>;
17
+ export declare const answeredByRoute: (error: DalpApiError, routeIds: ReadonlyArray<string>) => boolean;
8
18
  export declare const isDalpRouteError: <Id extends DalpRouteId>(error: unknown, ...routeIds: readonly [Id, ...ReadonlyArray<Id>]) => error is DalpApiError<DalpRouteErrorCode<Id> | DalpSdkLocalErrorCode>;