diff --git a/src/app.ts b/src/app.ts
index ac404908..6d82f94a 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -13,25 +13,25 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { SCNotFoundErrorResponse, SCUnsupportedMediaTypeErrorResponse } from '@openstapps/core';
-import { SCValidator } from '@openstapps/core-validator';
+import {SCNotFoundErrorResponse, SCUnsupportedMediaTypeErrorResponse} from '@openstapps/core';
+import {SCValidator} from '@openstapps/core-validator';
import * as bodyParser from 'body-parser';
import * as config from 'config';
import * as cors from 'cors';
import * as express from 'express';
import * as morgan from 'morgan';
-import { logger, mailer } from './common';
-import { MailQueue } from './notification/MailQueue';
-import { bulkAddRouter } from './routes/BulkAddRoute';
-import { bulkDoneRouter } from './routes/BulkDoneRoute';
-import { bulkRouter } from './routes/BulkRoute';
-import { indexRouter } from './routes/IndexRoute';
-import { multiSearchRouter } from './routes/MultiSearchRoute';
-import { searchRouter } from './routes/SearchRoute';
-import { thingUpdateRouter } from './routes/ThingUpdateRoute';
-import { BulkStorage } from './storage/BulkStorage';
-import { DatabaseConstructor } from './storage/Database';
-import { Elasticsearch } from './storage/elasticsearch/Elasticsearch';
+import {logger, mailer} from './common';
+import {MailQueue} from './notification/MailQueue';
+import {bulkAddRouter} from './routes/BulkAddRoute';
+import {bulkDoneRouter} from './routes/BulkDoneRoute';
+import {bulkRouter} from './routes/BulkRoute';
+import {indexRouter} from './routes/IndexRoute';
+import {multiSearchRouter} from './routes/MultiSearchRoute';
+import {searchRouter} from './routes/SearchRoute';
+import {thingUpdateRouter} from './routes/ThingUpdateRoute';
+import {BulkStorage} from './storage/BulkStorage';
+import {DatabaseConstructor} from './storage/Database';
+import {Elasticsearch} from './storage/elasticsearch/Elasticsearch';
export const app = express();
diff --git a/src/cli.ts b/src/cli.ts
index a0667f6a..ff42840c 100644
--- a/src/cli.ts
+++ b/src/cli.ts
@@ -14,8 +14,8 @@
* along with this program. If not, see .
*/
import * as http from 'http';
-import { app } from './app';
-import { logger } from './common';
+import {app} from './app';
+import {logger} from './common';
/**
* Get port from environment and store in Express.
diff --git a/src/common.ts b/src/common.ts
index f5247cea..b6189d74 100644
--- a/src/common.ts
+++ b/src/common.ts
@@ -13,8 +13,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { Logger } from '@openstapps/logger';
-import { BackendTransport } from './notification/BackendTransport';
+import {Logger} from '@openstapps/logger';
+import {BackendTransport} from './notification/BackendTransport';
export const mailer = BackendTransport.getTransportInstance();
diff --git a/src/notification/MailQueue.ts b/src/notification/MailQueue.ts
index a739b2ed..ed806c8a 100644
--- a/src/notification/MailQueue.ts
+++ b/src/notification/MailQueue.ts
@@ -14,10 +14,10 @@
* along with this program. If not, see .nse along with
* this program. If not, see .
*/
-import { SMTP } from '@openstapps/logger/lib/SMTP';
-import { MailOptions } from 'nodemailer/lib/sendmail-transport';
+import {SMTP} from '@openstapps/logger/lib/SMTP';
+import {MailOptions} from 'nodemailer/lib/sendmail-transport';
import * as Queue from 'promise-queue';
-import { logger } from '../common';
+import {logger} from '../common';
/**
* A queue that can send mails in serial
*/
diff --git a/src/routes/BulkAddRoute.ts b/src/routes/BulkAddRoute.ts
index 9782a717..0fdf01b8 100644
--- a/src/routes/BulkAddRoute.ts
+++ b/src/routes/BulkAddRoute.ts
@@ -13,10 +13,10 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { SCBulkAddRequest, SCBulkAddResponse, SCBulkAddRoute, SCNotFoundErrorResponse } from '@openstapps/core';
-import { logger } from '../common';
-import { BulkStorage } from '../storage/BulkStorage';
-import { createRoute } from './Route';
+import {SCBulkAddRequest, SCBulkAddResponse, SCBulkAddRoute, SCNotFoundErrorResponse} from '@openstapps/core';
+import {logger} from '../common';
+import {BulkStorage} from '../storage/BulkStorage';
+import {createRoute} from './Route';
const bulkRouteModel = new SCBulkAddRoute();
diff --git a/src/routes/BulkDoneRoute.ts b/src/routes/BulkDoneRoute.ts
index 62fab8a6..fab0fb90 100644
--- a/src/routes/BulkDoneRoute.ts
+++ b/src/routes/BulkDoneRoute.ts
@@ -13,10 +13,10 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { SCBulkDoneRequest, SCBulkDoneResponse, SCBulkDoneRoute, SCNotFoundErrorResponse } from '@openstapps/core';
-import { logger } from '../common';
-import { BulkStorage } from '../storage/BulkStorage';
-import { createRoute } from './Route';
+import {SCBulkDoneRequest, SCBulkDoneResponse, SCBulkDoneRoute, SCNotFoundErrorResponse} from '@openstapps/core';
+import {logger} from '../common';
+import {BulkStorage} from '../storage/BulkStorage';
+import {createRoute} from './Route';
const bulkDoneRouteModel = new SCBulkDoneRoute();
diff --git a/src/routes/BulkRoute.ts b/src/routes/BulkRoute.ts
index ad41427b..f5dcf246 100644
--- a/src/routes/BulkRoute.ts
+++ b/src/routes/BulkRoute.ts
@@ -13,9 +13,9 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { SCBulkRequest, SCBulkResponse, SCBulkRoute } from '@openstapps/core';
-import { BulkStorage } from '../storage/BulkStorage';
-import { createRoute } from './Route';
+import {SCBulkRequest, SCBulkResponse, SCBulkRoute} from '@openstapps/core';
+import {BulkStorage} from '../storage/BulkStorage';
+import {createRoute} from './Route';
const bulkRouteModel = new SCBulkRoute();
diff --git a/src/routes/IndexRoute.ts b/src/routes/IndexRoute.ts
index 277b34e5..6292acff 100644
--- a/src/routes/IndexRoute.ts
+++ b/src/routes/IndexRoute.ts
@@ -13,9 +13,9 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { SCConfigFile, SCIndexResponse, SCIndexRoute } from '@openstapps/core';
+import {SCConfigFile, SCIndexResponse, SCIndexRoute} from '@openstapps/core';
import * as config from 'config';
-import { createRoute } from './Route';
+import {createRoute} from './Route';
const indexRouteModel = new SCIndexRoute();
diff --git a/src/routes/MultiSearchRoute.ts b/src/routes/MultiSearchRoute.ts
index ece207b3..0fb762e1 100644
--- a/src/routes/MultiSearchRoute.ts
+++ b/src/routes/MultiSearchRoute.ts
@@ -20,8 +20,8 @@ import {
SCSearchResponse,
SCTooManyRequestsErrorResponse,
} from '@openstapps/core';
-import { BulkStorage } from '../storage/BulkStorage';
-import { createRoute } from './Route';
+import {BulkStorage} from '../storage/BulkStorage';
+import {createRoute} from './Route';
const multiSearchRouteModel = new SCMultiSearchRoute();
diff --git a/src/routes/Route.ts b/src/routes/Route.ts
index 11fbe235..336e6d17 100644
--- a/src/routes/Route.ts
+++ b/src/routes/Route.ts
@@ -19,11 +19,11 @@ import {
SCRoute,
SCValidationErrorResponse,
} from '@openstapps/core';
-import { SCValidator } from '@openstapps/core-validator';
-import { Application, Router } from 'express';
+import {SCValidator} from '@openstapps/core-validator';
+import {Application, Router} from 'express';
import PromiseRouter from 'express-promise-router';
-import { logger } from '../common';
-import { isHttpMethod } from './HTTPTypes';
+import {logger} from '../common';
+import {isHttpMethod} from './HTTPTypes';
/**
* Creates a router from a route class (model of a route) and a handler function which implements the logic
@@ -39,7 +39,7 @@ export function createRoute(
handler: (validatedBody: any, app: Application, params?: { [parameterName: string]: string }) => Promise,
): Router {
// create router
- const router = PromiseRouter({ mergeParams: true });
+ const router = PromiseRouter({mergeParams: true});
// create route
// the given type has no index signature so we have to cast to get the IRouteHandler when a HTTP method is given
diff --git a/src/routes/SearchRoute.ts b/src/routes/SearchRoute.ts
index 1b1aa47a..69b3a695 100644
--- a/src/routes/SearchRoute.ts
+++ b/src/routes/SearchRoute.ts
@@ -13,9 +13,9 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { SCSearchRequest, SCSearchResponse, SCSearchRoute } from '@openstapps/core';
-import { BulkStorage } from '../storage/BulkStorage';
-import { createRoute } from './Route';
+import {SCSearchRequest, SCSearchResponse, SCSearchRoute} from '@openstapps/core';
+import {BulkStorage} from '../storage/BulkStorage';
+import {createRoute} from './Route';
const searchRouteModel = new SCSearchRoute();
diff --git a/src/routes/ThingUpdateRoute.ts b/src/routes/ThingUpdateRoute.ts
index 2b6424e5..d3c58bcb 100644
--- a/src/routes/ThingUpdateRoute.ts
+++ b/src/routes/ThingUpdateRoute.ts
@@ -13,9 +13,9 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { SCThingUpdateRequest, SCThingUpdateResponse, SCThingUpdateRoute } from '@openstapps/core';
-import { BulkStorage } from '../storage/BulkStorage';
-import { createRoute } from './Route';
+import {SCThingUpdateRequest, SCThingUpdateResponse, SCThingUpdateRoute} from '@openstapps/core';
+import {BulkStorage} from '../storage/BulkStorage';
+import {createRoute} from './Route';
const thingUpdateRouteModel = new SCThingUpdateRoute();
diff --git a/src/storage/BulkStorage.ts b/src/storage/BulkStorage.ts
index d5b28c2e..e5866d54 100644
--- a/src/storage/BulkStorage.ts
+++ b/src/storage/BulkStorage.ts
@@ -13,13 +13,13 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { SCBulkRequest, SCThingTypes } from '@openstapps/core';
+import {SCBulkRequest, SCThingTypes} from '@openstapps/core';
import * as moment from 'moment';
import * as NodeCache from 'node-cache';
-import { promisify } from 'util';
-import { v4 } from 'uuid';
-import { logger } from '../common';
-import { Database } from './Database';
+import {promisify} from 'util';
+import {v4} from 'uuid';
+import {logger} from '../common';
+import {Database} from './Database';
export type BulkOperation = 'create' | 'expired' | 'update';
@@ -102,7 +102,7 @@ export class BulkStorage {
// a bulk lives 60 minutes if no expiration is given
// the cache is checked every 60 seconds
- this.cache = new NodeCache({ stdTTL: 3600, checkperiod: 60 });
+ this.cache = new NodeCache({stdTTL: 3600, checkperiod: 60});
this.cache.on('expired', (_key, bulk: Bulk) => {
// if the bulk is not done
diff --git a/src/storage/Database.ts b/src/storage/Database.ts
index b90f8dfa..b68e70c4 100644
--- a/src/storage/Database.ts
+++ b/src/storage/Database.ts
@@ -13,12 +13,10 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { SCSearchQuery, SCSearchResponse, SCThings, SCUuid } from '@openstapps/core';
+import {SCSearchQuery, SCSearchResponse, SCThings, SCUuid} from '@openstapps/core';
import {Bulk} from './BulkStorage';
-export interface DatabaseConstructor {
- new (...args: any): Database;
-}
+export type DatabaseConstructor = new (...args: any) => Database;
export interface Database {
diff --git a/src/storage/elasticsearch/Elasticsearch.ts b/src/storage/elasticsearch/Elasticsearch.ts
index ff4eb83d..3ccea6ec 100644
--- a/src/storage/elasticsearch/Elasticsearch.ts
+++ b/src/storage/elasticsearch/Elasticsearch.ts
@@ -25,15 +25,15 @@ import {
} from '@openstapps/core';
import * as ES from 'elasticsearch';
import * as moment from 'moment';
-import { logger } from '../../common';
-import { MailQueue } from '../../notification/MailQueue';
-import { Bulk } from '../BulkStorage';
-import { Database } from '../Database';
-import { buildAggregations, parseAggregations } from './aggregations';
-import { AggregationSchema, ElasticsearchConfig, ElasticsearchObject } from './common';
+import {logger} from '../../common';
+import {MailQueue} from '../../notification/MailQueue';
+import {Bulk} from '../BulkStorage';
+import {Database} from '../Database';
+import {buildAggregations, parseAggregations} from './aggregations';
+import {AggregationSchema, ElasticsearchConfig, ElasticsearchObject} from './common';
import * as Monitoring from './monitoring';
-import { buildQuery, buildSort } from './query';
-import { putTemplate } from './templating';
+import {buildQuery, buildSort} from './query';
+import {putTemplate} from './templating';
// this will match index names such as stapps___
const indexRegex = /^stapps_([A-z0-9_]+)_([a-z0-9-_]+)_([-a-z0-9^_]+)$/;
@@ -276,7 +276,7 @@ export class Elasticsearch implements Database {
// don't delete indices that are in use already
if (bulk.state !== 'done') {
logger.info('deleting obsolete index', index);
- return await this.client.indices.delete({ index });
+ return await this.client.indices.delete({index});
}
}
@@ -309,7 +309,7 @@ export class Elasticsearch implements Database {
}
// create the new index if it does not exists
- if (!(await this.client.indices.exists({ index }))) {
+ if (!(await this.client.indices.exists({index}))) {
// re-apply the index template before each new bulk operation
await putTemplate(this.client);
await this.client.indices.create({
@@ -323,14 +323,14 @@ export class Elasticsearch implements Database {
// add our new index to the alias
const actions: ES.IndicesUpdateAliasesParamsAction[] = [
{
- add: { index: index, alias: alias },
+ add: {index: index, alias: alias},
},
];
// remove our old index if it exists
if (typeof oldIndex === 'string') {
actions.push({
- remove: { index: oldIndex, alias: alias },
+ remove: {index: oldIndex, alias: alias},
});
}
@@ -350,7 +350,7 @@ export class Elasticsearch implements Database {
this.aliasMap[alias][bulk.source] = index;
if (typeof oldIndex === 'string') {
// delete the old index
- await this.client.indices.delete({ index: oldIndex });
+ await this.client.indices.delete({index: oldIndex});
logger.info('deleted old index', oldIndex);
}
logger.info('swapped alias index alias', oldIndex, '=>', index);
diff --git a/src/storage/elasticsearch/aggregations.ts b/src/storage/elasticsearch/aggregations.ts
index a73b4163..8720ebf5 100644
--- a/src/storage/elasticsearch/aggregations.ts
+++ b/src/storage/elasticsearch/aggregations.ts
@@ -13,8 +13,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { SCBackendAggregationConfiguration, SCFacet, SCThingTypes } from '@openstapps/core';
-import { AggregationSchema } from './common';
+import {SCBackendAggregationConfiguration, SCFacet, SCThingTypes} from '@openstapps/core';
+import {AggregationSchema} from './common';
export type aggregationType = SCThingTypes | '@all';
diff --git a/src/storage/elasticsearch/common.ts b/src/storage/elasticsearch/common.ts
index 1a9143da..b2aa9762 100644
--- a/src/storage/elasticsearch/common.ts
+++ b/src/storage/elasticsearch/common.ts
@@ -13,8 +13,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-import { SCThingTypes } from '@openstapps/core';
-import { SCThing } from '@openstapps/core';
+import {SCThingTypes} from '@openstapps/core';
+import {SCThing} from '@openstapps/core';
/**
* An elasticsearch bucket aggregation
diff --git a/src/storage/elasticsearch/monitoring.ts b/src/storage/elasticsearch/monitoring.ts
index 89fc5163..97cf1834 100644
--- a/src/storage/elasticsearch/monitoring.ts
+++ b/src/storage/elasticsearch/monitoring.ts
@@ -22,8 +22,8 @@ import {
} from '@openstapps/core';
import * as ES from 'elasticsearch';
import * as cron from 'node-cron';
-import { logger } from '../../common';
-import { MailQueue } from '../../notification/MailQueue';
+import {logger} from '../../common';
+import {MailQueue} from '../../notification/MailQueue';
/**
* Check if the given condition fails on the given number of results and the condition
diff --git a/src/storage/elasticsearch/query.ts b/src/storage/elasticsearch/query.ts
index c66c38b4..b8ef936d 100644
--- a/src/storage/elasticsearch/query.ts
+++ b/src/storage/elasticsearch/query.ts
@@ -24,7 +24,7 @@ import {
SCThingsField,
SCThingTypes,
} from '@openstapps/core';
-import { ElasticsearchConfig, ScriptSort } from './common';
+import {ElasticsearchConfig, ScriptSort} from './common';
import {
ESBooleanFilter,
ESBooleanFilterArguments,
diff --git a/src/storage/elasticsearch/templating.ts b/src/storage/elasticsearch/templating.ts
index 11297aa7..d8c1635c 100644
--- a/src/storage/elasticsearch/templating.ts
+++ b/src/storage/elasticsearch/templating.ts
@@ -15,8 +15,8 @@
*/
import {Client} from 'elasticsearch';
import {readdir, readFile} from 'fs-extra';
-import { resolve } from 'path';
-import { logger } from '../../common';
+import {resolve} from 'path';
+import {logger} from '../../common';
/**
* Assembles an elasticsearch template with all resolved subType-references