@stripe/link-sdk 0.7.0 → 0.9.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 +44 -1
- package/dist/chunk-TYOT25QK.js +26 -0
- package/dist/chunk-TYOT25QK.js.map +1 -0
- package/dist/client.d.ts +2 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +360 -351
- package/dist/index.js.map +1 -1
- package/dist/resources/__tests__/approval-policy.test.d.ts +2 -0
- package/dist/resources/__tests__/approval-policy.test.d.ts.map +1 -0
- package/dist/resources/approval-policy.d.ts +9 -0
- package/dist/resources/approval-policy.d.ts.map +1 -0
- package/dist/resources/interfaces.d.ts +9 -8
- package/dist/resources/interfaces.d.ts.map +1 -1
- package/dist/resources/payment-methods.d.ts +3 -1
- package/dist/resources/payment-methods.d.ts.map +1 -1
- package/dist/resources/user-info.d.ts.map +1 -1
- package/dist/tools/__tests__/tools.test.d.ts +2 -0
- package/dist/tools/__tests__/tools.test.d.ts.map +1 -0
- package/dist/tools/index.d.ts +299 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +233 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/schemas.d.ts +136 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/types/index.d.ts +31 -51
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +5 -1
- package/dist/resources/__tests__/summaries.test.d.ts +0 -2
- package/dist/resources/__tests__/summaries.test.d.ts.map +0 -1
- package/dist/resources/summaries.d.ts +0 -10
- package/dist/resources/summaries.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-policy.test.d.ts","sourceRoot":"","sources":["../../../src/resources/__tests__/approval-policy.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LinkOptions } from '@/config';
|
|
2
|
+
import { BaseResource } from '@/resources/base';
|
|
3
|
+
import type { IApprovalPolicyResource } from '@/resources/interfaces';
|
|
4
|
+
import type { ApprovalPolicy } from '@/types/index';
|
|
5
|
+
export declare class ApprovalPolicyResource extends BaseResource implements IApprovalPolicyResource {
|
|
6
|
+
constructor(options: LinkOptions);
|
|
7
|
+
retrieve(): Promise<ApprovalPolicy>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=approval-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-policy.d.ts","sourceRoot":"","sources":["../../src/resources/approval-policy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAiBpD,qBAAa,sBACX,SAAQ,YACR,YAAW,uBAAuB;IAElC,YAAY,OAAO,EAAE,WAAW,EAE/B;IAEK,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC,CAexC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApprovalDetail, BalancesPage, CredentialType, LineItem, PaymentMethod, RequestApprovalResponse, ShippingAddressRecord, SourcesPage, SpendRequest,
|
|
1
|
+
import type { ApprovalDetail, ApprovalPolicy, BalancesPage, CredentialType, LineItem, PaymentMethod, RequestApprovalResponse, ShippingAddressRecord, SourcesPage, SpendRequest, Total, TransactionOrigin, TransactionsPage, UcpCheckout, UcpCheckoutWithSpendRequest, UcpSearchResult, UserInfo, WebBotAuthBlock } from '@/types/index';
|
|
2
2
|
export interface GetAccessTokenOptions {
|
|
3
3
|
forceRefresh?: boolean;
|
|
4
4
|
}
|
|
@@ -76,6 +76,11 @@ export interface ISpendRequestResource {
|
|
|
76
76
|
}
|
|
77
77
|
export interface IPaymentMethodsResource {
|
|
78
78
|
list(): Promise<PaymentMethod[]>;
|
|
79
|
+
retrieve(id: string): Promise<PaymentMethod | null>;
|
|
80
|
+
update(id: string, params: UpdatePaymentMethodParams): Promise<PaymentMethod>;
|
|
81
|
+
}
|
|
82
|
+
export interface UpdatePaymentMethodParams {
|
|
83
|
+
nickname: string;
|
|
79
84
|
}
|
|
80
85
|
export interface IShippingAddressResource {
|
|
81
86
|
list(): Promise<ShippingAddressRecord[]>;
|
|
@@ -83,6 +88,9 @@ export interface IShippingAddressResource {
|
|
|
83
88
|
export interface IUserInfoResource {
|
|
84
89
|
retrieve(): Promise<UserInfo>;
|
|
85
90
|
}
|
|
91
|
+
export interface IApprovalPolicyResource {
|
|
92
|
+
retrieve(): Promise<ApprovalPolicy>;
|
|
93
|
+
}
|
|
86
94
|
export interface IWebBotAuthResource {
|
|
87
95
|
signUrl(url: string): Promise<WebBotAuthBlock>;
|
|
88
96
|
}
|
|
@@ -116,13 +124,6 @@ export interface ListBalancesParams {
|
|
|
116
124
|
export interface IBalancesResource {
|
|
117
125
|
list(params?: ListBalancesParams): Promise<BalancesPage>;
|
|
118
126
|
}
|
|
119
|
-
export interface ListSummariesParams {
|
|
120
|
-
starting_after?: string;
|
|
121
|
-
summaries?: string[];
|
|
122
|
-
}
|
|
123
|
-
export interface ISummariesResource {
|
|
124
|
-
list(params?: ListSummariesParams): Promise<SummariesPage>;
|
|
125
|
-
}
|
|
126
127
|
export declare const REPORT_OUTCOMES: readonly ['success', 'blocked', 'abandoned'];
|
|
127
128
|
export type ReportOutcome = (typeof REPORT_OUTCOMES)[number];
|
|
128
129
|
export declare const REPORT_TAGS: readonly ['stripe_checkout', 'captcha', 'anti_bot_script', 'cdn_block', 'waf_block', 'dns_block', 'rate_limited', 'login_required', '3ds_challenge', 'page_inaccessible', 'timeout', 'site_error', 'payment_declined', 'other'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/resources/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,aAAa,EACb,uBAAuB,EACvB,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/resources/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,aAAa,EACb,uBAAuB,EACvB,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,KAAK,EACL,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,2BAA2B,EAC3B,eAAe,EACf,QAAQ,EACR,eAAe,EAChB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,qBAAqB;IACpC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,mBAAmB,GAAG,CAChC,OAAO,CAAC,EAAE,qBAAqB,KAC5B,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAE9B,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC9E;AAED,MAAM,MAAM,eAAe,GAAG;IAAE,GAAG,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,SAAS,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,MAAM,WAAW,6BAA6B;IAC5C,GAAG,EAAE;QAAE,GAAG,EAAE,eAAe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M,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACtE,gBAAgB,CACd,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,WAAW,CAAC,CAAC;IACxB,gBAAgB,CACd,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,2BAA2B,CAAC,CAAC;CACzC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { LinkOptions } from '@/config';
|
|
2
2
|
import { BaseResource } from '@/resources/base';
|
|
3
|
-
import type { IPaymentMethodsResource } from '@/resources/interfaces';
|
|
3
|
+
import type { IPaymentMethodsResource, UpdatePaymentMethodParams } from '@/resources/interfaces';
|
|
4
4
|
import type { PaymentMethod } from '@/types/index';
|
|
5
5
|
export declare class PaymentMethodsResource extends BaseResource implements IPaymentMethodsResource {
|
|
6
6
|
constructor(options: LinkOptions);
|
|
7
7
|
list(): Promise<PaymentMethod[]>;
|
|
8
|
+
retrieve(id: string): Promise<PaymentMethod | null>;
|
|
9
|
+
update(id: string, params: UpdatePaymentMethodParams): Promise<PaymentMethod>;
|
|
8
10
|
}
|
|
9
11
|
//# sourceMappingURL=payment-methods.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-methods.d.ts","sourceRoot":"","sources":["../../src/resources/payment-methods.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"payment-methods.d.ts","sourceRoot":"","sources":["../../src/resources/payment-methods.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAuBnD,qBAAa,sBACX,SAAQ,YACR,YAAW,uBAAuB;IAElC,YAAY,OAAO,EAAE,WAAW,EAE/B;IAEK,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAiBrC;IAEK,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAgBxD;IAEK,MAAM,CACV,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,aAAa,CAAC,CAiBxB;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-info.d.ts","sourceRoot":"","sources":["../../src/resources/user-info.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"user-info.d.ts","sourceRoot":"","sources":["../../src/resources/user-info.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAoF9C,qBAAa,gBACX,SAAQ,YACR,YAAW,iBAAiB;IAE5B,YAAY,OAAO,EAAE,WAAW,EAE/B;IAEK,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CAalC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.test.d.ts","sourceRoot":"","sources":["../../../src/tools/__tests__/tools.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { Link } from '../client';
|
|
3
|
+
export { linkToolSchemas } from './schemas';
|
|
4
|
+
/**
|
|
5
|
+
* Standard Schema tools with no agent-framework dependency. A resolver runs
|
|
6
|
+
* for each execution, so a shared catalog can safely serve multiple users.
|
|
7
|
+
* Credentials are never resolved during tool discovery.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createLinkTools<Context = unknown>(client: Link | ((context: Context) => Link | Promise<Link>)): {
|
|
10
|
+
retrieve_user_info: {
|
|
11
|
+
description: string;
|
|
12
|
+
inputSchema: z.ZodObject<{}, z.core.$strict>;
|
|
13
|
+
execute(input: Record<string, never>, context: Context): Promise<import("..").UserInfo>;
|
|
14
|
+
};
|
|
15
|
+
list_payment_methods: {
|
|
16
|
+
description: string;
|
|
17
|
+
inputSchema: z.ZodObject<{}, z.core.$strict>;
|
|
18
|
+
execute(input: Record<string, never>, context: Context): Promise<import("..").PaymentMethod[]>;
|
|
19
|
+
};
|
|
20
|
+
list_shipping_addresses: {
|
|
21
|
+
description: string;
|
|
22
|
+
inputSchema: z.ZodObject<{}, z.core.$strict>;
|
|
23
|
+
execute(input: Record<string, never>, context: Context): Promise<import("..").ShippingAddressRecord[]>;
|
|
24
|
+
};
|
|
25
|
+
list_spend_requests: {
|
|
26
|
+
description: string;
|
|
27
|
+
inputSchema: z.ZodObject<{
|
|
28
|
+
include_history: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
execute(input: {
|
|
31
|
+
include_history?: boolean | undefined;
|
|
32
|
+
}, context: Context): Promise<import("..").SpendRequest[]>;
|
|
33
|
+
};
|
|
34
|
+
create_spend_request: {
|
|
35
|
+
description: string;
|
|
36
|
+
inputSchema: z.ZodObject<{
|
|
37
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
38
|
+
payment_details: z.ZodOptional<z.ZodString>;
|
|
39
|
+
credential_type: z.ZodDefault<z.ZodEnum<{
|
|
40
|
+
card: "card";
|
|
41
|
+
shared_payment_token: "shared_payment_token";
|
|
42
|
+
}>>;
|
|
43
|
+
network_id: z.ZodOptional<z.ZodString>;
|
|
44
|
+
execution_method: z.ZodOptional<z.ZodLiteral<"link_pay_token">>;
|
|
45
|
+
merchant_account_id: z.ZodOptional<z.ZodString>;
|
|
46
|
+
amount: z.ZodNumber;
|
|
47
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
48
|
+
merchant_name: z.ZodOptional<z.ZodString>;
|
|
49
|
+
merchant_url: z.ZodOptional<z.ZodURL>;
|
|
50
|
+
context: z.ZodString;
|
|
51
|
+
line_items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
52
|
+
name: z.ZodString;
|
|
53
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
unit_amount: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
description: z.ZodOptional<z.ZodString>;
|
|
56
|
+
sku: z.ZodOptional<z.ZodString>;
|
|
57
|
+
url: z.ZodOptional<z.ZodString>;
|
|
58
|
+
image_url: z.ZodOptional<z.ZodString>;
|
|
59
|
+
product_url: z.ZodOptional<z.ZodString>;
|
|
60
|
+
totals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
61
|
+
type: z.ZodString;
|
|
62
|
+
display_text: z.ZodString;
|
|
63
|
+
amount: z.ZodNumber;
|
|
64
|
+
}, z.core.$strict>>>;
|
|
65
|
+
}, z.core.$strict>>>;
|
|
66
|
+
totals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
67
|
+
type: z.ZodString;
|
|
68
|
+
display_text: z.ZodString;
|
|
69
|
+
amount: z.ZodNumber;
|
|
70
|
+
}, z.core.$strict>>>;
|
|
71
|
+
request_approval: z.ZodDefault<z.ZodBoolean>;
|
|
72
|
+
test: z.ZodDefault<z.ZodBoolean>;
|
|
73
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
74
|
+
}, z.core.$strict>;
|
|
75
|
+
execute(input: {
|
|
76
|
+
idempotency_key?: string | undefined;
|
|
77
|
+
payment_details?: string | undefined;
|
|
78
|
+
credential_type?: "card" | "shared_payment_token" | undefined;
|
|
79
|
+
network_id?: string | undefined;
|
|
80
|
+
execution_method?: "link_pay_token" | undefined;
|
|
81
|
+
merchant_account_id?: string | undefined;
|
|
82
|
+
amount: number;
|
|
83
|
+
currency?: string | undefined;
|
|
84
|
+
merchant_name?: string | undefined;
|
|
85
|
+
merchant_url?: string | undefined;
|
|
86
|
+
context: string;
|
|
87
|
+
line_items?: {
|
|
88
|
+
name: string;
|
|
89
|
+
quantity?: number | undefined;
|
|
90
|
+
unit_amount?: number | undefined;
|
|
91
|
+
description?: string | undefined;
|
|
92
|
+
sku?: string | undefined;
|
|
93
|
+
url?: string | undefined;
|
|
94
|
+
image_url?: string | undefined;
|
|
95
|
+
product_url?: string | undefined;
|
|
96
|
+
totals?: {
|
|
97
|
+
type: string;
|
|
98
|
+
display_text: string;
|
|
99
|
+
amount: number;
|
|
100
|
+
}[] | undefined;
|
|
101
|
+
}[] | undefined;
|
|
102
|
+
totals?: {
|
|
103
|
+
type: string;
|
|
104
|
+
display_text: string;
|
|
105
|
+
amount: number;
|
|
106
|
+
}[] | undefined;
|
|
107
|
+
request_approval?: boolean | undefined;
|
|
108
|
+
test?: boolean | undefined;
|
|
109
|
+
metadata?: Record<string, string> | undefined;
|
|
110
|
+
}, context: Context): Promise<import("..").SpendRequest>;
|
|
111
|
+
};
|
|
112
|
+
retrieve_spend_request: {
|
|
113
|
+
description: string;
|
|
114
|
+
inputSchema: z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
117
|
+
}, z.core.$strict>;
|
|
118
|
+
execute(input: {
|
|
119
|
+
id: string;
|
|
120
|
+
include?: string[] | undefined;
|
|
121
|
+
}, context: Context): Promise<import("..").SpendRequest | null>;
|
|
122
|
+
};
|
|
123
|
+
update_spend_request: {
|
|
124
|
+
description: string;
|
|
125
|
+
inputSchema: z.ZodObject<{
|
|
126
|
+
id: z.ZodString;
|
|
127
|
+
payment_details: z.ZodOptional<z.ZodString>;
|
|
128
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
130
|
+
merchant_url: z.ZodOptional<z.ZodURL>;
|
|
131
|
+
profile_id: z.ZodOptional<z.ZodString>;
|
|
132
|
+
merchant_id: z.ZodOptional<z.ZodString>;
|
|
133
|
+
line_items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
134
|
+
name: z.ZodString;
|
|
135
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
136
|
+
unit_amount: z.ZodOptional<z.ZodNumber>;
|
|
137
|
+
description: z.ZodOptional<z.ZodString>;
|
|
138
|
+
sku: z.ZodOptional<z.ZodString>;
|
|
139
|
+
url: z.ZodOptional<z.ZodString>;
|
|
140
|
+
image_url: z.ZodOptional<z.ZodString>;
|
|
141
|
+
product_url: z.ZodOptional<z.ZodString>;
|
|
142
|
+
totals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
143
|
+
type: z.ZodString;
|
|
144
|
+
display_text: z.ZodString;
|
|
145
|
+
amount: z.ZodNumber;
|
|
146
|
+
}, z.core.$strict>>>;
|
|
147
|
+
}, z.core.$strict>>>;
|
|
148
|
+
totals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
149
|
+
type: z.ZodString;
|
|
150
|
+
display_text: z.ZodString;
|
|
151
|
+
amount: z.ZodNumber;
|
|
152
|
+
}, z.core.$strict>>>;
|
|
153
|
+
}, z.core.$strict>;
|
|
154
|
+
execute(input: {
|
|
155
|
+
id: string;
|
|
156
|
+
payment_details?: string | undefined;
|
|
157
|
+
amount?: number | undefined;
|
|
158
|
+
currency?: string | undefined;
|
|
159
|
+
merchant_url?: string | undefined;
|
|
160
|
+
profile_id?: string | undefined;
|
|
161
|
+
merchant_id?: string | undefined;
|
|
162
|
+
line_items?: {
|
|
163
|
+
name: string;
|
|
164
|
+
quantity?: number | undefined;
|
|
165
|
+
unit_amount?: number | undefined;
|
|
166
|
+
description?: string | undefined;
|
|
167
|
+
sku?: string | undefined;
|
|
168
|
+
url?: string | undefined;
|
|
169
|
+
image_url?: string | undefined;
|
|
170
|
+
product_url?: string | undefined;
|
|
171
|
+
totals?: {
|
|
172
|
+
type: string;
|
|
173
|
+
display_text: string;
|
|
174
|
+
amount: number;
|
|
175
|
+
}[] | undefined;
|
|
176
|
+
}[] | undefined;
|
|
177
|
+
totals?: {
|
|
178
|
+
type: string;
|
|
179
|
+
display_text: string;
|
|
180
|
+
amount: number;
|
|
181
|
+
}[] | undefined;
|
|
182
|
+
}, context: Context): Promise<import("..").SpendRequest>;
|
|
183
|
+
};
|
|
184
|
+
request_spend_approval: {
|
|
185
|
+
description: string;
|
|
186
|
+
inputSchema: z.ZodObject<{
|
|
187
|
+
id: z.ZodString;
|
|
188
|
+
}, z.core.$strict>;
|
|
189
|
+
execute(input: {
|
|
190
|
+
id: string;
|
|
191
|
+
}, context: Context): Promise<import("..").RequestApprovalResponse>;
|
|
192
|
+
};
|
|
193
|
+
cancel_spend_request: {
|
|
194
|
+
description: string;
|
|
195
|
+
inputSchema: z.ZodObject<{
|
|
196
|
+
id: z.ZodString;
|
|
197
|
+
}, z.core.$strict>;
|
|
198
|
+
execute(input: {
|
|
199
|
+
id: string;
|
|
200
|
+
}, context: Context): Promise<import("..").SpendRequest>;
|
|
201
|
+
};
|
|
202
|
+
list_transactions: {
|
|
203
|
+
description: string;
|
|
204
|
+
inputSchema: z.ZodObject<{
|
|
205
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
206
|
+
starting_after: z.ZodOptional<z.ZodString>;
|
|
207
|
+
ending_before: z.ZodOptional<z.ZodString>;
|
|
208
|
+
start_date: z.ZodOptional<z.ZodISODate>;
|
|
209
|
+
end_date: z.ZodOptional<z.ZodISODate>;
|
|
210
|
+
category: z.ZodOptional<z.ZodString>;
|
|
211
|
+
origin: z.ZodOptional<z.ZodEnum<{
|
|
212
|
+
external_connection: "external_connection";
|
|
213
|
+
link: "link";
|
|
214
|
+
}>>;
|
|
215
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
216
|
+
}, z.core.$strict>;
|
|
217
|
+
execute(input: {
|
|
218
|
+
limit?: number | undefined;
|
|
219
|
+
starting_after?: string | undefined;
|
|
220
|
+
ending_before?: string | undefined;
|
|
221
|
+
start_date?: string | undefined;
|
|
222
|
+
end_date?: string | undefined;
|
|
223
|
+
category?: string | undefined;
|
|
224
|
+
origin?: "external_connection" | "link" | undefined;
|
|
225
|
+
sources?: string[] | undefined;
|
|
226
|
+
}, context: Context): Promise<import("..").TransactionsPage>;
|
|
227
|
+
};
|
|
228
|
+
list_sources: {
|
|
229
|
+
description: string;
|
|
230
|
+
inputSchema: z.ZodObject<{
|
|
231
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
232
|
+
starting_after: z.ZodOptional<z.ZodString>;
|
|
233
|
+
ending_before: z.ZodOptional<z.ZodString>;
|
|
234
|
+
}, z.core.$strict>;
|
|
235
|
+
execute(input: {
|
|
236
|
+
limit?: number | undefined;
|
|
237
|
+
starting_after?: string | undefined;
|
|
238
|
+
ending_before?: string | undefined;
|
|
239
|
+
}, context: Context): Promise<import("..").SourcesPage>;
|
|
240
|
+
};
|
|
241
|
+
list_balances: {
|
|
242
|
+
description: string;
|
|
243
|
+
inputSchema: z.ZodObject<{
|
|
244
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
245
|
+
starting_after: z.ZodOptional<z.ZodString>;
|
|
246
|
+
ending_before: z.ZodOptional<z.ZodString>;
|
|
247
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
248
|
+
}, z.core.$strict>;
|
|
249
|
+
execute(input: {
|
|
250
|
+
limit?: number | undefined;
|
|
251
|
+
starting_after?: string | undefined;
|
|
252
|
+
ending_before?: string | undefined;
|
|
253
|
+
sources?: string[] | undefined;
|
|
254
|
+
}, context: Context): Promise<import("..").BalancesPage>;
|
|
255
|
+
};
|
|
256
|
+
create_report: {
|
|
257
|
+
description: string;
|
|
258
|
+
inputSchema: z.ZodObject<{
|
|
259
|
+
domain: z.ZodString;
|
|
260
|
+
outcome: z.ZodEnum<{
|
|
261
|
+
abandoned: "abandoned";
|
|
262
|
+
blocked: "blocked";
|
|
263
|
+
success: "success";
|
|
264
|
+
}>;
|
|
265
|
+
spend_request_id: z.ZodString;
|
|
266
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
267
|
+
"3ds_challenge": "3ds_challenge";
|
|
268
|
+
anti_bot_script: "anti_bot_script";
|
|
269
|
+
captcha: "captcha";
|
|
270
|
+
cdn_block: "cdn_block";
|
|
271
|
+
dns_block: "dns_block";
|
|
272
|
+
login_required: "login_required";
|
|
273
|
+
other: "other";
|
|
274
|
+
page_inaccessible: "page_inaccessible";
|
|
275
|
+
payment_declined: "payment_declined";
|
|
276
|
+
rate_limited: "rate_limited";
|
|
277
|
+
site_error: "site_error";
|
|
278
|
+
stripe_checkout: "stripe_checkout";
|
|
279
|
+
timeout: "timeout";
|
|
280
|
+
waf_block: "waf_block";
|
|
281
|
+
}>>>;
|
|
282
|
+
step: z.ZodOptional<z.ZodString>;
|
|
283
|
+
freeform_context: z.ZodOptional<z.ZodString>;
|
|
284
|
+
attempt_trace: z.ZodOptional<z.ZodString>;
|
|
285
|
+
}, z.core.$strict>;
|
|
286
|
+
execute(input: {
|
|
287
|
+
domain: string;
|
|
288
|
+
outcome: "abandoned" | "blocked" | "success";
|
|
289
|
+
spend_request_id: string;
|
|
290
|
+
tags?: ("3ds_challenge" | "anti_bot_script" | "captcha" | "cdn_block" | "dns_block" | "login_required" | "other" | "page_inaccessible" | "payment_declined" | "rate_limited" | "site_error" | "stripe_checkout" | "timeout" | "waf_block")[] | undefined;
|
|
291
|
+
step?: string | undefined;
|
|
292
|
+
freeform_context?: string | undefined;
|
|
293
|
+
attempt_trace?: string | undefined;
|
|
294
|
+
}, context: Context): Promise<import("..").ReportRecord>;
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
export type LinkTools<Context = unknown> = ReturnType<typeof createLinkTools<Context>>;
|
|
298
|
+
export type LinkToolName = keyof LinkTools;
|
|
299
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAqB5C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAG,OAAO,EAC/C,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAoBzD,kBAAkB;;;uDAV+B,OAAO;;IAexD,oBAAoB;;;uDAf6B,OAAO;;IAoBxD,uBAAuB;;;uDApB0B,OAAO;;IAyBxD,mBAAmB;;;;;;;oBAzB8B,OAAO;;IAmCxD,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAnC6B,OAAO;;IAwCxD,sBAAsB;;;;;;;;;oBAxC2B,OAAO;;IA6CxD,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA7C6B,OAAO;;IAkDxD,sBAAsB;;;;;;;oBAlD2B,OAAO;;IAuDxD,oBAAoB;;;;;;;oBAvD6B,OAAO;;IA4DxD,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;oBA5DgC,OAAO;;IAiExD,YAAY;;;;;;;;;;;oBAjEqC,OAAO;;IAsExD,aAAa;;;;;;;;;;;;;oBAtEoC,OAAO;;IA2ExD,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA3EoC,OAAO;;EAiF3D;AAED,MAAM,MAAM,SAAS,CAAC,OAAO,GAAG,OAAO,IAAI,UAAU,CACnD,OAAO,eAAe,CAAC,OAAO,CAAC,CAChC,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import {
|
|
2
|
+
REPORT_OUTCOMES,
|
|
3
|
+
REPORT_TAGS
|
|
4
|
+
} from "../chunk-TYOT25QK.js";
|
|
5
|
+
|
|
6
|
+
// src/tools/schemas.ts
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
var id = z.string().min(1);
|
|
9
|
+
var money = z.number().int();
|
|
10
|
+
var total = z.strictObject({
|
|
11
|
+
type: z.string(),
|
|
12
|
+
display_text: z.string(),
|
|
13
|
+
amount: money
|
|
14
|
+
});
|
|
15
|
+
var lineItem = z.strictObject({
|
|
16
|
+
name: z.string(),
|
|
17
|
+
quantity: z.number().int().positive().optional(),
|
|
18
|
+
unit_amount: money.optional(),
|
|
19
|
+
description: z.string().optional(),
|
|
20
|
+
sku: z.string().optional(),
|
|
21
|
+
url: z.string().optional(),
|
|
22
|
+
image_url: z.string().optional(),
|
|
23
|
+
product_url: z.string().optional(),
|
|
24
|
+
totals: z.array(total).optional()
|
|
25
|
+
});
|
|
26
|
+
var pagination = {
|
|
27
|
+
limit: z.number().int().min(1).max(100).optional(),
|
|
28
|
+
starting_after: id.optional(),
|
|
29
|
+
ending_before: id.optional()
|
|
30
|
+
};
|
|
31
|
+
var linkToolSchemas = {
|
|
32
|
+
empty: z.strictObject({}),
|
|
33
|
+
spendRequestId: z.strictObject({ id: id.describe("Link spend request ID") }),
|
|
34
|
+
listSpendRequests: z.strictObject({
|
|
35
|
+
include_history: z.boolean().optional().describe("Include expired and terminal requests")
|
|
36
|
+
}),
|
|
37
|
+
retrieveSpendRequest: z.strictObject({
|
|
38
|
+
id: id.describe("Link spend request ID"),
|
|
39
|
+
include: z.array(z.string()).optional().describe(
|
|
40
|
+
"Extra data to return, such as card credentials. Request only when needed for checkout."
|
|
41
|
+
)
|
|
42
|
+
}),
|
|
43
|
+
createSpendRequest: z.strictObject({
|
|
44
|
+
idempotency_key: id.refine(
|
|
45
|
+
(key) => new TextEncoder().encode(key).length <= 255,
|
|
46
|
+
"At most 255 UTF-8 bytes"
|
|
47
|
+
).optional().describe("Reuse only when retrying the same logical creation."),
|
|
48
|
+
payment_details: id.optional().describe("Payment method ID; omit to use the default."),
|
|
49
|
+
credential_type: z.enum(["card", "shared_payment_token"]).default("card"),
|
|
50
|
+
network_id: id.optional().describe("Required for shared payment tokens."),
|
|
51
|
+
execution_method: z.literal("link_pay_token").optional(),
|
|
52
|
+
merchant_account_id: id.optional().describe(
|
|
53
|
+
"For link_pay_token, read data-stripe-merchant-account from the checkout DOM."
|
|
54
|
+
),
|
|
55
|
+
amount: money.positive().max(5e5).describe("Amount in cents."),
|
|
56
|
+
currency: z.string().length(3).default("usd"),
|
|
57
|
+
merchant_name: z.string().min(1).optional(),
|
|
58
|
+
merchant_url: z.url().optional(),
|
|
59
|
+
context: z.string().min(100).describe(
|
|
60
|
+
"Describe the purchase and rationale. The user reads this when approving."
|
|
61
|
+
),
|
|
62
|
+
line_items: z.array(lineItem).optional(),
|
|
63
|
+
totals: z.array(total).optional(),
|
|
64
|
+
request_approval: z.boolean().default(true).describe(
|
|
65
|
+
"Ask Link for user approval; return the approval URL without polling."
|
|
66
|
+
),
|
|
67
|
+
test: z.boolean().default(false).describe("Create test credentials instead of live credentials."),
|
|
68
|
+
metadata: z.record(z.string().max(40), z.string().max(500)).refine(
|
|
69
|
+
(value) => Object.keys(value).length <= 50,
|
|
70
|
+
"At most 50 metadata entries"
|
|
71
|
+
).optional()
|
|
72
|
+
}).superRefine((value, ctx) => {
|
|
73
|
+
if (value.execution_method === "link_pay_token") {
|
|
74
|
+
if (!value.merchant_account_id || value.credential_type !== "card" || value.test || value.network_id || value.merchant_name || value.merchant_url) {
|
|
75
|
+
ctx.addIssue({
|
|
76
|
+
code: "custom",
|
|
77
|
+
message: "link_pay_token requires merchant_account_id and card credentials; omit merchant_name, merchant_url, network_id, and test mode."
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
} else if (value.merchant_account_id) {
|
|
81
|
+
ctx.addIssue({
|
|
82
|
+
code: "custom",
|
|
83
|
+
path: ["merchant_account_id"],
|
|
84
|
+
message: "Requires execution_method: link_pay_token."
|
|
85
|
+
});
|
|
86
|
+
} else if (value.credential_type === "shared_payment_token") {
|
|
87
|
+
if (!value.network_id)
|
|
88
|
+
ctx.addIssue({
|
|
89
|
+
code: "custom",
|
|
90
|
+
path: ["network_id"],
|
|
91
|
+
message: "Required for shared payment tokens."
|
|
92
|
+
});
|
|
93
|
+
} else if (!value.merchant_name || !value.merchant_url) {
|
|
94
|
+
ctx.addIssue({
|
|
95
|
+
code: "custom",
|
|
96
|
+
message: "Card requests require merchant_name and merchant_url."
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}),
|
|
100
|
+
updateSpendRequest: z.strictObject({
|
|
101
|
+
id,
|
|
102
|
+
payment_details: id.optional(),
|
|
103
|
+
amount: money.positive().max(5e5).optional(),
|
|
104
|
+
currency: z.string().length(3).optional(),
|
|
105
|
+
merchant_url: z.url().optional(),
|
|
106
|
+
profile_id: id.optional(),
|
|
107
|
+
merchant_id: id.optional(),
|
|
108
|
+
line_items: z.array(lineItem).optional(),
|
|
109
|
+
totals: z.array(total).optional()
|
|
110
|
+
}),
|
|
111
|
+
listTransactions: z.strictObject({
|
|
112
|
+
...pagination,
|
|
113
|
+
start_date: z.iso.date().optional(),
|
|
114
|
+
end_date: z.iso.date().optional(),
|
|
115
|
+
category: z.string().optional(),
|
|
116
|
+
origin: z.enum(["link", "external_connection"]).optional(),
|
|
117
|
+
sources: z.array(id).optional()
|
|
118
|
+
}),
|
|
119
|
+
listSources: z.strictObject(pagination),
|
|
120
|
+
listBalances: z.strictObject({
|
|
121
|
+
...pagination,
|
|
122
|
+
sources: z.array(id).optional()
|
|
123
|
+
}),
|
|
124
|
+
createReport: z.strictObject({
|
|
125
|
+
domain: z.string().min(1),
|
|
126
|
+
outcome: z.enum(REPORT_OUTCOMES),
|
|
127
|
+
spend_request_id: id,
|
|
128
|
+
tags: z.array(z.enum(REPORT_TAGS)).optional(),
|
|
129
|
+
step: z.string().max(500).optional(),
|
|
130
|
+
freeform_context: z.string().max(500).optional(),
|
|
131
|
+
attempt_trace: z.string().optional().describe(
|
|
132
|
+
"Ordered account of the attempt. The API truncates long traces."
|
|
133
|
+
)
|
|
134
|
+
})
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// src/tools/index.ts
|
|
138
|
+
function defined(value) {
|
|
139
|
+
if (Array.isArray(value)) return value.map(defined);
|
|
140
|
+
if (value !== null && typeof value === "object") {
|
|
141
|
+
return Object.fromEntries(
|
|
142
|
+
Object.entries(value).filter(([, item]) => item !== void 0).map(([key, item]) => [key, defined(item)])
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
return value;
|
|
146
|
+
}
|
|
147
|
+
function createLinkTools(client) {
|
|
148
|
+
function tool(description, inputSchema, execute) {
|
|
149
|
+
return {
|
|
150
|
+
description,
|
|
151
|
+
inputSchema,
|
|
152
|
+
async execute(input, context) {
|
|
153
|
+
const params = defined(inputSchema.parse(input));
|
|
154
|
+
const link = typeof client === "function" ? await client(context) : client;
|
|
155
|
+
return execute(link, params);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
retrieve_user_info: tool(
|
|
161
|
+
"Retrieve the connected Link user profile, wallet limits, and verification requirements.",
|
|
162
|
+
linkToolSchemas.empty,
|
|
163
|
+
(link) => link.userInfo.retrieve()
|
|
164
|
+
),
|
|
165
|
+
list_payment_methods: tool(
|
|
166
|
+
"List saved Link payment methods and identify the default method.",
|
|
167
|
+
linkToolSchemas.empty,
|
|
168
|
+
(link) => link.paymentMethods.list()
|
|
169
|
+
),
|
|
170
|
+
list_shipping_addresses: tool(
|
|
171
|
+
"List the connected Link user\u2019s saved shipping addresses.",
|
|
172
|
+
linkToolSchemas.empty,
|
|
173
|
+
(link) => link.shippingAddresses.list()
|
|
174
|
+
),
|
|
175
|
+
list_spend_requests: tool(
|
|
176
|
+
"List Link spend requests and their current statuses.",
|
|
177
|
+
linkToolSchemas.listSpendRequests,
|
|
178
|
+
(link, input) => link.spendRequests.list(
|
|
179
|
+
input.include_history === void 0 ? {} : { includeHistory: input.include_history }
|
|
180
|
+
)
|
|
181
|
+
),
|
|
182
|
+
create_spend_request: tool(
|
|
183
|
+
"Create a Link spend request for a purchase. Show approval_url to the user; creating a request does not establish approval. Retrieve the same request after approval or required actions.",
|
|
184
|
+
linkToolSchemas.createSpendRequest,
|
|
185
|
+
(link, input) => link.spendRequests.create(input)
|
|
186
|
+
),
|
|
187
|
+
retrieve_spend_request: tool(
|
|
188
|
+
"Retrieve a Link spend request, its approval status, and requested credentials. Follow status_details.requires_action instructions; never assume approval from an earlier status.",
|
|
189
|
+
linkToolSchemas.retrieveSpendRequest,
|
|
190
|
+
(link, { id: id2, ...options }) => link.spendRequests.retrieve(id2, options)
|
|
191
|
+
),
|
|
192
|
+
update_spend_request: tool(
|
|
193
|
+
"Update an existing Link spend request. Check the returned approval status before using credentials.",
|
|
194
|
+
linkToolSchemas.updateSpendRequest,
|
|
195
|
+
(link, { id: id2, ...params }) => link.spendRequests.update(id2, params)
|
|
196
|
+
),
|
|
197
|
+
request_spend_approval: tool(
|
|
198
|
+
"Request human approval for a Link spend request. Show the returned approval URL to the user.",
|
|
199
|
+
linkToolSchemas.spendRequestId,
|
|
200
|
+
(link, { id: id2 }) => link.spendRequests.requestApproval(id2)
|
|
201
|
+
),
|
|
202
|
+
cancel_spend_request: tool(
|
|
203
|
+
"Cancel a Link spend request.",
|
|
204
|
+
linkToolSchemas.spendRequestId,
|
|
205
|
+
(link, { id: id2 }) => link.spendRequests.cancel(id2)
|
|
206
|
+
),
|
|
207
|
+
list_transactions: tool(
|
|
208
|
+
"List Link transactions. Requires the user\u2019s grant to include access to the requested sources.",
|
|
209
|
+
linkToolSchemas.listTransactions,
|
|
210
|
+
(link, input) => link.transactions.list(input)
|
|
211
|
+
),
|
|
212
|
+
list_sources: tool(
|
|
213
|
+
"List connected financial sources available to the Link grant.",
|
|
214
|
+
linkToolSchemas.listSources,
|
|
215
|
+
(link, input) => link.sources.list(input)
|
|
216
|
+
),
|
|
217
|
+
list_balances: tool(
|
|
218
|
+
"List balances for financial sources available to the Link grant.",
|
|
219
|
+
linkToolSchemas.listBalances,
|
|
220
|
+
(link, input) => link.balances.list(input)
|
|
221
|
+
),
|
|
222
|
+
create_report: tool(
|
|
223
|
+
"Report the outcome of a purchase attempt associated with a Link spend request.",
|
|
224
|
+
linkToolSchemas.createReport,
|
|
225
|
+
(link, input) => link.reports.create(input)
|
|
226
|
+
)
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
export {
|
|
230
|
+
createLinkTools,
|
|
231
|
+
linkToolSchemas
|
|
232
|
+
};
|
|
233
|
+
//# sourceMappingURL=index.js.map
|