agentmail 0.3.6 → 0.3.8

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.6",
47
- "User-Agent": "agentmail/0.3.6",
46
+ "X-Fern-SDK-Version": "0.3.8",
47
+ "User-Agent": "agentmail/0.3.8",
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.6";
1
+ export declare const SDK_VERSION = "0.3.8";
@@ -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.6";
4
+ exports.SDK_VERSION = "0.3.8";
@@ -4,5 +4,7 @@ export type GetPaymentCredentials = (wsUrl: string) => Promise<Record<string, st
4
4
  export declare class WebsocketsClient extends FernWebsocketsClient {
5
5
  private readonly _getPaymentCredentials;
6
6
  constructor(options: FernWebsocketsClient.Options, getPaymentCredentials?: GetPaymentCredentials);
7
- connect(args?: FernWebsocketsClient.ConnectArgs): Promise<WebsocketsSocket>;
7
+ connect(args?: FernWebsocketsClient.ConnectArgs & {
8
+ waitForOpen?: boolean;
9
+ }): Promise<WebsocketsSocket>;
8
10
  }
@@ -41,6 +41,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
41
  step((generator = generator.apply(thisArg, _arguments || [])).next());
42
42
  });
43
43
  };
44
+ var __rest = (this && this.__rest) || function (s, e) {
45
+ var t = {};
46
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
47
+ t[p] = s[p];
48
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
49
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
50
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
51
+ t[p[i]] = s[p[i]];
52
+ }
53
+ return t;
54
+ };
44
55
  Object.defineProperty(exports, "__esModule", { value: true });
45
56
  exports.WebsocketsClient = void 0;
46
57
  const Client_js_1 = require("../api/resources/websockets/client/Client.js");
@@ -57,19 +68,20 @@ class WebsocketsClient extends Client_js_1.WebsocketsClient {
57
68
  });
58
69
  return __awaiter(this, arguments, void 0, function* (args = {}) {
59
70
  var _a, _b, _c;
60
- let connectArgs = args;
71
+ const { waitForOpen = true } = args, rest = __rest(args, ["waitForOpen"]);
72
+ let connectArgs = rest;
61
73
  if (this._getPaymentCredentials) {
62
- 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)
63
- .websockets, "/v0");
74
+ 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).websockets, "/v0");
64
75
  const credentials = yield this._getPaymentCredentials(wsUrl);
65
- connectArgs = Object.assign(Object.assign({}, args), { queryParams: Object.assign(Object.assign({}, credentials), args.queryParams) });
76
+ connectArgs = Object.assign(Object.assign({}, rest), { queryParams: Object.assign(Object.assign({}, credentials), rest.queryParams) });
66
77
  }
67
- else if (!args.apiKey) {
78
+ else if (!rest.apiKey) {
68
79
  const apiKey = (_c = (yield core.Supplier.get(this._options.apiKey))) !== null && _c !== void 0 ? _c : process.env.AGENTMAIL_API_KEY;
69
- connectArgs = Object.assign(Object.assign({}, args), { apiKey });
80
+ connectArgs = Object.assign(Object.assign({}, rest), { apiKey });
70
81
  }
71
82
  const socket = yield _super.connect.call(this, connectArgs);
72
- yield socket.waitForOpen();
83
+ if (waitForOpen)
84
+ yield socket.waitForOpen();
73
85
  return socket;
74
86
  });
75
87
  }
@@ -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.6",
10
- "User-Agent": "agentmail/0.3.6",
9
+ "X-Fern-SDK-Version": "0.3.8",
10
+ "User-Agent": "agentmail/0.3.8",
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.6";
1
+ export declare const SDK_VERSION = "0.3.8";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.3.6";
1
+ export const SDK_VERSION = "0.3.8";
@@ -4,5 +4,7 @@ export type GetPaymentCredentials = (wsUrl: string) => Promise<Record<string, st
4
4
  export declare class WebsocketsClient extends FernWebsocketsClient {
5
5
  private readonly _getPaymentCredentials;
6
6
  constructor(options: FernWebsocketsClient.Options, getPaymentCredentials?: GetPaymentCredentials);
7
- connect(args?: FernWebsocketsClient.ConnectArgs): Promise<WebsocketsSocket>;
7
+ connect(args?: FernWebsocketsClient.ConnectArgs & {
8
+ waitForOpen?: boolean;
9
+ }): Promise<WebsocketsSocket>;
8
10
  }
@@ -7,6 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
10
21
  import { WebsocketsClient as FernWebsocketsClient } from "../api/resources/websockets/client/Client.mjs";
11
22
  import * as core from "../core/index.mjs";
12
23
  import * as environments from "../environments.mjs";
@@ -21,19 +32,20 @@ export class WebsocketsClient extends FernWebsocketsClient {
21
32
  });
22
33
  return __awaiter(this, arguments, void 0, function* (args = {}) {
23
34
  var _a, _b, _c;
24
- let connectArgs = args;
35
+ const { waitForOpen = true } = args, rest = __rest(args, ["waitForOpen"]);
36
+ let connectArgs = rest;
25
37
  if (this._getPaymentCredentials) {
26
- 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)
27
- .websockets, "/v0");
38
+ 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).websockets, "/v0");
28
39
  const credentials = yield this._getPaymentCredentials(wsUrl);
29
- connectArgs = Object.assign(Object.assign({}, args), { queryParams: Object.assign(Object.assign({}, credentials), args.queryParams) });
40
+ connectArgs = Object.assign(Object.assign({}, rest), { queryParams: Object.assign(Object.assign({}, credentials), rest.queryParams) });
30
41
  }
31
- else if (!args.apiKey) {
42
+ else if (!rest.apiKey) {
32
43
  const apiKey = (_c = (yield core.Supplier.get(this._options.apiKey))) !== null && _c !== void 0 ? _c : process.env.AGENTMAIL_API_KEY;
33
- connectArgs = Object.assign(Object.assign({}, args), { apiKey });
44
+ connectArgs = Object.assign(Object.assign({}, rest), { apiKey });
34
45
  }
35
46
  const socket = yield _super.connect.call(this, connectArgs);
36
- yield socket.waitForOpen();
47
+ if (waitForOpen)
48
+ yield socket.waitForOpen();
37
49
  return socket;
38
50
  });
39
51
  }