tftsr-devops_investigation/node_modules/@testing-library/user-event/dist/cjs/pointer/index.js

75 lines
3.9 KiB
JavaScript
Raw Normal View History

feat: initial implementation of TFTSR IT Triage & RCA application Implements Phases 1-8 of the TFTSR implementation plan. Rust backend (Tauri 2.x, src-tauri/): - Multi-provider AI: OpenAI-compatible, Anthropic, Gemini, Mistral, Ollama - PII detection engine: 11 regex patterns with overlap resolution - SQLCipher AES-256 encrypted database with 10 versioned migrations - 28 Tauri IPC commands for triage, analysis, document, and system ops - Ollama: hardware probe, model recommendations, pull/delete with events - RCA and blameless post-mortem Markdown document generators - PDF export via printpdf - Audit log: SHA-256 hash of every external data send - Integration stubs for Confluence, ServiceNow, Azure DevOps (v0.2) Frontend (React 18 + TypeScript + Vite, src/): - 9 pages: full triage workflow NewIssue→LogUpload→Triage→Resolution→RCA→Postmortem→History+Settings - 7 components: ChatWindow, TriageProgress, PiiDiffViewer, DocEditor, HardwareReport, ModelSelector, UI primitives - 3 Zustand stores: session, settings (persisted), history - Type-safe tauriCommands.ts matching Rust backend types exactly - 8 IT domain system prompts (Linux, Windows, Network, K8s, DB, Virt, HW, Obs) DevOps: - .woodpecker/test.yml: rustfmt, clippy, cargo test, tsc, vitest on every push - .woodpecker/release.yml: linux/amd64 + linux/arm64 builds, Gogs release upload Verified: - cargo check: zero errors - tsc --noEmit: zero errors - vitest run: 13/13 unit tests passing Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 03:36:25 +00:00
'use strict';
require('../utils/dataTransfer/Clipboard.js');
var level = require('../utils/misc/level.js');
var wait = require('../utils/misc/wait.js');
var parseKeyDef = require('./parseKeyDef.js');
async function pointer(input) {
const { pointerMap } = this.config;
const actions = [];
(Array.isArray(input) ? input : [
input
]).forEach((actionInput)=>{
if (typeof actionInput === 'string') {
actions.push(...parseKeyDef.parseKeyDef(pointerMap, actionInput));
} else if ('keys' in actionInput) {
actions.push(...parseKeyDef.parseKeyDef(pointerMap, actionInput.keys).map((i)=>({
...actionInput,
...i
})));
} else {
actions.push(actionInput);
}
});
for(let i = 0; i < actions.length; i++){
await wait.wait(this.config);
await pointerAction(this, actions[i]);
}
this.system.pointer.resetClickCount();
}
async function pointerAction(instance, action) {
var _previousPosition_caret, _previousPosition_caret1;
const pointerName = 'pointerName' in action && action.pointerName ? action.pointerName : 'keyDef' in action ? instance.system.pointer.getPointerName(action.keyDef) : 'mouse';
const previousPosition = instance.system.pointer.getPreviousPosition(pointerName);
var _action_target, _action_coords, _action_node, _action_offset;
const position = {
target: (_action_target = action.target) !== null && _action_target !== undefined ? _action_target : getPrevTarget(instance, previousPosition),
coords: (_action_coords = action.coords) !== null && _action_coords !== undefined ? _action_coords : previousPosition === null || previousPosition === undefined ? undefined : previousPosition.coords,
caret: {
node: (_action_node = action.node) !== null && _action_node !== undefined ? _action_node : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === undefined ? undefined : (_previousPosition_caret = previousPosition.caret) === null || _previousPosition_caret === undefined ? undefined : _previousPosition_caret.node,
offset: (_action_offset = action.offset) !== null && _action_offset !== undefined ? _action_offset : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === undefined ? undefined : (_previousPosition_caret1 = previousPosition.caret) === null || _previousPosition_caret1 === undefined ? undefined : _previousPosition_caret1.offset
}
};
if ('keyDef' in action) {
if (instance.system.pointer.isKeyPressed(action.keyDef)) {
level.setLevelRef(instance, level.ApiLevel.Trigger);
await instance.system.pointer.release(instance, action.keyDef, position);
}
if (!action.releasePrevious) {
level.setLevelRef(instance, level.ApiLevel.Trigger);
await instance.system.pointer.press(instance, action.keyDef, position);
if (action.releaseSelf) {
level.setLevelRef(instance, level.ApiLevel.Trigger);
await instance.system.pointer.release(instance, action.keyDef, position);
}
}
} else {
level.setLevelRef(instance, level.ApiLevel.Trigger);
await instance.system.pointer.move(instance, pointerName, position);
}
}
function hasCaretPosition(action) {
var _action_target, _ref;
return !!((_ref = (_action_target = action.target) !== null && _action_target !== undefined ? _action_target : action.node) !== null && _ref !== undefined ? _ref : action.offset !== undefined);
}
function getPrevTarget(instance, position) {
if (!position) {
throw new Error('This pointer has no previous position. Provide a target property!');
}
var _position_target;
return (_position_target = position.target) !== null && _position_target !== undefined ? _position_target : instance.config.document.body;
}
exports.pointer = pointer;