@itwin/core-common 4.4.0-dev.8 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/lib/cjs/FeatureTable.d.ts +7 -0
- package/lib/cjs/FeatureTable.d.ts.map +1 -1
- package/lib/cjs/FeatureTable.js +9 -0
- package/lib/cjs/FeatureTable.js.map +1 -1
- package/lib/cjs/GenericInstanceFilter.d.ts +151 -0
- package/lib/cjs/GenericInstanceFilter.d.ts.map +1 -0
- package/lib/cjs/GenericInstanceFilter.js +42 -0
- package/lib/cjs/GenericInstanceFilter.js.map +1 -0
- package/lib/cjs/MaterialProps.d.ts +27 -5
- package/lib/cjs/MaterialProps.d.ts.map +1 -1
- package/lib/cjs/MaterialProps.js.map +1 -1
- package/lib/cjs/PlanProjectionSettings.d.ts +2 -0
- package/lib/cjs/PlanProjectionSettings.d.ts.map +1 -1
- package/lib/cjs/PlanProjectionSettings.js +6 -0
- package/lib/cjs/PlanProjectionSettings.js.map +1 -1
- package/lib/cjs/core-common.d.ts +1 -0
- package/lib/cjs/core-common.d.ts.map +1 -1
- package/lib/cjs/core-common.js +1 -0
- package/lib/cjs/core-common.js.map +1 -1
- package/lib/cjs/geometry/ElementGeometry.d.ts +5 -3
- package/lib/cjs/geometry/ElementGeometry.d.ts.map +1 -1
- package/lib/cjs/geometry/ElementGeometry.js +37 -1
- package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
- package/lib/cjs/geometry/TextString.d.ts +10 -1
- package/lib/cjs/geometry/TextString.d.ts.map +1 -1
- package/lib/cjs/geometry/TextString.js.map +1 -1
- package/lib/cjs/rpc/core/RpcConstants.d.ts +6 -6
- package/lib/cjs/rpc/core/RpcConstants.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcConstants.js +6 -6
- package/lib/cjs/rpc/core/RpcConstants.js.map +1 -1
- package/lib/cjs/rpc/core/RpcInvocation.js +1 -1
- package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/cjs/rpc/web/OpenAPI.d.ts +1 -1
- package/lib/cjs/rpc/web/OpenAPI.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcProtocol.d.ts +2 -2
- package/lib/cjs/rpc/web/WebAppRpcProtocol.js.map +1 -1
- package/lib/cjs/tile/IModelTileIO.d.ts +2 -2
- package/lib/cjs/tile/IModelTileIO.js +2 -2
- package/lib/cjs/tile/IModelTileIO.js.map +1 -1
- package/lib/esm/FeatureTable.d.ts +7 -0
- package/lib/esm/FeatureTable.d.ts.map +1 -1
- package/lib/esm/FeatureTable.js +9 -0
- package/lib/esm/FeatureTable.js.map +1 -1
- package/lib/esm/GenericInstanceFilter.d.ts +151 -0
- package/lib/esm/GenericInstanceFilter.d.ts.map +1 -0
- package/lib/esm/GenericInstanceFilter.js +39 -0
- package/lib/esm/GenericInstanceFilter.js.map +1 -0
- package/lib/esm/MaterialProps.d.ts +27 -5
- package/lib/esm/MaterialProps.d.ts.map +1 -1
- package/lib/esm/MaterialProps.js.map +1 -1
- package/lib/esm/PlanProjectionSettings.d.ts +2 -0
- package/lib/esm/PlanProjectionSettings.d.ts.map +1 -1
- package/lib/esm/PlanProjectionSettings.js +6 -0
- package/lib/esm/PlanProjectionSettings.js.map +1 -1
- package/lib/esm/core-common.d.ts +1 -0
- package/lib/esm/core-common.d.ts.map +1 -1
- package/lib/esm/core-common.js +1 -0
- package/lib/esm/core-common.js.map +1 -1
- package/lib/esm/geometry/ElementGeometry.d.ts +5 -3
- package/lib/esm/geometry/ElementGeometry.d.ts.map +1 -1
- package/lib/esm/geometry/ElementGeometry.js +38 -2
- package/lib/esm/geometry/ElementGeometry.js.map +1 -1
- package/lib/esm/geometry/TextString.d.ts +10 -1
- package/lib/esm/geometry/TextString.d.ts.map +1 -1
- package/lib/esm/geometry/TextString.js.map +1 -1
- package/lib/esm/rpc/core/RpcConstants.d.ts +6 -6
- package/lib/esm/rpc/core/RpcConstants.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcConstants.js +6 -6
- package/lib/esm/rpc/core/RpcConstants.js.map +1 -1
- package/lib/esm/rpc/core/RpcInvocation.js +1 -1
- package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/esm/rpc/web/OpenAPI.d.ts +1 -1
- package/lib/esm/rpc/web/OpenAPI.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcProtocol.d.ts +2 -2
- package/lib/esm/rpc/web/WebAppRpcProtocol.js.map +1 -1
- package/lib/esm/tile/IModelTileIO.d.ts +2 -2
- package/lib/esm/tile/IModelTileIO.js +2 -2
- package/lib/esm/tile/IModelTileIO.js.map +1 -1
- package/package.json +8 -7
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Geometry
|
|
3
3
|
*/
|
|
4
|
-
import { Point3d, Transform, XYZProps, YawPitchRollAngles, YawPitchRollProps } from "@itwin/core-geometry";
|
|
4
|
+
import { Point2d, Point3d, Range2d, Transform, XYZProps, YawPitchRollAngles, YawPitchRollProps } from "@itwin/core-geometry";
|
|
5
5
|
import { FontId } from "../Fonts";
|
|
6
|
+
/**
|
|
7
|
+
* Optional cached text layout information used to support legacy proxy graphics.
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export interface TextStringGlyphData {
|
|
11
|
+
glyphIds: number[];
|
|
12
|
+
glyphOrigins: Point2d[];
|
|
13
|
+
range: Range2d;
|
|
14
|
+
}
|
|
6
15
|
/** Properties for a TextString class.
|
|
7
16
|
* @see [[GeometryStreamEntryProps]]
|
|
8
17
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextString.d.ts","sourceRoot":"","sources":["../../../src/geometry/TextString.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,SAAS,EAAY,QAAQ,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1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;IAC/C,SAAgB,MAAM,EAAE,OAAO,CAAC;IAChC,+CAA+C;IAC/C,SAAgB,QAAQ,EAAE,kBAAkB,CAAC;IAC7C,IAAW,KAAK,WAAwE;gBAErE,KAAK,EAAE,eAAe;IAYlC,MAAM,IAAI,eAAe;IAiBzB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;CAmBvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextString.js","sourceRoot":"","sources":["../../../src/geometry/TextString.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"TextString.js","sourceRoot":"","sources":["../../../src/geometry/TextString.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAW,OAAO,EAAsB,QAAQ,EAAY,kBAAkB,EAAqB,MAAM,sBAAsB,CAAC;AAuCvI;;;;GAIG;AACH,MAAM,OAAO,UAAU;IAmBrB,IAAW,KAAK,KAAK,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAExF,YAAmB,KAAsB;QACvC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,QAAQ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AC,kBAAkB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC/E,IAAI,SAAS,KAAK,WAAW;YAC3B,OAAO,KAAK,CAAC;QACf,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;QACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC;QACvC,IAAI,SAAS,GAAG,OAAO,IAAI,QAAQ,GAAG,OAAO;YAC3C,OAAO,KAAK,CAAC;QACf,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC;QACjF,OAAO,IAAI,CAAC;IACd,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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Geometry\n */\n\nimport { Point2d, Point3d, Range2d, Transform, Vector3d, XYZProps, YawPitchRollAngles, YawPitchRollProps } from \"@itwin/core-geometry\";\nimport { FontId } from \"../Fonts\";\n\n/**\n * Optional cached text layout information used to support legacy proxy graphics.\n * @beta\n */\nexport interface TextStringGlyphData {\n glyphIds: number[];\n glyphOrigins: Point2d[];\n range: Range2d;\n}\n\n/** Properties for a TextString class.\n * @see [[GeometryStreamEntryProps]]\n * @public\n * @extensions\n */\nexport interface TextStringProps {\n /** text string */\n text: string;\n /** FontId for the TextString. FontIds are mapped to font names and types via the FontMap */\n font: FontId;\n /* text height */\n height: number;\n /* width / height ratio. Default is 1.0 */\n widthFactor?: number;\n /** bold text. Default is false */\n bold?: boolean;\n /** italic text. Default is false */\n italic?: boolean;\n /** underline text. Default is false */\n underline?: boolean;\n /** Optional position relative to element's placement. Default is 0,0,0 */\n origin?: XYZProps;\n /** Optional rotation relative to element's placement. Default is identity matrix */\n rotation?: YawPitchRollProps;\n}\n\n/** A single line of text, all with the same font, styles (underline, bold, italic), and size.\n * This class also holds the origin and direction for the text.\n * A paragraph is composed of one or more instances of TextStrings.\n * @public\n */\nexport class TextString {\n /** Text string */\n public text: string;\n /** FontId for this TextString. FontIds are mapped to font names and types via the FontMap */\n public font: FontId;\n /* text height, in meters */\n public height: number;\n /* width / height ratio. Default is 1.0 */\n public widthFactor?: number;\n /** bold text. Default is false */\n public bold?: boolean;\n /** italic text. Default is false */\n public italic?: boolean;\n /** underline text. Default is false */\n public underline?: boolean;\n /** position relative to element's placement */\n public readonly origin: Point3d;\n /** Rotation relative to element's placement */\n public readonly rotation: YawPitchRollAngles;\n public get width() { return this.height * (this.widthFactor ? this.widthFactor : 1.0); }\n\n public constructor(props: TextStringProps) {\n this.text = props.text;\n this.font = props.font;\n this.height = props.height;\n this.widthFactor = props.widthFactor;\n this.bold = props.bold;\n this.italic = props.italic;\n this.underline = props.underline;\n this.origin = Point3d.fromJSON(props.origin);\n this.rotation = YawPitchRollAngles.fromJSON(props.rotation);\n }\n\n public toJSON(): TextStringProps {\n const val: any = {};\n val.text = this.text;\n val.font = this.font;\n val.height = this.height;\n val.widthFactor = this.widthFactor;\n val.bold = this.bold;\n val.italic = this.italic;\n val.underline = this.underline;\n if (!this.origin.isAlmostZero)\n val.origin = this.origin;\n if (!this.rotation.isIdentity())\n val.rotation = this.rotation;\n\n return val;\n }\n\n public transformInPlace(transform: Transform): boolean {\n const newOrigin = transform.multiplyPoint3d(this.origin, this.origin);\n const newTransform = this.rotation.toMatrix3d().multiplyMatrixTransform(transform);\n const scales = new Vector3d();\n if (!newTransform.matrix.normalizeColumnsInPlace(scales))\n return false;\n const newRotation = YawPitchRollAngles.createFromMatrix3d(newTransform.matrix);\n if (undefined === newRotation)\n return false;\n const newHeight = this.height * scales.y;\n const newWidth = this.width * scales.x;\n if (newHeight < 1.0e-10 || newWidth < 1.0e-10)\n return false;\n this.origin.setFrom(newOrigin);\n this.rotation.setFrom(newRotation);\n this.height = newHeight;\n this.widthFactor = (newHeight === newWidth ? undefined : (newWidth / newHeight));\n return true;\n }\n}\n"]}
|
|
@@ -10,7 +10,7 @@ export declare enum RpcResponseCacheControl {
|
|
|
10
10
|
}
|
|
11
11
|
/** RPC protocol event types.
|
|
12
12
|
* @public
|
|
13
|
-
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
13
|
+
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
|
|
14
14
|
*/
|
|
15
15
|
export declare enum RpcProtocolEvent {
|
|
16
16
|
RequestCreated = 0,
|
|
@@ -29,7 +29,7 @@ export declare enum RpcProtocolEvent {
|
|
|
29
29
|
}
|
|
30
30
|
/** The status of an RPC operation request.
|
|
31
31
|
* @public
|
|
32
|
-
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
32
|
+
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
|
|
33
33
|
*/
|
|
34
34
|
export declare enum RpcRequestStatus {
|
|
35
35
|
Unknown = 0,
|
|
@@ -48,13 +48,13 @@ export declare enum RpcRequestStatus {
|
|
|
48
48
|
RequestTimeout = 13,
|
|
49
49
|
TooManyRequests = 14
|
|
50
50
|
}
|
|
51
|
-
/** @public @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
51
|
+
/** @public @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future. */
|
|
52
52
|
export declare namespace RpcRequestStatus {
|
|
53
53
|
function isTransientError(status: RpcRequestStatus): boolean;
|
|
54
54
|
}
|
|
55
55
|
/** RPC request event types.
|
|
56
56
|
* @public
|
|
57
|
-
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
57
|
+
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
|
|
58
58
|
*/
|
|
59
59
|
export declare enum RpcRequestEvent {
|
|
60
60
|
StatusChanged = 0,
|
|
@@ -63,7 +63,7 @@ export declare enum RpcRequestEvent {
|
|
|
63
63
|
}
|
|
64
64
|
/** RPC content types.
|
|
65
65
|
* @public
|
|
66
|
-
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
66
|
+
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
|
|
67
67
|
*/
|
|
68
68
|
export declare enum RpcContentType {
|
|
69
69
|
Unknown = 0,
|
|
@@ -74,7 +74,7 @@ export declare enum RpcContentType {
|
|
|
74
74
|
}
|
|
75
75
|
/** Endpoints for RPC protocols.
|
|
76
76
|
* @public
|
|
77
|
-
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
77
|
+
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
|
|
78
78
|
*/
|
|
79
79
|
export declare enum RpcEndpoint {
|
|
80
80
|
Frontend = 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcConstants.d.ts","sourceRoot":"","sources":["../../../../src/rpc/core/RpcConstants.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH;;GAEG;AACH,oBAAY,uBAAuB;IACjC,IAAI,IAAA;IACJ,SAAS,IAAA;CACV;AAED;;;GAGG;AACH,oBAAY,gBAAgB;IAC1B,cAAc,IAAA;IACd,cAAc,IAAA;IACd,eAAe,IAAA;IACf,uBAAuB,IAAA;IACvB,oBAAoB,IAAA;IACpB,oBAAoB,IAAA;IACpB,iBAAiB,IAAA;IACjB,eAAe,IAAA;IACf,sBAAsB,IAAA;IACtB,sBAAsB,IAAA;IACtB,uBAAuB,KAAA;IACvB,oBAAoB,KAAA;IACpB,wBAAwB,KAAA;CACzB;AAED;;;GAGG;AACH,oBAAY,gBAAgB;IAC1B,OAAO,IAAA;IACP,OAAO,IAAA;IACP,SAAS,IAAA;IACT,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,SAAS,IAAA;IACT,SAAS,IAAA;IACT,UAAU,KAAA;IACV,kBAAkB,KAAA;IAClB,cAAc,KAAA;IACd,cAAc,KAAA;IACd,eAAe,KAAA;CAChB;AAED
|
|
1
|
+
{"version":3,"file":"RpcConstants.d.ts","sourceRoot":"","sources":["../../../../src/rpc/core/RpcConstants.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH;;GAEG;AACH,oBAAY,uBAAuB;IACjC,IAAI,IAAA;IACJ,SAAS,IAAA;CACV;AAED;;;GAGG;AACH,oBAAY,gBAAgB;IAC1B,cAAc,IAAA;IACd,cAAc,IAAA;IACd,eAAe,IAAA;IACf,uBAAuB,IAAA;IACvB,oBAAoB,IAAA;IACpB,oBAAoB,IAAA;IACpB,iBAAiB,IAAA;IACjB,eAAe,IAAA;IACf,sBAAsB,IAAA;IACtB,sBAAsB,IAAA;IACtB,uBAAuB,KAAA;IACvB,oBAAoB,KAAA;IACpB,wBAAwB,KAAA;CACzB;AAED;;;GAGG;AACH,oBAAY,gBAAgB;IAC1B,OAAO,IAAA;IACP,OAAO,IAAA;IACP,SAAS,IAAA;IACT,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,SAAS,IAAA;IACT,SAAS,IAAA;IACT,UAAU,KAAA;IACV,kBAAkB,KAAA;IAClB,cAAc,KAAA;IACd,cAAc,KAAA;IACd,eAAe,KAAA;CAChB;AAED,+GAA+G;AAC/G,yBAAiB,gBAAgB,CAAC;IAChC,SAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,WAGxD;CACF;AAED;;;GAGG;AACH,oBAAY,eAAe;IACzB,aAAa,IAAA;IACb,qBAAqB,IAAA;IACrB,sBAAsB,IAAA;CACvB;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,MAAM,IAAA;IACN,SAAS,IAAA;IACT,MAAM,IAAA;CACP;AAED;;;GAGG;AACH,oBAAY,WAAW;IACrB,QAAQ,IAAA;IACR,OAAO,IAAA;CACR;AAID,gBAAgB;AAChB,eAAO,MAAM,iBAAiB;;;;;;CAM7B,CAAC"}
|
|
@@ -16,7 +16,7 @@ export var RpcResponseCacheControl;
|
|
|
16
16
|
})(RpcResponseCacheControl || (RpcResponseCacheControl = {}));
|
|
17
17
|
/** RPC protocol event types.
|
|
18
18
|
* @public
|
|
19
|
-
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
19
|
+
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
|
|
20
20
|
*/
|
|
21
21
|
export var RpcProtocolEvent;
|
|
22
22
|
(function (RpcProtocolEvent) {
|
|
@@ -36,7 +36,7 @@ export var RpcProtocolEvent;
|
|
|
36
36
|
})(RpcProtocolEvent || (RpcProtocolEvent = {}));
|
|
37
37
|
/** The status of an RPC operation request.
|
|
38
38
|
* @public
|
|
39
|
-
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
39
|
+
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
|
|
40
40
|
*/
|
|
41
41
|
export var RpcRequestStatus;
|
|
42
42
|
(function (RpcRequestStatus) {
|
|
@@ -56,7 +56,7 @@ export var RpcRequestStatus;
|
|
|
56
56
|
RpcRequestStatus[RpcRequestStatus["RequestTimeout"] = 13] = "RequestTimeout";
|
|
57
57
|
RpcRequestStatus[RpcRequestStatus["TooManyRequests"] = 14] = "TooManyRequests";
|
|
58
58
|
})(RpcRequestStatus || (RpcRequestStatus = {}));
|
|
59
|
-
/** @public @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
59
|
+
/** @public @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future. */
|
|
60
60
|
(function (RpcRequestStatus) {
|
|
61
61
|
function isTransientError(status) {
|
|
62
62
|
return status === RpcRequestStatus.BadGateway || status === RpcRequestStatus.ServiceUnavailable || status === RpcRequestStatus.GatewayTimeout
|
|
@@ -66,7 +66,7 @@ export var RpcRequestStatus;
|
|
|
66
66
|
})(RpcRequestStatus || (RpcRequestStatus = {}));
|
|
67
67
|
/** RPC request event types.
|
|
68
68
|
* @public
|
|
69
|
-
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
69
|
+
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
|
|
70
70
|
*/
|
|
71
71
|
export var RpcRequestEvent;
|
|
72
72
|
(function (RpcRequestEvent) {
|
|
@@ -76,7 +76,7 @@ export var RpcRequestEvent;
|
|
|
76
76
|
})(RpcRequestEvent || (RpcRequestEvent = {}));
|
|
77
77
|
/** RPC content types.
|
|
78
78
|
* @public
|
|
79
|
-
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
79
|
+
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
|
|
80
80
|
*/
|
|
81
81
|
export var RpcContentType;
|
|
82
82
|
(function (RpcContentType) {
|
|
@@ -88,7 +88,7 @@ export var RpcContentType;
|
|
|
88
88
|
})(RpcContentType || (RpcContentType = {}));
|
|
89
89
|
/** Endpoints for RPC protocols.
|
|
90
90
|
* @public
|
|
91
|
-
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
91
|
+
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
|
|
92
92
|
*/
|
|
93
93
|
export var RpcEndpoint;
|
|
94
94
|
(function (RpcEndpoint) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcConstants.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcConstants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,4CAA4C;AAE5C;;GA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xB,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,yDAAO,CAAA;IACP,mDAAI,CAAA;IACJ,uDAAM,CAAA;IACN,6DAAS,CAAA;IACT,uDAAM,CAAA;AACR,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,qDAAQ,CAAA;IACR,mDAAO,CAAA;AACT,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAED,yDAAyD;AAEzD,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,OAAO,EAAE,cAAc;IACvB,IAAI,EAAE,YAAY;IAClB,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,0BAA0B;IAClC,SAAS,EAAE,qBAAqB;CACjC,CAAC","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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\n/* eslint-disable deprecation/deprecation */\n\n/** Describes available options for RPC response caching.\n * @public\n */\nexport enum RpcResponseCacheControl {\n None,\n Immutable,\n}\n\n/** RPC protocol event types.\n * @public\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\n */\nexport enum RpcProtocolEvent {\n RequestCreated,\n ResponseLoaded,\n ResponseLoading,\n ConnectionErrorReceived,\n UnknownErrorReceived,\n BackendErrorReceived,\n ConnectionAborted,\n RequestReceived,\n BackendResponseCreated,\n BackendReportedPending,\n BackendReportedNotFound,\n BackendErrorOccurred,\n BackendReportedNoContent,\n}\n\n/** The status of an RPC operation request.\n * @public\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\n */\nexport enum RpcRequestStatus {\n Unknown,\n Created,\n Submitted,\n Pending,\n Resolved,\n Rejected,\n Disposed,\n NotFound,\n Cancelled,\n NoContent,\n BadGateway,\n ServiceUnavailable,\n GatewayTimeout,\n RequestTimeout,\n TooManyRequests\n}\n\n/** @public @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future. */\nexport namespace RpcRequestStatus { // eslint-disable-line @typescript-eslint/no-redeclare\n export function isTransientError(status: RpcRequestStatus) {\n return status === RpcRequestStatus.BadGateway || status === RpcRequestStatus.ServiceUnavailable || status === RpcRequestStatus.GatewayTimeout\n || status === RpcRequestStatus.RequestTimeout || status === RpcRequestStatus.TooManyRequests;\n }\n}\n\n/** RPC request event types.\n * @public\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\n */\nexport enum RpcRequestEvent {\n StatusChanged,\n PendingUpdateReceived,\n TransientErrorReceived\n}\n\n/** RPC content types.\n * @public\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\n */\nexport enum RpcContentType {\n Unknown,\n Text,\n Binary,\n Multipart,\n Stream,\n}\n\n/** Endpoints for RPC protocols.\n * @public\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\n */\nexport enum RpcEndpoint {\n Frontend,\n Backend,\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/** @internal */\nexport const WEB_RPC_CONSTANTS = {\n CONTENT: \"Content-Type\",\n TEXT: \"text/plain\",\n ANY_TEXT: \"text/\",\n BINARY: \"application/octet-stream\",\n MULTIPART: \"multipart/form-data\",\n};\n"]}
|
|
@@ -111,7 +111,7 @@ class RpcInvocation {
|
|
|
111
111
|
// this catch block is intentionally placed inside `runActivity` to attach the right logging metadata and use the correct openTelemetry span.
|
|
112
112
|
if (!(error instanceof RpcPendingResponse)) {
|
|
113
113
|
Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, "Error in RPC operation", { error: BentleyError.getErrorProps(error) });
|
|
114
|
-
Tracing.
|
|
114
|
+
Tracing.recordException(error);
|
|
115
115
|
}
|
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AI,SAAS,YAAY,YAAY,EAAE;YACrC,WAAW,CAAC,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;SACzD;IACH,CAAC;;;AA5Qa,yBAAW,GAAmB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,AAAhD,CAAiD;SAD/D,aAAa","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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { AccessToken, BentleyError, BentleyStatus, GuidString, IModelStatus, Logger, RpcInterfaceStatus, StatusCategory, Tracing } from \"@itwin/core-bentley\";\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\nimport { IModelRpcProps } from \"../../IModel\";\nimport { IModelError } from \"../../IModelError\";\nimport { RpcInterface } from \"../../RpcInterface\";\nimport { SessionProps } from \"../../SessionProps\";\nimport { RpcConfiguration } from \"./RpcConfiguration\";\nimport { RpcProtocolEvent, RpcRequestStatus } from \"./RpcConstants\";\nimport { RpcControlChannel, RpcNotFoundResponse, RpcPendingResponse } from \"./RpcControl\";\nimport { RpcMarshaling, RpcSerializedValue } from \"./RpcMarshaling\";\nimport { RpcOperation } from \"./RpcOperation\";\nimport { RpcManagedStatus, RpcProtocol, RpcProtocolVersion, RpcRequestFulfillment, SerializedRpcRequest } from \"./RpcProtocol\";\nimport { CURRENT_INVOCATION, RpcRegistry } from \"./RpcRegistry\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** The properties of an RpcActivity.\n * @public\n * @extensions\n */\nexport interface RpcActivity extends SessionProps {\n /** Used for logging to correlate an Rpc activity between frontend and backend */\n readonly activityId: GuidString;\n\n /** access token for authorization */\n readonly accessToken: AccessToken;\n\n /** the name of the current rpc method */\n readonly rpcMethod?: string;\n\n readonly user?: string;\n}\n\n/** Serialized format for sending the request across the RPC layer\n * @public\n */\nexport interface SerializedRpcActivity {\n id: string;\n applicationId: string;\n applicationVersion: string;\n sessionId: string;\n authorization: string;\n user?: string;\n csrfToken?: { headerName: string, headerValue: string };\n}\n\n/** @internal */\nexport type RpcActivityRun = (activity: RpcActivity, fn: () => Promise<any>) => Promise<any>;\n\n/** An RPC operation invocation in response to a request.\n * @internal\n */\nexport class RpcInvocation {\n public static runActivity: RpcActivityRun = async (_activity, fn) => fn();\n private _threw: boolean = false;\n private _pending: boolean = false;\n private _notFound: boolean = false;\n private _noContent: boolean = false;\n private _timeIn: number = 0;\n private _timeOut: number = 0;\n\n /** The protocol for this invocation. */\n public readonly protocol: RpcProtocol;\n\n /** The received request. */\n public readonly request: SerializedRpcRequest;\n\n /** The operation of the request. */\n public readonly operation: RpcOperation = undefined as any;\n\n /** The implementation response. */\n public readonly result: Promise<any>;\n\n /** The fulfillment for this request. */\n public readonly fulfillment: Promise<RpcRequestFulfillment>;\n\n /** The status for this request. */\n public get status(): RpcRequestStatus {\n return this._threw ? RpcRequestStatus.Rejected :\n this._pending ? RpcRequestStatus.Pending :\n this._notFound ? RpcRequestStatus.NotFound :\n this._noContent ? RpcRequestStatus.NoContent :\n RpcRequestStatus.Resolved;\n }\n\n /** The elapsed time for this invocation. */\n public get elapsed(): number {\n return this._timeOut - this._timeIn;\n }\n\n /**\n * The invocation for the current RPC operation.\n * @note The return value of this function is only reliable in an RPC impl class member function where program control was received from the RpcInvocation constructor function.\n */\n public static current(rpcImpl: RpcInterface): RpcInvocation {\n return (rpcImpl as any)[CURRENT_INVOCATION];\n }\n\n /** Constructs an invocation. */\n public constructor(protocol: RpcProtocol, request: SerializedRpcRequest) {\n this._timeIn = new Date().getTime();\n this.protocol = protocol;\n this.request = request;\n\n try {\n try {\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\n\n const backend = this.operation.interfaceVersion;\n const frontend = this.request.operation.interfaceVersion;\n if (!RpcInterface.isVersionCompatible(backend, frontend)) {\n throw new IModelError(RpcInterfaceStatus.IncompatibleVersion, `Backend version ${backend} does not match frontend version ${frontend} for RPC interface ${this.operation.operationName}.`);\n }\n } catch (error) {\n if (this.handleUnknownOperation(error)) {\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\n } else {\n throw error;\n }\n }\n\n this.result = this.resolve();\n } catch (error) {\n this.result = this.reject(error);\n }\n\n this.fulfillment = this.result.then(async (value) => this._threw ? this.fulfillRejected(value) : this.fulfillResolved(value), async (reason) => this.fulfillRejected(reason));\n }\n\n private handleUnknownOperation(error: any): boolean {\n RpcControlChannel.ensureInitialized();\n return this.protocol.configuration.controlChannel.handleUnknownOperation(this, error);\n }\n\n public static sanitizeForLog(activity?: RpcActivity) {\n /* eslint-disable @typescript-eslint/naming-convention */\n return activity ? {\n ActivityId: activity.activityId, SessionId: activity.sessionId, ApplicationId: activity.applicationId, ApplicationVersion: activity.applicationVersion, rpcMethod: activity.rpcMethod,\n } : undefined;\n /* eslint-enable @typescript-eslint/naming-convention */\n }\n\n private async resolve(): Promise<any> {\n const request = this.request;\n const activity: RpcActivity = {\n activityId: request.id,\n applicationId: request.applicationId,\n applicationVersion: request.applicationVersion,\n sessionId: request.sessionId,\n user: request.user,\n accessToken: request.authorization,\n rpcMethod: request.operation.operationName,\n };\n\n try {\n this.protocol.events.raiseEvent(RpcProtocolEvent.RequestReceived, this);\n\n const parameters = request.parametersOverride || RpcMarshaling.deserialize(this.protocol, request.parameters);\n this.applyPolicies(parameters);\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition);\n (impl as any)[CURRENT_INVOCATION] = this;\n const op = this.lookupOperationFunction(impl);\n\n return await RpcInvocation.runActivity(activity, async () => op.call(impl, ...parameters)\n .catch(async (error) => {\n // this catch block is intentionally placed inside `runActivity` to attach the right logging metadata and use the correct openTelemetry span.\n if (!(error instanceof RpcPendingResponse)) {\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, \"Error in RPC operation\", { error: BentleyError.getErrorProps(error) });\n Tracing.setAttributes({ error: true });\n }\n throw error;\n }));\n } catch (error: unknown) {\n return this.reject(error);\n }\n }\n\n private applyPolicies(parameters: any) {\n if (!parameters || !Array.isArray(parameters))\n return;\n\n for (let i = 0; i !== parameters.length; ++i) {\n const parameter = parameters[i];\n const isToken = typeof (parameter) === \"object\" && parameter !== null && parameter.hasOwnProperty(\"iModelId\") && parameter.hasOwnProperty(\"iTwinId\");\n if (isToken && this.protocol.checkToken && !this.operation.policy.allowTokenMismatch) {\n const inflated = this.protocol.inflateToken(parameter, this.request);\n parameters[i] = inflated;\n\n if (!RpcInvocation.compareTokens(parameter, inflated)) {\n if (RpcConfiguration.throwOnTokenMismatch) {\n throw new IModelError(BentleyStatus.ERROR, \"IModelRpcProps mismatch detected for this request.\");\n } else {\n Logger.logWarning(CommonLoggerCategory.RpcInterfaceBackend, \"IModelRpcProps mismatch detected for this request.\");\n }\n }\n }\n }\n }\n\n private static compareTokens(a: IModelRpcProps, b: IModelRpcProps): boolean {\n return a.key === b.key &&\n a.iTwinId === b.iTwinId &&\n a.iModelId === b.iModelId &&\n (undefined === a.changeset || (a.changeset.id === b.changeset?.id));\n }\n\n private async reject(error: any): Promise<any> {\n this._threw = true;\n return error;\n }\n\n private async fulfillResolved(value: any): Promise<RpcRequestFulfillment> {\n this._timeOut = new Date().getTime();\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendResponseCreated, this);\n const result = RpcMarshaling.serialize(this.protocol, value);\n return this.fulfill(result, value);\n }\n\n private async fulfillRejected(reason: any): Promise<RpcRequestFulfillment> {\n this._timeOut = new Date().getTime();\n if (!RpcConfiguration.developmentMode)\n reason.stack = undefined;\n\n const result = RpcMarshaling.serialize(this.protocol, reason);\n\n if (reason instanceof RpcPendingResponse) {\n this._pending = true;\n this._threw = false;\n result.objects = reason.message;\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedPending, this);\n } else if (this.supportsNoContent() && reason?.errorNumber === IModelStatus.NoContent) {\n this._noContent = true;\n this._threw = false;\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNoContent, this);\n } else if (reason instanceof RpcNotFoundResponse) {\n this._notFound = true;\n this._threw = false;\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNotFound, this);\n } else {\n this._threw = true;\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendErrorOccurred, this);\n }\n\n return this.fulfill(result, reason);\n }\n\n private supportsNoContent() {\n if (!this.request.protocolVersion) {\n return false;\n }\n\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedNoContent && this.request.protocolVersion >= RpcProtocolVersion.IntroducedNoContent;\n }\n\n private supportsStatusCategory() {\n if (!this.request.protocolVersion) {\n return false;\n }\n\n if (!this.protocol.supportsStatusCategory) {\n return false;\n }\n\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory && this.request.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory;\n }\n\n private fulfill(result: RpcSerializedValue, rawResult: any): RpcRequestFulfillment {\n const fulfillment: RpcRequestFulfillment = {\n result,\n rawResult,\n status: this.protocol.getCode(this.status),\n id: this.request.id,\n interfaceName: (typeof (this.operation) === \"undefined\") ? \"\" : this.operation.interfaceDefinition.interfaceName,\n allowCompression: this.operation?.policy.allowResponseCompression || false,\n };\n\n this.transformResponseStatus(fulfillment, rawResult);\n\n try {\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition) as any;\n if (impl[CURRENT_INVOCATION] === this) {\n impl[CURRENT_INVOCATION] = undefined;\n }\n } catch (_err) { }\n\n return fulfillment;\n }\n\n private lookupOperationFunction(implementation: RpcInterface): (...args: any[]) => Promise<any> {\n const func = (implementation as any)[this.operation.operationName];\n if (!func || typeof (func) !== \"function\")\n throw new IModelError(BentleyStatus.ERROR, `RPC interface class \"${implementation.constructor.name}\" does not implement operation \"${this.operation.operationName}\".`);\n\n return func;\n }\n\n private transformResponseStatus(fulfillment: RpcRequestFulfillment, rawResult: any) {\n if (!this.supportsStatusCategory()) {\n return;\n }\n\n let managedStatus: \"notFound\" | \"pending\" | \"noContent\" | undefined;\n if (this._pending) {\n managedStatus = \"pending\";\n } else if (this._notFound) {\n managedStatus = \"notFound\";\n } else if (this._noContent) {\n managedStatus = \"noContent\";\n }\n\n if (managedStatus) {\n const responseValue = fulfillment.result.objects;\n const status: RpcManagedStatus = { iTwinRpcCoreResponse: true, managedStatus, responseValue };\n fulfillment.result.objects = JSON.stringify(status);\n status.responseValue = rawResult; // for ipc case\n fulfillment.rawResult = status;\n }\n\n if (rawResult instanceof BentleyError) {\n fulfillment.status = StatusCategory.for(rawResult).code;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RpcInvocation.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcInvocation.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;;AAEH,OAAO,EAAe,YAAY,EAAE,aAAa,EAAc,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9J,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAsB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAoB,WAAW,EAAE,kBAAkB,EAA+C,MAAM,eAAe,CAAC;AAC/H,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AC7B;QAED,IAAI,aAAa,EAAE;YACjB,MAAM,aAAa,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC;YACjD,MAAM,MAAM,GAAqB,EAAE,oBAAoB,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;YAC9F,WAAW,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACpD,MAAM,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC,eAAe;YACjD,WAAW,CAAC,SAAS,GAAG,MAAM,CAAC;SAChC;QAED,IAAI,SAAS,YAAY,YAAY,EAAE;YACrC,WAAW,CAAC,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;SACzD;IACH,CAAC;;;AA5Qa,yBAAW,GAAmB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,AAAhD,CAAiD;SAD/D,aAAa","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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { AccessToken, BentleyError, BentleyStatus, GuidString, IModelStatus, Logger, RpcInterfaceStatus, StatusCategory, Tracing } from \"@itwin/core-bentley\";\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\nimport { IModelRpcProps } from \"../../IModel\";\nimport { IModelError } from \"../../IModelError\";\nimport { RpcInterface } from \"../../RpcInterface\";\nimport { SessionProps } from \"../../SessionProps\";\nimport { RpcConfiguration } from \"./RpcConfiguration\";\nimport { RpcProtocolEvent, RpcRequestStatus } from \"./RpcConstants\";\nimport { RpcControlChannel, RpcNotFoundResponse, RpcPendingResponse } from \"./RpcControl\";\nimport { RpcMarshaling, RpcSerializedValue } from \"./RpcMarshaling\";\nimport { RpcOperation } from \"./RpcOperation\";\nimport { RpcManagedStatus, RpcProtocol, RpcProtocolVersion, RpcRequestFulfillment, SerializedRpcRequest } from \"./RpcProtocol\";\nimport { CURRENT_INVOCATION, RpcRegistry } from \"./RpcRegistry\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** The properties of an RpcActivity.\n * @public\n * @extensions\n */\nexport interface RpcActivity extends SessionProps {\n /** Used for logging to correlate an Rpc activity between frontend and backend */\n readonly activityId: GuidString;\n\n /** access token for authorization */\n readonly accessToken: AccessToken;\n\n /** the name of the current rpc method */\n readonly rpcMethod?: string;\n\n readonly user?: string;\n}\n\n/** Serialized format for sending the request across the RPC layer\n * @public\n */\nexport interface SerializedRpcActivity {\n id: string;\n applicationId: string;\n applicationVersion: string;\n sessionId: string;\n authorization: string;\n user?: string;\n csrfToken?: { headerName: string, headerValue: string };\n}\n\n/** @internal */\nexport type RpcActivityRun = (activity: RpcActivity, fn: () => Promise<any>) => Promise<any>;\n\n/** An RPC operation invocation in response to a request.\n * @internal\n */\nexport class RpcInvocation {\n public static runActivity: RpcActivityRun = async (_activity, fn) => fn();\n private _threw: boolean = false;\n private _pending: boolean = false;\n private _notFound: boolean = false;\n private _noContent: boolean = false;\n private _timeIn: number = 0;\n private _timeOut: number = 0;\n\n /** The protocol for this invocation. */\n public readonly protocol: RpcProtocol;\n\n /** The received request. */\n public readonly request: SerializedRpcRequest;\n\n /** The operation of the request. */\n public readonly operation: RpcOperation = undefined as any;\n\n /** The implementation response. */\n public readonly result: Promise<any>;\n\n /** The fulfillment for this request. */\n public readonly fulfillment: Promise<RpcRequestFulfillment>;\n\n /** The status for this request. */\n public get status(): RpcRequestStatus {\n return this._threw ? RpcRequestStatus.Rejected :\n this._pending ? RpcRequestStatus.Pending :\n this._notFound ? RpcRequestStatus.NotFound :\n this._noContent ? RpcRequestStatus.NoContent :\n RpcRequestStatus.Resolved;\n }\n\n /** The elapsed time for this invocation. */\n public get elapsed(): number {\n return this._timeOut - this._timeIn;\n }\n\n /**\n * The invocation for the current RPC operation.\n * @note The return value of this function is only reliable in an RPC impl class member function where program control was received from the RpcInvocation constructor function.\n */\n public static current(rpcImpl: RpcInterface): RpcInvocation {\n return (rpcImpl as any)[CURRENT_INVOCATION];\n }\n\n /** Constructs an invocation. */\n public constructor(protocol: RpcProtocol, request: SerializedRpcRequest) {\n this._timeIn = new Date().getTime();\n this.protocol = protocol;\n this.request = request;\n\n try {\n try {\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\n\n const backend = this.operation.interfaceVersion;\n const frontend = this.request.operation.interfaceVersion;\n if (!RpcInterface.isVersionCompatible(backend, frontend)) {\n throw new IModelError(RpcInterfaceStatus.IncompatibleVersion, `Backend version ${backend} does not match frontend version ${frontend} for RPC interface ${this.operation.operationName}.`);\n }\n } catch (error) {\n if (this.handleUnknownOperation(error)) {\n this.operation = RpcOperation.lookup(this.request.operation.interfaceDefinition, this.request.operation.operationName);\n } else {\n throw error;\n }\n }\n\n this.result = this.resolve();\n } catch (error) {\n this.result = this.reject(error);\n }\n\n this.fulfillment = this.result.then(async (value) => this._threw ? this.fulfillRejected(value) : this.fulfillResolved(value), async (reason) => this.fulfillRejected(reason));\n }\n\n private handleUnknownOperation(error: any): boolean {\n RpcControlChannel.ensureInitialized();\n return this.protocol.configuration.controlChannel.handleUnknownOperation(this, error);\n }\n\n public static sanitizeForLog(activity?: RpcActivity) {\n /* eslint-disable @typescript-eslint/naming-convention */\n return activity ? {\n ActivityId: activity.activityId, SessionId: activity.sessionId, ApplicationId: activity.applicationId, ApplicationVersion: activity.applicationVersion, rpcMethod: activity.rpcMethod,\n } : undefined;\n /* eslint-enable @typescript-eslint/naming-convention */\n }\n\n private async resolve(): Promise<any> {\n const request = this.request;\n const activity: RpcActivity = {\n activityId: request.id,\n applicationId: request.applicationId,\n applicationVersion: request.applicationVersion,\n sessionId: request.sessionId,\n user: request.user,\n accessToken: request.authorization,\n rpcMethod: request.operation.operationName,\n };\n\n try {\n this.protocol.events.raiseEvent(RpcProtocolEvent.RequestReceived, this);\n\n const parameters = request.parametersOverride || RpcMarshaling.deserialize(this.protocol, request.parameters);\n this.applyPolicies(parameters);\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition);\n (impl as any)[CURRENT_INVOCATION] = this;\n const op = this.lookupOperationFunction(impl);\n\n return await RpcInvocation.runActivity(activity, async () => op.call(impl, ...parameters)\n .catch(async (error) => {\n // this catch block is intentionally placed inside `runActivity` to attach the right logging metadata and use the correct openTelemetry span.\n if (!(error instanceof RpcPendingResponse)) {\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, \"Error in RPC operation\", { error: BentleyError.getErrorProps(error) });\n Tracing.recordException(error);\n }\n throw error;\n }));\n } catch (error: unknown) {\n return this.reject(error);\n }\n }\n\n private applyPolicies(parameters: any) {\n if (!parameters || !Array.isArray(parameters))\n return;\n\n for (let i = 0; i !== parameters.length; ++i) {\n const parameter = parameters[i];\n const isToken = typeof (parameter) === \"object\" && parameter !== null && parameter.hasOwnProperty(\"iModelId\") && parameter.hasOwnProperty(\"iTwinId\");\n if (isToken && this.protocol.checkToken && !this.operation.policy.allowTokenMismatch) {\n const inflated = this.protocol.inflateToken(parameter, this.request);\n parameters[i] = inflated;\n\n if (!RpcInvocation.compareTokens(parameter, inflated)) {\n if (RpcConfiguration.throwOnTokenMismatch) {\n throw new IModelError(BentleyStatus.ERROR, \"IModelRpcProps mismatch detected for this request.\");\n } else {\n Logger.logWarning(CommonLoggerCategory.RpcInterfaceBackend, \"IModelRpcProps mismatch detected for this request.\");\n }\n }\n }\n }\n }\n\n private static compareTokens(a: IModelRpcProps, b: IModelRpcProps): boolean {\n return a.key === b.key &&\n a.iTwinId === b.iTwinId &&\n a.iModelId === b.iModelId &&\n (undefined === a.changeset || (a.changeset.id === b.changeset?.id));\n }\n\n private async reject(error: any): Promise<any> {\n this._threw = true;\n return error;\n }\n\n private async fulfillResolved(value: any): Promise<RpcRequestFulfillment> {\n this._timeOut = new Date().getTime();\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendResponseCreated, this);\n const result = RpcMarshaling.serialize(this.protocol, value);\n return this.fulfill(result, value);\n }\n\n private async fulfillRejected(reason: any): Promise<RpcRequestFulfillment> {\n this._timeOut = new Date().getTime();\n if (!RpcConfiguration.developmentMode)\n reason.stack = undefined;\n\n const result = RpcMarshaling.serialize(this.protocol, reason);\n\n if (reason instanceof RpcPendingResponse) {\n this._pending = true;\n this._threw = false;\n result.objects = reason.message;\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedPending, this);\n } else if (this.supportsNoContent() && reason?.errorNumber === IModelStatus.NoContent) {\n this._noContent = true;\n this._threw = false;\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNoContent, this);\n } else if (reason instanceof RpcNotFoundResponse) {\n this._notFound = true;\n this._threw = false;\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNotFound, this);\n } else {\n this._threw = true;\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendErrorOccurred, this);\n }\n\n return this.fulfill(result, reason);\n }\n\n private supportsNoContent() {\n if (!this.request.protocolVersion) {\n return false;\n }\n\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedNoContent && this.request.protocolVersion >= RpcProtocolVersion.IntroducedNoContent;\n }\n\n private supportsStatusCategory() {\n if (!this.request.protocolVersion) {\n return false;\n }\n\n if (!this.protocol.supportsStatusCategory) {\n return false;\n }\n\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory && this.request.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory;\n }\n\n private fulfill(result: RpcSerializedValue, rawResult: any): RpcRequestFulfillment {\n const fulfillment: RpcRequestFulfillment = {\n result,\n rawResult,\n status: this.protocol.getCode(this.status),\n id: this.request.id,\n interfaceName: (typeof (this.operation) === \"undefined\") ? \"\" : this.operation.interfaceDefinition.interfaceName,\n allowCompression: this.operation?.policy.allowResponseCompression || false,\n };\n\n this.transformResponseStatus(fulfillment, rawResult);\n\n try {\n const impl = RpcRegistry.instance.getImplForInterface(this.operation.interfaceDefinition) as any;\n if (impl[CURRENT_INVOCATION] === this) {\n impl[CURRENT_INVOCATION] = undefined;\n }\n } catch (_err) { }\n\n return fulfillment;\n }\n\n private lookupOperationFunction(implementation: RpcInterface): (...args: any[]) => Promise<any> {\n const func = (implementation as any)[this.operation.operationName];\n if (!func || typeof (func) !== \"function\")\n throw new IModelError(BentleyStatus.ERROR, `RPC interface class \"${implementation.constructor.name}\" does not implement operation \"${this.operation.operationName}\".`);\n\n return func;\n }\n\n private transformResponseStatus(fulfillment: RpcRequestFulfillment, rawResult: any) {\n if (!this.supportsStatusCategory()) {\n return;\n }\n\n let managedStatus: \"notFound\" | \"pending\" | \"noContent\" | undefined;\n if (this._pending) {\n managedStatus = \"pending\";\n } else if (this._notFound) {\n managedStatus = \"notFound\";\n } else if (this._noContent) {\n managedStatus = \"noContent\";\n }\n\n if (managedStatus) {\n const responseValue = fulfillment.result.objects;\n const status: RpcManagedStatus = { iTwinRpcCoreResponse: true, managedStatus, responseValue };\n fulfillment.result.objects = JSON.stringify(status);\n status.responseValue = rawResult; // for ipc case\n fulfillment.rawResult = status;\n }\n\n if (rawResult instanceof BentleyError) {\n fulfillment.status = StatusCategory.for(rawResult).code;\n }\n }\n}\n"]}
|
|
@@ -12,7 +12,7 @@ export interface OpenAPIDocument {
|
|
|
12
12
|
}
|
|
13
13
|
/** An OpenAPI 3.0 info object.
|
|
14
14
|
* @public
|
|
15
|
-
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
15
|
+
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
|
|
16
16
|
*/
|
|
17
17
|
export interface OpenAPIInfo {
|
|
18
18
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAPI.js","sourceRoot":"","sources":["../../../../src/rpc/web/OpenAPI.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;G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AAW,CAAC,IAAI,GAAG;YACjB,WAAW,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE;YACxD,SAAS,EAAE;gBACT,GAAG,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE;gBACzD,OAAO,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE;aAC5D;SACF,CAAC;QAEF,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,gCAAgC,CAAC,SAAS,CAAC,CAAC;QAC7E,IAAI,UAAU,CAAC,MAAM;YACnB,WAAW,CAAC,UAAU,GAAG,UAAU,CAAC;QAEtC,OAAO,WAAW,CAAC;IACrB,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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { RpcOperation } from \"../core/RpcOperation\";\nimport { WebAppRpcProtocol } from \"./WebAppRpcProtocol\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** An OpenAPI 3.0 root document object.\n * @internal\n */\nexport interface OpenAPIDocument {\n openapi: \"3.0.0\";\n info: OpenAPIInfo;\n paths: OpenAPIPaths;\n}\n\n/** An OpenAPI 3.0 info object.\n * @public\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
1
|
+
{"version":3,"file":"OpenAPI.js","sourceRoot":"","sources":["../../../../src/rpc/web/OpenAPI.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAwIpD;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAIhC,iDAAiD;IACjD,IAAW,KAAK;QACd,MAAM,KAAK,GAAiB,EAAE,CAAC;QAE/B,IAAI,CAAC,QAAQ,C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OAAO,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE;aAC5D;SACF,CAAC;QAEF,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,gCAAgC,CAAC,SAAS,CAAC,CAAC;QAC7E,IAAI,UAAU,CAAC,MAAM;YACnB,WAAW,CAAC,UAAU,GAAG,UAAU,CAAC;QAEtC,OAAO,WAAW,CAAC;IACrB,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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { RpcOperation } from \"../core/RpcOperation\";\nimport { WebAppRpcProtocol } from \"./WebAppRpcProtocol\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** An OpenAPI 3.0 root document object.\n * @internal\n */\nexport interface OpenAPIDocument {\n openapi: \"3.0.0\";\n info: OpenAPIInfo;\n paths: OpenAPIPaths;\n}\n\n/** An OpenAPI 3.0 info object.\n * @public\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\n */\nexport interface OpenAPIInfo {\n title: string;\n version: string;\n}\n\n/** An OpenAPI 3.0 paths object.\n * @internal\n */\nexport interface OpenAPIPaths {\n [index: string]: OpenAPIPathItem;\n}\n\n/** An OpenAPI 3.0 path item object.\n * @internal\n */\nexport interface OpenAPIPathItem {\n summary?: string;\n get?: OpenAPIOperation;\n put?: OpenAPIOperation;\n post?: OpenAPIOperation;\n delete?: OpenAPIOperation;\n options?: OpenAPIOperation;\n head?: OpenAPIOperation;\n patch?: OpenAPIOperation;\n trace?: OpenAPIOperation;\n parameters?: OpenAPIParameter[];\n}\n\n/** An OpenAPI 3.0 operation object.\n * @internal\n */\nexport interface OpenAPIOperation {\n summary?: string;\n operationId?: string;\n parameters?: OpenAPIParameter[];\n requestBody?: OpenAPIRequestBody;\n responses: OpenAPIResponses;\n}\n\n/** An OpenAPI 3.0 content map.\n * @internal\n */\nexport interface OpenAPIContentMap {\n [index: string]: OpenAPIMediaType;\n}\n\n/** An OpenAPI 3.0 parameter object.\n * @internal\n */\nexport interface OpenAPIParameter {\n name: string;\n in: \"query\" | \"header\" | \"path\" | \"cookie\";\n description?: string;\n required?: boolean;\n allowEmptyValue?: boolean;\n style?: \"matrix\" | \"label\" | \"form\" | \"simple\" | \"spaceDelimited\" | \"pipeDelimited\" | \"deepObject\";\n explode?: boolean;\n allowReserved?: boolean;\n schema?: OpenAPISchema;\n content?: OpenAPIContentMap;\n}\n\n/** An OpenAPI 3.0 media type object.\n * @internal\n */\nexport interface OpenAPIMediaType {\n schema?: OpenAPISchema;\n}\n\n/** An OpenAPI 3.0 schema object.\n * @internal\n */\nexport interface OpenAPISchema {\n type?: \"boolean\" | \"object\" | \"array\" | \"number\" | \"string\";\n nullable?: boolean;\n description?: string;\n}\n\n/** An OpenAPI 3.0 encoding object.\n * @internal\n */\nexport interface OpenAPIEncoding {\n contentType?: string;\n style?: string;\n explode?: boolean;\n allowReserved?: boolean;\n}\n\n/** An OpenAPI 3.0 parameter object.\n * @internal\n */\nexport interface OpenAPIRequestBody {\n description?: string;\n content: OpenAPIContentMap;\n required?: boolean;\n}\n\n/** An OpenAPI 3.0 responses object.\n * @internal\n */\nexport interface OpenAPIResponses {\n default?: OpenAPIResponse;\n \"200\"?: OpenAPIResponse;\n \"301\"?: OpenAPIResponse;\n \"302\"?: OpenAPIResponse;\n \"400\"?: OpenAPIResponse;\n \"404\"?: OpenAPIResponse;\n \"500\"?: OpenAPIResponse;\n}\n\n/** An OpenAPI 3.0 response object.\n * @internal\n */\nexport interface OpenAPIResponse {\n description: string;\n content?: { [index: string]: OpenAPIMediaType };\n}\n\n/** An OpenAPI-compatible description of an RPC protocol.\n * @internal\n */\nexport class RpcOpenAPIDescription {\n /** The protocol for this description. */\n public readonly protocol: WebAppRpcProtocol;\n\n /** The OpenAPI paths object for the protocol. */\n public get paths(): OpenAPIPaths {\n const paths: OpenAPIPaths = {};\n\n this.protocol.configuration.interfaces().forEach((definition) => {\n RpcOperation.forEach(definition, (operation) => {\n const path = this.protocol.supplyPathForOperation(operation, undefined);\n paths[path] = this.generateDescription(operation);\n });\n });\n\n return paths;\n }\n\n /** An OpenAPI 3.0 (Swagger) description of the RESTful API that is exposed through the protocol. */\n public get document(): OpenAPIDocument {\n return {\n openapi: \"3.0.0\",\n info: this.protocol.info,\n paths: this.paths,\n };\n }\n\n /** Creates an OpenAPI description of an RPC protocol. */\n public constructor(protocol: WebAppRpcProtocol) {\n this.protocol = protocol;\n }\n\n /** Converts to JSON. */\n public toJSON() {\n return this.document;\n }\n\n private generateDescription(operation: RpcOperation): OpenAPIPathItem {\n const requestContent: OpenAPIContentMap = { \"application/json\": { schema: { type: \"array\" } } };\n const responseContent: OpenAPIContentMap = { \"application/json\": { schema: { type: \"object\" } } };\n\n const description: OpenAPIPathItem = {};\n\n description.head = {\n requestBody: { content: requestContent, required: true },\n responses: {\n 200: { description: \"Success\", content: responseContent },\n default: { description: \"Error\", content: responseContent },\n },\n };\n\n const parameters = this.protocol.supplyPathParametersForOperation(operation);\n if (parameters.length)\n description.parameters = parameters;\n\n return description;\n }\n}\n"]}
|
|
@@ -12,7 +12,7 @@ import { OpenAPIInfo, OpenAPIParameter, RpcOpenAPIDescription } from "./OpenAPI"
|
|
|
12
12
|
import { WebAppRpcRequest } from "./WebAppRpcRequest";
|
|
13
13
|
/** An HTTP server request object.
|
|
14
14
|
* @public
|
|
15
|
-
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
15
|
+
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
|
|
16
16
|
*/
|
|
17
17
|
export interface HttpServerRequest extends BackendReadable {
|
|
18
18
|
aborted: boolean;
|
|
@@ -46,7 +46,7 @@ export interface HttpServerRequest extends BackendReadable {
|
|
|
46
46
|
}
|
|
47
47
|
/** An HTTP server response object.
|
|
48
48
|
* @public
|
|
49
|
-
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in
|
|
49
|
+
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
|
|
50
50
|
*/
|
|
51
51
|
export interface HttpServerResponse extends BackendWritable {
|
|
52
52
|
send(body?: any): HttpServerResponse;
|
|
@@ -1 +1 @@
|
|
|
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,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA6CtD;;GAEG;AACH,MAAM,OAAgB,iBAAkB,SAAQ,WAAW;IAGzD,+EAA+E;IACxE,KAAK,CAAC,yBAAyB,CAAC,GAAsB,EAAE,GAAuB;QACpF,OAAO,IAAI,CAAC,0BAA0B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACnD,CAAC;IAED,gFAAgF;IACzE,KAAK,CAAC,0BAA0B,CAAC,GAAsB,EAAE,GAAuB;QACrF,IAAI,OAA6B,CAAC;QAClC,IAAI;YACF,OAAO,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC1D;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,OAAO,GAAG,YAAY,CAAC,eAAe,CAAC,K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AAU,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;IAO3E,mCAAmC;IACnC,YAAmB,aAA+B;QAChD,KAAK,CAAC,aAAa,CAAC,CAAC;QA3GP,oBAAe,GAAG,IAAI,CAAC;QAgDvC,sDAAsD;QAC/C,eAAU,GAAW,EAAE,CAAC;QAE/B,+CAA+C;QAC/B,gBAAW,GAAG,gBAAgB,CAAC;QAoC/B,2BAAsB,GAAG,IAAI,CAAC;QAoB5C,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACrG,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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BentleyError, Logger } from \"@itwin/core-bentley\";\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\nimport { BackendReadable, BackendWritable } from \"../../BackendTypes\";\nimport { RpcConfiguration } from \"../core/RpcConfiguration\";\nimport { RpcContentType, RpcRequestStatus, WEB_RPC_CONSTANTS } from \"../core/RpcConstants\";\nimport { RpcOperation } from \"../core/RpcOperation\";\nimport { RpcProtocol, SerializedRpcRequest } from \"../core/RpcProtocol\";\nimport { OpenAPIInfo, OpenAPIParameter, RpcOpenAPIDescription } from \"./OpenAPI\";\nimport { WebAppRpcLogging } from \"./WebAppRpcLogging\";\nimport { WebAppRpcRequest } from \"./WebAppRpcRequest\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** An HTTP server request object.\n * @public\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.\n */\nexport interface HttpServerRequest extends BackendReadable {\n aborted: boolean;\n httpVersion: string;\n httpVersionMajor: number;\n httpVersionMinor: number;\n complete: boolean;\n connection: any;\n headers: { [header: string]: string | string[] | undefined };\n rawHeaders: string[];\n trailers: { [key: string]: string | undefined };\n trailersDistinct: NodeJS.Dict<string[]>;\n rawTrailers: string[];\n setTimeout(msecs: number, callback: () => void): void;\n setTimeout(msecs: number, callback: () => void): this;\n url?: string;\n statusCode?: number;\n statusMessage?: string;\n socket: any;\n destroy(error?: Error): this;\n body: string | Buffer;\n path: string;\n method: string;\n ip?: string;\n header: (field: string) => string | undefined;\n headersDistinct: NodeJS.Dict<string[]>;\n}\n\n/** An HTTP server response object.\n * @public\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.\n */\nexport interface HttpServerResponse extends BackendWritable {\n send(body?: any): HttpServerResponse;\n status(code: number): HttpServerResponse;\n set(field: string, value: string): void;\n}\n\n/** The HTTP application protocol.\n * @internal\n */\nexport abstract class WebAppRpcProtocol extends RpcProtocol {\n public override preserveStreams = true;\n\n /** Convenience handler for an RPC operation get request for an HTTP server. */\n public async handleOperationGetRequest(req: HttpServerRequest, res: HttpServerResponse) {\n return this.handleOperationPostRequest(req, res);\n }\n\n /** Convenience handler for an RPC operation post request for an HTTP server. */\n public async handleOperationPostRequest(req: HttpServerRequest, res: HttpServerResponse) {\n let request: SerializedRpcRequest;\n try {\n request = await WebAppRpcRequest.parseRequest(this, req);\n } catch (error) {\n const message = BentleyError.getErrorMessage(error);\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, `Failed to parse request: ${message}`, BentleyError.getErrorMetadata(error));\n res.status(400);\n res.send(JSON.stringify({ message, isError: true }));\n return;\n }\n const fulfillment = await this.fulfill(request);\n await WebAppRpcRequest.sendResponse(this, request, fulfillment, req, res);\n }\n\n /** Convenience handler for an OpenAPI description request for an HTTP server. */\n public handleOpenApiDescriptionRequest(_req: HttpServerRequest, res: HttpServerResponse) {\n const description = JSON.stringify(this.openAPIDescription);\n res.send(description);\n }\n\n /** Converts an HTTP content type value to an RPC content type value. */\n public static computeContentType(httpType: string | null | undefined): RpcContentType {\n if (!httpType)\n return RpcContentType.Unknown;\n\n if (httpType.indexOf(WEB_RPC_CONSTANTS.ANY_TEXT) === 0) {\n return RpcContentType.Text;\n } else if (httpType.indexOf(WEB_RPC_CONSTANTS.BINARY) === 0) {\n return RpcContentType.Binary;\n } else if (httpType.indexOf(WEB_RPC_CONSTANTS.MULTIPART) === 0) {\n return RpcContentType.Multipart;\n } else {\n return RpcContentType.Unknown;\n }\n }\n\n /** The OpenAPI-compatible info object for this protocol. */\n public abstract info: OpenAPIInfo;\n\n /** An optional prefix for RPC operation URI paths. */\n public pathPrefix: string = \"\";\n\n /** The RPC request class for this protocol. */\n public readonly requestType = WebAppRpcRequest;\n\n /** Supplies the status corresponding to a protocol-specific code value. */\n public override getStatus(code: number): RpcRequestStatus {\n switch (code) {\n case 404: return RpcRequestStatus.NotFound;\n case 202: return RpcRequestStatus.Pending;\n case 200: return RpcRequestStatus.Resolved;\n case 500: return RpcRequestStatus.Rejected;\n case 204: return RpcRequestStatus.NoContent;\n case 502: return RpcRequestStatus.BadGateway;\n case 503: return RpcRequestStatus.ServiceUnavailable;\n case 504: return RpcRequestStatus.GatewayTimeout;\n case 408: return RpcRequestStatus.RequestTimeout;\n case 429: return RpcRequestStatus.TooManyRequests;\n default: return RpcRequestStatus.Unknown;\n }\n }\n\n /** Supplies the protocol-specific code corresponding to a status value. */\n public override getCode(status: RpcRequestStatus): number {\n switch (status) {\n case RpcRequestStatus.NotFound: return 404;\n case RpcRequestStatus.Pending: return 202;\n case RpcRequestStatus.Resolved: return 200;\n case RpcRequestStatus.Rejected: return 500;\n case RpcRequestStatus.NoContent: return 204;\n case RpcRequestStatus.BadGateway: return 502;\n case RpcRequestStatus.ServiceUnavailable: return 503;\n case RpcRequestStatus.GatewayTimeout: return 504;\n case RpcRequestStatus.RequestTimeout: return 408;\n case RpcRequestStatus.TooManyRequests: return 429;\n default: return 501;\n }\n }\n\n public override supportsStatusCategory = true;\n\n /** Whether an HTTP status code indicates a request timeout. */\n public isTimeout(code: number): boolean {\n return code === 504;\n }\n\n /** An OpenAPI-compatible description of this protocol.\n * @internal\n */\n public get openAPIDescription() { return new RpcOpenAPIDescription(this); }\n\n /** Returns the OpenAPI-compatible URI path parameters for an RPC operation.\n * @internal\n */\n public abstract supplyPathParametersForOperation(_operation: RpcOperation): OpenAPIParameter[];\n\n /** Constructs an HTTP protocol. */\n public constructor(configuration: RpcConfiguration) {\n super(configuration);\n this.events.addListener(async (event, object) => WebAppRpcLogging.logProtocolEvent(event, object));\n }\n}\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,qBAA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;QAgDvC,sDAAsD;QAC/C,eAAU,GAAW,EAAE,CAAC;QAE/B,+CAA+C;QAC/B,gBAAW,GAAG,gBAAgB,CAAC;QAoC/B,2BAAsB,GAAG,IAAI,CAAC;QAoB5C,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACrG,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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BentleyError, Logger } from \"@itwin/core-bentley\";\nimport { CommonLoggerCategory } from \"../../CommonLoggerCategory\";\nimport { BackendReadable, BackendWritable } from \"../../BackendTypes\";\nimport { RpcConfiguration } from \"../core/RpcConfiguration\";\nimport { RpcContentType, RpcRequestStatus, WEB_RPC_CONSTANTS } from \"../core/RpcConstants\";\nimport { RpcOperation } from \"../core/RpcOperation\";\nimport { RpcProtocol, SerializedRpcRequest } from \"../core/RpcProtocol\";\nimport { OpenAPIInfo, OpenAPIParameter, RpcOpenAPIDescription } from \"./OpenAPI\";\nimport { WebAppRpcLogging } from \"./WebAppRpcLogging\";\nimport { WebAppRpcRequest } from \"./WebAppRpcRequest\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** An HTTP server request object.\n * @public\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\n */\nexport interface HttpServerRequest extends BackendReadable {\n aborted: boolean;\n httpVersion: string;\n httpVersionMajor: number;\n httpVersionMinor: number;\n complete: boolean;\n connection: any;\n headers: { [header: string]: string | string[] | undefined };\n rawHeaders: string[];\n trailers: { [key: string]: string | undefined };\n trailersDistinct: NodeJS.Dict<string[]>;\n rawTrailers: string[];\n setTimeout(msecs: number, callback: () => void): void;\n setTimeout(msecs: number, callback: () => void): this;\n url?: string;\n statusCode?: number;\n statusMessage?: string;\n socket: any;\n destroy(error?: Error): this;\n body: string | Buffer;\n path: string;\n method: string;\n ip?: string;\n header: (field: string) => string | undefined;\n headersDistinct: NodeJS.Dict<string[]>;\n}\n\n/** An HTTP server response object.\n * @public\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\n */\nexport interface HttpServerResponse extends BackendWritable {\n send(body?: any): HttpServerResponse;\n status(code: number): HttpServerResponse;\n set(field: string, value: string): void;\n}\n\n/** The HTTP application protocol.\n * @internal\n */\nexport abstract class WebAppRpcProtocol extends RpcProtocol {\n public override preserveStreams = true;\n\n /** Convenience handler for an RPC operation get request for an HTTP server. */\n public async handleOperationGetRequest(req: HttpServerRequest, res: HttpServerResponse) {\n return this.handleOperationPostRequest(req, res);\n }\n\n /** Convenience handler for an RPC operation post request for an HTTP server. */\n public async handleOperationPostRequest(req: HttpServerRequest, res: HttpServerResponse) {\n let request: SerializedRpcRequest;\n try {\n request = await WebAppRpcRequest.parseRequest(this, req);\n } catch (error) {\n const message = BentleyError.getErrorMessage(error);\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, `Failed to parse request: ${message}`, BentleyError.getErrorMetadata(error));\n res.status(400);\n res.send(JSON.stringify({ message, isError: true }));\n return;\n }\n const fulfillment = await this.fulfill(request);\n await WebAppRpcRequest.sendResponse(this, request, fulfillment, req, res);\n }\n\n /** Convenience handler for an OpenAPI description request for an HTTP server. */\n public handleOpenApiDescriptionRequest(_req: HttpServerRequest, res: HttpServerResponse) {\n const description = JSON.stringify(this.openAPIDescription);\n res.send(description);\n }\n\n /** Converts an HTTP content type value to an RPC content type value. */\n public static computeContentType(httpType: string | null | undefined): RpcContentType {\n if (!httpType)\n return RpcContentType.Unknown;\n\n if (httpType.indexOf(WEB_RPC_CONSTANTS.ANY_TEXT) === 0) {\n return RpcContentType.Text;\n } else if (httpType.indexOf(WEB_RPC_CONSTANTS.BINARY) === 0) {\n return RpcContentType.Binary;\n } else if (httpType.indexOf(WEB_RPC_CONSTANTS.MULTIPART) === 0) {\n return RpcContentType.Multipart;\n } else {\n return RpcContentType.Unknown;\n }\n }\n\n /** The OpenAPI-compatible info object for this protocol. */\n public abstract info: OpenAPIInfo;\n\n /** An optional prefix for RPC operation URI paths. */\n public pathPrefix: string = \"\";\n\n /** The RPC request class for this protocol. */\n public readonly requestType = WebAppRpcRequest;\n\n /** Supplies the status corresponding to a protocol-specific code value. */\n public override getStatus(code: number): RpcRequestStatus {\n switch (code) {\n case 404: return RpcRequestStatus.NotFound;\n case 202: return RpcRequestStatus.Pending;\n case 200: return RpcRequestStatus.Resolved;\n case 500: return RpcRequestStatus.Rejected;\n case 204: return RpcRequestStatus.NoContent;\n case 502: return RpcRequestStatus.BadGateway;\n case 503: return RpcRequestStatus.ServiceUnavailable;\n case 504: return RpcRequestStatus.GatewayTimeout;\n case 408: return RpcRequestStatus.RequestTimeout;\n case 429: return RpcRequestStatus.TooManyRequests;\n default: return RpcRequestStatus.Unknown;\n }\n }\n\n /** Supplies the protocol-specific code corresponding to a status value. */\n public override getCode(status: RpcRequestStatus): number {\n switch (status) {\n case RpcRequestStatus.NotFound: return 404;\n case RpcRequestStatus.Pending: return 202;\n case RpcRequestStatus.Resolved: return 200;\n case RpcRequestStatus.Rejected: return 500;\n case RpcRequestStatus.NoContent: return 204;\n case RpcRequestStatus.BadGateway: return 502;\n case RpcRequestStatus.ServiceUnavailable: return 503;\n case RpcRequestStatus.GatewayTimeout: return 504;\n case RpcRequestStatus.RequestTimeout: return 408;\n case RpcRequestStatus.TooManyRequests: return 429;\n default: return 501;\n }\n }\n\n public override supportsStatusCategory = true;\n\n /** Whether an HTTP status code indicates a request timeout. */\n public isTimeout(code: number): boolean {\n return code === 504;\n }\n\n /** An OpenAPI-compatible description of this protocol.\n * @internal\n */\n public get openAPIDescription() { return new RpcOpenAPIDescription(this); }\n\n /** Returns the OpenAPI-compatible URI path parameters for an RPC operation.\n * @internal\n */\n public abstract supplyPathParametersForOperation(_operation: RpcOperation): OpenAPIParameter[];\n\n /** Constructs an HTTP protocol. */\n public constructor(configuration: RpcConfiguration) {\n super(configuration);\n this.events.addListener(async (event, object) => WebAppRpcLogging.logProtocolEvent(event, object));\n }\n}\n"]}
|
|
@@ -27,13 +27,13 @@ export declare enum CurrentImdlVersion {
|
|
|
27
27
|
* front-end is not capable of reading the tile content. Otherwise, this front-end can read the tile content even if the header specifies a
|
|
28
28
|
* greater minor version than CurrentVersion.Minor, although some data may be skipped.
|
|
29
29
|
*/
|
|
30
|
-
Major =
|
|
30
|
+
Major = 33,
|
|
31
31
|
/** The unsigned 16-bit minor version number. If the major version in the tile header is equal to CurrentVersion.Major, then this package can
|
|
32
32
|
* read the tile content even if the minor version in the tile header is greater than this value, although some data may be skipped.
|
|
33
33
|
*/
|
|
34
34
|
Minor = 0,
|
|
35
35
|
/** The unsigned 32-bit version number derived from the 16-bit major and minor version numbers. */
|
|
36
|
-
Combined =
|
|
36
|
+
Combined = 2162688
|
|
37
37
|
}
|
|
38
38
|
/** Header embedded at the beginning of binary tile data in iMdl format describing its contents.
|
|
39
39
|
* @internal
|
|
@@ -33,13 +33,13 @@ export var CurrentImdlVersion;
|
|
|
33
33
|
* front-end is not capable of reading the tile content. Otherwise, this front-end can read the tile content even if the header specifies a
|
|
34
34
|
* greater minor version than CurrentVersion.Minor, although some data may be skipped.
|
|
35
35
|
*/
|
|
36
|
-
CurrentImdlVersion[CurrentImdlVersion["Major"] =
|
|
36
|
+
CurrentImdlVersion[CurrentImdlVersion["Major"] = 33] = "Major";
|
|
37
37
|
/** The unsigned 16-bit minor version number. If the major version in the tile header is equal to CurrentVersion.Major, then this package can
|
|
38
38
|
* read the tile content even if the minor version in the tile header is greater than this value, although some data may be skipped.
|
|
39
39
|
*/
|
|
40
40
|
CurrentImdlVersion[CurrentImdlVersion["Minor"] = 0] = "Minor";
|
|
41
41
|
/** The unsigned 32-bit version number derived from the 16-bit major and minor version numbers. */
|
|
42
|
-
CurrentImdlVersion[CurrentImdlVersion["Combined"] =
|
|
42
|
+
CurrentImdlVersion[CurrentImdlVersion["Combined"] = 2162688] = "Combined";
|
|
43
43
|
})(CurrentImdlVersion || (CurrentImdlVersion = {}));
|
|
44
44
|
/** Header embedded at the beginning of binary tile data in iMdl format describing its contents.
|
|
45
45
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelTileIO.js","sourceRoot":"","sources":["../../../src/tile/IModelTileIO.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,2BAA2B,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE/E;;GAEG;AACH,MAAM,CAAN,IAAY,SAWX;AAXD,WAAY,SAAS;IACnB,uBAAuB;IACvB,yCAAQ,CAAA;IACR,6CAA6C;IAC7C,6DAAuB,CAAA;IACvB,wEAAwE;IACxE,qDAAmB,CAAA;IACnB,mEAAmE;IACnE,2EAA8B,CAAA;IAC9B,uEAAuE;IACvE,8EAA+B,CAAA;AACjC,CAAC,EAXW,SAAS,KAAT,SAAS,QAWpB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,kBAYX;AAZD,WAAY,kBAAkB;IAC5B;;;OAGG;IACH,8DAAU,CAAA;IACV;;OAEG;IACH,6DAAS,CAAA;IACT,kGAAkG;IAClG,yEAAkC,CAAA;AACpC,CAAC,EAZW,kBAAkB,KAAlB,kBAAkB,QAY7B;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IAkBxC,IAAW,YAAY,KAAa,OAAO,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC;IACnE,IAAW,YAAY,KAAa,OAAO,CAAC,IAAI,CAAC,OAAO,GAAG,MAAM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,YAAY;YACrB,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;CACF;AAED;;GAEG;AACH,MAAa,kBAAkB;IAStB,MAAM,CAAC,QAAQ,CAAC,MAAkB;QACvC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;IAC9F,CAAC;IAID,YAAoB,MAAc,EAAE,gBAAwB,EAAE,KAAa;QACzE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;;AANa,8BAAW,GAAG,EAAE,CAAC;SAhBpB,kBAAkB","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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tile\n */\n\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { ElementAlignedBox3d } from \"../geometry/Placement\";\nimport { nextPoint3d64FromByteStream, TileFormat, TileHeader } from \"./TileIO\";\n\n/** Flags describing the geometry contained within a tile in iMdl format.\n * @internal\n */\nexport enum ImdlFlags {\n /** No special flags */\n None = 0,\n /** The tile contains some curved geometry */\n ContainsCurves = 1 << 0,\n /** Some geometry within the tile range was omitted based on its size */\n Incomplete = 1 << 2,\n /** The tile must be refined by sub-division, not magnification. */\n DisallowMagnification = 1 << 3,\n /** The tile's feature table contains features from multiple models. */\n MultiModelFeatureTable = 1 << 4,\n}\n\n/** Describes the maximum major and minor version of the iMdl tile format supported by this version of this package.\n * @internal\n */\nexport enum CurrentImdlVersion {\n /** The unsigned 16-bit major version number. If the major version specified in the tile header is greater than this value, then this\n * front-end is not capable of reading the tile content. Otherwise, this front-end can read the tile content even if the header specifies a\n * greater minor version than CurrentVersion.Minor, although some data may be skipped.\n */\n Major =
|
|
1
|
+
{"version":3,"file":"IModelTileIO.js","sourceRoot":"","sources":["../../../src/tile/IModelTileIO.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,2BAA2B,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE/E;;GAEG;AACH,MAAM,CAAN,IAAY,SAWX;AAXD,WAAY,SAAS;IACnB,uBAAuB;IACvB,yCAAQ,CAAA;IACR,6CAA6C;IAC7C,6DAAuB,CAAA;IACvB,wEAAwE;IACxE,qDAAmB,CAAA;IACnB,mEAAmE;IACnE,2EAA8B,CAAA;IAC9B,uEAAuE;IACvE,8EAA+B,CAAA;AACjC,CAAC,EAXW,SAAS,KAAT,SAAS,QAWpB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,kBAYX;AAZD,WAAY,kBAAkB;IAC5B;;;OAGG;IACH,8DAAU,CAAA;IACV;;OAEG;IACH,6DAAS,CAAA;IACT,kGAAkG;IAClG,yEAAkC,CAAA;AACpC,CAAC,EAZW,kBAAkB,KAAlB,kBAAkB,QAY7B;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IAkBxC,IAAW,YAAY,KAAa,OAAO,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC;IACnE,IAAW,YAAY,KAAa,OAAO,CAAC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK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,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;CACF;AAED;;GAEG;AACH,MAAa,kBAAkB;IAStB,MAAM,CAAC,QAAQ,CAAC,MAAkB;QACvC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;IAC9F,CAAC;IAID,YAAoB,MAAc,EAAE,gBAAwB,EAAE,KAAa;QACzE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;;AANa,8BAAW,GAAG,EAAE,CAAC;SAhBpB,kBAAkB","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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tile\n */\n\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { ElementAlignedBox3d } from \"../geometry/Placement\";\nimport { nextPoint3d64FromByteStream, TileFormat, TileHeader } from \"./TileIO\";\n\n/** Flags describing the geometry contained within a tile in iMdl format.\n * @internal\n */\nexport enum ImdlFlags {\n /** No special flags */\n None = 0,\n /** The tile contains some curved geometry */\n ContainsCurves = 1 << 0,\n /** Some geometry within the tile range was omitted based on its size */\n Incomplete = 1 << 2,\n /** The tile must be refined by sub-division, not magnification. */\n DisallowMagnification = 1 << 3,\n /** The tile's feature table contains features from multiple models. */\n MultiModelFeatureTable = 1 << 4,\n}\n\n/** Describes the maximum major and minor version of the iMdl tile format supported by this version of this package.\n * @internal\n */\nexport enum CurrentImdlVersion {\n /** The unsigned 16-bit major version number. If the major version specified in the tile header is greater than this value, then this\n * front-end is not capable of reading the tile content. Otherwise, this front-end can read the tile content even if the header specifies a\n * greater minor version than CurrentVersion.Minor, although some data may be skipped.\n */\n Major = 33,\n /** The unsigned 16-bit minor version number. If the major version in the tile header is equal to CurrentVersion.Major, then this package can\n * read the tile content even if the minor version in the tile header is greater than this value, although some data may be skipped.\n */\n Minor = 0,\n /** The unsigned 32-bit version number derived from the 16-bit major and minor version numbers. */\n Combined = (Major << 0x10) | Minor,\n}\n\n/** Header embedded at the beginning of binary tile data in iMdl format describing its contents.\n * @internal\n */\nexport class ImdlHeader extends TileHeader {\n /** The size of this header in bytes. */\n public readonly headerLength: number;\n /** Flags describing the geometry contained within the tile */\n public readonly flags: ImdlFlags;\n /** A bounding box no larger than the tile's range, tightly enclosing the tile's geometry; or a null range if the tile is empty */\n public readonly contentRange: ElementAlignedBox3d;\n /** The chord tolerance in meters at which the tile's geometry was faceted */\n public readonly tolerance: number;\n /** The number of elements which contributed at least some geometry to the tile content */\n public readonly numElementsIncluded: number;\n /** The number of elements within the tile range which contributed no geometry to the tile content */\n public readonly numElementsExcluded: number;\n /** The total number of bytes in the binary tile data, including this header */\n public readonly tileLength: number;\n /** A bitfield wherein each set bit indicates an empty sub-volume. */\n public readonly emptySubRanges: number;\n\n public get versionMajor(): number { return this.version >>> 0x10; }\n public get versionMinor(): number { return (this.version & 0xffff) >>> 0; }\n\n public get isValid(): boolean { return TileFormat.IModel === this.format; }\n public get isReadableVersion(): boolean { return this.versionMajor <= CurrentImdlVersion.Major; }\n\n /** Deserialize a header from the binary data at the stream's current position.\n * If the binary data does not contain a valid header, the Header will be marked 'invalid'.\n */\n public constructor(stream: ByteStream) {\n super(stream);\n this.headerLength = stream.readUint32();\n this.flags = stream.readUint32();\n\n this.contentRange = new Range3d();\n nextPoint3d64FromByteStream(stream, this.contentRange.low);\n nextPoint3d64FromByteStream(stream, this.contentRange.high);\n\n this.tolerance = stream.readFloat64();\n this.numElementsIncluded = stream.readUint32();\n this.numElementsExcluded = stream.readUint32();\n this.tileLength = stream.readUint32();\n\n // empty sub-volume bit field introduced in format v02.00\n this.emptySubRanges = this.versionMajor >= 2 ? stream.readUint32() : 0;\n\n // Skip any unprocessed bytes in header\n const remainingHeaderBytes = this.headerLength - stream.curPos;\n assert(remainingHeaderBytes >= 0);\n stream.advance(remainingHeaderBytes);\n\n if (stream.isPastTheEnd)\n this.invalidate();\n }\n}\n\n/** Header preceding the feature table embedded in an iMdl tile's content.\n * @internal\n */\nexport class FeatureTableHeader {\n // The number of bytes the entire table occupies.\n public readonly length: number;\n // The number of subcategories in the table.\n // NOTE: This used to be \"max features\" which was useless and unused. It is only accurate if ImdlFlags.HasMultiModelFeatureTable is set.\n public readonly numSubCategories: number;\n // The number of features in the table.\n public readonly count: number;\n\n public static readFrom(stream: ByteStream) {\n const length = stream.readUint32();\n const maxFeatures = stream.readUint32();\n const count = stream.readUint32();\n return stream.isPastTheEnd ? undefined : new FeatureTableHeader(length, maxFeatures, count);\n }\n\n public static sizeInBytes = 12;\n\n private constructor(length: number, numSubCategories: number, count: number) {\n this.length = length;\n this.numSubCategories = numSubCategories;\n this.count = count;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-common",
|
|
3
|
-
"version": "4.4.0
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "iTwin.js components common to frontend and backend",
|
|
5
5
|
"main": "lib/cjs/core-common.js",
|
|
6
6
|
"module": "lib/esm/core-common.js",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"js-base64": "^3.6.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@itwin/core-bentley": "^4.4.0
|
|
31
|
-
"@itwin/core-geometry": "^4.4.0
|
|
30
|
+
"@itwin/core-bentley": "^4.4.0",
|
|
31
|
+
"@itwin/core-geometry": "^4.4.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@itwin/eslint-plugin": "4.0.0-dev.44",
|
|
35
|
-
"@itwin/object-storage-core": "^2.
|
|
35
|
+
"@itwin/object-storage-core": "^2.2.2",
|
|
36
36
|
"@types/chai": "4.3.1",
|
|
37
37
|
"@types/flatbuffers": "~1.10.0",
|
|
38
38
|
"@types/mocha": "^10.0.6",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"nyc": "^15.1.0",
|
|
43
43
|
"rimraf": "^3.0.2",
|
|
44
44
|
"typescript": "~5.0.2",
|
|
45
|
-
"@itwin/build-tools": "4.4.0
|
|
46
|
-
"@itwin/core-geometry": "4.4.0
|
|
47
|
-
"@itwin/core-bentley": "4.4.0
|
|
45
|
+
"@itwin/build-tools": "4.4.0",
|
|
46
|
+
"@itwin/core-geometry": "4.4.0",
|
|
47
|
+
"@itwin/core-bentley": "4.4.0"
|
|
48
48
|
},
|
|
49
49
|
"nyc": {
|
|
50
50
|
"extends": "./node_modules/@itwin/build-tools/.nycrc",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"extract-api": "betools extract-api --entry=core-common && npm run extract-extension-api",
|
|
60
60
|
"extract-extension-api": "eslint -c extraction.eslint.config.js \"./src/**/*.ts\" 1>&2",
|
|
61
61
|
"lint": "eslint -f visualstudio \"./src/**/*.ts\" 1>&2",
|
|
62
|
+
"lint-fix": "eslint --fix -f visualstudio \"./src/**/*.ts\" 1>&2",
|
|
62
63
|
"test": "mocha",
|
|
63
64
|
"cover": "nyc npm -s test"
|
|
64
65
|
}
|