Merge branch 'main' into new-admin
This commit is contained in:
commit
50dc4733e0
17 changed files with 32 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
|||
import { LogLevel, TaggedLogger } from "../types";
|
||||
import { ActivatableLogger } from "../logger";
|
||||
import type { LogLevel, TaggedLogger } from "../types";
|
||||
import type { ActivatableLogger } from "../logger";
|
||||
|
||||
export type MockLogMessages = unknown[][];
|
||||
type TaggedLogMessages = {
|
||||
|
|
|
@ -80,4 +80,4 @@ export class MockDatabase implements TypedDatabase {
|
|||
|
||||
export const db: MockDatabase = new MockDatabase();
|
||||
|
||||
export { TypedDatabase, Statement };
|
||||
export { Statement };
|
||||
|
|
|
@ -6,7 +6,7 @@ import { config } from "../config";
|
|||
import Logger from "../logger";
|
||||
import { Database, open, Statement } from "sqlite";
|
||||
import * as sqlite3 from "sqlite3";
|
||||
import { RunResult, SqlType, TypedDatabase } from "../types";
|
||||
import type { RunResult, SqlType, TypedDatabase } from "../types";
|
||||
|
||||
const pglob = util.promisify(glob);
|
||||
const pReadFile = util.promisify(fs.readFile);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { createTransport, Transporter } from "nodemailer";
|
||||
import { config } from "../config";
|
||||
import * as MailTemplateService from "../services/mailTemplateService";
|
||||
import Mail from "nodemailer/lib/mailer";
|
||||
import type Mail from "nodemailer/lib/mailer";
|
||||
import SMTPTransport from "nodemailer/lib/smtp-transport";
|
||||
|
||||
let transporterSingleton: Transporter | null = null;
|
||||
|
|
|
@ -3,7 +3,7 @@ import { promises as fs } from "graceful-fs";
|
|||
import ErrorTypes from "../utils/errorTypes";
|
||||
import Logger from "../logger";
|
||||
import * as Resources from "../utils/resources";
|
||||
import { Request, Response } from "express";
|
||||
import type { Request, Response } from "express";
|
||||
|
||||
const indexHtml = __dirname + "/../../client/index.html";
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import * as Resources from "../utils/resources";
|
|||
import { handleJSONWithData, RequestData } from "../utils/resources";
|
||||
import { normalizeString, parseInteger } from "../shared/utils/strings";
|
||||
import { forConstraint } from "../shared/validation/validator";
|
||||
import { Request, Response } from "express";
|
||||
import type { Request, Response } from "express";
|
||||
import { isString, Mail, MailId } from "../types";
|
||||
|
||||
const isValidId = forConstraint(CONSTRAINTS.id, false);
|
||||
|
|
|
@ -5,7 +5,7 @@ import * as Resources from "../utils/resources";
|
|||
import { handleJSONWithData } from "../utils/resources";
|
||||
import { normalizeString } from "../shared/utils/strings";
|
||||
import { forConstraint } from "../shared/validation/validator";
|
||||
import { Request, Response } from "express";
|
||||
import type { Request, Response } from "express";
|
||||
import {
|
||||
isMonitoringToken,
|
||||
JSONObject,
|
||||
|
|
|
@ -6,7 +6,7 @@ import { normalizeMac, normalizeString } from "../shared/utils/strings";
|
|||
import { forConstraint, forConstraints } from "../shared/validation/validator";
|
||||
import * as Resources from "../utils/resources";
|
||||
import { handleJSONWithData } from "../utils/resources";
|
||||
import { Request, Response } from "express";
|
||||
import type { Request, Response } from "express";
|
||||
import {
|
||||
CreateOrUpdateNode,
|
||||
DomainSpecificNodeResponse,
|
||||
|
|
|
@ -5,7 +5,7 @@ import { handleJSONWithData, RequestData } from "../utils/resources";
|
|||
import { getTasks, Task } from "../jobs/scheduler";
|
||||
import { normalizeString } from "../shared/utils/strings";
|
||||
import { forConstraint } from "../shared/validation/validator";
|
||||
import { Request, Response } from "express";
|
||||
import type { Request, Response } from "express";
|
||||
import {
|
||||
isString,
|
||||
isTaskSortField,
|
||||
|
|
|
@ -4,7 +4,7 @@ import { db } from "../db/database";
|
|||
import Logger from "../logger";
|
||||
import * as MailTemplateService from "./mailTemplateService";
|
||||
import * as Resources from "../utils/resources";
|
||||
import { RestParams } from "../utils/resources";
|
||||
import type { RestParams } from "../utils/resources";
|
||||
import {
|
||||
EmailAddress,
|
||||
isJSONObject,
|
||||
|
|
|
@ -7,8 +7,8 @@ import { htmlToText } from "nodemailer-html-to-text";
|
|||
import { config } from "../config";
|
||||
import Logger from "../logger";
|
||||
import { editNodeUrl } from "../utils/urlBuilder";
|
||||
import { Transporter } from "nodemailer";
|
||||
import { MailData, Mail } from "../types";
|
||||
import type { Transporter } from "nodemailer";
|
||||
import type { MailData, Mail } from "../types";
|
||||
|
||||
const templateBasePath = __dirname + "/../mailTemplates";
|
||||
const snippetsBasePath = templateBasePath + "/snippets";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ParsedNode, parseNode, parseNodesJson } from "./monitoringService";
|
||||
import { Domain, MAC, OnlineState, Site, UnixTimestampSeconds } from "../types";
|
||||
import Logger from "../logger";
|
||||
import { MockLogger } from "../__mocks__/logger";
|
||||
import type { MockLogger } from "../__mocks__/logger";
|
||||
import { now, parseTimestamp } from "../utils/time";
|
||||
|
||||
const mockedLogger = Logger as MockLogger;
|
||||
|
|
|
@ -10,7 +10,7 @@ import Logger from "../logger";
|
|||
import * as MailService from "../services/mailService";
|
||||
import * as NodeService from "../services/nodeService";
|
||||
import * as Resources from "../utils/resources";
|
||||
import { RestParams } from "../utils/resources";
|
||||
import type { RestParams } from "../utils/resources";
|
||||
import { normalizeMac, parseInteger } from "../shared/utils/strings";
|
||||
import { monitoringDisableUrl } from "../utils/urlBuilder";
|
||||
import CONSTRAINTS from "../shared/validation/constraints";
|
||||
|
|
|
@ -140,3 +140,15 @@ export type Domain = string & { readonly __tag: unique symbol };
|
|||
* @param arg - Value to check.
|
||||
*/
|
||||
export const isDomain = toIsNewtype(isString, "" as Domain);
|
||||
|
||||
/**
|
||||
* A search term entered by the user in the frontend.
|
||||
*/
|
||||
export type SearchTerm = string & { readonly __tag: unique symbol };
|
||||
|
||||
/**
|
||||
* Type guard for {@link Domain}.
|
||||
*
|
||||
* @param arg - Value to check.
|
||||
*/
|
||||
export const isSearchTerm = isString;
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
// "removeComments": true, /* Do not emit comments to output. */
|
||||
// "noEmit": true, /* Do not emit outputs. */
|
||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||
"importsNotUsedAsValues": "error", /* Enforce using `import type` instead of `import` for types */
|
||||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||
"isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||
|
||||
/* Strict Type-Checking Options */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
|
@ -29,7 +30,7 @@
|
|||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
||||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||
|
||||
/* Additional Checks */
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
isConstraints,
|
||||
NestedConstraints,
|
||||
} from "../shared/validation/validator";
|
||||
import { Request, Response } from "express";
|
||||
import type { Request, Response } from "express";
|
||||
import {
|
||||
type GenericSortField,
|
||||
isJSONObject,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { config } from "../config";
|
||||
import { MonitoringToken, Url } from "../types";
|
||||
import type { MonitoringToken, Url } from "../types";
|
||||
|
||||
function formUrl(route: string, queryParams?: { [key: string]: string }): Url {
|
||||
let url = config.server.baseUrl as string;
|
||||
|
|
Loading…
Reference in a new issue