@devicecloud.dev/dcd 3.7.9 → 3.7.12-beta.1

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.
@@ -1,27 +1,5 @@
1
1
  import { Command } from '@oclif/core';
2
2
  export declare const mimeTypeLookupByExtension: Record<string, string>;
3
- export declare enum EiOSDevices {
4
- 'ipad-pro-6th-gen' = "ipad-pro-6th-gen",
5
- 'iphone-14' = "iphone-14",
6
- 'iphone-14-plus' = "iphone-14-plus",
7
- 'iphone-14-pro' = "iphone-14-pro",
8
- 'iphone-14-pro-max' = "iphone-14-pro-max",
9
- 'iphone-15' = "iphone-15",
10
- 'iphone-15-plus' = "iphone-15-plus",
11
- 'iphone-15-pro' = "iphone-15-pro",
12
- 'iphone-15-pro-max' = "iphone-15-pro-max",
13
- 'iphone-16' = "iphone-16",
14
- 'iphone-16-plus' = "iphone-16-plus",
15
- 'iphone-16-pro' = "iphone-16-pro",
16
- 'iphone-16-pro-max' = "iphone-16-pro-max"
17
- }
18
- export declare enum EAndroidDevices {
19
- 'generic-tablet' = "generic-tablet",
20
- 'pixel-6' = "pixel-6",
21
- 'pixel-6-pro' = "pixel-6-pro",
22
- 'pixel-7' = "pixel-7",
23
- 'pixel-7-pro' = "pixel-7-pro"
24
- }
25
3
  export default class Cloud extends Command {
26
4
  static args: {
27
5
  firstFile: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EAndroidDevices = exports.EiOSDevices = exports.mimeTypeLookupByExtension = void 0;
3
+ exports.mimeTypeLookupByExtension = void 0;
4
4
  /* eslint-disable complexity */
5
5
  const core_1 = require("@oclif/core");
6
6
  const cli_ux_1 = require("@oclif/core/lib/cli-ux");
@@ -10,6 +10,7 @@ const fs = require("node:fs");
10
10
  const os = require("os");
11
11
  const StreamZip = require("node-stream-zip");
12
12
  const constants_1 = require("../constants");
13
+ const compatibility_1 = require("../utils/compatibility");
13
14
  const methods_1 = require("../methods");
14
15
  const plan_1 = require("../plan");
15
16
  const ApiGateway_1 = require("../gateways/ApiGateway");
@@ -18,30 +19,6 @@ exports.mimeTypeLookupByExtension = {
18
19
  yaml: 'application/x-yaml',
19
20
  zip: 'application/zip',
20
21
  };
21
- var EiOSDevices;
22
- (function (EiOSDevices) {
23
- EiOSDevices["ipad-pro-6th-gen"] = "ipad-pro-6th-gen";
24
- EiOSDevices["iphone-14"] = "iphone-14";
25
- EiOSDevices["iphone-14-plus"] = "iphone-14-plus";
26
- EiOSDevices["iphone-14-pro"] = "iphone-14-pro";
27
- EiOSDevices["iphone-14-pro-max"] = "iphone-14-pro-max";
28
- EiOSDevices["iphone-15"] = "iphone-15";
29
- EiOSDevices["iphone-15-plus"] = "iphone-15-plus";
30
- EiOSDevices["iphone-15-pro"] = "iphone-15-pro";
31
- EiOSDevices["iphone-15-pro-max"] = "iphone-15-pro-max";
32
- EiOSDevices["iphone-16"] = "iphone-16";
33
- EiOSDevices["iphone-16-plus"] = "iphone-16-plus";
34
- EiOSDevices["iphone-16-pro"] = "iphone-16-pro";
35
- EiOSDevices["iphone-16-pro-max"] = "iphone-16-pro-max";
36
- })(EiOSDevices || (exports.EiOSDevices = EiOSDevices = {}));
37
- var EAndroidDevices;
38
- (function (EAndroidDevices) {
39
- EAndroidDevices["generic-tablet"] = "generic-tablet";
40
- EAndroidDevices["pixel-6"] = "pixel-6";
41
- EAndroidDevices["pixel-6-pro"] = "pixel-6-pro";
42
- EAndroidDevices["pixel-7"] = "pixel-7";
43
- EAndroidDevices["pixel-7-pro"] = "pixel-7-pro";
44
- })(EAndroidDevices || (exports.EAndroidDevices = EAndroidDevices = {}));
45
22
  // Suppress punycode deprecation warning (caused by whatwg, supabase dependancy)
46
23
  process.removeAllListeners('warning');
47
24
  process.on('warning', (warning) => {
@@ -224,6 +201,21 @@ class Cloud extends core_1.Command {
224
201
  const apiKey = apiKeyFlag || process.env.DEVICE_CLOUD_API_KEY;
225
202
  if (!apiKey)
226
203
  throw new Error('You must provide an API key via --api-key flag or DEVICE_CLOUD_API_KEY environment variable');
204
+ // Fetch compatibility data from API
205
+ let compatibilityData;
206
+ try {
207
+ compatibilityData = await (0, compatibility_1.fetchCompatibilityData)(apiUrl, apiKey);
208
+ if (debug) {
209
+ this.log('DEBUG: Successfully fetched compatibility data from API');
210
+ }
211
+ }
212
+ catch (error) {
213
+ const errorMessage = error instanceof Error ? error.message : String(error);
214
+ if (debug) {
215
+ this.log(`DEBUG: Failed to fetch compatibility data from API: ${errorMessage}`);
216
+ }
217
+ throw new Error(`Failed to fetch device compatibility data: ${errorMessage}. Please check your API key and connection.`);
218
+ }
227
219
  if (debug) {
228
220
  this.log(`DEBUG: API URL: ${apiUrl}`);
229
221
  this.log(`DEBUG: API Key provided: ${apiKey ? 'Yes' : 'No'}`);
@@ -266,8 +258,11 @@ class Cloud extends core_1.Command {
266
258
  }
267
259
  if (iOSVersion || iOSDevice) {
268
260
  const iOSDeviceID = iOSDevice || 'iphone-14';
269
- const supportediOSVersions = constants_1.iOSCompatibilityLookup[iOSDeviceID];
261
+ const supportediOSVersions = compatibilityData.ios[iOSDeviceID] || [];
270
262
  const version = iOSVersion || '17';
263
+ if (supportediOSVersions.length === 0) {
264
+ throw new Error(`Device ${iOSDeviceID} is not supported. Please check the docs for supported devices: https://docs.devicecloud.dev/getting-started/devices-configuration`);
265
+ }
271
266
  if (!supportediOSVersions.includes(version)) {
272
267
  throw new Error(`${iOSDeviceID} only supports these iOS versions: ${supportediOSVersions.join(', ')}`);
273
268
  }
@@ -280,9 +275,9 @@ class Cloud extends core_1.Command {
280
275
  if (androidApiLevel || androidDevice) {
281
276
  const androidDeviceID = androidDevice || 'pixel-7';
282
277
  const lookup = googlePlay
283
- ? constants_1.AndroidCompatibilityLookupPlay
284
- : constants_1.AndroidCompatibilityLookup;
285
- const supportedAndroidVersions = lookup[androidDeviceID];
278
+ ? compatibilityData.androidPlay
279
+ : compatibilityData.android;
280
+ const supportedAndroidVersions = lookup[androidDeviceID] || [];
286
281
  const version = androidApiLevel || '34';
287
282
  if (supportedAndroidVersions.length === 0) {
288
283
  throw new Error(`We don't support that device configuration - please check the docs for supported devices: https://docs.devicecloud.dev/getting-started/devices-configuration`);
@@ -1,4 +1,3 @@
1
- import { EAndroidDevices, EiOSDevices } from './commands/cloud';
2
1
  export declare const flags: {
3
2
  'additional-app-binary-ids': import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
4
3
  'additional-app-files': import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
@@ -40,12 +39,3 @@ export declare const flags: {
40
39
  'moropo-v1-api-key': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
41
40
  'dry-run': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
42
41
  };
43
- export declare const iOSCompatibilityLookup: {
44
- [k in EiOSDevices]: string[];
45
- };
46
- export declare const AndroidCompatibilityLookup: {
47
- [k in EAndroidDevices]: string[];
48
- };
49
- export declare const AndroidCompatibilityLookupPlay: {
50
- [k in EAndroidDevices]: string[];
51
- };
package/dist/constants.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AndroidCompatibilityLookupPlay = exports.AndroidCompatibilityLookup = exports.iOSCompatibilityLookup = exports.flags = void 0;
3
+ exports.flags = void 0;
4
4
  const core_1 = require("@oclif/core");
5
+ const device_types_1 = require("./types/device.types");
5
6
  exports.flags = {
6
7
  'additional-app-binary-ids': core_1.Flags.string({
7
8
  default: [],
@@ -19,17 +20,11 @@ exports.flags = {
19
20
  }),
20
21
  'android-api-level': core_1.Flags.string({
21
22
  description: '[Android only] Android API level to run your flow against',
22
- options: ['29', '30', '31', '32', '33', '34', '35'],
23
+ options: Object.values(device_types_1.EAndroidApiLevels),
23
24
  }),
24
25
  'android-device': core_1.Flags.string({
25
26
  description: '[Android only] Android device to run your flow against',
26
- options: [
27
- 'pixel-6',
28
- 'pixel-6-pro',
29
- 'pixel-7',
30
- 'pixel-7-pro',
31
- 'generic-tablet',
32
- ],
27
+ options: Object.values(device_types_1.EAndroidDevices),
33
28
  }),
34
29
  'skip-chrome-onboarding': core_1.Flags.boolean({
35
30
  description: '[Android only] Skip Chrome browser onboarding screens when running tests',
@@ -120,26 +115,11 @@ exports.flags = {
120
115
  }),
121
116
  'ios-device': core_1.Flags.string({
122
117
  description: '[iOS only] iOS device to run your flow against',
123
- options: [
124
- 'iphone-13',
125
- 'iphone-14',
126
- 'iphone-14-plus',
127
- 'iphone-14-pro',
128
- 'iphone-14-pro-max',
129
- 'iphone-15',
130
- 'iphone-15-plus',
131
- 'iphone-15-pro',
132
- 'iphone-15-pro-max',
133
- 'iphone-16',
134
- 'iphone-16-plus',
135
- 'iphone-16-pro',
136
- 'iphone-16-pro-max',
137
- 'ipad-pro-6th-gen',
138
- ],
118
+ options: Object.values(device_types_1.EiOSDevices),
139
119
  }),
140
120
  'ios-version': core_1.Flags.string({
141
121
  description: '[iOS only] iOS version to run your flow against',
142
- options: ['16', '17', '18'],
122
+ options: Object.values(device_types_1.EiOSVersions),
143
123
  }),
144
124
  'x86-arch': core_1.Flags.boolean({
145
125
  description: '[iOS only, experimental] Run your flow against x86 architecture simulator instead of arm64',
@@ -212,32 +192,3 @@ exports.flags = {
212
192
  default: false,
213
193
  }),
214
194
  };
215
- exports.iOSCompatibilityLookup = {
216
- 'ipad-pro-6th-gen': ['16', '17', '18'],
217
- 'iphone-14': ['16', '17', '18'],
218
- 'iphone-14-plus': ['16', '17', '18'],
219
- 'iphone-14-pro': ['16', '17', '18'],
220
- 'iphone-14-pro-max': ['16', '17', '18'],
221
- 'iphone-15': ['17', '18'],
222
- 'iphone-15-plus': ['17', '18'],
223
- 'iphone-15-pro': ['17', '18'],
224
- 'iphone-15-pro-max': ['17', '18'],
225
- 'iphone-16': ['18'],
226
- 'iphone-16-plus': ['18'],
227
- 'iphone-16-pro': ['18'],
228
- 'iphone-16-pro-max': ['18'],
229
- };
230
- exports.AndroidCompatibilityLookup = {
231
- 'generic-tablet': ['33', '34', '35'],
232
- 'pixel-6': ['29', '30', '31', '32', '33', '34', '35'],
233
- 'pixel-6-pro': ['33', '34', '35'],
234
- 'pixel-7': ['33', '34', '35'],
235
- 'pixel-7-pro': ['33', '34', '35'],
236
- };
237
- exports.AndroidCompatibilityLookupPlay = {
238
- 'generic-tablet': [],
239
- 'pixel-6': ['34', '35'],
240
- 'pixel-6-pro': [],
241
- 'pixel-7': ['34', '35'],
242
- 'pixel-7-pro': [],
243
- };
@@ -1,11 +1,11 @@
1
1
  export declare class SupabaseGateway {
2
2
  private static SB;
3
- static getSupabaseKeys(env: 'prod' | 'dev'): {
3
+ static getSupabaseKeys(env: 'dev' | 'prod'): {
4
4
  SUPABASE_PUBLIC_KEY: string;
5
5
  SUPABASE_URL: string;
6
6
  } | {
7
7
  SUPABASE_PUBLIC_KEY: string;
8
8
  SUPABASE_URL: string;
9
9
  };
10
- static uploadToSignedUrl(env: 'prod' | 'dev', path: string, token: string, file: File): Promise<void>;
10
+ static uploadToSignedUrl(env: 'dev' | 'prod', path: string, token: string, file: File): Promise<void>;
11
11
  }
@@ -10,7 +10,7 @@ class SupabaseGateway {
10
10
  },
11
11
  prod: {
12
12
  SUPABASE_PUBLIC_KEY: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBneWRucGhiaW1ldGluc2dma2JvIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDc1OTQzNDYsImV4cCI6MjAyMzE3MDM0Nn0.hAYOMFxxwX1exkQkY9xyQJGC_GhGnyogkj2N-kBkMI8',
13
- SUPABASE_URL: 'https://pgydnphbimetinsgfkbo.supabase.co',
13
+ SUPABASE_URL: 'https://cloud.devicecloud.dev',
14
14
  },
15
15
  };
16
16
  static getSupabaseKeys(env) {
@@ -22,8 +22,11 @@ class SupabaseGateway {
22
22
  const uploadToUrl = await supabase.storage
23
23
  .from('organizations')
24
24
  .uploadToSignedUrl(path, token, file);
25
- if (uploadToUrl.error)
26
- throw new Error(uploadToUrl.error);
25
+ if (uploadToUrl.error) {
26
+ const error = uploadToUrl.error;
27
+ const errorMessage = typeof error === 'string' ? error : error?.message || 'Upload failed';
28
+ throw new Error(errorMessage);
29
+ }
27
30
  }
28
31
  }
29
32
  exports.SupabaseGateway = SupabaseGateway;
package/dist/methods.js CHANGED
@@ -148,7 +148,7 @@ const uploadBinary = async (filePath, apiUrl, apiKey, ignoreShaCheck = false, lo
148
148
  file = new file_1.File([zippedAppBlob], filePath + '.zip');
149
149
  }
150
150
  else {
151
- const binaryBlob = new Blob([await (0, promises_1.readFile)(filePath)], {
151
+ const binaryBlob = new Blob([new Uint8Array(await (0, promises_1.readFile)(filePath))], {
152
152
  type: cloud_1.mimeTypeLookupByExtension[filePath.split('.').pop()],
153
153
  });
154
154
  file = new file_1.File([binaryBlob], filePath);
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Device type definitions - should be kept in sync with API
3
+ * @see /Users/riglar/repos/dcd/api/src/common/types/device.types.ts
4
+ */
5
+ export declare enum EiOSDevices {
6
+ 'ipad-pro-6th-gen' = "ipad-pro-6th-gen",
7
+ 'iphone-14' = "iphone-14",
8
+ 'iphone-14-pro' = "iphone-14-pro",
9
+ 'iphone-15' = "iphone-15",
10
+ 'iphone-15-pro' = "iphone-15-pro",
11
+ 'iphone-16' = "iphone-16",
12
+ 'iphone-16-plus' = "iphone-16-plus",
13
+ 'iphone-16-pro' = "iphone-16-pro",
14
+ 'iphone-16-pro-max' = "iphone-16-pro-max"
15
+ }
16
+ export declare enum EAndroidDevices {
17
+ 'generic-tablet' = "generic-tablet",
18
+ 'pixel-6' = "pixel-6",
19
+ 'pixel-6-pro' = "pixel-6-pro",
20
+ 'pixel-7' = "pixel-7",
21
+ 'pixel-7-pro' = "pixel-7-pro"
22
+ }
23
+ export declare enum EiOSVersions {
24
+ 'sixteen' = "16",
25
+ 'seventeen' = "17",
26
+ 'eighteen' = "18"
27
+ }
28
+ export declare enum EAndroidApiLevels {
29
+ 'twentyNine' = "29",
30
+ 'thirty' = "30",
31
+ 'thirtyOne' = "31",
32
+ 'thirtyTwo' = "32",
33
+ 'thirtyThree' = "33",
34
+ 'thirtyFour' = "34",
35
+ 'thirtyFive' = "35"
36
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /**
3
+ * Device type definitions - should be kept in sync with API
4
+ * @see /Users/riglar/repos/dcd/api/src/common/types/device.types.ts
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.EAndroidApiLevels = exports.EiOSVersions = exports.EAndroidDevices = exports.EiOSDevices = void 0;
8
+ var EiOSDevices;
9
+ (function (EiOSDevices) {
10
+ EiOSDevices["ipad-pro-6th-gen"] = "ipad-pro-6th-gen";
11
+ EiOSDevices["iphone-14"] = "iphone-14";
12
+ EiOSDevices["iphone-14-pro"] = "iphone-14-pro";
13
+ EiOSDevices["iphone-15"] = "iphone-15";
14
+ EiOSDevices["iphone-15-pro"] = "iphone-15-pro";
15
+ EiOSDevices["iphone-16"] = "iphone-16";
16
+ EiOSDevices["iphone-16-plus"] = "iphone-16-plus";
17
+ EiOSDevices["iphone-16-pro"] = "iphone-16-pro";
18
+ EiOSDevices["iphone-16-pro-max"] = "iphone-16-pro-max";
19
+ })(EiOSDevices || (exports.EiOSDevices = EiOSDevices = {}));
20
+ var EAndroidDevices;
21
+ (function (EAndroidDevices) {
22
+ EAndroidDevices["generic-tablet"] = "generic-tablet";
23
+ EAndroidDevices["pixel-6"] = "pixel-6";
24
+ EAndroidDevices["pixel-6-pro"] = "pixel-6-pro";
25
+ EAndroidDevices["pixel-7"] = "pixel-7";
26
+ EAndroidDevices["pixel-7-pro"] = "pixel-7-pro";
27
+ })(EAndroidDevices || (exports.EAndroidDevices = EAndroidDevices = {}));
28
+ var EiOSVersions;
29
+ (function (EiOSVersions) {
30
+ EiOSVersions["sixteen"] = "16";
31
+ EiOSVersions["seventeen"] = "17";
32
+ EiOSVersions["eighteen"] = "18";
33
+ })(EiOSVersions || (exports.EiOSVersions = EiOSVersions = {}));
34
+ var EAndroidApiLevels;
35
+ (function (EAndroidApiLevels) {
36
+ EAndroidApiLevels["twentyNine"] = "29";
37
+ EAndroidApiLevels["thirty"] = "30";
38
+ EAndroidApiLevels["thirtyOne"] = "31";
39
+ EAndroidApiLevels["thirtyTwo"] = "32";
40
+ EAndroidApiLevels["thirtyThree"] = "33";
41
+ EAndroidApiLevels["thirtyFour"] = "34";
42
+ EAndroidApiLevels["thirtyFive"] = "35";
43
+ })(EAndroidApiLevels || (exports.EAndroidApiLevels = EAndroidApiLevels = {}));
@@ -0,0 +1,7 @@
1
+ export interface CompatibilityData {
2
+ ios: Record<string, string[]>;
3
+ android: Record<string, string[]>;
4
+ androidPlay: Record<string, string[]>;
5
+ }
6
+ export declare function fetchCompatibilityData(apiUrl: string, apiKey: string): Promise<CompatibilityData>;
7
+ export declare function clearCompatibilityCache(): void;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchCompatibilityData = fetchCompatibilityData;
4
+ exports.clearCompatibilityCache = clearCompatibilityCache;
5
+ let cachedCompatibilityData = null;
6
+ async function fetchCompatibilityData(apiUrl, apiKey) {
7
+ if (cachedCompatibilityData) {
8
+ return cachedCompatibilityData;
9
+ }
10
+ try {
11
+ const response = await fetch(`${apiUrl}/results/compatibility/data`, {
12
+ method: 'GET',
13
+ headers: {
14
+ 'x-app-api-key': apiKey,
15
+ 'Content-Type': 'application/json',
16
+ },
17
+ });
18
+ if (!response.ok) {
19
+ throw new Error(`HTTP error! status: ${response.status}`);
20
+ }
21
+ const result = await response.json();
22
+ if (result.statusCode !== 200 || !result.data) {
23
+ throw new Error(result.message || 'Failed to fetch compatibility data');
24
+ }
25
+ cachedCompatibilityData = result.data;
26
+ return result.data;
27
+ }
28
+ catch (error) {
29
+ const errorMessage = error instanceof Error ? error.message : String(error);
30
+ throw new Error(`Failed to fetch compatibility data from API: ${errorMessage}`);
31
+ }
32
+ }
33
+ function clearCompatibilityCache() {
34
+ cachedCompatibilityData = null;
35
+ }
@@ -63,11 +63,11 @@
63
63
  "hasDynamicHelp": false,
64
64
  "multiple": false,
65
65
  "options": [
66
+ "generic-tablet",
66
67
  "pixel-6",
67
68
  "pixel-6-pro",
68
69
  "pixel-7",
69
- "pixel-7-pro",
70
- "generic-tablet"
70
+ "pixel-7-pro"
71
71
  ],
72
72
  "type": "option"
73
73
  },
@@ -239,20 +239,15 @@
239
239
  "hasDynamicHelp": false,
240
240
  "multiple": false,
241
241
  "options": [
242
- "iphone-13",
242
+ "ipad-pro-6th-gen",
243
243
  "iphone-14",
244
- "iphone-14-plus",
245
244
  "iphone-14-pro",
246
- "iphone-14-pro-max",
247
245
  "iphone-15",
248
- "iphone-15-plus",
249
246
  "iphone-15-pro",
250
- "iphone-15-pro-max",
251
247
  "iphone-16",
252
248
  "iphone-16-plus",
253
249
  "iphone-16-pro",
254
- "iphone-16-pro-max",
255
- "ipad-pro-6th-gen"
250
+ "iphone-16-pro-max"
256
251
  ],
257
252
  "type": "option"
258
253
  },
@@ -556,5 +551,5 @@
556
551
  ]
557
552
  }
558
553
  },
559
- "version": "3.7.9"
554
+ "version": "3.7.12-beta.1"
560
555
  }
package/package.json CHANGED
@@ -79,7 +79,7 @@
79
79
  "prepare": "yarn build",
80
80
  "version": "oclif readme && git add README.md"
81
81
  },
82
- "version": "3.7.9",
82
+ "version": "3.7.12-beta.1",
83
83
  "bugs": {
84
84
  "url": "https://discord.gg/gm3mJwcNw8"
85
85
  },