@things-factory/dataset 4.3.0-alpha.0

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 (114) 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 +394 -0
  9. package/client/route.js +11 -0
  10. package/dist-server/controllers/create-data-sample.js +133 -0
  11. package/dist-server/controllers/create-data-sample.js.map +1 -0
  12. package/dist-server/controllers/data-use-case.js +57 -0
  13. package/dist-server/controllers/data-use-case.js.map +1 -0
  14. package/dist-server/controllers/index.js +1 -0
  15. package/dist-server/controllers/index.js.map +1 -0
  16. package/dist-server/index.js +21 -0
  17. package/dist-server/index.js.map +1 -0
  18. package/dist-server/middlewares/index.js +8 -0
  19. package/dist-server/middlewares/index.js.map +1 -0
  20. package/dist-server/migrations/index.js +12 -0
  21. package/dist-server/migrations/index.js.map +1 -0
  22. package/dist-server/routes.js +25 -0
  23. package/dist-server/routes.js.map +1 -0
  24. package/dist-server/service/data-item/data-item-mutation.js +69 -0
  25. package/dist-server/service/data-item/data-item-mutation.js.map +1 -0
  26. package/dist-server/service/data-item/data-item-query.js +100 -0
  27. package/dist-server/service/data-item/data-item-query.js.map +1 -0
  28. package/dist-server/service/data-item/data-item-type.js +80 -0
  29. package/dist-server/service/data-item/data-item-type.js.map +1 -0
  30. package/dist-server/service/data-item/data-item.js +136 -0
  31. package/dist-server/service/data-item/data-item.js.map +1 -0
  32. package/dist-server/service/data-item/index.js +9 -0
  33. package/dist-server/service/data-item/index.js.map +1 -0
  34. package/dist-server/service/data-ooc/data-ooc-mutation.js +92 -0
  35. package/dist-server/service/data-ooc/data-ooc-mutation.js.map +1 -0
  36. package/dist-server/service/data-ooc/data-ooc-query.js +120 -0
  37. package/dist-server/service/data-ooc/data-ooc-query.js.map +1 -0
  38. package/dist-server/service/data-ooc/data-ooc-subscription.js +65 -0
  39. package/dist-server/service/data-ooc/data-ooc-subscription.js.map +1 -0
  40. package/dist-server/service/data-ooc/data-ooc-type.js +107 -0
  41. package/dist-server/service/data-ooc/data-ooc-type.js.map +1 -0
  42. package/dist-server/service/data-ooc/data-ooc.js +237 -0
  43. package/dist-server/service/data-ooc/data-ooc.js.map +1 -0
  44. package/dist-server/service/data-ooc/index.js +10 -0
  45. package/dist-server/service/data-ooc/index.js.map +1 -0
  46. package/dist-server/service/data-sample/data-sample-mutation.js +142 -0
  47. package/dist-server/service/data-sample/data-sample-mutation.js.map +1 -0
  48. package/dist-server/service/data-sample/data-sample-query.js +100 -0
  49. package/dist-server/service/data-sample/data-sample-query.js.map +1 -0
  50. package/dist-server/service/data-sample/data-sample-type.js +82 -0
  51. package/dist-server/service/data-sample/data-sample-type.js.map +1 -0
  52. package/dist-server/service/data-sample/data-sample.js +105 -0
  53. package/dist-server/service/data-sample/data-sample.js.map +1 -0
  54. package/dist-server/service/data-sample/index.js +9 -0
  55. package/dist-server/service/data-sample/index.js.map +1 -0
  56. package/dist-server/service/data-sensor/data-sensor-mutation.js +120 -0
  57. package/dist-server/service/data-sensor/data-sensor-mutation.js.map +1 -0
  58. package/dist-server/service/data-sensor/data-sensor-query.js +113 -0
  59. package/dist-server/service/data-sensor/data-sensor-query.js.map +1 -0
  60. package/dist-server/service/data-sensor/data-sensor-type.js +147 -0
  61. package/dist-server/service/data-sensor/data-sensor-type.js.map +1 -0
  62. package/dist-server/service/data-sensor/data-sensor.js +168 -0
  63. package/dist-server/service/data-sensor/data-sensor.js.map +1 -0
  64. package/dist-server/service/data-sensor/index.js +9 -0
  65. package/dist-server/service/data-sensor/index.js.map +1 -0
  66. package/dist-server/service/data-set/data-set-mutation.js +216 -0
  67. package/dist-server/service/data-set/data-set-mutation.js.map +1 -0
  68. package/dist-server/service/data-set/data-set-query.js +102 -0
  69. package/dist-server/service/data-set/data-set-query.js.map +1 -0
  70. package/dist-server/service/data-set/data-set-type.js +77 -0
  71. package/dist-server/service/data-set/data-set-type.js.map +1 -0
  72. package/dist-server/service/data-set/data-set.js +103 -0
  73. package/dist-server/service/data-set/data-set.js.map +1 -0
  74. package/dist-server/service/data-set/index.js +9 -0
  75. package/dist-server/service/data-set/index.js.map +1 -0
  76. package/dist-server/service/data-spec/data-spec-manager.js +20 -0
  77. package/dist-server/service/data-spec/data-spec-manager.js.map +1 -0
  78. package/dist-server/service/data-spec/data-spec-query.js +48 -0
  79. package/dist-server/service/data-spec/data-spec-query.js.map +1 -0
  80. package/dist-server/service/data-spec/data-spec.js +78 -0
  81. package/dist-server/service/data-spec/data-spec.js.map +1 -0
  82. package/dist-server/service/data-spec/index.js +8 -0
  83. package/dist-server/service/data-spec/index.js.map +1 -0
  84. package/dist-server/service/index.js +40 -0
  85. package/dist-server/service/index.js.map +1 -0
  86. package/package.json +38 -0
  87. package/server/controllers/index.ts +0 -0
  88. package/server/index.ts +5 -0
  89. package/server/middlewares/index.ts +3 -0
  90. package/server/migrations/index.ts +9 -0
  91. package/server/routes.ts +28 -0
  92. package/server/service/data-item/data-item-mutation.ts +56 -0
  93. package/server/service/data-item/data-item-query.ts +53 -0
  94. package/server/service/data-item/data-item-type.ts +50 -0
  95. package/server/service/data-item/data-item.ts +113 -0
  96. package/server/service/data-item/index.ts +6 -0
  97. package/server/service/data-sample/data-sample-mutation.ts +137 -0
  98. package/server/service/data-sample/data-sample-query.ts +53 -0
  99. package/server/service/data-sample/data-sample-type.ts +50 -0
  100. package/server/service/data-sample/data-sample.ts +84 -0
  101. package/server/service/data-sample/index.ts +6 -0
  102. package/server/service/data-set/data-set-mutation.ts +209 -0
  103. package/server/service/data-set/data-set-query.ts +55 -0
  104. package/server/service/data-set/data-set-type.ts +45 -0
  105. package/server/service/data-set/data-set.ts +84 -0
  106. package/server/service/data-set/index.ts +6 -0
  107. package/server/service/index.ts +25 -0
  108. package/things-factory.config.js +17 -0
  109. package/translations/en.json +8 -0
  110. package/translations/ko.json +8 -0
  111. package/translations/ms.json +8 -0
  112. package/translations/zh.json +8 -0
  113. package/tsconfig.json +9 -0
  114. package/yarn-error.log +23244 -0
@@ -0,0 +1,25 @@
1
+ const debug = require('debug')('things-factory:dataset:routes');
2
+ process.on('bootstrap-module-global-public-route', (app, globalPublicRouter) => {
3
+ /*
4
+ * can add global public routes to application (auth not required, tenancy not required)
5
+ *
6
+ * ex) routes.get('/path', async(context, next) => {})
7
+ * ex) routes.post('/path', async(context, next) => {})
8
+ */
9
+ });
10
+ process.on('bootstrap-module-global-private-route', (app, globalPrivateRouter) => {
11
+ /*
12
+ * can add global private routes to application (auth required, tenancy not required)
13
+ */
14
+ });
15
+ process.on('bootstrap-module-domain-public-route', (app, domainPublicRouter) => {
16
+ /*
17
+ * can add domain public routes to application (auth not required, tenancy required)
18
+ */
19
+ });
20
+ process.on('bootstrap-module-domain-private-route', (app, domainPrivateRouter) => {
21
+ /*
22
+ * can add domain private routes to application (auth required, tenancy required)
23
+ */
24
+ });
25
+ //# sourceMappingURL=routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,+BAA+B,CAAC,CAAA;AAE/D,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;;;;OAKG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA"}
@@ -0,0 +1,69 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.DataItemMutation = void 0;
16
+ const type_graphql_1 = require("type-graphql");
17
+ const typeorm_1 = require("typeorm");
18
+ const data_set_1 = require("../data-set/data-set");
19
+ const data_item_1 = require("./data-item");
20
+ const data_item_type_1 = require("./data-item-type");
21
+ let DataItemMutation = class DataItemMutation {
22
+ async updateMultipleDataItem(dataSetId, patches, context) {
23
+ const { domain, user, tx } = context.state;
24
+ let results = [];
25
+ const dataItemRepo = tx.getRepository(data_item_1.DataItem);
26
+ const dataSet = await tx.getRepository(data_set_1.DataSet).findOne(dataSetId);
27
+ await dataItemRepo.delete({ domain, dataSet: dataSetId });
28
+ for (let i = 0; i < patches.length; i++) {
29
+ const result = await dataItemRepo.save(Object.assign(Object.assign({ quota: 1 }, patches[i]), { sequence: i, dataSet,
30
+ domain, creator: user, updater: user }));
31
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
32
+ }
33
+ return results;
34
+ }
35
+ async deleteDataItems(ids, context) {
36
+ const { domain, tx } = context.state;
37
+ await tx.getRepository(data_item_1.DataItem).delete({
38
+ domain,
39
+ id: (0, typeorm_1.In)(ids)
40
+ });
41
+ return true;
42
+ }
43
+ };
44
+ __decorate([
45
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)'),
46
+ (0, type_graphql_1.Directive)('@transaction'),
47
+ (0, type_graphql_1.Mutation)(returns => [data_item_1.DataItem], { description: "To modify multiple DataItems' information" }),
48
+ __param(0, (0, type_graphql_1.Arg)('dataSetId')),
49
+ __param(1, (0, type_graphql_1.Arg)('patches', type => [data_item_type_1.DataItemPatch])),
50
+ __param(2, (0, type_graphql_1.Ctx)()),
51
+ __metadata("design:type", Function),
52
+ __metadata("design:paramtypes", [String, Array, Object]),
53
+ __metadata("design:returntype", Promise)
54
+ ], DataItemMutation.prototype, "updateMultipleDataItem", null);
55
+ __decorate([
56
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)'),
57
+ (0, type_graphql_1.Directive)('@transaction'),
58
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple dataItems' }),
59
+ __param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
60
+ __param(1, (0, type_graphql_1.Ctx)()),
61
+ __metadata("design:type", Function),
62
+ __metadata("design:paramtypes", [Array, Object]),
63
+ __metadata("design:returntype", Promise)
64
+ ], DataItemMutation.prototype, "deleteDataItems", null);
65
+ DataItemMutation = __decorate([
66
+ (0, type_graphql_1.Resolver)(data_item_1.DataItem)
67
+ ], DataItemMutation);
68
+ exports.DataItemMutation = DataItemMutation;
69
+ //# sourceMappingURL=data-item-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-item-mutation.js","sourceRoot":"","sources":["../../../server/service/data-item/data-item-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsE;AACtE,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A;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA;AA3CC;IAHC,IAAA,wBAAS,EAAC,mFAAmF,CAAC;IAC9F,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,oBAAQ,CAAC,EAAE,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;IAE3F,WAAA,IAAA,kBAAG,EAAC,WAAW,CAAC,CAAA;IAChB,WAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,8BAAa,CAAC,CAAC,CAAA;IACvC,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DAyBP;AAKD;IAHC,IAAA,wBAAS,EAAC,mFAAmF,CAAC;IAC9F,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IACvD,WAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDASxE;AA9CU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,oBAAQ,CAAC;GACN,gBAAgB,CA+C5B;AA/CY,4CAAgB"}
@@ -0,0 +1,100 @@
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 _a;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.DataItemQuery = 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_set_1 = require("../data-set/data-set");
22
+ const data_item_1 = require("./data-item");
23
+ const data_item_type_1 = require("./data-item-type");
24
+ let DataItemQuery = class DataItemQuery {
25
+ async dataItem(id, context) {
26
+ const { domain } = context.state;
27
+ return await (0, typeorm_1.getRepository)(data_item_1.DataItem).findOne({
28
+ where: { domain, id }
29
+ });
30
+ }
31
+ async dataItems(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_item_1.DataItem).findAndCount(convertedParams);
35
+ return { items, total };
36
+ }
37
+ async dataSet(dataItem) {
38
+ return await (0, typeorm_1.getRepository)(data_set_1.DataSet).findOne(dataItem.dataSetId);
39
+ }
40
+ async domain(dataItem) {
41
+ return await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(dataItem.domainId);
42
+ }
43
+ async updater(dataItem) {
44
+ return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(dataItem.updaterId);
45
+ }
46
+ async creator(dataItem) {
47
+ return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(dataItem.creatorId);
48
+ }
49
+ };
50
+ __decorate([
51
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "query", domainOwnerGranted: true)'),
52
+ (0, type_graphql_1.Query)(returns => data_item_1.DataItem, { description: 'To fetch a DataItem' }),
53
+ __param(0, (0, type_graphql_1.Arg)('id')),
54
+ __param(1, (0, type_graphql_1.Ctx)()),
55
+ __metadata("design:type", Function),
56
+ __metadata("design:paramtypes", [String, Object]),
57
+ __metadata("design:returntype", Promise)
58
+ ], DataItemQuery.prototype, "dataItem", null);
59
+ __decorate([
60
+ (0, type_graphql_1.Directive)('@privilege(category: "data-set", privilege: "query", domainOwnerGranted: true)'),
61
+ (0, type_graphql_1.Query)(returns => data_item_type_1.DataItemList, { description: 'To fetch multiple DataItems' }),
62
+ __param(0, (0, type_graphql_1.Args)()),
63
+ __param(1, (0, type_graphql_1.Ctx)()),
64
+ __metadata("design:type", Function),
65
+ __metadata("design:paramtypes", [typeof (_a = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _a : Object, Object]),
66
+ __metadata("design:returntype", Promise)
67
+ ], DataItemQuery.prototype, "dataItems", null);
68
+ __decorate([
69
+ (0, type_graphql_1.FieldResolver)(type => data_set_1.DataSet),
70
+ __param(0, (0, type_graphql_1.Root)()),
71
+ __metadata("design:type", Function),
72
+ __metadata("design:paramtypes", [data_item_1.DataItem]),
73
+ __metadata("design:returntype", Promise)
74
+ ], DataItemQuery.prototype, "dataSet", null);
75
+ __decorate([
76
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
77
+ __param(0, (0, type_graphql_1.Root)()),
78
+ __metadata("design:type", Function),
79
+ __metadata("design:paramtypes", [data_item_1.DataItem]),
80
+ __metadata("design:returntype", Promise)
81
+ ], DataItemQuery.prototype, "domain", null);
82
+ __decorate([
83
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
84
+ __param(0, (0, type_graphql_1.Root)()),
85
+ __metadata("design:type", Function),
86
+ __metadata("design:paramtypes", [data_item_1.DataItem]),
87
+ __metadata("design:returntype", Promise)
88
+ ], DataItemQuery.prototype, "updater", null);
89
+ __decorate([
90
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
91
+ __param(0, (0, type_graphql_1.Root)()),
92
+ __metadata("design:type", Function),
93
+ __metadata("design:paramtypes", [data_item_1.DataItem]),
94
+ __metadata("design:returntype", Promise)
95
+ ], DataItemQuery.prototype, "creator", null);
96
+ DataItemQuery = __decorate([
97
+ (0, type_graphql_1.Resolver)(data_item_1.DataItem)
98
+ ], DataItemQuery);
99
+ exports.DataItemQuery = DataItemQuery;
100
+ //# sourceMappingURL=data-item-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-item-query.js","sourceRoot":"","sources":["../../../server/service/data-item/data-item-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA8F;AAC9F,qCAAuC;AAEvC,yDAAgD;AAChD,iDAA4E;AAE5E,mDAA8C;AAC9C,2CAAsC;AACtC,qDAA+C;AAG/C,IAAa,aAAa,GAA1B,MAAa,aAAa;IAGxB,KAAK,CAAC,QAAQ,CAAY,EAAU,EAAS,OAAY;QACvD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,uBAAa,EAAC,oBAAQ,CAAC,CAAC,OAAO,CAAC;YAC3C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;SACtB,CAAC,CAAA;IACJ,CAAC;IAID,KAAK,CAAC,SAAS,CAAS,MAAiB,EAAS,OAAY;QAC5D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;QAC5D,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,IAAA,uBAAa,EAAC,oBAAQ,CAAC,CAAC,YAAY,CAAC,eAAe,CAAC,CAAA;QAElF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAGD,KAAK,CAAC,OAAO,CAAS,QAAkB;QACtC,OAAO,MAAM,IAAA,uBAAa,EAAC,kBAAO,CAAC,CAAC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ChB,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAW,oBAAQ;;2CAEtC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAW,oBAAQ;;4CAEvC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAW,oBAAQ;;4CAEvC;AAxCU,aAAa;IADzB,IAAA,uBAAQ,EAAC,oBAAQ,CAAC;GACN,aAAa,CAyCzB;AAzCY,sCAAa"}
@@ -0,0 +1,80 @@
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.DataItemList = exports.DataItemPatch = void 0;
13
+ const type_graphql_1 = require("type-graphql");
14
+ const shell_1 = require("@things-factory/shell");
15
+ const data_item_1 = require("./data-item");
16
+ let DataItemPatch = class DataItemPatch {
17
+ };
18
+ __decorate([
19
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
20
+ __metadata("design:type", String)
21
+ ], DataItemPatch.prototype, "id", void 0);
22
+ __decorate([
23
+ (0, type_graphql_1.Field)({ nullable: true }),
24
+ __metadata("design:type", String)
25
+ ], DataItemPatch.prototype, "dataSetId", void 0);
26
+ __decorate([
27
+ (0, type_graphql_1.Field)({ nullable: true }),
28
+ __metadata("design:type", String)
29
+ ], DataItemPatch.prototype, "name", void 0);
30
+ __decorate([
31
+ (0, type_graphql_1.Field)({ nullable: true }),
32
+ __metadata("design:type", String)
33
+ ], DataItemPatch.prototype, "description", void 0);
34
+ __decorate([
35
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
36
+ __metadata("design:type", Number)
37
+ ], DataItemPatch.prototype, "sequence", void 0);
38
+ __decorate([
39
+ (0, type_graphql_1.Field)(type => data_item_1.DataItemType, { nullable: true }),
40
+ __metadata("design:type", String)
41
+ ], DataItemPatch.prototype, "type", void 0);
42
+ __decorate([
43
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
44
+ __metadata("design:type", Number)
45
+ ], DataItemPatch.prototype, "quota", void 0);
46
+ __decorate([
47
+ (0, type_graphql_1.Field)({ nullable: true }),
48
+ __metadata("design:type", String)
49
+ ], DataItemPatch.prototype, "options", void 0);
50
+ __decorate([
51
+ (0, type_graphql_1.Field)({ nullable: true }),
52
+ __metadata("design:type", Boolean)
53
+ ], DataItemPatch.prototype, "active", void 0);
54
+ __decorate([
55
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
56
+ __metadata("design:type", Object)
57
+ ], DataItemPatch.prototype, "spec", void 0);
58
+ __decorate([
59
+ (0, type_graphql_1.Field)({ nullable: true }),
60
+ __metadata("design:type", String)
61
+ ], DataItemPatch.prototype, "cuFlag", void 0);
62
+ DataItemPatch = __decorate([
63
+ (0, type_graphql_1.InputType)()
64
+ ], DataItemPatch);
65
+ exports.DataItemPatch = DataItemPatch;
66
+ let DataItemList = class DataItemList {
67
+ };
68
+ __decorate([
69
+ (0, type_graphql_1.Field)(type => [data_item_1.DataItem]),
70
+ __metadata("design:type", Array)
71
+ ], DataItemList.prototype, "items", void 0);
72
+ __decorate([
73
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
74
+ __metadata("design:type", Number)
75
+ ], DataItemList.prototype, "total", void 0);
76
+ DataItemList = __decorate([
77
+ (0, type_graphql_1.ObjectType)()
78
+ ], DataItemList);
79
+ exports.DataItemList = DataItemList;
80
+ //# sourceMappingURL=data-item-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-item-type.js","sourceRoot":"","sources":["../../../server/service/data-item/data-item-type.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAoE;AAEpE,iDAAoD;AAEpD,2CAAoD;AAGpD,IAAa,aAAa,GAA1B,MAAa,aAAa;CAiCzB,CAAA;AA/BC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC3B;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACR;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACtB;AAGjB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,wBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC7B;AAGnB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACzB;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACnC;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACX;AAhCJ,aAAa;IADzB,IAAA,wBAAS,GAAE;GACC,aAAa,CAiCzB;AAjCY,sCAAa;AAoC1B,IAAa,YAAY,GAAzB,MAAa,YAAY;CAMxB,CAAA;AAJC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,oBAAQ,CAAC,CAAC;;2CACT;AAGjB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;2CACN;AALF,YAAY;IADxB,IAAA,yBAAU,GAAE;GACA,YAAY,CAMxB;AANY,oCAAY"}
@@ -0,0 +1,136 @@
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.DataItem = exports.DataItemType = 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
+ var DataItemType;
20
+ (function (DataItemType) {
21
+ DataItemType["number"] = "number";
22
+ DataItemType["text"] = "text";
23
+ DataItemType["boolean"] = "boolean";
24
+ DataItemType["select"] = "select";
25
+ })(DataItemType = exports.DataItemType || (exports.DataItemType = {}));
26
+ (0, type_graphql_1.registerEnumType)(DataItemType, {
27
+ name: 'DataItemType',
28
+ description: 'state enumeration of a data-item'
29
+ });
30
+ let DataItem = class DataItem {
31
+ };
32
+ __decorate([
33
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
34
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
35
+ __metadata("design:type", String)
36
+ ], DataItem.prototype, "id", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
39
+ (0, type_graphql_1.Field)({ nullable: true }),
40
+ __metadata("design:type", typeof (_a = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _a : Object)
41
+ ], DataItem.prototype, "domain", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.RelationId)((dataItem) => dataItem.domain),
44
+ __metadata("design:type", String)
45
+ ], DataItem.prototype, "domainId", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)(),
48
+ (0, type_graphql_1.Field)(),
49
+ __metadata("design:type", String)
50
+ ], DataItem.prototype, "name", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({
53
+ nullable: true
54
+ }),
55
+ (0, type_graphql_1.Field)({ nullable: true }),
56
+ __metadata("design:type", String)
57
+ ], DataItem.prototype, "description", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.ManyToOne)(type => data_set_1.DataSet, dataSet => dataSet.dataItems, { onDelete: 'CASCADE' }),
60
+ (0, type_graphql_1.Field)(type => data_set_1.DataSet, { nullable: true }),
61
+ __metadata("design:type", data_set_1.DataSet)
62
+ ], DataItem.prototype, "dataSet", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.RelationId)((dataItem) => dataItem.dataSet),
65
+ __metadata("design:type", String)
66
+ ], DataItem.prototype, "dataSetId", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.Column)(),
69
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
70
+ __metadata("design:type", Number)
71
+ ], DataItem.prototype, "sequence", 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", Boolean)
78
+ ], DataItem.prototype, "active", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.Column)({
81
+ nullable: true
82
+ }),
83
+ (0, type_graphql_1.Field)({ nullable: true }),
84
+ __metadata("design:type", String)
85
+ ], DataItem.prototype, "type", void 0);
86
+ __decorate([
87
+ (0, typeorm_1.Column)({
88
+ nullable: true
89
+ }),
90
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
91
+ __metadata("design:type", Number)
92
+ ], DataItem.prototype, "quota", void 0);
93
+ __decorate([
94
+ (0, typeorm_1.Column)('simple-json', { nullable: true }),
95
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
96
+ __metadata("design:type", Object)
97
+ ], DataItem.prototype, "spec", void 0);
98
+ __decorate([
99
+ (0, typeorm_1.CreateDateColumn)(),
100
+ (0, type_graphql_1.Field)({ nullable: true }),
101
+ __metadata("design:type", Date)
102
+ ], DataItem.prototype, "createdAt", void 0);
103
+ __decorate([
104
+ (0, typeorm_1.UpdateDateColumn)(),
105
+ (0, type_graphql_1.Field)({ nullable: true }),
106
+ __metadata("design:type", Date)
107
+ ], DataItem.prototype, "updatedAt", void 0);
108
+ __decorate([
109
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
110
+ nullable: true
111
+ }),
112
+ (0, type_graphql_1.Field)({ nullable: true }),
113
+ __metadata("design:type", typeof (_b = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _b : Object)
114
+ ], DataItem.prototype, "creator", void 0);
115
+ __decorate([
116
+ (0, typeorm_1.RelationId)((dataItem) => dataItem.creator),
117
+ __metadata("design:type", String)
118
+ ], DataItem.prototype, "creatorId", void 0);
119
+ __decorate([
120
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
121
+ nullable: true
122
+ }),
123
+ (0, type_graphql_1.Field)({ nullable: true }),
124
+ __metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
125
+ ], DataItem.prototype, "updater", void 0);
126
+ __decorate([
127
+ (0, typeorm_1.RelationId)((dataItem) => dataItem.creator),
128
+ __metadata("design:type", String)
129
+ ], DataItem.prototype, "updaterId", void 0);
130
+ DataItem = __decorate([
131
+ (0, typeorm_1.Entity)(),
132
+ (0, typeorm_1.Index)('ix_data_item_0', (dataItem) => [dataItem.domain, dataItem.dataSet, dataItem.name], { unique: true }),
133
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for DataItem' })
134
+ ], DataItem);
135
+ exports.DataItem = DataItem;
136
+ //# sourceMappingURL=data-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-item.js","sourceRoot":"","sources":["../../../server/service/data-item/data-item.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAA2E;AAC3E,qCASgB;AAEhB,yDAAgD;AAChD,iDAA4D;AAE5D,mDAA8C;AAE9C,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,6BAAa,CAAA;IACb,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;AACnB,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAKvB;AAED,IAAA,+BAAgB,EAAC,YAAY,EAAE;IAC7B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,kCAAkC;CAChD,CAAC,CAAA;AAKF,IAAa,QAAQ,GAArB,MAAa,QAAQ;CAgFpB,CAAA;AA7EC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,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C,OAAO,CAAC;;2CACnC;AA/EP,QAAQ;IAHpB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,gBAAgB,EAAE,CAAC,QAAkB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACrH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;GACtC,QAAQ,CAgFpB;AAhFY,4BAAQ"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolvers = exports.entities = void 0;
4
+ const data_item_1 = require("./data-item");
5
+ const data_item_query_1 = require("./data-item-query");
6
+ const data_item_mutation_1 = require("./data-item-mutation");
7
+ exports.entities = [data_item_1.DataItem];
8
+ exports.resolvers = [data_item_query_1.DataItemQuery, data_item_mutation_1.DataItemMutation];
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/data-item/index.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AACtC,uDAAiD;AACjD,6DAAuD;AAE1C,QAAA,QAAQ,GAAG,CAAC,oBAAQ,CAAC,CAAA;AACrB,QAAA,SAAS,GAAG,CAAC,+BAAa,EAAE,qCAAgB,CAAC,CAAA"}
@@ -0,0 +1,92 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.DataOocMutation = void 0;
16
+ const type_graphql_1 = require("type-graphql");
17
+ const data_ooc_1 = require("./data-ooc");
18
+ const data_ooc_type_1 = require("./data-ooc-type");
19
+ let DataOocMutation = class DataOocMutation {
20
+ async createDataOoc(dataOoc, context) {
21
+ const { domain, user, tx } = context.state;
22
+ const state = dataOoc.state || data_ooc_1.DataOocStatus.CREATED;
23
+ const history = [
24
+ {
25
+ user: {
26
+ id: user.id,
27
+ name: user.name
28
+ },
29
+ state,
30
+ timestamp: Date.now()
31
+ }
32
+ ];
33
+ return await tx.getRepository(data_ooc_1.DataOoc).save(Object.assign(Object.assign({}, dataOoc), { state,
34
+ domain,
35
+ history, creator: user, updater: user }));
36
+ }
37
+ async updateDataOoc(id, patch, context) {
38
+ const { domain, user, tx } = context.state;
39
+ const repository = tx.getRepository(data_ooc_1.DataOoc);
40
+ const dataOoc = await repository.findOne({
41
+ where: { domain, id }
42
+ });
43
+ const state = patch.state || dataOoc.state;
44
+ const history = dataOoc.history || [];
45
+ history.push({
46
+ user: {
47
+ id: user.id,
48
+ name: user.name
49
+ },
50
+ state,
51
+ comment: patch.correctiveAction || '',
52
+ timestamp: Date.now()
53
+ });
54
+ const more = {};
55
+ if (dataOoc.state !== patch.state) {
56
+ if (patch.state === data_ooc_1.DataOocStatus.CORRECTED) {
57
+ more.corrector = user;
58
+ }
59
+ else {
60
+ more.corrector = null;
61
+ }
62
+ }
63
+ return await repository.save(Object.assign(Object.assign(Object.assign(Object.assign({}, dataOoc), patch), more), { state,
64
+ history, updater: user }));
65
+ }
66
+ };
67
+ __decorate([
68
+ (0, type_graphql_1.Directive)('@privilege(category: "data-ooc", privilege: "mutation", domainOwnerGranted: true)'),
69
+ (0, type_graphql_1.Directive)('@transaction'),
70
+ (0, type_graphql_1.Mutation)(returns => data_ooc_1.DataOoc, { description: 'To create new DataOoc' }),
71
+ __param(0, (0, type_graphql_1.Arg)('dataOoc')),
72
+ __param(1, (0, type_graphql_1.Ctx)()),
73
+ __metadata("design:type", Function),
74
+ __metadata("design:paramtypes", [data_ooc_type_1.NewDataOoc, Object]),
75
+ __metadata("design:returntype", Promise)
76
+ ], DataOocMutation.prototype, "createDataOoc", null);
77
+ __decorate([
78
+ (0, type_graphql_1.Directive)('@privilege(category: "data-ooc", privilege: "mutation", domainOwnerGranted: true)'),
79
+ (0, type_graphql_1.Directive)('@transaction'),
80
+ (0, type_graphql_1.Mutation)(returns => data_ooc_1.DataOoc, { description: 'To modify DataOoc information' }),
81
+ __param(0, (0, type_graphql_1.Arg)('id')),
82
+ __param(1, (0, type_graphql_1.Arg)('patch')),
83
+ __param(2, (0, type_graphql_1.Ctx)()),
84
+ __metadata("design:type", Function),
85
+ __metadata("design:paramtypes", [String, data_ooc_type_1.DataOocPatch, Object]),
86
+ __metadata("design:returntype", Promise)
87
+ ], DataOocMutation.prototype, "updateDataOoc", null);
88
+ DataOocMutation = __decorate([
89
+ (0, type_graphql_1.Resolver)(data_ooc_1.DataOoc)
90
+ ], DataOocMutation);
91
+ exports.DataOocMutation = DataOocMutation;
92
+ //# sourceMappingURL=data-ooc-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-ooc-mutation.js","sourceRoot":"","sources":["../../../server/service/data-ooc/data-ooc-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsE;AAEtE,yCAAmD;AACnD,mDAA0D;AAG1D,IAAa,eAAe,GAA5B,MAAa,eAAe;IAI1B,KAAK,CAAC,aAAa,CAAiB,OAAmB,EAAS,OAAY;QAC1E,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,E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