tftsr-devops_investigation/node_modules/pac-resolver/dist/weekdayRange.js
Shaun Arman 8839075805 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-14 22:36:25 -05:00

91 lines
2.6 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("./util");
const weekdays = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];
/**
* Only the first parameter is mandatory. Either the second, the third, or both
* may be left out.
*
* If only one parameter is present, the function yeilds a true value on the
* weekday that the parameter represents. If the string "GMT" is specified as
* a second parameter, times are taken to be in GMT, otherwise in local timezone.
*
* If both wd1 and wd1 are defined, the condition is true if the current weekday
* is in between those two weekdays. Bounds are inclusive. If the "GMT" parameter
* is specified, times are taken to be in GMT, otherwise the local timezone is
* used.
*
* Valid "weekday strings" are:
*
* SUN MON TUE WED THU FRI SAT
*
* Examples:
*
* ``` js
* weekdayRange("MON", "FRI")
* true Monday trhough Friday (local timezone).
*
* weekdayRange("MON", "FRI", "GMT")
* same as above, but GMT timezone.
*
* weekdayRange("SAT")
* true on Saturdays local time.
*
* weekdayRange("SAT", "GMT")
* true on Saturdays GMT time.
*
* weekdayRange("FRI", "MON")
* true Friday through Monday (note, order does matter!).
* ```
*
*
* @param {String} wd1 one of the weekday strings.
* @param {String} wd2 one of the weekday strings.
* @param {String} gmt is either the string: GMT or is left out.
* @return {Boolean}
*/
function weekdayRange(wd1, wd2, gmt) {
let useGMTzone = false;
let wd1Index = -1;
let wd2Index = -1;
let wd2IsGmt = false;
if ((0, util_1.isGMT)(gmt)) {
useGMTzone = true;
}
else if ((0, util_1.isGMT)(wd2)) {
useGMTzone = true;
wd2IsGmt = true;
}
wd1Index = weekdays.indexOf(wd1);
if (!wd2IsGmt && isWeekday(wd2)) {
wd2Index = weekdays.indexOf(wd2);
}
const todaysDay = getTodaysDay(useGMTzone);
let result;
if (wd2Index < 0) {
result = todaysDay === wd1Index;
}
else if (wd1Index <= wd2Index) {
result = valueInRange(wd1Index, todaysDay, wd2Index);
}
else {
result =
valueInRange(wd1Index, todaysDay, 6) ||
valueInRange(0, todaysDay, wd2Index);
}
return result;
}
exports.default = weekdayRange;
function getTodaysDay(gmt) {
return gmt ? new Date().getUTCDay() : new Date().getDay();
}
// start <= value <= finish
function valueInRange(start, value, finish) {
return start <= value && value <= finish;
}
function isWeekday(v) {
if (!v)
return false;
return weekdays.includes(v);
}
//# sourceMappingURL=weekdayRange.js.map