@capxul/sdk 0.0.0-rc-2cdddbb91

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.
@@ -0,0 +1,2 @@
1
+ import { $ as AuthMethods, $a as RequestPaymentConfirmation, $i as PaymentDocumentsMethods, $n as PaymentPrepared, $o as ORGANIZATION_SETUP_REASONS, $r as PayrollRunApprovalInput, $t as AddressBookMethods, A as formatAssetAmount, Aa as localPrivateKeyAccountProvider, Ai as MeProfile, An as VerificationInput, Ar as ApprovalsMethods, As as Money, At as Budget, B as IdentityProfileDetails, Ba as PreparedOfferCheckoutExecution, Bi as ActivityKind, Bn as TargetReference, Br as PermissionMethods, Bs as FAILURE_MODES, Bt as DestinationAddInput, C as OpenfortBrowserSigner, Ca as SignerStatusStore, Ci as AccountLifecycle, Cn as BankDetailsOverview, Co as OfferedAuthority, Cr as valueActivitySummary, Cs as AuthUserId, Ct as InvitationSubscriptionOptions, D as CAPXUL_PAYMENTS_V2_ADDRESS, Da as AccountRequirement, Di as DepositInstructions, Dn as BankAccountField, Do as CurrentPolicy, Dr as ApprovalInput, Ds as Errors, Dt as InvitePreviewInput, E as createOpenfortBrowserSigner, Ea as AccountProviderSource, Ei as AccountMethods, En as BankAccountDetails, Eo as BudgetIntent, Er as TOKENS, Es as toAddress, Et as InvitePrepared, F as MoneyParseErrorReason, Fa as FixedOfferDraft, Fi as ActivityAnnotation, Fn as VerificationQuestion, Fo as CapxulOperation, Fr as BudgetLeft, Fs as isCapxulError, Ft as BankingMethods, G as SystemHealth, Ga as PrepareInvoiceCheckoutExecutionInput, Gi as ActivityReference, Gn as OrganizationPaymentRetryPreview, Gr as PermissionReplaceInput, Gt as DestinationRemoveInput, H as IdentityRuntimeSendResult, Ha as InvoiceCheckoutReconciliation, Hi as ActivityMethods, Hn as OrganizationPaymentBatchInput, Ho as ObservationContext, Hr as PermissionPolicyChange, Hs as CAPXUL_ERROR_CODES, Ht as DestinationListInput, I as isMoneyParseError, Ia as FixedOfferDraftSchema, Ii as ActivityAnnotationInput, In as VerificationStatus, Io as NormalizedCapxulOperation, Ir as PermissionAssignInput, Is as CHAIN_UPSTREAMS, It as BankDepositCandidatesOptions, J as destination, Ja as PreparedRequestCheckoutExecution, Ji as ActivitySummaryTotal, Jn as Payment, Jr as PermissionCommandView, Jt as ActorProfileMethods, K as SystemMethods, Ka as PrepareRequestCheckoutExecutionInput, Ki as ActivitySummary, Kn as OrganizationPaymentsMethods, Kr as PermissionRevokeInput, Kt as DestinationsMethods, L as parseMoney, La as OfferCheckout, Li as ActivityDetail, Ln as RecipientResolution, Lo as isCapxulOperation, Lr as PermissionAssignmentEffect, Ls as ChainCause, Lt as BankDepositMethods, M as requireAsset, Ma as CheckoutReconciliation, Mi as inboxPhase, Mn as VerificationOperations, Mr as PermissionApprovalInput, Ms as toCurrencyCode, Mt as OrgMeMethod, N as toRaw, Na as CheckoutState, Ni as paymentPhase, Nn as VerificationAnswers, No as TelemetryPort, Nr as PermissionWrite, Ns as CapxulError, Nt as OrgMeOptions, O as formatMoney, Oa as Eip1193Provider, Oi as Home, On as BankAccountFilter, Oo as Permission, Or as ApprovalOutcome, Os as AssetAmount, Ot as OrgInvitations, P as MoneyParseError, Pa as FixedOffer, Pi as requestPhase, Pn as VerificationPersonInput, Po as CAPXUL_OPERATIONS, Pr as decodePermissionIntent, Ps as CapxulErrorDetails, Pt as BankDetailsMethods, Q as CurrentUserMethods, Qa as RequestCheckoutSummary, Qi as PAYMENT_STATUSES, Qn as PaymentMoney, Qo as Page, Qr as CancelApprovalInput, Qt as AddressBookLabelInput, R as CapxulClient, Ra as OfferCheckoutPreparation, Ri as ActivityFilter, Rn as Ref, Ro as normalizeCapxulOperation, Rr as PermissionChangeInput, Rs as ChainUpstream, Rt as BankDepositsListOptions, S as OpenfortBrowserAuth, Sa as SignerStatus, Si as Approval, Sn as BankDetails, So as InvitePreview, Sr as Valuation, Ss as AuthSession, St as InvitationSnapshot, Ta as AccountProvider, Ti as isSettingUpLifecycle, Tn as BankAccount, To as PermissionReplacementPreview, Tr as AssetMetadata, Ts as EVM_ADDRESS_RE, Tt as InviteOptions, U as MediaMethods, Ua as InvoiceCheckoutState, Ui as ActivityPage, Un as OrganizationPaymentInput, Uo as ObservationDelivery, Ur as PermissionPrepared, Us as CapxulErrorCode, Ut as DestinationPayload, V as IdentityRuntime, Va as InvoiceCheckoutPreparation, Vi as ActivityListParams, Vn as TargetsMethods, Vo as ObservationAdapter, Vr as PermissionOptions, Vs as FailureMode, Vt as DestinationKind, W as UploadImageResult, Wa as InvoiceCheckoutSummary, Wi as ActivityRange, Wn as OrganizationPaymentItemInput, Wo as SdkFailureObservation, Wr as PermissionReadResult, Ws as EXPECTED_OPERATION_OUTCOMES, Wt as DestinationRail, X as isRestoring, Xa as RequestCheckoutReconciliation, Xi as PaymentActivityEvidence, Xn as PaymentDocumentKind, Xo as CapxulResult, Xr as PermissionIntent, Xt as AddressBookAddInput, Y as isClaimed, Ya as RequestCheckoutPreparation, Yi as MovementActivityEvidence, Yn as PaymentDirection, Yo as ActorReference, Yr as SubmittedPermissionExecution, Yt as ActorRelationshipMethods, Z as CurrentUserContext, Za as RequestCheckoutState, Zi as PAYMENT_DIRECTIONS, Zn as PaymentDocumentRef, Zo as OperationResult, Zr as OrganizationApprovalInput, Zt as AddressBookEntry, _ as OpenfortEmbeddedWalletPort, _a as ActorRef, _i as PayrollTermsUnit, _n as BankCurrency, _o as InvitationRecovery, _r as HoldingsMethods, _s as HANDLE_RE, _t as OrganizationAccess, a as captureExceptionSync, aa as CompletedPersonProfile, ai as AuthorizeRunOptions, an as InboxFulfillOptions, ao as OrganizationSetupPageInput, ar as PaymentsPayInput, as as BudgetId, at as IdentityTransition, b as deriveDevPrivateKey, ba as CapxulSigner, bi as PayrollGroupInputSchema, bn as BankDepositMatchCandidate, bo as InviteGrant, br as Rate, bs as toHandle, bt as RoleDefinition, c as CapxulClientInput, ca as OrganizationOnboardingInput, ci as PayrollGroupInput, cn as CheckoutsMethods, co as Unsubscribe, cr as PaymentDocumentOptions, cs as toBudgetId, ct as Readiness, d as PostHogObservabilityOptions, da as PersonOnboardingInput, di as PayrollMethods, dn as PayRequestRegisteredInput, do as GranteeRef, dr as SupportingReceiptInput, ds as Account, dt as MemberIdentityProjection, ea as PaymentDocumentDownload, ei as RedirectApprovalInput, en as ActorRequest, eo as RequestPaymentTerms, er as PaymentSnapshot, es as OrgId, et as Session, f as postHogObservability, fa as ReadyAccountLifecycle, fi as PayrollOptions, fn as isCheckoutSettlementConsumed, fo as InvitationAcceptInput, fr as PaymentQuoteInput, fs as AccountId, ft as MemberStatus, g as OpenfortEmbeddedWalletApi, ga as PayoutAddress, gi as PayrollRuns, gn as BankAccountsMethods, go as InvitationPhase, gr as positionPeg, gs as toCountryCode, gt as OrgView, h as openfortEmbeddedSignerFromWallet, ha as Profile, hi as PayrollRunStatus, hn as BankAccountRequirementsInput, ho as InvitationPageInput, hr as SmartAccountMethods, hs as TesterKind, ht as OrgScopedMethods, i as captureException, ia as LineItemV3, ii as AuthorizeRunInput, in as InboxApproveInput, io as OrganizationSetupPage, ir as PaymentType, is as toPayrollGroupId, it as IdentityEvent, j as parseAssetAmount, ja as CheckoutReceipt, ji as ActivityPhase, jn as VerificationMethods, jr as InvitationApprovalInput, js as toAssetId, jt as OrgMe, k as assetSymbolFor, ka as eip1193AccountProvider, ki as MeMethods, kn as BankAccountTarget, kr as ApprovalWaitOptions, ks as AssetId, kt as OwnInvitationsMethod, l as HostObservability, la as OrganizationOnboardingOptions, li as PayrollGroupMember, ln as CreateOfferCheckoutInput, lo as AuthorityRef, lr as PaymentDocumentOptionsSchema, ls as toPermissionAssignmentId, lt as StateLabel, m as embeddedSigner, ma as IdentityMethods, mi as PayrollRunItemInput, mn as BankAccountRequirements, mo as InvitationPage, mr as SmartAccount, ms as CountryCode, mt as OrgMethods, n as checkoutUrl, na as PaymentDocumentRender, ni as RetryApprovalInput, nn as ActorRequestsMethods, no as InvocationControls, nr as PaymentSubscriptionOptions, ns as PayrollGroupId, nt as ClientRequests, o as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, oa as OnboardingMethods, oi as PayrollEngagementTerms, on as InboxItem, oo as OrganizationSetupSnapshot, or as PaymentsPayOptions, os as PermissionId, ot as IdentityState, p as OpenfortEmbeddedSignerInput, pa as CompleteProfileInput, pi as PayrollRun, pn as BankAccountAddInput, po as InvitationId, pr as FinancialOpsMethods, ps as toAccountId, pt as MemberView, q as Destination$1, qa as PreparedInvoiceCheckoutExecution, qi as ActivitySummaryParams, qn as PaymentsMethods, qr as PermissionCommandSnapshot, qt as ActorProfile, r as HandledErrorReportContext, ra as PaymentDocumentVerification, ri as decodePayrollRunInput, rn as OffersMethods, ro as OrganizationSetup, rr as PaymentTiming, rs as PayrollRunId, rt as ClientRequestView, s as createCapxulClient, sa as OrganizationOnboarding, si as PayrollGroup, sn as InboxMethods, so as SetupIssue, sr as InvoiceDraft, ss as RoleKey, st as OrgLane, t as CheckoutLinkReference, ta as PaymentDocumentReadRef, ti as RequestApprovalInput, tn as ActorRequestIssueInput, to as PaymentQuote, tr as PaymentStatus, ts as toOrgId, tt as AccountSetupPolicy, u as PostHogObservabilityClient, ua as PersonOnboarding, ui as PayrollGroupsMethods, un as PayInvoiceRegisteredInput, uo as EndingReason, ur as PaymentInstructionInput, us as toPermissionId, ut as AssignmentProjection, v as openfortEmbeddedWalletPort, va as fingerprintPaymentIntent, vi as PayrollRunSnapshot, vn as BankDeposit, vo as InvitationTarget, vr as CurrentHoldings, vs as Handle, vt as OrganizationAccount, w as OpenfortBrowserSignerBootstrap, wa as injectedWalletSigner, wi as AccountSetupStep, wn as SettlementToken, wo as SpendingScope, wr as valueIn, ws as Address, wt as InviteMethod, x as devPrivateKeySigner, xa as Eip1193RequestProvider, xi as PayrollRunDetail, xn as BankDepositsPage, xo as InviteInput, xr as RateSource, xs as toPartyId, xt as RoleView, y as DevPrivateKeySignerInput, ya as CapxulDigestSigner, yi as PayrollGroupIdSchema, yn as BankDepositCandidatesPage, yo as InvitationView, yr as AccountsMethods, ys as PartyId, yt as OrganizationAuditLogItem, z as CreateCapxulClientInput, za as PrepareOfferCheckoutExecutionInput, zi as ActivityItem, zn as ResolvedTarget, zr as PermissionCreateInput, zs as RevertSummary, zt as Destination } from "./index-Czjrh-Fo.mjs";
2
+ export { type Account, type AccountId, type AccountLifecycle, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, type AccountSetupPolicy, type AccountSetupStep, type AccountsMethods, type ActivityAnnotation, type ActivityAnnotationInput, type ActivityDetail, type ActivityFilter, type ActivityItem, type ActivityKind, type ActivityListParams, type ActivityMethods, type ActivityPage, type ActivityPhase, type ActivityRange, type ActivityReference, type ActivitySummary, type ActivitySummaryParams, type ActivitySummaryTotal, type ActorProfile, type ActorProfileMethods, type ActorRef, type ActorReference, type ActorRelationshipMethods, type ActorRequest, type ActorRequestIssueInput, type ActorRequestsMethods, type Address, type AddressBookAddInput, type AddressBookEntry, type AddressBookLabelInput, type AddressBookMethods, type Approval, type ApprovalInput, type ApprovalOutcome, type ApprovalWaitOptions, type ApprovalsMethods, type AssetAmount, type AssetId, type AssetMetadata, type AssignmentProjection, type AuthMethods, type AuthSession, type AuthUserId, type AuthorityRef, type AuthorizeRunInput, type AuthorizeRunOptions, type BankAccount, type BankAccountAddInput, type BankAccountDetails, type BankAccountField, type BankAccountFilter, type BankAccountRequirements, type BankAccountRequirementsInput, type BankAccountTarget, type BankAccountsMethods, type BankCurrency, type BankDeposit, type BankDepositCandidatesOptions, type BankDepositCandidatesPage, type BankDepositMatchCandidate, type BankDepositMethods, type BankDepositsListOptions, type BankDepositsPage, type BankDetails, type BankDetailsMethods, type BankDetailsOverview, type BankingMethods, type Budget, type BudgetId, type BudgetIntent, type BudgetLeft, CAPXUL_ERROR_CODES, CAPXUL_OPERATIONS, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CHAIN_UPSTREAMS, type CancelApprovalInput, type CapxulClient, type CapxulClientInput, type CapxulDigestSigner, CapxulError, type CapxulErrorCode, type CapxulErrorDetails, type CapxulOperation, type CapxulResult, type CapxulSigner, type ChainCause, type ChainUpstream, type CheckoutLinkReference, type CheckoutReceipt, type CheckoutReconciliation, type CheckoutState, type CheckoutsMethods, type ClientRequestView, type ClientRequests, type CompleteProfileInput, type CompletedPersonProfile, type CountryCode, type CreateCapxulClientInput, type CreateOfferCheckoutInput, type CurrentHoldings, type CurrentPolicy, type CurrentUserContext, type CurrentUserMethods, type DepositInstructions, type Destination, type DestinationAddInput, type DestinationKind, type DestinationListInput, type DestinationPayload, type DestinationRail, type DestinationRemoveInput, type DestinationsMethods, type DevPrivateKeySignerInput, EVM_ADDRESS_RE, EXPECTED_OPERATION_OUTCOMES, type Eip1193Provider, type Eip1193RequestProvider, type EndingReason, Errors, FAILURE_MODES, type FailureMode, type FinancialOpsMethods, type FixedOffer, type FixedOfferDraft, FixedOfferDraftSchema, type GranteeRef, HANDLE_RE, type Handle, type HandledErrorReportContext, type HoldingsMethods, type Home, type HostObservability, type Destination$1 as IdentityDestination, type IdentityEvent, type IdentityMethods, type IdentityProfileDetails, type IdentityRuntime, type IdentityRuntimeSendResult, type IdentityState, type IdentityTransition, type InboxApproveInput, type InboxFulfillOptions, type InboxItem, type InboxMethods, type InvitationAcceptInput, type InvitationApprovalInput, type InvitationId, type InvitationPage, type InvitationPageInput, type InvitationPhase, type InvitationRecovery, type InvitationSnapshot, type InvitationSubscriptionOptions, type InvitationTarget, type InvitationView, type InviteGrant, type InviteInput, type InviteMethod, type InviteOptions, type InvitePrepared, type InvitePreview, type InvitePreviewInput, type InvocationControls, type InvoiceCheckoutPreparation, type InvoiceCheckoutReconciliation, type InvoiceCheckoutState, type InvoiceCheckoutSummary, type InvoiceDraft, type LineItemV3, type MeMethods, type MeProfile, type MediaMethods, type MemberIdentityProjection, type MemberStatus, type MemberView, type Money, type MoneyParseError, type MoneyParseErrorReason, type MovementActivityEvidence, type NormalizedCapxulOperation, ORGANIZATION_SETUP_REASONS, type ObservationAdapter, type ObservationContext, type ObservationDelivery, type OfferCheckout, type OfferCheckoutPreparation, type OfferedAuthority, type OffersMethods, type OnboardingMethods, type OpenfortBrowserAuth, type OpenfortBrowserSigner, type OpenfortBrowserSignerBootstrap, type OpenfortEmbeddedSignerInput, type OpenfortEmbeddedWalletApi, type OpenfortEmbeddedWalletPort, type OperationResult, type OrgId, type OrgInvitations, type OrgLane, type OrgMe, type OrgMeMethod, type OrgMeOptions, type OrgMethods, type OrgScopedMethods, type OrgView, type OrganizationAccess, type OrganizationAccount, type OrganizationApprovalInput, type OrganizationAuditLogItem, type OrganizationOnboarding, type OrganizationOnboardingInput, type OrganizationOnboardingOptions, type OrganizationPaymentBatchInput, type OrganizationPaymentInput, type OrganizationPaymentItemInput, type OrganizationPaymentRetryPreview, type OrganizationPaymentsMethods, type OrganizationSetup, type OrganizationSetupPage, type OrganizationSetupPageInput, type OrganizationSetupSnapshot, type OwnInvitationsMethod, PAYMENT_DIRECTIONS, PAYMENT_STATUSES, type Page, type PartyId, type PayInvoiceRegisteredInput, type PayRequestRegisteredInput, type Payment, type PaymentActivityEvidence, type PaymentDirection, type PaymentDocumentDownload, type PaymentDocumentKind, type PaymentDocumentOptions, PaymentDocumentOptionsSchema, type PaymentDocumentReadRef, type PaymentDocumentRef, type PaymentDocumentRender, type PaymentDocumentVerification, type PaymentDocumentsMethods, type PaymentInstructionInput, type PaymentMoney, type PaymentPrepared, type PaymentQuote, type PaymentQuoteInput, type PaymentSnapshot, type PaymentStatus, type PaymentSubscriptionOptions, type PaymentTiming, type PaymentType, type PaymentsMethods, type PaymentsPayInput, type PaymentsPayOptions, type PayoutAddress, type PayrollEngagementTerms, type PayrollGroup, type PayrollGroupId, PayrollGroupIdSchema, type PayrollGroupInput, PayrollGroupInputSchema, type PayrollGroupMember, type PayrollGroupsMethods, type PayrollMethods, type PayrollOptions, type PayrollRun, type PayrollRunApprovalInput, type PayrollRunDetail, type PayrollRunId, type PayrollRunItemInput, type PayrollRunSnapshot, type PayrollRunStatus, type PayrollRuns, type PayrollTermsUnit, type Permission, type PermissionApprovalInput, type PermissionAssignInput, type PermissionAssignmentEffect, type PermissionChangeInput, type PermissionCommandSnapshot, type PermissionCommandView, type PermissionCreateInput, type PermissionId, type PermissionIntent, type PermissionMethods, type PermissionOptions, type PermissionPolicyChange, type PermissionPrepared, type PermissionReadResult, type PermissionReplaceInput, type PermissionReplacementPreview, type PermissionRevokeInput, type PermissionWrite, type PersonOnboarding, type PersonOnboardingInput, type PostHogObservabilityClient, type PostHogObservabilityOptions, type PrepareInvoiceCheckoutExecutionInput, type PrepareOfferCheckoutExecutionInput, type PrepareRequestCheckoutExecutionInput, type PreparedInvoiceCheckoutExecution, type PreparedOfferCheckoutExecution, type PreparedRequestCheckoutExecution, type Profile, type Rate, type RateSource, type Readiness, type ReadyAccountLifecycle, type RecipientResolution, type RedirectApprovalInput, type Ref, type RequestApprovalInput, type RequestCheckoutPreparation, type RequestCheckoutReconciliation, type RequestCheckoutState, type RequestCheckoutSummary, type RequestPaymentConfirmation, type RequestPaymentTerms, type ResolvedTarget, type RetryApprovalInput, type RevertSummary, type RoleDefinition, type RoleKey, type RoleView, type SdkFailureObservation, type Session, type SettlementToken, type SetupIssue, type SignerStatus, type SignerStatusStore, type SmartAccount, type SmartAccountMethods, type SpendingScope, type StateLabel, type SubmittedPermissionExecution, type SupportingReceiptInput, type SystemHealth, type SystemMethods, TOKENS, type TargetReference, type TargetsMethods, type TelemetryPort, type TesterKind, type Unsubscribe, type UploadImageResult, type Valuation, type VerificationAnswers, type VerificationInput, type VerificationMethods, type VerificationOperations, type VerificationPersonInput, type VerificationQuestion, type VerificationStatus, assetSymbolFor, captureException, captureExceptionSync, checkoutUrl, createCapxulClient, createOpenfortBrowserSigner, decodePayrollRunInput, decodePermissionIntent, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatAssetAmount, formatMoney, inboxPhase, injectedWalletSigner, isCapxulError, isCapxulOperation, isCheckoutSettlementConsumed, isClaimed, isMoneyParseError, isRestoring, isSettingUpLifecycle, localPrivateKeyAccountProvider, normalizeCapxulOperation, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseAssetAmount, parseMoney, paymentPhase, positionPeg, postHogObservability, requestPhase, requireAsset, destination as resolveIdentityDestination, toAccountId, toAssetId, toBudgetId, toCountryCode, toCurrencyCode, toAddress as toEvmAddress, toHandle, toOrgId, toPartyId, toPayrollGroupId, toPermissionAssignmentId, toPermissionId, toRaw, valueActivitySummary, valueIn };
package/dist/index.mjs ADDED
@@ -0,0 +1,348 @@
1
+ import { m as decodePermissionIntent } from "./organizations-BMEWnFEC.mjs";
2
+ import { $ as parseAssetAmount, $r as CAPXUL_ERROR_CODES, Ar as toCurrencyCode, Bi as isCapxulError, Bn as FixedOfferDraftSchema, Cr as toBudgetId, Dn as isCapxulOperation, En as CAPXUL_OPERATIONS, F as decodePayrollRunInput, G as isCheckoutSettlementConsumed, I as toPayrollGroupId, It as TOKENS, Jn as ORGANIZATION_SETUP_REASONS, Jt as SDK_VERSION, Mr as EVM_ADDRESS_RE, On as normalizeCapxulOperation, Or as currencySymbolFor, Pr as toAddress, Q as formatAssetAmount, Qn as toOrgId, Qt as safeExceptionLabel, Ri as Errors, Rn as PayrollGroupIdSchema, S as valueIn, Tr as toPermissionId, Vi as FAILURE_MODES, Vt as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, Xn as CHAIN_UPSTREAMS, Xt as normalizeExceptionOperation, Yt as normalizeExceptionErrorKind, Z as assetSymbolFor, Zt as projectSdkException, _n as toPartyId, a as paymentPhase, at as fingerprintPaymentIntent, br as PAYMENT_STATUSES, cn as signerFailure, ei as EXPECTED_OPERATION_OUTCOMES, en as isSettingUpLifecycle, et as requireAsset, fn as toCountryCode, fr as toAccountId, gn as toHandle, hn as HANDLE_RE, i as inboxPhase, kr as toAssetId, ln as resolveFailureMode, nt as isMoneyParseError, o as requestPhase, pr as PaymentDocumentOptionsSchema, qt as EXCEPTION_MESSAGE, rn as injectedWalletSigner, rt as parseMoney, tt as toRaw, wn as EXCEPTION_EVENT_NAME, wr as toPermissionAssignmentId, wt as CAPXUL_PAYMENTS_V2_ADDRESS, x as valueActivitySummary, y as positionPeg, yr as PAYMENT_DIRECTIONS, zi as CapxulError, zn as PayrollGroupInputSchema, zt as failureDetail } from "./access-CNha7G9T.mjs";
3
+ import { d as devPrivateKeySigner, f as createOpenfortBrowserSigner, h as openfortEmbeddedWalletPort, i as postHogObservability, m as openfortEmbeddedSignerFromWallet, p as embeddedSigner, t as createCapxulClient$1, u as deriveDevPrivateKey } from "./production-Bcjowmxk.mjs";
4
+ import { Effect } from "effect";
5
+ import { privateKeyToAccount } from "viem/accounts";
6
+ //#region src/access/identity/selectors.ts
7
+ /**
8
+ * The post-auth destination and provisioning lane merge as one total switch
9
+ * over the nest. "An active journey outranks default
10
+ * routing; org-list contents never choose a destination" holds by construction:
11
+ * there is no org list in the state, only the ONE active lane.
12
+ */
13
+ const destination = (state) => {
14
+ if (state.phase === "restoring") return null;
15
+ if (state.phase !== "authenticated") return { to: "home" };
16
+ if (!state.profileComplete) return { to: "selectUserType" };
17
+ if (state.account.at === "unknown") return null;
18
+ if (state.account.at !== "claimed") return {
19
+ to: "provisioning",
20
+ scope: "personal"
21
+ };
22
+ const org = state.account.org;
23
+ if (org === null) return { to: "dashboardPersonal" };
24
+ if (org.setup?.status === "ready" && org.observation === "connected" && org.orgId !== null) return {
25
+ to: "dashboardOrganization",
26
+ orgId: org.orgId
27
+ };
28
+ return {
29
+ to: "provisioning",
30
+ scope: "organization",
31
+ orgId: org.orgId
32
+ };
33
+ };
34
+ /**
35
+ * True while the machine has not settled enough to route or to gate on.
36
+ *
37
+ * Every phase is named, so a phase added to the type fails to compile here
38
+ * until someone decides whether it holds or settles. A phase this build does
39
+ * not know that still arrives at run time (a newer actor) holds: it must never
40
+ * redirect a member who is in fact signed in, so the default arm does not
41
+ * throw. Terminal for the account lane is `claimed | failed`.
42
+ *
43
+ * The org lane's own settledness (`ready | failed`) is the route gate's
44
+ * question, not this one: every org lane sits under a CLAIMED account, and
45
+ * `destination()` already names a real screen for each of its positions.
46
+ */
47
+ const isRestoring = (state) => {
48
+ switch (state.phase) {
49
+ case "signed_out":
50
+ case "otp_sending":
51
+ case "otp_pending":
52
+ case "otp_verifying":
53
+ case "signing_out":
54
+ case "faulted": return false;
55
+ case "authenticated": return state.account.at !== "claimed" && state.account.at !== "failed";
56
+ case "restoring": return true;
57
+ default: return true;
58
+ }
59
+ };
60
+ /** The claimed-account gate as one function. The inlined consumers move onto
61
+ * it in #1521; this ticket ships the selector they move onto. */
62
+ const isClaimed = (state) => state.phase === "authenticated" && state.account.at === "claimed";
63
+ //#endregion
64
+ //#region src/money/format.ts
65
+ function formatMoney(money, options = {}) {
66
+ if (!Number.isInteger(money.decimals) || money.decimals < 0) throw Errors.invalidInput("money.decimals", "must be a non-negative integer");
67
+ const symbol = currencySymbolFor(toCurrencyCode(money.currency));
68
+ const maximumFractionDigits = options.grammar === "code" ? 4 : 2;
69
+ const rounded = roundDecimal(money.value, money.decimals, maximumFractionDigits);
70
+ const grouped = rounded.integer.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
71
+ const signed = `${rounded.negative ? "-" : ""}${grouped}`;
72
+ if (options.grammar === "code") {
73
+ if (!rounded.hadFraction) return `${signed} ${money.currency}`;
74
+ let displayedFraction = rounded.fraction;
75
+ while (displayedFraction.length > 2 && displayedFraction.endsWith("0")) displayedFraction = displayedFraction.slice(0, -1);
76
+ return `${signed}.${displayedFraction} ${money.currency}`;
77
+ }
78
+ return `${symbol}${signed}.${rounded.fraction}`;
79
+ }
80
+ function roundDecimal(value, decimals, maximumFractionDigits) {
81
+ const match = /^(-?)(\d+)(?:\.(\d+))?$/.exec(value);
82
+ if (match === null) throw Errors.invalidInput("money.value", "must be a base-10 decimal string");
83
+ const integer = match[2] ?? "0";
84
+ const sourceFraction = match[3] ?? "";
85
+ if (sourceFraction.length > decimals) throw Errors.invalidInput("money.value", "fraction exceeds money.decimals");
86
+ const scale = 10n ** BigInt(maximumFractionDigits);
87
+ const keptFraction = sourceFraction.slice(0, maximumFractionDigits).padEnd(maximumFractionDigits, "0");
88
+ let scaled = BigInt(integer) * scale + BigInt(keptFraction || "0");
89
+ if ((sourceFraction[maximumFractionDigits] ?? "0") >= "5") scaled += 1n;
90
+ return {
91
+ negative: match[1] === "-",
92
+ integer: (scaled / scale).toString(),
93
+ fraction: (scaled % scale).toString().padStart(maximumFractionDigits, "0"),
94
+ hadFraction: /[1-9]/.test(sourceFraction)
95
+ };
96
+ }
97
+ //#endregion
98
+ //#region src/signing/account-providers.ts
99
+ function localPrivateKeyAccountProvider(input) {
100
+ const account = privateKeyToAccount(input.privateKey);
101
+ const address = toAddress(account.address);
102
+ return {
103
+ source: "local-private-key",
104
+ async getAddress() {
105
+ return {
106
+ ok: true,
107
+ value: address
108
+ };
109
+ },
110
+ async getDeployAccount() {
111
+ return {
112
+ ok: true,
113
+ value: account
114
+ };
115
+ }
116
+ };
117
+ }
118
+ function eip1193AccountProvider(input) {
119
+ let cachedAddress = null;
120
+ let inFlight = null;
121
+ const getAddress = async () => {
122
+ if (cachedAddress !== null) return {
123
+ ok: true,
124
+ value: cachedAddress
125
+ };
126
+ if (inFlight !== null) return inFlight;
127
+ inFlight = (async () => {
128
+ try {
129
+ const first = firstAccount(await input.provider.request({ method: "eth_accounts" }));
130
+ if (first === null) return {
131
+ ok: false,
132
+ error: Errors.smartAccountMissing("eip1193-account")
133
+ };
134
+ const address = toAddress(first);
135
+ cachedAddress = address;
136
+ return {
137
+ ok: true,
138
+ value: address
139
+ };
140
+ } catch (err) {
141
+ return {
142
+ ok: false,
143
+ error: signerFailure("injected-eip1193", "eth_accounts", err)
144
+ };
145
+ } finally {
146
+ inFlight = null;
147
+ }
148
+ })();
149
+ return inFlight;
150
+ };
151
+ return {
152
+ source: "injected-eip1193",
153
+ getAddress,
154
+ async getDeployAccount() {
155
+ return {
156
+ ok: false,
157
+ error: Errors.notImplemented("Eip1193AccountProvider", "getDeployAccount")
158
+ };
159
+ }
160
+ };
161
+ }
162
+ function firstAccount(value) {
163
+ if (!Array.isArray(value)) return null;
164
+ const first = value[0];
165
+ return typeof first === "string" ? first : null;
166
+ }
167
+ //#endregion
168
+ //#region src/platform/client/create.ts
169
+ /** Consumer-facing factory — accepts only production-meaningful inputs (#326). */
170
+ async function createCapxulClient(input) {
171
+ return createCapxulClient$1(input);
172
+ }
173
+ //#endregion
174
+ //#region src/observability/telemetry/stack-frame-parser.ts
175
+ /**
176
+ * Regex for V8/Chrome stack trace frame lines.
177
+ * Matches:
178
+ * `at functionName (url:line:col)`
179
+ * `at url:line:col`
180
+ * `at async functionName (url:line:col)`
181
+ * `at new ClassName (url:line:col)`
182
+ */
183
+ const V8_FRAME_RE = /^\s*at\s+(?:(.+?)\s+\()?(?:(.+?)(?::(\d+):(\d+))?|(.+?))\)?\s*$/;
184
+ function isNonUrlName(name) {
185
+ return name === "<anonymous>" || name.startsWith("eval") || name.startsWith("new ") || name.startsWith("async ");
186
+ }
187
+ /**
188
+ * Parse a V8/Chrome-style stack trace string into PostHog `ExceptionFrame` objects.
189
+ * Returns an empty array when `error.stack` is absent or empty.
190
+ *
191
+ * Handles:
192
+ * - Standard `at functionName (url:line:col)`
193
+ * - Bare `at url:line:col` (no function name)
194
+ * - `at async functionName (url:line:col)`
195
+ * - `at new ClassName (url:line:col)`
196
+ * - Native frames: `at Array.forEach (<anonymous>)`
197
+ */
198
+ function parseV8StackFrames(error) {
199
+ const stack = error.stack;
200
+ if (stack === void 0 || stack === null || stack === "") return [];
201
+ const lines = stack.split("\n");
202
+ const frames = [];
203
+ for (const line of lines) {
204
+ const trimmed = line.trim();
205
+ if (!trimmed.startsWith("at ")) continue;
206
+ const match = V8_FRAME_RE.exec(trimmed);
207
+ if (match === null) continue;
208
+ if (match[1] !== void 0) frames.push({
209
+ function: match[1],
210
+ filename: match[2],
211
+ lineno: match[3] !== void 0 ? Number(match[3]) : null,
212
+ colno: match[4] !== void 0 ? Number(match[4]) : null
213
+ });
214
+ else if (match[2] !== void 0 && !isNonUrlName(match[2])) frames.push({
215
+ function: "<anonymous>",
216
+ filename: match[2],
217
+ lineno: match[3] !== void 0 ? Number(match[3]) : null,
218
+ colno: match[4] !== void 0 ? Number(match[4]) : null
219
+ });
220
+ else frames.push({
221
+ function: match[1] ?? match[2] ?? match[5] ?? "<anonymous>",
222
+ filename: match[2] ?? match[5] ?? "<anonymous>",
223
+ lineno: match[3] !== void 0 ? Number(match[3]) : null,
224
+ colno: match[4] !== void 0 ? Number(match[4]) : null
225
+ });
226
+ }
227
+ return frames;
228
+ }
229
+ /** Fixed, leak-safe frame used when the error carries no parseable stack. */
230
+ const SDK_BOUNDARY_FILENAME = "capxul-sdk-observation://boundary";
231
+ /**
232
+ * Build PostHog's `$exception_list` (always a single entry). Error Tracking
233
+ * groups on `type`, so it is ALWAYS present (the CapxulError code) — the
234
+ * previous `[{ frames }]` shape omitted it and PostHog dropped the event as
235
+ * "missing field `type`". When the error has no parseable stack, a synthetic
236
+ * boundary frame stands in so the event still ingests as a real Issue (#1031).
237
+ */
238
+ function buildExceptionList(input) {
239
+ const frames = input.frames.length > 0 ? input.frames : [{
240
+ filename: SDK_BOUNDARY_FILENAME,
241
+ function: input.operation ?? "unknown",
242
+ lineno: 1,
243
+ colno: 1
244
+ }];
245
+ return [{
246
+ type: input.type,
247
+ value: input.value,
248
+ mechanism: {
249
+ handled: true,
250
+ type: "capxul_sdk_boundary"
251
+ },
252
+ stacktrace: { frames }
253
+ }];
254
+ }
255
+ //#endregion
256
+ //#region src/observability/telemetry/capture-exception.ts
257
+ /**
258
+ * Capture an error as a `$exception` event through the telemetry port,
259
+ * formatted for PostHog Error Tracking.
260
+ *
261
+ * Parses stack traces into `$exception_list` format, extracts structured
262
+ * metadata from CapxulError objects, and supplements with context props.
263
+ * Fire-and-forget: telemetry defects are silently swallowed.
264
+ * Returns `Effect<void, never>` for use in Effect pipelines; the underlying
265
+ * adapter work is synchronous, so callers outside Effect contexts can
266
+ * use `Effect.runSync`.
267
+ */
268
+ function captureException(telemetry, error, context) {
269
+ return Effect.catchDefect(Effect.sync(() => {
270
+ const frames = error instanceof Error ? parseV8StackFrames(error) : [];
271
+ const capxulError = isCapxulError(error) ? error : null;
272
+ const errorCode = normalizeExceptionErrorKind(capxulError?.code ?? context?.capxul_error_code);
273
+ const { chain_provider_message: _providerMessage, chain_revert_args: _revertArguments, ...safeDetail } = failureDetail(error) ?? {};
274
+ const operation = normalizeExceptionOperation(context?.operation ?? safeDetail.provider_operation);
275
+ const failureMode = resolveFailureMode(error, context?.failure_mode);
276
+ const detail = {
277
+ ...safeDetail,
278
+ failure_mode: failureMode
279
+ };
280
+ const properties = {
281
+ capxul_error_code: errorCode,
282
+ ...detail,
283
+ error_message: EXCEPTION_MESSAGE,
284
+ error_details: detail,
285
+ error_cause: detail.reason ?? failureMode,
286
+ layer: safeExceptionLabel(capxulError?.layer ?? context?.layer),
287
+ provider: detail.provider ?? safeExceptionLabel(context?.provider)
288
+ };
289
+ for (const key of Object.keys(properties)) if (properties[key] === void 0) delete properties[key];
290
+ const props = projectSdkException({
291
+ properties,
292
+ sdkVersion: SDK_VERSION,
293
+ operation,
294
+ errorKind: errorCode,
295
+ failureMode,
296
+ message: EXCEPTION_MESSAGE,
297
+ issueDescription: detail.reason ?? failureMode,
298
+ ...detail.chain_upstream === void 0 ? {} : { chainUpstream: detail.chain_upstream },
299
+ ...detail.chain_method === void 0 ? {} : { chainMethod: detail.chain_method },
300
+ ...detail.chain_http_status === void 0 ? {} : { chainHttpStatus: detail.chain_http_status },
301
+ ...detail.chain_rpc_code === void 0 ? {} : { chainRpcCode: detail.chain_rpc_code },
302
+ exceptionList: buildExceptionList({
303
+ type: errorCode,
304
+ value: EXCEPTION_MESSAGE,
305
+ operation,
306
+ frames
307
+ })
308
+ });
309
+ return telemetry.emit({
310
+ name: EXCEPTION_EVENT_NAME,
311
+ props
312
+ });
313
+ }).pipe(Effect.flatten), () => Effect.void);
314
+ }
315
+ /**
316
+ * Synchronous fire-and-forget capture. Runs the Effect inline with
317
+ * `Effect.runSync` so callers outside an Effect context can report errors
318
+ * without awaiting. Core SDK public methods use the assembled observation
319
+ * boundary instead.
320
+ */
321
+ function captureExceptionSync(telemetry, error, context) {
322
+ try {
323
+ Effect.runSync(captureException(telemetry, error, context));
324
+ } catch {}
325
+ }
326
+ //#endregion
327
+ //#region ../protocol/src/requests/model.ts
328
+ /** Build a reference URL. The consumer still reads authoritative terms from the backend. */
329
+ function checkoutUrl(frontendOrigin, reference) {
330
+ const origin = new URL(frontendOrigin);
331
+ const loopback = [
332
+ "localhost",
333
+ "127.0.0.1",
334
+ "[::1]"
335
+ ].includes(origin.hostname);
336
+ if (origin.protocol !== "https:" && !(origin.protocol === "http:" && loopback) || origin.username !== "" || origin.password !== "" || origin.pathname !== "/" || origin.search !== "" || origin.hash !== "") throw new TypeError("Provide an approved frontend origin");
337
+ const id = reference.kind === "offer" ? reference.offerId : reference.linkToken;
338
+ if (!/^[A-Za-z0-9_-]{1,128}$/u.test(id)) throw new TypeError("Invalid checkout reference");
339
+ const route = reference.kind === "offer" ? "offers" : reference.kind === "request" ? "requests" : "invoices";
340
+ const result = new URL(`/checkout/${route}/${encodeURIComponent(id)}`, origin);
341
+ if (reference.kind === "offer" && reference.quantity !== void 0) {
342
+ if (!Number.isSafeInteger(reference.quantity) || reference.quantity < 1) throw new TypeError("Invalid checkout quantity");
343
+ result.searchParams.set("quantity", String(reference.quantity));
344
+ }
345
+ return result.href;
346
+ }
347
+ //#endregion
348
+ export { CAPXUL_ERROR_CODES, CAPXUL_OPERATIONS, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CHAIN_UPSTREAMS, CapxulError, EVM_ADDRESS_RE, EXPECTED_OPERATION_OUTCOMES, Errors, FAILURE_MODES, FixedOfferDraftSchema, HANDLE_RE, ORGANIZATION_SETUP_REASONS, PAYMENT_DIRECTIONS, PAYMENT_STATUSES, PaymentDocumentOptionsSchema, PayrollGroupIdSchema, PayrollGroupInputSchema, TOKENS, assetSymbolFor, captureException, captureExceptionSync, checkoutUrl, createCapxulClient, createOpenfortBrowserSigner, decodePayrollRunInput, decodePermissionIntent, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatAssetAmount, formatMoney, inboxPhase, injectedWalletSigner, isCapxulError, isCapxulOperation, isCheckoutSettlementConsumed, isClaimed, isMoneyParseError, isRestoring, isSettingUpLifecycle, localPrivateKeyAccountProvider, normalizeCapxulOperation, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseAssetAmount, parseMoney, paymentPhase, positionPeg, postHogObservability, requestPhase, requireAsset, destination as resolveIdentityDestination, toAccountId, toAssetId, toBudgetId, toCountryCode, toCurrencyCode, toAddress as toEvmAddress, toHandle, toOrgId, toPartyId, toPayrollGroupId, toPermissionAssignmentId, toPermissionId, toRaw, valueActivitySummary, valueIn };
@@ -0,0 +1,50 @@
1
+ import { Bo as oauthBearerAuthClient, Go as AuthCacheError, Jo as CachedJwt, Ko as AuthCachePort, Ss as AuthSession, ba as CapxulSigner, qo as AuthCachePortTag, zo as OAuthBearerAuthClientInput } from "../index-Czjrh-Fo.mjs";
2
+ import { Effect, FileSystem, Layer, Path } from "effect";
3
+ import { Hex } from "viem";
4
+ //#region src/access/auth-cache/file-system.d.ts
5
+ type FileSystemRuntime = FileSystem.FileSystem | Path.Path;
6
+ export declare class FileSystemAuthCacheAdapter implements AuthCachePort {
7
+ private readonly path;
8
+ private readonly runtime;
9
+ readonly getSession: Effect.Effect<AuthSession | null, AuthCacheError>;
10
+ readonly setSession: (session: AuthSession) => Effect.Effect<void, AuthCacheError>;
11
+ readonly clearSession: Effect.Effect<void, AuthCacheError>;
12
+ readonly getJwt: Effect.Effect<CachedJwt | null, AuthCacheError>;
13
+ readonly setJwt: (jwt: CachedJwt) => Effect.Effect<void, AuthCacheError>;
14
+ readonly clearJwt: Effect.Effect<void, AuthCacheError>;
15
+ constructor(path: string, runtime?: Layer.Layer<FileSystemRuntime>);
16
+ private read;
17
+ private write;
18
+ private run;
19
+ }
20
+ export declare function FileSystemAuthCacheLayer(input: {
21
+ readonly path: string;
22
+ readonly runtime?: Layer.Layer<FileSystemRuntime>;
23
+ }): Layer.Layer<AuthCachePortTag, AuthCacheError>;
24
+ //#endregion
25
+ //#region src/node/index.d.ts
26
+ export interface DetectNodeAuthCacheAdapterOptions {
27
+ readonly authCachePath?: string;
28
+ readonly resolveHomeDirectory?: () => string;
29
+ }
30
+ /**
31
+ * Node `CapxulSigner` backed by a raw private key. Signs the EIP-712 `SafeOp`
32
+ * digest the backend returns for a prepared deployment UserOperation. The
33
+ * The reference CLI builds this from `DEPLOYER_PRIVATE_KEY` for live tests.
34
+ */
35
+ export declare function localPrivateKeySigner(input: {
36
+ readonly privateKey: Hex;
37
+ }): CapxulSigner;
38
+ /**
39
+ * Node-aware auth-cache detection. Mirrors the historic default order:
40
+ * 1. Browser localStorage → BrowserAuthCacheAdapter
41
+ * 2. Node.js process → FileSystemAuthCacheAdapter
42
+ * (`~/.config/capxul/auth-cache.json`)
43
+ * 3. Neither detected → InMemoryAuthCacheAdapter
44
+ *
45
+ * Use this from a Node entrypoint and pass the result to
46
+ * `createCapxulClient({ authCache })` for on-disk session persistence.
47
+ */
48
+ export declare function detectNodeAuthCacheAdapter(options?: DetectNodeAuthCacheAdapterOptions): AuthCachePort;
49
+ //#endregion
50
+ export { type OAuthBearerAuthClientInput, oauthBearerAuthClient };
@@ -0,0 +1,147 @@
1
+ import { Ai as parseCachedJwt, Di as InMemoryAuthCacheAdapter, Ei as globalLocalStorage, Gi as AuthCacheError, Ki as AuthCachePortTag, Oi as BrowserAuthCacheAdapter, Pr as toAddress, Ui as isRecord, ii as oauthBearerAuthClient, ki as parseAuthSession } from "../access-CNha7G9T.mjs";
2
+ import { Effect, FileSystem, Layer, Option, Path } from "effect";
3
+ import { privateKeyToAccount } from "viem/accounts";
4
+ import * as os from "node:os";
5
+ import { join } from "node:path";
6
+ import { NodeFileSystem, NodePath } from "@effect/platform-node";
7
+ //#region src/access/auth-cache/file-system.ts
8
+ function emptyPayload() {
9
+ return {
10
+ session: null,
11
+ jwt: null
12
+ };
13
+ }
14
+ const nodeFileSystemRuntime = Layer.merge(NodeFileSystem.layer, NodePath.layer);
15
+ var FileSystemAuthCacheAdapter = class {
16
+ path;
17
+ runtime;
18
+ getSession;
19
+ setSession;
20
+ clearSession;
21
+ getJwt;
22
+ setJwt;
23
+ clearJwt;
24
+ constructor(path, runtime = nodeFileSystemRuntime) {
25
+ this.path = path;
26
+ this.runtime = runtime;
27
+ this.getSession = this.run("getSession", this.read().pipe(Effect.map((payload) => payload.session)));
28
+ this.setSession = (session) => this.run("setSession", Effect.gen({ self: this }, function* () {
29
+ const cur = yield* this.read();
30
+ yield* this.write({
31
+ session,
32
+ jwt: cur.jwt
33
+ });
34
+ }));
35
+ this.clearSession = this.run("clearSession", Effect.gen({ self: this }, function* () {
36
+ const cur = yield* this.read();
37
+ yield* this.write({
38
+ session: null,
39
+ jwt: cur.jwt
40
+ });
41
+ }));
42
+ this.getJwt = this.run("getJwt", this.read().pipe(Effect.map((payload) => payload.jwt)));
43
+ this.setJwt = (jwt) => this.run("setJwt", Effect.gen({ self: this }, function* () {
44
+ const cur = yield* this.read();
45
+ yield* this.write({
46
+ session: cur.session,
47
+ jwt
48
+ });
49
+ }));
50
+ this.clearJwt = this.run("clearJwt", Effect.gen({ self: this }, function* () {
51
+ const cur = yield* this.read();
52
+ yield* this.write({
53
+ session: cur.session,
54
+ jwt: null
55
+ });
56
+ }));
57
+ }
58
+ read() {
59
+ return Effect.gen({ self: this }, function* () {
60
+ const fs = yield* FileSystem.FileSystem;
61
+ if (!(yield* fs.exists(this.path))) return emptyPayload();
62
+ const raw = yield* fs.readFileString(this.path, "utf-8");
63
+ const parsed = Option.getOrUndefined(yield* Effect.try(() => JSON.parse(raw)).pipe(Effect.option));
64
+ if (!isRecord(parsed)) return emptyPayload();
65
+ return {
66
+ session: parseAuthSession(parsed.session),
67
+ jwt: parseCachedJwt(parsed.jwt)
68
+ };
69
+ });
70
+ }
71
+ write(payload) {
72
+ return Effect.gen({ self: this }, function* () {
73
+ const fs = yield* FileSystem.FileSystem;
74
+ const dir = (yield* Path.Path).dirname(this.path);
75
+ if (!(yield* fs.exists(dir))) yield* fs.makeDirectory(dir, {
76
+ recursive: true,
77
+ mode: 448
78
+ });
79
+ yield* fs.writeFileString(this.path, JSON.stringify(payload), { mode: 384 });
80
+ yield* fs.chmod(this.path, 384);
81
+ });
82
+ }
83
+ run(operation, effect) {
84
+ return effect.pipe(Effect.mapError((cause) => toAuthCacheError(operation, cause)), Effect.provide(this.runtime));
85
+ }
86
+ };
87
+ function FileSystemAuthCacheLayer(input) {
88
+ return Layer.effect(AuthCachePortTag, Effect.sync(() => new FileSystemAuthCacheAdapter(input.path, input.runtime)).pipe(Effect.mapError((cause) => toAuthCacheError("initialize", cause))));
89
+ }
90
+ function toAuthCacheError(operation, cause) {
91
+ return new AuthCacheError({
92
+ operation,
93
+ cause
94
+ });
95
+ }
96
+ //#endregion
97
+ //#region src/node/index.ts
98
+ /**
99
+ * Node `CapxulSigner` backed by a raw private key. Signs the EIP-712 `SafeOp`
100
+ * digest the backend returns for a prepared deployment UserOperation. The
101
+ * The reference CLI builds this from `DEPLOYER_PRIVATE_KEY` for live tests.
102
+ */
103
+ function localPrivateKeySigner(input) {
104
+ const account = privateKeyToAccount(input.privateKey);
105
+ return {
106
+ source: "local-private-key",
107
+ async getAddress() {
108
+ return toAddress(account.address);
109
+ },
110
+ async signUserOpHash(hash) {
111
+ return account.sign({ hash });
112
+ }
113
+ };
114
+ }
115
+ /**
116
+ * Node-aware auth-cache detection. Mirrors the historic default order:
117
+ * 1. Browser localStorage → BrowserAuthCacheAdapter
118
+ * 2. Node.js process → FileSystemAuthCacheAdapter
119
+ * (`~/.config/capxul/auth-cache.json`)
120
+ * 3. Neither detected → InMemoryAuthCacheAdapter
121
+ *
122
+ * Use this from a Node entrypoint and pass the result to
123
+ * `createCapxulClient({ authCache })` for on-disk session persistence.
124
+ */
125
+ function detectNodeAuthCacheAdapter(options = {}) {
126
+ const localStorage = globalLocalStorage();
127
+ if (localStorage !== void 0) return new BrowserAuthCacheAdapter(localStorage);
128
+ if (globalThis.process?.versions?.node !== void 0) {
129
+ const authCachePath = normalizeConfiguredAuthCachePath(options.authCachePath) ?? resolveDefaultAuthCachePath(options.resolveHomeDirectory ?? os.homedir);
130
+ if (authCachePath !== null) return new FileSystemAuthCacheAdapter(authCachePath);
131
+ }
132
+ return new InMemoryAuthCacheAdapter();
133
+ }
134
+ function normalizeConfiguredAuthCachePath(path) {
135
+ if (path === void 0) return null;
136
+ const trimmed = path.trim();
137
+ return trimmed.length > 0 ? trimmed : null;
138
+ }
139
+ function resolveDefaultAuthCachePath(resolveHomeDirectory) {
140
+ try {
141
+ return join(resolveHomeDirectory(), ".config", "capxul", "auth-cache.json");
142
+ } catch {
143
+ return null;
144
+ }
145
+ }
146
+ //#endregion
147
+ export { FileSystemAuthCacheAdapter, FileSystemAuthCacheLayer, detectNodeAuthCacheAdapter, localPrivateKeySigner, oauthBearerAuthClient };