@absolutejs/voice 0.0.22-beta.230 → 0.0.22-beta.232
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/README.md +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +261 -0
- package/dist/observabilityExport.d.ts +20 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2758,14 +2758,21 @@ Every export manifest and artifact index includes a stable schema contract:
|
|
|
2758
2758
|
```ts
|
|
2759
2759
|
import {
|
|
2760
2760
|
assertVoiceObservabilityExportSchema,
|
|
2761
|
+
validateVoiceObservabilityExportRecord,
|
|
2761
2762
|
voiceObservabilityExportSchemaId,
|
|
2762
2763
|
voiceObservabilityExportSchemaVersion
|
|
2763
2764
|
} from '@absolutejs/voice';
|
|
2764
2765
|
|
|
2765
2766
|
assertVoiceObservabilityExportSchema(exportReport);
|
|
2767
|
+
const validation = validateVoiceObservabilityExportRecord(exportReport);
|
|
2768
|
+
if (!validation.ok) {
|
|
2769
|
+
throw new Error(validation.issues.map((issue) => issue.message).join('\n'));
|
|
2770
|
+
}
|
|
2766
2771
|
console.log(voiceObservabilityExportSchemaId, voiceObservabilityExportSchemaVersion);
|
|
2767
2772
|
```
|
|
2768
2773
|
|
|
2774
|
+
Use `validateVoiceObservabilityExportRecord(...)` or `assertVoiceObservabilityExportRecord(...)` when reading customer-owned records back from SQLite, Postgres, S3, a webhook collector, a warehouse, or a SIEM. The validator accepts manifests, artifact indexes, delivery reports, delivery receipts, delivery histories, and database payload records, then checks the stable schema id/version plus the minimum shape required for safe ingestion.
|
|
2775
|
+
|
|
2769
2776
|
```ts
|
|
2770
2777
|
import {
|
|
2771
2778
|
buildVoiceObservabilityExport,
|
package/dist/index.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export { createVoiceReadinessProfile, recommendVoiceReadinessProfile } from './r
|
|
|
53
53
|
export { buildVoiceProviderContractMatrix, createVoiceProviderContractMatrixHTMLHandler, createVoiceProviderContractMatrixJSONHandler, createVoiceProviderContractMatrixPreset, createVoiceProviderContractMatrixRoutes, evaluateVoiceProviderStackGaps, renderVoiceProviderContractMatrixHTML, recommendVoiceProviderStack } from './providerStackRecommendations';
|
|
54
54
|
export { buildVoiceOpsConsoleReport, createVoiceOpsConsoleRoutes, renderVoiceOpsConsoleHTML } from './opsConsoleRoutes';
|
|
55
55
|
export { buildVoiceOperationsRecord, createVoiceOperationsRecordRoutes, renderVoiceOperationsRecordHTML, renderVoiceOperationsRecordIncidentMarkdown } from './operationsRecord';
|
|
56
|
-
export { buildVoiceObservabilityArtifactIndex, buildVoiceObservabilityExportDeliveryHistory, buildVoiceObservabilityExport, assertVoiceObservabilityExportSchema, createVoiceObservabilityExportSchema, createVoiceFileObservabilityExportDeliveryReceiptStore, createVoiceMemoryObservabilityExportDeliveryReceiptStore, createVoiceObservabilityExportRoutes, deliverVoiceObservabilityExport, renderVoiceObservabilityExportMarkdown, voiceObservabilityExportSchemaId, voiceObservabilityExportSchemaVersion } from './observabilityExport';
|
|
56
|
+
export { assertVoiceObservabilityExportRecord, buildVoiceObservabilityArtifactIndex, buildVoiceObservabilityExportDeliveryHistory, buildVoiceObservabilityExport, assertVoiceObservabilityExportSchema, createVoiceObservabilityExportSchema, createVoiceFileObservabilityExportDeliveryReceiptStore, createVoiceMemoryObservabilityExportDeliveryReceiptStore, createVoiceObservabilityExportRoutes, deliverVoiceObservabilityExport, renderVoiceObservabilityExportMarkdown, validateVoiceObservabilityExportRecord, voiceObservabilityExportSchemaId, voiceObservabilityExportSchemaVersion } from './observabilityExport';
|
|
57
57
|
export { buildVoiceOpsRecoveryReadinessCheck, buildVoiceOpsRecoveryReport, createVoiceOpsRecoveryRoutes, renderVoiceOpsRecoveryHTML, renderVoiceOpsRecoveryMarkdown } from './opsRecovery';
|
|
58
58
|
export { buildVoiceIncidentBundle, createStoredVoiceIncidentBundleArtifact, createVoiceIncidentBundleRoutes, createVoiceMemoryIncidentBundleStore, pruneVoiceIncidentBundleArtifacts, saveVoiceIncidentBundleArtifact } from './incidentBundle';
|
|
59
59
|
export { summarizeVoiceOpsStatus } from './opsStatus';
|
|
@@ -118,7 +118,7 @@ export type { VoiceProductionReadinessAction, VoiceProductionReadinessAuditOptio
|
|
|
118
118
|
export type { VoiceReadinessProfileName, VoiceReadinessProfileOptions, VoiceReadinessProfileRecommendation, VoiceReadinessProfileRecommendationScore, VoiceReadinessProfileRoutesOptions } from './readinessProfiles';
|
|
119
119
|
export type { VoiceProviderStackChoice, VoiceProviderStackCapabilities, VoiceProviderStackCapabilityGap, VoiceProviderStackCapabilityGapInput, VoiceProviderStackCapabilityGapReport, VoiceProviderContractCheck, VoiceProviderContractCheckStatus, VoiceProviderContractDefinition, VoiceProviderContractMatrixHandlerOptions, VoiceProviderContractMatrixHTMLHandlerOptions, VoiceProviderContractMatrixInput, VoiceProviderContractMatrixPresetOptions, VoiceProviderContractMatrixReport, VoiceProviderContractMatrixRoutesOptions, VoiceProviderContractMatrixRow, VoiceProviderStackInput, VoiceProviderStackKind, VoiceProviderStackRecommendation } from './providerStackRecommendations';
|
|
120
120
|
export type { VoiceOperationsRecord, VoiceOperationsRecordAgentHandoff, VoiceOperationsRecordAuditSummary, VoiceOperationsRecordIntegrationEventSummary, VoiceOperationsRecordOptions, VoiceOperationsRecordOutcome, VoiceOperationsRecordProviderDecision, VoiceOperationsRecordReviewSummary, VoiceOperationsRecordRoutesOptions, VoiceOperationsRecordStatus, VoiceOperationsRecordTaskSummary, VoiceOperationsRecordTranscriptTurn, VoiceOperationsRecordTool } from './operationsRecord';
|
|
121
|
-
export type { VoiceObservabilityExportArtifact, VoiceObservabilityExportArtifactChecksum, VoiceObservabilityExportArtifactFreshness, VoiceObservabilityExportArtifactIndex, VoiceObservabilityExportArtifactIndexItem, VoiceObservabilityExportArtifactKind, VoiceObservabilityExportDeliverySummary, VoiceObservabilityExportDeliveryDestination, VoiceObservabilityExportDeliveryDestinationResult, VoiceObservabilityExportDeliveryHistory, VoiceObservabilityExportDeliveryOptions, VoiceObservabilityExportDeliveryReceipt, VoiceObservabilityExportDeliveryReceiptStore, VoiceObservabilityExportDeliveryReport, VoiceObservabilityExportEnvelope, VoiceObservabilityExportIssue, VoiceObservabilityExportIssueCode, VoiceObservabilityExportOptions, VoiceObservabilityExportRedactionSummary, VoiceObservabilityExportReport, VoiceObservabilityExportRoutesOptions, VoiceObservabilityExportSchema, VoiceObservabilityExportStatus } from './observabilityExport';
|
|
121
|
+
export type { VoiceObservabilityExportArtifact, VoiceObservabilityExportArtifactChecksum, VoiceObservabilityExportArtifactFreshness, VoiceObservabilityExportArtifactIndex, VoiceObservabilityExportArtifactIndexItem, VoiceObservabilityExportArtifactKind, VoiceObservabilityExportDeliverySummary, VoiceObservabilityExportDeliveryDestination, VoiceObservabilityExportDeliveryDestinationResult, VoiceObservabilityExportDeliveryHistory, VoiceObservabilityExportDeliveryOptions, VoiceObservabilityExportDeliveryReceipt, VoiceObservabilityExportDeliveryReceiptStore, VoiceObservabilityExportDeliveryReport, VoiceObservabilityExportEnvelope, VoiceObservabilityExportIssue, VoiceObservabilityExportIssueCode, VoiceObservabilityExportOptions, VoiceObservabilityExportIngestedRecordKind, VoiceObservabilityExportRedactionSummary, VoiceObservabilityExportRecordValidationOptions, VoiceObservabilityExportReport, VoiceObservabilityExportRoutesOptions, VoiceObservabilityExportSchema, VoiceObservabilityExportStatus, VoiceObservabilityExportValidationIssue, VoiceObservabilityExportValidationResult } from './observabilityExport';
|
|
122
122
|
export type { VoiceOpsRecoveryFailedSession, VoiceOpsRecoveryInterventionSummary, VoiceOpsRecoveryIssue, VoiceOpsRecoveryIssueCode, VoiceOpsRecoveryLinks, VoiceOpsRecoveryProviderSummary, VoiceOpsRecoveryReport, VoiceOpsRecoveryReportOptions, VoiceOpsRecoveryRoutesOptions, VoiceOpsRecoveryStatus } from './opsRecovery';
|
|
123
123
|
export type { StoredVoiceIncidentBundleArtifact, VoiceIncidentBundle, VoiceIncidentBundleArtifactOptions, VoiceIncidentBundleFormat, VoiceIncidentBundleOptions, VoiceIncidentBundleRetentionOptions, VoiceIncidentBundleRetentionReport, VoiceIncidentBundleRoutesOptions, VoiceIncidentBundleStore, VoiceIncidentBundleStoreFilter, VoiceIncidentBundleSummary } from './incidentBundle';
|
|
124
124
|
export type { VoiceQualityLink, VoiceQualityMetric, VoiceQualityReport, VoiceQualityRoutesOptions, VoiceQualityStatus, VoiceQualityThresholds } from './qualityRoutes';
|
package/dist/index.js
CHANGED
|
@@ -22998,6 +22998,265 @@ var assertVoiceObservabilityExportSchema = (input) => {
|
|
|
22998
22998
|
throw new Error(`Unsupported voice observability export schema: ${input.schema?.id ?? "missing"}@${input.schema?.version ?? "missing"}`);
|
|
22999
22999
|
}
|
|
23000
23000
|
};
|
|
23001
|
+
var isRecord2 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
23002
|
+
var isStatus2 = (value) => value === "fail" || value === "pass" || value === "warn";
|
|
23003
|
+
var getRecord = (value, key) => isRecord2(value) && isRecord2(value[key]) ? value[key] : undefined;
|
|
23004
|
+
var getRecordArray = (value, key) => isRecord2(value) && Array.isArray(value[key]) ? value[key] : undefined;
|
|
23005
|
+
var inferVoiceObservabilityExportRecordKind = (record) => {
|
|
23006
|
+
if (isRecord2(record.manifest) && isRecord2(record.artifactIndex)) {
|
|
23007
|
+
return "database-record";
|
|
23008
|
+
}
|
|
23009
|
+
if (Array.isArray(record.receipts)) {
|
|
23010
|
+
return "delivery-history";
|
|
23011
|
+
}
|
|
23012
|
+
if (typeof record.runId === "string" && Array.isArray(record.destinations)) {
|
|
23013
|
+
return "delivery-receipt";
|
|
23014
|
+
}
|
|
23015
|
+
if (Array.isArray(record.destinations) && isRecord2(record.summary) && typeof record.exportStatus === "string") {
|
|
23016
|
+
return "delivery-report";
|
|
23017
|
+
}
|
|
23018
|
+
if (Array.isArray(record.artifacts) && isRecord2(record.summary)) {
|
|
23019
|
+
return Array.isArray(record.envelopes) ? "manifest" : "artifact-index";
|
|
23020
|
+
}
|
|
23021
|
+
return;
|
|
23022
|
+
};
|
|
23023
|
+
var pushValidationIssue = (issues, issue) => {
|
|
23024
|
+
issues.push(issue);
|
|
23025
|
+
};
|
|
23026
|
+
var requireRecordSchema = (issues, record, path) => {
|
|
23027
|
+
const schema = getRecord(record, "schema");
|
|
23028
|
+
if (schema?.id !== voiceObservabilityExportSchemaId || schema?.version !== voiceObservabilityExportSchemaVersion) {
|
|
23029
|
+
pushValidationIssue(issues, {
|
|
23030
|
+
code: "voice.observability.export.unsupported_schema",
|
|
23031
|
+
message: `Unsupported voice observability export schema: ${schema?.id ?? "missing"}@${schema?.version ?? "missing"}`,
|
|
23032
|
+
path: `${path}.schema`
|
|
23033
|
+
});
|
|
23034
|
+
}
|
|
23035
|
+
return schema;
|
|
23036
|
+
};
|
|
23037
|
+
var requireArrayField = (issues, record, key, path) => {
|
|
23038
|
+
if (!Array.isArray(record[key])) {
|
|
23039
|
+
pushValidationIssue(issues, {
|
|
23040
|
+
code: "voice.observability.export.missing_field",
|
|
23041
|
+
message: `${path}.${key} must be an array.`,
|
|
23042
|
+
path: `${path}.${key}`
|
|
23043
|
+
});
|
|
23044
|
+
}
|
|
23045
|
+
};
|
|
23046
|
+
var requireNumberField = (issues, record, key, path) => {
|
|
23047
|
+
if (typeof record[key] !== "number") {
|
|
23048
|
+
pushValidationIssue(issues, {
|
|
23049
|
+
code: "voice.observability.export.missing_field",
|
|
23050
|
+
message: `${path}.${key} must be a number.`,
|
|
23051
|
+
path: `${path}.${key}`
|
|
23052
|
+
});
|
|
23053
|
+
}
|
|
23054
|
+
};
|
|
23055
|
+
var requireStatusField = (issues, record, key, path) => {
|
|
23056
|
+
if (!isStatus2(record[key])) {
|
|
23057
|
+
pushValidationIssue(issues, {
|
|
23058
|
+
code: "voice.observability.export.missing_field",
|
|
23059
|
+
message: `${path}.${key} must be pass, warn, or fail.`,
|
|
23060
|
+
path: `${path}.${key}`
|
|
23061
|
+
});
|
|
23062
|
+
}
|
|
23063
|
+
};
|
|
23064
|
+
var requireDeliveryDestinationStatusField = (issues, record, key, path) => {
|
|
23065
|
+
if (record[key] !== "delivered" && record[key] !== "failed") {
|
|
23066
|
+
pushValidationIssue(issues, {
|
|
23067
|
+
code: "voice.observability.export.missing_field",
|
|
23068
|
+
message: `${path}.${key} must be delivered or failed.`,
|
|
23069
|
+
path: `${path}.${key}`
|
|
23070
|
+
});
|
|
23071
|
+
}
|
|
23072
|
+
};
|
|
23073
|
+
var validateDeliveryDestinations = (issues, destinations, path) => {
|
|
23074
|
+
if (!destinations) {
|
|
23075
|
+
pushValidationIssue(issues, {
|
|
23076
|
+
code: "voice.observability.export.missing_field",
|
|
23077
|
+
message: `${path} must be an array.`,
|
|
23078
|
+
path
|
|
23079
|
+
});
|
|
23080
|
+
return;
|
|
23081
|
+
}
|
|
23082
|
+
destinations.forEach((destination, index) => {
|
|
23083
|
+
const destinationPath = `${path}.${index}`;
|
|
23084
|
+
if (!isRecord2(destination)) {
|
|
23085
|
+
pushValidationIssue(issues, {
|
|
23086
|
+
code: "voice.observability.export.invalid_shape",
|
|
23087
|
+
message: `${destinationPath} must be an object.`,
|
|
23088
|
+
path: destinationPath
|
|
23089
|
+
});
|
|
23090
|
+
return;
|
|
23091
|
+
}
|
|
23092
|
+
requireRecordSchema(issues, destination, destinationPath);
|
|
23093
|
+
requireDeliveryDestinationStatusField(issues, destination, "status", destinationPath);
|
|
23094
|
+
if (typeof destination.destinationKind !== "string") {
|
|
23095
|
+
pushValidationIssue(issues, {
|
|
23096
|
+
code: "voice.observability.export.missing_field",
|
|
23097
|
+
message: `${destinationPath}.destinationKind must be a string.`,
|
|
23098
|
+
path: `${destinationPath}.destinationKind`
|
|
23099
|
+
});
|
|
23100
|
+
}
|
|
23101
|
+
});
|
|
23102
|
+
};
|
|
23103
|
+
var validateVoiceObservabilityExportRecord = (input, options = {}) => {
|
|
23104
|
+
const issues = [];
|
|
23105
|
+
if (!isRecord2(input)) {
|
|
23106
|
+
return {
|
|
23107
|
+
issues: [
|
|
23108
|
+
{
|
|
23109
|
+
code: "voice.observability.export.invalid_shape",
|
|
23110
|
+
message: "Voice observability export record must be an object.",
|
|
23111
|
+
path: "$"
|
|
23112
|
+
}
|
|
23113
|
+
],
|
|
23114
|
+
ok: false
|
|
23115
|
+
};
|
|
23116
|
+
}
|
|
23117
|
+
const kind = options.kind ?? inferVoiceObservabilityExportRecordKind(input);
|
|
23118
|
+
if (!kind) {
|
|
23119
|
+
return {
|
|
23120
|
+
issues: [
|
|
23121
|
+
{
|
|
23122
|
+
code: "voice.observability.export.invalid_shape",
|
|
23123
|
+
message: "Voice observability export record kind could not be inferred.",
|
|
23124
|
+
path: "$"
|
|
23125
|
+
}
|
|
23126
|
+
],
|
|
23127
|
+
ok: false
|
|
23128
|
+
};
|
|
23129
|
+
}
|
|
23130
|
+
let schema;
|
|
23131
|
+
if (kind === "manifest") {
|
|
23132
|
+
schema = requireRecordSchema(issues, input, "$");
|
|
23133
|
+
requireArrayField(issues, input, "artifacts", "$");
|
|
23134
|
+
requireArrayField(issues, input, "envelopes", "$");
|
|
23135
|
+
requireArrayField(issues, input, "issues", "$");
|
|
23136
|
+
requireArrayField(issues, input, "operationsRecords", "$");
|
|
23137
|
+
requireArrayField(issues, input, "sessionIds", "$");
|
|
23138
|
+
requireNumberField(issues, input, "checkedAt", "$");
|
|
23139
|
+
requireStatusField(issues, input, "status", "$");
|
|
23140
|
+
if (!isRecord2(input.deliveries)) {
|
|
23141
|
+
pushValidationIssue(issues, {
|
|
23142
|
+
code: "voice.observability.export.missing_field",
|
|
23143
|
+
message: "$.deliveries must be an object.",
|
|
23144
|
+
path: "$.deliveries"
|
|
23145
|
+
});
|
|
23146
|
+
}
|
|
23147
|
+
if (!isRecord2(input.redaction)) {
|
|
23148
|
+
pushValidationIssue(issues, {
|
|
23149
|
+
code: "voice.observability.export.missing_field",
|
|
23150
|
+
message: "$.redaction must be an object.",
|
|
23151
|
+
path: "$.redaction"
|
|
23152
|
+
});
|
|
23153
|
+
}
|
|
23154
|
+
if (!isRecord2(input.summary)) {
|
|
23155
|
+
pushValidationIssue(issues, {
|
|
23156
|
+
code: "voice.observability.export.missing_field",
|
|
23157
|
+
message: "$.summary must be an object.",
|
|
23158
|
+
path: "$.summary"
|
|
23159
|
+
});
|
|
23160
|
+
}
|
|
23161
|
+
} else if (kind === "artifact-index") {
|
|
23162
|
+
schema = requireRecordSchema(issues, input, "$");
|
|
23163
|
+
requireArrayField(issues, input, "artifacts", "$");
|
|
23164
|
+
requireNumberField(issues, input, "checkedAt", "$");
|
|
23165
|
+
requireStatusField(issues, input, "status", "$");
|
|
23166
|
+
if (!isRecord2(input.summary)) {
|
|
23167
|
+
pushValidationIssue(issues, {
|
|
23168
|
+
code: "voice.observability.export.missing_field",
|
|
23169
|
+
message: "$.summary must be an object.",
|
|
23170
|
+
path: "$.summary"
|
|
23171
|
+
});
|
|
23172
|
+
}
|
|
23173
|
+
} else if (kind === "database-record") {
|
|
23174
|
+
schema = requireRecordSchema(issues, input, "$");
|
|
23175
|
+
requireNumberField(issues, input, "checkedAt", "$");
|
|
23176
|
+
requireStatusField(issues, input, "status", "$");
|
|
23177
|
+
requireStatusField(issues, input, "exportStatus", "$");
|
|
23178
|
+
if (!isRecord2(input.manifest)) {
|
|
23179
|
+
pushValidationIssue(issues, {
|
|
23180
|
+
code: "voice.observability.export.missing_field",
|
|
23181
|
+
message: "$.manifest must be an object.",
|
|
23182
|
+
path: "$.manifest"
|
|
23183
|
+
});
|
|
23184
|
+
} else {
|
|
23185
|
+
issues.push(...validateVoiceObservabilityExportRecord(input.manifest, {
|
|
23186
|
+
kind: "manifest"
|
|
23187
|
+
}).issues.map((issue) => ({
|
|
23188
|
+
...issue,
|
|
23189
|
+
path: `$.manifest${issue.path.slice(1)}`
|
|
23190
|
+
})));
|
|
23191
|
+
}
|
|
23192
|
+
if (!isRecord2(input.artifactIndex)) {
|
|
23193
|
+
pushValidationIssue(issues, {
|
|
23194
|
+
code: "voice.observability.export.missing_field",
|
|
23195
|
+
message: "$.artifactIndex must be an object.",
|
|
23196
|
+
path: "$.artifactIndex"
|
|
23197
|
+
});
|
|
23198
|
+
} else {
|
|
23199
|
+
issues.push(...validateVoiceObservabilityExportRecord(input.artifactIndex, {
|
|
23200
|
+
kind: "artifact-index"
|
|
23201
|
+
}).issues.map((issue) => ({
|
|
23202
|
+
...issue,
|
|
23203
|
+
path: `$.artifactIndex${issue.path.slice(1)}`
|
|
23204
|
+
})));
|
|
23205
|
+
}
|
|
23206
|
+
} else if (kind === "delivery-report") {
|
|
23207
|
+
requireNumberField(issues, input, "checkedAt", "$");
|
|
23208
|
+
requireStatusField(issues, input, "status", "$");
|
|
23209
|
+
requireStatusField(issues, input, "exportStatus", "$");
|
|
23210
|
+
validateDeliveryDestinations(issues, getRecordArray(input, "destinations"), "$.destinations");
|
|
23211
|
+
} else if (kind === "delivery-receipt") {
|
|
23212
|
+
requireNumberField(issues, input, "checkedAt", "$");
|
|
23213
|
+
requireStatusField(issues, input, "status", "$");
|
|
23214
|
+
requireStatusField(issues, input, "exportStatus", "$");
|
|
23215
|
+
if (typeof input.runId !== "string") {
|
|
23216
|
+
pushValidationIssue(issues, {
|
|
23217
|
+
code: "voice.observability.export.missing_field",
|
|
23218
|
+
message: "$.runId must be a string.",
|
|
23219
|
+
path: "$.runId"
|
|
23220
|
+
});
|
|
23221
|
+
}
|
|
23222
|
+
validateDeliveryDestinations(issues, getRecordArray(input, "destinations"), "$.destinations");
|
|
23223
|
+
} else if (kind === "delivery-history") {
|
|
23224
|
+
requireNumberField(issues, input, "checkedAt", "$");
|
|
23225
|
+
requireStatusField(issues, input, "status", "$");
|
|
23226
|
+
const receipts = getRecordArray(input, "receipts");
|
|
23227
|
+
if (!receipts) {
|
|
23228
|
+
pushValidationIssue(issues, {
|
|
23229
|
+
code: "voice.observability.export.missing_field",
|
|
23230
|
+
message: "$.receipts must be an array.",
|
|
23231
|
+
path: "$.receipts"
|
|
23232
|
+
});
|
|
23233
|
+
} else {
|
|
23234
|
+
receipts.forEach((receipt, index) => {
|
|
23235
|
+
const result = validateVoiceObservabilityExportRecord(receipt, {
|
|
23236
|
+
kind: "delivery-receipt"
|
|
23237
|
+
});
|
|
23238
|
+
issues.push(...result.issues.map((issue) => ({
|
|
23239
|
+
...issue,
|
|
23240
|
+
path: `$.receipts.${index}${issue.path.slice(1)}`
|
|
23241
|
+
})));
|
|
23242
|
+
});
|
|
23243
|
+
}
|
|
23244
|
+
}
|
|
23245
|
+
return {
|
|
23246
|
+
issues,
|
|
23247
|
+
kind,
|
|
23248
|
+
ok: issues.length === 0,
|
|
23249
|
+
schema
|
|
23250
|
+
};
|
|
23251
|
+
};
|
|
23252
|
+
var assertVoiceObservabilityExportRecord = (input, options) => {
|
|
23253
|
+
const result = validateVoiceObservabilityExportRecord(input, options);
|
|
23254
|
+
if (!result.ok) {
|
|
23255
|
+
const firstIssue = result.issues[0];
|
|
23256
|
+
throw new Error(`Invalid voice observability export record: ${firstIssue?.path ?? "$"} ${firstIssue?.message ?? "unknown validation failure"}`);
|
|
23257
|
+
}
|
|
23258
|
+
return result;
|
|
23259
|
+
};
|
|
23001
23260
|
var isDeliveryStore = (value) => !Array.isArray(value) && typeof value.list === "function";
|
|
23002
23261
|
var getString17 = (value) => typeof value === "string" ? value : undefined;
|
|
23003
23262
|
var getProviderKind = (payload) => getString17(payload.kind) ?? getString17(payload.providerKind);
|
|
@@ -28463,6 +28722,7 @@ export {
|
|
|
28463
28722
|
verifyVoicePlivoWebhookSignature,
|
|
28464
28723
|
verifyVoiceOpsWebhookSignature,
|
|
28465
28724
|
validateVoiceWorkflowRouteResult,
|
|
28725
|
+
validateVoiceObservabilityExportRecord,
|
|
28466
28726
|
transcodeTwilioInboundPayloadToPCM16,
|
|
28467
28727
|
transcodePCMToTwilioOutboundPayload,
|
|
28468
28728
|
summarizeVoiceTurnQuality,
|
|
@@ -28922,6 +29182,7 @@ export {
|
|
|
28922
29182
|
assignVoiceOpsTask,
|
|
28923
29183
|
assertVoiceProviderRoutingContract,
|
|
28924
29184
|
assertVoiceObservabilityExportSchema,
|
|
29185
|
+
assertVoiceObservabilityExportRecord,
|
|
28925
29186
|
assertVoiceLatencySLOGate,
|
|
28926
29187
|
assertVoiceAgentSquadContract,
|
|
28927
29188
|
applyVoiceTelephonyOutcome,
|
|
@@ -21,6 +21,26 @@ export declare const assertVoiceObservabilityExportSchema: (input: {
|
|
|
21
21
|
version?: string;
|
|
22
22
|
};
|
|
23
23
|
}) => void;
|
|
24
|
+
export type VoiceObservabilityExportIngestedRecordKind = 'artifact-index' | 'database-record' | 'delivery-history' | 'delivery-receipt' | 'delivery-report' | 'manifest';
|
|
25
|
+
export type VoiceObservabilityExportValidationIssue = {
|
|
26
|
+
code: 'voice.observability.export.invalid_shape' | 'voice.observability.export.missing_field' | 'voice.observability.export.unsupported_schema';
|
|
27
|
+
message: string;
|
|
28
|
+
path: string;
|
|
29
|
+
};
|
|
30
|
+
export type VoiceObservabilityExportValidationResult = {
|
|
31
|
+
issues: VoiceObservabilityExportValidationIssue[];
|
|
32
|
+
kind?: VoiceObservabilityExportIngestedRecordKind;
|
|
33
|
+
ok: boolean;
|
|
34
|
+
schema?: {
|
|
35
|
+
id?: string;
|
|
36
|
+
version?: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type VoiceObservabilityExportRecordValidationOptions = {
|
|
40
|
+
kind?: VoiceObservabilityExportIngestedRecordKind;
|
|
41
|
+
};
|
|
42
|
+
export declare const validateVoiceObservabilityExportRecord: (input: unknown, options?: VoiceObservabilityExportRecordValidationOptions) => VoiceObservabilityExportValidationResult;
|
|
43
|
+
export declare const assertVoiceObservabilityExportRecord: (input: unknown, options?: VoiceObservabilityExportRecordValidationOptions) => VoiceObservabilityExportValidationResult;
|
|
24
44
|
export type VoiceObservabilityExportArtifactKind = 'incident' | 'markdown' | 'operations-record' | 'proof-pack' | 'readiness' | 'screenshot' | 'slo' | 'trace' | 'audit' | 'custom';
|
|
25
45
|
export type VoiceObservabilityExportArtifactChecksum = {
|
|
26
46
|
algorithm: 'sha256';
|