@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.
@@ -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<"mem", "MemberId">;
23
- declare const toMemberId: (raw: string) => PrefixedId<"mem", "MemberId">;
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<"mem", "MemberId">;
23
- declare const toMemberId: (raw: string) => PrefixedId<"mem", "MemberId">;
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, K as KybProfileId$1, N as NextAction$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 } from './next-action-DkrwXYay.cjs';
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
- accountId: AccountId;
220
- role: "owner" | "finance_manager" | "team_lead" | "viewer";
221
- createdAt: TimestampIso$1;
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, MemberId$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 { WithdrawalStatus as $, Account as A, BalanceLedgerEntry as B, CreatePaymentResult as C, Document as D, ExternalAccount as E, TransferEndpoint as F, TransferFx as G, TransferStatus as H, InvoiceDocument as I, Treasury as J, KybProfile as K, List as L, Member as M, VirtualAccountOwnerKind as N, Operation as O, PageInfo as P, VirtualCard as Q, ReceiptDocument as R, Safe as S, TaxFormDocument as T, UserIdentifier as U, VirtualAccount as V, VirtualCardLimits as W, VirtualCardOwnerKind as X, WebhookEndpoint as Y, WebhookEvent as Z, Withdrawal as _, AccountLookupResult as a, CreateApiKeyRequest as a0, CreateDocumentRequest as a1, CreateWebhookEndpointRequest as a2, CreateVirtualAccountRequest as a3, CreateVirtualCardRequest as a4, ApiKey as b, ApiKeyEnvironment as c, ApiKeyType as d, BankStatementDocument as e, CreateTransferResult as f, CreateWithdrawalResult as g, ExternalAccountKind as h, KycProfile as i, KycUploadDocument as j, Money as k, OperationStatus as l, OperationSummary as m, Organization as n, Payment as o, PaymentParty as p, PaymentStatus as q, PayrollRunDocument as r, PayrollScheduleDocument as s, Scope as t, Settlement as u, SubAccount as v, SubAccountOwnerKind as w, TimestampIso as x, Transfer as y, TransferCustody as z };
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, K as KybProfileId$1, N as NextAction$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 } from './next-action-DkrwXYay.js';
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
- accountId: AccountId;
220
- role: "owner" | "finance_manager" | "team_lead" | "viewer";
221
- createdAt: TimestampIso$1;
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, MemberId$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 { WithdrawalStatus as $, Account as A, BalanceLedgerEntry as B, CreatePaymentResult as C, Document as D, ExternalAccount as E, TransferEndpoint as F, TransferFx as G, TransferStatus as H, InvoiceDocument as I, Treasury as J, KybProfile as K, List as L, Member as M, VirtualAccountOwnerKind as N, Operation as O, PageInfo as P, VirtualCard as Q, ReceiptDocument as R, Safe as S, TaxFormDocument as T, UserIdentifier as U, VirtualAccount as V, VirtualCardLimits as W, VirtualCardOwnerKind as X, WebhookEndpoint as Y, WebhookEvent as Z, Withdrawal as _, AccountLookupResult as a, CreateApiKeyRequest as a0, CreateDocumentRequest as a1, CreateWebhookEndpointRequest as a2, CreateVirtualAccountRequest as a3, CreateVirtualCardRequest as a4, ApiKey as b, ApiKeyEnvironment as c, ApiKeyType as d, BankStatementDocument as e, CreateTransferResult as f, CreateWithdrawalResult as g, ExternalAccountKind as h, KycProfile as i, KycUploadDocument as j, Money as k, OperationStatus as l, OperationSummary as m, Organization as n, Payment as o, PaymentParty as p, PaymentStatus as q, PayrollRunDocument as r, PayrollScheduleDocument as s, Scope as t, Settlement as u, SubAccount as v, SubAccountOwnerKind as w, TimestampIso as x, Transfer as y, TransferCustody as z };
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("TEAM_LEAD");
35
+ roleKeyFromLabel("PAYMENTS_OPERATOR");
36
36
 
37
37
  // src/webhooks.ts
38
38
  async function verifyWebhook(request, secret, options) {
@@ -1,5 +1,5 @@
1
- import { Z as WebhookEvent } from './types-hfcOE7Oi.cjs';
2
- import './next-action-DkrwXYay.cjs';
1
+ import { a2 as WebhookEvent } from './types-Brucpq0Z.cjs';
2
+ import './next-action-CTGl8wpy.cjs';
3
3
 
4
4
  /**
5
5
  * Webhook verification primitive per CANON.md §4.41 +
@@ -1,5 +1,5 @@
1
- import { Z as WebhookEvent } from './types-PM4AQRLP.js';
2
- import './next-action-DkrwXYay.js';
1
+ import { a2 as WebhookEvent } from './types-V_D7qjxY.js';
2
+ import './next-action-CTGl8wpy.js';
3
3
 
4
4
  /**
5
5
  * Webhook verification primitive per CANON.md §4.41 +
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("TEAM_LEAD");
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.1.0-alpha.9",
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",