@ledgerhq/device-management-kit 0.0.0-hid-candidate-3-20250528083456 → 0.0.0-io-revamp-20250618083854
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
- package/lib/cjs/src/api/command/utils/CommandUtils.js +1 -1
- package/lib/cjs/src/api/command/utils/CommandUtils.js.map +2 -2
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js +1 -1
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
- package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/Errors.js +1 -1
- package/lib/cjs/src/api/device-action/os/Errors.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js +1 -1
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +2 -2
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +1 -1
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +2 -2
- package/lib/cjs/src/api/index.js +1 -1
- package/lib/cjs/src/api/index.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/types.js.map +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js.map +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js.map +1 -1
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/task/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/task/types.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/utils.js +1 -1
- package/lib/cjs/src/api/secure-channel/utils.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/utils.test.js +1 -1
- package/lib/cjs/src/api/secure-channel/utils.test.js.map +3 -3
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js +2 -0
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +7 -0
- package/lib/cjs/src/api/transport/model/Errors.js +1 -1
- package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
- package/lib/cjs/src/internal/secure-channel/model/Errors.js +1 -1
- package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +3 -3
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js +1 -1
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
- package/lib/esm/src/api/command/utils/CommandUtils.js +1 -1
- package/lib/esm/src/api/command/utils/CommandUtils.js.map +3 -3
- package/lib/esm/src/api/command/utils/CommandUtils.test.js +1 -1
- package/lib/esm/src/api/command/utils/CommandUtils.test.js.map +2 -2
- package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
- package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
- package/lib/esm/src/api/device-action/os/Errors.js +1 -1
- package/lib/esm/src/api/device-action/os/Errors.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js +1 -1
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +3 -3
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +1 -1
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +3 -3
- package/lib/esm/src/api/index.js +1 -1
- package/lib/esm/src/api/index.js.map +3 -3
- package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
- package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +2 -2
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.js.map +2 -2
- package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +2 -2
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
- package/lib/esm/src/api/secure-channel/task/types.js +1 -1
- package/lib/esm/src/api/secure-channel/task/types.js.map +2 -2
- package/lib/esm/src/api/secure-channel/utils.js +1 -1
- package/lib/esm/src/api/secure-channel/utils.js.map +3 -3
- package/lib/esm/src/api/secure-channel/utils.test.js +1 -1
- package/lib/esm/src/api/secure-channel/utils.test.js.map +3 -3
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js +2 -0
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +7 -0
- package/lib/esm/src/api/transport/model/Errors.js +1 -1
- package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
- package/lib/esm/src/internal/secure-channel/model/Errors.js +1 -1
- package/lib/esm/src/internal/secure-channel/model/Errors.js.map +3 -3
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.js +1 -1
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
- package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts +28 -0
- package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts.map +1 -1
- package/lib/types/src/api/command/utils/CommandUtils.d.ts +3 -0
- package/lib/types/src/api/command/utils/CommandUtils.d.ts.map +1 -1
- package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +1 -0
- package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/Errors.d.ts +10 -0
- package/lib/types/src/api/device-action/os/Errors.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +2 -1
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +3 -2
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts +2 -2
- package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts.map +1 -1
- package/lib/types/src/api/index.d.ts +1 -1
- package/lib/types/src/api/index.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/InstallApp/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +5 -2
- package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/task/types.d.ts +6 -1
- package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/utils.d.ts +0 -11
- package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +8 -7
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts +2 -0
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts.map +1 -0
- package/lib/types/src/api/transport/model/Errors.d.ts +0 -5
- package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/model/Errors.d.ts +22 -2
- package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -1
- package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts +5 -1
- package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/transport/model/DeviceConnectionStateMachine.ts"],
|
4
|
-
"sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { type Either, Left, Maybe, Nothing, Right } from \"purify-ts\";\nimport { type Actor, assign, createActor, emit, setup } from \"xstate\";\n\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DmkError, UnknownDeviceExchangeError } from \"@api/Error\";\nimport { type DeviceId } from \"@api/types\";\n\nimport { type DeviceApduSender } from \"./DeviceApduSender\";\nimport {\n AlreadySendingApduError,\n DeviceDisconnectedBeforeSendingApdu,\n DeviceDisconnectedWhileSendingError,\n} from \"./Errors\";\n\n// const { inspect } = createBrowserInspector();\n\ntype DeviceDetachedEvent = {\n type: \"DeviceDetached\";\n};\n\ntype DeviceAttachedEvent = {\n type: \"DeviceAttached\";\n};\n\ntype ApduResponseReceived = {\n type: \"ApduResponseReceived\";\n apduResponse: ApduResponse;\n};\n\ntype ApduSendingError = {\n type: \"ApduSendingError\";\n error: DmkError;\n};\n\ntype SendApduCalled = {\n type: \"SendApduCalled\";\n apdu: Uint8Array;\n triggersDisconnection: boolean;\n abortTimeout?: number;\n responseCallback: (response: Either<DmkError, ApduResponse>) => void;\n};\n\ntype ReconnectionTimedOut = {\n type: \"ReconnectionTimedOut\";\n};\n\ntype CloseConnectionCalled = {\n type: \"CloseConnectionCalled\";\n};\n\nexport type DeviceConnectionEvent =\n | DeviceDetachedEvent\n | DeviceAttachedEvent\n | ApduResponseReceived\n | ApduSendingError\n | SendApduCalled\n | CloseConnectionCalled\n | ReconnectionTimedOut;\n\nexport type DeviceConnectionStateMachineParams<Dependencies> = {\n deviceId: DeviceId;\n deviceApduSender: DeviceApduSender<Dependencies>;\n timeoutDuration: number;\n onTerminated: () => void;\n};\n\nexport class DeviceConnectionStateMachine<Dependencies> {\n private deviceId: DeviceId;\n private deviceAdpuSender: DeviceApduSender<Dependencies>;\n\n private machineActor: Actor<ReturnType<typeof makeStateMachine>>;\n\n private timeoutDuration: number;\n private timeout: ReturnType<typeof setTimeout> | null = null;\n\n startReconnectionTimeout() {\n this.timeout = setTimeout(() => {\n this.machineActor.send({ type: \"ReconnectionTimedOut\" });\n }, this.timeoutDuration);\n }\n\n constructor(params: DeviceConnectionStateMachineParams<Dependencies>) {\n this.deviceId = params.deviceId;\n this.deviceAdpuSender = params.deviceApduSender;\n this.timeoutDuration = params.timeoutDuration;\n this.machineActor = createActor(\n makeStateMachine({\n sendApduFn: (apdu, triggersDisconnection, abortTimeout) =>\n this.sendApduToDeviceConnection(\n apdu,\n triggersDisconnection,\n abortTimeout,\n ),\n startReconnectionTimeout: () => this.startReconnectionTimeout(),\n cancelReconnectionTimeout: () => {\n if (this.timeout) {\n clearTimeout(this.timeout);\n this.timeout = null;\n }\n },\n onTerminated: params.onTerminated,\n closeConnection: () => {\n this.deviceAdpuSender.closeConnection();\n },\n }),\n // {\n // // inspect,\n // },\n );\n this.machineActor.start();\n }\n\n private sendApduToDeviceConnection(\n apdu: Uint8Array,\n triggersDisconnection?: boolean,\n abortTimeout?: number,\n ) {\n this.deviceAdpuSender\n .sendApdu(apdu, triggersDisconnection, abortTimeout)\n .then((response) => {\n response.caseOf({\n Left: (error) => {\n this.machineActor.send({ type: \"ApduSendingError\", error });\n },\n Right: (apduResponse) => {\n this.machineActor.send({\n type: \"ApduResponseReceived\",\n apduResponse,\n });\n },\n });\n })\n .catch((error) => {\n this.machineActor.send({\n type: \"ApduSendingError\",\n error: new UnknownDeviceExchangeError(error),\n });\n });\n }\n\n /**\n * Called by the transport\n */\n\n public getDependencies(): Dependencies {\n return this.deviceAdpuSender.getDependencies();\n }\n\n public setDependencies(dependencies: Dependencies) {\n this.deviceAdpuSender.setDependencies(dependencies);\n }\n\n public getDeviceId() {\n return this.deviceId;\n }\n\n public sendApdu(\n apdu: Uint8Array,\n triggersDisconnection?: boolean,\n abortTimeout?: number,\n ): Promise<Either<DmkError, ApduResponse>> {\n return new Promise((responseCallback) => {\n this.machineActor.send({\n type: \"SendApduCalled\",\n apdu,\n triggersDisconnection: !!triggersDisconnection,\n abortTimeout,\n responseCallback,\n });\n });\n }\n\n public async setupConnection() {\n await this.deviceAdpuSender.setupConnection();\n }\n\n // State Machine Events\n\n public eventDeviceAttached() {\n this.machineActor.send({ type: \"DeviceAttached\" });\n }\n\n public eventDeviceDetached() {\n this.machineActor.send({ type: \"DeviceDetached\" });\n }\n\n public closeConnection() {\n this.machineActor.send({ type: \"CloseConnectionCalled\" });\n }\n}\n\nfunction makeStateMachine({\n sendApduFn,\n startReconnectionTimeout,\n cancelReconnectionTimeout,\n onTerminated,\n closeConnection,\n}: {\n sendApduFn: (\n apdu: Uint8Array,\n triggersDisconnection: boolean,\n abortTimeout?: number,\n ) => void;\n startReconnectionTimeout: () => void;\n cancelReconnectionTimeout: () => void;\n onTerminated: () => void;\n closeConnection: () => void;\n}) {\n return setup({\n types: {} as {\n context: {\n apduInProgress: Maybe<{\n apdu: Uint8Array;\n triggersDisconnection: boolean;\n abortTimeout?: number;\n responseCallback: (response: Either<DmkError, ApduResponse>) => void;\n }>;\n };\n events: DeviceConnectionEvent;\n },\n actions: {\n // event transitions\n startTimer: () => {\n startReconnectionTimeout();\n },\n cancelTimer: () => {\n cancelReconnectionTimeout();\n },\n reconnectionTimeoutEvent: emit({ type: \"ReconnectionTimedOut\" }),\n sendApdu: ({ context }) => {\n context.apduInProgress.map(({ apdu, abortTimeout }) => {\n sendApduFn(apdu, false, abortTimeout);\n });\n },\n sendApduResponse: (\n { context },\n params: { response: Either<DmkError, ApduResponse> },\n ) => {\n context.apduInProgress.map(({ responseCallback }) =>\n responseCallback(params.response),\n );\n },\n cleanupContext: assign({ apduInProgress: Nothing }),\n signalTermination: () => {\n onTerminated();\n },\n closeConnection: () => {\n closeConnection(); // ASK: how do we handle errors ?\n },\n },\n guards: {\n isApduThatTriggersDisconnection: (\n { context },\n params: { apduResponse: ApduResponse },\n ) => {\n return context.apduInProgress.caseOf({\n Just: ({ triggersDisconnection, apdu }) => {\n const res =\n (triggersDisconnection ||\n CommandUtils.isApduThatTriggersDisconnection(apdu)) &&\n CommandUtils.isSuccessResponse(params.apduResponse);\n return res;\n },\n Nothing: () => false,\n });\n },\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QTANwJYGMwGED2AdgWJgC7qEB0+RJpkAxACJpZgukCGmAFpANoAGALqJQABzyx05QmJAAPRAA4A7AGZKywQEYAnAFYATMoAsBg6fUA2ADQgAnolUnKBjUdXXVpnUb0aAL6B9igY2DTEZBQE1IRR9BAMAMpgBBAAguIQAK44nAA2BQIi8pLSsgTySgjW6oKU6uo61kbWyh06Vsr2TgjqAZR6HUaWXcrqBmrBoawR8XQxcbRkjDgFUrgL0YT5RSWiSCDlMjHVKnrWjaO6ev6qlnp6vYim1qaN9YLqGuPKOjpVDMQGE2JFFlRUul0AQoFlcgx4TkAEpwSQEWBgVHYdCoA5lKSnORHGpNVSUPwGXQDQSmNTDF4IZTWPRDJotUw+HwAnTA0HzFaVShQiAwuHZHKIiWo2DozHYsC4gQ6Q4SQmVc79TxDIzqG6eJq+VSM94NPQ6CYuUzmQGCax8uZbQVLEVipFS3Ku2EAUQATr68L6hKrjuqziTEJNNHrTG1dIIDE8jLTGVTlJQboI2i56QZeSEQY7wTtYl7xQiWOF2GAuLx8UcThqIwh-OmdBZPF0qQCBoydIJlAZKK0jP4bHntBaHVXi0Ky+71ptZzE9sUIMGCRVw6Aau2dJQ6WZlMM-D9+89HIh++mbndVHpdNYLAnp2DtnO0qLYe6RUjV-W1S3Ykd0QABac1KFpbx3kHCxumNS9ak5SDTHNax0NUDRfFMV8BQSJYAHVOFOWEADFA2xd8YmYR0MlIWs+HXUoGzDYDFEQQx90mVozABJ9BAvPo6iuFpRgtQRdDUWNcKdfCqCIkioHI31KOdQgUk-P9CjXDcWKAqpmx0dR-gpCTaXNUxvh7RkvCHWlaWM9RfC6dCZOXeTiPIMiKJIKj1NUuSCAAFXQABbSAAHkclIXTAKJAyQIQLpBHJAEXB8AS1HvdRGT0a0D2ZZpBxjSc3L82IFK8pSfMwcqGEXTF3IIf8mJDRtt3YpLLPJZMWkmTtzJyxD+1UBofifVQOm8YyWjKtSKs8sVlICiECAImQeAARRyMAdogX8JRoqs6IYgDQ30zUjJ8CkWQmYZbOsFLGWzUyzE5bssx8ObAsoSqlpq8r1tILadr2g6ERWksQvCiAopi5i4qbRKjH7Bo4N1dsvFjOxEIeIwUPQ9o9AGSYvG+1bfsW7yVN8+agZB3bIHByUGtk1aWti874s1FGJOHYy6gTLo3lMVN7wPBNVAtbRRg0IEC35NmS0pxTltpwL6e2xn9s0w7mY5hGuaRzrAWZIYBJpc0pd1E18tNMZLOMAwnOCAsCDwFB4CORWms3bnm1AozWSgrHYMsYyEL6FGKXcDleMMO5rXJ5XZ0gP3jZqB4evaLwXEeqwnJNKYDypWlzHePwcIVotyuFT83QldOOpqWNU30A8rEmrMjPcAJk6FP7qch432rY3dxnN1onlaZ9idy5NILuCxl+UEwrH7wiqeqmnarpjatbB3Xcibser3eckfmd3xOkrnpce0DMjHMeoAgLjeqCCsBfVCmFOESE+EqdSfnmNwLJjBPBSs0QwuV3CQWPN3AwT4LTtldoEIAA */\n id: \"deviceConnection\",\n initial: \"Connected\",\n context: {\n apduInProgress: Nothing,\n },\n states: {\n Connected: {\n on: {\n DeviceDetached: {\n target: \"WaitingForReconnection\",\n },\n SendApduCalled: {\n target: \"SendingApdu\",\n actions: assign({\n apduInProgress: ({ event }) => {\n return Maybe.of({\n apdu: event.apdu,\n triggersDisconnection: event.triggersDisconnection,\n abortTimeout: event.abortTimeout,\n responseCallback: event.responseCallback,\n });\n },\n }),\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n },\n },\n },\n SendingApdu: {\n entry: \"sendApdu\",\n on: {\n ApduResponseReceived: [\n {\n guard: {\n type: \"isApduThatTriggersDisconnection\",\n params: ({ event }) => ({ apduResponse: event.apduResponse }),\n },\n target: \"WaitingForReconnection\",\n actions: [\n {\n type: \"sendApduResponse\",\n // https://stately.ai/docs/actions#dynamic-action-parameters\n params: ({ event }) => {\n return {\n response: Right(event.apduResponse),\n };\n },\n },\n { type: \"cleanupContext\" },\n ],\n },\n {\n target: \"Connected\",\n actions: [\n {\n type: \"sendApduResponse\",\n // https://stately.ai/docs/actions#dynamic-action-parameters\n params: ({ event }) => {\n return {\n response: Right(event.apduResponse),\n };\n },\n },\n { type: \"cleanupContext\" },\n ],\n },\n ],\n ApduSendingError: {\n target: \"Connected\",\n actions: [\n {\n type: \"sendApduResponse\",\n // https://stately.ai/docs/actions#dynamic-action-parameters\n params: ({ event }) => {\n return {\n response: Left(event.error),\n };\n },\n },\n \"cleanupContext\",\n ],\n },\n DeviceDetached: {\n target: \"WaitingForReconnection\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedWhileSendingError()),\n },\n },\n \"cleanupContext\",\n ],\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedWhileSendingError()),\n },\n },\n \"cleanupContext\",\n ],\n },\n SendApduCalled: {\n actions: ({ event }) => {\n event.responseCallback(Left(new AlreadySendingApduError()));\n },\n },\n },\n },\n WaitingForReconnection: {\n entry: \"startTimer\",\n on: {\n DeviceAttached: {\n target: \"Connected\",\n actions: \"cancelTimer\",\n },\n SendApduCalled: {\n target: \"WaitingForReconnectionWithQueuedSendApdu\",\n actions: assign({\n apduInProgress: ({ event }) => {\n return Maybe.of({\n apdu: event.apdu,\n triggersDisconnection: event.triggersDisconnection,\n abortTimeout: event.abortTimeout,\n responseCallback: event.responseCallback,\n });\n },\n }),\n },\n ReconnectionTimedOut: {\n target: \"Terminated\",\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n },\n },\n },\n WaitingForReconnectionWithQueuedSendApdu: {\n on: {\n DeviceAttached: {\n target: \"SendingApdu\",\n actions: \"cancelTimer\",\n },\n ReconnectionTimedOut: {\n target: \"Terminated\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedBeforeSendingApdu()),\n },\n },\n {\n type: \"cleanupContext\",\n },\n ],\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedWhileSendingError()),\n },\n },\n \"cleanupContext\",\n ],\n },\n SendApduCalled: {\n actions: ({ event }) => {\n event.responseCallback(Left(new AlreadySendingApduError()));\n },\n },\n },\n },\n // TODO: ADD INACTIVE STATE\n Terminated: {\n entry: [\"signalTermination\", \"closeConnection\"],\n type: \"final\",\n },\n },\n });\n}\n"],
|
5
|
-
"mappings": "AACA,OAAsB,QAAAA,EAAM,SAAAC,EAAO,WAAAC,EAAS,SAAAC,MAAa,YACzD,OAAqB,UAAAC,EAAQ,eAAAC,EAAa,QAAAC,EAAM,SAAAC,MAAa,SAE7D,OAAS,gBAAAC,MAAoB,kCAE7B,OAAwB,8BAAAC,MAAkC,aAI1D,OACE,2BAAAC,EACA,uCAAAC,EACA,uCAAAC,MACK,
|
6
|
-
"names": ["Left", "Maybe", "Nothing", "Right", "assign", "createActor", "emit", "setup", "CommandUtils", "UnknownDeviceExchangeError", "AlreadySendingApduError", "DeviceDisconnectedBeforeSendingApdu", "DeviceDisconnectedWhileSendingError", "DeviceConnectionStateMachine", "params", "makeStateMachine", "apdu", "triggersDisconnection", "abortTimeout", "response", "error", "apduResponse", "dependencies", "responseCallback", "sendApduFn", "startReconnectionTimeout", "cancelReconnectionTimeout", "onTerminated", "closeConnection", "context", "event"]
|
4
|
+
"sourcesContent": ["// import { createBrowserInspector } from \"@statelyai/inspect\";\nimport { type Either, Left, Maybe, Nothing, Right } from \"purify-ts\";\nimport { type Actor, assign, createActor, emit, setup } from \"xstate\";\n\nimport { GetAppAndVersionCommand } from \"@api/command/os/GetAppAndVersionCommand\";\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DmkError, UnknownDeviceExchangeError } from \"@api/Error\";\nimport { type DeviceId } from \"@api/types\";\n\nimport { type DeviceApduSender } from \"./DeviceApduSender\";\nimport {\n AlreadySendingApduError,\n DeviceDisconnectedBeforeSendingApdu,\n DeviceDisconnectedWhileSendingError,\n} from \"./Errors\";\n\n// const { inspect } = createBrowserInspector();\n\ntype DeviceDisconnectedEvent = {\n type: \"DeviceDisconnected\";\n};\n\ntype DeviceConnectedEvent = {\n type: \"DeviceConnected\";\n};\n\ntype ApduResponseReceived = {\n type: \"ApduResponseReceived\";\n apduResponse: ApduResponse;\n};\n\ntype ApduSendingError = {\n type: \"ApduSendingError\";\n error: DmkError;\n};\n\ntype SendApduCalled = {\n type: \"SendApduCalled\";\n apdu: Uint8Array;\n triggersDisconnection: boolean;\n abortTimeout?: number;\n responseCallback: (response: Either<DmkError, ApduResponse>) => void;\n};\n\ntype ReconnectionTimedOut = {\n type: \"ReconnectionTimedOut\";\n};\n\ntype CloseConnectionCalled = {\n type: \"CloseConnectionCalled\";\n};\n\nexport type Events =\n | DeviceDisconnectedEvent\n | DeviceConnectedEvent\n | ApduResponseReceived\n | ApduSendingError\n | SendApduCalled\n | CloseConnectionCalled\n | ReconnectionTimedOut;\n\nexport type DeviceConnectionStateMachineParams<Dependencies> = {\n deviceId: DeviceId;\n deviceApduSender: DeviceApduSender<Dependencies>;\n timeoutDuration: number;\n tryToReconnect: (timeoutDuration: number) => void;\n onTerminated: () => void;\n};\n\nexport class DeviceConnectionStateMachine<Dependencies> {\n private deviceId: DeviceId;\n private deviceAdpuSender: DeviceApduSender<Dependencies>;\n\n private machineActor: Actor<ReturnType<typeof makeStateMachine>>;\n\n private timeoutDuration: number;\n private timeout: ReturnType<typeof setTimeout> | null = null;\n\n startReconnectionTimeout() {\n this.timeout = setTimeout(() => {\n this.machineActor.send({ type: \"ReconnectionTimedOut\" });\n }, this.timeoutDuration);\n }\n\n constructor(params: DeviceConnectionStateMachineParams<Dependencies>) {\n this.deviceId = params.deviceId;\n this.deviceAdpuSender = params.deviceApduSender;\n this.timeoutDuration = params.timeoutDuration;\n this.machineActor = createActor(\n makeStateMachine({\n sendApduFn: (apdu, triggersDisconnection, abortTimeout) =>\n this.sendApduToDeviceConnection(\n apdu,\n triggersDisconnection,\n abortTimeout,\n ),\n startReconnectionTimeout: () => this.startReconnectionTimeout(),\n cancelReconnectionTimeout: () => {\n if (this.timeout) {\n clearTimeout(this.timeout);\n this.timeout = null;\n }\n },\n tryToReconnect: () => {\n params.tryToReconnect(this.timeoutDuration);\n },\n onTerminated: params.onTerminated,\n closeConnection: () => {\n this.deviceAdpuSender.closeConnection();\n },\n }),\n // {\n // // inspect,\n // },\n );\n this.machineActor.start();\n }\n\n private sendApduToDeviceConnection(\n apdu: Uint8Array,\n triggersDisconnection?: boolean,\n abortTimeout?: number,\n ) {\n this.deviceAdpuSender\n .sendApdu(apdu, triggersDisconnection, abortTimeout)\n .then((response) => {\n response.caseOf({\n Left: (error) => {\n this.machineActor.send({ type: \"ApduSendingError\", error });\n },\n Right: (apduResponse) => {\n this.machineActor.send({\n type: \"ApduResponseReceived\",\n apduResponse,\n });\n },\n });\n })\n .catch((error) => {\n this.machineActor.send({\n type: \"ApduSendingError\",\n error: new UnknownDeviceExchangeError(error),\n });\n });\n }\n\n /**\n * Called by the transport\n */\n\n public getDependencies(): Dependencies {\n return this.deviceAdpuSender.getDependencies();\n }\n\n public setDependencies(dependencies: Dependencies) {\n this.deviceAdpuSender.setDependencies(dependencies);\n }\n\n public getDeviceId() {\n return this.deviceId;\n }\n\n public sendApdu(\n apdu: Uint8Array,\n triggersDisconnection?: boolean,\n abortTimeout?: number,\n ): Promise<Either<DmkError, ApduResponse>> {\n return new Promise((responseCallback) => {\n this.machineActor.send({\n type: \"SendApduCalled\",\n apdu,\n triggersDisconnection: !!triggersDisconnection,\n abortTimeout,\n responseCallback,\n });\n });\n }\n\n public async setupConnection() {\n await this.deviceAdpuSender.setupConnection();\n }\n\n // State Machine Events\n\n public eventDeviceConnected() {\n this.machineActor.send({ type: \"DeviceConnected\" });\n }\n\n public eventDeviceDisconnected() {\n this.machineActor.send({ type: \"DeviceDisconnected\" });\n }\n\n public closeConnection() {\n this.machineActor.send({ type: \"CloseConnectionCalled\" });\n }\n}\n\nfunction makeStateMachine({\n sendApduFn,\n startReconnectionTimeout,\n cancelReconnectionTimeout,\n tryToReconnect,\n onTerminated,\n closeConnection,\n}: {\n sendApduFn: (\n apdu: Uint8Array,\n triggersDisconnection: boolean,\n abortTimeout?: number,\n ) => void;\n startReconnectionTimeout: () => void;\n cancelReconnectionTimeout: () => void;\n tryToReconnect: () => void;\n onTerminated: () => void;\n closeConnection: () => void;\n}) {\n return setup({\n types: {} as {\n context: {\n apduInProgress: Maybe<{\n apdu: Uint8Array;\n triggersDisconnection: boolean;\n abortTimeout?: number;\n responseCallback: (response: Either<DmkError, ApduResponse>) => void;\n }>;\n apduResponse: Maybe<ApduResponse>;\n };\n events: Events;\n },\n actions: {\n // event transitions\n startTimer: () => {\n startReconnectionTimeout();\n },\n cancelTimer: () => {\n cancelReconnectionTimeout();\n },\n reconnectionTimeoutEvent: emit({ type: \"ReconnectionTimedOut\" }),\n sendApdu: ({ context }) => {\n context.apduInProgress.map(({ apdu, abortTimeout }) => {\n sendApduFn(apdu, false, abortTimeout);\n });\n },\n sendApduResponse: (\n { context },\n params: { response: Either<DmkError, ApduResponse> },\n ) => {\n context.apduInProgress.map(({ responseCallback }) =>\n responseCallback(params.response),\n );\n },\n sendGetAppAndVersion: () => {\n // TODO: not import the command like this, might cause circular dependencies\n sendApduFn(new GetAppAndVersionCommand().getApdu().getRawApdu(), false);\n },\n tryToReconnect: () => {\n tryToReconnect();\n },\n clearApduInProgress: assign({\n apduInProgress: Nothing,\n }),\n clearApduResponse: assign({\n apduResponse: Nothing,\n }),\n signalTermination: () => {\n onTerminated();\n },\n closeConnection: () => {\n closeConnection(); // ASK: how do we handle errors ?\n },\n },\n guards: {\n isApduThatTriggersDisconnection: (\n { context },\n params: { apduResponse: ApduResponse },\n ) => {\n return context.apduInProgress.caseOf({\n Just: ({ triggersDisconnection, apdu }) => {\n const res =\n (triggersDisconnection ||\n CommandUtils.isApduThatTriggersDisconnection(apdu)) &&\n CommandUtils.isSuccessResponse(params.apduResponse);\n return res;\n },\n Nothing: () => false,\n });\n },\n },\n }).createMachine({\n /** @xstate-layout N4IgpgJg5mDOIC5QTANwJYGMwGED2AdgWJgC7qEB0+RJpkAxACJpZgukCGmAFpANoAGALqJQABzyx05QmJAAPRAA4A7AGZKywQEYAnAFYATMoAsBg6fUA2ADQgAnolUnKBjUdXXVpnUb0aAL6B9igY2DTEZBQE1IRR9BAMAMpgBBAAguIQAK44nAA2BQIi8pLSsgTySgjW6oKU6uo61kbWyh06Vsr2TgjqAZR6HUaWXcrqBmrBoawR8XQxcbRkjDgFUrgL0YT5RSWiSCDlMjHVKnrWjaO6ev6qlnp6vYim1qaN9YLqGuPKOjpVDMQGE2JFFlRUul0AQoFlcgx4TkAEpwSQEWBgVHYdCoA5lKSnORHGpNVSUPwGXQDQSmNTDF4IZTWPRDJotUw+HwAnTA0HzFaVShQiAwuHZHKIiWo2DozHYsC4gQ6Q4SQmVc79TxDIzqG6eJq+VSM94NPQ6CYuUzmQGCax8uZbQVLEVipFS3Ku2EAUQATr68L6hKrjuqziTEJNNHrTG1dIIDE8jLTGVTlJQboI2i56QZeSEQY7wTtYl7xQiWOF2GAuLx8UcThqIwh-OmdBZPF0qQCBoydIJlAZKK0jP4bHntBaHVXi0Ky+71ptZzE9sUIMGCRVw6Aau2dJQ6WZlMM-D9+89HIh++mbndVHpdNYLAnp2DtnO0qLYe6RUjV-W1S3Ykd0QABac1KFpbx3kHCxumNS9ak5SDTHNax0NUDRfFMV8BQSJYAHVOFOWEADFA2xd8YmYR0MlIWs+HXUoGzDYDFEQQx90mVozABJ9BAvPo6iuFpRgtQRdDUWNcKdfCqCIkioHI31KOdQgUk-P9CjXDcWKAqpmx0dR-gpCTaXNUxvh7RkvCHWlaWM9RfC6dCZOXeTiPIMiKJIKj1NUuSCAAFXQABbSAAHkclIXTAKJAyQIQLpBHJAEXB8AS1HvdRGT0a0D2ZZpBxjSc3L82IFK8pSfMwcqGEXTF3IIf8mJDRtt3YpLLPJZMWkmTtzJyxD+1UBofifVQOm8YyWjKtSKs8sVlICiECAImQeAARRyMAdogX8JRoqs6IYgDQ30zUjJ8CkWQmYZbOsFLGWzUyzE5bssx8ObAsoSqlpq8r1tILadr2g6ERWksQvCiAopi5i4qbRKjH7Bo4N1dsvFjOxEIeIwUPQ9o9AGSYvG+1bfsW7yVN8+agZB3bIHByUGtk1aWti874s1FGJOHYy6gTLo3lMVN7wPBNVAtbRRg0IEC35NmS0pxTltpwL6e2xn9s0w7mY5hGuaRzrAWZIYBJpc0pd1E18tNMZLOMAwnOCAsCDwFB4CORWms3bnm1AozWSgrHYMsYyEL6FGKXcDleMMO5rXJ5XZ0gP3jZqB4evaLwXEeqwnJNKYDypWlzHePwcIVotyuFT83QldOOpqWNU30A8rEmrMjPcAJk6FP7qch432rY3dxnN1onlaZ9idy5NILuCxl+UEwrH7wiqeqmnarpjatbB3Xcibser3eckfmd3xOkrnpce0DMjHMeoAgLjeqCCsBfVCmFOESE+EqdSfnmNwLJjBPBSs0QwuV3CQWPN3AwT4LTtldoEIAA */\n id: \"deviceConnection\",\n initial: \"Connected\",\n context: {\n apduInProgress: Nothing,\n apduResponse: Nothing,\n },\n states: {\n Connected: {\n on: {\n DeviceDisconnected: {\n target: \"WaitingForReconnection\",\n },\n SendApduCalled: {\n target: \"SendingApdu\",\n actions: assign({\n apduInProgress: ({ event }) => {\n return Maybe.of({\n apdu: event.apdu,\n triggersDisconnection: event.triggersDisconnection,\n abortTimeout: event.abortTimeout,\n responseCallback: event.responseCallback,\n });\n },\n }),\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n },\n },\n },\n SendingApdu: {\n entry: \"sendApdu\",\n on: {\n ApduResponseReceived: [\n {\n guard: {\n type: \"isApduThatTriggersDisconnection\",\n params: ({ event }) => ({ apduResponse: event.apduResponse }),\n },\n target: \"WaitingForDisconnection\",\n actions: [\n assign({\n apduResponse: ({ event }) => Maybe.of(event.apduResponse),\n }),\n ],\n },\n {\n target: \"Connected\",\n actions: [\n {\n type: \"sendApduResponse\",\n // https://stately.ai/docs/actions#dynamic-action-parameters\n params: ({ event }) => {\n return {\n response: Right(event.apduResponse),\n };\n },\n },\n { type: \"clearApduInProgress\" },\n ],\n },\n ],\n ApduSendingError: {\n target: \"Connected\",\n actions: [\n {\n type: \"sendApduResponse\",\n // https://stately.ai/docs/actions#dynamic-action-parameters\n params: ({ event }) => {\n return {\n response: Left(event.error),\n };\n },\n },\n \"clearApduInProgress\",\n ],\n },\n DeviceDisconnected: {\n target: \"WaitingForReconnection\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedWhileSendingError()),\n },\n },\n \"clearApduInProgress\",\n ],\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedWhileSendingError()),\n },\n },\n \"clearApduInProgress\",\n ],\n },\n SendApduCalled: {\n actions: ({ event }) => {\n event.responseCallback(Left(new AlreadySendingApduError()));\n },\n },\n },\n },\n WaitingForDisconnection: {\n entry: \"sendGetAppAndVersion\",\n exit: [\n {\n type: \"sendApduResponse\",\n params: ({ context }) => {\n return {\n response: context.apduResponse.caseOf({\n Just: (apduResponse) => Right(apduResponse),\n Nothing: () => Left(new UnknownDeviceExchangeError()),\n }),\n };\n },\n },\n { type: \"clearApduInProgress\" },\n { type: \"clearApduResponse\" },\n ],\n on: {\n ApduResponseReceived: {\n target: \"Connected\",\n },\n ApduSendingError: {\n target: \"WaitingForReconnection\",\n },\n DeviceDisconnected: {\n target: \"WaitingForReconnection\",\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n },\n },\n },\n WaitingForReconnection: {\n entry: [\"startTimer\", \"tryToReconnect\"],\n on: {\n DeviceConnected: {\n target: \"Connected\",\n actions: \"cancelTimer\",\n },\n SendApduCalled: {\n target: \"WaitingForReconnectionWithQueuedSendApdu\",\n actions: assign({\n apduInProgress: ({ event }) => {\n return Maybe.of({\n apdu: event.apdu,\n triggersDisconnection: event.triggersDisconnection,\n abortTimeout: event.abortTimeout,\n responseCallback: event.responseCallback,\n });\n },\n }),\n },\n ReconnectionTimedOut: {\n target: \"Terminated\",\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n },\n },\n },\n WaitingForReconnectionWithQueuedSendApdu: {\n on: {\n DeviceConnected: {\n target: \"SendingApdu\",\n actions: \"cancelTimer\",\n },\n ReconnectionTimedOut: {\n target: \"Terminated\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedBeforeSendingApdu()),\n },\n },\n {\n type: \"clearApduInProgress\",\n },\n ],\n },\n CloseConnectionCalled: {\n target: \"Terminated\",\n actions: [\n {\n type: \"sendApduResponse\",\n params: {\n response: Left(new DeviceDisconnectedWhileSendingError()),\n },\n },\n \"clearApduInProgress\",\n ],\n },\n SendApduCalled: {\n actions: ({ event }) => {\n event.responseCallback(Left(new AlreadySendingApduError()));\n },\n },\n },\n },\n // TODO: ADD INACTIVE STATE\n Terminated: {\n entry: [\"signalTermination\", \"closeConnection\"],\n type: \"final\",\n },\n },\n });\n}\n"],
|
5
|
+
"mappings": "AACA,OAAsB,QAAAA,EAAM,SAAAC,EAAO,WAAAC,EAAS,SAAAC,MAAa,YACzD,OAAqB,UAAAC,EAAQ,eAAAC,EAAa,QAAAC,EAAM,SAAAC,MAAa,SAE7D,OAAS,2BAAAC,MAA+B,0CACxC,OAAS,gBAAAC,MAAoB,kCAE7B,OAAwB,8BAAAC,MAAkC,aAI1D,OACE,2BAAAC,EACA,uCAAAC,EACA,uCAAAC,MACK,WAuDA,MAAMC,CAA2C,C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AM,GAAG,CACd,KAAM+B,EAAM,KACZ,sBAAuBA,EAAM,sBAC7B,aAAcA,EAAM,aACpB,iBAAkBA,EAAM,gBAC1B,CAAC,CAEL,CAAC,CACH,EACA,qBAAsB,CACpB,OAAQ,YACV,EACA,sBAAuB,CACrB,OAAQ,YACV,CACF,CACF,EACA,yCAA0C,CACxC,GAAI,CACF,gBAAiB,CACf,OAAQ,cACR,QAAS,aACX,EACA,qBAAsB,CACpB,OAAQ,aACR,QAAS,CACP,CACE,KAAM,mBACN,OAAQ,CACN,SAAUhC,EAAK,IAAIY,CAAqC,CAC1D,CACF,EACA,CACE,KAAM,qBACR,CACF,CACF,EACA,sBAAuB,CACrB,OAAQ,aACR,QAAS,CACP,CACE,KAAM,mBACN,OAAQ,CACN,SAAUZ,EAAK,IAAIa,CAAqC,CAC1D,CACF,EACA,qBACF,CACF,EACA,eAAgB,CACd,QAAS,CAAC,CAAE,MAAAmB,CAAM,IAAM,CACtBA,EAAM,iBAAiBhC,EAAK,IAAIW,CAAyB,CAAC,CAC5D,CACF,CACF,CACF,EAEA,WAAY,CACV,MAAO,CAAC,oBAAqB,iBAAiB,EAC9C,KAAM,OACR,CACF,CACF,CAAC,CACH",
|
6
|
+
"names": ["Left", "Maybe", "Nothing", "Right", "assign", "createActor", "emit", "setup", "GetAppAndVersionCommand", "CommandUtils", "UnknownDeviceExchangeError", "AlreadySendingApduError", "DeviceDisconnectedBeforeSendingApdu", "DeviceDisconnectedWhileSendingError", "DeviceConnectionStateMachine", "params", "makeStateMachine", "apdu", "triggersDisconnection", "abortTimeout", "response", "error", "apduResponse", "dependencies", "responseCallback", "sendApduFn", "startReconnectionTimeout", "cancelReconnectionTimeout", "tryToReconnect", "onTerminated", "closeConnection", "context", "event"]
|
7
7
|
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{Left as m,Right as d}from"purify-ts/Either";import{afterEach as v,beforeEach as x,describe as f,expect as e,it as u,vi as l}from"vitest";import{ApduResponse as c}from"../../device-session/ApduResponse";import{DeviceConnectionStateMachine as w}from"./DeviceConnectionStateMachine";import{AlreadySendingApduError as U,DeviceDisconnectedWhileSendingError as y}from"./Errors";f("DeviceConnectionStateMachine",()=>{let t;const s={sendApdu:l.fn(),getDependencies:l.fn(),setDependencies:l.fn(),closeConnection:l.fn(),setupConnection:l.fn()};x(()=>{l.useFakeTimers(),t=new w({deviceId:"deviceId",deviceApduSender:s,timeoutDuration:1e3,tryToReconnect:l.fn(),onTerminated:l.fn()})}),v(()=>{l.useRealTimers(),l.restoreAllMocks()}),f("Send APDUs",()=>{u("should send APDU successfully",async()=>{const a=Uint8Array.from([1,2,3,4]),o=new c({statusCode:Uint8Array.from([144,0]),data:new Uint8Array});s.sendApdu.mockResolvedValue(d(o));const n=await t.sendApdu(a);e(s.sendApdu).toHaveBeenCalledTimes(1),e(n).toStrictEqual(d(o))}),u("should send several APDUs successfully",async()=>{const a=Uint8Array.from([1,2,3,4]),o=Uint8Array.from([9,2,3,4]),n=new c({statusCode:Uint8Array.from([144,0]),data:new Uint8Array});s.sendApdu.mockResolvedValue(d(n));const r=await t.sendApdu(a),i=await t.sendApdu(o);e(s.sendApdu).toHaveBeenCalledTimes(2),e(r).toStrictEqual(d(n)),e(i).toStrictEqual(d(n))}),u("should not send several APDUs in parallel",async()=>{const a=Uint8Array.from([1,2,3,4]),o=Uint8Array.from([9,2,3,4]),n=new c({statusCode:Uint8Array.from([144,0]),data:new Uint8Array});s.sendApdu.mockResolvedValue(d(n));const r=t.sendApdu(a),i=await t.sendApdu(o),p=await r;e(s.sendApdu).toHaveBeenCalledTimes(1),e(p).toStrictEqual(d(n)),e(i).toStrictEqual(m(new U))}),u("Disconnected while sending APDU",async()=>{const a=Uint8Array.from([1,2,3,4]),o=new c({statusCode:Uint8Array.from([144,0]),data:new Uint8Array});s.sendApdu.mockResolvedValue(d(o));const n=t.sendApdu(a);t.eventDeviceDisconnected();const r=await n;e(s.sendApdu).toHaveBeenCalledTimes(1),e(r).toStrictEqual(m(new y))}),u("Request disconnection while sending APDU",async()=>{const a=Uint8Array.from([1,2,3,4]),o=new c({statusCode:Uint8Array.from([144,0]),data:new Uint8Array});s.sendApdu.mockResolvedValue(d(o));const n=t.sendApdu(a);t.closeConnection();const r=await n;e(s.sendApdu).toHaveBeenCalledTimes(1),e(r).toStrictEqual(m(new y))})}),f("Send APDUs triggering disconnection",()=>{u("should send one APDU successfully",async()=>{const a=Uint8Array.from([1,2,3,4]),o=new c({statusCode:Uint8Array.from([144,0]),data:new Uint8Array});s.sendApdu.mockResolvedValue(d(o));const n=await t.sendApdu(a,!0);e(s.sendApdu).toHaveBeenCalledTimes(2),e(s.sendApdu.mock.calls).toEqual([[a,!1,void 0],[Uint8Array.from([176,1,0,0,0]),!1,void 0]]),e(n).toStrictEqual(d(o))}),u("should send several APDUs successfully",async()=>{const a=Uint8Array.from([1,2,3,4]),o=Uint8Array.from([9,2,3,4]),n=new c({statusCode:Uint8Array.from([144,0]),data:new Uint8Array});s.sendApdu.mockResolvedValue(d(n));const r=t.sendApdu(a,!0);await Promise.resolve(),t.eventDeviceDisconnected(),t.eventDeviceConnected();const i=t.sendApdu(o),p=await r,A=await i;e(s.sendApdu).toHaveBeenCalledTimes(3),e(s.sendApdu.mock.calls).toEqual([[a,!1,void 0],[Uint8Array.from([176,1,0,0,0]),!1,void 0],[o,!1,void 0]]),e(p).toStrictEqual(d(n)),e(A).toStrictEqual(d(n))}),u("should send a second APDU after reconnection",async()=>{const a=Uint8Array.from([1,2,3,4]),o=Uint8Array.from([9,2,3,4]),n=new c({statusCode:Uint8Array.from([144,0]),data:new Uint8Array});s.sendApdu.mockResolvedValue(d(n));const r=await t.sendApdu(a,!0);t.eventDeviceDisconnected(),t.eventDeviceConnected();const i=await t.sendApdu(o);e(s.sendApdu).toHaveBeenCalledTimes(3),e(s.sendApdu.mock.calls).toEqual([[a,!1,void 0],[Uint8Array.from([176,1,0,0,0]),!1,void 0],[o,!1,void 0]]),e(r).toStrictEqual(d(n)),e(i).toStrictEqual(d(n))}),u("should not send several APDUs in parallel",async()=>{const a=Uint8Array.from([1,2,3,4]),o=Uint8Array.from([9,2,3,4]),n=new c({statusCode:Uint8Array.from([144,0]),data:new Uint8Array});s.sendApdu.mockResolvedValue(d(n));const r=t.sendApdu(a,!0),i=await t.sendApdu(o),p=await r;e(s.sendApdu).toHaveBeenCalledTimes(2),e(s.sendApdu.mock.calls).toEqual([[a,!1,void 0],[Uint8Array.from([176,1,0,0,0]),!1,void 0]]),e(p).toStrictEqual(d(n)),e(i).toStrictEqual(m(new U))}),u("should send another APDU in promise handler",async()=>{const a=Uint8Array.from([1,2,3,4]),o=Uint8Array.from([9,2,3,4]),n=new c({statusCode:Uint8Array.from([144,0]),data:new Uint8Array});s.sendApdu.mockResolvedValue(d(n));let r;const i=await t.sendApdu(a,!0).then(A=>(r=t.sendApdu(o),A));t.eventDeviceDisconnected(),t.eventDeviceConnected();const p=await r;e(s.sendApdu).toHaveBeenCalledTimes(3),e(s.sendApdu.mock.calls).toEqual([[a,!1,void 0],[Uint8Array.from([176,1,0,0,0]),!1,void 0],[o,!1,void 0]]),e(i).toStrictEqual(d(n)),e(p).toStrictEqual(d(n))}),u("send an APDU while device is reconnecting",async()=>{const a=Uint8Array.from([1,2,3,4]),o=new c({statusCode:Uint8Array.from([144,0]),data:new Uint8Array});s.sendApdu.mockResolvedValue(d(o)),t.eventDeviceDisconnected();const n=t.sendApdu(a,!0);t.eventDeviceConnected();const r=await n;e(s.sendApdu).toHaveBeenCalledTimes(2),e(s.sendApdu.mock.calls).toEqual([[a,!1,void 0],[Uint8Array.from([176,1,0,0,0]),!1,void 0]]),e(r).toStrictEqual(d(o))}),u("Close while an APDU is waiting for reconnection",async()=>{const a=Uint8Array.from([1,2,3,4]),o=Uint8Array.from([9,2,3,4]),n=new c({statusCode:Uint8Array.from([144,0]),data:new Uint8Array});s.sendApdu.mockResolvedValue(d(n));let r;const i=t.sendApdu(a,!0);await Promise.resolve(),t.eventDeviceDisconnected();const p=await i;r=t.sendApdu(o),t.closeConnection();const A=await r;e(s.sendApdu.mock.calls).toEqual([[a,!1,void 0],[Uint8Array.from([176,1,0,0,0]),!1,void 0]]),e(p).toStrictEqual(d(n)),e(A).toStrictEqual(m(new y))})})});
|
2
|
+
//# sourceMappingURL=DeviceConnectionStateMachine.test.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../src/api/transport/model/DeviceConnectionStateMachine.test.ts"],
|
4
|
+
"sourcesContent": ["import { Left, Right } from \"purify-ts/Either\";\nimport { afterEach, beforeEach, describe, expect, it, vi } from \"vitest\";\n\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\n\nimport { type SendApduResult } from \"./DeviceConnection\";\nimport { DeviceConnectionStateMachine } from \"./DeviceConnectionStateMachine\";\nimport {\n AlreadySendingApduError,\n DeviceDisconnectedWhileSendingError,\n} from \"./Errors\";\n\ndescribe(\"DeviceConnectionStateMachine\", () => {\n let machine: DeviceConnectionStateMachine<void>;\n const mockApduSender = {\n sendApdu: vi.fn(),\n getDependencies: vi.fn(),\n setDependencies: vi.fn(),\n closeConnection: vi.fn(),\n setupConnection: vi.fn(),\n };\n\n beforeEach(() => {\n vi.useFakeTimers();\n machine = new DeviceConnectionStateMachine<void>({\n deviceId: \"deviceId\",\n deviceApduSender: mockApduSender,\n timeoutDuration: 1000,\n tryToReconnect: vi.fn(),\n onTerminated: vi.fn(),\n });\n });\n\n afterEach(() => {\n vi.useRealTimers();\n vi.restoreAllMocks();\n });\n\n describe(\"Send APDUs\", () => {\n it(\"should send APDU successfully\", async () => {\n // GIVEN\n const apdu = Uint8Array.from([1, 2, 3, 4]);\n const apduResponse = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n });\n mockApduSender.sendApdu.mockResolvedValue(Right(apduResponse));\n\n // WHEN\n const result = await machine.sendApdu(apdu);\n\n // THEN\n expect(mockApduSender.sendApdu).toHaveBeenCalledTimes(1);\n expect(result).toStrictEqual(Right(apduResponse));\n });\n\n it(\"should send several APDUs successfully\", async () => {\n // GIVEN\n const apdu = Uint8Array.from([1, 2, 3, 4]);\n const apdu2 = Uint8Array.from([9, 2, 3, 4]);\n const apduResponse = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n });\n mockApduSender.sendApdu.mockResolvedValue(Right(apduResponse));\n\n // WHEN\n const result = await machine.sendApdu(apdu);\n const result2 = await machine.sendApdu(apdu2);\n\n // THEN\n expect(mockApduSender.sendApdu).toHaveBeenCalledTimes(2);\n expect(result).toStrictEqual(Right(apduResponse));\n expect(result2).toStrictEqual(Right(apduResponse));\n });\n\n it(\"should not send several APDUs in parallel\", async () => {\n // GIVEN\n const apdu = Uint8Array.from([1, 2, 3, 4]);\n const apdu2 = Uint8Array.from([9, 2, 3, 4]);\n const apduResponse = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n });\n mockApduSender.sendApdu.mockResolvedValue(Right(apduResponse));\n\n // WHEN\n const promise = machine.sendApdu(apdu);\n const result2 = await machine.sendApdu(apdu2);\n const result = await promise;\n\n // THEN\n expect(mockApduSender.sendApdu).toHaveBeenCalledTimes(1);\n expect(result).toStrictEqual(Right(apduResponse));\n expect(result2).toStrictEqual(Left(new AlreadySendingApduError()));\n });\n\n it(\"Disconnected while sending APDU\", async () => {\n // GIVEN\n const apdu = Uint8Array.from([1, 2, 3, 4]);\n const apduResponse = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n });\n mockApduSender.sendApdu.mockResolvedValue(Right(apduResponse));\n\n // WHEN\n const promise = machine.sendApdu(apdu);\n machine.eventDeviceDisconnected();\n const result = await promise;\n\n // THEN\n expect(mockApduSender.sendApdu).toHaveBeenCalledTimes(1);\n expect(result).toStrictEqual(\n Left(new DeviceDisconnectedWhileSendingError()),\n );\n });\n\n it(\"Request disconnection while sending APDU\", async () => {\n // GIVEN\n const apdu = Uint8Array.from([1, 2, 3, 4]);\n const apduResponse = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n });\n mockApduSender.sendApdu.mockResolvedValue(Right(apduResponse));\n\n // WHEN\n const promise = machine.sendApdu(apdu);\n machine.closeConnection();\n const result = await promise;\n\n // THEN\n expect(mockApduSender.sendApdu).toHaveBeenCalledTimes(1);\n expect(result).toStrictEqual(\n Left(new DeviceDisconnectedWhileSendingError()),\n );\n });\n });\n\n describe(\"Send APDUs triggering disconnection\", () => {\n it(\"should send one APDU successfully\", async () => {\n // GIVEN\n const apdu = Uint8Array.from([1, 2, 3, 4]);\n const apduResponse = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n });\n mockApduSender.sendApdu.mockResolvedValue(Right(apduResponse));\n\n // WHEN\n const result = await machine.sendApdu(apdu, true);\n\n // THEN\n expect(mockApduSender.sendApdu).toHaveBeenCalledTimes(2);\n expect(mockApduSender.sendApdu.mock.calls).toEqual([\n [apdu, false, undefined],\n [Uint8Array.from([0xb0, 0x01, 0x00, 0x00, 0x00]), false, undefined], // GetAppAndVersion APDU sent after a successful result from an APDU that triggers disconnection\n ]);\n expect(result).toStrictEqual(Right(apduResponse));\n });\n\n it(\"should send several APDUs successfully\", async () => {\n // GIVEN\n const apdu = Uint8Array.from([1, 2, 3, 4]);\n const apdu2 = Uint8Array.from([9, 2, 3, 4]);\n const apduResponse = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n });\n mockApduSender.sendApdu.mockResolvedValue(Right(apduResponse));\n\n // WHEN\n const promise1 = machine.sendApdu(apdu, true);\n await Promise.resolve(); // Allow the first APDU to be sent and processed before the disconnection event\n machine.eventDeviceDisconnected();\n machine.eventDeviceConnected();\n const promise2 = machine.sendApdu(apdu2);\n const result1 = await promise1;\n const result2 = await promise2;\n\n // THEN\n expect(mockApduSender.sendApdu).toHaveBeenCalledTimes(3);\n expect(mockApduSender.sendApdu.mock.calls).toEqual([\n [apdu, false, undefined],\n [Uint8Array.from([0xb0, 0x01, 0x00, 0x00, 0x00]), false, undefined], // GetAppAndVersion APDU sent after a successful result from an APDU that triggers disconnection\n [apdu2, false, undefined],\n ]);\n\n expect(result1).toStrictEqual(Right(apduResponse));\n expect(result2).toStrictEqual(Right(apduResponse));\n });\n\n it(\"should send a second APDU after reconnection\", async () => {\n // GIVEN\n const apdu = Uint8Array.from([1, 2, 3, 4]);\n const apdu2 = Uint8Array.from([9, 2, 3, 4]);\n const apduResponse = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n });\n mockApduSender.sendApdu.mockResolvedValue(Right(apduResponse));\n\n // WHEN\n const result = await machine.sendApdu(apdu, true);\n machine.eventDeviceDisconnected();\n machine.eventDeviceConnected();\n const result2 = await machine.sendApdu(apdu2);\n\n // THEN\n expect(mockApduSender.sendApdu).toHaveBeenCalledTimes(3);\n expect(mockApduSender.sendApdu.mock.calls).toEqual([\n [apdu, false, undefined],\n [Uint8Array.from([0xb0, 0x01, 0x00, 0x00, 0x00]), false, undefined], // GetAppAndVersion APDU sent after a successful result from an APDU that triggers disconnection\n [apdu2, false, undefined],\n ]);\n expect(result).toStrictEqual(Right(apduResponse));\n expect(result2).toStrictEqual(Right(apduResponse));\n });\n\n it(\"should not send several APDUs in parallel\", async () => {\n // GIVEN\n const apdu = Uint8Array.from([1, 2, 3, 4]);\n const apdu2 = Uint8Array.from([9, 2, 3, 4]);\n const apduResponse = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n });\n mockApduSender.sendApdu.mockResolvedValue(Right(apduResponse));\n\n // WHEN\n const promise = machine.sendApdu(apdu, true);\n const result2 = await machine.sendApdu(apdu2);\n const result = await promise;\n\n // THEN\n expect(mockApduSender.sendApdu).toHaveBeenCalledTimes(2);\n expect(mockApduSender.sendApdu.mock.calls).toEqual([\n [apdu, false, undefined],\n [Uint8Array.from([0xb0, 0x01, 0x00, 0x00, 0x00]), false, undefined], // GetAppAndVersion APDU sent after a successful result from an APDU that triggers disconnection\n ]);\n expect(result).toStrictEqual(Right(apduResponse));\n expect(result2).toStrictEqual(Left(new AlreadySendingApduError()));\n });\n\n it(\"should send another APDU in promise handler\", async () => {\n // GIVEN\n const apdu = Uint8Array.from([1, 2, 3, 4]);\n const apdu2 = Uint8Array.from([9, 2, 3, 4]);\n const apduResponse = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n });\n mockApduSender.sendApdu.mockResolvedValue(Right(apduResponse));\n\n // WHEN\n let promise: Promise<SendApduResult> | undefined = undefined;\n const result = await machine.sendApdu(apdu, true).then((value) => {\n promise = machine.sendApdu(apdu2);\n return value;\n });\n machine.eventDeviceDisconnected();\n machine.eventDeviceConnected();\n const result2 = await promise!;\n\n // THEN\n expect(mockApduSender.sendApdu).toHaveBeenCalledTimes(3);\n expect(mockApduSender.sendApdu.mock.calls).toEqual([\n [apdu, false, undefined],\n [Uint8Array.from([0xb0, 0x01, 0x00, 0x00, 0x00]), false, undefined], // GetAppAndVersion APDU sent after a successful result from an APDU that triggers disconnection\n [apdu2, false, undefined],\n ]);\n expect(result).toStrictEqual(Right(apduResponse));\n expect(result2).toStrictEqual(Right(apduResponse));\n });\n\n it(\"send an APDU while device is reconnecting\", async () => {\n // GIVEN\n const apdu = Uint8Array.from([1, 2, 3, 4]);\n const apduResponse = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n });\n mockApduSender.sendApdu.mockResolvedValue(Right(apduResponse));\n\n // WHEN\n machine.eventDeviceDisconnected();\n const promise = machine.sendApdu(apdu, true);\n machine.eventDeviceConnected();\n const result = await promise;\n\n // THEN\n expect(mockApduSender.sendApdu).toHaveBeenCalledTimes(2);\n expect(mockApduSender.sendApdu.mock.calls).toEqual([\n [apdu, false, undefined],\n [Uint8Array.from([0xb0, 0x01, 0x00, 0x00, 0x00]), false, undefined], // GetAppAndVersion APDU sent after a successful result from an APDU that triggers disconnection\n ]);\n expect(result).toStrictEqual(Right(apduResponse));\n });\n\n it(\"Close while an APDU is waiting for reconnection\", async () => {\n // GIVEN\n const apdu = Uint8Array.from([1, 2, 3, 4]);\n const apdu2 = Uint8Array.from([9, 2, 3, 4]);\n const apduResponse = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: new Uint8Array(),\n });\n mockApduSender.sendApdu.mockResolvedValue(Right(apduResponse));\n\n // WHEN\n let promise: Promise<SendApduResult> | undefined = undefined;\n const promise1 = machine.sendApdu(apdu, true);\n await Promise.resolve(); // Allow the first APDU promise to resolve before triggering disconnection\n machine.eventDeviceDisconnected();\n const result1 = await promise1;\n promise = machine.sendApdu(apdu2);\n machine.closeConnection();\n const result2 = await promise!;\n\n // THEN\n // expect(mockApduSender.sendApdu).toHaveBeenCalledTimes(2);\n expect(mockApduSender.sendApdu.mock.calls).toEqual([\n [apdu, false, undefined],\n [Uint8Array.from([0xb0, 0x01, 0x00, 0x00, 0x00]), false, undefined], // GetAppAndVersion APDU sent after a successful result from an APDU that triggers disconnection\n ]);\n expect(result1).toStrictEqual(Right(apduResponse));\n expect(result2).toStrictEqual(\n Left(new DeviceDisconnectedWhileSendingError()),\n );\n });\n });\n});\n"],
|
5
|
+
"mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,mBAC5B,OAAS,aAAAC,EAAW,cAAAC,EAAY,YAAAC,EAAU,UAAAC,EAAQ,MAAAC,EAAI,MAAAC,MAAU,SAEhE,OAAS,gBAAAC,MAAoB,mCAG7B,OAAS,gCAAAC,MAAoC,iCAC7C,OACE,2BAAAC,EACA,uCAAAC,MACK,WAEPP,EAAS,+BAAgC,IAAM,CAC7C,IAAIQ,EACJ,MAAMC,EAAiB,CACrB,SAAUN,EAAG,GAAG,EAChB,gBAAiBA,EAAG,GAAG,EACvB,gBAAiBA,EAAG,GA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S,EACvB,CAAC,WAAW,KAAK,CAAC,IAAM,EAAM,EAAM,EAAM,CAAI,CAAC,EAAG,GAAO,MAAS,CACpE,CAAC,EACDT,EAAOW,CAAM,EAAE,cAAcf,EAAMc,CAAY,CAAC,CAClD,CAAC,EAEDT,EAAG,kDAAmD,SAAY,CAEhE,MAAMQ,EAAO,WAAW,KAAK,CAAC,EAAG,EAAG,EAAG,CAAC,CAAC,EACnCG,EAAQ,WAAW,KAAK,CAAC,EAAG,EAAG,EAAG,CAAC,CAAC,EACpCF,EAAe,IAAIP,EAAa,CACpC,WAAY,WAAW,KAAK,CAAC,IAAM,CAAI,CAAC,EACxC,KAAM,IAAI,UACZ,CAAC,EACDK,EAAe,SAAS,kBAAkBZ,EAAMc,CAAY,CAAC,EAG7D,IAAII,EACJ,MAAMC,EAAWR,EAAQ,SAASE,EAAM,EAAI,EAC5C,MAAM,QAAQ,QAAQ,EACtBF,EAAQ,wBAAwB,EAChC,MAAMU,EAAU,MAAMF,EACtBD,EAAUP,EAAQ,SAASK,CAAK,EAChCL,EAAQ,gBAAgB,EACxB,MAAMM,EAAU,MAAMC,EAItBd,EAAOQ,EAAe,SAAS,KAAK,KAAK,EAAE,QAAQ,CACjD,CAACC,EAAM,GAAO,MAAS,EACvB,CAAC,WAAW,KAAK,CAAC,IAAM,EAAM,EAAM,EAAM,CAAI,CAAC,EAAG,GAAO,MAAS,CACpE,CAAC,EACDT,EAAOiB,CAAO,EAAE,cAAcrB,EAAMc,CAAY,CAAC,EACjDV,EAAOa,CAAO,EAAE,cACdlB,EAAK,IAAIW,CAAqC,CAChD,CACF,CAAC,CACH,CAAC,CACH,CAAC",
|
6
|
+
"names": ["Left", "Right", "afterEach", "beforeEach", "describe", "expect", "it", "vi", "ApduResponse", "DeviceConnectionStateMachine", "AlreadySendingApduError", "DeviceDisconnectedWhileSendingError", "machine", "mockApduSender", "apdu", "apduResponse", "result", "apdu2", "result2", "promise", "promise1", "promise2", "result1", "value"]
|
7
|
+
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
class n{_tag="GeneralDmkError";originalError;constructor(e){e instanceof Error?this.originalError=e:e!==void 0&&(this.originalError=new Error(String(e)))}}class t extends n{constructor(r){super(r);this.err=r}_tag="DeviceAlreadyDiscoveredError"}class s extends n{constructor(r){super(r);this.err=r}_tag="DeviceNotRecognizedError"}class d extends n{constructor(r){super(r);this.err=r}_tag="NoAccessibleDeviceError"}class c extends n{_tag="ConnectionOpeningError";constructor(e){super(e)}}class a extends n{constructor(r){super(r);this.err=r}_tag="UnknownDeviceError"}class i extends n{constructor(r){super(r);this.err=r}_tag="TransportNotSupportedError"}class l extends n{constructor(r){super(r);this.err=r}_tag="SendApduConcurrencyError"}class u extends n{constructor(r){super(r);this.err=r}_tag="SendApduTimeoutError"}class p extends n{constructor(r){super(r);this.err=r}_tag="
|
1
|
+
class n{_tag="GeneralDmkError";originalError;constructor(e){e instanceof Error?this.originalError=e:e!==void 0&&(this.originalError=new Error(String(e)))}}class t extends n{constructor(r){super(r);this.err=r}_tag="DeviceAlreadyDiscoveredError"}class s extends n{constructor(r){super(r);this.err=r}_tag="DeviceNotRecognizedError"}class d extends n{constructor(r){super(r);this.err=r}_tag="NoAccessibleDeviceError"}class c extends n{_tag="ConnectionOpeningError";constructor(e){super(e)}}class a extends n{constructor(r){super(r);this.err=r}_tag="UnknownDeviceError"}class i extends n{constructor(r){super(r);this.err=r}_tag="TransportNotSupportedError"}class l extends n{constructor(r){super(r);this.err=r}_tag="SendApduConcurrencyError"}class u extends n{constructor(r){super(r);this.err=r}_tag="SendApduTimeoutError"}class p extends n{constructor(r){super(r);this.err=r}_tag="DisconnectError"}class E extends n{constructor(r){super(r);this.err=r}_tag="ReconnectionFailedError"}class y extends n{constructor(r){super(r);this.err=r}_tag="DeviceNotInitializedError"}class v extends n{constructor(r){super(r);this.err=r}_tag="NoTransportsProvidedError"}class x extends n{constructor(r){super(r);this.err=r}_tag="TransportAlreadyExistsError"}class g extends n{constructor(r){super(r);this.err=r}_tag="DeviceDisconnectedWhileSendingError"}class D extends n{constructor(r){super(r);this.err=r}_tag="AlreadySendingApduError"}class k extends n{constructor(r){super(r);this.err=r}_tag="DeviceDisconnectedBeforeSendingApdu"}class w extends n{constructor(r){super(r);this.err=r}_tag="NoTransportProvidedError"}export{D as AlreadySendingApduError,t as DeviceAlreadyConnectedError,k as DeviceDisconnectedBeforeSendingApdu,g as DeviceDisconnectedWhileSendingError,y as DeviceNotInitializedError,s as DeviceNotRecognizedError,p as DisconnectError,n as GeneralDmkError,d as NoAccessibleDeviceError,w as NoTransportProvidedError,v as NoTransportsProvidedError,c as OpeningConnectionError,E as ReconnectionFailedError,l as SendApduConcurrencyError,u as SendApduTimeoutError,x as TransportAlreadyExistsError,i as TransportNotSupportedError,a as UnknownDeviceError};
|
2
2
|
//# sourceMappingURL=Errors.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/transport/model/Errors.ts"],
|
4
|
-
"sourcesContent": ["import { type DmkError } from \"@api/Error\";\n\nexport type ConnectError =\n | UnknownDeviceError\n | OpeningConnectionError\n | DeviceAlreadyConnectedError;\n\nexport class GeneralDmkError implements DmkError {\n _tag = \"GeneralDmkError\";\n originalError?: unknown;\n constructor(err?: unknown) {\n if (err instanceof Error) {\n this.originalError = err;\n } else if (err !== undefined) {\n this.originalError = new Error(String(err));\n }\n }\n}\n\nexport class DeviceAlreadyConnectedError extends GeneralDmkError {\n override readonly _tag = \"DeviceAlreadyDiscoveredError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DeviceNotRecognizedError extends GeneralDmkError {\n override readonly _tag = \"DeviceNotRecognizedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class NoAccessibleDeviceError extends GeneralDmkError {\n override readonly _tag = \"NoAccessibleDeviceError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class OpeningConnectionError extends GeneralDmkError {\n override _tag = \"ConnectionOpeningError\";\n constructor(err?: unknown) {\n super(err);\n }\n}\n\nexport class UnknownDeviceError extends GeneralDmkError {\n override readonly _tag = \"UnknownDeviceError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class TransportNotSupportedError extends GeneralDmkError {\n override readonly _tag = \"TransportNotSupportedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\nexport class SendApduConcurrencyError extends GeneralDmkError {\n override readonly _tag = \"SendApduConcurrencyError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class SendApduTimeoutError extends GeneralDmkError {\n override readonly _tag = \"SendApduTimeoutError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\
|
5
|
-
"mappings": "AAOO,MAAMA,CAAoC,CAC/C,KAAO,kBACP,cACA,YAAYC,EAAe,CACrBA,aAAe,MACjB,KAAK,cAAgBA,EACZA,IAAQ,SACjB,KAAK,cAAgB,IAAI,MAAM,OAAOA,CAAG,CAAC,EAE9C,CACF,CAEO,MAAMC,UAAoCF,CAAgB,CAE/D,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,8BAI3B,CAEO,MAAME,UAAiCH,CAAgB,CAE5D,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,0BAI3B,CAEO,MAAMG,UAAgCJ,CAAgB,CAE3D,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,yBAI3B,CAEO,MAAMI,UAA+BL,CAAgB,CACjD,KAAO,yBAChB,YAAYC,EAAe,CACzB,MAAMA,CAAG,CACX,CACF,CAEO,MAAMK,UAA2BN,CAAgB,CAEtD,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,oBAI3B,CAEO,MAAMM,UAAmCP,CAAgB,CAE9D,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,4BAI3B,CACO,MAAMO,UAAiCR,CAAgB,CAE5D,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,0BAI3B,CAEO,MAAMQ,UAA6BT,CAAgB,CAExD,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,sBAI3B,
|
6
|
-
"names": ["GeneralDmkError", "err", "DeviceAlreadyConnectedError", "DeviceNotRecognizedError", "NoAccessibleDeviceError", "OpeningConnectionError", "UnknownDeviceError", "TransportNotSupportedError", "SendApduConcurrencyError", "SendApduTimeoutError", "
|
4
|
+
"sourcesContent": ["import { type DmkError } from \"@api/Error\";\n\nexport type ConnectError =\n | UnknownDeviceError\n | OpeningConnectionError\n | DeviceAlreadyConnectedError;\n\nexport class GeneralDmkError implements DmkError {\n _tag = \"GeneralDmkError\";\n originalError?: unknown;\n constructor(err?: unknown) {\n if (err instanceof Error) {\n this.originalError = err;\n } else if (err !== undefined) {\n this.originalError = new Error(String(err));\n }\n }\n}\n\nexport class DeviceAlreadyConnectedError extends GeneralDmkError {\n override readonly _tag = \"DeviceAlreadyDiscoveredError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DeviceNotRecognizedError extends GeneralDmkError {\n override readonly _tag = \"DeviceNotRecognizedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class NoAccessibleDeviceError extends GeneralDmkError {\n override readonly _tag = \"NoAccessibleDeviceError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class OpeningConnectionError extends GeneralDmkError {\n override _tag = \"ConnectionOpeningError\";\n constructor(err?: unknown) {\n super(err);\n }\n}\n\nexport class UnknownDeviceError extends GeneralDmkError {\n override readonly _tag = \"UnknownDeviceError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class TransportNotSupportedError extends GeneralDmkError {\n override readonly _tag = \"TransportNotSupportedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\nexport class SendApduConcurrencyError extends GeneralDmkError {\n override readonly _tag = \"SendApduConcurrencyError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class SendApduTimeoutError extends GeneralDmkError {\n override readonly _tag = \"SendApduTimeoutError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\nexport class DisconnectError extends GeneralDmkError {\n override readonly _tag = \"DisconnectError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class ReconnectionFailedError extends GeneralDmkError {\n override readonly _tag = \"ReconnectionFailedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DeviceNotInitializedError extends GeneralDmkError {\n override readonly _tag = \"DeviceNotInitializedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class NoTransportsProvidedError extends GeneralDmkError {\n override readonly _tag = \"NoTransportsProvidedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class TransportAlreadyExistsError extends GeneralDmkError {\n override readonly _tag = \"TransportAlreadyExistsError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DeviceDisconnectedWhileSendingError extends GeneralDmkError {\n override readonly _tag = \"DeviceDisconnectedWhileSendingError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class AlreadySendingApduError extends GeneralDmkError {\n override readonly _tag = \"AlreadySendingApduError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class DeviceDisconnectedBeforeSendingApdu extends GeneralDmkError {\n override readonly _tag = \"DeviceDisconnectedBeforeSendingApdu\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class NoTransportProvidedError extends GeneralDmkError {\n override readonly _tag = \"NoTransportProvidedError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n"],
|
5
|
+
"mappings": "AAOO,MAAMA,CAAoC,CAC/C,KAAO,kBACP,cACA,YAAYC,EAAe,CACr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AClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,2BAI3B,CAEO,MAAMY,UAAkCb,CAAgB,CAE7D,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,2BAI3B,CAEO,MAAMa,UAAoCd,CAAgB,CAE/D,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,6BAI3B,CAEO,MAAMc,UAA4Cf,CAAgB,CAEvE,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,qCAI3B,CAEO,MAAMe,UAAgChB,CAAgB,CAE3D,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,yBAI3B,CAEO,MAAMgB,UAA4CjB,CAAgB,CAEvE,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,qCAI3B,CAEO,MAAMiB,UAAiClB,CAAgB,CAE5D,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,0BAI3B",
|
6
|
+
"names": ["GeneralDmkError", "err", "DeviceAlreadyConnectedError", "DeviceNotRecognizedError", "NoAccessibleDeviceError", "OpeningConnectionError", "UnknownDeviceError", "TransportNotSupportedError", "SendApduConcurrencyError", "SendApduTimeoutError", "DisconnectError", "ReconnectionFailedError", "DeviceNotInitializedError", "NoTransportsProvidedError", "TransportAlreadyExistsError", "DeviceDisconnectedWhileSendingError", "AlreadySendingApduError", "DeviceDisconnectedBeforeSendingApdu", "NoTransportProvidedError"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
|
1
|
+
import{AppAlreadyInstalledDAError as s,DeviceLockedError as o,OutOfMemoryDAError as l,RefusedByUserDAError as n}from"../../../api/device-action/os/Errors";var a=(r=>(r[r.AppAlreadyInstalled=0]="AppAlreadyInstalled",r[r.DeviceLocked=1]="DeviceLocked",r[r.OutOfMemory=2]="OutOfMemory",r[r.RefusedByUser=3]="RefusedByUser",r[r.Unknown=4]="Unknown",r))(a||{});class i{constructor(e){this.error=e;this.originalError=e}_tag="WebSocketConnectionError";originalError}class E{constructor(e,c=4){this.error=e;this.errorType=c;this.originalError=e}_tag="SecureChannelError";originalError;mapDAErrors(){switch(this.errorType){case 1:return new o;case 3:return new n;default:return this}}mapInstallDAErrors(){switch(this.errorType){case 1:return new o;case 3:return new n;case 0:return new s;case 2:return new l;default:return this}}}export{E as SecureChannelError,a as SecureChannelErrorType,i as WebSocketConnectionError};
|
2
2
|
//# sourceMappingURL=Errors.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/internal/secure-channel/model/Errors.ts"],
|
4
|
-
"sourcesContent": ["import { type DmkError } from \"@api/Error\";\n\nexport class WebSocketConnectionError implements DmkError {\n _tag = \"WebSocketConnectionError\";\n originalError?: unknown;\n\n constructor(public readonly error: unknown) {\n this.originalError = error;\n }\n}\n\nexport class SecureChannelError implements DmkError {\n _tag = \"SecureChannelError\";\n originalError?: unknown;\n\n constructor(public readonly error: unknown) {\n this.originalError = error;\n }\n}\n"],
|
5
|
-
"mappings": "
|
6
|
-
"names": ["WebSocketConnectionError", "error", "SecureChannelError"]
|
4
|
+
"sourcesContent": ["import {\n AppAlreadyInstalledDAError,\n DeviceLockedError,\n OutOfMemoryDAError,\n RefusedByUserDAError,\n} from \"@api/device-action/os/Errors\";\nimport type { DmkError } from \"@api/Error\";\n\nexport enum SecureChannelErrorType {\n AppAlreadyInstalled,\n DeviceLocked,\n OutOfMemory,\n RefusedByUser,\n Unknown,\n}\n\n/**\n * Errors that can possibly occur during a secure channel operation\n */\nexport type SecureChannelDAErrors =\n | SecureChannelError\n | DeviceLockedError\n | RefusedByUserDAError;\n\n/**\n * Errors that can possibly occur during a secure channel install operation\n * such as installApp or installFirmware\n */\nexport type SecureChannelInstallDAErrors =\n | SecureChannelError\n | AppAlreadyInstalledDAError\n | OutOfMemoryDAError\n | DeviceLockedError\n | RefusedByUserDAError;\n\nexport class WebSocketConnectionError implements DmkError {\n _tag = \"WebSocketConnectionError\";\n originalError?: unknown;\n\n constructor(public readonly error: unknown) {\n this.originalError = error;\n }\n}\n\nexport class SecureChannelError implements DmkError {\n _tag = \"SecureChannelError\";\n originalError?: unknown;\n\n constructor(\n public readonly error: unknown,\n public readonly errorType: SecureChannelErrorType = SecureChannelErrorType.Unknown,\n ) {\n this.originalError = error;\n }\n\n mapDAErrors(): SecureChannelDAErrors {\n switch (this.errorType) {\n case SecureChannelErrorType.DeviceLocked:\n return new DeviceLockedError();\n case SecureChannelErrorType.RefusedByUser:\n return new RefusedByUserDAError();\n default:\n return this;\n }\n }\n\n mapInstallDAErrors(): SecureChannelInstallDAErrors {\n switch (this.errorType) {\n case SecureChannelErrorType.DeviceLocked:\n return new DeviceLockedError();\n case SecureChannelErrorType.RefusedByUser:\n return new RefusedByUserDAError();\n case SecureChannelErrorType.AppAlreadyInstalled:\n return new AppAlreadyInstalledDAError();\n case SecureChannelErrorType.OutOfMemory:\n return new OutOfMemoryDAError();\n default:\n return this;\n }\n }\n}\n"],
|
5
|
+
"mappings": "AAAA,OACE,8BAAAA,EACA,qBAAAC,EACA,sBAAAC,EACA,wBAAAC,MACK,+BAGA,IAAKC,OACVA,IAAA,6CACAA,IAAA,+BACAA,IAAA,6BACAA,IAAA,iCACAA,IAAA,qBALUA,OAAA,IA2BL,MAAMC,CAA6C,CAIxD,YAA4BC,EAAgB,CAAhB,WAAAA,EAC1B,KAAK,cAAgBA,CACvB,CALA,KAAO,2BACP,aAKF,CAEO,MAAMC,CAAuC,CAIlD,YACkBD,EACAE,EAAoC,EACpD,CAFgB,WAAAF,EACA,eAAAE,EAEhB,KAAK,cAAgBF,CACvB,CARA,KAAO,qBACP,cASA,aAAqC,CACnC,OAAQ,KAAK,UAAW,CACtB,IAAK,GACH,OAAO,IAAIL,EACb,IAAK,GACH,OAAO,IAAIE,EACb,QACE,OAAO,IACX,CACF,CAEA,oBAAmD,CACjD,OAAQ,KAAK,UAAW,CACtB,IAAK,GACH,OAAO,IAAIF,EACb,IAAK,GACH,OAAO,IAAIE,EACb,IAAK,GACH,OAAO,IAAIH,EACb,IAAK,GACH,OAAO,IAAIE,EACb,QACE,OAAO,IACX,CACF,CACF",
|
6
|
+
"names": ["AppAlreadyInstalledDAError", "DeviceLockedError", "OutOfMemoryDAError", "RefusedByUserDAError", "SecureChannelErrorType", "WebSocketConnectionError", "error", "SecureChannelError", "errorType"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var S=(t,e,r,
|
1
|
+
var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var S=(t,e,r,s)=>{for(var i=s>1?void 0:s?d(e,r):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(i=(s?o(e,r,i):o(i))||i);return s&&i&&a(e,r,i),i},v=(t,e)=>(r,s)=>e(r,s,t);import{inject as p,injectable as m}from"inversify";import{deviceSessionTypes as l}from"../../device-session/di/deviceSessionTypes";import{loggerTypes as h}from"../../logger-publisher/di/loggerTypes";let g=class{_sessionService;_logger;constructor(e,r){this._sessionService=e,this._logger=r("SendApduUseCase")}async execute({sessionId:e,apdu:r,abortTimeout:s,triggersDisconnection:i}){return this._sessionService.getDeviceSessionById(e).caseOf({Right:async o=>(await o.sendApdu(r,{abortTimeout:s,triggersDisconnection:i})).caseOf({Right:c=>c,Left:c=>{throw this._logger.error("Error sending APDU",{data:{sessionId:e,apdu:r,error:c}}),c}}),Left:o=>{throw this._logger.error("Error getting deviceSession",{data:{error:o}}),o}})}};g=S([m(),v(0,p(l.DeviceSessionService)),v(1,p(h.LoggerPublisherServiceFactory))],g);export{g as SendApduUseCase};
|
2
2
|
//# sourceMappingURL=SendApduUseCase.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/internal/send/use-case/SendApduUseCase.ts"],
|
4
|
-
"sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { DeviceSessionId } from \"@api/types\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport type { DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { loggerTypes } from \"@internal/logger-publisher/di/loggerTypes\";\n\n/**\n * The arguments for the SendApduUseCase.\n */\nexport type SendApduUseCaseArgs = {\n /**\n * Device session identifier from `DeviceManagementKit.connect`.\n */\n sessionId: DeviceSessionId;\n /**\n * Raw APDU to send to the device.\n */\n apdu: Uint8Array;\n /**\n * The time, in milliseconds, to wait before aborting an operation.\n */\n abortTimeout?: number;\n};\n\n/**\n * Sends an APDU to a connected device.\n */\n@injectable()\nexport class SendApduUseCase {\n private readonly _sessionService: DeviceSessionService;\n private readonly _logger: LoggerPublisherService;\n\n constructor(\n @inject(deviceSessionTypes.DeviceSessionService)\n sessionService: DeviceSessionService,\n @inject(loggerTypes.LoggerPublisherServiceFactory)\n loggerFactory: (tag: string) => LoggerPublisherService,\n ) {\n this._sessionService = sessionService;\n this._logger = loggerFactory(\"SendApduUseCase\");\n }\n\n async execute({\n sessionId,\n apdu,\n abortTimeout,\n }: SendApduUseCaseArgs): Promise<ApduResponse> {\n const deviceSessionOrError =\n this._sessionService.getDeviceSessionById(sessionId);\n\n return deviceSessionOrError.caseOf({\n // Case device session found\n Right: async (deviceSession) => {\n const response = await deviceSession.sendApdu(apdu, {
|
5
|
-
"mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAKnC,OAAS,sBAAAC,MAA0B,iDAEnC,OAAS,eAAAC,MAAmB,
|
6
|
-
"names": ["inject", "injectable", "deviceSessionTypes", "loggerTypes", "SendApduUseCase", "sessionService", "loggerFactory", "sessionId", "apdu", "abortTimeout", "deviceSession", "data", "error", "__decorateClass", "injectable", "__decorateParam", "inject", "deviceSessionTypes", "loggerTypes"]
|
4
|
+
"sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type LoggerPublisherService } from \"@api/logger-publisher/service/LoggerPublisherService\";\nimport { DeviceSessionId } from \"@api/types\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport type { DeviceSessionService } from \"@internal/device-session/service/DeviceSessionService\";\nimport { loggerTypes } from \"@internal/logger-publisher/di/loggerTypes\";\n\n/**\n * The arguments for the SendApduUseCase.\n */\nexport type SendApduUseCaseArgs = {\n /**\n * Device session identifier from `DeviceManagementKit.connect`.\n */\n sessionId: DeviceSessionId;\n /**\n * Raw APDU to send to the device.\n */\n apdu: Uint8Array;\n /**\n * The time, in milliseconds, to wait before aborting an operation.\n */\n abortTimeout?: number;\n /**\n * Indicates if a device disconnection should be expected after sending the APDU.\n */\n triggersDisconnection?: boolean;\n};\n\n/**\n * Sends an APDU to a connected device.\n */\n@injectable()\nexport class SendApduUseCase {\n private readonly _sessionService: DeviceSessionService;\n private readonly _logger: LoggerPublisherService;\n\n constructor(\n @inject(deviceSessionTypes.DeviceSessionService)\n sessionService: DeviceSessionService,\n @inject(loggerTypes.LoggerPublisherServiceFactory)\n loggerFactory: (tag: string) => LoggerPublisherService,\n ) {\n this._sessionService = sessionService;\n this._logger = loggerFactory(\"SendApduUseCase\");\n }\n\n async execute({\n sessionId,\n apdu,\n abortTimeout,\n triggersDisconnection,\n }: SendApduUseCaseArgs): Promise<ApduResponse> {\n const deviceSessionOrError =\n this._sessionService.getDeviceSessionById(sessionId);\n\n return deviceSessionOrError.caseOf({\n // Case device session found\n Right: async (deviceSession) => {\n const response = await deviceSession.sendApdu(apdu, {\n abortTimeout,\n triggersDisconnection,\n });\n return response.caseOf({\n // Case APDU sent and response received successfully\n Right: (data) => data,\n // Case error sending or receiving APDU\n Left: (error) => {\n this._logger.error(\"Error sending APDU\", {\n data: { sessionId, apdu, error },\n });\n throw error;\n },\n });\n },\n // Case device session not found\n Left: (error) => {\n this._logger.error(\"Error getting deviceSession\", {\n data: { error },\n });\n throw error;\n },\n });\n }\n}\n"],
|
5
|
+
"mappings": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAKnC,OAAS,sBAAAC,MAA0B,iDAEnC,OAAS,eAAAC,MAAmB,4CA4BrB,IAAMC,EAAN,KAAsB,CACV,gBACA,QAEjB,YAEEC,EAEAC,EACA,CACA,KAAK,gBAAkBD,EACvB,KAAK,QAAUC,EAAc,iBAAiB,CAChD,CAEA,MAAM,QAAQ,CACZ,UAAAC,EACA,KAAAC,EACA,aAAAC,EACA,sBAAAC,CACF,EAA+C,CAI7C,OAFE,KAAK,gBAAgB,qBAAqBH,CAAS,EAEzB,OAAO,CAEjC,MAAO,MAAOI,IACK,MAAMA,EAAc,SAASH,EAAM,CAClD,aAAAC,EACA,sBAAAC,CACF,CAAC,GACe,OAAO,CAErB,MAAQE,GAASA,EAEjB,KAAOC,GAAU,CACf,WAAK,QAAQ,MAAM,qBAAsB,CACvC,KAAM,CAAE,UAAAN,EAAW,KAAAC,EAAM,MAAAK,CAAM,CACjC,CAAC,EACKA,CACR,CACF,CAAC,EAGH,KAAOA,GAAU,CACf,WAAK,QAAQ,MAAM,8BAA+B,CAChD,KAAM,CAAE,MAAAA,CAAM,CAChB,CAAC,EACKA,CACR,CACF,CAAC,CACH,CACF,EAnDaT,EAANU,EAAA,CADNC,EAAW,EAMPC,EAAA,EAAAC,EAAOC,EAAmB,oBAAoB,GAE9CF,EAAA,EAAAC,EAAOE,EAAY,6BAA6B,IAPxCf",
|
6
|
+
"names": ["inject", "injectable", "deviceSessionTypes", "loggerTypes", "SendApduUseCase", "sessionService", "loggerFactory", "sessionId", "apdu", "abortTimeout", "triggersDisconnection", "deviceSession", "data", "error", "__decorateClass", "injectable", "__decorateParam", "inject", "deviceSessionTypes", "loggerTypes"]
|
7
7
|
}
|
@@ -151,6 +151,34 @@ export declare class ByteArrayBuilder {
|
|
151
151
|
* @returns {ByteArrayBuilder} - Returns the current instance of ByteArrayBuilder
|
152
152
|
*/
|
153
153
|
encodeInLVFromAscii: (value: string) => ByteArrayBuilder;
|
154
|
+
/**
|
155
|
+
* Add a Tag-Length-Value encoded hexadecimal string to the data field if it has enough remaining space
|
156
|
+
* Length-Value encoding is a way to encode data in a binary format with the first byte
|
157
|
+
* being the length of the data and the following bytes being the data itself
|
158
|
+
* @param tag: number - The tag to add to the data
|
159
|
+
* @param value: string - The value to add to the data
|
160
|
+
* @returns {ByteArrayBuilder} - Returns the current instance of ByteArrayBuilder
|
161
|
+
*/
|
162
|
+
encodeInTLVFromHexa: (tag: number, value: string) => ByteArrayBuilder;
|
163
|
+
/**
|
164
|
+
* Add a Tag-Length-Value encoded hexadecimal string to the data field if it has enough remaining space
|
165
|
+
* Length-Value encoding is a way to encode data in a binary format with the first byte
|
166
|
+
* being the length of the data and the following bytes being the data itself
|
167
|
+
* @param tag: number - The tag to add to the data
|
168
|
+
* @param value: Uint8Array - The buffer to add to the data
|
169
|
+
* @returns {ByteArrayBuilder} - Returns the current instance of ByteArrayBuilder
|
170
|
+
*/
|
171
|
+
encodeInTLVFromBuffer: (tag: number, value: Uint8Array) => ByteArrayBuilder;
|
172
|
+
/**
|
173
|
+
* Add a Tag-Length-Value encoded uint64 to the data field if it has enough remaining space
|
174
|
+
* Length-Value encoding is a way to encode data in a binary format with the first byte
|
175
|
+
* being the length of the data and the following bytes being the data itself
|
176
|
+
* @param tag: number - The tag to add to the data
|
177
|
+
* @param value: number | bigint - The number to add
|
178
|
+
* @param bigEndian: boolean - Endianness used to encode the number
|
179
|
+
* @returns {ByteArrayBuilder} - Returns the current instance of ByteArrayBuilder
|
180
|
+
*/
|
181
|
+
encodeInTLVFromUInt64: (tag: number, value: number | bigint, bigEndian?: boolean) => ByteArrayBuilder;
|
154
182
|
/**
|
155
183
|
* Returns the remaining payload length
|
156
184
|
* @returns {number}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ByteArrayBuilder.d.ts","sourceRoot":"","sources":["../../../../../../src/api/apdu/utils/ByteArrayBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,mBAAmB,CAAC;AAI3B;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAgB;IAIf,OAAO,CAAC,cAAc;IAHlC,OAAO,CAAC,IAAI,CAAgC;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;gBAE5B,cAAc,GAAE,MAAwB;IAM5D;;;OAGG;IACH,KAAK,QAAO,UAAU,CAAc;IAEpC;;;;OAIG;IACH,QAAQ,QAAO,UAAU,GAAG,SAAS,CAEnC;IAEF;;;;OAIG;IACH,iBAAiB,GAAI,OAAO,MAAM,GAAG,MAAM,KAAG,gBAAgB,CAE5D;IAEF;;;;;OAKG;IACH,kBAAkB,GAChB,OAAO,MAAM,GAAG,MAAM,EACtB,YAAW,OAAc,KACxB,gBAAgB,CAEjB;IAEF;;;;;OAKG;IACH,kBAAkB,GAChB,OAAO,MAAM,GAAG,MAAM,EACtB,YAAW,OAAc,KACxB,gBAAgB,CAEjB;IAEF;;;;;OAKG;IACH,kBAAkB,GAChB,OAAO,MAAM,GAAG,MAAM,EACtB,YAAW,OAAc,KACxB,gBAAgB,CAEjB;IAEF;;;;;OAKG;IACH,mBAAmB,GACjB,OAAO,MAAM,GAAG,MAAM,EACtB,YAAW,OAAc,KACxB,gBAAgB,CAEjB;IAEF;;;;;OAKG;IACH,mBAAmB,GACjB,OAAO,MAAM,GAAG,MAAM,EACtB,YAAW,OAAc,KACxB,gBAAgB,CAEjB;IAEF;;;;;OAKG;IACH,iBAAiB,GACf,OAAO,MAAM,GAAG,MAAM,EACtB,YAAW,OAAc,KACxB,gBAAgB,CAEjB;IAEF;;;;;OAKG;IACH,iBAAiB,GACf,OAAO,MAAM,GAAG,MAAM,EACtB,YAAW,OAAc,KACxB,gBAAgB,CAEjB;IAEF;;;;;OAKG;IACH,iBAAiB,GACf,OAAO,MAAM,GAAG,MAAM,EACtB,YAAW,OAAc,KACxB,gBAAgB,CAEjB;IAEF;;;;;OAKG;IACH,kBAAkB,GAChB,OAAO,MAAM,GAAG,MAAM,EACtB,YAAW,OAAc,KACxB,gBAAgB,CAEjB;IAEF;;;;;OAKG;IACH,kBAAkB,GAChB,OAAO,MAAM,GAAG,MAAM,EACtB,YAAW,OAAc,KACxB,gBAAgB,CAEjB;IAEF;;;;OAIG;IACH,eAAe,GAAI,OAAO,UAAU,KAAG,gBAAgB,CAQrD;IAEF;;;;;OAKG;IACH,mBAAmB,GAAI,OAAO,MAAM,KAAG,gBAAgB,CAQrD;IAEF;;;;OAIG;IACH,oBAAoB,GAAI,OAAO,MAAM,KAAG,gBAAgB,CAItD;IAEF;;;;;;OAMG;IACH,kBAAkB,GAAI,OAAO,MAAM,KAAG,gBAAgB,CAgBpD;IAEF;;;;;;OAMG;IACH,oBAAoB,GAAI,OAAO,UAAU,KAAG,gBAAgB,CAS1D;IAEF;;;;;;OAMG;IACH,mBAAmB,GAAI,OAAO,MAAM,KAAG,gBAAgB,CASrD;IAEF;;;OAGG;IACH,yBAAyB,QAAO,MAAM,CAEpC;IAEF;;;OAGG;IACH,SAAS,QAAO,eAAe,EAAE,CAAgB;IAEjD;;;OAGG;IACH,SAAS,QAAO,OAAO,CAA6B;IAMpD;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB,CAO9B;IAEF;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;IA6BvB;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;CAuC9B"}
|
1
|
+
{"version":3,"file":"ByteArrayBuilder.d.ts","sourceRoot":"","sources":["../../../../../../src/api/apdu/utils/ByteArrayBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,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(statusCode: Uint8Array): boolean;
|
4
4
|
static isSuccessResponse({ statusCode }: ApduResponse): boolean;
|
5
5
|
static isLockedDeviceResponse({ statusCode }: ApduResponse): boolean;
|
6
|
+
static isRefusedByUser({ statusCode }: ApduResponse): boolean;
|
7
|
+
static isAppAlreadyInstalled({ statusCode }: ApduResponse): boolean;
|
8
|
+
static isOutOfMemory({ statusCode }: ApduResponse): boolean;
|
6
9
|
static isApduThatTriggersDisconnection(apdu: Uint8Array): boolean;
|
7
10
|
}
|
8
11
|
//# sourceMappingURL=CommandUtils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CommandUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/api/command/utils/CommandUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,qBAAa,YAAY;IACvB,MAAM,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU;IAI/C,MAAM,CAAC,iBAAiB,CAAC,EAAE,UAAU,EAAE,EAAE,YAAY;IAQrD,MAAM,CAAC,sBAAsB,CAAC,EAAE,UAAU,EAAE,EAAE,YAAY;
|
1
|
+
{"version":3,"file":"CommandUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/api/command/utils/CommandUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,qBAAa,YAAY;IACvB,MAAM,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU;IAI/C,MAAM,CAAC,iBAAiB,CAAC,EAAE,UAAU,EAAE,EAAE,YAAY;IAQrD,MAAM,CAAC,sBAAsB,CAAC,EAAE,UAAU,EAAE,EAAE,YAAY;IAY1D,MAAM,CAAC,eAAe,CAAC,EAAE,UAAU,EAAE,EAAE,YAAY;IAWnD,MAAM,CAAC,qBAAqB,CAAC,EAAE,UAAU,EAAE,EAAE,YAAY;IAazD,MAAM,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,EAAE,YAAY;IAajD,MAAM,CAAC,+BAA+B,CAAC,IAAI,EAAE,UAAU;CAmBxD"}
|
@@ -12,6 +12,7 @@ export declare enum UserInteractionRequired {
|
|
12
12
|
AllowListApps = "allow-list-apps",
|
13
13
|
VerifyAddress = "verify-address",
|
14
14
|
SignPersonalMessage = "sign-personal-message",
|
15
|
+
SignDelegationAuthorization = "sign-delegation-authorization",
|
15
16
|
Web3ChecksOptIn = "web3-checks-opt-in"
|
16
17
|
}
|
17
18
|
//# sourceMappingURL=UserInteractionRequired.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UserInteractionRequired.d.ts","sourceRoot":"","sources":["../../../../../../src/api/device-action/model/UserInteractionRequired.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,IAAI,SAAS;IACb,YAAY,kBAAkB;IAC9B,qBAAqB,4BAA4B;IACjD,cAAc,qBAAqB;IACnC,eAAe,qBAAqB;IACpC,aAAa,oBAAoB;IACjC,aAAa,oBAAoB;IACjC,aAAa,mBAAmB;IAChC,mBAAmB,0BAA0B;IAC7C,eAAe,uBAAuB;CACvC"}
|
1
|
+
{"version":3,"file":"UserInteractionRequired.d.ts","sourceRoot":"","sources":["../../../../../../src/api/device-action/model/UserInteractionRequired.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,IAAI,SAAS;IACb,YAAY,kBAAkB;IAC9B,qBAAqB,4BAA4B;IACjD,cAAc,qBAAqB;IACnC,eAAe,qBAAqB;IACpC,aAAa,oBAAoB;IACjC,aAAa,oBAAoB;IACjC,aAAa,mBAAmB;IAChC,mBAAmB,0BAA0B;IAC7C,2BAA2B,kCAAkC;IAC7D,eAAe,uBAAuB;CACvC"}
|
@@ -14,6 +14,16 @@ export declare class UnsupportedFirmwareDAError implements DmkError {
|
|
14
14
|
readonly originalError?: Error;
|
15
15
|
constructor(message?: string);
|
16
16
|
}
|
17
|
+
export declare class RefusedByUserDAError implements DmkError {
|
18
|
+
readonly _tag = "RefusedByUserDAError";
|
19
|
+
readonly originalError?: Error;
|
20
|
+
constructor(message?: string);
|
21
|
+
}
|
22
|
+
export declare class AppAlreadyInstalledDAError implements DmkError {
|
23
|
+
readonly _tag = "AppAlreadyInstalledDAError";
|
24
|
+
readonly originalError?: Error;
|
25
|
+
constructor(message?: string);
|
26
|
+
}
|
17
27
|
export declare class OutOfMemoryDAError implements DmkError {
|
18
28
|
readonly _tag = "OutOfMemoryDAError";
|
19
29
|
readonly originalError?: Error;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Errors.d.ts","sourceRoot":"","sources":["../../../../../../src/api/device-action/os/Errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,qBAAa,uBAAwB,YAAW,QAAQ;IACtD,QAAQ,CAAC,IAAI,6BAA6B;IAC1C,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC;gBAEnB,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,iBAAkB,YAAW,QAAQ;IAChD,QAAQ,CAAC,IAAI,uBAAuB;IACpC,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC;gBAEnB,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,0BAA2B,YAAW,QAAQ;IACzD,QAAQ,CAAC,IAAI,gCAAgC;IAC7C,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC;gBAEnB,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,kBAAmB,YAAW,QAAQ;IACjD,QAAQ,CAAC,IAAI,wBAAwB;IACrC,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC;gBAEnB,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,qBAAa,cAAe,YAAW,QAAQ;IAC7C,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CA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IACjC,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC;gBAEnB,OAAO,CAAC,EAAE,MAAM;CAG7B"}
|
package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"GetDeviceMetadataDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAKnE,OAAO,EAEL,KAAK,iCAAiC,EACtC,KAAK,YAAY,EAClB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EACL,KAAK,wBAAwB,EAC7B,kBAAkB,EACnB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,WAAW,EAEhB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC9B,MAAM,wCAAwC,CAAC;AAIhD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAE1E,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,oCAAoC,EACzC,KAAK,yBAAyB,EAC/B,MAAM,SAAS,CAAC;AAEjB,KAAK,qCAAqC,GAAG;IAC3C,QAAQ,CAAC,KAAK,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAChD,QAAQ,CA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;YACL,aAAa,EAAE,aAAa,CAAC;YAC7B,QAAQ,EAAE,aAAa,CAAC;YACxB,eAAe,EAAE,eAAe,CAAC;YACjC,aAAa,EAAE,YAAY,EAAE,CAAC;SAC/B,CAAC;KACH,KAAK,OAAO,CAAC,iCAAiC,CAAC,CAAC;IACjD,QAAQ,CAAC,qBAAqB,EAAE,CAAC,IAAI,EAAE;QACrC,KAAK,EAAE;YACL,QAAQ,EAAE,aAAa,CAAC;YACxB,eAAe,EAAE,eAAe,CAAC;SAClC,CAAC;KACH,KAAK,UAAU,CAAC,kBAAkB,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,CACvC,WAAW,EAAE,WAAW,KACrB,mBAAmB,CAAC;AAEzB,qBAAa,6BAA8B,SAAQ,kBAAkB,CACnE,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,oCAAoC,EACpC,qCAAqC,CACtC;IACC,gBAAgB,CACd,WAAW,EAAE,WAAW,GACvB,wBAAwB,CACzB,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,oCAAoC,EACpC,qCAAqC,CACtC;
|
1
|
+
{"version":3,"file":"GetDeviceMetadataDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAKnE,OAAO,EAEL,KAAK,iCAAiC,EACtC,KAAK,YAAY,EAClB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EACL,KAAK,wBAAwB,EAC7B,kBAAkB,EACnB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,WAAW,EAEhB,KAAK,qBAA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AqfD,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,mBAAmB;CAoEnE"}
|
@@ -5,6 +5,7 @@ import { type ListAppsDAError, type ListAppsDARequiredInteraction } from "../../
|
|
5
5
|
import { type Catalog, type CustomImage, type FirmwareUpdateContext, type FirmwareVersion, type InstalledLanguagePackage } from "../../../device-session/DeviceSessionState";
|
6
6
|
import { type ListInstalledAppsDAError, type ListInstalledAppsDARequiredInteraction } from "../../../secure-channel/device-action/ListInstalledApps/types";
|
7
7
|
import { type Application } from "../../../../internal/manager-api/model/Application";
|
8
|
+
import { type SecureChannelDAErrors } from "../../../../internal/secure-channel/model/Errors";
|
8
9
|
export type GetDeviceMetadataDAOutput = {
|
9
10
|
readonly firmwareVersion: FirmwareVersion;
|
10
11
|
readonly firmwareUpdateContext: FirmwareUpdateContext;
|
@@ -18,7 +19,7 @@ export type GetDeviceMetadataDAInput = GoToDashboardDAInput & {
|
|
18
19
|
readonly useSecureChannel?: boolean;
|
19
20
|
readonly forceUpdate?: boolean;
|
20
21
|
};
|
21
|
-
export type GetDeviceMetadataDAError = GoToDashboardDAError | ListAppsDAError | ListInstalledAppsDAError | CommandErrorResult["error"];
|
22
|
+
export type GetDeviceMetadataDAError = GoToDashboardDAError | ListAppsDAError | ListInstalledAppsDAError | SecureChannelDAErrors | CommandErrorResult["error"];
|
22
23
|
export type GetDeviceMetadataDARequiredInteraction = GoToDashboardDARequiredInteraction | ListAppsDARequiredInteraction | ListInstalledAppsDARequiredInteraction;
|
23
24
|
export type GetDeviceMetadataDAIntermediateValue = {
|
24
25
|
requiredUserInteraction: GetDeviceMetadataDARequiredInteraction;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/device-action/os/GetDeviceMetadata/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,kCAAkC,EACxC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,6BAA6B,EACnC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC9B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,sCAAsC,EAC5C,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,yCAAyC,CAAC;
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/device-action/os/GetDeviceMetadata/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,kCAAkC,EACxC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,6BAA6B,EACnC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC9B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,sCAAsC,EAC5C,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAEnF,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IACtD,QAAQ,CAAC,YAAY,EAAE,WAAW,EAAE,CAAC;IACrC,QAAQ,CAAC,mBAAmB,EAAE,WAAW,EAAE,CAAC;IAC5C,QAAQ,CAAC,kBAAkB,EAAE,wBAAwB,EAAE,CAAC;IACxD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,oBAAoB,GAAG;IAC5D,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAChC,oBAAoB,GACpB,eAAe,GACf,wBAAwB,GACxB,qBAAqB,GACrB,kBAAkB,CAAC,OAAO,CAAC,CAAC;AAEhC,MAAM,MAAM,sCAAsC,GAC9C,kCAAkC,GAClC,6BAA6B,GAC7B,sCAAsC,CAAC;AAE3C,MAAM,MAAM,oCAAoC,GAAG;IACjD,uBAAuB,EAAE,sCAAsC,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CACtD,yBAAyB,EACzB,wBAAwB,EACxB,oCAAoC,CACrC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"InstallOrUpdateAppsDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAGvC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAMnE,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAE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AAM,MAAM,0BAA0B,GAAG,CACvC,WAAW,EAAE,WAAW,KACrB,mBAAmB,CAAC;AAEzB,qBAAa,+BAAgC,SAAQ,kBAAkB,CACrE,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,sCAAsC,EACtC,uCAAuC,CACxC;IACC,gBAAgB,CACd,WAAW,EAAE,WAAW,GACvB,wBAAwB,CACzB,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,sCAAsC,EACtC,uCAAuC,CACxC;
|
1
|
+
{"version":3,"file":"InstallOrUpdateAppsDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAGvC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAMnE,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,gDAAgD,CAAC;AAExD,OAAO,EACL,KAAK,wBAAwB,EAC7B,kBAAkB,EACnB,MAAM,oDAAoD,CAAC;AAE5D,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAE3E,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,sCAAsC,EAC3C,KAAK,2BAA2B,EACjC,MAAM,SAAS,CAAC;AAEjB,KAAK,uCAAuC,GAAG;IAC7C,QAAQ,CAAC,KAAK,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,SAAS,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAChD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE;QAChC,KAAK,EAAE;YACL,YAAY,EAAE,qBAAqB,EAAE,CAAC;YACtC,uBAAuB,EAAE,OAAO,CAAC;SAClC,CAAC;KACH,KAAK,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAC9C,QAAQ,CAAC,kBAAkB,EAAE,CAAC,IAAI,EAAE;QAClC,KAAK,EAAE;YACL,WAAW,EAAE,WAAW,EAAE,CAAC;SAC5B,CAAC;KACH,KAAK,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE;QAC1B,KAAK,EAAE;YACL,SAAS,EAAE,oBAAoB,CAAC;YAChC,WAAW,EAAE,WAAW,CAAC;SAC1B,CAAC;KACH,KAAK,UAAU,CAAC,kBAAkB,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,CACvC,WAAW,EAAE,WAAW,KACrB,mBAAmB,CAAC;AAEzB,qBAAa,+BAAgC,SAAQ,kBAAkB,CACrE,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,sCAAsC,EACtC,uCAAuC,CACxC;IACC,gBAAgB,CACd,WAAW,EAAE,WAAW,GACvB,wBAAwB,CACzB,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,sCAAsC,EACtC,uCAAuC,CACxC;IA6bD,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,mBAAmB;CA0CnE"}
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import type { CommandErrorResult } from "../../../command/model/CommandResult";
|
2
2
|
import type { DeviceModelId } from "../../../device/DeviceModel";
|
3
3
|
import type { DeviceActionState } from "../../../device-action/model/DeviceActionState";
|
4
|
-
import type { OutOfMemoryDAError } from "../../../device-action/os/Errors";
|
4
|
+
import type { OutOfMemoryDAError, UnsupportedFirmwareDAError } from "../../../device-action/os/Errors";
|
5
5
|
import type { GetDeviceMetadataDAError, GetDeviceMetadataDARequiredInteraction } from "../../../device-action/os/GetDeviceMetadata/types";
|
6
6
|
import type { GoToDashboardDARequiredInteraction } from "../../../device-action/os/GoToDashboard/types";
|
7
7
|
import type { GoToDashboardDAInput } from "../../../device-action/os/GoToDashboard/types";
|
8
8
|
import type { InstallAppDAError } from "../../../secure-channel/device-action/InstallApp/types";
|
9
9
|
import type { Application } from "../../../../internal/manager-api/model/Application";
|
10
|
+
import type { SecureChannelInstallDAErrors } from "../../../../internal/secure-channel/model/Errors";
|
10
11
|
/**
|
11
12
|
* An application version used as application constraint should either be a valid semantic versioning formatted
|
12
13
|
* string, or "latest" to ensure the app is always up-to-date.
|
@@ -54,7 +55,7 @@ export type InstallOrUpdateAppsDAInput = GoToDashboardDAInput & {
|
|
54
55
|
readonly applications: ApplicationDependency[];
|
55
56
|
readonly allowMissingApplication: boolean;
|
56
57
|
};
|
57
|
-
export type InstallOrUpdateAppsDAError = GetDeviceMetadataDAError | InstallAppDAError | OutOfMemoryDAError | CommandErrorResult["error"];
|
58
|
+
export type InstallOrUpdateAppsDAError = GetDeviceMetadataDAError | InstallAppDAError | OutOfMemoryDAError | UnsupportedFirmwareDAError | SecureChannelInstallDAErrors | CommandErrorResult["error"];
|
58
59
|
export type InstallOrUpdateAppsDARequiredInteraction = GoToDashboardDARequiredInteraction | GetDeviceMetadataDARequiredInteraction;
|
59
60
|
export type InstallOrUpdateAppsDAIntermediateValue = {
|
60
61
|
requiredUserInteraction: InstallOrUpdateAppsDARequiredInteraction;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/device-action/os/InstallOrUpdateApps/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAA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AwC,CAAC;IAClE,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,CACxD,2BAA2B,EAC3B,0BAA0B,EAC1B,sCAAsC,CACvC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"OpenAppDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAMnE,OAAO,EACL,KAAK,wBAAwB,EAC7B,kBAAkB,EACnB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,wCAAwC,CAAC;
|
1
|
+
{"version":3,"file":"OpenAppDeviceAction.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAMnE,OAAO,EACL,KAAK,wBAAwB,EAC7B,kBAAkB,EACnB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,wCAAwC,CAAC;AAGhD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EACrB,MAAM,SAAS,CAAC;AAEjB,KAAK,gCAAgC,GAAG;IACtC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACxD,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE;QACvB,KAAK,EAAE;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACpC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;IACzD,QAAQ,CAAC,qBAAqB,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACpE,QAAQ,CAAC,iBAAiB,EAAE,MAAM,OAAO,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,CACvC,WAAW,EAAE,WAAW,KACrB,mBAAmB,CAAC;AAEzB;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,mBAAoB,SAAQ,kBAAkB,CACzD,eAAe,EACf,cAAc,EACd,cAAc,EACd,0BAA0B,EAC1B,gCAAgC,CACjC;IACC,gBAAgB,CACd,WAAW,EAAE,WAAW,GACvB,wBAAwB,CACzB,eAAe,EACf,cAAc,EACd,cAAc,EACd,0BAA0B,EAC1B,gCAAgC,CACjC;IA0VD,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,mBAAmB;CAgBnE"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { InternalApi } from "../../device-action/DeviceAction";
|
2
|
-
import { UnknownDAError } from "../../device-action/os/Errors";
|
2
|
+
import { UnknownDAError, UnsupportedFirmwareDAError } from "../../device-action/os/Errors";
|
3
3
|
import type { ApplicationDependency } from "../../device-action/os/InstallOrUpdateApps/types";
|
4
4
|
import type { Application } from "../../../internal/manager-api/model/Application";
|
5
5
|
export type BuildAppsInstallPlanTaskArgs = {
|
@@ -17,7 +17,7 @@ export type BuildAppsInstallPlanTaskResult = {
|
|
17
17
|
alreadyInstalled: string[];
|
18
18
|
missingApplications: string[];
|
19
19
|
} | {
|
20
|
-
error: UnknownDAError;
|
20
|
+
error: UnknownDAError | UnsupportedFirmwareDAError;
|
21
21
|
};
|
22
22
|
export declare class BuildAppsInstallPlanTask {
|
23
23
|
private readonly api;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"BuildAppsInstallPlanTask.d.ts","sourceRoot":"","sources":["../../../../../../src/api/device-action/task/BuildAppsInstallPlanTask.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,
|
1
|
+
{"version":3,"file":"BuildAppsInstallPlanTask.d.ts","sourceRoot":"","sources":["../../../../../../src/api/device-action/task/BuildAppsInstallPlanTask.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EACL,cAAc,EACd,0BAA0B,EAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAEV,qBAAqB,EACtB,MAAM,iDAAiD,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAE3E,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,qBAAqB,EAAE,CAAC;IAE/C;;OAEG;IACH,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,8BAA8B,GACtC;IACE,WAAW,EAAE,WAAW,EAAE,CAAC;IAC3B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B,GACD;IACE,KAAK,EAAE,cAAc,GAAG,0BAA0B,CAAC;CACpD,CAAC;AAEN,qBAAa,wBAAwB;IAIjC,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJvB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;gBAG3B,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,4BAA4B;IAMrD,GAAG,IAAI,8BAA8B;IA+FrC,OAAO,CAAC,kBAAkB;CAuC3B"}
|
@@ -22,7 +22,7 @@ export { type InternalApi } from "./device-action/DeviceAction";
|
|
22
22
|
export { type DeviceActionState, DeviceActionStatus, } from "./device-action/model/DeviceActionState";
|
23
23
|
export { UserInteractionRequired } from "./device-action/model/UserInteractionRequired";
|
24
24
|
export { CallTaskInAppDeviceAction } from "./device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction";
|
25
|
-
export { DeviceLockedError, OutOfMemoryDAError, UnknownDAError, UnsupportedFirmwareDAError, } from "./device-action/os/Errors";
|
25
|
+
export { AppAlreadyInstalledDAError, DeviceLockedError, OutOfMemoryDAError, RefusedByUserDAError, UnknownDAError, UnsupportedFirmwareDAError, } from "./device-action/os/Errors";
|
26
26
|
export { GetDeviceMetadataDeviceAction } from "./device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction";
|
27
27
|
export { GetDeviceStatusDeviceAction } from "./device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction";
|
28
28
|
export { GoToDashboardDeviceAction } from "./device-action/os/GoToDashboard/GoToDashboardDeviceAction";
|