@fonoster/common 0.8.25 → 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.
- package/dist/assistants/LanguageModelProvider.d.ts +6 -0
- package/dist/assistants/LanguageModelProvider.js +27 -0
- package/dist/assistants/assistantSchema.d.ts +411 -0
- package/dist/assistants/assistantSchema.js +29 -0
- package/dist/assistants/conversationSettingsSchema.d.ts +98 -0
- package/dist/assistants/conversationSettingsSchema.js +113 -0
- package/dist/assistants/index.d.ts +5 -0
- package/dist/assistants/index.js +39 -0
- package/dist/assistants/languageModelConfigSchema.d.ts +198 -0
- package/dist/assistants/languageModelConfigSchema.js +89 -0
- package/dist/assistants/tools/AllowedOperations.d.ts +6 -0
- package/dist/assistants/tools/AllowedOperations.js +27 -0
- package/dist/assistants/tools/index.d.ts +1 -0
- package/dist/assistants/tools/index.js +35 -0
- package/dist/assistants/tools/propertySchema.d.ts +23 -0
- package/dist/assistants/tools/propertySchema.js +34 -0
- package/dist/assistants/tools/toolSchema.d.ts +113 -0
- package/dist/assistants/tools/toolSchema.js +87 -0
- package/dist/errors/PrismaErrorEnum.d.ts +1 -2
- package/dist/errors/PrismaErrorEnum.js +0 -1
- package/dist/errors/handleError.js +1 -5
- package/dist/identity/createAuthInterceptor.d.ts +15 -0
- package/dist/identity/createAuthInterceptor.js +79 -0
- package/dist/identity/decodeToken.d.ts +3 -0
- package/dist/identity/decodeToken.js +25 -0
- package/dist/identity/errors.d.ts +4 -0
- package/dist/identity/errors.js +35 -0
- package/dist/identity/getAccessKeyIdFromCall.d.ts +3 -0
- package/dist/identity/getAccessKeyIdFromCall.js +8 -0
- package/dist/identity/getPublicKey.d.ts +5 -0
- package/dist/identity/getPublicKey.js +77 -0
- package/dist/identity/getTokenFromCall.d.ts +3 -0
- package/dist/identity/getTokenFromCall.js +8 -0
- package/dist/identity/hasAccess.d.ts +3 -0
- package/dist/identity/hasAccess.js +9 -0
- package/dist/identity/index.d.ts +9 -0
- package/dist/identity/index.js +43 -0
- package/dist/identity/isValidToken.d.ts +2 -0
- package/dist/identity/isValidToken.js +51 -0
- package/dist/identity/roles.d.ts +5 -0
- package/dist/identity/roles.js +132 -0
- package/dist/identity/tokenHasAccessKeyId.d.ts +2 -0
- package/dist/identity/tokenHasAccessKeyId.js +28 -0
- package/dist/identity/types.d.ts +44 -0
- package/dist/identity/types.js +14 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/protos/applications.proto +6 -4
- package/dist/utils/createFetchSingleCallByCallId.d.ts +4 -0
- package/dist/utils/{makeFetchSingleCallByCallId.js → createFetchSingleCallByCallId.js} +9 -7
- package/dist/utils/findIntegrationsCredentials.d.ts +5 -0
- package/dist/utils/findIntegrationsCredentials.js +25 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +2 -1
- package/dist/validators/calls.d.ts +2 -2
- package/dist/validators/hostOrHostPortSchema.d.ts +1 -1
- package/dist/validators/hostOrHostPortSchema.js +1 -4
- package/dist/validators/identity.d.ts +2 -2
- package/package.json +3 -3
- package/dist/utils/makeFetchSingleCallByCallId.d.ts +0 -4
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonWebErrorEnum = exports.TokenUseEnum = void 0;
|
|
4
|
+
var TokenUseEnum;
|
|
5
|
+
(function (TokenUseEnum) {
|
|
6
|
+
TokenUseEnum["ID"] = "id";
|
|
7
|
+
TokenUseEnum["ACCESS"] = "access";
|
|
8
|
+
TokenUseEnum["REFRESH"] = "refresh";
|
|
9
|
+
})(TokenUseEnum || (exports.TokenUseEnum = TokenUseEnum = {}));
|
|
10
|
+
var JsonWebErrorEnum;
|
|
11
|
+
(function (JsonWebErrorEnum) {
|
|
12
|
+
JsonWebErrorEnum["JsonWebTokenError"] = "JsonWebTokenError";
|
|
13
|
+
JsonWebErrorEnum["TokenExpiredError"] = "TokenExpiredError";
|
|
14
|
+
})(JsonWebErrorEnum || (exports.JsonWebErrorEnum = JsonWebErrorEnum = {}));
|
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";
|
|
@@ -12,3 +13,4 @@ export * as Validators from "./validators";
|
|
|
12
13
|
export * from "./validators";
|
|
13
14
|
export * from "./voice";
|
|
14
15
|
export * from "./countryIsoCodes";
|
|
16
|
+
export * from "./identity";
|
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);
|
|
@@ -69,3 +70,4 @@ exports.Validators = __importStar(require("./validators"));
|
|
|
69
70
|
__exportStar(require("./validators"), exports);
|
|
70
71
|
__exportStar(require("./voice"), exports);
|
|
71
72
|
__exportStar(require("./countryIsoCodes"), exports);
|
|
73
|
+
__exportStar(require("./identity"), 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
|
-
//
|
|
69
|
-
ProductContainer
|
|
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
|
-
//
|
|
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
|
-
//
|
|
136
|
+
// Intelligence product
|
|
135
137
|
ProductContainer intelligence = 7;
|
|
136
138
|
}
|
|
137
139
|
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.createFetchSingleCallByCallId = createFetchSingleCallByCallId;
|
|
13
13
|
/*
|
|
14
14
|
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
15
15
|
* http://github.com/fonoster/fonoster
|
|
@@ -30,9 +30,10 @@ exports.makeFetchSingleCallByCallId = makeFetchSingleCallByCallId;
|
|
|
30
30
|
*/
|
|
31
31
|
const influxdb_client_1 = require("@influxdata/influxdb-client");
|
|
32
32
|
const constants_1 = require("../constants");
|
|
33
|
-
function
|
|
34
|
-
return
|
|
35
|
-
|
|
33
|
+
function createFetchSingleCallByCallId(influxdb) {
|
|
34
|
+
return function fetchSingleCallByCallId(callId) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const query = (0, influxdb_client_1.flux) `from(bucket: "${constants_1.INFLUXDB_CALLS_BUCKET}")
|
|
36
37
|
|> range(start: -365d)
|
|
37
38
|
|> pivot(rowKey: ["callId"], columnKey: ["_field"], valueColumn: "_value")
|
|
38
39
|
|> map(fn: (r) => ({
|
|
@@ -43,7 +44,8 @@ function makeFetchSingleCallByCallId(influxdb) {
|
|
|
43
44
|
|> filter(fn: (r) => r.callId == ${callId})
|
|
44
45
|
|> sort(columns: ["_time"], desc: true)
|
|
45
46
|
|> limit(n: 1)`;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const items = (yield influxdb.collectRows(query));
|
|
48
|
+
return items.length > 0 ? items[0] : null;
|
|
49
|
+
});
|
|
50
|
+
};
|
|
49
51
|
}
|
|
@@ -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
|
+
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -10,4 +10,5 @@ export * from "./withErrorHandling";
|
|
|
10
10
|
export * from "./withErrorHandlingAndValidation";
|
|
11
11
|
export * from "./withValidation";
|
|
12
12
|
export * from "./types";
|
|
13
|
-
export * from "./
|
|
13
|
+
export * from "./createFetchSingleCallByCallId";
|
|
14
|
+
export * from "./findIntegrationsCredentials";
|
package/dist/utils/index.js
CHANGED
|
@@ -44,4 +44,5 @@ __exportStar(require("./withErrorHandling"), exports);
|
|
|
44
44
|
__exportStar(require("./withErrorHandlingAndValidation"), exports);
|
|
45
45
|
__exportStar(require("./withValidation"), exports);
|
|
46
46
|
__exportStar(require("./types"), exports);
|
|
47
|
-
__exportStar(require("./
|
|
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;
|
|
@@ -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.
|
|
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.
|
|
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": "
|
|
49
|
+
"gitHead": "3c50badbc1b7043d1525603ad3386b9f70d53b28"
|
|
50
50
|
}
|