runcloud 0.2.143 → 0.2.144

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.
@@ -1247,7 +1247,27 @@ function registerSimulatorCommands(program, platform) {
1247
1247
  const asset = await pushAsset(path, { contentType, orgId: opts.orgId });
1248
1248
  const api = client();
1249
1249
  try {
1250
- const result = await api.post(`/run-cloud/${platform}/${encodeURIComponent(id)}/gallery`, { assetId: asset.id });
1250
+ const path = `/run-cloud/${platform}/${encodeURIComponent(id)}/gallery`;
1251
+ let result = await api.post(path, { assetId: asset.id, async: true });
1252
+ if (typeof result.operationId === 'string') {
1253
+ const operationId = result.operationId;
1254
+ if (!/^[a-zA-Z0-9-]{1,128}$/.test(operationId))
1255
+ throw new Error('Invalid gallery operation receipt');
1256
+ const signal = AbortSignal.timeout(11 * 60_000);
1257
+ while (result.status === 'pending') {
1258
+ await new Promise(resolve => setTimeout(resolve, 1000));
1259
+ result = await api.get(`${path}/${encodeURIComponent(operationId)}`, { signal });
1260
+ if (result.operationId !== operationId)
1261
+ throw new Error('Gallery operation identity changed');
1262
+ }
1263
+ if (result.status !== 'completed' || result.ok !== true || !result.result) {
1264
+ throw new Error('Could not import the file into the device gallery');
1265
+ }
1266
+ result = { ...result.result, asset };
1267
+ }
1268
+ if (result.ok !== true || result.byteSize !== blob.size || result.contentType !== contentType) {
1269
+ throw new Error('The device did not confirm the gallery import');
1270
+ }
1251
1271
  if (opts.json)
1252
1272
  console.log(JSON.stringify(result, null, 2));
1253
1273
  else
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '0.2.143';
1
+ export const CLI_VERSION = '0.2.144';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.2.143",
3
+ "version": "0.2.144",
4
4
  "description": "Create and control run.cloud remote mobile simulators and cloud sandboxes",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
Binary file
Binary file