@oino-ts/db 0.16.2 → 0.17.1
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/cjs/OINODbApi.js +131 -59
- package/dist/cjs/OINODbConfig.js +0 -4
- package/dist/cjs/OINODbFactory.js +2 -67
- package/dist/cjs/OINODbParser.js +30 -27
- package/dist/cjs/OINODbSwagger.js +4 -4
- package/dist/cjs/index.js +2 -1
- package/dist/esm/OINODbApi.js +131 -60
- package/dist/esm/OINODbConfig.js +0 -4
- package/dist/esm/OINODbFactory.js +3 -68
- package/dist/esm/OINODbParser.js +30 -27
- package/dist/esm/OINODbSwagger.js +4 -4
- package/dist/esm/index.js +1 -1
- package/dist/types/OINODb.d.ts +2 -2
- package/dist/types/OINODbApi.d.ts +46 -16
- package/dist/types/OINODbConfig.d.ts +0 -4
- package/dist/types/OINODbFactory.d.ts +1 -7
- package/dist/types/OINODbParser.d.ts +11 -10
- package/dist/types/index.d.ts +1 -16
- package/package.json +37 -37
- package/src/OINODb.ts +321 -321
- package/src/OINODbApi.test.ts +492 -499
- package/src/OINODbApi.ts +602 -517
- package/src/OINODbConfig.ts +98 -104
- package/src/OINODbDataField.ts +403 -403
- package/src/OINODbDataModel.ts +291 -291
- package/src/OINODbFactory.ts +68 -137
- package/src/OINODbModelSet.ts +351 -351
- package/src/OINODbParser.ts +447 -443
- package/src/OINODbSqlParams.ts +592 -592
- package/src/OINODbSwagger.ts +208 -208
- package/src/index.ts +120 -136
package/src/OINODbConfig.ts
CHANGED
|
@@ -1,104 +1,98 @@
|
|
|
1
|
-
/** Set the name of the OINO ID field (default \_OINOID\_) */
|
|
2
|
-
|
|
3
|
-
export class OINODbConfig {
|
|
4
|
-
/** Name of the synthetic OINO ID field */
|
|
5
|
-
static OINODB_ID_FIELD:string = "_OINOID_"
|
|
6
|
-
/** Private key separator of the synthetic OINO ID field */
|
|
7
|
-
static OINODB_ID_SEPARATOR:string = "_"
|
|
8
|
-
private static OINODB_ID_SEPARATOR_ESCAPED:string = "%"
|
|
9
|
-
|
|
10
|
-
/** Name of the OINODbSqlFilter-parameter in request */
|
|
11
|
-
static OINODB_SQL_FILTER_PARAM:string = "oinosqlfilter"
|
|
12
|
-
|
|
13
|
-
/** Name of the OINODbSqlOrder-parameter in request */
|
|
14
|
-
static OINODB_SQL_ORDER_PARAM:string = "oinosqlorder"
|
|
15
|
-
|
|
16
|
-
/** Name of the OINODbSqlLimit-parameter in request */
|
|
17
|
-
static OINODB_SQL_LIMIT_PARAM:string = "oinosqllimit"
|
|
18
|
-
|
|
19
|
-
/** Name of the OINODbSqlAggregate-parameter in request */
|
|
20
|
-
static OINODB_SQL_AGGREGATE_PARAM:string = "oinosqlaggregate"
|
|
21
|
-
|
|
22
|
-
/** Name of the OINODbSqlSelect-parameter in request */
|
|
23
|
-
static OINODB_SQL_SELECT_PARAM:string = "oinosqlselect"
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
static
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
static setOinoSqlLimitParam(sqlLimitParam: string) {
|
|
100
|
-
if (sqlLimitParam) {
|
|
101
|
-
OINODbConfig.OINODB_SQL_LIMIT_PARAM = sqlLimitParam;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
1
|
+
/** Set the name of the OINO ID field (default \_OINOID\_) */
|
|
2
|
+
|
|
3
|
+
export class OINODbConfig {
|
|
4
|
+
/** Name of the synthetic OINO ID field */
|
|
5
|
+
static OINODB_ID_FIELD:string = "_OINOID_"
|
|
6
|
+
/** Private key separator of the synthetic OINO ID field */
|
|
7
|
+
static OINODB_ID_SEPARATOR:string = "_"
|
|
8
|
+
private static OINODB_ID_SEPARATOR_ESCAPED:string = "%"
|
|
9
|
+
|
|
10
|
+
/** Name of the OINODbSqlFilter-parameter in request */
|
|
11
|
+
static OINODB_SQL_FILTER_PARAM:string = "oinosqlfilter"
|
|
12
|
+
|
|
13
|
+
/** Name of the OINODbSqlOrder-parameter in request */
|
|
14
|
+
static OINODB_SQL_ORDER_PARAM:string = "oinosqlorder"
|
|
15
|
+
|
|
16
|
+
/** Name of the OINODbSqlLimit-parameter in request */
|
|
17
|
+
static OINODB_SQL_LIMIT_PARAM:string = "oinosqllimit"
|
|
18
|
+
|
|
19
|
+
/** Name of the OINODbSqlAggregate-parameter in request */
|
|
20
|
+
static OINODB_SQL_AGGREGATE_PARAM:string = "oinosqlaggregate"
|
|
21
|
+
|
|
22
|
+
/** Name of the OINODbSqlSelect-parameter in request */
|
|
23
|
+
static OINODB_SQL_SELECT_PARAM:string = "oinosqlselect"
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Set the name of the OINO ID field
|
|
27
|
+
* @param idField name of the OINO ID field
|
|
28
|
+
*/
|
|
29
|
+
static setOinoIdField(idField: string) {
|
|
30
|
+
if (idField) {
|
|
31
|
+
OINODbConfig.OINODB_ID_FIELD = idField;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Set the separator character of the OINO ID field
|
|
37
|
+
* @param idSeparator character to use as separator of id parts
|
|
38
|
+
*/
|
|
39
|
+
static setOinoIdSeparator(idSeparator: string) {
|
|
40
|
+
if (idSeparator && (idSeparator.length == 1)) {
|
|
41
|
+
OINODbConfig.OINODB_ID_SEPARATOR = idSeparator;
|
|
42
|
+
OINODbConfig.OINODB_ID_SEPARATOR_ESCAPED = '%' + idSeparator.charCodeAt(0).toString(16);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Print OINO ID for primary key values.
|
|
48
|
+
*
|
|
49
|
+
* @param primaryKeys an array of primary key values.
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
static printOINOId(primaryKeys:string[]):string {
|
|
53
|
+
let result:string = ""
|
|
54
|
+
for (let i=0; i< primaryKeys.length; i++) {
|
|
55
|
+
if (i > 0) {
|
|
56
|
+
result += OINODbConfig.OINODB_ID_SEPARATOR
|
|
57
|
+
}
|
|
58
|
+
result += encodeURIComponent(primaryKeys[i] as string).replaceAll(OINODbConfig.OINODB_ID_SEPARATOR, OINODbConfig.OINODB_ID_SEPARATOR_ESCAPED)
|
|
59
|
+
}
|
|
60
|
+
return result
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Set the name of the OINODbSqlFilter-param field
|
|
65
|
+
*
|
|
66
|
+
* @param sqlFilterParam name of the http parameter with `OINODbSqlFilter` definition
|
|
67
|
+
*
|
|
68
|
+
*/
|
|
69
|
+
static setOinoSqlFilterParam(sqlFilterParam: string) {
|
|
70
|
+
if (sqlFilterParam) {
|
|
71
|
+
OINODbConfig.OINODB_SQL_FILTER_PARAM = sqlFilterParam;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Set the name of the OINODbSqlOrder-param field
|
|
77
|
+
*
|
|
78
|
+
* @param sqlOrderParam name of the http parameter with `OINODbSqlOrder` definition
|
|
79
|
+
*
|
|
80
|
+
*/
|
|
81
|
+
static setOinoSqlOrderParam(sqlOrderParam: string) {
|
|
82
|
+
if (sqlOrderParam) {
|
|
83
|
+
OINODbConfig.OINODB_SQL_ORDER_PARAM = sqlOrderParam;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Set the name of the OINODbSqlLimit-param field
|
|
89
|
+
*
|
|
90
|
+
* @param sqlLimitParam name of the http parameter with `OINODbSqlLimit` definition
|
|
91
|
+
*
|
|
92
|
+
*/
|
|
93
|
+
static setOinoSqlLimitParam(sqlLimitParam: string) {
|
|
94
|
+
if (sqlLimitParam) {
|
|
95
|
+
OINODbConfig.OINODB_SQL_LIMIT_PARAM = sqlLimitParam;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|