@fonoster/apiserver 0.8.37 → 0.8.39

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.
@@ -10,9 +10,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.createGetFnUtil = createGetFnUtil;
13
+ /*
14
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
15
+ * http://github.com/fonoster/fonoster
16
+ *
17
+ * This file is part of Fonoster
18
+ *
19
+ * Licensed under the MIT License (the "License");
20
+ * you may not use this file except in compliance with
21
+ * the License. You may obtain a copy of the License at
22
+ *
23
+ * https://opensource.org/licenses/MIT
24
+ *
25
+ * Unless required by applicable law or agreed to in writing, software
26
+ * distributed under the License is distributed on an "AS IS" BASIS,
27
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
+ * See the License for the specific language governing permissions and
29
+ * limitations under the License.
30
+ */
31
+ const badRequestError_1 = require("../core/badRequestError");
13
32
  const notFoundError_1 = require("../core/notFoundError");
14
33
  function createGetFnUtil(prisma) {
15
34
  return (ref) => __awaiter(this, void 0, void 0, function* () {
35
+ if (!ref) {
36
+ throw (0, badRequestError_1.badRequestError)("The reference to the resource is required");
37
+ }
16
38
  const response = yield prisma.application.findUnique({
17
39
  where: { ref },
18
40
  include: {
@@ -6,11 +6,11 @@ declare const assistantWithoutApiKeySchema: z.ZodObject<z.objectUtil.extendShape
6
6
  goodbyeMessage: z.ZodString;
7
7
  systemErrorMessage: z.ZodString;
8
8
  initialDtmf: z.ZodOptional<z.ZodString>;
9
- maxSpeechWaitTimeout: z.ZodNumber;
9
+ maxSpeechWaitTimeout: z.ZodDefault<z.ZodNumber>;
10
10
  transferOptions: z.ZodOptional<z.ZodObject<{
11
11
  phoneNumber: z.ZodString;
12
12
  message: z.ZodString;
13
- timeout: z.ZodOptional<z.ZodNumber>;
13
+ timeout: z.ZodDefault<z.ZodNumber>;
14
14
  }, "strip", z.ZodTypeAny, {
15
15
  message?: string;
16
16
  phoneNumber?: string;
@@ -20,10 +20,10 @@ declare const assistantWithoutApiKeySchema: z.ZodObject<z.objectUtil.extendShape
20
20
  phoneNumber?: string;
21
21
  timeout?: number;
22
22
  }>>;
23
- idleOptions: z.ZodOptional<z.ZodObject<{
23
+ idleOptions: z.ZodObject<{
24
24
  message: z.ZodString;
25
- timeout: z.ZodNumber;
26
- maxTimeoutCount: z.ZodNumber;
25
+ timeout: z.ZodDefault<z.ZodNumber>;
26
+ maxTimeoutCount: z.ZodDefault<z.ZodNumber>;
27
27
  }, "strip", z.ZodTypeAny, {
28
28
  message?: string;
29
29
  timeout?: number;
@@ -32,8 +32,8 @@ declare const assistantWithoutApiKeySchema: z.ZodObject<z.objectUtil.extendShape
32
32
  message?: string;
33
33
  timeout?: number;
34
34
  maxTimeoutCount?: number;
35
- }>>;
36
- vad: z.ZodObject<{
35
+ }>;
36
+ vad: z.ZodDefault<z.ZodObject<{
37
37
  pathToModel: z.ZodOptional<z.ZodString>;
38
38
  activationThreshold: z.ZodNumber;
39
39
  deactivationThreshold: z.ZodNumber;
@@ -48,7 +48,7 @@ declare const assistantWithoutApiKeySchema: z.ZodObject<z.objectUtil.extendShape
48
48
  activationThreshold?: number;
49
49
  deactivationThreshold?: number;
50
50
  debounceFrames?: number;
51
- }>;
51
+ }>>;
52
52
  }, "strip", z.ZodTypeAny, {
53
53
  firstMessage?: string;
54
54
  systemTemplate?: string;
@@ -103,7 +103,7 @@ declare const assistantWithoutApiKeySchema: z.ZodObject<z.objectUtil.extendShape
103
103
  temperature: z.ZodNumber;
104
104
  maxTokens: z.ZodNumber;
105
105
  baseUrl: z.ZodOptional<z.ZodString>;
106
- knowledgeBase: z.ZodArray<z.ZodObject<{
106
+ knowledgeBase: z.ZodDefault<z.ZodArray<z.ZodObject<{
107
107
  type: z.ZodEnum<["s3"]>;
108
108
  title: z.ZodString;
109
109
  document: z.ZodString;
@@ -115,8 +115,8 @@ declare const assistantWithoutApiKeySchema: z.ZodObject<z.objectUtil.extendShape
115
115
  type?: "s3";
116
116
  title?: string;
117
117
  document?: string;
118
- }>, "many">;
119
- tools: z.ZodArray<z.ZodObject<{
118
+ }>, "many">>;
119
+ tools: z.ZodDefault<z.ZodArray<z.ZodObject<{
120
120
  name: z.ZodString;
121
121
  description: z.ZodString;
122
122
  parameters: z.ZodObject<{
@@ -225,7 +225,7 @@ declare const assistantWithoutApiKeySchema: z.ZodObject<z.objectUtil.extendShape
225
225
  waitForResponse?: boolean;
226
226
  headers?: Record<string, string>;
227
227
  };
228
- }>, "many">;
228
+ }>, "many">>;
229
229
  }, "strip", z.ZodTypeAny, {
230
230
  provider?: import("@fonoster/common").LanguageModelProvider;
231
231
  apiKey?: string;
@@ -299,7 +299,7 @@ declare const assistantWithoutApiKeySchema: z.ZodObject<z.objectUtil.extendShape
299
299
  temperature: z.ZodNumber;
300
300
  maxTokens: z.ZodNumber;
301
301
  baseUrl: z.ZodOptional<z.ZodString>;
302
- knowledgeBase: z.ZodArray<z.ZodObject<{
302
+ knowledgeBase: z.ZodDefault<z.ZodArray<z.ZodObject<{
303
303
  type: z.ZodEnum<["s3"]>;
304
304
  title: z.ZodString;
305
305
  document: z.ZodString;
@@ -311,8 +311,8 @@ declare const assistantWithoutApiKeySchema: z.ZodObject<z.objectUtil.extendShape
311
311
  type?: "s3";
312
312
  title?: string;
313
313
  document?: string;
314
- }>, "many">;
315
- tools: z.ZodArray<z.ZodObject<{
314
+ }>, "many">>;
315
+ tools: z.ZodDefault<z.ZodArray<z.ZodObject<{
316
316
  name: z.ZodString;
317
317
  description: z.ZodString;
318
318
  parameters: z.ZodObject<{
@@ -421,7 +421,7 @@ declare const assistantWithoutApiKeySchema: z.ZodObject<z.objectUtil.extendShape
421
421
  waitForResponse?: boolean;
422
422
  headers?: Record<string, string>;
423
423
  };
424
- }>, "many">;
424
+ }>, "many">>;
425
425
  }, "strip", z.ZodTypeAny, {
426
426
  provider?: import("@fonoster/common").LanguageModelProvider;
427
427
  apiKey?: string;
@@ -44,11 +44,11 @@ declare function createValidationSchema(request: {
44
44
  goodbyeMessage: z.ZodString;
45
45
  systemErrorMessage: z.ZodString;
46
46
  initialDtmf: z.ZodOptional<z.ZodString>;
47
- maxSpeechWaitTimeout: z.ZodNumber;
47
+ maxSpeechWaitTimeout: z.ZodDefault<z.ZodNumber>;
48
48
  transferOptions: z.ZodOptional<z.ZodObject<{
49
49
  phoneNumber: z.ZodString;
50
50
  message: z.ZodString;
51
- timeout: z.ZodOptional<z.ZodNumber>;
51
+ timeout: z.ZodDefault<z.ZodNumber>;
52
52
  }, "strip", z.ZodTypeAny, {
53
53
  message?: string;
54
54
  phoneNumber?: string;
@@ -58,10 +58,10 @@ declare function createValidationSchema(request: {
58
58
  phoneNumber?: string;
59
59
  timeout?: number;
60
60
  }>>;
61
- idleOptions: z.ZodOptional<z.ZodObject<{
61
+ idleOptions: z.ZodObject<{
62
62
  message: z.ZodString;
63
- timeout: z.ZodNumber;
64
- maxTimeoutCount: z.ZodNumber;
63
+ timeout: z.ZodDefault<z.ZodNumber>;
64
+ maxTimeoutCount: z.ZodDefault<z.ZodNumber>;
65
65
  }, "strip", z.ZodTypeAny, {
66
66
  message?: string;
67
67
  timeout?: number;
@@ -70,8 +70,8 @@ declare function createValidationSchema(request: {
70
70
  message?: string;
71
71
  timeout?: number;
72
72
  maxTimeoutCount?: number;
73
- }>>;
74
- vad: z.ZodObject<{
73
+ }>;
74
+ vad: z.ZodDefault<z.ZodObject<{
75
75
  pathToModel: z.ZodOptional<z.ZodString>;
76
76
  activationThreshold: z.ZodNumber;
77
77
  deactivationThreshold: z.ZodNumber;
@@ -86,7 +86,7 @@ declare function createValidationSchema(request: {
86
86
  activationThreshold?: number;
87
87
  deactivationThreshold?: number;
88
88
  debounceFrames?: number;
89
- }>;
89
+ }>>;
90
90
  }, "strip", z.ZodTypeAny, {
91
91
  firstMessage?: string;
92
92
  systemTemplate?: string;
@@ -141,7 +141,7 @@ declare function createValidationSchema(request: {
141
141
  temperature: z.ZodNumber;
142
142
  maxTokens: z.ZodNumber;
143
143
  baseUrl: z.ZodOptional<z.ZodString>;
144
- knowledgeBase: z.ZodArray<z.ZodObject<{
144
+ knowledgeBase: z.ZodDefault<z.ZodArray<z.ZodObject<{
145
145
  type: z.ZodEnum<["s3"]>;
146
146
  title: z.ZodString;
147
147
  document: z.ZodString;
@@ -153,8 +153,8 @@ declare function createValidationSchema(request: {
153
153
  type?: "s3";
154
154
  title?: string;
155
155
  document?: string;
156
- }>, "many">;
157
- tools: z.ZodArray<z.ZodObject<{
156
+ }>, "many">>;
157
+ tools: z.ZodDefault<z.ZodArray<z.ZodObject<{
158
158
  name: z.ZodString;
159
159
  description: z.ZodString;
160
160
  parameters: z.ZodObject<{
@@ -263,7 +263,7 @@ declare function createValidationSchema(request: {
263
263
  waitForResponse?: boolean;
264
264
  headers?: Record<string, string>;
265
265
  };
266
- }>, "many">;
266
+ }>, "many">>;
267
267
  }, "strip", z.ZodTypeAny, {
268
268
  provider?: import("@fonoster/common").LanguageModelProvider;
269
269
  apiKey?: string;
@@ -337,7 +337,7 @@ declare function createValidationSchema(request: {
337
337
  temperature: z.ZodNumber;
338
338
  maxTokens: z.ZodNumber;
339
339
  baseUrl: z.ZodOptional<z.ZodString>;
340
- knowledgeBase: z.ZodArray<z.ZodObject<{
340
+ knowledgeBase: z.ZodDefault<z.ZodArray<z.ZodObject<{
341
341
  type: z.ZodEnum<["s3"]>;
342
342
  title: z.ZodString;
343
343
  document: z.ZodString;
@@ -349,8 +349,8 @@ declare function createValidationSchema(request: {
349
349
  type?: "s3";
350
350
  title?: string;
351
351
  document?: string;
352
- }>, "many">;
353
- tools: z.ZodArray<z.ZodObject<{
352
+ }>, "many">>;
353
+ tools: z.ZodDefault<z.ZodArray<z.ZodObject<{
354
354
  name: z.ZodString;
355
355
  description: z.ZodString;
356
356
  parameters: z.ZodObject<{
@@ -459,7 +459,7 @@ declare function createValidationSchema(request: {
459
459
  waitForResponse?: boolean;
460
460
  headers?: Record<string, string>;
461
461
  };
462
- }>, "many">;
462
+ }>, "many">>;
463
463
  }, "strip", z.ZodTypeAny, {
464
464
  provider?: import("@fonoster/common").LanguageModelProvider;
465
465
  apiKey?: string;
@@ -0,0 +1,6 @@
1
+ import { status } from "@grpc/grpc-js";
2
+ declare const badRequestError: (message: string) => {
3
+ code: status;
4
+ message: string;
5
+ };
6
+ export { badRequestError };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.badRequestError = void 0;
4
+ /*
5
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
6
+ * http://github.com/fonoster/fonoster
7
+ *
8
+ * This file is part of Fonoster
9
+ *
10
+ * Licensed under the MIT License (the "License");
11
+ * you may not use this file except in compliance with
12
+ * the License. You may obtain a copy of the License at
13
+ *
14
+ * https://opensource.org/licenses/MIT
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ const grpc_js_1 = require("@grpc/grpc-js");
23
+ const badRequestError = (message) => ({
24
+ code: grpc_js_1.status.INVALID_ARGUMENT,
25
+ message
26
+ });
27
+ exports.badRequestError = badRequestError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/apiserver",
3
- "version": "0.8.37",
3
+ "version": "0.8.39",
4
4
  "description": "APIServer for Fonoster",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -21,13 +21,13 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@deepgram/sdk": "^3.5.1",
24
- "@fonoster/authz": "^0.8.36",
25
- "@fonoster/common": "^0.8.36",
26
- "@fonoster/identity": "^0.8.36",
27
- "@fonoster/logger": "^0.8.36",
28
- "@fonoster/sipnet": "^0.8.36",
29
- "@fonoster/streams": "^0.8.36",
30
- "@fonoster/types": "^0.8.36",
24
+ "@fonoster/authz": "^0.8.39",
25
+ "@fonoster/common": "^0.8.39",
26
+ "@fonoster/identity": "^0.8.39",
27
+ "@fonoster/logger": "^0.8.39",
28
+ "@fonoster/sipnet": "^0.8.39",
29
+ "@fonoster/streams": "^0.8.39",
30
+ "@fonoster/types": "^0.8.39",
31
31
  "@google-cloud/speech": "^6.6.0",
32
32
  "@google-cloud/text-to-speech": "^5.3.0",
33
33
  "@grpc/grpc-js": "~1.10.6",
@@ -73,5 +73,5 @@
73
73
  "@types/uuid": "^10.0.0",
74
74
  "@types/validator": "^13.12.0"
75
75
  },
76
- "gitHead": "5c10b1239e9363fa9d0041047bb6f641f5305c65"
76
+ "gitHead": "3ba2a5330d268f5be03fd9d5bbd22aeeb264fa61"
77
77
  }