Implementation:A9T9 RPA Command Validation
| Knowledge Sources | |
|---|---|
| Domains | Browser_Automation, Command_Parsing |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Concrete tool for validating, normalizing, and parsing RPA command entries into the command table, provided by the Ui.Vision command module.
Description
The command module (`src/common/command.ts`) defines the scope, validation, and parsing logic for classic RPA commands. The `commandScopes` map declares whether each command (click, type, open, store, XClick, etc.) applies to web only, desktop only, or all scopes. `normalizeCommandName` canonicalizes command name strings, `isValidCmd` checks whether a command name is recognized, and `parseImageTarget` parses image-target strings (used by visual commands like XClick) into structured `ImageTarget` objects.
During recording, these functions turn raw locator + command + value tuples from the inspector into validated command table entries stored in Redux state.
Usage
Import these utilities when you need to validate command names, determine command scope (web vs desktop), or parse image target strings for visual commands.
Code Reference
Source Location
- Repository: A9T9/RPA
- File: src/common/command.ts
- Lines: L9-L150 (commandScopes), L227-L258 (normalizeCommandName, isValidCmd), L520-L563 (parseImageTarget)
Signature
export enum CommandScope {
All = 1,
WebOnly,
DesktopOnly
}
export const commandScopes: Record<string, CommandScope>
export function normalizeCommandName(str: string): string
export function isValidCmd(str: string): boolean
export function parseImageTarget(target: string): ImageTarget | null
Import
import {
commandScopes,
CommandScope,
normalizeCommandName,
isValidCmd,
parseImageTarget
} from '@/common/command'
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| str | string | Yes | Command name to normalize or validate |
| target | string | Yes (parseImageTarget) | Image target string to parse into structured form |
Outputs
| Name | Type | Description |
|---|---|---|
| normalized | string | Canonical command name |
| valid | boolean | Whether the command name is recognized |
| imageTarget | null | Parsed image target with filename and options, or null |
Usage Examples
Validate and Normalize a Command
import { normalizeCommandName, isValidCmd, commandScopes, CommandScope } from '@/common/command'
const cmd = 'CLICK'
if (isValidCmd(cmd)) {
const name = normalizeCommandName(cmd) // "click"
const scope = commandScopes[name] // CommandScope.WebOnly
}
Parse an Image Target
import { parseImageTarget } from '@/common/command'
const target = parseImageTarget('login_button_dpi_96.png')
// { fileName: 'login_button_dpi_96.png', ... }