@tsed/formio 6.90.0 → 6.93.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -65,24 +65,11 @@ let FormioModule = class FormioModule {
65
65
  }
66
66
  // istanbul ignore next
67
67
  async $onReady() {
68
- if (this.formio.isInit()) {
68
+ if (this.formio.isInit() && this.injector.settings.getBestHost) {
69
69
  const { injector } = this;
70
- const { httpsPort, httpPort } = injector.settings;
71
- const displayLog = (host) => {
72
- const url = [`${host.protocol}://${host.address}`, typeof host.port === "number" && host.port].filter(Boolean).join(":");
73
- injector.logger.info(`Form.io API is available on ${url}${this.baseUrl || "/"}`);
74
- };
75
- /* istanbul ignore next */
76
- if (httpsPort) {
77
- this.formio.config.protocol = "https";
78
- const host = injector.settings.getHttpsPort();
79
- displayLog({ protocol: "https", ...host });
80
- }
81
- else if (httpPort) {
82
- this.formio.config.protocol = "http";
83
- const host = injector.settings.getHttpPort();
84
- displayLog({ protocol: "http", ...host });
85
- }
70
+ const host = injector.settings.getBestHost();
71
+ const url = host.toString();
72
+ injector.logger.info(`Form.io API is available on ${url}${this.baseUrl || "/"}`);
86
73
  }
87
74
  }
88
75
  async shouldInstall() {
@@ -1 +1 @@
1
- {"version":3,"file":"FormioModule.js","sourceRoot":"","sources":["../../src/FormioModule.ts"],"names":[],"mappings":";;;;AAAA,yCASsB;AACtB,qCAAqC;AACrC,iCAAgC;AAChC,4DAAuD;AACvD,wDAAmD;AACnD,sDAAiD;AACjD,oDAA+C;AAC/C,sDAAiD;AACjD,oFAA+E;AAC/E,oFAA+E;AAG/E,oEAA+D;AAC/D,sEAAiE;AACjE,gEAA2D;AAC3D,4DAAuD;AAgBvD,IAAa,YAAY,GAAzB,MAAa,YAAY;IA+BvB,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,IAAA,gBAAS,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,IAAI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CAAiB;YACjB,2BAAY;YACZ,qBAAS;YACT,uBAAU;YACV,mBAAQ;YACR,qBAAS;YACT,mDAAwB;YACxB,mDAAwB;SACzB;KACF,CAAC;GACW,YAAY,CAsHxB;AAtHY,oCAAY","sourcesContent":["import {\n Constant,\n Inject,\n InjectorService,\n OnReady,\n OnRoutesInit,\n PlatformApplication,\n PlatformRouteDetails,\n normalizePath\n} from \"@tsed/common\";\nimport {deepClone} from \"@tsed/core\";\nimport {Module} from \"@tsed/di\";\nimport {AlterActions} from \"./components/AlterActions\";\nimport {AlterAudit} from \"./components/AlterAudit\";\nimport {AlterHost} from \"./components/AlterHost\";\nimport {AlterLog} from \"./components/AlterLog\";\nimport {AlterSkip} from \"./components/AlterSkip\";\nimport {AlterTemplateExportSteps} from \"./components/AlterTemplateExportSteps\";\nimport {AlterTemplateImportSteps} from \"./components/AlterTemplateImportSteps\";\nimport {FormioConfig} from \"./domain/FormioConfig\";\nimport {FormioTemplate} from \"./domain/FormioTemplate\";\nimport {FormioAuthService} from \"./services/FormioAuthService\";\nimport {FormioHooksService} from \"./services/FormioHooksService\";\nimport {FormioInstaller} from \"./services/FormioInstaller\";\nimport {FormioService} from \"./services/FormioService\";\n\n@Module({\n imports: [\n FormioService,\n FormioHooksService,\n FormioAuthService,\n AlterActions,\n AlterHost,\n AlterAudit,\n AlterLog,\n AlterSkip,\n AlterTemplateImportSteps,\n AlterTemplateExportSteps\n ]\n})\nexport class FormioModule implements OnRoutesInit, OnReady {\n @Inject()\n protected formio: FormioService;\n\n @Inject()\n protected hooks: FormioHooksService;\n\n @Inject()\n protected installer: FormioInstaller;\n\n @Inject()\n protected app: PlatformApplication;\n\n @Inject()\n protected injector: InjectorService;\n\n @Constant(\"formio\", {})\n protected settings: FormioConfig;\n\n @Constant(\"formio.baseUrl\", \"/\")\n protected baseUrl: string;\n\n @Constant(\"formio.skipInstall\", false)\n protected skipInstall: boolean;\n\n @Constant(\"formio.template\")\n protected template?: FormioTemplate;\n\n @Constant(\"formio.root\")\n protected root?: any;\n\n $onInit() {\n return this.init(deepClone(this.settings));\n }\n\n async init(options: FormioConfig) {\n return this.formio.init(options, this.hooks.getHooks());\n }\n\n async $onRoutesInit() {\n if (this.formio.isInit()) {\n const router: any = this.app.getRouter();\n\n router.use(this.baseUrl, this.formio.middleware.restrictRequestTypes, this.formio.router);\n\n if (await this.shouldInstall()) {\n await this.installer.install(this.template!, this.root);\n }\n }\n }\n\n async $logRoutes(routes: PlatformRouteDetails[]): Promise<PlatformRouteDetails[]> {\n if (this.formio.isInit()) {\n const spec = (await this.formio.swagger(\n {\n $ctx: {\n request: {\n protocol: \"http\",\n host: \"localhost\"\n }\n }\n },\n this.formio.router\n )) as any;\n const {baseUrl} = this;\n\n Object.entries(spec.paths).forEach(([path, methods]: [string, any]) => {\n Object.entries(methods).forEach(([method, operation]: [string, any]) => {\n routes.push({\n toJSON() {\n return {\n method,\n name: operation.operationId,\n url: normalizePath(baseUrl, path.replace(/\\/{(.*)}/gi, \"/:$1\")),\n className: \"formio\",\n methodClassName: operation.operationId,\n parameters: [],\n rawBody: false\n };\n }\n } as any);\n });\n });\n }\n\n return routes;\n }\n\n // istanbul ignore next\n async $onReady(): Promise<void> {\n if (this.formio.isInit()) {\n const {injector} = this;\n const {httpsPort, httpPort} = injector.settings;\n\n const displayLog = (host: any) => {\n const url = [`${host.protocol}://${host.address}`, typeof host.port === \"number\" && host.port].filter(Boolean).join(\":\");\n\n injector.logger.info(`Form.io API is available on ${url}${this.baseUrl || \"/\"}`);\n };\n\n /* istanbul ignore next */\n if (httpsPort) {\n (this.formio.config as any).protocol = \"https\";\n const host = injector.settings.getHttpsPort();\n displayLog({protocol: \"https\", ...host});\n } else if (httpPort) {\n (this.formio.config as any).protocol = \"http\";\n const host = injector.settings.getHttpPort();\n displayLog({protocol: \"http\", ...host});\n }\n }\n }\n\n protected async shouldInstall() {\n const hasForms = await this.installer.hasForms();\n\n return this.template && !(hasForms || this.skipInstall);\n }\n}\n"]}
1
+ {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MAAM,CAAC,IAAI,CAAC,+BAA+B,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC;SAClF;IACH,CAAC;IAES,KAAK,CAAC,aAAa;QAC3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;QAEjD,OAAO,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1D,CAAC;CACF,CAAA;AAtGC;IADC,IAAA,eAAM,GAAE;2CACS,6BAAa;4CAAC;AAGhC;IADC,IAAA,eAAM,GAAE;2CACQ,uCAAkB;2CAAC;AAGpC;IADC,IAAA,eAAM,GAAE;2CACY,iCAAe;+CAAC;AAGrC;IADC,IAAA,eAAM,GAAE;2CACM,4BAAmB;yCAAC;AAGnC;IADC,IAAA,eAAM,GAAE;2CACW,wBAAe;8CAAC;AAGpC;IADC,IAAA,iBAAQ,EAAC,QAAQ,EAAE,EAAE,CAAC;;8CACU;AAGjC;IADC,IAAA,iBAAQ,EAAC,gBAAgB,EAAE,GAAG,CAAC;;6CACN;AAG1B;IADC,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,KAAK,CAAC;;iDACP;AAG/B;IADC,IAAA,iBAAQ,EAAC,iBAAiB,CAAC;;8CACQ;AAGpC;IADC,IAAA,iBAAQ,EAAC,aAAa,CAAC;;0CACH;AA7BV,YAAY;IAdxB,IAAA,WAAM,EAAC;QACN,OAAO,EAAE;YACP,6BAAa;YACb,uCAAkB;YAClB,qCAAiB;YACjB,2BAAY;YACZ,qBAAS;YACT,uBAAU;YACV,mBAAQ;YACR,qBAAS;YACT,mDAAwB;YACxB,mDAAwB;SACzB;KACF,CAAC;GACW,YAAY,CAwGxB;AAxGY,oCAAY","sourcesContent":["import {\n Constant,\n Inject,\n InjectorService,\n normalizePath,\n OnReady,\n OnRoutesInit,\n PlatformApplication,\n PlatformRouteDetails\n} from \"@tsed/common\";\nimport {deepClone} from \"@tsed/core\";\nimport {Module} from \"@tsed/di\";\nimport {AlterActions} from \"./components/AlterActions\";\nimport {AlterAudit} from \"./components/AlterAudit\";\nimport {AlterHost} from \"./components/AlterHost\";\nimport {AlterLog} from \"./components/AlterLog\";\nimport {AlterSkip} from \"./components/AlterSkip\";\nimport {AlterTemplateExportSteps} from \"./components/AlterTemplateExportSteps\";\nimport {AlterTemplateImportSteps} from \"./components/AlterTemplateImportSteps\";\nimport {FormioConfig} from \"./domain/FormioConfig\";\nimport {FormioTemplate} from \"./domain/FormioTemplate\";\nimport {FormioAuthService} from \"./services/FormioAuthService\";\nimport {FormioHooksService} from \"./services/FormioHooksService\";\nimport {FormioInstaller} from \"./services/FormioInstaller\";\nimport {FormioService} from \"./services/FormioService\";\n\n@Module({\n imports: [\n FormioService,\n FormioHooksService,\n FormioAuthService,\n AlterActions,\n AlterHost,\n AlterAudit,\n AlterLog,\n AlterSkip,\n AlterTemplateImportSteps,\n AlterTemplateExportSteps\n ]\n})\nexport class FormioModule implements OnRoutesInit, OnReady {\n @Inject()\n protected formio: FormioService;\n\n @Inject()\n protected hooks: FormioHooksService;\n\n @Inject()\n protected installer: FormioInstaller;\n\n @Inject()\n protected app: PlatformApplication;\n\n @Inject()\n protected injector: InjectorService;\n\n @Constant(\"formio\", {})\n protected settings: FormioConfig;\n\n @Constant(\"formio.baseUrl\", \"/\")\n protected baseUrl: string;\n\n @Constant(\"formio.skipInstall\", false)\n protected skipInstall: boolean;\n\n @Constant(\"formio.template\")\n protected template?: FormioTemplate;\n\n @Constant(\"formio.root\")\n protected root?: any;\n\n $onInit() {\n return this.init(deepClone(this.settings));\n }\n\n async init(options: FormioConfig) {\n return this.formio.init(options, this.hooks.getHooks());\n }\n\n async $onRoutesInit() {\n if (this.formio.isInit()) {\n const router: any = this.app.getRouter();\n\n router.use(this.baseUrl, this.formio.middleware.restrictRequestTypes, this.formio.router);\n\n if (await this.shouldInstall()) {\n await this.installer.install(this.template!, this.root);\n }\n }\n }\n\n async $logRoutes(routes: PlatformRouteDetails[]): Promise<PlatformRouteDetails[]> {\n if (this.formio.isInit()) {\n const spec = (await this.formio.swagger(\n {\n $ctx: {\n request: {\n protocol: \"http\",\n host: \"localhost\"\n }\n }\n },\n this.formio.router\n )) as any;\n const {baseUrl} = this;\n\n Object.entries(spec.paths).forEach(([path, methods]: [string, any]) => {\n Object.entries(methods).forEach(([method, operation]: [string, any]) => {\n routes.push({\n toJSON() {\n return {\n method,\n name: operation.operationId,\n url: normalizePath(baseUrl, path.replace(/\\/{(.*)}/gi, \"/:$1\")),\n className: \"formio\",\n methodClassName: operation.operationId,\n parameters: [],\n rawBody: false\n };\n }\n } as any);\n });\n });\n }\n\n return routes;\n }\n\n // istanbul ignore next\n async $onReady(): Promise<void> {\n if (this.formio.isInit() && this.injector.settings.getBestHost) {\n const {injector} = this;\n const host = injector.settings.getBestHost();\n const url = host.toString();\n\n injector.logger.info(`Form.io API is available on ${url}${this.baseUrl || \"/\"}`);\n }\n }\n\n protected async shouldInstall() {\n const hasForms = await this.installer.hasForms();\n\n return this.template && !(hasForms || this.skipInstall);\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
- import { Constant, Inject, InjectorService, PlatformApplication, normalizePath } from "@tsed/common";
2
+ import { Constant, Inject, InjectorService, normalizePath, PlatformApplication } from "@tsed/common";
3
3
  import { deepClone } from "@tsed/core";
4
4
  import { Module } from "@tsed/di";
5
5
  import { AlterActions } from "./components/AlterActions";
@@ -62,24 +62,11 @@ let FormioModule = class FormioModule {
62
62
  }
63
63
  // istanbul ignore next
64
64
  async $onReady() {
65
- if (this.formio.isInit()) {
65
+ if (this.formio.isInit() && this.injector.settings.getBestHost) {
66
66
  const { injector } = this;
67
- const { httpsPort, httpPort } = injector.settings;
68
- const displayLog = (host) => {
69
- const url = [`${host.protocol}://${host.address}`, typeof host.port === "number" && host.port].filter(Boolean).join(":");
70
- injector.logger.info(`Form.io API is available on ${url}${this.baseUrl || "/"}`);
71
- };
72
- /* istanbul ignore next */
73
- if (httpsPort) {
74
- this.formio.config.protocol = "https";
75
- const host = injector.settings.getHttpsPort();
76
- displayLog({ protocol: "https", ...host });
77
- }
78
- else if (httpPort) {
79
- this.formio.config.protocol = "http";
80
- const host = injector.settings.getHttpPort();
81
- displayLog({ protocol: "http", ...host });
82
- }
67
+ const host = injector.settings.getBestHost();
68
+ const url = host.toString();
69
+ injector.logger.info(`Form.io API is available on ${url}${this.baseUrl || "/"}`);
83
70
  }
84
71
  }
85
72
  async shouldInstall() {
@@ -1 +1 @@
1
- {"version":3,"file":"FormioModule.js","sourceRoot":"","sources":["../../src/FormioModule.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,MAAM,EACN,eAAe,EAGf,mBAAmB,EAEnB,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAG/E,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAgBvD,IAAa,YAAY,GA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AdxB,MAAM,CAAC;QACN,OAAO,EAAE;YACP,aAAa;YACb,kBAAkB;YAClB,iBAAiB;YACjB,YAAY;YACZ,SAAS;YACT,UAAU;YACV,QAAQ;YACR,SAAS;YACT,wBAAwB;YACxB,wBAAwB;SACzB;KACF,CAAC;GACW,YAAY,CAsHxB;SAtHY,YAAY","sourcesContent":["import {\n Constant,\n Inject,\n InjectorService,\n OnReady,\n OnRoutesInit,\n PlatformApplication,\n PlatformRouteDetails,\n normalizePath\n} from \"@tsed/common\";\nimport {deepClone} from \"@tsed/core\";\nimport {Module} from \"@tsed/di\";\nimport {AlterActions} from \"./components/AlterActions\";\nimport {AlterAudit} from \"./components/AlterAudit\";\nimport {AlterHost} from \"./components/AlterHost\";\nimport {AlterLog} from \"./components/AlterLog\";\nimport {AlterSkip} from \"./components/AlterSkip\";\nimport {AlterTemplateExportSteps} from \"./components/AlterTemplateExportSteps\";\nimport {AlterTemplateImportSteps} from \"./components/AlterTemplateImportSteps\";\nimport {FormioConfig} from \"./domain/FormioConfig\";\nimport {FormioTemplate} from \"./domain/FormioTemplate\";\nimport {FormioAuthService} from \"./services/FormioAuthService\";\nimport {FormioHooksService} from \"./services/FormioHooksService\";\nimport {FormioInstaller} from \"./services/FormioInstaller\";\nimport {FormioService} from \"./services/FormioService\";\n\n@Module({\n imports: [\n FormioService,\n FormioHooksService,\n FormioAuthService,\n AlterActions,\n AlterHost,\n AlterAudit,\n AlterLog,\n AlterSkip,\n AlterTemplateImportSteps,\n AlterTemplateExportSteps\n ]\n})\nexport class FormioModule implements OnRoutesInit, OnReady {\n @Inject()\n protected formio: FormioService;\n\n @Inject()\n protected hooks: FormioHooksService;\n\n @Inject()\n protected installer: FormioInstaller;\n\n @Inject()\n protected app: PlatformApplication;\n\n @Inject()\n protected injector: InjectorService;\n\n @Constant(\"formio\", {})\n protected settings: FormioConfig;\n\n @Constant(\"formio.baseUrl\", \"/\")\n protected baseUrl: string;\n\n @Constant(\"formio.skipInstall\", false)\n protected skipInstall: boolean;\n\n @Constant(\"formio.template\")\n protected template?: FormioTemplate;\n\n @Constant(\"formio.root\")\n protected root?: any;\n\n $onInit() {\n return this.init(deepClone(this.settings));\n }\n\n async init(options: FormioConfig) {\n return this.formio.init(options, this.hooks.getHooks());\n }\n\n async $onRoutesInit() {\n if (this.formio.isInit()) {\n const router: any = this.app.getRouter();\n\n router.use(this.baseUrl, this.formio.middleware.restrictRequestTypes, this.formio.router);\n\n if (await this.shouldInstall()) {\n await this.installer.install(this.template!, this.root);\n }\n }\n }\n\n async $logRoutes(routes: PlatformRouteDetails[]): Promise<PlatformRouteDetails[]> {\n if (this.formio.isInit()) {\n const spec = (await this.formio.swagger(\n {\n $ctx: {\n request: {\n protocol: \"http\",\n host: \"localhost\"\n }\n }\n },\n this.formio.router\n )) as any;\n const {baseUrl} = this;\n\n Object.entries(spec.paths).forEach(([path, methods]: [string, any]) => {\n Object.entries(methods).forEach(([method, operation]: [string, any]) => {\n routes.push({\n toJSON() {\n return {\n method,\n name: operation.operationId,\n url: normalizePath(baseUrl, path.replace(/\\/{(.*)}/gi, \"/:$1\")),\n className: \"formio\",\n methodClassName: operation.operationId,\n parameters: [],\n rawBody: false\n };\n }\n } as any);\n });\n });\n }\n\n return routes;\n }\n\n // istanbul ignore next\n async $onReady(): Promise<void> {\n if (this.formio.isInit()) {\n const {injector} = this;\n const {httpsPort, httpPort} = injector.settings;\n\n const displayLog = (host: any) => {\n const url = [`${host.protocol}://${host.address}`, typeof host.port === \"number\" && host.port].filter(Boolean).join(\":\");\n\n injector.logger.info(`Form.io API is available on ${url}${this.baseUrl || \"/\"}`);\n };\n\n /* istanbul ignore next */\n if (httpsPort) {\n (this.formio.config as any).protocol = \"https\";\n const host = injector.settings.getHttpsPort();\n displayLog({protocol: \"https\", ...host});\n } else if (httpPort) {\n (this.formio.config as any).protocol = \"http\";\n const host = injector.settings.getHttpPort();\n displayLog({protocol: \"http\", ...host});\n }\n }\n }\n\n protected async shouldInstall() {\n const hasForms = await this.installer.hasForms();\n\n return this.template && !(hasForms || this.skipInstall);\n }\n}\n"]}
1
+ {"version":3,"file":"FormioModule.js","sourceRoot":"","sources":["../../src/FormioModule.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EAGb,mBAAmB,EAEpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAG/E,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAgBvD,IAAa,YAAY,GAAzB,MAAa,YAAY;IA+BvB,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAqB;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,I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BAAgB,EAAE,GAAG,CAAC;;6CACN;AAG1B;IADC,QAAQ,CAAC,oBAAoB,EAAE,KAAK,CAAC;;iDACP;AAG/B;IADC,QAAQ,CAAC,iBAAiB,CAAC;;8CACQ;AAGpC;IADC,QAAQ,CAAC,aAAa,CAAC;;0CACH;AA7BV,YAAY;IAdxB,MAAM,CAAC;QACN,OAAO,EAAE;YACP,aAAa;YACb,kBAAkB;YAClB,iBAAiB;YACjB,YAAY;YACZ,SAAS;YACT,UAAU;YACV,QAAQ;YACR,SAAS;YACT,wBAAwB;YACxB,wBAAwB;SACzB;KACF,CAAC;GACW,YAAY,CAwGxB;SAxGY,YAAY","sourcesContent":["import {\n Constant,\n Inject,\n InjectorService,\n normalizePath,\n OnReady,\n OnRoutesInit,\n PlatformApplication,\n PlatformRouteDetails\n} from \"@tsed/common\";\nimport {deepClone} from \"@tsed/core\";\nimport {Module} from \"@tsed/di\";\nimport {AlterActions} from \"./components/AlterActions\";\nimport {AlterAudit} from \"./components/AlterAudit\";\nimport {AlterHost} from \"./components/AlterHost\";\nimport {AlterLog} from \"./components/AlterLog\";\nimport {AlterSkip} from \"./components/AlterSkip\";\nimport {AlterTemplateExportSteps} from \"./components/AlterTemplateExportSteps\";\nimport {AlterTemplateImportSteps} from \"./components/AlterTemplateImportSteps\";\nimport {FormioConfig} from \"./domain/FormioConfig\";\nimport {FormioTemplate} from \"./domain/FormioTemplate\";\nimport {FormioAuthService} from \"./services/FormioAuthService\";\nimport {FormioHooksService} from \"./services/FormioHooksService\";\nimport {FormioInstaller} from \"./services/FormioInstaller\";\nimport {FormioService} from \"./services/FormioService\";\n\n@Module({\n imports: [\n FormioService,\n FormioHooksService,\n FormioAuthService,\n AlterActions,\n AlterHost,\n AlterAudit,\n AlterLog,\n AlterSkip,\n AlterTemplateImportSteps,\n AlterTemplateExportSteps\n ]\n})\nexport class FormioModule implements OnRoutesInit, OnReady {\n @Inject()\n protected formio: FormioService;\n\n @Inject()\n protected hooks: FormioHooksService;\n\n @Inject()\n protected installer: FormioInstaller;\n\n @Inject()\n protected app: PlatformApplication;\n\n @Inject()\n protected injector: InjectorService;\n\n @Constant(\"formio\", {})\n protected settings: FormioConfig;\n\n @Constant(\"formio.baseUrl\", \"/\")\n protected baseUrl: string;\n\n @Constant(\"formio.skipInstall\", false)\n protected skipInstall: boolean;\n\n @Constant(\"formio.template\")\n protected template?: FormioTemplate;\n\n @Constant(\"formio.root\")\n protected root?: any;\n\n $onInit() {\n return this.init(deepClone(this.settings));\n }\n\n async init(options: FormioConfig) {\n return this.formio.init(options, this.hooks.getHooks());\n }\n\n async $onRoutesInit() {\n if (this.formio.isInit()) {\n const router: any = this.app.getRouter();\n\n router.use(this.baseUrl, this.formio.middleware.restrictRequestTypes, this.formio.router);\n\n if (await this.shouldInstall()) {\n await this.installer.install(this.template!, this.root);\n }\n }\n }\n\n async $logRoutes(routes: PlatformRouteDetails[]): Promise<PlatformRouteDetails[]> {\n if (this.formio.isInit()) {\n const spec = (await this.formio.swagger(\n {\n $ctx: {\n request: {\n protocol: \"http\",\n host: \"localhost\"\n }\n }\n },\n this.formio.router\n )) as any;\n const {baseUrl} = this;\n\n Object.entries(spec.paths).forEach(([path, methods]: [string, any]) => {\n Object.entries(methods).forEach(([method, operation]: [string, any]) => {\n routes.push({\n toJSON() {\n return {\n method,\n name: operation.operationId,\n url: normalizePath(baseUrl, path.replace(/\\/{(.*)}/gi, \"/:$1\")),\n className: \"formio\",\n methodClassName: operation.operationId,\n parameters: [],\n rawBody: false\n };\n }\n } as any);\n });\n });\n }\n\n return routes;\n }\n\n // istanbul ignore next\n async $onReady(): Promise<void> {\n if (this.formio.isInit() && this.injector.settings.getBestHost) {\n const {injector} = this;\n const host = injector.settings.getBestHost();\n const url = host.toString();\n\n injector.logger.info(`Form.io API is available on ${url}${this.baseUrl || \"/\"}`);\n }\n }\n\n protected async shouldInstall() {\n const hasForms = await this.installer.hasForms();\n\n return this.template && !(hasForms || this.skipInstall);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/formio",
3
- "version": "6.90.0",
3
+ "version": "6.93.0",
4
4
  "description": "Formio package for Ts.ED framework",
5
5
  "private": false,
6
6
  "keywords": [
@@ -28,24 +28,24 @@
28
28
  "test": "cross-env NODE_ENV=test nyc mocha"
29
29
  },
30
30
  "dependencies": {
31
- "@tsed/formio-types": "6.90.0",
31
+ "@tsed/formio-types": "6.93.0",
32
32
  "tslib": "2.2.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@tsed/common": "6.90.0",
36
- "@tsed/core": "6.90.0",
37
- "@tsed/di": "6.90.0",
38
- "@tsed/mongoose": "6.90.0",
35
+ "@tsed/common": "6.93.0",
36
+ "@tsed/core": "6.93.0",
37
+ "@tsed/di": "6.93.0",
38
+ "@tsed/mongoose": "6.93.0",
39
39
  "express": "^4.17.1",
40
40
  "formio": "^2.0.0",
41
41
  "mongodb": "*",
42
42
  "mongoose": "^5.12.2"
43
43
  },
44
44
  "peerDependencies": {
45
- "@tsed/common": "^6.90.0",
46
- "@tsed/core": "^6.90.0",
47
- "@tsed/di": "^6.90.0",
48
- "@tsed/mongoose": "^6.90.0",
45
+ "@tsed/common": "^6.93.0",
46
+ "@tsed/core": "^6.93.0",
47
+ "@tsed/di": "^6.93.0",
48
+ "@tsed/mongoose": "^6.93.0",
49
49
  "express": "^4.17.1",
50
50
  "formio": "^2.0.0",
51
51
  "mongodb": "*",