@itwin/core-common 4.5.0-dev.3 → 4.5.0-dev.6

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.
@@ -51,15 +51,19 @@ export interface TextureMapProps {
51
51
  pattern_mapping?: TextureMapping.Mode;
52
52
  /** Weight at which to combine diffuse image and color; if undefined, defaults to 1.0 */
53
53
  pattern_weight?: number;
54
- /** If true, override the mapping mode with constant LOD mapping for the normal map, defaults to false. */
54
+ /** If true, override the mapping mode with constant LOD mapping for the normal map, defaults to false.
55
+ * @deprecated in 4.4. It never functioned properly - use [[pattern_useconstantlod]] instead.
56
+ */
55
57
  pattern_useConstantLod?: boolean;
56
- /** The number of times the texture is repeated if pattern_useConstantLod is true. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. Defaults to 1.*/
58
+ /** If true, override the mapping mode with constant LOD mapping for the normal map, defaults to false. */
59
+ pattern_useconstantlod?: boolean;
60
+ /** The number of times the texture is repeated if pattern_useconstantlod is true. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. Defaults to 1.*/
57
61
  pattern_constantlod_repetitions?: number;
58
- /** An offset in world units used to shift the texture when pattern_useConstantLod is true. Defaults to (0, 0). */
62
+ /** An offset in world units used to shift the texture when pattern_useconstantlod is true. Defaults to (0, 0). */
59
63
  pattern_constantlod_offset?: Point2dProps;
60
- /** The minimum distance (from the eye to the surface) at which to clamp the texture size when pattern_useConstantLod is true. Defaults to 1. */
64
+ /** The minimum distance (from the eye to the surface) at which to clamp the texture size when pattern_useconstantlod is true. Defaults to 1. */
61
65
  pattern_constantlod_mindistanceclamp?: number;
62
- /** The maximum distance (from the eye to the surface) at which to clamp the texture size when pattern_useConstantLod is true. Defaults to 2^32. */
66
+ /** The maximum distance (from the eye to the surface) at which to clamp the texture size when pattern_useconstantlod is true. Defaults to 2^32. */
63
67
  pattern_constantlod_maxdistanceclamp?: number;
64
68
  /** The Id of the persistent [Texture]($backend) element defining the texture image. */
65
69
  Texture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F;IACvF,uEAAuB,CAAA;AACzB,CAAC,EATW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QASzB","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 Rendering\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { DefinitionElementProps } from \"./ElementProps\";\r\nimport { TextureMapping } from \"./TextureMapping\";\r\n\r\n/** Describes a color as an array of three numbers ranging from 0 to 1 where the first entry corresponds to the color's red component,\r\n * the second to green, and the third to blue.\r\n * @see usage in [[RenderMaterialAssetProps]].\r\n * @public\r\n * @extensions\r\n */\r\nexport type RgbFactorProps = number[];\r\n\r\n/** A 2d point specified as an array of 2 numbers [x, y].\r\n * @see usage in [[TextureMapProps]].\r\n * @public\r\n * @extensions\r\n */\r\nexport type Point2dProps = number[];\r\n\r\n/** Describes the units in which a [[TextureMapProps]]' scale is expressed.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum TextureMapUnits {\r\n /** Indicates the scale has no units. */\r\n Relative = 0,\r\n Meters = 3,\r\n Millimeters = 4,\r\n Feet = 5,\r\n Inches = 6,\r\n}\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\n/** As part of a [[RenderMaterialAssetProps]], describes how to map a [[RenderTexture]]'s image to the triangles of a mesh to which the material is applied.\r\n * @see [[RenderMaterialAssetMapsProps]] for the supported types of texture mappings.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TextureMapProps {\r\n /** Angle in degrees to rotate texture when applying; defaults to 0.0 if undefined */\r\n pattern_angle?: number;\r\n /** If true, flip the pattern map in U; if undefined, defaults to false */\r\n pattern_u_flip?: boolean;\r\n /** If true, flip the pattern map in V; if undefined, defaults to false */\r\n pattern_flip?: boolean;\r\n /** X, Y scale to apply to the pattern map; if undefined, defaults to {0,0}, which is almost never useful. */\r\n pattern_scale?: Point2dProps;\r\n /** X, Y offset to apply to the pattern map; if undefined, defaults to {0,0} */\r\n pattern_offset?: Point2dProps;\r\n /** Units to use when applying the scaling; if undefined, defaults to [[TextureMapUnits.Relative]] */\r\n pattern_scalemode?: TextureMapUnits;\r\n /** Mapping mode to use for the texture application; if undefined, defaults to [[TextureMapping.Mode.Parametric]] */\r\n pattern_mapping?: TextureMapping.Mode;\r\n /** Weight at which to combine diffuse image and color; if undefined, defaults to 1.0 */\r\n pattern_weight?: number;\r\n /** If true, override the mapping mode with constant LOD mapping for the normal map, defaults to false. */\r\n pattern_useConstantLod?: boolean;\r\n /** The number of times the texture is repeated if pattern_useConstantLod is true. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. Defaults to 1.*/\r\n pattern_constantlod_repetitions?: number;\r\n /** An offset in world units used to shift the texture when pattern_useConstantLod is true. Defaults to (0, 0). */\r\n pattern_constantlod_offset?: Point2dProps;\r\n /** The minimum distance (from the eye to the surface) at which to clamp the texture size when pattern_useConstantLod is true. Defaults to 1. */\r\n pattern_constantlod_mindistanceclamp?: number;\r\n /** The maximum distance (from the eye to the surface) at which to clamp the texture size when pattern_useConstantLod is true. Defaults to 2^32. */\r\n pattern_constantlod_maxdistanceclamp?: number;\r\n /** The Id of the persistent [Texture]($backend) element defining the texture image. */\r\n TextureId: Id64String;\r\n}\r\n\r\n/** Flags applied to a [[NormalMapProps]]. The enum values can be combined using bitwise operators.\r\n * @public\r\n */\r\nexport enum NormalMapFlags {\r\n /** No special flags. */\r\n None = 0,\r\n /** Indicates that the Y component of each vector - stored in the texture's green channel - points upward along the positive Y axis and should\r\n * be negated. By default it points downward.\r\n */\r\n GreenUp = 1 << 0,\r\n /** If true, override the mapping mode with constant LOD mapping for the normal map. */\r\n UseConstantLod = 1 << 1,\r\n}\r\n\r\n/** Describes how to apply [normal mapping](https://en.wikipedia.org/wiki/Normal_mapping) to a surface material.\r\n * @see [[RenderMaterialAssetMapsProps.Normal]] to define a normal map for a [[RenderMaterialAssetProps]].\r\n * @public\r\n */\r\nexport interface NormalMapProps extends TextureMapProps {\r\n /** Flags controlling how the normal map is applied. Default: [[NormalMapFlags.None]]. */\r\n NormalFlags?: NormalMapFlags;\r\n}\r\n\r\n/** Describes different types of textures to be applied to a surface material to alter its appearance.\r\n * @note While technically both [[Pattern]] and [[Normal]] can define their own mapping parameters (`pattern_angle`, `pattern_mapping`, etc), in practice\r\n * if both maps are present they are expected to have identical mapping parameters, with the exception of `TextureId`.\r\n * @see [[RenderMaterialAssetProps.Map]] to define the texture maps for a material asset.\r\n * @public\r\n */\r\nexport interface RenderMaterialAssetMapsProps {\r\n /** Maps an image describing the diffuse color of the surface, replacing or mixing with the surface's own color. */\r\n Pattern?: TextureMapProps;\r\n /** Maps a [normal map](https://en.wikipedia.org/wiki/Normal_mapping) to the surface, simulating more complex surface details than are\r\n * present in the surface's geometry.\r\n */\r\n Normal?: NormalMapProps;\r\n /** Maps an image describing detailed minor height variation of the surface geometry. */\r\n Bump?: TextureMapProps;\r\n /** Maps an image describing the diffuse color of the surface, replacing or mixing with the surface's own color. */\r\n Diffuse?: TextureMapProps;\r\n /** Maps an image describing the glossiness of the surface's finish */\r\n Finish?: TextureMapProps;\r\n /** Maps an image describing glowing parts of the surface */\r\n GlowColor?: TextureMapProps;\r\n /** Maps an image describing the reflectiveness of the surface */\r\n Reflect?: TextureMapProps;\r\n /** Maps an image describing the specular component of the surface */\r\n Specular?: TextureMapProps;\r\n /** Maps an image describing the translucency of the surface, how much light comes out the back of the surface */\r\n TranslucencyColor?: TextureMapProps;\r\n /** Maps an image describing the transparency of the surface, how visible objects behind this object are */\r\n TransparentColor?: TextureMapProps;\r\n /** Maps an image describing the displacement of the surface geometry */\r\n Displacement?: TextureMapProps;\r\n}\r\n\r\n/** Describes the graphical properties of a [RenderMaterialElement]($backend) as part of a [[RenderMaterialProps]].\r\n * This representation is used to persist the material properties into the [IModelDb]($backend), but is unwieldy and verbose.\r\n * @see [RenderMaterialElementParams]($backend) for a somewhat more ergonomic representation.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RenderMaterialAssetProps {\r\n /** If true, this material has a fill/diffuse color; if undefined, defaults to false */\r\n HasBaseColor?: boolean;\r\n /** Surface color used for fill or diffuse illumination; if undefined, defaults to black */\r\n color?: RgbFactorProps;\r\n /** If true, this material has a specular color; if undefined, defaults to false */\r\n HasSpecularColor?: boolean;\r\n /** Surface color used for specular illumination; if undefined, defaults to black */\r\n specular_color?: RgbFactorProps;\r\n /** If true, this material has a specular exponent; if undefined, defaults to false */\r\n HasFinish?: boolean;\r\n /** Specular exponent (surface shininess); range is 0 to 128; if undefined, defaults to 13.5 */\r\n finish?: number;\r\n /** If true, this material has surface transparency; if undefined, defaults to false */\r\n HasTransmit?: boolean;\r\n /** Surface transparency; if undefined, defaults to 0.0 */\r\n transmit?: number;\r\n /** If true, this material has a value for diffuse reflectivity; if undefined, defaults to false */\r\n HasDiffuse?: boolean;\r\n /** Surface diffuse reflectivity; if undefined, defaults to 0.6 */\r\n diffuse?: number;\r\n /** If true, this material has a value for specular reflectivity; if undefined, defaults to false. If false, specular value is actually set to 0.0 */\r\n HasSpecular?: boolean;\r\n /** Surface specular reflectivity; if undefined, defaults to 0.4 */\r\n specular?: number;\r\n /** If true, this material has a value for environmental reflectivity; if undefined, defaults to false */\r\n HasReflect?: boolean;\r\n /** Surface environmental reflectivity; stored as fraction of specular in V8 material settings; if undefined defaults to 0.0 */\r\n reflect?: number;\r\n /** If true, this material has a surface reflectance color; if undefined, defaults to false. If false, reflectance color is actually set to specular color */\r\n HasReflectColor?: boolean;\r\n /** Surface reflectance color; if undefined, defaults to black */\r\n reflect_color?: RgbFactorProps;\r\n /** A scale by which to multiply the components of the normals read from [[Map.Normal]], if a normal map is defined.\r\n * Default: 1.0\r\n */\r\n pbr_normal?: number;\r\n /** An optional set of texture maps associated with this material. */\r\n Map?: RenderMaterialAssetMapsProps;\r\n}\r\n\r\n/** Properties that define a [RenderMaterialElement]($backend).\r\n * @see [[RenderMaterial]] for the representation used by the display system.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RenderMaterialProps extends DefinitionElementProps {\r\n /** The name of a palette that can be used to categorize multiple materials. */\r\n paletteName: string;\r\n /** An optional description of the material. */\r\n description?: string;\r\n jsonProperties?: {\r\n /** A container for various \"assets\" describing aspects of the material. */\r\n materialAssets?: {\r\n /** Properties of the material describing how it is displayed. */\r\n renderMaterial?: RenderMaterialAssetProps;\r\n };\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"MaterialProps.js","sourceRoot":"","sources":["../../src/MaterialProps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAqBH;;;GAGG;AACH,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,wCAAwC;IACxC,6DAAY,CAAA;IACZ,yDAAU,CAAA;IACV,mEAAe,CAAA;IACf,qDAAQ,CAAA;IACR,yDAAU,CAAA;AACZ,CAAC,EAPW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAO1B;AA4CD;;GAEG;AACH,IAAY,cASX;AATD,WAAY,cAAc;IACxB,wBAAwB;IACxB,mDAAQ,CAAA;IACR;;OAEG;IACH,yDAAgB,CAAA;IAChB,uFAAuF;IACvF,uEAAuB,CAAA;AACzB,CAAC,EATW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QASzB","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 Rendering\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { DefinitionElementProps } from \"./ElementProps\";\r\nimport { TextureMapping } from \"./TextureMapping\";\r\n\r\n/** Describes a color as an array of three numbers ranging from 0 to 1 where the first entry corresponds to the color's red component,\r\n * the second to green, and the third to blue.\r\n * @see usage in [[RenderMaterialAssetProps]].\r\n * @public\r\n * @extensions\r\n */\r\nexport type RgbFactorProps = number[];\r\n\r\n/** A 2d point specified as an array of 2 numbers [x, y].\r\n * @see usage in [[TextureMapProps]].\r\n * @public\r\n * @extensions\r\n */\r\nexport type Point2dProps = number[];\r\n\r\n/** Describes the units in which a [[TextureMapProps]]' scale is expressed.\r\n * @public\r\n * @extensions\r\n */\r\nexport enum TextureMapUnits {\r\n /** Indicates the scale has no units. */\r\n Relative = 0,\r\n Meters = 3,\r\n Millimeters = 4,\r\n Feet = 5,\r\n Inches = 6,\r\n}\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\n/** As part of a [[RenderMaterialAssetProps]], describes how to map a [[RenderTexture]]'s image to the triangles of a mesh to which the material is applied.\r\n * @see [[RenderMaterialAssetMapsProps]] for the supported types of texture mappings.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TextureMapProps {\r\n /** Angle in degrees to rotate texture when applying; defaults to 0.0 if undefined */\r\n pattern_angle?: number;\r\n /** If true, flip the pattern map in U; if undefined, defaults to false */\r\n pattern_u_flip?: boolean;\r\n /** If true, flip the pattern map in V; if undefined, defaults to false */\r\n pattern_flip?: boolean;\r\n /** X, Y scale to apply to the pattern map; if undefined, defaults to {0,0}, which is almost never useful. */\r\n pattern_scale?: Point2dProps;\r\n /** X, Y offset to apply to the pattern map; if undefined, defaults to {0,0} */\r\n pattern_offset?: Point2dProps;\r\n /** Units to use when applying the scaling; if undefined, defaults to [[TextureMapUnits.Relative]] */\r\n pattern_scalemode?: TextureMapUnits;\r\n /** Mapping mode to use for the texture application; if undefined, defaults to [[TextureMapping.Mode.Parametric]] */\r\n pattern_mapping?: TextureMapping.Mode;\r\n /** Weight at which to combine diffuse image and color; if undefined, defaults to 1.0 */\r\n pattern_weight?: number;\r\n /** If true, override the mapping mode with constant LOD mapping for the normal map, defaults to false.\r\n * @deprecated in 4.4. It never functioned properly - use [[pattern_useconstantlod]] instead.\r\n */\r\n pattern_useConstantLod?: boolean;\r\n /** If true, override the mapping mode with constant LOD mapping for the normal map, defaults to false. */\r\n pattern_useconstantlod?: boolean;\r\n /** The number of times the texture is repeated if pattern_useconstantlod is true. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. Defaults to 1.*/\r\n pattern_constantlod_repetitions?: number;\r\n /** An offset in world units used to shift the texture when pattern_useconstantlod is true. Defaults to (0, 0). */\r\n pattern_constantlod_offset?: Point2dProps;\r\n /** The minimum distance (from the eye to the surface) at which to clamp the texture size when pattern_useconstantlod is true. Defaults to 1. */\r\n pattern_constantlod_mindistanceclamp?: number;\r\n /** The maximum distance (from the eye to the surface) at which to clamp the texture size when pattern_useconstantlod is true. Defaults to 2^32. */\r\n pattern_constantlod_maxdistanceclamp?: number;\r\n /** The Id of the persistent [Texture]($backend) element defining the texture image. */\r\n TextureId: Id64String;\r\n}\r\n\r\n/** Flags applied to a [[NormalMapProps]]. The enum values can be combined using bitwise operators.\r\n * @public\r\n */\r\nexport enum NormalMapFlags {\r\n /** No special flags. */\r\n None = 0,\r\n /** Indicates that the Y component of each vector - stored in the texture's green channel - points upward along the positive Y axis and should\r\n * be negated. By default it points downward.\r\n */\r\n GreenUp = 1 << 0,\r\n /** If true, override the mapping mode with constant LOD mapping for the normal map. */\r\n UseConstantLod = 1 << 1,\r\n}\r\n\r\n/** Describes how to apply [normal mapping](https://en.wikipedia.org/wiki/Normal_mapping) to a surface material.\r\n * @see [[RenderMaterialAssetMapsProps.Normal]] to define a normal map for a [[RenderMaterialAssetProps]].\r\n * @public\r\n */\r\nexport interface NormalMapProps extends TextureMapProps {\r\n /** Flags controlling how the normal map is applied. Default: [[NormalMapFlags.None]]. */\r\n NormalFlags?: NormalMapFlags;\r\n}\r\n\r\n/** Describes different types of textures to be applied to a surface material to alter its appearance.\r\n * @note While technically both [[Pattern]] and [[Normal]] can define their own mapping parameters (`pattern_angle`, `pattern_mapping`, etc), in practice\r\n * if both maps are present they are expected to have identical mapping parameters, with the exception of `TextureId`.\r\n * @see [[RenderMaterialAssetProps.Map]] to define the texture maps for a material asset.\r\n * @public\r\n */\r\nexport interface RenderMaterialAssetMapsProps {\r\n /** Maps an image describing the diffuse color of the surface, replacing or mixing with the surface's own color. */\r\n Pattern?: TextureMapProps;\r\n /** Maps a [normal map](https://en.wikipedia.org/wiki/Normal_mapping) to the surface, simulating more complex surface details than are\r\n * present in the surface's geometry.\r\n */\r\n Normal?: NormalMapProps;\r\n /** Maps an image describing detailed minor height variation of the surface geometry. */\r\n Bump?: TextureMapProps;\r\n /** Maps an image describing the diffuse color of the surface, replacing or mixing with the surface's own color. */\r\n Diffuse?: TextureMapProps;\r\n /** Maps an image describing the glossiness of the surface's finish */\r\n Finish?: TextureMapProps;\r\n /** Maps an image describing glowing parts of the surface */\r\n GlowColor?: TextureMapProps;\r\n /** Maps an image describing the reflectiveness of the surface */\r\n Reflect?: TextureMapProps;\r\n /** Maps an image describing the specular component of the surface */\r\n Specular?: TextureMapProps;\r\n /** Maps an image describing the translucency of the surface, how much light comes out the back of the surface */\r\n TranslucencyColor?: TextureMapProps;\r\n /** Maps an image describing the transparency of the surface, how visible objects behind this object are */\r\n TransparentColor?: TextureMapProps;\r\n /** Maps an image describing the displacement of the surface geometry */\r\n Displacement?: TextureMapProps;\r\n}\r\n\r\n/** Describes the graphical properties of a [RenderMaterialElement]($backend) as part of a [[RenderMaterialProps]].\r\n * This representation is used to persist the material properties into the [IModelDb]($backend), but is unwieldy and verbose.\r\n * @see [RenderMaterialElementParams]($backend) for a somewhat more ergonomic representation.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RenderMaterialAssetProps {\r\n /** If true, this material has a fill/diffuse color; if undefined, defaults to false */\r\n HasBaseColor?: boolean;\r\n /** Surface color used for fill or diffuse illumination; if undefined, defaults to black */\r\n color?: RgbFactorProps;\r\n /** If true, this material has a specular color; if undefined, defaults to false */\r\n HasSpecularColor?: boolean;\r\n /** Surface color used for specular illumination; if undefined, defaults to black */\r\n specular_color?: RgbFactorProps;\r\n /** If true, this material has a specular exponent; if undefined, defaults to false */\r\n HasFinish?: boolean;\r\n /** Specular exponent (surface shininess); range is 0 to 128; if undefined, defaults to 13.5 */\r\n finish?: number;\r\n /** If true, this material has surface transparency; if undefined, defaults to false */\r\n HasTransmit?: boolean;\r\n /** Surface transparency; if undefined, defaults to 0.0 */\r\n transmit?: number;\r\n /** If true, this material has a value for diffuse reflectivity; if undefined, defaults to false */\r\n HasDiffuse?: boolean;\r\n /** Surface diffuse reflectivity; if undefined, defaults to 0.6 */\r\n diffuse?: number;\r\n /** If true, this material has a value for specular reflectivity; if undefined, defaults to false. If false, specular value is actually set to 0.0 */\r\n HasSpecular?: boolean;\r\n /** Surface specular reflectivity; if undefined, defaults to 0.4 */\r\n specular?: number;\r\n /** If true, this material has a value for environmental reflectivity; if undefined, defaults to false */\r\n HasReflect?: boolean;\r\n /** Surface environmental reflectivity; stored as fraction of specular in V8 material settings; if undefined defaults to 0.0 */\r\n reflect?: number;\r\n /** If true, this material has a surface reflectance color; if undefined, defaults to false. If false, reflectance color is actually set to specular color */\r\n HasReflectColor?: boolean;\r\n /** Surface reflectance color; if undefined, defaults to black */\r\n reflect_color?: RgbFactorProps;\r\n /** A scale by which to multiply the components of the normals read from [[Map.Normal]], if a normal map is defined.\r\n * Default: 1.0\r\n */\r\n pbr_normal?: number;\r\n /** An optional set of texture maps associated with this material. */\r\n Map?: RenderMaterialAssetMapsProps;\r\n}\r\n\r\n/** Properties that define a [RenderMaterialElement]($backend).\r\n * @see [[RenderMaterial]] for the representation used by the display system.\r\n * @public\r\n * @extensions\r\n */\r\nexport interface RenderMaterialProps extends DefinitionElementProps {\r\n /** The name of a palette that can be used to categorize multiple materials. */\r\n paletteName: string;\r\n /** An optional description of the material. */\r\n description?: string;\r\n jsonProperties?: {\r\n /** A container for various \"assets\" describing aspects of the material. */\r\n materialAssets?: {\r\n /** Properties of the material describing how it is displayed. */\r\n renderMaterial?: RenderMaterialAssetProps;\r\n };\r\n };\r\n}\r\n"]}
@@ -9,6 +9,18 @@ import { BackgroundMapProps } from "./BackgroundMapSettings";
9
9
  * @deprecated in 3.x. Use string instead.
10
10
  */
11
11
  export type TerrainProviderName = string;
12
+ /** Ids of [Cesium ION assets](https://cesium.com/platform/cesium-ion/content/) providing global terrain data.
13
+ * These values are appropriate to use with [[TerrainSettings.dataSource]] when [[TerrainSettings.providerName]] is set to "CesiumWorldTerrain".
14
+ * You may alternatively use the Id of any ION asset to which you have access.
15
+ * @see [[TerrainSettings.fromCesiumIonAsset]] to create TerrainSettings that obtain terrain from a specified ION asset.
16
+ * @public
17
+ */
18
+ export declare enum CesiumTerrainAssetId {
19
+ /** Default [global 3d terrain](https://cesium.com/platform/cesium-ion/content/cesium-world-terrain/). */
20
+ Default = "1",
21
+ /** Global 3d terrain that includes [bathymetry](https://cesium.com/platform/cesium-ion/content/cesium-world-bathymetry/) (seafloor) terrain. */
22
+ Bathymetry = "2426648"
23
+ }
12
24
  /** JSON representation of the settings of the terrain applied to background map display by a [[DisplayStyle]].
13
25
  * @see [[DisplayStyleSettingsProps]]
14
26
  * @see [[BackgroundMapProps]]
@@ -20,6 +32,12 @@ export interface TerrainProps {
20
32
  * If omitted, it defaults to "CesiumWorldTerrain".
21
33
  */
22
34
  providerName?: string;
35
+ /** Identifies the specific terrain data source to be supplied by the [TerrainProvider]($frontend) identified by [[providerName]],
36
+ * for those providers that support multiple data sources.
37
+ * For example, the "CesiumWorldTerrain" provider uses this field to store a [[CesiumTerrainAssetId]].
38
+ * Default value: an empty string.
39
+ */
40
+ dataSource?: string;
23
41
  /** A value greater than one will cause terrain height to be exaggerated/scaled.false (or 1.0) indicate no exaggeration. Default value: 1.0 */
24
42
  exaggeration?: number;
25
43
  /** Applying lighting can help to visualize subtle terrain variation. Default value: true */
@@ -55,6 +73,12 @@ export declare class TerrainSettings {
55
73
  * Defaults to "CesiumWorldTerrain".
56
74
  */
57
75
  readonly providerName: string;
76
+ /** Identifies the specific terrain data source to be supplied by the [TerrainProvider]($frontend) identified by [[providerName]],
77
+ * for those providers that support multiple data sources.
78
+ * For example, the "CesiumWorldTerrain" provider uses this field to store a [[CesiumTerrainAssetId]].
79
+ * Default value: an empty string.
80
+ */
81
+ readonly dataSource: string;
58
82
  /** A value greater than one will cause terrain height to be exaggerated/scaled. 1.0 indicates no exaggeration. Default value: 1.0 */
59
83
  readonly exaggeration: number;
60
84
  /** Applying lighting can help to visualize subtle terrain variations. Default value: false */
@@ -68,8 +92,15 @@ export declare class TerrainSettings {
68
92
  * @internal
69
93
  */
70
94
  get nonLocatable(): true | undefined;
95
+ /** @deprecated in 4.5.x. Use the overload that takes [[TerrainProps]]. */
71
96
  constructor(providerName?: string, exaggeration?: number, applyLighting?: boolean, heightOrigin?: number, heightOriginMode?: TerrainHeightOriginMode);
97
+ constructor(props?: TerrainProps);
72
98
  static fromJSON(json?: TerrainProps): TerrainSettings;
99
+ /** Create settings that obtain terrain from a [Cesium ION asset](https://cesium.com/platform/cesium-ion/content/) such as
100
+ * one of those defined by [[CesiumTerrainAssetId]].
101
+ * @note You must ensure your Cesium ION account has access to the specified asset.
102
+ */
103
+ static fromCesiumIonAsset(assetId?: string, options?: Omit<TerrainProps, "providerName" | "dataSource">): TerrainSettings;
73
104
  toJSON(): TerrainProps;
74
105
  equals(other: TerrainSettings): boolean;
75
106
  /** Returns true if these settings are equivalent to the supplied JSON settings. */
@@ -1 +1 @@
1
- {"version":3,"file":"TerrainSettings.d.ts","sourceRoot":"","sources":["../../src/TerrainSettings.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8IAA8I;IAC9I,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8FAA8F;IAC9F,aAAa,C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AAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,uBAAuB;gBAExI,KAAK,CAAC,EAAE,YAAY;WAiClB,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY;IAI1C;;;OAGG;WACW,kBAAkB,CAAC,OAAO,GAAE,MAAqC,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,cAAc,GAAG,YAAY,CAAC,GAAG,eAAe;IAOvJ,MAAM,IAAI,YAAY;IAkBtB,MAAM,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO;IAK9C,mFAAmF;IAC5E,UAAU,CAAC,IAAI,CAAC,EAAE,kBAAkB,GAAG,OAAO;IAIrD;;;OAGG;IACI,KAAK,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,eAAe;CAgB3D"}
@@ -7,7 +7,20 @@
7
7
  * @module DisplayStyles
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.TerrainSettings = exports.TerrainHeightOriginMode = void 0;
10
+ exports.TerrainSettings = exports.TerrainHeightOriginMode = exports.CesiumTerrainAssetId = void 0;
11
+ /** Ids of [Cesium ION assets](https://cesium.com/platform/cesium-ion/content/) providing global terrain data.
12
+ * These values are appropriate to use with [[TerrainSettings.dataSource]] when [[TerrainSettings.providerName]] is set to "CesiumWorldTerrain".
13
+ * You may alternatively use the Id of any ION asset to which you have access.
14
+ * @see [[TerrainSettings.fromCesiumIonAsset]] to create TerrainSettings that obtain terrain from a specified ION asset.
15
+ * @public
16
+ */
17
+ var CesiumTerrainAssetId;
18
+ (function (CesiumTerrainAssetId) {
19
+ /** Default [global 3d terrain](https://cesium.com/platform/cesium-ion/content/cesium-world-terrain/). */
20
+ CesiumTerrainAssetId["Default"] = "1";
21
+ /** Global 3d terrain that includes [bathymetry](https://cesium.com/platform/cesium-ion/content/cesium-world-bathymetry/) (seafloor) terrain. */
22
+ CesiumTerrainAssetId["Bathymetry"] = "2426648";
23
+ })(CesiumTerrainAssetId = exports.CesiumTerrainAssetId || (exports.CesiumTerrainAssetId = {}));
11
24
  /** Correction modes for terrain height
12
25
  * @see [[TerrainProps]]
13
26
  * @public
@@ -33,11 +46,24 @@ class TerrainSettings {
33
46
  get nonLocatable() {
34
47
  return this._nonLocatable;
35
48
  }
36
- constructor(providerName = "CesiumWorldTerrain", exaggeration = 1.0, applyLighting = false, heightOrigin = 0.0, heightOriginMode = TerrainHeightOriginMode.Geodetic) {
37
- this.providerName = providerName;
38
- this.exaggeration = Math.min(100, Math.max(0.1, exaggeration));
39
- this.applyLighting = applyLighting;
40
- this.heightOrigin = heightOrigin;
49
+ /** @internal */
50
+ constructor(providerNameOrProps, exaggeration, applyLighting, heightOrigin, heightOriginMode) {
51
+ let providerName;
52
+ let dataSource;
53
+ let nonLocatable;
54
+ if (typeof providerNameOrProps === "string") {
55
+ providerName = providerNameOrProps;
56
+ }
57
+ else if (providerNameOrProps) {
58
+ ({ providerName, dataSource, exaggeration, applyLighting, heightOrigin, heightOriginMode, nonLocatable } = providerNameOrProps);
59
+ }
60
+ this.providerName = providerName ?? "CesiumWorldTerrain";
61
+ this.dataSource = dataSource ?? "";
62
+ this.exaggeration = Math.min(100, Math.max(0.1, exaggeration ?? 1.0));
63
+ this.applyLighting = applyLighting ?? false;
64
+ this.heightOrigin = heightOrigin ?? 0.0;
65
+ if (true === nonLocatable)
66
+ this._nonLocatable = true;
41
67
  switch (heightOriginMode) {
42
68
  case TerrainHeightOriginMode.Ground:
43
69
  case TerrainHeightOriginMode.Geoid:
@@ -49,18 +75,24 @@ class TerrainSettings {
49
75
  }
50
76
  }
51
77
  static fromJSON(json) {
52
- if (undefined === json)
53
- return new TerrainSettings();
54
- const providerName = json?.providerName ?? "CesiumWorldTerrain";
55
- const settings = new TerrainSettings(providerName, json.exaggeration, json.applyLighting, json.heightOrigin, json.heightOriginMode);
56
- if (true === json.nonLocatable)
57
- settings._nonLocatable = true;
58
- return settings;
78
+ return new TerrainSettings(json);
79
+ }
80
+ /** Create settings that obtain terrain from a [Cesium ION asset](https://cesium.com/platform/cesium-ion/content/) such as
81
+ * one of those defined by [[CesiumTerrainAssetId]].
82
+ * @note You must ensure your Cesium ION account has access to the specified asset.
83
+ */
84
+ static fromCesiumIonAsset(assetId = CesiumTerrainAssetId.Default, options) {
85
+ return TerrainSettings.fromJSON({
86
+ ...options,
87
+ dataSource: assetId,
88
+ });
59
89
  }
60
90
  toJSON() {
61
91
  const props = { heightOriginMode: this.heightOriginMode };
62
92
  if ("CesiumWorldTerrain" !== this.providerName)
63
93
  props.providerName = this.providerName;
94
+ if (this.dataSource)
95
+ props.dataSource = this.dataSource;
64
96
  if (1 !== this.exaggeration)
65
97
  props.exaggeration = this.exaggeration;
66
98
  if (this.nonLocatable)
@@ -72,7 +104,7 @@ class TerrainSettings {
72
104
  return props;
73
105
  }
74
106
  equals(other) {
75
- return this.providerName === other.providerName && this.exaggeration === other.exaggeration && this.applyLighting === other.applyLighting
107
+ return this.providerName === other.providerName && this.dataSource === other.dataSource && this.exaggeration === other.exaggeration && this.applyLighting === other.applyLighting
76
108
  && this.heightOrigin === other.heightOrigin && this.heightOriginMode === other.heightOriginMode && this.nonLocatable === other.nonLocatable;
77
109
  }
78
110
  /** Returns true if these settings are equivalent to the supplied JSON settings. */
@@ -88,6 +120,7 @@ class TerrainSettings {
88
120
  return this;
89
121
  const props = {
90
122
  providerName: changedProps.providerName ?? this.providerName,
123
+ dataSource: changedProps.dataSource ?? this.dataSource,
91
124
  exaggeration: changedProps.exaggeration ?? this.exaggeration,
92
125
  nonLocatable: changedProps.nonLocatable ?? this.nonLocatable,
93
126
  applyLighting: changedProps.applyLighting ?? this.applyLighting,
@@ -1 +1 @@
1
- {"version":3,"file":"TerrainSettings.js","sourceRoot":"","sources":["../../src/TerrainSettings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAqCH;;;;GAIG;AACH,IAAY,uBAOX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,CAAC,YAA2B;QACtC,IAAI,SAAS,KAAK,YAAY;YAC5B,OAAO,IAAI,CAAC;QAEd,MAAM,KAAK,GAAG;YACZ,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;YAC5D,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;YAC5D,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;YAC5D,aAAa,EAAE,YAAY,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa;YAC/D,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;YAC5D,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB;SACzE,CAAC;QAEF,OAAO,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CACF;AA/FD,0CA+FC","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 DisplayStyles\r\n */\r\n\r\nimport { BackgroundMapProps } from \"./BackgroundMapSettings\";\r\n\r\n/** Identifies a [TerrainProvider]($frontend).\r\n * @see [[TerrainSettings.providerName]] and [[TerrainProps.providerName]].\r\n * @public\r\n * @extensions\r\n * @deprecated in 3.x. Use string instead.\r\n */\r\nexport type TerrainProviderName = string;\r\n\r\n/** JSON representation of the settings of the terrain applied to background map display by a [[DisplayStyle]].\r\n * @see [[DisplayStyleSettingsProps]]\r\n * @see [[BackgroundMapProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TerrainProps {\r\n /** Identifies the [TerrainProvider]($frontend) that will supply terrain meshes.\r\n * If omitted, it defaults to \"CesiumWorldTerrain\".\r\n */\r\n providerName?: string;\r\n /** A value greater than one will cause terrain height to be exaggerated/scaled.false (or 1.0) indicate no exaggeration. Default value: 1.0 */\r\n exaggeration?: number;\r\n /** Applying lighting can help to visualize subtle terrain variation. Default value: true */\r\n applyLighting?: boolean;\r\n /** Origin value - height of the IModel origin at the project center as defined by heightOriginMode. Default value: 0.0 */\r\n heightOrigin?: number;\r\n /** Determines how/if the heightOrigin is applied to the terrain height. Default value: Geodetic */\r\n heightOriginMode?: TerrainHeightOriginMode;\r\n /** If true, the terrain will not be locatable. Otherwise, [[BackgroundMapProps.nonLocatable]] will determine whether terrain is locatable.\r\n * @internal use [[BackgroundMapProps.nonLocatable]]. Retained for backwards compatibility only.\r\n */\r\n nonLocatable?: boolean;\r\n}\r\n\r\n/** Correction modes for terrain height\r\n * @see [[TerrainProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport enum TerrainHeightOriginMode {\r\n /** Height value indicates the geodetic height of the IModel origin (also referred to as ellipsoidal or GPS height) */\r\n Geodetic = 0,\r\n /** Height value indicates the geoidal height of the IModel origin (commonly referred to as sea level). */\r\n Geoid = 1,\r\n /** Height value indicates the height of the IModel origin relative to ground level at project center. */\r\n Ground = 2,\r\n}\r\n\r\n/** Normalized version of [[TerrainProps]] for which provider has been validated and default values of all members are used.\r\n * @public\r\n */\r\nexport class TerrainSettings {\r\n private _nonLocatable: true | undefined;\r\n /** Identifies the [TerrainProvider]($frontend) that will supply terrain meshes.\r\n * Defaults to \"CesiumWorldTerrain\".\r\n */\r\n public readonly providerName: string;\r\n /** A value greater than one will cause terrain height to be exaggerated/scaled. 1.0 indicates no exaggeration. Default value: 1.0 */\r\n public readonly exaggeration: number;\r\n /** Applying lighting can help to visualize subtle terrain variations. Default value: false */\r\n public readonly applyLighting: boolean;\r\n /** Origin value - height of the IModel origin at the project center as defined by heightOriginMode. Default value 0.0 */\r\n public readonly heightOrigin: number;\r\n /** Determines how/if the heightOrigin is applied to the terrain height. Default value: Geodetic */\r\n public readonly heightOriginMode: TerrainHeightOriginMode;\r\n /** Optionally overrides [[BackgroundMapSettings.locatable]]. For backwards compatibility only.\r\n * @see [[TerrainProps.nonLocatable]].\r\n * @internal\r\n */\r\n public get nonLocatable(): true | undefined {\r\n return this._nonLocatable;\r\n }\r\n\r\n constructor(providerName: string = \"CesiumWorldTerrain\", exaggeration: number = 1.0, applyLighting = false, heightOrigin = 0.0, heightOriginMode = TerrainHeightOriginMode.Geodetic) {\r\n this.providerName = providerName;\r\n this.exaggeration = Math.min(100, Math.max(0.1, exaggeration));\r\n this.applyLighting = applyLighting;\r\n this.heightOrigin = heightOrigin;\r\n switch (heightOriginMode) {\r\n case TerrainHeightOriginMode.Ground:\r\n case TerrainHeightOriginMode.Geoid:\r\n this.heightOriginMode = heightOriginMode;\r\n break;\r\n default:\r\n this.heightOriginMode = TerrainHeightOriginMode.Geodetic;\r\n break;\r\n }\r\n }\r\n\r\n public static fromJSON(json?: TerrainProps) {\r\n if (undefined === json)\r\n return new TerrainSettings();\r\n\r\n const providerName = json?.providerName ?? \"CesiumWorldTerrain\";\r\n const settings = new TerrainSettings(providerName, json.exaggeration, json.applyLighting, json.heightOrigin, json.heightOriginMode);\r\n if (true === json.nonLocatable)\r\n settings._nonLocatable = true;\r\n\r\n return settings;\r\n }\r\n\r\n public toJSON(): TerrainProps {\r\n const props: TerrainProps = { heightOriginMode: this.heightOriginMode };\r\n if (\"CesiumWorldTerrain\" !== this.providerName)\r\n props.providerName = this.providerName;\r\n if (1 !== this.exaggeration)\r\n props.exaggeration = this.exaggeration;\r\n if (this.nonLocatable)\r\n props.nonLocatable = true;\r\n if (this.applyLighting)\r\n props.applyLighting = true;\r\n if (0 !== this.heightOrigin)\r\n props.heightOrigin = this.heightOrigin;\r\n\r\n return props;\r\n }\r\n\r\n public equals(other: TerrainSettings): boolean {\r\n return this.providerName === other.providerName && this.exaggeration === other.exaggeration && this.applyLighting === other.applyLighting\r\n && this.heightOrigin === other.heightOrigin && this.heightOriginMode === other.heightOriginMode && this.nonLocatable === other.nonLocatable;\r\n }\r\n\r\n /** Returns true if these settings are equivalent to the supplied JSON settings. */\r\n public equalsJSON(json?: BackgroundMapProps): boolean {\r\n return this.equals(TerrainSettings.fromJSON(json));\r\n }\r\n\r\n /** Create a copy of this TerrainSettings, optionally modifying some of its properties.\r\n * @param changedProps JSON representation of the properties to change.\r\n * @returns A TerrainSettings with all of its properties set to match those of`this`, except those explicitly defined in `changedProps`.\r\n */\r\n public clone(changedProps?: TerrainProps): TerrainSettings {\r\n if (undefined === changedProps)\r\n return this;\r\n\r\n const props = {\r\n providerName: changedProps.providerName ?? this.providerName,\r\n exaggeration: changedProps.exaggeration ?? this.exaggeration,\r\n nonLocatable: changedProps.nonLocatable ?? this.nonLocatable,\r\n applyLighting: changedProps.applyLighting ?? this.applyLighting,\r\n heightOrigin: changedProps.heightOrigin ?? this.heightOrigin,\r\n heightOriginMode: changedProps.heightOriginMode ?? this.heightOriginMode,\r\n };\r\n\r\n return TerrainSettings.fromJSON(props);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TerrainSettings.js","sourceRoot":"","sources":["../../src/TerrainSettings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAYH;;;;;GAKG;AACH,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,yGAAyG;IACzG,qCAAa,CAAA;IACb,gJAAgJ;IAChJ,8CAAsB,CAAA;AACxB,CAAC,EALW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAK/B;AAiCD;;;;GAIG;AACH,IAAY,uBAOX;AAPD,WAAY,uBAAuB;IACjC,sHAAsH;IACtH,6EAAY,CAAA;IACZ,0GAA0G;IAC1G,uEAAS,CAAA;IACT,yGAAyG;IACzG,yEAAU,CAAA;AACZ,CAAC,EAPW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAOlC;AAED;;GAEG;AACH,MAAa,eAAe;IAoB1B;;;OAGG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAOD,gBAAgB;IAChB,Y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I,CAAC,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,YAA2B;QACtC,IAAI,SAAS,KAAK,YAAY;YAC5B,OAAO,IAAI,CAAC;QAEd,MAAM,KAAK,GAAG;YACZ,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;YAC5D,UAAU,EAAE,YAAY,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU;YACtD,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;YAC5D,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;YAC5D,aAAa,EAAE,YAAY,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa;YAC/D,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY;YAC5D,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB;SACzE,CAAC;QAEF,OAAO,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CACF;AA/HD,0CA+HC","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 DisplayStyles\r\n */\r\n\r\nimport { BackgroundMapProps } from \"./BackgroundMapSettings\";\r\n\r\n/** Identifies a [TerrainProvider]($frontend).\r\n * @see [[TerrainSettings.providerName]] and [[TerrainProps.providerName]].\r\n * @public\r\n * @extensions\r\n * @deprecated in 3.x. Use string instead.\r\n */\r\nexport type TerrainProviderName = string;\r\n\r\n/** Ids of [Cesium ION assets](https://cesium.com/platform/cesium-ion/content/) providing global terrain data.\r\n * These values are appropriate to use with [[TerrainSettings.dataSource]] when [[TerrainSettings.providerName]] is set to \"CesiumWorldTerrain\".\r\n * You may alternatively use the Id of any ION asset to which you have access.\r\n * @see [[TerrainSettings.fromCesiumIonAsset]] to create TerrainSettings that obtain terrain from a specified ION asset.\r\n * @public\r\n */\r\nexport enum CesiumTerrainAssetId {\r\n /** Default [global 3d terrain](https://cesium.com/platform/cesium-ion/content/cesium-world-terrain/). */\r\n Default = \"1\",\r\n /** Global 3d terrain that includes [bathymetry](https://cesium.com/platform/cesium-ion/content/cesium-world-bathymetry/) (seafloor) terrain. */\r\n Bathymetry = \"2426648\",\r\n}\r\n\r\n/** JSON representation of the settings of the terrain applied to background map display by a [[DisplayStyle]].\r\n * @see [[DisplayStyleSettingsProps]]\r\n * @see [[BackgroundMapProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TerrainProps {\r\n /** Identifies the [TerrainProvider]($frontend) that will supply terrain meshes.\r\n * If omitted, it defaults to \"CesiumWorldTerrain\".\r\n */\r\n providerName?: string;\r\n /** Identifies the specific terrain data source to be supplied by the [TerrainProvider]($frontend) identified by [[providerName]],\r\n * for those providers that support multiple data sources.\r\n * For example, the \"CesiumWorldTerrain\" provider uses this field to store a [[CesiumTerrainAssetId]].\r\n * Default value: an empty string.\r\n */\r\n dataSource?: string;\r\n /** A value greater than one will cause terrain height to be exaggerated/scaled.false (or 1.0) indicate no exaggeration. Default value: 1.0 */\r\n exaggeration?: number;\r\n /** Applying lighting can help to visualize subtle terrain variation. Default value: true */\r\n applyLighting?: boolean;\r\n /** Origin value - height of the IModel origin at the project center as defined by heightOriginMode. Default value: 0.0 */\r\n heightOrigin?: number;\r\n /** Determines how/if the heightOrigin is applied to the terrain height. Default value: Geodetic */\r\n heightOriginMode?: TerrainHeightOriginMode;\r\n /** If true, the terrain will not be locatable. Otherwise, [[BackgroundMapProps.nonLocatable]] will determine whether terrain is locatable.\r\n * @internal use [[BackgroundMapProps.nonLocatable]]. Retained for backwards compatibility only.\r\n */\r\n nonLocatable?: boolean;\r\n}\r\n\r\n/** Correction modes for terrain height\r\n * @see [[TerrainProps]]\r\n * @public\r\n * @extensions\r\n */\r\nexport enum TerrainHeightOriginMode {\r\n /** Height value indicates the geodetic height of the IModel origin (also referred to as ellipsoidal or GPS height) */\r\n Geodetic = 0,\r\n /** Height value indicates the geoidal height of the IModel origin (commonly referred to as sea level). */\r\n Geoid = 1,\r\n /** Height value indicates the height of the IModel origin relative to ground level at project center. */\r\n Ground = 2,\r\n}\r\n\r\n/** Normalized version of [[TerrainProps]] for which provider has been validated and default values of all members are used.\r\n * @public\r\n */\r\nexport class TerrainSettings {\r\n private _nonLocatable: true | undefined;\r\n /** Identifies the [TerrainProvider]($frontend) that will supply terrain meshes.\r\n * Defaults to \"CesiumWorldTerrain\".\r\n */\r\n public readonly providerName: string;\r\n /** Identifies the specific terrain data source to be supplied by the [TerrainProvider]($frontend) identified by [[providerName]],\r\n * for those providers that support multiple data sources.\r\n * For example, the \"CesiumWorldTerrain\" provider uses this field to store a [[CesiumTerrainAssetId]].\r\n * Default value: an empty string.\r\n */\r\n public readonly dataSource: string;\r\n /** A value greater than one will cause terrain height to be exaggerated/scaled. 1.0 indicates no exaggeration. Default value: 1.0 */\r\n public readonly exaggeration: number;\r\n /** Applying lighting can help to visualize subtle terrain variations. Default value: false */\r\n public readonly applyLighting: boolean;\r\n /** Origin value - height of the IModel origin at the project center as defined by heightOriginMode. Default value 0.0 */\r\n public readonly heightOrigin: number;\r\n /** Determines how/if the heightOrigin is applied to the terrain height. Default value: Geodetic */\r\n public readonly heightOriginMode: TerrainHeightOriginMode;\r\n /** Optionally overrides [[BackgroundMapSettings.locatable]]. For backwards compatibility only.\r\n * @see [[TerrainProps.nonLocatable]].\r\n * @internal\r\n */\r\n public get nonLocatable(): true | undefined {\r\n return this._nonLocatable;\r\n }\r\n\r\n /** @deprecated in 4.5.x. Use the overload that takes [[TerrainProps]]. */\r\n constructor(providerName?: string, exaggeration?: number, applyLighting?: boolean, heightOrigin?: number, heightOriginMode?: TerrainHeightOriginMode);\r\n\r\n constructor(props?: TerrainProps);\r\n\r\n /** @internal */\r\n constructor(providerNameOrProps: string | TerrainProps | undefined, exaggeration?: number, applyLighting?: boolean, heightOrigin?: number, heightOriginMode?: TerrainHeightOriginMode) {\r\n let providerName;\r\n let dataSource;\r\n let nonLocatable;\r\n if (typeof providerNameOrProps === \"string\") {\r\n providerName = providerNameOrProps;\r\n } else if (providerNameOrProps) {\r\n ({ providerName, dataSource, exaggeration, applyLighting, heightOrigin, heightOriginMode, nonLocatable } = providerNameOrProps);\r\n }\r\n\r\n this.providerName = providerName ?? \"CesiumWorldTerrain\";\r\n this.dataSource = dataSource ?? \"\";\r\n this.exaggeration = Math.min(100, Math.max(0.1, exaggeration ?? 1.0));\r\n this.applyLighting = applyLighting ?? false;\r\n this.heightOrigin = heightOrigin ?? 0.0;\r\n\r\n if (true === nonLocatable)\r\n this._nonLocatable = true;\r\n\r\n switch (heightOriginMode) {\r\n case TerrainHeightOriginMode.Ground:\r\n case TerrainHeightOriginMode.Geoid:\r\n this.heightOriginMode = heightOriginMode;\r\n break;\r\n default:\r\n this.heightOriginMode = TerrainHeightOriginMode.Geodetic;\r\n break;\r\n }\r\n }\r\n\r\n public static fromJSON(json?: TerrainProps) {\r\n return new TerrainSettings(json);\r\n }\r\n\r\n /** Create settings that obtain terrain from a [Cesium ION asset](https://cesium.com/platform/cesium-ion/content/) such as\r\n * one of those defined by [[CesiumTerrainAssetId]].\r\n * @note You must ensure your Cesium ION account has access to the specified asset.\r\n */\r\n public static fromCesiumIonAsset(assetId: string = CesiumTerrainAssetId.Default, options?: Omit<TerrainProps, \"providerName\" | \"dataSource\">): TerrainSettings {\r\n return TerrainSettings.fromJSON({\r\n ...options,\r\n dataSource: assetId,\r\n });\r\n }\r\n\r\n public toJSON(): TerrainProps {\r\n const props: TerrainProps = { heightOriginMode: this.heightOriginMode };\r\n if (\"CesiumWorldTerrain\" !== this.providerName)\r\n props.providerName = this.providerName;\r\n if (this.dataSource)\r\n props.dataSource = this.dataSource;\r\n if (1 !== this.exaggeration)\r\n props.exaggeration = this.exaggeration;\r\n if (this.nonLocatable)\r\n props.nonLocatable = true;\r\n if (this.applyLighting)\r\n props.applyLighting = true;\r\n if (0 !== this.heightOrigin)\r\n props.heightOrigin = this.heightOrigin;\r\n\r\n return props;\r\n }\r\n\r\n public equals(other: TerrainSettings): boolean {\r\n return this.providerName === other.providerName && this.dataSource === other.dataSource && this.exaggeration === other.exaggeration && this.applyLighting === other.applyLighting\r\n && this.heightOrigin === other.heightOrigin && this.heightOriginMode === other.heightOriginMode && this.nonLocatable === other.nonLocatable;\r\n }\r\n\r\n /** Returns true if these settings are equivalent to the supplied JSON settings. */\r\n public equalsJSON(json?: BackgroundMapProps): boolean {\r\n return this.equals(TerrainSettings.fromJSON(json));\r\n }\r\n\r\n /** Create a copy of this TerrainSettings, optionally modifying some of its properties.\r\n * @param changedProps JSON representation of the properties to change.\r\n * @returns A TerrainSettings with all of its properties set to match those of`this`, except those explicitly defined in `changedProps`.\r\n */\r\n public clone(changedProps?: TerrainProps): TerrainSettings {\r\n if (undefined === changedProps)\r\n return this;\r\n\r\n const props = {\r\n providerName: changedProps.providerName ?? this.providerName,\r\n dataSource: changedProps.dataSource ?? this.dataSource,\r\n exaggeration: changedProps.exaggeration ?? this.exaggeration,\r\n nonLocatable: changedProps.nonLocatable ?? this.nonLocatable,\r\n applyLighting: changedProps.applyLighting ?? this.applyLighting,\r\n heightOrigin: changedProps.heightOrigin ?? this.heightOrigin,\r\n heightOriginMode: changedProps.heightOriginMode ?? this.heightOriginMode,\r\n };\r\n\r\n return TerrainSettings.fromJSON(props);\r\n }\r\n}\r\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 version 5.0.
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 version 5.0.
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 version 5.0. */
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 version 5.0.
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 version 5.0.
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 version 5.0.
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,gHAAgH;AAChH,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"}
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"}
@@ -19,7 +19,7 @@ var RpcResponseCacheControl;
19
19
  })(RpcResponseCacheControl = exports.RpcResponseCacheControl || (exports.RpcResponseCacheControl = {}));
20
20
  /** RPC protocol event types.
21
21
  * @public
22
- * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.
22
+ * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
23
23
  */
24
24
  var RpcProtocolEvent;
25
25
  (function (RpcProtocolEvent) {
@@ -39,7 +39,7 @@ var RpcProtocolEvent;
39
39
  })(RpcProtocolEvent = exports.RpcProtocolEvent || (exports.RpcProtocolEvent = {}));
40
40
  /** The status of an RPC operation request.
41
41
  * @public
42
- * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.
42
+ * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
43
43
  */
44
44
  var RpcRequestStatus;
45
45
  (function (RpcRequestStatus) {
@@ -59,7 +59,7 @@ var RpcRequestStatus;
59
59
  RpcRequestStatus[RpcRequestStatus["RequestTimeout"] = 13] = "RequestTimeout";
60
60
  RpcRequestStatus[RpcRequestStatus["TooManyRequests"] = 14] = "TooManyRequests";
61
61
  })(RpcRequestStatus = exports.RpcRequestStatus || (exports.RpcRequestStatus = {}));
62
- /** @public @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0. */
62
+ /** @public @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future. */
63
63
  (function (RpcRequestStatus) {
64
64
  function isTransientError(status) {
65
65
  return status === RpcRequestStatus.BadGateway || status === RpcRequestStatus.ServiceUnavailable || status === RpcRequestStatus.GatewayTimeout
@@ -69,7 +69,7 @@ var RpcRequestStatus;
69
69
  })(RpcRequestStatus = exports.RpcRequestStatus || (exports.RpcRequestStatus = {}));
70
70
  /** RPC request event types.
71
71
  * @public
72
- * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.
72
+ * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
73
73
  */
74
74
  var RpcRequestEvent;
75
75
  (function (RpcRequestEvent) {
@@ -79,7 +79,7 @@ var RpcRequestEvent;
79
79
  })(RpcRequestEvent = exports.RpcRequestEvent || (exports.RpcRequestEvent = {}));
80
80
  /** RPC content types.
81
81
  * @public
82
- * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.
82
+ * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
83
83
  */
84
84
  var RpcContentType;
85
85
  (function (RpcContentType) {
@@ -91,7 +91,7 @@ var RpcContentType;
91
91
  })(RpcContentType = exports.RpcContentType || (exports.RpcContentType = {}));
92
92
  /** Endpoints for RPC protocols.
93
93
  * @public
94
- * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.
94
+ * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
95
95
  */
96
96
  var RpcEndpoint;
97
97
  (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;;GAEG;AACH,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,qEAAI,CAAA;IACJ,+EAAS,CAAA;AACX,CAAC,EAHW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAGlC;AAED;;;GAGG;AACH,IAAY,gBAcX;AAdD,WAAY,gBAAgB;IAC1B,2EAAc,CAAA;IACd,2EAAc,CAAA;IACd,6EAAe,CAAA;IACf,6FAAuB,CAAA;IACvB,uFAAoB,CAAA;IACpB,uFAAoB,CAAA;IACpB,iFAAiB,CAAA;IACjB,6EAAe,CAAA;IACf,2FAAsB,CAAA;IACtB,2FAAsB,CAAA;IACtB,8FAAuB,CAAA;IACvB,wFAAoB,CAAA;IACpB,gGAAwB,CAAA;AAC1B,CAAC,EAdW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAc3B;AAED;;;GAGG;AACH,IAAY,gBAgBX;AAhBD,WAAY,gBAAgB;IAC1B,6DAAO,CAAA;IACP,6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gB;AACH,QAAA,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":["/*---------------------------------------------------------------------------------------------\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\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** Describes available options for RPC response caching.\r\n * @public\r\n */\r\nexport enum RpcResponseCacheControl {\r\n None,\r\n Immutable,\r\n}\r\n\r\n/** RPC protocol event types.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.\r\n */\r\nexport enum RpcProtocolEvent {\r\n RequestCreated,\r\n ResponseLoaded,\r\n ResponseLoading,\r\n ConnectionErrorReceived,\r\n UnknownErrorReceived,\r\n BackendErrorReceived,\r\n ConnectionAborted,\r\n RequestReceived,\r\n BackendResponseCreated,\r\n BackendReportedPending,\r\n BackendReportedNotFound,\r\n BackendErrorOccurred,\r\n BackendReportedNoContent,\r\n}\r\n\r\n/** The status of an RPC operation request.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.\r\n */\r\nexport enum RpcRequestStatus {\r\n Unknown,\r\n Created,\r\n Submitted,\r\n Pending,\r\n Resolved,\r\n Rejected,\r\n Disposed,\r\n NotFound,\r\n Cancelled,\r\n NoContent,\r\n BadGateway,\r\n ServiceUnavailable,\r\n GatewayTimeout,\r\n RequestTimeout,\r\n TooManyRequests\r\n}\r\n\r\n/** @public @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0. */\r\nexport namespace RpcRequestStatus { // eslint-disable-line @typescript-eslint/no-redeclare\r\n export function isTransientError(status: RpcRequestStatus) {\r\n return status === RpcRequestStatus.BadGateway || status === RpcRequestStatus.ServiceUnavailable || status === RpcRequestStatus.GatewayTimeout\r\n || status === RpcRequestStatus.RequestTimeout || status === RpcRequestStatus.TooManyRequests;\r\n }\r\n}\r\n\r\n/** RPC request event types.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.\r\n */\r\nexport enum RpcRequestEvent {\r\n StatusChanged,\r\n PendingUpdateReceived,\r\n TransientErrorReceived\r\n}\r\n\r\n/** RPC content types.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.\r\n */\r\nexport enum RpcContentType {\r\n Unknown,\r\n Text,\r\n Binary,\r\n Multipart,\r\n Stream,\r\n}\r\n\r\n/** Endpoints for RPC protocols.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.\r\n */\r\nexport enum RpcEndpoint {\r\n Frontend,\r\n Backend,\r\n}\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\n/** @internal */\r\nexport const WEB_RPC_CONSTANTS = {\r\n CONTENT: \"Content-Type\",\r\n TEXT: \"text/plain\",\r\n ANY_TEXT: \"text/\",\r\n BINARY: \"application/octet-stream\",\r\n MULTIPART: \"multipart/form-data\",\r\n};\r\n"]}
1
+ {"version":3,"file":"RpcConstants.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcConstants.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,4CAA4C;AAE5C;;GAEG;AACH,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,qEAAI,CAAA;IACJ,+EAAS,CAAA;AACX,CAAC,EAHW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAGlC;AAED;;;GAGG;AACH,IAAY,gBAcX;AAdD,WAAY,gBAAgB;IAC1B,2EAAc,CAAA;IACd,2EAAc,CAAA;IACd,6EAAe,CAAA;IACf,6FAAuB,CAAA;IAC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AAY,cAAc;IACxB,yDAAO,CAAA;IACP,mDAAI,CAAA;IACJ,uDAAM,CAAA;IACN,6DAAS,CAAA;IACT,uDAAM,CAAA;AACR,CAAC,EANW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAMzB;AAED;;;GAGG;AACH,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,qDAAQ,CAAA;IACR,mDAAO,CAAA;AACT,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB;AAED,yDAAyD;AAEzD,gBAAgB;AACH,QAAA,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":["/*---------------------------------------------------------------------------------------------\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\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** Describes available options for RPC response caching.\r\n * @public\r\n */\r\nexport enum RpcResponseCacheControl {\r\n None,\r\n Immutable,\r\n}\r\n\r\n/** RPC protocol event types.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\r\n */\r\nexport enum RpcProtocolEvent {\r\n RequestCreated,\r\n ResponseLoaded,\r\n ResponseLoading,\r\n ConnectionErrorReceived,\r\n UnknownErrorReceived,\r\n BackendErrorReceived,\r\n ConnectionAborted,\r\n RequestReceived,\r\n BackendResponseCreated,\r\n BackendReportedPending,\r\n BackendReportedNotFound,\r\n BackendErrorOccurred,\r\n BackendReportedNoContent,\r\n}\r\n\r\n/** The status of an RPC operation request.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\r\n */\r\nexport enum RpcRequestStatus {\r\n Unknown,\r\n Created,\r\n Submitted,\r\n Pending,\r\n Resolved,\r\n Rejected,\r\n Disposed,\r\n NotFound,\r\n Cancelled,\r\n NoContent,\r\n BadGateway,\r\n ServiceUnavailable,\r\n GatewayTimeout,\r\n RequestTimeout,\r\n TooManyRequests\r\n}\r\n\r\n/** @public @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future. */\r\nexport namespace RpcRequestStatus { // eslint-disable-line @typescript-eslint/no-redeclare\r\n export function isTransientError(status: RpcRequestStatus) {\r\n return status === RpcRequestStatus.BadGateway || status === RpcRequestStatus.ServiceUnavailable || status === RpcRequestStatus.GatewayTimeout\r\n || status === RpcRequestStatus.RequestTimeout || status === RpcRequestStatus.TooManyRequests;\r\n }\r\n}\r\n\r\n/** RPC request event types.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\r\n */\r\nexport enum RpcRequestEvent {\r\n StatusChanged,\r\n PendingUpdateReceived,\r\n TransientErrorReceived\r\n}\r\n\r\n/** RPC content types.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\r\n */\r\nexport enum RpcContentType {\r\n Unknown,\r\n Text,\r\n Binary,\r\n Multipart,\r\n Stream,\r\n}\r\n\r\n/** Endpoints for RPC protocols.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\r\n */\r\nexport enum RpcEndpoint {\r\n Frontend,\r\n Backend,\r\n}\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\n\r\n/** @internal */\r\nexport const WEB_RPC_CONSTANTS = {\r\n CONTENT: \"Content-Type\",\r\n TEXT: \"text/plain\",\r\n ANY_TEXT: \"text/\",\r\n BINARY: \"application/octet-stream\",\r\n MULTIPART: \"multipart/form-data\",\r\n};\r\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 version 5.0.
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;;GAEG;;;AAEH,uDAAoD;AAwIpD;;GAEG;AACH,MAAa,qBAAqB;IAIhC,iDAAiD;IACjD,IAAW,KAAK;QACd,MAAM,KAAK,GAAiB,EAAE,CAAC;QAE/B,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YAC9D,2BAAY,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE;gBAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;gBACxE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;YACpD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;IAED,oGAAoG;IACpG,IAAW,QAAQ;QACjB,OAAO;YACL,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;YACxB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;IACJ,CAAC;IAED,yDAAyD;IACzD,YAAmB,QAA2B;QAC5C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,wBAAwB;IACjB,MAAM;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAEO,mBAAmB,CAAC,SAAuB;QACjD,MAAM,cAAc,GAAsB,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QAChG,MAAM,eAAe,GAAsB,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;QAElG,MAAM,WAAW,GAAoB,EAAE,CAAC;QAExC,WAAW,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;AAzDD,sDAyDC","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 { RpcOperation } from \"../core/RpcOperation\";\r\nimport { WebAppRpcProtocol } from \"./WebAppRpcProtocol\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** An OpenAPI 3.0 root document object.\r\n * @internal\r\n */\r\nexport interface OpenAPIDocument {\r\n openapi: \"3.0.0\";\r\n info: OpenAPIInfo;\r\n paths: OpenAPIPaths;\r\n}\r\n\r\n/** An OpenAPI 3.0 info object.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.\r\n */\r\nexport interface OpenAPIInfo {\r\n title: string;\r\n version: string;\r\n}\r\n\r\n/** An OpenAPI 3.0 paths object.\r\n * @internal\r\n */\r\nexport interface OpenAPIPaths {\r\n [index: string]: OpenAPIPathItem;\r\n}\r\n\r\n/** An OpenAPI 3.0 path item object.\r\n * @internal\r\n */\r\nexport interface OpenAPIPathItem {\r\n summary?: string;\r\n get?: OpenAPIOperation;\r\n put?: OpenAPIOperation;\r\n post?: OpenAPIOperation;\r\n delete?: OpenAPIOperation;\r\n options?: OpenAPIOperation;\r\n head?: OpenAPIOperation;\r\n patch?: OpenAPIOperation;\r\n trace?: OpenAPIOperation;\r\n parameters?: OpenAPIParameter[];\r\n}\r\n\r\n/** An OpenAPI 3.0 operation object.\r\n * @internal\r\n */\r\nexport interface OpenAPIOperation {\r\n summary?: string;\r\n operationId?: string;\r\n parameters?: OpenAPIParameter[];\r\n requestBody?: OpenAPIRequestBody;\r\n responses: OpenAPIResponses;\r\n}\r\n\r\n/** An OpenAPI 3.0 content map.\r\n * @internal\r\n */\r\nexport interface OpenAPIContentMap {\r\n [index: string]: OpenAPIMediaType;\r\n}\r\n\r\n/** An OpenAPI 3.0 parameter object.\r\n * @internal\r\n */\r\nexport interface OpenAPIParameter {\r\n name: string;\r\n in: \"query\" | \"header\" | \"path\" | \"cookie\";\r\n description?: string;\r\n required?: boolean;\r\n allowEmptyValue?: boolean;\r\n style?: \"matrix\" | \"label\" | \"form\" | \"simple\" | \"spaceDelimited\" | \"pipeDelimited\" | \"deepObject\";\r\n explode?: boolean;\r\n allowReserved?: boolean;\r\n schema?: OpenAPISchema;\r\n content?: OpenAPIContentMap;\r\n}\r\n\r\n/** An OpenAPI 3.0 media type object.\r\n * @internal\r\n */\r\nexport interface OpenAPIMediaType {\r\n schema?: OpenAPISchema;\r\n}\r\n\r\n/** An OpenAPI 3.0 schema object.\r\n * @internal\r\n */\r\nexport interface OpenAPISchema {\r\n type?: \"boolean\" | \"object\" | \"array\" | \"number\" | \"string\";\r\n nullable?: boolean;\r\n description?: string;\r\n}\r\n\r\n/** An OpenAPI 3.0 encoding object.\r\n * @internal\r\n */\r\nexport interface OpenAPIEncoding {\r\n contentType?: string;\r\n style?: string;\r\n explode?: boolean;\r\n allowReserved?: boolean;\r\n}\r\n\r\n/** An OpenAPI 3.0 parameter object.\r\n * @internal\r\n */\r\nexport interface OpenAPIRequestBody {\r\n description?: string;\r\n content: OpenAPIContentMap;\r\n required?: boolean;\r\n}\r\n\r\n/** An OpenAPI 3.0 responses object.\r\n * @internal\r\n */\r\nexport interface OpenAPIResponses {\r\n default?: OpenAPIResponse;\r\n \"200\"?: OpenAPIResponse;\r\n \"301\"?: OpenAPIResponse;\r\n \"302\"?: OpenAPIResponse;\r\n \"400\"?: OpenAPIResponse;\r\n \"404\"?: OpenAPIResponse;\r\n \"500\"?: OpenAPIResponse;\r\n}\r\n\r\n/** An OpenAPI 3.0 response object.\r\n * @internal\r\n */\r\nexport interface OpenAPIResponse {\r\n description: string;\r\n content?: { [index: string]: OpenAPIMediaType };\r\n}\r\n\r\n/** An OpenAPI-compatible description of an RPC protocol.\r\n * @internal\r\n */\r\nexport class RpcOpenAPIDescription {\r\n /** The protocol for this description. */\r\n public readonly protocol: WebAppRpcProtocol;\r\n\r\n /** The OpenAPI paths object for the protocol. */\r\n public get paths(): OpenAPIPaths {\r\n const paths: OpenAPIPaths = {};\r\n\r\n this.protocol.configuration.interfaces().forEach((definition) => {\r\n RpcOperation.forEach(definition, (operation) => {\r\n const path = this.protocol.supplyPathForOperation(operation, undefined);\r\n paths[path] = this.generateDescription(operation);\r\n });\r\n });\r\n\r\n return paths;\r\n }\r\n\r\n /** An OpenAPI 3.0 (Swagger) description of the RESTful API that is exposed through the protocol. */\r\n public get document(): OpenAPIDocument {\r\n return {\r\n openapi: \"3.0.0\",\r\n info: this.protocol.info,\r\n paths: this.paths,\r\n };\r\n }\r\n\r\n /** Creates an OpenAPI description of an RPC protocol. */\r\n public constructor(protocol: WebAppRpcProtocol) {\r\n this.protocol = protocol;\r\n }\r\n\r\n /** Converts to JSON. */\r\n public toJSON() {\r\n return this.document;\r\n }\r\n\r\n private generateDescription(operation: RpcOperation): OpenAPIPathItem {\r\n const requestContent: OpenAPIContentMap = { \"application/json\": { schema: { type: \"array\" } } };\r\n const responseContent: OpenAPIContentMap = { \"application/json\": { schema: { type: \"object\" } } };\r\n\r\n const description: OpenAPIPathItem = {};\r\n\r\n description.head = {\r\n requestBody: { content: requestContent, required: true },\r\n responses: {\r\n 200: { description: \"Success\", content: responseContent },\r\n default: { description: \"Error\", content: responseContent },\r\n },\r\n };\r\n\r\n const parameters = this.protocol.supplyPathParametersForOperation(operation);\r\n if (parameters.length)\r\n description.parameters = parameters;\r\n\r\n return description;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"OpenAPI.js","sourceRoot":"","sources":["../../../../src/rpc/web/OpenAPI.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,uDAAoD;AAwIpD;;GAEG;AACH,MAAa,qBAAqB;IAIhC,iDAAiD;IACjD,IAAW,KAAK;QACd,MAAM,KAAK,GAAiB,EAAE,CAAC;QAE/B,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YAC9D,2BAAY,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE;gBAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;gBACxE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;YACpD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;IAED,oGAAoG;IACpG,IAAW,QAAQ;QACjB,OAAO;YACL,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;YACxB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;IACJ,CAAC;IAED,yDAAyD;IACzD,YAAmB,QAA2B;QAC5C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,wBAAwB;IACjB,MAAM;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAEO,mBAAmB,CAAC,SAAuB;QACjD,MAAM,cAAc,GAAsB,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QAChG,MAAM,eAAe,GAAsB,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;QAElG,MAAM,WAAW,GAAoB,EAAE,CAAC;QAExC,WAAW,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;AAzDD,sDAyDC","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 { RpcOperation } from \"../core/RpcOperation\";\r\nimport { WebAppRpcProtocol } from \"./WebAppRpcProtocol\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** An OpenAPI 3.0 root document object.\r\n * @internal\r\n */\r\nexport interface OpenAPIDocument {\r\n openapi: \"3.0.0\";\r\n info: OpenAPIInfo;\r\n paths: OpenAPIPaths;\r\n}\r\n\r\n/** An OpenAPI 3.0 info object.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\r\n */\r\nexport interface OpenAPIInfo {\r\n title: string;\r\n version: string;\r\n}\r\n\r\n/** An OpenAPI 3.0 paths object.\r\n * @internal\r\n */\r\nexport interface OpenAPIPaths {\r\n [index: string]: OpenAPIPathItem;\r\n}\r\n\r\n/** An OpenAPI 3.0 path item object.\r\n * @internal\r\n */\r\nexport interface OpenAPIPathItem {\r\n summary?: string;\r\n get?: OpenAPIOperation;\r\n put?: OpenAPIOperation;\r\n post?: OpenAPIOperation;\r\n delete?: OpenAPIOperation;\r\n options?: OpenAPIOperation;\r\n head?: OpenAPIOperation;\r\n patch?: OpenAPIOperation;\r\n trace?: OpenAPIOperation;\r\n parameters?: OpenAPIParameter[];\r\n}\r\n\r\n/** An OpenAPI 3.0 operation object.\r\n * @internal\r\n */\r\nexport interface OpenAPIOperation {\r\n summary?: string;\r\n operationId?: string;\r\n parameters?: OpenAPIParameter[];\r\n requestBody?: OpenAPIRequestBody;\r\n responses: OpenAPIResponses;\r\n}\r\n\r\n/** An OpenAPI 3.0 content map.\r\n * @internal\r\n */\r\nexport interface OpenAPIContentMap {\r\n [index: string]: OpenAPIMediaType;\r\n}\r\n\r\n/** An OpenAPI 3.0 parameter object.\r\n * @internal\r\n */\r\nexport interface OpenAPIParameter {\r\n name: string;\r\n in: \"query\" | \"header\" | \"path\" | \"cookie\";\r\n description?: string;\r\n required?: boolean;\r\n allowEmptyValue?: boolean;\r\n style?: \"matrix\" | \"label\" | \"form\" | \"simple\" | \"spaceDelimited\" | \"pipeDelimited\" | \"deepObject\";\r\n explode?: boolean;\r\n allowReserved?: boolean;\r\n schema?: OpenAPISchema;\r\n content?: OpenAPIContentMap;\r\n}\r\n\r\n/** An OpenAPI 3.0 media type object.\r\n * @internal\r\n */\r\nexport interface OpenAPIMediaType {\r\n schema?: OpenAPISchema;\r\n}\r\n\r\n/** An OpenAPI 3.0 schema object.\r\n * @internal\r\n */\r\nexport interface OpenAPISchema {\r\n type?: \"boolean\" | \"object\" | \"array\" | \"number\" | \"string\";\r\n nullable?: boolean;\r\n description?: string;\r\n}\r\n\r\n/** An OpenAPI 3.0 encoding object.\r\n * @internal\r\n */\r\nexport interface OpenAPIEncoding {\r\n contentType?: string;\r\n style?: string;\r\n explode?: boolean;\r\n allowReserved?: boolean;\r\n}\r\n\r\n/** An OpenAPI 3.0 parameter object.\r\n * @internal\r\n */\r\nexport interface OpenAPIRequestBody {\r\n description?: string;\r\n content: OpenAPIContentMap;\r\n required?: boolean;\r\n}\r\n\r\n/** An OpenAPI 3.0 responses object.\r\n * @internal\r\n */\r\nexport interface OpenAPIResponses {\r\n default?: OpenAPIResponse;\r\n \"200\"?: OpenAPIResponse;\r\n \"301\"?: OpenAPIResponse;\r\n \"302\"?: OpenAPIResponse;\r\n \"400\"?: OpenAPIResponse;\r\n \"404\"?: OpenAPIResponse;\r\n \"500\"?: OpenAPIResponse;\r\n}\r\n\r\n/** An OpenAPI 3.0 response object.\r\n * @internal\r\n */\r\nexport interface OpenAPIResponse {\r\n description: string;\r\n content?: { [index: string]: OpenAPIMediaType };\r\n}\r\n\r\n/** An OpenAPI-compatible description of an RPC protocol.\r\n * @internal\r\n */\r\nexport class RpcOpenAPIDescription {\r\n /** The protocol for this description. */\r\n public readonly protocol: WebAppRpcProtocol;\r\n\r\n /** The OpenAPI paths object for the protocol. */\r\n public get paths(): OpenAPIPaths {\r\n const paths: OpenAPIPaths = {};\r\n\r\n this.protocol.configuration.interfaces().forEach((definition) => {\r\n RpcOperation.forEach(definition, (operation) => {\r\n const path = this.protocol.supplyPathForOperation(operation, undefined);\r\n paths[path] = this.generateDescription(operation);\r\n });\r\n });\r\n\r\n return paths;\r\n }\r\n\r\n /** An OpenAPI 3.0 (Swagger) description of the RESTful API that is exposed through the protocol. */\r\n public get document(): OpenAPIDocument {\r\n return {\r\n openapi: \"3.0.0\",\r\n info: this.protocol.info,\r\n paths: this.paths,\r\n };\r\n }\r\n\r\n /** Creates an OpenAPI description of an RPC protocol. */\r\n public constructor(protocol: WebAppRpcProtocol) {\r\n this.protocol = protocol;\r\n }\r\n\r\n /** Converts to JSON. */\r\n public toJSON() {\r\n return this.document;\r\n }\r\n\r\n private generateDescription(operation: RpcOperation): OpenAPIPathItem {\r\n const requestContent: OpenAPIContentMap = { \"application/json\": { schema: { type: \"array\" } } };\r\n const responseContent: OpenAPIContentMap = { \"application/json\": { schema: { type: \"object\" } } };\r\n\r\n const description: OpenAPIPathItem = {};\r\n\r\n description.head = {\r\n requestBody: { content: requestContent, required: true },\r\n responses: {\r\n 200: { description: \"Success\", content: responseContent },\r\n default: { description: \"Error\", content: responseContent },\r\n },\r\n };\r\n\r\n const parameters = this.protocol.supplyPathParametersForOperation(operation);\r\n if (parameters.length)\r\n description.parameters = parameters;\r\n\r\n return description;\r\n }\r\n}\r\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 version 5.0.
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 version 5.0.
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,sDAA2D;AAC3D,qEAAkE;AAGlE,uDAA2F;AAE3F,qDAAwE;AACxE,uCAAiF;AACjF,yDAAsD;AACtD,yDAAsD;AA6CtD;;GAEG;AACH,MAAsB,iBAAkB,SAAQ,yBAAW;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,mCAAgB,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC1D;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,OAAO,GAAG,2BAAY,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YACpD,qBAAM,CAAC,QAAQ,CAAC,2CAAoB,CAAC,mBAAmB,EAAE,4BAA4B,OAAO,EAAE,EAAE,2BAAY,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;YACvI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAChB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YACrD,OAAO;SACR;QACD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAChD,MAAM,mCAAgB,CAAC,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tB,CAAC;IAED;;OAEG;IACH,IAAW,kBAAkB,KAAK,OAAO,IAAI,+BAAqB,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,mCAAgB,CAAC;QAoC/B,2BAAsB,GAAG,IAAI,CAAC;QAoB5C,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,mCAAgB,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACrG,CAAC;CACF;AA/GD,8CA+GC","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 * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.\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 trailersDistinct: NodeJS.Dict<string[]>;\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 headersDistinct: NodeJS.Dict<string[]>;\r\n}\r\n\r\n/** An HTTP server response object.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in version 5.0.\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(async (event, object) => WebAppRpcLogging.logProtocolEvent(event, object));\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,sDAA2D;AAC3D,qEAAkE;AAGlE,uDAA2F;AAE3F,qDAAwE;AACxE,uCAAiF;AACjF,yDAAsD;AACtD,yDAAsD;AA6CtD;;GAEG;AACH,MAAsB,iBAAkB,SAAQ,yBAAW;IAGzD,+EAA+E;IACxE,KAAK,CAAC,yBAAyB,CAAC,GAAsB,EAAE,GAAuB;QACpF,OAAO,IAAI,CAAC,0BAA0B,CAAC,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CAAC;IACrG,CAAC;CACF;AA/GD,8CA+GC","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 * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\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 trailersDistinct: NodeJS.Dict<string[]>;\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 headersDistinct: NodeJS.Dict<string[]>;\r\n}\r\n\r\n/** An HTTP server response object.\r\n * @public\r\n * @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.\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(async (event, object) => WebAppRpcLogging.logProtocolEvent(event, object));\r\n }\r\n}\r\n"]}