fix(core): update

This commit is contained in:
Philipp Kunz 2023-04-03 13:40:56 +02:00
parent a1bf280a2f
commit 8e9c6be7e0
13 changed files with 133 additions and 68 deletions

View File

@ -3,7 +3,7 @@ import * as interfaces from '../ts/index.js';
tap.test('first test', async () => { tap.test('first test', async () => {
console.log( console.log(
'hi' as interfaces.requests.checkRequests.IRequest_PageCheck_Assumption['request']['domain'] 'hi' as interfaces.requests.IRequest_CheckExchange['request']['checkCollection']['id']
); );
}); });

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@uptime.link/interfaces', name: '@uptime.link/interfaces',
version: '2.0.3', version: '2.0.4',
description: 'TypeScript interface for the uptime.link API and modules' description: 'TypeScript interface for the uptime.link API and modules'
} }

View File

@ -0,0 +1,15 @@
import * as plugins from '../ul-interfaces.plugins.js';
import * as search from './search.js';
import * as checks from './checks/index.js';
export interface ICheckCollection {
id: string;
intervalMs: number;
assumptionChecks?: Array<checks.IAssumptionCheck>;
functionChecks: Array<checks.IFunctionCheck>;
pwaChecks?: Array<checks.IPwaCheck>;
pageRankChecks: Array<checks.IPageRankCheck>;
}

View File

@ -1,59 +0,0 @@
import * as plugins from '../ul-interfaces.plugins.js';
export type TCheckResultStatus = 'ok' | 'not ok' | 'timed out';
export interface ICheck {
type: 'pwa' | 'function' | 'assumption';
intervalMs: number;
pwaData?: {
domain: string;
};
functionData: {
domain: string;
functionDef: string;
};
assumptionData?: {
domain: string;
title?: string;
statusCode?: string;
description?: string;
dnsRecordMx?: string;
dnsRecordTxt?: string;
};
checkResults: Array<{
pwaResult?: {
timeStarted: number;
timeEnded: number;
duration: number;
status: TCheckResultStatus;
data: {
lhr: any;
reports: any[];
};
};
functionResult?: {
timeStarted: number;
timeEnded: number;
duration: number;
status: TCheckResultStatus;
data: any;
};
assumptionResult: {
timeStarted: number;
timeEnded: number;
duration: number;
status: TCheckResultStatus;
data: {
domain: string;
title?: string;
statusCode?: string;
description?: string;
dnsRecordMx?: string;
dnsRecordTxt?: string;
};
};
checkLog: string[];
}>;
}

View File

@ -0,0 +1,23 @@
import * as plugins from '../../ul-interfaces.plugins.js';
import { TCheckResultStatus, TExecutionTiming } from './index.js';
export interface IAssumptionCheck {
inputData: {
domain: string;
title?: string;
statusCode?: string;
description?: string;
dnsRecords?: plugins.tsclass.network.IDnsRecord;
};
executionResults: Array<{
timing: TExecutionTiming;
status: TCheckResultStatus;
data: {
domain: string;
title?: string;
statusCode?: string;
description?: string;
dnsRecords: Array<plugins.tsclass.network.IDnsRecord>;
};
}>;
}

View File

@ -0,0 +1,15 @@
import { TCheckResultStatus, TExecutionTiming } from "./index.js";
export interface IFunctionCheck {
checkId: string;
inputData: {
domain: string;
functionDef: string;
};
executionResults: Array<{
timing: TExecutionTiming;
status: TCheckResultStatus;
data: any;
checkLog: string[];
}>
}

13
ts/data/checks/index.ts Normal file
View File

@ -0,0 +1,13 @@
export type TCheckResultStatus = 'ok' | 'not ok' | 'timed out';
export interface TExecutionTiming {
plannedTime: number;
timeStarted: number;
timeEnded: number;
duration: number;
}
export * from './assumption.check.js';
export * from './function.check.js';
export * from './pagerank.check.js';
export * from './pwa.check.js';

View File

@ -0,0 +1,19 @@
import * as search from '../search.js';
import { TCheckResultStatus, TExecutionTiming } from './index.js';
export interface IPageRankCheck {
inputData: {
subId: string;
domain: string;
searchTerm: string;
checkBing?: boolean;
checkGoogle?: boolean;
bingMinRank?: number;
googleMinRank?: number;
};
executionResults: Array<{
timing: TExecutionTiming;
status: TCheckResultStatus;
pageRankResult: search.IPageRankResult
}>
}

View File

@ -0,0 +1,16 @@
import { TCheckResultStatus } from "./index.js";
export interface IPwaCheck {
inputData: { domain: string };
executionResults: Array<{
subId: string;
timeStarted: number;
timeEnded: number;
duration: number;
status: TCheckResultStatus;
data: {
lhr: any;
reports: any[];
};
}>;
}

View File

@ -1,4 +1,5 @@
export * from './checks.js'; export * from './checkcollection.js';
export * from './incident.js'; export * from './incident.js';
export * from './property.js'; export * from './property.js';
export * from './search.js';
export * from './status.js'; export * from './status.js';

View File

@ -1,9 +1,10 @@
import * as plugins from '../ul-interfaces.plugins.js'; import * as plugins from '../ul-interfaces.plugins.js';
export class IProperty { export class IUplinkProperty {
wgOrgIdRef: string;
wgPropertyIdRef: string;
name: string; name: string;
type: 'website' | 'app' | 'api' | 'other'; type: 'website' | 'app' | 'api' | 'other';
access: 'private' | 'public' | 'auth'; access: 'private' | 'public' | 'auth';
checkRefs: string[]; checkCollectionIdRefs: string[];
} }

21
ts/data/search.ts Normal file
View File

@ -0,0 +1,21 @@
export interface ISearchResult {
searchTerm: string;
targetUrl: string;
title: string;
description: string;
rank: number;
}
/**
* special data returned by the PageRankCheck check class
*/
export interface IPageRankResult {
googleRank: number;
googleBlocked: boolean;
bingRank: number;
bingBlocked: boolean;
searchResults: {
google: ISearchResult[];
bing: ISearchResult[];
};
}

View File

@ -1,4 +1,4 @@
import { ICheck } from '../data/checks.js'; import { ICheckCollection } from '../data/checkcollection.js';
import * as plugins from '../ul-interfaces.plugins.js'; import * as plugins from '../ul-interfaces.plugins.js';
export interface IRequest_CheckExchange export interface IRequest_CheckExchange
@ -8,9 +8,9 @@ export interface IRequest_CheckExchange
> { > {
method: 'check'; method: 'check';
request: { request: {
check: ICheck; checkCollection: ICheckCollection;
}; };
response: { response: {
check: ICheck; checkCollection: ICheckCollection;
} }
} }