@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,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported logical conjunctions in filter predicates.
|
|
3
|
+
* @enum
|
|
4
|
+
*/
|
|
5
|
+
export declare enum OINOQueryBooleanOperation {
|
|
6
|
+
and = "and",
|
|
7
|
+
or = "or",
|
|
8
|
+
not = "not"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Supported logical conjunctions in filter predicates.
|
|
12
|
+
* @enum
|
|
13
|
+
*/
|
|
14
|
+
export declare enum OINOQueryComparison {
|
|
15
|
+
lt = "lt",
|
|
16
|
+
le = "le",
|
|
17
|
+
eq = "eq",
|
|
18
|
+
ne = "ne",
|
|
19
|
+
ge = "ge",
|
|
20
|
+
gt = "gt",
|
|
21
|
+
like = "like"
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Supported logical conjunctions in filter predicates.
|
|
25
|
+
* @enum
|
|
26
|
+
*/
|
|
27
|
+
export declare enum OINOQueryNullCheck {
|
|
28
|
+
isnull = "isnull",
|
|
29
|
+
isNotNull = "isNotNull"
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Supported aggregation functions in OINODbQueryAggregate.
|
|
33
|
+
* @enum
|
|
34
|
+
*/
|
|
35
|
+
export declare enum OINOQueryAggregateFunctions {
|
|
36
|
+
count = "count",
|
|
37
|
+
sum = "sum",
|
|
38
|
+
avg = "avg",
|
|
39
|
+
min = "min",
|
|
40
|
+
max = "max"
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Class for recursively parsing of filters and printing them as SQL conditions.
|
|
44
|
+
* Supports three types of statements
|
|
45
|
+
* - comparison: (field)-lt|le|eq|ge|gt|like(value)
|
|
46
|
+
* - negation: -not(filter)
|
|
47
|
+
* - conjunction/disjunction: (filter)-and|or(filter)
|
|
48
|
+
* Supported conditions are comparisons (<, <=, =, >=, >) and substring match (LIKE).
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
export declare class OINOQueryFilter {
|
|
52
|
+
protected static _booleanOperationRegex: RegExp;
|
|
53
|
+
protected static _negationRegex: RegExp;
|
|
54
|
+
protected static _filterComparisonRegex: RegExp;
|
|
55
|
+
protected static _filterNullCheckRegex: RegExp;
|
|
56
|
+
readonly leftSide: OINOQueryFilter | string;
|
|
57
|
+
readonly rightSide: OINOQueryFilter | string;
|
|
58
|
+
readonly operator: OINOQueryComparison | OINOQueryBooleanOperation | OINOQueryNullCheck | null;
|
|
59
|
+
/**
|
|
60
|
+
* Constructor of `OINOQueryFilter`
|
|
61
|
+
* @param leftSide left side of the filter, either another filter or a column name
|
|
62
|
+
* @param operation operation of the filter, either `OINOQueryComparison` or `OINOQueryBooleanOperation`
|
|
63
|
+
* @param rightSide right side of the filter, either another filter or a value
|
|
64
|
+
*/
|
|
65
|
+
constructor(leftSide: OINOQueryFilter | string, operation: OINOQueryComparison | OINOQueryBooleanOperation | OINOQueryNullCheck | null, rightSide: OINOQueryFilter | string);
|
|
66
|
+
/**
|
|
67
|
+
* Constructor for `OINOQueryFilter` as parser of http parameter.
|
|
68
|
+
*
|
|
69
|
+
* Supports three types of statements:
|
|
70
|
+
* - comparison: (field)-lt|le|eq|ge|gt|like(value)
|
|
71
|
+
* - negation: -not(filter)
|
|
72
|
+
* - conjunction/disjunction: (filter)-and|or(filter)
|
|
73
|
+
* - null check: -isnull(field) or -isNotNull(field)
|
|
74
|
+
*
|
|
75
|
+
* @param filterString string representation of filter from HTTP-request
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
static parse(filterString: string): OINOQueryFilter;
|
|
79
|
+
/**
|
|
80
|
+
* Construct a new `OINOQueryFilter` as combination of (boolean and/or) of two filters.
|
|
81
|
+
*
|
|
82
|
+
* @param leftSide left side to combine
|
|
83
|
+
* @param operation boolean operation to use in combination
|
|
84
|
+
* @param rightSide right side to combine
|
|
85
|
+
*
|
|
86
|
+
*/
|
|
87
|
+
static combine(leftSide: OINOQueryFilter | undefined, operation: OINOQueryBooleanOperation, rightSide: OINOQueryFilter | undefined): OINOQueryFilter | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Combine two filters with an AND operation.
|
|
90
|
+
*
|
|
91
|
+
* @param leftSide left side filter
|
|
92
|
+
* @param rightSide right side filter
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
static and(leftSide: OINOQueryFilter, rightSide: OINOQueryFilter): OINOQueryFilter | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Combine two filters with an OR operation.
|
|
98
|
+
*
|
|
99
|
+
* @param leftSide left side filter
|
|
100
|
+
* @param rightSide right side filter
|
|
101
|
+
*
|
|
102
|
+
*/
|
|
103
|
+
static or(leftSide: OINOQueryFilter, rightSide: OINOQueryFilter): OINOQueryFilter | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Negate a filter with a NOT operation.
|
|
106
|
+
*
|
|
107
|
+
* @param leftSide left side filter
|
|
108
|
+
*
|
|
109
|
+
*/
|
|
110
|
+
static not(leftSide: OINOQueryFilter): OINOQueryFilter | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Does filter contain any valid conditions.
|
|
113
|
+
*
|
|
114
|
+
*/
|
|
115
|
+
isEmpty(): boolean;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Class for ordering select results on a number of columns.
|
|
119
|
+
*
|
|
120
|
+
*/
|
|
121
|
+
export declare class OINOQueryOrder {
|
|
122
|
+
protected static _orderColumnRegex: RegExp;
|
|
123
|
+
readonly columns: string[];
|
|
124
|
+
readonly descending: boolean[];
|
|
125
|
+
/**
|
|
126
|
+
* Constructor for `OINOQueryOrder`.
|
|
127
|
+
*
|
|
128
|
+
* @param column_or_array single or array of columns to order on
|
|
129
|
+
* @param descending_or_array single or array of booleans if ordes is descending
|
|
130
|
+
*
|
|
131
|
+
*/
|
|
132
|
+
constructor(column_or_array: string[] | string, descending_or_array: boolean[] | boolean);
|
|
133
|
+
/**
|
|
134
|
+
* Constructor for `OINOQueryOrder` as parser of http parameter.
|
|
135
|
+
*
|
|
136
|
+
* Supports comma separated list of column orders formatted as :
|
|
137
|
+
* - `column` - order by column in ascending order
|
|
138
|
+
* - `column ASC|DESC` - order by single either ascending or descending order
|
|
139
|
+
* - `column+|-` - order by single either ascending or descending order
|
|
140
|
+
*
|
|
141
|
+
* @param orderString string representation of order from HTTP-request
|
|
142
|
+
*
|
|
143
|
+
*/
|
|
144
|
+
static parse(orderString: string): OINOQueryOrder;
|
|
145
|
+
/**
|
|
146
|
+
* Does filter contain any valid conditions.
|
|
147
|
+
*
|
|
148
|
+
*/
|
|
149
|
+
isEmpty(): boolean;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Class for limiting the number of results.
|
|
153
|
+
*
|
|
154
|
+
*/
|
|
155
|
+
export declare class OINOQueryLimit {
|
|
156
|
+
protected static _limitRegex: RegExp;
|
|
157
|
+
readonly limit: number;
|
|
158
|
+
readonly page: number;
|
|
159
|
+
/**
|
|
160
|
+
* Constructor for `OINOQueryLimit`.
|
|
161
|
+
*
|
|
162
|
+
* @param limit maximum number of items to return
|
|
163
|
+
* @param page page number to return starting from 1
|
|
164
|
+
*
|
|
165
|
+
*/
|
|
166
|
+
constructor(limit: number, page?: number);
|
|
167
|
+
/**
|
|
168
|
+
* Constructor for `OINOQueryLimit` as parser of http parameter.
|
|
169
|
+
*
|
|
170
|
+
* Supports limit and page formatted as:
|
|
171
|
+
* - `limit` - limit number of items to return
|
|
172
|
+
* - `limit page n` - limit number of items to return and return page n (starting from 1)
|
|
173
|
+
* - `limit.n` - limit number of items to return and return page n (starting from 1)
|
|
174
|
+
*
|
|
175
|
+
* @param limitString string representation of limit from HTTP-request
|
|
176
|
+
*
|
|
177
|
+
*/
|
|
178
|
+
static parse(limitString: string): OINOQueryLimit;
|
|
179
|
+
/**
|
|
180
|
+
* Does filter contain any valid conditions.
|
|
181
|
+
*
|
|
182
|
+
*/
|
|
183
|
+
isEmpty(): boolean;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Class for limiting the number of results.
|
|
187
|
+
*
|
|
188
|
+
*/
|
|
189
|
+
export declare class OINOQueryAggregate {
|
|
190
|
+
protected static _aggregateRegex: RegExp;
|
|
191
|
+
readonly functions: OINOQueryAggregateFunctions[];
|
|
192
|
+
readonly fields: string[];
|
|
193
|
+
/**
|
|
194
|
+
* Constructor for `OINOQueryAggregate`.
|
|
195
|
+
*
|
|
196
|
+
* @param functions aggregate function to use
|
|
197
|
+
* @param fields fields to aggregate
|
|
198
|
+
*
|
|
199
|
+
*/
|
|
200
|
+
constructor(functions: OINOQueryAggregateFunctions[], fields: string[]);
|
|
201
|
+
/**
|
|
202
|
+
* Constructor for `OINOQueryAggregate` as parser of http parameter.
|
|
203
|
+
*
|
|
204
|
+
* Supports comma separated list of aggregates formatted as:
|
|
205
|
+
* - `function(field)`
|
|
206
|
+
*
|
|
207
|
+
* Supported functions are count, sum, avg, min, max.
|
|
208
|
+
*
|
|
209
|
+
* @param aggregatorString string representation of limit from HTTP-request
|
|
210
|
+
*
|
|
211
|
+
*/
|
|
212
|
+
static parse(aggregatorString: string): OINOQueryAggregate;
|
|
213
|
+
/**
|
|
214
|
+
* Does filter contain any valid conditions.
|
|
215
|
+
*
|
|
216
|
+
*/
|
|
217
|
+
isEmpty(): boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Does filter contain any valid conditions.
|
|
220
|
+
*
|
|
221
|
+
* @param field field to check if it is aggregated
|
|
222
|
+
*/
|
|
223
|
+
isAggregated(field: string): boolean;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Class for ordering select results on a number of columns.
|
|
227
|
+
*
|
|
228
|
+
*/
|
|
229
|
+
export declare class OINOQuerySelect {
|
|
230
|
+
readonly columns: string[];
|
|
231
|
+
/**
|
|
232
|
+
* Constructor for `OINOQuerySelect`.
|
|
233
|
+
*
|
|
234
|
+
* @param columns array of columns to select
|
|
235
|
+
*
|
|
236
|
+
*/
|
|
237
|
+
constructor(columns: string[]);
|
|
238
|
+
/**
|
|
239
|
+
* Constructor for `OINOQuerySelect` as parser of http parameter.
|
|
240
|
+
*
|
|
241
|
+
* @param columns comma separated string selected columns from HTTP-request
|
|
242
|
+
*
|
|
243
|
+
*/
|
|
244
|
+
static parse(columns: string): OINOQuerySelect;
|
|
245
|
+
/**
|
|
246
|
+
* Does select contain any valid columns.
|
|
247
|
+
*
|
|
248
|
+
*/
|
|
249
|
+
isEmpty(): boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Does select include given column.
|
|
252
|
+
*
|
|
253
|
+
* @param field field to check if it is selected
|
|
254
|
+
*
|
|
255
|
+
*/
|
|
256
|
+
isSelected(field: string): boolean;
|
|
257
|
+
}
|
|
258
|
+
/** Request options */
|
|
259
|
+
export type OINOQueryParams = {
|
|
260
|
+
/** Additional SQL select where-conditions */
|
|
261
|
+
filter?: OINOQueryFilter;
|
|
262
|
+
/** SQL result ordering conditions */
|
|
263
|
+
order?: OINOQueryOrder;
|
|
264
|
+
/** SQL result limit condition */
|
|
265
|
+
limit?: OINOQueryLimit;
|
|
266
|
+
/** SQL aggregation functions */
|
|
267
|
+
aggregate?: OINOQueryAggregate;
|
|
268
|
+
/** SQL select condition */
|
|
269
|
+
select?: OINOQuerySelect;
|
|
270
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { Buffer } from "node:buffer";
|
|
4
|
-
import { OINOContentType
|
|
4
|
+
import { OINOContentType } from "./OINOConstants.js";
|
|
5
|
+
import { OINOHeaders, type OINOHeadersInit } from "./OINOHeaders.js";
|
|
5
6
|
export interface OINORequestInit {
|
|
6
7
|
params?: Record<string, string>;
|
|
7
8
|
}
|
|
@@ -29,6 +30,7 @@ export interface OINOHttpRequestInit extends OINORequestInit {
|
|
|
29
30
|
body?: OINOHttpData;
|
|
30
31
|
requestType?: OINOContentType;
|
|
31
32
|
responseType?: OINOContentType;
|
|
33
|
+
responseDownload?: string;
|
|
32
34
|
multipartBoundary?: string;
|
|
33
35
|
lastModified?: number;
|
|
34
36
|
}
|
|
@@ -42,6 +44,7 @@ export declare class OINOHttpRequest extends OINORequest {
|
|
|
42
44
|
body: OINOHttpData;
|
|
43
45
|
requestType: OINOContentType;
|
|
44
46
|
responseType: OINOContentType;
|
|
47
|
+
responseDownload?: string;
|
|
45
48
|
multipartBoundary?: string;
|
|
46
49
|
lastModified?: number;
|
|
47
50
|
etags?: string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { Buffer } from "node:buffer";
|
|
4
|
-
import { OINOHeaders, OINOHeadersInit } from ".";
|
|
4
|
+
import { OINOHeaders, type OINOHeadersInit } from "./OINOHeaders.js";
|
|
5
5
|
export interface OINOResultInit {
|
|
6
6
|
success?: boolean;
|
|
7
7
|
status?: number;
|
package/common/src/OINOStr.d.ts
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { OINOApi } from "./OINOApi.js";
|
|
2
|
+
/**
|
|
3
|
+
* Static class for Swagger utilities
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare class OINOSwagger {
|
|
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: OINOApi[]): any;
|
|
25
|
+
}
|
package/common/src/index.d.ts
CHANGED
|
@@ -1,35 +1,18 @@
|
|
|
1
|
+
export { OINOApi, OINOApiRequest, OINOApiResult, OINOApiHtmlTemplate, type OINOApiParams, type OINOApiData, type OINOApiRequestInit } from "./OINOApi.js";
|
|
1
2
|
export { OINOBenchmark, OINOMemoryBenchmark } from "./OINOBenchmark.js";
|
|
3
|
+
export { OINOConfig } from "./OINOConfig.js";
|
|
4
|
+
export { OINO_ERROR_PREFIX, OINO_WARNING_PREFIX, OINO_INFO_PREFIX, OINO_DEBUG_PREFIX, OINO_REQUEST_TYPE_PARAM, OINO_RESPONSE_TYPE_PARAM, OINOContentType, type OINODataFieldParams, type OINODataCell, type OINODataRow, OINO_EMPTY_ROW, OINO_EMPTY_ROWS } from "./OINOConstants.js";
|
|
5
|
+
export { OINODataModel } from "./OINODataModel.js";
|
|
6
|
+
export { OINODataSource, OINODataSet, OINOMemoryDataset } from "./OINODataSource.js";
|
|
7
|
+
export { OINODataField, OINOStringDataField, OINONumberDataField, OINOBooleanDataField, OINODatetimeDataField, OINOBlobDataField, type OINODataFieldFilter } from "./OINODataField.js";
|
|
8
|
+
export { OINOFormatter, OINO_EMPTY_FORMATTER } from "./OINOFormatter.js";
|
|
9
|
+
export { OINOHeaders, type OINOHeadersInit } from "./OINOHeaders.js";
|
|
10
|
+
export { OINOHtmlTemplate } from "./OINOHtmlTemplate.js";
|
|
2
11
|
export { OINOLog, OINOLogLevel, OINOConsoleLog } from "./OINOLog.js";
|
|
3
|
-
export {
|
|
12
|
+
export { OINOModelSet } from "./OINOModelSet.js";
|
|
13
|
+
export { OINOParser } from "./OINOParser.js";
|
|
14
|
+
export { OINOQueryBooleanOperation, OINOQueryComparison, OINOQueryNullCheck, OINOQueryAggregateFunctions, OINOQuerySelect, OINOQueryFilter, OINOQueryOrder, OINOQueryLimit, OINOQueryAggregate, type OINOQueryParams } from "./OINOQueryParams.js";
|
|
4
15
|
export { OINORequest, OINOHttpRequest, type OINOHttpData, type OINORequestInit, type OINOHttpRequestInit } from "./OINORequest.js";
|
|
16
|
+
export { OINOResult, OINOHttpResult, type OINOResultInit, type OINOHttpResultInit } from "./OINOResult.js";
|
|
5
17
|
export { OINOStr } from "./OINOStr.js";
|
|
6
|
-
export {
|
|
7
|
-
export { OINOFormatter, OINO_EMPTY_FORMATTER } from "./OINOFormatter.js";
|
|
8
|
-
export { OINOHeaders, type OINOHeadersInit } from "./OINOHeaders.js";
|
|
9
|
-
/** OINO error message prefix */
|
|
10
|
-
export declare const OINO_ERROR_PREFIX = "OINO ERROR";
|
|
11
|
-
/** OINO warning message prefix */
|
|
12
|
-
export declare const OINO_WARNING_PREFIX = "OINO WARNING";
|
|
13
|
-
/** OINO info message prefix */
|
|
14
|
-
export declare const OINO_INFO_PREFIX = "OINO INFO";
|
|
15
|
-
/** OINO debug message prefix */
|
|
16
|
-
export declare const OINO_DEBUG_PREFIX = "OINO DEBUG";
|
|
17
|
-
/** Name of the OINOContentType-parameter request */
|
|
18
|
-
export declare const OINO_REQUEST_TYPE_PARAM = "oinorequesttype";
|
|
19
|
-
/** Name of the OINOContentType-parameter request */
|
|
20
|
-
export declare const OINO_RESPONSE_TYPE_PARAM = "oinoresponsetype";
|
|
21
|
-
/**
|
|
22
|
-
* Supported content format mime-types
|
|
23
|
-
*/
|
|
24
|
-
export declare enum OINOContentType {
|
|
25
|
-
/** JSON encoded data */
|
|
26
|
-
json = "application/json",
|
|
27
|
-
/** CSV encoded data */
|
|
28
|
-
csv = "text/csv",
|
|
29
|
-
/** Multipart encoded form data */
|
|
30
|
-
formdata = "multipart/form-data",
|
|
31
|
-
/** URL encoded form data */
|
|
32
|
-
urlencode = "application/x-www-form-urlencoded",
|
|
33
|
-
/** HTML encoded data (output only) */
|
|
34
|
-
html = "text/html"
|
|
35
|
-
}
|
|
18
|
+
export { OINOSwagger } from "./OINOSwagger.js";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { OINODataSet, OINODataSource } from "@oino-ts/common";
|
|
2
|
+
import { OINODbParams } from "./OINODbConstants.js";
|
|
3
|
+
/**
|
|
4
|
+
* Base class for database abstraction, implementing methods for connecting, making queries and parsing/formatting data
|
|
5
|
+
* between SQL and serialization formats.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class OINODb extends OINODataSource {
|
|
9
|
+
protected readonly dbParams: OINODbParams;
|
|
10
|
+
/** Name of the database */
|
|
11
|
+
readonly name: string;
|
|
12
|
+
isConnected: boolean;
|
|
13
|
+
isValidated: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Constructor for `OINODb`.
|
|
16
|
+
* @param params database parameters
|
|
17
|
+
*/
|
|
18
|
+
constructor(params: OINODbParams);
|
|
19
|
+
/**
|
|
20
|
+
* Execute a select operation.
|
|
21
|
+
*
|
|
22
|
+
* @param sql SQL statement.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
abstract sqlSelect(sql: string): Promise<OINODataSet>;
|
|
26
|
+
/**
|
|
27
|
+
* Execute other sql operations.
|
|
28
|
+
*
|
|
29
|
+
* @param sql SQL statement.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
abstract sqlExec(sql: string): Promise<OINODataSet>;
|
|
33
|
+
/**
|
|
34
|
+
* Print SQL select statement with DB specific formatting.
|
|
35
|
+
*
|
|
36
|
+
* @param tableName - The name of the table to select from.
|
|
37
|
+
* @param columnNames - The columns to be selected.
|
|
38
|
+
* @param whereCondition - The WHERE clause to filter the results.
|
|
39
|
+
* @param orderCondition - The ORDER BY clause to sort the results.
|
|
40
|
+
* @param limitCondition - The LIMIT clause to limit the number of results.
|
|
41
|
+
* @param groupByCondition - The GROUP BY clause to group the results.
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
printSqlSelect(tableName: string, columnNames: string, whereCondition: string, orderCondition: string, limitCondition: string, groupByCondition: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Print SQL select statement with DB specific formatting.
|
|
47
|
+
*
|
|
48
|
+
* @param tableName - The name of the table to select from.
|
|
49
|
+
* @param columns - The columns to be selected.
|
|
50
|
+
* @param values - The values to be inserted.
|
|
51
|
+
* @param returnIdFields - the id fields to return if returnIds is true (if supported by the database)
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
printSqlInsert(tableName: string, columns: string, values: string, returnIdFields?: string[]): string;
|
|
55
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { OINOApi, OINOApiParams, OINOHttpRequest, OINOApiRequest, OINOApiResult, OINOContentType, OINOQueryParams, OINOApiData } from "@oino-ts/common";
|
|
2
|
+
import { OINODb } from "./OINODb.js";
|
|
3
|
+
import { OINODbDataModel } from "./OINODbDataModel.js";
|
|
4
|
+
/**
|
|
5
|
+
* API class with method to process HTTP REST requests.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare class OINODbApi extends OINOApi {
|
|
9
|
+
/** DB reference */
|
|
10
|
+
readonly db: OINODb;
|
|
11
|
+
/** DB parameters reference */
|
|
12
|
+
readonly dbParams: OINOApiParams;
|
|
13
|
+
/** DB datamodel reference */
|
|
14
|
+
dbDatamodel: OINODbDataModel | null;
|
|
15
|
+
/**
|
|
16
|
+
* Constructor of API object.
|
|
17
|
+
* NOTE! OINODb.initDatamodel must be called if created manually instead of the factory.
|
|
18
|
+
*
|
|
19
|
+
* @param db database for the API
|
|
20
|
+
* @param params parameters for the API
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
constructor(db: OINODb, params: OINOApiParams);
|
|
24
|
+
initializeDatamodel(datamodel: OINODbDataModel): void;
|
|
25
|
+
private _validateRow;
|
|
26
|
+
private _parseData;
|
|
27
|
+
private _doGet;
|
|
28
|
+
private _doPost;
|
|
29
|
+
private _doPut;
|
|
30
|
+
private _doDelete;
|
|
31
|
+
/**
|
|
32
|
+
* Method for handling a HTTP REST request with GET, POST, PUT, DELETE corresponding to
|
|
33
|
+
* SQL select, insert, update and delete.
|
|
34
|
+
*
|
|
35
|
+
* @param request OINO HTTP request object containing all parameters of the REST request
|
|
36
|
+
* @param rowId URL id of the REST request
|
|
37
|
+
* @param rowData HTTP body data as either serialized string or unserialized JS object or OINODataRow-array or Buffer/Uint8Array binary data
|
|
38
|
+
* @param queryParams SQL parameters for the REST request
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
doHttpRequest(request: OINOHttpRequest, rowId: string, rowData: OINOApiData, queryParams: OINOQueryParams): Promise<OINOApiResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Method for handling a HTTP REST request with GET, POST, PUT, DELETE corresponding to
|
|
44
|
+
* SQL select, insert, update and delete.
|
|
45
|
+
*
|
|
46
|
+
* @param method HTTP method of the REST request
|
|
47
|
+
* @param rowId URL id of the REST request
|
|
48
|
+
* @param rowData HTTP body data as either serialized string or unserialized JS object or OINODataRow-array or Buffer/Uint8Array binary data
|
|
49
|
+
* @param queryParams SQL parameters for the REST request
|
|
50
|
+
* @param contentType content type of the HTTP body data, default is JSON
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
doRequest(method: string, rowId: string, rowData: OINOApiData, queryParams: OINOQueryParams, contentType?: OINOContentType): Promise<OINOApiResult>;
|
|
54
|
+
doApiRequest(request: OINOApiRequest): Promise<OINOApiResult>;
|
|
55
|
+
/**
|
|
56
|
+
* Method for handling a HTTP REST request with batch update using PUT or DELETE methods.
|
|
57
|
+
*
|
|
58
|
+
* @param method HTTP method of the REST request
|
|
59
|
+
* @param rowId URL id of the REST request
|
|
60
|
+
* @param rowData HTTP body data as either serialized string or unserialized JS object or OINODataRow-array or Buffer/Uint8Array binary data
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
doBatchUpdate(method: string, rowId: string, rowData: OINOApiData, queryParams?: OINOQueryParams): Promise<OINOApiResult>;
|
|
64
|
+
/**
|
|
65
|
+
* Method for handling a HTTP REST request with batch update using PUT or DELETE methods.
|
|
66
|
+
*
|
|
67
|
+
* @param request HTTP URL parameters as key-value-pairs
|
|
68
|
+
*
|
|
69
|
+
*/
|
|
70
|
+
doBatchApiRequest(request: OINOApiRequest): Promise<OINOApiResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Method to check if a field is included in the API params.
|
|
73
|
+
*
|
|
74
|
+
* @param fieldName name of the field
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
isFieldIncluded(fieldName: string): boolean;
|
|
78
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** Set the name of the OINO ID field (default \_OINOID\_) */
|
|
2
|
+
export declare class OINODbConfig {
|
|
3
|
+
/** Name of the synthetic OINO ID field */
|
|
4
|
+
static OINODB_ID_FIELD: string;
|
|
5
|
+
/** Private key separator of the synthetic OINO ID field */
|
|
6
|
+
static OINODB_ID_SEPARATOR: string;
|
|
7
|
+
private static OINODB_ID_SEPARATOR_ESCAPED;
|
|
8
|
+
/** Name of the OINODbSqlFilter-parameter in request */
|
|
9
|
+
static OINODB_SQL_FILTER_PARAM: string;
|
|
10
|
+
/** Name of the OINODbSqlOrder-parameter in request */
|
|
11
|
+
static OINODB_SQL_ORDER_PARAM: string;
|
|
12
|
+
/** Name of the OINODbSqlLimit-parameter in request */
|
|
13
|
+
static OINODB_SQL_LIMIT_PARAM: string;
|
|
14
|
+
/** Name of the OINODbSqlAggregate-parameter in request */
|
|
15
|
+
static OINODB_SQL_AGGREGATE_PARAM: string;
|
|
16
|
+
/** Name of the OINODbSqlSelect-parameter in request */
|
|
17
|
+
static OINODB_SQL_SELECT_PARAM: string;
|
|
18
|
+
/**
|
|
19
|
+
* Set the name of the OINO ID field
|
|
20
|
+
* @param idField name of the OINO ID field
|
|
21
|
+
*/
|
|
22
|
+
static setOinoIdField(idField: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Set the separator character of the OINO ID field
|
|
25
|
+
* @param idSeparator character to use as separator of id parts
|
|
26
|
+
*/
|
|
27
|
+
static setOinoIdSeparator(idSeparator: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Print OINO ID for primary key values.
|
|
30
|
+
*
|
|
31
|
+
* @param primaryKeys an array of primary key values.
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
static printOINOId(primaryKeys: string[]): string;
|
|
35
|
+
/**
|
|
36
|
+
* Set the name of the OINODbSqlFilter-param field
|
|
37
|
+
*
|
|
38
|
+
* @param sqlFilterParam name of the http parameter with `OINODbSqlFilter` definition
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
static setOinoSqlFilterParam(sqlFilterParam: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Set the name of the OINODbSqlOrder-param field
|
|
44
|
+
*
|
|
45
|
+
* @param sqlOrderParam name of the http parameter with `OINODbSqlOrder` definition
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
static setOinoSqlOrderParam(sqlOrderParam: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* Set the name of the OINODbSqlLimit-param field
|
|
51
|
+
*
|
|
52
|
+
* @param sqlLimitParam name of the http parameter with `OINODbSqlLimit` definition
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
static setOinoSqlLimitParam(sqlLimitParam: string): void;
|
|
56
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OINODb } from "./OINODb.js";
|
|
2
|
+
/**
|
|
3
|
+
* Database class (constructor) type
|
|
4
|
+
* @param dbParams database parameters
|
|
5
|
+
*/
|
|
6
|
+
export type OINODbConstructor = new (dbParams: OINODbParams) => OINODb;
|
|
7
|
+
/** Database parameters */
|
|
8
|
+
export type OINODbParams = {
|
|
9
|
+
/** Name of the database class (e.g. OINODbPostgresql) */
|
|
10
|
+
type: string;
|
|
11
|
+
/** Connection URL, either file://-path or an IP-address or an HTTP-url */
|
|
12
|
+
url: string;
|
|
13
|
+
/** Name of the database */
|
|
14
|
+
database: string;
|
|
15
|
+
/** TCP port of the database */
|
|
16
|
+
port?: number;
|
|
17
|
+
/** Username used to authenticate */
|
|
18
|
+
user?: string;
|
|
19
|
+
/** Password used to authenticate */
|
|
20
|
+
password?: string;
|
|
21
|
+
};
|
|
22
|
+
/** Constant for undefined values */
|
|
23
|
+
export declare const OINODB_UNDEFINED = "";
|