mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-02 12:47:41 +02:00
Tools: Apply eslint rule @typescript-eslint/no-inferrable-types with ignoreProperties=false
This commit is contained in:
parent
667bb19765
commit
315f071337
@ -183,7 +183,7 @@ module.exports = {
|
|||||||
'rules': {
|
'rules': {
|
||||||
'@typescript-eslint/explicit-member-accessibility': ['error'],
|
'@typescript-eslint/explicit-member-accessibility': ['error'],
|
||||||
'@typescript-eslint/type-annotation-spacing': ['error', { 'before': false, 'after': true }],
|
'@typescript-eslint/type-annotation-spacing': ['error', { 'before': false, 'after': true }],
|
||||||
'@typescript-eslint/no-inferrable-types': ['error', { 'ignoreParameters': true, 'ignoreProperties': true }],
|
'@typescript-eslint/no-inferrable-types': ['error', { 'ignoreParameters': true }],
|
||||||
'@typescript-eslint/comma-dangle': ['error', {
|
'@typescript-eslint/comma-dangle': ['error', {
|
||||||
'arrays': 'always-multiline',
|
'arrays': 'always-multiline',
|
||||||
'objects': 'always-multiline',
|
'objects': 'always-multiline',
|
||||||
|
@ -26,7 +26,7 @@ export default class ElectronAppWrapper {
|
|||||||
private isDebugMode_: boolean;
|
private isDebugMode_: boolean;
|
||||||
private profilePath_: string;
|
private profilePath_: string;
|
||||||
private win_: BrowserWindow = null;
|
private win_: BrowserWindow = null;
|
||||||
private willQuitApp_: boolean = false;
|
private willQuitApp_ = false;
|
||||||
private tray_: any = null;
|
private tray_: any = null;
|
||||||
private buildDir_: string = null;
|
private buildDir_: string = null;
|
||||||
private rendererProcessQuitReply_: RendererProcessQuitReply = null;
|
private rendererProcessQuitReply_: RendererProcessQuitReply = null;
|
||||||
|
@ -80,7 +80,7 @@ const appDefaultState = createAppDefaultState(
|
|||||||
class Application extends BaseApplication {
|
class Application extends BaseApplication {
|
||||||
|
|
||||||
private checkAllPluginStartedIID_: any = null;
|
private checkAllPluginStartedIID_: any = null;
|
||||||
private initPluginServiceDone_: boolean = false;
|
private initPluginServiceDone_ = false;
|
||||||
|
|
||||||
public constructor() {
|
public constructor() {
|
||||||
super();
|
super();
|
||||||
|
@ -12,8 +12,8 @@ interface Props {
|
|||||||
|
|
||||||
export default class NoteTextViewerComponent extends React.Component<Props, any> {
|
export default class NoteTextViewerComponent extends React.Component<Props, any> {
|
||||||
|
|
||||||
private initialized_: boolean = false;
|
private initialized_ = false;
|
||||||
private domReady_: boolean = false;
|
private domReady_ = false;
|
||||||
private webviewRef_: any;
|
private webviewRef_: any;
|
||||||
private webviewListeners_: any = null;
|
private webviewListeners_: any = null;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ export default class PromptDialog extends React.Component<Props, any> {
|
|||||||
private focusInput_: boolean;
|
private focusInput_: boolean;
|
||||||
private styles_: any;
|
private styles_: any;
|
||||||
private styleKey_: string;
|
private styleKey_: string;
|
||||||
private menuIsOpened_: boolean = false;
|
private menuIsOpened_ = false;
|
||||||
|
|
||||||
public constructor(props: Props) {
|
public constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
// Stores information about the current content of the user's selection
|
// Stores information about the current content of the user's selection
|
||||||
|
|
||||||
export default class SelectionFormatting {
|
export default class SelectionFormatting {
|
||||||
public bolded: boolean = false;
|
public bolded = false;
|
||||||
public italicized: boolean = false;
|
public italicized = false;
|
||||||
public inChecklist: boolean = false;
|
public inChecklist = false;
|
||||||
public inCode: boolean = false;
|
public inCode = false;
|
||||||
public inUnorderedList: boolean = false;
|
public inUnorderedList = false;
|
||||||
public inOrderedList: boolean = false;
|
public inOrderedList = false;
|
||||||
public inMath: boolean = false;
|
public inMath = false;
|
||||||
public inLink: boolean = false;
|
public inLink = false;
|
||||||
public spellChecking: boolean = false;
|
public spellChecking = false;
|
||||||
public unspellCheckableRegion: boolean = false;
|
public unspellCheckableRegion = false;
|
||||||
|
|
||||||
// Link data, both fields are null if not in a link.
|
// Link data, both fields are null if not in a link.
|
||||||
public linkData: { linkText?: string; linkURL?: string } = {
|
public linkData: { linkText?: string; linkURL?: string } = {
|
||||||
@ -20,11 +20,11 @@ export default class SelectionFormatting {
|
|||||||
|
|
||||||
// If [headerLevel], [listLevel], etc. are zero, then the
|
// If [headerLevel], [listLevel], etc. are zero, then the
|
||||||
// selection isn't in a header/list
|
// selection isn't in a header/list
|
||||||
public headerLevel: number = 0;
|
public headerLevel = 0;
|
||||||
public listLevel: number = 0;
|
public listLevel = 0;
|
||||||
|
|
||||||
// Content of the selection
|
// Content of the selection
|
||||||
public selectedText: string = '';
|
public selectedText = '';
|
||||||
|
|
||||||
// List of data properties (for serializing/deseralizing)
|
// List of data properties (for serializing/deseralizing)
|
||||||
private static propNames: string[] = [
|
private static propNames: string[] = [
|
||||||
|
@ -75,8 +75,8 @@ export default class BaseApplication {
|
|||||||
private database_: any = null;
|
private database_: any = null;
|
||||||
private profileConfig_: ProfileConfig = null;
|
private profileConfig_: ProfileConfig = null;
|
||||||
|
|
||||||
protected showStackTraces_: boolean = false;
|
protected showStackTraces_ = false;
|
||||||
protected showPromptString_: boolean = false;
|
protected showPromptString_ = false;
|
||||||
|
|
||||||
// Note: this is basically a cache of state.selectedFolderId. It should *only*
|
// Note: this is basically a cache of state.selectedFolderId. It should *only*
|
||||||
// be derived from the state and not set directly since that would make the
|
// be derived from the state and not set directly since that would make the
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
export default class JoplinError extends Error {
|
export default class JoplinError extends Error {
|
||||||
|
|
||||||
public code: any = null;
|
public code: any = null;
|
||||||
public details: string = '';
|
public details = '';
|
||||||
|
|
||||||
public constructor(message: string, code: any = null, details: string = null) {
|
public constructor(message: string, code: any = null, details: string = null) {
|
||||||
super(message);
|
super(message);
|
||||||
|
@ -44,8 +44,8 @@ export default class JoplinServerApi {
|
|||||||
|
|
||||||
private options_: Options;
|
private options_: Options;
|
||||||
private session_: Session;
|
private session_: Session;
|
||||||
private debugRequests_: boolean = false;
|
private debugRequests_ = false;
|
||||||
private debugRequestsShowPasswords_: boolean = false;
|
private debugRequestsShowPasswords_ = false;
|
||||||
|
|
||||||
public constructor(options: Options) {
|
public constructor(options: Options) {
|
||||||
this.options_ = options;
|
this.options_ = options;
|
||||||
|
@ -61,7 +61,7 @@ class Logger {
|
|||||||
private targets_: Target[] = [];
|
private targets_: Target[] = [];
|
||||||
private level_: LogLevel = LogLevel.Info;
|
private level_: LogLevel = LogLevel.Info;
|
||||||
private lastDbCleanup_: number = time.unixMs();
|
private lastDbCleanup_: number = time.unixMs();
|
||||||
private enabled_: boolean = true;
|
private enabled_ = true;
|
||||||
|
|
||||||
public static fsDriver() {
|
public static fsDriver() {
|
||||||
if (!Logger.fsDriver_) Logger.fsDriver_ = new FsDriverDummy();
|
if (!Logger.fsDriver_) Logger.fsDriver_ = new FsDriverDummy();
|
||||||
|
@ -25,7 +25,7 @@ interface Intervals {
|
|||||||
export default class PoorManIntervals {
|
export default class PoorManIntervals {
|
||||||
|
|
||||||
private static maxNativeTimerDuration_ = 10 * 1000;
|
private static maxNativeTimerDuration_ = 10 * 1000;
|
||||||
private static lastUpdateTime_: number = 0;
|
private static lastUpdateTime_ = 0;
|
||||||
private static intervalId_: IntervalId = 0;
|
private static intervalId_: IntervalId = 0;
|
||||||
private static intervals_: Intervals = {};
|
private static intervals_: Intervals = {};
|
||||||
|
|
||||||
|
@ -49,14 +49,14 @@ function isCannotSyncError(error: any): boolean {
|
|||||||
|
|
||||||
export default class Synchronizer {
|
export default class Synchronizer {
|
||||||
|
|
||||||
public static verboseMode: boolean = true;
|
public static verboseMode = true;
|
||||||
|
|
||||||
private db_: JoplinDatabase;
|
private db_: JoplinDatabase;
|
||||||
private api_: FileApi;
|
private api_: FileApi;
|
||||||
private appType_: AppType;
|
private appType_: AppType;
|
||||||
private logger_: Logger = new Logger();
|
private logger_: Logger = new Logger();
|
||||||
private state_: string = 'idle';
|
private state_ = 'idle';
|
||||||
private cancelling_: boolean = false;
|
private cancelling_ = false;
|
||||||
public maxResourceSize_: number = null;
|
public maxResourceSize_: number = null;
|
||||||
private downloadQueue_: any = null;
|
private downloadQueue_: any = null;
|
||||||
private clientId_: string;
|
private clientId_: string;
|
||||||
@ -64,7 +64,7 @@ export default class Synchronizer {
|
|||||||
private migrationHandler_: MigrationHandler;
|
private migrationHandler_: MigrationHandler;
|
||||||
private encryptionService_: EncryptionService = null;
|
private encryptionService_: EncryptionService = null;
|
||||||
private resourceService_: ResourceService = null;
|
private resourceService_: ResourceService = null;
|
||||||
private syncTargetIsLocked_: boolean = false;
|
private syncTargetIsLocked_ = false;
|
||||||
private shareService_: ShareService = null;
|
private shareService_: ShareService = null;
|
||||||
private lockClientType_: LockClientType = null;
|
private lockClientType_: LockClientType = null;
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ class Setting extends BaseModel {
|
|||||||
private static changedKeys_: string[] = [];
|
private static changedKeys_: string[] = [];
|
||||||
private static fileHandler_: FileHandler = null;
|
private static fileHandler_: FileHandler = null;
|
||||||
private static rootFileHandler_: FileHandler = null;
|
private static rootFileHandler_: FileHandler = null;
|
||||||
private static settingFilename_: string = 'settings.json';
|
private static settingFilename_ = 'settings.json';
|
||||||
private static buildInMetadata_: SettingItems = null;
|
private static buildInMetadata_: SettingItems = null;
|
||||||
|
|
||||||
public static tableName() {
|
public static tableName() {
|
||||||
|
@ -21,7 +21,7 @@ export default class DecryptionWorker {
|
|||||||
|
|
||||||
public static instance_: DecryptionWorker = null;
|
public static instance_: DecryptionWorker = null;
|
||||||
|
|
||||||
private state_: string = 'idle';
|
private state_ = 'idle';
|
||||||
private logger_: Logger;
|
private logger_: Logger;
|
||||||
public dispatch: Function = () => {};
|
public dispatch: Function = () => {};
|
||||||
private scheduleId_: any = null;
|
private scheduleId_: any = null;
|
||||||
|
@ -33,7 +33,7 @@ export default class ResourceEditWatcher {
|
|||||||
private chokidar_: any;
|
private chokidar_: any;
|
||||||
private watchedItems_: WatchedItems = {};
|
private watchedItems_: WatchedItems = {};
|
||||||
private eventEmitter_: any;
|
private eventEmitter_: any;
|
||||||
private tempDir_: string = '';
|
private tempDir_ = '';
|
||||||
private openItem_: OpenItemFn;
|
private openItem_: OpenItemFn;
|
||||||
|
|
||||||
public constructor() {
|
public constructor() {
|
||||||
|
@ -13,8 +13,8 @@ const { sprintf } = require('sprintf-js');
|
|||||||
|
|
||||||
export default class ResourceService extends BaseService {
|
export default class ResourceService extends BaseService {
|
||||||
|
|
||||||
public static isRunningInBackground_: boolean = false;
|
public static isRunningInBackground_ = false;
|
||||||
private isIndexing_: boolean = false;
|
private isIndexing_ = false;
|
||||||
|
|
||||||
private maintenanceCalls_: boolean[] = [];
|
private maintenanceCalls_: boolean[] = [];
|
||||||
private maintenanceTimer1_: any = null;
|
private maintenanceTimer1_: any = null;
|
||||||
|
@ -4,7 +4,7 @@ const EventEmitter = require('events');
|
|||||||
class UndoQueue {
|
class UndoQueue {
|
||||||
|
|
||||||
private inner_: any[] = [];
|
private inner_: any[] = [];
|
||||||
private size_: number = 20;
|
private size_ = 20;
|
||||||
|
|
||||||
public pop() {
|
public pop() {
|
||||||
return this.inner_.pop();
|
return this.inner_.pop();
|
||||||
@ -33,7 +33,7 @@ export default class UndoRedoService {
|
|||||||
private undoStates: UndoQueue = new UndoQueue();
|
private undoStates: UndoQueue = new UndoQueue();
|
||||||
private redoStates: UndoQueue = new UndoQueue();
|
private redoStates: UndoQueue = new UndoQueue();
|
||||||
private eventEmitter: any = new EventEmitter();
|
private eventEmitter: any = new EventEmitter();
|
||||||
private isUndoing: boolean = false;
|
private isUndoing = false;
|
||||||
|
|
||||||
public constructor() {
|
public constructor() {
|
||||||
this.push = this.push.bind(this);
|
this.push = this.push.bind(this);
|
||||||
|
@ -24,7 +24,7 @@ export default class InteropService_Exporter_Html extends InteropService_Exporte
|
|||||||
private markupToHtml_: MarkupToHtml;
|
private markupToHtml_: MarkupToHtml;
|
||||||
private resources_: ResourceEntity[] = [];
|
private resources_: ResourceEntity[] = [];
|
||||||
private style_: any;
|
private style_: any;
|
||||||
private packIntoSingleFile_: boolean = false;
|
private packIntoSingleFile_ = false;
|
||||||
|
|
||||||
public async init(path: string, options: any = {}) {
|
public async init(path: string, options: any = {}) {
|
||||||
this.customCss_ = options.customCss ? options.customCss : '';
|
this.customCss_ = options.customCss ? options.customCss : '';
|
||||||
|
@ -7,7 +7,7 @@ import Setting from '../../models/Setting';
|
|||||||
export default class InteropService_Importer_Base {
|
export default class InteropService_Importer_Base {
|
||||||
|
|
||||||
private metadata_: any = null;
|
private metadata_: any = null;
|
||||||
protected sourcePath_: string = '';
|
protected sourcePath_ = '';
|
||||||
protected options_: any = {};
|
protected options_: any = {};
|
||||||
|
|
||||||
public setMetadata(md: any) {
|
public setMetadata(md: any) {
|
||||||
|
@ -6,7 +6,7 @@ export default class KeychainService extends BaseService {
|
|||||||
|
|
||||||
private driver: KeychainServiceDriverBase;
|
private driver: KeychainServiceDriverBase;
|
||||||
private static instance_: KeychainService;
|
private static instance_: KeychainService;
|
||||||
private enabled_: boolean = true;
|
private enabled_ = true;
|
||||||
|
|
||||||
public static instance(): KeychainService {
|
public static instance(): KeychainService {
|
||||||
if (!this.instance_) this.instance_ = new KeychainService();
|
if (!this.instance_) this.instance_ = new KeychainService();
|
||||||
|
@ -30,11 +30,11 @@ export default class Plugin {
|
|||||||
private contentScripts_: ContentScripts = {};
|
private contentScripts_: ContentScripts = {};
|
||||||
private dispatch_: Function;
|
private dispatch_: Function;
|
||||||
private eventEmitter_: any;
|
private eventEmitter_: any;
|
||||||
private devMode_: boolean = false;
|
private devMode_ = false;
|
||||||
private messageListener_: Function = null;
|
private messageListener_: Function = null;
|
||||||
private contentScriptMessageListeners_: Record<string, Function> = {};
|
private contentScriptMessageListeners_: Record<string, Function> = {};
|
||||||
private dataDir_: string;
|
private dataDir_: string;
|
||||||
private dataDirCreated_: boolean = false;
|
private dataDirCreated_ = false;
|
||||||
|
|
||||||
public constructor(baseDir: string, manifest: PluginManifest, scriptText: string, dispatch: Function, dataDir: string) {
|
public constructor(baseDir: string, manifest: PluginManifest, scriptText: string, dispatch: Function, dataDir: string) {
|
||||||
this.baseDir_ = shim.fsDriver().resolve(baseDir);
|
this.baseDir_ = shim.fsDriver().resolve(baseDir);
|
||||||
|
@ -87,7 +87,7 @@ export default class PluginService extends BaseService {
|
|||||||
private plugins_: Plugins = {};
|
private plugins_: Plugins = {};
|
||||||
private runner_: BasePluginRunner = null;
|
private runner_: BasePluginRunner = null;
|
||||||
private startedPlugins_: Record<string, boolean> = {};
|
private startedPlugins_: Record<string, boolean> = {};
|
||||||
private isSafeMode_: boolean = false;
|
private isSafeMode_ = false;
|
||||||
|
|
||||||
public initialize(appVersion: string, platformImplementation: any, runner: BasePluginRunner, store: any) {
|
public initialize(appVersion: string, platformImplementation: any, runner: BasePluginRunner, store: any) {
|
||||||
this.appVersion_ = appVersion;
|
this.appVersion_ = appVersion;
|
||||||
|
@ -61,7 +61,7 @@ export default class RepositoryApi {
|
|||||||
private manifests_: PluginManifest[] = null;
|
private manifests_: PluginManifest[] = null;
|
||||||
private githubApiUrl_: string;
|
private githubApiUrl_: string;
|
||||||
private contentBaseUrl_: string;
|
private contentBaseUrl_: string;
|
||||||
private isUsingDefaultContentUrl_: boolean = true;
|
private isUsingDefaultContentUrl_ = true;
|
||||||
|
|
||||||
public constructor(baseUrl: string, tempDir: string) {
|
public constructor(baseUrl: string, tempDir: string) {
|
||||||
this.baseUrl_ = baseUrl;
|
this.baseUrl_ = baseUrl;
|
||||||
|
@ -174,7 +174,7 @@ export function syncInfoEquals(s1: SyncInfo, s2: SyncInfo): boolean {
|
|||||||
|
|
||||||
export class SyncInfo {
|
export class SyncInfo {
|
||||||
|
|
||||||
private version_: number = 0;
|
private version_ = 0;
|
||||||
private e2ee_: SyncInfoValueBoolean;
|
private e2ee_: SyncInfoValueBoolean;
|
||||||
private activeMasterKeyId_: SyncInfoValueString;
|
private activeMasterKeyId_: SyncInfoValueString;
|
||||||
private masterKeys_: MasterKeyEntity[] = [];
|
private masterKeys_: MasterKeyEntity[] = [];
|
||||||
|
@ -5,9 +5,9 @@ type ConditionHandler = ()=> boolean;
|
|||||||
|
|
||||||
class Time {
|
class Time {
|
||||||
|
|
||||||
private dateFormat_: string = 'DD/MM/YYYY';
|
private dateFormat_ = 'DD/MM/YYYY';
|
||||||
private timeFormat_: string = 'HH:mm';
|
private timeFormat_ = 'HH:mm';
|
||||||
private locale_: string = 'en-us';
|
private locale_ = 'en-us';
|
||||||
|
|
||||||
public locale() {
|
public locale() {
|
||||||
return this.locale_;
|
return this.locale_;
|
||||||
|
@ -198,7 +198,7 @@ export default class MdToHtml {
|
|||||||
private pluginOptions_: any = {};
|
private pluginOptions_: any = {};
|
||||||
private extraRendererRules_: RendererRules = {};
|
private extraRendererRules_: RendererRules = {};
|
||||||
private allProcessedAssets_: any = {};
|
private allProcessedAssets_: any = {};
|
||||||
private customCss_: string = '';
|
private customCss_ = '';
|
||||||
|
|
||||||
public constructor(options: Options = null) {
|
public constructor(options: Options = null) {
|
||||||
if (!options) options = {};
|
if (!options) options = {};
|
||||||
|
@ -68,7 +68,7 @@ export interface ItemLoadOptions extends LoadOptions {
|
|||||||
|
|
||||||
export default class ItemModel extends BaseModel<Item> {
|
export default class ItemModel extends BaseModel<Item> {
|
||||||
|
|
||||||
private updatingTotalSizes_: boolean = false;
|
private updatingTotalSizes_ = false;
|
||||||
private storageDriverConfig_: StorageDriverConfig;
|
private storageDriverConfig_: StorageDriverConfig;
|
||||||
private storageDriverConfigFallback_: StorageDriverConfig;
|
private storageDriverConfigFallback_: StorageDriverConfig;
|
||||||
|
|
||||||
|
@ -10,12 +10,12 @@ export default class BaseService {
|
|||||||
private env_: Env;
|
private env_: Env;
|
||||||
private models_: Models;
|
private models_: Models;
|
||||||
private config_: Config;
|
private config_: Config;
|
||||||
protected name_: string = 'Untitled';
|
protected name_ = 'Untitled';
|
||||||
protected enabled_: boolean = true;
|
protected enabled_ = true;
|
||||||
private destroyed_: boolean = false;
|
private destroyed_ = false;
|
||||||
protected maintenanceInterval_: number = 10000;
|
protected maintenanceInterval_ = 10000;
|
||||||
private scheduledMaintenances_: boolean[] = [];
|
private scheduledMaintenances_: boolean[] = [];
|
||||||
private maintenanceInProgress_: boolean = false;
|
private maintenanceInProgress_ = false;
|
||||||
|
|
||||||
public constructor(env: Env, models: Models, config: Config) {
|
public constructor(env: Env, models: Models, config: Config) {
|
||||||
this.env_ = env;
|
this.env_ = env;
|
||||||
|
@ -67,7 +67,7 @@ export default class MustacheService {
|
|||||||
|
|
||||||
private viewDir_: string;
|
private viewDir_: string;
|
||||||
private baseAssetUrl_: string;
|
private baseAssetUrl_: string;
|
||||||
private prefersDarkEnabled_: boolean = true;
|
private prefersDarkEnabled_ = true;
|
||||||
private partials_: Record<string, string> = {};
|
private partials_: Record<string, string> = {};
|
||||||
private fileContentCache_: Record<string, string> = {};
|
private fileContentCache_: Record<string, string> = {};
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ export interface DeletionJobOptions {
|
|||||||
|
|
||||||
export default class UserDeletionService extends BaseService {
|
export default class UserDeletionService extends BaseService {
|
||||||
|
|
||||||
protected name_: string = 'UserDeletionService';
|
protected name_ = 'UserDeletionService';
|
||||||
|
|
||||||
private async deleteUserData(userId: Uuid, options: DeletionJobOptions) {
|
private async deleteUserData(userId: Uuid, options: DeletionJobOptions) {
|
||||||
// While the "UserDeletionInProgress" flag is on, the account is
|
// While the "UserDeletionInProgress" flag is on, the account is
|
||||||
|
@ -13,7 +13,7 @@ export default class Router {
|
|||||||
// available (that ctx.joplin.owner is defined). It means by default any user, even
|
// available (that ctx.joplin.owner is defined). It means by default any user, even
|
||||||
// not logged in, can access any route of this router. End points that
|
// not logged in, can access any route of this router. End points that
|
||||||
// should not be publicly available should call ownerRequired(ctx);
|
// should not be publicly available should call ownerRequired(ctx);
|
||||||
public public: boolean = false;
|
public public = false;
|
||||||
public publicSchemas: string[] = [];
|
public publicSchemas: string[] = [];
|
||||||
|
|
||||||
public responseFormat: RouteResponseFormat = null;
|
public responseFormat: RouteResponseFormat = null;
|
||||||
|
@ -17,8 +17,8 @@ export default class TransactionHandler {
|
|||||||
|
|
||||||
private transactionStack_: TransactionInfo[] = [];
|
private transactionStack_: TransactionInfo[] = [];
|
||||||
private activeTransaction_: Knex.Transaction = null;
|
private activeTransaction_: Knex.Transaction = null;
|
||||||
private transactionIndex_: number = 0;
|
private transactionIndex_ = 0;
|
||||||
private logEnabled_: boolean = false;
|
private logEnabled_ = false;
|
||||||
private db_: Knex = null;
|
private db_: Knex = null;
|
||||||
|
|
||||||
public constructor(db: DbConnection) {
|
public constructor(db: DbConnection) {
|
||||||
|
@ -16,7 +16,7 @@ export interface ErrorOptions {
|
|||||||
// For explanation of the setPrototypeOf call, see:
|
// For explanation of the setPrototypeOf call, see:
|
||||||
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
||||||
export class ApiError extends Error {
|
export class ApiError extends Error {
|
||||||
public static httpCode: number = 400;
|
public static httpCode = 400;
|
||||||
|
|
||||||
public httpCode: number;
|
public httpCode: number;
|
||||||
public code: ErrorCode;
|
public code: ErrorCode;
|
||||||
@ -46,7 +46,7 @@ export class ErrorWithCode extends ApiError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ErrorMethodNotAllowed extends ApiError {
|
export class ErrorMethodNotAllowed extends ApiError {
|
||||||
public static httpCode: number = 400;
|
public static httpCode = 400;
|
||||||
|
|
||||||
public constructor(message: string = 'Method Not Allowed', options: ErrorOptions = null) {
|
public constructor(message: string = 'Method Not Allowed', options: ErrorOptions = null) {
|
||||||
super(message, ErrorMethodNotAllowed.httpCode, options);
|
super(message, ErrorMethodNotAllowed.httpCode, options);
|
||||||
@ -55,7 +55,7 @@ export class ErrorMethodNotAllowed extends ApiError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ErrorNotFound extends ApiError {
|
export class ErrorNotFound extends ApiError {
|
||||||
public static httpCode: number = 404;
|
public static httpCode = 404;
|
||||||
|
|
||||||
public constructor(message: string = 'Not Found', code: ErrorCode = undefined) {
|
public constructor(message: string = 'Not Found', code: ErrorCode = undefined) {
|
||||||
super(message, ErrorNotFound.httpCode, code);
|
super(message, ErrorNotFound.httpCode, code);
|
||||||
@ -64,7 +64,7 @@ export class ErrorNotFound extends ApiError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ErrorForbidden extends ApiError {
|
export class ErrorForbidden extends ApiError {
|
||||||
public static httpCode: number = 403;
|
public static httpCode = 403;
|
||||||
|
|
||||||
public constructor(message: string = 'Forbidden', options: ErrorOptions = null) {
|
public constructor(message: string = 'Forbidden', options: ErrorOptions = null) {
|
||||||
super(message, ErrorForbidden.httpCode, options);
|
super(message, ErrorForbidden.httpCode, options);
|
||||||
@ -73,7 +73,7 @@ export class ErrorForbidden extends ApiError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ErrorBadRequest extends ApiError {
|
export class ErrorBadRequest extends ApiError {
|
||||||
public static httpCode: number = 400;
|
public static httpCode = 400;
|
||||||
|
|
||||||
public constructor(message: string = 'Bad Request', options: ErrorOptions = null) {
|
public constructor(message: string = 'Bad Request', options: ErrorOptions = null) {
|
||||||
super(message, ErrorBadRequest.httpCode, options);
|
super(message, ErrorBadRequest.httpCode, options);
|
||||||
@ -83,7 +83,7 @@ export class ErrorBadRequest extends ApiError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ErrorPreconditionFailed extends ApiError {
|
export class ErrorPreconditionFailed extends ApiError {
|
||||||
public static httpCode: number = 412;
|
public static httpCode = 412;
|
||||||
|
|
||||||
public constructor(message: string = 'Precondition Failed', options: ErrorOptions = null) {
|
public constructor(message: string = 'Precondition Failed', options: ErrorOptions = null) {
|
||||||
super(message, ErrorPreconditionFailed.httpCode, options);
|
super(message, ErrorPreconditionFailed.httpCode, options);
|
||||||
@ -93,7 +93,7 @@ export class ErrorPreconditionFailed extends ApiError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ErrorUnprocessableEntity extends ApiError {
|
export class ErrorUnprocessableEntity extends ApiError {
|
||||||
public static httpCode: number = 422;
|
public static httpCode = 422;
|
||||||
|
|
||||||
public constructor(message: string = 'Unprocessable Entity', options: ErrorOptions = null) {
|
public constructor(message: string = 'Unprocessable Entity', options: ErrorOptions = null) {
|
||||||
super(message, ErrorUnprocessableEntity.httpCode, options);
|
super(message, ErrorUnprocessableEntity.httpCode, options);
|
||||||
@ -102,7 +102,7 @@ export class ErrorUnprocessableEntity extends ApiError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ErrorConflict extends ApiError {
|
export class ErrorConflict extends ApiError {
|
||||||
public static httpCode: number = 409;
|
public static httpCode = 409;
|
||||||
|
|
||||||
public constructor(message: string = 'Conflict', code: ErrorCode = undefined) {
|
public constructor(message: string = 'Conflict', code: ErrorCode = undefined) {
|
||||||
super(message, ErrorConflict.httpCode, code);
|
super(message, ErrorConflict.httpCode, code);
|
||||||
@ -111,7 +111,7 @@ export class ErrorConflict extends ApiError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ErrorResyncRequired extends ApiError {
|
export class ErrorResyncRequired extends ApiError {
|
||||||
public static httpCode: number = 400;
|
public static httpCode = 400;
|
||||||
|
|
||||||
public constructor(message: string = 'Delta cursor is invalid and the complete data should be resynced') {
|
public constructor(message: string = 'Delta cursor is invalid and the complete data should be resynced') {
|
||||||
super(message, ErrorResyncRequired.httpCode, ErrorCode.ResyncRequired);
|
super(message, ErrorResyncRequired.httpCode, ErrorCode.ResyncRequired);
|
||||||
@ -120,7 +120,7 @@ export class ErrorResyncRequired extends ApiError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ErrorPayloadTooLarge extends ApiError {
|
export class ErrorPayloadTooLarge extends ApiError {
|
||||||
public static httpCode: number = 413;
|
public static httpCode = 413;
|
||||||
|
|
||||||
public constructor(message: string = 'Payload Too Large', options: ErrorOptions = null) {
|
public constructor(message: string = 'Payload Too Large', options: ErrorOptions = null) {
|
||||||
super(message, ErrorPayloadTooLarge.httpCode, options);
|
super(message, ErrorPayloadTooLarge.httpCode, options);
|
||||||
@ -129,8 +129,8 @@ export class ErrorPayloadTooLarge extends ApiError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ErrorTooManyRequests extends ApiError {
|
export class ErrorTooManyRequests extends ApiError {
|
||||||
public static httpCode: number = 429;
|
public static httpCode = 429;
|
||||||
public retryAfterMs: number = 0;
|
public retryAfterMs = 0;
|
||||||
|
|
||||||
public constructor(message: string = null, retryAfterMs: number = 0) {
|
public constructor(message: string = null, retryAfterMs: number = 0) {
|
||||||
super(message === null ? 'Too Many Requests' : message, ErrorTooManyRequests.httpCode);
|
super(message === null ? 'Too Many Requests' : message, ErrorTooManyRequests.httpCode);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export default class FakeResponse {
|
export default class FakeResponse {
|
||||||
|
|
||||||
public status: number = 200;
|
public status = 200;
|
||||||
public body: any = null;
|
public body: any = null;
|
||||||
private headers_: any = {};
|
private headers_: any = {};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user