@ledgerhq/device-management-kit 1.0.0 → 1.0.1

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.
Files changed (85) hide show
  1. package/README.md +79 -0
  2. package/lib/cjs/package.json +1 -1
  3. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  4. package/lib/cjs/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
  5. package/lib/cjs/src/api/index.js +1 -1
  6. package/lib/cjs/src/api/index.js.map +3 -3
  7. package/lib/cjs/src/api/logger-subscriber/model/LogSubscriberOptions.js +1 -1
  8. package/lib/cjs/src/api/logger-subscriber/model/LogSubscriberOptions.js.map +1 -1
  9. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.js +1 -1
  10. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.js.map +2 -2
  11. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js +1 -1
  12. package/lib/cjs/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +2 -2
  13. package/lib/cjs/src/api/logger-subscriber/service/DefaultLogTagFormatter.js +2 -0
  14. package/lib/cjs/src/api/logger-subscriber/service/DefaultLogTagFormatter.js.map +7 -0
  15. package/lib/cjs/src/api/logger-subscriber/service/DefaultLogTagFormatter.test.js +2 -0
  16. package/lib/cjs/src/api/logger-subscriber/service/DefaultLogTagFormatter.test.js.map +7 -0
  17. package/lib/cjs/src/api/logger-subscriber/service/LogTagFormatter.js +2 -0
  18. package/lib/cjs/src/api/logger-subscriber/service/LogTagFormatter.js.map +7 -0
  19. package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
  20. package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +2 -2
  21. package/lib/cjs/src/internal/device-session/model/DeviceSession.test.js +2 -0
  22. package/lib/cjs/src/internal/device-session/model/DeviceSession.test.js.map +7 -0
  23. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  24. package/lib/cjs/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  25. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.js +1 -1
  26. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.js.map +3 -3
  27. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +1 -1
  28. package/lib/cjs/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js.map +3 -3
  29. package/lib/cjs/src/internal/logger-publisher/service/sanitiseData.js +2 -0
  30. package/lib/cjs/src/internal/logger-publisher/service/sanitiseData.js.map +7 -0
  31. package/lib/cjs/src/internal/logger-publisher/service/sanitiseData.test.js +2 -0
  32. package/lib/cjs/src/internal/logger-publisher/service/sanitiseData.test.js.map +7 -0
  33. package/lib/esm/package.json +1 -1
  34. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js +1 -1
  35. package/lib/esm/src/api/device-action/xstate-utils/XStateDeviceAction.js.map +3 -3
  36. package/lib/esm/src/api/index.js +1 -1
  37. package/lib/esm/src/api/index.js.map +3 -3
  38. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.js +1 -1
  39. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.js.map +2 -2
  40. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js +1 -1
  41. package/lib/esm/src/api/logger-subscriber/service/ConsoleLogger.test.js.map +2 -2
  42. package/lib/esm/src/api/logger-subscriber/service/DefaultLogTagFormatter.js +2 -0
  43. package/lib/esm/src/api/logger-subscriber/service/DefaultLogTagFormatter.js.map +7 -0
  44. package/lib/esm/src/api/logger-subscriber/service/DefaultLogTagFormatter.test.js +2 -0
  45. package/lib/esm/src/api/logger-subscriber/service/DefaultLogTagFormatter.test.js.map +7 -0
  46. package/lib/esm/src/api/logger-subscriber/service/LogTagFormatter.js +1 -0
  47. package/lib/esm/src/api/logger-subscriber/service/LogTagFormatter.js.map +7 -0
  48. package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
  49. package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +2 -2
  50. package/lib/esm/src/internal/device-session/model/DeviceSession.test.js +2 -0
  51. package/lib/esm/src/internal/device-session/model/DeviceSession.test.js.map +7 -0
  52. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js +1 -1
  53. package/lib/esm/src/internal/discovery/use-case/ConnectUseCase.js.map +3 -3
  54. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.js +1 -1
  55. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.js.map +3 -3
  56. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js +1 -1
  57. package/lib/esm/src/internal/logger-publisher/service/DefaultLoggerPublisherService.test.js.map +3 -3
  58. package/lib/esm/src/internal/logger-publisher/service/sanitiseData.js +2 -0
  59. package/lib/esm/src/internal/logger-publisher/service/sanitiseData.js.map +7 -0
  60. package/lib/esm/src/internal/logger-publisher/service/sanitiseData.test.js +2 -0
  61. package/lib/esm/src/internal/logger-publisher/service/sanitiseData.test.js.map +7 -0
  62. package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts +4 -0
  63. package/lib/types/src/api/device-action/xstate-utils/XStateDeviceAction.d.ts.map +1 -1
  64. package/lib/types/src/api/index.d.ts +2 -0
  65. package/lib/types/src/api/index.d.ts.map +1 -1
  66. package/lib/types/src/api/logger-subscriber/model/LogSubscriberOptions.d.ts +1 -0
  67. package/lib/types/src/api/logger-subscriber/model/LogSubscriberOptions.d.ts.map +1 -1
  68. package/lib/types/src/api/logger-subscriber/service/DefaultLogTagFormatter.d.ts +10 -0
  69. package/lib/types/src/api/logger-subscriber/service/DefaultLogTagFormatter.d.ts.map +1 -0
  70. package/lib/types/src/api/logger-subscriber/service/DefaultLogTagFormatter.test.d.ts +2 -0
  71. package/lib/types/src/api/logger-subscriber/service/DefaultLogTagFormatter.test.d.ts.map +1 -0
  72. package/lib/types/src/api/logger-subscriber/service/LogTagFormatter.d.ts +9 -0
  73. package/lib/types/src/api/logger-subscriber/service/LogTagFormatter.d.ts.map +1 -0
  74. package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
  75. package/lib/types/src/internal/device-session/model/DeviceSession.test.d.ts +2 -0
  76. package/lib/types/src/internal/device-session/model/DeviceSession.test.d.ts.map +1 -0
  77. package/lib/types/src/internal/discovery/use-case/ConnectUseCase.d.ts.map +1 -1
  78. package/lib/types/src/internal/logger-publisher/service/DefaultLoggerPublisherService.d.ts +5 -2
  79. package/lib/types/src/internal/logger-publisher/service/DefaultLoggerPublisherService.d.ts.map +1 -1
  80. package/lib/types/src/internal/logger-publisher/service/sanitiseData.d.ts +6 -0
  81. package/lib/types/src/internal/logger-publisher/service/sanitiseData.d.ts.map +1 -0
  82. package/lib/types/src/internal/logger-publisher/service/sanitiseData.test.d.ts +2 -0
  83. package/lib/types/src/internal/logger-publisher/service/sanitiseData.test.d.ts.map +1 -0
  84. package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
  85. package/package.json +4 -4
package/README.md CHANGED
@@ -369,3 +369,82 @@ observable.subscribe({
369
369
  ### Example in React
370
370
 
371
371
  Check [the sample app](https://github.com/LedgerHQ/device-sdk-ts/tree/develop/apps/sample) for an advanced example showcasing all possible usages of the Device Management Kit in a React app.
372
+
373
+ ## Developer tools
374
+
375
+ Some basic developer tools are available.
376
+ For now they allow to view logs from the Device Management Kit. They will have more advanced features soon.
377
+
378
+ ### JavaScript app
379
+
380
+ The devtools can be set up in any JavaScript runtime with WebSocket support. (e.g. web apps, React Native apps etc.)
381
+
382
+ #### Set up
383
+
384
+ Install those packages:
385
+
386
+ - `@ledgerhq/device-management-kit-devtools-core`
387
+ - `@ledgerhq/device-management-kit-devtools-websocket-common`
388
+ - `@ledgerhq/device-management-kit-devtools-websocket-connector`
389
+
390
+ ```ts
391
+ import { DevToolsLogger } from "@ledgerhq/device-management-kit-devtools-core";
392
+ import { DEFAULT_CLIENT_WS_URL } from "@ledgerhq/device-management-kit-devtools-websocket-common";
393
+ import { DevtoolsWebSocketConnector } from "@ledgerhq/device-management-kit-devtools-websocket-connector";
394
+
395
+ // Build the dev tools logger
396
+ function buildDevToolsLogger() {
397
+ const devToolsWebSocketConnector =
398
+ DevtoolsWebSocketConnector.getInstance().connect({
399
+ url: DEFAULT_CLIENT_WS_URL,
400
+ });
401
+ return new DevToolsLogger(devToolsWebSocketConnector);
402
+ }
403
+
404
+ // Pass the logger to your DMK builder
405
+ new DeviceManagementKitBuilder()
406
+ //...
407
+ .addLogger(buildDevToolsLogger())
408
+ .build();
409
+ ```
410
+
411
+ #### Usage
412
+
413
+ The devtools can be accessed as an Electron app.
414
+
415
+ 1. [Clone this repo and install dependencies](#Installation)
416
+ 2. Run `pnpm dev devtools`
417
+
418
+ ### React Native app (with Rozenite)
419
+
420
+ If you have [Rozenite](https://www.rozenite.dev/) already set up in your React Native app, the DMK developer tools can be accessed directly in the React Native DevTools.
421
+
422
+ #### Set up
423
+
424
+ Install those packages:
425
+
426
+ - `@ledgerhq/device-management-kit-devtools-core`
427
+ - `@ledgerhq/device-management-kit-devtools-rozenite`
428
+
429
+ ```ts
430
+ import { DevToolsLogger } from "@ledgerhq/device-management-kit-devtools-core";
431
+ import { RozeniteConnector } from "@ledgerhq/device-management-kit-devtools-rozenite";
432
+
433
+ // Build the dev tools logger
434
+ function buildDevToolsLogger() {
435
+ const connector = RozeniteConnector.getInstance();
436
+ return new DevToolsLogger(connector);
437
+ }
438
+
439
+ // Pass the logger to your DMK builder
440
+ new DeviceManagementKitBuilder()
441
+ //...
442
+ .addLogger(buildDevToolsLogger())
443
+ .build();
444
+ ```
445
+
446
+ #### Usage
447
+
448
+ 1. Run your React Native app
449
+ 2. [Open the React Native DevTools](https://reactnative.dev/docs/react-native-devtools)
450
+ 3. Navigate to the DMK Devtools tab
@@ -64,5 +64,5 @@
64
64
  "watch:builds": "pnpm ldmk-tool watch --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
65
65
  "watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\""
66
66
  },
67
- "version": "1.0.0"
67
+ "version": "1.0.1"
68
68
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var A=(a,e)=>{for(var t in e)s(a,t,{get:e[t],enumerable:!0})},E=(a,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!v.call(a,r)&&r!==t&&s(a,r,{get:()=>e[r],enumerable:!(n=b(e,r))||n.enumerable});return a};var x=a=>E(s({},"__esModule",{value:!0}),a);var M={};A(M,{XStateDeviceAction:()=>D});module.exports=x(M);var i=require("rxjs"),h=require("xstate"),c=require("../../device-action/model/DeviceActionState");class D{input;inspect=!1;constructor(e){this.input=e.input,this.inspect=!!e.inspect}_execute(e){const t=this.makeStateMachine(e);return this._subscribeToStateMachine(t)}_subscribeToStateMachine(e){const t=(0,h.createActor)(e,{input:this.input}),n=new i.ReplaySubject,r=o=>{const{context:u,status:m,output:S,error:I}=o;switch(m){case"active":n.next({status:c.DeviceActionStatus.Pending,intermediateValue:u.intermediateValue});break;case"done":S.caseOf({Left:p=>{n.next({status:c.DeviceActionStatus.Error,error:p})},Right:p=>{n.next({status:c.DeviceActionStatus.Completed,output:p})}}),n.complete();break;case"error":n.error(I),n.complete();break;case"stopped":n.next({status:c.DeviceActionStatus.Stopped}),n.complete();break;default:this._exhaustiveMatchingGuard(m)}},d=new i.Observable(o=>{const u=n.subscribe(o);return()=>{l.unsubscribe(),u.unsubscribe(),t.stop()}}),l=t.subscribe(r);return t.start(),{observable:d.pipe((0,i.share)()),cancel:()=>{t.stop(),l.unsubscribe(),r(t.getSnapshot())}}}_exhaustiveMatchingGuard(e){throw console.log("_exhaustiveMatchingGuard status",e),new Error(`Unhandled status: ${e}`)}}0&&(module.exports={XStateDeviceAction});
1
+ "use strict";var l=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var A=(a,e)=>{for(var t in e)l(a,t,{get:e[t],enumerable:!0})},D=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of v(e))!g.call(a,n)&&n!==t&&l(a,n,{get:()=>e[n],enumerable:!(r=y(e,n))||r.enumerable});return a};var E=a=>D(l({},"__esModule",{value:!0}),a);var M={};A(M,{XStateDeviceAction:()=>x});module.exports=E(M);var o=require("rxjs"),h=require("xstate"),p=require("../../device-action/model/DeviceActionState");class x{input;inspect=!1;logger;constructor(e){this.input=e.input,this.inspect=!!e.inspect,this.logger=e.logger}_execute(e){const t=this.makeStateMachine(e);return this._subscribeToStateMachine(t)}_subscribeToStateMachine(e){const t=(0,h.createActor)(e,{input:this.input}),r=new o.ReplaySubject;let n=!1;const m=i=>{const{context:u,status:s,output:b,error:I}=i;if(this.logger&&!n&&(n=!0,this.logger.debug("[XStateDeviceAction] Input",{data:{input:u.input}})),this.logger&&s==="active"){const c=typeof i.value=="string"?i.value:JSON.stringify(i.value);this.logger.debug(`[XStateDeviceAction] State: ${c}`,{data:{internalState:u._internalState}})}switch(s){case"active":r.next({status:p.DeviceActionStatus.Pending,intermediateValue:u.intermediateValue});break;case"done":b.caseOf({Left:c=>{r.next({status:p.DeviceActionStatus.Error,error:c})},Right:c=>{r.next({status:p.DeviceActionStatus.Completed,output:c})}}),r.complete();break;case"error":r.error(I),r.complete();break;case"stopped":r.next({status:p.DeviceActionStatus.Stopped}),r.complete();break;default:this._exhaustiveMatchingGuard(s)}},d=new o.Observable(i=>{const u=r.subscribe(i);return()=>{S.unsubscribe(),u.unsubscribe(),t.stop()}}),S=t.subscribe(m);return t.start(),{observable:d.pipe((0,o.share)()),cancel:()=>{t.stop(),S.unsubscribe(),m(t.getSnapshot())}}}_exhaustiveMatchingGuard(e){throw console.log("_exhaustiveMatchingGuard status",e),new Error(`Unhandled status: ${e}`)}}0&&(module.exports={XStateDeviceAction});
2
2
  //# sourceMappingURL=XStateDeviceAction.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/device-action/xstate-utils/XStateDeviceAction.ts"],
4
- "sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { Observable, ReplaySubject, share } from \"rxjs\";\nimport {\n createActor,\n type SnapshotFrom,\n type StateMachine,\n type StateSchema,\n} from \"xstate\";\n\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\n\nimport { type StateMachineTypes } from \"./StateMachineTypes\";\n\nexport type DeviceActionStateMachine<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> = StateMachine<\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"context\"], // context\n /**\n * The following usages `any` are OK because this is just a wrapper around the\n * state machine and we are not directly going to use these types.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any, // event\n any, // children\n any, // actor\n any, // action\n any, // guard\n any, // delay\n any, // state value\n any, // tag\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"input\"],\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"output\"],\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any,\n any,\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateSchema\n>;\n\n/**\n * A DeviceAction that uses an XState state machine to execute.\n * It maps the state machine snapshots to the DeviceActionState.\n * This class is abstract and should be extended to implement the state machine.\n */\nexport abstract class XStateDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> implements DeviceAction<Output, Input, Error, IntermediateValue>\n{\n readonly input: Input;\n readonly inspect: boolean = false;\n\n /**\n *\n * @param input The input for the DeviceAction\n * @param inspect If true, the state machine will be inspected in the browser\n */\n constructor(args: { input: Input; inspect?: boolean }) {\n this.input = args.input;\n this.inspect = Boolean(args.inspect);\n }\n\n protected abstract makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >;\n\n _execute(\n internalApi: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const stateMachine = this.makeStateMachine(internalApi);\n return this._subscribeToStateMachine(stateMachine);\n }\n\n protected _subscribeToStateMachine(\n stateMachine: DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const actor = createActor(stateMachine, {\n input: this.input,\n // optional inspector for debugging\n // inspect: this.inspect ? createBrowserInspector().inspect : undefined,\n });\n\n /**\n * Using a ReplaySubject is important because the first snapshots might be\n * emitted before the observable is subscribed (if the machine goes through\n * those states fully synchronously).\n * This way, we ensure that the subscriber always receives the latest snapshot.\n * */\n const subject = new ReplaySubject<\n DeviceActionState<Output, Error, IntermediateValue>\n >();\n\n const handleActorSnapshot = (\n snapshot: SnapshotFrom<typeof stateMachine>,\n ) => {\n const { context, status, output, error } = snapshot;\n switch (status) {\n case \"active\":\n subject.next({\n status: DeviceActionStatus.Pending,\n intermediateValue: context.intermediateValue,\n });\n break;\n case \"done\":\n output.caseOf({\n Left: (err) => {\n subject.next({\n status: DeviceActionStatus.Error,\n error: err,\n });\n },\n Right: (result) => {\n subject.next({\n status: DeviceActionStatus.Completed,\n output: result,\n });\n },\n });\n subject.complete();\n break;\n case \"error\":\n // this is an error in the execution of the state machine, it should not happen\n subject.error(error);\n subject.complete();\n break;\n case \"stopped\":\n subject.next({\n status: DeviceActionStatus.Stopped,\n });\n subject.complete();\n break;\n default:\n this._exhaustiveMatchingGuard(status);\n }\n };\n\n const observable = new Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n return () => {\n actorSubscription.unsubscribe();\n subjectSubscription.unsubscribe();\n actor.stop(); // stop the actor when the observable is unsubscribed\n };\n });\n\n const actorSubscription = actor.subscribe(handleActorSnapshot);\n actor.start();\n\n return {\n observable: observable.pipe(share()), // share to garantee that once there is no more observer, the actor is stopped\n cancel: () => {\n actor.stop();\n actorSubscription.unsubscribe();\n handleActorSnapshot(actor.getSnapshot());\n },\n };\n }\n\n private _exhaustiveMatchingGuard(status: never): never {\n console.log(\"_exhaustiveMatchingGuard status\", status);\n throw new Error(`Unhandled status: ${status}`);\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAiD,gBACjDC,EAKO,kBAQPC,EAGO,sDA2DA,MAAeJ,CAOtB,CACW,MACA,QAAmB,GAO5B,YAAYK,EAA2C,CACrD,KAAK,MAAQA,EAAK,MAClB,KAAK,QAAU,EAAQA,EAAK,OAC9B,CAYA,SACEC,EACiE,CACjE,MAAMC,EAAe,KAAK,iBAAiBD,CAAW,EACtD,OAAO,KAAK,yBAAyBC,CAAY,CACnD,CAEU,yBACRA,EAOiE,CACjE,MAAMC,KAAQ,eAAYD,EAAc,CACtC,MAAO,KAAK,KAGd,CAAC,EAQKE,EAAU,IAAI,gBAIdC,EACJC,GACG,CACH,KAAM,CAAE,QAAAC,EAAS,OAAAC,EAAQ,OAAAC,EAAQ,MAAAC,CAAM,EAAIJ,EAC3C,OAAQE,EAAQ,CACd,IAAK,SACHJ,EAAQ,KAAK,CACX,OAAQ,qBAAmB,QAC3B,kBAAmBG,EAAQ,iBAC7B,CAAC,EACD,MACF,IAAK,OACHE,EAAO,OAAO,CACZ,KAAOE,GAAQ,CACbP,EAAQ,KAAK,CACX,OAAQ,qBAAmB,MAC3B,MAAOO,CACT,CAAC,CACH,EACA,MAAQC,GAAW,CACjBR,EAAQ,KAAK,CACX,OAAQ,qBAAmB,UAC3B,OAAQQ,CACV,CAAC,CACH,CACF,CAAC,EACDR,EAAQ,SAAS,EACjB,MACF,IAAK,QAEHA,EAAQ,MAAMM,CAAK,EACnBN,EAAQ,SAAS,EACjB,MACF,IAAK,UACHA,EAAQ,KAAK,CACX,OAAQ,qBAAmB,OAC7B,CAAC,EACDA,EAAQ,SAAS,EACjB,MACF,QACE,KAAK,yBAAyBI,CAAM,CACxC,CACF,EAEMK,EAAa,IAAI,aAEpBC,GAAe,CAChB,MAAMC,EAAsBX,EAAQ,UAAUU,CAAU,EACxD,MAAO,IAAM,CACXE,EAAkB,YAAY,EAC9BD,EAAoB,YAAY,EAChCZ,EAAM,KAAK,CACb,CACF,CAAC,EAEKa,EAAoBb,EAAM,UAAUE,CAAmB,EAC7D,OAAAF,EAAM,MAAM,EAEL,CACL,WAAYU,EAAW,QAAK,SAAM,CAAC,EACnC,OAAQ,IAAM,CACZV,EAAM,KAAK,EACXa,EAAkB,YAAY,EAC9BX,EAAoBF,EAAM,YAAY,CAAC,CACzC,CACF,CACF,CAEQ,yBAAyBK,EAAsB,CACrD,cAAQ,IAAI,kCAAmCA,CAAM,EAC/C,IAAI,MAAM,qBAAqBA,CAAM,EAAE,CAC/C,CACF",
6
- "names": ["XStateDeviceAction_exports", "__export", "XStateDeviceAction", "__toCommonJS", "import_rxjs", "import_xstate", "import_DeviceActionState", "args", "internalApi", "stateMachine", "actor", "subject", "handleActorSnapshot", "snapshot", "context", "status", "output", "error", "err", "result", "observable", "subscriber", "subjectSubscription", "actorSubscription"]
4
+ "sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { Observable, ReplaySubject, share } from \"rxjs\";\nimport {\n createActor,\n type SnapshotFrom,\n type StateMachine,\n type StateSchema,\n} from \"xstate\";\n\nimport {\n type DeviceAction,\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n type InternalApi,\n} from \"@api/device-action/DeviceAction\";\nimport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nimport { type DmkError } from \"@api/Error\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\n\nimport { type StateMachineTypes } from \"./StateMachineTypes\";\n\nexport type DeviceActionStateMachine<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> = StateMachine<\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"context\"], // context\n /**\n * The following usages `any` are OK because this is just a wrapper around the\n * state machine and we are not directly going to use these types.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any, // event\n any, // children\n any, // actor\n any, // action\n any, // guard\n any, // delay\n any, // state value\n any, // tag\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"input\"],\n StateMachineTypes<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >[\"output\"],\n /* eslint-disable @typescript-eslint/no-explicit-any */\n any,\n any,\n /* eslint-enable @typescript-eslint/no-explicit-any */\n StateSchema\n>;\n\n/**\n * A DeviceAction that uses an XState state machine to execute.\n * It maps the state machine snapshots to the DeviceActionState.\n * This class is abstract and should be extended to implement the state machine.\n */\nexport abstract class XStateDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n InternalState,\n> implements DeviceAction<Output, Input, Error, IntermediateValue>\n{\n readonly input: Input;\n readonly inspect: boolean = false;\n protected readonly logger?: LoggerPublisherService;\n\n /**\n *\n * @param input The input for the DeviceAction\n * @param inspect If true, the state machine will be inspected in the browser\n * @param logger Optional logger for debugging. If provided, input and internal state will be logged on state transitions.\n */\n constructor(args: {\n input: Input;\n inspect?: boolean;\n logger?: LoggerPublisherService;\n }) {\n this.input = args.input;\n this.inspect = Boolean(args.inspect);\n this.logger = args.logger;\n }\n\n protected abstract makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >;\n\n _execute(\n internalApi: InternalApi,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const stateMachine = this.makeStateMachine(internalApi);\n return this._subscribeToStateMachine(stateMachine);\n }\n\n protected _subscribeToStateMachine(\n stateMachine: DeviceActionStateMachine<\n Output,\n Input,\n Error,\n IntermediateValue,\n InternalState\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n const actor = createActor(stateMachine, {\n input: this.input,\n // optional inspector for debugging\n // inspect: this.inspect ? createBrowserInspector().inspect : undefined,\n });\n\n /**\n * Using a ReplaySubject is important because the first snapshots might be\n * emitted before the observable is subscribed (if the machine goes through\n * those states fully synchronously).\n * This way, we ensure that the subscriber always receives the latest snapshot.\n * */\n const subject = new ReplaySubject<\n DeviceActionState<Output, Error, IntermediateValue>\n >();\n\n let hasLoggedInput = false;\n\n const handleActorSnapshot = (\n snapshot: SnapshotFrom<typeof stateMachine>,\n ) => {\n const { context, status, output, error } = snapshot;\n\n // Log input once at the beginning\n if (this.logger && !hasLoggedInput) {\n hasLoggedInput = true;\n this.logger.debug(\"[XStateDeviceAction] Input\", {\n data: { input: context.input },\n });\n }\n\n // Log internal state on each state transition\n if (this.logger && status === \"active\") {\n const stateValue =\n typeof snapshot.value === \"string\"\n ? snapshot.value\n : JSON.stringify(snapshot.value);\n this.logger.debug(`[XStateDeviceAction] State: ${stateValue}`, {\n data: { internalState: context._internalState },\n });\n }\n\n switch (status) {\n case \"active\":\n subject.next({\n status: DeviceActionStatus.Pending,\n intermediateValue: context.intermediateValue,\n });\n break;\n case \"done\":\n output.caseOf({\n Left: (err) => {\n subject.next({\n status: DeviceActionStatus.Error,\n error: err,\n });\n },\n Right: (result) => {\n subject.next({\n status: DeviceActionStatus.Completed,\n output: result,\n });\n },\n });\n subject.complete();\n break;\n case \"error\":\n // this is an error in the execution of the state machine, it should not happen\n subject.error(error);\n subject.complete();\n break;\n case \"stopped\":\n subject.next({\n status: DeviceActionStatus.Stopped,\n });\n subject.complete();\n break;\n default:\n this._exhaustiveMatchingGuard(status);\n }\n };\n\n const observable = new Observable<\n DeviceActionState<Output, Error, IntermediateValue>\n >((subscriber) => {\n const subjectSubscription = subject.subscribe(subscriber);\n return () => {\n actorSubscription.unsubscribe();\n subjectSubscription.unsubscribe();\n actor.stop(); // stop the actor when the observable is unsubscribed\n };\n });\n\n const actorSubscription = actor.subscribe(handleActorSnapshot);\n actor.start();\n\n return {\n observable: observable.pipe(share()), // share to garantee that once there is no more observer, the actor is stopped\n cancel: () => {\n actor.stop();\n actorSubscription.unsubscribe();\n handleActorSnapshot(actor.getSnapshot());\n },\n };\n }\n\n private _exhaustiveMatchingGuard(status: never): never {\n console.log(\"_exhaustiveMatchingGuard status\", status);\n throw new Error(`Unhandled status: ${status}`);\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAiD,gBACjDC,EAKO,kBAQPC,EAGO,sDA4DA,MAAeJ,CAOtB,CACW,MACA,QAAmB,GACT,OAQnB,YAAYK,EAIT,CACD,KAAK,MAAQA,EAAK,MAClB,KAAK,QAAU,EAAQA,EAAK,QAC5B,KAAK,OAASA,EAAK,MACrB,CAYA,SACEC,EACiE,CACjE,MAAMC,EAAe,KAAK,iBAAiBD,CAAW,EACtD,OAAO,KAAK,yBAAyBC,CAAY,CACnD,CAEU,yBACRA,EAOiE,CACjE,MAAMC,KAAQ,eAAYD,EAAc,CACtC,MAAO,KAAK,KAGd,CAAC,EAQKE,EAAU,IAAI,gBAIpB,I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OAAAH,EAAM,MAAM,EAEL,CACL,WAAYY,EAAW,QAAK,SAAM,CAAC,EACnC,OAAQ,IAAM,CACZZ,EAAM,KAAK,EACXe,EAAkB,YAAY,EAC9BZ,EAAoBH,EAAM,YAAY,CAAC,CACzC,CACF,CACF,CAEQ,yBAAyBM,EAAsB,CACrD,cAAQ,IAAI,kCAAmCA,CAAM,EAC/C,IAAI,MAAM,qBAAqBA,CAAM,EAAE,CAC/C,CACF",
6
+ "names": ["XStateDeviceAction_exports", "__export", "XStateDeviceAction", "__toCommonJS", "import_rxjs", "import_xstate", "import_DeviceActionState", "args", "internalApi", "stateMachine", "actor", "subject", "hasLoggedInput", "handleActorSnapshot", "snapshot", "context", "status", "output", "error", "stateValue", "err", "result", "observable", "subscriber", "subjectSubscription", "actorSubscription"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var le=(p,o)=>{for(var i in o)u(p,i,{get:o[i],enumerable:!0})},l=(p,o,i,v)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of Ae(o))!De.call(p,s)&&s!==i&&u(p,s,{get:()=>o[s],enumerable:!(v=de(o,s))||v.enumerable});return p},r=(p,o,i)=>(l(p,o,"default"),i&&l(i,o,"default"));var ue=p=>l(u({},"__esModule",{value:!0}),p);var e={};le(e,{APDU_MAX_PAYLOAD:()=>c.APDU_MAX_PAYLOAD,Apdu:()=>S.Apdu,ApduBuilder:()=>c.ApduBuilder,ApduParser:()=>C.ApduParser,ApduResponse:()=>j.ApduResponse,AppAlreadyInstalledDAError:()=>t.AppAlreadyInstalledDAError,BatteryStatusType:()=>x.BatteryStatusType,BleDeviceInfos:()=>N.BleDeviceInfos,ByteArrayBuilder:()=>y.ByteArrayBuilder,ByteArrayParser:()=>L.ByteArrayParser,CallTaskInAppDeviceAction:()=>U.CallTaskInAppDeviceAction,CloseAppCommand:()=>g.CloseAppCommand,CommandResultFactory:()=>n.CommandResultFactory,CommandResultStatus:()=>n.CommandResultStatus,CommandUtils:()=>O.CommandUtils,ConnectedDevice:()=>se.ConnectedDevice,ConsoleLogger:()=>me.ConsoleLogger,DeviceActionStatus:()=>h.DeviceActionStatus,DeviceConnectionStateMachine:()=>ce.DeviceConnectionStateMachine,DeviceLockedError:()=>t.DeviceLockedError,DeviceManagementKit:()=>pe.DeviceManagementKit,DeviceManagementKitBuilder:()=>ie.DeviceManagementKitBuilder,DeviceModel:()=>m.DeviceModel,DeviceModelId:()=>m.DeviceModelId,DeviceSessionStateType:()=>z.DeviceSessionStateType,DeviceStatus:()=>b.DeviceStatus,FramerUtils:()=>te.FramerUtils,GenuineCheckDeviceAction:()=>J.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>E.GetAppAndVersionCommand,GetBatteryStatusCommand:()=>x.GetBatteryStatusCommand,GetDeviceMetadataDeviceAction:()=>P.GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction:()=>V.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>B.GetOsVersionCommand,GlobalCommandError:()=>d.GlobalCommandError,GlobalCommandErrorHandler:()=>d.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>k.GoToDashboardDeviceAction,InstallAppDeviceAction:()=>Q.InstallAppDeviceAction,InstallOrUpdateAppsDeviceAction:()=>F.InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError:()=>f.InvalidGetFirmwareMetadataResponseError,InvalidStatusWordError:()=>f.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>m.LEDGER_VENDOR_ID,ListAppsCommand:()=>G.ListAppsCommand,ListAppsDeviceAction:()=>W.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>_.ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction:()=>Z.ListInstalledAppsDeviceAction,LoadCertificateCommand:()=>R.LoadCertificateCommand,LogLevel:()=>ne.LogLevel,OpenAppCommand:()=>M.OpenAppCommand,OpenAppDeviceAction:()=>w.OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction:()=>H.OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError:()=>t.OutOfMemoryDAError,RefusedByUserDAError:()=>t.RefusedByUserDAError,SecureChannelError:()=>ee.SecureChannelError,SendCommandInAppDeviceAction:()=>K.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>q.StaticDeviceModelDataSource,TransportConnectedDevice:()=>fe.TransportConnectedDevice,TransportDeviceModel:()=>Y.TransportDeviceModel,UninstallAppDeviceAction:()=>$.UninstallAppDeviceAction,UnknownDAError:()=>t.UnknownDAError,UnsupportedFirmwareDAError:()=>t.UnsupportedFirmwareDAError,UserInteractionRequired:()=>T.UserInteractionRequired,WebLogsExporterLogger:()=>ae.WebLogsExporterLogger,XStateDeviceAction:()=>X.XStateDeviceAction,base64StringToBuffer:()=>D.base64StringToBuffer,bufferToHexaString:()=>a.bufferToHexaString,connectedDeviceStubBuilder:()=>xe.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>re.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>oe.defaultApduSenderServiceStubBuilder,formatApduReceivedLog:()=>A.formatApduReceivedLog,formatApduSentLog:()=>A.formatApduSentLog,hexaStringToBuffer:()=>a.hexaStringToBuffer,isBase64String:()=>D.isBase64String,isCommandErrorCode:()=>I.isCommandErrorCode,isHexaString:()=>a.isHexaString,isSuccessCommandResult:()=>n.isSuccessCommandResult});module.exports=ue(e);var S=require("./apdu/model/Apdu"),c=require("./apdu/utils/ApduBuilder"),C=require("./apdu/utils/ApduParser");r(e,require("./apdu/utils/AppBuilderError"),module.exports);var y=require("./apdu/utils/ByteArrayBuilder"),L=require("./apdu/utils/ByteArrayParser"),f=require("./command/Errors"),n=require("./command/model/CommandResult"),g=require("./command/os/CloseAppCommand"),E=require("./command/os/GetAppAndVersionCommand"),x=require("./command/os/GetBatteryStatusCommand"),B=require("./command/os/GetOsVersionCommand"),G=require("./command/os/ListAppsCommand"),R=require("./command/os/LoadCertificateCommand"),M=require("./command/os/OpenAppCommand"),I=require("./command/utils/CommandErrors"),O=require("./command/utils/CommandUtils"),d=require("./command/utils/GlobalCommandError"),m=require("./device/DeviceModel"),b=require("./device/DeviceStatus"),h=require("./device-action/model/DeviceActionState"),T=require("./device-action/model/UserInteractionRequired"),U=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),t=require("./device-action/os/Errors"),P=require("./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction"),V=require("./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),k=require("./device-action/os/GoToDashboard/GoToDashboardDeviceAction"),F=require("./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction"),W=require("./device-action/os/ListApps/ListAppsDeviceAction"),_=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),w=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),H=require("./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction"),K=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),X=require("./device-action/xstate-utils/XStateDeviceAction"),q=require("./device-model/data/StaticDeviceModelDataSource"),N=require("./device-model/model/BleDeviceInfos"),Y=require("./device-model/model/DeviceModel"),j=require("./device-session/ApduResponse");r(e,require("./device-session/data/FramerConst"),module.exports);var z=require("./device-session/DeviceSessionState"),J=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),Q=require("./secure-channel/device-action/InstallApp/InstallAppDeviceAction"),Z=require("./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),$=require("./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction"),ee=require("../internal/secure-channel/model/Errors"),re=require("./device-session/service/DefaultApduReceiverService.stub"),oe=require("./device-session/service/DefaultApduSenderService.stub"),te=require("./device-session/utils/FramerUtils"),pe=require("./DeviceManagementKit"),ie=require("./DeviceManagementKitBuilder");r(e,require("./Error"),module.exports);var ne=require("./logger-subscriber/model/LogLevel"),me=require("./logger-subscriber/service/ConsoleLogger"),ae=require("./logger-subscriber/service/WebLogsExporterLogger"),se=require("./transport/model/ConnectedDevice"),ce=require("./transport/model/DeviceConnectionStateMachine");r(e,require("./transport/model/Errors"),module.exports);var fe=require("./transport/model/TransportConnectedDevice"),xe=require("./transport/model/TransportConnectedDevice.stub");r(e,require("./types"),module.exports);var A=require("./utils/apduLogs"),D=require("./utils/Base64String"),a=require("./utils/HexaString");0&&(module.exports={APDU_MAX_PAYLOAD,Apdu,ApduBuilder,ApduParser,ApduResponse,AppAlreadyInstalledDAError,BatteryStatusType,BleDeviceInfos,ByteArrayBuilder,ByteArrayParser,CallTaskInAppDeviceAction,CloseAppCommand,CommandResultFactory,CommandResultStatus,CommandUtils,ConnectedDevice,ConsoleLogger,DeviceActionStatus,DeviceConnectionStateMachine,DeviceLockedError,DeviceManagementKit,DeviceManagementKitBuilder,DeviceModel,DeviceModelId,DeviceSessionStateType,DeviceStatus,FramerUtils,GenuineCheckDeviceAction,GetAppAndVersionCommand,GetBatteryStatusCommand,GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction,GetOsVersionCommand,GlobalCommandError,GlobalCommandErrorHandler,GoToDashboardDeviceAction,InstallAppDeviceAction,InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError,InvalidStatusWordError,LEDGER_VENDOR_ID,ListAppsCommand,ListAppsDeviceAction,ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction,LoadCertificateCommand,LogLevel,OpenAppCommand,OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError,RefusedByUserDAError,SecureChannelError,SendCommandInAppDeviceAction,StaticDeviceModelDataSource,TransportConnectedDevice,TransportDeviceModel,UninstallAppDeviceAction,UnknownDAError,UnsupportedFirmwareDAError,UserInteractionRequired,WebLogsExporterLogger,XStateDeviceAction,base64StringToBuffer,bufferToHexaString,connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder,formatApduReceivedLog,formatApduSentLog,hexaStringToBuffer,isBase64String,isCommandErrorCode,isHexaString,isSuccessCommandResult,...require("./apdu/utils/AppBuilderError"),...require("./device-session/data/FramerConst"),...require("./Error"),...require("./transport/model/Errors"),...require("./types")});
1
+ "use strict";var u=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var le=Object.prototype.hasOwnProperty;var ue=(p,o)=>{for(var i in o)u(p,i,{get:o[i],enumerable:!0})},l=(p,o,i,v)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of De(o))!le.call(p,s)&&s!==i&&u(p,s,{get:()=>o[s],enumerable:!(v=Ae(o,s))||v.enumerable});return p},r=(p,o,i)=>(l(p,o,"default"),i&&l(i,o,"default"));var ve=p=>l(u({},"__esModule",{value:!0}),p);var e={};ue(e,{APDU_MAX_PAYLOAD:()=>f.APDU_MAX_PAYLOAD,Apdu:()=>S.Apdu,ApduBuilder:()=>f.ApduBuilder,ApduParser:()=>y.ApduParser,ApduResponse:()=>j.ApduResponse,AppAlreadyInstalledDAError:()=>t.AppAlreadyInstalledDAError,BatteryStatusType:()=>x.BatteryStatusType,BleDeviceInfos:()=>N.BleDeviceInfos,ByteArrayBuilder:()=>C.ByteArrayBuilder,ByteArrayParser:()=>g.ByteArrayParser,CallTaskInAppDeviceAction:()=>U.CallTaskInAppDeviceAction,CloseAppCommand:()=>L.CloseAppCommand,CommandResultFactory:()=>m.CommandResultFactory,CommandResultStatus:()=>m.CommandResultStatus,CommandUtils:()=>O.CommandUtils,ConnectedDevice:()=>fe.ConnectedDevice,ConsoleLogger:()=>ne.ConsoleLogger,DefaultLogTagFormatter:()=>ae.DefaultLogTagFormatter,DeviceActionStatus:()=>b.DeviceActionStatus,DeviceConnectionStateMachine:()=>ce.DeviceConnectionStateMachine,DeviceLockedError:()=>t.DeviceLockedError,DeviceManagementKit:()=>pe.DeviceManagementKit,DeviceManagementKitBuilder:()=>ie.DeviceManagementKitBuilder,DeviceModel:()=>n.DeviceModel,DeviceModelId:()=>n.DeviceModelId,DeviceSessionStateType:()=>z.DeviceSessionStateType,DeviceStatus:()=>T.DeviceStatus,FramerUtils:()=>te.FramerUtils,GenuineCheckDeviceAction:()=>J.GenuineCheckDeviceAction,GetAppAndVersionCommand:()=>E.GetAppAndVersionCommand,GetBatteryStatusCommand:()=>x.GetBatteryStatusCommand,GetDeviceMetadataDeviceAction:()=>F.GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction:()=>P.GetDeviceStatusDeviceAction,GetOsVersionCommand:()=>B.GetOsVersionCommand,GlobalCommandError:()=>d.GlobalCommandError,GlobalCommandErrorHandler:()=>d.GlobalCommandErrorHandler,GoToDashboardDeviceAction:()=>V.GoToDashboardDeviceAction,InstallAppDeviceAction:()=>Q.InstallAppDeviceAction,InstallOrUpdateAppsDeviceAction:()=>k.InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError:()=>c.InvalidGetFirmwareMetadataResponseError,InvalidStatusWordError:()=>c.InvalidStatusWordError,LEDGER_VENDOR_ID:()=>n.LEDGER_VENDOR_ID,ListAppsCommand:()=>G.ListAppsCommand,ListAppsDeviceAction:()=>W.ListAppsDeviceAction,ListAppsWithMetadataDeviceAction:()=>_.ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction:()=>Z.ListInstalledAppsDeviceAction,LoadCertificateCommand:()=>R.LoadCertificateCommand,LogLevel:()=>me.LogLevel,OpenAppCommand:()=>M.OpenAppCommand,OpenAppDeviceAction:()=>w.OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction:()=>H.OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError:()=>t.OutOfMemoryDAError,RefusedByUserDAError:()=>t.RefusedByUserDAError,SecureChannelError:()=>ee.SecureChannelError,SendCommandInAppDeviceAction:()=>K.SendCommandInAppDeviceAction,StaticDeviceModelDataSource:()=>q.StaticDeviceModelDataSource,TransportConnectedDevice:()=>xe.TransportConnectedDevice,TransportDeviceModel:()=>Y.TransportDeviceModel,UninstallAppDeviceAction:()=>$.UninstallAppDeviceAction,UnknownDAError:()=>t.UnknownDAError,UnsupportedFirmwareDAError:()=>t.UnsupportedFirmwareDAError,UserInteractionRequired:()=>h.UserInteractionRequired,WebLogsExporterLogger:()=>se.WebLogsExporterLogger,XStateDeviceAction:()=>X.XStateDeviceAction,base64StringToBuffer:()=>D.base64StringToBuffer,bufferToHexaString:()=>a.bufferToHexaString,connectedDeviceStubBuilder:()=>de.connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder:()=>re.defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder:()=>oe.defaultApduSenderServiceStubBuilder,formatApduReceivedLog:()=>A.formatApduReceivedLog,formatApduSentLog:()=>A.formatApduSentLog,hexaStringToBuffer:()=>a.hexaStringToBuffer,isBase64String:()=>D.isBase64String,isCommandErrorCode:()=>I.isCommandErrorCode,isHexaString:()=>a.isHexaString,isSuccessCommandResult:()=>m.isSuccessCommandResult});module.exports=ve(e);var S=require("./apdu/model/Apdu"),f=require("./apdu/utils/ApduBuilder"),y=require("./apdu/utils/ApduParser");r(e,require("./apdu/utils/AppBuilderError"),module.exports);var C=require("./apdu/utils/ByteArrayBuilder"),g=require("./apdu/utils/ByteArrayParser"),c=require("./command/Errors"),m=require("./command/model/CommandResult"),L=require("./command/os/CloseAppCommand"),E=require("./command/os/GetAppAndVersionCommand"),x=require("./command/os/GetBatteryStatusCommand"),B=require("./command/os/GetOsVersionCommand"),G=require("./command/os/ListAppsCommand"),R=require("./command/os/LoadCertificateCommand"),M=require("./command/os/OpenAppCommand"),I=require("./command/utils/CommandErrors"),O=require("./command/utils/CommandUtils"),d=require("./command/utils/GlobalCommandError"),n=require("./device/DeviceModel"),T=require("./device/DeviceStatus"),b=require("./device-action/model/DeviceActionState"),h=require("./device-action/model/UserInteractionRequired"),U=require("./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction"),t=require("./device-action/os/Errors"),F=require("./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction"),P=require("./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction"),V=require("./device-action/os/GoToDashboard/GoToDashboardDeviceAction"),k=require("./device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction"),W=require("./device-action/os/ListApps/ListAppsDeviceAction"),_=require("./device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction"),w=require("./device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),H=require("./device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction"),K=require("./device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction"),X=require("./device-action/xstate-utils/XStateDeviceAction"),q=require("./device-model/data/StaticDeviceModelDataSource"),N=require("./device-model/model/BleDeviceInfos"),Y=require("./device-model/model/DeviceModel"),j=require("./device-session/ApduResponse");r(e,require("./device-session/data/FramerConst"),module.exports);var z=require("./device-session/DeviceSessionState"),J=require("./secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction"),Q=require("./secure-channel/device-action/InstallApp/InstallAppDeviceAction"),Z=require("./secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction"),$=require("./secure-channel/device-action/UninstallApp/UninstallAppDeviceAction"),ee=require("../internal/secure-channel/model/Errors"),re=require("./device-session/service/DefaultApduReceiverService.stub"),oe=require("./device-session/service/DefaultApduSenderService.stub"),te=require("./device-session/utils/FramerUtils"),pe=require("./DeviceManagementKit"),ie=require("./DeviceManagementKitBuilder");r(e,require("./Error"),module.exports);var me=require("./logger-subscriber/model/LogLevel"),ne=require("./logger-subscriber/service/ConsoleLogger"),ae=require("./logger-subscriber/service/DefaultLogTagFormatter"),se=require("./logger-subscriber/service/WebLogsExporterLogger"),fe=require("./transport/model/ConnectedDevice"),ce=require("./transport/model/DeviceConnectionStateMachine");r(e,require("./transport/model/Errors"),module.exports);var xe=require("./transport/model/TransportConnectedDevice"),de=require("./transport/model/TransportConnectedDevice.stub");r(e,require("./types"),module.exports);var A=require("./utils/apduLogs"),D=require("./utils/Base64String"),a=require("./utils/HexaString");0&&(module.exports={APDU_MAX_PAYLOAD,Apdu,ApduBuilder,ApduParser,ApduResponse,AppAlreadyInstalledDAError,BatteryStatusType,BleDeviceInfos,ByteArrayBuilder,ByteArrayParser,CallTaskInAppDeviceAction,CloseAppCommand,CommandResultFactory,CommandResultStatus,CommandUtils,ConnectedDevice,ConsoleLogger,DefaultLogTagFormatter,DeviceActionStatus,DeviceConnectionStateMachine,DeviceLockedError,DeviceManagementKit,DeviceManagementKitBuilder,DeviceModel,DeviceModelId,DeviceSessionStateType,DeviceStatus,FramerUtils,GenuineCheckDeviceAction,GetAppAndVersionCommand,GetBatteryStatusCommand,GetDeviceMetadataDeviceAction,GetDeviceStatusDeviceAction,GetOsVersionCommand,GlobalCommandError,GlobalCommandErrorHandler,GoToDashboardDeviceAction,InstallAppDeviceAction,InstallOrUpdateAppsDeviceAction,InvalidGetFirmwareMetadataResponseError,InvalidStatusWordError,LEDGER_VENDOR_ID,ListAppsCommand,ListAppsDeviceAction,ListAppsWithMetadataDeviceAction,ListInstalledAppsDeviceAction,LoadCertificateCommand,LogLevel,OpenAppCommand,OpenAppDeviceAction,OpenAppWithDependenciesDeviceAction,OutOfMemoryDAError,RefusedByUserDAError,SecureChannelError,SendCommandInAppDeviceAction,StaticDeviceModelDataSource,TransportConnectedDevice,TransportDeviceModel,UninstallAppDeviceAction,UnknownDAError,UnsupportedFirmwareDAError,UserInteractionRequired,WebLogsExporterLogger,XStateDeviceAction,base64StringToBuffer,bufferToHexaString,connectedDeviceStubBuilder,defaultApduReceiverServiceStubBuilder,defaultApduSenderServiceStubBuilder,formatApduReceivedLog,formatApduSentLog,hexaStringToBuffer,isBase64String,isCommandErrorCode,isHexaString,isSuccessCommandResult,...require("./apdu/utils/AppBuilderError"),...require("./device-session/data/FramerConst"),...require("./Error"),...require("./transport/model/Errors"),...require("./types")});
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/api/index.ts"],
4
- "sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport {\n InvalidGetFirmwareMetadataResponseError,\n InvalidStatusWordError,\n} from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport {\n AppAlreadyInstalledDAError,\n DeviceLockedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nexport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { OpenAppWithDependenciesDeviceAction } from \"@api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\nexport { InstallAppDeviceAction } from \"@api/secure-channel/device-action/InstallApp/InstallAppDeviceAction\";\nexport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nexport { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\nexport { SecureChannelError } from \"@internal/secure-channel/model/Errors\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport {\n DeviceConnectionStateMachine,\n type DeviceConnectionStateMachineParams,\n} from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { formatApduReceivedLog, formatApduSentLog } from \"@api/utils/apduLogs\";\nexport { base64StringToBuffer, isBase64String } from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
5
- "mappings": "meAAA,IAAAA,EAAA,GAAAC,GAAAD,EAAA,ykHAAAE,GAAAF,GAEA,IAAAG,EAAqB,gCACrBC,EAA8C,uCAC9CC,EAA2B,sCAC3BC,EAAAN,EAAc,2CALd,gBAMA,IAAAO,EAAiC,4CACjCC,EAAgC,2CAChCC,EAGO,+BACPC,EAIO,4CACPC,EAAgC,2CAChCC,EAGO,mDACPC,EAKO,mDACPC,EAGO,+CACPC,EAKO,2CACPC,EAIO,kDACPC,EAGO,0CACPC,EAAmC,4CACnCC,EAA6B,2CAC7BC,EAGO,iDACPC,EAIO,mCACPC,EAA6B,oCAE7BC,EAGO,sDACPC,EAAwC,4DACxCC,EAA0C,qFAC1ChB,EAOO,wCACPiB,EAA8C,iFAC9CC,EAA4C,6EAC5CC,EAA0C,yEAC1CC,EAAgD,qFAChDC,EAAqC,+DACrCC,EAAiD,uFACjDC,EAAoC,yEACpCC,EAAoD,6FACpDC,EAA6C,2FAC7CC,EAGO,8DACPC,EAA4C,8DAC5CC,EAA+B,kDAC/BhB,EAAqC,+CACrCiB,EAA6B,4CAC7BhC,EAAAN,EAAc,gDA3Fd,gBA4FA,IAAAuC,EAGO,kDACPC,EAAyC,mFACzCC,EAAuC,+EACvCC,EAA8C,6FAC9CC,EAAyC,mFACzClC,GAAmC,iDAEnCmC,GAAsD,uEACtDC,GAAoD,qEACpDC,GAA4B,iDAC5BC,GAAoC,oCACpCC,GAA2C,2CAC3C1C,EAAAN,EAAc,sBA3Gd,gBA4GA,IAAAiD,GAAyB,iDACzBC,GAA8B,wDAC9BC,GAAsC,gEACtCC,GAAgC,gDAChCC,GAGO,6DACP/C,EAAAN,EAAc,uCApHd,gBAqHA,IAAAsD,GAAyC,yDACzCA,GAA2C,8DAC3ChD,EAAAN,EAAc,sBAvHd,gBAwHA,IAAAuD,EAAyD,+BACzDC,EAAqD,mCACrDC,EAIO",
6
- "names": ["api_exports", "__export", "__toCommonJS", "import_Apdu", "import_ApduBuilder", "import_ApduParser", "__reExport", "import_ByteArrayBuilder", "import_ByteArrayParser", "import_Errors", "import_CommandResult", "import_CloseAppCommand", "import_GetAppAndVersionCommand", "import_GetBatteryStatusCommand", "import_GetOsVersionCommand", "import_ListAppsCommand", "import_LoadCertificateCommand", "import_OpenAppCommand", "import_CommandErrors", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "import_DeviceStatus", "import_DeviceActionState", "import_UserInteractionRequired", "import_CallTaskInAppDeviceAction", "import_GetDeviceMetadataDeviceAction", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_InstallOrUpdateAppsDeviceAction", "import_ListAppsDeviceAction", "import_ListAppsWithMetadataDeviceAction", "import_OpenAppDeviceAction", "import_OpenAppWithDependenciesDeviceAction", "import_SendCommandInAppDeviceAction", "import_XStateDeviceAction", "import_StaticDeviceModelDataSource", "import_BleDeviceInfos", "import_ApduResponse", "import_DeviceSessionState", "import_GenuineCheckDeviceAction", "import_InstallAppDeviceAction", "import_ListInstalledAppsDeviceAction", "import_UninstallAppDeviceAction", "import_DefaultApduReceiverService", "import_DefaultApduSenderService", "import_FramerUtils", "import_DeviceManagementKit", "import_DeviceManagementKitBuilder", "import_LogLevel", "import_ConsoleLogger", "import_WebLogsExporterLogger", "import_ConnectedDevice", "import_DeviceConnectionStateMachine", "import_TransportConnectedDevice", "import_apduLogs", "import_Base64String", "import_HexaString"]
4
+ "sourcesContent": ["\"use strict\";\n\nexport { Apdu } from \"@api/apdu/model/Apdu\";\nexport { APDU_MAX_PAYLOAD, ApduBuilder } from \"@api/apdu/utils/ApduBuilder\";\nexport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nexport * from \"@api/apdu/utils/AppBuilderError\";\nexport { ByteArrayBuilder } from \"@api/apdu/utils/ByteArrayBuilder\";\nexport { ByteArrayParser } from \"@api/apdu/utils/ByteArrayParser\";\nexport {\n InvalidGetFirmwareMetadataResponseError,\n InvalidStatusWordError,\n} from \"@api/command/Errors\";\nexport {\n CommandResultFactory,\n CommandResultStatus,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nexport { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nexport {\n GetAppAndVersionCommand,\n type GetAppAndVersionResponse,\n} from \"@api/command/os/GetAppAndVersionCommand\";\nexport {\n BatteryStatusType,\n type GetBatteryStatusArgs,\n GetBatteryStatusCommand,\n type GetBatteryStatusResponse,\n} from \"@api/command/os/GetBatteryStatusCommand\";\nexport {\n GetOsVersionCommand,\n type GetOsVersionResponse,\n} from \"@api/command/os/GetOsVersionCommand\";\nexport {\n type ListAppsArgs,\n ListAppsCommand,\n type ListAppsErrorCodes,\n type ListAppsResponse,\n} from \"@api/command/os/ListAppsCommand\";\nexport {\n type LoadCertificateArgs,\n LoadCertificateCommand,\n type LoadCertificateErrorCodes,\n} from \"@api/command/os/LoadCertificateCommand\";\nexport {\n type OpenAppArgs,\n OpenAppCommand,\n} from \"@api/command/os/OpenAppCommand\";\nexport { isCommandErrorCode } from \"@api/command/utils/CommandErrors\";\nexport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nexport {\n GlobalCommandError,\n GlobalCommandErrorHandler,\n} from \"@api/command/utils/GlobalCommandError\";\nexport {\n DeviceModel,\n DeviceModelId,\n LEDGER_VENDOR_ID,\n} from \"@api/device/DeviceModel\";\nexport { DeviceStatus } from \"@api/device/DeviceStatus\";\nexport { type InternalApi } from \"@api/device-action/DeviceAction\";\nexport {\n type DeviceActionState,\n DeviceActionStatus,\n} from \"@api/device-action/model/DeviceActionState\";\nexport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nexport { CallTaskInAppDeviceAction } from \"@api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction\";\nexport {\n AppAlreadyInstalledDAError,\n DeviceLockedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n UnknownDAError,\n UnsupportedFirmwareDAError,\n} from \"@api/device-action/os/Errors\";\nexport { GetDeviceMetadataDeviceAction } from \"@api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction\";\nexport { GetDeviceStatusDeviceAction } from \"@api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction\";\nexport { GoToDashboardDeviceAction } from \"@api/device-action/os/GoToDashboard/GoToDashboardDeviceAction\";\nexport { InstallOrUpdateAppsDeviceAction } from \"@api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction\";\nexport { ListAppsDeviceAction } from \"@api/device-action/os/ListApps/ListAppsDeviceAction\";\nexport { ListAppsWithMetadataDeviceAction } from \"@api/device-action/os/ListAppsWithMetadata/ListAppsWithMetadataDeviceAction\";\nexport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nexport { OpenAppWithDependenciesDeviceAction } from \"@api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction\";\nexport { SendCommandInAppDeviceAction } from \"@api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction\";\nexport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\nexport { StaticDeviceModelDataSource } from \"@api/device-model/data/StaticDeviceModelDataSource\";\nexport { BleDeviceInfos } from \"@api/device-model/model/BleDeviceInfos\";\nexport { TransportDeviceModel } from \"@api/device-model/model/DeviceModel\";\nexport { ApduResponse } from \"@api/device-session/ApduResponse\";\nexport * from \"@api/device-session/data/FramerConst\";\nexport {\n type DeviceSessionState,\n DeviceSessionStateType,\n} from \"@api/device-session/DeviceSessionState\";\nexport { GenuineCheckDeviceAction } from \"@api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction\";\nexport { InstallAppDeviceAction } from \"@api/secure-channel/device-action/InstallApp/InstallAppDeviceAction\";\nexport { ListInstalledAppsDeviceAction } from \"@api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction\";\nexport { UninstallAppDeviceAction } from \"@api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction\";\nexport { SecureChannelError } from \"@internal/secure-channel/model/Errors\";\n// TODO: remove from exported\nexport { defaultApduReceiverServiceStubBuilder } from \"@api/device-session/service/DefaultApduReceiverService.stub\";\nexport { defaultApduSenderServiceStubBuilder } from \"@api/device-session/service/DefaultApduSenderService.stub\";\nexport { FramerUtils } from \"@api/device-session/utils/FramerUtils\";\nexport { DeviceManagementKit } from \"@api/DeviceManagementKit\";\nexport { DeviceManagementKitBuilder } from \"@api/DeviceManagementKitBuilder\";\nexport * from \"@api/Error\";\nexport { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nexport { ConsoleLogger } from \"@api/logger-subscriber/service/ConsoleLogger\";\nexport { DefaultLogTagFormatter } from \"@api/logger-subscriber/service/DefaultLogTagFormatter\";\nexport { type LogTagFormatter } from \"@api/logger-subscriber/service/LogTagFormatter\";\nexport { WebLogsExporterLogger } from \"@api/logger-subscriber/service/WebLogsExporterLogger\";\nexport { ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nexport {\n DeviceConnectionStateMachine,\n type DeviceConnectionStateMachineParams,\n} from \"@api/transport/model/DeviceConnectionStateMachine\";\nexport * from \"@api/transport/model/Errors\";\nexport { TransportConnectedDevice } from \"@api/transport/model/TransportConnectedDevice\";\nexport { connectedDeviceStubBuilder } from \"@api/transport/model/TransportConnectedDevice.stub\";\nexport * from \"@api/types\";\nexport { formatApduReceivedLog, formatApduSentLog } from \"@api/utils/apduLogs\";\nexport { base64StringToBuffer, isBase64String } from \"@api/utils/Base64String\";\nexport {\n bufferToHexaString,\n hexaStringToBuffer,\n isHexaString,\n} from \"@api/utils/HexaString\";\n"],
5
+ "mappings": "meAAA,IAAAA,EAAA,GAAAC,GAAAD,EAAA,8nHAAAE,GAAAF,GAEA,IAAAG,EAAqB,gCACrBC,EAA8C,uCAC9CC,EAA2B,sCAC3BC,EAAAN,EAAc,2CALd,gBAMA,IAAAO,EAAiC,4CACjCC,EAAgC,2CAChCC,EAGO,+BACPC,EAIO,4CACPC,EAAgC,2CAChCC,EAGO,mDACPC,EAKO,mDACPC,EAGO,+CACPC,EAKO,2CACPC,EAIO,kDACPC,EAGO,0CACPC,EAAmC,4CACnCC,EAA6B,2CAC7BC,EAGO,iDACPC,EAIO,mCACPC,EAA6B,oCAE7BC,EAGO,sDACPC,EAAwC,4DACxCC,EAA0C,qFAC1ChB,EAOO,wCACPiB,EAA8C,iFAC9CC,EAA4C,6EAC5CC,EAA0C,yEAC1CC,EAAgD,qFAChDC,EAAqC,+DACrCC,EAAiD,uFACjDC,EAAoC,yEACpCC,EAAoD,6FACpDC,EAA6C,2FAC7CC,EAGO,8DACPC,EAA4C,8DAC5CC,EAA+B,kDAC/BhB,EAAqC,+CACrCiB,EAA6B,4CAC7BhC,EAAAN,EAAc,gDA3Fd,gBA4FA,IAAAuC,EAGO,kDACPC,EAAyC,mFACzCC,EAAuC,+EACvCC,EAA8C,6FAC9CC,EAAyC,mFACzClC,GAAmC,iDAEnCmC,GAAsD,uEACtDC,GAAoD,qEACpDC,GAA4B,iDAC5BC,GAAoC,oCACpCC,GAA2C,2CAC3C1C,EAAAN,EAAc,sBA3Gd,gBA4GA,IAAAiD,GAAyB,iDACzBC,GAA8B,wDAC9BC,GAAuC,iEAEvCC,GAAsC,gEACtCC,GAAgC,gDAChCC,GAGO,6DACPhD,EAAAN,EAAc,uCAtHd,gBAuHA,IAAAuD,GAAyC,yDACzCA,GAA2C,8DAC3CjD,EAAAN,EAAc,sBAzHd,gBA0HA,IAAAwD,EAAyD,+BACzDC,EAAqD,mCACrDC,EAIO",
6
+ "names": ["api_exports", "__export", "__toCommonJS", "import_Apdu", "import_ApduBuilder", "import_ApduParser", "__reExport", "import_ByteArrayBuilder", "import_ByteArrayParser", "import_Errors", "import_CommandResult", "import_CloseAppCommand", "import_GetAppAndVersionCommand", "import_GetBatteryStatusCommand", "import_GetOsVersionCommand", "import_ListAppsCommand", "import_LoadCertificateCommand", "import_OpenAppCommand", "import_CommandErrors", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "import_DeviceStatus", "import_DeviceActionState", "import_UserInteractionRequired", "import_CallTaskInAppDeviceAction", "import_GetDeviceMetadataDeviceAction", "import_GetDeviceStatusDeviceAction", "import_GoToDashboardDeviceAction", "import_InstallOrUpdateAppsDeviceAction", "import_ListAppsDeviceAction", "import_ListAppsWithMetadataDeviceAction", "import_OpenAppDeviceAction", "import_OpenAppWithDependenciesDeviceAction", "import_SendCommandInAppDeviceAction", "import_XStateDeviceAction", "import_StaticDeviceModelDataSource", "import_BleDeviceInfos", "import_ApduResponse", "import_DeviceSessionState", "import_GenuineCheckDeviceAction", "import_InstallAppDeviceAction", "import_ListInstalledAppsDeviceAction", "import_UninstallAppDeviceAction", "import_DefaultApduReceiverService", "import_DefaultApduSenderService", "import_FramerUtils", "import_DeviceManagementKit", "import_DeviceManagementKitBuilder", "import_LogLevel", "import_ConsoleLogger", "import_DefaultLogTagFormatter", "import_WebLogsExporterLogger", "import_ConnectedDevice", "import_DeviceConnectionStateMachine", "import_TransportConnectedDevice", "import_apduLogs", "import_Base64String", "import_HexaString"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var g=(e,r,n,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of i(r))!s.call(e,t)&&t!==n&&o(e,t,{get:()=>r[t],enumerable:!(a=b(r,t))||a.enumerable});return e};var p=e=>g(o({},"__esModule",{value:!0}),e);var d={};module.exports=p(d);
1
+ "use strict";var a=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var p=(t,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of i(r))!s.call(t,e)&&e!==n&&a(t,e,{get:()=>r[e],enumerable:!(o=g(r,e))||o.enumerable});return t};var b=t=>p(a({},"__esModule",{value:!0}),t);var y={};module.exports=b(y);
2
2
  //# sourceMappingURL=LogSubscriberOptions.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/logger-subscriber/model/LogSubscriberOptions.ts"],
4
- "sourcesContent": ["export type LogSubscriberData = Record<string, unknown>;\n\nexport type LogSubscriberOptions = {\n readonly tag: string;\n readonly timestamp: number;\n readonly data?: LogSubscriberData;\n};\n"],
4
+ "sourcesContent": ["export type LogSubscriberData = Record<string, unknown>;\n\n// Tag can be a single string or an array of strings for hierarchical tags\nexport type LogTag = string | string[];\n\nexport type LogSubscriberOptions = {\n // Formatted tag string (subscribers always receive a formatted string)\n readonly tag: string;\n readonly timestamp: number;\n readonly data?: LogSubscriberData;\n};\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["LogSubscriberOptions_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var l=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var L=(o,e)=>{for(var a in e)l(o,a,{get:e[a],enumerable:!0})},h=(o,e,a,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of s(e))!c.call(o,r)&&r!==a&&l(o,r,{get:()=>e[r],enumerable:!(i=g(e,r))||i.enumerable});return o};var n=o=>h(l({},"__esModule",{value:!0}),o);var v={};L(v,{ConsoleLogger:()=>b});module.exports=n(v);var t=require("../../logger-subscriber/model/LogLevel");class b{maxLevel;constructor(e=t.LogLevel.Debug){this.maxLevel=e}log(e,a,i){const r=`[${i.tag}]`;switch(e){case t.LogLevel.Info:{this.maxLevel>=t.LogLevel.Info&&this.logWithData(r,console.info,a,i);break}case t.LogLevel.Warning:{this.maxLevel>=t.LogLevel.Warning&&this.logWithData(r,console.warn,a,i);break}case t.LogLevel.Debug:{this.maxLevel>=t.LogLevel.Debug&&this.logWithData(r,console.debug,a,i);break}case t.LogLevel.Error:{this.maxLevel>=t.LogLevel.Error&&this.logWithData(r,console.error,a,i);break}case t.LogLevel.Fatal:{this.maxLevel>=t.LogLevel.Fatal&&this.logWithData(r,console.error,a,i);break}default:this.logWithData(r,console.log,a,i)}}logWithData(e,a,i,r){r.data?a(e,i,r.data):a(e,i)}}0&&(module.exports={ConsoleLogger});
1
+ "use strict";var l=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var L=(o,e)=>{for(var a in e)l(o,a,{get:e[a],enumerable:!0})},h=(o,e,a,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of s(e))!c.call(o,r)&&r!==a&&l(o,r,{get:()=>e[r],enumerable:!(i=g(e,r))||i.enumerable});return o};var n=o=>h(l({},"__esModule",{value:!0}),o);var v={};L(v,{ConsoleLogger:()=>b});module.exports=n(v);var t=require("../../logger-subscriber/model/LogLevel");class b{maxLevel;constructor(e=t.LogLevel.Debug){this.maxLevel=e}log(e,a,i){const r=i.tag;switch(e){case t.LogLevel.Info:{this.maxLevel>=t.LogLevel.Info&&this.logWithData(r,console.info,a,i);break}case t.LogLevel.Warning:{this.maxLevel>=t.LogLevel.Warning&&this.logWithData(r,console.warn,a,i);break}case t.LogLevel.Debug:{this.maxLevel>=t.LogLevel.Debug&&this.logWithData(r,console.debug,a,i);break}case t.LogLevel.Error:{this.maxLevel>=t.LogLevel.Error&&this.logWithData(r,console.error,a,i);break}case t.LogLevel.Fatal:{this.maxLevel>=t.LogLevel.Fatal&&this.logWithData(r,console.error,a,i);break}default:this.logWithData(r,console.log,a,i)}}logWithData(e,a,i,r){r.data?a(e,i,r.data):a(e,i)}}0&&(module.exports={ConsoleLogger});
2
2
  //# sourceMappingURL=ConsoleLogger.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/logger-subscriber/service/ConsoleLogger.ts"],
4
- "sourcesContent": ["import { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nimport { type LogSubscriberOptions } from \"@api/logger-subscriber/model/LogSubscriberOptions\";\nimport { type LoggerSubscriberService } from \"@api/logger-subscriber/service/LoggerSubscriberService\";\n\nexport class ConsoleLogger implements LoggerSubscriberService {\n private readonly maxLevel: LogLevel;\n\n constructor(level: LogLevel = LogLevel.Debug) {\n this.maxLevel = level;\n }\n\n log(\n level: LogLevel | null,\n message: string,\n options: LogSubscriberOptions,\n ): void {\n const tag = `[${options.tag}]`;\n\n switch (level) {\n case LogLevel.Info: {\n if (this.maxLevel >= LogLevel.Info) {\n this.logWithData(tag, console.info, message, options);\n }\n break;\n }\n case LogLevel.Warning: {\n if (this.maxLevel >= LogLevel.Warning) {\n this.logWithData(tag, console.warn, message, options);\n }\n break;\n }\n case LogLevel.Debug: {\n if (this.maxLevel >= LogLevel.Debug) {\n this.logWithData(tag, console.debug, message, options);\n }\n break;\n }\n case LogLevel.Error: {\n if (this.maxLevel >= LogLevel.Error) {\n this.logWithData(tag, console.error, message, options);\n }\n break;\n }\n case LogLevel.Fatal: {\n if (this.maxLevel >= LogLevel.Fatal) {\n this.logWithData(tag, console.error, message, options);\n }\n break;\n }\n default:\n this.logWithData(tag, console.log, message, options);\n }\n }\n\n private logWithData(\n tag: string,\n logFunction: (...args: unknown[]) => void,\n message: string,\n options: LogSubscriberOptions,\n ): void {\n if (options.data) {\n logFunction(tag, message, options.data);\n } else {\n logFunction(tag, message);\n }\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyB,iDAIlB,MAAMF,CAAiD,CAC3C,SAEjB,YAAYG,EAAkB,WAAS,MAAO,CAC5C,KAAK,SAAWA,CAClB,CAEA,IACEA,EACAC,EACAC,EACM,CACN,MAAMC,EAAM,IAAID,EAAQ,GAAG,IAE3B,OAAQF,EAAO,CACb,KAAK,WAAS,KAAM,CACd,KAAK,UAAY,WAAS,MAC5B,KAAK,YAAYG,EAAK,QAAQ,KAAMF,EAASC,CAAO,EAEtD,KACF,CACA,KAAK,WAAS,QAAS,CACjB,KAAK,UAAY,WAAS,SAC5B,KAAK,YAAYC,EAAK,QAAQ,KAAMF,EAASC,CAAO,EAEtD,KACF,CACA,KAAK,WAAS,MAAO,CACf,KAAK,UAAY,WAAS,OAC5B,KAAK,YAAYC,EAAK,QAAQ,MAAOF,EAASC,CAAO,EAEvD,KACF,CACA,KAAK,WAAS,MAAO,CACf,KAAK,UAAY,WAAS,OAC5B,KAAK,YAAYC,EAAK,QAAQ,MAAOF,EAASC,CAAO,EAEvD,KACF,CACA,KAAK,WAAS,MAAO,CACf,KAAK,UAAY,WAAS,OAC5B,KAAK,YAAYC,EAAK,QAAQ,MAAOF,EAASC,CAAO,EAEvD,KACF,CACA,QACE,KAAK,YAAYC,EAAK,QAAQ,IAAKF,EAASC,CAAO,CACvD,CACF,CAEQ,YACNC,EACAC,EACAH,EACAC,EACM,CACFA,EAAQ,KACVE,EAAYD,EAAKF,EAASC,EAAQ,IAAI,EAEtCE,EAAYD,EAAKF,CAAO,CAE5B,CACF",
4
+ "sourcesContent": ["import { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nimport { type LogSubscriberOptions } from \"@api/logger-subscriber/model/LogSubscriberOptions\";\nimport { type LoggerSubscriberService } from \"@api/logger-subscriber/service/LoggerSubscriberService\";\n\nexport class ConsoleLogger implements LoggerSubscriberService {\n private readonly maxLevel: LogLevel;\n\n constructor(level: LogLevel = LogLevel.Debug) {\n this.maxLevel = level;\n }\n\n log(\n level: LogLevel | null,\n message: string,\n options: LogSubscriberOptions,\n ): void {\n const tag = options.tag;\n\n switch (level) {\n case LogLevel.Info: {\n if (this.maxLevel >= LogLevel.Info) {\n this.logWithData(tag, console.info, message, options);\n }\n break;\n }\n case LogLevel.Warning: {\n if (this.maxLevel >= LogLevel.Warning) {\n this.logWithData(tag, console.warn, message, options);\n }\n break;\n }\n case LogLevel.Debug: {\n if (this.maxLevel >= LogLevel.Debug) {\n this.logWithData(tag, console.debug, message, options);\n }\n break;\n }\n case LogLevel.Error: {\n if (this.maxLevel >= LogLevel.Error) {\n this.logWithData(tag, console.error, message, options);\n }\n break;\n }\n case LogLevel.Fatal: {\n if (this.maxLevel >= LogLevel.Fatal) {\n this.logWithData(tag, console.error, message, options);\n }\n break;\n }\n default:\n this.logWithData(tag, console.log, message, options);\n }\n }\n\n private logWithData(\n tag: string,\n logFunction: (...args: unknown[]) => void,\n message: string,\n options: LogSubscriberOptions,\n ): void {\n if (options.data) {\n logFunction(tag, message, options.data);\n } else {\n logFunction(tag, message);\n }\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyB,iDAIlB,MAAMF,CAAiD,CAC3C,SAEjB,YAAYG,EAAkB,WAAS,MAAO,CAC5C,KAAK,SAAWA,CAClB,CAEA,IACEA,EACAC,EACAC,EACM,CACN,MAAMC,EAAMD,EAAQ,IAEpB,OAAQF,EAAO,CACb,KAAK,WAAS,KAAM,CACd,KAAK,UAAY,WAAS,MAC5B,KAAK,YAAYG,EAAK,QAAQ,KAAMF,EAASC,CAAO,EAEtD,KACF,CACA,KAAK,WAAS,QAAS,CACjB,KAAK,UAAY,WAAS,SAC5B,KAAK,YAAYC,EAAK,QAAQ,KAAMF,EAASC,CAAO,EAEtD,KACF,CACA,KAAK,WAAS,MAAO,CACf,KAAK,UAAY,WAAS,OAC5B,KAAK,YAAYC,EAAK,QAAQ,MAAOF,EAASC,CAAO,EAEvD,KACF,CACA,KAAK,WAAS,MAAO,CACf,KAAK,UAAY,WAAS,OAC5B,KAAK,YAAYC,EAAK,QAAQ,MAAOF,EAASC,CAAO,EAEvD,KACF,CACA,KAAK,WAAS,MAAO,CACf,KAAK,UAAY,WAAS,OAC5B,KAAK,YAAYC,EAAK,QAAQ,MAAOF,EAASC,CAAO,EAEvD,KACF,CACA,QACE,KAAK,YAAYC,EAAK,QAAQ,IAAKF,EAASC,CAAO,CACvD,CACF,CAEQ,YACNC,EACAC,EACAH,EACAC,EACM,CACFA,EAAQ,KACVE,EAAYD,EAAKF,EAASC,EAAQ,IAAI,EAEtCE,EAAYD,EAAKF,CAAO,CAE5B,CACF",
6
6
  "names": ["ConsoleLogger_exports", "__export", "ConsoleLogger", "__toCommonJS", "import_LogLevel", "level", "message", "options", "tag", "logFunction"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var t=require("../../logger-subscriber/model/LogLevel"),g=require("./ConsoleLogger");const d=vi.spyOn(console,"warn").mockImplementation(vi.fn()),n=vi.spyOn(console,"info").mockImplementation(vi.fn()),r=vi.spyOn(console,"debug").mockImplementation(vi.fn()),a=vi.spyOn(console,"error").mockImplementation(vi.fn()),s=vi.spyOn(console,"log").mockImplementation(vi.fn());let o;const e={data:{key:"value"},timestamp:1,tag:"tag"},l="message";describe("ConsoleLogger",()=>{afterAll(()=>{vi.restoreAllMocks()}),describe("default level (LogLevel.DEBUG)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new g.ConsoleLogger}),describe("log",()=>{it("should log Info level",()=>{o.log(t.LogLevel.Info,l,e),expect(n).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Info level with a custom tag",()=>{const i="custom-tag";o.log(t.LogLevel.Info,l,{...e,tag:i}),expect(n).toHaveBeenCalledWith(`[${i}]`,l,e.data)}),it("should log Warn level",()=>{o.log(t.LogLevel.Warning,l,e),expect(d).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Debug level",()=>{o.log(t.LogLevel.Debug,l,e),expect(r).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Fatal level",()=>{o.log(t.LogLevel.Fatal,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should default to Log level if none present",()=>{o.log(null,l,e),expect(s).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Error level",()=>{o.log(t.LogLevel.Error,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)})})}),describe("custom level (LogLevel.Info)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new g.ConsoleLogger(t.LogLevel.Info)}),describe("log",()=>{it("should log Info level",()=>{o.log(t.LogLevel.Info,l,e),expect(n).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Info level with a custom tag",()=>{const i="custom-tag";o.log(t.LogLevel.Info,l,{...e,tag:i}),expect(n).toHaveBeenCalledWith(`[${i}]`,l,e.data)}),it("should log Warn level",()=>{o.log(t.LogLevel.Warning,l,e),expect(d).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should not log Debug level",()=>{o.log(t.LogLevel.Debug,l,e),expect(r).not.toHaveBeenCalled()}),it("should default to Log level if none present",()=>{o.log(null,l,e),expect(s).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Error level",()=>{o.log(t.LogLevel.Error,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Fatal level",()=>{o.log(t.LogLevel.Fatal,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)})})}),describe("custom level (LogLevel.Warning)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new g.ConsoleLogger(t.LogLevel.Warning)}),describe("log",()=>{it("should not log Info level",()=>{o.log(t.LogLevel.Info,l,e),expect(n).not.toHaveBeenCalled()}),it("should log Warn level",()=>{o.log(t.LogLevel.Warning,l,e),expect(d).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should not log Debug level",()=>{o.log(t.LogLevel.Debug,l,e),expect(r).not.toHaveBeenCalled()}),it("should default to Log level if none present",()=>{o.log(null,l,e),expect(s).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Error level",()=>{o.log(t.LogLevel.Error,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Fatal level",()=>{o.log(t.LogLevel.Fatal,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)})})}),describe("custom level (LogLevel.Error)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new g.ConsoleLogger(t.LogLevel.Error)}),describe("log",()=>{it("should not log Info level",()=>{o.log(t.LogLevel.Info,l,e),expect(n).not.toHaveBeenCalled()}),it("should not log Warn level",()=>{o.log(t.LogLevel.Warning,l,e),expect(d).not.toHaveBeenCalled()}),it("should not log Debug level",()=>{o.log(t.LogLevel.Debug,l,e),expect(r).not.toHaveBeenCalled()}),it("should default to Log level if none present",()=>{o.log(null,l,e),expect(s).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Error level",()=>{o.log(t.LogLevel.Error,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)}),it("should log Fatal level",()=>{o.log(t.LogLevel.Fatal,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)})})}),describe("custom level (LogLevel.Fatal)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new g.ConsoleLogger(t.LogLevel.Fatal)}),describe("log",()=>{it("should not log Info level",()=>{o.log(t.LogLevel.Info,l,e),expect(n).not.toHaveBeenCalled()}),it("should not log Warn level",()=>{o.log(t.LogLevel.Warning,l,e),expect(d).not.toHaveBeenCalled()}),it("should not log Debug level",()=>{o.log(t.LogLevel.Debug,l,e),expect(r).not.toHaveBeenCalled()}),it("should log Fatal level",()=>{o.log(t.LogLevel.Fatal,l,e),expect(a).toHaveBeenCalledWith(`[${e.tag}]`,l,e.data)})})})});
1
+ "use strict";var t=require("../../logger-subscriber/model/LogLevel"),g=require("./ConsoleLogger");const d=vi.spyOn(console,"warn").mockImplementation(vi.fn()),n=vi.spyOn(console,"info").mockImplementation(vi.fn()),r=vi.spyOn(console,"debug").mockImplementation(vi.fn()),a=vi.spyOn(console,"error").mockImplementation(vi.fn()),s=vi.spyOn(console,"log").mockImplementation(vi.fn());let o;const e={data:{key:"value"},timestamp:1,tag:"[tag]"},l="message";describe("ConsoleLogger",()=>{afterAll(()=>{vi.restoreAllMocks()}),describe("default level (LogLevel.DEBUG)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new g.ConsoleLogger}),describe("log",()=>{it("should log Info level",()=>{o.log(t.LogLevel.Info,l,e),expect(n).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should log Info level with a custom tag",()=>{const i="[custom-tag]";o.log(t.LogLevel.Info,l,{...e,tag:i}),expect(n).toHaveBeenCalledWith(i,l,e.data)}),it("should log Warn level",()=>{o.log(t.LogLevel.Warning,l,e),expect(d).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should log Debug level",()=>{o.log(t.LogLevel.Debug,l,e),expect(r).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should log Fatal level",()=>{o.log(t.LogLevel.Fatal,l,e),expect(a).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should default to Log level if none present",()=>{o.log(null,l,e),expect(s).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should log Error level",()=>{o.log(t.LogLevel.Error,l,e),expect(a).toHaveBeenCalledWith(e.tag,l,e.data)})})}),describe("custom level (LogLevel.Info)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new g.ConsoleLogger(t.LogLevel.Info)}),describe("log",()=>{it("should log Info level",()=>{o.log(t.LogLevel.Info,l,e),expect(n).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should log Info level with a custom tag",()=>{const i="[custom-tag]";o.log(t.LogLevel.Info,l,{...e,tag:i}),expect(n).toHaveBeenCalledWith(i,l,e.data)}),it("should log Warn level",()=>{o.log(t.LogLevel.Warning,l,e),expect(d).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should not log Debug level",()=>{o.log(t.LogLevel.Debug,l,e),expect(r).not.toHaveBeenCalled()}),it("should default to Log level if none present",()=>{o.log(null,l,e),expect(s).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should log Error level",()=>{o.log(t.LogLevel.Error,l,e),expect(a).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should log Fatal level",()=>{o.log(t.LogLevel.Fatal,l,e),expect(a).toHaveBeenCalledWith(e.tag,l,e.data)})})}),describe("custom level (LogLevel.Warning)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new g.ConsoleLogger(t.LogLevel.Warning)}),describe("log",()=>{it("should not log Info level",()=>{o.log(t.LogLevel.Info,l,e),expect(n).not.toHaveBeenCalled()}),it("should log Warn level",()=>{o.log(t.LogLevel.Warning,l,e),expect(d).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should not log Debug level",()=>{o.log(t.LogLevel.Debug,l,e),expect(r).not.toHaveBeenCalled()}),it("should default to Log level if none present",()=>{o.log(null,l,e),expect(s).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should log Error level",()=>{o.log(t.LogLevel.Error,l,e),expect(a).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should log Fatal level",()=>{o.log(t.LogLevel.Fatal,l,e),expect(a).toHaveBeenCalledWith(e.tag,l,e.data)})})}),describe("custom level (LogLevel.Error)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new g.ConsoleLogger(t.LogLevel.Error)}),describe("log",()=>{it("should not log Info level",()=>{o.log(t.LogLevel.Info,l,e),expect(n).not.toHaveBeenCalled()}),it("should not log Warn level",()=>{o.log(t.LogLevel.Warning,l,e),expect(d).not.toHaveBeenCalled()}),it("should not log Debug level",()=>{o.log(t.LogLevel.Debug,l,e),expect(r).not.toHaveBeenCalled()}),it("should default to Log level if none present",()=>{o.log(null,l,e),expect(s).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should log Error level",()=>{o.log(t.LogLevel.Error,l,e),expect(a).toHaveBeenCalledWith(e.tag,l,e.data)}),it("should log Fatal level",()=>{o.log(t.LogLevel.Fatal,l,e),expect(a).toHaveBeenCalledWith(e.tag,l,e.data)})})}),describe("custom level (LogLevel.Fatal)",()=>{beforeEach(()=>{vi.clearAllMocks(),o=new g.ConsoleLogger(t.LogLevel.Fatal)}),describe("log",()=>{it("should not log Info level",()=>{o.log(t.LogLevel.Info,l,e),expect(n).not.toHaveBeenCalled()}),it("should not log Warn level",()=>{o.log(t.LogLevel.Warning,l,e),expect(d).not.toHaveBeenCalled()}),it("should not log Debug level",()=>{o.log(t.LogLevel.Debug,l,e),expect(r).not.toHaveBeenCalled()}),it("should log Fatal level",()=>{o.log(t.LogLevel.Fatal,l,e),expect(a).toHaveBeenCalledWith(e.tag,l,e.data)})})})});
2
2
  //# sourceMappingURL=ConsoleLogger.test.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/api/logger-subscriber/service/ConsoleLogger.test.ts"],
4
- "sourcesContent": ["import { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nimport { type LogSubscriberOptions } from \"@api/logger-subscriber/model/LogSubscriberOptions\";\n\nimport { ConsoleLogger } from \"./ConsoleLogger\";\n\nconst warn = vi.spyOn(console, \"warn\").mockImplementation(vi.fn());\nconst info = vi.spyOn(console, \"info\").mockImplementation(vi.fn());\nconst debug = vi.spyOn(console, \"debug\").mockImplementation(vi.fn());\nconst error = vi.spyOn(console, \"error\").mockImplementation(vi.fn());\nconst log = vi.spyOn(console, \"log\").mockImplementation(vi.fn());\n\nlet logger: ConsoleLogger;\nconst options: LogSubscriberOptions = {\n data: { key: \"value\" },\n timestamp: 1,\n tag: \"tag\",\n};\nconst message = \"message\";\n\ndescribe(\"ConsoleLogger\", () => {\n afterAll(() => {\n vi.restoreAllMocks();\n });\n\n describe(\"default level (LogLevel.DEBUG)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger();\n });\n\n describe(\"log\", () => {\n it(\"should log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Info level with a custom tag\", () => {\n const tag = \"custom-tag\";\n logger.log(LogLevel.Info, message, { ...options, tag });\n expect(info).toHaveBeenCalledWith(`[${tag}]`, message, options.data);\n });\n\n it(\"should log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should default to Log level if none present\", () => {\n logger.log(null, message, options);\n expect(log).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Error level\", () => {\n logger.log(LogLevel.Error, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n });\n });\n\n describe(\"custom level (LogLevel.Info)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger(LogLevel.Info);\n });\n\n describe(\"log\", () => {\n it(\"should log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Info level with a custom tag\", () => {\n const tag = \"custom-tag\";\n logger.log(LogLevel.Info, message, { ...options, tag });\n expect(info).toHaveBeenCalledWith(`[${tag}]`, message, options.data);\n });\n\n it(\"should log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should not log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).not.toHaveBeenCalled();\n });\n\n it(\"should default to Log level if none present\", () => {\n logger.log(null, message, options);\n expect(log).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Error level\", () => {\n logger.log(LogLevel.Error, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n });\n });\n\n describe(\"custom level (LogLevel.Warning)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger(LogLevel.Warning);\n });\n\n describe(\"log\", () => {\n it(\"should not log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).not.toHaveBeenCalled();\n });\n\n it(\"should log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should not log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).not.toHaveBeenCalled();\n });\n\n it(\"should default to Log level if none present\", () => {\n logger.log(null, message, options);\n expect(log).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Error level\", () => {\n logger.log(LogLevel.Error, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n });\n });\n\n describe(\"custom level (LogLevel.Error)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger(LogLevel.Error);\n });\n\n describe(\"log\", () => {\n it(\"should not log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).not.toHaveBeenCalled();\n });\n\n it(\"should not log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).not.toHaveBeenCalled();\n });\n\n it(\"should not log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).not.toHaveBeenCalled();\n });\n\n it(\"should default to Log level if none present\", () => {\n logger.log(null, message, options);\n expect(log).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Error level\", () => {\n logger.log(LogLevel.Error, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n });\n });\n\n describe(\"custom level (LogLevel.Fatal)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger(LogLevel.Fatal);\n });\n\n describe(\"log\", () => {\n it(\"should not log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).not.toHaveBeenCalled();\n });\n\n it(\"should not log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).not.toHaveBeenCalled();\n });\n\n it(\"should not log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).not.toHaveBeenCalled();\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(\n `[${options.tag}]`,\n message,\n options.data,\n );\n });\n });\n });\n});\n"],
5
- "mappings": "aAAA,IAAAA,EAAyB,iDAGzBC,EAA8B,2BAE9B,MAAMC,EAAO,GAAG,MAAM,QAAS,MAAM,EAAE,mBAAmB,GAAG,GAAG,CAAC,EAC3DC,EAAO,GAAG,MAAM,QAAS,MAAM,EAAE,mBAAmB,GAAG,GAAG,CAAC,EAC3DC,EAAQ,GAAG,MAAM,QAAS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ED,SAAS,gCAAiC,IAAM,CAC9C,WAAW,IAAM,CACf,GAAG,cAAc,EACjBD,EAAS,IAAI,gBAAc,WAAS,KAAK,CAC3C,CAAC,EAED,SAAS,MAAO,IAAM,CACpB,GAAG,4BAA6B,IAAM,CACpCA,EAAO,IAAI,WAAS,KAAME,EAASD,CAAO,EAC1C,OAAOL,CAAI,EAAE,IAAI,iBAAiB,CACpC,CAAC,EAED,GAAG,4BAA6B,IAAM,CACpCI,EAAO,IAAI,WAAS,QAASE,EAASD,CAAO,EAC7C,OAAON,CAAI,EAAE,IAAI,iBAAiB,CACpC,CAAC,EAED,GAAG,6BAA8B,IAAM,CACrCK,EAAO,IAAI,WAAS,MAAOE,EAASD,CAAO,EAC3C,OAAOJ,CAAK,EAAE,IAAI,iBAAiB,CACrC,CAAC,EAED,GAAG,yBAA0B,IAAM,CACjCG,EAAO,IAAI,WAAS,MAAOE,EAASD,CAAO,EAC3C,OAAOH,CAAK,EAAE,qBACZ,IAAIG,EAAQ,GAAG,IACfC,EACAD,EAAQ,IACV,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
4
+ "sourcesContent": ["import { LogLevel } from \"@api/logger-subscriber/model/LogLevel\";\nimport { type LogSubscriberOptions } from \"@api/logger-subscriber/model/LogSubscriberOptions\";\n\nimport { ConsoleLogger } from \"./ConsoleLogger\";\n\nconst warn = vi.spyOn(console, \"warn\").mockImplementation(vi.fn());\nconst info = vi.spyOn(console, \"info\").mockImplementation(vi.fn());\nconst debug = vi.spyOn(console, \"debug\").mockImplementation(vi.fn());\nconst error = vi.spyOn(console, \"error\").mockImplementation(vi.fn());\nconst log = vi.spyOn(console, \"log\").mockImplementation(vi.fn());\n\nlet logger: ConsoleLogger;\n// Tags are pre-formatted by the publisher before reaching subscribers\nconst options: LogSubscriberOptions = {\n data: { key: \"value\" },\n timestamp: 1,\n tag: \"[tag]\",\n};\nconst message = \"message\";\n\ndescribe(\"ConsoleLogger\", () => {\n afterAll(() => {\n vi.restoreAllMocks();\n });\n\n describe(\"default level (LogLevel.DEBUG)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger();\n });\n\n describe(\"log\", () => {\n it(\"should log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should log Info level with a custom tag\", () => {\n const tag = \"[custom-tag]\";\n logger.log(LogLevel.Info, message, { ...options, tag });\n expect(info).toHaveBeenCalledWith(tag, message, options.data);\n });\n\n it(\"should log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should default to Log level if none present\", () => {\n logger.log(null, message, options);\n expect(log).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should log Error level\", () => {\n logger.log(LogLevel.Error, message, options);\n expect(error).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n });\n });\n\n describe(\"custom level (LogLevel.Info)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger(LogLevel.Info);\n });\n\n describe(\"log\", () => {\n it(\"should log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should log Info level with a custom tag\", () => {\n const tag = \"[custom-tag]\";\n logger.log(LogLevel.Info, message, { ...options, tag });\n expect(info).toHaveBeenCalledWith(tag, message, options.data);\n });\n\n it(\"should log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should not log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).not.toHaveBeenCalled();\n });\n\n it(\"should default to Log level if none present\", () => {\n logger.log(null, message, options);\n expect(log).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should log Error level\", () => {\n logger.log(LogLevel.Error, message, options);\n expect(error).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n });\n });\n\n describe(\"custom level (LogLevel.Warning)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger(LogLevel.Warning);\n });\n\n describe(\"log\", () => {\n it(\"should not log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).not.toHaveBeenCalled();\n });\n\n it(\"should log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should not log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).not.toHaveBeenCalled();\n });\n\n it(\"should default to Log level if none present\", () => {\n logger.log(null, message, options);\n expect(log).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should log Error level\", () => {\n logger.log(LogLevel.Error, message, options);\n expect(error).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n });\n });\n\n describe(\"custom level (LogLevel.Error)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger(LogLevel.Error);\n });\n\n describe(\"log\", () => {\n it(\"should not log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).not.toHaveBeenCalled();\n });\n\n it(\"should not log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).not.toHaveBeenCalled();\n });\n\n it(\"should not log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).not.toHaveBeenCalled();\n });\n\n it(\"should default to Log level if none present\", () => {\n logger.log(null, message, options);\n expect(log).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should log Error level\", () => {\n logger.log(LogLevel.Error, message, options);\n expect(error).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n });\n });\n\n describe(\"custom level (LogLevel.Fatal)\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n logger = new ConsoleLogger(LogLevel.Fatal);\n });\n\n describe(\"log\", () => {\n it(\"should not log Info level\", () => {\n logger.log(LogLevel.Info, message, options);\n expect(info).not.toHaveBeenCalled();\n });\n\n it(\"should not log Warn level\", () => {\n logger.log(LogLevel.Warning, message, options);\n expect(warn).not.toHaveBeenCalled();\n });\n\n it(\"should not log Debug level\", () => {\n logger.log(LogLevel.Debug, message, options);\n expect(debug).not.toHaveBeenCalled();\n });\n\n it(\"should log Fatal level\", () => {\n logger.log(LogLevel.Fatal, message, options);\n expect(error).toHaveBeenCalledWith(options.tag, message, options.data);\n });\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAAyB,iDAGzBC,EAA8B,2BAE9B,MAAMC,EAAO,GAAG,MAAM,QAAS,MAAM,EAAE,mBAAmB,GAAG,GAAG,CAAC,EAC3DC,EAAO,GAAG,MAAM,QAAS,MAAM,EAAE,mBAAmB,GAAG,GAAG,CAAC,EAC3DC,EAAQ,GAAG,MAAM,QAAS,OAAO,EAAE,mBAAmB,GAAG,GAAG,CAAC,EAC7DC,EAAQ,GAAG,MAAM,QAAS,OAAO,EAAE,mBAAmB,GAAG,GAAG,CAAC,EAC7DC,EAAM,GAAG,MAAM,QAAS,KAAK,EAAE,mBAAmB,GAAG,GAAG,CAAC,EAE/D,IAAIC,EAEJ,MAAMC,EAAgC,CACpC,KAAM,CAAE,IAAK,OAAQ,EACrB,UA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AAM,CACrCK,EAAO,IAAI,WAAS,MAAOE,EAASD,CAAO,EAC3C,OAAOJ,CAAK,EAAE,IAAI,iBAAiB,CACrC,CAAC,EAED,GAAG,yBAA0B,IAAM,CACjCG,EAAO,IAAI,WAAS,MAAOE,EAASD,CAAO,EAC3C,OAAOH,CAAK,EAAE,qBAAqBG,EAAQ,IAAKC,EAASD,EAAQ,IAAI,CACvE,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
6
6
  "names": ["import_LogLevel", "import_ConsoleLogger", "warn", "info", "debug", "error", "log", "logger", "options", "message", "tag"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";var e=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var f=(o,r)=>{for(var t in r)e(o,t,{get:r[t],enumerable:!0})},n=(o,r,t,m)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of i(r))!p.call(o,a)&&a!==t&&e(o,a,{get:()=>r[a],enumerable:!(m=g(r,a))||m.enumerable});return o};var s=o=>n(e({},"__esModule",{value:!0}),o);var T={};f(T,{DefaultLogTagFormatter:()=>L});module.exports=s(T);class L{format(r){return Array.isArray(r)?r.map(t=>`[${t}]`).join(" "):`[${r}]`}}0&&(module.exports={DefaultLogTagFormatter});
2
+ //# sourceMappingURL=DefaultLogTagFormatter.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/logger-subscriber/service/DefaultLogTagFormatter.ts"],
4
+ "sourcesContent": ["import { type LogTag } from \"@api/logger-subscriber/model/LogSubscriberOptions\";\n\nimport { type LogTagFormatter } from \"./LogTagFormatter\";\n\n/**\n * Default implementation of LogTagFormatter.\n * Formats tags as \"[tag1] [tag2] [tag3]\" for arrays, or \"[tag]\" for strings.\n */\nexport class DefaultLogTagFormatter implements LogTagFormatter {\n format(tag: LogTag): string {\n if (Array.isArray(tag)) {\n return tag.map((t) => `[${t}]`).join(\" \");\n }\n return `[${tag}]`;\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAQO,MAAME,CAAkD,CAC7D,OAAOE,EAAqB,CAC1B,OAAI,MAAM,QAAQA,CAAG,EACZA,EAAI,IAAK,GAAM,IAAI,CAAC,GAAG,EAAE,KAAK,GAAG,EAEnC,IAAIA,CAAG,GAChB,CACF",
6
+ "names": ["DefaultLogTagFormatter_exports", "__export", "DefaultLogTagFormatter", "__toCommonJS", "tag"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var t=require("vitest"),e=require("./DefaultLogTagFormatter");(0,t.describe)("DefaultLogTagFormatter",()=>{const a=new e.DefaultLogTagFormatter;(0,t.describe)("format",()=>{(0,t.it)("should format a single string tag with brackets",()=>{(0,t.expect)(a.format("myTag")).toBe("[myTag]")}),(0,t.it)("should format an empty string tag with brackets",()=>{(0,t.expect)(a.format("")).toBe("[]")}),(0,t.it)("should format a single element array with brackets",()=>{(0,t.expect)(a.format(["myTag"])).toBe("[myTag]")}),(0,t.it)("should format multiple tags with brackets separated by spaces",()=>{(0,t.expect)(a.format(["tag1","tag2","tag3"])).toBe("[tag1] [tag2] [tag3]")}),(0,t.it)("should format an empty array as empty string",()=>{(0,t.expect)(a.format([])).toBe("")}),(0,t.it)("should handle tags with special characters",()=>{(0,t.expect)(a.format(["SignerEth","ContextModule","loader"])).toBe("[SignerEth] [ContextModule] [loader]")})})});
2
+ //# sourceMappingURL=DefaultLogTagFormatter.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/logger-subscriber/service/DefaultLogTagFormatter.test.ts"],
4
+ "sourcesContent": ["import { describe, expect, it } from \"vitest\";\n\nimport { DefaultLogTagFormatter } from \"./DefaultLogTagFormatter\";\n\ndescribe(\"DefaultLogTagFormatter\", () => {\n const formatter = new DefaultLogTagFormatter();\n\n describe(\"format\", () => {\n it(\"should format a single string tag with brackets\", () => {\n expect(formatter.format(\"myTag\")).toBe(\"[myTag]\");\n });\n\n it(\"should format an empty string tag with brackets\", () => {\n expect(formatter.format(\"\")).toBe(\"[]\");\n });\n\n it(\"should format a single element array with brackets\", () => {\n expect(formatter.format([\"myTag\"])).toBe(\"[myTag]\");\n });\n\n it(\"should format multiple tags with brackets separated by spaces\", () => {\n expect(formatter.format([\"tag1\", \"tag2\", \"tag3\"])).toBe(\n \"[tag1] [tag2] [tag3]\",\n );\n });\n\n it(\"should format an empty array as empty string\", () => {\n expect(formatter.format([])).toBe(\"\");\n });\n\n it(\"should handle tags with special characters\", () => {\n expect(formatter.format([\"SignerEth\", \"ContextModule\", \"loader\"])).toBe(\n \"[SignerEth] [ContextModule] [loader]\",\n );\n });\n });\n});\n"],
5
+ "mappings": "aAAA,IAAAA,EAAqC,kBAErCC,EAAuC,uCAEvC,YAAS,yBAA0B,IAAM,CACvC,MAAMC,EAAY,IAAI,4BAEtB,YAAS,SAAU,IAAM,IACvB,MAAG,kDAAmD,IAAM,IAC1D,UAAOA,EAAU,OAAO,OAAO,CAAC,EAAE,KAAK,SAAS,CAClD,CAAC,KAED,MAAG,kDAAmD,IAAM,IAC1D,UAAOA,EAAU,OAAO,EAAE,CAAC,EAAE,KAAK,IAAI,CACxC,CAAC,KAED,MAAG,qDAAsD,IAAM,IAC7D,UAAOA,EAAU,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,SAAS,CACpD,CAAC,KAED,MAAG,gEAAiE,IAAM,IACxE,UAAOA,EAAU,OAAO,CAAC,OAAQ,OAAQ,MAAM,CAAC,CAAC,EAAE,KACjD,sBACF,CACF,CAAC,KAED,MAAG,+CAAgD,IAAM,IACvD,UAAOA,EAAU,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CACtC,CAAC,KAED,MAAG,6CAA8C,IAAM,IACrD,UAAOA,EAAU,OAAO,CAAC,YAAa,gBAAiB,QAAQ,CAAC,CAAC,EAAE,KACjE,sCACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
6
+ "names": ["import_vitest", "import_DefaultLogTagFormatter", "formatter"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var a=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var p=(g,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of f(t))!i.call(g,o)&&o!==e&&a(g,o,{get:()=>t[o],enumerable:!(r=m(t,o))||r.enumerable});return g};var L=g=>p(a({},"__esModule",{value:!0}),g);var T={};module.exports=L(T);
2
+ //# sourceMappingURL=LogTagFormatter.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/api/logger-subscriber/service/LogTagFormatter.ts"],
4
+ "sourcesContent": ["import { type LogTag } from \"@api/logger-subscriber/model/LogSubscriberOptions\";\n\n/**\n * Interface for formatting log tags.\n * Allows different formatting strategies to be injected into subscribers.\n */\nexport interface LogTagFormatter {\n format(tag: LogTag): string;\n}\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["LogTagFormatter_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var i in e)p(n,i,{get:e[i],enumerable:!0})},T=(n,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of A(e))!R.call(n,t)&&t!==i&&p(n,t,{get:()=>e[t],enumerable:!(s=b(e,t))||s.enumerable});return n};var O=n=>T(p({},"__esModule",{value:!0}),n);var P={};y(P,{DeviceSession:()=>I});module.exports=O(P);var d=require("rxjs"),h=require("uuid"),S=require("../../../api/command/utils/CommandUtils"),v=require("../../../api/device/DeviceStatus"),u=require("../../../api/device-session/DeviceSessionState"),m=require("../../../api/utils/apduLogs"),l=require("../../device-session/data/DeviceSessionRefresherConst"),D=require("../../device-session/service/MutexService"),_=require("../../device-session/service/RefresherService"),g=require("./DevicePinger"),o=require("./DeviceSessionEventDispatcher"),f=require("./DeviceSessionRefresher"),E=require("./DeviceSessionStateHandler");class I{_id;_connectedDevice;_deviceState;_managerApiService;_secureChannelService;_logger;_refresherOptions;_pinger;_deviceSessionRefresher;_refresherService;_commandMutex=new D.MutexService;_sessionEventDispatcher=new o.DeviceSessionEventDispatcher;constructor({connectedDevice:e,id:i=(0,h.v4)()},s,t,r,c){this._id=i,this._connectedDevice=e,this._logger=s("device-session"),this._managerApiService=t,this._secureChannelService=r,this._refresherOptions={...l.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,...c},this._deviceState=new d.BehaviorSubject({sessionStateType:u.DeviceSessionStateType.Connected,deviceStatus:v.DeviceStatus.CONNECTED,deviceModelId:this._connectedDevice.deviceModel.id}),this._pinger=new g.DevicePinger(s,e,this._sessionEventDispatcher,(a,C)=>this.sendCommand(a,C)),this._deviceSessionRefresher=new f.DeviceSessionRefresher(s,this._refresherOptions,this._sessionEventDispatcher,this._connectedDevice),new E.DeviceSessionStateHandler(s,this._sessionEventDispatcher,this._connectedDevice,this._deviceState,a=>this.setDeviceSessionState(a)),this._refresherService=new _.RefresherService(s,{start:()=>this._deviceSessionRefresher.restartRefresher(),stop:()=>this._deviceSessionRefresher.stopRefresher()})}async initialiseSession(){try{await this._pinger.ping()}catch(e){throw this._logger.error("Error while initialising session",{data:{error:e}}),e}finally{this._refresherOptions.isRefresherDisabled||this._deviceSessionRefresher.startRefresher()}}get id(){return this._id}get connectedDevice(){return this._connectedDevice}get state(){return this._deviceState.asObservable()}getDeviceSessionState(){return this._deviceState.getValue()}setDeviceSessionState(e){this._deviceState.next(e)}async sendApdu(e,i={isPolling:!1,triggersDisconnection:!1,abortTimeout:void 0}){const s=await this._commandMutex.lock();try{this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_BUSY}),this._logger.debug((0,m.formatApduSendingLog)(e));const t=await this._connectedDevice.sendApdu(e,i.triggersDisconnection,i.abortTimeout);return t.ifRight(r=>{S.CommandUtils.isLockedDeviceResponse(r)?this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_LOCKED}):this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_CONNECTED})}).ifLeft(()=>{this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_CONNECTED})}),t}finally{s()}}async sendCommand(e,i){this._logger.debug(`[sendCommand] ${e.name}`);const s=e.getApdu();return(await this.sendApdu(s.getRawApdu(),{isPolling:!1,triggersDisconnection:e.triggersDisconnection??!1,abortTimeout:i})).caseOf({Left:r=>{throw this._logger.error("[sendCommand] error",{data:{err:r}}),r},Right:r=>{const c=e.parseResponse(r,this._connectedDevice.deviceModel.id);return this._logger.debug("[sendCommand] result",{data:{result:c}}),c}})}executeDeviceAction(e){const{observable:i,cancel:s}=e._execute({sendApdu:async t=>this.sendApdu(t),sendCommand:async(t,r)=>this.sendCommand(t,r),getDeviceModel:()=>this._connectedDevice.deviceModel,getDeviceSessionState:()=>this._deviceState.getValue(),getDeviceSessionStateObservable:()=>this.state,setDeviceSessionState:t=>(this.setDeviceSessionState(t),this._deviceState.getValue()),disableRefresher:t=>this._refresherService.disableRefresher(t),getManagerApiService:()=>this._managerApiService,getSecureChannelService:()=>this._secureChannelService});return{observable:i,cancel:s}}close(){this._updateDeviceStatus(v.DeviceStatus.NOT_CONNECTED),this._deviceState.complete(),this._deviceSessionRefresher.stopRefresher()}disableRefresher(e){return this._refresherService.disableRefresher(e)}_updateDeviceStatus(e){const i=this._deviceState.getValue();this._deviceState.next({...i,deviceStatus:e})}}0&&(module.exports={DeviceSession});
1
+ "use strict";var p=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var t in e)p(n,t,{get:e[t],enumerable:!0})},T=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of A(e))!R.call(n,i)&&i!==t&&p(n,i,{get:()=>e[i],enumerable:!(s=C(e,i))||s.enumerable});return n};var O=n=>T(p({},"__esModule",{value:!0}),n);var P={};y(P,{DeviceSession:()=>I});module.exports=O(P);var d=require("rxjs"),h=require("uuid"),S=require("../../../api/command/utils/CommandUtils"),v=require("../../../api/device/DeviceStatus"),u=require("../../../api/device-session/DeviceSessionState"),m=require("../../../api/utils/apduLogs"),l=require("../../device-session/data/DeviceSessionRefresherConst"),D=require("../../device-session/service/MutexService"),_=require("../../device-session/service/RefresherService"),g=require("./DevicePinger"),o=require("./DeviceSessionEventDispatcher"),f=require("./DeviceSessionRefresher"),E=require("./DeviceSessionStateHandler");class I{_id;_connectedDevice;_deviceState;_managerApiService;_secureChannelService;_logger;_refresherOptions;_pinger;_deviceSessionRefresher;_refresherService;_commandMutex=new D.MutexService;_sessionEventDispatcher=new o.DeviceSessionEventDispatcher;constructor({connectedDevice:e,id:t=(0,h.v4)()},s,i,r,c){this._id=t,this._connectedDevice=e,this._logger=s("device-session"),this._managerApiService=i,this._secureChannelService=r,this._refresherOptions={...l.DEVICE_SESSION_REFRESHER_DEFAULT_OPTIONS,...c},this._deviceState=new d.BehaviorSubject({sessionStateType:u.DeviceSessionStateType.Connected,deviceStatus:v.DeviceStatus.CONNECTED,deviceModelId:this._connectedDevice.deviceModel.id}),this._pinger=new g.DevicePinger(s,e,this._sessionEventDispatcher,(a,b)=>this.sendCommand(a,b)),this._deviceSessionRefresher=new f.DeviceSessionRefresher(s,this._refresherOptions,this._sessionEventDispatcher,this._connectedDevice),new E.DeviceSessionStateHandler(s,this._sessionEventDispatcher,this._connectedDevice,this._deviceState,a=>this.setDeviceSessionState(a)),this._refresherService=new _.RefresherService(s,{start:()=>this._deviceSessionRefresher.restartRefresher(),stop:()=>this._deviceSessionRefresher.stopRefresher()})}async initialiseSession(){try{await this._pinger.ping()}catch(e){throw this._logger.error("Error while initialising session",{data:{error:e}}),e}finally{this._refresherOptions.isRefresherDisabled||this._deviceSessionRefresher.startRefresher()}}get id(){return this._id}get connectedDevice(){return this._connectedDevice}get state(){return this._deviceState.asObservable()}getDeviceSessionState(){return this._deviceState.getValue()}setDeviceSessionState(e){this._deviceState.next(e)}async sendApdu(e,t={isPolling:!1,triggersDisconnection:!1,abortTimeout:void 0}){const s=await this._commandMutex.lock();try{this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_BUSY}),this._logger.debug((0,m.formatApduSendingLog)(e));const i=await this._connectedDevice.sendApdu(e,t.triggersDisconnection,t.abortTimeout);return i.ifRight(r=>{S.CommandUtils.isLockedDeviceResponse(r)?this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_LOCKED}):this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_CONNECTED})}).ifLeft(()=>{this._sessionEventDispatcher.dispatch({eventName:o.SessionEvents.DEVICE_STATE_UPDATE_CONNECTED})}),i}finally{s()}}async sendCommand(e,t){this._logger.debug(`[sendCommand] ${e.name}`);const s=e.getApdu();return(await this.sendApdu(s.getRawApdu(),{isPolling:!1,triggersDisconnection:e.triggersDisconnection??!1,abortTimeout:t})).caseOf({Left:r=>{throw this._logger.error("[sendCommand] error",{data:{err:r}}),r},Right:r=>{const c=e.parseResponse(r,this._connectedDevice.deviceModel.id);return this._logger.debug("[sendCommand] result",{data:{result:c}}),c}})}executeDeviceAction(e){const{observable:t,cancel:s}=e._execute({sendApdu:async i=>this.sendApdu(i),sendCommand:async(i,r)=>this.sendCommand(i,r),getDeviceModel:()=>this._connectedDevice.deviceModel,getDeviceSessionState:()=>this._deviceState.getValue(),getDeviceSessionStateObservable:()=>this.state,setDeviceSessionState:i=>(this.setDeviceSessionState(i),this._deviceState.getValue()),disableRefresher:i=>this._refresherService.disableRefresher(i),getManagerApiService:()=>this._managerApiService,getSecureChannelService:()=>this._secureChannelService});return{observable:t,cancel:s}}close(){this._updateDeviceStatus(v.DeviceStatus.NOT_CONNECTED),this._deviceState.complete(),this._deviceSessionRefresher.stopRefresher(),this._pinger.unsubscribe()}disableRefresher(e){return this._refresherService.disableRefresher(e)}_updateDeviceStatus(e){const t=this._deviceState.getValue();this._deviceState.next({...t,deviceStatus:e})}}0&&(module.exports={DeviceSession});
2
2
  //# sourceMappingURL=DeviceSession.js.map