@capxul/sdk 0.2.0-alpha.3 → 0.2.0-alpha.4
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/CHANGELOG.md +18 -0
- package/README.md +64 -22
- package/dist/{client-pMBRFcsz.d.ts → client-CbUeJoM9.d.ts} +41 -190
- package/dist/{client-B_Z3ThFO.d.cts → client-UEm2oZbZ.d.cts} +41 -190
- package/dist/client.cjs +362 -644
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +363 -645
- package/dist/index.cjs +363 -716
- package/dist/index.d.cts +32 -142
- package/dist/index.d.ts +32 -142
- package/dist/index.js +365 -716
- package/dist/{types-V_D7qjxY.d.ts → types-BD4VAQb5.d.ts} +14 -0
- package/dist/{types-Brucpq0Z.d.cts → types-HlwCIjgQ.d.cts} +14 -0
- package/dist/webhooks.d.cts +1 -1
- package/dist/webhooks.d.ts +1 -1
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @capxul/sdk
|
|
2
2
|
|
|
3
|
+
## 0.2.0-alpha.4
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b6c1f94: Complete the auth dogfooding epic around the canonical auth surface.
|
|
8
|
+
|
|
9
|
+
The SDK now carries the guarded OTP proof path, bootstrap continuation states,
|
|
10
|
+
canonical auth service behavior, and final funnel proof support needed for
|
|
11
|
+
first-run auth dogfooding. The React SDK aligns its auth hooks and provider
|
|
12
|
+
state with that canonical flow, including signout cleanup, bootstrap-required
|
|
13
|
+
continuations, and funnel telemetry integration.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 50d3c55: Bundle the internal Safe derivation package into the SDK artifact instead of
|
|
18
|
+
publishing it as a runtime dependency, and add a packaging guard that fails when
|
|
19
|
+
publishable packages leak private `@repo/*` runtime dependencies.
|
|
20
|
+
|
|
3
21
|
## 0.2.0-alpha.3
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -30,10 +30,10 @@ React-flavored entry point lives in `@capxul/sdk-react`. Pick:
|
|
|
30
30
|
|
|
31
31
|
Capxul splits the platform into two layers with different licenses:
|
|
32
32
|
|
|
33
|
-
| Layer
|
|
34
|
-
|
|
35
|
-
| Custody (on-chain)
|
|
36
|
-
| Orchestration (this package) | Workflow logic, business rules, integration glue, the `/v1/*` HTTP client
|
|
33
|
+
| Layer | What it does | License |
|
|
34
|
+
| ---------------------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
35
|
+
| Custody (on-chain) | Safe v1.4.1 + ERC-4337 modules — every contract that holds, transfers, or signs over user funds | Open source, audited, in the [Capxul GitHub repo](https://github.com/Xelmar-tech/Capxul/tree/main/packages/contracts) |
|
|
36
|
+
| Orchestration (this package) | Workflow logic, business rules, integration glue, the `/v1/*` HTTP client | Proprietary — see `LICENSE` |
|
|
37
37
|
|
|
38
38
|
You don't have to take our word for the parts that hold money — those
|
|
39
39
|
contracts are open and auditable. The parts that orchestrate workflows
|
|
@@ -94,7 +94,10 @@ runtime URLs by POSTing to `/v1/client/bootstrap` on the first auth or
|
|
|
94
94
|
small:
|
|
95
95
|
|
|
96
96
|
```json
|
|
97
|
-
{
|
|
97
|
+
{
|
|
98
|
+
"authBaseUrl": "https://<deployment>.convex.site/api/auth",
|
|
99
|
+
"convexUrl": "https://<deployment>.convex.cloud"
|
|
100
|
+
}
|
|
98
101
|
```
|
|
99
102
|
|
|
100
103
|
The resolved runtime is cached for the lifetime of the transport. Concurrent
|
|
@@ -136,11 +139,11 @@ try {
|
|
|
136
139
|
|
|
137
140
|
Runtime proof status:
|
|
138
141
|
|
|
139
|
-
| Surface
|
|
140
|
-
|
|
141
|
-
| SDK transport
|
|
142
|
-
| React provider | `CapxulProvider config={{ mode: "publishable-key", ... }}`
|
|
143
|
-
| Reference CLI
|
|
142
|
+
| Surface | Source support | Runtime proof | Status |
|
|
143
|
+
| -------------- | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
144
|
+
| SDK transport | `makeHttpTransport({ mode: "publishable-key", publishableKey })` | `packages/sdk/tests/unit/transport.test.ts` proves config validation, singleflight bootstrap, retry after failure, lifecycle transitions, and sanitized backend errors. | Proven with mocked fetch |
|
|
145
|
+
| React provider | `CapxulProvider config={{ mode: "publishable-key", ... }}` | `packages/sdk-react/ops/proof/react-headless.test.tsx` proves bootstrap before a real `useMe()` read through the provider and lazy Convex data client. | Proven with mocked fetch + headless React |
|
|
146
|
+
| Reference CLI | `bootstrap probe --mock --json` | `apps/reference-cli/scripts/agent-driver.ts` phase 0 and the direct CLI command prove provider/bootstrap/auth ordering and sanitized output. | Proven locally; live endpoint remains manual-key gated |
|
|
144
147
|
|
|
145
148
|
Copy-paste local replication:
|
|
146
149
|
|
|
@@ -160,7 +163,16 @@ fresh checkout; the CLI depends on their generated declaration outputs.
|
|
|
160
163
|
Expected sanitized pass signal:
|
|
161
164
|
|
|
162
165
|
```json
|
|
163
|
-
{
|
|
166
|
+
{
|
|
167
|
+
"command": "bootstrap.probe",
|
|
168
|
+
"ok": true,
|
|
169
|
+
"mode": "publishable-key",
|
|
170
|
+
"status": "ready",
|
|
171
|
+
"bootstrapRequests": 1,
|
|
172
|
+
"authRequests": 1,
|
|
173
|
+
"keyLengthClass": "provided",
|
|
174
|
+
"mocked": true
|
|
175
|
+
}
|
|
164
176
|
```
|
|
165
177
|
|
|
166
178
|
## Public surface (alpha)
|
|
@@ -171,12 +183,36 @@ capxul.me // get, update — first-party caller identity
|
|
|
171
183
|
capxul.accounts // create, retrieve, list
|
|
172
184
|
capxul.organizations // CRUD + members + payments + treasury
|
|
173
185
|
capxul.payments // create, retrieve, list
|
|
174
|
-
capxul.invoices // create, retrieve, list
|
|
175
186
|
capxul.withdrawals // create, retrieve, list
|
|
176
|
-
capxul.documents //
|
|
187
|
+
capxul.documents // personal invoices first; broader document variants typed
|
|
177
188
|
capxul.flows.{auth, onboarding, provisioning} // XState v5 flows
|
|
178
189
|
```
|
|
179
190
|
|
|
191
|
+
### Personal invoice documents
|
|
192
|
+
|
|
193
|
+
The first `documents` runtime surface is the personal invoice pilot.
|
|
194
|
+
It creates immutable open invoice documents with a canonical
|
|
195
|
+
`invoiceHash`. The backend stores the private invoice payload; the
|
|
196
|
+
chain receives only the hash as `documentHash`.
|
|
197
|
+
|
|
198
|
+
```ts
|
|
199
|
+
const [err, invoice] = await capxul.documents.create({
|
|
200
|
+
type: "invoice",
|
|
201
|
+
recipient: { email: "client@example.com" },
|
|
202
|
+
amount: { value: "25.00", currency: "USD" },
|
|
203
|
+
lineItems: [
|
|
204
|
+
{ description: "Design", quantity: 1, unitPrice: "25.00", currency: "USD" },
|
|
205
|
+
],
|
|
206
|
+
reference: "May design work",
|
|
207
|
+
dueAt: "2026-05-20T00:00:00.000Z",
|
|
208
|
+
});
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Use `capxul.documents.retrieve(docId)`, `.list({ type: "invoice" })`,
|
|
212
|
+
and `.cancel(docId)` for the rest of the pilot surface. Org-admin
|
|
213
|
+
invoices, file uploads, PDFs, partial payments, and mutable open
|
|
214
|
+
invoices are outside this pilot.
|
|
215
|
+
|
|
180
216
|
Helpers:
|
|
181
217
|
|
|
182
218
|
- `tryCatch(promise)` — error tuple `[error, data]`; routes on
|
|
@@ -196,11 +232,12 @@ role-based access:
|
|
|
196
232
|
const [err, org] = await capxul.organizations.create({ name: "Acme" });
|
|
197
233
|
|
|
198
234
|
// Invite a member — returns the raw token once
|
|
199
|
-
const [err, { member, inviteToken }] =
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
235
|
+
const [err, { member, inviteToken }] =
|
|
236
|
+
await capxul.organizations.members.invite({
|
|
237
|
+
organizationId: org.id,
|
|
238
|
+
email: "alice@example.com",
|
|
239
|
+
role: "finance_manager",
|
|
240
|
+
});
|
|
204
241
|
|
|
205
242
|
// List members — defaults to active; pass status to filter
|
|
206
243
|
const [err, list] = await capxul.organizations.members.list({
|
|
@@ -209,7 +246,9 @@ const [err, list] = await capxul.organizations.members.list({
|
|
|
209
246
|
});
|
|
210
247
|
|
|
211
248
|
// Accept an invitation (called by the invitee)
|
|
212
|
-
const [err, member] = await capxul.organizations.members.accept({
|
|
249
|
+
const [err, member] = await capxul.organizations.members.accept({
|
|
250
|
+
token: inviteToken,
|
|
251
|
+
});
|
|
213
252
|
|
|
214
253
|
// Revoke a pending invitation
|
|
215
254
|
const [err] = await capxul.organizations.members.revoke({
|
|
@@ -241,9 +280,12 @@ const [err, account] = await tryCatch(capxul.me.get());
|
|
|
241
280
|
|
|
242
281
|
if (err) {
|
|
243
282
|
switch (err.code) {
|
|
244
|
-
case "PROFILE_NOT_FOUND":
|
|
245
|
-
|
|
246
|
-
|
|
283
|
+
case "PROFILE_NOT_FOUND":
|
|
284
|
+
return router.push("/onboarding");
|
|
285
|
+
case "NOT_AUTHENTICATED":
|
|
286
|
+
return router.push("/login");
|
|
287
|
+
default:
|
|
288
|
+
throw err; // unhandled — bubble to the error boundary
|
|
247
289
|
}
|
|
248
290
|
}
|
|
249
291
|
```
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Account as Account$1 } from 'viem';
|
|
2
|
-
import * as xstate from 'xstate';
|
|
3
2
|
import { AnyStateMachine } from 'xstate';
|
|
4
3
|
import { A as AccountId, S as SafeId, c as KycProfileId, b as ExternalAccountId, f as SubAccountId, d as OrganizationId, a as ApiKeyId, X as TimestampIso, U as Username, E as Email, D as DocumentId, O as OperationId, P as PaymentId, g as TransferId, k as WithdrawalId, W as WebhookEndpointId, j as WebhookEventId, M as MemberId, V as VirtualAccountId, i as VirtualCardId } from './next-action-CTGl8wpy.js';
|
|
5
|
-
import { d as CapxulResult, C as CapxulError
|
|
6
|
-
import { A as Account, X as UserIdentifier, a as AccountLookupResult, S as Safe, k as KycProfile, E as ExternalAccount, L as List, F as SubAccount, B as BalanceLedgerEntry, b as ApiKey, a5 as CreateApiKeyRequest, a6 as CreateDocumentRequest, D as Document, O as Operation, q as OperationStatus, p as Money, C as CreatePaymentResult, t as Payment, Q as TransferEndpoint, f as CreateTransferResult, J as Transfer, g as CreateWithdrawalResult, a3 as Withdrawal, a7 as CreateWebhookEndpointRequest, a1 as WebhookEndpoint, a2 as WebhookEvent, s as Organization, W as Treasury, o as MembershipStatus, M as Member, n as MemberInviteResponse, a8 as CreateVirtualAccountRequest, Y as VirtualAccount, a9 as CreateVirtualCardRequest, _ as VirtualCard } from './types-
|
|
4
|
+
import { d as CapxulResult, C as CapxulError } from './errors-CwhCWGxm.js';
|
|
5
|
+
import { A as Account, X as UserIdentifier, a as AccountLookupResult, S as Safe, k as KycProfile, E as ExternalAccount, L as List, F as SubAccount, B as BalanceLedgerEntry, b as ApiKey, a5 as CreateApiKeyRequest, a6 as CreateDocumentRequest, D as Document, O as Operation, q as OperationStatus, p as Money, C as CreatePaymentResult, t as Payment, Q as TransferEndpoint, f as CreateTransferResult, J as Transfer, g as CreateWithdrawalResult, a3 as Withdrawal, a7 as CreateWebhookEndpointRequest, a1 as WebhookEndpoint, a2 as WebhookEvent, s as Organization, W as Treasury, o as MembershipStatus, M as Member, n as MemberInviteResponse, a8 as CreateVirtualAccountRequest, Y as VirtualAccount, a9 as CreateVirtualCardRequest, _ as VirtualCard } from './types-BD4VAQb5.js';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Accounts domain — individual user accounts per sdk-surface.md §1a.
|
|
@@ -184,13 +183,6 @@ type AuthSessionStore = {
|
|
|
184
183
|
set(session: Session): void;
|
|
185
184
|
clear(): void;
|
|
186
185
|
};
|
|
187
|
-
type AuthSendOtpInput = {
|
|
188
|
-
readonly email: string;
|
|
189
|
-
};
|
|
190
|
-
type AuthVerifyOtpInput = {
|
|
191
|
-
readonly email: string;
|
|
192
|
-
readonly otp: string;
|
|
193
|
-
};
|
|
194
186
|
type AuthBootstrapToken = string & {
|
|
195
187
|
readonly __capxulAuthBootstrapTokenBrand: "AuthBootstrapToken";
|
|
196
188
|
};
|
|
@@ -222,10 +214,6 @@ type CompleteBootstrapResult = {
|
|
|
222
214
|
readonly username: Username;
|
|
223
215
|
readonly safe: Safe;
|
|
224
216
|
};
|
|
225
|
-
type AuthServiceTokenMintInput = {
|
|
226
|
-
readonly apiKey: string;
|
|
227
|
-
readonly audience?: string;
|
|
228
|
-
};
|
|
229
217
|
/**
|
|
230
218
|
* Options bag for auth methods that perform outbound `fetch` work.
|
|
231
219
|
*
|
|
@@ -239,26 +227,37 @@ type AuthServiceTokenMintInput = {
|
|
|
239
227
|
type AuthMethodOptions = {
|
|
240
228
|
readonly signal?: AbortSignal;
|
|
241
229
|
};
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* AuthService — unified promise-based auth surface.
|
|
233
|
+
*
|
|
234
|
+
* Wraps the imperative `AuthClient` tuple API with a class-based,
|
|
235
|
+
* promise-based interface. `signOut` preserves the data-client
|
|
236
|
+
* reference so provider-owned singletons survive sign-in/sign-out
|
|
237
|
+
* cycles.
|
|
238
|
+
*/
|
|
239
|
+
|
|
240
|
+
declare class AuthService {
|
|
241
|
+
private authClient;
|
|
242
|
+
private sessionStore;
|
|
243
|
+
private config;
|
|
244
|
+
constructor(config?: CapxulConfig);
|
|
245
|
+
sendOtp(email: string, options?: AuthMethodOptions): Promise<void>;
|
|
246
|
+
verifyOtp(email: string, otp: string, options?: AuthMethodOptions): Promise<VerifyOtpResult>;
|
|
247
|
+
completeBootstrap(params: CompleteBootstrapInput, signer?: Account$1): Promise<CompleteBootstrapResult>;
|
|
248
|
+
/**
|
|
249
|
+
* Clears the persisted session and, when a transport was pre-injected,
|
|
250
|
+
* drops the cached auth header.
|
|
251
|
+
*
|
|
252
|
+
* **Transport safety note:** `clearAuth()` is only invoked when
|
|
253
|
+
* `config._transport` was supplied at construction (e.g. by the React
|
|
254
|
+
* provider). If `AuthService` is instantiated directly in a Node/CLI
|
|
255
|
+
* context without an injected transport, the transport-side auth cache
|
|
256
|
+
* is the caller's responsibility.
|
|
257
|
+
*/
|
|
258
|
+
signOut(): Promise<void>;
|
|
259
|
+
getSession(): Promise<Session | null>;
|
|
260
|
+
}
|
|
262
261
|
|
|
263
262
|
/**
|
|
264
263
|
* Documents domain — unified artifact primitive per sdk-surface.md §1a
|
|
@@ -294,9 +293,9 @@ type OrgDocumentsCancelInput = {
|
|
|
294
293
|
readonly documentId: DocumentId;
|
|
295
294
|
};
|
|
296
295
|
type CreateCodes$7 = "NOT_AUTHENTICATED" | "PERMISSION_DENIED" | "INVALID_INPUT" | "IDEMPOTENCY_CONFLICT" | "RATE_LIMITED" | "NETWORK_ERROR";
|
|
297
|
-
type RetrieveCodes$c = "NOT_AUTHENTICATED" | "PERMISSION_DENIED" | "NOT_FOUND";
|
|
296
|
+
type RetrieveCodes$c = "NOT_AUTHENTICATED" | "PERMISSION_DENIED" | "NOT_FOUND" | "INVALID_INPUT";
|
|
298
297
|
type ListCodes$9 = "NOT_AUTHENTICATED" | "PERMISSION_DENIED" | "INVALID_INPUT";
|
|
299
|
-
type CancelCodes$1 = "NOT_AUTHENTICATED" | "PERMISSION_DENIED" | "NOT_FOUND" | "OPERATION_CANCELED";
|
|
298
|
+
type CancelCodes$1 = "NOT_AUTHENTICATED" | "PERMISSION_DENIED" | "NOT_FOUND" | "INVALID_INPUT" | "OPERATION_CANCELED";
|
|
300
299
|
type DocumentsClient = {
|
|
301
300
|
readonly create: (input: DocumentsCreateInput) => Promise<CapxulResult<Document, CreateCodes$7>>;
|
|
302
301
|
readonly retrieve: (documentId: DocumentId) => Promise<CapxulResult<Document, RetrieveCodes$c>>;
|
|
@@ -922,7 +921,7 @@ type TransportState = {
|
|
|
922
921
|
readonly runtime: TransportRuntime;
|
|
923
922
|
} | {
|
|
924
923
|
readonly status: "error";
|
|
925
|
-
readonly error: CapxulError
|
|
924
|
+
readonly error: CapxulError;
|
|
926
925
|
};
|
|
927
926
|
type TransportRuntime = {
|
|
928
927
|
readonly authBaseUrl: string;
|
|
@@ -1149,152 +1148,6 @@ type VirtualCardsClient = {
|
|
|
1149
1148
|
readonly cancel: (virtualCardId: VirtualCardId) => Promise<CapxulResult<VirtualCard, MutateCodes>>;
|
|
1150
1149
|
};
|
|
1151
1150
|
|
|
1152
|
-
/**
|
|
1153
|
-
* Unified error type used across the entire stack: backend, SDK, and frontend.
|
|
1154
|
-
* One class, one set of codes, one language.
|
|
1155
|
-
*
|
|
1156
|
-
* Backend throws CapxulError → withErrorBoundary serializes to ConvexError →
|
|
1157
|
-
* SDK deserializes back to CapxulError → frontend routes on err.code.
|
|
1158
|
-
*/
|
|
1159
|
-
type CapxulErrorCode = "NOT_AUTHENTICATED" | "EMAIL_DELIVERY_FAILED" | "API_KEY_INVALID" | "API_KEY_EXPIRED" | "PROFILE_NOT_FOUND" | "SMART_ACCOUNT_MISSING" | "PLAYER_NOT_FOUND" | "ACCOUNT_NOT_FOUND" | "PROVIDER_ERROR" | "INVALID_INPUT" | "ENV_MISSING" | "NOT_IMPLEMENTED" | "VERIFICATION_REQUIRED" | "INSUFFICIENT_BALANCE" | "INVALID_RECIPIENT" | "TRANSACTION_FAILED" | "RATE_LIMITED" | "NETWORK_ERROR" | "PERMISSION_DENIED" | "IDEMPOTENCY_CONFLICT" | "NOT_FOUND" | "OPERATION_CANCELED" | "OPERATION_TIMEOUT" | "ACTION_REQUIRED" | "KYC_REQUIRED" | "POLICY_DENIED" | "SAFE_NOT_READY" | "PROVIDER_UNAVAILABLE" | "PROVIDER_REJECTED" | "RECONCILIATION_FAILED" | "INTERNAL_ERROR" | "QUOTE_EXPIRED" | "QUOTE_NOT_FOUND" | "INDEXER_DELIVERY_TIMEOUT" | "UNKNOWN";
|
|
1160
|
-
declare class CapxulError extends Error {
|
|
1161
|
-
readonly code: CapxulErrorCode;
|
|
1162
|
-
readonly details?: Record<string, unknown>;
|
|
1163
|
-
readonly correlationId?: string;
|
|
1164
|
-
readonly layer?: string;
|
|
1165
|
-
constructor(code: CapxulErrorCode, message: string, options?: {
|
|
1166
|
-
cause?: unknown;
|
|
1167
|
-
details?: Record<string, unknown>;
|
|
1168
|
-
correlationId?: string;
|
|
1169
|
-
layer?: string;
|
|
1170
|
-
});
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
type AuthBootstrapFlowError = CapxulError$1 | CapxulError;
|
|
1174
|
-
type AuthBootstrapFlowContext = {
|
|
1175
|
-
readonly email: Email | null;
|
|
1176
|
-
readonly code: string | null;
|
|
1177
|
-
readonly username: Username | null;
|
|
1178
|
-
readonly bootstrapToken: AuthBootstrapToken | null;
|
|
1179
|
-
readonly bootstrapReason: AuthBootstrapReason | null;
|
|
1180
|
-
readonly session: Session | null;
|
|
1181
|
-
readonly account: Account | null;
|
|
1182
|
-
readonly safe: Safe | null;
|
|
1183
|
-
readonly error: AuthBootstrapFlowError | null;
|
|
1184
|
-
};
|
|
1185
|
-
type AuthBootstrapFlowEvent = {
|
|
1186
|
-
readonly type: "ENTER_EMAIL";
|
|
1187
|
-
readonly email: Email;
|
|
1188
|
-
} | {
|
|
1189
|
-
readonly type: "REQUEST_OTP";
|
|
1190
|
-
} | {
|
|
1191
|
-
readonly type: "ENTER_OTP";
|
|
1192
|
-
readonly code: string;
|
|
1193
|
-
} | {
|
|
1194
|
-
readonly type: "VERIFY_OTP";
|
|
1195
|
-
} | {
|
|
1196
|
-
readonly type: "ENTER_USERNAME";
|
|
1197
|
-
readonly username: Username;
|
|
1198
|
-
} | {
|
|
1199
|
-
readonly type: "COMPLETE_BOOTSTRAP";
|
|
1200
|
-
} | {
|
|
1201
|
-
readonly type: "BACK";
|
|
1202
|
-
} | {
|
|
1203
|
-
readonly type: "RESET";
|
|
1204
|
-
} | {
|
|
1205
|
-
readonly type: "SIGN_OUT";
|
|
1206
|
-
};
|
|
1207
|
-
declare function createAuthBootstrapFlowMachine(client: CapxulClient): xstate.StateMachine<AuthBootstrapFlowContext, {
|
|
1208
|
-
readonly type: "ENTER_EMAIL";
|
|
1209
|
-
readonly email: Email;
|
|
1210
|
-
} | {
|
|
1211
|
-
readonly type: "REQUEST_OTP";
|
|
1212
|
-
} | {
|
|
1213
|
-
readonly type: "ENTER_OTP";
|
|
1214
|
-
readonly code: string;
|
|
1215
|
-
} | {
|
|
1216
|
-
readonly type: "VERIFY_OTP";
|
|
1217
|
-
} | {
|
|
1218
|
-
readonly type: "ENTER_USERNAME";
|
|
1219
|
-
readonly username: Username;
|
|
1220
|
-
} | {
|
|
1221
|
-
readonly type: "COMPLETE_BOOTSTRAP";
|
|
1222
|
-
} | {
|
|
1223
|
-
readonly type: "BACK";
|
|
1224
|
-
} | {
|
|
1225
|
-
readonly type: "RESET";
|
|
1226
|
-
} | {
|
|
1227
|
-
readonly type: "SIGN_OUT";
|
|
1228
|
-
}, {
|
|
1229
|
-
[x: string]: xstate.ActorRefFromLogic<xstate.PromiseActorLogic<void, void, xstate.EventObject>> | xstate.ActorRefFromLogic<xstate.PromiseActorLogic<void, {
|
|
1230
|
-
email: Email;
|
|
1231
|
-
}, xstate.EventObject>> | xstate.ActorRefFromLogic<xstate.PromiseActorLogic<VerifyOtpResult, {
|
|
1232
|
-
email: Email;
|
|
1233
|
-
code: string;
|
|
1234
|
-
}, xstate.EventObject>> | xstate.ActorRefFromLogic<xstate.PromiseActorLogic<CompleteBootstrapResult, {
|
|
1235
|
-
bootstrapToken: AuthBootstrapToken;
|
|
1236
|
-
username: Username;
|
|
1237
|
-
}, xstate.EventObject>> | undefined;
|
|
1238
|
-
}, {
|
|
1239
|
-
src: "sendOtp";
|
|
1240
|
-
logic: xstate.PromiseActorLogic<void, {
|
|
1241
|
-
email: Email;
|
|
1242
|
-
}, xstate.EventObject>;
|
|
1243
|
-
id: string | undefined;
|
|
1244
|
-
} | {
|
|
1245
|
-
src: "verifyOtp";
|
|
1246
|
-
logic: xstate.PromiseActorLogic<VerifyOtpResult, {
|
|
1247
|
-
email: Email;
|
|
1248
|
-
code: string;
|
|
1249
|
-
}, xstate.EventObject>;
|
|
1250
|
-
id: string | undefined;
|
|
1251
|
-
} | {
|
|
1252
|
-
src: "signOut";
|
|
1253
|
-
logic: xstate.PromiseActorLogic<void, void, xstate.EventObject>;
|
|
1254
|
-
id: string | undefined;
|
|
1255
|
-
} | {
|
|
1256
|
-
src: "completeBootstrap";
|
|
1257
|
-
logic: xstate.PromiseActorLogic<CompleteBootstrapResult, {
|
|
1258
|
-
bootstrapToken: AuthBootstrapToken;
|
|
1259
|
-
username: Username;
|
|
1260
|
-
}, xstate.EventObject>;
|
|
1261
|
-
id: string | undefined;
|
|
1262
|
-
}, {
|
|
1263
|
-
type: "trackOtpRequested";
|
|
1264
|
-
params: unknown;
|
|
1265
|
-
} | {
|
|
1266
|
-
type: "trackTimeoutFailed";
|
|
1267
|
-
params: unknown;
|
|
1268
|
-
} | {
|
|
1269
|
-
type: "trackVerified";
|
|
1270
|
-
params: unknown;
|
|
1271
|
-
} | {
|
|
1272
|
-
type: "identifyAndTrack";
|
|
1273
|
-
params: unknown;
|
|
1274
|
-
} | {
|
|
1275
|
-
type: "trackSignedOut";
|
|
1276
|
-
params: unknown;
|
|
1277
|
-
} | {
|
|
1278
|
-
type: "trackFailed";
|
|
1279
|
-
params: unknown;
|
|
1280
|
-
} | {
|
|
1281
|
-
type: "trackBootstrapRequired";
|
|
1282
|
-
params: unknown;
|
|
1283
|
-
}, never, never, "email" | "authenticated" | "error" | "bootstrap_required" | "sending_otp" | "otp_requested" | "signing_out" | "verifying_otp" | "completing_bootstrap", string, xstate.NonReducibleUnknown, xstate.NonReducibleUnknown, xstate.EventObject, xstate.MetaObject, {
|
|
1284
|
-
id: "authBootstrap";
|
|
1285
|
-
states: {
|
|
1286
|
-
readonly email: {};
|
|
1287
|
-
readonly sending_otp: {};
|
|
1288
|
-
readonly otp_requested: {};
|
|
1289
|
-
readonly verifying_otp: {};
|
|
1290
|
-
readonly bootstrap_required: {};
|
|
1291
|
-
readonly completing_bootstrap: {};
|
|
1292
|
-
readonly authenticated: {};
|
|
1293
|
-
readonly signing_out: {};
|
|
1294
|
-
readonly error: {};
|
|
1295
|
-
};
|
|
1296
|
-
}>;
|
|
1297
|
-
|
|
1298
1151
|
/**
|
|
1299
1152
|
* Root `@capxul/sdk` client factory.
|
|
1300
1153
|
*
|
|
@@ -1401,7 +1254,7 @@ type CapxulConfig = {
|
|
|
1401
1254
|
readonly _transport?: HttpTransport;
|
|
1402
1255
|
};
|
|
1403
1256
|
/**
|
|
1404
|
-
* Per-call factories for
|
|
1257
|
+
* Per-call factories for XState v5 flow machines.
|
|
1405
1258
|
*
|
|
1406
1259
|
* Each factory returns a fresh machine instance bound to this
|
|
1407
1260
|
* `CapxulClient`. The consumer is responsible for creating a single
|
|
@@ -1417,8 +1270,6 @@ type CapxulConfig = {
|
|
|
1417
1270
|
* `./flows/*` when they need them.
|
|
1418
1271
|
*/
|
|
1419
1272
|
type CapxulFlowFactories = {
|
|
1420
|
-
readonly auth: () => AnyStateMachine;
|
|
1421
|
-
readonly authBootstrap: () => ReturnType<typeof createAuthBootstrapFlowMachine>;
|
|
1422
1273
|
readonly onboarding: () => AnyStateMachine;
|
|
1423
1274
|
readonly provisioning: () => AnyStateMachine;
|
|
1424
1275
|
};
|
|
@@ -1439,7 +1290,7 @@ type CapxulClient = {
|
|
|
1439
1290
|
* `createCapxulClient()` call. See Codex P1 finding on PR #406.
|
|
1440
1291
|
*/
|
|
1441
1292
|
readonly id: string;
|
|
1442
|
-
readonly auth:
|
|
1293
|
+
readonly auth: AuthService;
|
|
1443
1294
|
readonly me: MeClient;
|
|
1444
1295
|
readonly accounts: AccountsClient;
|
|
1445
1296
|
readonly organizations: OrganizationsClient;
|
|
@@ -1474,11 +1325,11 @@ type CapxulClient = {
|
|
|
1474
1325
|
* Two-pass construction: the per-domain clients (`auth`, `me`, …) are
|
|
1475
1326
|
* built first, then `flows` is assigned with factories that close over
|
|
1476
1327
|
* the fully-built `client` so the spawned XState machines can call
|
|
1477
|
-
* back into `client.
|
|
1478
|
-
*
|
|
1328
|
+
* back into `client.accounts.provisionPersonal`, etc. The intermediate
|
|
1329
|
+
* `clientWithoutFlows` value is typed without
|
|
1479
1330
|
* `flows`; `Object.assign` mutates a single `flows` field on it before
|
|
1480
1331
|
* the returned `CapxulClient` cast — minimal and contained.
|
|
1481
1332
|
*/
|
|
1482
1333
|
declare function createCapxulClient(config?: CapxulConfig): CapxulClient;
|
|
1483
1334
|
|
|
1484
|
-
export { type
|
|
1335
|
+
export { type AccountProvisionPersonalInput as A, type BrowserCapxulConfig as B, type CapxulClient as C, type DocumentsClient as D, type ExternalAccountsClient as E, type TokenTransfersListPage as F, type TokenTransfersRetrieveInput as G, type HttpTransport as H, type TransfersClient as I, type TransportRuntime as J, type TransportState as K, type LocalPrivateKeySignerProvider as L, type MeClient as M, type VirtualAccountsClient as N, type OperationsClient as O, type PaymentsClient as P, type VirtualCardsClient as Q, type WebhookEndpointsClient as R, type Session as S, type TokenTransfer as T, type WebhookEventsClient as U, type VerifyOtpResult as V, type WebhookEndpointCreateResult as W, type WithdrawalsClient as X, createCapxulClient as Y, makeHttpTransport as Z, toTokenTransferId as _, type AccountsClient as a, type ApiKeyCreateResult as b, type ApiKeysClient as c, type AuthBootstrapReason as d, type AuthBootstrapToken as e, AuthService as f, type AuthSessionStore as g, type CapxulAuthConfig as h, type CapxulConfig as i, type CapxulDataClient as j, type CapxulFlowFactories as k, type CapxulSigningConfig as l, type CompleteBootstrapInput as m, type CompleteBootstrapResult as n, type OrgDocumentsClient as o, type OrgMembersClient as p, type OrgPaymentsClient as q, type OrgSafesClient as r, type OrgTransfersClient as s, type OrgTreasuryClient as t, type OrgWithdrawalsClient as u, type OrganizationsClient as v, type SubAccountsClient as w, type TokenTransferId as x, type TokenTransfersClient as y, type TokenTransfersListInput as z };
|