@devicecloud.dev/dcd 5.11.0-beta.7 → 5.11.0-beta.9
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/cloud.js +1 -5
- package/dist/commands/device.js +7 -1
- package/dist/commands/upload.js +2 -8
- package/dist/mcp/bridge.js +7 -2
- package/dist/services/execution-plan.service.d.ts +21 -0
- package/dist/services/execution-plan.service.js +1 -1
- package/dist/utils/app-upload.js +2 -8
- package/dist/utils/auth.js +23 -3
- package/dist/utils/compatibility.d.ts +5 -7
- package/dist/utils/compatibility.js +5 -13
- package/dist/utils/device-bundle.d.ts +16 -3
- package/dist/utils/device-bundle.js +77 -17
- package/package.json +1 -1
package/dist/commands/cloud.js
CHANGED
|
@@ -242,11 +242,7 @@ export const cloudCommand = defineCommand({
|
|
|
242
242
|
const ciContext = detectCiContext();
|
|
243
243
|
let compatibilityData;
|
|
244
244
|
try {
|
|
245
|
-
compatibilityData = await fetchCompatibilityData(apiUrl, auth
|
|
246
|
-
cliVersion,
|
|
247
|
-
ciProvider: ciContext.provider,
|
|
248
|
-
ciWrapperVersion: ciContext.wrapperVersion,
|
|
249
|
-
});
|
|
245
|
+
compatibilityData = await fetchCompatibilityData(apiUrl, auth);
|
|
250
246
|
if (debug) {
|
|
251
247
|
out('[DEBUG] Successfully fetched compatibility data from API');
|
|
252
248
|
}
|
package/dist/commands/device.js
CHANGED
|
@@ -767,7 +767,13 @@ const runSub = defineCommand({
|
|
|
767
767
|
let body;
|
|
768
768
|
if (dir) {
|
|
769
769
|
ctx.progress(ui.running(`Uploading the flows in ${colors.highlight(dir)}…`));
|
|
770
|
-
const bundle = await uploadFlowBundle({
|
|
770
|
+
const bundle = await uploadFlowBundle({
|
|
771
|
+
apiUrl: ctx.apiUrl,
|
|
772
|
+
auth: ctx.auth,
|
|
773
|
+
dir,
|
|
774
|
+
entry,
|
|
775
|
+
log: ctx.progress,
|
|
776
|
+
});
|
|
771
777
|
ctx.progress(ui.success(`Uploaded ${bundle.files} files`));
|
|
772
778
|
body = {
|
|
773
779
|
flowUploadId: bundle.id,
|
package/dist/commands/upload.js
CHANGED
|
@@ -6,8 +6,7 @@ import { outputFlags } from '../config/flags/output.flags.js';
|
|
|
6
6
|
import { uploadBinary, verifyAppZip } from '../methods.js';
|
|
7
7
|
import { telemetry } from '../services/telemetry.service.js';
|
|
8
8
|
import { resolveAuth } from '../utils/auth.js';
|
|
9
|
-
import {
|
|
10
|
-
import { CliError, getCliVersion, logger } from '../utils/cli.js';
|
|
9
|
+
import { CliError, logger } from '../utils/cli.js';
|
|
11
10
|
import { fetchCompatibilityData } from '../utils/compatibility.js';
|
|
12
11
|
import { resolveApiUrl } from '../utils/config-store.js';
|
|
13
12
|
import { checkKekForEncryption, resolveEncryption } from '../utils/envelope.js';
|
|
@@ -56,12 +55,7 @@ export const uploadCommand = defineCommand({
|
|
|
56
55
|
// failed fetch leaves the default off rather than failing the upload.
|
|
57
56
|
let serverDefault;
|
|
58
57
|
try {
|
|
59
|
-
const
|
|
60
|
-
const compatibilityData = await fetchCompatibilityData(apiUrl, auth, {
|
|
61
|
-
cliVersion: getCliVersion(),
|
|
62
|
-
ciProvider: ciContext.provider,
|
|
63
|
-
ciWrapperVersion: ciContext.wrapperVersion,
|
|
64
|
-
});
|
|
58
|
+
const compatibilityData = await fetchCompatibilityData(apiUrl, auth);
|
|
65
59
|
serverDefault = compatibilityData.encryption?.defaultOn;
|
|
66
60
|
}
|
|
67
61
|
catch (error) {
|
package/dist/mcp/bridge.js
CHANGED
|
@@ -47,7 +47,7 @@ const LOCAL_INPUTS = {
|
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
run: {
|
|
50
|
-
description: ' Or pass path: a flow file on this machine (sent as yaml), or a directory of flows (
|
|
50
|
+
description: ' Or pass path: a flow file on this machine (sent as yaml), or a directory of flows (flow picks the entry file inside it). Only the YAML files and the files the flows use (scripts, media) are uploaded, not builds or anything else in the directory.',
|
|
51
51
|
properties: {
|
|
52
52
|
path: {
|
|
53
53
|
type: 'string',
|
|
@@ -93,7 +93,12 @@ export async function resolveLocalInputs(name, args, ctx) {
|
|
|
93
93
|
throw new Error(`No such file or directory: ${flowPath}`);
|
|
94
94
|
if (info.isDirectory()) {
|
|
95
95
|
logStderr(`Uploading the flows in ${flowPath}…`);
|
|
96
|
-
const bundle = await uploadFlowBundle({
|
|
96
|
+
const bundle = await uploadFlowBundle({
|
|
97
|
+
...ctx,
|
|
98
|
+
dir: flowPath,
|
|
99
|
+
entry: typeof rest.flow === 'string' ? rest.flow : undefined,
|
|
100
|
+
log: logStderr,
|
|
101
|
+
});
|
|
97
102
|
return { ...rest, flow_upload_id: bundle.id };
|
|
98
103
|
}
|
|
99
104
|
return { ...rest, yaml: await readFile(flowPath, 'utf8') };
|
|
@@ -43,6 +43,27 @@ interface IFlowSequence {
|
|
|
43
43
|
* accepts: YAML `true` or the string `'true'`.
|
|
44
44
|
*/
|
|
45
45
|
export declare function countExtendedRuntimeFlows(flowOverrides: Record<string, Record<string, unknown>>): number;
|
|
46
|
+
/**
|
|
47
|
+
* Resolve `config.yaml`'s `includedPaths` globs into absolute file paths.
|
|
48
|
+
*
|
|
49
|
+
* This is the general-purpose escape hatch for shipping files the flow
|
|
50
|
+
* commands don't reference: `assertScreenshot` baselines above all, but also
|
|
51
|
+
* fixtures, test data and certificates. Only `addMedia` / `runFlow` /
|
|
52
|
+
* `runScript` arguments are discovered by walking the flows, so without this
|
|
53
|
+
* key such files are silently absent from the uploaded zip.
|
|
54
|
+
*
|
|
55
|
+
* Glob semantics deliberately mirror `flows:` (`applyFlowGlobs`): patterns
|
|
56
|
+
* resolve against the workspace root, never the config file's directory, so
|
|
57
|
+
* `--config ci/workspace.yaml` behaves identically to an auto-detected config.
|
|
58
|
+
*
|
|
59
|
+
* @param workspaceConfig - Validated workspace config
|
|
60
|
+
* @param normalizedInput - Normalized path to the workspace directory
|
|
61
|
+
* @param warn - Sink for non-fatal problems
|
|
62
|
+
* @param debug - Whether to emit debug logging
|
|
63
|
+
* @returns Absolute paths of every matched file, deduped and sorted
|
|
64
|
+
* @throws Error if a pattern escapes the workspace root
|
|
65
|
+
*/
|
|
66
|
+
export declare function resolveIncludedPaths(workspaceConfig: IWorkspaceConfig, normalizedInput: string, warn: (message: string) => void, debug?: boolean): string[];
|
|
46
67
|
/**
|
|
47
68
|
* Generate execution plan for test flows
|
|
48
69
|
*
|
|
@@ -218,7 +218,7 @@ const INCLUDED_PATHS_BYTES_WARN_THRESHOLD = 50 * 1024 * 1024;
|
|
|
218
218
|
* @returns Absolute paths of every matched file, deduped and sorted
|
|
219
219
|
* @throws Error if a pattern escapes the workspace root
|
|
220
220
|
*/
|
|
221
|
-
function resolveIncludedPaths(workspaceConfig, normalizedInput, warn, debug = false) {
|
|
221
|
+
export function resolveIncludedPaths(workspaceConfig, normalizedInput, warn, debug = false) {
|
|
222
222
|
const patterns = workspaceConfig.includedPaths;
|
|
223
223
|
if (!patterns || patterns.length === 0)
|
|
224
224
|
return [];
|
package/dist/utils/app-upload.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { rm } from 'node:fs/promises';
|
|
2
2
|
import { uploadBinary, verifyAppZip } from '../methods.js';
|
|
3
|
-
import {
|
|
4
|
-
import { CliError, getCliVersion } from './cli.js';
|
|
3
|
+
import { CliError } from './cli.js';
|
|
5
4
|
import { fetchCompatibilityData } from './compatibility.js';
|
|
6
5
|
import { checkKekForEncryption, resolveEncryption } from './envelope.js';
|
|
7
6
|
import { extractTarGz, findAppBundle } from './expo.js';
|
|
@@ -31,12 +30,7 @@ export async function uploadLocalApp(opts) {
|
|
|
31
30
|
// rather than failing the upload.
|
|
32
31
|
let serverDefault;
|
|
33
32
|
try {
|
|
34
|
-
const
|
|
35
|
-
const compatibility = await fetchCompatibilityData(apiUrl, auth, {
|
|
36
|
-
cliVersion: getCliVersion(),
|
|
37
|
-
ciProvider: ci.provider,
|
|
38
|
-
ciWrapperVersion: ci.wrapperVersion,
|
|
39
|
-
});
|
|
33
|
+
const compatibility = await fetchCompatibilityData(apiUrl, auth);
|
|
40
34
|
serverDefault = compatibility.encryption?.defaultOn;
|
|
41
35
|
}
|
|
42
36
|
catch {
|
package/dist/utils/auth.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Resolves which credential a command should use and returns the fetch headers
|
|
3
3
|
* to send. Precedence: --api-key flag > DEVICE_CLOUD_API_KEY env > stored
|
|
4
4
|
* Supabase session (refreshed if near expiry). Throws CliError if none found.
|
|
5
|
+
* The headers also carry the CLI's own identity (see clientHeaders).
|
|
5
6
|
*
|
|
6
7
|
* The refresh path writes the rotated tokens back to disk atomically. Callers
|
|
7
8
|
* resolve once per invocation, not per request — except where a process can
|
|
@@ -11,7 +12,8 @@
|
|
|
11
12
|
import { closeSync, openSync, rmSync, statSync } from 'node:fs';
|
|
12
13
|
import { CliAuthGateway, SessionRefreshError, } from '../gateways/cli-auth-gateway.js';
|
|
13
14
|
import { telemetry } from '../services/telemetry.service.js';
|
|
14
|
-
import {
|
|
15
|
+
import { detectCiContext } from './ci.js';
|
|
16
|
+
import { CliError, getCliVersion } from './cli.js';
|
|
15
17
|
import { getConfigPath, readConfig, writeConfig, } from './config-store.js';
|
|
16
18
|
const REFRESH_SKEW_SECONDS = 60;
|
|
17
19
|
// Refresh lock tuning: a refresh is a single HTTP round-trip, so anything
|
|
@@ -31,13 +33,30 @@ export function apiKeyOverride(apiKeyFlag) {
|
|
|
31
33
|
return 'DEVICE_CLOUD_API_KEY';
|
|
32
34
|
return undefined;
|
|
33
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Who is calling, sent with every request next to the credential: the API
|
|
38
|
+
* targets notices by it and records it on each upload and binary.
|
|
39
|
+
* The CI headers are sent only when a DCD wrapper forwarded them or the
|
|
40
|
+
* provider could be inferred.
|
|
41
|
+
*/
|
|
42
|
+
function clientHeaders() {
|
|
43
|
+
const headers = {
|
|
44
|
+
'x-dcd-cli-version': getCliVersion(),
|
|
45
|
+
};
|
|
46
|
+
const ci = detectCiContext();
|
|
47
|
+
if (ci.provider)
|
|
48
|
+
headers['x-dcd-ci-provider'] = ci.provider;
|
|
49
|
+
if (ci.wrapperVersion)
|
|
50
|
+
headers['x-dcd-ci-wrapper-version'] = ci.wrapperVersion;
|
|
51
|
+
return headers;
|
|
52
|
+
}
|
|
34
53
|
export async function resolveAuth(opts) {
|
|
35
54
|
if (!opts.sessionOnly) {
|
|
36
55
|
const flag = opts.apiKeyFlag?.trim();
|
|
37
56
|
if (flag) {
|
|
38
57
|
const auth = {
|
|
39
58
|
mode: 'apiKey',
|
|
40
|
-
headers: { 'x-app-api-key': flag },
|
|
59
|
+
headers: { ...clientHeaders(), 'x-app-api-key': flag },
|
|
41
60
|
};
|
|
42
61
|
telemetry.configure({ auth });
|
|
43
62
|
return auth;
|
|
@@ -46,7 +65,7 @@ export async function resolveAuth(opts) {
|
|
|
46
65
|
if (env) {
|
|
47
66
|
const auth = {
|
|
48
67
|
mode: 'apiKey',
|
|
49
|
-
headers: { 'x-app-api-key': env },
|
|
68
|
+
headers: { ...clientHeaders(), 'x-app-api-key': env },
|
|
50
69
|
};
|
|
51
70
|
telemetry.configure({ auth });
|
|
52
71
|
return auth;
|
|
@@ -75,6 +94,7 @@ export async function resolveAuth(opts) {
|
|
|
75
94
|
orgId: config.current_org_id,
|
|
76
95
|
userEmail: session.user_email,
|
|
77
96
|
headers: {
|
|
97
|
+
...clientHeaders(),
|
|
78
98
|
authorization: `Bearer ${session.access_token}`,
|
|
79
99
|
'x-dcd-org': config.current_org_id,
|
|
80
100
|
},
|
|
@@ -19,11 +19,9 @@ export interface CompatibilityData {
|
|
|
19
19
|
defaultOn: boolean;
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
export declare function fetchCompatibilityData(apiUrl: string, auth: AuthContext, clientContext?: ClientContext): Promise<CompatibilityData>;
|
|
22
|
+
/**
|
|
23
|
+
* The CLI / CI identity the API version-filters and targets notices by rides
|
|
24
|
+
* on `auth.headers`, like on every other request (see resolveAuth).
|
|
25
|
+
*/
|
|
26
|
+
export declare function fetchCompatibilityData(apiUrl: string, auth: AuthContext): Promise<CompatibilityData>;
|
|
29
27
|
export declare function clearCompatibilityCache(): void;
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
let cachedCompatibilityData = null;
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* The CLI / CI identity the API version-filters and targets notices by rides
|
|
4
|
+
* on `auth.headers`, like on every other request (see resolveAuth).
|
|
5
|
+
*/
|
|
6
|
+
export async function fetchCompatibilityData(apiUrl, auth) {
|
|
3
7
|
if (cachedCompatibilityData) {
|
|
4
8
|
return cachedCompatibilityData;
|
|
5
9
|
}
|
|
6
|
-
// Forward CLI / CI identity so the API can version-filter and target notices.
|
|
7
|
-
const noticeHeaders = {};
|
|
8
|
-
if (clientContext?.cliVersion) {
|
|
9
|
-
noticeHeaders['x-dcd-cli-version'] = clientContext.cliVersion;
|
|
10
|
-
}
|
|
11
|
-
if (clientContext?.ciProvider) {
|
|
12
|
-
noticeHeaders['x-dcd-ci-provider'] = clientContext.ciProvider;
|
|
13
|
-
}
|
|
14
|
-
if (clientContext?.ciWrapperVersion) {
|
|
15
|
-
noticeHeaders['x-dcd-ci-wrapper-version'] = clientContext.ciWrapperVersion;
|
|
16
|
-
}
|
|
17
10
|
try {
|
|
18
11
|
const response = await fetch(`${apiUrl}/results/compatibility/data`, {
|
|
19
12
|
headers: {
|
|
20
13
|
'Content-Type': 'application/json',
|
|
21
14
|
...auth.headers,
|
|
22
|
-
...noticeHeaders,
|
|
23
15
|
},
|
|
24
16
|
method: 'GET',
|
|
25
17
|
});
|
|
@@ -2,16 +2,29 @@ import type { AuthContext } from '../types/domain/auth.types.js';
|
|
|
2
2
|
import type { DeviceFlowBundle } from '../types/domain/device-session.types.js';
|
|
3
3
|
/** The API's limit on a bundle (dcd plan 2.5b). */
|
|
4
4
|
export declare const MAX_BUNDLE_BYTES: number;
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The files under `dir` a bundle needs, relative to it, in a stable order:
|
|
7
|
+
* every YAML file (flows, subflows, config), the files the flows use
|
|
8
|
+
* (runScript, addMedia, assertScreenshot and the like), and config's
|
|
9
|
+
* includedPaths. Nothing else: an agent's samples folder sent 265 MB of .apk
|
|
10
|
+
* and .zip files with its flows.
|
|
11
|
+
*
|
|
12
|
+
* `entry` is the one flow that will run. Its files must all be inside `dir`.
|
|
13
|
+
* Without an entry every flow may run, so that goes for all of them. Another
|
|
14
|
+
* flow's missing file doesn't stop the entry running, so it is left out.
|
|
15
|
+
*/
|
|
16
|
+
export declare function bundleFiles(dir: string, entry?: string, warn?: (message: string) => void): string[];
|
|
7
17
|
export interface UploadFlowBundleOptions {
|
|
8
18
|
apiUrl: string;
|
|
9
19
|
auth: AuthContext;
|
|
10
20
|
dir: string;
|
|
21
|
+
/** The one flow that will run, a path inside `dir`. Omitted, all of them. */
|
|
22
|
+
entry?: string;
|
|
11
23
|
log: (message: string) => void;
|
|
12
24
|
}
|
|
13
25
|
/**
|
|
14
|
-
* Zip a directory
|
|
26
|
+
* Zip the files a directory's flows need (bundleFiles) and upload them as a
|
|
27
|
+
* flow bundle: ask the API for
|
|
15
28
|
* upload URLs, PUT the zip to both copies, then register it with its
|
|
16
29
|
* SHA-256. Encrypted like `dcd cloud`'s flow zips when the org's default
|
|
17
30
|
* (or DCD_ENCRYPT) says so. Entries are relative to `dir`, so a run's
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import { readdirSync } from 'node:fs';
|
|
2
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import { DeviceGateway } from '../gateways/device-gateway.js';
|
|
5
5
|
import { compressFilesFromRelativePath } from '../methods.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { resolveIncludedPaths } from '../services/execution-plan.service.js';
|
|
7
|
+
import { isWorkspaceConfigFile, loadWorkspaceConfig, processDependencies, readTestYamlFileAsJson, } from '../services/execution-plan.utils.js';
|
|
8
|
+
import { CliError } from './cli.js';
|
|
8
9
|
import { fetchCompatibilityData } from './compatibility.js';
|
|
9
10
|
import { checkKekForEncryption, encryptFlowBuffer, resolveEncryption, resolveKekPublicKey, } from './envelope.js';
|
|
10
11
|
/** The API's limit on a bundle (dcd plan 2.5b). */
|
|
@@ -15,13 +16,76 @@ function skipped(relativePath) {
|
|
|
15
16
|
.split(path.sep)
|
|
16
17
|
.some((part) => part === 'node_modules' || (part.startsWith('.') && part !== '.'));
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const YAML_FILE = /\.ya?ml$/i;
|
|
20
|
+
/** Every file under `dir`, relative to it. */
|
|
21
|
+
function allFiles(dir) {
|
|
20
22
|
return readdirSync(dir, { recursive: true, withFileTypes: true })
|
|
21
23
|
.filter((entry) => entry.isFile())
|
|
22
24
|
.map((entry) => path.relative(dir, path.join(entry.parentPath, entry.name)))
|
|
23
|
-
.filter((file) => !skipped(file))
|
|
24
|
-
|
|
25
|
+
.filter((file) => !skipped(file));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The files under `dir` a bundle needs, relative to it, in a stable order:
|
|
29
|
+
* every YAML file (flows, subflows, config), the files the flows use
|
|
30
|
+
* (runScript, addMedia, assertScreenshot and the like), and config's
|
|
31
|
+
* includedPaths. Nothing else: an agent's samples folder sent 265 MB of .apk
|
|
32
|
+
* and .zip files with its flows.
|
|
33
|
+
*
|
|
34
|
+
* `entry` is the one flow that will run. Its files must all be inside `dir`.
|
|
35
|
+
* Without an entry every flow may run, so that goes for all of them. Another
|
|
36
|
+
* flow's missing file doesn't stop the entry running, so it is left out.
|
|
37
|
+
*/
|
|
38
|
+
export function bundleFiles(dir, entry, warn = () => { }) {
|
|
39
|
+
const root = path.resolve(dir);
|
|
40
|
+
const yamlFiles = allFiles(dir).filter((file) => YAML_FILE.test(file));
|
|
41
|
+
const entryFile = entry === undefined ? undefined : path.normalize(entry);
|
|
42
|
+
if (entryFile !== undefined && !yamlFiles.includes(entryFile)) {
|
|
43
|
+
throw new CliError(`No flow ${entry} in ${dir}.`);
|
|
44
|
+
}
|
|
45
|
+
const needed = new Set(yamlFiles);
|
|
46
|
+
const problems = [];
|
|
47
|
+
const add = (absolute, strict, from) => {
|
|
48
|
+
const relative = path.relative(root, absolute);
|
|
49
|
+
if (relative.startsWith('..') || path.isAbsolute(relative)) {
|
|
50
|
+
if (strict)
|
|
51
|
+
problems.push(`${from} uses ${absolute}, which is outside ${dir}. Pass a directory that holds both.`);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
needed.add(relative);
|
|
55
|
+
};
|
|
56
|
+
for (const file of yamlFiles) {
|
|
57
|
+
const absolute = path.join(root, file);
|
|
58
|
+
const strict = entryFile === undefined || entryFile === file;
|
|
59
|
+
if (isWorkspaceConfigFile(absolute))
|
|
60
|
+
continue;
|
|
61
|
+
let deps;
|
|
62
|
+
try {
|
|
63
|
+
const { config, testSteps } = readTestYamlFileAsJson(absolute);
|
|
64
|
+
deps = processDependencies({ config, input: absolute, testSteps });
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
// Not a flow (a data file, say), or one Maestro will report itself.
|
|
68
|
+
if (entryFile === file)
|
|
69
|
+
throw new CliError(error.message);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (strict)
|
|
73
|
+
problems.push(...deps.allErrors);
|
|
74
|
+
for (const dep of deps.allFiles) {
|
|
75
|
+
if (existsSync(dep))
|
|
76
|
+
add(dep, strict, file);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
for (const name of ['config.yaml', 'config.yml']) {
|
|
80
|
+
if (!yamlFiles.includes(name))
|
|
81
|
+
continue;
|
|
82
|
+
const config = loadWorkspaceConfig(path.join(root, name), warn);
|
|
83
|
+
for (const file of resolveIncludedPaths(config, root, warn))
|
|
84
|
+
add(file, true, name);
|
|
85
|
+
}
|
|
86
|
+
if (problems.length > 0)
|
|
87
|
+
throw new CliError(problems.join('\n'));
|
|
88
|
+
return [...needed].sort();
|
|
25
89
|
}
|
|
26
90
|
/** PUT the zip to one signed URL. The URL is the credential. */
|
|
27
91
|
async function put(url, body) {
|
|
@@ -46,27 +110,23 @@ async function put(url, body) {
|
|
|
46
110
|
return false;
|
|
47
111
|
}
|
|
48
112
|
/**
|
|
49
|
-
* Zip a directory
|
|
113
|
+
* Zip the files a directory's flows need (bundleFiles) and upload them as a
|
|
114
|
+
* flow bundle: ask the API for
|
|
50
115
|
* upload URLs, PUT the zip to both copies, then register it with its
|
|
51
116
|
* SHA-256. Encrypted like `dcd cloud`'s flow zips when the org's default
|
|
52
117
|
* (or DCD_ENCRYPT) says so. Entries are relative to `dir`, so a run's
|
|
53
118
|
* `flow` is a path inside it, e.g. `login.yaml`.
|
|
54
119
|
*/
|
|
55
120
|
export async function uploadFlowBundle(opts) {
|
|
56
|
-
const { apiUrl, auth, dir, log } = opts;
|
|
57
|
-
const files = bundleFiles(dir);
|
|
58
|
-
if (!files.some((f) =>
|
|
121
|
+
const { apiUrl, auth, dir, entry, log } = opts;
|
|
122
|
+
const files = bundleFiles(dir, entry, log);
|
|
123
|
+
if (!files.some((f) => YAML_FILE.test(f))) {
|
|
59
124
|
throw new CliError(`No flow files (.yaml) in ${dir}.`);
|
|
60
125
|
}
|
|
61
126
|
const zip = await compressFilesFromRelativePath(dir, files, '');
|
|
62
127
|
let serverDefault;
|
|
63
128
|
try {
|
|
64
|
-
const
|
|
65
|
-
const compatibility = await fetchCompatibilityData(apiUrl, auth, {
|
|
66
|
-
cliVersion: getCliVersion(),
|
|
67
|
-
ciProvider: ci.provider,
|
|
68
|
-
ciWrapperVersion: ci.wrapperVersion,
|
|
69
|
-
});
|
|
129
|
+
const compatibility = await fetchCompatibilityData(apiUrl, auth);
|
|
70
130
|
serverDefault = compatibility.encryption?.defaultOn;
|
|
71
131
|
}
|
|
72
132
|
catch {
|
package/package.json
CHANGED