@oino-ts/types 0.21.2 → 1.0.0
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/blob/src/OINOBlob.d.ts +78 -0
- package/blob/src/OINOBlobApi.d.ts +49 -0
- package/blob/src/OINOBlobConstants.d.ts +37 -0
- package/blob/src/OINOBlobDataModel.d.ts +33 -0
- package/blob/src/OINOBlobFactory.d.ts +40 -0
- package/blob/src/index.d.ts +5 -0
- package/blob-aws/src/OINOBlobAwsS3.d.ts +90 -0
- package/blob-aws/src/index.d.ts +1 -0
- package/blob-azure/src/OINOBlobAzureTable.d.ts +86 -0
- package/blob-azure/src/index.d.ts +1 -0
- package/common/src/OINOApi.d.ts +191 -0
- package/common/src/OINOConfig.d.ts +63 -0
- package/common/src/OINOConstants.d.ts +51 -0
- package/common/src/OINODataField.d.ts +209 -0
- package/common/src/OINODataModel.d.ts +78 -0
- package/common/src/OINODataSource.d.ts +184 -0
- package/common/src/OINOHtmlTemplate.d.ts +1 -1
- package/common/src/OINOModelSet.d.ts +64 -0
- package/common/src/OINOParser.d.ts +42 -0
- package/common/src/OINOQueryParams.d.ts +270 -0
- package/common/src/OINORequest.d.ts +4 -1
- package/common/src/OINOResult.d.ts +1 -1
- package/common/src/OINOStr.d.ts +1 -1
- package/common/src/OINOSwagger.d.ts +25 -0
- package/common/src/index.d.ts +14 -31
- package/db/src/OINODb.d.ts +55 -0
- package/db/src/OINODbApi.d.ts +78 -0
- package/db/src/OINODbConfig.d.ts +56 -0
- package/db/src/OINODbConstants.d.ts +23 -0
- package/db/src/OINODbDataField.d.ts +210 -0
- package/db/src/OINODbDataModel.d.ts +55 -0
- package/db/src/OINODbDataSet.d.ts +95 -0
- package/db/src/OINODbFactory.d.ts +34 -0
- package/db/src/OINODbModelSet.d.ts +62 -0
- package/db/src/OINODbParser.d.ts +42 -0
- package/db/src/OINODbQueryParams.d.ts +72 -0
- package/db/src/OINODbRequestParams.d.ts +146 -0
- package/db/src/OINODbSqlParams.d.ts +296 -0
- package/db/src/OINODbSwagger.d.ts +25 -0
- package/db/src/index.d.ts +6 -0
- package/db-bunsqlite/src/OINODbBunSqlite.d.ts +99 -0
- package/db-bunsqlite/src/index.d.ts +1 -0
- package/db-mariadb/src/OINODbMariadb.d.ts +99 -0
- package/db-mariadb/src/index.d.ts +1 -0
- package/db-mssql/src/OINODbMsSql.d.ts +116 -0
- package/db-mssql/src/index.d.ts +1 -0
- package/db-postgresql/src/OINODbPostgresql.d.ts +95 -0
- package/db-postgresql/src/index.d.ts +1 -0
- package/hashid/src/OINOHashid.d.ts +42 -0
- package/hashid/src/index.d.ts +1 -0
- package/index.d.ts +7 -7
- package/nosql/src/OINONoSql.d.ts +81 -0
- package/nosql/src/OINONoSqlApi.d.ts +67 -0
- package/nosql/src/OINONoSqlConstants.d.ts +34 -0
- package/nosql/src/OINONoSqlDataModel.d.ts +29 -0
- package/nosql/src/OINONoSqlFactory.d.ts +40 -0
- package/nosql/src/index.d.ts +5 -0
- package/nosql-aws/src/OINONoSqlAwsDynamo.d.ts +223 -0
- package/nosql-aws/src/index.d.ts +1 -0
- package/nosql-azure/src/OINONoSqlAzureTable.d.ts +130 -0
- package/nosql-azure/src/index.d.ts +1 -0
- package/package.json +28 -28
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { OINODbDataModel } from "./index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Supported logical conjunctions in filter predicates.
|
|
4
|
+
* @enum
|
|
5
|
+
*/
|
|
6
|
+
export declare enum OINODbSqlBooleanOperation {
|
|
7
|
+
and = "and",
|
|
8
|
+
or = "or",
|
|
9
|
+
not = "not"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Supported logical conjunctions in filter predicates.
|
|
13
|
+
* @enum
|
|
14
|
+
*/
|
|
15
|
+
export declare enum OINODbSqlComparison {
|
|
16
|
+
lt = "lt",
|
|
17
|
+
le = "le",
|
|
18
|
+
eq = "eq",
|
|
19
|
+
ge = "ge",
|
|
20
|
+
gt = "gt",
|
|
21
|
+
like = "like"
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Class for recursively parsing of filters and printing them as SQL conditions.
|
|
25
|
+
* Supports three types of statements
|
|
26
|
+
* - comparison: (field)-lt|le|eq|ge|gt|like(value)
|
|
27
|
+
* - negation: -not(filter)
|
|
28
|
+
* - conjunction/disjunction: (filter)-and|or(filter)
|
|
29
|
+
* Supported conditions are comparisons (<, <=, =, >=, >) and substring match (LIKE).
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export declare class OINODbSqlFilter {
|
|
33
|
+
private static _booleanOperationRegex;
|
|
34
|
+
private static _negationRegex;
|
|
35
|
+
private static _filterComparisonRegex;
|
|
36
|
+
private _leftSide;
|
|
37
|
+
private _rightSide;
|
|
38
|
+
private _operator;
|
|
39
|
+
/**
|
|
40
|
+
* Constructor of `OINODbSqlFilter`
|
|
41
|
+
* @param leftSide left side of the filter, either another filter or a column name
|
|
42
|
+
* @param operation operation of the filter, either `OINODbSqlComparison` or `OINODbSqlBooleanOperation`
|
|
43
|
+
* @param rightSide right side of the filter, either another filter or a value
|
|
44
|
+
*/
|
|
45
|
+
constructor(leftSide: OINODbSqlFilter | string, operation: OINODbSqlComparison | OINODbSqlBooleanOperation | null, rightSide: OINODbSqlFilter | string);
|
|
46
|
+
/**
|
|
47
|
+
* Constructor for `OINOFilter` as parser of http parameter.
|
|
48
|
+
*
|
|
49
|
+
* @param filterString string representation of filter from HTTP-request
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
static parse(filterString: string): OINODbSqlFilter;
|
|
53
|
+
/**
|
|
54
|
+
* Construct a new `OINOFilter` as combination of (boolean and/or) of two filters.
|
|
55
|
+
*
|
|
56
|
+
* @param leftSide left side to combine
|
|
57
|
+
* @param operation boolean operation to use in combination
|
|
58
|
+
* @param rightSide right side to combine
|
|
59
|
+
*
|
|
60
|
+
*/
|
|
61
|
+
static combine(leftSide: OINODbSqlFilter | undefined, operation: OINODbSqlBooleanOperation, rightSide: OINODbSqlFilter | undefined): OINODbSqlFilter | undefined;
|
|
62
|
+
private _operatorToSql;
|
|
63
|
+
/**
|
|
64
|
+
* Does filter contain any valid conditions.
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
isEmpty(): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Print filter as SQL condition based on the datamodel of the API.
|
|
70
|
+
*
|
|
71
|
+
* @param dataModel data model (and database) to use for formatting of values
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
toSql(dataModel: OINODbDataModel): string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Class for ordering select results on a number of columns.
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
80
|
+
export declare class OINODbSqlOrder {
|
|
81
|
+
private static _orderColumnRegex;
|
|
82
|
+
private _columns;
|
|
83
|
+
private _descending;
|
|
84
|
+
/**
|
|
85
|
+
* Constructor for `OINODbSqlOrder`.
|
|
86
|
+
*
|
|
87
|
+
* @param column_or_array single or array of columns to order on
|
|
88
|
+
* @param descending_or_array single or array of booleans if ordes is descending
|
|
89
|
+
*
|
|
90
|
+
*/
|
|
91
|
+
constructor(column_or_array: string[] | string, descending_or_array: boolean[] | boolean);
|
|
92
|
+
/**
|
|
93
|
+
* Constructor for `OINODbSqlOrder` as parser of http parameter.
|
|
94
|
+
*
|
|
95
|
+
* @param orderString string representation of ordering from HTTP-request
|
|
96
|
+
*
|
|
97
|
+
*/
|
|
98
|
+
static parse(orderString: string): OINODbSqlOrder;
|
|
99
|
+
/**
|
|
100
|
+
* Does filter contain any valid conditions.
|
|
101
|
+
*
|
|
102
|
+
*/
|
|
103
|
+
isEmpty(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Print order as SQL condition based on the datamodel of the API.
|
|
106
|
+
*
|
|
107
|
+
* @param dataModel data model (and database) to use for formatting of values
|
|
108
|
+
*
|
|
109
|
+
*/
|
|
110
|
+
toSql(dataModel: OINODbDataModel): string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Class for limiting the number of results.
|
|
114
|
+
*
|
|
115
|
+
*/
|
|
116
|
+
export declare class OINODbSqlLimit {
|
|
117
|
+
private static _limitRegex;
|
|
118
|
+
private _limit;
|
|
119
|
+
private _page;
|
|
120
|
+
/**
|
|
121
|
+
* Constructor for `OINODbSqlLimit`.
|
|
122
|
+
*
|
|
123
|
+
* @param limit maximum number of items to return
|
|
124
|
+
*
|
|
125
|
+
*/
|
|
126
|
+
constructor(limit: number, page?: number);
|
|
127
|
+
/**
|
|
128
|
+
* Constructor for `OINODbSqlLimit` as parser of http parameter.
|
|
129
|
+
*
|
|
130
|
+
* @param limitString string representation of limit from HTTP-request
|
|
131
|
+
*
|
|
132
|
+
*/
|
|
133
|
+
static parse(limitString: string): OINODbSqlLimit;
|
|
134
|
+
/**
|
|
135
|
+
* Does filter contain any valid conditions.
|
|
136
|
+
*
|
|
137
|
+
*/
|
|
138
|
+
isEmpty(): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Print order as SQL condition based on the datamodel of the API.
|
|
141
|
+
*
|
|
142
|
+
* @param dataModel data model (and database) to use for formatting of values
|
|
143
|
+
*
|
|
144
|
+
*/
|
|
145
|
+
toSql(dataModel: OINODbDataModel): string;
|
|
146
|
+
}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { OINODbDataField, OINODbDataModel } from "./index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Supported logical conjunctions in filter predicates.
|
|
4
|
+
* @enum
|
|
5
|
+
*/
|
|
6
|
+
export declare enum OINODbSqlBooleanOperation {
|
|
7
|
+
and = "and",
|
|
8
|
+
or = "or",
|
|
9
|
+
not = "not"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Supported logical conjunctions in filter predicates.
|
|
13
|
+
* @enum
|
|
14
|
+
*/
|
|
15
|
+
export declare enum OINODbSqlComparison {
|
|
16
|
+
lt = "lt",
|
|
17
|
+
le = "le",
|
|
18
|
+
eq = "eq",
|
|
19
|
+
ne = "ne",
|
|
20
|
+
ge = "ge",
|
|
21
|
+
gt = "gt",
|
|
22
|
+
like = "like"
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Supported logical conjunctions in filter predicates.
|
|
26
|
+
* @enum
|
|
27
|
+
*/
|
|
28
|
+
export declare enum OINODbSqlNullCheck {
|
|
29
|
+
isnull = "isnull",
|
|
30
|
+
isnotnull = "isnotnull"
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Class for recursively parsing of filters and printing them as SQL conditions.
|
|
34
|
+
* Supports three types of statements
|
|
35
|
+
* - comparison: (field)-lt|le|eq|ge|gt|like(value)
|
|
36
|
+
* - negation: -not(filter)
|
|
37
|
+
* - conjunction/disjunction: (filter)-and|or(filter)
|
|
38
|
+
* Supported conditions are comparisons (<, <=, =, >=, >) and substring match (LIKE).
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
export declare class OINODbSqlFilter {
|
|
42
|
+
private static _booleanOperationRegex;
|
|
43
|
+
private static _negationRegex;
|
|
44
|
+
private static _filterComparisonRegex;
|
|
45
|
+
private static _filterNullCheckRegex;
|
|
46
|
+
private _leftSide;
|
|
47
|
+
private _rightSide;
|
|
48
|
+
private _operator;
|
|
49
|
+
/**
|
|
50
|
+
* Constructor of `OINODbSqlFilter`
|
|
51
|
+
* @param leftSide left side of the filter, either another filter or a column name
|
|
52
|
+
* @param operation operation of the filter, either `OINODbSqlComparison` or `OINODbSqlBooleanOperation`
|
|
53
|
+
* @param rightSide right side of the filter, either another filter or a value
|
|
54
|
+
*/
|
|
55
|
+
constructor(leftSide: OINODbSqlFilter | string, operation: OINODbSqlComparison | OINODbSqlBooleanOperation | OINODbSqlNullCheck | null, rightSide: OINODbSqlFilter | string);
|
|
56
|
+
/**
|
|
57
|
+
* Constructor for `OINODbSqlFilter` as parser of http parameter.
|
|
58
|
+
*
|
|
59
|
+
* Supports three types of statements:
|
|
60
|
+
* - comparison: (field)-lt|le|eq|ge|gt|like(value)
|
|
61
|
+
* - negation: -not(filter)
|
|
62
|
+
* - conjunction/disjunction: (filter)-and|or(filter)
|
|
63
|
+
* - null check: -isnull(field) or -isnotnull(field)
|
|
64
|
+
*
|
|
65
|
+
* @param filterString string representation of filter from HTTP-request
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
static parse(filterString: string): OINODbSqlFilter;
|
|
69
|
+
/**
|
|
70
|
+
* Construct a new `OINODbSqlFilter` as combination of (boolean and/or) of two filters.
|
|
71
|
+
*
|
|
72
|
+
* @param leftSide left side to combine
|
|
73
|
+
* @param operation boolean operation to use in combination
|
|
74
|
+
* @param rightSide right side to combine
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
static combine(leftSide: OINODbSqlFilter | undefined, operation: OINODbSqlBooleanOperation, rightSide: OINODbSqlFilter | undefined): OINODbSqlFilter | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Combine two filters with an AND operation.
|
|
80
|
+
*
|
|
81
|
+
* @param leftSide left side filter
|
|
82
|
+
* @param rightSide right side filter
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
static and(leftSide: OINODbSqlFilter, rightSide: OINODbSqlFilter): OINODbSqlFilter | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Combine two filters with an OR operation.
|
|
88
|
+
*
|
|
89
|
+
* @param leftSide left side filter
|
|
90
|
+
* @param rightSide right side filter
|
|
91
|
+
*
|
|
92
|
+
*/
|
|
93
|
+
static or(leftSide: OINODbSqlFilter, rightSide: OINODbSqlFilter): OINODbSqlFilter | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Negate a filter with a NOT operation.
|
|
96
|
+
*
|
|
97
|
+
* @param leftSide left side filter
|
|
98
|
+
*
|
|
99
|
+
*/
|
|
100
|
+
static not(leftSide: OINODbSqlFilter): OINODbSqlFilter | undefined;
|
|
101
|
+
private _operatorToSql;
|
|
102
|
+
/**
|
|
103
|
+
* Does filter contain any valid conditions.
|
|
104
|
+
*
|
|
105
|
+
*/
|
|
106
|
+
isEmpty(): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Print filter as SQL condition based on the datamodel of the API.
|
|
109
|
+
*
|
|
110
|
+
* @param dataModel data model (and database) to use for formatting of values
|
|
111
|
+
*
|
|
112
|
+
*/
|
|
113
|
+
toSql(dataModel: OINODbDataModel): string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Class for ordering select results on a number of columns.
|
|
117
|
+
*
|
|
118
|
+
*/
|
|
119
|
+
export declare class OINODbSqlOrder {
|
|
120
|
+
private static _orderColumnRegex;
|
|
121
|
+
private _columns;
|
|
122
|
+
private _descending;
|
|
123
|
+
/**
|
|
124
|
+
* Constructor for `OINODbSqlOrder`.
|
|
125
|
+
*
|
|
126
|
+
* @param column_or_array single or array of columns to order on
|
|
127
|
+
* @param descending_or_array single or array of booleans if ordes is descending
|
|
128
|
+
*
|
|
129
|
+
*/
|
|
130
|
+
constructor(column_or_array: string[] | string, descending_or_array: boolean[] | boolean);
|
|
131
|
+
/**
|
|
132
|
+
* Constructor for `OINODbSqlOrder` as parser of http parameter.
|
|
133
|
+
*
|
|
134
|
+
* Supports comma separated list of column orders formatted as :
|
|
135
|
+
* - `column` - order by column in ascending order
|
|
136
|
+
* - `column ASC|DESC` - order by single either ascending or descending order
|
|
137
|
+
* - `column+|-` - order by single either ascending or descending order
|
|
138
|
+
*
|
|
139
|
+
* @param orderString string representation of order from HTTP-request
|
|
140
|
+
*
|
|
141
|
+
*/
|
|
142
|
+
static parse(orderString: string): OINODbSqlOrder;
|
|
143
|
+
/**
|
|
144
|
+
* Does filter contain any valid conditions.
|
|
145
|
+
*
|
|
146
|
+
*/
|
|
147
|
+
isEmpty(): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Print order as SQL condition based on the datamodel of the API.
|
|
150
|
+
*
|
|
151
|
+
* @param dataModel data model (and database) to use for formatting of values
|
|
152
|
+
*
|
|
153
|
+
*/
|
|
154
|
+
toSql(dataModel: OINODbDataModel): string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Class for limiting the number of results.
|
|
158
|
+
*
|
|
159
|
+
*/
|
|
160
|
+
export declare class OINODbSqlLimit {
|
|
161
|
+
private static _limitRegex;
|
|
162
|
+
private _limit;
|
|
163
|
+
private _page;
|
|
164
|
+
/**
|
|
165
|
+
* Constructor for `OINODbSqlLimit`.
|
|
166
|
+
*
|
|
167
|
+
* @param limit maximum number of items to return
|
|
168
|
+
* @param page page number to return starting from 1
|
|
169
|
+
*
|
|
170
|
+
*/
|
|
171
|
+
constructor(limit: number, page?: number);
|
|
172
|
+
/**
|
|
173
|
+
* Constructor for `OINODbSqlLimit` as parser of http parameter.
|
|
174
|
+
*
|
|
175
|
+
* Supports limit and page formatted as:
|
|
176
|
+
* - `limit` - limit number of items to return
|
|
177
|
+
* - `limit page n` - limit number of items to return and return page n (starting from 1)
|
|
178
|
+
* - `limit.n` - limit number of items to return and return page n (starting from 1)
|
|
179
|
+
*
|
|
180
|
+
* @param limitString string representation of limit from HTTP-request
|
|
181
|
+
*
|
|
182
|
+
*/
|
|
183
|
+
static parse(limitString: string): OINODbSqlLimit;
|
|
184
|
+
/**
|
|
185
|
+
* Does filter contain any valid conditions.
|
|
186
|
+
*
|
|
187
|
+
*/
|
|
188
|
+
isEmpty(): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Print order as SQL condition based on the datamodel of the API.
|
|
191
|
+
*
|
|
192
|
+
* @param dataModel data model (and database) to use for formatting of values
|
|
193
|
+
*
|
|
194
|
+
*/
|
|
195
|
+
toSql(dataModel: OINODbDataModel): string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Supported aggregation functions in OINODbSqlAggregate.
|
|
199
|
+
* @enum
|
|
200
|
+
*/
|
|
201
|
+
export declare enum OINODbSqlAggregateFunctions {
|
|
202
|
+
count = "count",
|
|
203
|
+
sum = "sum",
|
|
204
|
+
avg = "avg",
|
|
205
|
+
min = "min",
|
|
206
|
+
max = "max"
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Class for limiting the number of results.
|
|
210
|
+
*
|
|
211
|
+
*/
|
|
212
|
+
export declare class OINODbSqlAggregate {
|
|
213
|
+
private static _aggregateRegex;
|
|
214
|
+
private _functions;
|
|
215
|
+
private _fields;
|
|
216
|
+
/**
|
|
217
|
+
* Constructor for `OINODbSqlAggregate`.
|
|
218
|
+
*
|
|
219
|
+
* @param functions aggregate function to use
|
|
220
|
+
* @param fields fields to aggregate
|
|
221
|
+
*
|
|
222
|
+
*/
|
|
223
|
+
constructor(functions: OINODbSqlAggregateFunctions[], fields: string[]);
|
|
224
|
+
/**
|
|
225
|
+
* Constructor for `OINODbSqlAggregate` as parser of http parameter.
|
|
226
|
+
*
|
|
227
|
+
* Supports comma separated list of aggregates formatted as:
|
|
228
|
+
* - `function(field)`
|
|
229
|
+
*
|
|
230
|
+
* Supported functions are count, sum, avg, min, max.
|
|
231
|
+
*
|
|
232
|
+
* @param aggregatorString string representation of limit from HTTP-request
|
|
233
|
+
*
|
|
234
|
+
*/
|
|
235
|
+
static parse(aggregatorString: string): OINODbSqlAggregate;
|
|
236
|
+
/**
|
|
237
|
+
* Does filter contain any valid conditions.
|
|
238
|
+
*
|
|
239
|
+
*/
|
|
240
|
+
isEmpty(): boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Print non-aggregated fields as SQL GROUP BY-condition based on the datamodel of the API.
|
|
243
|
+
*
|
|
244
|
+
* @param dataModel data model (and database) to use for formatting of values
|
|
245
|
+
* @param select what fields to select
|
|
246
|
+
*
|
|
247
|
+
*/
|
|
248
|
+
toSql(dataModel: OINODbDataModel, select?: OINODbSqlSelect): string;
|
|
249
|
+
/**
|
|
250
|
+
* Print non-aggregated fields as SQL GROUP BY-condition based on the datamodel of the API.
|
|
251
|
+
*
|
|
252
|
+
* @param dataModel data model (and database) to use for formatting of values
|
|
253
|
+
* @param select what fields to select
|
|
254
|
+
*
|
|
255
|
+
*/
|
|
256
|
+
printSqlColumnNames(dataModel: OINODbDataModel, select?: OINODbSqlSelect): string;
|
|
257
|
+
/**
|
|
258
|
+
* Does filter contain any valid conditions.
|
|
259
|
+
*
|
|
260
|
+
* @param field field to check if it is aggregated
|
|
261
|
+
*/
|
|
262
|
+
isAggregated(field: OINODbDataField): boolean;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Class for ordering select results on a number of columns.
|
|
266
|
+
*
|
|
267
|
+
*/
|
|
268
|
+
export declare class OINODbSqlSelect {
|
|
269
|
+
private _columns;
|
|
270
|
+
/**
|
|
271
|
+
* Constructor for `OINODbSqlSelect`.
|
|
272
|
+
*
|
|
273
|
+
* @param columns array of columns to select
|
|
274
|
+
*
|
|
275
|
+
*/
|
|
276
|
+
constructor(columns: string[]);
|
|
277
|
+
/**
|
|
278
|
+
* Constructor for `OINODbSqlSelect` as parser of http parameter.
|
|
279
|
+
*
|
|
280
|
+
* @param columns comma separated string selected columns from HTTP-request
|
|
281
|
+
*
|
|
282
|
+
*/
|
|
283
|
+
static parse(columns: string): OINODbSqlSelect;
|
|
284
|
+
/**
|
|
285
|
+
* Does select contain any valid columns.
|
|
286
|
+
*
|
|
287
|
+
*/
|
|
288
|
+
isEmpty(): boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Does select include given column.
|
|
291
|
+
*
|
|
292
|
+
* @param field field to check if it is selected
|
|
293
|
+
*
|
|
294
|
+
*/
|
|
295
|
+
isSelected(field: OINODbDataField): boolean;
|
|
296
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { OINODbApi } from "./index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Static class for Swagger utilities
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare class OINODbSwagger {
|
|
7
|
+
private static _getSchemaApiMethodParamsQueryId;
|
|
8
|
+
private static _getSchemaApiMethodParamsBody;
|
|
9
|
+
private static _getSchemaApiMethodDescription;
|
|
10
|
+
private static _getSchemaApiMethodOperationId;
|
|
11
|
+
private static _getSchemaOinoResponse;
|
|
12
|
+
private static _getSchemaFieldType;
|
|
13
|
+
private static _getSwaggerApiType;
|
|
14
|
+
private static _getSchemaType;
|
|
15
|
+
private static _getSchemaApiMethodParams;
|
|
16
|
+
private static _getSchemaApiMethod;
|
|
17
|
+
private static _getSwaggerApiPath;
|
|
18
|
+
/**
|
|
19
|
+
* Returns swagger.json as object of the given API's.
|
|
20
|
+
*
|
|
21
|
+
* @param apis array of API's use for Swagger definition
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
static getApiDefinition(apis: OINODbApi[]): any;
|
|
25
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { OINODb } from "./OINODb.js";
|
|
2
|
+
export { OINODbDataModel } from "./OINODbDataModel.js";
|
|
3
|
+
export { OINODbFactory } from "./OINODbFactory.js";
|
|
4
|
+
export { OINODbApi } from "./OINODbApi.js";
|
|
5
|
+
export { OINODbQueryFilter, OINODbQueryOrder, OINODbQueryLimit, OINODbQueryAggregate } from "./OINODbQueryParams.js";
|
|
6
|
+
export { type OINODbConstructor, type OINODbParams, OINODB_UNDEFINED } from "./OINODbConstants.js";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { OINOResult, OINODataSet, OINODataCell } from "@oino-ts/common";
|
|
2
|
+
import { OINODb, OINODbApi, OINODbParams } from "@oino-ts/db";
|
|
3
|
+
/**
|
|
4
|
+
* Implementation of BunSqlite-database.
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export declare class OINODbBunSqlite extends OINODb {
|
|
8
|
+
private static _tableDescriptionRegex;
|
|
9
|
+
private static _tablePrimarykeyRegex;
|
|
10
|
+
private static _tableForeignkeyRegex;
|
|
11
|
+
private static _tableFieldTypeRegex;
|
|
12
|
+
private _db;
|
|
13
|
+
/**
|
|
14
|
+
* OINODbBunSqlite constructor
|
|
15
|
+
* @param params database parameters
|
|
16
|
+
*/
|
|
17
|
+
constructor(params: OINODbParams);
|
|
18
|
+
private _parseDbFieldParams;
|
|
19
|
+
/**
|
|
20
|
+
* Print a table name using database specific SQL escaping.
|
|
21
|
+
*
|
|
22
|
+
* @param sqlTable name of the table
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
printTableName(sqlTable: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Print a column name with correct SQL escaping.
|
|
28
|
+
*
|
|
29
|
+
* @param sqlColumn name of the column
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
printColumnName(sqlColumn: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Print a single data value from serialization using the context of the native data
|
|
35
|
+
* type with the correct SQL escaping.
|
|
36
|
+
*
|
|
37
|
+
* @param cellValue data from sql results
|
|
38
|
+
* @param nativeType native type name for table column
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
printCellAsValue(cellValue: OINODataCell, nativeType: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Print a single string value as valid sql literal
|
|
44
|
+
*
|
|
45
|
+
* @param sqlString string value
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
printStringValue(sqlString: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Parse a single SQL result value for serialization using the context of the native data
|
|
51
|
+
* type.
|
|
52
|
+
*
|
|
53
|
+
* @param sqlValue data from serialization
|
|
54
|
+
* @param nativeType native type name for table column
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
parseValueAsCell(sqlValue: OINODataCell, nativeType: string): OINODataCell;
|
|
58
|
+
/**
|
|
59
|
+
* Connect to database.
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
connect(): Promise<OINOResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Validate connection to database is working.
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
validate(): Promise<OINOResult>;
|
|
68
|
+
/**
|
|
69
|
+
* Connect to database.
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
disconnect(): Promise<void>;
|
|
73
|
+
private _query;
|
|
74
|
+
private _exec;
|
|
75
|
+
/**
|
|
76
|
+
* Execute a select operation.
|
|
77
|
+
*
|
|
78
|
+
* @param sql SQL statement.
|
|
79
|
+
*
|
|
80
|
+
*/
|
|
81
|
+
sqlSelect(sql: string): Promise<OINODataSet>;
|
|
82
|
+
/**
|
|
83
|
+
* Execute other sql operations.
|
|
84
|
+
*
|
|
85
|
+
* @param sql SQL statement.
|
|
86
|
+
*
|
|
87
|
+
*/
|
|
88
|
+
sqlExec(sql: string): Promise<OINODataSet>;
|
|
89
|
+
private _getSchemaSql;
|
|
90
|
+
private _getValidateSql;
|
|
91
|
+
/**
|
|
92
|
+
* Initialize a data model by getting the SQL schema and populating OINODataFields of
|
|
93
|
+
* the model.
|
|
94
|
+
*
|
|
95
|
+
* @param api api which data model to initialize.
|
|
96
|
+
*
|
|
97
|
+
*/
|
|
98
|
+
initializeApiDatamodel(api: OINODbApi): Promise<void>;
|
|
99
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OINODbBunSqlite } from "./OINODbBunSqlite.js";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { OINOResult } from "@oino-ts/common";
|
|
2
|
+
import { OINODataSet, OINODataCell } from "@oino-ts/common";
|
|
3
|
+
import { OINODb, OINODbApi, OINODbParams } from "@oino-ts/db";
|
|
4
|
+
/**
|
|
5
|
+
* Implementation of MariaDb/MySql-database.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare class OINODbMariadb extends OINODb {
|
|
9
|
+
private static _fieldLengthRegex;
|
|
10
|
+
private static _connectionExceptionMessageRegex;
|
|
11
|
+
private static _sqlExceptionMessageRegex;
|
|
12
|
+
private _pool;
|
|
13
|
+
/**
|
|
14
|
+
* Constructor of `OINODbMariadb`
|
|
15
|
+
* @param params database parameters
|
|
16
|
+
*/
|
|
17
|
+
constructor(params: OINODbParams);
|
|
18
|
+
private _parseFieldLength;
|
|
19
|
+
private _query;
|
|
20
|
+
private _exec;
|
|
21
|
+
/**
|
|
22
|
+
* Print a table name using database specific SQL escaping.
|
|
23
|
+
*
|
|
24
|
+
* @param sqlTable name of the table
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
printTableName(sqlTable: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Print a column name with correct SQL escaping.
|
|
30
|
+
*
|
|
31
|
+
* @param sqlColumn name of the column
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
printColumnName(sqlColumn: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Print a single data value from serialization using the context of the native data
|
|
37
|
+
* type with the correct SQL escaping.
|
|
38
|
+
*
|
|
39
|
+
* @param cellValue data from sql results
|
|
40
|
+
* @param nativeType native type name for table column
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
printCellAsValue(cellValue: OINODataCell, nativeType: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Print a single string value as valid sql literal
|
|
46
|
+
*
|
|
47
|
+
* @param sqlString string value
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
printStringValue(sqlString: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Parse a single SQL result value for serialization using the context of the native data
|
|
53
|
+
* type.
|
|
54
|
+
*
|
|
55
|
+
* @param sqlValue data from serialization
|
|
56
|
+
* @param nativeType native type name for table column
|
|
57
|
+
*
|
|
58
|
+
*/
|
|
59
|
+
parseValueAsCell(sqlValue: OINODataCell, nativeType: string): OINODataCell;
|
|
60
|
+
/**
|
|
61
|
+
* Connect to database.
|
|
62
|
+
*
|
|
63
|
+
*/
|
|
64
|
+
connect(): Promise<OINOResult>;
|
|
65
|
+
/**
|
|
66
|
+
* Validate connection to database is working.
|
|
67
|
+
*
|
|
68
|
+
*/
|
|
69
|
+
validate(): Promise<OINOResult>;
|
|
70
|
+
/**
|
|
71
|
+
* Disconnect from database.
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
disconnect(): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Execute a select operation.
|
|
77
|
+
*
|
|
78
|
+
* @param sql SQL statement.
|
|
79
|
+
*
|
|
80
|
+
*/
|
|
81
|
+
sqlSelect(sql: string): Promise<OINODataSet>;
|
|
82
|
+
/**
|
|
83
|
+
* Execute other sql operations.
|
|
84
|
+
*
|
|
85
|
+
* @param sql SQL statement.
|
|
86
|
+
*
|
|
87
|
+
*/
|
|
88
|
+
sqlExec(sql: string): Promise<OINODataSet>;
|
|
89
|
+
private _getSchemaSql;
|
|
90
|
+
private _getValidateSql;
|
|
91
|
+
/**
|
|
92
|
+
* Initialize a data model by getting the SQL schema and populating OINODataFields of
|
|
93
|
+
* the model.
|
|
94
|
+
*
|
|
95
|
+
* @param api api which data model to initialize.
|
|
96
|
+
*
|
|
97
|
+
*/
|
|
98
|
+
initializeApiDatamodel(api: OINODbApi): Promise<void>;
|
|
99
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OINODbMariadb } from "./OINODbMariadb.js";
|