@things-factory/shell 5.0.7 → 5.0.11

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 (90) hide show
  1. package/db.test.sqlite +0 -0
  2. package/dist-server/graphql-local-client.js.map +1 -1
  3. package/dist-server/index.js +9 -22
  4. package/dist-server/index.js.map +1 -1
  5. package/dist-server/initializers/database.js.map +1 -1
  6. package/dist-server/initializers/naming-strategy.js +3 -5
  7. package/dist-server/initializers/naming-strategy.js.map +1 -1
  8. package/dist-server/middlewares/domain-middleware.js +0 -4
  9. package/dist-server/middlewares/domain-middleware.js.map +1 -1
  10. package/dist-server/middlewares/index.js +2 -17
  11. package/dist-server/middlewares/index.js.map +1 -1
  12. package/dist-server/migrations/1000000000000-SeedDomain.js.map +1 -1
  13. package/dist-server/migrations/index.js.map +1 -1
  14. package/dist-server/pubsub-log-transport.js +3 -5
  15. package/dist-server/pubsub-log-transport.js.map +1 -1
  16. package/dist-server/pubsub.js +2 -6
  17. package/dist-server/pubsub.js.map +1 -1
  18. package/dist-server/routers/domain-router.js +2 -7
  19. package/dist-server/routers/domain-router.js.map +1 -1
  20. package/dist-server/routers/global-router.js +3 -7
  21. package/dist-server/routers/global-router.js.map +1 -1
  22. package/dist-server/routers/index.js +3 -16
  23. package/dist-server/routers/index.js.map +1 -1
  24. package/dist-server/schema.js.map +1 -1
  25. package/dist-server/server-dev.js +11 -14
  26. package/dist-server/server-dev.js.map +1 -1
  27. package/dist-server/server.js +10 -12
  28. package/dist-server/server.js.map +1 -1
  29. package/dist-server/service/common-types/index.js +7 -20
  30. package/dist-server/service/common-types/index.js.map +1 -1
  31. package/dist-server/service/common-types/list-param.js +27 -35
  32. package/dist-server/service/common-types/list-param.js.map +1 -1
  33. package/dist-server/service/common-types/log.js +10 -18
  34. package/dist-server/service/common-types/log.js.map +1 -1
  35. package/dist-server/service/common-types/object-ref.js +8 -16
  36. package/dist-server/service/common-types/object-ref.js.map +1 -1
  37. package/dist-server/service/common-types/scalar-any.js.map +1 -1
  38. package/dist-server/service/common-types/scalar-date.js.map +1 -1
  39. package/dist-server/service/common-types/scalar-object.js.map +1 -1
  40. package/dist-server/service/directive-transaction/index.js +2 -15
  41. package/dist-server/service/directive-transaction/index.js.map +1 -1
  42. package/dist-server/service/directive-transaction/transaction.js +2 -7
  43. package/dist-server/service/directive-transaction/transaction.js.map +1 -1
  44. package/dist-server/service/domain/domain-resolver.js +44 -55
  45. package/dist-server/service/domain/domain-resolver.js.map +1 -1
  46. package/dist-server/service/domain/domain-types.js +32 -40
  47. package/dist-server/service/domain/domain-types.js.map +1 -1
  48. package/dist-server/service/domain/domain.js +30 -38
  49. package/dist-server/service/domain/domain.js.map +1 -1
  50. package/dist-server/service/domain/index.js.map +1 -1
  51. package/dist-server/service/index.js +5 -18
  52. package/dist-server/service/index.js.map +1 -1
  53. package/dist-server/service/subscription-data/data-resolver.js +9 -22
  54. package/dist-server/service/subscription-data/data-resolver.js.map +1 -1
  55. package/dist-server/service/subscription-data/data-types.js +8 -17
  56. package/dist-server/service/subscription-data/data-types.js.map +1 -1
  57. package/dist-server/service/subscription-data/index.js.map +1 -1
  58. package/dist-server/tsconfig.tsbuildinfo +1 -0
  59. package/dist-server/utils/condition-builder.js +2 -4
  60. package/dist-server/utils/condition-builder.js.map +1 -1
  61. package/dist-server/utils/get-domain.js +2 -5
  62. package/dist-server/utils/get-domain.js.map +1 -1
  63. package/dist-server/utils/get-query-builder-from-list-params.js +7 -8
  64. package/dist-server/utils/get-query-builder-from-list-params.js.map +1 -1
  65. package/dist-server/utils/index.js +8 -21
  66. package/dist-server/utils/index.js.map +1 -1
  67. package/dist-server/utils/list-param-adjuster.js.map +1 -1
  68. package/dist-server/utils/list-params-converter.js +1 -2
  69. package/dist-server/utils/list-params-converter.js.map +1 -1
  70. package/dist-server/utils/list-query-builder.js +2 -3
  71. package/dist-server/utils/list-query-builder.js.map +1 -1
  72. package/dist-server/utils/publish-progress.js.map +1 -1
  73. package/dist-server/webpack/koa-webpack/client.js.map +1 -1
  74. package/dist-server/webpack/koa-webpack/index.js.map +1 -1
  75. package/dist-server/webpack/koa-webpack/middleware.js.map +1 -1
  76. package/dist-server/webpack/koa-webpack/validate.js.map +1 -1
  77. package/package.json +2 -2
  78. package/server/middlewares/domain-middleware.ts +0 -5
  79. package/server/middlewares/index.ts +0 -4
  80. package/server/pubsub.ts +0 -4
  81. package/server/routers/domain-router.ts +1 -4
  82. package/server/routers/global-router.ts +2 -3
  83. package/server/server-dev.ts +0 -2
  84. package/server/service/directive-transaction/transaction.ts +0 -6
  85. package/server/service/subscription-data/data-resolver.ts +3 -6
  86. package/server/service/subscription-data/data-types.ts +2 -3
  87. package/server/utils/get-domain.ts +4 -6
  88. package/server/utils/get-query-builder-from-list-params.ts +13 -9
  89. package/server/utils/list-params-converter.ts +4 -3
  90. package/server/utils/list-query-builder.ts +8 -4
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../server/server.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;;;AAE5B,4DAA4D;AAC5D,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAA;AACnC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;AAE1B,2DAAsH;AACtH,yDAAgD;AAChD,kDAA+B;AAC/B,6FAAiE;AACjE,8CAAiD;AACjD,+BAAmC;AACnC,8CAAqB;AACrB,oEAA0C;AAC1C,oDAAuB;AACvB,4DAAkC;AAClC,8DAAiC;AACjC,yFAAsE;AACtE,2BAAoC;AACpC,4CAAmB;AAEnB,qDAA4B;AAC5B,6CAAgF;AAEhF,iEAA2D;AAC3D,sDAA6D;AAC7D,uCAA4G;AAC5G,qCAAiC;AAEjC,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,KAAK,CAAC,EAAE;IACtC,YAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAEnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;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CACH,CAAA;IAED,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE;QACrC,YAAM,CAAC,IAAI,CAAC,qCAAqC,IAAI,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC,CAAA;QAC7E,YAAM,CAAC,IAAI,CAAC,0CAA0C,IAAI,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC,CAAA;QAElF,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 2 lines should be located in top of the file */\nprocess.env.NODE_ENV = 'production'\nprocess.setMaxListeners(0)\n\nimport { ApolloServerPluginDrainHttpServer, ApolloServerPluginLandingPageGraphQLPlayground } from 'apollo-server-core'\nimport { ApolloServer } from 'apollo-server-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 ip from 'koa-ip'\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'\n\nimport cors from '@koa/cors'\nimport { config, loader, logger, orderedModuleNames } from '@things-factory/env'\n\nimport { GraphqlLocalClient } from './graphql-local-client'\nimport { databaseInitializer } from './initializers/database'\nimport { domainPrivateRouter, domainPublicRouter, globalPrivateRouter, globalPublicRouter } from './routers'\nimport { schema } from './schema'\n\nprocess.on('uncaughtException', error => {\n logger.error(error)\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\n/* bootstrap */\nconst bootstrap = async () => {\n await databaseInitializer()\n\n const app = new Koa()\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 const whitelist = config.get('whitelist')\n const blacklist = config.get('blacklist')\n\n if (whitelist || blacklist) {\n app.use(\n ip({\n whitelist,\n blacklist,\n handler: async (ctx, next) => {\n ctx.status = 403\n }\n })\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 var url = new URL(((connectionParams['headers'] as any) || connectionParams).referer)\n var accessToken = url.searchParams.get('access_token')\n connectionParams['headers']['authorization'] = accessToken\n\n request.headers = {\n ...request.headers,\n ...(connectionParams['headers'] || (connectionParams as any))\n }\n\n var koacontext = await app.createContext(request, {} as any)\n koacontext['state'] = {}\n\n /* in case connect error(like a authentication error) just throw exception */\n var middlewares = [...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 formatResponse: response => {\n // logger.info('response %s', JSON.stringify(response, null, 2))\n return response\n },\n introspection: true,\n context: async ({ connection, ctx }) => {\n if (connection) {\n return connection.context\n } else {\n return ctx\n }\n },\n plugins: [\n ApolloServerPluginDrainHttpServer({ httpServer }),\n {\n async serverWillStart() {\n return {\n async drainServer() {\n await serverCleanup.dispose()\n }\n }\n }\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 app.use(graphqlUploadKoa(fileUploadOption))\n\n app.use(\n server.getMiddleware({\n path: '/graphql'\n })\n )\n\n /* routers */\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\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 /* should follow this order : history-fallback => koaStatic */\n app.use(historyApiFallback({ whiteList: [] }))\n\n app.use(\n koaStatic(path.join(process.cwd(), 'dist-client'), {\n index: 'index.html'\n })\n )\n\n httpServer.listen({ port: PORT }, () => {\n logger.info(`🚀 Server ready at http://0.0.0.0:${PORT}${server.graphqlPath}`)\n logger.info(`🚀 Subscriptions ready at ws://0.0.0.0:${PORT}${server.graphqlPath}`)\n\n process.emit('bootstrap-module-start' as any, { app, config, builtSchema, httpServer } as any)\n })\n}\n\nbootstrap()\n"]}
@@ -1,23 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./list-param"), exports);
18
- __exportStar(require("./scalar-any"), exports);
19
- __exportStar(require("./scalar-date"), exports);
20
- __exportStar(require("./scalar-object"), exports);
21
- __exportStar(require("./object-ref"), exports);
22
- __exportStar(require("./log"), exports);
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./list-param"), exports);
5
+ tslib_1.__exportStar(require("./scalar-any"), exports);
6
+ tslib_1.__exportStar(require("./scalar-date"), exports);
7
+ tslib_1.__exportStar(require("./scalar-object"), exports);
8
+ tslib_1.__exportStar(require("./object-ref"), exports);
9
+ tslib_1.__exportStar(require("./log"), exports);
23
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/common-types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,+CAA4B;AAC5B,gDAA6B;AAC7B,kDAA+B;AAC/B,+CAA4B;AAC5B,wCAAqB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/common-types/index.ts"],"names":[],"mappings":";;;AAAA,uDAA4B;AAC5B,uDAA4B;AAC5B,wDAA6B;AAC7B,0DAA+B;AAC/B,uDAA4B;AAC5B,gDAAqB","sourcesContent":["export * from './list-param'\nexport * from './scalar-any'\nexport * from './scalar-date'\nexport * from './scalar-object'\nexport * from './object-ref'\nexport * from './log'\n"]}
@@ -1,82 +1,74 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ListParam = exports.Filter = exports.Pagination = exports.Sorting = void 0;
4
+ const tslib_1 = require("tslib");
13
5
  const type_graphql_1 = require("type-graphql");
14
6
  const scalar_any_1 = require("./scalar-any");
15
7
  let Sorting = class Sorting {
16
8
  };
17
- __decorate([
9
+ tslib_1.__decorate([
18
10
  (0, type_graphql_1.Field)({ description: 'Field name to sort by' }),
19
- __metadata("design:type", String)
11
+ tslib_1.__metadata("design:type", String)
20
12
  ], Sorting.prototype, "name", void 0);
21
- __decorate([
13
+ tslib_1.__decorate([
22
14
  (0, type_graphql_1.Field)({ nullable: true, description: 'Set to true if descending sort. Default is "false"' }),
23
- __metadata("design:type", Boolean)
15
+ tslib_1.__metadata("design:type", Boolean)
24
16
  ], Sorting.prototype, "desc", void 0);
25
- Sorting = __decorate([
17
+ Sorting = tslib_1.__decorate([
26
18
  (0, type_graphql_1.InputType)()
27
19
  ], Sorting);
28
20
  exports.Sorting = Sorting;
29
21
  let Pagination = class Pagination {
30
22
  };
31
- __decorate([
23
+ tslib_1.__decorate([
32
24
  (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
33
- __metadata("design:type", Number)
25
+ tslib_1.__metadata("design:type", Number)
34
26
  ], Pagination.prototype, "page", void 0);
35
- __decorate([
27
+ tslib_1.__decorate([
36
28
  (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
37
- __metadata("design:type", Number)
29
+ tslib_1.__metadata("design:type", Number)
38
30
  ], Pagination.prototype, "limit", void 0);
39
- Pagination = __decorate([
31
+ Pagination = tslib_1.__decorate([
40
32
  (0, type_graphql_1.InputType)()
41
33
  ], Pagination);
42
34
  exports.Pagination = Pagination;
43
35
  let Filter = class Filter {
44
36
  };
45
- __decorate([
37
+ tslib_1.__decorate([
46
38
  (0, type_graphql_1.Field)(),
47
- __metadata("design:type", String)
39
+ tslib_1.__metadata("design:type", String)
48
40
  ], Filter.prototype, "name", void 0);
49
- __decorate([
41
+ tslib_1.__decorate([
50
42
  (0, type_graphql_1.Field)(),
51
- __metadata("design:type", String)
43
+ tslib_1.__metadata("design:type", String)
52
44
  ], Filter.prototype, "operator", void 0);
53
- __decorate([
45
+ tslib_1.__decorate([
54
46
  (0, type_graphql_1.Field)(type => scalar_any_1.ScalarAny),
55
- __metadata("design:type", Object)
47
+ tslib_1.__metadata("design:type", Object)
56
48
  ], Filter.prototype, "value", void 0);
57
- __decorate([
49
+ tslib_1.__decorate([
58
50
  (0, type_graphql_1.Field)({ nullable: true }),
59
- __metadata("design:type", Boolean)
51
+ tslib_1.__metadata("design:type", Boolean)
60
52
  ], Filter.prototype, "relation", void 0);
61
- Filter = __decorate([
53
+ Filter = tslib_1.__decorate([
62
54
  (0, type_graphql_1.InputType)()
63
55
  ], Filter);
64
56
  exports.Filter = Filter;
65
57
  let ListParam = class ListParam {
66
58
  };
67
- __decorate([
59
+ tslib_1.__decorate([
68
60
  (0, type_graphql_1.Field)(type => [Filter], { nullable: true }),
69
- __metadata("design:type", Array)
61
+ tslib_1.__metadata("design:type", Array)
70
62
  ], ListParam.prototype, "filters", void 0);
71
- __decorate([
63
+ tslib_1.__decorate([
72
64
  (0, type_graphql_1.Field)(type => Pagination, { nullable: true }),
73
- __metadata("design:type", Pagination)
65
+ tslib_1.__metadata("design:type", Pagination)
74
66
  ], ListParam.prototype, "pagination", void 0);
75
- __decorate([
67
+ tslib_1.__decorate([
76
68
  (0, type_graphql_1.Field)(type => [Sorting], { nullable: true }),
77
- __metadata("design:type", Array)
69
+ tslib_1.__metadata("design:type", Array)
78
70
  ], ListParam.prototype, "sortings", void 0);
79
- ListParam = __decorate([
71
+ ListParam = tslib_1.__decorate([
80
72
  (0, type_graphql_1.ArgsType)()
81
73
  ], ListParam);
82
74
  exports.ListParam = ListParam;
@@ -1 +1 @@
1
- {"version":3,"file":"list-param.js","sourceRoot":"","sources":["../../../server/service/common-types/list-param.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA8D;AAC9D,6CAAwC;AAGxC,IAAa,OAAO,GAApB,MAAa,OAAO;CAMnB,CAAA;AAJC;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;;qCACpC;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,oDAAoD,EAAE,CAAC;;qCAC/E;AALH,OAAO;IADnB,IAAA,wBAAS,GAAE;GACC,OAAO,CAMnB;AANY,0BAAO;AASpB,IAAa,UAAU,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AAC,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjC,UAAU;6CAAA;AAGvB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACzB;AART,SAAS;IADrB,IAAA,uBAAQ,GAAE;GACE,SAAS,CASrB;AATY,8BAAS","sourcesContent":["import { ArgsType, InputType, Field, Int } from 'type-graphql'\nimport { ScalarAny } from './scalar-any'\n\n@InputType()\nexport class Sorting {\n @Field({ description: 'Field name to sort by' })\n name: string\n\n @Field({ nullable: true, description: 'Set to true if descending sort. Default is \"false\"' })\n desc?: boolean\n}\n\n@InputType()\nexport class Pagination {\n @Field(type => Int, { nullable: true })\n page?: number\n\n @Field(type => Int, { nullable: true })\n limit?: number\n}\n\n@InputType()\nexport class Filter {\n @Field()\n name: string\n\n @Field()\n operator: string\n\n @Field(type => ScalarAny)\n value: any\n\n @Field({ nullable: true })\n relation?: boolean\n}\n\n@ArgsType()\nexport class ListParam {\n @Field(type => [Filter], { nullable: true })\n filters?: Filter[]\n\n @Field(type => Pagination, { nullable: true })\n pagination?: Pagination\n\n @Field(type => [Sorting], { nullable: true })\n sortings?: Sorting[]\n}\n"]}
@@ -1,36 +1,28 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.Log = void 0;
4
+ const tslib_1 = require("tslib");
13
5
  const type_graphql_1 = require("type-graphql");
14
6
  const scalar_object_1 = require("./scalar-object");
15
7
  let Log = class Log {
16
8
  };
17
- __decorate([
9
+ tslib_1.__decorate([
18
10
  (0, type_graphql_1.Field)(() => scalar_object_1.ScalarObject, { description: 'the source of the log' }),
19
- __metadata("design:type", Object)
11
+ tslib_1.__metadata("design:type", Object)
20
12
  ], Log.prototype, "source", void 0);
21
- __decorate([
13
+ tslib_1.__decorate([
22
14
  (0, type_graphql_1.Field)({ description: 'log level (error, warning, info, ..)' }),
23
- __metadata("design:type", String)
15
+ tslib_1.__metadata("design:type", String)
24
16
  ], Log.prototype, "level", void 0);
25
- __decorate([
17
+ tslib_1.__decorate([
26
18
  (0, type_graphql_1.Field)({ description: 'log body message' }),
27
- __metadata("design:type", String)
19
+ tslib_1.__metadata("design:type", String)
28
20
  ], Log.prototype, "message", void 0);
29
- __decorate([
21
+ tslib_1.__decorate([
30
22
  (0, type_graphql_1.Field)({ description: 'timestamp the log occurred' }),
31
- __metadata("design:type", String)
23
+ tslib_1.__metadata("design:type", String)
32
24
  ], Log.prototype, "timestamp", void 0);
33
- Log = __decorate([
25
+ Log = tslib_1.__decorate([
34
26
  (0, type_graphql_1.ObjectType)()
35
27
  ], Log);
36
28
  exports.Log = Log;
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../server/service/common-types/log.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAgD;AAChD,mDAA8C;AAG9C,IAAa,GAAG,GAAhB,MAAa,GAAG;CAYf,CAAA;AAVC;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,4BAAY,EAAE,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;;mCACtD;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;;kCAClD;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;;oCAC5B;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;;sCACpC;AAXN,GAAG;IADf,IAAA,yBAAU,GAAE;GACA,GAAG,CAYf;AAZY,kBAAG"}
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../server/service/common-types/log.ts"],"names":[],"mappings":";;;;AAAA,+CAAgD;AAChD,mDAA8C;AAG9C,IAAa,GAAG,GAAhB,MAAa,GAAG;CAYf,CAAA;AAVC;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,4BAAY,EAAE,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;;mCACtD;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;;kCAClD;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;;oCAC5B;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;;sCACpC;AAXN,GAAG;IADf,IAAA,yBAAU,GAAE;GACA,GAAG,CAYf;AAZY,kBAAG","sourcesContent":["import { ObjectType, Field } from 'type-graphql'\nimport { ScalarObject } from './scalar-object'\n\n@ObjectType()\nexport class Log {\n @Field(() => ScalarObject, { description: 'the source of the log' })\n source: object\n\n @Field({ description: 'log level (error, warning, info, ..)' })\n level: string\n\n @Field({ description: 'log body message' })\n message: string\n\n @Field({ description: 'timestamp the log occurred' })\n timestamp: string\n}\n"]}
@@ -1,31 +1,23 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ObjectRef = void 0;
4
+ const tslib_1 = require("tslib");
13
5
  const type_graphql_1 = require("type-graphql");
14
6
  let ObjectRef = class ObjectRef {
15
7
  };
16
- __decorate([
8
+ tslib_1.__decorate([
17
9
  (0, type_graphql_1.Field)(() => type_graphql_1.ID, { description: 'Field id' }),
18
- __metadata("design:type", String)
10
+ tslib_1.__metadata("design:type", String)
19
11
  ], ObjectRef.prototype, "id", void 0);
20
- __decorate([
12
+ tslib_1.__decorate([
21
13
  (0, type_graphql_1.Field)({ nullable: true, description: 'Field name' }),
22
- __metadata("design:type", String)
14
+ tslib_1.__metadata("design:type", String)
23
15
  ], ObjectRef.prototype, "name", void 0);
24
- __decorate([
16
+ tslib_1.__decorate([
25
17
  (0, type_graphql_1.Field)({ nullable: true, description: 'Field description' }),
26
- __metadata("design:type", String)
18
+ tslib_1.__metadata("design:type", String)
27
19
  ], ObjectRef.prototype, "description", void 0);
28
- ObjectRef = __decorate([
20
+ ObjectRef = tslib_1.__decorate([
29
21
  (0, type_graphql_1.InputType)()
30
22
  ], ObjectRef);
31
23
  exports.ObjectRef = ObjectRef;
@@ -1 +1 @@
1
- {"version":3,"file":"object-ref.js","sourceRoot":"","sources":["../../../server/service/common-types/object-ref.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAmD;AAGnD,IAAa,SAAS,GAAtB,MAAa,SAAS;CASrB,CAAA;AAPC;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;;qCACnC;AAGV;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;;uCACxC;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;;8CACxC;AART,SAAS;IADrB,IAAA,wBAAS,GAAE;GACC,SAAS,CASrB;AATY,8BAAS"}
1
+ {"version":3,"file":"object-ref.js","sourceRoot":"","sources":["../../../server/service/common-types/object-ref.ts"],"names":[],"mappings":";;;;AAAA,+CAAmD;AAGnD,IAAa,SAAS,GAAtB,MAAa,SAAS;CASrB,CAAA;AAPC;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;;qCACnC;AAGV;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;;uCACxC;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;;8CACxC;AART,SAAS;IADrB,IAAA,wBAAS,GAAE;GACC,SAAS,CASrB;AATY,8BAAS","sourcesContent":["import { InputType, Field, ID } from 'type-graphql'\n\n@InputType()\nexport class ObjectRef {\n @Field(() => ID, { description: 'Field id' })\n id: string\n\n @Field({ nullable: true, description: 'Field name' })\n name?: string\n\n @Field({ nullable: true, description: 'Field description' })\n description?: string\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scalar-any.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-any.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AAEjD,SAAS,WAAW,CAAC,GAAG;IACtB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACjC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACzB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;IACF,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,GAAG;IACnB,QAAQ,GAAG,CAAC,IAAI,EAAE;QAChB,KAAK,cAAI,CAAC,GAAG;YACX,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC5B,KAAK,cAAI,CAAC,KAAK;YACb,OAAO,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC9B,KAAK,cAAI,CAAC,OAAO;YACf,OAAO,GAAG,CAAC,KAAK,CAAA;QAClB,KAAK,cAAI,CAAC,MAAM;YACd,OAAO,GAAG,CAAC,KAAK,CAAA;QAClB,KAAK,cAAI,CAAC,IAAI;YACZ,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACjC,KAAK,cAAI,CAAC,MAAM;YACd,OAAO,WAAW,CAAC,GAAG,CAAC,CAAA;QACzB;YACE,OAAO,IAAI,CAAA;KACd;AACH,CAAC;AAEY,QAAA,SAAS,GAAG,IAAI,2BAAiB,CAAC;IAC7C,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,6DAA6D;IAC1E,SAAS,CAAC,KAAK;QACb,oEAAoE;QACpE,OAAO,KAAK,CAAA;IACd,CAAC;IACD,UAAU,CAAC,KAAK;QACd,oEAAoE;QACpE,OAAO,KAAK,CAAA;IACd,CAAC;IACD,YAAY,CAAC,GAAG;QACd,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAA;IACtB,CAAC;CACF,CAAC,CAAA"}
1
+ {"version":3,"file":"scalar-any.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-any.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AAEjD,SAAS,WAAW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ScalarType, Kind } from 'graphql'\n\nfunction parseObject(ast) {\n const value = Object.create(null)\n ast.fields.forEach(field => {\n value[field.name.value] = parseAst(field.value)\n })\n return value\n}\n\nfunction parseAst(ast) {\n switch (ast.kind) {\n case Kind.INT:\n return parseInt(ast.value)\n case Kind.FLOAT:\n return parseFloat(ast.value)\n case Kind.BOOLEAN:\n return ast.value\n case Kind.STRING:\n return ast.value\n case Kind.LIST:\n return ast.values.map(parseAst)\n case Kind.OBJECT:\n return parseObject(ast)\n default:\n return null\n }\n}\n\nexport const ScalarAny = new GraphQLScalarType({\n name: 'Any',\n description: 'Any Scalar type (String, Boolean, Int, Float, Object, List)',\n serialize(value) {\n // Implement your own behavior here by setting the 'result' variable\n return value\n },\n parseValue(value) {\n // Implement your own behavior here by setting the 'result' variable\n return value\n },\n parseLiteral(ast) {\n return parseAst(ast)\n }\n})\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scalar-date.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-date.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AAEpC,QAAA,UAAU,GAAG,IAAI,2BAAiB,CAAC;IAC9C,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,yBAAyB;IACtC,UAAU,CAAC,KAAK;QACd,OAAO,IAAI,IAAI,CAAC,KAAwB,CAAC,CAAA,CAAC,wBAAwB;IACpE,CAAC;IACD,SAAS,CAAC,KAAK;QACb;;;WAGG;QACH,OAAO,IAAI,IAAI,CAAC,KAAY,CAAC,CAAC,OAAO,EAAE,CAAA,CAAC,2BAA2B;IACrE,CAAC;IACD,YAAY,CAAC,GAAG;QACd,IAAI,GAAG,CAAC,IAAI,KAAK,cAAI,CAAC,GAAG,EAAE;YACzB,OAAO,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA,CAAC,uCAAuC;SACpE;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAC,CAAA"}
1
+ {"version":3,"file":"scalar-date.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-date.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AAEpC,QAAA,UAAU,GAAG,IAAI,2BAAiB,CAAC;IAC9C,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,yBAAyB;IACtC,UAAU,CAAC,KAAK;QACd,OAAO,IAAI,IAAI,CAAC,KAAwB,CAAC,CAAA,CAAC,wBAAwB;IACpE,CAAC;IACD,SAAS,CAAC,KAAK;QACb;;;WAGG;QACH,OAAO,IAAI,IAAI,CAAC,KAAY,CAAC,CAAC,OAAO,EAAE,CAAA,CAAC,2BAA2B;IACrE,CAAC;IACD,YAAY,CAAC,GAAG;QACd,IAAI,GAAG,CAAC,IAAI,KAAK,cAAI,CAAC,GAAG,EAAE;YACzB,OAAO,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA,CAAC,uCAAuC;SACpE;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLScalarType, Kind } from 'graphql'\n\nexport const ScalarDate = new GraphQLScalarType({\n name: 'Date',\n description: 'Date custom scalar type',\n parseValue(value) {\n return new Date(value as string | number) // value from the client\n },\n serialize(value) {\n /**\n * Note: Allow value to be date only like \"2021-01-31\" to be serialize before passing data to clientside for TypeGraphql.\n * Usage: When database column datatype is \"date\" and data do not contain any time component.\n */\n return new Date(value as any).getTime() // value sent to the client\n },\n parseLiteral(ast) {\n if (ast.kind === Kind.INT) {\n return new Date(+ast.value) // ast value is always in string format\n }\n return null\n }\n})\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scalar-object.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-object.ts"],"names":[],"mappings":";;;AAAA,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;AAEnC,QAAA,YAAY,GAAG,IAAI,iBAAiB,CAAC;IAChD,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,iBAAiB;IAC9B,UAAU,CAAC,KAAK;QACd,OAAO,KAAK,CAAA;IACd,CAAC;IACD,SAAS,CAAC,KAAK;QACb,OAAO,KAAK,CAAA;IACd,CAAC;IACD,YAAY,CAAC,GAAG;QACd,OAAO,GAAG,CAAA;IACZ,CAAC;CACF,CAAC,CAAA"}
1
+ {"version":3,"file":"scalar-object.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-object.ts"],"names":[],"mappings":";;;AAAA,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;AAEnC,QAAA,YAAY,GAAG,IAAI,iBAAiB,CAAC;IAChD,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,iBAAiB;IAC9B,UAAU,CAAC,KAAK;QACd,OAAO,KAAK,CAAA;IACd,CAAC;IACD,SAAS,CAAC,KAAK;QACb,OAAO,KAAK,CAAA;IACd,CAAC;IACD,YAAY,CAAC,GAAG;QACd,OAAO,GAAG,CAAA;IACZ,CAAC;CACF,CAAC,CAAA","sourcesContent":["const { GraphQLScalarType } = require('graphql')\n\nexport const ScalarObject = new GraphQLScalarType({\n name: 'Object',\n description: 'Can be anything',\n parseValue(value) {\n return value\n },\n serialize(value) {\n return value\n },\n parseLiteral(ast) {\n return ast\n }\n})\n"]}
@@ -1,18 +1,5 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./transaction"), exports);
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./transaction"), exports);
18
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/directive-transaction/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/directive-transaction/index.ts"],"names":[],"mappings":";;;AAAA,wDAA6B","sourcesContent":["export * from './transaction'\n"]}
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.transactionDirectiveResolver = exports.transactionDirectiveTypeDefs = void 0;
4
+ const tslib_1 = require("tslib");
7
5
  const graphql_1 = require("graphql");
8
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
6
+ const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
9
7
  const typeorm_1 = require("typeorm");
10
8
  const utils_1 = require("@graphql-tools/utils");
11
- const debug = require('debug')('things-factory:shell:directive-transaction');
12
9
  const DIRECTIVE = 'transaction';
13
10
  exports.transactionDirectiveTypeDefs = (0, graphql_tag_1.default) `
14
11
  directive @${DIRECTIVE} on FIELD_DEFINITION
@@ -20,13 +17,11 @@ const transactionDirectiveResolver = (schema) => (0, utils_1.mapSchema)(schema,
20
17
  if (transactionDirective) {
21
18
  const { resolve = graphql_1.defaultFieldResolver } = fieldConfig;
22
19
  fieldConfig.resolve = async function (source, args, context, info) {
23
- debug('@transaction-begin : ', fieldName);
24
20
  return await (0, typeorm_1.getConnection)().transaction(async (tx) => {
25
21
  /* local-graphql-client로부터 invoke인 경우에는 context.req, context.res 가 없으므로, 빈 오브젝트로 대체해준다. */
26
22
  let wrap = context.app.createContext(context.req || {}, context.res || {});
27
23
  wrap.state = Object.assign(Object.assign({}, context.state), { tx });
28
24
  let result = await resolve.call(this, source, args, wrap, info);
29
- debug('@transaction-end : ', fieldName);
30
25
  return result;
31
26
  });
32
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../server/service/directive-transaction/transaction.ts"],"names":[],"mappings":";;;;;;AAAA,qCAA6D;AAC7D,8DAA6B;AAC7B,qCAAuC;AAEvC,gDAA0E;AAE1E,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,4CAA4C,CAAC,CAAA;AAE5E,MAAM,SAAS,GAAG,aAAa,CAAA;AAElB,QAAA,4BAA4B,GAAG,IAAA,qBAAG,EAAA;iBAC9B,SAAS;GACvB,CAAA;AACI,MAAM,4BAA4B,GAAG,CAAC,MAAqB,EAAE,EAAE,CACpE,IAAA,iBAAS,EAAC,MAAM,EAAE;IAChB,CAAC,kBAAU,CAAC,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,EAAE;;QACpD,MAAM,oBAAoB,GAAG,MAAA,IAAA,oBAAY,EAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,0CAAG,CAAC,CAAC,CAAA;QAC9E,IAAI,oBAAoB,EAAE;YACxB,MAAM,EAAE,OAAO,GAAG,8BAAoB,EAAE,GAAG,WAAW,CAAA;YAEtD,WAAW,CAAC,OAAO,GAAG,KAAK,WAAW,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI;gBAC/D,KAAK,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAA;gBAEzC,OAAO,MAAM,IAAA,uBAAa,GAAE,CAAC,WAAW,CAAC,KAAK,EAAC,EAAE,EAAC,EAAE;oBAClD,0FAA0F;oBAC1F,IAAI,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,CAAA;oBAE1E,IAAI,CAAC,KAAK,mCACL,OAAO,CAAC,KAAK,KAChB,EAAE,GACH,CAAA;oBAED,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;oBAE/D,KAAK,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAA;oBAEvC,OAAO,MAAM,CAAA;gBACf,CAAC,CAAC,CAAA;YACJ,CAAC,CAAA;YAED,OAAO,WAAW,CAAA;SACnB;IACH,CAAC;CACF,CAAC,CAAA;AA9BS,QAAA,4BAA4B,gCA8BrC"}
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../server/service/directive-transaction/transaction.ts"],"names":[],"mappings":";;;;AAAA,qCAA6D;AAC7D,sEAA6B;AAC7B,qCAAuC;AAEvC,gDAA0E;AAE1E,MAAM,SAAS,GAAG,aAAa,CAAA;AAElB,QAAA,4BAA4B,GAAG,IAAA,qBAAG,EAAA;iBAC9B,SAAS;GACvB,CAAA;AACI,MAAM,4BAA4B,GAAG,CAAC,MAAqB,EAAE,EAAE,CACpE,IAAA,iBAAS,EAAC,MAAM,EAAE;IAChB,CAAC,kBAAU,CAAC,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,EAAE;;QACpD,MAAM,oBAAoB,GAAG,MAAA,IAAA,oBAAY,EAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,0CAAG,CAAC,CAAC,CAAA;QAC9E,IAAI,oBAAoB,EAAE;YACxB,MAAM,EAAE,OAAO,GAAG,8BAAoB,EAAE,GAAG,WAAW,CAAA;YAEtD,WAAW,CAAC,OAAO,GAAG,KAAK,WAAW,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI;gBAC/D,OAAO,MAAM,IAAA,uBAAa,GAAE,CAAC,WAAW,CAAC,KAAK,EAAC,EAAE,EAAC,EAAE;oBAClD,0FAA0F;oBAC1F,IAAI,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,CAAA;oBAE1E,IAAI,CAAC,KAAK,mCACL,OAAO,CAAC,KAAK,KAChB,EAAE,GACH,CAAA;oBAED,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;oBAE/D,OAAO,MAAM,CAAA;gBACf,CAAC,CAAC,CAAA;YACJ,CAAC,CAAA;YAED,OAAO,WAAW,CAAA;SACnB;IACH,CAAC;CACF,CAAC,CAAA;AA1BS,QAAA,4BAA4B,gCA0BrC","sourcesContent":["import { defaultFieldResolver, GraphQLSchema } from 'graphql'\nimport gql from 'graphql-tag'\nimport { getConnection } from 'typeorm'\n\nimport { getDirective, MapperKind, mapSchema } from '@graphql-tools/utils'\n\nconst DIRECTIVE = 'transaction'\n\nexport const transactionDirectiveTypeDefs = gql`\n directive @${DIRECTIVE} on FIELD_DEFINITION\n `\nexport const transactionDirectiveResolver = (schema: GraphQLSchema) =>\n mapSchema(schema, {\n [MapperKind.OBJECT_FIELD]: (fieldConfig, fieldName) => {\n const transactionDirective = getDirective(schema, fieldConfig, DIRECTIVE)?.[0]\n if (transactionDirective) {\n const { resolve = defaultFieldResolver } = fieldConfig\n\n fieldConfig.resolve = async function (source, args, context, info) {\n return await getConnection().transaction(async tx => {\n /* local-graphql-client로부터 invoke인 경우에는 context.req, context.res 가 없으므로, 빈 오브젝트로 대체해준다. */\n let wrap = context.app.createContext(context.req || {}, context.res || {})\n\n wrap.state = {\n ...context.state,\n tx\n }\n\n let result = await resolve.call(this, source, args, wrap, info)\n\n return result\n })\n }\n\n return fieldConfig\n }\n }\n })\n"]}
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
2
  Object.defineProperty(exports, "__esModule", { value: true });
15
3
  exports.DomainResolver = void 0;
4
+ const tslib_1 = require("tslib");
16
5
  const type_graphql_1 = require("type-graphql");
17
6
  const typeorm_1 = require("typeorm");
18
7
  const utils_1 = require("@things-factory/utils");
@@ -81,72 +70,72 @@ let DomainResolver = class DomainResolver {
81
70
  return true;
82
71
  }
83
72
  };
84
- __decorate([
73
+ tslib_1.__decorate([
85
74
  (0, type_graphql_1.Directive)('@privilege(category: "system", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
86
75
  (0, type_graphql_1.Query)(returns => domain_1.Domain, { description: 'To fetch domain' }),
87
- __param(0, (0, type_graphql_1.Arg)('id')),
88
- __metadata("design:type", Function),
89
- __metadata("design:paramtypes", [String]),
90
- __metadata("design:returntype", Promise)
76
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
77
+ tslib_1.__metadata("design:type", Function),
78
+ tslib_1.__metadata("design:paramtypes", [String]),
79
+ tslib_1.__metadata("design:returntype", Promise)
91
80
  ], DomainResolver.prototype, "domain", null);
92
- __decorate([
81
+ tslib_1.__decorate([
93
82
  (0, type_graphql_1.Directive)('@privilege(category: "system", privilege: "query", superUserGranted: true)'),
94
83
  (0, type_graphql_1.Query)(returns => domain_types_1.DomainList, { description: 'To fetch multiple domain' }),
95
- __param(0, (0, type_graphql_1.Args)()),
96
- __param(1, (0, type_graphql_1.Ctx)()),
97
- __metadata("design:type", Function),
98
- __metadata("design:paramtypes", [list_param_1.ListParam, Object]),
99
- __metadata("design:returntype", Promise)
84
+ tslib_1.__param(0, (0, type_graphql_1.Args)()),
85
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
86
+ tslib_1.__metadata("design:type", Function),
87
+ tslib_1.__metadata("design:paramtypes", [list_param_1.ListParam, Object]),
88
+ tslib_1.__metadata("design:returntype", Promise)
100
89
  ], DomainResolver.prototype, "domains", null);
101
- __decorate([
90
+ tslib_1.__decorate([
102
91
  (0, type_graphql_1.Query)(returns => Boolean, { description: 'To check if given domain is exist' }),
103
- __param(0, (0, type_graphql_1.Arg)('name')),
104
- __metadata("design:type", Function),
105
- __metadata("design:paramtypes", [String]),
106
- __metadata("design:returntype", Promise)
92
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
93
+ tslib_1.__metadata("design:type", Function),
94
+ tslib_1.__metadata("design:paramtypes", [String]),
95
+ tslib_1.__metadata("design:returntype", Promise)
107
96
  ], DomainResolver.prototype, "checkExistsDomain", null);
108
- __decorate([
97
+ tslib_1.__decorate([
109
98
  (0, type_graphql_1.Directive)('@privilege(category: "system", privilege: "mutation", superUserGranted: true)'),
110
99
  (0, type_graphql_1.Mutation)(returns => domain_1.Domain, { description: 'To create domain' }),
111
- __param(0, (0, type_graphql_1.Arg)('domainInput')),
112
- __metadata("design:type", Function),
113
- __metadata("design:paramtypes", [domain_types_1.DomainPatch]),
114
- __metadata("design:returntype", Promise)
100
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('domainInput')),
101
+ tslib_1.__metadata("design:type", Function),
102
+ tslib_1.__metadata("design:paramtypes", [domain_types_1.DomainPatch]),
103
+ tslib_1.__metadata("design:returntype", Promise)
115
104
  ], DomainResolver.prototype, "createDomain", null);
116
- __decorate([
105
+ tslib_1.__decorate([
117
106
  (0, type_graphql_1.Directive)('@privilege(category: "system", privilege: "mutation", superUserGranted: true)'),
118
107
  (0, type_graphql_1.Mutation)(returns => domain_1.Domain, { description: 'To delete domain' }),
119
- __param(0, (0, type_graphql_1.Arg)('name')),
120
- __metadata("design:type", Function),
121
- __metadata("design:paramtypes", [String]),
122
- __metadata("design:returntype", Promise)
108
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
109
+ tslib_1.__metadata("design:type", Function),
110
+ tslib_1.__metadata("design:paramtypes", [String]),
111
+ tslib_1.__metadata("design:returntype", Promise)
123
112
  ], DomainResolver.prototype, "deleteDomain", null);
124
- __decorate([
113
+ tslib_1.__decorate([
125
114
  (0, type_graphql_1.Directive)('@privilege(category: "system", privilege: "mutation", superUserGranted: true)'),
126
115
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple domains' }),
127
- __param(0, (0, type_graphql_1.Arg)('names', () => [String])),
128
- __metadata("design:type", Function),
129
- __metadata("design:paramtypes", [Array]),
130
- __metadata("design:returntype", Promise)
116
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('names', () => [String])),
117
+ tslib_1.__metadata("design:type", Function),
118
+ tslib_1.__metadata("design:paramtypes", [Array]),
119
+ tslib_1.__metadata("design:returntype", Promise)
131
120
  ], DomainResolver.prototype, "deleteDomains", null);
132
- __decorate([
121
+ tslib_1.__decorate([
133
122
  (0, type_graphql_1.Directive)('@privilege(category: "system", privilege: "mutation", domainOwnerGranted: true, superUserGranted: true)'),
134
123
  (0, type_graphql_1.Mutation)(returns => domain_1.Domain, { description: 'To update domain' }),
135
- __param(0, (0, type_graphql_1.Arg)('name')),
136
- __param(1, (0, type_graphql_1.Arg)('patch', () => domain_types_1.DomainPatch)),
137
- __metadata("design:type", Function),
138
- __metadata("design:paramtypes", [String, domain_types_1.DomainPatch]),
139
- __metadata("design:returntype", Promise)
124
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
125
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('patch', () => domain_types_1.DomainPatch)),
126
+ tslib_1.__metadata("design:type", Function),
127
+ tslib_1.__metadata("design:paramtypes", [String, domain_types_1.DomainPatch]),
128
+ tslib_1.__metadata("design:returntype", Promise)
140
129
  ], DomainResolver.prototype, "updateDomain", null);
141
- __decorate([
130
+ tslib_1.__decorate([
142
131
  (0, type_graphql_1.Directive)('@privilege(category: "system", privilege: "mutation", superUserGranted: true)'),
143
132
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To update multiple domains' }),
144
- __param(0, (0, type_graphql_1.Arg)('patches', () => [domain_types_1.DomainPatch])),
145
- __metadata("design:type", Function),
146
- __metadata("design:paramtypes", [Array]),
147
- __metadata("design:returntype", Promise)
133
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', () => [domain_types_1.DomainPatch])),
134
+ tslib_1.__metadata("design:type", Function),
135
+ tslib_1.__metadata("design:paramtypes", [Array]),
136
+ tslib_1.__metadata("design:returntype", Promise)
148
137
  ], DomainResolver.prototype, "updateDomains", null);
149
- DomainResolver = __decorate([
138
+ DomainResolver = tslib_1.__decorate([
150
139
  (0, type_graphql_1.Resolver)(domain_1.Domain)
151
140
  ], DomainResolver);
152
141
  exports.DomainResolver = DomainResolver;
@@ -1 +1 @@
1
- {"version":3,"file":"domain-resolver.js","sourceRoot":"","sources":["../../../server/service/domain/domain-resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAmF;AACnF,qCAAuD;AAEvD,iDAA+C;AAE/C,uEAA2D;AAC3D,2DAAsD;AACtD,qCAAiC;AACjC,iDAAwD;AAGxD,IAAa,cAAc,GAA3B,MAAa,cAAc;IAGzB,KAAK,CAAC,MAAM,CAAY,EAAU;QAChC,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,eAAM,CAAC,CAAA;QAExC,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IACzC,CAAC;IAID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0BAAW;;kDAQhG;AAID;IAFC,IAAA,wBAAS,EAAC,+EAA+E,CAAC;IAC1F,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;IACvD,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,0BAAW,CAAC,CAAC,CAAA;;;;mDAqBvD;AArGU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,eAAM,CAAC;GACJ,cAAc,CAsG1B;AAtGY,wCAAc","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver } from 'type-graphql'\nimport { getRepository, In, Repository } from 'typeorm'\n\nimport { slugger } from '@things-factory/utils'\n\nimport { buildQuery } from '../../utils/list-query-builder'\nimport { ListParam } from '../common-types/list-param'\nimport { Domain } from './domain'\nimport { DomainList, DomainPatch } from './domain-types'\n\n@Resolver(Domain)\nexport class DomainResolver {\n @Directive('@privilege(category: \"system\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => Domain, { description: 'To fetch domain' })\n async domain(@Arg('id') id: string): Promise<Domain> {\n const repository = getRepository(Domain)\n\n return await repository.findOne({ id })\n }\n\n @Directive('@privilege(category: \"system\", privilege: \"query\", superUserGranted: true)')\n @Query(returns => DomainList, { description: 'To fetch multiple domain' })\n async domains(@Args() params: ListParam, @Ctx() context): Promise<DomainList> {\n const queryBuilder = getRepository(Domain).createQueryBuilder()\n\n buildQuery(queryBuilder, params || {}, context, {\n domainRef: false,\n searchables: ['name', 'description', 'subdomain']\n })\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Query(returns => Boolean, { description: 'To check if given domain is exist' })\n async checkExistsDomain(@Arg('name') name: string) {\n const domainRepository: Repository<Domain> = getRepository(Domain)\n const targetSubdomain: string = slugger(name)\n\n const oldDomain = await domainRepository.findOne({ subdomain: targetSubdomain })\n if (oldDomain) {\n throw new Error('domain is duplicated')\n }\n\n return true\n }\n\n @Directive('@privilege(category: \"system\", privilege: \"mutation\", superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To create domain' })\n async createDomain(@Arg('domainInput') domainInput: DomainPatch) {\n const { name, description } = domainInput\n const domainRepo: Repository<Domain> = getRepository(Domain)\n const subdomain: string = slugger(name)\n\n const domain: Domain = await domainRepo.findOne({ subdomain })\n if (domain) {\n throw new Error('domain is duplicated')\n }\n\n return await domainRepo.save({ name, description, subdomain })\n }\n\n @Directive('@privilege(category: \"system\", privilege: \"mutation\", superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To delete domain' })\n async deleteDomain(@Arg('name') name: string) {\n return await getRepository(Domain).delete({ name })\n }\n\n @Directive('@privilege(category: \"system\", privilege: \"mutation\", superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple domains' })\n async deleteDomains(@Arg('names', () => [String]) names: string[]) {\n const domains: Domain[] = await getRepository(Domain).find({ where: { name: In(names) } })\n const domainIds: string[] = domains.map(domain => domain.id)\n\n await getRepository(Domain).delete({ id: In(domainIds) })\n }\n\n @Directive('@privilege(category: \"system\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To update domain' })\n async updateDomain(@Arg('name') name: string, @Arg('patch', () => DomainPatch) patch: DomainPatch) {\n const repository = getRepository(Domain)\n const domain: Domain = await repository.findOne({ name })\n\n return await repository.save({\n ...domain,\n ...patch\n } as any)\n }\n\n @Directive('@privilege(category: \"system\", privilege: \"mutation\", superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To update multiple domains' })\n async updateDomains(@Arg('patches', () => [DomainPatch]) patches: DomainPatch[]): Promise<boolean> {\n const domainRepo: Repository<Domain> = getRepository(Domain)\n\n const patchIds = patches.filter((patch: any) => patch.id)\n\n if (patchIds.length > 0) {\n patchIds.forEach(async updateRecord => {\n const domain: Domain = await domainRepo.findOne({ where: { id: updateRecord.id } })\n\n if (updateRecord.name) {\n updateRecord.subdomain = slugger(updateRecord.name)\n }\n\n await domainRepo.save({\n ...domain,\n ...updateRecord\n } as any)\n })\n }\n\n return true\n }\n}\n"]}