@things-factory/api 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.
@@ -1,19 +1,6 @@
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 });
3
+ const tslib_1 = require("tslib");
17
4
  require("./routes");
18
- __exportStar(require("./routers"), exports);
5
+ tslib_1.__exportStar(require("./routers"), exports);
19
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oBAAiB;AAEjB,4CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;AAAA,oBAAiB;AAEjB,oDAAyB","sourcesContent":["import './routes'\n\nexport * from './routers'\n"]}
@@ -1,16 +1,13 @@
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.initMiddlewares = exports.apiDocsRouter = exports.PREFIX = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const lodash_1 = require("lodash");
9
- const koa_router_1 = __importDefault(require("koa-router"));
10
- const yamljs_1 = __importDefault(require("yamljs"));
4
+ const tslib_1 = require("tslib");
5
+ const koa_router_1 = tslib_1.__importDefault(require("koa-router"));
11
6
  const koa2_swagger_ui_1 = require("koa2-swagger-ui");
7
+ const lodash_1 = require("lodash");
8
+ const path_1 = tslib_1.__importDefault(require("path"));
9
+ const yamljs_1 = tslib_1.__importDefault(require("yamljs"));
12
10
  const env_1 = require("@things-factory/env");
13
- const debug = require('debug')('things-factory:api:api-docs-router');
14
11
  const openapiDir = path_1.default.join(env_1.appRootPath, 'dist-client', 'openapi');
15
12
  exports.PREFIX = '/api-docs';
16
13
  exports.apiDocsRouter = new koa_router_1.default();
@@ -27,7 +24,6 @@ function initMiddlewares(app) {
27
24
  .filter(filename => /\.yaml$/.test(filename))
28
25
  .forEach(file => {
29
26
  const version = path_1.default.basename(file, path_1.default.extname(file));
30
- debug('build -file', file, path_1.default.join(openapiDir, version));
31
27
  if (fs.existsSync(path_1.default.join(openapiDir, version))) {
32
28
  spec[version] = fs
33
29
  .readdirSync(path_1.default.join(openapiDir, version))
@@ -41,16 +37,14 @@ function initMiddlewares(app) {
41
37
  spec[version] = yamljs_1.default.parse(fs.readFileSync(path_1.default.join(openapiDir, file)).toString());
42
38
  }
43
39
  });
44
- debug('build', spec);
45
40
  }
46
41
  catch (err) {
47
- debug('build error', err);
42
+ console.error('build error', err);
48
43
  }
49
44
  }
50
45
  build();
51
46
  process.on('client-rebuilt', (app, compilerFileSystem) => {
52
47
  /* change filesystem whenever webpacking assets done. only for development mode. */
53
- debug('client-rebuilt', 'openapi filesystem changed');
54
48
  fs = compilerFileSystem;
55
49
  build();
56
50
  });
@@ -1 +1 @@
1
- {"version":3,"file":"api-docs-router.js","sourceRoot":"","sources":["../../server/routers/api-docs-router.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,mCAA8B;AAC9B,4DAA+B;AAC/B,oDAAyB;AAEzB,qDAA4C;AAC5C,6CAAiD;AAEjD,MAAM,KAAK,GA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O,CAAC,EAAE,CAAC,gBAAuB,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;QAC9D,mFAAmF;QACnF,EAAE,GAAG,kBAAkB,CAAA;QACvB,KAAK,EAAE,CAAA;IACT,CAAC,CAAC,CAAA;IAEF,qBAAa,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACrD,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,CAAA;QAEhC,OAAO,MAAM,IAAA,4BAAU,EAAC,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAC/G,CAAC,CAAC,CAAA;IAEF,WAAW;IACX,qBAAa,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAChD,IAAI,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QAEzC,OAAO,CAAC,QAAQ,CAAC,GAAG,cAAM,IAAI,cAAc,EAAE,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;AACJ,CAAC;AA5DD,0CA4DC","sourcesContent":["import Router from 'koa-router'\nimport { koaSwagger } from 'koa2-swagger-ui'\nimport { merge } from 'lodash'\nimport path from 'path'\nimport yaml from 'yamljs'\n\nimport { appRootPath } from '@things-factory/env'\n\nconst openapiDir = path.join(appRootPath, 'dist-client', 'openapi')\n\nexport const PREFIX = '/api-docs'\nexport const apiDocsRouter = new Router()\n\nexport function initMiddlewares(app) {\n var fs = require('fs')\n\n var spec = {}\n\n function build() {\n try {\n if (!fs.existsSync(openapiDir)) {\n return\n }\n\n var files = fs.readdirSync(openapiDir)\n\n files\n .filter(filename => /\\.yaml$/.test(filename))\n .forEach(file => {\n const version = path.basename(file, path.extname(file))\n\n if (fs.existsSync(path.join(openapiDir, version))) {\n spec[version] = fs\n .readdirSync(path.join(openapiDir, version))\n .filter(filename => /\\.yaml$/.test(filename))\n .reduce(\n (merged, file) => {\n const parsed = yaml.parse(fs.readFileSync(path.join(openapiDir, version, file)).toString())\n return merge(merged, parsed)\n },\n {\n ...yaml.parse(fs.readFileSync(path.join(openapiDir, file)).toString())\n }\n )\n } else {\n spec[version] = yaml.parse(fs.readFileSync(path.join(openapiDir, file)).toString())\n }\n })\n } catch (err) {\n console.error('build error', err)\n }\n }\n\n build()\n\n process.on('client-rebuilt' as any, (app, compilerFileSystem) => {\n /* change filesystem whenever webpacking assets done. only for development mode. */\n fs = compilerFileSystem\n build()\n })\n\n apiDocsRouter.get(`/:version`, async (context, next) => {\n let { version } = context.params\n\n return await koaSwagger({ routePrefix: false, swaggerOptions: { spec: spec[version] || {} } })(context, next)\n })\n\n // fallback\n apiDocsRouter.get('(.*)', async (context, next) => {\n var defaultVersion = Object.keys(spec)[0]\n\n context.redirect(`${PREFIX}/${defaultVersion}`)\n })\n}\n"]}
@@ -1,19 +1,6 @@
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("./restful-api-router"), exports);
18
- __exportStar(require("./api-docs-router"), exports);
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./restful-api-router"), exports);
5
+ tslib_1.__exportStar(require("./api-docs-router"), exports);
19
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/routers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC;AACpC,oDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/routers/index.ts"],"names":[],"mappings":";;;AAAA,+DAAoC;AACpC,4DAAiC","sourcesContent":["export * from './restful-api-router'\nexport * from './api-docs-router'\n"]}
@@ -1,13 +1,10 @@
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.restfulApiRouter = void 0;
7
- const koa_router_1 = __importDefault(require("koa-router"));
8
- const shell_1 = require("@things-factory/shell");
4
+ const tslib_1 = require("tslib");
5
+ const koa_router_1 = tslib_1.__importDefault(require("koa-router"));
9
6
  const auth_base_1 = require("@things-factory/auth-base");
10
- const debug = require('debug')('things-factory:operato-hub:restful-api-router');
7
+ const shell_1 = require("@things-factory/shell");
11
8
  exports.restfulApiRouter = new koa_router_1.default();
12
9
  exports.restfulApiRouter.use(auth_base_1.jwtAuthenticateMiddleware);
13
10
  exports.restfulApiRouter.use(auth_base_1.domainAuthenticateMiddleware);
@@ -15,7 +12,6 @@ exports.restfulApiRouter.use(async (context, next) => {
15
12
  context.state.version = context.path.split('/')[2];
16
13
  context.state.client = shell_1.GraphqlLocalClient.client;
17
14
  const { user, domain, version } = context.state;
18
- debug('context', context.url, user === null || user === void 0 ? void 0 : user.email, domain === null || domain === void 0 ? void 0 : domain.subdomain, version);
19
15
  if (!user) {
20
16
  context.status = 401;
21
17
  context.body = context.t('error.user not found');
@@ -1 +1 @@
1
- {"version":3,"file":"restful-api-router.js","sourceRoot":"","sources":["../../server/routers/restful-api-router.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAC/B,iDAA0D;AAC1D,yDAAmG;AAEnG,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,+CAA+C,CAAC,CAAA;AAElE,QAAA,gBAAgB,GAAG,IAAI,oBAAM,EAAE,CAAA;AAE5C,wBAAgB,CAAC,GAAG,CAAC,qCAAyB,CAAC,CAAA;AAC/C,wBAAgB,CAAC,GAAG,CAAC,wCAA4B,CAAC,CAAA;AAElD,wBAAgB,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IAC3C,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAClD,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,0BAAkB,CAAC,MAAM,CAAA;IAEhD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAE/C,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,EAAE,OAAO,CAAC,CAAA;IAEtE,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,CAAC,MAAM,GAAG,GAAG,CAAA;QACpB,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAA;QAChD,OAAM;KACP;IAED,MAAM,IAAI,EAAE,CAAA;AACd,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"restful-api-router.js","sourceRoot":"","sources":["../../server/routers/restful-api-router.ts"],"names":[],"mappings":";;;;AAAA,oEAA+B;AAE/B,yDAAmG;AACnG,iDAA0D;AAE7C,QAAA,gBAAgB,GAAG,IAAI,oBAAM,EAAE,CAAA;AAE5C,wBAAgB,CAAC,GAAG,CAAC,qCAAyB,CAAC,CAAA;AAC/C,wBAAgB,CAAC,GAAG,CAAC,wCAA4B,CAAC,CAAA;AAElD,wBAAgB,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IAC3C,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAClD,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,0BAAkB,CAAC,MAAM,CAAA;IAEhD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAE/C,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,CAAC,MAAM,GAAG,GAAG,CAAA;QACpB,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAA;QAChD,OAAM;KACP;IAED,MAAM,IAAI,EAAE,CAAA;AACd,CAAC,CAAC,CAAA","sourcesContent":["import Router from 'koa-router'\n\nimport { domainAuthenticateMiddleware, jwtAuthenticateMiddleware } from '@things-factory/auth-base'\nimport { GraphqlLocalClient } from '@things-factory/shell'\n\nexport const restfulApiRouter = new Router()\n\nrestfulApiRouter.use(jwtAuthenticateMiddleware)\nrestfulApiRouter.use(domainAuthenticateMiddleware)\n\nrestfulApiRouter.use(async (context, next) => {\n context.state.version = context.path.split('/')[2]\n context.state.client = GraphqlLocalClient.client\n\n const { user, domain, version } = context.state\n\n if (!user) {\n context.status = 401\n context.body = context.t('error.user not found')\n return\n }\n\n await next()\n})\n"]}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const routers_1 = require("./routers");
4
- const debug = require('debug')('things-factory:api:routes');
5
4
  process.on('bootstrap-module-global-public-route', (app, globalPublicRouter) => {
6
5
  globalPublicRouter.use(routers_1.PREFIX, routers_1.apiDocsRouter.routes(), routers_1.apiDocsRouter.allowedMethods());
7
6
  });
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;AAAA,uCAAoF;AAEpF,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,2BAA2B,CAAC,CAAA;AAE3D,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF,kBAAkB,CAAC,GAAG,CAAC,gBAAa,EAAE,uBAAa,CAAC,MAAM,EAAE,EAAE,uBAAa,CAAC,cAAc,EAAE,CAAC,CAAA;AAC/F,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF,oGAAoG;IACpG,kBAAkB,CAAC,GAAG,CAAC,MAAM,EAAE,0BAAgB,CAAC,MAAM,EAAE,EAAE,0BAAgB,CAAC,cAAc,EAAE,CAAC,CAAA;AAC9F,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;AAAA,uCAAoF;AAEpF,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF,kBAAkB,CAAC,GAAG,CAAC,gBAAa,EAAE,uBAAa,CAAC,MAAM,EAAE,EAAE,uBAAa,CAAC,cAAc,EAAE,CAAC,CAAA;AAC/F,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF,oGAAoG;IACpG,kBAAkB,CAAC,GAAG,CAAC,MAAM,EAAE,0BAAgB,CAAC,MAAM,EAAE,EAAE,0BAAgB,CAAC,cAAc,EAAE,CAAC,CAAA;AAC9F,CAAC,CAAC,CAAA","sourcesContent":["import { apiDocsRouter, PREFIX as apiDocsPrefix, restfulApiRouter } from './routers'\n\nprocess.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {\n globalPublicRouter.use(apiDocsPrefix, apiDocsRouter.routes(), apiDocsRouter.allowedMethods())\n})\n\nprocess.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {\n /* API nested-routers authentication with jwtAuthenticateMiddleware based on domain-public-router */\n domainPublicRouter.use('/api', restfulApiRouter.routes(), restfulApiRouter.allowedMethods())\n})\n"]}
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/tslib/tslib.d.ts","../server/routers/restful-api-router.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/@types/accepts/index.d.ts","../../../node_modules/@types/keygrip/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/@types/cookies/index.d.ts","../../../node_modules/@types/http-assert/index.d.ts","../../../node_modules/@types/http-errors/index.d.ts","../../../node_modules/@types/koa-compose/index.d.ts","../../../node_modules/@types/content-disposition/index.d.ts","../../../node_modules/@types/koa/index.d.ts","../../../node_modules/koa2-swagger-ui/dist/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../server/routers/api-docs-router.ts","../server/routers/index.ts","../server/routes.ts","../server/index.ts","../../../node_modules/jest-diff/build/cleanupsemantic.d.ts","../../../node_modules/jest-diff/build/types.d.ts","../../../node_modules/jest-diff/build/difflines.d.ts","../../../node_modules/jest-diff/build/printdiffs.d.ts","../../../node_modules/jest-diff/build/index.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts"],"fileInfos":[{"version":"f5c28122bee592cfaf5c72ed7bcc47f453b79778ffa6e301f45d21a0970719d4","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"3f149f903dd20dfeb7c80e228b659f0e436532de772469980dbd00702cc05cc1","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"cd483c056da900716879771893a3c9772b66c3c88f8943b4205aec738a94b1d0","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"c37f8a49593a0030eecb51bbfa270e709bec9d79a6cc3bb851ef348d4e6b26f8","affectsGlobalScope":true},"14a84fbe4ec531dcbaf5d2594fd95df107258e60ae6c6a076404f13c3f66f28e","7d699d9af89e51be5f2e42edb8e89b6d3c361c49781765239fc742de0092ea35","9122ed7070e054b73ebab37c2373a196def2d90e7d1a9a7fcd9d46b0e51fae78","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"77f0b5c6a193a699c9f7d7fb0578e64e562d271afa740783665d2a827104a873","affectsGlobalScope":true},"21a167fec8f933752fb8157f06d28fab6817af3ad9b0bdb1908a10762391eab9",{"version":"3e4624c306340ad303cc536a07004e81336c3f088308a9e4a9f4c957a3cda2fd","affectsGlobalScope":true},"0c0cee62cb619aed81133b904f644515ba3064487002a7da83fd8aa07b1b4abd","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","34ec1daf3566f26c43dbab380af0de1aac29166e57e4f9ef379a2f154e0cb290","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","75ecef44f126e2ae018b4abbd85b6e8a2e2ba1638ebec56cc64274643ce3567b","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"249a2b90439cdfd51709539fbfa4dfe0791cbae6efce1e9b327ba8f8cd703f49","affectsGlobalScope":true},"acc8fa7e1d03f0d8c4af03c75027086d80bf1cb17edd2d71313bee7bd12dfb91","a9b6b0f7b1e30359283b131ba6d1c51ee2d3601a2f12e1623141e6a1a60c92a5","aeee0090b38de0dd47ca9a79ad5c2d156e3e09d92306719b0b45a3e96098e564","7bac475dcdd9f7e4e9da934d32c305bc889c4ce3c8ac0ef45a93a8d670fff607","09416dd69576b03a3f485adf329a02f043e4a481e060ef5b208194e488d31fd9","8acf99b1c8682276a63ea5bb68433782715892726b97e4604a415e4e56bce41c",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"3b145a2351f5cf16abf999c8d5f4481c74dffdc54ec1e9a89992e2622e1226c5","a907bf91df26df2400858ef75f749498fb5cf00062bf90a737ac3949cc07978d","cb92bc2e42b261e4299025756f1beb826b3d9666a3f0d46f8a7254ca512f57e4","4275d5f964e7fc7afc18538e26b3748c207dd772998346d17f409749aa1f3a63",{"version":"59a638a504490fecaacf0020b9814b6abee37edb66047eb1ab9f7c2274bf1da0","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","d1a78a3c5708807e8de3e399f91df4797c62e44b02195eefc2209b2e713e54ee","8c4c1a64db28930732033c31418f817dcb9d09d706766707ae6d38f23faf0c53","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","556bf5c36deb62cffa1bf697c1789fe008ec82db0273025001db66732714e9d9","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true},"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","653968fc1b35c5eb3d273d36fac1c1dc66f9537edf28f33485b8776bd956e23d",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","a381f079c4804442f179d742fdb2e495fe28d67a47cac673485f75ae2e77aeca","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"bfe39beb986d2a2e512c091cbe924f1c415bc65de54de0e2f6a0dc6f84c183d9","affectsGlobalScope":true},"2af17363f8a062e3a8cd1b26030af0058b3f86e783f4fc6aa9f57247f240ebaa","06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","dfe08140492cdc135fb7fd9c4a652c05207b61a436906079b87da1d3111314bf","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa","089e1f8603cbc35ab977c8dcc662eb754b82fca32ed1dfb16bd682726c2d5432","8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"64d5585e08ad1ab194b18bf4e851f22a626eae33ac7312ca4ba90bb7ea7daf64","6738101ae8e56cd3879ab3f99630ada7d78097fc9fd334df7e766216778ca219","ce013414484233b24f42c0fcfca48a60bb66ab4e13c82953662305e8f1ee4925","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"ae3fe461989bbd951344efc1f1fe932360ce7392e6126bdb225a82a1bbaf15ee","affectsGlobalScope":true},"c8fda835044ca50d9eacb72ea0d354fe22f321dd9eb0e424f294fe1806ce6dfb","f47887b61c6cf2f48746980390d6cb5b8013518951d912cfb37fe748071942be","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","15c88bfd1b8dc7231ff828ae8df5d955bae5ebca4cf2bcb417af5821e52299ae","eb96a2321f717bccc3e49e104e299152984b927ea4546b559ae631c06565819c","e98185f4249720ace1921d59c1ff4612fa5c633a183fc9bf28e2e7b8e3c7fd51","6168414aa12d33d0fcfac4f9870aa81ce27e136db6faf182001a5f3792e1d720","5006668996956580886022c05108e32c742823e1b5652aff7914917233731518","204dbe6c72467fb14bbe8f06510b11fb541b6ce29580c6e10ebd3bdb2eb0c1f9","3a9b877f47119ac64aab98c61cae91a304ddeb6e8285ccd824a6aa665ffaeb95","12726c18586ded182601e7e3094ff98ddbbc9dc1997ef2b9ec75210f65a31fe0","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","fe4a2042d087990ebfc7dc0142d5aaf5a152e4baea86b45f283f103ec1e871ea","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","ca59fe42b81228a317812e95a2e72ccc8c7f1911b5f0c2a032adf41a0161ec5d","9364c7566b0be2f7b70ff5285eb34686f83ccb01bda529b82d23b2a844653bfb","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","ae9930989ed57478eb03b9b80ad3efa7a3eacdfeff0f78ecf7894c4963a64f93","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3e59f00ab03c33717b3130066d4debb272da90eeded4935ff0604c2bc25a5cae","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"3ef8a12300aedc5be2628baa0edf8fb33e66db4bf1ce8d5ae5e4bc2643475b21","1595acb507efa301fb317474e354c1e7441cecca88da1a4303dcdd1b88bf7cfd","7e59de6156579b34e31bbcbe46b958ddb12fd92b4e85d8541a8fc844fb943bf8","21f46345928a48b3eb9f8720d93269227c26ec99611414fb036516bf0864e76a","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","69da61a7b5093dac77fa3bec8be95dcf9a74c95a0e9161edb98bb24e30e439d2","561eca7a381b96d6ccac6e4061e6d2ae53f5bc44203f3fd9f5b26864c32ae6e9","62ea38627e3ebab429f7616812a9394d327c2bc271003dfba985de9b4137369f","b4439890c168d646357928431100daac5cbdee1d345a34e6bf6eca9f3abe22bc","5d72971a459517c44c1379dab9ed248e87a61ba0a1e0f25c9d67e1e640cd9a09","02d734976af36f4273d930bea88b3e62adf6b078cf120c1c63d49aa8d8427c5c",{"version":"516a426e3960379f310107635b8f3a7e8c307c6c665080b128039d9299ec4087","affectsGlobalScope":true}],"options":{"allowSyntheticDefaultImports":true,"declaration":false,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"importHelpers":true,"inlineSources":true,"module":1,"noEmitOnError":true,"noImplicitAny":false,"outDir":"./","sourceMap":true,"strict":false,"target":4,"useDefineForClassFields":false},"fileIdsList":[[62,88,95],[62,88,95,103],[88],[62,88,95,97,103,105],[59,62,88,95,98,99],[88,99,100,102,104],[88,134,136],[88,135],[88,111],[59,62,63,67,73,87,88,95,96,97,106,107,108,109,110],[88,113,115,116,117,118,119,120,121,122,123,124,125],[88,113,114,116,117,118,119,120,121,122,123,124,125],[88,114,115,116,117,118,119,120,121,122,123,124,125],[88,113,114,115,117,118,119,120,121,122,123,124,125],[88,113,114,115,116,118,119,120,121,122,123,124,125],[88,113,114,115,116,117,119,120,121,122,123,124,125],[88,113,114,115,116,117,118,120,121,122,123,124,125],[88,113,114,115,116,117,118,119,121,122,123,124,125],[88,113,114,115,116,117,118,119,120,122,123,124,125],[88,113,114,115,116,117,118,119,120,121,123,124,125],[88,113,114,115,116,117,118,119,120,121,122,124,125],[88,113,114,115,116,117,118,119,120,121,122,123,125],[88,113,114,115,116,117,118,119,120,121,122,123,124],[44,88],[47,88],[48,53,88],[49,59,60,67,76,87,88],[49,50,59,67,88],[51,88],[52,53,60,68,88],[53,76,84,88],[54,56,59,67,88],[55,88],[56,57,88],[58,59,88],[59,88],[59,60,61,76,87,88],[59,60,61,76,79,88],[88,92],[62,67,76,87,88],[59,60,62,63,67,76,84,87,88],[62,64,76,84,87,88],[44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94],[59,65,88],[66,87,88],[56,59,67,76,88],[68,88],[69,88],[47,70,88],[71,86,88,92],[72,88],[73,88],[59,74,88],[74,75,88,90],[59,76,77,78,79,88],[76,78,88],[76,77,88],[79,88],[80,88],[59,82,83,88],[82,83,88],[53,67,76,84,88],[85,88],[67,86,88],[48,62,73,87,88],[53,88],[76,88,89],[88,90],[88,91],[48,53,59,61,70,76,87,88,90,92],[76,88,93],[62,88,95,101],[88,130,131],[88,130,131,132,133],[42,88,127,128],[42,69,88,112,125],[42,43,88,126],[42,88],[42,88,127]],"referencedMap":[[96,1],[104,2],[103,1],[110,3],[106,4],[100,5],[105,6],[107,3],[108,3],[137,7],[136,8],[135,3],[97,3],[109,9],[111,10],[114,11],[115,12],[113,13],[116,14],[117,15],[118,16],[119,17],[120,18],[121,19],[122,20],[123,21],[124,22],[125,23],[101,3],[44,24],[45,24],[47,25],[48,26],[49,27],[50,28],[51,29],[52,30],[53,31],[54,32],[55,33],[56,34],[57,34],[58,35],[59,36],[60,37],[61,38],[46,39],[94,3],[62,40],[63,41],[64,42],[95,43],[65,44],[66,45],[67,46],[68,47],[69,48],[70,49],[71,50],[72,51],[73,52],[74,53],[75,54],[76,55],[78,56],[77,57],[79,58],[80,59],[81,3],[82,60],[83,61],[84,62],[85,63],[86,64],[87,65],[88,66],[89,67],[90,68],[91,69],[92,70],[93,71],[99,3],[98,3],[102,72],[130,3],[132,73],[134,74],[133,73],[131,3],[112,9],[42,3],[8,3],[10,3],[9,3],[2,3],[11,3],[12,3],[13,3],[14,3],[15,3],[16,3],[17,3],[18,3],[3,3],[4,3],[22,3],[19,3],[20,3],[21,3],[23,3],[24,3],[25,3],[5,3],[26,3],[27,3],[28,3],[29,3],[6,3],[30,3],[31,3],[32,3],[33,3],[7,3],[34,3],[39,3],[40,3],[35,3],[36,3],[37,3],[38,3],[1,3],[41,3],[129,75],[126,76],[127,77],[43,78],[128,79]],"exportedModulesMap":[[96,1],[104,2],[103,1],[110,3],[106,4],[100,5],[105,6],[107,3],[108,3],[137,7],[136,8],[135,3],[97,3],[109,9],[111,10],[114,11],[115,12],[113,13],[116,14],[117,15],[118,16],[119,17],[120,18],[121,19],[122,20],[123,21],[124,22],[125,23],[101,3],[44,24],[45,24],[47,25],[48,26],[49,27],[50,28],[51,29],[52,30],[53,31],[54,32],[55,33],[56,34],[57,34],[58,35],[59,36],[60,37],[61,38],[46,39],[94,3],[62,40],[63,41],[64,42],[95,43],[65,44],[66,45],[67,46],[68,47],[69,48],[70,49],[71,50],[72,51],[73,52],[74,53],[75,54],[76,55],[78,56],[77,57],[79,58],[80,59],[81,3],[82,60],[83,61],[84,62],[85,63],[86,64],[87,65],[88,66],[89,67],[90,68],[91,69],[92,70],[93,71],[99,3],[98,3],[102,72],[130,3],[132,73],[134,74],[133,73],[131,3],[112,9],[42,3],[8,3],[10,3],[9,3],[2,3],[11,3],[12,3],[13,3],[14,3],[15,3],[16,3],[17,3],[18,3],[3,3],[4,3],[22,3],[19,3],[20,3],[21,3],[23,3],[24,3],[25,3],[5,3],[26,3],[27,3],[28,3],[29,3],[6,3],[30,3],[31,3],[32,3],[33,3],[7,3],[34,3],[39,3],[40,3],[35,3],[36,3],[37,3],[38,3],[1,3],[41,3],[129,75],[126,76],[127,77],[43,78],[128,79]],"semanticDiagnosticsPerFile":[96,104,103,110,106,100,105,107,108,137,136,135,97,109,111,114,115,113,116,117,118,119,120,121,122,123,124,125,101,44,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,46,94,62,63,64,95,65,66,67,68,69,70,71,72,73,74,75,76,78,77,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,99,98,102,130,132,134,133,131,112,42,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,30,31,32,33,7,34,39,40,35,36,37,38,1,41,129,126,127,43,128]},"version":"4.7.4"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/api",
3
- "version": "5.0.7",
3
+ "version": "5.0.11",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,12 +24,12 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/auth-base": "^5.0.7",
28
- "@things-factory/component-ui": "^5.0.0",
29
- "@things-factory/shell": "^5.0.7",
27
+ "@things-factory/auth-base": "^5.0.11",
28
+ "@things-factory/component-ui": "^5.0.11",
29
+ "@things-factory/shell": "^5.0.11",
30
30
  "koa2-swagger-ui": "^5.0.2",
31
31
  "swagger-jsdoc": "^5.0.0",
32
32
  "yamljs": "^0.3.0"
33
33
  },
34
- "gitHead": "1c7c7618e2e3c9ef8b07d730c3df84c8bc01b35f"
34
+ "gitHead": "37cd4feb62e062899cae7029588d86a5d4b4036a"
35
35
  }
@@ -1,13 +1,11 @@
1
- import path from 'path'
2
- import { merge } from 'lodash'
3
1
  import Router from 'koa-router'
2
+ import { koaSwagger } from 'koa2-swagger-ui'
3
+ import { merge } from 'lodash'
4
+ import path from 'path'
4
5
  import yaml from 'yamljs'
5
6
 
6
- import { koaSwagger } from 'koa2-swagger-ui'
7
7
  import { appRootPath } from '@things-factory/env'
8
8
 
9
- const debug = require('debug')('things-factory:api:api-docs-router')
10
-
11
9
  const openapiDir = path.join(appRootPath, 'dist-client', 'openapi')
12
10
 
13
11
  export const PREFIX = '/api-docs'
@@ -30,7 +28,7 @@ export function initMiddlewares(app) {
30
28
  .filter(filename => /\.yaml$/.test(filename))
31
29
  .forEach(file => {
32
30
  const version = path.basename(file, path.extname(file))
33
- debug('build -file', file, path.join(openapiDir, version))
31
+
34
32
  if (fs.existsSync(path.join(openapiDir, version))) {
35
33
  spec[version] = fs
36
34
  .readdirSync(path.join(openapiDir, version))
@@ -48,10 +46,8 @@ export function initMiddlewares(app) {
48
46
  spec[version] = yaml.parse(fs.readFileSync(path.join(openapiDir, file)).toString())
49
47
  }
50
48
  })
51
-
52
- debug('build', spec)
53
49
  } catch (err) {
54
- debug('build error', err)
50
+ console.error('build error', err)
55
51
  }
56
52
  }
57
53
 
@@ -59,7 +55,6 @@ export function initMiddlewares(app) {
59
55
 
60
56
  process.on('client-rebuilt' as any, (app, compilerFileSystem) => {
61
57
  /* change filesystem whenever webpacking assets done. only for development mode. */
62
- debug('client-rebuilt', 'openapi filesystem changed')
63
58
  fs = compilerFileSystem
64
59
  build()
65
60
  })
@@ -1,8 +1,7 @@
1
1
  import Router from 'koa-router'
2
- import { GraphqlLocalClient } from '@things-factory/shell'
3
- import { jwtAuthenticateMiddleware, domainAuthenticateMiddleware } from '@things-factory/auth-base'
4
2
 
5
- const debug = require('debug')('things-factory:operato-hub:restful-api-router')
3
+ import { domainAuthenticateMiddleware, jwtAuthenticateMiddleware } from '@things-factory/auth-base'
4
+ import { GraphqlLocalClient } from '@things-factory/shell'
6
5
 
7
6
  export const restfulApiRouter = new Router()
8
7
 
@@ -15,8 +14,6 @@ restfulApiRouter.use(async (context, next) => {
15
14
 
16
15
  const { user, domain, version } = context.state
17
16
 
18
- debug('context', context.url, user?.email, domain?.subdomain, version)
19
-
20
17
  if (!user) {
21
18
  context.status = 401
22
19
  context.body = context.t('error.user not found')
package/server/routes.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import { apiDocsRouter, PREFIX as apiDocsPrefix, restfulApiRouter } from './routers'
2
2
 
3
- const debug = require('debug')('things-factory:api:routes')
4
-
5
3
  process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {
6
4
  globalPublicRouter.use(apiDocsPrefix, apiDocsRouter.routes(), apiDocsRouter.allowedMethods())
7
5
  })