use interface
This commit is contained in:
1 parent
404bd5d06b
commit
465cea21bc
2 files changed
+4
-4
No files matched your search
@@ -2,11 +2,11 @@ import { Monitor } from "@/types/monitor.js";
|
||||
import jmespath from "jmespath";
|
||||
type JmesPath = typeof jmespath;
|
||||
|
||||
export interface IADvancedMatcher {
|
||||
export interface IAdvancedMatcher {
|
||||
validate<T>(payload: T, monitor: Monitor): { ok: boolean; message: string; extracted?: T | undefined };
|
||||
}
|
||||
|
||||
export class AdvancedMatcher {
|
||||
export class AdvancedMatcher implements IAdvancedMatcher {
|
||||
constructor(private jmespath: JmesPath) {}
|
||||
|
||||
private compare(actual: unknown, expected: string, method?: string): boolean {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { type Got, HTTPError, RequestError } from "got";
|
||||
import { AdvancedMatcher } from "@/service/infrastructure/network/AdvancedMatcher.js";
|
||||
import { IAdvancedMatcher } from "@/service/infrastructure/network/AdvancedMatcher.js";
|
||||
import { IStatusProvider } from "@/service/infrastructure/network/IStatusProvider.js";
|
||||
import { HttpStatusPayload } from "@/types/network.js";
|
||||
import { MonitorStatusResponse } from "@/types/network.js";
|
||||
@@ -13,7 +13,7 @@ export class HttpProvider implements IStatusProvider<HttpStatusPayload> {
|
||||
|
||||
constructor(
|
||||
private got: Got,
|
||||
private advancedMatcher: AdvancedMatcher
|
||||
private advancedMatcher: IAdvancedMatcher
|
||||
) {
|
||||
const cacheable = new CacheableLookup({ maxTtl: 300, errorTtl: 30 });
|
||||
this.got = got.extend({
|
||||
|
||||
Reference in new issue
Block a user