@supraio/client-daemon-js 1.0.0-mzbrightsigndecoder.482 → 1.0.0-mzbrightsigndecoder.485

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/sdk.js CHANGED
@@ -24830,7 +24830,7 @@ async function initBrightSignDecoder(options) {
24830
24830
  streamProtocol: options.brightSignDecoderStreamProtocol,
24831
24831
  streamOptions: options.brightSignStreamOptions ? { brightSign: options.brightSignStreamOptions } : void 0
24832
24832
  });
24833
- window.brightSignDecoder = decoder;
24833
+ window.brightSignDecoder = instrumentBrightSignDecoder(decoder);
24834
24834
  registerTeardown();
24835
24835
  updateNativeState({ lastEvent: "decoder-init-complete", decoder: "ready" });
24836
24836
  console.log("BrightSign decoder initialization complete");
@@ -24932,6 +24932,9 @@ function ensureNativeState() {
24932
24932
  decoder: "missing",
24933
24933
  lastEvent: "init",
24934
24934
  lastError: "",
24935
+ lastDiagnostics: "",
24936
+ decodeSuccessCount: 0,
24937
+ decodeFailureCount: 0,
24935
24938
  unloadCount: 0
24936
24939
  };
24937
24940
  window.__supraNativeState = state;
@@ -24953,6 +24956,64 @@ function describeError(value) {
24953
24956
  return String(value);
24954
24957
  }
24955
24958
  }
24959
+ function instrumentBrightSignDecoder(decoder) {
24960
+ var _a, _b;
24961
+ const originalDecodeAndRender = (_a = decoder.decodeAndRender) == null ? void 0 : _a.bind(decoder);
24962
+ if (typeof originalDecodeAndRender === "function") {
24963
+ decoder.decodeAndRender = async (...args) => {
24964
+ try {
24965
+ await originalDecodeAndRender(...args);
24966
+ recordDecoderSuccess("decoder-write-ok", decoder);
24967
+ } catch (error) {
24968
+ recordDecoderFailure("decoder-write-failed", error, decoder);
24969
+ throw error;
24970
+ }
24971
+ };
24972
+ }
24973
+ const originalDecodeAndRenderRef = (_b = decoder.decodeAndRenderRef) == null ? void 0 : _b.bind(decoder);
24974
+ if (typeof originalDecodeAndRenderRef === "function") {
24975
+ decoder.decodeAndRenderRef = async (...args) => {
24976
+ try {
24977
+ await originalDecodeAndRenderRef(...args);
24978
+ recordDecoderSuccess("decoder-write-ref-ok", decoder);
24979
+ } catch (error) {
24980
+ recordDecoderFailure("decoder-write-ref-failed", error, decoder);
24981
+ throw error;
24982
+ }
24983
+ };
24984
+ }
24985
+ return decoder;
24986
+ }
24987
+ function recordDecoderSuccess(event, decoder) {
24988
+ const nativeState = ensureNativeState();
24989
+ nativeState.decodeSuccessCount += 1;
24990
+ updateNativeState({
24991
+ lastEvent: event,
24992
+ lastDiagnostics: describeDiagnostics(decoder)
24993
+ });
24994
+ }
24995
+ function recordDecoderFailure(event, error, decoder) {
24996
+ const nativeState = ensureNativeState();
24997
+ nativeState.decodeFailureCount += 1;
24998
+ const diagnostics = describeDiagnostics(decoder);
24999
+ updateNativeState({
25000
+ lastEvent: event,
25001
+ lastError: describeError(error),
25002
+ lastDiagnostics: diagnostics
25003
+ });
25004
+ console.error("BrightSign decoder write failed", error, diagnostics);
25005
+ }
25006
+ function describeDiagnostics(decoder) {
25007
+ try {
25008
+ const getDiagnostics = Reflect.get(decoder, "getDiagnostics");
25009
+ if (typeof getDiagnostics === "function") {
25010
+ return JSON.stringify(Reflect.apply(getDiagnostics, decoder, []));
25011
+ }
25012
+ } catch (error) {
25013
+ return `diagnostics-error:${describeError(error)}`;
25014
+ }
25015
+ return "";
25016
+ }
24956
25017
 
24957
25018
  // screen/nacltcp.ts
24958
25019
  var import_nacl_decoder = __toESM(require_dist2());
@@ -24983,7 +25044,7 @@ async function initSamsungWasmTCP() {
24983
25044
  }
24984
25045
 
24985
25046
  // daemon/plain.ts
24986
- var DAEMON_JS_URL = "supra-client-daemon.js?v=1.0.0-mzbrightsigndecoder.482";
25047
+ var DAEMON_JS_URL = "supra-client-daemon.js?v=1.0.0-mzbrightsigndecoder.485";
24987
25048
  async function startPlainDaemon() {
24988
25049
  initBrightSignTCP();
24989
25050
  await initNaClTCP();
@@ -24997,7 +25058,7 @@ async function startPlainDaemon() {
24997
25058
  }
24998
25059
 
24999
25060
  // daemon/wasm.ts
25000
- var DAEMON_WASM_URL = "supra-client-daemon.wasm?v=1.0.0-mzbrightsigndecoder.482";
25061
+ var DAEMON_WASM_URL = "supra-client-daemon.wasm?v=1.0.0-mzbrightsigndecoder.485";
25001
25062
  async function startWasmDaemon() {
25002
25063
  initBrightSignTCP();
25003
25064
  await initNaClTCP();
@@ -25422,7 +25483,7 @@ function getGoArgv2(binFile, options) {
25422
25483
  }
25423
25484
 
25424
25485
  // screen/plain.ts
25425
- var SCREEN_JS_URL = "supra-client-screen.js?v=1.0.0-mzbrightsigndecoder.482";
25486
+ var SCREEN_JS_URL = "supra-client-screen.js?v=1.0.0-mzbrightsigndecoder.485";
25426
25487
  async function startPlainScreen(options) {
25427
25488
  var _a, _b, _c, _d;
25428
25489
  console.log("[Supra screen plain] initialization begin");
@@ -25484,7 +25545,7 @@ async function startPlainScreen(options) {
25484
25545
  }
25485
25546
 
25486
25547
  // screen/h264decoder.ts
25487
- var H264_DECODER_URL = "h264decoder.js?v=1.0.0-mzbrightsigndecoder.482";
25548
+ var H264_DECODER_URL = "h264decoder.js?v=1.0.0-mzbrightsigndecoder.485";
25488
25549
  async function initH264Decoder() {
25489
25550
  if (window.VideoDecoder !== void 0) {
25490
25551
  return void 0;
@@ -25523,7 +25584,7 @@ function getProperty(value, property) {
25523
25584
  }
25524
25585
 
25525
25586
  // screen/wasm.ts
25526
- var SCREEN_WASM_URL = "supra-client-screen.wasm?v=1.0.0-mzbrightsigndecoder.482";
25587
+ var SCREEN_WASM_URL = "supra-client-screen.wasm?v=1.0.0-mzbrightsigndecoder.485";
25527
25588
  async function initializePhase(name, initialize) {
25528
25589
  const startedAt = Date.now();
25529
25590
  console.log(`[Supra screen WASM] ${name} begin`);