@devicecloud.dev/dcd 3.2.3 → 3.3.0
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/commands/status.d.ts +14 -0
- package/dist/commands/status.js +77 -0
- package/dist/constants.js +0 -5
- package/dist/methods.d.ts +7 -0
- package/dist/methods.js +20 -1
- package/oclif.manifest.json +75 -6
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Status extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
'upload-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
apiKey: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
apiUrl: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
private getStatusSymbol;
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const methods_1 = require("../methods");
|
|
6
|
+
class Status extends core_1.Command {
|
|
7
|
+
static description = 'Get the status of an upload by name or upload ID';
|
|
8
|
+
static examples = [
|
|
9
|
+
'<%= config.bin %> <%= command.id %> --name my-upload-name',
|
|
10
|
+
'<%= config.bin %> <%= command.id %> --upload-id 123e4567-e89b-12d3-a456-426614174000 --json',
|
|
11
|
+
];
|
|
12
|
+
static flags = {
|
|
13
|
+
json: core_1.Flags.boolean({
|
|
14
|
+
description: 'output in json format',
|
|
15
|
+
}),
|
|
16
|
+
name: core_1.Flags.string({
|
|
17
|
+
description: 'Name of the upload to check status for',
|
|
18
|
+
exclusive: ['upload-id'],
|
|
19
|
+
}),
|
|
20
|
+
'upload-id': core_1.Flags.string({
|
|
21
|
+
description: 'UUID of the upload to check status for',
|
|
22
|
+
exclusive: ['name'],
|
|
23
|
+
}),
|
|
24
|
+
apiKey: constants_1.flags.apiKey,
|
|
25
|
+
apiUrl: constants_1.flags.apiUrl,
|
|
26
|
+
};
|
|
27
|
+
getStatusSymbol(status) {
|
|
28
|
+
switch (status) {
|
|
29
|
+
case 'SUCCESS':
|
|
30
|
+
return '✓';
|
|
31
|
+
case 'FAILED':
|
|
32
|
+
return '✗';
|
|
33
|
+
case 'CANCELED':
|
|
34
|
+
return '⊘';
|
|
35
|
+
case 'PENDING':
|
|
36
|
+
return '⋯';
|
|
37
|
+
default:
|
|
38
|
+
return '?';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async run() {
|
|
42
|
+
const { flags } = await this.parse(Status);
|
|
43
|
+
const { apiUrl, apiKey, name, 'upload-id': uploadId } = flags;
|
|
44
|
+
if (!apiKey) {
|
|
45
|
+
this.error('API Key is required. Please provide it via --api-key flag or DEVICE_CLOUD_API_KEY environment variable.');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (!name && !uploadId) {
|
|
49
|
+
this.error('Either --name or --upload-id must be provided');
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
const status = await (0, methods_1.getUploadStatus)(apiUrl, apiKey, {
|
|
54
|
+
name,
|
|
55
|
+
uploadId,
|
|
56
|
+
});
|
|
57
|
+
if (flags.json) {
|
|
58
|
+
this.log(JSON.stringify(status, null, 2));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.log('\nUpload Status:');
|
|
62
|
+
this.log('─'.repeat(50));
|
|
63
|
+
status.forEach((item) => {
|
|
64
|
+
const symbol = this.getStatusSymbol(item.status);
|
|
65
|
+
this.log(`\n${symbol} Flow: ${item.name}`);
|
|
66
|
+
this.log(` Status: ${item.status}`);
|
|
67
|
+
this.log('─'.repeat(50));
|
|
68
|
+
});
|
|
69
|
+
this.log(''); // Add empty line at the end
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
this.error(`Failed to get status: ${error.message}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.default = Status;
|
package/dist/constants.js
CHANGED
package/dist/methods.d.ts
CHANGED
|
@@ -25,3 +25,10 @@ export declare const extractAppMetadataIos: (appFolderPath: string) => Promise<T
|
|
|
25
25
|
export declare const uploadBinary: (filePath: string, apiUrl: string, apiKey: string, ignoreShaCheck?: boolean) => Promise<string>;
|
|
26
26
|
export declare const uploadBinaries: (finalAppFiles: string[], apiUrl: string, apiKey: string, ignoreShaCheck?: boolean) => Promise<string[]>;
|
|
27
27
|
export declare const verifyAdditionalAppFiles: (appFiles: string[] | undefined) => Promise<void>;
|
|
28
|
+
export declare const getUploadStatus: (apiUrl: string, apiKey: string, options: {
|
|
29
|
+
uploadId?: string;
|
|
30
|
+
name?: string;
|
|
31
|
+
}) => Promise<{
|
|
32
|
+
name: string;
|
|
33
|
+
status: "SUCCESS" | "FAILED" | "CANCELED" | "PENDING";
|
|
34
|
+
}[]>;
|
package/dist/methods.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verifyAdditionalAppFiles = exports.uploadBinaries = exports.uploadBinary = exports.extractAppMetadataIos = exports.extractAppMetadataIosZip = exports.extractAppMetadataAndroid = exports.verifyAppZip = exports.compressFilesFromRelativePath = exports.compressFolderToBlob = exports.compressDir = exports.toBuffer = exports.typeSafeGet = exports.typeSafePostDownload = exports.typeSafePost = exports.versionCheck = void 0;
|
|
3
|
+
exports.getUploadStatus = exports.verifyAdditionalAppFiles = exports.uploadBinaries = exports.uploadBinary = exports.extractAppMetadataIos = exports.extractAppMetadataIosZip = exports.extractAppMetadataAndroid = exports.verifyAppZip = exports.compressFilesFromRelativePath = exports.compressFolderToBlob = exports.compressDir = exports.toBuffer = exports.typeSafeGet = exports.typeSafePostDownload = exports.typeSafePost = exports.versionCheck = void 0;
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const supabase_js_1 = require("@supabase/supabase-js");
|
|
6
6
|
// required polyfill for node 18
|
|
@@ -337,3 +337,22 @@ async function getFileHashFromFile(file) {
|
|
|
337
337
|
processChunks();
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
|
+
const getUploadStatus = async (apiUrl, apiKey, options) => {
|
|
341
|
+
const queryParams = new URLSearchParams();
|
|
342
|
+
if (options.uploadId) {
|
|
343
|
+
queryParams.append('uploadId', options.uploadId);
|
|
344
|
+
}
|
|
345
|
+
if (options.name) {
|
|
346
|
+
queryParams.append('name', options.name);
|
|
347
|
+
}
|
|
348
|
+
const response = await fetch(`${apiUrl}/uploads/status?${queryParams}`, {
|
|
349
|
+
headers: {
|
|
350
|
+
'x-app-api-key': apiKey,
|
|
351
|
+
},
|
|
352
|
+
});
|
|
353
|
+
if (!response.ok) {
|
|
354
|
+
throw new Error(`Failed to fetch status: ${response.statusText}`);
|
|
355
|
+
}
|
|
356
|
+
return response.json();
|
|
357
|
+
};
|
|
358
|
+
exports.getUploadStatus = getUploadStatus;
|
package/oclif.manifest.json
CHANGED
|
@@ -244,11 +244,6 @@
|
|
|
244
244
|
"multiple": false,
|
|
245
245
|
"options": [
|
|
246
246
|
"1.36.0",
|
|
247
|
-
"1.37.0",
|
|
248
|
-
"1.37.1",
|
|
249
|
-
"1.37.2",
|
|
250
|
-
"1.37.3",
|
|
251
|
-
"1.37.4",
|
|
252
247
|
"1.37.5",
|
|
253
248
|
"1.37.6",
|
|
254
249
|
"1.37.7",
|
|
@@ -327,7 +322,81 @@
|
|
|
327
322
|
"commands",
|
|
328
323
|
"cloud.js"
|
|
329
324
|
]
|
|
325
|
+
},
|
|
326
|
+
"status": {
|
|
327
|
+
"aliases": [],
|
|
328
|
+
"args": {},
|
|
329
|
+
"description": "Get the status of an upload by name or upload ID",
|
|
330
|
+
"examples": [
|
|
331
|
+
"<%= config.bin %> <%= command.id %> --name my-upload-name",
|
|
332
|
+
"<%= config.bin %> <%= command.id %> --upload-id 123e4567-e89b-12d3-a456-426614174000 --json"
|
|
333
|
+
],
|
|
334
|
+
"flags": {
|
|
335
|
+
"json": {
|
|
336
|
+
"description": "output in json format",
|
|
337
|
+
"name": "json",
|
|
338
|
+
"allowNo": false,
|
|
339
|
+
"type": "boolean"
|
|
340
|
+
},
|
|
341
|
+
"name": {
|
|
342
|
+
"description": "Name of the upload to check status for",
|
|
343
|
+
"exclusive": [
|
|
344
|
+
"upload-id"
|
|
345
|
+
],
|
|
346
|
+
"name": "name",
|
|
347
|
+
"hasDynamicHelp": false,
|
|
348
|
+
"multiple": false,
|
|
349
|
+
"type": "option"
|
|
350
|
+
},
|
|
351
|
+
"upload-id": {
|
|
352
|
+
"description": "UUID of the upload to check status for",
|
|
353
|
+
"exclusive": [
|
|
354
|
+
"name"
|
|
355
|
+
],
|
|
356
|
+
"name": "upload-id",
|
|
357
|
+
"hasDynamicHelp": false,
|
|
358
|
+
"multiple": false,
|
|
359
|
+
"type": "option"
|
|
360
|
+
},
|
|
361
|
+
"apiKey": {
|
|
362
|
+
"aliases": [
|
|
363
|
+
"api-key"
|
|
364
|
+
],
|
|
365
|
+
"description": "API key for devicecloud.dev (find this in the console UI). You can also set the DEVICE_CLOUD_API_KEY environment variable.",
|
|
366
|
+
"name": "apiKey",
|
|
367
|
+
"hasDynamicHelp": false,
|
|
368
|
+
"multiple": false,
|
|
369
|
+
"type": "option"
|
|
370
|
+
},
|
|
371
|
+
"apiUrl": {
|
|
372
|
+
"aliases": [
|
|
373
|
+
"api-url",
|
|
374
|
+
"apiURL"
|
|
375
|
+
],
|
|
376
|
+
"description": "API base URL",
|
|
377
|
+
"hidden": true,
|
|
378
|
+
"name": "apiUrl",
|
|
379
|
+
"default": "https://api.devicecloud.dev",
|
|
380
|
+
"hasDynamicHelp": false,
|
|
381
|
+
"multiple": false,
|
|
382
|
+
"type": "option"
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
"hasDynamicHelp": false,
|
|
386
|
+
"hiddenAliases": [],
|
|
387
|
+
"id": "status",
|
|
388
|
+
"pluginAlias": "@devicecloud.dev/dcd",
|
|
389
|
+
"pluginName": "@devicecloud.dev/dcd",
|
|
390
|
+
"pluginType": "core",
|
|
391
|
+
"strict": true,
|
|
392
|
+
"enableJsonFlag": false,
|
|
393
|
+
"isESM": false,
|
|
394
|
+
"relativePath": [
|
|
395
|
+
"dist",
|
|
396
|
+
"commands",
|
|
397
|
+
"status.js"
|
|
398
|
+
]
|
|
330
399
|
}
|
|
331
400
|
},
|
|
332
|
-
"version": "3.
|
|
401
|
+
"version": "3.3.0"
|
|
333
402
|
}
|