@capxul/sdk 2.1.1 → 2.3.0
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/README.md +24 -0
- package/dist/{InMemoryAuthCacheAdapter-Rc8tCtml.mjs → InMemoryAuthCacheAdapter-qMpBOGb3.mjs} +15 -2
- package/dist/{create-capxul-client-CPhTPz_9.mjs → create-capxul-client-mArFr_Os.mjs} +675 -532
- package/dist/index.d.mts +25 -64
- package/dist/index.mjs +260 -103
- package/dist/node/index.d.mts +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/{create-capxul-client-BI-6Za6X.d.mts → observation-Ci8gIQjm.d.mts} +193 -20
- package/dist/{signer-Bj4F-RwT.d.mts → signer-BejoR3bA.d.mts} +116 -1
- package/dist/testing/index.d.mts +3 -1
- package/dist/testing/index.mjs +4 -3
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as
|
|
1
|
+
import { $ as toAddress, C as Address, H as PartyId, J as RoleKey, N as CountryCode, O as AuthSession, S as AccountId, V as OrgId, a as SignerStatusStore, at as Errors, c as AccountProviderSource, ct as isCapxulError, d as eip1193AccountProvider, et as toCountryCode, f as localPrivateKeyAccountProvider, g as SmartAccount, h as Session, i as SignerStatus, it as CapxulErrorDetails, j as BudgetId, k as AuthUserId, l as AccountRequirement, m as Profile, n as CapxulSigner, nt as CapxulError, o as injectedWalletSigner, p as CapxulResult, r as Eip1193RequestProvider, rt as CapxulErrorCode, s as AccountProvider, st as FailureMode, t as CapxulDigestSigner, tt as CAPXUL_ERROR_CODES, u as Eip1193Provider, x as Account, z as Money } from "./signer-BejoR3bA.mjs";
|
|
2
|
+
import { $ as AccountMethods, $t as RecipientResolution, A as OrganizationAccount, An as isClaimed, At as FinancialOpsMethods, B as PermissionAssignInput, Bt as Payment, C as InviteMemberInput, Cn as Destination$1, Ct as DestinationAddInput, D as OrgScopedMethods, Dn as Readiness, Dt as DestinationRail, E as OrgMethods, En as OrgLane, Et as DestinationPayload, F as RoleView, Ft as OfframpQuote, G as PermissionReplaceInput, Gt as PaymentDocumentVerification, H as PermissionCreateInput, Ht as PaymentDocumentKind, I as OrganizationPaymentBatchInput, It as OfframpQuoteInput, J as Budget, Jt as PaymentStatus, K as PermissionRevokeInput, Kt as PaymentDocumentsMethods, L as OrganizationPaymentInput, Lt as OfframpStatus, M as ResendInviteTokenInput, Mn as IdentityTransition, Mt as MeMethods, N as RoleDefinition, Nn as InvocationControls, Nt as MeProfile, O as OrgTemplate, On as StateLabel, Ot as DestinationRemoveInput, P as RoleSpendCap, Pt as OfframpMethods, Q as AccountsMethods, Qt as PaymentsPayInput, R as OrganizationPaymentItemInput, Rt as Payee, S as DetectPendingOrgInvitationsResult, Sn as CAPXUL_PAYMENTS_V2_ADDRESS, St as Destination, T as MemberView, Tn as IdentityState, Tt as DestinationListInput, U as PermissionMethods, Ut as PaymentDocumentRef, V as PermissionChangeInput, Vt as PaymentDirection, W as PermissionOptions, Wt as PaymentDocumentRender, X as OrgMeMethod, Xt as PaymentType, Y as OrgMe, Yt as PaymentTiming, Z as OrgMeOptions, Zt as PaymentsMethods, _ as SystemHealth, _n as SubmittedPermissionExecution, _t as ActivityMethods, a as SdkFailureObservation, an as fingerprintPaymentIntent, at as ActorRequestsMethods, b as CurrentUserMethods, bt as ActorReference, c as PostHogObservabilityOptions, cn as isSettingUpLifecycle, ct as AddressBookLabelInput, d as CreateCapxulClientInput, dn as AuthMethods, dt as InboxItem, en as RecipientResolutionKind, et as ActorProfile, f as IdentityProfileDetails, fn as OrgLifecycle, ft as InboxMethods, g as SystemMethods, gn as Permission, gt as ActivityListParams, h as HoldingsMethods, hn as MovementAnnotation, ht as ActivityItem, i as ObservationDelivery, in as TargetsMethods, it as ActorRequestIssueInput, j as OrganizationAuditLogItem, jn as isRestoring, jt as HandlesMethods, k as OrgView, kn as destination, kt as DestinationsMethods, l as postHogObservability, ln as IdentityMethods, lt as AddressBookMethods, m as IdentityRuntimeSendResult, mn as CurrentHoldings, mt as ActivityDetail, n as ObservationAdapter, nn as ResolvedTarget, nt as ActorRelationshipMethods, o as HostObservability, on as AccountLifecycle, ot as AddressBookAddInput, p as IdentityRuntime, pn as OrgSetupStep, pt as ActivityAnnotationInput, q as PermissionReadResult, qt as PaymentMoney, r as ObservationContext, rn as TargetReference, rt as ActorRequest, s as PostHogObservabilityClient, sn as AccountSetupStep, st as AddressBookEntry, t as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, tn as Ref, tt as ActorProfileMethods, u as CapxulClient, un as SmartAccountMethods, ut as InboxApproveInput, v as MediaMethods, vt as ActivityPage, w as MemberStatus, wn as IdentityEvent, wt as DestinationKind, x as CreateOrgInput, xn as TelemetryPort, xt as DepositInstructions, y as CurrentUserContext, yt as ActivityReference, z as OrganizationPaymentsMethods, zt as PayeesMethods } from "./observation-Ci8gIQjm.mjs";
|
|
3
3
|
import { Hex } from "viem";
|
|
4
4
|
import { Context, Effect, Layer } from "effect";
|
|
5
5
|
import { FunctionReference } from "convex/server";
|
|
6
6
|
|
|
7
|
+
//#region src/domain/money/format-money.d.ts
|
|
8
|
+
declare function formatMoney(money: Money, options?: {
|
|
9
|
+
readonly grammar?: "symbol" | "code";
|
|
10
|
+
}): string;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/domain/money/parse-money.d.ts
|
|
13
|
+
type MoneyParseErrorReason = "required" | "too-long" | "invalid-format" | "non-positive" | "too-many-decimals";
|
|
14
|
+
interface MoneyParseError {
|
|
15
|
+
readonly kind: "error";
|
|
16
|
+
readonly reason: MoneyParseErrorReason;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* ADR-0023 R1: the reason is a closed code and the ONLY failure vocabulary —
|
|
20
|
+
* the consuming app maps each code to its own sentence. The SDK ships no
|
|
21
|
+
* English for user-text failure.
|
|
22
|
+
*/
|
|
23
|
+
declare function isMoneyParseError(value: Money | MoneyParseError): value is MoneyParseError;
|
|
24
|
+
declare function parseMoney(input: string, asset: Pick<Money, "currency" | "decimals">): Money | MoneyParseError;
|
|
25
|
+
//#endregion
|
|
7
26
|
//#region src/adapters/auth-cache/BrowserAuthCacheAdapter.d.ts
|
|
8
27
|
interface BrowserStorageShape {
|
|
9
28
|
getItem(key: string): string | null;
|
|
@@ -86,65 +105,6 @@ declare function openfortEmbeddedSigner(input: OpenfortEmbeddedSignerInput): Ope
|
|
|
86
105
|
*/
|
|
87
106
|
declare const embeddedSigner: typeof openfortEmbeddedSigner;
|
|
88
107
|
//#endregion
|
|
89
|
-
//#region src/host-observability.d.ts
|
|
90
|
-
/** One host-owned observability module at the SDK consumer boundary. */
|
|
91
|
-
interface HostObservability {
|
|
92
|
-
readonly failures: ObservationAdapter;
|
|
93
|
-
readonly product: TelemetryPort;
|
|
94
|
-
}
|
|
95
|
-
interface PostHogObservabilityClient {
|
|
96
|
-
capture(event: string, properties?: Readonly<Record<string, unknown>>): unknown;
|
|
97
|
-
captureException?(exception: Error, properties?: Readonly<Record<string, unknown>>): unknown;
|
|
98
|
-
identify?(distinctId: string, properties?: Readonly<Record<string, unknown>>): unknown;
|
|
99
|
-
group?(groupType: string, groupKey: string, properties?: Readonly<Record<string, unknown>>): unknown;
|
|
100
|
-
reset?(): unknown;
|
|
101
|
-
}
|
|
102
|
-
interface PostHogObservabilityOptions {
|
|
103
|
-
/** Consent / kill-switch seam. Defaults to enabled. */
|
|
104
|
-
readonly enabled?: boolean | (() => boolean);
|
|
105
|
-
/** Host environment stamped on every SDK-owned product event. */
|
|
106
|
-
readonly capxulEnv?: CapxulEnv;
|
|
107
|
-
/** Host-owned correlation context shared by product and failure delivery. */
|
|
108
|
-
readonly context?: ObservationContext | (() => ObservationContext | undefined);
|
|
109
|
-
}
|
|
110
|
-
/** Build the SDK's one host module around an already-initialized PostHog client. */
|
|
111
|
-
declare function postHogObservability(client: PostHogObservabilityClient | null | undefined, options?: PostHogObservabilityOptions): HostObservability;
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region src/observation.d.ts
|
|
114
|
-
/** Host-owned correlation fields that are safe to attach to an SDK failure. */
|
|
115
|
-
interface ObservationContext extends Omit<WireObservationContext, "applicationId"> {}
|
|
116
|
-
/**
|
|
117
|
-
* The small, SDK-owned failure envelope delivered to observation adapters.
|
|
118
|
-
* Method arguments, response bodies, wallet payloads, and arbitrary error
|
|
119
|
-
* details are deliberately absent.
|
|
120
|
-
*/
|
|
121
|
-
interface SdkFailureObservation {
|
|
122
|
-
readonly exception: Error;
|
|
123
|
-
readonly sdkVersion: string;
|
|
124
|
-
readonly operation: string;
|
|
125
|
-
readonly errorKind: string;
|
|
126
|
-
/** Invocation snapshot; failure correlation wins over later host state. */
|
|
127
|
-
readonly context?: ObservationContext;
|
|
128
|
-
}
|
|
129
|
-
type ObservationDelivery = void | PromiseLike<void>;
|
|
130
|
-
/**
|
|
131
|
-
* High-level host observation boundary. The SDK owns when each method is
|
|
132
|
-
* called; the host owns the destination client, consent, and delivery policy.
|
|
133
|
-
*/
|
|
134
|
-
interface ObservationAdapter {
|
|
135
|
-
/**
|
|
136
|
-
* Optional read-only invocation context. Transport adapters snapshot it once
|
|
137
|
-
* at call start; implementations must not mutate global SDK state.
|
|
138
|
-
*/
|
|
139
|
-
readonly resolveContext?: () => ObservationContext | undefined;
|
|
140
|
-
/** A method returned the SDK's typed `{ ok: false, error }` result. */
|
|
141
|
-
captureOperationFailure(failure: SdkFailureObservation): ObservationDelivery;
|
|
142
|
-
/** A method unexpectedly threw or rejected instead of returning a typed result. */
|
|
143
|
-
captureException(exception: SdkFailureObservation): ObservationDelivery;
|
|
144
|
-
}
|
|
145
|
-
/** Stable PostHog event used for typed failures that are expected product outcomes. */
|
|
146
|
-
declare const CAPXUL_SDK_EXPECTED_OUTCOME_EVENT = "capxul_sdk_expected_outcome";
|
|
147
|
-
//#endregion
|
|
148
108
|
//#region src/production.d.ts
|
|
149
109
|
/**
|
|
150
110
|
* Consumer-facing `createCapxulClient` input (SDK DX public surface · #326).
|
|
@@ -202,9 +162,10 @@ interface HandledErrorReportContext {
|
|
|
202
162
|
declare function captureException(telemetry: TelemetryPort, error: unknown, context?: HandledErrorReportContext): Effect.Effect<void, never>;
|
|
203
163
|
/**
|
|
204
164
|
* Synchronous fire-and-forget capture. Runs the Effect inline with
|
|
205
|
-
* `Effect.runSync` so callers outside an Effect context
|
|
206
|
-
*
|
|
165
|
+
* `Effect.runSync` so callers outside an Effect context can report errors
|
|
166
|
+
* without awaiting. Core SDK public methods use the assembled observation
|
|
167
|
+
* boundary instead.
|
|
207
168
|
*/
|
|
208
169
|
declare function captureExceptionSync(telemetry: TelemetryPort, error: unknown, context?: HandledErrorReportContext): void;
|
|
209
170
|
//#endregion
|
|
210
|
-
export { type Account, type AccountId, type AccountLifecycle, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, type AccountSetupStep, type AccountsMethods, type ActivityAnnotationInput, type ActivityDetail, type ActivityItem, type ActivityListParams, type ActivityMethods, type ActivityPage, type ActivityReference, type ActorProfile, type ActorProfileMethods, type ActorReference, type ActorRelationshipMethods, type ActorRequest, type ActorRequestIssueInput, type ActorRequestsMethods, type Address, type AddressBookAddInput, type AddressBookEntry, type AddressBookLabelInput, type AddressBookMethods, type AuthMethods, type AuthSession, type AuthUserId, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, type CapxulClient, type CapxulClientInput, type CapxulDigestSigner, CapxulError, type CapxulErrorCode, type CapxulErrorDetails, type CapxulResult, type CapxulSigner, type CountryCode, type CreateCapxulClientInput, type CreateOrgInput, type CurrentHoldings, type CurrentUserContext, type CurrentUserMethods, type DepositInstructions, type Destination, type DestinationAddInput, type DestinationKind, type DestinationListInput, type DestinationPayload, type DestinationRail, type DestinationRemoveInput, type DestinationsMethods, type DetectPendingOrgInvitationsResult, type DevPrivateKeySignerInput, type Eip1193Provider, type Eip1193RequestProvider, type FinancialOpsMethods, type HandledErrorReportContext, type HandlesMethods, type HoldingsMethods, type HostObservability, type Destination$1 as IdentityDestination, type IdentityEvent, type IdentityMethods, type IdentityProfileDetails, type IdentityRuntime, type IdentityRuntimeSendResult, type IdentityState, type IdentityTransition, type InboxApproveInput, type InboxItem, type InboxMethods, type InviteMemberInput, type InvocationControls, type MeMethods, type MeProfile, type MediaMethods, type MemberStatus, type MemberView, type Money, type MovementAnnotation, type ObservationAdapter, type ObservationContext, type ObservationDelivery, type OfframpMethods, type OfframpQuote, type OfframpQuoteInput, type OfframpStatus, type OpenfortEmbeddedSignerInput, type OpenfortEmbeddedWalletApi, type OpenfortEmbeddedWalletPort, type OrgId, type OrgLane, type OrgLifecycle, type OrgMethods, type OrgScopedMethods, type OrgSetupStep, type OrgTemplate, type OrgView, type OrganizationAccount, type OrganizationAuditLogItem, type OrganizationPaymentBatchInput, type OrganizationPaymentInput, type OrganizationPaymentItemInput, type OrganizationPaymentsMethods, type Payee, type PayeesMethods, type Payment, type PaymentDirection, type PaymentDocumentKind, type PaymentDocumentRef, type PaymentDocumentRender, type PaymentDocumentVerification, type PaymentDocumentsMethods, type PaymentMoney, type PaymentStatus, type PaymentTiming, type PaymentType, type PaymentsMethods, type PaymentsPayInput, type Permission, type PermissionAssignInput, type PermissionChangeInput, type PermissionCreateInput, type PermissionMethods, type PermissionOptions, type PermissionReadResult, type PermissionReplaceInput, type PermissionRevokeInput, type PostHogObservabilityClient, type PostHogObservabilityOptions, type Profile, type Readiness, type RecipientResolution, type RecipientResolutionKind, type Ref, type ResendInviteTokenInput, type ResolvedTarget, type RoleDefinition, type RoleKey, type RoleSpendCap, type RoleView, type SdkFailureObservation, type Session, type SmartAccount, type SmartAccountMethods, type StateLabel, type SubmittedPermissionExecution, type SystemHealth, type SystemMethods, type TargetReference, type TargetsMethods, type TelemetryPort, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, injectedWalletSigner, isCapxulError, isSettingUpLifecycle, localPrivateKeyAccountProvider, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, postHogObservability, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress };
|
|
171
|
+
export { type Account, type AccountId, type AccountLifecycle, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, type AccountSetupStep, type AccountsMethods, type ActivityAnnotationInput, type ActivityDetail, type ActivityItem, type ActivityListParams, type ActivityMethods, type ActivityPage, type ActivityReference, type ActorProfile, type ActorProfileMethods, type ActorReference, type ActorRelationshipMethods, type ActorRequest, type ActorRequestIssueInput, type ActorRequestsMethods, type Address, type AddressBookAddInput, type AddressBookEntry, type AddressBookLabelInput, type AddressBookMethods, type AuthMethods, type AuthSession, type AuthUserId, type Budget, type BudgetId, CAPXUL_ERROR_CODES, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, type CapxulClient, type CapxulClientInput, type CapxulDigestSigner, CapxulError, type CapxulErrorCode, type CapxulErrorDetails, type CapxulResult, type CapxulSigner, type CountryCode, type CreateCapxulClientInput, type CreateOrgInput, type CurrentHoldings, type CurrentUserContext, type CurrentUserMethods, type DepositInstructions, type Destination, type DestinationAddInput, type DestinationKind, type DestinationListInput, type DestinationPayload, type DestinationRail, type DestinationRemoveInput, type DestinationsMethods, type DetectPendingOrgInvitationsResult, type DevPrivateKeySignerInput, type Eip1193Provider, type Eip1193RequestProvider, Errors, type FinancialOpsMethods, type HandledErrorReportContext, type HandlesMethods, type HoldingsMethods, type HostObservability, type Destination$1 as IdentityDestination, type IdentityEvent, type IdentityMethods, type IdentityProfileDetails, type IdentityRuntime, type IdentityRuntimeSendResult, type IdentityState, type IdentityTransition, type InboxApproveInput, type InboxItem, type InboxMethods, type InviteMemberInput, type InvocationControls, type MeMethods, type MeProfile, type MediaMethods, type MemberStatus, type MemberView, type Money, type MoneyParseError, type MoneyParseErrorReason, type MovementAnnotation, type ObservationAdapter, type ObservationContext, type ObservationDelivery, type OfframpMethods, type OfframpQuote, type OfframpQuoteInput, type OfframpStatus, type OpenfortEmbeddedSignerInput, type OpenfortEmbeddedWalletApi, type OpenfortEmbeddedWalletPort, type OrgId, type OrgLane, type OrgLifecycle, type OrgMe, type OrgMeMethod, type OrgMeOptions, type OrgMethods, type OrgScopedMethods, type OrgSetupStep, type OrgTemplate, type OrgView, type OrganizationAccount, type OrganizationAuditLogItem, type OrganizationPaymentBatchInput, type OrganizationPaymentInput, type OrganizationPaymentItemInput, type OrganizationPaymentsMethods, type PartyId, type Payee, type PayeesMethods, type Payment, type PaymentDirection, type PaymentDocumentKind, type PaymentDocumentRef, type PaymentDocumentRender, type PaymentDocumentVerification, type PaymentDocumentsMethods, type PaymentMoney, type PaymentStatus, type PaymentTiming, type PaymentType, type PaymentsMethods, type PaymentsPayInput, type Permission, type PermissionAssignInput, type PermissionChangeInput, type PermissionCreateInput, type PermissionMethods, type PermissionOptions, type PermissionReadResult, type PermissionReplaceInput, type PermissionRevokeInput, type PostHogObservabilityClient, type PostHogObservabilityOptions, type Profile, type Readiness, type RecipientResolution, type RecipientResolutionKind, type Ref, type ResendInviteTokenInput, type ResolvedTarget, type RoleDefinition, type RoleKey, type RoleSpendCap, type RoleView, type SdkFailureObservation, type Session, type SignerStatus, type SignerStatusStore, type SmartAccount, type SmartAccountMethods, type StateLabel, type SubmittedPermissionExecution, type SystemHealth, type SystemMethods, type TargetReference, type TargetsMethods, type TelemetryPort, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatMoney, injectedWalletSigner, isCapxulError, isClaimed, isMoneyParseError, isRestoring, isSettingUpLifecycle, localPrivateKeyAccountProvider, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseMoney, postHogObservability, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress };
|