@things-factory/dataset 5.0.0-zeta.9 → 5.0.2
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/README.md +25 -0
- package/assets/data-samples.jpg +0 -0
- package/client/{pages/data-entry → components}/data-entry-form.js +1 -1
- package/client/index.js +1 -0
- package/client/pages/data-entry/data-entry-list-page.js +2 -2
- package/client/pages/data-ooc/data-ooc-list-page.js +12 -17
- package/client/pages/data-report/data-report-list-page.js +1 -1
- package/client/pages/data-sample/data-sample-list-page.js +11 -12
- package/client/pages/data-sensor/data-sensor-list-page.js +1 -1
- package/client/pages/data-set/data-set-list-page.js +3 -2
- package/config/config.development.js +1 -1
- package/config/config.production.js +13 -1
- package/dist-server/controllers/create-data-sample.js +4 -37
- package/dist-server/controllers/create-data-sample.js.map +1 -1
- package/dist-server/controllers/data-use-case.js +11 -5
- package/dist-server/controllers/data-use-case.js.map +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 +4 -17
- package/dist-server/service/data-ooc/data-ooc-query.js.map +1 -1
- package/dist-server/service/data-ooc/data-ooc.js +7 -15
- package/dist-server/service/data-ooc/data-ooc.js.map +1 -1
- package/dist-server/service/data-sample/data-sample-query.js +4 -4
- package/dist-server/service/data-sample/data-sample-query.js.map +1 -1
- package/dist-server/service/data-sample/data-sample.js +7 -3
- package/dist-server/service/data-sample/data-sample.js.map +1 -1
- package/dist-server/service/data-set/data-set-mutation.js +13 -30
- package/dist-server/service/data-set/data-set-mutation.js.map +1 -1
- package/dist-server/service/data-set/data-set-query.js +3 -2
- package/dist-server/service/data-set/data-set-query.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/data-set.js +1 -4
- package/dist-server/service/data-set/data-set.js.map +1 -1
- package/dist-server/service/data-set-history/data-set-history-query.js +4 -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 +46 -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/create-data-sample.ts +5 -37
- package/server/controllers/data-use-case.ts +17 -6
- package/server/controllers/jasper-report.ts +58 -48
- package/server/service/data-ooc/data-ooc-query.ts +3 -11
- package/server/service/data-ooc/data-ooc.ts +6 -16
- package/server/service/data-sample/data-sample-query.ts +3 -3
- package/server/service/data-sample/data-sample.ts +6 -4
- package/server/service/data-set/data-set-mutation.ts +8 -39
- package/server/service/data-set/data-set-query.ts +3 -2
- package/server/service/data-set/data-set-type.ts +2 -1
- package/server/service/data-set/data-set.ts +3 -5
- package/server/service/data-set-history/data-set-history-query.ts +4 -2
- package/server/service/data-set-history/data-set-history.ts +61 -60
- 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 +1 -1
- package/translations/ko.json +2 -2
- package/translations/ms.json +1 -1
- package/translations/zh.json +1 -1
@@ -13,20 +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 {
|
25
|
+
constructor() {
|
26
|
+
this.version = 1;
|
27
|
+
}
|
21
28
|
};
|
22
29
|
__decorate([
|
23
|
-
(0, typeorm_1.
|
30
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
24
31
|
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
25
32
|
__metadata("design:type", String)
|
26
33
|
], DataSetHistory.prototype, "id", void 0);
|
27
34
|
__decorate([
|
28
|
-
(0, typeorm_1.
|
29
|
-
(0, type_graphql_1.Field)(),
|
35
|
+
(0, typeorm_1.Column)({ default: 1 }),
|
36
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
30
37
|
__metadata("design:type", Number)
|
31
38
|
], DataSetHistory.prototype, "version", void 0);
|
32
39
|
__decorate([
|
@@ -44,23 +51,17 @@ __decorate([
|
|
44
51
|
__metadata("design:type", String)
|
45
52
|
], DataSetHistory.prototype, "name", void 0);
|
46
53
|
__decorate([
|
47
|
-
(0, typeorm_1.Column)({
|
48
|
-
nullable: true
|
49
|
-
}),
|
54
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
50
55
|
(0, type_graphql_1.Field)({ nullable: true }),
|
51
56
|
__metadata("design:type", String)
|
52
57
|
], DataSetHistory.prototype, "description", void 0);
|
53
58
|
__decorate([
|
54
|
-
(0, typeorm_1.Column)({
|
55
|
-
nullable: true
|
56
|
-
}),
|
59
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
57
60
|
(0, type_graphql_1.Field)({ nullable: true }),
|
58
61
|
__metadata("design:type", Boolean)
|
59
62
|
], DataSetHistory.prototype, "active", void 0);
|
60
63
|
__decorate([
|
61
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.Role, {
|
62
|
-
nullable: true
|
63
|
-
}),
|
64
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.Role, { nullable: true }),
|
64
65
|
(0, type_graphql_1.Field)(type => auth_base_1.Role, { nullable: true }),
|
65
66
|
__metadata("design:type", typeof (_b = typeof auth_base_1.Role !== "undefined" && auth_base_1.Role) === "function" ? _b : Object)
|
66
67
|
], DataSetHistory.prototype, "entryRole", void 0);
|
@@ -69,9 +70,7 @@ __decorate([
|
|
69
70
|
__metadata("design:type", String)
|
70
71
|
], DataSetHistory.prototype, "entryRoleId", void 0);
|
71
72
|
__decorate([
|
72
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.Role, {
|
73
|
-
nullable: true
|
74
|
-
}),
|
73
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.Role, { nullable: true }),
|
75
74
|
(0, type_graphql_1.Field)(type => auth_base_1.Role, { nullable: true }),
|
76
75
|
__metadata("design:type", typeof (_c = typeof auth_base_1.Role !== "undefined" && auth_base_1.Role) === "function" ? _c : Object)
|
77
76
|
], DataSetHistory.prototype, "supervisoryRole", void 0);
|
@@ -80,51 +79,37 @@ __decorate([
|
|
80
79
|
__metadata("design:type", String)
|
81
80
|
], DataSetHistory.prototype, "supervisoryRoleId", void 0);
|
82
81
|
__decorate([
|
83
|
-
(0, typeorm_1.Column)({
|
84
|
-
nullable: true
|
85
|
-
}),
|
82
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
86
83
|
(0, type_graphql_1.Field)({ nullable: true }),
|
87
84
|
__metadata("design:type", String)
|
88
85
|
], DataSetHistory.prototype, "type", void 0);
|
89
86
|
__decorate([
|
90
|
-
(0, typeorm_1.Column)({
|
91
|
-
nullable: true
|
92
|
-
}),
|
87
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
93
88
|
(0, type_graphql_1.Field)({ nullable: true }),
|
94
89
|
__metadata("design:type", String)
|
95
90
|
], DataSetHistory.prototype, "entryType", void 0);
|
96
91
|
__decorate([
|
97
|
-
(0, typeorm_1.Column)({
|
98
|
-
nullable: true
|
99
|
-
}),
|
92
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
100
93
|
(0, type_graphql_1.Field)({ nullable: true }),
|
101
94
|
__metadata("design:type", String)
|
102
95
|
], DataSetHistory.prototype, "entryView", void 0);
|
103
96
|
__decorate([
|
104
|
-
(0, typeorm_1.Column)({
|
105
|
-
nullable: true
|
106
|
-
}),
|
97
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
107
98
|
(0, type_graphql_1.Field)({ nullable: true }),
|
108
99
|
__metadata("design:type", String)
|
109
100
|
], DataSetHistory.prototype, "monitorType", void 0);
|
110
101
|
__decorate([
|
111
|
-
(0, typeorm_1.Column)({
|
112
|
-
nullable: true
|
113
|
-
}),
|
102
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
114
103
|
(0, type_graphql_1.Field)({ nullable: true }),
|
115
104
|
__metadata("design:type", String)
|
116
105
|
], DataSetHistory.prototype, "monitorView", void 0);
|
117
106
|
__decorate([
|
118
|
-
(0, typeorm_1.Column)({
|
119
|
-
nullable: true
|
120
|
-
}),
|
107
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
121
108
|
(0, type_graphql_1.Field)({ nullable: true }),
|
122
109
|
__metadata("design:type", String)
|
123
110
|
], DataSetHistory.prototype, "reportType", void 0);
|
124
111
|
__decorate([
|
125
|
-
(0, typeorm_1.Column)({
|
126
|
-
nullable: true
|
127
|
-
}),
|
112
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
128
113
|
(0, type_graphql_1.Field)({ nullable: true }),
|
129
114
|
__metadata("design:type", String)
|
130
115
|
], DataSetHistory.prototype, "reportView", void 0);
|
@@ -133,9 +118,7 @@ __decorate([
|
|
133
118
|
__metadata("design:type", String)
|
134
119
|
], DataSetHistory.prototype, "reportTemplate", void 0);
|
135
120
|
__decorate([
|
136
|
-
(0, typeorm_1.Column)({
|
137
|
-
nullable: true
|
138
|
-
}),
|
121
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
139
122
|
(0, type_graphql_1.Field)({ nullable: true }),
|
140
123
|
__metadata("design:type", String)
|
141
124
|
], DataSetHistory.prototype, "useCase", void 0);
|
@@ -150,35 +133,27 @@ __decorate([
|
|
150
133
|
__metadata("design:type", Array)
|
151
134
|
], DataSetHistory.prototype, "dataItems", void 0);
|
152
135
|
__decorate([
|
153
|
-
(0, typeorm_1.Column)({
|
154
|
-
nullable: true
|
155
|
-
}),
|
136
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
156
137
|
(0, type_graphql_1.Field)({ nullable: true }),
|
157
138
|
__metadata("design:type", String)
|
158
139
|
], DataSetHistory.prototype, "schedule", void 0);
|
159
140
|
__decorate([
|
160
|
-
(0, typeorm_1.Column)({
|
161
|
-
nullable: true
|
162
|
-
}),
|
141
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
163
142
|
(0, type_graphql_1.Field)({ nullable: true }),
|
164
143
|
__metadata("design:type", String)
|
165
144
|
], DataSetHistory.prototype, "timezone", void 0);
|
166
145
|
__decorate([
|
167
|
-
(0, typeorm_1.Column)({
|
168
|
-
nullable: true
|
169
|
-
}),
|
146
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
170
147
|
(0, type_graphql_1.Field)({ nullable: true }),
|
171
148
|
__metadata("design:type", Date)
|
172
149
|
], DataSetHistory.prototype, "createdAt", void 0);
|
173
150
|
__decorate([
|
174
|
-
(0, typeorm_1.
|
151
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
175
152
|
(0, type_graphql_1.Field)({ nullable: true }),
|
176
153
|
__metadata("design:type", Date)
|
177
154
|
], DataSetHistory.prototype, "updatedAt", void 0);
|
178
155
|
__decorate([
|
179
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
180
|
-
nullable: true
|
181
|
-
}),
|
156
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
182
157
|
(0, type_graphql_1.Field)({ nullable: true }),
|
183
158
|
__metadata("design:type", typeof (_e = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _e : Object)
|
184
159
|
], DataSetHistory.prototype, "creator", void 0);
|
@@ -187,9 +162,7 @@ __decorate([
|
|
187
162
|
__metadata("design:type", String)
|
188
163
|
], DataSetHistory.prototype, "creatorId", void 0);
|
189
164
|
__decorate([
|
190
|
-
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
191
|
-
nullable: true
|
192
|
-
}),
|
165
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
193
166
|
(0, type_graphql_1.Field)({ nullable: true }),
|
194
167
|
__metadata("design:type", typeof (_f = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _f : Object)
|
195
168
|
], DataSetHistory.prototype, "updater", void 0);
|
@@ -197,8 +170,26 @@ __decorate([
|
|
197
170
|
(0, typeorm_1.RelationId)((dataSetHistory) => dataSetHistory.creator),
|
198
171
|
__metadata("design:type", String)
|
199
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);
|
200
189
|
DataSetHistory = __decorate([
|
201
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 }),
|
202
193
|
(0, type_graphql_1.ObjectType)({ description: 'Entity for DataSetHistory' })
|
203
194
|
], DataSetHistory);
|
204
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,MAAa,cAAc;IAA3B;QAOW,YAAO,GAAW,CAAC,CAAA;IA0H9B,CAAC;CAAA,CAAA;AA9HC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;0CACC;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACE;AAI5B;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDACjB,cAAM,oBAAN,cAAM;8CAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,cA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CAAC;IAC3C,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDAChB,gBAAI,oBAAJ,gBAAI;+CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,cAA8B,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC;;iDACrD;AAGlB;IADC,IAAA,yCAAuB,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDAClB;AAY1B;IAVC,IAAA,qCAAmB,EAAC;QACnB,QAAQ,EAAE,KAAK;QACf,IAAI,EACF,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS;YACnF,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,aAAa,IAAI,QAAQ;gBAC3B,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,UAAU;QAChB,IAAI,EAAE,mCAAiB;KACxB,CAAC;;8CAC+B;AAhItB,cAAc;IAZ1B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,uBAAuB,EACvB,CAAC,cAA8B,EAAE,EAAE,CAAC,CAAC,cAAc,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.
|
3
|
+
"version": "5.0.2",
|
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.
|
28
|
-
"@operato/data-grist": "^1.0.
|
29
|
-
"@operato/dataset": "^1.0.0
|
30
|
-
"@operato/graphql": "^1.0.0
|
31
|
-
"@operato/grist-editor": "^1.0.0
|
32
|
-
"@operato/i18n": "^1.0.0
|
33
|
-
"@operato/layout": "^1.0.
|
34
|
-
"@operato/shell": "^1.0.
|
35
|
-
"@operato/styles": "^1.0.0
|
36
|
-
"@operato/utils": "^1.0.
|
37
|
-
"@things-factory/auth-base": "^5.0.
|
38
|
-
"@things-factory/aws-base": "^5.0.
|
39
|
-
"@things-factory/board-service": "^5.0.
|
40
|
-
"@things-factory/env": "^5.0.0
|
41
|
-
"@things-factory/shell": "^5.0.
|
42
|
-
"@things-factory/work-shift": "^5.0.
|
27
|
+
"@operato/app": "^1.0.1",
|
28
|
+
"@operato/data-grist": "^1.0.1",
|
29
|
+
"@operato/dataset": "^1.0.0",
|
30
|
+
"@operato/graphql": "^1.0.0",
|
31
|
+
"@operato/grist-editor": "^1.0.0",
|
32
|
+
"@operato/i18n": "^1.0.0",
|
33
|
+
"@operato/layout": "^1.0.1",
|
34
|
+
"@operato/shell": "^1.0.1",
|
35
|
+
"@operato/styles": "^1.0.0",
|
36
|
+
"@operato/utils": "^1.0.1",
|
37
|
+
"@things-factory/auth-base": "^5.0.1",
|
38
|
+
"@things-factory/aws-base": "^5.0.1",
|
39
|
+
"@things-factory/board-service": "^5.0.2",
|
40
|
+
"@things-factory/env": "^5.0.0",
|
41
|
+
"@things-factory/shell": "^5.0.1",
|
42
|
+
"@things-factory/work-shift": "^5.0.1",
|
43
43
|
"cron-parser": "^4.3.0",
|
44
44
|
"moment-timezone": "^0.5.34"
|
45
45
|
},
|
46
|
-
"gitHead": "
|
46
|
+
"gitHead": "009cda6cb65e0930988fb2b1c1a309b9a7973383"
|
47
47
|
}
|
@@ -55,20 +55,6 @@ export async function createDataSample(
|
|
55
55
|
})
|
56
56
|
|
57
57
|
const dataItems = dataSet.dataItems
|
58
|
-
|
59
|
-
// TODO spec should be removed
|
60
|
-
// const spec = dataItems.reduce((spec, dataItem) => {
|
61
|
-
// spec[dataItem.tag] = {
|
62
|
-
// spec: dataItem.spec,
|
63
|
-
// name: dataItem.name,
|
64
|
-
// description: dataItem.description,
|
65
|
-
// unit: dataItem.unit,
|
66
|
-
// hidden: dataItem.hidden
|
67
|
-
// }
|
68
|
-
|
69
|
-
// return spec
|
70
|
-
// }, {})
|
71
|
-
|
72
58
|
const collectedAt = dataSample.collectedAt || new Date()
|
73
59
|
|
74
60
|
const timezone = dataSet.timezone || domain.timezone || 'UTC'
|
@@ -79,7 +65,6 @@ export async function createDataSample(
|
|
79
65
|
|
80
66
|
// local time dataSet timezone or domain timezone or default 'UTC'
|
81
67
|
|
82
|
-
// const collectedAt = dataSample.collectedAt || new Date()
|
83
68
|
const localDateTz = moment(collectedAt).tz(timezone)
|
84
69
|
const defaultPartitionKeys = {
|
85
70
|
domain: domain.subdomain,
|
@@ -99,7 +84,7 @@ export async function createDataSample(
|
|
99
84
|
...dataSample.data
|
100
85
|
})
|
101
86
|
|
102
|
-
const { ooc, oos } = DataUseCase.evaluate(dataSet, dataItems, dataSample.data) || {}
|
87
|
+
const { ooc, oos, judgment } = DataUseCase.evaluate(dataSet, dataItems, dataSample.data) || {}
|
103
88
|
const result = await tx.getRepository(DataSample).save({
|
104
89
|
name: dataSet.name,
|
105
90
|
description: dataSet.description,
|
@@ -108,9 +93,9 @@ export async function createDataSample(
|
|
108
93
|
dataSetVersion: dataSet.version,
|
109
94
|
domain,
|
110
95
|
partitionKeys,
|
111
|
-
// spec, // TODO spec should be removed
|
112
96
|
ooc,
|
113
97
|
oos,
|
98
|
+
judgment,
|
114
99
|
collectedAt,
|
115
100
|
workDate,
|
116
101
|
workShift,
|
@@ -120,19 +105,7 @@ export async function createDataSample(
|
|
120
105
|
|
121
106
|
if (ooc || oos) {
|
122
107
|
const dataOoc = await tx.getRepository(DataOoc).save({
|
123
|
-
|
124
|
-
description: dataSet.description,
|
125
|
-
useCase: dataSet.useCase,
|
126
|
-
dataSet,
|
127
|
-
dataSetVersion: dataSet.version,
|
128
|
-
dataSample: result,
|
129
|
-
data: dataSample.data,
|
130
|
-
rawData: dataSample.rawData,
|
131
|
-
domain,
|
132
|
-
partitionKeys,
|
133
|
-
// spec, // TODO spec should be removed
|
134
|
-
ooc,
|
135
|
-
oos,
|
108
|
+
...result,
|
136
109
|
history: [
|
137
110
|
{
|
138
111
|
user: {
|
@@ -143,12 +116,7 @@ export async function createDataSample(
|
|
143
116
|
timestamp: Date.now()
|
144
117
|
}
|
145
118
|
],
|
146
|
-
state: DataOocStatus.CREATED
|
147
|
-
workDate,
|
148
|
-
workShift,
|
149
|
-
collectedAt,
|
150
|
-
creator: user,
|
151
|
-
updater: user
|
119
|
+
state: DataOocStatus.CREATED
|
152
120
|
})
|
153
121
|
|
154
122
|
pubsub.publish('data-ooc', {
|
@@ -169,4 +137,4 @@ export async function createDataSample(
|
|
169
137
|
}
|
170
138
|
|
171
139
|
return result
|
172
|
-
}
|
140
|
+
}
|
@@ -14,7 +14,11 @@ export type DataItemSpecSet = {
|
|
14
14
|
specs: DataItemSpec[]
|
15
15
|
}
|
16
16
|
|
17
|
-
export type EvaluationResult = {
|
17
|
+
export type EvaluationResult = {
|
18
|
+
oos: boolean
|
19
|
+
ooc: boolean
|
20
|
+
judgment?: { [tag: string]: { ooc: boolean; oos: boolean } }
|
21
|
+
}
|
18
22
|
|
19
23
|
export abstract class DataUseCase {
|
20
24
|
static registry: { [name: string]: DataUseCase } = {}
|
@@ -34,6 +38,7 @@ export abstract class DataUseCase {
|
|
34
38
|
public static evaluate(dataSet: DataSet, dataItems: DataItem[], data: any): EvaluationResult {
|
35
39
|
var ooc = false
|
36
40
|
var oos = false
|
41
|
+
var judgment: { [tag: string]: { ooc: boolean; oos: boolean } } = {}
|
37
42
|
|
38
43
|
if (!dataSet.useCase) {
|
39
44
|
return { ooc, oos }
|
@@ -50,7 +55,7 @@ export abstract class DataUseCase {
|
|
50
55
|
}
|
51
56
|
|
52
57
|
let values: any | any[] = data[tag]
|
53
|
-
if (
|
58
|
+
if (values == null) {
|
54
59
|
continue // TODO what if in case no value ?
|
55
60
|
}
|
56
61
|
|
@@ -58,6 +63,9 @@ export abstract class DataUseCase {
|
|
58
63
|
values = [values]
|
59
64
|
}
|
60
65
|
|
66
|
+
let oocForTag = false
|
67
|
+
let oosForTag = false
|
68
|
+
|
61
69
|
for (let j = 0; j < useCases.length; j++) {
|
62
70
|
const useCase = useCases[j]
|
63
71
|
|
@@ -69,17 +77,20 @@ export abstract class DataUseCase {
|
|
69
77
|
const result = useCase.evaluate(specs, values)
|
70
78
|
|
71
79
|
if (result) {
|
80
|
+
oocForTag ||= result.ooc
|
81
|
+
oosForTag ||= result.oos
|
72
82
|
ooc ||= result.ooc
|
73
83
|
oos ||= result.oos
|
74
84
|
}
|
85
|
+
}
|
75
86
|
|
76
|
-
|
77
|
-
|
78
|
-
|
87
|
+
judgment[tag] = {
|
88
|
+
ooc: oocForTag,
|
89
|
+
oos: oosForTag
|
79
90
|
}
|
80
91
|
}
|
81
92
|
|
82
|
-
return { ooc, oos }
|
93
|
+
return { ooc, oos, judgment }
|
83
94
|
}
|
84
95
|
|
85
96
|
public abstract evaluate(specs: any, values: any[]): EvaluationResult
|