@itwin/core-common 3.4.0-dev.8 → 3.5.0-dev.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -1
- package/lib/cjs/Camera.d.ts.map +1 -1
- package/lib/cjs/Camera.js +7 -3
- package/lib/cjs/Camera.js.map +1 -1
- package/lib/cjs/CloudStorage.d.ts +20 -5
- package/lib/cjs/CloudStorage.d.ts.map +1 -1
- package/lib/cjs/CloudStorage.js +13 -3
- package/lib/cjs/CloudStorage.js.map +1 -1
- package/lib/cjs/CloudStorageTileCache.d.ts +4 -1
- package/lib/cjs/CloudStorageTileCache.d.ts.map +1 -1
- package/lib/cjs/CloudStorageTileCache.js +5 -1
- package/lib/cjs/CloudStorageTileCache.js.map +1 -1
- package/lib/cjs/Code.d.ts +10 -4
- package/lib/cjs/Code.d.ts.map +1 -1
- package/lib/cjs/Code.js +6 -2
- package/lib/cjs/Code.js.map +1 -1
- package/lib/cjs/ColorDef.d.ts.map +1 -1
- package/lib/cjs/ColorDef.js +2 -0
- package/lib/cjs/ColorDef.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
- package/lib/cjs/ConcurrentQuery.js +56 -14
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/ContextRealityModel.d.ts +21 -0
- package/lib/cjs/ContextRealityModel.d.ts.map +1 -1
- package/lib/cjs/ContextRealityModel.js +33 -0
- package/lib/cjs/ContextRealityModel.js.map +1 -1
- package/lib/cjs/DisplayStyleSettings.d.ts +32 -0
- package/lib/cjs/DisplayStyleSettings.d.ts.map +1 -1
- package/lib/cjs/DisplayStyleSettings.js +30 -0
- package/lib/cjs/DisplayStyleSettings.js.map +1 -1
- package/lib/cjs/ECSchemaProps.d.ts +40 -0
- package/lib/cjs/ECSchemaProps.d.ts.map +1 -0
- package/lib/cjs/ECSchemaProps.js +10 -0
- package/lib/cjs/ECSchemaProps.js.map +1 -0
- package/lib/cjs/ElementProps.d.ts +6 -0
- package/lib/cjs/ElementProps.d.ts.map +1 -1
- package/lib/cjs/ElementProps.js.map +1 -1
- package/lib/cjs/FeatureGates.d.ts.map +1 -1
- package/lib/cjs/FeatureGates.js +6 -2
- package/lib/cjs/FeatureGates.js.map +1 -1
- package/lib/cjs/FeatureIndex.d.ts.map +1 -1
- package/lib/cjs/FeatureIndex.js +5 -1
- package/lib/cjs/FeatureIndex.js.map +1 -1
- package/lib/cjs/FeatureSymbology.d.ts.map +1 -1
- package/lib/cjs/FeatureSymbology.js.map +1 -1
- package/lib/cjs/Fonts.d.ts.map +1 -1
- package/lib/cjs/Fonts.js.map +1 -1
- package/lib/cjs/Frustum.d.ts.map +1 -1
- package/lib/cjs/Frustum.js +55 -21
- package/lib/cjs/Frustum.js.map +1 -1
- package/lib/cjs/Gradient.d.ts +18 -2
- package/lib/cjs/Gradient.d.ts.map +1 -1
- package/lib/cjs/Gradient.js +29 -18
- package/lib/cjs/Gradient.js.map +1 -1
- package/lib/cjs/IModel.d.ts +4 -0
- package/lib/cjs/IModel.d.ts.map +1 -1
- package/lib/cjs/IModel.js +8 -1
- package/lib/cjs/IModel.js.map +1 -1
- package/lib/cjs/Image.d.ts.map +1 -1
- package/lib/cjs/Image.js +3 -1
- package/lib/cjs/Image.js.map +1 -1
- package/lib/cjs/Localization.d.ts +4 -5
- package/lib/cjs/Localization.d.ts.map +1 -1
- package/lib/cjs/Localization.js.map +1 -1
- package/lib/cjs/QPoint.d.ts +185 -5
- package/lib/cjs/QPoint.d.ts.map +1 -1
- package/lib/cjs/QPoint.js +204 -4
- package/lib/cjs/QPoint.js.map +1 -1
- package/lib/cjs/RealityModelDisplaySettings.d.ts +119 -0
- package/lib/cjs/RealityModelDisplaySettings.d.ts.map +1 -0
- package/lib/cjs/RealityModelDisplaySettings.js +115 -0
- package/lib/cjs/RealityModelDisplaySettings.js.map +1 -0
- package/lib/cjs/Render.d.ts.map +1 -1
- package/lib/cjs/Render.js +11 -3
- package/lib/cjs/Render.js.map +1 -1
- package/lib/cjs/RgbColor.d.ts +9 -1
- package/lib/cjs/RgbColor.d.ts.map +1 -1
- package/lib/cjs/RgbColor.js +12 -2
- package/lib/cjs/RgbColor.js.map +1 -1
- package/lib/cjs/SubCategoryOverride.d.ts.map +1 -1
- package/lib/cjs/SubCategoryOverride.js.map +1 -1
- package/lib/cjs/TerrainSettings.d.ts +12 -7
- package/lib/cjs/TerrainSettings.d.ts.map +1 -1
- package/lib/cjs/TerrainSettings.js +2 -1
- package/lib/cjs/TerrainSettings.js.map +1 -1
- package/lib/cjs/ThematicDisplay.d.ts +6 -10
- package/lib/cjs/ThematicDisplay.d.ts.map +1 -1
- package/lib/cjs/ThematicDisplay.js.map +1 -1
- package/lib/cjs/TileProps.d.ts +5 -0
- package/lib/cjs/TileProps.d.ts.map +1 -1
- package/lib/cjs/TileProps.js +12 -1
- package/lib/cjs/TileProps.js.map +1 -1
- package/lib/cjs/ViewFlags.d.ts.map +1 -1
- package/lib/cjs/ViewFlags.js.map +1 -1
- package/lib/cjs/core-common.d.ts +2 -0
- package/lib/cjs/core-common.d.ts.map +1 -1
- package/lib/cjs/core-common.js +2 -0
- package/lib/cjs/core-common.js.map +1 -1
- package/lib/cjs/geometry/BoundingSphere.d.ts.map +1 -1
- package/lib/cjs/geometry/BoundingSphere.js +8 -2
- package/lib/cjs/geometry/BoundingSphere.js.map +1 -1
- package/lib/cjs/geometry/TextString.d.ts.map +1 -1
- package/lib/cjs/geometry/TextString.js.map +1 -1
- package/lib/cjs/ipc/IpcWebSocket.d.ts +3 -0
- package/lib/cjs/ipc/IpcWebSocket.d.ts.map +1 -1
- package/lib/cjs/ipc/IpcWebSocket.js +28 -14
- package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
- package/lib/cjs/ipc/IpcWebSocketTransport.js +10 -3
- package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.js +1 -1
- package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/IModelTileRpcInterface.d.ts +9 -1
- package/lib/cjs/rpc/IModelTileRpcInterface.d.ts.map +1 -1
- package/lib/cjs/rpc/IModelTileRpcInterface.js +12 -2
- package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/cjs/rpc/core/RpcConfiguration.js +1 -1
- package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
- package/lib/cjs/rpc/core/RpcConstants.d.ts +3 -1
- package/lib/cjs/rpc/core/RpcConstants.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcConstants.js +4 -1
- package/lib/cjs/rpc/core/RpcConstants.js.map +1 -1
- package/lib/cjs/rpc/core/RpcRequest.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcRequest.js +8 -2
- package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.d.ts.map +1 -1
- package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js +3 -0
- package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcProtocol.d.ts +1 -1
- package/lib/cjs/rpc/web/WebAppRpcProtocol.d.ts.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcProtocol.js +17 -1
- package/lib/cjs/rpc/web/WebAppRpcProtocol.js.map +1 -1
- package/lib/cjs/rpc/web/WebAppRpcRequest.js +1 -1
- package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
- package/lib/cjs/rpc/web/multipart/RpcMultipartParser.d.ts.map +1 -1
- package/lib/cjs/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
- package/lib/cjs/tile/I3dmTileIO.d.ts.map +1 -1
- package/lib/cjs/tile/I3dmTileIO.js.map +1 -1
- package/lib/esm/Camera.d.ts.map +1 -1
- package/lib/esm/Camera.js +7 -3
- package/lib/esm/Camera.js.map +1 -1
- package/lib/esm/CloudStorage.d.ts +20 -5
- package/lib/esm/CloudStorage.d.ts.map +1 -1
- package/lib/esm/CloudStorage.js +13 -3
- package/lib/esm/CloudStorage.js.map +1 -1
- package/lib/esm/CloudStorageTileCache.d.ts +4 -1
- package/lib/esm/CloudStorageTileCache.d.ts.map +1 -1
- package/lib/esm/CloudStorageTileCache.js +5 -1
- package/lib/esm/CloudStorageTileCache.js.map +1 -1
- package/lib/esm/Code.d.ts +10 -4
- package/lib/esm/Code.d.ts.map +1 -1
- package/lib/esm/Code.js +6 -2
- package/lib/esm/Code.js.map +1 -1
- package/lib/esm/ColorDef.d.ts.map +1 -1
- package/lib/esm/ColorDef.js +2 -0
- package/lib/esm/ColorDef.js.map +1 -1
- package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
- package/lib/esm/ConcurrentQuery.js +56 -14
- package/lib/esm/ConcurrentQuery.js.map +1 -1
- package/lib/esm/ContextRealityModel.d.ts +21 -0
- package/lib/esm/ContextRealityModel.d.ts.map +1 -1
- package/lib/esm/ContextRealityModel.js +33 -0
- package/lib/esm/ContextRealityModel.js.map +1 -1
- package/lib/esm/DisplayStyleSettings.d.ts +32 -0
- package/lib/esm/DisplayStyleSettings.d.ts.map +1 -1
- package/lib/esm/DisplayStyleSettings.js +30 -0
- package/lib/esm/DisplayStyleSettings.js.map +1 -1
- package/lib/esm/ECSchemaProps.d.ts +40 -0
- package/lib/esm/ECSchemaProps.d.ts.map +1 -0
- package/lib/esm/ECSchemaProps.js +9 -0
- package/lib/esm/ECSchemaProps.js.map +1 -0
- package/lib/esm/ElementProps.d.ts +6 -0
- package/lib/esm/ElementProps.d.ts.map +1 -1
- package/lib/esm/ElementProps.js.map +1 -1
- package/lib/esm/FeatureGates.d.ts.map +1 -1
- package/lib/esm/FeatureGates.js +6 -2
- package/lib/esm/FeatureGates.js.map +1 -1
- package/lib/esm/FeatureIndex.d.ts.map +1 -1
- package/lib/esm/FeatureIndex.js +5 -1
- package/lib/esm/FeatureIndex.js.map +1 -1
- package/lib/esm/FeatureSymbology.d.ts.map +1 -1
- package/lib/esm/FeatureSymbology.js.map +1 -1
- package/lib/esm/Fonts.d.ts.map +1 -1
- package/lib/esm/Fonts.js.map +1 -1
- package/lib/esm/Frustum.d.ts.map +1 -1
- package/lib/esm/Frustum.js +55 -21
- package/lib/esm/Frustum.js.map +1 -1
- package/lib/esm/Gradient.d.ts +18 -2
- package/lib/esm/Gradient.d.ts.map +1 -1
- package/lib/esm/Gradient.js +29 -18
- package/lib/esm/Gradient.js.map +1 -1
- package/lib/esm/IModel.d.ts +4 -0
- package/lib/esm/IModel.d.ts.map +1 -1
- package/lib/esm/IModel.js +8 -1
- package/lib/esm/IModel.js.map +1 -1
- package/lib/esm/Image.d.ts.map +1 -1
- package/lib/esm/Image.js +3 -1
- package/lib/esm/Image.js.map +1 -1
- package/lib/esm/Localization.d.ts +4 -5
- package/lib/esm/Localization.d.ts.map +1 -1
- package/lib/esm/Localization.js.map +1 -1
- package/lib/esm/QPoint.d.ts +185 -5
- package/lib/esm/QPoint.d.ts.map +1 -1
- package/lib/esm/QPoint.js +203 -5
- package/lib/esm/QPoint.js.map +1 -1
- package/lib/esm/RealityModelDisplaySettings.d.ts +119 -0
- package/lib/esm/RealityModelDisplaySettings.d.ts.map +1 -0
- package/lib/esm/RealityModelDisplaySettings.js +110 -0
- package/lib/esm/RealityModelDisplaySettings.js.map +1 -0
- package/lib/esm/Render.d.ts.map +1 -1
- package/lib/esm/Render.js +11 -3
- package/lib/esm/Render.js.map +1 -1
- package/lib/esm/RgbColor.d.ts +9 -1
- package/lib/esm/RgbColor.d.ts.map +1 -1
- package/lib/esm/RgbColor.js +12 -2
- package/lib/esm/RgbColor.js.map +1 -1
- package/lib/esm/SubCategoryOverride.d.ts.map +1 -1
- package/lib/esm/SubCategoryOverride.js.map +1 -1
- package/lib/esm/TerrainSettings.d.ts +12 -7
- package/lib/esm/TerrainSettings.d.ts.map +1 -1
- package/lib/esm/TerrainSettings.js +2 -1
- package/lib/esm/TerrainSettings.js.map +1 -1
- package/lib/esm/ThematicDisplay.d.ts +6 -10
- package/lib/esm/ThematicDisplay.d.ts.map +1 -1
- package/lib/esm/ThematicDisplay.js.map +1 -1
- package/lib/esm/TileProps.d.ts +5 -0
- package/lib/esm/TileProps.d.ts.map +1 -1
- package/lib/esm/TileProps.js +10 -0
- package/lib/esm/TileProps.js.map +1 -1
- package/lib/esm/ViewFlags.d.ts.map +1 -1
- package/lib/esm/ViewFlags.js.map +1 -1
- package/lib/esm/core-common.d.ts +2 -0
- package/lib/esm/core-common.d.ts.map +1 -1
- package/lib/esm/core-common.js +2 -0
- package/lib/esm/core-common.js.map +1 -1
- package/lib/esm/geometry/BoundingSphere.d.ts.map +1 -1
- package/lib/esm/geometry/BoundingSphere.js +8 -2
- package/lib/esm/geometry/BoundingSphere.js.map +1 -1
- package/lib/esm/geometry/TextString.d.ts.map +1 -1
- package/lib/esm/geometry/TextString.js.map +1 -1
- package/lib/esm/ipc/IpcWebSocket.d.ts +3 -0
- package/lib/esm/ipc/IpcWebSocket.d.ts.map +1 -1
- package/lib/esm/ipc/IpcWebSocket.js +28 -14
- package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
- package/lib/esm/ipc/IpcWebSocketTransport.js +10 -3
- package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.js +1 -1
- package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
- package/lib/esm/rpc/IModelTileRpcInterface.d.ts +9 -1
- package/lib/esm/rpc/IModelTileRpcInterface.d.ts.map +1 -1
- package/lib/esm/rpc/IModelTileRpcInterface.js +12 -2
- package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
- package/lib/esm/rpc/core/RpcConfiguration.js +1 -1
- package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
- package/lib/esm/rpc/core/RpcConstants.d.ts +3 -1
- package/lib/esm/rpc/core/RpcConstants.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcConstants.js +4 -1
- package/lib/esm/rpc/core/RpcConstants.js.map +1 -1
- package/lib/esm/rpc/core/RpcRequest.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcRequest.js +8 -2
- package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcProtocol.d.ts.map +1 -1
- package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js +3 -0
- package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcProtocol.d.ts +1 -1
- package/lib/esm/rpc/web/WebAppRpcProtocol.d.ts.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcProtocol.js +17 -1
- package/lib/esm/rpc/web/WebAppRpcProtocol.js.map +1 -1
- package/lib/esm/rpc/web/WebAppRpcRequest.js +1 -1
- package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
- package/lib/esm/rpc/web/multipart/RpcMultipartParser.d.ts.map +1 -1
- package/lib/esm/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
- package/lib/esm/tile/I3dmTileIO.d.ts.map +1 -1
- package/lib/esm/tile/I3dmTileIO.js.map +1 -1
- package/package.json +10 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcMultipartParser.js","sourceRoot":"","sources":["../../../../../src/rpc/web/multipart/RpcMultipartParser.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BE;AACF,mCAAgC;AAChC,mDAA+C;AAC/C,4DAA8D;AAE9D,MAAM,KAAK,GAAG,CAAC,CAAC;AAChB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAA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Y,CAAC;QAEzD,IAAI,CAA0B,CAAC;QAC/B,IAAI,IAAI,CAAC,YAAY,KAAK,qBAAqB,EAAE;YAC/C,IAAI,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE;gBACpD,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;aACvB;YACD,yDAAyD;SAC1D;aAAM,IAAI,IAAI,CAAC,YAAY,KAAK,2BAA2B,EAAE;YAC5D,gEAAgE;SACjE;QAED,IAAI,CAAC,mBAAmB,GAAG,IAAI,8BAAa,CAAC,MAAM,CAAC,CAAC;QACrD,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,mBAAmB,GAAG,IAAI,8BAAa,CAAC,MAAM,CAAC,CAAC;QACrD,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IACzB,CAAC;IAEO,gBAAgB,CAAC,CAAS;QAChC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAEO,eAAe;QACrB,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAExG,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;YAChC,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;SAC5C;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAClC;QAED,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAEO,kBAAkB,CAAC,OAAe;IAC1C,CAAC;CACF;AAnUD,gDAmUC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\n/*\r\nAdapted from https://github.com/pillarjs/multiparty. Multiparty license as follows:\r\n(The MIT License)\r\n\r\nCopyright (c) 2013 Felix Geisendörfer\r\nCopyright (c) 2014 Andrew Kelley\r\nCopyright (c) 2014 Douglas Christopher Wilson\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining\r\na copy of this software and associated documentation files (the\r\n'Software'), to deal in the Software without restriction, including\r\nwithout limitation the rights to use, copy, modify, merge, publish,\r\ndistribute, sublicense, and/or sell copies of the Software, and to\r\npermit persons to whom the Software is furnished to do so, subject to\r\nthe following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be\r\nincluded in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n*/\r\nimport { Buffer } from \"buffer\";\r\nimport { StringDecoder } from \"string_decoder\";\r\nimport { RpcSerializedValue } from \"../../core/RpcMarshaling\";\r\n\r\nconst START = 0;\r\nconst START_BOUNDARY = 1;\r\nconst HEADER_FIELD_START = 2;\r\nconst HEADER_FIELD = 3;\r\nconst HEADER_VALUE_START = 4;\r\nconst HEADER_VALUE = 5;\r\nconst HEADER_VALUE_ALMOST_DONE = 6;\r\nconst HEADERS_ALMOST_DONE = 7;\r\nconst PART_DATA_START = 8;\r\nconst PART_DATA = 9;\r\nconst CLOSE_BOUNDARY = 10;\r\nconst END = 11;\r\n\r\nconst LF = 10;\r\nconst CR = 13;\r\nconst SPACE = 32;\r\nconst HYPHEN = 45;\r\nconst COLON = 58;\r\nconst A = 97;\r\nconst Z = 122;\r\n\r\nconst CONTENT_TYPE_RE = /^multipart\\/(?:form-data|related)(?:;|$)/i;\r\nconst CONTENT_TYPE_PARAM_RE = /;\\s*([^=]+)=(?:\"([^\"]+)\"|([^;]+))/gi;\r\n\r\n/** @internal */\r\nexport class RpcMultipartParser {\r\n private _headerFieldMark: number | null;\r\n private _headerValueMark: number | null;\r\n private _partDataMark: number | null;\r\n private _partBoundaryFlag: boolean;\r\n private _headerFieldDecoder: StringDecoder | null;\r\n private _headerValueDecoder: StringDecoder | null;\r\n private _headerField: string;\r\n private _partHeaders: { [index: string]: string };\r\n private _partName: string | null;\r\n private _partChunks: Buffer[];\r\n private _headerValue: string;\r\n private _boundary: string;\r\n private _buffer: Buffer;\r\n private _value: RpcSerializedValue;\r\n\r\n public constructor(contentType: string, buffer: Buffer) {\r\n let m = CONTENT_TYPE_RE.exec(contentType);\r\n if (!m) {\r\n throw new Error(\"unsupported content-type\");\r\n }\r\n\r\n let boundary = \"\";\r\n CONTENT_TYPE_PARAM_RE.lastIndex = m.index + m[0].length - 1;\r\n while ((m = CONTENT_TYPE_PARAM_RE.exec(contentType))) {\r\n if (m[1].toLowerCase() !== \"boundary\") continue;\r\n boundary = m[2] || m[3];\r\n break;\r\n }\r\n\r\n if (!boundary) {\r\n throw new Error(\"content-type missing boundary\");\r\n }\r\n\r\n this._headerFieldDecoder = null;\r\n this._headerValueDecoder = null;\r\n this._headerField = \"\";\r\n this._partHeaders = {};\r\n this._partName = null;\r\n this._partChunks = [];\r\n this._headerValue = \"\";\r\n\r\n this._headerFieldMark = null;\r\n this._headerValueMark = null;\r\n this._partDataMark = null;\r\n this._partBoundaryFlag = false;\r\n\r\n this._boundary = boundary;\r\n this._buffer = buffer;\r\n this._value = RpcSerializedValue.create();\r\n }\r\n\r\n public parse(): RpcSerializedValue {\r\n let i = 0;\r\n const len = this._buffer.length;\r\n let prevIndex = 0;\r\n let index = 0;\r\n let state = START;\r\n\r\n const boundary = Buffer.alloc(this._boundary.length + 4);\r\n boundary.write(\"\\r\\n--\", 0, this._boundary.length + 4, \"ascii\");\r\n boundary.write(this._boundary, 4, this._boundary.length, \"ascii\");\r\n\r\n const boundaryChars: { [index: number]: boolean } = {};\r\n for (const char of boundary) {\r\n boundaryChars[char] = true;\r\n }\r\n\r\n const boundaryLength = boundary.length;\r\n const boundaryEnd = boundaryLength - 1;\r\n const bufferLength = this._buffer.length;\r\n const lookbehind = Buffer.alloc(boundaryLength + 8);\r\n\r\n let c;\r\n let cl;\r\n\r\n for (i = 0; i < len; i++) {\r\n c = this._buffer[i];\r\n switch (state) {\r\n case START:\r\n index = 0;\r\n state = START_BOUNDARY;\r\n /* falls through */\r\n case START_BOUNDARY:\r\n if (index === boundaryLength - 2 && c === HYPHEN) {\r\n index = 1;\r\n state = CLOSE_BOUNDARY;\r\n break;\r\n } else if (index === boundaryLength - 2) {\r\n if (c !== CR) throw new Error(`Expected CR Received ${c}`);\r\n index++;\r\n break;\r\n } else if (index === boundaryLength - 1) {\r\n if (c !== LF) throw new Error(`Expected LF Received ${c}`);\r\n index = 0;\r\n this._onParsePartBegin();\r\n state = HEADER_FIELD_START;\r\n break;\r\n }\r\n\r\n if (c !== boundary[index + 2]) index = -2;\r\n if (c === boundary[index + 2]) index++;\r\n break;\r\n case HEADER_FIELD_START:\r\n state = HEADER_FIELD;\r\n this._headerFieldMark = i;\r\n index = 0;\r\n /* falls through */\r\n case HEADER_FIELD:\r\n if (c === CR) {\r\n this._headerFieldMark = null;\r\n state = HEADERS_ALMOST_DONE;\r\n break;\r\n }\r\n\r\n index++;\r\n if (c === HYPHEN) break;\r\n\r\n if (c === COLON) {\r\n if (index === 1) {\r\n // empty header field\r\n throw new Error(\"Empty header field\");\r\n }\r\n this._onParseHeaderField(this._buffer.slice(this._headerFieldMark as number, i));\r\n this._headerFieldMark = null;\r\n state = HEADER_VALUE_START;\r\n break;\r\n }\r\n\r\n cl = c | 0x20;\r\n if (cl < A || cl > Z) {\r\n throw new Error(`Expected alphabetic character, received ${c}`);\r\n }\r\n break;\r\n case HEADER_VALUE_START:\r\n if (c === SPACE) break;\r\n\r\n this._headerValueMark = i;\r\n state = HEADER_VALUE;\r\n /* falls through */\r\n case HEADER_VALUE:\r\n if (c === CR) {\r\n this._onParseHeaderValue(this._buffer.slice(this._headerValueMark as number, i));\r\n this._headerValueMark = null;\r\n this._onParseHeaderEnd();\r\n state = HEADER_VALUE_ALMOST_DONE;\r\n }\r\n break;\r\n case HEADER_VALUE_ALMOST_DONE:\r\n if (c !== LF) throw new Error(`Expected LF Received ${c}`);\r\n state = HEADER_FIELD_START;\r\n break;\r\n case HEADERS_ALMOST_DONE:\r\n if (c !== LF) throw new Error(`Expected LF Received ${c}`);\r\n const err: any = this._onParseHeadersEnd(i + 1);\r\n if (err) throw err;\r\n state = PART_DATA_START;\r\n break;\r\n case PART_DATA_START:\r\n state = PART_DATA;\r\n this._partDataMark = i;\r\n /* falls through */\r\n case PART_DATA:\r\n prevIndex = index;\r\n\r\n if (index === 0) {\r\n // boyer-moore derived algorithm to safely skip non-boundary data\r\n i += boundaryEnd;\r\n while (i < bufferLength && !(this._buffer[i] in boundaryChars)) {\r\n i += boundaryLength;\r\n }\r\n i -= boundaryEnd;\r\n c = this._buffer[i];\r\n }\r\n\r\n if (index < boundaryLength) {\r\n if (boundary[index] === c) {\r\n if (index === 0) {\r\n this._onParsePartData(this._buffer.slice(this._partDataMark as number, i));\r\n this._partDataMark = null;\r\n }\r\n index++;\r\n } else {\r\n index = 0;\r\n }\r\n } else if (index === boundaryLength) {\r\n index++;\r\n if (c === CR) {\r\n // CR = part boundary\r\n this._partBoundaryFlag = true;\r\n } else if (c === HYPHEN) {\r\n index = 1;\r\n state = CLOSE_BOUNDARY;\r\n break;\r\n } else {\r\n index = 0;\r\n }\r\n } else if (index - 1 === boundaryLength) {\r\n if (this._partBoundaryFlag) {\r\n index = 0;\r\n if (c === LF) {\r\n this._partBoundaryFlag = false;\r\n this._onParsePartEnd();\r\n this._onParsePartBegin();\r\n state = HEADER_FIELD_START;\r\n break;\r\n }\r\n } else {\r\n index = 0;\r\n }\r\n }\r\n\r\n if (index > 0) {\r\n // when matching a possible boundary, keep a lookbehind reference\r\n // in case it turns out to be a false lead\r\n lookbehind[index - 1] = c;\r\n } else if (prevIndex > 0) {\r\n // if our boundary turned out to be rubbish, the captured lookbehind\r\n // belongs to partData\r\n this._onParsePartData(lookbehind.slice(0, prevIndex));\r\n prevIndex = 0;\r\n this._partDataMark = i;\r\n\r\n // reconsider the current character even so it interrupted the sequence\r\n // it could be the beginning of a new sequence\r\n i--;\r\n }\r\n\r\n break;\r\n case CLOSE_BOUNDARY:\r\n if (c !== HYPHEN) throw new Error(`Expected HYPHEN Received ${c}`);\r\n if (index === 1) {\r\n this._onParsePartEnd();\r\n state = END;\r\n } else if (index > 1) {\r\n throw new Error(\"Parser has invalid state.\");\r\n }\r\n index++;\r\n break;\r\n case END:\r\n break;\r\n default:\r\n throw new Error(\"Parser has invalid state.\");\r\n }\r\n }\r\n\r\n if (this._headerFieldMark != null) {\r\n this._onParseHeaderField(this._buffer.slice(this._headerFieldMark));\r\n this._headerFieldMark = 0;\r\n }\r\n if (this._headerValueMark != null) {\r\n this._onParseHeaderValue(this._buffer.slice(this._headerValueMark));\r\n this._headerValueMark = 0;\r\n }\r\n if (this._partDataMark != null) {\r\n this._onParsePartData(this._buffer.slice(this._partDataMark));\r\n this._partDataMark = 0;\r\n }\r\n\r\n return this._value;\r\n }\r\n\r\n private _onParsePartBegin() {\r\n this._clearPartVars();\r\n }\r\n\r\n private _clearPartVars() {\r\n this._partHeaders = {};\r\n this._partName = null;\r\n this._partChunks.length = 0;\r\n\r\n this._headerFieldDecoder = new StringDecoder(\"utf8\");\r\n this._headerField = \"\";\r\n this._headerValueDecoder = new StringDecoder(\"utf8\");\r\n this._headerValue = \"\";\r\n }\r\n\r\n private _onParseHeaderField(b: Buffer) {\r\n this._headerField += this._headerFieldDecoder!.write(b);\r\n }\r\n\r\n private _onParseHeaderValue(b: Buffer) {\r\n this._headerValue += this._headerValueDecoder!.write(b);\r\n }\r\n\r\n private _onParseHeaderEnd() {\r\n this._headerField = this._headerField.toLowerCase();\r\n this._partHeaders[this._headerField] = this._headerValue;\r\n\r\n let m: RegExpMatchArray | null;\r\n if (this._headerField === \"content-disposition\") {\r\n if (m = this._headerValue.match(/\\bname=\"([^\"]+)\"/i)) {\r\n this._partName = m[1];\r\n }\r\n // this._partFilename = parseFilename(this._headerValue);\r\n } else if (this._headerField === \"content-transfer-encoding\") {\r\n // this._partTransferEncoding = this._headerValue.toLowerCase();\r\n }\r\n\r\n this._headerFieldDecoder = new StringDecoder(\"utf8\");\r\n this._headerField = \"\";\r\n this._headerValueDecoder = new StringDecoder(\"utf8\");\r\n this._headerValue = \"\";\r\n }\r\n\r\n private _onParsePartData(b: Buffer) {\r\n this._partChunks.push(b);\r\n }\r\n\r\n private _onParsePartEnd() {\r\n const partValue = this._partChunks.length === 1 ? this._partChunks[0] : Buffer.concat(this._partChunks);\r\n\r\n if (this._partName === \"objects\") {\r\n this._value.objects = partValue.toString();\r\n } else {\r\n this._value.data.push(partValue);\r\n }\r\n\r\n this._clearPartVars();\r\n }\r\n\r\n private _onParseHeadersEnd(_offset: number) {\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"RpcMultipartParser.js","sourceRoot":"","sources":["../../../../../src/rpc/web/multipart/RpcMultipartParser.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BE;AACF,mCAAgC;AAChC,mDAA+C;AAC/C,4DAA8D;AAE9D,MAAM,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AAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAClC;QAED,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAEO,kBAAkB,CAAC,OAAe;IAC1C,CAAC;CACF;AAvVD,gDAuVC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\n/*\r\nAdapted from https://github.com/pillarjs/multiparty. Multiparty license as follows:\r\n(The MIT License)\r\n\r\nCopyright (c) 2013 Felix Geisendörfer\r\nCopyright (c) 2014 Andrew Kelley\r\nCopyright (c) 2014 Douglas Christopher Wilson\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining\r\na copy of this software and associated documentation files (the\r\n'Software'), to deal in the Software without restriction, including\r\nwithout limitation the rights to use, copy, modify, merge, publish,\r\ndistribute, sublicense, and/or sell copies of the Software, and to\r\npermit persons to whom the Software is furnished to do so, subject to\r\nthe following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be\r\nincluded in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n*/\r\nimport { Buffer } from \"buffer\";\r\nimport { StringDecoder } from \"string_decoder\";\r\nimport { RpcSerializedValue } from \"../../core/RpcMarshaling\";\r\n\r\nconst START = 0;\r\nconst START_BOUNDARY = 1;\r\nconst HEADER_FIELD_START = 2;\r\nconst HEADER_FIELD = 3;\r\nconst HEADER_VALUE_START = 4;\r\nconst HEADER_VALUE = 5;\r\nconst HEADER_VALUE_ALMOST_DONE = 6;\r\nconst HEADERS_ALMOST_DONE = 7;\r\nconst PART_DATA_START = 8;\r\nconst PART_DATA = 9;\r\nconst CLOSE_BOUNDARY = 10;\r\nconst END = 11;\r\n\r\nconst LF = 10;\r\nconst CR = 13;\r\nconst SPACE = 32;\r\nconst HYPHEN = 45;\r\nconst COLON = 58;\r\nconst A = 97;\r\nconst Z = 122;\r\n\r\nconst CONTENT_TYPE_RE = /^multipart\\/(?:form-data|related)(?:;|$)/i;\r\nconst CONTENT_TYPE_PARAM_RE = /;\\s*([^=]+)=(?:\"([^\"]+)\"|([^;]+))/gi;\r\n\r\n/** @internal */\r\nexport class RpcMultipartParser {\r\n private _headerFieldMark: number | null;\r\n private _headerValueMark: number | null;\r\n private _partDataMark: number | null;\r\n private _partBoundaryFlag: boolean;\r\n private _headerFieldDecoder: StringDecoder | null;\r\n private _headerValueDecoder: StringDecoder | null;\r\n private _headerField: string;\r\n private _partHeaders: { [index: string]: string };\r\n private _partName: string | null;\r\n private _partChunks: Buffer[];\r\n private _headerValue: string;\r\n private _boundary: string;\r\n private _buffer: Buffer;\r\n private _value: RpcSerializedValue;\r\n\r\n public constructor(contentType: string, buffer: Buffer) {\r\n let m = CONTENT_TYPE_RE.exec(contentType);\r\n if (!m) {\r\n throw new Error(\"unsupported content-type\");\r\n }\r\n\r\n let boundary = \"\";\r\n CONTENT_TYPE_PARAM_RE.lastIndex = m.index + m[0].length - 1;\r\n while ((m = CONTENT_TYPE_PARAM_RE.exec(contentType))) {\r\n if (m[1].toLowerCase() !== \"boundary\")\r\n continue;\r\n\r\n boundary = m[2] || m[3];\r\n break;\r\n }\r\n\r\n if (!boundary) {\r\n throw new Error(\"content-type missing boundary\");\r\n }\r\n\r\n this._headerFieldDecoder = null;\r\n this._headerValueDecoder = null;\r\n this._headerField = \"\";\r\n this._partHeaders = {};\r\n this._partName = null;\r\n this._partChunks = [];\r\n this._headerValue = \"\";\r\n\r\n this._headerFieldMark = null;\r\n this._headerValueMark = null;\r\n this._partDataMark = null;\r\n this._partBoundaryFlag = false;\r\n\r\n this._boundary = boundary;\r\n this._buffer = buffer;\r\n this._value = RpcSerializedValue.create();\r\n }\r\n\r\n public parse(): RpcSerializedValue {\r\n let i = 0;\r\n const len = this._buffer.length;\r\n let prevIndex = 0;\r\n let index = 0;\r\n let state = START;\r\n\r\n const boundary = Buffer.alloc(this._boundary.length + 4);\r\n boundary.write(\"\\r\\n--\", 0, this._boundary.length + 4, \"ascii\");\r\n boundary.write(this._boundary, 4, this._boundary.length, \"ascii\");\r\n\r\n const boundaryChars: { [index: number]: boolean } = {};\r\n for (const char of boundary) {\r\n boundaryChars[char] = true;\r\n }\r\n\r\n const boundaryLength = boundary.length;\r\n const boundaryEnd = boundaryLength - 1;\r\n const bufferLength = this._buffer.length;\r\n const lookbehind = Buffer.alloc(boundaryLength + 8);\r\n\r\n let c;\r\n let cl;\r\n\r\n for (i = 0; i < len; i++) {\r\n c = this._buffer[i];\r\n switch (state) {\r\n case START:\r\n index = 0;\r\n state = START_BOUNDARY;\r\n /* falls through */\r\n case START_BOUNDARY:\r\n if (index === boundaryLength - 2 && c === HYPHEN) {\r\n index = 1;\r\n state = CLOSE_BOUNDARY;\r\n break;\r\n } else if (index === boundaryLength - 2) {\r\n if (c !== CR)\r\n throw new Error(`Expected CR Received ${c}`);\r\n\r\n index++;\r\n break;\r\n } else if (index === boundaryLength - 1) {\r\n if (c !== LF)\r\n throw new Error(`Expected LF Received ${c}`);\r\n\r\n index = 0;\r\n this._onParsePartBegin();\r\n state = HEADER_FIELD_START;\r\n break;\r\n }\r\n\r\n if (c !== boundary[index + 2])\r\n index = -2;\r\n\r\n if (c === boundary[index + 2])\r\n index++;\r\n\r\n break;\r\n case HEADER_FIELD_START:\r\n state = HEADER_FIELD;\r\n this._headerFieldMark = i;\r\n index = 0;\r\n /* falls through */\r\n case HEADER_FIELD:\r\n if (c === CR) {\r\n this._headerFieldMark = null;\r\n state = HEADERS_ALMOST_DONE;\r\n break;\r\n }\r\n\r\n index++;\r\n if (c === HYPHEN)\r\n break;\r\n\r\n if (c === COLON) {\r\n if (index === 1) {\r\n // empty header field\r\n throw new Error(\"Empty header field\");\r\n }\r\n this._onParseHeaderField(this._buffer.slice(this._headerFieldMark as number, i));\r\n this._headerFieldMark = null;\r\n state = HEADER_VALUE_START;\r\n break;\r\n }\r\n\r\n cl = c | 0x20;\r\n if (cl < A || cl > Z) {\r\n throw new Error(`Expected alphabetic character, received ${c}`);\r\n }\r\n break;\r\n case HEADER_VALUE_START:\r\n if (c === SPACE)\r\n break;\r\n\r\n this._headerValueMark = i;\r\n state = HEADER_VALUE;\r\n /* falls through */\r\n case HEADER_VALUE:\r\n if (c === CR) {\r\n this._onParseHeaderValue(this._buffer.slice(this._headerValueMark as number, i));\r\n this._headerValueMark = null;\r\n this._onParseHeaderEnd();\r\n state = HEADER_VALUE_ALMOST_DONE;\r\n }\r\n break;\r\n case HEADER_VALUE_ALMOST_DONE:\r\n if (c !== LF)\r\n throw new Error(`Expected LF Received ${c}`);\r\n\r\n state = HEADER_FIELD_START;\r\n break;\r\n case HEADERS_ALMOST_DONE:\r\n if (c !== LF)\r\n throw new Error(`Expected LF Received ${c}`);\r\n\r\n const err: any = this._onParseHeadersEnd(i + 1);\r\n if (err)\r\n throw err;\r\n\r\n state = PART_DATA_START;\r\n break;\r\n case PART_DATA_START:\r\n state = PART_DATA;\r\n this._partDataMark = i;\r\n /* falls through */\r\n case PART_DATA:\r\n prevIndex = index;\r\n\r\n if (index === 0) {\r\n // boyer-moore derived algorithm to safely skip non-boundary data\r\n i += boundaryEnd;\r\n while (i < bufferLength && !(this._buffer[i] in boundaryChars)) {\r\n i += boundaryLength;\r\n }\r\n i -= boundaryEnd;\r\n c = this._buffer[i];\r\n }\r\n\r\n if (index < boundaryLength) {\r\n if (boundary[index] === c) {\r\n if (index === 0) {\r\n this._onParsePartData(this._buffer.slice(this._partDataMark as number, i));\r\n this._partDataMark = null;\r\n }\r\n index++;\r\n } else {\r\n index = 0;\r\n }\r\n } else if (index === boundaryLength) {\r\n index++;\r\n if (c === CR) {\r\n // CR = part boundary\r\n this._partBoundaryFlag = true;\r\n } else if (c === HYPHEN) {\r\n index = 1;\r\n state = CLOSE_BOUNDARY;\r\n break;\r\n } else {\r\n index = 0;\r\n }\r\n } else if (index - 1 === boundaryLength) {\r\n if (this._partBoundaryFlag) {\r\n index = 0;\r\n if (c === LF) {\r\n this._partBoundaryFlag = false;\r\n this._onParsePartEnd();\r\n this._onParsePartBegin();\r\n state = HEADER_FIELD_START;\r\n break;\r\n }\r\n } else {\r\n index = 0;\r\n }\r\n }\r\n\r\n if (index > 0) {\r\n // when matching a possible boundary, keep a lookbehind reference\r\n // in case it turns out to be a false lead\r\n lookbehind[index - 1] = c;\r\n } else if (prevIndex > 0) {\r\n // if our boundary turned out to be rubbish, the captured lookbehind\r\n // belongs to partData\r\n this._onParsePartData(lookbehind.slice(0, prevIndex));\r\n prevIndex = 0;\r\n this._partDataMark = i;\r\n\r\n // reconsider the current character even so it interrupted the sequence\r\n // it could be the beginning of a new sequence\r\n i--;\r\n }\r\n\r\n break;\r\n case CLOSE_BOUNDARY:\r\n if (c !== HYPHEN)\r\n throw new Error(`Expected HYPHEN Received ${c}`);\r\n\r\n if (index === 1) {\r\n this._onParsePartEnd();\r\n state = END;\r\n } else if (index > 1) {\r\n throw new Error(\"Parser has invalid state.\");\r\n }\r\n index++;\r\n break;\r\n case END:\r\n break;\r\n default:\r\n throw new Error(\"Parser has invalid state.\");\r\n }\r\n }\r\n\r\n if (this._headerFieldMark != null) {\r\n this._onParseHeaderField(this._buffer.slice(this._headerFieldMark));\r\n this._headerFieldMark = 0;\r\n }\r\n if (this._headerValueMark != null) {\r\n this._onParseHeaderValue(this._buffer.slice(this._headerValueMark));\r\n this._headerValueMark = 0;\r\n }\r\n if (this._partDataMark != null) {\r\n this._onParsePartData(this._buffer.slice(this._partDataMark));\r\n this._partDataMark = 0;\r\n }\r\n\r\n return this._value;\r\n }\r\n\r\n private _onParsePartBegin() {\r\n this._clearPartVars();\r\n }\r\n\r\n private _clearPartVars() {\r\n this._partHeaders = {};\r\n this._partName = null;\r\n this._partChunks.length = 0;\r\n\r\n this._headerFieldDecoder = new StringDecoder(\"utf8\");\r\n this._headerField = \"\";\r\n this._headerValueDecoder = new StringDecoder(\"utf8\");\r\n this._headerValue = \"\";\r\n }\r\n\r\n private _onParseHeaderField(b: Buffer) {\r\n this._headerField += this._headerFieldDecoder!.write(b);\r\n }\r\n\r\n private _onParseHeaderValue(b: Buffer) {\r\n this._headerValue += this._headerValueDecoder!.write(b);\r\n }\r\n\r\n private _onParseHeaderEnd() {\r\n this._headerField = this._headerField.toLowerCase();\r\n this._partHeaders[this._headerField] = this._headerValue;\r\n\r\n let m: RegExpMatchArray | null;\r\n if (this._headerField === \"content-disposition\") {\r\n if (m = this._headerValue.match(/\\bname=\"([^\"]+)\"/i)) {\r\n this._partName = m[1];\r\n }\r\n // this._partFilename = parseFilename(this._headerValue);\r\n } else if (this._headerField === \"content-transfer-encoding\") {\r\n // this._partTransferEncoding = this._headerValue.toLowerCase();\r\n }\r\n\r\n this._headerFieldDecoder = new StringDecoder(\"utf8\");\r\n this._headerField = \"\";\r\n this._headerValueDecoder = new StringDecoder(\"utf8\");\r\n this._headerValue = \"\";\r\n }\r\n\r\n private _onParsePartData(b: Buffer) {\r\n this._partChunks.push(b);\r\n }\r\n\r\n private _onParsePartEnd() {\r\n const partValue = this._partChunks.length === 1 ? this._partChunks[0] : Buffer.concat(this._partChunks);\r\n\r\n if (this._partName === \"objects\") {\r\n this._value.objects = partValue.toString();\r\n } else {\r\n this._value.data.push(partValue);\r\n }\r\n\r\n this._clearPartVars();\r\n }\r\n\r\n private _onParseHeadersEnd(_offset: number) {\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"I3dmTileIO.d.ts","sourceRoot":"","sources":["../../../src/tile/I3dmTileIO.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAgB,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,qBAAa,UAAW,SAAQ,UAAU;IACxC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,wBAAwB,EAAE,MAAM,CAAC;IACjD,SAAgB,sBAAsB,EAAE,MAAM,CAAC;IAC/C,SAAgB,wBAAwB,EAAE,MAAM,CAAC;IACjD,SAAgB,oBAAoB,EAAE,MAAM,CAAC;IAC7C,SAAgB,sBAAsB,EAAE,MAAM,CAAC;IAC/C,SAAgB,WAAW,EAAE,MAAM,CAAC;IACpC,SAAgB,cAAc,EAAE,GAAG,CAAC;IACpC,IAAW,OAAO,IAAI,OAAO,CAA4C;gBAEtD,MAAM,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"I3dmTileIO.d.ts","sourceRoot":"","sources":["../../../src/tile/I3dmTileIO.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAgB,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,qBAAa,UAAW,SAAQ,UAAU;IACxC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,wBAAwB,EAAE,MAAM,CAAC;IACjD,SAAgB,sBAAsB,EAAE,MAAM,CAAC;IAC/C,SAAgB,wBAAwB,EAAE,MAAM,CAAC;IACjD,SAAgB,oBAAoB,EAAE,MAAM,CAAC;IAC7C,SAAgB,sBAAsB,EAAE,MAAM,CAAC;IAC/C,SAAgB,WAAW,EAAE,MAAM,CAAC;IACpC,SAAgB,cAAc,EAAE,GAAG,CAAC;IACpC,IAAW,OAAO,IAAI,OAAO,CAA4C;gBAEtD,MAAM,EAAE,UAAU;CAsBtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"I3dmTileIO.js","sourceRoot":"","sources":["../../../src/tile/I3dmTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+D;AAC/D,qCAAkD;AAElD;;GAEG;AACH,MAAa,UAAW,SAAQ,mBAAU;IAWxC,YAAmB,MAAkB;QACnC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC;QAChC,IAAI,CAAC,sBAAsB,GAAG,MAAM,CAAC,UAAU,CAAC;QAChD,IAAI,CAAC,wBAAwB,GAAG,MAAM,CAAC,UAAU,CAAC;QAClD,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC,UAAU,CAAC;QAC9C,IAAI,CAAC,sBAAsB,GAAG,MAAM,CAAC,UAAU,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC;QAC9C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC5C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,IAAI,CAAC,oBAAoB,EAAE;YACnC,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YACjE,MAAM,QAAQ,GAAG,IAAA,2BAAY,EAAC,YAAY,CAAC,CAAC;YAC5C,IAAI,QAAQ;
|
|
1
|
+
{"version":3,"file":"I3dmTileIO.js","sourceRoot":"","sources":["../../../src/tile/I3dmTileIO.ts"],"names":[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AjCD,gCAiCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tile\r\n */\r\n\r\nimport { ByteStream, utf8ToString } from \"@itwin/core-bentley\";\r\nimport { TileFormat, TileHeader } from \"./TileIO\";\r\n\r\n/** Header preceding tile content in [i3dm](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/Instanced3DModel) format.\r\n * @internal\r\n */\r\nexport class I3dmHeader extends TileHeader {\r\n public readonly length: number;\r\n public readonly featureTableJsonPosition: number;\r\n public readonly featureTableJsonLength: number;\r\n public readonly featureTableBinaryLength: number;\r\n public readonly batchTableJsonLength: number;\r\n public readonly batchTableBinaryLength: number;\r\n public readonly gltfVersion: number;\r\n public readonly batchTableJson: any;\r\n public get isValid(): boolean { return TileFormat.I3dm === this.format; }\r\n\r\n public constructor(stream: ByteStream) {\r\n super(stream);\r\n this.length = stream.nextUint32;\r\n this.featureTableJsonLength = stream.nextUint32;\r\n this.featureTableBinaryLength = stream.nextUint32;\r\n this.batchTableJsonLength = stream.nextUint32;\r\n this.batchTableBinaryLength = stream.nextUint32;\r\n this.gltfVersion = stream.nextUint32;\r\n this.featureTableJsonPosition = stream.curPos;\r\n stream.advance(this.featureTableJsonLength);\r\n stream.advance(this.featureTableBinaryLength);\r\n if (0 !== this.batchTableJsonLength) {\r\n const batchStrData = stream.nextBytes(this.batchTableJsonLength);\r\n const batchStr = utf8ToString(batchStrData);\r\n if (batchStr)\r\n this.batchTableJson = JSON.parse(batchStr);\r\n }\r\n stream.advance(this.batchTableBinaryLength);\r\n\r\n if (stream.isPastTheEnd)\r\n this.invalidate();\r\n }\r\n}\r\n"]}
|
package/lib/esm/Camera.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Camera.d.ts","sourceRoot":"","sources":["../../src/Camera.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEpF;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,QAAQ,CAAC;CACf;AAED;;;GAGG;AACH,qBAAa,MAAO,YAAW,WAAW;IACxC,SAAgB,IAAI,EAAE,KAAK,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IACzB,SAAgB,GAAG,EAAE,OAAO,CAAC;WAEf,gBAAgB,CAAC,GAAG,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"Camera.d.ts","sourceRoot":"","sources":["../../src/Camera.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEpF;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,QAAQ,CAAC;CACf;AAED;;;GAGG;AACH,qBAAa,MAAO,YAAW,WAAW;IACxC,SAAgB,IAAI,EAAE,KAAK,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IACzB,SAAgB,GAAG,EAAE,OAAO,CAAC;WAEf,gBAAgB,CAAC,GAAG,EAAE,KAAK;WAI3B,iBAAiB,CAAC,GAAG,EAAE,KAAK;IAKnC,eAAe;IACtB,IAAW,YAAY,YAA8D;IAC9E,gBAAgB;IAChB,gBAAgB,CAAC,IAAI,EAAE,MAAM;IACpC,IAAW,WAAW,YAAiD;IAChE,YAAY;IACZ,YAAY;IACZ,YAAY,CAAC,KAAK,EAAE,KAAK;IACzB,WAAW;IACX,WAAW,CAAC,EAAE,EAAE,MAAM;IAC7B,IAAW,OAAO,YAAoD;IAC/D,MAAM,CAAC,KAAK,EAAE,MAAM;IAKpB,KAAK;IACL,OAAO,CAAC,GAAG,EAAE,MAAM;IAM1B;;OAEG;gBACgB,KAAK,CAAC,EAAE,WAAW;CAWvC"}
|
package/lib/esm/Camera.js
CHANGED
|
@@ -26,9 +26,13 @@ export class Camera {
|
|
|
26
26
|
this.focusDist = 1;
|
|
27
27
|
this.eye = new Point3d();
|
|
28
28
|
}
|
|
29
|
-
static isValidLensAngle(val) {
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
static isValidLensAngle(val) {
|
|
30
|
+
return val.radians > (Math.PI / 8.0) && val.radians < Math.PI;
|
|
31
|
+
}
|
|
32
|
+
static validateLensAngle(val) {
|
|
33
|
+
if (!this.isValidLensAngle(val))
|
|
34
|
+
val.setRadians(Math.PI / 2.0);
|
|
35
|
+
}
|
|
32
36
|
invalidateFocus() { this.focusDist = 0.0; }
|
|
33
37
|
get isFocusValid() { return this.focusDist > 0.0 && this.focusDist < 1.0e14; }
|
|
34
38
|
getFocusDistance() { return this.focusDist; }
|
package/lib/esm/Camera.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Camera.js","sourceRoot":"","sources":["../../src/Camera.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAc,OAAO,EAAoB,MAAM,sBAAsB,CAAC;AAYpF;;;GAGG;AACH,MAAM,OAAO,MAAM;
|
|
1
|
+
{"version":3,"file":"Camera.js","sourceRoot":"","sources":["../../src/Camera.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAc,OAAO,EAAoB,MAAM,sBAAsB,CAAC;A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C,GAAG,CAAC,CAAC;IAC5B,CAAC;CAgBF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { JsonUtils } from \"@itwin/core-bentley\";\r\nimport { Angle, AngleProps, Point3d, XYAndZ, XYZProps } from \"@itwin/core-geometry\";\r\n\r\n/** JSON representation of a [[Camera]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface CameraProps {\r\n lens: AngleProps;\r\n focusDist: number; // NOTE: this is abbreviated, do not change!\r\n eye: XYZProps;\r\n}\r\n\r\n/** The current position (eyepoint), lens angle, and focus distance of a camera.\r\n * @see [Views]($docs/learning/frontend/Views.md)\r\n * @public\r\n */\r\nexport class Camera implements CameraProps {\r\n public readonly lens: Angle;\r\n public focusDist: number;\r\n public readonly eye: Point3d;\r\n\r\n public static isValidLensAngle(val: Angle) {\r\n return val.radians > (Math.PI / 8.0) && val.radians < Math.PI;\r\n }\r\n\r\n public static validateLensAngle(val: Angle) {\r\n if (!this.isValidLensAngle(val))\r\n val.setRadians(Math.PI / 2.0);\r\n }\r\n\r\n public invalidateFocus() { this.focusDist = 0.0; }\r\n public get isFocusValid() { return this.focusDist > 0.0 && this.focusDist < 1.0e14; }\r\n public getFocusDistance() { return this.focusDist; }\r\n public setFocusDistance(dist: number) { this.focusDist = dist; }\r\n public get isLensValid() { return Camera.isValidLensAngle(this.lens); }\r\n public validateLens() { Camera.validateLensAngle(this.lens); }\r\n public getLensAngle() { return this.lens; }\r\n public setLensAngle(angle: Angle) { this.lens.setFrom(angle); }\r\n public getEyePoint() { return this.eye; }\r\n public setEyePoint(pt: XYAndZ) { this.eye.setFrom(pt); }\r\n public get isValid() { return this.isLensValid && this.isFocusValid; }\r\n public equals(other: Camera) {\r\n return Math.abs(this.lens.radians - other.lens.radians) < .01 &&\r\n Math.abs(this.focusDist - other.focusDist) < .1 &&\r\n this.eye.isAlmostEqual(other.eye);\r\n }\r\n public clone() { return new Camera(this); }\r\n public setFrom(rhs: Camera) {\r\n this.lens.setFrom(rhs.lens);\r\n this.focusDist = rhs.focusDist;\r\n this.eye.setFrom(rhs.eye);\r\n }\r\n\r\n /** Construct a Camera\r\n * @param props The properties of the new camera. If undefined, create a camera with eye at {0,0,0}, 90 degree lens, 1 meter focus distance.\r\n */\r\n public constructor(props?: CameraProps) {\r\n if (props !== undefined) {\r\n this.lens = Angle.fromJSON(props.lens);\r\n this.focusDist = JsonUtils.asDouble(props.focusDist);\r\n this.eye = Point3d.fromJSON(props.eye);\r\n return;\r\n }\r\n this.lens = Angle.createRadians(Math.PI / 2.0);\r\n this.focusDist = 1;\r\n this.eye = new Point3d();\r\n }\r\n}\r\n"]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module CloudStorage
|
|
3
3
|
*/
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @beta
|
|
6
|
+
* @deprecated
|
|
7
|
+
*/
|
|
5
8
|
export declare enum CloudStorageProvider {
|
|
6
9
|
Azure = 0,
|
|
7
10
|
Amazon = 1,
|
|
@@ -9,13 +12,19 @@ export declare enum CloudStorageProvider {
|
|
|
9
12
|
External = 3,
|
|
10
13
|
Unknown = 4
|
|
11
14
|
}
|
|
12
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* @beta
|
|
17
|
+
* @deprecated
|
|
18
|
+
*/
|
|
13
19
|
export interface CloudStorageContainerDescriptor {
|
|
14
20
|
provider?: CloudStorageProvider;
|
|
15
21
|
name: string;
|
|
16
22
|
resource?: string;
|
|
17
23
|
}
|
|
18
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* @beta
|
|
26
|
+
* @deprecated
|
|
27
|
+
*/
|
|
19
28
|
export interface CloudStorageContainerUrl {
|
|
20
29
|
descriptor: CloudStorageContainerDescriptor;
|
|
21
30
|
valid: number;
|
|
@@ -25,11 +34,17 @@ export interface CloudStorageContainerUrl {
|
|
|
25
34
|
headers?: Record<string, string>;
|
|
26
35
|
bound?: boolean;
|
|
27
36
|
}
|
|
28
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* @beta
|
|
39
|
+
* @deprecated
|
|
40
|
+
*/
|
|
29
41
|
export declare namespace CloudStorageContainerUrl {
|
|
30
42
|
function empty(): CloudStorageContainerUrl;
|
|
31
43
|
}
|
|
32
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* @beta
|
|
46
|
+
* @deprecated
|
|
47
|
+
*/
|
|
33
48
|
export declare abstract class CloudStorageCache<TContentId, TContentType> {
|
|
34
49
|
private _containers;
|
|
35
50
|
provider: CloudStorageProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudStorage.d.ts","sourceRoot":"","sources":["../../src/CloudStorage.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"CloudStorage.d.ts","sourceRoot":"","sources":["../../src/CloudStorage.ts"],"names":[],"mappings":"AAIA;;GAEG;AAMH;;;GAGG;AACH,oBAAY,oBAAoB;IAC9B,KAAK,IAAA;IACL,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,OAAO,IAAA;CACR;AAED;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,+BAA+B,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,E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slint-disable deprecation/deprecation */
|
|
10
|
+
/**
|
|
11
|
+
* @beta
|
|
12
|
+
* @deprecated
|
|
13
|
+
*/
|
|
10
14
|
export var CloudStorageProvider;
|
|
11
15
|
(function (CloudStorageProvider) {
|
|
12
16
|
CloudStorageProvider[CloudStorageProvider["Azure"] = 0] = "Azure";
|
|
@@ -15,7 +19,10 @@ export var CloudStorageProvider;
|
|
|
15
19
|
CloudStorageProvider[CloudStorageProvider["External"] = 3] = "External";
|
|
16
20
|
CloudStorageProvider[CloudStorageProvider["Unknown"] = 4] = "Unknown";
|
|
17
21
|
})(CloudStorageProvider || (CloudStorageProvider = {}));
|
|
18
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* @beta
|
|
24
|
+
* @deprecated
|
|
25
|
+
*/
|
|
19
26
|
export var CloudStorageContainerUrl;
|
|
20
27
|
(function (CloudStorageContainerUrl) {
|
|
21
28
|
function empty() {
|
|
@@ -28,7 +35,10 @@ export var CloudStorageContainerUrl;
|
|
|
28
35
|
}
|
|
29
36
|
CloudStorageContainerUrl.empty = empty;
|
|
30
37
|
})(CloudStorageContainerUrl || (CloudStorageContainerUrl = {}));
|
|
31
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* @beta
|
|
40
|
+
* @deprecated
|
|
41
|
+
*/
|
|
32
42
|
export class CloudStorageCache {
|
|
33
43
|
constructor() {
|
|
34
44
|
this.provider = CloudStorageProvider.Unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudStorage.js","sourceRoot":"","sources":["../../src/CloudStorage.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,
|
|
1
|
+
{"version":3,"file":"CloudStorage.js","sourceRoot":"","sources":["../../src/CloudStorage.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,q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AI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,SAAS,IAAI,SAAS,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,GAAG,IAAI,SAAS,CAAC,OAAO,GAAG,GAAG,CAAC,EAAE;YACpF,SAAS,GAAG,SAAS,CAAC;YACtB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAC9B;QAED,IAAI,CAAC,SAAS,EAAE;YACd,IAAI,OAAO,GAAG,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACtD,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;oBAC9C,IAAI;wBACF,SAAS,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;wBAClE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;wBACrC,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAC3C,OAAO,CAAC,SAAS,CAAC,CAAC;qBACpB;oBAAC,OAAO,GAAG,EAAE;wBACZ,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAC3C,MAAM,CAAC,GAAG,CAAC,CAAC;qBACb;gBACH,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;aAClD;YAED,OAAO,OAAO,CAAC;SAChB;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CloudStorage\r\n */\r\n\r\nimport { UnexpectedErrors } from \"@itwin/core-bentley\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/**\r\n * @beta\r\n * @deprecated\r\n */\r\nexport enum CloudStorageProvider {\r\n Azure,\r\n Amazon,\r\n AliCloud,\r\n External,\r\n Unknown,\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated\r\n */\r\nexport interface CloudStorageContainerDescriptor {\r\n provider?: CloudStorageProvider;\r\n name: string;\r\n resource?: string;\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated\r\n */\r\nexport interface CloudStorageContainerUrl {\r\n descriptor: CloudStorageContainerDescriptor;\r\n valid: number;\r\n expires: number;\r\n url: string;\r\n method?: string;\r\n headers?: Record<string, string>;\r\n bound?: boolean;\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated\r\n */\r\nexport namespace CloudStorageContainerUrl {\r\n export function empty(): CloudStorageContainerUrl {\r\n return {\r\n descriptor: { name: \"\" },\r\n valid: 0,\r\n expires: 0,\r\n url: \"\",\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated\r\n */\r\nexport abstract class CloudStorageCache<TContentId, TContentType> {\r\n private _containers: Map<string, CloudStorageContainerUrl>;\r\n\r\n public provider: CloudStorageProvider = CloudStorageProvider.Unknown;\r\n public abstract formContainerName(id: TContentId): string;\r\n public abstract formResourceName(id: TContentId): string;\r\n protected formContainerKey(id: TContentId): string { return this.formContainerName(id); }\r\n protected abstract obtainContainerUrl(id: TContentId, descriptor: CloudStorageContainerDescriptor): Promise<CloudStorageContainerUrl>;\r\n protected abstract instantiateResource(response: Response): Promise<TContentType | undefined>;\r\n protected supplyUrlBase(_container: CloudStorageContainerUrl, _id: TContentId): string | undefined { return undefined; }\r\n\r\n public constructor() {\r\n this._containers = new Map();\r\n }\r\n\r\n public async retrieve(id: TContentId): Promise<TContentType | undefined> {\r\n try {\r\n const container = await this.getContainer(id);\r\n if (!container.url)\r\n return undefined;\r\n\r\n const response = await this.requestResource(container, id);\r\n if (response.ok) {\r\n const content = await this.instantiateResource(response);\r\n return content;\r\n }\r\n } catch (err) {\r\n UnexpectedErrors.handle(err);\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n protected async requestResource(container: CloudStorageContainerUrl, id: TContentId): Promise<Response> {\r\n const base = this.supplyUrlBase(container, id);\r\n const url = (undefined === base || \"\" === base) ? new URL(container.url) : new URL(container.url, base);\r\n\r\n if (!container.bound) {\r\n url.pathname += `/${this.formResourceName(id)}`;\r\n }\r\n\r\n const init: RequestInit = {\r\n headers: container.headers,\r\n method: \"GET\",\r\n };\r\n\r\n return fetch(url.toString(), init);\r\n }\r\n\r\n private _pendingContainerRequests: Map<string, Promise<CloudStorageContainerUrl>> = new Map();\r\n\r\n protected async getContainer(id: TContentId): Promise<CloudStorageContainerUrl> {\r\n const now = new Date().getTime();\r\n const name = this.formContainerName(id);\r\n const resource = this.formResourceName(id);\r\n const key = this.formContainerKey(id);\r\n\r\n let container = this._containers.get(key);\r\n if (container && container.url && (container.valid > now || container.expires < now)) {\r\n container = undefined;\r\n this._containers.delete(key);\r\n }\r\n\r\n if (!container) {\r\n let request = this._pendingContainerRequests.get(key);\r\n if (!request) {\r\n request = new Promise(async (resolve, reject) => {\r\n try {\r\n container = await this.obtainContainerUrl(id, { name, resource });\r\n this._containers.set(key, container);\r\n this._pendingContainerRequests.delete(key);\r\n resolve(container);\r\n } catch (err) {\r\n this._pendingContainerRequests.delete(key);\r\n reject(err);\r\n }\r\n });\r\n\r\n this._pendingContainerRequests.set(key, request);\r\n }\r\n\r\n return request;\r\n }\r\n\r\n return container;\r\n }\r\n}\r\n"]}
|
|
@@ -10,7 +10,10 @@ export interface TileContentIdentifier {
|
|
|
10
10
|
contentId: string;
|
|
11
11
|
guid: string | undefined;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* @beta
|
|
15
|
+
* @deprecated
|
|
16
|
+
*/
|
|
14
17
|
export declare class CloudStorageTileCache extends CloudStorageCache<TileContentIdentifier, Uint8Array> {
|
|
15
18
|
private static _instance;
|
|
16
19
|
static getCache(): CloudStorageTileCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudStorageTileCache.d.ts","sourceRoot":"","sources":["../../src/CloudStorageTileCache.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"CloudStorageTileCache.d.ts","sourceRoot":"","sources":["../../src/CloudStorageTileCache.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,iBAAiB,EAAE,+BAA+B,EAAE,wBAAwB,EAAwB,MAAM,gBAAgB,CAAC;AACpI,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,YAAY;AACZ,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,cAAc,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,iBAAiB,CAAC,qBAAqB,EAAE,UAAU,CAAC;IAC7F,OAAO,CAAC,MAAM,CAAC,SAAS,CAAwB;WAElC,QAAQ,IAAI,qBAAqB;IAQxC,2BAA2B,CAAC,GAAG,EAAE,+BAA+B,GAAG,IAAI;IAe9E,SAAS;cAIO,kBAAkB,CAAC,EAAE,EAAE,qBAAqB,EAAE,UAAU,EAAE,+BAA+B,GAAG,OAAO,CAAC,wBAAwB,CAAC;cAK7H,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IASjF,iBAAiB,CAAC,EAAE,EAAE,qBAAqB,GAAG,MAAM;IAIpD,gBAAgB,CAAC,EAAE,EAAE,qBAAqB,GAAG,MAAM;cAMvC,gBAAgB,CAAC,EAAE,EAAE,qBAAqB,GAAG,MAAM;CAOvE"}
|
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module CloudStorage
|
|
7
7
|
*/
|
|
8
|
+
/* eslint-disable deprecation/deprecation */
|
|
8
9
|
import { CloudStorageCache, CloudStorageProvider } from "./CloudStorage";
|
|
9
10
|
import { IModelTileRpcInterface } from "./rpc/IModelTileRpcInterface";
|
|
10
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* @beta
|
|
13
|
+
* @deprecated
|
|
14
|
+
*/
|
|
11
15
|
export class CloudStorageTileCache extends CloudStorageCache {
|
|
12
16
|
constructor() {
|
|
13
17
|
super();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudStorageTileCache.js","sourceRoot":"","sources":["../../src/CloudStorageTileCache.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAA6D,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEpI,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAUtE
|
|
1
|
+
{"version":3,"file":"CloudStorageTileCache.js","sourceRoot":"","sources":["../../src/CloudStorageTileCache.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,4CAA4C;AAE5C,OAAO,EAAE,iBAAiB,EAA6D,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEpI,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAUtE;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,iBAAoD;IA0B7F;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAzBM,MAAM,CAAC,QAAQ;QACpB,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE;YACpC,qBAAqB,CAAC,SAAS,GAAG,IAAI,qBAAqB,EAAE,CAAC;SAC/D;QAED,OAAO,qBAAqB,CA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CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,oEAAoE;QACrH,OAAO,SAAS,EAAE,CAAC,MAAM,IAAI,OAAO,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;IACzD,CAAC;IAEkB,gBAAgB,CAAC,EAAyB;QAC3D,IAAI,IAAI,CAAC,QAAQ,KAAK,oBAAoB,CAAC,QAAQ,EAAE;YACnD,OAAO,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;SAC/D;QAED,OAAO,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module CloudStorage\r\n */\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\nimport { CloudStorageCache, CloudStorageContainerDescriptor, CloudStorageContainerUrl, CloudStorageProvider } from \"./CloudStorage\";\r\nimport { IModelRpcProps } from \"./IModel\";\r\nimport { IModelTileRpcInterface } from \"./rpc/IModelTileRpcInterface\";\r\n\r\n/** @beta */\r\nexport interface TileContentIdentifier {\r\n tokenProps: IModelRpcProps;\r\n treeId: string;\r\n contentId: string;\r\n guid: string | undefined;\r\n}\r\n\r\n/**\r\n * @beta\r\n * @deprecated\r\n */\r\nexport class CloudStorageTileCache extends CloudStorageCache<TileContentIdentifier, Uint8Array> {\r\n private static _instance: CloudStorageTileCache;\r\n\r\n public static getCache(): CloudStorageTileCache {\r\n if (!CloudStorageTileCache._instance) {\r\n CloudStorageTileCache._instance = new CloudStorageTileCache();\r\n }\r\n\r\n return CloudStorageTileCache._instance;\r\n }\r\n\r\n public supplyExpiryForContainerUrl(_id: CloudStorageContainerDescriptor): Date {\r\n const expiry = new Date();\r\n\r\n const today = new Date().getDay();\r\n const rolloverDay = 6; // saturday\r\n expiry.setHours((rolloverDay - today) * 24);\r\n\r\n expiry.setHours(23);\r\n expiry.setMinutes(59);\r\n expiry.setSeconds(59);\r\n expiry.setMilliseconds(999);\r\n\r\n return expiry;\r\n }\r\n\r\n protected constructor() {\r\n super();\r\n }\r\n\r\n protected async obtainContainerUrl(id: TileContentIdentifier, descriptor: CloudStorageContainerDescriptor): Promise<CloudStorageContainerUrl> {\r\n const client = IModelTileRpcInterface.getClient();\r\n return client.getTileCacheContainerUrl(id.tokenProps, descriptor);\r\n }\r\n\r\n protected async instantiateResource(response: Response): Promise<Uint8Array | undefined> {\r\n const data = await response.arrayBuffer();\r\n if (!data.byteLength) {\r\n return undefined;\r\n }\r\n\r\n return new Uint8Array(data);\r\n }\r\n\r\n public formContainerName(id: TileContentIdentifier): string {\r\n return `${id.tokenProps.iModelId}`;\r\n }\r\n\r\n public formResourceName(id: TileContentIdentifier): string {\r\n const changesetId = id.tokenProps.changeset?.id || \"first\";\r\n const version = id.guid ? id.guid : changesetId; // NB: id.guid can be null (backend) OR undefined (frontend) here...\r\n return `tiles/${id.treeId}/${version}/${id.contentId}`;\r\n }\r\n\r\n protected override formContainerKey(id: TileContentIdentifier): string {\r\n if (this.provider === CloudStorageProvider.AliCloud) {\r\n return this.formContainerName(id) + this.formResourceName(id);\r\n }\r\n\r\n return super.formContainerKey(id);\r\n }\r\n}\r\n"]}
|
package/lib/esm/Code.d.ts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { GuidString, Id64String } from "@itwin/core-bentley";
|
|
5
5
|
import { IModel } from "./IModel";
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* The identity of the element defining the scope for a Code value.
|
|
8
|
+
* For query input, may either be an ElementId or a FederationGuid. When returned from a query, it will be an ElementId.
|
|
7
9
|
* @public
|
|
8
10
|
* @extensions
|
|
9
11
|
*/
|
|
@@ -13,18 +15,22 @@ export declare type CodeScopeProps = Id64String | GuidString;
|
|
|
13
15
|
* @extensions
|
|
14
16
|
*/
|
|
15
17
|
export interface CodeProps {
|
|
16
|
-
|
|
18
|
+
/** Either the stringified 64-bit Id of the CodeSpec for this code, or the name of the CodeSpec. */
|
|
19
|
+
spec: Id64String | string;
|
|
20
|
+
/** Either the ElementId or the FederationGuid of the element that provides the scope for this code. */
|
|
17
21
|
scope: CodeScopeProps;
|
|
22
|
+
/** the value of this code. May be undefined. */
|
|
18
23
|
value?: string;
|
|
19
24
|
}
|
|
20
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* A three-part structure containing information about the [Code]($docs/bis/guide/fundamentals/codes) of an Element
|
|
21
27
|
* @public
|
|
22
28
|
*/
|
|
23
29
|
export declare class Code implements CodeProps {
|
|
24
30
|
/** The id of the [CodeSpec]($docs/bis/guide/fundamentals/codes.md#codespec) of the Element */
|
|
25
31
|
spec: Id64String;
|
|
26
32
|
/** The [CodeScope]($docs/bis/guide/fundamentals/codes.md#codescope-property) of the Element */
|
|
27
|
-
scope:
|
|
33
|
+
scope: Id64String;
|
|
28
34
|
/** The [CodeValue]($docs/bis/guide/fundamentals/codes.md#codevalue-property) of the Element
|
|
29
35
|
* @note Leading and trailing whitespace is invalid so is automatically trimmed.
|
|
30
36
|
*/
|
package/lib/esm/Code.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Code.d.ts","sourceRoot":"","sources":["../../src/Code.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAQ,UAAU,EAAa,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC
|
|
1
|
+
{"version":3,"file":"Code.d.ts","sourceRoot":"","sources":["../../src/Code.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAQ,UAAU,EAAa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ACvE,cAAc,IAAI;KACnB;CACF;AAED;;;;;;GAMG;AACH,qBAAa,QAAQ;IACnB,wCAAwC;IACjC,MAAM,EAAE,MAAM,CAAC;IACtB,+BAA+B;IACxB,EAAE,EAAE,UAAU,CAAC;IACtB,iCAAiC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACI,UAAU,EAAE,GAAG,CAAC;IAEvB;OACG;IACH,OAAO;IAqBP;;;OAGG;WACW,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,aAAa,CAAC,gBAAgB,GAAG,QAAQ;IAItI;;OAEG;WACW,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,QAAQ;IAIrG,wDAAwD;IACxD,IAAW,OAAO,IAAI,OAAO,CAAkC;IAE/D,uCAAuC;IACvC,IAAW,SAAS,IAAI,aAAa,CAAC,IAAI,CAA2C;IACrF,IAAW,SAAS,CAAC,SAAS,EAAE,aAAa,CAAC,IAAI,EAAiD;IAEnG,0MAA0M;IAC1M,IAAW,QAAQ,IAAI,aAAa,CAAC,gBAAgB,CAEpD;IACD,IAAW,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC,gBAAgB,EAKtD;IAED;;OAEG;IACH,IAAW,mBAAmB,IAAI,OAAO,CAKxC;IACD,IAAW,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAK5C;CACF"}
|
package/lib/esm/Code.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* @module Codes
|
|
7
7
|
*/
|
|
8
8
|
import { Id64, JsonUtils } from "@itwin/core-bentley";
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* A three-part structure containing information about the [Code]($docs/bis/guide/fundamentals/codes) of an Element
|
|
10
11
|
* @public
|
|
11
12
|
*/
|
|
12
13
|
export class Code {
|
|
@@ -21,7 +22,10 @@ export class Code {
|
|
|
21
22
|
get value() { var _a; return (_a = this._value) !== null && _a !== void 0 ? _a : ""; }
|
|
22
23
|
set value(val) { this._value = val === null || val === void 0 ? void 0 : val.trim(); }
|
|
23
24
|
/** Create an empty, non-unique code with no special meaning. */
|
|
24
|
-
static createEmpty() {
|
|
25
|
+
static createEmpty() {
|
|
26
|
+
const id = Id64.fromLocalAndBriefcaseIds(1, 0);
|
|
27
|
+
return new Code({ spec: id, scope: id });
|
|
28
|
+
}
|
|
25
29
|
static fromJSON(json) { return json ? new Code(json) : Code.createEmpty(); }
|
|
26
30
|
toJSON() { return { spec: this.spec, scope: this.scope, value: this.value }; }
|
|
27
31
|
equals(other) { return Code.equalCodes(this, other); }
|
package/lib/esm/Code.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Code.js","sourceRoot":"","sources":["../../src/Code.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAmB9E;;GAEG;AACH,MAAM,OAAO,IAAI;IAYf,YAAY,SAAoB;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IAXD;;OAEG;IACH,IAAW,KAAK,aAAK,OAAO,MAAA,IAAI,CAAC,MAAM,mCAAI,EAAE,CAAC,CAAC,CAAC;IAChD,IAAW,KAAK,CAAC,GAAW,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE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,CAAC;;YAE/C,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,GAAG,SAAS,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,IAAW,mBAAmB;QAC5B,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,kBAAkB,KAAK,SAAS,EAAE;YACjF,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC;SAChD;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAW,mBAAmB,CAAC,KAAc;QAC3C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI;YAAE,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,EAAE,CAAC;QACrD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAClD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Codes\r\n */\r\n\r\nimport { GuidString, Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { IModel } from \"./IModel\";\r\n\r\n/** The props that hold the identity of the object defining the uniqueness scope for a set of Code values.\r\n * @public\r\n * @extensions\r\n */\r\nexport type CodeScopeProps = Id64String | GuidString;\r\n\r\n/** The wire format for a Code\r\n * @public\r\n * @extensions\r\n */\r\nexport interface CodeProps {\r\n spec: Id64String;\r\n scope: CodeScopeProps;\r\n value?: string;\r\n}\r\n\r\n/** A three-part structure containing information about the [Code]($docs/bis/guide/fundamentals/codes) of an Element\r\n * @public\r\n */\r\nexport class Code implements CodeProps {\r\n /** The id of the [CodeSpec]($docs/bis/guide/fundamentals/codes.md#codespec) of the Element */\r\n public spec: Id64String;\r\n /** The [CodeScope]($docs/bis/guide/fundamentals/codes.md#codescope-property) of the Element */\r\n public scope: string;\r\n /** The [CodeValue]($docs/bis/guide/fundamentals/codes.md#codevalue-property) of the Element\r\n * @note Leading and trailing whitespace is invalid so is automatically trimmed.\r\n */\r\n public get value() { return this._value ?? \"\"; }\r\n public set value(val: string) { this._value = val?.trim(); }\r\n private _value?: string;\r\n\r\n constructor(codeProps: CodeProps) {\r\n this.spec = Id64.fromJSON(codeProps.spec);\r\n this.scope = JsonUtils.asString(codeProps.scope);\r\n this.value = JsonUtils.asString(codeProps.value);\r\n }\r\n\r\n /** Create an empty, non-unique code with no special meaning. */\r\n public static createEmpty(): Code { const id: Id64String = Id64.fromLocalAndBriefcaseIds(1, 0); return new Code({ spec: id, scope: id }); }\r\n public static fromJSON(json?: any): Code { return json ? new Code(json) : Code.createEmpty(); }\r\n public toJSON(): CodeProps { return { spec: this.spec, scope: this.scope, value: this.value }; }\r\n public equals(other: Code): boolean { return Code.equalCodes(this, other); }\r\n /** @internal */\r\n public static equalCodes(c1: CodeProps, c2: CodeProps): boolean {\r\n return c1.spec === c2.spec && c1.scope === c2.scope && c1.value === c2.value;\r\n }\r\n /** Determine whether this Code is valid. */\r\n public static isValid(c: CodeProps): boolean { return Id64.isValidId64(c.spec); }\r\n /** Determine if this code is valid but not otherwise meaningful (and therefore not necessarily unique) */\r\n public static isEmpty(c: CodeProps): boolean { return this.isValid(c) && (c.value === undefined || c.value === \"\"); }\r\n}\r\n\r\n/** Names of the internal BIS CodeSpecs. These names match those specified by the native library.\r\n * For other domains, the best practice is to include the domain name or alias as part of the CodeSpec name to ensure global uniqueness.\r\n * @public\r\n* @extensions\r\n* @see [CodeSpec]($docs/bis/guide/fundamentals/codes.md#codespec)\r\n */\r\nexport enum BisCodeSpec {\r\n /** The name of the standard [[CodeSpec]] used when creating *empty* codes.\r\n * @see [[Code.createEmpty]]\r\n */\r\n nullCodeSpec = \"bis:NullCodeSpec\",\r\n /** @internal */\r\n annotationFrameStyle = \"bis:AnnotationFrameStyle\",\r\n /** @internal */\r\n annotationLeaderStyle = \"bis:AnnotationLeaderStyle\",\r\n /** @internal */\r\n annotationTextStyle = \"bis:AnnotationTextStyle\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystem2d]($backend) elements.\r\n * @see [AuxCoordSystem2d.createCode]($backend)\r\n */\r\n auxCoordSystem2d = \"bis:AuxCoordSystem2d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystem3d]($backend) elements.\r\n * @see [AuxCoordSystem3d.createCode]($backend)\r\n */\r\n auxCoordSystem3d = \"bis:AuxCoordSystem3d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystemSpatial]($backend) elements.\r\n * @see [AuxCoordSystemSpatial.createCode]($backend)\r\n */\r\n auxCoordSystemSpatial = \"bis:AuxCoordSystemSpatial\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [CategorySelector]($backend) elements.\r\n * @see [CategorySelector.createCode]($backend)\r\n */\r\n categorySelector = \"bis:CategorySelector\",\r\n /** @internal */\r\n colorBook = \"bis:ColorBook\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [DisplayStyle]($backend) elements.\r\n * @see [DisplayStyle.createCode]($backend)\r\n */\r\n displayStyle = \"bis:DisplayStyle\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Drawing]($backend) elements.\r\n * @see [Drawing.createCode]($backend)\r\n */\r\n drawing = \"bis:Drawing\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [DrawingCategory]($backend) elements.\r\n * @see [DrawingCategory.createCode]($backend)\r\n */\r\n drawingCategory = \"bis:DrawingCategory\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ExternalSource]($backend) elements.\r\n * @note This CodeSpec is not automatically created, so use [ExternalSource.ensureCodeSpec]($backend) to make sure that it exists.\r\n * @see [ExternalSource.createCode]($backend)\r\n */\r\n externalSource = \"bis:ExternalSource\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ExternalSourceAttachment]($backend) elements.\r\n * @note This CodeSpec is not automatically created, so use [ExternalSourceAttachment.ensureCodeSpec]($backend) to make sure that it exists.\r\n * @see [ExternalSource.createCode]($backend)\r\n */\r\n externalSourceAttachment = \"bis:ExternalSourceAttachment\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [GeometryPart]($backend) elements.\r\n * @see [GeometryPart.createCode]($backend)\r\n */\r\n geometryPart = \"bis:GeometryPart\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [GraphicalType2d]($backend) elements.\r\n * @see [GraphicalType2d.createCode]($backend)\r\n */\r\n graphicalType2d = \"bis:GraphicalType2d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [LineStyle]($backend) elements.\r\n * @see [LineStyle.createCode]($backend)\r\n */\r\n lineStyle = \"bis:LineStyle\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [LinkElement]($backend) elements.\r\n * @see [LinkElement.createCode]($backend)\r\n */\r\n linkElement = \"bis:LinkElement\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ModelSelector]($backend) elements.\r\n * @see [ModelSelector.createCode]($backend)\r\n */\r\n modelSelector = \"bis:ModelSelector\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [PhysicalMaterial]($backend) elements.\r\n * @see [PhysicalMaterial.createCode]($backend)\r\n */\r\n physicalMaterial = \"bis:PhysicalMaterial\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [PhysicalType]($backend) elements.\r\n * @see [PhysicalType.createCode]($backend)\r\n */\r\n physicalType = \"bis:PhysicalType\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [InformationPartitionElement]($backend) elements.\r\n * @see [InformationPartitionElement.createCode]($backend)\r\n */\r\n informationPartitionElement = \"bis:InformationPartitionElement\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [RenderMaterialElement]($backend) elements.\r\n * @see [RenderMaterialElement.createCode]($backend)\r\n */\r\n renderMaterial = \"bis:RenderMaterial\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Sheet]($backend) elements.\r\n * @see [Sheet.createCode]($backend)\r\n */\r\n sheet = \"bis:Sheet\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [SpatialCategory]($backend) elements.\r\n * @see [SpatialCategory.createCode]($backend)\r\n */\r\n spatialCategory = \"bis:SpatialCategory\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [SpatialLocationType]($backend) elements.\r\n * @see [SpatialLocationType.createCode]($backend)\r\n */\r\n spatialLocationType = \"bis:SpatialLocationType\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [SubCategory]($backend) elements.\r\n * @see [SubCategory.createCode]($backend)\r\n */\r\n subCategory = \"bis:SubCategory\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Subject]($backend) elements.\r\n * @see [Subject.createCode]($backend)\r\n */\r\n subject = \"bis:Subject\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [TemplateRecipe2d]($backend) elements.\r\n * @see [TemplateRecipe2d.createCode]($backend)\r\n */\r\n templateRecipe2d = \"bis:TemplateRecipe2d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [TemplateRecipe3d]($backend) elements.\r\n * @see [TemplateRecipe3d.createCode]($backend)\r\n */\r\n templateRecipe3d = \"bis:TemplateRecipe3d\",\r\n /** @internal */\r\n textAnnotationSeed = \"bis:TextAnnotationSeed\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Texture]($backend) elements.\r\n * @see [Texture.createCode]($backend)\r\n */\r\n texture = \"bis:Texture\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ViewDefinition]($backend) elements.\r\n * @see [ViewDefinition.createCode]($backend)\r\n */\r\n viewDefinition = \"bis:ViewDefinition\",\r\n}\r\n\r\n/** The scope of the Code.\r\n * @public\r\n */\r\nexport namespace CodeScopeSpec {\r\n /** The standard ways the CodeScope can be specified.\r\n * @public\r\n */\r\n export enum Type {\r\n /** The Code value must be unique within (at least) the iModel repository */\r\n Repository = 1,\r\n /** The Code value must be unique within the scope of the Model */\r\n Model = 2,\r\n /** The Code value must be unique among other children of the same parent element */\r\n ParentElement = 3,\r\n /** The Code value must be unique among other elements also scoped by the same element */\r\n RelatedElement = 4,\r\n }\r\n\r\n /** Requirements for how the CodeScope Element is identified.\r\n * @public\r\n */\r\n export enum ScopeRequirement {\r\n /** The Code is required to have a valid ElementId as its scope */\r\n ElementId = 1,\r\n /** The Code is required to have a valid FederationGuid as its scope */\r\n FederationGuid = 2,\r\n }\r\n}\r\n\r\n/** A [Code Specification]($docs/bis/guide/references/glossary#codespec) captures the rules for encoding and decoding significant business information into\r\n * and from a Code (string). This specification is used to generate and validate Codes.\r\n *\r\n * A CodeSpec defines the format of a Code for a certain type of Element in an IModel.\r\n * A CodeSpec can identify an external system that maintains and/or assigns Codes.\r\n * @public\r\n */\r\nexport class CodeSpec {\r\n /** The iModel holding this CodeSpec. */\r\n public iModel: IModel;\r\n /** The id of this CodeSpec. */\r\n public id: Id64String;\r\n /** The name of this CodeSpec. */\r\n public name: string;\r\n /** The JSON properties for this CodeSpec.\r\n * > Note: Use the getters and setters instead of accessing this directly.\r\n * @internal\r\n */\r\n public properties: any;\r\n\r\n /** Internal-only constructor. Proper use is to supply `properties` only or `scopeType` and `scopeReq` but not `properties`.\r\n */\r\n private constructor(iModel: IModel, id: Id64String, name: string, scopeType?: CodeScopeSpec.Type, scopeReq?: CodeScopeSpec.ScopeRequirement, properties?: any) {\r\n this.iModel = iModel;\r\n this.id = id;\r\n this.name = name;\r\n if (properties) {\r\n this.properties = properties;\r\n if (!this.properties.scopeSpec) {\r\n this.properties.scopeSpec = {};\r\n this.scopeType = CodeScopeSpec.Type.Repository;\r\n }\r\n } else {\r\n this.properties = { scopeSpec: {} };\r\n this.scopeType = CodeScopeSpec.Type.Repository;\r\n }\r\n if (undefined !== scopeType) this.scopeType = scopeType;\r\n if (undefined !== scopeReq) this.scopeReq = scopeReq;\r\n }\r\n\r\n /** Create a new CodeSpec from the specified parameters\r\n * > Note: CodeSpec.id will not be valid until inserted\r\n * @see [CodeSpecs.insert]($backend)\r\n */\r\n public static create(iModel: IModel, name: string, scopeType: CodeScopeSpec.Type, scopeReq?: CodeScopeSpec.ScopeRequirement): CodeSpec {\r\n return new CodeSpec(iModel, Id64.invalid, name, scopeType, scopeReq, undefined);\r\n }\r\n\r\n /** Create a new CodeSpec directly from JSON. Used internally by the CodeSpecs.load function.\r\n * @internal\r\n */\r\n public static createFromJson(iModel: IModel, id: Id64String, name: string, properties: any): CodeSpec {\r\n return new CodeSpec(iModel, id, name, undefined, undefined, properties); // eslint-disable-line deprecation/deprecation\r\n }\r\n\r\n /** Will be true if the id of this CodeSpec is valid. */\r\n public get isValid(): boolean { return Id64.isValid(this.id); }\r\n\r\n /** The scope type of this CodeSpec. */\r\n public get scopeType(): CodeScopeSpec.Type { return this.properties.scopeSpec.type; }\r\n public set scopeType(scopeType: CodeScopeSpec.Type) { this.properties.scopeSpec.type = scopeType; }\r\n\r\n /** Will be `CodeScopeSpec.ScopeRequirement.FederationGuid` if the scoping element is required to have a FederationGuid or `CodeScopeSpec.ScopeRequirement.ElementId` otherwise (which is the default). */\r\n public get scopeReq(): CodeScopeSpec.ScopeRequirement {\r\n return this.properties.scopeSpec.fGuidRequired ? CodeScopeSpec.ScopeRequirement.FederationGuid : CodeScopeSpec.ScopeRequirement.ElementId;\r\n }\r\n public set scopeReq(req: CodeScopeSpec.ScopeRequirement) {\r\n if (CodeScopeSpec.ScopeRequirement.FederationGuid === req)\r\n this.properties.scopeSpec.fGuidRequired = true;\r\n else\r\n this.properties.scopeSpec.fGuidRequired = undefined;\r\n }\r\n\r\n /** Will be true if the codes associated with this CodeSpec are managed along with the iModel and false if the codes are managed by an external service.\r\n * @beta\r\n */\r\n public get isManagedWithIModel(): boolean {\r\n if (this.properties.spec && this.properties.spec.isManagedWithDgnDb !== undefined) {\r\n return this.properties.spec.isManagedWithDgnDb;\r\n }\r\n return true;\r\n }\r\n public set isManagedWithIModel(value: boolean) {\r\n if (!this.properties.spec) this.properties.spec = {};\r\n this.properties.spec.isManagedWithDgnDb = value;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Code.js","sourceRoot":"","sources":["../../src/Code.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAc,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAwB9E;;;GAGG;AACH,MAAM,OAAO,IAAI;IAYf,YAAY,SAAoB;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IAXD;;OAEG;IACH,IAAW,KAAK,aAAK,OAAO,MAAA,IAAI,CAAC,MAAM,mCAAI,EAAE,CAAC,CAAC,CAAC;IAChD,IAAW,KAAK,CAAC,GAAW,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAS5D,gEAAgE;IACzD,MAAM,CAAC,WAAW;QACvB,MAAM,EAAE,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/C,OAAO,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAC3C,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,IAAU,IAAU,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IACxF,MAAM,KAAgB,OAAO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AAI,GAAG,EAAE,CAAC;QAE5B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAClD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Codes\r\n */\r\n\r\nimport { GuidString, Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { IModel } from \"./IModel\";\r\n\r\n/**\r\n * The identity of the element defining the scope for a Code value.\r\n * For query input, may either be an ElementId or a FederationGuid. When returned from a query, it will be an ElementId.\r\n * @public\r\n * @extensions\r\n */\r\nexport type CodeScopeProps = Id64String | GuidString;\r\n\r\n/** The wire format for a Code\r\n * @public\r\n * @extensions\r\n */\r\nexport interface CodeProps {\r\n /** Either the stringified 64-bit Id of the CodeSpec for this code, or the name of the CodeSpec. */\r\n spec: Id64String | string;\r\n /** Either the ElementId or the FederationGuid of the element that provides the scope for this code. */\r\n scope: CodeScopeProps;\r\n /** the value of this code. May be undefined. */\r\n value?: string;\r\n}\r\n\r\n/**\r\n * A three-part structure containing information about the [Code]($docs/bis/guide/fundamentals/codes) of an Element\r\n * @public\r\n */\r\nexport class Code implements CodeProps {\r\n /** The id of the [CodeSpec]($docs/bis/guide/fundamentals/codes.md#codespec) of the Element */\r\n public spec: Id64String;\r\n /** The [CodeScope]($docs/bis/guide/fundamentals/codes.md#codescope-property) of the Element */\r\n public scope: Id64String;\r\n /** The [CodeValue]($docs/bis/guide/fundamentals/codes.md#codevalue-property) of the Element\r\n * @note Leading and trailing whitespace is invalid so is automatically trimmed.\r\n */\r\n public get value() { return this._value ?? \"\"; }\r\n public set value(val: string) { this._value = val?.trim(); }\r\n private _value?: string;\r\n\r\n constructor(codeProps: CodeProps) {\r\n this.spec = Id64.fromJSON(codeProps.spec);\r\n this.scope = JsonUtils.asString(codeProps.scope);\r\n this.value = JsonUtils.asString(codeProps.value);\r\n }\r\n\r\n /** Create an empty, non-unique code with no special meaning. */\r\n public static createEmpty(): Code {\r\n const id = Id64.fromLocalAndBriefcaseIds(1, 0);\r\n return new Code({ spec: id, scope: id });\r\n }\r\n\r\n public static fromJSON(json?: any): Code { return json ? new Code(json) : Code.createEmpty(); }\r\n public toJSON(): CodeProps { return { spec: this.spec, scope: this.scope, value: this.value }; }\r\n public equals(other: Code): boolean { return Code.equalCodes(this, other); }\r\n /** @internal */\r\n public static equalCodes(c1: CodeProps, c2: CodeProps): boolean {\r\n return c1.spec === c2.spec && c1.scope === c2.scope && c1.value === c2.value;\r\n }\r\n /** Determine whether this Code is valid. */\r\n public static isValid(c: CodeProps): boolean { return Id64.isValidId64(c.spec); }\r\n /** Determine if this code is valid but not otherwise meaningful (and therefore not necessarily unique) */\r\n public static isEmpty(c: CodeProps): boolean { return this.isValid(c) && (c.value === undefined || c.value === \"\"); }\r\n}\r\n\r\n/** Names of the internal BIS CodeSpecs. These names match those specified by the native library.\r\n * For other domains, the best practice is to include the domain name or alias as part of the CodeSpec name to ensure global uniqueness.\r\n * @public\r\n* @extensions\r\n* @see [CodeSpec]($docs/bis/guide/fundamentals/codes.md#codespec)\r\n */\r\nexport enum BisCodeSpec {\r\n /** The name of the standard [[CodeSpec]] used when creating *empty* codes.\r\n * @see [[Code.createEmpty]]\r\n */\r\n nullCodeSpec = \"bis:NullCodeSpec\",\r\n /** @internal */\r\n annotationFrameStyle = \"bis:AnnotationFrameStyle\",\r\n /** @internal */\r\n annotationLeaderStyle = \"bis:AnnotationLeaderStyle\",\r\n /** @internal */\r\n annotationTextStyle = \"bis:AnnotationTextStyle\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystem2d]($backend) elements.\r\n * @see [AuxCoordSystem2d.createCode]($backend)\r\n */\r\n auxCoordSystem2d = \"bis:AuxCoordSystem2d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystem3d]($backend) elements.\r\n * @see [AuxCoordSystem3d.createCode]($backend)\r\n */\r\n auxCoordSystem3d = \"bis:AuxCoordSystem3d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [AuxCoordSystemSpatial]($backend) elements.\r\n * @see [AuxCoordSystemSpatial.createCode]($backend)\r\n */\r\n auxCoordSystemSpatial = \"bis:AuxCoordSystemSpatial\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [CategorySelector]($backend) elements.\r\n * @see [CategorySelector.createCode]($backend)\r\n */\r\n categorySelector = \"bis:CategorySelector\",\r\n /** @internal */\r\n colorBook = \"bis:ColorBook\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [DisplayStyle]($backend) elements.\r\n * @see [DisplayStyle.createCode]($backend)\r\n */\r\n displayStyle = \"bis:DisplayStyle\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Drawing]($backend) elements.\r\n * @see [Drawing.createCode]($backend)\r\n */\r\n drawing = \"bis:Drawing\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [DrawingCategory]($backend) elements.\r\n * @see [DrawingCategory.createCode]($backend)\r\n */\r\n drawingCategory = \"bis:DrawingCategory\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ExternalSource]($backend) elements.\r\n * @note This CodeSpec is not automatically created, so use [ExternalSource.ensureCodeSpec]($backend) to make sure that it exists.\r\n * @see [ExternalSource.createCode]($backend)\r\n */\r\n externalSource = \"bis:ExternalSource\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ExternalSourceAttachment]($backend) elements.\r\n * @note This CodeSpec is not automatically created, so use [ExternalSourceAttachment.ensureCodeSpec]($backend) to make sure that it exists.\r\n * @see [ExternalSource.createCode]($backend)\r\n */\r\n externalSourceAttachment = \"bis:ExternalSourceAttachment\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [GeometryPart]($backend) elements.\r\n * @see [GeometryPart.createCode]($backend)\r\n */\r\n geometryPart = \"bis:GeometryPart\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [GraphicalType2d]($backend) elements.\r\n * @see [GraphicalType2d.createCode]($backend)\r\n */\r\n graphicalType2d = \"bis:GraphicalType2d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [LineStyle]($backend) elements.\r\n * @see [LineStyle.createCode]($backend)\r\n */\r\n lineStyle = \"bis:LineStyle\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [LinkElement]($backend) elements.\r\n * @see [LinkElement.createCode]($backend)\r\n */\r\n linkElement = \"bis:LinkElement\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ModelSelector]($backend) elements.\r\n * @see [ModelSelector.createCode]($backend)\r\n */\r\n modelSelector = \"bis:ModelSelector\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [PhysicalMaterial]($backend) elements.\r\n * @see [PhysicalMaterial.createCode]($backend)\r\n */\r\n physicalMaterial = \"bis:PhysicalMaterial\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [PhysicalType]($backend) elements.\r\n * @see [PhysicalType.createCode]($backend)\r\n */\r\n physicalType = \"bis:PhysicalType\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [InformationPartitionElement]($backend) elements.\r\n * @see [InformationPartitionElement.createCode]($backend)\r\n */\r\n informationPartitionElement = \"bis:InformationPartitionElement\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [RenderMaterialElement]($backend) elements.\r\n * @see [RenderMaterialElement.createCode]($backend)\r\n */\r\n renderMaterial = \"bis:RenderMaterial\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Sheet]($backend) elements.\r\n * @see [Sheet.createCode]($backend)\r\n */\r\n sheet = \"bis:Sheet\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [SpatialCategory]($backend) elements.\r\n * @see [SpatialCategory.createCode]($backend)\r\n */\r\n spatialCategory = \"bis:SpatialCategory\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [SpatialLocationType]($backend) elements.\r\n * @see [SpatialLocationType.createCode]($backend)\r\n */\r\n spatialLocationType = \"bis:SpatialLocationType\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [SubCategory]($backend) elements.\r\n * @see [SubCategory.createCode]($backend)\r\n */\r\n subCategory = \"bis:SubCategory\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Subject]($backend) elements.\r\n * @see [Subject.createCode]($backend)\r\n */\r\n subject = \"bis:Subject\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [TemplateRecipe2d]($backend) elements.\r\n * @see [TemplateRecipe2d.createCode]($backend)\r\n */\r\n templateRecipe2d = \"bis:TemplateRecipe2d\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [TemplateRecipe3d]($backend) elements.\r\n * @see [TemplateRecipe3d.createCode]($backend)\r\n */\r\n templateRecipe3d = \"bis:TemplateRecipe3d\",\r\n /** @internal */\r\n textAnnotationSeed = \"bis:TextAnnotationSeed\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [Texture]($backend) elements.\r\n * @see [Texture.createCode]($backend)\r\n */\r\n texture = \"bis:Texture\",\r\n /** The name of the standard [[CodeSpec]] used when creating codes for [ViewDefinition]($backend) elements.\r\n * @see [ViewDefinition.createCode]($backend)\r\n */\r\n viewDefinition = \"bis:ViewDefinition\",\r\n}\r\n\r\n/** The scope of the Code.\r\n * @public\r\n */\r\nexport namespace CodeScopeSpec {\r\n /** The standard ways the CodeScope can be specified.\r\n * @public\r\n */\r\n export enum Type {\r\n /** The Code value must be unique within (at least) the iModel repository */\r\n Repository = 1,\r\n /** The Code value must be unique within the scope of the Model */\r\n Model = 2,\r\n /** The Code value must be unique among other children of the same parent element */\r\n ParentElement = 3,\r\n /** The Code value must be unique among other elements also scoped by the same element */\r\n RelatedElement = 4,\r\n }\r\n\r\n /** Requirements for how the CodeScope Element is identified.\r\n * @public\r\n */\r\n export enum ScopeRequirement {\r\n /** The Code is required to have a valid ElementId as its scope */\r\n ElementId = 1,\r\n /** The Code is required to have a valid FederationGuid as its scope */\r\n FederationGuid = 2,\r\n }\r\n}\r\n\r\n/** A [Code Specification]($docs/bis/guide/references/glossary#codespec) captures the rules for encoding and decoding significant business information into\r\n * and from a Code (string). This specification is used to generate and validate Codes.\r\n *\r\n * A CodeSpec defines the format of a Code for a certain type of Element in an IModel.\r\n * A CodeSpec can identify an external system that maintains and/or assigns Codes.\r\n * @public\r\n */\r\nexport class CodeSpec {\r\n /** The iModel holding this CodeSpec. */\r\n public iModel: IModel;\r\n /** The id of this CodeSpec. */\r\n public id: Id64String;\r\n /** The name of this CodeSpec. */\r\n public name: string;\r\n /** The JSON properties for this CodeSpec.\r\n * > Note: Use the getters and setters instead of accessing this directly.\r\n * @internal\r\n */\r\n public properties: any;\r\n\r\n /** Internal-only constructor. Proper use is to supply `properties` only or `scopeType` and `scopeReq` but not `properties`.\r\n */\r\n private constructor(iModel: IModel, id: Id64String, name: string, scopeType?: CodeScopeSpec.Type, scopeReq?: CodeScopeSpec.ScopeRequirement, properties?: any) {\r\n this.iModel = iModel;\r\n this.id = id;\r\n this.name = name;\r\n if (properties) {\r\n this.properties = properties;\r\n if (!this.properties.scopeSpec) {\r\n this.properties.scopeSpec = {};\r\n this.scopeType = CodeScopeSpec.Type.Repository;\r\n }\r\n } else {\r\n this.properties = { scopeSpec: {} };\r\n this.scopeType = CodeScopeSpec.Type.Repository;\r\n }\r\n if (undefined !== scopeType)\r\n this.scopeType = scopeType;\r\n\r\n if (undefined !== scopeReq)\r\n this.scopeReq = scopeReq;\r\n }\r\n\r\n /** Create a new CodeSpec from the specified parameters\r\n * > Note: CodeSpec.id will not be valid until inserted\r\n * @see [CodeSpecs.insert]($backend)\r\n */\r\n public static create(iModel: IModel, name: string, scopeType: CodeScopeSpec.Type, scopeReq?: CodeScopeSpec.ScopeRequirement): CodeSpec {\r\n return new CodeSpec(iModel, Id64.invalid, name, scopeType, scopeReq, undefined);\r\n }\r\n\r\n /** Create a new CodeSpec directly from JSON. Used internally by the CodeSpecs.load function.\r\n * @internal\r\n */\r\n public static createFromJson(iModel: IModel, id: Id64String, name: string, properties: any): CodeSpec {\r\n return new CodeSpec(iModel, id, name, undefined, undefined, properties); // eslint-disable-line deprecation/deprecation\r\n }\r\n\r\n /** Will be true if the id of this CodeSpec is valid. */\r\n public get isValid(): boolean { return Id64.isValid(this.id); }\r\n\r\n /** The scope type of this CodeSpec. */\r\n public get scopeType(): CodeScopeSpec.Type { return this.properties.scopeSpec.type; }\r\n public set scopeType(scopeType: CodeScopeSpec.Type) { this.properties.scopeSpec.type = scopeType; }\r\n\r\n /** Will be `CodeScopeSpec.ScopeRequirement.FederationGuid` if the scoping element is required to have a FederationGuid or `CodeScopeSpec.ScopeRequirement.ElementId` otherwise (which is the default). */\r\n public get scopeReq(): CodeScopeSpec.ScopeRequirement {\r\n return this.properties.scopeSpec.fGuidRequired ? CodeScopeSpec.ScopeRequirement.FederationGuid : CodeScopeSpec.ScopeRequirement.ElementId;\r\n }\r\n public set scopeReq(req: CodeScopeSpec.ScopeRequirement) {\r\n if (CodeScopeSpec.ScopeRequirement.FederationGuid === req)\r\n this.properties.scopeSpec.fGuidRequired = true;\r\n else\r\n this.properties.scopeSpec.fGuidRequired = undefined;\r\n }\r\n\r\n /** Will be true if the codes associated with this CodeSpec are managed along with the iModel and false if the codes are managed by an external service.\r\n * @beta\r\n */\r\n public get isManagedWithIModel(): boolean {\r\n if (this.properties.spec && this.properties.spec.isManagedWithDgnDb !== undefined) {\r\n return this.properties.spec.isManagedWithDgnDb;\r\n }\r\n return true;\r\n }\r\n public set isManagedWithIModel(value: boolean) {\r\n if (!this.properties.spec)\r\n this.properties.spec = {};\r\n\r\n this.properties.spec.isManagedWithDgnDb = value;\r\n }\r\n}\r\n"]}
|