@holonograph/client 0.3.0 → 0.4.0
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 +192 -137
- package/dist/index.js +46 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4769,7 +4769,9 @@ var EvaluationEventKindSchema = external_exports.enum([
|
|
|
4769
4769
|
|
|
4770
4770
|
"analysis.conformance-fixture",
|
|
4771
4771
|
|
|
4772
|
-
"analysis.emission-coverage"
|
|
4772
|
+
"analysis.emission-coverage",
|
|
4773
|
+
|
|
4774
|
+
"analysis.delivery-orphan"
|
|
4773
4775
|
]);
|
|
4774
4776
|
var AvailabilityTransitionDirectionSchema = external_exports.enum([
|
|
4775
4777
|
"reachable->unreachable",
|
|
@@ -4957,6 +4959,16 @@ var EmissionCoverageSchema = external_exports.object({
|
|
|
4957
4959
|
|
|
4958
4960
|
observedAtMs: external_exports.number().int().nonnegative()
|
|
4959
4961
|
});
|
|
4962
|
+
var DeliveryOrphanSchema = external_exports.object({
|
|
4963
|
+
|
|
4964
|
+
darkEventId: external_exports.string().min(1),
|
|
4965
|
+
|
|
4966
|
+
emissionStreamId: external_exports.string().min(1),
|
|
4967
|
+
|
|
4968
|
+
surfaceId: external_exports.string().min(1),
|
|
4969
|
+
|
|
4970
|
+
witnessedAtMs: external_exports.number().int().nonnegative()
|
|
4971
|
+
});
|
|
4960
4972
|
var EvaluationEventSchema = external_exports.object({
|
|
4961
4973
|
|
|
4962
4974
|
eventId: external_exports.string().min(1),
|
|
@@ -4967,6 +4979,8 @@ var EvaluationEventSchema = external_exports.object({
|
|
|
4967
4979
|
|
|
4968
4980
|
correlationId: CorrelationIdSchema,
|
|
4969
4981
|
|
|
4982
|
+
emissionStreamId: external_exports.string().min(1).optional(),
|
|
4983
|
+
|
|
4970
4984
|
lensVersion: external_exports.string().min(1),
|
|
4971
4985
|
|
|
4972
4986
|
kind: EvaluationEventKindSchema.default("evaluation"),
|
|
@@ -4989,34 +5003,39 @@ var EvaluationEventSchema = external_exports.object({
|
|
|
4989
5003
|
|
|
4990
5004
|
conformanceFixtureRecord: ConformanceFixtureRecordSchema.optional(),
|
|
4991
5005
|
|
|
4992
|
-
emissionCoverage: EmissionCoverageSchema.optional()
|
|
5006
|
+
emissionCoverage: EmissionCoverageSchema.optional(),
|
|
5007
|
+
|
|
5008
|
+
deliveryOrphan: DeliveryOrphanSchema.optional()
|
|
4993
5009
|
}).refine(
|
|
4994
5010
|
(e) => {
|
|
4995
5011
|
if (e.kind === "evaluation") {
|
|
4996
|
-
return e.light !== void 0 && e.substrate !== void 0 && e.surface !== void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0;
|
|
5012
|
+
return e.light !== void 0 && e.substrate !== void 0 && e.surface !== void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0;
|
|
4997
5013
|
}
|
|
4998
5014
|
if (e.kind === "availability.transition") {
|
|
4999
|
-
return e.availability !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0;
|
|
5015
|
+
return e.availability !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0;
|
|
5000
5016
|
}
|
|
5001
5017
|
if (e.kind === "analysis.noise-floor-calibration") {
|
|
5002
|
-
return e.noiseFloorCalibration !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0;
|
|
5018
|
+
return e.noiseFloorCalibration !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0;
|
|
5003
5019
|
}
|
|
5004
5020
|
if (e.kind === "analysis.variance-decomposition") {
|
|
5005
|
-
return e.varianceDecomposition !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0;
|
|
5021
|
+
return e.varianceDecomposition !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0;
|
|
5006
5022
|
}
|
|
5007
5023
|
if (e.kind === "analysis.lifecycle-transition") {
|
|
5008
|
-
return e.lifecycleTransition !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0;
|
|
5024
|
+
return e.lifecycleTransition !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0;
|
|
5009
5025
|
}
|
|
5010
5026
|
if (e.kind === "analysis.eval-recommendation") {
|
|
5011
|
-
return e.evalRecommendation !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0;
|
|
5027
|
+
return e.evalRecommendation !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.conformanceFixtureRecord === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0;
|
|
5012
5028
|
}
|
|
5013
5029
|
if (e.kind === "analysis.conformance-fixture") {
|
|
5014
|
-
return e.conformanceFixtureRecord !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.emissionCoverage === void 0;
|
|
5030
|
+
return e.conformanceFixtureRecord !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.emissionCoverage === void 0 && e.deliveryOrphan === void 0;
|
|
5031
|
+
}
|
|
5032
|
+
if (e.kind === "analysis.emission-coverage") {
|
|
5033
|
+
return e.emissionCoverage !== void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0 && e.deliveryOrphan === void 0;
|
|
5015
5034
|
}
|
|
5016
|
-
return e.
|
|
5035
|
+
return e.deliveryOrphan !== void 0 && e.emissionCoverage === void 0 && e.light === void 0 && e.substrate === void 0 && e.surface === void 0 && e.availability === void 0 && e.noiseFloorCalibration === void 0 && e.varianceDecomposition === void 0 && e.lifecycleTransition === void 0 && e.evalRecommendation === void 0 && e.conformanceFixtureRecord === void 0;
|
|
5017
5036
|
},
|
|
5018
5037
|
{
|
|
5019
|
-
message: "EvaluationEvent shape invariant: each kind requires exactly its corresponding payload and forbids the others. kind='evaluation' \u2192 light+substrate+surface; kind='availability.transition' \u2192 availability; kind='analysis.noise-floor-calibration' \u2192 noiseFloorCalibration; kind='analysis.variance-decomposition' \u2192 varianceDecomposition; kind='analysis.lifecycle-transition' \u2192 lifecycleTransition; kind='analysis.eval-recommendation' \u2192 evalRecommendation; kind='analysis.conformance-fixture' \u2192 conformanceFixtureRecord; kind='analysis.emission-coverage' \u2192 emissionCoverage."
|
|
5038
|
+
message: "EvaluationEvent shape invariant: each kind requires exactly its corresponding payload and forbids the others. kind='evaluation' \u2192 light+substrate+surface; kind='availability.transition' \u2192 availability; kind='analysis.noise-floor-calibration' \u2192 noiseFloorCalibration; kind='analysis.variance-decomposition' \u2192 varianceDecomposition; kind='analysis.lifecycle-transition' \u2192 lifecycleTransition; kind='analysis.eval-recommendation' \u2192 evalRecommendation; kind='analysis.conformance-fixture' \u2192 conformanceFixtureRecord; kind='analysis.emission-coverage' \u2192 emissionCoverage; kind='analysis.delivery-orphan' \u2192 deliveryOrphan."
|
|
5020
5039
|
}
|
|
5021
5040
|
);
|
|
5022
5041
|
function newEventId(occurredAt = new Date()) {
|
|
@@ -5527,6 +5546,8 @@ var EvaluationEventEmitter = class {
|
|
|
5527
5546
|
|
|
5528
5547
|
lastSeq = -1;
|
|
5529
5548
|
|
|
5549
|
+
emitsSentinels;
|
|
5550
|
+
|
|
5530
5551
|
inFlight = null;
|
|
5531
5552
|
stopped = false;
|
|
5532
5553
|
constructor(opts) {
|
|
@@ -5538,6 +5559,7 @@ var EvaluationEventEmitter = class {
|
|
|
5538
5559
|
this.sentinelTargets = this.flushTargets.filter((t) => typeof t.emitSentinel === "function");
|
|
5539
5560
|
this.now = opts.now ?? Date.now;
|
|
5540
5561
|
this.streamId = opts.streamId ?? generateStreamId(this.now());
|
|
5562
|
+
this.emitsSentinels = opts.deployment !== "serverless";
|
|
5541
5563
|
this.onFlushError = opts.onFlushError ?? ((error) => {
|
|
5542
5564
|
console.warn("[holonograph] emit flush error:", error);
|
|
5543
5565
|
});
|
|
@@ -5554,9 +5576,10 @@ var EvaluationEventEmitter = class {
|
|
|
5554
5576
|
this.stopInterval = schedule(() => {
|
|
5555
5577
|
this.tick();
|
|
5556
5578
|
}, opts.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS);
|
|
5557
|
-
this.stopSentinelInterval = schedule(() => {
|
|
5579
|
+
this.stopSentinelInterval = this.emitsSentinels ? schedule(() => {
|
|
5558
5580
|
this.sentinelTick();
|
|
5559
|
-
}, opts.sentinelIntervalMs ?? DEFAULT_SENTINEL_INTERVAL_MS)
|
|
5581
|
+
}, opts.sentinelIntervalMs ?? DEFAULT_SENTINEL_INTERVAL_MS) : () => {
|
|
5582
|
+
};
|
|
5560
5583
|
}
|
|
5561
5584
|
|
|
5562
5585
|
enqueue(event) {
|
|
@@ -5564,7 +5587,8 @@ var EvaluationEventEmitter = class {
|
|
|
5564
5587
|
const seq = this.nextSeq;
|
|
5565
5588
|
this.nextSeq += 1;
|
|
5566
5589
|
this.lastSeq = seq;
|
|
5567
|
-
const
|
|
5590
|
+
const stamped = event.emissionStreamId === void 0 ? { ...event, emissionStreamId: this.streamId } : event;
|
|
5591
|
+
const accepted = this.buffer.offer({ event: stamped, seq, streamId: this.streamId });
|
|
5568
5592
|
this.accounting.recordOffer(nowMs, accepted);
|
|
5569
5593
|
this.accounting.maybeRollover(nowMs);
|
|
5570
5594
|
return event.eventId;
|
|
@@ -5581,6 +5605,7 @@ var EvaluationEventEmitter = class {
|
|
|
5581
5605
|
}
|
|
5582
5606
|
|
|
5583
5607
|
async emitSentinelNow(final) {
|
|
5608
|
+
if (!this.emitsSentinels) return;
|
|
5584
5609
|
if (this.sentinelTargets.length === 0) return;
|
|
5585
5610
|
const sentinel = { streamId: this.streamId, seq: this.lastSeq, final };
|
|
5586
5611
|
await Promise.all(
|
|
@@ -5961,7 +5986,14 @@ var HttpTransport = class {
|
|
|
5961
5986
|
otlpOpts.rawResponseLocation = mode === "dual" ? "http-channel" : "store";
|
|
5962
5987
|
flushTargets.push(new OtlpEventFlushTarget(otlpOpts));
|
|
5963
5988
|
}
|
|
5989
|
+
if (e.deployment === "serverless" && e.streamId === void 0) {
|
|
5990
|
+
throw new Error(
|
|
5991
|
+
"emit.deployment 'serverless' requires a stable emit.streamId (e.g. the function name) \u2014 a per-request id would make streamCount track calls, not emitters. Completeness for a serverless emitter comes from reconciliation over that stable stream."
|
|
5992
|
+
);
|
|
5993
|
+
}
|
|
5964
5994
|
const emitterOpts = { flushTargets, lensVersion };
|
|
5995
|
+
if (e.deployment !== void 0) emitterOpts.deployment = e.deployment;
|
|
5996
|
+
if (e.streamId !== void 0) emitterOpts.streamId = e.streamId;
|
|
5965
5997
|
if (e.bufferSize !== void 0) emitterOpts.bufferSize = e.bufferSize;
|
|
5966
5998
|
if (e.flushIntervalMs !== void 0) emitterOpts.flushIntervalMs = e.flushIntervalMs;
|
|
5967
5999
|
if (e.sentinelIntervalMs !== void 0) emitterOpts.sentinelIntervalMs = e.sentinelIntervalMs;
|
package/package.json
CHANGED