@grantex/sdk 0.3.7 → 0.3.9
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 +86 -3
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +17 -5
- package/dist/client.js.map +1 -1
- package/dist/http.d.ts +8 -5
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +33 -12
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/commerce.d.ts +284 -0
- package/dist/resources/commerce.d.ts.map +1 -0
- package/dist/resources/commerce.js +178 -0
- package/dist/resources/commerce.js.map +1 -0
- package/dist/resources/grants.d.ts +0 -2
- package/dist/resources/grants.d.ts.map +1 -1
- package/dist/resources/grants.js +6 -6
- package/dist/resources/grants.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/verify.d.ts +2 -1
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +14 -2
- package/dist/verify.js.map +1 -1
- package/package.json +74 -74
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import type { HttpClient } from '../http.js';
|
|
2
|
+
export type CommerceEnvironment = 'sandbox' | 'live';
|
|
3
|
+
export type CommerceProviderKey = 'mock' | 'plural';
|
|
4
|
+
export type CommercePassportType = 'browse' | 'checkout';
|
|
5
|
+
export type CommercePaymentStatus = 'created' | 'authorized' | 'checkout_created' | 'payment_pending' | 'paid' | 'failed' | 'cancelled' | 'expired';
|
|
6
|
+
export type CommerceRecord = Record<string, unknown>;
|
|
7
|
+
export interface CommerceDataResponse<T = CommerceRecord> {
|
|
8
|
+
data: T;
|
|
9
|
+
audit_event_id?: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
export interface CommerceListResponse<T = CommerceRecord> {
|
|
13
|
+
items: T[];
|
|
14
|
+
next_cursor?: string | null;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
export interface CommerceProfile extends CommerceRecord {
|
|
18
|
+
version?: string;
|
|
19
|
+
merchant?: CommerceRecord & {
|
|
20
|
+
merchant_id?: string;
|
|
21
|
+
display_name?: string;
|
|
22
|
+
environment?: CommerceEnvironment;
|
|
23
|
+
default_currency?: string;
|
|
24
|
+
country_code?: string;
|
|
25
|
+
};
|
|
26
|
+
supported_tools?: string[];
|
|
27
|
+
capabilities?: unknown[];
|
|
28
|
+
}
|
|
29
|
+
export interface CommerceIdempotentRequest {
|
|
30
|
+
idempotencyKey: string;
|
|
31
|
+
}
|
|
32
|
+
export interface CommerceTenantCreateParams extends CommerceRecord {
|
|
33
|
+
tenant_id?: string;
|
|
34
|
+
display_name?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CommerceTenantUpdateParams extends CommerceRecord {
|
|
37
|
+
display_name?: string;
|
|
38
|
+
status?: 'active' | 'disabled';
|
|
39
|
+
}
|
|
40
|
+
export interface CommerceDeveloperTenantBindParams extends CommerceRecord {
|
|
41
|
+
developer_id: string;
|
|
42
|
+
tenant_id: string;
|
|
43
|
+
role?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface CommerceMerchantCreateParams extends CommerceRecord {
|
|
46
|
+
display_name: string;
|
|
47
|
+
category_preset: string;
|
|
48
|
+
environment?: CommerceEnvironment;
|
|
49
|
+
default_currency?: string;
|
|
50
|
+
country_code?: string;
|
|
51
|
+
agentic_commerce_requested?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface CommerceMerchantUpdateParams extends CommerceRecord {
|
|
54
|
+
display_name?: string;
|
|
55
|
+
category_preset?: string;
|
|
56
|
+
default_currency?: string;
|
|
57
|
+
country_code?: string;
|
|
58
|
+
agentic_commerce_requested?: boolean;
|
|
59
|
+
agentic_commerce_enabled?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface CommerceAgentCreateParams extends CommerceRecord {
|
|
62
|
+
merchant_id: string;
|
|
63
|
+
display_name: string;
|
|
64
|
+
agentic_org_agent_id?: string;
|
|
65
|
+
trust_status?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface CommerceAgentUpdateParams extends CommerceRecord {
|
|
68
|
+
display_name?: string;
|
|
69
|
+
trust_status?: string;
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface CommerceCatalogVariantInput extends CommerceRecord {
|
|
73
|
+
sku: string;
|
|
74
|
+
price_amount: number;
|
|
75
|
+
currency?: string;
|
|
76
|
+
availability_status?: 'in_stock' | 'out_of_stock' | 'pre_order' | 'back_order' | 'unknown';
|
|
77
|
+
}
|
|
78
|
+
export interface CommerceCatalogProductCreateParams extends CommerceRecord {
|
|
79
|
+
merchant_id: string;
|
|
80
|
+
product_id: string;
|
|
81
|
+
title: string;
|
|
82
|
+
category_preset: string;
|
|
83
|
+
variants: CommerceCatalogVariantInput[];
|
|
84
|
+
}
|
|
85
|
+
export interface CommerceCatalogProductUpdateParams extends CommerceRecord {
|
|
86
|
+
title?: string;
|
|
87
|
+
brand?: string | null;
|
|
88
|
+
description?: string | null;
|
|
89
|
+
image_url?: string | null;
|
|
90
|
+
category_preset?: string;
|
|
91
|
+
status?: 'active' | 'archived';
|
|
92
|
+
variants?: CommerceRecord[];
|
|
93
|
+
}
|
|
94
|
+
export interface CommerceCatalogProductListParams {
|
|
95
|
+
merchant_id?: string;
|
|
96
|
+
query?: string;
|
|
97
|
+
category_preset?: string;
|
|
98
|
+
status?: 'active' | 'archived' | 'all';
|
|
99
|
+
limit?: number;
|
|
100
|
+
cursor?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface CommerceCatalogSearchParams extends CommerceRecord {
|
|
103
|
+
merchant_id?: string;
|
|
104
|
+
query?: string;
|
|
105
|
+
filters?: CommerceRecord;
|
|
106
|
+
limit?: number;
|
|
107
|
+
cursor?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface CommerceCartCreateParams extends CommerceIdempotentRequest {
|
|
110
|
+
merchant_id: string;
|
|
111
|
+
currency: string;
|
|
112
|
+
line_items: Array<{
|
|
113
|
+
variant_id: string;
|
|
114
|
+
quantity: number;
|
|
115
|
+
}>;
|
|
116
|
+
agent_id?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface CommerceConsentRequestCreateParams extends CommerceRecord {
|
|
119
|
+
merchant_id: string;
|
|
120
|
+
passport_type: CommercePassportType;
|
|
121
|
+
requested_scopes?: string[];
|
|
122
|
+
max_amount?: number;
|
|
123
|
+
currency?: string;
|
|
124
|
+
user_principal_hint?: string;
|
|
125
|
+
ttl_seconds?: number;
|
|
126
|
+
}
|
|
127
|
+
export interface CommerceConsentExchangeParams {
|
|
128
|
+
consent_request_id: string;
|
|
129
|
+
}
|
|
130
|
+
export interface CommercePassportVerifyParams {
|
|
131
|
+
passport_jwt: string;
|
|
132
|
+
mode?: 'read_only' | 'payment_affecting';
|
|
133
|
+
expected_merchant_id?: string;
|
|
134
|
+
}
|
|
135
|
+
export interface CommercePassportRevokeParams {
|
|
136
|
+
jti: string;
|
|
137
|
+
reason?: string;
|
|
138
|
+
}
|
|
139
|
+
export interface CommercePolicyCreateParams extends CommerceRecord {
|
|
140
|
+
merchant_id: string;
|
|
141
|
+
rules: CommerceRecord;
|
|
142
|
+
}
|
|
143
|
+
export interface CommercePolicyEvaluateParams extends CommerceRecord {
|
|
144
|
+
merchant_id: string;
|
|
145
|
+
agent_id: string;
|
|
146
|
+
passport_jwt: string;
|
|
147
|
+
action_scope: string;
|
|
148
|
+
amount_minor_units?: number;
|
|
149
|
+
currency?: string;
|
|
150
|
+
}
|
|
151
|
+
export interface CommercePaymentIntentCreateParams extends CommerceIdempotentRequest {
|
|
152
|
+
merchant_id: string;
|
|
153
|
+
cart_id: string;
|
|
154
|
+
passport_jwt: string;
|
|
155
|
+
amount_minor_units: number;
|
|
156
|
+
currency: string;
|
|
157
|
+
provider_key?: CommerceProviderKey;
|
|
158
|
+
agent_id?: string;
|
|
159
|
+
metadata?: CommerceRecord;
|
|
160
|
+
}
|
|
161
|
+
export interface CommercePaymentIntentListParams {
|
|
162
|
+
merchant_id?: string;
|
|
163
|
+
status?: CommercePaymentStatus;
|
|
164
|
+
limit?: number;
|
|
165
|
+
}
|
|
166
|
+
export interface CommerceCheckoutLinkCreateParams extends CommerceIdempotentRequest {
|
|
167
|
+
passport_jwt: string;
|
|
168
|
+
success_url: string;
|
|
169
|
+
cancel_url: string;
|
|
170
|
+
}
|
|
171
|
+
export interface CommerceProviderCredentialCreateParams extends CommerceRecord {
|
|
172
|
+
merchant_id: string;
|
|
173
|
+
provider_key: CommerceProviderKey;
|
|
174
|
+
environment: CommerceEnvironment;
|
|
175
|
+
credential_payload: CommerceRecord;
|
|
176
|
+
}
|
|
177
|
+
export interface CommerceProviderCredentialPatchParams extends CommerceRecord {
|
|
178
|
+
credential_payload?: CommerceRecord;
|
|
179
|
+
status?: 'disabled';
|
|
180
|
+
}
|
|
181
|
+
export interface CommerceProviderCredentialListParams {
|
|
182
|
+
merchant_id?: string;
|
|
183
|
+
provider_key?: CommerceProviderKey;
|
|
184
|
+
environment?: CommerceEnvironment;
|
|
185
|
+
}
|
|
186
|
+
export interface CommerceWebhookSourceCreateParams extends CommerceRecord {
|
|
187
|
+
merchant_id: string;
|
|
188
|
+
source_key: string;
|
|
189
|
+
display_name: string;
|
|
190
|
+
}
|
|
191
|
+
export interface CommerceWebhookSourceListParams {
|
|
192
|
+
merchant_id?: string;
|
|
193
|
+
}
|
|
194
|
+
export interface CommerceOpsHealthParams {
|
|
195
|
+
merchant_id?: string;
|
|
196
|
+
environment?: CommerceEnvironment;
|
|
197
|
+
}
|
|
198
|
+
export interface CommerceProviderWebhookEventListParams {
|
|
199
|
+
merchant_id?: string;
|
|
200
|
+
processing_status?: 'received' | 'processed' | 'ignored' | 'failed';
|
|
201
|
+
provider_key?: CommerceProviderKey;
|
|
202
|
+
limit?: number;
|
|
203
|
+
}
|
|
204
|
+
export interface CommerceProviderWebhookReplayParams {
|
|
205
|
+
reason: string;
|
|
206
|
+
dry_run?: boolean;
|
|
207
|
+
}
|
|
208
|
+
export interface CommerceMcpJsonRpcRequest extends CommerceRecord {
|
|
209
|
+
jsonrpc: '2.0';
|
|
210
|
+
id?: string | number;
|
|
211
|
+
method: string;
|
|
212
|
+
params?: CommerceRecord;
|
|
213
|
+
}
|
|
214
|
+
export declare class CommerceClient {
|
|
215
|
+
#private;
|
|
216
|
+
constructor(http: HttpClient);
|
|
217
|
+
getProfile(params?: {
|
|
218
|
+
merchantId?: string;
|
|
219
|
+
}): Promise<CommerceProfile>;
|
|
220
|
+
mcp(request: CommerceMcpJsonRpcRequest): Promise<CommerceRecord>;
|
|
221
|
+
createTenant(params: CommerceTenantCreateParams): Promise<CommerceDataResponse>;
|
|
222
|
+
listTenants(): Promise<CommerceListResponse>;
|
|
223
|
+
updateTenant(tenantId: string, params: CommerceTenantUpdateParams): Promise<CommerceDataResponse>;
|
|
224
|
+
bindDeveloperTenant(params: CommerceDeveloperTenantBindParams): Promise<CommerceDataResponse>;
|
|
225
|
+
createMerchant(params: CommerceMerchantCreateParams): Promise<CommerceDataResponse>;
|
|
226
|
+
getMerchant(merchantId: string): Promise<CommerceDataResponse>;
|
|
227
|
+
updateMerchant(merchantId: string, params: CommerceMerchantUpdateParams): Promise<CommerceDataResponse>;
|
|
228
|
+
createAgent(params: CommerceAgentCreateParams): Promise<CommerceDataResponse>;
|
|
229
|
+
listAgents(params?: {
|
|
230
|
+
merchant_id?: string;
|
|
231
|
+
limit?: number;
|
|
232
|
+
cursor?: string;
|
|
233
|
+
}): Promise<CommerceListResponse>;
|
|
234
|
+
getAgent(agentId: string): Promise<CommerceDataResponse>;
|
|
235
|
+
updateAgent(agentId: string, params: CommerceAgentUpdateParams): Promise<CommerceDataResponse>;
|
|
236
|
+
createCatalogProduct(params: CommerceCatalogProductCreateParams): Promise<CommerceDataResponse>;
|
|
237
|
+
listCatalogProducts(params: CommerceCatalogProductListParams): Promise<CommerceListResponse>;
|
|
238
|
+
bulkUpsertCatalogProducts(params: CommerceRecord): Promise<CommerceRecord>;
|
|
239
|
+
getCatalogProduct(productId: string, params?: {
|
|
240
|
+
merchant_id?: string;
|
|
241
|
+
}): Promise<CommerceDataResponse>;
|
|
242
|
+
updateCatalogProduct(productId: string, params: CommerceCatalogProductUpdateParams, query?: {
|
|
243
|
+
merchant_id?: string;
|
|
244
|
+
}): Promise<CommerceDataResponse>;
|
|
245
|
+
deleteCatalogProduct(productId: string): Promise<CommerceDataResponse>;
|
|
246
|
+
searchCatalog(params: CommerceCatalogSearchParams): Promise<CommerceListResponse>;
|
|
247
|
+
listAuditEvents(params?: CommerceRecord): Promise<CommerceListResponse>;
|
|
248
|
+
createCart(params: CommerceCartCreateParams): Promise<CommerceDataResponse>;
|
|
249
|
+
getCart(cartId: string): Promise<CommerceDataResponse>;
|
|
250
|
+
createConsentRequest(params: CommerceConsentRequestCreateParams): Promise<CommerceDataResponse>;
|
|
251
|
+
exchangeConsentForPassport(params: CommerceConsentExchangeParams): Promise<CommerceDataResponse>;
|
|
252
|
+
listPassports(): Promise<CommerceListResponse>;
|
|
253
|
+
verifyPassport(params: CommercePassportVerifyParams): Promise<CommerceDataResponse>;
|
|
254
|
+
revokePassport(params: CommercePassportRevokeParams): Promise<CommerceDataResponse>;
|
|
255
|
+
createPolicy(params: CommercePolicyCreateParams): Promise<CommerceDataResponse>;
|
|
256
|
+
listPolicies(params?: {
|
|
257
|
+
merchant_id?: string;
|
|
258
|
+
status?: string;
|
|
259
|
+
limit?: number;
|
|
260
|
+
}): Promise<CommerceListResponse>;
|
|
261
|
+
getPolicy(policyId: string): Promise<CommerceDataResponse>;
|
|
262
|
+
activatePolicy(policyId: string): Promise<CommerceDataResponse>;
|
|
263
|
+
evaluatePolicy(params: CommercePolicyEvaluateParams): Promise<CommerceDataResponse>;
|
|
264
|
+
createPaymentIntent(params: CommercePaymentIntentCreateParams): Promise<CommerceDataResponse>;
|
|
265
|
+
listPaymentIntents(params?: CommercePaymentIntentListParams): Promise<CommerceListResponse>;
|
|
266
|
+
getPaymentIntent(paymentIntentId: string): Promise<CommerceDataResponse>;
|
|
267
|
+
createCheckoutLink(paymentIntentId: string, params: CommerceCheckoutLinkCreateParams): Promise<CommerceDataResponse>;
|
|
268
|
+
reconcilePaymentIntent(paymentIntentId: string): Promise<CommerceDataResponse>;
|
|
269
|
+
createProviderCredential(params: CommerceProviderCredentialCreateParams): Promise<CommerceDataResponse>;
|
|
270
|
+
listProviderCredentials(params?: CommerceProviderCredentialListParams): Promise<CommerceListResponse>;
|
|
271
|
+
patchProviderCredential(credentialId: string, params: CommerceProviderCredentialPatchParams): Promise<CommerceDataResponse>;
|
|
272
|
+
validateProviderCredential(credentialId: string): Promise<CommerceDataResponse>;
|
|
273
|
+
createWebhookSource(params: CommerceWebhookSourceCreateParams): Promise<CommerceDataResponse>;
|
|
274
|
+
listWebhookSources(params?: CommerceWebhookSourceListParams): Promise<CommerceListResponse>;
|
|
275
|
+
updateWebhookSource(sourceKey: string, params: CommerceRecord): Promise<CommerceDataResponse>;
|
|
276
|
+
rotateWebhookSourceSecret(sourceKey: string): Promise<CommerceDataResponse>;
|
|
277
|
+
getOpsHealth(params?: CommerceOpsHealthParams): Promise<CommerceRecord>;
|
|
278
|
+
listProviderWebhookEvents(params?: CommerceProviderWebhookEventListParams): Promise<CommerceListResponse>;
|
|
279
|
+
replayProviderWebhookEvent(eventId: string, params: CommerceProviderWebhookReplayParams): Promise<CommerceDataResponse>;
|
|
280
|
+
handleProviderWebhook(providerKey: CommerceProviderKey, payload: CommerceRecord, options?: {
|
|
281
|
+
headers?: Record<string, string>;
|
|
282
|
+
}): Promise<CommerceDataResponse>;
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=commerce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commerce.d.ts","sourceRoot":"","sources":["../../src/resources/commerce.ts"],"names":[],"mappings":"AAAA,O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vB,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GAC7C,OAAO,CAAC,oBAAoB,CAAC;CAOjC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
export class CommerceClient {
|
|
2
|
+
#http;
|
|
3
|
+
constructor(http) {
|
|
4
|
+
this.#http = http;
|
|
5
|
+
}
|
|
6
|
+
getProfile(params) {
|
|
7
|
+
return this.#http.get(pathWithQuery('/.well-known/grantex-commerce', { merchant_id: params?.merchantId }));
|
|
8
|
+
}
|
|
9
|
+
mcp(request) {
|
|
10
|
+
return this.#http.post('/mcp', request);
|
|
11
|
+
}
|
|
12
|
+
createTenant(params) {
|
|
13
|
+
return this.#http.post('/v1/commerce/tenants', params);
|
|
14
|
+
}
|
|
15
|
+
listTenants() {
|
|
16
|
+
return this.#http.get('/v1/commerce/tenants');
|
|
17
|
+
}
|
|
18
|
+
updateTenant(tenantId, params) {
|
|
19
|
+
return this.#http.patch(`/v1/commerce/tenants/${encodeURIComponent(tenantId)}`, params);
|
|
20
|
+
}
|
|
21
|
+
bindDeveloperTenant(params) {
|
|
22
|
+
return this.#http.post('/v1/commerce/developer-tenants', params);
|
|
23
|
+
}
|
|
24
|
+
createMerchant(params) {
|
|
25
|
+
return this.#http.post('/v1/commerce/merchants', params);
|
|
26
|
+
}
|
|
27
|
+
getMerchant(merchantId) {
|
|
28
|
+
return this.#http.get(`/v1/commerce/merchants/${encodeURIComponent(merchantId)}`);
|
|
29
|
+
}
|
|
30
|
+
updateMerchant(merchantId, params) {
|
|
31
|
+
return this.#http.patch(`/v1/commerce/merchants/${encodeURIComponent(merchantId)}`, params);
|
|
32
|
+
}
|
|
33
|
+
createAgent(params) {
|
|
34
|
+
return this.#http.post('/v1/commerce/agents', params);
|
|
35
|
+
}
|
|
36
|
+
listAgents(params) {
|
|
37
|
+
return this.#http.get(pathWithQuery('/v1/commerce/agents', params));
|
|
38
|
+
}
|
|
39
|
+
getAgent(agentId) {
|
|
40
|
+
return this.#http.get(`/v1/commerce/agents/${encodeURIComponent(agentId)}`);
|
|
41
|
+
}
|
|
42
|
+
updateAgent(agentId, params) {
|
|
43
|
+
return this.#http.patch(`/v1/commerce/agents/${encodeURIComponent(agentId)}`, params);
|
|
44
|
+
}
|
|
45
|
+
createCatalogProduct(params) {
|
|
46
|
+
return this.#http.post('/v1/commerce/catalog/products', params);
|
|
47
|
+
}
|
|
48
|
+
listCatalogProducts(params) {
|
|
49
|
+
return this.#http.get(pathWithQuery('/v1/commerce/catalog/products', params));
|
|
50
|
+
}
|
|
51
|
+
bulkUpsertCatalogProducts(params) {
|
|
52
|
+
return this.#http.post('/v1/commerce/catalog/products/bulk', params);
|
|
53
|
+
}
|
|
54
|
+
getCatalogProduct(productId, params) {
|
|
55
|
+
return this.#http.get(pathWithQuery(`/v1/commerce/catalog/products/${encodeURIComponent(productId)}`, params));
|
|
56
|
+
}
|
|
57
|
+
updateCatalogProduct(productId, params, query) {
|
|
58
|
+
return this.#http.patch(pathWithQuery(`/v1/commerce/catalog/products/${encodeURIComponent(productId)}`, query), params);
|
|
59
|
+
}
|
|
60
|
+
deleteCatalogProduct(productId) {
|
|
61
|
+
return this.#http.delete(`/v1/commerce/catalog/products/${encodeURIComponent(productId)}`);
|
|
62
|
+
}
|
|
63
|
+
searchCatalog(params) {
|
|
64
|
+
return this.#http.post('/v1/commerce/catalog/search', params);
|
|
65
|
+
}
|
|
66
|
+
listAuditEvents(params) {
|
|
67
|
+
return this.#http.get(pathWithQuery('/v1/commerce/audit/events', params));
|
|
68
|
+
}
|
|
69
|
+
createCart(params) {
|
|
70
|
+
const { idempotencyKey, ...body } = params;
|
|
71
|
+
return this.#http.post('/v1/commerce/carts', body, idempotencyOptions(idempotencyKey));
|
|
72
|
+
}
|
|
73
|
+
getCart(cartId) {
|
|
74
|
+
return this.#http.get(`/v1/commerce/carts/${encodeURIComponent(cartId)}`);
|
|
75
|
+
}
|
|
76
|
+
createConsentRequest(params) {
|
|
77
|
+
return this.#http.post('/v1/commerce/passports/consent-requests', params);
|
|
78
|
+
}
|
|
79
|
+
exchangeConsentForPassport(params) {
|
|
80
|
+
return this.#http.post('/v1/commerce/passports/exchange', params);
|
|
81
|
+
}
|
|
82
|
+
listPassports() {
|
|
83
|
+
return this.#http.get('/v1/commerce/passports');
|
|
84
|
+
}
|
|
85
|
+
verifyPassport(params) {
|
|
86
|
+
return this.#http.post('/v1/commerce/passports/verify', params);
|
|
87
|
+
}
|
|
88
|
+
revokePassport(params) {
|
|
89
|
+
return this.#http.post('/v1/commerce/passports/revoke', params);
|
|
90
|
+
}
|
|
91
|
+
createPolicy(params) {
|
|
92
|
+
return this.#http.post('/v1/commerce/policies', params);
|
|
93
|
+
}
|
|
94
|
+
listPolicies(params) {
|
|
95
|
+
return this.#http.get(pathWithQuery('/v1/commerce/policies', params));
|
|
96
|
+
}
|
|
97
|
+
getPolicy(policyId) {
|
|
98
|
+
return this.#http.get(`/v1/commerce/policies/${encodeURIComponent(policyId)}`);
|
|
99
|
+
}
|
|
100
|
+
activatePolicy(policyId) {
|
|
101
|
+
return this.#http.post(`/v1/commerce/policies/${encodeURIComponent(policyId)}/activate`);
|
|
102
|
+
}
|
|
103
|
+
evaluatePolicy(params) {
|
|
104
|
+
return this.#http.post('/v1/commerce/policies/evaluate', params);
|
|
105
|
+
}
|
|
106
|
+
createPaymentIntent(params) {
|
|
107
|
+
const { idempotencyKey, ...body } = params;
|
|
108
|
+
return this.#http.post('/v1/commerce/payments/intents', body, idempotencyOptions(idempotencyKey));
|
|
109
|
+
}
|
|
110
|
+
listPaymentIntents(params) {
|
|
111
|
+
return this.#http.get(pathWithQuery('/v1/commerce/payments/intents', params));
|
|
112
|
+
}
|
|
113
|
+
getPaymentIntent(paymentIntentId) {
|
|
114
|
+
return this.#http.get(`/v1/commerce/payments/intents/${encodeURIComponent(paymentIntentId)}`);
|
|
115
|
+
}
|
|
116
|
+
createCheckoutLink(paymentIntentId, params) {
|
|
117
|
+
const { idempotencyKey, ...body } = params;
|
|
118
|
+
return this.#http.post(`/v1/commerce/payments/intents/${encodeURIComponent(paymentIntentId)}/checkout-link`, body, idempotencyOptions(idempotencyKey));
|
|
119
|
+
}
|
|
120
|
+
reconcilePaymentIntent(paymentIntentId) {
|
|
121
|
+
return this.#http.post(`/v1/commerce/payments/intents/${encodeURIComponent(paymentIntentId)}/reconcile`);
|
|
122
|
+
}
|
|
123
|
+
createProviderCredential(params) {
|
|
124
|
+
return this.#http.post('/v1/commerce/provider-credentials', params);
|
|
125
|
+
}
|
|
126
|
+
listProviderCredentials(params) {
|
|
127
|
+
return this.#http.get(pathWithQuery('/v1/commerce/provider-credentials', params));
|
|
128
|
+
}
|
|
129
|
+
patchProviderCredential(credentialId, params) {
|
|
130
|
+
return this.#http.patch(`/v1/commerce/provider-credentials/${encodeURIComponent(credentialId)}`, params);
|
|
131
|
+
}
|
|
132
|
+
validateProviderCredential(credentialId) {
|
|
133
|
+
return this.#http.post(`/v1/commerce/provider-credentials/${encodeURIComponent(credentialId)}/validate`);
|
|
134
|
+
}
|
|
135
|
+
createWebhookSource(params) {
|
|
136
|
+
return this.#http.post('/v1/commerce/webhook-sources', params);
|
|
137
|
+
}
|
|
138
|
+
listWebhookSources(params) {
|
|
139
|
+
return this.#http.get(pathWithQuery('/v1/commerce/webhook-sources', params));
|
|
140
|
+
}
|
|
141
|
+
updateWebhookSource(sourceKey, params) {
|
|
142
|
+
return this.#http.patch(`/v1/commerce/webhook-sources/${encodeURIComponent(sourceKey)}`, params);
|
|
143
|
+
}
|
|
144
|
+
rotateWebhookSourceSecret(sourceKey) {
|
|
145
|
+
return this.#http.post(`/v1/commerce/webhook-sources/${encodeURIComponent(sourceKey)}/rotate-secret`);
|
|
146
|
+
}
|
|
147
|
+
getOpsHealth(params) {
|
|
148
|
+
return this.#http.get(pathWithQuery('/v1/commerce/ops/health', params));
|
|
149
|
+
}
|
|
150
|
+
listProviderWebhookEvents(params) {
|
|
151
|
+
return this.#http.get(pathWithQuery('/v1/commerce/ops/provider-webhook-events', params));
|
|
152
|
+
}
|
|
153
|
+
replayProviderWebhookEvent(eventId, params) {
|
|
154
|
+
return this.#http.post(`/v1/commerce/ops/provider-webhook-events/${encodeURIComponent(eventId)}/replay`, params);
|
|
155
|
+
}
|
|
156
|
+
handleProviderWebhook(providerKey, payload, options) {
|
|
157
|
+
return this.#http.post(`/v1/webhooks/providers/${encodeURIComponent(providerKey)}`, payload, options);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function idempotencyOptions(idempotencyKey) {
|
|
161
|
+
return { headers: { 'Idempotency-Key': idempotencyKey } };
|
|
162
|
+
}
|
|
163
|
+
function pathWithQuery(path, params) {
|
|
164
|
+
const query = buildQuery(params);
|
|
165
|
+
return query ? `${path}?${query}` : path;
|
|
166
|
+
}
|
|
167
|
+
function buildQuery(params) {
|
|
168
|
+
if (!params)
|
|
169
|
+
return '';
|
|
170
|
+
const search = new URLSearchParams();
|
|
171
|
+
for (const [key, value] of Object.entries(params)) {
|
|
172
|
+
if (value === undefined || value === null)
|
|
173
|
+
continue;
|
|
174
|
+
search.set(key, String(value));
|
|
175
|
+
}
|
|
176
|
+
return search.toString();
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=commerce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commerce.js","sourceRoot":"","sources":["../../src/resources/commerce.ts"],"names":[],"mappings":"AAgQA,MAAM,OAAO,cAAc;IAChB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,UAAU,CAAC,MAAgC;QACzC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CACnB,aAAa,CAAC,+BAA+B,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CACpF,CAAC;IACJ,CAAC;IAED,GAAG,CAAC,OAAkC;QACpC,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MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACrC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAA6B,EAAE,CAAC;QAC9E,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;YAAE,SAAS;QACpD,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -17,8 +17,6 @@ export declare class GrantsClient {
|
|
|
17
17
|
}>;
|
|
18
18
|
/**
|
|
19
19
|
* Verify a grant token via the API (online verification).
|
|
20
|
-
* Returns a clean VerifiedGrant shape by decoding the raw token returned
|
|
21
|
-
* from the server to fill fields the summary response may omit.
|
|
22
20
|
*/
|
|
23
21
|
verify(token: string): Promise<VerifiedGrant>;
|
|
24
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grants.d.ts","sourceRoot":"","sources":["../../src/resources/grants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"grants.d.ts","sourceRoot":"","sources":["../../src/resources/grants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,KAAK,EACV,KAAK,EACL,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,cAAc,EAEf,MAAM,aAAa,CAAC;AAErB,qBAAa,YAAY;;gBAGX,IAAI,EAAE,UAAU;IAI5B,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAIpC,IAAI,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAM5D,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAIvH;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAgBpD"}
|
package/dist/resources/grants.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { claimsToVerifiedGrant } from '../verify.js';
|
|
2
|
+
import { GrantexTokenError } from '../errors.js';
|
|
2
3
|
export class GrantsClient {
|
|
3
4
|
#http;
|
|
4
5
|
constructor(http) {
|
|
@@ -23,14 +24,13 @@ export class GrantsClient {
|
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
26
|
* Verify a grant token via the API (online verification).
|
|
26
|
-
* Returns a clean VerifiedGrant shape by decoding the raw token returned
|
|
27
|
-
* from the server to fill fields the summary response may omit.
|
|
28
27
|
*/
|
|
29
28
|
async verify(token) {
|
|
30
29
|
const response = await this.#http.post('/v1/grants/verify', { token });
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
if (!response.active || !response.claims) {
|
|
31
|
+
throw new GrantexTokenError(`Grant token is not active${response.reason ? `: ${response.reason}` : ''}`);
|
|
32
|
+
}
|
|
33
|
+
return claimsToVerifiedGrant(response.claims);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function buildQuery(params) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grants.js","sourceRoot":"","sources":["../../src/resources/grants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"grants.js","sourceRoot":"","sources":["../../src/resources/grants.ts"],"names":[],"mappings":"AACA,OAA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,OAAO,qBAAqB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;CACF;AAED,SAAS,UAAU,CAAC,MAAyB;IAC3C,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAC3C,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CACL,CAAC;IACtC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,OAAO,OAAO;SACX,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5E,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ export interface GrantexClientOptions {
|
|
|
9
9
|
apiKey?: string;
|
|
10
10
|
/** Base URL for the Grantex API. Defaults to https://api.grantex.dev */
|
|
11
11
|
baseUrl?: string;
|
|
12
|
+
/** Override the JWKS URL used for offline token verification. Defaults to `${baseUrl}/.well-known/jwks.json`. */
|
|
13
|
+
jwksUri?: string;
|
|
14
|
+
/** Expected JWT issuer for offline token verification. Set this when tokens are issued for a canonical domain different from `baseUrl`. */
|
|
15
|
+
issuer?: string;
|
|
12
16
|
/** Request timeout in milliseconds. Defaults to 30000. */
|
|
13
17
|
timeout?: number;
|
|
14
18
|
/** Maximum number of retries for transient failures (429, 502, 503, 504). Defaults to 3. Set to 0 to disable. */
|
|
@@ -232,6 +236,8 @@ export interface VerifyGrantTokenOptions {
|
|
|
232
236
|
jwksUri: string;
|
|
233
237
|
requiredScopes?: string[];
|
|
234
238
|
audience?: string;
|
|
239
|
+
/** Expected issuer URL. Defaults to the issuer derived from issuerDid or jwksUri. */
|
|
240
|
+
issuer?: string;
|
|
235
241
|
/** Resolve a did:web DID to derive the JWKS URL instead of using jwksUri directly */
|
|
236
242
|
issuerDid?: string;
|
|
237
243
|
/** @internal override clock for testing */
|