runcloud 0.2.143 → 0.2.145

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.
@@ -89,9 +89,9 @@ const SKIP_DIRS = new Set([
89
89
  'node_modules',
90
90
  'Pods',
91
91
  ]);
92
- export function evaluateCompliance(manifest, projectDir) {
92
+ export function evaluateCompliance(manifest, projectDir, options = {}) {
93
93
  const root = path.resolve(projectDir);
94
- const appJson = readJson(path.join(root, 'app.json'));
94
+ const appJson = asReleased(readJson(path.join(root, 'app.json')), options.iosBundleId);
95
95
  const targetPlatforms = targetPlatformsFromAppJson(appJson);
96
96
  const items = [];
97
97
  const unresolved = [];
@@ -146,8 +146,9 @@ function activeItems(manifest) {
146
146
  return manifest.items.filter((item) => !item.deferred && item.resolvedBy !== 'card');
147
147
  }
148
148
  function evaluateLocalItem(root, appJson, item) {
149
- if (CONFIG_RULES[item.id])
150
- return evaluateConfigItem(appJson, item, CONFIG_RULES[item.id]);
149
+ const rule = CONFIG_RULES[item.id];
150
+ if (rule)
151
+ return evaluateConfigItem(appJson, item, rule);
151
152
  switch (item.id) {
152
153
  case 'hardcoded_secrets':
153
154
  return patternItem(root, item, /sk-[A-Za-z0-9]{20,}|AIza[0-9A-Za-z_-]{30,}|-----BEGIN.*PRIVATE KEY|api[_-]?key\s*[:=]\s*['"][A-Za-z0-9]{16,}/i, 'fail', 'Hardcoded secret-like value found.', 'No secret-like values found.');
@@ -446,6 +447,14 @@ function routePath(root, file) {
446
447
  function evidence(matches) {
447
448
  return matches.slice(0, 5).map((match) => `${match.file}:${match.line}: ${match.text}`).join('\n');
448
449
  }
450
+ function asReleased(appJson, iosBundleId) {
451
+ const expo = getPath(appJson, ['expo']);
452
+ if (!iosBundleId || !expo || typeof expo !== 'object' || Array.isArray(expo))
453
+ return appJson;
454
+ const ios = getPath(expo, ['ios']);
455
+ const iosConfig = ios && typeof ios === 'object' && !Array.isArray(ios) ? ios : {};
456
+ return { ...appJson, expo: { ...expo, ios: { ...iosConfig, bundleIdentifier: iosBundleId } } };
457
+ }
449
458
  function readJson(file) {
450
459
  try {
451
460
  return JSON.parse(readFileSync(file, 'utf8'));
@@ -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.145';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.2.143",
3
+ "version": "0.2.145",
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