@things-factory/shell 8.0.38 → 9.0.0-9.0.0-beta.59.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 (180) hide show
  1. package/_index.html +0 -1
  2. package/bin/things-factory-migration +6 -3
  3. package/client/themes/calendar-theme.css +3 -1
  4. package/client/themes/index.css +2 -1
  5. package/dist-server/index.d.ts +12 -12
  6. package/dist-server/index.js +12 -12
  7. package/dist-server/index.js.map +1 -1
  8. package/dist-server/initializers/database.js +4 -10
  9. package/dist-server/initializers/database.js.map +1 -1
  10. package/dist-server/initializers/ormconfig.d.ts +2 -0
  11. package/dist-server/initializers/ormconfig.js +30 -0
  12. package/dist-server/initializers/ormconfig.js.map +1 -0
  13. package/dist-server/middlewares/domain-middleware.js +2 -2
  14. package/dist-server/middlewares/domain-middleware.js.map +1 -1
  15. package/dist-server/middlewares/index.d.ts +1 -1
  16. package/dist-server/middlewares/index.js +3 -3
  17. package/dist-server/middlewares/index.js.map +1 -1
  18. package/dist-server/migrations/1000000000000-SeedDomain.js +4 -4
  19. package/dist-server/migrations/1000000000000-SeedDomain.js.map +1 -1
  20. package/dist-server/migrations/index.js.map +1 -1
  21. package/dist-server/process-cleaner.d.ts +1 -0
  22. package/dist-server/process-cleaner.js +92 -0
  23. package/dist-server/process-cleaner.js.map +1 -0
  24. package/dist-server/routers/domain-router.js +3 -3
  25. package/dist-server/routers/domain-router.js.map +1 -1
  26. package/dist-server/routers/global-router.js +6 -6
  27. package/dist-server/routers/global-router.js.map +1 -1
  28. package/dist-server/routers/index.d.ts +3 -3
  29. package/dist-server/routers/index.js +3 -3
  30. package/dist-server/routers/index.js.map +1 -1
  31. package/dist-server/schema.js +5 -4
  32. package/dist-server/schema.js.map +1 -1
  33. package/dist-server/server-dev.js +37 -39
  34. package/dist-server/server-dev.js.map +1 -1
  35. package/dist-server/server.js +34 -36
  36. package/dist-server/server.js.map +1 -1
  37. package/dist-server/service/attribute-set/attribute-set-item-type.js +3 -3
  38. package/dist-server/service/attribute-set/attribute-set-item-type.js.map +1 -1
  39. package/dist-server/service/attribute-set/attribute-set-mutation.d.ts +2 -2
  40. package/dist-server/service/attribute-set/attribute-set-mutation.js +16 -16
  41. package/dist-server/service/attribute-set/attribute-set-mutation.js.map +1 -1
  42. package/dist-server/service/attribute-set/attribute-set-query.d.ts +3 -3
  43. package/dist-server/service/attribute-set/attribute-set-query.js +15 -15
  44. package/dist-server/service/attribute-set/attribute-set-query.js.map +1 -1
  45. package/dist-server/service/attribute-set/attribute-set-type.d.ts +2 -2
  46. package/dist-server/service/attribute-set/attribute-set-type.js +5 -5
  47. package/dist-server/service/attribute-set/attribute-set-type.js.map +1 -1
  48. package/dist-server/service/attribute-set/attribute-set.d.ts +1 -1
  49. package/dist-server/service/attribute-set/attribute-set.js +2 -2
  50. package/dist-server/service/attribute-set/attribute-set.js.map +1 -1
  51. package/dist-server/service/attribute-set/index.d.ts +3 -3
  52. package/dist-server/service/attribute-set/index.js +5 -5
  53. package/dist-server/service/attribute-set/index.js.map +1 -1
  54. package/dist-server/service/common-types/index.d.ts +6 -6
  55. package/dist-server/service/common-types/index.js +6 -6
  56. package/dist-server/service/common-types/index.js.map +1 -1
  57. package/dist-server/service/common-types/list-param.js +2 -2
  58. package/dist-server/service/common-types/list-param.js.map +1 -1
  59. package/dist-server/service/common-types/log.js +2 -2
  60. package/dist-server/service/common-types/log.js.map +1 -1
  61. package/dist-server/service/common-types/scalar-object.d.ts +2 -1
  62. package/dist-server/service/common-types/scalar-object.js +2 -2
  63. package/dist-server/service/common-types/scalar-object.js.map +1 -1
  64. package/dist-server/service/directive-transaction/index.d.ts +1 -1
  65. package/dist-server/service/directive-transaction/index.js +1 -1
  66. package/dist-server/service/directive-transaction/index.js.map +1 -1
  67. package/dist-server/service/directive-transaction/transaction.js +2 -2
  68. package/dist-server/service/directive-transaction/transaction.js.map +1 -1
  69. package/dist-server/service/domain/domain-mutation.d.ts +2 -2
  70. package/dist-server/service/domain/domain-mutation.js +21 -21
  71. package/dist-server/service/domain/domain-mutation.js.map +1 -1
  72. package/dist-server/service/domain/domain-query.js +6 -6
  73. package/dist-server/service/domain/domain-query.js.map +1 -1
  74. package/dist-server/service/domain/domain-types.d.ts +2 -2
  75. package/dist-server/service/domain/domain-types.js +6 -6
  76. package/dist-server/service/domain/domain-types.js.map +1 -1
  77. package/dist-server/service/domain/index.d.ts +3 -3
  78. package/dist-server/service/domain/index.js +5 -5
  79. package/dist-server/service/domain/index.js.map +1 -1
  80. package/dist-server/service/index.d.ts +7 -7
  81. package/dist-server/service/index.js +16 -16
  82. package/dist-server/service/index.js.map +1 -1
  83. package/dist-server/service/subscription-data/data-resolver.d.ts +1 -1
  84. package/dist-server/service/subscription-data/data-resolver.js +4 -4
  85. package/dist-server/service/subscription-data/data-resolver.js.map +1 -1
  86. package/dist-server/service/subscription-data/data-types.d.ts +1 -1
  87. package/dist-server/service/subscription-data/data-types.js +5 -5
  88. package/dist-server/service/subscription-data/data-types.js.map +1 -1
  89. package/dist-server/service/subscription-data/index.d.ts +1 -1
  90. package/dist-server/service/subscription-data/index.js +2 -2
  91. package/dist-server/service/subscription-data/index.js.map +1 -1
  92. package/dist-server/tsconfig.tsbuildinfo +1 -1
  93. package/dist-server/typeorm/encrypt-transform.js +3 -3
  94. package/dist-server/typeorm/encrypt-transform.js.map +1 -1
  95. package/dist-server/utils/get-times-for-period.d.ts +24 -4
  96. package/dist-server/utils/get-times-for-period.js +42 -5
  97. package/dist-server/utils/get-times-for-period.js.map +1 -1
  98. package/dist-server/utils/index.d.ts +8 -8
  99. package/dist-server/utils/index.js +8 -8
  100. package/dist-server/utils/index.js.map +1 -1
  101. package/dist-server/utils/list-param-adjuster.d.ts +1 -1
  102. package/dist-server/utils/list-param-adjuster.js.map +1 -1
  103. package/dist-server/utils/list-params-converter.d.ts +2 -2
  104. package/dist-server/utils/list-params-converter.js +2 -2
  105. package/dist-server/utils/list-params-converter.js.map +1 -1
  106. package/dist-server/utils/list-query-builder.d.ts +1 -1
  107. package/dist-server/utils/list-query-builder.js +7 -7
  108. package/dist-server/utils/list-query-builder.js.map +1 -1
  109. package/dist-server/utils/publish-progress.js +2 -2
  110. package/dist-server/utils/publish-progress.js.map +1 -1
  111. package/package.json +14 -19
  112. package/translations/en.json +1 -0
  113. package/translations/ja.json +1 -0
  114. package/translations/ko.json +2 -1
  115. package/translations/ms.json +1 -0
  116. package/translations/zh.json +1 -0
  117. package/views/public/home.html +0 -1
  118. package/client/hot-client/hot.js +0 -140
  119. package/client/hot-client/index.js +0 -103
  120. package/client/hot-client/log.js +0 -44
  121. package/client/hot-client/socket.js +0 -63
  122. package/client/scene/scene-components.js +0 -3
  123. package/client/scene/scene-player.js +0 -103
  124. package/client/scene/scene-viewer.js +0 -106
  125. package/client/scene/things-scene-components.import +0 -1
  126. package/ormconfig.js +0 -31
  127. package/server/graphql-local-client.ts +0 -59
  128. package/server/index.ts +0 -13
  129. package/server/initializers/database.ts +0 -96
  130. package/server/initializers/naming-strategy.ts +0 -14
  131. package/server/middlewares/domain-middleware.ts +0 -60
  132. package/server/middlewares/index.ts +0 -43
  133. package/server/migrations/1000000000000-SeedDomain.ts +0 -37
  134. package/server/migrations/index.ts +0 -9
  135. package/server/pubsub-log-transport.ts +0 -59
  136. package/server/pubsub.ts +0 -84
  137. package/server/routers/domain-router.ts +0 -13
  138. package/server/routers/global-router.ts +0 -76
  139. package/server/routers/graphql-router.ts +0 -3
  140. package/server/routers/index.ts +0 -3
  141. package/server/schema.ts +0 -163
  142. package/server/server-dev.ts +0 -305
  143. package/server/server.ts +0 -296
  144. package/server/service/attribute-set/attribute-set-item-type.ts +0 -65
  145. package/server/service/attribute-set/attribute-set-mutation.ts +0 -125
  146. package/server/service/attribute-set/attribute-set-query.ts +0 -36
  147. package/server/service/attribute-set/attribute-set-type.ts +0 -46
  148. package/server/service/attribute-set/attribute-set.ts +0 -35
  149. package/server/service/attribute-set/index.ts +0 -6
  150. package/server/service/common-types/index.ts +0 -6
  151. package/server/service/common-types/list-param.ts +0 -61
  152. package/server/service/common-types/log.ts +0 -17
  153. package/server/service/common-types/object-ref.ts +0 -13
  154. package/server/service/common-types/scalar-any.ts +0 -44
  155. package/server/service/common-types/scalar-date.ts +0 -22
  156. package/server/service/common-types/scalar-object.ts +0 -15
  157. package/server/service/directive-transaction/index.ts +0 -1
  158. package/server/service/directive-transaction/transaction.ts +0 -40
  159. package/server/service/domain/domain-mutation.ts +0 -120
  160. package/server/service/domain/domain-query.ts +0 -55
  161. package/server/service/domain/domain-types.ts +0 -69
  162. package/server/service/domain/domain.ts +0 -112
  163. package/server/service/domain/index.ts +0 -6
  164. package/server/service/index.ts +0 -32
  165. package/server/service/subscription-data/data-resolver.ts +0 -37
  166. package/server/service/subscription-data/data-types.ts +0 -16
  167. package/server/service/subscription-data/index.ts +0 -4
  168. package/server/typeorm/encrypt-transform.ts +0 -70
  169. package/server/typeorm/get-data-encryption-key.ts +0 -13
  170. package/server/typeorm/json5-transform.ts +0 -26
  171. package/server/typeorm/round-transform.ts +0 -20
  172. package/server/utils/condition-builder.ts +0 -145
  173. package/server/utils/get-domain.ts +0 -228
  174. package/server/utils/get-query-builder-from-list-params.ts +0 -469
  175. package/server/utils/get-times-for-period.ts +0 -60
  176. package/server/utils/index.ts +0 -8
  177. package/server/utils/list-param-adjuster.ts +0 -21
  178. package/server/utils/list-params-converter.ts +0 -200
  179. package/server/utils/list-query-builder.ts +0 -120
  180. package/server/utils/publish-progress.ts +0 -23
@@ -5,14 +5,14 @@ const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
6
  const typeorm_1 = require("typeorm");
7
7
  const utils_1 = require("@things-factory/utils");
8
- const database_1 = require("../../initializers/database");
9
- const domain_1 = require("./domain");
10
- const domain_types_1 = require("./domain-types");
11
- const common_types_1 = require("../common-types");
8
+ const database_js_1 = require("../../initializers/database.js");
9
+ const domain_js_1 = require("./domain.js");
10
+ const domain_types_js_1 = require("./domain-types.js");
11
+ const scalar_object_js_1 = require("../common-types/scalar-object.js");
12
12
  let DomainMutation = class DomainMutation {
13
13
  async createDomain(domainInput) {
14
14
  const { name, description } = domainInput;
15
- const domainRepo = (0, database_1.getRepository)(domain_1.Domain);
15
+ const domainRepo = (0, database_js_1.getRepository)(domain_js_1.Domain);
16
16
  const subdomain = (0, utils_1.slugger)(name);
17
17
  const domain = await domainRepo.findOneBy({ subdomain });
18
18
  if (domain) {
@@ -21,15 +21,15 @@ let DomainMutation = class DomainMutation {
21
21
  return await domainRepo.save({ name, description, subdomain });
22
22
  }
23
23
  async deleteDomain(name) {
24
- return await (0, database_1.getRepository)(domain_1.Domain).delete({ name });
24
+ return await (0, database_js_1.getRepository)(domain_js_1.Domain).delete({ name });
25
25
  }
26
26
  async deleteDomains(names) {
27
- const domains = await (0, database_1.getRepository)(domain_1.Domain).find({ where: { name: (0, typeorm_1.In)(names) } });
27
+ const domains = await (0, database_js_1.getRepository)(domain_js_1.Domain).find({ where: { name: (0, typeorm_1.In)(names) } });
28
28
  const domainIds = domains.map(domain => domain.id);
29
- await (0, database_1.getRepository)(domain_1.Domain).delete({ id: (0, typeorm_1.In)(domainIds) });
29
+ await (0, database_js_1.getRepository)(domain_js_1.Domain).delete({ id: (0, typeorm_1.In)(domainIds) });
30
30
  }
31
31
  async updateDomain(name, patch) {
32
- const repository = (0, database_1.getRepository)(domain_1.Domain);
32
+ const repository = (0, database_js_1.getRepository)(domain_js_1.Domain);
33
33
  const domain = await repository.findOneBy({ name });
34
34
  if (patch.parent && patch.parent.id == domain.id) {
35
35
  delete patch.parent;
@@ -37,7 +37,7 @@ let DomainMutation = class DomainMutation {
37
37
  return await repository.save(Object.assign(Object.assign({}, domain), patch));
38
38
  }
39
39
  async updateDomains(patches) {
40
- const domainRepo = (0, database_1.getRepository)(domain_1.Domain);
40
+ const domainRepo = (0, database_js_1.getRepository)(domain_js_1.Domain);
41
41
  const patchIds = patches.filter((patch) => patch.id);
42
42
  if (patchIds.length > 0) {
43
43
  patchIds.forEach(async (updateRecord) => {
@@ -55,7 +55,7 @@ let DomainMutation = class DomainMutation {
55
55
  }
56
56
  async updateSecureIPList(iplist, context) {
57
57
  const { domain } = context.state;
58
- const repository = (0, database_1.getRepository)(domain_1.Domain);
58
+ const repository = (0, database_js_1.getRepository)(domain_js_1.Domain);
59
59
  // const domain: Domain = await repository.findOneBy({ id })
60
60
  const { iplist: result } = await repository.save(Object.assign(Object.assign({}, domain), { iplist }));
61
61
  return result;
@@ -65,16 +65,16 @@ exports.DomainMutation = DomainMutation;
65
65
  tslib_1.__decorate([
66
66
  (0, type_graphql_1.Directive)('@transaction'),
67
67
  (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
68
- (0, type_graphql_1.Mutation)(returns => domain_1.Domain, { description: 'To create domain (Only superuser is granted this privilege.)' }),
68
+ (0, type_graphql_1.Mutation)(returns => domain_js_1.Domain, { description: 'To create domain (Only superuser is granted this privilege.)' }),
69
69
  tslib_1.__param(0, (0, type_graphql_1.Arg)('domainInput')),
70
70
  tslib_1.__metadata("design:type", Function),
71
- tslib_1.__metadata("design:paramtypes", [domain_types_1.DomainPatch]),
71
+ tslib_1.__metadata("design:paramtypes", [domain_types_js_1.DomainPatch]),
72
72
  tslib_1.__metadata("design:returntype", Promise)
73
73
  ], DomainMutation.prototype, "createDomain", null);
74
74
  tslib_1.__decorate([
75
75
  (0, type_graphql_1.Directive)('@transaction'),
76
76
  (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
77
- (0, type_graphql_1.Mutation)(returns => domain_1.Domain, { description: 'To delete domain (Only superuser is granted this privilege.)' }),
77
+ (0, type_graphql_1.Mutation)(returns => domain_js_1.Domain, { description: 'To delete domain (Only superuser is granted this privilege.)' }),
78
78
  tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
79
79
  tslib_1.__metadata("design:type", Function),
80
80
  tslib_1.__metadata("design:paramtypes", [String]),
@@ -94,13 +94,13 @@ tslib_1.__decorate([
94
94
  tslib_1.__decorate([
95
95
  (0, type_graphql_1.Directive)('@transaction'),
96
96
  (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
97
- (0, type_graphql_1.Mutation)(returns => domain_1.Domain, {
97
+ (0, type_graphql_1.Mutation)(returns => domain_js_1.Domain, {
98
98
  description: 'To update domain (Only superuser is granted this privilege.)'
99
99
  }),
100
100
  tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
101
- tslib_1.__param(1, (0, type_graphql_1.Arg)('patch', () => domain_types_1.DomainPatch)),
101
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('patch', () => domain_types_js_1.DomainPatch)),
102
102
  tslib_1.__metadata("design:type", Function),
103
- tslib_1.__metadata("design:paramtypes", [String, domain_types_1.DomainPatch]),
103
+ tslib_1.__metadata("design:paramtypes", [String, domain_types_js_1.DomainPatch]),
104
104
  tslib_1.__metadata("design:returntype", Promise)
105
105
  ], DomainMutation.prototype, "updateDomain", null);
106
106
  tslib_1.__decorate([
@@ -109,7 +109,7 @@ tslib_1.__decorate([
109
109
  (0, type_graphql_1.Mutation)(returns => Boolean, {
110
110
  description: 'To update multiple domains (Only superuser is granted this privilege.)'
111
111
  }),
112
- tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', () => [domain_types_1.DomainPatch])),
112
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', () => [domain_types_js_1.DomainPatch])),
113
113
  tslib_1.__metadata("design:type", Function),
114
114
  tslib_1.__metadata("design:paramtypes", [Array]),
115
115
  tslib_1.__metadata("design:returntype", Promise)
@@ -117,14 +117,14 @@ tslib_1.__decorate([
117
117
  tslib_1.__decorate([
118
118
  (0, type_graphql_1.Directive)('@transaction'),
119
119
  (0, type_graphql_1.Directive)('@privilege(category: "security", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
120
- (0, type_graphql_1.Mutation)(returns => common_types_1.ScalarObject, { nullable: true, description: 'To update secure IP list for domain' }),
121
- tslib_1.__param(0, (0, type_graphql_1.Arg)('iplist', type => common_types_1.ScalarObject)),
120
+ (0, type_graphql_1.Mutation)(returns => scalar_object_js_1.ScalarObject, { nullable: true, description: 'To update secure IP list for domain' }),
121
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('iplist', type => scalar_object_js_1.ScalarObject)),
122
122
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
123
123
  tslib_1.__metadata("design:type", Function),
124
124
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
125
125
  tslib_1.__metadata("design:returntype", Promise)
126
126
  ], DomainMutation.prototype, "updateSecureIPList", null);
127
127
  exports.DomainMutation = DomainMutation = tslib_1.__decorate([
128
- (0, type_graphql_1.Resolver)(domain_1.Domain)
128
+ (0, type_graphql_1.Resolver)(domain_js_1.Domain)
129
129
  ], DomainMutation);
130
130
  //# sourceMappingURL=domain-mutation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"domain-mutation.js","sourceRoot":"","sources":["../../../server/service/domain/domain-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAyF;AACzF,qCAAwC;AAExC,iDAA+C;AAE/C,0DAA2D;AAE3D,qCAAyC;AACzC,iDAA4C;AAC5C,kDAA8C;AAGvC,IAAM,cAAc,GAApB,MAAM,cAAc;IAInB,AAAN,KAAK,CAAC,YAAY,CAAqB,WAAwB;QAC7D,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,WAAW,CAAA;QACzC,MAAM,UAAU,GAAuB,IAAA,wBAAa,EAAC,eAAM,CAAC,CAAA;QAC5D,MAAM,SAAS,GAAW,IAAA,eAAO,EAAC,IAAI,CAAC,CAAA;QAEvC,MAAM,MAAM,GAAW,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;QAChE,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;QACzC,CAAC;QAED,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SA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ACtF,CAAC;IACmB,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,0BAAW,CAAC,CAAC,CAAA;;;;mDAyBvD;AAOK;IALL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EACR,2GAA2G,CAC5G;IACA,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,2BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;IAEvG,mBAAA,IAAA,kBAAG,EAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,2BAAY,CAAC,CAAA;IACnC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;wDAYP;yBA1GU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,eAAM,CAAC;GACJ,cAAc,CA2G1B","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver, Root } from 'type-graphql'\nimport { In, Repository } from 'typeorm'\n\nimport { slugger } from '@things-factory/utils'\n\nimport { getRepository } from '../../initializers/database'\n\nimport { Domain, IPList } from './domain'\nimport { DomainPatch } from './domain-types'\nimport { ScalarObject } from '../common-types'\n\n@Resolver(Domain)\nexport class DomainMutation {\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To create domain (Only superuser is granted this privilege.)' })\n async createDomain(@Arg('domainInput') domainInput: DomainPatch) {\n const { name, description } = domainInput\n const domainRepo: Repository<Domain> = getRepository(Domain)\n const subdomain: string = slugger(name)\n\n const domain: Domain = await domainRepo.findOneBy({ subdomain })\n if (domain) {\n throw new Error('domain is duplicated')\n }\n\n return await domainRepo.save({ name, description, subdomain })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To delete domain (Only superuser is granted this privilege.)' })\n async deleteDomain(@Arg('name') name: string) {\n return await getRepository(Domain).delete({ name })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To delete multiple domains (Only superuser is granted this privilege.)'\n })\n async deleteDomains(@Arg('names', () => [String]) names: string[]) {\n const domains: Domain[] = await getRepository(Domain).find({ where: { name: In(names) } })\n const domainIds: string[] = domains.map(domain => domain.id)\n\n await getRepository(Domain).delete({ id: In(domainIds) })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, {\n description: 'To update domain (Only superuser is granted this privilege.)'\n })\n async updateDomain(@Arg('name') name: string, @Arg('patch', () => DomainPatch) patch: DomainPatch) {\n const repository = getRepository(Domain)\n const domain: Domain = await repository.findOneBy({ name })\n\n if (patch.parent && patch.parent.id == domain.id) {\n delete patch.parent\n }\n\n return await repository.save({\n ...domain,\n ...patch\n } as any)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To update multiple domains (Only superuser is granted this privilege.)'\n })\n async updateDomains(@Arg('patches', () => [DomainPatch]) patches: DomainPatch[]): Promise<boolean> {\n const domainRepo: Repository<Domain> = getRepository(Domain)\n\n const patchIds = patches.filter((patch: any) => patch.id)\n\n if (patchIds.length > 0) {\n patchIds.forEach(async updateRecord => {\n const domain: Domain = await domainRepo.findOne({ where: { id: updateRecord.id } })\n\n if (updateRecord.name) {\n updateRecord.subdomain = slugger(updateRecord.name)\n }\n\n if (updateRecord.parent && updateRecord.parent.id == domain.id) {\n delete updateRecord.parent\n }\n\n await domainRepo.save({\n ...domain,\n ...updateRecord\n } as any)\n })\n }\n\n return true\n }\n\n @Directive('@transaction')\n @Directive(\n '@privilege(category: \"security\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)'\n )\n @Mutation(returns => ScalarObject, { nullable: true, description: 'To update secure IP list for domain' })\n async updateSecureIPList(\n @Arg('iplist', type => ScalarObject) iplist: IPList,\n @Ctx() context: any\n ): Promise<IPList | null> {\n const { domain } = context.state\n const repository = getRepository(Domain)\n // const domain: Domain = await repository.findOneBy({ id })\n\n const { iplist: result } = await repository.save({\n ...domain,\n iplist\n } as any)\n\n return result\n }\n}\n"]}
1
+ {"version":3,"file":"domain-mutation.js","sourceRoot":"","sources":["../../../server/service/domain/domain-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAyF;AACzF,qCAAwC;AAExC,iDAA+C;AAE/C,gEAA8D;AAE9D,2CAA4C;AAC5C,uDAA+C;AAC/C,uEAA+D;AAGxD,IAAM,cAAc,GAApB,MAAM,cAAc;IAInB,AAAN,KAAK,CAAC,YAAY,CAAqB,WAAwB;QAC7D,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,WAAW,CAAA;QACzC,MAAM,UAAU,GAAuB,IAAA,2BAAa,EAAC,kBAAM,CAAC,CAAA;QAC5D,MAAM,SAAS,GAAW,IAAA,eAAO,EAAC,IAAI,CAAC,CAAA;QAEvC,MAAM,MAAM,GAAW,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;QAChE,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;QACzC,CAAC;QAED,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAA;IAChE,CAAC;IAKK,AAAN,KAAK,CAAC,YAAY,CAAc,IAAY;QAC1C,OAAO,MAAM,IAAA,2BAAa,EAAC,kBAAM,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IACrD,CAAC;IAOK,AAAN,KAAK,CAAC,aAAa,CAA+B,KAAe;QAC/D,MAAM,OAAO,GAAa,MAAM,IAAA,2BAAa,EAAC,kBAAM,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAA,YAAE,EAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;Q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AC,+BAAY,CAAC,CAAA;IACnC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;wDAYP;yBA1GU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,kBAAM,CAAC;GACJ,cAAc,CA2G1B","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver, Root } from 'type-graphql'\nimport { In, Repository } from 'typeorm'\n\nimport { slugger } from '@things-factory/utils'\n\nimport { getRepository } from '../../initializers/database.js'\n\nimport { Domain, IPList } from './domain.js'\nimport { DomainPatch } from './domain-types.js'\nimport { ScalarObject } from '../common-types/scalar-object.js'\n\n@Resolver(Domain)\nexport class DomainMutation {\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To create domain (Only superuser is granted this privilege.)' })\n async createDomain(@Arg('domainInput') domainInput: DomainPatch) {\n const { name, description } = domainInput\n const domainRepo: Repository<Domain> = getRepository(Domain)\n const subdomain: string = slugger(name)\n\n const domain: Domain = await domainRepo.findOneBy({ subdomain })\n if (domain) {\n throw new Error('domain is duplicated')\n }\n\n return await domainRepo.save({ name, description, subdomain })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To delete domain (Only superuser is granted this privilege.)' })\n async deleteDomain(@Arg('name') name: string) {\n return await getRepository(Domain).delete({ name })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To delete multiple domains (Only superuser is granted this privilege.)'\n })\n async deleteDomains(@Arg('names', () => [String]) names: string[]) {\n const domains: Domain[] = await getRepository(Domain).find({ where: { name: In(names) } })\n const domainIds: string[] = domains.map(domain => domain.id)\n\n await getRepository(Domain).delete({ id: In(domainIds) })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, {\n description: 'To update domain (Only superuser is granted this privilege.)'\n })\n async updateDomain(@Arg('name') name: string, @Arg('patch', () => DomainPatch) patch: DomainPatch) {\n const repository = getRepository(Domain)\n const domain: Domain = await repository.findOneBy({ name })\n\n if (patch.parent && patch.parent.id == domain.id) {\n delete patch.parent\n }\n\n return await repository.save({\n ...domain,\n ...patch\n } as any)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To update multiple domains (Only superuser is granted this privilege.)'\n })\n async updateDomains(@Arg('patches', () => [DomainPatch]) patches: DomainPatch[]): Promise<boolean> {\n const domainRepo: Repository<Domain> = getRepository(Domain)\n\n const patchIds = patches.filter((patch: any) => patch.id)\n\n if (patchIds.length > 0) {\n patchIds.forEach(async updateRecord => {\n const domain: Domain = await domainRepo.findOne({ where: { id: updateRecord.id } })\n\n if (updateRecord.name) {\n updateRecord.subdomain = slugger(updateRecord.name)\n }\n\n if (updateRecord.parent && updateRecord.parent.id == domain.id) {\n delete updateRecord.parent\n }\n\n await domainRepo.save({\n ...domain,\n ...updateRecord\n } as any)\n })\n }\n\n return true\n }\n\n @Directive('@transaction')\n @Directive(\n '@privilege(category: \"security\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)'\n )\n @Mutation(returns => ScalarObject, { nullable: true, description: 'To update secure IP list for domain' })\n async updateSecureIPList(\n @Arg('iplist', type => ScalarObject) iplist: IPList,\n @Ctx() context: any\n ): Promise<IPList | null> {\n const { domain } = context.state\n const repository = getRepository(Domain)\n // const domain: Domain = await repository.findOneBy({ id })\n\n const { iplist: result } = await repository.save({\n ...domain,\n iplist\n } as any)\n\n return result\n }\n}\n"]}
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DomainQuery = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
- const database_1 = require("../../initializers/database");
7
- const get_query_builder_from_list_params_1 = require("../../utils/get-query-builder-from-list-params");
6
+ const database_js_1 = require("../../initializers/database.js");
7
+ const get_query_builder_from_list_params_js_1 = require("../../utils/get-query-builder-from-list-params.js");
8
8
  const list_param_js_1 = require("../common-types/list-param.js");
9
9
  const domain_js_1 = require("./domain.js");
10
10
  const domain_types_js_1 = require("./domain-types.js");
@@ -15,12 +15,12 @@ let DomainQuery = class DomainQuery {
15
15
  return env_1.config.get('domainTypes') || ['domain'];
16
16
  }
17
17
  async domain(id, context) {
18
- const repository = (0, database_1.getRepository)(domain_js_1.Domain);
18
+ const repository = (0, database_js_1.getRepository)(domain_js_1.Domain);
19
19
  return await repository.findOneBy({ id });
20
20
  }
21
21
  async domains(params, context) {
22
- const queryBuilder = await (0, get_query_builder_from_list_params_1.getQueryBuilderFromListParams)({
23
- repository: (0, database_1.getRepository)(domain_js_1.Domain),
22
+ const queryBuilder = await (0, get_query_builder_from_list_params_js_1.getQueryBuilderFromListParams)({
23
+ repository: (0, database_js_1.getRepository)(domain_js_1.Domain),
24
24
  alias: 'ContactPoint',
25
25
  params,
26
26
  searchables: ['name', 'description', 'subdomain']
@@ -33,7 +33,7 @@ let DomainQuery = class DomainQuery {
33
33
  return domain.iplist;
34
34
  }
35
35
  async parent(domain) {
36
- return domain.parentId && (await (0, database_1.getRepository)(domain_js_1.Domain).findOneBy({ id: domain.parentId }));
36
+ return domain.parentId && (await (0, database_js_1.getRepository)(domain_js_1.Domain).findOneBy({ id: domain.parentId }));
37
37
  }
38
38
  };
39
39
  exports.DomainQuery = DomainQuery;
@@ -1 +1 @@
1
- {"version":3,"file":"domain-query.js","sourceRoot":"","sources":["../../../server/service/domain/domain-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAwG;AAGxG,0DAA2D;AAC3D,uGAA8F;AAE9F,iEAAyD;AACzD,2CAA4C;AAC5C,uDAA8C;AAC9C,uEAA+D;AAC/D,6CAA4C;AAGrC,IAAM,WAAW,GAAjB,MAAM,WAAW;IAGhB,AAAN,KAAK,CAAC,WAAW,CAAQ,OAAY;QACnC,OAAO,YAAM,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,QAA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E,CAAA;;;;8CAEvB;AAIK;IAFL,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,kBAAM,EAAE,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IAC/C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;yCAIzC;AAIK;IAFL,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,4BAAU,EAAE,EAAE,WAAW,EAAE,kEAAkE,EAAE,CAAC;IACnG,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,yBAAS,CAAC,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,yBAAS;;0CAWvD;AAIK;IAFL,IAAA,wBAAS,EAAC,wGAAwG,CAAC;IACnH,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,+BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IAC/D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+CAGxB;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAS,kBAAM;;yCAElC;sBAxCU,WAAW;IADvB,IAAA,uBAAQ,EAAC,kBAAM,CAAC;GACJ,WAAW,CAyCvB","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver, FieldResolver, Root } from 'type-graphql'\nimport { In, Repository } from 'typeorm'\n\nimport { getRepository } from '../../initializers/database'\nimport { getQueryBuilderFromListParams } from '../../utils/get-query-builder-from-list-params'\n\nimport { ListParam } from '../common-types/list-param.js'\nimport { Domain, IPList } from './domain.js'\nimport { DomainList } from './domain-types.js'\nimport { ScalarObject } from '../common-types/scalar-object.js'\nimport { config } from '@things-factory/env'\n\n@Resolver(Domain)\nexport class DomainQuery {\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => [String], { description: 'To fetch domain' })\n async domainTypes(@Ctx() context: any): Promise<String[]> {\n return config.get('domainTypes') || ['domain']\n }\n\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => Domain, { description: 'To fetch domain' })\n async domain(@Arg('id') id: string, @Ctx() context: any): Promise<Domain> {\n const repository = getRepository(Domain)\n\n return await repository.findOneBy({ id })\n }\n\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => DomainList, { description: 'To fetch all domains (Only superuser is granted this privilege.)' })\n async domains(@Args(type => ListParam) params: ListParam, @Ctx() context: any): Promise<DomainList> {\n const queryBuilder = await getQueryBuilderFromListParams({\n repository: getRepository(Domain),\n alias: 'ContactPoint',\n params,\n searchables: ['name', 'description', 'subdomain']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => ScalarObject, { nullable: true, description: 'To fetch domain' })\n async secureIPList(@Ctx() context: any): Promise<IPList | null> {\n const { domain } = context.state\n return domain.iplist\n }\n\n @FieldResolver(type => Domain)\n async parent(@Root() domain: Domain): Promise<Domain> {\n return domain.parentId && (await getRepository(Domain).findOneBy({ id: domain.parentId }))\n }\n}\n"]}
1
+ {"version":3,"file":"domain-query.js","sourceRoot":"","sources":["../../../server/service/domain/domain-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAwG;AAExG,gEAA8D;AAC9D,6GAAiG;AAEjG,iEAAyD;AACzD,2CAA4C;AAC5C,uDAA8C;AAC9C,uEAA+D;AAC/D,6CAA4C;AAGrC,IAAM,WAAW,GAAjB,MAAM,WAAW;IAGhB,AAAN,KAAK,CAAC,WAAW,CAAQ,OAAY;QACnC,OAAO,YAAM,CAAC,GAAG,CAAC,aA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,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8CAEvB;AAIK;IAFL,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,kBAAM,EAAE,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IAC/C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;yCAIzC;AAIK;IAFL,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,4BAAU,EAAE,EAAE,WAAW,EAAE,kEAAkE,EAAE,CAAC;IACnG,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,yBAAS,CAAC,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,yBAAS;;0CAWvD;AAIK;IAFL,IAAA,wBAAS,EAAC,wGAAwG,CAAC;IACnH,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,+BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IAC/D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+CAGxB;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAS,kBAAM;;yCAElC;sBAxCU,WAAW;IADvB,IAAA,uBAAQ,EAAC,kBAAM,CAAC;GACJ,WAAW,CAyCvB","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver, FieldResolver, Root } from 'type-graphql'\n\nimport { getRepository } from '../../initializers/database.js'\nimport { getQueryBuilderFromListParams } from '../../utils/get-query-builder-from-list-params.js'\n\nimport { ListParam } from '../common-types/list-param.js'\nimport { Domain, IPList } from './domain.js'\nimport { DomainList } from './domain-types.js'\nimport { ScalarObject } from '../common-types/scalar-object.js'\nimport { config } from '@things-factory/env'\n\n@Resolver(Domain)\nexport class DomainQuery {\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => [String], { description: 'To fetch domain' })\n async domainTypes(@Ctx() context: any): Promise<String[]> {\n return config.get('domainTypes') || ['domain']\n }\n\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => Domain, { description: 'To fetch domain' })\n async domain(@Arg('id') id: string, @Ctx() context: any): Promise<Domain> {\n const repository = getRepository(Domain)\n\n return await repository.findOneBy({ id })\n }\n\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => DomainList, { description: 'To fetch all domains (Only superuser is granted this privilege.)' })\n async domains(@Args(type => ListParam) params: ListParam, @Ctx() context: any): Promise<DomainList> {\n const queryBuilder = await getQueryBuilderFromListParams({\n repository: getRepository(Domain),\n alias: 'ContactPoint',\n params,\n searchables: ['name', 'description', 'subdomain']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => ScalarObject, { nullable: true, description: 'To fetch domain' })\n async secureIPList(@Ctx() context: any): Promise<IPList | null> {\n const { domain } = context.state\n return domain.iplist\n }\n\n @FieldResolver(type => Domain)\n async parent(@Root() domain: Domain): Promise<Domain> {\n return domain.parentId && (await getRepository(Domain).findOneBy({ id: domain.parentId }))\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { Domain } from './domain';
2
- import { ObjectRef } from '../common-types';
1
+ import { Domain } from './domain.js';
2
+ import { ObjectRef } from '../common-types/index.js';
3
3
  export declare class DomainInput {
4
4
  name: string;
5
5
  description?: string;
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DomainList = exports.DomainPatch = exports.DomainInput = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
- const domain_1 = require("./domain");
7
- const common_types_1 = require("../common-types");
6
+ const domain_js_1 = require("./domain.js");
7
+ const index_js_1 = require("../common-types/index.js");
8
8
  let DomainInput = class DomainInput {
9
9
  };
10
10
  exports.DomainInput = DomainInput;
@@ -55,8 +55,8 @@ tslib_1.__decorate([
55
55
  tslib_1.__metadata("design:type", String)
56
56
  ], DomainPatch.prototype, "owner", void 0);
57
57
  tslib_1.__decorate([
58
- (0, type_graphql_1.Field)(type => common_types_1.ObjectRef, { nullable: true }),
59
- tslib_1.__metadata("design:type", common_types_1.ObjectRef)
58
+ (0, type_graphql_1.Field)(type => index_js_1.ObjectRef, { nullable: true }),
59
+ tslib_1.__metadata("design:type", index_js_1.ObjectRef)
60
60
  ], DomainPatch.prototype, "parent", void 0);
61
61
  tslib_1.__decorate([
62
62
  (0, type_graphql_1.Field)({ nullable: true }),
@@ -75,7 +75,7 @@ tslib_1.__decorate([
75
75
  tslib_1.__metadata("design:type", String)
76
76
  ], DomainPatch.prototype, "extType", void 0);
77
77
  tslib_1.__decorate([
78
- (0, type_graphql_1.Field)(type => common_types_1.ScalarObject, { nullable: true }),
78
+ (0, type_graphql_1.Field)(type => index_js_1.ScalarObject, { nullable: true }),
79
79
  tslib_1.__metadata("design:type", Object)
80
80
  ], DomainPatch.prototype, "attributes", void 0);
81
81
  tslib_1.__decorate([
@@ -89,7 +89,7 @@ let DomainList = class DomainList {
89
89
  };
90
90
  exports.DomainList = DomainList;
91
91
  tslib_1.__decorate([
92
- (0, type_graphql_1.Field)(type => [domain_1.Domain], { nullable: true }),
92
+ (0, type_graphql_1.Field)(type => [domain_js_1.Domain], { nullable: true }),
93
93
  tslib_1.__metadata("design:type", Array)
94
94
  ], DomainList.prototype, "items", void 0);
95
95
  tslib_1.__decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"domain-types.js","sourceRoot":"","sources":["../../../server/service/domain/domain-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,qCAAyC;AACzC,kDAAyD;AAGlD,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AE,IAAI,EAAE,CAAC;;iDACL;AAGrB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,2BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CAChC;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACZ;sBAzCH,WAAW;IADvB,IAAA,wBAAS,GAAE;GACC,WAAW,CA0CvB;AAGM,IAAM,UAAU,GAAhB,MAAM,UAAU;CAMtB,CAAA;AANY,gCAAU;AAErB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,eAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC7B;AAGf;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC1B;qBALF,UAAU;IADtB,IAAA,yBAAU,GAAE;GACA,UAAU,CAMtB","sourcesContent":["import { ObjectType, InputType, Field, Int } from 'type-graphql'\nimport { Domain, IPList } from './domain'\nimport { ObjectRef, ScalarObject } from '../common-types'\n\n@InputType()\nexport class DomainInput {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n extType?: string\n}\n\n@InputType()\nexport class DomainPatch {\n @Field({ nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n timezone?: string\n\n @Field({ nullable: true })\n systemFlag?: Boolean\n\n @Field({ nullable: true })\n subdomain?: string\n\n @Field({ nullable: true })\n owner?: string\n\n @Field(type => ObjectRef, { nullable: true })\n parent?: ObjectRef\n\n @Field({ nullable: true })\n brandName?: string\n\n @Field({ nullable: true })\n brandImage?: string\n\n @Field({ nullable: true })\n contentImage?: string\n\n @Field({ nullable: true })\n extType?: string\n\n @Field(type => ScalarObject, { nullable: true })\n attributes?: any\n\n @Field({ nullable: true })\n theme?: string\n}\n\n@ObjectType()\nexport class DomainList {\n @Field(type => [Domain], { nullable: true })\n items: Domain[]\n\n @Field(type => Int, { nullable: true })\n total: number\n}\n"]}
1
+ {"version":3,"file":"domain-types.js","sourceRoot":"","sources":["../../../server/service/domain/domain-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,2CAA4C;AAC5C,uDAAkE;AAG3D,IAAM,WAAW,GAAjB,MAAM,WAAW;CASvB,CAAA;AATY,kCAAW;AAEtB;IADC,IAAA,oBAAK,GAAE;;yCACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACV;sBARL,WAAW;IADvB,IAAA,wBAAS,GAAE;GACC,WAAW,CASvB;AAGM,IAAM,WAAW,GAAjB,MAAM,WAAW;CA0CvB,CAAA;AA1CY,kCAAW;AAEtB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCACf;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACT;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACb,OAAO;+CAAA;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACR;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACZ;AAGd;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,oBAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACpC,oBAAS;2CAAA;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACR;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACP;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACL;AAGrB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,uBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CAChC;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACZ;sBAzCH,WAAW;IADvB,IAAA,wBAAS,GAAE;GACC,WAAW,CA0CvB;AAGM,IAAM,UAAU,GAAhB,MAAM,UAAU;CAMtB,CAAA;AANY,gCAAU;AAErB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,kBAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC7B;AAGf;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC1B;qBALF,UAAU;IADtB,IAAA,yBAAU,GAAE;GACA,UAAU,CAMtB","sourcesContent":["import { ObjectType, InputType, Field, Int } from 'type-graphql'\nimport { Domain, IPList } from './domain.js'\nimport { ObjectRef, ScalarObject } from '../common-types/index.js'\n\n@InputType()\nexport class DomainInput {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n extType?: string\n}\n\n@InputType()\nexport class DomainPatch {\n @Field({ nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n timezone?: string\n\n @Field({ nullable: true })\n systemFlag?: Boolean\n\n @Field({ nullable: true })\n subdomain?: string\n\n @Field({ nullable: true })\n owner?: string\n\n @Field(type => ObjectRef, { nullable: true })\n parent?: ObjectRef\n\n @Field({ nullable: true })\n brandName?: string\n\n @Field({ nullable: true })\n brandImage?: string\n\n @Field({ nullable: true })\n contentImage?: string\n\n @Field({ nullable: true })\n extType?: string\n\n @Field(type => ScalarObject, { nullable: true })\n attributes?: any\n\n @Field({ nullable: true })\n theme?: string\n}\n\n@ObjectType()\nexport class DomainList {\n @Field(type => [Domain], { nullable: true })\n items: Domain[]\n\n @Field(type => Int, { nullable: true })\n total: number\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { Domain } from './domain';
2
- import { DomainQuery } from './domain-query';
3
- import { DomainMutation } from './domain-mutation';
1
+ import { Domain } from './domain.js';
2
+ import { DomainQuery } from './domain-query.js';
3
+ import { DomainMutation } from './domain-mutation.js';
4
4
  export declare const entities: (typeof Domain)[];
5
5
  export declare const resolvers: (typeof DomainQuery | typeof DomainMutation)[];
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolvers = exports.entities = void 0;
4
- const domain_1 = require("./domain");
5
- const domain_query_1 = require("./domain-query");
6
- const domain_mutation_1 = require("./domain-mutation");
7
- exports.entities = [domain_1.Domain];
8
- exports.resolvers = [domain_query_1.DomainQuery, domain_mutation_1.DomainMutation];
4
+ const domain_js_1 = require("./domain.js");
5
+ const domain_query_js_1 = require("./domain-query.js");
6
+ const domain_mutation_js_1 = require("./domain-mutation.js");
7
+ exports.entities = [domain_js_1.Domain];
8
+ exports.resolvers = [domain_query_js_1.DomainQuery, domain_mutation_js_1.DomainMutation];
9
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/domain/index.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,iDAA4C;AAC5C,uDAAkD;AAErC,QAAA,QAAQ,GAAG,CAAC,eAAM,CAAC,CAAA;AACnB,QAAA,SAAS,GAAG,CAAC,0BAAW,EAAE,gCAAc,CAAC,CAAA","sourcesContent":["import { Domain } from './domain'\nimport { DomainQuery } from './domain-query'\nimport { DomainMutation } from './domain-mutation'\n\nexport const entities = [Domain]\nexport const resolvers = [DomainQuery, DomainMutation]\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/domain/index.ts"],"names":[],"mappings":";;;AAAA,2CAAoC;AACpC,uDAA+C;AAC/C,6DAAqD;AAExC,QAAA,QAAQ,GAAG,CAAC,kBAAM,CAAC,CAAA;AACnB,QAAA,SAAS,GAAG,CAAC,6BAAW,EAAE,mCAAc,CAAC,CAAA","sourcesContent":["import { Domain } from './domain.js'\nimport { DomainQuery } from './domain-query.js'\nimport { DomainMutation } from './domain-mutation.js'\n\nexport const entities = [Domain]\nexport const resolvers = [DomainQuery, DomainMutation]\n"]}
@@ -1,14 +1,14 @@
1
- export * from './common-types';
2
- export * from './domain/domain';
3
- export * from './domain/domain';
4
- export * from './domain/domain-types';
5
- export * from './subscription-data/data-types';
6
- export declare const entities: (typeof import("./domain/domain").Domain | typeof import("./attribute-set/attribute-set").AttributeSet)[];
1
+ export * from './common-types/index.js';
2
+ export * from './domain/domain.js';
3
+ export * from './domain/domain.js';
4
+ export * from './domain/domain-types.js';
5
+ export * from './subscription-data/data-types.js';
6
+ export declare const entities: (typeof import("./domain/domain.js").Domain | typeof import("./attribute-set/attribute-set.js").AttributeSet)[];
7
7
  export declare const schema: {
8
8
  typeDefs: {
9
9
  transactionDirectiveTypeDefs: import("graphql").DocumentNode;
10
10
  };
11
- resolverClasses: (typeof import("./domain/domain-query").DomainQuery | typeof import("./domain/domain-mutation").DomainMutation | typeof import("./attribute-set/attribute-set-query").AttributeSetQuery | typeof import("./attribute-set/attribute-set-mutation").AttributeSetMutation | typeof import("./subscription-data/data-resolver").DataResolver)[];
11
+ resolverClasses: (typeof import("./domain/domain-query.js").DomainQuery | typeof import("./domain/domain-mutation.js").DomainMutation | typeof import("./attribute-set/attribute-set-query.js").AttributeSetQuery | typeof import("./attribute-set/attribute-set-mutation.js").AttributeSetMutation | typeof import("./subscription-data/data-resolver.js").DataResolver)[];
12
12
  directives: {
13
13
  transaction: (schema: import("graphql").GraphQLSchema) => import("graphql").GraphQLSchema;
14
14
  };
@@ -2,33 +2,33 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.entities = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const directive_transaction_1 = require("./directive-transaction");
6
- const domain_1 = require("./domain");
7
- const attribute_set_1 = require("./attribute-set");
8
- const subscription_data_1 = require("./subscription-data");
9
- tslib_1.__exportStar(require("./common-types"), exports);
10
- tslib_1.__exportStar(require("./domain/domain"), exports);
11
- tslib_1.__exportStar(require("./domain/domain"), exports);
5
+ const index_js_1 = require("./directive-transaction/index.js");
6
+ const index_js_2 = require("./domain/index.js");
7
+ const index_js_3 = require("./attribute-set/index.js");
8
+ const index_js_4 = require("./subscription-data/index.js");
9
+ tslib_1.__exportStar(require("./common-types/index.js"), exports);
10
+ tslib_1.__exportStar(require("./domain/domain.js"), exports);
11
+ tslib_1.__exportStar(require("./domain/domain.js"), exports);
12
12
  /* EXPORT TYPES */
13
- tslib_1.__exportStar(require("./domain/domain-types"), exports);
14
- tslib_1.__exportStar(require("./subscription-data/data-types"), exports);
13
+ tslib_1.__exportStar(require("./domain/domain-types.js"), exports);
14
+ tslib_1.__exportStar(require("./subscription-data/data-types.js"), exports);
15
15
  exports.entities = [
16
16
  /* Entities */
17
- ...attribute_set_1.entities,
18
- ...domain_1.entities
17
+ ...index_js_3.entities,
18
+ ...index_js_2.entities
19
19
  ];
20
20
  exports.schema = {
21
21
  typeDefs: {
22
- transactionDirectiveTypeDefs: directive_transaction_1.transactionDirectiveTypeDefs
22
+ transactionDirectiveTypeDefs: index_js_1.transactionDirectiveTypeDefs
23
23
  },
24
24
  resolverClasses: [
25
25
  /* Resolvers */
26
- ...attribute_set_1.resolvers,
27
- ...domain_1.resolvers,
28
- ...subscription_data_1.resolvers
26
+ ...index_js_3.resolvers,
27
+ ...index_js_2.resolvers,
28
+ ...index_js_4.resolvers
29
29
  ],
30
30
  directives: {
31
- transaction: directive_transaction_1.transactionDirectiveResolver
31
+ transaction: index_js_1.transactionDirectiveResolver
32
32
  }
33
33
  };
34
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,mEAAoG;AACpG,qCAAmF;AACnF,mDAAgG;AAChG,2DAA4E;AAE5E,yDAA8B;AAC9B,0DAA+B;AAC/B,0DAA+B;AAE/B,kBAAkB;AAClB,gEAAqC;AACrC,yEAA8C;AAEjC,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,wBAAiB;IACpB,GAAG,iBAAc;CAClB,CAAA;AACY,QAAA,MAAM,GAAG;IACpB,QAAQ,EAAE;QACR,4BAA4B,EAA5B,oDAA4B;KAC7B;IACD,eAAe,EAAE;QACf,eAAe;QACf,GAAG,yBAAkB;QACrB,GAAG,kBAAe;QAClB,GAAG,6BAAyB;KAC7B;IACD,UAAU,EAAE;QACV,WAAW,EAAE,oDAA4B;KAC1C;CACF,CAAA","sourcesContent":["import { transactionDirectiveResolver, transactionDirectiveTypeDefs } from './directive-transaction'\nimport { entities as DomainEntities, resolvers as DomainResolvers } from './domain'\nimport { entities as AttributeEntities, resolvers as AttributeResolvers } from './attribute-set'\nimport { resolvers as SubscriptionDataResolvers } from './subscription-data'\n\nexport * from './common-types'\nexport * from './domain/domain'\nexport * from './domain/domain'\n\n/* EXPORT TYPES */\nexport * from './domain/domain-types'\nexport * from './subscription-data/data-types'\n\nexport const entities = [\n /* Entities */\n ...AttributeEntities,\n ...DomainEntities\n]\nexport const schema = {\n typeDefs: {\n transactionDirectiveTypeDefs\n },\n resolverClasses: [\n /* Resolvers */\n ...AttributeResolvers,\n ...DomainResolvers,\n ...SubscriptionDataResolvers\n ],\n directives: {\n transaction: transactionDirectiveResolver\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,+DAA6G;AAC7G,gDAA4F;AAC5F,uDAAyG;AACzG,2DAAqF;AAErF,kEAAuC;AACvC,6DAAkC;AAClC,6DAAkC;AAElC,kBAAkB;AAClB,mEAAwC;AACxC,4EAAiD;AAEpC,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,mBAAiB;IACpB,GAAG,mBAAc;CAClB,CAAA;AACY,QAAA,MAAM,GAAG;IACpB,QAAQ,EAAE;QACR,4BAA4B,EAA5B,uCAA4B;KAC7B;IACD,eAAe,EAAE;QACf,eAAe;QACf,GAAG,oBAAkB;QACrB,GAAG,oBAAe;QAClB,GAAG,oBAAyB;KAC7B;IACD,UAAU,EAAE;QACV,WAAW,EAAE,uCAA4B;KAC1C;CACF,CAAA","sourcesContent":["import { transactionDirectiveResolver, transactionDirectiveTypeDefs } from './directive-transaction/index.js'\nimport { entities as DomainEntities, resolvers as DomainResolvers } from './domain/index.js'\nimport { entities as AttributeEntities, resolvers as AttributeResolvers } from './attribute-set/index.js'\nimport { resolvers as SubscriptionDataResolvers } from './subscription-data/index.js'\n\nexport * from './common-types/index.js'\nexport * from './domain/domain.js'\nexport * from './domain/domain.js'\n\n/* EXPORT TYPES */\nexport * from './domain/domain-types.js'\nexport * from './subscription-data/data-types.js'\n\nexport const entities = [\n /* Entities */\n ...AttributeEntities,\n ...DomainEntities\n]\nexport const schema = {\n typeDefs: {\n transactionDirectiveTypeDefs\n },\n resolverClasses: [\n /* Resolvers */\n ...AttributeResolvers,\n ...DomainResolvers,\n ...SubscriptionDataResolvers\n ],\n directives: {\n transaction: transactionDirectiveResolver\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Data } from './data-types';
1
+ import { Data } from './data-types.js';
2
2
  export declare class DataResolver {
3
3
  data(payload: {
4
4
  data: Data;
@@ -4,8 +4,8 @@ exports.DataResolver = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const graphql_yoga_1 = require("graphql-yoga");
6
6
  const type_graphql_1 = require("type-graphql");
7
- const pubsub_1 = require("../../pubsub");
8
- const data_types_1 = require("./data-types");
7
+ const pubsub_js_1 = require("../../pubsub.js");
8
+ const data_types_js_1 = require("./data-types.js");
9
9
  /* 이 Resolver는 @things-factory/integration-base 에서 Overide 된다. (state-register를 사용하기 위해서) */
10
10
  let DataResolver = class DataResolver {
11
11
  data(payload, tag) {
@@ -27,7 +27,7 @@ tslib_1.__decorate([
27
27
  if (!((_a = user.domains) === null || _a === void 0 ? void 0 : _a.find(d => d.subdomain === subdomain)) && !process.superUserGranted(domain, user)) {
28
28
  throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`);
29
29
  }
30
- return (0, graphql_yoga_1.pipe)(pubsub_1.pubsub.subscribe('data'), (0, graphql_yoga_1.filter)((payload) => {
30
+ return (0, graphql_yoga_1.pipe)(pubsub_js_1.pubsub.subscribe('data'), (0, graphql_yoga_1.filter)((payload) => {
31
31
  const { domain: pdomain, tag: ptag, data } = payload.data;
32
32
  return tag === ptag && subdomain === (pdomain === null || pdomain === void 0 ? void 0 : pdomain.subdomain);
33
33
  }));
@@ -37,7 +37,7 @@ tslib_1.__decorate([
37
37
  tslib_1.__param(1, (0, type_graphql_1.Arg)('tag')),
38
38
  tslib_1.__metadata("design:type", Function),
39
39
  tslib_1.__metadata("design:paramtypes", [Object, String]),
40
- tslib_1.__metadata("design:returntype", data_types_1.Data)
40
+ tslib_1.__metadata("design:returntype", data_types_js_1.Data)
41
41
  ], DataResolver.prototype, "data", null);
42
42
  exports.DataResolver = DataResolver = tslib_1.__decorate([
43
43
  (0, type_graphql_1.Resolver)()
@@ -1 +1 @@
1
- {"version":3,"file":"data-resolver.js","sourceRoot":"","sources":["../../../server/service/subscription-data/data-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAA2C;AAC3C,+CAAgE;AAEhE,yCAAqC;AACrC,6CAAmC;AAEnC,4FAA4F;AAErF,IAAM,YAAY,GAAlB,MAAM,YAAY;IAyBvB,IAAI,CAAS,OAAuB,EAAc,GAAW;QAC3D,OAAO,OAAO,CAAC,IAAI,CAAA;IACrB,CAAC;CACF,CAAA;AA5BY,oCAAY;AAyBvB;IAxBC,IAAA,2BAAY,EAAC;QACZ,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;;YACrC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;YACtC,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;YACpB,MAAM,SAAS,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,CAAA;YAEnC,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;YAC5C,CAAC;YAED,YAAY;YACZ,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAA,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;gBACnG,MAAM,IAAI,KAAK,CAAC,UAAU,SAAS,6BAA6B,IAAI,CAAC,KAAK,IAAI,CAAC,CAAA;YACjF,CAAC;YAED,OAAO,IAAA,mBAAI,EACT,eAAM,CAAC,SAAS,CAAC,MAAM,CAAC,EACxB,IAAA,qBAAM,EAAC,CAAC,OAAuB,EAAE,EAAE;gBACjC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAA;gBACzD,OAAO,GAAG,KAAK,IAAI,IAAI,SAAS,MAAK,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAA,CAAA;YACzD,CAAC,CAAC,CACH,CAAA;QACH,CAAC;KACF,CAAC;IACI,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAA2B,mBAAA,IAAA,kBAAG,EAAC,KAAK,CAAC,CAAA;;;4CAAe,iBAAI;wCAEnE;uBA3BU,YAAY;IADxB,IAAA,uBAAQ,GAAE;GACE,YAAY,CA4BxB","sourcesContent":["import { filter, pipe } from 'graphql-yoga'\nimport { Arg, Resolver, Root, Subscription } from 'type-graphql'\n\nimport { pubsub } from '../../pubsub'\nimport { Data } from './data-types'\n\n/* 이 Resolver는 @things-factory/integration-base 에서 Overide 된다. (state-register를 사용하기 위해서) */\n@Resolver()\nexport class DataResolver {\n @Subscription({\n subscribe: ({ args, context, info }) => {\n const { domain, user } = context.state\n const { tag } = args\n const subdomain = domain?.subdomain\n\n if (!domain || !tag) {\n throw new Error('domain and tag required')\n }\n\n //@ts-ignore\n if (!user.domains?.find(d => d.subdomain === subdomain) && !process.superUserGranted(domain, user)) {\n throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`)\n }\n\n return pipe(\n pubsub.subscribe('data'),\n filter((payload: { data: Data }) => {\n const { domain: pdomain, tag: ptag, data } = payload.data\n return tag === ptag && subdomain === pdomain?.subdomain\n })\n )\n }\n })\n data(@Root() payload: { data: Data }, @Arg('tag') tag: string): Data {\n return payload.data\n }\n}\n"]}
1
+ {"version":3,"file":"data-resolver.js","sourceRoot":"","sources":["../../../server/service/subscription-data/data-resolver.ts"],"names":[],"mappings":";;;;AAAA,+CAA2C;AAC3C,+CAAgE;AAEhE,+CAAwC;AACxC,mDAAsC;A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CAAA,CAAA;YACzD,CAAC,CAAC,CACH,CAAA;QACH,CAAC;KACF,CAAC;IACI,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAA2B,mBAAA,IAAA,kBAAG,EAAC,KAAK,CAAC,CAAA;;;4CAAe,oBAAI;wCAEnE;uBA3BU,YAAY;IADxB,IAAA,uBAAQ,GAAE;GACE,YAAY,CA4BxB","sourcesContent":["import { filter, pipe } from 'graphql-yoga'\nimport { Arg, Resolver, Root, Subscription } from 'type-graphql'\n\nimport { pubsub } from '../../pubsub.js'\nimport { Data } from './data-types.js'\n\n/* 이 Resolver는 @things-factory/integration-base 에서 Overide 된다. (state-register를 사용하기 위해서) */\n@Resolver()\nexport class DataResolver {\n @Subscription({\n subscribe: ({ args, context, info }) => {\n const { domain, user } = context.state\n const { tag } = args\n const subdomain = domain?.subdomain\n\n if (!domain || !tag) {\n throw new Error('domain and tag required')\n }\n\n //@ts-ignore\n if (!user.domains?.find(d => d.subdomain === subdomain) && !process.superUserGranted(domain, user)) {\n throw new Error(`domain(${subdomain}) is not working for user(${user.email}).`)\n }\n\n return pipe(\n pubsub.subscribe('data'),\n filter((payload: { data: Data }) => {\n const { domain: pdomain, tag: ptag, data } = payload.data\n return tag === ptag && subdomain === pdomain?.subdomain\n })\n )\n }\n })\n data(@Root() payload: { data: Data }, @Arg('tag') tag: string): Data {\n return payload.data\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Domain } from '../domain/domain';
1
+ import { Domain } from '../domain/domain.js';
2
2
  export declare class Data {
3
3
  domain?: Domain;
4
4
  tag: string;
@@ -3,21 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Data = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
- const scalar_object_1 = require("../common-types/scalar-object");
7
- const domain_1 = require("../domain/domain");
6
+ const scalar_object_js_1 = require("../common-types/scalar-object.js");
7
+ const domain_js_1 = require("../domain/domain.js");
8
8
  let Data = class Data {
9
9
  };
10
10
  exports.Data = Data;
11
11
  tslib_1.__decorate([
12
- (0, type_graphql_1.Field)(type => domain_1.Domain, { nullable: true, description: 'The domain where the data originated' }),
13
- tslib_1.__metadata("design:type", domain_1.Domain)
12
+ (0, type_graphql_1.Field)(type => domain_js_1.Domain, { nullable: true, description: 'The domain where the data originated' }),
13
+ tslib_1.__metadata("design:type", domain_js_1.Domain)
14
14
  ], Data.prototype, "domain", void 0);
15
15
  tslib_1.__decorate([
16
16
  (0, type_graphql_1.Field)({ description: 'Tag name attached to data' }),
17
17
  tslib_1.__metadata("design:type", String)
18
18
  ], Data.prototype, "tag", void 0);
19
19
  tslib_1.__decorate([
20
- (0, type_graphql_1.Field)(type => scalar_object_1.ScalarObject, { nullable: true, description: 'Data delivered by subscription' }),
20
+ (0, type_graphql_1.Field)(type => scalar_object_js_1.ScalarObject, { nullable: true, description: 'Data delivered by subscription' }),
21
21
  tslib_1.__metadata("design:type", Object)
22
22
  ], Data.prototype, "data", void 0);
23
23
  exports.Data = Data = tslib_1.__decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"data-types.js","sourceRoot":"","sources":["../../../server/service/subscription-data/data-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgD;AAEhD,iEAA4D;AAC5D,6CAAyC;AAGlC,IAAM,IAAI,GAAV,MAAM,IAAI;CAShB,CAAA;AATY,oBAAI;AAEf;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,eAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;sCACtF,eAAM;oCAAA;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;;iCACzC;AAGX;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,4BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;sCACxF,MAAM;kCAAA;eARF,IAAI;IADhB,IAAA,yBAAU,GAAE;GACA,IAAI,CAShB","sourcesContent":["import { Field, ObjectType } from 'type-graphql'\n\nimport { ScalarObject } from '../common-types/scalar-object'\nimport { Domain } from '../domain/domain'\n\n@ObjectType()\nexport class Data {\n @Field(type => Domain, { nullable: true, description: 'The domain where the data originated' })\n domain?: Domain\n\n @Field({ description: 'Tag name attached to data' })\n tag: string\n\n @Field(type => ScalarObject, { nullable: true, description: 'Data delivered by subscription' })\n data?: Object\n}\n"]}
1
+ {"version":3,"file":"data-types.js","sourceRoot":"","sources":["../../../server/service/subscription-data/data-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgD;AAEhD,uEAA+D;AAC/D,mDAA4C;AAGrC,IAAM,IAAI,GAAV,MAAM,IAAI;CAShB,CAAA;AATY,oBAAI;AAEf;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;sCACtF,kBAAM;oCAAA;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;;iCACzC;AAGX;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,+BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;sCACxF,MAAM;kCAAA;eARF,IAAI;IADhB,IAAA,yBAAU,GAAE;GACA,IAAI,CAShB","sourcesContent":["import { Field, ObjectType } from 'type-graphql'\n\nimport { ScalarObject } from '../common-types/scalar-object.js'\nimport { Domain } from '../domain/domain.js'\n\n@ObjectType()\nexport class Data {\n @Field(type => Domain, { nullable: true, description: 'The domain where the data originated' })\n domain?: Domain\n\n @Field({ description: 'Tag name attached to data' })\n tag: string\n\n @Field(type => ScalarObject, { nullable: true, description: 'Data delivered by subscription' })\n data?: Object\n}\n"]}
@@ -1,3 +1,3 @@
1
- import { DataResolver } from './data-resolver';
1
+ import { DataResolver } from './data-resolver.js';
2
2
  export declare const entities: any[];
3
3
  export declare const resolvers: (typeof DataResolver)[];
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolvers = exports.entities = void 0;
4
- const data_resolver_1 = require("./data-resolver");
4
+ const data_resolver_js_1 = require("./data-resolver.js");
5
5
  exports.entities = [];
6
- exports.resolvers = [data_resolver_1.DataResolver];
6
+ exports.resolvers = [data_resolver_js_1.DataResolver];
7
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/subscription-data/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAEjC,QAAA,QAAQ,GAAG,EAAE,CAAA;AACb,QAAA,SAAS,GAAG,CAAC,4BAAY,CAAC,CAAA","sourcesContent":["import { DataResolver } from './data-resolver'\n\nexport const entities = []\nexport const resolvers = [DataResolver]\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/subscription-data/index.ts"],"names":[],"mappings":";;;AAAA,yDAAiD;AAEpC,QAAA,QAAQ,GAAG,EAAE,CAAA;AACb,QAAA,SAAS,GAAG,CAAC,+BAAY,CAAC,CAAA","sourcesContent":["import { DataResolver } from './data-resolver.js'\n\nexport const entities = []\nexport const resolvers = [DataResolver]\n"]}