@fonoster/apiserver 0.8.26 → 0.8.28
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/applications/buildService.js +10 -10
- package/dist/applications/{createApplication.d.ts → createCreateApplication.d.ts} +2 -2
- package/dist/applications/{createApplication.js → createCreateApplication.js} +13 -5
- package/dist/applications/{getApplication.d.ts → createDeleteApplication.d.ts} +2 -2
- package/dist/applications/{deleteApplication.js → createDeleteApplication.js} +4 -4
- package/dist/applications/{updateApplication.d.ts → createGetApplication.d.ts} +2 -2
- package/dist/applications/{getApplication.js → createGetApplication.js} +4 -4
- package/dist/applications/createGetFnUtil.d.ts +3 -1
- package/dist/applications/{listApplications.d.ts → createListApplications.d.ts} +2 -2
- package/dist/applications/{listApplications.js → createListApplications.js} +4 -4
- package/dist/applications/{deleteApplication.d.ts → createUpdateApplication.d.ts} +2 -2
- package/dist/applications/{updateApplication.js → createUpdateApplication.js} +5 -5
- package/dist/applications/utils/applicationWithEncodedStruct.js +2 -0
- package/dist/applications/utils/convertToApplicationData.d.ts +2 -2
- package/dist/applications/validation/assistantWithoutApiKeySchema.d.ts +671 -0
- package/dist/applications/validation/assistantWithoutApiKeySchema.js +35 -0
- package/dist/applications/validation/createValidationSchema.d.ts +1107 -0
- package/dist/applications/validation/createValidationSchema.js +67 -0
- package/dist/applications/validation/speechValidators.d.ts +29 -0
- package/dist/applications/{utils/getApplicationValidationSchema.js → validation/speechValidators.js} +3 -28
- package/dist/applications/{utils → validation}/validOrThrow.js +3 -2
- package/dist/core/seed.js +11 -1
- package/dist/envs.d.ts +1 -0
- package/dist/envs.js +3 -2
- package/dist/utils/createCheckNumberPreconditions.js +2 -2
- package/dist/voice/VoiceClientImpl.js +13 -7
- package/dist/voice/integrations/createCreateContainer.js +1 -1
- package/dist/voice/integrations/getSttConfig.js +20 -2
- package/dist/voice/integrations/getTtsConfig.js +2 -2
- package/package.json +9 -9
- package/dist/applications/utils/getApplicationValidationSchema.d.ts +0 -64
- package/dist/voice/integrations/findIntegrationsCredentials.d.ts +0 -3
- package/dist/voice/integrations/findIntegrationsCredentials.js +0 -7
- /package/dist/applications/{utils → validation}/prepareForValidation.d.ts +0 -0
- /package/dist/applications/{utils → validation}/prepareForValidation.js +0 -0
- /package/dist/applications/{utils → validation}/validOrThrow.d.ts +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createValidationSchema = createValidationSchema;
|
|
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
|
+
const common_1 = require("@fonoster/common");
|
|
23
|
+
const client_1 = require("@prisma/client");
|
|
24
|
+
const zod_1 = require("zod");
|
|
25
|
+
const speechValidators_1 = require("./speechValidators");
|
|
26
|
+
const assistantWithoutApiKeySchema_1 = require("./assistantWithoutApiKeySchema");
|
|
27
|
+
const MAX_NAME_MESSAGE = "Name must contain at most 255 characters";
|
|
28
|
+
function createValidationSchema(request) {
|
|
29
|
+
const { applicationType, ttsEngineName, sttEngineName } = request;
|
|
30
|
+
return zod_1.z.object({
|
|
31
|
+
name: zod_1.z.string().max(255, MAX_NAME_MESSAGE),
|
|
32
|
+
type: zod_1.z.nativeEnum(client_1.ApplicationType, {
|
|
33
|
+
message: "Invalid application type"
|
|
34
|
+
}),
|
|
35
|
+
endpoint: common_1.hostOrHostPortSchema,
|
|
36
|
+
textToSpeech: ttsEngineName
|
|
37
|
+
? zod_1.z.object({
|
|
38
|
+
productRef: zod_1.z.string(),
|
|
39
|
+
config: speechValidators_1.speechValidators.ttsConfigValidators[ttsEngineName]()
|
|
40
|
+
})
|
|
41
|
+
: zod_1.z.undefined(),
|
|
42
|
+
speechToText: sttEngineName
|
|
43
|
+
? zod_1.z.object({
|
|
44
|
+
productRef: zod_1.z.string(),
|
|
45
|
+
config: speechValidators_1.speechValidators.sttConfigValidators[sttEngineName]()
|
|
46
|
+
})
|
|
47
|
+
: zod_1.z.undefined(),
|
|
48
|
+
intelligence: applicationType === client_1.ApplicationType.AUTOPILOT
|
|
49
|
+
? zod_1.z
|
|
50
|
+
.object({
|
|
51
|
+
productRef: zod_1.z.string(),
|
|
52
|
+
config: assistantWithoutApiKeySchema_1.assistantWithoutApiKeySchema
|
|
53
|
+
})
|
|
54
|
+
.superRefine((data, ctx) => {
|
|
55
|
+
const vendor = data.productRef.split(".")[1];
|
|
56
|
+
const languageModelProvider = data.config.languageModel.provider;
|
|
57
|
+
if (vendor !== languageModelProvider) {
|
|
58
|
+
ctx.addIssue({
|
|
59
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
60
|
+
message: `intelligence.productRef (${data.productRef}) must match languageModel.provider (${languageModelProvider}).`,
|
|
61
|
+
path: ["productRef"]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
: zod_1.z.undefined()
|
|
66
|
+
});
|
|
67
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Deepgram as DeepgramStt } from "../../voice/stt/Deepgram";
|
|
2
|
+
import { Google as GoogleStt } from "../../voice/stt/Google";
|
|
3
|
+
import { Azure as AzureTts } from "../../voice/tts/Azure";
|
|
4
|
+
import { Deepgram as DeepgramTts } from "../../voice/tts/Deepgram";
|
|
5
|
+
import { ElevenLabs as ElevenLabsTts } from "../../voice/tts/ElevenLabs";
|
|
6
|
+
import { Google as GoogleTts } from "../../voice/tts/Google";
|
|
7
|
+
declare const speechValidators: {
|
|
8
|
+
ttsConfigValidators: {
|
|
9
|
+
"tts.google": typeof GoogleTts.getConfigValidationSchema;
|
|
10
|
+
"tts.azure": typeof AzureTts.getConfigValidationSchema;
|
|
11
|
+
"tts.deepgram": typeof DeepgramTts.getConfigValidationSchema;
|
|
12
|
+
"tts.elevenlabs": typeof ElevenLabsTts.getConfigValidationSchema;
|
|
13
|
+
};
|
|
14
|
+
ttsCredentialsValidators: {
|
|
15
|
+
"tts.google": typeof GoogleTts.getCredentialsValidationSchema;
|
|
16
|
+
"tts.azure": typeof AzureTts.getCredentialsValidationSchema;
|
|
17
|
+
"tts.deepgram": typeof DeepgramTts.getCredentialsValidationSchema;
|
|
18
|
+
"tts.elevenlabs": typeof ElevenLabsTts.getCredentialsValidationSchema;
|
|
19
|
+
};
|
|
20
|
+
sttConfigValidators: {
|
|
21
|
+
"stt.google": typeof GoogleStt.getConfigValidationSchema;
|
|
22
|
+
"stt.deepgram": typeof DeepgramStt.getConfigValidationSchema;
|
|
23
|
+
};
|
|
24
|
+
sttCredentialsValidators: {
|
|
25
|
+
"stt.google": typeof GoogleStt.getCredentialsValidationSchema;
|
|
26
|
+
"stt.deepgram": typeof DeepgramStt.getCredentialsValidationSchema;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export { speechValidators };
|
package/dist/applications/{utils/getApplicationValidationSchema.js → validation/speechValidators.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.speechValidators = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/fonoster
|
|
@@ -19,17 +19,13 @@ exports.getApplicationValidationSchema = getApplicationValidationSchema;
|
|
|
19
19
|
* See the License for the specific language governing permissions and
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
|
-
const common_1 = require("@fonoster/common");
|
|
23
|
-
const client_1 = require("@prisma/client");
|
|
24
|
-
const zod_1 = require("zod");
|
|
25
22
|
const Deepgram_1 = require("../../voice/stt/Deepgram");
|
|
26
23
|
const Google_1 = require("../../voice/stt/Google");
|
|
27
24
|
const Azure_1 = require("../../voice/tts/Azure");
|
|
28
25
|
const Deepgram_2 = require("../../voice/tts/Deepgram");
|
|
29
26
|
const ElevenLabs_1 = require("../../voice/tts/ElevenLabs");
|
|
30
27
|
const Google_2 = require("../../voice/tts/Google");
|
|
31
|
-
const
|
|
32
|
-
const validators = {
|
|
28
|
+
const speechValidators = {
|
|
33
29
|
ttsConfigValidators: {
|
|
34
30
|
"tts.google": Google_2.Google.getConfigValidationSchema,
|
|
35
31
|
"tts.azure": Azure_1.Azure.getConfigValidationSchema,
|
|
@@ -51,25 +47,4 @@ const validators = {
|
|
|
51
47
|
"stt.deepgram": Deepgram_1.Deepgram.getCredentialsValidationSchema
|
|
52
48
|
}
|
|
53
49
|
};
|
|
54
|
-
|
|
55
|
-
const { ttsEngineName, sttEngineName } = request;
|
|
56
|
-
return zod_1.z.object({
|
|
57
|
-
name: zod_1.z.string().max(255, MAX_NAME_MESSAGE),
|
|
58
|
-
type: zod_1.z.nativeEnum(client_1.ApplicationType, {
|
|
59
|
-
message: "Invalid application type."
|
|
60
|
-
}),
|
|
61
|
-
endpoint: common_1.hostOrHostPortSchema,
|
|
62
|
-
textToSpeech: ttsEngineName
|
|
63
|
-
? zod_1.z.object({
|
|
64
|
-
productRef: zod_1.z.string(),
|
|
65
|
-
config: validators.ttsConfigValidators[ttsEngineName]()
|
|
66
|
-
})
|
|
67
|
-
: zod_1.z.undefined(),
|
|
68
|
-
speechToText: sttEngineName
|
|
69
|
-
? zod_1.z.object({
|
|
70
|
-
productRef: zod_1.z.string(),
|
|
71
|
-
config: validators.sttConfigValidators[sttEngineName]()
|
|
72
|
-
})
|
|
73
|
-
: zod_1.z.undefined()
|
|
74
|
-
});
|
|
75
|
-
}
|
|
50
|
+
exports.speechValidators = speechValidators;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validOrThrow = validOrThrow;
|
|
4
|
-
const
|
|
4
|
+
const createValidationSchema_1 = require("./createValidationSchema");
|
|
5
5
|
const prepareForValidation_1 = require("./prepareForValidation");
|
|
6
6
|
function validOrThrow(request) {
|
|
7
7
|
var _a, _b;
|
|
8
8
|
const data = (0, prepareForValidation_1.prepareForValidation)(request);
|
|
9
|
-
const schema = (0,
|
|
9
|
+
const schema = (0, createValidationSchema_1.createValidationSchema)({
|
|
10
|
+
applicationType: request.type,
|
|
10
11
|
ttsEngineName: (_a = request.textToSpeech) === null || _a === void 0 ? void 0 : _a.productRef,
|
|
11
12
|
sttEngineName: (_b = request.speechToText) === null || _b === void 0 ? void 0 : _b.productRef
|
|
12
13
|
});
|
package/dist/core/seed.js
CHANGED
|
@@ -90,7 +90,17 @@ function main() {
|
|
|
90
90
|
ref: "llm.openai",
|
|
91
91
|
name: "OpenAI Language Model",
|
|
92
92
|
vendor: "OPENAI",
|
|
93
|
-
type: "
|
|
93
|
+
type: "LLM"
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
yield prisma.product.upsert({
|
|
97
|
+
where: { ref: "llm.groq" },
|
|
98
|
+
update: {},
|
|
99
|
+
create: {
|
|
100
|
+
ref: "llm.groq",
|
|
101
|
+
name: "Groq Language Model",
|
|
102
|
+
vendor: "GROQ",
|
|
103
|
+
type: "LLM"
|
|
94
104
|
}
|
|
95
105
|
});
|
|
96
106
|
yield prisma.product.upsert({
|
package/dist/envs.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const APISERVER_BIND_ADDR: string;
|
|
2
2
|
export declare const APISERVER_HOST: string;
|
|
3
|
+
export declare const APISERVER_AUTOPILOT_ENDPOINT: string;
|
|
3
4
|
export declare const APP_URL: string;
|
|
4
5
|
export declare const ASTERISK_ARI_PROXY_URL: string;
|
|
5
6
|
export declare const ASTERISK_ARI_SECRET: string;
|
package/dist/envs.js
CHANGED
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
exports.TWILIO_PHONE_NUMBER = exports.TWILIO_AUTH_TOKEN = exports.TWILIO_ACCOUNT_SID = exports.TEMPLATES_DIR = void 0;
|
|
7
|
+
exports.SMTP_SECURE = exports.SMTP_PORT = exports.SMTP_HOST = exports.SMTP_AUTH_USER = exports.SMTP_AUTH_PASS = exports.ROUTR_DEFAULT_PEER_USERNAME = exports.ROUTR_DEFAULT_PEER_PASSWORD = exports.ROUTR_DEFAULT_PEER_NAME = exports.ROUTR_DEFAULT_PEER_AOR = exports.ROUTR_API_ENDPOINT = exports.OWNER_PASSWORD = exports.OWNER_NAME = exports.OWNER_EMAIL = exports.NATS_URL = exports.INTEGRATIONS_FILE = exports.INFLUXDB_USERNAME = exports.INFLUXDB_URL = exports.INFLUXDB_TOKEN = exports.INFLUXDB_PASSWORD = exports.INFLUXDB_ORG = exports.AUTHZ_SERVICE_METHODS = exports.AUTHZ_SERVICE_PORT = exports.AUTHZ_SERVICE_HOST = exports.AUTHZ_SERVICE_ENABLED = exports.IDENTITY_WORKSPACE_INVITATION_FAIL_URL = exports.IDENTITY_REFRESH_TOKEN_EXPIRES_IN = exports.IDENTITY_PUBLIC_KEY = exports.IDENTITY_PRIVATE_KEY = exports.IDENTITY_OAUTH2_GITHUB_CLIENT_SECRET = exports.IDENTITY_OAUTH2_GITHUB_CLIENT_ID = exports.IDENTITY_OAUTH2_GITHUB_ENABLED = exports.IDENTITY_USER_VERIFICATION_REQUIRED = exports.IDENTITY_ISSUER = exports.IDENTITY_ID_TOKEN_EXPIRES_IN = exports.IDENTITY_AUDIENCE = exports.IDENTITY_ACCESS_TOKEN_EXPIRES_IN = exports.HTTP_BRIDGE_PORT = exports.DEFAULT_NATS_QUEUE_GROUP = exports.CLOAK_ENCRYPTION_KEY = exports.CALLS_TRACK_CALL_SUBJECT = exports.CALLS_CREATE_SUBJECT = exports.ASTERISK_TRUNK = exports.ASTERISK_SYSTEM_DOMAIN = exports.ASTERISK_ARI_USERNAME = exports.ASTERISK_ARI_SECRET = exports.ASTERISK_ARI_PROXY_URL = exports.APP_URL = exports.APISERVER_AUTOPILOT_ENDPOINT = exports.APISERVER_HOST = exports.APISERVER_BIND_ADDR = void 0;
|
|
8
|
+
exports.TWILIO_PHONE_NUMBER = exports.TWILIO_AUTH_TOKEN = exports.TWILIO_ACCOUNT_SID = exports.TEMPLATES_DIR = exports.SMTP_SENDER = void 0;
|
|
9
9
|
/*
|
|
10
10
|
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
11
11
|
* http://github.com/fonoster/fonoster
|
|
@@ -56,6 +56,7 @@ const IDENTITY_PRIVATE_KEY_PATH = e.IDENTITY_PRIVATE_KEY_PATH || "/opt/fonoster/
|
|
|
56
56
|
const IDENTITY_PUBLIC_KEY_PATH = e.IDENTITY_PUBLIC_KEY_PATH || "/opt/fonoster/keys/public.pem";
|
|
57
57
|
exports.APISERVER_BIND_ADDR = e.APISERVER_BIND_ADDR || "0.0.0.0:50051";
|
|
58
58
|
exports.APISERVER_HOST = e.APISERVER_HOST || "apiserver";
|
|
59
|
+
exports.APISERVER_AUTOPILOT_ENDPOINT = e.APISERVER_AUTOPILOT_ENDPOINT || "autopilot:50061";
|
|
59
60
|
// Frontend configurations
|
|
60
61
|
exports.APP_URL = e.APP_URL;
|
|
61
62
|
exports.ASTERISK_ARI_PROXY_URL = e.ASTERISK_ARI_PROXY_URL;
|
|
@@ -33,15 +33,15 @@ const grpc_js_1 = require("@grpc/grpc-js");
|
|
|
33
33
|
function createCheckNumberPreconditions(prisma) {
|
|
34
34
|
return function checkNumberPreconditions(_a) {
|
|
35
35
|
return __awaiter(this, arguments, void 0, function* ({ appRef, accessKeyId }) {
|
|
36
|
+
// You can have a Number without an Application but it must exist
|
|
36
37
|
if (!appRef) {
|
|
37
|
-
// Not needed to check for the precondition
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
const app = yield prisma.application.findUnique({
|
|
41
41
|
where: { ref: appRef, accessKeyId }
|
|
42
42
|
});
|
|
43
43
|
if (!app) {
|
|
44
|
-
throw new common_1.GrpcError(grpc_js_1.status.
|
|
44
|
+
throw new common_1.GrpcError(grpc_js_1.status.INVALID_ARGUMENT, "Application not found for ref: " + appRef);
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
};
|
|
@@ -88,20 +88,26 @@ class VoiceClientImpl {
|
|
|
88
88
|
}
|
|
89
89
|
connect() {
|
|
90
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
// TODO: We should improve the error handling here. As it is now,
|
|
92
|
-
// it always returns true or throws an error we should return a boolean and throw an error only if the
|
|
93
|
-
// connection is not possible or other critical error
|
|
94
91
|
if (envs_1.AUTHZ_SERVICE_ENABLED) {
|
|
92
|
+
const { sessionRef: channelId } = this.config;
|
|
93
|
+
const { ari } = this;
|
|
95
94
|
try {
|
|
96
95
|
const authz = new authz_1.AuthzClient(`${envs_1.AUTHZ_SERVICE_HOST}:${envs_1.AUTHZ_SERVICE_PORT}`);
|
|
97
|
-
yield authz.checkSessionAuthorized({
|
|
96
|
+
const authorized = yield authz.checkSessionAuthorized({
|
|
98
97
|
accessKeyId: this.config.accessKeyId
|
|
99
98
|
});
|
|
99
|
+
if (!authorized) {
|
|
100
|
+
logger.verbose("rejected unauthorized session", { channelId });
|
|
101
|
+
yield ari.channels.answer({ channelId });
|
|
102
|
+
yield ari.channels.play({ channelId, media: "sound:unavailable" });
|
|
103
|
+
yield new Promise((resolve) => setTimeout(resolve, 2000));
|
|
104
|
+
yield ari.channels.hangup({ channelId });
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
100
107
|
}
|
|
101
108
|
catch (e) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
logger.verbose("rejected unauthorized session", { channelId });
|
|
109
|
+
logger.error("authz service error", e);
|
|
110
|
+
// TODO: Play a different sound
|
|
105
111
|
yield ari.channels.answer({ channelId });
|
|
106
112
|
yield ari.channels.play({ channelId, media: "sound:unavailable" });
|
|
107
113
|
yield new Promise((resolve) => setTimeout(resolve, 2000));
|
|
@@ -44,7 +44,7 @@ const logger = (0, logger_1.getLogger)({ service: "apiserver", filePath: __filen
|
|
|
44
44
|
const integrationsConfigSchema = zod_1.z.array(zod_1.z.object({
|
|
45
45
|
name: zod_1.z.string(),
|
|
46
46
|
productRef: zod_1.z.string(),
|
|
47
|
-
type: zod_1.z.enum(["tts", "stt"]),
|
|
47
|
+
type: zod_1.z.enum(["tts", "stt", "llm"]),
|
|
48
48
|
credentials: zod_1.z.record(zod_1.z.unknown())
|
|
49
49
|
}));
|
|
50
50
|
function createCreateContainer(prisma, pathToIntegrations) {
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSttConfig = getSttConfig;
|
|
4
|
-
|
|
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
|
+
const common_1 = require("@fonoster/common");
|
|
5
23
|
function getSttConfig(integrations, app) {
|
|
6
24
|
const config = app.speechToText.config;
|
|
7
|
-
const credentials = (0,
|
|
25
|
+
const credentials = (0, common_1.findIntegrationsCredentials)(integrations, app.speechToText.productRef);
|
|
8
26
|
return {
|
|
9
27
|
config,
|
|
10
28
|
credentials
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTtsConfig = getTtsConfig;
|
|
4
|
-
const
|
|
4
|
+
const common_1 = require("@fonoster/common");
|
|
5
5
|
function getTtsConfig(integrations, app) {
|
|
6
6
|
const config = app.textToSpeech.config;
|
|
7
|
-
const credentials = (0,
|
|
7
|
+
const credentials = (0, common_1.findIntegrationsCredentials)(integrations, app.textToSpeech.productRef);
|
|
8
8
|
return {
|
|
9
9
|
config,
|
|
10
10
|
credentials
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/apiserver",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.28",
|
|
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.
|
|
25
|
-
"@fonoster/common": "^0.8.
|
|
26
|
-
"@fonoster/identity": "^0.8.
|
|
27
|
-
"@fonoster/logger": "^0.8.
|
|
28
|
-
"@fonoster/sipnet": "^0.8.
|
|
29
|
-
"@fonoster/streams": "^0.8.
|
|
30
|
-
"@fonoster/types": "^0.8.
|
|
24
|
+
"@fonoster/authz": "^0.8.28",
|
|
25
|
+
"@fonoster/common": "^0.8.28",
|
|
26
|
+
"@fonoster/identity": "^0.8.28",
|
|
27
|
+
"@fonoster/logger": "^0.8.28",
|
|
28
|
+
"@fonoster/sipnet": "^0.8.28",
|
|
29
|
+
"@fonoster/streams": "^0.8.28",
|
|
30
|
+
"@fonoster/types": "^0.8.28",
|
|
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": "
|
|
76
|
+
"gitHead": "d4faaf735419bf453503c2081e5aab34a0eae6b7"
|
|
77
77
|
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
declare function getApplicationValidationSchema(request: {
|
|
3
|
-
ttsEngineName: string;
|
|
4
|
-
sttEngineName: string;
|
|
5
|
-
}): z.ZodObject<{
|
|
6
|
-
name: z.ZodString;
|
|
7
|
-
type: z.ZodNativeEnum<{
|
|
8
|
-
EXTERNAL: "EXTERNAL";
|
|
9
|
-
}>;
|
|
10
|
-
endpoint: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string>;
|
|
11
|
-
textToSpeech: z.ZodObject<{
|
|
12
|
-
productRef: z.ZodString;
|
|
13
|
-
config: any;
|
|
14
|
-
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
[x: string]: any;
|
|
16
|
-
productRef?: unknown;
|
|
17
|
-
config?: unknown;
|
|
18
|
-
}, {
|
|
19
|
-
[x: string]: any;
|
|
20
|
-
productRef?: unknown;
|
|
21
|
-
config?: unknown;
|
|
22
|
-
}> | z.ZodUndefined;
|
|
23
|
-
speechToText: z.ZodUndefined | z.ZodObject<{
|
|
24
|
-
productRef: z.ZodString;
|
|
25
|
-
config: any;
|
|
26
|
-
}, "strip", z.ZodTypeAny, {
|
|
27
|
-
[x: string]: any;
|
|
28
|
-
productRef?: unknown;
|
|
29
|
-
config?: unknown;
|
|
30
|
-
}, {
|
|
31
|
-
[x: string]: any;
|
|
32
|
-
productRef?: unknown;
|
|
33
|
-
config?: unknown;
|
|
34
|
-
}>;
|
|
35
|
-
}, "strip", z.ZodTypeAny, {
|
|
36
|
-
textToSpeech?: {
|
|
37
|
-
[x: string]: any;
|
|
38
|
-
productRef?: unknown;
|
|
39
|
-
config?: unknown;
|
|
40
|
-
};
|
|
41
|
-
speechToText?: {
|
|
42
|
-
[x: string]: any;
|
|
43
|
-
productRef?: unknown;
|
|
44
|
-
config?: unknown;
|
|
45
|
-
};
|
|
46
|
-
name?: string;
|
|
47
|
-
type?: "EXTERNAL";
|
|
48
|
-
endpoint?: string;
|
|
49
|
-
}, {
|
|
50
|
-
textToSpeech?: {
|
|
51
|
-
[x: string]: any;
|
|
52
|
-
productRef?: unknown;
|
|
53
|
-
config?: unknown;
|
|
54
|
-
};
|
|
55
|
-
speechToText?: {
|
|
56
|
-
[x: string]: any;
|
|
57
|
-
productRef?: unknown;
|
|
58
|
-
config?: unknown;
|
|
59
|
-
};
|
|
60
|
-
name?: string;
|
|
61
|
-
type?: "EXTERNAL";
|
|
62
|
-
endpoint?: string;
|
|
63
|
-
}>;
|
|
64
|
-
export { getApplicationValidationSchema };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findIntegrationsCredentials = findIntegrationsCredentials;
|
|
4
|
-
function findIntegrationsCredentials(integrations, engine) {
|
|
5
|
-
var _a;
|
|
6
|
-
return (_a = integrations.find((i) => i.productRef === engine)) === null || _a === void 0 ? void 0 : _a.credentials;
|
|
7
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|