@samet-it/be-db-common 1.3.1 → 1.3.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.
- package/README.md +2 -0
- package/dist/connection/db.connection.d.ts +1 -1
- package/dist/connection/db.connection.js +41 -46
- package/dist/connection/index.d.ts +2 -2
- package/dist/connection/index.js +2 -18
- package/dist/connection/index.types.js +1 -2
- package/dist/error/db-execute.error.d.ts +1 -1
- package/dist/error/db-execute.error.js +3 -7
- package/dist/error/db-invalid-value.error.d.ts +1 -1
- package/dist/error/db-invalid-value.error.js +3 -7
- package/dist/error/db-not-supported.error.d.ts +1 -1
- package/dist/error/db-not-supported.error.js +3 -7
- package/dist/error/db.error.js +2 -6
- package/dist/error/index.d.ts +4 -4
- package/dist/error/index.js +4 -20
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -20
- package/dist/line/db-lines.impl.d.ts +1 -1
- package/dist/line/db-lines.impl.js +7 -10
- package/dist/line/index.d.ts +2 -2
- package/dist/line/index.js +2 -18
- package/dist/line/index.types.js +1 -2
- package/dist/repo/db.repo.d.ts +9 -3
- package/dist/repo/db.repo.js +658 -653
- package/dist/repo/index.d.ts +2 -2
- package/dist/repo/index.js +2 -18
- package/dist/repo/index.types.d.ts +44 -2
- package/dist/repo/index.types.js +1 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -64,6 +64,8 @@ git clone https://github.com/samet-digital/be-db-common.git -b development
|
|
|
64
64
|
## Standards
|
|
65
65
|
```diff
|
|
66
66
|
+ language: TS
|
|
67
|
+
+ target: ES2022
|
|
68
|
+
+ module: NodeNext ~not commonJs~
|
|
67
69
|
+ lint: eslint
|
|
68
70
|
+ inspections: intelli-j code inspections
|
|
69
71
|
+ ddd: domain driven development
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DbConnectionLike, DbConnOpt, DbOnAfter, DbConnProps, DbEvent } from "./index.types";
|
|
1
|
+
import { DbConnectionLike, DbConnOpt, DbOnAfter, DbConnProps, DbEvent } from "./index.types.js";
|
|
2
2
|
import { Logger } from "@leyyo/common";
|
|
3
3
|
/**
|
|
4
4
|
* DB connection abstract class
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.DbConnection = void 0;
|
|
13
|
-
const type_1 = require("@leyyo/type");
|
|
14
|
-
const common_1 = require("@leyyo/common");
|
|
1
|
+
import { isBareObject } from "@leyyo/type";
|
|
2
|
+
import { errorCommon } from "@leyyo/common";
|
|
15
3
|
// noinspection JSUnusedGlobalSymbols
|
|
16
4
|
/**
|
|
17
5
|
* DB connection abstract class
|
|
@@ -19,7 +7,33 @@ const common_1 = require("@leyyo/common");
|
|
|
19
7
|
* Generics:
|
|
20
8
|
* - 0-`OPT`: db execution options {@link DbExecOpt}
|
|
21
9
|
* */
|
|
22
|
-
class DbConnection {
|
|
10
|
+
export class DbConnection {
|
|
11
|
+
// region protected-property
|
|
12
|
+
/**
|
|
13
|
+
* Logger
|
|
14
|
+
* */
|
|
15
|
+
logger;
|
|
16
|
+
/**
|
|
17
|
+
* On connected callbacks
|
|
18
|
+
* */
|
|
19
|
+
_onConnected = [];
|
|
20
|
+
/**
|
|
21
|
+
* On first connected callbacks
|
|
22
|
+
* */
|
|
23
|
+
_onFirstConnected = [];
|
|
24
|
+
/**
|
|
25
|
+
* On disconnected callbacks
|
|
26
|
+
* */
|
|
27
|
+
_onDisconnected = [];
|
|
28
|
+
/**
|
|
29
|
+
* Option of in-body usage in place of constructor param
|
|
30
|
+
* */
|
|
31
|
+
_opt = {};
|
|
32
|
+
/**
|
|
33
|
+
* Produced setting from option
|
|
34
|
+
* @see _opt
|
|
35
|
+
* */
|
|
36
|
+
_props;
|
|
23
37
|
// endregion protected-property
|
|
24
38
|
/**
|
|
25
39
|
* Constructor
|
|
@@ -27,29 +41,13 @@ class DbConnection {
|
|
|
27
41
|
* @param {DbConnOpt} opt - options
|
|
28
42
|
* */
|
|
29
43
|
constructor(opt) {
|
|
30
|
-
|
|
31
|
-
* On connected callbacks
|
|
32
|
-
* */
|
|
33
|
-
this._onConnected = [];
|
|
34
|
-
/**
|
|
35
|
-
* On first connected callbacks
|
|
36
|
-
* */
|
|
37
|
-
this._onFirstConnected = [];
|
|
38
|
-
/**
|
|
39
|
-
* On disconnected callbacks
|
|
40
|
-
* */
|
|
41
|
-
this._onDisconnected = [];
|
|
42
|
-
/**
|
|
43
|
-
* Option of in-body usage in place of constructor param
|
|
44
|
-
* */
|
|
45
|
-
this._opt = {};
|
|
46
|
-
if (!(0, type_1.isBareObject)(this._opt)) {
|
|
44
|
+
if (!isBareObject(this._opt)) {
|
|
47
45
|
this._opt = {};
|
|
48
46
|
}
|
|
49
|
-
if (
|
|
50
|
-
this._opt =
|
|
47
|
+
if (isBareObject(opt)) {
|
|
48
|
+
this._opt = { ...this._opt, ...opt };
|
|
51
49
|
}
|
|
52
|
-
this._props =
|
|
50
|
+
this._props = { ...this._opt, connectTryCount: 0, pingTryCount: 0 };
|
|
53
51
|
delete this._opt;
|
|
54
52
|
}
|
|
55
53
|
// region protected-method
|
|
@@ -70,7 +68,7 @@ class DbConnection {
|
|
|
70
68
|
}
|
|
71
69
|
else {
|
|
72
70
|
fn().then().catch(e => {
|
|
73
|
-
this.logger.warn(
|
|
71
|
+
this.logger.warn(errorCommon.text(e, 'on', name));
|
|
74
72
|
if (throwable) {
|
|
75
73
|
throw e;
|
|
76
74
|
}
|
|
@@ -88,7 +86,7 @@ class DbConnection {
|
|
|
88
86
|
if (items.length > 0) {
|
|
89
87
|
items.forEach(fn => {
|
|
90
88
|
fn().then().catch(e => {
|
|
91
|
-
this.logger.warn(
|
|
89
|
+
this.logger.warn(errorCommon.text(e, 'trigger', 'on', name));
|
|
92
90
|
if (throwable) {
|
|
93
91
|
throw e;
|
|
94
92
|
}
|
|
@@ -105,7 +103,7 @@ class DbConnection {
|
|
|
105
103
|
* @return {number}
|
|
106
104
|
* */
|
|
107
105
|
_delayWithJitter(count, baseDelay, maxDelay) {
|
|
108
|
-
const exp = Math.min(baseDelay *
|
|
106
|
+
const exp = Math.min(baseDelay * 2 ** count, maxDelay);
|
|
109
107
|
return exp / 2 + Math.random() * (exp / 2);
|
|
110
108
|
}
|
|
111
109
|
// endregion protected-method
|
|
@@ -140,13 +138,10 @@ class DbConnection {
|
|
|
140
138
|
/**
|
|
141
139
|
* It will be called during module based systems
|
|
142
140
|
* */
|
|
143
|
-
onModuleInit() {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
yield this.connect();
|
|
149
|
-
});
|
|
141
|
+
async onModuleInit() {
|
|
142
|
+
if (!this.isEnabled) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
await this.connect();
|
|
150
146
|
}
|
|
151
147
|
}
|
|
152
|
-
exports.DbConnection = DbConnection;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './index.types';
|
|
2
|
-
export * from './db.connection';
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './db.connection.js';
|
package/dist/connection/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./index.types"), exports);
|
|
18
|
-
__exportStar(require("./db.connection"), exports);
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './db.connection.js';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DbExecuteError = void 0;
|
|
4
|
-
const db_error_1 = require("./db.error");
|
|
1
|
+
import { DbError } from "./db.error.js";
|
|
5
2
|
// noinspection JSUnusedGlobalSymbols
|
|
6
3
|
/**
|
|
7
4
|
* DB execute error during run sql
|
|
8
5
|
* */
|
|
9
|
-
class DbExecuteError extends
|
|
6
|
+
export class DbExecuteError extends DbError {
|
|
10
7
|
/**
|
|
11
8
|
* @param {Error} err - error instance
|
|
12
9
|
* @param {string} name - query name
|
|
@@ -14,7 +11,6 @@ class DbExecuteError extends db_error_1.DbError {
|
|
|
14
11
|
* @param {Opt} params - parameters
|
|
15
12
|
* */
|
|
16
13
|
constructor(err, name, sql, params) {
|
|
17
|
-
super(`${name ? name + ' : ' : ''}<${err.name}> ${err.message}`,
|
|
14
|
+
super(`${name ? name + ' : ' : ''}<${err.name}> ${err.message}`, { ...params, sql, queryName: name });
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
|
-
exports.DbExecuteError = DbExecuteError;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DbInvalidValueError = void 0;
|
|
4
|
-
const db_error_1 = require("./db.error");
|
|
1
|
+
import { DbError } from "./db.error.js";
|
|
5
2
|
// noinspection JSUnusedGlobalSymbols
|
|
6
3
|
/**
|
|
7
4
|
* Cache validation error
|
|
8
5
|
* */
|
|
9
|
-
class DbInvalidValueError extends
|
|
6
|
+
export class DbInvalidValueError extends DbError {
|
|
10
7
|
/**
|
|
11
8
|
* @param {string} field - invalid field
|
|
12
9
|
* @param {Opt} params - parameters
|
|
13
10
|
* */
|
|
14
11
|
constructor(field, params) {
|
|
15
|
-
super(`${field} value is not valid`,
|
|
12
|
+
super(`${field} value is not valid`, { ...params, field });
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
|
-
exports.DbInvalidValueError = DbInvalidValueError;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DbNotSupportedError = void 0;
|
|
4
|
-
const db_error_1 = require("./db.error");
|
|
1
|
+
import { DbError } from "./db.error.js";
|
|
5
2
|
/**
|
|
6
3
|
* DB not-supported error
|
|
7
4
|
* */
|
|
8
|
-
class DbNotSupportedError extends
|
|
5
|
+
export class DbNotSupportedError extends DbError {
|
|
9
6
|
/**
|
|
10
7
|
* Constructor
|
|
11
8
|
*
|
|
@@ -13,7 +10,6 @@ class DbNotSupportedError extends db_error_1.DbError {
|
|
|
13
10
|
* @param {Opt} params - parameters
|
|
14
11
|
* */
|
|
15
12
|
constructor(feature, params) {
|
|
16
|
-
super(`${feature} is not supported`,
|
|
13
|
+
super(`${feature} is not supported`, { ...params, feature });
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
exports.DbNotSupportedError = DbNotSupportedError;
|
package/dist/error/db.error.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DbError = void 0;
|
|
4
|
-
const be_base_common_1 = require("@samet-it/be-base-common");
|
|
1
|
+
import { SametError } from "@samet-it/be-base-common";
|
|
5
2
|
/**
|
|
6
3
|
* General database error
|
|
7
4
|
* */
|
|
8
|
-
class DbError extends
|
|
5
|
+
export class DbError extends SametError {
|
|
9
6
|
}
|
|
10
|
-
exports.DbError = DbError;
|
package/dist/error/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './db.error';
|
|
2
|
-
export * from './db-execute.error';
|
|
3
|
-
export * from './db-invalid-value.error';
|
|
4
|
-
export * from './db-not-supported.error';
|
|
1
|
+
export * from './db.error.js';
|
|
2
|
+
export * from './db-execute.error.js';
|
|
3
|
+
export * from './db-invalid-value.error.js';
|
|
4
|
+
export * from './db-not-supported.error.js';
|
package/dist/error/index.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./db.error"), exports);
|
|
18
|
-
__exportStar(require("./db-execute.error"), exports);
|
|
19
|
-
__exportStar(require("./db-invalid-value.error"), exports);
|
|
20
|
-
__exportStar(require("./db-not-supported.error"), exports);
|
|
1
|
+
export * from './db.error.js';
|
|
2
|
+
export * from './db-execute.error.js';
|
|
3
|
+
export * from './db-invalid-value.error.js';
|
|
4
|
+
export * from './db-not-supported.error.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './connection';
|
|
2
|
-
export * from './line';
|
|
3
|
-
export * from './repo';
|
|
4
|
-
export * from './error';
|
|
1
|
+
export * from './connection/index.js';
|
|
2
|
+
export * from './line/index.js';
|
|
3
|
+
export * from './repo/index.js';
|
|
4
|
+
export * from './error/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./connection"), exports);
|
|
18
|
-
__exportStar(require("./line"), exports);
|
|
19
|
-
__exportStar(require("./repo"), exports);
|
|
20
|
-
__exportStar(require("./error"), exports);
|
|
1
|
+
export * from './connection/index.js';
|
|
2
|
+
export * from './line/index.js';
|
|
3
|
+
export * from './repo/index.js';
|
|
4
|
+
export * from './error/index.js';
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// ~~console.log(__filename);
|
|
3
|
-
|
|
4
|
-
exports.dbLines = void 0;
|
|
5
|
-
const type_1 = require("@leyyo/type");
|
|
2
|
+
import { assertFunction } from "@leyyo/type";
|
|
6
3
|
/** @inheritDoc */
|
|
7
4
|
class DbLinesImpl {
|
|
5
|
+
_lines;
|
|
8
6
|
constructor() {
|
|
9
7
|
this._lines = [];
|
|
10
8
|
}
|
|
@@ -72,14 +70,14 @@ class DbLinesImpl {
|
|
|
72
70
|
if (flag) {
|
|
73
71
|
const type = typeof yes;
|
|
74
72
|
if (!['string', 'function'].includes(type)) {
|
|
75
|
-
|
|
73
|
+
assertFunction(yes, { field: 'yes', method: 'both' });
|
|
76
74
|
}
|
|
77
75
|
this.add((typeof yes === 'function') ? yes() : yes);
|
|
78
76
|
}
|
|
79
77
|
else {
|
|
80
78
|
const type = typeof no;
|
|
81
79
|
if (!['string', 'function'].includes(type)) {
|
|
82
|
-
|
|
80
|
+
assertFunction(no, { field: 'no', method: 'both' });
|
|
83
81
|
}
|
|
84
82
|
this.add((typeof no === 'function') ? no() : no);
|
|
85
83
|
}
|
|
@@ -90,7 +88,7 @@ class DbLinesImpl {
|
|
|
90
88
|
if (flag) {
|
|
91
89
|
const type = typeof yes;
|
|
92
90
|
if (!['string', 'function'].includes(type)) {
|
|
93
|
-
|
|
91
|
+
assertFunction(yes, { field: 'yes', method: 'yes' });
|
|
94
92
|
}
|
|
95
93
|
this.add((typeof yes === 'function') ? yes() : yes);
|
|
96
94
|
}
|
|
@@ -101,7 +99,7 @@ class DbLinesImpl {
|
|
|
101
99
|
if (!flag) {
|
|
102
100
|
const type = typeof no;
|
|
103
101
|
if (!['string', 'function'].includes(type)) {
|
|
104
|
-
|
|
102
|
+
assertFunction(no, { field: 'no', method: 'no' });
|
|
105
103
|
}
|
|
106
104
|
this.add((typeof no === 'function') ? no() : no);
|
|
107
105
|
}
|
|
@@ -135,7 +133,6 @@ class DbLinesImpl {
|
|
|
135
133
|
*
|
|
136
134
|
* @return {DbLines}
|
|
137
135
|
* */
|
|
138
|
-
const dbLines = () => {
|
|
136
|
+
export const dbLines = () => {
|
|
139
137
|
return new DbLinesImpl();
|
|
140
138
|
};
|
|
141
|
-
exports.dbLines = dbLines;
|
package/dist/line/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './index.types';
|
|
2
|
-
export * from './db-lines.impl';
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './db-lines.impl.js';
|
package/dist/line/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./index.types"), exports);
|
|
18
|
-
__exportStar(require("./db-lines.impl"), exports);
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './db-lines.impl.js';
|
package/dist/line/index.types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/repo/db.repo.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DbCheckKeysResult, DbRepoProps, DbRepoLike, DbRepoOpt, UrnDelimiter, DbCheckKeysTuple, DbExecOpt, DbMeta, DbRepoExtensionLambda, DbQueryResultOne, DbQueryResultMore } from "./index.types";
|
|
1
|
+
import { DbCheckKeysResult, DbRepoProps, DbRepoLike, DbRepoOpt, UrnDelimiter, DbCheckKeysTuple, DbExecOpt, DbMeta, DbRepoExtensionLambda, DbQueryResultOne, DbQueryResultMore } from "./index.types.js";
|
|
2
2
|
import { DefDims, Entity, IdDocLike, Pair, Portion, UrnDocLike, UrnTuple, View } from "@samet-it/be-base-common";
|
|
3
|
-
import { DbConnectionLike, UserFetcherLambda } from "../connection";
|
|
3
|
+
import { DbConnectionLike, UserFetcherLambda } from "../connection/index.js";
|
|
4
4
|
import { KeyValue, Logger, Opt, StrKey } from "@leyyo/common";
|
|
5
5
|
import { QueryAny, QueryRegular } from "@leyyo/query";
|
|
6
6
|
import { CacheConnectionLike, CacheChannelLike, CacheExecOpt } from "@samet-it/be-cache-common";
|
|
7
|
-
import { DbLines } from "../line";
|
|
7
|
+
import { DbLines } from "../line/index.js";
|
|
8
8
|
/**
|
|
9
9
|
* DB repository abstract class
|
|
10
10
|
*
|
|
@@ -187,6 +187,8 @@ export declare abstract class DbRepo<CONN extends DbConnectionLike, OPT extends
|
|
|
187
187
|
/** @inheritDoc */
|
|
188
188
|
toUrn(urnRec: URN): string;
|
|
189
189
|
/** @inheritDoc */
|
|
190
|
+
toUrnKey(p1: Partial<ENT> | string): string;
|
|
191
|
+
/** @inheritDoc */
|
|
190
192
|
$toUrnTuple(urnRec: URN): UrnTuple;
|
|
191
193
|
/** @inheritDoc */
|
|
192
194
|
get(keyLike: PORTION | KeyValue, p1?: OPT | string): Promise<ENT | undefined>;
|
|
@@ -272,15 +274,19 @@ export declare abstract class DbRepo<CONN extends DbConnectionLike, OPT extends
|
|
|
272
274
|
getDim<R extends IdDocLike<ID>>(key: PORTION | KeyValue, dim?: DIMS): Promise<R>;
|
|
273
275
|
/** @inheritDoc */
|
|
274
276
|
listDims<R extends IdDocLike<ID>>(keys: Array<PORTION | KeyValue>, dim?: DIMS, ignoreCheck?: boolean): Promise<Array<R>>;
|
|
277
|
+
toPair(doc: ENT): Promise<PAIR>;
|
|
275
278
|
/** @inheritDoc */
|
|
276
279
|
getPair(key: PORTION | KeyValue): Promise<PAIR>;
|
|
277
280
|
/** @inheritDoc */
|
|
278
281
|
listPairs(keys: Array<PORTION | KeyValue>, ignoreCheck?: boolean): Promise<Array<PAIR>>;
|
|
282
|
+
toView(doc: ENT): Promise<VIEW>;
|
|
279
283
|
/** @inheritDoc */
|
|
280
284
|
getView(key: PORTION | KeyValue): Promise<VIEW>;
|
|
281
285
|
/** @inheritDoc */
|
|
282
286
|
listViews(keys: Array<PORTION | KeyValue>, ignoreCheck?: boolean): Promise<Array<VIEW>>;
|
|
283
287
|
/** @inheritDoc */
|
|
288
|
+
toPortion(doc: ENT): Promise<PORTION>;
|
|
289
|
+
/** @inheritDoc */
|
|
284
290
|
getPortion(key: PORTION | KeyValue): Promise<PORTION>;
|
|
285
291
|
/** @inheritDoc */
|
|
286
292
|
listPortions(keys: Array<PORTION | KeyValue>, ignoreCheck?: boolean): Promise<Array<PORTION>>;
|