@settlemint/dalp-sdk 3.1.10 → 3.1.11-main.33556892334

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.
Files changed (108) hide show
  1. package/README.md +111 -177
  2. package/dist/auth/client.d.ts +115 -0
  3. package/dist/auth/live.d.ts +4366 -0
  4. package/dist/{auth-permissions.d.ts → auth/permissions.d.ts} +1 -2
  5. package/dist/{auth-wallet-plugins.d.ts → auth/wallet-plugins.d.ts} +69 -5
  6. package/dist/auth.d.ts +22 -115
  7. package/dist/auth.js +248 -0
  8. package/dist/bundler.d.ts +17 -207
  9. package/dist/bundler.js +111 -0
  10. package/dist/chunk-63xjs3xe.js +45725 -0
  11. package/dist/chunk-cy9b59s6.js +503 -0
  12. package/dist/chunk-h12fatty.js +63 -0
  13. package/dist/chunk-nac758dt.js +14542 -0
  14. package/dist/chunk-q8bjy1aa.js +255 -0
  15. package/dist/chunk-r0vsftj4.js +102 -0
  16. package/dist/chunk-w21k7p99.js +843 -0
  17. package/dist/chunk-y0d2c7kp.js +54 -0
  18. package/dist/client/conditional-request.d.ts +16 -0
  19. package/dist/client/factory.d.ts +39 -0
  20. package/dist/client/query-serializer.d.ts +2 -0
  21. package/dist/client/request-compression.d.ts +47 -0
  22. package/dist/client/ssr-fetch.d.ts +12 -0
  23. package/dist/errors/api-error.d.ts +29 -0
  24. package/dist/errors/find-current-error.d.ts +8 -0
  25. package/dist/errors/sdk-error.d.ts +52 -0
  26. package/dist/errors/sdk-error.js +8 -0
  27. package/dist/generated/@tanstack/react-query.gen.d.ts +17380 -0
  28. package/dist/generated/client/client.gen.d.ts +2 -0
  29. package/dist/generated/client/index.d.ts +10 -0
  30. package/dist/generated/client/types.gen.d.ts +120 -0
  31. package/dist/generated/client/utils.gen.d.ts +37 -0
  32. package/dist/generated/client.gen.d.ts +12 -0
  33. package/dist/generated/core/auth.gen.d.ts +25 -0
  34. package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
  35. package/dist/generated/core/params.gen.d.ts +43 -0
  36. package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
  37. package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
  38. package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
  39. package/dist/generated/core/types.gen.d.ts +83 -0
  40. package/dist/generated/core/utils.gen.d.ts +19 -0
  41. package/dist/generated/index.d.ts +2 -0
  42. package/dist/generated/sdk.gen.d.ts +5214 -0
  43. package/dist/generated/types.gen.d.ts +137282 -0
  44. package/dist/generated/zod.gen.d.ts +181286 -0
  45. package/dist/index.d.ts +23 -40
  46. package/dist/index.js +208 -96098
  47. package/dist/operations.d.ts +12 -0
  48. package/dist/operations.js +1747 -0
  49. package/dist/react-query.d.ts +11 -0
  50. package/dist/react-query.js +16485 -0
  51. package/dist/readonly-deep.d.ts +12 -0
  52. package/dist/runtime-exports.d.ts +20 -0
  53. package/dist/runtime-exports.js +16 -0
  54. package/dist/scalars/big-decimal.d.ts +16 -0
  55. package/dist/scalars/ethereum-address.d.ts +8 -0
  56. package/dist/scalars/exchange-rates.d.ts +36 -0
  57. package/dist/scalars/index.d.ts +15 -0
  58. package/dist/scalars/index.js +39 -0
  59. package/dist/scalars/organization-id.d.ts +8 -0
  60. package/dist/schemas.d.ts +10 -0
  61. package/dist/schemas.js +12040 -0
  62. package/dist/secret.d.ts +14 -0
  63. package/dist/sign-webhook-receipt.d.ts +76 -0
  64. package/dist/sign-webhook-receipt.js +26 -0
  65. package/dist/transport/cookie-store.d.ts +9 -0
  66. package/dist/transport/sse-lifecycle.d.ts +44 -0
  67. package/dist/types.d.ts +67 -102
  68. package/dist/url.d.ts +0 -1
  69. package/dist/verify-webhook.d.ts +17 -28
  70. package/dist/verify-webhook.js +8 -0
  71. package/dist/version.d.ts +0 -1
  72. package/dist/wait-for-transaction.d.ts +40 -86
  73. package/dist/wait-for-transaction.js +112 -0
  74. package/dist/webhook-events.d.ts +44 -27
  75. package/package.json +98 -30
  76. package/dist/auth-permissions.d.ts.map +0 -1
  77. package/dist/auth-wallet-plugins.d.ts.map +0 -1
  78. package/dist/auth.d.ts.map +0 -1
  79. package/dist/bundler.d.ts.map +0 -1
  80. package/dist/chunk-xm8h1dzh.js +0 -33
  81. package/dist/client.d.ts +0 -19
  82. package/dist/client.d.ts.map +0 -1
  83. package/dist/contract-errors.d.ts +0 -4156
  84. package/dist/contract-errors.d.ts.map +0 -1
  85. package/dist/contract.d.ts +0 -17
  86. package/dist/contract.d.ts.map +0 -1
  87. package/dist/cookie-store.d.ts +0 -10
  88. package/dist/cookie-store.d.ts.map +0 -1
  89. package/dist/dapi-errors.d.ts +0 -650
  90. package/dist/dapi-errors.d.ts.map +0 -1
  91. package/dist/errors.d.ts +0 -633
  92. package/dist/errors.d.ts.map +0 -1
  93. package/dist/index.d.ts.map +0 -1
  94. package/dist/platform.d.ts +0 -41
  95. package/dist/platform.d.ts.map +0 -1
  96. package/dist/plugins/index.d.ts +0 -13
  97. package/dist/plugins/index.d.ts.map +0 -1
  98. package/dist/plugins/index.js +0 -10
  99. package/dist/sdk-error.d.ts +0 -74
  100. package/dist/sdk-error.d.ts.map +0 -1
  101. package/dist/serializers.d.ts +0 -41
  102. package/dist/serializers.d.ts.map +0 -1
  103. package/dist/types.d.ts.map +0 -1
  104. package/dist/url.d.ts.map +0 -1
  105. package/dist/verify-webhook.d.ts.map +0 -1
  106. package/dist/version.d.ts.map +0 -1
  107. package/dist/wait-for-transaction.d.ts.map +0 -1
  108. package/dist/webhook-events.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,206 +1,140 @@
1
- <p align="center">
2
- <img src="https://github.com/settlemint/sdk/blob/main/logo.svg" width="200px" align="center" alt="SettleMint logo" />
3
- <h1 align="center">DALP SDK</h1>
4
- <p align="center">
5
- <a href="https://settlemint.com">https://settlemint.com</a>
6
- <br/>
7
- Fully typed TypeScript SDK for the Digital Asset Lifecycle Platform API.
8
- </p>
9
- </p>
10
-
11
- <p align="center">
12
- <a href="https://www.npmjs.com/package/@settlemint/dalp-sdk" rel="nofollow"><img src="https://img.shields.io/npm/v/@settlemint/dalp-sdk" alt="npm version"></a>
13
- <a href="https://www.npmjs.com/package/@settlemint/dalp-sdk" rel="nofollow"><img src="https://img.shields.io/npm/dw/@settlemint/dalp-sdk" alt="npm downloads"></a>
14
- </p>
15
-
16
- <div align="center">
17
- <a href="https://settlemint.com">Website</a>
18
- <span>&nbsp;&nbsp;&bull;&nbsp;&nbsp;</span>
19
- <a href="https://www.npmjs.com/package/@settlemint/dalp-sdk">NPM</a>
20
- <span>&nbsp;&nbsp;&bull;&nbsp;&nbsp;</span>
21
- <a href="mailto:support@settlemint.com">Support</a>
22
- <br />
23
- </div>
24
-
25
- ## About
26
-
27
- The DALP SDK provides a fully typed client for the Digital Asset Lifecycle Platform API. Built on [oRPC](https://orpc.unnoq.com/) with contract-first types, it gives you auto-complete for every API namespace — tokens, identities, compliance, transactions, and more.
28
-
29
- ## Installation
30
-
31
- ```bash
32
- # npm
33
- npm install @settlemint/dalp-sdk
34
-
35
- # bun
36
- bun add @settlemint/dalp-sdk
37
- ```
1
+ # DALP SDK
2
+
3
+ The DALP SDK is a Promise-based client generated from the canonical v2 OpenAPI
4
+ declaration ([Hey API](https://heyapi.dev/)), validated at runtime with
5
+ [zod](https://zod.dev/). It is Effect-free: no `Effect` values, no branded
6
+ Effect Schema identifiers on the wire.
38
7
 
39
- ## Quick Start
8
+ ## Client
40
9
 
41
- ```typescript
10
+ ```ts
42
11
  import { createDalpClient } from "@settlemint/dalp-sdk";
43
12
 
44
13
  const dalp = createDalpClient({
45
- url: "https://dalp.example.com",
14
+ baseUrl: "https://dalp.example.com",
46
15
  apiKey: "sm_dalp_...",
47
- organizationId: "org_...", // optional, for multi-org setups
48
16
  });
49
17
 
50
- // Every method is fully typed with auto-complete
51
- const tokens = await dalp.token.list({ query: {} });
52
- const system = await dalp.system.read({});
18
+ const tokens = await dalp.token.list({ query: {} }, { signal });
53
19
  ```
54
20
 
55
- ## Auth Client
56
-
57
- Use `createDalpAuthClient` for Better Auth operations such as sign-up, session listing, organization management, API
58
- keys, device authorization, and wallet verification setup.
21
+ `createDalpClient` owns shared transport policy once: the credential mechanism
22
+ (session cookie in the browser and on SSR, or an `X-Api-Key` header for
23
+ server/CLI callers — never both from the same runtime), organization headers,
24
+ idempotency keys, `Prefer`, conditional `If-None-Match` / ETag reuse, custom fetch
25
+ injection, and abort propagation. See the "Credential ownership matrix" JSDoc
26
+ on `createDalpClient` in `src/client/factory.ts` for which runtime may use
27
+ which credential.
59
28
 
60
- ```typescript
61
- import { createDalpAuthClient } from "@settlemint/dalp-sdk";
29
+ Response decoding is strict: every generated operation parses its response
30
+ against the declared zod schema and throws on a mismatch.
62
31
 
63
- const auth = createDalpAuthClient({
64
- url: "https://dalp.example.com",
65
- apiKey: "sm_dalp_...",
66
- organizationId: "org_...",
67
- });
32
+ ### Conditional requests and ETags
68
33
 
69
- const apiKeys = await auth.apiKey.list();
70
- ```
34
+ `createDalpClient` installs `If-None-Match` / 304 interceptors that reuse a
35
+ held body when the server returns a matching ETag. Server ETags must be
36
+ **strong content digests** computed **after authorization** inside the
37
+ requester's partition. The dapi response cache guarantees this: it hashes the
38
+ serialized body after the request-context middleware has authenticated the
39
+ session. Version-stamp ETags (generation counters, watermarks, table versions)
40
+ are forbidden for conditional-request adopters — a stamp can collide across
41
+ tenants or lag a body change.
71
42
 
72
- For Node-side session flows, use the platform client. It keeps Better Auth cookies in an SDK-owned store and exposes the
73
- DAPI client and auth client together.
43
+ Identity changes that do not ride this client (browser sign-out, organization
44
+ switch) must call `clearConditionalRequestStore(client)` so a later GET cannot
45
+ send another session's `If-None-Match`.
74
46
 
75
- ```typescript
76
- import { createDalpPlatformClient } from "@settlemint/dalp-sdk";
47
+ ```ts
48
+ import { clearConditionalRequestStore, createDalpClient } from "@settlemint/dalp-sdk";
77
49
 
78
- const platform = createDalpPlatformClient({
79
- url: "https://dalp.example.com",
80
- });
81
-
82
- await platform.auth.signUp.email({
83
- email: "user@example.com",
84
- password: "Password123!",
85
- name: "Example User",
86
- });
87
-
88
- const sessionCookie = platform.cookieStore.header;
50
+ clearConditionalRequestStore(dalp);
89
51
  ```
90
52
 
91
- ### Auth Namespaces
92
-
93
- All namespaces below are fully typed on `DalpAuthClient` — every operation has auto-complete and a typed return value.
94
-
95
- | Namespace | Operations | Description |
96
- | --------------------- | ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
97
- | `signIn` | `email` | Sign in with email and password |
98
- | `signUp` | `email` | Register a new account |
99
- | `getSession` | — | Fetch the current session |
100
- | `listSessions` | — | List all active sessions |
101
- | `revokeSession` | — | Revoke a specific session |
102
- | `revokeOtherSessions` | — | Revoke all sessions except the current one |
103
- | `apiKey` | `create`, `list`, `delete` | Manage API keys |
104
- | `organization` | `create`, `list`, `setActive`, `inviteMember`, `acceptInvitation`, `listMembers`, `addMember`, `removeMember` | Manage organizations and membership |
105
- | `admin` | `listUsers`, `createUser`, `removeUser`, `setRole` | Administrative user management |
106
- | `device` | `code`, `token`, `approve`, `deny` | Device authorization flow |
107
- | `twoFactor` | `enable`, `disable`, `verifyTotp`, `verifyBackupCode`, `generateBackupCodes` | Account-level TOTP two-factor authentication |
108
- | `wallet.pincode` | `enable`, `disable`, `update`, `reset` | Wallet pincode protection |
109
- | `wallet.twoFactor` | `enable`, `disable`, `verify` | Wallet two-factor verification |
110
- | `wallet.secretCodes` | `generate`, `confirm` | Wallet secret (recovery) codes |
111
- | `passkey` | — | Account-level passkey registration (browser/WebAuthn only) |
112
-
113
- ```typescript
114
- // Enable account-level 2FA and verify a TOTP code
115
- await auth.twoFactor.enable({ password: "..." });
116
- await auth.twoFactor.verifyTotp({ code: "123456" });
117
- ```
53
+ ## Generated operations
118
54
 
119
- ```typescript
120
- // Enable wallet pincode protection
121
- await auth.wallet.pincode.enable({ pincode: "1234", password: "..." });
55
+ ```ts
56
+ import { createClient } from "@settlemint/dalp-sdk/operations";
122
57
  ```
123
58
 
124
- ## Configuration
125
-
126
- ```typescript
127
- import { createDalpClient } from "@settlemint/dalp-sdk";
128
-
129
- const dalp = createDalpClient({
130
- // Required
131
- url: "https://dalp.example.com",
132
-
133
- // Required for authenticated routes
134
- apiKey: "sm_dalp_...",
135
-
136
- // Optional
137
- organizationId: "org_...", // multi-org scoping
138
- headers: { "User-Agent": "MyApp" }, // override default headers
139
- idempotencyKey: "req_abc123", // ⚠️ sent on EVERY request — use only for single-mutation clients
140
- requestValidation: false, // validate requests client-side (default: false)
141
- responseValidation: false, // validate responses client-side (default: false)
142
- fetch: customFetch, // custom fetch implementation
143
- });
59
+ `./operations` re-exports the generated v2 operation functions and generated
60
+ client primitives (585 operations) on their own subpath, so a consumer who
61
+ only signs webhooks or builds a client never loads that module. Pair it with
62
+ `createDalpClient` from the package root.
63
+
64
+ ## Scalars
65
+
66
+ Custom wire formats — BigDecimal amounts, EVM addresses, and the
67
+ `OrganizationId` entity brand — are not expressed structurally in the
68
+ generated OpenAPI spec (it carries no `format:`/`x-` extension for them), so
69
+ each has a hand-maintained wrapper under `src/scalars/`:
70
+ `big-decimal.ts`, `ethereum-address.ts`, `exchange-rates.ts`,
71
+ `organization-id.ts`. `OrganizationId` is the only entity ID branded
72
+ end-to-end across the platform (see `AGENTS.md`); every other identifier
73
+ crossing this SDK's boundary is a plain string. `tools/scripts/src/check-sdk-scalar-coverage.ts`
74
+ gates new generated scalar-shaped symbols against a curated allowlist so a
75
+ spec change that introduces a new custom scalar fails the build instead of
76
+ shipping unwrapped.
77
+
78
+ ## React Query
79
+
80
+ ```ts
81
+ import { tokenListOptions } from "@settlemint/dalp-sdk/react-query";
144
82
  ```
145
83
 
146
- ## API Namespaces
147
-
148
- | Namespace | Description |
149
- | ------------------ | -------------------------- |
150
- | `account` | Manage accounts |
151
- | `actions` | Manage actions |
152
- | `addons` | Manage addons |
153
- | `admin` | Administrative operations |
154
- | `contacts` | Manage contacts |
155
- | `exchangeRates` | View exchange rates |
156
- | `externalToken` | Manage external tokens |
157
- | `identityRecovery` | Recover lost identities |
158
- | `monitoring` | Platform monitoring |
159
- | `search` | Search across the platform |
160
- | `settings` | Platform settings |
161
- | `system` | System administration |
162
- | `token` | Manage security tokens |
163
- | `transaction` | View transactions |
164
- | `user` | Manage platform users |
165
-
166
- ## Endpoint Coverage
167
-
168
- The SDK covers 100% of the v2 REST API: it is generated from the same oRPC contract that the server implements, and a
169
- CI check (`bun run check:sdk-coverage`) diffs every mounted API route against the contract on every change. Endpoints
170
- intentionally outside the SDK contract are named in a committed allowlist with a reason each, in these categories:
171
-
172
- - **v1-frozen** — the deliberately frozen v1 REST surface
173
- - **internal-ops** — health probes, CSP report sink, theme CSS, static manifests
174
- - **webhook-receiver** — provider webhook receivers (DFNS, Ripple, compliance providers)
175
- - **better-auth** — auth plumbing, covered by the SDK auth client instead
176
- - **docs / asset-delivery / bundler / orpc-mount** — API docs pages, binary asset delivery, the ERC-4337 bundler
177
- JSON-RPC passthrough (covered by the SDK bundler client), and the oRPC transport mounts themselves
178
-
179
- ## Subpath Exports
180
-
181
- ```typescript
182
- // Main entry — client factory, error codes, serializers
183
- import { createDalpAuthClient, createDalpClient, createDalpPlatformClient } from "@settlemint/dalp-sdk";
184
-
185
- // Type-only — for function signatures without runtime code
186
- import type { DalpClient, DalpClientConfig } from "@settlemint/dalp-sdk/types";
187
-
188
- // Plugins — optional oRPC link plugins for advanced usage
189
- import { BatchLinkPlugin, RequestValidationPlugin } from "@settlemint/dalp-sdk/plugins";
190
- ```
84
+ `./react-query` re-exports the generated TanStack Query option factories
85
+ (`queryOptions`, `infiniteOptions`, `mutationOptions`) — spread into your own
86
+ hooks; the generator emits no hooks itself. This is the only module that
87
+ imports `@tanstack/react-query`, so that peer dependency stays optional for
88
+ non-React consumers.
191
89
 
192
- ## Security
90
+ ## Auth
193
91
 
194
- - **API key authentication** — issued via the DALP dashboard (Settings → API Keys) or via `dalp login`
195
- - Public routes can be called without an API key; authenticated routes still require one
196
- - Security headers (`x-api-key`, `x-organization-id`) cannot be overridden by custom headers
197
- - Client-side request validation can be enabled to catch schema violations early
92
+ ```ts
93
+ import { createDalpAuthClient } from "@settlemint/dalp-sdk/auth";
94
+ ```
198
95
 
199
- ## Errors
96
+ The generated SDK already exposes every auth REST operation; `./auth` covers
97
+ what a REST call cannot express — the session/cookie state machine, plugin
98
+ actions that must run in the browser (`passkeyClient` drives the WebAuthn
99
+ ceremony through `navigator.credentials`), and the access-control model that
100
+ evaluates a permission locally instead of round-tripping `has-permission`. Off
101
+ the package root because it costs roughly 70 KiB of Better Auth a
102
+ pure-operations consumer should not pay.
200
103
 
201
- DAPI errors thrown by the SDK use `DalpSdkError` and include `message`, `why`, `fix`, `status`, `retryable`, and the
202
- public DAPI error id when the server returns one.
104
+ ## Bundler and paymaster
203
105
 
204
- ## License
106
+ ```ts
107
+ import { createDalpBundlerClient } from "@settlemint/dalp-sdk/bundler";
108
+ ```
205
109
 
206
- This project is licensed under the **SettleMint Commercial Customer Source License**. See the LICENSE file included in the package for full terms.
110
+ `createDalpBundlerClient` retains the eight established ERC-4337 method names
111
+ while calling the generated v2 REST resources underneath. The SDK accepts
112
+ EntryPoint v0.9 `viem` shapes and returns the corresponding typed values.
113
+
114
+ ## Webhooks and transaction wait
115
+
116
+ - `./verify-webhook` — verify an inbound webhook signature.
117
+ - `./sign-webhook-receipt` — sign a webhook delivery receipt (Node-only).
118
+ - `./wait-for-transaction` — bounded poll for on-chain transaction settlement;
119
+ calls a generated operation and so inherits the generated validator
120
+ module's full weight.
121
+
122
+ ## Package root
123
+
124
+ The package root (`@settlemint/dalp-sdk`) stays deliberately small — the
125
+ client factory, its config and errors, cookie-store transport, SSE lifecycle
126
+ handling, and SDK version constants — so a consumer
127
+ who only needs to call operations never pays for auth, bundler, react-query,
128
+ or webhook code. See the `@module` doc at the top of `src/index.ts` for the
129
+ current weight breakdown per subpath.
130
+
131
+ ## Migrating from the Effect client
132
+
133
+ Prior major versions exposed an `Effect`-returning client
134
+ (`makeDalpEffectClient`, `makeDalpApiLayer`, `DalpEffectClient`) alongside the
135
+ Promise client. That dual surface, the `contracts/` schema re-exports, and
136
+ `makeDalpPlatformClient`/`waitForTransactionEffect` are removed — see
137
+ `CHANGELOG.md` and the
138
+ [v2 migration guide](../docs/content/docs/api-reference/reference/v2-migration.mdx).
139
+ No published consumer depended on the Effect surface, so this ships without a
140
+ major version bump.
@@ -0,0 +1,115 @@
1
+ import type { DalpFetch } from "../client/ssr-fetch.ts";
2
+ import type { AuthGetApiKeyListResponse, AuthGetOrganizationListResponse, AuthPostApiKeyCreateData, AuthPostApiKeyCreateResponse, AuthPostApiKeyDeleteData, AuthPostApiKeyDeleteResponse, AuthPostDeviceApproveData, AuthPostDeviceApproveResponse, AuthPostDeviceDenyData, AuthPostDeviceDenyResponse, AuthPostOrganizationAcceptInvitationData, AuthPostOrganizationAcceptInvitationResponse, AuthPostOrganizationCreateData, AuthPostOrganizationCreateResponse, AuthPostOrganizationRemoveMemberData, AuthPostOrganizationRemoveMemberResponse, AuthPostRevokeOtherSessionsResponse, AuthPostRevokeSessionData, AuthPostRevokeSessionResponse, AuthPostTwoFactorDisableData, AuthPostTwoFactorDisableResponse, AuthPostTwoFactorEnableData, AuthPostTwoFactorEnableResponse, AuthPostTwoFactorGenerateBackupCodesData, AuthPostTwoFactorGenerateBackupCodesResponse, AuthPostTwoFactorVerifyBackupCodeData, AuthPostTwoFactorVerifyBackupCodeResponse, AuthPostTwoFactorVerifyTotpData, AuthPostTwoFactorVerifyTotpResponse, CreateOrganizationInvitationData, CreateOrganizationInvitationResponse, GetSessionResponse, ListUserSessionsResponse, Member, SetActiveOrganizationData, SetActiveOrganizationResponse } from "../generated/types.gen.ts";
3
+ import { Secret } from "../secret.ts";
4
+ import type { CookieStoreShape } from "../transport/cookie-store.ts";
5
+ export interface DalpAuthClientConfig {
6
+ readonly url: string;
7
+ readonly apiKey?: string;
8
+ readonly sessionToken?: string;
9
+ readonly cookie?: string;
10
+ readonly cookieStore?: CookieStoreShape;
11
+ readonly organizationId?: string;
12
+ readonly headers?: Record<string, string>;
13
+ readonly fetch?: DalpFetch;
14
+ }
15
+ export interface DecodedDalpAuthClientConfig extends Omit<DalpAuthClientConfig, "apiKey" | "sessionToken" | "cookie"> {
16
+ readonly apiKey?: Secret;
17
+ readonly sessionToken?: Secret;
18
+ readonly cookie?: Secret;
19
+ }
20
+ export interface DalpAuthError {
21
+ readonly code?: string;
22
+ readonly message?: string;
23
+ readonly status?: number;
24
+ readonly statusText?: string;
25
+ readonly [key: string]: unknown;
26
+ }
27
+ export interface DalpAuthResult<TData = unknown, TError = DalpAuthError> {
28
+ readonly data: TData | null;
29
+ readonly error: TError | null;
30
+ }
31
+ export type DalpAuthOperation<TInput, TData = unknown> = (input?: TInput, options?: unknown) => Promise<DalpAuthResult<TData>>;
32
+ export type DalpRequiredAuthOperation<TInput, TData> = (input: TInput, options?: unknown) => Promise<DalpAuthResult<TData>>;
33
+ export type DalpNoInputAuthOperation<TData> = (options?: unknown) => Promise<DalpAuthResult<TData>>;
34
+ export type RequestBody<TData extends {
35
+ readonly body?: unknown;
36
+ }> = NonNullable<TData["body"]>;
37
+ export interface DalpOrganizationMember extends Member {
38
+ readonly user: {
39
+ readonly id: string;
40
+ readonly email: string;
41
+ readonly name: string;
42
+ readonly image?: string;
43
+ };
44
+ }
45
+ export interface DalpOrganizationMembersQuery {
46
+ readonly limit?: string | number;
47
+ readonly offset?: string | number;
48
+ readonly sortBy?: string;
49
+ readonly sortDirection?: "asc" | "desc";
50
+ readonly filterField?: string;
51
+ readonly filterValue?: string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number>;
52
+ readonly filterOperator?: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with";
53
+ readonly organizationId?: string;
54
+ readonly organizationSlug?: string;
55
+ }
56
+ /** Invitation row from Better Auth `listInvitations` / `listUserInvitations`. */
57
+ export interface DalpOrganizationInvitation {
58
+ readonly id: string;
59
+ readonly organizationId: string;
60
+ readonly email: string;
61
+ readonly role?: string;
62
+ readonly status: string;
63
+ readonly expiresAt: string | Date;
64
+ }
65
+ export interface DalpOrganizationInvitationsQuery {
66
+ readonly organizationId?: string;
67
+ }
68
+ /**
69
+ * Stable Better Auth operation types composed into `DalpAuthClient`.
70
+ *
71
+ * This is not a separate runtime client — `createDalpAuthClient` returns
72
+ * `DalpAuthClient`, which also includes wallet plugins. Keep this interface as
73
+ * the typed non-wallet surface so inference stays explicit; do not construct it.
74
+ */
75
+ export interface DalpCliAuthClient {
76
+ readonly getSession: DalpNoInputAuthOperation<GetSessionResponse>;
77
+ readonly listSessions: DalpNoInputAuthOperation<ListUserSessionsResponse>;
78
+ readonly revokeSession: DalpRequiredAuthOperation<RequestBody<AuthPostRevokeSessionData>, AuthPostRevokeSessionResponse>;
79
+ readonly revokeOtherSessions: DalpNoInputAuthOperation<AuthPostRevokeOtherSessionsResponse>;
80
+ readonly apiKey: {
81
+ readonly list: DalpNoInputAuthOperation<AuthGetApiKeyListResponse>;
82
+ readonly create: DalpRequiredAuthOperation<RequestBody<AuthPostApiKeyCreateData>, AuthPostApiKeyCreateResponse>;
83
+ readonly delete: DalpRequiredAuthOperation<RequestBody<AuthPostApiKeyDeleteData>, AuthPostApiKeyDeleteResponse>;
84
+ };
85
+ readonly organization: {
86
+ readonly list: DalpNoInputAuthOperation<AuthGetOrganizationListResponse>;
87
+ readonly setActive: DalpRequiredAuthOperation<RequestBody<SetActiveOrganizationData>, SetActiveOrganizationResponse>;
88
+ readonly create: DalpRequiredAuthOperation<RequestBody<AuthPostOrganizationCreateData>, AuthPostOrganizationCreateResponse>;
89
+ readonly inviteMember: DalpRequiredAuthOperation<RequestBody<CreateOrganizationInvitationData>, CreateOrganizationInvitationResponse>;
90
+ readonly removeMember: DalpRequiredAuthOperation<RequestBody<AuthPostOrganizationRemoveMemberData>, AuthPostOrganizationRemoveMemberResponse>;
91
+ readonly acceptInvitation: DalpRequiredAuthOperation<RequestBody<AuthPostOrganizationAcceptInvitationData>, AuthPostOrganizationAcceptInvitationResponse>;
92
+ readonly listMembers: DalpRequiredAuthOperation<{
93
+ readonly query?: DalpOrganizationMembersQuery;
94
+ }, {
95
+ readonly members: ReadonlyArray<DalpOrganizationMember>;
96
+ readonly total: number;
97
+ }>;
98
+ readonly listInvitations: DalpAuthOperation<{
99
+ readonly query?: DalpOrganizationInvitationsQuery;
100
+ }, ReadonlyArray<DalpOrganizationInvitation>>;
101
+ readonly listUserInvitations: DalpNoInputAuthOperation<ReadonlyArray<DalpOrganizationInvitation>>;
102
+ };
103
+ readonly twoFactor: {
104
+ readonly enable: DalpRequiredAuthOperation<RequestBody<AuthPostTwoFactorEnableData>, AuthPostTwoFactorEnableResponse>;
105
+ readonly disable: DalpRequiredAuthOperation<RequestBody<AuthPostTwoFactorDisableData>, AuthPostTwoFactorDisableResponse>;
106
+ readonly verifyTotp: DalpRequiredAuthOperation<RequestBody<AuthPostTwoFactorVerifyTotpData>, AuthPostTwoFactorVerifyTotpResponse>;
107
+ readonly verifyBackupCode: DalpRequiredAuthOperation<RequestBody<AuthPostTwoFactorVerifyBackupCodeData>, AuthPostTwoFactorVerifyBackupCodeResponse>;
108
+ readonly generateBackupCodes: DalpRequiredAuthOperation<RequestBody<AuthPostTwoFactorGenerateBackupCodesData>, AuthPostTwoFactorGenerateBackupCodesResponse>;
109
+ };
110
+ readonly device: {
111
+ readonly approve: DalpRequiredAuthOperation<RequestBody<AuthPostDeviceApproveData>, AuthPostDeviceApproveResponse>;
112
+ readonly deny: DalpRequiredAuthOperation<RequestBody<AuthPostDeviceDenyData>, AuthPostDeviceDenyResponse>;
113
+ };
114
+ }
115
+ export declare function decodeDalpAuthClientConfig(input: DalpAuthClientConfig): Promise<DecodedDalpAuthClientConfig>;