@capxul/sdk 0.1.0-alpha.0 → 0.1.0-alpha.2

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 CHANGED
@@ -1,5 +1,44 @@
1
1
  # @capxul/sdk
2
2
 
3
+ ## 0.1.0-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Add `convex` as a peer dependency.
8
+
9
+ `@capxul/sdk`'s bundled `_generated/api` snapshot calls
10
+ `anyApi` / `componentsGeneric` from `convex/server` at runtime — they
11
+ are not just types — and tsup correctly externalizes `convex` /
12
+ `convex/server` / `convex/react` so the consumer's own Convex install
13
+ is reused. The peer was missing from the published manifest, so
14
+ `require('@capxul/sdk')` failed with `Cannot find module 'convex/server'`
15
+ in any spike that hadn't already installed `convex`.
16
+
17
+ `@capxul/sdk-react` mirrors the peer because its bundle re-exports
18
+ flow-machine constructors from `@capxul/sdk` and may transitively
19
+ pull in the same module.
20
+
21
+ Caught during alpha.1 spike-install verification.
22
+
23
+ ## 0.1.0-alpha.1
24
+
25
+ ### Patch Changes
26
+
27
+ - Move workspace `@repo/*` packages from `dependencies` to
28
+ `devDependencies` so the published `package.json` doesn't list them
29
+ as runtime deps. The tsup pipeline bundles every `@repo/*` import
30
+ inline (`noExternal`), so the published code has zero references to
31
+ those packages — but until now the published `package.json` still
32
+ declared them, and `npm install @capxul/sdk@0.1.0-alpha.0` failed
33
+ trying to resolve `@repo/api-contract@0.0.0` etc. on the public
34
+ registry.
35
+
36
+ `@capxul/sdk-react` keeps `@capxul/sdk` as a runtime dep — that one
37
+ is published.
38
+
39
+ No public surface changes. Pure publish-metadata correction caught
40
+ during alpha.0 spike-install verification.
41
+
3
42
  Changelog managed by [changesets](https://github.com/changesets/changesets) —
4
43
  see `.changeset/README.md` for the operator workflow.
5
44
 
@@ -1,8 +1,8 @@
1
1
  import { Account as Account$1 } from 'viem';
2
2
  import { AnyStateMachine } from 'xstate';
3
- import { AccountId, SafeId, KycProfileId, ExternalAccountId, SubAccountId, OrganizationId, ApiKeyId, TimestampIso, DocumentId, OperationId, PaymentId, TransferId, WithdrawalId, WebhookEndpointId, WebhookEventId, MemberId, KybProfileId, VirtualAccountId, VirtualCardId } from '@repo/platform-kernel';
4
- import { CapxulResult, CapxulError } from './errors.cjs';
5
- import { A as Account, U as UserIdentifier, a as AccountLookupResult, S as Safe, i as KycProfile, E as ExternalAccount, L as List, v as SubAccount, B as BalanceLedgerEntry, b as ApiKey, D as Document, O as Operation, l as OperationStatus, k as Money, C as CreatePaymentResult, o as Payment, F as TransferEndpoint, f as CreateTransferResult, y as Transfer, g as CreateWithdrawalResult, _ as Withdrawal, Y as WebhookEndpoint, Z as WebhookEvent, n as Organization, J as Treasury, M as Member, K as KybProfile, V as VirtualAccount, Q as VirtualCard } from './types-Cokyqgwm.cjs';
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, D as DocumentId, O as OperationId, P as PaymentId, g as TransferId, k as WithdrawalId, W as WebhookEndpointId, j as WebhookEventId, M as MemberId, K as KybProfileId, V as VirtualAccountId, i as VirtualCardId } from './next-action-DkrwXYay.js';
4
+ import { d as CapxulResult, C as CapxulError } from './errors-QHD5Tlok.js';
5
+ import { A as Account, U as UserIdentifier, a as AccountLookupResult, S as Safe, i as KycProfile, E as ExternalAccount, L as List, v as SubAccount, B as BalanceLedgerEntry, b as ApiKey, D as Document, O as Operation, l as OperationStatus, k as Money, C as CreatePaymentResult, o as Payment, F as TransferEndpoint, f as CreateTransferResult, y as Transfer, g as CreateWithdrawalResult, _ as Withdrawal, Y as WebhookEndpoint, Z as WebhookEvent, n as Organization, J as Treasury, M as Member, K as KybProfile, V as VirtualAccount, Q as VirtualCard } from './types-75UokagF.js';
6
6
  import * as types from '@repo/api-contract/gen/types';
7
7
 
8
8
  /**
@@ -1,8 +1,8 @@
1
1
  import { Account as Account$1 } from 'viem';
2
2
  import { AnyStateMachine } from 'xstate';
3
- import { AccountId, SafeId, KycProfileId, ExternalAccountId, SubAccountId, OrganizationId, ApiKeyId, TimestampIso, DocumentId, OperationId, PaymentId, TransferId, WithdrawalId, WebhookEndpointId, WebhookEventId, MemberId, KybProfileId, VirtualAccountId, VirtualCardId } from '@repo/platform-kernel';
4
- import { CapxulResult, CapxulError } from './errors.js';
5
- import { A as Account, U as UserIdentifier, a as AccountLookupResult, S as Safe, i as KycProfile, E as ExternalAccount, L as List, v as SubAccount, B as BalanceLedgerEntry, b as ApiKey, D as Document, O as Operation, l as OperationStatus, k as Money, C as CreatePaymentResult, o as Payment, F as TransferEndpoint, f as CreateTransferResult, y as Transfer, g as CreateWithdrawalResult, _ as Withdrawal, Y as WebhookEndpoint, Z as WebhookEvent, n as Organization, J as Treasury, M as Member, K as KybProfile, V as VirtualAccount, Q as VirtualCard } from './types-Cokyqgwm.js';
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, D as DocumentId, O as OperationId, P as PaymentId, g as TransferId, k as WithdrawalId, W as WebhookEndpointId, j as WebhookEventId, M as MemberId, K as KybProfileId, V as VirtualAccountId, i as VirtualCardId } from './next-action-DkrwXYay.cjs';
4
+ import { d as CapxulResult, C as CapxulError } from './errors-GgKrSUKp.cjs';
5
+ import { A as Account, U as UserIdentifier, a as AccountLookupResult, S as Safe, i as KycProfile, E as ExternalAccount, L as List, v as SubAccount, B as BalanceLedgerEntry, b as ApiKey, D as Document, O as Operation, l as OperationStatus, k as Money, C as CreatePaymentResult, o as Payment, F as TransferEndpoint, f as CreateTransferResult, y as Transfer, g as CreateWithdrawalResult, _ as Withdrawal, Y as WebhookEndpoint, Z as WebhookEvent, n as Organization, J as Treasury, M as Member, K as KybProfile, V as VirtualAccount, Q as VirtualCard } from './types-DVWojoy4.cjs';
6
6
  import * as types from '@repo/api-contract/gen/types';
7
7
 
8
8
  /**
package/dist/client.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import 'viem';
2
2
  import 'xstate';
3
- export { f as CapxulAuthConfig, C as CapxulClient, g as CapxulConfig, h as CapxulDataClient, i as CapxulFlowFactories, j as CapxulSigningConfig, y as createCapxulClient } from './client-BNGGubL2.cjs';
4
- import '@repo/platform-kernel';
5
- import './errors.cjs';
6
- import './types-Cokyqgwm.cjs';
3
+ export { f as CapxulAuthConfig, C as CapxulClient, g as CapxulConfig, h as CapxulDataClient, i as CapxulFlowFactories, j as CapxulSigningConfig, y as createCapxulClient } from './client-D-0KTn8D.cjs';
4
+ import './next-action-DkrwXYay.cjs';
5
+ import './errors-GgKrSUKp.cjs';
6
+ import './types-DVWojoy4.cjs';
7
7
  import '@repo/api-contract/gen/types';
package/dist/client.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import 'viem';
2
2
  import 'xstate';
3
- export { f as CapxulAuthConfig, C as CapxulClient, g as CapxulConfig, h as CapxulDataClient, i as CapxulFlowFactories, j as CapxulSigningConfig, y as createCapxulClient } from './client-o4R-ZFh2.js';
4
- import '@repo/platform-kernel';
5
- import './errors.js';
6
- import './types-Cokyqgwm.js';
3
+ export { f as CapxulAuthConfig, C as CapxulClient, g as CapxulConfig, h as CapxulDataClient, i as CapxulFlowFactories, j as CapxulSigningConfig, y as createCapxulClient } from './client-CweJSkaY.js';
4
+ import './next-action-DkrwXYay.js';
5
+ import './errors-QHD5Tlok.js';
6
+ import './types-75UokagF.js';
7
7
  import '@repo/api-contract/gen/types';
@@ -0,0 +1,70 @@
1
+ import { N as NextAction, O as OperationId, C as CorrelationId } from './next-action-DkrwXYay.cjs';
2
+
3
+ type CapxulErrorCode = "NOT_AUTHENTICATED" | "EMAIL_DELIVERY_FAILED" | "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" | "UNKNOWN" | "PERMISSION_DENIED" | "API_KEY_INVALID" | "API_KEY_EXPIRED" | "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";
4
+ type CapxulErrorDetails = Record<string, unknown> & {
5
+ nextAction?: NextAction;
6
+ };
7
+ type CapxulErrorEnvelope = {
8
+ error: {
9
+ code: CapxulErrorCode;
10
+ message: string;
11
+ operationId?: OperationId;
12
+ correlationId?: CorrelationId;
13
+ retryable?: boolean;
14
+ details?: CapxulErrorDetails;
15
+ };
16
+ };
17
+
18
+ /**
19
+ * Unified error class surfaced by every SDK method.
20
+ *
21
+ * Parameterized on `Codes` so individual method signatures can narrow
22
+ * to the subset of `CapxulErrorCode` they actually produce (per
23
+ * CANON.md §4.39 + §4.44 + sdk-surface.md §3a). The default
24
+ * `Codes = CapxulErrorCode` is the global catalog from
25
+ * `@repo/platform-kernel` — 34 values aligned with the wire
26
+ * `ErrorEnvelope.error.code` enum.
27
+ */
28
+ declare class CapxulError<Codes extends CapxulErrorCode = CapxulErrorCode> extends Error {
29
+ readonly code: Codes;
30
+ readonly details?: CapxulErrorDetails;
31
+ readonly operationId?: OperationId;
32
+ readonly correlationId?: CorrelationId;
33
+ readonly retryable?: boolean;
34
+ constructor(init: {
35
+ code: Codes;
36
+ message: string;
37
+ cause?: unknown;
38
+ details?: CapxulErrorDetails;
39
+ operationId?: OperationId;
40
+ correlationId?: CorrelationId;
41
+ retryable?: boolean;
42
+ });
43
+ }
44
+ /**
45
+ * Direct tuple-return shape per CANON.md §4.39: every SDK mutation or
46
+ * read returns `[null, value]` on success or `[CapxulError<Codes>, null]`
47
+ * on failure. The tuple is `readonly` so callers can destructure
48
+ * without worrying about mutation.
49
+ */
50
+ type CapxulResult<T, Codes extends CapxulErrorCode = CapxulErrorCode> = readonly [null, T] | readonly [CapxulError<Codes>, null];
51
+ /**
52
+ * Internal helper. Returns a concrete `CapxulError<"NOT_IMPLEMENTED">`
53
+ * suitable for `throw` from non-tuple surfaces (e.g. `verifyWebhook`).
54
+ */
55
+ declare function notImplemented(method: string): CapxulError<"NOT_IMPLEMENTED">;
56
+ /**
57
+ * Scaffold-only stub helper for every tuple-return SDK method. Returns
58
+ * the failed tuple `[CapxulError<Codes>, null]` carrying a
59
+ * `NOT_IMPLEMENTED` error.
60
+ *
61
+ * The `as CapxulError<Codes>` cast is intentionally unsound: runtime
62
+ * `code` is `"NOT_IMPLEMENTED"` even though the method's narrowed
63
+ * `Codes` union may not list it. This goes away in Slice F when real
64
+ * HTTP bodies replace every call site. Until then, callers shouldn't
65
+ * switch on the runtime `code` inside tests — the scaffold's contract
66
+ * is strictly type-level.
67
+ */
68
+ declare function stub<T, Codes extends CapxulErrorCode = CapxulErrorCode>(method: string): CapxulResult<T, Codes>;
69
+
70
+ export { CapxulError as C, type CapxulErrorCode as a, type CapxulErrorDetails as b, type CapxulErrorEnvelope as c, type CapxulResult as d, notImplemented as n, stub as s };
@@ -0,0 +1,70 @@
1
+ import { N as NextAction, O as OperationId, C as CorrelationId } from './next-action-DkrwXYay.js';
2
+
3
+ type CapxulErrorCode = "NOT_AUTHENTICATED" | "EMAIL_DELIVERY_FAILED" | "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" | "UNKNOWN" | "PERMISSION_DENIED" | "API_KEY_INVALID" | "API_KEY_EXPIRED" | "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";
4
+ type CapxulErrorDetails = Record<string, unknown> & {
5
+ nextAction?: NextAction;
6
+ };
7
+ type CapxulErrorEnvelope = {
8
+ error: {
9
+ code: CapxulErrorCode;
10
+ message: string;
11
+ operationId?: OperationId;
12
+ correlationId?: CorrelationId;
13
+ retryable?: boolean;
14
+ details?: CapxulErrorDetails;
15
+ };
16
+ };
17
+
18
+ /**
19
+ * Unified error class surfaced by every SDK method.
20
+ *
21
+ * Parameterized on `Codes` so individual method signatures can narrow
22
+ * to the subset of `CapxulErrorCode` they actually produce (per
23
+ * CANON.md §4.39 + §4.44 + sdk-surface.md §3a). The default
24
+ * `Codes = CapxulErrorCode` is the global catalog from
25
+ * `@repo/platform-kernel` — 34 values aligned with the wire
26
+ * `ErrorEnvelope.error.code` enum.
27
+ */
28
+ declare class CapxulError<Codes extends CapxulErrorCode = CapxulErrorCode> extends Error {
29
+ readonly code: Codes;
30
+ readonly details?: CapxulErrorDetails;
31
+ readonly operationId?: OperationId;
32
+ readonly correlationId?: CorrelationId;
33
+ readonly retryable?: boolean;
34
+ constructor(init: {
35
+ code: Codes;
36
+ message: string;
37
+ cause?: unknown;
38
+ details?: CapxulErrorDetails;
39
+ operationId?: OperationId;
40
+ correlationId?: CorrelationId;
41
+ retryable?: boolean;
42
+ });
43
+ }
44
+ /**
45
+ * Direct tuple-return shape per CANON.md §4.39: every SDK mutation or
46
+ * read returns `[null, value]` on success or `[CapxulError<Codes>, null]`
47
+ * on failure. The tuple is `readonly` so callers can destructure
48
+ * without worrying about mutation.
49
+ */
50
+ type CapxulResult<T, Codes extends CapxulErrorCode = CapxulErrorCode> = readonly [null, T] | readonly [CapxulError<Codes>, null];
51
+ /**
52
+ * Internal helper. Returns a concrete `CapxulError<"NOT_IMPLEMENTED">`
53
+ * suitable for `throw` from non-tuple surfaces (e.g. `verifyWebhook`).
54
+ */
55
+ declare function notImplemented(method: string): CapxulError<"NOT_IMPLEMENTED">;
56
+ /**
57
+ * Scaffold-only stub helper for every tuple-return SDK method. Returns
58
+ * the failed tuple `[CapxulError<Codes>, null]` carrying a
59
+ * `NOT_IMPLEMENTED` error.
60
+ *
61
+ * The `as CapxulError<Codes>` cast is intentionally unsound: runtime
62
+ * `code` is `"NOT_IMPLEMENTED"` even though the method's narrowed
63
+ * `Codes` union may not list it. This goes away in Slice F when real
64
+ * HTTP bodies replace every call site. Until then, callers shouldn't
65
+ * switch on the runtime `code` inside tests — the scaffold's contract
66
+ * is strictly type-level.
67
+ */
68
+ declare function stub<T, Codes extends CapxulErrorCode = CapxulErrorCode>(method: string): CapxulResult<T, Codes>;
69
+
70
+ export { CapxulError as C, type CapxulErrorCode as a, type CapxulErrorDetails as b, type CapxulErrorEnvelope as c, type CapxulResult as d, notImplemented as n, stub as s };
package/dist/errors.d.cts CHANGED
@@ -1,55 +1,2 @@
1
- import { CapxulErrorCode, CapxulErrorDetails, OperationId, CorrelationId } from '@repo/platform-kernel';
2
-
3
- /**
4
- * Unified error class surfaced by every SDK method.
5
- *
6
- * Parameterized on `Codes` so individual method signatures can narrow
7
- * to the subset of `CapxulErrorCode` they actually produce (per
8
- * CANON.md §4.39 + §4.44 + sdk-surface.md §3a). The default
9
- * `Codes = CapxulErrorCode` is the global catalog from
10
- * `@repo/platform-kernel` — 34 values aligned with the wire
11
- * `ErrorEnvelope.error.code` enum.
12
- */
13
- declare class CapxulError<Codes extends CapxulErrorCode = CapxulErrorCode> extends Error {
14
- readonly code: Codes;
15
- readonly details?: CapxulErrorDetails;
16
- readonly operationId?: OperationId;
17
- readonly correlationId?: CorrelationId;
18
- readonly retryable?: boolean;
19
- constructor(init: {
20
- code: Codes;
21
- message: string;
22
- cause?: unknown;
23
- details?: CapxulErrorDetails;
24
- operationId?: OperationId;
25
- correlationId?: CorrelationId;
26
- retryable?: boolean;
27
- });
28
- }
29
- /**
30
- * Direct tuple-return shape per CANON.md §4.39: every SDK mutation or
31
- * read returns `[null, value]` on success or `[CapxulError<Codes>, null]`
32
- * on failure. The tuple is `readonly` so callers can destructure
33
- * without worrying about mutation.
34
- */
35
- type CapxulResult<T, Codes extends CapxulErrorCode = CapxulErrorCode> = readonly [null, T] | readonly [CapxulError<Codes>, null];
36
- /**
37
- * Internal helper. Returns a concrete `CapxulError<"NOT_IMPLEMENTED">`
38
- * suitable for `throw` from non-tuple surfaces (e.g. `verifyWebhook`).
39
- */
40
- declare function notImplemented(method: string): CapxulError<"NOT_IMPLEMENTED">;
41
- /**
42
- * Scaffold-only stub helper for every tuple-return SDK method. Returns
43
- * the failed tuple `[CapxulError<Codes>, null]` carrying a
44
- * `NOT_IMPLEMENTED` error.
45
- *
46
- * The `as CapxulError<Codes>` cast is intentionally unsound: runtime
47
- * `code` is `"NOT_IMPLEMENTED"` even though the method's narrowed
48
- * `Codes` union may not list it. This goes away in Slice F when real
49
- * HTTP bodies replace every call site. Until then, callers shouldn't
50
- * switch on the runtime `code` inside tests — the scaffold's contract
51
- * is strictly type-level.
52
- */
53
- declare function stub<T, Codes extends CapxulErrorCode = CapxulErrorCode>(method: string): CapxulResult<T, Codes>;
54
-
55
- export { CapxulError, type CapxulResult, notImplemented, stub };
1
+ import './next-action-DkrwXYay.cjs';
2
+ export { C as CapxulError, d as CapxulResult, n as notImplemented, s as stub } from './errors-GgKrSUKp.cjs';
package/dist/errors.d.ts CHANGED
@@ -1,55 +1,2 @@
1
- import { CapxulErrorCode, CapxulErrorDetails, OperationId, CorrelationId } from '@repo/platform-kernel';
2
-
3
- /**
4
- * Unified error class surfaced by every SDK method.
5
- *
6
- * Parameterized on `Codes` so individual method signatures can narrow
7
- * to the subset of `CapxulErrorCode` they actually produce (per
8
- * CANON.md §4.39 + §4.44 + sdk-surface.md §3a). The default
9
- * `Codes = CapxulErrorCode` is the global catalog from
10
- * `@repo/platform-kernel` — 34 values aligned with the wire
11
- * `ErrorEnvelope.error.code` enum.
12
- */
13
- declare class CapxulError<Codes extends CapxulErrorCode = CapxulErrorCode> extends Error {
14
- readonly code: Codes;
15
- readonly details?: CapxulErrorDetails;
16
- readonly operationId?: OperationId;
17
- readonly correlationId?: CorrelationId;
18
- readonly retryable?: boolean;
19
- constructor(init: {
20
- code: Codes;
21
- message: string;
22
- cause?: unknown;
23
- details?: CapxulErrorDetails;
24
- operationId?: OperationId;
25
- correlationId?: CorrelationId;
26
- retryable?: boolean;
27
- });
28
- }
29
- /**
30
- * Direct tuple-return shape per CANON.md §4.39: every SDK mutation or
31
- * read returns `[null, value]` on success or `[CapxulError<Codes>, null]`
32
- * on failure. The tuple is `readonly` so callers can destructure
33
- * without worrying about mutation.
34
- */
35
- type CapxulResult<T, Codes extends CapxulErrorCode = CapxulErrorCode> = readonly [null, T] | readonly [CapxulError<Codes>, null];
36
- /**
37
- * Internal helper. Returns a concrete `CapxulError<"NOT_IMPLEMENTED">`
38
- * suitable for `throw` from non-tuple surfaces (e.g. `verifyWebhook`).
39
- */
40
- declare function notImplemented(method: string): CapxulError<"NOT_IMPLEMENTED">;
41
- /**
42
- * Scaffold-only stub helper for every tuple-return SDK method. Returns
43
- * the failed tuple `[CapxulError<Codes>, null]` carrying a
44
- * `NOT_IMPLEMENTED` error.
45
- *
46
- * The `as CapxulError<Codes>` cast is intentionally unsound: runtime
47
- * `code` is `"NOT_IMPLEMENTED"` even though the method's narrowed
48
- * `Codes` union may not list it. This goes away in Slice F when real
49
- * HTTP bodies replace every call site. Until then, callers shouldn't
50
- * switch on the runtime `code` inside tests — the scaffold's contract
51
- * is strictly type-level.
52
- */
53
- declare function stub<T, Codes extends CapxulErrorCode = CapxulErrorCode>(method: string): CapxulResult<T, Codes>;
54
-
55
- export { CapxulError, type CapxulResult, notImplemented, stub };
1
+ import './next-action-DkrwXYay.js';
2
+ export { C as CapxulError, d as CapxulResult, n as notImplemented, s as stub } from './errors-QHD5Tlok.js';
package/dist/index.d.cts CHANGED
@@ -1,17 +1,37 @@
1
- import { S as Session, C as CapxulClient, A as AccountProvisionPersonalInput } from './client-BNGGubL2.cjs';
2
- export { a as AccountsClient, b as ApiKeyCreateResult, c as ApiKeysClient, d as AuthClient, e as AuthSessionStore, B as BrowserCapxulConfig, f as CapxulAuthConfig, g as CapxulConfig, h as CapxulDataClient, i as CapxulFlowFactories, j as CapxulSigningConfig, D as DocumentsClient, E as ExternalAccountsClient, H as HttpTransport, L as LocalPrivateKeySignerProvider, M as MeClient, O as OperationsClient, k as OrgDocumentsClient, l as OrgPaymentsClient, m as OrgSafesClient, n as OrgTransfersClient, o as OrgTreasuryClient, p as OrgWithdrawalsClient, q as OrganizationsClient, P as PaymentsClient, r as SubAccountsClient, T as TransfersClient, s as TransportRuntime, t as TransportState, V as VirtualAccountsClient, u as VirtualCardsClient, W as WebhookEndpointCreateResult, v as WebhookEndpointsClient, w as WebhookEventsClient, x as WithdrawalsClient, y as createCapxulClient, z as makeHttpTransport } from './client-BNGGubL2.cjs';
1
+ import { S as Session, C as CapxulClient, A as AccountProvisionPersonalInput } from './client-D-0KTn8D.cjs';
2
+ export { a as AccountsClient, b as ApiKeyCreateResult, c as ApiKeysClient, d as AuthClient, e as AuthSessionStore, B as BrowserCapxulConfig, f as CapxulAuthConfig, g as CapxulConfig, h as CapxulDataClient, i as CapxulFlowFactories, j as CapxulSigningConfig, D as DocumentsClient, E as ExternalAccountsClient, H as HttpTransport, L as LocalPrivateKeySignerProvider, M as MeClient, O as OperationsClient, k as OrgDocumentsClient, l as OrgPaymentsClient, m as OrgSafesClient, n as OrgTransfersClient, o as OrgTreasuryClient, p as OrgWithdrawalsClient, q as OrganizationsClient, P as PaymentsClient, r as SubAccountsClient, T as TransfersClient, s as TransportRuntime, t as TransportState, V as VirtualAccountsClient, u as VirtualCardsClient, W as WebhookEndpointCreateResult, v as WebhookEndpointsClient, w as WebhookEventsClient, x as WithdrawalsClient, y as createCapxulClient, z as makeHttpTransport } from './client-D-0KTn8D.cjs';
3
3
  import * as xstate from 'xstate';
4
- import { CapxulError as CapxulError$1 } from '@repo/config';
5
- import { Email, Username, OperationId, NextAction, CapxulErrorCode } from '@repo/platform-kernel';
6
- export { AccountId, ApiKeyId, BalanceLedgerEntryId, CapxulErrorCode, CapxulErrorDetails, CapxulErrorEnvelope, CorrelationId, DocumentId, Email, ExternalAccountId, KybProfileId, KycProfileId, MemberId, NextAction, OperationId, OrganizationId, PaymentId, PhoneNumber, SafeId, SubAccountId, TransactionIntentId, TransferId, TreasuryId, Username, VirtualAccountId, VirtualCardId, WebhookEndpointId, WebhookEventId, WithdrawalId, toAccountId, toApiKeyId, toBalanceLedgerEntryId, toDocumentId, toEmail, toExternalAccountId, toKybProfileId, toKycProfileId, toMemberId, toOperationId, toOrganizationId, toPaymentId, toPhoneNumber, toSafeId, toSubAccountId, toTransferId, toTreasuryId, toUsername, toVirtualAccountId, toVirtualCardId, toWebhookEndpointId, toWebhookEventId, toWithdrawalId } from '@repo/platform-kernel';
7
- import { CapxulError } from './errors.cjs';
8
- export { CapxulResult } from './errors.cjs';
9
- import { A as Account } from './types-Cokyqgwm.cjs';
10
- export { a as AccountLookupResult, b as ApiKey, c as ApiKeyEnvironment, d as ApiKeyType, B as BalanceLedgerEntry, e as BankStatementDocument, C as CreatePaymentResult, f as CreateTransferResult, g as CreateWithdrawalResult, D as Document, E as ExternalAccount, h as ExternalAccountKind, I as InvoiceDocument, K as KybProfile, i as KycProfile, j as KycUploadDocument, L as List, M as Member, k as Money, O as Operation, l as OperationStatus, m as OperationSummary, n as Organization, P as PageInfo, o as Payment, p as PaymentParty, q as PaymentStatus, r as PayrollRunDocument, s as PayrollScheduleDocument, R as ReceiptDocument, S as Safe, t as Scope, u as Settlement, v as SubAccount, w as SubAccountOwnerKind, T as TaxFormDocument, x as TimestampIso, y as Transfer, z as TransferCustody, F as TransferEndpoint, G as TransferFx, H as TransferStatus, J as Treasury, U as UserIdentifier, V as VirtualAccount, N as VirtualAccountOwnerKind, Q as VirtualCard, W as VirtualCardLimits, X as VirtualCardOwnerKind, Y as WebhookEndpoint, Z as WebhookEvent, _ as Withdrawal, $ as WithdrawalStatus } from './types-Cokyqgwm.cjs';
4
+ import { E as Email, U as Username, O as OperationId, N as NextAction } from './next-action-DkrwXYay.cjs';
5
+ export { A as AccountId, a as ApiKeyId, B as BalanceLedgerEntryId, C as CorrelationId, D as DocumentId, b as ExternalAccountId, K as KybProfileId, c as KycProfileId, M as MemberId, d as OrganizationId, P as PaymentId, e as PhoneNumber, S as SafeId, f as SubAccountId, T as TransactionIntentId, g as TransferId, h as TreasuryId, V as VirtualAccountId, i as VirtualCardId, W as WebhookEndpointId, j as WebhookEventId, k as WithdrawalId, t as toAccountId, l as toApiKeyId, m as toBalanceLedgerEntryId, n as toDocumentId, o as toEmail, p as toExternalAccountId, q as toKybProfileId, r as toKycProfileId, s as toMemberId, u as toOperationId, v as toOrganizationId, w as toPaymentId, x as toPhoneNumber, y as toSafeId, z as toSubAccountId, F as toTransferId, G as toTreasuryId, H as toUsername, I as toVirtualAccountId, J as toVirtualCardId, L as toWebhookEndpointId, Q as toWebhookEventId, R as toWithdrawalId } from './next-action-DkrwXYay.cjs';
6
+ import { C as CapxulError$1, a as CapxulErrorCode$1 } from './errors-GgKrSUKp.cjs';
7
+ export { b as CapxulErrorDetails, c as CapxulErrorEnvelope, d as CapxulResult } from './errors-GgKrSUKp.cjs';
8
+ import { A as Account } from './types-DVWojoy4.cjs';
9
+ export { a as AccountLookupResult, b as ApiKey, c as ApiKeyEnvironment, d as ApiKeyType, B as BalanceLedgerEntry, e as BankStatementDocument, C as CreatePaymentResult, f as CreateTransferResult, g as CreateWithdrawalResult, D as Document, E as ExternalAccount, h as ExternalAccountKind, I as InvoiceDocument, K as KybProfile, i as KycProfile, j as KycUploadDocument, L as List, M as Member, k as Money, O as Operation, l as OperationStatus, m as OperationSummary, n as Organization, P as PageInfo, o as Payment, p as PaymentParty, q as PaymentStatus, r as PayrollRunDocument, s as PayrollScheduleDocument, R as ReceiptDocument, S as Safe, t as Scope, u as Settlement, v as SubAccount, w as SubAccountOwnerKind, T as TaxFormDocument, x as TimestampIso, y as Transfer, z as TransferCustody, F as TransferEndpoint, G as TransferFx, H as TransferStatus, J as Treasury, U as UserIdentifier, V as VirtualAccount, N as VirtualAccountOwnerKind, Q as VirtualCard, W as VirtualCardLimits, X as VirtualCardOwnerKind, Y as WebhookEndpoint, Z as WebhookEvent, _ as Withdrawal, $ as WithdrawalStatus } from './types-DVWojoy4.cjs';
11
10
  import { Account as Account$1 } from 'viem';
12
11
  export { WebhookVerificationOptions, WebhookVerificationResult, verifyWebhook } from './webhooks.cjs';
13
12
  import '@repo/api-contract/gen/types';
14
13
 
14
+ /**
15
+ * Unified error type used across the entire stack: backend, SDK, and frontend.
16
+ * One class, one set of codes, one language.
17
+ *
18
+ * Backend throws CapxulError → withErrorBoundary serializes to ConvexError →
19
+ * SDK deserializes back to CapxulError → frontend routes on err.code.
20
+ */
21
+ 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" | "UNKNOWN";
22
+ declare class CapxulError extends Error {
23
+ readonly code: CapxulErrorCode;
24
+ readonly details?: Record<string, unknown>;
25
+ readonly correlationId?: string;
26
+ readonly layer?: string;
27
+ constructor(code: CapxulErrorCode, message: string, options?: {
28
+ cause?: unknown;
29
+ details?: Record<string, unknown>;
30
+ correlationId?: string;
31
+ layer?: string;
32
+ });
33
+ }
34
+
15
35
  /**
16
36
  * Auth flow errors may originate from two CapxulError surfaces:
17
37
  * - the SDK-local generic `CapxulError<Codes>` returned by
@@ -23,7 +43,7 @@ import '@repo/api-contract/gen/types';
23
43
  * union keeps either origin assignable to `context.error` without an
24
44
  * `as` cast at the call site.
25
45
  */
26
- type AuthFlowError = CapxulError | CapxulError$1;
46
+ type AuthFlowError = CapxulError$1 | CapxulError;
27
47
  type AuthFlowContext = {
28
48
  readonly email: Email | null;
29
49
  readonly session: Session | null;
@@ -122,7 +142,7 @@ declare function createAuthFlowMachine(client: CapxulClient): xstate.StateMachin
122
142
  *
123
143
  * Both share `.code`, `.message`, `.details`, and extend `Error`.
124
144
  */
125
- type ProvisioningFlowError = CapxulError | CapxulError$1;
145
+ type ProvisioningFlowError = CapxulError$1 | CapxulError;
126
146
  type ProvisioningFlowContext = {
127
147
  readonly input: AccountProvisionPersonalInput | null;
128
148
  readonly account: Account | null;
@@ -229,7 +249,7 @@ declare function createProvisioningMachine(client: CapxulClient): xstate.StateMa
229
249
  *
230
250
  * Both share `.code`, `.message`, `.details`, and extend `Error`.
231
251
  */
232
- type OnboardingFlowError = CapxulError | CapxulError$1;
252
+ type OnboardingFlowError = CapxulError$1 | CapxulError;
233
253
  /** Subjects supported by the onboarding flow. */
234
254
  type OnboardingSubjectKind = "account" | "organization";
235
255
  /**
@@ -442,8 +462,8 @@ declare function createOnboardingFlowMachine(client: CapxulClient): xstate.State
442
462
  * No `default:` arm needed — the compile-time exhaustiveness check is
443
463
  * the contract.
444
464
  */
445
- declare function matchError<Codes extends CapxulErrorCode, R>(err: CapxulError<Codes>, handlers: {
446
- [K in Codes]: (err: CapxulError<K>) => R;
465
+ declare function matchError<Codes extends CapxulErrorCode$1, R>(err: CapxulError$1<Codes>, handlers: {
466
+ [K in Codes]: (err: CapxulError$1<K>) => R;
447
467
  }): R;
448
468
  /**
449
469
  * Exhaustive resource-status dispatch per CANON.md §4.44.
@@ -492,4 +512,4 @@ declare function matchAction<A extends NextAction, R>(action: A, handlers: {
492
512
  */
493
513
  declare function createLocalSigner(privateKey: `0x${string}`): Account$1;
494
514
 
495
- export { Account, AccountProvisionPersonalInput, type AuthFlowContext, type AuthFlowError, type AuthFlowEvent, CapxulClient, CapxulError, type OnboardingFlowContext, type OnboardingFlowError, type OnboardingFlowEvent, type OnboardingProfileInput, type OnboardingSubjectKind, type ProvisioningFlowContext, type ProvisioningFlowError, type ProvisioningFlowEvent, type ProvisioningFlowInput, type ProvisioningFlowOutput, Session, createAuthFlowMachine, createLocalSigner, createOnboardingFlowMachine, createProvisioningMachine as createProvisioningFlowMachine, matchAction, matchError, matchStatus };
515
+ export { Account, AccountProvisionPersonalInput, type AuthFlowContext, type AuthFlowError, type AuthFlowEvent, CapxulClient, CapxulError$1 as CapxulError, CapxulErrorCode$1 as CapxulErrorCode, Email, NextAction, type OnboardingFlowContext, type OnboardingFlowError, type OnboardingFlowEvent, type OnboardingProfileInput, type OnboardingSubjectKind, OperationId, type ProvisioningFlowContext, type ProvisioningFlowError, type ProvisioningFlowEvent, type ProvisioningFlowInput, type ProvisioningFlowOutput, Session, Username, createAuthFlowMachine, createLocalSigner, createOnboardingFlowMachine, createProvisioningMachine as createProvisioningFlowMachine, matchAction, matchError, matchStatus };
package/dist/index.d.ts CHANGED
@@ -1,17 +1,37 @@
1
- import { S as Session, C as CapxulClient, A as AccountProvisionPersonalInput } from './client-o4R-ZFh2.js';
2
- export { a as AccountsClient, b as ApiKeyCreateResult, c as ApiKeysClient, d as AuthClient, e as AuthSessionStore, B as BrowserCapxulConfig, f as CapxulAuthConfig, g as CapxulConfig, h as CapxulDataClient, i as CapxulFlowFactories, j as CapxulSigningConfig, D as DocumentsClient, E as ExternalAccountsClient, H as HttpTransport, L as LocalPrivateKeySignerProvider, M as MeClient, O as OperationsClient, k as OrgDocumentsClient, l as OrgPaymentsClient, m as OrgSafesClient, n as OrgTransfersClient, o as OrgTreasuryClient, p as OrgWithdrawalsClient, q as OrganizationsClient, P as PaymentsClient, r as SubAccountsClient, T as TransfersClient, s as TransportRuntime, t as TransportState, V as VirtualAccountsClient, u as VirtualCardsClient, W as WebhookEndpointCreateResult, v as WebhookEndpointsClient, w as WebhookEventsClient, x as WithdrawalsClient, y as createCapxulClient, z as makeHttpTransport } from './client-o4R-ZFh2.js';
1
+ import { S as Session, C as CapxulClient, A as AccountProvisionPersonalInput } from './client-CweJSkaY.js';
2
+ export { a as AccountsClient, b as ApiKeyCreateResult, c as ApiKeysClient, d as AuthClient, e as AuthSessionStore, B as BrowserCapxulConfig, f as CapxulAuthConfig, g as CapxulConfig, h as CapxulDataClient, i as CapxulFlowFactories, j as CapxulSigningConfig, D as DocumentsClient, E as ExternalAccountsClient, H as HttpTransport, L as LocalPrivateKeySignerProvider, M as MeClient, O as OperationsClient, k as OrgDocumentsClient, l as OrgPaymentsClient, m as OrgSafesClient, n as OrgTransfersClient, o as OrgTreasuryClient, p as OrgWithdrawalsClient, q as OrganizationsClient, P as PaymentsClient, r as SubAccountsClient, T as TransfersClient, s as TransportRuntime, t as TransportState, V as VirtualAccountsClient, u as VirtualCardsClient, W as WebhookEndpointCreateResult, v as WebhookEndpointsClient, w as WebhookEventsClient, x as WithdrawalsClient, y as createCapxulClient, z as makeHttpTransport } from './client-CweJSkaY.js';
3
3
  import * as xstate from 'xstate';
4
- import { CapxulError as CapxulError$1 } from '@repo/config';
5
- import { Email, Username, OperationId, NextAction, CapxulErrorCode } from '@repo/platform-kernel';
6
- export { AccountId, ApiKeyId, BalanceLedgerEntryId, CapxulErrorCode, CapxulErrorDetails, CapxulErrorEnvelope, CorrelationId, DocumentId, Email, ExternalAccountId, KybProfileId, KycProfileId, MemberId, NextAction, OperationId, OrganizationId, PaymentId, PhoneNumber, SafeId, SubAccountId, TransactionIntentId, TransferId, TreasuryId, Username, VirtualAccountId, VirtualCardId, WebhookEndpointId, WebhookEventId, WithdrawalId, toAccountId, toApiKeyId, toBalanceLedgerEntryId, toDocumentId, toEmail, toExternalAccountId, toKybProfileId, toKycProfileId, toMemberId, toOperationId, toOrganizationId, toPaymentId, toPhoneNumber, toSafeId, toSubAccountId, toTransferId, toTreasuryId, toUsername, toVirtualAccountId, toVirtualCardId, toWebhookEndpointId, toWebhookEventId, toWithdrawalId } from '@repo/platform-kernel';
7
- import { CapxulError } from './errors.js';
8
- export { CapxulResult } from './errors.js';
9
- import { A as Account } from './types-Cokyqgwm.js';
10
- export { a as AccountLookupResult, b as ApiKey, c as ApiKeyEnvironment, d as ApiKeyType, B as BalanceLedgerEntry, e as BankStatementDocument, C as CreatePaymentResult, f as CreateTransferResult, g as CreateWithdrawalResult, D as Document, E as ExternalAccount, h as ExternalAccountKind, I as InvoiceDocument, K as KybProfile, i as KycProfile, j as KycUploadDocument, L as List, M as Member, k as Money, O as Operation, l as OperationStatus, m as OperationSummary, n as Organization, P as PageInfo, o as Payment, p as PaymentParty, q as PaymentStatus, r as PayrollRunDocument, s as PayrollScheduleDocument, R as ReceiptDocument, S as Safe, t as Scope, u as Settlement, v as SubAccount, w as SubAccountOwnerKind, T as TaxFormDocument, x as TimestampIso, y as Transfer, z as TransferCustody, F as TransferEndpoint, G as TransferFx, H as TransferStatus, J as Treasury, U as UserIdentifier, V as VirtualAccount, N as VirtualAccountOwnerKind, Q as VirtualCard, W as VirtualCardLimits, X as VirtualCardOwnerKind, Y as WebhookEndpoint, Z as WebhookEvent, _ as Withdrawal, $ as WithdrawalStatus } from './types-Cokyqgwm.js';
4
+ import { E as Email, U as Username, O as OperationId, N as NextAction } from './next-action-DkrwXYay.js';
5
+ export { A as AccountId, a as ApiKeyId, B as BalanceLedgerEntryId, C as CorrelationId, D as DocumentId, b as ExternalAccountId, K as KybProfileId, c as KycProfileId, M as MemberId, d as OrganizationId, P as PaymentId, e as PhoneNumber, S as SafeId, f as SubAccountId, T as TransactionIntentId, g as TransferId, h as TreasuryId, V as VirtualAccountId, i as VirtualCardId, W as WebhookEndpointId, j as WebhookEventId, k as WithdrawalId, t as toAccountId, l as toApiKeyId, m as toBalanceLedgerEntryId, n as toDocumentId, o as toEmail, p as toExternalAccountId, q as toKybProfileId, r as toKycProfileId, s as toMemberId, u as toOperationId, v as toOrganizationId, w as toPaymentId, x as toPhoneNumber, y as toSafeId, z as toSubAccountId, F as toTransferId, G as toTreasuryId, H as toUsername, I as toVirtualAccountId, J as toVirtualCardId, L as toWebhookEndpointId, Q as toWebhookEventId, R as toWithdrawalId } from './next-action-DkrwXYay.js';
6
+ import { C as CapxulError$1, a as CapxulErrorCode$1 } from './errors-QHD5Tlok.js';
7
+ export { b as CapxulErrorDetails, c as CapxulErrorEnvelope, d as CapxulResult } from './errors-QHD5Tlok.js';
8
+ import { A as Account } from './types-75UokagF.js';
9
+ export { a as AccountLookupResult, b as ApiKey, c as ApiKeyEnvironment, d as ApiKeyType, B as BalanceLedgerEntry, e as BankStatementDocument, C as CreatePaymentResult, f as CreateTransferResult, g as CreateWithdrawalResult, D as Document, E as ExternalAccount, h as ExternalAccountKind, I as InvoiceDocument, K as KybProfile, i as KycProfile, j as KycUploadDocument, L as List, M as Member, k as Money, O as Operation, l as OperationStatus, m as OperationSummary, n as Organization, P as PageInfo, o as Payment, p as PaymentParty, q as PaymentStatus, r as PayrollRunDocument, s as PayrollScheduleDocument, R as ReceiptDocument, S as Safe, t as Scope, u as Settlement, v as SubAccount, w as SubAccountOwnerKind, T as TaxFormDocument, x as TimestampIso, y as Transfer, z as TransferCustody, F as TransferEndpoint, G as TransferFx, H as TransferStatus, J as Treasury, U as UserIdentifier, V as VirtualAccount, N as VirtualAccountOwnerKind, Q as VirtualCard, W as VirtualCardLimits, X as VirtualCardOwnerKind, Y as WebhookEndpoint, Z as WebhookEvent, _ as Withdrawal, $ as WithdrawalStatus } from './types-75UokagF.js';
11
10
  import { Account as Account$1 } from 'viem';
12
11
  export { WebhookVerificationOptions, WebhookVerificationResult, verifyWebhook } from './webhooks.js';
13
12
  import '@repo/api-contract/gen/types';
14
13
 
14
+ /**
15
+ * Unified error type used across the entire stack: backend, SDK, and frontend.
16
+ * One class, one set of codes, one language.
17
+ *
18
+ * Backend throws CapxulError → withErrorBoundary serializes to ConvexError →
19
+ * SDK deserializes back to CapxulError → frontend routes on err.code.
20
+ */
21
+ 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" | "UNKNOWN";
22
+ declare class CapxulError extends Error {
23
+ readonly code: CapxulErrorCode;
24
+ readonly details?: Record<string, unknown>;
25
+ readonly correlationId?: string;
26
+ readonly layer?: string;
27
+ constructor(code: CapxulErrorCode, message: string, options?: {
28
+ cause?: unknown;
29
+ details?: Record<string, unknown>;
30
+ correlationId?: string;
31
+ layer?: string;
32
+ });
33
+ }
34
+
15
35
  /**
16
36
  * Auth flow errors may originate from two CapxulError surfaces:
17
37
  * - the SDK-local generic `CapxulError<Codes>` returned by
@@ -23,7 +43,7 @@ import '@repo/api-contract/gen/types';
23
43
  * union keeps either origin assignable to `context.error` without an
24
44
  * `as` cast at the call site.
25
45
  */
26
- type AuthFlowError = CapxulError | CapxulError$1;
46
+ type AuthFlowError = CapxulError$1 | CapxulError;
27
47
  type AuthFlowContext = {
28
48
  readonly email: Email | null;
29
49
  readonly session: Session | null;
@@ -122,7 +142,7 @@ declare function createAuthFlowMachine(client: CapxulClient): xstate.StateMachin
122
142
  *
123
143
  * Both share `.code`, `.message`, `.details`, and extend `Error`.
124
144
  */
125
- type ProvisioningFlowError = CapxulError | CapxulError$1;
145
+ type ProvisioningFlowError = CapxulError$1 | CapxulError;
126
146
  type ProvisioningFlowContext = {
127
147
  readonly input: AccountProvisionPersonalInput | null;
128
148
  readonly account: Account | null;
@@ -229,7 +249,7 @@ declare function createProvisioningMachine(client: CapxulClient): xstate.StateMa
229
249
  *
230
250
  * Both share `.code`, `.message`, `.details`, and extend `Error`.
231
251
  */
232
- type OnboardingFlowError = CapxulError | CapxulError$1;
252
+ type OnboardingFlowError = CapxulError$1 | CapxulError;
233
253
  /** Subjects supported by the onboarding flow. */
234
254
  type OnboardingSubjectKind = "account" | "organization";
235
255
  /**
@@ -442,8 +462,8 @@ declare function createOnboardingFlowMachine(client: CapxulClient): xstate.State
442
462
  * No `default:` arm needed — the compile-time exhaustiveness check is
443
463
  * the contract.
444
464
  */
445
- declare function matchError<Codes extends CapxulErrorCode, R>(err: CapxulError<Codes>, handlers: {
446
- [K in Codes]: (err: CapxulError<K>) => R;
465
+ declare function matchError<Codes extends CapxulErrorCode$1, R>(err: CapxulError$1<Codes>, handlers: {
466
+ [K in Codes]: (err: CapxulError$1<K>) => R;
447
467
  }): R;
448
468
  /**
449
469
  * Exhaustive resource-status dispatch per CANON.md §4.44.
@@ -492,4 +512,4 @@ declare function matchAction<A extends NextAction, R>(action: A, handlers: {
492
512
  */
493
513
  declare function createLocalSigner(privateKey: `0x${string}`): Account$1;
494
514
 
495
- export { Account, AccountProvisionPersonalInput, type AuthFlowContext, type AuthFlowError, type AuthFlowEvent, CapxulClient, CapxulError, type OnboardingFlowContext, type OnboardingFlowError, type OnboardingFlowEvent, type OnboardingProfileInput, type OnboardingSubjectKind, type ProvisioningFlowContext, type ProvisioningFlowError, type ProvisioningFlowEvent, type ProvisioningFlowInput, type ProvisioningFlowOutput, Session, createAuthFlowMachine, createLocalSigner, createOnboardingFlowMachine, createProvisioningMachine as createProvisioningFlowMachine, matchAction, matchError, matchStatus };
515
+ export { Account, AccountProvisionPersonalInput, type AuthFlowContext, type AuthFlowError, type AuthFlowEvent, CapxulClient, CapxulError$1 as CapxulError, CapxulErrorCode$1 as CapxulErrorCode, Email, NextAction, type OnboardingFlowContext, type OnboardingFlowError, type OnboardingFlowEvent, type OnboardingProfileInput, type OnboardingSubjectKind, OperationId, type ProvisioningFlowContext, type ProvisioningFlowError, type ProvisioningFlowEvent, type ProvisioningFlowInput, type ProvisioningFlowOutput, Session, Username, createAuthFlowMachine, createLocalSigner, createOnboardingFlowMachine, createProvisioningMachine as createProvisioningFlowMachine, matchAction, matchError, matchStatus };
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Branded ID types for every public Capxul resource.
3
+ *
4
+ * Every branded value MUST be created via the `to*()` constructor
5
+ * exported alongside its type — direct casts (`raw as AccountId`) are
6
+ * forbidden by `.claude/rules/typescript-style.md`. Constructors
7
+ * validate the prefix pattern and throw on mismatch.
8
+ *
9
+ * Brand regime per `CANON.md` §A1+A2 lock (2026-04-19): the kernel
10
+ * keeps its own `IdBrand<Name>` + `PrefixedId<Prefix, Name>` pattern
11
+ * (independent of `@repo/types`, which was designed around earlier
12
+ * Convex-typed SDK IDs) so the restart stack stays the brand canon.
13
+ */
14
+ type IdBrand<Name extends string> = string & {
15
+ readonly __capxulIdBrand: Name;
16
+ };
17
+ type PrefixedId<Prefix extends string, Name extends string> = `${Prefix}_${string}` & IdBrand<Name>;
18
+ type AccountId = PrefixedId<"acct", "AccountId">;
19
+ declare const toAccountId: (raw: string) => PrefixedId<"acct", "AccountId">;
20
+ type OrganizationId = PrefixedId<"org", "OrganizationId">;
21
+ declare const toOrganizationId: (raw: string) => PrefixedId<"org", "OrganizationId">;
22
+ type MemberId = PrefixedId<"mem", "MemberId">;
23
+ declare const toMemberId: (raw: string) => PrefixedId<"mem", "MemberId">;
24
+ type SafeId = PrefixedId<"safe", "SafeId">;
25
+ declare const toSafeId: (raw: string) => PrefixedId<"safe", "SafeId">;
26
+ type TreasuryId = PrefixedId<"try", "TreasuryId">;
27
+ declare const toTreasuryId: (raw: string) => PrefixedId<"try", "TreasuryId">;
28
+ type ApiKeyId = PrefixedId<"ak", "ApiKeyId">;
29
+ declare const toApiKeyId: (raw: string) => PrefixedId<"ak", "ApiKeyId">;
30
+ type ServiceAccountId = PrefixedId<"svc", "ServiceAccountId">;
31
+ type OperationId = PrefixedId<"op", "OperationId">;
32
+ declare const toOperationId: (raw: string) => PrefixedId<"op", "OperationId">;
33
+ type CorrelationId = PrefixedId<"ctx", "CorrelationId">;
34
+ type KycProfileId = PrefixedId<"kyc", "KycProfileId">;
35
+ declare const toKycProfileId: (raw: string) => PrefixedId<"kyc", "KycProfileId">;
36
+ type KybProfileId = PrefixedId<"kyb", "KybProfileId">;
37
+ declare const toKybProfileId: (raw: string) => PrefixedId<"kyb", "KybProfileId">;
38
+ type PayrollEntryId = PrefixedId<"pe", "PayrollEntryId">;
39
+ type ExternalAccountId = PrefixedId<"ext", "ExternalAccountId">;
40
+ declare const toExternalAccountId: (raw: string) => PrefixedId<"ext", "ExternalAccountId">;
41
+ type PaymentId = PrefixedId<"pay", "PaymentId">;
42
+ declare const toPaymentId: (raw: string) => PrefixedId<"pay", "PaymentId">;
43
+ type InvoiceId = PrefixedId<"inv", "InvoiceId">;
44
+ type WithdrawalId = PrefixedId<"wd", "WithdrawalId">;
45
+ declare const toWithdrawalId: (raw: string) => PrefixedId<"wd", "WithdrawalId">;
46
+ type WebhookEndpointId = PrefixedId<"we", "WebhookEndpointId">;
47
+ declare const toWebhookEndpointId: (raw: string) => PrefixedId<"we", "WebhookEndpointId">;
48
+ type WebhookEventId = PrefixedId<"evt", "WebhookEventId">;
49
+ declare const toWebhookEventId: (raw: string) => PrefixedId<"evt", "WebhookEventId">;
50
+ type OutboxMessageId = PrefixedId<"out", "OutboxMessageId">;
51
+ type Cursor = PrefixedId<"cur", "Cursor">;
52
+ type TransactionIntentId = PrefixedId<"ti", "TransactionIntentId">;
53
+ type SubAccountId = PrefixedId<"sub", "SubAccountId">;
54
+ declare const toSubAccountId: (raw: string) => PrefixedId<"sub", "SubAccountId">;
55
+ type VirtualAccountId = PrefixedId<"va", "VirtualAccountId">;
56
+ declare const toVirtualAccountId: (raw: string) => PrefixedId<"va", "VirtualAccountId">;
57
+ type VirtualCardId = PrefixedId<"vc", "VirtualCardId">;
58
+ declare const toVirtualCardId: (raw: string) => PrefixedId<"vc", "VirtualCardId">;
59
+ type TransferId = PrefixedId<"txfr", "TransferId">;
60
+ declare const toTransferId: (raw: string) => PrefixedId<"txfr", "TransferId">;
61
+ type DocumentId = PrefixedId<"doc", "DocumentId">;
62
+ declare const toDocumentId: (raw: string) => PrefixedId<"doc", "DocumentId">;
63
+ type BalanceLedgerEntryId = PrefixedId<"bal", "BalanceLedgerEntryId">;
64
+ declare const toBalanceLedgerEntryId: (raw: string) => PrefixedId<"bal", "BalanceLedgerEntryId">;
65
+ type PublicId = AccountId | OrganizationId | MemberId | SafeId | TreasuryId | ApiKeyId | ServiceAccountId | OperationId | CorrelationId | KycProfileId | KybProfileId | PayrollEntryId | ExternalAccountId | PaymentId | InvoiceId | WithdrawalId | WebhookEndpointId | WebhookEventId | OutboxMessageId | Cursor | TransactionIntentId | SubAccountId | VirtualAccountId | VirtualCardId | TransferId | DocumentId | BalanceLedgerEntryId;
66
+
67
+ type Money = {
68
+ value: string;
69
+ currency: string;
70
+ };
71
+ type WalletFundingDestination = {
72
+ kind: "wallet_address";
73
+ address: string;
74
+ chain?: string;
75
+ };
76
+ type LinkedInstrumentFundingDestination = {
77
+ kind: "linked_instrument";
78
+ instrumentId: ExternalAccountId;
79
+ };
80
+ type ProviderInstructionFundingDestination = {
81
+ kind: "provider_instruction";
82
+ instructionId: string;
83
+ };
84
+ type FundingDestination = WalletFundingDestination | LinkedInstrumentFundingDestination | ProviderInstructionFundingDestination;
85
+ type TimestampIso = string;
86
+ /**
87
+ * E.164-validated international phone number. Brand prevents swapping
88
+ * with `email`, `username`, or other string identifiers (per `CANON.md`
89
+ * §4.54 and `sdk-surface.md` §5h).
90
+ */
91
+ type PhoneNumber = string & {
92
+ readonly __capxulPhoneBrand: "PhoneNumber";
93
+ };
94
+ /** Validate and brand an E.164 phone number. Throws on invalid input. */
95
+ declare function toPhoneNumber(raw: string): PhoneNumber;
96
+ /**
97
+ * Lowercased, shape-validated email address. Brand prevents swapping
98
+ * with `phoneNumber`, `username`, or other string identifiers (per
99
+ * `CANON.md` §4.54 and `sdk-surface.md` §5h).
100
+ */
101
+ type Email = string & {
102
+ readonly __capxulEmailBrand: "Email";
103
+ };
104
+ /** Validate, lowercase, and brand an email. Throws on invalid input. */
105
+ declare function toEmail(raw: string): Email;
106
+ /**
107
+ * Public Capxul username. 3–30 chars, letter-first, lowercased,
108
+ * remaining chars from `[a-z0-9_-]` (per `CANON.md` §4.54 and
109
+ * `sdk-surface.md` §5h). Constructor lowercases before validating so
110
+ * mixed-case input canonicalizes cleanly when the first char is a
111
+ * letter; purely invalid shapes (too short, illegal chars, digit-first)
112
+ * still throw.
113
+ */
114
+ type Username = string & {
115
+ readonly __capxulUsernameBrand: "Username";
116
+ };
117
+ /** Validate, lowercase, and brand a username. Throws on invalid input. */
118
+ declare function toUsername(raw: string): Username;
119
+
120
+ /**
121
+ * Discriminated union of action-required pauses. See
122
+ * `/docs/internal/reset/conventions` §6 for the variant
123
+ * catalog and the "Inline vs thrown" rule (Rule D).
124
+ *
125
+ * §4.54 refined the `fix_destination` payload with a reason enum and
126
+ * optional recipient metadata. §4.58 added the 9th variant
127
+ * `confirm_fx_quote` for the cross-custody transfer FX-commit flow.
128
+ */
129
+ type NextAction = {
130
+ kind: "complete_kyc";
131
+ url?: string;
132
+ expiresAt?: TimestampIso;
133
+ } | {
134
+ kind: "complete_kyb";
135
+ url?: string;
136
+ embedToken?: string;
137
+ expiresAt?: TimestampIso;
138
+ } | {
139
+ kind: "approve_transaction";
140
+ intentId: TransactionIntentId;
141
+ url?: string;
142
+ } | {
143
+ kind: "send_funds";
144
+ amount: Money;
145
+ destination: FundingDestination;
146
+ } | {
147
+ kind: "follow_redirect";
148
+ url: string;
149
+ expiresAt?: TimestampIso;
150
+ } | {
151
+ kind: "provide_otp";
152
+ channel?: "email" | "sms" | "provider";
153
+ } | {
154
+ kind: "fix_destination";
155
+ reason: "recipient_not_yet_capxul_user" | "recipient_unreachable_email" | "destination_kyc_blocked" | "invalid_format";
156
+ recipient?: {
157
+ email?: Email;
158
+ phone?: PhoneNumber;
159
+ username?: Username;
160
+ invitationSentAt?: TimestampIso;
161
+ invitationExpiresAt?: TimestampIso;
162
+ signupUrl?: string;
163
+ };
164
+ } | {
165
+ kind: "contact_support";
166
+ reason: string;
167
+ } | {
168
+ kind: "confirm_fx_quote";
169
+ quoteId: string;
170
+ rate: string;
171
+ sourceAmount: Money;
172
+ creditAmount: Money;
173
+ fees?: Money;
174
+ expiresAt: TimestampIso;
175
+ };
176
+
177
+ export { type AccountId as A, type BalanceLedgerEntryId as B, type CorrelationId as C, type DocumentId as D, type Email as E, toTransferId as F, toTreasuryId as G, toUsername as H, toVirtualAccountId as I, toVirtualCardId as J, type KybProfileId as K, toWebhookEndpointId as L, type MemberId as M, type NextAction as N, type OperationId as O, type PaymentId as P, toWebhookEventId as Q, toWithdrawalId as R, type SafeId as S, type TransactionIntentId as T, type Username as U, type VirtualAccountId as V, type WebhookEndpointId as W, type TimestampIso as X, type PublicId as Y, type ApiKeyId as a, type ExternalAccountId as b, type KycProfileId as c, type OrganizationId as d, type PhoneNumber as e, type SubAccountId as f, type TransferId as g, type TreasuryId as h, type VirtualCardId as i, type WebhookEventId as j, type WithdrawalId as k, toApiKeyId as l, toBalanceLedgerEntryId as m, toDocumentId as n, toEmail as o, toExternalAccountId as p, toKybProfileId as q, toKycProfileId as r, toMemberId as s, toAccountId as t, toOperationId as u, toOrganizationId as v, toPaymentId as w, toPhoneNumber as x, toSafeId as y, toSubAccountId as z };
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Branded ID types for every public Capxul resource.
3
+ *
4
+ * Every branded value MUST be created via the `to*()` constructor
5
+ * exported alongside its type — direct casts (`raw as AccountId`) are
6
+ * forbidden by `.claude/rules/typescript-style.md`. Constructors
7
+ * validate the prefix pattern and throw on mismatch.
8
+ *
9
+ * Brand regime per `CANON.md` §A1+A2 lock (2026-04-19): the kernel
10
+ * keeps its own `IdBrand<Name>` + `PrefixedId<Prefix, Name>` pattern
11
+ * (independent of `@repo/types`, which was designed around earlier
12
+ * Convex-typed SDK IDs) so the restart stack stays the brand canon.
13
+ */
14
+ type IdBrand<Name extends string> = string & {
15
+ readonly __capxulIdBrand: Name;
16
+ };
17
+ type PrefixedId<Prefix extends string, Name extends string> = `${Prefix}_${string}` & IdBrand<Name>;
18
+ type AccountId = PrefixedId<"acct", "AccountId">;
19
+ declare const toAccountId: (raw: string) => PrefixedId<"acct", "AccountId">;
20
+ type OrganizationId = PrefixedId<"org", "OrganizationId">;
21
+ declare const toOrganizationId: (raw: string) => PrefixedId<"org", "OrganizationId">;
22
+ type MemberId = PrefixedId<"mem", "MemberId">;
23
+ declare const toMemberId: (raw: string) => PrefixedId<"mem", "MemberId">;
24
+ type SafeId = PrefixedId<"safe", "SafeId">;
25
+ declare const toSafeId: (raw: string) => PrefixedId<"safe", "SafeId">;
26
+ type TreasuryId = PrefixedId<"try", "TreasuryId">;
27
+ declare const toTreasuryId: (raw: string) => PrefixedId<"try", "TreasuryId">;
28
+ type ApiKeyId = PrefixedId<"ak", "ApiKeyId">;
29
+ declare const toApiKeyId: (raw: string) => PrefixedId<"ak", "ApiKeyId">;
30
+ type ServiceAccountId = PrefixedId<"svc", "ServiceAccountId">;
31
+ type OperationId = PrefixedId<"op", "OperationId">;
32
+ declare const toOperationId: (raw: string) => PrefixedId<"op", "OperationId">;
33
+ type CorrelationId = PrefixedId<"ctx", "CorrelationId">;
34
+ type KycProfileId = PrefixedId<"kyc", "KycProfileId">;
35
+ declare const toKycProfileId: (raw: string) => PrefixedId<"kyc", "KycProfileId">;
36
+ type KybProfileId = PrefixedId<"kyb", "KybProfileId">;
37
+ declare const toKybProfileId: (raw: string) => PrefixedId<"kyb", "KybProfileId">;
38
+ type PayrollEntryId = PrefixedId<"pe", "PayrollEntryId">;
39
+ type ExternalAccountId = PrefixedId<"ext", "ExternalAccountId">;
40
+ declare const toExternalAccountId: (raw: string) => PrefixedId<"ext", "ExternalAccountId">;
41
+ type PaymentId = PrefixedId<"pay", "PaymentId">;
42
+ declare const toPaymentId: (raw: string) => PrefixedId<"pay", "PaymentId">;
43
+ type InvoiceId = PrefixedId<"inv", "InvoiceId">;
44
+ type WithdrawalId = PrefixedId<"wd", "WithdrawalId">;
45
+ declare const toWithdrawalId: (raw: string) => PrefixedId<"wd", "WithdrawalId">;
46
+ type WebhookEndpointId = PrefixedId<"we", "WebhookEndpointId">;
47
+ declare const toWebhookEndpointId: (raw: string) => PrefixedId<"we", "WebhookEndpointId">;
48
+ type WebhookEventId = PrefixedId<"evt", "WebhookEventId">;
49
+ declare const toWebhookEventId: (raw: string) => PrefixedId<"evt", "WebhookEventId">;
50
+ type OutboxMessageId = PrefixedId<"out", "OutboxMessageId">;
51
+ type Cursor = PrefixedId<"cur", "Cursor">;
52
+ type TransactionIntentId = PrefixedId<"ti", "TransactionIntentId">;
53
+ type SubAccountId = PrefixedId<"sub", "SubAccountId">;
54
+ declare const toSubAccountId: (raw: string) => PrefixedId<"sub", "SubAccountId">;
55
+ type VirtualAccountId = PrefixedId<"va", "VirtualAccountId">;
56
+ declare const toVirtualAccountId: (raw: string) => PrefixedId<"va", "VirtualAccountId">;
57
+ type VirtualCardId = PrefixedId<"vc", "VirtualCardId">;
58
+ declare const toVirtualCardId: (raw: string) => PrefixedId<"vc", "VirtualCardId">;
59
+ type TransferId = PrefixedId<"txfr", "TransferId">;
60
+ declare const toTransferId: (raw: string) => PrefixedId<"txfr", "TransferId">;
61
+ type DocumentId = PrefixedId<"doc", "DocumentId">;
62
+ declare const toDocumentId: (raw: string) => PrefixedId<"doc", "DocumentId">;
63
+ type BalanceLedgerEntryId = PrefixedId<"bal", "BalanceLedgerEntryId">;
64
+ declare const toBalanceLedgerEntryId: (raw: string) => PrefixedId<"bal", "BalanceLedgerEntryId">;
65
+ type PublicId = AccountId | OrganizationId | MemberId | SafeId | TreasuryId | ApiKeyId | ServiceAccountId | OperationId | CorrelationId | KycProfileId | KybProfileId | PayrollEntryId | ExternalAccountId | PaymentId | InvoiceId | WithdrawalId | WebhookEndpointId | WebhookEventId | OutboxMessageId | Cursor | TransactionIntentId | SubAccountId | VirtualAccountId | VirtualCardId | TransferId | DocumentId | BalanceLedgerEntryId;
66
+
67
+ type Money = {
68
+ value: string;
69
+ currency: string;
70
+ };
71
+ type WalletFundingDestination = {
72
+ kind: "wallet_address";
73
+ address: string;
74
+ chain?: string;
75
+ };
76
+ type LinkedInstrumentFundingDestination = {
77
+ kind: "linked_instrument";
78
+ instrumentId: ExternalAccountId;
79
+ };
80
+ type ProviderInstructionFundingDestination = {
81
+ kind: "provider_instruction";
82
+ instructionId: string;
83
+ };
84
+ type FundingDestination = WalletFundingDestination | LinkedInstrumentFundingDestination | ProviderInstructionFundingDestination;
85
+ type TimestampIso = string;
86
+ /**
87
+ * E.164-validated international phone number. Brand prevents swapping
88
+ * with `email`, `username`, or other string identifiers (per `CANON.md`
89
+ * §4.54 and `sdk-surface.md` §5h).
90
+ */
91
+ type PhoneNumber = string & {
92
+ readonly __capxulPhoneBrand: "PhoneNumber";
93
+ };
94
+ /** Validate and brand an E.164 phone number. Throws on invalid input. */
95
+ declare function toPhoneNumber(raw: string): PhoneNumber;
96
+ /**
97
+ * Lowercased, shape-validated email address. Brand prevents swapping
98
+ * with `phoneNumber`, `username`, or other string identifiers (per
99
+ * `CANON.md` §4.54 and `sdk-surface.md` §5h).
100
+ */
101
+ type Email = string & {
102
+ readonly __capxulEmailBrand: "Email";
103
+ };
104
+ /** Validate, lowercase, and brand an email. Throws on invalid input. */
105
+ declare function toEmail(raw: string): Email;
106
+ /**
107
+ * Public Capxul username. 3–30 chars, letter-first, lowercased,
108
+ * remaining chars from `[a-z0-9_-]` (per `CANON.md` §4.54 and
109
+ * `sdk-surface.md` §5h). Constructor lowercases before validating so
110
+ * mixed-case input canonicalizes cleanly when the first char is a
111
+ * letter; purely invalid shapes (too short, illegal chars, digit-first)
112
+ * still throw.
113
+ */
114
+ type Username = string & {
115
+ readonly __capxulUsernameBrand: "Username";
116
+ };
117
+ /** Validate, lowercase, and brand a username. Throws on invalid input. */
118
+ declare function toUsername(raw: string): Username;
119
+
120
+ /**
121
+ * Discriminated union of action-required pauses. See
122
+ * `/docs/internal/reset/conventions` §6 for the variant
123
+ * catalog and the "Inline vs thrown" rule (Rule D).
124
+ *
125
+ * §4.54 refined the `fix_destination` payload with a reason enum and
126
+ * optional recipient metadata. §4.58 added the 9th variant
127
+ * `confirm_fx_quote` for the cross-custody transfer FX-commit flow.
128
+ */
129
+ type NextAction = {
130
+ kind: "complete_kyc";
131
+ url?: string;
132
+ expiresAt?: TimestampIso;
133
+ } | {
134
+ kind: "complete_kyb";
135
+ url?: string;
136
+ embedToken?: string;
137
+ expiresAt?: TimestampIso;
138
+ } | {
139
+ kind: "approve_transaction";
140
+ intentId: TransactionIntentId;
141
+ url?: string;
142
+ } | {
143
+ kind: "send_funds";
144
+ amount: Money;
145
+ destination: FundingDestination;
146
+ } | {
147
+ kind: "follow_redirect";
148
+ url: string;
149
+ expiresAt?: TimestampIso;
150
+ } | {
151
+ kind: "provide_otp";
152
+ channel?: "email" | "sms" | "provider";
153
+ } | {
154
+ kind: "fix_destination";
155
+ reason: "recipient_not_yet_capxul_user" | "recipient_unreachable_email" | "destination_kyc_blocked" | "invalid_format";
156
+ recipient?: {
157
+ email?: Email;
158
+ phone?: PhoneNumber;
159
+ username?: Username;
160
+ invitationSentAt?: TimestampIso;
161
+ invitationExpiresAt?: TimestampIso;
162
+ signupUrl?: string;
163
+ };
164
+ } | {
165
+ kind: "contact_support";
166
+ reason: string;
167
+ } | {
168
+ kind: "confirm_fx_quote";
169
+ quoteId: string;
170
+ rate: string;
171
+ sourceAmount: Money;
172
+ creditAmount: Money;
173
+ fees?: Money;
174
+ expiresAt: TimestampIso;
175
+ };
176
+
177
+ export { type AccountId as A, type BalanceLedgerEntryId as B, type CorrelationId as C, type DocumentId as D, type Email as E, toTransferId as F, toTreasuryId as G, toUsername as H, toVirtualAccountId as I, toVirtualCardId as J, type KybProfileId as K, toWebhookEndpointId as L, type MemberId as M, type NextAction as N, type OperationId as O, type PaymentId as P, toWebhookEventId as Q, toWithdrawalId as R, type SafeId as S, type TransactionIntentId as T, type Username as U, type VirtualAccountId as V, type WebhookEndpointId as W, type TimestampIso as X, type PublicId as Y, type ApiKeyId as a, type ExternalAccountId as b, type KycProfileId as c, type OrganizationId as d, type PhoneNumber as e, type SubAccountId as f, type TransferId as g, type TreasuryId as h, type VirtualCardId as i, type WebhookEventId as j, type WithdrawalId as k, toApiKeyId as l, toBalanceLedgerEntryId as m, toDocumentId as n, toEmail as o, toExternalAccountId as p, toKybProfileId as q, toKycProfileId as r, toMemberId as s, toAccountId as t, toOperationId as u, toOrganizationId as v, toPaymentId as w, toPhoneNumber as x, toSafeId as y, toSubAccountId as z };
@@ -1,5 +1,5 @@
1
1
  import * as types from '@repo/api-contract/gen/types';
2
- import { PublicId, AccountId, SafeId, OrganizationId, KycProfileId, ExternalAccountId, SubAccountId, BalanceLedgerEntryId, ApiKeyId, TreasuryId, MemberId, KybProfileId, NextAction, PaymentId, TransferId, WithdrawalId, DocumentId, WebhookEndpointId, WebhookEventId, VirtualAccountId, VirtualCardId, OperationId, CorrelationId } from '@repo/platform-kernel';
2
+ import { Y as PublicId, A as AccountId, S as SafeId, d as OrganizationId, c as KycProfileId, b as ExternalAccountId, f as SubAccountId, B as BalanceLedgerEntryId, a as ApiKeyId, h as TreasuryId, M as MemberId, K as KybProfileId, N as NextAction, P as PaymentId, g as TransferId, k as WithdrawalId, D as DocumentId, W as WebhookEndpointId, j as WebhookEventId, V as VirtualAccountId, i as VirtualCardId, O as OperationId, C as CorrelationId } from './next-action-DkrwXYay.js';
3
3
 
4
4
  /**
5
5
  * SDK surface types.
@@ -1,5 +1,5 @@
1
1
  import * as types from '@repo/api-contract/gen/types';
2
- import { PublicId, AccountId, SafeId, OrganizationId, KycProfileId, ExternalAccountId, SubAccountId, BalanceLedgerEntryId, ApiKeyId, TreasuryId, MemberId, KybProfileId, NextAction, PaymentId, TransferId, WithdrawalId, DocumentId, WebhookEndpointId, WebhookEventId, VirtualAccountId, VirtualCardId, OperationId, CorrelationId } from '@repo/platform-kernel';
2
+ import { Y as PublicId, A as AccountId, S as SafeId, d as OrganizationId, c as KycProfileId, b as ExternalAccountId, f as SubAccountId, B as BalanceLedgerEntryId, a as ApiKeyId, h as TreasuryId, M as MemberId, K as KybProfileId, N as NextAction, P as PaymentId, g as TransferId, k as WithdrawalId, D as DocumentId, W as WebhookEndpointId, j as WebhookEventId, V as VirtualAccountId, i as VirtualCardId, O as OperationId, C as CorrelationId } from './next-action-DkrwXYay.cjs';
3
3
 
4
4
  /**
5
5
  * SDK surface types.
@@ -1,6 +1,6 @@
1
- import { Z as WebhookEvent } from './types-Cokyqgwm.cjs';
1
+ import { Z as WebhookEvent } from './types-DVWojoy4.cjs';
2
2
  import '@repo/api-contract/gen/types';
3
- import '@repo/platform-kernel';
3
+ import './next-action-DkrwXYay.cjs';
4
4
 
5
5
  /**
6
6
  * Webhook verification primitive per CANON.md §4.41 +
@@ -1,6 +1,6 @@
1
- import { Z as WebhookEvent } from './types-Cokyqgwm.js';
1
+ import { Z as WebhookEvent } from './types-75UokagF.js';
2
2
  import '@repo/api-contract/gen/types';
3
- import '@repo/platform-kernel';
3
+ import './next-action-DkrwXYay.js';
4
4
 
5
5
  /**
6
6
  * Webhook verification primitive per CANON.md §4.41 +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sdk",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.0-alpha.2",
4
4
  "description": "Headless TypeScript client for Capxul's /v1/* HTTP contract.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -55,14 +55,10 @@
55
55
  "access": "public"
56
56
  },
57
57
  "dependencies": {
58
- "xstate": "^5",
59
- "@repo/api-contract": "0.0.0",
60
- "@repo/backend": "0.0.0",
61
- "@repo/config": "0.0.0",
62
- "@repo/observability": "0.0.0",
63
- "@repo/platform-kernel": "0.0.0"
58
+ "xstate": "^5"
64
59
  },
65
60
  "peerDependencies": {
61
+ "convex": ">=1.0.0",
66
62
  "permissionless": ">=0.3.4 <0.4.0",
67
63
  "viem": ">=2.0.0"
68
64
  },
@@ -74,6 +70,11 @@
74
70
  "viem": "2.47.10",
75
71
  "vitest": "^4.1.2",
76
72
  "zod": "^4.3.6",
73
+ "@repo/api-contract": "0.0.0",
74
+ "@repo/backend": "0.0.0",
75
+ "@repo/config": "0.0.0",
76
+ "@repo/observability": "0.0.0",
77
+ "@repo/platform-kernel": "0.0.0",
77
78
  "@repo/typescript-config": "0.0.0"
78
79
  },
79
80
  "scripts": {