@things-factory/dataset 5.0.0-alpha.13 → 5.0.0-alpha.14
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-form.js +3 -1
- package/client/pages/data-ooc.js +418 -0
- package/client/pages/data-sample.js +39 -37
- package/client/pages/data-sensor.js +1 -1
- package/client/pages/data-set.js +61 -0
- package/client/route.js +4 -0
- package/dist-server/controllers/data-use-case.js +57 -0
- package/dist-server/controllers/data-use-case.js.map +1 -0
- package/dist-server/controllers/index.js +17 -0
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/index.js +1 -0
- package/dist-server/index.js.map +1 -1
- package/dist-server/service/data-item/data-item-type.js +6 -6
- package/dist-server/service/data-item/data-item-type.js.map +1 -1
- package/dist-server/service/data-item/data-item.js +1 -1
- package/dist-server/service/data-item/data-item.js.map +1 -1
- package/dist-server/service/data-ooc/data-ooc-mutation.js +130 -0
- package/dist-server/service/data-ooc/data-ooc-mutation.js.map +1 -0
- package/dist-server/service/data-ooc/data-ooc-query.js +89 -0
- package/dist-server/service/data-ooc/data-ooc-query.js.map +1 -0
- package/dist-server/service/data-ooc/data-ooc-type.js +99 -0
- package/dist-server/service/data-ooc/data-ooc-type.js.map +1 -0
- package/dist-server/service/data-ooc/data-ooc.js +218 -0
- package/dist-server/service/data-ooc/data-ooc.js.map +1 -0
- package/dist-server/service/data-ooc/index.js +9 -0
- package/dist-server/service/data-ooc/index.js.map +1 -0
- package/dist-server/service/data-sample/data-sample-mutation.js +28 -88
- package/dist-server/service/data-sample/data-sample-mutation.js.map +1 -1
- package/dist-server/service/data-sample/data-sample-type.js +5 -43
- package/dist-server/service/data-sample/data-sample-type.js.map +1 -1
- package/dist-server/service/data-sample/data-sample.js +20 -6
- package/dist-server/service/data-sample/data-sample.js.map +1 -1
- package/dist-server/service/data-set/data-set-mutation.js +1 -2
- package/dist-server/service/data-set/data-set-mutation.js.map +1 -1
- package/dist-server/service/data-set/data-set-type.js +19 -3
- package/dist-server/service/data-set/data-set-type.js.map +1 -1
- package/dist-server/service/data-set/data-set.js +24 -12
- package/dist-server/service/data-set/data-set.js.map +1 -1
- package/dist-server/service/index.js +6 -2
- package/dist-server/service/index.js.map +1 -1
- package/package.json +14 -14
- package/server/controllers/data-use-case.ts +85 -0
- package/server/controllers/index.ts +1 -0
- package/server/index.ts +1 -0
- package/server/service/data-item/data-item-type.ts +3 -4
- package/server/service/data-item/data-item.ts +1 -1
- package/server/service/data-ooc/data-ooc-mutation.ts +117 -0
- package/server/service/data-ooc/data-ooc-query.ts +45 -0
- package/server/service/data-ooc/data-ooc-type.ts +62 -0
- package/server/service/data-ooc/data-ooc.ts +188 -0
- package/server/service/data-ooc/index.ts +6 -0
- package/server/service/data-sample/data-sample-mutation.ts +30 -95
- package/server/service/data-sample/data-sample-type.ts +3 -31
- package/server/service/data-sample/data-sample.ts +22 -7
- package/server/service/data-set/data-set-mutation.ts +1 -4
- package/server/service/data-set/data-set-type.ts +15 -4
- package/server/service/data-set/data-set.ts +18 -9
- package/server/service/index.ts +6 -2
- package/things-factory.config.js +4 -0
- package/translations/en.json +10 -1
- package/translations/ko.json +10 -1
- package/translations/ms.json +10 -1
- package/translations/zh.json +10 -1
@@ -8,7 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
10
|
};
|
11
|
-
var _a, _b;
|
11
|
+
var _a, _b, _c, _d;
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
13
13
|
exports.DataSetList = exports.DataSetPatch = exports.NewDataSet = void 0;
|
14
14
|
const type_graphql_1 = require("type-graphql");
|
@@ -24,6 +24,10 @@ __decorate([
|
|
24
24
|
(0, type_graphql_1.Field)({ nullable: true }),
|
25
25
|
__metadata("design:type", String)
|
26
26
|
], NewDataSet.prototype, "description", void 0);
|
27
|
+
__decorate([
|
28
|
+
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true }),
|
29
|
+
__metadata("design:type", typeof (_a = typeof shell_1.ObjectRef !== "undefined" && shell_1.ObjectRef) === "function" ? _a : Object)
|
30
|
+
], NewDataSet.prototype, "supervisoryRole", void 0);
|
27
31
|
__decorate([
|
28
32
|
(0, type_graphql_1.Field)({ nullable: true }),
|
29
33
|
__metadata("design:type", Boolean)
|
@@ -32,9 +36,13 @@ __decorate([
|
|
32
36
|
(0, type_graphql_1.Field)({ nullable: true }),
|
33
37
|
__metadata("design:type", String)
|
34
38
|
], NewDataSet.prototype, "type", void 0);
|
39
|
+
__decorate([
|
40
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
41
|
+
__metadata("design:type", String)
|
42
|
+
], NewDataSet.prototype, "useCase", void 0);
|
35
43
|
__decorate([
|
36
44
|
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
|
37
|
-
__metadata("design:type", typeof (
|
45
|
+
__metadata("design:type", typeof (_b = typeof shell_1.ScalarObject !== "undefined" && shell_1.ScalarObject) === "function" ? _b : Object)
|
38
46
|
], NewDataSet.prototype, "partitionKeys", void 0);
|
39
47
|
__decorate([
|
40
48
|
(0, type_graphql_1.Field)({ nullable: true }),
|
@@ -62,6 +70,10 @@ __decorate([
|
|
62
70
|
(0, type_graphql_1.Field)({ nullable: true }),
|
63
71
|
__metadata("design:type", String)
|
64
72
|
], DataSetPatch.prototype, "description", void 0);
|
73
|
+
__decorate([
|
74
|
+
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true }),
|
75
|
+
__metadata("design:type", typeof (_c = typeof shell_1.ObjectRef !== "undefined" && shell_1.ObjectRef) === "function" ? _c : Object)
|
76
|
+
], DataSetPatch.prototype, "supervisoryRole", void 0);
|
65
77
|
__decorate([
|
66
78
|
(0, type_graphql_1.Field)({ nullable: true }),
|
67
79
|
__metadata("design:type", Boolean)
|
@@ -70,9 +82,13 @@ __decorate([
|
|
70
82
|
(0, type_graphql_1.Field)({ nullable: true }),
|
71
83
|
__metadata("design:type", String)
|
72
84
|
], DataSetPatch.prototype, "type", void 0);
|
85
|
+
__decorate([
|
86
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
87
|
+
__metadata("design:type", String)
|
88
|
+
], DataSetPatch.prototype, "useCase", void 0);
|
73
89
|
__decorate([
|
74
90
|
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
|
75
|
-
__metadata("design:type", typeof (
|
91
|
+
__metadata("design:type", typeof (_d = typeof shell_1.ScalarObject !== "undefined" && shell_1.ScalarObject) === "function" ? _d : Object)
|
76
92
|
], DataSetPatch.prototype, "partitionKeys", void 0);
|
77
93
|
__decorate([
|
78
94
|
(0, type_graphql_1.Field)({ nullable: true }),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"data-set-type.js","sourceRoot":"","sources":["../../../server/service/data-set/data-set-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAAoE;
|
1
|
+
{"version":3,"file":"data-set-type.js","sourceRoot":"","sources":["../../../server/service/data-set/data-set-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAAoE;AACpE,iDAA+D;AAE/D,yCAAoC;AAGpC,IAAa,UAAU,GAAvB,MAAa,UAAU;CA2BtB,CAAA;AAzBC;IADC,IAAA,oBAAK,GAAE;;wCACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDAC3B,iBAAS,oBAAT,iBAAS;mDAAA;AAG3B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,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QAAQ,EAAE,IAAI,EAAE,CAAC;kDAChC,oBAAY,oBAAZ,oBAAY;mDAAA;AAG5B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACT;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACT;AAGjB;IADC,IAAA,oBAAK,GAAE;;4CACM;AAhCH,YAAY;IADxB,IAAA,wBAAS,GAAE;GACC,YAAY,CAiCxB;AAjCY,oCAAY;AAoCzB,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"}
|
@@ -8,15 +8,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
10
|
};
|
11
|
-
var _a, _b, _c, _d;
|
11
|
+
var _a, _b, _c, _d, _e;
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
13
13
|
exports.DataSet = void 0;
|
14
|
-
const type_graphql_1 = require("type-graphql");
|
15
14
|
const typeorm_1 = require("typeorm");
|
16
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
17
15
|
const shell_1 = require("@things-factory/shell");
|
16
|
+
const type_graphql_1 = require("type-graphql");
|
17
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
18
18
|
const data_item_1 = require("../data-item/data-item");
|
19
|
-
const data_sample_1 = require("../data-sample/data-sample");
|
20
19
|
let DataSet = class DataSet {
|
21
20
|
};
|
22
21
|
__decorate([
|
@@ -52,6 +51,17 @@ __decorate([
|
|
52
51
|
(0, type_graphql_1.Field)({ nullable: true }),
|
53
52
|
__metadata("design:type", Boolean)
|
54
53
|
], DataSet.prototype, "active", void 0);
|
54
|
+
__decorate([
|
55
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.Role, {
|
56
|
+
nullable: true
|
57
|
+
}),
|
58
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
59
|
+
__metadata("design:type", typeof (_b = typeof auth_base_1.Role !== "undefined" && auth_base_1.Role) === "function" ? _b : Object)
|
60
|
+
], DataSet.prototype, "supervisoryRole", void 0);
|
61
|
+
__decorate([
|
62
|
+
(0, typeorm_1.RelationId)((dataSet) => dataSet.supervisoryRole),
|
63
|
+
__metadata("design:type", String)
|
64
|
+
], DataSet.prototype, "supervisoryRoleId", void 0);
|
55
65
|
__decorate([
|
56
66
|
(0, typeorm_1.Column)({
|
57
67
|
nullable: true
|
@@ -59,10 +69,17 @@ __decorate([
|
|
59
69
|
(0, type_graphql_1.Field)({ nullable: true }),
|
60
70
|
__metadata("design:type", String)
|
61
71
|
], DataSet.prototype, "type", void 0);
|
72
|
+
__decorate([
|
73
|
+
(0, typeorm_1.Column)({
|
74
|
+
nullable: true
|
75
|
+
}),
|
76
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
77
|
+
__metadata("design:type", String)
|
78
|
+
], DataSet.prototype, "useCase", void 0);
|
62
79
|
__decorate([
|
63
80
|
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
64
81
|
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
|
65
|
-
__metadata("design:type", typeof (
|
82
|
+
__metadata("design:type", typeof (_c = typeof shell_1.ScalarObject !== "undefined" && shell_1.ScalarObject) === "function" ? _c : Object)
|
66
83
|
], DataSet.prototype, "partitionKeys", void 0);
|
67
84
|
__decorate([
|
68
85
|
(0, typeorm_1.Column)({
|
@@ -76,11 +93,6 @@ __decorate([
|
|
76
93
|
(0, type_graphql_1.Field)(type => [data_item_1.DataItem], { nullable: true }),
|
77
94
|
__metadata("design:type", Array)
|
78
95
|
], DataSet.prototype, "dataItems", void 0);
|
79
|
-
__decorate([
|
80
|
-
(0, typeorm_1.OneToMany)(type => data_sample_1.DataSample, dataSample => dataSample.dataSet),
|
81
|
-
(0, type_graphql_1.Field)(type => [data_sample_1.DataSample], { nullable: true }),
|
82
|
-
__metadata("design:type", Array)
|
83
|
-
], DataSet.prototype, "dataSamples", void 0);
|
84
96
|
__decorate([
|
85
97
|
(0, typeorm_1.Column)({
|
86
98
|
nullable: true
|
@@ -110,7 +122,7 @@ __decorate([
|
|
110
122
|
nullable: true
|
111
123
|
}),
|
112
124
|
(0, type_graphql_1.Field)({ nullable: true }),
|
113
|
-
__metadata("design:type", typeof (
|
125
|
+
__metadata("design:type", typeof (_d = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _d : Object)
|
114
126
|
], DataSet.prototype, "creator", void 0);
|
115
127
|
__decorate([
|
116
128
|
(0, typeorm_1.RelationId)((dataSet) => dataSet.creator),
|
@@ -121,7 +133,7 @@ __decorate([
|
|
121
133
|
nullable: true
|
122
134
|
}),
|
123
135
|
(0, type_graphql_1.Field)({ nullable: true }),
|
124
|
-
__metadata("design:type", typeof (
|
136
|
+
__metadata("design:type", typeof (_e = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _e : Object)
|
125
137
|
], DataSet.prototype, "updater", void 0);
|
126
138
|
__decorate([
|
127
139
|
(0, typeorm_1.RelationId)((dataSet) => dataSet.creator),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"data-set.js","sourceRoot":"","sources":["../../../server/service/data-set/data-set.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA
|
1
|
+
{"version":3,"file":"data-set.js","sourceRoot":"","sources":["../../../server/service/data-set/data-set.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAUgB;AAChB,iDAA4D;AAC5D,+CAAoD;AACpD,yD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JC,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;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;AAnGP,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,CAoGnB;AApGY,0BAAO"}
|
@@ -15,13 +15,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
exports.schema = exports.entities = void 0;
|
18
|
+
const data_item_1 = require("./data-item");
|
18
19
|
/* IMPORT ENTITIES AND RESOLVERS */
|
19
|
-
const
|
20
|
+
const data_ooc_1 = require("./data-ooc");
|
20
21
|
const data_sample_1 = require("./data-sample");
|
21
|
-
const
|
22
|
+
const data_sensor_1 = require("./data-sensor");
|
22
23
|
const data_set_1 = require("./data-set");
|
23
24
|
const data_spec_1 = require("./data-spec");
|
24
25
|
/* EXPORT ENTITY TYPES */
|
26
|
+
__exportStar(require("./data-ooc/data-ooc"), exports);
|
25
27
|
__exportStar(require("./data-sensor/data-sensor"), exports);
|
26
28
|
__exportStar(require("./data-sample/data-sample"), exports);
|
27
29
|
__exportStar(require("./data-item/data-item"), exports);
|
@@ -29,6 +31,7 @@ __exportStar(require("./data-set/data-set"), exports);
|
|
29
31
|
__exportStar(require("./data-spec/data-spec"), exports);
|
30
32
|
exports.entities = [
|
31
33
|
/* ENTITIES */
|
34
|
+
...data_ooc_1.entities,
|
32
35
|
...data_sensor_1.entities,
|
33
36
|
...data_sample_1.entities,
|
34
37
|
...data_item_1.entities,
|
@@ -38,6 +41,7 @@ exports.entities = [
|
|
38
41
|
exports.schema = {
|
39
42
|
resolverClasses: [
|
40
43
|
/* RESOLVER CLASSES */
|
44
|
+
...data_ooc_1.resolvers,
|
41
45
|
...data_sensor_1.resolvers,
|
42
46
|
...data_sample_1.resolvers,
|
43
47
|
...data_item_1.resolvers,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mCAAmC;AACnC,+CAAgG;AAChG,+CAAgG;AAChG,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAA0F;AAC1F,mCAAmC;AACnC,yCAAuF;AACvF,+CAAgG;AAChG,+CAAgG;AAChG,yCAAuF;AACvF,2CAA0F;AAE1F,yBAAyB;AACzB,sDAAmC;AACnC,4DAAyC;AACzC,4DAAyC;AACzC,wDAAqC;AACrC,sDAAmC;AACnC,wDAAqC;AAExB,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,mBAAe;IAClB,GAAG,sBAAkB;IACrB,GAAG,sBAAkB;IACrB,GAAG,oBAAgB;IACnB,GAAG,mBAAe;IAClB,GAAG,oBAAgB;CACpB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACtB,GAAG,oBAAgB;QACnB,GAAG,uBAAmB;QACtB,GAAG,uBAAmB;QACtB,GAAG,qBAAiB;QACpB,GAAG,oBAAgB;QACnB,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-alpha.
|
3
|
+
"version": "5.0.0-alpha.14",
|
4
4
|
"main": "dist-server/index.js",
|
5
5
|
"browser": "client/index.js",
|
6
6
|
"things-factory": true,
|
@@ -24,19 +24,19 @@
|
|
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-alpha.
|
28
|
-
"@operato/data-grist": "1.0.0-alpha.
|
29
|
-
"@operato/dataset": "1.0.0-alpha.
|
30
|
-
"@operato/graphql": "1.0.0-alpha.
|
31
|
-
"@operato/i18n": "1.0.0-alpha.
|
32
|
-
"@operato/layout": "1.0.0-alpha.
|
33
|
-
"@operato/shell": "1.0.0-alpha.
|
34
|
-
"@operato/styles": "1.0.0-alpha.
|
35
|
-
"@operato/utils": "1.0.0-alpha.
|
36
|
-
"@things-factory/auth-base": "^5.0.0-alpha.
|
37
|
-
"@things-factory/env": "^5.0.0-alpha.
|
38
|
-
"@things-factory/shell": "^5.0.0-alpha.
|
27
|
+
"@operato/app": "1.0.0-alpha.34",
|
28
|
+
"@operato/data-grist": "1.0.0-alpha.34",
|
29
|
+
"@operato/dataset": "1.0.0-alpha.34",
|
30
|
+
"@operato/graphql": "1.0.0-alpha.34",
|
31
|
+
"@operato/i18n": "1.0.0-alpha.34",
|
32
|
+
"@operato/layout": "1.0.0-alpha.34",
|
33
|
+
"@operato/shell": "1.0.0-alpha.34",
|
34
|
+
"@operato/styles": "1.0.0-alpha.34",
|
35
|
+
"@operato/utils": "1.0.0-alpha.34",
|
36
|
+
"@things-factory/auth-base": "^5.0.0-alpha.14",
|
37
|
+
"@things-factory/env": "^5.0.0-alpha.14",
|
38
|
+
"@things-factory/shell": "^5.0.0-alpha.14",
|
39
39
|
"moment": "^2.29.1"
|
40
40
|
},
|
41
|
-
"gitHead": "
|
41
|
+
"gitHead": "e64e66b147eca1d3219fed7d9764fe2a221a5569"
|
42
42
|
}
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import { DataItem, DataSet } from 'server/service'
|
2
|
+
|
3
|
+
export type DataItemSpec = {
|
4
|
+
type: string
|
5
|
+
label: string
|
6
|
+
name: string
|
7
|
+
property: { [option: string]: any }
|
8
|
+
}
|
9
|
+
|
10
|
+
export type DataItemSpecSet = {
|
11
|
+
name: string
|
12
|
+
description: string
|
13
|
+
specs: DataItemSpec[]
|
14
|
+
}
|
15
|
+
|
16
|
+
export type EvaluationResult = { oos: boolean; ooc: boolean }
|
17
|
+
|
18
|
+
export abstract class DataUseCase {
|
19
|
+
static registry: { [name: string]: DataUseCase } = {}
|
20
|
+
|
21
|
+
public static registerUseCase(name: string, provider: DataUseCase) {
|
22
|
+
DataUseCase.registry[name] = provider
|
23
|
+
}
|
24
|
+
|
25
|
+
public static getUseCaseNames() {
|
26
|
+
return Object.keys(DataUseCase.registry)
|
27
|
+
}
|
28
|
+
|
29
|
+
public static getUseCase(name: string): DataUseCase | undefined {
|
30
|
+
return DataUseCase.registry[name]
|
31
|
+
}
|
32
|
+
|
33
|
+
public static evaluate(dataSet: DataSet, dataItems: DataItem[], data: any): EvaluationResult {
|
34
|
+
var ooc = false
|
35
|
+
var oos = false
|
36
|
+
|
37
|
+
if (!dataSet.useCase) {
|
38
|
+
return { ooc, oos }
|
39
|
+
}
|
40
|
+
|
41
|
+
const useCaseNames = dataSet.useCase.split(',').map(useCaseName => useCaseName.trim())
|
42
|
+
const useCases = useCaseNames.map(useCaseName => DataUseCase.getUseCase(useCaseName)).filter(useCase => !!useCase)
|
43
|
+
|
44
|
+
for (let i = 0; i < dataItems.length; i++) {
|
45
|
+
const dataItem = dataItems[i]
|
46
|
+
const { name, active } = dataItem
|
47
|
+
if (!active) {
|
48
|
+
continue
|
49
|
+
}
|
50
|
+
|
51
|
+
let values: any | any[] = data[name]
|
52
|
+
if (typeof values === 'undefined') {
|
53
|
+
continue // TODO what if in case no value ?
|
54
|
+
}
|
55
|
+
|
56
|
+
if (!(values instanceof Array)) {
|
57
|
+
values = [values]
|
58
|
+
}
|
59
|
+
|
60
|
+
for (let j = 0; j < useCases.length; j++) {
|
61
|
+
const useCase = useCases[j]
|
62
|
+
|
63
|
+
const specs = dataItem.spec?.[dataSet.useCase]
|
64
|
+
if (!specs) {
|
65
|
+
continue
|
66
|
+
}
|
67
|
+
|
68
|
+
const result = useCase.evaluate(specs, values)
|
69
|
+
|
70
|
+
if (result) {
|
71
|
+
ooc ||= result.ooc
|
72
|
+
oos ||= result.oos
|
73
|
+
}
|
74
|
+
|
75
|
+
// if (ooc && oos) {
|
76
|
+
// return { ooc, oos }
|
77
|
+
// }
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
return { ooc, oos }
|
82
|
+
}
|
83
|
+
|
84
|
+
public abstract evaluate(specs: any, values: any[]): EvaluationResult
|
85
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './data-use-case'
|
package/server/index.ts
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
import { DataItem, DataItemType } from './data-item'
|
2
2
|
import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'
|
3
|
-
|
4
|
-
import { ScalarObject } from '@things-factory/shell'
|
3
|
+
import { ObjectRef, ScalarObject } from '@things-factory/shell'
|
5
4
|
|
6
5
|
@InputType()
|
7
6
|
export class DataItemPatch {
|
8
7
|
@Field(type => ID, { nullable: true })
|
9
8
|
id?: string
|
10
9
|
|
11
|
-
@Field({ nullable: true })
|
12
|
-
|
10
|
+
@Field(type => ObjectRef, { nullable: true })
|
11
|
+
dataSet?: ObjectRef
|
13
12
|
|
14
13
|
@Field({ nullable: true })
|
15
14
|
name?: string
|
@@ -53,7 +53,7 @@ export class DataItem {
|
|
53
53
|
description?: string
|
54
54
|
|
55
55
|
@ManyToOne(type => DataSet, dataSet => dataSet.dataItems, { onDelete: 'CASCADE' })
|
56
|
-
@Field(type => DataSet, { nullable:
|
56
|
+
@Field(type => DataSet, { nullable: false })
|
57
57
|
dataSet?: DataSet
|
58
58
|
|
59
59
|
@RelationId((dataItem: DataItem) => dataItem.dataSet)
|
@@ -0,0 +1,117 @@
|
|
1
|
+
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
2
|
+
import { getRepository, In } from 'typeorm'
|
3
|
+
import { DataOoc, DataOocStatus } from './data-ooc'
|
4
|
+
import { NewDataOoc, DataOocPatch } from './data-ooc-type'
|
5
|
+
|
6
|
+
@Resolver(DataOoc)
|
7
|
+
export class DataOocMutation {
|
8
|
+
@Directive('@privilege(category: "data-ooc", privilege: "mutation", domainOwnerGranted: true)')
|
9
|
+
@Directive('@transaction')
|
10
|
+
@Mutation(returns => DataOoc, { description: 'To create new DataOoc' })
|
11
|
+
async createDataOoc(@Arg('dataOoc') dataOoc: NewDataOoc, @Ctx() context: any): Promise<DataOoc> {
|
12
|
+
const { domain, user, tx } = context.state
|
13
|
+
|
14
|
+
return await tx.getRepository(DataOoc).save({
|
15
|
+
...dataOoc,
|
16
|
+
domain,
|
17
|
+
creator: user,
|
18
|
+
updater: user
|
19
|
+
})
|
20
|
+
}
|
21
|
+
|
22
|
+
@Directive('@privilege(category: "data-ooc", privilege: "mutation", domainOwnerGranted: true)')
|
23
|
+
@Directive('@transaction')
|
24
|
+
@Mutation(returns => DataOoc, { description: 'To modify DataOoc information' })
|
25
|
+
async updateDataOoc(@Arg('id') id: string, @Arg('patch') patch: DataOocPatch, @Ctx() context: any): Promise<DataOoc> {
|
26
|
+
const { domain, user, tx } = context.state
|
27
|
+
|
28
|
+
const repository = tx.getRepository(DataOoc)
|
29
|
+
const dataOoc = await repository.findOne({
|
30
|
+
where: { domain, id }
|
31
|
+
})
|
32
|
+
|
33
|
+
const more = {} as any
|
34
|
+
if (patch.correctiveAction) {
|
35
|
+
more.corrector = user
|
36
|
+
more.state = DataOocStatus.CORRECTED
|
37
|
+
}
|
38
|
+
|
39
|
+
return await repository.save({
|
40
|
+
...dataOoc,
|
41
|
+
...patch,
|
42
|
+
...more,
|
43
|
+
updater: user
|
44
|
+
})
|
45
|
+
}
|
46
|
+
|
47
|
+
@Directive('@privilege(category: "data-ooc", privilege: "mutation", domainOwnerGranted: true)')
|
48
|
+
@Directive('@transaction')
|
49
|
+
@Mutation(returns => [DataOoc], { description: "To modify multiple DataOoc' information" })
|
50
|
+
async updateMultipleDataOoc(
|
51
|
+
@Arg('patches', type => [DataOocPatch]) patches: DataOocPatch[],
|
52
|
+
@Ctx() context: any
|
53
|
+
): Promise<DataOoc[]> {
|
54
|
+
const { domain, user, tx } = context.state
|
55
|
+
|
56
|
+
let results = []
|
57
|
+
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
58
|
+
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
59
|
+
const dataOocRepo = tx.getRepository(DataOoc)
|
60
|
+
|
61
|
+
if (_createRecords.length > 0) {
|
62
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
63
|
+
const newRecord = _createRecords[i]
|
64
|
+
|
65
|
+
const result = await dataOocRepo.save({
|
66
|
+
...newRecord,
|
67
|
+
domain,
|
68
|
+
creator: user,
|
69
|
+
updater: user
|
70
|
+
})
|
71
|
+
|
72
|
+
results.push({ ...result, cuFlag: '+' })
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
if (_updateRecords.length > 0) {
|
77
|
+
for (let i = 0; i < _updateRecords.length; i++) {
|
78
|
+
const newRecord = _updateRecords[i]
|
79
|
+
const dataOoc = await dataOocRepo.findOne(newRecord.id)
|
80
|
+
|
81
|
+
const result = await dataOocRepo.save({
|
82
|
+
...dataOoc,
|
83
|
+
...newRecord,
|
84
|
+
updater: user
|
85
|
+
})
|
86
|
+
|
87
|
+
results.push({ ...result, cuFlag: 'M' })
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
return results
|
92
|
+
}
|
93
|
+
|
94
|
+
@Directive('@privilege(category: "data-ooc", privilege: "mutation", domainOwnerGranted: true)')
|
95
|
+
@Directive('@transaction')
|
96
|
+
@Mutation(returns => Boolean, { description: 'To delete DataOoc' })
|
97
|
+
async deleteDataOoc(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
|
98
|
+
const { domain, tx } = context.state
|
99
|
+
|
100
|
+
await tx.getRepository(DataOoc).delete({ domain, id })
|
101
|
+
return true
|
102
|
+
}
|
103
|
+
|
104
|
+
@Directive('@privilege(category: "data-ooc", privilege: "mutation", domainOwnerGranted: true)')
|
105
|
+
@Directive('@transaction')
|
106
|
+
@Mutation(returns => Boolean, { description: 'To delete multiple dataOocs' })
|
107
|
+
async deleteDataOocs(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {
|
108
|
+
const { domain, tx } = context.state
|
109
|
+
|
110
|
+
await tx.getRepository(DataOoc).delete({
|
111
|
+
domain,
|
112
|
+
id: In(ids)
|
113
|
+
})
|
114
|
+
|
115
|
+
return true
|
116
|
+
}
|
117
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
|
2
|
+
import { getRepository } from 'typeorm'
|
3
|
+
import { Domain, ListParam, convertListParams } from '@things-factory/shell'
|
4
|
+
import { User } from '@things-factory/auth-base'
|
5
|
+
import { DataOoc } from './data-ooc'
|
6
|
+
import { DataOocList } from './data-ooc-type'
|
7
|
+
|
8
|
+
@Resolver(DataOoc)
|
9
|
+
export class DataOocQuery {
|
10
|
+
@Directive('@privilege(category: "data-ooc", privilege: "query", domainOwnerGranted: true)')
|
11
|
+
@Query(returns => DataOoc, { description: 'To fetch a DataOoc' })
|
12
|
+
async dataOoc(@Arg('id') id: string, @Ctx() context: any): Promise<DataOoc> {
|
13
|
+
const { domain } = context.state
|
14
|
+
|
15
|
+
return await getRepository(DataOoc).findOne({
|
16
|
+
where: { domain, id }
|
17
|
+
})
|
18
|
+
}
|
19
|
+
|
20
|
+
@Directive('@privilege(category: "data-ooc", privilege: "query", domainOwnerGranted: true)')
|
21
|
+
@Query(returns => DataOocList, { description: 'To fetch multiple DataOoc' })
|
22
|
+
async dataOocs(@Args() params: ListParam, @Ctx() context: any): Promise<DataOocList> {
|
23
|
+
const { domain } = context.state
|
24
|
+
|
25
|
+
const convertedParams = convertListParams(params, domain.id)
|
26
|
+
const [items, total] = await getRepository(DataOoc).findAndCount(convertedParams)
|
27
|
+
|
28
|
+
return { items, total }
|
29
|
+
}
|
30
|
+
|
31
|
+
@FieldResolver(type => Domain)
|
32
|
+
async domain(@Root() dataOoc: DataOoc): Promise<Domain> {
|
33
|
+
return await getRepository(Domain).findOne(dataOoc.domainId)
|
34
|
+
}
|
35
|
+
|
36
|
+
@FieldResolver(type => User)
|
37
|
+
async updater(@Root() dataOoc: DataOoc): Promise<User> {
|
38
|
+
return await getRepository(User).findOne(dataOoc.updaterId)
|
39
|
+
}
|
40
|
+
|
41
|
+
@FieldResolver(type => User)
|
42
|
+
async creator(@Root() dataOoc: DataOoc): Promise<User> {
|
43
|
+
return await getRepository(User).findOne(dataOoc.creatorId)
|
44
|
+
}
|
45
|
+
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { DataOoc, DataOocStatus } from './data-ooc'
|
2
|
+
import { Field, ID, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'
|
3
|
+
import { ObjectRef, ScalarObject } from '@things-factory/shell'
|
4
|
+
|
5
|
+
import { User } from '@things-factory/auth-base'
|
6
|
+
|
7
|
+
@InputType()
|
8
|
+
export class NewDataOoc {
|
9
|
+
@Field()
|
10
|
+
name: string
|
11
|
+
|
12
|
+
@Field({ nullable: true })
|
13
|
+
description?: string
|
14
|
+
|
15
|
+
@Field(type => ObjectRef, { nullable: true })
|
16
|
+
dataSet?: ObjectRef
|
17
|
+
|
18
|
+
@Field(type => ObjectRef, { nullable: true })
|
19
|
+
dataSample?: ObjectRef
|
20
|
+
|
21
|
+
@Field(type => DataOocStatus, { nullable: true })
|
22
|
+
state?: DataOocStatus
|
23
|
+
|
24
|
+
@Field(type => ScalarObject, { nullable: true })
|
25
|
+
data?: ScalarObject
|
26
|
+
|
27
|
+
@Field({ nullable: true })
|
28
|
+
rawData?: string
|
29
|
+
|
30
|
+
@Field({ nullable: true })
|
31
|
+
source?: string
|
32
|
+
|
33
|
+
@Field({ nullable: true })
|
34
|
+
ooc?: boolean
|
35
|
+
|
36
|
+
@Field({ nullable: true })
|
37
|
+
oos?: boolean
|
38
|
+
|
39
|
+
@Field({ nullable: true })
|
40
|
+
collectedAt?: Date
|
41
|
+
}
|
42
|
+
|
43
|
+
@InputType()
|
44
|
+
export class DataOocPatch {
|
45
|
+
@Field(type => ID, { nullable: true })
|
46
|
+
id?: string
|
47
|
+
|
48
|
+
@Field(type => DataOocStatus, { nullable: true })
|
49
|
+
state?: DataOocStatus
|
50
|
+
|
51
|
+
@Field({ nullable: true })
|
52
|
+
correctiveAction?: string
|
53
|
+
}
|
54
|
+
|
55
|
+
@ObjectType()
|
56
|
+
export class DataOocList {
|
57
|
+
@Field(type => [DataOoc])
|
58
|
+
items: DataOoc[]
|
59
|
+
|
60
|
+
@Field(type => Int)
|
61
|
+
total: number
|
62
|
+
}
|