@things-factory/dataset 5.0.0-alpha.1 → 5.0.0-alpha.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/client/bootstrap.js +0 -2
- package/client/pages/data-item-list.js +9 -0
- package/client/pages/data-sample.js +30 -5
- package/client/pages/data-sensor.js +451 -0
- package/client/pages/data-set.js +12 -3
- package/client/route.js +4 -0
- package/dist-server/routes.js +64 -0
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/data-item/data-item-type.js +4 -4
- package/dist-server/service/data-item/data-item-type.js.map +1 -1
- package/dist-server/service/data-item/data-item.js +7 -0
- package/dist-server/service/data-item/data-item.js.map +1 -1
- package/dist-server/service/data-sample/data-sample-mutation.js +5 -5
- package/dist-server/service/data-sample/data-sample-mutation.js.map +1 -1
- package/dist-server/service/data-sample/data-sample-type.js +20 -0
- package/dist-server/service/data-sample/data-sample-type.js.map +1 -1
- package/dist-server/service/data-sample/data-sample.js +39 -0
- package/dist-server/service/data-sample/data-sample.js.map +1 -1
- package/dist-server/service/data-sensor/data-sensor-mutation.js +120 -0
- package/dist-server/service/data-sensor/data-sensor-mutation.js.map +1 -0
- package/dist-server/service/data-sensor/data-sensor-query.js +108 -0
- package/dist-server/service/data-sensor/data-sensor-query.js.map +1 -0
- package/dist-server/service/data-sensor/data-sensor-type.js +147 -0
- package/dist-server/service/data-sensor/data-sensor-type.js.map +1 -0
- package/dist-server/service/data-sensor/data-sensor.js +168 -0
- package/dist-server/service/data-sensor/data-sensor.js.map +1 -0
- package/dist-server/service/data-sensor/index.js +9 -0
- package/dist-server/service/data-sensor/index.js.map +1 -0
- package/dist-server/service/data-set/data-set-type.js +17 -0
- package/dist-server/service/data-set/data-set-type.js.map +1 -1
- package/dist-server/service/data-set/data-set.js +19 -0
- package/dist-server/service/data-set/data-set.js.map +1 -1
- package/dist-server/service/index.js +4 -0
- package/dist-server/service/index.js.map +1 -1
- package/package.json +12 -11
- package/server/routes.ts +76 -0
- package/server/service/data-item/data-item-type.ts +3 -3
- package/server/service/data-item/data-item.ts +6 -0
- package/server/service/data-sample/data-sample-mutation.ts +6 -3
- package/server/service/data-sample/data-sample-type.ts +15 -0
- package/server/service/data-sample/data-sample.ts +35 -0
- package/server/service/data-sensor/data-sensor-mutation.ts +110 -0
- package/server/service/data-sensor/data-sensor-query.ts +56 -0
- package/server/service/data-sensor/data-sensor-type.ts +98 -0
- package/server/service/data-sensor/data-sensor.ts +139 -0
- package/server/service/data-sensor/index.ts +6 -0
- package/server/service/data-set/data-set-type.ts +14 -0
- package/server/service/data-set/data-set.ts +17 -1
- package/server/service/index.ts +4 -0
- package/things-factory.config.js +4 -0
- package/translations/en.json +16 -5
- package/translations/ko.json +15 -4
- package/translations/ms.json +16 -5
- package/translations/zh.json +16 -5
@@ -0,0 +1,168 @@
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
var _a, _b, _c, _d;
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
13
|
+
exports.DataSensor = void 0;
|
14
|
+
const type_graphql_1 = require("type-graphql");
|
15
|
+
const typeorm_1 = require("typeorm");
|
16
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
17
|
+
const shell_1 = require("@things-factory/shell");
|
18
|
+
const data_set_1 = require("../data-set/data-set");
|
19
|
+
let DataSensor = class DataSensor {
|
20
|
+
};
|
21
|
+
__decorate([
|
22
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
23
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
24
|
+
__metadata("design:type", String)
|
25
|
+
], DataSensor.prototype, "id", void 0);
|
26
|
+
__decorate([
|
27
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
28
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
29
|
+
__metadata("design:type", typeof (_a = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _a : Object)
|
30
|
+
], DataSensor.prototype, "domain", void 0);
|
31
|
+
__decorate([
|
32
|
+
(0, typeorm_1.RelationId)((dataSensor) => dataSensor.domain),
|
33
|
+
__metadata("design:type", String)
|
34
|
+
], DataSensor.prototype, "domainId", void 0);
|
35
|
+
__decorate([
|
36
|
+
(0, typeorm_1.Column)(),
|
37
|
+
(0, type_graphql_1.Field)(),
|
38
|
+
__metadata("design:type", String)
|
39
|
+
], DataSensor.prototype, "name", void 0);
|
40
|
+
__decorate([
|
41
|
+
(0, typeorm_1.Column)({
|
42
|
+
nullable: true
|
43
|
+
}),
|
44
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
45
|
+
__metadata("design:type", String)
|
46
|
+
], DataSensor.prototype, "description", void 0);
|
47
|
+
__decorate([
|
48
|
+
(0, typeorm_1.Column)({
|
49
|
+
nullable: true
|
50
|
+
}),
|
51
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
52
|
+
__metadata("design:type", Boolean)
|
53
|
+
], DataSensor.prototype, "active", void 0);
|
54
|
+
__decorate([
|
55
|
+
(0, typeorm_1.Column)({
|
56
|
+
nullable: true
|
57
|
+
}),
|
58
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
59
|
+
__metadata("design:type", String)
|
60
|
+
], DataSensor.prototype, "deviceId", void 0);
|
61
|
+
__decorate([
|
62
|
+
(0, typeorm_1.Column)({
|
63
|
+
nullable: true
|
64
|
+
}),
|
65
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
66
|
+
__metadata("design:type", String)
|
67
|
+
], DataSensor.prototype, "serialNo", void 0);
|
68
|
+
__decorate([
|
69
|
+
(0, typeorm_1.Column)({
|
70
|
+
nullable: true
|
71
|
+
}),
|
72
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
73
|
+
__metadata("design:type", String)
|
74
|
+
], DataSensor.prototype, "brand", void 0);
|
75
|
+
__decorate([
|
76
|
+
(0, typeorm_1.Column)({
|
77
|
+
nullable: true
|
78
|
+
}),
|
79
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
80
|
+
__metadata("design:type", String)
|
81
|
+
], DataSensor.prototype, "model", void 0);
|
82
|
+
__decorate([
|
83
|
+
(0, typeorm_1.Column)({
|
84
|
+
nullable: true
|
85
|
+
}),
|
86
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
87
|
+
__metadata("design:type", String)
|
88
|
+
], DataSensor.prototype, "netmask", void 0);
|
89
|
+
__decorate([
|
90
|
+
(0, typeorm_1.Column)({
|
91
|
+
nullable: true
|
92
|
+
}),
|
93
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
94
|
+
__metadata("design:type", String)
|
95
|
+
], DataSensor.prototype, "tag", void 0);
|
96
|
+
__decorate([
|
97
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
98
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
99
|
+
__metadata("design:type", String)
|
100
|
+
], DataSensor.prototype, "refBy", void 0);
|
101
|
+
__decorate([
|
102
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.Appliance, {
|
103
|
+
nullable: true
|
104
|
+
}),
|
105
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
106
|
+
__metadata("design:type", typeof (_b = typeof auth_base_1.Appliance !== "undefined" && auth_base_1.Appliance) === "function" ? _b : Object)
|
107
|
+
], DataSensor.prototype, "appliance", void 0);
|
108
|
+
__decorate([
|
109
|
+
(0, typeorm_1.RelationId)((dataSensor) => dataSensor.appliance),
|
110
|
+
__metadata("design:type", String)
|
111
|
+
], DataSensor.prototype, "applianceId", void 0);
|
112
|
+
__decorate([
|
113
|
+
(0, typeorm_1.ManyToOne)(type => data_set_1.DataSet, {
|
114
|
+
nullable: true
|
115
|
+
}),
|
116
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
117
|
+
__metadata("design:type", data_set_1.DataSet)
|
118
|
+
], DataSensor.prototype, "dataSet", void 0);
|
119
|
+
__decorate([
|
120
|
+
(0, typeorm_1.RelationId)((dataSensor) => dataSensor.dataSet),
|
121
|
+
__metadata("design:type", String)
|
122
|
+
], DataSensor.prototype, "dataSetId", void 0);
|
123
|
+
__decorate([
|
124
|
+
(0, typeorm_1.CreateDateColumn)(),
|
125
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
126
|
+
__metadata("design:type", Date)
|
127
|
+
], DataSensor.prototype, "createdAt", void 0);
|
128
|
+
__decorate([
|
129
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
130
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
131
|
+
__metadata("design:type", Date)
|
132
|
+
], DataSensor.prototype, "updatedAt", void 0);
|
133
|
+
__decorate([
|
134
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
135
|
+
nullable: true
|
136
|
+
}),
|
137
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
138
|
+
__metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
|
139
|
+
], DataSensor.prototype, "creator", void 0);
|
140
|
+
__decorate([
|
141
|
+
(0, typeorm_1.RelationId)((dataSensor) => dataSensor.creator),
|
142
|
+
__metadata("design:type", String)
|
143
|
+
], DataSensor.prototype, "creatorId", void 0);
|
144
|
+
__decorate([
|
145
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
146
|
+
nullable: true
|
147
|
+
}),
|
148
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
149
|
+
__metadata("design:type", typeof (_d = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _d : Object)
|
150
|
+
], DataSensor.prototype, "updater", void 0);
|
151
|
+
__decorate([
|
152
|
+
(0, typeorm_1.RelationId)((dataSensor) => dataSensor.creator),
|
153
|
+
__metadata("design:type", String)
|
154
|
+
], DataSensor.prototype, "updaterId", void 0);
|
155
|
+
DataSensor = __decorate([
|
156
|
+
(0, typeorm_1.Entity)(),
|
157
|
+
(0, typeorm_1.Index)('ix_data_sensor_0', (dataSensor) => [dataSensor.domain, dataSensor.name], { unique: true }),
|
158
|
+
(0, typeorm_1.Index)('ix_data_sensor_1', (dataSensor) => [dataSensor.deviceId], { unique: true }),
|
159
|
+
(0, typeorm_1.Index)('ix_data_sensor_2', (dataSensor) => [dataSensor.domain, dataSensor.refBy], {
|
160
|
+
unique: false
|
161
|
+
}),
|
162
|
+
(0, typeorm_1.Index)('ix_data_sensor_3', (dataSensor) => [dataSensor.domain, dataSensor.serialNo], {
|
163
|
+
unique: false
|
164
|
+
}),
|
165
|
+
(0, type_graphql_1.ObjectType)({ description: 'Entity for DataSensor' })
|
166
|
+
], DataSensor);
|
167
|
+
exports.DataSensor = DataSensor;
|
168
|
+
//# sourceMappingURL=data-sensor.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"data-sensor.js","sourceRoot":"","sources":["../../../server/service/data-sensor/data-sensor.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAAoD;AACpD,qCASgB;AAEhB,yDAA2D;AAC3D,iDAA8C;AAE9C,mDAA8C;AAY9C,IAAa,UAAU,GAAvB,MAAa,UAAU;CA+GtB,CAAA;AA5GC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;sCACC;AAIn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AAuB,EAAE,CAAC;GACxC,UAAU,CA+GtB;AA/GY,gCAAU"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.resolvers = exports.entities = void 0;
|
4
|
+
const data_sensor_1 = require("./data-sensor");
|
5
|
+
const data_sensor_query_1 = require("./data-sensor-query");
|
6
|
+
const data_sensor_mutation_1 = require("./data-sensor-mutation");
|
7
|
+
exports.entities = [data_sensor_1.DataSensor];
|
8
|
+
exports.resolvers = [data_sensor_query_1.DataSensorQuery, data_sensor_mutation_1.DataSensorMutation];
|
9
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/data-sensor/index.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,2DAAqD;AACrD,iEAA2D;AAE9C,QAAA,QAAQ,GAAG,CAAC,wBAAU,CAAC,CAAA;AACvB,QAAA,SAAS,GAAG,CAAC,mCAAe,EAAE,yCAAkB,CAAC,CAAA"}
|
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.DataSetList = exports.DataSetPatch = exports.NewDataSet = void 0;
|
13
13
|
const type_graphql_1 = require("type-graphql");
|
14
|
+
const shell_1 = require("@things-factory/shell");
|
14
15
|
const data_set_1 = require("./data-set");
|
15
16
|
let NewDataSet = class NewDataSet {
|
16
17
|
};
|
@@ -26,6 +27,14 @@ __decorate([
|
|
26
27
|
(0, type_graphql_1.Field)({ nullable: true }),
|
27
28
|
__metadata("design:type", Boolean)
|
28
29
|
], NewDataSet.prototype, "active", void 0);
|
30
|
+
__decorate([
|
31
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
32
|
+
__metadata("design:type", String)
|
33
|
+
], NewDataSet.prototype, "type", void 0);
|
34
|
+
__decorate([
|
35
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
|
36
|
+
__metadata("design:type", Object)
|
37
|
+
], NewDataSet.prototype, "partitionKeys", void 0);
|
29
38
|
__decorate([
|
30
39
|
(0, type_graphql_1.Field)({ nullable: true }),
|
31
40
|
__metadata("design:type", String)
|
@@ -56,6 +65,14 @@ __decorate([
|
|
56
65
|
(0, type_graphql_1.Field)({ nullable: true }),
|
57
66
|
__metadata("design:type", Boolean)
|
58
67
|
], DataSetPatch.prototype, "active", void 0);
|
68
|
+
__decorate([
|
69
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
70
|
+
__metadata("design:type", String)
|
71
|
+
], DataSetPatch.prototype, "type", void 0);
|
72
|
+
__decorate([
|
73
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
|
74
|
+
__metadata("design:type", Object)
|
75
|
+
], DataSetPatch.prototype, "partitionKeys", void 0);
|
59
76
|
__decorate([
|
60
77
|
(0, type_graphql_1.Field)({ nullable: true }),
|
61
78
|
__metadata("design:type", String)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"data-set-type.js","sourceRoot":"","sources":["../../../server/service/data-set/data-set-type.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAoE;AAEpE,yCAAoC;AAGpC,IAAa,UAAU,GAAvB,MAAa,UAAU;
|
1
|
+
{"version":3,"file":"data-set-type.js","sourceRoot":"","sources":["../../../server/service/data-set/data-set-type.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAoE;AAEpE,iDAAoD;AAEpD,yCAAoC;AAGpC,IAAa,UAAU,GAAvB,MAAa,UAAU;CAqBtB,CAAA;AAnBC;IADC,IAAA,oBAAK,GAAE;;wCACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACV;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AY,CA2BxB;AA3BY,oCAAY;AA8BzB,IAAa,WAAW,GAAxB,MAAa,WAAW;CAMvB,CAAA;AAJC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,kBAAO,CAAC,CAAC;;0CACT;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;0CACN;AALF,WAAW;IADvB,IAAA,yBAAU,GAAE;GACA,WAAW,CAMvB;AANY,kCAAW"}
|
@@ -52,6 +52,25 @@ __decorate([
|
|
52
52
|
(0, type_graphql_1.Field)({ nullable: true }),
|
53
53
|
__metadata("design:type", Boolean)
|
54
54
|
], DataSet.prototype, "active", void 0);
|
55
|
+
__decorate([
|
56
|
+
(0, typeorm_1.Column)({
|
57
|
+
nullable: true
|
58
|
+
}),
|
59
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
60
|
+
__metadata("design:type", String)
|
61
|
+
], DataSet.prototype, "type", void 0);
|
62
|
+
__decorate([
|
63
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
64
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
|
65
|
+
__metadata("design:type", Object)
|
66
|
+
], DataSet.prototype, "partitionKeys", void 0);
|
67
|
+
__decorate([
|
68
|
+
(0, typeorm_1.Column)({
|
69
|
+
nullable: true
|
70
|
+
}),
|
71
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
72
|
+
__metadata("design:type", String)
|
73
|
+
], DataSet.prototype, "slugger", void 0);
|
55
74
|
__decorate([
|
56
75
|
(0, typeorm_1.OneToMany)(type => data_item_1.DataItem, dataItem => dataItem.dataSet),
|
57
76
|
(0, type_graphql_1.Field)(type => [data_item_1.DataItem], { nullable: true }),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"data-set.js","sourceRoot":"","sources":["../../../server/service/data-set/data-set.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAAoD;AACpD,qCA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,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDAChB,gBAAI,oBAAJ,gBAAI;wCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;0CAChC;AAMlB;IAJC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDAChB,gBAAI,oBAAJ,gBAAI;wCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;0CAChC;AAxFP,OAAO;IAHnB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,eAAe,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC9F,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;GACrC,OAAO,CAyFnB;AAzFY,0BAAO"}
|
@@ -16,15 +16,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
exports.schema = exports.entities = void 0;
|
18
18
|
/* IMPORT ENTITIES AND RESOLVERS */
|
19
|
+
const data_sensor_1 = require("./data-sensor");
|
19
20
|
const data_sample_1 = require("./data-sample");
|
20
21
|
const data_item_1 = require("./data-item");
|
21
22
|
const data_set_1 = require("./data-set");
|
22
23
|
/* EXPORT ENTITY TYPES */
|
24
|
+
__exportStar(require("./data-sensor/data-sensor"), exports);
|
23
25
|
__exportStar(require("./data-sample/data-sample"), exports);
|
24
26
|
__exportStar(require("./data-item/data-item"), exports);
|
25
27
|
__exportStar(require("./data-set/data-set"), exports);
|
26
28
|
exports.entities = [
|
27
29
|
/* ENTITIES */
|
30
|
+
...data_sensor_1.entities,
|
28
31
|
...data_sample_1.entities,
|
29
32
|
...data_item_1.entities,
|
30
33
|
...data_set_1.entities
|
@@ -32,6 +35,7 @@ exports.entities = [
|
|
32
35
|
exports.schema = {
|
33
36
|
resolverClasses: [
|
34
37
|
/* RESOLVER CLASSES */
|
38
|
+
...data_sensor_1.resolvers,
|
35
39
|
...data_sample_1.resolvers,
|
36
40
|
...data_item_1.resolvers,
|
37
41
|
...data_set_1.resolvers
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mCAAmC;AACnC,+CAAgG;AAChG,2CAA0F;AAC1F,yCAAuF;AAEvF,yBAAyB;AACzB,4DAAyC;AACzC,wDAAqC;AACrC,sDAAmC;AAEtB,QAAA,QAAQ,GAAG;IACtB,cAAc;IACf,GAAG,sBAAkB;IACpB,GAAG,oBAAgB;IACnB,GAAG,mBAAe;CACnB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACxB,GAAG,uBAAmB;QACpB,GAAG,qBAAiB;QACpB,GAAG,oBAAgB;KACpB;CACF,CAAA"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mCAAmC;AACnC,+CAAgG;AAChG,+CAAgG;AAChG,2CAA0F;AAC1F,yCAAuF;AAEvF,yBAAyB;AACzB,4DAAyC;AACzC,4DAAyC;AACzC,wDAAqC;AACrC,sDAAmC;AAEtB,QAAA,QAAQ,GAAG;IACtB,cAAc;IACf,GAAG,sBAAkB;IACrB,GAAG,sBAAkB;IACpB,GAAG,oBAAgB;IACnB,GAAG,mBAAe;CACnB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACxB,GAAG,uBAAmB;QACtB,GAAG,uBAAmB;QACpB,GAAG,qBAAiB;QACpB,GAAG,oBAAgB;KACpB;CACF,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/dataset",
|
3
|
-
"version": "5.0.0-alpha.
|
3
|
+
"version": "5.0.0-alpha.2",
|
4
4
|
"main": "dist-server/index.js",
|
5
5
|
"browser": "client/index.js",
|
6
6
|
"things-factory": true,
|
@@ -24,15 +24,16 @@
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
25
25
|
},
|
26
26
|
"dependencies": {
|
27
|
-
"@operato/data-grist": "^0.4.
|
28
|
-
"@operato/graphql": "^0.4.
|
29
|
-
"@operato/i18n": "^0.4.
|
30
|
-
"@operato/layout": "^0.4.
|
31
|
-
"@operato/shell": "^0.4.
|
32
|
-
"@operato/styles": "^0.4.
|
33
|
-
"@operato/utils": "^0.4.
|
34
|
-
"@things-factory/auth-base": "^5.0.0-alpha.
|
35
|
-
"@things-factory/
|
27
|
+
"@operato/data-grist": "^0.4.3",
|
28
|
+
"@operato/graphql": "^0.4.3",
|
29
|
+
"@operato/i18n": "^0.4.3",
|
30
|
+
"@operato/layout": "^0.4.3",
|
31
|
+
"@operato/shell": "^0.4.3",
|
32
|
+
"@operato/styles": "^0.4.3",
|
33
|
+
"@operato/utils": "^0.4.3",
|
34
|
+
"@things-factory/auth-base": "^5.0.0-alpha.2",
|
35
|
+
"@things-factory/env": "^5.0.0-alpha.2",
|
36
|
+
"@things-factory/shell": "^5.0.0-alpha.2"
|
36
37
|
},
|
37
|
-
"gitHead": "
|
38
|
+
"gitHead": "055536f981d229d51ae63f46585036b35fa86602"
|
38
39
|
}
|
package/server/routes.ts
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
import { getConnection } from 'typeorm'
|
2
|
+
|
3
|
+
import { DataSample } from './service'
|
4
|
+
import { DataItem } from './service/data-item/data-item'
|
5
|
+
import { DataSensor } from './service/data-sensor/data-sensor'
|
6
|
+
|
1
7
|
const debug = require('debug')('things-factory:dataset:routes')
|
2
8
|
|
3
9
|
process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {
|
@@ -7,6 +13,76 @@ process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRout
|
|
7
13
|
* ex) routes.get('/path', async(context, next) => {})
|
8
14
|
* ex) routes.post('/path', async(context, next) => {})
|
9
15
|
*/
|
16
|
+
|
17
|
+
globalPublicRouter.post('/sensor-data', async (context, next) => {
|
18
|
+
// 데이타 검증
|
19
|
+
const { deviceId, data, rawData, timestamp = Date.now() } = context.request.body
|
20
|
+
if (!deviceId || !data) {
|
21
|
+
throw new Error(`deviceId(${deviceId}) and data(${JSON.stringify(data)}) properties are mandatory`)
|
22
|
+
}
|
23
|
+
|
24
|
+
// make new data-sample
|
25
|
+
await getConnection().transaction(async tx => {
|
26
|
+
// find sensor through deviceId
|
27
|
+
const sensor = await tx.getRepository(DataSensor).findOne({
|
28
|
+
where: { deviceId },
|
29
|
+
relations: ['domain', 'appliance', 'dataSet']
|
30
|
+
})
|
31
|
+
|
32
|
+
if (!sensor) {
|
33
|
+
throw new Error(`Sensor having given deviceId(${deviceId}) not found`)
|
34
|
+
}
|
35
|
+
|
36
|
+
if (!sensor.active) {
|
37
|
+
throw new Error(`State of the sensor given deviceId(${deviceId}) is not active`)
|
38
|
+
}
|
39
|
+
|
40
|
+
if (!sensor.appliance) {
|
41
|
+
throw new Error(`Appliance of the sensor given deviceId(${deviceId}) is not set up`)
|
42
|
+
}
|
43
|
+
|
44
|
+
if (!sensor.dataSet) {
|
45
|
+
throw new Error(`DataSet of the sensor given deviceId(${deviceId}) is not set up`)
|
46
|
+
}
|
47
|
+
|
48
|
+
const domain = sensor.domain
|
49
|
+
const dataSet = sensor.dataSet
|
50
|
+
const user = sensor.appliance
|
51
|
+
|
52
|
+
const dataItems = await tx.getRepository(DataItem).find({
|
53
|
+
where: {
|
54
|
+
domain,
|
55
|
+
dataSet
|
56
|
+
},
|
57
|
+
order: {
|
58
|
+
sequence: 'DESC'
|
59
|
+
}
|
60
|
+
})
|
61
|
+
|
62
|
+
var spec = {} as any
|
63
|
+
|
64
|
+
dataItems.forEach(dataItem => {
|
65
|
+
spec[dataItem.name] = dataItem.spec
|
66
|
+
})
|
67
|
+
|
68
|
+
await tx.getRepository(DataSample).save({
|
69
|
+
domain,
|
70
|
+
name: dataSet.name,
|
71
|
+
description: dataSet.description,
|
72
|
+
partitionKeys: dataSet.partitionKeys,
|
73
|
+
dataSet,
|
74
|
+
data,
|
75
|
+
rawData,
|
76
|
+
spec,
|
77
|
+
source: deviceId,
|
78
|
+
collectedAt: new Date(timestamp),
|
79
|
+
creator: user,
|
80
|
+
updater: user
|
81
|
+
})
|
82
|
+
})
|
83
|
+
|
84
|
+
return 'OK'
|
85
|
+
})
|
10
86
|
})
|
11
87
|
|
12
88
|
process.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {
|
@@ -21,15 +21,15 @@ export class DataItemPatch {
|
|
21
21
|
@Field(type => Int, { nullable: true })
|
22
22
|
sequence?: number
|
23
23
|
|
24
|
+
@Field({ nullable: true })
|
25
|
+
tag?: string
|
26
|
+
|
24
27
|
@Field(type => DataItemType, { nullable: true })
|
25
28
|
type?: DataItemType
|
26
29
|
|
27
30
|
@Field(type => Int, { nullable: true })
|
28
31
|
quota?: number
|
29
32
|
|
30
|
-
@Field({ nullable: true })
|
31
|
-
options?: string
|
32
|
-
|
33
33
|
@Field({ nullable: true })
|
34
34
|
active?: boolean
|
35
35
|
|
@@ -16,9 +16,9 @@ export class DataSampleMutation {
|
|
16
16
|
|
17
17
|
const dataSet = await tx.getRepository(DataSet).findOne({ id: dataSample.dataSetId })
|
18
18
|
const dataItems = await tx.getRepository(DataItem).find({
|
19
|
-
|
19
|
+
where: {
|
20
20
|
domain,
|
21
|
-
|
21
|
+
dataSet
|
22
22
|
},
|
23
23
|
order: {
|
24
24
|
sequence: 'DESC'
|
@@ -27,15 +27,18 @@ export class DataSampleMutation {
|
|
27
27
|
|
28
28
|
var spec = {} as any
|
29
29
|
|
30
|
-
dataItems.
|
30
|
+
dataItems.forEach(dataItem => {
|
31
31
|
spec[dataItem.name] = dataItem.spec
|
32
|
+
// TODO 변수형 스펙값은 처리 결과값을 spec의 아이템 value로 반영하여야 한다.
|
32
33
|
})
|
33
34
|
|
34
35
|
return await tx.getRepository(DataSample).save({
|
35
36
|
name: dataSet.name,
|
36
37
|
description: dataSet.description,
|
38
|
+
collectedAt: new Date(),
|
37
39
|
...dataSample,
|
38
40
|
domain,
|
41
|
+
partitionKeys: dataSet.partitionKeys,
|
39
42
|
spec,
|
40
43
|
creator: user,
|
41
44
|
updater: user
|
@@ -17,6 +17,15 @@ export class NewDataSample {
|
|
17
17
|
|
18
18
|
@Field(type => ScalarObject, { nullable: true })
|
19
19
|
data?: object
|
20
|
+
|
21
|
+
@Field({ nullable: true })
|
22
|
+
rawData?: string
|
23
|
+
|
24
|
+
@Field({ nullable: true })
|
25
|
+
source?: string
|
26
|
+
|
27
|
+
@Field({ nullable: true })
|
28
|
+
collectedAt?: Date
|
20
29
|
}
|
21
30
|
|
22
31
|
@InputType()
|
@@ -36,6 +45,12 @@ export class DataSamplePatch {
|
|
36
45
|
@Field(type => ScalarObject, { nullable: true })
|
37
46
|
data?: object
|
38
47
|
|
48
|
+
@Field({ nullable: true })
|
49
|
+
rawData?: string
|
50
|
+
|
51
|
+
@Field({ nullable: true })
|
52
|
+
source?: string
|
53
|
+
|
39
54
|
@Field()
|
40
55
|
cuFlag: string
|
41
56
|
}
|
@@ -11,10 +11,13 @@ import {
|
|
11
11
|
} from 'typeorm'
|
12
12
|
|
13
13
|
import { User } from '@things-factory/auth-base'
|
14
|
+
import { config } from '@things-factory/env'
|
14
15
|
import { Domain, ScalarObject } from '@things-factory/shell'
|
15
16
|
|
16
17
|
import { DataSet } from '../data-set/data-set'
|
17
18
|
|
19
|
+
const ORMCONFIG = config.get('ormconfig', {})
|
20
|
+
const DATABASE_TYPE = ORMCONFIG.type
|
18
21
|
@Entity()
|
19
22
|
@Index('ix_data_sample_0', (dataSample: DataSample) => [dataSample.domain, dataSample.dataSet], { unique: false })
|
20
23
|
@ObjectType({ description: 'Entity for DataSample' })
|
@@ -40,6 +43,16 @@ export class DataSample {
|
|
40
43
|
@Field({ nullable: true })
|
41
44
|
description?: string
|
42
45
|
|
46
|
+
@Column({
|
47
|
+
nullable: true
|
48
|
+
})
|
49
|
+
@Field({ nullable: true })
|
50
|
+
type?: string
|
51
|
+
|
52
|
+
@Column('simple-json', { nullable: true })
|
53
|
+
@Field(type => ScalarObject, { nullable: true })
|
54
|
+
partitionKeys?: object
|
55
|
+
|
43
56
|
@ManyToOne(type => DataSet, dataSet => dataSet.dataSamples)
|
44
57
|
@Field(type => DataSet, { nullable: true })
|
45
58
|
dataSet?: DataSet
|
@@ -56,6 +69,28 @@ export class DataSample {
|
|
56
69
|
@Field(type => ScalarObject, { nullable: true })
|
57
70
|
spec?: object
|
58
71
|
|
72
|
+
@Column({
|
73
|
+
nullable: true,
|
74
|
+
type:
|
75
|
+
DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
76
|
+
? 'longtext'
|
77
|
+
: DATABASE_TYPE == 'oracle'
|
78
|
+
? 'clob'
|
79
|
+
: 'varchar'
|
80
|
+
})
|
81
|
+
@Field({ nullable: true })
|
82
|
+
rawData?: string
|
83
|
+
|
84
|
+
@Column({
|
85
|
+
nullable: true
|
86
|
+
})
|
87
|
+
@Field({ nullable: true })
|
88
|
+
source?: string
|
89
|
+
|
90
|
+
@Column({ nullable: true })
|
91
|
+
@Field({ nullable: true })
|
92
|
+
collectedAt?: Date
|
93
|
+
|
59
94
|
@CreateDateColumn()
|
60
95
|
@Field({ nullable: true })
|
61
96
|
createdAt?: Date
|