@moovio/sdk 0.0.0-dev.17 → 0.0.0-dev.19
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 +75 -60
- package/bin/mcp-server.js +1295 -966
- package/bin/mcp-server.js.map +25 -16
- package/funcs/cardsGetMetadata.d.ts +21 -0
- package/funcs/cardsGetMetadata.d.ts.map +1 -0
- package/funcs/cardsGetMetadata.js +126 -0
- package/funcs/cardsGetMetadata.js.map +1 -0
- package/hooks/access-token-hook.d.ts +25 -0
- package/hooks/access-token-hook.d.ts.map +1 -0
- package/hooks/access-token-hook.js +60 -0
- package/hooks/access-token-hook.js.map +1 -0
- package/hooks/registration.d.ts.map +1 -1
- package/hooks/registration.js +4 -0
- package/hooks/registration.js.map +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +7 -3
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +3 -3
- package/lib/config.js.map +1 -1
- package/mcp-server/cli/start/command.d.ts.map +1 -1
- package/mcp-server/cli/start/command.js +8 -0
- package/mcp-server/cli/start/command.js.map +1 -1
- package/mcp-server/cli/start/impl.d.ts +1 -0
- package/mcp-server/cli/start/impl.d.ts.map +1 -1
- package/mcp-server/cli/start/impl.js +2 -0
- package/mcp-server/cli/start/impl.js.map +1 -1
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.d.ts +1 -0
- package/mcp-server/server.d.ts.map +1 -1
- package/mcp-server/server.js +4 -1
- package/mcp-server/server.js.map +1 -1
- package/mcp-server/tools/cardsGetMetadata.d.ts +8 -0
- package/mcp-server/tools/cardsGetMetadata.d.ts.map +1 -0
- package/mcp-server/tools/cardsGetMetadata.js +67 -0
- package/mcp-server/tools/cardsGetMetadata.js.map +1 -0
- package/models/components/cardmetadata.d.ts +91 -0
- package/models/components/cardmetadata.d.ts.map +1 -0
- package/models/components/cardmetadata.js +85 -0
- package/models/components/cardmetadata.js.map +1 -0
- package/models/components/cardmetadatarequest.d.ts +30 -0
- package/models/components/cardmetadatarequest.d.ts.map +1 -0
- package/models/components/cardmetadatarequest.js +62 -0
- package/models/components/cardmetadatarequest.js.map +1 -0
- package/models/components/collectionpaymentmethodtype.d.ts +1 -0
- package/models/components/collectionpaymentmethodtype.d.ts.map +1 -1
- package/models/components/collectionpaymentmethodtype.js +1 -0
- package/models/components/collectionpaymentmethodtype.js.map +1 -1
- package/models/components/createreversal.d.ts +6 -0
- package/models/components/createreversal.d.ts.map +1 -1
- package/models/components/createreversal.js +3 -0
- package/models/components/createreversal.js.map +1 -1
- package/models/components/index.d.ts +4 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +4 -0
- package/models/components/index.js.map +1 -1
- package/models/components/reversalamountdetails.d.ts +21 -0
- package/models/components/reversalamountdetails.d.ts.map +1 -0
- package/models/components/reversalamountdetails.js +60 -0
- package/models/components/reversalamountdetails.js.map +1 -0
- package/models/components/reversalamountdetailsvalidationerror.d.ts +17 -0
- package/models/components/reversalamountdetailsvalidationerror.d.ts.map +1 -0
- package/models/components/reversalamountdetailsvalidationerror.js +59 -0
- package/models/components/reversalamountdetailsvalidationerror.js.map +1 -0
- package/models/errors/cardmetadatarequesterror.d.ts +31 -0
- package/models/errors/cardmetadatarequesterror.d.ts.map +1 -0
- package/models/errors/cardmetadatarequesterror.js +85 -0
- package/models/errors/cardmetadatarequesterror.js.map +1 -0
- package/models/errors/index.d.ts +1 -0
- package/models/errors/index.d.ts.map +1 -1
- package/models/errors/index.js +1 -0
- package/models/errors/index.js.map +1 -1
- package/models/errors/reversalvalidationerror.d.ts +4 -0
- package/models/errors/reversalvalidationerror.d.ts.map +1 -1
- package/models/errors/reversalvalidationerror.js +6 -0
- package/models/errors/reversalvalidationerror.js.map +1 -1
- package/models/operations/getcardmetadata.d.ts +24 -0
- package/models/operations/getcardmetadata.d.ts.map +1 -0
- package/models/operations/getcardmetadata.js +72 -0
- package/models/operations/getcardmetadata.js.map +1 -0
- package/models/operations/index.d.ts +1 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +1 -0
- package/models/operations/index.js.map +1 -1
- package/package.json +1 -1
- package/sdk/cards.d.ts +10 -0
- package/sdk/cards.d.ts.map +1 -1
- package/sdk/cards.js +12 -0
- package/sdk/cards.js.map +1 -1
- package/src/funcs/cardsGetMetadata.ts +184 -0
- package/src/hooks/access-token-hook.ts +73 -0
- package/src/hooks/registration.ts +5 -0
- package/src/lib/config.ts +8 -3
- package/src/mcp-server/cli/start/command.ts +9 -0
- package/src/mcp-server/cli/start/impl.ts +3 -0
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +5 -1
- package/src/mcp-server/tools/cardsGetMetadata.ts +41 -0
- package/src/models/components/cardmetadata.ts +160 -0
- package/src/models/components/cardmetadatarequest.ts +72 -0
- package/src/models/components/collectionpaymentmethodtype.ts +1 -0
- package/src/models/components/createreversal.ts +13 -0
- package/src/models/components/index.ts +4 -0
- package/src/models/components/reversalamountdetails.ts +61 -0
- package/src/models/components/reversalamountdetailsvalidationerror.ts +55 -0
- package/src/models/errors/cardmetadatarequesterror.ts +80 -0
- package/src/models/errors/index.ts +1 -0
- package/src/models/errors/reversalvalidationerror.ts +12 -0
- package/src/models/operations/getcardmetadata.ts +67 -0
- package/src/models/operations/index.ts +1 -0
- package/src/sdk/cards.ts +21 -0
- package/test/tests/accessToken.test.ts +86 -0
package/sdk/cards.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Cards = void 0;
|
|
7
7
|
const cardsDisable_js_1 = require("../funcs/cardsDisable.js");
|
|
8
8
|
const cardsGet_js_1 = require("../funcs/cardsGet.js");
|
|
9
|
+
const cardsGetMetadata_js_1 = require("../funcs/cardsGetMetadata.js");
|
|
9
10
|
const cardsLink_js_1 = require("../funcs/cardsLink.js");
|
|
10
11
|
const cardsList_js_1 = require("../funcs/cardsList.js");
|
|
11
12
|
const cardsUpdate_js_1 = require("../funcs/cardsUpdate.js");
|
|
@@ -84,6 +85,17 @@ class Cards extends sdks_js_1.ClientSDK {
|
|
|
84
85
|
async disable(request, options) {
|
|
85
86
|
return (0, fp_js_1.unwrapAsync)((0, cardsDisable_js_1.cardsDisable)(this, request, options));
|
|
86
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Look up metadata for a card without linking it to a Moov account.
|
|
90
|
+
*
|
|
91
|
+
* Only use this endpoint if you have provided Moov with a copy of your PCI attestation of compliance.
|
|
92
|
+
*
|
|
93
|
+
* To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
|
94
|
+
* you'll need to specify the `/card-metadata.read` scope.
|
|
95
|
+
*/
|
|
96
|
+
async getMetadata(request, options) {
|
|
97
|
+
return (0, fp_js_1.unwrapAsync)((0, cardsGetMetadata_js_1.cardsGetMetadata)(this, request, options));
|
|
98
|
+
}
|
|
87
99
|
}
|
|
88
100
|
exports.Cards = Cards;
|
|
89
101
|
//# sourceMappingURL=cards.js.map
|
package/sdk/cards.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cards.js","sourceRoot":"","sources":["../src/sdk/cards.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,8DAAwD;AACxD,sDAAgD;AAChD,wDAAkD;AAClD,wDAAkD;AAClD,4DAAsD;AACtD,4CAA2D;
|
|
1
|
+
{"version":3,"file":"cards.js","sourceRoot":"","sources":["../src/sdk/cards.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,8DAAwD;AACxD,sDAAgD;AAChD,sEAAgE;AAChE,wDAAkD;AAClD,wDAAkD;AAClD,4DAAsD;AACtD,4CAA2D;AAG3D,0CAA6C;AAE7C,MAAa,KAAM,SAAQ,mBAAS;IAClC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,IAAI,CACR,OAAmC,EACnC,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,wBAAS,EAC1B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI,CACR,OAAoC,EACpC,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,wBAAS,EAC1B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG,CACP,OAAkC,EAClC,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,sBAAQ,EACzB,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,MAAM,CACV,OAAqC,EACrC,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,4BAAW,EAC5B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CACX,OAAsC,EACtC,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,8BAAY,EAC7B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,WAAW,CACf,OAAuC,EACvC,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,sCAAgB,EACjC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF;AAnID,sBAmIC"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { MoovCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import * as components from "../models/components/index.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { MoovError } from "../models/errors/mooverror.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
26
|
+
import * as operations from "../models/operations/index.js";
|
|
27
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
28
|
+
import { Result } from "../types/fp.js";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Look up metadata for a card without linking it to a Moov account.
|
|
32
|
+
*
|
|
33
|
+
* Only use this endpoint if you have provided Moov with a copy of your PCI attestation of compliance.
|
|
34
|
+
*
|
|
35
|
+
* To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
|
36
|
+
* you'll need to specify the `/card-metadata.read` scope.
|
|
37
|
+
*/
|
|
38
|
+
export function cardsGetMetadata(
|
|
39
|
+
client: MoovCore,
|
|
40
|
+
request: components.CardMetadataRequest,
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): APIPromise<
|
|
43
|
+
Result<
|
|
44
|
+
operations.GetCardMetadataResponse,
|
|
45
|
+
| errors.GenericError
|
|
46
|
+
| errors.CardMetadataRequestError
|
|
47
|
+
| MoovError
|
|
48
|
+
| ResponseValidationError
|
|
49
|
+
| ConnectionError
|
|
50
|
+
| RequestAbortedError
|
|
51
|
+
| RequestTimeoutError
|
|
52
|
+
| InvalidRequestError
|
|
53
|
+
| UnexpectedClientError
|
|
54
|
+
| SDKValidationError
|
|
55
|
+
>
|
|
56
|
+
> {
|
|
57
|
+
return new APIPromise($do(
|
|
58
|
+
client,
|
|
59
|
+
request,
|
|
60
|
+
options,
|
|
61
|
+
));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function $do(
|
|
65
|
+
client: MoovCore,
|
|
66
|
+
request: components.CardMetadataRequest,
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): Promise<
|
|
69
|
+
[
|
|
70
|
+
Result<
|
|
71
|
+
operations.GetCardMetadataResponse,
|
|
72
|
+
| errors.GenericError
|
|
73
|
+
| errors.CardMetadataRequestError
|
|
74
|
+
| MoovError
|
|
75
|
+
| ResponseValidationError
|
|
76
|
+
| ConnectionError
|
|
77
|
+
| RequestAbortedError
|
|
78
|
+
| RequestTimeoutError
|
|
79
|
+
| InvalidRequestError
|
|
80
|
+
| UnexpectedClientError
|
|
81
|
+
| SDKValidationError
|
|
82
|
+
>,
|
|
83
|
+
APICall,
|
|
84
|
+
]
|
|
85
|
+
> {
|
|
86
|
+
const parsed = safeParse(
|
|
87
|
+
request,
|
|
88
|
+
(value) => components.CardMetadataRequest$outboundSchema.parse(value),
|
|
89
|
+
"Input validation failed",
|
|
90
|
+
);
|
|
91
|
+
if (!parsed.ok) {
|
|
92
|
+
return [parsed, { status: "invalid" }];
|
|
93
|
+
}
|
|
94
|
+
const payload = parsed.value;
|
|
95
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
96
|
+
|
|
97
|
+
const path = pathToFunc("/card-metadata")();
|
|
98
|
+
|
|
99
|
+
const headers = new Headers(compactMap({
|
|
100
|
+
"Content-Type": "application/json",
|
|
101
|
+
Accept: "application/json",
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
105
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
106
|
+
|
|
107
|
+
const context = {
|
|
108
|
+
options: client._options,
|
|
109
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
110
|
+
operationID: "getCardMetadata",
|
|
111
|
+
oAuth2Scopes: null,
|
|
112
|
+
|
|
113
|
+
resolvedSecurity: requestSecurity,
|
|
114
|
+
|
|
115
|
+
securitySource: client._options.security,
|
|
116
|
+
retryConfig: options?.retries
|
|
117
|
+
|| client._options.retryConfig
|
|
118
|
+
|| { strategy: "none" },
|
|
119
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const requestRes = client._createRequest(context, {
|
|
123
|
+
security: requestSecurity,
|
|
124
|
+
method: "POST",
|
|
125
|
+
baseURL: options?.serverURL,
|
|
126
|
+
path: path,
|
|
127
|
+
headers: headers,
|
|
128
|
+
body: body,
|
|
129
|
+
userAgent: client._options.userAgent,
|
|
130
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
131
|
+
}, options);
|
|
132
|
+
if (!requestRes.ok) {
|
|
133
|
+
return [requestRes, { status: "invalid" }];
|
|
134
|
+
}
|
|
135
|
+
const req = requestRes.value;
|
|
136
|
+
|
|
137
|
+
const doResult = await client._do(req, {
|
|
138
|
+
context,
|
|
139
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
140
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
141
|
+
retryConfig: context.retryConfig,
|
|
142
|
+
retryCodes: context.retryCodes,
|
|
143
|
+
});
|
|
144
|
+
if (!doResult.ok) {
|
|
145
|
+
return [doResult, { status: "request-error", request: req }];
|
|
146
|
+
}
|
|
147
|
+
const response = doResult.value;
|
|
148
|
+
|
|
149
|
+
const responseFields = {
|
|
150
|
+
HttpMeta: { Response: response, Request: req },
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const [result] = await M.match<
|
|
154
|
+
operations.GetCardMetadataResponse,
|
|
155
|
+
| errors.GenericError
|
|
156
|
+
| errors.CardMetadataRequestError
|
|
157
|
+
| MoovError
|
|
158
|
+
| ResponseValidationError
|
|
159
|
+
| ConnectionError
|
|
160
|
+
| RequestAbortedError
|
|
161
|
+
| RequestTimeoutError
|
|
162
|
+
| InvalidRequestError
|
|
163
|
+
| UnexpectedClientError
|
|
164
|
+
| SDKValidationError
|
|
165
|
+
>(
|
|
166
|
+
M.json(200, operations.GetCardMetadataResponse$inboundSchema, {
|
|
167
|
+
hdrs: true,
|
|
168
|
+
key: "Result",
|
|
169
|
+
}),
|
|
170
|
+
M.jsonErr([400, 409], errors.GenericError$inboundSchema, { hdrs: true }),
|
|
171
|
+
M.jsonErr(422, errors.CardMetadataRequestError$inboundSchema, {
|
|
172
|
+
hdrs: true,
|
|
173
|
+
}),
|
|
174
|
+
M.fail([401, 403, 404, 429]),
|
|
175
|
+
M.fail([500, 504]),
|
|
176
|
+
M.fail("4XX"),
|
|
177
|
+
M.fail("5XX"),
|
|
178
|
+
)(response, req, { extraFields: responseFields });
|
|
179
|
+
if (!result.ok) {
|
|
180
|
+
return [result, { status: "complete", request: req, response }];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return [result, { status: "complete", request: req, response }];
|
|
184
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { SDKOptions } from "../lib/config.js";
|
|
2
|
+
import {
|
|
3
|
+
BeforeRequestContext,
|
|
4
|
+
BeforeRequestHook,
|
|
5
|
+
SDKInitHook,
|
|
6
|
+
} from "./types.js";
|
|
7
|
+
|
|
8
|
+
const gt: unknown = typeof globalThis === "undefined" ? null : globalThis;
|
|
9
|
+
const webWorkerLike = typeof gt === "object"
|
|
10
|
+
&& gt != null
|
|
11
|
+
&& "importScripts" in gt
|
|
12
|
+
&& typeof gt["importScripts"] === "function";
|
|
13
|
+
const isBrowserLike = webWorkerLike
|
|
14
|
+
|| (typeof navigator !== "undefined" && "serviceWorker" in navigator)
|
|
15
|
+
|| (typeof window === "object" && typeof window.document !== "undefined");
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Applies bearer-token authentication and validates auth-related SDK
|
|
19
|
+
* options at construction time.
|
|
20
|
+
*
|
|
21
|
+
* `accessToken` is exposed as a top-level SDK option via the
|
|
22
|
+
* `x-speakeasy-globals` overlay in `.speakeasy/overlays/access-token.yaml`.
|
|
23
|
+
* Speakeasy doesn't auto-send it (no operation declares a matching
|
|
24
|
+
* parameter), so this hook is responsible for translating it into the
|
|
25
|
+
* `Authorization: Bearer …` header.
|
|
26
|
+
*
|
|
27
|
+
* HTTP Basic credentials (`security.username` / `security.password`) are
|
|
28
|
+
* still handled automatically by Speakeasy's generated security pipeline.
|
|
29
|
+
*
|
|
30
|
+
* Validation rules enforced at SDK init:
|
|
31
|
+
* - `accessToken` and `security.username`/`password` cannot both be set.
|
|
32
|
+
* - HTTP Basic credentials are rejected in browser-like environments.
|
|
33
|
+
* Browsers must use `accessToken` instead.
|
|
34
|
+
*/
|
|
35
|
+
export class AccessTokenHook implements SDKInitHook, BeforeRequestHook {
|
|
36
|
+
sdkInit(opts: SDKOptions): SDKOptions {
|
|
37
|
+
const token = (opts as SDKOptions & { accessToken: string }).accessToken;
|
|
38
|
+
const hasToken = typeof token === "string" && token.length > 0;
|
|
39
|
+
|
|
40
|
+
if (hasToken && opts.security != null) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
"Moov SDK: `accessToken` and `security.username`/`password` cannot "
|
|
43
|
+
+ "both be set. Use `accessToken` for OAuth2 bearer auth "
|
|
44
|
+
+ "(typically client-side) or `security.username`/`password` for "
|
|
45
|
+
+ "HTTP Basic auth with API keys (server-side).",
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (isBrowserLike && opts.security != null) {
|
|
50
|
+
throw new Error(
|
|
51
|
+
"Moov SDK: HTTP Basic credentials were provided in a browser-like "
|
|
52
|
+
+ "environment. API keys must never be embedded in client-side "
|
|
53
|
+
+ "code. Mint a short-lived OAuth2 access token on your server "
|
|
54
|
+
+ "and pass it via the `accessToken` option instead.",
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return opts;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
beforeRequest(ctx: BeforeRequestContext, request: Request): Request {
|
|
62
|
+
const token = (ctx.options as SDKOptions & { accessToken: string }).accessToken;
|
|
63
|
+
|
|
64
|
+
// Bail early if there's no token or the request already has an Authorization header.
|
|
65
|
+
if (!token || request.headers.has("Authorization")) {
|
|
66
|
+
return request;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const next = new Request(request);
|
|
70
|
+
next.headers.set("Authorization", `Bearer ${token}`);
|
|
71
|
+
return next;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AccessTokenHook } from "./access-token-hook.js";
|
|
1
2
|
import { MoovVersionHook } from "./moov-version-hook.js";
|
|
2
3
|
import { Hooks } from "./types.js";
|
|
3
4
|
|
|
@@ -14,4 +15,8 @@ export function initHooks(hooks: Hooks) {
|
|
|
14
15
|
|
|
15
16
|
const versionHook = new MoovVersionHook();
|
|
16
17
|
hooks.registerBeforeRequestHook(versionHook);
|
|
18
|
+
|
|
19
|
+
const accessTokenHook = new AccessTokenHook();
|
|
20
|
+
hooks.registerSDKInitHook(accessTokenHook);
|
|
21
|
+
hooks.registerBeforeRequestHook(accessTokenHook);
|
|
17
22
|
}
|
package/src/lib/config.ts
CHANGED
|
@@ -27,6 +27,11 @@ export type SDKOptions = {
|
|
|
27
27
|
| (() => Promise<components.Security>)
|
|
28
28
|
| undefined;
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Allows setting the accessToken parameter for all supported operations
|
|
32
|
+
*/
|
|
33
|
+
accessToken?: string | undefined;
|
|
34
|
+
|
|
30
35
|
httpClient?: HTTPClient;
|
|
31
36
|
/**
|
|
32
37
|
* Allows overriding the default server used by the SDK
|
|
@@ -68,7 +73,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
68
73
|
export const SDK_METADATA = {
|
|
69
74
|
language: "typescript",
|
|
70
75
|
openapiDocVersion: "dev",
|
|
71
|
-
sdkVersion: "0.0.0-dev.
|
|
72
|
-
genVersion: "2.
|
|
73
|
-
userAgent: "speakeasy-sdk/typescript 0.0.0-dev.
|
|
76
|
+
sdkVersion: "0.0.0-dev.19",
|
|
77
|
+
genVersion: "2.882.0",
|
|
78
|
+
userAgent: "speakeasy-sdk/typescript 0.0.0-dev.19 2.882.0 dev @moovio/sdk",
|
|
74
79
|
} as const;
|
|
@@ -51,6 +51,15 @@ export const startCommand = buildCommand({
|
|
|
51
51
|
return z.string().parse(value);
|
|
52
52
|
},
|
|
53
53
|
},
|
|
54
|
+
"access-token": {
|
|
55
|
+
kind: "parsed",
|
|
56
|
+
brief:
|
|
57
|
+
"Allows setting the accessToken parameter for all supported operations",
|
|
58
|
+
optional: true,
|
|
59
|
+
parse: (value) => {
|
|
60
|
+
return z.string().parse(value);
|
|
61
|
+
},
|
|
62
|
+
},
|
|
54
63
|
"server-url": {
|
|
55
64
|
kind: "parsed",
|
|
56
65
|
brief: "Overrides the default server URL used by the SDK",
|
|
@@ -20,6 +20,7 @@ interface StartCommandFlags {
|
|
|
20
20
|
readonly tool?: string[];
|
|
21
21
|
readonly username?: string | undefined;
|
|
22
22
|
readonly password?: string | undefined;
|
|
23
|
+
readonly "access-token"?: SDKOptions["accessToken"] | undefined;
|
|
23
24
|
readonly "server-url"?: string;
|
|
24
25
|
readonly "server-index"?: SDKOptions["serverIdx"];
|
|
25
26
|
readonly "log-level": ConsoleLoggerLevel;
|
|
@@ -53,6 +54,7 @@ async function startStdio(flags: StartCommandFlags) {
|
|
|
53
54
|
username: flags.username ?? "",
|
|
54
55
|
password: flags.password ?? "",
|
|
55
56
|
}),
|
|
57
|
+
accessToken: flags["access-token"],
|
|
56
58
|
serverURL: flags["server-url"],
|
|
57
59
|
serverIdx: flags["server-index"],
|
|
58
60
|
});
|
|
@@ -76,6 +78,7 @@ async function startSSE(flags: StartCommandFlags) {
|
|
|
76
78
|
username: flags.username ?? "",
|
|
77
79
|
password: flags.password ?? "",
|
|
78
80
|
}),
|
|
81
|
+
accessToken: flags["access-token"],
|
|
79
82
|
serverURL: flags["server-url"],
|
|
80
83
|
serverIdx: flags["server-index"],
|
|
81
84
|
});
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -61,6 +61,7 @@ import { tool$cardIssuingRequest } from "./tools/cardIssuingRequest.js";
|
|
|
61
61
|
import { tool$cardIssuingUpdate } from "./tools/cardIssuingUpdate.js";
|
|
62
62
|
import { tool$cardsDisable } from "./tools/cardsDisable.js";
|
|
63
63
|
import { tool$cardsGet } from "./tools/cardsGet.js";
|
|
64
|
+
import { tool$cardsGetMetadata } from "./tools/cardsGetMetadata.js";
|
|
64
65
|
import { tool$cardsLink } from "./tools/cardsLink.js";
|
|
65
66
|
import { tool$cardsList } from "./tools/cardsList.js";
|
|
66
67
|
import { tool$cardsUpdate } from "./tools/cardsUpdate.js";
|
|
@@ -207,15 +208,17 @@ export function createMCPServer(deps: {
|
|
|
207
208
|
scopes?: MCPScope[] | undefined;
|
|
208
209
|
serverURL?: string | undefined;
|
|
209
210
|
security?: SDKOptions["security"] | undefined;
|
|
211
|
+
accessToken?: SDKOptions["accessToken"] | undefined;
|
|
210
212
|
serverIdx?: SDKOptions["serverIdx"] | undefined;
|
|
211
213
|
}) {
|
|
212
214
|
const server = new McpServer({
|
|
213
215
|
name: "Moov",
|
|
214
|
-
version: "0.0.0-dev.
|
|
216
|
+
version: "0.0.0-dev.19",
|
|
215
217
|
});
|
|
216
218
|
|
|
217
219
|
const client = new MoovCore({
|
|
218
220
|
security: deps.security,
|
|
221
|
+
accessToken: deps.accessToken,
|
|
219
222
|
serverURL: deps.serverURL,
|
|
220
223
|
serverIdx: deps.serverIdx,
|
|
221
224
|
});
|
|
@@ -280,6 +283,7 @@ export function createMCPServer(deps: {
|
|
|
280
283
|
tool(tool$cardsGet);
|
|
281
284
|
tool(tool$cardsUpdate);
|
|
282
285
|
tool(tool$cardsDisable);
|
|
286
|
+
tool(tool$cardsGetMetadata);
|
|
283
287
|
tool(tool$disputesList);
|
|
284
288
|
tool(tool$disputesGet);
|
|
285
289
|
tool(tool$disputesAccept);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { cardsGetMetadata } from "../../funcs/cardsGetMetadata.js";
|
|
6
|
+
import * as components from "../../models/components/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: components.CardMetadataRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$cardsGetMetadata: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "cards-get-metadata",
|
|
15
|
+
description:
|
|
16
|
+
`Look up metadata for a card without linking it to a Moov account.
|
|
17
|
+
|
|
18
|
+
Only use this endpoint if you have provided Moov with a copy of your PCI attestation of compliance.
|
|
19
|
+
|
|
20
|
+
To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
|
21
|
+
you'll need to specify the \`/card-metadata.read\` scope.`,
|
|
22
|
+
args,
|
|
23
|
+
tool: async (client, args, ctx) => {
|
|
24
|
+
const [result, apiCall] = await cardsGetMetadata(
|
|
25
|
+
client,
|
|
26
|
+
args.request,
|
|
27
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
28
|
+
).$inspect();
|
|
29
|
+
|
|
30
|
+
if (!result.ok) {
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: result.error.message }],
|
|
33
|
+
isError: true,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const value = result.value.result;
|
|
38
|
+
|
|
39
|
+
return formatResult(value, apiCall);
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import * as types from "../../types/primitives.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
CardBrand,
|
|
12
|
+
CardBrand$inboundSchema,
|
|
13
|
+
CardBrand$outboundSchema,
|
|
14
|
+
} from "./cardbrand.js";
|
|
15
|
+
import {
|
|
16
|
+
CardType,
|
|
17
|
+
CardType$inboundSchema,
|
|
18
|
+
CardType$outboundSchema,
|
|
19
|
+
} from "./cardtype.js";
|
|
20
|
+
import {
|
|
21
|
+
DomesticPullFromCard,
|
|
22
|
+
DomesticPullFromCard$inboundSchema,
|
|
23
|
+
DomesticPullFromCard$outboundSchema,
|
|
24
|
+
} from "./domesticpullfromcard.js";
|
|
25
|
+
import {
|
|
26
|
+
DomesticPushToCard,
|
|
27
|
+
DomesticPushToCard$inboundSchema,
|
|
28
|
+
DomesticPushToCard$outboundSchema,
|
|
29
|
+
} from "./domesticpushtocard.js";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Metadata describing a card.
|
|
33
|
+
*/
|
|
34
|
+
export type CardMetadata = {
|
|
35
|
+
/**
|
|
36
|
+
* The first six to eight digits of the card number, which identifies the financial institution that issued the card.
|
|
37
|
+
*/
|
|
38
|
+
bin: string;
|
|
39
|
+
/**
|
|
40
|
+
* The card brand.
|
|
41
|
+
*/
|
|
42
|
+
brand: CardBrand;
|
|
43
|
+
/**
|
|
44
|
+
* The category or level of the card defined by the issuer.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* Examples include, but not limited to, "REWARDS", "TRADITIONAL REWARDS", "CLASSIC", and "CORPORATE PURCHASING".
|
|
48
|
+
*/
|
|
49
|
+
cardCategory?: string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* The type of the card.
|
|
52
|
+
*/
|
|
53
|
+
cardType: CardType;
|
|
54
|
+
/**
|
|
55
|
+
* If true, the card is for commercial use, or associated with a business.
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* If false, the card is associated with a general consumer.
|
|
59
|
+
*/
|
|
60
|
+
commercial?: boolean | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* If true, the card issuing bank is regulated, and the scheme fees for debit transactions will be limited based on the Durbin Amendment.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* If false, the card issuing bank is not regulated, and the scheme fees will not be limited.
|
|
66
|
+
*/
|
|
67
|
+
regulated?: boolean | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Financial institution that issued the card.
|
|
70
|
+
*/
|
|
71
|
+
issuer?: string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Country where the card was issued.
|
|
74
|
+
*/
|
|
75
|
+
issuerCountry?: string | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Phone number of the issuer.
|
|
78
|
+
*/
|
|
79
|
+
issuerPhone?: string | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* URL of the issuer.
|
|
82
|
+
*/
|
|
83
|
+
issuerURL?: string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Indicates if the card supports domestic pull-from-card transfer.
|
|
86
|
+
*/
|
|
87
|
+
domesticPullFromCard?: DomesticPullFromCard | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Indicates which level of domestic push-to-card transfer is supported by the card, if any.
|
|
90
|
+
*/
|
|
91
|
+
domesticPushToCard?: DomesticPushToCard | undefined;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/** @internal */
|
|
95
|
+
export const CardMetadata$inboundSchema: z.ZodType<
|
|
96
|
+
CardMetadata,
|
|
97
|
+
z.ZodTypeDef,
|
|
98
|
+
unknown
|
|
99
|
+
> = z.object({
|
|
100
|
+
bin: types.string(),
|
|
101
|
+
brand: CardBrand$inboundSchema,
|
|
102
|
+
cardCategory: types.optional(types.string()),
|
|
103
|
+
cardType: CardType$inboundSchema,
|
|
104
|
+
commercial: types.optional(types.boolean()),
|
|
105
|
+
regulated: types.optional(types.boolean()),
|
|
106
|
+
issuer: types.optional(types.string()),
|
|
107
|
+
issuerCountry: types.optional(types.string()),
|
|
108
|
+
issuerPhone: types.optional(types.string()),
|
|
109
|
+
issuerURL: types.optional(types.string()),
|
|
110
|
+
domesticPullFromCard: types.optional(DomesticPullFromCard$inboundSchema),
|
|
111
|
+
domesticPushToCard: types.optional(DomesticPushToCard$inboundSchema),
|
|
112
|
+
});
|
|
113
|
+
/** @internal */
|
|
114
|
+
export type CardMetadata$Outbound = {
|
|
115
|
+
bin: string;
|
|
116
|
+
brand: string;
|
|
117
|
+
cardCategory?: string | undefined;
|
|
118
|
+
cardType: string;
|
|
119
|
+
commercial?: boolean | undefined;
|
|
120
|
+
regulated?: boolean | undefined;
|
|
121
|
+
issuer?: string | undefined;
|
|
122
|
+
issuerCountry?: string | undefined;
|
|
123
|
+
issuerPhone?: string | undefined;
|
|
124
|
+
issuerURL?: string | undefined;
|
|
125
|
+
domesticPullFromCard?: string | undefined;
|
|
126
|
+
domesticPushToCard?: string | undefined;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/** @internal */
|
|
130
|
+
export const CardMetadata$outboundSchema: z.ZodType<
|
|
131
|
+
CardMetadata$Outbound,
|
|
132
|
+
z.ZodTypeDef,
|
|
133
|
+
CardMetadata
|
|
134
|
+
> = z.object({
|
|
135
|
+
bin: z.string(),
|
|
136
|
+
brand: CardBrand$outboundSchema,
|
|
137
|
+
cardCategory: z.string().optional(),
|
|
138
|
+
cardType: CardType$outboundSchema,
|
|
139
|
+
commercial: z.boolean().optional(),
|
|
140
|
+
regulated: z.boolean().optional(),
|
|
141
|
+
issuer: z.string().optional(),
|
|
142
|
+
issuerCountry: z.string().optional(),
|
|
143
|
+
issuerPhone: z.string().optional(),
|
|
144
|
+
issuerURL: z.string().optional(),
|
|
145
|
+
domesticPullFromCard: DomesticPullFromCard$outboundSchema.optional(),
|
|
146
|
+
domesticPushToCard: DomesticPushToCard$outboundSchema.optional(),
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
export function cardMetadataToJSON(cardMetadata: CardMetadata): string {
|
|
150
|
+
return JSON.stringify(CardMetadata$outboundSchema.parse(cardMetadata));
|
|
151
|
+
}
|
|
152
|
+
export function cardMetadataFromJSON(
|
|
153
|
+
jsonString: string,
|
|
154
|
+
): SafeParseResult<CardMetadata, SDKValidationError> {
|
|
155
|
+
return safeParse(
|
|
156
|
+
jsonString,
|
|
157
|
+
(x) => CardMetadata$inboundSchema.parse(JSON.parse(x)),
|
|
158
|
+
`Failed to parse 'CardMetadata' from JSON`,
|
|
159
|
+
);
|
|
160
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import * as types from "../../types/primitives.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
E2EEToken,
|
|
12
|
+
E2EEToken$inboundSchema,
|
|
13
|
+
E2EEToken$Outbound,
|
|
14
|
+
E2EEToken$outboundSchema,
|
|
15
|
+
} from "./e2eetoken.js";
|
|
16
|
+
|
|
17
|
+
export type CardMetadataRequest = {
|
|
18
|
+
/**
|
|
19
|
+
* Wraps a compact-serialized JSON Web Encryption (JWE) token used for secure transmission of sensitive data (e.g., PCI information) through intermediaries.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* This token is encrypted using the public key from /end-to-end-keys and wraps an AES key. For details and examples, refer to our
|
|
23
|
+
* [GitHub repository](https://github.com/moovfinancial/moov-go/blob/main/examples/e2ee/e2ee_test.go).
|
|
24
|
+
*/
|
|
25
|
+
e2ee?: E2EEToken | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The full card number (PAN).
|
|
28
|
+
*/
|
|
29
|
+
cardNumber?: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export const CardMetadataRequest$inboundSchema: z.ZodType<
|
|
34
|
+
CardMetadataRequest,
|
|
35
|
+
z.ZodTypeDef,
|
|
36
|
+
unknown
|
|
37
|
+
> = z.object({
|
|
38
|
+
e2ee: types.optional(E2EEToken$inboundSchema),
|
|
39
|
+
cardNumber: types.optional(types.string()),
|
|
40
|
+
});
|
|
41
|
+
/** @internal */
|
|
42
|
+
export type CardMetadataRequest$Outbound = {
|
|
43
|
+
e2ee?: E2EEToken$Outbound | undefined;
|
|
44
|
+
cardNumber?: string | undefined;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** @internal */
|
|
48
|
+
export const CardMetadataRequest$outboundSchema: z.ZodType<
|
|
49
|
+
CardMetadataRequest$Outbound,
|
|
50
|
+
z.ZodTypeDef,
|
|
51
|
+
CardMetadataRequest
|
|
52
|
+
> = z.object({
|
|
53
|
+
e2ee: E2EEToken$outboundSchema.optional(),
|
|
54
|
+
cardNumber: z.string().optional(),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export function cardMetadataRequestToJSON(
|
|
58
|
+
cardMetadataRequest: CardMetadataRequest,
|
|
59
|
+
): string {
|
|
60
|
+
return JSON.stringify(
|
|
61
|
+
CardMetadataRequest$outboundSchema.parse(cardMetadataRequest),
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
export function cardMetadataRequestFromJSON(
|
|
65
|
+
jsonString: string,
|
|
66
|
+
): SafeParseResult<CardMetadataRequest, SDKValidationError> {
|
|
67
|
+
return safeParse(
|
|
68
|
+
jsonString,
|
|
69
|
+
(x) => CardMetadataRequest$inboundSchema.parse(JSON.parse(x)),
|
|
70
|
+
`Failed to parse 'CardMetadataRequest' from JSON`,
|
|
71
|
+
);
|
|
72
|
+
}
|