anote-server-libs 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ {
2
+ "typescript.tsdk": "node_modules\\typescript\\lib"
3
+ }
package/models/ApiCall.js CHANGED
@@ -4,6 +4,9 @@ exports.ApiCallRepository = void 0;
4
4
  const mssql_1 = require("mssql");
5
5
  const ModelDao_1 = require("./repository/ModelDao");
6
6
  class ApiCallRepository extends ModelDao_1.ModelDao {
7
+ pool;
8
+ poolMssql;
9
+ logger;
7
10
  constructor(pool, poolMssql, logger) {
8
11
  super(pool, poolMssql, logger, 'api_call', 5, pool ? 'id=$1,"updatedOn"=$2,"responseCode"=$3,"responseJson"=$4,"expiresAt"=$5' :
9
12
  'id=@1,"updatedOn"=@2,"responseCode"=@3,"responseJson"=@4,"expiresAt"=@5');
package/models/ApiCall.ts CHANGED
@@ -1,40 +1,40 @@
1
- import { ConnectionPool, DateTimeOffset, Request } from 'mssql';
2
- import {Pool} from 'pg';
3
- import {Logger} from 'winston';
4
- import {Model, ModelDao} from './repository/ModelDao';
5
-
6
- export interface ApiCall extends Model<string> {
7
- responseCode: number;
8
- responseJson: string;
9
- expiresAt: Date;
10
- }
11
-
12
- export class ApiCallRepository extends ModelDao<string, ApiCall> {
13
- constructor(protected pool: Pool, protected poolMssql: ConnectionPool, protected logger: Logger) {
14
- super(pool, poolMssql, logger, 'api_call', 5, pool ? 'id=$1,"updatedOn"=$2,"responseCode"=$3,"responseJson"=$4,"expiresAt"=$5' :
15
- 'id=@1,"updatedOn"=@2,"responseCode"=@3,"responseJson"=@4,"expiresAt"=@5');
16
- }
17
-
18
- buildObject(q: any): ApiCall {
19
- if(!q) return undefined;
20
- q.id = q.id.trim();
21
- q.updatedOn = q.updatedOn && new Date(q.updatedOn);
22
- q.responseCode = parseInt(q.responseCode, 10);
23
- q.expiresAt = q.expiresAt && new Date(q.expiresAt);
24
- return q;
25
- }
26
-
27
- serialize(instance: ApiCall, request?: Request) {
28
- if(request) {
29
- request.input('1', instance.id);
30
- request.input('2', DateTimeOffset, instance.updatedOn);
31
- request.input('3', instance.responseCode);
32
- request.input('4', instance.responseJson);
33
- request.input('5', DateTimeOffset, instance.expiresAt);
34
- return undefined;
35
- } else {
36
- return [instance.id, instance.updatedOn, instance.responseCode, instance.responseJson, instance.expiresAt];
37
- }
38
- }
39
-
40
- }
1
+ import { ConnectionPool, DateTimeOffset, Request } from 'mssql';
2
+ import {Pool} from 'pg';
3
+ import {Logger} from 'winston';
4
+ import {Model, ModelDao} from './repository/ModelDao';
5
+
6
+ export interface ApiCall extends Model<string> {
7
+ responseCode: number;
8
+ responseJson: string;
9
+ expiresAt: Date;
10
+ }
11
+
12
+ export class ApiCallRepository extends ModelDao<string, ApiCall> {
13
+ constructor(protected pool: Pool, protected poolMssql: ConnectionPool, protected logger: Logger) {
14
+ super(pool, poolMssql, logger, 'api_call', 5, pool ? 'id=$1,"updatedOn"=$2,"responseCode"=$3,"responseJson"=$4,"expiresAt"=$5' :
15
+ 'id=@1,"updatedOn"=@2,"responseCode"=@3,"responseJson"=@4,"expiresAt"=@5');
16
+ }
17
+
18
+ buildObject(q: any): ApiCall {
19
+ if(!q) return undefined;
20
+ q.id = q.id.trim();
21
+ q.updatedOn = q.updatedOn && new Date(q.updatedOn);
22
+ q.responseCode = parseInt(q.responseCode, 10);
23
+ q.expiresAt = q.expiresAt && new Date(q.expiresAt);
24
+ return q;
25
+ }
26
+
27
+ serialize(instance: ApiCall, request?: Request) {
28
+ if(request) {
29
+ request.input('1', instance.id);
30
+ request.input('2', DateTimeOffset, instance.updatedOn);
31
+ request.input('3', instance.responseCode);
32
+ request.input('4', instance.responseJson);
33
+ request.input('5', DateTimeOffset, instance.expiresAt);
34
+ return undefined;
35
+ } else {
36
+ return [instance.id, instance.updatedOn, instance.responseCode, instance.responseJson, instance.expiresAt];
37
+ }
38
+ }
39
+
40
+ }
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MigrationRepository = void 0;
4
4
  const ModelDao_1 = require("./repository/ModelDao");
5
5
  class MigrationRepository extends ModelDao_1.ModelDao {
6
+ pool;
7
+ poolMssql;
8
+ logger;
6
9
  constructor(pool, poolMssql, logger) {
7
10
  super(pool, poolMssql, logger, 'migration', 5, pool ? 'id=$1,hash=$2,"sqlUp"=$3,"sqlDown"=$4,state=$5' :
8
11
  'id=@1,hash=@2,"sqlUp"=@3,"sqlDown"=@4,state=@5');
@@ -1,40 +1,40 @@
1
- import { ConnectionPool, Request } from 'mssql';
2
- import {Pool} from 'pg';
3
- import {Logger} from 'winston';
4
- import {ModelDao} from './repository/ModelDao';
5
-
6
- export interface Migration {
7
- id: number;
8
- hash: string;
9
- sqlUp: string;
10
- sqlDown: string;
11
- state: number;
12
- }
13
-
14
- export class MigrationRepository extends ModelDao<number, Migration> {
15
- constructor(protected pool: Pool, protected poolMssql: ConnectionPool, protected logger: Logger) {
16
- super(pool, poolMssql, logger, 'migration', 5, pool ? 'id=$1,hash=$2,"sqlUp"=$3,"sqlDown"=$4,state=$5' :
17
- 'id=@1,hash=@2,"sqlUp"=@3,"sqlDown"=@4,state=@5');
18
- }
19
-
20
- buildObject(q: any): Migration {
21
- if(!q) return undefined;
22
- q.id = parseInt(q.id, 10);
23
- q.hash = q.hash.trim();
24
- q.state = parseInt(q.state, 10);
25
- return q;
26
- }
27
-
28
- serialize(instance: Migration, request?: Request) {
29
- if(request) {
30
- request.input('1', instance.id);
31
- request.input('2', instance.hash);
32
- request.input('3', instance.sqlUp);
33
- request.input('4', instance.sqlDown);
34
- request.input('5', instance.state);
35
- return undefined;
36
- } else {
37
- return [instance.id, instance.hash, instance.sqlUp, instance.sqlDown, instance.state];
38
- }
39
- }
40
- }
1
+ import { ConnectionPool, Request } from 'mssql';
2
+ import {Pool} from 'pg';
3
+ import {Logger} from 'winston';
4
+ import {ModelDao} from './repository/ModelDao';
5
+
6
+ export interface Migration {
7
+ id: number;
8
+ hash: string;
9
+ sqlUp: string;
10
+ sqlDown: string;
11
+ state: number;
12
+ }
13
+
14
+ export class MigrationRepository extends ModelDao<number, Migration> {
15
+ constructor(protected pool: Pool, protected poolMssql: ConnectionPool, protected logger: Logger) {
16
+ super(pool, poolMssql, logger, 'migration', 5, pool ? 'id=$1,hash=$2,"sqlUp"=$3,"sqlDown"=$4,state=$5' :
17
+ 'id=@1,hash=@2,"sqlUp"=@3,"sqlDown"=@4,state=@5');
18
+ }
19
+
20
+ buildObject(q: any): Migration {
21
+ if(!q) return undefined;
22
+ q.id = parseInt(q.id, 10);
23
+ q.hash = q.hash.trim();
24
+ q.state = parseInt(q.state, 10);
25
+ return q;
26
+ }
27
+
28
+ serialize(instance: Migration, request?: Request) {
29
+ if(request) {
30
+ request.input('1', instance.id);
31
+ request.input('2', instance.hash);
32
+ request.input('3', instance.sqlUp);
33
+ request.input('4', instance.sqlDown);
34
+ request.input('5', instance.state);
35
+ return undefined;
36
+ } else {
37
+ return [instance.id, instance.hash, instance.sqlUp, instance.sqlDown, instance.state];
38
+ }
39
+ }
40
+ }
@@ -6,6 +6,13 @@ const fs = require("fs");
6
6
  const ApiCall_1 = require("../ApiCall");
7
7
  const Migration_1 = require("../Migration");
8
8
  class BaseModelRepository {
9
+ db;
10
+ dbSpare;
11
+ dbMssql;
12
+ logger;
13
+ cache;
14
+ Migration;
15
+ ApiCall;
9
16
  constructor(db, dbSpare, dbMssql, logger, cache) {
10
17
  this.db = db;
11
18
  this.dbSpare = dbSpare;
@@ -1,152 +1,152 @@
1
- import * as crypto from 'crypto';
2
- import * as fs from 'fs';
3
- import * as Memcached from 'memcached';
4
- import {ConnectionPool, Transaction} from 'mssql';
5
- import {ClientBase, Pool} from 'pg';
6
- import {Logger} from 'winston';
7
- import { ApiCallRepository } from '../ApiCall';
8
- import { Migration, MigrationRepository } from '../Migration';
9
- import {ModelRepr} from './ModelDao';
10
-
11
- export class BaseModelRepository {
12
- Migration: MigrationRepository;
13
- ApiCall: ApiCallRepository;
14
-
15
- constructor(public db: Pool, public dbSpare: Pool, public dbMssql: ConnectionPool, public logger: Logger, public cache: Memcached) {
16
- if(db && dbSpare) {
17
- const dbQuery = db.query.bind(db);
18
- db.query = (function(text: any, values: any, cb: any) {
19
- if((this.idleCount + this.waitingCount) >= this.totalCount && this.totalCount === this.options.max)
20
- return dbSpare.query(text, values, cb);
21
- return dbQuery(text, values, cb);
22
- }).bind(db);
23
- }
24
- this.Migration = new MigrationRepository(db, dbMssql, logger);
25
- this.ApiCall = new ApiCallRepository(db, dbMssql, logger);
26
- }
27
-
28
- migrate(migrationsPath: string, callback: (() => void), onlyAboveOrEquals = 0) {
29
- (this.db ? this.db.query('CREATE TABLE IF NOT EXISTS migration (' +
30
- 'id integer PRIMARY KEY,' +
31
- 'hash text NOT NULL,' +
32
- '"sqlUp" text NOT NULL,' +
33
- '"sqlDown" text NOT NULL,' +
34
- 'state integer NOT NULL' +
35
- ')') : this.dbMssql.query('if not exists (select * from sysobjects where name=\'migration\' and xtype=\'U\') CREATE TABLE migration (' +
36
- 'id int PRIMARY KEY,' +
37
- 'hash text NOT NULL,' +
38
- '"sqlUp" text NOT NULL,' +
39
- '"sqlDown" text NOT NULL,' +
40
- 'state int NOT NULL' +
41
- ')')).then(() => {
42
- this.Migration.getAllBy('id').then((migrations: Migration[]) => {
43
- if(migrations.find(migration => migration.state !== 0)) process.exit(4); // Have to fix manually
44
- // Read the new ones
45
- fs.readdir(migrationsPath, (_, files) => {
46
- const migrationsAvailable = files
47
- .filter(file => /[0-9]+\.sql/.test(file))
48
- .map(file => parseInt(file.split('.sql')[0], 10))
49
- .filter(file => file > 0)
50
- .sort((a, b) => a - b)
51
- .map(file => {
52
- const content = fs.readFileSync(migrationsPath + file + '.sql', 'utf-8');
53
- return {
54
- id: file,
55
- content: content,
56
- hash: crypto.createHash('sha256').update(content).digest('hex')
57
- };
58
- });
59
- if(migrationsAvailable.length === 0
60
- || migrationsAvailable.length
61
- !== migrationsAvailable[migrationsAvailable.length - 1].id) process.exit(5); // Did not use OK files
62
- let highestCommon = onlyAboveOrEquals;
63
- while(highestCommon < migrations.length && highestCommon < migrationsAvailable.length
64
- && migrations[highestCommon].hash === migrationsAvailable[highestCommon].hash)
65
- highestCommon++;
66
- this.applyDownUntil(migrations, migrations.length, highestCommon).then(() => {
67
- this.applyUpUntil(migrationsAvailable, Math.min(highestCommon, migrations.length), migrationsAvailable.length).then(callback, process.exit);
68
- }, process.exit);
69
- });
70
- }, () => process.exit(3));
71
- }, () => process.exit(2));
72
- }
73
-
74
- lockTables(tables: ModelRepr[], client: ClientBase | Transaction): Promise<any> {
75
- if(this.db)
76
- return Promise.all(tables.map(t => (<ClientBase>client).query('LOCK TABLE ' + t.table + ' IN EXCLUSIVE MODE')));
77
- return Promise.all(tables.map(t => (<Transaction>client).request().query('SELECT id FROM ' + t.table + ' WITH (UPDLOCK)')));
78
- }
79
-
80
- private applyUpUntil(migrations: {id: number, content: string, hash: string}[], current: number, until: number): Promise<void> {
81
- if(current < until)
82
- return this.applyUp(migrations[current]).then(() => this.applyUpUntil(migrations, current + 1, until));
83
- return Promise.resolve();
84
- }
85
-
86
- private applyUp(migration: {id: number, content: string, hash: string}): Promise<void> {
87
- return new Promise((resolve, reject) => {
88
- const sqlParts = migration.content.split('----');
89
- this.Migration.create({
90
- id: migration.id,
91
- hash: migration.hash,
92
- sqlUp: sqlParts[0],
93
- sqlDown: sqlParts[1],
94
- state: 2
95
- }).then(() => {
96
- (<any>(this.db|| this.dbMssql)).query(sqlParts[0], (err: any) => {
97
- if(err) {
98
- console.error(err);
99
- reject(10);
100
- } else {
101
- (<any>(this.db|| this.dbMssql)).query('UPDATE "migration" SET "state"=0 WHERE "id"=' + migration.id, (err2: any) => {
102
- if(err2) reject(11); // No cleanup
103
- else resolve();
104
- });
105
- }
106
- });
107
- }, () => process.exit(9));
108
- });
109
- }
110
-
111
- private applyDownUntil(migrations: Migration[], current: number, until: number): Promise<void> {
112
- if(current > until) {
113
- current--;
114
- return this.applyDown(migrations[current]).then(() => this.applyDownUntil(migrations, current, until));
115
- }
116
- return Promise.resolve();
117
- }
118
-
119
- private applyDown(migration: Migration): Promise<void> {
120
- return new Promise((resolve, reject) => {
121
- (<any>(this.db|| this.dbMssql)).query('UPDATE "migration" SET "state"=1 WHERE "id"=' + migration.id, (err: any) => {
122
- if(err) reject(6); // No required change
123
- else (<any>(this.db|| this.dbMssql)).query(migration.sqlDown, (err2: any) => {
124
- if(err2) {
125
- console.error(err2);
126
- reject(7);
127
- } // No apply down
128
- else (<any>(this.db|| this.dbMssql)).query('DELETE FROM "migration" WHERE "id"=' + migration.id, (err3: any) => {
129
- if(err3 && migration.id !== 1) reject(8); // No cleanup for not base migration
130
- else {
131
- if(migration.id === 1) {
132
- (this.db ? this.db.query('CREATE TABLE IF NOT EXISTS migration (' +
133
- 'id integer PRIMARY KEY,' +
134
- 'hash text NOT NULL,' +
135
- '"sqlUp" text NOT NULL,' +
136
- '"sqlDown" text NOT NULL,' +
137
- 'state integer NOT NULL' +
138
- ')') : this.dbMssql.query('if not exists (select * from sysobjects where name=\'migration\' and xtype=\'U\') CREATE TABLE migration (' +
139
- 'id int PRIMARY KEY,' +
140
- 'hash text NOT NULL,' +
141
- '"sqlUp" text NOT NULL,' +
142
- '"sqlDown" text NOT NULL,' +
143
- 'state int NOT NULL' +
144
- ')')).then(() => resolve(), reject);
145
- } else resolve();
146
- }
147
- });
148
- });
149
- });
150
- });
151
- }
152
- }
1
+ import * as crypto from 'crypto';
2
+ import * as fs from 'fs';
3
+ import * as Memcached from 'memcached';
4
+ import {ConnectionPool, Transaction} from 'mssql';
5
+ import {ClientBase, Pool} from 'pg';
6
+ import {Logger} from 'winston';
7
+ import { ApiCallRepository } from '../ApiCall';
8
+ import { Migration, MigrationRepository } from '../Migration';
9
+ import {ModelRepr} from './ModelDao';
10
+
11
+ export class BaseModelRepository {
12
+ Migration: MigrationRepository;
13
+ ApiCall: ApiCallRepository;
14
+
15
+ constructor(public db: Pool, public dbSpare: Pool, public dbMssql: ConnectionPool, public logger: Logger, public cache: Memcached) {
16
+ if(db && dbSpare) {
17
+ const dbQuery = db.query.bind(db);
18
+ db.query = (function(text: any, values: any, cb: any) {
19
+ if((this.idleCount + this.waitingCount) >= this.totalCount && this.totalCount === this.options.max)
20
+ return dbSpare.query(text, values, cb);
21
+ return dbQuery(text, values, cb);
22
+ }).bind(db);
23
+ }
24
+ this.Migration = new MigrationRepository(db, dbMssql, logger);
25
+ this.ApiCall = new ApiCallRepository(db, dbMssql, logger);
26
+ }
27
+
28
+ migrate(migrationsPath: string, callback: (() => void), onlyAboveOrEquals = 0) {
29
+ (this.db ? this.db.query('CREATE TABLE IF NOT EXISTS migration (' +
30
+ 'id integer PRIMARY KEY,' +
31
+ 'hash text NOT NULL,' +
32
+ '"sqlUp" text NOT NULL,' +
33
+ '"sqlDown" text NOT NULL,' +
34
+ 'state integer NOT NULL' +
35
+ ')') : this.dbMssql.query('if not exists (select * from sysobjects where name=\'migration\' and xtype=\'U\') CREATE TABLE migration (' +
36
+ 'id int PRIMARY KEY,' +
37
+ 'hash text NOT NULL,' +
38
+ '"sqlUp" text NOT NULL,' +
39
+ '"sqlDown" text NOT NULL,' +
40
+ 'state int NOT NULL' +
41
+ ')')).then(() => {
42
+ this.Migration.getAllBy('id').then((migrations: Migration[]) => {
43
+ if(migrations.find(migration => migration.state !== 0)) process.exit(4); // Have to fix manually
44
+ // Read the new ones
45
+ fs.readdir(migrationsPath, (_, files) => {
46
+ const migrationsAvailable = files
47
+ .filter(file => /[0-9]+\.sql/.test(file))
48
+ .map(file => parseInt(file.split('.sql')[0], 10))
49
+ .filter(file => file > 0)
50
+ .sort((a, b) => a - b)
51
+ .map(file => {
52
+ const content = fs.readFileSync(migrationsPath + file + '.sql', 'utf-8');
53
+ return {
54
+ id: file,
55
+ content: content,
56
+ hash: crypto.createHash('sha256').update(content).digest('hex')
57
+ };
58
+ });
59
+ if(migrationsAvailable.length === 0
60
+ || migrationsAvailable.length
61
+ !== migrationsAvailable[migrationsAvailable.length - 1].id) process.exit(5); // Did not use OK files
62
+ let highestCommon = onlyAboveOrEquals;
63
+ while(highestCommon < migrations.length && highestCommon < migrationsAvailable.length
64
+ && migrations[highestCommon].hash === migrationsAvailable[highestCommon].hash)
65
+ highestCommon++;
66
+ this.applyDownUntil(migrations, migrations.length, highestCommon).then(() => {
67
+ this.applyUpUntil(migrationsAvailable, Math.min(highestCommon, migrations.length), migrationsAvailable.length).then(callback, process.exit);
68
+ }, process.exit);
69
+ });
70
+ }, () => process.exit(3));
71
+ }, () => process.exit(2));
72
+ }
73
+
74
+ lockTables(tables: ModelRepr[], client: ClientBase | Transaction): Promise<any> {
75
+ if(this.db)
76
+ return Promise.all(tables.map(t => (<ClientBase>client).query('LOCK TABLE ' + t.table + ' IN EXCLUSIVE MODE')));
77
+ return Promise.all(tables.map(t => (<Transaction>client).request().query('SELECT id FROM ' + t.table + ' WITH (UPDLOCK)')));
78
+ }
79
+
80
+ private applyUpUntil(migrations: {id: number, content: string, hash: string}[], current: number, until: number): Promise<void> {
81
+ if(current < until)
82
+ return this.applyUp(migrations[current]).then(() => this.applyUpUntil(migrations, current + 1, until));
83
+ return Promise.resolve();
84
+ }
85
+
86
+ private applyUp(migration: {id: number, content: string, hash: string}): Promise<void> {
87
+ return new Promise((resolve, reject) => {
88
+ const sqlParts = migration.content.split('----');
89
+ this.Migration.create({
90
+ id: migration.id,
91
+ hash: migration.hash,
92
+ sqlUp: sqlParts[0],
93
+ sqlDown: sqlParts[1],
94
+ state: 2
95
+ }).then(() => {
96
+ (<any>(this.db|| this.dbMssql)).query(sqlParts[0], (err: any) => {
97
+ if(err) {
98
+ console.error(err);
99
+ reject(10);
100
+ } else {
101
+ (<any>(this.db|| this.dbMssql)).query('UPDATE "migration" SET "state"=0 WHERE "id"=' + migration.id, (err2: any) => {
102
+ if(err2) reject(11); // No cleanup
103
+ else resolve();
104
+ });
105
+ }
106
+ });
107
+ }, () => process.exit(9));
108
+ });
109
+ }
110
+
111
+ private applyDownUntil(migrations: Migration[], current: number, until: number): Promise<void> {
112
+ if(current > until) {
113
+ current--;
114
+ return this.applyDown(migrations[current]).then(() => this.applyDownUntil(migrations, current, until));
115
+ }
116
+ return Promise.resolve();
117
+ }
118
+
119
+ private applyDown(migration: Migration): Promise<void> {
120
+ return new Promise((resolve, reject) => {
121
+ (<any>(this.db|| this.dbMssql)).query('UPDATE "migration" SET "state"=1 WHERE "id"=' + migration.id, (err: any) => {
122
+ if(err) reject(6); // No required change
123
+ else (<any>(this.db|| this.dbMssql)).query(migration.sqlDown, (err2: any) => {
124
+ if(err2) {
125
+ console.error(err2);
126
+ reject(7);
127
+ } // No apply down
128
+ else (<any>(this.db|| this.dbMssql)).query('DELETE FROM "migration" WHERE "id"=' + migration.id, (err3: any) => {
129
+ if(err3 && migration.id !== 1) reject(8); // No cleanup for not base migration
130
+ else {
131
+ if(migration.id === 1) {
132
+ (this.db ? this.db.query('CREATE TABLE IF NOT EXISTS migration (' +
133
+ 'id integer PRIMARY KEY,' +
134
+ 'hash text NOT NULL,' +
135
+ '"sqlUp" text NOT NULL,' +
136
+ '"sqlDown" text NOT NULL,' +
137
+ 'state integer NOT NULL' +
138
+ ')') : this.dbMssql.query('if not exists (select * from sysobjects where name=\'migration\' and xtype=\'U\') CREATE TABLE migration (' +
139
+ 'id int PRIMARY KEY,' +
140
+ 'hash text NOT NULL,' +
141
+ '"sqlUp" text NOT NULL,' +
142
+ '"sqlDown" text NOT NULL,' +
143
+ 'state int NOT NULL' +
144
+ ')')).then(() => resolve(), reject);
145
+ } else resolve();
146
+ }
147
+ });
148
+ });
149
+ });
150
+ });
151
+ }
152
+ }
@@ -2,10 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MemoryCache = void 0;
4
4
  class MemoryCache {
5
+ localKey;
6
+ cache;
7
+ localCache = {};
5
8
  constructor(localKey, cache) {
6
9
  this.localKey = localKey;
7
10
  this.cache = cache;
8
- this.localCache = {};
9
11
  }
10
12
  list() {
11
13
  if (this.cache)