feat(spec): export typing builtin generator

This commit is contained in:
pj committed 2026-05-25 18:13:13 +05:30
1 parent 923d06813e
commit 9ca16e7627
5 files changed
+8 -1

No files matched your search

+4 -1
View File
@@ -65,7 +65,9 @@ export function Wait(parameters: { durationMillis: number }): WaitAction {
return globalThis.__sanderling__.wait(parameters); return globalThis.__sanderling__.wait(parameters);
} }
function builtinGenerator(name: "taps" | "swipes" | "waitOnce" | "pressKeys"): ActionGenerator { function builtinGenerator(
name: "taps" | "typing" | "swipes" | "waitOnce" | "pressKeys",
): ActionGenerator {
return new Proxy({} as ActionGenerator, { return new Proxy({} as ActionGenerator, {
get(_target, property) { get(_target, property) {
const runtime = globalThis.__sanderling__[name] as unknown as Record< const runtime = globalThis.__sanderling__[name] as unknown as Record<
@@ -78,6 +80,7 @@ function builtinGenerator(name: "taps" | "swipes" | "waitOnce" | "pressKeys"): A
} }
export const taps: ActionGenerator = builtinGenerator("taps"); export const taps: ActionGenerator = builtinGenerator("taps");
export const typing: ActionGenerator = builtinGenerator("typing");
export const swipes: ActionGenerator = builtinGenerator("swipes"); export const swipes: ActionGenerator = builtinGenerator("swipes");
export const waitOnce: ActionGenerator = builtinGenerator("waitOnce"); export const waitOnce: ActionGenerator = builtinGenerator("waitOnce");
export const pressKey: ActionGenerator = builtinGenerator("pressKeys"); export const pressKey: ActionGenerator = builtinGenerator("pressKeys");
+1
View File
@@ -40,6 +40,7 @@ export {
pressKey, pressKey,
swipes, swipes,
taps, taps,
typing,
waitOnce, waitOnce,
weighted, weighted,
whenRoute, whenRoute,
+1
View File
@@ -206,6 +206,7 @@ export interface SanderlingRuntime {
pressKey: (parameters: { key: Key }) => PressKeyAction; pressKey: (parameters: { key: Key }) => PressKeyAction;
wait: (parameters: { durationMillis: number }) => WaitAction; wait: (parameters: { durationMillis: number }) => WaitAction;
taps: ActionGenerator; taps: ActionGenerator;
typing: ActionGenerator;
swipes: ActionGenerator; swipes: ActionGenerator;
waitOnce: ActionGenerator; waitOnce: ActionGenerator;
pressKeys: ActionGenerator; pressKeys: ActionGenerator;
+1
View File
@@ -148,6 +148,7 @@ function installFakeRuntime(): RecordedRuntime {
pressKey: ({ key }) => ({ kind: "PressKey", key }), pressKey: ({ key }) => ({ kind: "PressKey", key }),
wait: ({ durationMillis }) => ({ kind: "Wait", durationMillis }), wait: ({ durationMillis }) => ({ kind: "Wait", durationMillis }),
taps: { __sanderlingActionGenerator: true, generate: () => [] }, taps: { __sanderlingActionGenerator: true, generate: () => [] },
typing: { __sanderlingActionGenerator: true, generate: () => [] },
swipes: { __sanderlingActionGenerator: true, generate: () => [] }, swipes: { __sanderlingActionGenerator: true, generate: () => [] },
waitOnce: { __sanderlingActionGenerator: true, generate: () => [] }, waitOnce: { __sanderlingActionGenerator: true, generate: () => [] },
pressKeys: { __sanderlingActionGenerator: true, generate: () => [] }, pressKeys: { __sanderlingActionGenerator: true, generate: () => [] },
+1
View File
@@ -63,6 +63,7 @@ function installRuntime(initialState: State): RecordedRuntime {
pressKey: ({ key }) => ({ kind: "PressKey", key }), pressKey: ({ key }) => ({ kind: "PressKey", key }),
wait: ({ durationMillis }) => ({ kind: "Wait", durationMillis }), wait: ({ durationMillis }) => ({ kind: "Wait", durationMillis }),
taps: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator, taps: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
typing: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
swipes: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator, swipes: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
waitOnce: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator, waitOnce: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,
pressKeys: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator, pressKeys: { __sanderlingActionGenerator: true, generate: () => [] } as ActionGenerator,