@capxul/sdk 3.2.0 → 4.0.1
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 +2 -2
- package/dist/{OAuthBearerAuthClient-8F_kyVP5.mjs → OAuthBearerAuthClient-BHvDR8_0.mjs} +1 -1
- package/dist/{OAuthBearerAuthClient-CsOgeeZa.d.mts → OAuthBearerAuthClient-D-DLYlKj.d.mts} +1 -1
- package/dist/{clock-CWpcQlLy.mjs → clock-C2AUlq1V.mjs} +34 -1
- package/dist/{create-capxul-client-BCq08ppe.mjs → create-capxul-client-5Bk0PS0R.mjs} +1047 -552
- package/dist/index.d.mts +21 -20
- package/dist/index.mjs +44 -9
- package/dist/node/index.d.mts +2 -2
- package/dist/node/index.mjs +2 -2
- package/dist/{observation-B76zFxd6.d.mts → observation-DtzTdv20.d.mts} +75 -71
- package/dist/{signer-DOqb8M1Y.d.mts → signer-C0hZ6Kiy.d.mts} +9 -2
- package/dist/testing/index.d.mts +1 -1
- package/dist/testing/index.mjs +6 -6
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -91,13 +91,13 @@ derives endpoints, service, producer, and version. Missing or invalid policy
|
|
|
91
91
|
disables engineering export without failing client creation.
|
|
92
92
|
|
|
93
93
|
Person onboarding is one Core SDK journey. It requires a normalized, globally
|
|
94
|
-
unique
|
|
94
|
+
unique handle before it writes the Profile or starts Account setup:
|
|
95
95
|
|
|
96
96
|
```ts
|
|
97
97
|
const onboarded = await client.onboarding.completePerson({
|
|
98
98
|
displayName: "Ada Lovelace",
|
|
99
99
|
country: "GH",
|
|
100
|
-
|
|
100
|
+
handle: "ada_lovelace",
|
|
101
101
|
});
|
|
102
102
|
```
|
|
103
103
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as toAuthUserId, B as toJwtToken, I as toEmail, J as toSessionToken, L as toEpochMs, R as toEpochSeconds, c as ClockError, l as ClockPortTag, t as readClockNow, tt as Errors, u as authClientPortFromPromiseAdapter } from "./clock-C2AUlq1V.mjs";
|
|
2
2
|
import { Effect, Layer } from "effect";
|
|
3
3
|
//#region src/adapters/clock/SystemClockAdapter.ts
|
|
4
4
|
var SystemClockAdapter = class {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as ClockPort, v as AuthClientPort } from "./signer-
|
|
1
|
+
import { _ as ClockPort, v as AuthClientPort } from "./signer-C0hZ6Kiy.mjs";
|
|
2
2
|
//#region src/adapters/auth-client/OAuthBearerAuthClient.d.ts
|
|
3
3
|
interface OAuthBearerAuthClientInput {
|
|
4
4
|
/** The exchange endpoint: `{authBaseUrl}/api/auth/agent/exchange`. */
|
|
@@ -601,6 +601,10 @@ function decodeConvexError(err) {
|
|
|
601
601
|
return null;
|
|
602
602
|
}
|
|
603
603
|
//#endregion
|
|
604
|
+
//#region ../errors/src/index.ts
|
|
605
|
+
/** Canonical handle syntax shared by validation and branded constructors. */
|
|
606
|
+
const HANDLE_RE = /^[a-z0-9_-]{3,30}$/;
|
|
607
|
+
//#endregion
|
|
604
608
|
//#region ../types/src/index.ts
|
|
605
609
|
const EVM_ADDRESS_RE = /^0x[0-9a-f]{40}$/i;
|
|
606
610
|
const BYTES32_RE = /^0x[0-9a-f]{64}$/i;
|
|
@@ -661,6 +665,10 @@ function toPartyId(raw) {
|
|
|
661
665
|
if (typeof raw !== "string" || !PARTY_ID_RE.test(raw)) throw Errors.invalidInput("partyId", invalidValueReason("must be party_ plus an alphanumeric id", raw));
|
|
662
666
|
return raw;
|
|
663
667
|
}
|
|
668
|
+
function toHandle(raw) {
|
|
669
|
+
if (typeof raw !== "string" || !HANDLE_RE.test(raw)) throw Errors.invalidInput("handle", invalidValueReason("must be 3-30 characters of a-z, 0-9, underscore, or hyphen", raw));
|
|
670
|
+
return raw;
|
|
671
|
+
}
|
|
664
672
|
function toBudgetId(raw) {
|
|
665
673
|
return toNonEmptyStringBrand(raw, "budgetId");
|
|
666
674
|
}
|
|
@@ -718,6 +726,10 @@ function currencySymbolFor(code) {
|
|
|
718
726
|
if (symbol === void 0) throw Errors.invalidInput("currencyCode", `no symbol registered for "${String(code)}"`);
|
|
719
727
|
return symbol;
|
|
720
728
|
}
|
|
729
|
+
function toTesterKind(raw) {
|
|
730
|
+
if (raw !== "human" && raw !== "e2e" && raw !== "agent") throw Errors.invalidInput("testerKind", "must be human, e2e, or agent");
|
|
731
|
+
return raw;
|
|
732
|
+
}
|
|
721
733
|
function toKycTier(raw) {
|
|
722
734
|
if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 0 || raw > 3) throw Errors.invalidInput("kycTier", invalidValueReason("must be an integer in [0, 3]", raw));
|
|
723
735
|
return raw;
|
|
@@ -757,6 +769,27 @@ function invalidValueReason(prefix, raw) {
|
|
|
757
769
|
return `${prefix}: ${String(raw)}`;
|
|
758
770
|
}
|
|
759
771
|
//#endregion
|
|
772
|
+
//#region ../config/src/handle.ts
|
|
773
|
+
const RESERVED_HANDLES = /* @__PURE__ */ new Set([
|
|
774
|
+
"admin",
|
|
775
|
+
"api",
|
|
776
|
+
"capxul",
|
|
777
|
+
"help",
|
|
778
|
+
"root",
|
|
779
|
+
"support",
|
|
780
|
+
"system",
|
|
781
|
+
"www"
|
|
782
|
+
]);
|
|
783
|
+
function normalizeHandle(raw) {
|
|
784
|
+
return raw.trim().toLowerCase().replace(/^@/, "");
|
|
785
|
+
}
|
|
786
|
+
function validateHandle(raw) {
|
|
787
|
+
const handle = normalizeHandle(raw);
|
|
788
|
+
if (!HANDLE_RE.test(handle)) throw Errors.invalidInput("handle", "must be 3-30 characters of a-z, 0-9, underscore, or hyphen");
|
|
789
|
+
if (RESERVED_HANDLES.has(handle)) throw Errors.invalidInput("handle", "handle is reserved");
|
|
790
|
+
return handle;
|
|
791
|
+
}
|
|
792
|
+
//#endregion
|
|
760
793
|
//#region ../config/src/tokens.ts
|
|
761
794
|
/** `TestUSDC` ("USDX") — Base Sepolia, 6 decimals, open `mint`. (Canon §1.) */
|
|
762
795
|
const USDX_ADDRESS_BASE_SEPOLIA = "0xf09fcbb6df9f8f918e58f9c8ab15a76ade862b77";
|
|
@@ -1857,4 +1890,4 @@ async function readClockNow(clock) {
|
|
|
1857
1890
|
}
|
|
1858
1891
|
}
|
|
1859
1892
|
//#endregion
|
|
1860
|
-
export {
|
|
1893
|
+
export { CapxulError as $, toAuthUserId as A, toJwtToken as B, WEI_RE as C, toAddress as D, toAccountId as E, toDurationMs as F, toPayrollRunId as G, toOrgId as H, toEmail as I, toSessionToken as J, toPublishableKey as K, toEpochMs as L, toChainId as M, toCountryCode as N, toAllowedOrigin as O, toCurrencyCode as P, CAPXUL_ERROR_CODES as Q, toEpochSeconds as R, SUPPORTED_CURRENCY_CODES as S, currencySymbolFor as T, toPartyId as U, toKycTier as V, toPayrollGroupId as W, HANDLE_RE as X, toTesterKind as Y, decodeConvexError as Z, deriveCapxulSafeAddress as _, parseCachedJwt as a, boundedResponseHeaders as at, BYTES32_RE as b, ClockError as c, decodeChainCause as ct, AuthClientError as d, isFailureMode as dt, EXPECTED_OPERATION_OUTCOMES as et, AuthClientPortTag as f, revertSummaryText as ft, BASE_SEPOLIA_CHAIN_ID as g, normalizeBindingEmail as h, parseAuthSession as i, FAILURE_MODES as it, toBudgetId as j, toAppId as k, ClockPortTag as l, failureFingerprint as lt, CAPXUL_PAYMENTS_V2_ADDRESS as m, redactSecrets as mt, InMemoryAuthCacheAdapter as n, isCapxulError as nt, AuthCacheError as o, chainCauseProperties as ot, orgRoleKeyForLabel as p, containsSensitiveMaterial as pt, toRoleKey as q, BrowserAuthCacheAdapter as r, CHAIN_UPSTREAMS as rt, AuthCachePortTag as s, chainEvidenceLabel as st, readClockNow as t, Errors as tt, authClientPortFromPromiseAdapter as u, isChainUpstream as ut, validateHandle as v, ZERO_BYTES32 as w, EVM_ADDRESS_RE as x, APP_ID_RE as y, toHandle as z };
|