@things-factory/shell 7.0.1-beta.1 → 7.0.1-beta.12

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 (61) hide show
  1. package/client/themes/app-theme.css +9 -9
  2. package/client/themes/grist-theme.css +4 -0
  3. package/client/themes/layout-theme.css +1 -1
  4. package/dist-server/initializers/database.js.map +1 -1
  5. package/dist-server/middlewares/domain-middleware.js.map +1 -1
  6. package/dist-server/middlewares/index.js.map +1 -1
  7. package/dist-server/pubsub.js +0 -1
  8. package/dist-server/pubsub.js.map +1 -1
  9. package/dist-server/routers/global-router.js.map +1 -1
  10. package/dist-server/server-dev.js.map +1 -1
  11. package/dist-server/server.js.map +1 -1
  12. package/dist-server/service/attribute-set/attribute-set-item-type.js +5 -5
  13. package/dist-server/service/attribute-set/attribute-set-item-type.js.map +1 -1
  14. package/dist-server/service/attribute-set/attribute-set-mutation.js +2 -2
  15. package/dist-server/service/attribute-set/attribute-set-mutation.js.map +1 -1
  16. package/dist-server/service/attribute-set/attribute-set-query.js +2 -2
  17. package/dist-server/service/attribute-set/attribute-set-query.js.map +1 -1
  18. package/dist-server/service/attribute-set/attribute-set-type.js +6 -6
  19. package/dist-server/service/attribute-set/attribute-set-type.js.map +1 -1
  20. package/dist-server/service/attribute-set/attribute-set.js +2 -2
  21. package/dist-server/service/attribute-set/attribute-set.js.map +1 -1
  22. package/dist-server/service/common-types/list-param.js +9 -9
  23. package/dist-server/service/common-types/list-param.js.map +1 -1
  24. package/dist-server/service/common-types/log.js +2 -2
  25. package/dist-server/service/common-types/log.js.map +1 -1
  26. package/dist-server/service/common-types/object-ref.js +2 -2
  27. package/dist-server/service/common-types/object-ref.js.map +1 -1
  28. package/dist-server/service/common-types/scalar-any.js.map +1 -1
  29. package/dist-server/service/common-types/scalar-date.js.map +1 -1
  30. package/dist-server/service/directive-transaction/transaction.js.map +1 -1
  31. package/dist-server/service/domain/{domain-Mutation.js → domain-mutation.js} +3 -3
  32. package/dist-server/service/domain/domain-mutation.js.map +1 -0
  33. package/dist-server/service/domain/domain-query.js +2 -2
  34. package/dist-server/service/domain/domain-query.js.map +1 -1
  35. package/dist-server/service/domain/domain-types.js +6 -6
  36. package/dist-server/service/domain/domain-types.js.map +1 -1
  37. package/dist-server/service/domain/domain.js +6 -7
  38. package/dist-server/service/domain/domain.js.map +1 -1
  39. package/dist-server/service/domain/index.d.ts +1 -1
  40. package/dist-server/service/domain/index.js +2 -2
  41. package/dist-server/service/domain/index.js.map +1 -1
  42. package/dist-server/service/index.d.ts +1 -1
  43. package/dist-server/service/subscription-data/data-resolver.js +2 -2
  44. package/dist-server/service/subscription-data/data-resolver.js.map +1 -1
  45. package/dist-server/service/subscription-data/data-types.js +2 -2
  46. package/dist-server/service/subscription-data/data-types.js.map +1 -1
  47. package/dist-server/tsconfig.tsbuildinfo +1 -1
  48. package/dist-server/typeorm/encrypt-transform.js +1 -1
  49. package/dist-server/typeorm/encrypt-transform.js.map +1 -1
  50. package/dist-server/typeorm/get-data-encryption-key.js.map +1 -1
  51. package/dist-server/typeorm/json5-transform.js.map +1 -1
  52. package/dist-server/utils/condition-builder.js.map +1 -1
  53. package/dist-server/utils/get-domain.js.map +1 -1
  54. package/dist-server/utils/get-query-builder-from-list-params.js.map +1 -1
  55. package/dist-server/utils/get-times-for-period.js.map +1 -1
  56. package/dist-server/utils/list-params-converter.js.map +1 -1
  57. package/dist-server/utils/list-query-builder.js.map +1 -1
  58. package/package.json +6 -6
  59. package/server/service/domain/index.ts +1 -1
  60. package/dist-server/service/domain/domain-Mutation.js.map +0 -1
  61. /package/dist-server/service/domain/{domain-Mutation.d.ts → domain-mutation.d.ts} +0 -0
@@ -4,10 +4,10 @@ body {
4
4
  --primary-color: rgb(var(--primary-color-rgb));
5
5
  --secondary-color-rgb: 57, 78, 100;
6
6
  --secondary-color: rgb(var(--secondary-color-rgb));
7
- --focus-color: var(--theme-white-color);
7
+ --focus-color: var(--md-sys-color-on-primary);
8
8
  --primary-background-color: var(--md-sys-color-secondary);
9
9
  --secondary-background-color: #283644;
10
- --theme-white-color: #fff;
10
+ --md-sys-color-on-primary: #fff;
11
11
  --theme-black-color: rgba(0, 0, 0, 0.9);
12
12
 
13
13
  --focus-background-color: var(--md-sys-color-primary);
@@ -25,7 +25,7 @@ body {
25
25
 
26
26
  /* common style */
27
27
  --border-radius: 4px;
28
- --border-dark-color: 1px solid rgba(0, 0, 0, 0.15);
28
+ --border-dim-color: 1px solid rgba(0, 0, 0, 0.15);
29
29
  --border-light-color: 1px solid rgba(255, 255, 255, 0.3);
30
30
 
31
31
  --box-shadow: 2px 2px 3px 0px rgba(0, 0, 0, 0.1);
@@ -68,12 +68,12 @@ body {
68
68
  --icon-tiny-size: 24px;
69
69
  --icon-default-size: 36px;
70
70
  --icon-big-size: 48px;
71
- --icon-default-color: var(--theme-white-color);
71
+ --icon-default-color: var(--md-sys-color-on-primary);
72
72
 
73
73
  /* material design component themes */
74
- --mdc-theme-on-primary: var(--theme-white-color);
74
+ --mdc-theme-on-primary: var(--md-sys-color-on-primary);
75
75
  --mdc-theme-primary: var(--secondary-text-color);
76
- --mdc-theme-on-secondary: var(--theme-white-color);
76
+ --mdc-theme-on-secondary: var(--md-sys-color-on-primary);
77
77
  --mdc-theme-secondary: var(--md-sys-color-primary);
78
78
  --mdc-button-outline-color: var(--md-sys-color-primary);
79
79
  --mdc-danger-button-primary-color: var(--status-danger-color);
@@ -84,7 +84,7 @@ body {
84
84
  /* button style */
85
85
  --button-background-color: #fafbfc;
86
86
  --button-background-focus-color: var(--md-sys-color-primary);
87
- --button-border: var(--border-dark-color);
87
+ --button-border: var(--border-dim-color);
88
88
  --button-border-radius: var(--border-radius);
89
89
  --button-margin: var(--margin-default) var(--margin-default) var(--margin-default) 0;
90
90
  --button-padding: calc(var(--padding-narrow) * 1.5) var(--padding-wide);
@@ -94,13 +94,13 @@ body {
94
94
  --button-active-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);
95
95
  --button-activ-border: 1px solid var(--md-sys-color-primary);
96
96
  --button-activ-background-color: var(--md-sys-color-primary);
97
- --button-activ-color: var(--theme-white-color);
97
+ --button-activ-color: var(--md-sys-color-on-primary);
98
98
  --iconbtn-padding: var(--padding-narrow);
99
99
 
100
100
  --button-primary-background-color: var(--md-sys-color-primary);
101
101
  --button-primary-active-background-color: var(--status-success-color);
102
102
  --button-primary-padding: var(--margin-default) var(--margin-wide);
103
- --button-primary-color: var(--theme-white-color);
103
+ --button-primary-color: var(--md-sys-color-on-primary);
104
104
  --button-primary-font: bold 16px var(--theme-font);
105
105
 
106
106
  /* table style */
@@ -171,3 +171,7 @@ body {
171
171
  --data-card-create-form-padding: 7px;
172
172
  }
173
173
  }
174
+
175
+ body.dark {
176
+ --grid-container-border-color: 1px solid rgba(255, 255, 255, 0.09);
177
+ }
@@ -34,7 +34,7 @@ body {
34
34
  --button-container-button-border-radius: var(--button-border-radius);
35
35
  --button-container-button-margin: var(--button-margin);
36
36
  --button-container-button-font: bold var(--fontsize-large) var(--theme-font);
37
- --button-container-button-color: var(--theme-white-color);
37
+ --button-container-button-color: var(--md-sys-color-on-primary);
38
38
  --button-container-button-height: initial;
39
39
  --button-container-button-border: var(--button-border);
40
40
 
@@ -1 +1 @@
1
- {"version":3,"file":"database.js","sourceRoot":"","sources":["../../server/initializers/database.ts"],"names":[],"mappings":";;;AAAA,qCAAgF;AAEhF,6CAAiE;AAEjE,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAE5B,IAAI,SAAS,CAAA;AACb,IAAI;IACF,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAW,EAAE,WAAW,CAAC,CAAC,CAAA;CAC5D;AAAC,OAAO,CAAC,EAAE;IACV,SAAS,GAAG,OAAO,CAAC,iCAAiC,CAAC,CAAA;CACvD;AAED,MAAM,WAAW,GAAmC,EAAE,CAAA;AAEtD;;;;GAIG;AACH,SAAgB,aAAa,CAAC,IAAa;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AG,IAAI,oBAAU,iCAC/B,SAAS,GACT,YAAM,CAAC,GAAG,CAAC,cAAc,CAAC,EAC7B,CAAA;YACF,MAAM,aAAa,CAAC,UAAU,EAAE,CAAA;YAChC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;YAElC,YAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAA;SAClD;aAAM;YACL,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;SAChC;KACF;IAAC,OAAO,CAAC,EAAE;QACV,YAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;KAChB;AACH,CAAC,CAAA;AAlCY,QAAA,mBAAmB,uBAkC/B","sourcesContent":["import { createConnection, DataSource, EntityTarget, Repository } from 'typeorm'\n\nimport { appRootPath, config, logger } from '@things-factory/env'\n\nconst path = require('path')\n\nvar ormconfig\ntry {\n ormconfig = require(path.resolve(appRootPath, 'ormconfig'))\n} catch (e) {\n ormconfig = require('@things-factory/shell/ormconfig')\n}\n\nconst dataSources: { [name: string]: DataSource } = {}\n\n/**\n * Returns the specified DataSource by name.\n * @param {string} name - The name of the DataSource.\n * @returns {DataSource} - The DataSource with the specified name.\n */\nexport function getDataSource(name?: string): DataSource {\n return dataSources[name || 'default']\n}\n\n/**\n * Adds a new DataSource with the specified name.\n * @param {string} name - The name of the DataSource to add.\n * @param {DataSource} dataSource - The DataSource to add.\n */\nexport function addDataSource(name: string, dataSource: DataSource) {\n dataSources[name] = dataSource\n}\n\n/**\n * Removes a DataSource with the specified name.\n * @param {string} name - The name of the DataSource to remove.\n */\nexport function removeDataSource(name: string) {\n delete dataSources[name]\n}\n\n/**\n * Returns an array of all registered DataSource names.\n * @returns {string[]} - An array of DataSource names.\n */\nexport function getDataSourceNames() {\n return Object.keys(dataSources)\n}\n\n/**\n * Returns a repository for the specified entity.\n * @param {EntityTarget<X>} target - The target entity for which to get the repository.\n * @returns {Repository<X>} - The repository for the specified entity.\n */\nexport function getRepository<X>(target: EntityTarget<X>): Repository<X> {\n return getDataSource('default').getRepository<X>(target)\n}\n\n/**\n * Initializes the database connections and data sources.\n */\nexport const databaseInitializer = async () => {\n try {\n const readConnectionConfig = config.get('ormconfig')\n\n const dataSource = await createConnection({\n ...ormconfig,\n ...readConnectionConfig\n })\n\n addDataSource('default', dataSource)\n\n logger.info('Default DataSource established')\n\n if (readConnectionConfig.type == 'sqlite' && readConnectionConfig.synchronize == false) {\n await dataSource.query('PRAGMA foreign_keys=OFF')\n await dataSource.synchronize()\n await dataSource.query('PRAGMA foreign_keys=ON')\n }\n\n if (config.get('ormconfig4Tx')) {\n const dataSource4Tx = new DataSource({\n ...ormconfig,\n ...config.get('ormconfig4Tx')\n })\n await dataSource4Tx.initialize()\n addDataSource('tx', dataSource4Tx)\n\n logger.info('Transaction DataSource established')\n } else {\n addDataSource('tx', dataSource)\n }\n } catch (e) {\n logger.error(e)\n }\n}\n"]}
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../server/initializers/database.ts"],"names":[],"mappings":";;;AAAA,qCAAgF;AAEhF,6CAAiE;AAEjE,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAE5B,IAAI,SAAS,CAAA;AACb,IAAI,CAAC;IACH,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAW,EAAE,WAAW,CAAC,CAAC,CAAA;AAC7D,CAAC;AAAC,OAAO,CAAC,EAAE,CAAC;IACX,SAAS,GAAG,OAAO,CAAC,iCAAiC,CAAC,CAAA;AACxD,CAAC;AAED,MAAM,WAAW,GAAmC,EAAE,CAAA;AAEtD;;;;GAIG;AACH,SAAgB,aAAa,CAAC,IAAa;IACzC,OAAO,WAAW,CAAC,IAAI,IAAI,SAAS,CAAC,CAAA;AACvC,CAAC;AAFD,sCAEC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,IAAY,EAAE,UAAsB;IAChE,WAAW,CAAC,IAAI,CAAC,GAAG,UAAU,CAAA;AAChC,CAAC;A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YAElC,YAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAA;QACnD,CAAC;aAAM,CAAC;YACN,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,YAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC,CAAA;AAlCY,QAAA,mBAAmB,uBAkC/B","sourcesContent":["import { createConnection, DataSource, EntityTarget, Repository } from 'typeorm'\n\nimport { appRootPath, config, logger } from '@things-factory/env'\n\nconst path = require('path')\n\nvar ormconfig\ntry {\n ormconfig = require(path.resolve(appRootPath, 'ormconfig'))\n} catch (e) {\n ormconfig = require('@things-factory/shell/ormconfig')\n}\n\nconst dataSources: { [name: string]: DataSource } = {}\n\n/**\n * Returns the specified DataSource by name.\n * @param {string} name - The name of the DataSource.\n * @returns {DataSource} - The DataSource with the specified name.\n */\nexport function getDataSource(name?: string): DataSource {\n return dataSources[name || 'default']\n}\n\n/**\n * Adds a new DataSource with the specified name.\n * @param {string} name - The name of the DataSource to add.\n * @param {DataSource} dataSource - The DataSource to add.\n */\nexport function addDataSource(name: string, dataSource: DataSource) {\n dataSources[name] = dataSource\n}\n\n/**\n * Removes a DataSource with the specified name.\n * @param {string} name - The name of the DataSource to remove.\n */\nexport function removeDataSource(name: string) {\n delete dataSources[name]\n}\n\n/**\n * Returns an array of all registered DataSource names.\n * @returns {string[]} - An array of DataSource names.\n */\nexport function getDataSourceNames() {\n return Object.keys(dataSources)\n}\n\n/**\n * Returns a repository for the specified entity.\n * @param {EntityTarget<X>} target - The target entity for which to get the repository.\n * @returns {Repository<X>} - The repository for the specified entity.\n */\nexport function getRepository<X>(target: EntityTarget<X>): Repository<X> {\n return getDataSource('default').getRepository<X>(target)\n}\n\n/**\n * Initializes the database connections and data sources.\n */\nexport const databaseInitializer = async () => {\n try {\n const readConnectionConfig = config.get('ormconfig')\n\n const dataSource = await createConnection({\n ...ormconfig,\n ...readConnectionConfig\n })\n\n addDataSource('default', dataSource)\n\n logger.info('Default DataSource established')\n\n if (readConnectionConfig.type == 'sqlite' && readConnectionConfig.synchronize == false) {\n await dataSource.query('PRAGMA foreign_keys=OFF')\n await dataSource.synchronize()\n await dataSource.query('PRAGMA foreign_keys=ON')\n }\n\n if (config.get('ormconfig4Tx')) {\n const dataSource4Tx = new DataSource({\n ...ormconfig,\n ...config.get('ormconfig4Tx')\n })\n await dataSource4Tx.initialize()\n addDataSource('tx', dataSource4Tx)\n\n logger.info('Transaction DataSource established')\n } else {\n addDataSource('tx', dataSource)\n }\n } catch (e) {\n logger.error(e)\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"domain-middleware.js","sourceRoot":"","sources":["../../server/middlewares/domain-middleware.ts"],"names":[],"mappings":";;;;AAAA,oEAAkC;AAClC,oCAA2C;AAEpC,KAAK,UAAU,gBAAgB,CAAC,OAAY,EAAE,IAAS;IAC5D,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAC9B,IAAI,CAAC,MAAM,EAAE;QACX;;;;WAIG;QACH,MAAM,GAAG,MAAM,IAAA,wBAAgB,EAAC,OAAO,CAAC,CAAA;KACzC;IAED,IAAI,MAAM,EAAE;QACV,MAAM,EAAE,GAAG,oBAAS,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAC7C,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,aAAa,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAA;QAEnG,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACpD,kBAAkB;YAClB,MAAM,WAAW,GACf,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;gBACxB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;oBACpB,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBAClC,CAAC,CAAC,CAAA;YAEJ,IAAI,CAAC,WAAW,EAAE;gBAChB,OAAO,CAAC,MAAM,GAAG,GAAG,CAAA;gBACpB,OAAM;aACP;SACF;aAAM;YACL,MAAM,WAAW,GACf,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;gBACxB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;oBACpB,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBAClC,CAAC,CAAC,CAAA;YAEJ,IAAI,WAAW,EAAE;gBACf,OAAO,CAAC,MAAM,GAAG,GAAG,CAAA;gBACpB,OAAM;aACP;SACF;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5D,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACrC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAClC,CAAC,CAAC,CAAA;YAEF,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAA;YAE9B,IAAI,CAAC,IAAI,EAAE;gBACT,OAAO,CAAC,KAAK,CAAC,oBAAoB,GAAG,UAAU,CAAA;aAChD;SACF;KACF;IAED,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;IAE7B,OAAO,IAAI,EAAE,CAAA;AACf,CAAC;AAxDD,4CAwDC","sourcesContent":["import requestIp from 'request-ip'\nimport { getDomainFromURL } from '../utils'\n\nexport async function domainMiddleware(context: any, next: any) {\n var { domain } = context.state\n if (!domain) {\n /*\n * The domainType should be checked only when signin and checkin.\n * For purposes such as API calls, the target domainType may be different from the system domainType.\n * So, we don't check domainType here.\n */\n domain = await getDomainFromURL(context)\n }\n\n if (domain) {\n const ip = requestIp.getClientIp(context.req)\n const { whitelist = [], blacklist = [], protectedlist = [], privileges = [] } = domain.iplist || {}\n\n if (Array.isArray(whitelist) && whitelist.length > 0) {\n /* whitelist 우선 */\n const whitelisted =\n Array.isArray(whitelist) &&\n whitelist.some(item => {\n return new RegExp(item).test(ip)\n })\n\n if (!whitelisted) {\n context.status = 403\n return\n }\n } else {\n const blacklisted =\n Array.isArray(blacklist) &&\n blacklist.some(item => {\n return new RegExp(item).test(ip)\n })\n\n if (blacklisted) {\n context.status = 403\n return\n }\n }\n\n if (Array.isArray(protectedlist) && protectedlist.length > 0) {\n const safe = protectedlist.some(item => {\n return new RegExp(item).test(ip)\n })\n\n context.state.unsafeIP = !safe\n\n if (!safe) {\n context.state.prohibitedPrivileges = privileges\n }\n }\n }\n\n context.state.domain = domain\n\n return next()\n}\n"]}
1
+ {"version":3,"file":"domain-middleware.js","sourceRoot":"","sources":["../../server/middlewares/domain-middleware.ts"],"names":[],"mappings":";;;;AAAA,oEAAkC;AAClC,oCAA2C;AAEpC,KAAK,UAAU,gBAAgB,CAAC,OAAY,EAAE,IAAS;IAC5D,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAC9B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ;;;;WAIG;QACH,MAAM,GAAG,MAAM,IAAA,wBAAgB,EAAC,OAAO,CAAC,CAAA;IAC1C,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,EAAE,GAAG,oBAAS,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAC7C,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,aAAa,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAA;QAEnG,IAAI,KAAK,CAAC,OAAO,CAAC,S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AAM,CAAA;IAE7B,OAAO,IAAI,EAAE,CAAA;AACf,CAAC;AAxDD,4CAwDC","sourcesContent":["import requestIp from 'request-ip'\nimport { getDomainFromURL } from '../utils'\n\nexport async function domainMiddleware(context: any, next: any) {\n var { domain } = context.state\n if (!domain) {\n /*\n * The domainType should be checked only when signin and checkin.\n * For purposes such as API calls, the target domainType may be different from the system domainType.\n * So, we don't check domainType here.\n */\n domain = await getDomainFromURL(context)\n }\n\n if (domain) {\n const ip = requestIp.getClientIp(context.req)\n const { whitelist = [], blacklist = [], protectedlist = [], privileges = [] } = domain.iplist || {}\n\n if (Array.isArray(whitelist) && whitelist.length > 0) {\n /* whitelist 우선 */\n const whitelisted =\n Array.isArray(whitelist) &&\n whitelist.some(item => {\n return new RegExp(item).test(ip)\n })\n\n if (!whitelisted) {\n context.status = 403\n return\n }\n } else {\n const blacklisted =\n Array.isArray(blacklist) &&\n blacklist.some(item => {\n return new RegExp(item).test(ip)\n })\n\n if (blacklisted) {\n context.status = 403\n return\n }\n }\n\n if (Array.isArray(protectedlist) && protectedlist.length > 0) {\n const safe = protectedlist.some(item => {\n return new RegExp(item).test(ip)\n })\n\n context.state.unsafeIP = !safe\n\n if (!safe) {\n context.state.prohibitedPrivileges = privileges\n }\n }\n }\n\n context.state.domain = domain\n\n return next()\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":";;;;AAAA,6CAAoD;AAEpD,2DAAsD;AAEtD,SAAgB,eAAe,CAAC,GAAG;IACjC,GAAG,CAAC,eAAe,GAAG,YAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAA;IAEtD,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;QAC/B,YAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF;;;OAGG;IACH,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC9B,IAAI;YACF,MAAM,IAAI,EAAE,CAAA;SACb;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,MAAM,GAAG,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,KAAI,GAAG,CAAA;YACnC,OAAO,CAAC,IAAI,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,CAAA;YAE3B,yCAAyC;YACzC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;SACxC;IACH,CAAC,CAAC,CAAA;IAEF;;;OAGG;IACH,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC9B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;QAEhC,IAAI,MAAM,IAAI,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;YACnD,OAAO,MAAM,IAAA,oCAAgB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAA;SAC7C;QAED,MAAM,IAAI,EAAE,CAAA;IACd,CAAC,CAAC,CAAA;AACJ,CAAC;AApCD,0CAoCC;AAED,8DAAmC","sourcesContent":["import { config, logger } from '@things-factory/env'\n\nimport { domainMiddleware } from './domain-middleware'\n\nexport function initMiddlewares(app) {\n app.subdomainOffset = config.get('subdomainOffset', 2)\n\n app.on('error', (err, context) => {\n logger.error(err)\n })\n\n /*\n * Catching downstream errors\n * - recommend to use context.throw, context.assert\n */\n app.use(async (context, next) => {\n try {\n await next()\n } catch (err) {\n context.status = err?.status || 500\n context.body = err?.message\n\n // emitting error to app.on('error', ...)\n context.app.emit('error', err, context)\n }\n })\n\n /*\n * post:graphql 에 대해서는 domain을 확인한다.\n * graphql app을 router에 적용하지 못하기 때문임.\n */\n app.use(async (context, next) => {\n const { method, path } = context\n\n if (method == 'POST' && path.startsWith('/graphql')) {\n return await domainMiddleware(context, next)\n }\n\n await next()\n })\n}\n\nexport * from './domain-middleware'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":";;;;AAAA,6CAAoD;AAEpD,2DAAsD;AAEtD,SAAgB,eAAe,CAAC,GAAG;IACjC,GAAG,CAAC,eAAe,GAAG,YAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAA;IAEtD,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;QAC/B,YAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF;;;OAGG;IACH,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC9B,IAAI,CAAC;YACH,MAAM,IAAI,EAAE,CAAA;QACd,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,MAAM,GAAG,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,KAAI,GAAG,CAAA;YACnC,OAAO,CAAC,IAAI,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,CAAA;YAE3B,yCAAyC;YACzC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;QACzC,CAAC;IACH,CAAC,CAAC,CAAA;IAEF;;;OAGG;IACH,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC9B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;QAEhC,IAAI,MAAM,IAAI,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YACpD,OAAO,MAAM,IAAA,oCAAgB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QAC9C,CAAC;QAED,MAAM,IAAI,EAAE,CAAA;IACd,CAAC,CAAC,CAAA;AACJ,CAAC;AApCD,0CAoCC;AAED,8DAAmC","sourcesContent":["import { config, logger } from '@things-factory/env'\n\nimport { domainMiddleware } from './domain-middleware'\n\nexport function initMiddlewares(app) {\n app.subdomainOffset = config.get('subdomainOffset', 2)\n\n app.on('error', (err, context) => {\n logger.error(err)\n })\n\n /*\n * Catching downstream errors\n * - recommend to use context.throw, context.assert\n */\n app.use(async (context, next) => {\n try {\n await next()\n } catch (err) {\n context.status = err?.status || 500\n context.body = err?.message\n\n // emitting error to app.on('error', ...)\n context.app.emit('error', err, context)\n }\n })\n\n /*\n * post:graphql 에 대해서는 domain을 확인한다.\n * graphql app을 router에 적용하지 못하기 때문임.\n */\n app.use(async (context, next) => {\n const { method, path } = context\n\n if (method == 'POST' && path.startsWith('/graphql')) {\n return await domainMiddleware(context, next)\n }\n\n await next()\n })\n}\n\nexport * from './domain-middleware'\n"]}
@@ -17,7 +17,6 @@ const mqtt_1 = require("mqtt");
17
17
  const env_1 = require("@things-factory/env");
18
18
  const { middleware, host, port, nodes, topic, options } = env_1.config.get('pubsub', {});
19
19
  let pubsub;
20
- exports.pubsub = pubsub;
21
20
  switch (middleware) {
22
21
  case 'mqtt':
23
22
  //@ts-ignore
@@ -1 +1 @@
1
- {"version":3,"file":"pubsub.js","sourceRoot":"","sources":["../server/pubsub.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;AAEH,2EAAuD;AACvD,6EAAyD;AACzD,+CAA2C;AAC3C,8DAA2B;AAC3B,+BAA8B;AAE9B,6CAAoD;AAGpD,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,YAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AAElF,IAAI,MAAc,CAAA;AAwFT,wBAAM;AAtF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,CAAA;QACvB,MAAK;CACR;AAED,wEAAwE;AACxE,MAAM,WAAW,GAAG,KAAK,EAAC,GAAG,EAAC,EAAE;IAC9B,YAAY;IACZ,IAAI,MAAM,CAAC,KAAK,EAAE;QAChB,IAAI;YACF,YAAY;YACZ,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;SACrB;QAAC,OAAO,GAAG,EAAE;YACZ,YAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;SAClB;KACF;AACH,CAAC,CAAA;AAED;;GAEG;AAEH,kCAAkC;AAClC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAExE,sBAAsB;AACtB,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAE5E,oDAAoD;AACpD,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAC9E,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA","sourcesContent":["/**\n * @module pubsub\n * @description\n * This module provides a Pub/Sub (Publish/Subscribe) mechanism for handling messages and events.\n * Developers can use various middleware options such as MQTT, Redis, Redis Cluster, or Kafka\n * to implement Pub/Sub functionality.\n */\n\nimport { MQTTPubSub } from 'graphql-mqtt-subscriptions'\nimport { RedisPubSub } from 'graphql-redis-subscriptions'\nimport { createPubSub } from 'graphql-yoga'\nimport Redis from 'ioredis'\nimport { connect } from 'mqtt'\n\nimport { config, logger } from '@things-factory/env'\nimport { PubSub } from 'type-graphql'\n\nconst { middleware, host, port, nodes, topic, options } = config.get('pubsub', {})\n\nlet pubsub: PubSub\n\nswitch (middleware) {\n case 'mqtt':\n //@ts-ignore\n pubsub = new MQTTPubSub({\n client: connect('mqtt://' + host, {\n reconnectPeriod: 1000,\n ...options\n }) as any\n })\n break\n case 'redis':\n const redisOption = {\n host,\n port,\n retryStrategy: times => {\n // reconnect after\n return Math.min(times * 50, 2000)\n },\n ...options\n }\n //@ts-ignore\n pubsub = new RedisPubSub({\n publisher: new Redis(redisOption),\n subscriber: new Redis(redisOption)\n })\n break\n case 'redisCluster':\n const cluster = new Redis.Cluster(nodes, options)\n //@ts-ignore\n pubsub = new RedisPubSub({\n publisher: cluster,\n subscriber: cluster\n })\n break\n case 'kafka':\n try {\n /*\n * https://github.com/hatiolab/things-factory/issues/1239\n */\n const { KafkaPubSub } = require('graphql-kafka-subscriptions')\n pubsub = new KafkaPubSub({\n topic,\n host,\n port,\n ...options\n })\n } catch (e) {\n logger.error('graphql-kafka-subscriptions module is not installed, so application can not go further.')\n throw e\n }\n break\n default:\n pubsub = createPubSub()\n break\n}\n\n// kafka pubsub keeps connection and app port with 'ctrl+c' termination.\nconst exitHandler = async evt => {\n //@ts-ignore\n if (pubsub.close) {\n try {\n //@ts-ignore\n await pubsub.close()\n } catch (err) {\n logger.error(err)\n }\n }\n}\n\n/*\n * exit events hint from https://stackoverflow.com/a/14032965/14539284\n */\n\n//do something when app is closing\nprocess.on('exit', exitHandler.bind(null, { name: 'exit', exit: true }))\n\n//catches ctrl+c event\nprocess.on('SIGINT', exitHandler.bind(null, { name: 'SIGINT', exit: true }))\n\n// catches \"kill pid\" (for example: nodemon restart)\nprocess.on('SIGUSR1', exitHandler.bind(null, { name: 'SIGUSR1', exit: true }))\nprocess.on('SIGUSR2', exitHandler.bind(null, { name: 'SIGUSR2', exit: true }))\n\n//catches uncaught exceptions\n// process.on('uncaughtException', exitHandler.bind(null, { name: 'uncaughtException', exit: true }))\n\nexport { pubsub }\n"]}
1
+ {"version":3,"file":"pubsub.js","sourceRoot":"","sources":["../server/pubsub.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;AAEH,2EAAuD;AACvD,6EAAyD;AACzD,+CAA2C;AAC3C,8DAA2B;AAC3B,+BAA8B;AAE9B,6CAAoD;AAGpD,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,YAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AAElF,IAAI,MAAc,CAAA;AAElB,QAAQ,UAAU,EAAE,CAAC;IACnB,KAAK,MAAM;QACT,YAAY;QACZ,iBAAA,MAAM,GAAG,IAAI,uCAAU,CAAC;YACtB,MAAM,EAAE,IAAA,cAAO,EAAC,SAAS,GAAG,IAAI,kBAC9B,eAAe,EAAE,IAAI,IAClB,OAAO,EACH;SACV,CAAC,CAAA;QACF,MAAK;IACP,KAAK,OAAO;QACV,MAAM,WAAW,mBACf,IAAI;YACJ,IAAI,EACJ,aAAa,EAAE,KAAK,CAAC,EAAE;gBACrB,kBAAkB;gBAClB,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,EAAE,IAAI,CAAC,CAAA;YACnC,CAAC,IACE,OAAO,CACX,CAAA;QACD,YAAY;QACZ,iBAAA,MAAM,GAAG,IAAI,yCAAW,CAAC;YACvB,SAAS,EAAE,IAAI,iBAAK,CAAC,WAAW,CAAC;YACjC,UAAU,EAAE,IAAI,iBAAK,CAAC,WAAW,CAAC;SACnC,CAAC,CAAA;QACF,MAAK;IACP,KAAK,cAAc;QACjB,MAAM,OAAO,GAAG,IAAI,iBAAK,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACjD,YAAY;QACZ,iBAAA,MAAM,GAAG,IAAI,yCAAW,CAAC;YACvB,SAAS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I,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAC9E,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA","sourcesContent":["/**\n * @module pubsub\n * @description\n * This module provides a Pub/Sub (Publish/Subscribe) mechanism for handling messages and events.\n * Developers can use various middleware options such as MQTT, Redis, Redis Cluster, or Kafka\n * to implement Pub/Sub functionality.\n */\n\nimport { MQTTPubSub } from 'graphql-mqtt-subscriptions'\nimport { RedisPubSub } from 'graphql-redis-subscriptions'\nimport { createPubSub } from 'graphql-yoga'\nimport Redis from 'ioredis'\nimport { connect } from 'mqtt'\n\nimport { config, logger } from '@things-factory/env'\nimport { PubSub } from 'type-graphql'\n\nconst { middleware, host, port, nodes, topic, options } = config.get('pubsub', {})\n\nlet pubsub: PubSub\n\nswitch (middleware) {\n case 'mqtt':\n //@ts-ignore\n pubsub = new MQTTPubSub({\n client: connect('mqtt://' + host, {\n reconnectPeriod: 1000,\n ...options\n }) as any\n })\n break\n case 'redis':\n const redisOption = {\n host,\n port,\n retryStrategy: times => {\n // reconnect after\n return Math.min(times * 50, 2000)\n },\n ...options\n }\n //@ts-ignore\n pubsub = new RedisPubSub({\n publisher: new Redis(redisOption),\n subscriber: new Redis(redisOption)\n })\n break\n case 'redisCluster':\n const cluster = new Redis.Cluster(nodes, options)\n //@ts-ignore\n pubsub = new RedisPubSub({\n publisher: cluster,\n subscriber: cluster\n })\n break\n case 'kafka':\n try {\n /*\n * https://github.com/hatiolab/things-factory/issues/1239\n */\n const { KafkaPubSub } = require('graphql-kafka-subscriptions')\n pubsub = new KafkaPubSub({\n topic,\n host,\n port,\n ...options\n })\n } catch (e) {\n logger.error('graphql-kafka-subscriptions module is not installed, so application can not go further.')\n throw e\n }\n break\n default:\n pubsub = createPubSub()\n break\n}\n\n// kafka pubsub keeps connection and app port with 'ctrl+c' termination.\nconst exitHandler = async evt => {\n //@ts-ignore\n if (pubsub.close) {\n try {\n //@ts-ignore\n await pubsub.close()\n } catch (err) {\n logger.error(err)\n }\n }\n}\n\n/*\n * exit events hint from https://stackoverflow.com/a/14032965/14539284\n */\n\n//do something when app is closing\nprocess.on('exit', exitHandler.bind(null, { name: 'exit', exit: true }))\n\n//catches ctrl+c event\nprocess.on('SIGINT', exitHandler.bind(null, { name: 'SIGINT', exit: true }))\n\n// catches \"kill pid\" (for example: nodemon restart)\nprocess.on('SIGUSR1', exitHandler.bind(null, { name: 'SIGUSR1', exit: true }))\nprocess.on('SIGUSR2', exitHandler.bind(null, { name: 'SIGUSR2', exit: true }))\n\n//catches uncaught exceptions\n// process.on('uncaughtException', exitHandler.bind(null, { name: 'uncaughtException', exit: true }))\n\nexport { pubsub }\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"global-router.js","sourceRoot":"","sources":["../../server/routers/global-router.ts"],"names":[],"mappings":";;;;AAAA,oEAA+B;AAC/B,oEAAkC;AAElC,qFAAwE;AACxE,wEAAmE;AAEnE,IAAI,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAE/B,QAAA,kBAAkB,GAAG,IAAI,oBAAM,EAAE,CAAA;AACjC,QAAA,mBAAmB,GAAG,IAAI,oBAAM,EAAE,CAAA;AAE/C,qEAAqE;AACrE,2BAAmB,CAAC,GAAG,CAAC,oCAAgB,CAAC,CAAA;AAEzC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,YAAY,EAAE;IACxC,0BAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACzD,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAA;QAE5C,MAAM,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,eAAe,EAAE,CAAC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B,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,EAAE;IAChD,OAAO,CAAC,IAAI,GAAG;qCACoB,oBAAS,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC;;sCAEjC,OAAO,CAAC,EAAE;4CACJ,OAAO,CAAC,QAAQ;wCACpB,OAAO,CAAC,IAAI;;2CAET,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC;6CAChC,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC;4CACrC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC;4CACnC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC;GAC5E,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,2EAA2E;AAC3E,0BAAkB,CAAC,GAAG,CAAC,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACjE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;IACxB,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AACtC,CAAC,CAAC,CAAA","sourcesContent":["import Router from 'koa-router'\nimport requestIp from 'request-ip'\n\nimport { getLicenseInfo } from '@things-factory/operato-license-checker'\nimport { domainMiddleware } from '../middlewares/domain-middleware'\n\nvar crawler = require('npm-license-crawler')\n\nexport const globalPublicRouter = new Router()\nexport const globalPrivateRouter = new Router()\n\n/* even though global private router, catch domain for information */\nglobalPrivateRouter.use(domainMiddleware)\n\nif (process.env.NODE_ENV != 'production') {\n globalPublicRouter.get('/graphql', async (context, next) => {\n const initialEndpoint = context.request.href\n\n await context.render('graphql', { initialEndpoint })\n })\n}\n\nglobalPublicRouter.get('/dependencies', async (context, next) => {\n const { dependencyGraph } = require('@things-factory/env')\n\n await context.render('dependencies-view-graphviz', { model: dependencyGraph })\n})\n\nglobalPublicRouter.get('/license-info', (context, next) => {\n context.type = 'application/json'\n context.body = getLicenseInfo()\n})\n\nglobalPublicRouter.get('/opensource-licenses', (context, next) => {\n return new Promise(function (resolve, reject) {\n var options = {\n start: ['.'],\n exclude: [],\n noColor: true,\n production: true,\n unknown: false\n }\n\n crawler.dumpLicenses(options, function (error, res) {\n if (error) {\n console.error('get:/opensource-licenses', error)\n reject(error)\n } else {\n context.type = 'application/json'\n context.body = res\n resolve(res)\n }\n })\n })\n})\n\nglobalPublicRouter.get('/request-info', context => {\n context.body = `\n Client info. from \"requestIp\": ${requestIp.getClientIp(context.req)}\n\n Client info. from \"context.ip\": ${context.ip}\n Client info. from \"context.protocol\": ${context.protocol}\n Client info. from \"context.host\": ${context.host}\n\n Client info. from \"x-forwarded-for\": ${context.headers['x-forwarded-for']}\n Client info. from \"x-forwarded-proto\": ${context.headers['x-forwarded-proto']}\n Client info. from \"x-forwarded-host\": ${context.headers['x-forwarded-host']}\n Client info. from \"x-forwarded-port\": ${context.headers['x-forwarded-port']}\n `\n})\n\n/* Paths starting with /public are assumed to use the koa-view renderer. */\nglobalPublicRouter.get('/public/(.[^.]*)', async (context, next) => {\n const { path } = context\n await context.render(path.substr(1))\n})\n"]}
1
+ {"version":3,"file":"global-router.js","sourceRoot":"","sources":["../../server/routers/global-router.ts"],"names":[],"mappings":";;;;AAAA,oEAA+B;AAC/B,oEAAkC;AAElC,qFAAwE;AACxE,wEAAmE;AAEnE,IAAI,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAE/B,QAAA,kBAAkB,GAAG,IAAI,oBAAM,EAAE,CAAA;AACjC,QAAA,mBAAmB,GAAG,IAAI,oBAAM,EAAE,CAAA;AAE/C,qEAAqE;AACrE,2BAAmB,CAAC,GAAG,CAAC,oCAAgB,CAAC,CAAA;AAEzC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,YAAY,EAAE,CAAC;IACzC,0BAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACzD,MAAM,eAAe,GAAG,O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,CAAA;gBAClB,OAAO,CAAC,GAAG,CAAC,CAAA;YACd,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,0BAAkB,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,EAAE;IAChD,OAAO,CAAC,IAAI,GAAG;qCACoB,oBAAS,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC;;sCAEjC,OAAO,CAAC,EAAE;4CACJ,OAAO,CAAC,QAAQ;wCACpB,OAAO,CAAC,IAAI;;2CAET,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC;6CAChC,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC;4CACrC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC;4CACnC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC;GAC5E,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,2EAA2E;AAC3E,0BAAkB,CAAC,GAAG,CAAC,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACjE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;IACxB,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AACtC,CAAC,CAAC,CAAA","sourcesContent":["import Router from 'koa-router'\nimport requestIp from 'request-ip'\n\nimport { getLicenseInfo } from '@things-factory/operato-license-checker'\nimport { domainMiddleware } from '../middlewares/domain-middleware'\n\nvar crawler = require('npm-license-crawler')\n\nexport const globalPublicRouter = new Router()\nexport const globalPrivateRouter = new Router()\n\n/* even though global private router, catch domain for information */\nglobalPrivateRouter.use(domainMiddleware)\n\nif (process.env.NODE_ENV != 'production') {\n globalPublicRouter.get('/graphql', async (context, next) => {\n const initialEndpoint = context.request.href\n\n await context.render('graphql', { initialEndpoint })\n })\n}\n\nglobalPublicRouter.get('/dependencies', async (context, next) => {\n const { dependencyGraph } = require('@things-factory/env')\n\n await context.render('dependencies-view-graphviz', { model: dependencyGraph })\n})\n\nglobalPublicRouter.get('/license-info', (context, next) => {\n context.type = 'application/json'\n context.body = getLicenseInfo()\n})\n\nglobalPublicRouter.get('/opensource-licenses', (context, next) => {\n return new Promise(function (resolve, reject) {\n var options = {\n start: ['.'],\n exclude: [],\n noColor: true,\n production: true,\n unknown: false\n }\n\n crawler.dumpLicenses(options, function (error, res) {\n if (error) {\n console.error('get:/opensource-licenses', error)\n reject(error)\n } else {\n context.type = 'application/json'\n context.body = res\n resolve(res)\n }\n })\n })\n})\n\nglobalPublicRouter.get('/request-info', context => {\n context.body = `\n Client info. from \"requestIp\": ${requestIp.getClientIp(context.req)}\n\n Client info. from \"context.ip\": ${context.ip}\n Client info. from \"context.protocol\": ${context.protocol}\n Client info. from \"context.host\": ${context.host}\n\n Client info. from \"x-forwarded-for\": ${context.headers['x-forwarded-for']}\n Client info. from \"x-forwarded-proto\": ${context.headers['x-forwarded-proto']}\n Client info. from \"x-forwarded-host\": ${context.headers['x-forwarded-host']}\n Client info. from \"x-forwarded-port\": ${context.headers['x-forwarded-port']}\n `\n})\n\n/* Paths starting with /public are assumed to use the koa-view renderer. */\nglobalPublicRouter.get('/public/(.[^.]*)', async (context, next) => {\n const { path } = context\n await context.render(path.substr(1))\n})\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"server-dev.js","sourceRoot":"","sources":["../server/server-dev.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;AAE5B,4DAA4D;AAC5D,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AACxB,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,CAAA;AAEjD,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;AAEjE,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,aAAa,CAAA;AACp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AK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG;KAChC,CAAC,CACH,CAAA;IACD,GAAG,CAAC,GAAG,CAAC,uBAAa,CAAC,MAAM,EAAE,CAAC,CAAA;IAC/B,GAAG,CAAC,GAAG,CAAC,uBAAa,CAAC,cAAc,EAAE,CAAC,CAAA;IAEvC,uEAAuE;IACvE,GAAG,CAAC,GAAG,CAAC,IAAA,sDAAkB,EAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;IAE9C,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IAEnB,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE;QACrC,YAAM,CAAC,IAAI,CAAC,qCAAqC,IAAI,UAAU,CAAC,CAAA;QAChE,YAAM,CAAC,IAAI,CAAC,0CAA0C,IAAI,UAAU,CAAC,CAAA;QAErE,OAAO,CAAC,IAAI,CAAC,wBAA+B,EAAE,EAAE,GAAG,EAAE,MAAM,EAAN,YAAM,EAAE,WAAW,EAAE,UAAU,EAAS,CAAC,CAAA;IAChG,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,SAAS,EAAE,CAAA","sourcesContent":["// ts-import-sorter: disable\n\n/* following 7 lines should be located in top of the file */\nconst OS = require('os')\nprocess.env.UV_THREADPOOL_SIZE = OS.cpus().length\n\nconsole.log('UV_THREADPOOL_SIZE', process.env.UV_THREADPOOL_SIZE)\n\nprocess.env.NODE_ENV = 'development'\nprocess.setMaxListeners(0)\n\nimport { ApolloServer } from '@apollo/server'\nimport { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer'\nimport { ApolloServerPluginLandingPageLocalDefault } from '@apollo/server/plugin/landingPage/default'\n\nimport { koaMiddleware } from '@as-integrations/koa'\nimport bytesFormat from 'bytes'\nimport graphqlUploadKoa from 'graphql-upload/graphqlUploadKoa.js'\nimport { useServer } from 'graphql-ws/lib/use/ws'\nimport { createServer } from 'http'\nimport Koa from 'koa'\nimport koaBodyParser from 'koa-bodyparser'\nimport compose from 'koa-compose'\nimport { historyApiFallback } from 'koa2-connect-history-api-fallback'\nimport { WebSocketServer } from 'ws'\nimport co from 'co'\nimport http from 'http'\n\nimport koaWebpack from '@hatiolab/koa-webpack'\nimport cors from '@koa/cors'\nimport { config, loader, logger, orderedModuleNames } from '@things-factory/env'\nimport { initLicense, checkValidity } from '@things-factory/operato-license-checker'\n\nimport { GraphqlLocalClient } from './graphql-local-client'\nimport { databaseInitializer } from './initializers/database'\nimport {\n domainPrivateRouter,\n domainPublicRouter,\n globalPrivateRouter,\n globalPublicRouter,\n graphqlRouter\n} from './routers'\nimport { schema } from './schema'\nimport { Domain } from './service'\nimport { EntityManager } from 'typeorm'\nimport { domainMiddleware } from './middlewares'\n\nprocess.on('uncaughtException', error => {\n logger.error('uncaughtException: ', error, error.stack)\n\n //process.exit(1)\n})\n\nconst args = require('args')\n\nargs.option('port', 'The port on which the app will be running', config.get('port', 3000))\nargs.option(\n 'inspect',\n `The address on which the inspection will be running. Used in development mode only.\n This option is just to prevent termination for reasons of not recognizing the 'inspect' option.`,\n config.get('inspect', ':9229')\n)\nargs.option('webpack', 'webpack configuration file', config.get('webpack'))\n\nconst flags = args.parse(process.argv)\n\nconst webpack = require('webpack')\nconst webpackConfig = require(flags.webpack || '@things-factory/builder/webpack.config.dev.js')\n\nconst compiler = webpack(webpackConfig)\n\nconst PORT = (process.env.PORT = flags.port)\n\nconst requestBody = config.get('requestBody') || {}\n\nconst bodyParserOption = {\n formLimit: requestBody.formLimit || '10mb',\n jsonLimit: requestBody.jsonLimit || '10mb',\n textLimit: requestBody.textLimit || '10mb'\n}\n\nconst fileUpload = config.get('fileUpload') || {}\nconst fileUploadOption = {\n maxFileSize: bytesFormat.parse(fileUpload.maxFileSize) || bytesFormat.parse('10mb'),\n maxFiles: fileUpload.maxFiles || 10\n}\n\ninterface ICustomAppState {\n domain: Domain\n user: any\n tx: EntityManager\n}\n\ninterface ICustomAppContext {\n t: any\n ssoMiddlewares: any[]\n}\n\ninitLicense(config.get('licenseKey'))\n\n/* bootstrap */\nconst bootstrap = async () => {\n await databaseInitializer()\n\n const app = new Koa<ICustomAppState, ICustomAppContext>() as any\n app.proxy = true\n\n app.use(\n cors({\n origin: function (ctx) {\n return ctx.request.headers.origin || '*'\n },\n exposeHeaders: ['WWW-Authenticate', 'Server-Authorization'],\n maxAge: 5,\n credentials: true,\n /* allowMethods: ['GET', 'POST', 'DELETE'], -- use default */\n allowHeaders: ['Content-Type', 'Authorization', 'Accept']\n })\n )\n\n var subscriptionMiddleware = []\n process.emit('bootstrap-module-subscription' as any, app, subscriptionMiddleware)\n\n const builtSchema = await schema()\n\n const httpServer = createServer(app.callback())\n const websocketServer = new WebSocketServer({\n server: httpServer,\n path: '/graphql'\n })\n\n // Save the returned server's info so we can shut down this server later\n const serverCleanup = useServer(\n {\n schema: builtSchema,\n context: async (ctx, msg, args) => {\n return ctx['context']\n },\n onConnect: async ctx => {\n var { extra, connectionParams } = ctx\n var { request } = extra\n\n if (((connectionParams['headers'] as any) || connectionParams)?.referer) {\n var url = new URL(((connectionParams['headers'] as any) || connectionParams).referer)\n var accessToken = url.searchParams.get('access_token')\n if (accessToken) {\n connectionParams['headers']['authorization'] = accessToken\n }\n }\n\n request.headers = {\n ...request.headers,\n ...(connectionParams['headers'] || (connectionParams as any))\n }\n\n var koacontext = await app.createContext(request, new http.ServerResponse(request))\n koacontext['state'] = {}\n\n /* in case connect error(like a authentication error) just throw exception */\n var middlewares = [domainMiddleware, ...subscriptionMiddleware]\n const fn = co.wrap(compose(middlewares))\n\n await fn(koacontext)\n\n return (ctx['context'] = koacontext)\n },\n onDisconnect(ctx, code, reason) {\n console.log('Disconnected!')\n },\n onError(ctx, msg, errors) {\n console.error(msg, errors)\n }\n },\n websocketServer\n )\n\n const server = new ApolloServer({\n schema: builtSchema,\n formatError: error => {\n logger.error(error)\n return error\n },\n introspection: true,\n csrfPrevention: true,\n plugins: [\n // Proper shutdown for the HTTP server.\n ApolloServerPluginDrainHttpServer({ httpServer }),\n // Proper shutdown for the WebSocket server.\n {\n async serverWillStart() {\n return {\n async drainServer() {\n await serverCleanup.dispose()\n }\n }\n }\n },\n // TODO make this landing page work\n ApolloServerPluginLandingPageLocalDefault({\n footer: false,\n embed: true,\n includeCookies: true\n })\n ],\n cache: 'bounded'\n })\n\n await server.start()\n\n GraphqlLocalClient.init(builtSchema, app)\n\n orderedModuleNames.forEach(name => {\n const { initMiddlewares } = loader(name)\n initMiddlewares && initMiddlewares(app)\n })\n\n const render = require('@things-factory/ejs-remote')\n render(app, {\n root: '/views',\n host: `http://127.0.0.1:${PORT}`,\n layout: false,\n viewExt: 'html',\n cache: false,\n debug: false\n })\n\n const middleware = await koaWebpack({\n compiler,\n hotClient: {},\n devMiddleware: {\n publicPath: webpackConfig.output.publicPath,\n stats: { colors: true }\n }\n })\n\n // only for development mode. triggered after webpack compilation is done.\n compiler.hooks.done.tap({ name: 'server-dev' }, stats => {\n process.emit('client-rebuilt' as any, app, compiler.outputFileSystem)\n })\n\n app.use(koaBodyParser(bodyParserOption))\n\n /* routers */\n const ssoMiddlewares = []\n process.emit('bootstrap-collect-sso-middleware' as any, null, ssoMiddlewares)\n app.ssoMiddlewares = ssoMiddlewares\n\n process.emit('bootstrap-module-global-public-route' as any, app, globalPublicRouter)\n process.emit('bootstrap-module-global-private-route' as any, app, globalPrivateRouter)\n process.emit('bootstrap-module-domain-public-route' as any, app, domainPublicRouter)\n process.emit('bootstrap-module-domain-private-route' as any, app, domainPrivateRouter)\n\n app.use(checkValidity) /* Check the license after most of the context has been built */\n\n app\n .use(globalPublicRouter.routes())\n .use(globalPublicRouter.allowedMethods())\n .use(globalPrivateRouter.routes())\n .use(globalPrivateRouter.allowedMethods())\n .use(domainPublicRouter.routes())\n .use(domainPublicRouter.allowedMethods())\n .use(domainPrivateRouter.routes())\n .use(domainPrivateRouter.allowedMethods())\n\n /* Graphql Upload's multipart/form-data handling affects the restful file upload feature, so it should be placed after the routers configuration. */\n app.use(graphqlUploadKoa(fileUploadOption))\n\n graphqlRouter.post(\n '/graphql',\n koaMiddleware(server, {\n context: async ({ ctx }) => ctx\n })\n )\n app.use(graphqlRouter.routes())\n app.use(graphqlRouter.allowedMethods())\n\n /* should follow this order : history-fallback => webpack-middleware */\n app.use(historyApiFallback({ whiteList: [] }))\n\n app.use(middleware)\n\n httpServer.listen({ port: PORT }, () => {\n logger.info(`🚀 Server ready at http://0.0.0.0:${PORT}/graphql`)\n logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}/graphql`)\n\n process.emit('bootstrap-module-start' as any, { app, config, builtSchema, httpServer } as any)\n })\n}\n\nbootstrap()\n"]}
1
+ {"version":3,"file":"server-dev.js","sourceRoot":"","sources":["../server/server-dev.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;AAE5B,4DAA4D;AAC5D,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AACxB,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,CAAA;AAEjD,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;AAEjE,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,aAAa,CAAA;AACpC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;AAE1B,2CAA6C;AAC7C,2EAAyF;AACzF,uEAAqG;AAErG,8CAAoD;AACpD,0DAA+B;AAC/B,qGAAiE;AACjE,8CAAiD;AACjD,+BAAmC;AACnC,sDAAqB;AACrB,4EAA0C;AAC1C,sEAAiC;AACjC,yFAAsE;AACtE,2BAAoC;AACpC,oDAAmB;AACnB,wDAAuB;AAEvB,gFAA8C;AAC9C,6DAA4B;AAC5B,6CAAgF;AAChF,qFAAoF;AAEpF,iEAA2D;AAC3D,sDAA6D;AAC7D,uCAMkB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,CAAC,UAAU,CAAC,CAAA;IAEnB,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE;QACrC,YAAM,CAAC,IAAI,CAAC,qCAAqC,IAAI,UAAU,CAAC,CAAA;QAChE,YAAM,CAAC,IAAI,CAAC,0CAA0C,IAAI,UAAU,CAAC,CAAA;QAErE,OAAO,CAAC,IAAI,CAAC,wBAA+B,EAAE,EAAE,GAAG,EAAE,MAAM,EAAN,YAAM,EAAE,WAAW,EAAE,UAAU,EAAS,CAAC,CAAA;IAChG,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,SAAS,EAAE,CAAA","sourcesContent":["// ts-import-sorter: disable\n\n/* following 7 lines should be located in top of the file */\nconst OS = require('os')\nprocess.env.UV_THREADPOOL_SIZE = OS.cpus().length\n\nconsole.log('UV_THREADPOOL_SIZE', process.env.UV_THREADPOOL_SIZE)\n\nprocess.env.NODE_ENV = 'development'\nprocess.setMaxListeners(0)\n\nimport { ApolloServer } from '@apollo/server'\nimport { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer'\nimport { ApolloServerPluginLandingPageLocalDefault } from '@apollo/server/plugin/landingPage/default'\n\nimport { koaMiddleware } from '@as-integrations/koa'\nimport bytesFormat from 'bytes'\nimport graphqlUploadKoa from 'graphql-upload/graphqlUploadKoa.js'\nimport { useServer } from 'graphql-ws/lib/use/ws'\nimport { createServer } from 'http'\nimport Koa from 'koa'\nimport koaBodyParser from 'koa-bodyparser'\nimport compose from 'koa-compose'\nimport { historyApiFallback } from 'koa2-connect-history-api-fallback'\nimport { WebSocketServer } from 'ws'\nimport co from 'co'\nimport http from 'http'\n\nimport koaWebpack from '@hatiolab/koa-webpack'\nimport cors from '@koa/cors'\nimport { config, loader, logger, orderedModuleNames } from '@things-factory/env'\nimport { initLicense, checkValidity } from '@things-factory/operato-license-checker'\n\nimport { GraphqlLocalClient } from './graphql-local-client'\nimport { databaseInitializer } from './initializers/database'\nimport {\n domainPrivateRouter,\n domainPublicRouter,\n globalPrivateRouter,\n globalPublicRouter,\n graphqlRouter\n} from './routers'\nimport { schema } from './schema'\nimport { Domain } from './service'\nimport { EntityManager } from 'typeorm'\nimport { domainMiddleware } from './middlewares'\n\nprocess.on('uncaughtException', error => {\n logger.error('uncaughtException: ', error, error.stack)\n\n //process.exit(1)\n})\n\nconst args = require('args')\n\nargs.option('port', 'The port on which the app will be running', config.get('port', 3000))\nargs.option(\n 'inspect',\n `The address on which the inspection will be running. Used in development mode only.\n This option is just to prevent termination for reasons of not recognizing the 'inspect' option.`,\n config.get('inspect', ':9229')\n)\nargs.option('webpack', 'webpack configuration file', config.get('webpack'))\n\nconst flags = args.parse(process.argv)\n\nconst webpack = require('webpack')\nconst webpackConfig = require(flags.webpack || '@things-factory/builder/webpack.config.dev.js')\n\nconst compiler = webpack(webpackConfig)\n\nconst PORT = (process.env.PORT = flags.port)\n\nconst requestBody = config.get('requestBody') || {}\n\nconst bodyParserOption = {\n formLimit: requestBody.formLimit || '10mb',\n jsonLimit: requestBody.jsonLimit || '10mb',\n textLimit: requestBody.textLimit || '10mb'\n}\n\nconst fileUpload = config.get('fileUpload') || {}\nconst fileUploadOption = {\n maxFileSize: bytesFormat.parse(fileUpload.maxFileSize) || bytesFormat.parse('10mb'),\n maxFiles: fileUpload.maxFiles || 10\n}\n\ninterface ICustomAppState {\n domain: Domain\n user: any\n tx: EntityManager\n}\n\ninterface ICustomAppContext {\n t: any\n ssoMiddlewares: any[]\n}\n\ninitLicense(config.get('licenseKey'))\n\n/* bootstrap */\nconst bootstrap = async () => {\n await databaseInitializer()\n\n const app = new Koa<ICustomAppState, ICustomAppContext>() as any\n app.proxy = true\n\n app.use(\n cors({\n origin: function (ctx) {\n return ctx.request.headers.origin || '*'\n },\n exposeHeaders: ['WWW-Authenticate', 'Server-Authorization'],\n maxAge: 5,\n credentials: true,\n /* allowMethods: ['GET', 'POST', 'DELETE'], -- use default */\n allowHeaders: ['Content-Type', 'Authorization', 'Accept']\n })\n )\n\n var subscriptionMiddleware = []\n process.emit('bootstrap-module-subscription' as any, app, subscriptionMiddleware)\n\n const builtSchema = await schema()\n\n const httpServer = createServer(app.callback())\n const websocketServer = new WebSocketServer({\n server: httpServer,\n path: '/graphql'\n })\n\n // Save the returned server's info so we can shut down this server later\n const serverCleanup = useServer(\n {\n schema: builtSchema,\n context: async (ctx, msg, args) => {\n return ctx['context']\n },\n onConnect: async ctx => {\n var { extra, connectionParams } = ctx\n var { request } = extra\n\n if (((connectionParams['headers'] as any) || connectionParams)?.referer) {\n var url = new URL(((connectionParams['headers'] as any) || connectionParams).referer)\n var accessToken = url.searchParams.get('access_token')\n if (accessToken) {\n connectionParams['headers']['authorization'] = accessToken\n }\n }\n\n request.headers = {\n ...request.headers,\n ...(connectionParams['headers'] || (connectionParams as any))\n }\n\n var koacontext = await app.createContext(request, new http.ServerResponse(request))\n koacontext['state'] = {}\n\n /* in case connect error(like a authentication error) just throw exception */\n var middlewares = [domainMiddleware, ...subscriptionMiddleware]\n const fn = co.wrap(compose(middlewares))\n\n await fn(koacontext)\n\n return (ctx['context'] = koacontext)\n },\n onDisconnect(ctx, code, reason) {\n console.log('Disconnected!')\n },\n onError(ctx, msg, errors) {\n console.error(msg, errors)\n }\n },\n websocketServer\n )\n\n const server = new ApolloServer({\n schema: builtSchema,\n formatError: error => {\n logger.error(error)\n return error\n },\n introspection: true,\n csrfPrevention: true,\n plugins: [\n // Proper shutdown for the HTTP server.\n ApolloServerPluginDrainHttpServer({ httpServer }),\n // Proper shutdown for the WebSocket server.\n {\n async serverWillStart() {\n return {\n async drainServer() {\n await serverCleanup.dispose()\n }\n }\n }\n },\n // TODO make this landing page work\n ApolloServerPluginLandingPageLocalDefault({\n footer: false,\n embed: true,\n includeCookies: true\n })\n ],\n cache: 'bounded'\n })\n\n await server.start()\n\n GraphqlLocalClient.init(builtSchema, app)\n\n orderedModuleNames.forEach(name => {\n const { initMiddlewares } = loader(name)\n initMiddlewares && initMiddlewares(app)\n })\n\n const render = require('@things-factory/ejs-remote')\n render(app, {\n root: '/views',\n host: `http://127.0.0.1:${PORT}`,\n layout: false,\n viewExt: 'html',\n cache: false,\n debug: false\n })\n\n const middleware = await koaWebpack({\n compiler,\n hotClient: {},\n devMiddleware: {\n publicPath: webpackConfig.output.publicPath,\n stats: { colors: true }\n }\n })\n\n // only for development mode. triggered after webpack compilation is done.\n compiler.hooks.done.tap({ name: 'server-dev' }, stats => {\n process.emit('client-rebuilt' as any, app, compiler.outputFileSystem)\n })\n\n app.use(koaBodyParser(bodyParserOption))\n\n /* routers */\n const ssoMiddlewares = []\n process.emit('bootstrap-collect-sso-middleware' as any, null, ssoMiddlewares)\n app.ssoMiddlewares = ssoMiddlewares\n\n process.emit('bootstrap-module-global-public-route' as any, app, globalPublicRouter)\n process.emit('bootstrap-module-global-private-route' as any, app, globalPrivateRouter)\n process.emit('bootstrap-module-domain-public-route' as any, app, domainPublicRouter)\n process.emit('bootstrap-module-domain-private-route' as any, app, domainPrivateRouter)\n\n app.use(checkValidity) /* Check the license after most of the context has been built */\n\n app\n .use(globalPublicRouter.routes())\n .use(globalPublicRouter.allowedMethods())\n .use(globalPrivateRouter.routes())\n .use(globalPrivateRouter.allowedMethods())\n .use(domainPublicRouter.routes())\n .use(domainPublicRouter.allowedMethods())\n .use(domainPrivateRouter.routes())\n .use(domainPrivateRouter.allowedMethods())\n\n /* Graphql Upload's multipart/form-data handling affects the restful file upload feature, so it should be placed after the routers configuration. */\n app.use(graphqlUploadKoa(fileUploadOption))\n\n graphqlRouter.post(\n '/graphql',\n koaMiddleware(server, {\n context: async ({ ctx }) => ctx\n })\n )\n app.use(graphqlRouter.routes())\n app.use(graphqlRouter.allowedMethods())\n\n /* should follow this order : history-fallback => webpack-middleware */\n app.use(historyApiFallback({ whiteList: [] }))\n\n app.use(middleware)\n\n httpServer.listen({ port: PORT }, () => {\n logger.info(`🚀 Server ready at http://0.0.0.0:${PORT}/graphql`)\n logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}/graphql`)\n\n process.emit('bootstrap-module-start' as any, { app, config, builtSchema, httpServer } as any)\n })\n}\n\nbootstrap()\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../server/server.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;AAE5B,4DAA4D;AAC5D,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AACxB,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,CAAA;AAEjD,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;AAEjE,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAA;AACnC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;AAE1B,2CAA6C;AAC7C,2EAAyF;AACzF,uEAA0G;AAC1G,8CAAoD;AAEpD,0DAA+B;AAC/B,qGAAiE;AACjE,8CAAiD;AACjD,+BAAmC;AACnC,sDAAqB;AACrB,4EAA0C;AAC1C,oEAAkC;AAClC,sEAAiC;AACjC,yFAAsE;AACtE,2BAAoC;AACpC,oDAAmB;AACnB,wDAAuB;AAEvB,6DAA4B;AAC5B,6CAAgF;AAChF,qFAAoF;AAEpF,iEAA2D;AAC3D,sDAA6D;AAC7D,uCAMkB;AAClB,qCAAiC;AACjC,+CAAgD;AAEhD,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,KAAK,CAAC,EAAE;IACtC,YAAM,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IAEvD,iBAAiB;AACnB,CAAC,CAAC,CAAA;AAEF,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAE5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,2CAA2C,EAAE,YAAM,CA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AA;IAE9C,GAAG,CAAC,GAAG,CACL,IAAA,oBAAS,EAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,EAAE;QAC9C,KAAK,EAAE,YAAY;KACpB,CAAC,CACH,CAAA;IAED,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE;QACrC,YAAM,CAAC,IAAI,CAAC,qCAAqC,IAAI,UAAU,CAAC,CAAA;QAChE,YAAM,CAAC,IAAI,CAAC,0CAA0C,IAAI,UAAU,CAAC,CAAA;QAErE,OAAO,CAAC,IAAI,CAAC,wBAA+B,EAAE,EAAE,GAAG,EAAE,MAAM,EAAN,YAAM,EAAE,WAAW,EAAE,UAAU,EAAS,CAAC,CAAA;IAChG,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,SAAS,EAAE,CAAA","sourcesContent":["// ts-import-sorter: disable\n\n/* following 5 lines should be located in top of the file */\nconst OS = require('os')\nprocess.env.UV_THREADPOOL_SIZE = OS.cpus().length\n\nconsole.log('UV_THREADPOOL_SIZE', process.env.UV_THREADPOOL_SIZE)\n\nprocess.env.NODE_ENV = 'production'\nprocess.setMaxListeners(0)\n\nimport { ApolloServer } from '@apollo/server'\nimport { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer'\nimport { ApolloServerPluginLandingPageProductionDefault } from '@apollo/server/plugin/landingPage/default'\nimport { koaMiddleware } from '@as-integrations/koa'\n\nimport bytesFormat from 'bytes'\nimport graphqlUploadKoa from 'graphql-upload/graphqlUploadKoa.js'\nimport { useServer } from 'graphql-ws/lib/use/ws'\nimport { createServer } from 'http'\nimport Koa from 'koa'\nimport koaBodyParser from 'koa-bodyparser'\nimport koaStatic from 'koa-static'\nimport compose from 'koa-compose'\nimport { historyApiFallback } from 'koa2-connect-history-api-fallback'\nimport { WebSocketServer } from 'ws'\nimport co from 'co'\nimport http from 'http'\n\nimport cors from '@koa/cors'\nimport { config, loader, logger, orderedModuleNames } from '@things-factory/env'\nimport { initLicense, checkValidity } from '@things-factory/operato-license-checker'\n\nimport { GraphqlLocalClient } from './graphql-local-client'\nimport { databaseInitializer } from './initializers/database'\nimport {\n domainPrivateRouter,\n domainPublicRouter,\n globalPrivateRouter,\n globalPublicRouter,\n graphqlRouter\n} from './routers'\nimport { schema } from './schema'\nimport { domainMiddleware } from './middlewares'\n\nprocess.on('uncaughtException', error => {\n logger.error('uncaughtException: ', error, error.stack)\n\n //process.exit(1)\n})\n\nconst args = require('args')\n\nargs.option('port', 'The port on which the app will be running', config.get('port', 3000))\n\nconst flags = args.parse(process.argv)\n\nconst path = require('path')\n\nconst PORT = (process.env.PORT = flags.port)\n\nconst requestBody = config.get('requestBody') || {}\n\nconst bodyParserOption = {\n formLimit: requestBody.formLimit || '10mb',\n jsonLimit: requestBody.jsonLimit || '10mb',\n textLimit: requestBody.textLimit || '10mb'\n}\n\nconst fileUpload = config.get('fileUpload') || {}\nconst fileUploadOption = {\n maxFileSize: bytesFormat.parse(fileUpload.maxFileSize) || bytesFormat.parse('10mb'),\n maxFiles: fileUpload.maxFiles || 10\n}\n\ninitLicense(config.get('licenseKey'))\n\n/* bootstrap */\nconst bootstrap = async () => {\n await databaseInitializer()\n\n const app = new Koa() as any\n app.proxy = true\n\n app.use(\n cors({\n origin: function (ctx) {\n return ctx.request.headers.origin || '*'\n },\n exposeHeaders: ['WWW-Authenticate', 'Server-Authorization'],\n maxAge: 5,\n credentials: true,\n /* allowMethods: ['GET', 'POST', 'DELETE'], -- use default */\n allowHeaders: ['Content-Type', 'Authorization', 'Accept']\n })\n )\n\n var subscriptionMiddleware = []\n process.emit('bootstrap-module-subscription' as any, app, subscriptionMiddleware)\n\n const builtSchema = await schema()\n\n const httpServer = createServer(app.callback())\n const websocketServer = new WebSocketServer({\n server: httpServer,\n path: '/graphql'\n })\n\n // Save the returned server's info so we can shut down this server later\n const serverCleanup = useServer(\n {\n schema: builtSchema,\n context: async (ctx, msg, args) => {\n return ctx['context']\n },\n onConnect: async ctx => {\n var { extra, connectionParams } = ctx\n var { request } = extra\n\n if (((connectionParams['headers'] as any) || connectionParams)?.referer) {\n var url = new URL(((connectionParams['headers'] as any) || connectionParams).referer)\n var accessToken = url.searchParams.get('access_token')\n if (accessToken) {\n connectionParams['headers']['authorization'] = accessToken\n }\n }\n\n request.headers = {\n ...request.headers,\n ...(connectionParams['headers'] || (connectionParams as any))\n }\n\n var koacontext = await app.createContext(request, new http.ServerResponse(request))\n koacontext['state'] = {}\n\n /* in case connect error(like a authentication error) just throw exception */\n var middlewares = [domainMiddleware, ...subscriptionMiddleware]\n const fn = co.wrap(compose(middlewares))\n\n await fn(koacontext)\n\n return (ctx['context'] = koacontext)\n },\n onDisconnect(ctx, code, reason) {\n console.log('Disconnected!')\n },\n onError(ctx, msg, errors) {\n console.error(msg, errors)\n }\n },\n websocketServer\n )\n\n const server = new ApolloServer({\n schema: builtSchema,\n formatError: error => {\n logger.error(error)\n return error\n },\n introspection: true,\n csrfPrevention: true,\n plugins: [\n // Proper shutdown for the HTTP server.\n ApolloServerPluginDrainHttpServer({ httpServer }),\n // Proper shutdown for the WebSocket server.\n {\n async serverWillStart() {\n return {\n async drainServer() {\n await serverCleanup.dispose()\n }\n }\n }\n },\n // TODO make this landing page work\n ApolloServerPluginLandingPageProductionDefault({\n graphRef: 'my-graph-id@my-graph-variant',\n footer: false\n })\n ],\n cache: 'bounded'\n })\n\n await server.start()\n\n GraphqlLocalClient.init(builtSchema, app)\n\n orderedModuleNames.forEach(name => {\n const { initMiddlewares } = loader(name)\n initMiddlewares && initMiddlewares(app)\n })\n\n const render = require('@things-factory/ejs-remote')\n render(app, {\n root: '/views',\n host: `http://127.0.0.1:${PORT}`,\n layout: false,\n viewExt: 'html',\n cache: true,\n debug: false\n })\n\n app.use(koaBodyParser(bodyParserOption))\n\n /* routers */\n const ssoMiddlewares = []\n process.emit('bootstrap-collect-sso-middleware' as any, null, ssoMiddlewares)\n app.ssoMiddlewares = ssoMiddlewares\n\n process.emit('bootstrap-module-global-public-route' as any, app, globalPublicRouter)\n process.emit('bootstrap-module-global-private-route' as any, app, globalPrivateRouter)\n process.emit('bootstrap-module-domain-public-route' as any, app, domainPublicRouter)\n process.emit('bootstrap-module-domain-private-route' as any, app, domainPrivateRouter)\n\n app.use(checkValidity) /* Check the license after most of the context has been built */\n\n app\n .use(globalPublicRouter.routes())\n .use(globalPublicRouter.allowedMethods())\n .use(globalPrivateRouter.routes())\n .use(globalPrivateRouter.allowedMethods())\n .use(domainPublicRouter.routes())\n .use(domainPublicRouter.allowedMethods())\n .use(domainPrivateRouter.routes())\n .use(domainPrivateRouter.allowedMethods())\n\n /* Graphql Upload's multipart/form-data handling affects the restful file upload feature, so it should be placed after the routers configuration. */\n app.use(graphqlUploadKoa(fileUploadOption))\n\n graphqlRouter.post(\n '/graphql',\n koaMiddleware(server, {\n context: async ({ ctx }) => ctx\n })\n )\n app.use(graphqlRouter.routes())\n app.use(graphqlRouter.allowedMethods())\n\n /* should follow this order : history-fallback => koaStatic */\n app.use(historyApiFallback({ whiteList: [] }))\n\n app.use(\n koaStatic(path.join(process.cwd(), 'dist-app'), {\n index: 'index.html'\n })\n )\n\n httpServer.listen({ port: PORT }, () => {\n logger.info(`🚀 Server ready at http://0.0.0.0:${PORT}/graphql`)\n logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}/graphql`)\n\n process.emit('bootstrap-module-start' as any, { app, config, builtSchema, httpServer } as any)\n })\n}\n\nbootstrap()\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../server/server.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;AAE5B,4DAA4D;AAC5D,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AACxB,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,CAAA;AAEjD,OAAO,CAAC,GAAG,CAAC,oBAAoB,E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AAO,CAAC,IAAI,CAAC,wBAA+B,EAAE,EAAE,GAAG,EAAE,MAAM,EAAN,YAAM,EAAE,WAAW,EAAE,UAAU,EAAS,CAAC,CAAA;IAChG,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,SAAS,EAAE,CAAA","sourcesContent":["// ts-import-sorter: disable\n\n/* following 5 lines should be located in top of the file */\nconst OS = require('os')\nprocess.env.UV_THREADPOOL_SIZE = OS.cpus().length\n\nconsole.log('UV_THREADPOOL_SIZE', process.env.UV_THREADPOOL_SIZE)\n\nprocess.env.NODE_ENV = 'production'\nprocess.setMaxListeners(0)\n\nimport { ApolloServer } from '@apollo/server'\nimport { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer'\nimport { ApolloServerPluginLandingPageProductionDefault } from '@apollo/server/plugin/landingPage/default'\nimport { koaMiddleware } from '@as-integrations/koa'\n\nimport bytesFormat from 'bytes'\nimport graphqlUploadKoa from 'graphql-upload/graphqlUploadKoa.js'\nimport { useServer } from 'graphql-ws/lib/use/ws'\nimport { createServer } from 'http'\nimport Koa from 'koa'\nimport koaBodyParser from 'koa-bodyparser'\nimport koaStatic from 'koa-static'\nimport compose from 'koa-compose'\nimport { historyApiFallback } from 'koa2-connect-history-api-fallback'\nimport { WebSocketServer } from 'ws'\nimport co from 'co'\nimport http from 'http'\n\nimport cors from '@koa/cors'\nimport { config, loader, logger, orderedModuleNames } from '@things-factory/env'\nimport { initLicense, checkValidity } from '@things-factory/operato-license-checker'\n\nimport { GraphqlLocalClient } from './graphql-local-client'\nimport { databaseInitializer } from './initializers/database'\nimport {\n domainPrivateRouter,\n domainPublicRouter,\n globalPrivateRouter,\n globalPublicRouter,\n graphqlRouter\n} from './routers'\nimport { schema } from './schema'\nimport { domainMiddleware } from './middlewares'\n\nprocess.on('uncaughtException', error => {\n logger.error('uncaughtException: ', error, error.stack)\n\n //process.exit(1)\n})\n\nconst args = require('args')\n\nargs.option('port', 'The port on which the app will be running', config.get('port', 3000))\n\nconst flags = args.parse(process.argv)\n\nconst path = require('path')\n\nconst PORT = (process.env.PORT = flags.port)\n\nconst requestBody = config.get('requestBody') || {}\n\nconst bodyParserOption = {\n formLimit: requestBody.formLimit || '10mb',\n jsonLimit: requestBody.jsonLimit || '10mb',\n textLimit: requestBody.textLimit || '10mb'\n}\n\nconst fileUpload = config.get('fileUpload') || {}\nconst fileUploadOption = {\n maxFileSize: bytesFormat.parse(fileUpload.maxFileSize) || bytesFormat.parse('10mb'),\n maxFiles: fileUpload.maxFiles || 10\n}\n\ninitLicense(config.get('licenseKey'))\n\n/* bootstrap */\nconst bootstrap = async () => {\n await databaseInitializer()\n\n const app = new Koa() as any\n app.proxy = true\n\n app.use(\n cors({\n origin: function (ctx) {\n return ctx.request.headers.origin || '*'\n },\n exposeHeaders: ['WWW-Authenticate', 'Server-Authorization'],\n maxAge: 5,\n credentials: true,\n /* allowMethods: ['GET', 'POST', 'DELETE'], -- use default */\n allowHeaders: ['Content-Type', 'Authorization', 'Accept']\n })\n )\n\n var subscriptionMiddleware = []\n process.emit('bootstrap-module-subscription' as any, app, subscriptionMiddleware)\n\n const builtSchema = await schema()\n\n const httpServer = createServer(app.callback())\n const websocketServer = new WebSocketServer({\n server: httpServer,\n path: '/graphql'\n })\n\n // Save the returned server's info so we can shut down this server later\n const serverCleanup = useServer(\n {\n schema: builtSchema,\n context: async (ctx, msg, args) => {\n return ctx['context']\n },\n onConnect: async ctx => {\n var { extra, connectionParams } = ctx\n var { request } = extra\n\n if (((connectionParams['headers'] as any) || connectionParams)?.referer) {\n var url = new URL(((connectionParams['headers'] as any) || connectionParams).referer)\n var accessToken = url.searchParams.get('access_token')\n if (accessToken) {\n connectionParams['headers']['authorization'] = accessToken\n }\n }\n\n request.headers = {\n ...request.headers,\n ...(connectionParams['headers'] || (connectionParams as any))\n }\n\n var koacontext = await app.createContext(request, new http.ServerResponse(request))\n koacontext['state'] = {}\n\n /* in case connect error(like a authentication error) just throw exception */\n var middlewares = [domainMiddleware, ...subscriptionMiddleware]\n const fn = co.wrap(compose(middlewares))\n\n await fn(koacontext)\n\n return (ctx['context'] = koacontext)\n },\n onDisconnect(ctx, code, reason) {\n console.log('Disconnected!')\n },\n onError(ctx, msg, errors) {\n console.error(msg, errors)\n }\n },\n websocketServer\n )\n\n const server = new ApolloServer({\n schema: builtSchema,\n formatError: error => {\n logger.error(error)\n return error\n },\n introspection: true,\n csrfPrevention: true,\n plugins: [\n // Proper shutdown for the HTTP server.\n ApolloServerPluginDrainHttpServer({ httpServer }),\n // Proper shutdown for the WebSocket server.\n {\n async serverWillStart() {\n return {\n async drainServer() {\n await serverCleanup.dispose()\n }\n }\n }\n },\n // TODO make this landing page work\n ApolloServerPluginLandingPageProductionDefault({\n graphRef: 'my-graph-id@my-graph-variant',\n footer: false\n })\n ],\n cache: 'bounded'\n })\n\n await server.start()\n\n GraphqlLocalClient.init(builtSchema, app)\n\n orderedModuleNames.forEach(name => {\n const { initMiddlewares } = loader(name)\n initMiddlewares && initMiddlewares(app)\n })\n\n const render = require('@things-factory/ejs-remote')\n render(app, {\n root: '/views',\n host: `http://127.0.0.1:${PORT}`,\n layout: false,\n viewExt: 'html',\n cache: true,\n debug: false\n })\n\n app.use(koaBodyParser(bodyParserOption))\n\n /* routers */\n const ssoMiddlewares = []\n process.emit('bootstrap-collect-sso-middleware' as any, null, ssoMiddlewares)\n app.ssoMiddlewares = ssoMiddlewares\n\n process.emit('bootstrap-module-global-public-route' as any, app, globalPublicRouter)\n process.emit('bootstrap-module-global-private-route' as any, app, globalPrivateRouter)\n process.emit('bootstrap-module-domain-public-route' as any, app, domainPublicRouter)\n process.emit('bootstrap-module-domain-private-route' as any, app, domainPrivateRouter)\n\n app.use(checkValidity) /* Check the license after most of the context has been built */\n\n app\n .use(globalPublicRouter.routes())\n .use(globalPublicRouter.allowedMethods())\n .use(globalPrivateRouter.routes())\n .use(globalPrivateRouter.allowedMethods())\n .use(domainPublicRouter.routes())\n .use(domainPublicRouter.allowedMethods())\n .use(domainPrivateRouter.routes())\n .use(domainPrivateRouter.allowedMethods())\n\n /* Graphql Upload's multipart/form-data handling affects the restful file upload feature, so it should be placed after the routers configuration. */\n app.use(graphqlUploadKoa(fileUploadOption))\n\n graphqlRouter.post(\n '/graphql',\n koaMiddleware(server, {\n context: async ({ ctx }) => ctx\n })\n )\n app.use(graphqlRouter.routes())\n app.use(graphqlRouter.allowedMethods())\n\n /* should follow this order : history-fallback => koaStatic */\n app.use(historyApiFallback({ whiteList: [] }))\n\n app.use(\n koaStatic(path.join(process.cwd(), 'dist-app'), {\n index: 'index.html'\n })\n )\n\n httpServer.listen({ port: PORT }, () => {\n logger.info(`🚀 Server ready at http://0.0.0.0:${PORT}/graphql`)\n logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}/graphql`)\n\n process.emit('bootstrap-module-start' as any, { app, config, builtSchema, httpServer } as any)\n })\n}\n\nbootstrap()\n"]}
@@ -13,13 +13,14 @@ var AttributeSetItemType;
13
13
  AttributeSetItemType["date"] = "date";
14
14
  AttributeSetItemType["datetime"] = "datetime";
15
15
  AttributeSetItemType["file"] = "file";
16
- })(AttributeSetItemType = exports.AttributeSetItemType || (exports.AttributeSetItemType = {}));
16
+ })(AttributeSetItemType || (exports.AttributeSetItemType = AttributeSetItemType = {}));
17
17
  (0, type_graphql_1.registerEnumType)(AttributeSetItemType, {
18
18
  name: 'AttributeSetItemType',
19
19
  description: 'type enumeration of a attribute-set-item'
20
20
  });
21
21
  let AttributeSetItem = class AttributeSetItem {
22
22
  };
23
+ exports.AttributeSetItem = AttributeSetItem;
23
24
  tslib_1.__decorate([
24
25
  (0, type_graphql_1.Field)(),
25
26
  tslib_1.__metadata("design:type", String)
@@ -48,12 +49,12 @@ tslib_1.__decorate([
48
49
  (0, type_graphql_1.Field)(type => common_types_1.ScalarObject, { nullable: true }),
49
50
  tslib_1.__metadata("design:type", Object)
50
51
  ], AttributeSetItem.prototype, "options", void 0);
51
- AttributeSetItem = tslib_1.__decorate([
52
+ exports.AttributeSetItem = AttributeSetItem = tslib_1.__decorate([
52
53
  (0, type_graphql_1.ObjectType)({ description: 'Entity for AttributeSetItem' })
53
54
  ], AttributeSetItem);
54
- exports.AttributeSetItem = AttributeSetItem;
55
55
  let AttributeSetItemPatch = class AttributeSetItemPatch {
56
56
  };
57
+ exports.AttributeSetItemPatch = AttributeSetItemPatch;
57
58
  tslib_1.__decorate([
58
59
  (0, type_graphql_1.Field)({ nullable: true }),
59
60
  tslib_1.__metadata("design:type", String)
@@ -82,8 +83,7 @@ tslib_1.__decorate([
82
83
  (0, type_graphql_1.Field)({ nullable: true }),
83
84
  tslib_1.__metadata("design:type", Boolean)
84
85
  ], AttributeSetItemPatch.prototype, "hidden", void 0);
85
- AttributeSetItemPatch = tslib_1.__decorate([
86
+ exports.AttributeSetItemPatch = AttributeSetItemPatch = tslib_1.__decorate([
86
87
  (0, type_graphql_1.InputType)()
87
88
  ], AttributeSetItemPatch);
88
- exports.AttributeSetItemPatch = AttributeSetItemPatch;
89
89
  //# sourceMappingURL=attribute-set-item-type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attribute-set-item-type.js","sourceRoot":"","sources":["../../../server/service/attribute-set/attribute-set-item-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAkF;AAClF,kDAA8C;AAE9C,IAAY,oBAQX;AARD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,2CAAmB,CAAA;IACnB,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,6CAAqB,CAAA;IACrB,qCAAa,CAAA;AACf,CAAC,EARW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAQ/B;AAED,IAAA,+BAAgB,EAAC,oBAAoB,EAAE;IACrC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,0CAA0C;CACxD,CAAC,CAAA;AAGK,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAqB5B,CAAA;AApBC;IAAC,IAAA,oBAA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AEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACV;AApBL,qBAAqB;IADjC,IAAA,wBAAS,GAAE;GACC,qBAAqB,CAqBjC;AArBY,sDAAqB","sourcesContent":["import { Field, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'\nimport { ScalarObject } from '../common-types'\n\nexport enum AttributeSetItemType {\n number = 'number',\n text = 'text',\n boolean = 'boolean',\n select = 'select',\n date = 'date',\n datetime = 'datetime',\n file = 'file'\n}\n\nregisterEnumType(AttributeSetItemType, {\n name: 'AttributeSetItemType',\n description: 'type enumeration of a attribute-set-item'\n})\n\n@ObjectType({ description: 'Entity for AttributeSetItem' })\nexport class AttributeSetItem {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n tag?: string\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n hidden?: boolean\n\n @Field({ nullable: true })\n type?: AttributeSetItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n}\n\n@InputType()\nexport class AttributeSetItemPatch {\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n tag?: string\n\n @Field(type => AttributeSetItemType, { nullable: true })\n type?: AttributeSetItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n hidden?: boolean\n}\n"]}
1
+ {"version":3,"file":"attribute-set-item-type.js","sourceRoot":"","sources":["../../../server/service/attribute-set/attribute-set-item-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAkF;AAClF,kDAA8C;AAE9C,IAAY,oBAQX;AARD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,2CAAmB,CAAA;IACnB,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,6CAAqB,CAAA;IACrB,qCAAa,CA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EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDAC7B;AAG3B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,2BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACb;AAGnC;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACV;AAGhB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACV;gCApBL,qBAAqB;IADjC,IAAA,wBAAS,GAAE;GACC,qBAAqB,CAqBjC","sourcesContent":["import { Field, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'\nimport { ScalarObject } from '../common-types'\n\nexport enum AttributeSetItemType {\n number = 'number',\n text = 'text',\n boolean = 'boolean',\n select = 'select',\n date = 'date',\n datetime = 'datetime',\n file = 'file'\n}\n\nregisterEnumType(AttributeSetItemType, {\n name: 'AttributeSetItemType',\n description: 'type enumeration of a attribute-set-item'\n})\n\n@ObjectType({ description: 'Entity for AttributeSetItem' })\nexport class AttributeSetItem {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n tag?: string\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n hidden?: boolean\n\n @Field({ nullable: true })\n type?: AttributeSetItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n}\n\n@InputType()\nexport class AttributeSetItemPatch {\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n tag?: string\n\n @Field(type => AttributeSetItemType, { nullable: true })\n type?: AttributeSetItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n hidden?: boolean\n}\n"]}
@@ -62,6 +62,7 @@ let AttributeSetMutation = class AttributeSetMutation {
62
62
  return true;
63
63
  }
64
64
  };
65
+ exports.AttributeSetMutation = AttributeSetMutation;
65
66
  tslib_1.__decorate([
66
67
  (0, type_graphql_1.Directive)('@transaction'),
67
68
  (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
@@ -123,8 +124,7 @@ tslib_1.__decorate([
123
124
  tslib_1.__metadata("design:paramtypes", [Array, Object]),
124
125
  tslib_1.__metadata("design:returntype", Promise)
125
126
  ], AttributeSetMutation.prototype, "importAttributeSets", null);
126
- AttributeSetMutation = tslib_1.__decorate([
127
+ exports.AttributeSetMutation = AttributeSetMutation = tslib_1.__decorate([
127
128
  (0, type_graphql_1.Resolver)(attribute_set_1.AttributeSet)
128
129
  ], AttributeSetMutation);
129
- exports.AttributeSetMutation = AttributeSetMutation;
130
130
  //# sourceMappingURL=attribute-set-mutation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attribute-set-mutation.js","sourceRoot":"","sources":["../../../server/service/attribute-set/attribute-set-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,mDAA8C;AAC9C,6DAAyE;AAGlE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAIzB,AAAN,KAAK,CAAC,kBAAkB,CAAmB,SAA0B,EAAS,OAAY;QACxF,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE5B,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAC,IAAI,mBAC3C,SAAS,EACZ,CAAA;IACJ,CAAC;IAKK,AAAN,KAAK,CAAC,kBAAkB,CACX,EAAU,EACP,KAAwB,EAC/B,OAAY;QAEnB,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE5B,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAA;QACjD,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YACzC,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CA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BAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,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;;;;+DAQ5E;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAE/E,mBAAA,IAAA,kBAAG,EAAC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,sCAAiB,CAAC,CAAC,CAAA;IAC9C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+DAWP;AApHU,oBAAoB;IADhC,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,oBAAoB,CAqHhC;AArHY,oDAAoB","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { AttributeSet } from './attribute-set'\nimport { NewAttributeSet, AttributeSetPatch } from './attribute-set-type'\n\n@Resolver(AttributeSet)\nexport class AttributeSetMutation {\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => AttributeSet, { description: 'To create new AttributeSet' })\n async createAttributeSet(@Arg('attribute') attribute: NewAttributeSet, @Ctx() context: any): Promise<AttributeSet> {\n const { tx } = context.state\n\n return await tx.getRepository(AttributeSet).save({\n ...attribute\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => AttributeSet, { description: 'To modify AttributeSet information' })\n async updateAttributeSet(\n @Arg('id') id: string,\n @Arg('patch') patch: AttributeSetPatch,\n @Ctx() context: any\n ): Promise<AttributeSet> {\n const { tx } = context.state\n\n const repository = tx.getRepository(AttributeSet)\n const attribute = await repository.findOne({\n where: { id }\n })\n\n return await repository.save({\n ...attribute,\n ...patch\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => [AttributeSet], { description: \"To modify multiple AttributeSets' information\" })\n async updateMultipleAttributeSet(\n @Arg('patches', type => [AttributeSetPatch]) patches: AttributeSetPatch[],\n @Ctx() context: any\n ): Promise<AttributeSet[]> {\n const { 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 attributeRepo = tx.getRepository(AttributeSet)\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 attributeRepo.save({\n ...newRecord\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 updateRecord = _updateRecords[i]\n const attribute = await attributeRepo.findOneBy({ id: updateRecord.id })\n\n const result = await attributeRepo.save({\n ...attribute,\n ...updateRecord\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete AttributeSet' })\n async deleteAttributeSet(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(AttributeSet).delete({ id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple AttributeSets' })\n async deleteAttributeSets(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(AttributeSet).delete({\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple AttributeSets' })\n async importAttributeSets(\n @Arg('attributes', type => [AttributeSetPatch]) attributes: AttributeSetPatch[],\n @Ctx() context: any\n ): Promise<boolean> {\n const { tx } = context.state\n\n await Promise.all(\n attributes.map(async (attribute: AttributeSetPatch) => {\n await tx.getRepository(AttributeSet).save(attribute)\n })\n )\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"attribute-set-mutation.js","sourceRoot":"","sources":["../../../server/service/attribute-set/attribute-set-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,mDAA8C;AAC9C,6DAAyE;AAGlE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAIzB,AAAN,KAAK,CAAC,kBAAkB,CAAmB,SAA0B,EAAS,OAAY;QACxF,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE5B,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAC,IAAI,mBAC3C,SAAS,EACZ,CAAA;IACJ,CAAC;IAKK,AAAN,KAAK,CAAC,kBAAkB,CACX,EAAU,EACP,KAAwB,EAC/B,OAAY;QAEnB,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE5B,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAA;QACjD,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YACzC,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CAAC,CAAA;QAEF,OAAO,MAAM,UAAU,CAAC,IAAI,iCACvB,SAAS,GACT,KAAK,EACR,CAAA;IACJ,CAAC;IAKK,AAAN,KAAK,CAAC,0BAA0B,CACe,OAA4B,EAClE,OAAY;QAEnB,MAAM,EAAE,EAAE,EAAE,G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AAO,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;;;;+DAQ5E;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAE/E,mBAAA,IAAA,kBAAG,EAAC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,sCAAiB,CAAC,CAAC,CAAA;IAC9C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+DAWP;+BApHU,oBAAoB;IADhC,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,oBAAoB,CAqHhC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { AttributeSet } from './attribute-set'\nimport { NewAttributeSet, AttributeSetPatch } from './attribute-set-type'\n\n@Resolver(AttributeSet)\nexport class AttributeSetMutation {\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => AttributeSet, { description: 'To create new AttributeSet' })\n async createAttributeSet(@Arg('attribute') attribute: NewAttributeSet, @Ctx() context: any): Promise<AttributeSet> {\n const { tx } = context.state\n\n return await tx.getRepository(AttributeSet).save({\n ...attribute\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => AttributeSet, { description: 'To modify AttributeSet information' })\n async updateAttributeSet(\n @Arg('id') id: string,\n @Arg('patch') patch: AttributeSetPatch,\n @Ctx() context: any\n ): Promise<AttributeSet> {\n const { tx } = context.state\n\n const repository = tx.getRepository(AttributeSet)\n const attribute = await repository.findOne({\n where: { id }\n })\n\n return await repository.save({\n ...attribute,\n ...patch\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => [AttributeSet], { description: \"To modify multiple AttributeSets' information\" })\n async updateMultipleAttributeSet(\n @Arg('patches', type => [AttributeSetPatch]) patches: AttributeSetPatch[],\n @Ctx() context: any\n ): Promise<AttributeSet[]> {\n const { 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 attributeRepo = tx.getRepository(AttributeSet)\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 attributeRepo.save({\n ...newRecord\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 updateRecord = _updateRecords[i]\n const attribute = await attributeRepo.findOneBy({ id: updateRecord.id })\n\n const result = await attributeRepo.save({\n ...attribute,\n ...updateRecord\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete AttributeSet' })\n async deleteAttributeSet(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(AttributeSet).delete({ id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple AttributeSets' })\n async deleteAttributeSets(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(AttributeSet).delete({\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple AttributeSets' })\n async importAttributeSets(\n @Arg('attributes', type => [AttributeSetPatch]) attributes: AttributeSetPatch[],\n @Ctx() context: any\n ): Promise<boolean> {\n const { tx } = context.state\n\n await Promise.all(\n attributes.map(async (attribute: AttributeSetPatch) => {\n await tx.getRepository(AttributeSet).save(attribute)\n })\n )\n\n return true\n }\n}\n"]}
@@ -29,6 +29,7 @@ let AttributeSetQuery = class AttributeSetQuery {
29
29
  return { items, total };
30
30
  }
31
31
  };
32
+ exports.AttributeSetQuery = AttributeSetQuery;
32
33
  tslib_1.__decorate([
33
34
  (0, type_graphql_1.Query)(returns => attribute_set_1.AttributeSet, { nullable: true, description: 'To fetch a AttributeSet' }),
34
35
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
@@ -53,8 +54,7 @@ tslib_1.__decorate([
53
54
  tslib_1.__metadata("design:paramtypes", [common_types_1.ListParam, Object]),
54
55
  tslib_1.__metadata("design:returntype", Promise)
55
56
  ], AttributeSetQuery.prototype, "attributeSets", null);
56
- AttributeSetQuery = tslib_1.__decorate([
57
+ exports.AttributeSetQuery = AttributeSetQuery = tslib_1.__decorate([
57
58
  (0, type_graphql_1.Resolver)(attribute_set_1.AttributeSet)
58
59
  ], AttributeSetQuery);
59
- exports.AttributeSetQuery = AttributeSetQuery;
60
60
  //# sourceMappingURL=attribute-set-query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attribute-set-query.js","sourceRoot":"","sources":["../../../server/service/attribute-set/attribute-set-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,mDAA8C;AAC9C,6DAAuD;AACvD,kDAA2C;AAC3C,0DAA2D;AAC3D,uCAA2D;AAGpD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAEtB,AAAN,KAAK,CAAC,YAAY,CAAY,EAAU,EAAS,OAAY;QAC3D,OAAO,MAAM,IAAA,wBAAa,EAAC,4BAAY,CAAC,CAAC,OAAO,CAAC;YAC/C,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CAAC,CAAA;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A,kBAAG,GAAE,CAAA;;6CAAjB,wBAAS;;sDAU5C;AA1BU,iBAAiB;IAD7B,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,iBAAiB,CA2B7B;AA3BY,8CAAiB","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { AttributeSet } from './attribute-set'\nimport { AttributeSetList } from './attribute-set-type'\nimport { ListParam } from '../common-types'\nimport { getRepository } from '../../initializers/database'\nimport { getQueryBuilderFromListParams } from '../../utils'\n\n@Resolver(AttributeSet)\nexport class AttributeSetQuery {\n @Query(returns => AttributeSet!, { nullable: true, description: 'To fetch a AttributeSet' })\n async attributeSet(@Arg('id') id: string, @Ctx() context: any): Promise<AttributeSet> {\n return await getRepository(AttributeSet).findOne({\n where: { id }\n })\n }\n\n @Query(returns => AttributeSet!, { nullable: true, description: 'To fetch a AttributeSet by Entity name' })\n async attributeSetByEntity(@Arg('entity') entity: string, @Ctx() context: any): Promise<AttributeSet> {\n return await getRepository(AttributeSet).findOne({\n where: { entity }\n })\n }\n\n @Query(returns => AttributeSetList, { description: 'To fetch multiple AttributeSets' })\n async attributeSets(@Args() params: ListParam, @Ctx() context: any): Promise<AttributeSetList> {\n const queryBuilder = getQueryBuilderFromListParams({\n params,\n repository: await getRepository(AttributeSet),\n searchables: ['entity', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n}\n"]}
1
+ {"version":3,"file":"attribute-set-query.js","sourceRoot":"","sources":["../../../server/service/attribute-set/attribute-set-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,mDAA8C;AAC9C,6DAAuD;AACvD,kDAA2C;AAC3C,0DAA2D;AAC3D,uCAA2D;AAGpD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAEtB,AAAN,KAAK,CAAC,YAAY,CAAY,EAAU,EAAS,OAAY;QAC3D,OAAO,MAAM,IAAA,wBAAa,EAAC,4BAAY,CA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E,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAClE,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,wBAAS;;sDAU5C;4BA1BU,iBAAiB;IAD7B,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,iBAAiB,CA2B7B","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { AttributeSet } from './attribute-set'\nimport { AttributeSetList } from './attribute-set-type'\nimport { ListParam } from '../common-types'\nimport { getRepository } from '../../initializers/database'\nimport { getQueryBuilderFromListParams } from '../../utils'\n\n@Resolver(AttributeSet)\nexport class AttributeSetQuery {\n @Query(returns => AttributeSet!, { nullable: true, description: 'To fetch a AttributeSet' })\n async attributeSet(@Arg('id') id: string, @Ctx() context: any): Promise<AttributeSet> {\n return await getRepository(AttributeSet).findOne({\n where: { id }\n })\n }\n\n @Query(returns => AttributeSet!, { nullable: true, description: 'To fetch a AttributeSet by Entity name' })\n async attributeSetByEntity(@Arg('entity') entity: string, @Ctx() context: any): Promise<AttributeSet> {\n return await getRepository(AttributeSet).findOne({\n where: { entity }\n })\n }\n\n @Query(returns => AttributeSetList, { description: 'To fetch multiple AttributeSets' })\n async attributeSets(@Args() params: ListParam, @Ctx() context: any): Promise<AttributeSetList> {\n const queryBuilder = getQueryBuilderFromListParams({\n params,\n repository: await getRepository(AttributeSet),\n searchables: ['entity', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n}\n"]}
@@ -7,6 +7,7 @@ const attribute_set_1 = require("./attribute-set");
7
7
  const attribute_set_item_type_1 = require("./attribute-set-item-type");
8
8
  let NewAttributeSet = class NewAttributeSet {
9
9
  };
10
+ exports.NewAttributeSet = NewAttributeSet;
10
11
  tslib_1.__decorate([
11
12
  (0, type_graphql_1.Field)(),
12
13
  tslib_1.__metadata("design:type", String)
@@ -23,12 +24,12 @@ tslib_1.__decorate([
23
24
  (0, type_graphql_1.Field)({ nullable: true }),
24
25
  tslib_1.__metadata("design:type", Boolean)
25
26
  ], NewAttributeSet.prototype, "active", void 0);
26
- NewAttributeSet = tslib_1.__decorate([
27
+ exports.NewAttributeSet = NewAttributeSet = tslib_1.__decorate([
27
28
  (0, type_graphql_1.InputType)()
28
29
  ], NewAttributeSet);
29
- exports.NewAttributeSet = NewAttributeSet;
30
30
  let AttributeSetPatch = class AttributeSetPatch {
31
31
  };
32
+ exports.AttributeSetPatch = AttributeSetPatch;
32
33
  tslib_1.__decorate([
33
34
  (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
34
35
  tslib_1.__metadata("design:type", String)
@@ -49,12 +50,12 @@ tslib_1.__decorate([
49
50
  (0, type_graphql_1.Field)({ nullable: true }),
50
51
  tslib_1.__metadata("design:type", String)
51
52
  ], AttributeSetPatch.prototype, "cuFlag", void 0);
52
- AttributeSetPatch = tslib_1.__decorate([
53
+ exports.AttributeSetPatch = AttributeSetPatch = tslib_1.__decorate([
53
54
  (0, type_graphql_1.InputType)()
54
55
  ], AttributeSetPatch);
55
- exports.AttributeSetPatch = AttributeSetPatch;
56
56
  let AttributeSetList = class AttributeSetList {
57
57
  };
58
+ exports.AttributeSetList = AttributeSetList;
58
59
  tslib_1.__decorate([
59
60
  (0, type_graphql_1.Field)(type => [attribute_set_1.AttributeSet]),
60
61
  tslib_1.__metadata("design:type", Array)
@@ -63,8 +64,7 @@ tslib_1.__decorate([
63
64
  (0, type_graphql_1.Field)(type => type_graphql_1.Int),
64
65
  tslib_1.__metadata("design:type", Number)
65
66
  ], AttributeSetList.prototype, "total", void 0);
66
- AttributeSetList = tslib_1.__decorate([
67
+ exports.AttributeSetList = AttributeSetList = tslib_1.__decorate([
67
68
  (0, type_graphql_1.ObjectType)()
68
69
  ], AttributeSetList);
69
- exports.AttributeSetList = AttributeSetList;
70
70
  //# sourceMappingURL=attribute-set-type.js.map
@@ -1 +1 @@
1
- {"version":3,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ALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAY,CAAC,CAAC;;+CACT;AAErB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;+CACN;AALF,gBAAgB;IAD5B,IAAA,yBAAU,GAAE;GACA,gBAAgB,CAM5B;AANY,4CAAgB","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\n\nimport { AttributeSet } from './attribute-set'\nimport { AttributeSetItemPatch } from './attribute-set-item-type'\n\n@InputType()\nexport class NewAttributeSet {\n @Field()\n entity: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => [AttributeSetItemPatch], { nullable: true })\n items?: AttributeSetItemPatch[]\n\n @Field({ nullable: true })\n active?: boolean\n}\n\n@InputType()\nexport class AttributeSetPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n entity?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => [AttributeSetItemPatch], { nullable: true })\n items?: AttributeSetItemPatch[]\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class AttributeSetList {\n @Field(type => [AttributeSet])\n items: AttributeSet[]\n\n @Field(type => Int)\n total: number\n}\n"]}
1
+ {"version":3,"file":"attribute-set-type.js","sourceRoot":"","sources":["../../../server/service/attribute-set/attribute-set-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,mDAA8C;AAC9C,uEAAiE;AAG1D,IAAM,eAAe,GAArB,MAAM,eAAe;CAY3B,CAAA;AAZY,0CAAe;AAE1B;IADC,IAAA,oBAAK,GAAE;;+CACM;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,+CAAqB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAC5B;AAG/B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACV;0BAXL,eAAe;IAD3B,IAAA,wBAAS,GAAE;GACC,eAAe,CAY3B;AAGM,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAe7B,CAAA;AAfY,8CAAiB;AAE5B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CAC3B;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACX;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,+CAAqB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDAC5B;AAG/B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACX;4BAdJ,iBAAiB;IAD7B,IAAA,wBAAS,GAAE;GACC,iBAAiB,CAe7B;AAGM,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAM5B,CAAA;AANY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAY,CAAC,CAAC;;+CACT;AAGrB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;+CACN;2BALF,gBAAgB;IAD5B,IAAA,yBAAU,GAAE;GACA,gBAAgB,CAM5B","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\n\nimport { AttributeSet } from './attribute-set'\nimport { AttributeSetItemPatch } from './attribute-set-item-type'\n\n@InputType()\nexport class NewAttributeSet {\n @Field()\n entity: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => [AttributeSetItemPatch], { nullable: true })\n items?: AttributeSetItemPatch[]\n\n @Field({ nullable: true })\n active?: boolean\n}\n\n@InputType()\nexport class AttributeSetPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n entity?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => [AttributeSetItemPatch], { nullable: true })\n items?: AttributeSetItemPatch[]\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class AttributeSetList {\n @Field(type => [AttributeSet])\n items: AttributeSet[]\n\n @Field(type => Int)\n total: number\n}\n"]}