@samet-it/be-db-common 1.1.2 → 1.1.3

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.
@@ -1,4 +1,4 @@
1
- import { DbConnectionLike, DbExecOpt, DbQueryResultMore, DbQueryResultOne, DbConnOpt, DbMeta, DbOnAfter, DbConnProps, DbRepoLink } from "./index.types";
1
+ import { DbConnectionLike, DbExecOpt, DbQueryResultMore, DbQueryResultOne, DbConnOpt, DbMeta, DbOnAfter, DbConnProps, DbRepoLink, DbEvent } from "./index.types";
2
2
  import { LoggerLike } from "@samet-it/be-base-common";
3
3
  import type { DbLines } from "../line";
4
4
  import type { Opt } from "@leyyo/common";
@@ -31,12 +31,34 @@ export declare abstract class DbConnection<LINK extends DbRepoLink, META extends
31
31
  * @see _opt
32
32
  * */
33
33
  protected _props: DbConnProps;
34
+ /**
35
+ * Constructor
36
+ *
37
+ * @param {DbConnOpt} opt - options
38
+ * */
34
39
  protected constructor(opt?: DbConnOpt);
35
- checkError(err: Error, opt: DbExecOpt | Opt): void;
36
- protected _on(items: Array<DbOnAfter>, fn: DbOnAfter, throwable: boolean): void;
40
+ /**
41
+ * Add or instantly trigger new lambda
42
+ *
43
+ * @param {DbEvent} name - event name
44
+ * @param {Array<function>} items - existing callback function array
45
+ * @param {function} fn - callback function
46
+ * @param {boolean?} throwable - throw an error if it fails
47
+ * */
48
+ protected _on(name: DbEvent, items: Array<DbOnAfter>, fn: DbOnAfter, throwable: boolean): void;
49
+ /**
50
+ * Trigger after on case
51
+ *
52
+ * @param {DbEvent} name - event name
53
+ * @param {Array<DbOnAfter>} items - callback functions
54
+ * @param {boolean} throwable - throwable? yes: throw the error
55
+ * */
56
+ protected _triggerOnCase(name: DbEvent, items: Array<DbOnAfter>, throwable: boolean): void;
37
57
  /** {@inheritDoc} */
38
58
  get props(): Readonly<DbConnProps>;
39
59
  /** {@inheritDoc} */
60
+ checkError(err: Error, opt: DbExecOpt | Opt): void;
61
+ /** {@inheritDoc} */
40
62
  f(field: string): string;
41
63
  /** {@inheritDoc} */
42
64
  abstract field(field: string): string;
@@ -19,6 +19,11 @@ const error_1 = require("../error");
19
19
  * */
20
20
  class DbConnection {
21
21
  // endregion protected-property
22
+ /**
23
+ * Constructor
24
+ *
25
+ * @param {DbConnOpt} opt - options
26
+ * */
22
27
  constructor(opt) {
23
28
  /**
24
29
  * On connected callbacks
@@ -46,29 +51,15 @@ class DbConnection {
46
51
  delete this._opt;
47
52
  }
48
53
  // region protected-method
49
- checkError(err, opt) {
50
- var _a, _b, _c;
51
- const size = be_base_common_1.errorHandler.addStat(err);
52
- if ((_a = opt === null || opt === void 0 ? void 0 : opt.ignoredErrors) === null || _a === void 0 ? void 0 : _a.includes(err.name)) {
53
- return;
54
- }
55
- if (opt === null || opt === void 0 ? void 0 : opt.silent) {
56
- if (size < 100) {
57
- this.logger.warn(`[${size}] ${(_b = opt.name) !== null && _b !== void 0 ? _b : 'Database error'} <${err.name}> ${err.message}`, err);
58
- }
59
- return;
60
- }
61
- if (size < 100) {
62
- this.logger.error(`[${size}] ${(_c = opt.name) !== null && _c !== void 0 ? _c : 'Database error'} <${err.name}> ${err.message}`, err);
63
- }
64
- if (err instanceof error_1.DbError) {
65
- throw err;
66
- }
67
- else {
68
- throw be_base_common_1.errorHandler.common.castForClass(error_1.DbError, err, { queryName: opt.name });
69
- }
70
- }
71
- _on(items, fn, throwable) {
54
+ /**
55
+ * Add or instantly trigger new lambda
56
+ *
57
+ * @param {DbEvent} name - event name
58
+ * @param {Array<function>} items - existing callback function array
59
+ * @param {function} fn - callback function
60
+ * @param {boolean?} throwable - throw an error if it fails
61
+ * */
62
+ _on(name, items, fn, throwable) {
72
63
  if (typeof fn !== 'function') {
73
64
  return;
74
65
  }
@@ -77,13 +68,32 @@ class DbConnection {
77
68
  }
78
69
  else {
79
70
  fn().then().catch(e => {
80
- this.logger.error(`[${e.name}] => ${e.message}`, e);
71
+ this.logger.warn(be_base_common_1.errorHandler.common.logText(e, 'on', name));
81
72
  if (throwable) {
82
73
  throw e;
83
74
  }
84
75
  });
85
76
  }
86
77
  }
78
+ /**
79
+ * Trigger after on case
80
+ *
81
+ * @param {DbEvent} name - event name
82
+ * @param {Array<DbOnAfter>} items - callback functions
83
+ * @param {boolean} throwable - throwable? yes: throw the error
84
+ * */
85
+ _triggerOnCase(name, items, throwable) {
86
+ if (items.length > 0) {
87
+ items.forEach(fn => {
88
+ fn().then().catch(e => {
89
+ this.logger.warn(be_base_common_1.errorHandler.common.logText(e, 'trigger', 'on', name));
90
+ if (throwable) {
91
+ throw e;
92
+ }
93
+ });
94
+ });
95
+ }
96
+ }
87
97
  // endregion protected-method
88
98
  // region getter
89
99
  /** {@inheritDoc} */
@@ -93,6 +103,29 @@ class DbConnection {
93
103
  // endregion getter
94
104
  // region field-value
95
105
  /** {@inheritDoc} */
106
+ checkError(err, opt) {
107
+ var _a, _b, _c;
108
+ const size = be_base_common_1.errorHandler.addStat(err);
109
+ if ((_a = opt === null || opt === void 0 ? void 0 : opt.ignoredErrors) === null || _a === void 0 ? void 0 : _a.includes(err.name)) {
110
+ return;
111
+ }
112
+ if (opt === null || opt === void 0 ? void 0 : opt.silent) {
113
+ if (size < 100) {
114
+ this.logger.warn(be_base_common_1.errorHandler.common.logText(err, ((_b = opt.name) !== null && _b !== void 0 ? _b : 'Database error'), size));
115
+ }
116
+ return;
117
+ }
118
+ if (size < 100) {
119
+ this.logger.error(be_base_common_1.errorHandler.common.logText(err, ((_c = opt.name) !== null && _c !== void 0 ? _c : 'Database error'), size));
120
+ }
121
+ if (err instanceof error_1.DbError) {
122
+ throw err;
123
+ }
124
+ else {
125
+ throw be_base_common_1.errorHandler.common.castForClass(error_1.DbError, err, { queryName: opt.name });
126
+ }
127
+ }
128
+ /** {@inheritDoc} */
96
129
  f(field) {
97
130
  return this.field(field);
98
131
  }
@@ -135,15 +168,15 @@ class DbConnection {
135
168
  // region callback
136
169
  /** {@inheritDoc} */
137
170
  onConnected(fn) {
138
- this._on(this._onConnected, fn, false);
171
+ this._on('connected', this._onConnected, fn, false);
139
172
  }
140
173
  /** {@inheritDoc} */
141
174
  onDisconnected(fn) {
142
- this._on(this._onDisconnected, fn, false);
175
+ this._on('disconnected', this._onDisconnected, fn, false);
143
176
  }
144
177
  /** {@inheritDoc} */
145
178
  onFirstConnected(fn) {
146
- this._on(this._onFirstConnected, fn, true);
179
+ this._on('first-connected', this._onFirstConnected, fn, true);
147
180
  }
148
181
  // endregion callback
149
182
  // region query
@@ -1,5 +1,14 @@
1
1
  import type { Opt } from "@leyyo/common";
2
2
  import { DbError } from "./db.error";
3
+ /**
4
+ * DB execute error during run sql
5
+ * */
3
6
  export declare class DbExecuteError extends DbError {
4
- constructor(err: Error, name: string, sql: string, opt?: Opt);
7
+ /**
8
+ * @param {Error} err - error instance
9
+ * @param {string} name - query name
10
+ * @param {string} sql - sql script
11
+ * @param {Opt} params - parameters
12
+ * */
13
+ constructor(err: Error, name: string, sql: string, params?: Opt);
5
14
  }
@@ -2,9 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DbExecuteError = void 0;
4
4
  const db_error_1 = require("./db.error");
5
+ // noinspection JSUnusedGlobalSymbols
6
+ /**
7
+ * DB execute error during run sql
8
+ * */
5
9
  class DbExecuteError extends db_error_1.DbError {
6
- constructor(err, name, sql, opt) {
7
- super(`${name ? name + ' : ' : ''}<${err.name}> ${err.message}`, Object.assign(Object.assign({}, opt), { sql, sqlName: name }));
10
+ /**
11
+ * @param {Error} err - error instance
12
+ * @param {string} name - query name
13
+ * @param {string} sql - sql script
14
+ * @param {Opt} params - parameters
15
+ * */
16
+ constructor(err, name, sql, params) {
17
+ super(`${name ? name + ' : ' : ''}<${err.name}> ${err.message}`, Object.assign(Object.assign({}, params), { sql, queryName: name }));
8
18
  }
9
19
  }
10
20
  exports.DbExecuteError = DbExecuteError;
@@ -1,5 +1,14 @@
1
1
  import type { BasicType } from "@leyyo/common";
2
2
  import { DbError } from "./db.error";
3
+ /**
4
+ * Cache validation error
5
+ * */
3
6
  export declare class DbInvalidValueError extends DbError {
4
- constructor(field: string, type: BasicType, where: string, method: string);
7
+ /**
8
+ * @param {string} field - invalid field
9
+ * @param {string} expected - expected type
10
+ * @param {string} where - class name
11
+ * @param {string} method - method name
12
+ * */
13
+ constructor(field: string, expected: BasicType, where: string, method: string);
5
14
  }
@@ -2,9 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DbInvalidValueError = void 0;
4
4
  const db_error_1 = require("./db.error");
5
+ // noinspection JSUnusedGlobalSymbols
6
+ /**
7
+ * Cache validation error
8
+ * */
5
9
  class DbInvalidValueError extends db_error_1.DbError {
6
- constructor(field, type, where, method) {
7
- super(`${field} value is not valid at ${where}#${method}`, { field, type, where, method });
10
+ /**
11
+ * @param {string} field - invalid field
12
+ * @param {string} expected - expected type
13
+ * @param {string} where - class name
14
+ * @param {string} method - method name
15
+ * */
16
+ constructor(field, expected, where, method) {
17
+ super(`${field} value is not valid at ${where}#${method}`, { field, expected, where, method });
8
18
  }
9
19
  }
10
20
  exports.DbInvalidValueError = DbInvalidValueError;
@@ -1,4 +1,12 @@
1
1
  import { DbError } from "./db.error";
2
+ /**
3
+ * DB not-supported error
4
+ * */
2
5
  export declare class DbNotSupportedError extends DbError {
6
+ /**
7
+ * @param {string} feature - feature name
8
+ * @param {string} where - class name
9
+ * @param {string} method - method name
10
+ * */
3
11
  constructor(feature: string, where: string, method: string);
4
12
  }
@@ -2,7 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DbNotSupportedError = void 0;
4
4
  const db_error_1 = require("./db.error");
5
+ /**
6
+ * DB not-supported error
7
+ * */
5
8
  class DbNotSupportedError extends db_error_1.DbError {
9
+ /**
10
+ * @param {string} feature - feature name
11
+ * @param {string} where - class name
12
+ * @param {string} method - method name
13
+ * */
6
14
  constructor(feature, where, method) {
7
15
  super(`${feature} is not supported at ${where}#${method}`, { feature, where, method });
8
16
  }
@@ -1,7 +1,7 @@
1
1
  import { SametError } from "@samet-it/be-base-common";
2
2
  import type { DbErrorOmit } from "./index.types";
3
3
  /**
4
- * Generic database error
4
+ * General database error
5
5
  * */
6
6
  export declare class DbError extends SametError implements DbErrorOmit {
7
7
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DbError = void 0;
4
4
  const be_base_common_1 = require("@samet-it/be-base-common");
5
5
  /**
6
- * Generic database error
6
+ * General database error
7
7
  * */
8
8
  class DbError extends be_base_common_1.SametError {
9
9
  }
@@ -1,12 +1,24 @@
1
1
  import type { DbCheckKeysResult, DbRepoProps, DbRepoLike, DbRepoOpt, DbCheckKeysTuple } from "./index.types";
2
- import type { DefDims, Entity, IdDocLike, LoggerLike, Pair, Portion, UrnDocLike, UrnTuple, View } from "@samet-it/be-base-common";
2
+ import { DefDims, Entity, IdDocLike, LoggerLike, Pair, Portion, UrnDocLike, UrnTuple, View } from "@samet-it/be-base-common";
3
3
  import type { DbConnectionBase, DbExecOpt } from "../connection";
4
4
  import type { KeyValue, StrKey } from "@leyyo/common";
5
5
  import { type QueryAny, type QueryRegular } from "@leyyo/query";
6
6
  /**
7
7
  * DB repository abstract class
8
+ *
9
+ * Generics:
10
+ * - 0-`CONN`: db connection {@link DbConnectionBase}
11
+ * - 1-`OPT`: db execution options {@link DbExecOpt}
12
+ * - 2-`ENT`: entity {@link Entity}
13
+ * - 3-`ID`: id type {@link KeyValue}
14
+ * - 4-`URN`: urn interface {@link UrnDocLike}
15
+ * - 5-`VIEW`: view interface for presentation layer {@link View}
16
+ * - 6-`PAIR`: pair interface for presentation layer {@link Pair}
17
+ * - 7-`PORTION`: portion interface for presentation layer {@link Portion}
18
+ * - 8-`KEYS`: keys to autocomplete, def: keys of {@link Entity}
19
+ * - 9-`DIMS`: dimensions for presentation layer {@link DefDims}
8
20
  * */
9
- export declare abstract class DbRepo<CONN extends DbConnectionBase, OPT extends DbExecOpt, ID extends KeyValue, ENTITY extends Entity<ID>, URN extends UrnDocLike, KEYS extends string, DIMS extends DefDims, PAIR extends Pair<ID>, VIEW extends View<ID>, PORTION extends Portion<ID>> implements DbRepoLike<CONN, OPT, ID, ENTITY, URN, KEYS, DIMS, PAIR, VIEW, PORTION> {
21
+ export declare abstract class DbRepo<CONN extends DbConnectionBase, OPT extends DbExecOpt, ENT extends Entity<ID>, ID extends KeyValue, URN extends UrnDocLike, VIEW extends View<ID>, PAIR extends Pair<ID>, PORTION extends Portion<ID>, KEYS extends string, DIMS extends DefDims> implements DbRepoLike<CONN, OPT, ENT, ID, URN, VIEW, PAIR, PORTION, KEYS, DIMS> {
10
22
  /**
11
23
  * Logger
12
24
  * */
@@ -14,47 +26,53 @@ export declare abstract class DbRepo<CONN extends DbConnectionBase, OPT extends
14
26
  /**
15
27
  * Option of in-body usage in place of constructor param
16
28
  * */
17
- protected _opt: DbRepoOpt<ID, ENTITY>;
29
+ protected _opt: DbRepoOpt<ENT, ID>;
18
30
  /**
19
31
  * Produced setting from option
20
32
  * @see _opt
21
33
  * */
22
- protected _props: DbRepoProps<CONN, ID, ENTITY>;
23
- protected constructor(conn: CONN, opt?: DbRepoOpt<ID, ENTITY>);
24
- protected _removeFieldForForbidden(fields: Array<keyof ENTITY>, flag: keyof DbRepoOpt<ID, ENTITY>, field: keyof ENTITY): void;
25
- protected _checkForbiddenList(given: Array<keyof ENTITY>, def: Array<keyof ENTITY>): Array<keyof ENTITY>;
34
+ protected _props: DbRepoProps<CONN, ENT, ID>;
35
+ /**
36
+ * Constructor
37
+ *
38
+ * @param {DbConnectionBase} conn - db connection
39
+ * @param {DbRepoOpt} opt - options
40
+ * */
41
+ protected constructor(conn: CONN, opt?: DbRepoOpt<ENT, ID>);
42
+ protected _removeFieldForForbidden(fields: Array<keyof ENT>, flag: keyof DbRepoOpt<ENT, ID>, field: keyof ENT): void;
43
+ protected _checkForbiddenList(given: Array<keyof ENT>, def: Array<keyof ENT>): Array<keyof ENT>;
26
44
  protected get _now(): string | number;
27
45
  protected get _randomIndexName(): string;
28
46
  protected _indexName(name: string): string;
29
47
  /**
30
48
  * Fetch urn from doc as doc._urn
31
49
  * */
32
- protected _urnFromDoc(doc: Partial<ENTITY>, method: string): string;
50
+ protected _urnFromDoc(doc: Partial<ENT>, method: string): string;
33
51
  protected _checkKey(value: unknown): DbCheckKeysTuple<ID>;
34
52
  /**
35
53
  * Check array keys as id list or urn list
36
54
  * */
37
55
  protected _checkKeys(keys: Array<KeyValue>): DbCheckKeysResult<ID>;
38
56
  protected _isUrn(key: KeyValue): boolean;
57
+ protected _keyToUrn(key: KeyValue): string;
39
58
  /** @inheritDoc */
40
- get props(): Readonly<DbRepoProps<CONN, ID, ENTITY>>;
59
+ get props(): Readonly<DbRepoProps<CONN, ENT, ID>>;
41
60
  /** @inheritDoc */
42
61
  $cast<T>(): T;
43
- protected _keyToUrn(key: KeyValue): string;
44
62
  /** @inheritDoc */
45
63
  toUrn(urnRec: URN): string;
46
64
  /** @inheritDoc */
47
65
  $toUrnTuple(urnRec: URN): UrnTuple;
48
66
  /** @inheritDoc */
49
- get(k1: KeyValue, p1?: OPT | string): Promise<ENTITY | undefined>;
67
+ get(k1: KeyValue, p1?: OPT | string): Promise<ENT | undefined>;
50
68
  /** @inheritDoc */
51
- getByPrimary(key: string, p1?: OPT | string, ignoreCheck?: boolean): Promise<ENTITY | undefined>;
69
+ getByPrimary(key: string, p1?: OPT | string, ignoreCheck?: boolean): Promise<ENT | undefined>;
52
70
  /** @inheritDoc */
53
- abstract $getByPrimary(key: string, p1?: OPT | string, ignoreCheck?: boolean): Promise<ENTITY | undefined>;
71
+ abstract $getByPrimary(key: string, p1?: OPT | string, ignoreCheck?: boolean): Promise<ENT | undefined>;
54
72
  /** @inheritDoc */
55
- getBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<ENTITY | undefined>;
73
+ getBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<ENT | undefined>;
56
74
  /** @inheritDoc */
57
- abstract $getBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<ENTITY | undefined>;
75
+ abstract $getBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<ENT | undefined>;
58
76
  /** @inheritDoc */
59
77
  exists(k1: KeyValue, p1?: OPT | string): Promise<boolean>;
60
78
  /** @inheritDoc */
@@ -66,39 +84,43 @@ export declare abstract class DbRepo<CONN extends DbConnectionBase, OPT extends
66
84
  /** @inheritDoc */
67
85
  abstract $existsBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<boolean>;
68
86
  /** @inheritDoc */
69
- list(keys: Array<KeyValue>, p1?: OPT | string, ignoreCheck?: boolean): Promise<Array<ENTITY>>;
87
+ list(keys: Array<KeyValue>, p1?: OPT | string, ignoreCheck?: boolean): Promise<Array<ENT>>;
88
+ /** @inheritDoc */
89
+ abstract $listByPrimary(keys: string[], p1?: OPT | string, ignoreCheck?: boolean): Promise<Array<ENT>>;
90
+ /** @inheritDoc */
91
+ abstract $listBySecondary(keys: Array<KeyValue>, p1?: OPT | string, ignoreCheck?: boolean): Promise<Array<ENT>>;
70
92
  /** @inheritDoc */
71
- abstract $listByPrimary(keys: string[], p1?: OPT | string, ignoreCheck?: boolean): Promise<Array<ENTITY>>;
93
+ filter<R = ENT, K2 extends string = StrKey<R>>(query: QueryAny<K2 | KEYS | StrKey<ENT>>, p1?: OPT | string): Promise<Array<R>>;
72
94
  /** @inheritDoc */
73
- abstract $listBySecondary(keys: Array<KeyValue>, p1?: OPT | string, ignoreCheck?: boolean): Promise<Array<ENTITY>>;
95
+ abstract $filter<R = ENT, K2 extends string = StrKey<R>>(query: QueryRegular<K2 | KEYS | StrKey<ENT>>, p1?: OPT | string): Promise<Array<R>>;
74
96
  /** @inheritDoc */
75
- filter<R = ENTITY, K2 extends string = StrKey<R>>(query: QueryAny<K2 | KEYS | StrKey<ENTITY>>, p1?: OPT | string): Promise<Array<R>>;
97
+ insert(doc: ENT, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
76
98
  /** @inheritDoc */
77
- abstract $filter<R = ENTITY, K2 extends string = StrKey<R>>(query: QueryRegular<K2 | KEYS | StrKey<ENTITY>>, p1?: OPT | string): Promise<Array<R>>;
99
+ inserts(docs: Array<ENT>, p1?: OPT | string, ignoreCheck?: boolean): Promise<Array<string>>;
78
100
  /** @inheritDoc */
79
- insert(doc: ENTITY, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
101
+ abstract $insert(doc: ENT, opt?: OPT | string, ignoreCheck?: boolean): Promise<string>;
80
102
  /** @inheritDoc */
81
- inserts(docs: Array<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<Array<string>>;
103
+ replace(doc: ENT, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
82
104
  /** @inheritDoc */
83
- abstract $insert(doc: ENTITY, opt?: OPT | string, ignoreCheck?: boolean): Promise<string>;
105
+ abstract $replace(doc: ENT, opt?: OPT | string, ignoreCheck?: boolean): Promise<string>;
84
106
  /** @inheritDoc */
85
- replace(doc: ENTITY, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
107
+ upsert(doc: ENT, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
86
108
  /** @inheritDoc */
87
- abstract $replace(doc: ENTITY, opt?: OPT | string, ignoreCheck?: boolean): Promise<string>;
109
+ abstract $upsert(doc: ENT, opt?: OPT | string, ignoreCheck?: boolean): Promise<string>;
88
110
  /** @inheritDoc */
89
- update(k1: KeyValue, doc: Partial<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
111
+ update(k1: KeyValue, doc: Partial<ENT>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
90
112
  /** @inheritDoc */
91
- updateByPrimary(key: string, doc: Partial<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
113
+ updateByPrimary(key: string, doc: Partial<ENT>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
92
114
  /** @inheritDoc */
93
- abstract $updateByPrimary(key: string, doc: Partial<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
115
+ abstract $updateByPrimary(key: string, doc: Partial<ENT>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
94
116
  /** @inheritDoc */
95
- updateBySecondary(key: KeyValue, doc: Partial<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
117
+ updateBySecondary(key: KeyValue, doc: Partial<ENT>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
96
118
  /** @inheritDoc */
97
- abstract $updateBySecondary(key: KeyValue, doc: Partial<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
119
+ abstract $updateBySecondary(key: KeyValue, doc: Partial<ENT>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
98
120
  /** @inheritDoc */
99
- set(key: KeyValue, doc: Partial<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
121
+ set(key: KeyValue, doc: Partial<ENT>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
100
122
  /** @inheritDoc */
101
- unset(key: KeyValue, fields: Array<keyof ENTITY | string>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
123
+ unset(key: KeyValue, fields: Array<keyof ENT | KEYS | string>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
102
124
  /** @inheritDoc */
103
125
  remove(k1: KeyValue, p1?: OPT | string): Promise<string>;
104
126
  /** @inheritDoc */
@@ -120,24 +142,24 @@ export declare abstract class DbRepo<CONN extends DbConnectionBase, OPT extends
120
142
  /** @inheritDoc */
121
143
  abstract $trashBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
122
144
  /** @inheritDoc */
123
- $toDim<R extends IdDocLike<ID>>(doc: ENTITY, dim?: DIMS): Promise<R>;
145
+ $toDim<R extends IdDocLike<ID>>(doc: ENT, dim?: DIMS): Promise<R>;
124
146
  /** @inheritDoc */
125
147
  getDim<R extends IdDocLike<ID>>(key: KeyValue, dim?: DIMS): Promise<R>;
126
148
  /** @inheritDoc */
127
149
  listDims<R extends IdDocLike<ID>>(keys: Array<KeyValue>, dim?: DIMS, ignoreCheck?: boolean): Promise<Array<R>>;
128
150
  /** @inheritDoc */
129
- $toPair(doc: ENTITY): Promise<PAIR>;
151
+ $toPair(doc: ENT): Promise<PAIR>;
130
152
  /** @inheritDoc */
131
153
  getPair(key: KeyValue): Promise<PAIR>;
132
154
  /** @inheritDoc */
133
155
  listPairs(keys: Array<KeyValue>, ignoreCheck?: boolean): Promise<Array<PAIR>>;
134
- $toView(doc: ENTITY): Promise<VIEW>;
156
+ $toView(doc: ENT): Promise<VIEW>;
135
157
  /** @inheritDoc */
136
158
  getView(identifier: string): Promise<VIEW>;
137
159
  /** @inheritDoc */
138
160
  listViews(identifiers: Array<string>, ignoreCheck?: boolean): Promise<Array<VIEW>>;
139
161
  /** @inheritDoc */
140
- $toPortion(doc: ENTITY): Promise<PORTION>;
162
+ $toPortion(doc: ENT): Promise<PORTION>;
141
163
  /** @inheritDoc */
142
164
  getPortion(identifier: string): Promise<PORTION>;
143
165
  /** @inheritDoc */