@samet-it/be-db-common 1.0.11
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/LICENSE +24 -0
- package/README.md +74 -0
- package/dist/assets/.gitkeep +0 -0
- package/dist/connection/db.connection.d.ts +74 -0
- package/dist/connection/db.connection.js +173 -0
- package/dist/connection/index.d.ts +2 -0
- package/dist/connection/index.js +18 -0
- package/dist/connection/index.types.d.ts +294 -0
- package/dist/connection/index.types.js +2 -0
- package/dist/error/db-execute.error.d.ts +5 -0
- package/dist/error/db-execute.error.js +10 -0
- package/dist/error/db-invalid-value.error.d.ts +5 -0
- package/dist/error/db-invalid-value.error.js +10 -0
- package/dist/error/db-not-supported.error.d.ts +4 -0
- package/dist/error/db-not-supported.error.js +10 -0
- package/dist/error/db.error.d.ts +7 -0
- package/dist/error/db.error.js +10 -0
- package/dist/error/index.d.ts +5 -0
- package/dist/error/index.js +21 -0
- package/dist/error/index.types.d.ts +1 -0
- package/dist/error/index.types.js +2 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -0
- package/dist/line/db-lines.impl.d.ts +7 -0
- package/dist/line/db-lines.impl.js +141 -0
- package/dist/line/index.d.ts +2 -0
- package/dist/line/index.js +18 -0
- package/dist/line/index.types.d.ts +103 -0
- package/dist/line/index.types.js +2 -0
- package/dist/repo/db.repo.d.ts +147 -0
- package/dist/repo/db.repo.js +924 -0
- package/dist/repo/index.d.ts +2 -0
- package/dist/repo/index.js +18 -0
- package/dist/repo/index.types.d.ts +701 -0
- package/dist/repo/index.types.js +2 -0
- package/package.json +72 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DbInvalidValueError = void 0;
|
|
4
|
+
const db_error_1 = require("./db.error");
|
|
5
|
+
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 });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.DbInvalidValueError = DbInvalidValueError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DbNotSupportedError = void 0;
|
|
4
|
+
const db_error_1 = require("./db.error");
|
|
5
|
+
class DbNotSupportedError extends db_error_1.DbError {
|
|
6
|
+
constructor(feature, where, method) {
|
|
7
|
+
super(`${feature} is not supported at ${where}#${method}`, { feature, where, method });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.DbNotSupportedError = DbNotSupportedError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DbError = void 0;
|
|
4
|
+
const be_base_common_1 = require("@samet-it/be-base-common");
|
|
5
|
+
/**
|
|
6
|
+
* Generic database error
|
|
7
|
+
* */
|
|
8
|
+
class DbError extends be_base_common_1.SametError {
|
|
9
|
+
}
|
|
10
|
+
exports.DbError = DbError;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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.error"), exports);
|
|
19
|
+
__exportStar(require("./db-execute.error"), exports);
|
|
20
|
+
__exportStar(require("./db-invalid-value.error"), exports);
|
|
21
|
+
__exportStar(require("./db-not-supported.error"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DbErrorOmit = Omit<Error, 'message' | 'name' | 'stack'>;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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("./connection"), exports);
|
|
18
|
+
__exportStar(require("./line"), exports);
|
|
19
|
+
__exportStar(require("./repo"), exports);
|
|
20
|
+
__exportStar(require("./error"), exports);
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ~~console.log(__filename);
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.dbLines = void 0;
|
|
5
|
+
const type_1 = require("@leyyo/type");
|
|
6
|
+
/** @inheritDoc */
|
|
7
|
+
class DbLinesImpl {
|
|
8
|
+
constructor() {
|
|
9
|
+
this._lines = [];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Add line for normal, marked, or optional with padding or without padding
|
|
13
|
+
* */
|
|
14
|
+
_add(mark, parts) {
|
|
15
|
+
if (parts.length < 1) {
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
parts = parts
|
|
19
|
+
.map(item => {
|
|
20
|
+
switch (typeof item) {
|
|
21
|
+
case "string":
|
|
22
|
+
const str = item.trim();
|
|
23
|
+
return str ? str : undefined;
|
|
24
|
+
default:
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
.filter(item => item !== undefined);
|
|
29
|
+
if (parts.length < 1) {
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
this._lines.push({ mark, content: parts.join(' ') });
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
/** @inheritDoc */
|
|
36
|
+
marked(mark, ...parts) {
|
|
37
|
+
return this._add(mark, parts);
|
|
38
|
+
}
|
|
39
|
+
/** @inheritDoc */
|
|
40
|
+
add(...parts) {
|
|
41
|
+
return this._add(undefined, parts);
|
|
42
|
+
}
|
|
43
|
+
/** @inheritDoc */
|
|
44
|
+
remove(mark) {
|
|
45
|
+
if (typeof mark !== 'string') {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
const index = this._lines.findIndex(line => line.mark === mark);
|
|
49
|
+
if (index < 0) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
this._lines.splice(index, 1);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
/** @inheritDoc */
|
|
56
|
+
replace(mark, line) {
|
|
57
|
+
if (typeof mark !== 'string') {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
const index = this._lines.findIndex(line => line.mark === mark);
|
|
61
|
+
if (index < 0) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (typeof line !== 'string') {
|
|
65
|
+
line = '';
|
|
66
|
+
}
|
|
67
|
+
this._lines[index] = { mark, content: line };
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
/** @inheritDoc */
|
|
71
|
+
both(flag, yes, no) {
|
|
72
|
+
if (flag) {
|
|
73
|
+
const type = typeof yes;
|
|
74
|
+
if (!['string', 'function'].includes(type)) {
|
|
75
|
+
(0, type_1.assertFunction)(yes, { field: 'yes', method: 'both' });
|
|
76
|
+
}
|
|
77
|
+
this.add((typeof yes === 'function') ? yes() : yes);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const type = typeof no;
|
|
81
|
+
if (!['string', 'function'].includes(type)) {
|
|
82
|
+
(0, type_1.assertFunction)(no, { field: 'no', method: 'both' });
|
|
83
|
+
}
|
|
84
|
+
this.add((typeof no === 'function') ? no() : no);
|
|
85
|
+
}
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
/** @inheritDoc */
|
|
89
|
+
yes(flag, yes) {
|
|
90
|
+
if (flag) {
|
|
91
|
+
const type = typeof yes;
|
|
92
|
+
if (!['string', 'function'].includes(type)) {
|
|
93
|
+
(0, type_1.assertFunction)(yes, { field: 'yes', method: 'yes' });
|
|
94
|
+
}
|
|
95
|
+
this.add((typeof yes === 'function') ? yes() : yes);
|
|
96
|
+
}
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
/** @inheritDoc */
|
|
100
|
+
no(flag, no) {
|
|
101
|
+
if (!flag) {
|
|
102
|
+
const type = typeof no;
|
|
103
|
+
if (!['string', 'function'].includes(type)) {
|
|
104
|
+
(0, type_1.assertFunction)(no, { field: 'no', method: 'no' });
|
|
105
|
+
}
|
|
106
|
+
this.add((typeof no === 'function') ? no() : no);
|
|
107
|
+
}
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
/** @inheritDoc */
|
|
111
|
+
clear() {
|
|
112
|
+
this._lines.splice(0, this._lines.length);
|
|
113
|
+
return this;
|
|
114
|
+
}
|
|
115
|
+
/** @inheritDoc */
|
|
116
|
+
end() {
|
|
117
|
+
return this.lines.join('\n');
|
|
118
|
+
}
|
|
119
|
+
/** @inheritDoc */
|
|
120
|
+
get lines() {
|
|
121
|
+
return this._lines.map(line => line.content);
|
|
122
|
+
}
|
|
123
|
+
/** @inheritDoc */
|
|
124
|
+
get size() {
|
|
125
|
+
return this._lines.length;
|
|
126
|
+
}
|
|
127
|
+
/** @inheritDoc */
|
|
128
|
+
toString() {
|
|
129
|
+
return this.end();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// noinspection JSUnusedGlobalSymbols
|
|
133
|
+
/**
|
|
134
|
+
* Create new/empty sql lines
|
|
135
|
+
*
|
|
136
|
+
* @return {DbLines}
|
|
137
|
+
* */
|
|
138
|
+
const dbLines = () => {
|
|
139
|
+
return new DbLinesImpl();
|
|
140
|
+
};
|
|
141
|
+
exports.dbLines = dbLines;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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);
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQL line item
|
|
3
|
+
* */
|
|
4
|
+
export interface DbLineItem {
|
|
5
|
+
mark?: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* SQL lines
|
|
10
|
+
* */
|
|
11
|
+
export interface DbLines {
|
|
12
|
+
/**
|
|
13
|
+
* Add marked line
|
|
14
|
+
*
|
|
15
|
+
* @param {string} mark - mark for selected line
|
|
16
|
+
* @param {...string} parts - line parts
|
|
17
|
+
* @return {DbLines}
|
|
18
|
+
*/
|
|
19
|
+
marked(mark: string, ...parts: Array<string>): DbLines;
|
|
20
|
+
/**
|
|
21
|
+
* Add line
|
|
22
|
+
*
|
|
23
|
+
* @param {...string} parts - line parts
|
|
24
|
+
* @return {DbLines}
|
|
25
|
+
*/
|
|
26
|
+
add(...parts: Array<string>): DbLines;
|
|
27
|
+
/**
|
|
28
|
+
* Clear all lines
|
|
29
|
+
* @return {DbLines}
|
|
30
|
+
*/
|
|
31
|
+
clear(): DbLines;
|
|
32
|
+
/**
|
|
33
|
+
* Remove marked line
|
|
34
|
+
*
|
|
35
|
+
* @param {string} mark - mark for selected line
|
|
36
|
+
* @return {boolean} - is removed?
|
|
37
|
+
*/
|
|
38
|
+
remove(mark: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Replace marked line
|
|
41
|
+
*
|
|
42
|
+
* @param {string} mark - mark for selected line
|
|
43
|
+
* @param {string} line - new content
|
|
44
|
+
* @return {boolean} - is replaced?
|
|
45
|
+
*/
|
|
46
|
+
replace(mark: string, line: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Add new lines by flag
|
|
49
|
+
* - if flag is true, then `yes` will be added
|
|
50
|
+
* - if flag is not true, then `no` will be added
|
|
51
|
+
*
|
|
52
|
+
* @param {boolean} flag
|
|
53
|
+
* @param {(function|string)} yes - it's effective when flag is true
|
|
54
|
+
* @param {(function|string)} no - it's effective when flag is not true
|
|
55
|
+
* @return {DbLines}
|
|
56
|
+
*/
|
|
57
|
+
both(flag: boolean, yes: DbLineConditionalLambda | string, no: DbLineConditionalLambda | string): DbLines;
|
|
58
|
+
/**
|
|
59
|
+
* Add new lines if flag is true
|
|
60
|
+
*
|
|
61
|
+
* @param {boolean} flag
|
|
62
|
+
* @param {(function|string)} yes - it's effective when flag is true
|
|
63
|
+
* @return {DbLines}
|
|
64
|
+
*/
|
|
65
|
+
yes(flag: boolean, yes: DbLineConditionalLambda | string): DbLines;
|
|
66
|
+
/**
|
|
67
|
+
* Add new lines if flag is not true
|
|
68
|
+
*
|
|
69
|
+
* @param {boolean} flag
|
|
70
|
+
* @param {(function|string)} no - it's effective when flag is not true
|
|
71
|
+
* @return {DbLines}
|
|
72
|
+
*/
|
|
73
|
+
no(flag: boolean, no: DbLineConditionalLambda | string): DbLines;
|
|
74
|
+
/**
|
|
75
|
+
* Builds a string from lines
|
|
76
|
+
*
|
|
77
|
+
* @return {string}
|
|
78
|
+
*/
|
|
79
|
+
end(): string;
|
|
80
|
+
/**
|
|
81
|
+
* Return all lines
|
|
82
|
+
*
|
|
83
|
+
* @return {Array<string>}
|
|
84
|
+
*/
|
|
85
|
+
get lines(): Array<string>;
|
|
86
|
+
/**
|
|
87
|
+
* Return size of lines
|
|
88
|
+
*
|
|
89
|
+
* @return {number}
|
|
90
|
+
*/
|
|
91
|
+
get size(): number;
|
|
92
|
+
/**
|
|
93
|
+
* Alis for end() method
|
|
94
|
+
*
|
|
95
|
+
* @return {string}
|
|
96
|
+
*/
|
|
97
|
+
toString(): string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* SQL conditional lambda
|
|
101
|
+
* @function
|
|
102
|
+
* */
|
|
103
|
+
export type DbLineConditionalLambda = () => string;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { DbCheckKeysResult, DbRepoProps, DbRepoLike, DbRepoOpt, DbRepoDef, DbCheckKeysTuple } from "./index.types";
|
|
2
|
+
import type { DefDims, Entity, IdDocLike, LoggerLike, Pair, Portion, UrnDocLike, UrnTuple, View } from "@samet-it/be-base-common";
|
|
3
|
+
import type { DbConnectionBase, DbExecOpt } from "../connection";
|
|
4
|
+
import type { KeyValue, StrKey } from "@leyyo/common";
|
|
5
|
+
import { type QueryAny, type QueryRegular } from "@leyyo/query";
|
|
6
|
+
/**
|
|
7
|
+
* DB repository abstract class
|
|
8
|
+
* */
|
|
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> {
|
|
10
|
+
/**
|
|
11
|
+
* Logger
|
|
12
|
+
* */
|
|
13
|
+
protected logger: LoggerLike;
|
|
14
|
+
/**
|
|
15
|
+
* Option of in-body usage in place of constructor param
|
|
16
|
+
* */
|
|
17
|
+
protected _opt: DbRepoOpt<ID, ENTITY>;
|
|
18
|
+
/**
|
|
19
|
+
* Produced setting from option
|
|
20
|
+
* @see _opt
|
|
21
|
+
* */
|
|
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>;
|
|
26
|
+
protected get _now(): string | number;
|
|
27
|
+
protected get _randomIndexName(): string;
|
|
28
|
+
protected _indexName(name: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Fetch urn from doc as doc._urn
|
|
31
|
+
* */
|
|
32
|
+
protected _urnFromDoc(doc: Partial<ENTITY>, method: string): string;
|
|
33
|
+
protected _checkKey(value: unknown): DbCheckKeysTuple<ID>;
|
|
34
|
+
/**
|
|
35
|
+
* Check array keys as id list or urn list
|
|
36
|
+
* */
|
|
37
|
+
protected _checkKeys(keys: Array<KeyValue>): DbCheckKeysResult<ID>;
|
|
38
|
+
protected _isUrn(key: KeyValue): boolean;
|
|
39
|
+
/** @inheritDoc */
|
|
40
|
+
get props(): Readonly<DbRepoProps<CONN, ID, ENTITY>>;
|
|
41
|
+
/** @inheritDoc */
|
|
42
|
+
get $def(): DbRepoDef;
|
|
43
|
+
/** @inheritDoc */
|
|
44
|
+
$cast<T>(): T;
|
|
45
|
+
protected _keyToUrn(key: KeyValue): string;
|
|
46
|
+
/** @inheritDoc */
|
|
47
|
+
toUrn(urnRec: URN): string;
|
|
48
|
+
/** @inheritDoc */
|
|
49
|
+
$toUrnTuple(urnRec: URN): UrnTuple;
|
|
50
|
+
/** @inheritDoc */
|
|
51
|
+
get(k1: KeyValue, p1?: OPT | string): Promise<ENTITY | undefined>;
|
|
52
|
+
/** @inheritDoc */
|
|
53
|
+
getByPrimary(key: string, p1?: OPT | string, ignoreCheck?: boolean): Promise<ENTITY | undefined>;
|
|
54
|
+
/** @inheritDoc */
|
|
55
|
+
abstract $getByPrimary(key: string, p1?: OPT | string, ignoreCheck?: boolean): Promise<ENTITY | undefined>;
|
|
56
|
+
/** @inheritDoc */
|
|
57
|
+
getBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<ENTITY | undefined>;
|
|
58
|
+
/** @inheritDoc */
|
|
59
|
+
abstract $getBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<ENTITY | undefined>;
|
|
60
|
+
/** @inheritDoc */
|
|
61
|
+
exists(k1: KeyValue, p1?: OPT | string): Promise<boolean>;
|
|
62
|
+
/** @inheritDoc */
|
|
63
|
+
existsByPrimary(key: string, p1?: OPT | string, ignoreCheck?: boolean): Promise<boolean>;
|
|
64
|
+
/** @inheritDoc */
|
|
65
|
+
abstract $existsByPrimary(key: string, p1?: OPT | string, ignoreCheck?: boolean): Promise<boolean>;
|
|
66
|
+
/** @inheritDoc */
|
|
67
|
+
existsBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<boolean>;
|
|
68
|
+
/** @inheritDoc */
|
|
69
|
+
abstract $existsBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<boolean>;
|
|
70
|
+
/** @inheritDoc */
|
|
71
|
+
list(keys: Array<KeyValue>, p1?: OPT | string, ignoreCheck?: boolean): Promise<Array<ENTITY>>;
|
|
72
|
+
/** @inheritDoc */
|
|
73
|
+
abstract $listByPrimary(keys: string[], p1?: OPT | string, ignoreCheck?: boolean): Promise<Array<ENTITY>>;
|
|
74
|
+
/** @inheritDoc */
|
|
75
|
+
abstract $listBySecondary(keys: Array<KeyValue>, p1?: OPT | string, ignoreCheck?: boolean): Promise<Array<ENTITY>>;
|
|
76
|
+
/** @inheritDoc */
|
|
77
|
+
filter<R = ENTITY, K2 extends string = StrKey<R>>(query: QueryAny<K2 | KEYS | StrKey<ENTITY>>, p1?: OPT | string): Promise<Array<R>>;
|
|
78
|
+
/** @inheritDoc */
|
|
79
|
+
abstract $filter<R = ENTITY, K2 extends string = StrKey<R>>(query: QueryRegular<K2 | KEYS | StrKey<ENTITY>>, p1?: OPT | string): Promise<Array<R>>;
|
|
80
|
+
/** @inheritDoc */
|
|
81
|
+
insert(doc: ENTITY, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
82
|
+
/** @inheritDoc */
|
|
83
|
+
inserts(docs: Array<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<Array<string>>;
|
|
84
|
+
/** @inheritDoc */
|
|
85
|
+
abstract $insert(doc: ENTITY, opt?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
86
|
+
/** @inheritDoc */
|
|
87
|
+
replace(doc: ENTITY, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
88
|
+
/** @inheritDoc */
|
|
89
|
+
abstract $replace(doc: ENTITY, opt?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
90
|
+
/** @inheritDoc */
|
|
91
|
+
update(k1: KeyValue, doc: Partial<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
92
|
+
/** @inheritDoc */
|
|
93
|
+
updateByPrimary(key: string, doc: Partial<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
94
|
+
/** @inheritDoc */
|
|
95
|
+
abstract $updateByPrimary(key: string, doc: Partial<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
96
|
+
/** @inheritDoc */
|
|
97
|
+
updateBySecondary(key: KeyValue, doc: Partial<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
98
|
+
/** @inheritDoc */
|
|
99
|
+
abstract $updateBySecondary(key: KeyValue, doc: Partial<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
100
|
+
/** @inheritDoc */
|
|
101
|
+
set(key: KeyValue, doc: Partial<ENTITY>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
102
|
+
/** @inheritDoc */
|
|
103
|
+
unset(key: KeyValue, fields: Array<keyof ENTITY | string>, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
104
|
+
/** @inheritDoc */
|
|
105
|
+
remove(k1: KeyValue, p1?: OPT | string): Promise<string>;
|
|
106
|
+
/** @inheritDoc */
|
|
107
|
+
removeByPrimary(key: string, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
108
|
+
/** @inheritDoc */
|
|
109
|
+
abstract $removeByPrimary(key: string, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
110
|
+
/** @inheritDoc */
|
|
111
|
+
removeBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
112
|
+
/** @inheritDoc */
|
|
113
|
+
abstract $removeBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
114
|
+
/** @inheritDoc */
|
|
115
|
+
trash(k1: KeyValue, p1?: OPT | string): Promise<string>;
|
|
116
|
+
/** @inheritDoc */
|
|
117
|
+
trashByPrimary(key: string, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
118
|
+
/** @inheritDoc */
|
|
119
|
+
abstract $trashByPrimary(key: string, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
120
|
+
/** @inheritDoc */
|
|
121
|
+
trashBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
122
|
+
/** @inheritDoc */
|
|
123
|
+
abstract $trashBySecondary(key: KeyValue, p1?: OPT | string, ignoreCheck?: boolean): Promise<string>;
|
|
124
|
+
/** @inheritDoc */
|
|
125
|
+
$toDim<R extends IdDocLike<ID>>(doc: ENTITY, dim?: DIMS): Promise<R>;
|
|
126
|
+
/** @inheritDoc */
|
|
127
|
+
getDim<R extends IdDocLike<ID>>(key: KeyValue, dim?: DIMS): Promise<R>;
|
|
128
|
+
/** @inheritDoc */
|
|
129
|
+
listDims<R extends IdDocLike<ID>>(keys: Array<KeyValue>, dim?: DIMS, ignoreCheck?: boolean): Promise<Array<R>>;
|
|
130
|
+
/** @inheritDoc */
|
|
131
|
+
$toPair(doc: ENTITY): Promise<PAIR>;
|
|
132
|
+
/** @inheritDoc */
|
|
133
|
+
getPair(key: KeyValue): Promise<PAIR>;
|
|
134
|
+
/** @inheritDoc */
|
|
135
|
+
listPairs(keys: Array<KeyValue>, ignoreCheck?: boolean): Promise<Array<PAIR>>;
|
|
136
|
+
$toView(doc: ENTITY): Promise<VIEW>;
|
|
137
|
+
/** @inheritDoc */
|
|
138
|
+
getView(identifier: string): Promise<VIEW>;
|
|
139
|
+
/** @inheritDoc */
|
|
140
|
+
listViews(identifiers: Array<string>, ignoreCheck?: boolean): Promise<Array<VIEW>>;
|
|
141
|
+
/** @inheritDoc */
|
|
142
|
+
$toPortion(doc: ENTITY): Promise<PORTION>;
|
|
143
|
+
/** @inheritDoc */
|
|
144
|
+
getPortion(identifier: string): Promise<PORTION>;
|
|
145
|
+
/** @inheritDoc */
|
|
146
|
+
listPortions(identifiers: Array<string>, ignoreCheck?: boolean): Promise<Array<PORTION>>;
|
|
147
|
+
}
|