@things-factory/dataset 5.0.0-alpha.1

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.
Files changed (79) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE.md +21 -0
  3. package/client/bootstrap.js +3 -0
  4. package/client/index.js +0 -0
  5. package/client/pages/data-item-list.js +280 -0
  6. package/client/pages/data-sample.js +272 -0
  7. package/client/pages/data-set-importer.js +103 -0
  8. package/client/pages/data-set.js +418 -0
  9. package/client/route.js +11 -0
  10. package/dist-server/controllers/index.js +1 -0
  11. package/dist-server/controllers/index.js.map +1 -0
  12. package/dist-server/index.js +21 -0
  13. package/dist-server/index.js.map +1 -0
  14. package/dist-server/middlewares/index.js +8 -0
  15. package/dist-server/middlewares/index.js.map +1 -0
  16. package/dist-server/migrations/index.js +12 -0
  17. package/dist-server/migrations/index.js.map +1 -0
  18. package/dist-server/routes.js +25 -0
  19. package/dist-server/routes.js.map +1 -0
  20. package/dist-server/service/data-item/data-item-mutation.js +69 -0
  21. package/dist-server/service/data-item/data-item-mutation.js.map +1 -0
  22. package/dist-server/service/data-item/data-item-query.js +100 -0
  23. package/dist-server/service/data-item/data-item-query.js.map +1 -0
  24. package/dist-server/service/data-item/data-item-type.js +80 -0
  25. package/dist-server/service/data-item/data-item-type.js.map +1 -0
  26. package/dist-server/service/data-item/data-item.js +136 -0
  27. package/dist-server/service/data-item/data-item.js.map +1 -0
  28. package/dist-server/service/data-item/index.js +9 -0
  29. package/dist-server/service/data-item/index.js.map +1 -0
  30. package/dist-server/service/data-sample/data-sample-mutation.js +142 -0
  31. package/dist-server/service/data-sample/data-sample-mutation.js.map +1 -0
  32. package/dist-server/service/data-sample/data-sample-query.js +100 -0
  33. package/dist-server/service/data-sample/data-sample-query.js.map +1 -0
  34. package/dist-server/service/data-sample/data-sample-type.js +82 -0
  35. package/dist-server/service/data-sample/data-sample-type.js.map +1 -0
  36. package/dist-server/service/data-sample/data-sample.js +105 -0
  37. package/dist-server/service/data-sample/data-sample.js.map +1 -0
  38. package/dist-server/service/data-sample/index.js +9 -0
  39. package/dist-server/service/data-sample/index.js.map +1 -0
  40. package/dist-server/service/data-set/data-set-mutation.js +216 -0
  41. package/dist-server/service/data-set/data-set-mutation.js.map +1 -0
  42. package/dist-server/service/data-set/data-set-query.js +102 -0
  43. package/dist-server/service/data-set/data-set-query.js.map +1 -0
  44. package/dist-server/service/data-set/data-set-type.js +89 -0
  45. package/dist-server/service/data-set/data-set-type.js.map +1 -0
  46. package/dist-server/service/data-set/data-set.js +117 -0
  47. package/dist-server/service/data-set/data-set.js.map +1 -0
  48. package/dist-server/service/data-set/index.js +9 -0
  49. package/dist-server/service/data-set/index.js.map +1 -0
  50. package/dist-server/service/index.js +40 -0
  51. package/dist-server/service/index.js.map +1 -0
  52. package/package.json +38 -0
  53. package/server/controllers/index.ts +0 -0
  54. package/server/index.ts +5 -0
  55. package/server/middlewares/index.ts +3 -0
  56. package/server/migrations/index.ts +9 -0
  57. package/server/routes.ts +28 -0
  58. package/server/service/data-item/data-item-mutation.ts +56 -0
  59. package/server/service/data-item/data-item-query.ts +53 -0
  60. package/server/service/data-item/data-item-type.ts +50 -0
  61. package/server/service/data-item/data-item.ts +113 -0
  62. package/server/service/data-item/index.ts +6 -0
  63. package/server/service/data-sample/data-sample-mutation.ts +137 -0
  64. package/server/service/data-sample/data-sample-query.ts +53 -0
  65. package/server/service/data-sample/data-sample-type.ts +50 -0
  66. package/server/service/data-sample/data-sample.ts +84 -0
  67. package/server/service/data-sample/index.ts +6 -0
  68. package/server/service/data-set/data-set-mutation.ts +209 -0
  69. package/server/service/data-set/data-set-query.ts +55 -0
  70. package/server/service/data-set/data-set-type.ts +54 -0
  71. package/server/service/data-set/data-set.ts +96 -0
  72. package/server/service/data-set/index.ts +6 -0
  73. package/server/service/index.ts +25 -0
  74. package/things-factory.config.js +17 -0
  75. package/translations/en.json +8 -0
  76. package/translations/ko.json +8 -0
  77. package/translations/ms.json +8 -0
  78. package/translations/zh.json +8 -0
  79. package/tsconfig.json +9 -0
@@ -0,0 +1,82 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DataSampleList = exports.DataSamplePatch = exports.NewDataSample = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const shell_1 = require("@things-factory/shell");
15
+ const data_sample_1 = require("./data-sample");
16
+ let NewDataSample = class NewDataSample {
17
+ };
18
+ __decorate([
19
+ (0, type_graphql_1.Field)({ nullable: true }),
20
+ __metadata("design:type", String)
21
+ ], NewDataSample.prototype, "name", void 0);
22
+ __decorate([
23
+ (0, type_graphql_1.Field)({ nullable: true }),
24
+ __metadata("design:type", String)
25
+ ], NewDataSample.prototype, "description", void 0);
26
+ __decorate([
27
+ (0, type_graphql_1.Field)({ nullable: true }),
28
+ __metadata("design:type", String)
29
+ ], NewDataSample.prototype, "dataSetId", void 0);
30
+ __decorate([
31
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
32
+ __metadata("design:type", Object)
33
+ ], NewDataSample.prototype, "data", void 0);
34
+ NewDataSample = __decorate([
35
+ (0, type_graphql_1.InputType)()
36
+ ], NewDataSample);
37
+ exports.NewDataSample = NewDataSample;
38
+ let DataSamplePatch = class DataSamplePatch {
39
+ };
40
+ __decorate([
41
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
42
+ __metadata("design:type", String)
43
+ ], DataSamplePatch.prototype, "id", void 0);
44
+ __decorate([
45
+ (0, type_graphql_1.Field)({ nullable: true }),
46
+ __metadata("design:type", String)
47
+ ], DataSamplePatch.prototype, "name", void 0);
48
+ __decorate([
49
+ (0, type_graphql_1.Field)({ nullable: true }),
50
+ __metadata("design:type", String)
51
+ ], DataSamplePatch.prototype, "description", void 0);
52
+ __decorate([
53
+ (0, type_graphql_1.Field)({ nullable: true }),
54
+ __metadata("design:type", String)
55
+ ], DataSamplePatch.prototype, "dataSetId", void 0);
56
+ __decorate([
57
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
58
+ __metadata("design:type", Object)
59
+ ], DataSamplePatch.prototype, "data", void 0);
60
+ __decorate([
61
+ (0, type_graphql_1.Field)(),
62
+ __metadata("design:type", String)
63
+ ], DataSamplePatch.prototype, "cuFlag", void 0);
64
+ DataSamplePatch = __decorate([
65
+ (0, type_graphql_1.InputType)()
66
+ ], DataSamplePatch);
67
+ exports.DataSamplePatch = DataSamplePatch;
68
+ let DataSampleList = class DataSampleList {
69
+ };
70
+ __decorate([
71
+ (0, type_graphql_1.Field)(type => [data_sample_1.DataSample]),
72
+ __metadata("design:type", Array)
73
+ ], DataSampleList.prototype, "items", void 0);
74
+ __decorate([
75
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
76
+ __metadata("design:type", Number)
77
+ ], DataSampleList.prototype, "total", void 0);
78
+ DataSampleList = __decorate([
79
+ (0, type_graphql_1.ObjectType)()
80
+ ], DataSampleList);
81
+ exports.DataSampleList = DataSampleList;
82
+ //# sourceMappingURL=data-sample-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-sample-type.js","sourceRoot":"","sources":["../../../server/service/data-sample/data-sample-type.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAoE;AAEpE,iDAAoD;AAE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GnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;6CACN;AALF,cAAc;IAD1B,IAAA,yBAAU,GAAE;GACA,cAAc,CAM1B;AANY,wCAAc"}
@@ -0,0 +1,105 @@
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;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.DataSample = 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 DataSample = class DataSample {
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
+ ], DataSample.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
+ ], DataSample.prototype, "domain", void 0);
31
+ __decorate([
32
+ (0, typeorm_1.RelationId)((dataSample) => dataSample.domain),
33
+ __metadata("design:type", String)
34
+ ], DataSample.prototype, "domainId", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.Column)(),
37
+ (0, type_graphql_1.Field)(),
38
+ __metadata("design:type", String)
39
+ ], DataSample.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
+ ], DataSample.prototype, "description", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.ManyToOne)(type => data_set_1.DataSet, dataSet => dataSet.dataSamples),
49
+ (0, type_graphql_1.Field)(type => data_set_1.DataSet, { nullable: true }),
50
+ __metadata("design:type", data_set_1.DataSet)
51
+ ], DataSample.prototype, "dataSet", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.RelationId)((dataSample) => dataSample.dataSet),
54
+ (0, type_graphql_1.Field)({ nullable: true }),
55
+ __metadata("design:type", String)
56
+ ], DataSample.prototype, "dataSetId", void 0);
57
+ __decorate([
58
+ (0, typeorm_1.Column)('simple-json', { nullable: true }),
59
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
60
+ __metadata("design:type", Object)
61
+ ], DataSample.prototype, "data", 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
+ ], DataSample.prototype, "spec", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.CreateDateColumn)(),
69
+ (0, type_graphql_1.Field)({ nullable: true }),
70
+ __metadata("design:type", Date)
71
+ ], DataSample.prototype, "createdAt", void 0);
72
+ __decorate([
73
+ (0, typeorm_1.UpdateDateColumn)(),
74
+ (0, type_graphql_1.Field)({ nullable: true }),
75
+ __metadata("design:type", Date)
76
+ ], DataSample.prototype, "updatedAt", void 0);
77
+ __decorate([
78
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
79
+ nullable: true
80
+ }),
81
+ (0, type_graphql_1.Field)({ nullable: true }),
82
+ __metadata("design:type", typeof (_b = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _b : Object)
83
+ ], DataSample.prototype, "creator", void 0);
84
+ __decorate([
85
+ (0, typeorm_1.RelationId)((dataSample) => dataSample.creator),
86
+ __metadata("design:type", String)
87
+ ], DataSample.prototype, "creatorId", void 0);
88
+ __decorate([
89
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
90
+ nullable: true
91
+ }),
92
+ (0, type_graphql_1.Field)({ nullable: true }),
93
+ __metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
94
+ ], DataSample.prototype, "updater", void 0);
95
+ __decorate([
96
+ (0, typeorm_1.RelationId)((dataSample) => dataSample.creator),
97
+ __metadata("design:type", String)
98
+ ], DataSample.prototype, "updaterId", void 0);
99
+ DataSample = __decorate([
100
+ (0, typeorm_1.Entity)(),
101
+ (0, typeorm_1.Index)('ix_data_sample_0', (dataSample) => [dataSample.domain, dataSample.dataSet], { unique: false }),
102
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for DataSample' })
103
+ ], DataSample);
104
+ exports.DataSample = DataSample;
105
+ //# sourceMappingURL=data-sample.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-sample.js","sourceRoot":"","sources":["../../../server/service/data-sample/data-sample.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAAoD;AACpD,qCASgB;AAEhB,yDAAgD;AAChD,iDAA4D;AAE5D,mDAA8C;AAK9C,IAAa,UAAU,GAAvB,MAAa,UAAU;CA+DtB,CAAA;AA5DC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;sCACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAA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AE,IAAI,EAAE,CAAC;8BACd,IAAI;6CAAA;AAIhB;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACd,IAAI;6CAAA;AAMhB;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;2CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,UAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;;6CACzC;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;2CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,UAAsB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;;6CACzC;AA9DP,UAAU;IAHtB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,kBAAkB,EAAE,CAAC,UAAsB,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACjH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;GACxC,UAAU,CA+DtB;AA/DY,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_sample_1 = require("./data-sample");
5
+ const data_sample_query_1 = require("./data-sample-query");
6
+ const data_sample_mutation_1 = require("./data-sample-mutation");
7
+ exports.entities = [data_sample_1.DataSample];
8
+ exports.resolvers = [data_sample_query_1.DataSampleQuery, data_sample_mutation_1.DataSampleMutation];
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/data-sample/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"}
@@ -0,0 +1,216 @@
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 __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DataSetMutation = void 0;
19
+ const type_graphql_1 = require("type-graphql");
20
+ const typeorm_1 = require("typeorm");
21
+ const v4_1 = __importDefault(require("uuid/v4"));
22
+ const data_item_1 = require("../data-item/data-item");
23
+ const data_set_1 = require("./data-set");
24
+ const data_set_type_1 = require("./data-set-type");
25
+ let DataSetMutation = class DataSetMutation {
26
+ async createDataSet(dataSet, context) {
27
+ const { domain, user, tx } = context.state;
28
+ return await tx.getRepository(data_set_1.DataSet).save(Object.assign(Object.assign({}, dataSet), { domain, creator: user, updater: user }));
29
+ }
30
+ async updateDataSet(id, patch, context) {
31
+ const { domain, user, tx } = context.state;
32
+ const repository = tx.getRepository(data_set_1.DataSet);
33
+ const dataSet = await repository.findOne({
34
+ where: { domain, id }
35
+ });
36
+ return await repository.save(Object.assign(Object.assign(Object.assign({}, dataSet), patch), { updater: user }));
37
+ }
38
+ async updateMultipleDataSet(patches, context) {
39
+ const { domain, user, tx } = context.state;
40
+ let results = [];
41
+ const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
42
+ const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
43
+ const dataSetRepo = tx.getRepository(data_set_1.DataSet);
44
+ if (_createRecords.length > 0) {
45
+ for (let i = 0; i < _createRecords.length; i++) {
46
+ const newRecord = _createRecords[i];
47
+ const result = await dataSetRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
48
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
49
+ }
50
+ }
51
+ if (_updateRecords.length > 0) {
52
+ for (let i = 0; i < _updateRecords.length; i++) {
53
+ const newRecord = _updateRecords[i];
54
+ const dataSet = await dataSetRepo.findOne(newRecord.id);
55
+ const result = await dataSetRepo.save(Object.assign(Object.assign(Object.assign({}, dataSet), newRecord), { updater: user }));
56
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
57
+ }
58
+ }
59
+ return results;
60
+ }
61
+ async deleteDataSet(id, context) {
62
+ const { domain, tx } = context.state;
63
+ await tx.getRepository(data_set_1.DataSet).delete({ domain, id });
64
+ return true;
65
+ }
66
+ async deleteDataSets(ids, context) {
67
+ const { domain, tx } = context.state;
68
+ await tx.getRepository(data_set_1.DataSet).delete({
69
+ domain,
70
+ id: (0, typeorm_1.In)(ids)
71
+ });
72
+ return true;
73
+ }
74
+ async importDataSets(dataSets, context) {
75
+ const tx = context.state.tx;
76
+ const domain = context.state.domain;
77
+ await Promise.all(dataSets.map(async (dataSet) => {
78
+ var _a;
79
+ const createdDataSet = await tx.getRepository(data_set_1.DataSet).save(Object.assign({ domain }, dataSet));
80
+ if ((_a = dataSet.dataItems) === null || _a === void 0 ? void 0 : _a.length) {
81
+ await tx.getRepository(data_item_1.DataItem).save(dataSet.dataItems.map((dataItem) => {
82
+ dataItem.domain = domain;
83
+ dataItem.dataSet = createdDataSet;
84
+ return dataItem;
85
+ }));
86
+ }
87
+ }));
88
+ return true;
89
+ }
90
+ async copyDataSets(ids, context) {
91
+ const { domain, user, tx } = context.state;
92
+ const originals = await tx.getRepository(data_set_1.DataSet).find({
93
+ where: {
94
+ id: (0, typeorm_1.In)(ids),
95
+ domain
96
+ },
97
+ relations: ['domain', 'dataItems']
98
+ });
99
+ if (originals.length == 0) {
100
+ return [];
101
+ }
102
+ var newDataItems = [];
103
+ var newCopys = originals.map(dataSet => {
104
+ let dataSetId = (0, v4_1.default)();
105
+ newDataItems.push(...dataSet.dataItems.map(dataItem => {
106
+ return {
107
+ dataSet: dataSetId,
108
+ name: dataItem.name,
109
+ description: dataItem.description,
110
+ sequence: dataItem.sequence,
111
+ task: dataItem.task,
112
+ connection: dataItem.connection,
113
+ params: dataItem.params,
114
+ domain,
115
+ creator: user,
116
+ updater: user
117
+ };
118
+ }));
119
+ return {
120
+ id: dataSetId,
121
+ name: dataSet.name + ' (' + dataSetId + ')',
122
+ type: dataSet.type,
123
+ description: dataSet.description,
124
+ active: false,
125
+ schedule: dataSet.schedule,
126
+ timezone: dataSet.timezone,
127
+ domain,
128
+ creator: user,
129
+ updater: user
130
+ };
131
+ });
132
+ var copiedDataSets = await tx.getRepository(data_set_1.DataSet).save(newCopys);
133
+ var copiedDataItems = await tx.getRepository(data_item_1.DataItem).save(newDataItems);
134
+ return copiedDataSets.map(dataSet => {
135
+ dataSet.dataItems = copiedDataItems.filter(dataItem => dataItem.dataSet == dataSet.id);
136
+ return Object.assign(Object.assign({}, dataSet), { state: 'UNLOADED' // DataSetInstanceStatus.UNLOADED
137
+ });
138
+ });
139
+ }
140
+ };
141
+ __decorate([
142
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)'),
143
+ (0, type_graphql_1.Directive)('@transaction'),
144
+ (0, type_graphql_1.Mutation)(returns => data_set_1.DataSet, { description: 'To create new DataSet' }),
145
+ __param(0, (0, type_graphql_1.Arg)('dataSet')),
146
+ __param(1, (0, type_graphql_1.Ctx)()),
147
+ __metadata("design:type", Function),
148
+ __metadata("design:paramtypes", [data_set_type_1.NewDataSet, Object]),
149
+ __metadata("design:returntype", Promise)
150
+ ], DataSetMutation.prototype, "createDataSet", null);
151
+ __decorate([
152
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)'),
153
+ (0, type_graphql_1.Directive)('@transaction'),
154
+ (0, type_graphql_1.Mutation)(returns => data_set_1.DataSet, { description: 'To modify DataSet information' }),
155
+ __param(0, (0, type_graphql_1.Arg)('id')),
156
+ __param(1, (0, type_graphql_1.Arg)('patch')),
157
+ __param(2, (0, type_graphql_1.Ctx)()),
158
+ __metadata("design:type", Function),
159
+ __metadata("design:paramtypes", [String, data_set_type_1.DataSetPatch, Object]),
160
+ __metadata("design:returntype", Promise)
161
+ ], DataSetMutation.prototype, "updateDataSet", null);
162
+ __decorate([
163
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)'),
164
+ (0, type_graphql_1.Directive)('@transaction'),
165
+ (0, type_graphql_1.Mutation)(returns => [data_set_1.DataSet], { description: "To modify multiple DataSets' information" }),
166
+ __param(0, (0, type_graphql_1.Arg)('patches', type => [data_set_type_1.DataSetPatch])),
167
+ __param(1, (0, type_graphql_1.Ctx)()),
168
+ __metadata("design:type", Function),
169
+ __metadata("design:paramtypes", [Array, Object]),
170
+ __metadata("design:returntype", Promise)
171
+ ], DataSetMutation.prototype, "updateMultipleDataSet", null);
172
+ __decorate([
173
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)'),
174
+ (0, type_graphql_1.Directive)('@transaction'),
175
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete DataSet' }),
176
+ __param(0, (0, type_graphql_1.Arg)('id')),
177
+ __param(1, (0, type_graphql_1.Ctx)()),
178
+ __metadata("design:type", Function),
179
+ __metadata("design:paramtypes", [String, Object]),
180
+ __metadata("design:returntype", Promise)
181
+ ], DataSetMutation.prototype, "deleteDataSet", null);
182
+ __decorate([
183
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)'),
184
+ (0, type_graphql_1.Directive)('@transaction'),
185
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple dataSets' }),
186
+ __param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
187
+ __param(1, (0, type_graphql_1.Ctx)()),
188
+ __metadata("design:type", Function),
189
+ __metadata("design:paramtypes", [Array, Object]),
190
+ __metadata("design:returntype", Promise)
191
+ ], DataSetMutation.prototype, "deleteDataSets", null);
192
+ __decorate([
193
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)'),
194
+ (0, type_graphql_1.Directive)('@transaction'),
195
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple data-sets' }),
196
+ __param(0, (0, type_graphql_1.Arg)('dataSets', type => [data_set_type_1.DataSetPatch])),
197
+ __param(1, (0, type_graphql_1.Ctx)()),
198
+ __metadata("design:type", Function),
199
+ __metadata("design:paramtypes", [Array, Object]),
200
+ __metadata("design:returntype", Promise)
201
+ ], DataSetMutation.prototype, "importDataSets", null);
202
+ __decorate([
203
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)'),
204
+ (0, type_graphql_1.Directive)('@transaction'),
205
+ (0, type_graphql_1.Mutation)(returns => [data_set_1.DataSet], { description: 'To copy multiple data-sets' }),
206
+ __param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
207
+ __param(1, (0, type_graphql_1.Ctx)()),
208
+ __metadata("design:type", Function),
209
+ __metadata("design:paramtypes", [Array, Object]),
210
+ __metadata("design:returntype", Promise)
211
+ ], DataSetMutation.prototype, "copyDataSets", null);
212
+ DataSetMutation = __decorate([
213
+ (0, type_graphql_1.Resolver)(data_set_1.DataSet)
214
+ ], DataSetMutation);
215
+ exports.DataSetMutation = DataSetMutation;
216
+ //# sourceMappingURL=data-set-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-set-mutation.js","sourceRoot":"","sources":["../../../server/service/data-set/data-set-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+CAAsE;AACtE,qCAA2C;AAC3C,iDAA0B;AAI1B,sDAAiD;AACjD,yCAAoC;AACpC,mDAA0D;AAG1D,IAAa,eAAe,GAA5B,MAAa,eAAe;IAI1B,KAAK,CAAC,aAAa,CAAiB,OAAmB,EAAS,OAAY;QAC1E,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,kBAAO,CAAC,CAAC,IAAI,iCACtC,OAAO,KACV,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAKD,KAAK,CAAC,aAAa,CAAY,EAAU,EAAgB,KAAmB,EAAS,OAAY;QAC/F,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,kBAAO,CAAC,CAAA;QAC5C,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,O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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 __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var _a;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.DataSetQuery = void 0;
17
+ const type_graphql_1 = require("type-graphql");
18
+ const typeorm_1 = require("typeorm");
19
+ const auth_base_1 = require("@things-factory/auth-base");
20
+ const shell_1 = require("@things-factory/shell");
21
+ const data_item_1 = require("../data-item/data-item");
22
+ const data_set_1 = require("./data-set");
23
+ const data_set_type_1 = require("./data-set-type");
24
+ let DataSetQuery = class DataSetQuery {
25
+ async dataSet(id, context) {
26
+ const { domain } = context.state;
27
+ return await (0, typeorm_1.getRepository)(data_set_1.DataSet).findOne({
28
+ where: { domain, id }
29
+ });
30
+ }
31
+ async dataSets(params, context) {
32
+ const { domain } = context.state;
33
+ const convertedParams = (0, shell_1.convertListParams)(params, domain.id);
34
+ const [items, total] = await (0, typeorm_1.getRepository)(data_set_1.DataSet).findAndCount(convertedParams);
35
+ return { items, total };
36
+ }
37
+ async dataItems(dataSet) {
38
+ return await (0, typeorm_1.getRepository)(data_item_1.DataItem).find({
39
+ dataSet
40
+ });
41
+ }
42
+ async domain(dataSet) {
43
+ return await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(dataSet.domainId);
44
+ }
45
+ async updater(dataSet) {
46
+ return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(dataSet.updaterId);
47
+ }
48
+ async creator(dataSet) {
49
+ return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(dataSet.creatorId);
50
+ }
51
+ };
52
+ __decorate([
53
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "query", domainOwnerGranted: true)'),
54
+ (0, type_graphql_1.Query)(returns => data_set_1.DataSet, { description: 'To fetch a DataSet' }),
55
+ __param(0, (0, type_graphql_1.Arg)('id')),
56
+ __param(1, (0, type_graphql_1.Ctx)()),
57
+ __metadata("design:type", Function),
58
+ __metadata("design:paramtypes", [String, Object]),
59
+ __metadata("design:returntype", Promise)
60
+ ], DataSetQuery.prototype, "dataSet", null);
61
+ __decorate([
62
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "query", domainOwnerGranted: true)'),
63
+ (0, type_graphql_1.Query)(returns => data_set_type_1.DataSetList, { description: 'To fetch multiple DataSets' }),
64
+ __param(0, (0, type_graphql_1.Args)()),
65
+ __param(1, (0, type_graphql_1.Ctx)()),
66
+ __metadata("design:type", Function),
67
+ __metadata("design:paramtypes", [typeof (_a = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _a : Object, Object]),
68
+ __metadata("design:returntype", Promise)
69
+ ], DataSetQuery.prototype, "dataSets", null);
70
+ __decorate([
71
+ (0, type_graphql_1.FieldResolver)(type => [data_item_1.DataItem]),
72
+ __param(0, (0, type_graphql_1.Root)()),
73
+ __metadata("design:type", Function),
74
+ __metadata("design:paramtypes", [data_set_1.DataSet]),
75
+ __metadata("design:returntype", Promise)
76
+ ], DataSetQuery.prototype, "dataItems", null);
77
+ __decorate([
78
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
79
+ __param(0, (0, type_graphql_1.Root)()),
80
+ __metadata("design:type", Function),
81
+ __metadata("design:paramtypes", [data_set_1.DataSet]),
82
+ __metadata("design:returntype", Promise)
83
+ ], DataSetQuery.prototype, "domain", null);
84
+ __decorate([
85
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
86
+ __param(0, (0, type_graphql_1.Root)()),
87
+ __metadata("design:type", Function),
88
+ __metadata("design:paramtypes", [data_set_1.DataSet]),
89
+ __metadata("design:returntype", Promise)
90
+ ], DataSetQuery.prototype, "updater", null);
91
+ __decorate([
92
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
93
+ __param(0, (0, type_graphql_1.Root)()),
94
+ __metadata("design:type", Function),
95
+ __metadata("design:paramtypes", [data_set_1.DataSet]),
96
+ __metadata("design:returntype", Promise)
97
+ ], DataSetQuery.prototype, "creator", null);
98
+ DataSetQuery = __decorate([
99
+ (0, type_graphql_1.Resolver)(data_set_1.DataSet)
100
+ ], DataSetQuery);
101
+ exports.DataSetQuery = DataSetQuery;
102
+ //# sourceMappingURL=data-set-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-set-query.js","sourceRoot":"","sources":["../../../server/service/data-set/data-set-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA8F;AAC9F,qCAAuC;AAEvC,yDAAgD;AAChD,iDAA4E;AAE5E,sDAAiD;AACjD,yCAAoC;AACpC,mDAA6C;AAG7C,IAAa,YAAY,GAAzB,MAAa,YAAY;IAGvB,KAAK,CAAC,OAAO,CAAY,EAAU,EAAS,OAAY;QACtD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,uBAAa,EAAC,kBAAO,CAAC,CAAC,OAAO,CAAC;YAC1C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;SACtB,CAAC,CAAA;IACJ,CAAC;IAID,KAAK,CAAC,QAAQ,CAAS,MAAiB,EAAS,OAAY;QAC3D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,EAAE,MAAM,CAA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,GAAE,CAAA;IAAqB,WAAA,IAAA,kBAAG,GAAE,CAAA;;yDAAjB,iBAAS,oBAAT,iBAAS;;4CAOvC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,oBAAQ,CAAC,CAAC;IACjB,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAU,kBAAO;;6CAIvC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAU,kBAAO;;0CAEpC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAU,kBAAO;;2CAErC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAU,kBAAO;;2CAErC;AA1CU,YAAY;IADxB,IAAA,uBAAQ,EAAC,kBAAO,CAAC;GACL,YAAY,CA2CxB;AA3CY,oCAAY"}
@@ -0,0 +1,89 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DataSetList = exports.DataSetPatch = exports.NewDataSet = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const data_set_1 = require("./data-set");
15
+ let NewDataSet = class NewDataSet {
16
+ };
17
+ __decorate([
18
+ (0, type_graphql_1.Field)(),
19
+ __metadata("design:type", String)
20
+ ], NewDataSet.prototype, "name", void 0);
21
+ __decorate([
22
+ (0, type_graphql_1.Field)({ nullable: true }),
23
+ __metadata("design:type", String)
24
+ ], NewDataSet.prototype, "description", void 0);
25
+ __decorate([
26
+ (0, type_graphql_1.Field)({ nullable: true }),
27
+ __metadata("design:type", Boolean)
28
+ ], NewDataSet.prototype, "active", void 0);
29
+ __decorate([
30
+ (0, type_graphql_1.Field)({ nullable: true }),
31
+ __metadata("design:type", String)
32
+ ], NewDataSet.prototype, "schedule", void 0);
33
+ __decorate([
34
+ (0, type_graphql_1.Field)({ nullable: true }),
35
+ __metadata("design:type", String)
36
+ ], NewDataSet.prototype, "timezone", void 0);
37
+ NewDataSet = __decorate([
38
+ (0, type_graphql_1.InputType)()
39
+ ], NewDataSet);
40
+ exports.NewDataSet = NewDataSet;
41
+ let DataSetPatch = class DataSetPatch {
42
+ };
43
+ __decorate([
44
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
45
+ __metadata("design:type", String)
46
+ ], DataSetPatch.prototype, "id", void 0);
47
+ __decorate([
48
+ (0, type_graphql_1.Field)({ nullable: true }),
49
+ __metadata("design:type", String)
50
+ ], DataSetPatch.prototype, "name", void 0);
51
+ __decorate([
52
+ (0, type_graphql_1.Field)({ nullable: true }),
53
+ __metadata("design:type", String)
54
+ ], DataSetPatch.prototype, "description", void 0);
55
+ __decorate([
56
+ (0, type_graphql_1.Field)({ nullable: true }),
57
+ __metadata("design:type", Boolean)
58
+ ], DataSetPatch.prototype, "active", void 0);
59
+ __decorate([
60
+ (0, type_graphql_1.Field)({ nullable: true }),
61
+ __metadata("design:type", String)
62
+ ], DataSetPatch.prototype, "schedule", void 0);
63
+ __decorate([
64
+ (0, type_graphql_1.Field)({ nullable: true }),
65
+ __metadata("design:type", String)
66
+ ], DataSetPatch.prototype, "timezone", void 0);
67
+ __decorate([
68
+ (0, type_graphql_1.Field)(),
69
+ __metadata("design:type", String)
70
+ ], DataSetPatch.prototype, "cuFlag", void 0);
71
+ DataSetPatch = __decorate([
72
+ (0, type_graphql_1.InputType)()
73
+ ], DataSetPatch);
74
+ exports.DataSetPatch = DataSetPatch;
75
+ let DataSetList = class DataSetList {
76
+ };
77
+ __decorate([
78
+ (0, type_graphql_1.Field)(type => [data_set_1.DataSet]),
79
+ __metadata("design:type", Array)
80
+ ], DataSetList.prototype, "items", void 0);
81
+ __decorate([
82
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
83
+ __metadata("design:type", Number)
84
+ ], DataSetList.prototype, "total", void 0);
85
+ DataSetList = __decorate([
86
+ (0, type_graphql_1.ObjectType)()
87
+ ], DataSetList);
88
+ exports.DataSetList = DataSetList;
89
+ //# sourceMappingURL=data-set-type.js.map
@@ -0,0 +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;CAetB,CAAA;AAbC;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;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACT;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACT;AAdN,UAAU;IADtB,IAAA,wBAAS,GAAE;GACC,UAAU,CAetB;AAfY,gCAAU;AAkBvB,IAAa,YAAY,GAAzB,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