@absolutejs/voice 0.0.22-beta.416 → 0.0.22-beta.417

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 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, createVoiceProofPackStaleWhileRefreshSource, createVoiceProofPackArtifacts, createVoiceProofPackOperationsRecordSection, createVoiceProofPackProductionReadinessSection, createVoiceProofPackProviderSloSection, createVoiceProofPackRoutes, createVoiceProofPackSupportBundleSection, renderVoiceProofPackMarkdown, writeVoiceProofPack } from './proofPack';
210
- export type { VoiceProofPack, VoiceProofPackEvidence, VoiceProofPackInput, VoiceProofPackRefreshState, VoiceProofPackRefreshStatus, VoiceProofPackRoutesOptions, VoiceProofPackSection, VoiceProofPackSourceValue, VoiceProofPackStatus, VoiceProofPackStaleWhileRefreshSource, VoiceProofPackStaleWhileRefreshSourceOptions, VoiceProofPackWriteResult } from './proofPack';
209
+ export { buildVoiceProofPack, buildVoiceProofPackFromObservabilityExport, createVoiceProofPackBuildContext, createVoiceProofPackStaleWhileRefreshSource, createVoiceProofPackArtifacts, createVoiceProofPackOperationsRecordSection, createVoiceProofPackProductionReadinessSection, createVoiceProofPackProviderSloSection, createVoiceProofPackRoutes, createVoiceProofPackSupportBundleSection, renderVoiceProofPackMarkdown, writeVoiceProofPack } from './proofPack';
210
+ export type { VoiceProofPack, VoiceProofPackBuildContext, VoiceProofPackBuildContextOptions, VoiceProofPackBuildTiming, VoiceProofPackEvidence, VoiceProofPackInput, VoiceProofPackRefreshState, VoiceProofPackRefreshStatus, VoiceProofPackRoutesOptions, VoiceProofPackSection, VoiceProofPackSourceValue, VoiceProofPackStatus, VoiceProofPackStaleWhileRefreshSource, VoiceProofPackStaleWhileRefreshSourceOptions, VoiceProofPackWriteResult } from './proofPack';
211
211
  export * from './types';
package/dist/index.js CHANGED
@@ -39981,6 +39981,48 @@ var summarizeProofPackSections = (sections) => {
39981
39981
  }
39982
39982
  return { fail, pass, sections: sections.length, warn };
39983
39983
  };
39984
+ var createVoiceProofPackBuildContext = (options = {}) => {
39985
+ const now = options.now ?? Date.now;
39986
+ const cachedValues = new Map;
39987
+ const timings = [];
39988
+ const time = async (label, run) => {
39989
+ const startedAt = now();
39990
+ try {
39991
+ return await run();
39992
+ } finally {
39993
+ const endedAt = now();
39994
+ const timing = {
39995
+ durationMs: Math.max(0, endedAt - startedAt),
39996
+ endedAt,
39997
+ label,
39998
+ startedAt
39999
+ };
40000
+ timings.push(timing);
40001
+ options.onTiming?.(timing);
40002
+ }
40003
+ };
40004
+ const cache = (key, loader) => {
40005
+ const cached = cachedValues.get(key);
40006
+ if (cached) {
40007
+ return cached;
40008
+ }
40009
+ const value = Promise.resolve(loader());
40010
+ cachedValues.set(key, value);
40011
+ return value;
40012
+ };
40013
+ return {
40014
+ cache,
40015
+ clear: (key) => {
40016
+ if (key === undefined) {
40017
+ cachedValues.clear();
40018
+ return;
40019
+ }
40020
+ cachedValues.delete(key);
40021
+ },
40022
+ getTimings: () => [...timings],
40023
+ time
40024
+ };
40025
+ };
39984
40026
  var toProofPackStatus = (status) => {
39985
40027
  if (status === "fail" || status === "failed") {
39986
40028
  return "fail";
@@ -40832,6 +40874,7 @@ export {
40832
40874
  createVoiceProofPackProviderSloSection,
40833
40875
  createVoiceProofPackProductionReadinessSection,
40834
40876
  createVoiceProofPackOperationsRecordSection,
40877
+ createVoiceProofPackBuildContext,
40835
40878
  createVoiceProofPackArtifacts,
40836
40879
  createVoiceProofAssertion,
40837
40880
  createVoiceProfileTraceTagger,
@@ -53,6 +53,22 @@ export type VoiceProofPackWriteResult = {
53
53
  markdownPath: string;
54
54
  proofPack: VoiceProofPack;
55
55
  };
56
+ export type VoiceProofPackBuildTiming = {
57
+ durationMs: number;
58
+ endedAt: number;
59
+ label: string;
60
+ startedAt: number;
61
+ };
62
+ export type VoiceProofPackBuildContext = {
63
+ cache: <TValue>(key: string, loader: () => Promise<TValue> | TValue) => Promise<TValue>;
64
+ clear: (key?: string) => void;
65
+ getTimings: () => VoiceProofPackBuildTiming[];
66
+ time: <TValue>(label: string, run: () => Promise<TValue> | TValue) => Promise<TValue>;
67
+ };
68
+ export type VoiceProofPackBuildContextOptions = {
69
+ now?: () => number;
70
+ onTiming?: (timing: VoiceProofPackBuildTiming) => void;
71
+ };
56
72
  export type VoiceProofPackSourceValue = VoiceProofPack | VoiceProofPackInput;
57
73
  export type VoiceProofPackStaleWhileRefreshSourceOptions = {
58
74
  maxAgeMs?: number;
@@ -83,6 +99,7 @@ export type VoiceProofPackRoutesOptions = {
83
99
  name?: string;
84
100
  source: VoiceProofPackSourceValue | (() => VoiceProofPackSourceValue | Promise<VoiceProofPackSourceValue>);
85
101
  };
102
+ export declare const createVoiceProofPackBuildContext: (options?: VoiceProofPackBuildContextOptions) => VoiceProofPackBuildContext;
86
103
  export declare const createVoiceProofPackProviderSloSection: (report: VoiceProviderSloReport, options?: {
87
104
  href?: string;
88
105
  title?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.416",
3
+ "version": "0.0.22-beta.417",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",