@bicharts/chart-host 0.5.121 → 0.5.122

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.mjs CHANGED
@@ -2376,6 +2376,34 @@ function reconcileChartPick(pick, offered, autoLabel) {
2376
2376
  };
2377
2377
  }
2378
2378
 
2379
+ // src/clientIdentity.ts
2380
+ function stableFingerprintOptions() {
2381
+ return { exclude: ["fonts", "system.useragent", "system.browser.version"], logging: false };
2382
+ }
2383
+ function fnv1a(text) {
2384
+ let h2 = 2166136261;
2385
+ for (let i2 = 0; i2 < text.length; i2++) {
2386
+ h2 ^= text.charCodeAt(i2);
2387
+ h2 = Math.imul(h2, 16777619) >>> 0;
2388
+ }
2389
+ return h2 >>> 0;
2390
+ }
2391
+ function fingerprintComponentDigest(components) {
2392
+ if (!components || typeof components !== "object") return "";
2393
+ const parts = [];
2394
+ for (const [name2, value] of Object.entries(components)) {
2395
+ const timedOut = !!value && typeof value === "object" && value.timeout === "true";
2396
+ let text;
2397
+ try {
2398
+ text = JSON.stringify(value) ?? "undefined";
2399
+ } catch {
2400
+ text = String(value);
2401
+ }
2402
+ parts.push(`${name2}:${timedOut ? "timeout" : (fnv1a(text) >>> 16).toString(16).padStart(4, "0")}`);
2403
+ }
2404
+ return parts.join(",");
2405
+ }
2406
+
2379
2407
  // src/index.ts
2380
2408
  function registerCityTable(packed) {
2381
2409
  L3(packed);
@@ -2511,6 +2539,7 @@ export {
2511
2539
  explainRenderFailure,
2512
2540
  filterFitsChooser,
2513
2541
  filterQualifyRows,
2542
+ fingerprintComponentDigest,
2514
2543
  fitReadingFor,
2515
2544
  fitRenderedChart,
2516
2545
  formatSourceDate,
@@ -2592,6 +2621,7 @@ export {
2592
2621
  shouldOpenChooserOnGenerate,
2593
2622
  shouldOpenInlineChooserOnGenerate,
2594
2623
  shouldReview,
2624
+ stableFingerprintOptions,
2595
2625
  stripEsmExports,
2596
2626
  stripJsComments,
2597
2627
  svgInkReach,
@@ -0,0 +1,16 @@
1
+ /** Where a host's client id came from, reported on every request so identity durability is measured, not guessed.
2
+ * `persisted`: a minted id the host keeps; `fingerprint`: derived from the browser; `session`: neither was available,
3
+ * so the id lives for this session only. */
4
+ export type ClientIdSource = "persisted" | "fingerprint" | "session";
5
+ /** ThumbmarkJS options shared by every browser host. A fresh object each call, so no host can mutate another's. */
6
+ export declare function stableFingerprintOptions(): {
7
+ exclude: string[];
8
+ logging: boolean;
9
+ };
10
+ /**
11
+ * A short digest of each fingerprint component - `name:xxxx` joined by commas, in the library's own order - so a log
12
+ * line can say WHICH input moved when a host's fingerprint changes (the id alone cannot). A component the library gave
13
+ * up on (it times out after a few seconds and reports `{timeout: "true"}`) reads `name:timeout`, because a timed-out
14
+ * component alone changes the fingerprint. Opaque to every source value: 16 bits of a hash per component.
15
+ */
16
+ export declare function fingerprintComponentDigest(components: Record<string, unknown> | null | undefined): string;
@@ -37,3 +37,4 @@ export { resolveAutoColorScale, autoRampMinStep, autoRampCanvas, AUTO_RAMP_CLASS
37
37
  export { PENDING_RECOVERY_WINDOW_MS, PENDING_RECOVERY_POLL_MS, PENDING_RECOVERY_FIRST_POLL_MS, PENDING_RECOVERY_FAST_PHASE_MS, PENDING_RECOVERY_MID_POLL_MS, PENDING_RECOVERY_SLOW_PHASE_MS, PENDING_RECOVERY_SLOW_POLL_MS, pendingRecoveryNextDelayMs, encodePendingGenerate, parsePendingGenerate, markerArmedBlind, isBlindMarker, servedCorrelationProves, sameMarker, decidePendingRecovery, recoveryPollRunning, recoveryOwnsTheSentence, latePickupAction, latePickupKeepsMarker, pollGiveUpKeepsMarker, pendingRecoveryRemainingMs, transportFailureShouldRecover, TRANSPORT_LOST_CHECKING_MESSAGE, GENERATION_CANCELLED_MESSAGE, recoveryAnswerIsCancelled, generationCancelledMessage, type PendingGenerateMarker, type PendingRecoveryDecision, type LatePickupAction, } from "./pendingGenerate";
38
38
  export { stripJsComments } from "./codeComments";
39
39
  export { reconcileChartPick, type ChartPickReconciliation } from "./chartPick";
40
+ export { stableFingerprintOptions, fingerprintComponentDigest, type ClientIdSource } from "./clientIdentity";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.5.121",
3
+ "version": "0.5.122",
4
4
  "description": "Run a BIC-generated D3 chart in any web host: compiles the generated render() function, applies the shared option defaults, resolves mark clicks (through tooltip overlays), owns the selection affordance, and translates row indices between cross-filtered charts. The same contract the BIC Power BI visual implements, minus Power BI. React bindings at @bicharts/chart-host/react.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",