Skip to content

Commit 5b596d6

Browse files
authored
Merge pull request #530 from chelslava/feature/516-domain-extraction-phase2
[#516] Domain extraction phase 2: @rpaforge/activities, @rpaforge/diagram-core, @rpaforge/validation
2 parents 73be993 + 3e24fa1 commit 5b596d6

49 files changed

Lines changed: 1010 additions & 662 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11-
- Comprehensive Vitest tests for packages/codegen/src/graph.ts (26 tests covering graph building, BFS traversal, and common merge node finding)
11+
- **@rpaforge/activities** — new workspace package (Activity types, registry, builtin activities)
12+
- **@rpaforge/diagram-core** — new workspace package (graph operations, circular dependency detection, 13 tests)
13+
- **@rpaforge/validation** — new workspace package (sub-diagram validation, 10 tests)
14+
15+
### Changed
16+
- Studio imports: Activity types and registry functions now via `domain/activity` shim → `@rpaforge/activities`
17+
- Studio imports: diagram operations and circular dep functions now via `domain/diagram` shim → `@rpaforge/diagram-core`
18+
- Studio imports: validation functions now via `utils/diagramValidation` shim → `@rpaforge/validation`
19+
- `src/types/engine.ts`: Activity types and runtime functions removed (only Bridge/IPC types remain)
20+
- 16 import sites updated from `types/engine` to `domain/activity` for Activity-related imports
1221

1322
## [0.3.8] - 2026-06-04
1423

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"workspaces": [
88
"packages/domain-model",
99
"packages/codegen",
10+
"packages/activities",
11+
"packages/diagram-core",
12+
"packages/validation",
1013
"packages/studio"
1114
],
1215
"scripts": {

packages/activities/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "@rpaforge/activities",
3+
"version": "0.1.0",
4+
"description": "RPA activity registry, builtin activities, and type definitions",
5+
"type": "module",
6+
"main": "dist/index.js",
7+
"types": "dist/index.d.ts",
8+
"scripts": {
9+
"prepare": "tsc",
10+
"build": "tsc",
11+
"type-check": "tsc --noEmit"
12+
},
13+
"keywords": ["rpa", "activities", "registry"],
14+
"author": "RPAForge Contributors",
15+
"license": "Apache-2.0",
16+
"devDependencies": {
17+
"typescript": "^6.0.3"
18+
}
19+
}

packages/studio/src/domain/activity/builtin.ts renamed to packages/activities/src/builtin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Activity } from '../../types/engine';
1+
import type { Activity } from './types.js';
22

33
export const BUILTIN_ACTIVITIES: Activity[] = [
44
{

packages/activities/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from './types.js';
2+
export * from './registry.js';
3+
export * from './builtin.js';

packages/studio/src/domain/activity/registry.ts renamed to packages/activities/src/registry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Activity, ActivityBridgePayload } from '../../types/engine';
2-
import { normalizeActivity } from '../../types/engine';
1+
import type { Activity, ActivityBridgePayload } from './types.js';
2+
import { normalizeActivity } from './types.js';
33

44
export interface ActivityRegistry {
55
activities: Map<string, Activity>;

packages/activities/src/types.ts

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/**
2+
* RPA Activity Types
3+
*
4+
* Type definitions and runtime functions for RPA activities.
5+
*/
6+
7+
export type ActivityType =
8+
| 'sync'
9+
| 'condition'
10+
| 'loop'
11+
| 'container'
12+
| 'async'
13+
| 'error_handler'
14+
| 'code'
15+
| 'sub_diagram';
16+
17+
export type ActivityParamType =
18+
| 'string'
19+
| 'integer'
20+
| 'float'
21+
| 'boolean'
22+
| 'variable'
23+
| 'expression'
24+
| 'secret'
25+
| 'code'
26+
| 'list'
27+
| 'dict'
28+
| 'dataframe';
29+
30+
export interface ActivityParam {
31+
name: string;
32+
type: ActivityParamType;
33+
label: string;
34+
description: string;
35+
required: boolean;
36+
default?: unknown;
37+
options: string[];
38+
variadic?: boolean;
39+
}
40+
41+
export interface ActivityBuiltinSettings {
42+
timeout_ms: number;
43+
has_retry: boolean;
44+
has_continue_on_error: boolean;
45+
}
46+
47+
export interface ActivityBridgePayload {
48+
id?: string;
49+
name: string;
50+
library: string;
51+
type?: string;
52+
category: string;
53+
description: string;
54+
tags?: string[];
55+
timeout_ms?: number;
56+
has_retry?: boolean;
57+
has_continue_on_error?: boolean;
58+
params?: ActivityParam[];
59+
}
60+
61+
export interface Activity {
62+
id: string;
63+
name: string;
64+
library: string;
65+
type: ActivityType;
66+
category: string;
67+
description: string;
68+
tags: string[];
69+
timeout_ms: number;
70+
has_retry: boolean;
71+
has_continue_on_error: boolean;
72+
params: ActivityParam[];
73+
has_output: boolean;
74+
output_description: string;
75+
}
76+
77+
export const DEFAULT_BUILTIN_SETTINGS: ActivityBuiltinSettings = {
78+
timeout_ms: 30000,
79+
has_retry: false,
80+
has_continue_on_error: false,
81+
};
82+
83+
function normalizeActivityParam(param: Partial<ActivityParam>): ActivityParam {
84+
return {
85+
name: param.name || '',
86+
type: (param.type || 'string') as ActivityParamType,
87+
label: param.label || param.name || '',
88+
description: param.description || '',
89+
required: param.required ?? true,
90+
default: param.default,
91+
options: param.options || [],
92+
variadic: param.variadic ?? false,
93+
};
94+
}
95+
96+
export function normalizeLibraryName(rawLibrary: string): string {
97+
if (!rawLibrary) return 'BuiltIn';
98+
return rawLibrary.replace(/^RPAForge\./, '').replace(/^rpaforge_libraries\./, '');
99+
}
100+
101+
export function normalizeActivity(payload: ActivityBridgePayload): Activity {
102+
return {
103+
id: payload.id || `${payload.library}.${payload.name}`.replace(/\s+/g, '_').toLowerCase(),
104+
name: payload.name,
105+
library: normalizeLibraryName(payload.library),
106+
type: (payload.type as ActivityType) || 'sync',
107+
category: payload.category || 'Other',
108+
description: payload.description || '',
109+
tags: payload.tags || [],
110+
timeout_ms: payload.timeout_ms ?? DEFAULT_BUILTIN_SETTINGS.timeout_ms,
111+
has_retry: payload.has_retry ?? DEFAULT_BUILTIN_SETTINGS.has_retry,
112+
has_continue_on_error: payload.has_continue_on_error ?? DEFAULT_BUILTIN_SETTINGS.has_continue_on_error,
113+
params: (payload.params || []).map(normalizeActivityParam),
114+
has_output: (payload as { has_output?: boolean }).has_output ?? false,
115+
output_description: (payload as { output_description?: string }).output_description ?? '',
116+
};
117+
}

packages/activities/tsconfig.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2022",
4+
"useDefineForClassFields": true,
5+
"lib": ["ES2022"],
6+
"module": "ESNext",
7+
"skipLibCheck": true,
8+
"moduleResolution": "bundler",
9+
"outDir": "dist",
10+
"rootDir": "src",
11+
"composite": true,
12+
"declaration": true,
13+
"noEmit": false,
14+
"resolveJsonModule": true,
15+
"isolatedModules": true,
16+
"strict": true,
17+
"noUnusedLocals": true,
18+
"noUnusedParameters": true,
19+
"noFallthroughCasesInSwitch": true
20+
},
21+
"include": ["src/**/*.ts"],
22+
"exclude": ["node_modules", "dist", "**/*.test.ts"]
23+
}

packages/diagram-core/package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "@rpaforge/diagram-core",
3+
"version": "0.1.0",
4+
"description": "Diagram graph operations and circular dependency detection - framework agnostic",
5+
"type": "module",
6+
"main": "dist/index.js",
7+
"types": "dist/index.d.ts",
8+
"scripts": {
9+
"prepare": "tsc",
10+
"build": "tsc",
11+
"type-check": "tsc --noEmit",
12+
"test": "vitest run"
13+
},
14+
"keywords": ["rpa", "diagram", "graph", "circular-dependency"],
15+
"author": "RPAForge Contributors",
16+
"license": "Apache-2.0",
17+
"dependencies": {
18+
"@rpaforge/domain-model": "workspace:^"
19+
},
20+
"devDependencies": {
21+
"typescript": "^6.0.3",
22+
"vitest": "^4.1.8"
23+
}
24+
}

packages/studio/src/domain/diagram/circular-dependency.test.ts renamed to packages/diagram-core/src/circular-dependency.test.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,16 @@ import {
66
getNestingDepth,
77
MAX_NESTING_DEPTH,
88
} from './circular-dependency';
9-
import type { DiagramMetadata } from '../../stores/diagramStore';
9+
import type { DiagramRef } from './types';
1010

1111
const createMockDiagram = (
1212
id: string,
1313
name: string,
14-
type: 'main' | 'sub-diagram' = 'sub-diagram'
15-
): DiagramMetadata => ({
14+
type: 'main' | 'sub-diagram' | 'library' = 'sub-diagram'
15+
): DiagramRef => ({
1616
id,
1717
name,
1818
type,
19-
path: `${name}.process`,
20-
createdAt: new Date().toISOString(),
21-
updatedAt: new Date().toISOString(),
2219
});
2320

2421
describe('findCircularDependencies', () => {

0 commit comments

Comments
 (0)