@itwin/express-server 5.4.0-dev.7 → 5.4.1
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
# Change Log - @itwin/express-server
|
|
2
2
|
|
|
3
|
-
This log was last generated on Thu,
|
|
3
|
+
This log was last generated on Thu, 11 Dec 2025 21:29:32 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.4.1
|
|
6
|
+
Thu, 11 Dec 2025 21:29:32 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 5.4.0
|
|
11
|
+
Tue, 02 Dec 2025 21:22:25 GMT
|
|
12
|
+
|
|
13
|
+
### Updates
|
|
14
|
+
|
|
15
|
+
- Add support for Node.js 24
|
|
16
|
+
|
|
17
|
+
## 5.3.3
|
|
18
|
+
Thu, 20 Nov 2025 22:30:37 GMT
|
|
19
|
+
|
|
20
|
+
_Version update only_
|
|
21
|
+
|
|
22
|
+
## 5.3.2
|
|
23
|
+
Thu, 13 Nov 2025 23:23:23 GMT
|
|
24
|
+
|
|
25
|
+
_Version update only_
|
|
4
26
|
|
|
5
27
|
## 5.3.1
|
|
6
28
|
Thu, 06 Nov 2025 20:29:06 GMT
|
|
@@ -12,6 +34,16 @@ Mon, 03 Nov 2025 19:02:35 GMT
|
|
|
12
34
|
|
|
13
35
|
_Version update only_
|
|
14
36
|
|
|
37
|
+
## 5.2.6
|
|
38
|
+
Thu, 13 Nov 2025 21:13:51 GMT
|
|
39
|
+
|
|
40
|
+
_Version update only_
|
|
41
|
+
|
|
42
|
+
## 5.2.5
|
|
43
|
+
Thu, 13 Nov 2025 07:45:14 GMT
|
|
44
|
+
|
|
45
|
+
_Version update only_
|
|
46
|
+
|
|
15
47
|
## 5.2.4
|
|
16
48
|
Fri, 24 Oct 2025 16:20:38 GMT
|
|
17
49
|
|
|
@@ -120,6 +152,11 @@ Fri, 13 Jun 2025 20:25:38 GMT
|
|
|
120
152
|
- Dropped support for Node 18
|
|
121
153
|
- Added ESM support
|
|
122
154
|
|
|
155
|
+
## 4.11.7
|
|
156
|
+
Thu, 13 Nov 2025 20:49:33 GMT
|
|
157
|
+
|
|
158
|
+
_Version update only_
|
|
159
|
+
|
|
123
160
|
## 4.11.6
|
|
124
161
|
Mon, 16 Jun 2025 15:00:15 GMT
|
|
125
162
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express-server.js","sourceRoot":"","sources":["../../src/express-server.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,mCAAmC;AACnC,uCAAuC;AAEvC,oDAAuG;AACvG,sDAAuD;AAUvD;;;;;;GAMG;AACH,MAAa,qBAAqB;IAChC,6CAA6C;IACtC,MAAM,CAAU,QAAQ,GAAgC;QAC7D,WAAW,EAAE,KAAK;KACnB,CAAC;IAEM,SAAS,CAAoB;IAC7B,OAAO,CAA8B;IACnC,IAAI,GAAkC,OAAO,EAAE,CAAC;IAE1D,aAAa;IACb,IAAW,gBAAgB,KAAuB,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC;IAExF,YAAY,QAA2B,EAAE,MAAM,GAAG,qBAAqB,CAAC,QAAQ;QAC9E,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAES,oBAAoB;QAC5B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QACjE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;IAES,iBAAiB;QACz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,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;YAChC,IAAI,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,UAAU,CAAC,IAAqB;QAC3C,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAExB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC5B,OAAO,IAAI,OAAO,CAAa,CAAC,OAAO,EAAE,EAAE;YACzC,MAAM,MAAM,GAAe,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5F,CAAC,CAAC,CAAC;IACL,CAAC;;AAzDH,sDA0DC;AAED;;GAEG;AACH,MAAa,aAAc,SAAQ,qBAAqB;IACnC,gBAAgB;QAChC,IAAI,CAAC,IAAY,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAO,EAAE,IAAS,EAAE,EAAE,CAAC,+BAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;QACpF,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAC3B,CAAC;IAED,YAAY,QAA2B,EAAE,MAAM,GAAG,qBAAqB,CAAC,QAAQ;QAC9E,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACxB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;CACF;AAVD,sCAUC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as express from \"express\";\nimport * as enableWs from \"express-ws\";\nimport { Server as HttpServer } from \"http\";\nimport { BentleyCloudRpcConfiguration, RpcConfiguration, WebAppRpcProtocol } from \"@itwin/core-common\";\nimport { LocalhostIpcHost } from \"@itwin/core-backend\";\n\n/**\n * Options for configuring IModelJsExpressServer.\n * @public\n */\nexport interface IModelJsExpressServerConfig {\n uploadLimit: string;\n}\n\n/**\n * An express web server with some reasonable defaults for web applications built with @bentley/webpack-tools.\n * @note This server is not designed to be a hardened, secure endpoint on the public internet.\n * It is intended to participate in a private HTTP exchange with a public-facing routing and provisioning infrastructure\n * that should be supplied by the application's deployment environment.\n * @public\n */\nexport class IModelJsExpressServer {\n /** The default configuration for servers. */\n public static readonly defaults: IModelJsExpressServerConfig = {\n uploadLimit: \"5mb\",\n };\n\n private _protocol: WebAppRpcProtocol;\n private _config: IModelJsExpressServerConfig;\n protected _app: import(\"express\").Application = express();\n\n /** @alpha */\n public get rpcConfiguration(): RpcConfiguration { return this._protocol.configuration; }\n\n constructor(protocol: WebAppRpcProtocol, config = IModelJsExpressServer.defaults) {\n this._protocol = protocol;\n this._config = config;\n }\n\n protected _configureMiddleware() {\n this._app.use(express.text({ limit: this._config.uploadLimit }));\n this._app.use(express.raw({ limit: this._config.uploadLimit }));\n }\n\n protected _configureHeaders() {\n // enable CORS for all apis\n this._app.all(\"/**\", (_req, res, next) => {\n res.header(\"Access-Control-Allow-Origin\", BentleyCloudRpcConfiguration.accessControl.allowOrigin);\n res.header(\"Access-Control-Allow-Methods\", BentleyCloudRpcConfiguration.accessControl.allowMethods);\n res.header(\"Access-Control-Allow-Headers\", BentleyCloudRpcConfiguration.accessControl.allowHeaders);\n next();\n });\n }\n\n protected _configureRoutes() {\n this._app.get(\"/v3/swagger.json\", (req, res) => this._protocol.handleOpenApiDescriptionRequest(req, res));\n this._app.post(\"*\", async (req, res) => this._protocol.handleOperationPostRequest(req, res));\n this._app.get(/\\/imodel\\//, async (req, res) => this._protocol.handleOperationGetRequest(req, res));\n this._app.get(\"/ping\", async (_req, res) => res.status(200).send(\"Success\"));\n // for all HTTP requests, identify the server.\n this._app.use(\"*\", (_req, resp) => {\n resp.send(\"<h1>IModelJs RPC Server</h1>\");\n });\n }\n\n /**\n * Configure the express application with necessary headers, routes, and middleware, then starts listening on the given port.\n * @param port The port to listen on\n */\n public async initialize(port: number | string): Promise<HttpServer> {\n this._configureMiddleware();\n this._configureHeaders();\n this._configureRoutes();\n\n this._app.set(\"port\", port);\n return new Promise<HttpServer>((resolve) => {\n const server: HttpServer = this._app.listen(this._app.get(\"port\"), () => resolve(server));\n });\n }\n}\n\n/**\n * @alpha\n */\nexport class WebEditServer extends IModelJsExpressServer {\n protected override _configureRoutes() {\n (this._app as any).ws(\"/ipc\", (ws: any, _req: any) => LocalhostIpcHost.connect(ws));\n super._configureRoutes();\n }\n\n constructor(protocol: WebAppRpcProtocol, config = IModelJsExpressServer.defaults) {\n super(protocol, config);\n enableWs(this._app);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"express-server.js","sourceRoot":"","sources":["../../src/express-server.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,mCAAmC;AACnC,uCAAuC;AAEvC,oDAAuG;AACvG,sDAAuD;AAUvD;;;;;;GAMG;AACH,MAAa,qBAAqB;IAChC,6CAA6C;IACtC,MAAM,CAAU,QAAQ,GAAgC;QAC7D,WAAW,EAAE,KAAK;KACnB,CAAC;IAEM,SAAS,CAAoB;IAC7B,OAAO,CAA8B;IACnC,IAAI,GAAkC,OAAO,EAAE,CAAC;IAE1D,aAAa;IACb,IAAW,gBAAgB,KAAuB,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC;IAExF,YAAY,QAA2B,EAAE,MAAM,GAAG,qBAAqB,CAAC,QAAQ;QAC9E,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAES,oBAAoB;QAC5B,IAAI,CAAC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AAC,QAAQ;QAC9E,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACxB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;CACF;AAVD,sCAUC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as express from \"express\";\r\nimport * as enableWs from \"express-ws\";\r\nimport { Server as HttpServer } from \"http\";\r\nimport { BentleyCloudRpcConfiguration, RpcConfiguration, WebAppRpcProtocol } from \"@itwin/core-common\";\r\nimport { LocalhostIpcHost } from \"@itwin/core-backend\";\r\n\r\n/**\r\n * Options for configuring IModelJsExpressServer.\r\n * @public\r\n */\r\nexport interface IModelJsExpressServerConfig {\r\n uploadLimit: string;\r\n}\r\n\r\n/**\r\n * An express web server with some reasonable defaults for web applications built with @bentley/webpack-tools.\r\n * @note This server is not designed to be a hardened, secure endpoint on the public internet.\r\n * It is intended to participate in a private HTTP exchange with a public-facing routing and provisioning infrastructure\r\n * that should be supplied by the application's deployment environment.\r\n * @public\r\n */\r\nexport class IModelJsExpressServer {\r\n /** The default configuration for servers. */\r\n public static readonly defaults: IModelJsExpressServerConfig = {\r\n uploadLimit: \"5mb\",\r\n };\r\n\r\n private _protocol: WebAppRpcProtocol;\r\n private _config: IModelJsExpressServerConfig;\r\n protected _app: import(\"express\").Application = express();\r\n\r\n /** @alpha */\r\n public get rpcConfiguration(): RpcConfiguration { return this._protocol.configuration; }\r\n\r\n constructor(protocol: WebAppRpcProtocol, config = IModelJsExpressServer.defaults) {\r\n this._protocol = protocol;\r\n this._config = config;\r\n }\r\n\r\n protected _configureMiddleware() {\r\n this._app.use(express.text({ limit: this._config.uploadLimit }));\r\n this._app.use(express.raw({ limit: this._config.uploadLimit }));\r\n }\r\n\r\n protected _configureHeaders() {\r\n // enable CORS for all apis\r\n this._app.all(\"/**\", (_req, res, next) => {\r\n res.header(\"Access-Control-Allow-Origin\", BentleyCloudRpcConfiguration.accessControl.allowOrigin);\r\n res.header(\"Access-Control-Allow-Methods\", BentleyCloudRpcConfiguration.accessControl.allowMethods);\r\n res.header(\"Access-Control-Allow-Headers\", BentleyCloudRpcConfiguration.accessControl.allowHeaders);\r\n next();\r\n });\r\n }\r\n\r\n protected _configureRoutes() {\r\n this._app.get(\"/v3/swagger.json\", (req, res) => this._protocol.handleOpenApiDescriptionRequest(req, res));\r\n this._app.post(\"*\", async (req, res) => this._protocol.handleOperationPostRequest(req, res));\r\n this._app.get(/\\/imodel\\//, async (req, res) => this._protocol.handleOperationGetRequest(req, res));\r\n this._app.get(\"/ping\", async (_req, res) => res.status(200).send(\"Success\"));\r\n // for all HTTP requests, identify the server.\r\n this._app.use(\"*\", (_req, resp) => {\r\n resp.send(\"<h1>IModelJs RPC Server</h1>\");\r\n });\r\n }\r\n\r\n /**\r\n * Configure the express application with necessary headers, routes, and middleware, then starts listening on the given port.\r\n * @param port The port to listen on\r\n */\r\n public async initialize(port: number | string): Promise<HttpServer> {\r\n this._configureMiddleware();\r\n this._configureHeaders();\r\n this._configureRoutes();\r\n\r\n this._app.set(\"port\", port);\r\n return new Promise<HttpServer>((resolve) => {\r\n const server: HttpServer = this._app.listen(this._app.get(\"port\"), () => resolve(server));\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n */\r\nexport class WebEditServer extends IModelJsExpressServer {\r\n protected override _configureRoutes() {\r\n (this._app as any).ws(\"/ipc\", (ws: any, _req: any) => LocalhostIpcHost.connect(ws));\r\n super._configureRoutes();\r\n }\r\n\r\n constructor(protocol: WebAppRpcProtocol, config = IModelJsExpressServer.defaults) {\r\n super(protocol, config);\r\n enableWs(this._app);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express-server.js","sourceRoot":"","sources":["../../src/express-server.ts"],"names":[],"mappings":"AAAA;;;+FAG+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B,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAExB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC5B,OAAO,IAAI,OAAO,CAAa,CAAC,OAAO,EAAE,EAAE;YACzC,MAAM,MAAM,GAAe,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5F,CAAC,CAAC,CAAC;IACL,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,qBAAqB;IACnC,gBAAgB;QAChC,IAAI,CAAC,IAAY,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAO,EAAE,IAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;QACpF,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAC3B,CAAC;IAED,YAAY,QAA2B,EAAE,MAAM,GAAG,qBAAqB,CAAC,QAAQ;QAC9E,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACxB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as express from \"express\";\nimport * as enableWs from \"express-ws\";\nimport { Server as HttpServer } from \"http\";\nimport { BentleyCloudRpcConfiguration, RpcConfiguration, WebAppRpcProtocol } from \"@itwin/core-common\";\nimport { LocalhostIpcHost } from \"@itwin/core-backend\";\n\n/**\n * Options for configuring IModelJsExpressServer.\n * @public\n */\nexport interface IModelJsExpressServerConfig {\n uploadLimit: string;\n}\n\n/**\n * An express web server with some reasonable defaults for web applications built with @bentley/webpack-tools.\n * @note This server is not designed to be a hardened, secure endpoint on the public internet.\n * It is intended to participate in a private HTTP exchange with a public-facing routing and provisioning infrastructure\n * that should be supplied by the application's deployment environment.\n * @public\n */\nexport class IModelJsExpressServer {\n /** The default configuration for servers. */\n public static readonly defaults: IModelJsExpressServerConfig = {\n uploadLimit: \"5mb\",\n };\n\n private _protocol: WebAppRpcProtocol;\n private _config: IModelJsExpressServerConfig;\n protected _app: import(\"express\").Application = express();\n\n /** @alpha */\n public get rpcConfiguration(): RpcConfiguration { return this._protocol.configuration; }\n\n constructor(protocol: WebAppRpcProtocol, config = IModelJsExpressServer.defaults) {\n this._protocol = protocol;\n this._config = config;\n }\n\n protected _configureMiddleware() {\n this._app.use(express.text({ limit: this._config.uploadLimit }));\n this._app.use(express.raw({ limit: this._config.uploadLimit }));\n }\n\n protected _configureHeaders() {\n // enable CORS for all apis\n this._app.all(\"/**\", (_req, res, next) => {\n res.header(\"Access-Control-Allow-Origin\", BentleyCloudRpcConfiguration.accessControl.allowOrigin);\n res.header(\"Access-Control-Allow-Methods\", BentleyCloudRpcConfiguration.accessControl.allowMethods);\n res.header(\"Access-Control-Allow-Headers\", BentleyCloudRpcConfiguration.accessControl.allowHeaders);\n next();\n });\n }\n\n protected _configureRoutes() {\n this._app.get(\"/v3/swagger.json\", (req, res) => this._protocol.handleOpenApiDescriptionRequest(req, res));\n this._app.post(\"*\", async (req, res) => this._protocol.handleOperationPostRequest(req, res));\n this._app.get(/\\/imodel\\//, async (req, res) => this._protocol.handleOperationGetRequest(req, res));\n this._app.get(\"/ping\", async (_req, res) => res.status(200).send(\"Success\"));\n // for all HTTP requests, identify the server.\n this._app.use(\"*\", (_req, resp) => {\n resp.send(\"<h1>IModelJs RPC Server</h1>\");\n });\n }\n\n /**\n * Configure the express application with necessary headers, routes, and middleware, then starts listening on the given port.\n * @param port The port to listen on\n */\n public async initialize(port: number | string): Promise<HttpServer> {\n this._configureMiddleware();\n this._configureHeaders();\n this._configureRoutes();\n\n this._app.set(\"port\", port);\n return new Promise<HttpServer>((resolve) => {\n const server: HttpServer = this._app.listen(this._app.get(\"port\"), () => resolve(server));\n });\n }\n}\n\n/**\n * @alpha\n */\nexport class WebEditServer extends IModelJsExpressServer {\n protected override _configureRoutes() {\n (this._app as any).ws(\"/ipc\", (ws: any, _req: any) => LocalhostIpcHost.connect(ws));\n super._configureRoutes();\n }\n\n constructor(protocol: WebAppRpcProtocol, config = IModelJsExpressServer.defaults) {\n super(protocol, config);\n enableWs(this._app);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"express-server.js","sourceRoot":"","sources":["../../src/express-server.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,4BAA4B,EAAuC,MAAM,oBAAoB,CAAC;AACvG,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAUvD;;;;;;GAMG;AACH,MAAM,OAAO,qBAAqB;IAChC,6CAA6C;IACtC,MAAM,CAAU,QAAQ,GAAgC;QAC7D,WAAW,EAAE,KAAK;KACnB,CAAC;IAEM,SAAS,CAAoB;IAC7B,OAAO,CAA8B;IACnC,IAAI,GAAkC,OAAO,EAAE,CAAC;IAE1D,aAAa;IACb,IAAW,gBAAgB,KAAuB,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC;IAExF,YAAY,QAA2B,EAAE,MAAM,GAAG,qBAAqB,CAAC,QAAQ;QAC9E,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAES,oBAAoB;QAC5B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QACjE,IAAI,CAAC,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------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as express from \"express\";\r\nimport * as enableWs from \"express-ws\";\r\nimport { Server as HttpServer } from \"http\";\r\nimport { BentleyCloudRpcConfiguration, RpcConfiguration, WebAppRpcProtocol } from \"@itwin/core-common\";\r\nimport { LocalhostIpcHost } from \"@itwin/core-backend\";\r\n\r\n/**\r\n * Options for configuring IModelJsExpressServer.\r\n * @public\r\n */\r\nexport interface IModelJsExpressServerConfig {\r\n uploadLimit: string;\r\n}\r\n\r\n/**\r\n * An express web server with some reasonable defaults for web applications built with @bentley/webpack-tools.\r\n * @note This server is not designed to be a hardened, secure endpoint on the public internet.\r\n * It is intended to participate in a private HTTP exchange with a public-facing routing and provisioning infrastructure\r\n * that should be supplied by the application's deployment environment.\r\n * @public\r\n */\r\nexport class IModelJsExpressServer {\r\n /** The default configuration for servers. */\r\n public static readonly defaults: IModelJsExpressServerConfig = {\r\n uploadLimit: \"5mb\",\r\n };\r\n\r\n private _protocol: WebAppRpcProtocol;\r\n private _config: IModelJsExpressServerConfig;\r\n protected _app: import(\"express\").Application = express();\r\n\r\n /** @alpha */\r\n public get rpcConfiguration(): RpcConfiguration { return this._protocol.configuration; }\r\n\r\n constructor(protocol: WebAppRpcProtocol, config = IModelJsExpressServer.defaults) {\r\n this._protocol = protocol;\r\n this._config = config;\r\n }\r\n\r\n protected _configureMiddleware() {\r\n this._app.use(express.text({ limit: this._config.uploadLimit }));\r\n this._app.use(express.raw({ limit: this._config.uploadLimit }));\r\n }\r\n\r\n protected _configureHeaders() {\r\n // enable CORS for all apis\r\n this._app.all(\"/**\", (_req, res, next) => {\r\n res.header(\"Access-Control-Allow-Origin\", BentleyCloudRpcConfiguration.accessControl.allowOrigin);\r\n res.header(\"Access-Control-Allow-Methods\", BentleyCloudRpcConfiguration.accessControl.allowMethods);\r\n res.header(\"Access-Control-Allow-Headers\", BentleyCloudRpcConfiguration.accessControl.allowHeaders);\r\n next();\r\n });\r\n }\r\n\r\n protected _configureRoutes() {\r\n this._app.get(\"/v3/swagger.json\", (req, res) => this._protocol.handleOpenApiDescriptionRequest(req, res));\r\n this._app.post(\"*\", async (req, res) => this._protocol.handleOperationPostRequest(req, res));\r\n this._app.get(/\\/imodel\\//, async (req, res) => this._protocol.handleOperationGetRequest(req, res));\r\n this._app.get(\"/ping\", async (_req, res) => res.status(200).send(\"Success\"));\r\n // for all HTTP requests, identify the server.\r\n this._app.use(\"*\", (_req, resp) => {\r\n resp.send(\"<h1>IModelJs RPC Server</h1>\");\r\n });\r\n }\r\n\r\n /**\r\n * Configure the express application with necessary headers, routes, and middleware, then starts listening on the given port.\r\n * @param port The port to listen on\r\n */\r\n public async initialize(port: number | string): Promise<HttpServer> {\r\n this._configureMiddleware();\r\n this._configureHeaders();\r\n this._configureRoutes();\r\n\r\n this._app.set(\"port\", port);\r\n return new Promise<HttpServer>((resolve) => {\r\n const server: HttpServer = this._app.listen(this._app.get(\"port\"), () => resolve(server));\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n */\r\nexport class WebEditServer extends IModelJsExpressServer {\r\n protected override _configureRoutes() {\r\n (this._app as any).ws(\"/ipc\", (ws: any, _req: any) => LocalhostIpcHost.connect(ws));\r\n super._configureRoutes();\r\n }\r\n\r\n constructor(protocol: WebAppRpcProtocol, config = IModelJsExpressServer.defaults) {\r\n super(protocol, config);\r\n enableWs(this._app);\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/express-server",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.1",
|
|
4
4
|
"description": "iTwin.js express utilities",
|
|
5
5
|
"main": "lib/cjs/express-server.js",
|
|
6
6
|
"module": "lib/esm/express-server.js",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"sinon": "^17.0.2",
|
|
44
44
|
"supertest": "^7.0.0",
|
|
45
45
|
"typescript": "~5.6.2",
|
|
46
|
-
"@itwin/
|
|
47
|
-
"@itwin/core-common": "5.4.
|
|
48
|
-
"@itwin/
|
|
46
|
+
"@itwin/core-backend": "5.4.1",
|
|
47
|
+
"@itwin/core-common": "5.4.1",
|
|
48
|
+
"@itwin/build-tools": "5.4.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@itwin/core-backend": "5.4.
|
|
52
|
-
"@itwin/core-common": "5.4.
|
|
51
|
+
"@itwin/core-backend": "5.4.1",
|
|
52
|
+
"@itwin/core-common": "5.4.1"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"express": "^4.21.2",
|