@iamkirbki/database-handler-core 4.4.6 → 4.4.8
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/dist/abstract/Controller.d.ts +2 -2
- package/dist/abstract/Controller.d.ts.map +1 -1
- package/dist/abstract/Controller.js +1 -1
- package/dist/abstract/Model.d.ts +10 -9
- package/dist/abstract/Model.d.ts.map +1 -1
- package/dist/abstract/Model.js +92 -70
- package/dist/abstract/SchemaTableBuilder.d.ts +1 -1
- package/dist/abstract/SchemaTableBuilder.d.ts.map +1 -1
- package/dist/abstract/SchemaTableBuilder.js +8 -8
- package/dist/abstract/model/ModelRelation.d.ts +5 -4
- package/dist/abstract/model/ModelRelation.d.ts.map +1 -1
- package/dist/abstract/model/ModelRelation.js +35 -27
- package/dist/base/Query.d.ts +4 -8
- package/dist/base/Query.d.ts.map +1 -1
- package/dist/base/Query.js +91 -73
- package/dist/base/Record.d.ts +5 -4
- package/dist/base/Record.d.ts.map +1 -1
- package/dist/base/Record.js +44 -23
- package/dist/base/Table.d.ts +17 -14
- package/dist/base/Table.d.ts.map +1 -1
- package/dist/base/Table.js +123 -89
- package/dist/factories/ModelFactory.d.ts +7 -0
- package/dist/factories/ModelFactory.d.ts.map +1 -0
- package/dist/factories/ModelFactory.js +6 -0
- package/dist/factories/QueryFactory.d.ts +7 -0
- package/dist/factories/QueryFactory.d.ts.map +1 -0
- package/dist/factories/QueryFactory.js +6 -0
- package/dist/factories/RecordFactory.d.ts +8 -0
- package/dist/factories/RecordFactory.d.ts.map +1 -0
- package/dist/factories/RecordFactory.js +6 -0
- package/dist/factories/TableFactory.d.ts +7 -0
- package/dist/factories/TableFactory.d.ts.map +1 -0
- package/dist/factories/TableFactory.js +6 -0
- package/dist/helpers/Errors/AdapterErrors/AdapterNotFoundError.d.ts +2 -1
- package/dist/helpers/Errors/AdapterErrors/AdapterNotFoundError.d.ts.map +1 -1
- package/dist/helpers/Errors/AdapterErrors/AdapterNotFoundError.js +3 -3
- package/dist/helpers/Errors/AdapterErrors/ConnectionFailedError.d.ts +2 -1
- package/dist/helpers/Errors/AdapterErrors/ConnectionFailedError.d.ts.map +1 -1
- package/dist/helpers/Errors/AdapterErrors/ConnectionFailedError.js +3 -3
- package/dist/helpers/Errors/AdapterErrors/NoDefaultAdapterError.d.ts +2 -1
- package/dist/helpers/Errors/AdapterErrors/NoDefaultAdapterError.d.ts.map +1 -1
- package/dist/helpers/Errors/AdapterErrors/NoDefaultAdapterError.js +3 -3
- package/dist/helpers/Errors/DatabaseHandlerError.d.ts +9 -0
- package/dist/helpers/Errors/DatabaseHandlerError.d.ts.map +1 -0
- package/dist/helpers/Errors/DatabaseHandlerError.js +10 -0
- package/dist/helpers/Errors/ExpressionErrors/InvalidExpressionParametersError.d.ts +2 -1
- package/dist/helpers/Errors/ExpressionErrors/InvalidExpressionParametersError.d.ts.map +1 -1
- package/dist/helpers/Errors/ExpressionErrors/InvalidExpressionParametersError.js +5 -3
- package/dist/helpers/Errors/ExpressionErrors/UnknownExpressionTypeError.d.ts +2 -1
- package/dist/helpers/Errors/ExpressionErrors/UnknownExpressionTypeError.d.ts.map +1 -1
- package/dist/helpers/Errors/ExpressionErrors/UnknownExpressionTypeError.js +5 -3
- package/dist/helpers/Errors/ExpressionErrors/UnsupportedQueryPhaseError.d.ts +2 -1
- package/dist/helpers/Errors/ExpressionErrors/UnsupportedQueryPhaseError.d.ts.map +1 -1
- package/dist/helpers/Errors/ExpressionErrors/UnsupportedQueryPhaseError.js +3 -3
- package/dist/helpers/Errors/ModelErrors/InvalidOperationError.d.ts +5 -0
- package/dist/helpers/Errors/ModelErrors/InvalidOperationError.d.ts.map +1 -0
- package/dist/helpers/Errors/ModelErrors/InvalidOperationError.js +6 -0
- package/dist/helpers/Errors/ModelErrors/RecordNotFoundError.d.ts +6 -0
- package/dist/helpers/Errors/ModelErrors/RecordNotFoundError.d.ts.map +1 -0
- package/dist/helpers/Errors/ModelErrors/RecordNotFoundError.js +6 -0
- package/dist/helpers/Errors/ModelErrors/RelationError.d.ts +5 -0
- package/dist/helpers/Errors/ModelErrors/RelationError.d.ts.map +1 -0
- package/dist/helpers/Errors/ModelErrors/RelationError.js +6 -0
- package/dist/helpers/Errors/QueryErrors/InvalidWhereConditionError.d.ts +5 -0
- package/dist/helpers/Errors/QueryErrors/InvalidWhereConditionError.d.ts.map +1 -0
- package/dist/helpers/Errors/QueryErrors/InvalidWhereConditionError.js +6 -0
- package/dist/helpers/Errors/QueryErrors/QueryExecutionError.d.ts +5 -0
- package/dist/helpers/Errors/QueryErrors/QueryExecutionError.d.ts.map +1 -0
- package/dist/helpers/Errors/QueryErrors/QueryExecutionError.js +6 -0
- package/dist/helpers/Errors/QueryErrors/UnexpectedEmptyQueryError.d.ts +2 -1
- package/dist/helpers/Errors/QueryErrors/UnexpectedEmptyQueryError.d.ts.map +1 -1
- package/dist/helpers/Errors/QueryErrors/UnexpectedEmptyQueryError.js +3 -3
- package/dist/helpers/Errors/TableErrors/UnknownTableError.d.ts +3 -2
- package/dist/helpers/Errors/TableErrors/UnknownTableError.d.ts.map +1 -1
- package/dist/helpers/Errors/TableErrors/UnknownTableError.js +4 -4
- package/dist/helpers/QueryBuilders/BaseQueryBuilders/BaseSelectQueryBuilder.d.ts +2 -2
- package/dist/helpers/QueryBuilders/BaseQueryBuilders/BaseSelectQueryBuilder.d.ts.map +1 -1
- package/dist/helpers/QueryBuilders/BaseQueryBuilders/BaseSelectQueryBuilder.js +1 -1
- package/dist/helpers/QueryBuilders/ExpressionBuilders/JsonAggregateExpression.d.ts +3 -4
- package/dist/helpers/QueryBuilders/ExpressionBuilders/JsonAggregateExpression.d.ts.map +1 -1
- package/dist/helpers/QueryBuilders/ExpressionBuilders/JsonAggregateExpression.js +46 -44
- package/dist/helpers/QueryBuilders/ExpressionBuilders/SpatialDistanceExpression.d.ts +3 -4
- package/dist/helpers/QueryBuilders/ExpressionBuilders/SpatialDistanceExpression.d.ts.map +1 -1
- package/dist/helpers/QueryBuilders/ExpressionBuilders/SpatialDistanceExpression.js +34 -32
- package/dist/helpers/QueryBuilders/ExpressionBuilders/TextRelevanceExpression.d.ts +3 -4
- package/dist/helpers/QueryBuilders/ExpressionBuilders/TextRelevanceExpression.d.ts.map +1 -1
- package/dist/helpers/QueryBuilders/ExpressionBuilders/TextRelevanceExpression.js +9 -20
- package/dist/helpers/QueryBuilders/QueryDecorators/ExpressionDecorator.d.ts +4 -4
- package/dist/helpers/QueryBuilders/QueryDecorators/ExpressionDecorator.d.ts.map +1 -1
- package/dist/helpers/QueryBuilders/QueryDecorators/ExpressionDecorator.js +14 -17
- package/dist/helpers/QueryBuilders/QueryDecorators/GroupByDecorator.d.ts +3 -3
- package/dist/helpers/QueryBuilders/QueryDecorators/GroupByDecorator.d.ts.map +1 -1
- package/dist/helpers/QueryBuilders/QueryDecorators/GroupByDecorator.js +2 -2
- package/dist/helpers/QueryBuilders/QueryDecorators/JoinDecorator.d.ts +4 -4
- package/dist/helpers/QueryBuilders/QueryDecorators/JoinDecorator.d.ts.map +1 -1
- package/dist/helpers/QueryBuilders/QueryDecorators/JoinDecorator.js +17 -14
- package/dist/helpers/QueryBuilders/QueryDecorators/LimitDecorator.d.ts +3 -3
- package/dist/helpers/QueryBuilders/QueryDecorators/LimitDecorator.d.ts.map +1 -1
- package/dist/helpers/QueryBuilders/QueryDecorators/LimitDecorator.js +2 -2
- package/dist/helpers/QueryBuilders/QueryDecorators/OrderByDecorator.d.ts +3 -3
- package/dist/helpers/QueryBuilders/QueryDecorators/OrderByDecorator.d.ts.map +1 -1
- package/dist/helpers/QueryBuilders/QueryDecorators/OrderByDecorator.js +2 -2
- package/dist/helpers/QueryBuilders/QueryDecorators/QueryDecorator.d.ts +2 -2
- package/dist/helpers/QueryBuilders/QueryDecorators/QueryDecorator.d.ts.map +1 -1
- package/dist/helpers/QueryBuilders/QueryDecorators/QueryDecorator.js +1 -1
- package/dist/helpers/QueryBuilders/QueryDecorators/WhereDecorator.d.ts +5 -5
- package/dist/helpers/QueryBuilders/QueryDecorators/WhereDecorator.d.ts.map +1 -1
- package/dist/helpers/QueryBuilders/QueryDecorators/WhereDecorator.js +3 -4
- package/dist/helpers/QueryBuilders/QueryExpressionBuilder.d.ts +1 -3
- package/dist/helpers/QueryBuilders/QueryExpressionBuilder.d.ts.map +1 -1
- package/dist/helpers/QueryBuilders/QueryExpressionBuilder.js +4 -22
- package/dist/helpers/QueryBuilders/QueryStatementBuilder.d.ts +3 -4
- package/dist/helpers/QueryBuilders/QueryStatementBuilder.d.ts.map +1 -1
- package/dist/helpers/QueryBuilders/QueryStatementBuilder.js +59 -45
- package/dist/helpers/QueryBuilders/{SqlRenderer.d.ts → SqlGenerator.d.ts} +3 -3
- package/dist/helpers/QueryBuilders/SqlGenerator.d.ts.map +1 -0
- package/dist/helpers/QueryBuilders/{SqlRenderer.js → SqlGenerator.js} +30 -19
- package/dist/helpers/QueryBuilders/{oldQueryStatementBuilder.d.ts → depricatedQueryStatementBuilder.d.ts} +19 -46
- package/dist/helpers/QueryBuilders/depricatedQueryStatementBuilder.d.ts.map +1 -0
- package/dist/helpers/QueryBuilders/{oldQueryStatementBuilder.js → depricatedQueryStatementBuilder.js} +31 -67
- package/dist/index.d.ts +13 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/dist/interfaces/IController.d.ts +1 -1
- package/dist/interfaces/IController.d.ts.map +1 -1
- package/dist/interfaces/IDatabaseAdapter.d.ts +2 -2
- package/dist/interfaces/IDatabaseAdapter.d.ts.map +1 -1
- package/dist/interfaces/IExpressionBuilder.d.ts +1 -2
- package/dist/interfaces/IExpressionBuilder.d.ts.map +1 -1
- package/dist/interfaces/IFactory.d.ts +4 -0
- package/dist/interfaces/IFactory.d.ts.map +1 -0
- package/dist/interfaces/IFactory.js +1 -0
- package/dist/interfaces/IMigration.d.ts +4 -4
- package/dist/interfaces/IMigration.d.ts.map +1 -1
- package/dist/interfaces/IQueryBuilder.d.ts +1 -1
- package/dist/interfaces/IQueryBuilder.d.ts.map +1 -1
- package/dist/interfaces/ISchemaBuilder.d.ts +2 -2
- package/dist/interfaces/ISchemaBuilder.d.ts.map +1 -1
- package/dist/interfaces/IStatementAdapter.d.ts +1 -1
- package/dist/interfaces/IStatementAdapter.d.ts.map +1 -1
- package/dist/runtime/Container.d.ts +2 -3
- package/dist/runtime/Container.d.ts.map +1 -1
- package/dist/runtime/Container.js +3 -4
- package/dist/runtime/QueryCache.d.ts +1 -1
- package/dist/runtime/QueryCache.d.ts.map +1 -1
- package/dist/runtime/QueryCache.js +1 -1
- package/dist/runtime/Repository.d.ts +23 -12
- package/dist/runtime/Repository.d.ts.map +1 -1
- package/dist/runtime/Repository.js +324 -65
- package/dist/types/expressions.d.ts +12 -47
- package/dist/types/expressions.d.ts.map +1 -1
- package/dist/types/expressions.js +1 -6
- package/dist/types/factories.d.ts +5 -3
- package/dist/types/factories.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/model.d.ts +5 -23
- package/dist/types/model.d.ts.map +1 -1
- package/dist/types/query.d.ts +5 -4
- package/dist/types/query.d.ts.map +1 -1
- package/dist/types/record.d.ts +11 -0
- package/dist/types/record.d.ts.map +1 -0
- package/dist/types/record.js +1 -0
- package/dist/types/repository.d.ts +8 -0
- package/dist/types/repository.d.ts.map +1 -0
- package/dist/types/repository.js +1 -0
- package/dist/types/table.d.ts +9 -1
- package/dist/types/table.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/helpers/QueryBuilders/SqlRenderer.d.ts.map +0 -1
- package/dist/helpers/QueryBuilders/oldQueryStatementBuilder.d.ts.map +0 -1
package/dist/base/Table.js
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
|
-
import QueryStatementBuilder from
|
|
2
|
-
import {
|
|
1
|
+
import { QueryStatementBuilder } from '../helpers/QueryBuilders/QueryStatementBuilder.js';
|
|
2
|
+
import { QueryFactory } from '../factories/QueryFactory.js';
|
|
3
|
+
import { RecordFactory } from '../factories/RecordFactory.js';
|
|
4
|
+
import { InvalidOperationError } from '../helpers/Errors/ModelErrors/InvalidOperationError.js';
|
|
3
5
|
/** Table class for interacting with a database table */
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
export class Table {
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// CONSTRUCTOR & INITIALIZATION
|
|
9
|
+
// ============================================================================
|
|
10
|
+
/** Private constructor - use TableFactory.create() */
|
|
11
|
+
constructor({ name, adapter, queryFactory = new QueryFactory(), recordFactory = new RecordFactory(), }) {
|
|
7
12
|
this._name = name;
|
|
8
|
-
this.
|
|
13
|
+
this._adapter = adapter;
|
|
9
14
|
this._queryFactory = queryFactory;
|
|
10
15
|
this._recordFactory = recordFactory;
|
|
11
|
-
this._query = this._queryFactory({
|
|
16
|
+
this._query = this._queryFactory.create({
|
|
12
17
|
tableName: this._name,
|
|
13
|
-
adapterName: this.
|
|
14
|
-
recordFactory: this._recordFactory
|
|
18
|
+
adapterName: this._adapter,
|
|
19
|
+
recordFactory: this._recordFactory,
|
|
15
20
|
});
|
|
16
21
|
}
|
|
17
|
-
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// GETTERS & ACCESSORS
|
|
24
|
+
// ============================================================================
|
|
25
|
+
get QueryHelperClient() {
|
|
18
26
|
return this._query;
|
|
19
27
|
}
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// SCHEMA & TABLE INFORMATION
|
|
30
|
+
// ============================================================================
|
|
20
31
|
/** Get raw column information */
|
|
21
32
|
async TableColumnInformation(tableName) {
|
|
22
33
|
return this._query.TableColumnInformation(tableName || this._name);
|
|
@@ -32,38 +43,33 @@ export default class Table {
|
|
|
32
43
|
defaultValue: col.dflt_value,
|
|
33
44
|
}));
|
|
34
45
|
}
|
|
35
|
-
async
|
|
36
|
-
const
|
|
37
|
-
const query = this._queryFactory({
|
|
46
|
+
async exists() {
|
|
47
|
+
const query = this._queryFactory.create({
|
|
38
48
|
tableName: this._name,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
recordFactory: this._recordFactory
|
|
49
|
+
adapterName: this._adapter,
|
|
50
|
+
recordFactory: this._recordFactory,
|
|
42
51
|
});
|
|
43
|
-
await query.
|
|
52
|
+
return await query.DoesTableExist();
|
|
44
53
|
}
|
|
54
|
+
// ============================================================================
|
|
55
|
+
// READ OPERATIONS
|
|
56
|
+
// ============================================================================
|
|
45
57
|
/** Fetch records with optional filtering, ordering, and pagination */
|
|
46
|
-
async
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
let params = {};
|
|
51
|
-
if (((_a = queryLayers === null || queryLayers === void 0 ? void 0 : queryLayers.base) === null || _a === void 0 ? void 0 : _a.where) && Object.keys(queryLayers.base.where).length > 0)
|
|
52
|
-
params = queryLayers.base.where;
|
|
53
|
-
if (((_b = queryLayers === null || queryLayers === void 0 ? void 0 : queryLayers.pretty) === null || _b === void 0 ? void 0 : _b.where) && Object.keys(queryLayers.pretty.where).length > 0)
|
|
54
|
-
params = { ...params, ...queryLayers.pretty.where };
|
|
55
|
-
const query = this._queryFactory({
|
|
58
|
+
async FetchRecords(queryLayers) {
|
|
59
|
+
const queryStr = await this.buildSelectQuery(queryLayers);
|
|
60
|
+
const params = this.extractWhereParameters(queryLayers);
|
|
61
|
+
const query = this._queryFactory.create({
|
|
56
62
|
tableName: this._name,
|
|
57
63
|
query: queryStr,
|
|
58
64
|
parameters: params,
|
|
59
|
-
recordFactory: this._recordFactory
|
|
65
|
+
recordFactory: this._recordFactory,
|
|
60
66
|
});
|
|
61
67
|
const results = await query.All();
|
|
62
68
|
return results;
|
|
63
69
|
}
|
|
64
70
|
/** Fetch a single record from the table */
|
|
65
|
-
async
|
|
66
|
-
const results = await this.
|
|
71
|
+
async FetchSingleRecord(queryLayers) {
|
|
72
|
+
const results = await this.FetchRecords({
|
|
67
73
|
...queryLayers,
|
|
68
74
|
final: {
|
|
69
75
|
...queryLayers === null || queryLayers === void 0 ? void 0 : queryLayers.final,
|
|
@@ -74,35 +80,91 @@ export default class Table {
|
|
|
74
80
|
}
|
|
75
81
|
/** Get the total count of records */
|
|
76
82
|
async RecordsCount() {
|
|
77
|
-
const query = this._queryFactory({
|
|
83
|
+
const query = this._queryFactory.create({
|
|
78
84
|
tableName: this._name,
|
|
79
85
|
query: `SELECT COUNT(*) as count FROM "${this._name}"`,
|
|
80
|
-
recordFactory: this._recordFactory
|
|
86
|
+
recordFactory: this._recordFactory,
|
|
81
87
|
});
|
|
82
88
|
const count = await query.Count();
|
|
83
89
|
return count || 0;
|
|
84
90
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
adapterName: this._customAdapter,
|
|
89
|
-
recordFactory: this._recordFactory
|
|
90
|
-
});
|
|
91
|
-
return await query.DoesTableExist();
|
|
92
|
-
}
|
|
91
|
+
// ============================================================================
|
|
92
|
+
// WRITE OPERATIONS
|
|
93
|
+
// ============================================================================
|
|
93
94
|
/** Insert a record into the table */
|
|
94
|
-
async
|
|
95
|
-
const record = this._recordFactory(
|
|
95
|
+
async CreateRecord(values) {
|
|
96
|
+
const record = this._recordFactory.create({
|
|
97
|
+
table: this._name,
|
|
98
|
+
values,
|
|
99
|
+
adapter: this._adapter,
|
|
100
|
+
});
|
|
96
101
|
await record.Insert();
|
|
97
102
|
return record;
|
|
98
103
|
}
|
|
104
|
+
async Drop() {
|
|
105
|
+
const queryStr = `DROP TABLE IF EXISTS "${this._name}";`;
|
|
106
|
+
const query = this._queryFactory.create({
|
|
107
|
+
tableName: this._name,
|
|
108
|
+
query: queryStr,
|
|
109
|
+
adapterName: this._adapter,
|
|
110
|
+
recordFactory: this._recordFactory,
|
|
111
|
+
});
|
|
112
|
+
await query.Run();
|
|
113
|
+
}
|
|
114
|
+
// ============================================================================
|
|
115
|
+
// JOIN OPERATIONS
|
|
116
|
+
// ============================================================================
|
|
99
117
|
/** Perform JOIN operations with other tables */
|
|
100
|
-
async
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
118
|
+
async FetchJoined(queryLayers) {
|
|
119
|
+
if (queryLayers.base.joins === undefined ||
|
|
120
|
+
(Array.isArray(queryLayers.base.joins) &&
|
|
121
|
+
queryLayers.base.joins.length === 0)) {
|
|
122
|
+
throw new InvalidOperationError('No joins defined for the Join operation.');
|
|
123
|
+
}
|
|
124
|
+
const joinedTables = queryLayers.base.joins.map((j) => j.fromTable);
|
|
125
|
+
const tableColumnCache = await this.fetchSchemaInformation(joinedTables);
|
|
126
|
+
const queryString = await this.buildSelectQuery(queryLayers, tableColumnCache);
|
|
127
|
+
const params = this.extractWhereParameters(queryLayers);
|
|
128
|
+
const query = this._queryFactory.create({
|
|
129
|
+
tableName: this._name,
|
|
130
|
+
query: queryString,
|
|
131
|
+
parameters: params,
|
|
132
|
+
recordFactory: this._recordFactory,
|
|
133
|
+
});
|
|
134
|
+
const records = await query.All();
|
|
135
|
+
const splitTables = await this.mapJoinedResults(records, joinedTables);
|
|
136
|
+
return splitTables;
|
|
137
|
+
}
|
|
138
|
+
// ============================================================================
|
|
139
|
+
// UTILITY METHODS
|
|
140
|
+
// ============================================================================
|
|
141
|
+
async toSql(queryLayers) {
|
|
142
|
+
let tableColumnCache = undefined;
|
|
143
|
+
if (queryLayers.base.joins && queryLayers.base.joins.length > 0) {
|
|
144
|
+
const joinedTables = queryLayers.base.joins.map((j) => j.fromTable);
|
|
145
|
+
tableColumnCache = await this.fetchSchemaInformation(joinedTables);
|
|
104
146
|
}
|
|
105
|
-
|
|
147
|
+
return await this.buildSelectQuery(queryLayers, tableColumnCache);
|
|
148
|
+
}
|
|
149
|
+
// ============================================================================
|
|
150
|
+
// PRIVATE HELPERS
|
|
151
|
+
// ============================================================================
|
|
152
|
+
async buildSelectQuery(queryLayers, tableColumnCache) {
|
|
153
|
+
const builder = new QueryStatementBuilder(queryLayers, tableColumnCache);
|
|
154
|
+
return await builder.build();
|
|
155
|
+
}
|
|
156
|
+
extractWhereParameters(queryLayers) {
|
|
157
|
+
var _a, _b;
|
|
158
|
+
let params = {};
|
|
159
|
+
if (((_a = queryLayers === null || queryLayers === void 0 ? void 0 : queryLayers.base) === null || _a === void 0 ? void 0 : _a.where) &&
|
|
160
|
+
Object.keys(queryLayers.base.where).length > 0)
|
|
161
|
+
params = queryLayers.base.where;
|
|
162
|
+
if (((_b = queryLayers === null || queryLayers === void 0 ? void 0 : queryLayers.pretty) === null || _b === void 0 ? void 0 : _b.where) &&
|
|
163
|
+
Object.keys(queryLayers.pretty.where).length > 0)
|
|
164
|
+
params = { ...params, ...queryLayers.pretty.where };
|
|
165
|
+
return params;
|
|
166
|
+
}
|
|
167
|
+
async fetchSchemaInformation(joinedTables) {
|
|
106
168
|
const tableColumnCache = new Map();
|
|
107
169
|
const columnInfo = await this._query.TableColumnInformation(this._name);
|
|
108
170
|
tableColumnCache.set(this._name, columnInfo);
|
|
@@ -110,25 +172,10 @@ export default class Table {
|
|
|
110
172
|
const columnInfo = await this._query.TableColumnInformation(tableName);
|
|
111
173
|
tableColumnCache.set(tableName, columnInfo);
|
|
112
174
|
}
|
|
113
|
-
|
|
114
|
-
const queryString = await builder.build();
|
|
115
|
-
let params = {};
|
|
116
|
-
if ((_a = queryLayers === null || queryLayers === void 0 ? void 0 : queryLayers.base) === null || _a === void 0 ? void 0 : _a.where)
|
|
117
|
-
params = this.QueryHelperObject.ConvertParamsToObject(queryLayers.base.where);
|
|
118
|
-
if ((_b = queryLayers === null || queryLayers === void 0 ? void 0 : queryLayers.pretty) === null || _b === void 0 ? void 0 : _b.where)
|
|
119
|
-
params = { ...params, ...this.QueryHelperObject.ConvertParamsToObject(queryLayers.pretty.where) };
|
|
120
|
-
const query = this._queryFactory({
|
|
121
|
-
tableName: this._name,
|
|
122
|
-
query: queryString,
|
|
123
|
-
parameters: params,
|
|
124
|
-
recordFactory: this._recordFactory
|
|
125
|
-
});
|
|
126
|
-
const records = await query.All();
|
|
127
|
-
const splitTables = await this.splitJoinValues(records, joinedTables, queryLayers.base.joins);
|
|
128
|
-
return splitTables;
|
|
175
|
+
return tableColumnCache;
|
|
129
176
|
}
|
|
130
|
-
async
|
|
131
|
-
return records.map(record => {
|
|
177
|
+
async mapJoinedResults(records, joinedTables) {
|
|
178
|
+
return records.map((record) => {
|
|
132
179
|
var _a;
|
|
133
180
|
if (!record.values)
|
|
134
181
|
return record;
|
|
@@ -141,10 +188,8 @@ export default class Table {
|
|
|
141
188
|
mainTableData[columnName] = value;
|
|
142
189
|
}
|
|
143
190
|
else if (joinedTables.includes(tableName)) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
(_a = joinedTableData[aliasedTableName]) !== null && _a !== void 0 ? _a : (joinedTableData[aliasedTableName] = {});
|
|
147
|
-
joinedTableData[aliasedTableName][columnName] = value;
|
|
191
|
+
(_a = joinedTableData[tableName]) !== null && _a !== void 0 ? _a : (joinedTableData[tableName] = {});
|
|
192
|
+
joinedTableData[tableName][columnName] = value;
|
|
148
193
|
}
|
|
149
194
|
}
|
|
150
195
|
else {
|
|
@@ -154,26 +199,15 @@ export default class Table {
|
|
|
154
199
|
const filteredJoinedData = Object.fromEntries(
|
|
155
200
|
// eslint-disable-next-line no-unused-vars
|
|
156
201
|
Object.entries(joinedTableData).filter(([_, data]) => Object.keys(data).length > 0));
|
|
157
|
-
const combinedData = {
|
|
158
|
-
|
|
202
|
+
const combinedData = {
|
|
203
|
+
...mainTableData,
|
|
204
|
+
...filteredJoinedData,
|
|
205
|
+
};
|
|
206
|
+
return this._recordFactory.create({
|
|
207
|
+
table: this._name,
|
|
208
|
+
values: combinedData,
|
|
209
|
+
adapter: this._adapter,
|
|
210
|
+
});
|
|
159
211
|
});
|
|
160
212
|
}
|
|
161
|
-
async toSql(queryLayers) {
|
|
162
|
-
if (queryLayers.base.joins && queryLayers.base.joins.length > 0) {
|
|
163
|
-
const joinedTables = queryLayers.base.joins.map(j => j.fromTable);
|
|
164
|
-
const tableColumnCache = new Map();
|
|
165
|
-
const columnInfo = await this._query.TableColumnInformation(this._name);
|
|
166
|
-
tableColumnCache.set(this._name, columnInfo);
|
|
167
|
-
for (const tableName of joinedTables) {
|
|
168
|
-
const columnInfo = await this._query.TableColumnInformation(tableName);
|
|
169
|
-
tableColumnCache.set(tableName, columnInfo);
|
|
170
|
-
}
|
|
171
|
-
const builder = new QueryStatementBuilder(queryLayers, tableColumnCache);
|
|
172
|
-
return await builder.build();
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
const builder = new QueryStatementBuilder(queryLayers);
|
|
176
|
-
return await builder.build();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
213
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Model } from '../abstract/Model';
|
|
2
|
+
import { IFactory } from '../interfaces/IFactory';
|
|
3
|
+
import { columnType } from '../types/index';
|
|
4
|
+
export declare class ModelFactory<ModelColumnType extends columnType, ModelType extends Model<ModelColumnType>, ModelConstructorType extends new () => ModelType> implements IFactory<ModelType, ModelConstructorType> {
|
|
5
|
+
create(model: ModelConstructorType): ModelType;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=ModelFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelFactory.d.ts","sourceRoot":"","sources":["../../src/factories/ModelFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,qBAAa,YAAY,CACvB,eAAe,SAAS,UAAU,EAClC,SAAS,SAAS,KAAK,CAAC,eAAe,CAAC,EACxC,oBAAoB,SAAS,UAAU,SAAS,CAChD,YAAW,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC;IACpD,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,SAAS;CAG/C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Query } from '../base/Query.js';
|
|
2
|
+
import { QueryConstructorType } from '../types/index';
|
|
3
|
+
import { IFactory } from '../interfaces/IFactory.js';
|
|
4
|
+
export declare class QueryFactory implements IFactory<Query, QueryConstructorType> {
|
|
5
|
+
create(props: QueryConstructorType): Query;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=QueryFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryFactory.d.ts","sourceRoot":"","sources":["../../src/factories/QueryFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,qBAAa,YAAa,YAAW,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACxE,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,KAAK;CAG3C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Record } from '../base/Record.js';
|
|
2
|
+
import { RecordConstructorType } from '../types/record.js';
|
|
3
|
+
import { IFactory } from '../interfaces/IFactory.js';
|
|
4
|
+
import { columnType } from '../types/table.js';
|
|
5
|
+
export declare class RecordFactory<ColumnValuesType extends columnType> implements IFactory<Record<ColumnValuesType>, RecordConstructorType<ColumnValuesType>> {
|
|
6
|
+
create(props: RecordConstructorType<ColumnValuesType>): Record<ColumnValuesType>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=RecordFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordFactory.d.ts","sourceRoot":"","sources":["../../src/factories/RecordFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,qBAAa,aAAa,CACxB,gBAAgB,SAAS,UAAU,CACnC,YAAW,QAAQ,CACnB,MAAM,CAAC,gBAAgB,CAAC,EACxB,qBAAqB,CAAC,gBAAgB,CAAC,CACxC;IACC,MAAM,CACJ,KAAK,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,GAC7C,MAAM,CAAC,gBAAgB,CAAC;CAG5B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Table } from '../base/Table.js';
|
|
2
|
+
import { TableConstructorType } from '../types/table.js';
|
|
3
|
+
import { IFactory } from '../interfaces/IFactory.js';
|
|
4
|
+
export declare class TableFactory implements IFactory<Table, TableConstructorType> {
|
|
5
|
+
create(props: TableConstructorType): Table;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=TableFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableFactory.d.ts","sourceRoot":"","sources":["../../src/factories/TableFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,qBAAa,YAAa,YAAW,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACxE,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,KAAK;CAG3C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
export declare class AdapterNotFoundError extends DatabaseHandlerError {
|
|
2
3
|
constructor(adapterName: string);
|
|
3
4
|
}
|
|
4
5
|
//# sourceMappingURL=AdapterNotFoundError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdapterNotFoundError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/AdapterErrors/AdapterNotFoundError.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"AdapterNotFoundError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/AdapterErrors/AdapterNotFoundError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,qBAAa,oBAAqB,SAAQ,oBAAoB;gBAChD,WAAW,EAAE,MAAM;CAGhC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
export class AdapterNotFoundError extends DatabaseHandlerError {
|
|
2
3
|
constructor(adapterName) {
|
|
3
|
-
super(`Adapter not found: ${adapterName}
|
|
4
|
-
this.name = "AdapterNotFoundError";
|
|
4
|
+
super(`Adapter not found: ${adapterName}`, { code: 'ADAPTER_NOT_FOUND' });
|
|
5
5
|
}
|
|
6
6
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
export declare class ConnectionFailedError extends DatabaseHandlerError {
|
|
2
3
|
constructor(details: string);
|
|
3
4
|
}
|
|
4
5
|
//# sourceMappingURL=ConnectionFailedError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionFailedError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/AdapterErrors/ConnectionFailedError.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"ConnectionFailedError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/AdapterErrors/ConnectionFailedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,qBAAa,qBAAsB,SAAQ,oBAAoB;gBACjD,OAAO,EAAE,MAAM;CAG5B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
export class ConnectionFailedError extends DatabaseHandlerError {
|
|
2
3
|
constructor(details) {
|
|
3
|
-
super(`Connection failed: ${details}
|
|
4
|
-
this.name = "ConnectionFailedError";
|
|
4
|
+
super(`Connection failed: ${details}`, { code: 'CONNECTION_FAILED' });
|
|
5
5
|
}
|
|
6
6
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
export declare class NoDefaultAdapterError extends DatabaseHandlerError {
|
|
2
3
|
constructor();
|
|
3
4
|
}
|
|
4
5
|
//# sourceMappingURL=NoDefaultAdapterError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoDefaultAdapterError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/AdapterErrors/NoDefaultAdapterError.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"NoDefaultAdapterError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/AdapterErrors/NoDefaultAdapterError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,qBAAa,qBAAsB,SAAQ,oBAAoB;;CAI9D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
export class NoDefaultAdapterError extends DatabaseHandlerError {
|
|
2
3
|
constructor() {
|
|
3
|
-
super(
|
|
4
|
-
this.name = "NoDefaultAdapterError";
|
|
4
|
+
super('No default adapter set', { code: 'NO_DEFAULT_ADAPTER' });
|
|
5
5
|
}
|
|
6
6
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatabaseHandlerError.d.ts","sourceRoot":"","sources":["../../../src/helpers/Errors/DatabaseHandlerError.ts"],"names":[],"mappings":"AAAA,qBAAa,oBAAqB,SAAQ,KAAK;IACpC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;gBAET,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;CAS5E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class DatabaseHandlerError extends Error {
|
|
2
|
+
constructor(message, options) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = this.constructor.name;
|
|
5
|
+
this.cause = options === null || options === void 0 ? void 0 : options.cause;
|
|
6
|
+
this.code = options === null || options === void 0 ? void 0 : options.code;
|
|
7
|
+
// Ensure the prototype is correctly set for extending Error in TypeScript
|
|
8
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
export declare class InvalidExpressionParametersError extends DatabaseHandlerError {
|
|
2
3
|
constructor(message: string);
|
|
3
4
|
}
|
|
4
5
|
//# sourceMappingURL=InvalidExpressionParametersError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvalidExpressionParametersError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/ExpressionErrors/InvalidExpressionParametersError.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"InvalidExpressionParametersError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/ExpressionErrors/InvalidExpressionParametersError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,qBAAa,gCAAiC,SAAQ,oBAAoB;gBAC5D,OAAO,EAAE,MAAM;CAK5B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
export class InvalidExpressionParametersError extends DatabaseHandlerError {
|
|
2
3
|
constructor(message) {
|
|
3
|
-
super(`Invalid expression parameters: ${message}
|
|
4
|
-
|
|
4
|
+
super(`Invalid expression parameters: ${message}`, {
|
|
5
|
+
code: 'INVALID_EXPRESSION_PARAMETERS',
|
|
6
|
+
});
|
|
5
7
|
}
|
|
6
8
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
export declare class UnknownExpressionTypeError extends DatabaseHandlerError {
|
|
2
3
|
constructor(type: string);
|
|
3
4
|
}
|
|
4
5
|
//# sourceMappingURL=UnknownExpressionTypeError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnknownExpressionTypeError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/ExpressionErrors/UnknownExpressionTypeError.ts"],"names":[],"mappings":"AAAA,qBAAa,0BAA2B,SAAQ,
|
|
1
|
+
{"version":3,"file":"UnknownExpressionTypeError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/ExpressionErrors/UnknownExpressionTypeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,qBAAa,0BAA2B,SAAQ,oBAAoB;gBACtD,IAAI,EAAE,MAAM;CAKzB"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
export class UnknownExpressionTypeError extends DatabaseHandlerError {
|
|
2
3
|
constructor(type) {
|
|
3
|
-
super(`No builder registered for expression type: ${type}
|
|
4
|
-
|
|
4
|
+
super(`No builder registered for expression type: ${type}`, {
|
|
5
|
+
code: 'UNKNOWN_EXPRESSION_TYPE',
|
|
6
|
+
});
|
|
5
7
|
}
|
|
6
8
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
export declare class UnsupportedQueryPhaseError extends DatabaseHandlerError {
|
|
2
3
|
constructor(phase?: string);
|
|
3
4
|
}
|
|
4
5
|
//# sourceMappingURL=UnsupportedQueryPhaseError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnsupportedQueryPhaseError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/ExpressionErrors/UnsupportedQueryPhaseError.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"UnsupportedQueryPhaseError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/ExpressionErrors/UnsupportedQueryPhaseError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,qBAAa,0BAA2B,SAAQ,oBAAoB;gBACtD,KAAK,CAAC,EAAE,MAAM;CAM3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
export class UnsupportedQueryPhaseError extends DatabaseHandlerError {
|
|
2
3
|
constructor(phase) {
|
|
3
|
-
super(`The query evaluation phase "${phase}" is not supported by this expression
|
|
4
|
-
this.name = "UnsupportedQueryPhaseError";
|
|
4
|
+
super(`The query evaluation phase "${phase}" is not supported by this expression.`, { code: 'UNSUPPORTED_QUERY_PHASE' });
|
|
5
5
|
}
|
|
6
6
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidOperationError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/ModelErrors/InvalidOperationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,qBAAa,qBAAsB,SAAQ,oBAAoB;gBAC/C,OAAO,EAAE,MAAM;CAG9B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
import { QueryValues } from '../../../types/index.js';
|
|
3
|
+
export declare class RecordNotFoundError extends DatabaseHandlerError {
|
|
4
|
+
constructor(identifier: QueryValues | undefined, table: string);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=RecordNotFoundError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordNotFoundError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/ModelErrors/RecordNotFoundError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,qBAAa,mBAAoB,SAAQ,oBAAoB;gBAC/C,UAAU,EAAE,WAAW,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM;CAM/D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DatabaseHandlerError } from '../DatabaseHandlerError.js';
|
|
2
|
+
export class RecordNotFoundError extends DatabaseHandlerError {
|
|
3
|
+
constructor(identifier, table) {
|
|
4
|
+
super(`No record found in table '${table}' matching identifier '${identifier}'`, { code: 'RECORD_NOT_FOUND' });
|
|
5
|
+
}
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelationError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/ModelErrors/RelationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,qBAAa,aAAc,SAAQ,oBAAoB;gBACvC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAGjD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DatabaseHandlerError } from "../DatabaseHandlerError.js";
|
|
2
|
+
export class RelationError extends DatabaseHandlerError {
|
|
3
|
+
constructor(relation, message) {
|
|
4
|
+
super(`Error in relation '${relation}'${message ? `: ${message}` : ''}`, { code: 'RELATION_ERROR' });
|
|
5
|
+
}
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidWhereConditionError.d.ts","sourceRoot":"","sources":["../../../../src/helpers/Errors/QueryErrors/InvalidWhereConditionError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,qBAAa,0BAA2B,SAAQ,oBAAoB;gBACtD,OAAO,GAAE,MAA+C;CAGrE"}
|