@devicecloud.dev/dcd 4.1.1 → 4.1.2-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.
- package/dist/commands/cloud.js +1 -1
- package/dist/plan.d.ts +1 -1
- package/dist/plan.js +21 -3
- package/dist/planMethods.d.ts +1 -1
- package/dist/planMethods.js +33 -8
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/dist/commands/cloud.js
CHANGED
|
@@ -308,7 +308,7 @@ class Cloud extends core_1.Command {
|
|
|
308
308
|
if (debug) {
|
|
309
309
|
this.log('DEBUG: Generating execution plan...');
|
|
310
310
|
}
|
|
311
|
-
executionPlan = await (0, plan_1.plan)(flowFile, includeTags.flat(), excludeTags.flat(), excludeFlows.flat(), configFile);
|
|
311
|
+
executionPlan = await (0, plan_1.plan)(flowFile, includeTags.flat(), excludeTags.flat(), excludeFlows.flat(), configFile, debug);
|
|
312
312
|
if (debug) {
|
|
313
313
|
this.log(`DEBUG: Execution plan generated`);
|
|
314
314
|
this.log(`DEBUG: Total flow files: ${executionPlan.totalFlowFiles}`);
|
package/dist/plan.d.ts
CHANGED
|
@@ -35,5 +35,5 @@ interface IFlowSequence {
|
|
|
35
35
|
continueOnFailure?: boolean;
|
|
36
36
|
flows: string[];
|
|
37
37
|
}
|
|
38
|
-
export declare function plan(input: string, includeTags: string[], excludeTags: string[], excludeFlows?: string[], configFile?: string): Promise<IExecutionPlan>;
|
|
38
|
+
export declare function plan(input: string, includeTags: string[], excludeTags: string[], excludeFlows?: string[], configFile?: string, debug?: boolean): Promise<IExecutionPlan>;
|
|
39
39
|
export {};
|
package/dist/plan.js
CHANGED
|
@@ -64,7 +64,7 @@ function extractDeviceCloudOverrides(config) {
|
|
|
64
64
|
}
|
|
65
65
|
return overrides;
|
|
66
66
|
}
|
|
67
|
-
async function plan(input, includeTags, excludeTags, excludeFlows, configFile) {
|
|
67
|
+
async function plan(input, includeTags, excludeTags, excludeFlows, configFile, debug = false) {
|
|
68
68
|
const normalizedInput = path.normalize(input);
|
|
69
69
|
const flowMetadata = {};
|
|
70
70
|
if (!fs.existsSync(normalizedInput)) {
|
|
@@ -189,12 +189,30 @@ async function plan(input, includeTags, excludeTags, excludeFlows, configFile) {
|
|
|
189
189
|
const config = configPerFlowFile[filePath];
|
|
190
190
|
const name = config?.name || path.parse(filePath).name;
|
|
191
191
|
acc[name] = filePath;
|
|
192
|
+
if (debug) {
|
|
193
|
+
console.log(`[DEBUG] Flow name mapping: "${name}" -> ${filePath}`);
|
|
194
|
+
}
|
|
192
195
|
return acc;
|
|
193
196
|
}, {});
|
|
197
|
+
if (debug && workspaceConfig.executionOrder?.flowsOrder) {
|
|
198
|
+
console.log('[DEBUG] executionOrder.flowsOrder:', workspaceConfig.executionOrder.flowsOrder);
|
|
199
|
+
console.log('[DEBUG] Available flow names:', Object.keys(pathsByName));
|
|
200
|
+
}
|
|
194
201
|
const flowsToRunInSequence = workspaceConfig.executionOrder?.flowsOrder
|
|
195
|
-
?.map((flowOrder) =>
|
|
196
|
-
|
|
202
|
+
?.map((flowOrder) => {
|
|
203
|
+
// Strip .yaml/.yml extension only from the END of the string
|
|
204
|
+
// This supports flowsOrder entries like "my_test.yml" matching "my_test"
|
|
205
|
+
// while preserving extensions in the middle like "(file.yml) Name"
|
|
206
|
+
const normalizedFlowOrder = flowOrder.replace(/\.ya?ml$/i, '');
|
|
207
|
+
if (debug && flowOrder !== normalizedFlowOrder) {
|
|
208
|
+
console.log(`[DEBUG] Stripping trailing extension: "${flowOrder}" -> "${normalizedFlowOrder}"`);
|
|
209
|
+
}
|
|
210
|
+
return (0, planMethods_1.getFlowsToRunInSequence)(pathsByName, [normalizedFlowOrder], debug);
|
|
211
|
+
})
|
|
197
212
|
.flat() || [];
|
|
213
|
+
if (debug) {
|
|
214
|
+
console.log(`[DEBUG] Sequential flows resolved: ${flowsToRunInSequence.length} flow(s)`);
|
|
215
|
+
}
|
|
198
216
|
const normalFlows = allFlows
|
|
199
217
|
.filter((flow) => !flowsToRunInSequence.includes(flow))
|
|
200
218
|
.sort((a, b) => a.localeCompare(b));
|
package/dist/planMethods.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function getFlowsToRunInSequence(paths: {
|
|
2
2
|
[key: string]: string;
|
|
3
|
-
}, flowOrder: string[]): string[];
|
|
3
|
+
}, flowOrder: string[], debug?: boolean): string[];
|
|
4
4
|
export declare function isFlowFile(filePath: string): boolean;
|
|
5
5
|
export declare const readYamlFileAsJson: (filePath: string) => unknown;
|
|
6
6
|
export declare const readTestYamlFileAsJson: (filePath: string) => {
|
package/dist/planMethods.js
CHANGED
|
@@ -9,25 +9,50 @@ const yaml = require("js-yaml");
|
|
|
9
9
|
const fs = require("node:fs");
|
|
10
10
|
const path = require("node:path");
|
|
11
11
|
const commandsThatRequireFiles = new Set(['addMedia', 'runFlow', 'runScript']);
|
|
12
|
-
function getFlowsToRunInSequence(paths, flowOrder) {
|
|
13
|
-
if (flowOrder.length === 0)
|
|
12
|
+
function getFlowsToRunInSequence(paths, flowOrder, debug = false) {
|
|
13
|
+
if (flowOrder.length === 0) {
|
|
14
|
+
if (debug) {
|
|
15
|
+
console.log('[DEBUG] getFlowsToRunInSequence: flowOrder is empty, returning []');
|
|
16
|
+
}
|
|
14
17
|
return [];
|
|
18
|
+
}
|
|
15
19
|
const orderSet = new Set(flowOrder);
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
20
|
+
const availableNames = Object.keys(paths);
|
|
21
|
+
if (debug) {
|
|
22
|
+
console.log(`[DEBUG] getFlowsToRunInSequence: Looking for flows in order: [${[...orderSet].join(', ')}]`);
|
|
23
|
+
console.log(`[DEBUG] getFlowsToRunInSequence: Available flow names: [${availableNames.join(', ')}]`);
|
|
24
|
+
}
|
|
25
|
+
const namesInOrder = availableNames.filter((key) => orderSet.has(key));
|
|
26
|
+
if (debug) {
|
|
27
|
+
console.log(`[DEBUG] getFlowsToRunInSequence: Matched ${namesInOrder.length} flow(s): [${namesInOrder.join(', ')}]`);
|
|
28
|
+
}
|
|
29
|
+
if (namesInOrder.length === 0) {
|
|
30
|
+
const notFound = [...orderSet].filter((item) => !availableNames.includes(item));
|
|
31
|
+
if (debug) {
|
|
32
|
+
console.log(`[DEBUG] getFlowsToRunInSequence: No flows matched, not found: [${notFound.join(', ')}]`);
|
|
33
|
+
}
|
|
18
34
|
return [];
|
|
35
|
+
}
|
|
19
36
|
const result = [...orderSet].filter((item) => namesInOrder.includes(item));
|
|
20
37
|
if (result.length === 0) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.join(', ')}`);
|
|
38
|
+
const notFound = [...orderSet].filter((item) => !namesInOrder.includes(item));
|
|
39
|
+
throw new Error(`Could not find flows needed for execution in order: ${notFound.join(', ')}\n\nAvailable flow names:\n${availableNames.join('\n')}`);
|
|
24
40
|
}
|
|
25
41
|
else if (flowOrder
|
|
26
42
|
.slice(0, result.length)
|
|
27
43
|
.every((value, index) => value === result[index])) {
|
|
28
|
-
|
|
44
|
+
const resolvedPaths = result.map((item) => paths[item]);
|
|
45
|
+
if (debug) {
|
|
46
|
+
console.log(`[DEBUG] getFlowsToRunInSequence: Order matches, returning ${resolvedPaths.length} path(s)`);
|
|
47
|
+
}
|
|
48
|
+
return resolvedPaths;
|
|
29
49
|
}
|
|
30
50
|
else {
|
|
51
|
+
if (debug) {
|
|
52
|
+
console.log('[DEBUG] getFlowsToRunInSequence: Order does not match, returning []');
|
|
53
|
+
console.log(`[DEBUG] Expected order: [${flowOrder.slice(0, result.length).join(', ')}]`);
|
|
54
|
+
console.log(`[DEBUG] Actual result: [${result.join(', ')}]`);
|
|
55
|
+
}
|
|
31
56
|
return [];
|
|
32
57
|
}
|
|
33
58
|
}
|
package/oclif.manifest.json
CHANGED