@devicecloud.dev/dcd 4.4.8 → 5.0.0-beta.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/README.md +40 -2
- package/dist/commands/artifacts.d.ts +47 -18
- package/dist/commands/artifacts.js +68 -60
- package/dist/commands/cloud.d.ts +228 -88
- package/dist/commands/cloud.js +389 -282
- package/dist/commands/list.d.ts +39 -38
- package/dist/commands/list.js +122 -127
- package/dist/commands/live.d.ts +2 -0
- package/dist/commands/live.js +513 -0
- package/dist/commands/login.d.ts +17 -0
- package/dist/commands/login.js +250 -0
- package/dist/commands/logout.d.ts +2 -0
- package/dist/commands/logout.js +32 -0
- package/dist/commands/status.d.ts +23 -42
- package/dist/commands/status.js +162 -173
- package/dist/commands/switch-org.d.ts +12 -0
- package/dist/commands/switch-org.js +78 -0
- package/dist/commands/upgrade.d.ts +2 -0
- package/dist/commands/upgrade.js +122 -0
- package/dist/commands/upload.d.ts +33 -18
- package/dist/commands/upload.js +62 -67
- package/dist/commands/whoami.d.ts +2 -0
- package/dist/commands/whoami.js +34 -0
- package/dist/config/environments.d.ts +31 -0
- package/dist/config/environments.js +58 -0
- package/dist/config/flags/api.flags.d.ts +10 -2
- package/dist/config/flags/api.flags.js +12 -10
- package/dist/config/flags/binary.flags.d.ts +17 -4
- package/dist/config/flags/binary.flags.js +13 -14
- package/dist/config/flags/device.flags.d.ts +49 -11
- package/dist/config/flags/device.flags.js +41 -33
- package/dist/config/flags/environment.flags.d.ts +27 -6
- package/dist/config/flags/environment.flags.js +23 -25
- package/dist/config/flags/execution.flags.d.ts +35 -8
- package/dist/config/flags/execution.flags.js +30 -37
- package/dist/config/flags/github.flags.d.ts +23 -5
- package/dist/config/flags/github.flags.js +18 -11
- package/dist/config/flags/output.flags.d.ts +57 -13
- package/dist/config/flags/output.flags.js +47 -43
- package/dist/constants.d.ts +218 -51
- package/dist/constants.js +2 -2
- package/dist/gateways/api-gateway.d.ts +43 -12
- package/dist/gateways/api-gateway.js +240 -100
- package/dist/gateways/cli-auth-gateway.d.ts +13 -0
- package/dist/gateways/cli-auth-gateway.js +57 -0
- package/dist/gateways/supabase-gateway.d.ts +11 -11
- package/dist/gateways/supabase-gateway.js +15 -39
- package/dist/index.d.ts +2 -1
- package/dist/index.js +93 -2
- package/dist/methods.d.ts +3 -5
- package/dist/methods.js +170 -178
- package/dist/services/device-validation.service.d.ts +8 -0
- package/dist/services/device-validation.service.js +55 -35
- package/dist/services/execution-plan.service.js +27 -15
- package/dist/services/execution-plan.utils.d.ts +3 -0
- package/dist/services/execution-plan.utils.js +10 -32
- package/dist/services/metadata-extractor.service.d.ts +0 -2
- package/dist/services/metadata-extractor.service.js +57 -57
- package/dist/services/moropo.service.js +25 -24
- package/dist/services/report-download.service.d.ts +12 -1
- package/dist/services/report-download.service.js +31 -20
- package/dist/services/results-polling.service.d.ts +6 -7
- package/dist/services/results-polling.service.js +80 -33
- package/dist/services/telemetry.service.d.ts +40 -0
- package/dist/services/telemetry.service.js +230 -0
- package/dist/services/test-submission.service.js +2 -1
- package/dist/services/version.service.d.ts +3 -2
- package/dist/services/version.service.js +27 -11
- package/dist/types/domain/auth.types.d.ts +12 -0
- package/dist/types/{schema.types.js → domain/auth.types.js} +0 -1
- package/dist/types/domain/live.types.d.ts +76 -0
- package/dist/types/domain/live.types.js +4 -0
- package/dist/utils/auth.d.ts +13 -0
- package/dist/utils/auth.js +142 -0
- package/dist/utils/cli.d.ts +35 -0
- package/dist/utils/cli.js +127 -0
- package/dist/utils/compatibility.d.ts +2 -1
- package/dist/utils/compatibility.js +2 -2
- package/dist/utils/config-store.d.ts +35 -0
- package/dist/utils/config-store.js +125 -0
- package/dist/utils/connectivity.js +7 -3
- package/dist/utils/expo.js +14 -3
- package/dist/utils/orgs.d.ts +11 -0
- package/dist/utils/orgs.js +40 -0
- package/dist/utils/paths.d.ts +11 -0
- package/dist/utils/paths.js +24 -0
- package/dist/utils/progress.d.ts +13 -0
- package/dist/utils/progress.js +50 -0
- package/dist/utils/styling.d.ts +13 -5
- package/dist/utils/styling.js +37 -7
- package/package.json +26 -38
- package/bin/dev.cmd +0 -3
- package/bin/dev.js +0 -6
- package/bin/run.cmd +0 -3
- package/bin/run.js +0 -7
- package/dist/types/schema.types.d.ts +0 -2702
- package/oclif.manifest.json +0 -884
package/dist/commands/list.d.ts
CHANGED
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
1
|
+
export declare const listCommand: import("citty").CommandDef<{
|
|
2
|
+
from: {
|
|
3
|
+
type: "string";
|
|
4
|
+
description: string;
|
|
5
|
+
};
|
|
6
|
+
json: {
|
|
7
|
+
type: "boolean";
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
limit: {
|
|
11
|
+
type: "string";
|
|
12
|
+
default: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
name: {
|
|
16
|
+
type: "string";
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
offset: {
|
|
20
|
+
type: "string";
|
|
21
|
+
default: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
to: {
|
|
25
|
+
type: "string";
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
'api-key': {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly alias: ["apiKey"];
|
|
31
|
+
readonly description: "API key for devicecloud.dev (find this in the console UI). You can also set the DEVICE_CLOUD_API_KEY environment variable.";
|
|
32
|
+
};
|
|
33
|
+
'api-url': {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
readonly alias: ["apiURL", "apiUrl"];
|
|
36
|
+
readonly description: "API base URL (defaults to the URL stored by `dcd login`, else prod)";
|
|
37
|
+
};
|
|
38
|
+
}>;
|
|
39
|
+
export default listCommand;
|
package/dist/commands/list.js
CHANGED
|
@@ -1,143 +1,138 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
exports.listCommand = void 0;
|
|
4
|
+
const citty_1 = require("citty");
|
|
5
|
+
const api_flags_1 = require("../config/flags/api.flags");
|
|
5
6
|
const api_gateway_1 = require("../gateways/api-gateway");
|
|
7
|
+
const auth_1 = require("../utils/auth");
|
|
8
|
+
const cli_1 = require("../utils/cli");
|
|
9
|
+
const config_store_1 = require("../utils/config-store");
|
|
6
10
|
const styling_1 = require("../utils/styling");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'
|
|
12
|
-
'<%= config.bin %> <%= command.id %> --limit 10',
|
|
13
|
-
'<%= config.bin %> <%= command.id %> --name "nightly-*" # Quote wildcards to prevent shell expansion!',
|
|
14
|
-
'<%= config.bin %> <%= command.id %> --from 2024-01-01 --to 2024-01-31',
|
|
15
|
-
'<%= config.bin %> <%= command.id %> --json',
|
|
11
|
+
function detectShellExpansion(name) {
|
|
12
|
+
const indicators = [
|
|
13
|
+
name.includes('/') || name.includes('\\'),
|
|
14
|
+
/\.(yaml|yml|json|txt|md|ts|js|py|sh)$/i.test(name),
|
|
15
|
+
name.includes(' ') && !name.includes('*') && !name.includes('?'),
|
|
16
16
|
];
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
if (indicators.some(Boolean)) {
|
|
18
|
+
cli_1.logger.warn(`\nThe --name parameter appears to have been expanded by your shell: "${name}"\n` +
|
|
19
|
+
'Wildcards like * should be quoted to prevent shell expansion.\n' +
|
|
20
|
+
'Examples:\n' +
|
|
21
|
+
' ✓ Correct: dcd list --name "nightly-*"\n' +
|
|
22
|
+
" ✓ Correct: dcd list --name 'nightly-*'\n" +
|
|
23
|
+
' ✗ Incorrect: dcd list --name nightly-*\n');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function displayResults(response) {
|
|
27
|
+
const { uploads, total, limit, offset } = response;
|
|
28
|
+
if (uploads.length === 0) {
|
|
29
|
+
cli_1.logger.log(`\n${styling_1.symbols.info} No uploads found matching your criteria.\n`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
cli_1.logger.log((0, styling_1.sectionHeader)('Recent Uploads'));
|
|
33
|
+
cli_1.logger.log(` ${styling_1.colors.dim('Showing')} ${uploads.length} ${styling_1.colors.dim('of')} ${total} ${styling_1.colors.dim('uploads')}`);
|
|
34
|
+
if (offset > 0) {
|
|
35
|
+
cli_1.logger.log(` ${styling_1.colors.dim('(offset:')} ${offset}${styling_1.colors.dim(')')}`);
|
|
36
|
+
}
|
|
37
|
+
cli_1.logger.log('');
|
|
38
|
+
for (const upload of uploads) {
|
|
39
|
+
const date = new Date(upload.created_at);
|
|
40
|
+
const formattedDate = date.toLocaleDateString('en-US', {
|
|
41
|
+
day: 'numeric',
|
|
42
|
+
hour: '2-digit',
|
|
43
|
+
minute: '2-digit',
|
|
44
|
+
month: 'short',
|
|
45
|
+
year: 'numeric',
|
|
46
|
+
});
|
|
47
|
+
const displayName = upload.name || styling_1.colors.dim('(unnamed)');
|
|
48
|
+
cli_1.logger.log(` ${styling_1.colors.bold(displayName)}`);
|
|
49
|
+
cli_1.logger.log(` ${styling_1.colors.dim('ID:')} ${(0, styling_1.formatId)(upload.id)}`);
|
|
50
|
+
cli_1.logger.log(` ${styling_1.colors.dim('Created:')} ${formattedDate}`);
|
|
51
|
+
cli_1.logger.log(` ${styling_1.colors.dim('Console:')} ${(0, styling_1.formatUrl)(upload.consoleUrl)}`);
|
|
52
|
+
cli_1.logger.log('');
|
|
53
|
+
}
|
|
54
|
+
if (total > offset + uploads.length) {
|
|
55
|
+
const remaining = total - (offset + uploads.length);
|
|
56
|
+
cli_1.logger.log(` ${styling_1.colors.dim('Use')} --offset ${offset + uploads.length} ${styling_1.colors.dim('to see the next')} ${Math.min(remaining, limit)} ${styling_1.colors.dim('uploads')}\n`);
|
|
57
|
+
}
|
|
58
|
+
cli_1.logger.log(` ${styling_1.symbols.info} ${styling_1.colors.dim('Use')} dcd status --upload-id <id> ${styling_1.colors.dim('for detailed test results')}\n`);
|
|
59
|
+
}
|
|
60
|
+
exports.listCommand = (0, citty_1.defineCommand)({
|
|
61
|
+
meta: {
|
|
62
|
+
name: 'list',
|
|
63
|
+
description: 'List recent flow uploads for your organization',
|
|
64
|
+
},
|
|
65
|
+
args: {
|
|
66
|
+
...api_flags_1.apiFlags,
|
|
67
|
+
from: {
|
|
68
|
+
type: 'string',
|
|
21
69
|
description: 'Filter uploads created on or after this date (ISO 8601 format, e.g., 2024-01-01)',
|
|
22
|
-
}
|
|
23
|
-
json:
|
|
70
|
+
},
|
|
71
|
+
json: {
|
|
72
|
+
type: 'boolean',
|
|
24
73
|
description: 'Output in JSON format',
|
|
25
|
-
}
|
|
26
|
-
limit:
|
|
27
|
-
|
|
74
|
+
},
|
|
75
|
+
limit: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
default: '20',
|
|
28
78
|
description: 'Maximum number of uploads to return',
|
|
29
|
-
}
|
|
30
|
-
name:
|
|
79
|
+
},
|
|
80
|
+
name: {
|
|
81
|
+
type: 'string',
|
|
31
82
|
description: 'Filter by upload name (supports * wildcard, e.g., "nightly-*"). IMPORTANT: Always quote wildcards to prevent shell expansion!',
|
|
32
|
-
}
|
|
33
|
-
offset:
|
|
34
|
-
|
|
83
|
+
},
|
|
84
|
+
offset: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
default: '0',
|
|
35
87
|
description: 'Number of uploads to skip (for pagination)',
|
|
36
|
-
}
|
|
37
|
-
to:
|
|
88
|
+
},
|
|
89
|
+
to: {
|
|
90
|
+
type: 'string',
|
|
38
91
|
description: 'Filter uploads created on or before this date (ISO 8601 format, e.g., 2024-01-31)',
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
async run() {
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (from && Number.isNaN(Date.parse(from))) {
|
|
51
|
-
this.error('Invalid --from date format. Please use ISO 8601 format (e.g., 2024-01-01).');
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (to && Number.isNaN(Date.parse(to))) {
|
|
55
|
-
this.error('Invalid --to date format. Please use ISO 8601 format (e.g., 2024-01-31).');
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
// Detect potential shell expansion of wildcards
|
|
59
|
-
if (name) {
|
|
60
|
-
this.detectShellExpansion(name);
|
|
61
|
-
}
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
async run({ args }) {
|
|
95
|
+
const apiKeyFlag = args['api-key'];
|
|
96
|
+
const apiUrl = (0, config_store_1.resolveApiUrl)(args['api-url']);
|
|
97
|
+
const from = args.from;
|
|
98
|
+
const to = args.to;
|
|
99
|
+
const name = args.name;
|
|
100
|
+
const json = Boolean(args.json);
|
|
101
|
+
const limit = (0, cli_1.parseIntFlag)(args.limit, 'limit') ?? 20;
|
|
102
|
+
const offset = (0, cli_1.parseIntFlag)(args.offset, 'offset') ?? 0;
|
|
62
103
|
try {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
to
|
|
69
|
-
}
|
|
70
|
-
if (
|
|
71
|
-
|
|
104
|
+
const auth = await (0, auth_1.resolveAuth)({ apiKeyFlag });
|
|
105
|
+
if (from && Number.isNaN(Date.parse(from))) {
|
|
106
|
+
throw new cli_1.CliError('Invalid --from date format. Please use ISO 8601 format (e.g., 2024-01-01).');
|
|
107
|
+
}
|
|
108
|
+
if (to && Number.isNaN(Date.parse(to))) {
|
|
109
|
+
throw new cli_1.CliError('Invalid --to date format. Please use ISO 8601 format (e.g., 2024-01-31).');
|
|
110
|
+
}
|
|
111
|
+
if (name) {
|
|
112
|
+
detectShellExpansion(name);
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
const response = (await api_gateway_1.ApiGateway.listUploads(apiUrl, auth, {
|
|
116
|
+
from,
|
|
117
|
+
limit,
|
|
118
|
+
name,
|
|
119
|
+
offset,
|
|
120
|
+
to,
|
|
121
|
+
}));
|
|
122
|
+
if (json) {
|
|
123
|
+
// eslint-disable-next-line no-console
|
|
124
|
+
console.log(JSON.stringify(response, null, 2));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
displayResults(response);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
throw new cli_1.CliError(`Failed to list uploads: ${error.message}`);
|
|
72
131
|
}
|
|
73
|
-
this.displayResults(response);
|
|
74
132
|
}
|
|
75
133
|
catch (error) {
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Detects if the provided name parameter likely underwent shell expansion
|
|
81
|
-
* Warns the user if shell expansion is detected
|
|
82
|
-
* @param name - The name parameter to check for shell expansion
|
|
83
|
-
* @returns void
|
|
84
|
-
*/
|
|
85
|
-
detectShellExpansion(name) {
|
|
86
|
-
const shellExpansionIndicators = [
|
|
87
|
-
// Contains file path separators (likely expanded to file paths)
|
|
88
|
-
name.includes('/') || name.includes('\\'),
|
|
89
|
-
// Contains file extensions (likely expanded to filenames)
|
|
90
|
-
/\.(yaml|yml|json|txt|md|ts|js|py|sh)$/i.test(name),
|
|
91
|
-
// Looks like multiple space-separated filenames (shell expanded glob to multiple files)
|
|
92
|
-
name.includes(' ') && !name.includes('*') && !name.includes('?'),
|
|
93
|
-
];
|
|
94
|
-
if (shellExpansionIndicators.some(Boolean)) {
|
|
95
|
-
this.warn(`\nThe --name parameter appears to have been expanded by your shell: "${name}"\n` +
|
|
96
|
-
'Wildcards like * should be quoted to prevent shell expansion.\n' +
|
|
97
|
-
'Examples:\n' +
|
|
98
|
-
' ✓ Correct: dcd list --name "nightly-*"\n' +
|
|
99
|
-
' ✓ Correct: dcd list --name \'nightly-*\'\n' +
|
|
100
|
-
' ✗ Incorrect: dcd list --name nightly-*\n');
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
displayResults(response) {
|
|
104
|
-
const { uploads, total, limit, offset } = response;
|
|
105
|
-
if (uploads.length === 0) {
|
|
106
|
-
this.log('\nNo uploads found matching your criteria.\n');
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
this.log((0, styling_1.sectionHeader)('Recent Uploads'));
|
|
110
|
-
this.log(` ${styling_1.colors.dim('Showing')} ${uploads.length} ${styling_1.colors.dim('of')} ${total} ${styling_1.colors.dim('uploads')}`);
|
|
111
|
-
if (offset > 0) {
|
|
112
|
-
this.log(` ${styling_1.colors.dim('(offset:')} ${offset}${styling_1.colors.dim(')')}`);
|
|
113
|
-
}
|
|
114
|
-
this.log('');
|
|
115
|
-
for (const upload of uploads) {
|
|
116
|
-
const date = new Date(upload.created_at);
|
|
117
|
-
const formattedDate = date.toLocaleDateString('en-US', {
|
|
118
|
-
day: 'numeric',
|
|
119
|
-
hour: '2-digit',
|
|
120
|
-
minute: '2-digit',
|
|
121
|
-
month: 'short',
|
|
122
|
-
year: 'numeric',
|
|
123
|
-
});
|
|
124
|
-
// Upload name
|
|
125
|
-
const displayName = upload.name || styling_1.colors.dim('(unnamed)');
|
|
126
|
-
this.log(` ${styling_1.colors.bold(displayName)}`);
|
|
127
|
-
// Upload ID and date
|
|
128
|
-
this.log(` ${styling_1.colors.dim('ID:')} ${(0, styling_1.formatId)(upload.id)}`);
|
|
129
|
-
this.log(` ${styling_1.colors.dim('Created:')} ${formattedDate}`);
|
|
130
|
-
// Console URL
|
|
131
|
-
this.log(` ${styling_1.colors.dim('Console:')} ${(0, styling_1.formatUrl)(upload.consoleUrl)}`);
|
|
132
|
-
this.log('');
|
|
134
|
+
cli_1.logger.error(error, { exit: 1, json });
|
|
133
135
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
this.log(` ${styling_1.colors.dim('Use')} --offset ${offset + limit} ${styling_1.colors.dim('to see the next')} ${Math.min(remaining, limit)} ${styling_1.colors.dim('uploads')}\n`);
|
|
138
|
-
}
|
|
139
|
-
// Hint about getting detailed status
|
|
140
|
-
this.log(` ${styling_1.colors.dim('Tip: Use')} dcd status --upload-id <id> ${styling_1.colors.dim('for detailed test results')}\n`);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
exports.default = List;
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
exports.default = exports.listCommand;
|