@octaviaflow/flow-rules 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/index.js +2894 -28
  2. package/package.json +14 -5
  3. package/dist/catalog/actions/console-log/config.js +0 -70
  4. package/dist/catalog/actions/console-log/index.js +0 -89
  5. package/dist/catalog/actions/delay/config.js +0 -79
  6. package/dist/catalog/actions/delay/index.js +0 -71
  7. package/dist/catalog/actions/delay/migrate.js +0 -38
  8. package/dist/catalog/actions/delay/types.js +0 -17
  9. package/dist/catalog/actions/http-request/config.js +0 -111
  10. package/dist/catalog/actions/http-request/index.js +0 -223
  11. package/dist/catalog/ai/ai-agent/index.js +0 -72
  12. package/dist/catalog/ai/idp-extract/index.js +0 -90
  13. package/dist/catalog/api/graphql-query/config.js +0 -31
  14. package/dist/catalog/api/graphql-query/index.js +0 -75
  15. package/dist/catalog/communication/email-send/config.js +0 -80
  16. package/dist/catalog/communication/email-send/index.js +0 -152
  17. package/dist/catalog/communication/google-chat/config.js +0 -28
  18. package/dist/catalog/communication/google-chat/index.js +0 -36
  19. package/dist/catalog/communication/slack-message/config.js +0 -36
  20. package/dist/catalog/communication/slack-message/index.js +0 -37
  21. package/dist/catalog/communication/teams-message/config.js +0 -29
  22. package/dist/catalog/communication/teams-message/index.js +0 -39
  23. package/dist/catalog/communication/webhook-call/config.js +0 -31
  24. package/dist/catalog/communication/webhook-call/index.js +0 -43
  25. package/dist/catalog/communication/whatsapp-send/config.js +0 -36
  26. package/dist/catalog/communication/whatsapp-send/index.js +0 -57
  27. package/dist/catalog/general/query/config.js +0 -257
  28. package/dist/catalog/general/query/index.js +0 -271
  29. package/dist/catalog/general/query/types.js +0 -82
  30. package/dist/catalog/general/transform/config.js +0 -95
  31. package/dist/catalog/general/transform/index.js +0 -63
  32. package/dist/catalog/index.js +0 -168
  33. package/dist/catalog/logic/condition/config.js +0 -93
  34. package/dist/catalog/logic/condition/index.js +0 -64
  35. package/dist/catalog/logic/for-each/config.js +0 -75
  36. package/dist/catalog/logic/for-each/index.js +0 -92
  37. package/dist/catalog/logic/for-each/pathOptions.js +0 -151
  38. package/dist/catalog/logic/group/index.js +0 -46
  39. package/dist/catalog/policies.js +0 -62
  40. package/dist/catalog/storage/csv-action/index.js +0 -38
  41. package/dist/catalog/storage/dropbox-action/index.js +0 -33
  42. package/dist/catalog/storage/excel-action/index.js +0 -32
  43. package/dist/catalog/storage/file-action/index.js +0 -119
  44. package/dist/catalog/storage/file-operation/config.js +0 -45
  45. package/dist/catalog/storage/file-operation/index.js +0 -111
  46. package/dist/catalog/storage/ftp-action/index.js +0 -33
  47. package/dist/catalog/storage/google-drive-action/index.js +0 -38
  48. package/dist/catalog/storage/json-action/index.js +0 -31
  49. package/dist/catalog/storage/onedrive-action/index.js +0 -33
  50. package/dist/catalog/storage/s3-action/index.js +0 -36
  51. package/dist/catalog/storage/storage-action/index.js +0 -72
  52. package/dist/catalog/storage/storageCapabilities.js +0 -207
  53. package/dist/catalog/storage/xml-action/index.js +0 -31
  54. package/dist/catalog/transforms/format/config.js +0 -19
  55. package/dist/catalog/transforms/format/index.js +0 -39
  56. package/dist/catalog/triggers/connector-trigger/index.js +0 -72
  57. package/dist/catalog/triggers/manual-trigger/config.js +0 -60
  58. package/dist/catalog/triggers/manual-trigger/index.js +0 -74
  59. package/dist/catalog/triggers/schedule-trigger/config.js +0 -42
  60. package/dist/catalog/triggers/schedule-trigger/index.js +0 -102
  61. package/dist/catalog/triggers/webhook-trigger/config.js +0 -27
  62. package/dist/catalog/triggers/webhook-trigger/index.js +0 -89
  63. package/dist/catalog/types.js +0 -135
  64. package/dist/catalog/utility/debug/config.js +0 -90
  65. package/dist/catalog/utility/debug/index.js +0 -38
  66. package/dist/catalog/utility/error/config.js +0 -25
  67. package/dist/catalog/utility/error/index.js +0 -46
  68. package/dist/catalog/utility/variables/config.js +0 -70
  69. package/dist/catalog/utility/variables/index.js +0 -40
  70. package/dist/catalog/workflow.js +0 -25
  71. package/dist/ids.js +0 -53
  72. package/dist/rules/nodeConfigStatus.js +0 -217
  73. package/dist/rules/workflowValidator.js +0 -358
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octaviaflow/flow-rules",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "The flow action catalog and the rules engine behind Flow Doctor — one definition of what a step accepts and what makes a flow valid, shared by the editor and the server",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -12,9 +12,12 @@
12
12
  "import": "./dist/index.js"
13
13
  }
14
14
  },
15
- "files": ["dist", "README.md"],
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
16
19
  "scripts": {
17
- "build": "rm -rf dist && tsc -p tsconfig.build.json",
20
+ "build": "rm -rf dist && tsc -p tsconfig.build.json --emitDeclarationOnly && bun build src/index.ts --outdir dist --target node --format esm",
18
21
  "test": "bun test",
19
22
  "typecheck": "tsc --noEmit"
20
23
  },
@@ -25,12 +28,18 @@
25
28
  "engines": {
26
29
  "bun": ">=1.2.0"
27
30
  },
28
- "keywords": ["octaviaflow", "workflow", "actions", "validation", "flow-doctor"],
31
+ "keywords": [
32
+ "octaviaflow",
33
+ "workflow",
34
+ "actions",
35
+ "validation",
36
+ "flow-doctor"
37
+ ],
29
38
  "author": "Octaviaflow Team",
30
39
  "license": "Apache-2.0",
31
40
  "repository": {
32
41
  "type": "git",
33
- "url": "https://github.com/OctaviaFlow/Octaviaflow-System.git",
42
+ "url": "git+https://github.com/OctaviaFlow/Octaviaflow-System.git",
34
43
  "directory": "Octaviaflow-Flow-Rules"
35
44
  },
36
45
  "bugs": "https://github.com/OctaviaFlow/Octaviaflow-System/issues",
@@ -1,70 +0,0 @@
1
- /**
2
- * Console Log Configuration
3
- *
4
- * Defines the configuration structure and default values for the Console Log action
5
- */
6
- export const ConsoleLogConfig = {
7
- /**
8
- * Default configuration for Console Log
9
- */
10
- defaults: {
11
- message: '',
12
- level: 'info',
13
- data: undefined,
14
- includeInputData: true,
15
- },
16
- /**
17
- * Configuration schema for validation
18
- */
19
- schema: {
20
- message: {
21
- type: 'string',
22
- required: true,
23
- description: 'Message to log',
24
- },
25
- level: {
26
- type: 'select',
27
- required: false,
28
- description: 'Log level for the message',
29
- },
30
- data: {
31
- type: 'json',
32
- required: false,
33
- description: 'Additional data to log',
34
- },
35
- },
36
- /**
37
- * Validate configuration
38
- */
39
- validate: (config) => {
40
- const errors = [];
41
- if (!config.message) {
42
- errors.push('Message is required');
43
- }
44
- else if (typeof config.message !== 'string') {
45
- errors.push('Message must be a string');
46
- }
47
- if (config.level && !['info', 'warning', 'error', 'debug'].includes(config.level)) {
48
- errors.push('Invalid log level');
49
- }
50
- return {
51
- valid: errors.length === 0,
52
- errors,
53
- };
54
- },
55
- /**
56
- * Merge user config with defaults
57
- */
58
- merge: (userConfig) => {
59
- return {
60
- ...ConsoleLogConfig.defaults,
61
- ...userConfig,
62
- };
63
- },
64
- /**
65
- * Get display label for configuration
66
- */
67
- getLabel: (config) => {
68
- return `Log [${config.level}]: ${config.message}`;
69
- },
70
- };
@@ -1,89 +0,0 @@
1
- /**
2
- * Console Log Action
3
- *
4
- * Log messages to the workflow console for debugging and monitoring
5
- */
6
- import { ActionCategory, ActionType, ActionStatus, FieldType } from '../../types';
7
- export const consoleLogDefinition = {
8
- id: 'console_log',
9
- name: 'Console Log',
10
- description: 'Log messages to the workflow console for debugging',
11
- category: ActionCategory.Utility,
12
- type: ActionType.Console,
13
- tags: ['utility', 'logging', 'debug', 'built-in'],
14
- status: ActionStatus.Stable,
15
- icon: 'Terminal',
16
- color: '#525252',
17
- inputSchema: {
18
- fields: [
19
- {
20
- key: 'message',
21
- label: 'Message',
22
- type: FieldType.String,
23
- description: 'Message to log',
24
- placeholder: 'e.g., Processing user data...',
25
- validation: { required: true },
26
- },
27
- {
28
- key: 'level',
29
- label: 'Log Level',
30
- type: FieldType.Select,
31
- description: 'Log level for the message',
32
- defaultValue: 'info',
33
- options: [
34
- { label: 'Info', value: 'info' },
35
- { label: 'Warning', value: 'warning' },
36
- { label: 'Error', value: 'error' },
37
- { label: 'Debug', value: 'debug' },
38
- ],
39
- validation: { required: true },
40
- },
41
- {
42
- key: 'data',
43
- label: 'Data',
44
- type: FieldType.JSON,
45
- description: 'Additional data to log',
46
- validation: { required: false },
47
- },
48
- {
49
- key: 'includeInputData',
50
- label: 'Include previous step output',
51
- type: FieldType.Boolean,
52
- description: 'When off, only the custom message prints — useful for summary "Done" logs that follow a ForEach.',
53
- defaultValue: true,
54
- validation: { required: false },
55
- },
56
- ],
57
- },
58
- outputSchema: {
59
- type: 'object',
60
- properties: [
61
- {
62
- key: 'logged',
63
- type: FieldType.Boolean,
64
- description: 'Whether the message was successfully logged',
65
- },
66
- {
67
- key: 'timestamp',
68
- type: FieldType.DateTime,
69
- description: 'Timestamp of the log entry',
70
- },
71
- {
72
- key: 'level',
73
- type: FieldType.String,
74
- description: 'Log level used',
75
- },
76
- ],
77
- sampleOutput: {
78
- logged: true,
79
- timestamp: new Date().toISOString(),
80
- level: 'info',
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,79 +0,0 @@
1
- /**
2
- * Delay Configuration
3
- *
4
- * Defines the configuration structure and default values for the Delay action
5
- */
6
- export const DelayConfig = {
7
- /**
8
- * Default configuration for Delay
9
- */
10
- defaults: {
11
- duration: 1000,
12
- unit: 'milliseconds',
13
- },
14
- /**
15
- * Configuration schema for validation
16
- */
17
- schema: {
18
- duration: {
19
- type: 'number',
20
- required: true,
21
- description: 'Duration to delay',
22
- min: 0,
23
- },
24
- unit: {
25
- type: 'select',
26
- required: false,
27
- description: 'Time unit for the duration',
28
- },
29
- },
30
- /**
31
- * Validate configuration
32
- */
33
- validate: (config) => {
34
- const errors = [];
35
- if (config.duration === undefined || config.duration === null) {
36
- errors.push('Duration is required');
37
- }
38
- else if (typeof config.duration !== 'number') {
39
- errors.push('Duration must be a number');
40
- }
41
- else if (config.duration < 0) {
42
- errors.push('Duration must be non-negative');
43
- }
44
- if (config.unit && !['milliseconds', 'seconds', 'minutes', 'hours'].includes(config.unit)) {
45
- errors.push('Invalid time unit');
46
- }
47
- return {
48
- valid: errors.length === 0,
49
- errors,
50
- };
51
- },
52
- /**
53
- * Convert duration to milliseconds
54
- */
55
- toMilliseconds: (duration, unit = 'milliseconds') => {
56
- const multipliers = {
57
- milliseconds: 1,
58
- seconds: 1000,
59
- minutes: 60000,
60
- hours: 3600000,
61
- };
62
- return duration * (multipliers[unit] || 1);
63
- },
64
- /**
65
- * Merge user config with defaults
66
- */
67
- merge: (userConfig) => {
68
- return {
69
- ...DelayConfig.defaults,
70
- ...userConfig,
71
- };
72
- },
73
- /**
74
- * Get display label for configuration
75
- */
76
- getLabel: (config) => {
77
- return `Delay ${config.duration}${config.unit ? ' ' + config.unit : 'ms'}`;
78
- },
79
- };
@@ -1,71 +0,0 @@
1
- /**
2
- * Delay Action
3
- *
4
- * Pause workflow execution for a specified duration
5
- */
6
- import { ActionCategory, ActionType, ActionStatus, FieldType } from '../../types';
7
- export const delayDefinition = {
8
- id: 'delay',
9
- name: 'Delay',
10
- description: 'Pause workflow execution for a specified duration',
11
- category: ActionCategory.Utility,
12
- type: ActionType.Delay,
13
- tags: ['utility', 'delay', 'wait', 'built-in'],
14
- status: ActionStatus.Stable,
15
- icon: 'Timer',
16
- color: '#8f8f8f',
17
- inputSchema: {
18
- fields: [
19
- {
20
- key: 'duration',
21
- label: 'Duration (ms)',
22
- type: FieldType.Number,
23
- description: 'Duration to delay in milliseconds',
24
- defaultValue: 1000,
25
- validation: { required: true, min: 0 },
26
- },
27
- {
28
- key: 'unit',
29
- label: 'Unit',
30
- type: FieldType.Select,
31
- description: 'Time unit for the duration',
32
- defaultValue: 'milliseconds',
33
- options: [
34
- { label: 'Milliseconds', value: 'milliseconds' },
35
- { label: 'Seconds', value: 'seconds' },
36
- { label: 'Minutes', value: 'minutes' },
37
- { label: 'Hours', value: 'hours' },
38
- ],
39
- validation: { required: true },
40
- },
41
- ],
42
- },
43
- outputSchema: {
44
- type: 'object',
45
- properties: [
46
- {
47
- key: 'delayedFor',
48
- type: FieldType.Number,
49
- description: 'Actual delay duration in milliseconds',
50
- },
51
- {
52
- key: 'completedAt',
53
- type: FieldType.DateTime,
54
- description: 'Timestamp when delay completed',
55
- },
56
- ],
57
- sampleOutput: {
58
- delayedFor: 1000,
59
- completedAt: new Date().toISOString(),
60
- },
61
- },
62
- execution: {
63
- timeout: 3600000,
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
- };
@@ -1,38 +0,0 @@
1
- /**
2
- * Migration shim — legacy `{ duration, unit }` Delay config → v2 multi-mode shape.
3
- *
4
- * Runs at read time in both UI (panel renders v2 shape) and Engine (executor
5
- * dispatches v2 modes). One-way and pure: persisted v1 configs stay v1 on
6
- * disk until a user explicitly saves the step in the v2 UI panel.
7
- *
8
- * Detection rule: a config is v2 when it has a `mode` property; otherwise
9
- * treat as v1 and rewrite to fixed-mode with the legacy duration/unit.
10
- *
11
- * See implementation doc §5.7 for design rationale.
12
- */
13
- const LEGACY_UNITS = new Set([
14
- 'milliseconds',
15
- 'seconds',
16
- 'minutes',
17
- 'hours',
18
- ]);
19
- /**
20
- * Convert any persisted Delay config (v1 legacy or v2 multi-mode) into the v2
21
- * `DelayConfig` shape. Always safe to call — passes v2 inputs through unchanged.
22
- */
23
- export function migrateDelayConfig(raw) {
24
- if (raw && typeof raw === 'object' && 'mode' in raw) {
25
- return raw;
26
- }
27
- const legacy = (raw ?? {});
28
- const duration = typeof legacy.duration === 'number' && Number.isFinite(legacy.duration)
29
- ? legacy.duration
30
- : 1;
31
- const unit = typeof legacy.unit === 'string' && LEGACY_UNITS.has(legacy.unit)
32
- ? legacy.unit
33
- : 'milliseconds';
34
- return {
35
- mode: 'fixed',
36
- fixed: { duration, unit },
37
- };
38
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Delay Action — v2 type definitions.
3
- *
4
- * v2 turns Delay into a multi-mode primitive (fixed / until / random-jitter /
5
- * expression) with per-mode configs. See architecture doc for design rationale:
6
- * (design notes live in the platform's own documentation)
7
- *
8
- * PR 1 ships these types alongside the legacy `config.ts`. PR 3 collapses the
9
- * legacy file and rewrites the action definition (`index.ts`) against this
10
- * schema.
11
- */
12
- /**
13
- * Schema version. Bumped from the legacy 1.0.0 to mark the multi-mode
14
- * shape. The migration shim (`migrate.ts`) detects v1 configs by the
15
- * absence of `mode` and rewrites them to v2 fixed-mode equivalents.
16
- */
17
- export const DELAY_CONFIG_VERSION = '2.0.0';
@@ -1,111 +0,0 @@
1
- /**
2
- * HTTP Request Configuration
3
- *
4
- * Defines the configuration structure and default values for the HTTP Request action
5
- */
6
- export const HTTPRequestConfig = {
7
- /**
8
- * Default configuration for HTTP Request
9
- */
10
- defaults: {
11
- apiType: 'rest',
12
- method: 'GET',
13
- url: '',
14
- queryParams: [],
15
- headers: [],
16
- bodyType: 'json',
17
- body: undefined,
18
- formData: [],
19
- graphqlQuery: '',
20
- graphqlVariables: {},
21
- auth: { type: 'none' },
22
- timeout: 30000,
23
- failOnError: true,
24
- followRedirects: true,
25
- retry: { maxAttempts: 1, retryOn: [429, 500, 502, 503, 504], initialDelayMs: 1000, backoffFactor: 2, maxDelayMs: 30000 },
26
- pagination: { type: 'none' },
27
- extract: {},
28
- responseType: 'json',
29
- expectedContentTypes: [],
30
- },
31
- /**
32
- * Configuration schema for validation
33
- */
34
- schema: {
35
- method: {
36
- type: 'select',
37
- required: true,
38
- description: 'HTTP method to use',
39
- },
40
- url: {
41
- type: 'url',
42
- required: true,
43
- description: 'The URL to send the request to',
44
- },
45
- headers: {
46
- type: 'json',
47
- required: false,
48
- description: 'HTTP headers to send with the request',
49
- },
50
- body: {
51
- type: 'json',
52
- required: false,
53
- description: 'Request body (for POST, PUT, PATCH)',
54
- },
55
- timeout: {
56
- type: 'number',
57
- required: false,
58
- description: 'Request timeout in milliseconds',
59
- min: 1000,
60
- },
61
- },
62
- /**
63
- * Validate configuration
64
- */
65
- validate: (config) => {
66
- const errors = [];
67
- const apiType = config.apiType ?? 'rest';
68
- if (apiType === 'rest' && !config.method) {
69
- errors.push('Method is required');
70
- }
71
- if (apiType === 'graphql' && !config.graphqlQuery?.trim()) {
72
- errors.push('GraphQL query is required');
73
- }
74
- if (!config.url) {
75
- errors.push('URL is required');
76
- }
77
- else if (typeof config.url === 'string') {
78
- try {
79
- new URL(config.url);
80
- }
81
- catch {
82
- errors.push('Invalid URL format');
83
- }
84
- }
85
- if (config.timeout !== undefined && typeof config.timeout === 'number') {
86
- if (config.timeout < 1000) {
87
- errors.push('Timeout must be at least 1000ms');
88
- }
89
- }
90
- return {
91
- valid: errors.length === 0,
92
- errors,
93
- };
94
- },
95
- /**
96
- * Merge user config with defaults
97
- */
98
- merge: (userConfig) => {
99
- return {
100
- ...HTTPRequestConfig.defaults,
101
- ...userConfig,
102
- };
103
- },
104
- /**
105
- * Get display label for configuration
106
- */
107
- getLabel: (config) => {
108
- const type = config.apiType === 'graphql' ? 'GraphQL' : (config.method ?? 'GET');
109
- return `${type} ${config.url}`;
110
- },
111
- };