@absolutejs/voice 0.0.22-beta.267 → 0.0.22-beta.268
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/index.d.ts +1 -1
- package/dist/index.js +18 -1
- package/dist/telephonyOutcome.d.ts +16 -0
- package/dist/testing/index.js +18 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -115,7 +115,7 @@ export type { VoiceLiveLatencyOptions, VoiceLiveLatencyReport, VoiceLiveLatencyR
|
|
|
115
115
|
export type { VoiceLatencySLOBudget, VoiceLatencySLOGateError, VoiceLatencySLOGateOptions, VoiceLatencySLOGateReport, VoiceLatencySLOMeasurement, VoiceLatencySLOStage, VoiceLatencySLOStageSummary, VoiceLatencySLOStatus } from './latencySlo';
|
|
116
116
|
export type { VoiceTurnQualityHTMLHandlerOptions, VoiceTurnQualityItem, VoiceTurnQualityOptions, VoiceTurnQualityReport, VoiceTurnQualityRoutesOptions, VoiceTurnQualityStatus } from './turnQuality';
|
|
117
117
|
export type { VoiceOutcomeContractAssertionInput, VoiceOutcomeContractAssertionReport, VoiceOutcomeContractDefinition, VoiceOutcomeContractHTMLHandlerOptions, VoiceOutcomeContractIssue, VoiceOutcomeContractOptions, VoiceOutcomeContractReport, VoiceOutcomeContractRoutesOptions, VoiceOutcomeContractStatus, VoiceOutcomeContractSuiteReport } from './outcomeContract';
|
|
118
|
-
export type { VoiceTelephonyOutcomeAction, VoiceTelephonyOutcomeDecision, VoiceTelephonyOutcomePolicy, VoiceTelephonyOutcomeProviderEvent, VoiceTelephonyOutcomeRouteResult, VoiceTelephonyOutcomeStatusDecision, VoiceTelephonyWebhookDecision, VoiceTelephonyWebhookHandlerOptions, VoiceTelephonyWebhookIdempotencyStore, VoiceTelephonyWebhookNormalizationEvidenceDecision, VoiceTelephonyWebhookNormalizationEvidenceInput, VoiceTelephonyWebhookNormalizationEvidenceReport, VoiceTelephonyWebhookParseInput, VoiceTelephonyWebhookProvider, VoiceTelephonyWebhookRoutesOptions, VoiceTelephonyWebhookVerificationResult, StoredVoiceTelephonyWebhookDecision } from './telephonyOutcome';
|
|
118
|
+
export type { VoiceTelephonyOutcomeAction, VoiceTelephonyOutcomeDecision, VoiceTelephonyOutcomePolicy, VoiceTelephonyOutcomeProviderEvent, VoiceTelephonyOutcomeRouteResult, VoiceTelephonyOutcomeStatusDecision, VoiceTelephonyWebhookDecision, VoiceTelephonyWebhookHandlerOptions, VoiceTelephonyWebhookIdempotencyStore, VoiceTelephonyWebhookNormalizationEvidenceDecision, VoiceTelephonyWebhookNormalizationEvidenceInput, VoiceTelephonyWebhookNormalizationEvidenceReport, VoiceTelephonyWebhookParseInput, VoiceTelephonyWebhookProvider, VoiceTelephonyWebhookRoutesOptions, VoiceTelephonyWebhookVerificationEvidenceAttempt, VoiceTelephonyWebhookVerificationResult, StoredVoiceTelephonyWebhookDecision } from './telephonyOutcome';
|
|
119
119
|
export type { VoicePhoneAgentCarrier, VoicePhoneAgentCarrierSummary, VoicePhoneAssistantEvidenceInput, VoicePhoneAssistantEvidenceReport, VoicePhoneCallControlEvidenceInput, VoicePhoneCallControlEvidenceReport, VoicePhoneAgentLifecycleStage, VoicePhoneAgentPlivoCarrier, VoicePhoneAgentRoutes, VoicePhoneAgentRoutesOptions, VoicePhoneAgentSetupReport, VoicePhoneAgentTelnyxCarrier, VoicePhoneAgentTwilioCarrier } from './phoneAgent';
|
|
120
120
|
export type { VoicePhoneAgentProductionSmokeIssue, VoicePhoneAgentProductionSmokeHandlerOptions, VoicePhoneAgentProductionSmokeHTMLHandlerOptions, VoicePhoneAgentProductionSmokeOptions, VoicePhoneAgentProductionSmokeReport, VoicePhoneAgentProductionSmokeRoutesOptions, VoicePhoneAgentProductionSmokeRequirement } from './phoneAgentProductionSmoke';
|
|
121
121
|
export type { VoiceOpsConsoleLink, VoiceOpsConsoleReport, VoiceOpsConsoleRoutesOptions } from './opsConsoleRoutes';
|
package/dist/index.js
CHANGED
|
@@ -17396,6 +17396,7 @@ var isCallDisposition = (value) => value === "completed" || value === "escalated
|
|
|
17396
17396
|
var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
17397
17397
|
const issues = [];
|
|
17398
17398
|
const decisions = input.decisions ?? [];
|
|
17399
|
+
const verificationAttempts = input.verificationAttempts ?? [];
|
|
17399
17400
|
const actions = uniqueSorted3(decisions.map((decision) => decision.decision?.action ?? decision.action).filter(isTelephonyOutcomeAction));
|
|
17400
17401
|
const dispositions = uniqueSorted3(decisions.map((decision) => decision.decision?.disposition ?? decision.disposition).filter(isCallDisposition));
|
|
17401
17402
|
const providers = uniqueSorted3(decisions.map((decision) => decision.provider ?? decision.event?.provider).filter(isTelephonyWebhookProvider));
|
|
@@ -17408,6 +17409,9 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
17408
17409
|
const duplicateOutcomeReasons = uniqueSorted3(duplicateDecisions.map((decision) => isRecord(decision.campaignOutcome) ? decision.campaignOutcome.reason : undefined).filter((reason) => typeof reason === "string"));
|
|
17409
17410
|
const routeResults = decisions.filter((decision) => isRecord(decision.routeResult)).length;
|
|
17410
17411
|
const missingSessionIds = decisions.filter((decision) => !decision.sessionId).length;
|
|
17412
|
+
const rejectedVerificationAttempts = verificationAttempts.filter((attempt) => attempt.rejected === true || attempt.status === 401 || attempt.verification?.ok === false && attempt.verification.reason === "invalid-signature");
|
|
17413
|
+
const rejectedVerificationProviders = uniqueSorted3(rejectedVerificationAttempts.map((attempt) => attempt.provider).filter(isTelephonyWebhookProvider));
|
|
17414
|
+
const rejectedVerificationSideEffects = rejectedVerificationAttempts.reduce((total, attempt) => total + Math.max(0, attempt.sideEffects ?? 0), 0);
|
|
17411
17415
|
if (input.minDecisions !== undefined && decisions.length < input.minDecisions) {
|
|
17412
17416
|
issues.push(`Expected at least ${String(input.minDecisions)} telephony webhook decision(s), found ${String(decisions.length)}.`);
|
|
17413
17417
|
}
|
|
@@ -17423,6 +17427,12 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
17423
17427
|
if (input.maxDuplicateCampaignOutcomesApplied !== undefined && duplicateCampaignOutcomesApplied > input.maxDuplicateCampaignOutcomesApplied) {
|
|
17424
17428
|
issues.push(`Expected at most ${String(input.maxDuplicateCampaignOutcomesApplied)} duplicate telephony webhook campaign outcome application(s), found ${String(duplicateCampaignOutcomesApplied)}.`);
|
|
17425
17429
|
}
|
|
17430
|
+
if (input.minRejectedVerificationAttempts !== undefined && rejectedVerificationAttempts.length < input.minRejectedVerificationAttempts) {
|
|
17431
|
+
issues.push(`Expected at least ${String(input.minRejectedVerificationAttempts)} rejected telephony webhook verification attempt(s), found ${String(rejectedVerificationAttempts.length)}.`);
|
|
17432
|
+
}
|
|
17433
|
+
if (input.maxRejectedVerificationSideEffects !== undefined && rejectedVerificationSideEffects > input.maxRejectedVerificationSideEffects) {
|
|
17434
|
+
issues.push(`Expected at most ${String(input.maxRejectedVerificationSideEffects)} rejected telephony webhook side effect(s), found ${String(rejectedVerificationSideEffects)}.`);
|
|
17435
|
+
}
|
|
17426
17436
|
if (input.maxMissingSessionIds !== undefined && missingSessionIds > input.maxMissingSessionIds) {
|
|
17427
17437
|
issues.push(`Expected at most ${String(input.maxMissingSessionIds)} telephony webhook decision(s) without sessionId, found ${String(missingSessionIds)}.`);
|
|
17428
17438
|
}
|
|
@@ -17435,6 +17445,9 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
17435
17445
|
for (const provider of findMissing3(duplicateProviders, input.requiredDuplicateProviders)) {
|
|
17436
17446
|
issues.push(`Missing duplicate telephony webhook provider: ${provider}.`);
|
|
17437
17447
|
}
|
|
17448
|
+
for (const provider of findMissing3(rejectedVerificationProviders, input.requiredRejectedVerificationProviders)) {
|
|
17449
|
+
issues.push(`Missing rejected telephony webhook verification provider: ${provider}.`);
|
|
17450
|
+
}
|
|
17438
17451
|
for (const action of findMissing3(actions, input.requiredActions)) {
|
|
17439
17452
|
issues.push(`Missing telephony webhook action: ${action}.`);
|
|
17440
17453
|
}
|
|
@@ -17455,8 +17468,12 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
17455
17468
|
missingSessionIds,
|
|
17456
17469
|
ok: issues.length === 0,
|
|
17457
17470
|
providers,
|
|
17471
|
+
rejectedVerificationAttempts: rejectedVerificationAttempts.length,
|
|
17472
|
+
rejectedVerificationProviders,
|
|
17473
|
+
rejectedVerificationSideEffects,
|
|
17458
17474
|
routeResults,
|
|
17459
|
-
sources
|
|
17475
|
+
sources,
|
|
17476
|
+
verificationAttempts: verificationAttempts.length
|
|
17460
17477
|
};
|
|
17461
17478
|
};
|
|
17462
17479
|
var assertVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
@@ -83,6 +83,14 @@ export type VoiceTelephonyWebhookNormalizationEvidenceDecision = {
|
|
|
83
83
|
sessionId?: string;
|
|
84
84
|
source?: VoiceTelephonyOutcomeDecision['source'] | string;
|
|
85
85
|
};
|
|
86
|
+
export type VoiceTelephonyWebhookVerificationEvidenceAttempt = {
|
|
87
|
+
decisions?: number;
|
|
88
|
+
provider?: VoiceTelephonyWebhookProvider | string;
|
|
89
|
+
rejected?: boolean;
|
|
90
|
+
sideEffects?: number;
|
|
91
|
+
status?: number;
|
|
92
|
+
verification?: VoiceTelephonyWebhookVerificationResult;
|
|
93
|
+
};
|
|
86
94
|
export type VoiceTelephonyWebhookNormalizationEvidenceInput = {
|
|
87
95
|
decisions?: VoiceTelephonyWebhookNormalizationEvidenceDecision[];
|
|
88
96
|
maxMissingSessionIds?: number;
|
|
@@ -91,11 +99,15 @@ export type VoiceTelephonyWebhookNormalizationEvidenceInput = {
|
|
|
91
99
|
minDuplicateIdempotencyKeys?: number;
|
|
92
100
|
minDuplicates?: number;
|
|
93
101
|
maxDuplicateCampaignOutcomesApplied?: number;
|
|
102
|
+
maxRejectedVerificationSideEffects?: number;
|
|
103
|
+
minRejectedVerificationAttempts?: number;
|
|
94
104
|
requiredActions?: VoiceTelephonyOutcomeAction[];
|
|
95
105
|
requiredDispositions?: VoiceCallDisposition[];
|
|
96
106
|
requiredDuplicateProviders?: VoiceTelephonyWebhookProvider[];
|
|
97
107
|
requiredProviders?: VoiceTelephonyWebhookProvider[];
|
|
108
|
+
requiredRejectedVerificationProviders?: VoiceTelephonyWebhookProvider[];
|
|
98
109
|
requireRouteResults?: boolean;
|
|
110
|
+
verificationAttempts?: VoiceTelephonyWebhookVerificationEvidenceAttempt[];
|
|
99
111
|
};
|
|
100
112
|
export type VoiceTelephonyWebhookNormalizationEvidenceReport = {
|
|
101
113
|
actions: VoiceTelephonyOutcomeAction[];
|
|
@@ -111,8 +123,12 @@ export type VoiceTelephonyWebhookNormalizationEvidenceReport = {
|
|
|
111
123
|
missingSessionIds: number;
|
|
112
124
|
ok: boolean;
|
|
113
125
|
providers: VoiceTelephonyWebhookProvider[];
|
|
126
|
+
rejectedVerificationAttempts: number;
|
|
127
|
+
rejectedVerificationProviders: VoiceTelephonyWebhookProvider[];
|
|
128
|
+
rejectedVerificationSideEffects: number;
|
|
114
129
|
routeResults: number;
|
|
115
130
|
sources: string[];
|
|
131
|
+
verificationAttempts: number;
|
|
116
132
|
};
|
|
117
133
|
export type VoiceTelephonyWebhookIdempotencyStore<TResult = unknown> = {
|
|
118
134
|
get: (key: string) => Promise<StoredVoiceTelephonyWebhookDecision<TResult> | undefined> | StoredVoiceTelephonyWebhookDecision<TResult> | undefined;
|
package/dist/testing/index.js
CHANGED
|
@@ -8251,6 +8251,7 @@ var isCallDisposition = (value) => value === "completed" || value === "escalated
|
|
|
8251
8251
|
var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
8252
8252
|
const issues = [];
|
|
8253
8253
|
const decisions = input.decisions ?? [];
|
|
8254
|
+
const verificationAttempts = input.verificationAttempts ?? [];
|
|
8254
8255
|
const actions = uniqueSorted(decisions.map((decision) => decision.decision?.action ?? decision.action).filter(isTelephonyOutcomeAction));
|
|
8255
8256
|
const dispositions = uniqueSorted(decisions.map((decision) => decision.decision?.disposition ?? decision.disposition).filter(isCallDisposition));
|
|
8256
8257
|
const providers = uniqueSorted(decisions.map((decision) => decision.provider ?? decision.event?.provider).filter(isTelephonyWebhookProvider));
|
|
@@ -8263,6 +8264,9 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
8263
8264
|
const duplicateOutcomeReasons = uniqueSorted(duplicateDecisions.map((decision) => isRecord(decision.campaignOutcome) ? decision.campaignOutcome.reason : undefined).filter((reason) => typeof reason === "string"));
|
|
8264
8265
|
const routeResults = decisions.filter((decision) => isRecord(decision.routeResult)).length;
|
|
8265
8266
|
const missingSessionIds = decisions.filter((decision) => !decision.sessionId).length;
|
|
8267
|
+
const rejectedVerificationAttempts = verificationAttempts.filter((attempt) => attempt.rejected === true || attempt.status === 401 || attempt.verification?.ok === false && attempt.verification.reason === "invalid-signature");
|
|
8268
|
+
const rejectedVerificationProviders = uniqueSorted(rejectedVerificationAttempts.map((attempt) => attempt.provider).filter(isTelephonyWebhookProvider));
|
|
8269
|
+
const rejectedVerificationSideEffects = rejectedVerificationAttempts.reduce((total, attempt) => total + Math.max(0, attempt.sideEffects ?? 0), 0);
|
|
8266
8270
|
if (input.minDecisions !== undefined && decisions.length < input.minDecisions) {
|
|
8267
8271
|
issues.push(`Expected at least ${String(input.minDecisions)} telephony webhook decision(s), found ${String(decisions.length)}.`);
|
|
8268
8272
|
}
|
|
@@ -8278,6 +8282,12 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
8278
8282
|
if (input.maxDuplicateCampaignOutcomesApplied !== undefined && duplicateCampaignOutcomesApplied > input.maxDuplicateCampaignOutcomesApplied) {
|
|
8279
8283
|
issues.push(`Expected at most ${String(input.maxDuplicateCampaignOutcomesApplied)} duplicate telephony webhook campaign outcome application(s), found ${String(duplicateCampaignOutcomesApplied)}.`);
|
|
8280
8284
|
}
|
|
8285
|
+
if (input.minRejectedVerificationAttempts !== undefined && rejectedVerificationAttempts.length < input.minRejectedVerificationAttempts) {
|
|
8286
|
+
issues.push(`Expected at least ${String(input.minRejectedVerificationAttempts)} rejected telephony webhook verification attempt(s), found ${String(rejectedVerificationAttempts.length)}.`);
|
|
8287
|
+
}
|
|
8288
|
+
if (input.maxRejectedVerificationSideEffects !== undefined && rejectedVerificationSideEffects > input.maxRejectedVerificationSideEffects) {
|
|
8289
|
+
issues.push(`Expected at most ${String(input.maxRejectedVerificationSideEffects)} rejected telephony webhook side effect(s), found ${String(rejectedVerificationSideEffects)}.`);
|
|
8290
|
+
}
|
|
8281
8291
|
if (input.maxMissingSessionIds !== undefined && missingSessionIds > input.maxMissingSessionIds) {
|
|
8282
8292
|
issues.push(`Expected at most ${String(input.maxMissingSessionIds)} telephony webhook decision(s) without sessionId, found ${String(missingSessionIds)}.`);
|
|
8283
8293
|
}
|
|
@@ -8290,6 +8300,9 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
8290
8300
|
for (const provider of findMissing(duplicateProviders, input.requiredDuplicateProviders)) {
|
|
8291
8301
|
issues.push(`Missing duplicate telephony webhook provider: ${provider}.`);
|
|
8292
8302
|
}
|
|
8303
|
+
for (const provider of findMissing(rejectedVerificationProviders, input.requiredRejectedVerificationProviders)) {
|
|
8304
|
+
issues.push(`Missing rejected telephony webhook verification provider: ${provider}.`);
|
|
8305
|
+
}
|
|
8293
8306
|
for (const action of findMissing(actions, input.requiredActions)) {
|
|
8294
8307
|
issues.push(`Missing telephony webhook action: ${action}.`);
|
|
8295
8308
|
}
|
|
@@ -8310,8 +8323,12 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
8310
8323
|
missingSessionIds,
|
|
8311
8324
|
ok: issues.length === 0,
|
|
8312
8325
|
providers,
|
|
8326
|
+
rejectedVerificationAttempts: rejectedVerificationAttempts.length,
|
|
8327
|
+
rejectedVerificationProviders,
|
|
8328
|
+
rejectedVerificationSideEffects,
|
|
8313
8329
|
routeResults,
|
|
8314
|
-
sources
|
|
8330
|
+
sources,
|
|
8331
|
+
verificationAttempts: verificationAttempts.length
|
|
8315
8332
|
};
|
|
8316
8333
|
};
|
|
8317
8334
|
var assertVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|