@marktoflow/core 2.0.0-alpha.7 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -220
- package/dist/built-in-operations.d.ts +150 -0
- package/dist/built-in-operations.d.ts.map +1 -0
- package/dist/built-in-operations.js +799 -0
- package/dist/built-in-operations.js.map +1 -0
- package/dist/core-tools.d.ts +39 -0
- package/dist/core-tools.d.ts.map +1 -0
- package/dist/core-tools.js +58 -0
- package/dist/core-tools.js.map +1 -0
- package/dist/credentials.d.ts +60 -1
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +229 -4
- package/dist/credentials.js.map +1 -1
- package/dist/engine.d.ts +144 -3
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +1385 -49
- package/dist/engine.js.map +1 -1
- package/dist/file-operations.d.ts +86 -0
- package/dist/file-operations.d.ts.map +1 -0
- package/dist/file-operations.js +363 -0
- package/dist/file-operations.js.map +1 -0
- package/dist/index.d.ts +16 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -4
- package/dist/index.js.map +1 -1
- package/dist/logging.d.ts +40 -2
- package/dist/logging.d.ts.map +1 -1
- package/dist/logging.js +166 -13
- package/dist/logging.js.map +1 -1
- package/dist/models.d.ts +1931 -203
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +303 -13
- package/dist/models.js.map +1 -1
- package/dist/nunjucks-filters.d.ts +271 -0
- package/dist/nunjucks-filters.d.ts.map +1 -0
- package/dist/nunjucks-filters.js +648 -0
- package/dist/nunjucks-filters.js.map +1 -0
- package/dist/oauth-manager.d.ts +128 -0
- package/dist/oauth-manager.d.ts.map +1 -0
- package/dist/oauth-manager.js +291 -0
- package/dist/oauth-manager.js.map +1 -0
- package/dist/oauth-refresh.d.ts +37 -0
- package/dist/oauth-refresh.d.ts.map +1 -0
- package/dist/oauth-refresh.js +76 -0
- package/dist/oauth-refresh.js.map +1 -0
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +291 -10
- package/dist/parser.js.map +1 -1
- package/dist/permissions.d.ts +49 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +286 -0
- package/dist/permissions.js.map +1 -0
- package/dist/prompt-loader.d.ts +53 -0
- package/dist/prompt-loader.d.ts.map +1 -0
- package/dist/prompt-loader.js +205 -0
- package/dist/prompt-loader.js.map +1 -0
- package/dist/scheduler.d.ts +22 -3
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/scheduler.js +72 -73
- package/dist/scheduler.js.map +1 -1
- package/dist/script-executor.d.ts +65 -0
- package/dist/script-executor.d.ts.map +1 -0
- package/dist/script-executor.js +261 -0
- package/dist/script-executor.js.map +1 -0
- package/dist/sdk-registry.d.ts +20 -2
- package/dist/sdk-registry.d.ts.map +1 -1
- package/dist/sdk-registry.js +100 -15
- package/dist/sdk-registry.js.map +1 -1
- package/dist/secret-providers/index.d.ts +12 -0
- package/dist/secret-providers/index.d.ts.map +1 -0
- package/dist/secret-providers/index.js +11 -0
- package/dist/secret-providers/index.js.map +1 -0
- package/dist/secret-providers/providers/aws.d.ts +32 -0
- package/dist/secret-providers/providers/aws.d.ts.map +1 -0
- package/dist/secret-providers/providers/aws.js +118 -0
- package/dist/secret-providers/providers/aws.js.map +1 -0
- package/dist/secret-providers/providers/azure.d.ts +40 -0
- package/dist/secret-providers/providers/azure.d.ts.map +1 -0
- package/dist/secret-providers/providers/azure.js +170 -0
- package/dist/secret-providers/providers/azure.js.map +1 -0
- package/dist/secret-providers/providers/env.d.ts +26 -0
- package/dist/secret-providers/providers/env.d.ts.map +1 -0
- package/dist/secret-providers/providers/env.js +59 -0
- package/dist/secret-providers/providers/env.js.map +1 -0
- package/dist/secret-providers/providers/vault.d.ts +39 -0
- package/dist/secret-providers/providers/vault.d.ts.map +1 -0
- package/dist/secret-providers/providers/vault.js +180 -0
- package/dist/secret-providers/providers/vault.js.map +1 -0
- package/dist/secret-providers/secret-manager.d.ts +72 -0
- package/dist/secret-providers/secret-manager.d.ts.map +1 -0
- package/dist/secret-providers/secret-manager.js +226 -0
- package/dist/secret-providers/secret-manager.js.map +1 -0
- package/dist/secret-providers/types.d.ts +105 -0
- package/dist/secret-providers/types.d.ts.map +1 -0
- package/dist/secret-providers/types.js +8 -0
- package/dist/secret-providers/types.js.map +1 -0
- package/dist/security.d.ts +1 -0
- package/dist/security.d.ts.map +1 -1
- package/dist/security.js +4 -0
- package/dist/security.js.map +1 -1
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +16 -9
- package/dist/state.js.map +1 -1
- package/dist/template-engine.d.ts +51 -0
- package/dist/template-engine.d.ts.map +1 -0
- package/dist/template-engine.js +227 -0
- package/dist/template-engine.js.map +1 -0
- package/dist/templates.d.ts +10 -0
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +21 -17
- package/dist/templates.js.map +1 -1
- package/dist/tools/mcp-tool.js +9 -9
- package/dist/tools/mcp-tool.js.map +1 -1
- package/dist/trigger-manager.js +1 -1
- package/dist/trigger-manager.js.map +1 -1
- package/dist/workflow-tools.d.ts +102 -0
- package/dist/workflow-tools.d.ts.map +1 -0
- package/dist/workflow-tools.js +130 -0
- package/dist/workflow-tools.js.map +1 -0
- package/package.json +24 -6
package/README.md
CHANGED
|
@@ -1,68 +1,51 @@
|
|
|
1
1
|
# @marktoflow/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Workflow engine for parsing, executing, and managing markdown-based automations.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@marktoflow/core)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Part of [marktoflow](../../README.md) — open-source markdown workflow automation.
|
|
8
8
|
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
- **Workflow Parser** - Parse markdown + YAML workflow definitions
|
|
12
|
-
- **Execution Engine** - Step-by-step workflow execution with retry and error handling
|
|
13
|
-
- **State Management** - SQLite-based persistent state tracking
|
|
14
|
-
- **Scheduling** - Cron-based workflow scheduling
|
|
15
|
-
- **Queue System** - Support for Redis, RabbitMQ, and in-memory queues
|
|
16
|
-
- **Webhooks** - HTTP webhook trigger support
|
|
17
|
-
- **File Watching** - Monitor files for changes and trigger workflows
|
|
18
|
-
- **Security** - RBAC, approval workflows, and audit logging
|
|
19
|
-
- **Cost Tracking** - Track and manage API usage costs
|
|
20
|
-
- **Plugin System** - Extensible plugin architecture with 17 hook types
|
|
21
|
-
- **Templates** - Reusable workflow templates with variables
|
|
22
|
-
- **Tool Registry** - Support for MCP, OpenAPI, and custom tools
|
|
23
|
-
- **Agent Routing** - Multi-agent workflow support with routing strategies
|
|
24
|
-
|
|
25
|
-
## Installation
|
|
9
|
+
## Quick Start
|
|
26
10
|
|
|
27
11
|
```bash
|
|
28
12
|
npm install @marktoflow/core
|
|
29
13
|
```
|
|
30
14
|
|
|
31
|
-
## Usage
|
|
32
|
-
|
|
33
|
-
### Basic Workflow Execution
|
|
34
|
-
|
|
35
15
|
```typescript
|
|
36
16
|
import { WorkflowParser, WorkflowEngine } from '@marktoflow/core';
|
|
37
17
|
|
|
38
|
-
// Parse workflow
|
|
39
18
|
const parser = new WorkflowParser();
|
|
40
19
|
const workflow = await parser.parseWorkflow('workflow.md');
|
|
41
20
|
|
|
42
|
-
// Execute workflow
|
|
43
21
|
const engine = new WorkflowEngine();
|
|
44
22
|
const result = await engine.execute(workflow, {
|
|
45
23
|
inputs: { message: 'Hello World' },
|
|
46
24
|
});
|
|
47
|
-
|
|
48
|
-
console.log(result);
|
|
49
25
|
```
|
|
50
26
|
|
|
51
|
-
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- **Workflow Parser** — Parse markdown + YAML workflow definitions
|
|
30
|
+
- **Execution Engine** — Step-by-step execution with retry, circuit breakers, and error handling
|
|
31
|
+
- **State Management** — SQLite-based persistent state tracking
|
|
32
|
+
- **Plugin System** — Extensible architecture with 17 hook types
|
|
33
|
+
- **Cost Tracking** — Monitor and budget API usage per workflow
|
|
34
|
+
- **Scheduling** — Cron-based workflow scheduling
|
|
35
|
+
- **Security** — RBAC, approval workflows, and audit logging
|
|
36
|
+
- **Queue System** — Distributed execution via Redis, RabbitMQ, or in-memory
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### State Management
|
|
52
41
|
|
|
53
42
|
```typescript
|
|
54
43
|
import { WorkflowEngine, StateManager } from '@marktoflow/core';
|
|
55
44
|
|
|
56
|
-
|
|
57
|
-
const stateManager = new StateManager({
|
|
58
|
-
dbPath: '.marktoflow/state.db',
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
// Execute workflow with state
|
|
45
|
+
const stateManager = new StateManager({ dbPath: '.marktoflow/state.db' });
|
|
62
46
|
const engine = new WorkflowEngine({ stateManager });
|
|
63
47
|
const result = await engine.execute(workflow);
|
|
64
48
|
|
|
65
|
-
// Query state
|
|
66
49
|
const history = await stateManager.getWorkflowHistory(workflow.id);
|
|
67
50
|
```
|
|
68
51
|
|
|
@@ -71,234 +54,55 @@ const history = await stateManager.getWorkflowHistory(workflow.id);
|
|
|
71
54
|
```typescript
|
|
72
55
|
import { Scheduler } from '@marktoflow/core';
|
|
73
56
|
|
|
74
|
-
// Create scheduler
|
|
75
57
|
const scheduler = new Scheduler();
|
|
76
|
-
|
|
77
|
-
// Schedule workflow (cron format)
|
|
78
58
|
await scheduler.schedule({
|
|
79
59
|
workflowId: 'daily-report',
|
|
80
|
-
cron: '0 9 * * 1-5',
|
|
60
|
+
cron: '0 9 * * 1-5',
|
|
81
61
|
workflowPath: './workflows/daily-report.md',
|
|
82
62
|
});
|
|
83
|
-
|
|
84
|
-
// Start scheduler
|
|
85
63
|
await scheduler.start();
|
|
86
64
|
```
|
|
87
65
|
|
|
88
|
-
### Webhooks
|
|
89
|
-
|
|
90
|
-
```typescript
|
|
91
|
-
import { WebhookServer } from '@marktoflow/core';
|
|
92
|
-
|
|
93
|
-
// Create webhook server
|
|
94
|
-
const webhookServer = new WebhookServer({ port: 3000 });
|
|
95
|
-
|
|
96
|
-
// Register webhook
|
|
97
|
-
await webhookServer.registerWebhook({
|
|
98
|
-
path: '/github',
|
|
99
|
-
workflowPath: './workflows/github-pr.md',
|
|
100
|
-
secret: process.env.GITHUB_WEBHOOK_SECRET,
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
// Start server
|
|
104
|
-
await webhookServer.start();
|
|
105
|
-
```
|
|
106
|
-
|
|
107
66
|
### Plugin System
|
|
108
67
|
|
|
109
68
|
```typescript
|
|
110
69
|
import { PluginRegistry } from '@marktoflow/core';
|
|
111
70
|
|
|
112
|
-
// Register plugin
|
|
113
71
|
const registry = new PluginRegistry();
|
|
114
72
|
await registry.register({
|
|
115
73
|
name: 'my-plugin',
|
|
116
74
|
hooks: {
|
|
117
|
-
beforeWorkflowStart: async (
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
afterStepComplete: async (context) => {
|
|
121
|
-
console.log('Completed step:', context.step.action);
|
|
122
|
-
},
|
|
75
|
+
beforeWorkflowStart: async (ctx) => console.log('Starting:', ctx.workflow.id),
|
|
76
|
+
afterStepComplete: async (ctx) => console.log('Done:', ctx.step.action),
|
|
123
77
|
},
|
|
124
78
|
});
|
|
125
79
|
```
|
|
126
80
|
|
|
127
|
-
## Workflow Format
|
|
128
|
-
|
|
129
|
-
Workflows are written in markdown with YAML frontmatter:
|
|
130
|
-
|
|
131
|
-
```markdown
|
|
132
|
-
---
|
|
133
|
-
workflow:
|
|
134
|
-
id: example
|
|
135
|
-
name: Example Workflow
|
|
136
|
-
|
|
137
|
-
tools:
|
|
138
|
-
slack:
|
|
139
|
-
sdk: '@slack/web-api'
|
|
140
|
-
auth:
|
|
141
|
-
token: '${SLACK_BOT_TOKEN}'
|
|
142
|
-
|
|
143
|
-
triggers:
|
|
144
|
-
- type: schedule
|
|
145
|
-
cron: '0 9 * * *'
|
|
146
|
-
|
|
147
|
-
inputs:
|
|
148
|
-
message:
|
|
149
|
-
type: string
|
|
150
|
-
required: true
|
|
151
|
-
|
|
152
|
-
outputs:
|
|
153
|
-
result:
|
|
154
|
-
type: string
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
# Example Workflow
|
|
158
|
-
|
|
159
|
-
This workflow posts a message to Slack.
|
|
160
|
-
|
|
161
|
-
## Step 1: Post Message
|
|
162
|
-
|
|
163
|
-
\`\`\`yaml
|
|
164
|
-
action: slack.chat.postMessage
|
|
165
|
-
inputs:
|
|
166
|
-
channel: '#general'
|
|
167
|
-
text: '{{ inputs.message }}'
|
|
168
|
-
output_variable: result
|
|
169
|
-
\`\`\`
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
## Architecture
|
|
173
|
-
|
|
174
|
-
### Core Components
|
|
175
|
-
|
|
176
|
-
1. **Parser** (`parser.ts`) - Parse markdown + YAML workflow definitions
|
|
177
|
-
2. **Engine** (`engine.ts`) - Execute workflows with retry/circuit breaker
|
|
178
|
-
3. **State Manager** (`state.ts`) - SQLite-based state persistence
|
|
179
|
-
4. **Scheduler** (`scheduler.ts`) - Cron-based workflow scheduling
|
|
180
|
-
5. **Queue** (`queue.ts`) - Redis/RabbitMQ/InMemory queue support
|
|
181
|
-
6. **Webhook** (`webhook.ts`) - HTTP webhook triggers
|
|
182
|
-
7. **File Watcher** (`filewatcher.ts`) - File change monitoring
|
|
183
|
-
8. **Security** (`security.ts`) - RBAC and audit logging
|
|
184
|
-
9. **Cost Tracker** (`costs.ts`) - API usage cost management
|
|
185
|
-
10. **Plugin System** (`plugins.ts`) - Extensible hooks
|
|
186
|
-
11. **Templates** (`templates.ts`) - Reusable workflow patterns
|
|
187
|
-
12. **Tool Registry** (`tool-registry.ts`) - MCP/OpenAPI/Custom tools
|
|
188
|
-
13. **Agent Routing** (`routing.ts`) - Multi-agent coordination
|
|
189
|
-
|
|
190
|
-
### Execution Flow
|
|
191
|
-
|
|
192
|
-
```
|
|
193
|
-
Parser → Validate → Security Check → Execute Steps → Save State → Output
|
|
194
|
-
↓ ↓ ↓ ↓
|
|
195
|
-
Schema RBAC Retry/Failover Audit Log
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
## Configuration
|
|
199
|
-
|
|
200
|
-
### Environment Variables
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
# Database
|
|
204
|
-
MARKTOFLOW_DB_PATH=.marktoflow/state.db
|
|
205
|
-
|
|
206
|
-
# Queue (Redis)
|
|
207
|
-
REDIS_HOST=localhost
|
|
208
|
-
REDIS_PORT=6379
|
|
209
|
-
|
|
210
|
-
# Queue (RabbitMQ)
|
|
211
|
-
RABBITMQ_URL=amqp://localhost
|
|
212
|
-
|
|
213
|
-
# Security
|
|
214
|
-
MARKTOFLOW_SECRET_KEY=your-secret-key
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Configuration File
|
|
218
|
-
|
|
219
|
-
Create `.marktoflow/config.yaml`:
|
|
220
|
-
|
|
221
|
-
```yaml
|
|
222
|
-
state:
|
|
223
|
-
dbPath: .marktoflow/state.db
|
|
224
|
-
|
|
225
|
-
queue:
|
|
226
|
-
type: redis # redis, rabbitmq, or memory
|
|
227
|
-
redis:
|
|
228
|
-
host: localhost
|
|
229
|
-
port: 6379
|
|
230
|
-
|
|
231
|
-
security:
|
|
232
|
-
rbac:
|
|
233
|
-
enabled: true
|
|
234
|
-
auditLog:
|
|
235
|
-
enabled: true
|
|
236
|
-
|
|
237
|
-
costs:
|
|
238
|
-
budget:
|
|
239
|
-
daily: 100
|
|
240
|
-
monthly: 3000
|
|
241
|
-
alerts:
|
|
242
|
-
- threshold: 50
|
|
243
|
-
emails: [admin@example.com]
|
|
244
|
-
```
|
|
245
|
-
|
|
246
81
|
## API Reference
|
|
247
82
|
|
|
248
|
-
### WorkflowParser
|
|
249
|
-
|
|
250
83
|
```typescript
|
|
251
84
|
class WorkflowParser {
|
|
252
85
|
parseWorkflow(filePath: string): Promise<Workflow>;
|
|
253
86
|
parseYAML(content: string): Workflow;
|
|
254
87
|
validate(workflow: Workflow): ValidationResult;
|
|
255
88
|
}
|
|
256
|
-
```
|
|
257
89
|
|
|
258
|
-
### WorkflowEngine
|
|
259
|
-
|
|
260
|
-
```typescript
|
|
261
90
|
class WorkflowEngine {
|
|
262
91
|
constructor(options?: EngineOptions);
|
|
263
92
|
execute(workflow: Workflow, context?: ExecutionContext): Promise<WorkflowResult>;
|
|
264
93
|
stop(): Promise<void>;
|
|
265
94
|
}
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
### StateManager
|
|
269
95
|
|
|
270
|
-
```typescript
|
|
271
96
|
class StateManager {
|
|
272
97
|
constructor(options: StateOptions);
|
|
273
98
|
getWorkflowHistory(workflowId: string): Promise<WorkflowRun[]>;
|
|
274
|
-
getWorkflowState(runId: string): Promise<WorkflowState>;
|
|
275
99
|
saveWorkflowState(state: WorkflowState): Promise<void>;
|
|
276
100
|
}
|
|
277
101
|
```
|
|
278
102
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
```typescript
|
|
282
|
-
class Scheduler {
|
|
283
|
-
schedule(config: ScheduleConfig): Promise<void>;
|
|
284
|
-
unschedule(workflowId: string): Promise<void>;
|
|
285
|
-
start(): Promise<void>;
|
|
286
|
-
stop(): Promise<void>;
|
|
287
|
-
}
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
## Testing
|
|
291
|
-
|
|
292
|
-
```bash
|
|
293
|
-
npm test
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
## Links
|
|
103
|
+
## Contributing
|
|
297
104
|
|
|
298
|
-
|
|
299
|
-
- [Documentation](https://github.com/scottgl9/marktoflow#readme)
|
|
300
|
-
- [CLI Package](@marktoflow/cli)
|
|
301
|
-
- [Integrations Package](@marktoflow/integrations)
|
|
105
|
+
See the [contributing guide](https://github.com/marktoflow/marktoflow/blob/main/CONTRIBUTING.md).
|
|
302
106
|
|
|
303
107
|
## License
|
|
304
108
|
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Operations for marktoflow
|
|
3
|
+
*
|
|
4
|
+
* Provides common operations that eliminate the need for verbose script blocks:
|
|
5
|
+
* - core.set: Simple variable assignment
|
|
6
|
+
* - core.transform: Map/filter/reduce transformations
|
|
7
|
+
* - core.extract: Nested path access
|
|
8
|
+
* - core.format: Date/number/string formatting
|
|
9
|
+
* - file.read: Read files with format conversion (docx, pdf, xlsx)
|
|
10
|
+
* - file.write: Write files (text or binary)
|
|
11
|
+
*/
|
|
12
|
+
import { ExecutionContext } from './models.js';
|
|
13
|
+
export interface SetOperationInputs {
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface TransformOperationInputs {
|
|
17
|
+
input: unknown[];
|
|
18
|
+
operation: 'map' | 'filter' | 'reduce' | 'find' | 'group_by' | 'unique' | 'sort';
|
|
19
|
+
expression?: string;
|
|
20
|
+
condition?: string;
|
|
21
|
+
initialValue?: unknown;
|
|
22
|
+
key?: string;
|
|
23
|
+
reverse?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface ExtractOperationInputs {
|
|
26
|
+
input: unknown;
|
|
27
|
+
path: string;
|
|
28
|
+
default?: unknown;
|
|
29
|
+
}
|
|
30
|
+
export interface FormatOperationInputs {
|
|
31
|
+
value: unknown;
|
|
32
|
+
type: 'date' | 'number' | 'string' | 'currency' | 'json';
|
|
33
|
+
format?: string;
|
|
34
|
+
locale?: string;
|
|
35
|
+
currency?: string;
|
|
36
|
+
precision?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Set multiple variables at once with expression resolution.
|
|
40
|
+
*
|
|
41
|
+
* Example:
|
|
42
|
+
* ```yaml
|
|
43
|
+
* action: core.set
|
|
44
|
+
* inputs:
|
|
45
|
+
* owner: "{{ inputs.repo =~ /^([^\/]+)\// }}"
|
|
46
|
+
* repo_name: "{{ inputs.repo =~ /\/(.+)$/ }}"
|
|
47
|
+
* timestamp: "{{ now() }}"
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function executeSet(inputs: SetOperationInputs, context: ExecutionContext): Record<string, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* Transform arrays using common operations like map, filter, reduce.
|
|
53
|
+
*
|
|
54
|
+
* Examples:
|
|
55
|
+
*
|
|
56
|
+
* Map:
|
|
57
|
+
* ```yaml
|
|
58
|
+
* action: core.transform
|
|
59
|
+
* inputs:
|
|
60
|
+
* input: "{{ oncall_response.data.oncalls }}"
|
|
61
|
+
* operation: map
|
|
62
|
+
* expression: "@{{ item.user.name }}"
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* Filter:
|
|
66
|
+
* ```yaml
|
|
67
|
+
* action: core.transform
|
|
68
|
+
* inputs:
|
|
69
|
+
* input: "{{ issues }}"
|
|
70
|
+
* operation: filter
|
|
71
|
+
* condition: "item.priority == 'high'"
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* Reduce:
|
|
75
|
+
* ```yaml
|
|
76
|
+
* action: core.transform
|
|
77
|
+
* inputs:
|
|
78
|
+
* input: "{{ numbers }}"
|
|
79
|
+
* operation: reduce
|
|
80
|
+
* expression: "{{ accumulator + item }}"
|
|
81
|
+
* initialValue: 0
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function executeTransform(rawInputs: TransformOperationInputs, resolvedInputs: Record<string, unknown>, context: ExecutionContext): unknown;
|
|
85
|
+
/**
|
|
86
|
+
* Extract values from nested objects safely.
|
|
87
|
+
*
|
|
88
|
+
* Example:
|
|
89
|
+
* ```yaml
|
|
90
|
+
* action: core.extract
|
|
91
|
+
* inputs:
|
|
92
|
+
* input: "{{ api_response }}"
|
|
93
|
+
* path: "data.users[0].email"
|
|
94
|
+
* default: "unknown@example.com"
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare function executeExtract(inputs: ExtractOperationInputs, context: ExecutionContext): unknown;
|
|
98
|
+
/**
|
|
99
|
+
* Format values for display (dates, numbers, strings, currency).
|
|
100
|
+
*
|
|
101
|
+
* Examples:
|
|
102
|
+
*
|
|
103
|
+
* Date:
|
|
104
|
+
* ```yaml
|
|
105
|
+
* action: core.format
|
|
106
|
+
* inputs:
|
|
107
|
+
* value: "{{ now() }}"
|
|
108
|
+
* type: date
|
|
109
|
+
* format: "YYYY-MM-DD HH:mm:ss"
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* Number:
|
|
113
|
+
* ```yaml
|
|
114
|
+
* action: core.format
|
|
115
|
+
* inputs:
|
|
116
|
+
* value: 1234.56
|
|
117
|
+
* type: number
|
|
118
|
+
* precision: 2
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* Currency:
|
|
122
|
+
* ```yaml
|
|
123
|
+
* action: core.format
|
|
124
|
+
* inputs:
|
|
125
|
+
* value: 1234.56
|
|
126
|
+
* type: currency
|
|
127
|
+
* currency: USD
|
|
128
|
+
* locale: en-US
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export declare function executeFormat(inputs: FormatOperationInputs, context: ExecutionContext): string;
|
|
132
|
+
/**
|
|
133
|
+
* Execute a built-in operation based on action name
|
|
134
|
+
*/
|
|
135
|
+
export declare function executeBuiltInOperation(action: string, rawInputs: Record<string, unknown>, resolvedInputs: Record<string, unknown>, context: ExecutionContext): unknown | Promise<unknown>;
|
|
136
|
+
/**
|
|
137
|
+
* Check if an action is a built-in operation
|
|
138
|
+
*/
|
|
139
|
+
export declare function isBuiltInOperation(action: string): boolean;
|
|
140
|
+
export declare function executeAggregate(inputs: Record<string, unknown>, _context: ExecutionContext): unknown;
|
|
141
|
+
export declare function executeCompare(inputs: Record<string, unknown>, _context: ExecutionContext): unknown;
|
|
142
|
+
export declare function executeRenameKeys(inputs: Record<string, unknown>): unknown;
|
|
143
|
+
export declare function executeLimit(inputs: Record<string, unknown>): unknown;
|
|
144
|
+
export declare function executeSortOperation(inputs: Record<string, unknown>): unknown;
|
|
145
|
+
export declare function executeCrypto(inputs: Record<string, unknown>): unknown;
|
|
146
|
+
export declare function executeDatetime(inputs: Record<string, unknown>): unknown;
|
|
147
|
+
export declare function executeParse(inputs: Record<string, unknown>): unknown;
|
|
148
|
+
export declare function executeCompress(inputs: Record<string, unknown>): unknown;
|
|
149
|
+
export declare function executeDecompress(inputs: Record<string, unknown>): unknown;
|
|
150
|
+
//# sourceMappingURL=built-in-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"built-in-operations.d.ts","sourceRoot":"","sources":["../src/built-in-operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAQ/C,MAAM,WAAW,kBAAkB;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,SAAS,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;IACjF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC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