retell-sdk 1.15.17 → 1.15.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/dist/sdk/sdk.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" />
2
- import { WebSocket } from "undici-types";
3
2
  import * as utils from "../internal/utils";
4
3
  import * as components from "../models/components";
5
4
  import * as operations from "../models/operations";
5
+ import { WebSocket } from "isomorphic-ws";
6
6
  import { AxiosInstance, AxiosRequestConfig } from "axios";
7
7
  import { EventEmitter } from "events";
8
8
  /**
@@ -59,6 +59,7 @@ export declare function convertFloat32ToPCM16(array: Float32Array): Uint8Array;
59
59
  export declare class RetellClient {
60
60
  private sdkConfiguration;
61
61
  constructor(props?: SDKProps);
62
+ createWebCall(apikey: string, agentId: string, sampleRate?: number, agentPromptParams?: never[], websocketEndpoint?: string): Promise<LiveClient>;
62
63
  /**
63
64
  * Create a new agent
64
65
  */
package/dist/sdk/sdk.js CHANGED
@@ -119,12 +119,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
119
119
  };
120
120
  Object.defineProperty(exports, "__esModule", { value: true });
121
121
  exports.RetellClient = exports.convertFloat32ToPCM16 = exports.convertPCM16ToFloat32 = exports.LiveClient = exports.SDKConfiguration = exports.ServerList = void 0;
122
- var undici_types_1 = require("undici-types");
123
122
  var utils = __importStar(require("../internal/utils"));
124
123
  var components = __importStar(require("../models/components"));
125
124
  var errors = __importStar(require("../models/errors"));
126
125
  var operations = __importStar(require("../models/operations"));
127
126
  var axios_1 = __importDefault(require("axios"));
127
+ var isomorphic_ws_1 = require("isomorphic-ws");
128
128
  var events_1 = require("events");
129
129
  /**
130
130
  * Contains the list of servers available to the SDK
@@ -171,7 +171,7 @@ var LiveClient = /** @class */ (function (_super) {
171
171
  }
172
172
  finally { if (e_1) throw e_1.error; }
173
173
  }
174
- _this.ws = new undici_types_1.WebSocket(endpoint);
174
+ _this.ws = new isomorphic_ws_1.WebSocket(endpoint);
175
175
  _this.ws.binaryType = "arraybuffer";
176
176
  return _this;
177
177
  }
@@ -260,6 +260,24 @@ var RetellClient = /** @class */ (function () {
260
260
  retryConfig: props === null || props === void 0 ? void 0 : props.retryConfig,
261
261
  });
262
262
  }
263
+ RetellClient.prototype.createWebCall = function (apikey, agentId, sampleRate, agentPromptParams, websocketEndpoint) {
264
+ if (sampleRate === void 0) { sampleRate = 16000; }
265
+ if (agentPromptParams === void 0) { agentPromptParams = []; }
266
+ if (websocketEndpoint === void 0) { websocketEndpoint = "wss://api.re-tell.ai"; }
267
+ return __awaiter(this, void 0, void 0, function () {
268
+ var liveClient;
269
+ return __generator(this, function (_a) {
270
+ switch (_a.label) {
271
+ case 0:
272
+ liveClient = new LiveClient(apikey, agentId, sampleRate, agentPromptParams, websocketEndpoint);
273
+ return [4 /*yield*/, liveClient.waitForReady()];
274
+ case 1:
275
+ _a.sent();
276
+ return [2 /*return*/, liveClient];
277
+ }
278
+ });
279
+ });
280
+ };
263
281
  /**
264
282
  * Create a new agent
265
283
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "retell-sdk",
3
- "version": "1.15.17",
3
+ "version": "1.15.19",
4
4
  "author": "Retell",
5
5
  "scripts": {
6
6
  "prepare": "tsc --build",
@@ -13,12 +13,15 @@
13
13
  "axios": "^1.1.3",
14
14
  "class-transformer": "^0.5.1",
15
15
  "form-data": "^4.0.0",
16
+ "isomorphic-ws": "^5.0.0",
16
17
  "jsonpath": "^1.1.1",
17
18
  "reflect-metadata": "^0.1.13",
18
- "websocket": "^1.0.34"
19
+ "websocket": "^1.0.34",
20
+ "ws": "^8.16.0"
19
21
  },
20
22
  "devDependencies": {
21
23
  "@types/jsonpath": "^0.2.0",
24
+ "@types/ws": "^8.5.10",
22
25
  "@typescript-eslint/eslint-plugin": "^5.56.0",
23
26
  "@typescript-eslint/parser": "^5.56.0",
24
27
  "eslint": "^8.36.0",