@things-factory/i18n-base 7.0.0-alpha.9 → 7.0.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 (81) hide show
  1. package/client/bootstrap.ts +16 -0
  2. package/client/{index.js → index.ts} +0 -2
  3. package/client/page/terminology-page.ts +406 -0
  4. package/client/route.ts +7 -0
  5. package/config/config.development.js +29 -0
  6. package/config/config.production.js +29 -0
  7. package/dist-client/bootstrap.d.ts +6 -0
  8. package/dist-client/bootstrap.js +10 -0
  9. package/dist-client/bootstrap.js.map +1 -0
  10. package/dist-client/index.d.ts +5 -0
  11. package/dist-client/index.js +6 -0
  12. package/dist-client/index.js.map +1 -0
  13. package/dist-client/page/terminology-page.d.ts +79 -0
  14. package/dist-client/page/terminology-page.js +395 -0
  15. package/dist-client/page/terminology-page.js.map +1 -0
  16. package/dist-client/route.d.ts +1 -0
  17. package/dist-client/route.js +8 -0
  18. package/dist-client/route.js.map +1 -0
  19. package/dist-client/tsconfig.tsbuildinfo +1 -0
  20. package/dist-server/apis/index.d.ts +1 -0
  21. package/dist-server/apis/t.d.ts +6 -0
  22. package/dist-server/apis/t.js +1 -2
  23. package/dist-server/apis/t.js.map +1 -1
  24. package/dist-server/controllers/clear-cache-for-translation.d.ts +1 -0
  25. package/dist-server/controllers/clear-cache-for-translation.js +17 -0
  26. package/dist-server/controllers/clear-cache-for-translation.js.map +1 -0
  27. package/dist-server/index.d.ts +5 -0
  28. package/dist-server/index.js +1 -0
  29. package/dist-server/index.js.map +1 -1
  30. package/dist-server/middlewares/index.d.ts +1 -0
  31. package/dist-server/middlewares/index.js +1 -2
  32. package/dist-server/middlewares/index.js.map +1 -1
  33. package/dist-server/middlewares/koa-i18next/detect.d.ts +1 -0
  34. package/dist-server/middlewares/koa-i18next/detect.js +1 -1
  35. package/dist-server/middlewares/koa-i18next/detect.js.map +1 -1
  36. package/dist-server/middlewares/koa-i18next/index.d.ts +6 -0
  37. package/dist-server/middlewares/koa-i18next/index.js +1 -1
  38. package/dist-server/middlewares/koa-i18next/index.js.map +1 -1
  39. package/dist-server/middlewares/translations.d.ts +1 -0
  40. package/dist-server/middlewares/translations.js +1 -2
  41. package/dist-server/middlewares/translations.js.map +1 -1
  42. package/dist-server/routes.d.ts +1 -0
  43. package/dist-server/routes.js +66 -1
  44. package/dist-server/routes.js.map +1 -1
  45. package/dist-server/service/index.d.ts +7 -0
  46. package/dist-server/service/index.js +8 -3
  47. package/dist-server/service/index.js.map +1 -1
  48. package/dist-server/service/terminology/index.d.ts +6 -0
  49. package/dist-server/service/terminology/index.js +2 -1
  50. package/dist-server/service/terminology/index.js.map +1 -1
  51. package/dist-server/service/terminology/terminology-mutation.d.ts +11 -0
  52. package/dist-server/service/terminology/terminology-mutation.js +41 -4
  53. package/dist-server/service/terminology/terminology-mutation.js.map +1 -1
  54. package/dist-server/service/terminology/terminology-query.d.ts +11 -0
  55. package/dist-server/service/terminology/terminology-query.js +24 -3
  56. package/dist-server/service/terminology/terminology-query.js.map +1 -1
  57. package/dist-server/service/terminology/terminology-type.d.ts +21 -0
  58. package/dist-server/service/terminology/terminology-type.js +9 -9
  59. package/dist-server/service/terminology/terminology-type.js.map +1 -1
  60. package/dist-server/service/terminology/terminology.d.ts +18 -0
  61. package/dist-server/service/terminology/terminology.js +23 -6
  62. package/dist-server/service/terminology/terminology.js.map +1 -1
  63. package/dist-server/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +13 -9
  65. package/server/controllers/clear-cache-for-translation.ts +18 -0
  66. package/server/index.ts +1 -0
  67. package/server/routes.ts +85 -1
  68. package/server/service/index.ts +15 -6
  69. package/server/service/terminology/index.ts +1 -0
  70. package/server/service/terminology/terminology-mutation.ts +46 -2
  71. package/server/service/terminology/terminology-query.ts +12 -1
  72. package/server/service/terminology/terminology-type.ts +6 -6
  73. package/server/service/terminology/terminology.ts +31 -9
  74. package/things-factory.config.js +10 -2
  75. package/translations/en.json +8 -0
  76. package/translations/ja.json +8 -0
  77. package/translations/ko.json +8 -0
  78. package/translations/ms.json +8 -0
  79. package/translations/zh.json +8 -0
  80. package/client/bootstrap.js +0 -10
  81. package/client/components/i18n-msg.js +0 -9
@@ -2,6 +2,22 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const i18next_1 = tslib_1.__importDefault(require("i18next"));
5
+ const typeorm_1 = require("typeorm");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const env_1 = require("@things-factory/env");
8
+ const disableCustomTerminologyFeature = env_1.config.get('i18n/disableCustomTerminologyFeature');
9
+ const terminology_1 = require("./service/terminology/terminology");
10
+ const path = require('path');
11
+ const cacheFS = require('fs');
12
+ var fs = require('fs');
13
+ process.on('client-rebuilt', (app, compilerFileSystem) => {
14
+ /* change filesystem whenever webpacking assets done. only for development mode. */
15
+ fs = compilerFileSystem;
16
+ const cacheFileFolder = path.join('cache', 'translations');
17
+ if (cacheFS.existsSync(cacheFileFolder)) {
18
+ cacheFS.rmSync(cacheFileFolder, { recursive: true });
19
+ }
20
+ });
5
21
  process.on('bootstrap-module-global-public-route', (app, globalPublicRouter) => {
6
22
  globalPublicRouter.get('/translations/translate/:lng/:key', async (context, next) => {
7
23
  const { lng, key } = context.params;
@@ -9,10 +25,59 @@ process.on('bootstrap-module-global-public-route', (app, globalPublicRouter) =>
9
25
  context.body = translated;
10
26
  });
11
27
  globalPublicRouter.get('/translations/translate/:key', async (context, next) => {
12
- const { lng } = context.state;
13
28
  const { key } = context.params;
14
29
  const translated = context.t(key);
15
30
  context.body = translated;
16
31
  });
17
32
  });
33
+ process.on('bootstrap-module-domain-public-route', (app, domainPublicRouter) => {
34
+ domainPublicRouter.get('/domain/:subdomain/translations/:filename', async (context, next) => {
35
+ const { subdomain, filename } = context.params;
36
+ const { domain } = context.state;
37
+ const locale = (filename || 'en.json').split('.')[0];
38
+ // context.set('Cache-Control', 'public, max-age=31536000') // 캐시 기간 설정 : 1년
39
+ // context.set('Expires', new Date(Date.now() + 31536000000).toUTCString()) // 캐시 만료일 설정
40
+ if (disableCustomTerminologyFeature) {
41
+ var file = fs.readFileSync(path.resolve(path.join('dist-app', 'translations', filename)));
42
+ context.type = 'application/json';
43
+ context.body = file;
44
+ return;
45
+ }
46
+ const cacheFileFolder = path.join('cache', 'translations', subdomain);
47
+ const cacheFilePath = path.join(cacheFileFolder, filename);
48
+ if (cacheFS.existsSync(cacheFilePath)) {
49
+ var file = cacheFS.readFileSync(cacheFilePath);
50
+ }
51
+ else {
52
+ var file = fs.readFileSync(path.resolve(path.join('dist-app', 'translations', filename)));
53
+ try {
54
+ const terminologies = await (0, shell_1.getRepository)(terminology_1.Terminology).find({
55
+ where: { domain: { id: domain.id }, locale: (0, typeorm_1.ILike)(locale + '%') }
56
+ });
57
+ const json = JSON.parse(file);
58
+ terminologies.forEach(term => {
59
+ const { name, category, display } = term;
60
+ json[`${category}.${name}`] = display;
61
+ });
62
+ try {
63
+ if (!cacheFS.existsSync(cacheFileFolder)) {
64
+ cacheFS.mkdirSync(cacheFileFolder, { recursive: true });
65
+ }
66
+ cacheFS.writeFileSync(cacheFilePath, JSON.stringify(json));
67
+ }
68
+ catch (err) {
69
+ console.error(err);
70
+ }
71
+ context.type = 'application/json';
72
+ context.body = json;
73
+ return;
74
+ }
75
+ catch (err) {
76
+ console.error(err);
77
+ }
78
+ }
79
+ context.type = 'application/json';
80
+ context.body = file;
81
+ });
82
+ });
18
83
  //# sourceMappingURL=routes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;;AAAA,8DAA6B;AAE7B,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF,kBAAkB,CAAC,GAAG,CAAC,mCAAmC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAClF,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,MAAM,CAAA;QACnC,MAAM,UAAU,GAAG,iBAAO,CAAC,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAA;QAEvE,OAAO,CAAC,IAAI,GAAG,UAAU,CAAA;IAC3B,CAAC,CAAC,CAAA;IAEF,kBAAkB,CAAC,GAAG,CAAC,8BAA8B,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC7E,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC7B,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,MAAM,CAAA;QAC9B,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QAEjC,OAAO,CAAC,IAAI,GAAG,UAAU,CAAA;IAC3B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import i18next from 'i18next'\n\nprocess.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {\n globalPublicRouter.get('/translations/translate/:lng/:key', async (context, next) => {\n const { lng, key } = context.params\n const translated = i18next.getFixedT(lng, 'translations' /* ns */)(key)\n\n context.body = translated\n })\n\n globalPublicRouter.get('/translations/translate/:key', async (context, next) => {\n const { lng } = context.state\n const { key } = context.params\n const translated = context.t(key)\n\n context.body = translated\n })\n})\n"]}
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;;AAAA,8DAA6B;AAC7B,qCAA+B;AAE/B,iDAAqD;AACrD,6CAA4C;AAE5C,MAAM,+BAA+B,GAAG,YAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAA;AAE1F,mEAA+D;AAE/D,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAC7B,IAAI,EAAE,GAAG,OAAO,CAAC,IA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{ getRepository } from '@things-factory/shell'\nimport { config } from '@things-factory/env'\n\nconst disableCustomTerminologyFeature = config.get('i18n/disableCustomTerminologyFeature')\n\nimport { Terminology } from './service/terminology/terminology'\n\nconst path = require('path')\nconst cacheFS = require('fs')\nvar fs = require('fs')\n\nprocess.on('client-rebuilt' as any, (app, compilerFileSystem) => {\n /* change filesystem whenever webpacking assets done. only for development mode. */\n fs = compilerFileSystem\n\n const cacheFileFolder = path.join('cache', 'translations')\n\n if (cacheFS.existsSync(cacheFileFolder)) {\n cacheFS.rmSync(cacheFileFolder, { recursive: true })\n }\n})\n\nprocess.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {\n globalPublicRouter.get('/translations/translate/:lng/:key', async (context, next) => {\n const { lng, key } = context.params\n const translated = i18next.getFixedT(lng, 'translations' /* ns */)(key)\n\n context.body = translated\n })\n\n globalPublicRouter.get('/translations/translate/:key', async (context, next) => {\n const { key } = context.params\n const translated = context.t(key)\n\n context.body = translated\n })\n})\n\nprocess.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {\n domainPublicRouter.get('/domain/:subdomain/translations/:filename', async (context, next) => {\n const { subdomain, filename } = context.params\n const { domain } = context.state\n\n const locale = (filename || 'en.json').split('.')[0]\n\n // context.set('Cache-Control', 'public, max-age=31536000') // 캐시 기간 설정 : 1년\n // context.set('Expires', new Date(Date.now() + 31536000000).toUTCString()) // 캐시 만료일 설정\n\n if (disableCustomTerminologyFeature) {\n var file = fs.readFileSync(path.resolve(path.join('dist-app', 'translations', filename)))\n\n context.type = 'application/json'\n context.body = file\n return\n }\n\n const cacheFileFolder = path.join('cache', 'translations', subdomain)\n const cacheFilePath = path.join(cacheFileFolder, filename)\n\n if (cacheFS.existsSync(cacheFilePath)) {\n var file = cacheFS.readFileSync(cacheFilePath)\n } else {\n var file = fs.readFileSync(path.resolve(path.join('dist-app', 'translations', filename)))\n\n try {\n const terminologies = await getRepository(Terminology).find({\n where: { domain: { id: domain.id }, locale: ILike(locale + '%') }\n })\n\n const json = JSON.parse(file)\n\n terminologies.forEach(term => {\n const { name, category, display } = term\n json[`${category}.${name}`] = display\n })\n\n try {\n if (!cacheFS.existsSync(cacheFileFolder)) {\n cacheFS.mkdirSync(cacheFileFolder, { recursive: true })\n }\n\n cacheFS.writeFileSync(cacheFilePath, JSON.stringify(json))\n } catch (err) {\n console.error(err)\n }\n\n context.type = 'application/json'\n context.body = json\n\n return\n } catch (err) {\n console.error(err)\n }\n }\n\n context.type = 'application/json'\n context.body = file\n })\n})\n"]}
@@ -0,0 +1,7 @@
1
+ export * from './terminology/terminology';
2
+ export * from './terminology/terminology-type';
3
+ export declare const entities: typeof import("./terminology/terminology").Terminology[];
4
+ export declare const subscribers: any[];
5
+ export declare const schema: {
6
+ resolverClasses: (typeof import("./terminology/terminology-query").TerminologyQuery | typeof import("./terminology/terminology-mutation").TerminologyMutation)[];
7
+ };
@@ -1,19 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.schema = exports.entities = void 0;
3
+ exports.schema = exports.subscribers = exports.entities = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  /* EXPORT ENTITY TYPES */
6
6
  tslib_1.__exportStar(require("./terminology/terminology"), exports);
7
+ tslib_1.__exportStar(require("./terminology/terminology-type"), exports);
7
8
  /* IMPORT ENTITIES AND RESOLVERS */
8
9
  const terminology_1 = require("./terminology");
9
10
  exports.entities = [
10
11
  /* ENTITIES */
11
- ...terminology_1.entities,
12
+ ...terminology_1.entities
13
+ ];
14
+ exports.subscribers = [
15
+ /* SUBSCRIBERS */
16
+ ...terminology_1.subscribers
12
17
  ];
13
18
  exports.schema = {
14
19
  resolverClasses: [
15
20
  /* RESOLVER CLASSES */
16
- ...terminology_1.resolvers,
21
+ ...terminology_1.resolvers
17
22
  ]
18
23
  };
19
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,oEAAyC;AAEzC,mCAAmC;AACnC,+CAAkG;AAErF,QAAA,QAAQ,GAAG;IACtB,cAAc;IACf,GAAG,sBAAmB;CACtB,CAAA;AAGY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACxB,GAAG,uBAAoB;KACtB;CACF,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './terminology/terminology'\n\n/* IMPORT ENTITIES AND RESOLVERS */\nimport { entities as TerminologyEntities, resolvers as TerminologyResolvers } from './terminology'\n\nexport const entities = [ \n /* ENTITIES */\n\t...TerminologyEntities,\n] \n\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n\t\t...TerminologyResolvers,\n ] \n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,oEAAyC;AACzC,yEAA8C;AAE9C,mCAAmC;AACnC,+CAIsB;AAET,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,sBAAmB;CACvB,CAAA;AAEY,QAAA,WAAW,GAAG;IACzB,iBAAiB;IACjB,GAAG,yBAAsB;CAC1B,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACtB,GAAG,uBAAoB;KACxB;CACF,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './terminology/terminology'\nexport * from './terminology/terminology-type'\n\n/* IMPORT ENTITIES AND RESOLVERS */\nimport {\n entities as TerminologyEntities,\n resolvers as TerminologyResolvers,\n subscribers as TerminologySubscribers\n} from './terminology'\n\nexport const entities = [\n /* ENTITIES */\n ...TerminologyEntities\n]\n\nexport const subscribers = [\n /* SUBSCRIBERS */\n ...TerminologySubscribers\n]\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n ...TerminologyResolvers\n ]\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { Terminology } from './terminology';
2
+ import { TerminologyQuery } from './terminology-query';
3
+ import { TerminologyMutation } from './terminology-mutation';
4
+ export declare const entities: (typeof Terminology)[];
5
+ export declare const resolvers: (typeof TerminologyQuery | typeof TerminologyMutation)[];
6
+ export declare const subscribers: any[];
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolvers = exports.entities = void 0;
3
+ exports.subscribers = exports.resolvers = exports.entities = void 0;
4
4
  const terminology_1 = require("./terminology");
5
5
  const terminology_query_1 = require("./terminology-query");
6
6
  const terminology_mutation_1 = require("./terminology-mutation");
7
7
  exports.entities = [terminology_1.Terminology];
8
8
  exports.resolvers = [terminology_query_1.TerminologyQuery, terminology_mutation_1.TerminologyMutation];
9
+ exports.subscribers = [];
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/terminology/index.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,2DAAsD;AACtD,iEAA4D;AAE/C,QAAA,QAAQ,GAAG,CAAC,yBAAW,CAAC,CAAA;AACxB,QAAA,SAAS,GAAG,CAAC,oCAAgB,EAAE,0CAAmB,CAAC,CAAA","sourcesContent":["import { Terminology } from './terminology'\nimport { TerminologyQuery } from './terminology-query'\nimport { TerminologyMutation } from './terminology-mutation'\n\nexport const entities = [Terminology]\nexport const resolvers = [TerminologyQuery, TerminologyMutation]\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/terminology/index.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,2DAAsD;AACtD,iEAA4D;AAE/C,QAAA,QAAQ,GAAG,CAAC,yBAAW,CAAC,CAAA;AACxB,QAAA,SAAS,GAAG,CAAC,oCAAgB,EAAE,0CAAmB,CAAC,CAAA;AACnD,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { Terminology } from './terminology'\nimport { TerminologyQuery } from './terminology-query'\nimport { TerminologyMutation } from './terminology-mutation'\n\nexport const entities = [Terminology]\nexport const resolvers = [TerminologyQuery, TerminologyMutation]\nexport const subscribers = []\n"]}
@@ -0,0 +1,11 @@
1
+ import { Terminology } from './terminology';
2
+ import { NewTerminology, TerminologyPatch } from './terminology-type';
3
+ export declare class TerminologyMutation {
4
+ createTerminology(terminology: NewTerminology, context: any): Promise<Terminology>;
5
+ updateTerminology(id: string, patch: TerminologyPatch, context: any): Promise<Terminology>;
6
+ updateMultipleTerminologies(patches: TerminologyPatch[], context: any): Promise<Terminology[]>;
7
+ clearTranslationsCache(context: any): Promise<boolean>;
8
+ deleteTerminology(id: string, context: any): Promise<boolean>;
9
+ deleteTerminologies(ids: string[], context: any): Promise<boolean>;
10
+ importTerminologies(terminologies: TerminologyPatch[], context: any): Promise<boolean>;
11
+ }
@@ -6,10 +6,22 @@ const type_graphql_1 = require("type-graphql");
6
6
  const typeorm_1 = require("typeorm");
7
7
  const terminology_1 = require("./terminology");
8
8
  const terminology_type_1 = require("./terminology-type");
9
+ const clear_cache_for_translation_1 = require("../../controllers/clear-cache-for-translation");
10
+ function clearCache(subdomain) {
11
+ /** multiple update/delete시 모든 엔티티에 대해서 subscription 이 걸리므로, EventSubscriber를 사용하지 않음. */
12
+ try {
13
+ (0, clear_cache_for_translation_1.clearTranslationCacheForCertainDomain)(subdomain);
14
+ }
15
+ catch (err) {
16
+ console.error('Failed to delete the translations cache directory:', err);
17
+ }
18
+ }
9
19
  let TerminologyMutation = class TerminologyMutation {
10
20
  async createTerminology(terminology, context) {
11
21
  const { domain, user, tx } = context.state;
12
- return await tx.getRepository(terminology_1.Terminology).save(Object.assign(Object.assign({}, terminology), { domain, creator: user, updater: user }));
22
+ const result = await tx.getRepository(terminology_1.Terminology).save(Object.assign(Object.assign({}, terminology), { domain, creator: user, updater: user }));
23
+ clearCache(domain.subdomain);
24
+ return result;
13
25
  }
14
26
  async updateTerminology(id, patch, context) {
15
27
  const { domain, user, tx } = context.state;
@@ -17,7 +29,9 @@ let TerminologyMutation = class TerminologyMutation {
17
29
  const terminology = await repository.findOne({
18
30
  where: { domain: { id: domain.id }, id }
19
31
  });
20
- return await repository.save(Object.assign(Object.assign(Object.assign({}, terminology), patch), { updater: user }));
32
+ const result = await repository.save(Object.assign(Object.assign(Object.assign({}, terminology), patch), { updater: user }));
33
+ clearCache(domain.subdomain);
34
+ return result;
21
35
  }
22
36
  async updateMultipleTerminologies(patches, context) {
23
37
  const { domain, user, tx } = context.state;
@@ -40,11 +54,18 @@ let TerminologyMutation = class TerminologyMutation {
40
54
  results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
41
55
  }
42
56
  }
57
+ clearCache(domain.subdomain);
43
58
  return results;
44
59
  }
60
+ async clearTranslationsCache(context) {
61
+ const { domain, tx } = context.state;
62
+ clearCache(domain.subdomain);
63
+ return true;
64
+ }
45
65
  async deleteTerminology(id, context) {
46
66
  const { domain, tx } = context.state;
47
67
  await tx.getRepository(terminology_1.Terminology).delete({ domain: { id: domain.id }, id });
68
+ clearCache(domain.subdomain);
48
69
  return true;
49
70
  }
50
71
  async deleteTerminologies(ids, context) {
@@ -53,6 +74,7 @@ let TerminologyMutation = class TerminologyMutation {
53
74
  domain: { id: domain.id },
54
75
  id: (0, typeorm_1.In)(ids)
55
76
  });
77
+ clearCache(domain.subdomain);
56
78
  return true;
57
79
  }
58
80
  async importTerminologies(terminologies, context) {
@@ -60,11 +82,14 @@ let TerminologyMutation = class TerminologyMutation {
60
82
  await Promise.all(terminologies.map(async (terminology) => {
61
83
  const createdTerminology = await tx.getRepository(terminology_1.Terminology).save(Object.assign({ domain }, terminology));
62
84
  }));
85
+ clearCache(domain.subdomain);
63
86
  return true;
64
87
  }
65
88
  };
89
+ exports.TerminologyMutation = TerminologyMutation;
66
90
  tslib_1.__decorate([
67
91
  (0, type_graphql_1.Directive)('@transaction'),
92
+ (0, type_graphql_1.Directive)('@privilege(category: "terminology", privilege: "mutation", domainOwnerGranted: true)'),
68
93
  (0, type_graphql_1.Mutation)(returns => terminology_1.Terminology, { description: 'To create new Terminology' }),
69
94
  tslib_1.__param(0, (0, type_graphql_1.Arg)('terminology')),
70
95
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -74,6 +99,7 @@ tslib_1.__decorate([
74
99
  ], TerminologyMutation.prototype, "createTerminology", null);
75
100
  tslib_1.__decorate([
76
101
  (0, type_graphql_1.Directive)('@transaction'),
102
+ (0, type_graphql_1.Directive)('@privilege(category: "terminology", privilege: "mutation", domainOwnerGranted: true)'),
77
103
  (0, type_graphql_1.Mutation)(returns => terminology_1.Terminology, { description: 'To modify Terminology information' }),
78
104
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
79
105
  tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
@@ -84,6 +110,7 @@ tslib_1.__decorate([
84
110
  ], TerminologyMutation.prototype, "updateTerminology", null);
85
111
  tslib_1.__decorate([
86
112
  (0, type_graphql_1.Directive)('@transaction'),
113
+ (0, type_graphql_1.Directive)('@privilege(category: "terminology", privilege: "mutation", domainOwnerGranted: true)'),
87
114
  (0, type_graphql_1.Mutation)(returns => [terminology_1.Terminology], { description: "To modify multiple Terminologies' information" }),
88
115
  tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [terminology_type_1.TerminologyPatch])),
89
116
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -93,6 +120,15 @@ tslib_1.__decorate([
93
120
  ], TerminologyMutation.prototype, "updateMultipleTerminologies", null);
94
121
  tslib_1.__decorate([
95
122
  (0, type_graphql_1.Directive)('@transaction'),
123
+ (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To clear translations cache' }),
124
+ tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
125
+ tslib_1.__metadata("design:type", Function),
126
+ tslib_1.__metadata("design:paramtypes", [Object]),
127
+ tslib_1.__metadata("design:returntype", Promise)
128
+ ], TerminologyMutation.prototype, "clearTranslationsCache", null);
129
+ tslib_1.__decorate([
130
+ (0, type_graphql_1.Directive)('@transaction'),
131
+ (0, type_graphql_1.Directive)('@privilege(category: "terminology", privilege: "mutation", domainOwnerGranted: true)'),
96
132
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Terminology' }),
97
133
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
98
134
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -102,6 +138,7 @@ tslib_1.__decorate([
102
138
  ], TerminologyMutation.prototype, "deleteTerminology", null);
103
139
  tslib_1.__decorate([
104
140
  (0, type_graphql_1.Directive)('@transaction'),
141
+ (0, type_graphql_1.Directive)('@privilege(category: "terminology", privilege: "mutation", domainOwnerGranted: true)'),
105
142
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Terminologies' }),
106
143
  tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
107
144
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -111,6 +148,7 @@ tslib_1.__decorate([
111
148
  ], TerminologyMutation.prototype, "deleteTerminologies", null);
112
149
  tslib_1.__decorate([
113
150
  (0, type_graphql_1.Directive)('@transaction'),
151
+ (0, type_graphql_1.Directive)('@privilege(category: "terminology", privilege: "mutation", domainOwnerGranted: true)'),
114
152
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Terminologies' }),
115
153
  tslib_1.__param(0, (0, type_graphql_1.Arg)('terminologies', type => [terminology_type_1.TerminologyPatch])),
116
154
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
@@ -118,8 +156,7 @@ tslib_1.__decorate([
118
156
  tslib_1.__metadata("design:paramtypes", [Array, Object]),
119
157
  tslib_1.__metadata("design:returntype", Promise)
120
158
  ], TerminologyMutation.prototype, "importTerminologies", null);
121
- TerminologyMutation = tslib_1.__decorate([
159
+ exports.TerminologyMutation = TerminologyMutation = tslib_1.__decorate([
122
160
  (0, type_graphql_1.Resolver)(terminology_1.Terminology)
123
161
  ], TerminologyMutation);
124
- exports.TerminologyMutation = TerminologyMutation;
125
162
  //# sourceMappingURL=terminology-mutation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"terminology-mutation.js","sourceRoot":"","sources":["../../../server/service/terminology/terminology-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,+CAA2C;AAC3C,yDAAqE;AAG9D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGxB,AAAN,KAAK,CAAC,iBAAiB,CAAqB,WAA2B,EAAS,OAAY;QAC1F,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,yBAAW,CAAC,CAAC,IAAI,iCAC1C,WAAW,KACd,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,iBAAiB,CACV,EAAU,EACP,KAAuB,EAC9B,OAAY;QAEnB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,yBAAW,CAAC,CAAA;QAChD,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YAC3C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;QAEF,OAAO,MAAM,UAAU,CAAC,IAAI,+CACvB,WAAW,GACX,KAAK,KACR,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,2BAA2B,CACa,OAA2B,EAChE,OAAY;QAEnB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK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,EAAE,kCAAkC,EAAE,CAAC;IACvD,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DAS5E;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAE/E,mBAAA,IAAA,kBAAG,EAAC,eAAe,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,mCAAgB,CAAC,CAAC,CAAA;IAChD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DAWP;AAtHU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,yBAAW,CAAC;GACT,mBAAmB,CAuH/B;AAvHY,kDAAmB","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { Terminology } from './terminology'\nimport { NewTerminology, TerminologyPatch } from './terminology-type'\n\n@Resolver(Terminology)\nexport class TerminologyMutation {\n @Directive('@transaction')\n @Mutation(returns => Terminology, { description: 'To create new Terminology' })\n async createTerminology(@Arg('terminology') terminology: NewTerminology, @Ctx() context: any): Promise<Terminology> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(Terminology).save({\n ...terminology,\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => Terminology, { description: 'To modify Terminology information' })\n async updateTerminology(\n @Arg('id') id: string,\n @Arg('patch') patch: TerminologyPatch,\n @Ctx() context: any\n ): Promise<Terminology> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Terminology)\n const terminology = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n return await repository.save({\n ...terminology,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [Terminology], { description: \"To modify multiple Terminologies' information\" })\n async updateMultipleTerminologies(\n @Arg('patches', type => [TerminologyPatch]) patches: TerminologyPatch[],\n @Ctx() context: any\n ): Promise<Terminology[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const terminologyRepo = tx.getRepository(Terminology)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await terminologyRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const terminology = await terminologyRepo.findOneBy({ id: newRecord.id })\n\n const result = await terminologyRepo.save({\n ...terminology,\n ...newRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete Terminology' })\n async deleteTerminology(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Terminology).delete({ domain: { id: domain.id }, id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple Terminologies' })\n async deleteTerminologies(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Terminology).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple Terminologies' })\n async importTerminologies(\n @Arg('terminologies', type => [TerminologyPatch]) terminologies: TerminologyPatch[],\n @Ctx() context: any\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n terminologies.map(async (terminology: TerminologyPatch) => {\n const createdTerminology: Terminology = await tx.getRepository(Terminology).save({ domain, ...terminology })\n })\n )\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"terminology-mutation.js","sourceRoot":"","sources":["../../../server/service/terminology/terminology-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,+CAA2C;AAC3C,yDAAqE;AAErE,+FAAqG;AAErG,SAAS,UAAU,CAAC,SAAiB;IACnC,yFAAyF;IACzF,IAAI,CAAC;QACH,IAAA,mEAAqC,EAAC,SAAS,CAAC,CAAA;IAClD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,oDAAoD,EAAE,GAAG,CAAC,CAAA;IAC1E,CAAC;AACH,CAAC;AAGM,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAIxB,AAAN,KAAK,CAAC,iBAAiB,CAAqB,WAA2B,EAAS,OAAY;QAC1F,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,yBAAW,CAAC,CAAC,IAAI,iCAClD,WAAW,KACd,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QAE5B,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,iBAAiB,CACV,EAAU,EACP,KAAuB,EAC9B,OAAY;QAEnB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,yBAAW,CAAC,CAAA;QAChD,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YAC3C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAA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CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IACvD,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DAW5E;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,sFAAsF,CAAC;IACjG,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAE/E,mBAAA,IAAA,kBAAG,EAAC,eAAe,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,mCAAgB,CAAC,CAAC,CAAA;IAChD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DAaP;8BAvJU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,yBAAW,CAAC;GACT,mBAAmB,CAwJ/B","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { Terminology } from './terminology'\nimport { NewTerminology, TerminologyPatch } from './terminology-type'\n\nimport { clearTranslationCacheForCertainDomain } from '../../controllers/clear-cache-for-translation'\n\nfunction clearCache(subdomain: string) {\n /** multiple update/delete시 모든 엔티티에 대해서 subscription 이 걸리므로, EventSubscriber를 사용하지 않음. */\n try {\n clearTranslationCacheForCertainDomain(subdomain)\n } catch (err) {\n console.error('Failed to delete the translations cache directory:', err)\n }\n}\n\n@Resolver(Terminology)\nexport class TerminologyMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"terminology\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Terminology, { description: 'To create new Terminology' })\n async createTerminology(@Arg('terminology') terminology: NewTerminology, @Ctx() context: any): Promise<Terminology> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(Terminology).save({\n ...terminology,\n domain,\n creator: user,\n updater: user\n })\n\n clearCache(domain.subdomain)\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"terminology\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Terminology, { description: 'To modify Terminology information' })\n async updateTerminology(\n @Arg('id') id: string,\n @Arg('patch') patch: TerminologyPatch,\n @Ctx() context: any\n ): Promise<Terminology> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Terminology)\n const terminology = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...terminology,\n ...patch,\n updater: user\n })\n\n clearCache(domain.subdomain)\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"terminology\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [Terminology], { description: \"To modify multiple Terminologies' information\" })\n async updateMultipleTerminologies(\n @Arg('patches', type => [TerminologyPatch]) patches: TerminologyPatch[],\n @Ctx() context: any\n ): Promise<Terminology[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const terminologyRepo = tx.getRepository(Terminology)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await terminologyRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const terminology = await terminologyRepo.findOneBy({ id: newRecord.id })\n\n const result = await terminologyRepo.save({\n ...terminology,\n ...newRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n clearCache(domain.subdomain)\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To clear translations cache' })\n async clearTranslationsCache(@Ctx() context: any): Promise<boolean> {\n const { domain, tx } = context.state\n\n clearCache(domain.subdomain)\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"terminology\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete Terminology' })\n async deleteTerminology(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Terminology).delete({ domain: { id: domain.id }, id })\n\n clearCache(domain.subdomain)\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"terminology\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple Terminologies' })\n async deleteTerminologies(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Terminology).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n clearCache(domain.subdomain)\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"terminology\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple Terminologies' })\n async importTerminologies(\n @Arg('terminologies', type => [TerminologyPatch]) terminologies: TerminologyPatch[],\n @Ctx() context: any\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n terminologies.map(async (terminology: TerminologyPatch) => {\n const createdTerminology: Terminology = await tx.getRepository(Terminology).save({ domain, ...terminology })\n })\n )\n\n clearCache(domain.subdomain)\n\n return true\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { Domain, ListParam } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ import { Terminology } from './terminology';
4
+ import { TerminologyList } from './terminology-type';
5
+ export declare class TerminologyQuery {
6
+ terminology(id: string, context: any): Promise<Terminology>;
7
+ terminologies(params: ListParam, context: any): Promise<TerminologyList>;
8
+ domain(terminology: Terminology): Promise<Domain>;
9
+ updater(terminology: Terminology): Promise<User>;
10
+ creator(terminology: Terminology): Promise<User>;
11
+ }
@@ -4,6 +4,7 @@ exports.TerminologyQuery = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
6
  const shell_1 = require("@things-factory/shell");
7
+ const auth_base_1 = require("@things-factory/auth-base");
7
8
  const terminology_1 = require("./terminology");
8
9
  const terminology_type_1 = require("./terminology-type");
9
10
  let TerminologyQuery = class TerminologyQuery {
@@ -27,7 +28,14 @@ let TerminologyQuery = class TerminologyQuery {
27
28
  async domain(terminology) {
28
29
  return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: terminology.domainId });
29
30
  }
31
+ async updater(terminology) {
32
+ return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: terminology.updaterId });
33
+ }
34
+ async creator(terminology) {
35
+ return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: terminology.creatorId });
36
+ }
30
37
  };
38
+ exports.TerminologyQuery = TerminologyQuery;
31
39
  tslib_1.__decorate([
32
40
  (0, type_graphql_1.Query)(returns => terminology_1.Terminology, { description: 'To fetch a Terminology' }),
33
41
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
@@ -38,7 +46,7 @@ tslib_1.__decorate([
38
46
  ], TerminologyQuery.prototype, "terminology", null);
39
47
  tslib_1.__decorate([
40
48
  (0, type_graphql_1.Query)(returns => terminology_type_1.TerminologyList, { description: 'To fetch multiple Terminologies' }),
41
- tslib_1.__param(0, (0, type_graphql_1.Args)()),
49
+ tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
42
50
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
43
51
  tslib_1.__metadata("design:type", Function),
44
52
  tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
@@ -51,8 +59,21 @@ tslib_1.__decorate([
51
59
  tslib_1.__metadata("design:paramtypes", [terminology_1.Terminology]),
52
60
  tslib_1.__metadata("design:returntype", Promise)
53
61
  ], TerminologyQuery.prototype, "domain", null);
54
- TerminologyQuery = tslib_1.__decorate([
62
+ tslib_1.__decorate([
63
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
64
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
65
+ tslib_1.__metadata("design:type", Function),
66
+ tslib_1.__metadata("design:paramtypes", [terminology_1.Terminology]),
67
+ tslib_1.__metadata("design:returntype", Promise)
68
+ ], TerminologyQuery.prototype, "updater", null);
69
+ tslib_1.__decorate([
70
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
71
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
72
+ tslib_1.__metadata("design:type", Function),
73
+ tslib_1.__metadata("design:paramtypes", [terminology_1.Terminology]),
74
+ tslib_1.__metadata("design:returntype", Promise)
75
+ ], TerminologyQuery.prototype, "creator", null);
76
+ exports.TerminologyQuery = TerminologyQuery = tslib_1.__decorate([
55
77
  (0, type_graphql_1.Resolver)(terminology_1.Terminology)
56
78
  ], TerminologyQuery);
57
- exports.TerminologyQuery = TerminologyQuery;
58
79
  //# sourceMappingURL=terminology-query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"terminology-query.js","sourceRoot":"","sources":["../../../server/service/terminology/terminology-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,iDAAuG;AAEvG,+CAA2C;AAC3C,yDAAoD;AAG7C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAErB,AAAN,KAAK,CAAC,WAAW,CAAY,EAAU,EAAS,OAAY;QAC1D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,yBAAW,CAAC,CAAC,OAAO,CAAC;YAC9C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,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CAAC;GACT,gBAAgB,CA8B5B;AA9BY,4CAAgB","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { Terminology } from './terminology'\nimport { TerminologyList } from './terminology-type'\n\n@Resolver(Terminology)\nexport class TerminologyQuery {\n @Query(returns => Terminology, { description: 'To fetch a Terminology' })\n async terminology(@Arg('id') id: string, @Ctx() context: any): Promise<Terminology> {\n const { domain } = context.state\n\n return await getRepository(Terminology).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => TerminologyList, { description: 'To fetch multiple Terminologies' })\n async terminologies(@Args() params: ListParam, @Ctx() context: any): Promise<TerminologyList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Terminology),\n searchables: ['name', 'category', 'display']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() terminology: Terminology): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: terminology.domainId })\n }\n}\n"]}
1
+ {"version":3,"file":"terminology-query.js","sourceRoot":"","sources":["../../../server/service/terminology/terminology-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,iDAAuG;AACvG,yDAAgD;AAEhD,+CAA2C;AAC3C,yDAAoD;AAG7C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAErB,AAAN,KAAK,CAAC,WAAW,CAAY,EAAU,EAAS,OAAY;QAC1D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,yBAAW,CAAC,CAAC,OAAO,CAAC;YAC9C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC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AAG,GAAE,CAAA;;;;mDAM9C;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,kCAAe,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IACjE,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,iBAAS;;qDAa7D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,yBAAW;;8CAE5C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,yBAAW;;+CAE7C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAc,yBAAW;;+CAE7C;2BAvCU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,yBAAW,CAAC;GACT,gBAAgB,CAwC5B","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nimport { Terminology } from './terminology'\nimport { TerminologyList } from './terminology-type'\n\n@Resolver(Terminology)\nexport class TerminologyQuery {\n @Query(returns => Terminology, { description: 'To fetch a Terminology' })\n async terminology(@Arg('id') id: string, @Ctx() context: any): Promise<Terminology> {\n const { domain } = context.state\n\n return await getRepository(Terminology).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => TerminologyList, { description: 'To fetch multiple Terminologies' })\n async terminologies(@Args(type => ListParam) params: ListParam, @Ctx() context: any): Promise<TerminologyList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Terminology),\n searchables: ['name', 'category', 'display']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() terminology: Terminology): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: terminology.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() terminology: Terminology): Promise<User> {\n return await getRepository(User).findOneBy({ id: terminology.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() terminology: Terminology): Promise<User> {\n return await getRepository(User).findOneBy({ id: terminology.creatorId })\n }\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { Terminology } from './terminology';
2
+ export declare class NewTerminology {
3
+ name: string;
4
+ description?: string;
5
+ locale: string;
6
+ category: string;
7
+ display: string;
8
+ }
9
+ export declare class TerminologyPatch {
10
+ id?: string;
11
+ name?: string;
12
+ description?: string;
13
+ locale?: string;
14
+ category?: string;
15
+ display?: string;
16
+ cuFlag?: string;
17
+ }
18
+ export declare class TerminologyList {
19
+ items: Terminology[];
20
+ total: number;
21
+ }
@@ -6,6 +6,7 @@ const type_graphql_1 = require("type-graphql");
6
6
  const terminology_1 = require("./terminology");
7
7
  let NewTerminology = class NewTerminology {
8
8
  };
9
+ exports.NewTerminology = NewTerminology;
9
10
  tslib_1.__decorate([
10
11
  (0, type_graphql_1.Field)(),
11
12
  tslib_1.__metadata("design:type", String)
@@ -26,12 +27,12 @@ tslib_1.__decorate([
26
27
  (0, type_graphql_1.Field)(),
27
28
  tslib_1.__metadata("design:type", String)
28
29
  ], NewTerminology.prototype, "display", void 0);
29
- NewTerminology = tslib_1.__decorate([
30
+ exports.NewTerminology = NewTerminology = tslib_1.__decorate([
30
31
  (0, type_graphql_1.InputType)()
31
32
  ], NewTerminology);
32
- exports.NewTerminology = NewTerminology;
33
33
  let TerminologyPatch = class TerminologyPatch {
34
34
  };
35
+ exports.TerminologyPatch = TerminologyPatch;
35
36
  tslib_1.__decorate([
36
37
  (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
37
38
  tslib_1.__metadata("design:type", String)
@@ -45,27 +46,27 @@ tslib_1.__decorate([
45
46
  tslib_1.__metadata("design:type", String)
46
47
  ], TerminologyPatch.prototype, "description", void 0);
47
48
  tslib_1.__decorate([
48
- (0, type_graphql_1.Field)(),
49
+ (0, type_graphql_1.Field)({ nullable: true }),
49
50
  tslib_1.__metadata("design:type", String)
50
51
  ], TerminologyPatch.prototype, "locale", void 0);
51
52
  tslib_1.__decorate([
52
- (0, type_graphql_1.Field)(),
53
+ (0, type_graphql_1.Field)({ nullable: true }),
53
54
  tslib_1.__metadata("design:type", String)
54
55
  ], TerminologyPatch.prototype, "category", void 0);
55
56
  tslib_1.__decorate([
56
- (0, type_graphql_1.Field)(),
57
+ (0, type_graphql_1.Field)({ nullable: true }),
57
58
  tslib_1.__metadata("design:type", String)
58
59
  ], TerminologyPatch.prototype, "display", void 0);
59
60
  tslib_1.__decorate([
60
61
  (0, type_graphql_1.Field)({ nullable: true }),
61
62
  tslib_1.__metadata("design:type", String)
62
63
  ], TerminologyPatch.prototype, "cuFlag", void 0);
63
- TerminologyPatch = tslib_1.__decorate([
64
+ exports.TerminologyPatch = TerminologyPatch = tslib_1.__decorate([
64
65
  (0, type_graphql_1.InputType)()
65
66
  ], TerminologyPatch);
66
- exports.TerminologyPatch = TerminologyPatch;
67
67
  let TerminologyList = class TerminologyList {
68
68
  };
69
+ exports.TerminologyList = TerminologyList;
69
70
  tslib_1.__decorate([
70
71
  (0, type_graphql_1.Field)(type => [terminology_1.Terminology]),
71
72
  tslib_1.__metadata("design:type", Array)
@@ -74,8 +75,7 @@ tslib_1.__decorate([
74
75
  (0, type_graphql_1.Field)(type => type_graphql_1.Int),
75
76
  tslib_1.__metadata("design:type", Number)
76
77
  ], TerminologyList.prototype, "total", void 0);
77
- TerminologyList = tslib_1.__decorate([
78
+ exports.TerminologyList = TerminologyList = tslib_1.__decorate([
78
79
  (0, type_graphql_1.ObjectType)()
79
80
  ], TerminologyList);
80
- exports.TerminologyList = TerminologyList;
81
81
  //# sourceMappingURL=terminology-type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"terminology-type.js","sourceRoot":"","sources":["../../../server/service/terminology/terminology-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,+CAA2C;AAGpC,IAAM,cAAc,GAApB,MAAM,cAAc;CAe1B,CAAA;AAdC;IAAC,IAAA,oBAAK,GAAE;;4CACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAEpB;IAAC,IAAA,oBAAK,GAAE;;8CACM;AAEd;IAAC,IAAA,oBAAK,GAAE;;gDACQ;AAEhB;IAAC,IAAA,oBAAK,GAAE;;+CACO;AAdJ,cAAc;IAD1B,IAAA,wBAAS,GAAE;GACC,cAAc,CAe1B;AAfY,wCAAc;AAkBpB,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAqB5B,CAAA;AApBC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CAC3B;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACN;AAEpB;IAAC,IAAA,oBAAK,GAAE;;gDACM;AAEd;IAAC,IAAA,oBAAK,GAAE;;kDACQ;AAEhB;IAAC,IAAA,oBAAK,GAAE;;iDACO;AAEf;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACX;AApBJ,gBAAgB;IAD5B,IAAA,wBAAS,GAAE;GACC,gBAAgB,CAqB5B;AArBY,4CAAgB;AAwBtB,IAAM,eAAe,GAArB,MAAM,eAAe;CAM3B,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,yBAAW,CAAC,CAAC;;8CACT;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;8CACN;AALF,eAAe;IAD3B,IAAA,yBAAU,GAAE;GACA,eAAe,CAM3B;AANY,0CAAe","sourcesContent":["import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { Terminology } from './terminology'\n\n@InputType()\nexport class NewTerminology {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field()\n locale: string\n\n @Field()\n category: string\n\n @Field()\n display: string\n}\n\n@InputType()\nexport class TerminologyPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field()\n locale: string\n\n @Field()\n category: string\n\n @Field()\n display: string\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class TerminologyList {\n @Field(type => [Terminology])\n items: Terminology[]\n\n @Field(type => Int)\n total: number\n}\n"]}
1
+ {"version":3,"file":"terminology-type.js","sourceRoot":"","sources":["../../../server/service/terminology/terminology-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,+CAA2C;AAGpC,IAAM,cAAc,GAApB,MAAM,cAAc;CAe1B,CAAA;AAfY,wCAAc;AAEzB;IADC,IAAA,oBAAK,GAAE;;4CACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAGpB;IADC,IAAA,oBAAK,GAAE;;8CACM;AAGd;IADC,IAAA,oBAAK,GAAE;;gDACQ;AAGhB;IADC,IAAA,oBAAK,GAAE;;+CACO;yBAdJ,cAAc;IAD1B,IAAA,wBAAS,GAAE;GACC,cAAc,CAe1B;AAGM,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAqB5B,CAAA;AArBY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CAC3B;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACX;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACT;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACX;2BApBJ,gBAAgB;IAD5B,IAAA,wBAAS,GAAE;GACC,gBAAgB,CAqB5B;AAGM,IAAM,eAAe,GAArB,MAAM,eAAe;CAM3B,CAAA;AANY,0CAAe;AAE1B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,yBAAW,CAAC,CAAC;;8CACT;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;8CACN;0BALF,eAAe;IAD3B,IAAA,yBAAU,GAAE;GACA,eAAe,CAM3B","sourcesContent":["import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { Terminology } from './terminology'\n\n@InputType()\nexport class NewTerminology {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field()\n locale: string\n\n @Field()\n category: string\n\n @Field()\n display: string\n}\n\n@InputType()\nexport class TerminologyPatch {\n @Field(type => ID, { 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 locale?: string\n\n @Field({ nullable: true })\n category?: string\n\n @Field({ nullable: true })\n display?: string\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class TerminologyList {\n @Field(type => [Terminology])\n items: Terminology[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import { Domain } from '@things-factory/shell';
2
+ import { User } from '@things-factory/auth-base';
3
+ export declare class Terminology {
4
+ readonly id: string;
5
+ domain?: Domain;
6
+ domainId?: string;
7
+ name?: string;
8
+ description?: string;
9
+ locale?: string;
10
+ category?: string;
11
+ display?: string;
12
+ createdAt?: Date;
13
+ updatedAt?: Date;
14
+ creator?: User;
15
+ creatorId?: string;
16
+ updater?: User;
17
+ updaterId?: string;
18
+ }