Metamigo API build fixes
This commit is contained in:
parent
101fea0bf4
commit
608c26c763
6 changed files with 1188 additions and 211 deletions
|
|
@ -7,11 +7,11 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@adiwajshing/baileys": "5.0.0",
|
"@adiwajshing/baileys": "5.0.0",
|
||||||
"@adiwajshing/keyed-db": "0.2.4",
|
"@adiwajshing/keyed-db": "0.2.4",
|
||||||
|
"@digiresilience/hapi-nextauth": "*",
|
||||||
|
"@digiresilience/hapi-pg-promise": "*",
|
||||||
"@digiresilience/metamigo-common": "*",
|
"@digiresilience/metamigo-common": "*",
|
||||||
"@digiresilience/metamigo-config": "*",
|
"@digiresilience/metamigo-config": "*",
|
||||||
"@digiresilience/metamigo-db": "*",
|
"@digiresilience/metamigo-db": "*",
|
||||||
"@digiresilience/hapi-nextauth": "*",
|
|
||||||
"@digiresilience/hapi-pg-promise": "*",
|
|
||||||
"@digiresilience/montar": "*",
|
"@digiresilience/montar": "*",
|
||||||
"@digiresilience/node-signald": "*",
|
"@digiresilience/node-signald": "*",
|
||||||
"@graphile-contrib/pg-simplify-inflector": "^6.1.0",
|
"@graphile-contrib/pg-simplify-inflector": "^6.1.0",
|
||||||
|
|
@ -22,38 +22,40 @@
|
||||||
"@hapipal/toys": "^4.0.0",
|
"@hapipal/toys": "^4.0.0",
|
||||||
"blipp": "^4.0.2",
|
"blipp": "^4.0.2",
|
||||||
"camelcase-keys": "^8.0.2",
|
"camelcase-keys": "^8.0.2",
|
||||||
|
"expiry-map": "^2.0.0",
|
||||||
"fluent-ffmpeg": "^2.1.2",
|
"fluent-ffmpeg": "^2.1.2",
|
||||||
"graphile-migrate": "^1.4.1",
|
"graphile-migrate": "^1.4.1",
|
||||||
"graphile-worker": "^0.13.0",
|
"graphile-worker": "^0.13.0",
|
||||||
"hapi-auth-jwt2": "^10.4.0",
|
"hapi-auth-jwt2": "^10.4.0",
|
||||||
"hapi-postgraphile": "^0.11.0",
|
"hapi-postgraphile": "^0.11.0",
|
||||||
"hapi-swagger": "^15.0.0",
|
"hapi-swagger": "^16.0.1",
|
||||||
"joi": "^17.7.0",
|
"joi": "^17.9.2",
|
||||||
"jsonwebtoken": "^9.0.0",
|
"jsonwebtoken": "^9.0.0",
|
||||||
"jwks-rsa": "^3.0.1",
|
"jwks-rsa": "^3.0.1",
|
||||||
"long": "^5.2.1",
|
"long": "^5.2.3",
|
||||||
"p-memoize": "^7.1.1",
|
"p-memoize": "^7.1.1",
|
||||||
|
"pg": "^7.18.2",
|
||||||
"pg-monitor": "^2.0.0",
|
"pg-monitor": "^2.0.0",
|
||||||
"pg-promise": "^11.0.2",
|
"pg-promise": "^11.4.3",
|
||||||
"postgraphile-plugin-connection-filter": "^2.3.0",
|
"postgraphile-plugin-connection-filter": "^2.3.0",
|
||||||
"remeda": "^1.6.0",
|
"remeda": "^1.18.1",
|
||||||
"twilio": "^3.84.1",
|
"twilio": "^4.11.1",
|
||||||
"expiry-map": "^2.0.0"
|
"typeorm": "^0.3.16"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"pino-pretty": "^9.1.1",
|
|
||||||
"ts-node": "^10.9.1",
|
|
||||||
"typescript": "^4.9.5",
|
|
||||||
"@types/long": "^4.0.2",
|
"@types/long": "^4.0.2",
|
||||||
"nodemon": "^2.0.20",
|
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
|
"babel-preset-link": "*",
|
||||||
"camelcase-keys": "^8.0.2",
|
"camelcase-keys": "^8.0.2",
|
||||||
"pg-monitor": "^2.0.0",
|
|
||||||
"typedoc": "^0.23.24",
|
|
||||||
"tsconfig-link": "*",
|
|
||||||
"eslint-config-link": "*",
|
"eslint-config-link": "*",
|
||||||
"jest-config-link": "*",
|
"jest-config-link": "*",
|
||||||
"babel-preset-link": "*"
|
"nodemon": "^2.0.22",
|
||||||
|
"pg-monitor": "^2.0.0",
|
||||||
|
"pino-pretty": "^10.0.0",
|
||||||
|
"ts-node": "^10.9.1",
|
||||||
|
"tsconfig-link": "*",
|
||||||
|
"typedoc": "^0.24.7",
|
||||||
|
"typescript": "^5.0.4"
|
||||||
},
|
},
|
||||||
"nodemonConfig": {
|
"nodemonConfig": {
|
||||||
"ignore": [
|
"ignore": [
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import * as Hapi from "@hapi/hapi";
|
import * as Hapi from "@hapi/hapi";
|
||||||
import * as Joi from "joi";
|
import * as Joi from "joi";
|
||||||
import * as Helpers from "../helpers";
|
import * as Helpers from "../helpers";
|
||||||
import Boom from "boom";
|
import Boom from "@hapi/boom";
|
||||||
|
|
||||||
const getSignalService = (request) => request.services("app").signaldService;
|
const getSignalService = (request) => request.services("app").signaldService;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const TwilioHandlers = {
|
||||||
R.filter((n) => n.capabilities.voice),
|
R.filter((n) => n.capabilities.voice),
|
||||||
R.map(R.pick(["sid", "phoneNumber"]))
|
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 voiceLineRepo = request.db().voiceLines;
|
||||||
const voiceLines: SavedVoiceLine[] =
|
const voiceLines: SavedVoiceLine[] =
|
||||||
await voiceLineRepo.findAllByProviderLineSids(numberSids);
|
await voiceLineRepo.findAllByProviderLineSids(numberSids);
|
||||||
|
|
@ -29,7 +29,7 @@ const TwilioHandlers = {
|
||||||
|
|
||||||
return R.pipe(
|
return R.pipe(
|
||||||
numbers,
|
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 }))
|
R.map((n) => ({ id: n.sid, name: n.phoneNumber }))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import ExpiryMap from "expiry-map";
|
||||||
import ms from "ms";
|
import ms from "ms";
|
||||||
import * as Helpers from "../../helpers";
|
import * as Helpers from "../../helpers";
|
||||||
import workerUtils from "../../../../worker-utils";
|
import workerUtils from "../../../../worker-utils";
|
||||||
import { SayLanguage, SayVoice } from "twilio/lib/twiml/VoiceResponse";
|
|
||||||
|
|
||||||
const queueRecording = async (meta) =>
|
const queueRecording = async (meta) =>
|
||||||
workerUtils.addJob("twilio-recording", meta, { jobKey: meta.callSid });
|
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) {
|
async handler(request: Hapi.Request, _h: Hapi.ResponseToolkit) {
|
||||||
const { voiceLineId } = request.params;
|
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 });
|
const voiceLine = await request.db().voiceLines.findBy({ number: To });
|
||||||
if (!voiceLine) return Boom.notFound();
|
if (!voiceLine) return Boom.notFound();
|
||||||
if (voiceLine.id !== voiceLineId) return Boom.badRequest();
|
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.";
|
"The grabadora text prompt is unconfigured. Please set a prompt in the administration screen.";
|
||||||
twiml.say(
|
twiml.say(
|
||||||
{
|
{
|
||||||
language: voiceLine.language as SayLanguage,
|
language: voiceLine.language as any,
|
||||||
voice: voiceLine.voice as SayVoice,
|
voice: voiceLine.voice as any,
|
||||||
},
|
},
|
||||||
prompt
|
prompt
|
||||||
);
|
);
|
||||||
|
|
@ -172,8 +171,8 @@ export const TwilioRoutes = Helpers.noAuth([
|
||||||
},
|
},
|
||||||
async handler(request: Hapi.Request, _h: Hapi.ResponseToolkit) {
|
async handler(request: Hapi.Request, _h: Hapi.ResponseToolkit) {
|
||||||
const { language, voice, prompt } = request.payload as {
|
const { language, voice, prompt } = request.payload as {
|
||||||
language: SayLanguage;
|
language: any;
|
||||||
voice: SayVoice;
|
voice: any;
|
||||||
prompt: string;
|
prompt: string;
|
||||||
};
|
};
|
||||||
const twiml = new Twilio.twiml.VoiceResponse();
|
const twiml = new Twilio.twiml.VoiceResponse();
|
||||||
|
|
@ -194,7 +193,7 @@ export const TwilioRoutes = Helpers.noAuth([
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
async handler(request: Hapi.Request, h: Hapi.ResponseToolkit) {
|
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
|
const provider: SavedVoiceProvider = await request
|
||||||
.db()
|
.db()
|
||||||
.voiceProviders.findById({ id: providerId });
|
.voiceProviders.findById({ id: providerId });
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import * as Hapi from "@hapi/hapi";
|
import * as Hapi from "@hapi/hapi";
|
||||||
import * as Helpers from "../helpers";
|
import * as Helpers from "../helpers";
|
||||||
import Boom from "boom";
|
import Boom from "@hapi/boom";
|
||||||
|
|
||||||
export const GetAllWhatsappBotsRoute = Helpers.withDefaults({
|
export const GetAllWhatsappBotsRoute = Helpers.withDefaults({
|
||||||
method: "get",
|
method: "get",
|
||||||
|
|
|
||||||
1340
package-lock.json
generated
1340
package-lock.json
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue