@capxul/sdk 0.1.0-alpha.9 → 0.2.0-alpha.3
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/CHANGELOG.md +108 -0
- package/README.md +45 -0
- package/dist/{client-DG6ODWu6.d.cts → client-B_Z3ThFO.d.cts} +49 -51
- package/dist/{client-ChZrdf3R.d.ts → client-pMBRFcsz.d.ts} +49 -51
- package/dist/client.cjs +1283 -419
- package/dist/client.d.cts +4 -4
- package/dist/client.d.ts +4 -4
- package/dist/client.js +1283 -419
- package/dist/{errors-QHD5Tlok.d.ts → errors-CwhCWGxm.d.ts} +1 -1
- package/dist/{errors-GgKrSUKp.d.cts → errors-rqxuUhQP.d.cts} +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/errors.d.ts +2 -2
- package/dist/index.cjs +1342 -410
- package/dist/index.d.cts +80 -9
- package/dist/index.d.ts +80 -9
- package/dist/index.js +1341 -412
- package/dist/{next-action-DkrwXYay.d.cts → next-action-CTGl8wpy.d.cts} +2 -2
- package/dist/{next-action-DkrwXYay.d.ts → next-action-CTGl8wpy.d.ts} +2 -2
- package/dist/{types-hfcOE7Oi.d.cts → types-Brucpq0Z.d.cts} +63 -8
- package/dist/{types-PM4AQRLP.d.ts → types-V_D7qjxY.d.ts} +63 -8
- package/dist/webhooks.cjs +1 -1
- package/dist/webhooks.d.cts +2 -2
- package/dist/webhooks.d.ts +2 -2
- package/dist/webhooks.js +1 -1
- package/package.json +7 -5
|
@@ -19,8 +19,8 @@ type AccountId = PrefixedId<"acct", "AccountId">;
|
|
|
19
19
|
declare const toAccountId: (raw: string) => PrefixedId<"acct", "AccountId">;
|
|
20
20
|
type OrganizationId = PrefixedId<"org", "OrganizationId">;
|
|
21
21
|
declare const toOrganizationId: (raw: string) => PrefixedId<"org", "OrganizationId">;
|
|
22
|
-
type MemberId = PrefixedId<"
|
|
23
|
-
declare const toMemberId: (raw: string) => PrefixedId<"
|
|
22
|
+
type MemberId = PrefixedId<"mb", "MemberId">;
|
|
23
|
+
declare const toMemberId: (raw: string) => PrefixedId<"mb", "MemberId">;
|
|
24
24
|
type SafeId = PrefixedId<"safe", "SafeId">;
|
|
25
25
|
declare const toSafeId: (raw: string) => PrefixedId<"safe", "SafeId">;
|
|
26
26
|
type TreasuryId = PrefixedId<"try", "TreasuryId">;
|
|
@@ -19,8 +19,8 @@ type AccountId = PrefixedId<"acct", "AccountId">;
|
|
|
19
19
|
declare const toAccountId: (raw: string) => PrefixedId<"acct", "AccountId">;
|
|
20
20
|
type OrganizationId = PrefixedId<"org", "OrganizationId">;
|
|
21
21
|
declare const toOrganizationId: (raw: string) => PrefixedId<"org", "OrganizationId">;
|
|
22
|
-
type MemberId = PrefixedId<"
|
|
23
|
-
declare const toMemberId: (raw: string) => PrefixedId<"
|
|
22
|
+
type MemberId = PrefixedId<"mb", "MemberId">;
|
|
23
|
+
declare const toMemberId: (raw: string) => PrefixedId<"mb", "MemberId">;
|
|
24
24
|
type SafeId = PrefixedId<"safe", "SafeId">;
|
|
25
25
|
declare const toSafeId: (raw: string) => PrefixedId<"safe", "SafeId">;
|
|
26
26
|
type TreasuryId = PrefixedId<"try", "TreasuryId">;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Y as PublicId, A as AccountId$1, S as SafeId$1, d as OrganizationId$1, c as KycProfileId$1, b as ExternalAccountId$1, O as OperationId$1, C as CorrelationId$1, f as SubAccountId$1, B as BalanceLedgerEntryId$1, a as ApiKeyId$1, h as TreasuryId$1, M as MemberId$1,
|
|
1
|
+
import { Y as PublicId, A as AccountId$1, S as SafeId$1, d as OrganizationId$1, N as NextAction$1, c as KycProfileId$1, b as ExternalAccountId$1, O as OperationId$1, C as CorrelationId$1, f as SubAccountId$1, B as BalanceLedgerEntryId$1, a as ApiKeyId$1, h as TreasuryId$1, M as MemberId$1, P as PaymentId$1, g as TransferId$1, k as WithdrawalId$1, D as DocumentId$1, W as WebhookEndpointId$1, j as WebhookEventId$1, V as VirtualAccountId$1, i as VirtualCardId$1, K as KybProfileId$1 } from './next-action-CTGl8wpy.cjs';
|
|
2
2
|
|
|
3
3
|
type AccountId = string;
|
|
4
4
|
type OrganizationId = string;
|
|
@@ -212,13 +212,20 @@ type Organization$1 = {
|
|
|
212
212
|
status: string;
|
|
213
213
|
operation: OperationSummary$1;
|
|
214
214
|
};
|
|
215
|
+
type MembershipStatus$1 = "pending" | "active" | "revoked" | "expired";
|
|
215
216
|
type Member$1 = {
|
|
216
217
|
object: "member";
|
|
217
218
|
id: MemberId;
|
|
218
219
|
organizationId: OrganizationId;
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
authUserId: string;
|
|
221
|
+
email: string;
|
|
222
|
+
role: "owner" | "finance_manager" | "payments_operator" | "org_admin" | "viewer" | "accountant";
|
|
223
|
+
status: MembershipStatus$1;
|
|
224
|
+
invitedBy: string;
|
|
225
|
+
invitedAt: number;
|
|
226
|
+
expiresAt: number;
|
|
227
|
+
acceptedAt: number;
|
|
228
|
+
resentCount: number;
|
|
222
229
|
};
|
|
223
230
|
type Safe$1 = {
|
|
224
231
|
object: "safe";
|
|
@@ -1051,9 +1058,49 @@ type Safe = Override<Rebrand<Safe$1, SafeId$1>, {
|
|
|
1051
1058
|
type Organization = Rebrand<Organization$1, OrganizationId$1>;
|
|
1052
1059
|
type Treasury = Rebrand<Treasury$1, TreasuryId$1> & {
|
|
1053
1060
|
readonly organizationId: OrganizationId$1;
|
|
1061
|
+
readonly safeId: SafeId$1;
|
|
1062
|
+
readonly totalBalance: Money;
|
|
1063
|
+
readonly positions: Array<{
|
|
1064
|
+
readonly symbol: string;
|
|
1065
|
+
readonly contractAddress: string;
|
|
1066
|
+
readonly amount: string;
|
|
1067
|
+
}>;
|
|
1068
|
+
readonly asOf: TimestampIso;
|
|
1069
|
+
};
|
|
1070
|
+
type KycStatus = KycProfile$1["status"];
|
|
1071
|
+
type KybStatus = KybProfile$1["status"];
|
|
1072
|
+
/**
|
|
1073
|
+
* Shared base type for identity profiles (KYC + KYB).
|
|
1074
|
+
*
|
|
1075
|
+
* Parameterized by status so per-resource discriminated unions
|
|
1076
|
+
* narrow correctly via `matchStatus`.
|
|
1077
|
+
*/
|
|
1078
|
+
type IdentityProfileBase<TStatus extends string> = {
|
|
1079
|
+
readonly object: string;
|
|
1080
|
+
readonly id: string;
|
|
1081
|
+
readonly owner: {
|
|
1082
|
+
readonly type: string;
|
|
1083
|
+
readonly id: string;
|
|
1084
|
+
};
|
|
1085
|
+
readonly status: TStatus;
|
|
1086
|
+
readonly nextAction?: NextAction$1;
|
|
1087
|
+
};
|
|
1088
|
+
type KycProfile = IdentityProfileBase<KycStatus> & {
|
|
1089
|
+
readonly object: "kyc_profile";
|
|
1090
|
+
readonly id: KycProfileId$1;
|
|
1091
|
+
readonly owner: {
|
|
1092
|
+
readonly type: "account";
|
|
1093
|
+
readonly id: AccountId$1;
|
|
1094
|
+
};
|
|
1095
|
+
};
|
|
1096
|
+
type KybProfile = IdentityProfileBase<KybStatus> & {
|
|
1097
|
+
readonly object: "kyb_profile";
|
|
1098
|
+
readonly id: KybProfileId$1;
|
|
1099
|
+
readonly owner: {
|
|
1100
|
+
readonly type: "organization";
|
|
1101
|
+
readonly id: OrganizationId$1;
|
|
1102
|
+
};
|
|
1054
1103
|
};
|
|
1055
|
-
type KycProfile = Rebrand<KycProfile$1, KycProfileId$1>;
|
|
1056
|
-
type KybProfile = Rebrand<KybProfile$1, KybProfileId$1>;
|
|
1057
1104
|
/**
|
|
1058
1105
|
* Trust-chain operation summary is sourced from the wire's nested
|
|
1059
1106
|
* `operation: OperationSummary` field (see resources.mdx §canonical
|
|
@@ -1130,7 +1177,15 @@ type ApiKey = Rebrand<ApiKey$1, ApiKeyId$1>;
|
|
|
1130
1177
|
type ApiKeyEnvironment = ApiKeyEnvironment$1;
|
|
1131
1178
|
type ApiKeyType = ApiKeyType$1;
|
|
1132
1179
|
type Scope = Scope$1;
|
|
1133
|
-
type Member = Rebrand<Member$1,
|
|
1180
|
+
type Member = Rebrand<Omit<Member$1, "authUserId" | "acceptedAt"> & {
|
|
1181
|
+
readonly authUserId: string | null;
|
|
1182
|
+
readonly acceptedAt: number | null;
|
|
1183
|
+
}, MemberId$1>;
|
|
1184
|
+
type MembershipStatus = MembershipStatus$1;
|
|
1185
|
+
type MemberInviteResponse = {
|
|
1186
|
+
readonly member: Member;
|
|
1187
|
+
readonly inviteToken: string;
|
|
1188
|
+
};
|
|
1134
1189
|
type BalanceLedgerEntry = Rebrand<BalanceLedgerEntry$1, BalanceLedgerEntryId$1>;
|
|
1135
1190
|
|
|
1136
|
-
export type {
|
|
1191
|
+
export type { VirtualCardLimits as $, Account as A, BalanceLedgerEntry as B, CreatePaymentResult as C, Document as D, ExternalAccount as E, SubAccount as F, SubAccountOwnerKind as G, TimestampIso as H, IdentityProfileBase as I, Transfer as J, KybProfile as K, List as L, Member as M, TransferCustody as N, Operation as O, PageInfo as P, TransferEndpoint as Q, ReceiptDocument as R, Safe as S, TaxFormDocument as T, TransferFx as U, TransferStatus as V, Treasury as W, UserIdentifier as X, VirtualAccount as Y, VirtualAccountOwnerKind as Z, VirtualCard as _, AccountLookupResult as a, VirtualCardOwnerKind as a0, WebhookEndpoint as a1, WebhookEvent as a2, Withdrawal as a3, WithdrawalStatus as a4, CreateApiKeyRequest as a5, CreateDocumentRequest as a6, CreateWebhookEndpointRequest as a7, CreateVirtualAccountRequest as a8, CreateVirtualCardRequest as a9, ApiKey as b, ApiKeyEnvironment as c, ApiKeyType as d, BankStatementDocument as e, CreateTransferResult as f, CreateWithdrawalResult as g, ExternalAccountKind as h, InvoiceDocument as i, KybStatus as j, KycProfile as k, KycStatus as l, KycUploadDocument as m, MemberInviteResponse as n, MembershipStatus as o, Money as p, OperationStatus as q, OperationSummary as r, Organization as s, Payment as t, PaymentParty as u, PaymentStatus as v, PayrollRunDocument as w, PayrollScheduleDocument as x, Scope as y, Settlement as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Y as PublicId, A as AccountId$1, S as SafeId$1, d as OrganizationId$1, c as KycProfileId$1, b as ExternalAccountId$1, O as OperationId$1, C as CorrelationId$1, f as SubAccountId$1, B as BalanceLedgerEntryId$1, a as ApiKeyId$1, h as TreasuryId$1, M as MemberId$1,
|
|
1
|
+
import { Y as PublicId, A as AccountId$1, S as SafeId$1, d as OrganizationId$1, N as NextAction$1, c as KycProfileId$1, b as ExternalAccountId$1, O as OperationId$1, C as CorrelationId$1, f as SubAccountId$1, B as BalanceLedgerEntryId$1, a as ApiKeyId$1, h as TreasuryId$1, M as MemberId$1, P as PaymentId$1, g as TransferId$1, k as WithdrawalId$1, D as DocumentId$1, W as WebhookEndpointId$1, j as WebhookEventId$1, V as VirtualAccountId$1, i as VirtualCardId$1, K as KybProfileId$1 } from './next-action-CTGl8wpy.js';
|
|
2
2
|
|
|
3
3
|
type AccountId = string;
|
|
4
4
|
type OrganizationId = string;
|
|
@@ -212,13 +212,20 @@ type Organization$1 = {
|
|
|
212
212
|
status: string;
|
|
213
213
|
operation: OperationSummary$1;
|
|
214
214
|
};
|
|
215
|
+
type MembershipStatus$1 = "pending" | "active" | "revoked" | "expired";
|
|
215
216
|
type Member$1 = {
|
|
216
217
|
object: "member";
|
|
217
218
|
id: MemberId;
|
|
218
219
|
organizationId: OrganizationId;
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
authUserId: string;
|
|
221
|
+
email: string;
|
|
222
|
+
role: "owner" | "finance_manager" | "payments_operator" | "org_admin" | "viewer" | "accountant";
|
|
223
|
+
status: MembershipStatus$1;
|
|
224
|
+
invitedBy: string;
|
|
225
|
+
invitedAt: number;
|
|
226
|
+
expiresAt: number;
|
|
227
|
+
acceptedAt: number;
|
|
228
|
+
resentCount: number;
|
|
222
229
|
};
|
|
223
230
|
type Safe$1 = {
|
|
224
231
|
object: "safe";
|
|
@@ -1051,9 +1058,49 @@ type Safe = Override<Rebrand<Safe$1, SafeId$1>, {
|
|
|
1051
1058
|
type Organization = Rebrand<Organization$1, OrganizationId$1>;
|
|
1052
1059
|
type Treasury = Rebrand<Treasury$1, TreasuryId$1> & {
|
|
1053
1060
|
readonly organizationId: OrganizationId$1;
|
|
1061
|
+
readonly safeId: SafeId$1;
|
|
1062
|
+
readonly totalBalance: Money;
|
|
1063
|
+
readonly positions: Array<{
|
|
1064
|
+
readonly symbol: string;
|
|
1065
|
+
readonly contractAddress: string;
|
|
1066
|
+
readonly amount: string;
|
|
1067
|
+
}>;
|
|
1068
|
+
readonly asOf: TimestampIso;
|
|
1069
|
+
};
|
|
1070
|
+
type KycStatus = KycProfile$1["status"];
|
|
1071
|
+
type KybStatus = KybProfile$1["status"];
|
|
1072
|
+
/**
|
|
1073
|
+
* Shared base type for identity profiles (KYC + KYB).
|
|
1074
|
+
*
|
|
1075
|
+
* Parameterized by status so per-resource discriminated unions
|
|
1076
|
+
* narrow correctly via `matchStatus`.
|
|
1077
|
+
*/
|
|
1078
|
+
type IdentityProfileBase<TStatus extends string> = {
|
|
1079
|
+
readonly object: string;
|
|
1080
|
+
readonly id: string;
|
|
1081
|
+
readonly owner: {
|
|
1082
|
+
readonly type: string;
|
|
1083
|
+
readonly id: string;
|
|
1084
|
+
};
|
|
1085
|
+
readonly status: TStatus;
|
|
1086
|
+
readonly nextAction?: NextAction$1;
|
|
1087
|
+
};
|
|
1088
|
+
type KycProfile = IdentityProfileBase<KycStatus> & {
|
|
1089
|
+
readonly object: "kyc_profile";
|
|
1090
|
+
readonly id: KycProfileId$1;
|
|
1091
|
+
readonly owner: {
|
|
1092
|
+
readonly type: "account";
|
|
1093
|
+
readonly id: AccountId$1;
|
|
1094
|
+
};
|
|
1095
|
+
};
|
|
1096
|
+
type KybProfile = IdentityProfileBase<KybStatus> & {
|
|
1097
|
+
readonly object: "kyb_profile";
|
|
1098
|
+
readonly id: KybProfileId$1;
|
|
1099
|
+
readonly owner: {
|
|
1100
|
+
readonly type: "organization";
|
|
1101
|
+
readonly id: OrganizationId$1;
|
|
1102
|
+
};
|
|
1054
1103
|
};
|
|
1055
|
-
type KycProfile = Rebrand<KycProfile$1, KycProfileId$1>;
|
|
1056
|
-
type KybProfile = Rebrand<KybProfile$1, KybProfileId$1>;
|
|
1057
1104
|
/**
|
|
1058
1105
|
* Trust-chain operation summary is sourced from the wire's nested
|
|
1059
1106
|
* `operation: OperationSummary` field (see resources.mdx §canonical
|
|
@@ -1130,7 +1177,15 @@ type ApiKey = Rebrand<ApiKey$1, ApiKeyId$1>;
|
|
|
1130
1177
|
type ApiKeyEnvironment = ApiKeyEnvironment$1;
|
|
1131
1178
|
type ApiKeyType = ApiKeyType$1;
|
|
1132
1179
|
type Scope = Scope$1;
|
|
1133
|
-
type Member = Rebrand<Member$1,
|
|
1180
|
+
type Member = Rebrand<Omit<Member$1, "authUserId" | "acceptedAt"> & {
|
|
1181
|
+
readonly authUserId: string | null;
|
|
1182
|
+
readonly acceptedAt: number | null;
|
|
1183
|
+
}, MemberId$1>;
|
|
1184
|
+
type MembershipStatus = MembershipStatus$1;
|
|
1185
|
+
type MemberInviteResponse = {
|
|
1186
|
+
readonly member: Member;
|
|
1187
|
+
readonly inviteToken: string;
|
|
1188
|
+
};
|
|
1134
1189
|
type BalanceLedgerEntry = Rebrand<BalanceLedgerEntry$1, BalanceLedgerEntryId$1>;
|
|
1135
1190
|
|
|
1136
|
-
export type {
|
|
1191
|
+
export type { VirtualCardLimits as $, Account as A, BalanceLedgerEntry as B, CreatePaymentResult as C, Document as D, ExternalAccount as E, SubAccount as F, SubAccountOwnerKind as G, TimestampIso as H, IdentityProfileBase as I, Transfer as J, KybProfile as K, List as L, Member as M, TransferCustody as N, Operation as O, PageInfo as P, TransferEndpoint as Q, ReceiptDocument as R, Safe as S, TaxFormDocument as T, TransferFx as U, TransferStatus as V, Treasury as W, UserIdentifier as X, VirtualAccount as Y, VirtualAccountOwnerKind as Z, VirtualCard as _, AccountLookupResult as a, VirtualCardOwnerKind as a0, WebhookEndpoint as a1, WebhookEvent as a2, Withdrawal as a3, WithdrawalStatus as a4, CreateApiKeyRequest as a5, CreateDocumentRequest as a6, CreateWebhookEndpointRequest as a7, CreateVirtualAccountRequest as a8, CreateVirtualCardRequest as a9, ApiKey as b, ApiKeyEnvironment as c, ApiKeyType as d, BankStatementDocument as e, CreateTransferResult as f, CreateWithdrawalResult as g, ExternalAccountKind as h, InvoiceDocument as i, KybStatus as j, KycProfile as k, KycStatus as l, KycUploadDocument as m, MemberInviteResponse as n, MembershipStatus as o, Money as p, OperationStatus as q, OperationSummary as r, Organization as s, Payment as t, PaymentParty as u, PaymentStatus as v, PayrollRunDocument as w, PayrollScheduleDocument as x, Scope as y, Settlement as z };
|
package/dist/webhooks.cjs
CHANGED
|
@@ -32,7 +32,7 @@ function roleKeyFromLabel(label) {
|
|
|
32
32
|
}
|
|
33
33
|
roleKeyFromLabel("OWNER");
|
|
34
34
|
roleKeyFromLabel("FINANCE_MANAGER");
|
|
35
|
-
roleKeyFromLabel("
|
|
35
|
+
roleKeyFromLabel("PAYMENTS_OPERATOR");
|
|
36
36
|
|
|
37
37
|
// src/webhooks.ts
|
|
38
38
|
async function verifyWebhook(request, secret, options) {
|
package/dist/webhooks.d.cts
CHANGED
package/dist/webhooks.d.ts
CHANGED
package/dist/webhooks.js
CHANGED
|
@@ -30,7 +30,7 @@ function roleKeyFromLabel(label) {
|
|
|
30
30
|
}
|
|
31
31
|
roleKeyFromLabel("OWNER");
|
|
32
32
|
roleKeyFromLabel("FINANCE_MANAGER");
|
|
33
|
-
roleKeyFromLabel("
|
|
33
|
+
roleKeyFromLabel("PAYMENTS_OPERATOR");
|
|
34
34
|
|
|
35
35
|
// src/webhooks.ts
|
|
36
36
|
async function verifyWebhook(request, secret, options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capxul/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-alpha.3",
|
|
4
4
|
"description": "Headless TypeScript client for Capxul's /v1/* HTTP contract.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -58,10 +58,11 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"xstate": "^5"
|
|
61
|
+
"xstate": "^5",
|
|
62
|
+
"convex": ">=1.0.0",
|
|
63
|
+
"@repo/safe-derive": "0.0.1-alpha.0"
|
|
62
64
|
},
|
|
63
65
|
"peerDependencies": {
|
|
64
|
-
"convex": ">=1.0.0",
|
|
65
66
|
"permissionless": ">=0.3.4 <0.4.0",
|
|
66
67
|
"viem": ">=2.0.0"
|
|
67
68
|
},
|
|
@@ -73,12 +74,13 @@
|
|
|
73
74
|
"viem": "2.47.10",
|
|
74
75
|
"vitest": "^4.1.2",
|
|
75
76
|
"zod": "^4.3.6",
|
|
76
|
-
"@repo/backend": "0.0.0",
|
|
77
77
|
"@repo/api-contract": "0.0.0",
|
|
78
|
+
"@repo/backend": "0.0.1-alpha.0",
|
|
78
79
|
"@repo/config": "0.0.0",
|
|
79
80
|
"@repo/observability": "0.0.0",
|
|
80
81
|
"@repo/platform-kernel": "0.0.0",
|
|
81
|
-
"@repo/typescript-config": "0.0.0"
|
|
82
|
+
"@repo/typescript-config": "0.0.0",
|
|
83
|
+
"@repo/safe-derive": "0.0.1-alpha.0"
|
|
82
84
|
},
|
|
83
85
|
"scripts": {
|
|
84
86
|
"build": "tsup",
|