phonic 0.30.12 → 0.30.14

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 (31) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/agents/client/Client.d.ts +1 -1
  3. package/dist/cjs/api/resources/agents/client/Client.js +3 -3
  4. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +1 -1
  5. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +1 -1
  6. package/dist/cjs/api/resources/conversations/client/requests/ConversationsListRequest.d.ts +3 -3
  7. package/dist/cjs/api/resources/conversations/types/ConversationsListResponse.d.ts +4 -0
  8. package/dist/cjs/api/resources/projects/client/Client.d.ts +1 -1
  9. package/dist/cjs/api/resources/projects/client/Client.js +3 -3
  10. package/dist/cjs/api/resources/projects/client/requests/UpdateProjectRequest.d.ts +1 -1
  11. package/dist/cjs/api/types/CreateAgentRequest.d.ts +1 -1
  12. package/dist/cjs/api/types/ToolCallOutputProcessedPayload.d.ts +4 -2
  13. package/dist/cjs/core/websocket/ws.js +2 -1
  14. package/dist/cjs/version.d.ts +1 -1
  15. package/dist/cjs/version.js +1 -1
  16. package/dist/esm/Client.mjs +2 -2
  17. package/dist/esm/api/resources/agents/client/Client.d.mts +1 -1
  18. package/dist/esm/api/resources/agents/client/Client.mjs +3 -3
  19. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +1 -1
  20. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +1 -1
  21. package/dist/esm/api/resources/conversations/client/requests/ConversationsListRequest.d.mts +3 -3
  22. package/dist/esm/api/resources/conversations/types/ConversationsListResponse.d.mts +4 -0
  23. package/dist/esm/api/resources/projects/client/Client.d.mts +1 -1
  24. package/dist/esm/api/resources/projects/client/Client.mjs +3 -3
  25. package/dist/esm/api/resources/projects/client/requests/UpdateProjectRequest.d.mts +1 -1
  26. package/dist/esm/api/types/CreateAgentRequest.d.mts +1 -1
  27. package/dist/esm/api/types/ToolCallOutputProcessedPayload.d.mts +4 -2
  28. package/dist/esm/core/websocket/ws.mjs +2 -1
  29. package/dist/esm/version.d.mts +1 -1
  30. package/dist/esm/version.mjs +1 -1
  31. package/package.json +1 -1
@@ -50,8 +50,8 @@ class PhonicClient {
50
50
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
51
51
  "X-Fern-Language": "JavaScript",
52
52
  "X-Fern-SDK-Name": "phonic",
53
- "X-Fern-SDK-Version": "0.30.12",
54
- "User-Agent": "phonic/0.30.12",
53
+ "X-Fern-SDK-Version": "0.30.14",
54
+ "User-Agent": "phonic/0.30.14",
55
55
  "X-Fern-Runtime": core.RUNTIME.type,
56
56
  "X-Fern-Runtime-Version": core.RUNTIME.version,
57
57
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -212,7 +212,7 @@ export declare class Agents {
212
212
  * }
213
213
  * })
214
214
  */
215
- update(nameOrId: string, request?: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
215
+ update(nameOrId: string, request: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
216
216
  private __update;
217
217
  protected _getAuthorizationHeader(): Promise<string | undefined>;
218
218
  }
@@ -528,11 +528,11 @@ class Agents {
528
528
  * }
529
529
  * })
530
530
  */
531
- update(nameOrId, request = {}, requestOptions) {
531
+ update(nameOrId, request, requestOptions) {
532
532
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
533
533
  }
534
- __update(nameOrId_1) {
535
- return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
534
+ __update(nameOrId, request, requestOptions) {
535
+ return __awaiter(this, void 0, void 0, function* () {
536
536
  var _a, _b, _c, _d;
537
537
  const { project } = request, _body = __rest(request, ["project"]);
538
538
  const _queryParams = {};
@@ -41,7 +41,7 @@ export interface AgentsCreateRequest {
41
41
  project?: string;
42
42
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
43
43
  name: string;
44
- phone_number?: "assign-automatically" | null;
44
+ phone_number: "assign-automatically" | null;
45
45
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
46
46
  timezone?: string;
47
47
  /** The voice ID to use. */
@@ -41,7 +41,7 @@ export interface UpdateAgentRequest {
41
41
  project?: string;
42
42
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
43
43
  name?: string;
44
- phone_number?: "assign-automatically" | null;
44
+ phone_number: "assign-automatically" | null;
45
45
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
46
46
  timezone?: string;
47
47
  /** The voice ID to use. */
@@ -21,10 +21,10 @@ export interface ConversationsListRequest {
21
21
  started_at_min?: string;
22
22
  /** Maximum start date/time. Valid examples: `2025-04-17`, `2025-04-17T02:48:52.708Z` */
23
23
  started_at_max?: string;
24
- /** Cursor for pagination (before). */
24
+ /** Cursor for backward pagination. Use a conversation ID from `pagination.prev_cursor` to fetch the previous page of conversations. Cannot be used with `after`. */
25
25
  before?: string;
26
- /** Cursor for pagination (after). */
26
+ /** Cursor for forward pagination. Use a conversation ID from `pagination.next_cursor` to fetch the next page of conversations. Cannot be used with `before`. */
27
27
  after?: string;
28
- /** Maximum number of conversations to return. */
28
+ /** Maximum number of conversations to return per page. */
29
29
  limit?: number;
30
30
  }
@@ -4,6 +4,10 @@
4
4
  import * as Phonic from "../../../index.js";
5
5
  export type ConversationsListResponse = {
6
6
  conversations: Phonic.Conversation[];
7
+ pagination: {
8
+ prev_cursor: string | null;
9
+ next_cursor: string | null;
10
+ };
7
11
  } | {
8
12
  conversation: Phonic.Conversation;
9
13
  };
@@ -113,7 +113,7 @@ export declare class Projects {
113
113
  * default_agent: "another-agent"
114
114
  * })
115
115
  */
116
- update(nameOrId: string, request?: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
116
+ update(nameOrId: string, request: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
117
117
  private __update;
118
118
  /**
119
119
  * Returns all conversation evaluation prompts for a project.
@@ -349,11 +349,11 @@ class Projects {
349
349
  * default_agent: "another-agent"
350
350
  * })
351
351
  */
352
- update(nameOrId, request = {}, requestOptions) {
352
+ update(nameOrId, request, requestOptions) {
353
353
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
354
354
  }
355
- __update(nameOrId_1) {
356
- return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
355
+ __update(nameOrId, request, requestOptions) {
356
+ return __awaiter(this, void 0, void 0, function* () {
357
357
  var _a, _b, _c, _d;
358
358
  let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
359
359
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
@@ -11,5 +11,5 @@
11
11
  export interface UpdateProjectRequest {
12
12
  /** The name of the project. Can only contain lowercase letters, numbers and hyphens. Must be unique within the workspace. */
13
13
  name?: string;
14
- default_agent?: string | null;
14
+ default_agent: string | null;
15
15
  }
@@ -5,7 +5,7 @@ import * as Phonic from "../index.js";
5
5
  export interface CreateAgentRequest {
6
6
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
7
7
  name: string;
8
- phone_number?: "assign-automatically" | null;
8
+ phone_number: "assign-automatically" | null;
9
9
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
10
10
  timezone?: string;
11
11
  /** The voice ID to use. */
@@ -14,10 +14,12 @@ export interface ToolCallOutputProcessedPayload {
14
14
  endpoint_called_at?: string | null;
15
15
  /** Webhook request body (null for WebSocket tools) */
16
16
  request_body?: Record<string, unknown> | null;
17
- response_body?: unknown;
17
+ /** Webhook response body (null for WebSocket tools) */
18
+ response_body?: unknown | null;
18
19
  /** WebSocket tool parameters (null for webhook tools) */
19
20
  parameters?: Record<string, unknown> | null;
20
- output?: unknown;
21
+ /** WebSocket tool output (null for webhook tools) */
22
+ output?: unknown | null;
21
23
  /** Webhook HTTP status code (null for WebSocket tools) */
22
24
  response_status_code?: number | null;
23
25
  /** Whether the tool call timed out */
@@ -39,7 +39,8 @@ const index_js_1 = require("../runtime/index.js");
39
39
  const qs_js_1 = require("../url/qs.js");
40
40
  const Events = __importStar(require("./events.js"));
41
41
  const getGlobalWebSocket = () => {
42
- if (index_js_1.RUNTIME.type === "node") {
42
+ // Use Node.js 'ws' library for server-side runtimes since native WebSocket doesn't support headers
43
+ if (index_js_1.RUNTIME.type === "node" || index_js_1.RUNTIME.type === "bun" || index_js_1.RUNTIME.type === "deno") {
43
44
  return ws_1.WebSocket;
44
45
  }
45
46
  else if (typeof WebSocket !== "undefined") {
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.12";
1
+ export declare const SDK_VERSION = "0.30.14";
@@ -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.30.12";
4
+ exports.SDK_VERSION = "0.30.14";
@@ -14,8 +14,8 @@ export class PhonicClient {
14
14
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
15
15
  "X-Fern-Language": "JavaScript",
16
16
  "X-Fern-SDK-Name": "phonic",
17
- "X-Fern-SDK-Version": "0.30.12",
18
- "User-Agent": "phonic/0.30.12",
17
+ "X-Fern-SDK-Version": "0.30.14",
18
+ "User-Agent": "phonic/0.30.14",
19
19
  "X-Fern-Runtime": core.RUNTIME.type,
20
20
  "X-Fern-Runtime-Version": core.RUNTIME.version,
21
21
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -212,7 +212,7 @@ export declare class Agents {
212
212
  * }
213
213
  * })
214
214
  */
215
- update(nameOrId: string, request?: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
215
+ update(nameOrId: string, request: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
216
216
  private __update;
217
217
  protected _getAuthorizationHeader(): Promise<string | undefined>;
218
218
  }
@@ -492,11 +492,11 @@ export class Agents {
492
492
  * }
493
493
  * })
494
494
  */
495
- update(nameOrId, request = {}, requestOptions) {
495
+ update(nameOrId, request, requestOptions) {
496
496
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
497
497
  }
498
- __update(nameOrId_1) {
499
- return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
498
+ __update(nameOrId, request, requestOptions) {
499
+ return __awaiter(this, void 0, void 0, function* () {
500
500
  var _a, _b, _c, _d;
501
501
  const { project } = request, _body = __rest(request, ["project"]);
502
502
  const _queryParams = {};
@@ -41,7 +41,7 @@ export interface AgentsCreateRequest {
41
41
  project?: string;
42
42
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
43
43
  name: string;
44
- phone_number?: "assign-automatically" | null;
44
+ phone_number: "assign-automatically" | null;
45
45
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
46
46
  timezone?: string;
47
47
  /** The voice ID to use. */
@@ -41,7 +41,7 @@ export interface UpdateAgentRequest {
41
41
  project?: string;
42
42
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
43
43
  name?: string;
44
- phone_number?: "assign-automatically" | null;
44
+ phone_number: "assign-automatically" | null;
45
45
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
46
46
  timezone?: string;
47
47
  /** The voice ID to use. */
@@ -21,10 +21,10 @@ export interface ConversationsListRequest {
21
21
  started_at_min?: string;
22
22
  /** Maximum start date/time. Valid examples: `2025-04-17`, `2025-04-17T02:48:52.708Z` */
23
23
  started_at_max?: string;
24
- /** Cursor for pagination (before). */
24
+ /** Cursor for backward pagination. Use a conversation ID from `pagination.prev_cursor` to fetch the previous page of conversations. Cannot be used with `after`. */
25
25
  before?: string;
26
- /** Cursor for pagination (after). */
26
+ /** Cursor for forward pagination. Use a conversation ID from `pagination.next_cursor` to fetch the next page of conversations. Cannot be used with `before`. */
27
27
  after?: string;
28
- /** Maximum number of conversations to return. */
28
+ /** Maximum number of conversations to return per page. */
29
29
  limit?: number;
30
30
  }
@@ -4,6 +4,10 @@
4
4
  import * as Phonic from "../../../index.mjs";
5
5
  export type ConversationsListResponse = {
6
6
  conversations: Phonic.Conversation[];
7
+ pagination: {
8
+ prev_cursor: string | null;
9
+ next_cursor: string | null;
10
+ };
7
11
  } | {
8
12
  conversation: Phonic.Conversation;
9
13
  };
@@ -113,7 +113,7 @@ export declare class Projects {
113
113
  * default_agent: "another-agent"
114
114
  * })
115
115
  */
116
- update(nameOrId: string, request?: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
116
+ update(nameOrId: string, request: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
117
117
  private __update;
118
118
  /**
119
119
  * Returns all conversation evaluation prompts for a project.
@@ -313,11 +313,11 @@ export class Projects {
313
313
  * default_agent: "another-agent"
314
314
  * })
315
315
  */
316
- update(nameOrId, request = {}, requestOptions) {
316
+ update(nameOrId, request, requestOptions) {
317
317
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
318
318
  }
319
- __update(nameOrId_1) {
320
- return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
319
+ __update(nameOrId, request, requestOptions) {
320
+ return __awaiter(this, void 0, void 0, function* () {
321
321
  var _a, _b, _c, _d;
322
322
  let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
323
323
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
@@ -11,5 +11,5 @@
11
11
  export interface UpdateProjectRequest {
12
12
  /** The name of the project. Can only contain lowercase letters, numbers and hyphens. Must be unique within the workspace. */
13
13
  name?: string;
14
- default_agent?: string | null;
14
+ default_agent: string | null;
15
15
  }
@@ -5,7 +5,7 @@ import * as Phonic from "../index.mjs";
5
5
  export interface CreateAgentRequest {
6
6
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
7
7
  name: string;
8
- phone_number?: "assign-automatically" | null;
8
+ phone_number: "assign-automatically" | null;
9
9
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
10
10
  timezone?: string;
11
11
  /** The voice ID to use. */
@@ -14,10 +14,12 @@ export interface ToolCallOutputProcessedPayload {
14
14
  endpoint_called_at?: string | null;
15
15
  /** Webhook request body (null for WebSocket tools) */
16
16
  request_body?: Record<string, unknown> | null;
17
- response_body?: unknown;
17
+ /** Webhook response body (null for WebSocket tools) */
18
+ response_body?: unknown | null;
18
19
  /** WebSocket tool parameters (null for webhook tools) */
19
20
  parameters?: Record<string, unknown> | null;
20
- output?: unknown;
21
+ /** WebSocket tool output (null for webhook tools) */
22
+ output?: unknown | null;
21
23
  /** Webhook HTTP status code (null for WebSocket tools) */
22
24
  response_status_code?: number | null;
23
25
  /** Whether the tool call timed out */
@@ -3,7 +3,8 @@ import { RUNTIME } from "../runtime/index.mjs";
3
3
  import { toQueryString } from "../url/qs.mjs";
4
4
  import * as Events from "./events.mjs";
5
5
  const getGlobalWebSocket = () => {
6
- if (RUNTIME.type === "node") {
6
+ // Use Node.js 'ws' library for server-side runtimes since native WebSocket doesn't support headers
7
+ if (RUNTIME.type === "node" || RUNTIME.type === "bun" || RUNTIME.type === "deno") {
7
8
  return NodeWebSocket;
8
9
  }
9
10
  else if (typeof WebSocket !== "undefined") {
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.12";
1
+ export declare const SDK_VERSION = "0.30.14";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.30.12";
1
+ export const SDK_VERSION = "0.30.14";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.30.12",
3
+ "version": "0.30.14",
4
4
  "private": false,
5
5
  "repository": "github:Phonic-Co/phonic-node",
6
6
  "type": "commonjs",