@ledgerhq/speculos-device-controller 0.0.0-develop-20260428002525 → 0.0.0-develop-20260430002707
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/README.md +2 -2
- package/lib/cjs/package.json +2 -3
- package/lib/cjs/src/internal/adapters/DefaultButtonController.js +1 -1
- package/lib/cjs/src/internal/adapters/DefaultButtonController.js.map +2 -2
- package/lib/cjs/src/internal/adapters/DefaultButtonController.test.js +1 -1
- package/lib/cjs/src/internal/adapters/DefaultButtonController.test.js.map +3 -3
- package/lib/cjs/src/internal/adapters/DefaultTouchController.js +1 -1
- package/lib/cjs/src/internal/adapters/DefaultTouchController.js.map +2 -2
- package/lib/cjs/src/internal/adapters/DefaultTouchController.test.js +1 -1
- package/lib/cjs/src/internal/adapters/DefaultTouchController.test.js.map +3 -3
- package/lib/cjs/src/internal/core/types.js +1 -1
- package/lib/cjs/src/internal/core/types.js.map +2 -2
- package/lib/cjs/src/internal/di.js +1 -1
- package/lib/cjs/src/internal/di.js.map +3 -3
- package/lib/cjs/src/internal/di.test.js +1 -1
- package/lib/cjs/src/internal/di.test.js.map +3 -3
- package/lib/cjs/src/internal/use-cases/touchUseCases.js +1 -1
- package/lib/cjs/src/internal/use-cases/touchUseCases.js.map +3 -3
- package/lib/cjs/src/internal/use-cases/touchUseCases.test.js +1 -1
- package/lib/cjs/src/internal/use-cases/touchUseCases.test.js.map +3 -3
- package/lib/esm/package.json +2 -3
- package/lib/esm/src/internal/adapters/DefaultButtonController.js.map +2 -2
- package/lib/esm/src/internal/adapters/DefaultButtonController.test.js +1 -1
- package/lib/esm/src/internal/adapters/DefaultButtonController.test.js.map +3 -3
- package/lib/esm/src/internal/adapters/DefaultTouchController.js +1 -1
- package/lib/esm/src/internal/adapters/DefaultTouchController.js.map +2 -2
- package/lib/esm/src/internal/adapters/DefaultTouchController.test.js +1 -1
- package/lib/esm/src/internal/adapters/DefaultTouchController.test.js.map +3 -3
- package/lib/esm/src/internal/core/types.js.map +2 -2
- package/lib/esm/src/internal/di.js +1 -1
- package/lib/esm/src/internal/di.js.map +3 -3
- package/lib/esm/src/internal/di.test.js +1 -1
- package/lib/esm/src/internal/di.test.js.map +3 -3
- package/lib/esm/src/internal/use-cases/touchUseCases.js +1 -1
- package/lib/esm/src/internal/use-cases/touchUseCases.js.map +3 -3
- package/lib/esm/src/internal/use-cases/touchUseCases.test.js +1 -1
- package/lib/esm/src/internal/use-cases/touchUseCases.test.js.map +3 -3
- package/lib/types/src/internal/adapters/DefaultButtonController.d.ts +2 -3
- package/lib/types/src/internal/adapters/DefaultButtonController.d.ts.map +1 -1
- package/lib/types/src/internal/adapters/DefaultTouchController.d.ts +2 -3
- package/lib/types/src/internal/adapters/DefaultTouchController.d.ts.map +1 -1
- package/lib/types/src/internal/core/types.d.ts +3 -0
- package/lib/types/src/internal/core/types.d.ts.map +1 -1
- package/lib/types/src/internal/di.d.ts.map +1 -1
- package/lib/types/src/internal/use-cases/touchUseCases.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +6 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/adapters/DefaultTouchController.test.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\nimport type {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["DefaultTouchController", "postMock", "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\nimport type { HttpClient, PercentCoordinates } from \"../core/types\";\nimport { DefaultTouchController } from \"./DefaultTouchController\";\n\ndescribe(\"DefaultTouchController\", () => {\n let postMock: ReturnType<typeof vi.fn>;\n let httpClient: HttpClient;\n\n const axisA = {\n xy: vi.fn((xPct: number, yPct: number) => ({\n x: Math.round(xPct * 10),\n y: Math.round(yPct * 20),\n })),\n };\n const axisB = {\n xy: vi.fn((xPct: number, yPct: number) => ({\n x: Math.round(100 + xPct),\n y: Math.round(200 + yPct),\n })),\n };\n let axesFake: Record<\n string,\n { xy: (x: number, y: number) => { x: number; y: number } }\n >;\n\n let controller: DefaultTouchController<string>;\n\n beforeEach(() => {\n postMock = vi.fn().mockResolvedValue(undefined);\n httpClient = { post: postMock };\n\n axisA.xy.mockClear();\n axisB.xy.mockClear();\n\n axesFake = { devA: axisA, devB: axisB };\n controller = new DefaultTouchController(httpClient, axesFake as any);\n });\n\n const point: PercentCoordinates = { x: 12, y: 45 };\n\n it(\"tapAndRelease: converts percent to absolute via axes and POSTs expected body\", async () => {\n await controller.tapAndRelease(\"devA\", point);\n\n expect(axisA.xy).toHaveBeenCalledTimes(1);\n expect(axisA.xy).toHaveBeenCalledWith(point.x, point.y);\n\n const expectedAbs = (axisA.xy.mock.results as any)[0].value;\n expect(postMock).toHaveBeenCalledTimes(1);\n expect(postMock).toHaveBeenCalledWith(\"/finger\", {\n action: \"press-and-release\",\n ...expectedAbs,\n });\n });\n\n it(\"tap: converts via axes and POSTs action 'press'\", async () => {\n await controller.tap(\"devB\", point);\n\n expect(axisB.xy).toHaveBeenCalledWith(point.x, point.y);\n const expectedAbs = axisB.xy.mock.results[0]?.value;\n\n expect(postMock).toHaveBeenCalledWith(\"/finger\", {\n action: \"press\",\n ...expectedAbs,\n });\n });\n\n it(\"release: converts via axes and POSTs action 'release'\", async () => {\n await controller.release(\"devA\", point);\n\n const expectedAbs = axisA.xy.mock.results[0]!.value;\n expect(postMock).toHaveBeenCalledWith(\"/finger\", {\n action: \"release\",\n ...expectedAbs,\n });\n });\n\n it(\"throws an error when device key is unknown\", async () => {\n await expect(controller.tap(\"unknownDevice\" as any, point)).rejects.toThrow(\n /\\[Touch] Unknown device key \"unknownDevice\".*Known keys: devA, devB/,\n );\n expect(postMock).not.toHaveBeenCalled();\n });\n\n it(\"propagates HTTP errors\", async () => {\n const boom = new Error(\"backend down\");\n postMock.mockRejectedValueOnce(boom);\n\n await expect(controller.tapAndRelease(\"devA\", point)).rejects.toBe(boom);\n });\n});\n\ndescribe(\"percent validation\", () => {\n let controller: DefaultTouchController<string>;\n let postMock: ReturnType<typeof vi.fn>;\n let httpClient: HttpClient;\n\n const axis = {\n xy: vi.fn((xPct: number, yPct: number) => ({ x: xPct, y: yPct })),\n };\n const axesFake = { devA: axis };\n\n beforeEach(() => {\n postMock = vi.fn().mockResolvedValue(undefined);\n httpClient = { post: postMock };\n axis.xy.mockClear();\n controller = new DefaultTouchController(httpClient, axesFake as any);\n });\n\n it(\"accepts boundary values 0 and 100\", async () => {\n await controller.tapAndRelease(\"devA\", { x: 0, y: 100 });\n await controller.tap(\"devA\", { x: 100, y: 0 });\n await controller.release(\"devA\", { x: 50, y: 99 });\n\n // should have sent 3 HTTP calls if all accepted\n expect(postMock).toHaveBeenCalledTimes(3);\n });\n\n it(\"rejects values outside [0, 100], non-finite, negative and non-integer\", async () => {\n const badPoints = [\n { x: 140, y: 50 },\n { x: -1, y: 50 },\n { x: 50, y: 120 },\n { x: 50, y: -0.01 },\n ];\n\n for (const p of badPoints) {\n await expect(\n controller.tapAndRelease(\"devA\", p as any),\n ).rejects.toThrow();\n }\n\n // no HTTP calls should be made for invalid input\n expect(postMock).not.toHaveBeenCalled();\n });\n\n it(\"rejects NaN or non-finite values\", async () => {\n const badPoints = [\n { x: Number.NaN, y: 50 },\n { x: 50, y: Number.NaN },\n { x: Number.POSITIVE_INFINITY, y: 10 },\n { x: 10, y: Number.NEGATIVE_INFINITY },\n ];\n\n for (const p of badPoints) {\n await expect(controller.tap(\"devA\", p as any)).rejects.toThrow(\n /percent/i,\n );\n }\n expect(postMock).not.toHaveBeenCalled();\n });\n});\n"],
|
|
5
|
+
"mappings": "AAKA,O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Q,OAAQ,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAGjD,OAAOP,CAAQ,EAAE,sBAAsB,CAAC,CAC1C,CAAC,EAED,GAAG,wEAAyE,SAAY,CACtF,MAAMY,EAAY,CAChB,CAAE,EAAG,IAAK,EAAG,EAAG,EAChB,CAAE,EAAG,GAAI,EAAG,EAAG,EACf,CAAE,EAAG,GAAI,EAAG,GAAI,EAChB,CAAE,EAAG,GAAI,EAAG,IAAM,CACpB,EAEA,UAAWC,KAAKD,EACd,MAAM,OACJL,EAAW,cAAc,OAAQM,CAAQ,CAC3C,EAAE,QAAQ,QAAQ,EAIpB,OAAOb,CAAQ,EAAE,IAAI,iBAAiB,CACxC,CAAC,EAED,GAAG,mCAAoC,SAAY,CACjD,MAAMY,EAAY,CAChB,CAAE,EAAG,OAAO,IAAK,EAAG,EAAG,EACvB,CAAE,EAAG,GAAI,EAAG,OAAO,GAAI,EACvB,CAAE,EAAG,OAAO,kBAAmB,EAAG,EAAG,EACrC,CAAE,EAAG,GAAI,EAAG,OAAO,iBAAkB,CACvC,EAEA,UAAWC,KAAKD,EACd,MAAM,OAAOL,EAAW,IAAI,OAAQM,CAAQ,CAAC,EAAE,QAAQ,QACrD,UACF,EAEF,OAAOb,CAAQ,EAAE,IAAI,iBAAiB,CACxC,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["DefaultTouchController", "postMock", "httpClient", "axisA", "xPct", "yPct", "axisB", "axesFake", "controller", "point", "expectedAbs", "boom", "axis", "badPoints", "p"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/core/types.ts"],
|
|
4
|
-
"sourcesContent": ["export type ButtonKey = \"left\" | \"right\" | \"both\";\n\nexport type ScreenSpec = Readonly<{ width: number; height: number }>;\n\nexport type DeviceScreens<K extends string = string> = Readonly<\n Record<K, ScreenSpec>\n>;\n\nexport type Range<\n N extends number,\n Acc extends number[] = [],\n> = Acc[\"length\"] extends N ? Acc[number] : Range<N, [...Acc, Acc[\"length\"]]>;\nexport type Percent = Range<101>;\n\nexport type PercentCoordinates = { x: Percent; y: Percent };\n\nexport type DeviceControllerOptions<K extends string = string> = {\n screens: DeviceScreens<K>;\n timeoutMs?: number;\n clientHeader?: string;\n};\n\nexport enum SpeculosActions {\n PRESS = \"press\",\n RELEASE = \"release\",\n PRESS_AND_RELEASE = \"press-and-release\",\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export type ButtonKey = \"left\" | \"right\" | \"both\";\n\nexport type ScreenSpec = Readonly<{ width: number; height: number }>;\n\nexport type DeviceScreens<K extends string = string> = Readonly<\n Record<K, ScreenSpec>\n>;\n\nexport type Range<\n N extends number,\n Acc extends number[] = [],\n> = Acc[\"length\"] extends N ? Acc[number] : Range<N, [...Acc, Acc[\"length\"]]>;\nexport type Percent = Range<101>;\n\nexport type PercentCoordinates = { x: Percent; y: Percent };\n\nexport type DeviceControllerOptions<K extends string = string> = {\n screens: DeviceScreens<K>;\n timeoutMs?: number;\n clientHeader?: string;\n};\n\nexport interface HttpClient {\n post(url: string, data?: unknown): Promise<unknown>;\n}\n\nexport enum SpeculosActions {\n PRESS = \"press\",\n RELEASE = \"release\",\n PRESS_AND_RELEASE = \"press-and-release\",\n}\n"],
|
|
5
|
+
"mappings": "AA0BO,IAAKA,OACVA,EAAA,MAAQ,QACRA,EAAA,QAAU,UACVA,EAAA,kBAAoB,oBAHVA,OAAA",
|
|
6
6
|
"names": ["SpeculosActions"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{DmkNetworkClient as p}from"@ledgerhq/device-management-kit";import{DefaultButtonController as C}from"./adapters/DefaultButtonController";import{DefaultTouchController as m}from"./adapters/DefaultTouchController";import{createAxes as a}from"./utils/axisClamp";function x(r,t){const e=t.timeoutMs??1500,n=new p({baseUrl:r,headers:{"X-Ledger-Client-Version":t.clientHeader??"ldmk-transport-speculos"}}),o={async post(c,u){return n.post(c,u,{timeoutMs:e})}},l=a(t.screens),s=new C(o),i=new m(o,l);return{buttons:s,touch:i}}export{x as createDefaultControllers};
|
|
2
2
|
//# sourceMappingURL=di.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/internal/di.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { DmkNetworkClient } from \"@ledgerhq/device-management-kit\";\n\nimport { DefaultButtonController } from \"@internal/adapters/DefaultButtonController\";\nimport { DefaultTouchController } from \"@internal/adapters/DefaultTouchController\";\nimport type { ButtonController } from \"@internal/core/ButtonController\";\nimport type { DeviceControllerOptions, HttpClient } from \"@internal/core/types\";\nimport { type AxisMap, createAxes } from \"@internal/utils/axisClamp\";\nimport type { TouchController } from \"@root/src/internal/core/TouchController\";\n\nexport type ControllersContainer = {\n buttons: ButtonController;\n touch: TouchController;\n};\n\nexport function createDefaultControllers(\n baseURL: string,\n opts: DeviceControllerOptions,\n): ControllersContainer {\n const timeoutMs = opts.timeoutMs ?? 1500;\n const client = new DmkNetworkClient({\n baseUrl: baseURL,\n headers: {\n \"X-Ledger-Client-Version\": opts.clientHeader ?? \"ldmk-transport-speculos\",\n },\n });\n\n const http: HttpClient = {\n async post(url: string, data?: unknown): Promise<unknown> {\n return client.post(url, data, { timeoutMs });\n },\n };\n\n const axes: AxisMap = createAxes(opts.screens);\n\n const buttons: ButtonController = new DefaultButtonController(http);\n const touch: TouchController = new DefaultTouchController(http, axes);\n\n return { buttons, touch };\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,kCAEjC,OAAS,2BAAAC,MAA+B,6CACxC,OAAS,0BAAAC,MAA8B,4CAGvC,OAAuB,cAAAC,MAAkB,4BAQlC,SAASC,EACdC,EACAC,EACsB,CACtB,MAAMC,EAAYD,EAAK,WAAa,KAC9BE,EAAS,IAAIR,EAAiB,CAClC,QAASK,EACT,QAAS,CACP,0BAA2BC,EAAK,cAAgB,yBAClD,CACF,CAAC,EAEKG,EAAmB,CACvB,MAAM,KAAKC,EAAaC,EAAkC,CACxD,OAAOH,EAAO,KAAKE,EAAKC,EAAM,CAAE,UAAAJ,CAAU,CAAC,CAC7C,CACF,EAEMK,EAAgBT,EAAWG,EAAK,OAAO,EAEvCO,EAA4B,IAAIZ,EAAwBQ,CAAI,EAC5DK,EAAyB,IAAIZ,EAAuBO,EAAMG,CAAI,EAEpE,MAAO,CAAE,QAAAC,EAAS,MAAAC,CAAM,CAC1B",
|
|
6
|
+
"names": ["DmkNetworkClient", "DefaultButtonController", "DefaultTouchController", "createAxes", "createDefaultControllers", "baseURL", "opts", "timeoutMs", "client", "http", "url", "data", "axes", "buttons", "touch"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{afterEach as l,describe as i,expect as e,it as a,vi as c}from"vitest";import{DefaultButtonController as r}from"./adapters/DefaultButtonController";import{DefaultTouchController as h}from"./adapters/DefaultTouchController";import{createDefaultControllers as n}from"./di";const s={flex:{width:128,height:64},stax:{width:400,height:672}};l(()=>{c.restoreAllMocks()});i("createDefaultControllers - fetch configuration",()=>{a("configures with custom timeout and header",async()=>{const t=c.spyOn(globalThis,"fetch").mockResolvedValue(new Response("{}")),{buttons:o}=n("https://example.com/api",{screens:s,timeoutMs:2345,clientHeader:"test-client"});await o.press("left"),e(t).toHaveBeenCalledTimes(1),e(t).toHaveBeenCalledWith(e.objectContaining({href:"https://example.com/api/button/left"}),e.objectContaining({method:"POST",headers:e.objectContaining({"X-Ledger-Client-Version":"test-client"})}))}),a("applies default timeout and client header when not provided",async()=>{const t=c.spyOn(globalThis,"fetch").mockResolvedValue(new Response("{}")),{buttons:o}=n("https://localhost:1234",{screens:s});await o.press("left"),e(t).toHaveBeenCalledWith(e.objectContaining({href:"https://localhost:1234/button/left"}),e.objectContaining({method:"POST",headers:e.objectContaining({"X-Ledger-Client-Version":"ldmk-transport-speculos"})}))})});i("createDefaultControllers - wiring",()=>{a("returns correct controller implementations",()=>{const{buttons:t,touch:o}=n("https://x",{screens:s});e(t).toBeInstanceOf(r),e(o).toBeInstanceOf(h),e(typeof t.press).toBe("function")}),a("creates fresh instances per invocation",()=>{const t=n("https://x",{screens:s}),o=n("https://x",{screens:s});e(t.buttons).not.toBe(o.buttons),e(t.touch).not.toBe(o.touch)}),a("button.press posts the correct payload",async()=>{const t=c.spyOn(globalThis,"fetch").mockResolvedValue(new Response("{}")),{buttons:o}=n("https://x",{screens:s});await o.press("left"),e(t).toHaveBeenCalledWith(e.objectContaining({href:"https://x/button/left"}),e.objectContaining({method:"POST",body:JSON.stringify({action:"press-and-release"})}))}),a("touch.tapAndRelease maps percent to absolute coords",async()=>{const t=c.spyOn(globalThis,"fetch").mockResolvedValue(new Response("{}")),{touch:o}=n("https://x",{screens:s});await o.tapAndRelease("flex",{x:50,y:50}),e(t).toHaveBeenCalledWith(e.objectContaining({href:"https://x/finger"}),e.objectContaining({method:"POST",body:JSON.stringify({action:"press-and-release",x:64,y:32})}))})});
|
|
2
2
|
//# sourceMappingURL=di.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/internal/di.test.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { afterEach, describe, expect, it, vi } from \"vitest\";\n\nimport { DefaultButtonController } from \"@internal/adapters/DefaultButtonController\";\nimport { DefaultTouchController } from \"@internal/adapters/DefaultTouchController\";\n\nimport { createDefaultControllers } from \"./di\";\n\nconst SCREENS = {\n flex: { width: 128, height: 64 },\n stax: { width: 400, height: 672 },\n} as const;\n\nafterEach(() => {\n vi.restoreAllMocks();\n});\n\ndescribe(\"createDefaultControllers - fetch configuration\", () => {\n it(\"configures with custom timeout and header\", async () => {\n const fetchSpy = vi\n .spyOn(globalThis, \"fetch\")\n .mockResolvedValue(new Response(\"{}\"));\n\n const { buttons } = createDefaultControllers(\"https://example.com/api\", {\n screens: SCREENS,\n timeoutMs: 2345,\n clientHeader: \"test-client\",\n });\n\n await buttons.press(\"left\");\n\n expect(fetchSpy).toHaveBeenCalledTimes(1);\n expect(fetchSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n href: \"https://example.com/api/button/left\",\n }),\n expect.objectContaining({\n method: \"POST\",\n headers: expect.objectContaining({\n \"X-Ledger-Client-Version\": \"test-client\",\n }),\n }),\n );\n });\n\n it(\"applies default timeout and client header when not provided\", async () => {\n const fetchSpy = vi\n .spyOn(globalThis, \"fetch\")\n .mockResolvedValue(new Response(\"{}\"));\n\n const { buttons } = createDefaultControllers(\"https://localhost:1234\", {\n screens: SCREENS,\n });\n\n await buttons.press(\"left\");\n\n expect(fetchSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n href: \"https://localhost:1234/button/left\",\n }),\n expect.objectContaining({\n method: \"POST\",\n headers: expect.objectContaining({\n \"X-Ledger-Client-Version\": \"ldmk-transport-speculos\",\n }),\n }),\n );\n });\n});\n\ndescribe(\"createDefaultControllers - wiring\", () => {\n it(\"returns correct controller implementations\", () => {\n const { buttons, touch } = createDefaultControllers(\"https://x\", {\n screens: SCREENS,\n });\n\n expect(buttons).toBeInstanceOf(DefaultButtonController);\n expect(touch).toBeInstanceOf(DefaultTouchController);\n expect(typeof buttons.press).toBe(\"function\");\n });\n\n it(\"creates fresh instances per invocation\", () => {\n const a = createDefaultControllers(\"https://x\", { screens: SCREENS });\n const b = createDefaultControllers(\"https://x\", { screens: SCREENS });\n\n expect(a.buttons).not.toBe(b.buttons);\n expect(a.touch).not.toBe(b.touch);\n });\n\n it(\"button.press posts the correct payload\", async () => {\n const fetchSpy = vi\n .spyOn(globalThis, \"fetch\")\n .mockResolvedValue(new Response(\"{}\"));\n\n const { buttons } = createDefaultControllers(\"https://x\", {\n screens: SCREENS,\n });\n\n await buttons.press(\"left\");\n\n expect(fetchSpy).toHaveBeenCalledWith(\n expect.objectContaining({ href: \"https://x/button/left\" }),\n expect.objectContaining({\n method: \"POST\",\n body: JSON.stringify({ action: \"press-and-release\" }),\n }),\n );\n });\n\n it(\"touch.tapAndRelease maps percent to absolute coords\", async () => {\n const fetchSpy = vi\n .spyOn(globalThis, \"fetch\")\n .mockResolvedValue(new Response(\"{}\"));\n\n const { touch } = createDefaultControllers(\"https://x\", {\n screens: SCREENS,\n });\n\n // 50% of 128x64 \u2192 (64, 32)\n await touch.tapAndRelease(\"flex\", { x: 50 as any, y: 50 as any });\n\n expect(fetchSpy).toHaveBeenCalledWith(\n expect.objectContaining({ href: \"https://x/finger\" }),\n expect.objectContaining({\n method: \"POST\",\n body: JSON.stringify({\n action: \"press-and-release\",\n x: 64,\n y: 32,\n }),\n }),\n );\n });\n});\n"],
|
|
5
|
+
"mappings": "AACA,OAAS,aAAAA,EAAW,YAAAC,EAAU,UAAAC,EAAQ,MAAAC,EAAI,MAAAC,MAAU,SAEpD,OAAS,2BAAAC,MAA+B,6CACxC,OAAS,0BAAAC,MAA8B,4CAEvC,OAAS,4BAAAC,MAAgC,OAEzC,MAAMC,EAAU,CACd,KAAM,CAAE,MAAO,IAAK,OAAQ,EAAG,EAC/B,KAAM,CAAE,MAAO,IAAK,OAAQ,GAAI,CAClC,EAEAR,EAAU,IAAM,CACdI,EAAG,gBAAgB,CACrB,CAAC,EAEDH,EAAS,iDAAkD,IAAM,CAC/DE,EAAG,4CAA6C,SAAY,CAC1D,MAAMM,EAAWL,EACd,MAAM,WAAY,OAAO,EACzB,kBAAkB,IAAI,SAAS,IAAI,CAAC,EAEjC,CAAE,QAAAM,CAAQ,EAAIH,EAAyB,0BAA2B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,EAAE,KAAK,EAAE,IAAI,KAAKC,EAAE,KAAK,CAClC,CAAC,EAEDV,EAAG,yCAA0C,SAAY,CACvD,MAAMM,EAAWL,EACd,MAAM,WAAY,OAAO,EACzB,kBAAkB,IAAI,SAAS,IAAI,CAAC,EAEjC,CAAE,QAAAM,CAAQ,EAAIH,EAAyB,YAAa,CACxD,QAASC,CACX,CAAC,EAED,MAAME,EAAQ,MAAM,MAAM,EAE1BR,EAAOO,CAAQ,EAAE,qBACfP,EAAO,iBAAiB,CAAE,KAAM,uBAAwB,CAAC,EACzDA,EAAO,iBAAiB,CACtB,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,OAAQ,mBAAoB,CAAC,CACtD,CAAC,CACH,CACF,CAAC,EAEDC,EAAG,sDAAuD,SAAY,CACpE,MAAMM,EAAWL,EACd,MAAM,WAAY,OAAO,EACzB,kBAAkB,IAAI,SAAS,IAAI,CAAC,EAEjC,CAAE,MAAAO,CAAM,EAAIJ,EAAyB,YAAa,CACtD,QAASC,CACX,CAAC,EAGD,MAAMG,EAAM,cAAc,OAAQ,CAAE,EAAG,GAAW,EAAG,EAAU,CAAC,EAEhET,EAAOO,CAAQ,EAAE,qBACfP,EAAO,iBAAiB,CAAE,KAAM,kBAAmB,CAAC,EACpDA,EAAO,iBAAiB,CACtB,OAAQ,OACR,KAAM,KAAK,UAAU,CACnB,OAAQ,oBACR,EAAG,GACH,EAAG,EACL,CAAC,CACH,CAAC,CACH,CACF,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["afterEach", "describe", "expect", "it", "vi", "DefaultButtonController", "DefaultTouchController", "createDefaultControllers", "SCREENS", "fetchSpy", "buttons", "touch", "a", "b"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const
|
|
1
|
+
const s=5e3,c=(t,n)=>async(o,a=s)=>{await t.tap(n,o),await new Promise(i=>setTimeout(i,a)),await t.release(n,o)},e=(t,n)=>async o=>await t.tapAndRelease(n,o),K=(t,n)=>async(o=s)=>await c(t,n)({x:85,y:80},o),y=(t,n)=>async()=>await e(t,n)({x:20,y:90}),g=(t,n)=>async()=>await e(t,n)({x:90,y:90}),p=(t,n)=>async()=>await e(t,n)({x:45,y:90}),u=(t,n)=>async()=>await e(t,n)({x:50,y:80}),T=(t,n)=>async()=>await e(t,n)({x:50,y:90}),d=(t,n)=>async()=>await e(t,n)({x:85,y:8}),C=(t,n)=>async()=>await e(t,n)({x:10,y:4}),r={stax:{x:88,y:51},flex:{x:88,y:58},apex:{x:88,y:58}},x=t=>Object.hasOwn(r,t),l={x:88,y:51},h=(t,n)=>async()=>{const o=x(n)?r[n]:l;await e(t,n)(o)},w=(t,n)=>async()=>await e(t,n)({x:50,y:94}),S=(t,n)=>async()=>await e(t,n)({x:50,y:94});export{S as acceptBlindSigning,w as continueToBlindSigning,h as enableBlindSigningSettings,d as enterMenu,C as exitMenu,u as mainButton,g as navigateNext,p as navigatePrevious,y as reject,T as secondaryButton,K as sign,c as tapLong,e as tapQuick};
|
|
2
2
|
//# sourceMappingURL=touchUseCases.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/use-cases/touchUseCases.ts"],
|
|
4
|
-
"sourcesContent": ["import type { PercentCoordinates } from \"@internal/core/types\";\nimport { type TouchController } from \"@root/src/internal/core/TouchController\";\n\nconst TAP_LONG_TIME_MS = 5000;\n\nexport const tapLong =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (point: PercentCoordinates, delayMs: number = TAP_LONG_TIME_MS) => {\n await touch.tap(deviceKey, point);\n await new Promise((r) => setTimeout(r, delayMs));\n await touch.release(deviceKey, point);\n };\n\nexport const tapQuick =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (point: PercentCoordinates) =>\n await touch.tapAndRelease(deviceKey, point);\n\nexport const sign =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (delayMs: number = TAP_LONG_TIME_MS) =>\n await tapLong(touch, deviceKey)({ x: 85, y: 80 }, delayMs);\n\nexport const reject =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 20, y: 90 });\n\nexport const navigateNext =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 90, y: 90 });\n\nexport const navigatePrevious =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 45, y: 90 });\n\nexport const mainButton =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 80 });\n\nexport const secondaryButton =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 90 });\n\nexport const enterMenu =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 85, y: 8 });\n\nexport const exitMenu =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 10, y: 4 });\n\nexport const enableBlindSigningSettings =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async ()
|
|
5
|
-
"mappings": "AAGA,MAAMA,EAAmB,IAEZC,EACX,CAAmBC,EAA2BC,IAC9C,MAAOC,EAA2BC,EAAkBL,IAAqB,CACvE,MAAME,EAAM,IAAIC,EAAWC,CAAK,EAChC,MAAM,IAAI,QAASE,GAAM,WAAWA,EAAGD,CAAO,CAAC,EAC/C,MAAMH,EAAM,QAAQC,EAAWC,CAAK,CACtC,EAEWG,EACX,CAAmBL,EAA2BC,IAC9C,MAAOC,GACL,MAAMF,EAAM,cAAcC,EAAWC,CAAK,EAEjCI,EACX,CAAmBN,EAA2BC,IAC9C,MAAOE,EAAkBL,IACvB,MAAMC,EAAQC,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,EAAGE,CAAO,EAEhDI,EACX,CAAmBP,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCO,EACX,CAAmBR,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCQ,EACX,CAAmBT,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCS,EACX,CAAmBV,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCU,EACX,CAAmBX,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCW,EACX,CAAmBZ,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,CAAE,CAAC,EAEvCY,EACX,CAAmBb,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,CAAE,CAAC,
|
|
6
|
-
"names": ["TAP_LONG_TIME_MS", "tapLong", "touch", "deviceKey", "point", "delayMs", "r", "tapQuick", "sign", "reject", "navigateNext", "navigatePrevious", "mainButton", "secondaryButton", "enterMenu", "exitMenu", "enableBlindSigningSettings", "continueToBlindSigning", "acceptBlindSigning"]
|
|
4
|
+
"sourcesContent": ["import type { PercentCoordinates } from \"@internal/core/types\";\nimport { type TouchController } from \"@root/src/internal/core/TouchController\";\n\nconst TAP_LONG_TIME_MS = 5000;\n\nexport const tapLong =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (point: PercentCoordinates, delayMs: number = TAP_LONG_TIME_MS) => {\n await touch.tap(deviceKey, point);\n await new Promise((r) => setTimeout(r, delayMs));\n await touch.release(deviceKey, point);\n };\n\nexport const tapQuick =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (point: PercentCoordinates) =>\n await touch.tapAndRelease(deviceKey, point);\n\nexport const sign =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async (delayMs: number = TAP_LONG_TIME_MS) =>\n await tapLong(touch, deviceKey)({ x: 85, y: 80 }, delayMs);\n\nexport const reject =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 20, y: 90 });\n\nexport const navigateNext =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 90, y: 90 });\n\nexport const navigatePrevious =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 45, y: 90 });\n\nexport const mainButton =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 80 });\n\nexport const secondaryButton =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 90 });\n\nexport const enterMenu =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 85, y: 8 });\n\nexport const exitMenu =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 10, y: 4 });\n\nconst BLIND_SIGNING_TOGGLE_COORDS = {\n stax: { x: 88, y: 51 },\n flex: { x: 88, y: 58 },\n apex: { x: 88, y: 58 },\n} as const satisfies Record<string, PercentCoordinates>;\n\ntype BlindSigningTouchKey = keyof typeof BLIND_SIGNING_TOGGLE_COORDS;\n\nconst isBlindSigningTouchKey = (key: string): key is BlindSigningTouchKey =>\n Object.hasOwn(BLIND_SIGNING_TOGGLE_COORDS, key);\n\nconst DEFAULT_BLIND_SIGNING_TOGGLE_COORDS: PercentCoordinates = {\n x: 88,\n y: 51,\n};\n\nexport const enableBlindSigningSettings =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () => {\n const point = isBlindSigningTouchKey(deviceKey)\n ? BLIND_SIGNING_TOGGLE_COORDS[deviceKey]\n : DEFAULT_BLIND_SIGNING_TOGGLE_COORDS;\n await tapQuick(touch, deviceKey)(point);\n };\n\nexport const continueToBlindSigning =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 94 });\n\nexport const acceptBlindSigning =\n <K extends string>(touch: TouchController<K>, deviceKey: K) =>\n async () =>\n await tapQuick(touch, deviceKey)({ x: 50, y: 94 });\n"],
|
|
5
|
+
"mappings": "AAGA,MAAMA,EAAmB,IAEZC,EACX,CAAmBC,EAA2BC,IAC9C,MAAOC,EAA2BC,EAAkBL,IAAqB,CACvE,MAAME,EAAM,IAAIC,EAAWC,CAAK,EAChC,MAAM,IAAI,QAASE,GAAM,WAAWA,EAAGD,CAAO,CAAC,EAC/C,MAAMH,EAAM,QAAQC,EAAWC,CAAK,CACtC,EAEWG,EACX,CAAmBL,EAA2BC,IAC9C,MAAOC,GACL,MAAMF,EAAM,cAAcC,EAAWC,CAAK,EAEjCI,EACX,CAAmBN,EAA2BC,IAC9C,MAAOE,EAAkBL,IACvB,MAAMC,EAAQC,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,EAAGE,CAAO,EAEhDI,EACX,CAAmBP,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCO,EACX,CAAmBR,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCQ,EACX,CAAmBT,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCS,EACX,CAAmBV,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCU,EACX,CAAmBX,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCW,EACX,CAAmBZ,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,CAAE,CAAC,EAEvCY,EACX,CAAmBb,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,CAAE,CAAC,EAE9Ca,EAA8B,CAClC,KAAM,CAAE,EAAG,GAAI,EAAG,EAAG,EACrB,KAAM,CAAE,EAAG,GAAI,EAAG,EAAG,EACrB,KAAM,CAAE,EAAG,GAAI,EAAG,EAAG,CACvB,EAIMC,EAA0BC,GAC9B,OAAO,OAAOF,EAA6BE,CAAG,EAE1CC,EAA0D,CAC9D,EAAG,GACH,EAAG,EACL,EAEaC,EACX,CAAmBlB,EAA2BC,IAC9C,SAAY,CACV,MAAMC,EAAQa,EAAuBd,CAAS,EAC1Ca,EAA4Bb,CAAS,EACrCgB,EACJ,MAAMZ,EAASL,EAAOC,CAAS,EAAEC,CAAK,CACxC,EAEWiB,EACX,CAAmBnB,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC,EAExCmB,EACX,CAAmBpB,EAA2BC,IAC9C,SACE,MAAMI,EAASL,EAAOC,CAAS,EAAE,CAAE,EAAG,GAAI,EAAG,EAAG,CAAC",
|
|
6
|
+
"names": ["TAP_LONG_TIME_MS", "tapLong", "touch", "deviceKey", "point", "delayMs", "r", "tapQuick", "sign", "reject", "navigateNext", "navigatePrevious", "mainButton", "secondaryButton", "enterMenu", "exitMenu", "BLIND_SIGNING_TOGGLE_COORDS", "isBlindSigningTouchKey", "key", "DEFAULT_BLIND_SIGNING_TOGGLE_COORDS", "enableBlindSigningSettings", "continueToBlindSigning", "acceptBlindSigning"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{tapLong as l,tapQuick as
|
|
1
|
+
import{enableBlindSigningSettings as i,tapLong as l,tapQuick as p}from"./touchUseCases";describe("touchUsecases",()=>{const t="devA",n={x:50,y:30};let e;beforeEach(()=>{e={tap:vi.fn().mockResolvedValue(void 0),release:vi.fn().mockResolvedValue(void 0),tapAndRelease:vi.fn().mockResolvedValue(void 0)},vi.restoreAllMocks(),vi.useRealTimers()}),it("tapQuick calls tapAndRelease with the same deviceKey and point",async()=>{await p(e,t)(n),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(t,n),expect(e.tap).not.toHaveBeenCalled(),expect(e.release).not.toHaveBeenCalled()}),it("tapLong taps, waits default timeout, then releases",async()=>{vi.useFakeTimers();const a=vi.spyOn(globalThis,"setTimeout"),s=l(e,t)(n);await Promise.resolve(),expect(e.tap).toHaveBeenCalledTimes(1),expect(e.tap).toHaveBeenCalledWith(t,n),expect(a).toHaveBeenCalledTimes(1),expect(a).toHaveBeenLastCalledWith(expect.any(Function),5e3),expect(e.release).not.toHaveBeenCalled(),await vi.advanceTimersByTimeAsync(5e3),await s,expect(e.release).toHaveBeenCalledTimes(1),expect(e.release).toHaveBeenCalledWith(t,n)}),it("tapLong uses the provided delayMs value",async()=>{vi.useFakeTimers();const a=vi.spyOn(globalThis,"setTimeout"),o=1234,c=l(e,t)(n,o);await Promise.resolve(),expect(e.tap).toHaveBeenCalledTimes(1),expect(e.tap).toHaveBeenCalledWith(t,n),expect(a).toHaveBeenCalledTimes(1),expect(a).toHaveBeenLastCalledWith(expect.any(Function),o),expect(e.release).not.toHaveBeenCalled(),await vi.advanceTimersByTimeAsync(o),await c,expect(e.release).toHaveBeenCalledTimes(1),expect(e.release).toHaveBeenCalledWith(t,n)}),it("tapLong propagates error if tap() rejects (no release)",async()=>{vi.useFakeTimers();const a=new Error("tap failed");e.tap.mockRejectedValueOnce(a);const s=l(e,t)(n);await expect(s).rejects.toThrow("tap failed"),expect(e.release).not.toHaveBeenCalled()}),it("tapLong propagates error if release() rejects",async()=>{vi.useFakeTimers();const a=new Error("release failed");e.release.mockRejectedValueOnce(a);const o=l(e,t)(n),s=expect(o).rejects.toThrow("release failed");await Promise.resolve(),await vi.advanceTimersByTimeAsync(5e3),await s,expect(e.tap).toHaveBeenCalledTimes(1),expect(e.release).toHaveBeenCalledTimes(1)}),describe("enableBlindSigningSettings",()=>{it.each([["stax",{x:88,y:51}],["flex",{x:88,y:58}],["apex",{x:88,y:58}]])("taps the blind-signing toggle at the %s coordinates",async(a,o)=>{await i(e,a)(),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(a,o)}),it("falls back to default coordinates for an unknown device key",async()=>{const a="unknown";await i(e,a)(),expect(e.tapAndRelease).toHaveBeenCalledTimes(1),expect(e.tapAndRelease).toHaveBeenCalledWith(a,{x:88,y:51})})})});
|
|
2
2
|
//# sourceMappingURL=touchUseCases.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/internal/use-cases/touchUseCases.test.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport type { TouchController } from \"@root/src/internal/core/TouchController\";\n\nimport { tapLong, tapQuick } from \"./touchUseCases\";\n\ndescribe(\"touchUsecases\", () => {\n const deviceKey = \"devA\";\n const point = { x: 50, y: 30 } as any;\n\n let controller: TouchController;\n\n beforeEach(() => {\n controller = {\n tap: vi.fn().mockResolvedValue(undefined),\n release: vi.fn().mockResolvedValue(undefined),\n tapAndRelease: vi.fn().mockResolvedValue(undefined),\n } as unknown as TouchController;\n vi.restoreAllMocks();\n vi.useRealTimers();\n });\n\n it(\"tapQuick calls tapAndRelease with the same deviceKey and point\", async () => {\n const quick = tapQuick(controller, deviceKey);\n await quick(point);\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(deviceKey, point);\n expect(controller.tap).not.toHaveBeenCalled();\n expect(controller.release).not.toHaveBeenCalled();\n });\n\n it(\"tapLong taps, waits default timeout, then releases\", async () => {\n vi.useFakeTimers();\n const timeoutSpy = vi.spyOn(globalThis, \"setTimeout\");\n\n const longTap = tapLong(controller, deviceKey);\n const run = longTap(point);\n\n await Promise.resolve();\n\n expect(controller.tap).toHaveBeenCalledTimes(1);\n expect(controller.tap).toHaveBeenCalledWith(deviceKey, point);\n expect(timeoutSpy).toHaveBeenCalledTimes(1);\n expect(timeoutSpy).toHaveBeenLastCalledWith(expect.any(Function), 5000);\n expect(controller.release).not.toHaveBeenCalled();\n\n // let the 5s timer elapse\n await vi.advanceTimersByTimeAsync(5000);\n await run;\n\n expect(controller.release).toHaveBeenCalledTimes(1);\n expect(controller.release).toHaveBeenCalledWith(deviceKey, point);\n });\n\n it(\"tapLong uses the provided delayMs value\", async () => {\n vi.useFakeTimers();\n const timeoutSpy = vi.spyOn(globalThis, \"setTimeout\");\n\n const customMs = 1234;\n const longTap = tapLong(controller, deviceKey);\n const run = longTap(point, customMs);\n\n await Promise.resolve();\n\n expect(controller.tap).toHaveBeenCalledTimes(1);\n expect(controller.tap).toHaveBeenCalledWith(deviceKey, point);\n expect(timeoutSpy).toHaveBeenCalledTimes(1);\n expect(timeoutSpy).toHaveBeenLastCalledWith(expect.any(Function), customMs);\n expect(controller.release).not.toHaveBeenCalled();\n\n // advance exactly customMs and ensure release happens then\n await vi.advanceTimersByTimeAsync(customMs);\n await run;\n\n expect(controller.release).toHaveBeenCalledTimes(1);\n expect(controller.release).toHaveBeenCalledWith(deviceKey, point);\n });\n\n it(\"tapLong propagates error if tap() rejects (no release)\", async () => {\n vi.useFakeTimers();\n\n const boom = new Error(\"tap failed\");\n (controller.tap as any).mockRejectedValueOnce(boom);\n\n const longTap = tapLong(controller, deviceKey);\n const p = longTap(point);\n\n // attach rejection handler immediately\n await expect(p).rejects.toThrow(\"tap failed\");\n expect(controller.release).not.toHaveBeenCalled();\n });\n\n it(\"tapLong propagates error if release() rejects\", async () => {\n vi.useFakeTimers();\n\n const boom = new Error(\"release failed\");\n (controller.release as any).mockRejectedValueOnce(boom);\n\n const p = tapLong(controller, deviceKey)(point);\n\n const assertion = expect(p).rejects.toThrow(\"release failed\");\n\n await Promise.resolve();\n await vi.advanceTimersByTimeAsync(5000);\n\n await assertion;\n\n expect(controller.tap).toHaveBeenCalledTimes(1);\n expect(controller.release).toHaveBeenCalledTimes(1);\n });\n});\n"],
|
|
5
|
-
"mappings": "AAMA,OAAS,
|
|
6
|
-
"names": ["tapLong", "tapQuick", "deviceKey", "point", "controller", "timeoutSpy", "run", "customMs", "boom", "p", "assertion"]
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport type { TouchController } from \"@root/src/internal/core/TouchController\";\n\nimport { enableBlindSigningSettings, tapLong, tapQuick } from \"./touchUseCases\";\n\ndescribe(\"touchUsecases\", () => {\n const deviceKey = \"devA\";\n const point = { x: 50, y: 30 } as any;\n\n let controller: TouchController;\n\n beforeEach(() => {\n controller = {\n tap: vi.fn().mockResolvedValue(undefined),\n release: vi.fn().mockResolvedValue(undefined),\n tapAndRelease: vi.fn().mockResolvedValue(undefined),\n } as unknown as TouchController;\n vi.restoreAllMocks();\n vi.useRealTimers();\n });\n\n it(\"tapQuick calls tapAndRelease with the same deviceKey and point\", async () => {\n const quick = tapQuick(controller, deviceKey);\n await quick(point);\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(deviceKey, point);\n expect(controller.tap).not.toHaveBeenCalled();\n expect(controller.release).not.toHaveBeenCalled();\n });\n\n it(\"tapLong taps, waits default timeout, then releases\", async () => {\n vi.useFakeTimers();\n const timeoutSpy = vi.spyOn(globalThis, \"setTimeout\");\n\n const longTap = tapLong(controller, deviceKey);\n const run = longTap(point);\n\n await Promise.resolve();\n\n expect(controller.tap).toHaveBeenCalledTimes(1);\n expect(controller.tap).toHaveBeenCalledWith(deviceKey, point);\n expect(timeoutSpy).toHaveBeenCalledTimes(1);\n expect(timeoutSpy).toHaveBeenLastCalledWith(expect.any(Function), 5000);\n expect(controller.release).not.toHaveBeenCalled();\n\n // let the 5s timer elapse\n await vi.advanceTimersByTimeAsync(5000);\n await run;\n\n expect(controller.release).toHaveBeenCalledTimes(1);\n expect(controller.release).toHaveBeenCalledWith(deviceKey, point);\n });\n\n it(\"tapLong uses the provided delayMs value\", async () => {\n vi.useFakeTimers();\n const timeoutSpy = vi.spyOn(globalThis, \"setTimeout\");\n\n const customMs = 1234;\n const longTap = tapLong(controller, deviceKey);\n const run = longTap(point, customMs);\n\n await Promise.resolve();\n\n expect(controller.tap).toHaveBeenCalledTimes(1);\n expect(controller.tap).toHaveBeenCalledWith(deviceKey, point);\n expect(timeoutSpy).toHaveBeenCalledTimes(1);\n expect(timeoutSpy).toHaveBeenLastCalledWith(expect.any(Function), customMs);\n expect(controller.release).not.toHaveBeenCalled();\n\n // advance exactly customMs and ensure release happens then\n await vi.advanceTimersByTimeAsync(customMs);\n await run;\n\n expect(controller.release).toHaveBeenCalledTimes(1);\n expect(controller.release).toHaveBeenCalledWith(deviceKey, point);\n });\n\n it(\"tapLong propagates error if tap() rejects (no release)\", async () => {\n vi.useFakeTimers();\n\n const boom = new Error(\"tap failed\");\n (controller.tap as any).mockRejectedValueOnce(boom);\n\n const longTap = tapLong(controller, deviceKey);\n const p = longTap(point);\n\n // attach rejection handler immediately\n await expect(p).rejects.toThrow(\"tap failed\");\n expect(controller.release).not.toHaveBeenCalled();\n });\n\n it(\"tapLong propagates error if release() rejects\", async () => {\n vi.useFakeTimers();\n\n const boom = new Error(\"release failed\");\n (controller.release as any).mockRejectedValueOnce(boom);\n\n const p = tapLong(controller, deviceKey)(point);\n\n const assertion = expect(p).rejects.toThrow(\"release failed\");\n\n await Promise.resolve();\n await vi.advanceTimersByTimeAsync(5000);\n\n await assertion;\n\n expect(controller.tap).toHaveBeenCalledTimes(1);\n expect(controller.release).toHaveBeenCalledTimes(1);\n });\n\n describe(\"enableBlindSigningSettings\", () => {\n it.each([\n [\"stax\", { x: 88, y: 51 }],\n [\"flex\", { x: 88, y: 58 }],\n [\"apex\", { x: 88, y: 58 }],\n ] as const)(\n \"taps the blind-signing toggle at the %s coordinates\",\n async (key, expected) => {\n await enableBlindSigningSettings(controller, key)();\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(key, expected);\n },\n );\n\n it(\"falls back to default coordinates for an unknown device key\", async () => {\n const unknownKey = \"unknown\";\n await enableBlindSigningSettings(controller, unknownKey)();\n\n expect(controller.tapAndRelease).toHaveBeenCalledTimes(1);\n expect(controller.tapAndRelease).toHaveBeenCalledWith(unknownKey, {\n x: 88,\n y: 51,\n });\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "AAMA,OAAS,8BAAAA,EAA4B,WAAAC,EAAS,YAAAC,MAAgB,kBAE9D,SAAS,gBAAiB,IAAM,CAC9B,MAAMC,EAAY,OACZC,EAAQ,CAAE,EAAG,GAAI,EAAG,EAAG,EAE7B,IAAIC,EAEJ,WAAW,IAAM,CACfA,EAAa,CACX,IAAK,GAAG,GAAG,EAAE,kBAAkB,MAAS,EACxC,QA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AAE,EAAG,GAAI,EAAG,EAAG,CAAC,CAC3B,CAAU,EACR,sDACA,MAAOO,EAAKC,IAAa,CACvB,MAAMb,EAA2BK,EAAYO,CAAG,EAAE,EAElD,OAAOP,EAAW,aAAa,EAAE,sBAAsB,CAAC,EACxD,OAAOA,EAAW,aAAa,EAAE,qBAAqBO,EAAKC,CAAQ,CACrE,CACF,EAEA,GAAG,8DAA+D,SAAY,CAC5E,MAAMC,EAAa,UACnB,MAAMd,EAA2BK,EAAYS,CAAU,EAAE,EAEzD,OAAOT,EAAW,aAAa,EAAE,sBAAsB,CAAC,EACxD,OAAOA,EAAW,aAAa,EAAE,qBAAqBS,EAAY,CAChE,EAAG,GACH,EAAG,EACL,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["enableBlindSigningSettings", "tapLong", "tapQuick", "deviceKey", "point", "controller", "timeoutSpy", "run", "customMs", "boom", "p", "assertion", "key", "expected", "unknownKey"]
|
|
7
7
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { AxiosInstance } from "axios";
|
|
2
1
|
import type { ButtonController } from "../core/ButtonController";
|
|
3
|
-
import { type ButtonKey } from "../core/types";
|
|
2
|
+
import { type ButtonKey, type HttpClient } from "../core/types";
|
|
4
3
|
export declare class DefaultButtonController implements ButtonController {
|
|
5
4
|
private readonly client;
|
|
6
|
-
constructor(client:
|
|
5
|
+
constructor(client: HttpClient);
|
|
7
6
|
press(key: ButtonKey): Promise<void>;
|
|
8
7
|
}
|
|
9
8
|
//# sourceMappingURL=DefaultButtonController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultButtonController.d.ts","sourceRoot":"","sources":["../../../../../src/internal/adapters/DefaultButtonController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"DefaultButtonController.d.ts","sourceRoot":"","sources":["../../../../../src/internal/adapters/DefaultButtonController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EACL,KAAK,SAAS,EACd,KAAK,UAAU,EAEhB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,uBAAwB,YAAW,gBAAgB;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEzC,KAAK,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAK3C"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type PercentCoordinates } from "../core/types";
|
|
1
|
+
import { type HttpClient, type PercentCoordinates } from "../core/types";
|
|
3
2
|
import type { AxisMap } from "../utils/axisClamp";
|
|
4
3
|
import type { TouchController } from "../../../src/internal/core/TouchController";
|
|
5
4
|
export declare class DefaultTouchController<K extends string> implements TouchController<K> {
|
|
6
5
|
private readonly client;
|
|
7
6
|
private readonly axes;
|
|
8
|
-
constructor(client:
|
|
7
|
+
constructor(client: HttpClient, axes: AxisMap<K>);
|
|
9
8
|
private assertPercentPoint;
|
|
10
9
|
private toAbs;
|
|
11
10
|
tapAndRelease(deviceKey: K, point: PercentCoordinates): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultTouchController.d.ts","sourceRoot":"","sources":["../../../../../src/internal/adapters/DefaultTouchController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"DefaultTouchController.d.ts","sourceRoot":"","sources":["../../../../../src/internal/adapters/DefaultTouchController.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,kBAAkB,EAExB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE/E,qBAAa,sBAAsB,CAAC,CAAC,SAAS,MAAM,CAClD,YAAW,eAAe,CAAC,CAAC,CAAC;IAG3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAGnC,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,KAAK;IAYP,aAAa,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQrE,GAAG,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3D,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAOtE"}
|
|
@@ -15,6 +15,9 @@ export type DeviceControllerOptions<K extends string = string> = {
|
|
|
15
15
|
timeoutMs?: number;
|
|
16
16
|
clientHeader?: string;
|
|
17
17
|
};
|
|
18
|
+
export interface HttpClient {
|
|
19
|
+
post(url: string, data?: unknown): Promise<unknown>;
|
|
20
|
+
}
|
|
18
21
|
export declare enum SpeculosActions {
|
|
19
22
|
PRESS = "press",
|
|
20
23
|
RELEASE = "release",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/internal/core/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAErE,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAC7D,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CACtB,C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Q,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC9E,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAEjC,MAAM,MAAM,kBAAkB,GAAG;IAAE,CAAC,EAAE,OAAO,CAAC;IAAC,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE5D,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IAC/D,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACrD;AAED,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,iBAAiB,sBAAsB;CACxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"di.d.ts","sourceRoot":"","sources":["../../../../src/internal/di.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"di.d.ts","sourceRoot":"","sources":["../../../../src/internal/di.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,uBAAuB,EAAc,MAAM,sBAAsB,CAAC;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE/E,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,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