@octaviaflow/flow-rules 0.1.0 → 0.2.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.
Files changed (74) hide show
  1. package/dist/index.d.ts +6 -0
  2. package/dist/index.js +3010 -28
  3. package/package.json +14 -5
  4. package/dist/catalog/actions/console-log/config.js +0 -70
  5. package/dist/catalog/actions/console-log/index.js +0 -89
  6. package/dist/catalog/actions/delay/config.js +0 -79
  7. package/dist/catalog/actions/delay/index.js +0 -71
  8. package/dist/catalog/actions/delay/migrate.js +0 -38
  9. package/dist/catalog/actions/delay/types.js +0 -17
  10. package/dist/catalog/actions/http-request/config.js +0 -111
  11. package/dist/catalog/actions/http-request/index.js +0 -223
  12. package/dist/catalog/ai/ai-agent/index.js +0 -72
  13. package/dist/catalog/ai/idp-extract/index.js +0 -90
  14. package/dist/catalog/api/graphql-query/config.js +0 -31
  15. package/dist/catalog/api/graphql-query/index.js +0 -75
  16. package/dist/catalog/communication/email-send/config.js +0 -80
  17. package/dist/catalog/communication/email-send/index.js +0 -152
  18. package/dist/catalog/communication/google-chat/config.js +0 -28
  19. package/dist/catalog/communication/google-chat/index.js +0 -36
  20. package/dist/catalog/communication/slack-message/config.js +0 -36
  21. package/dist/catalog/communication/slack-message/index.js +0 -37
  22. package/dist/catalog/communication/teams-message/config.js +0 -29
  23. package/dist/catalog/communication/teams-message/index.js +0 -39
  24. package/dist/catalog/communication/webhook-call/config.js +0 -31
  25. package/dist/catalog/communication/webhook-call/index.js +0 -43
  26. package/dist/catalog/communication/whatsapp-send/config.js +0 -36
  27. package/dist/catalog/communication/whatsapp-send/index.js +0 -57
  28. package/dist/catalog/general/query/config.js +0 -257
  29. package/dist/catalog/general/query/index.js +0 -271
  30. package/dist/catalog/general/query/types.js +0 -82
  31. package/dist/catalog/general/transform/config.js +0 -95
  32. package/dist/catalog/general/transform/index.js +0 -63
  33. package/dist/catalog/index.js +0 -168
  34. package/dist/catalog/logic/condition/config.js +0 -93
  35. package/dist/catalog/logic/condition/index.js +0 -64
  36. package/dist/catalog/logic/for-each/config.js +0 -75
  37. package/dist/catalog/logic/for-each/index.js +0 -92
  38. package/dist/catalog/logic/for-each/pathOptions.js +0 -151
  39. package/dist/catalog/logic/group/index.js +0 -46
  40. package/dist/catalog/policies.js +0 -62
  41. package/dist/catalog/storage/csv-action/index.js +0 -38
  42. package/dist/catalog/storage/dropbox-action/index.js +0 -33
  43. package/dist/catalog/storage/excel-action/index.js +0 -32
  44. package/dist/catalog/storage/file-action/index.js +0 -119
  45. package/dist/catalog/storage/file-operation/config.js +0 -45
  46. package/dist/catalog/storage/file-operation/index.js +0 -111
  47. package/dist/catalog/storage/ftp-action/index.js +0 -33
  48. package/dist/catalog/storage/google-drive-action/index.js +0 -38
  49. package/dist/catalog/storage/json-action/index.js +0 -31
  50. package/dist/catalog/storage/onedrive-action/index.js +0 -33
  51. package/dist/catalog/storage/s3-action/index.js +0 -36
  52. package/dist/catalog/storage/storage-action/index.js +0 -72
  53. package/dist/catalog/storage/storageCapabilities.js +0 -207
  54. package/dist/catalog/storage/xml-action/index.js +0 -31
  55. package/dist/catalog/transforms/format/config.js +0 -19
  56. package/dist/catalog/transforms/format/index.js +0 -39
  57. package/dist/catalog/triggers/connector-trigger/index.js +0 -72
  58. package/dist/catalog/triggers/manual-trigger/config.js +0 -60
  59. package/dist/catalog/triggers/manual-trigger/index.js +0 -74
  60. package/dist/catalog/triggers/schedule-trigger/config.js +0 -42
  61. package/dist/catalog/triggers/schedule-trigger/index.js +0 -102
  62. package/dist/catalog/triggers/webhook-trigger/config.js +0 -27
  63. package/dist/catalog/triggers/webhook-trigger/index.js +0 -89
  64. package/dist/catalog/types.js +0 -135
  65. package/dist/catalog/utility/debug/config.js +0 -90
  66. package/dist/catalog/utility/debug/index.js +0 -38
  67. package/dist/catalog/utility/error/config.js +0 -25
  68. package/dist/catalog/utility/error/index.js +0 -46
  69. package/dist/catalog/utility/variables/config.js +0 -70
  70. package/dist/catalog/utility/variables/index.js +0 -40
  71. package/dist/catalog/workflow.js +0 -25
  72. package/dist/ids.js +0 -53
  73. package/dist/rules/nodeConfigStatus.js +0 -217
  74. package/dist/rules/workflowValidator.js +0 -358
@@ -1,60 +0,0 @@
1
- /**
2
- * Manual Trigger Configuration
3
- *
4
- * Defines the configuration structure and default values for the Manual Trigger action
5
- */
6
- export const ManualTriggerConfig = {
7
- /**
8
- * Default configuration for Manual Trigger
9
- */
10
- defaults: {
11
- description: '',
12
- },
13
- /**
14
- * Configuration schema for validation
15
- */
16
- schema: {
17
- description: {
18
- type: 'string',
19
- maxLength: 500,
20
- required: false,
21
- description: 'Optional description for this trigger (shown on node)',
22
- },
23
- },
24
- /**
25
- * Validate configuration
26
- */
27
- validate: (config) => {
28
- const errors = [];
29
- if (config.description !== undefined) {
30
- if (typeof config.description !== 'string') {
31
- errors.push('Description must be a string');
32
- }
33
- if (config.description.length > 500) {
34
- errors.push('Description must not exceed 500 characters');
35
- }
36
- }
37
- return {
38
- valid: errors.length === 0,
39
- errors,
40
- };
41
- },
42
- /**
43
- * Merge user config with defaults
44
- */
45
- merge: (userConfig) => {
46
- return {
47
- ...ManualTriggerConfig.defaults,
48
- ...userConfig,
49
- };
50
- },
51
- /**
52
- * Get display label for configuration
53
- */
54
- getLabel: (config) => {
55
- if (config.description) {
56
- return `Manual Trigger: ${config.description}`;
57
- }
58
- return 'Manual Trigger';
59
- },
60
- };
@@ -1,74 +0,0 @@
1
- /**
2
- * Manual Trigger Action
3
- *
4
- * A built-in trigger action that allows manual workflow execution with optional configuration
5
- */
6
- import { ActionCategory, ActionType, ActionStatus, FieldType } from '../../types';
7
- import { randomSuffix } from '../../../ids';
8
- import { ManualTriggerConfig } from './config';
9
- export const manualTriggerDefinition = {
10
- id: 'manual_trigger',
11
- name: 'Manual Trigger',
12
- description: 'Manually trigger workflow with optional description',
13
- category: ActionCategory.Trigger,
14
- type: ActionType.Manual,
15
- tags: ['trigger', 'manual', 'built-in'],
16
- status: ActionStatus.Stable,
17
- icon: 'PlayOutline',
18
- color: '#0f62fe',
19
- inputSchema: {
20
- fields: [
21
- {
22
- key: 'description',
23
- label: 'Description',
24
- type: FieldType.String,
25
- description: 'Optional description for this trigger (shown on node)',
26
- placeholder: 'e.g., Manual data sync, Testing workflow, etc.',
27
- validation: {
28
- required: false,
29
- maxLength: 500,
30
- },
31
- },
32
- ],
33
- },
34
- outputSchema: {
35
- type: 'object',
36
- properties: [
37
- {
38
- key: 'triggeredAt',
39
- type: FieldType.DateTime,
40
- description: 'Timestamp when workflow was triggered',
41
- },
42
- // `triggeredBy` was declared here but never produced, so the picker
43
- // offered a token that always resolved to nothing. The Engine DOES have
44
- // it — `metadata.triggeredBy` / `.triggeredByEmail` exist on the run —
45
- // but they are not threaded into `executeStep`, which is where the
46
- // trigger envelope is built. Removed rather than left as a dead token;
47
- // re-add it together with that threading.
48
- {
49
- key: 'executionId',
50
- type: FieldType.String,
51
- description: 'Unique execution ID for this workflow run',
52
- },
53
- {
54
- key: 'description',
55
- type: FieldType.String,
56
- description: 'The description provided by the user (if any)',
57
- },
58
- ],
59
- sampleOutput: {
60
- triggeredAt: new Date().toISOString(),
61
- executionId: `exec_${Date.now()}_${randomSuffix(9)}`,
62
- description: 'Manual data sync',
63
- },
64
- },
65
- version: '1.0.0',
66
- createdAt: '2025-01-01T00:00:00Z',
67
- updatedAt: '2025-12-15T00:00:00Z',
68
- createdBy: 'system',
69
- isOfficial: true,
70
- testable: true,
71
- };
72
- // The config PANEL stays in octaviaflow-ui: this package is data and rules,
73
- // and a React component here would make it unusable from Backend.
74
- export { ManualTriggerConfig };
@@ -1,42 +0,0 @@
1
- /**
2
- * Schedule Trigger Configuration
3
- */
4
- export const ScheduleTriggerConfig = {
5
- defaults: {
6
- scheduleType: 'interval',
7
- interval: 60,
8
- intervalUnit: 'minutes',
9
- timezone: 'UTC',
10
- },
11
- schema: {
12
- scheduleType: { type: 'select', required: true },
13
- interval: { type: 'number', required: false, min: 1 },
14
- intervalUnit: { type: 'select', required: false },
15
- cronExpression: { type: 'string', required: false },
16
- timezone: { type: 'string', required: false },
17
- },
18
- validate: (config) => {
19
- const errors = [];
20
- if (!config.scheduleType) {
21
- errors.push('Schedule type is required');
22
- }
23
- if (config.scheduleType === 'interval') {
24
- if (!config.interval || config.interval < 1) {
25
- errors.push('Interval must be at least 1');
26
- }
27
- }
28
- if (config.scheduleType === 'cron' && !config.cronExpression) {
29
- errors.push('Cron expression is required');
30
- }
31
- return { valid: errors.length === 0, errors };
32
- },
33
- merge: (userConfig) => {
34
- return { ...ScheduleTriggerConfig.defaults, ...userConfig };
35
- },
36
- getLabel: (config) => {
37
- if (config.scheduleType === 'interval') {
38
- return `Every ${config.interval} ${config.intervalUnit}`;
39
- }
40
- return `Schedule: ${config.scheduleType}`;
41
- },
42
- };
@@ -1,102 +0,0 @@
1
- /**
2
- * Schedule Trigger Action
3
- *
4
- * Trigger workflows on a schedule using cron expressions or intervals
5
- */
6
- import { ActionCategory, ActionType, ActionStatus, FieldType } from '../../types';
7
- export const scheduleTriggerDefinition = {
8
- id: 'schedule_trigger',
9
- name: 'Schedule Trigger',
10
- description: 'Trigger workflow on a schedule using cron or intervals',
11
- category: ActionCategory.Trigger,
12
- type: ActionType.Schedule,
13
- tags: ['trigger', 'schedule', 'cron', 'built-in'],
14
- status: ActionStatus.Stable,
15
- icon: 'Time',
16
- color: '#0f62fe',
17
- inputSchema: {
18
- fields: [
19
- {
20
- key: 'scheduleType',
21
- label: 'Schedule Type',
22
- type: FieldType.Select,
23
- description: 'Type of schedule',
24
- defaultValue: 'interval',
25
- options: [
26
- { label: 'Interval', value: 'interval' },
27
- { label: 'Cron Expression', value: 'cron' },
28
- { label: 'Specific Time', value: 'specific' },
29
- ],
30
- validation: { required: true },
31
- },
32
- {
33
- key: 'interval',
34
- label: 'Interval',
35
- type: FieldType.Number,
36
- description: 'Interval value (used with interval type)',
37
- validation: { required: false, min: 1 },
38
- },
39
- {
40
- key: 'intervalUnit',
41
- label: 'Interval Unit',
42
- type: FieldType.Select,
43
- description: 'Unit for interval (minutes, hours, days)',
44
- defaultValue: 'minutes',
45
- options: [
46
- { label: 'Minutes', value: 'minutes' },
47
- { label: 'Hours', value: 'hours' },
48
- { label: 'Days', value: 'days' },
49
- { label: 'Weeks', value: 'weeks' },
50
- ],
51
- validation: { required: false },
52
- },
53
- {
54
- key: 'cronExpression',
55
- label: 'Cron Expression',
56
- type: FieldType.String,
57
- description: 'Cron expression (e.g., 0 0 * * * for daily at midnight)',
58
- placeholder: '0 0 * * *',
59
- validation: { required: false },
60
- },
61
- {
62
- key: 'timezone',
63
- label: 'Timezone',
64
- type: FieldType.String,
65
- description: 'Timezone for schedule (e.g., UTC, America/New_York)',
66
- defaultValue: 'UTC',
67
- validation: { required: false },
68
- },
69
- ],
70
- },
71
- outputSchema: {
72
- type: 'object',
73
- properties: [
74
- {
75
- key: 'scheduledAt',
76
- type: FieldType.DateTime,
77
- description: 'When the schedule was triggered',
78
- },
79
- {
80
- key: 'nextRun',
81
- type: FieldType.DateTime,
82
- description: 'When the next run is scheduled',
83
- },
84
- {
85
- key: 'scheduleType',
86
- type: FieldType.String,
87
- description: 'Type of schedule that triggered',
88
- },
89
- ],
90
- sampleOutput: {
91
- scheduledAt: new Date().toISOString(),
92
- nextRun: new Date(Date.now() + 3600000).toISOString(),
93
- scheduleType: 'interval',
94
- },
95
- },
96
- version: '1.0.0',
97
- createdAt: '2025-01-01T00:00:00Z',
98
- updatedAt: '2025-12-15T00:00:00Z',
99
- createdBy: 'system',
100
- isOfficial: true,
101
- testable: true,
102
- };
@@ -1,27 +0,0 @@
1
- /**
2
- * Webhook Trigger Configuration
3
- */
4
- export const WebhookTriggerConfig = {
5
- defaults: {
6
- method: 'POST',
7
- requireAuth: true,
8
- },
9
- schema: {
10
- webhookPath: { type: 'string', required: false },
11
- method: { type: 'select', required: true },
12
- requireAuth: { type: 'boolean', required: false },
13
- },
14
- validate: (config) => {
15
- const errors = [];
16
- if (!config.method) {
17
- errors.push('HTTP method is required');
18
- }
19
- return { valid: errors.length === 0, errors };
20
- },
21
- merge: (userConfig) => {
22
- return { ...WebhookTriggerConfig.defaults, ...userConfig };
23
- },
24
- getLabel: (config) => {
25
- return `Webhook ${config.method}${config.webhookPath ? ` ${config.webhookPath}` : ''}`;
26
- },
27
- };
@@ -1,89 +0,0 @@
1
- /**
2
- * Webhook Trigger Action
3
- *
4
- * Trigger workflows via HTTP webhooks
5
- */
6
- import { ActionCategory, ActionType, ActionStatus, FieldType } from '../../types';
7
- export const webhookTriggerDefinition = {
8
- id: 'webhook_trigger',
9
- name: 'Webhook Trigger',
10
- description: 'Trigger workflow via HTTP webhook',
11
- category: ActionCategory.Trigger,
12
- type: ActionType.Webhook,
13
- tags: ['trigger', 'webhook', 'http', 'built-in'],
14
- status: ActionStatus.Stable,
15
- icon: 'WebhookAlt',
16
- color: '#0f62fe',
17
- inputSchema: {
18
- fields: [
19
- {
20
- key: 'webhookPath',
21
- label: 'Webhook Path',
22
- type: FieldType.String,
23
- description: 'Custom path for the webhook URL',
24
- placeholder: '/my-webhook',
25
- validation: { required: false },
26
- },
27
- {
28
- key: 'method',
29
- label: 'HTTP Method',
30
- type: FieldType.Select,
31
- description: 'Allowed HTTP methods',
32
- defaultValue: 'POST',
33
- options: [
34
- { label: 'GET', value: 'GET' },
35
- { label: 'POST', value: 'POST' },
36
- { label: 'PUT', value: 'PUT' },
37
- { label: 'PATCH', value: 'PATCH' },
38
- { label: 'DELETE', value: 'DELETE' },
39
- ],
40
- validation: { required: true },
41
- },
42
- {
43
- key: 'requireAuth',
44
- label: 'Require Authentication',
45
- type: FieldType.Boolean,
46
- description: 'Require API key or token for webhook',
47
- defaultValue: true,
48
- validation: { required: false },
49
- },
50
- ],
51
- },
52
- outputSchema: {
53
- type: 'object',
54
- properties: [
55
- {
56
- key: 'webhookUrl',
57
- type: FieldType.URL,
58
- description: 'The generated webhook URL',
59
- },
60
- {
61
- key: 'method',
62
- type: FieldType.String,
63
- description: 'HTTP method used',
64
- },
65
- {
66
- key: 'payload',
67
- type: FieldType.JSON,
68
- description: 'Request payload received',
69
- },
70
- {
71
- key: 'headers',
72
- type: FieldType.Object,
73
- description: 'Request headers',
74
- },
75
- ],
76
- sampleOutput: {
77
- webhookUrl: 'https://api.example.com/webhooks/trigger-123',
78
- method: 'POST',
79
- payload: { data: 'example' },
80
- headers: { 'content-type': 'application/json' },
81
- },
82
- },
83
- version: '1.0.0',
84
- createdAt: '2025-01-01T00:00:00Z',
85
- updatedAt: '2025-12-15T00:00:00Z',
86
- createdBy: 'system',
87
- isOfficial: true,
88
- testable: true,
89
- };
@@ -1,135 +0,0 @@
1
- /**
2
- * Action System Type Definitions
3
- *
4
- * Complete type definitions for the action system including enums, interfaces, and utilities
5
- */
6
- // ============================================
7
- // ENUMS
8
- // ============================================
9
- export var ActionCategory;
10
- (function (ActionCategory) {
11
- // Core workflow
12
- ActionCategory["Trigger"] = "trigger";
13
- ActionCategory["Action"] = "action";
14
- ActionCategory["Logic"] = "logic";
15
- ActionCategory["Transform"] = "transform";
16
- // AI-specific
17
- ActionCategory["AI"] = "ai";
18
- // Data operations
19
- ActionCategory["Database"] = "database";
20
- ActionCategory["API"] = "api";
21
- ActionCategory["Storage"] = "storage";
22
- ActionCategory["FileStorage"] = "file_storage";
23
- // Communication
24
- ActionCategory["Communication"] = "communication";
25
- // Integrations
26
- ActionCategory["CRM"] = "crm";
27
- ActionCategory["Ecommerce"] = "ecommerce";
28
- ActionCategory["Marketing"] = "marketing";
29
- ActionCategory["Analytics"] = "analytics";
30
- ActionCategory["Productivity"] = "productivity";
31
- // Advanced
32
- ActionCategory["Custom"] = "custom";
33
- ActionCategory["Utility"] = "utility";
34
- })(ActionCategory || (ActionCategory = {}));
35
- export var ActionType;
36
- (function (ActionType) {
37
- // Triggers
38
- ActionType["Schedule"] = "schedule";
39
- ActionType["Webhook"] = "webhook";
40
- ActionType["Manual"] = "manual";
41
- ActionType["DataChange"] = "data_change";
42
- ActionType["Event"] = "event";
43
- // Data Actions
44
- ActionType["Read"] = "read";
45
- ActionType["Write"] = "write";
46
- ActionType["Update"] = "update";
47
- ActionType["Delete"] = "delete";
48
- ActionType["Query"] = "query";
49
- // API Actions
50
- ActionType["HTTPRequest"] = "http_request";
51
- ActionType["GraphQLQuery"] = "graphql_query";
52
- // Logic Actions
53
- ActionType["Condition"] = "condition";
54
- ActionType["ForEach"] = "for_each";
55
- ActionType["Group"] = "group";
56
- // Transform Actions
57
- ActionType["Format"] = "format";
58
- // AI Actions
59
- ActionType["AIAgent"] = "ai_agent";
60
- ActionType["Embedding"] = "embedding";
61
- ActionType["VectorSearch"] = "vector_search";
62
- ActionType["ImageGeneration"] = "image_generation";
63
- ActionType["ImageAnalysis"] = "image_analysis";
64
- ActionType["SpeechToText"] = "speech_to_text";
65
- ActionType["TextToSpeech"] = "text_to_speech";
66
- // General Actions
67
- ActionType["Transform"] = "transform";
68
- // Storage Actions
69
- ActionType["FileOperation"] = "file_operation";
70
- ActionType["FileAction"] = "file_action";
71
- ActionType["CsvAction"] = "csv_action";
72
- ActionType["JsonAction"] = "json_action";
73
- ActionType["XmlAction"] = "xml_action";
74
- ActionType["ExcelAction"] = "excel_action";
75
- ActionType["S3Action"] = "s3_action";
76
- ActionType["FtpAction"] = "ftp_action";
77
- ActionType["GoogleDriveAction"] = "google_drive_action";
78
- ActionType["DropboxAction"] = "dropbox_action";
79
- ActionType["OneDriveAction"] = "onedrive_action";
80
- ActionType["StorageAction"] = "storage_action";
81
- // Communication Actions
82
- ActionType["EmailSend"] = "email_send";
83
- ActionType["SlackMessage"] = "slack_message";
84
- ActionType["WhatsappSend"] = "whatsapp_send";
85
- ActionType["TeamsMessage"] = "teams_message";
86
- ActionType["GoogleChat"] = "google_chat";
87
- ActionType["WebhookCall"] = "webhook_call";
88
- // Utility Actions
89
- ActionType["Delay"] = "delay";
90
- ActionType["Wait"] = "wait";
91
- ActionType["Console"] = "console";
92
- ActionType["Debug"] = "debug";
93
- ActionType["Error"] = "error";
94
- // Custom
95
- ActionType["CustomCode"] = "custom_code";
96
- ActionType["CustomAction"] = "custom_action";
97
- // IDP — engine-driven sync extraction. Replaces the legacy
98
- // idp_wait_for_job poll loop; the engine resolves the LLM connector at
99
- // execution time and extracts once per source file.
100
- ActionType["IdpExtract"] = "idp_extract";
101
- })(ActionType || (ActionType = {}));
102
- export var ActionStatus;
103
- (function (ActionStatus) {
104
- ActionStatus["Stable"] = "stable";
105
- ActionStatus["Beta"] = "beta";
106
- ActionStatus["Alpha"] = "alpha";
107
- ActionStatus["Experimental"] = "experimental";
108
- ActionStatus["Deprecated"] = "deprecated";
109
- })(ActionStatus || (ActionStatus = {}));
110
- export var FieldType;
111
- (function (FieldType) {
112
- FieldType["String"] = "string";
113
- FieldType["Number"] = "number";
114
- FieldType["Boolean"] = "boolean";
115
- FieldType["Date"] = "date";
116
- FieldType["DateTime"] = "datetime";
117
- FieldType["Array"] = "array";
118
- FieldType["Object"] = "object";
119
- FieldType["JSON"] = "json";
120
- FieldType["File"] = "file";
121
- FieldType["Image"] = "image";
122
- FieldType["Select"] = "select";
123
- FieldType["MultiSelect"] = "multi_select";
124
- FieldType["Code"] = "code";
125
- FieldType["Expression"] = "expression";
126
- FieldType["Mapping"] = "mapping";
127
- FieldType["Connection"] = "connection";
128
- FieldType["Secret"] = "secret";
129
- FieldType["Color"] = "color";
130
- FieldType["URL"] = "url";
131
- FieldType["Email"] = "email";
132
- FieldType["Phone"] = "phone";
133
- FieldType["RichText"] = "rich_text";
134
- FieldType["Markdown"] = "markdown";
135
- })(FieldType || (FieldType = {}));
@@ -1,90 +0,0 @@
1
- /**
2
- * Debug Action — Config Types
3
- *
4
- * Mirrors the engine's `DebugConfig` shape so UI and engine agree on
5
- * serialization with no translation layer. See:
6
- * Octaviaflow-Engine/src/services/debugExecutor.ts
7
- */
8
- export const DebugConfig = {
9
- defaults: {
10
- mode: 'log',
11
- label: '',
12
- log: { level: 'info', message: '' },
13
- },
14
- /**
15
- * Pre-flight validation. Surfaces mode-specific missing-field errors.
16
- */
17
- validate(config) {
18
- const errors = [];
19
- if (!config.mode)
20
- errors.push('Mode is required.');
21
- if (!config.label?.trim())
22
- errors.push('Label is required.');
23
- switch (config.mode) {
24
- case 'log':
25
- if (!config.log?.message?.trim())
26
- errors.push('Log mode: message is required.');
27
- if (!config.log?.level)
28
- errors.push('Log mode: level is required.');
29
- break;
30
- case 'snapshot':
31
- // No required fields — paths is optional, schemaDiff is optional.
32
- break;
33
- case 'watch':
34
- if (!config.watch?.expressions?.length) {
35
- errors.push('Watch mode: add at least one expression.');
36
- }
37
- else {
38
- for (const e of config.watch.expressions) {
39
- if (!e.label?.trim())
40
- errors.push('Watch mode: each expression needs a label.');
41
- if (!e.expression?.trim())
42
- errors.push('Watch mode: each expression needs an expression string.');
43
- }
44
- }
45
- break;
46
- case 'assert':
47
- if (!config.assert?.predicate?.trim())
48
- errors.push('Assert mode: predicate is required.');
49
- if (!config.assert?.failureMessage?.trim())
50
- errors.push('Assert mode: failure message is required.');
51
- break;
52
- case 'profile':
53
- if (!config.profile?.scope)
54
- errors.push('Profile mode: scope is required.');
55
- break;
56
- }
57
- return { valid: errors.length === 0, errors };
58
- },
59
- /**
60
- * One-time migration of the legacy `{ label, value }` stub config to
61
- * the new `{ mode: 'log', label, log: {...} }` shape. Returns the
62
- * config unchanged when it's already in the new shape.
63
- */
64
- migrateLegacyStub(config) {
65
- if (config.mode) {
66
- // Already migrated — strip stub-only `value` field if it lingers.
67
- const { value: _stub, ...rest } = config;
68
- return { ...DebugConfig.defaults, ...rest };
69
- }
70
- // Stub shape: { label, value }. Convert to log mode with the label
71
- // doubled as the message (the most useful default given no other
72
- // signal). The unused `value` is dropped — its content was always
73
- // the upstream input which `includeInputData: true` now captures.
74
- return {
75
- mode: 'log',
76
- label: config.label ?? 'Debug',
77
- log: {
78
- level: 'info',
79
- message: config.label ?? 'Debug',
80
- includeInputData: true,
81
- },
82
- };
83
- },
84
- merge(userConfig) {
85
- return { ...DebugConfig.defaults, ...userConfig };
86
- },
87
- getLabel(config) {
88
- return `Debug [${config.mode}]: ${config.label}`;
89
- },
90
- };
@@ -1,38 +0,0 @@
1
- /**
2
- * Debug Action
3
- *
4
- * Multi-mode workflow-author observability primitive: log / snapshot /
5
- * watch / assert / profile. Plus condition gating, sampling, schema-
6
- * diff classification, and a deploy-mode flag.
7
- *
8
- * See:
9
- */
10
- import { ActionCategory, ActionType, ActionStatus } from '../../types';
11
- export const debugDefinition = {
12
- id: 'debug',
13
- name: 'Debug',
14
- description: 'Inspect, assert, watch, profile, or log workflow data at any point. Supports condition gating, sampling, and schema-drift detection.',
15
- category: ActionCategory.Utility,
16
- type: ActionType.Debug,
17
- tags: ['utility', 'debug', 'observability', 'assert', 'snapshot', 'profile', 'built-in'],
18
- status: ActionStatus.Stable,
19
- icon: 'Debug',
20
- color: '#6929C4',
21
- // Custom panel handles all input — no generic field list.
22
- inputSchema: { fields: [] },
23
- // Output is intentionally minimal — Debug is observation, not data
24
- // production. Captures live in the per-execution debug record.
25
- outputSchema: {
26
- type: 'object',
27
- properties: [],
28
- sampleOutput: { debugged: true, mode: 'log' },
29
- },
30
- // Bumping major version triggers the workflow migration that converts
31
- // the legacy `{ label, value }` stub config to `{ mode: 'log', ... }`.
32
- version: '2.0.0',
33
- createdAt: '2025-01-01T00:00:00Z',
34
- updatedAt: '2026-05-02T00:00:00Z',
35
- createdBy: 'system',
36
- isOfficial: true,
37
- testable: false,
38
- };