@moovio/sdk 25.5.6 → 25.6.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.
Files changed (46) hide show
  1. package/README.md +30 -2
  2. package/bin/mcp-server.js +63 -15
  3. package/bin/mcp-server.js.map +12 -11
  4. package/hooks/access-token-hook.d.ts +25 -0
  5. package/hooks/access-token-hook.d.ts.map +1 -0
  6. package/hooks/access-token-hook.js +60 -0
  7. package/hooks/access-token-hook.js.map +1 -0
  8. package/hooks/registration.d.ts.map +1 -1
  9. package/hooks/registration.js +4 -0
  10. package/hooks/registration.js.map +1 -1
  11. package/jsr.json +1 -1
  12. package/lib/config.d.ts +7 -3
  13. package/lib/config.d.ts.map +1 -1
  14. package/lib/config.js +3 -3
  15. package/lib/config.js.map +1 -1
  16. package/mcp-server/cli/start/command.d.ts.map +1 -1
  17. package/mcp-server/cli/start/command.js +8 -0
  18. package/mcp-server/cli/start/command.js.map +1 -1
  19. package/mcp-server/cli/start/impl.d.ts +1 -0
  20. package/mcp-server/cli/start/impl.d.ts.map +1 -1
  21. package/mcp-server/cli/start/impl.js +2 -0
  22. package/mcp-server/cli/start/impl.js.map +1 -1
  23. package/mcp-server/mcp-server.js +1 -1
  24. package/mcp-server/server.d.ts +1 -0
  25. package/mcp-server/server.d.ts.map +1 -1
  26. package/mcp-server/server.js +2 -1
  27. package/mcp-server/server.js.map +1 -1
  28. package/models/components/webhookdata.d.ts +2 -2
  29. package/models/components/webhookdata.d.ts.map +1 -1
  30. package/models/components/webhookdata.js +2 -2
  31. package/models/components/webhookdata.js.map +1 -1
  32. package/models/components/webhookdatabankaccountdeleted.d.ts +3 -0
  33. package/models/components/webhookdatabankaccountdeleted.d.ts.map +1 -1
  34. package/models/components/webhookdatabankaccountdeleted.js +3 -0
  35. package/models/components/webhookdatabankaccountdeleted.js.map +1 -1
  36. package/package.json +1 -1
  37. package/src/hooks/access-token-hook.ts +73 -0
  38. package/src/hooks/registration.ts +5 -0
  39. package/src/lib/config.ts +8 -3
  40. package/src/mcp-server/cli/start/command.ts +9 -0
  41. package/src/mcp-server/cli/start/impl.ts +3 -0
  42. package/src/mcp-server/mcp-server.ts +1 -1
  43. package/src/mcp-server/server.ts +3 -1
  44. package/src/models/components/webhookdata.ts +4 -4
  45. package/src/models/components/webhookdatabankaccountdeleted.ts +9 -0
  46. package/test/tests/accessToken.test.ts +86 -0
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: "v2025.04.00",
71
- sdkVersion: "25.5.6",
72
- genVersion: "2.882.0",
73
- userAgent: "speakeasy-sdk/typescript 25.5.6 2.882.0 v2025.04.00 @moovio/sdk",
76
+ sdkVersion: "25.6.0",
77
+ genVersion: "2.884.4",
78
+ userAgent: "speakeasy-sdk/typescript 25.6.0 2.884.4 v2025.04.00 @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
  });
@@ -19,7 +19,7 @@ const routes = buildRouteMap({
19
19
  export const app = buildApplication(routes, {
20
20
  name: "mcp",
21
21
  versionInfo: {
22
- currentVersion: "25.5.6",
22
+ currentVersion: "25.6.0",
23
23
  },
24
24
  });
25
25
 
@@ -186,15 +186,17 @@ export function createMCPServer(deps: {
186
186
  scopes?: MCPScope[] | undefined;
187
187
  serverURL?: string | undefined;
188
188
  security?: SDKOptions["security"] | undefined;
189
+ accessToken?: SDKOptions["accessToken"] | undefined;
189
190
  serverIdx?: SDKOptions["serverIdx"] | undefined;
190
191
  }) {
191
192
  const server = new McpServer({
192
193
  name: "Moov",
193
- version: "25.5.6",
194
+ version: "25.6.0",
194
195
  });
195
196
 
196
197
  const client = new MoovCore({
197
198
  security: deps.security,
199
+ accessToken: deps.accessToken,
198
200
  serverURL: deps.serverURL,
199
201
  serverIdx: deps.serverIdx,
200
202
  });
@@ -240,6 +240,7 @@ export type WebhookData =
240
240
  | WebhookDataRefundUpdated
241
241
  | WebhookDataWalletTransactionUpdated
242
242
  | WebhookDataBankAccountCreated
243
+ | WebhookDataBankAccountDeleted
243
244
  | WebhookDataCancellationCreated
244
245
  | WebhookDataCancellationUpdated
245
246
  | WebhookDataCardAutoUpdated
@@ -253,7 +254,6 @@ export type WebhookData =
253
254
  | WebhookDataTransferCreated
254
255
  | WebhookDataWalletUpdated
255
256
  | WebhookDataBalanceUpdated
256
- | WebhookDataBankAccountDeleted
257
257
  | WebhookDataCapabilityRequested
258
258
  | WebhookDataInvoiceCreated
259
259
  | WebhookDataRepresentativeCreated
@@ -284,6 +284,7 @@ export const WebhookData$inboundSchema: z.ZodType<
284
284
  WebhookDataRefundUpdated$inboundSchema,
285
285
  WebhookDataWalletTransactionUpdated$inboundSchema,
286
286
  WebhookDataBankAccountCreated$inboundSchema,
287
+ WebhookDataBankAccountDeleted$inboundSchema,
287
288
  WebhookDataCancellationCreated$inboundSchema,
288
289
  WebhookDataCancellationUpdated$inboundSchema,
289
290
  WebhookDataCardAutoUpdated$inboundSchema,
@@ -297,7 +298,6 @@ export const WebhookData$inboundSchema: z.ZodType<
297
298
  WebhookDataTransferCreated$inboundSchema,
298
299
  WebhookDataWalletUpdated$inboundSchema,
299
300
  WebhookDataBalanceUpdated$inboundSchema,
300
- WebhookDataBankAccountDeleted$inboundSchema,
301
301
  WebhookDataCapabilityRequested$inboundSchema,
302
302
  WebhookDataInvoiceCreated$inboundSchema,
303
303
  WebhookDataRepresentativeCreated$inboundSchema,
@@ -324,6 +324,7 @@ export type WebhookData$Outbound =
324
324
  | WebhookDataRefundUpdated$Outbound
325
325
  | WebhookDataWalletTransactionUpdated$Outbound
326
326
  | WebhookDataBankAccountCreated$Outbound
327
+ | WebhookDataBankAccountDeleted$Outbound
327
328
  | WebhookDataCancellationCreated$Outbound
328
329
  | WebhookDataCancellationUpdated$Outbound
329
330
  | WebhookDataCardAutoUpdated$Outbound
@@ -337,7 +338,6 @@ export type WebhookData$Outbound =
337
338
  | WebhookDataTransferCreated$Outbound
338
339
  | WebhookDataWalletUpdated$Outbound
339
340
  | WebhookDataBalanceUpdated$Outbound
340
- | WebhookDataBankAccountDeleted$Outbound
341
341
  | WebhookDataCapabilityRequested$Outbound
342
342
  | WebhookDataInvoiceCreated$Outbound
343
343
  | WebhookDataRepresentativeCreated$Outbound
@@ -368,6 +368,7 @@ export const WebhookData$outboundSchema: z.ZodType<
368
368
  WebhookDataRefundUpdated$outboundSchema,
369
369
  WebhookDataWalletTransactionUpdated$outboundSchema,
370
370
  WebhookDataBankAccountCreated$outboundSchema,
371
+ WebhookDataBankAccountDeleted$outboundSchema,
371
372
  WebhookDataCancellationCreated$outboundSchema,
372
373
  WebhookDataCancellationUpdated$outboundSchema,
373
374
  WebhookDataCardAutoUpdated$outboundSchema,
@@ -381,7 +382,6 @@ export const WebhookData$outboundSchema: z.ZodType<
381
382
  WebhookDataTransferCreated$outboundSchema,
382
383
  WebhookDataWalletUpdated$outboundSchema,
383
384
  WebhookDataBalanceUpdated$outboundSchema,
384
- WebhookDataBankAccountDeleted$outboundSchema,
385
385
  WebhookDataCapabilityRequested$outboundSchema,
386
386
  WebhookDataInvoiceCreated$outboundSchema,
387
387
  WebhookDataRepresentativeCreated$outboundSchema,
@@ -6,10 +6,16 @@ import * as z from "zod/v3";
6
6
  import { safeParse } from "../../lib/schemas.js";
7
7
  import { Result as SafeParseResult } from "../../types/fp.js";
8
8
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
+ import {
10
+ BankAccountStatus,
11
+ BankAccountStatus$inboundSchema,
12
+ BankAccountStatus$outboundSchema,
13
+ } from "./bankaccountstatus.js";
9
14
 
10
15
  export type WebhookDataBankAccountDeleted = {
11
16
  bankAccountID: string;
12
17
  accountID: string;
18
+ status: BankAccountStatus;
13
19
  };
14
20
 
15
21
  /** @internal */
@@ -20,11 +26,13 @@ export const WebhookDataBankAccountDeleted$inboundSchema: z.ZodType<
20
26
  > = z.object({
21
27
  bankAccountID: z.string(),
22
28
  accountID: z.string(),
29
+ status: BankAccountStatus$inboundSchema,
23
30
  });
24
31
  /** @internal */
25
32
  export type WebhookDataBankAccountDeleted$Outbound = {
26
33
  bankAccountID: string;
27
34
  accountID: string;
35
+ status: string;
28
36
  };
29
37
 
30
38
  /** @internal */
@@ -35,6 +43,7 @@ export const WebhookDataBankAccountDeleted$outboundSchema: z.ZodType<
35
43
  > = z.object({
36
44
  bankAccountID: z.string(),
37
45
  accountID: z.string(),
46
+ status: BankAccountStatus$outboundSchema,
38
47
  });
39
48
 
40
49
  export function webhookDataBankAccountDeletedToJSON(
@@ -0,0 +1,86 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { HTTPClient, Moov } from "@moovio/sdk";
3
+
4
+ /**
5
+ * Builds a Moov SDK instance whose HTTPClient captures every outgoing
6
+ * Request without hitting the network. The captured Request can then be
7
+ * inspected for headers, URL, etc.
8
+ */
9
+ function captureRequests(opts: ConstructorParameters<typeof Moov>[0]) {
10
+ const requests: Request[] = [];
11
+ const httpClient = new HTTPClient({
12
+ fetcher: async (input, init) => {
13
+ const req = input instanceof Request ? input : new Request(input, init);
14
+ requests.push(req.clone());
15
+ return new Response(null, { status: 200 });
16
+ },
17
+ });
18
+
19
+ const moov = new Moov({ ...opts, httpClient });
20
+ return { moov, requests };
21
+ }
22
+
23
+ describe("accessToken option", () => {
24
+ test("sets Authorization: Bearer header on outgoing requests", async () => {
25
+ const { moov, requests } = captureRequests({
26
+ accessToken: "test-access-token-123",
27
+ });
28
+
29
+ await moov.ping.ping();
30
+
31
+ expect(requests.length).toBe(1);
32
+ expect(requests[0].headers.get("Authorization")).toBe(
33
+ "Bearer test-access-token-123",
34
+ );
35
+ });
36
+
37
+ test("applies bearer auth on every request, not just the first", async () => {
38
+ const { moov, requests } = captureRequests({
39
+ accessToken: "another-token",
40
+ });
41
+
42
+ await moov.ping.ping();
43
+ await moov.ping.ping();
44
+ await moov.ping.ping();
45
+
46
+ expect(requests.length).toBe(3);
47
+ for (const req of requests) {
48
+ expect(req.headers.get("Authorization")).toBe("Bearer another-token");
49
+ }
50
+ });
51
+
52
+ test("HTTP Basic auth still works when accessToken is not set", async () => {
53
+ const { moov, requests } = captureRequests({
54
+ security: { username: "my-public-key", password: "my-secret-key" },
55
+ });
56
+
57
+ await moov.ping.ping();
58
+
59
+ expect(requests.length).toBe(1);
60
+ const auth = requests[0].headers.get("Authorization");
61
+ expect(auth).toMatch(/^Basic /);
62
+
63
+ // Decode the base64 portion and confirm the credentials round-trip.
64
+ const encoded = auth!.slice("Basic ".length);
65
+ const decoded = Buffer.from(encoded, "base64").toString("utf8");
66
+ expect(decoded).toBe("my-public-key:my-secret-key");
67
+ });
68
+
69
+ test("no Authorization header is sent when neither auth mode is configured", async () => {
70
+ const { moov, requests } = captureRequests({});
71
+
72
+ await moov.ping.ping();
73
+
74
+ expect(requests.length).toBe(1);
75
+ expect(requests[0].headers.get("Authorization")).toBeNull();
76
+ });
77
+
78
+ test("throws at construction when both accessToken and Basic creds are set", () => {
79
+ expect(() =>
80
+ new Moov({
81
+ accessToken: "some-token",
82
+ security: { username: "u", password: "p" },
83
+ })
84
+ ).toThrow(/cannot both be set/i);
85
+ });
86
+ });