@things-factory/dataset 5.0.0-zeta.19 → 5.0.0-zeta.21
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/client/pages/data-entry/data-entry-list-page.js +1 -1
- package/client/pages/data-ooc/data-ooc-list-page.js +2 -2
- package/client/pages/data-report/data-report-list-page.js +1 -1
- package/client/pages/data-sample/data-sample-list-page.js +1 -1
- package/client/pages/data-sensor/data-sensor-list-page.js +1 -1
- package/client/pages/data-set/data-set-list-page.js +1 -1
- package/dist-server/controllers/jasper-report.js +14 -9
- package/dist-server/controllers/jasper-report.js.map +1 -1
- package/dist-server/service/data-ooc/data-ooc-query.js +1 -1
- package/dist-server/service/data-ooc/data-ooc-query.js.map +1 -1
- package/dist-server/service/data-sample/data-sample-query.js +1 -1
- package/dist-server/service/data-sample/data-sample-query.js.map +1 -1
- package/dist-server/service/data-set/data-set-mutation.js +0 -17
- package/dist-server/service/data-set/data-set-mutation.js.map +1 -1
- package/dist-server/service/data-set/data-set-type.js +12 -9
- package/dist-server/service/data-set/data-set-type.js.map +1 -1
- package/dist-server/service/data-set-history/data-set-history-query.js +2 -2
- package/dist-server/service/data-set-history/data-set-history-query.js.map +1 -1
- package/dist-server/service/data-set-history/data-set-history.js +43 -55
- package/dist-server/service/data-set-history/data-set-history.js.map +1 -1
- package/dist-server/service/data-set-history/event-subscriber.js +26 -0
- package/dist-server/service/data-set-history/event-subscriber.js.map +1 -0
- package/dist-server/service/data-set-history/index.js +3 -1
- package/dist-server/service/data-set-history/index.js.map +1 -1
- package/dist-server/service/index.js +5 -1
- package/dist-server/service/index.js.map +1 -1
- package/package.json +18 -18
- package/server/controllers/jasper-report.ts +58 -48
- package/server/service/data-ooc/data-ooc-query.ts +1 -1
- package/server/service/data-sample/data-sample-query.ts +1 -1
- package/server/service/data-set/data-set-mutation.ts +0 -26
- package/server/service/data-set/data-set-type.ts +2 -1
- package/server/service/data-set-history/data-set-history-query.ts +2 -2
- package/server/service/data-set-history/data-set-history.ts +60 -59
- package/server/service/data-set-history/event-subscriber.ts +17 -0
- package/server/service/data-set-history/index.ts +2 -0
- package/server/service/index.ts +10 -1
- package/translations/en.json +2 -2
- package/translations/ko.json +2 -2
- package/translations/ms.json +1 -1
- package/translations/zh.json +1 -1
@@ -13,23 +13,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.DataSetHistory = void 0;
|
14
14
|
const type_graphql_1 = require("type-graphql");
|
15
15
|
const typeorm_1 = require("typeorm");
|
16
|
+
const typeorm_history_1 = require("@anchan828/typeorm-history");
|
16
17
|
const auth_base_1 = require("@things-factory/auth-base");
|
18
|
+
const env_1 = require("@things-factory/env");
|
17
19
|
const shell_1 = require("@things-factory/shell");
|
18
20
|
const data_item_type_1 = require("../data-set/data-item-type");
|
19
21
|
const data_set_1 = require("../data-set/data-set");
|
22
|
+
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
23
|
+
const DATABASE_TYPE = ORMCONFIG.type;
|
20
24
|
let DataSetHistory = class DataSetHistory {
|
21
25
|
constructor() {
|
22
26
|
this.version = 1;
|
23
27
|
}
|
24
28
|
};
|
25
29
|
__decorate([
|
26
|
-
(0, typeorm_1.
|
30
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
27
31
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
28
32
|
__metadata("design:type", String)
|
29
33
|
], DataSetHistory.prototype, "id", void 0);
|
30
34
|
__decorate([
|
31
|
-
(0, typeorm_1.
|
32
|
-
(0, type_graphql_1.Field)(),
|
35
|
+
(0, typeorm_1.Column)({ default: 1 }),
|
36
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
33
37
|
__metadata("design:type", Number)
|
34
38
|
], DataSetHistory.prototype, "version", void 0);
|
35
39
|
__decorate([
|
@@ -47,23 +51,17 @@ __decorate([
|
|
47
51
|
__metadata("design:type", String)
|
48
52
|
], DataSetHistory.prototype, "name", void 0);
|
49
53
|
__decorate([
|
50
|
-
(0, typeorm_1.Column)({
|
51
|
-
nullable: true
|
52
|
-
}),
|
54
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
53
55
|
(0, type_graphql_1.Field)({ nullable: true }),
|
54
56
|
__metadata("design:type", String)
|
55
57
|
], DataSetHistory.prototype, "description", void 0);
|
56
58
|
__decorate([
|
57
|
-
(0, typeorm_1.Column)({
|
58
|
-
nullable: true
|
59
|
-
}),
|
59
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
60
60
|
(0, type_graphql_1.Field)({ nullable: true }),
|
61
61
|
__metadata("design:type", Boolean)
|
62
62
|
], DataSetHistory.prototype, "active", void 0);
|
63
63
|
__decorate([
|
64
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.Role, {
|
65
|
-
nullable: true
|
66
|
-
}),
|
64
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.Role, { nullable: true }),
|
67
65
|
(0, type_graphql_1.Field)(type => auth_base_1.Role, { nullable: true }),
|
68
66
|
__metadata("design:type", typeof (_b = typeof auth_base_1.Role !== "undefined" && auth_base_1.Role) === "function" ? _b : Object)
|
69
67
|
], DataSetHistory.prototype, "entryRole", void 0);
|
@@ -72,9 +70,7 @@ __decorate([
|
|
72
70
|
__metadata("design:type", String)
|
73
71
|
], DataSetHistory.prototype, "entryRoleId", void 0);
|
74
72
|
__decorate([
|
75
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.Role, {
|
76
|
-
nullable: true
|
77
|
-
}),
|
73
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.Role, { nullable: true }),
|
78
74
|
(0, type_graphql_1.Field)(type => auth_base_1.Role, { nullable: true }),
|
79
75
|
__metadata("design:type", typeof (_c = typeof auth_base_1.Role !== "undefined" && auth_base_1.Role) === "function" ? _c : Object)
|
80
76
|
], DataSetHistory.prototype, "supervisoryRole", void 0);
|
@@ -83,51 +79,37 @@ __decorate([
|
|
83
79
|
__metadata("design:type", String)
|
84
80
|
], DataSetHistory.prototype, "supervisoryRoleId", void 0);
|
85
81
|
__decorate([
|
86
|
-
(0, typeorm_1.Column)({
|
87
|
-
nullable: true
|
88
|
-
}),
|
82
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
89
83
|
(0, type_graphql_1.Field)({ nullable: true }),
|
90
84
|
__metadata("design:type", String)
|
91
85
|
], DataSetHistory.prototype, "type", void 0);
|
92
86
|
__decorate([
|
93
|
-
(0, typeorm_1.Column)({
|
94
|
-
nullable: true
|
95
|
-
}),
|
87
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
96
88
|
(0, type_graphql_1.Field)({ nullable: true }),
|
97
89
|
__metadata("design:type", String)
|
98
90
|
], DataSetHistory.prototype, "entryType", void 0);
|
99
91
|
__decorate([
|
100
|
-
(0, typeorm_1.Column)({
|
101
|
-
nullable: true
|
102
|
-
}),
|
92
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
103
93
|
(0, type_graphql_1.Field)({ nullable: true }),
|
104
94
|
__metadata("design:type", String)
|
105
95
|
], DataSetHistory.prototype, "entryView", void 0);
|
106
96
|
__decorate([
|
107
|
-
(0, typeorm_1.Column)({
|
108
|
-
nullable: true
|
109
|
-
}),
|
97
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
110
98
|
(0, type_graphql_1.Field)({ nullable: true }),
|
111
99
|
__metadata("design:type", String)
|
112
100
|
], DataSetHistory.prototype, "monitorType", void 0);
|
113
101
|
__decorate([
|
114
|
-
(0, typeorm_1.Column)({
|
115
|
-
nullable: true
|
116
|
-
}),
|
102
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
117
103
|
(0, type_graphql_1.Field)({ nullable: true }),
|
118
104
|
__metadata("design:type", String)
|
119
105
|
], DataSetHistory.prototype, "monitorView", void 0);
|
120
106
|
__decorate([
|
121
|
-
(0, typeorm_1.Column)({
|
122
|
-
nullable: true
|
123
|
-
}),
|
107
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
124
108
|
(0, type_graphql_1.Field)({ nullable: true }),
|
125
109
|
__metadata("design:type", String)
|
126
110
|
], DataSetHistory.prototype, "reportType", void 0);
|
127
111
|
__decorate([
|
128
|
-
(0, typeorm_1.Column)({
|
129
|
-
nullable: true
|
130
|
-
}),
|
112
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
131
113
|
(0, type_graphql_1.Field)({ nullable: true }),
|
132
114
|
__metadata("design:type", String)
|
133
115
|
], DataSetHistory.prototype, "reportView", void 0);
|
@@ -136,9 +118,7 @@ __decorate([
|
|
136
118
|
__metadata("design:type", String)
|
137
119
|
], DataSetHistory.prototype, "reportTemplate", void 0);
|
138
120
|
__decorate([
|
139
|
-
(0, typeorm_1.Column)({
|
140
|
-
nullable: true
|
141
|
-
}),
|
121
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
142
122
|
(0, type_graphql_1.Field)({ nullable: true }),
|
143
123
|
__metadata("design:type", String)
|
144
124
|
], DataSetHistory.prototype, "useCase", void 0);
|
@@ -153,35 +133,27 @@ __decorate([
|
|
153
133
|
__metadata("design:type", Array)
|
154
134
|
], DataSetHistory.prototype, "dataItems", void 0);
|
155
135
|
__decorate([
|
156
|
-
(0, typeorm_1.Column)({
|
157
|
-
nullable: true
|
158
|
-
}),
|
136
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
159
137
|
(0, type_graphql_1.Field)({ nullable: true }),
|
160
138
|
__metadata("design:type", String)
|
161
139
|
], DataSetHistory.prototype, "schedule", void 0);
|
162
140
|
__decorate([
|
163
|
-
(0, typeorm_1.Column)({
|
164
|
-
nullable: true
|
165
|
-
}),
|
141
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
166
142
|
(0, type_graphql_1.Field)({ nullable: true }),
|
167
143
|
__metadata("design:type", String)
|
168
144
|
], DataSetHistory.prototype, "timezone", void 0);
|
169
145
|
__decorate([
|
170
|
-
(0, typeorm_1.Column)({
|
171
|
-
nullable: true
|
172
|
-
}),
|
146
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
173
147
|
(0, type_graphql_1.Field)({ nullable: true }),
|
174
148
|
__metadata("design:type", Date)
|
175
149
|
], DataSetHistory.prototype, "createdAt", void 0);
|
176
150
|
__decorate([
|
177
|
-
(0, typeorm_1.
|
151
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
178
152
|
(0, type_graphql_1.Field)({ nullable: true }),
|
179
153
|
__metadata("design:type", Date)
|
180
154
|
], DataSetHistory.prototype, "updatedAt", void 0);
|
181
155
|
__decorate([
|
182
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
183
|
-
nullable: true
|
184
|
-
}),
|
156
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
185
157
|
(0, type_graphql_1.Field)({ nullable: true }),
|
186
158
|
__metadata("design:type", typeof (_e = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _e : Object)
|
187
159
|
], DataSetHistory.prototype, "creator", void 0);
|
@@ -190,9 +162,7 @@ __decorate([
|
|
190
162
|
__metadata("design:type", String)
|
191
163
|
], DataSetHistory.prototype, "creatorId", void 0);
|
192
164
|
__decorate([
|
193
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
194
|
-
nullable: true
|
195
|
-
}),
|
165
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
196
166
|
(0, type_graphql_1.Field)({ nullable: true }),
|
197
167
|
__metadata("design:type", typeof (_f = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _f : Object)
|
198
168
|
], DataSetHistory.prototype, "updater", void 0);
|
@@ -200,8 +170,26 @@ __decorate([
|
|
200
170
|
(0, typeorm_1.RelationId)((dataSetHistory) => dataSetHistory.creator),
|
201
171
|
__metadata("design:type", String)
|
202
172
|
], DataSetHistory.prototype, "updaterId", void 0);
|
173
|
+
__decorate([
|
174
|
+
(0, typeorm_history_1.HistoryOriginalIdColumn)({ nullable: true }),
|
175
|
+
__metadata("design:type", String)
|
176
|
+
], DataSetHistory.prototype, "originalId", void 0);
|
177
|
+
__decorate([
|
178
|
+
(0, typeorm_history_1.HistoryActionColumn)({
|
179
|
+
nullable: false,
|
180
|
+
type: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
181
|
+
? 'enum'
|
182
|
+
: DATABASE_TYPE == 'oracle'
|
183
|
+
? 'varchar2'
|
184
|
+
: 'smallint',
|
185
|
+
enum: typeorm_history_1.HistoryActionType
|
186
|
+
}),
|
187
|
+
__metadata("design:type", String)
|
188
|
+
], DataSetHistory.prototype, "action", void 0);
|
203
189
|
DataSetHistory = __decorate([
|
204
190
|
(0, typeorm_1.Entity)(),
|
191
|
+
(0, typeorm_1.Index)('ix_data_set_history_0', (dataSetHistory) => [dataSetHistory.originalId, dataSetHistory.version], { unique: true }),
|
192
|
+
(0, typeorm_1.Index)('ix_data_set_history_1', (dataSetHistory) => [dataSetHistory.domain, dataSetHistory.originalId, dataSetHistory.version], { unique: true }),
|
205
193
|
(0, type_graphql_1.ObjectType)({ description: 'Entity for DataSetHistory' })
|
206
194
|
], DataSetHistory);
|
207
195
|
exports.DataSetHistory = DataSetHistory;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"data-set-history.js","sourceRoot":"","sources":["../../../server/service/data-set-history/data-set-history.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAAoD;AACpD,
|
1
|
+
{"version":3,"file":"data-set-history.js","sourceRoot":"","sources":["../../../server/service/data-set-history/data-set-history.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAAoD;AACpD,qCAA8F;AAE9F,gEAKmC;AACnC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA4D;AAE5D,+DAAqD;AACrD,mDAAuG;AAEvG,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAcpC,IAAa,cAAc,GAA3B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Ac,CAAC,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC,EACvF,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,eAAK,EACJ,uBAAuB,EACvB,CAAC,cAA8B,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC,EAC9G,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;GAC5C,cAAc,CAiI1B;AAjIY,wCAAc"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
+
exports.DataSetHistoryEntitySubscriber = void 0;
|
10
|
+
const typeorm_1 = require("typeorm");
|
11
|
+
const typeorm_history_1 = require("@anchan828/typeorm-history");
|
12
|
+
const data_set_1 = require("../data-set/data-set");
|
13
|
+
const data_set_history_1 = require("./data-set-history");
|
14
|
+
let DataSetHistoryEntitySubscriber = class DataSetHistoryEntitySubscriber extends typeorm_history_1.HistoryEntitySubscriber {
|
15
|
+
get entity() {
|
16
|
+
return data_set_1.DataSet;
|
17
|
+
}
|
18
|
+
get historyEntity() {
|
19
|
+
return data_set_history_1.DataSetHistory;
|
20
|
+
}
|
21
|
+
};
|
22
|
+
DataSetHistoryEntitySubscriber = __decorate([
|
23
|
+
(0, typeorm_1.EventSubscriber)()
|
24
|
+
], DataSetHistoryEntitySubscriber);
|
25
|
+
exports.DataSetHistoryEntitySubscriber = DataSetHistoryEntitySubscriber;
|
26
|
+
//# sourceMappingURL=event-subscriber.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"event-subscriber.js","sourceRoot":"","sources":["../../../server/service/data-set-history/event-subscriber.ts"],"names":[],"mappings":";;;;;;;;;AAAA,qCAAyC;AAEzC,gEAAoE;AAEpE,mDAA8C;AAC9C,yDAAmD;AAGnD,IAAa,8BAA8B,GAA3C,MAAa,8BAA+B,SAAQ,yCAAgD;IAClG,IAAW,MAAM;QACf,OAAO,kBAAO,CAAA;IAChB,CAAC;IAED,IAAW,aAAa;QACtB,OAAO,iCAAc,CAAA;IACvB,CAAC;CACF,CAAA;AARY,8BAA8B;IAD1C,IAAA,yBAAe,GAAE;GACL,8BAA8B,CAQ1C;AARY,wEAA8B"}
|
@@ -1,8 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.resolvers = exports.entities = void 0;
|
3
|
+
exports.subscribers = exports.resolvers = exports.entities = void 0;
|
4
4
|
const data_set_history_1 = require("./data-set-history");
|
5
5
|
const data_set_history_query_1 = require("./data-set-history-query");
|
6
|
+
const event_subscriber_1 = require("./event-subscriber");
|
6
7
|
exports.entities = [data_set_history_1.DataSetHistory];
|
7
8
|
exports.resolvers = [data_set_history_query_1.DataSetHistoryQuery];
|
9
|
+
exports.subscribers = [event_subscriber_1.DataSetHistoryEntitySubscriber];
|
8
10
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/data-set-history/index.ts"],"names":[],"mappings":";;;AAAA,yDAAmD;AACnD,qEAA8D;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/data-set-history/index.ts"],"names":[],"mappings":";;;AAAA,yDAAmD;AACnD,qEAA8D;AAC9D,yDAAmE;AAEtD,QAAA,QAAQ,GAAG,CAAC,iCAAc,CAAC,CAAA;AAC3B,QAAA,SAAS,GAAG,CAAC,4CAAmB,CAAC,CAAA;AACjC,QAAA,WAAW,GAAG,CAAC,iDAA8B,CAAC,CAAA"}
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
exports.schema = exports.entities = void 0;
|
17
|
+
exports.schema = exports.subscribers = exports.entities = void 0;
|
18
18
|
const data_item_1 = require("./data-item");
|
19
19
|
/* IMPORT ENTITIES AND RESOLVERS */
|
20
20
|
const data_ooc_1 = require("./data-ooc");
|
@@ -41,6 +41,10 @@ exports.entities = [
|
|
41
41
|
...data_set_history_1.entities,
|
42
42
|
...data_spec_1.entities
|
43
43
|
];
|
44
|
+
exports.subscribers = [
|
45
|
+
/* SUBSCRIBERS */
|
46
|
+
...data_set_history_1.subscribers
|
47
|
+
];
|
44
48
|
exports.schema = {
|
45
49
|
resolverClasses: [
|
46
50
|
/* RESOLVER CLASSES */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAA0D;AAC1D,mCAAmC;AACnC,yCAAuF;AACvF,+CAAgG;AAChG,+CAAgG;AAChG,yCAAuF;AACvF,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAA0D;AAC1D,mCAAmC;AACnC,yCAAuF;AACvF,+CAAgG;AAChG,+CAAgG;AAChG,yCAAuF;AACvF,yDAI2B;AAC3B,2CAA0F;AAE1F,yBAAyB;AACzB,sDAAmC;AACnC,4DAAyC;AACzC,4DAAyC;AACzC,sDAAmC;AACnC,sEAAmD;AACnD,4DAAyC;AACzC,wDAAqC;AAExB,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,oBAAgB;IACnB,GAAG,mBAAe;IAClB,GAAG,sBAAkB;IACrB,GAAG,sBAAkB;IACrB,GAAG,mBAAe;IAClB,GAAG,2BAAsB;IACzB,GAAG,oBAAgB;CACpB,CAAA;AAEY,QAAA,WAAW,GAAG;IACzB,iBAAiB;IACjB,GAAG,8BAAyB;CAC7B,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACtB,GAAG,oBAAgB;QACnB,GAAG,uBAAmB;QACtB,GAAG,uBAAmB;QACtB,GAAG,oBAAgB;QACnB,GAAG,4BAAuB;QAC1B,GAAG,qBAAiB;KACrB;CACF,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/dataset",
|
3
|
-
"version": "5.0.0-zeta.
|
3
|
+
"version": "5.0.0-zeta.21",
|
4
4
|
"main": "dist-server/index.js",
|
5
5
|
"browser": "client/index.js",
|
6
6
|
"things-factory": true,
|
@@ -24,24 +24,24 @@
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
25
25
|
},
|
26
26
|
"dependencies": {
|
27
|
-
"@operato/app": "^1.0.0-beta.
|
28
|
-
"@operato/data-grist": "^1.0.0-beta.
|
29
|
-
"@operato/dataset": "^1.0.0-beta.
|
30
|
-
"@operato/graphql": "^1.0.0-beta.
|
31
|
-
"@operato/grist-editor": "^1.0.0-beta.
|
32
|
-
"@operato/i18n": "^1.0.0-beta.
|
33
|
-
"@operato/layout": "^1.0.0-beta.
|
34
|
-
"@operato/shell": "^1.0.0-beta.
|
35
|
-
"@operato/styles": "^1.0.0-beta.
|
36
|
-
"@operato/utils": "^1.0.0-beta.
|
37
|
-
"@things-factory/auth-base": "^5.0.0-zeta.
|
38
|
-
"@things-factory/aws-base": "^5.0.0-zeta.
|
39
|
-
"@things-factory/board-service": "^5.0.0-zeta.
|
40
|
-
"@things-factory/env": "^5.0.0-zeta.
|
41
|
-
"@things-factory/shell": "^5.0.0-zeta.
|
42
|
-
"@things-factory/work-shift": "^5.0.0-zeta.
|
27
|
+
"@operato/app": "^1.0.0-beta.48",
|
28
|
+
"@operato/data-grist": "^1.0.0-beta.48",
|
29
|
+
"@operato/dataset": "^1.0.0-beta.48",
|
30
|
+
"@operato/graphql": "^1.0.0-beta.48",
|
31
|
+
"@operato/grist-editor": "^1.0.0-beta.48",
|
32
|
+
"@operato/i18n": "^1.0.0-beta.48",
|
33
|
+
"@operato/layout": "^1.0.0-beta.48",
|
34
|
+
"@operato/shell": "^1.0.0-beta.48",
|
35
|
+
"@operato/styles": "^1.0.0-beta.48",
|
36
|
+
"@operato/utils": "^1.0.0-beta.48",
|
37
|
+
"@things-factory/auth-base": "^5.0.0-zeta.21",
|
38
|
+
"@things-factory/aws-base": "^5.0.0-zeta.21",
|
39
|
+
"@things-factory/board-service": "^5.0.0-zeta.21",
|
40
|
+
"@things-factory/env": "^5.0.0-zeta.21",
|
41
|
+
"@things-factory/shell": "^5.0.0-zeta.21",
|
42
|
+
"@things-factory/work-shift": "^5.0.0-zeta.21",
|
43
43
|
"cron-parser": "^4.3.0",
|
44
44
|
"moment-timezone": "^0.5.34"
|
45
45
|
},
|
46
|
-
"gitHead": "
|
46
|
+
"gitHead": "a63dd238090dc87e77ea07dac34e818d31a277f2"
|
47
47
|
}
|
@@ -6,47 +6,53 @@ import { AthenaController } from '@things-factory/aws-base'
|
|
6
6
|
import { config } from '@things-factory/env'
|
7
7
|
|
8
8
|
const dataReportConfig = config.get('dataReport')
|
9
|
-
const {
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
const {
|
10
|
+
jasper: {
|
11
|
+
endpoint: { protocol: PROTOCOL, host: HOST, port: PORT },
|
12
|
+
datasource: { database: DATABASE }
|
13
|
+
}
|
14
|
+
} = dataReportConfig || {
|
15
|
+
jasper: {
|
16
|
+
endpoint: {},
|
17
|
+
datasource: {}
|
18
|
+
}
|
19
|
+
}
|
13
20
|
|
14
|
-
/** author: ywnam123 */
|
15
21
|
function transformValuesToRows(queryResult) {
|
16
22
|
var parseData = []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
}
|
23
|
+
let index = 1
|
24
|
+
for (let i = 0; i < queryResult.Items.length; i++) {
|
25
|
+
var j = 0
|
26
|
+
const data = JSON.parse(queryResult.Items[i].data)
|
27
|
+
const spec = JSON.parse(queryResult.Items[i].spec)
|
28
|
+
|
29
|
+
for (let key in data) {
|
30
|
+
if (Array.isArray(data[key])) {
|
31
|
+
for (j = 0; j < data[key].length; j++) {
|
32
|
+
for (let specKey in spec) {
|
33
|
+
if (key === specKey) {
|
34
|
+
parseData.push({
|
35
|
+
item: spec[specKey].name,
|
36
|
+
index: index + j,
|
37
|
+
value: String(data[key][j])
|
38
|
+
})
|
34
39
|
}
|
35
40
|
}
|
36
|
-
} else {
|
37
|
-
parseData.push({
|
38
|
-
item: key,
|
39
|
-
index,
|
40
|
-
value: String(data[key])
|
41
|
-
})
|
42
41
|
}
|
43
|
-
}
|
44
|
-
if (j !== 0) {
|
45
|
-
index = index + j
|
46
42
|
} else {
|
47
|
-
|
43
|
+
parseData.push({
|
44
|
+
item: key,
|
45
|
+
index,
|
46
|
+
value: String(data[key])
|
47
|
+
})
|
48
48
|
}
|
49
49
|
}
|
50
|
+
if (j !== 0) {
|
51
|
+
index = index + j
|
52
|
+
} else {
|
53
|
+
index = index + 1
|
54
|
+
}
|
55
|
+
}
|
50
56
|
}
|
51
57
|
|
52
58
|
/** @todo considering trasformation in lambda, as massive dataset */
|
@@ -61,11 +67,12 @@ function pivotData(rows) {
|
|
61
67
|
for (let key in data) {
|
62
68
|
/** @todo rule to display or not, about unspecified spec */
|
63
69
|
const value = data[key]
|
64
|
-
!
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
70
|
+
!spec[key]?.hidden &&
|
71
|
+
parsedData.push({
|
72
|
+
item: spec[key]?.name || key,
|
73
|
+
index,
|
74
|
+
value: Array.isArray(value) ? value.join(', ') : value
|
75
|
+
})
|
69
76
|
}
|
70
77
|
if (j !== 0) {
|
71
78
|
index = index + j
|
@@ -95,6 +102,7 @@ function parseJsonDataField(rows) {
|
|
95
102
|
}
|
96
103
|
|
97
104
|
const athenaClient = new AthenaController()
|
105
|
+
|
98
106
|
async function queryAthena(params) {
|
99
107
|
const { table, domain, dataSetId, fromWorkDate, toWorkDate, workShift, timezone } = params
|
100
108
|
const queryData = {
|
@@ -108,7 +116,7 @@ async function queryAthena(params) {
|
|
108
116
|
AND datasetid = '${dataSetId}'
|
109
117
|
AND workdate >= '${fromWorkDate}'
|
110
118
|
AND workdate <= '${toWorkDate}'
|
111
|
-
${workShift ?
|
119
|
+
${workShift ? "AND workshift = '" + workShift + "'" : ''}
|
112
120
|
ORDER BY collected_at`,
|
113
121
|
db: DATABASE
|
114
122
|
}
|
@@ -116,19 +124,23 @@ async function queryAthena(params) {
|
|
116
124
|
|
117
125
|
return await athenaClient.query(queryData)
|
118
126
|
}
|
119
|
-
|
120
|
-
|
127
|
+
|
128
|
+
export async function renderJasperReport(context: any) {
|
129
|
+
const {
|
130
|
+
state: { domain },
|
131
|
+
query
|
132
|
+
} = context
|
121
133
|
|
122
134
|
const template = await STORAGE.readFile(query['template'] || 'dynamic_header_sample.jrxml', 'utf-8')
|
123
135
|
let templateType = query['templateType'] || 'crosstab'
|
124
136
|
let parsedData = []
|
125
137
|
|
126
138
|
// @todo: get dataset timezone
|
127
|
-
/**
|
139
|
+
/**
|
128
140
|
* const variables = await gql(dataSet(id:${dataSetId}) {
|
129
141
|
* name, description, partition_keys, timezone
|
130
142
|
* })
|
131
|
-
|
143
|
+
*/
|
132
144
|
|
133
145
|
query['domain'] = domain?.subdomain
|
134
146
|
query['timezone'] = domain?.timezone
|
@@ -137,8 +149,7 @@ export async function renderJasperReport(context: any) {
|
|
137
149
|
|
138
150
|
if (!rows.length) {
|
139
151
|
return '<h3>Not found result.</h3>'
|
140
|
-
}
|
141
|
-
else {
|
152
|
+
} else {
|
142
153
|
const firstRow = rows[0]
|
143
154
|
// uses the first row values as data-set has no history data.
|
144
155
|
const parameters = {
|
@@ -146,18 +157,18 @@ export async function renderJasperReport(context: any) {
|
|
146
157
|
description: firstRow.description,
|
147
158
|
...query
|
148
159
|
}
|
149
|
-
|
160
|
+
|
150
161
|
if (templateType === 'crosstab') {
|
151
162
|
parsedData = pivotData(rows)
|
152
163
|
} else {
|
153
164
|
parsedData = parseJsonDataField(rows)
|
154
165
|
}
|
155
|
-
|
166
|
+
|
156
167
|
const formData = new FormData()
|
157
168
|
formData.append('template', template)
|
158
169
|
formData.append('jsonString', JSON.stringify(parsedData))
|
159
170
|
formData.append('parameters', JSON.stringify(parameters))
|
160
|
-
|
171
|
+
|
161
172
|
const reportUrl = `${PROTOCOL || 'http'}://${HOST}:${PORT}/rest/report/show_html`
|
162
173
|
const response = await fetch(reportUrl, {
|
163
174
|
method: 'POST',
|
@@ -166,5 +177,4 @@ export async function renderJasperReport(context: any) {
|
|
166
177
|
|
167
178
|
return await response.text()
|
168
179
|
}
|
169
|
-
|
170
180
|
}
|
@@ -43,7 +43,7 @@ export class DataOocQuery {
|
|
43
43
|
async dataItems(@Root() dataOoc: DataOoc): Promise<DataItem[]> {
|
44
44
|
const dataSetHistory: DataSetHistory = await getRepository(DataSetHistory).findOne({
|
45
45
|
where: {
|
46
|
-
|
46
|
+
originalId: dataOoc.dataSetId,
|
47
47
|
version: dataOoc.dataSetVersion
|
48
48
|
}
|
49
49
|
})
|
@@ -43,7 +43,7 @@ export class DataSampleQuery {
|
|
43
43
|
async dataItems(@Root() dataSample: DataSample): Promise<DataItem[]> {
|
44
44
|
const dataSetHistory: DataSetHistory = await getRepository(DataSetHistory).findOne({
|
45
45
|
where: {
|
46
|
-
|
46
|
+
originalId: dataSample.dataSetId,
|
47
47
|
version: dataSample.dataSetVersion
|
48
48
|
}
|
49
49
|
})
|