agentmail 0.3.1 → 0.3.2

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.
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "agentmail",
46
- "X-Fern-SDK-Version": "0.3.1",
47
- "User-Agent": "agentmail/0.3.1",
46
+ "X-Fern-SDK-Version": "0.3.2",
47
+ "User-Agent": "agentmail/0.3.2",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.3.1";
1
+ export declare const SDK_VERSION = "0.3.2";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.3.1";
4
+ exports.SDK_VERSION = "0.3.2";
@@ -22,7 +22,7 @@ export declare namespace AgentMailClient {
22
22
  }
23
23
  export declare class AgentMailClient extends FernAgentMailClient {
24
24
  protected _websockets: WebsocketsClient | undefined;
25
- private readonly _getPaymentHeaders;
25
+ private readonly _getPaymentCredentials;
26
26
  get websockets(): WebsocketsClient;
27
27
  constructor(options?: AgentMailClient.Options);
28
28
  }
@@ -64,7 +64,7 @@ const mpp_js_1 = require("./mpp.js");
64
64
  class AgentMailClient extends Client_js_1.AgentMailClient {
65
65
  get websockets() {
66
66
  var _a;
67
- return ((_a = this._websockets) !== null && _a !== void 0 ? _a : (this._websockets = new WebsocketsClient_js_1.WebsocketsClient(this._options, this._getPaymentHeaders)));
67
+ return ((_a = this._websockets) !== null && _a !== void 0 ? _a : (this._websockets = new WebsocketsClient_js_1.WebsocketsClient(this._options, this._getPaymentCredentials)));
68
68
  }
69
69
  constructor(options = {}) {
70
70
  if (options.x402) {
@@ -81,7 +81,7 @@ class AgentMailClient extends Client_js_1.AgentMailClient {
81
81
  fernOptions.environment = environments_js_1.AgentMailEnvironment.ProdX402;
82
82
  }
83
83
  super(fernOptions);
84
- this._getPaymentHeaders = (wsUrl) => (0, x402_js_1.getPaymentHeaders)(wsUrl, x402);
84
+ this._getPaymentCredentials = (wsUrl) => (0, x402_js_1.getPaymentCredentials)(wsUrl, x402);
85
85
  }
86
86
  else if (options.mpp) {
87
87
  const { mpp } = options, rest = __rest(options, ["mpp"]);
@@ -90,7 +90,7 @@ class AgentMailClient extends Client_js_1.AgentMailClient {
90
90
  fernOptions.environment = environments_js_1.AgentMailEnvironment.ProdMpp;
91
91
  }
92
92
  super(fernOptions);
93
- this._getPaymentHeaders = (wsUrl) => (0, mpp_js_1.getPaymentHeaders)(wsUrl, mpp);
93
+ this._getPaymentCredentials = (wsUrl) => (0, mpp_js_1.getPaymentCredentials)(wsUrl, mpp);
94
94
  }
95
95
  else {
96
96
  let fernOptions = options;
@@ -104,7 +104,7 @@ class AgentMailClient extends Client_js_1.AgentMailClient {
104
104
  }) });
105
105
  }
106
106
  super(fernOptions);
107
- this._getPaymentHeaders = undefined;
107
+ this._getPaymentCredentials = undefined;
108
108
  }
109
109
  }
110
110
  }
@@ -1,8 +1,8 @@
1
1
  import { WebsocketsClient as FernWebsocketsClient } from "../api/resources/websockets/client/Client.js";
2
2
  import type { WebsocketsSocket } from "../api/resources/websockets/client/Socket.js";
3
- export type GetPaymentHeaders = (wsUrl: string) => Promise<Record<string, string>>;
3
+ export type GetPaymentCredentials = (wsUrl: string) => Promise<Record<string, string>>;
4
4
  export declare class WebsocketsClient extends FernWebsocketsClient {
5
- private readonly _getPaymentHeaders;
6
- constructor(options: FernWebsocketsClient.Options, getPaymentHeaders?: GetPaymentHeaders);
5
+ private readonly _getPaymentCredentials;
6
+ constructor(options: FernWebsocketsClient.Options, getPaymentCredentials?: GetPaymentCredentials);
7
7
  connect(args?: FernWebsocketsClient.ConnectArgs): Promise<WebsocketsSocket>;
8
8
  }
@@ -47,9 +47,9 @@ const Client_js_1 = require("../api/resources/websockets/client/Client.js");
47
47
  const core = __importStar(require("../core/index.js"));
48
48
  const environments = __importStar(require("../environments.js"));
49
49
  class WebsocketsClient extends Client_js_1.WebsocketsClient {
50
- constructor(options, getPaymentHeaders) {
50
+ constructor(options, getPaymentCredentials) {
51
51
  super(options);
52
- this._getPaymentHeaders = getPaymentHeaders;
52
+ this._getPaymentCredentials = getPaymentCredentials;
53
53
  }
54
54
  connect() {
55
55
  const _super = Object.create(null, {
@@ -57,11 +57,11 @@ class WebsocketsClient extends Client_js_1.WebsocketsClient {
57
57
  });
58
58
  return __awaiter(this, arguments, void 0, function* (args = {}) {
59
59
  var _a, _b, _c;
60
- if (this._getPaymentHeaders) {
60
+ if (this._getPaymentCredentials) {
61
61
  const wsUrl = core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Prod)
62
62
  .websockets, "/v0");
63
- const paymentHeaders = yield this._getPaymentHeaders(wsUrl);
64
- return _super.connect.call(this, Object.assign(Object.assign({}, args), { headers: Object.assign(Object.assign({}, paymentHeaders), args.headers) }));
63
+ const credentials = yield this._getPaymentCredentials(wsUrl);
64
+ return _super.connect.call(this, Object.assign(Object.assign({}, args), { queryParams: Object.assign(Object.assign({}, credentials), args.queryParams) }));
65
65
  }
66
66
  if (!args.apiKey) {
67
67
  const apiKey = (_c = (yield core.Supplier.get(this._options.apiKey))) !== null && _c !== void 0 ? _c : process.env.AGENTMAIL_API_KEY;
@@ -1,2 +1,2 @@
1
1
  import type { Mppx } from "mppx/client";
2
- export declare function getPaymentHeaders(wsUrl: string, mpp: Mppx.Mppx): Promise<Record<string, string>>;
2
+ export declare function getPaymentCredentials(wsUrl: string, mpp: Mppx.Mppx): Promise<Record<string, string>>;
@@ -9,9 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getPaymentHeaders = getPaymentHeaders;
12
+ exports.getPaymentCredentials = getPaymentCredentials;
13
13
  const probe402_js_1 = require("./probe402.js");
14
- function getPaymentHeaders(wsUrl, mpp) {
14
+ function getPaymentCredentials(wsUrl, mpp) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
16
  const response = yield (0, probe402_js_1.probe402)(wsUrl);
17
17
  const credential = yield mpp.createCredential(response);
@@ -1,2 +1,2 @@
1
1
  import type { x402Client } from "@x402/fetch";
2
- export declare function getPaymentHeaders(wsUrl: string, client: x402Client): Promise<Record<string, string>>;
2
+ export declare function getPaymentCredentials(wsUrl: string, client: x402Client): Promise<Record<string, string>>;
@@ -42,9 +42,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
42
42
  });
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.getPaymentHeaders = getPaymentHeaders;
45
+ exports.getPaymentCredentials = getPaymentCredentials;
46
46
  const probe402_js_1 = require("./probe402.js");
47
- function getPaymentHeaders(wsUrl, client) {
47
+ function getPaymentCredentials(wsUrl, client) {
48
48
  return __awaiter(this, void 0, void 0, function* () {
49
49
  const { x402HTTPClient } = yield Promise.resolve().then(() => __importStar(require("@x402/fetch")));
50
50
  const httpClient = new x402HTTPClient(client);
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "agentmail",
9
- "X-Fern-SDK-Version": "0.3.1",
10
- "User-Agent": "agentmail/0.3.1",
9
+ "X-Fern-SDK-Version": "0.3.2",
10
+ "User-Agent": "agentmail/0.3.2",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.3.1";
1
+ export declare const SDK_VERSION = "0.3.2";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.3.1";
1
+ export const SDK_VERSION = "0.3.2";
@@ -22,7 +22,7 @@ export declare namespace AgentMailClient {
22
22
  }
23
23
  export declare class AgentMailClient extends FernAgentMailClient {
24
24
  protected _websockets: WebsocketsClient | undefined;
25
- private readonly _getPaymentHeaders;
25
+ private readonly _getPaymentCredentials;
26
26
  get websockets(): WebsocketsClient;
27
27
  constructor(options?: AgentMailClient.Options);
28
28
  }
@@ -23,12 +23,12 @@ import { NoOpAuthProvider } from "../core/auth/NoOpAuthProvider.mjs";
23
23
  import { AgentMailEnvironment } from "../environments.mjs";
24
24
  import { AgentMailClient as FernAgentMailClient } from "../Client.mjs";
25
25
  import { WebsocketsClient } from "./WebsocketsClient.mjs";
26
- import { getPaymentHeaders as getX402PaymentHeaders } from "./x402.mjs";
27
- import { getPaymentHeaders as getMppPaymentHeaders } from "./mpp.mjs";
26
+ import { getPaymentCredentials as getX402Credentials } from "./x402.mjs";
27
+ import { getPaymentCredentials as getMppCredentials } from "./mpp.mjs";
28
28
  export class AgentMailClient extends FernAgentMailClient {
29
29
  get websockets() {
30
30
  var _a;
31
- return ((_a = this._websockets) !== null && _a !== void 0 ? _a : (this._websockets = new WebsocketsClient(this._options, this._getPaymentHeaders)));
31
+ return ((_a = this._websockets) !== null && _a !== void 0 ? _a : (this._websockets = new WebsocketsClient(this._options, this._getPaymentCredentials)));
32
32
  }
33
33
  constructor(options = {}) {
34
34
  if (options.x402) {
@@ -45,7 +45,7 @@ export class AgentMailClient extends FernAgentMailClient {
45
45
  fernOptions.environment = AgentMailEnvironment.ProdX402;
46
46
  }
47
47
  super(fernOptions);
48
- this._getPaymentHeaders = (wsUrl) => getX402PaymentHeaders(wsUrl, x402);
48
+ this._getPaymentCredentials = (wsUrl) => getX402Credentials(wsUrl, x402);
49
49
  }
50
50
  else if (options.mpp) {
51
51
  const { mpp } = options, rest = __rest(options, ["mpp"]);
@@ -54,7 +54,7 @@ export class AgentMailClient extends FernAgentMailClient {
54
54
  fernOptions.environment = AgentMailEnvironment.ProdMpp;
55
55
  }
56
56
  super(fernOptions);
57
- this._getPaymentHeaders = (wsUrl) => getMppPaymentHeaders(wsUrl, mpp);
57
+ this._getPaymentCredentials = (wsUrl) => getMppCredentials(wsUrl, mpp);
58
58
  }
59
59
  else {
60
60
  let fernOptions = options;
@@ -68,7 +68,7 @@ export class AgentMailClient extends FernAgentMailClient {
68
68
  }) });
69
69
  }
70
70
  super(fernOptions);
71
- this._getPaymentHeaders = undefined;
71
+ this._getPaymentCredentials = undefined;
72
72
  }
73
73
  }
74
74
  }
@@ -1,8 +1,8 @@
1
1
  import { WebsocketsClient as FernWebsocketsClient } from "../api/resources/websockets/client/Client.mjs";
2
2
  import type { WebsocketsSocket } from "../api/resources/websockets/client/Socket.mjs";
3
- export type GetPaymentHeaders = (wsUrl: string) => Promise<Record<string, string>>;
3
+ export type GetPaymentCredentials = (wsUrl: string) => Promise<Record<string, string>>;
4
4
  export declare class WebsocketsClient extends FernWebsocketsClient {
5
- private readonly _getPaymentHeaders;
6
- constructor(options: FernWebsocketsClient.Options, getPaymentHeaders?: GetPaymentHeaders);
5
+ private readonly _getPaymentCredentials;
6
+ constructor(options: FernWebsocketsClient.Options, getPaymentCredentials?: GetPaymentCredentials);
7
7
  connect(args?: FernWebsocketsClient.ConnectArgs): Promise<WebsocketsSocket>;
8
8
  }
@@ -11,9 +11,9 @@ import { WebsocketsClient as FernWebsocketsClient } from "../api/resources/webso
11
11
  import * as core from "../core/index.mjs";
12
12
  import * as environments from "../environments.mjs";
13
13
  export class WebsocketsClient extends FernWebsocketsClient {
14
- constructor(options, getPaymentHeaders) {
14
+ constructor(options, getPaymentCredentials) {
15
15
  super(options);
16
- this._getPaymentHeaders = getPaymentHeaders;
16
+ this._getPaymentCredentials = getPaymentCredentials;
17
17
  }
18
18
  connect() {
19
19
  const _super = Object.create(null, {
@@ -21,11 +21,11 @@ export class WebsocketsClient extends FernWebsocketsClient {
21
21
  });
22
22
  return __awaiter(this, arguments, void 0, function* (args = {}) {
23
23
  var _a, _b, _c;
24
- if (this._getPaymentHeaders) {
24
+ if (this._getPaymentCredentials) {
25
25
  const wsUrl = core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Prod)
26
26
  .websockets, "/v0");
27
- const paymentHeaders = yield this._getPaymentHeaders(wsUrl);
28
- return _super.connect.call(this, Object.assign(Object.assign({}, args), { headers: Object.assign(Object.assign({}, paymentHeaders), args.headers) }));
27
+ const credentials = yield this._getPaymentCredentials(wsUrl);
28
+ return _super.connect.call(this, Object.assign(Object.assign({}, args), { queryParams: Object.assign(Object.assign({}, credentials), args.queryParams) }));
29
29
  }
30
30
  if (!args.apiKey) {
31
31
  const apiKey = (_c = (yield core.Supplier.get(this._options.apiKey))) !== null && _c !== void 0 ? _c : process.env.AGENTMAIL_API_KEY;
@@ -1,2 +1,2 @@
1
1
  import type { Mppx } from "mppx/client";
2
- export declare function getPaymentHeaders(wsUrl: string, mpp: Mppx.Mppx): Promise<Record<string, string>>;
2
+ export declare function getPaymentCredentials(wsUrl: string, mpp: Mppx.Mppx): Promise<Record<string, string>>;
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { probe402 } from "./probe402.mjs";
11
- export function getPaymentHeaders(wsUrl, mpp) {
11
+ export function getPaymentCredentials(wsUrl, mpp) {
12
12
  return __awaiter(this, void 0, void 0, function* () {
13
13
  const response = yield probe402(wsUrl);
14
14
  const credential = yield mpp.createCredential(response);
@@ -1,2 +1,2 @@
1
1
  import type { x402Client } from "@x402/fetch";
2
- export declare function getPaymentHeaders(wsUrl: string, client: x402Client): Promise<Record<string, string>>;
2
+ export declare function getPaymentCredentials(wsUrl: string, client: x402Client): Promise<Record<string, string>>;
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { probe402 } from "./probe402.mjs";
11
- export function getPaymentHeaders(wsUrl, client) {
11
+ export function getPaymentCredentials(wsUrl, client) {
12
12
  return __awaiter(this, void 0, void 0, function* () {
13
13
  const { x402HTTPClient } = yield import("@x402/fetch");
14
14
  const httpClient = new x402HTTPClient(client);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentmail",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",