diff --git a/test/test.ts b/test/test.ts index 3f2dd9d..4b960ca 100644 --- a/test/test.ts +++ b/test/test.ts @@ -3,7 +3,7 @@ import * as interfaces from '../ts/index.js'; tap.test('first test', async () => { console.log( - 'hi' as interfaces.requests.checkRequests.IRequest_PageCheck_Assumption['request']['domain'] + 'hi' as interfaces.requests.IRequest_CheckExchange['request']['checkCollection']['id'] ); }); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index dcb5057..b05734c 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@uptime.link/interfaces', - version: '2.0.3', + version: '2.0.4', description: 'TypeScript interface for the uptime.link API and modules' } diff --git a/ts/data/checkcollection.ts b/ts/data/checkcollection.ts new file mode 100644 index 0000000..6569e4f --- /dev/null +++ b/ts/data/checkcollection.ts @@ -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; + functionChecks: Array; + pwaChecks?: Array; + pageRankChecks: Array; +} diff --git a/ts/data/checks.ts b/ts/data/checks.ts deleted file mode 100644 index b77e48f..0000000 --- a/ts/data/checks.ts +++ /dev/null @@ -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[]; - }>; -} diff --git a/ts/data/checks/assumption.check.ts b/ts/data/checks/assumption.check.ts new file mode 100644 index 0000000..02a3b1a --- /dev/null +++ b/ts/data/checks/assumption.check.ts @@ -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; + }; + }>; +} diff --git a/ts/data/checks/function.check.ts b/ts/data/checks/function.check.ts new file mode 100644 index 0000000..32a919e --- /dev/null +++ b/ts/data/checks/function.check.ts @@ -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[]; + }> +} \ No newline at end of file diff --git a/ts/data/checks/index.ts b/ts/data/checks/index.ts new file mode 100644 index 0000000..343b3a0 --- /dev/null +++ b/ts/data/checks/index.ts @@ -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'; diff --git a/ts/data/checks/pagerank.check.ts b/ts/data/checks/pagerank.check.ts new file mode 100644 index 0000000..7fcea03 --- /dev/null +++ b/ts/data/checks/pagerank.check.ts @@ -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 + }> +} \ No newline at end of file diff --git a/ts/data/checks/pwa.check.ts b/ts/data/checks/pwa.check.ts new file mode 100644 index 0000000..5a3641f --- /dev/null +++ b/ts/data/checks/pwa.check.ts @@ -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[]; + }; + }>; +} diff --git a/ts/data/index.ts b/ts/data/index.ts index fd42ec5..82806b3 100644 --- a/ts/data/index.ts +++ b/ts/data/index.ts @@ -1,4 +1,5 @@ -export * from './checks.js'; +export * from './checkcollection.js'; export * from './incident.js'; export * from './property.js'; +export * from './search.js'; export * from './status.js'; diff --git a/ts/data/property.ts b/ts/data/property.ts index d60a1c9..d75e0d3 100644 --- a/ts/data/property.ts +++ b/ts/data/property.ts @@ -1,9 +1,10 @@ import * as plugins from '../ul-interfaces.plugins.js'; -export class IProperty { +export class IUplinkProperty { + wgOrgIdRef: string; + wgPropertyIdRef: string; name: string; type: 'website' | 'app' | 'api' | 'other'; access: 'private' | 'public' | 'auth'; - checkRefs: string[]; - + checkCollectionIdRefs: string[]; } \ No newline at end of file diff --git a/ts/data/search.ts b/ts/data/search.ts new file mode 100644 index 0000000..c880961 --- /dev/null +++ b/ts/data/search.ts @@ -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[]; + }; +} \ No newline at end of file diff --git a/ts/requests/requests.checks.ts b/ts/requests/requests.checks.ts index 7fd1e49..ee916b6 100644 --- a/ts/requests/requests.checks.ts +++ b/ts/requests/requests.checks.ts @@ -1,4 +1,4 @@ -import { ICheck } from '../data/checks.js'; +import { ICheckCollection } from '../data/checkcollection.js'; import * as plugins from '../ul-interfaces.plugins.js'; export interface IRequest_CheckExchange @@ -8,9 +8,9 @@ export interface IRequest_CheckExchange > { method: 'check'; request: { - check: ICheck; + checkCollection: ICheckCollection; }; response: { - check: ICheck; + checkCollection: ICheckCollection; } }