@itwin/core-common 3.5.0-dev.8 → 3.6.0-dev.3

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 (190) hide show
  1. package/CHANGELOG.md +75 -1
  2. package/lib/cjs/BackendTypes.d.ts +13 -0
  3. package/lib/cjs/BackendTypes.d.ts.map +1 -0
  4. package/lib/cjs/BackendTypes.js +10 -0
  5. package/lib/cjs/BackendTypes.js.map +1 -0
  6. package/lib/cjs/Base64EncodedString.d.ts +2 -0
  7. package/lib/cjs/Base64EncodedString.d.ts.map +1 -1
  8. package/lib/cjs/Base64EncodedString.js +10 -0
  9. package/lib/cjs/Base64EncodedString.js.map +1 -1
  10. package/lib/cjs/ChangedElements.d.ts +3 -1
  11. package/lib/cjs/ChangedElements.d.ts.map +1 -1
  12. package/lib/cjs/ChangedElements.js +2 -0
  13. package/lib/cjs/ChangedElements.js.map +1 -1
  14. package/lib/cjs/ConcurrentQuery.d.ts +181 -1
  15. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
  16. package/lib/cjs/ConcurrentQuery.js +175 -3
  17. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  18. package/lib/cjs/ElementMesh.d.ts +40 -0
  19. package/lib/cjs/ElementMesh.d.ts.map +1 -0
  20. package/lib/cjs/ElementMesh.js +57 -0
  21. package/lib/cjs/ElementMesh.js.map +1 -0
  22. package/lib/cjs/ElementProps.d.ts +4 -1
  23. package/lib/cjs/ElementProps.d.ts.map +1 -1
  24. package/lib/cjs/ElementProps.js.map +1 -1
  25. package/lib/cjs/EntityReference.d.ts +52 -0
  26. package/lib/cjs/EntityReference.d.ts.map +1 -0
  27. package/lib/cjs/EntityReference.js +57 -0
  28. package/lib/cjs/EntityReference.js.map +1 -0
  29. package/lib/cjs/IpcAppProps.d.ts +18 -1
  30. package/lib/cjs/IpcAppProps.d.ts.map +1 -1
  31. package/lib/cjs/IpcAppProps.js +6 -1
  32. package/lib/cjs/IpcAppProps.js.map +1 -1
  33. package/lib/cjs/Localization.d.ts +2 -0
  34. package/lib/cjs/Localization.d.ts.map +1 -1
  35. package/lib/cjs/Localization.js.map +1 -1
  36. package/lib/cjs/ModelProps.d.ts +1 -0
  37. package/lib/cjs/ModelProps.d.ts.map +1 -1
  38. package/lib/cjs/ModelProps.js.map +1 -1
  39. package/lib/cjs/RenderSchedule.d.ts +12 -9
  40. package/lib/cjs/RenderSchedule.d.ts.map +1 -1
  41. package/lib/cjs/RenderSchedule.js +11 -9
  42. package/lib/cjs/RenderSchedule.js.map +1 -1
  43. package/lib/cjs/TextureMapping.d.ts +17 -2
  44. package/lib/cjs/TextureMapping.d.ts.map +1 -1
  45. package/lib/cjs/TextureMapping.js.map +1 -1
  46. package/lib/cjs/ViewDetails.d.ts.map +1 -1
  47. package/lib/cjs/ViewDetails.js +10 -2
  48. package/lib/cjs/ViewDetails.js.map +1 -1
  49. package/lib/cjs/core-common.d.ts +4 -0
  50. package/lib/cjs/core-common.d.ts.map +1 -1
  51. package/lib/cjs/core-common.js +4 -0
  52. package/lib/cjs/core-common.js.map +1 -1
  53. package/lib/cjs/ipc/IpcWebSocketTransport.d.ts.map +1 -1
  54. package/lib/cjs/ipc/IpcWebSocketTransport.js +5 -3
  55. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
  56. package/lib/cjs/rpc/IModelReadRpcInterface.d.ts +25 -1
  57. package/lib/cjs/rpc/IModelReadRpcInterface.d.ts.map +1 -1
  58. package/lib/cjs/rpc/IModelReadRpcInterface.js +8 -1
  59. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  60. package/lib/cjs/rpc/core/RpcConfiguration.d.ts.map +1 -1
  61. package/lib/cjs/rpc/core/RpcConfiguration.js +0 -1
  62. package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
  63. package/lib/cjs/rpc/core/RpcControl.d.ts +2 -0
  64. package/lib/cjs/rpc/core/RpcControl.d.ts.map +1 -1
  65. package/lib/cjs/rpc/core/RpcControl.js +13 -18
  66. package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
  67. package/lib/cjs/rpc/core/RpcInvocation.d.ts.map +1 -1
  68. package/lib/cjs/rpc/core/RpcInvocation.js +1 -0
  69. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  70. package/lib/cjs/rpc/core/RpcMarshaling.d.ts +2 -3
  71. package/lib/cjs/rpc/core/RpcMarshaling.d.ts.map +1 -1
  72. package/lib/cjs/rpc/core/RpcMarshaling.js +5 -2
  73. package/lib/cjs/rpc/core/RpcMarshaling.js.map +1 -1
  74. package/lib/cjs/rpc/web/RpcMultipart.d.ts +11 -7
  75. package/lib/cjs/rpc/web/RpcMultipart.d.ts.map +1 -1
  76. package/lib/cjs/rpc/web/RpcMultipart.js +17 -12
  77. package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
  78. package/lib/cjs/rpc/web/WebAppRpcLogging.d.ts +19 -8
  79. package/lib/cjs/rpc/web/WebAppRpcLogging.d.ts.map +1 -1
  80. package/lib/cjs/rpc/web/WebAppRpcLogging.js +62 -63
  81. package/lib/cjs/rpc/web/WebAppRpcLogging.js.map +1 -1
  82. package/lib/cjs/rpc/web/WebAppRpcProtocol.d.ts +4 -3
  83. package/lib/cjs/rpc/web/WebAppRpcProtocol.d.ts.map +1 -1
  84. package/lib/cjs/rpc/web/WebAppRpcProtocol.js.map +1 -1
  85. package/lib/cjs/rpc/web/WebAppRpcRequest.d.ts +6 -10
  86. package/lib/cjs/rpc/web/WebAppRpcRequest.d.ts.map +1 -1
  87. package/lib/cjs/rpc/web/WebAppRpcRequest.js +14 -149
  88. package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
  89. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.d.ts +2 -3
  90. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.d.ts.map +1 -1
  91. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.js +34 -21
  92. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
  93. package/lib/cjs/tile/ElementGraphics.d.ts +13 -2
  94. package/lib/cjs/tile/ElementGraphics.d.ts.map +1 -1
  95. package/lib/cjs/tile/ElementGraphics.js.map +1 -1
  96. package/lib/esm/BackendTypes.d.ts +13 -0
  97. package/lib/esm/BackendTypes.d.ts.map +1 -0
  98. package/lib/esm/BackendTypes.js +9 -0
  99. package/lib/esm/BackendTypes.js.map +1 -0
  100. package/lib/esm/Base64EncodedString.d.ts +2 -0
  101. package/lib/esm/Base64EncodedString.d.ts.map +1 -1
  102. package/lib/esm/Base64EncodedString.js +10 -0
  103. package/lib/esm/Base64EncodedString.js.map +1 -1
  104. package/lib/esm/ChangedElements.d.ts +3 -1
  105. package/lib/esm/ChangedElements.d.ts.map +1 -1
  106. package/lib/esm/ChangedElements.js +2 -0
  107. package/lib/esm/ChangedElements.js.map +1 -1
  108. package/lib/esm/ConcurrentQuery.d.ts +181 -1
  109. package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
  110. package/lib/esm/ConcurrentQuery.js +175 -3
  111. package/lib/esm/ConcurrentQuery.js.map +1 -1
  112. package/lib/esm/ElementMesh.d.ts +40 -0
  113. package/lib/esm/ElementMesh.d.ts.map +1 -0
  114. package/lib/esm/ElementMesh.js +53 -0
  115. package/lib/esm/ElementMesh.js.map +1 -0
  116. package/lib/esm/ElementProps.d.ts +4 -1
  117. package/lib/esm/ElementProps.d.ts.map +1 -1
  118. package/lib/esm/ElementProps.js.map +1 -1
  119. package/lib/esm/EntityReference.d.ts +52 -0
  120. package/lib/esm/EntityReference.d.ts.map +1 -0
  121. package/lib/esm/EntityReference.js +53 -0
  122. package/lib/esm/EntityReference.js.map +1 -0
  123. package/lib/esm/IpcAppProps.d.ts +18 -1
  124. package/lib/esm/IpcAppProps.d.ts.map +1 -1
  125. package/lib/esm/IpcAppProps.js +4 -0
  126. package/lib/esm/IpcAppProps.js.map +1 -1
  127. package/lib/esm/Localization.d.ts +2 -0
  128. package/lib/esm/Localization.d.ts.map +1 -1
  129. package/lib/esm/Localization.js.map +1 -1
  130. package/lib/esm/ModelProps.d.ts +1 -0
  131. package/lib/esm/ModelProps.d.ts.map +1 -1
  132. package/lib/esm/ModelProps.js.map +1 -1
  133. package/lib/esm/RenderSchedule.d.ts +12 -9
  134. package/lib/esm/RenderSchedule.d.ts.map +1 -1
  135. package/lib/esm/RenderSchedule.js +11 -9
  136. package/lib/esm/RenderSchedule.js.map +1 -1
  137. package/lib/esm/TextureMapping.d.ts +17 -2
  138. package/lib/esm/TextureMapping.d.ts.map +1 -1
  139. package/lib/esm/TextureMapping.js.map +1 -1
  140. package/lib/esm/ViewDetails.d.ts.map +1 -1
  141. package/lib/esm/ViewDetails.js +11 -3
  142. package/lib/esm/ViewDetails.js.map +1 -1
  143. package/lib/esm/core-common.d.ts +4 -0
  144. package/lib/esm/core-common.d.ts.map +1 -1
  145. package/lib/esm/core-common.js +4 -0
  146. package/lib/esm/core-common.js.map +1 -1
  147. package/lib/esm/ipc/IpcWebSocketTransport.d.ts.map +1 -1
  148. package/lib/esm/ipc/IpcWebSocketTransport.js +5 -3
  149. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
  150. package/lib/esm/rpc/IModelReadRpcInterface.d.ts +25 -1
  151. package/lib/esm/rpc/IModelReadRpcInterface.d.ts.map +1 -1
  152. package/lib/esm/rpc/IModelReadRpcInterface.js +8 -1
  153. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  154. package/lib/esm/rpc/core/RpcConfiguration.d.ts.map +1 -1
  155. package/lib/esm/rpc/core/RpcConfiguration.js +0 -1
  156. package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
  157. package/lib/esm/rpc/core/RpcControl.d.ts +2 -0
  158. package/lib/esm/rpc/core/RpcControl.d.ts.map +1 -1
  159. package/lib/esm/rpc/core/RpcControl.js +13 -18
  160. package/lib/esm/rpc/core/RpcControl.js.map +1 -1
  161. package/lib/esm/rpc/core/RpcInvocation.d.ts.map +1 -1
  162. package/lib/esm/rpc/core/RpcInvocation.js +2 -1
  163. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  164. package/lib/esm/rpc/core/RpcMarshaling.d.ts +2 -3
  165. package/lib/esm/rpc/core/RpcMarshaling.d.ts.map +1 -1
  166. package/lib/esm/rpc/core/RpcMarshaling.js +5 -2
  167. package/lib/esm/rpc/core/RpcMarshaling.js.map +1 -1
  168. package/lib/esm/rpc/web/RpcMultipart.d.ts +11 -7
  169. package/lib/esm/rpc/web/RpcMultipart.d.ts.map +1 -1
  170. package/lib/esm/rpc/web/RpcMultipart.js +17 -12
  171. package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
  172. package/lib/esm/rpc/web/WebAppRpcLogging.d.ts +19 -8
  173. package/lib/esm/rpc/web/WebAppRpcLogging.d.ts.map +1 -1
  174. package/lib/esm/rpc/web/WebAppRpcLogging.js +62 -63
  175. package/lib/esm/rpc/web/WebAppRpcLogging.js.map +1 -1
  176. package/lib/esm/rpc/web/WebAppRpcProtocol.d.ts +4 -3
  177. package/lib/esm/rpc/web/WebAppRpcProtocol.d.ts.map +1 -1
  178. package/lib/esm/rpc/web/WebAppRpcProtocol.js.map +1 -1
  179. package/lib/esm/rpc/web/WebAppRpcRequest.d.ts +6 -10
  180. package/lib/esm/rpc/web/WebAppRpcRequest.d.ts.map +1 -1
  181. package/lib/esm/rpc/web/WebAppRpcRequest.js +15 -150
  182. package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
  183. package/lib/esm/rpc/web/multipart/RpcMultipartParser.d.ts +2 -3
  184. package/lib/esm/rpc/web/multipart/RpcMultipartParser.d.ts.map +1 -1
  185. package/lib/esm/rpc/web/multipart/RpcMultipartParser.js +34 -21
  186. package/lib/esm/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
  187. package/lib/esm/tile/ElementGraphics.d.ts +13 -2
  188. package/lib/esm/tile/ElementGraphics.d.ts.map +1 -1
  189. package/lib/esm/tile/ElementGraphics.js.map +1 -1
  190. package/package.json +8 -10
@@ -1,17 +1,15 @@
1
1
  /** @packageDocumentation
2
2
  * @module RpcInterface
3
3
  */
4
- /// <reference types="node" />
5
- import { Buffer } from "buffer";
6
- import { Readable } from "stream";
4
+ import { BackendBuffer, BackendReadable } from "../../BackendTypes";
7
5
  import { RpcSerializedValue } from "../core/RpcMarshaling";
8
6
  import { HttpServerRequest } from "../web/WebAppRpcProtocol";
9
7
  /** @internal */
10
8
  export interface FormDataCommon {
11
- append(name: string, value: string | Blob | Buffer, fileName?: string): void;
9
+ append(name: string, value: string | Blob | BackendBuffer, fileName?: string): void;
12
10
  }
13
11
  /** @internal */
14
- export interface ReadableFormData extends Readable {
12
+ export interface ReadableFormData extends BackendReadable {
15
13
  getHeaders(): {
16
14
  [key: string]: any;
17
15
  };
@@ -23,10 +21,16 @@ export declare class RpcMultipart {
23
21
  /** Creates a multipart form object for an RPC value. */
24
22
  static createForm(value: RpcSerializedValue): FormData;
25
23
  /** Creates a multipart stream for an RPC value. */
26
- static createStream(_value: RpcSerializedValue): ReadableFormData;
24
+ static createStream(value: RpcSerializedValue): ReadableFormData;
27
25
  /** Obtains the RPC value from a multipart HTTP request. */
28
- static parseRequest(_req: HttpServerRequest): Promise<RpcSerializedValue>;
26
+ static parseRequest(req: HttpServerRequest): Promise<RpcSerializedValue>;
29
27
  /** @internal */
30
28
  static writeValueToForm(form: FormDataCommon, value: RpcSerializedValue): void;
29
+ /** @internal */
30
+ static platform: {
31
+ createStream(_value: RpcSerializedValue): ReadableFormData;
32
+ parseRequest(_req: HttpServerRequest): Promise<RpcSerializedValue>;
33
+ appendToForm(i: number, form: FormDataCommon, value: RpcSerializedValue): void;
34
+ };
31
35
  }
32
36
  //# sourceMappingURL=RpcMultipart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RpcMultipart.d.ts","sourceRoot":"","sources":["../../../../src/rpc/web/RpcMultipart.ts"],"names":[],"mappings":"AAIA;;GAEG;;AAEH,OAAO,EAAE,MAAM,E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G,aAAa,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrF;AAED,gBAAgB;AAChB,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,UAAU,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACtC;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB,wDAAwD;WAC1C,UAAU,CAAC,KAAK,EAAE,kBAAkB,GAAG,QAAQ;IAM7D,mDAAmD;WACrC,YAAY,CAAC,KAAK,EAAE,kBAAkB,GAAG,gBAAgB;IAIvE,2DAA2D;WACvC,YAAY,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIrF,gBAAgB;WACF,gBAAgB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,kBAAkB;IAQ9E,gBAAgB;IAChB,OAAc,QAAQ;6BACC,kBAAkB,GAAG,gBAAgB;2BAGjC,iBAAiB,GAAG,QAAQ,kBAAkB,CAAC;wBAGxD,MAAM,QAAQ,cAAc,SAAS,kBAAkB,GAAG,IAAI;MAG9E;CACH"}
@@ -5,7 +5,6 @@
5
5
  /** @packageDocumentation
6
6
  * @module RpcInterface
7
7
  */
8
- import { Buffer } from "buffer";
9
8
  import { BentleyStatus, IModelError } from "../../IModelError";
10
9
  /** Support for transporting RPC values using the HTTP multipart content type.
11
10
  * @internal
@@ -18,25 +17,31 @@ export class RpcMultipart {
18
17
  return form;
19
18
  }
20
19
  /** Creates a multipart stream for an RPC value. */
21
- static createStream(_value) {
22
- throw new IModelError(BentleyStatus.ERROR, "Not implemented.");
20
+ static createStream(value) {
21
+ return this.platform.createStream(value);
23
22
  }
24
23
  /** Obtains the RPC value from a multipart HTTP request. */
25
- static async parseRequest(_req) {
26
- throw new IModelError(BentleyStatus.ERROR, "Not implemented.");
24
+ static async parseRequest(req) {
25
+ return this.platform.parseRequest(req);
27
26
  }
28
27
  /** @internal */
29
28
  static writeValueToForm(form, value) {
30
29
  form.append("objects", value.objects);
31
30
  for (let i = 0; i !== value.data.length; ++i) {
32
- if (typeof (Blob) !== "undefined") {
33
- form.append(`data-${i}`, new Blob([value.data[i]], { type: "application/octet-stream" }));
34
- }
35
- else {
36
- const buf = value.data[i];
37
- form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));
38
- }
31
+ this.platform.appendToForm(i, form, value);
39
32
  }
40
33
  }
41
34
  }
35
+ /** @internal */
36
+ RpcMultipart.platform = {
37
+ createStream(_value) {
38
+ throw new IModelError(BentleyStatus.ERROR, "Not bound.");
39
+ },
40
+ async parseRequest(_req) {
41
+ throw new IModelError(BentleyStatus.ERROR, "Not bound.");
42
+ },
43
+ appendToForm(i, form, value) {
44
+ form.append(`data-${i}`, new Blob([value.data[i]], { type: "application/octet-stream" }));
45
+ },
46
+ };
42
47
  //# sourceMappingURL=RpcMultipart.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RpcMultipart.js","sourceRoot":"","sources":["../../../../src/rpc/web/RpcMultipart.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAc/D;;GAEG;AACH,MAAM,OAAO,YAAY;IACvB,wDAAwD;IACjD,MAAM,CAAC,UAAU,CAAC,KAAyB;QAChD,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,YAAY,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mDAAmD;IAC5C,MAAM,CAAC,YAAY,CAAC,MAA0B;QACnD,MAAM,IAAI,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACjE,CAAC;IAED,2DAA2D;IACpD,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAAuB;QACtD,MAAM,IAAI,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACjE,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,gBAAgB,CAAC,IAAoB,EAAE,KAAyB;QAC5E,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YAC5C,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,WAAW,EAAE;gBACjC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC,CAAC,CAAC;aAC3F;iBAAM;gBACL,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;aACnF;SACF;IACH,CAAC;CACF","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\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { Buffer } from \"buffer\";\r\nimport { Readable } from \"stream\";\r\nimport { BentleyStatus, IModelError } from \"../../IModelError\";\r\nimport { RpcSerializedValue } from \"../core/RpcMarshaling\";\r\nimport { HttpServerRequest } from \"../web/WebAppRpcProtocol\";\r\n\r\n/** @internal */\r\nexport interface FormDataCommon {\r\n append(name: string, value: string | Blob | Buffer, fileName?: string): void;\r\n}\r\n\r\n/** @internal */\r\nexport interface ReadableFormData extends Readable {\r\n getHeaders(): { [key: string]: any };\r\n}\r\n\r\n/** Support for transporting RPC values using the HTTP multipart content type.\r\n * @internal\r\n */\r\nexport class RpcMultipart {\r\n /** Creates a multipart form object for an RPC value. */\r\n public static createForm(value: RpcSerializedValue): FormData {\r\n const form = new FormData();\r\n RpcMultipart.writeValueToForm(form, value);\r\n return form;\r\n }\r\n\r\n /** Creates a multipart stream for an RPC value. */\r\n public static createStream(_value: RpcSerializedValue): ReadableFormData {\r\n throw new IModelError(BentleyStatus.ERROR, \"Not implemented.\");\r\n }\r\n\r\n /** Obtains the RPC value from a multipart HTTP request. */\r\n public static async parseRequest(_req: HttpServerRequest): Promise<RpcSerializedValue> {\r\n throw new IModelError(BentleyStatus.ERROR, \"Not implemented.\");\r\n }\r\n\r\n /** @internal */\r\n public static writeValueToForm(form: FormDataCommon, value: RpcSerializedValue) {\r\n form.append(\"objects\", value.objects);\r\n\r\n for (let i = 0; i !== value.data.length; ++i) {\r\n if (typeof (Blob) !== \"undefined\") {\r\n form.append(`data-${i}`, new Blob([value.data[i]], { type: \"application/octet-stream\" }));\r\n } else {\r\n const buf = value.data[i];\r\n form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RpcMultipart.js","sourceRoot":"","sources":["../../../../src/rpc/web/RpcMultipart.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAiB/D;;GAEG;AACH,MAAM,OAAO,YAAY;IACvB,wDAAwD;IACjD,MAAM,CAAC,UAAU,CAAC,KAAyB;QAChD,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,YAAY,CAAC,gBAA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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\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { BentleyStatus, IModelError } from \"../../IModelError\";\r\nimport { BackendBuffer, BackendReadable } from \"../../BackendTypes\";\r\nimport { RpcSerializedValue } from \"../core/RpcMarshaling\";\r\nimport { HttpServerRequest } from \"../web/WebAppRpcProtocol\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** @internal */\r\nexport interface FormDataCommon {\r\n append(name: string, value: string | Blob | BackendBuffer, fileName?: string): void;\r\n}\r\n\r\n/** @internal */\r\nexport interface ReadableFormData extends BackendReadable {\r\n getHeaders(): { [key: string]: any };\r\n}\r\n\r\n/** Support for transporting RPC values using the HTTP multipart content type.\r\n * @internal\r\n */\r\nexport class RpcMultipart {\r\n /** Creates a multipart form object for an RPC value. */\r\n public static createForm(value: RpcSerializedValue): FormData {\r\n const form = new FormData();\r\n RpcMultipart.writeValueToForm(form, value);\r\n return form;\r\n }\r\n\r\n /** Creates a multipart stream for an RPC value. */\r\n public static createStream(value: RpcSerializedValue): ReadableFormData {\r\n return this.platform.createStream(value);\r\n }\r\n\r\n /** Obtains the RPC value from a multipart HTTP request. */\r\n public static async parseRequest(req: HttpServerRequest): Promise<RpcSerializedValue> {\r\n return this.platform.parseRequest(req);\r\n }\r\n\r\n /** @internal */\r\n public static writeValueToForm(form: FormDataCommon, value: RpcSerializedValue) {\r\n form.append(\"objects\", value.objects);\r\n\r\n for (let i = 0; i !== value.data.length; ++i) {\r\n this.platform.appendToForm(i, form, value);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static platform = {\r\n createStream(_value: RpcSerializedValue): ReadableFormData {\r\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\r\n },\r\n async parseRequest(_req: HttpServerRequest): Promise<RpcSerializedValue> {\r\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\r\n },\r\n appendToForm(i: number, form: FormDataCommon, value: RpcSerializedValue): void {\r\n form.append(`data-${i}`, new Blob([value.data[i]], { type: \"application/octet-stream\" }));\r\n },\r\n };\r\n}\r\n\r\n"]}
@@ -1,18 +1,29 @@
1
1
  /** @packageDocumentation
2
2
  * @module RpcInterface
3
3
  */
4
+ import { RpcInterfaceDefinition } from "../../RpcInterface";
4
5
  import { RpcProtocolEvent } from "../core/RpcConstants";
5
6
  import { RpcInvocation } from "../core/RpcInvocation";
7
+ import { RpcOperation } from "../core/RpcOperation";
8
+ import { SerializedRpcOperation, SerializedRpcRequest } from "../core/RpcProtocol";
6
9
  import { RpcRequest } from "../core/RpcRequest";
10
+ import { WebAppRpcRequest } from "./WebAppRpcRequest";
7
11
  /** @internal */
8
- export declare class WebAppRpcLogging {
12
+ export declare abstract class WebAppRpcLogging {
13
+ static initializeBackend(instance: WebAppRpcLogging): void;
14
+ static initializeFrontend(instance: WebAppRpcLogging): void;
15
+ private static get backend();
16
+ private static get frontend();
9
17
  static logProtocolEvent(event: RpcProtocolEvent, object: RpcRequest | RpcInvocation): Promise<void>;
10
- private static getRpcInterfaceName;
11
- private static findPathIds;
12
- private static buildOperationDescriptor;
13
- private static logRequest;
14
- private static logResponse;
15
- private static logErrorFrontend;
16
- private static logErrorBackend;
18
+ protected abstract logProtocolEvent(event: RpcProtocolEvent, object: RpcRequest | RpcInvocation): Promise<void>;
19
+ protected abstract getHostname(): string;
20
+ protected getRpcInterfaceName(g: string | RpcInterfaceDefinition): string;
21
+ protected findPathIds(path: string): {
22
+ iTwinId: string;
23
+ iModelId: string;
24
+ };
25
+ protected buildOperationDescriptor(operation: RpcOperation | SerializedRpcOperation): string;
26
+ protected logRequest(loggerCategory: string, message: string, object: WebAppRpcRequest | SerializedRpcRequest): void;
27
+ protected logResponse(loggerCategory: string, message: string, object: WebAppRpcRequest | SerializedRpcRequest, status: number, elapsed: number): void;
17
28
  }
18
29
  //# sourceMappingURL=WebAppRpcLogging.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebAppRpcLogging.d.ts","sourceRoot":"","sources":["../../../../src/rpc/web/WebAppRpcLogging.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAqBhD,gBAAgB;AAChB,qBAAa,gBAAgB;WACP,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,GAAG,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBhH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAIlC,OAAO,CAAC,MAAM,CAAC,WAAW;IAmB1B,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAUvC,OAAO,CAAC,MAAM,CAAC,UAAU;IAiBzB,OAAO,CAAC,MAAM,CAAC,WAAW;IAkB1B,OAAO,CAAC,MAAM,CAAC,gBAAgB;mBAcV,eAAe;CAiBrC"}
1
+ {"version":3,"file":"WebAppRpcLogging.d.ts","sourceRoot":"","sources":["../../../../src/rpc/web/WebAppRpcLogging.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,gBAAgB;AAChB,8BAAsB,gBAAgB;WACtB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB;WAI5C,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB;IAI3D,OAAO,CAAC,MAAM,KAAK,OAAO,GAOzB;IAED,OAAO,CAAC,MAAM,KAAK,QAAQ,GAO1B;WAEmB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,GAAG,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAQhH,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,GAAG,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAE/G,SAAS,CAAC,QAAQ,CAAC,WAAW,IAAI,MAAM;IAExC,SAAS,CAAC,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,MAAM;IAIzE,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM;;;;IAmBlC,SAAS,CAAC,wBAAwB,CAAC,SAAS,EAAE,YAAY,GAAG,sBAAsB,GAAG,MAAM;IAU5F,SAAS,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,oBAAoB,GAAG,IAAI;IAiBpH,SAAS,CAAC,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,oBAAoB,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;CAiBvJ"}
@@ -5,53 +5,49 @@
5
5
  /** @packageDocumentation
6
6
  * @module RpcInterface
7
7
  */
8
- import { Logger } from "@itwin/core-bentley";
8
+ import { BentleyStatus, Logger } from "@itwin/core-bentley";
9
9
  import { CommonLoggerCategory } from "../../CommonLoggerCategory";
10
+ import { IModelError } from "../../IModelError";
10
11
  import { RpcProtocolEvent } from "../core/RpcConstants";
11
12
  import { RpcInvocation } from "../core/RpcInvocation";
12
13
  import { WebAppRpcRequest } from "./WebAppRpcRequest";
13
- let hostname = "";
14
- function getHostname() {
15
- if (!hostname) {
16
- try {
17
- // eslint-disable-next-line @typescript-eslint/no-var-requires
18
- const os = require("os");
19
- hostname = os.hostname();
14
+ /** @internal */
15
+ const BACKEND = Symbol.for("@itwin.WebAppRpcLogging.Backend");
16
+ const FRONTEND = Symbol.for("@itwin.WebAppRpcLogging.Frontend");
17
+ /** @internal */
18
+ export class WebAppRpcLogging {
19
+ static initializeBackend(instance) {
20
+ globalThis[BACKEND] = instance;
21
+ }
22
+ static initializeFrontend(instance) {
23
+ globalThis[FRONTEND] = instance;
24
+ }
25
+ static get backend() {
26
+ const instance = globalThis[BACKEND];
27
+ if (typeof (instance) === "undefined") {
28
+ throw new IModelError(BentleyStatus.ERROR, "Backend logging is not initialized.");
20
29
  }
21
- catch (_) {
22
- if (globalThis.window) {
23
- hostname = globalThis.window.location.host;
24
- }
25
- else {
26
- hostname = "imodeljs-mobile";
27
- }
30
+ return instance;
31
+ }
32
+ static get frontend() {
33
+ const instance = globalThis[FRONTEND];
34
+ if (typeof (instance) === "undefined") {
35
+ throw new IModelError(BentleyStatus.ERROR, "Frontend logging is not initialized.");
28
36
  }
37
+ return instance;
29
38
  }
30
- return hostname;
31
- }
32
- /** @internal */
33
- export class WebAppRpcLogging {
34
39
  static async logProtocolEvent(event, object) {
35
40
  if (object instanceof WebAppRpcRequest) {
36
- switch (event) {
37
- case RpcProtocolEvent.RequestCreated: return WebAppRpcLogging.logRequest(CommonLoggerCategory.RpcInterfaceFrontend, "RpcInterface.frontend.request", object);
38
- case RpcProtocolEvent.ResponseLoaded: return WebAppRpcLogging.logResponse(CommonLoggerCategory.RpcInterfaceFrontend, "RpcInterface.frontend.response", object, object.metadata.status, object.elapsed);
39
- case RpcProtocolEvent.ConnectionErrorReceived: return WebAppRpcLogging.logErrorFrontend("RpcInterface.frontend.connectionError", object);
40
- case RpcProtocolEvent.ConnectionAborted: return WebAppRpcLogging.logErrorFrontend("RpcInterface.frontend.connectionAborted", object);
41
- }
41
+ await WebAppRpcLogging.frontend.logProtocolEvent(event, object);
42
42
  }
43
43
  else if (object instanceof RpcInvocation) {
44
- switch (event) {
45
- case RpcProtocolEvent.RequestReceived: return WebAppRpcLogging.logRequest(CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.request", object.request);
46
- case RpcProtocolEvent.BackendErrorOccurred: return WebAppRpcLogging.logErrorBackend("RpcInterface.backend.error", object);
47
- case RpcProtocolEvent.BackendResponseCreated: return WebAppRpcLogging.logResponse(CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.response", object.request, object.status, object.elapsed);
48
- }
44
+ await WebAppRpcLogging.backend.logProtocolEvent(event, object);
49
45
  }
50
46
  }
51
- static getRpcInterfaceName(g) {
47
+ getRpcInterfaceName(g) {
52
48
  return (typeof g === "string") ? g : g.interfaceName;
53
49
  }
54
- static findPathIds(path) {
50
+ findPathIds(path) {
55
51
  let iTwinId = "";
56
52
  let iModelId = "";
57
53
  const tokens = path.split("/");
@@ -66,7 +62,7 @@ export class WebAppRpcLogging {
66
62
  }
67
63
  return { iTwinId, iModelId };
68
64
  }
69
- static buildOperationDescriptor(operation) {
65
+ buildOperationDescriptor(operation) {
70
66
  if (!operation) {
71
67
  return "unknown.unknown";
72
68
  }
@@ -74,64 +70,67 @@ export class WebAppRpcLogging {
74
70
  const operationName = operation.operationName;
75
71
  return `${interfaceName}.${operationName}`;
76
72
  }
77
- static logRequest(loggerCategory, message, object) {
78
- const operationDescriptor = WebAppRpcLogging.buildOperationDescriptor(object.operation);
79
- const pathIds = WebAppRpcLogging.findPathIds(object.path);
73
+ logRequest(loggerCategory, message, object) {
74
+ const operationDescriptor = this.buildOperationDescriptor(object.operation);
75
+ const pathIds = this.findPathIds(object.path);
80
76
  Logger.logTrace(loggerCategory, `${message}.${operationDescriptor}`, () => ({
81
77
  method: object.method,
82
78
  path: object.path,
83
79
  operation: object.operation.operationName,
84
- rpcInterface: WebAppRpcLogging.getRpcInterfaceName(object.operation.interfaceDefinition),
80
+ rpcInterface: this.getRpcInterfaceName(object.operation.interfaceDefinition),
85
81
  // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!
86
82
  ActivityId: object.id,
87
83
  TimeElapsed: ("elapsed" in object) ? object.elapsed : 0,
88
- MachineName: getHostname(),
84
+ MachineName: this.getHostname(),
89
85
  ...pathIds,
90
86
  }));
91
87
  }
92
- static logResponse(loggerCategory, message, object, status, elapsed) {
93
- const operationDescriptor = WebAppRpcLogging.buildOperationDescriptor(object.operation);
94
- const pathIds = WebAppRpcLogging.findPathIds(object.path);
88
+ logResponse(loggerCategory, message, object, status, elapsed) {
89
+ const operationDescriptor = this.buildOperationDescriptor(object.operation);
90
+ const pathIds = this.findPathIds(object.path);
95
91
  Logger.logTrace(loggerCategory, `${message}.${operationDescriptor}`, () => ({
96
92
  method: object.method,
97
93
  path: object.path,
98
94
  operation: object.operation.operationName,
99
- rpcInterface: WebAppRpcLogging.getRpcInterfaceName(object.operation.interfaceDefinition),
95
+ rpcInterface: this.getRpcInterfaceName(object.operation.interfaceDefinition),
100
96
  status,
101
97
  // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!
102
98
  ActivityId: object.id,
103
99
  TimeElapsed: elapsed,
104
- MachineName: getHostname(),
100
+ MachineName: this.getHostname(),
105
101
  ...pathIds,
106
102
  }));
107
103
  }
108
- static logErrorFrontend(message, request) {
109
- const operationDescriptor = WebAppRpcLogging.buildOperationDescriptor(request.operation);
110
- const pathIds = WebAppRpcLogging.findPathIds(request.path);
104
+ }
105
+ class WebAppRpcLoggingFrontend extends WebAppRpcLogging {
106
+ async logProtocolEvent(event, object) {
107
+ switch (event) {
108
+ case RpcProtocolEvent.RequestCreated: return this.logRequest(CommonLoggerCategory.RpcInterfaceFrontend, "RpcInterface.frontend.request", object);
109
+ case RpcProtocolEvent.ResponseLoaded: return this.logResponse(CommonLoggerCategory.RpcInterfaceFrontend, "RpcInterface.frontend.response", object, object.metadata.status, object.elapsed);
110
+ case RpcProtocolEvent.ConnectionErrorReceived: return this.logErrorFrontend("RpcInterface.frontend.connectionError", object);
111
+ case RpcProtocolEvent.ConnectionAborted: return this.logErrorFrontend("RpcInterface.frontend.connectionAborted", object);
112
+ }
113
+ }
114
+ getHostname() {
115
+ if (globalThis.window) {
116
+ return globalThis.window.location.host;
117
+ }
118
+ else {
119
+ return "imodeljs-mobile";
120
+ }
121
+ }
122
+ logErrorFrontend(message, request) {
123
+ const operationDescriptor = this.buildOperationDescriptor(request.operation);
124
+ const pathIds = this.findPathIds(request.path);
111
125
  Logger.logInfo(CommonLoggerCategory.RpcInterfaceFrontend, `${message}.${operationDescriptor}`, () => ({
112
126
  method: request.method,
113
127
  path: request.path,
114
128
  // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!
115
129
  ActivityId: request.id,
116
- MachineName: getHostname(),
117
- ...pathIds,
118
- }));
119
- }
120
- static async logErrorBackend(message, invocation) {
121
- const operationDescriptor = WebAppRpcLogging.buildOperationDescriptor(invocation.operation);
122
- const pathIds = WebAppRpcLogging.findPathIds(invocation.request.path);
123
- const result = await invocation.result;
124
- const errorMessage = result.message ? result.message : result.objects; // Can be an error or an RpcSerializedValue
125
- Logger.logInfo(CommonLoggerCategory.RpcInterfaceBackend, `${message}.${operationDescriptor}`, () => ({
126
- method: invocation.request.method,
127
- path: invocation.request.path,
128
- status: invocation.status,
129
- errorMessage,
130
- // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!
131
- ActivityId: invocation.request.id,
132
- MachineName: getHostname(),
130
+ MachineName: this.getHostname(),
133
131
  ...pathIds,
134
132
  }));
135
133
  }
136
134
  }
135
+ WebAppRpcLogging.initializeFrontend(new WebAppRpcLoggingFrontend());
137
136
  //# sourceMappingURL=WebAppRpcLogging.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebAppRpcLogging.js","sourceRoot":"","sources":["../../../../src/rpc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,uGAAuG;YACvG,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE;YACjC,WAAW,EAAE,WAAW,EAAE;YAC1B,GAAG,OAAO;SACX,CAAC,CAAC,CAAC;IACN,CAAC;CACF","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\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\r\nimport { RpcInterfaceDefinition } from \"../../RpcInterface\";\r\nimport { RpcProtocolEvent } from \"../core/RpcConstants\";\r\nimport { RpcInvocation } from \"../core/RpcInvocation\";\r\nimport { RpcOperation } from \"../core/RpcOperation\";\r\nimport { SerializedRpcOperation, SerializedRpcRequest } from \"../core/RpcProtocol\";\r\nimport { RpcRequest } from \"../core/RpcRequest\";\r\nimport { WebAppRpcRequest } from \"./WebAppRpcRequest\";\r\n\r\nlet hostname = \"\";\r\nfunction getHostname(): string {\r\n if (!hostname) {\r\n try {\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n const os = require(\"os\");\r\n hostname = os.hostname();\r\n } catch (_) {\r\n if (globalThis.window) {\r\n hostname = globalThis.window.location.host;\r\n } else {\r\n hostname = \"imodeljs-mobile\";\r\n }\r\n }\r\n }\r\n return hostname;\r\n}\r\n\r\n/** @internal */\r\nexport class WebAppRpcLogging {\r\n public static async logProtocolEvent(event: RpcProtocolEvent, object: RpcRequest | RpcInvocation): Promise<void> {\r\n if (object instanceof WebAppRpcRequest) {\r\n switch (event) {\r\n case RpcProtocolEvent.RequestCreated: return WebAppRpcLogging.logRequest(CommonLoggerCategory.RpcInterfaceFrontend, \"RpcInterface.frontend.request\", object);\r\n case RpcProtocolEvent.ResponseLoaded: return WebAppRpcLogging.logResponse(CommonLoggerCategory.RpcInterfaceFrontend, \"RpcInterface.frontend.response\", object, object.metadata.status, object.elapsed);\r\n case RpcProtocolEvent.ConnectionErrorReceived: return WebAppRpcLogging.logErrorFrontend(\"RpcInterface.frontend.connectionError\", object);\r\n case RpcProtocolEvent.ConnectionAborted: return WebAppRpcLogging.logErrorFrontend(\"RpcInterface.frontend.connectionAborted\", object);\r\n }\r\n } else if (object instanceof RpcInvocation) {\r\n switch (event) {\r\n case RpcProtocolEvent.RequestReceived: return WebAppRpcLogging.logRequest(CommonLoggerCategory.RpcInterfaceBackend, \"RpcInterface.backend.request\", object.request);\r\n case RpcProtocolEvent.BackendErrorOccurred: return WebAppRpcLogging.logErrorBackend(\"RpcInterface.backend.error\", object);\r\n case RpcProtocolEvent.BackendResponseCreated: return WebAppRpcLogging.logResponse(CommonLoggerCategory.RpcInterfaceBackend, \"RpcInterface.backend.response\", object.request, object.status, object.elapsed);\r\n }\r\n }\r\n }\r\n\r\n private static getRpcInterfaceName(g: string | RpcInterfaceDefinition): string {\r\n return (typeof g === \"string\") ? g : g.interfaceName;\r\n }\r\n\r\n private static findPathIds(path: string) {\r\n let iTwinId = \"\";\r\n let iModelId = \"\";\r\n\r\n const tokens = path.split(\"/\");\r\n for (let i = 0; i !== tokens.length; ++i) {\r\n // For backwards compatibility, find old \"context\" or current \"iTwin\" terminology\r\n if ((/^context$/i).test(tokens[i]) || (/^itwin$/i).test(tokens[i])) {\r\n iTwinId = tokens[i + 1] || \"\";\r\n }\r\n\r\n if ((/^imodel$/i).test(tokens[i])) {\r\n iModelId = tokens[i + 1] || \"\";\r\n }\r\n }\r\n\r\n return { iTwinId, iModelId };\r\n }\r\n\r\n private static buildOperationDescriptor(operation: RpcOperation | SerializedRpcOperation): string {\r\n if (!operation) {\r\n return \"unknown.unknown\";\r\n }\r\n\r\n const interfaceName = typeof (operation.interfaceDefinition) === \"string\" ? operation.interfaceDefinition : operation.interfaceDefinition.interfaceName;\r\n const operationName = operation.operationName;\r\n return `${interfaceName}.${operationName}`;\r\n }\r\n\r\n private static logRequest(loggerCategory: string, message: string, object: WebAppRpcRequest | SerializedRpcRequest): void {\r\n const operationDescriptor = WebAppRpcLogging.buildOperationDescriptor(object.operation);\r\n const pathIds = WebAppRpcLogging.findPathIds(object.path);\r\n\r\n Logger.logTrace(loggerCategory, `${message}.${operationDescriptor}`, () => ({\r\n method: object.method,\r\n path: object.path,\r\n operation: object.operation.operationName,\r\n rpcInterface: WebAppRpcLogging.getRpcInterfaceName(object.operation.interfaceDefinition),\r\n // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!\r\n ActivityId: object.id, // eslint-disable-line @typescript-eslint/naming-convention\r\n TimeElapsed: (\"elapsed\" in object) ? object.elapsed : 0, // eslint-disable-line @typescript-eslint/naming-convention\r\n MachineName: getHostname(), // eslint-disable-line @typescript-eslint/naming-convention\r\n ...pathIds,\r\n }));\r\n }\r\n\r\n private static logResponse(loggerCategory: string, message: string, object: WebAppRpcRequest | SerializedRpcRequest, status: number, elapsed: number): void {\r\n const operationDescriptor = WebAppRpcLogging.buildOperationDescriptor(object.operation);\r\n const pathIds = WebAppRpcLogging.findPathIds(object.path);\r\n\r\n Logger.logTrace(loggerCategory, `${message}.${operationDescriptor}`, () => ({\r\n method: object.method,\r\n path: object.path,\r\n operation: object.operation.operationName,\r\n rpcInterface: WebAppRpcLogging.getRpcInterfaceName(object.operation.interfaceDefinition),\r\n status,\r\n // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!\r\n ActivityId: object.id, // eslint-disable-line @typescript-eslint/naming-convention\r\n TimeElapsed: elapsed, // eslint-disable-line @typescript-eslint/naming-convention\r\n MachineName: getHostname(), // eslint-disable-line @typescript-eslint/naming-convention\r\n ...pathIds,\r\n }));\r\n }\r\n\r\n private static logErrorFrontend(message: string, request: WebAppRpcRequest): void {\r\n const operationDescriptor = WebAppRpcLogging.buildOperationDescriptor(request.operation);\r\n const pathIds = WebAppRpcLogging.findPathIds(request.path);\r\n\r\n Logger.logInfo(CommonLoggerCategory.RpcInterfaceFrontend, `${message}.${operationDescriptor}`, () => ({\r\n method: request.method,\r\n path: request.path,\r\n // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!\r\n ActivityId: request.id, // eslint-disable-line @typescript-eslint/naming-convention\r\n MachineName: getHostname(), // eslint-disable-line @typescript-eslint/naming-convention\r\n ...pathIds,\r\n }));\r\n }\r\n\r\n private static async logErrorBackend(message: string, invocation: RpcInvocation): Promise<void> {\r\n const operationDescriptor = WebAppRpcLogging.buildOperationDescriptor(invocation.operation);\r\n const pathIds = WebAppRpcLogging.findPathIds(invocation.request.path);\r\n const result = await invocation.result;\r\n const errorMessage = result.message ? result.message : result.objects; // Can be an error or an RpcSerializedValue\r\n\r\n Logger.logInfo(CommonLoggerCategory.RpcInterfaceBackend, `${message}.${operationDescriptor}`, () => ({\r\n method: invocation.request.method,\r\n path: invocation.request.path,\r\n status: invocation.status,\r\n errorMessage,\r\n // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!\r\n ActivityId: invocation.request.id, // eslint-disable-line @typescript-eslint/naming-convention\r\n MachineName: getHostname(), // eslint-disable-line @typescript-eslint/naming-convention\r\n ...pathIds,\r\n }));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"WebAppRpcLogging.js","sourceRoot":"","sources":["../../../../src/rpc/web/WebAppRpcLogging.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAItD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,gBAAgB;AAChB,MAAM,OAAO,GAA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AC,wBAAwB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC7E,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAE/C,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,oBAAoB,EAAE,GAAG,OAAO,IAAI,mBAAmB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;YACpG,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,uGAAuG;YACvG,UAAU,EAAE,OAAO,CAAC,EAAE;YACtB,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;YAC/B,GAAG,OAAO;SACX,CAAC,CAAC,CAAC;IACN,CAAC;CACF;AAED,gBAAgB,CAAC,kBAAkB,CAAC,IAAI,wBAAwB,EAAE,CAAC,CAAC","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\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { BentleyStatus, Logger } from \"@itwin/core-bentley\";\r\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\r\nimport { IModelError } from \"../../IModelError\";\r\nimport { RpcInterfaceDefinition } from \"../../RpcInterface\";\r\nimport { RpcProtocolEvent } from \"../core/RpcConstants\";\r\nimport { RpcInvocation } from \"../core/RpcInvocation\";\r\nimport { RpcOperation } from \"../core/RpcOperation\";\r\nimport { SerializedRpcOperation, SerializedRpcRequest } from \"../core/RpcProtocol\";\r\nimport { RpcRequest } from \"../core/RpcRequest\";\r\nimport { WebAppRpcRequest } from \"./WebAppRpcRequest\";\r\n\r\n/** @internal */\r\nconst BACKEND = Symbol.for(\"@itwin.WebAppRpcLogging.Backend\");\r\nconst FRONTEND = Symbol.for(\"@itwin.WebAppRpcLogging.Frontend\");\r\n\r\n/** @internal */\r\nexport abstract class WebAppRpcLogging {\r\n public static initializeBackend(instance: WebAppRpcLogging) {\r\n (globalThis as any)[BACKEND] = instance;\r\n }\r\n\r\n public static initializeFrontend(instance: WebAppRpcLogging) {\r\n (globalThis as any)[FRONTEND] = instance;\r\n }\r\n\r\n private static get backend(): WebAppRpcLogging {\r\n const instance = (globalThis as any)[BACKEND];\r\n if (typeof (instance) === \"undefined\") {\r\n throw new IModelError(BentleyStatus.ERROR, \"Backend logging is not initialized.\");\r\n }\r\n\r\n return instance;\r\n }\r\n\r\n private static get frontend(): WebAppRpcLogging {\r\n const instance = (globalThis as any)[FRONTEND];\r\n if (typeof (instance) === \"undefined\") {\r\n throw new IModelError(BentleyStatus.ERROR, \"Frontend logging is not initialized.\");\r\n }\r\n\r\n return instance;\r\n }\r\n\r\n public static async logProtocolEvent(event: RpcProtocolEvent, object: RpcRequest | RpcInvocation): Promise<void> {\r\n if (object instanceof WebAppRpcRequest) {\r\n await WebAppRpcLogging.frontend.logProtocolEvent(event, object);\r\n } else if (object instanceof RpcInvocation) {\r\n await WebAppRpcLogging.backend.logProtocolEvent(event, object);\r\n }\r\n }\r\n\r\n protected abstract logProtocolEvent(event: RpcProtocolEvent, object: RpcRequest | RpcInvocation): Promise<void>;\r\n\r\n protected abstract getHostname(): string;\r\n\r\n protected getRpcInterfaceName(g: string | RpcInterfaceDefinition): string {\r\n return (typeof g === \"string\") ? g : g.interfaceName;\r\n }\r\n\r\n protected findPathIds(path: string) {\r\n let iTwinId = \"\";\r\n let iModelId = \"\";\r\n\r\n const tokens = path.split(\"/\");\r\n for (let i = 0; i !== tokens.length; ++i) {\r\n // For backwards compatibility, find old \"context\" or current \"iTwin\" terminology\r\n if ((/^context$/i).test(tokens[i]) || (/^itwin$/i).test(tokens[i])) {\r\n iTwinId = tokens[i + 1] || \"\";\r\n }\r\n\r\n if ((/^imodel$/i).test(tokens[i])) {\r\n iModelId = tokens[i + 1] || \"\";\r\n }\r\n }\r\n\r\n return { iTwinId, iModelId };\r\n }\r\n\r\n protected buildOperationDescriptor(operation: RpcOperation | SerializedRpcOperation): string {\r\n if (!operation) {\r\n return \"unknown.unknown\";\r\n }\r\n\r\n const interfaceName = typeof (operation.interfaceDefinition) === \"string\" ? operation.interfaceDefinition : operation.interfaceDefinition.interfaceName;\r\n const operationName = operation.operationName;\r\n return `${interfaceName}.${operationName}`;\r\n }\r\n\r\n protected logRequest(loggerCategory: string, message: string, object: WebAppRpcRequest | SerializedRpcRequest): void {\r\n const operationDescriptor = this.buildOperationDescriptor(object.operation);\r\n const pathIds = this.findPathIds(object.path);\r\n\r\n Logger.logTrace(loggerCategory, `${message}.${operationDescriptor}`, () => ({\r\n method: object.method,\r\n path: object.path,\r\n operation: object.operation.operationName,\r\n rpcInterface: this.getRpcInterfaceName(object.operation.interfaceDefinition),\r\n // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!\r\n ActivityId: object.id, // eslint-disable-line @typescript-eslint/naming-convention\r\n TimeElapsed: (\"elapsed\" in object) ? object.elapsed : 0, // eslint-disable-line @typescript-eslint/naming-convention\r\n MachineName: this.getHostname(), // eslint-disable-line @typescript-eslint/naming-convention\r\n ...pathIds,\r\n }));\r\n }\r\n\r\n protected logResponse(loggerCategory: string, message: string, object: WebAppRpcRequest | SerializedRpcRequest, status: number, elapsed: number): void {\r\n const operationDescriptor = this.buildOperationDescriptor(object.operation);\r\n const pathIds = this.findPathIds(object.path);\r\n\r\n Logger.logTrace(loggerCategory, `${message}.${operationDescriptor}`, () => ({\r\n method: object.method,\r\n path: object.path,\r\n operation: object.operation.operationName,\r\n rpcInterface: this.getRpcInterfaceName(object.operation.interfaceDefinition),\r\n status,\r\n // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!\r\n ActivityId: object.id, // eslint-disable-line @typescript-eslint/naming-convention\r\n TimeElapsed: elapsed, // eslint-disable-line @typescript-eslint/naming-convention\r\n MachineName: this.getHostname(), // eslint-disable-line @typescript-eslint/naming-convention\r\n ...pathIds,\r\n }));\r\n }\r\n}\r\n\r\nclass WebAppRpcLoggingFrontend extends WebAppRpcLogging {\r\n protected override async logProtocolEvent(event: RpcProtocolEvent, object: WebAppRpcRequest): Promise<void> {\r\n switch (event) {\r\n case RpcProtocolEvent.RequestCreated: return this.logRequest(CommonLoggerCategory.RpcInterfaceFrontend, \"RpcInterface.frontend.request\", object);\r\n case RpcProtocolEvent.ResponseLoaded: return this.logResponse(CommonLoggerCategory.RpcInterfaceFrontend, \"RpcInterface.frontend.response\", object, object.metadata.status, object.elapsed);\r\n case RpcProtocolEvent.ConnectionErrorReceived: return this.logErrorFrontend(\"RpcInterface.frontend.connectionError\", object);\r\n case RpcProtocolEvent.ConnectionAborted: return this.logErrorFrontend(\"RpcInterface.frontend.connectionAborted\", object);\r\n }\r\n }\r\n\r\n protected override getHostname(): string {\r\n if (globalThis.window) {\r\n return globalThis.window.location.host;\r\n } else {\r\n return \"imodeljs-mobile\";\r\n }\r\n }\r\n\r\n private logErrorFrontend(message: string, request: WebAppRpcRequest): void {\r\n const operationDescriptor = this.buildOperationDescriptor(request.operation);\r\n const pathIds = this.findPathIds(request.path);\r\n\r\n Logger.logInfo(CommonLoggerCategory.RpcInterfaceFrontend, `${message}.${operationDescriptor}`, () => ({\r\n method: request.method,\r\n path: request.path,\r\n // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!\r\n ActivityId: request.id, // eslint-disable-line @typescript-eslint/naming-convention\r\n MachineName: this.getHostname(), // eslint-disable-line @typescript-eslint/naming-convention\r\n ...pathIds,\r\n }));\r\n }\r\n}\r\n\r\nWebAppRpcLogging.initializeFrontend(new WebAppRpcLoggingFrontend());\r\n"]}
@@ -2,7 +2,7 @@
2
2
  * @module RpcInterface
3
3
  */
4
4
  /// <reference types="node" />
5
- import { Readable, Writable } from "stream";
5
+ import { BackendReadable, BackendWritable } from "../../BackendTypes";
6
6
  import { RpcConfiguration } from "../core/RpcConfiguration";
7
7
  import { RpcContentType, RpcRequestStatus } from "../core/RpcConstants";
8
8
  import { RpcOperation } from "../core/RpcOperation";
@@ -12,7 +12,7 @@ import { WebAppRpcRequest } from "./WebAppRpcRequest";
12
12
  /** An HTTP server request object.
13
13
  * @public
14
14
  */
15
- export interface HttpServerRequest extends Readable {
15
+ export interface HttpServerRequest extends BackendReadable {
16
16
  aborted: boolean;
17
17
  httpVersion: string;
18
18
  httpVersionMajor: number;
@@ -27,6 +27,7 @@ export interface HttpServerRequest extends Readable {
27
27
  [key: string]: string | undefined;
28
28
  };
29
29
  rawTrailers: string[];
30
+ setTimeout(msecs: number, callback: () => void): void;
30
31
  setTimeout(msecs: number, callback: () => void): this;
31
32
  url?: string;
32
33
  statusCode?: number;
@@ -42,7 +43,7 @@ export interface HttpServerRequest extends Readable {
42
43
  /** An HTTP server response object.
43
44
  * @public
44
45
  */
45
- export interface HttpServerResponse extends Writable {
46
+ export interface HttpServerResponse extends BackendWritable {
46
47
  send(body?: any): HttpServerResponse;
47
48
  status(code: number): HttpServerResponse;
48
49
  set(field: string, value: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"WebAppRpcProtocol.d.ts","sourceRoot":"","sources":["../../../../src/rpc/web/WebAppRpcProtocol.ts"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAqB,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAwB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;IAC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;YAC3C,KAAK,gBAAgB,CAAC,QAAQ,CAAC,CAAC,OAAO,GAAG,CAAC;YAC3C,KAAK,gBAAgB,CAAC,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC;YAC5C,KAAK,gBAAgB,CAAC,UAAU,CAAC,CAAC,OAAO,GAAG,CAAC;YAC7C,KAAK,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,OAAO,GAAG,CAAC;YACrD,KAAK,gBAAgB,CAAC,cAAc,CAAC,CAAC,OAAO,GAAG,CAAC;YACjD,KAAK,gBAAgB,CAAC,cAAc,CAAC,CAAC,OAAO,GAAG,CAAC;YACjD,KAAK,gBAAgB,CAAC,eAAe,CAAC,CAAC,OAAO,GAAG,CAAC;YAClD,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC;SACrB;IACH,CAAC;IAID,+DAA+D;IACxD,SAAS,CAAC,IAAY;QAC3B,OAAO,IAAI,KAAK,GAAG,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAW,kBAAkB,KAAK,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAY5E","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\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { BentleyError, Logger } from \"@itwin/core-bentley\";\r\nimport { Readable, Writable } from \"stream\";\r\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\r\nimport { RpcConfiguration } from \"../core/RpcConfiguration\";\r\nimport { RpcContentType, RpcRequestStatus, WEB_RPC_CONSTANTS } from \"../core/RpcConstants\";\r\nimport { RpcOperation } from \"../core/RpcOperation\";\r\nimport { RpcProtocol, SerializedRpcRequest } from \"../core/RpcProtocol\";\r\nimport { OpenAPIInfo, OpenAPIParameter, RpcOpenAPIDescription } from \"./OpenAPI\";\r\nimport { WebAppRpcLogging } from \"./WebAppRpcLogging\";\r\nimport { WebAppRpcRequest } from \"./WebAppRpcRequest\";\r\n\r\n/** An HTTP server request object.\r\n * @public\r\n */\r\nexport interface HttpServerRequest extends Readable {\r\n aborted: boolean;\r\n httpVersion: string;\r\n httpVersionMajor: number;\r\n httpVersionMinor: number;\r\n complete: boolean;\r\n connection: any;\r\n headers: { [header: string]: string | string[] | undefined };\r\n rawHeaders: string[];\r\n trailers: { [key: string]: string | undefined };\r\n rawTrailers: string[];\r\n setTimeout(msecs: number, callback: () => void): this;\r\n url?: string;\r\n statusCode?: number;\r\n statusMessage?: string;\r\n socket: any;\r\n destroy(error?: Error): this;\r\n body: string | Buffer;\r\n path: string;\r\n method: string;\r\n ip?: string;\r\n header: (field: string) => string | undefined;\r\n}\r\n\r\n/** An HTTP server response object.\r\n * @public\r\n */\r\nexport interface HttpServerResponse extends Writable {\r\n send(body?: any): HttpServerResponse;\r\n status(code: number): HttpServerResponse;\r\n set(field: string, value: string): void;\r\n}\r\n\r\n/** The HTTP application protocol.\r\n * @internal\r\n */\r\nexport abstract class WebAppRpcProtocol extends RpcProtocol {\r\n public override preserveStreams = true;\r\n\r\n /** Convenience handler for an RPC operation get request for an HTTP server. */\r\n public async handleOperationGetRequest(req: HttpServerRequest, res: HttpServerResponse) {\r\n return this.handleOperationPostRequest(req, res);\r\n }\r\n\r\n /** Convenience handler for an RPC operation post request for an HTTP server. */\r\n public async handleOperationPostRequest(req: HttpServerRequest, res: HttpServerResponse) {\r\n let request: SerializedRpcRequest;\r\n try {\r\n request = await WebAppRpcRequest.parseRequest(this, req);\r\n } catch (error) {\r\n const message = BentleyError.getErrorMessage(error);\r\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, `Failed to parse request: ${message}`, BentleyError.getErrorMetadata(error));\r\n res.status(400);\r\n res.send(JSON.stringify({ message, isError: true }));\r\n return;\r\n }\r\n const fulfillment = await this.fulfill(request);\r\n await WebAppRpcRequest.sendResponse(this, request, fulfillment, req, res);\r\n }\r\n\r\n /** Convenience handler for an OpenAPI description request for an HTTP server. */\r\n public handleOpenApiDescriptionRequest(_req: HttpServerRequest, res: HttpServerResponse) {\r\n const description = JSON.stringify(this.openAPIDescription);\r\n res.send(description);\r\n }\r\n\r\n /** Converts an HTTP content type value to an RPC content type value. */\r\n public static computeContentType(httpType: string | null | undefined): RpcContentType {\r\n if (!httpType)\r\n return RpcContentType.Unknown;\r\n\r\n if (httpType.indexOf(WEB_RPC_CONSTANTS.ANY_TEXT) === 0) {\r\n return RpcContentType.Text;\r\n } else if (httpType.indexOf(WEB_RPC_CONSTANTS.BINARY) === 0) {\r\n return RpcContentType.Binary;\r\n } else if (httpType.indexOf(WEB_RPC_CONSTANTS.MULTIPART) === 0) {\r\n return RpcContentType.Multipart;\r\n } else {\r\n return RpcContentType.Unknown;\r\n }\r\n }\r\n\r\n /** The OpenAPI-compatible info object for this protocol. */\r\n public abstract info: OpenAPIInfo;\r\n\r\n /** An optional prefix for RPC operation URI paths. */\r\n public pathPrefix: string = \"\";\r\n\r\n /** The RPC request class for this protocol. */\r\n public readonly requestType = WebAppRpcRequest;\r\n\r\n /** Supplies the status corresponding to a protocol-specific code value. */\r\n public override getStatus(code: number): RpcRequestStatus {\r\n switch (code) {\r\n case 404: return RpcRequestStatus.NotFound;\r\n case 202: return RpcRequestStatus.Pending;\r\n case 200: return RpcRequestStatus.Resolved;\r\n case 500: return RpcRequestStatus.Rejected;\r\n case 204: return RpcRequestStatus.NoContent;\r\n case 502: return RpcRequestStatus.BadGateway;\r\n case 503: return RpcRequestStatus.ServiceUnavailable;\r\n case 504: return RpcRequestStatus.GatewayTimeout;\r\n case 408: return RpcRequestStatus.RequestTimeout;\r\n case 429: return RpcRequestStatus.TooManyRequests;\r\n default: return RpcRequestStatus.Unknown;\r\n }\r\n }\r\n\r\n /** Supplies the protocol-specific code corresponding to a status value. */\r\n public override getCode(status: RpcRequestStatus): number {\r\n switch (status) {\r\n case RpcRequestStatus.NotFound: return 404;\r\n case RpcRequestStatus.Pending: return 202;\r\n case RpcRequestStatus.Resolved: return 200;\r\n case RpcRequestStatus.Rejected: return 500;\r\n case RpcRequestStatus.NoContent: return 204;\r\n case RpcRequestStatus.BadGateway: return 502;\r\n case RpcRequestStatus.ServiceUnavailable: return 503;\r\n case RpcRequestStatus.GatewayTimeout: return 504;\r\n case RpcRequestStatus.RequestTimeout: return 408;\r\n case RpcRequestStatus.TooManyRequests: return 429;\r\n default: return 501;\r\n }\r\n }\r\n\r\n public override supportsStatusCategory = true;\r\n\r\n /** Whether an HTTP status code indicates a request timeout. */\r\n public isTimeout(code: number): boolean {\r\n return code === 504;\r\n }\r\n\r\n /** An OpenAPI-compatible description of this protocol.\r\n * @internal\r\n */\r\n public get openAPIDescription() { return new RpcOpenAPIDescription(this); }\r\n\r\n /** Returns the OpenAPI-compatible URI path parameters for an RPC operation.\r\n * @internal\r\n */\r\n public abstract supplyPathParametersForOperation(_operation: RpcOperation): OpenAPIParameter[];\r\n\r\n /** Constructs an HTTP protocol. */\r\n public constructor(configuration: RpcConfiguration) {\r\n super(configuration);\r\n this.events.addListener(WebAppRpcLogging.logProtocolEvent);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"WebAppRpcProtocol.js","sourceRoot":"","sources":["../../../../src/rpc/web/WebAppRpcProtocol.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE3F,OAAO,EAAE,WAAW,EAAwB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAiC,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OA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3B,OAAO,IAAI,KAAK,GAAG,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAW,kBAAkB,KAAK,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAY5E","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\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { BentleyError, Logger } from \"@itwin/core-bentley\";\r\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\r\nimport { BackendReadable, BackendWritable } from \"../../BackendTypes\";\r\nimport { RpcConfiguration } from \"../core/RpcConfiguration\";\r\nimport { RpcContentType, RpcRequestStatus, WEB_RPC_CONSTANTS } from \"../core/RpcConstants\";\r\nimport { RpcOperation } from \"../core/RpcOperation\";\r\nimport { RpcProtocol, SerializedRpcRequest } from \"../core/RpcProtocol\";\r\nimport { OpenAPIInfo, OpenAPIParameter, RpcOpenAPIDescription } from \"./OpenAPI\";\r\nimport { WebAppRpcLogging } from \"./WebAppRpcLogging\";\r\nimport { WebAppRpcRequest } from \"./WebAppRpcRequest\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** An HTTP server request object.\r\n * @public\r\n */\r\nexport interface HttpServerRequest extends BackendReadable {\r\n aborted: boolean;\r\n httpVersion: string;\r\n httpVersionMajor: number;\r\n httpVersionMinor: number;\r\n complete: boolean;\r\n connection: any;\r\n headers: { [header: string]: string | string[] | undefined };\r\n rawHeaders: string[];\r\n trailers: { [key: string]: string | undefined };\r\n rawTrailers: string[];\r\n setTimeout(msecs: number, callback: () => void): void;\r\n setTimeout(msecs: number, callback: () => void): this;\r\n url?: string;\r\n statusCode?: number;\r\n statusMessage?: string;\r\n socket: any;\r\n destroy(error?: Error): this;\r\n body: string | Buffer;\r\n path: string;\r\n method: string;\r\n ip?: string;\r\n header: (field: string) => string | undefined;\r\n}\r\n\r\n/** An HTTP server response object.\r\n * @public\r\n */\r\nexport interface HttpServerResponse extends BackendWritable {\r\n send(body?: any): HttpServerResponse;\r\n status(code: number): HttpServerResponse;\r\n set(field: string, value: string): void;\r\n}\r\n\r\n/** The HTTP application protocol.\r\n * @internal\r\n */\r\nexport abstract class WebAppRpcProtocol extends RpcProtocol {\r\n public override preserveStreams = true;\r\n\r\n /** Convenience handler for an RPC operation get request for an HTTP server. */\r\n public async handleOperationGetRequest(req: HttpServerRequest, res: HttpServerResponse) {\r\n return this.handleOperationPostRequest(req, res);\r\n }\r\n\r\n /** Convenience handler for an RPC operation post request for an HTTP server. */\r\n public async handleOperationPostRequest(req: HttpServerRequest, res: HttpServerResponse) {\r\n let request: SerializedRpcRequest;\r\n try {\r\n request = await WebAppRpcRequest.parseRequest(this, req);\r\n } catch (error) {\r\n const message = BentleyError.getErrorMessage(error);\r\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, `Failed to parse request: ${message}`, BentleyError.getErrorMetadata(error));\r\n res.status(400);\r\n res.send(JSON.stringify({ message, isError: true }));\r\n return;\r\n }\r\n const fulfillment = await this.fulfill(request);\r\n await WebAppRpcRequest.sendResponse(this, request, fulfillment, req, res);\r\n }\r\n\r\n /** Convenience handler for an OpenAPI description request for an HTTP server. */\r\n public handleOpenApiDescriptionRequest(_req: HttpServerRequest, res: HttpServerResponse) {\r\n const description = JSON.stringify(this.openAPIDescription);\r\n res.send(description);\r\n }\r\n\r\n /** Converts an HTTP content type value to an RPC content type value. */\r\n public static computeContentType(httpType: string | null | undefined): RpcContentType {\r\n if (!httpType)\r\n return RpcContentType.Unknown;\r\n\r\n if (httpType.indexOf(WEB_RPC_CONSTANTS.ANY_TEXT) === 0) {\r\n return RpcContentType.Text;\r\n } else if (httpType.indexOf(WEB_RPC_CONSTANTS.BINARY) === 0) {\r\n return RpcContentType.Binary;\r\n } else if (httpType.indexOf(WEB_RPC_CONSTANTS.MULTIPART) === 0) {\r\n return RpcContentType.Multipart;\r\n } else {\r\n return RpcContentType.Unknown;\r\n }\r\n }\r\n\r\n /** The OpenAPI-compatible info object for this protocol. */\r\n public abstract info: OpenAPIInfo;\r\n\r\n /** An optional prefix for RPC operation URI paths. */\r\n public pathPrefix: string = \"\";\r\n\r\n /** The RPC request class for this protocol. */\r\n public readonly requestType = WebAppRpcRequest;\r\n\r\n /** Supplies the status corresponding to a protocol-specific code value. */\r\n public override getStatus(code: number): RpcRequestStatus {\r\n switch (code) {\r\n case 404: return RpcRequestStatus.NotFound;\r\n case 202: return RpcRequestStatus.Pending;\r\n case 200: return RpcRequestStatus.Resolved;\r\n case 500: return RpcRequestStatus.Rejected;\r\n case 204: return RpcRequestStatus.NoContent;\r\n case 502: return RpcRequestStatus.BadGateway;\r\n case 503: return RpcRequestStatus.ServiceUnavailable;\r\n case 504: return RpcRequestStatus.GatewayTimeout;\r\n case 408: return RpcRequestStatus.RequestTimeout;\r\n case 429: return RpcRequestStatus.TooManyRequests;\r\n default: return RpcRequestStatus.Unknown;\r\n }\r\n }\r\n\r\n /** Supplies the protocol-specific code corresponding to a status value. */\r\n public override getCode(status: RpcRequestStatus): number {\r\n switch (status) {\r\n case RpcRequestStatus.NotFound: return 404;\r\n case RpcRequestStatus.Pending: return 202;\r\n case RpcRequestStatus.Resolved: return 200;\r\n case RpcRequestStatus.Rejected: return 500;\r\n case RpcRequestStatus.NoContent: return 204;\r\n case RpcRequestStatus.BadGateway: return 502;\r\n case RpcRequestStatus.ServiceUnavailable: return 503;\r\n case RpcRequestStatus.GatewayTimeout: return 504;\r\n case RpcRequestStatus.RequestTimeout: return 408;\r\n case RpcRequestStatus.TooManyRequests: return 429;\r\n default: return 501;\r\n }\r\n }\r\n\r\n public override supportsStatusCategory = true;\r\n\r\n /** Whether an HTTP status code indicates a request timeout. */\r\n public isTimeout(code: number): boolean {\r\n return code === 504;\r\n }\r\n\r\n /** An OpenAPI-compatible description of this protocol.\r\n * @internal\r\n */\r\n public get openAPIDescription() { return new RpcOpenAPIDescription(this); }\r\n\r\n /** Returns the OpenAPI-compatible URI path parameters for an RPC operation.\r\n * @internal\r\n */\r\n public abstract supplyPathParametersForOperation(_operation: RpcOperation): OpenAPIParameter[];\r\n\r\n /** Constructs an HTTP protocol. */\r\n public constructor(configuration: RpcConfiguration) {\r\n super(configuration);\r\n this.events.addListener(WebAppRpcLogging.logProtocolEvent);\r\n }\r\n}\r\n"]}
@@ -32,14 +32,12 @@ export declare class WebAppRpcRequest extends RpcRequest {
32
32
  status: number;
33
33
  message: string;
34
34
  };
35
- /** Parse headers */
36
- private static parseHeaders;
37
35
  /** Parses a request. */
38
36
  static parseRequest(protocol: WebAppRpcProtocol, req: HttpServerRequest): Promise<SerializedRpcRequest>;
39
37
  /** Sends the response for a web request. */
40
38
  static sendResponse(protocol: WebAppRpcProtocol, request: SerializedRpcRequest, fulfillment: RpcRequestFulfillment, req: HttpServerRequest, res: HttpServerResponse): Promise<void>;
41
39
  /** Determines the most efficient transport type for an RPC value. */
42
- protected static computeTransportType(value: RpcSerializedValue, source: any): RpcContentType;
40
+ static computeTransportType(value: RpcSerializedValue, source: any): RpcContentType;
43
41
  /** Constructs a web application request. */
44
42
  constructor(client: RpcInterface, operation: string, parameters: any[]);
45
43
  /** Sets request header values. */
@@ -53,13 +51,6 @@ export declare class WebAppRpcRequest extends RpcRequest {
53
51
  protected supplyFetch(): typeof fetch;
54
52
  /** Override to supply an alternate Request function. */
55
53
  protected supplyRequest(): typeof Request;
56
- private static configureResponse;
57
- private static configureText;
58
- private static configureBinary;
59
- private static configureMultipart;
60
- private static configureStream;
61
- private static parseFromPath;
62
- private static parseFromBody;
63
54
  private performFetch;
64
55
  private loadText;
65
56
  private loadBinary;
@@ -68,5 +59,10 @@ export declare class WebAppRpcRequest extends RpcRequest {
68
59
  private setupBinaryTransport;
69
60
  private setupMultipartTransport;
70
61
  private setupTextTransport;
62
+ /** @internal */
63
+ static backend: {
64
+ sendResponse: (_protocol: WebAppRpcProtocol, _request: SerializedRpcRequest, _fulfillment: RpcRequestFulfillment, _req: HttpServerRequest, _res: HttpServerResponse) => Promise<void>;
65
+ parseRequest: (_protocol: WebAppRpcProtocol, _req: HttpServerRequest) => Promise<SerializedRpcRequest>;
66
+ };
71
67
  }
72
68
  //# sourceMappingURL=WebAppRpcRequest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebAppRpcRequest.d.ts","sourceRoot":"","sources":["../../../../src/rpc/web/WebAppRpcRequest.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAkF,MAAM,sBAAsB,CAAC;AAEtI,OAAO,EAA0B,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAe,qBAAqB,EAA0B,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACvH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE/F,gBAAgB;AAChB,oBAAY,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtG;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAC9C,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,QAAQ,CAAmB;IACnC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,KAAK,QAAQ,GAAiE;IAErF;;;;OAIG;IACH,OAAc,mBAAmB,SAAY;IAE7C,wCAAwC;IACxB,MAAM,EAAE,YAAY,CAAC;IAErC,0DAA0D;IAC1D,SAAyB,QAAQ,EAAE,iBAAiB,CAA6C;IAEjG,+FAA+F;IACxF,QAAQ;;;MAA8B;IAE7C,oBAAoB;IACpB,OAAO,CAAC,M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