mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
refactor(spec): drop the legacy goja bridge fields from action factories
This commit is contained in:
1 parent
76c68b84ac
commit
1a9d82711f
1 file changed
+3
-34
+3
-34
@@ -24,37 +24,12 @@ import type {
|
|||||||
} from "./types.ts";
|
} from "./types.ts";
|
||||||
import type { ActionDescriptor, BuiltinVerb, GeneratorNode } from "./action-tree.ts";
|
import type { ActionDescriptor, BuiltinVerb, GeneratorNode } from "./action-tree.ts";
|
||||||
|
|
||||||
// LEGACY GOJA BRIDGE. The new data-tree nodes carry the old goja picker's tags
|
|
||||||
// (__sanderlingKind / entries / per-verb kind) so worker.go keeps walking them
|
|
||||||
// unchanged until Phase 2 rewires goja onto pick.ts. pick.ts ignores these
|
|
||||||
// fields. Delete this bridge (and the goja picker) in Phase 2.
|
|
||||||
const VERB_LEGACY_KIND: Record<string, string> = {
|
|
||||||
taps: "taps",
|
|
||||||
doubleTaps: "doubleTaps",
|
|
||||||
longPresses: "longPresses",
|
|
||||||
scrolls: "scrolls",
|
|
||||||
typing: "typing",
|
|
||||||
swipes: "swipes",
|
|
||||||
waitOnce: "waitOnce",
|
|
||||||
pressKeys: "pressKey",
|
|
||||||
};
|
|
||||||
|
|
||||||
function builtinNode(verb: BuiltinVerb): GeneratorNode {
|
function builtinNode(verb: BuiltinVerb): GeneratorNode {
|
||||||
return {
|
return { kind: "builtin", verb };
|
||||||
kind: "builtin",
|
|
||||||
verb,
|
|
||||||
__sanderlingActionGenerator: true,
|
|
||||||
__sanderlingKind: VERB_LEGACY_KIND[verb],
|
|
||||||
} as GeneratorNode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function actions(generator: () => Action[]): GeneratorNode {
|
export function actions(generator: () => Action[]): GeneratorNode {
|
||||||
return {
|
return { kind: "actions", generate: generator as () => ActionDescriptor[] };
|
||||||
kind: "actions",
|
|
||||||
generate: generator as () => ActionDescriptor[],
|
|
||||||
__sanderlingActionGenerator: true,
|
|
||||||
__sanderlingKind: "actions",
|
|
||||||
} as GeneratorNode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function whenRoute(
|
export function whenRoute(
|
||||||
@@ -71,13 +46,7 @@ export function whenRoute(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function weighted(...entries: WeightedEntry[]): GeneratorNode {
|
export function weighted(...entries: WeightedEntry[]): GeneratorNode {
|
||||||
return {
|
return { kind: "weighted", branches: entries };
|
||||||
kind: "weighted",
|
|
||||||
branches: entries,
|
|
||||||
__sanderlingActionGenerator: true,
|
|
||||||
__sanderlingKind: "weighted",
|
|
||||||
entries,
|
|
||||||
} as GeneratorNode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// samplerRng is the picker's Pcg while it evaluates an `actions` node's
|
// samplerRng is the picker's Pcg while it evaluates an `actions` node's
|
||||||
|
|||||||
Reference in new issue
Block a user