Metamigo API build fixes
This commit is contained in:
parent
101fea0bf4
commit
608c26c763
6 changed files with 1188 additions and 211 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import * as Hapi from "@hapi/hapi";
|
||||
import * as Joi from "joi";
|
||||
import * as Helpers from "../helpers";
|
||||
import Boom from "boom";
|
||||
import Boom from "@hapi/boom";
|
||||
|
||||
const getSignalService = (request) => request.services("app").signaldService;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ const TwilioHandlers = {
|
|||
R.filter((n) => n.capabilities.voice),
|
||||
R.map(R.pick(["sid", "phoneNumber"]))
|
||||
);
|
||||
const numberSids = R.map(numbers, R.prop("sid"));
|
||||
const numberSids: any = R.map(numbers, R.prop("sid"));
|
||||
const voiceLineRepo = request.db().voiceLines;
|
||||
const voiceLines: SavedVoiceLine[] =
|
||||
await voiceLineRepo.findAllByProviderLineSids(numberSids);
|
||||
|
|
@ -29,7 +29,7 @@ const TwilioHandlers = {
|
|||
|
||||
return R.pipe(
|
||||
numbers,
|
||||
R.reject((n) => voiceLineSids.has(n.sid)),
|
||||
R.reject((n) => voiceLineSids.has(n.sid as any)),
|
||||
R.map((n) => ({ id: n.sid, name: n.phoneNumber }))
|
||||
);
|
||||
},
|
||||
|
|
@ -66,7 +66,7 @@ export const VoiceProviderRoutes = Helpers.withDefaults([
|
|||
},
|
||||
]);
|
||||
|
||||
class VoiceLineRecordController extends CrudControllerBase(VoiceLineRecord) {}
|
||||
class VoiceLineRecordController extends CrudControllerBase(VoiceLineRecord) { }
|
||||
|
||||
const validator = (): Record<string, Hapi.RouteOptionsValidate> => ({
|
||||
create: {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import ExpiryMap from "expiry-map";
|
|||
import ms from "ms";
|
||||
import * as Helpers from "../../helpers";
|
||||
import workerUtils from "../../../../worker-utils";
|
||||
import { SayLanguage, SayVoice } from "twilio/lib/twiml/VoiceResponse";
|
||||
|
||||
const queueRecording = async (meta) =>
|
||||
workerUtils.addJob("twilio-recording", meta, { jobKey: meta.callSid });
|
||||
|
|
@ -92,7 +91,7 @@ export const TwilioRoutes = Helpers.noAuth([
|
|||
},
|
||||
async handler(request: Hapi.Request, _h: Hapi.ResponseToolkit) {
|
||||
const { voiceLineId } = request.params;
|
||||
const { To } = request.payload as { To: string };
|
||||
const { To } = request.payload as { To: string; };
|
||||
const voiceLine = await request.db().voiceLines.findBy({ number: To });
|
||||
if (!voiceLine) return Boom.notFound();
|
||||
if (voiceLine.id !== voiceLineId) return Boom.badRequest();
|
||||
|
|
@ -108,8 +107,8 @@ export const TwilioRoutes = Helpers.noAuth([
|
|||
"The grabadora text prompt is unconfigured. Please set a prompt in the administration screen.";
|
||||
twiml.say(
|
||||
{
|
||||
language: voiceLine.language as SayLanguage,
|
||||
voice: voiceLine.voice as SayVoice,
|
||||
language: voiceLine.language as any,
|
||||
voice: voiceLine.voice as any,
|
||||
},
|
||||
prompt
|
||||
);
|
||||
|
|
@ -172,8 +171,8 @@ export const TwilioRoutes = Helpers.noAuth([
|
|||
},
|
||||
async handler(request: Hapi.Request, _h: Hapi.ResponseToolkit) {
|
||||
const { language, voice, prompt } = request.payload as {
|
||||
language: SayLanguage;
|
||||
voice: SayVoice;
|
||||
language: any;
|
||||
voice: any;
|
||||
prompt: string;
|
||||
};
|
||||
const twiml = new Twilio.twiml.VoiceResponse();
|
||||
|
|
@ -194,7 +193,7 @@ export const TwilioRoutes = Helpers.noAuth([
|
|||
},
|
||||
},
|
||||
async handler(request: Hapi.Request, h: Hapi.ResponseToolkit) {
|
||||
const { providerId } = request.params as { providerId: string };
|
||||
const { providerId } = request.params as { providerId: string; };
|
||||
const provider: SavedVoiceProvider = await request
|
||||
.db()
|
||||
.voiceProviders.findById({ id: providerId });
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as Hapi from "@hapi/hapi";
|
||||
import * as Helpers from "../helpers";
|
||||
import Boom from "boom";
|
||||
import Boom from "@hapi/boom";
|
||||
|
||||
export const GetAllWhatsappBotsRoute = Helpers.withDefaults({
|
||||
method: "get",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue