@absolutejs/voice 0.0.22-beta.672 → 0.0.22-beta.673
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/core/assistantHealth.d.ts +3 -40
- package/dist/core/auditDeliveryRoutes.d.ts +5 -40
- package/dist/core/auditRoutes.d.ts +3 -27
- package/dist/core/bargeInRoutes.d.ts +3 -27
- package/dist/core/browserCallProfiles.d.ts +3 -27
- package/dist/core/browserMediaRoutes.d.ts +3 -27
- package/dist/core/callDebugger.d.ts +3 -27
- package/dist/core/campaign.d.ts +166 -143
- package/dist/core/competitiveCoverage.d.ts +3 -40
- package/dist/core/dataControl.d.ts +3 -27
- package/dist/core/deliveryRuntime.d.ts +3 -40
- package/dist/core/deliverySinkRoutes.d.ts +3 -40
- package/dist/core/demoReadyRoutes.d.ts +3 -27
- package/dist/core/diagnosticsRoutes.d.ts +3 -27
- package/dist/core/evalRoutes.d.ts +3 -27
- package/dist/core/guardrails.d.ts +3 -27
- package/dist/core/handoffHealth.d.ts +5 -40
- package/dist/core/htmxDashboardRoutes.d.ts +309 -195
- package/dist/core/incidentBundle.d.ts +3 -27
- package/dist/core/incidentTimeline.d.ts +3 -40
- package/dist/core/liveLatency.d.ts +3 -40
- package/dist/core/liveOps.d.ts +154 -44
- package/dist/core/mediaPipelineRoutes.d.ts +3 -40
- package/dist/core/monitor.d.ts +5 -19
- package/dist/core/observabilityExport.d.ts +6 -54
- package/dist/core/operationalStatus.d.ts +3 -40
- package/dist/core/operationsRecord.d.ts +3 -27
- package/dist/core/opsActionAuditRoutes.d.ts +160 -51
- package/dist/core/opsConsoleRoutes.d.ts +3 -27
- package/dist/core/opsRecovery.d.ts +3 -40
- package/dist/core/opsStatusRoutes.d.ts +3 -27
- package/dist/core/opsWebhook.d.ts +158 -49
- package/dist/core/outcomeContract.d.ts +3 -40
- package/dist/core/phoneAgentProductionSmoke.d.ts +6 -40
- package/dist/core/platformCoverage.d.ts +3 -27
- package/dist/core/plugin.d.ts +12 -40
- package/dist/core/postCallAnalysis.d.ts +3 -27
- package/dist/core/productionReadiness.d.ts +3 -27
- package/dist/core/profileSwitchRecommendation.d.ts +299 -116
- package/dist/core/proofPack.d.ts +3 -27
- package/dist/core/proofTrends.d.ts +15 -135
- package/dist/core/providerCapabilities.d.ts +3 -40
- package/dist/core/providerDecisionTraces.d.ts +3 -40
- package/dist/core/providerHealth.d.ts +3 -40
- package/dist/core/providerOrchestration.d.ts +3 -40
- package/dist/core/providerSlo.d.ts +3 -27
- package/dist/core/providerStackRecommendations.d.ts +3 -27
- package/dist/core/qualityRoutes.d.ts +3 -27
- package/dist/core/realtimeChannel.d.ts +3 -40
- package/dist/core/realtimeProviderContracts.d.ts +3 -40
- package/dist/core/reconnectContract.d.ts +153 -79
- package/dist/core/resilienceRoutes.d.ts +3 -40
- package/dist/core/routeAuth.d.ts +3 -29
- package/dist/core/sessionObservability.d.ts +3 -27
- package/dist/core/sessionReplay.d.ts +10 -79
- package/dist/core/sessionSnapshot.d.ts +148 -39
- package/dist/core/simulationSuite.d.ts +3 -40
- package/dist/core/sloCalibration.d.ts +6 -54
- package/dist/core/telephonyMediaRoutes.d.ts +3 -27
- package/dist/core/telephonyOutcome.d.ts +148 -39
- package/dist/core/toolContract.d.ts +3 -40
- package/dist/core/traceDeliveryRoutes.d.ts +5 -40
- package/dist/core/traceTimeline.d.ts +3 -27
- package/dist/core/turnLatency.d.ts +3 -40
- package/dist/core/turnQuality.d.ts +3 -40
- package/dist/core/voiceMonitoring.d.ts +164 -115
- package/dist/index.js +58 -26
- package/dist/telephony/matrix.d.ts +148 -39
- package/dist/telephony/plivo.d.ts +10 -33
- package/dist/telephony/security.d.ts +3 -40
- package/dist/telephony/telnyx.d.ts +10 -33
- package/dist/testing/index.js +14 -10
- package/package.json +7 -81
package/dist/index.js
CHANGED
|
@@ -249,6 +249,7 @@ var resolveAudioConditioningConfig = (config) => {
|
|
|
249
249
|
|
|
250
250
|
// src/core/plugin.ts
|
|
251
251
|
import { Elysia as Elysia70 } from "elysia";
|
|
252
|
+
import { websocket as websocket5 } from "elysia/websocket";
|
|
252
253
|
import { resolve } from "path";
|
|
253
254
|
|
|
254
255
|
// src/internal/html.ts
|
|
@@ -21389,6 +21390,7 @@ var summarizeVoiceMediaPipelineReport = (report, options = {}) => {
|
|
|
21389
21390
|
|
|
21390
21391
|
// src/core/monitor.ts
|
|
21391
21392
|
import { Elysia as Elysia32 } from "elysia";
|
|
21393
|
+
import { websocket } from "elysia/websocket";
|
|
21392
21394
|
var buildAudioFanout = () => {
|
|
21393
21395
|
const handlers = new Set;
|
|
21394
21396
|
return {
|
|
@@ -21677,7 +21679,7 @@ var createVoiceLiveMonitorRoutes = (options) => {
|
|
|
21677
21679
|
transfer: options.controlHandlers?.transfer ?? buildDefaultControlHandler("transfer"),
|
|
21678
21680
|
voicemail: options.controlHandlers?.voicemail ?? buildDefaultControlHandler("voicemail")
|
|
21679
21681
|
};
|
|
21680
|
-
const app = new Elysia32({ name: "absolutejs-voice-monitor" });
|
|
21682
|
+
const app = new Elysia32({ name: "absolutejs-voice-monitor" }).use(websocket());
|
|
21681
21683
|
const unsubscribers = new WeakMap;
|
|
21682
21684
|
if (listenPath !== false && listenPath.length > 0) {
|
|
21683
21685
|
app.ws(`/${listenPath.replace(/^\/+/, "")}`, {
|
|
@@ -24888,7 +24890,9 @@ var createVoiceTelephonyWebhookRoutes = (options = {}) => {
|
|
|
24888
24890
|
const handler = createVoiceTelephonyWebhookHandler(options);
|
|
24889
24891
|
return new Elysia36({
|
|
24890
24892
|
name: options.name ?? "absolutejs-voice-telephony-webhooks"
|
|
24891
|
-
}).post(path,
|
|
24893
|
+
}).post(path, {
|
|
24894
|
+
parse: "none"
|
|
24895
|
+
}, async ({ query, request }) => {
|
|
24892
24896
|
try {
|
|
24893
24897
|
return await handler({ query, request });
|
|
24894
24898
|
} catch (error) {
|
|
@@ -24902,8 +24906,6 @@ var createVoiceTelephonyWebhookRoutes = (options = {}) => {
|
|
|
24902
24906
|
}
|
|
24903
24907
|
throw error;
|
|
24904
24908
|
}
|
|
24905
|
-
}, {
|
|
24906
|
-
parse: "none"
|
|
24907
24909
|
});
|
|
24908
24910
|
};
|
|
24909
24911
|
|
|
@@ -25443,10 +25445,12 @@ var createVoiceSQLiteTraceSinkDeliveryStore = (options) => createSQLiteTraceSink
|
|
|
25443
25445
|
import { Buffer as Buffer4 } from "buffer";
|
|
25444
25446
|
import { Database as Database3 } from "bun:sqlite";
|
|
25445
25447
|
import { Elysia as Elysia38 } from "elysia";
|
|
25448
|
+
import { websocket as websocket3 } from "elysia/websocket";
|
|
25446
25449
|
|
|
25447
25450
|
// src/telephony/twilio.ts
|
|
25448
25451
|
import { Buffer as Buffer3 } from "buffer";
|
|
25449
25452
|
import { Elysia as Elysia37 } from "elysia";
|
|
25453
|
+
import { websocket as websocket2 } from "elysia/websocket";
|
|
25450
25454
|
var TWILIO_MULAW_SAMPLE_RATE = 8000;
|
|
25451
25455
|
var VOICE_PCM_SAMPLE_RATE = 16000;
|
|
25452
25456
|
var escapeXml2 = (value) => value.replaceAll("&", "&").replaceAll('"', """).replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">");
|
|
@@ -25481,10 +25485,12 @@ var resolveTrustedTwilioRequestUrl = (security, request) => {
|
|
|
25481
25485
|
return `${resolveTwilioPublicOrigin(security)}${requestUrl.pathname}${requestUrl.search}`;
|
|
25482
25486
|
};
|
|
25483
25487
|
var resolveTwilioSocketHeaders = (socket) => {
|
|
25484
|
-
|
|
25485
|
-
|
|
25486
|
-
|
|
25487
|
-
|
|
25488
|
+
const data = socket.data && typeof socket.data === "object" ? socket.data : {
|
|
25489
|
+
headers: socket.headers,
|
|
25490
|
+
request: socket.request && typeof socket.request === "object" ? socket.request : undefined
|
|
25491
|
+
};
|
|
25492
|
+
const candidates = [data.request?.headers, data.headers];
|
|
25493
|
+
for (const candidate of candidates) {
|
|
25488
25494
|
if (!candidate)
|
|
25489
25495
|
continue;
|
|
25490
25496
|
if (typeof candidate === "object" && "get" in candidate && typeof candidate.get === "function") {
|
|
@@ -25496,6 +25502,7 @@ var resolveTwilioSocketHeaders = (socket) => {
|
|
|
25496
25502
|
}
|
|
25497
25503
|
return new Headers;
|
|
25498
25504
|
};
|
|
25505
|
+
var socketKey = (socket) => ("raw" in socket) && socket.raw && typeof socket.raw === "object" ? socket.raw : socket;
|
|
25499
25506
|
var readTwilioVoiceForm = async (request) => {
|
|
25500
25507
|
const declaredLength = Number(request.headers.get("content-length"));
|
|
25501
25508
|
if (Number.isFinite(declaredLength) && declaredLength > MAX_TWILIO_VOICE_BODY_BYTES) {
|
|
@@ -26263,9 +26270,9 @@ var createTwilioVoiceRoutes = (options) => {
|
|
|
26263
26270
|
const streamVerificationUrl = options.security.streamVerificationUrl ?? `${resolveTwilioPublicOrigin(options.security).replace(/^https:/, "wss:")}${streamPath}`;
|
|
26264
26271
|
const app = new Elysia37({
|
|
26265
26272
|
name: options.name ?? "absolutejs-voice-twilio"
|
|
26266
|
-
}).get(twimlPath, renderTwiml).post(twimlPath,
|
|
26273
|
+
}).use(websocket2()).get(twimlPath, renderTwiml).post(twimlPath, { parse: "none" }, renderTwiml).ws(streamPath, {
|
|
26267
26274
|
close: async (ws, _code, reason) => {
|
|
26268
|
-
const key = ws
|
|
26275
|
+
const key = socketKey(ws);
|
|
26269
26276
|
const bridge = bridges.get(key);
|
|
26270
26277
|
bridges.delete(key);
|
|
26271
26278
|
admittedSockets.delete(key);
|
|
@@ -26273,7 +26280,7 @@ var createTwilioVoiceRoutes = (options) => {
|
|
|
26273
26280
|
await bridge?.close(reason);
|
|
26274
26281
|
},
|
|
26275
26282
|
message: async (ws, raw) => {
|
|
26276
|
-
const key = ws
|
|
26283
|
+
const key = socketKey(ws);
|
|
26277
26284
|
if (!admittedSockets.has(key)) {
|
|
26278
26285
|
const verification = await verifyVoiceTwilioWebhookSignature({
|
|
26279
26286
|
authToken: options.security.authToken,
|
|
@@ -26880,6 +26887,7 @@ var createPlivoVoiceRoutes = (options = {}) => {
|
|
|
26880
26887
|
const setupPath = options.setup?.path === false ? false : options.setup?.path ?? "/api/voice/plivo/setup";
|
|
26881
26888
|
const smokePath = options.smoke?.path === false ? false : options.smoke?.path ?? "/api/voice/plivo/smoke";
|
|
26882
26889
|
const bridges = new WeakMap;
|
|
26890
|
+
const socketKey2 = (socket) => ("raw" in socket) && socket.raw && typeof socket.raw === "object" ? socket.raw : socket;
|
|
26883
26891
|
const webhookPolicy = options.webhook?.policy ?? options.outcomePolicy ?? createVoiceTelephonyOutcomePolicy();
|
|
26884
26892
|
const verify = options.webhook?.verify ?? (options.webhook?.authToken ? createVoicePlivoWebhookVerifier({
|
|
26885
26893
|
authToken: options.webhook.authToken,
|
|
@@ -26888,7 +26896,7 @@ var createPlivoVoiceRoutes = (options = {}) => {
|
|
|
26888
26896
|
}) : undefined);
|
|
26889
26897
|
const app = new Elysia38({
|
|
26890
26898
|
name: options.name ?? "absolutejs-voice-plivo"
|
|
26891
|
-
}).get(answerPath, async ({ query, request }) => {
|
|
26899
|
+
}).use(websocket3()).get(answerPath, async ({ query, request }) => {
|
|
26892
26900
|
const streamUrl = await resolvePlivoStreamUrl(options, {
|
|
26893
26901
|
query,
|
|
26894
26902
|
request,
|
|
@@ -26918,7 +26926,7 @@ var createPlivoVoiceRoutes = (options = {}) => {
|
|
|
26918
26926
|
});
|
|
26919
26927
|
}).ws(streamPath, {
|
|
26920
26928
|
close: async (ws, _code, reason) => {
|
|
26921
|
-
const key = ws
|
|
26929
|
+
const key = socketKey2(ws);
|
|
26922
26930
|
const bridge = bridges.get(key);
|
|
26923
26931
|
bridges.delete(key);
|
|
26924
26932
|
await bridge?.close(reason);
|
|
@@ -26928,7 +26936,7 @@ var createPlivoVoiceRoutes = (options = {}) => {
|
|
|
26928
26936
|
ws.close(1011, "Plivo media bridge is not configured.");
|
|
26929
26937
|
return;
|
|
26930
26938
|
}
|
|
26931
|
-
const key = ws
|
|
26939
|
+
const key = socketKey2(ws);
|
|
26932
26940
|
let bridge = bridges.get(key);
|
|
26933
26941
|
if (!bridge) {
|
|
26934
26942
|
bridge = createPlivoMediaStreamBridge({
|
|
@@ -27001,6 +27009,7 @@ var createPlivoVoiceRoutes = (options = {}) => {
|
|
|
27001
27009
|
import { Buffer as Buffer5 } from "buffer";
|
|
27002
27010
|
import { Database as Database4 } from "bun:sqlite";
|
|
27003
27011
|
import { Elysia as Elysia39 } from "elysia";
|
|
27012
|
+
import { websocket as websocket4 } from "elysia/websocket";
|
|
27004
27013
|
var escapeXml4 = (value) => value.replaceAll("&", "&").replaceAll('"', """).replaceAll("'", "'").replaceAll("<", "<").replaceAll(">", ">");
|
|
27005
27014
|
var joinUrlPath3 = (origin, path) => `${origin.replace(/\/$/, "")}${path.startsWith("/") ? path : `/${path}`}`;
|
|
27006
27015
|
var resolveRequestOrigin2 = (request) => {
|
|
@@ -27459,6 +27468,7 @@ var createTelnyxVoiceRoutes = (options = {}) => {
|
|
|
27459
27468
|
const setupPath = options.setup?.path === false ? false : options.setup?.path ?? "/api/voice/telnyx/setup";
|
|
27460
27469
|
const smokePath = options.smoke?.path === false ? false : options.smoke?.path ?? "/api/voice/telnyx/smoke";
|
|
27461
27470
|
const bridges = new WeakMap;
|
|
27471
|
+
const socketKey2 = (socket) => ("raw" in socket) && socket.raw && typeof socket.raw === "object" ? socket.raw : socket;
|
|
27462
27472
|
const webhookPolicy = options.webhook?.policy ?? options.outcomePolicy ?? createVoiceTelephonyOutcomePolicy();
|
|
27463
27473
|
const verify = options.webhook?.verify ?? (options.webhook?.publicKey ? createVoiceTelnyxWebhookVerifier({
|
|
27464
27474
|
eventStore: options.webhook.eventStore,
|
|
@@ -27467,7 +27477,7 @@ var createTelnyxVoiceRoutes = (options = {}) => {
|
|
|
27467
27477
|
}) : undefined);
|
|
27468
27478
|
const app = new Elysia39({
|
|
27469
27479
|
name: options.name ?? "absolutejs-voice-telnyx"
|
|
27470
|
-
}).get(texmlPath, async ({ query, request }) => {
|
|
27480
|
+
}).use(websocket4()).get(texmlPath, async ({ query, request }) => {
|
|
27471
27481
|
const streamUrl = await resolveTelnyxStreamUrl(options, {
|
|
27472
27482
|
query,
|
|
27473
27483
|
request,
|
|
@@ -27497,7 +27507,7 @@ var createTelnyxVoiceRoutes = (options = {}) => {
|
|
|
27497
27507
|
});
|
|
27498
27508
|
}).ws(streamPath, {
|
|
27499
27509
|
close: async (ws, _code, reason) => {
|
|
27500
|
-
const key = ws
|
|
27510
|
+
const key = socketKey2(ws);
|
|
27501
27511
|
const bridge = bridges.get(key);
|
|
27502
27512
|
bridges.delete(key);
|
|
27503
27513
|
await bridge?.close(reason);
|
|
@@ -27507,7 +27517,7 @@ var createTelnyxVoiceRoutes = (options = {}) => {
|
|
|
27507
27517
|
ws.close(1011, "Telnyx media bridge is not configured.");
|
|
27508
27518
|
return;
|
|
27509
27519
|
}
|
|
27510
|
-
const key = ws
|
|
27520
|
+
const key = socketKey2(ws);
|
|
27511
27521
|
let bridge = bridges.get(key);
|
|
27512
27522
|
if (!bridge) {
|
|
27513
27523
|
bridge = createTelnyxMediaStreamBridge({
|
|
@@ -31812,7 +31822,9 @@ var createVoiceOpsWebhookEnvelope = async (input) => {
|
|
|
31812
31822
|
};
|
|
31813
31823
|
var createVoiceOpsWebhookReceiverRoutes = (options = {}) => {
|
|
31814
31824
|
const path = options.path ?? "/api/voice-ops/webhook";
|
|
31815
|
-
return new Elysia48().post(path,
|
|
31825
|
+
return new Elysia48().post(path, {
|
|
31826
|
+
parse: "text"
|
|
31827
|
+
}, async ({ body, request, set }) => {
|
|
31816
31828
|
const bodyText = typeof body === "string" ? body : JSON.stringify(body);
|
|
31817
31829
|
if (options.signingSecret) {
|
|
31818
31830
|
const verification = await verifyVoiceOpsWebhookSignature({
|
|
@@ -31840,8 +31852,6 @@ var createVoiceOpsWebhookReceiverRoutes = (options = {}) => {
|
|
|
31840
31852
|
ok: true,
|
|
31841
31853
|
type: envelope.event?.type
|
|
31842
31854
|
};
|
|
31843
|
-
}, {
|
|
31844
|
-
parse: "text"
|
|
31845
31855
|
});
|
|
31846
31856
|
};
|
|
31847
31857
|
var createVoiceOpsWebhookSink = (options) => createVoiceIntegrationHTTPSink({
|
|
@@ -40111,7 +40121,7 @@ var parseClientMessage = (raw) => {
|
|
|
40111
40121
|
return null;
|
|
40112
40122
|
};
|
|
40113
40123
|
var resolveSessionId3 = (runtime, ws) => {
|
|
40114
|
-
const query = ws
|
|
40124
|
+
const query = resolveSocketQuery(ws);
|
|
40115
40125
|
const identity = socketIdentity(ws);
|
|
40116
40126
|
const existing = runtime.socketSessions.get(identity);
|
|
40117
40127
|
const providedSessionId = typeof query?.sessionId === "string" && query.sessionId.trim() ? query.sessionId.trim() : existing?.sessionId ?? createId();
|
|
@@ -40123,7 +40133,21 @@ var resolveSessionId3 = (runtime, ws) => {
|
|
|
40123
40133
|
runtime.socketSessions.set(identity, resolved);
|
|
40124
40134
|
return resolved;
|
|
40125
40135
|
};
|
|
40126
|
-
var resolveSocketQuery = (ws) =>
|
|
40136
|
+
var resolveSocketQuery = (ws) => {
|
|
40137
|
+
if (ws.query && typeof ws.query === "object") {
|
|
40138
|
+
return ws.query;
|
|
40139
|
+
}
|
|
40140
|
+
if (ws.data && typeof ws.data === "object" && "query" in ws.data) {
|
|
40141
|
+
return ws.data.query ?? {};
|
|
40142
|
+
}
|
|
40143
|
+
return {};
|
|
40144
|
+
};
|
|
40145
|
+
var resolveSocketContext = (ws) => {
|
|
40146
|
+
if (ws.data && typeof ws.data === "object" && (("headers" in ws.data) || ("query" in ws.data) || ("request" in ws.data))) {
|
|
40147
|
+
return ws.data;
|
|
40148
|
+
}
|
|
40149
|
+
return ws;
|
|
40150
|
+
};
|
|
40127
40151
|
var normalizeSocketHeaders = (value) => {
|
|
40128
40152
|
if (!value || typeof value !== "object")
|
|
40129
40153
|
return null;
|
|
@@ -40137,6 +40161,14 @@ var normalizeSocketHeaders = (value) => {
|
|
|
40137
40161
|
}
|
|
40138
40162
|
};
|
|
40139
40163
|
var resolveSocketHeaders = (ws) => {
|
|
40164
|
+
if (ws.request && typeof ws.request === "object" && "headers" in ws.request) {
|
|
40165
|
+
const requestHeaders = normalizeSocketHeaders(ws.request.headers);
|
|
40166
|
+
if (requestHeaders)
|
|
40167
|
+
return requestHeaders;
|
|
40168
|
+
}
|
|
40169
|
+
const directContextHeaders = normalizeSocketHeaders(ws.headers);
|
|
40170
|
+
if (directContextHeaders)
|
|
40171
|
+
return directContextHeaders;
|
|
40140
40172
|
if (!ws.data || typeof ws.data !== "object")
|
|
40141
40173
|
return new Headers;
|
|
40142
40174
|
if ("request" in ws.data && ws.data.request && typeof ws.data.request === "object" && "headers" in ws.data.request) {
|
|
@@ -40343,7 +40375,7 @@ var voice = (config) => {
|
|
|
40343
40375
|
let authorized = false;
|
|
40344
40376
|
try {
|
|
40345
40377
|
authorized = await config.authorizeConnection({
|
|
40346
|
-
context: ws
|
|
40378
|
+
context: resolveSocketContext(ws),
|
|
40347
40379
|
headers: resolveSocketHeaders(ws),
|
|
40348
40380
|
path: config.path,
|
|
40349
40381
|
query: resolveSocketQuery(ws),
|
|
@@ -40435,7 +40467,7 @@ var voice = (config) => {
|
|
|
40435
40467
|
const htmxRenderers = resolveVoiceHTMXRenderers(config.htmx && config.htmx !== true ? config.htmx : undefined);
|
|
40436
40468
|
const htmxTargets = resolveVoiceHTMXTargets(htmxOptions?.targets);
|
|
40437
40469
|
const createManagedSession = async (ws, sessionId, scenarioId) => {
|
|
40438
|
-
const context = ws
|
|
40470
|
+
const context = resolveSocketContext(ws);
|
|
40439
40471
|
const profileSwitchDecision = await resolveProfileSwitchGuard(config, runtime, {
|
|
40440
40472
|
context,
|
|
40441
40473
|
scenarioId,
|
|
@@ -40724,7 +40756,7 @@ var voice = (config) => {
|
|
|
40724
40756
|
}
|
|
40725
40757
|
}));
|
|
40726
40758
|
};
|
|
40727
|
-
return new Elysia70({ name: "absolutejs-voice" }).ws(config.path, {
|
|
40759
|
+
return new Elysia70({ name: "absolutejs-voice" }).use(websocket5()).ws(config.path, {
|
|
40728
40760
|
close: async (ws, code, reason) => {
|
|
40729
40761
|
const identity = socketIdentity(ws);
|
|
40730
40762
|
closedSockets.add(identity);
|
|
@@ -44091,7 +44123,7 @@ var isBypassed = (bypassPaths, url) => {
|
|
|
44091
44123
|
};
|
|
44092
44124
|
var createVoiceRouteAuth = (options) => {
|
|
44093
44125
|
const bypassPaths = options.bypassPaths ?? [];
|
|
44094
|
-
return new Elysia71({ name: options.name ?? "voice-route-auth" }).
|
|
44126
|
+
return new Elysia71({ name: options.name ?? "voice-route-auth" }).request(async ({ request, set }) => {
|
|
44095
44127
|
const { url } = request;
|
|
44096
44128
|
if (isBypassed(bypassPaths, url))
|
|
44097
44129
|
return;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Elysia } from "elysia";
|
|
2
1
|
import { type VoiceTelephonyContractOptions, type VoiceTelephonyContractReport, type VoiceTelephonyProvider, type VoiceTelephonySetupStatus, type VoiceTelephonySmokeReport } from "./contract";
|
|
3
2
|
export type VoiceTelephonyCarrierMatrixStatus = "fail" | "pass" | "warn";
|
|
4
3
|
export type VoiceTelephonyCarrierMatrixInput<TProvider extends VoiceTelephonyProvider = VoiceTelephonyProvider> = {
|
|
@@ -52,46 +51,156 @@ export type VoiceTelephonyCarrierMatrixRoutesOptions = {
|
|
|
52
51
|
contract?: VoiceTelephonyContractOptions;
|
|
53
52
|
};
|
|
54
53
|
export declare const createVoiceTelephonyCarrierMatrix: (options: VoiceTelephonyCarrierMatrixOptions) => VoiceTelephonyCarrierMatrix;
|
|
55
|
-
export declare const createVoiceTelephonyCarrierMatrixRoutes: (options: VoiceTelephonyCarrierMatrixRoutesOptions) =>
|
|
56
|
-
decorator: {};
|
|
57
|
-
store: {};
|
|
58
|
-
derive: {};
|
|
59
|
-
resolve: {};
|
|
60
|
-
}, {
|
|
54
|
+
export declare const createVoiceTelephonyCarrierMatrixRoutes: (options: VoiceTelephonyCarrierMatrixRoutesOptions) => import("elysia/types").AddRoute<"", "local", import("elysia/types").DefaultSingleton, {
|
|
61
55
|
typebox: {};
|
|
62
|
-
error:
|
|
63
|
-
}, {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
query: unknown;
|
|
76
|
-
headers: unknown;
|
|
77
|
-
response: {
|
|
78
|
-
200: Response | VoiceTelephonyCarrierMatrix;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
56
|
+
error: [];
|
|
57
|
+
}, import("elysia/types").DefaultMetadata, {}, import("elysia/types").DefaultEphemeral, import("elysia/types").DefaultEphemeral, "get", string, import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<{}, {}, `/${string}`>, import("elysia/types").MergeScopedSchemas<{}, {}, {}>>, {}, ({ query, request }: {
|
|
58
|
+
body: unknown;
|
|
59
|
+
query: Record<string, string | undefined>;
|
|
60
|
+
params: {};
|
|
61
|
+
headers: Record<string, string | undefined>;
|
|
62
|
+
cookie: Record<string, import("elysia").Cookie<unknown>>;
|
|
63
|
+
server: import("elysia").Server | null;
|
|
64
|
+
redirect: import("elysia").redirect;
|
|
65
|
+
set: {
|
|
66
|
+
headers: import("elysia").HTTPHeaders;
|
|
67
|
+
status?: number | keyof import("elysia").StatusMap;
|
|
68
|
+
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
81
69
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
70
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 404 | 400 | 408 | 401 | 503 | 200 | 429 | 500 | 300 | 420 | 413 | 415 | 403 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 301 | 302 | 303 | 304 | 307 | 308 | 402 | 405 | 406 | 407 | 409 | 410 | 411 | 412 | 414 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 431 | 451 | 501 | 502 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
71
|
+
readonly 100: "Continue";
|
|
72
|
+
readonly 101: "Switching Protocols";
|
|
73
|
+
readonly 102: "Processing";
|
|
74
|
+
readonly 103: "Early Hints";
|
|
75
|
+
readonly 200: "OK";
|
|
76
|
+
readonly 201: "Created";
|
|
77
|
+
readonly 202: "Accepted";
|
|
78
|
+
readonly 203: "Non-Authoritative Information";
|
|
79
|
+
readonly 204: "No Content";
|
|
80
|
+
readonly 205: "Reset Content";
|
|
81
|
+
readonly 206: "Partial Content";
|
|
82
|
+
readonly 207: "Multi-Status";
|
|
83
|
+
readonly 208: "Already Reported";
|
|
84
|
+
readonly 300: "Multiple Choices";
|
|
85
|
+
readonly 301: "Moved Permanently";
|
|
86
|
+
readonly 302: "Found";
|
|
87
|
+
readonly 303: "See Other";
|
|
88
|
+
readonly 304: "Not Modified";
|
|
89
|
+
readonly 307: "Temporary Redirect";
|
|
90
|
+
readonly 308: "Permanent Redirect";
|
|
91
|
+
readonly 400: "Bad Request";
|
|
92
|
+
readonly 401: "Unauthorized";
|
|
93
|
+
readonly 402: "Payment Required";
|
|
94
|
+
readonly 403: "Forbidden";
|
|
95
|
+
readonly 404: "Not Found";
|
|
96
|
+
readonly 405: "Method Not Allowed";
|
|
97
|
+
readonly 406: "Not Acceptable";
|
|
98
|
+
readonly 407: "Proxy Authentication Required";
|
|
99
|
+
readonly 408: "Request Timeout";
|
|
100
|
+
readonly 409: "Conflict";
|
|
101
|
+
readonly 410: "Gone";
|
|
102
|
+
readonly 411: "Length Required";
|
|
103
|
+
readonly 412: "Precondition Failed";
|
|
104
|
+
readonly 413: "Payload Too Large";
|
|
105
|
+
readonly 414: "URI Too Long";
|
|
106
|
+
readonly 415: "Unsupported Media Type";
|
|
107
|
+
readonly 416: "Range Not Satisfiable";
|
|
108
|
+
readonly 417: "Expectation Failed";
|
|
109
|
+
readonly 418: "I'm a teapot";
|
|
110
|
+
readonly 420: "Enhance Your Calm";
|
|
111
|
+
readonly 421: "Misdirected Request";
|
|
112
|
+
readonly 422: "Unprocessable Content";
|
|
113
|
+
readonly 423: "Locked";
|
|
114
|
+
readonly 424: "Failed Dependency";
|
|
115
|
+
readonly 425: "Too Early";
|
|
116
|
+
readonly 426: "Upgrade Required";
|
|
117
|
+
readonly 428: "Precondition Required";
|
|
118
|
+
readonly 429: "Too Many Requests";
|
|
119
|
+
readonly 431: "Request Header Fields Too Large";
|
|
120
|
+
readonly 451: "Unavailable For Legal Reasons";
|
|
121
|
+
readonly 500: "Internal Server Error";
|
|
122
|
+
readonly 501: "Not Implemented";
|
|
123
|
+
readonly 502: "Bad Gateway";
|
|
124
|
+
readonly 503: "Service Unavailable";
|
|
125
|
+
readonly 504: "Gateway Timeout";
|
|
126
|
+
readonly 505: "HTTP Version Not Supported";
|
|
127
|
+
readonly 506: "Variant Also Negotiates";
|
|
128
|
+
readonly 507: "Insufficient Storage";
|
|
129
|
+
readonly 508: "Loop Detected";
|
|
130
|
+
readonly 510: "Not Extended";
|
|
131
|
+
readonly 511: "Network Authentication Required";
|
|
132
|
+
}[Code] : Code>(code: Code, response?: T) => import("elysia").ElysiaStatus<Code, T, Code extends "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required" ? {
|
|
133
|
+
readonly Continue: 100;
|
|
134
|
+
readonly "Switching Protocols": 101;
|
|
135
|
+
readonly Processing: 102;
|
|
136
|
+
readonly "Early Hints": 103;
|
|
137
|
+
readonly OK: 200;
|
|
138
|
+
readonly Created: 201;
|
|
139
|
+
readonly Accepted: 202;
|
|
140
|
+
readonly "Non-Authoritative Information": 203;
|
|
141
|
+
readonly "No Content": 204;
|
|
142
|
+
readonly "Reset Content": 205;
|
|
143
|
+
readonly "Partial Content": 206;
|
|
144
|
+
readonly "Multi-Status": 207;
|
|
145
|
+
readonly "Already Reported": 208;
|
|
146
|
+
readonly "Multiple Choices": 300;
|
|
147
|
+
readonly "Moved Permanently": 301;
|
|
148
|
+
readonly Found: 302;
|
|
149
|
+
readonly "See Other": 303;
|
|
150
|
+
readonly "Not Modified": 304;
|
|
151
|
+
readonly "Temporary Redirect": 307;
|
|
152
|
+
readonly "Permanent Redirect": 308;
|
|
153
|
+
readonly "Bad Request": 400;
|
|
154
|
+
readonly Unauthorized: 401;
|
|
155
|
+
readonly "Payment Required": 402;
|
|
156
|
+
readonly Forbidden: 403;
|
|
157
|
+
readonly "Not Found": 404;
|
|
158
|
+
readonly "Method Not Allowed": 405;
|
|
159
|
+
readonly "Not Acceptable": 406;
|
|
160
|
+
readonly "Proxy Authentication Required": 407;
|
|
161
|
+
readonly "Request Timeout": 408;
|
|
162
|
+
readonly Conflict: 409;
|
|
163
|
+
readonly Gone: 410;
|
|
164
|
+
readonly "Length Required": 411;
|
|
165
|
+
readonly "Precondition Failed": 412;
|
|
166
|
+
readonly "Payload Too Large": 413;
|
|
167
|
+
readonly "URI Too Long": 414;
|
|
168
|
+
readonly "Unsupported Media Type": 415;
|
|
169
|
+
readonly "Range Not Satisfiable": 416;
|
|
170
|
+
readonly "Expectation Failed": 417;
|
|
171
|
+
readonly "I'm a teapot": 418;
|
|
172
|
+
readonly "Enhance Your Calm": 420;
|
|
173
|
+
readonly "Misdirected Request": 421;
|
|
174
|
+
readonly "Unprocessable Content": 422;
|
|
175
|
+
readonly Locked: 423;
|
|
176
|
+
readonly "Failed Dependency": 424;
|
|
177
|
+
readonly "Too Early": 425;
|
|
178
|
+
readonly "Upgrade Required": 426;
|
|
179
|
+
readonly "Precondition Required": 428;
|
|
180
|
+
readonly "Too Many Requests": 429;
|
|
181
|
+
readonly "Request Header Fields Too Large": 431;
|
|
182
|
+
readonly "Unavailable For Legal Reasons": 451;
|
|
183
|
+
readonly "Internal Server Error": 500;
|
|
184
|
+
readonly "Not Implemented": 501;
|
|
185
|
+
readonly "Bad Gateway": 502;
|
|
186
|
+
readonly "Service Unavailable": 503;
|
|
187
|
+
readonly "Gateway Timeout": 504;
|
|
188
|
+
readonly "HTTP Version Not Supported": 505;
|
|
189
|
+
readonly "Variant Also Negotiates": 506;
|
|
190
|
+
readonly "Insufficient Storage": 507;
|
|
191
|
+
readonly "Loop Detected": 508;
|
|
192
|
+
readonly "Not Extended": 510;
|
|
193
|
+
readonly "Network Authentication Required": 511;
|
|
194
|
+
}[Code] : Code>;
|
|
195
|
+
defer: (fn: import("elysia/types").AfterResponseHandler<NoInfer<import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<{}, {}, `/${string}`>, import("elysia/types").MergeScopedSchemas<{}, {}, {}>>>, NoInfer<import("elysia/types").DefaultSingleton & {
|
|
196
|
+
derive: {};
|
|
197
|
+
}>>) => import("elysia/types").MaybePromise<void>;
|
|
198
|
+
readonly path: string;
|
|
199
|
+
route?: string | undefined;
|
|
200
|
+
rid?: string | undefined;
|
|
201
|
+
request: Request;
|
|
202
|
+
store: {};
|
|
203
|
+
}) => Promise<Response | VoiceTelephonyCarrierMatrix>>;
|
|
95
204
|
export declare const renderVoiceTelephonyCarrierMatrixHTML: (matrix: VoiceTelephonyCarrierMatrix, options?: {
|
|
96
205
|
title?: string;
|
|
97
206
|
}) => string;
|
|
@@ -220,22 +220,14 @@ export declare const createVoicePlivoWebhookVerifier: (options: VoicePlivoWebhoo
|
|
|
220
220
|
request: Request;
|
|
221
221
|
}) => Promise<VoiceTelephonyWebhookVerificationResult>;
|
|
222
222
|
export declare const createVoiceRedisPlivoWebhookNonceStore: (options?: VoiceRedisPlivoWebhookNonceStoreOptions) => VoicePlivoWebhookNonceStore;
|
|
223
|
-
export declare const createPlivoVoiceRoutes: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options?: PlivoVoiceRoutesOptions<TContext, TSession, TResult>) => Elysia<"", {
|
|
223
|
+
export declare const createPlivoVoiceRoutes: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options?: PlivoVoiceRoutesOptions<TContext, TSession, TResult>) => Elysia<"", "local", {
|
|
224
224
|
decorator: {};
|
|
225
225
|
store: {};
|
|
226
226
|
derive: {};
|
|
227
|
-
resolve: {};
|
|
228
227
|
}, {
|
|
229
228
|
typebox: {};
|
|
230
|
-
error:
|
|
231
|
-
}, {
|
|
232
|
-
schema: {};
|
|
233
|
-
standaloneSchema: {};
|
|
234
|
-
macro: {};
|
|
235
|
-
macroFn: {};
|
|
236
|
-
parser: {};
|
|
237
|
-
response: {};
|
|
238
|
-
}, {
|
|
229
|
+
error: [];
|
|
230
|
+
}, import("elysia/types").DefaultMetadata, {
|
|
239
231
|
[x: string]: {
|
|
240
232
|
get: {
|
|
241
233
|
body: unknown;
|
|
@@ -245,6 +237,7 @@ export declare const createPlivoVoiceRoutes: <TContext = unknown, TSession exten
|
|
|
245
237
|
response: {
|
|
246
238
|
200: Response;
|
|
247
239
|
};
|
|
240
|
+
error: never;
|
|
248
241
|
};
|
|
249
242
|
};
|
|
250
243
|
} & {
|
|
@@ -257,17 +250,12 @@ export declare const createPlivoVoiceRoutes: <TContext = unknown, TSession exten
|
|
|
257
250
|
response: {
|
|
258
251
|
200: Response;
|
|
259
252
|
};
|
|
253
|
+
error: never;
|
|
260
254
|
};
|
|
261
255
|
};
|
|
262
256
|
} & {
|
|
263
257
|
[x: string]: {
|
|
264
|
-
subscribe: {
|
|
265
|
-
body: {};
|
|
266
|
-
params: {};
|
|
267
|
-
query: {};
|
|
268
|
-
headers: {};
|
|
269
|
-
response: {};
|
|
270
|
-
};
|
|
258
|
+
subscribe: import("elysia/types").CreateWSEdenResponse<string, import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<import("elysia").InputSchema<never>, {}, `/${string}`>, import("elysia/types").MergeScopedSchemas<{}, {}, {}>>, {}, import("elysia/types").ComposeElysiaResponse<import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<import("elysia").InputSchema<never>, {}, `/${string}`>, import("elysia/types").MergeScopedSchemas<{}, {}, {}>>, void, {}, [], string>>;
|
|
271
259
|
};
|
|
272
260
|
} & {
|
|
273
261
|
[x: string]: {
|
|
@@ -279,24 +267,13 @@ export declare const createPlivoVoiceRoutes: <TContext = unknown, TSession exten
|
|
|
279
267
|
response: {
|
|
280
268
|
200: Response | import("..").VoiceTelephonyWebhookDecision<TResult>;
|
|
281
269
|
};
|
|
270
|
+
error: never;
|
|
282
271
|
};
|
|
283
272
|
};
|
|
284
|
-
}, {
|
|
285
|
-
derive: {};
|
|
286
|
-
resolve: {};
|
|
287
|
-
schema: {};
|
|
288
|
-
standaloneSchema: {};
|
|
289
|
-
response: {};
|
|
290
|
-
}, {
|
|
291
|
-
derive: {};
|
|
292
|
-
resolve: {};
|
|
293
|
-
schema: {};
|
|
294
|
-
standaloneSchema: {};
|
|
295
|
-
response: {};
|
|
296
|
-
} & {
|
|
273
|
+
}, import("elysia/types").DefaultEphemeral, {
|
|
297
274
|
derive: {};
|
|
298
|
-
resolve: {};
|
|
299
275
|
schema: {};
|
|
300
|
-
|
|
276
|
+
schemas: {};
|
|
301
277
|
response: {};
|
|
278
|
+
error: [];
|
|
302
279
|
}>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type VoiceTelephonyWebhookIdempotencyStore, type VoiceTelephonyWebhookProvider, type VoiceTelephonyWebhookVerificationResult } from "../core/telephonyOutcome";
|
|
2
|
-
import { Elysia } from "elysia";
|
|
3
2
|
import { type VoicePostgresClient } from "../core/postgresStore";
|
|
4
3
|
import { type VoiceRedisTelephonyWebhookIdempotencyClient } from "../core/queue";
|
|
5
4
|
import { type VoicePlivoWebhookNonceStore, type VoiceRedisPlivoWebhookNonceClient } from "./plivo";
|
|
@@ -139,44 +138,8 @@ export type VoiceTelephonyWebhookSecurityRoutesOptions<TResult = unknown> = {
|
|
|
139
138
|
export declare const assertVoiceTelephonyWebhookSecurityEvidence: (report: VoiceTelephonyWebhookSecurityReport, input?: VoiceTelephonyWebhookSecurityAssertionInput) => VoiceTelephonyWebhookSecurityAssertionReport;
|
|
140
139
|
export declare const buildVoiceTelephonyWebhookSecurityReport: <TResult = unknown>(options?: VoiceTelephonyWebhookSecurityOptions<TResult>) => VoiceTelephonyWebhookSecurityReport;
|
|
141
140
|
export declare const createVoiceTelephonyWebhookSecurityPreset: <TResult = unknown>(options?: VoiceTelephonyWebhookSecurityOptions<TResult>) => VoiceTelephonyWebhookSecurityPreset<TResult>;
|
|
142
|
-
export declare const createVoiceTelephonyWebhookSecurityRoutes: <TResult = unknown>(options: VoiceTelephonyWebhookSecurityRoutesOptions<TResult>) =>
|
|
143
|
-
decorator: {};
|
|
144
|
-
store: {};
|
|
145
|
-
derive: {};
|
|
146
|
-
resolve: {};
|
|
147
|
-
}, {
|
|
141
|
+
export declare const createVoiceTelephonyWebhookSecurityRoutes: <TResult = unknown>(options: VoiceTelephonyWebhookSecurityRoutesOptions<TResult>) => import("elysia/types").AddRoute<"", "local", import("elysia/types").DefaultSingleton, {
|
|
148
142
|
typebox: {};
|
|
149
|
-
error:
|
|
150
|
-
}, {
|
|
151
|
-
schema: {};
|
|
152
|
-
standaloneSchema: {};
|
|
153
|
-
macro: {};
|
|
154
|
-
macroFn: {};
|
|
155
|
-
parser: {};
|
|
156
|
-
response: {};
|
|
157
|
-
}, {
|
|
158
|
-
[x: string]: {
|
|
159
|
-
get: {
|
|
160
|
-
body: unknown;
|
|
161
|
-
params: {};
|
|
162
|
-
query: unknown;
|
|
163
|
-
headers: unknown;
|
|
164
|
-
response: {
|
|
165
|
-
200: VoiceTelephonyWebhookSecurityReport;
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
}, {
|
|
170
|
-
derive: {};
|
|
171
|
-
resolve: {};
|
|
172
|
-
schema: {};
|
|
173
|
-
standaloneSchema: {};
|
|
174
|
-
response: {};
|
|
175
|
-
}, {
|
|
176
|
-
derive: {};
|
|
177
|
-
resolve: {};
|
|
178
|
-
schema: {};
|
|
179
|
-
standaloneSchema: {};
|
|
180
|
-
response: {};
|
|
181
|
-
}>;
|
|
143
|
+
error: [];
|
|
144
|
+
}, import("elysia/types").DefaultMetadata, {}, import("elysia/types").DefaultEphemeral, import("elysia/types").DefaultEphemeral, "get", string, import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<{}, {}, `/${string}`>, import("elysia/types").MergeScopedSchemas<{}, {}, {}>>, {}, () => VoiceTelephonyWebhookSecurityReport>;
|
|
182
145
|
export declare const evaluateVoiceTelephonyWebhookSecurityEvidence: (report: VoiceTelephonyWebhookSecurityReport, input?: VoiceTelephonyWebhookSecurityAssertionInput) => VoiceTelephonyWebhookSecurityAssertionReport;
|