@gr4vy/sdk 0.18.1 → 0.18.4
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 +32 -7
- package/bin/mcp-server.js +12 -6
- package/bin/mcp-server.js.map +10 -9
- package/docs/sdks/transactions/README.md +1 -1
- package/funcs/transactionsVoid.d.ts +1 -1
- package/funcs/transactionsVoid.js +1 -1
- package/hooks/hooks.d.ts.map +1 -1
- package/hooks/hooks.js +2 -0
- package/hooks/hooks.js.map +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/config.js +2 -2
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.js +1 -1
- package/mcp-server/tools/transactionsVoid.js +1 -1
- package/mcp-server/tools/transactionsVoid.js.map +1 -1
- package/package.json +1 -1
- package/sdk/transactions.d.ts +1 -1
- package/sdk/transactions.js +1 -1
- package/src/funcs/transactionsVoid.ts +1 -1
- package/src/hooks/hooks.ts +3 -0
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/mcp-server/tools/transactionsVoid.ts +1 -1
- package/src/sdk/transactions.ts +1 -1
package/README.md
CHANGED
|
@@ -34,10 +34,10 @@ For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
|
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
36
|
import fs from "fs";
|
|
37
|
-
import {
|
|
37
|
+
import { Gr4vy, withToken } from "@gr4vy/sdk";
|
|
38
38
|
|
|
39
39
|
async function run() {
|
|
40
|
-
const
|
|
40
|
+
const gr4vy = new Gr4vy({
|
|
41
41
|
server: "sandbox",
|
|
42
42
|
id: "example",
|
|
43
43
|
bearerAuth: withToken({
|
|
@@ -45,7 +45,7 @@ async function run() {
|
|
|
45
45
|
}),
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
const result = await
|
|
48
|
+
const result = await gr4vy.transactions.listTransactions({});
|
|
49
49
|
|
|
50
50
|
// Handle the result
|
|
51
51
|
console.log(result);
|
|
@@ -81,18 +81,18 @@ run();
|
|
|
81
81
|
Alternatively, you can create a token for use with Embed as follows.
|
|
82
82
|
|
|
83
83
|
```js
|
|
84
|
-
import {
|
|
84
|
+
import { Gr4vy, getEmbedToken } from "@gr4vy/sdk";
|
|
85
85
|
|
|
86
86
|
async function run() {
|
|
87
87
|
const privateKey = fs.readFileSync("private_key.pem", "utf8")
|
|
88
88
|
|
|
89
|
-
const
|
|
89
|
+
const gr4vy = new Gr4vy({
|
|
90
90
|
server: "sandbox",
|
|
91
91
|
id: "example",
|
|
92
92
|
bearerAuth: withToken({ privateKey }),
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
const checkoutSession =
|
|
95
|
+
const checkoutSession = await gr4vy.checkoutSessions.create()
|
|
96
96
|
|
|
97
97
|
const token = await getEmbedToken({
|
|
98
98
|
privateKey,
|
|
@@ -102,7 +102,8 @@ async function run() {
|
|
|
102
102
|
currency: 'USD',
|
|
103
103
|
buyerExternalIdentifier: 'user-1234',
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
});
|
|
106
|
+
|
|
106
107
|
console.log(token);
|
|
107
108
|
}
|
|
108
109
|
|
|
@@ -112,6 +113,29 @@ run();
|
|
|
112
113
|
> **Note:** This will only create a token once. Use `withToken` to dynamically generate a token
|
|
113
114
|
> for every request.
|
|
114
115
|
|
|
116
|
+
## Merchant account ID selection
|
|
117
|
+
|
|
118
|
+
Depending on the key used, you might need to explicitly define a merchant account ID to use. In our API,
|
|
119
|
+
this uses the `X-GR4VY-MERCHANT-ACCOUNT-ID` header. When using the SDK, you can set the `merchantAccountId`
|
|
120
|
+
on every request.
|
|
121
|
+
|
|
122
|
+
```js
|
|
123
|
+
const result = await gr4vy.transactions.list({
|
|
124
|
+
merchantAccountId: 'merchant-12345'
|
|
125
|
+
})
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Alternatively, the merchant account ID can also be set when initializing the SDK.
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
const gr4vy = new Gr4vy({
|
|
132
|
+
server: "sandbox",
|
|
133
|
+
id: "example",
|
|
134
|
+
merchantAccountId: 'merchant-12345',
|
|
135
|
+
bearerAuth: withToken({ privateKey }),
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
115
139
|
|
|
116
140
|
## Webhooks verification
|
|
117
141
|
|
|
@@ -901,6 +925,7 @@ Gr4vy: The Gr4vy API.
|
|
|
901
925
|
* [SDK Example Usage](#sdk-example-usage)
|
|
902
926
|
* [Bearer token generation](#bearer-token-generation)
|
|
903
927
|
* [Embed token generation](#embed-token-generation)
|
|
928
|
+
* [Merchant account ID selection](#merchant-account-id-selection)
|
|
904
929
|
* [Webhooks verification](#webhooks-verification)
|
|
905
930
|
* [Available Resources and Operations](#available-resources-and-operations)
|
|
906
931
|
* [Error Handling](#error-handling)
|
package/bin/mcp-server.js
CHANGED
|
@@ -4026,9 +4026,9 @@ var init_config = __esm(() => {
|
|
|
4026
4026
|
SDK_METADATA = {
|
|
4027
4027
|
language: "typescript",
|
|
4028
4028
|
openapiDocVersion: "1.0.0",
|
|
4029
|
-
sdkVersion: "0.18.
|
|
4029
|
+
sdkVersion: "0.18.4",
|
|
4030
4030
|
genVersion: "2.591.1",
|
|
4031
|
-
userAgent: "speakeasy-sdk/typescript 0.18.
|
|
4031
|
+
userAgent: "speakeasy-sdk/typescript 0.18.4 2.591.1 1.0.0 @gr4vy/sdk"
|
|
4032
4032
|
};
|
|
4033
4033
|
});
|
|
4034
4034
|
|
|
@@ -34058,6 +34058,9 @@ var init_mcp = __esm(() => {
|
|
|
34058
34058
|
};
|
|
34059
34059
|
});
|
|
34060
34060
|
|
|
34061
|
+
// src/hooks/registration.ts
|
|
34062
|
+
function initHooks(hooks) {}
|
|
34063
|
+
|
|
34061
34064
|
// src/hooks/hooks.ts
|
|
34062
34065
|
class SDKHooks {
|
|
34063
34066
|
sdkInitHooks = [];
|
|
@@ -34084,6 +34087,7 @@ class SDKHooks {
|
|
|
34084
34087
|
this.registerAfterErrorHook(hook);
|
|
34085
34088
|
}
|
|
34086
34089
|
}
|
|
34090
|
+
initHooks(this);
|
|
34087
34091
|
}
|
|
34088
34092
|
registerSDKInitHook(hook) {
|
|
34089
34093
|
this.sdkInitHooks.push(hook);
|
|
@@ -34135,6 +34139,7 @@ class SDKHooks {
|
|
|
34135
34139
|
return { response: res, error: err };
|
|
34136
34140
|
}
|
|
34137
34141
|
}
|
|
34142
|
+
var init_hooks = () => {};
|
|
34138
34143
|
|
|
34139
34144
|
// src/models/errors/httpclienterrors.ts
|
|
34140
34145
|
var HTTPClientError, UnexpectedClientError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, ConnectionError;
|
|
@@ -34985,6 +34990,7 @@ async function logResponse(logger, res, req) {
|
|
|
34985
34990
|
}
|
|
34986
34991
|
var gt, webWorkerLike, isBrowserLike, jsonLikeContentTypeRE, jsonlLikeContentTypeRE;
|
|
34987
34992
|
var init_sdks = __esm(() => {
|
|
34993
|
+
init_hooks();
|
|
34988
34994
|
init_httpclienterrors();
|
|
34989
34995
|
init_base64();
|
|
34990
34996
|
init_config();
|
|
@@ -55963,7 +55969,7 @@ var init_transactionsVoid2 = __esm(() => {
|
|
|
55963
55969
|
name: "transactions-void",
|
|
55964
55970
|
description: `Void transaction
|
|
55965
55971
|
|
|
55966
|
-
Void
|
|
55972
|
+
Void a previously authorized transaction.`,
|
|
55967
55973
|
args: args63,
|
|
55968
55974
|
tool: async (client, args64, ctx) => {
|
|
55969
55975
|
const [result, apiCall] = await transactionsVoid(client, args64.transactionId, args64.timeoutInSeconds, args64.merchantAccountId, { fetchOptions: { signal: ctx.signal } }).$inspect();
|
|
@@ -55983,7 +55989,7 @@ Void an authorized transaction.`,
|
|
|
55983
55989
|
function createMCPServer(deps) {
|
|
55984
55990
|
const server = new McpServer({
|
|
55985
55991
|
name: "Gr4vy",
|
|
55986
|
-
version: "0.18.
|
|
55992
|
+
version: "0.18.4"
|
|
55987
55993
|
});
|
|
55988
55994
|
const client = new Gr4vyCore({
|
|
55989
55995
|
bearerAuth: deps.bearerAuth,
|
|
@@ -57341,7 +57347,7 @@ var routes = an({
|
|
|
57341
57347
|
var app = He(routes, {
|
|
57342
57348
|
name: "mcp",
|
|
57343
57349
|
versionInfo: {
|
|
57344
|
-
currentVersion: "0.18.
|
|
57350
|
+
currentVersion: "0.18.4"
|
|
57345
57351
|
}
|
|
57346
57352
|
});
|
|
57347
57353
|
zt(app, process3.argv.slice(2), buildContext(process3));
|
|
@@ -57349,5 +57355,5 @@ export {
|
|
|
57349
57355
|
app
|
|
57350
57356
|
};
|
|
57351
57357
|
|
|
57352
|
-
//# debugId=
|
|
57358
|
+
//# debugId=CEBF585E3F41DAFF64756E2164756E21
|
|
57353
57359
|
//# sourceMappingURL=mcp-server.js.map
|