@oino-ts/db 0.3.3 → 0.3.4

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.
@@ -1,382 +1,382 @@
1
- /*
2
- * This Source Code Form is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
- */
6
-
7
- import { OINODbDataFieldParams, OINODataCell, OINODb, OINOLog, OINO_ERROR_PREFIX } from "./index.js";
8
-
9
- /**
10
- * Base class for a column of data responsible for appropriatelly serializing/deserializing the data.
11
- *
12
- */
13
- export class OINODbDataField {
14
-
15
- /** OINODB reference*/
16
- readonly db:OINODb;
17
-
18
- /** Name of the field */
19
- readonly name: string;
20
-
21
- /** Internal type of field*/
22
- readonly type: string;
23
-
24
- /** SQL type of the field */
25
- readonly sqlType: string;
26
-
27
- /** Maximum length of the field (or 0) */
28
- readonly maxLength: number;
29
-
30
- /** Parameters for the field */
31
- readonly fieldParams: OINODbDataFieldParams;
32
-
33
- /**
34
- * Constructor for a data field
35
- *
36
- * @param db OINODb reference
37
- * @param name name of the field
38
- * @param type internal type of the field
39
- * @param sqlType column type in database
40
- * @param fieldParams parameters of the field
41
- * @param maxLength maximum length of the field (or 0)
42
- *
43
- */
44
- constructor(db:OINODb, name: string, type:string, sqlType: string, fieldParams: OINODbDataFieldParams, maxLength:number = 0) {
45
- this.db = db
46
- this.name = name
47
- this.type = type
48
- this.maxLength = maxLength
49
- this.sqlType = sqlType
50
- this.fieldParams = fieldParams
51
- // OINOLog.debug("OINODbDataField.constructor", {this:this})
52
- }
53
-
54
- /**
55
- * Pring debug information for the field
56
- *
57
- * @param length length of the debug output (or 0 for as long as needed)
58
- *
59
- */
60
- printColumnDebug(length:number = 0): string {
61
- let params: string = "";
62
- if (this.fieldParams.isPrimaryKey) {
63
- params += "PK ";
64
- }
65
- if (this.fieldParams.isForeignKey) {
66
- params += "FK ";
67
- }
68
- if (this.fieldParams.isAutoInc) {
69
- params += "AUTOINC ";
70
- }
71
- if (this.fieldParams.isNotNull) {
72
- params += "NOTNUL ";
73
- }
74
- if (params != "") {
75
- params = "{" + params.trim() + "}";
76
- }
77
- if (this.maxLength > 0) {
78
- params = this.sqlType + "(" + this.maxLength + ")" + params
79
- } else {
80
- params = this.sqlType + params
81
- }
82
- const name_length:number = length - 2 - 1 - params.length
83
- let result:string = this.name
84
- if (length > 0) {
85
- if (result.length > name_length) {
86
- result = result.substring(0, name_length-2)+".."
87
- }
88
- result = (result + ":" + params).padEnd(length-2, " ")
89
- } else {
90
- result = this.type + ":" + result + ":" + params
91
- }
92
- return "[" + result + "]";
93
- }
94
-
95
- /**
96
- * Serialize cell value in the given content format.
97
- *
98
- * @param cellVal cell value
99
- *
100
- */
101
- serializeCell(cellVal: OINODataCell):string|null|undefined {
102
- cellVal = this.db.parseSqlValueAsCell(cellVal, this.sqlType)
103
- if ((cellVal === null) || (cellVal === undefined)) {
104
- return cellVal // let content type encoder worry what to do with the value (so not force it to string)
105
- } else {
106
- return cellVal.toString()
107
- }
108
- }
109
-
110
- /**
111
- * Parce cell value from string using field type specific formatting rules.
112
- *
113
- * @param value string value
114
- *
115
- */
116
- deserializeCell(value: string|null|undefined): OINODataCell {
117
- return value
118
- }
119
-
120
- /**
121
- * Print data cell (from deserialization) as SQL-string.
122
- *
123
- * @param cellVal cell value
124
- *
125
- */
126
- printCellAsSqlValue(cellVal: OINODataCell):string {
127
- return this.db.printCellAsSqlValue(cellVal, this.sqlType);
128
- }
129
-
130
- /**
131
- * Print name of column as SQL.
132
- *
133
- */
134
- printSqlColumnName():string {
135
- return this.db.printSqlColumnname(this.name)
136
- }
137
- }
138
-
139
- /**
140
- * Specialised class for a string column.
141
- *
142
- */
143
- export class OINOStringDataField extends OINODbDataField {
144
-
145
- /**
146
- * Constructor for a string data field
147
- *
148
- * @param db OINODb reference
149
- * @param name name of the field
150
- * @param sqlType column type in database
151
- * @param fieldParams parameters of the field
152
- * @param maxLength maximum length of the field (or 0)
153
- *
154
- */
155
- constructor(db:OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams, maxLength: number) {
156
- super(db, name, "string", sqlType, fieldParams, maxLength)
157
- }
158
-
159
- }
160
-
161
- /**
162
- * Specialised class for a boolean column.
163
- *
164
- */
165
- export class OINOBooleanDataField extends OINODbDataField {
166
-
167
- /**
168
- * Constructor for a boolean data field
169
- *
170
- * @param db OINODb reference
171
- * @param name name of the field
172
- * @param sqlType column type in database
173
- * @param fieldParams parameters of the field
174
- *
175
- */
176
- constructor(db:OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams) {
177
- super(db, name, "boolean", sqlType, fieldParams)
178
- }
179
- /**
180
- * Serialize cell value in the given content format.
181
- *
182
- * @param cellVal cell value
183
- *
184
- */
185
- serializeCell(cellVal: OINODataCell):string|null|undefined {
186
- const parsed_value:string = (this.db.parseSqlValueAsCell(cellVal, this.sqlType) || "").toString()
187
- let result:string
188
- // console.log("OINOBooleanDataField.serializeCell: parsed_value=" + parsed_value)
189
- if ((parsed_value == "") || (parsed_value.toLowerCase() == "false") || (parsed_value.match(/^0+$/))) {
190
- result = "false"
191
- } else {
192
- result = "true"
193
- }
194
- return result
195
- }
196
-
197
- /**
198
- * Parce cell value from string using field type specific formatting rules.
199
- *
200
- * @param value string value
201
- *
202
- */
203
- deserializeCell(value: string|null|undefined): OINODataCell {
204
- if (value == null || value == "" || value.toString().toLowerCase() == "false" || value == "0") { // TODO: testaa poistaa .toString()
205
- return false
206
- } else {
207
- return true
208
- }
209
- }
210
- }
211
-
212
- /**
213
- * Specialised class for a number column.
214
- *
215
- */
216
- export class OINONumberDataField extends OINODbDataField {
217
-
218
- /**
219
- * Constructor for a string data field
220
- *
221
- * @param db OINODb reference
222
- * @param name name of the field
223
- * @param sqlType column type in database
224
- * @param fieldParams parameters of the field
225
- *
226
- */
227
- constructor(db:OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams) {
228
- super(db, name, "number", sqlType, fieldParams)
229
- }
230
-
231
- /**
232
- * Serialize cell value in the given content format.
233
- *
234
- * @param cellVal cell value
235
- *
236
- */
237
- serializeCell(cellVal: OINODataCell):string|null|undefined {
238
- let result:string|null
239
- if ((cellVal === null) || (cellVal === undefined) || (cellVal === "")) {
240
- result = null
241
- } else {
242
- result = cellVal.toString()
243
- }
244
- return result
245
- }
246
-
247
- /**
248
- * Parce cell value from string using field type specific formatting rules.
249
- *
250
- * @param value string value
251
- *
252
- */
253
- deserializeCell(value: string|null|undefined): OINODataCell {
254
- if (value === undefined) {
255
- return undefined
256
- } else if ((value === "") || (value === null)) {
257
- return null
258
- } else {
259
- const result:number = parseFloat(value)
260
- if (isNaN(result)) {
261
- OINOLog.error("OINONumberDataField.toSql: Invalid value!", {value:value})
262
- throw new Error(OINO_ERROR_PREFIX + ": OINONumberDataField.deserializeCell - Invalid value '" + value + "'") // incorrectly formatted data could be a security risk, abort processing
263
- }
264
- return result
265
- }
266
- }
267
- }
268
-
269
- /**
270
- * Specialised class for a blob column.
271
- *
272
- */
273
- export class OINOBlobDataField extends OINODbDataField {
274
-
275
- /**
276
- * Constructor for a blob data field
277
- *
278
- * @param db OINODb reference
279
- * @param name name of the field
280
- * @param sqlType column type in database
281
- * @param fieldParams parameters of the field
282
- * @param maxLength maximum length of the field (or 0)
283
- *
284
- */
285
- constructor(db:OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams, maxLength:number) {
286
- super(db, name, "blob", sqlType, fieldParams, maxLength)
287
- }
288
-
289
- /**
290
- * Serialize cell value in the given content format.
291
- *
292
- * @param cellVal cell value
293
- *
294
- */
295
- serializeCell(cellVal: OINODataCell):string|null|undefined {
296
- // OINOLog.debug("OINOBlobDataField.serializeCell", {cellVal:cellVal})
297
- if ((cellVal === null) || (cellVal === undefined)) {
298
- return cellVal
299
-
300
- } else if (cellVal instanceof Uint8Array) {
301
- return Buffer.from(cellVal as Uint8Array).toString('base64')
302
-
303
- } else {
304
- return cellVal.toString()
305
- }
306
- }
307
-
308
- /**
309
- * Parce cell value from string using field type specific formatting rules.
310
- *
311
- * @param value string value
312
- *
313
- */
314
- deserializeCell(value: string|null|undefined): OINODataCell {
315
- if (value == null) {
316
- return Buffer.alloc(0)
317
-
318
- } else {
319
- return Buffer.from(value, 'base64') // Blob-field data is base64 encoded and converted internally to UInt8Array / Buffer
320
- }
321
- }
322
-
323
- }
324
-
325
- /**
326
- * Specialised class for a datetime column.
327
- *
328
- */
329
- export class OINODatetimeDataField extends OINODbDataField {
330
-
331
- /**
332
- * Constructor for a string data field
333
- *
334
- * @param db OINODb reference
335
- * @param name name of the field
336
- * @param sqlType column type in database
337
- * @param fieldParams parameters of the field
338
- *
339
- */
340
- constructor(db:OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams) {
341
- super(db, name, "datetime", sqlType, fieldParams)
342
- }
343
-
344
- /**
345
- * Serialize cell value in the given content format.
346
- *
347
- * @param cellVal cell value
348
- *
349
- */
350
- serializeCell(cellVal: OINODataCell): string|null|undefined {
351
- // OINOLog.debug("OINODatetimeDataField.serializeCell", {cellVal:cellVal, type:typeof(cellVal)})
352
- if (typeof(cellVal) == "string") {
353
- cellVal = this.db.parseSqlValueAsCell(cellVal, this.sqlType)
354
- // OINOLog.debug("OINODatetimeDataField.serializeCell parsed", {cellVal:cellVal, type:typeof(cellVal)})
355
- }
356
- if ((cellVal === null) || (cellVal === undefined)) {
357
- return cellVal
358
-
359
- } else if (cellVal instanceof Date) {
360
- return cellVal.toISOString()
361
-
362
- } else {
363
- return cellVal.toString()
364
- }
365
- }
366
-
367
- /**
368
- * Parce cell value from string using field type specific formatting rules.
369
- *
370
- * @param value string value
371
- *
372
- */
373
- deserializeCell(value: string|null|undefined): OINODataCell {
374
- // OINOLog.debug("OINODatetimeDataField.deserializeCell", {strVal:strVal})
375
- if ((value === null) || (value === undefined)) {
376
- return value
377
- } else {
378
- return new Date(value)
379
- }
380
- }
381
-
382
- }
1
+ /*
2
+ * This Source Code Form is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ */
6
+
7
+ import { OINODbDataFieldParams, OINODataCell, OINODb, OINOLog, OINO_ERROR_PREFIX } from "./index.js";
8
+
9
+ /**
10
+ * Base class for a column of data responsible for appropriatelly serializing/deserializing the data.
11
+ *
12
+ */
13
+ export class OINODbDataField {
14
+
15
+ /** OINODB reference*/
16
+ readonly db:OINODb;
17
+
18
+ /** Name of the field */
19
+ readonly name: string;
20
+
21
+ /** Internal type of field*/
22
+ readonly type: string;
23
+
24
+ /** SQL type of the field */
25
+ readonly sqlType: string;
26
+
27
+ /** Maximum length of the field (or 0) */
28
+ readonly maxLength: number;
29
+
30
+ /** Parameters for the field */
31
+ readonly fieldParams: OINODbDataFieldParams;
32
+
33
+ /**
34
+ * Constructor for a data field
35
+ *
36
+ * @param db OINODb reference
37
+ * @param name name of the field
38
+ * @param type internal type of the field
39
+ * @param sqlType column type in database
40
+ * @param fieldParams parameters of the field
41
+ * @param maxLength maximum length of the field (or 0)
42
+ *
43
+ */
44
+ constructor(db:OINODb, name: string, type:string, sqlType: string, fieldParams: OINODbDataFieldParams, maxLength:number = 0) {
45
+ this.db = db
46
+ this.name = name
47
+ this.type = type
48
+ this.maxLength = maxLength
49
+ this.sqlType = sqlType
50
+ this.fieldParams = fieldParams
51
+ // OINOLog.debug("OINODbDataField.constructor", {this:this})
52
+ }
53
+
54
+ /**
55
+ * Pring debug information for the field
56
+ *
57
+ * @param length length of the debug output (or 0 for as long as needed)
58
+ *
59
+ */
60
+ printColumnDebug(length:number = 0): string {
61
+ let params: string = "";
62
+ if (this.fieldParams.isPrimaryKey) {
63
+ params += "PK ";
64
+ }
65
+ if (this.fieldParams.isForeignKey) {
66
+ params += "FK ";
67
+ }
68
+ if (this.fieldParams.isAutoInc) {
69
+ params += "AUTOINC ";
70
+ }
71
+ if (this.fieldParams.isNotNull) {
72
+ params += "NOTNUL ";
73
+ }
74
+ if (params != "") {
75
+ params = "{" + params.trim() + "}";
76
+ }
77
+ if (this.maxLength > 0) {
78
+ params = this.sqlType + "(" + this.maxLength + ")" + params
79
+ } else {
80
+ params = this.sqlType + params
81
+ }
82
+ const name_length:number = length - 2 - 1 - params.length
83
+ let result:string = this.name
84
+ if (length > 0) {
85
+ if (result.length > name_length) {
86
+ result = result.substring(0, name_length-2)+".."
87
+ }
88
+ result = (result + ":" + params).padEnd(length-2, " ")
89
+ } else {
90
+ result = this.type + ":" + result + ":" + params
91
+ }
92
+ return "[" + result + "]";
93
+ }
94
+
95
+ /**
96
+ * Serialize cell value in the given content format.
97
+ *
98
+ * @param cellVal cell value
99
+ *
100
+ */
101
+ serializeCell(cellVal: OINODataCell):string|null|undefined {
102
+ cellVal = this.db.parseSqlValueAsCell(cellVal, this.sqlType)
103
+ if ((cellVal === null) || (cellVal === undefined)) {
104
+ return cellVal // let content type encoder worry what to do with the value (so not force it to string)
105
+ } else {
106
+ return cellVal.toString()
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Parce cell value from string using field type specific formatting rules.
112
+ *
113
+ * @param value string value
114
+ *
115
+ */
116
+ deserializeCell(value: string|null|undefined): OINODataCell {
117
+ return value
118
+ }
119
+
120
+ /**
121
+ * Print data cell (from deserialization) as SQL-string.
122
+ *
123
+ * @param cellVal cell value
124
+ *
125
+ */
126
+ printCellAsSqlValue(cellVal: OINODataCell):string {
127
+ return this.db.printCellAsSqlValue(cellVal, this.sqlType);
128
+ }
129
+
130
+ /**
131
+ * Print name of column as SQL.
132
+ *
133
+ */
134
+ printSqlColumnName():string {
135
+ return this.db.printSqlColumnname(this.name)
136
+ }
137
+ }
138
+
139
+ /**
140
+ * Specialised class for a string column.
141
+ *
142
+ */
143
+ export class OINOStringDataField extends OINODbDataField {
144
+
145
+ /**
146
+ * Constructor for a string data field
147
+ *
148
+ * @param db OINODb reference
149
+ * @param name name of the field
150
+ * @param sqlType column type in database
151
+ * @param fieldParams parameters of the field
152
+ * @param maxLength maximum length of the field (or 0)
153
+ *
154
+ */
155
+ constructor(db:OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams, maxLength: number) {
156
+ super(db, name, "string", sqlType, fieldParams, maxLength)
157
+ }
158
+
159
+ }
160
+
161
+ /**
162
+ * Specialised class for a boolean column.
163
+ *
164
+ */
165
+ export class OINOBooleanDataField extends OINODbDataField {
166
+
167
+ /**
168
+ * Constructor for a boolean data field
169
+ *
170
+ * @param db OINODb reference
171
+ * @param name name of the field
172
+ * @param sqlType column type in database
173
+ * @param fieldParams parameters of the field
174
+ *
175
+ */
176
+ constructor(db:OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams) {
177
+ super(db, name, "boolean", sqlType, fieldParams)
178
+ }
179
+ /**
180
+ * Serialize cell value in the given content format.
181
+ *
182
+ * @param cellVal cell value
183
+ *
184
+ */
185
+ serializeCell(cellVal: OINODataCell):string|null|undefined {
186
+ const parsed_value:string = (this.db.parseSqlValueAsCell(cellVal, this.sqlType) || "").toString()
187
+ let result:string
188
+ // console.log("OINOBooleanDataField.serializeCell: parsed_value=" + parsed_value)
189
+ if ((parsed_value == "") || (parsed_value.toLowerCase() == "false") || (parsed_value.match(/^0+$/))) {
190
+ result = "false"
191
+ } else {
192
+ result = "true"
193
+ }
194
+ return result
195
+ }
196
+
197
+ /**
198
+ * Parce cell value from string using field type specific formatting rules.
199
+ *
200
+ * @param value string value
201
+ *
202
+ */
203
+ deserializeCell(value: string|null|undefined): OINODataCell {
204
+ if (value == null || value == "" || value.toString().toLowerCase() == "false" || value == "0") { // TODO: testaa poistaa .toString()
205
+ return false
206
+ } else {
207
+ return true
208
+ }
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Specialised class for a number column.
214
+ *
215
+ */
216
+ export class OINONumberDataField extends OINODbDataField {
217
+
218
+ /**
219
+ * Constructor for a string data field
220
+ *
221
+ * @param db OINODb reference
222
+ * @param name name of the field
223
+ * @param sqlType column type in database
224
+ * @param fieldParams parameters of the field
225
+ *
226
+ */
227
+ constructor(db:OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams) {
228
+ super(db, name, "number", sqlType, fieldParams)
229
+ }
230
+
231
+ /**
232
+ * Serialize cell value in the given content format.
233
+ *
234
+ * @param cellVal cell value
235
+ *
236
+ */
237
+ serializeCell(cellVal: OINODataCell):string|null|undefined {
238
+ let result:string|null
239
+ if ((cellVal === null) || (cellVal === undefined) || (cellVal === "")) {
240
+ result = null
241
+ } else {
242
+ result = cellVal.toString()
243
+ }
244
+ return result
245
+ }
246
+
247
+ /**
248
+ * Parce cell value from string using field type specific formatting rules.
249
+ *
250
+ * @param value string value
251
+ *
252
+ */
253
+ deserializeCell(value: string|null|undefined): OINODataCell {
254
+ if (value === undefined) {
255
+ return undefined
256
+ } else if ((value === "") || (value === null)) {
257
+ return null
258
+ } else {
259
+ const result:number = parseFloat(value)
260
+ if (isNaN(result)) {
261
+ OINOLog.error("OINONumberDataField.toSql: Invalid value!", {value:value})
262
+ throw new Error(OINO_ERROR_PREFIX + ": OINONumberDataField.deserializeCell - Invalid value '" + value + "'") // incorrectly formatted data could be a security risk, abort processing
263
+ }
264
+ return result
265
+ }
266
+ }
267
+ }
268
+
269
+ /**
270
+ * Specialised class for a blob column.
271
+ *
272
+ */
273
+ export class OINOBlobDataField extends OINODbDataField {
274
+
275
+ /**
276
+ * Constructor for a blob data field
277
+ *
278
+ * @param db OINODb reference
279
+ * @param name name of the field
280
+ * @param sqlType column type in database
281
+ * @param fieldParams parameters of the field
282
+ * @param maxLength maximum length of the field (or 0)
283
+ *
284
+ */
285
+ constructor(db:OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams, maxLength:number) {
286
+ super(db, name, "blob", sqlType, fieldParams, maxLength)
287
+ }
288
+
289
+ /**
290
+ * Serialize cell value in the given content format.
291
+ *
292
+ * @param cellVal cell value
293
+ *
294
+ */
295
+ serializeCell(cellVal: OINODataCell):string|null|undefined {
296
+ // OINOLog.debug("OINOBlobDataField.serializeCell", {cellVal:cellVal})
297
+ if ((cellVal === null) || (cellVal === undefined)) {
298
+ return cellVal
299
+
300
+ } else if (cellVal instanceof Uint8Array) {
301
+ return Buffer.from(cellVal as Uint8Array).toString('base64')
302
+
303
+ } else {
304
+ return cellVal.toString()
305
+ }
306
+ }
307
+
308
+ /**
309
+ * Parce cell value from string using field type specific formatting rules.
310
+ *
311
+ * @param value string value
312
+ *
313
+ */
314
+ deserializeCell(value: string|null|undefined): OINODataCell {
315
+ if (value == null) {
316
+ return Buffer.alloc(0)
317
+
318
+ } else {
319
+ return Buffer.from(value, 'base64') // Blob-field data is base64 encoded and converted internally to UInt8Array / Buffer
320
+ }
321
+ }
322
+
323
+ }
324
+
325
+ /**
326
+ * Specialised class for a datetime column.
327
+ *
328
+ */
329
+ export class OINODatetimeDataField extends OINODbDataField {
330
+
331
+ /**
332
+ * Constructor for a string data field
333
+ *
334
+ * @param db OINODb reference
335
+ * @param name name of the field
336
+ * @param sqlType column type in database
337
+ * @param fieldParams parameters of the field
338
+ *
339
+ */
340
+ constructor(db:OINODb, name: string, sqlType: string, fieldParams: OINODbDataFieldParams) {
341
+ super(db, name, "datetime", sqlType, fieldParams)
342
+ }
343
+
344
+ /**
345
+ * Serialize cell value in the given content format.
346
+ *
347
+ * @param cellVal cell value
348
+ *
349
+ */
350
+ serializeCell(cellVal: OINODataCell): string|null|undefined {
351
+ // OINOLog.debug("OINODatetimeDataField.serializeCell", {cellVal:cellVal, type:typeof(cellVal)})
352
+ if (typeof(cellVal) == "string") {
353
+ cellVal = this.db.parseSqlValueAsCell(cellVal, this.sqlType)
354
+ // OINOLog.debug("OINODatetimeDataField.serializeCell parsed", {cellVal:cellVal, type:typeof(cellVal)})
355
+ }
356
+ if ((cellVal === null) || (cellVal === undefined)) {
357
+ return cellVal
358
+
359
+ } else if (cellVal instanceof Date) {
360
+ return cellVal.toISOString()
361
+
362
+ } else {
363
+ return cellVal.toString()
364
+ }
365
+ }
366
+
367
+ /**
368
+ * Parce cell value from string using field type specific formatting rules.
369
+ *
370
+ * @param value string value
371
+ *
372
+ */
373
+ deserializeCell(value: string|null|undefined): OINODataCell {
374
+ // OINOLog.debug("OINODatetimeDataField.deserializeCell", {strVal:strVal})
375
+ if ((value === null) || (value === undefined)) {
376
+ return value
377
+ } else {
378
+ return new Date(value)
379
+ }
380
+ }
381
+
382
+ }