@marktoflow/core 2.0.0-alpha.9 → 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 -222
- 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 +92 -3
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +937 -59
- 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 +1441 -54
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +124 -2
- 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 +113 -3
- 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 +30 -12
- package/LICENSE +0 -201
package/README.md
CHANGED
|
@@ -1,70 +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
|
-
## Features
|
|
12
|
-
|
|
13
|
-
- **Workflow Parser** - Parse markdown + YAML workflow definitions
|
|
14
|
-
- **Execution Engine** - Step-by-step workflow execution with retry and error handling
|
|
15
|
-
- **State Management** - SQLite-based persistent state tracking
|
|
16
|
-
- **Scheduling** - Cron-based workflow scheduling
|
|
17
|
-
- **Queue System** - Support for Redis, RabbitMQ, and in-memory queues
|
|
18
|
-
- **Webhooks** - HTTP webhook trigger support
|
|
19
|
-
- **File Watching** - Monitor files for changes and trigger workflows
|
|
20
|
-
- **Security** - RBAC, approval workflows, and audit logging
|
|
21
|
-
- **Cost Tracking** - Track and manage API usage costs
|
|
22
|
-
- **Plugin System** - Extensible plugin architecture with 17 hook types
|
|
23
|
-
- **Templates** - Reusable workflow templates with variables
|
|
24
|
-
- **Tool Registry** - Support for MCP, OpenAPI, and custom tools
|
|
25
|
-
- **Agent Routing** - Multi-agent workflow support with routing strategies
|
|
26
|
-
|
|
27
|
-
## Installation
|
|
9
|
+
## Quick Start
|
|
28
10
|
|
|
29
11
|
```bash
|
|
30
12
|
npm install @marktoflow/core
|
|
31
13
|
```
|
|
32
14
|
|
|
33
|
-
## Usage
|
|
34
|
-
|
|
35
|
-
### Basic Workflow Execution
|
|
36
|
-
|
|
37
15
|
```typescript
|
|
38
16
|
import { WorkflowParser, WorkflowEngine } from '@marktoflow/core';
|
|
39
17
|
|
|
40
|
-
// Parse workflow
|
|
41
18
|
const parser = new WorkflowParser();
|
|
42
19
|
const workflow = await parser.parseWorkflow('workflow.md');
|
|
43
20
|
|
|
44
|
-
// Execute workflow
|
|
45
21
|
const engine = new WorkflowEngine();
|
|
46
22
|
const result = await engine.execute(workflow, {
|
|
47
23
|
inputs: { message: 'Hello World' },
|
|
48
24
|
});
|
|
49
|
-
|
|
50
|
-
console.log(result);
|
|
51
25
|
```
|
|
52
26
|
|
|
53
|
-
|
|
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
|
|
54
41
|
|
|
55
42
|
```typescript
|
|
56
43
|
import { WorkflowEngine, StateManager } from '@marktoflow/core';
|
|
57
44
|
|
|
58
|
-
|
|
59
|
-
const stateManager = new StateManager({
|
|
60
|
-
dbPath: '.marktoflow/state.db',
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// Execute workflow with state
|
|
45
|
+
const stateManager = new StateManager({ dbPath: '.marktoflow/state.db' });
|
|
64
46
|
const engine = new WorkflowEngine({ stateManager });
|
|
65
47
|
const result = await engine.execute(workflow);
|
|
66
48
|
|
|
67
|
-
// Query state
|
|
68
49
|
const history = await stateManager.getWorkflowHistory(workflow.id);
|
|
69
50
|
```
|
|
70
51
|
|
|
@@ -73,234 +54,55 @@ const history = await stateManager.getWorkflowHistory(workflow.id);
|
|
|
73
54
|
```typescript
|
|
74
55
|
import { Scheduler } from '@marktoflow/core';
|
|
75
56
|
|
|
76
|
-
// Create scheduler
|
|
77
57
|
const scheduler = new Scheduler();
|
|
78
|
-
|
|
79
|
-
// Schedule workflow (cron format)
|
|
80
58
|
await scheduler.schedule({
|
|
81
59
|
workflowId: 'daily-report',
|
|
82
|
-
cron: '0 9 * * 1-5',
|
|
60
|
+
cron: '0 9 * * 1-5',
|
|
83
61
|
workflowPath: './workflows/daily-report.md',
|
|
84
62
|
});
|
|
85
|
-
|
|
86
|
-
// Start scheduler
|
|
87
63
|
await scheduler.start();
|
|
88
64
|
```
|
|
89
65
|
|
|
90
|
-
### Webhooks
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
import { WebhookServer } from '@marktoflow/core';
|
|
94
|
-
|
|
95
|
-
// Create webhook server
|
|
96
|
-
const webhookServer = new WebhookServer({ port: 3000 });
|
|
97
|
-
|
|
98
|
-
// Register webhook
|
|
99
|
-
await webhookServer.registerWebhook({
|
|
100
|
-
path: '/github',
|
|
101
|
-
workflowPath: './workflows/github-pr.md',
|
|
102
|
-
secret: process.env.GITHUB_WEBHOOK_SECRET,
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
// Start server
|
|
106
|
-
await webhookServer.start();
|
|
107
|
-
```
|
|
108
|
-
|
|
109
66
|
### Plugin System
|
|
110
67
|
|
|
111
68
|
```typescript
|
|
112
69
|
import { PluginRegistry } from '@marktoflow/core';
|
|
113
70
|
|
|
114
|
-
// Register plugin
|
|
115
71
|
const registry = new PluginRegistry();
|
|
116
72
|
await registry.register({
|
|
117
73
|
name: 'my-plugin',
|
|
118
74
|
hooks: {
|
|
119
|
-
beforeWorkflowStart: async (
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
afterStepComplete: async (context) => {
|
|
123
|
-
console.log('Completed step:', context.step.action);
|
|
124
|
-
},
|
|
75
|
+
beforeWorkflowStart: async (ctx) => console.log('Starting:', ctx.workflow.id),
|
|
76
|
+
afterStepComplete: async (ctx) => console.log('Done:', ctx.step.action),
|
|
125
77
|
},
|
|
126
78
|
});
|
|
127
79
|
```
|
|
128
80
|
|
|
129
|
-
## Workflow Format
|
|
130
|
-
|
|
131
|
-
Workflows are written in markdown with YAML frontmatter:
|
|
132
|
-
|
|
133
|
-
```markdown
|
|
134
|
-
---
|
|
135
|
-
workflow:
|
|
136
|
-
id: example
|
|
137
|
-
name: Example Workflow
|
|
138
|
-
|
|
139
|
-
tools:
|
|
140
|
-
slack:
|
|
141
|
-
sdk: '@slack/web-api'
|
|
142
|
-
auth:
|
|
143
|
-
token: '${SLACK_BOT_TOKEN}'
|
|
144
|
-
|
|
145
|
-
triggers:
|
|
146
|
-
- type: schedule
|
|
147
|
-
cron: '0 9 * * *'
|
|
148
|
-
|
|
149
|
-
inputs:
|
|
150
|
-
message:
|
|
151
|
-
type: string
|
|
152
|
-
required: true
|
|
153
|
-
|
|
154
|
-
outputs:
|
|
155
|
-
result:
|
|
156
|
-
type: string
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
# Example Workflow
|
|
160
|
-
|
|
161
|
-
This workflow posts a message to Slack.
|
|
162
|
-
|
|
163
|
-
## Step 1: Post Message
|
|
164
|
-
|
|
165
|
-
\`\`\`yaml
|
|
166
|
-
action: slack.chat.postMessage
|
|
167
|
-
inputs:
|
|
168
|
-
channel: '#general'
|
|
169
|
-
text: '{{ inputs.message }}'
|
|
170
|
-
output_variable: result
|
|
171
|
-
\`\`\`
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
## Architecture
|
|
175
|
-
|
|
176
|
-
### Core Components
|
|
177
|
-
|
|
178
|
-
1. **Parser** (`parser.ts`) - Parse markdown + YAML workflow definitions
|
|
179
|
-
2. **Engine** (`engine.ts`) - Execute workflows with retry/circuit breaker
|
|
180
|
-
3. **State Manager** (`state.ts`) - SQLite-based state persistence
|
|
181
|
-
4. **Scheduler** (`scheduler.ts`) - Cron-based workflow scheduling
|
|
182
|
-
5. **Queue** (`queue.ts`) - Redis/RabbitMQ/InMemory queue support
|
|
183
|
-
6. **Webhook** (`webhook.ts`) - HTTP webhook triggers
|
|
184
|
-
7. **File Watcher** (`filewatcher.ts`) - File change monitoring
|
|
185
|
-
8. **Security** (`security.ts`) - RBAC and audit logging
|
|
186
|
-
9. **Cost Tracker** (`costs.ts`) - API usage cost management
|
|
187
|
-
10. **Plugin System** (`plugins.ts`) - Extensible hooks
|
|
188
|
-
11. **Templates** (`templates.ts`) - Reusable workflow patterns
|
|
189
|
-
12. **Tool Registry** (`tool-registry.ts`) - MCP/OpenAPI/Custom tools
|
|
190
|
-
13. **Agent Routing** (`routing.ts`) - Multi-agent coordination
|
|
191
|
-
|
|
192
|
-
### Execution Flow
|
|
193
|
-
|
|
194
|
-
```
|
|
195
|
-
Parser → Validate → Security Check → Execute Steps → Save State → Output
|
|
196
|
-
↓ ↓ ↓ ↓
|
|
197
|
-
Schema RBAC Retry/Failover Audit Log
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
## Configuration
|
|
201
|
-
|
|
202
|
-
### Environment Variables
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
# Database
|
|
206
|
-
MARKTOFLOW_DB_PATH=.marktoflow/state.db
|
|
207
|
-
|
|
208
|
-
# Queue (Redis)
|
|
209
|
-
REDIS_HOST=localhost
|
|
210
|
-
REDIS_PORT=6379
|
|
211
|
-
|
|
212
|
-
# Queue (RabbitMQ)
|
|
213
|
-
RABBITMQ_URL=amqp://localhost
|
|
214
|
-
|
|
215
|
-
# Security
|
|
216
|
-
MARKTOFLOW_SECRET_KEY=your-secret-key
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
### Configuration File
|
|
220
|
-
|
|
221
|
-
Create `.marktoflow/config.yaml`:
|
|
222
|
-
|
|
223
|
-
```yaml
|
|
224
|
-
state:
|
|
225
|
-
dbPath: .marktoflow/state.db
|
|
226
|
-
|
|
227
|
-
queue:
|
|
228
|
-
type: redis # redis, rabbitmq, or memory
|
|
229
|
-
redis:
|
|
230
|
-
host: localhost
|
|
231
|
-
port: 6379
|
|
232
|
-
|
|
233
|
-
security:
|
|
234
|
-
rbac:
|
|
235
|
-
enabled: true
|
|
236
|
-
auditLog:
|
|
237
|
-
enabled: true
|
|
238
|
-
|
|
239
|
-
costs:
|
|
240
|
-
budget:
|
|
241
|
-
daily: 100
|
|
242
|
-
monthly: 3000
|
|
243
|
-
alerts:
|
|
244
|
-
- threshold: 50
|
|
245
|
-
emails: [admin@example.com]
|
|
246
|
-
```
|
|
247
|
-
|
|
248
81
|
## API Reference
|
|
249
82
|
|
|
250
|
-
### WorkflowParser
|
|
251
|
-
|
|
252
83
|
```typescript
|
|
253
84
|
class WorkflowParser {
|
|
254
85
|
parseWorkflow(filePath: string): Promise<Workflow>;
|
|
255
86
|
parseYAML(content: string): Workflow;
|
|
256
87
|
validate(workflow: Workflow): ValidationResult;
|
|
257
88
|
}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### WorkflowEngine
|
|
261
89
|
|
|
262
|
-
```typescript
|
|
263
90
|
class WorkflowEngine {
|
|
264
91
|
constructor(options?: EngineOptions);
|
|
265
92
|
execute(workflow: Workflow, context?: ExecutionContext): Promise<WorkflowResult>;
|
|
266
93
|
stop(): Promise<void>;
|
|
267
94
|
}
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
### StateManager
|
|
271
95
|
|
|
272
|
-
```typescript
|
|
273
96
|
class StateManager {
|
|
274
97
|
constructor(options: StateOptions);
|
|
275
98
|
getWorkflowHistory(workflowId: string): Promise<WorkflowRun[]>;
|
|
276
|
-
getWorkflowState(runId: string): Promise<WorkflowState>;
|
|
277
99
|
saveWorkflowState(state: WorkflowState): Promise<void>;
|
|
278
100
|
}
|
|
279
101
|
```
|
|
280
102
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
```typescript
|
|
284
|
-
class Scheduler {
|
|
285
|
-
schedule(config: ScheduleConfig): Promise<void>;
|
|
286
|
-
unschedule(workflowId: string): Promise<void>;
|
|
287
|
-
start(): Promise<void>;
|
|
288
|
-
stop(): Promise<void>;
|
|
289
|
-
}
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
## Testing
|
|
293
|
-
|
|
294
|
-
```bash
|
|
295
|
-
npm test
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
## Links
|
|
103
|
+
## Contributing
|
|
299
104
|
|
|
300
|
-
|
|
301
|
-
- [Documentation](https://github.com/scottgl9/marktoflow#readme)
|
|
302
|
-
- [CLI Package](@marktoflow/cli)
|
|
303
|
-
- [Integrations Package](@marktoflow/integrations)
|
|
105
|
+
See the [contributing guide](https://github.com/marktoflow/marktoflow/blob/main/CONTRIBUTING.md).
|
|
304
106
|
|
|
305
107
|
## License
|
|
306
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,MAA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