luxlabs 1.0.5 → 1.0.6
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/commands/workflows.js +40 -10
- package/package.json +1 -1
package/commands/workflows.js
CHANGED
|
@@ -249,19 +249,26 @@ ${chalk.bold('Examples:')}
|
|
|
249
249
|
const now = new Date().toISOString();
|
|
250
250
|
|
|
251
251
|
if (!localFlow) {
|
|
252
|
-
// New from cloud
|
|
252
|
+
// New from cloud - it's published, so set deploy snapshot
|
|
253
|
+
const cloudNodes = cloudFlow.config?.nodes || [];
|
|
254
|
+
const cloudEdges = cloudFlow.config?.edges || [];
|
|
253
255
|
const newFlow = {
|
|
254
256
|
id: cloudFlow.id,
|
|
255
257
|
name: cloudFlow.name,
|
|
256
258
|
description: cloudFlow.description,
|
|
257
|
-
nodes:
|
|
258
|
-
edges:
|
|
259
|
+
nodes: cloudNodes,
|
|
260
|
+
edges: cloudEdges,
|
|
259
261
|
localVersion: cloudFlow.version || 1,
|
|
260
262
|
publishedVersion: cloudFlow.version || 1,
|
|
261
263
|
cloudVersion: cloudFlow.version || 1,
|
|
262
264
|
lastSyncedAt: now,
|
|
263
265
|
createdAt: cloudFlow.updated_at || cloudFlow.created_at,
|
|
264
266
|
updatedAt: cloudFlow.updated_at,
|
|
267
|
+
// Store deploy snapshot since this is a published flow
|
|
268
|
+
deployedNodes: JSON.parse(JSON.stringify(cloudNodes)),
|
|
269
|
+
deployedEdges: JSON.parse(JSON.stringify(cloudEdges)),
|
|
270
|
+
cloudPublishedAt: cloudFlow.updated_at || now,
|
|
271
|
+
cloudStatus: 'published',
|
|
265
272
|
};
|
|
266
273
|
saveLocalFlow(cloudFlow.id, newFlow);
|
|
267
274
|
newFromCloud++;
|
|
@@ -288,18 +295,25 @@ ${chalk.bold('Examples:')}
|
|
|
288
295
|
saveLocalFlow(cloudFlow.id, updatedFlow);
|
|
289
296
|
conflicts++;
|
|
290
297
|
} else if (cloudHasNewerVersion && !hasLocalChanges) {
|
|
291
|
-
// Update from cloud
|
|
298
|
+
// Update from cloud - replace with newer published version
|
|
299
|
+
const cloudNodes = cloudFlow.config?.nodes || [];
|
|
300
|
+
const cloudEdges = cloudFlow.config?.edges || [];
|
|
292
301
|
const updatedFlow = {
|
|
293
302
|
...localFlow,
|
|
294
303
|
name: cloudFlow.name,
|
|
295
304
|
description: cloudFlow.description,
|
|
296
|
-
nodes:
|
|
297
|
-
edges:
|
|
305
|
+
nodes: cloudNodes,
|
|
306
|
+
edges: cloudEdges,
|
|
298
307
|
localVersion: cloudVersion,
|
|
299
308
|
publishedVersion: cloudVersion,
|
|
300
309
|
cloudVersion,
|
|
301
310
|
lastSyncedAt: now,
|
|
302
311
|
updatedAt: cloudFlow.updated_at,
|
|
312
|
+
// Update deploy snapshot to match new published version
|
|
313
|
+
deployedNodes: JSON.parse(JSON.stringify(cloudNodes)),
|
|
314
|
+
deployedEdges: JSON.parse(JSON.stringify(cloudEdges)),
|
|
315
|
+
cloudPublishedAt: cloudFlow.updated_at || now,
|
|
316
|
+
cloudStatus: 'published',
|
|
303
317
|
};
|
|
304
318
|
saveLocalFlow(cloudFlow.id, updatedFlow);
|
|
305
319
|
synced++;
|
|
@@ -461,15 +475,23 @@ ${chalk.bold('Examples:')}
|
|
|
461
475
|
);
|
|
462
476
|
|
|
463
477
|
const newVersion = publishResponse.data.version || 1;
|
|
478
|
+
const now = new Date().toISOString();
|
|
464
479
|
|
|
465
480
|
// Update local storage with published version and cloud ID
|
|
481
|
+
// IMPORTANT: This must match what the UI's markFlowPublished() does exactly
|
|
466
482
|
const updatedFlow = {
|
|
467
483
|
...newFlow,
|
|
468
484
|
cloudId: cloudId,
|
|
469
485
|
publishedVersion: newVersion,
|
|
470
486
|
cloudVersion: newVersion,
|
|
471
|
-
lastPublishedAt:
|
|
472
|
-
lastSyncedAt:
|
|
487
|
+
lastPublishedAt: now,
|
|
488
|
+
lastSyncedAt: now,
|
|
489
|
+
// Store snapshot of deployed config for change tracking
|
|
490
|
+
deployedNodes: JSON.parse(JSON.stringify(newFlow.nodes || [])),
|
|
491
|
+
deployedEdges: JSON.parse(JSON.stringify(newFlow.edges || [])),
|
|
492
|
+
// Cloud sync tracking - matches markFlowPublished()
|
|
493
|
+
cloudPublishedAt: now,
|
|
494
|
+
cloudStatus: 'published',
|
|
473
495
|
};
|
|
474
496
|
saveLocalFlow(flowId, updatedFlow);
|
|
475
497
|
|
|
@@ -580,15 +602,23 @@ ${chalk.bold('Examples:')}
|
|
|
580
602
|
);
|
|
581
603
|
|
|
582
604
|
const newVersion = data.version || (localFlow.publishedVersion || 0) + 1;
|
|
605
|
+
const now = new Date().toISOString();
|
|
583
606
|
|
|
584
607
|
// Update local storage with new published version
|
|
608
|
+
// IMPORTANT: This must match what the UI's markFlowPublished() does exactly
|
|
585
609
|
const updatedFlow = {
|
|
586
610
|
...localFlow,
|
|
587
611
|
publishedVersion: newVersion,
|
|
588
612
|
cloudVersion: newVersion,
|
|
589
|
-
lastPublishedAt:
|
|
590
|
-
lastSyncedAt:
|
|
613
|
+
lastPublishedAt: now,
|
|
614
|
+
lastSyncedAt: now,
|
|
591
615
|
cloudData: undefined, // Clear any stored conflict data
|
|
616
|
+
// Store snapshot of deployed config for change tracking
|
|
617
|
+
deployedNodes: JSON.parse(JSON.stringify(localFlow.nodes || [])),
|
|
618
|
+
deployedEdges: JSON.parse(JSON.stringify(localFlow.edges || [])),
|
|
619
|
+
// Cloud sync tracking - matches markFlowPublished()
|
|
620
|
+
cloudPublishedAt: now,
|
|
621
|
+
cloudStatus: 'published',
|
|
592
622
|
};
|
|
593
623
|
saveLocalFlow(workflowId, updatedFlow);
|
|
594
624
|
|