@absolutejs/voice 0.0.22-beta.413 → 0.0.22-beta.415
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 +2 -2
- package/dist/index.js +36 -1
- package/dist/observabilityExport.d.ts +1 -0
- package/dist/proofPack.d.ts +10 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -206,6 +206,6 @@ export type { PlivoInboundMessage, PlivoMediaStreamBridge, PlivoMediaStreamBridg
|
|
|
206
206
|
export type { VoiceTelephonyCarrierMatrix, VoiceTelephonyCarrierMatrixEntry, VoiceTelephonyCarrierMatrixInput, VoiceTelephonyCarrierMatrixOptions, VoiceTelephonyCarrierMatrixRoutesOptions, VoiceTelephonyCarrierMatrixStatus } from './telephony/matrix';
|
|
207
207
|
export { shapeTelephonyAssistantText } from './telephony/response';
|
|
208
208
|
export type { TelephonyResponseShapeMode, TelephonyResponseShapeOptions } from './telephony/response';
|
|
209
|
-
export { buildVoiceProofPack, buildVoiceProofPackFromObservabilityExport, createVoiceProofPackArtifacts, createVoiceProofPackOperationsRecordSection, createVoiceProofPackProductionReadinessSection, createVoiceProofPackProviderSloSection, createVoiceProofPackRoutes, createVoiceProofPackSupportBundleSection, renderVoiceProofPackMarkdown, writeVoiceProofPack } from './proofPack';
|
|
210
|
-
export type { VoiceProofPack, VoiceProofPackEvidence, VoiceProofPackInput, VoiceProofPackRoutesOptions, VoiceProofPackSection, VoiceProofPackStatus, VoiceProofPackWriteResult } from './proofPack';
|
|
209
|
+
export { buildVoiceProofPack, buildVoiceProofPackFromObservabilityExport, createVoiceProofPackStaleWhileRefreshSource, createVoiceProofPackArtifacts, createVoiceProofPackOperationsRecordSection, createVoiceProofPackProductionReadinessSection, createVoiceProofPackProviderSloSection, createVoiceProofPackRoutes, createVoiceProofPackSupportBundleSection, renderVoiceProofPackMarkdown, writeVoiceProofPack } from './proofPack';
|
|
210
|
+
export type { VoiceProofPack, VoiceProofPackEvidence, VoiceProofPackInput, VoiceProofPackRoutesOptions, VoiceProofPackSection, VoiceProofPackSourceValue, VoiceProofPackStatus, VoiceProofPackStaleWhileRefreshSourceOptions, VoiceProofPackWriteResult } from './proofPack';
|
|
211
211
|
export * from './types';
|
package/dist/index.js
CHANGED
|
@@ -32434,6 +32434,7 @@ var assertVoiceObservabilityExportRecord = (input, options) => {
|
|
|
32434
32434
|
}
|
|
32435
32435
|
return result;
|
|
32436
32436
|
};
|
|
32437
|
+
var resolveVoiceObservabilityArtifactIndex = async (source) => typeof source === "function" ? await source() : source;
|
|
32437
32438
|
var isDeliveryStore = (value) => !Array.isArray(value) && typeof value.list === "function";
|
|
32438
32439
|
var getString18 = (value) => typeof value === "string" ? value : undefined;
|
|
32439
32440
|
var getProviderKind = (payload) => getString18(payload.kind) ?? getString18(payload.providerKind);
|
|
@@ -33619,7 +33620,7 @@ var createVoiceObservabilityExportRoutes = (options = {}) => {
|
|
|
33619
33620
|
});
|
|
33620
33621
|
app.get(path, async () => Response.json(await buildReport(), { headers }));
|
|
33621
33622
|
if (artifactIndexPath !== false) {
|
|
33622
|
-
app.get(artifactIndexPath, async () => Response.json(buildVoiceObservabilityArtifactIndex(await buildReport()), { headers }));
|
|
33623
|
+
app.get(artifactIndexPath, async () => Response.json(options.artifactIndex ? await resolveVoiceObservabilityArtifactIndex(options.artifactIndex) : buildVoiceObservabilityArtifactIndex(await buildReport()), { headers }));
|
|
33623
33624
|
}
|
|
33624
33625
|
if (artifactDownloadPath !== false) {
|
|
33625
33626
|
app.get(`${artifactDownloadPath}/:artifactId`, async ({ params }) => {
|
|
@@ -39951,6 +39952,11 @@ import { Elysia as Elysia66 } from "elysia";
|
|
|
39951
39952
|
import { mkdir as mkdir5 } from "fs/promises";
|
|
39952
39953
|
import { dirname as dirname3, join as join4 } from "path";
|
|
39953
39954
|
var toGeneratedAt = (value) => value === undefined ? new Date().toISOString() : typeof value === "number" ? new Date(value).toISOString() : value;
|
|
39955
|
+
var getProofPackGeneratedAtMs = (proofPack) => {
|
|
39956
|
+
const generatedAt = buildVoiceProofPack(proofPack).generatedAt;
|
|
39957
|
+
const generatedAtMs = Date.parse(generatedAt);
|
|
39958
|
+
return Number.isFinite(generatedAtMs) ? generatedAtMs : 0;
|
|
39959
|
+
};
|
|
39954
39960
|
var summarizeProofPackSections = (sections) => {
|
|
39955
39961
|
let pass = 0;
|
|
39956
39962
|
let warn = 0;
|
|
@@ -40162,6 +40168,34 @@ var buildVoiceProofPack = (input) => {
|
|
|
40162
40168
|
summary
|
|
40163
40169
|
};
|
|
40164
40170
|
};
|
|
40171
|
+
var createVoiceProofPackStaleWhileRefreshSource = (options) => {
|
|
40172
|
+
const maxAgeMs = options.maxAgeMs ?? 5 * 60000;
|
|
40173
|
+
const now = options.now ?? Date.now;
|
|
40174
|
+
let refreshPromise;
|
|
40175
|
+
const refresh = async () => {
|
|
40176
|
+
const refreshed = await options.refresh();
|
|
40177
|
+
return refreshed ?? options.read();
|
|
40178
|
+
};
|
|
40179
|
+
const startRefresh = () => {
|
|
40180
|
+
refreshPromise ??= refresh().finally(() => {
|
|
40181
|
+
refreshPromise = undefined;
|
|
40182
|
+
});
|
|
40183
|
+
return refreshPromise;
|
|
40184
|
+
};
|
|
40185
|
+
return async () => {
|
|
40186
|
+
let current;
|
|
40187
|
+
try {
|
|
40188
|
+
current = await options.read();
|
|
40189
|
+
} catch {
|
|
40190
|
+
return startRefresh();
|
|
40191
|
+
}
|
|
40192
|
+
if (now() - getProofPackGeneratedAtMs(current) <= maxAgeMs) {
|
|
40193
|
+
return current;
|
|
40194
|
+
}
|
|
40195
|
+
startRefresh().catch((error) => options.onRefreshError?.(error));
|
|
40196
|
+
return current;
|
|
40197
|
+
};
|
|
40198
|
+
};
|
|
40165
40199
|
var buildVoiceProofPackFromObservabilityExport = (report, input = {}) => buildVoiceProofPack({
|
|
40166
40200
|
...input,
|
|
40167
40201
|
artifacts: report.artifacts,
|
|
@@ -40724,6 +40758,7 @@ export {
|
|
|
40724
40758
|
createVoiceProofTrendRecommendationRoutes,
|
|
40725
40759
|
createVoiceProofTraceStore,
|
|
40726
40760
|
createVoiceProofPackSupportBundleSection,
|
|
40761
|
+
createVoiceProofPackStaleWhileRefreshSource,
|
|
40727
40762
|
createVoiceProofPackRoutes,
|
|
40728
40763
|
createVoiceProofPackProviderSloSection,
|
|
40729
40764
|
createVoiceProofPackProductionReadinessSection,
|
|
@@ -399,6 +399,7 @@ export type VoiceObservabilityExportOptions = {
|
|
|
399
399
|
export type VoiceObservabilityExportRoutesOptions = VoiceObservabilityExportOptions & {
|
|
400
400
|
headers?: HeadersInit;
|
|
401
401
|
artifactDownloadPath?: false | string;
|
|
402
|
+
artifactIndex?: VoiceObservabilityExportArtifactIndex | (() => VoiceObservabilityExportArtifactIndex | Promise<VoiceObservabilityExportArtifactIndex>);
|
|
402
403
|
artifactIndexPath?: false | string;
|
|
403
404
|
deliveryDestinations?: VoiceObservabilityExportDeliveryDestination[];
|
|
404
405
|
deliveryPath?: false | string;
|
package/dist/proofPack.d.ts
CHANGED
|
@@ -53,12 +53,20 @@ export type VoiceProofPackWriteResult = {
|
|
|
53
53
|
markdownPath: string;
|
|
54
54
|
proofPack: VoiceProofPack;
|
|
55
55
|
};
|
|
56
|
+
export type VoiceProofPackSourceValue = VoiceProofPack | VoiceProofPackInput;
|
|
57
|
+
export type VoiceProofPackStaleWhileRefreshSourceOptions = {
|
|
58
|
+
maxAgeMs?: number;
|
|
59
|
+
now?: () => number;
|
|
60
|
+
onRefreshError?: (error: unknown) => void;
|
|
61
|
+
read: () => VoiceProofPackSourceValue | Promise<VoiceProofPackSourceValue>;
|
|
62
|
+
refresh: () => VoiceProofPackSourceValue | void | Promise<VoiceProofPackSourceValue | void>;
|
|
63
|
+
};
|
|
56
64
|
export type VoiceProofPackRoutesOptions = {
|
|
57
65
|
headers?: HeadersInit;
|
|
58
66
|
jsonPath?: false | string;
|
|
59
67
|
markdownPath?: false | string;
|
|
60
68
|
name?: string;
|
|
61
|
-
source:
|
|
69
|
+
source: VoiceProofPackSourceValue | (() => VoiceProofPackSourceValue | Promise<VoiceProofPackSourceValue>);
|
|
62
70
|
};
|
|
63
71
|
export declare const createVoiceProofPackProviderSloSection: (report: VoiceProviderSloReport, options?: {
|
|
64
72
|
href?: string;
|
|
@@ -77,6 +85,7 @@ export declare const createVoiceProofPackSupportBundleSection: (input: {
|
|
|
77
85
|
title?: string;
|
|
78
86
|
}) => VoiceProofPackSection;
|
|
79
87
|
export declare const buildVoiceProofPack: (input: VoiceProofPackInput | VoiceProofPack) => VoiceProofPack;
|
|
88
|
+
export declare const createVoiceProofPackStaleWhileRefreshSource: (options: VoiceProofPackStaleWhileRefreshSourceOptions) => () => Promise<VoiceProofPackSourceValue>;
|
|
80
89
|
export declare const buildVoiceProofPackFromObservabilityExport: (report: VoiceObservabilityExportReport, input?: Omit<VoiceProofPackInput, "artifacts" | "sections">) => VoiceProofPack;
|
|
81
90
|
export declare const renderVoiceProofPackMarkdown: (proofPack: VoiceProofPack) => string;
|
|
82
91
|
export declare const writeVoiceProofPack: (input: VoiceProofPackInput | VoiceProofPack, options?: {
|