@nodestackapp/server 2.5.0 → 2.7.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 +42 -28
- package/dist/NodeStack.d.ts +5 -1
- package/dist/NodeStack.d.ts.map +1 -1
- package/dist/NodeStack.js +117 -18
- package/dist/NodeStack.js.map +1 -1
- package/dist/admin/AdminUIBundler.d.ts.map +1 -1
- package/dist/admin/AdminUIBundler.js +2 -0
- package/dist/admin/AdminUIBundler.js.map +1 -1
- package/dist/admin/ui/css/main.css +40 -3
- package/dist/admin/ui/css/webhooks.css +8 -0
- package/dist/admin/ui/index.html +21479 -17251
- package/dist/admin/ui/js/api-keys.js +1381 -0
- package/dist/admin/ui/js/api.js +8 -0
- package/dist/admin/ui/js/app.js +698 -641
- package/dist/admin/ui/js/apps.js +514 -489
- package/dist/admin/ui/js/collections.js +486 -484
- package/dist/admin/ui/js/command-palette.js +693 -673
- package/dist/admin/ui/js/cron.js +1706 -0
- package/dist/admin/ui/js/database.js +10 -0
- package/dist/admin/ui/js/flows-designer.js +1219 -1076
- package/dist/admin/ui/js/flows.js +947 -890
- package/dist/admin/ui/js/functions-tester.js +1 -1
- package/dist/admin/ui/js/functions-workbench.js +1162 -1101
- package/dist/admin/ui/js/functions.js +983 -979
- package/dist/admin/ui/js/rules.js +1080 -775
- package/dist/admin/ui/js/schema.js +346 -304
- package/dist/admin/ui/js/snapshots.js +338 -0
- package/dist/admin/ui/js/views.js +1 -1
- package/dist/apps/AppManager.d.ts +1 -1
- package/dist/apps/AppManager.d.ts.map +1 -1
- package/dist/apps/AppManager.js +11 -21
- package/dist/apps/AppManager.js.map +1 -1
- package/dist/apps/AppRegistry.d.ts +1 -0
- package/dist/apps/AppRegistry.d.ts.map +1 -1
- package/dist/apps/AppRegistry.js +78 -23
- package/dist/apps/AppRegistry.js.map +1 -1
- package/dist/apps/AppScope.d.ts +2 -1
- package/dist/apps/AppScope.d.ts.map +1 -1
- package/dist/apps/AppScope.js +27 -17
- package/dist/apps/AppScope.js.map +1 -1
- package/dist/auth/ApiKeyService.d.ts +63 -2
- package/dist/auth/ApiKeyService.d.ts.map +1 -1
- package/dist/auth/ApiKeyService.js +518 -8
- package/dist/auth/ApiKeyService.js.map +1 -1
- package/dist/auth/AuthService.d.ts +30 -1
- package/dist/auth/AuthService.d.ts.map +1 -1
- package/dist/auth/AuthService.js +468 -65
- package/dist/auth/AuthService.js.map +1 -1
- package/dist/auth/oauth/AppleProvider.d.ts +2 -0
- package/dist/auth/oauth/AppleProvider.d.ts.map +1 -1
- package/dist/auth/oauth/AppleProvider.js +40 -3
- package/dist/auth/oauth/AppleProvider.js.map +1 -1
- package/dist/auth/oauth/BaseOAuthProvider.d.ts +3 -2
- package/dist/auth/oauth/BaseOAuthProvider.d.ts.map +1 -1
- package/dist/auth/oauth/BaseOAuthProvider.js +29 -3
- package/dist/auth/oauth/BaseOAuthProvider.js.map +1 -1
- package/dist/auth/oauth/DiscordProvider.d.ts.map +1 -1
- package/dist/auth/oauth/DiscordProvider.js +4 -1
- package/dist/auth/oauth/DiscordProvider.js.map +1 -1
- package/dist/auth/oauth/GitHubProvider.d.ts.map +1 -1
- package/dist/auth/oauth/GitHubProvider.js +4 -1
- package/dist/auth/oauth/GitHubProvider.js.map +1 -1
- package/dist/auth/oauth/GoogleProvider.d.ts.map +1 -1
- package/dist/auth/oauth/GoogleProvider.js +4 -1
- package/dist/auth/oauth/GoogleProvider.js.map +1 -1
- package/dist/auth/oauth/MicrosoftProvider.d.ts.map +1 -1
- package/dist/auth/oauth/MicrosoftProvider.js +4 -1
- package/dist/auth/oauth/MicrosoftProvider.js.map +1 -1
- package/dist/auth/oauth/OAuthProviderRegistry.d.ts +6 -2
- package/dist/auth/oauth/OAuthProviderRegistry.d.ts.map +1 -1
- package/dist/auth/oauth/OAuthProviderRegistry.js +25 -10
- package/dist/auth/oauth/OAuthProviderRegistry.js.map +1 -1
- package/dist/auth/oauth/types.d.ts +4 -2
- package/dist/auth/oauth/types.d.ts.map +1 -1
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +228 -12
- package/dist/cli/cli.js.map +1 -1
- package/dist/core/config/ConfigService.d.ts.map +1 -1
- package/dist/core/config/ConfigService.js +5 -3
- package/dist/core/config/ConfigService.js.map +1 -1
- package/dist/core/config/EnvLoader.d.ts +14 -0
- package/dist/core/config/EnvLoader.d.ts.map +1 -1
- package/dist/core/config/EnvLoader.js +44 -0
- package/dist/core/config/EnvLoader.js.map +1 -1
- package/dist/core/container/Container.d.ts +14 -0
- package/dist/core/container/Container.d.ts.map +1 -1
- package/dist/core/container/Container.js +32 -0
- package/dist/core/container/Container.js.map +1 -1
- package/dist/core/container/Tokens.d.ts +2 -0
- package/dist/core/container/Tokens.d.ts.map +1 -1
- package/dist/core/container/Tokens.js +2 -0
- package/dist/core/container/Tokens.js.map +1 -1
- package/dist/core/errors/AppError.d.ts +7 -7
- package/dist/core/errors/AppError.d.ts.map +1 -1
- package/dist/core/errors/AppError.js +18 -14
- package/dist/core/errors/AppError.js.map +1 -1
- package/dist/core/events/EventBus.d.ts.map +1 -1
- package/dist/core/events/EventBus.js +36 -6
- package/dist/core/events/EventBus.js.map +1 -1
- package/dist/core/maintenance/MaintenanceGate.d.ts +47 -0
- package/dist/core/maintenance/MaintenanceGate.d.ts.map +1 -1
- package/dist/core/maintenance/MaintenanceGate.js +265 -7
- package/dist/core/maintenance/MaintenanceGate.js.map +1 -1
- package/dist/core/plugins/PluginManager.d.ts +20 -1
- package/dist/core/plugins/PluginManager.d.ts.map +1 -1
- package/dist/core/plugins/PluginManager.js +231 -146
- package/dist/core/plugins/PluginManager.js.map +1 -1
- package/dist/core/plugins/types.d.ts +48 -31
- package/dist/core/plugins/types.d.ts.map +1 -1
- package/dist/cron/CronParser.d.ts +83 -0
- package/dist/cron/CronParser.d.ts.map +1 -0
- package/dist/cron/CronParser.js +538 -0
- package/dist/cron/CronParser.js.map +1 -0
- package/dist/cron/CronService.d.ts +74 -0
- package/dist/cron/CronService.d.ts.map +1 -0
- package/dist/cron/CronService.js +1254 -0
- package/dist/cron/CronService.js.map +1 -0
- package/dist/cron/types.d.ts +98 -0
- package/dist/cron/types.d.ts.map +1 -0
- package/dist/cron/types.js +3 -0
- package/dist/cron/types.js.map +1 -0
- package/dist/database/DatabaseService.d.ts +4 -1
- package/dist/database/DatabaseService.d.ts.map +1 -1
- package/dist/database/DatabaseService.js +34 -9
- package/dist/database/DatabaseService.js.map +1 -1
- package/dist/database/config/DatabaseConfigService.d.ts +1 -0
- package/dist/database/config/DatabaseConfigService.d.ts.map +1 -1
- package/dist/database/config/DatabaseConfigService.js +4 -2
- package/dist/database/config/DatabaseConfigService.js.map +1 -1
- package/dist/database/drivers/DriverPackageLoader.d.ts +11 -0
- package/dist/database/drivers/DriverPackageLoader.d.ts.map +1 -0
- package/dist/database/drivers/DriverPackageLoader.js +112 -0
- package/dist/database/drivers/DriverPackageLoader.js.map +1 -0
- package/dist/database/drivers/DriverRegistry.d.ts +1 -0
- package/dist/database/drivers/DriverRegistry.d.ts.map +1 -1
- package/dist/database/drivers/DriverRegistry.js +29 -0
- package/dist/database/drivers/DriverRegistry.js.map +1 -1
- package/dist/database/drivers/IDatabaseDriver.d.ts +1 -0
- package/dist/database/drivers/IDatabaseDriver.d.ts.map +1 -1
- package/dist/database/drivers/MssqlDriver.d.ts.map +1 -1
- package/dist/database/drivers/MssqlDriver.js +10 -5
- package/dist/database/drivers/MssqlDriver.js.map +1 -1
- package/dist/database/drivers/NodeSqliteDriver.d.ts.map +1 -1
- package/dist/database/drivers/NodeSqliteDriver.js +15 -1
- package/dist/database/drivers/NodeSqliteDriver.js.map +1 -1
- package/dist/database/drivers/PostgresDriver.d.ts.map +1 -1
- package/dist/database/drivers/PostgresDriver.js +4 -5
- package/dist/database/drivers/PostgresDriver.js.map +1 -1
- package/dist/database/migration/DatabaseMigrationService.d.ts +1 -0
- package/dist/database/migration/DatabaseMigrationService.d.ts.map +1 -1
- package/dist/database/migration/DatabaseMigrationService.js +51 -0
- package/dist/database/migration/DatabaseMigrationService.js.map +1 -1
- package/dist/database/migrations/SystemMigrations.d.ts.map +1 -1
- package/dist/database/migrations/SystemMigrations.js +200 -5
- package/dist/database/migrations/SystemMigrations.js.map +1 -1
- package/dist/flows/FlowEngine.js.map +1 -1
- package/dist/flows/FlowService.d.ts +10 -1
- package/dist/flows/FlowService.d.ts.map +1 -1
- package/dist/flows/FlowService.js +227 -14
- package/dist/flows/FlowService.js.map +1 -1
- package/dist/flows/FlowValidator.d.ts +2 -1
- package/dist/flows/FlowValidator.d.ts.map +1 -1
- package/dist/flows/FlowValidator.js +89 -4
- package/dist/flows/FlowValidator.js.map +1 -1
- package/dist/flows/types.d.ts +20 -3
- package/dist/flows/types.d.ts.map +1 -1
- package/dist/functions/FunctionService.d.ts +10 -2
- package/dist/functions/FunctionService.d.ts.map +1 -1
- package/dist/functions/FunctionService.js +271 -37
- package/dist/functions/FunctionService.js.map +1 -1
- package/dist/functions/runtime/QuickJsWasmRuntime.d.ts.map +1 -1
- package/dist/functions/runtime/QuickJsWasmRuntime.js +189 -177
- package/dist/functions/runtime/QuickJsWasmRuntime.js.map +1 -1
- package/dist/functions/types.d.ts +31 -2
- package/dist/functions/types.d.ts.map +1 -1
- package/dist/http/HttpServer.d.ts +7 -1
- package/dist/http/HttpServer.d.ts.map +1 -1
- package/dist/http/HttpServer.js +187 -8
- package/dist/http/HttpServer.js.map +1 -1
- package/dist/http/controllers/ApiKeyController.d.ts +1 -0
- package/dist/http/controllers/ApiKeyController.d.ts.map +1 -1
- package/dist/http/controllers/ApiKeyController.js +47 -1
- package/dist/http/controllers/ApiKeyController.js.map +1 -1
- package/dist/http/controllers/AuthController.d.ts +12 -0
- package/dist/http/controllers/AuthController.d.ts.map +1 -1
- package/dist/http/controllers/AuthController.js +40 -2
- package/dist/http/controllers/AuthController.js.map +1 -1
- package/dist/http/controllers/CronController.d.ts +63 -0
- package/dist/http/controllers/CronController.d.ts.map +1 -0
- package/dist/http/controllers/CronController.js +92 -0
- package/dist/http/controllers/CronController.js.map +1 -0
- package/dist/http/controllers/DatabaseController.d.ts.map +1 -1
- package/dist/http/controllers/DatabaseController.js +53 -0
- package/dist/http/controllers/DatabaseController.js.map +1 -1
- package/dist/http/controllers/FlowController.d.ts.map +1 -1
- package/dist/http/controllers/FlowController.js +45 -4
- package/dist/http/controllers/FlowController.js.map +1 -1
- package/dist/http/controllers/FunctionController.d.ts.map +1 -1
- package/dist/http/controllers/FunctionController.js +16 -2
- package/dist/http/controllers/FunctionController.js.map +1 -1
- package/dist/http/controllers/HealthController.js +2 -2
- package/dist/http/middleware/AppResolutionMiddleware.d.ts +1 -1
- package/dist/http/middleware/AppResolutionMiddleware.d.ts.map +1 -1
- package/dist/http/middleware/AppResolutionMiddleware.js +2 -3
- package/dist/http/middleware/AppResolutionMiddleware.js.map +1 -1
- package/dist/http/middleware/AuthMiddleware.d.ts.map +1 -1
- package/dist/http/middleware/AuthMiddleware.js +6 -3
- package/dist/http/middleware/AuthMiddleware.js.map +1 -1
- package/dist/http/middleware/ChaosMiddleware.js +6 -6
- package/dist/http/middleware/ChaosMiddleware.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/queue/QueueService.d.ts +9 -0
- package/dist/queue/QueueService.d.ts.map +1 -1
- package/dist/queue/QueueService.js +143 -60
- package/dist/queue/QueueService.js.map +1 -1
- package/dist/queue/drivers/SqliteQueueDriver.d.ts +3 -0
- package/dist/queue/drivers/SqliteQueueDriver.d.ts.map +1 -1
- package/dist/queue/drivers/SqliteQueueDriver.js +315 -255
- package/dist/queue/drivers/SqliteQueueDriver.js.map +1 -1
- package/dist/records/FtsService.d.ts +7 -3
- package/dist/records/FtsService.d.ts.map +1 -1
- package/dist/records/FtsService.js +69 -5
- package/dist/records/FtsService.js.map +1 -1
- package/dist/records/QueryFilterParser.d.ts.map +1 -1
- package/dist/records/QueryFilterParser.js +58 -20
- package/dist/records/QueryFilterParser.js.map +1 -1
- package/dist/records/RecordSanitizer.d.ts.map +1 -1
- package/dist/records/RecordSanitizer.js +32 -4
- package/dist/records/RecordSanitizer.js.map +1 -1
- package/dist/records/RecordService.d.ts +6 -0
- package/dist/records/RecordService.d.ts.map +1 -1
- package/dist/records/RecordService.js +95 -14
- package/dist/records/RecordService.js.map +1 -1
- package/dist/records/RecordValidator.d.ts +10 -0
- package/dist/records/RecordValidator.d.ts.map +1 -1
- package/dist/records/RecordValidator.js +110 -2
- package/dist/records/RecordValidator.js.map +1 -1
- package/dist/records/fts/IFtsDriver.d.ts +7 -6
- package/dist/records/fts/IFtsDriver.d.ts.map +1 -1
- package/dist/records/fts/MssqlFtsDriver.d.ts +5 -1
- package/dist/records/fts/MssqlFtsDriver.d.ts.map +1 -1
- package/dist/records/fts/MssqlFtsDriver.js +35 -3
- package/dist/records/fts/MssqlFtsDriver.js.map +1 -1
- package/dist/records/fts/PostgresFtsDriver.d.ts +9 -2
- package/dist/records/fts/PostgresFtsDriver.d.ts.map +1 -1
- package/dist/records/fts/PostgresFtsDriver.js +116 -11
- package/dist/records/fts/PostgresFtsDriver.js.map +1 -1
- package/dist/records/fts/SqliteFts5Driver.d.ts +7 -1
- package/dist/records/fts/SqliteFts5Driver.d.ts.map +1 -1
- package/dist/records/fts/SqliteFts5Driver.js +66 -6
- package/dist/records/fts/SqliteFts5Driver.js.map +1 -1
- package/dist/schema/OpenApiGenerator.d.ts.map +1 -1
- package/dist/schema/OpenApiGenerator.js +103 -3
- package/dist/schema/OpenApiGenerator.js.map +1 -1
- package/dist/schema/models/Field.d.ts +1 -0
- package/dist/schema/models/Field.d.ts.map +1 -1
- package/dist/snapshots/SnapshotService.d.ts.map +1 -1
- package/dist/snapshots/SnapshotService.js +21 -9
- package/dist/snapshots/SnapshotService.js.map +1 -1
- package/dist/snapshots/drivers/LogicalSnapshotDriver.d.ts.map +1 -1
- package/dist/snapshots/drivers/LogicalSnapshotDriver.js +2 -0
- package/dist/snapshots/drivers/LogicalSnapshotDriver.js.map +1 -1
- package/dist/templates/definitions/ecommerce.js +6 -6
- package/dist/templates/definitions/ecommerce.js.map +1 -1
- package/dist/webhooks/WebhookService.js +1 -1
- package/package.json +5 -3
|
@@ -1,1076 +1,1219 @@
|
|
|
1
|
-
// Functions Flow Visual Designer & Workbench Module for NodeStack Admin UI
|
|
2
|
-
// Provides Visual Step Card Builder, Live Auto-Layout SVG Diagram, and Interactive Test Runner
|
|
3
|
-
|
|
4
|
-
let designerState = {
|
|
5
|
-
activeFlow: null,
|
|
6
|
-
activeMode: 'visual', // 'visual' | 'code'
|
|
7
|
-
cmDslEditor: null,
|
|
8
|
-
selectedStepName: null,
|
|
9
|
-
isTestDrawerOpen: false,
|
|
10
|
-
testPayload: '{\n "order": {\n "amount": 250,\n "discount": 25\n }\n}',
|
|
11
|
-
latestExecution: null,
|
|
12
|
-
addStepSelectedType: 'Task',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
if (typeof window !== 'undefined') {
|
|
16
|
-
window.designerState = designerState;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// ==========================================
|
|
20
|
-
// 1. Navigation & Workbench Shell
|
|
21
|
-
// ==========================================
|
|
22
|
-
|
|
23
|
-
function getDesignerFlowsApiBase() {
|
|
24
|
-
if (typeof getFlowsApiBase === 'function') return getFlowsApiBase();
|
|
25
|
-
const slug = typeof getActiveAppSlug === 'function' ? getActiveAppSlug() : (typeof state !== 'undefined' && state?.activeApp?.slug ? state.activeApp.slug : 'default');
|
|
26
|
-
return slug && slug !== 'default' ? `/api/apps/${slug}/flows` : '/api/flows';
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function getDesignerFunctionsApiBase() {
|
|
30
|
-
if (typeof getFunctionsApiBase === 'function') return getFunctionsApiBase();
|
|
31
|
-
const slug = typeof getActiveAppSlug === 'function' ? getActiveAppSlug() : (typeof state !== 'undefined' && state?.activeApp?.slug ? state.activeApp.slug : 'default');
|
|
32
|
-
return slug && slug !== 'default' ? `/api/apps/${slug}/functions` : '/api/functions';
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function openFlowDesigner(flowId, openTestDrawer = false, pushState = true) {
|
|
36
|
-
try {
|
|
37
|
-
const base = getDesignerFlowsApiBase();
|
|
38
|
-
const flow = await api(`${base}/${encodeURIComponent(flowId)}`);
|
|
39
|
-
flowsState.currentView = 'designer';
|
|
40
|
-
flowsState.activeFlowForEdit = flow;
|
|
41
|
-
designerState.activeFlow = JSON.parse(JSON.stringify(flow));
|
|
42
|
-
designerState.latestExecution = null;
|
|
43
|
-
designerState.isTestDrawerOpen = !!openTestDrawer;
|
|
44
|
-
|
|
45
|
-
if (pushState && typeof updateUrl === 'function') {
|
|
46
|
-
const flowIdentifier = flow.name ? encodeURIComponent(flow.name) : encodeURIComponent(flow.id);
|
|
47
|
-
updateUrl('/_/flows/' + flowIdentifier);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (typeof updateBreadcrumbs === 'function') {
|
|
51
|
-
updateBreadcrumbs();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (typeof loadFunctionsForPicker === 'function') {
|
|
55
|
-
await loadFunctionsForPicker();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
renderFlowDesignerWorkbench(designerState.activeFlow);
|
|
59
|
-
} catch (err) {
|
|
60
|
-
toast('Failed to load flow: ' + (err.message || err), 'error');
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function closeFlowDesigner(pushState = true) {
|
|
65
|
-
flowsState.currentView = 'list';
|
|
66
|
-
flowsState.activeFlowForEdit = null;
|
|
67
|
-
designerState.activeFlow = null;
|
|
68
|
-
designerState.isTestDrawerOpen = false;
|
|
69
|
-
|
|
70
|
-
if (pushState && typeof updateUrl === 'function') {
|
|
71
|
-
const sub = (typeof flowsState !== 'undefined' && flowsState.subTab === 'executions') ? '/executions' : '';
|
|
72
|
-
updateUrl('/_/flows' + sub);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (typeof updateBreadcrumbs === 'function') {
|
|
76
|
-
updateBreadcrumbs();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (typeof renderFlowsView === 'function') {
|
|
80
|
-
renderFlowsView();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function renderTriggerConfigHtml(flow) {
|
|
85
|
-
const triggerType = flow.triggerType || 'http';
|
|
86
|
-
|
|
87
|
-
if (triggerType === 'event') {
|
|
88
|
-
return `
|
|
89
|
-
<input
|
|
90
|
-
type="text"
|
|
91
|
-
id="flow-edit-event-trigger"
|
|
92
|
-
class="flow-field-input"
|
|
93
|
-
placeholder="collection:action (e.g. orders:create)"
|
|
94
|
-
value="${escapeHtml(flow.eventTrigger || '')}"
|
|
95
|
-
style="width: 190px; padding: 0.25rem 0.5rem; font-size: 0.8rem; font-family: var(--font-mono, monospace);"
|
|
96
|
-
title="Triggered automatically on database record event (e.g. orders:create, users:update, *:delete)"
|
|
97
|
-
onchange="updateFlowMeta('eventTrigger', this.value)"
|
|
98
|
-
/>
|
|
99
|
-
<span style="font-size: 0.72rem; color: var(--text-muted); cursor: help;" title="Format: <collection>:<action> Examples: • orders:create - Run when order is created • users:update - Run when user is updated • *:delete - Run when any record is deleted">ℹ️</span>
|
|
100
|
-
`;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (triggerType === '
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
<div style="display: flex; align-items: center; gap:
|
|
286
|
-
<
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
if (
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
if (
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
toast('
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
if (
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
if (
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
if (
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
} else
|
|
631
|
-
|
|
632
|
-
if (
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
if (
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
function
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
if (
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
const
|
|
778
|
-
if (
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
if (!
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
return
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
if (
|
|
979
|
-
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
}
|
|
1
|
+
// Functions Flow Visual Designer & Workbench Module for NodeStack Admin UI
|
|
2
|
+
// Provides Visual Step Card Builder, Live Auto-Layout SVG Diagram, and Interactive Test Runner
|
|
3
|
+
|
|
4
|
+
let designerState = {
|
|
5
|
+
activeFlow: null,
|
|
6
|
+
activeMode: 'visual', // 'visual' | 'code'
|
|
7
|
+
cmDslEditor: null,
|
|
8
|
+
selectedStepName: null,
|
|
9
|
+
isTestDrawerOpen: false,
|
|
10
|
+
testPayload: '{\n "order": {\n "amount": 250,\n "discount": 25\n }\n}',
|
|
11
|
+
latestExecution: null,
|
|
12
|
+
addStepSelectedType: 'Task',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
if (typeof window !== 'undefined') {
|
|
16
|
+
window.designerState = designerState;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// ==========================================
|
|
20
|
+
// 1. Navigation & Workbench Shell
|
|
21
|
+
// ==========================================
|
|
22
|
+
|
|
23
|
+
function getDesignerFlowsApiBase() {
|
|
24
|
+
if (typeof getFlowsApiBase === 'function') return getFlowsApiBase();
|
|
25
|
+
const slug = typeof getActiveAppSlug === 'function' ? getActiveAppSlug() : (typeof state !== 'undefined' && state?.activeApp?.slug ? state.activeApp.slug : 'default');
|
|
26
|
+
return slug && slug !== 'default' ? `/api/apps/${slug}/flows` : '/api/flows';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function getDesignerFunctionsApiBase() {
|
|
30
|
+
if (typeof getFunctionsApiBase === 'function') return getFunctionsApiBase();
|
|
31
|
+
const slug = typeof getActiveAppSlug === 'function' ? getActiveAppSlug() : (typeof state !== 'undefined' && state?.activeApp?.slug ? state.activeApp.slug : 'default');
|
|
32
|
+
return slug && slug !== 'default' ? `/api/apps/${slug}/functions` : '/api/functions';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function openFlowDesigner(flowId, openTestDrawer = false, pushState = true) {
|
|
36
|
+
try {
|
|
37
|
+
const base = getDesignerFlowsApiBase();
|
|
38
|
+
const flow = await api(`${base}/${encodeURIComponent(flowId)}`);
|
|
39
|
+
flowsState.currentView = 'designer';
|
|
40
|
+
flowsState.activeFlowForEdit = flow;
|
|
41
|
+
designerState.activeFlow = JSON.parse(JSON.stringify(flow));
|
|
42
|
+
designerState.latestExecution = null;
|
|
43
|
+
designerState.isTestDrawerOpen = !!openTestDrawer;
|
|
44
|
+
|
|
45
|
+
if (pushState && typeof updateUrl === 'function') {
|
|
46
|
+
const flowIdentifier = flow.name ? encodeURIComponent(flow.name) : encodeURIComponent(flow.id);
|
|
47
|
+
updateUrl('/_/flows/' + flowIdentifier);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (typeof updateBreadcrumbs === 'function') {
|
|
51
|
+
updateBreadcrumbs();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (typeof loadFunctionsForPicker === 'function') {
|
|
55
|
+
await loadFunctionsForPicker();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
renderFlowDesignerWorkbench(designerState.activeFlow);
|
|
59
|
+
} catch (err) {
|
|
60
|
+
toast('Failed to load flow: ' + (err.message || err), 'error');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function closeFlowDesigner(pushState = true) {
|
|
65
|
+
flowsState.currentView = 'list';
|
|
66
|
+
flowsState.activeFlowForEdit = null;
|
|
67
|
+
designerState.activeFlow = null;
|
|
68
|
+
designerState.isTestDrawerOpen = false;
|
|
69
|
+
|
|
70
|
+
if (pushState && typeof updateUrl === 'function') {
|
|
71
|
+
const sub = (typeof flowsState !== 'undefined' && flowsState.subTab === 'executions') ? '/executions' : '';
|
|
72
|
+
updateUrl('/_/flows' + sub);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (typeof updateBreadcrumbs === 'function') {
|
|
76
|
+
updateBreadcrumbs();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (typeof renderFlowsView === 'function') {
|
|
80
|
+
renderFlowsView();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function renderTriggerConfigHtml(flow) {
|
|
85
|
+
const triggerType = flow.triggerType || 'http';
|
|
86
|
+
|
|
87
|
+
if (triggerType === 'event') {
|
|
88
|
+
return `
|
|
89
|
+
<input
|
|
90
|
+
type="text"
|
|
91
|
+
id="flow-edit-event-trigger"
|
|
92
|
+
class="flow-field-input"
|
|
93
|
+
placeholder="collection:action (e.g. orders:create)"
|
|
94
|
+
value="${escapeHtml(flow.eventTrigger || '')}"
|
|
95
|
+
style="width: 190px; padding: 0.25rem 0.5rem; font-size: 0.8rem; font-family: var(--font-mono, monospace);"
|
|
96
|
+
title="Triggered automatically on database record event (e.g. orders:create, users:update, *:delete)"
|
|
97
|
+
onchange="updateFlowMeta('eventTrigger', this.value)"
|
|
98
|
+
/>
|
|
99
|
+
<span style="font-size: 0.72rem; color: var(--text-muted); cursor: help;" title="Format: <collection>:<action> Examples: • orders:create - Run when order is created • users:update - Run when user is updated • *:delete - Run when any record is deleted">ℹ️</span>
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (triggerType === 'cron') {
|
|
104
|
+
return `
|
|
105
|
+
<div style="display: flex; align-items: center; gap: 6px;">
|
|
106
|
+
<input
|
|
107
|
+
type="text"
|
|
108
|
+
id="flow-edit-cron-schedule"
|
|
109
|
+
class="flow-field-input"
|
|
110
|
+
placeholder="e.g. 0 * * * * or */15 * * * *"
|
|
111
|
+
value="${escapeHtml(flow.cronSchedule || '')}"
|
|
112
|
+
style="width: 140px; padding: 0.25rem 0.5rem; font-size: 0.8rem; font-family: var(--font-mono, monospace);"
|
|
113
|
+
title="5-field cron expression"
|
|
114
|
+
oninput="handleFlowCronScheduleChange(this.value)"
|
|
115
|
+
/>
|
|
116
|
+
<input
|
|
117
|
+
type="text"
|
|
118
|
+
id="flow-edit-cron-timezone"
|
|
119
|
+
class="flow-field-input"
|
|
120
|
+
placeholder="Timezone"
|
|
121
|
+
list="iana-timezones-list"
|
|
122
|
+
value="${escapeHtml(flow.cronTimezone || 'UTC')}"
|
|
123
|
+
style="width: 110px; padding: 0.25rem 0.5rem; font-size: 0.8rem;"
|
|
124
|
+
title="IANA timezone (e.g. UTC, America/New_York)"
|
|
125
|
+
oninput="handleFlowCronTimezoneChange(this.value)"
|
|
126
|
+
/>
|
|
127
|
+
<span id="flow-cron-preview" style="font-size: 0.72rem; color: var(--text-muted); max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
|
128
|
+
${flow.cronSchedule ? '⏱️ Scheduled' : 'Enter expression'}
|
|
129
|
+
</span>
|
|
130
|
+
</div>
|
|
131
|
+
`;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (triggerType === 'http') {
|
|
135
|
+
const base = getDesignerFlowsApiBase();
|
|
136
|
+
const endpointPath = `${base}/${flow.id}/execute`;
|
|
137
|
+
const authPolicy = flow.authPolicy || 'public';
|
|
138
|
+
return `
|
|
139
|
+
<span style="display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; color: var(--text-muted);">
|
|
140
|
+
Endpoint:
|
|
141
|
+
<code
|
|
142
|
+
style="font-size: 0.72rem; color: var(--accent-primary); background: var(--bg-main, #0f172a); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border-subtle); cursor: pointer;"
|
|
143
|
+
data-endpoint="POST ${endpointPath}"
|
|
144
|
+
title="Click to copy endpoint"
|
|
145
|
+
onclick="if (navigator.clipboard) { navigator.clipboard.writeText(this.getAttribute('data-endpoint')); toast('Copied endpoint: ' + this.getAttribute('data-endpoint'), 'success'); }"
|
|
146
|
+
>
|
|
147
|
+
POST ${endpointPath} 📋
|
|
148
|
+
</code>
|
|
149
|
+
</span>
|
|
150
|
+
<span style="font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-left: 4px;">Auth:</span>
|
|
151
|
+
<select
|
|
152
|
+
id="flow-edit-auth-policy"
|
|
153
|
+
class="flow-field-select"
|
|
154
|
+
aria-label="HTTP Flow Authorization Policy"
|
|
155
|
+
style="width: 130px; padding: 0.25rem 0.5rem; font-size: 0.8rem; font-weight: 600;"
|
|
156
|
+
onchange="handleFlowAuthPolicyChange(this.value)"
|
|
157
|
+
>
|
|
158
|
+
<option value="admin" ${authPolicy === 'admin' ? 'selected' : ''}>Admin Only</option>
|
|
159
|
+
<option value="auth" ${authPolicy === 'auth' ? 'selected' : ''}>User Token</option>
|
|
160
|
+
<option value="apiKey" ${authPolicy === 'apiKey' ? 'selected' : ''}>API Key</option>
|
|
161
|
+
<option value="custom" ${authPolicy === 'custom' ? 'selected' : ''}>Custom Rule</option>
|
|
162
|
+
<option value="public" ${authPolicy === 'public' ? 'selected' : ''}>Public</option>
|
|
163
|
+
</select>
|
|
164
|
+
`;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Manual
|
|
168
|
+
return `
|
|
169
|
+
<span style="font-size: 0.75rem; color: var(--text-muted); font-style: italic;">
|
|
170
|
+
Triggered on-demand via Run / Test Flow
|
|
171
|
+
</span>
|
|
172
|
+
`;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function handleFlowTriggerTypeChange(newType) {
|
|
176
|
+
if (!designerState.activeFlow) return;
|
|
177
|
+
designerState.activeFlow.triggerType = newType;
|
|
178
|
+
if (newType === 'event') {
|
|
179
|
+
if (!designerState.activeFlow.eventTrigger) {
|
|
180
|
+
designerState.activeFlow.eventTrigger = 'orders:create';
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
designerState.activeFlow.eventTrigger = null;
|
|
184
|
+
}
|
|
185
|
+
if (newType === 'cron') {
|
|
186
|
+
if (!designerState.activeFlow.cronSchedule) {
|
|
187
|
+
designerState.activeFlow.cronSchedule = '0 * * * *';
|
|
188
|
+
}
|
|
189
|
+
if (!designerState.activeFlow.cronTimezone) {
|
|
190
|
+
designerState.activeFlow.cronTimezone = 'UTC';
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
designerState.activeFlow.cronSchedule = null;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const configArea = document.getElementById('flow-trigger-config-area');
|
|
197
|
+
if (configArea) {
|
|
198
|
+
configArea.innerHTML = renderTriggerConfigHtml(designerState.activeFlow);
|
|
199
|
+
}
|
|
200
|
+
const rulePanel = document.getElementById('flow-custom-rule-panel');
|
|
201
|
+
if (rulePanel) {
|
|
202
|
+
const showCustom = newType === 'http' && (designerState.activeFlow.authPolicy || 'public') === 'custom';
|
|
203
|
+
rulePanel.style.display = showCustom ? 'block' : 'none';
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function handleFlowCronScheduleChange(val) {
|
|
208
|
+
if (!designerState.activeFlow) return;
|
|
209
|
+
designerState.activeFlow.cronSchedule = val.trim();
|
|
210
|
+
updateFlowCronPreview();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function handleFlowCronTimezoneChange(val) {
|
|
214
|
+
if (!designerState.activeFlow) return;
|
|
215
|
+
designerState.activeFlow.cronTimezone = val.trim() || 'UTC';
|
|
216
|
+
updateFlowCronPreview();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
let flowPreviewTimer = null;
|
|
220
|
+
function updateFlowCronPreview() {
|
|
221
|
+
clearTimeout(flowPreviewTimer);
|
|
222
|
+
flowPreviewTimer = setTimeout(async () => {
|
|
223
|
+
const el = document.getElementById('flow-cron-preview');
|
|
224
|
+
if (!el || !designerState.activeFlow) return;
|
|
225
|
+
const expr = designerState.activeFlow.cronSchedule;
|
|
226
|
+
const tz = designerState.activeFlow.cronTimezone || 'UTC';
|
|
227
|
+
if (!expr || expr.split(/\s+/).length < 5) {
|
|
228
|
+
el.textContent = 'Enter 5-field cron';
|
|
229
|
+
el.style.color = 'var(--text-muted)';
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
try {
|
|
233
|
+
const slug = typeof getActiveAppSlug === 'function' ? getActiveAppSlug() : 'default';
|
|
234
|
+
const url = slug && slug !== 'default' ? `/api/apps/${slug}/cron/preview` : '/api/cron/preview';
|
|
235
|
+
const res = await api(url, {
|
|
236
|
+
method: 'POST',
|
|
237
|
+
headers: { 'Content-Type': 'application/json' },
|
|
238
|
+
body: JSON.stringify({ cronExpression: expr, timezone: tz, count: 1 })
|
|
239
|
+
});
|
|
240
|
+
if (res && res.valid) {
|
|
241
|
+
el.textContent = res.description || 'Valid cron';
|
|
242
|
+
el.style.color = 'var(--accent-success)';
|
|
243
|
+
} else {
|
|
244
|
+
el.textContent = res?.error || 'Invalid cron';
|
|
245
|
+
el.style.color = 'var(--accent-danger)';
|
|
246
|
+
}
|
|
247
|
+
} catch (_) {
|
|
248
|
+
el.textContent = 'Invalid cron';
|
|
249
|
+
el.style.color = 'var(--accent-danger)';
|
|
250
|
+
}
|
|
251
|
+
}, 400);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function handleFlowAuthPolicyChange(policy) {
|
|
255
|
+
if (!designerState.activeFlow) return;
|
|
256
|
+
designerState.activeFlow.authPolicy = policy;
|
|
257
|
+
const rulePanel = document.getElementById('flow-custom-rule-panel');
|
|
258
|
+
if (rulePanel) {
|
|
259
|
+
const showCustom = (designerState.activeFlow.triggerType || 'http') === 'http' && policy === 'custom';
|
|
260
|
+
rulePanel.style.display = showCustom ? 'block' : 'none';
|
|
261
|
+
if (showCustom && typeof renderStandaloneRuleEditor === 'function') {
|
|
262
|
+
if (typeof initStandaloneRule === 'function' && (!state.standaloneRules || !state.standaloneRules.flow_invoke)) {
|
|
263
|
+
initStandaloneRule('flow_invoke', designerState.activeFlow.invokeRule || '@request.auth.id != ""');
|
|
264
|
+
}
|
|
265
|
+
rulePanel.innerHTML = renderStandaloneRuleEditor('flow_invoke');
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function renderFlowDesignerWorkbench(flow) {
|
|
271
|
+
const container = document.getElementById('page-view-flows') || document.getElementById('main-body');
|
|
272
|
+
if (!container || !flow) return;
|
|
273
|
+
if (typeof initStandaloneRule === 'function') {
|
|
274
|
+
initStandaloneRule('flow_invoke', flow.invokeRule || '@request.auth.id != ""');
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
container.innerHTML = `
|
|
278
|
+
<div class="flows-container">
|
|
279
|
+
<!-- Toolbar -->
|
|
280
|
+
<div class="flows-designer-toolbar">
|
|
281
|
+
<div style="display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;">
|
|
282
|
+
<button class="btn btn-secondary btn-sm" onclick="closeFlowDesigner()">
|
|
283
|
+
← Back to Flows
|
|
284
|
+
</button>
|
|
285
|
+
<div style="display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;">
|
|
286
|
+
<input
|
|
287
|
+
type="text"
|
|
288
|
+
id="flow-edit-name"
|
|
289
|
+
class="flow-field-input"
|
|
290
|
+
value="${escapeHtml(flow.name)}"
|
|
291
|
+
style="font-weight: 700; font-size: 1rem; width: 210px;"
|
|
292
|
+
onchange="updateFlowMeta('name', this.value)"
|
|
293
|
+
/>
|
|
294
|
+
${flow.id ? `<code style="font-size: 11px; color: var(--text-muted); background: var(--bg-card); border: 1px solid var(--border-subtle); padding: 3px 6px; border-radius: 4px;" title="Unique Flow ID">id: ${escapeHtml(flow.id)}</code>` : ''}
|
|
295
|
+
<div style="display: flex; align-items: center; gap: 0.4rem; background: var(--bg-card); padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border-subtle);">
|
|
296
|
+
<span style="font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;">Trigger:</span>
|
|
297
|
+
<select
|
|
298
|
+
id="flow-edit-trigger-type"
|
|
299
|
+
class="flow-field-select"
|
|
300
|
+
style="width: 110px; padding: 0.25rem 0.5rem; font-size: 0.8rem; font-weight: 600;"
|
|
301
|
+
onchange="handleFlowTriggerTypeChange(this.value)"
|
|
302
|
+
>
|
|
303
|
+
<option value="http" ${flow.triggerType === 'http' ? 'selected' : ''}>HTTP API</option>
|
|
304
|
+
<option value="event" ${flow.triggerType === 'event' ? 'selected' : ''}>DB Event</option>
|
|
305
|
+
<option value="cron" ${flow.triggerType === 'cron' ? 'selected' : ''}>Cron Schedule</option>
|
|
306
|
+
<option value="manual" ${flow.triggerType === 'manual' ? 'selected' : ''}>Manual</option>
|
|
307
|
+
</select>
|
|
308
|
+
<div id="flow-trigger-config-area" style="display: flex; align-items: center; gap: 6px;">
|
|
309
|
+
${renderTriggerConfigHtml(flow)}
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
<div style="display: flex; align-items: center; gap: 0.4rem; background: var(--bg-card); padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border-subtle);" title="Maximum concurrent instances allowed to run simultaneously (empty = unlimited)">
|
|
313
|
+
<span style="font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;">Concurrency:</span>
|
|
314
|
+
<input
|
|
315
|
+
type="number"
|
|
316
|
+
id="flow-edit-concurrency"
|
|
317
|
+
class="flow-field-input"
|
|
318
|
+
min="1"
|
|
319
|
+
step="1"
|
|
320
|
+
placeholder="Unlimited"
|
|
321
|
+
value="${flow.maxConcurrentExecutions ? escapeHtml(String(flow.maxConcurrentExecutions)) : ''}"
|
|
322
|
+
style="width: 90px; padding: 0.25rem 0.5rem; font-size: 0.8rem; font-weight: 600;"
|
|
323
|
+
onchange="updateFlowMeta('maxConcurrentExecutions', this.value !== '' ? parseInt(this.value, 10) : null)"
|
|
324
|
+
/>
|
|
325
|
+
</div>
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
|
|
329
|
+
<div style="display: flex; align-items: center; gap: 0.5rem;">
|
|
330
|
+
<div style="display: flex; background: var(--bg-hover-subtle); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 2px;">
|
|
331
|
+
<button
|
|
332
|
+
class="btn btn-sm ${designerState.activeMode === 'visual' ? 'btn-primary' : 'btn-secondary'}"
|
|
333
|
+
style="border:none; padding: 4px 12px; font-weight: 600;"
|
|
334
|
+
onclick="switchDesignerMode('visual')"
|
|
335
|
+
>
|
|
336
|
+
Visual
|
|
337
|
+
</button>
|
|
338
|
+
<button
|
|
339
|
+
class="btn btn-sm ${designerState.activeMode === 'code' ? 'btn-primary' : 'btn-secondary'}"
|
|
340
|
+
style="border:none; padding: 4px 12px; font-weight: 600;"
|
|
341
|
+
onclick="switchDesignerMode('code')"
|
|
342
|
+
>
|
|
343
|
+
Code DSL
|
|
344
|
+
</button>
|
|
345
|
+
</div>
|
|
346
|
+
<button class="btn btn-secondary btn-sm" onclick="toggleTestDrawer()" title="Test Run Flow" style="font-weight: 600;">
|
|
347
|
+
▶ Test Flow
|
|
348
|
+
</button>
|
|
349
|
+
<button class="btn btn-primary btn-sm" onclick="saveFlowChanges()" style="font-weight: 600;">
|
|
350
|
+
Save Flow
|
|
351
|
+
</button>
|
|
352
|
+
</div>
|
|
353
|
+
</div>
|
|
354
|
+
|
|
355
|
+
<!-- Conditional Custom Invoke Rule Panel (HTTP Trigger + Custom Policy) -->
|
|
356
|
+
<div id="flow-custom-rule-panel" style="display: ${(flow.triggerType || 'http') === 'http' && flow.authPolicy === 'custom' ? 'block' : 'none'}; padding: 0.75rem 1.25rem; background: var(--bg-card); border-bottom: 1px solid var(--border-subtle);">
|
|
357
|
+
${typeof renderStandaloneRuleEditor === 'function' ? renderStandaloneRuleEditor('flow_invoke') : ''}
|
|
358
|
+
</div>
|
|
359
|
+
|
|
360
|
+
<!-- Main Designer Workspace -->
|
|
361
|
+
${designerState.activeMode === 'visual' ? renderVisualWorkspaceHtml(flow) : renderCodeDslWorkspaceHtml(flow)}
|
|
362
|
+
|
|
363
|
+
<!-- Slide-over Test Runner Drawer -->
|
|
364
|
+
<div id="flow-test-drawer" class="flow-test-drawer ${designerState.isTestDrawerOpen ? 'open' : ''}">
|
|
365
|
+
${renderTestDrawerHtml(flow)}
|
|
366
|
+
</div>
|
|
367
|
+
</div>
|
|
368
|
+
`;
|
|
369
|
+
|
|
370
|
+
if (designerState.activeMode === 'visual') {
|
|
371
|
+
renderSvgFlowchart(flow);
|
|
372
|
+
} else {
|
|
373
|
+
initDslCodeMirror(flow);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// ==========================================
|
|
378
|
+
// 2. Visual Builder & Step Cards Pane
|
|
379
|
+
// ==========================================
|
|
380
|
+
|
|
381
|
+
function renderVisualWorkspaceHtml(flow) {
|
|
382
|
+
const states = flow.definition?.states || {};
|
|
383
|
+
const stateKeys = Object.keys(states);
|
|
384
|
+
const startAt = flow.definition?.startAt || stateKeys[0] || '';
|
|
385
|
+
|
|
386
|
+
return `
|
|
387
|
+
<div class="flows-split-pane">
|
|
388
|
+
<!-- Left: Step Sequence Editor -->
|
|
389
|
+
<div class="flows-steps-pane">
|
|
390
|
+
<div class="flows-steps-header">
|
|
391
|
+
<div style="display: flex; align-items: center; gap: 0.5rem;">
|
|
392
|
+
<span style="font-size: 0.75rem; color: var(--text-muted); font-weight: 700;">START AT:</span>
|
|
393
|
+
<select
|
|
394
|
+
class="flow-field-select"
|
|
395
|
+
style="width: 160px; font-weight: 600; padding: 0.35rem 0.6rem;"
|
|
396
|
+
onchange="updateFlowStartAt(this.value)"
|
|
397
|
+
>
|
|
398
|
+
${stateKeys.map(k => `<option value="${escapeHtml(k)}" ${k === startAt ? 'selected' : ''}>${escapeHtml(k)}</option>`).join('')}
|
|
399
|
+
</select>
|
|
400
|
+
</div>
|
|
401
|
+
<button class="btn btn-primary btn-sm" onclick="openAddStepModal()" style="font-weight: 600; font-size: 0.8rem; padding: 0.35rem 0.85rem;">
|
|
402
|
+
+ Add Step
|
|
403
|
+
</button>
|
|
404
|
+
</div>
|
|
405
|
+
|
|
406
|
+
<div class="flows-steps-list" id="flows-steps-list">
|
|
407
|
+
${stateKeys.length === 0 ? `
|
|
408
|
+
<div style="text-align: center; padding: 3rem 1.5rem; color: var(--text-muted);">
|
|
409
|
+
<p style="margin: 0 0 1rem 0;">No steps defined in this flow.</p>
|
|
410
|
+
<button class="btn btn-primary btn-sm" onclick="openAddStepModal()">+ Add First Step</button>
|
|
411
|
+
</div>
|
|
412
|
+
` : stateKeys.map((stepName, idx) => renderStepCardHtml(stepName, states[stepName], idx, stateKeys)).join('')}
|
|
413
|
+
</div>
|
|
414
|
+
</div>
|
|
415
|
+
|
|
416
|
+
<!-- Right: Live Auto-Layout SVG Diagram -->
|
|
417
|
+
<div class="flows-diagram-pane">
|
|
418
|
+
<div class="flows-diagram-header">
|
|
419
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
420
|
+
<span style="font-size: 0.75rem; color: var(--text-muted); font-weight: 700;">LIVE FLOW DIAGRAM</span>
|
|
421
|
+
<span style="font-size: 0.7rem; color: var(--text-subtle); font-weight: 500;">(Click a node to select)</span>
|
|
422
|
+
</div>
|
|
423
|
+
</div>
|
|
424
|
+
<div id="flow-diagram-container" class="flows-diagram-canvas-wrap"></div>
|
|
425
|
+
</div>
|
|
426
|
+
</div>
|
|
427
|
+
`;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// ==========================================
|
|
431
|
+
// 6. Code DSL View (CodeMirror)
|
|
432
|
+
// ==========================================
|
|
433
|
+
|
|
434
|
+
function renderCodeDslWorkspaceHtml(flow) {
|
|
435
|
+
return `
|
|
436
|
+
<div style="background: var(--bg-card); border: 1px solid var(--border-default); border-radius: 10px; height: 100%; min-height: 0; flex: 1; display: flex; flex-direction: column;">
|
|
437
|
+
<div style="padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between;">
|
|
438
|
+
<span style="font-size: 0.85rem; font-weight: 700; color: var(--text-muted);">
|
|
439
|
+
JSON Definition (Flow States Language / DSL)
|
|
440
|
+
</span>
|
|
441
|
+
<button class="btn btn-secondary btn-sm" onclick="syncDslToVisual()" style="font-weight: 600;">
|
|
442
|
+
Apply Changes to Visual
|
|
443
|
+
</button>
|
|
444
|
+
</div>
|
|
445
|
+
<div id="flow-dsl-editor-container" style="flex: 1; overflow: hidden;"></div>
|
|
446
|
+
</div>
|
|
447
|
+
`;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function initDslCodeMirror(flow) {
|
|
451
|
+
const el = document.getElementById('flow-dsl-editor-container');
|
|
452
|
+
if (!el || typeof CodeMirror === 'undefined') return;
|
|
453
|
+
|
|
454
|
+
el.innerHTML = '';
|
|
455
|
+
designerState.cmDslEditor = CodeMirror(el, {
|
|
456
|
+
value: JSON.stringify(flow.definition || {}, null, 2),
|
|
457
|
+
mode: 'application/json',
|
|
458
|
+
theme: 'dracula',
|
|
459
|
+
lineNumbers: true,
|
|
460
|
+
tabSize: 2,
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
function syncDslToVisual() {
|
|
465
|
+
if (!designerState.cmDslEditor) return;
|
|
466
|
+
try {
|
|
467
|
+
const parsed = JSON.parse(designerState.cmDslEditor.getValue());
|
|
468
|
+
const validationError = validateFlowDefinitionClient(parsed);
|
|
469
|
+
if (validationError) {
|
|
470
|
+
toast('DSL Validation Error: ' + validationError, 'error');
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
designerState.activeFlow.definition = parsed;
|
|
474
|
+
switchDesignerMode('visual');
|
|
475
|
+
} catch (err) {
|
|
476
|
+
toast('Invalid JSON in definition: ' + err.message, 'error');
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// ==========================================
|
|
481
|
+
// 7. Test Runner Drawer & Execution Visualizer
|
|
482
|
+
// ==========================================
|
|
483
|
+
|
|
484
|
+
function renderTestDrawerHtml(flow) {
|
|
485
|
+
const exec = designerState.latestExecution;
|
|
486
|
+
|
|
487
|
+
return `
|
|
488
|
+
<div style="padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; background: var(--bg-card-hover, rgba(0,0,0,0.05));">
|
|
489
|
+
<h3 style="margin: 0; font-size: 1rem; color: var(--text-main); font-weight: 700; display: flex; align-items: center; gap: 0.5rem;">
|
|
490
|
+
▶ Test Flow Execution
|
|
491
|
+
</h3>
|
|
492
|
+
<button class="btn btn-secondary btn-sm" style="padding: 2px 8px;" onclick="toggleTestDrawer()">✕</button>
|
|
493
|
+
</div>
|
|
494
|
+
|
|
495
|
+
<div style="padding: 1.25rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1.15rem; flex: 1;">
|
|
496
|
+
<div class="flow-field-row">
|
|
497
|
+
<label class="flow-field-label">Initial Input Payload (JSON):</label>
|
|
498
|
+
<textarea
|
|
499
|
+
id="flow-test-input"
|
|
500
|
+
class="flow-field-input"
|
|
501
|
+
style="height: 130px; font-family: var(--font-mono, monospace); font-size: 0.8rem; resize: vertical;"
|
|
502
|
+
>${escapeHtml(designerState.testPayload)}</textarea>
|
|
503
|
+
</div>
|
|
504
|
+
|
|
505
|
+
<button class="btn btn-primary" onclick="runFlowTest()" style="font-weight: 700; padding: 0.65rem 1rem;">
|
|
506
|
+
⚡ Execute Flow Now
|
|
507
|
+
</button>
|
|
508
|
+
|
|
509
|
+
${exec ? `
|
|
510
|
+
<div style="border-top: 1px solid var(--border-subtle); padding-top: 1rem; display: flex; flex-direction: column; gap: 0.85rem;">
|
|
511
|
+
<div style="display: flex; align-items: center; justify-content: space-between;">
|
|
512
|
+
<span style="font-weight: 800; color: ${exec.status === 'succeeded' ? 'var(--accent-success)' : 'var(--accent-danger)'}; font-size: 0.85rem; text-transform: uppercase;">
|
|
513
|
+
● ${exec.status} (${exec.durationMs}ms)
|
|
514
|
+
</span>
|
|
515
|
+
<span style="font-size: 0.75rem; color: var(--text-muted);">${new Date(exec.startedAt).toLocaleTimeString()} • Caller: <code style="font-size: 10px; font-weight: 600;">${escapeHtml(exec.actorId || 'admin / test')}</code></span>
|
|
516
|
+
</div>
|
|
517
|
+
|
|
518
|
+
<!-- Step Timeline -->
|
|
519
|
+
<div style="font-size: 0.75rem; font-weight: 700; color: var(--text-muted);">STEP TIMELINE:</div>
|
|
520
|
+
<div style="display: flex; flex-direction: column; gap: 0.5rem;">
|
|
521
|
+
${(exec.stepLogs || []).map(log => `
|
|
522
|
+
<div class="flow-timeline-item status-${log.status}">
|
|
523
|
+
<div style="display: flex; align-items: center; justify-content: space-between;">
|
|
524
|
+
<strong style="color: var(--text-main); font-size: 0.85rem;">${escapeHtml(log.step)}</strong>
|
|
525
|
+
<span style="font-size: 0.72rem; color: var(--text-muted); font-weight: 600;">${log.durationMs}ms</span>
|
|
526
|
+
</div>
|
|
527
|
+
${log.error ? `<div style="color: var(--accent-danger); font-size: 0.75rem; margin-top: 2px;">${escapeHtml(log.error)}</div>` : ''}
|
|
528
|
+
</div>
|
|
529
|
+
`).join('')}
|
|
530
|
+
</div>
|
|
531
|
+
|
|
532
|
+
<!-- Output Payload -->
|
|
533
|
+
<div class="flow-field-row">
|
|
534
|
+
<label class="flow-field-label">Final Output Payload:</label>
|
|
535
|
+
<pre style="background: var(--bg-input); border: 1px solid var(--border-default); border-radius: 6px; padding: 0.75rem; font-size: 0.78rem; overflow-x: auto; max-height: 200px; margin: 0; color: var(--text-main); font-family: var(--font-mono, monospace);">${escapeHtml(JSON.stringify(exec.output, null, 2))}</pre>
|
|
536
|
+
</div>
|
|
537
|
+
</div>
|
|
538
|
+
` : ''}
|
|
539
|
+
</div>
|
|
540
|
+
`;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function toggleTestDrawer() {
|
|
544
|
+
designerState.isTestDrawerOpen = !designerState.isTestDrawerOpen;
|
|
545
|
+
const drawer = document.getElementById('flow-test-drawer');
|
|
546
|
+
if (drawer) {
|
|
547
|
+
drawer.classList.toggle('open', designerState.isTestDrawerOpen);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
async function runFlowTest() {
|
|
552
|
+
const inputEl = document.getElementById('flow-test-input');
|
|
553
|
+
let parsedPayload = {};
|
|
554
|
+
if (inputEl) {
|
|
555
|
+
designerState.testPayload = inputEl.value;
|
|
556
|
+
try {
|
|
557
|
+
parsedPayload = JSON.parse(inputEl.value);
|
|
558
|
+
} catch (e) {
|
|
559
|
+
toast('Invalid JSON in test payload input', 'error');
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
const flow = designerState.activeFlow;
|
|
565
|
+
if (!flow || !flow.id) return;
|
|
566
|
+
|
|
567
|
+
// Validate and persist edits before execution so server runs the up-to-date definition
|
|
568
|
+
const saved = await saveFlowChanges({ silent: true });
|
|
569
|
+
if (!saved) {
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
const flowId = designerState.activeFlow.id;
|
|
574
|
+
|
|
575
|
+
try {
|
|
576
|
+
const base = getDesignerFlowsApiBase();
|
|
577
|
+
const res = await api(`${base}/${flowId}/execute?wait=true`, {
|
|
578
|
+
method: 'POST',
|
|
579
|
+
body: JSON.stringify(parsedPayload),
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
designerState.latestExecution = res;
|
|
583
|
+
// Update drawer content
|
|
584
|
+
const drawer = document.getElementById('flow-test-drawer');
|
|
585
|
+
if (drawer) {
|
|
586
|
+
drawer.innerHTML = renderTestDrawerHtml(designerState.activeFlow);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// Refresh flowchart diagram to show status highlights (green / red)
|
|
590
|
+
renderSvgFlowchart(designerState.activeFlow);
|
|
591
|
+
} catch (err) {
|
|
592
|
+
toast('Flow execution failed: ' + (err.message || err), 'error');
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// ==========================================
|
|
597
|
+
// 8. Flow Mutators
|
|
598
|
+
// ==========================================
|
|
599
|
+
|
|
600
|
+
function updateFlowMeta(key, value) {
|
|
601
|
+
if (designerState.activeFlow) {
|
|
602
|
+
designerState.activeFlow[key] = value;
|
|
603
|
+
if (key === 'name' && typeof updateBreadcrumbs === 'function') {
|
|
604
|
+
updateBreadcrumbs();
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function updateFlowStartAt(val) {
|
|
610
|
+
if (designerState.activeFlow?.definition) {
|
|
611
|
+
designerState.activeFlow.definition.startAt = val;
|
|
612
|
+
renderSvgFlowchart(designerState.activeFlow);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
function handleStepEndToggle(stepName, isEnd) {
|
|
617
|
+
const step = designerState.activeFlow?.definition?.states?.[stepName];
|
|
618
|
+
if (!step) return;
|
|
619
|
+
|
|
620
|
+
const nextSelect = document.getElementById(`step-next-select-${stepName}`);
|
|
621
|
+
const endCheck = document.getElementById(`step-end-check-${stepName}`);
|
|
622
|
+
|
|
623
|
+
if (isEnd) {
|
|
624
|
+
step.end = true;
|
|
625
|
+
delete step.next;
|
|
626
|
+
if (nextSelect) {
|
|
627
|
+
nextSelect.value = '';
|
|
628
|
+
nextSelect.disabled = true;
|
|
629
|
+
}
|
|
630
|
+
} else {
|
|
631
|
+
delete step.end;
|
|
632
|
+
if (nextSelect) {
|
|
633
|
+
nextSelect.disabled = false;
|
|
634
|
+
nextSelect.focus();
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
if (endCheck) {
|
|
639
|
+
endCheck.checked = !!step.end;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
renderSvgFlowchart(designerState.activeFlow);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
function handleStepNextChange(stepName, nextStep) {
|
|
646
|
+
const step = designerState.activeFlow?.definition?.states?.[stepName];
|
|
647
|
+
if (!step) return;
|
|
648
|
+
|
|
649
|
+
const nextSelect = document.getElementById(`step-next-select-${stepName}`);
|
|
650
|
+
const endCheck = document.getElementById(`step-end-check-${stepName}`);
|
|
651
|
+
|
|
652
|
+
if (nextStep) {
|
|
653
|
+
step.next = nextStep;
|
|
654
|
+
delete step.end;
|
|
655
|
+
if (endCheck) {
|
|
656
|
+
endCheck.checked = false;
|
|
657
|
+
}
|
|
658
|
+
} else {
|
|
659
|
+
delete step.next;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
if (nextSelect) {
|
|
663
|
+
nextSelect.disabled = false;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
renderSvgFlowchart(designerState.activeFlow);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function updateStepProp(stepName, prop, val) {
|
|
670
|
+
const step = designerState.activeFlow?.definition?.states?.[stepName];
|
|
671
|
+
if (!step) return;
|
|
672
|
+
|
|
673
|
+
if (prop === 'end') {
|
|
674
|
+
handleStepEndToggle(stepName, !!val);
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
if (prop === 'next') {
|
|
678
|
+
handleStepNextChange(stepName, val);
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
step[prop] = val;
|
|
683
|
+
renderSvgFlowchart(designerState.activeFlow);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
function updateMapIteratorFunction(stepName, fnName) {
|
|
687
|
+
const step = designerState.activeFlow?.definition?.states?.[stepName];
|
|
688
|
+
if (!step) return;
|
|
689
|
+
|
|
690
|
+
step.iterator = {
|
|
691
|
+
startAt: 'ProcessItem',
|
|
692
|
+
states: {
|
|
693
|
+
ProcessItem: {
|
|
694
|
+
type: 'Task',
|
|
695
|
+
function: fnName,
|
|
696
|
+
end: true,
|
|
697
|
+
},
|
|
698
|
+
},
|
|
699
|
+
};
|
|
700
|
+
renderSvgFlowchart(designerState.activeFlow);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
function addParallelBranch(stepName) {
|
|
704
|
+
const step = designerState.activeFlow?.definition?.states?.[stepName];
|
|
705
|
+
if (!step) return;
|
|
706
|
+
if (!Array.isArray(step.branches)) step.branches = [];
|
|
707
|
+
const bNum = step.branches.length + 1;
|
|
708
|
+
const startKey = `Branch${bNum}_Task`;
|
|
709
|
+
step.branches.push({
|
|
710
|
+
startAt: startKey,
|
|
711
|
+
states: {
|
|
712
|
+
[startKey]: {
|
|
713
|
+
type: 'Task',
|
|
714
|
+
function: '',
|
|
715
|
+
end: true,
|
|
716
|
+
},
|
|
717
|
+
},
|
|
718
|
+
});
|
|
719
|
+
renderFlowDesignerWorkbench(designerState.activeFlow);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
function removeParallelBranch(stepName, branchIdx) {
|
|
723
|
+
const step = designerState.activeFlow?.definition?.states?.[stepName];
|
|
724
|
+
if (!step || !Array.isArray(step.branches)) return;
|
|
725
|
+
if (step.branches.length <= 1) {
|
|
726
|
+
toast('A Parallel step must have at least one branch.', 'warning');
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
step.branches.splice(branchIdx, 1);
|
|
730
|
+
renderFlowDesignerWorkbench(designerState.activeFlow);
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
function updateParallelBranchFunction(stepName, branchIdx, fnName) {
|
|
734
|
+
const step = designerState.activeFlow?.definition?.states?.[stepName];
|
|
735
|
+
if (!step || !Array.isArray(step.branches) || !step.branches[branchIdx]) return;
|
|
736
|
+
const branch = step.branches[branchIdx];
|
|
737
|
+
const startKey = branch.startAt || Object.keys(branch.states || {})[0] || `Branch${branchIdx + 1}_Task`;
|
|
738
|
+
branch.startAt = startKey;
|
|
739
|
+
if (!branch.states) branch.states = {};
|
|
740
|
+
if (!branch.states[startKey]) {
|
|
741
|
+
branch.states[startKey] = {
|
|
742
|
+
type: 'Task',
|
|
743
|
+
function: fnName,
|
|
744
|
+
end: true,
|
|
745
|
+
};
|
|
746
|
+
} else {
|
|
747
|
+
branch.states[startKey].type = 'Task';
|
|
748
|
+
branch.states[startKey].function = fnName;
|
|
749
|
+
branch.states[startKey].end = true;
|
|
750
|
+
}
|
|
751
|
+
renderSvgFlowchart(designerState.activeFlow);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
function updateLoopCondition(stepName, prop, val) {
|
|
755
|
+
const step = designerState.activeFlow?.definition?.states?.[stepName];
|
|
756
|
+
if (!step) return;
|
|
757
|
+
if (!step.condition) step.condition = { variable: '$.counter' };
|
|
758
|
+
if (prop === 'variable') {
|
|
759
|
+
let cleanVal = String(val || '').trim();
|
|
760
|
+
if (cleanVal && !cleanVal.startsWith('$')) {
|
|
761
|
+
cleanVal = cleanVal.startsWith('[') ? '$' + cleanVal : '$.' + cleanVal;
|
|
762
|
+
}
|
|
763
|
+
step.condition.variable = cleanVal;
|
|
764
|
+
} else if (prop === 'numericLessThan') {
|
|
765
|
+
const num = typeof val === 'number' ? val : parseFloat(val);
|
|
766
|
+
if (isNaN(num)) {
|
|
767
|
+
delete step.condition.numericLessThan;
|
|
768
|
+
} else {
|
|
769
|
+
step.condition.numericLessThan = num;
|
|
770
|
+
}
|
|
771
|
+
} else {
|
|
772
|
+
step.condition[prop] = val;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
function updatePassResult(stepName, jsonStr) {
|
|
777
|
+
const step = designerState.activeFlow?.definition?.states?.[stepName];
|
|
778
|
+
if (!step) return;
|
|
779
|
+
try {
|
|
780
|
+
step.result = JSON.parse(jsonStr);
|
|
781
|
+
} catch (e) {
|
|
782
|
+
step.result = jsonStr;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
function addChoiceBranch(stepName) {
|
|
787
|
+
const step = designerState.activeFlow?.definition?.states?.[stepName];
|
|
788
|
+
if (!step) return;
|
|
789
|
+
if (!step.choices) step.choices = [];
|
|
790
|
+
step.choices.push({ variable: '$.status', stringEquals: 'approved', next: '' });
|
|
791
|
+
renderFlowDesignerWorkbench(designerState.activeFlow);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
function removeChoiceBranch(stepName, index) {
|
|
795
|
+
const step = designerState.activeFlow?.definition?.states?.[stepName];
|
|
796
|
+
if (!step || !step.choices) return;
|
|
797
|
+
step.choices.splice(index, 1);
|
|
798
|
+
renderFlowDesignerWorkbench(designerState.activeFlow);
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
function updateChoiceBranch(stepName, index, prop, val) {
|
|
802
|
+
const step = designerState.activeFlow?.definition?.states?.[stepName];
|
|
803
|
+
if (step?.choices?.[index]) {
|
|
804
|
+
if (prop === 'variable') {
|
|
805
|
+
let v = (val || '').trim();
|
|
806
|
+
if (v && !v.startsWith('$')) {
|
|
807
|
+
v = '$.' + v;
|
|
808
|
+
}
|
|
809
|
+
step.choices[index].variable = v;
|
|
810
|
+
} else {
|
|
811
|
+
step.choices[index][prop] = val;
|
|
812
|
+
}
|
|
813
|
+
renderSvgFlowchart(designerState.activeFlow);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
function updateChoiceBranchOp(stepName, index, op) {
|
|
818
|
+
const branch = designerState.activeFlow?.definition?.states?.[stepName]?.choices?.[index];
|
|
819
|
+
if (!branch) return;
|
|
820
|
+
|
|
821
|
+
delete branch.stringEquals;
|
|
822
|
+
delete branch.numericEquals;
|
|
823
|
+
delete branch.numericGreaterThan;
|
|
824
|
+
delete branch.numericLessThan;
|
|
825
|
+
delete branch.numericGreaterThanEquals;
|
|
826
|
+
delete branch.numericLessThanEquals;
|
|
827
|
+
delete branch.booleanEquals;
|
|
828
|
+
delete branch.isPresent;
|
|
829
|
+
|
|
830
|
+
if (op === 'booleanEquals') {
|
|
831
|
+
branch.booleanEquals = true;
|
|
832
|
+
} else if (op === 'isPresent') {
|
|
833
|
+
branch.isPresent = true;
|
|
834
|
+
} else if (op === 'numericGreaterThan') {
|
|
835
|
+
branch.numericGreaterThan = 0;
|
|
836
|
+
} else if (op === 'numericLessThan') {
|
|
837
|
+
branch.numericLessThan = 10;
|
|
838
|
+
} else if (op === 'numericEquals') {
|
|
839
|
+
branch.numericEquals = 0;
|
|
840
|
+
} else if (op === 'numericGreaterThanEquals') {
|
|
841
|
+
branch.numericGreaterThanEquals = 0;
|
|
842
|
+
} else if (op === 'numericLessThanEquals') {
|
|
843
|
+
branch.numericLessThanEquals = 10;
|
|
844
|
+
} else {
|
|
845
|
+
branch.stringEquals = '';
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
renderFlowDesignerWorkbench(designerState.activeFlow);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
function updateChoiceBranchVal(stepName, index, val) {
|
|
852
|
+
const branch = designerState.activeFlow?.definition?.states?.[stepName]?.choices?.[index];
|
|
853
|
+
if (!branch) return;
|
|
854
|
+
|
|
855
|
+
if (branch.booleanEquals !== undefined) {
|
|
856
|
+
branch.booleanEquals = val === 'true';
|
|
857
|
+
} else if (branch.isPresent !== undefined) {
|
|
858
|
+
branch.isPresent = val === 'true';
|
|
859
|
+
} else if (branch.numericGreaterThan !== undefined ||
|
|
860
|
+
branch.numericLessThan !== undefined ||
|
|
861
|
+
branch.numericEquals !== undefined ||
|
|
862
|
+
branch.numericGreaterThanEquals !== undefined ||
|
|
863
|
+
branch.numericLessThanEquals !== undefined) {
|
|
864
|
+
const num = Number(val);
|
|
865
|
+
if (isNaN(num) || String(val).trim() === '') {
|
|
866
|
+
toast('Please enter a valid numeric value for number conditions.', 'warning');
|
|
867
|
+
renderFlowDesignerWorkbench(designerState.activeFlow);
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
if (branch.numericGreaterThan !== undefined) branch.numericGreaterThan = num;
|
|
871
|
+
else if (branch.numericLessThan !== undefined) branch.numericLessThan = num;
|
|
872
|
+
else if (branch.numericEquals !== undefined) branch.numericEquals = num;
|
|
873
|
+
else if (branch.numericGreaterThanEquals !== undefined) branch.numericGreaterThanEquals = num;
|
|
874
|
+
else if (branch.numericLessThanEquals !== undefined) branch.numericLessThanEquals = num;
|
|
875
|
+
} else {
|
|
876
|
+
branch.stringEquals = String(val);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
renderSvgFlowchart(designerState.activeFlow);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
function deleteStep(stepName, evt) {
|
|
883
|
+
if (evt) evt.stopPropagation();
|
|
884
|
+
if (!confirm(`Delete step "${stepName}"?`)) return;
|
|
885
|
+
|
|
886
|
+
const states = designerState.activeFlow.definition.states;
|
|
887
|
+
delete states[stepName];
|
|
888
|
+
|
|
889
|
+
// Clean up references across all remaining states
|
|
890
|
+
Object.values(states).forEach((st) => {
|
|
891
|
+
if (st.next === stepName) delete st.next;
|
|
892
|
+
if (st.target === stepName) delete st.target;
|
|
893
|
+
if (st.default === stepName) delete st.default;
|
|
894
|
+
if (Array.isArray(st.choices)) {
|
|
895
|
+
st.choices.forEach((c) => {
|
|
896
|
+
if (c.next === stepName) c.next = '';
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
});
|
|
900
|
+
|
|
901
|
+
if (designerState.activeFlow.definition.startAt === stepName) {
|
|
902
|
+
const keys = Object.keys(states);
|
|
903
|
+
designerState.activeFlow.definition.startAt = keys[0] || '';
|
|
904
|
+
}
|
|
905
|
+
renderFlowDesignerWorkbench(designerState.activeFlow);
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
function renameStep(oldName, newName) {
|
|
909
|
+
const trimmed = newName ? newName.trim() : '';
|
|
910
|
+
if (!trimmed || oldName === trimmed) return;
|
|
911
|
+
const states = designerState.activeFlow.definition.states;
|
|
912
|
+
if (states[trimmed]) {
|
|
913
|
+
toast(`A step with name "${trimmed}" already exists`, 'warning');
|
|
914
|
+
renderFlowDesignerWorkbench(designerState.activeFlow);
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
// Preserve exact key position in states object so renamed step does not jump to the end
|
|
919
|
+
const keys = Object.keys(states);
|
|
920
|
+
const newStates = {};
|
|
921
|
+
keys.forEach((k) => {
|
|
922
|
+
if (k === oldName) {
|
|
923
|
+
newStates[trimmed] = states[oldName];
|
|
924
|
+
} else {
|
|
925
|
+
newStates[k] = states[k];
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
designerState.activeFlow.definition.states = newStates;
|
|
929
|
+
|
|
930
|
+
// Synchronize references across all other states
|
|
931
|
+
Object.values(newStates).forEach((st) => {
|
|
932
|
+
if (st.next === oldName) st.next = trimmed;
|
|
933
|
+
if (st.target === oldName) st.target = trimmed;
|
|
934
|
+
if (st.default === oldName) st.default = trimmed;
|
|
935
|
+
if (Array.isArray(st.choices)) {
|
|
936
|
+
st.choices.forEach((c) => {
|
|
937
|
+
if (c.next === oldName) c.next = trimmed;
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
});
|
|
941
|
+
|
|
942
|
+
if (designerState.activeFlow.definition.startAt === oldName) {
|
|
943
|
+
designerState.activeFlow.definition.startAt = trimmed;
|
|
944
|
+
}
|
|
945
|
+
if (designerState.selectedStepName === oldName) {
|
|
946
|
+
designerState.selectedStepName = trimmed;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
renderFlowDesignerWorkbench(designerState.activeFlow);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
function validateFlowDefinitionClient(def) {
|
|
953
|
+
if (!def || typeof def !== 'object') return 'Flow definition is empty or invalid.';
|
|
954
|
+
if (!def.startAt || typeof def.startAt !== 'string' || !def.startAt.trim()) {
|
|
955
|
+
return 'Flow must have a Start Step configured.';
|
|
956
|
+
}
|
|
957
|
+
if (!def.states || typeof def.states !== 'object' || Object.keys(def.states).length === 0) {
|
|
958
|
+
return 'Flow must contain at least one step in definition.';
|
|
959
|
+
}
|
|
960
|
+
if (!def.states[def.startAt]) {
|
|
961
|
+
return `Start Step "${def.startAt}" does not exist in flow steps.`;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
const keys = Object.keys(def.states);
|
|
965
|
+
for (const [name, state] of Object.entries(def.states)) {
|
|
966
|
+
if (!state || typeof state !== 'object') {
|
|
967
|
+
return `Step "${name}" is invalid.`;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
if (state.next && !keys.includes(state.next)) {
|
|
971
|
+
return `Step "${name}" points to non-existent step "${state.next}".`;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
if (state.type === 'Task') {
|
|
975
|
+
if (!state.function || !state.function.trim()) {
|
|
976
|
+
return `Task step "${name}" must specify a serverless function.`;
|
|
977
|
+
}
|
|
978
|
+
if (!state.next && !state.end) {
|
|
979
|
+
return `Task step "${name}" must configure "Then Go To" or mark as "End State".`;
|
|
980
|
+
}
|
|
981
|
+
} else if (state.type === 'Choice') {
|
|
982
|
+
if (!Array.isArray(state.choices) || state.choices.length === 0) {
|
|
983
|
+
return `Choice step "${name}" must have at least one condition rule.`;
|
|
984
|
+
}
|
|
985
|
+
for (let i = 0; i < state.choices.length; i++) {
|
|
986
|
+
const c = state.choices[i];
|
|
987
|
+
if (!c.variable || !c.variable.trim() || !c.variable.startsWith('$')) {
|
|
988
|
+
return `Choice step "${name}" rule #${i + 1} variable must start with '$' (e.g. $.status).`;
|
|
989
|
+
}
|
|
990
|
+
if (!c.next || !keys.includes(c.next)) {
|
|
991
|
+
return `Choice step "${name}" rule #${i + 1} must select a valid target step.`;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
const isNumeric = c.numericGreaterThan !== undefined ||
|
|
995
|
+
c.numericLessThan !== undefined ||
|
|
996
|
+
c.numericEquals !== undefined ||
|
|
997
|
+
c.numericGreaterThanEquals !== undefined ||
|
|
998
|
+
c.numericLessThanEquals !== undefined;
|
|
999
|
+
|
|
1000
|
+
if (isNumeric) {
|
|
1001
|
+
const num = c.numericGreaterThan ??
|
|
1002
|
+
c.numericLessThan ??
|
|
1003
|
+
c.numericEquals ??
|
|
1004
|
+
c.numericGreaterThanEquals ??
|
|
1005
|
+
c.numericLessThanEquals;
|
|
1006
|
+
if (typeof num !== 'number' || isNaN(num) || !Number.isFinite(num)) {
|
|
1007
|
+
return `Choice step "${name}" rule #${i + 1} has invalid non-numeric value: ${JSON.stringify(num)}.`;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
if (c.booleanEquals !== undefined && typeof c.booleanEquals !== 'boolean') {
|
|
1012
|
+
return `Choice step "${name}" rule #${i + 1} boolean condition must be true or false.`;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
if (state.default && !keys.includes(state.default)) {
|
|
1017
|
+
return `Choice step "${name}" default fallback step "${state.default}" does not exist.`;
|
|
1018
|
+
}
|
|
1019
|
+
} else if (state.type === 'Loop') {
|
|
1020
|
+
if (!state.target || !keys.includes(state.target)) {
|
|
1021
|
+
return `Loop step "${name}" must select a valid jump target step.`;
|
|
1022
|
+
}
|
|
1023
|
+
if (state.maxIterations !== undefined) {
|
|
1024
|
+
if (typeof state.maxIterations !== 'number' || state.maxIterations < 1) {
|
|
1025
|
+
return `Loop step "${name}" max iterations must be a positive number.`;
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
if (!state.condition || typeof state.condition !== 'object') {
|
|
1029
|
+
return `Loop step "${name}" must specify a condition choice rule.`;
|
|
1030
|
+
}
|
|
1031
|
+
if (!state.next && !state.end) {
|
|
1032
|
+
return `Loop step "${name}" must configure "Then Go To" or mark as "End State".`;
|
|
1033
|
+
}
|
|
1034
|
+
} else if (state.type === 'Wait') {
|
|
1035
|
+
if (typeof state.seconds !== 'number' || isNaN(state.seconds) || state.seconds < 0) {
|
|
1036
|
+
return `Wait step "${name}" seconds delay must be a non-negative number.`;
|
|
1037
|
+
}
|
|
1038
|
+
if (!state.next && !state.end) {
|
|
1039
|
+
return `Wait step "${name}" must configure "Then Go To" or mark as "End State".`;
|
|
1040
|
+
}
|
|
1041
|
+
} else if (state.type === 'Map') {
|
|
1042
|
+
if (!state.itemsPath || !state.itemsPath.startsWith('$')) {
|
|
1043
|
+
return `Map step "${name}" itemsPath must be a valid JSONPath starting with '$'.`;
|
|
1044
|
+
}
|
|
1045
|
+
if (!state.iterator || typeof state.iterator !== 'object') {
|
|
1046
|
+
return `Map step "${name}" must specify an iterator with startAt and states.`;
|
|
1047
|
+
}
|
|
1048
|
+
const subErr = validateFlowDefinitionClient(state.iterator);
|
|
1049
|
+
if (subErr) {
|
|
1050
|
+
return `Map step "${name}" iterator: ${subErr}`;
|
|
1051
|
+
}
|
|
1052
|
+
if (!state.next && !state.end) {
|
|
1053
|
+
return `Map step "${name}" must configure "Then Go To" or mark as "End State".`;
|
|
1054
|
+
}
|
|
1055
|
+
} else if (state.type === 'Parallel') {
|
|
1056
|
+
if (!Array.isArray(state.branches) || state.branches.length === 0) {
|
|
1057
|
+
return `Parallel step "${name}" must have at least one branch in "branches".`;
|
|
1058
|
+
}
|
|
1059
|
+
for (let bIdx = 0; bIdx < state.branches.length; bIdx++) {
|
|
1060
|
+
const branch = state.branches[bIdx];
|
|
1061
|
+
if (!branch || typeof branch !== 'object') {
|
|
1062
|
+
return `Parallel step "${name}" branch #${bIdx + 1} is invalid.`;
|
|
1063
|
+
}
|
|
1064
|
+
const subErr = validateFlowDefinitionClient(branch);
|
|
1065
|
+
if (subErr) {
|
|
1066
|
+
return `Parallel step "${name}" branch #${bIdx + 1}: ${subErr}`;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
if (!state.next && !state.end) {
|
|
1070
|
+
return `Parallel step "${name}" must configure "Then Go To" or mark as "End State".`;
|
|
1071
|
+
}
|
|
1072
|
+
} else if (state.type === 'Pass') {
|
|
1073
|
+
if (!state.next && !state.end) {
|
|
1074
|
+
return `Pass step "${name}" must configure "Then Go To" or mark as "End State".`;
|
|
1075
|
+
}
|
|
1076
|
+
} else if (state.type === 'Succeed' || state.type === 'Fail') {
|
|
1077
|
+
// Terminal states must not have next or end transitions
|
|
1078
|
+
if (state.next) {
|
|
1079
|
+
delete state.next;
|
|
1080
|
+
}
|
|
1081
|
+
if (state.end) {
|
|
1082
|
+
delete state.end;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
return null;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
function selectStepCard(name) {
|
|
1091
|
+
designerState.selectedStepName = name;
|
|
1092
|
+
document.querySelectorAll('.flow-step-card').forEach((el) => el.classList.remove('active-step'));
|
|
1093
|
+
const safeSelector = typeof CSS !== 'undefined' && CSS.escape ? `.flow-step-card[data-step-name="${CSS.escape(name)}"]` : null;
|
|
1094
|
+
const card = (safeSelector ? document.querySelector(safeSelector) : null) || document.getElementById(`step-card-${name}`);
|
|
1095
|
+
if (card) card.classList.add('active-step');
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
function selectStepFromDiagram(name) {
|
|
1099
|
+
selectStepCard(name);
|
|
1100
|
+
const safeSelector = typeof CSS !== 'undefined' && CSS.escape ? `.flow-step-card[data-step-name="${CSS.escape(name)}"]` : null;
|
|
1101
|
+
const card = (safeSelector ? document.querySelector(safeSelector) : null) || document.getElementById(`step-card-${name}`);
|
|
1102
|
+
if (card && typeof card.scrollIntoView === 'function') {
|
|
1103
|
+
card.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
function switchDesignerMode(mode) {
|
|
1108
|
+
if (designerState.activeMode === 'code' && designerState.cmDslEditor) {
|
|
1109
|
+
try {
|
|
1110
|
+
const parsed = JSON.parse(designerState.cmDslEditor.getValue());
|
|
1111
|
+
const validationError = validateFlowDefinitionClient(parsed);
|
|
1112
|
+
if (validationError) {
|
|
1113
|
+
toast('DSL Validation Warning: ' + validationError, 'warning');
|
|
1114
|
+
} else {
|
|
1115
|
+
designerState.activeFlow.definition = parsed;
|
|
1116
|
+
}
|
|
1117
|
+
} catch (e) {
|
|
1118
|
+
toast('Invalid JSON in editor: ' + e.message, 'warning');
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
designerState.activeMode = mode;
|
|
1122
|
+
renderFlowDesignerWorkbench(designerState.activeFlow);
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
async function saveFlowChanges(options = {}) {
|
|
1126
|
+
const flow = designerState.activeFlow;
|
|
1127
|
+
if (!flow || !flow.id) return false;
|
|
1128
|
+
|
|
1129
|
+
if (designerState.activeMode === 'code' && designerState.cmDslEditor) {
|
|
1130
|
+
try {
|
|
1131
|
+
const parsed = JSON.parse(designerState.cmDslEditor.getValue());
|
|
1132
|
+
flow.definition = parsed;
|
|
1133
|
+
} catch (e) {
|
|
1134
|
+
toast('Invalid JSON in DSL editor: ' + e.message, 'error');
|
|
1135
|
+
return false;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
const validationError = validateFlowDefinitionClient(flow.definition);
|
|
1140
|
+
if (validationError) {
|
|
1141
|
+
toast('Validation Error: ' + validationError, 'error');
|
|
1142
|
+
return false;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
try {
|
|
1146
|
+
const base = getDesignerFlowsApiBase();
|
|
1147
|
+
const updated = await api(`${base}/${flow.id}`, {
|
|
1148
|
+
method: 'PATCH',
|
|
1149
|
+
body: JSON.stringify({
|
|
1150
|
+
name: flow.name,
|
|
1151
|
+
description: flow.description,
|
|
1152
|
+
triggerType: flow.triggerType,
|
|
1153
|
+
authPolicy: flow.authPolicy || 'public',
|
|
1154
|
+
invokeRule: (flow.triggerType || 'http') === 'http' && flow.authPolicy === 'custom'
|
|
1155
|
+
? (typeof getStandaloneRuleValue === 'function' ? getStandaloneRuleValue('flow_invoke') : (flow.invokeRule || null))
|
|
1156
|
+
: null,
|
|
1157
|
+
eventTrigger: flow.triggerType === 'event' ? (flow.eventTrigger || null) : null,
|
|
1158
|
+
cronSchedule: flow.triggerType === 'cron' ? (flow.cronSchedule || null) : null,
|
|
1159
|
+
cronTimezone: flow.triggerType === 'cron' ? (flow.cronTimezone || 'UTC') : 'UTC',
|
|
1160
|
+
maxConcurrentExecutions: flow.maxConcurrentExecutions ?? null,
|
|
1161
|
+
definition: flow.definition,
|
|
1162
|
+
}),
|
|
1163
|
+
});
|
|
1164
|
+
flowsState.activeFlowForEdit = updated;
|
|
1165
|
+
designerState.activeFlow = JSON.parse(JSON.stringify(updated));
|
|
1166
|
+
|
|
1167
|
+
if (typeof updateUrl === 'function') {
|
|
1168
|
+
const flowIdentifier = updated.name ? encodeURIComponent(updated.name) : encodeURIComponent(updated.id);
|
|
1169
|
+
updateUrl('/_/flows/' + flowIdentifier, true);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
if (typeof updateBreadcrumbs === 'function') {
|
|
1173
|
+
updateBreadcrumbs();
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
if (!options || !options.silent) {
|
|
1177
|
+
toast('Flow changes saved successfully!', 'success');
|
|
1178
|
+
}
|
|
1179
|
+
return true;
|
|
1180
|
+
} catch (err) {
|
|
1181
|
+
toast('Failed to save flow: ' + (err.message || err), 'error');
|
|
1182
|
+
return false;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
if (typeof window !== 'undefined') {
|
|
1187
|
+
window.openFlowDesigner = openFlowDesigner;
|
|
1188
|
+
window.closeFlowDesigner = closeFlowDesigner;
|
|
1189
|
+
window.renderFlowDesignerWorkbench = renderFlowDesignerWorkbench;
|
|
1190
|
+
window.updateFlowMeta = updateFlowMeta;
|
|
1191
|
+
window.handleFlowTriggerTypeChange = handleFlowTriggerTypeChange;
|
|
1192
|
+
window.handleFlowCronScheduleChange = handleFlowCronScheduleChange;
|
|
1193
|
+
window.handleFlowCronTimezoneChange = handleFlowCronTimezoneChange;
|
|
1194
|
+
window.handleFlowAuthPolicyChange = handleFlowAuthPolicyChange;
|
|
1195
|
+
window.updateFlowStartAt = updateFlowStartAt;
|
|
1196
|
+
window.updateStepProp = updateStepProp;
|
|
1197
|
+
window.handleStepEndToggle = handleStepEndToggle;
|
|
1198
|
+
window.handleStepNextChange = handleStepNextChange;
|
|
1199
|
+
window.updateMapIteratorFunction = updateMapIteratorFunction;
|
|
1200
|
+
window.addParallelBranch = addParallelBranch;
|
|
1201
|
+
window.removeParallelBranch = removeParallelBranch;
|
|
1202
|
+
window.updateParallelBranchFunction = updateParallelBranchFunction;
|
|
1203
|
+
window.updateLoopCondition = updateLoopCondition;
|
|
1204
|
+
window.updatePassResult = updatePassResult;
|
|
1205
|
+
window.addChoiceBranch = addChoiceBranch;
|
|
1206
|
+
window.removeChoiceBranch = removeChoiceBranch;
|
|
1207
|
+
window.updateChoiceBranch = updateChoiceBranch;
|
|
1208
|
+
window.updateChoiceBranchOp = updateChoiceBranchOp;
|
|
1209
|
+
window.updateChoiceBranchVal = updateChoiceBranchVal;
|
|
1210
|
+
window.deleteStep = deleteStep;
|
|
1211
|
+
window.renameStep = renameStep;
|
|
1212
|
+
window.selectStepCard = selectStepCard;
|
|
1213
|
+
window.selectStepFromDiagram = selectStepFromDiagram;
|
|
1214
|
+
window.switchDesignerMode = switchDesignerMode;
|
|
1215
|
+
window.syncDslToVisual = syncDslToVisual;
|
|
1216
|
+
window.toggleTestDrawer = toggleTestDrawer;
|
|
1217
|
+
window.runFlowTest = runFlowTest;
|
|
1218
|
+
window.saveFlowChanges = saveFlowChanges;
|
|
1219
|
+
}
|