@capxul/sdk 2.3.2 → 2.5.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 +22 -0
- package/dist/{InMemoryAuthCacheAdapter-qMpBOGb3.mjs → InMemoryAuthCacheAdapter-D5Cv0yz0.mjs} +7 -1
- package/dist/{create-capxul-client-DgvnboPR.mjs → create-capxul-client-Btl4qyNC.mjs} +1623 -1245
- package/dist/index.d.mts +39 -4
- package/dist/index.mjs +94 -10
- package/dist/node/index.d.mts +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/{observation-CLhrvkF6.d.mts → observation-CyNjyQxv.d.mts} +233 -31
- package/dist/{signer-BejoR3bA.d.mts → signer-CRzTIrau.d.mts} +3 -2
- package/dist/testing/index.d.mts +1 -1
- package/dist/testing/index.mjs +2 -2
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as
|
|
1
|
+
import { B as OrgId, C as Address, N as CountryCode, O as AuthSession, S as AccountId, U as PayrollGroupId, V as PartyId, W as PayrollRunId, Y as RoleKey, a as SignerStatusStore, at as CapxulErrorDetails, c as AccountProviderSource, ct as FailureMode, d as eip1193AccountProvider, et as toAddress, f as localPrivateKeyAccountProvider, g as SmartAccount, h as Session, i as SignerStatus, it as CapxulErrorCode, j as BudgetId, k as AuthUserId, l as AccountRequirement, lt as isCapxulError, m as Profile, n as CapxulSigner, nt as CAPXUL_ERROR_CODES, o as injectedWalletSigner, ot as Errors, p as CapxulResult, r as Eip1193RequestProvider, rt as CapxulError, s as AccountProvider, t as CapxulDigestSigner, tt as toCountryCode, u as Eip1193Provider, x as Account, z as Money } from "./signer-CRzTIrau.mjs";
|
|
2
|
+
import { $ as PermissionChangeInput, $n as Readiness, $t as MovementActivityEvidence, A as OrgView, An as IdentityMethods, At as ActivityKind, B as PayrollGroupMember, Bn as PAYMENT_DIRECTIONS, Bt as DepositInstructions, C as DetectPendingOrgInvitationsResult, Cn as ResolvedTarget, Ct as InboxItem, D as OrgMethods, Dn as AccountLifecycle, Dt as ActivityDetail, E as MemberView, En as fingerprintPaymentIntent, Et as ActivityAnnotationInput, F as RoleSpendCap, Fn as ActorRef, Ft as ActivityReference, G as PayrollRunItemInput, Gt as DestinationPayload, H as PayrollMethods, Hn as PaymentStatus$1, Ht as DestinationAddInput, I as RoleView, In as CurrentHoldings, It as ActivitySummary, J as OrganizationPaymentBatchInput, Jn as CAPXUL_PAYMENTS_V2_ADDRESS, Jt as DestinationsMethods, K as PayrollRunStatus, Kt as DestinationRail, L as AuthorizeRunInput, Ln as Permission, Lt as ActivitySummaryParams, M as OrganizationAuditLogItem, Mn as AuthMethods, Mt as ActivityMethods, N as ResendInviteTokenInput, Nn as OrgLifecycle, Nt as ActivityPage, O as OrgScopedMethods, On as AccountSetupStep, Ot as ActivityFilter, P as RoleDefinition, Pn as OrgSetupStep, Pt as ActivityRange, Q as PermissionAssignInput, Qn as OrgLane, Qt as MeProfile, R as PayrollGroup, Rn as SubmittedPermissionExecution, Rt as ActivitySummaryTotal, S as CreateOrgInput, Sn as Ref, St as InboxApproveInput, T as MemberStatus, Tn as TargetsMethods, Tt as ActivityAnnotation, U as PayrollOptions, Un as RequestStatus, Ut as DestinationKind, V as PayrollGroupsMethods, Vn as PAYMENT_STATUSES, Vt as Destination, W as PayrollRun, Wt as DestinationListInput, X as OrganizationPaymentItemInput, Xn as IdentityEvent, Xt as HandlesMethods, Y as OrganizationPaymentInput, Yn as Destination$1, Yt as FinancialOpsMethods, Z as OrganizationPaymentsMethods, Zn as IdentityState, Zt as MeMethods, _ as SystemMethods, _n as PaymentType, _t as ActorRequestsMethods, a as SdkFailureObservation, an as PayeesMethods, ar as InvocationControls, at as PermissionReadResult, b as CurrentUserContext, bn as RecipientResolution, bt as AddressBookLabelInput, c as PostHogObservabilityOptions, cn as PaymentDirection, ct as OrgMeMethod, d as CreateCapxulClientInput, dn as PaymentDocumentRender, dt as AccountMethods, en as OfframpMethods, er as StateLabel, et as PermissionCreateInput, f as IdentityProfileDetails, fn as PaymentDocumentVerification, ft as ActorProfile, g as Holding, gn as PaymentTiming, gt as ActorRequestIssueInput, h as HoldingsMethods, hn as PaymentStatus, ht as ActorRequest, i as ObservationDelivery, in as Payee, ir as IdentityTransition, it as PermissionRevokeInput, j as OrganizationAccount, jn as SmartAccountMethods, jt as ActivityListParams, k as OrgTemplate, kn as isSettingUpLifecycle, kt as ActivityItem, l as postHogObservability, ln as PaymentDocumentKind, lt as OrgMeOptions, m as IdentityRuntimeSendResult, mn as PaymentMoney, mt as ActorRelationshipMethods, n as ObservationAdapter, nn as OfframpQuoteInput, nr as isClaimed, nt as PermissionOptions, o as HostObservability, on as Payment, ot as Budget, p as IdentityRuntime, pn as PaymentDocumentsMethods, pt as ActorProfileMethods, q as PayrollRuns, qn as TelemetryPort, qt as DestinationRemoveInput, r as ObservationContext, rn as OfframpStatus, rr as isRestoring, rt as PermissionReplaceInput, s as PostHogObservabilityClient, sn as PaymentActivityEvidence, st as OrgMe, t as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, tn as OfframpQuote, tr as destination, tt as PermissionMethods, u as CapxulClient, un as PaymentDocumentRef, ut as AccountsMethods, v as SystemHealth, vn as PaymentsMethods, vt as AddressBookAddInput, w as InviteMemberInput, wn as TargetReference, wt as InboxMethods, x as CurrentUserMethods, xn as RecipientResolutionKind, xt as AddressBookMethods, y as MediaMethods, yn as PaymentsPayInput, yt as AddressBookEntry, z as PayrollGroupInput, zn as InboxStatus, zt as ActorReference } from "./observation-CyNjyQxv.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/activity/phase.d.ts
|
|
8
|
+
interface ActivityPhase {
|
|
9
|
+
/** The row is in a final state. No subsequent status change occurs. */
|
|
10
|
+
readonly terminal: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The result of the final state. It is `null` when `terminal` is false.
|
|
13
|
+
*
|
|
14
|
+
* - `good` — the row completed as intended (settled, paid).
|
|
15
|
+
* - `bad` — the row ended, but it did not complete (failed, declined,
|
|
16
|
+
* expired).
|
|
17
|
+
* - `neutral` — a participant stopped the row on purpose (cancelled).
|
|
18
|
+
*/
|
|
19
|
+
readonly outcome: "good" | "bad" | "neutral" | null;
|
|
20
|
+
/** The actor who reads this row must do the next step. */
|
|
21
|
+
readonly needsAction: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** Interpret a Payment status. `pending_claim` waits for the actor who reads it. */
|
|
24
|
+
declare function paymentPhase(status: PaymentStatus$1): ActivityPhase;
|
|
25
|
+
/** Interpret a payment Request as its ISSUER sees it. An issuer does not wait for itself. */
|
|
26
|
+
declare function requestPhase(status: RequestStatus): ActivityPhase;
|
|
27
|
+
/** Interpret the same request as its RECIPIENT sees it. `open` waits for the recipient. */
|
|
28
|
+
declare function inboxPhase(status: InboxStatus): ActivityPhase;
|
|
29
|
+
//#endregion
|
|
7
30
|
//#region src/domain/money/format-money.d.ts
|
|
8
|
-
|
|
31
|
+
/**
|
|
32
|
+
* `Money` and the wire-shaped money the activity surface carries
|
|
33
|
+
* (`PaymentMoney`, whose `currency` is an unbranded string) are the same three
|
|
34
|
+
* facts. Accepting both lets an activity row format without a cast; the
|
|
35
|
+
* currency is validated here instead, so an unsupported code fails with the
|
|
36
|
+
* same `INVALID_INPUT` it always did.
|
|
37
|
+
*/
|
|
38
|
+
interface FormattableMoney {
|
|
39
|
+
readonly currency: string;
|
|
40
|
+
readonly value: string;
|
|
41
|
+
readonly decimals: number;
|
|
42
|
+
}
|
|
43
|
+
declare function formatMoney(money: FormattableMoney, options?: {
|
|
9
44
|
readonly grammar?: "symbol" | "code";
|
|
10
45
|
}): string;
|
|
11
46
|
//#endregion
|
|
@@ -168,4 +203,4 @@ declare function captureException(telemetry: TelemetryPort, error: unknown, cont
|
|
|
168
203
|
*/
|
|
169
204
|
declare function captureExceptionSync(telemetry: TelemetryPort, error: unknown, context?: HandledErrorReportContext): void;
|
|
170
205
|
//#endregion
|
|
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
|
|
206
|
+
export { type Account, type AccountId, type AccountLifecycle, type AccountMethods, type AccountProvider, type AccountProviderSource, type AccountRequirement, 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 AuthMethods, type AuthSession, type AuthUserId, type AuthorizeRunInput, 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 Holding, 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 MovementActivityEvidence, 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, PAYMENT_DIRECTIONS, PAYMENT_STATUSES, type PartyId, type Payee, type PayeesMethods, type Payment, type PaymentActivityEvidence, 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 PayrollGroup, type PayrollGroupId, type PayrollGroupInput, type PayrollGroupMember, type PayrollGroupsMethods, type PayrollMethods, type PayrollOptions, type PayrollRun, type PayrollRunId, type PayrollRunItemInput, type PayrollRunStatus, type PayrollRuns, 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, inboxPhase, injectedWalletSigner, isCapxulError, isClaimed, isMoneyParseError, isRestoring, isSettingUpLifecycle, localPrivateKeyAccountProvider, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseMoney, paymentPhase, postHogObservability, requestPhase, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as fingerprintPaymentIntent, B as
|
|
2
|
-
import { C as toDurationMs, D as toJwtToken, E as toEpochSeconds, F as
|
|
1
|
+
import { $ as isClaimed, A as fingerprintPaymentIntent, B as OBSERVATION_CONTEXT_HEADER, C as ClockPortTag, D as AuthClientError, E as authClientPortFromPromiseAdapter, F as copyInvocationObservation, G as CAPXUL_FUNCTIONS, H as sanitizeObservationContext, I as readInvocationObservation, J as CAPXUL_PAYMENTS_V2_ADDRESS, K as BootstrapEnvelope, L as causeChain, M as fromWei, N as isSettingUpLifecycle, O as AuthClientPortTag, P as formatTraceparent, Q as destination, R as injectedWalletSigner, S as ClockError, T as bootstrapErrorFromCapxul, U as PAYMENT_DIRECTIONS, V as encodeObservationContextHeader, W as PAYMENT_STATUSES, X as BASE_SEPOLIA_CHAIN_ID, Y as normalizeBindingEmail, _ as wireChainId, a as observeFailedResult, b as ConvexCallPortTag, c as captureExceptionSync, d as TelemetryPortTag, et as isRestoring, g as accountReadErrorFromCapxul, h as AccountReadPortTag, i as observationContextProps, j as toWei, k as version, l as detectAuthCacheAdapter, m as smartAccountErrorFromCapxul, n as postHogProductTelemetry, o as postHogFailureObservation, p as SmartAccountPortTag, q as EngineeringTelemetryBootstrapPolicy, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, s as captureException, t as assembleCapxulClient, u as PostHogTelemetryLayer, v as IdentityPortTag, w as BootstrapPortTag, x as convexCallErrorFromCapxul, y as identityErrorFromCapxul, z as signerFailure } from "./create-capxul-client-Btl4qyNC.mjs";
|
|
2
|
+
import { B as Errors, C as toDurationMs, D as toJwtToken, E as toEpochSeconds, F as toSessionToken, I as decodeConvexError, L as CAPXUL_ERROR_CODES, N as toPublishableKey, O as toKycTier, P as toRoleKey, R as CapxulError, S as toCurrencyCode, T as toEpochMs, V as isCapxulError, b as toChainId, g as toAllowedOrigin, h as toAddress, k as toOrgId, m as toAccountId, o as AuthCachePortTag, p as currencySymbolFor, v as toAuthUserId, w as toEmail, x as toCountryCode } from "./InMemoryAuthCacheAdapter-D5Cv0yz0.mjs";
|
|
3
3
|
import { keccak256, recoverAddress, stringToHex } from "viem";
|
|
4
4
|
import { Cause, Context, Data, Effect, Exit, Layer, Result, SchemaIssue, SchemaParser, Scope, Tracer } from "effect";
|
|
5
5
|
import { getFunctionName, makeFunctionReference } from "convex/server";
|
|
@@ -8,10 +8,92 @@ import { FetchHttpClient, Headers, HttpClient } from "effect/unstable/http";
|
|
|
8
8
|
import { OtlpExporter, OtlpLogger, OtlpSerialization, OtlpTracer } from "effect/unstable/observability";
|
|
9
9
|
import { ConvexClient } from "convex/browser";
|
|
10
10
|
import { AccountTypeEnum, ChainTypeEnum, EmbeddedState, Openfort, RecoveryMethod, ThirdPartyOAuthProvider } from "@openfort/openfort-js";
|
|
11
|
+
//#region src/domain/activity/phase.ts
|
|
12
|
+
const PENDING = Object.freeze({
|
|
13
|
+
terminal: false,
|
|
14
|
+
outcome: null,
|
|
15
|
+
needsAction: false
|
|
16
|
+
});
|
|
17
|
+
const AWAITING_ACTOR = Object.freeze({
|
|
18
|
+
terminal: false,
|
|
19
|
+
outcome: null,
|
|
20
|
+
needsAction: true
|
|
21
|
+
});
|
|
22
|
+
const COMPLETED = Object.freeze({
|
|
23
|
+
terminal: true,
|
|
24
|
+
outcome: "good",
|
|
25
|
+
needsAction: false
|
|
26
|
+
});
|
|
27
|
+
const FAILED = Object.freeze({
|
|
28
|
+
terminal: true,
|
|
29
|
+
outcome: "bad",
|
|
30
|
+
needsAction: false
|
|
31
|
+
});
|
|
32
|
+
const WITHDRAWN = Object.freeze({
|
|
33
|
+
terminal: true,
|
|
34
|
+
outcome: "neutral",
|
|
35
|
+
needsAction: false
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* The `default` arm of each interpreter below.
|
|
39
|
+
*
|
|
40
|
+
* The `never` parameter keeps the compile-time guarantee: a status that you add
|
|
41
|
+
* to a wire vocabulary and do not add to a switch does not fit here, and the
|
|
42
|
+
* package does not build.
|
|
43
|
+
*
|
|
44
|
+
* The refusal covers run time. A wire status is a type claim about a string
|
|
45
|
+
* that no code narrows, so an unknown status can arrive. This function refuses
|
|
46
|
+
* it. It does not let an `undefined` typed `ActivityPhase` reach a screen,
|
|
47
|
+
* where the first property read fails.
|
|
48
|
+
*/
|
|
49
|
+
function unknownStatus(status) {
|
|
50
|
+
throw Errors.invalidInput("status", "unknown activity status");
|
|
51
|
+
}
|
|
52
|
+
/** Interpret a Payment status. `pending_claim` waits for the actor who reads it. */
|
|
53
|
+
function paymentPhase(status) {
|
|
54
|
+
switch (status) {
|
|
55
|
+
case "pending":
|
|
56
|
+
case "settling":
|
|
57
|
+
case "scheduled":
|
|
58
|
+
case "streaming": return PENDING;
|
|
59
|
+
case "pending_claim": return AWAITING_ACTOR;
|
|
60
|
+
case "settled": return COMPLETED;
|
|
61
|
+
case "cancelled": return WITHDRAWN;
|
|
62
|
+
case "failed": return FAILED;
|
|
63
|
+
default: return unknownStatus(status);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** Interpret a payment Request as its ISSUER sees it. An issuer does not wait for itself. */
|
|
67
|
+
function requestPhase(status) {
|
|
68
|
+
switch (status) {
|
|
69
|
+
case "draft":
|
|
70
|
+
case "sent":
|
|
71
|
+
case "viewed":
|
|
72
|
+
case "pending_settlement": return PENDING;
|
|
73
|
+
case "paid": return COMPLETED;
|
|
74
|
+
case "declined":
|
|
75
|
+
case "expired": return FAILED;
|
|
76
|
+
case "cancelled": return WITHDRAWN;
|
|
77
|
+
default: return unknownStatus(status);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** Interpret the same request as its RECIPIENT sees it. `open` waits for the recipient. */
|
|
81
|
+
function inboxPhase(status) {
|
|
82
|
+
switch (status) {
|
|
83
|
+
case "open": return AWAITING_ACTOR;
|
|
84
|
+
case "approved": return PENDING;
|
|
85
|
+
case "paid": return COMPLETED;
|
|
86
|
+
case "declined":
|
|
87
|
+
case "expired": return FAILED;
|
|
88
|
+
case "cancelled": return WITHDRAWN;
|
|
89
|
+
default: return unknownStatus(status);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
11
93
|
//#region src/domain/money/format-money.ts
|
|
12
94
|
function formatMoney(money, options = {}) {
|
|
13
95
|
if (!Number.isInteger(money.decimals) || money.decimals < 0) throw Errors.invalidInput("money.decimals", "must be a non-negative integer");
|
|
14
|
-
const symbol = currencySymbolFor(money.currency);
|
|
96
|
+
const symbol = currencySymbolFor(toCurrencyCode(money.currency));
|
|
15
97
|
const maximumFractionDigits = options.grammar === "code" ? 4 : 2;
|
|
16
98
|
const rounded = roundDecimal(money.value, money.decimals, maximumFractionDigits);
|
|
17
99
|
const grouped = rounded.integer.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
@@ -334,6 +416,12 @@ async function recoverRawDigestSigner(input) {
|
|
|
334
416
|
}
|
|
335
417
|
//#endregion
|
|
336
418
|
//#region ../observability/src/engineering.ts
|
|
419
|
+
const ENGINEERING_CAPXUL_ENVS = [
|
|
420
|
+
"development",
|
|
421
|
+
"staging",
|
|
422
|
+
"production",
|
|
423
|
+
"local"
|
|
424
|
+
];
|
|
337
425
|
const SAFE_TRACED_HEADER_NAMES = [
|
|
338
426
|
"content-length",
|
|
339
427
|
"content-type",
|
|
@@ -356,11 +444,7 @@ const postHogOtlpEndpoints = (host) => {
|
|
|
356
444
|
traces: `${base}/i/v1/traces`
|
|
357
445
|
};
|
|
358
446
|
};
|
|
359
|
-
const
|
|
360
|
-
"development",
|
|
361
|
-
"staging",
|
|
362
|
-
"production"
|
|
363
|
-
]);
|
|
447
|
+
const ENGINEERING_CAPXUL_ENV_SET = new Set(ENGINEERING_CAPXUL_ENVS);
|
|
364
448
|
const ENGINEERING_PRODUCERS = new Set(["browser", "server"]);
|
|
365
449
|
const PUBLIC_POSTHOG_AUTHORIZATION = /^Bearer phc_[A-Za-z0-9_-]{1,191}$/u;
|
|
366
450
|
const SAFE_RESOURCE_VALUE = /^[A-Za-z0-9][A-Za-z0-9._+@/-]{0,127}$/u;
|
|
@@ -372,7 +456,7 @@ const validateEngineeringTelemetryConfig = (config) => {
|
|
|
372
456
|
throw new TypeError("engineering telemetry host must be an absolute HTTPS URL");
|
|
373
457
|
}
|
|
374
458
|
if (url.protocol !== "https:" || url.username.length > 0 || url.password.length > 0 || url.pathname !== "/" || url.search.length > 0 || url.hash.length > 0 || !(url.hostname === "posthog.com" || url.hostname.endsWith(".posthog.com"))) throw new TypeError("engineering telemetry host must be a credential-free HTTPS origin");
|
|
375
|
-
if (!
|
|
459
|
+
if (!ENGINEERING_CAPXUL_ENV_SET.has(config.capxulEnv)) throw new TypeError("engineering telemetry capxulEnv is not canonical");
|
|
376
460
|
if (!ENGINEERING_PRODUCERS.has(config.producer)) throw new TypeError("engineering telemetry producer is not canonical");
|
|
377
461
|
if (!SAFE_RESOURCE_VALUE.test(config.sdkVersion)) throw new TypeError("engineering telemetry sdkVersion must be a bounded safe value");
|
|
378
462
|
if (config.serviceName !== void 0 && !SAFE_RESOURCE_VALUE.test(config.serviceName)) throw new TypeError("engineering telemetry serviceName must be a bounded safe value");
|
|
@@ -3069,4 +3153,4 @@ async function createCapxulClient(input) {
|
|
|
3069
3153
|
return createCapxulClient$1(input);
|
|
3070
3154
|
}
|
|
3071
3155
|
//#endregion
|
|
3072
|
-
export { CAPXUL_ERROR_CODES, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CapxulError, Errors, 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 };
|
|
3156
|
+
export { CAPXUL_ERROR_CODES, CAPXUL_PAYMENTS_V2_ADDRESS, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, CapxulError, Errors, PAYMENT_DIRECTIONS, PAYMENT_STATUSES, captureException, captureExceptionSync, createCapxulClient, deriveDevPrivateKey, devPrivateKeySigner, eip1193AccountProvider, embeddedSigner, fingerprintPaymentIntent, formatMoney, inboxPhase, injectedWalletSigner, isCapxulError, isClaimed, isMoneyParseError, isRestoring, isSettingUpLifecycle, localPrivateKeyAccountProvider, openfortEmbeddedSigner, openfortEmbeddedSignerFromWallet, openfortEmbeddedWalletPort, parseMoney, paymentPhase, postHogObservability, requestPhase, destination as resolveIdentityDestination, toCountryCode, toAddress as toEvmAddress };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as AuthSession, _ as AuthCacheError, b as CachedJwt, n as CapxulSigner, v as AuthCachePort, y as AuthCachePortTag } from "../signer-
|
|
1
|
+
import { O as AuthSession, _ as AuthCacheError, b as CachedJwt, n as CapxulSigner, v as AuthCachePort, y as AuthCachePortTag } from "../signer-CRzTIrau.mjs";
|
|
2
2
|
import { Hex } from "viem";
|
|
3
3
|
import { Effect, FileSystem, Layer, Path } from "effect";
|
|
4
4
|
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AuthCacheError, h as toAddress, i as parseCachedJwt, n as BrowserAuthCacheAdapter, o as AuthCachePortTag, r as parseAuthSession, t as InMemoryAuthCacheAdapter } from "../InMemoryAuthCacheAdapter-
|
|
1
|
+
import { a as AuthCacheError, h as toAddress, i as parseCachedJwt, n as BrowserAuthCacheAdapter, o as AuthCachePortTag, r as parseAuthSession, t as InMemoryAuthCacheAdapter } from "../InMemoryAuthCacheAdapter-D5Cv0yz0.mjs";
|
|
2
2
|
import { Effect, FileSystem, Layer, Path } from "effect";
|
|
3
3
|
import { privateKeyToAccount } from "viem/accounts";
|
|
4
4
|
import * as os from "node:os";
|