@fonoster/common 0.8.26 → 0.8.27

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 (34) hide show
  1. package/dist/assistants/LanguageModelProvider.d.ts +6 -0
  2. package/dist/assistants/LanguageModelProvider.js +27 -0
  3. package/dist/assistants/assistantSchema.d.ts +411 -0
  4. package/dist/assistants/assistantSchema.js +29 -0
  5. package/dist/assistants/conversationSettingsSchema.d.ts +98 -0
  6. package/dist/assistants/conversationSettingsSchema.js +113 -0
  7. package/dist/assistants/index.d.ts +5 -0
  8. package/dist/assistants/index.js +39 -0
  9. package/dist/assistants/languageModelConfigSchema.d.ts +198 -0
  10. package/dist/assistants/languageModelConfigSchema.js +89 -0
  11. package/dist/assistants/tools/AllowedOperations.d.ts +6 -0
  12. package/dist/assistants/tools/AllowedOperations.js +27 -0
  13. package/dist/assistants/tools/index.d.ts +1 -0
  14. package/dist/assistants/tools/index.js +35 -0
  15. package/dist/assistants/tools/propertySchema.d.ts +23 -0
  16. package/dist/assistants/tools/propertySchema.js +34 -0
  17. package/dist/assistants/tools/toolSchema.d.ts +113 -0
  18. package/dist/assistants/tools/toolSchema.js +87 -0
  19. package/dist/errors/PrismaErrorEnum.d.ts +1 -2
  20. package/dist/errors/PrismaErrorEnum.js +0 -1
  21. package/dist/errors/handleError.js +1 -5
  22. package/dist/identity/roles.js +4 -1
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.js +1 -0
  25. package/dist/protos/applications.proto +6 -4
  26. package/dist/utils/findIntegrationsCredentials.d.ts +5 -0
  27. package/dist/utils/findIntegrationsCredentials.js +25 -0
  28. package/dist/utils/index.d.ts +1 -0
  29. package/dist/utils/index.js +1 -0
  30. package/dist/validators/calls.d.ts +2 -2
  31. package/dist/validators/hostOrHostPortSchema.d.ts +1 -1
  32. package/dist/validators/hostOrHostPortSchema.js +1 -4
  33. package/dist/validators/identity.d.ts +2 -2
  34. package/package.json +3 -3
@@ -83,10 +83,6 @@ function handleError(error, callback) {
83
83
  case grpc.status.NOT_FOUND:
84
84
  logAndCallback(grpc_js_1.status.NOT_FOUND, "The requested resource was not found", "not found error");
85
85
  break;
86
- case PrismaErrorEnum_1.PrismaErrorEnum.FAILED_PRECONDITION:
87
- case grpc.status.FAILED_PRECONDITION:
88
- logAndCallback(grpc_js_1.status.FAILED_PRECONDITION, "Failed precondition error (e.g., missing dependency)", "failed precondition error");
89
- break;
90
86
  case grpc.status.PERMISSION_DENIED:
91
87
  logAndCallback(grpc_js_1.status.PERMISSION_DENIED, "You don't have permission to perform this action", "permission denied error");
92
88
  break;
@@ -94,7 +90,7 @@ function handleError(error, callback) {
94
90
  logAndCallback(grpc_js_1.status.UNAUTHENTICATED, "You need to be authenticated to perform this action", "unauthenticated error");
95
91
  break;
96
92
  case grpc.status.INVALID_ARGUMENT:
97
- logAndCallback(grpc_js_1.status.INVALID_ARGUMENT, message !== null && message !== void 0 ? message : "Your request has invalid arguments", "invalid argument error");
93
+ logAndCallback(grpc_js_1.status.INVALID_ARGUMENT, message !== null && message !== void 0 ? message : "Your request has one or more invalid arguments", "invalid argument error");
98
94
  break;
99
95
  default:
100
96
  logger.error("internal server error:", error);
@@ -123,7 +123,10 @@ const roles = [
123
123
  {
124
124
  name: VOICE_SERVICE_ROLE,
125
125
  description: "Role with access only to the Voice service endpoint",
126
- access: ["/fonoster.voice.v1beta2.Voice/CreateSession"]
126
+ access: [
127
+ "/fonoster.voice.v1beta2.Voice/CreateSession",
128
+ "/fonoster.applications.v1beta2.Applications/GetApplication"
129
+ ]
127
130
  }
128
131
  ];
129
132
  exports.roles = roles;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./assistants";
1
2
  export * from "./GrpcError";
2
3
  export * from "./constants";
3
4
  export * from "./errors";
package/dist/index.js CHANGED
@@ -55,6 +55,7 @@ exports.Validators = exports.Messages = void 0;
55
55
  * See the License for the specific language governing permissions and
56
56
  * limitations under the License.
57
57
  */
58
+ __exportStar(require("./assistants"), exports);
58
59
  __exportStar(require("./GrpcError"), exports);
59
60
  __exportStar(require("./constants"), exports);
60
61
  __exportStar(require("./errors"), exports);
@@ -40,6 +40,8 @@ service Applications {
40
40
  enum ApplicationType {
41
41
  // Programmable Voice
42
42
  EXTERNAL = 0;
43
+ // Internal LLM based applications
44
+ AUTOPILOT = 1;
43
45
  }
44
46
 
45
47
  message ProductContainer {
@@ -65,8 +67,8 @@ message Application {
65
67
  ProductContainer text_to_speech = 5;
66
68
  // Speech to text product
67
69
  ProductContainer speech_to_text = 6;
68
- // Conversation product
69
- ProductContainer conversation = 7;
70
+ // Intelligence product
71
+ ProductContainer intelligence = 7;
70
72
  // Creation time
71
73
  int32 created_at = 8;
72
74
  // Update time
@@ -85,7 +87,7 @@ message CreateApplicationRequest {
85
87
  ProductContainer text_to_speech = 4;
86
88
  // Speech to text product
87
89
  ProductContainer speech_to_text = 5;
88
- // Conversation product
90
+ // Inference engine
89
91
  ProductContainer intelligence = 6;
90
92
  }
91
93
 
@@ -131,7 +133,7 @@ message UpdateApplicationRequest {
131
133
  ProductContainer text_to_speech = 5;
132
134
  // Speech to text product
133
135
  ProductContainer speech_to_text = 6;
134
- // Conversation product
136
+ // Intelligence product
135
137
  ProductContainer intelligence = 7;
136
138
  }
137
139
 
@@ -0,0 +1,5 @@
1
+ declare function findIntegrationsCredentials(integrations: {
2
+ productRef: string;
3
+ credentials: Record<string, unknown>;
4
+ }[], engine: string): Record<string, unknown>;
5
+ export { findIntegrationsCredentials };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findIntegrationsCredentials = findIntegrationsCredentials;
4
+ /*
5
+ * Copyright (C) 2024 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
+ function findIntegrationsCredentials(integrations, engine) {
23
+ var _a;
24
+ return (_a = integrations.find((i) => i.productRef === engine)) === null || _a === void 0 ? void 0 : _a.credentials;
25
+ }
@@ -11,3 +11,4 @@ export * from "./withErrorHandlingAndValidation";
11
11
  export * from "./withValidation";
12
12
  export * from "./types";
13
13
  export * from "./createFetchSingleCallByCallId";
14
+ export * from "./findIntegrationsCredentials";
@@ -45,3 +45,4 @@ __exportStar(require("./withErrorHandlingAndValidation"), exports);
45
45
  __exportStar(require("./withValidation"), exports);
46
46
  __exportStar(require("./types"), exports);
47
47
  __exportStar(require("./createFetchSingleCallByCallId"), exports);
48
+ __exportStar(require("./findIntegrationsCredentials"), exports);
@@ -6,15 +6,15 @@ declare const createCallRequestSchema: z.ZodObject<{
6
6
  appRef: z.ZodString;
7
7
  timeout: z.ZodOptional<z.ZodNumber>;
8
8
  }, "strip", z.ZodTypeAny, {
9
+ timeout?: number;
9
10
  to?: string;
10
11
  from?: string;
11
12
  appRef?: string;
12
- timeout?: number;
13
13
  }, {
14
+ timeout?: number;
14
15
  to?: string;
15
16
  from?: string;
16
17
  appRef?: string;
17
- timeout?: number;
18
18
  }>;
19
19
  declare const getCallRequestSchema: z.ZodObject<{
20
20
  ref: z.ZodString;
@@ -1,3 +1,3 @@
1
1
  import { z } from "zod";
2
- declare const hostOrHostPortSchema: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string>;
2
+ declare const hostOrHostPortSchema: z.ZodEffects<z.ZodString, string, string>;
3
3
  export { hostOrHostPortSchema };
@@ -20,10 +20,7 @@ exports.hostOrHostPortSchema = void 0;
20
20
  * limitations under the License.
21
21
  */
22
22
  const zod_1 = require("zod");
23
- const hostOrHostPortSchema = zod_1.z
24
- .string()
25
- .optional()
26
- .refine((value) => {
23
+ const hostOrHostPortSchema = zod_1.z.string().refine((value) => {
27
24
  const hostRegex = /^(?!:\/\/)([a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)*|(\d{1,3}\.){3}\d{1,3})$/;
28
25
  const hostPortRegex = /^(?!:\/\/)([a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)*|(\d{1,3}\.){3}\d{1,3}):\d{1,5}$/;
29
26
  return hostRegex.test(value) || hostPortRegex.test(value);
@@ -46,12 +46,12 @@ declare const exchangeOauth2RequestSchema: z.ZodObject<{
46
46
  code: z.ZodString;
47
47
  }, "strip", z.ZodTypeAny, {
48
48
  code?: string;
49
- username?: string;
50
49
  provider?: "GITHUB";
50
+ username?: string;
51
51
  }, {
52
52
  code?: string;
53
- username?: string;
54
53
  provider?: "GITHUB";
54
+ username?: string;
55
55
  }>;
56
56
  declare const exchangeRefreshTokenRequestSchema: z.ZodObject<{
57
57
  refreshToken: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/common",
3
- "version": "0.8.26",
3
+ "version": "0.8.27",
4
4
  "description": "Common library for Fonoster projects",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -18,7 +18,7 @@
18
18
  "clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo"
19
19
  },
20
20
  "dependencies": {
21
- "@fonoster/logger": "^0.8.26",
21
+ "@fonoster/logger": "^0.8.27",
22
22
  "@grpc/grpc-js": "~1.10.6",
23
23
  "@grpc/proto-loader": "^0.7.12",
24
24
  "@influxdata/influxdb-client": "^1.35.0",
@@ -46,5 +46,5 @@
46
46
  "devDependencies": {
47
47
  "@types/nodemailer": "^6.4.14"
48
48
  },
49
- "gitHead": "f01e634eca9a94b3a276369e998c6e75f8b75284"
49
+ "gitHead": "3c50badbc1b7043d1525603ad3386b9f70d53b28"
50
50
  }