@itwin/core-common 5.0.0-dev.32 → 5.0.0-dev.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/AmbientOcclusion.js +9 -9
- package/lib/cjs/AmbientOcclusion.js.map +1 -1
- package/lib/cjs/AnalysisStyle.js +1 -1
- package/lib/cjs/AnalysisStyle.js.map +1 -1
- package/lib/cjs/Atmosphere.js +19 -21
- package/lib/cjs/Atmosphere.js.map +1 -1
- package/lib/cjs/ClipStyle.js +5 -5
- package/lib/cjs/ClipStyle.js.map +1 -1
- package/lib/cjs/ColorDef.js +10 -10
- package/lib/cjs/ColorDef.js.map +1 -1
- package/lib/cjs/ContourDisplay.js +5 -5
- package/lib/cjs/ContourDisplay.js.map +1 -1
- package/lib/cjs/ECSqlReader.js +1 -1
- package/lib/cjs/ECSqlReader.js.map +1 -1
- package/lib/cjs/ElementProps.js +2 -2
- package/lib/cjs/ElementProps.js.map +1 -1
- package/lib/cjs/Environment.js +2 -2
- package/lib/cjs/Environment.js.map +1 -1
- package/lib/cjs/FeatureSymbology.js +3 -3
- package/lib/cjs/FeatureSymbology.js.map +1 -1
- package/lib/cjs/Gradient.js +9 -9
- package/lib/cjs/Gradient.js.map +1 -1
- package/lib/cjs/GroundPlane.js +2 -2
- package/lib/cjs/GroundPlane.js.map +1 -1
- package/lib/cjs/HiddenLine.js +4 -4
- package/lib/cjs/HiddenLine.js.map +1 -1
- package/lib/cjs/IModel.js +6 -6
- package/lib/cjs/IModel.js.map +1 -1
- package/lib/cjs/LightSettings.js +1 -1
- package/lib/cjs/LightSettings.js.map +1 -1
- package/lib/cjs/PlanarClipMask.js +2 -2
- package/lib/cjs/PlanarClipMask.js.map +1 -1
- package/lib/cjs/RealityModelDisplaySettings.js +4 -4
- package/lib/cjs/RealityModelDisplaySettings.js.map +1 -1
- package/lib/cjs/RenderMaterial.js +3 -3
- package/lib/cjs/RenderMaterial.js.map +1 -1
- package/lib/cjs/SkyBox.js +4 -4
- package/lib/cjs/SkyBox.js.map +1 -1
- package/lib/cjs/SolarShadows.js +1 -1
- package/lib/cjs/SolarShadows.js.map +1 -1
- package/lib/cjs/SubCategoryAppearance.js +1 -1
- package/lib/cjs/SubCategoryAppearance.js.map +1 -1
- package/lib/cjs/SubCategoryOverride.js +2 -2
- package/lib/cjs/SubCategoryOverride.js.map +1 -1
- package/lib/cjs/TextureMapping.js +2 -2
- package/lib/cjs/TextureMapping.js.map +1 -1
- package/lib/cjs/ThematicDisplay.js +2 -2
- package/lib/cjs/ThematicDisplay.js.map +1 -1
- package/lib/cjs/ViewDetails.js +2 -2
- package/lib/cjs/ViewDetails.js.map +1 -1
- package/lib/cjs/ViewFlags.js +2 -2
- package/lib/cjs/ViewFlags.js.map +1 -1
- package/lib/cjs/WhiteOnWhiteReversalSettings.js +2 -2
- package/lib/cjs/WhiteOnWhiteReversalSettings.js.map +1 -1
- package/lib/cjs/annotation/TextStyle.js +19 -19
- package/lib/cjs/annotation/TextStyle.js.map +1 -1
- package/lib/cjs/geometry/Cartographic.js +13 -13
- package/lib/cjs/geometry/Cartographic.js.map +1 -1
- package/lib/cjs/ipc/IpcWebSocket.js +1 -1
- package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
- package/lib/cjs/ipc/IpcWebSocketTransport.js +1 -1
- package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
- package/lib/cjs/rpc/DevToolsRpcInterface.js +6 -6
- package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.js +4 -4
- package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/IModelTileRpcInterface.js +4 -4
- package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.js +4 -4
- package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/core/RpcConfiguration.js +32 -34
- package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
- package/lib/cjs/rpc/core/RpcControl.js +8 -15
- package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
- package/lib/cjs/rpc/core/RpcInvocation.js +3 -5
- package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/cjs/rpc/core/RpcOperation.js +2 -2
- package/lib/cjs/rpc/core/RpcOperation.js.map +1 -1
- package/lib/cjs/rpc/core/RpcProtocol.js +4 -4
- package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
- package/lib/cjs/rpc/core/RpcPush.js +5 -5
- package/lib/cjs/rpc/core/RpcPush.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRequest.js +5 -5
- package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRoutingToken.js +2 -2
- package/lib/cjs/rpc/core/RpcRoutingToken.js.map +1 -1
- package/lib/cjs/rpc/core/RpcSessionInvocation.js +1 -1
- package/lib/cjs/rpc/core/RpcSessionInvocation.js.map +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcManager.js +6 -6
- package/lib/cjs/rpc/web/BentleyCloudRpcManager.js.map +1 -1
- package/lib/cjs/rpc/web/RpcMultipart.js +12 -12
- package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcRequest.js +17 -19
- package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
- package/lib/cjs/tile/IModelTileIO.js +1 -1
- package/lib/cjs/tile/IModelTileIO.js.map +1 -1
- package/lib/esm/AmbientOcclusion.js +9 -9
- package/lib/esm/AmbientOcclusion.js.map +1 -1
- package/lib/esm/AnalysisStyle.js +1 -1
- package/lib/esm/AnalysisStyle.js.map +1 -1
- package/lib/esm/Atmosphere.js +19 -21
- package/lib/esm/Atmosphere.js.map +1 -1
- package/lib/esm/ClipStyle.js +5 -5
- package/lib/esm/ClipStyle.js.map +1 -1
- package/lib/esm/ColorDef.js +10 -10
- package/lib/esm/ColorDef.js.map +1 -1
- package/lib/esm/ContourDisplay.js +5 -5
- package/lib/esm/ContourDisplay.js.map +1 -1
- package/lib/esm/ECSqlReader.js +1 -1
- package/lib/esm/ECSqlReader.js.map +1 -1
- package/lib/esm/ElementProps.js +2 -2
- package/lib/esm/ElementProps.js.map +1 -1
- package/lib/esm/Environment.js +2 -2
- package/lib/esm/Environment.js.map +1 -1
- package/lib/esm/FeatureSymbology.js +3 -3
- package/lib/esm/FeatureSymbology.js.map +1 -1
- package/lib/esm/Gradient.js +9 -9
- package/lib/esm/Gradient.js.map +1 -1
- package/lib/esm/GroundPlane.js +2 -2
- package/lib/esm/GroundPlane.js.map +1 -1
- package/lib/esm/HiddenLine.js +4 -4
- package/lib/esm/HiddenLine.js.map +1 -1
- package/lib/esm/IModel.js +6 -6
- package/lib/esm/IModel.js.map +1 -1
- package/lib/esm/LightSettings.js +1 -1
- package/lib/esm/LightSettings.js.map +1 -1
- package/lib/esm/PlanarClipMask.js +2 -2
- package/lib/esm/PlanarClipMask.js.map +1 -1
- package/lib/esm/RealityModelDisplaySettings.js +4 -4
- package/lib/esm/RealityModelDisplaySettings.js.map +1 -1
- package/lib/esm/RenderMaterial.js +3 -3
- package/lib/esm/RenderMaterial.js.map +1 -1
- package/lib/esm/SkyBox.js +4 -4
- package/lib/esm/SkyBox.js.map +1 -1
- package/lib/esm/SolarShadows.js +1 -1
- package/lib/esm/SolarShadows.js.map +1 -1
- package/lib/esm/SubCategoryAppearance.js +1 -1
- package/lib/esm/SubCategoryAppearance.js.map +1 -1
- package/lib/esm/SubCategoryOverride.js +2 -2
- package/lib/esm/SubCategoryOverride.js.map +1 -1
- package/lib/esm/TextureMapping.js +2 -2
- package/lib/esm/TextureMapping.js.map +1 -1
- package/lib/esm/ThematicDisplay.js +2 -2
- package/lib/esm/ThematicDisplay.js.map +1 -1
- package/lib/esm/ViewDetails.js +2 -2
- package/lib/esm/ViewDetails.js.map +1 -1
- package/lib/esm/ViewFlags.js +2 -2
- package/lib/esm/ViewFlags.js.map +1 -1
- package/lib/esm/WhiteOnWhiteReversalSettings.js +2 -2
- package/lib/esm/WhiteOnWhiteReversalSettings.js.map +1 -1
- package/lib/esm/annotation/TextStyle.js +19 -19
- package/lib/esm/annotation/TextStyle.js.map +1 -1
- package/lib/esm/geometry/Cartographic.js +13 -13
- package/lib/esm/geometry/Cartographic.js.map +1 -1
- package/lib/esm/ipc/IpcWebSocket.js +1 -1
- package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
- package/lib/esm/ipc/IpcWebSocketTransport.js +1 -1
- package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
- package/lib/esm/rpc/DevToolsRpcInterface.js +6 -6
- package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.js +4 -4
- package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/esm/rpc/IModelTileRpcInterface.js +4 -4
- package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/esm/rpc/SnapshotIModelRpcInterface.js +4 -4
- package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
- package/lib/esm/rpc/core/RpcConfiguration.js +32 -34
- package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
- package/lib/esm/rpc/core/RpcControl.js +8 -15
- package/lib/esm/rpc/core/RpcControl.js.map +1 -1
- package/lib/esm/rpc/core/RpcInvocation.js +3 -5
- package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/esm/rpc/core/RpcOperation.js +2 -2
- package/lib/esm/rpc/core/RpcOperation.js.map +1 -1
- package/lib/esm/rpc/core/RpcProtocol.js +4 -4
- package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
- package/lib/esm/rpc/core/RpcPush.js +5 -5
- package/lib/esm/rpc/core/RpcPush.js.map +1 -1
- package/lib/esm/rpc/core/RpcRequest.js +5 -5
- package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
- package/lib/esm/rpc/core/RpcRoutingToken.js +2 -2
- package/lib/esm/rpc/core/RpcRoutingToken.js.map +1 -1
- package/lib/esm/rpc/core/RpcSessionInvocation.js +1 -1
- package/lib/esm/rpc/core/RpcSessionInvocation.js.map +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcManager.js +6 -6
- package/lib/esm/rpc/web/BentleyCloudRpcManager.js.map +1 -1
- package/lib/esm/rpc/web/RpcMultipart.js +12 -12
- package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcRequest.js +17 -19
- package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
- package/lib/esm/tile/IModelTileIO.js +1 -1
- package/lib/esm/tile/IModelTileIO.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcRequest.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcRequest.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmE;AAEnE,mDAA8E;AAE9E,yDAAsD;AACtD,iDAA8G;AAE9G,mDAAoE;AACpE,iDAA8C;AAC9C,+CAAkF;AAClF,+CAAgD;AAEhD,yDAAyD;AACzD,qBAAqB;AACrB,qDAAqD;AAErD,gBAAgB;AACH,QAAA,aAAa,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;AAEjE,gBAAgB;AAChB,MAAa,YAAY;IAEvB,IAAW,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,WAAW,KAA2B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,KAAK,CAAC,IAAI,KAAoB,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAC/F,KAAK,CAAC,QAAQ,KAAwB,MAAM,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CAAC,OAAO,CAAC;gBAC9B,KAAK,+BAAgB,CAAC,QAAQ,CAAC;gBAC/B,KAAK,+BAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAC/B,qBAAa,CAAC,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;oBACjD,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,yBAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;YACtC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;YAEjC,QAAQ,IAAI,EAAE,CAAC;gBACb,KAAK,+BAAgB,CAAC,eAAe,CAAC,CAAC,CAAC;oBACtC,qBAAa,CAAC,WAAW,GAAG,GAAG,CAAC;oBAChC,MAAM;gBACR,CAAC;gBAED,KAAK,+BAAgB,CAAC,sBAAsB,CAAC;gBAC7C,KAAK,+BAAgB,CAAC,oBAAoB,CAAC;gBAC3C,KAAK,+BAAgB,CAAC,sBAAsB,CAAC,CAAC,CAAC;oBAC7C,qBAAa,CAAC,YAAY,GAAG,GAAG,CAAC;oBACjC,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BeEvent, BentleyStatus, Guid } from \"@itwin/core-bentley\";\nimport { IModelRpcProps } from \"../../IModel\";\nimport { BackendError, IModelError, NoContentError } from \"../../IModelError\";\nimport { RpcInterface } from \"../../RpcInterface\";\nimport { RpcConfiguration } from \"./RpcConfiguration\";\nimport { RpcProtocolEvent, RpcRequestEvent, RpcRequestStatus, RpcResponseCacheControl } from \"./RpcConstants\";\nimport { RpcNotFoundResponse } from \"./RpcControl\";\nimport { RpcMarshaling, RpcSerializedValue } from \"./RpcMarshaling\";\nimport { RpcOperation } from \"./RpcOperation\";\nimport { RpcManagedStatus, RpcProtocol, RpcProtocolVersion } from \"./RpcProtocol\";\nimport { CURRENT_REQUEST } from \"./RpcRegistry\";\n\n/* eslint-disable @typescript-eslint/naming-convention */\n// cspell:ignore csrf\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** @internal */\nexport const aggregateLoad = { lastRequest: 0, lastResponse: 0 };\n\n/** @internal */\nexport class ResponseLike implements Response {\n private _data: Promise<any>;\n public get body() { return null; }\n public async arrayBuffer(): Promise<ArrayBuffer> { return this._data; }\n public async blob(): Promise<Blob> { throw new IModelError(BentleyStatus.ERROR, \"Not implemented.\"); }\n public async formData(): Promise<FormData> { throw new IModelError(BentleyStatus.ERROR, \"Not implemented.\"); }\n public async json(): Promise<any> { return this._data; }\n public async text(): Promise<string> { return this._data; }\n public get bodyUsed() { return false; }\n public get headers(): Headers { throw new IModelError(BentleyStatus.ERROR, \"Not implemented.\"); }\n public get ok(): boolean { return this.status >= 200 && this.status <= 299; }\n public get redirected() { return false; }\n public get status() { return 200; }\n public get statusText() { return \"\"; }\n public get trailer(): Promise<Headers> { throw new IModelError(BentleyStatus.ERROR, \"Not implemented.\"); }\n public get type(): ResponseType { return \"basic\"; }\n public get url() { return \"\"; }\n public clone() { return { ...this }; }\n\n public constructor(data: any) {\n this._data = Promise.resolve(data);\n }\n}\n\n/** Supplies an IModelRpcProps for an RPC request.\n * @internal\n */\nexport type RpcRequestTokenSupplier_T = (request: RpcRequest) => IModelRpcProps | undefined;\n\n/** Supplies the initial retry interval for an RPC request.\n * @internal\n */\nexport type RpcRequestInitialRetryIntervalSupplier_T = (configuration: RpcConfiguration) => number;\n\n/** Notification callback for an RPC request.\n * @internal\n */\nexport type RpcRequestCallback_T = (request: RpcRequest) => void;\n\n/** Determines if caching is permitted for a RPC response.\n * @internal\n */\nexport type RpcResponseCachingCallback_T = (request: RpcRequest) => RpcResponseCacheControl;\n\n/** Runtime information related to the operation load of one or more RPC interfaces.\n * @internal\n */\nexport interface RpcOperationsProfile {\n readonly lastRequest: number;\n readonly lastResponse: number;\n}\n\n/** Handles RPC request events.\n * @internal\n */\nexport type RpcRequestEventHandler = (type: RpcRequestEvent, request: RpcRequest) => void;\n\n/** Resolves \"not found\" responses for RPC requests.\n * @internal\n */\nexport type RpcRequestNotFoundHandler = (request: RpcRequest, response: RpcNotFoundResponse, resubmit: () => void, reject: (reason?: any) => void) => void;\n\nclass Cancellable<T> {\n public promise: Promise<T | undefined>;\n public cancel() { }\n\n public constructor(task: Promise<T>) {\n this.promise = new Promise((resolve, reject) => {\n this.cancel = () => resolve(undefined);\n task.then(resolve, reject);\n });\n }\n}\n\n/** A RPC operation request.\n * @internal\n */\nexport abstract class RpcRequest<TResponse = any> {\n private static _activeRequests: Map<string, RpcRequest> = new Map();\n private _resolve: (value?: TResponse | PromiseLike<TResponse> | undefined) => void = () => undefined;\n protected _resolveRaw: (value?: Response | PromiseLike<Response> | undefined) => void = () => undefined;\n private _reject: (reason?: any) => void = () => undefined;\n private _rejectRaw: (reason?: any) => void = () => undefined;\n private _created: number = 0;\n private _lastSubmitted: number = 0;\n private _lastUpdated: number = 0;\n\n /** @internal */\n public _status: RpcRequestStatus = RpcRequestStatus.Unknown;\n\n /** @internal */\n public _extendedStatus: string = \"\";\n\n private _connecting: boolean = false;\n private _active: boolean = true;\n private _hasRawListener = false;\n private _raw: ArrayBuffer | string | undefined = undefined;\n private _sending?: Cancellable<number>;\n private _attempts = 0;\n private _retryAfter: number | null = null;\n private _transientFaults = 0;\n protected _response: Response | undefined = undefined;\n protected _rawPromise: Promise<Response | undefined>;\n public responseProtocolVersion = RpcProtocolVersion.None;\n\n /** All RPC requests that are currently in flight. */\n public static get activeRequests(): ReadonlyMap<string, RpcRequest> { return this._activeRequests; }\n\n /** Events raised by RpcRequest. See [[RpcRequestEvent]] */\n public static readonly events: BeEvent<RpcRequestEventHandler> = new BeEvent();\n\n /** Resolvers for \"not found\" requests. See [[RpcRequestNotFoundHandler]] */\n public static readonly notFoundHandlers: BeEvent<RpcRequestNotFoundHandler> = new BeEvent();\n\n /** The aggregate operations profile of all active RPC interfaces. */\n public static get aggregateLoad(): RpcOperationsProfile { return aggregateLoad; }\n\n /**\n * The request for the current RPC operation.\n * @note The return value of this function is only reliable if program control was received from a RPC interface class member function that directly returns the result of calling RpcInterface.forward.\n */\n public static current(context: RpcInterface): RpcRequest {\n return (context as any)[CURRENT_REQUEST];\n }\n\n /** The unique identifier of this request. */\n public readonly id: string;\n\n /** The operation for this request. */\n public readonly operation: RpcOperation;\n\n /** The parameters for this request. */\n public parameters: any[];\n\n /** The RPC client instance for this request. */\n public readonly client: RpcInterface;\n\n /** Convenience access to the protocol of this request. */\n public readonly protocol: RpcProtocol;\n\n /** The implementation response for this request. */\n public readonly response: Promise<TResponse | undefined>;\n\n /** The status of this request. */\n public get status() { return this._status; }\n\n /** Extended status information for this request (if available). */\n public get extendedStatus() { return this._extendedStatus; }\n\n /** The last submission for this request. */\n public get lastSubmitted() { return this._lastSubmitted; }\n\n /** The last status update received for this request. */\n public get lastUpdated() { return this._lastUpdated; }\n\n /** The target interval (in milliseconds) between submission attempts for this request. */\n public retryInterval: number;\n\n /** Whether a connection is active for this request. */\n public get connecting() { return this._connecting; }\n\n /** Whether this request is pending. */\n public get pending(): boolean {\n switch (this.status) {\n case RpcRequestStatus.Submitted:\n case RpcRequestStatus.Pending: {\n return true;\n }\n\n default: {\n return false;\n }\n }\n }\n\n /** The elapsed time for this request. */\n public get elapsed(): number {\n return this._lastUpdated - this._created;\n }\n\n /** A protocol-specific path identifier for this request. */\n public path: string;\n\n /** A protocol-specific method identifier for this request. */\n public method: string;\n\n /** An attempt-specific value for when to next retry this request. */\n public get retryAfter() { return this._retryAfter; }\n\n /** Finds the first parameter of a given structural type if present. */\n public findParameterOfType<T>(requiredProperties: { [index: string]: string }): T | undefined {\n for (const param of this.parameters) {\n if (typeof (param) === \"object\" && param !== null) {\n for (const prop of Object.getOwnPropertyNames(requiredProperties)) {\n if (prop in param && typeof (param[prop]) === requiredProperties[prop]) {\n return param;\n }\n }\n }\n }\n\n return undefined;\n }\n\n /** Finds the first IModelRpcProps parameter if present. */\n public findTokenPropsParameter(): IModelRpcProps | undefined {\n return this.findParameterOfType({ iModelId: \"string\" });\n\n }\n\n /** The raw implementation response for this request. */\n public get rawResponse(): Promise<Response | undefined> {\n this._hasRawListener = true;\n return this._rawPromise;\n }\n\n /** Constructs an RPC request. */\n public constructor(client: RpcInterface, operation: string, parameters: any[]) {\n this._created = new Date().getTime();\n this.path = \"\";\n this.method = \"\";\n this.client = client;\n this.protocol = client.configuration.protocol;\n this.operation = RpcOperation.lookup(client.constructor as any, operation);\n this.parameters = parameters;\n this.retryInterval = this.operation.policy.retryInterval(client.configuration);\n this.response = new Promise((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n\n this._rawPromise = new Promise((resolve, reject) => {\n this._resolveRaw = resolve;\n this._rejectRaw = reject;\n });\n\n this.id = RpcConfiguration.requestContext.getId(this) || Guid.createValue();\n this.setStatus(RpcRequestStatus.Created);\n this.operation.policy.requestCallback(this);\n }\n\n /** Override to send the request. */\n protected abstract send(): Promise<number>;\n\n /** Override to load response value. */\n protected abstract load(): Promise<RpcSerializedValue>;\n\n /** Override to set request header values. */\n protected abstract setHeader(name: string, value: string): void;\n\n /** Sets the last updated time for the request. */\n protected setLastUpdatedTime() {\n this._lastUpdated = new Date().getTime();\n }\n\n protected computeRetryAfter(attempts: number) {\n return (((Math.pow(2, attempts) - 1) / 2) * 500) + 500;\n }\n\n protected recordTransientFault() {\n ++this._transientFaults;\n }\n\n protected resetTransientFaultCount() {\n this._transientFaults = 0;\n }\n\n protected supportsStatusCategory() {\n if (!this.protocol.supportsStatusCategory) {\n return false;\n }\n\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory && this.responseProtocolVersion >= RpcProtocolVersion.IntroducedStatusCategory;\n }\n\n /* @internal */\n public cancel() {\n if (typeof (this._sending) === \"undefined\") {\n return;\n }\n\n this._sending.cancel();\n this._sending = undefined;\n\n this._connecting = false;\n RpcRequest._activeRequests.delete(this.id);\n this.setStatus(RpcRequestStatus.Cancelled);\n }\n\n /* @internal */\n public async submit(): Promise<void> {\n if (!this._active)\n return;\n\n this._lastSubmitted = new Date().getTime();\n this._retryAfter = null;\n ++this._attempts;\n\n if (this.status === RpcRequestStatus.Created || this.status === RpcRequestStatus.NotFound || this.status === RpcRequestStatus.Cancelled) {\n this.setStatus(RpcRequestStatus.Submitted);\n }\n\n try {\n this._connecting = true;\n RpcRequest._activeRequests.set(this.id, this);\n this.protocol.events.raiseEvent(RpcProtocolEvent.RequestCreated, this);\n this._sending = new Cancellable(this.setHeaders().then(async () => this.send()));\n this.operation.policy.sentCallback(this);\n\n const response = await this._sending.promise;\n if (typeof (response) === \"undefined\") {\n return;\n }\n this._sending = undefined;\n\n const status = this.protocol.getStatus(response);\n\n if (this._hasRawListener && status === RpcRequestStatus.Resolved && typeof (this._response) !== \"undefined\") {\n this._connecting = false;\n RpcRequest._activeRequests.delete(this.id);\n this.resolveRaw();\n } else {\n this.protocol.events.raiseEvent(RpcProtocolEvent.ResponseLoading, this);\n\n if (status === RpcRequestStatus.Unknown) {\n this._connecting = false;\n RpcRequest._activeRequests.delete(this.id);\n this.handleUnknownResponse(response);\n return;\n }\n\n const value = await this.load();\n this.protocol.events.raiseEvent(RpcProtocolEvent.ResponseLoaded, this);\n RpcRequest._activeRequests.delete(this.id);\n this._connecting = false;\n this.handleResponse(response, value);\n }\n } catch (err) {\n this.protocol.events.raiseEvent(RpcProtocolEvent.ConnectionErrorReceived, this, err);\n RpcRequest._activeRequests.delete(this.id);\n this._connecting = false;\n this.reject(err);\n }\n }\n\n protected handleUnknownResponse(code: number) {\n this.reject(new IModelError(BentleyStatus.ERROR, `Unknown response ${code}.`));\n }\n\n private handleResponse(code: number, value: RpcSerializedValue) {\n const protocolStatus = this.protocol.getStatus(code);\n const status = this.transformResponseStatus(protocolStatus, value);\n\n if (RpcRequestStatus.isTransientError(status)) {\n return this.handleTransientError(status);\n }\n\n switch (status) {\n case RpcRequestStatus.Resolved: {\n return this.handleResolved(value);\n }\n\n case RpcRequestStatus.Rejected: {\n return this.handleRejected(value);\n }\n\n case RpcRequestStatus.Pending: {\n return this.setPending(status, value.objects);\n }\n\n case RpcRequestStatus.NotFound: {\n return this.handleNotFound(status, value);\n }\n\n case RpcRequestStatus.NoContent: {\n return this.handleNoContent();\n }\n }\n }\n\n private transformResponseStatus(protocolStatus: RpcRequestStatus, value: RpcSerializedValue): RpcRequestStatus {\n if (!this.supportsStatusCategory()) {\n return protocolStatus;\n }\n\n let status = protocolStatus;\n\n if (protocolStatus === RpcRequestStatus.Pending) {\n status = RpcRequestStatus.Rejected;\n } else if (protocolStatus === RpcRequestStatus.NotFound) {\n status = RpcRequestStatus.Rejected;\n } else if (protocolStatus === RpcRequestStatus.Unknown) {\n status = RpcRequestStatus.Rejected;\n }\n\n if (value.objects.indexOf(\"iTwinRpcCoreResponse\") !== -1 && value.objects.indexOf(\"managedStatus\") !== -1) {\n const managedStatus: RpcManagedStatus = JSON.parse(value.objects);\n value.objects = managedStatus.responseValue as string;\n\n if (managedStatus.managedStatus === \"pending\") {\n status = RpcRequestStatus.Pending;\n } else if (managedStatus.managedStatus === \"notFound\") {\n status = RpcRequestStatus.NotFound;\n }\n }\n\n return status;\n }\n\n private handleResolved(value: RpcSerializedValue) {\n try {\n this._raw = value.objects;\n const result: TResponse = RpcMarshaling.deserialize(this.protocol, value);\n\n if (ArrayBuffer.isView(result)) {\n this._raw = result.buffer;\n }\n\n return this.resolve(result);\n } catch (err) {\n return this.reject(err);\n }\n }\n\n private handleRejected(value: RpcSerializedValue) {\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendErrorReceived, this);\n\n try {\n const error = RpcMarshaling.deserialize(this.protocol, value);\n const hasInfo = error && typeof (error) === \"object\" && error.hasOwnProperty(\"name\") && error.hasOwnProperty(\"message\");\n const name = hasInfo ? error.name : \"\";\n const message = hasInfo ? error.message : \"\";\n const errorNumber = (hasInfo && error.hasOwnProperty(\"errorNumber\")) ? error.errorNumber : BentleyStatus.ERROR;\n return this.reject(new BackendError(errorNumber, name, message, () => error));\n } catch (err) {\n return this.reject(err);\n }\n }\n\n private handleNoContent() {\n return this.reject(new NoContentError());\n }\n\n private handleNotFound(status: RpcRequestStatus, value: RpcSerializedValue) {\n if (RpcRequest.notFoundHandlers.numberOfListeners === 0)\n this.handleRejected(value);\n\n const response = RpcMarshaling.deserialize(this.protocol, value);\n this.setStatus(status);\n\n let resubmitted = false;\n RpcRequest.notFoundHandlers.raiseEvent(this, response, () => {\n if (resubmitted)\n throw new IModelError(BentleyStatus.ERROR, `Already resubmitted using this handler.`);\n\n resubmitted = true;\n void this.submit();\n }, (reason: any) => reason ? this.reject(reason) : this.handleRejected(value));\n return;\n }\n\n private resolve(result: TResponse): void {\n if (!this._active)\n return;\n\n this._active = false;\n this.setLastUpdatedTime();\n this._resolve(result);\n\n if (this._hasRawListener) {\n if (typeof (this._raw) === \"undefined\") {\n throw new IModelError(BentleyStatus.ERROR, \"Cannot access raw response.\");\n }\n\n this._resolveRaw(new ResponseLike(this._raw));\n }\n\n this.setStatus(RpcRequestStatus.Resolved);\n this.dispose();\n }\n\n private resolveRaw() {\n if (typeof (this._response) === \"undefined\") {\n throw new IModelError(BentleyStatus.ERROR, \"Cannot access raw response.\");\n }\n\n this._active = false;\n this.setLastUpdatedTime();\n this._resolveRaw(this._response);\n this.setStatus(RpcRequestStatus.Resolved);\n this.dispose();\n }\n\n protected reject(reason: any): void {\n if (!this._active)\n return;\n\n this._active = false;\n this.setLastUpdatedTime();\n this._reject(reason);\n\n if (this._hasRawListener) {\n this._rejectRaw(reason);\n }\n\n this.setStatus(RpcRequestStatus.Rejected);\n this.dispose();\n }\n\n /** @internal */\n public dispose(): void {\n this.setStatus(RpcRequestStatus.Disposed);\n this._raw = undefined;\n this._response = undefined;\n\n const client = this.client as any;\n if (client[CURRENT_REQUEST] === this) {\n client[CURRENT_REQUEST] = undefined;\n }\n }\n\n private setPending(status: RpcRequestStatus.Pending, extendedStatus: string): void {\n if (!this._active)\n return;\n\n this.setLastUpdatedTime();\n this._extendedStatus = extendedStatus;\n this.setStatus(status);\n RpcRequest.events.raiseEvent(RpcRequestEvent.PendingUpdateReceived, this);\n }\n\n private handleTransientError(status: RpcRequestStatus) {\n if (!this._active)\n return;\n\n this.setLastUpdatedTime();\n this._retryAfter = this.computeRetryAfter(this._attempts - 1);\n\n if (this._transientFaults > this.protocol.configuration.transientFaultLimit) {\n this.reject(new IModelError(BentleyStatus.ERROR, `Exceeded transient fault limit.`));\n } else {\n this.setStatus(status);\n RpcRequest.events.raiseEvent(RpcRequestEvent.TransientErrorReceived, this);\n }\n }\n\n protected async setHeaders(): Promise<void> {\n const versionHeader = this.protocol.protocolVersionHeaderName;\n if (versionHeader && RpcProtocol.protocolVersion)\n this.setHeader(versionHeader, RpcProtocol.protocolVersion.toString());\n\n const headerNames = this.protocol.serializedClientRequestContextHeaderNames;\n const headerValues = await RpcConfiguration.requestContext.serialize(this);\n\n if (headerNames.id)\n this.setHeader(headerNames.id, headerValues.id || this.id); // Cannot be empty\n\n if (headerNames.applicationVersion)\n this.setHeader(headerNames.applicationVersion, headerValues.applicationVersion);\n\n if (headerNames.applicationId)\n this.setHeader(headerNames.applicationId, headerValues.applicationId);\n\n if (headerNames.sessionId)\n this.setHeader(headerNames.sessionId, headerValues.sessionId);\n\n if (headerNames.authorization && headerValues.authorization)\n this.setHeader(headerNames.authorization, headerValues.authorization);\n\n if (headerValues.csrfToken)\n this.setHeader(headerValues.csrfToken.headerName, headerValues.csrfToken.headerValue);\n }\n\n private setStatus(status: RpcRequestStatus): void {\n if (this._status === status)\n return;\n\n this._status = status;\n RpcRequest.events.raiseEvent(RpcRequestEvent.StatusChanged, this);\n }\n}\n\n/** @internal */\nexport const initializeRpcRequest = (() => {\n let initialized = false;\n\n return () => {\n if (initialized) {\n return;\n }\n\n initialized = true;\n\n RpcRequest.events.addListener((type, request) => {\n if (type !== RpcRequestEvent.StatusChanged)\n return;\n\n switch (request.status) {\n case RpcRequestStatus.Submitted: {\n aggregateLoad.lastRequest = request.lastSubmitted;\n break;\n }\n\n case RpcRequestStatus.Pending:\n case RpcRequestStatus.Resolved:\n case RpcRequestStatus.Rejected: {\n aggregateLoad.lastResponse = request.lastUpdated;\n break;\n }\n }\n });\n\n RpcProtocol.events.addListener((type) => {\n const now = new Date().getTime();\n\n switch (type) {\n case RpcProtocolEvent.RequestReceived: {\n aggregateLoad.lastRequest = now;\n break;\n }\n\n case RpcProtocolEvent.BackendReportedPending:\n case RpcProtocolEvent.BackendErrorOccurred:\n case RpcProtocolEvent.BackendResponseCreated: {\n aggregateLoad.lastResponse = now;\n break;\n }\n }\n });\n };\n})();\n"]}
|
|
1
|
+
{"version":3,"file":"RpcRequest.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcRequest.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmE;AAEnE,mDAA8E;AAE9E,yDAAsD;AACtD,iDAA8G;AAE9G,mDAAoE;AACpE,iDAA8C;AAC9C,+CAAkF;AAClF,+CAAgD;AAEhD,yDAAyD;AACzD,qBAAqB;AACrB,qDAAqD;AAErD,gBAAgB;AACH,QAAA,aAAa,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;AAEjE,gBAAgB;AAChB,MAAa,YAAY;IAEvB,IAAW,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,WAAW,KAA2B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,KAAK,CAAC,IAAI,KAAoB,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,kBAAkB,CAAC,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C;oBAClD,MAAM;gBACR,CAAC;gBAED,KAAK,+BAAgB,CAAC,OAAO,CAAC;gBAC9B,KAAK,+BAAgB,CAAC,QAAQ,CAAC;gBAC/B,KAAK,+BAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAC/B,qBAAa,CAAC,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;oBACjD,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,yBAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;YACtC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;YAEjC,QAAQ,IAAI,EAAE,CAAC;gBACb,KAAK,+BAAgB,CAAC,eAAe,CAAC,CAAC,CAAC;oBACtC,qBAAa,CAAC,WAAW,GAAG,GAAG,CAAC;oBAChC,MAAM;gBACR,CAAC;gBAED,KAAK,+BAAgB,CAAC,sBAAsB,CAAC;gBAC7C,KAAK,+BAAgB,CAAC,oBAAoB,CAAC;gBAC3C,KAAK,+BAAgB,CAAC,sBAAsB,CAAC,CAAC,CAAC;oBAC7C,qBAAa,CAAC,YAAY,GAAG,GAAG,CAAC;oBACjC,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BeEvent, BentleyStatus, Guid } from \"@itwin/core-bentley\";\nimport { IModelRpcProps } from \"../../IModel\";\nimport { BackendError, IModelError, NoContentError } from \"../../IModelError\";\nimport { RpcInterface } from \"../../RpcInterface\";\nimport { RpcConfiguration } from \"./RpcConfiguration\";\nimport { RpcProtocolEvent, RpcRequestEvent, RpcRequestStatus, RpcResponseCacheControl } from \"./RpcConstants\";\nimport { RpcNotFoundResponse } from \"./RpcControl\";\nimport { RpcMarshaling, RpcSerializedValue } from \"./RpcMarshaling\";\nimport { RpcOperation } from \"./RpcOperation\";\nimport { RpcManagedStatus, RpcProtocol, RpcProtocolVersion } from \"./RpcProtocol\";\nimport { CURRENT_REQUEST } from \"./RpcRegistry\";\n\n/* eslint-disable @typescript-eslint/naming-convention */\n// cspell:ignore csrf\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** @internal */\nexport const aggregateLoad = { lastRequest: 0, lastResponse: 0 };\n\n/** @internal */\nexport class ResponseLike implements Response {\n private _data: Promise<any>;\n public get body() { return null; }\n public async arrayBuffer(): Promise<ArrayBuffer> { return this._data; }\n public async blob(): Promise<Blob> { throw new IModelError(BentleyStatus.ERROR, \"Not implemented.\"); }\n public async formData(): Promise<FormData> { throw new IModelError(BentleyStatus.ERROR, \"Not implemented.\"); }\n public async json(): Promise<any> { return this._data; }\n public async text(): Promise<string> { return this._data; }\n public get bodyUsed() { return false; }\n public get headers(): Headers { throw new IModelError(BentleyStatus.ERROR, \"Not implemented.\"); }\n public get ok(): boolean { return this.status >= 200 && this.status <= 299; }\n public get redirected() { return false; }\n public get status() { return 200; }\n public get statusText() { return \"\"; }\n public get trailer(): Promise<Headers> { throw new IModelError(BentleyStatus.ERROR, \"Not implemented.\"); }\n public get type(): ResponseType { return \"basic\"; }\n public get url() { return \"\"; }\n public clone() { return { ...this }; }\n\n public constructor(data: any) {\n this._data = Promise.resolve(data);\n }\n}\n\n/** Supplies an IModelRpcProps for an RPC request.\n * @internal\n */\nexport type RpcRequestTokenSupplier_T = (request: RpcRequest) => IModelRpcProps | undefined;\n\n/** Supplies the initial retry interval for an RPC request.\n * @internal\n */\nexport type RpcRequestInitialRetryIntervalSupplier_T = (configuration: RpcConfiguration) => number;\n\n/** Notification callback for an RPC request.\n * @internal\n */\nexport type RpcRequestCallback_T = (request: RpcRequest) => void;\n\n/** Determines if caching is permitted for a RPC response.\n * @internal\n */\nexport type RpcResponseCachingCallback_T = (request: RpcRequest) => RpcResponseCacheControl;\n\n/** Runtime information related to the operation load of one or more RPC interfaces.\n * @internal\n */\nexport interface RpcOperationsProfile {\n readonly lastRequest: number;\n readonly lastResponse: number;\n}\n\n/** Handles RPC request events.\n * @internal\n */\nexport type RpcRequestEventHandler = (type: RpcRequestEvent, request: RpcRequest) => void;\n\n/** Resolves \"not found\" responses for RPC requests.\n * @internal\n */\nexport type RpcRequestNotFoundHandler = (request: RpcRequest, response: RpcNotFoundResponse, resubmit: () => void, reject: (reason?: any) => void) => void;\n\nclass Cancellable<T> {\n public promise: Promise<T | undefined>;\n public cancel() { }\n\n public constructor(task: Promise<T>) {\n this.promise = new Promise((resolve, reject) => {\n this.cancel = () => resolve(undefined);\n task.then(resolve, reject);\n });\n }\n}\n\n/** A RPC operation request.\n * @internal\n */\nexport abstract class RpcRequest<TResponse = any> {\n private static _activeRequests: Map<string, RpcRequest> = new Map();\n private _resolve: (value?: TResponse | PromiseLike<TResponse> | undefined) => void = () => undefined;\n protected _resolveRaw: (value?: Response | PromiseLike<Response> | undefined) => void = () => undefined;\n private _reject: (reason?: any) => void = () => undefined;\n private _rejectRaw: (reason?: any) => void = () => undefined;\n private _created: number = 0;\n private _lastSubmitted: number = 0;\n private _lastUpdated: number = 0;\n\n /** @internal */\n public _status: RpcRequestStatus = RpcRequestStatus.Unknown;\n\n /** @internal */\n public _extendedStatus: string = \"\";\n\n private _connecting: boolean = false;\n private _active: boolean = true;\n private _hasRawListener = false;\n private _raw: ArrayBuffer | string | undefined = undefined;\n private _sending?: Cancellable<number>;\n private _attempts = 0;\n private _retryAfter: number | null = null;\n private _transientFaults = 0;\n protected _response: Response | undefined = undefined;\n protected _rawPromise: Promise<Response | undefined>;\n public responseProtocolVersion = RpcProtocolVersion.None;\n\n /** All RPC requests that are currently in flight. */\n public static get activeRequests(): ReadonlyMap<string, RpcRequest> { return this._activeRequests; }\n\n /** Events raised by RpcRequest. See [[RpcRequestEvent]] */\n public static readonly events: BeEvent<RpcRequestEventHandler> = new BeEvent();\n\n /** Resolvers for \"not found\" requests. See [[RpcRequestNotFoundHandler]] */\n public static readonly notFoundHandlers: BeEvent<RpcRequestNotFoundHandler> = new BeEvent();\n\n /** The aggregate operations profile of all active RPC interfaces. */\n public static get aggregateLoad(): RpcOperationsProfile { return aggregateLoad; }\n\n /**\n * The request for the current RPC operation.\n * @note The return value of this function is only reliable if program control was received from a RPC interface class member function that directly returns the result of calling RpcInterface.forward.\n */\n public static current(context: RpcInterface): RpcRequest {\n return (context as any)[CURRENT_REQUEST];\n }\n\n /** The unique identifier of this request. */\n public readonly id: string;\n\n /** The operation for this request. */\n public readonly operation: RpcOperation;\n\n /** The parameters for this request. */\n public parameters: any[];\n\n /** The RPC client instance for this request. */\n public readonly client: RpcInterface;\n\n /** Convenience access to the protocol of this request. */\n public readonly protocol: RpcProtocol;\n\n /** The implementation response for this request. */\n public readonly response: Promise<TResponse | undefined>;\n\n /** The status of this request. */\n public get status() { return this._status; }\n\n /** Extended status information for this request (if available). */\n public get extendedStatus() { return this._extendedStatus; }\n\n /** The last submission for this request. */\n public get lastSubmitted() { return this._lastSubmitted; }\n\n /** The last status update received for this request. */\n public get lastUpdated() { return this._lastUpdated; }\n\n /** The target interval (in milliseconds) between submission attempts for this request. */\n public retryInterval: number;\n\n /** Whether a connection is active for this request. */\n public get connecting() { return this._connecting; }\n\n /** Whether this request is pending. */\n public get pending(): boolean {\n switch (this.status) {\n case RpcRequestStatus.Submitted:\n case RpcRequestStatus.Pending: {\n return true;\n }\n\n default: {\n return false;\n }\n }\n }\n\n /** The elapsed time for this request. */\n public get elapsed(): number {\n return this._lastUpdated - this._created;\n }\n\n /** A protocol-specific path identifier for this request. */\n public path: string;\n\n /** A protocol-specific method identifier for this request. */\n public method: string;\n\n /** An attempt-specific value for when to next retry this request. */\n public get retryAfter() { return this._retryAfter; }\n\n /** Finds the first parameter of a given structural type if present. */\n public findParameterOfType<T>(requiredProperties: { [index: string]: string }): T | undefined {\n for (const param of this.parameters) {\n if (typeof (param) === \"object\" && param !== null) {\n for (const prop of Object.getOwnPropertyNames(requiredProperties)) {\n if (prop in param && typeof (param[prop]) === requiredProperties[prop]) {\n return param;\n }\n }\n }\n }\n\n return undefined;\n }\n\n /** Finds the first IModelRpcProps parameter if present. */\n public findTokenPropsParameter(): IModelRpcProps | undefined {\n return this.findParameterOfType({ iModelId: \"string\" });\n\n }\n\n /** The raw implementation response for this request. */\n public get rawResponse(): Promise<Response | undefined> {\n this._hasRawListener = true;\n return this._rawPromise;\n }\n\n /** Constructs an RPC request. */\n public constructor(client: RpcInterface, operation: string, parameters: any[]) {\n this._created = new Date().getTime();\n this.path = \"\";\n this.method = \"\";\n this.client = client;\n this.protocol = client.configuration.protocol;\n this.operation = RpcOperation.lookup(client.constructor as any, operation);\n this.parameters = parameters;\n this.retryInterval = this.operation.policy.retryInterval(client.configuration);\n this.response = new Promise((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n\n this._rawPromise = new Promise((resolve, reject) => {\n this._resolveRaw = resolve;\n this._rejectRaw = reject;\n });\n\n this.id = RpcConfiguration.requestContext.getId(this) || Guid.createValue();\n this.setStatus(RpcRequestStatus.Created);\n this.operation.policy.requestCallback(this);\n }\n\n /** Override to send the request. */\n protected abstract send(): Promise<number>;\n\n /** Override to load response value. */\n protected abstract load(): Promise<RpcSerializedValue>;\n\n /** Override to set request header values. */\n protected abstract setHeader(name: string, value: string): void;\n\n /** Sets the last updated time for the request. */\n protected setLastUpdatedTime() {\n this._lastUpdated = new Date().getTime();\n }\n\n protected computeRetryAfter(attempts: number) {\n return (((Math.pow(2, attempts) - 1) / 2) * 500) + 500;\n }\n\n protected recordTransientFault() {\n ++this._transientFaults;\n }\n\n protected resetTransientFaultCount() {\n this._transientFaults = 0;\n }\n\n protected supportsStatusCategory() {\n if (!this.protocol.supportsStatusCategory) {\n return false;\n }\n\n return RpcProtocol.protocolVersion >= RpcProtocolVersion.IntroducedStatusCategory && this.responseProtocolVersion >= RpcProtocolVersion.IntroducedStatusCategory;\n }\n\n /* @internal */\n public cancel() {\n if (typeof (this._sending) === \"undefined\") {\n return;\n }\n\n this._sending.cancel();\n this._sending = undefined;\n\n this._connecting = false;\n RpcRequest._activeRequests.delete(this.id);\n this.setStatus(RpcRequestStatus.Cancelled);\n }\n\n /* @internal */\n public async submit(): Promise<void> {\n if (!this._active)\n return;\n\n this._lastSubmitted = new Date().getTime();\n this._retryAfter = null;\n ++this._attempts;\n\n if (this.status === RpcRequestStatus.Created || this.status === RpcRequestStatus.NotFound || this.status === RpcRequestStatus.Cancelled) {\n this.setStatus(RpcRequestStatus.Submitted);\n }\n\n try {\n this._connecting = true;\n RpcRequest._activeRequests.set(this.id, this);\n this.protocol.events.raiseEvent(RpcProtocolEvent.RequestCreated, this);\n this._sending = new Cancellable(this.setHeaders().then(async () => this.send()));\n this.operation.policy.sentCallback(this);\n\n const response = await this._sending.promise;\n if (typeof (response) === \"undefined\") {\n return;\n }\n this._sending = undefined;\n\n const status = this.protocol.getStatus(response);\n\n if (this._hasRawListener && status === RpcRequestStatus.Resolved && typeof (this._response) !== \"undefined\") {\n this._connecting = false;\n RpcRequest._activeRequests.delete(this.id);\n this.resolveRaw();\n } else {\n this.protocol.events.raiseEvent(RpcProtocolEvent.ResponseLoading, this);\n\n if (status === RpcRequestStatus.Unknown) {\n this._connecting = false;\n RpcRequest._activeRequests.delete(this.id);\n this.handleUnknownResponse(response);\n return;\n }\n\n const value = await this.load();\n this.protocol.events.raiseEvent(RpcProtocolEvent.ResponseLoaded, this);\n RpcRequest._activeRequests.delete(this.id);\n this._connecting = false;\n this.handleResponse(response, value);\n }\n } catch (err) {\n this.protocol.events.raiseEvent(RpcProtocolEvent.ConnectionErrorReceived, this, err);\n RpcRequest._activeRequests.delete(this.id);\n this._connecting = false;\n this.reject(err);\n }\n }\n\n protected handleUnknownResponse(code: number) {\n this.reject(new IModelError(BentleyStatus.ERROR, `Unknown response ${code}.`));\n }\n\n private handleResponse(code: number, value: RpcSerializedValue) {\n const protocolStatus = this.protocol.getStatus(code);\n const status = this.transformResponseStatus(protocolStatus, value);\n\n if (RpcRequestStatus.isTransientError(status)) {\n return this.handleTransientError(status);\n }\n\n switch (status) {\n case RpcRequestStatus.Resolved: {\n return this.handleResolved(value);\n }\n\n case RpcRequestStatus.Rejected: {\n return this.handleRejected(value);\n }\n\n case RpcRequestStatus.Pending: {\n return this.setPending(status, value.objects);\n }\n\n case RpcRequestStatus.NotFound: {\n return this.handleNotFound(status, value);\n }\n\n case RpcRequestStatus.NoContent: {\n return this.handleNoContent();\n }\n }\n }\n\n private transformResponseStatus(protocolStatus: RpcRequestStatus, value: RpcSerializedValue): RpcRequestStatus {\n if (!this.supportsStatusCategory()) {\n return protocolStatus;\n }\n\n let status = protocolStatus;\n\n if (protocolStatus === RpcRequestStatus.Pending) {\n status = RpcRequestStatus.Rejected;\n } else if (protocolStatus === RpcRequestStatus.NotFound) {\n status = RpcRequestStatus.Rejected;\n } else if (protocolStatus === RpcRequestStatus.Unknown) {\n status = RpcRequestStatus.Rejected;\n }\n\n if (value.objects.indexOf(\"iTwinRpcCoreResponse\") !== -1 && value.objects.indexOf(\"managedStatus\") !== -1) {\n const managedStatus: RpcManagedStatus = JSON.parse(value.objects);\n value.objects = managedStatus.responseValue as string;\n\n if (managedStatus.managedStatus === \"pending\") {\n status = RpcRequestStatus.Pending;\n } else if (managedStatus.managedStatus === \"notFound\") {\n status = RpcRequestStatus.NotFound;\n }\n }\n\n return status;\n }\n\n private handleResolved(value: RpcSerializedValue) {\n try {\n this._raw = value.objects;\n const result: TResponse = RpcMarshaling.deserialize(this.protocol, value);\n\n if (ArrayBuffer.isView(result)) {\n this._raw = result.buffer;\n }\n\n return this.resolve(result);\n } catch (err) {\n return this.reject(err);\n }\n }\n\n private handleRejected(value: RpcSerializedValue) {\n this.protocol.events.raiseEvent(RpcProtocolEvent.BackendErrorReceived, this);\n\n try {\n const error = RpcMarshaling.deserialize(this.protocol, value);\n const hasInfo = error && typeof (error) === \"object\" && error.hasOwnProperty(\"name\") && error.hasOwnProperty(\"message\");\n const name = hasInfo ? error.name : \"\";\n const message = hasInfo ? error.message : \"\";\n const errorNumber = (hasInfo && error.hasOwnProperty(\"errorNumber\")) ? error.errorNumber : BentleyStatus.ERROR;\n return this.reject(new BackendError(errorNumber, name, message, () => error));\n } catch (err) {\n return this.reject(err);\n }\n }\n\n private handleNoContent() {\n return this.reject(new NoContentError());\n }\n\n private handleNotFound(status: RpcRequestStatus, value: RpcSerializedValue) {\n if (RpcRequest.notFoundHandlers.numberOfListeners === 0)\n this.handleRejected(value);\n\n const response = RpcMarshaling.deserialize(this.protocol, value);\n this.setStatus(status);\n\n let resubmitted = false;\n RpcRequest.notFoundHandlers.raiseEvent(this, response, () => {\n if (resubmitted)\n throw new IModelError(BentleyStatus.ERROR, `Already resubmitted using this handler.`);\n\n resubmitted = true;\n void this.submit();\n }, (reason: any) => reason ? this.reject(reason) : this.handleRejected(value));\n return;\n }\n\n private resolve(result: TResponse): void {\n if (!this._active)\n return;\n\n this._active = false;\n this.setLastUpdatedTime();\n this._resolve(result);\n\n if (this._hasRawListener) {\n if (typeof (this._raw) === \"undefined\") {\n throw new IModelError(BentleyStatus.ERROR, \"Cannot access raw response.\");\n }\n\n this._resolveRaw(new ResponseLike(this._raw));\n }\n\n this.setStatus(RpcRequestStatus.Resolved);\n this.dispose();\n }\n\n private resolveRaw() {\n if (typeof (this._response) === \"undefined\") {\n throw new IModelError(BentleyStatus.ERROR, \"Cannot access raw response.\");\n }\n\n this._active = false;\n this.setLastUpdatedTime();\n this._resolveRaw(this._response);\n this.setStatus(RpcRequestStatus.Resolved);\n this.dispose();\n }\n\n protected reject(reason: any): void {\n if (!this._active)\n return;\n\n this._active = false;\n this.setLastUpdatedTime();\n this._reject(reason);\n\n if (this._hasRawListener) {\n this._rejectRaw(reason);\n }\n\n this.setStatus(RpcRequestStatus.Rejected);\n this.dispose();\n }\n\n /** @internal */\n public dispose(): void {\n this.setStatus(RpcRequestStatus.Disposed);\n this._raw = undefined;\n this._response = undefined;\n\n const client = this.client as any;\n if (client[CURRENT_REQUEST] === this) {\n client[CURRENT_REQUEST] = undefined;\n }\n }\n\n private setPending(status: RpcRequestStatus.Pending, extendedStatus: string): void {\n if (!this._active)\n return;\n\n this.setLastUpdatedTime();\n this._extendedStatus = extendedStatus;\n this.setStatus(status);\n RpcRequest.events.raiseEvent(RpcRequestEvent.PendingUpdateReceived, this);\n }\n\n private handleTransientError(status: RpcRequestStatus) {\n if (!this._active)\n return;\n\n this.setLastUpdatedTime();\n this._retryAfter = this.computeRetryAfter(this._attempts - 1);\n\n if (this._transientFaults > this.protocol.configuration.transientFaultLimit) {\n this.reject(new IModelError(BentleyStatus.ERROR, `Exceeded transient fault limit.`));\n } else {\n this.setStatus(status);\n RpcRequest.events.raiseEvent(RpcRequestEvent.TransientErrorReceived, this);\n }\n }\n\n protected async setHeaders(): Promise<void> {\n const versionHeader = this.protocol.protocolVersionHeaderName;\n if (versionHeader && RpcProtocol.protocolVersion)\n this.setHeader(versionHeader, RpcProtocol.protocolVersion.toString());\n\n const headerNames = this.protocol.serializedClientRequestContextHeaderNames;\n const headerValues = await RpcConfiguration.requestContext.serialize(this);\n\n if (headerNames.id)\n this.setHeader(headerNames.id, headerValues.id || this.id); // Cannot be empty\n\n if (headerNames.applicationVersion)\n this.setHeader(headerNames.applicationVersion, headerValues.applicationVersion);\n\n if (headerNames.applicationId)\n this.setHeader(headerNames.applicationId, headerValues.applicationId);\n\n if (headerNames.sessionId)\n this.setHeader(headerNames.sessionId, headerValues.sessionId);\n\n if (headerNames.authorization && headerValues.authorization)\n this.setHeader(headerNames.authorization, headerValues.authorization);\n\n if (headerValues.csrfToken)\n this.setHeader(headerValues.csrfToken.headerName, headerValues.csrfToken.headerValue);\n }\n\n private setStatus(status: RpcRequestStatus): void {\n if (this._status === status)\n return;\n\n this._status = status;\n RpcRequest.events.raiseEvent(RpcRequestEvent.StatusChanged, this);\n }\n}\n\n/** @internal */\nexport const initializeRpcRequest = (() => {\n let initialized = false;\n\n return () => {\n if (initialized) {\n return;\n }\n\n initialized = true;\n\n RpcRequest.events.addListener((type, request) => {\n if (type !== RpcRequestEvent.StatusChanged)\n return;\n\n switch (request.status) {\n case RpcRequestStatus.Submitted: {\n aggregateLoad.lastRequest = request.lastSubmitted;\n break;\n }\n\n case RpcRequestStatus.Pending:\n case RpcRequestStatus.Resolved:\n case RpcRequestStatus.Rejected: {\n aggregateLoad.lastResponse = request.lastUpdated;\n break;\n }\n }\n });\n\n RpcProtocol.events.addListener((type) => {\n const now = new Date().getTime();\n\n switch (type) {\n case RpcProtocolEvent.RequestReceived: {\n aggregateLoad.lastRequest = now;\n break;\n }\n\n case RpcProtocolEvent.BackendReportedPending:\n case RpcProtocolEvent.BackendErrorOccurred:\n case RpcProtocolEvent.BackendResponseCreated: {\n aggregateLoad.lastResponse = now;\n break;\n }\n }\n });\n };\n})();\n"]}
|
|
@@ -10,15 +10,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.RpcRoutingToken = void 0;
|
|
11
11
|
/** @beta */
|
|
12
12
|
class RpcRoutingToken {
|
|
13
|
+
static { this._next = -1; }
|
|
13
14
|
static generate(debugLabel = "") {
|
|
14
15
|
return new RpcRoutingToken(++this._next, debugLabel);
|
|
15
16
|
}
|
|
17
|
+
static { this.default = RpcRoutingToken.generate("default"); }
|
|
16
18
|
constructor(id, debugLabel) {
|
|
17
19
|
this.id = id;
|
|
18
20
|
this.debugLabel = debugLabel;
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
23
|
exports.RpcRoutingToken = RpcRoutingToken;
|
|
22
|
-
RpcRoutingToken._next = -1;
|
|
23
|
-
RpcRoutingToken.default = RpcRoutingToken.generate("default");
|
|
24
24
|
//# sourceMappingURL=RpcRoutingToken.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcRoutingToken.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcRoutingToken.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,YAAY;AACZ,MAAa,eAAe;
|
|
1
|
+
{"version":3,"file":"RpcRoutingToken.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcRoutingToken.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,YAAY;AACZ,MAAa,eAAe;aACX,UAAK,GAAG,CAAC,CAAC,CAAC;IAEnB,MAAM,CAAC,QAAQ,CAAC,UAAU,GAAG,EAAE;QACpC,OAAO,IAAI,eAAe,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;aAEsB,YAAO,GAAG,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAKrE,YAAoB,EAAU,EAAE,UAAkB;QAChD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;;AAfH,0CAgBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\n/** @beta */\nexport class RpcRoutingToken {\n private static _next = -1;\n\n public static generate(debugLabel = \"\"): RpcRoutingToken {\n return new RpcRoutingToken(++this._next, debugLabel);\n }\n\n public static readonly default = RpcRoutingToken.generate(\"default\");\n\n public readonly id: number;\n public readonly debugLabel: string;\n\n private constructor(id: number, debugLabel: string) {\n this.id = id;\n this.debugLabel = debugLabel;\n }\n}\n"]}
|
|
@@ -23,13 +23,13 @@ class SessionConfiguration extends RpcConfiguration_1.RpcConfiguration {
|
|
|
23
23
|
get protocol() { return SessionProtocol.instance; }
|
|
24
24
|
}
|
|
25
25
|
class SessionProtocol extends RpcProtocol_1.RpcProtocol {
|
|
26
|
+
static { this.instance = new SessionProtocol(); }
|
|
26
27
|
constructor() {
|
|
27
28
|
super(new SessionConfiguration());
|
|
28
29
|
this.requestType = RpcRequest_1.RpcRequest;
|
|
29
30
|
this.supportsStatusCategory = true;
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
SessionProtocol.instance = new SessionProtocol();
|
|
33
33
|
/** @internal */
|
|
34
34
|
class RpcSessionInvocation extends RpcInvocation_1.RpcInvocation {
|
|
35
35
|
static create(request) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcSessionInvocation.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcSessionInvocation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,yDAAsD;AACtD,iDAA2E;AAC3E,mDAAgD;AAChD,mDAAqD;AACrD,+CAAkE;AAClE,6CAA0C;AAE1C,qDAAqD;AAErD,MAAM,oBAAqB,SAAQ,mCAAgB;IAAnD;;QACS,eAAU,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC;IAE/B,CAAC;IADC,IAAW,QAAQ,KAAK,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;CAC3D;AAED,MAAM,eAAgB,SAAQ,yBAAW;
|
|
1
|
+
{"version":3,"file":"RpcSessionInvocation.js","sourceRoot":"","sources":["../../../../src/rpc/core/RpcSessionInvocation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,yDAAsD;AACtD,iDAA2E;AAC3E,mDAAgD;AAChD,mDAAqD;AACrD,+CAAkE;AAClE,6CAA0C;AAE1C,qDAAqD;AAErD,MAAM,oBAAqB,SAAQ,mCAAgB;IAAnD;;QACS,eAAU,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC;IAE/B,CAAC;IADC,IAAW,QAAQ,KAAK,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;CAC3D;AAED,MAAM,eAAgB,SAAQ,yBAAW;aACzB,aAAQ,GAAG,IAAI,eAAe,EAAE,AAAxB,CAAyB;IAG/C;QAAgB,KAAK,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;QAF3C,gBAAW,GAAG,uBAAU,CAAC;QAChB,2BAAsB,GAAG,IAAI,CAAC;IACK,CAAC;;AAGtD,gBAAgB;AAChB,MAAa,oBAAqB,SAAQ,6BAAa;IAC9C,MAAM,CAAC,MAAM,CAAC,OAA8B;QACjD,MAAM,iBAAiB,GAAyB;YAC9C,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE;YACtB,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,aAAa;YAC5C,kBAAkB,EAAE,OAAO,CAAC,OAAO,CAAC,kBAAkB;YACtD,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS;YACpC,aAAa,EAAE,EAAE;YACjB,SAAS,EAAE;gBACT,mBAAmB,EAAE,OAAO,CAAC,UAAU,CAAC,aAAa;gBACrD,gBAAgB,EAAE,OAAO,CAAC,UAAU,CAAC,gBAAgB;gBACrD,aAAa,EAAE,OAAO,CAAC,SAAS;aACjC;YACD,MAAM,EAAE,OAAO,CAAC,SAAS;YACzB,IAAI,EAAE,EAAE;YACR,UAAU,EAAE,kCAAkB,CAAC,MAAM,EAAE;YACvC,kBAAkB,EAAE,OAAO,CAAC,UAAU;YACtC,OAAO,EAAE,sCAAuB,CAAC,IAAI;YACrC,eAAe,EAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;SAC/D,CAAC;QAEF,OAAO,IAAI,oBAAoB,CAAC,eAAe,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAC/E,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,MAAM,KAAK,+BAAgB,CAAC,QAAQ,CAAC;IACnD,CAAC;CACF;AA3BD,oDA2BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { InterceptedRpcRequest } from \"../../ipc/IpcSession\";\nimport { RpcConfiguration } from \"./RpcConfiguration\";\nimport { RpcRequestStatus, RpcResponseCacheControl } from \"./RpcConstants\";\nimport { RpcInvocation } from \"./RpcInvocation\";\nimport { RpcSerializedValue } from \"./RpcMarshaling\";\nimport { RpcProtocol, SerializedRpcRequest } from \"./RpcProtocol\";\nimport { RpcRequest } from \"./RpcRequest\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nclass SessionConfiguration extends RpcConfiguration {\n public interfaces = () => [];\n public get protocol() { return SessionProtocol.instance; }\n}\n\nclass SessionProtocol extends RpcProtocol {\n public static instance = new SessionProtocol();\n public requestType = RpcRequest;\n public override supportsStatusCategory = true;\n constructor() { super(new SessionConfiguration()); }\n}\n\n/** @internal */\nexport class RpcSessionInvocation extends RpcInvocation {\n public static create(request: InterceptedRpcRequest): RpcSessionInvocation {\n const serializedRequest: SerializedRpcRequest = {\n id: request.context.id,\n applicationId: request.context.applicationId,\n applicationVersion: request.context.applicationVersion,\n sessionId: request.context.sessionId,\n authorization: \"\",\n operation: {\n interfaceDefinition: request.definition.interfaceName,\n interfaceVersion: request.definition.interfaceVersion,\n operationName: request.operation,\n },\n method: request.operation,\n path: \"\",\n parameters: RpcSerializedValue.create(),\n parametersOverride: request.parameters,\n caching: RpcResponseCacheControl.None,\n protocolVersion: parseInt(request.context.protocolVersion, 10),\n };\n\n return new RpcSessionInvocation(SessionProtocol.instance, serializedRequest);\n }\n\n public get rejected() {\n return this.status === RpcRequestStatus.Rejected;\n }\n}\n"]}
|
|
@@ -18,14 +18,14 @@ const RpcRoutingToken_1 = require("../core/RpcRoutingToken");
|
|
|
18
18
|
* @beta
|
|
19
19
|
*/
|
|
20
20
|
class BentleyCloudRpcConfiguration extends RpcConfiguration_1.RpcConfiguration {
|
|
21
|
+
/** Access-Control header values for backend servers that serve frontends using BentleyCloudRpcProtocol. */
|
|
22
|
+
static { this.accessControl = {
|
|
23
|
+
allowOrigin: "*",
|
|
24
|
+
allowMethods: "POST, GET, OPTIONS",
|
|
25
|
+
allowHeaders: "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, X-Correlation-Id, X-Session-Id, X-Application-Id, X-Application-Version, X-User-Id, X-Protocol-Version",
|
|
26
|
+
}; }
|
|
21
27
|
}
|
|
22
28
|
exports.BentleyCloudRpcConfiguration = BentleyCloudRpcConfiguration;
|
|
23
|
-
/** Access-Control header values for backend servers that serve frontends using BentleyCloudRpcProtocol. */
|
|
24
|
-
BentleyCloudRpcConfiguration.accessControl = {
|
|
25
|
-
allowOrigin: "*",
|
|
26
|
-
allowMethods: "POST, GET, OPTIONS",
|
|
27
|
-
allowHeaders: "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, X-Correlation-Id, X-Session-Id, X-Application-Id, X-Application-Version, X-User-Id, X-Protocol-Version",
|
|
28
|
-
};
|
|
29
29
|
/** Coordinates usage of RPC interfaces for Bentley cloud deployments.
|
|
30
30
|
* @beta
|
|
31
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BentleyCloudRpcManager.js","sourceRoot":"","sources":["../../../../src/rpc/web/BentleyCloudRpcManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,iDAA8C;AAC9C,+DAA4D;AAC5D,uDAAuD;AACvD,mDAAwE;AACxE,uEAAoE;AAEpE,6DAA0D;AAoB1D;;GAEG;AACH,MAAsB,4BAA6B,SAAQ,mCAAgB
|
|
1
|
+
{"version":3,"file":"BentleyCloudRpcManager.js","sourceRoot":"","sources":["../../../../src/rpc/web/BentleyCloudRpcManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,iDAA8C;AAC9C,+DAA4D;AAC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BAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3D,CAAC;QAED,MAAM,QAAQ,GAAG,mCAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEjD,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,QAAQ,CAAC,QAAQ,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACnD,CAAC;QAED,mCAAgB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAEhD,IAAI,MAAM,CAAC,sBAAsB,EAAE,CAAC;YAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,sBAAsB,CAAC;YAE/C,uBAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;gBAC9C,IAAI,IAAI,KAAK,8BAAe,CAAC,qBAAqB,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,EAAE,CAAC;oBAC7F,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAC1B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AA/CD,wDA+CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { RpcInterfaceDefinition } from \"../../RpcInterface\";\nimport { RpcManager } from \"../../RpcManager\";\nimport { RpcConfiguration } from \"../core/RpcConfiguration\";\nimport { RpcRequestEvent } from \"../core/RpcConstants\";\nimport { RpcRequest, RpcRequestEventHandler } from \"../core/RpcRequest\";\nimport { BentleyCloudRpcProtocol } from \"./BentleyCloudRpcProtocol\";\nimport { OpenAPIInfo } from \"./OpenAPI\";\nimport { RpcRoutingToken } from \"../core/RpcRoutingToken\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** Initialization parameters for BentleyCloudRpcConfiguration.\n * @beta\n */\nexport interface BentleyCloudRpcParams {\n /** Identifies the remote server that implements a set of RpcInterfaces. Note that the ID of the remote server is not a URI or hostname. It is a string that matches a key in the orchestrator's app registry. */\n info: OpenAPIInfo;\n /** @internal The protocol for Bentley cloud RPC interface deployments */\n protocol?: typeof BentleyCloudRpcProtocol;\n /** The URI of the orchestrator that will route requests to the remote RpcInterface server. If not supplied, this default to the origin of the Web page. This is required only when calling initializeClient and only if the server is not the origin of the Web page. */\n uriPrefix?: string;\n /** @internal Handler for RPC request events. */\n pendingRequestListener?: RpcRequestEventHandler;\n /** An optional prefix for RPC operation URI paths. */\n pathPrefix?: string;\n}\n\n/** Operating parameters for Bentley cloud RPC interface deployments.\n * @beta\n */\nexport abstract class BentleyCloudRpcConfiguration extends RpcConfiguration {\n /** Access-Control header values for backend servers that serve frontends using BentleyCloudRpcProtocol. */\n public static readonly accessControl = {\n allowOrigin: \"*\",\n allowMethods: \"POST, GET, OPTIONS\",\n allowHeaders: \"Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, X-Correlation-Id, X-Session-Id, X-Application-Id, X-Application-Version, X-User-Id, X-Protocol-Version\",\n };\n\n /** @internal The protocol of the configuration. */\n public abstract override readonly protocol: BentleyCloudRpcProtocol;\n}\n\n/** Coordinates usage of RPC interfaces for Bentley cloud deployments.\n * @beta\n */\nexport class BentleyCloudRpcManager extends RpcManager {\n /** @beta Initializes BentleyCloudRpcManager for the frontend of an application. */\n public static initializeClient(params: BentleyCloudRpcParams, interfaces: RpcInterfaceDefinition[], routing: RpcRoutingToken = RpcRoutingToken.default): BentleyCloudRpcConfiguration {\n return BentleyCloudRpcManager.performInitialization(params, interfaces, routing);\n }\n\n /** @beta Initializes BentleyCloudRpcManager for the backend of an application. */\n public static initializeImpl(params: BentleyCloudRpcParams, interfaces: RpcInterfaceDefinition[]): BentleyCloudRpcConfiguration {\n return BentleyCloudRpcManager.performInitialization(params, interfaces);\n }\n\n private static performInitialization(params: BentleyCloudRpcParams, interfaces: RpcInterfaceDefinition[], routing: RpcRoutingToken = RpcRoutingToken.default): BentleyCloudRpcConfiguration {\n const protocol = class extends (params.protocol || BentleyCloudRpcProtocol) {\n public override pathPrefix = params.uriPrefix || \"\";\n public info = params.info;\n };\n\n const config = class extends BentleyCloudRpcConfiguration {\n public interfaces = () => interfaces;\n public protocol: BentleyCloudRpcProtocol = new protocol(this);\n public override routing = routing;\n };\n\n for (const def of interfaces) {\n RpcConfiguration.assignWithRouting(def, routing, config);\n }\n\n const instance = RpcConfiguration.obtain(config);\n\n if (params.pathPrefix) {\n instance.protocol.pathPrefix = params.pathPrefix;\n }\n\n RpcConfiguration.initializeInterfaces(instance);\n\n if (params.pendingRequestListener) {\n const listener = params.pendingRequestListener;\n\n RpcRequest.events.addListener((type, request) => {\n if (type === RpcRequestEvent.PendingUpdateReceived && request.protocol === instance.protocol) {\n listener(type, request);\n }\n });\n }\n\n return instance;\n }\n}\n"]}
|
|
@@ -34,18 +34,18 @@ class RpcMultipart {
|
|
|
34
34
|
this.platform.appendToForm(i, form, value);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
/** @internal */
|
|
38
|
+
static { this.platform = {
|
|
39
|
+
createStream(_value) {
|
|
40
|
+
throw new IModelError_1.IModelError(IModelError_1.BentleyStatus.ERROR, "Not bound.");
|
|
41
|
+
},
|
|
42
|
+
async parseRequest(_req) {
|
|
43
|
+
throw new IModelError_1.IModelError(IModelError_1.BentleyStatus.ERROR, "Not bound.");
|
|
44
|
+
},
|
|
45
|
+
appendToForm(i, form, value) {
|
|
46
|
+
form.append(`data-${i}`, new Blob([value.data[i]], { type: "application/octet-stream" }));
|
|
47
|
+
},
|
|
48
|
+
}; }
|
|
37
49
|
}
|
|
38
50
|
exports.RpcMultipart = RpcMultipart;
|
|
39
|
-
/** @internal */
|
|
40
|
-
RpcMultipart.platform = {
|
|
41
|
-
createStream(_value) {
|
|
42
|
-
throw new IModelError_1.IModelError(IModelError_1.BentleyStatus.ERROR, "Not bound.");
|
|
43
|
-
},
|
|
44
|
-
async parseRequest(_req) {
|
|
45
|
-
throw new IModelError_1.IModelError(IModelError_1.BentleyStatus.ERROR, "Not bound.");
|
|
46
|
-
},
|
|
47
|
-
appendToForm(i, form, value) {
|
|
48
|
-
form.append(`data-${i}`, new Blob([value.data[i]], { type: "application/octet-stream" }));
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
51
|
//# sourceMappingURL=RpcMultipart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcMultipart.js","sourceRoot":"","sources":["../../../../src/rpc/web/RpcMultipart.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,mDAA+D;AAiB/D;;GAEG;AACH,MAAa,YAAY;IACvB,wDAAwD;IACjD,MAAM,CAAC,UAAU,CAAC,KAAyB;QAChD,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,YAAY,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mDAAmD;IAC5C,MAAM,CAAC,YAAY,CAAC,KAAyB;QAClD,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,2DAA2D;IACpD,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,GAAsB;QACrD,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,gBAAgB,CAAC,IAAoB,EAAE,KAAyB;QAC5E,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,MAAM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BAAW,CAAC,2BAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC3D,CAAC;QACD,KAAK,CAAC,YAAY,CAAC,IAAuB;YACxC,MAAM,IAAI,yBAAW,CAAC,2BAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC3D,CAAC;QACD,YAAY,CAAC,CAAS,EAAE,IAAoB,EAAE,KAAyB;YACrE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC,CAAC,CAAC;QAC5F,CAAC;KACF,CAAC;;AAtCJ,oCAuCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BentleyStatus, IModelError } from \"../../IModelError\";\nimport { BackendBuffer, BackendReadable } from \"../../BackendTypes\";\nimport { RpcSerializedValue } from \"../core/RpcMarshaling\";\nimport { HttpServerRequest } from \"../web/WebAppRpcProtocol\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** @internal */\nexport interface FormDataCommon {\n append(name: string, value: string | Blob | BackendBuffer, fileName?: string): void;\n}\n\n/** @internal */\nexport interface ReadableFormData extends BackendReadable {\n getHeaders(): { [key: string]: any };\n}\n\n/** Support for transporting RPC values using the HTTP multipart content type.\n * @internal\n */\nexport class RpcMultipart {\n /** Creates a multipart form object for an RPC value. */\n public static createForm(value: RpcSerializedValue): FormData {\n const form = new FormData();\n RpcMultipart.writeValueToForm(form, value);\n return form;\n }\n\n /** Creates a multipart stream for an RPC value. */\n public static createStream(value: RpcSerializedValue): ReadableFormData {\n return this.platform.createStream(value);\n }\n\n /** Obtains the RPC value from a multipart HTTP request. */\n public static async parseRequest(req: HttpServerRequest): Promise<RpcSerializedValue> {\n return this.platform.parseRequest(req);\n }\n\n /** @internal */\n public static writeValueToForm(form: FormDataCommon, value: RpcSerializedValue) {\n form.append(\"objects\", value.objects);\n\n for (let i = 0; i !== value.data.length; ++i) {\n this.platform.appendToForm(i, form, value);\n }\n }\n\n /** @internal */\n public static platform = {\n createStream(_value: RpcSerializedValue): ReadableFormData {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n async parseRequest(_req: HttpServerRequest): Promise<RpcSerializedValue> {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n appendToForm(i: number, form: FormDataCommon, value: RpcSerializedValue): void {\n form.append(`data-${i}`, new Blob([value.data[i]], { type: \"application/octet-stream\" }));\n },\n };\n}\n\n"]}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
/** @packageDocumentation
|
|
7
7
|
* @module RpcInterface
|
|
8
8
|
*/
|
|
9
|
-
var _a;
|
|
10
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
10
|
exports.WebAppRpcRequest = void 0;
|
|
12
11
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
@@ -22,6 +21,12 @@ const WebAppRpcProtocol_1 = require("./WebAppRpcProtocol");
|
|
|
22
21
|
*/
|
|
23
22
|
class WebAppRpcRequest extends RpcRequest_1.RpcRequest {
|
|
24
23
|
get _headers() { return this._request.headers; }
|
|
24
|
+
/** The maximum size permitted for an encoded component in a URL.
|
|
25
|
+
* Note that some backends limit the total cumulative request size. Our current node backends accept requests with a max size of 16 kb.
|
|
26
|
+
* In addition to the url size, an authorization header may also add considerably to the request size.
|
|
27
|
+
* @note This is used for features like encoding the payload of a cacheable request in the URL.
|
|
28
|
+
*/
|
|
29
|
+
static { this.maxUrlComponentSize = 1024 * 8; }
|
|
25
30
|
/** Parses a request. */
|
|
26
31
|
static async parseRequest(protocol, req) {
|
|
27
32
|
return this.backend.parseRequest(protocol, req);
|
|
@@ -181,7 +186,7 @@ class WebAppRpcRequest extends RpcRequest_1.RpcRequest {
|
|
|
181
186
|
}
|
|
182
187
|
async setupTransport() {
|
|
183
188
|
const parameters = (await this.protocol.serialize(this)).parameters;
|
|
184
|
-
const transportType =
|
|
189
|
+
const transportType = WebAppRpcRequest.computeTransportType(parameters, this.parameters);
|
|
185
190
|
if (transportType === RpcConstants_1.RpcContentType.Binary) {
|
|
186
191
|
this.setupBinaryTransport(parameters);
|
|
187
192
|
}
|
|
@@ -206,7 +211,7 @@ class WebAppRpcRequest extends RpcRequest_1.RpcRequest {
|
|
|
206
211
|
setupTextTransport(parameters) {
|
|
207
212
|
if (this.operation.policy.allowResponseCaching(this)) {
|
|
208
213
|
const encodedBody = btoa(parameters.objects);
|
|
209
|
-
if (encodedBody.length <=
|
|
214
|
+
if (encodedBody.length <= WebAppRpcRequest.maxUrlComponentSize) {
|
|
210
215
|
this._request.method = "get";
|
|
211
216
|
this._request.body = undefined;
|
|
212
217
|
delete this._headers[RpcConstants_1.WEB_RPC_CONSTANTS.CONTENT];
|
|
@@ -219,22 +224,15 @@ class WebAppRpcRequest extends RpcRequest_1.RpcRequest {
|
|
|
219
224
|
this._request.method = "post";
|
|
220
225
|
this._request.body = parameters.objects;
|
|
221
226
|
}
|
|
227
|
+
/** @internal */
|
|
228
|
+
static { this.backend = {
|
|
229
|
+
sendResponse: async (_protocol, _request, _fulfillment, _req, _res) => {
|
|
230
|
+
throw new IModelError_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Not bound.");
|
|
231
|
+
},
|
|
232
|
+
parseRequest: async (_protocol, _req) => {
|
|
233
|
+
throw new IModelError_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Not bound.");
|
|
234
|
+
},
|
|
235
|
+
}; }
|
|
222
236
|
}
|
|
223
237
|
exports.WebAppRpcRequest = WebAppRpcRequest;
|
|
224
|
-
_a = WebAppRpcRequest;
|
|
225
|
-
/** The maximum size permitted for an encoded component in a URL.
|
|
226
|
-
* Note that some backends limit the total cumulative request size. Our current node backends accept requests with a max size of 16 kb.
|
|
227
|
-
* In addition to the url size, an authorization header may also add considerably to the request size.
|
|
228
|
-
* @note This is used for features like encoding the payload of a cacheable request in the URL.
|
|
229
|
-
*/
|
|
230
|
-
WebAppRpcRequest.maxUrlComponentSize = 1024 * 8;
|
|
231
|
-
/** @internal */
|
|
232
|
-
WebAppRpcRequest.backend = {
|
|
233
|
-
sendResponse: async (_protocol, _request, _fulfillment, _req, _res) => {
|
|
234
|
-
throw new IModelError_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Not bound.");
|
|
235
|
-
},
|
|
236
|
-
parseRequest: async (_protocol, _req) => {
|
|
237
|
-
throw new IModelError_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Not bound.");
|
|
238
|
-
},
|
|
239
|
-
};
|
|
240
238
|
//# sourceMappingURL=WebAppRpcRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebAppRpcRequest.js","sourceRoot":"","sources":["../../../../src/rpc/web/WebAppRpcRequest.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,sDAAoD;AACpD,mDAAiF;AAEjF,uDAA2F;AAC3F,yDAAmF;AAEnF,mDAAgD;AAChD,uEAAoE;AACpE,iDAA8C;AAC9C,2DAA+F;AAO/F;;GAEG;AACH,MAAa,gBAAiB,SAAQ,uBAAU;IAI9C,IAAY,QAAQ,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAoC,CAAC,CAAC,CAAC;IAkBrF,wBAAwB;IACjB,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,QAA2B,EAAE,GAAsB;QAClF,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IAED,4CAA4C;IACrC,MAAM,CAAC,KAAK,CAAC,YAAY,CAC9B,QAA2B,EAC3B,OAA6B,EAC7B,WAAkC,EAClC,GAAsB,EACtB,GAA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AA8B,EAAE,YAAmC,EAAE,IAAuB,EAAE,IAAwB,EAAiB,EAAE;QAC1L,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAC3D,CAAC;IACD,YAAY,EAAE,KAAK,EAAE,SAA4B,EAAE,IAAuB,EAAiC,EAAE;QAC3G,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAC3D,CAAC;CACF,AAPoB,CAOnB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BentleyStatus } from \"@itwin/core-bentley\";\nimport { IModelError, ServerError, ServerTimeoutError } from \"../../IModelError\";\nimport { RpcInterface } from \"../../RpcInterface\";\nimport { RpcContentType, RpcProtocolEvent, WEB_RPC_CONSTANTS } from \"../core/RpcConstants\";\nimport { MarshalingBinaryMarker, RpcSerializedValue } from \"../core/RpcMarshaling\";\nimport { RpcRequestFulfillment, SerializedRpcRequest } from \"../core/RpcProtocol\";\nimport { RpcRequest } from \"../core/RpcRequest\";\nimport { RpcMultipartParser } from \"./multipart/RpcMultipartParser\";\nimport { RpcMultipart } from \"./RpcMultipart\";\nimport { HttpServerRequest, HttpServerResponse, WebAppRpcProtocol } from \"./WebAppRpcProtocol\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** @internal */\nexport type HttpMethod_T = \"get\" | \"put\" | \"post\" | \"delete\" | \"options\" | \"head\" | \"patch\" | \"trace\"; // eslint-disable-line @typescript-eslint/naming-convention\n\n/** A web application RPC request.\n * @internal\n */\nexport class WebAppRpcRequest extends RpcRequest {\n private _loading: boolean = false;\n private _request: RequestInit = {};\n private _pathSuffix: string = \"\";\n private get _headers() { return this._request.headers as { [key: string]: string }; }\n\n /** The maximum size permitted for an encoded component in a URL.\n * Note that some backends limit the total cumulative request size. Our current node backends accept requests with a max size of 16 kb.\n * In addition to the url size, an authorization header may also add considerably to the request size.\n * @note This is used for features like encoding the payload of a cacheable request in the URL.\n */\n public static maxUrlComponentSize = 1024 * 8;\n\n /** The HTTP method for this request. */\n public override method: HttpMethod_T;\n\n /** Convenience access to the protocol of this request. */\n public override readonly protocol: WebAppRpcProtocol = this.client.configuration.protocol as any;\n\n /** Standardized access to metadata about the request (useful for purposes such as logging). */\n public metadata = { status: 0, message: \"\" };\n\n /** Parses a request. */\n public static async parseRequest(protocol: WebAppRpcProtocol, req: HttpServerRequest): Promise<SerializedRpcRequest> {\n return this.backend.parseRequest(protocol, req);\n }\n\n /** Sends the response for a web request. */\n public static async sendResponse(\n protocol: WebAppRpcProtocol,\n request: SerializedRpcRequest,\n fulfillment: RpcRequestFulfillment,\n req: HttpServerRequest,\n res: HttpServerResponse,\n ): Promise<void> {\n return this.backend.sendResponse(protocol, request, fulfillment, req, res);\n }\n\n /** Determines the most efficient transport type for an RPC value. */\n public static computeTransportType(value: RpcSerializedValue, source: any): RpcContentType {\n if (source instanceof Uint8Array || (Array.isArray(source) && source[0] instanceof Uint8Array)) {\n return RpcContentType.Binary;\n } else if (value.data.length > 0) {\n return RpcContentType.Multipart;\n } else if (value.stream) {\n return RpcContentType.Stream;\n } else {\n return RpcContentType.Text;\n }\n }\n\n /** Constructs a web application request. */\n public constructor(client: RpcInterface, operation: string, parameters: any[]) {\n super(client, operation, parameters);\n this.path = this.protocol.supplyPathForOperation(this.operation, this);\n this.method = \"head\";\n this._request.headers = {};\n }\n\n /** Sets request header values. */\n protected setHeader(name: string, value: string): void {\n this._headers[name] = value;\n }\n\n /** Sends the request. */\n protected async send(): Promise<number> {\n this._loading = true;\n await this.setupTransport();\n\n return new Promise<number>(async (resolve, reject) => {\n try {\n resolve(await this.performFetch());\n } catch (reason) {\n reject(new ServerError(-1, typeof (reason) === \"string\" ? reason : \"Server connection error.\"));\n }\n });\n }\n\n protected override computeRetryAfter(attempts: number): number {\n const retryAfter = this._response && this._response.headers.get(\"Retry-After\");\n if (retryAfter) {\n this.resetTransientFaultCount();\n\n const r = Number(retryAfter);\n if (Number.isFinite(r)) {\n return r * 1000;\n }\n\n const d = Date.parse(retryAfter);\n if (!Number.isNaN(d)) {\n return d - Date.now();\n }\n } else {\n this.recordTransientFault();\n }\n\n return super.computeRetryAfter(attempts);\n }\n\n protected override handleUnknownResponse(code: number) {\n if (this.protocol.isTimeout(code)) {\n this.reject(new ServerTimeoutError(\"Request timeout.\"));\n } else {\n this.reject(new ServerError(code, \"Unknown server response code.\"));\n }\n }\n\n protected async load(): Promise<RpcSerializedValue> {\n return new Promise<RpcSerializedValue>(async (resolve, reject) => {\n try {\n if (!this._loading)\n return;\n\n const response = this._response;\n if (!response) {\n reject(new IModelError(BentleyStatus.ERROR, \"Invalid state.\"));\n return;\n }\n\n if (this.protocol.protocolVersionHeaderName) {\n const version = response.headers.get(this.protocol.protocolVersionHeaderName);\n if (version) {\n this.responseProtocolVersion = parseInt(version, 10);\n }\n }\n\n const contentType = response.headers.get(WEB_RPC_CONSTANTS.CONTENT);\n const responseType = WebAppRpcProtocol.computeContentType(contentType);\n\n if (responseType === RpcContentType.Binary) {\n resolve(await this.loadBinary(response));\n } else if (responseType === RpcContentType.Multipart) {\n resolve(await this.loadMultipart(response, contentType!));\n } else {\n resolve(await this.loadText(response));\n }\n\n this._loading = false;\n this.setLastUpdatedTime();\n this.protocol.events.raiseEvent(RpcProtocolEvent.ResponseLoaded, this);\n } catch (reason) {\n if (!this._loading)\n return;\n\n this._loading = false;\n reject(new ServerError(this.metadata.status, typeof (reason) === \"string\" ? reason : \"Unknown server response error.\"));\n }\n });\n }\n\n /** Override to supply an alternate fetch function. */\n protected supplyFetch(): typeof fetch {\n return fetch;\n }\n\n /** Override to supply an alternate Request function. */\n protected supplyRequest(): typeof Request {\n return Request;\n }\n\n private async performFetch(): Promise<number> {\n const requestClass = this.supplyRequest();\n const fetchFunction = this.supplyFetch();\n\n const path = new URL(this.path, typeof (location) !== \"undefined\" ? location.origin : undefined);\n if (this._pathSuffix) {\n const params = new URLSearchParams();\n params.set(\"parameters\", this._pathSuffix);\n path.search = `?${params.toString()}`;\n }\n\n const request = new requestClass(path.toString(), this._request);\n const response = await fetchFunction(request);\n this._response = response;\n this.metadata.status = response.status;\n return response.status;\n }\n\n private async loadText(response: Response) {\n const value = await response.text();\n this.metadata.message = value;\n return RpcSerializedValue.create(value);\n }\n\n private async loadBinary(response: Response) {\n const value = new Uint8Array(await response.arrayBuffer());\n const objects = JSON.stringify(MarshalingBinaryMarker.createDefault());\n return RpcSerializedValue.create(objects, [value]);\n }\n\n private async loadMultipart(response: Response, contentType: string) {\n const data = await response.arrayBuffer();\n const value = new RpcMultipartParser(contentType, new Uint8Array(data)).parse();\n return value;\n }\n\n private async setupTransport(): Promise<void> {\n const parameters = (await this.protocol.serialize(this)).parameters;\n const transportType = WebAppRpcRequest.computeTransportType(parameters, this.parameters);\n\n if (transportType === RpcContentType.Binary) {\n this.setupBinaryTransport(parameters);\n } else if (transportType === RpcContentType.Multipart) {\n this.setupMultipartTransport(parameters);\n } else {\n this.setupTextTransport(parameters);\n }\n }\n\n private setupBinaryTransport(parameters: RpcSerializedValue) {\n this._headers[WEB_RPC_CONSTANTS.CONTENT] = WEB_RPC_CONSTANTS.BINARY;\n this._request.method = \"post\";\n this._request.body = parameters.data[0];\n }\n\n private setupMultipartTransport(parameters: RpcSerializedValue) {\n // IMPORTANT: do not set a multipart Content-Type header value. The browser does this automatically!\n delete this._headers[WEB_RPC_CONSTANTS.CONTENT];\n this._request.method = \"post\";\n this._request.body = RpcMultipart.createForm(parameters);\n }\n\n private setupTextTransport(parameters: RpcSerializedValue) {\n if (this.operation.policy.allowResponseCaching(this)) {\n const encodedBody = btoa(parameters.objects);\n if (encodedBody.length <= WebAppRpcRequest.maxUrlComponentSize) {\n this._request.method = \"get\";\n this._request.body = undefined;\n delete this._headers[WEB_RPC_CONSTANTS.CONTENT];\n this._pathSuffix = encodedBody;\n return;\n }\n }\n\n this._pathSuffix = \"\";\n this._headers[WEB_RPC_CONSTANTS.CONTENT] = WEB_RPC_CONSTANTS.TEXT;\n this._request.method = \"post\";\n this._request.body = parameters.objects;\n }\n\n /** @internal */\n public static backend = {\n sendResponse: async (_protocol: WebAppRpcProtocol, _request: SerializedRpcRequest, _fulfillment: RpcRequestFulfillment, _req: HttpServerRequest, _res: HttpServerResponse): Promise<void> => {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n parseRequest: async (_protocol: WebAppRpcProtocol, _req: HttpServerRequest): Promise<SerializedRpcRequest> => {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"WebAppRpcRequest.js","sourceRoot":"","sources":["../../../../src/rpc/web/WebAppRpcRequest.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoD;AACpD,mDAAiF;AAEjF,uDAA2F;AAC3F,yDAAmF;AAEnF,mDAAgD;AAChD,uEAAoE;AACpE,iDAA8C;AAC9C,2DAA+F;AAO/F;;GAEG;AACH,MAAa,gBAAiB,SAAQ,uBAAU;IAI9C,IAAY,QAAQ,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAoC,CAAC,CAAC,CAAC;IAErF;;;;OAIG;aACW,wBAAmB,GAAG,IAAI,GAAG,CAAC,AAAX,CAAY;IAW7C,wBAAwB;IACjB,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,QAA2B,EAAE,GAAsB;QAClF,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IAED,4CAA4C;IACrC,MAAM,CAAC,KAAK,CAAC,YAAY,CAC9B,QAA2B,EAC3B,OAA6B,EAC7B,WAAkC,EAClC,GAAsB,EACtB,GAAuB;QAEvB,OAAO,IAAI,C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EAAE,YAAY,CAAC,CAAC;QAC3D,CAAC;QACD,YAAY,EAAE,KAAK,EAAE,SAA4B,EAAE,IAAuB,EAAiC,EAAE;YAC3G,MAAM,IAAI,yBAAW,CAAC,4BAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC3D,CAAC;KACF,AAPoB,CAOnB;;AAxPJ,4CAyPC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BentleyStatus } from \"@itwin/core-bentley\";\nimport { IModelError, ServerError, ServerTimeoutError } from \"../../IModelError\";\nimport { RpcInterface } from \"../../RpcInterface\";\nimport { RpcContentType, RpcProtocolEvent, WEB_RPC_CONSTANTS } from \"../core/RpcConstants\";\nimport { MarshalingBinaryMarker, RpcSerializedValue } from \"../core/RpcMarshaling\";\nimport { RpcRequestFulfillment, SerializedRpcRequest } from \"../core/RpcProtocol\";\nimport { RpcRequest } from \"../core/RpcRequest\";\nimport { RpcMultipartParser } from \"./multipart/RpcMultipartParser\";\nimport { RpcMultipart } from \"./RpcMultipart\";\nimport { HttpServerRequest, HttpServerResponse, WebAppRpcProtocol } from \"./WebAppRpcProtocol\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** @internal */\nexport type HttpMethod_T = \"get\" | \"put\" | \"post\" | \"delete\" | \"options\" | \"head\" | \"patch\" | \"trace\"; // eslint-disable-line @typescript-eslint/naming-convention\n\n/** A web application RPC request.\n * @internal\n */\nexport class WebAppRpcRequest extends RpcRequest {\n private _loading: boolean = false;\n private _request: RequestInit = {};\n private _pathSuffix: string = \"\";\n private get _headers() { return this._request.headers as { [key: string]: string }; }\n\n /** The maximum size permitted for an encoded component in a URL.\n * Note that some backends limit the total cumulative request size. Our current node backends accept requests with a max size of 16 kb.\n * In addition to the url size, an authorization header may also add considerably to the request size.\n * @note This is used for features like encoding the payload of a cacheable request in the URL.\n */\n public static maxUrlComponentSize = 1024 * 8;\n\n /** The HTTP method for this request. */\n public override method: HttpMethod_T;\n\n /** Convenience access to the protocol of this request. */\n public override readonly protocol: WebAppRpcProtocol = this.client.configuration.protocol as any;\n\n /** Standardized access to metadata about the request (useful for purposes such as logging). */\n public metadata = { status: 0, message: \"\" };\n\n /** Parses a request. */\n public static async parseRequest(protocol: WebAppRpcProtocol, req: HttpServerRequest): Promise<SerializedRpcRequest> {\n return this.backend.parseRequest(protocol, req);\n }\n\n /** Sends the response for a web request. */\n public static async sendResponse(\n protocol: WebAppRpcProtocol,\n request: SerializedRpcRequest,\n fulfillment: RpcRequestFulfillment,\n req: HttpServerRequest,\n res: HttpServerResponse,\n ): Promise<void> {\n return this.backend.sendResponse(protocol, request, fulfillment, req, res);\n }\n\n /** Determines the most efficient transport type for an RPC value. */\n public static computeTransportType(value: RpcSerializedValue, source: any): RpcContentType {\n if (source instanceof Uint8Array || (Array.isArray(source) && source[0] instanceof Uint8Array)) {\n return RpcContentType.Binary;\n } else if (value.data.length > 0) {\n return RpcContentType.Multipart;\n } else if (value.stream) {\n return RpcContentType.Stream;\n } else {\n return RpcContentType.Text;\n }\n }\n\n /** Constructs a web application request. */\n public constructor(client: RpcInterface, operation: string, parameters: any[]) {\n super(client, operation, parameters);\n this.path = this.protocol.supplyPathForOperation(this.operation, this);\n this.method = \"head\";\n this._request.headers = {};\n }\n\n /** Sets request header values. */\n protected setHeader(name: string, value: string): void {\n this._headers[name] = value;\n }\n\n /** Sends the request. */\n protected async send(): Promise<number> {\n this._loading = true;\n await this.setupTransport();\n\n return new Promise<number>(async (resolve, reject) => {\n try {\n resolve(await this.performFetch());\n } catch (reason) {\n reject(new ServerError(-1, typeof (reason) === \"string\" ? reason : \"Server connection error.\"));\n }\n });\n }\n\n protected override computeRetryAfter(attempts: number): number {\n const retryAfter = this._response && this._response.headers.get(\"Retry-After\");\n if (retryAfter) {\n this.resetTransientFaultCount();\n\n const r = Number(retryAfter);\n if (Number.isFinite(r)) {\n return r * 1000;\n }\n\n const d = Date.parse(retryAfter);\n if (!Number.isNaN(d)) {\n return d - Date.now();\n }\n } else {\n this.recordTransientFault();\n }\n\n return super.computeRetryAfter(attempts);\n }\n\n protected override handleUnknownResponse(code: number) {\n if (this.protocol.isTimeout(code)) {\n this.reject(new ServerTimeoutError(\"Request timeout.\"));\n } else {\n this.reject(new ServerError(code, \"Unknown server response code.\"));\n }\n }\n\n protected async load(): Promise<RpcSerializedValue> {\n return new Promise<RpcSerializedValue>(async (resolve, reject) => {\n try {\n if (!this._loading)\n return;\n\n const response = this._response;\n if (!response) {\n reject(new IModelError(BentleyStatus.ERROR, \"Invalid state.\"));\n return;\n }\n\n if (this.protocol.protocolVersionHeaderName) {\n const version = response.headers.get(this.protocol.protocolVersionHeaderName);\n if (version) {\n this.responseProtocolVersion = parseInt(version, 10);\n }\n }\n\n const contentType = response.headers.get(WEB_RPC_CONSTANTS.CONTENT);\n const responseType = WebAppRpcProtocol.computeContentType(contentType);\n\n if (responseType === RpcContentType.Binary) {\n resolve(await this.loadBinary(response));\n } else if (responseType === RpcContentType.Multipart) {\n resolve(await this.loadMultipart(response, contentType!));\n } else {\n resolve(await this.loadText(response));\n }\n\n this._loading = false;\n this.setLastUpdatedTime();\n this.protocol.events.raiseEvent(RpcProtocolEvent.ResponseLoaded, this);\n } catch (reason) {\n if (!this._loading)\n return;\n\n this._loading = false;\n reject(new ServerError(this.metadata.status, typeof (reason) === \"string\" ? reason : \"Unknown server response error.\"));\n }\n });\n }\n\n /** Override to supply an alternate fetch function. */\n protected supplyFetch(): typeof fetch {\n return fetch;\n }\n\n /** Override to supply an alternate Request function. */\n protected supplyRequest(): typeof Request {\n return Request;\n }\n\n private async performFetch(): Promise<number> {\n const requestClass = this.supplyRequest();\n const fetchFunction = this.supplyFetch();\n\n const path = new URL(this.path, typeof (location) !== \"undefined\" ? location.origin : undefined);\n if (this._pathSuffix) {\n const params = new URLSearchParams();\n params.set(\"parameters\", this._pathSuffix);\n path.search = `?${params.toString()}`;\n }\n\n const request = new requestClass(path.toString(), this._request);\n const response = await fetchFunction(request);\n this._response = response;\n this.metadata.status = response.status;\n return response.status;\n }\n\n private async loadText(response: Response) {\n const value = await response.text();\n this.metadata.message = value;\n return RpcSerializedValue.create(value);\n }\n\n private async loadBinary(response: Response) {\n const value = new Uint8Array(await response.arrayBuffer());\n const objects = JSON.stringify(MarshalingBinaryMarker.createDefault());\n return RpcSerializedValue.create(objects, [value]);\n }\n\n private async loadMultipart(response: Response, contentType: string) {\n const data = await response.arrayBuffer();\n const value = new RpcMultipartParser(contentType, new Uint8Array(data)).parse();\n return value;\n }\n\n private async setupTransport(): Promise<void> {\n const parameters = (await this.protocol.serialize(this)).parameters;\n const transportType = WebAppRpcRequest.computeTransportType(parameters, this.parameters);\n\n if (transportType === RpcContentType.Binary) {\n this.setupBinaryTransport(parameters);\n } else if (transportType === RpcContentType.Multipart) {\n this.setupMultipartTransport(parameters);\n } else {\n this.setupTextTransport(parameters);\n }\n }\n\n private setupBinaryTransport(parameters: RpcSerializedValue) {\n this._headers[WEB_RPC_CONSTANTS.CONTENT] = WEB_RPC_CONSTANTS.BINARY;\n this._request.method = \"post\";\n this._request.body = parameters.data[0];\n }\n\n private setupMultipartTransport(parameters: RpcSerializedValue) {\n // IMPORTANT: do not set a multipart Content-Type header value. The browser does this automatically!\n delete this._headers[WEB_RPC_CONSTANTS.CONTENT];\n this._request.method = \"post\";\n this._request.body = RpcMultipart.createForm(parameters);\n }\n\n private setupTextTransport(parameters: RpcSerializedValue) {\n if (this.operation.policy.allowResponseCaching(this)) {\n const encodedBody = btoa(parameters.objects);\n if (encodedBody.length <= WebAppRpcRequest.maxUrlComponentSize) {\n this._request.method = \"get\";\n this._request.body = undefined;\n delete this._headers[WEB_RPC_CONSTANTS.CONTENT];\n this._pathSuffix = encodedBody;\n return;\n }\n }\n\n this._pathSuffix = \"\";\n this._headers[WEB_RPC_CONSTANTS.CONTENT] = WEB_RPC_CONSTANTS.TEXT;\n this._request.method = \"post\";\n this._request.body = parameters.objects;\n }\n\n /** @internal */\n public static backend = {\n sendResponse: async (_protocol: WebAppRpcProtocol, _request: SerializedRpcRequest, _fulfillment: RpcRequestFulfillment, _req: HttpServerRequest, _res: HttpServerResponse): Promise<void> => {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n parseRequest: async (_protocol: WebAppRpcProtocol, _req: HttpServerRequest): Promise<SerializedRpcRequest> => {\n throw new IModelError(BentleyStatus.ERROR, \"Not bound.\");\n },\n };\n}\n"]}
|
|
@@ -87,6 +87,7 @@ class FeatureTableHeader {
|
|
|
87
87
|
const count = stream.readUint32();
|
|
88
88
|
return stream.isPastTheEnd ? undefined : new FeatureTableHeader(length, maxFeatures, count);
|
|
89
89
|
}
|
|
90
|
+
static { this.sizeInBytes = 12; }
|
|
90
91
|
constructor(length, numSubCategories, count) {
|
|
91
92
|
this.length = length;
|
|
92
93
|
this.numSubCategories = numSubCategories;
|
|
@@ -94,5 +95,4 @@ class FeatureTableHeader {
|
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
exports.FeatureTableHeader = FeatureTableHeader;
|
|
97
|
-
FeatureTableHeader.sizeInBytes = 12;
|
|
98
98
|
//# sourceMappingURL=IModelTileIO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelTileIO.js","sourceRoot":"","sources":["../../../src/tile/IModelTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyD;AACzD,wDAA+C;AAE/C,qCAA+E;AAE/E;;GAEG;AACH,IAAY,SAWX;AAXD,WAAY,SAAS;IACnB,uBAAuB;IACvB,yCAAQ,CAAA;IACR,6CAA6C;IAC7C,6DAAuB,CAAA;IACvB,wEAAwE;IACxE,qDAAmB,CAAA;IACnB,mEAAmE;IACnE,2EAA8B,CAAA;IAC9B,uEAAuE;IACvE,8EA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Content":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tile\n */\n\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { ElementAlignedBox3d } from \"../geometry/Placement\";\nimport { nextPoint3d64FromByteStream, TileFormat, TileHeader } from \"./TileIO\";\n\n/** Flags describing the geometry contained within a tile in iMdl format.\n * @internal\n */\nexport enum ImdlFlags {\n /** No special flags */\n None = 0,\n /** The tile contains some curved geometry */\n ContainsCurves = 1 << 0,\n /** Some geometry within the tile range was omitted based on its size */\n Incomplete = 1 << 2,\n /** The tile must be refined by sub-division, not magnification. */\n DisallowMagnification = 1 << 3,\n /** The tile's feature table contains features from multiple models. */\n MultiModelFeatureTable = 1 << 4,\n}\n\n/** Describes the maximum major and minor version of the iMdl tile format supported by this version of this package.\n * @internal\n */\nexport enum CurrentImdlVersion {\n /** The unsigned 16-bit major version number. If the major version specified in the tile header is greater than this value, then this\n * front-end is not capable of reading the tile content. Otherwise, this front-end can read the tile content even if the header specifies a\n * greater minor version than CurrentVersion.Minor, although some data may be skipped.\n */\n Major = 36,\n /** The unsigned 16-bit minor version number. If the major version in the tile header is equal to CurrentVersion.Major, then this package can\n * read the tile content even if the minor version in the tile header is greater than this value, although some data may be skipped.\n */\n Minor = 0,\n /** The unsigned 32-bit version number derived from the 16-bit major and minor version numbers. */\n Combined = (Major << 0x10) | Minor,\n}\n\n/** Header embedded at the beginning of binary tile data in iMdl format describing its contents.\n * @internal\n */\nexport class ImdlHeader extends TileHeader {\n /** The size of this header in bytes. */\n public readonly headerLength: number;\n /** Flags describing the geometry contained within the tile */\n public readonly flags: ImdlFlags;\n /** A bounding box no larger than the tile's range, tightly enclosing the tile's geometry; or a null range if the tile is empty */\n public readonly contentRange: ElementAlignedBox3d;\n /** The chord tolerance in meters at which the tile's geometry was faceted */\n public readonly tolerance: number;\n /** The number of elements which contributed at least some geometry to the tile content */\n public readonly numElementsIncluded: number;\n /** The number of elements within the tile range which contributed no geometry to the tile content */\n public readonly numElementsExcluded: number;\n /** The total number of bytes in the binary tile data, including this header */\n public readonly tileLength: number;\n /** A bitfield wherein each set bit indicates an empty sub-volume. */\n public readonly emptySubRanges: number;\n\n public get versionMajor(): number { return this.version >>> 0x10; }\n public get versionMinor(): number { return (this.version & 0xffff) >>> 0; }\n\n public get isValid(): boolean { return TileFormat.IModel === this.format; }\n public get isReadableVersion(): boolean { return this.versionMajor <= CurrentImdlVersion.Major; }\n\n /** Deserialize a header from the binary data at the stream's current position.\n * If the binary data does not contain a valid header, the Header will be marked 'invalid'.\n */\n public constructor(stream: ByteStream) {\n super(stream);\n this.headerLength = stream.readUint32();\n this.flags = stream.readUint32();\n\n this.contentRange = new Range3d();\n nextPoint3d64FromByteStream(stream, this.contentRange.low);\n nextPoint3d64FromByteStream(stream, this.contentRange.high);\n\n this.tolerance = stream.readFloat64();\n this.numElementsIncluded = stream.readUint32();\n this.numElementsExcluded = stream.readUint32();\n this.tileLength = stream.readUint32();\n\n // empty sub-volume bit field introduced in format v02.00\n this.emptySubRanges = this.versionMajor >= 2 ? stream.readUint32() : 0;\n\n // Skip any unprocessed bytes in header\n const remainingHeaderBytes = this.headerLength - stream.curPos;\n assert(remainingHeaderBytes >= 0);\n stream.advance(remainingHeaderBytes);\n\n if (stream.isPastTheEnd)\n this.invalidate();\n }\n}\n\n/** Header preceding the feature table embedded in an iMdl tile's content.\n * @internal\n */\nexport class FeatureTableHeader {\n // The number of bytes the entire table occupies.\n public readonly length: number;\n // The number of subcategories in the table.\n // NOTE: This used to be \"max features\" which was useless and unused. It is only accurate if ImdlFlags.HasMultiModelFeatureTable is set.\n public readonly numSubCategories: number;\n // The number of features in the table.\n public readonly count: number;\n\n public static readFrom(stream: ByteStream) {\n const length = stream.readUint32();\n const maxFeatures = stream.readUint32();\n const count = stream.readUint32();\n return stream.isPastTheEnd ? undefined : new FeatureTableHeader(length, maxFeatures, count);\n }\n\n public static sizeInBytes = 12;\n\n private constructor(length: number, numSubCategories: number, count: number) {\n this.length = length;\n this.numSubCategories = numSubCategories;\n this.count = count;\n }\n}\n"]}
|