@swmansion/argent 0.25.1-next.33 → 0.25.1-next.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-cmds.mjs +1 -1
- package/dist/installer.mjs +1 -1
- package/dist/tool-server.cjs +58 -35
- package/package.json +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -21857,7 +21857,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
21857
21857
|
var SESSION_ID2 = randomUUID5();
|
|
21858
21858
|
function readCliVersion() {
|
|
21859
21859
|
if (true) {
|
|
21860
|
-
return "0.25.1-next.
|
|
21860
|
+
return "0.25.1-next.34";
|
|
21861
21861
|
}
|
|
21862
21862
|
return "0.0.0";
|
|
21863
21863
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -16710,7 +16710,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
16710
16710
|
var SESSION_ID = randomUUID4();
|
|
16711
16711
|
function readCliVersion() {
|
|
16712
16712
|
if (true) {
|
|
16713
|
-
return "0.25.1-next.
|
|
16713
|
+
return "0.25.1-next.34";
|
|
16714
16714
|
}
|
|
16715
16715
|
return "0.0.0";
|
|
16716
16716
|
}
|
package/dist/tool-server.cjs
CHANGED
|
@@ -94704,7 +94704,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
94704
94704
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
94705
94705
|
function readCliVersion() {
|
|
94706
94706
|
if (true) {
|
|
94707
|
-
return "0.25.1-next.
|
|
94707
|
+
return "0.25.1-next.34";
|
|
94708
94708
|
}
|
|
94709
94709
|
return "0.0.0";
|
|
94710
94710
|
}
|
|
@@ -107264,6 +107264,7 @@ async function openMoqClient(udid) {
|
|
|
107264
107264
|
async function openMoqClientFromInfo(info) {
|
|
107265
107265
|
await installNodeWebTransport();
|
|
107266
107266
|
const session = new MoqDeviceSession(await connectMoq(info), { publishPath: PUBLISH_PATH });
|
|
107267
|
+
disposeWhenTransportDies(session);
|
|
107267
107268
|
return {
|
|
107268
107269
|
sendControl: (payload) => session.sendControl(payload),
|
|
107269
107270
|
async screenshot(opts) {
|
|
@@ -107274,6 +107275,15 @@ async function openMoqClientFromInfo(info) {
|
|
|
107274
107275
|
}
|
|
107275
107276
|
};
|
|
107276
107277
|
}
|
|
107278
|
+
function disposeWhenTransportDies(session) {
|
|
107279
|
+
const dispose = () => {
|
|
107280
|
+
try {
|
|
107281
|
+
session.close();
|
|
107282
|
+
} catch {
|
|
107283
|
+
}
|
|
107284
|
+
};
|
|
107285
|
+
void session.closed.then(dispose, dispose);
|
|
107286
|
+
}
|
|
107277
107287
|
|
|
107278
107288
|
// ../tool-server/src/utils/simulator-client.ts
|
|
107279
107289
|
init_wrapper();
|
|
@@ -107342,17 +107352,26 @@ function failAllPending(conn, makeError) {
|
|
|
107342
107352
|
conn.pending.clear();
|
|
107343
107353
|
for (const entry of entries) entry.settle(makeError(entry.cmd));
|
|
107344
107354
|
}
|
|
107355
|
+
var COMMAND_TRANSPORT_FAILURE = {
|
|
107356
|
+
error_code: FAILURE_CODES.SIMULATOR_COMMAND_TRANSPORT_FAILED,
|
|
107357
|
+
failure_stage: "simulator_command_transport",
|
|
107358
|
+
failure_area: "tool_server",
|
|
107359
|
+
error_kind: "network",
|
|
107360
|
+
network_failure: "connection_reset",
|
|
107361
|
+
failure_command: "simulator_server"
|
|
107362
|
+
};
|
|
107345
107363
|
function transportError(cmd, apiUrl, detail) {
|
|
107346
107364
|
return new FailureError(
|
|
107347
107365
|
`simulator-server did not accept the '${cmd}' command: ${detail}. The command was NOT delivered to the device. Check that the simulator is still booted and the simulator-server for ${apiUrl} is running.`,
|
|
107348
|
-
|
|
107349
|
-
|
|
107350
|
-
|
|
107351
|
-
|
|
107352
|
-
|
|
107353
|
-
|
|
107354
|
-
|
|
107355
|
-
|
|
107366
|
+
COMMAND_TRANSPORT_FAILURE
|
|
107367
|
+
);
|
|
107368
|
+
}
|
|
107369
|
+
function remoteTransportError(cmd, cause) {
|
|
107370
|
+
const detail = cause instanceof Error ? cause.message : String(cause);
|
|
107371
|
+
return wrapFailure(
|
|
107372
|
+
cause,
|
|
107373
|
+
COMMAND_TRANSPORT_FAILURE,
|
|
107374
|
+
`The remote simulator did not accept the '${cmd}' command: ${detail}. The command was NOT delivered to the device. Call stop-simulator-server for this device and retry - the next call opens a new cloud session. If the machine itself was released, acquire one again before retrying.`
|
|
107356
107375
|
);
|
|
107357
107376
|
}
|
|
107358
107377
|
function getOrCreateConnection(api) {
|
|
@@ -107408,13 +107427,10 @@ function getOrCreateConnection(api) {
|
|
|
107408
107427
|
return conn;
|
|
107409
107428
|
}
|
|
107410
107429
|
function sendCommand(api, cmd) {
|
|
107411
|
-
|
|
107412
|
-
|
|
107413
|
-
return Promise.resolve();
|
|
107414
|
-
}
|
|
107430
|
+
const cmdName = typeof cmd.cmd === "string" ? cmd.cmd : "unknown";
|
|
107431
|
+
if (api.transport) return sendViaTransport(api.transport, cmd, cmdName);
|
|
107415
107432
|
const conn = getOrCreateConnection(api);
|
|
107416
107433
|
const id = String(++cmdId);
|
|
107417
|
-
const cmdName = typeof cmd.cmd === "string" ? cmd.cmd : "unknown";
|
|
107418
107434
|
const payload = JSON.stringify({ id, ...cmd });
|
|
107419
107435
|
return new Promise((resolve14, reject) => {
|
|
107420
107436
|
let done = false;
|
|
@@ -107616,32 +107632,36 @@ async function httpScreenshot(api, rotation, signal, scale) {
|
|
|
107616
107632
|
);
|
|
107617
107633
|
}
|
|
107618
107634
|
}
|
|
107635
|
+
async function sendViaTransport(transport, cmd, cmdName) {
|
|
107636
|
+
const sent = routeViaTransport(transport, cmd);
|
|
107637
|
+
try {
|
|
107638
|
+
await sent;
|
|
107639
|
+
} catch (cause) {
|
|
107640
|
+
throw remoteTransportError(cmdName, cause);
|
|
107641
|
+
}
|
|
107642
|
+
}
|
|
107619
107643
|
function routeViaTransport(transport, cmd) {
|
|
107620
107644
|
switch (cmd.cmd) {
|
|
107621
107645
|
case "touch": {
|
|
107622
107646
|
const sx = cmd.second_x ?? cmd.secondX;
|
|
107623
107647
|
const sy = cmd.second_y ?? cmd.secondY;
|
|
107624
|
-
transport.touch({
|
|
107648
|
+
return transport.touch({
|
|
107625
107649
|
type: cmd.type,
|
|
107626
107650
|
x: cmd.x,
|
|
107627
107651
|
y: cmd.y,
|
|
107628
107652
|
secondX: sx == null ? void 0 : sx,
|
|
107629
107653
|
secondY: sy == null ? void 0 : sy
|
|
107630
107654
|
});
|
|
107631
|
-
return;
|
|
107632
107655
|
}
|
|
107633
107656
|
case "button":
|
|
107634
|
-
transport.button({
|
|
107657
|
+
return transport.button({
|
|
107635
107658
|
direction: cmd.direction,
|
|
107636
107659
|
button: cmd.button
|
|
107637
107660
|
});
|
|
107638
|
-
return;
|
|
107639
107661
|
case "rotate":
|
|
107640
|
-
transport.rotate(cmd.direction);
|
|
107641
|
-
return;
|
|
107662
|
+
return transport.rotate(cmd.direction);
|
|
107642
107663
|
case "key":
|
|
107643
|
-
transport.pressKey(cmd.direction, cmd.code);
|
|
107644
|
-
return;
|
|
107664
|
+
return transport.pressKey(cmd.direction, cmd.code);
|
|
107645
107665
|
default:
|
|
107646
107666
|
throw new Error(`MoQ transport does not implement sendCommand cmd '${String(cmd.cmd)}'`);
|
|
107647
107667
|
}
|
|
@@ -107655,8 +107675,8 @@ function createMoqTransport(moq, options) {
|
|
|
107655
107675
|
return { url: (0, import_node_url.pathToFileURL)(file2).toString(), path: file2 };
|
|
107656
107676
|
};
|
|
107657
107677
|
return {
|
|
107658
|
-
touch(opts) {
|
|
107659
|
-
|
|
107678
|
+
async touch(opts) {
|
|
107679
|
+
await moq.sendControl(
|
|
107660
107680
|
encodeTouch({
|
|
107661
107681
|
action: opts.type,
|
|
107662
107682
|
x: opts.x,
|
|
@@ -107666,17 +107686,17 @@ function createMoqTransport(moq, options) {
|
|
|
107666
107686
|
})
|
|
107667
107687
|
);
|
|
107668
107688
|
},
|
|
107669
|
-
button(opts) {
|
|
107670
|
-
|
|
107689
|
+
async button(opts) {
|
|
107690
|
+
await moq.sendControl(encodeButton({ action: opts.direction, button: opts.button }));
|
|
107671
107691
|
},
|
|
107672
|
-
rotate(direction) {
|
|
107673
|
-
|
|
107692
|
+
async rotate(direction) {
|
|
107693
|
+
await moq.sendControl(encodeRotate(direction));
|
|
107674
107694
|
},
|
|
107675
107695
|
async paste(text) {
|
|
107676
107696
|
await options.pasteText(text);
|
|
107677
107697
|
},
|
|
107678
|
-
pressKey(direction, keyCode) {
|
|
107679
|
-
|
|
107698
|
+
async pressKey(direction, keyCode) {
|
|
107699
|
+
await moq.sendControl(encodeKey({ action: direction, code: keyCode }));
|
|
107680
107700
|
},
|
|
107681
107701
|
async screenshot(opts) {
|
|
107682
107702
|
const scale = opts?.scale ?? getScreenshotScale();
|
|
@@ -107709,17 +107729,20 @@ async function buildRemoteInstance(device) {
|
|
|
107709
107729
|
await simctlPbcopy(device.id, text);
|
|
107710
107730
|
const CMD = 227;
|
|
107711
107731
|
const V = 25;
|
|
107712
|
-
await
|
|
107713
|
-
await
|
|
107714
|
-
await
|
|
107715
|
-
await
|
|
107732
|
+
await api.pressKey("Down", CMD);
|
|
107733
|
+
await api.pressKey("Down", V);
|
|
107734
|
+
await api.pressKey("Up", V);
|
|
107735
|
+
await api.pressKey("Up", CMD);
|
|
107716
107736
|
}
|
|
107717
107737
|
});
|
|
107718
107738
|
const stubUrl = `moq+remote://${device.id}`;
|
|
107719
107739
|
const api = {
|
|
107720
107740
|
apiUrl: stubUrl,
|
|
107721
107741
|
streamUrl: stubUrl,
|
|
107722
|
-
|
|
107742
|
+
// Through `sendCommand`, as the attached instance below does, so a key the
|
|
107743
|
+
// session refuses reports the same failure as a refused touch instead of a
|
|
107744
|
+
// bare SDK error the caller cannot classify.
|
|
107745
|
+
pressKey: (direction, keyCode) => sendCommand(api, { cmd: "key", code: keyCode, direction }),
|
|
107723
107746
|
transport
|
|
107724
107747
|
};
|
|
107725
107748
|
return {
|
package/package.json
CHANGED