@absolutejs/voice 0.0.22-beta.265 → 0.0.22-beta.266
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.js +15 -0
- package/dist/telephonyOutcome.d.ts +8 -0
- package/dist/testing/index.js +15 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17401,6 +17401,9 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
17401
17401
|
const providers = uniqueSorted3(decisions.map((decision) => decision.provider ?? decision.event?.provider).filter(isTelephonyWebhookProvider));
|
|
17402
17402
|
const sources = uniqueSorted3(decisions.map((decision) => decision.decision?.source ?? decision.source).filter((source) => typeof source === "string"));
|
|
17403
17403
|
const applied = decisions.filter((decision) => decision.applied === true).length;
|
|
17404
|
+
const duplicateDecisions = decisions.filter((decision) => decision.duplicate === true);
|
|
17405
|
+
const duplicateProviders = uniqueSorted3(duplicateDecisions.map((decision) => decision.provider ?? decision.event?.provider).filter(isTelephonyWebhookProvider));
|
|
17406
|
+
const duplicateIdempotencyKeys = new Set(duplicateDecisions.map((decision) => decision.idempotencyKey).filter((key) => typeof key === "string" && key.length > 0)).size;
|
|
17404
17407
|
const routeResults = decisions.filter((decision) => isRecord(decision.routeResult)).length;
|
|
17405
17408
|
const missingSessionIds = decisions.filter((decision) => !decision.sessionId).length;
|
|
17406
17409
|
if (input.minDecisions !== undefined && decisions.length < input.minDecisions) {
|
|
@@ -17409,6 +17412,12 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
17409
17412
|
if (input.minApplied !== undefined && applied < input.minApplied) {
|
|
17410
17413
|
issues.push(`Expected at least ${String(input.minApplied)} applied telephony webhook decision(s), found ${String(applied)}.`);
|
|
17411
17414
|
}
|
|
17415
|
+
if (input.minDuplicates !== undefined && duplicateDecisions.length < input.minDuplicates) {
|
|
17416
|
+
issues.push(`Expected at least ${String(input.minDuplicates)} duplicate telephony webhook decision(s), found ${String(duplicateDecisions.length)}.`);
|
|
17417
|
+
}
|
|
17418
|
+
if (input.minDuplicateIdempotencyKeys !== undefined && duplicateIdempotencyKeys < input.minDuplicateIdempotencyKeys) {
|
|
17419
|
+
issues.push(`Expected at least ${String(input.minDuplicateIdempotencyKeys)} duplicate telephony webhook idempotency key(s), found ${String(duplicateIdempotencyKeys)}.`);
|
|
17420
|
+
}
|
|
17412
17421
|
if (input.maxMissingSessionIds !== undefined && missingSessionIds > input.maxMissingSessionIds) {
|
|
17413
17422
|
issues.push(`Expected at most ${String(input.maxMissingSessionIds)} telephony webhook decision(s) without sessionId, found ${String(missingSessionIds)}.`);
|
|
17414
17423
|
}
|
|
@@ -17418,6 +17427,9 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
17418
17427
|
for (const provider of findMissing3(providers, input.requiredProviders)) {
|
|
17419
17428
|
issues.push(`Missing telephony webhook provider: ${provider}.`);
|
|
17420
17429
|
}
|
|
17430
|
+
for (const provider of findMissing3(duplicateProviders, input.requiredDuplicateProviders)) {
|
|
17431
|
+
issues.push(`Missing duplicate telephony webhook provider: ${provider}.`);
|
|
17432
|
+
}
|
|
17421
17433
|
for (const action of findMissing3(actions, input.requiredActions)) {
|
|
17422
17434
|
issues.push(`Missing telephony webhook action: ${action}.`);
|
|
17423
17435
|
}
|
|
@@ -17429,6 +17441,9 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
17429
17441
|
applied,
|
|
17430
17442
|
decisions: decisions.length,
|
|
17431
17443
|
dispositions,
|
|
17444
|
+
duplicateIdempotencyKeys,
|
|
17445
|
+
duplicateProviders,
|
|
17446
|
+
duplicates: duplicateDecisions.length,
|
|
17432
17447
|
issues,
|
|
17433
17448
|
missingSessionIds,
|
|
17434
17449
|
ok: issues.length === 0,
|
|
@@ -74,7 +74,9 @@ export type VoiceTelephonyWebhookNormalizationEvidenceDecision = {
|
|
|
74
74
|
source?: VoiceTelephonyOutcomeDecision['source'] | string;
|
|
75
75
|
};
|
|
76
76
|
disposition?: VoiceCallDisposition | string;
|
|
77
|
+
duplicate?: boolean;
|
|
77
78
|
event?: VoiceTelephonyOutcomeProviderEvent;
|
|
79
|
+
idempotencyKey?: string;
|
|
78
80
|
provider?: VoiceTelephonyWebhookProvider | string;
|
|
79
81
|
routeResult?: unknown;
|
|
80
82
|
sessionId?: string;
|
|
@@ -85,8 +87,11 @@ export type VoiceTelephonyWebhookNormalizationEvidenceInput = {
|
|
|
85
87
|
maxMissingSessionIds?: number;
|
|
86
88
|
minApplied?: number;
|
|
87
89
|
minDecisions?: number;
|
|
90
|
+
minDuplicateIdempotencyKeys?: number;
|
|
91
|
+
minDuplicates?: number;
|
|
88
92
|
requiredActions?: VoiceTelephonyOutcomeAction[];
|
|
89
93
|
requiredDispositions?: VoiceCallDisposition[];
|
|
94
|
+
requiredDuplicateProviders?: VoiceTelephonyWebhookProvider[];
|
|
90
95
|
requiredProviders?: VoiceTelephonyWebhookProvider[];
|
|
91
96
|
requireRouteResults?: boolean;
|
|
92
97
|
};
|
|
@@ -95,6 +100,9 @@ export type VoiceTelephonyWebhookNormalizationEvidenceReport = {
|
|
|
95
100
|
applied: number;
|
|
96
101
|
decisions: number;
|
|
97
102
|
dispositions: VoiceCallDisposition[];
|
|
103
|
+
duplicateIdempotencyKeys: number;
|
|
104
|
+
duplicateProviders: VoiceTelephonyWebhookProvider[];
|
|
105
|
+
duplicates: number;
|
|
98
106
|
issues: string[];
|
|
99
107
|
missingSessionIds: number;
|
|
100
108
|
ok: boolean;
|
package/dist/testing/index.js
CHANGED
|
@@ -8256,6 +8256,9 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
8256
8256
|
const providers = uniqueSorted(decisions.map((decision) => decision.provider ?? decision.event?.provider).filter(isTelephonyWebhookProvider));
|
|
8257
8257
|
const sources = uniqueSorted(decisions.map((decision) => decision.decision?.source ?? decision.source).filter((source) => typeof source === "string"));
|
|
8258
8258
|
const applied = decisions.filter((decision) => decision.applied === true).length;
|
|
8259
|
+
const duplicateDecisions = decisions.filter((decision) => decision.duplicate === true);
|
|
8260
|
+
const duplicateProviders = uniqueSorted(duplicateDecisions.map((decision) => decision.provider ?? decision.event?.provider).filter(isTelephonyWebhookProvider));
|
|
8261
|
+
const duplicateIdempotencyKeys = new Set(duplicateDecisions.map((decision) => decision.idempotencyKey).filter((key) => typeof key === "string" && key.length > 0)).size;
|
|
8259
8262
|
const routeResults = decisions.filter((decision) => isRecord(decision.routeResult)).length;
|
|
8260
8263
|
const missingSessionIds = decisions.filter((decision) => !decision.sessionId).length;
|
|
8261
8264
|
if (input.minDecisions !== undefined && decisions.length < input.minDecisions) {
|
|
@@ -8264,6 +8267,12 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
8264
8267
|
if (input.minApplied !== undefined && applied < input.minApplied) {
|
|
8265
8268
|
issues.push(`Expected at least ${String(input.minApplied)} applied telephony webhook decision(s), found ${String(applied)}.`);
|
|
8266
8269
|
}
|
|
8270
|
+
if (input.minDuplicates !== undefined && duplicateDecisions.length < input.minDuplicates) {
|
|
8271
|
+
issues.push(`Expected at least ${String(input.minDuplicates)} duplicate telephony webhook decision(s), found ${String(duplicateDecisions.length)}.`);
|
|
8272
|
+
}
|
|
8273
|
+
if (input.minDuplicateIdempotencyKeys !== undefined && duplicateIdempotencyKeys < input.minDuplicateIdempotencyKeys) {
|
|
8274
|
+
issues.push(`Expected at least ${String(input.minDuplicateIdempotencyKeys)} duplicate telephony webhook idempotency key(s), found ${String(duplicateIdempotencyKeys)}.`);
|
|
8275
|
+
}
|
|
8267
8276
|
if (input.maxMissingSessionIds !== undefined && missingSessionIds > input.maxMissingSessionIds) {
|
|
8268
8277
|
issues.push(`Expected at most ${String(input.maxMissingSessionIds)} telephony webhook decision(s) without sessionId, found ${String(missingSessionIds)}.`);
|
|
8269
8278
|
}
|
|
@@ -8273,6 +8282,9 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
8273
8282
|
for (const provider of findMissing(providers, input.requiredProviders)) {
|
|
8274
8283
|
issues.push(`Missing telephony webhook provider: ${provider}.`);
|
|
8275
8284
|
}
|
|
8285
|
+
for (const provider of findMissing(duplicateProviders, input.requiredDuplicateProviders)) {
|
|
8286
|
+
issues.push(`Missing duplicate telephony webhook provider: ${provider}.`);
|
|
8287
|
+
}
|
|
8276
8288
|
for (const action of findMissing(actions, input.requiredActions)) {
|
|
8277
8289
|
issues.push(`Missing telephony webhook action: ${action}.`);
|
|
8278
8290
|
}
|
|
@@ -8284,6 +8296,9 @@ var evaluateVoiceTelephonyWebhookNormalizationEvidence = (input = {}) => {
|
|
|
8284
8296
|
applied,
|
|
8285
8297
|
decisions: decisions.length,
|
|
8286
8298
|
dispositions,
|
|
8299
|
+
duplicateIdempotencyKeys,
|
|
8300
|
+
duplicateProviders,
|
|
8301
|
+
duplicates: duplicateDecisions.length,
|
|
8287
8302
|
issues,
|
|
8288
8303
|
missingSessionIds,
|
|
8289
8304
|
ok: issues.length === 0,
|