agentmail 0.3.5 → 0.3.7

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.5",
47
- "User-Agent": "agentmail/0.3.5",
46
+ "X-Fern-SDK-Version": "0.3.7",
47
+ "User-Agent": "agentmail/0.3.7",
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.5";
1
+ export declare const SDK_VERSION = "0.3.7";
@@ -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.5";
4
+ exports.SDK_VERSION = "0.3.7";
@@ -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,17 +68,21 @@ 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;
71
+ const { waitForOpen = true } = args, rest = __rest(args, ["waitForOpen"]);
72
+ let connectArgs = rest;
60
73
  if (this._getPaymentCredentials) {
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
- .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");
63
75
  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) }));
76
+ connectArgs = Object.assign(Object.assign({}, rest), { queryParams: Object.assign(Object.assign({}, credentials), rest.queryParams) });
65
77
  }
66
- if (!args.apiKey) {
78
+ else if (!rest.apiKey) {
67
79
  const apiKey = (_c = (yield core.Supplier.get(this._options.apiKey))) !== null && _c !== void 0 ? _c : process.env.AGENTMAIL_API_KEY;
68
- return _super.connect.call(this, Object.assign(Object.assign({}, args), { apiKey }));
80
+ connectArgs = Object.assign(Object.assign({}, rest), { apiKey });
69
81
  }
70
- return _super.connect.call(this, args);
82
+ const socket = yield _super.connect.call(this, connectArgs);
83
+ if (waitForOpen)
84
+ yield socket.waitForOpen();
85
+ return socket;
71
86
  });
72
87
  }
73
88
  }
@@ -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.5",
10
- "User-Agent": "agentmail/0.3.5",
9
+ "X-Fern-SDK-Version": "0.3.7",
10
+ "User-Agent": "agentmail/0.3.7",
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.5";
1
+ export declare const SDK_VERSION = "0.3.7";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.3.5";
1
+ export const SDK_VERSION = "0.3.7";
@@ -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,17 +32,21 @@ export class WebsocketsClient extends FernWebsocketsClient {
21
32
  });
22
33
  return __awaiter(this, arguments, void 0, function* (args = {}) {
23
34
  var _a, _b, _c;
35
+ const { waitForOpen = true } = args, rest = __rest(args, ["waitForOpen"]);
36
+ let connectArgs = rest;
24
37
  if (this._getPaymentCredentials) {
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
- .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");
27
39
  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) }));
40
+ connectArgs = Object.assign(Object.assign({}, rest), { queryParams: Object.assign(Object.assign({}, credentials), rest.queryParams) });
29
41
  }
30
- if (!args.apiKey) {
42
+ else if (!rest.apiKey) {
31
43
  const apiKey = (_c = (yield core.Supplier.get(this._options.apiKey))) !== null && _c !== void 0 ? _c : process.env.AGENTMAIL_API_KEY;
32
- return _super.connect.call(this, Object.assign(Object.assign({}, args), { apiKey }));
44
+ connectArgs = Object.assign(Object.assign({}, rest), { apiKey });
33
45
  }
34
- return _super.connect.call(this, args);
46
+ const socket = yield _super.connect.call(this, connectArgs);
47
+ if (waitForOpen)
48
+ yield socket.waitForOpen();
49
+ return socket;
35
50
  });
36
51
  }
37
52
  }