@egi/smart-db 2.3.2 → 2.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.
- package/drivers/smart-db-better-sqlite3.d.ts +36 -0
- package/drivers/smart-db-better-sqlite3.js +1 -0
- package/drivers/smart-db-mysql.d.ts +26 -0
- package/drivers/smart-db-mysql.js +1 -0
- package/drivers/smart-db-mysql2.d.ts +26 -0
- package/drivers/smart-db-mysql2.js +1 -0
- package/drivers/smart-db-sqlite3.d.ts +30 -0
- package/drivers/smart-db-sqlite3.js +1 -0
- package/helpers/extract-db-api.d.ts +1 -0
- package/helpers/extract-db-api.js +1 -0
- package/models/abstract-model.d.ts +22 -0
- package/models/abstract-model.js +1 -0
- package/models/smart-db-core-table-model.d.ts +35 -0
- package/models/smart-db-core-table-model.js +1 -0
- package/models/smart-db-dictionary.d.ts +13 -0
- package/models/smart-db-dictionary.js +1 -0
- package/models/smart-db-log-model.d.ts +65 -0
- package/models/smart-db-log-model.js +1 -0
- package/models/smart-db-version-model.d.ts +65 -0
- package/models/smart-db-version-model.js +1 -0
- package/models/smart-db-version-view-model.d.ts +71 -0
- package/models/smart-db-version-view-model.js +1 -0
- package/models/sqlite-master-model.d.ts +36 -0
- package/models/sqlite-master-model.js +1 -0
- package/models/sqlite-sequence-model.d.ts +24 -0
- package/models/sqlite-sequence-model.js +1 -0
- package/package.json +1 -1
- package/{src/smart-db-api.ts → smart-db-api.d.ts} +0 -3
- package/smart-db-api.js +1 -0
- package/smart-db-globals.d.ts +22 -0
- package/smart-db-globals.js +1 -0
- package/{src/smart-db-interfaces.ts → smart-db-interfaces.d.ts} +34 -82
- package/smart-db-interfaces.js +1 -0
- package/smart-db-log.d.ts +58 -0
- package/smart-db-log.js +1 -0
- package/smart-db-sql-build-data.d.ts +9 -0
- package/smart-db-sql-build-data.js +1 -0
- package/smart-db-upgrade-manager.d.ts +13 -0
- package/smart-db-upgrade-manager.js +1 -0
- package/smart-db.d.ts +67 -0
- package/smart-db.js +1 -0
- package/.eslintrc.json +0 -212
- package/README.md +0 -2
- package/bin/copy-assets +0 -6
- package/src/drivers/smart-db-better-sqlite3.ts +0 -284
- package/src/drivers/smart-db-mysql.ts +0 -159
- package/src/drivers/smart-db-mysql2.ts +0 -159
- package/src/drivers/smart-db-sqlite3.ts +0 -198
- package/src/helpers/extract-db-api.ts +0 -465
- package/src/helpers/terser-tree.ts +0 -39
- package/src/models/abstract-model.ts +0 -209
- package/src/models/smart-db-core-table-model.ts +0 -161
- package/src/models/smart-db-dictionary.ts +0 -28
- package/src/models/smart-db-log-model.ts +0 -316
- package/src/models/smart-db-version-model.ts +0 -316
- package/src/models/smart-db-version-view-model.ts +0 -347
- package/src/models/sqlite-master-model.ts +0 -140
- package/src/models/sqlite-sequence-model.ts +0 -91
- package/src/smart-db-globals.ts +0 -136
- package/src/smart-db-log.ts +0 -262
- package/src/smart-db-sql-build-data.ts +0 -28
- package/src/smart-db-upgrade-manager.ts +0 -171
- package/src/smart-db.ts +0 -854
- package/test/data/sql-engine-tests.json +0 -232
- package/test/db/mysql/database-init.sql +0 -11
- package/test/db/sqlite3/database-init.sql +0 -11
- package/test/exer.js +0 -28
- package/test/model/smart-db-dictionary.ts +0 -19
- package/test/model/test-table-model.ts +0 -214
- package/test/test.js +0 -273
- package/test/test2.js +0 -252
- package/tsconfig.json +0 -32
- package/tsconfig.pro.json +0 -32
- package/tsconfig.test-model.json +0 -23
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
2
|
-
import {FieldNamingStyle, GenericModelData, ModelAttributeMap, SqlValueType} from "../smart-db-interfaces";
|
|
3
|
-
|
|
4
|
-
export abstract class AbstractModel<T extends AbstractModel<T, D>, D extends GenericModelData> {
|
|
5
|
-
public abstract clone(): T;
|
|
6
|
-
|
|
7
|
-
public abstract getClassName(): string;
|
|
8
|
-
|
|
9
|
-
public abstract getTableName(): string;
|
|
10
|
-
|
|
11
|
-
public abstract getPrimaryKey(): string;
|
|
12
|
-
|
|
13
|
-
public abstract getAttributeMap(): ModelAttributeMap;
|
|
14
|
-
|
|
15
|
-
// overload this in child class
|
|
16
|
-
static readonly attributeMap: ModelAttributeMap = {};
|
|
17
|
-
|
|
18
|
-
static getTableName(): string {
|
|
19
|
-
return "overload this in child class";
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
static from(other: any): any {
|
|
23
|
-
// overload this in child class
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public assign(other: T | D, options?: { only?: string[]; exclude?: string[]; skipUndefined?: boolean }): void {
|
|
27
|
-
if (typeof other == "object") {
|
|
28
|
-
const attributeMap = this.getAttributeMap();
|
|
29
|
-
let skipUndefined = !options || !!options.skipUndefined;
|
|
30
|
-
Object.keys(attributeMap).forEach((attribute) => {
|
|
31
|
-
let ok = true;
|
|
32
|
-
if (options) {
|
|
33
|
-
if (options.only && !_.includes(options.only, attribute)) {
|
|
34
|
-
ok = false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (options.exclude && _.includes(options.exclude, attribute)) {
|
|
38
|
-
ok = false;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (ok) {
|
|
43
|
-
if (other instanceof AbstractModel && other.hasAttribute(attribute)) {
|
|
44
|
-
const otherValue = other.getValue(attribute);
|
|
45
|
-
if (!skipUndefined || otherValue !== undefined) {
|
|
46
|
-
this.setValue(attribute, otherValue);
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
if (other.hasOwnProperty(attribute)) {
|
|
50
|
-
const otherValue: string | number = (<any>other)[attribute] as (string | number);
|
|
51
|
-
if (!skipUndefined || otherValue !== undefined) {
|
|
52
|
-
this.setValue(attribute, otherValue);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// noinspection OverlyComplexFunctionJS
|
|
62
|
-
public setValue(attribute: string, value: string | number | boolean | Date): void {
|
|
63
|
-
const info = this.getAttributeMap()[attribute];
|
|
64
|
-
if (info) {
|
|
65
|
-
if (value === null) {
|
|
66
|
-
(<Record<string, any>>this)[info.attribute] = null;
|
|
67
|
-
} else if (value === undefined) {
|
|
68
|
-
delete (<Record<string, any>>this)[info.attribute];
|
|
69
|
-
} else {
|
|
70
|
-
switch (info.type) {
|
|
71
|
-
case "SqlValueType":
|
|
72
|
-
break;
|
|
73
|
-
|
|
74
|
-
case "string":
|
|
75
|
-
if (_.isNumber(value)) {
|
|
76
|
-
value = value.toString();
|
|
77
|
-
} else if (_.isBoolean(value)) {
|
|
78
|
-
value = value ? "true" : "false";
|
|
79
|
-
} else if (_.isDate(value)) {
|
|
80
|
-
value = this.toDbTimestamp(value);
|
|
81
|
-
}
|
|
82
|
-
break;
|
|
83
|
-
|
|
84
|
-
case "number":
|
|
85
|
-
if (_.isString(value)) {
|
|
86
|
-
value = parseFloat(value);
|
|
87
|
-
} else if (_.isBoolean(value)) {
|
|
88
|
-
value = value ? 1 : 0;
|
|
89
|
-
} else if (_.isDate(value)) {
|
|
90
|
-
value = value.getTime();
|
|
91
|
-
}
|
|
92
|
-
break;
|
|
93
|
-
|
|
94
|
-
case "boolean":
|
|
95
|
-
if (_.isString(value)) {
|
|
96
|
-
value = !value.match(/(F|N|false|no|0)/i);
|
|
97
|
-
} else if (_.isNumber(value)) {
|
|
98
|
-
value = !!value;
|
|
99
|
-
} else if (_.isDate(value)) {
|
|
100
|
-
value = true;
|
|
101
|
-
}
|
|
102
|
-
break;
|
|
103
|
-
|
|
104
|
-
case "Date":
|
|
105
|
-
if (_.isString(value)) {
|
|
106
|
-
if (value.match(/^\d{4}-[01][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-5][0-9]\s*$/)) {
|
|
107
|
-
value += " GMT";
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (_.isNumber(value) || _.isString(value) || _.isDate(value)) {
|
|
112
|
-
value = new Date(value);
|
|
113
|
-
} else {
|
|
114
|
-
value = new Date();
|
|
115
|
-
}
|
|
116
|
-
break;
|
|
117
|
-
|
|
118
|
-
default:
|
|
119
|
-
throw `AbstractModel.setValue: unknown data type '${info.type}'`;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
(<Record<string, any>>this)[info.attribute] = value;
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
throw `unknown attribute ${attribute} for ${this.getClassName()}`;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
public getValue(attribute: string): string | number | boolean {
|
|
131
|
-
const info = this.getAttributeMap()[attribute];
|
|
132
|
-
return (<Record<string, any>>this)[info.attribute] as (string | number | boolean);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
public hasAttribute(attribute: string): boolean {
|
|
136
|
-
return !!this.getAttributeMap()[attribute];
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// noinspection JSUnusedGlobalSymbols
|
|
140
|
-
public clear(attributes: string | string[]): void {
|
|
141
|
-
if (!_.isArray(attributes)) {
|
|
142
|
-
attributes = [attributes];
|
|
143
|
-
}
|
|
144
|
-
const attributeMap = this.getAttributeMap();
|
|
145
|
-
|
|
146
|
-
attributes.forEach((attribute) => {
|
|
147
|
-
const info = attributeMap[attribute];
|
|
148
|
-
if (info) {
|
|
149
|
-
delete (<Record<string, any>>this)[info.attribute];
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
public getPlainObject(style: FieldNamingStyle, includeVirtuals?: boolean, fields?: string[]): D {
|
|
155
|
-
const attributeMap = this.getAttributeMap();
|
|
156
|
-
const plainObjectFields: string[] = [];
|
|
157
|
-
|
|
158
|
-
if (includeVirtuals === undefined) {
|
|
159
|
-
includeVirtuals = true;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
_.forOwn(attributeMap, (info, attribute) => {
|
|
163
|
-
let includeAttribute = style == FieldNamingStyle.All || (includeVirtuals && info.virtual);
|
|
164
|
-
if (!includeAttribute) {
|
|
165
|
-
if (style == FieldNamingStyle.Database) {
|
|
166
|
-
includeAttribute = info.physical;
|
|
167
|
-
} else if (style == FieldNamingStyle.TypeScript) {
|
|
168
|
-
includeAttribute = info.typeScriptStyle;
|
|
169
|
-
} else {
|
|
170
|
-
throw `unknown style ${style}`;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (includeAttribute) {
|
|
175
|
-
if (!fields || _.includes(fields, attribute)) {
|
|
176
|
-
plainObjectFields.push(attribute);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
const plainObject: Record<string, SqlValueType> = {};
|
|
182
|
-
|
|
183
|
-
plainObjectFields.forEach((attribute) => {
|
|
184
|
-
const info = attributeMap[attribute];
|
|
185
|
-
if (info) {
|
|
186
|
-
const value = (<Record<string, any>>this)[info.attribute] as SqlValueType;
|
|
187
|
-
if (value !== undefined) {
|
|
188
|
-
plainObject[attribute] = value;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
return plainObject as D;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// noinspection JSMethodCanBeStatic
|
|
197
|
-
private toDbTimestamp(d: Date | number): string {
|
|
198
|
-
let timestampString: string;
|
|
199
|
-
if (d) {
|
|
200
|
-
if (_.isNumber(d)) {
|
|
201
|
-
d = new Date(d);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
timestampString = d.toISOString().substr(0, 23).replace("T", " ");
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return timestampString;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/member-ordering */
|
|
2
|
-
// noinspection JSUnusedGlobalSymbols
|
|
3
|
-
|
|
4
|
-
import {GenericModelData, ModelAttributeMap} from "../smart-db-interfaces";
|
|
5
|
-
import {AbstractModel} from "./abstract-model";
|
|
6
|
-
|
|
7
|
-
export interface SmartDbCoreTableModelData extends GenericModelData {
|
|
8
|
-
id?: number;
|
|
9
|
-
name?: string;
|
|
10
|
-
type?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class SmartDbCoreTableModel extends AbstractModel<SmartDbCoreTableModel, SmartDbCoreTableModelData> {
|
|
14
|
-
private _id?: number;
|
|
15
|
-
private _name?: string;
|
|
16
|
-
private _type?: string;
|
|
17
|
-
|
|
18
|
-
static readonly attributeMap: ModelAttributeMap = {
|
|
19
|
-
id: {
|
|
20
|
-
alias: "ctb_id",
|
|
21
|
-
typeScriptStyle: true,
|
|
22
|
-
type: "number",
|
|
23
|
-
attribute: "_id"
|
|
24
|
-
},
|
|
25
|
-
ctb_id: {
|
|
26
|
-
physical: true,
|
|
27
|
-
type: "number",
|
|
28
|
-
attribute: "_id"
|
|
29
|
-
},
|
|
30
|
-
name: {
|
|
31
|
-
alias: "ctb_name",
|
|
32
|
-
typeScriptStyle: true,
|
|
33
|
-
type: "string",
|
|
34
|
-
attribute: "_name"
|
|
35
|
-
},
|
|
36
|
-
ctb_name: {
|
|
37
|
-
physical: true,
|
|
38
|
-
type: "string",
|
|
39
|
-
attribute: "_name"
|
|
40
|
-
},
|
|
41
|
-
type: {
|
|
42
|
-
alias: "ctb_type",
|
|
43
|
-
typeScriptStyle: true,
|
|
44
|
-
type: "string",
|
|
45
|
-
attribute: "_type"
|
|
46
|
-
},
|
|
47
|
-
ctb_type: {
|
|
48
|
-
physical: true,
|
|
49
|
-
type: "string",
|
|
50
|
-
attribute: "_type"
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
constructor(data?: SmartDbCoreTableModel | SmartDbCoreTableModelData) {
|
|
55
|
-
super();
|
|
56
|
-
if (data) {
|
|
57
|
-
this.assign(data);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
static getClassName(): string {
|
|
62
|
-
return "SmartDbCoreTableModel";
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
static getTableName(): string {
|
|
66
|
-
return "smart_db_core_table";
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
static getPrimaryKey(): string {
|
|
70
|
-
return "ctb_id";
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
static from(other: SmartDbCoreTableModel | SmartDbCoreTableModelData): SmartDbCoreTableModel {
|
|
74
|
-
let value: SmartDbCoreTableModel = null;
|
|
75
|
-
if (other) {
|
|
76
|
-
value = new SmartDbCoreTableModel();
|
|
77
|
-
if (other instanceof SmartDbCoreTableModel) {
|
|
78
|
-
Object.assign(value, other);
|
|
79
|
-
} else {
|
|
80
|
-
value.assign(other);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return value;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public clone(): SmartDbCoreTableModel {
|
|
87
|
-
return SmartDbCoreTableModel.from(this);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
public getClassName(): string {
|
|
91
|
-
return "SmartDbCoreTableModel";
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
public getTableName(): string {
|
|
95
|
-
return "smart_db_core_table";
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public getPrimaryKey(): string {
|
|
99
|
-
return "ctb_id";
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
public getAttributeMap(): ModelAttributeMap {
|
|
103
|
-
return SmartDbCoreTableModel.attributeMap;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// noinspection FunctionNamingConventionJS
|
|
107
|
-
get ctb_id(): number {
|
|
108
|
-
return this._id;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// noinspection FunctionNamingConventionJS
|
|
112
|
-
set ctb_id(id: number) {
|
|
113
|
-
this._id = id;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// noinspection FunctionNamingConventionJS
|
|
117
|
-
get ctb_name(): string {
|
|
118
|
-
return this._name;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// noinspection FunctionNamingConventionJS
|
|
122
|
-
set ctb_name(name: string) {
|
|
123
|
-
this._name = name;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// noinspection FunctionNamingConventionJS
|
|
127
|
-
get ctb_type(): string {
|
|
128
|
-
return this._type;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// noinspection FunctionNamingConventionJS
|
|
132
|
-
set ctb_type(type: string) {
|
|
133
|
-
this._type = type;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// noinspection FunctionNamingConventionJS
|
|
137
|
-
get id(): number {
|
|
138
|
-
return this._id;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// noinspection FunctionNamingConventionJS
|
|
142
|
-
set id(id: number) {
|
|
143
|
-
this._id = id;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
get name(): string {
|
|
147
|
-
return this._name;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
set name(name: string) {
|
|
151
|
-
this._name = name;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
get type(): string {
|
|
155
|
-
return this._type;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
set type(type: string) {
|
|
159
|
-
this._type = type;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {SmartDbCoreTableModel} from "./smart-db-core-table-model";
|
|
2
|
-
import {SmartDbLogModel} from "./smart-db-log-model";
|
|
3
|
-
import {SmartDbVersionModel} from "./smart-db-version-model";
|
|
4
|
-
import {SmartDbVersionViewModel} from "./smart-db-version-view-model";
|
|
5
|
-
|
|
6
|
-
interface SmartDbDictionaryEntry {
|
|
7
|
-
cls: typeof SmartDbCoreTableModel |
|
|
8
|
-
typeof SmartDbLogModel |
|
|
9
|
-
typeof SmartDbVersionModel |
|
|
10
|
-
typeof SmartDbVersionViewModel;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class SmartDbDictionary {
|
|
14
|
-
static models: { [relation: string]: SmartDbDictionaryEntry; } = {
|
|
15
|
-
SmartDbCoreTableModel: {
|
|
16
|
-
cls: SmartDbCoreTableModel
|
|
17
|
-
},
|
|
18
|
-
SmartDbLogModel: {
|
|
19
|
-
cls: SmartDbLogModel
|
|
20
|
-
},
|
|
21
|
-
SmartDbVersionModel: {
|
|
22
|
-
cls: SmartDbVersionModel
|
|
23
|
-
},
|
|
24
|
-
SmartDbVersionViewModel: {
|
|
25
|
-
cls: SmartDbVersionViewModel
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/member-ordering */
|
|
2
|
-
// noinspection JSUnusedGlobalSymbols
|
|
3
|
-
|
|
4
|
-
import {GenericModelData, ModelAttributeMap} from "../smart-db-interfaces";
|
|
5
|
-
import {AbstractModel} from "./abstract-model";
|
|
6
|
-
|
|
7
|
-
export interface SmartDbLogModelData extends GenericModelData {
|
|
8
|
-
id?: number;
|
|
9
|
-
severity?: string;
|
|
10
|
-
type?: string;
|
|
11
|
-
location?: string;
|
|
12
|
-
info?: string;
|
|
13
|
-
data?: string;
|
|
14
|
-
user?: string;
|
|
15
|
-
timestamp?: Date;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class SmartDbLogModel extends AbstractModel<SmartDbLogModel, SmartDbLogModelData> {
|
|
19
|
-
private _id?: number;
|
|
20
|
-
private _severity?: string;
|
|
21
|
-
private _type?: string;
|
|
22
|
-
private _location?: string;
|
|
23
|
-
private _info?: string;
|
|
24
|
-
private _data?: string;
|
|
25
|
-
private _user?: string;
|
|
26
|
-
private _timestamp?: Date;
|
|
27
|
-
|
|
28
|
-
static readonly attributeMap: ModelAttributeMap = {
|
|
29
|
-
id: {
|
|
30
|
-
alias: "log_id",
|
|
31
|
-
typeScriptStyle: true,
|
|
32
|
-
type: "number",
|
|
33
|
-
attribute: "_id"
|
|
34
|
-
},
|
|
35
|
-
log_id: {
|
|
36
|
-
physical: true,
|
|
37
|
-
type: "number",
|
|
38
|
-
attribute: "_id"
|
|
39
|
-
},
|
|
40
|
-
severity: {
|
|
41
|
-
alias: "log_severity",
|
|
42
|
-
typeScriptStyle: true,
|
|
43
|
-
type: "string",
|
|
44
|
-
attribute: "_severity"
|
|
45
|
-
},
|
|
46
|
-
log_severity: {
|
|
47
|
-
physical: true,
|
|
48
|
-
type: "string",
|
|
49
|
-
attribute: "_severity"
|
|
50
|
-
},
|
|
51
|
-
type: {
|
|
52
|
-
alias: "log_type",
|
|
53
|
-
typeScriptStyle: true,
|
|
54
|
-
type: "string",
|
|
55
|
-
attribute: "_type"
|
|
56
|
-
},
|
|
57
|
-
log_type: {
|
|
58
|
-
physical: true,
|
|
59
|
-
type: "string",
|
|
60
|
-
attribute: "_type"
|
|
61
|
-
},
|
|
62
|
-
location: {
|
|
63
|
-
alias: "log_location",
|
|
64
|
-
typeScriptStyle: true,
|
|
65
|
-
type: "string",
|
|
66
|
-
attribute: "_location"
|
|
67
|
-
},
|
|
68
|
-
log_location: {
|
|
69
|
-
physical: true,
|
|
70
|
-
type: "string",
|
|
71
|
-
attribute: "_location"
|
|
72
|
-
},
|
|
73
|
-
info: {
|
|
74
|
-
alias: "log_info",
|
|
75
|
-
typeScriptStyle: true,
|
|
76
|
-
type: "string",
|
|
77
|
-
attribute: "_info"
|
|
78
|
-
},
|
|
79
|
-
log_info: {
|
|
80
|
-
physical: true,
|
|
81
|
-
type: "string",
|
|
82
|
-
attribute: "_info"
|
|
83
|
-
},
|
|
84
|
-
data: {
|
|
85
|
-
alias: "log_data",
|
|
86
|
-
typeScriptStyle: true,
|
|
87
|
-
type: "string",
|
|
88
|
-
attribute: "_data"
|
|
89
|
-
},
|
|
90
|
-
log_data: {
|
|
91
|
-
physical: true,
|
|
92
|
-
type: "string",
|
|
93
|
-
attribute: "_data"
|
|
94
|
-
},
|
|
95
|
-
user: {
|
|
96
|
-
alias: "log_user",
|
|
97
|
-
typeScriptStyle: true,
|
|
98
|
-
type: "string",
|
|
99
|
-
attribute: "_user"
|
|
100
|
-
},
|
|
101
|
-
log_user: {
|
|
102
|
-
physical: true,
|
|
103
|
-
type: "string",
|
|
104
|
-
attribute: "_user"
|
|
105
|
-
},
|
|
106
|
-
timestamp: {
|
|
107
|
-
alias: "log_timestamp",
|
|
108
|
-
typeScriptStyle: true,
|
|
109
|
-
type: "Date",
|
|
110
|
-
attribute: "_timestamp"
|
|
111
|
-
},
|
|
112
|
-
log_timestamp: {
|
|
113
|
-
physical: true,
|
|
114
|
-
type: "Date",
|
|
115
|
-
attribute: "_timestamp"
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
constructor(data?: SmartDbLogModel | SmartDbLogModelData) {
|
|
120
|
-
super();
|
|
121
|
-
if (data) {
|
|
122
|
-
this.assign(data);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
static getClassName(): string {
|
|
127
|
-
return "SmartDbLogModel";
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
static getTableName(): string {
|
|
131
|
-
return "smart_db_log";
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
static getPrimaryKey(): string {
|
|
135
|
-
return "log_id";
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
static from(other: SmartDbLogModel | SmartDbLogModelData): SmartDbLogModel {
|
|
139
|
-
let value: SmartDbLogModel = null;
|
|
140
|
-
if (other) {
|
|
141
|
-
value = new SmartDbLogModel();
|
|
142
|
-
if (other instanceof SmartDbLogModel) {
|
|
143
|
-
Object.assign(value, other);
|
|
144
|
-
} else {
|
|
145
|
-
value.assign(other);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return value;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public clone(): SmartDbLogModel {
|
|
152
|
-
return SmartDbLogModel.from(this);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
public getClassName(): string {
|
|
156
|
-
return "SmartDbLogModel";
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
public getTableName(): string {
|
|
160
|
-
return "smart_db_log";
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
public getPrimaryKey(): string {
|
|
164
|
-
return "log_id";
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
public getAttributeMap(): ModelAttributeMap {
|
|
168
|
-
return SmartDbLogModel.attributeMap;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
get data(): string {
|
|
172
|
-
return this._data;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
set data(data: string) {
|
|
176
|
-
this._data = data;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// noinspection FunctionNamingConventionJS
|
|
180
|
-
get id(): number {
|
|
181
|
-
return this._id;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// noinspection FunctionNamingConventionJS
|
|
185
|
-
set id(id: number) {
|
|
186
|
-
this._id = id;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
get info(): string {
|
|
190
|
-
return this._info;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
set info(info: string) {
|
|
194
|
-
this._info = info;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
get location(): string {
|
|
198
|
-
return this._location;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
set location(location: string) {
|
|
202
|
-
this._location = location;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// noinspection FunctionNamingConventionJS
|
|
206
|
-
get log_data(): string {
|
|
207
|
-
return this._data;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// noinspection FunctionNamingConventionJS
|
|
211
|
-
set log_data(data: string) {
|
|
212
|
-
this._data = data;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// noinspection FunctionNamingConventionJS
|
|
216
|
-
get log_id(): number {
|
|
217
|
-
return this._id;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// noinspection FunctionNamingConventionJS
|
|
221
|
-
set log_id(id: number) {
|
|
222
|
-
this._id = id;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// noinspection FunctionNamingConventionJS
|
|
226
|
-
get log_info(): string {
|
|
227
|
-
return this._info;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// noinspection FunctionNamingConventionJS
|
|
231
|
-
set log_info(info: string) {
|
|
232
|
-
this._info = info;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// noinspection FunctionNamingConventionJS
|
|
236
|
-
get log_location(): string {
|
|
237
|
-
return this._location;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// noinspection FunctionNamingConventionJS
|
|
241
|
-
set log_location(location: string) {
|
|
242
|
-
this._location = location;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// noinspection FunctionNamingConventionJS
|
|
246
|
-
get log_severity(): string {
|
|
247
|
-
return this._severity;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// noinspection FunctionNamingConventionJS
|
|
251
|
-
set log_severity(severity: string) {
|
|
252
|
-
this._severity = severity;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// noinspection FunctionNamingConventionJS
|
|
256
|
-
get log_timestamp(): Date {
|
|
257
|
-
return this._timestamp;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// noinspection FunctionNamingConventionJS
|
|
261
|
-
set log_timestamp(timestamp: Date) {
|
|
262
|
-
this._timestamp = timestamp;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// noinspection FunctionNamingConventionJS
|
|
266
|
-
get log_type(): string {
|
|
267
|
-
return this._type;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// noinspection FunctionNamingConventionJS
|
|
271
|
-
set log_type(type: string) {
|
|
272
|
-
this._type = type;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// noinspection FunctionNamingConventionJS
|
|
276
|
-
get log_user(): string {
|
|
277
|
-
return this._user;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
// noinspection FunctionNamingConventionJS
|
|
281
|
-
set log_user(user: string) {
|
|
282
|
-
this._user = user;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
get severity(): string {
|
|
286
|
-
return this._severity;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
set severity(severity: string) {
|
|
290
|
-
this._severity = severity;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
get timestamp(): Date {
|
|
294
|
-
return this._timestamp;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
set timestamp(timestamp: Date) {
|
|
298
|
-
this._timestamp = timestamp;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
get type(): string {
|
|
302
|
-
return this._type;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
set type(type: string) {
|
|
306
|
-
this._type = type;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
get user(): string {
|
|
310
|
-
return this._user;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
set user(user: string) {
|
|
314
|
-
this._user = user;
|
|
315
|
-
}
|
|
316
|
-
}
|