@xkova/sdk 0.1.0-alpha.1 → 0.1.0-alpha.10
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 +324 -32
- package/dist/abi.d.ts +40 -0
- package/dist/abi.js +25 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +62 -3
- package/dist/generated/types.d.ts +8629 -5182
- package/dist/held-approval.d.ts +41 -0
- package/dist/held-approval.js +33 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/member-action-intents.js +2 -2
- package/dist/member-bff.d.ts +60 -21
- package/dist/member-bff.js +81 -79
- package/dist/member-resources.d.ts +67 -1
- package/dist/member-resources.js +9 -5
- package/dist/request-signing.js +6 -0
- package/dist/resources/account-holders.d.ts +131 -1
- package/dist/resources/account-holders.js +44 -9
- package/dist/resources/branding.d.ts +10 -0
- package/dist/resources/branding.js +2 -0
- package/dist/resources/contacts.d.ts +2 -2
- package/dist/resources/contacts.js +3 -3
- package/dist/resources/escrows.d.ts +3 -0
- package/dist/resources/payment-requests.d.ts +4 -0
- package/dist/resources/payments.d.ts +13 -0
- package/dist/resources/payments.js +7 -0
- package/dist/resources/ramps.d.ts +73 -64
- package/dist/resources/ramps.js +2 -2
- package/dist/resources/rwa.d.ts +9 -9
- package/dist/resources/tenant.d.ts +15 -0
- package/dist/resources/tenant.js +6 -1
- package/dist/resources/tokenization.d.ts +30 -11
- package/dist/resources/tokenization.js +10 -10
- package/dist/resources/treasury.d.ts +404 -0
- package/dist/resources/treasury.js +115 -0
- package/dist/resources/wallets.d.ts +2 -0
- package/dist/resources/webhooks.d.ts +1 -1
- package/dist/resources/webhooks.js +2 -2
- package/dist/resources/workflows.d.ts +7 -6
- package/dist/resources/workflows.js +87 -24
- package/dist/resources/workforce-wallets.d.ts +34 -0
- package/dist/resources/workforce-wallets.js +19 -0
- package/dist/url.d.ts +1 -0
- package/dist/url.js +4 -0
- package/dist/webhook.js +1 -1
- package/dist/workforce-bff.d.ts +202 -0
- package/dist/workforce-bff.js +462 -0
- package/examples/postgres-checkpoint-store.mjs +116 -0
- package/examples/postgres-checkpoints.sql +9 -0
- package/llms.txt +29 -9
- package/package.json +8 -3
|
@@ -18,8 +18,64 @@ export declare class XKOVAMemberResources {
|
|
|
18
18
|
get paymentRequests(): import("./resources/index.js").PaymentRequestsResource;
|
|
19
19
|
get wallets(): import("./resources/index.js").WalletsResource;
|
|
20
20
|
readonly self: {
|
|
21
|
+
profile: () => Promise<{
|
|
22
|
+
id: import("./generated/types.js").components["schemas"]["AccountHolderId"];
|
|
23
|
+
tenant_id?: string;
|
|
24
|
+
state: "active" | "held" | "closed" | "closed_uncooperative" | "provisioning_failed";
|
|
25
|
+
state_reason?: string | null;
|
|
26
|
+
state_changed_at?: import("./generated/types.js").components["schemas"]["TimestampUtc"] | null;
|
|
27
|
+
tier: "tier_1" | "tier_2";
|
|
28
|
+
tier_2_uplift_status?: "not_requested" | "pending" | "passed" | "failed";
|
|
29
|
+
first_use_completed: boolean;
|
|
30
|
+
cip_payload?: {
|
|
31
|
+
name_hash?: string;
|
|
32
|
+
dob_hash?: string;
|
|
33
|
+
id_hash?: string;
|
|
34
|
+
address_hash?: string;
|
|
35
|
+
} | null;
|
|
36
|
+
cip_accepted_at?: import("./generated/types.js").components["schemas"]["TimestampUtc"] | null;
|
|
37
|
+
merchant_role_state?: "none" | "pending_review" | "approved" | "rejected" | "revoked";
|
|
38
|
+
auto_save_contacts?: boolean;
|
|
39
|
+
created_at: import("./generated/types.js").components["schemas"]["TimestampUtc"];
|
|
40
|
+
updated_at?: import("./generated/types.js").components["schemas"]["TimestampUtc"];
|
|
41
|
+
email?: string | null;
|
|
42
|
+
first_name?: string | null;
|
|
43
|
+
last_name?: string | null;
|
|
44
|
+
phone?: string | null;
|
|
45
|
+
avatar_url?: string | null;
|
|
46
|
+
}>;
|
|
47
|
+
productEnrollment: (product: string, control?: XKOVARequestControl) => Promise<{
|
|
48
|
+
product: string;
|
|
49
|
+
status: "not_opened" | "setup_required" | "opening" | "active" | "requires_review";
|
|
50
|
+
terms_version: string | null;
|
|
51
|
+
accepted_at: string | null;
|
|
52
|
+
credit: {
|
|
53
|
+
amount: string;
|
|
54
|
+
token_deployment_id: string;
|
|
55
|
+
token_address: string;
|
|
56
|
+
token_symbol: string;
|
|
57
|
+
chain: import("./generated/types.js").components["schemas"]["ChainDescriptor"];
|
|
58
|
+
status: "pending" | "submitted" | "settled" | "requires_review";
|
|
59
|
+
transaction_hash: string | null;
|
|
60
|
+
} | null;
|
|
61
|
+
}>;
|
|
62
|
+
acceptProductEnrollment: (product: string, body: ReqBody<"acceptAccountHolderSelfProductEnrollment">, opts?: XKOVAMutationOptions) => Promise<{
|
|
63
|
+
product: string;
|
|
64
|
+
status: "not_opened" | "setup_required" | "opening" | "active" | "requires_review";
|
|
65
|
+
terms_version: string | null;
|
|
66
|
+
accepted_at: string | null;
|
|
67
|
+
credit: {
|
|
68
|
+
amount: string;
|
|
69
|
+
token_deployment_id: string;
|
|
70
|
+
token_address: string;
|
|
71
|
+
token_symbol: string;
|
|
72
|
+
chain: import("./generated/types.js").components["schemas"]["ChainDescriptor"];
|
|
73
|
+
status: "pending" | "submitted" | "settled" | "requires_review";
|
|
74
|
+
transaction_hash: string | null;
|
|
75
|
+
} | null;
|
|
76
|
+
}>;
|
|
21
77
|
actionReadiness: (control?: XKOVARequestControl) => Promise<{
|
|
22
|
-
authorization_method: "hosted_passkey" | "external_oidc";
|
|
78
|
+
authorization_method: "hosted_passkey" | "external_oidc" | "xkova_webauthn";
|
|
23
79
|
setup_status: "passkey_required" | "recovery_acknowledgement_required" | "recovery_required" | "ready" | "externally_managed";
|
|
24
80
|
action_authorization_enabled: boolean;
|
|
25
81
|
requires_fresh_proof: true;
|
|
@@ -53,10 +109,20 @@ export declare class XKOVAMemberResources {
|
|
|
53
109
|
}>;
|
|
54
110
|
balance: (control?: XKOVARequestControl) => Promise<{
|
|
55
111
|
balances: import("./generated/types.js").components["schemas"]["AccountHolderSelfBalanceEntry"][];
|
|
112
|
+
data_freshness: import("./generated/types.js").components["schemas"]["DataFreshness"][];
|
|
56
113
|
}>;
|
|
57
114
|
wallets: (control?: XKOVARequestControl) => Promise<{
|
|
58
115
|
data: import("./generated/types.js").components["schemas"]["Wallet"][];
|
|
59
116
|
}>;
|
|
117
|
+
walletAuth: (control?: XKOVARequestControl) => Promise<{
|
|
118
|
+
strategy: "auth_endpoint";
|
|
119
|
+
payload: string;
|
|
120
|
+
client_id: string;
|
|
121
|
+
project_id: string;
|
|
122
|
+
external_user_id: string;
|
|
123
|
+
expires_at: string;
|
|
124
|
+
expected_address?: string;
|
|
125
|
+
} & Record<string, never>>;
|
|
60
126
|
walletReadiness: (control?: XKOVARequestControl) => Promise<{
|
|
61
127
|
status: "not_registered" | "provisioning" | "ready";
|
|
62
128
|
wallets: import("./generated/types.js").components["schemas"]["Wallet"][];
|
package/dist/member-resources.js
CHANGED
|
@@ -31,11 +31,15 @@ export class XKOVAMemberResources {
|
|
|
31
31
|
return this.client.wallets;
|
|
32
32
|
}
|
|
33
33
|
self = {
|
|
34
|
+
profile: () => this.client.accountHolders.selfProfile(this.context),
|
|
35
|
+
productEnrollment: (product, control) => this.client.accountHolders.selfProductEnrollment(this.context, product, control),
|
|
36
|
+
acceptProductEnrollment: (product, body, opts) => this.client.accountHolders.acceptSelfProductEnrollment(this.context, product, body, opts),
|
|
34
37
|
actionReadiness: (control) => this.client.accountHolders.selfActionReadiness({ ...this.context, accountHolderId: this.accountHolderId }, control),
|
|
35
38
|
sandboxBankingContext: (control) => this.client.accountHolders.selfSandboxBankingContext(this.context, control),
|
|
36
39
|
verification: (control) => this.client.accountHolders.selfVerification(this.context, control),
|
|
37
40
|
balance: (control) => this.client.accountHolders.selfBalance(this.context, control),
|
|
38
41
|
wallets: (control) => this.client.accountHolders.listSelfWallets(this.context, control),
|
|
42
|
+
walletAuth: (control) => this.client.accountHolders.selfWalletAuth(this.context, control),
|
|
39
43
|
walletReadiness: (control) => this.client.accountHolders.selfWalletReadiness(this.context, control),
|
|
40
44
|
ensureWalletProvisioning: (opts) => this.client.accountHolders.ensureSelfWalletProvisioning(this.context, opts),
|
|
41
45
|
bankBalance: (control) => this.client.accountHolders.selfBankBalance(this.context, control),
|
|
@@ -47,10 +51,10 @@ export class XKOVAMemberResources {
|
|
|
47
51
|
requestDataExport: (opts) => this.client.accountHolders.requestSelfDataExport(this.context, opts),
|
|
48
52
|
dataExport: (id, control) => this.client.accountHolders.selfDataExport(this.context, id, control),
|
|
49
53
|
transactions: (query, control) => this.client.accountHolders.listSelfTransactions(this.context, query, control),
|
|
50
|
-
avatar: () => this.client.accountHolders.
|
|
51
|
-
uploadAvatar: (image, control) => this.client.accountHolders.
|
|
52
|
-
deleteAvatar: (opts) => this.client.accountHolders.
|
|
53
|
-
confirmAvatar: (body, opts) => this.client.accountHolders.
|
|
54
|
-
presignAvatarUpload: (body, opts) => this.client.accountHolders.
|
|
54
|
+
avatar: () => this.client.accountHolders.selfAvatarUrl(this.context),
|
|
55
|
+
uploadAvatar: (image, control) => this.client.accountHolders.uploadSelfAvatar(this.context, image, control),
|
|
56
|
+
deleteAvatar: (opts) => this.client.accountHolders.deleteSelfAvatar(this.context, opts),
|
|
57
|
+
confirmAvatar: (body, opts) => this.client.accountHolders.confirmSelfAvatar(this.context, body, opts),
|
|
58
|
+
presignAvatarUpload: (body, opts) => this.client.accountHolders.presignSelfAvatarUpload(this.context, body, opts),
|
|
55
59
|
};
|
|
56
60
|
}
|
package/dist/request-signing.js
CHANGED
|
@@ -11,6 +11,10 @@ const CONDITIONAL_HEADERS = [
|
|
|
11
11
|
'idempotency-key',
|
|
12
12
|
'x-member-session-id',
|
|
13
13
|
'x-xkova-publishable-key',
|
|
14
|
+
'x-xkova-workforce-key',
|
|
15
|
+
'x-workforce-session',
|
|
16
|
+
'x-xkova-human-authorization',
|
|
17
|
+
'origin',
|
|
14
18
|
'x-account-holder-id',
|
|
15
19
|
'x-sender-wallet-id',
|
|
16
20
|
'x-sandbox-scenario',
|
|
@@ -78,6 +82,8 @@ export async function signXKOVARequest(input) {
|
|
|
78
82
|
function requiredComponents(headers, bodyPresent) {
|
|
79
83
|
const components = [...BASE_COMPONENTS];
|
|
80
84
|
for (const header of CONDITIONAL_HEADERS) {
|
|
85
|
+
if (header === 'origin' && !headers.has('x-xkova-workforce-key'))
|
|
86
|
+
continue;
|
|
81
87
|
if (headers.has(header) ||
|
|
82
88
|
(bodyPresent && (header === 'content-digest' || header === 'content-type'))) {
|
|
83
89
|
components.push(header);
|
|
@@ -100,6 +100,32 @@ export declare class AccountHoldersResource extends Resource {
|
|
|
100
100
|
next_cursor?: string | null;
|
|
101
101
|
has_more: boolean;
|
|
102
102
|
}>;
|
|
103
|
+
selfProfile(context: XKOVAMemberSessionContext, control?: XKOVARequestControl): Promise<{
|
|
104
|
+
id: import("../generated/types.js").components["schemas"]["AccountHolderId"];
|
|
105
|
+
tenant_id?: string;
|
|
106
|
+
state: "active" | "held" | "closed" | "closed_uncooperative" | "provisioning_failed";
|
|
107
|
+
state_reason?: string | null;
|
|
108
|
+
state_changed_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"] | null;
|
|
109
|
+
tier: "tier_1" | "tier_2";
|
|
110
|
+
tier_2_uplift_status?: "not_requested" | "pending" | "passed" | "failed";
|
|
111
|
+
first_use_completed: boolean;
|
|
112
|
+
cip_payload?: {
|
|
113
|
+
name_hash?: string;
|
|
114
|
+
dob_hash?: string;
|
|
115
|
+
id_hash?: string;
|
|
116
|
+
address_hash?: string;
|
|
117
|
+
} | null;
|
|
118
|
+
cip_accepted_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"] | null;
|
|
119
|
+
merchant_role_state?: "none" | "pending_review" | "approved" | "rejected" | "revoked";
|
|
120
|
+
auto_save_contacts?: boolean;
|
|
121
|
+
created_at: import("../generated/types.js").components["schemas"]["TimestampUtc"];
|
|
122
|
+
updated_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"];
|
|
123
|
+
email?: string | null;
|
|
124
|
+
first_name?: string | null;
|
|
125
|
+
last_name?: string | null;
|
|
126
|
+
phone?: string | null;
|
|
127
|
+
avatar_url?: string | null;
|
|
128
|
+
}>;
|
|
103
129
|
selfVerification(context: XKOVAMemberSessionContext, control?: XKOVARequestControl): Promise<{
|
|
104
130
|
required: boolean;
|
|
105
131
|
status: string;
|
|
@@ -118,12 +144,52 @@ export declare class AccountHoldersResource extends Resource {
|
|
|
118
144
|
}[];
|
|
119
145
|
verification_url: string | null;
|
|
120
146
|
}>;
|
|
147
|
+
selfProductEnrollment(context: XKOVAMemberSessionContext, product: string, control?: XKOVARequestControl): Promise<{
|
|
148
|
+
product: string;
|
|
149
|
+
status: "not_opened" | "setup_required" | "opening" | "active" | "requires_review";
|
|
150
|
+
terms_version: string | null;
|
|
151
|
+
accepted_at: string | null;
|
|
152
|
+
credit: {
|
|
153
|
+
amount: string;
|
|
154
|
+
token_deployment_id: string;
|
|
155
|
+
token_address: string;
|
|
156
|
+
token_symbol: string;
|
|
157
|
+
chain: import("../generated/types.js").components["schemas"]["ChainDescriptor"];
|
|
158
|
+
status: "pending" | "submitted" | "settled" | "requires_review";
|
|
159
|
+
transaction_hash: string | null;
|
|
160
|
+
} | null;
|
|
161
|
+
}>;
|
|
162
|
+
acceptSelfProductEnrollment(context: XKOVAMemberSessionContext, product: string, body: ReqBody<'acceptAccountHolderSelfProductEnrollment'>, opts?: XKOVAMutationOptions): Promise<{
|
|
163
|
+
product: string;
|
|
164
|
+
status: "not_opened" | "setup_required" | "opening" | "active" | "requires_review";
|
|
165
|
+
terms_version: string | null;
|
|
166
|
+
accepted_at: string | null;
|
|
167
|
+
credit: {
|
|
168
|
+
amount: string;
|
|
169
|
+
token_deployment_id: string;
|
|
170
|
+
token_address: string;
|
|
171
|
+
token_symbol: string;
|
|
172
|
+
chain: import("../generated/types.js").components["schemas"]["ChainDescriptor"];
|
|
173
|
+
status: "pending" | "submitted" | "settled" | "requires_review";
|
|
174
|
+
transaction_hash: string | null;
|
|
175
|
+
} | null;
|
|
176
|
+
}>;
|
|
121
177
|
selfBalance(context: XKOVAMemberSessionContext, control?: XKOVARequestControl): Promise<{
|
|
122
178
|
balances: import("../generated/types.js").components["schemas"]["AccountHolderSelfBalanceEntry"][];
|
|
179
|
+
data_freshness: import("../generated/types.js").components["schemas"]["DataFreshness"][];
|
|
123
180
|
}>;
|
|
124
181
|
listSelfWallets(context: XKOVAMemberSessionContext, control?: XKOVARequestControl): Promise<{
|
|
125
182
|
data: import("../generated/types.js").components["schemas"]["Wallet"][];
|
|
126
183
|
}>;
|
|
184
|
+
selfWalletAuth(context: XKOVAMemberSessionContext, control?: XKOVARequestControl): Promise<{
|
|
185
|
+
strategy: "auth_endpoint";
|
|
186
|
+
payload: string;
|
|
187
|
+
client_id: string;
|
|
188
|
+
project_id: string;
|
|
189
|
+
external_user_id: string;
|
|
190
|
+
expires_at: string;
|
|
191
|
+
expected_address?: string;
|
|
192
|
+
} & Record<string, never>>;
|
|
127
193
|
selfWalletReadiness(context: XKOVAMemberSessionContext, control?: XKOVARequestControl): Promise<{
|
|
128
194
|
status: "not_registered" | "provisioning" | "ready";
|
|
129
195
|
wallets: import("../generated/types.js").components["schemas"]["Wallet"][];
|
|
@@ -149,7 +215,7 @@ export declare class AccountHoldersResource extends Resource {
|
|
|
149
215
|
selfActionReadiness(context: XKOVAMemberSessionContext & {
|
|
150
216
|
accountHolderId: string;
|
|
151
217
|
}, control?: XKOVARequestControl): Promise<{
|
|
152
|
-
authorization_method: "hosted_passkey" | "external_oidc";
|
|
218
|
+
authorization_method: "hosted_passkey" | "external_oidc" | "xkova_webauthn";
|
|
153
219
|
setup_status: "passkey_required" | "recovery_acknowledgement_required" | "recovery_required" | "ready" | "externally_managed";
|
|
154
220
|
action_authorization_enabled: boolean;
|
|
155
221
|
requires_fresh_proof: true;
|
|
@@ -229,6 +295,70 @@ export declare class AccountHoldersResource extends Resource {
|
|
|
229
295
|
uploadAvatar(id: string, image: Blob, control?: XKOVARequestControl): Promise<{
|
|
230
296
|
url: string | null;
|
|
231
297
|
}>;
|
|
298
|
+
uploadSelfAvatar(context: XKOVAMemberSessionContext, image: Blob, control?: XKOVARequestControl): Promise<{
|
|
299
|
+
url: string | null;
|
|
300
|
+
}>;
|
|
301
|
+
private uploadAvatarImage;
|
|
302
|
+
selfAvatarUrl(context: XKOVAMemberSessionContext): Promise<{
|
|
303
|
+
url: string | null;
|
|
304
|
+
}>;
|
|
305
|
+
deleteSelfAvatar(context: XKOVAMemberSessionContext, opts?: XKOVAMutationOptions): Promise<{
|
|
306
|
+
id: import("../generated/types.js").components["schemas"]["AccountHolderId"];
|
|
307
|
+
tenant_id?: string;
|
|
308
|
+
state: "active" | "held" | "closed" | "closed_uncooperative" | "provisioning_failed";
|
|
309
|
+
state_reason?: string | null;
|
|
310
|
+
state_changed_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"] | null;
|
|
311
|
+
tier: "tier_1" | "tier_2";
|
|
312
|
+
tier_2_uplift_status?: "not_requested" | "pending" | "passed" | "failed";
|
|
313
|
+
first_use_completed: boolean;
|
|
314
|
+
cip_payload?: {
|
|
315
|
+
name_hash?: string;
|
|
316
|
+
dob_hash?: string;
|
|
317
|
+
id_hash?: string;
|
|
318
|
+
address_hash?: string;
|
|
319
|
+
} | null;
|
|
320
|
+
cip_accepted_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"] | null;
|
|
321
|
+
merchant_role_state?: "none" | "pending_review" | "approved" | "rejected" | "revoked";
|
|
322
|
+
auto_save_contacts?: boolean;
|
|
323
|
+
created_at: import("../generated/types.js").components["schemas"]["TimestampUtc"];
|
|
324
|
+
updated_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"];
|
|
325
|
+
email?: string | null;
|
|
326
|
+
first_name?: string | null;
|
|
327
|
+
last_name?: string | null;
|
|
328
|
+
phone?: string | null;
|
|
329
|
+
avatar_url?: string | null;
|
|
330
|
+
}>;
|
|
331
|
+
confirmSelfAvatar(context: XKOVAMemberSessionContext, body: ReqBody<'confirmAccountHolderSelfAvatar'>, opts?: XKOVAMutationOptions): Promise<{
|
|
332
|
+
id: import("../generated/types.js").components["schemas"]["AccountHolderId"];
|
|
333
|
+
tenant_id?: string;
|
|
334
|
+
state: "active" | "held" | "closed" | "closed_uncooperative" | "provisioning_failed";
|
|
335
|
+
state_reason?: string | null;
|
|
336
|
+
state_changed_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"] | null;
|
|
337
|
+
tier: "tier_1" | "tier_2";
|
|
338
|
+
tier_2_uplift_status?: "not_requested" | "pending" | "passed" | "failed";
|
|
339
|
+
first_use_completed: boolean;
|
|
340
|
+
cip_payload?: {
|
|
341
|
+
name_hash?: string;
|
|
342
|
+
dob_hash?: string;
|
|
343
|
+
id_hash?: string;
|
|
344
|
+
address_hash?: string;
|
|
345
|
+
} | null;
|
|
346
|
+
cip_accepted_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"] | null;
|
|
347
|
+
merchant_role_state?: "none" | "pending_review" | "approved" | "rejected" | "revoked";
|
|
348
|
+
auto_save_contacts?: boolean;
|
|
349
|
+
created_at: import("../generated/types.js").components["schemas"]["TimestampUtc"];
|
|
350
|
+
updated_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"];
|
|
351
|
+
email?: string | null;
|
|
352
|
+
first_name?: string | null;
|
|
353
|
+
last_name?: string | null;
|
|
354
|
+
phone?: string | null;
|
|
355
|
+
avatar_url?: string | null;
|
|
356
|
+
}>;
|
|
357
|
+
presignSelfAvatarUpload(context: XKOVAMemberSessionContext, body: ReqBody<'presignAccountHolderSelfAvatarUpload'>, opts?: XKOVAMutationOptions): Promise<{
|
|
358
|
+
upload_url: string;
|
|
359
|
+
object_key: string;
|
|
360
|
+
expires_at: import("../generated/types.js").components["schemas"]["TimestampUtc"];
|
|
361
|
+
}>;
|
|
232
362
|
avatarUrl(id: string): Promise<{
|
|
233
363
|
url: string | null;
|
|
234
364
|
}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Resource } from './base.js';
|
|
2
2
|
import { XKOVAUploadError } from '../errors.js';
|
|
3
|
+
import { isAllowedProtocol } from '../url.js';
|
|
3
4
|
function memberSessionHeaders(context) {
|
|
4
5
|
return {
|
|
5
6
|
'X-Member-Session-Id': context.memberSessionId,
|
|
@@ -27,15 +28,27 @@ export class AccountHoldersResource extends Resource {
|
|
|
27
28
|
history(id, query = {}) {
|
|
28
29
|
return this.getJson(`/account-holders/${this.enc(id)}/history`, query);
|
|
29
30
|
}
|
|
31
|
+
selfProfile(context, control) {
|
|
32
|
+
return this.getJson('/account-holders/self', undefined, control, memberSessionHeaders(context));
|
|
33
|
+
}
|
|
30
34
|
selfVerification(context, control) {
|
|
31
35
|
return this.getJson('/account-holders/self/verification', undefined, control, memberSessionHeaders(context));
|
|
32
36
|
}
|
|
37
|
+
selfProductEnrollment(context, product, control) {
|
|
38
|
+
return this.getJson(`/account-holders/self/product-enrollments/${this.enc(product)}`, undefined, control, memberSessionHeaders(context));
|
|
39
|
+
}
|
|
40
|
+
acceptSelfProductEnrollment(context, product, body, opts) {
|
|
41
|
+
return this.postJson(`/account-holders/self/product-enrollments/${this.enc(product)}`, body, opts, undefined, memberSessionHeaders(context));
|
|
42
|
+
}
|
|
33
43
|
selfBalance(context, control) {
|
|
34
44
|
return this.getJson('/account-holders/self/balance', undefined, control, memberSessionHeaders(context));
|
|
35
45
|
}
|
|
36
46
|
listSelfWallets(context, control) {
|
|
37
47
|
return this.getJson('/account-holders/self/wallets', undefined, control, memberSessionHeaders(context));
|
|
38
48
|
}
|
|
49
|
+
selfWalletAuth(context, control) {
|
|
50
|
+
return this.postJson('/account-holders/self/wallet-auth', undefined, control, undefined, memberSessionHeaders(context));
|
|
51
|
+
}
|
|
39
52
|
selfWalletReadiness(context, control) {
|
|
40
53
|
return this.getJson('/account-holders/self/wallet-readiness', undefined, control, memberSessionHeaders(context));
|
|
41
54
|
}
|
|
@@ -57,7 +70,7 @@ export class AccountHoldersResource extends Resource {
|
|
|
57
70
|
}
|
|
58
71
|
const readiness = status.action_readiness;
|
|
59
72
|
if (!readiness ||
|
|
60
|
-
!['hosted_passkey', 'external_oidc'].includes(readiness.authorization_method) ||
|
|
73
|
+
!['hosted_passkey', 'external_oidc', 'xkova_webauthn'].includes(readiness.authorization_method) ||
|
|
61
74
|
![
|
|
62
75
|
'passkey_required',
|
|
63
76
|
'recovery_acknowledgement_required',
|
|
@@ -102,21 +115,31 @@ export class AccountHoldersResource extends Resource {
|
|
|
102
115
|
* member context and cookies never follow the presigned URL or a redirect.
|
|
103
116
|
*/
|
|
104
117
|
async uploadAvatar(id, image, control = {}) {
|
|
118
|
+
return this.uploadAvatarImage(image, control, {
|
|
119
|
+
presign: (body) => this.presignAvatarUpload(id, body, control),
|
|
120
|
+
confirm: (object_key) => this.confirmAvatar(id, { object_key }, control),
|
|
121
|
+
read: () => this.avatarUrl(id),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
async uploadSelfAvatar(context, image, control = {}) {
|
|
125
|
+
return this.uploadAvatarImage(image, control, {
|
|
126
|
+
presign: (body) => this.presignSelfAvatarUpload(context, body, control),
|
|
127
|
+
confirm: (object_key) => this.confirmSelfAvatar(context, { object_key }, control),
|
|
128
|
+
read: () => this.selfAvatarUrl(context),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
async uploadAvatarImage(image, control, operations) {
|
|
105
132
|
if (!['image/png', 'image/jpeg', 'image/webp', 'image/gif'].includes(image.type) ||
|
|
106
133
|
image.size === 0 ||
|
|
107
134
|
image.size > 5 * 1024 * 1024) {
|
|
108
135
|
throw new TypeError('Avatar must be a PNG, JPEG, WebP, or GIF image of at most 5 MiB');
|
|
109
136
|
}
|
|
110
|
-
const upload = await
|
|
111
|
-
content_type: image.type,
|
|
112
|
-
content_length: image.size,
|
|
113
|
-
}, control);
|
|
137
|
+
const upload = await operations.presign({ content_type: image.type, content_length: image.size });
|
|
114
138
|
const target = new URL(upload.upload_url);
|
|
115
139
|
if (target.username ||
|
|
116
140
|
target.password ||
|
|
117
141
|
target.hash ||
|
|
118
|
-
(target
|
|
119
|
-
!(target.protocol === 'http:' && target.hostname === 'localhost')) ||
|
|
142
|
+
!isAllowedProtocol(target) ||
|
|
120
143
|
!Number.isFinite(Date.parse(upload.expires_at)) ||
|
|
121
144
|
Date.parse(upload.expires_at) <= Date.now()) {
|
|
122
145
|
throw new XKOVAUploadError('The avatar upload capability is invalid or expired');
|
|
@@ -145,8 +168,20 @@ export class AccountHoldersResource extends Resource {
|
|
|
145
168
|
}
|
|
146
169
|
if (!response.ok)
|
|
147
170
|
throw new XKOVAUploadError('Object storage rejected the avatar upload', response.status);
|
|
148
|
-
await
|
|
149
|
-
return
|
|
171
|
+
await operations.confirm(upload.object_key);
|
|
172
|
+
return operations.read();
|
|
173
|
+
}
|
|
174
|
+
selfAvatarUrl(context) {
|
|
175
|
+
return this.getJson('/account-holders/self/avatar', undefined, {}, memberSessionHeaders(context));
|
|
176
|
+
}
|
|
177
|
+
deleteSelfAvatar(context, opts) {
|
|
178
|
+
return this.deleteJson('/account-holders/self/avatar', opts, undefined, memberSessionHeaders(context));
|
|
179
|
+
}
|
|
180
|
+
confirmSelfAvatar(context, body, opts) {
|
|
181
|
+
return this.postJson('/account-holders/self/avatar/confirm', body, opts, undefined, memberSessionHeaders(context));
|
|
182
|
+
}
|
|
183
|
+
presignSelfAvatarUpload(context, body, opts) {
|
|
184
|
+
return this.postJson('/account-holders/self/avatar/upload-url', body, opts, undefined, memberSessionHeaders(context));
|
|
150
185
|
}
|
|
151
186
|
avatarUrl(id) {
|
|
152
187
|
return this.getJson(`/account-holders/${this.enc(id)}/avatar`);
|
|
@@ -2,6 +2,8 @@ import { Resource, type ReqBody, type Query } from './base.js';
|
|
|
2
2
|
import type { XKOVAMutationOptions } from '../client.js';
|
|
3
3
|
export declare class BrandingResource extends Resource {
|
|
4
4
|
get(): Promise<{
|
|
5
|
+
logo_upload_limits: import("../generated/types.js").components["schemas"]["LogoUploadLimits"];
|
|
6
|
+
has_logo_override: boolean;
|
|
5
7
|
resolved: {
|
|
6
8
|
brand_name: string;
|
|
7
9
|
legal_name: string;
|
|
@@ -28,6 +30,8 @@ export declare class BrandingResource extends Resource {
|
|
|
28
30
|
theme: import("../generated/types.js").components["schemas"]["TenantBrandingTheme"];
|
|
29
31
|
}>;
|
|
30
32
|
upsert(body: ReqBody<'upsertBranding'>, opts?: XKOVAMutationOptions): Promise<{
|
|
33
|
+
logo_upload_limits: import("../generated/types.js").components["schemas"]["LogoUploadLimits"];
|
|
34
|
+
has_logo_override: boolean;
|
|
31
35
|
resolved: {
|
|
32
36
|
brand_name: string;
|
|
33
37
|
legal_name: string;
|
|
@@ -94,12 +98,16 @@ export declare class BrandingResource extends Resource {
|
|
|
94
98
|
last_synced_at: string;
|
|
95
99
|
created_at: string;
|
|
96
100
|
}>;
|
|
101
|
+
/** Upload bytes to the returned URL, then confirm its opaque key as the same tenant. */
|
|
97
102
|
logoUploadUrl(body: ReqBody<'brandingLogoUploadUrl'>, opts?: XKOVAMutationOptions): Promise<{
|
|
98
103
|
upload_url: string;
|
|
99
104
|
object_key: string;
|
|
100
105
|
expires_at: string;
|
|
101
106
|
}>;
|
|
107
|
+
/** Publish a newly issued upload. Saved logo URLs or keys are not upload keys. */
|
|
102
108
|
confirmLogo(body: ReqBody<'confirmBrandingLogo'>, opts?: XKOVAMutationOptions): Promise<{
|
|
109
|
+
logo_upload_limits: import("../generated/types.js").components["schemas"]["LogoUploadLimits"];
|
|
110
|
+
has_logo_override: boolean;
|
|
103
111
|
resolved: {
|
|
104
112
|
brand_name: string;
|
|
105
113
|
legal_name: string;
|
|
@@ -126,6 +134,8 @@ export declare class BrandingResource extends Resource {
|
|
|
126
134
|
theme: import("../generated/types.js").components["schemas"]["TenantBrandingTheme"];
|
|
127
135
|
}>;
|
|
128
136
|
deleteLogo(opts?: XKOVAMutationOptions): Promise<{
|
|
137
|
+
logo_upload_limits: import("../generated/types.js").components["schemas"]["LogoUploadLimits"];
|
|
138
|
+
has_logo_override: boolean;
|
|
129
139
|
resolved: {
|
|
130
140
|
brand_name: string;
|
|
131
141
|
legal_name: string;
|
|
@@ -22,9 +22,11 @@ export class BrandingResource extends Resource {
|
|
|
22
22
|
verifyEmailDomain(id, opts) {
|
|
23
23
|
return this.postJson(`/branding/email-domains/${this.enc(id)}/verify`, undefined, opts);
|
|
24
24
|
}
|
|
25
|
+
/** Upload bytes to the returned URL, then confirm its opaque key as the same tenant. */
|
|
25
26
|
logoUploadUrl(body, opts) {
|
|
26
27
|
return this.postJson('/branding/logo/upload-url', body, opts);
|
|
27
28
|
}
|
|
29
|
+
/** Publish a newly issued upload. Saved logo URLs or keys are not upload keys. */
|
|
28
30
|
confirmLogo(body, opts) {
|
|
29
31
|
return this.postJson('/branding/logo', body, opts);
|
|
30
32
|
}
|
|
@@ -46,8 +46,8 @@ export declare class ContactsResource extends Resource {
|
|
|
46
46
|
updated_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"];
|
|
47
47
|
}>;
|
|
48
48
|
delete(id: string, query: Query<'deleteContact'>, opts?: XKOVAMutationOptions): Promise<void>;
|
|
49
|
-
/** Look up
|
|
50
|
-
search(body: ReqBody<'searchContacts'>, opts?: XKOVAMutationOptions): Promise<{
|
|
49
|
+
/** Look up contacts with optional cursor pagination. */
|
|
50
|
+
search(body: ReqBody<'searchContacts'>, opts?: XKOVAMutationOptions, query?: Query<'searchContacts'>): Promise<{
|
|
51
51
|
data: import("../generated/types.js").components["schemas"]["Contact"][];
|
|
52
52
|
next_cursor?: string | null;
|
|
53
53
|
has_more: boolean;
|
|
@@ -15,8 +15,8 @@ export class ContactsResource extends Resource {
|
|
|
15
15
|
delete(id, query, opts) {
|
|
16
16
|
return this.deleteJson(`/contacts/${this.enc(id)}`, opts, query);
|
|
17
17
|
}
|
|
18
|
-
/** Look up
|
|
19
|
-
search(body, opts) {
|
|
20
|
-
return this.postJson('/contacts/search', body, opts);
|
|
18
|
+
/** Look up contacts with optional cursor pagination. */
|
|
19
|
+
search(body, opts, query = {}) {
|
|
20
|
+
return this.postJson('/contacts/search', body, opts, query);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -7,6 +7,7 @@ export declare class EscrowsResource extends Resource {
|
|
|
7
7
|
has_more: boolean;
|
|
8
8
|
}>;
|
|
9
9
|
create(body: ReqBody<'createEscrow'>, opts?: XKOVAMutationOptions): Promise<{
|
|
10
|
+
notification_status?: "queued" | "sent" | "failed" | "cancelled";
|
|
10
11
|
escrow: import("../generated/types.js").components["schemas"]["Escrow"];
|
|
11
12
|
claim_token: string;
|
|
12
13
|
claim_url: string;
|
|
@@ -15,6 +16,7 @@ export declare class EscrowsResource extends Resource {
|
|
|
15
16
|
signing_expires_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"] | null;
|
|
16
17
|
}>;
|
|
17
18
|
retrieve(id: string, query?: Query<'getEscrow'>): Promise<{
|
|
19
|
+
notification_status?: "queued" | "sent" | "failed" | "cancelled";
|
|
18
20
|
id: import("../generated/types.js").components["schemas"]["EscrowId"];
|
|
19
21
|
chain: import("../generated/types.js").components["schemas"]["ChainDescriptor"];
|
|
20
22
|
fingerprint: string;
|
|
@@ -28,6 +30,7 @@ export declare class EscrowsResource extends Resource {
|
|
|
28
30
|
on_chain_payment_id?: string | null;
|
|
29
31
|
create_tx_hash?: string | null;
|
|
30
32
|
release_tx_hash?: string | null;
|
|
33
|
+
data_freshness?: import("../generated/types.js").components["schemas"]["DataFreshness"][];
|
|
31
34
|
fee_accruals?: import("../generated/types.js").components["schemas"]["EscrowFeeAccrual"][];
|
|
32
35
|
net_amount?: import("../generated/types.js").components["schemas"]["Money"] | null;
|
|
33
36
|
claimed_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"] | null;
|
|
@@ -11,6 +11,7 @@ export declare class PaymentRequestsResource extends Resource {
|
|
|
11
11
|
has_more: boolean;
|
|
12
12
|
}>;
|
|
13
13
|
create(body: ReqBody<'createPaymentRequest'>, opts?: XKOVAMutationOptions): Promise<{
|
|
14
|
+
notification_status?: "queued" | "sent" | "failed" | "cancelled";
|
|
14
15
|
id?: import("../generated/types.js").components["schemas"]["PaymentRequestId"];
|
|
15
16
|
requester_id?: import("../generated/types.js").components["schemas"]["AccountHolderId"];
|
|
16
17
|
payer_id?: import("../generated/types.js").components["schemas"]["AccountHolderId"] | null;
|
|
@@ -26,6 +27,7 @@ export declare class PaymentRequestsResource extends Resource {
|
|
|
26
27
|
updated_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"];
|
|
27
28
|
}>;
|
|
28
29
|
retrieve(id: string): Promise<{
|
|
30
|
+
notification_status?: "queued" | "sent" | "failed" | "cancelled";
|
|
29
31
|
id?: import("../generated/types.js").components["schemas"]["PaymentRequestId"];
|
|
30
32
|
requester_id?: import("../generated/types.js").components["schemas"]["AccountHolderId"];
|
|
31
33
|
payer_id?: import("../generated/types.js").components["schemas"]["AccountHolderId"] | null;
|
|
@@ -82,6 +84,7 @@ export declare class PaymentRequestsResource extends Resource {
|
|
|
82
84
|
finalized_at: import("../generated/types.js").components["schemas"]["TimestampUtc"] | null;
|
|
83
85
|
}>;
|
|
84
86
|
cancel(id: string, opts?: XKOVAMutationOptions): Promise<{
|
|
87
|
+
notification_status?: "queued" | "sent" | "failed" | "cancelled";
|
|
85
88
|
id?: import("../generated/types.js").components["schemas"]["PaymentRequestId"];
|
|
86
89
|
requester_id?: import("../generated/types.js").components["schemas"]["AccountHolderId"];
|
|
87
90
|
payer_id?: import("../generated/types.js").components["schemas"]["AccountHolderId"] | null;
|
|
@@ -97,6 +100,7 @@ export declare class PaymentRequestsResource extends Resource {
|
|
|
97
100
|
updated_at?: import("../generated/types.js").components["schemas"]["TimestampUtc"];
|
|
98
101
|
}>;
|
|
99
102
|
decline(id: string, body?: ReqBody<'declinePaymentRequest'>, opts?: XKOVAMutationOptions): Promise<{
|
|
103
|
+
notification_status?: "queued" | "sent" | "failed" | "cancelled";
|
|
100
104
|
id?: import("../generated/types.js").components["schemas"]["PaymentRequestId"];
|
|
101
105
|
requester_id?: import("../generated/types.js").components["schemas"]["AccountHolderId"];
|
|
102
106
|
payer_id?: import("../generated/types.js").components["schemas"]["AccountHolderId"] | null;
|
|
@@ -178,5 +178,18 @@ export declare class PaymentsResource extends Resource {
|
|
|
178
178
|
created_at: import("../generated/types.js").components["schemas"]["TimestampUtc"];
|
|
179
179
|
finalized_at: import("../generated/types.js").components["schemas"]["TimestampUtc"] | null;
|
|
180
180
|
}>;
|
|
181
|
+
/** Requires a resolved member session. Only the sender can continue or cancel. */
|
|
182
|
+
recovery(id: string): Promise<{
|
|
183
|
+
payment: import("../generated/types.js").components["schemas"]["Payment"];
|
|
184
|
+
state: "awaiting_approval" | "approval_expired" | "on_hold" | "processing" | "completed" | "cancelled" | "failed";
|
|
185
|
+
can_continue: boolean;
|
|
186
|
+
can_cancel: boolean;
|
|
187
|
+
}>;
|
|
188
|
+
cancelForMember(id: string, opts?: XKOVAMutationOptions): Promise<{
|
|
189
|
+
payment: import("../generated/types.js").components["schemas"]["Payment"];
|
|
190
|
+
state: "awaiting_approval" | "approval_expired" | "on_hold" | "processing" | "completed" | "cancelled" | "failed";
|
|
191
|
+
can_continue: boolean;
|
|
192
|
+
can_cancel: boolean;
|
|
193
|
+
}>;
|
|
181
194
|
}
|
|
182
195
|
export {};
|
|
@@ -30,4 +30,11 @@ export class PaymentsResource extends Resource {
|
|
|
30
30
|
cancel(id, opts) {
|
|
31
31
|
return this.postJson(`/payments/${this.enc(id)}/cancel`, undefined, opts);
|
|
32
32
|
}
|
|
33
|
+
/** Requires a resolved member session. Only the sender can continue or cancel. */
|
|
34
|
+
recovery(id) {
|
|
35
|
+
return this.getJson(`/account-holders/self/payments/${this.enc(id)}/recovery`);
|
|
36
|
+
}
|
|
37
|
+
cancelForMember(id, opts) {
|
|
38
|
+
return this.postJson(`/account-holders/self/payments/${this.enc(id)}/cancel`, undefined, opts);
|
|
39
|
+
}
|
|
33
40
|
}
|