@healflow/shared 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/circuit-breaker.d.ts +23 -0
- package/dist/circuit-breaker.d.ts.map +1 -0
- package/dist/circuit-breaker.js +75 -0
- package/dist/circuit-breaker.js.map +1 -0
- package/dist/config-index.d.ts +3 -0
- package/dist/config-index.d.ts.map +1 -0
- package/dist/config-index.js +19 -0
- package/dist/config-index.js.map +1 -0
- package/dist/config-loader.d.ts +5 -0
- package/dist/config-loader.d.ts.map +1 -0
- package/dist/config-loader.js +140 -0
- package/dist/config-loader.js.map +1 -0
- package/dist/config.d.ts +74 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +74 -0
- package/dist/config.js.map +1 -0
- package/dist/contracts/index.d.ts +204 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +3 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/domain.d.ts +319 -0
- package/dist/domain.d.ts.map +1 -0
- package/dist/domain.js +3 -0
- package/dist/domain.js.map +1 -0
- package/dist/enums.d.ts +122 -0
- package/dist/enums.d.ts.map +1 -0
- package/dist/enums.js +147 -0
- package/dist/enums.js.map +1 -0
- package/dist/events/index.d.ts +113 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +28 -0
- package/dist/events/index.js.map +1 -0
- package/dist/healing-rules.d.ts +18 -0
- package/dist/healing-rules.d.ts.map +1 -0
- package/dist/healing-rules.js +118 -0
- package/dist/healing-rules.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/organization-settings.d.ts +4 -0
- package/dist/organization-settings.d.ts.map +1 -0
- package/dist/organization-settings.js +28 -0
- package/dist/organization-settings.js.map +1 -0
- package/dist/policy.d.ts +14 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +68 -0
- package/dist/policy.js.map +1 -0
- package/dist/policy.test.d.ts +2 -0
- package/dist/policy.test.d.ts.map +1 -0
- package/dist/policy.test.js +43 -0
- package/dist/policy.test.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare class CircuitBreakerOpenError extends Error {
|
|
2
|
+
readonly service: string;
|
|
3
|
+
constructor(service: string);
|
|
4
|
+
}
|
|
5
|
+
interface CircuitBreakerConfig {
|
|
6
|
+
threshold: number;
|
|
7
|
+
resetMs: number;
|
|
8
|
+
service: string;
|
|
9
|
+
}
|
|
10
|
+
declare class CircuitBreaker {
|
|
11
|
+
private readonly config;
|
|
12
|
+
private state;
|
|
13
|
+
private failures;
|
|
14
|
+
private openedAt;
|
|
15
|
+
constructor(config: CircuitBreakerConfig);
|
|
16
|
+
execute<T>(fn: () => Promise<T>): Promise<T>;
|
|
17
|
+
private onSuccess;
|
|
18
|
+
private onFailure;
|
|
19
|
+
}
|
|
20
|
+
export declare function getCircuitBreaker(service: string): CircuitBreaker;
|
|
21
|
+
export declare function withCircuitBreaker<T>(service: string, fn: () => Promise<T>): Promise<T>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=circuit-breaker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circuit-breaker.d.ts","sourceRoot":"","sources":["../src/circuit-breaker.ts"],"names":[],"mappings":"AAAA,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM;CAK5B;AAID,UAAU,oBAAoB;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,cAAM,cAAc;IAKN,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJnC,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,QAAQ,CAAK;gBAEQ,MAAM,EAAE,oBAAoB;IAEnD,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAmBlD,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,SAAS;CAOlB;AAaD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAQjE;AAED,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE7F"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CircuitBreakerOpenError = void 0;
|
|
4
|
+
exports.getCircuitBreaker = getCircuitBreaker;
|
|
5
|
+
exports.withCircuitBreaker = withCircuitBreaker;
|
|
6
|
+
class CircuitBreakerOpenError extends Error {
|
|
7
|
+
service;
|
|
8
|
+
constructor(service) {
|
|
9
|
+
super(`Circuit breaker open for ${service}`);
|
|
10
|
+
this.name = 'CircuitBreakerOpenError';
|
|
11
|
+
this.service = service;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.CircuitBreakerOpenError = CircuitBreakerOpenError;
|
|
15
|
+
class CircuitBreaker {
|
|
16
|
+
config;
|
|
17
|
+
state = 'closed';
|
|
18
|
+
failures = 0;
|
|
19
|
+
openedAt = 0;
|
|
20
|
+
constructor(config) {
|
|
21
|
+
this.config = config;
|
|
22
|
+
}
|
|
23
|
+
async execute(fn) {
|
|
24
|
+
if (this.state === 'open') {
|
|
25
|
+
if (Date.now() - this.openedAt >= this.config.resetMs) {
|
|
26
|
+
this.state = 'half-open';
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
throw new CircuitBreakerOpenError(this.config.service);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const result = await fn();
|
|
34
|
+
this.onSuccess();
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
this.onFailure();
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
onSuccess() {
|
|
43
|
+
this.failures = 0;
|
|
44
|
+
this.state = 'closed';
|
|
45
|
+
}
|
|
46
|
+
onFailure() {
|
|
47
|
+
this.failures += 1;
|
|
48
|
+
if (this.failures >= this.config.threshold) {
|
|
49
|
+
this.state = 'open';
|
|
50
|
+
this.openedAt = Date.now();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const registry = new Map();
|
|
55
|
+
function readCircuitBreakerConfig() {
|
|
56
|
+
const threshold = Number.parseInt(process.env.CIRCUIT_BREAKER_THRESHOLD ?? '5', 10);
|
|
57
|
+
const resetMs = Number.parseInt(process.env.CIRCUIT_BREAKER_RESET_MS ?? '30000', 10);
|
|
58
|
+
return {
|
|
59
|
+
threshold: Number.isFinite(threshold) && threshold > 0 ? threshold : 5,
|
|
60
|
+
resetMs: Number.isFinite(resetMs) && resetMs > 0 ? resetMs : 30_000,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function getCircuitBreaker(service) {
|
|
64
|
+
const existing = registry.get(service);
|
|
65
|
+
if (existing)
|
|
66
|
+
return existing;
|
|
67
|
+
const { threshold, resetMs } = readCircuitBreakerConfig();
|
|
68
|
+
const breaker = new CircuitBreaker({ threshold, resetMs, service });
|
|
69
|
+
registry.set(service, breaker);
|
|
70
|
+
return breaker;
|
|
71
|
+
}
|
|
72
|
+
async function withCircuitBreaker(service, fn) {
|
|
73
|
+
return getCircuitBreaker(service).execute(fn);
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=circuit-breaker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circuit-breaker.js","sourceRo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AC/B,OAAO,OAAO,CAAC;AACjB,CAAC;AAEM,KAAK,UAAU,kBAAkB,CAAI,OAAe,EAAE,EAAoB;IAC/E,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-index.d.ts","sourceRoot":"","sources":["../src/config-index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./config.js"), exports);
|
|
18
|
+
__exportStar(require("./config-loader.js"), exports);
|
|
19
|
+
//# sourceMappingURL=config-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-index.js","sourceRoot":"","sources":["../src/config-index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,qDAAmC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type HealFlowConfig } from './config.js';
|
|
2
|
+
export declare function findHealFlowConfigPath(startDir?: string): string | null;
|
|
3
|
+
export declare function loadHealFlowConfig(startDir?: string): HealFlowConfig;
|
|
4
|
+
export declare function isHealingCategoryEnabled(config: HealFlowConfig, category: 'selector' | 'timing' | 'overlay' | 'iframe' | 'shadowDom' | 'auth' | 'network'): boolean;
|
|
5
|
+
//# sourceMappingURL=config-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AA2FrB,wBAAgB,sBAAsB,CAAC,QAAQ,SAAgB,GAAG,MAAM,GAAG,IAAI,CAM9E;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,SAAgB,GAAG,cAAc,CAiB3E;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,GACxF,OAAO,CAsBT"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findHealFlowConfigPath = findHealFlowConfigPath;
|
|
4
|
+
exports.loadHealFlowConfig = loadHealFlowConfig;
|
|
5
|
+
exports.isHealingCategoryEnabled = isHealingCategoryEnabled;
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const config_js_1 = require("./config.js");
|
|
9
|
+
function parseSimpleYaml(content) {
|
|
10
|
+
const result = {};
|
|
11
|
+
let currentSection = null;
|
|
12
|
+
let currentKey = '';
|
|
13
|
+
for (const rawLine of content.split('\n')) {
|
|
14
|
+
const line = rawLine.trim();
|
|
15
|
+
if (!line || line.startsWith('#'))
|
|
16
|
+
continue;
|
|
17
|
+
if (!rawLine.startsWith(' ') && !rawLine.startsWith('\t') && line.endsWith(':')) {
|
|
18
|
+
currentKey = line.slice(0, -1);
|
|
19
|
+
const section = {};
|
|
20
|
+
result[currentKey] = section;
|
|
21
|
+
currentSection = section;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const match = line.match(/^([^:]+):\s*(.*)$/);
|
|
25
|
+
if (!match)
|
|
26
|
+
continue;
|
|
27
|
+
const [, key, rawValue = ''] = match;
|
|
28
|
+
if (!key)
|
|
29
|
+
continue;
|
|
30
|
+
let value = rawValue.trim();
|
|
31
|
+
if (value === 'true')
|
|
32
|
+
value = true;
|
|
33
|
+
else if (value === 'false')
|
|
34
|
+
value = false;
|
|
35
|
+
else if (/^\d+$/.test(String(value)))
|
|
36
|
+
value = Number(value);
|
|
37
|
+
else if (typeof value === 'string' &&
|
|
38
|
+
((value.startsWith('"') && value.endsWith('"')) ||
|
|
39
|
+
(value.startsWith("'") && value.endsWith("'")))) {
|
|
40
|
+
value = value.slice(1, -1);
|
|
41
|
+
}
|
|
42
|
+
if (currentSection && rawLine.startsWith(' ')) {
|
|
43
|
+
currentSection[key] = value;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
result[key] = value;
|
|
47
|
+
currentSection = null;
|
|
48
|
+
currentKey = key;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
function toHealFlowConfig(raw) {
|
|
54
|
+
const healing = raw.healing;
|
|
55
|
+
const validation = raw.validation;
|
|
56
|
+
const backend = raw.backend;
|
|
57
|
+
const auth = raw.auth;
|
|
58
|
+
return (0, config_js_1.mergeHealFlowConfig)({
|
|
59
|
+
mode: raw.mode,
|
|
60
|
+
output: raw.output,
|
|
61
|
+
healing: healing
|
|
62
|
+
? {
|
|
63
|
+
selector: healing.selector,
|
|
64
|
+
timing: healing.timing,
|
|
65
|
+
overlay: healing.overlay,
|
|
66
|
+
iframe: healing.iframe,
|
|
67
|
+
shadowDom: healing.shadowDom,
|
|
68
|
+
auth: healing.auth,
|
|
69
|
+
network: healing.network,
|
|
70
|
+
}
|
|
71
|
+
: undefined,
|
|
72
|
+
validation: validation
|
|
73
|
+
? {
|
|
74
|
+
requiredRuns: validation.requiredRuns,
|
|
75
|
+
}
|
|
76
|
+
: undefined,
|
|
77
|
+
backend: backend
|
|
78
|
+
? {
|
|
79
|
+
url: backend.url,
|
|
80
|
+
organizationId: backend.organizationId,
|
|
81
|
+
repositoryId: backend.repositoryId,
|
|
82
|
+
token: backend.token,
|
|
83
|
+
}
|
|
84
|
+
: undefined,
|
|
85
|
+
auth: auth
|
|
86
|
+
? {
|
|
87
|
+
loginUrl: auth.loginUrl,
|
|
88
|
+
storageStatePath: auth.storageStatePath,
|
|
89
|
+
}
|
|
90
|
+
: undefined,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function findHealFlowConfigPath(startDir = process.cwd()) {
|
|
94
|
+
for (const filename of config_js_1.HEALFLOW_CONFIG_FILENAMES) {
|
|
95
|
+
const candidate = (0, node_path_1.join)(startDir, filename);
|
|
96
|
+
if ((0, node_fs_1.existsSync)(candidate))
|
|
97
|
+
return candidate;
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
function loadHealFlowConfig(startDir = process.cwd()) {
|
|
102
|
+
const configPath = findHealFlowConfigPath(startDir);
|
|
103
|
+
if (!configPath) {
|
|
104
|
+
return (0, config_js_1.mergeHealFlowConfig)((0, config_js_1.healFlowConfigFromEnv)());
|
|
105
|
+
}
|
|
106
|
+
const raw = parseSimpleYaml((0, node_fs_1.readFileSync)(configPath, 'utf-8'));
|
|
107
|
+
const fileConfig = toHealFlowConfig(raw);
|
|
108
|
+
const envConfig = (0, config_js_1.healFlowConfigFromEnv)();
|
|
109
|
+
return (0, config_js_1.mergeHealFlowConfig)({
|
|
110
|
+
...fileConfig,
|
|
111
|
+
backend: {
|
|
112
|
+
...fileConfig.backend,
|
|
113
|
+
...envConfig.backend,
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function isHealingCategoryEnabled(config, category) {
|
|
118
|
+
const healing = config.healing ?? config_js_1.DEFAULT_HEALFLOW_CONFIG.healing;
|
|
119
|
+
switch (category) {
|
|
120
|
+
case 'selector':
|
|
121
|
+
return healing.selector !== false;
|
|
122
|
+
case 'timing':
|
|
123
|
+
return healing.timing !== false;
|
|
124
|
+
case 'overlay':
|
|
125
|
+
return healing.overlay !== false;
|
|
126
|
+
case 'iframe':
|
|
127
|
+
return healing.iframe !== false;
|
|
128
|
+
case 'shadowDom':
|
|
129
|
+
return healing.shadowDom !== false;
|
|
130
|
+
case 'auth':
|
|
131
|
+
return healing.auth !== false;
|
|
132
|
+
case 'network':
|
|
133
|
+
return healing.network !== false;
|
|
134
|
+
default: {
|
|
135
|
+
const _exhaustive = category;
|
|
136
|
+
return _exhaustive;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=config-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":";;AAmGA,wDAMC;AAED,gDAiBC;AAED,4DAyBC;AAvJD,qCAAmD;AACnD,yCAAiC;AACjC,2CAMqB;AAErB,SAAS,eAAe,CAAC,OAAe;IACtC,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,IAAI,cAAc,GAAmC,IAAI,CAAC;IAC1D,IAAI,UAAU,GAAG,EAAE,CAAC;IAEpB,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAA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AyF;IAEzF,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,mCAAuB,CAAC,OAAO,CAAC;IAClE,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,OAAO,CAAC,QAAQ,KAAK,KAAK,CAAC;QACpC,KAAK,QAAQ;YACX,OAAO,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC;QAClC,KAAK,SAAS;YACZ,OAAO,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC;QACnC,KAAK,QAAQ;YACX,OAAO,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC;QAClC,KAAK,WAAW;YACd,OAAO,OAAO,CAAC,SAAS,KAAK,KAAK,CAAC;QACrC,KAAK,MAAM;YACT,OAAO,OAAO,CAAC,IAAI,KAAK,KAAK,CAAC;QAChC,KAAK,SAAS;YACZ,OAAO,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC;QACnC,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,WAAW,GAAU,QAAQ,CAAC;YACpC,OAAO,WAAW,CAAC;QACrB,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export type HealFlowMode = 'draft-pr' | 'report-only' | 'local';
|
|
2
|
+
export type HealFlowOutput = 'verbose' | 'quiet';
|
|
3
|
+
export interface HealFlowHealingConfig {
|
|
4
|
+
selector?: boolean;
|
|
5
|
+
timing?: boolean;
|
|
6
|
+
overlay?: boolean;
|
|
7
|
+
iframe?: boolean;
|
|
8
|
+
shadowDom?: boolean;
|
|
9
|
+
auth?: boolean;
|
|
10
|
+
network?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface HealFlowAuthConfig {
|
|
13
|
+
loginUrl?: string;
|
|
14
|
+
storageStatePath?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface HealFlowValidationConfig {
|
|
17
|
+
requiredRuns?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface HealFlowBackendConfig {
|
|
20
|
+
url?: string;
|
|
21
|
+
organizationId?: string;
|
|
22
|
+
repositoryId?: string;
|
|
23
|
+
token?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface HealFlowConfig {
|
|
26
|
+
mode?: HealFlowMode;
|
|
27
|
+
output?: HealFlowOutput;
|
|
28
|
+
healing?: HealFlowHealingConfig;
|
|
29
|
+
validation?: HealFlowValidationConfig;
|
|
30
|
+
backend?: HealFlowBackendConfig;
|
|
31
|
+
auth?: HealFlowAuthConfig;
|
|
32
|
+
}
|
|
33
|
+
export interface RuntimeHealRecord {
|
|
34
|
+
id: string;
|
|
35
|
+
testFile?: string;
|
|
36
|
+
testTitle?: string;
|
|
37
|
+
rootCause: string;
|
|
38
|
+
category: string;
|
|
39
|
+
oldValue?: string;
|
|
40
|
+
newValue?: string;
|
|
41
|
+
confidence: number;
|
|
42
|
+
healedAt: string;
|
|
43
|
+
}
|
|
44
|
+
export interface FixProposalRecord {
|
|
45
|
+
id: string;
|
|
46
|
+
testFile: string;
|
|
47
|
+
testTitle: string;
|
|
48
|
+
rootCause: string;
|
|
49
|
+
category: string;
|
|
50
|
+
oldValue?: string;
|
|
51
|
+
newValue?: string;
|
|
52
|
+
confidence: number;
|
|
53
|
+
strategy: string;
|
|
54
|
+
dryRun: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface HealFlowRunArtifacts {
|
|
57
|
+
runId: string;
|
|
58
|
+
startedAt: string;
|
|
59
|
+
completedAt: string;
|
|
60
|
+
mode: HealFlowMode;
|
|
61
|
+
status: string;
|
|
62
|
+
failureCount: number;
|
|
63
|
+
healCount: number;
|
|
64
|
+
passedCount?: number;
|
|
65
|
+
durationMs?: number;
|
|
66
|
+
heals: RuntimeHealRecord[];
|
|
67
|
+
fixes: FixProposalRecord[];
|
|
68
|
+
}
|
|
69
|
+
export declare const HEALFLOW_CONFIG_FILENAMES: readonly ["healflow.yml", "healflow.yaml"];
|
|
70
|
+
export declare const DEFAULT_HEALFLOW_CONFIG: Required<Pick<HealFlowConfig, 'mode' | 'output' | 'healing' | 'validation'>>;
|
|
71
|
+
export declare function mergeHealFlowConfig(partial?: HealFlowConfig): HealFlowConfig;
|
|
72
|
+
export declare function healFlowConfigFromEnv(): HealFlowConfig;
|
|
73
|
+
export declare function serializeHealFlowConfig(config: HealFlowConfig): string;
|
|
74
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,aAAa,GAAG,OAAO,CAAC;AAEhE,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,OAAO,CAAC,EAAE,qBAAqB,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,CAAC;AAEpF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAC5C,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,CAAC,CAgBnE,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,cAAc,CAe5E;AAED,wBAAgB,qBAAqB,IAAI,cAAc,CAYtD;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CA+BtE"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_HEALFLOW_CONFIG = exports.HEALFLOW_CONFIG_FILENAMES = void 0;
|
|
4
|
+
exports.mergeHealFlowConfig = mergeHealFlowConfig;
|
|
5
|
+
exports.healFlowConfigFromEnv = healFlowConfigFromEnv;
|
|
6
|
+
exports.serializeHealFlowConfig = serializeHealFlowConfig;
|
|
7
|
+
exports.HEALFLOW_CONFIG_FILENAMES = ['healflow.yml', 'healflow.yaml'];
|
|
8
|
+
exports.DEFAULT_HEALFLOW_CONFIG = {
|
|
9
|
+
mode: 'local',
|
|
10
|
+
output: 'verbose',
|
|
11
|
+
healing: {
|
|
12
|
+
selector: true,
|
|
13
|
+
timing: true,
|
|
14
|
+
overlay: true,
|
|
15
|
+
iframe: true,
|
|
16
|
+
shadowDom: true,
|
|
17
|
+
auth: true,
|
|
18
|
+
network: true,
|
|
19
|
+
},
|
|
20
|
+
validation: {
|
|
21
|
+
requiredRuns: 3,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
function mergeHealFlowConfig(partial) {
|
|
25
|
+
return {
|
|
26
|
+
mode: partial?.mode ?? exports.DEFAULT_HEALFLOW_CONFIG.mode,
|
|
27
|
+
output: partial?.output ?? exports.DEFAULT_HEALFLOW_CONFIG.output,
|
|
28
|
+
healing: {
|
|
29
|
+
...exports.DEFAULT_HEALFLOW_CONFIG.healing,
|
|
30
|
+
...partial?.healing,
|
|
31
|
+
},
|
|
32
|
+
validation: {
|
|
33
|
+
...exports.DEFAULT_HEALFLOW_CONFIG.validation,
|
|
34
|
+
...partial?.validation,
|
|
35
|
+
},
|
|
36
|
+
backend: partial?.backend,
|
|
37
|
+
auth: partial?.auth,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function healFlowConfigFromEnv() {
|
|
41
|
+
const backend = process.env.HEALFLOW_API_URL || process.env.HEALFLOW_ORG_ID || process.env.HEALFLOW_REPO_ID
|
|
42
|
+
? {
|
|
43
|
+
url: process.env.HEALFLOW_API_URL,
|
|
44
|
+
organizationId: process.env.HEALFLOW_ORG_ID,
|
|
45
|
+
repositoryId: process.env.HEALFLOW_REPO_ID,
|
|
46
|
+
token: process.env.HEALFLOW_TOKEN,
|
|
47
|
+
}
|
|
48
|
+
: undefined;
|
|
49
|
+
return mergeHealFlowConfig({ backend });
|
|
50
|
+
}
|
|
51
|
+
function serializeHealFlowConfig(config) {
|
|
52
|
+
const lines = [
|
|
53
|
+
`# HealFlow configuration — https://healflow.dev/docs/config`,
|
|
54
|
+
`mode: ${config.mode ?? exports.DEFAULT_HEALFLOW_CONFIG.mode}`,
|
|
55
|
+
'',
|
|
56
|
+
'healing:',
|
|
57
|
+
` selector: ${config.healing?.selector ?? true}`,
|
|
58
|
+
` timing: ${config.healing?.timing ?? true}`,
|
|
59
|
+
` overlay: ${config.healing?.overlay ?? true}`,
|
|
60
|
+
'',
|
|
61
|
+
'validation:',
|
|
62
|
+
` requiredRuns: ${config.validation?.requiredRuns ?? 3}`,
|
|
63
|
+
];
|
|
64
|
+
if (config.output && config.output !== exports.DEFAULT_HEALFLOW_CONFIG.output) {
|
|
65
|
+
lines.splice(2, 0, `output: ${config.output}`, '');
|
|
66
|
+
}
|
|
67
|
+
if (config.backend?.url) {
|
|
68
|
+
lines.push('', 'backend:', ` url: ${config.backend.url}`, ...(config.backend.organizationId
|
|
69
|
+
? [` organizationId: ${config.backend.organizationId}`]
|
|
70
|
+
: []), ...(config.backend.repositoryId ? [` repositoryId: ${config.backend.repositoryId}`] : []));
|
|
71
|
+
}
|
|
72
|
+
return `${lines.join('\n')}\n`;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAmGA,kDAeC;AAED,sDAYC;AAED,0DA+BC;AAnFY,QAAA,yBAAyB,GAAG,CAAC,cAAc,EAAE,eAAe,CAAU,CAAC;AAEvE,QAAA,uBAAuB,GAEhC;IACF,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE;QACP,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,IAAI;QACZ,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI;KACd;IACD,UAAU,EAAE;QACV,YAAY,EAAE,CAAC;KAChB;CACF,CAAC;AAEF,SAAgB,mBAAmB,CAAC,OAAwB;IAC1D,OAAO;QACL,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,+BAAuB,CAAC,IAAI;QACnD,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,+BAAuB,CAAC,MAAM;QACzD,OAAO,EAAE;YACP,GAAG,+BAAuB,CAAC,OAAO;YAClC,GAAG,OAAO,EAAE,OAAO;SACpB;QACD,UAAU,EAAE;YACV,GAAG,+BAAuB,CAAC,UAAU;YACrC,GAAG,OAAO,EAAE,UAAU;SACvB;QACD,OAAO,EAAE,OAAO,EAAE,OAAO;QACzB,IAAI,EAAE,OAAO,EAAE,IAAI;KACpB,CAAC;AACJ,CAAC;AAED,SAAgB,qBAAqB;IACnC,MAAM,OAAO,GACX,OAAO,CAAC,GAAG,CAAC,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AC,OAAO,CAAC,cAAc;YAC/B,CAAC,CAAC,CAAC,qBAAqB,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;YACxD,CAAC,CAAC,EAAE,CAAC,EACP,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,mBAAmB,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAC3F,CAAC;IACJ,CAAC;IAED,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type { ClassificationResult, FailureEvent, FailureIntelligence, Fix, HealingPlan, LearningEntry, Organization, PullRequestRecord, Repository, RepositoryIndex, RootCause, ValidationRun } from '../domain.js';
|
|
2
|
+
import type { CiProvider, FailureCategory, PrGroupingStrategy, PrMode } from '../enums.js';
|
|
3
|
+
export interface PaginatedRequest {
|
|
4
|
+
page?: number;
|
|
5
|
+
limit?: number;
|
|
6
|
+
sortBy?: string;
|
|
7
|
+
sortOrder?: 'asc' | 'desc';
|
|
8
|
+
}
|
|
9
|
+
export interface PaginatedResponse<T> {
|
|
10
|
+
data: T[];
|
|
11
|
+
total: number;
|
|
12
|
+
page: number;
|
|
13
|
+
limit: number;
|
|
14
|
+
hasMore: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface IngestFailureRequest {
|
|
17
|
+
organizationId: string;
|
|
18
|
+
repositoryId: string;
|
|
19
|
+
failure: Omit<FailureEvent, 'id' | 'fingerprint' | 'occurredAt'>;
|
|
20
|
+
}
|
|
21
|
+
export interface IngestFailureResponse {
|
|
22
|
+
failureId: string;
|
|
23
|
+
fingerprint: string;
|
|
24
|
+
queued: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface UploadReportRequest {
|
|
27
|
+
organizationId: string;
|
|
28
|
+
repositoryId: string;
|
|
29
|
+
format: 'html' | 'json' | 'junit';
|
|
30
|
+
filePath: string;
|
|
31
|
+
}
|
|
32
|
+
export interface UploadReportResponse {
|
|
33
|
+
jobId: string;
|
|
34
|
+
failureCount: number;
|
|
35
|
+
}
|
|
36
|
+
export interface IngestCiFailureRequest {
|
|
37
|
+
organizationId: string;
|
|
38
|
+
repositoryId: string;
|
|
39
|
+
provider: CiProvider;
|
|
40
|
+
ciRunId: string;
|
|
41
|
+
jobName: string;
|
|
42
|
+
logContent?: string;
|
|
43
|
+
logUrl?: string;
|
|
44
|
+
artifacts?: {
|
|
45
|
+
type: string;
|
|
46
|
+
url: string;
|
|
47
|
+
}[];
|
|
48
|
+
}
|
|
49
|
+
export interface ClassifyFailureRequest {
|
|
50
|
+
failureId: string;
|
|
51
|
+
}
|
|
52
|
+
export interface ClassifyFailureResponse {
|
|
53
|
+
classification: ClassificationResult;
|
|
54
|
+
}
|
|
55
|
+
export interface BatchClassifyRequest {
|
|
56
|
+
failureIds: string[];
|
|
57
|
+
}
|
|
58
|
+
export interface AnalyzeRootCauseRequest {
|
|
59
|
+
failureIds: string[];
|
|
60
|
+
repositoryId: string;
|
|
61
|
+
}
|
|
62
|
+
export interface AnalyzeRootCauseResponse {
|
|
63
|
+
rootCauses: RootCause[];
|
|
64
|
+
ungroupedFailureIds: string[];
|
|
65
|
+
}
|
|
66
|
+
export interface DeduplicateFailuresRequest {
|
|
67
|
+
repositoryId: string;
|
|
68
|
+
since?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface GenerateHealingPlanRequest {
|
|
71
|
+
rootCauseId: string;
|
|
72
|
+
repositoryIndex?: RepositoryIndex;
|
|
73
|
+
}
|
|
74
|
+
export interface GenerateHealingPlanResponse {
|
|
75
|
+
plan: HealingPlan;
|
|
76
|
+
}
|
|
77
|
+
export interface ApplyFixRequest {
|
|
78
|
+
planId: string;
|
|
79
|
+
workspacePath: string;
|
|
80
|
+
dryRun?: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface ApplyFixResponse {
|
|
83
|
+
fix: Fix;
|
|
84
|
+
diff: string;
|
|
85
|
+
dryRun: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface AnalyzeFailureIntelligenceRequest {
|
|
88
|
+
failureId: string;
|
|
89
|
+
includeTrace?: boolean;
|
|
90
|
+
includeScreenshot?: boolean;
|
|
91
|
+
}
|
|
92
|
+
export interface AnalyzeFailureIntelligenceResponse {
|
|
93
|
+
intelligence: FailureIntelligence;
|
|
94
|
+
}
|
|
95
|
+
export interface StartValidationRequest {
|
|
96
|
+
fixId: string;
|
|
97
|
+
runsRequired?: number;
|
|
98
|
+
impactedTests?: string[];
|
|
99
|
+
}
|
|
100
|
+
export interface StartValidationResponse {
|
|
101
|
+
validation: ValidationRun;
|
|
102
|
+
jobId: string;
|
|
103
|
+
}
|
|
104
|
+
export interface GetValidationStatusRequest {
|
|
105
|
+
validationId: string;
|
|
106
|
+
}
|
|
107
|
+
export interface CreatePullRequestRequest {
|
|
108
|
+
fixIds: string[];
|
|
109
|
+
mode?: PrMode;
|
|
110
|
+
groupingStrategy?: PrGroupingStrategy;
|
|
111
|
+
title?: string;
|
|
112
|
+
description?: string;
|
|
113
|
+
}
|
|
114
|
+
export interface CreatePullRequestResponse {
|
|
115
|
+
pr: PullRequestRecord;
|
|
116
|
+
externalUrl?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface IndexRepositoryRequest {
|
|
119
|
+
repositoryId: string;
|
|
120
|
+
workspacePath: string;
|
|
121
|
+
force?: boolean;
|
|
122
|
+
}
|
|
123
|
+
export interface IndexRepositoryResponse {
|
|
124
|
+
index: RepositoryIndex;
|
|
125
|
+
durationMs: number;
|
|
126
|
+
}
|
|
127
|
+
export interface QueryLearningRequest {
|
|
128
|
+
organizationId: string;
|
|
129
|
+
repositoryId?: string;
|
|
130
|
+
category?: FailureCategory;
|
|
131
|
+
minSuccessRate?: number;
|
|
132
|
+
}
|
|
133
|
+
export interface QueryLearningResponse {
|
|
134
|
+
entries: LearningEntry[];
|
|
135
|
+
}
|
|
136
|
+
export interface CreateOrganizationRequest {
|
|
137
|
+
name: string;
|
|
138
|
+
slug: string;
|
|
139
|
+
settings?: Partial<Organization['settings']>;
|
|
140
|
+
}
|
|
141
|
+
export interface OnboardingProgress {
|
|
142
|
+
step: number;
|
|
143
|
+
setupType: 'local' | 'team' | 'enterprise' | null;
|
|
144
|
+
completed: boolean;
|
|
145
|
+
workspaceName?: string;
|
|
146
|
+
organizationId?: string;
|
|
147
|
+
}
|
|
148
|
+
export interface CreateApiKeyRequest {
|
|
149
|
+
name: string;
|
|
150
|
+
}
|
|
151
|
+
export interface CreateApiKeyResponse {
|
|
152
|
+
key: string;
|
|
153
|
+
prefix: string;
|
|
154
|
+
name: string;
|
|
155
|
+
}
|
|
156
|
+
export interface GitHubInstallUrlResponse {
|
|
157
|
+
installUrl: string | null;
|
|
158
|
+
configured: boolean;
|
|
159
|
+
}
|
|
160
|
+
export interface ConnectRepositoryRequest {
|
|
161
|
+
organizationId: string;
|
|
162
|
+
fullName: string;
|
|
163
|
+
provider: Repository['provider'];
|
|
164
|
+
accessToken: string;
|
|
165
|
+
}
|
|
166
|
+
export interface AnalyticsOverview {
|
|
167
|
+
totalFailures: number;
|
|
168
|
+
healedFailures: number;
|
|
169
|
+
healingRate: number;
|
|
170
|
+
openRootCauses: number;
|
|
171
|
+
openPrs: number;
|
|
172
|
+
diagnosedCount: number;
|
|
173
|
+
blockedCount: number;
|
|
174
|
+
healedOutcomeCount: number;
|
|
175
|
+
avgConfidence: number;
|
|
176
|
+
topCategories: {
|
|
177
|
+
category: FailureCategory;
|
|
178
|
+
count: number;
|
|
179
|
+
}[];
|
|
180
|
+
trend: {
|
|
181
|
+
date: string;
|
|
182
|
+
failures: number;
|
|
183
|
+
heals: number;
|
|
184
|
+
}[];
|
|
185
|
+
}
|
|
186
|
+
export interface TeamAnalytics {
|
|
187
|
+
teamId: string;
|
|
188
|
+
teamName: string;
|
|
189
|
+
failureCount: number;
|
|
190
|
+
healCount: number;
|
|
191
|
+
successRate: number;
|
|
192
|
+
avgTimeToHealMs: number;
|
|
193
|
+
}
|
|
194
|
+
export interface ServiceHealth {
|
|
195
|
+
service: string;
|
|
196
|
+
status: 'healthy' | 'degraded' | 'unhealthy';
|
|
197
|
+
latencyMs: number;
|
|
198
|
+
queueDepth?: number;
|
|
199
|
+
}
|
|
200
|
+
export interface PlatformHealthResponse {
|
|
201
|
+
services: ServiceHealth[];
|
|
202
|
+
timestamp: string;
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=index.d.ts.map
|