@capxul/sdk 2.8.0 → 3.0.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/dist/OAuthBearerAuthClient-BZ6tXt4m.mjs +211 -0
- package/dist/OAuthBearerAuthClient-GkHnGqNi.d.mts +19 -0
- package/dist/{InMemoryAuthCacheAdapter-FptQ2p7C.mjs → clock-0c5NM-TY.mjs} +1050 -6
- package/dist/{create-capxul-client-YSN2yN8m.mjs → create-capxul-client-DwINzpXZ.mjs} +364 -1409
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +639 -43
- package/dist/node/index.d.mts +3 -2
- package/dist/node/index.mjs +3 -2
- package/dist/{observation-YhuU8yQX.d.mts → observation-CR3_haBB.d.mts} +34 -67
- package/dist/{signer-xGhV5Q7i.d.mts → signer-HY5Ju8xs.d.mts} +88 -3
- package/dist/testing/index.d.mts +1 -1
- package/dist/testing/index.mjs +2 -22
- package/package.json +5 -5
package/dist/node/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as CachedJwt, M as AuthSession, S as AuthCachePortTag, b as AuthCacheError, n as CapxulSigner, x as AuthCachePort } from "../signer-HY5Ju8xs.mjs";
|
|
2
|
+
import { n as oauthBearerAuthClient, t as OAuthBearerAuthClientInput } from "../OAuthBearerAuthClient-GkHnGqNi.mjs";
|
|
2
3
|
import { Hex } from "viem";
|
|
3
4
|
import { Effect, FileSystem, Layer, Path } from "effect";
|
|
4
5
|
//#region src/adapters/auth-cache/FileSystemAuthCacheAdapter.d.ts
|
|
@@ -47,4 +48,4 @@ declare function localPrivateKeySigner(input: {
|
|
|
47
48
|
*/
|
|
48
49
|
declare function detectNodeAuthCacheAdapter(options?: DetectNodeAuthCacheAdapterOptions): AuthCachePort;
|
|
49
50
|
//#endregion
|
|
50
|
-
export { DetectNodeAuthCacheAdapterOptions, FileSystemAuthCacheAdapter, FileSystemAuthCacheLayer, detectNodeAuthCacheAdapter, localPrivateKeySigner };
|
|
51
|
+
export { DetectNodeAuthCacheAdapterOptions, FileSystemAuthCacheAdapter, FileSystemAuthCacheLayer, type OAuthBearerAuthClientInput, detectNodeAuthCacheAdapter, localPrivateKeySigner, oauthBearerAuthClient };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as toAddress, a as parseCachedJwt, i as parseAuthSession, n as InMemoryAuthCacheAdapter, o as AuthCacheError, r as BrowserAuthCacheAdapter, s as AuthCachePortTag } from "../clock-0c5NM-TY.mjs";
|
|
2
|
+
import { t as oauthBearerAuthClient } from "../OAuthBearerAuthClient-BZ6tXt4m.mjs";
|
|
2
3
|
import { Effect, FileSystem, Layer, Path } from "effect";
|
|
3
4
|
import { privateKeyToAccount } from "viem/accounts";
|
|
4
5
|
import * as os from "node:os";
|
|
@@ -153,4 +154,4 @@ function resolveDefaultAuthCachePath(resolveHomeDirectory) {
|
|
|
153
154
|
}
|
|
154
155
|
}
|
|
155
156
|
//#endregion
|
|
156
|
-
export { FileSystemAuthCacheAdapter, FileSystemAuthCacheLayer, detectNodeAuthCacheAdapter, localPrivateKeySigner };
|
|
157
|
+
export { FileSystemAuthCacheAdapter, FileSystemAuthCacheLayer, detectNodeAuthCacheAdapter, localPrivateKeySigner, oauthBearerAuthClient };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import {
|
|
1
|
+
import { $ as RoleKey, A as AnonymousDistinctId, B as DurationMs, D as Address$1, F as BudgetId, G as PartyId, H as EpochMs, I as ChainId, J as PayrollRunId, K as PaymentCommandId, L as CountryCode, M as AuthSession, N as AuthUserId, O as AllowanceKey, P as BlockNumber, Q as PublishableKey, R as CurrencyCode, T as Account$1, U as Money, V as Email, W as OrgId, X as PermissionId, Y as PermissionAssignmentId, Z as Profile, _ as ClockPort, _t as FailureMode, a as SignerStatusStore, c as AccountProviderSource, ct as CapxulErrorCode, dt as Failure, et as SessionToken, g as SmartAccount$1, h as Session$1, j as AppId, k as AllowedOrigin, l as AccountRequirement, lt as CapxulErrorDetails, m as Profile$1, n as CapxulSigner, nt as TxHash, p as CapxulResult, q as PayrollGroupId, rt as WeiAmount, st as CapxulError, tt as SmartAccount, v as AuthClientPort, x as AuthCachePort, y as CanSendOtpStatus, z as DocumentHash } from "./signer-HY5Ju8xs.mjs";
|
|
2
|
+
import { Hex } from "viem";
|
|
3
3
|
import { Context, Effect, Layer, Schema, Scope, Tracer } from "effect";
|
|
4
4
|
import { FunctionReference } from "convex/server";
|
|
5
5
|
//#region src/domain/machine/shell.d.ts
|
|
@@ -312,68 +312,6 @@ interface TelemetryGroupInput {
|
|
|
312
312
|
readonly properties?: TelemetryProps;
|
|
313
313
|
}
|
|
314
314
|
//#endregion
|
|
315
|
-
//#region ../config/src/capxul-payments-v2.d.ts
|
|
316
|
-
/** Immutable CapxulPaymentsV2 deployment on Base Sepolia. */
|
|
317
|
-
declare const CAPXUL_PAYMENTS_V2_ADDRESS: Address;
|
|
318
|
-
//#endregion
|
|
319
|
-
//#region src/ports/auth-client.d.ts
|
|
320
|
-
type AuthClientOperationOptions = {
|
|
321
|
-
readonly signal?: AbortSignal;
|
|
322
|
-
};
|
|
323
|
-
type SendOtpInput = {
|
|
324
|
-
readonly email: Email;
|
|
325
|
-
};
|
|
326
|
-
type CanSendOtpInput = {
|
|
327
|
-
readonly email: Email;
|
|
328
|
-
};
|
|
329
|
-
type CanSendOtpStatus = {
|
|
330
|
-
readonly allowed: boolean;
|
|
331
|
-
readonly cooldownMs: DurationMs;
|
|
332
|
-
};
|
|
333
|
-
type VerifyOtpInput = {
|
|
334
|
-
readonly email: Email;
|
|
335
|
-
readonly otp: string;
|
|
336
|
-
};
|
|
337
|
-
type GetConvexJwtOptions = AuthClientOperationOptions & {
|
|
338
|
-
readonly forceRefresh?: boolean;
|
|
339
|
-
};
|
|
340
|
-
declare const AuthClientError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
341
|
-
readonly _tag: "AuthClientError";
|
|
342
|
-
} & Readonly<A>;
|
|
343
|
-
declare class AuthClientError extends AuthClientError_base<{
|
|
344
|
-
readonly operation: string;
|
|
345
|
-
readonly kind: string;
|
|
346
|
-
readonly cause: unknown;
|
|
347
|
-
}> {}
|
|
348
|
-
interface AuthClientPort {
|
|
349
|
-
canSendOtp(input: CanSendOtpInput, options?: AuthClientOperationOptions): Effect.Effect<CanSendOtpStatus, AuthClientError>;
|
|
350
|
-
sendOtp(input: SendOtpInput, options?: AuthClientOperationOptions): Effect.Effect<void, AuthClientError>;
|
|
351
|
-
verifyOtp(input: VerifyOtpInput, options?: AuthClientOperationOptions): Effect.Effect<AuthSession, AuthClientError>;
|
|
352
|
-
getSession(options?: AuthClientOperationOptions): Effect.Effect<AuthSession | null, AuthClientError>;
|
|
353
|
-
signOut(options?: AuthClientOperationOptions): Effect.Effect<void, AuthClientError>;
|
|
354
|
-
/**
|
|
355
|
-
* Fetches a Convex-aud JWT from `/api/auth/convex/token` (W7). Server mints
|
|
356
|
-
* a fresh JWT on every call per Probe A's 2026-05-19 finding (RS256, 900 s
|
|
357
|
-
* lifetime, `iss = <site-url>`, `aud = convex`). The caller (the SDK's
|
|
358
|
-
* `tokenProvider` wired into ConvexCallPort) is responsible for the
|
|
359
|
-
* `exp - 30s` proactive cache + `forceRefresh` callback handshake.
|
|
360
|
-
*/
|
|
361
|
-
getConvexJwt(options?: GetConvexJwtOptions): Effect.Effect<CachedJwt, AuthClientError>;
|
|
362
|
-
}
|
|
363
|
-
//#endregion
|
|
364
|
-
//#region src/ports/clock.d.ts
|
|
365
|
-
interface ClockPort {
|
|
366
|
-
readonly now: Effect.Effect<EpochMs, ClockError>;
|
|
367
|
-
readonly sleep: (duration: DurationMs) => Effect.Effect<void, ClockError>;
|
|
368
|
-
}
|
|
369
|
-
declare const ClockError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
370
|
-
readonly _tag: "ClockError";
|
|
371
|
-
} & Readonly<A>;
|
|
372
|
-
declare class ClockError extends ClockError_base<{
|
|
373
|
-
readonly operation: "now" | "sleep" | "initialize";
|
|
374
|
-
readonly cause: unknown;
|
|
375
|
-
}> {}
|
|
376
|
-
//#endregion
|
|
377
315
|
//#region ../wire/src/bootstrap.d.ts
|
|
378
316
|
declare const EngineeringTelemetryBootstrapPolicy: Schema.Struct<{
|
|
379
317
|
readonly host: Schema.refine<string, Schema.String>;
|
|
@@ -719,6 +657,20 @@ type Snapshot<T, E = CapxulError> = {
|
|
|
719
657
|
readonly status: "error";
|
|
720
658
|
readonly error: E;
|
|
721
659
|
};
|
|
660
|
+
type ConvexTransportFailure = {
|
|
661
|
+
readonly kind: "connection-lost-in-flight";
|
|
662
|
+
readonly connection_id: string;
|
|
663
|
+
readonly start_connection_count: number;
|
|
664
|
+
readonly connection_count: number;
|
|
665
|
+
readonly connection_retries?: number;
|
|
666
|
+
readonly close_code?: number;
|
|
667
|
+
readonly close_was_clean?: boolean;
|
|
668
|
+
readonly close_reason_present?: boolean;
|
|
669
|
+
readonly document_visibility?: string;
|
|
670
|
+
readonly navigator_online?: boolean;
|
|
671
|
+
readonly last_browser_event?: "visibility-visible" | "visibility-hidden" | "pagehide" | "pageshow" | "online" | "offline";
|
|
672
|
+
readonly ms_since_browser_event?: number;
|
|
673
|
+
};
|
|
722
674
|
declare const ConvexCallError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
723
675
|
readonly _tag: "ConvexCallError";
|
|
724
676
|
} & Readonly<A>;
|
|
@@ -728,6 +680,7 @@ declare class ConvexCallError extends ConvexCallError_base<{
|
|
|
728
680
|
readonly publicError: CapxulError;
|
|
729
681
|
readonly cause: unknown;
|
|
730
682
|
readonly details?: CapxulErrorDetails;
|
|
683
|
+
readonly transport?: ConvexTransportFailure;
|
|
731
684
|
}> {}
|
|
732
685
|
interface ConvexCallPort {
|
|
733
686
|
query<TArgs extends Record<string, unknown>, TOutput>(fn: FunctionReference<"query", "public", TArgs, TOutput>, args: TArgs): Effect.Effect<TOutput, ConvexCallError>;
|
|
@@ -2776,16 +2729,30 @@ interface SdkFailureObservation {
|
|
|
2776
2729
|
/**
|
|
2777
2730
|
* The PII-safe subset of `CapxulError.details`, already in PostHog property
|
|
2778
2731
|
* shape. `provider` + `provider_operation` name the failing dependency
|
|
2779
|
-
* (`convex bootstrap`, `openfort configure`)
|
|
2780
|
-
*
|
|
2732
|
+
* (`convex bootstrap`, `openfort configure`). `provider_error_source` names
|
|
2733
|
+
* the owner of an allow-listed `provider_error_code`. `failure_mode` / `reason`
|
|
2734
|
+
* are enumerated codes. `http_status` is the upstream status. Anything else on
|
|
2781
2735
|
* `details` (ids, field names, free text) is dropped at the boundary.
|
|
2782
2736
|
*/
|
|
2783
2737
|
interface SdkFailureDetail {
|
|
2784
2738
|
readonly provider?: string;
|
|
2785
2739
|
readonly provider_operation?: string;
|
|
2740
|
+
readonly provider_error_source?: string;
|
|
2741
|
+
readonly provider_error_code?: string;
|
|
2742
|
+
readonly target_host?: string;
|
|
2786
2743
|
readonly failure_mode?: string;
|
|
2787
2744
|
readonly reason?: string;
|
|
2788
2745
|
readonly http_status?: number;
|
|
2746
|
+
readonly connection_id?: string;
|
|
2747
|
+
readonly connection_count?: number;
|
|
2748
|
+
readonly connection_retries?: number;
|
|
2749
|
+
readonly close_code?: number;
|
|
2750
|
+
readonly close_was_clean?: boolean;
|
|
2751
|
+
readonly close_reason_present?: boolean;
|
|
2752
|
+
readonly document_visibility?: string;
|
|
2753
|
+
readonly navigator_online?: boolean;
|
|
2754
|
+
readonly last_browser_event?: string;
|
|
2755
|
+
readonly ms_since_browser_event?: number;
|
|
2789
2756
|
/** ADR-0023 R7: the chain cause, flat, same keys as every other producer. */
|
|
2790
2757
|
readonly chain_upstream?: string;
|
|
2791
2758
|
readonly chain_method?: string;
|
|
@@ -2816,4 +2783,4 @@ interface ObservationAdapter {
|
|
|
2816
2783
|
/** Stable PostHog event used for typed failures that are expected product outcomes. */
|
|
2817
2784
|
declare const CAPXUL_SDK_EXPECTED_OUTCOME_EVENT = "capxul_sdk_expected_outcome";
|
|
2818
2785
|
//#endregion
|
|
2819
|
-
export { OrganizationPaymentsMethods as $,
|
|
2786
|
+
export { OrganizationPaymentsMethods as $, OrgLane as $n, MeMethods as $t, OrgView as A, AccountSetupStep as An, ActivityFilter as At, PayrollGroupInput as B, SubmittedPermissionExecution as Bn, ActivitySummaryTotal as Bt, DetectPendingOrgInvitationsResult as C, RecipientResolutionKind as Cn, AddressBookMethods as Ct, OrgMethods as D, TargetsMethods as Dn, ActivityAnnotation as Dt, MemberView as E, TargetReference as En, InboxMethods as Et, RoleSpendCap as F, OrgLifecycle as Fn, ActivityPage as Ft, PayrollRun as G, RequestStatus as Gn, DestinationKind as Gt, PayrollGroupsMethods as H, PAYMENT_DIRECTIONS as Hn, DepositInstructions as Ht, RoleView as I, OrgSetupStep as In, ActivityRange as It, PayrollRuns as J, TelemetryIdentifyInput as Jn, DestinationRail as Jt, PayrollRunItemInput as K, TelemetryEvent as Kn, DestinationListInput as Kt, AuthorizeRunInput as L, ActorRef as Ln, ActivityReference as Lt, OrganizationAuditLogItem as M, IdentityMethods as Mn, ActivityKind as Mt, ResendInviteTokenInput as N, SmartAccountMethods as Nn, ActivityListParams as Nt, OrgScopedMethods as O, fingerprintPaymentIntent as On, ActivityAnnotationInput as Ot, RoleDefinition as P, AuthMethods as Pn, ActivityMethods as Pt, OrganizationPaymentItemInput as Q, IdentityState as Qn, HandlesMethods as Qt, PayrollEngagementTerms as R, CurrentHoldings as Rn, ActivitySummary as Rt, CreateOrgInput as S, RecipientResolution as Sn, AddressBookLabelInput as St, MemberStatus as T, ResolvedTarget as Tn, InboxItem as Tt, PayrollMethods as U, PAYMENT_STATUSES as Un, Destination as Ut, PayrollGroupMember as V, InboxStatus as Vn, ActorReference as Vt, PayrollOptions as W, PaymentStatus$1 as Wn, DestinationAddInput as Wt, OrganizationPaymentBatchInput as X, Destination$1 as Xn, DestinationsMethods as Xt, PayrollTermsUnit as Y, TelemetryPort as Yn, DestinationRemoveInput as Yt, OrganizationPaymentInput as Z, IdentityEvent as Zn, FinancialOpsMethods as Zt, SystemMethods as _, PaymentStatus as _n, ActorRequest as _t, SdkFailureObservation as a, OfframpStatus as an, IdentityTransition as ar, PermissionReplaceInput as at, CurrentUserContext as b, PaymentsMethods as bn, AddressBookAddInput as bt, PostHogObservabilityOptions as c, Payment as cn, Budget as ct, CreateCapxulClientInput as d, PaymentDocumentKind as dn, OrgMeOptions as dt, MeProfile as en, Readiness as er, PermissionAssignInput as et, IdentityProfileDetails as f, PaymentDocumentRef as fn, AccountsMethods as ft, Holding as g, PaymentMoney as gn, ActorRelationshipMethods as gt, HoldingsMethods as h, PaymentDocumentsMethods as hn, ActorProfileMethods as ht, ObservationDelivery as i, OfframpQuoteInput as in, isRestoring as ir, PermissionOptions as it, OrganizationAccount as j, isSettingUpLifecycle as jn, ActivityItem as jt, OrgTemplate as k, AccountLifecycle as kn, ActivityDetail as kt, postHogObservability as l, PaymentActivityEvidence as ln, OrgMe as lt, IdentityRuntimeSendResult as m, PaymentDocumentVerification as mn, ActorProfile as mt, ObservationAdapter as n, OfframpMethods as nn, destination as nr, PermissionCreateInput as nt, HostObservability as o, Payee as on, InvocationControls as or, PermissionRevokeInput as ot, IdentityRuntime as p, PaymentDocumentRender as pn, AccountMethods as pt, PayrollRunStatus as q, TelemetryGroupInput as qn, DestinationPayload as qt, ObservationContext as r, OfframpQuote as rn, isClaimed as rr, PermissionMethods as rt, PostHogObservabilityClient as s, PayeesMethods as sn, PermissionReadResult as st, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT as t, MovementActivityEvidence as tn, StateLabel as tr, PermissionChangeInput as tt, CapxulClient as u, PaymentDirection as un, OrgMeMethod as ut, SystemHealth as v, PaymentTiming as vn, ActorRequestIssueInput as vt, InviteMemberInput as w, Ref$1 as wn, InboxApproveInput as wt, CurrentUserMethods as x, PaymentsPayInput as xn, AddressBookEntry as xt, MediaMethods as y, PaymentType as yn, ActorRequestsMethods as yt, PayrollGroup as z, Permission as zn, ActivitySummaryParams as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Account, Hex } from "viem";
|
|
1
|
+
import { Account, Address, Hex } from "viem";
|
|
2
2
|
import { Context, Effect } from "effect";
|
|
3
3
|
//#region ../errors/src/chain-cause.d.ts
|
|
4
4
|
/**
|
|
@@ -17,6 +17,8 @@ declare const FAILURE_MODES: readonly [
|
|
|
17
17
|
"app-env-allowlist",
|
|
18
18
|
/** Sandboxed/headless browser with no Web Crypto. */
|
|
19
19
|
"no-secure-context",
|
|
20
|
+
/** The embedded wallet lost its configured signer state. */
|
|
21
|
+
"signer-not-ready",
|
|
20
22
|
/** One upstream answered HTTP 429 or JSON-RPC -32005. Retryable. */
|
|
21
23
|
"rate-limited",
|
|
22
24
|
/** No answer inside the budget. Retryable. */
|
|
@@ -104,6 +106,22 @@ declare class CapxulError extends Error {
|
|
|
104
106
|
constructor(code: CapxulErrorCode, message: string, options?: CapxulErrorOptions);
|
|
105
107
|
}
|
|
106
108
|
declare function isCapxulError(value: unknown): value is CapxulError;
|
|
109
|
+
type NetworkErrorOptions = {
|
|
110
|
+
readonly provider?: string;
|
|
111
|
+
readonly target_host?: string;
|
|
112
|
+
readonly failure_mode?: FailureMode;
|
|
113
|
+
readonly reason?: "connection-lost-in-flight";
|
|
114
|
+
readonly connection_id?: string;
|
|
115
|
+
readonly connection_count?: number;
|
|
116
|
+
readonly connection_retries?: number;
|
|
117
|
+
readonly close_code?: number;
|
|
118
|
+
readonly close_was_clean?: boolean;
|
|
119
|
+
readonly close_reason_present?: boolean;
|
|
120
|
+
readonly document_visibility?: string;
|
|
121
|
+
readonly navigator_online?: boolean;
|
|
122
|
+
readonly last_browser_event?: string;
|
|
123
|
+
readonly ms_since_browser_event?: number;
|
|
124
|
+
};
|
|
107
125
|
declare const Errors: {
|
|
108
126
|
readonly notAuthenticated: (message?: string, opts?: {
|
|
109
127
|
readonly failure_mode?: FailureMode;
|
|
@@ -182,7 +200,7 @@ declare const Errors: {
|
|
|
182
200
|
readonly retryAfterMs?: number;
|
|
183
201
|
readonly resource?: string;
|
|
184
202
|
}) => CapxulError;
|
|
185
|
-
readonly networkError: (operation: string, cause?: unknown) => CapxulError;
|
|
203
|
+
readonly networkError: (operation: string, cause?: unknown, opts?: NetworkErrorOptions) => CapxulError;
|
|
186
204
|
readonly unknown: (cause?: unknown) => CapxulError;
|
|
187
205
|
readonly otpExpired: (details?: {
|
|
188
206
|
readonly email?: string;
|
|
@@ -193,6 +211,11 @@ declare const Errors: {
|
|
|
193
211
|
readonly reason?: string;
|
|
194
212
|
readonly cause?: unknown;
|
|
195
213
|
}) => CapxulError;
|
|
214
|
+
readonly superseded: (details: {
|
|
215
|
+
readonly operation: string;
|
|
216
|
+
readonly reason: string;
|
|
217
|
+
readonly executionId?: string;
|
|
218
|
+
}) => CapxulError;
|
|
196
219
|
readonly cancelled: (details?: {
|
|
197
220
|
readonly operation?: string;
|
|
198
221
|
readonly reason?: string;
|
|
@@ -319,6 +342,10 @@ type SupportedCurrencyCode = (typeof SUPPORTED_CURRENCIES)[number]["code"];
|
|
|
319
342
|
declare function toAddress(raw: unknown): Address$1;
|
|
320
343
|
declare function toCountryCode(raw: unknown): CountryCode;
|
|
321
344
|
//#endregion
|
|
345
|
+
//#region ../config/src/capxul-payments-v2.d.ts
|
|
346
|
+
/** Immutable CapxulPaymentsV2 deployment on Base Sepolia. */
|
|
347
|
+
declare const CAPXUL_PAYMENTS_V2_ADDRESS: Address;
|
|
348
|
+
//#endregion
|
|
322
349
|
//#region src/ports/auth-cache.d.ts
|
|
323
350
|
/**
|
|
324
351
|
* AuthCachePort stores the user session and the cached
|
|
@@ -364,6 +391,64 @@ declare class AuthCacheError extends AuthCacheError_base<{
|
|
|
364
391
|
declare const AuthCachePortTag_base: Context.ServiceClass<AuthCachePortTag, "@capxul/sdk/ports/AuthCachePort", AuthCachePort>;
|
|
365
392
|
declare class AuthCachePortTag extends AuthCachePortTag_base {}
|
|
366
393
|
//#endregion
|
|
394
|
+
//#region src/ports/auth-client.d.ts
|
|
395
|
+
type AuthClientOperationOptions = {
|
|
396
|
+
readonly signal?: AbortSignal;
|
|
397
|
+
};
|
|
398
|
+
type SendOtpInput = {
|
|
399
|
+
readonly email: Email;
|
|
400
|
+
};
|
|
401
|
+
type CanSendOtpInput = {
|
|
402
|
+
readonly email: Email;
|
|
403
|
+
};
|
|
404
|
+
type CanSendOtpStatus = {
|
|
405
|
+
readonly allowed: boolean;
|
|
406
|
+
readonly cooldownMs: DurationMs;
|
|
407
|
+
};
|
|
408
|
+
type VerifyOtpInput = {
|
|
409
|
+
readonly email: Email;
|
|
410
|
+
readonly otp: string;
|
|
411
|
+
};
|
|
412
|
+
type GetConvexJwtOptions = AuthClientOperationOptions & {
|
|
413
|
+
readonly forceRefresh?: boolean;
|
|
414
|
+
};
|
|
415
|
+
declare const AuthClientError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
416
|
+
readonly _tag: "AuthClientError";
|
|
417
|
+
} & Readonly<A>;
|
|
418
|
+
declare class AuthClientError extends AuthClientError_base<{
|
|
419
|
+
readonly operation: string;
|
|
420
|
+
readonly kind: string;
|
|
421
|
+
readonly cause: unknown;
|
|
422
|
+
}> {}
|
|
423
|
+
interface AuthClientPort {
|
|
424
|
+
canSendOtp(input: CanSendOtpInput, options?: AuthClientOperationOptions): Effect.Effect<CanSendOtpStatus, AuthClientError>;
|
|
425
|
+
sendOtp(input: SendOtpInput, options?: AuthClientOperationOptions): Effect.Effect<void, AuthClientError>;
|
|
426
|
+
verifyOtp(input: VerifyOtpInput, options?: AuthClientOperationOptions): Effect.Effect<AuthSession, AuthClientError>;
|
|
427
|
+
getSession(options?: AuthClientOperationOptions): Effect.Effect<AuthSession | null, AuthClientError>;
|
|
428
|
+
signOut(options?: AuthClientOperationOptions): Effect.Effect<void, AuthClientError>;
|
|
429
|
+
/**
|
|
430
|
+
* Fetches a Convex-aud JWT from `/api/auth/convex/token` (W7). Server mints
|
|
431
|
+
* a fresh JWT on every call per Probe A's 2026-05-19 finding (RS256, 900 s
|
|
432
|
+
* lifetime, `iss = <site-url>`, `aud = convex`). The caller (the SDK's
|
|
433
|
+
* `tokenProvider` wired into ConvexCallPort) is responsible for the
|
|
434
|
+
* `exp - 30s` proactive cache + `forceRefresh` callback handshake.
|
|
435
|
+
*/
|
|
436
|
+
getConvexJwt(options?: GetConvexJwtOptions): Effect.Effect<CachedJwt, AuthClientError>;
|
|
437
|
+
}
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/ports/clock.d.ts
|
|
440
|
+
interface ClockPort {
|
|
441
|
+
readonly now: Effect.Effect<EpochMs, ClockError>;
|
|
442
|
+
readonly sleep: (duration: DurationMs) => Effect.Effect<void, ClockError>;
|
|
443
|
+
}
|
|
444
|
+
declare const ClockError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
445
|
+
readonly _tag: "ClockError";
|
|
446
|
+
} & Readonly<A>;
|
|
447
|
+
declare class ClockError extends ClockError_base<{
|
|
448
|
+
readonly operation: "now" | "sleep" | "initialize";
|
|
449
|
+
readonly cause: unknown;
|
|
450
|
+
}> {}
|
|
451
|
+
//#endregion
|
|
367
452
|
//#region src/surface/types.d.ts
|
|
368
453
|
type Session = AuthSession;
|
|
369
454
|
type Profile = Profile$1;
|
|
@@ -487,4 +572,4 @@ interface Eip1193RequestProvider {
|
|
|
487
572
|
*/
|
|
488
573
|
declare function injectedWalletSigner(provider: Eip1193RequestProvider): CapxulSigner;
|
|
489
574
|
//#endregion
|
|
490
|
-
export {
|
|
575
|
+
export { RoleKey as $, AnonymousDistinctId as A, DurationMs as B, CachedJwt as C, Address$1 as D, AccountId as E, BudgetId as F, PartyId as G, EpochMs as H, ChainId as I, PayrollRunId as J, PaymentCommandId as K, CountryCode as L, AuthSession as M, AuthUserId as N, AllowanceKey as O, BlockNumber as P, PublishableKey as Q, CurrencyCode as R, AuthCachePortTag as S, Account$1 as T, Money as U, Email as V, OrgId as W, PermissionId as X, PermissionAssignmentId as Y, Profile$1 as Z, ClockPort as _, FailureMode as _t, SignerStatusStore as a, toCountryCode as at, AuthCacheError as b, AccountProviderSource as c, CapxulErrorCode as ct, eip1193AccountProvider as d, Failure as dt, SessionToken as et, localPrivateKeyAccountProvider as f, isCapxulError as ft, SmartAccount as g, FAILURE_MODES as gt, Session as h, ChainUpstream as ht, SignerStatus as i, toAddress as it, AppId as j, AllowedOrigin as k, AccountRequirement as l, CapxulErrorDetails as lt, Profile as m, ChainCause as mt, CapxulSigner as n, TxHash as nt, injectedWalletSigner as o, CAPXUL_ERROR_CODES as ot, CapxulResult as p, CHAIN_UPSTREAMS as pt, PayrollGroupId as q, Eip1193RequestProvider as r, WeiAmount as rt, AccountProvider as s, CapxulError as st, CapxulDigestSigner as t, SmartAccount$1 as tt, Eip1193Provider as u, Errors as ut, AuthClientPort as v, RevertSummary as vt, CAPXUL_PAYMENTS_V2_ADDRESS as w, AuthCachePort as x, CanSendOtpStatus as y, DocumentHash as z };
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Jn as
|
|
1
|
+
import { Jn as TelemetryIdentifyInput, Kn as TelemetryEvent, ar as IdentityTransition, n as ObservationAdapter, qn as TelemetryGroupInput, u as CapxulClient } from "../observation-CR3_haBB.mjs";
|
|
2
2
|
import { Effect, Layer } from "effect";
|
|
3
3
|
//#region src/testing/telemetry/RecordingTelemetryAdapter.d.ts
|
|
4
4
|
type RecordingTelemetryOperation = {
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { F as fromWei, _ as convexCallErrorFromCapxul, c as redactTelemetryEvent, h as identityErrorFromCapxul, i as smartAccountErrorFromCapxul, o as accountReadErrorFromCapxul, p as wireChainId, t as assembleCapxulClient, x as toWei, y as bootstrapErrorFromCapxul } from "../create-capxul-client-DwINzpXZ.mjs";
|
|
2
|
+
import { D as toAllowedOrigin, E as toAddress, F as toEmail, I as toEpochMs, K as toSessionToken, L as toEpochSeconds, M as toCountryCode, O as toAppId, P as toDurationMs, R as toJwtToken, T as toAccountId, W as toPublishableKey, Y as CapxulError, Z as Errors, _ as deriveCapxulSafeAddress, j as toChainId, k as toAuthUserId, n as InMemoryAuthCacheAdapter, t as readClockNow, u as authClientPortFromPromiseAdapter, z as toKycTier } from "../clock-0c5NM-TY.mjs";
|
|
3
3
|
import { keccak256 } from "viem";
|
|
4
4
|
import { Effect, Result, Semaphore } from "effect";
|
|
5
5
|
import { getFunctionName } from "convex/server";
|
|
@@ -43,26 +43,6 @@ function cloneAccount(account) {
|
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
|
-
//#region src/adapters/_shared/clock.ts
|
|
47
|
-
async function readClockNow(clock) {
|
|
48
|
-
try {
|
|
49
|
-
const result = await Effect.runPromise(Effect.result(clock.now));
|
|
50
|
-
if (Result.isFailure(result)) return {
|
|
51
|
-
ok: false,
|
|
52
|
-
error: Errors.providerError("clock", "now", result.failure)
|
|
53
|
-
};
|
|
54
|
-
return {
|
|
55
|
-
ok: true,
|
|
56
|
-
value: result.success
|
|
57
|
-
};
|
|
58
|
-
} catch (cause) {
|
|
59
|
-
return {
|
|
60
|
-
ok: false,
|
|
61
|
-
error: Errors.providerError("clock", "now", cause)
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
46
|
//#region src/testing/clock/ManualClockAdapter.ts
|
|
67
47
|
/**
|
|
68
48
|
* Event-discipline test clock. Time moves only when a release primitive is
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capxul/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/Xelmar-tech/infrastructure.git",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
|
|
48
48
|
"vite-plus": "0.3.0",
|
|
49
49
|
"vitest": "4.1.11",
|
|
50
|
-
"@capxul/types": "0.2.1",
|
|
51
50
|
"@capxul/errors": "0.0.2",
|
|
52
|
-
"@capxul/
|
|
51
|
+
"@capxul/types": "0.2.1",
|
|
53
52
|
"@capxul/typescript-config": "0.0.0",
|
|
54
|
-
"@capxul/
|
|
55
|
-
"@capxul/config": "0.2.1"
|
|
53
|
+
"@capxul/wire": "0.5.1",
|
|
54
|
+
"@capxul/config": "0.2.1",
|
|
55
|
+
"@capxul/observability": "3.0.0"
|
|
56
56
|
},
|
|
57
57
|
"_permissionlessPinReason": "permissionless.toSafeSmartAccount is pinned to 0.3.4 for live Safe deployment E2E. Counterfactual address fixtures captured 2026-05-17 in packages/backend/convex/_shared/__tests__/counterfactual.test.ts and packages/config/tests/safe.test.ts must be re-verified before upgrading.",
|
|
58
58
|
"scripts": {
|