@oino-ts/types 0.17.1 → 0.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/src/OINORequest.d.ts +14 -10
- package/common/src/OINOResult.d.ts +4 -1
- package/index.d.ts +23 -23
- package/package.json +28 -28
- package/db/src/OINODb.d.ts +0 -206
- package/db/src/OINODbApi.d.ts +0 -153
- package/db/src/OINODbConfig.d.ts +0 -56
- package/db/src/OINODbDataField.d.ts +0 -210
- package/db/src/OINODbDataModel.d.ts +0 -108
- package/db/src/OINODbDataSet.d.ts +0 -95
- package/db/src/OINODbFactory.d.ts +0 -31
- package/db/src/OINODbModelSet.d.ts +0 -61
- package/db/src/OINODbParser.d.ts +0 -54
- package/db/src/OINODbRequestParams.d.ts +0 -146
- package/db/src/OINODbSqlParams.d.ts +0 -296
- package/db/src/OINODbSwagger.d.ts +0 -25
- package/db/src/index.d.ts +0 -108
- package/db-bunsqlite/src/OINODbBunSqlite.d.ts +0 -91
- package/db-bunsqlite/src/index.d.ts +0 -1
- package/db-mariadb/src/OINODbMariadb.d.ts +0 -92
- package/db-mariadb/src/index.d.ts +0 -1
- package/db-mssql/src/OINODbMsSql.d.ts +0 -100
- package/db-mssql/src/index.d.ts +0 -1
- package/db-postgresql/src/OINODbPostgresql.d.ts +0 -89
- package/db-postgresql/src/index.d.ts +0 -1
- package/hashid/src/OINOHashid.d.ts +0 -42
- package/hashid/src/index.d.ts +0 -1
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import { OINODbDataFieldParams, OINODataCell, OINODb } from "./index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Base class for a column of data responsible for appropriatelly serializing/deserializing the data.
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export declare class OINODbDataField {
|
|
7
|
-
/** OINODB reference*/
|
|
8
|
-
readonly db: OINODb;
|
|
9
|
-
/** Name of the field */
|
|
10
|
-
readonly name: string;
|
|
11
|
-
/** Internal type of field*/
|
|
12
|
-
readonly type: string;
|
|
13
|
-
/** SQL type of the field */
|
|
14
|
-
readonly sqlType: string;
|
|
15
|
-
/** Maximum length of the field (or 0) */
|
|
16
|
-
readonly maxLength: number;
|
|
17
|
-
/** Parameters for the field */
|
|
18
|
-
readonly fieldParams: OINODbDataFieldParams;
|
|
19
|
-
/**
|
|
20
|
-
* Constructor for a data field
|
|
21
|
-
*
|
|
22
|
-
* @param db OINODb reference
|
|
23
|
-
* @param name name of the field
|
|
24
|
-
* @param type internal type of the field
|
|
25
|
-
* @param sqlType column type in database
|
|
26
|
-
* @param fieldParams parameters of the field
|
|
27
|
-
* @param maxLength maximum length of the field (or 0)
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
constructor(db: OINODb, name: string, type: string, sqlType: string, fieldParams: OINODbDataFieldParams, maxLength?: number);
|
|
31
|
-
/**
|
|
32
|
-
* Pring debug information for the field
|
|
33
|
-
*
|
|
34
|
-
* @param length length of the debug output (or 0 for as long as needed)
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
printColumnDebug(length?: number): string;
|
|
38
|
-
/**
|
|
39
|
-
* Serialize cell value in the given content format.
|
|
40
|
-
*
|
|
41
|
-
* @param cellVal cell value
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
serializeCell(cellVal: OINODataCell): string | null | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Parce cell value from string using field type specific formatting rules.
|
|
47
|
-
*
|
|
48
|
-
* @param value string value
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
deserializeCell(value: string | null | undefined): OINODataCell;
|
|
52
|
-
/**
|
|
53
|
-
* Print data cell (from deserialization) as SQL-string.
|
|
54
|
-
*
|
|
55
|
-
* @param cellVal cell value
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
printCellAsSqlValue(cellVal: OINODataCell): string;
|
|
59
|
-
/**
|
|
60
|
-
* Print name of column as SQL.
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
|
-
printSqlColumnName(): string;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Specialised class for a string column.
|
|
67
|
-
*
|
|
68
|
-
*/
|
|
69
|
-
export declare class OINOStringDataField extends OINODbDataField {
|
|
70
|
-
/**
|
|
71
|
-
* Constructor for a string data field
|
|
72
|
-
*
|
|
73
|
-
* @param db OINODb reference
|
|
74
|
-
* @param name name of the field
|
|
75
|
-
* @param sqlType column type in database
|
|
76
|
-
* @param fieldParams parameters of the field
|
|
77
|
-
* @param maxLength maximum length of the field (or 0)
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
|
-
constructor(db: OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams, maxLength: number);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Specialised class for a boolean column.
|
|
84
|
-
*
|
|
85
|
-
*/
|
|
86
|
-
export declare class OINOBooleanDataField extends OINODbDataField {
|
|
87
|
-
/**
|
|
88
|
-
* Constructor for a boolean data field
|
|
89
|
-
*
|
|
90
|
-
* @param db OINODb reference
|
|
91
|
-
* @param name name of the field
|
|
92
|
-
* @param sqlType column type in database
|
|
93
|
-
* @param fieldParams parameters of the field
|
|
94
|
-
*
|
|
95
|
-
*/
|
|
96
|
-
constructor(db: OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams);
|
|
97
|
-
/**
|
|
98
|
-
* Serialize cell value in the given content format.
|
|
99
|
-
*
|
|
100
|
-
* @param cellVal cell value
|
|
101
|
-
*
|
|
102
|
-
*/
|
|
103
|
-
serializeCell(cellVal: OINODataCell): string | null | undefined;
|
|
104
|
-
/**
|
|
105
|
-
* Parce cell value from string using field type specific formatting rules.
|
|
106
|
-
*
|
|
107
|
-
* @param value string value
|
|
108
|
-
*
|
|
109
|
-
*/
|
|
110
|
-
deserializeCell(value: string | null | undefined): OINODataCell;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Specialised class for a number column.
|
|
114
|
-
*
|
|
115
|
-
*/
|
|
116
|
-
export declare class OINONumberDataField extends OINODbDataField {
|
|
117
|
-
/**
|
|
118
|
-
* Constructor for a string data field
|
|
119
|
-
*
|
|
120
|
-
* @param db OINODb reference
|
|
121
|
-
* @param name name of the field
|
|
122
|
-
* @param sqlType column type in database
|
|
123
|
-
* @param fieldParams parameters of the field
|
|
124
|
-
*
|
|
125
|
-
*/
|
|
126
|
-
constructor(db: OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams);
|
|
127
|
-
/**
|
|
128
|
-
* Serialize cell value in the given content format.
|
|
129
|
-
*
|
|
130
|
-
* @param cellVal cell value
|
|
131
|
-
*
|
|
132
|
-
*/
|
|
133
|
-
serializeCell(cellVal: OINODataCell): string | null | undefined;
|
|
134
|
-
/**
|
|
135
|
-
* Parce cell value from string using field type specific formatting rules.
|
|
136
|
-
*
|
|
137
|
-
* @param value string value
|
|
138
|
-
*
|
|
139
|
-
*/
|
|
140
|
-
deserializeCell(value: string | null | undefined): OINODataCell;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Specialised class for a blob column.
|
|
144
|
-
*
|
|
145
|
-
*/
|
|
146
|
-
export declare class OINOBlobDataField extends OINODbDataField {
|
|
147
|
-
/**
|
|
148
|
-
* Constructor for a blob data field
|
|
149
|
-
*
|
|
150
|
-
* @param db OINODb reference
|
|
151
|
-
* @param name name of the field
|
|
152
|
-
* @param sqlType column type in database
|
|
153
|
-
* @param fieldParams parameters of the field
|
|
154
|
-
* @param maxLength maximum length of the field (or 0)
|
|
155
|
-
*
|
|
156
|
-
*/
|
|
157
|
-
constructor(db: OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams, maxLength: number);
|
|
158
|
-
/**
|
|
159
|
-
* Serialize cell value in the given content format.
|
|
160
|
-
*
|
|
161
|
-
* @param cellVal cell value
|
|
162
|
-
*
|
|
163
|
-
*/
|
|
164
|
-
serializeCell(cellVal: OINODataCell): string | null | undefined;
|
|
165
|
-
/**
|
|
166
|
-
* Parce cell value from string using field type specific formatting rules.
|
|
167
|
-
*
|
|
168
|
-
* @param value string value
|
|
169
|
-
*
|
|
170
|
-
*/
|
|
171
|
-
deserializeCell(value: string | null | undefined): OINODataCell;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Specialised class for a datetime column.
|
|
175
|
-
*
|
|
176
|
-
*/
|
|
177
|
-
export declare class OINODatetimeDataField extends OINODbDataField {
|
|
178
|
-
/**
|
|
179
|
-
* Constructor for a string data field
|
|
180
|
-
*
|
|
181
|
-
* @param db OINODb reference
|
|
182
|
-
* @param name name of the field
|
|
183
|
-
* @param sqlType column type in database
|
|
184
|
-
* @param fieldParams parameters of the field
|
|
185
|
-
*
|
|
186
|
-
*/
|
|
187
|
-
constructor(db: OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams);
|
|
188
|
-
/**
|
|
189
|
-
* Serialize cell value in the given content format.
|
|
190
|
-
*
|
|
191
|
-
* @param cellVal cell value
|
|
192
|
-
*
|
|
193
|
-
*/
|
|
194
|
-
serializeCell(cellVal: OINODataCell): string | null | undefined;
|
|
195
|
-
/**
|
|
196
|
-
* Serialize cell value in the given content format.
|
|
197
|
-
*
|
|
198
|
-
* @param cellVal cell value
|
|
199
|
-
* @param locale locale-object to format datetimes with
|
|
200
|
-
*
|
|
201
|
-
*/
|
|
202
|
-
serializeCellWithLocale(cellVal: OINODataCell, locale: Intl.DateTimeFormat): string | null | undefined;
|
|
203
|
-
/**
|
|
204
|
-
* Parce cell value from string using field type specific formatting rules.
|
|
205
|
-
*
|
|
206
|
-
* @param value string value
|
|
207
|
-
*
|
|
208
|
-
*/
|
|
209
|
-
deserializeCell(value: string | null | undefined): OINODataCell;
|
|
210
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { OINODbDataField, OINODbApi, OINODataRow, OINODbDataFieldFilter, OINODbSqlParams } from "./index.js";
|
|
2
|
-
/**
|
|
3
|
-
* OINO Datamodel object for representing one database table and it's columns.
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export declare class OINODbDataModel {
|
|
7
|
-
private _fieldIndexLookup;
|
|
8
|
-
/** Database refererence of the table */
|
|
9
|
-
readonly api: OINODbApi;
|
|
10
|
-
/** Field refererences of the API */
|
|
11
|
-
readonly fields: OINODbDataField[];
|
|
12
|
-
/**
|
|
13
|
-
* Constructor of the data model.
|
|
14
|
-
* NOTE! OINODbDataModel.initialize must be called after constructor to populate fields.
|
|
15
|
-
*
|
|
16
|
-
* @param api api of the data model
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
constructor(api: OINODbApi);
|
|
20
|
-
/**
|
|
21
|
-
* Initialize datamodel from SQL schema.
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
initialize(): Promise<void>;
|
|
25
|
-
private _printSqlColumnNames;
|
|
26
|
-
private _printSqlInsertColumnsAndValues;
|
|
27
|
-
private _printSqlUpdateValues;
|
|
28
|
-
private _printSqlPrimaryKeyCondition;
|
|
29
|
-
/**
|
|
30
|
-
* Add a field to the datamodel.
|
|
31
|
-
*
|
|
32
|
-
* @param field dataset field
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
35
|
-
addField(field: OINODbDataField): void;
|
|
36
|
-
/**
|
|
37
|
-
* Find a field of a given name if any.
|
|
38
|
-
*
|
|
39
|
-
* @param name name of the field to find
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
findFieldByName(name: string): OINODbDataField | null;
|
|
43
|
-
/**
|
|
44
|
-
* Find index of a field of a given name if any.
|
|
45
|
-
*
|
|
46
|
-
* @param name name of the field to find
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
49
|
-
findFieldIndexByName(name: string): number;
|
|
50
|
-
/**
|
|
51
|
-
* Find all fields based of given filter callback criteria (e.g. fields of certain data type, primary keys etc.)
|
|
52
|
-
*
|
|
53
|
-
* @param filter callback called for each field to include or not
|
|
54
|
-
*
|
|
55
|
-
*/
|
|
56
|
-
filterFields(filter: OINODbDataFieldFilter): OINODbDataField[];
|
|
57
|
-
/**
|
|
58
|
-
* Return the primary key values of one row in order of the data model
|
|
59
|
-
*
|
|
60
|
-
* @param row data row
|
|
61
|
-
* @param hashidValues apply hashid when applicable
|
|
62
|
-
*
|
|
63
|
-
*/
|
|
64
|
-
getRowPrimarykeyValues(row: OINODataRow, hashidValues?: boolean): string[];
|
|
65
|
-
/**
|
|
66
|
-
* Print debug information about the fields.
|
|
67
|
-
*
|
|
68
|
-
* @param separator string to separate field prints
|
|
69
|
-
*
|
|
70
|
-
*/
|
|
71
|
-
printDebug(separator?: string): string;
|
|
72
|
-
/**
|
|
73
|
-
* Print all public properties (db, table name, fields) of the datamodel. Used
|
|
74
|
-
* in automated testing validate schema has stayed the same.
|
|
75
|
-
*
|
|
76
|
-
*/
|
|
77
|
-
printFieldPublicPropertiesJson(): string;
|
|
78
|
-
/**
|
|
79
|
-
* Print SQL select statement using optional id and filter.
|
|
80
|
-
*
|
|
81
|
-
* @param id OINO ID (i.e. combined primary key values)
|
|
82
|
-
* @param params OINO reqest params
|
|
83
|
-
*
|
|
84
|
-
*/
|
|
85
|
-
printSqlSelect(id: string, params: OINODbSqlParams): string;
|
|
86
|
-
/**
|
|
87
|
-
* Print SQL insert statement from one data row.
|
|
88
|
-
*
|
|
89
|
-
* @param row one row of data in the data model
|
|
90
|
-
*
|
|
91
|
-
*/
|
|
92
|
-
printSqlInsert(row: OINODataRow): string;
|
|
93
|
-
/**
|
|
94
|
-
* Print SQL insert statement from one data row.
|
|
95
|
-
*
|
|
96
|
-
* @param id OINO ID (i.e. combined primary key values)
|
|
97
|
-
* @param row one row of data in the data model
|
|
98
|
-
*
|
|
99
|
-
*/
|
|
100
|
-
printSqlUpdate(id: string, row: OINODataRow): string;
|
|
101
|
-
/**
|
|
102
|
-
* Print SQL delete statement for id.
|
|
103
|
-
*
|
|
104
|
-
* @param id OINO ID (i.e. combined primary key values)
|
|
105
|
-
*
|
|
106
|
-
*/
|
|
107
|
-
printSqlDelete(id: string): string;
|
|
108
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { OINODataRow } from "./index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Base class for SQL results that can be asynchronously iterated (but
|
|
4
|
-
* not necessarity rewinded). Idea is to handle database specific mechanisms
|
|
5
|
-
* for returning and formatting conventions in the database specific
|
|
6
|
-
* implementation. Data might be in memory or streamed in chunks and
|
|
7
|
-
* `OINODbDataSet` will serve it out consistently.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
export declare abstract class OINODbDataSet {
|
|
11
|
-
private _data;
|
|
12
|
-
/** Error messages */
|
|
13
|
-
readonly messages: string[];
|
|
14
|
-
/**
|
|
15
|
-
* Constructor for `OINODbDataSet`.
|
|
16
|
-
*
|
|
17
|
-
* @param data internal database specific data type (constructor will throw if invalid)
|
|
18
|
-
* @param messages error messages from SQL-query
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
constructor(data: unknown, messages?: string[]);
|
|
22
|
-
/**
|
|
23
|
-
* Is data set empty.
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
abstract isEmpty(): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Is there no more content, i.e. either dataset is empty or we have moved beyond last line
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
abstract isEof(): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Attempts to moves dataset to the next row, possibly waiting for more data to become available. Returns !isEof().
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
abstract next(): Promise<boolean>;
|
|
37
|
-
/**
|
|
38
|
-
* Gets current row of data.
|
|
39
|
-
*
|
|
40
|
-
*/
|
|
41
|
-
abstract getRow(): OINODataRow;
|
|
42
|
-
/**
|
|
43
|
-
* Checks if the messages contain errors.
|
|
44
|
-
*
|
|
45
|
-
*/
|
|
46
|
-
hasErrors(): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Checks if the messages contain errors.
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
getFirstError(): string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Generic in memory implementation of a data set where data is an array of rows. Used
|
|
55
|
-
* by BunSqlite and automated testing. Can be rewinded.
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
export declare class OINODbMemoryDataSet extends OINODbDataSet {
|
|
59
|
-
private _rows;
|
|
60
|
-
private _currentRow;
|
|
61
|
-
private _eof;
|
|
62
|
-
/**
|
|
63
|
-
* Constructor of `OINODbMemoryDataSet`.
|
|
64
|
-
*
|
|
65
|
-
* @param data data as OINODataRow[] (constructor will throw if invalid)
|
|
66
|
-
* @param errors error messages from SQL-query
|
|
67
|
-
*
|
|
68
|
-
*/
|
|
69
|
-
constructor(data: unknown, errors?: string[]);
|
|
70
|
-
/**
|
|
71
|
-
* Is data set empty.
|
|
72
|
-
*
|
|
73
|
-
*/
|
|
74
|
-
isEmpty(): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Is there no more content, i.e. either dataset is empty or we have moved beyond last line
|
|
77
|
-
*
|
|
78
|
-
*/
|
|
79
|
-
isEof(): boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Attempts to moves dataset to the next row, possibly waiting for more data to become available. Returns !isEof().
|
|
82
|
-
*
|
|
83
|
-
*/
|
|
84
|
-
next(): Promise<boolean>;
|
|
85
|
-
/**
|
|
86
|
-
* Gets current row of data.
|
|
87
|
-
*
|
|
88
|
-
*/
|
|
89
|
-
getRow(): OINODataRow;
|
|
90
|
-
/**
|
|
91
|
-
* Rewinds data set to the first row, returns !isEof().
|
|
92
|
-
*
|
|
93
|
-
*/
|
|
94
|
-
first(): boolean;
|
|
95
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { OINODbApi, OINODbApiParams, OINODbParams, OINODb, OINODbConstructor } from "./index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Static factory class for easily creating things based on data
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export declare class OINODbFactory {
|
|
7
|
-
private static _dbRegistry;
|
|
8
|
-
/**
|
|
9
|
-
* Register a supported database class. Used to enable those that are installed in the factory
|
|
10
|
-
* instead of forcing everyone to install all database libraries.
|
|
11
|
-
*
|
|
12
|
-
* @param dbName name of the database implementation class
|
|
13
|
-
* @param dbTypeClass constructor for creating a database of that type
|
|
14
|
-
*/
|
|
15
|
-
static registerDb(dbName: string, dbTypeClass: OINODbConstructor): void;
|
|
16
|
-
/**
|
|
17
|
-
* Create database from parameters from the registered classes.
|
|
18
|
-
*
|
|
19
|
-
* @param params database connection parameters
|
|
20
|
-
* @param connect if true, connects to the database
|
|
21
|
-
* @param validate if true, validates the database connection
|
|
22
|
-
*/
|
|
23
|
-
static createDb(params: OINODbParams, connect?: boolean, validate?: boolean): Promise<OINODb>;
|
|
24
|
-
/**
|
|
25
|
-
* Create API from parameters and calls initDatamodel on the datamodel.
|
|
26
|
-
*
|
|
27
|
-
* @param db databased used in API
|
|
28
|
-
* @param params parameters of the API
|
|
29
|
-
*/
|
|
30
|
-
static createApi(db: OINODb, params: OINODbApiParams): Promise<OINODbApi>;
|
|
31
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { OINODbDataSet, OINODbDataModel, OINOContentType, OINODataCell, OINODbSqlParams } from "./index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Class for dataset based on a data model that can be serialized to
|
|
4
|
-
* a supported format:
|
|
5
|
-
* - JSON (application/json)
|
|
6
|
-
* - CSV (text/csv)
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
export declare class OINODbModelSet {
|
|
10
|
-
/** Reference to datamodel */
|
|
11
|
-
readonly datamodel: OINODbDataModel;
|
|
12
|
-
/** Reference to data set */
|
|
13
|
-
readonly dataset: OINODbDataSet;
|
|
14
|
-
/** SQL parameters */
|
|
15
|
-
readonly sqlParams?: OINODbSqlParams;
|
|
16
|
-
/** Collection of errors */
|
|
17
|
-
errors: string[];
|
|
18
|
-
/**
|
|
19
|
-
* Constructor for `OINODbModelSet`.
|
|
20
|
-
*
|
|
21
|
-
* @param datamodel data model
|
|
22
|
-
* @param dataset data set
|
|
23
|
-
* @param sqlParams SQL parameters
|
|
24
|
-
*/
|
|
25
|
-
constructor(datamodel: OINODbDataModel, dataset: OINODbDataSet, sqlParams?: OINODbSqlParams);
|
|
26
|
-
private _encodeAndHashFieldValue;
|
|
27
|
-
private _writeRowJson;
|
|
28
|
-
private _writeStringJson;
|
|
29
|
-
private _writeHeaderCsv;
|
|
30
|
-
private _writeRowCsv;
|
|
31
|
-
private _writeStringCsv;
|
|
32
|
-
private _writeRowFormdataParameterBlock;
|
|
33
|
-
private _writeRowFormdataFileBlock;
|
|
34
|
-
private _writeRowFormdata;
|
|
35
|
-
private _writeStringFormdata;
|
|
36
|
-
private _writeRowUrlencode;
|
|
37
|
-
private _writeStringUrlencode;
|
|
38
|
-
private _exportRow;
|
|
39
|
-
/**
|
|
40
|
-
* Serialize model set in the given format.
|
|
41
|
-
*
|
|
42
|
-
* @param [contentType=OINOContentType.json] serialization content type
|
|
43
|
-
*
|
|
44
|
-
*/
|
|
45
|
-
writeString(contentType?: OINOContentType): Promise<string>;
|
|
46
|
-
/**
|
|
47
|
-
* Get value of given field in the current row. Undefined if no rows,
|
|
48
|
-
* field not found or value does not exist.
|
|
49
|
-
*
|
|
50
|
-
* @param fieldName name of the field
|
|
51
|
-
* @param serialize serialize the value
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
getValueByFieldName(fieldName: string, serialize?: boolean): OINODataCell;
|
|
55
|
-
/**
|
|
56
|
-
* Export all rows as a record with OINOId as key and object with row cells as values.
|
|
57
|
-
*
|
|
58
|
-
* @param idFieldName optional field name to use as key instead of OINOId
|
|
59
|
-
*/
|
|
60
|
-
exportAsRecord(idFieldName?: string): Promise<Record<string, any>>;
|
|
61
|
-
}
|
package/db/src/OINODbParser.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { OINODbDataModel, OINODataRow } from "./index.js";
|
|
2
|
-
import { OINODbApiRequest } from "./OINODbApi.js";
|
|
3
|
-
/**
|
|
4
|
-
* Static factory class for easily creating things based on data
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export declare class OINODbParser {
|
|
8
|
-
/**
|
|
9
|
-
* Create data rows from request body based on the datamodel.
|
|
10
|
-
*
|
|
11
|
-
* @param datamodel datamodel of the api
|
|
12
|
-
* @param data data as either serialized string or unserialized JS object or OINODataRow-array or Buffer/Uint8Array binary data
|
|
13
|
-
* @param request parameters
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
static createRows(datamodel: OINODbDataModel, data: string | object | Buffer | Uint8Array, request: OINODbApiRequest): OINODataRow[];
|
|
17
|
-
/**
|
|
18
|
-
* Create data rows from request body based on the datamodel.
|
|
19
|
-
*
|
|
20
|
-
* @param datamodel datamodel of the api
|
|
21
|
-
* @param data data as a string
|
|
22
|
-
* @param request request parameters
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
private static _createRowsFromText;
|
|
26
|
-
/**
|
|
27
|
-
* Create data rows from request body based on the datamodel.
|
|
28
|
-
*
|
|
29
|
-
* @param datamodel datamodel of the api
|
|
30
|
-
* @param data data as an Buffer or Uint8Array
|
|
31
|
-
* @param request parameters
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
private static _createRowsFromBlob;
|
|
35
|
-
/**
|
|
36
|
-
* Create one data row from javascript object based on the datamodel.
|
|
37
|
-
* NOTE! Data assumed to be unserialized i.e. of the native type (string, number, boolean, Buffer)
|
|
38
|
-
*
|
|
39
|
-
* @param datamodel datamodel of the api
|
|
40
|
-
* @param data data as javascript object
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
private static _createRowFromObject;
|
|
44
|
-
private static _findCsvLineEnd;
|
|
45
|
-
private static _parseCsvLine;
|
|
46
|
-
private static _createRowFromCsv;
|
|
47
|
-
private static _createRowFromJsonObj;
|
|
48
|
-
private static _createRowFromJson;
|
|
49
|
-
private static _findMultipartBoundary;
|
|
50
|
-
private static _parseMultipartLine;
|
|
51
|
-
private static _multipartHeaderRegex;
|
|
52
|
-
private static _createRowFromFormdata;
|
|
53
|
-
private static _createRowFromUrlencoded;
|
|
54
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
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
|
-
}
|