@itwin/core-backend 4.6.0-dev.14 → 4.6.0-dev.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.d.ts.map +1 -1
- package/lib/cjs/BisCoreSchema.js +2 -0
- package/lib/cjs/BisCoreSchema.js.map +1 -1
- package/lib/cjs/BlobContainerService.js.map +1 -1
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +1 -1
- package/lib/cjs/Category.js +1 -1
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +2 -2
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChangedElementsManager.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +237 -237
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChannelControl.js.map +1 -1
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.js +5 -5
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +0 -16
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +2 -20
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.d.ts +0 -3
- package/lib/cjs/ElementGraphics.d.ts.map +1 -1
- package/lib/cjs/ElementGraphics.js +2 -5
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
- package/lib/cjs/ElementTreeWalker.js +5 -0
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/EntityReferences.js.map +1 -1
- package/lib/cjs/ExportGraphics.d.ts +1 -1
- package/lib/cjs/ExportGraphics.js +1 -1
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeometrySummary.js +47 -47
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +3 -0
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +16 -8
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.d.ts +1 -1
- package/lib/cjs/LineStyle.js +1 -1
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/LocalHub.js +1 -1
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.d.ts +0 -3
- package/lib/cjs/PromiseMemoizer.d.ts.map +1 -1
- package/lib/cjs/PromiseMemoizer.js +2 -5
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/RpcBackend.js.map +1 -1
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/SchemaUtils.js.map +1 -1
- package/lib/cjs/ServerBasedLocks.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/TextAnnotationElement.d.ts +54 -0
- package/lib/cjs/TextAnnotationElement.d.ts.map +1 -0
- package/lib/cjs/TextAnnotationElement.js +94 -0
- package/lib/cjs/TextAnnotationElement.js.map +1 -0
- package/lib/cjs/TextAnnotationGeometry.d.ts +28 -0
- package/lib/cjs/TextAnnotationGeometry.d.ts.map +1 -0
- package/lib/cjs/TextAnnotationGeometry.js +134 -0
- package/lib/cjs/TextAnnotationGeometry.js.map +1 -0
- package/lib/cjs/TextAnnotationLayout.d.ts +124 -0
- package/lib/cjs/TextAnnotationLayout.d.ts.map +1 -0
- package/lib/cjs/TextAnnotationLayout.js +399 -0
- package/lib/cjs/TextAnnotationLayout.js.map +1 -0
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.d.ts +1 -0
- package/lib/cjs/ViewStateHydrator.d.ts.map +1 -1
- package/lib/cjs/ViewStateHydrator.js +1 -0
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
- package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +44 -44
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
- package/lib/cjs/assets/Settings/backend.setting.json5 +132 -132
- package/lib/cjs/core-backend.d.ts +46 -61
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +46 -61
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/domains/GenericSchema.js.map +1 -1
- package/lib/cjs/rpc/multipart.js.map +1 -1
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc/web/logging.js.map +1 -1
- package/lib/cjs/rpc/web/request.js.map +1 -1
- package/lib/cjs/rpc/web/response.js.map +1 -1
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-backend.js","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;AAE/F,4DAAmG;AAA1F,iHAAA,cAAc,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAAE,uHAAA,oBAAoB,OAAA;AAEhE,qDAAmC;AACnC,0DAAwC;AACxC,kDAAgC;AAChC,y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GG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG","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\r\nexport { IModelJsNative, NativeCloudSqlite, NativeLoggerCategory } from \"@bentley/imodeljs-native\";\r\n\r\nexport * from \"./BackendHubAccess\";\r\nexport * from \"./BackendLoggerCategory\";\r\nexport * from \"./BisCoreSchema\";\r\nexport * from \"./BlobContainerService\";\r\nexport * from \"./BriefcaseManager\";\r\nexport * from \"./Category\";\r\nexport * from \"./ChangedElementsDb\";\r\nexport * from \"./ChangeSummaryManager\";\r\nexport * from \"./ChannelControl\";\r\nexport * from \"./CheckpointManager\";\r\nexport * from \"./ClassRegistry\";\r\nexport * from \"./CloudSqlite\";\r\nexport * from \"./CodeService\";\r\nexport * from \"./CodeSpecs\";\r\nexport * from \"./DevTools\";\r\nexport * from \"./DisplayStyle\";\r\nexport * from \"./domains/FunctionalElements\";\r\nexport * from \"./domains/FunctionalSchema\";\r\nexport * from \"./domains/GenericElements\";\r\nexport * from \"./domains/GenericSchema\";\r\nexport * from \"./ECDb\";\r\nexport * from \"./ECSchemaXmlContext\";\r\nexport * from \"./ECSqlStatement\";\r\nexport * from \"./Element\";\r\nexport * from \"./ElementAspect\";\r\nexport * from \"./ElementGraphics\";\r\nexport * from \"./ElementTreeWalker\";\r\nexport * from \"./Entity\";\r\nexport * from \"./EntityReferences\";\r\nexport * from \"./ExportGraphics\";\r\nexport * from \"./ExternalSource\";\r\nexport * from \"./GeoCoordConfig\";\r\nexport * from \"./HubMock\";\r\nexport * from \"./IModelCloneContext\";\r\nexport * from \"./IModelDb\";\r\nexport * from \"./IModelElementCloneContext\";\r\nexport * from \"./IModelHost\";\r\nexport * from \"./IModelJsFs\";\r\nexport * from \"./SchemaSync\";\r\nexport * from \"./IpcHost\";\r\nexport * from \"./LineStyle\";\r\nexport * from \"./LocalhostIpcHost\";\r\nexport * from \"./LocalHub\";\r\nexport * from \"./Material\";\r\nexport * from \"./Model\";\r\nexport * from \"./NativeAppStorage\";\r\nexport * from \"./NativeHost\";\r\nexport * from \"./NavigationRelationship\";\r\nexport * from \"./PropertyStore\";\r\nexport * from \"./Relationship\";\r\nexport * from \"./rpc/tracing\";\r\nexport * from \"./Schema\";\r\nexport * from \"./SchemaUtils\";\r\nexport * from \"./SQLiteDb\";\r\nexport * from \"./SqliteStatement\";\r\nexport * from \"./TextAnnotationElement\";\r\nexport * from \"./TextAnnotationGeometry\";\r\nexport * from \"./Texture\";\r\nexport * from \"./TileStorage\";\r\nexport * from \"./TxnManager\";\r\nexport * from \"./ViewDefinition\";\r\nexport * from \"./ViewStore\";\r\nexport * from \"./workspace/Settings\";\r\nexport * from \"./workspace/SettingsSchemas\";\r\nexport * from \"./workspace/Workspace\";\r\nexport * from \"./SqliteChangesetReader\";\r\nexport * from \"./ChangesetECAdaptor\";\r\n\r\n/** @docs-package-description\r\n * The core-backend package always runs on the computer with a local Briefcase.\r\n *\r\n * It contains classes that [backend code]($docs/learning/backend/index.md) can use to work with directly with iModels.\r\n */\r\n\r\n/**\r\n * @docs-group-description BlobContainers\r\n * Classes for working with cloud-based blob containers.\r\n */\r\n\r\n/**\r\n * @docs-group-description Codes\r\n * Classes for working with [Codes]($docs/BIS/guide/fundamentals/codes.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n\r\n/**\r\n * @docs-group-description ECDb\r\n * Classes for working with ECDb.\r\n */\r\n\r\n/**\r\n * @docs-group-description ECSQL\r\n * Classes for working with [ECSQL]($docs/learning/ECSQL.md)\r\n */\r\n\r\n/**\r\n * @docs-group-description ElementAspects\r\n * Subclasses of [ElementAspects]($docs/bis/guide/fundamentals/elementaspect-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n\r\n/**\r\n * @docs-group-description ElementGeometry\r\n * Classes for defining the symbology and geometry of geometric elements\r\n */\r\n\r\n/**\r\n * @docs-group-description Elements\r\n * Subclasses of [Elements]($docs/BIS/guide/fundamentals/element-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n\r\n/**\r\n * @docs-group-description ExportGraphics\r\n * APIs for producing low-level graphics primitives from element geometry.\r\n */\r\n\r\n/**\r\n * @docs-group-description HubAccess\r\n * APIs for working with IModelHub\r\n */\r\n\r\n/**\r\n * @docs-group-description IModelHost\r\n * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).\r\n * See [the learning article]($docs/learning/backend/IModelHost.md).\r\n */\r\n\r\n/**\r\n * @docs-group-description iModels\r\n * Classes for working with [iModels]($docs/learning/iModels.md).\r\n * See [the learning article]($docs/learning/backend/index.md).\r\n */\r\n\r\n/**\r\n * @docs-group-description Logging\r\n * Logger categories used by this package.\r\n */\r\n\r\n/**\r\n * @docs-group-description Models\r\n * Subclasses of [Models]($docs/BIS/guide/fundamentals/model-fundamentals.md).\r\n * See [the learning articles]($docs/learning/backend/index.md).\r\n */\r\n\r\n/**\r\n * @docs-group-description NativeApp\r\n * Classes for working with Mobile/Desktop Application.\r\n */\r\n\r\n/**\r\n * @docs-group-description Portability\r\n */\r\n\r\n/**\r\n * @docs-group-description Relationships\r\n * Classes that describe the [relationships]($docs/bis/guide/fundamentals/relationship-fundamentals.md) between elements.\r\n */\r\n\r\n/**\r\n * @docs-group-description RpcInterface\r\n * Classes for working with [RpcInterfaces]($docs/learning/RpcInterface.md).\r\n */\r\n\r\n/**\r\n * @docs-group-description Schema\r\n * Classes for working with [ECSchemas]($docs/learning/backend/SchemasAndElementsInTypeScript.md)\r\n */\r\n\r\n/**\r\n * @docs-group-description SQLite\r\n * Classes for working directly with SQLite\r\n */\r\n\r\n/**\r\n * @docs-group-description SQLiteDb\r\n * Classes for working with SQLiteDb.\r\n */\r\n\r\n/**\r\n * @docs-group-description TileStorage\r\n * Class for working with cloud storage using iTwin/object-storage cloud providers\r\n */\r\n\r\n/**\r\n * @docs-group-description ViewDefinitions\r\n * Classes for working with Elements that define what appears in [Views]($docs/learning/frontend/views.md).\r\n * See [the learning articles]($docs/learning/backend/createelements/#orthographicviewdefinition).\r\n */\r\n\r\n/**\r\n * @docs-group-description Workspace\r\n * APIs for loading and using Settings and Workspace resources\r\n */\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionalElements.js","sourceRoot":"","sources":["../../../src/domains/FunctionalElements.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,oDAE4B;AAC5B,wCAA6F;AAE7F,oCAAqC;AACrC,sEAAyE;AACzE,kDAA2F;AAE3F;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,qCAA2B;IAClE,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,qBAAqB,CAAC,CAAC,CAAC;IAEhF,YAAsB,KAAuC,EAAE,MAAgB;QAC7E,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAPD,kDAOC;AAED;;GAEG;AACH,MAAa,eAAgB,SAAQ,iBAAS;IAC5C,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;IAE5E,YAAmB,KAAiB,EAAE,MAAgB;QACpD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,QAAkB,EAAE,eAA2B,EAAE,IAAY;QAChF,MAAM,cAAc,GAAqC;YACvD,aAAa,EAAE,mBAAmB,CAAC,aAAa;YAChD,KAAK,EAAE,oBAAM,CAAC,iBAAiB;YAC/B,MAAM,EAAE,IAAI,qDAA4B,CAAC,eAAe,CAAC;YACzD,IAAI,EAAE,mBAAmB,CAAC,UAAU,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC;SACtE,CAAC;QACF,MAAM,W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+BAAqB;IAChE,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,gBAAgB,CAAC,CAAC,CAAC;IAE3E,YAAsB,KAAiC,EAAE,MAAgB;QACvE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAPD,wCAOC;AAED;;GAEG;AACH,MAAa,yBAA0B,SAAQ,4BAAc;IAC3D,gBAAgB;IACT,MAAM,KAAK,SAAS,KAAa,OAAO,2BAA2B,CAAC,CAAC,CAAC;IAE7E,YAAmB,EAAc,EAAE,eAAuB,yBAAyB,CAAC,aAAa;QAC/F,KAAK,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;IAC9B,CAAC;;AAHa,uCAAa,GAAG,sCAAsC,CAAC;AAH1D,8DAAyB;AAStC;;GAEG;AACH,MAAa,+BAAgC,SAAQ,sCAAuB;IAC1E,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,iCAAiC,CAAC,CAAC,CAAC;CAC7F;AAHD,0EAGC;AAED;;GAEG;AACH,MAAa,yCAA0C,SAAQ,8CAA+B;IAC5F,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,2CAA2C,CAAC,CAAC,CAAC;CACvG;AAHD,8FAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport {\n FunctionalElementProps, IModel, InformationPartitionElementProps, ModelProps, RelatedElement, TypeDefinitionElementProps,\n} from \"@itwin/core-common\";\nimport { InformationPartitionElement, RoleElement, TypeDefinitionElement } from \"../Element\";\nimport { IModelDb } from \"../IModelDb\";\nimport { RoleModel } from \"../Model\";\nimport { SubjectOwnsPartitionElements } from \"../NavigationRelationship\";\nimport { DrawingGraphicRepresentsElement, ElementRefersToElements } from \"../Relationship\";\n\n/** A FunctionalPartition element is a key part of the iModel information hierarchy and is always parented\n * to a Subject and broken down by a FunctionalModel.\n * @public\n */\nexport class FunctionalPartition extends InformationPartitionElement {\n /** @internal */\n public static override get className(): string { return \"FunctionalPartition\"; }\n\n protected constructor(props: InformationPartitionElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A container for persisting FunctionalElements.\n * @public\n */\nexport class FunctionalModel extends RoleModel {\n /** @internal */\n public static override get className(): string { return \"FunctionalModel\"; }\n\n public constructor(props: ModelProps, iModel: IModelDb) {\n super(props, iModel);\n }\n\n /** Insert a FunctionalPartition and a FunctionalModel that breaks it down.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The FunctionalPartition will be inserted as a child of this Subject element.\n * @param name The name of the FunctionalPartition that the new FunctionalModel will break down.\n * @returns The Id of the newly inserted FunctionalPartition and FunctionalModel (same value).\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: FunctionalPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: FunctionalPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n return iModelDb.models.insertModel({\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n });\n }\n}\n\n/** A FunctionalElement captures functional requirements that will ultimately be fulfilled by a PhysicalElement.\n * @public\n */\nexport abstract class FunctionalElement extends RoleElement {\n /** @internal */\n public static override get className(): string { return \"FunctionalElement\"; }\n\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A FunctionalBreakdownElement is a *folder* node in the functional hierarchy.\n * @public\n */\nexport abstract class FunctionalBreakdownElement extends FunctionalElement {\n /** @internal */\n public static override get className(): string { return \"FunctionalBreakdownElement\"; }\n\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** @public */\nexport class FunctionalComposite extends FunctionalBreakdownElement {\n /** @internal */\n public static override get className(): string { return \"FunctionalComposite\"; }\n\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A FunctionalComponentElement is a *leaf* node in the functional hierarchy.\n * @public\n */\nexport abstract class FunctionalComponentElement extends FunctionalElement {\n /** @internal */\n public static override get className(): string { return \"FunctionalComponentElement\"; }\n\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** Defines a set of properties (the 'type') that can be associated with a Functional Element.\n * @public\n */\nexport abstract class FunctionalType extends TypeDefinitionElement {\n /** @internal */\n public static override get className(): string { return \"FunctionalType\"; }\n\n protected constructor(props: TypeDefinitionElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** Relates a [[FunctionalElement]] to its [[FunctionalType]]\n * @public\n */\nexport class FunctionalElementIsOfType extends RelatedElement {\n /** @internal */\n public static get className(): string { return \"FunctionalElementIsOfType\"; }\n public static classFullName = \"Functional:FunctionalElementIsOfType\";\n public constructor(id: Id64String, relClassName: string = FunctionalElementIsOfType.classFullName) {\n super({ id, relClassName });\n }\n}\n\n/** Relates a [[PhysicalElement]] to the [[FunctionalElement]] elements that it fulfills.\n * @public\n */\nexport class PhysicalElementFulfillsFunction extends ElementRefersToElements {\n /** @internal */\n public static override get className(): string { return \"PhysicalElementFulfillsFunction\"; }\n}\n\n/** Relates a [[DrawingGraphic]] to the [[FunctionalElement]] that it represents\n * @public\n */\nexport class DrawingGraphicRepresentsFunctionalElement extends DrawingGraphicRepresentsElement {\n /** @internal */\n public static override get className(): string { return \"DrawingGraphicRepresentsFunctionalElement\"; }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FunctionalElements.js","sourceRoot":"","sources":["../../../src/domains/FunctionalElements.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;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,yBAAyB,CAAC,aAAa;QAC/F,KAAK,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;IAC9B,CAAC;;AAHa,uCAAa,GAAG,sCAAsC,CAAC;AAH1D,8DAAyB;AAStC;;GAEG;AACH,MAAa,+BAAgC,SAAQ,sCAAuB;IAC1E,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,iCAAiC,CAAC,CAAC,CAAC;CAC7F;AAHD,0EAGC;AAED;;GAEG;AACH,MAAa,yCAA0C,SAAQ,8CAA+B;IAC5F,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,2CAA2C,CAAC,CAAC,CAAC;CACvG;AAHD,8FAGC","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 Elements\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n FunctionalElementProps, IModel, InformationPartitionElementProps, ModelProps, RelatedElement, TypeDefinitionElementProps,\r\n} from \"@itwin/core-common\";\r\nimport { InformationPartitionElement, RoleElement, TypeDefinitionElement } from \"../Element\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { RoleModel } from \"../Model\";\r\nimport { SubjectOwnsPartitionElements } from \"../NavigationRelationship\";\r\nimport { DrawingGraphicRepresentsElement, ElementRefersToElements } from \"../Relationship\";\r\n\r\n/** A FunctionalPartition element is a key part of the iModel information hierarchy and is always parented\r\n * to a Subject and broken down by a FunctionalModel.\r\n * @public\r\n */\r\nexport class FunctionalPartition extends InformationPartitionElement {\r\n /** @internal */\r\n public static override get className(): string { return \"FunctionalPartition\"; }\r\n\r\n protected constructor(props: InformationPartitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A container for persisting FunctionalElements.\r\n * @public\r\n */\r\nexport class FunctionalModel extends RoleModel {\r\n /** @internal */\r\n public static override get className(): string { return \"FunctionalModel\"; }\r\n\r\n public constructor(props: ModelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n\r\n /** Insert a FunctionalPartition and a FunctionalModel that breaks it down.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The FunctionalPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the FunctionalPartition that the new FunctionalModel will break down.\r\n * @returns The Id of the newly inserted FunctionalPartition and FunctionalModel (same value).\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: FunctionalPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: FunctionalPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n return iModelDb.models.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** A FunctionalElement captures functional requirements that will ultimately be fulfilled by a PhysicalElement.\r\n * @public\r\n */\r\nexport abstract class FunctionalElement extends RoleElement {\r\n /** @internal */\r\n public static override get className(): string { return \"FunctionalElement\"; }\r\n\r\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A FunctionalBreakdownElement is a *folder* node in the functional hierarchy.\r\n * @public\r\n */\r\nexport abstract class FunctionalBreakdownElement extends FunctionalElement {\r\n /** @internal */\r\n public static override get className(): string { return \"FunctionalBreakdownElement\"; }\r\n\r\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** @public */\r\nexport class FunctionalComposite extends FunctionalBreakdownElement {\r\n /** @internal */\r\n public static override get className(): string { return \"FunctionalComposite\"; }\r\n\r\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A FunctionalComponentElement is a *leaf* node in the functional hierarchy.\r\n * @public\r\n */\r\nexport abstract class FunctionalComponentElement extends FunctionalElement {\r\n /** @internal */\r\n public static override get className(): string { return \"FunctionalComponentElement\"; }\r\n\r\n protected constructor(props: FunctionalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** Defines a set of properties (the 'type') that can be associated with a Functional Element.\r\n * @public\r\n */\r\nexport abstract class FunctionalType extends TypeDefinitionElement {\r\n /** @internal */\r\n public static override get className(): string { return \"FunctionalType\"; }\r\n\r\n protected constructor(props: TypeDefinitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** Relates a [[FunctionalElement]] to its [[FunctionalType]]\r\n * @public\r\n */\r\nexport class FunctionalElementIsOfType extends RelatedElement {\r\n /** @internal */\r\n public static get className(): string { return \"FunctionalElementIsOfType\"; }\r\n public static classFullName = \"Functional:FunctionalElementIsOfType\";\r\n public constructor(id: Id64String, relClassName: string = FunctionalElementIsOfType.classFullName) {\r\n super({ id, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a [[PhysicalElement]] to the [[FunctionalElement]] elements that it fulfills.\r\n * @public\r\n */\r\nexport class PhysicalElementFulfillsFunction extends ElementRefersToElements {\r\n /** @internal */\r\n public static override get className(): string { return \"PhysicalElementFulfillsFunction\"; }\r\n}\r\n\r\n/** Relates a [[DrawingGraphic]] to the [[FunctionalElement]] that it represents\r\n * @public\r\n */\r\nexport class DrawingGraphicRepresentsFunctionalElement extends DrawingGraphicRepresentsElement {\r\n /** @internal */\r\n public static override get className(): string { return \"DrawingGraphicRepresentsFunctionalElement\"; }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionalSchema.js","sourceRoot":"","sources":["../../../src/domains/FunctionalSchema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6BAA6B;AAC7B,sDAA+C;AAC/C,oDAAiD;AACjD,oDAAiD;AAEjD,8CAA+C;AAC/C,sCAA4C;AAC5C,uDAAuD;AAEvD,cAAc;AACd,MAAa,gBAAiB,SAAQ,eAAM;IACnC,MAAM,KAAc,UAAU,KAAa,OAAO,YAAY,CAAC,CAAC,CAAC;IACjE,MAAM,KAAK,cAAc,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAc,CAAC,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,UAAU,eAAe,CAAC,CAAC,CAAC,CAAC;IAC/J,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,gBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACzD,gBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,gBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC7B,6BAAa,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;SACpD;IACH,CAAC;IAED,cAAc;IACP,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,QAAkB;QACjD,IAAI,QAAQ,CAAC,aAAa,EAAE;YAC1B,MAAM,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QAErC,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,sBAAsB,EAAE,CAAC;QACxD,IAAI,uBAAQ,CAAC,YAAY,KAAK,IAAI,EAAE;YAClC,MAAM,IAAI,yBAAW,CAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;SAClE;IACH,CAAC;CACF;AArBD,4CAqBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Schema\n */\n\nimport * as path from \"path\";\nimport { DbResult } from \"@itwin/core-bentley\";\nimport { IModelError } from \"@itwin/core-common\";\nimport { ClassRegistry } from \"../ClassRegistry\";\nimport { IModelDb } from \"../IModelDb\";\nimport { KnownLocations } from \"../IModelHost\";\nimport { Schema, Schemas } from \"../Schema\";\nimport * as elementsModule from \"./FunctionalElements\";\n\n/** @public */\nexport class FunctionalSchema extends Schema {\n public static override get schemaName(): string { return \"Functional\"; }\n public static get schemaFilePath(): string { return path.join(KnownLocations.nativeAssetsDir, \"ECSchemas\", \"Domain\", `${FunctionalSchema.schemaName}.ecschema.xml`); }\n public static registerSchema() {\n if (this !== Schemas.getRegisteredSchema(this.schemaName)) {\n Schemas.unregisterSchema(this.schemaName);\n Schemas.registerSchema(this);\n ClassRegistry.registerModule(elementsModule, this);\n }\n }\n\n /** @public */\n public static async importSchema(iModelDb: IModelDb) {\n if (iModelDb.isBriefcaseDb())\n await iModelDb.acquireSchemaLock();\n\n const stat = iModelDb.nativeDb.importFunctionalSchema();\n if (DbResult.BE_SQLITE_OK !== stat) {\n throw new IModelError(stat, \"Error importing Functional schema\");\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FunctionalSchema.js","sourceRoot":"","sources":["../../../src/domains/FunctionalSchema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6BAA6B;AAC7B,sDAA+C;AAC/C,oDAAiD;AACjD,oDAAiD;AAEjD,8CAA+C;AAC/C,sCAA4C;AAC5C,uDAAuD;AAEvD,cAAc;AACd,MAAa,gBAAiB,SAAQ,eAAM;IACnC,MAAM,KAAc,UAAU,KAAa,OAAO,YAAY,CAAC,CAAC,CAAC;IACjE,MAAM,KAAK,cAAc,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAc,CAAC,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,UAAU,eAAe,CAAC,CAAC,CAAC,CAAC;IAC/J,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,gBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACzD,gBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,gBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC7B,6BAAa,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;SACpD;IACH,CAAC;IAED,cAAc;IACP,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,QAAkB;QACjD,IAAI,QAAQ,CAAC,aAAa,EAAE;YAC1B,MAAM,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QAErC,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,sBAAsB,EAAE,CAAC;QACxD,IAAI,uBAAQ,CAAC,YAAY,KAAK,IAAI,EAAE;YAClC,MAAM,IAAI,yBAAW,CAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;SAClE;IACH,CAAC;CACF;AArBD,4CAqBC","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 Schema\r\n */\r\n\r\nimport * as path from \"path\";\r\nimport { DbResult } from \"@itwin/core-bentley\";\r\nimport { IModelError } from \"@itwin/core-common\";\r\nimport { ClassRegistry } from \"../ClassRegistry\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { KnownLocations } from \"../IModelHost\";\r\nimport { Schema, Schemas } from \"../Schema\";\r\nimport * as elementsModule from \"./FunctionalElements\";\r\n\r\n/** @public */\r\nexport class FunctionalSchema extends Schema {\r\n public static override get schemaName(): string { return \"Functional\"; }\r\n public static get schemaFilePath(): string { return path.join(KnownLocations.nativeAssetsDir, \"ECSchemas\", \"Domain\", `${FunctionalSchema.schemaName}.ecschema.xml`); }\r\n public static registerSchema() {\r\n if (this !== Schemas.getRegisteredSchema(this.schemaName)) {\r\n Schemas.unregisterSchema(this.schemaName);\r\n Schemas.registerSchema(this);\r\n ClassRegistry.registerModule(elementsModule, this);\r\n }\r\n }\r\n\r\n /** @public */\r\n public static async importSchema(iModelDb: IModelDb) {\r\n if (iModelDb.isBriefcaseDb())\r\n await iModelDb.acquireSchemaLock();\r\n\r\n const stat = iModelDb.nativeDb.importFunctionalSchema();\r\n if (DbResult.BE_SQLITE_OK !== stat) {\r\n throw new IModelError(stat, \"Error importing Functional schema\");\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericElements.js","sourceRoot":"","sources":["../../../src/domains/GenericElements.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,oDAG4B;AAC5B,wCAGoB;AAEpB,0CAA+C;AAC/C,oCAAmE;AACnE,sEAAyE;AAEzE;;GAEG;AACH,MAAsB,eAAgB,SAAQ,4BAAkB;IAC9D,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;IAC5E,YAAmB,KAA8B,EAAE,MAAgB;QACjE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,0CAMC;AAED;;GAEG;AACH,MAAa,SAAU,SAAQ,eAAe;IAC5C,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,WAAW,CAAC,CAAC,CAAC;IACtE,YAAmB,KAA8B,EAAE,MAAgB;QACjE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,8BAMC;AAED;;GAEG;AACH,MAAa,mBAAoB,SAAQ,eAAe;IACtD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,qBAAqB,CAAC,CAAC,CAAC;IAChF,YAAmB,KAA+B,EAAE,MAAgB;QAClE,KAA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C,CAAC,CAAC;IAClE,YAAmB,KAAmB,EAAE,MAAgB;QACtD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,sBAMC;AAED;;;GAGG;AACH,MAAa,eAAgB,SAAQ,kBAAQ;IAC3C,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,UAAU,CAAC,CAAC,CAAC;IACrE,YAAmB,KAAmB,EAAE,MAAgB;QACtD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,0CAMC;AAED;;;GAGG;AACH,MAAa,uBAAwB,SAAQ,2BAAgB;IAC3D,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAC7E,YAAmB,KAA6B,EAAE,MAAgB;QAChE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,0DAMC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,sBAAY;IACnD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,cAAc,CAAC,CAAC,CAAC;IACzE,YAAmB,KAAwB,EAAE,MAAgB;QAC3D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,kDAMC;AAED;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,yBAAe;IACzD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;IAC5E,YAAmB,KAAiC,EAAE,MAAgB;QACpE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,wDAMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport {\n CalloutProps, DefinitionElementProps, ElementProps, GeometricElement2dProps, GeometricElement3dProps, GeometricModel3dProps, IModel,\n InformationPartitionElementProps, ModelProps, PhysicalElementProps, PhysicalTypeProps, TypeDefinitionElementProps, ViewAttachmentLabelProps,\n} from \"@itwin/core-common\";\nimport {\n Document, GraphicalElement2d, GraphicalElement3d, GraphicalPartition3d, GraphicalType2d, GroupInformationElement, GroupInformationPartition,\n PhysicalElement, PhysicalType, SpatialLocationElement,\n} from \"../Element\";\nimport { IModelDb } from \"../IModelDb\";\nimport { PhysicalMaterial } from \"../Material\";\nimport { GraphicalModel3d, GroupInformationModel } from \"../Model\";\nimport { SubjectOwnsPartitionElements } from \"../NavigationRelationship\";\n\n/** A graphical detailing symbol that is placed on a [[Drawing]] or [[Sheet]].\n * @public\n */\nexport abstract class DetailingSymbol extends GraphicalElement2d {\n /** @internal */\n public static override get className(): string { return \"DetailingSymbol\"; }\n public constructor(props: GeometricElement2dProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical DetailingSymbol that contains title text.\n * @public\n */\nexport class TitleText extends DetailingSymbol {\n /** @internal */\n public static override get className(): string { return \"TitleText\"; }\n public constructor(props: GeometricElement2dProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical DetailingSymbol that contains a view attachment label.\n * @public\n */\nexport class ViewAttachmentLabel extends DetailingSymbol {\n /** @internal */\n public static override get className(): string { return \"ViewAttachmentLabel\"; }\n public constructor(props: ViewAttachmentLabelProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical DetailingSymbol that calls out a reference to another drawing.\n * @public\n */\nexport abstract class Callout extends DetailingSymbol {\n /** @internal */\n public static override get className(): string { return \"Callout\"; }\n public constructor(props: CalloutProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical Callout that references a section drawing.\n * @public\n */\nexport class SectionCallout extends Callout {\n /** @internal */\n public static override get className(): string { return \"SectionCallout\"; }\n public constructor(props: CalloutProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical Callout that references an elevation drawing.\n * @public\n */\nexport class ElevationCallout extends Callout {\n /** @internal */\n public static override get className(): string { return \"ElevationCallout\"; }\n public constructor(props: CalloutProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical Callout that references a plan drawing.\n * @public\n */\nexport class PlanCallout extends Callout {\n /** @internal */\n public static override get className(): string { return \"PlanCallout\"; }\n public constructor(props: CalloutProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A graphical Callout that references a detail drawing.\n * @public\n */\nexport class DetailCallout extends Callout {\n /** @internal */\n public static override get className(): string { return \"DetailCallout\"; }\n public constructor(props: CalloutProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A generic container for persisting BisCore:GraphicalElement3d instances.\n * @public\n */\nexport class GenericGraphicalModel3d extends GraphicalModel3d {\n /** @internal */\n public static override get className(): string { return \"GraphicalModel3d\"; }\n public constructor(props: GeometricModel3dProps, iModel: IModelDb) {\n super(props, iModel);\n }\n /** Insert a BisCore:GraphicalPartition3d and a Generic:GraphicalModel3d that sub-models it.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The GraphicalPartition3d will be inserted as a child of this Subject element.\n * @param name The name of the GraphicalPartition3d that the new Generic:GraphicalModel3d will sub-model.\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\n * @returns The Id of the newly inserted GraphicalPartition3d and GraphicalModel3d (same value).\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: GraphicalPartition3d.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: GraphicalPartition3d.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n const modelProps: GeometricModel3dProps = {\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n isPlanProjection,\n };\n return iModelDb.models.insertModel(modelProps);\n }\n}\n\n/** The Generic:Graphic3d class is used when 3D graphics cannot be further classified.\n * @note More-specific BisCore:GraphicalElement3d subclasses should be used wherever possible.\n * @public\n */\nexport class Graphic3d extends GraphicalElement3d {\n /** @internal */\n public static override get className(): string { return \"Graphic3d\"; }\n public constructor(props: GeometricElement3dProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** The Generic:PhysicalObject class is used when physical elements cannot be further classified.\n * @note More-specific BisCore:PhysicalElement subclasses should be used wherever possible.\n * @public\n */\nexport class PhysicalObject extends PhysicalElement {\n /** @internal */\n public static override get className(): string { return \"PhysicalObject\"; }\n public constructor(props: PhysicalElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** The Generic:SpatialLocation class is used when spatial locations cannot be further classified.\n * @note More-specific BisCore:SpatialLocationElement subclasses should be used wherever possible.\n * @public\n */\nexport class SpatialLocation extends SpatialLocationElement {\n /** @internal */\n public static override get className(): string { return \"SpatialLocation\"; }\n public constructor(props: GeometricElement3dProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** A generic container for BisCore:GroupInformationElement instances.\n * @public\n */\nexport class GroupModel extends GroupInformationModel {\n /** @internal */\n public static override get className(): string { return \"GroupModel\"; }\n public constructor(props: ModelProps, iModel: IModelDb) {\n super(props, iModel);\n }\n /** Insert a GroupInformationPartition and a GroupModel that breaks it down.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The GroupInformationPartition will be inserted as a child of this Subject element.\n * @param name The name of the GroupInformationPartition that the new GroupModel will break down.\n * @returns The Id of the newly inserted GroupModel.\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: GroupInformationPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: GroupInformationPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n return iModelDb.models.insertModel({\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n });\n }\n}\n\n/** The Generic:Group class is used when the group cannot be further classified.\n * @public\n */\nexport class Group extends GroupInformationElement {\n /** @internal */\n public static override get className(): string { return \"Group\"; }\n public constructor(props: ElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** The Generic:Document class is used when a document cannot be further classified.\n * @note More-specific BisCore:Document subclasses should be used wherever possible.\n * @public\n */\nexport class GenericDocument extends Document {\n /** @internal */\n public static override get className(): string { return \"Document\"; }\n public constructor(props: ElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** The Generic:PhysicalMaterial class is used when the physical material cannot be further classified.\n * @note More-specific BisCore:PhysicalMaterial subclasses should be used wherever possible.\n * @public\n */\nexport class GenericPhysicalMaterial extends PhysicalMaterial {\n /** @internal */\n public static override get className(): string { return \"PhysicalMaterial\"; }\n public constructor(props: DefinitionElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** The Generic:PhysicalType class is used when the physical type cannot be further classified.\n * @note More-specific BisCore:PhysicalType subclasses should be used wherever possible.\n * @public\n */\nexport class GenericPhysicalType extends PhysicalType {\n /** @internal */\n public static override get className(): string { return \"PhysicalType\"; }\n public constructor(props: PhysicalTypeProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** The Generic:GraphicalType2d class is used when graphical types cannot be further classified.\n * @note More-specific BisCore:GraphicalType2d subclasses should be used wherever possible.\n * @public\n */\nexport class GenericGraphicalType2d extends GraphicalType2d {\n /** @internal */\n public static override get className(): string { return \"GraphicalType2d\"; }\n public constructor(props: TypeDefinitionElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"GenericElements.js","sourceRoot":"","sources":["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AAkB,CAAC,CAAC,CAAC;IAC7E,YAAmB,KAA6B,EAAE,MAAgB;QAChE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,0DAMC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,sBAAY;IACnD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,cAAc,CAAC,CAAC,CAAC;IACzE,YAAmB,KAAwB,EAAE,MAAgB;QAC3D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,kDAMC;AAED;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,yBAAe;IACzD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;IAC5E,YAAmB,KAAiC,EAAE,MAAgB;QACpE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAND,wDAMC","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 Elements\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n CalloutProps, DefinitionElementProps, ElementProps, GeometricElement2dProps, GeometricElement3dProps, GeometricModel3dProps, IModel,\r\n InformationPartitionElementProps, ModelProps, PhysicalElementProps, PhysicalTypeProps, TypeDefinitionElementProps, ViewAttachmentLabelProps,\r\n} from \"@itwin/core-common\";\r\nimport {\r\n Document, GraphicalElement2d, GraphicalElement3d, GraphicalPartition3d, GraphicalType2d, GroupInformationElement, GroupInformationPartition,\r\n PhysicalElement, PhysicalType, SpatialLocationElement,\r\n} from \"../Element\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { PhysicalMaterial } from \"../Material\";\r\nimport { GraphicalModel3d, GroupInformationModel } from \"../Model\";\r\nimport { SubjectOwnsPartitionElements } from \"../NavigationRelationship\";\r\n\r\n/** A graphical detailing symbol that is placed on a [[Drawing]] or [[Sheet]].\r\n * @public\r\n */\r\nexport abstract class DetailingSymbol extends GraphicalElement2d {\r\n /** @internal */\r\n public static override get className(): string { return \"DetailingSymbol\"; }\r\n public constructor(props: GeometricElement2dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical DetailingSymbol that contains title text.\r\n * @public\r\n */\r\nexport class TitleText extends DetailingSymbol {\r\n /** @internal */\r\n public static override get className(): string { return \"TitleText\"; }\r\n public constructor(props: GeometricElement2dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical DetailingSymbol that contains a view attachment label.\r\n * @public\r\n */\r\nexport class ViewAttachmentLabel extends DetailingSymbol {\r\n /** @internal */\r\n public static override get className(): string { return \"ViewAttachmentLabel\"; }\r\n public constructor(props: ViewAttachmentLabelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical DetailingSymbol that calls out a reference to another drawing.\r\n * @public\r\n */\r\nexport abstract class Callout extends DetailingSymbol {\r\n /** @internal */\r\n public static override get className(): string { return \"Callout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references a section drawing.\r\n * @public\r\n */\r\nexport class SectionCallout extends Callout {\r\n /** @internal */\r\n public static override get className(): string { return \"SectionCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references an elevation drawing.\r\n * @public\r\n */\r\nexport class ElevationCallout extends Callout {\r\n /** @internal */\r\n public static override get className(): string { return \"ElevationCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references a plan drawing.\r\n * @public\r\n */\r\nexport class PlanCallout extends Callout {\r\n /** @internal */\r\n public static override get className(): string { return \"PlanCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A graphical Callout that references a detail drawing.\r\n * @public\r\n */\r\nexport class DetailCallout extends Callout {\r\n /** @internal */\r\n public static override get className(): string { return \"DetailCallout\"; }\r\n public constructor(props: CalloutProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A generic container for persisting BisCore:GraphicalElement3d instances.\r\n * @public\r\n */\r\nexport class GenericGraphicalModel3d extends GraphicalModel3d {\r\n /** @internal */\r\n public static override get className(): string { return \"GraphicalModel3d\"; }\r\n public constructor(props: GeometricModel3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n /** Insert a BisCore:GraphicalPartition3d and a Generic:GraphicalModel3d that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The GraphicalPartition3d will be inserted as a child of this Subject element.\r\n * @param name The name of the GraphicalPartition3d that the new Generic:GraphicalModel3d will sub-model.\r\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\r\n * @returns The Id of the newly inserted GraphicalPartition3d and GraphicalModel3d (same value).\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: GraphicalPartition3d.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: GraphicalPartition3d.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n const modelProps: GeometricModel3dProps = {\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n isPlanProjection,\r\n };\r\n return iModelDb.models.insertModel(modelProps);\r\n }\r\n}\r\n\r\n/** The Generic:Graphic3d class is used when 3D graphics cannot be further classified.\r\n * @note More-specific BisCore:GraphicalElement3d subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class Graphic3d extends GraphicalElement3d {\r\n /** @internal */\r\n public static override get className(): string { return \"Graphic3d\"; }\r\n public constructor(props: GeometricElement3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:PhysicalObject class is used when physical elements cannot be further classified.\r\n * @note More-specific BisCore:PhysicalElement subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class PhysicalObject extends PhysicalElement {\r\n /** @internal */\r\n public static override get className(): string { return \"PhysicalObject\"; }\r\n public constructor(props: PhysicalElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:SpatialLocation class is used when spatial locations cannot be further classified.\r\n * @note More-specific BisCore:SpatialLocationElement subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class SpatialLocation extends SpatialLocationElement {\r\n /** @internal */\r\n public static override get className(): string { return \"SpatialLocation\"; }\r\n public constructor(props: GeometricElement3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** A generic container for BisCore:GroupInformationElement instances.\r\n * @public\r\n */\r\nexport class GroupModel extends GroupInformationModel {\r\n /** @internal */\r\n public static override get className(): string { return \"GroupModel\"; }\r\n public constructor(props: ModelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n /** Insert a GroupInformationPartition and a GroupModel that breaks it down.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The GroupInformationPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the GroupInformationPartition that the new GroupModel will break down.\r\n * @returns The Id of the newly inserted GroupModel.\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: GroupInformationPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: GroupInformationPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n return iModelDb.models.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** The Generic:Group class is used when the group cannot be further classified.\r\n * @public\r\n */\r\nexport class Group extends GroupInformationElement {\r\n /** @internal */\r\n public static override get className(): string { return \"Group\"; }\r\n public constructor(props: ElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:Document class is used when a document cannot be further classified.\r\n * @note More-specific BisCore:Document subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericDocument extends Document {\r\n /** @internal */\r\n public static override get className(): string { return \"Document\"; }\r\n public constructor(props: ElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:PhysicalMaterial class is used when the physical material cannot be further classified.\r\n * @note More-specific BisCore:PhysicalMaterial subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericPhysicalMaterial extends PhysicalMaterial {\r\n /** @internal */\r\n public static override get className(): string { return \"PhysicalMaterial\"; }\r\n public constructor(props: DefinitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:PhysicalType class is used when the physical type cannot be further classified.\r\n * @note More-specific BisCore:PhysicalType subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericPhysicalType extends PhysicalType {\r\n /** @internal */\r\n public static override get className(): string { return \"PhysicalType\"; }\r\n public constructor(props: PhysicalTypeProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** The Generic:GraphicalType2d class is used when graphical types cannot be further classified.\r\n * @note More-specific BisCore:GraphicalType2d subclasses should be used wherever possible.\r\n * @public\r\n */\r\nexport class GenericGraphicalType2d extends GraphicalType2d {\r\n /** @internal */\r\n public static override get className(): string { return \"GraphicalType2d\"; }\r\n public constructor(props: TypeDefinitionElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericSchema.js","sourceRoot":"","sources":["../../../src/domains/GenericSchema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6BAA6B;AAC7B,oDAAiD;AACjD,8CAA+C;AAC/C,sCAA4C;AAC5C,oDAAoD;AAEpD,cAAc;AACd,MAAa,aAAc,SAAQ,eAAM;IAChC,MAAM,KAAc,UAAU,KAAa,OAAO,SAAS,CAAC,CAAC,CAAC;IAC9D,MAAM,KAAK,cAAc,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAc,CAAC,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,UAAU,eAAe,CAAC,CAAC,CAAC,CAAC;IACzJ,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,gBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACzD,gBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,gBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC7B,6BAAa,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;SACpD;IACH,CAAC;CACF;AAVD,sCAUC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Schema\n */\n\nimport * as path from \"path\";\nimport { ClassRegistry } from \"../ClassRegistry\";\nimport { KnownLocations } from \"../IModelHost\";\nimport { Schema, Schemas } from \"../Schema\";\nimport * as elementsModule from \"./GenericElements\";\n\n/** @public */\nexport class GenericSchema extends Schema {\n public static override get schemaName(): string { return \"Generic\"; }\n public static get schemaFilePath(): string { return path.join(KnownLocations.nativeAssetsDir, \"ECSchemas\", \"Dgn\", `${GenericSchema.schemaName}.ecschema.xml`); }\n public static registerSchema() {\n if (this !== Schemas.getRegisteredSchema(this.schemaName)) {\n Schemas.unregisterSchema(this.schemaName);\n Schemas.registerSchema(this);\n ClassRegistry.registerModule(elementsModule, this);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"GenericSchema.js","sourceRoot":"","sources":["../../../src/domains/GenericSchema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6BAA6B;AAC7B,oDAAiD;AACjD,8CAA+C;AAC/C,sCAA4C;AAC5C,oDAAoD;AAEpD,cAAc;AACd,MAAa,aAAc,SAAQ,eAAM;IAChC,MAAM,KAAc,UAAU,KAAa,OAAO,SAAS,CAAC,CAAC,CAAC;IAC9D,MAAM,KAAK,cAAc,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAc,CAAC,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,UAAU,eAAe,CAAC,CAAC,CAAC,CAAC;IACzJ,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,gBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACzD,gBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,gBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC7B,6BAAa,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;SACpD;IACH,CAAC;CACF;AAVD,sCAUC","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 Schema\r\n */\r\n\r\nimport * as path from \"path\";\r\nimport { ClassRegistry } from \"../ClassRegistry\";\r\nimport { KnownLocations } from \"../IModelHost\";\r\nimport { Schema, Schemas } from \"../Schema\";\r\nimport * as elementsModule from \"./GenericElements\";\r\n\r\n/** @public */\r\nexport class GenericSchema extends Schema {\r\n public static override get schemaName(): string { return \"Generic\"; }\r\n public static get schemaFilePath(): string { return path.join(KnownLocations.nativeAssetsDir, \"ECSchemas\", \"Dgn\", `${GenericSchema.schemaName}.ecschema.xml`); }\r\n public static registerSchema() {\r\n if (this !== Schemas.getRegisteredSchema(this.schemaName)) {\r\n Schemas.unregisterSchema(this.schemaName);\r\n Schemas.registerSchema(this);\r\n ClassRegistry.registerModule(elementsModule, this);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multipart.js","sourceRoot":"","sources":["../../../src/rpc/multipart.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAqI;AACrI,sCAAsC;AACtC,yCAAyC;AAEzC,4CAA4C;AAE5C,gBAAgB;AAChB,SAAgB,qBAAqB,CAAC,KAAyB;IAC7D,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;IAC5B,0BAAY,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3C,mHAAmH;IACnH,gBAAgB;IAChB,OAAO,IAAI,CAAC;AACd,CAAC;AAND,sDAMC;AAED,gBAAgB;AACT,KAAK,UAAU,qBAAqB,CAAC,GAAsB;IAChE,OAAO,IAAI,OAAO,CAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACzD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACvB,MAAM,CA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CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBACvD,EAAE,CAAC,CAAC;aACL;YAED,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AA5CD,sDA4CC;AAED,gBAAgB;AAChB,SAAgB,qBAAqB,CAAC,CAAS,EAAE,IAAoB,EAAE,KAAyB;IAC9F,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;AACpF,CAAC;AAHD,sDAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BentleyStatus, FormDataCommon, HttpServerRequest, IModelError, RpcMultipart, RpcSerializedValue } from \"@itwin/core-common\";\nimport * as FormData from \"form-data\";\nimport * as multiparty from \"multiparty\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** @internal */\nexport function createMultipartStream(value: RpcSerializedValue) {\n const form = new FormData();\n RpcMultipart.writeValueToForm(form, value);\n // Type information for FormData is lying. It actually extends Stream but not Readable, although it appears to work\n // fine for now.\n return form;\n}\n\n/** @internal */\nexport async function parseMultipartRequest(req: HttpServerRequest) {\n return new Promise<RpcSerializedValue>((resolve, reject) => {\n const form = new multiparty.Form({ maxFieldsSize: Infinity });\n form.on(\"error\", (err) => {\n reject(err);\n });\n\n const value = RpcSerializedValue.create();\n const data: { [index: string]: { size: number, chunks: Buffer[] } } = {};\n\n form.on(\"part\", (part: multiparty.Part) => {\n part.on(\"data\", (chunk: string | Buffer) => {\n if (part.name === \"objects\") {\n value.objects += chunk.toString();\n } else if (Buffer.isBuffer(chunk)) {\n if (!data[part.name]) {\n data[part.name] = { size: 0, chunks: [] };\n }\n\n data[part.name].size += chunk.byteLength;\n data[part.name].chunks.push(chunk);\n } else {\n throw new IModelError(BentleyStatus.ERROR, \"Unknown input.\");\n }\n });\n });\n\n form.on(\"close\", () => {\n let i = 0;\n for (; ;) {\n const part = data[`data-${i}`];\n if (!part) {\n break;\n }\n\n value.data.push(Buffer.concat(part.chunks, part.size));\n ++i;\n }\n\n resolve(value);\n });\n\n form.parse(req);\n });\n}\n\n/** @internal */\nexport function appendToMultipartForm(i: number, form: FormDataCommon, value: RpcSerializedValue) {\n const buf = value.data[i];\n form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"multipart.js","sourceRoot":"","sources":["../../../src/rpc/multipart.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAqI;AACrI,sCAAsC;AACtC,yCAAyC;AAEzC,4CAA4C;AAE5C,gBAAgB;AAChB,SAAgB,qBAAqB,CAAC,KAAyB;IAC7D,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;IAC5B,0BAAY,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3C,mHAAmH;IACnH,gBAAgB;IAChB,OAAO,IAAI,CAAC;AACd,CAAC;AAND,sDAMC;AAED,gBAAgB;AACT,KAAK,UAAU,qBAAqB,CAAC,GAAsB;IAChE,OAAO,IAAI,OAAO,CAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACzD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC9D,IAAI,CAA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BACP;gBAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBACvD,EAAE,CAAC,CAAC;aACL;YAED,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AA5CD,sDA4CC;AAED,gBAAgB;AAChB,SAAgB,qBAAqB,CAAC,CAAS,EAAE,IAAoB,EAAE,KAAyB;IAC9F,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;AACpF,CAAC;AAHD,sDAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { BentleyStatus, FormDataCommon, HttpServerRequest, IModelError, RpcMultipart, RpcSerializedValue } from \"@itwin/core-common\";\r\nimport * as FormData from \"form-data\";\r\nimport * as multiparty from \"multiparty\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** @internal */\r\nexport function createMultipartStream(value: RpcSerializedValue) {\r\n const form = new FormData();\r\n RpcMultipart.writeValueToForm(form, value);\r\n // Type information for FormData is lying. It actually extends Stream but not Readable, although it appears to work\r\n // fine for now.\r\n return form;\r\n}\r\n\r\n/** @internal */\r\nexport async function parseMultipartRequest(req: HttpServerRequest) {\r\n return new Promise<RpcSerializedValue>((resolve, reject) => {\r\n const form = new multiparty.Form({ maxFieldsSize: Infinity });\r\n form.on(\"error\", (err) => {\r\n reject(err);\r\n });\r\n\r\n const value = RpcSerializedValue.create();\r\n const data: { [index: string]: { size: number, chunks: Buffer[] } } = {};\r\n\r\n form.on(\"part\", (part: multiparty.Part) => {\r\n part.on(\"data\", (chunk: string | Buffer) => {\r\n if (part.name === \"objects\") {\r\n value.objects += chunk.toString();\r\n } else if (Buffer.isBuffer(chunk)) {\r\n if (!data[part.name]) {\r\n data[part.name] = { size: 0, chunks: [] };\r\n }\r\n\r\n data[part.name].size += chunk.byteLength;\r\n data[part.name].chunks.push(chunk);\r\n } else {\r\n throw new IModelError(BentleyStatus.ERROR, \"Unknown input.\");\r\n }\r\n });\r\n });\r\n\r\n form.on(\"close\", () => {\r\n let i = 0;\r\n for (; ;) {\r\n const part = data[`data-${i}`];\r\n if (!part) {\r\n break;\r\n }\r\n\r\n value.data.push(Buffer.concat(part.chunks, part.size));\r\n ++i;\r\n }\r\n\r\n resolve(value);\r\n });\r\n\r\n form.parse(req);\r\n });\r\n}\r\n\r\n/** @internal */\r\nexport function appendToMultipartForm(i: number, form: FormDataCommon, value: RpcSerializedValue) {\r\n const buf = value.data[i];\r\n form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/rpc/tracing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0BAA0B;AAE1B,sDAAwE;AACxE,oDAAgE;AAChE,6CAAgD;AAChD,oEAAiE;AACjE,8CAA2C;AAE3C,4CAA4C;AAE5C;;;;;;GAMG;AACH,MAAa,QAAQ;IAGnB;;SAEK;IACE,MAAM,KAAK,eAAe;QAC/B,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAA6B,CAAC;IACjE,CAAC;IAED;;SAEK;IACE,M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G,CAAC,CAAC;YACzC,2BAAa,CAAC,WAAW,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,mEAAmE;SAC5J;QAAC,OAAO,CAAC,EAAE;YACV,gEAAgE;YAChE,qBAAM,CAAC,QAAQ,CAAC,6CAAqB,CAAC,UAAU,EAAE,oCAAoC,CAAC,CAAC;YACxF,qBAAM,CAAC,YAAY,CAAC,6CAAqB,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;SAC1D;KACF;IAED,0GAA0G;IAC1G,qBAAM,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,2BAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;AACjG,CAAC;AAnBD,8CAmBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\n// cspell:ignore calltrace\n\nimport { assert, Logger, SpanKind, Tracing } from \"@itwin/core-bentley\";\nimport { RpcActivity, RpcInvocation } from \"@itwin/core-common\";\nimport { AsyncLocalStorage } from \"async_hooks\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { IModelHost } from \"../IModelHost\";\n\n/* eslint-disable deprecation/deprecation */\n\n/**\n * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this\n * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending\n * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken\n * from the RpcActivity.\n * @public\n */\nexport class RpcTrace {\n private static _storage = new AsyncLocalStorage();\n\n /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no\n * RpcActivity in the current call stack.\n * */\n public static get currentActivity(): RpcActivity | undefined {\n return RpcTrace._storage.getStore() as RpcActivity | undefined;\n }\n\n /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity\n * exists in the current call stack.\n * */\n public static get expectCurrentActivity(): RpcActivity {\n assert(undefined !== RpcTrace.currentActivity);\n return RpcTrace.currentActivity;\n }\n\n /** Start the processing of an RpcActivity. */\n public static async run<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\n return RpcTrace._storage.run(activity, fn);\n }\n\n /** Start the processing of an RpcActivity inside an OpenTelemetry span */\n public static async runWithSpan<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\n return Tracing.withSpan(activity.rpcMethod ?? \"unknown RPC method\", async () => RpcTrace.run(activity, fn), {\n attributes: { ...RpcInvocation.sanitizeForLog(activity) },\n kind: SpanKind.INTERNAL,\n });\n }\n}\n\n/** @internal */\nexport function initializeTracing(enableOpenTelemetry: boolean = false) {\n RpcInvocation.runActivity = async (activity, fn) => RpcTrace.run(activity, fn); // redirect the invocation processing to the tracer\n\n if (enableOpenTelemetry) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const api = require(\"@opentelemetry/api\");\n const tracer = api.trace.getTracer(\"@itwin/core-backend\", IModelHost.backendVersion);\n Tracing.enableOpenTelemetry(tracer, api);\n RpcInvocation.runActivity = async (activity, fn) => RpcTrace.runWithSpan(activity, fn); // wrap invocation in an OpenTelemetry span in addition to RpcTrace\n } catch (e) {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Logger.logError(BackendLoggerCategory.IModelHost, \"Failed to initialize OpenTelemetry\");\n Logger.logException(BackendLoggerCategory.IModelHost, e);\n }\n }\n\n // set up static logger metadata to include current RpcActivity information for logs during rpc processing\n Logger.staticMetaData.set(\"rpc\", () => RpcInvocation.sanitizeForLog(RpcTrace.currentActivity));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/rpc/tracing.ts"],"names":[],"mappings":";AAA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AAE,CAAC,CAAC,CAAC,mDAAmD;IAEnI,IAAI,mBAAmB,EAAE;QACvB,IAAI;YACF,8DAA8D;YAC9D,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;YAC1C,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,qBAAqB,EAAE,uBAAU,CAAC,cAAc,CAAC,CAAC;YACrF,sBAAO,CAAC,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACzC,2BAAa,CAAC,WAAW,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,mEAAmE;SAC5J;QAAC,OAAO,CAAC,EAAE;YACV,gEAAgE;YAChE,qBAAM,CAAC,QAAQ,CAAC,6CAAqB,CAAC,UAAU,EAAE,oCAAoC,CAAC,CAAC;YACxF,qBAAM,CAAC,YAAY,CAAC,6CAAqB,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;SAC1D;KACF;IAED,0GAA0G;IAC1G,qBAAM,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,2BAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;AACjG,CAAC;AAnBD,8CAmBC","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// cspell:ignore calltrace\r\n\r\nimport { assert, Logger, SpanKind, Tracing } from \"@itwin/core-bentley\";\r\nimport { RpcActivity, RpcInvocation } from \"@itwin/core-common\";\r\nimport { AsyncLocalStorage } from \"async_hooks\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { IModelHost } from \"../IModelHost\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/**\r\n * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this\r\n * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending\r\n * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken\r\n * from the RpcActivity.\r\n * @public\r\n */\r\nexport class RpcTrace {\r\n private static _storage = new AsyncLocalStorage();\r\n\r\n /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no\r\n * RpcActivity in the current call stack.\r\n * */\r\n public static get currentActivity(): RpcActivity | undefined {\r\n return RpcTrace._storage.getStore() as RpcActivity | undefined;\r\n }\r\n\r\n /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity\r\n * exists in the current call stack.\r\n * */\r\n public static get expectCurrentActivity(): RpcActivity {\r\n assert(undefined !== RpcTrace.currentActivity);\r\n return RpcTrace.currentActivity;\r\n }\r\n\r\n /** Start the processing of an RpcActivity. */\r\n public static async run<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\r\n return RpcTrace._storage.run(activity, fn);\r\n }\r\n\r\n /** Start the processing of an RpcActivity inside an OpenTelemetry span */\r\n public static async runWithSpan<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\r\n return Tracing.withSpan(activity.rpcMethod ?? \"unknown RPC method\", async () => RpcTrace.run(activity, fn), {\r\n attributes: { ...RpcInvocation.sanitizeForLog(activity) },\r\n kind: SpanKind.INTERNAL,\r\n });\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function initializeTracing(enableOpenTelemetry: boolean = false) {\r\n RpcInvocation.runActivity = async (activity, fn) => RpcTrace.run(activity, fn); // redirect the invocation processing to the tracer\r\n\r\n if (enableOpenTelemetry) {\r\n try {\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n const api = require(\"@opentelemetry/api\");\r\n const tracer = api.trace.getTracer(\"@itwin/core-backend\", IModelHost.backendVersion);\r\n Tracing.enableOpenTelemetry(tracer, api);\r\n RpcInvocation.runActivity = async (activity, fn) => RpcTrace.runWithSpan(activity, fn); // wrap invocation in an OpenTelemetry span in addition to RpcTrace\r\n } catch (e) {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n Logger.logError(BackendLoggerCategory.IModelHost, \"Failed to initialize OpenTelemetry\");\r\n Logger.logException(BackendLoggerCategory.IModelHost, e);\r\n }\r\n }\r\n\r\n // set up static logger metadata to include current RpcActivity information for logs during rpc processing\r\n Logger.staticMetaData.set(\"rpc\", () => RpcInvocation.sanitizeForLog(RpcTrace.currentActivity));\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../../src/rpc/web/logging.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,oDAA6G;AAC7G,yBAAyB;AAEzB,4CAA4C;AAE5C,MAAa,uBAAwB,SAAQ,8BAAgB;IACxC,KAAK,CAAC,gBAAgB,CAAC,KAAuB,EAAE,MAAqB;QACtF,QAAQ,KAAK,EAAE;YACb,KAAK,8BAAgB,CAAC,eAAe,CAAC,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,kCAAoB,CAAC,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YACxJ,KAAK,8BAAgB,CAAC,oBAAoB,CAAC,CAAC,OAAO,IAAI,CAAC,eAAe,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;YAC9G,KAAK,8BAAgB,CAAC,sBAAsB,CAAC,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,kCAAoB,CAAC,mBAAmB,EAAE,+BAA+B,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;SACjM;IACH,CAAC;IAEkB,WAAW;QAC5B,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,eAAe,CAAC,OAAe,EAAE,UAAyB;QACtE,MAAM,mBAAmB,GAAG,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAChF,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1D,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC;QACvC,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,2CAA2C;QAElH,MAAM,QAAQ,GAAG;YACf,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM;YACjC,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI;YAC7B,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,YAAY;YACZ,uGAAuG;YACvG,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;YAC/B,GAAG,OAAO;SACX,CAAC;QAEF,qBAAM,CAAC,QAAQ,CAAC,kCAAoB,CAAC,mBAAmB,EAAE,GAAG,OAAO,IAAI,mBAAmB,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC3G,CAAC;CACF;AAhCD,0DAgCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { Logger } from \"@itwin/core-bentley\";\nimport { CommonLoggerCategory, RpcInvocation, RpcProtocolEvent, WebAppRpcLogging } from \"@itwin/core-common\";\nimport * as os from \"os\";\n\n/* eslint-disable deprecation/deprecation */\n\nexport class WebAppRpcLoggingBackend extends WebAppRpcLogging {\n protected override async logProtocolEvent(event: RpcProtocolEvent, object: RpcInvocation): Promise<void> {\n switch (event) {\n case RpcProtocolEvent.RequestReceived: return this.logRequest(CommonLoggerCategory.RpcInterfaceBackend, \"RpcInterface.backend.request\", object.request);\n case RpcProtocolEvent.BackendErrorOccurred: return this.logErrorBackend(\"RpcInterface.backend.error\", object);\n case RpcProtocolEvent.BackendResponseCreated: return this.logResponse(CommonLoggerCategory.RpcInterfaceBackend, \"RpcInterface.backend.response\", object.request, object.status, object.elapsed);\n }\n }\n\n protected override getHostname(): string {\n return os.hostname();\n }\n\n private async logErrorBackend(message: string, invocation: RpcInvocation): Promise<void> {\n const operationDescriptor = this.buildOperationDescriptor(invocation.operation);\n const pathIds = this.findPathIds(invocation.request.path);\n const result = await invocation.result;\n const errorMessage = result.message ? result.message : result.objects; // Can be an error or an RpcSerializedValue\n\n const metadata = {\n method: invocation.request.method,\n path: invocation.request.path,\n status: invocation.status,\n errorMessage,\n // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!\n ActivityId: invocation.request.id, // eslint-disable-line @typescript-eslint/naming-convention\n MachineName: this.getHostname(), // eslint-disable-line @typescript-eslint/naming-convention\n ...pathIds,\n };\n\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, `${message}.${operationDescriptor}`, metadata);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../../src/rpc/web/logging.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,oDAA6G;AAC7G,yBAAyB;AAEzB,4CAA4C;AAE5C,MAAa,uBAAwB,SAAQ,8BAAgB;IACxC,KAAK,CAAC,gBAAgB,CAAC,KAAuB,EAAE,MAAqB;QACtF,QAAQ,KAAK,EAAE;YACb,KAAK,8BAAgB,CAAC,eAAe,CAAC,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,kCAAoB,CAAC,mBAAmB,EAAE,8BAA8B,EAAE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,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC3G,CAAC;CACF;AAhCD,0DAgCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { CommonLoggerCategory, RpcInvocation, RpcProtocolEvent, WebAppRpcLogging } from \"@itwin/core-common\";\r\nimport * as os from \"os\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\nexport class WebAppRpcLoggingBackend extends WebAppRpcLogging {\r\n protected override async logProtocolEvent(event: RpcProtocolEvent, object: RpcInvocation): Promise<void> {\r\n switch (event) {\r\n case RpcProtocolEvent.RequestReceived: return this.logRequest(CommonLoggerCategory.RpcInterfaceBackend, \"RpcInterface.backend.request\", object.request);\r\n case RpcProtocolEvent.BackendErrorOccurred: return this.logErrorBackend(\"RpcInterface.backend.error\", object);\r\n case RpcProtocolEvent.BackendResponseCreated: return this.logResponse(CommonLoggerCategory.RpcInterfaceBackend, \"RpcInterface.backend.response\", object.request, object.status, object.elapsed);\r\n }\r\n }\r\n\r\n protected override getHostname(): string {\r\n return os.hostname();\r\n }\r\n\r\n private async logErrorBackend(message: string, invocation: RpcInvocation): Promise<void> {\r\n const operationDescriptor = this.buildOperationDescriptor(invocation.operation);\r\n const pathIds = this.findPathIds(invocation.request.path);\r\n const result = await invocation.result;\r\n const errorMessage = result.message ? result.message : result.objects; // Can be an error or an RpcSerializedValue\r\n\r\n const metadata = {\r\n method: invocation.request.method,\r\n path: invocation.request.path,\r\n status: invocation.status,\r\n errorMessage,\r\n // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!\r\n ActivityId: invocation.request.id, // eslint-disable-line @typescript-eslint/naming-convention\r\n MachineName: this.getHostname(), // eslint-disable-line @typescript-eslint/naming-convention\r\n ...pathIds,\r\n };\r\n\r\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, `${message}.${operationDescriptor}`, metadata);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/rpc/web/request.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAc4B;AAE5B,4CAA4C;AAE5C,SAAS,YAAY,CAAC,QAA2B,EAAE,GAAsB;IACvE,MAAM,WAAW,GAA0B,QAAQ,CAAC,yCAAyC,CAAC;IAC9F,MAAM,aAAa,GAA0B;QAC3C,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE;QACpC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,EAAE;QAC1D,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,IAAI,EAAE;QACpE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,EAAE;QAClD,aAAa,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE;KAC9F,CAAC;IACF,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,SAAS,aAAa,CAAC,SAAiC;IACtD,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACnH,OAAO,gCAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,GAAs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OAAO,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,qCAAuB,CAAC,SAAS,CAAC,CAAC,CAAC,qCAAuB,CAAC,IAAI;KACrG,CAAC;IAEF,OAAO,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC;IAEpB,OAAO,CAAC,eAAe,GAAG,CAAC,CAAC;IAE5B,IAAI,QAAQ,CAAC,yBAAyB,EAAE;QACtC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC;QAC/D,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,eAAe,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;SACjD;KACF;IAED,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE;QACf,MAAM,IAAI,yBAAW,CAAC,2BAAa,CAAC,KAAK,EAAE,gDAAgD,CAAC,CAAC;KAC9F;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AApCD,oCAoCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport {\n BentleyStatus,\n HttpServerRequest,\n IModelError,\n MarshalingBinaryMarker,\n RpcContentType,\n RpcMultipart,\n RpcResponseCacheControl,\n RpcSerializedValue,\n SerializedRpcActivity,\n SerializedRpcOperation,\n SerializedRpcRequest,\n WEB_RPC_CONSTANTS,\n WebAppRpcProtocol,\n} from \"@itwin/core-common\";\n\n/* eslint-disable deprecation/deprecation */\n\nfunction parseHeaders(protocol: WebAppRpcProtocol, req: HttpServerRequest): SerializedRpcActivity {\n const headerNames: SerializedRpcActivity = protocol.serializedClientRequestContextHeaderNames;\n const parsedHeaders: SerializedRpcActivity = {\n id: req.header(headerNames.id) || \"\",\n applicationId: req.header(headerNames.applicationId) || \"\",\n applicationVersion: req.header(headerNames.applicationVersion) || \"\",\n sessionId: req.header(headerNames.sessionId) || \"\",\n authorization: (headerNames.authorization ? req.header(headerNames.authorization) : \"\") ?? \"\",\n };\n return parsedHeaders;\n}\n\nfunction parseFromPath(operation: SerializedRpcOperation): RpcSerializedValue {\n const decoded = operation.encodedRequest ? Buffer.from(operation.encodedRequest, \"base64\").toString(\"binary\") : \"\";\n return RpcSerializedValue.create(decoded);\n}\n\nasync function parseFromBody(req: HttpServerRequest): Promise<RpcSerializedValue> {\n const contentType = WebAppRpcProtocol.computeContentType(req.header(WEB_RPC_CONSTANTS.CONTENT));\n if (contentType === RpcContentType.Binary) {\n const objects = JSON.stringify([MarshalingBinaryMarker.createDefault()]);\n const data = [req.body as Buffer];\n return RpcSerializedValue.create(objects, data);\n } else if (contentType === RpcContentType.Multipart) {\n return RpcMultipart.parseRequest(req);\n } else {\n return RpcSerializedValue.create(req.body as string);\n }\n}\n\n/** @internal */\nexport async function parseRequest(protocol: WebAppRpcProtocol, req: HttpServerRequest): Promise<SerializedRpcRequest> {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const operation = protocol.getOperationFromPath(req.url!);\n\n const parsedHeaders = parseHeaders(protocol, req);\n\n const request: SerializedRpcRequest = {\n ...parsedHeaders,\n operation: {\n interfaceDefinition: operation.interfaceDefinition,\n operationName: operation.operationName,\n interfaceVersion: operation.interfaceVersion,\n },\n method: req.method,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n path: req.url!,\n parameters: operation.encodedRequest ? parseFromPath(operation) : await parseFromBody(req),\n caching: operation.encodedRequest ? RpcResponseCacheControl.Immutable : RpcResponseCacheControl.None,\n };\n\n request.ip = req.ip;\n\n request.protocolVersion = 0;\n\n if (protocol.protocolVersionHeaderName) {\n const version = req.header(protocol.protocolVersionHeaderName);\n if (version) {\n request.protocolVersion = parseInt(version, 10);\n }\n }\n\n if (!request.id) {\n throw new IModelError(BentleyStatus.ERROR, `Invalid request: Missing required activity ID.`);\n }\n\n return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AAC;IAEF,OAAO,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC;IAEpB,OAAO,CAAC,eAAe,GAAG,CAAC,CAAC;IAE5B,IAAI,QAAQ,CAAC,yBAAyB,EAAE;QACtC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC;QAC/D,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,eAAe,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;SACjD;KACF;IAED,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE;QACf,MAAM,IAAI,yBAAW,CAAC,2BAAa,CAAC,KAAK,EAAE,gDAAgD,CAAC,CAAC;KAC9F;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AApCD,oCAoCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport {\r\n BentleyStatus,\r\n HttpServerRequest,\r\n IModelError,\r\n MarshalingBinaryMarker,\r\n RpcContentType,\r\n RpcMultipart,\r\n RpcResponseCacheControl,\r\n RpcSerializedValue,\r\n SerializedRpcActivity,\r\n SerializedRpcOperation,\r\n SerializedRpcRequest,\r\n WEB_RPC_CONSTANTS,\r\n WebAppRpcProtocol,\r\n} from \"@itwin/core-common\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\nfunction parseHeaders(protocol: WebAppRpcProtocol, req: HttpServerRequest): SerializedRpcActivity {\r\n const headerNames: SerializedRpcActivity = protocol.serializedClientRequestContextHeaderNames;\r\n const parsedHeaders: SerializedRpcActivity = {\r\n id: req.header(headerNames.id) || \"\",\r\n applicationId: req.header(headerNames.applicationId) || \"\",\r\n applicationVersion: req.header(headerNames.applicationVersion) || \"\",\r\n sessionId: req.header(headerNames.sessionId) || \"\",\r\n authorization: (headerNames.authorization ? req.header(headerNames.authorization) : \"\") ?? \"\",\r\n };\r\n return parsedHeaders;\r\n}\r\n\r\nfunction parseFromPath(operation: SerializedRpcOperation): RpcSerializedValue {\r\n const decoded = operation.encodedRequest ? Buffer.from(operation.encodedRequest, \"base64\").toString(\"binary\") : \"\";\r\n return RpcSerializedValue.create(decoded);\r\n}\r\n\r\nasync function parseFromBody(req: HttpServerRequest): Promise<RpcSerializedValue> {\r\n const contentType = WebAppRpcProtocol.computeContentType(req.header(WEB_RPC_CONSTANTS.CONTENT));\r\n if (contentType === RpcContentType.Binary) {\r\n const objects = JSON.stringify([MarshalingBinaryMarker.createDefault()]);\r\n const data = [req.body as Buffer];\r\n return RpcSerializedValue.create(objects, data);\r\n } else if (contentType === RpcContentType.Multipart) {\r\n return RpcMultipart.parseRequest(req);\r\n } else {\r\n return RpcSerializedValue.create(req.body as string);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport async function parseRequest(protocol: WebAppRpcProtocol, req: HttpServerRequest): Promise<SerializedRpcRequest> {\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n const operation = protocol.getOperationFromPath(req.url!);\r\n\r\n const parsedHeaders = parseHeaders(protocol, req);\r\n\r\n const request: SerializedRpcRequest = {\r\n ...parsedHeaders,\r\n operation: {\r\n interfaceDefinition: operation.interfaceDefinition,\r\n operationName: operation.operationName,\r\n interfaceVersion: operation.interfaceVersion,\r\n },\r\n method: req.method,\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n path: req.url!,\r\n parameters: operation.encodedRequest ? parseFromPath(operation) : await parseFromBody(req),\r\n caching: operation.encodedRequest ? RpcResponseCacheControl.Immutable : RpcResponseCacheControl.None,\r\n };\r\n\r\n request.ip = req.ip;\r\n\r\n request.protocolVersion = 0;\r\n\r\n if (protocol.protocolVersionHeaderName) {\r\n const version = req.header(protocol.protocolVersionHeaderName);\r\n if (version) {\r\n request.protocolVersion = parseInt(version, 10);\r\n }\r\n }\r\n\r\n if (!request.id) {\r\n throw new IModelError(BentleyStatus.ERROR, `Invalid request: Missing required activity ID.`);\r\n }\r\n\r\n return request;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../../../src/rpc/web/response.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,oDAe4B;AAE5B,4CAA4C;AAE5C,SAAS,iBAAiB,CAAC,QAA2B,EAAE,OAA6B,EAAE,WAAkC,EAAE,GAAuB;IAChJ,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,8BAAgB,CAAC,QAAQ,CAAC;IACrF,iJAAiJ;IACjJ,kJAAkJ;IAElJ,yFAAyF;IACzF,MAAM,gBAAgB,GAAG,IAAI,CAAC;IAC9B,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,KAAK,qCAAuB,CAAC,SAAS,EAAE;QACpE,gDAAgD;QAChD,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE;YACtD,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;SACtC;aAAM,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,KAAK,qBAAqB,EAAE;YACpE,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;SACtC;aAAM,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,KAAK,oBAAoB,EAAE;YACnE,qKAAqK;YACrK,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,YAAY,gBAAgB,GAAG,EAAE,wBAAwB,CAAC,CAAC;SACrF;aAAM,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,KAAK,0BAA0B,EAAE;YACzE,yHAAyH;YACzH,GAAG,CA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AI,UAAU,GAAG,GAAG;QAClB,qBAAM,CAAC,OAAO,CAAC,kCAAoB,CAAC,mBAAmB,EAAE,gCAAgC,EAAE,QAAQ,CAAC,CAAC;;QAErG,qBAAM,CAAC,QAAQ,CAAC,kCAAoB,CAAC,mBAAmB,EAAE,gCAAgC,EAAE,QAAQ,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { Logger } from \"@itwin/core-bentley\";\nimport {\n CommonLoggerCategory,\n HttpServerRequest,\n HttpServerResponse,\n ReadableFormData,\n RpcContentType,\n RpcMultipart,\n RpcProtocol,\n RpcRequestFulfillment,\n RpcRequestStatus,\n RpcResponseCacheControl,\n SerializedRpcRequest,\n WEB_RPC_CONSTANTS,\n WebAppRpcProtocol,\n WebAppRpcRequest,\n} from \"@itwin/core-common\";\n\n/* eslint-disable deprecation/deprecation */\n\nfunction configureResponse(protocol: WebAppRpcProtocol, request: SerializedRpcRequest, fulfillment: RpcRequestFulfillment, res: HttpServerResponse) {\n const success = protocol.getStatus(fulfillment.status) === RpcRequestStatus.Resolved;\n // TODO: Use stale-while-revalidate in cache headers. This needs to be tested, and does not currently have support in the router/caching-service.\n // This will allow browsers to use stale cached responses while also revalidating with the router, allowing us to start up a backend if necessary.\n\n // RPC Caching Service uses the s-maxage header to determine the TTL for the redis cache.\n const oneHourInSeconds = 3600;\n if (success && request.caching === RpcResponseCacheControl.Immutable) {\n // If response size is > 50 MB, do not cache it.\n if (fulfillment.result.objects.length > (50 * 10 ** 7)) {\n res.set(\"Cache-Control\", \"no-store\");\n } else if (request.operation.operationName === \"generateTileContent\") {\n res.set(\"Cache-Control\", \"no-store\");\n } else if (request.operation.operationName === \"getConnectionProps\") {\n // GetConnectionprops can't be cached on the browser longer than the lifespan of the backend. The lifespan of backend may shrink too. Keep it at 1 second to be safe.\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 24}, max-age=1, immutable`);\n } else if (request.operation.operationName === \"getTileCacheContainerUrl\") {\n // getTileCacheContainerUrl returns a SAS with an expiry of 23:59:59. We can't exceed that time when setting the max-age.\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 23}, max-age=${oneHourInSeconds * 23}, immutable`);\n } else {\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 24}, max-age=${oneHourInSeconds * 48}, immutable`);\n }\n }\n\n if (fulfillment.retry) {\n res.set(\"Retry-After\", fulfillment.retry);\n }\n}\n\nfunction configureText(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): string {\n res.set(WEB_RPC_CONSTANTS.CONTENT, WEB_RPC_CONSTANTS.TEXT);\n return (fulfillment.status === 204) ? \"\" : fulfillment.result.objects;\n}\n\nfunction configureBinary(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): Buffer {\n res.set(WEB_RPC_CONSTANTS.CONTENT, WEB_RPC_CONSTANTS.BINARY);\n const data = fulfillment.result.data[0];\n return Buffer.isBuffer(data) ? data : Buffer.from(data);\n}\n\nfunction configureMultipart(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): ReadableFormData {\n const response = RpcMultipart.createStream(fulfillment.result);\n const headers = response.getHeaders();\n for (const header in headers) {\n if (headers.hasOwnProperty(header)) {\n res.set(header, headers[header]);\n }\n }\n\n return response;\n}\n\nfunction configureStream(fulfillment: RpcRequestFulfillment) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return fulfillment.result.stream!;\n}\n\n/** @internal */\nexport async function sendResponse(protocol: WebAppRpcProtocol, request: SerializedRpcRequest, fulfillment: RpcRequestFulfillment, req: HttpServerRequest, res: HttpServerResponse) {\n logResponse(request, fulfillment.status, fulfillment.rawResult);\n\n const versionHeader = protocol.protocolVersionHeaderName;\n if (versionHeader && RpcProtocol.protocolVersion) {\n res.set(versionHeader, RpcProtocol.protocolVersion.toString());\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const { Readable, Stream } = await import(/* webpackIgnore: true */ \"stream\");\n const { createGzip } = await import(/* webpackIgnore: true */ \"zlib\");\n\n const transportType = WebAppRpcRequest.computeTransportType(fulfillment.result, fulfillment.rawResult);\n let responseBody;\n if (transportType === RpcContentType.Binary) {\n responseBody = configureBinary(fulfillment, res);\n } else if (transportType === RpcContentType.Multipart) {\n responseBody = configureMultipart(fulfillment, res);\n } else if (transportType === RpcContentType.Stream) {\n responseBody = configureStream(fulfillment);\n } else {\n responseBody = configureText(fulfillment, res);\n }\n\n configureResponse(protocol, request, fulfillment, res);\n res.status(fulfillment.status);\n\n if (fulfillment.allowCompression && req.header(\"Accept-Encoding\")?.includes(\"gzip\")) {\n res.set(\"Content-Encoding\", \"gzip\");\n const readableResponseBody = (responseBody instanceof Stream) ? responseBody : Readable.from(responseBody);\n responseBody = readableResponseBody.pipe(createGzip());\n }\n\n // This check should in theory look for instances of Readable, but that would break backend implementation at\n // core/backend/src/RpcBackend.ts\n if (responseBody instanceof Stream) {\n responseBody.pipe(res);\n } else {\n res.send(responseBody);\n }\n}\n\nfunction logResponse(request: SerializedRpcRequest, statusCode: number, resultObj: unknown) {\n const metadata = {\n ActivityId: request.id, // eslint-disable-line @typescript-eslint/naming-convention\n method: request.method,\n path: request.path,\n operation: request.operation,\n statusCode,\n error: resultObj instanceof Error ? resultObj : undefined,\n };\n\n if (statusCode < 400)\n Logger.logInfo(CommonLoggerCategory.RpcInterfaceBackend, \"RPC over HTTP success response\", metadata);\n else\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, \"RPC over HTTP failure response\", metadata);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../../../src/rpc/web/response.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,oDAe4B;AAE5B,4CAA4C;AAE5C,SAA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AAgB,IAAI,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE;QACnF,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QACpC,MAAM,oBAAoB,GAAG,CAAC,YAAY,YAAY,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3G,YAAY,GAAG,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;KACxD;IAED,6GAA6G;IAC7G,iCAAiC;IACjC,IAAI,YAAY,YAAY,MAAM,EAAE;QAClC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACxB;SAAM;QACL,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KACxB;AACH,CAAC;AAvCD,oCAuCC;AAED,SAAS,WAAW,CAAC,OAA6B,EAAE,UAAkB,EAAE,SAAkB;IACxF,MAAM,QAAQ,GAAG;QACf,UAAU,EAAE,OAAO,CAAC,EAAE;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,UAAU;QACV,KAAK,EAAE,SAAS,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;KAC1D,CAAC;IAEF,IAAI,UAAU,GAAG,GAAG;QAClB,qBAAM,CAAC,OAAO,CAAC,kCAAoB,CAAC,mBAAmB,EAAE,gCAAgC,EAAE,QAAQ,CAAC,CAAC;;QAErG,qBAAM,CAAC,QAAQ,CAAC,kCAAoB,CAAC,mBAAmB,EAAE,gCAAgC,EAAE,QAAQ,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n CommonLoggerCategory,\r\n HttpServerRequest,\r\n HttpServerResponse,\r\n ReadableFormData,\r\n RpcContentType,\r\n RpcMultipart,\r\n RpcProtocol,\r\n RpcRequestFulfillment,\r\n RpcRequestStatus,\r\n RpcResponseCacheControl,\r\n SerializedRpcRequest,\r\n WEB_RPC_CONSTANTS,\r\n WebAppRpcProtocol,\r\n WebAppRpcRequest,\r\n} from \"@itwin/core-common\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\nfunction configureResponse(protocol: WebAppRpcProtocol, request: SerializedRpcRequest, fulfillment: RpcRequestFulfillment, res: HttpServerResponse) {\r\n const success = protocol.getStatus(fulfillment.status) === RpcRequestStatus.Resolved;\r\n // TODO: Use stale-while-revalidate in cache headers. This needs to be tested, and does not currently have support in the router/caching-service.\r\n // This will allow browsers to use stale cached responses while also revalidating with the router, allowing us to start up a backend if necessary.\r\n\r\n // RPC Caching Service uses the s-maxage header to determine the TTL for the redis cache.\r\n const oneHourInSeconds = 3600;\r\n if (success && request.caching === RpcResponseCacheControl.Immutable) {\r\n // If response size is > 50 MB, do not cache it.\r\n if (fulfillment.result.objects.length > (50 * 10 ** 7)) {\r\n res.set(\"Cache-Control\", \"no-store\");\r\n } else if (request.operation.operationName === \"generateTileContent\") {\r\n res.set(\"Cache-Control\", \"no-store\");\r\n } else if (request.operation.operationName === \"getConnectionProps\") {\r\n // GetConnectionprops can't be cached on the browser longer than the lifespan of the backend. The lifespan of backend may shrink too. Keep it at 1 second to be safe.\r\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 24}, max-age=1, immutable`);\r\n } else if (request.operation.operationName === \"getTileCacheContainerUrl\") {\r\n // getTileCacheContainerUrl returns a SAS with an expiry of 23:59:59. We can't exceed that time when setting the max-age.\r\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 23}, max-age=${oneHourInSeconds * 23}, immutable`);\r\n } else {\r\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 24}, max-age=${oneHourInSeconds * 48}, immutable`);\r\n }\r\n }\r\n\r\n if (fulfillment.retry) {\r\n res.set(\"Retry-After\", fulfillment.retry);\r\n }\r\n}\r\n\r\nfunction configureText(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): string {\r\n res.set(WEB_RPC_CONSTANTS.CONTENT, WEB_RPC_CONSTANTS.TEXT);\r\n return (fulfillment.status === 204) ? \"\" : fulfillment.result.objects;\r\n}\r\n\r\nfunction configureBinary(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): Buffer {\r\n res.set(WEB_RPC_CONSTANTS.CONTENT, WEB_RPC_CONSTANTS.BINARY);\r\n const data = fulfillment.result.data[0];\r\n return Buffer.isBuffer(data) ? data : Buffer.from(data);\r\n}\r\n\r\nfunction configureMultipart(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): ReadableFormData {\r\n const response = RpcMultipart.createStream(fulfillment.result);\r\n const headers = response.getHeaders();\r\n for (const header in headers) {\r\n if (headers.hasOwnProperty(header)) {\r\n res.set(header, headers[header]);\r\n }\r\n }\r\n\r\n return response;\r\n}\r\n\r\nfunction configureStream(fulfillment: RpcRequestFulfillment) {\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n return fulfillment.result.stream!;\r\n}\r\n\r\n/** @internal */\r\nexport async function sendResponse(protocol: WebAppRpcProtocol, request: SerializedRpcRequest, fulfillment: RpcRequestFulfillment, req: HttpServerRequest, res: HttpServerResponse) {\r\n logResponse(request, fulfillment.status, fulfillment.rawResult);\r\n\r\n const versionHeader = protocol.protocolVersionHeaderName;\r\n if (versionHeader && RpcProtocol.protocolVersion) {\r\n res.set(versionHeader, RpcProtocol.protocolVersion.toString());\r\n }\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n const { Readable, Stream } = await import(/* webpackIgnore: true */ \"stream\");\r\n const { createGzip } = await import(/* webpackIgnore: true */ \"zlib\");\r\n\r\n const transportType = WebAppRpcRequest.computeTransportType(fulfillment.result, fulfillment.rawResult);\r\n let responseBody;\r\n if (transportType === RpcContentType.Binary) {\r\n responseBody = configureBinary(fulfillment, res);\r\n } else if (transportType === RpcContentType.Multipart) {\r\n responseBody = configureMultipart(fulfillment, res);\r\n } else if (transportType === RpcContentType.Stream) {\r\n responseBody = configureStream(fulfillment);\r\n } else {\r\n responseBody = configureText(fulfillment, res);\r\n }\r\n\r\n configureResponse(protocol, request, fulfillment, res);\r\n res.status(fulfillment.status);\r\n\r\n if (fulfillment.allowCompression && req.header(\"Accept-Encoding\")?.includes(\"gzip\")) {\r\n res.set(\"Content-Encoding\", \"gzip\");\r\n const readableResponseBody = (responseBody instanceof Stream) ? responseBody : Readable.from(responseBody);\r\n responseBody = readableResponseBody.pipe(createGzip());\r\n }\r\n\r\n // This check should in theory look for instances of Readable, but that would break backend implementation at\r\n // core/backend/src/RpcBackend.ts\r\n if (responseBody instanceof Stream) {\r\n responseBody.pipe(res);\r\n } else {\r\n res.send(responseBody);\r\n }\r\n}\r\n\r\nfunction logResponse(request: SerializedRpcRequest, statusCode: number, resultObj: unknown) {\r\n const metadata = {\r\n ActivityId: request.id, // eslint-disable-line @typescript-eslint/naming-convention\r\n method: request.method,\r\n path: request.path,\r\n operation: request.operation,\r\n statusCode,\r\n error: resultObj instanceof Error ? resultObj : undefined,\r\n };\r\n\r\n if (statusCode < 400)\r\n Logger.logInfo(CommonLoggerCategory.RpcInterfaceBackend, \"RPC over HTTP success response\", metadata);\r\n else\r\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, \"RPC over HTTP failure response\", metadata);\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevToolsRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/DevToolsRpcImpl.ts"],"names":[],"mappings":";;;AAQA,oDAA0H;AAC1H,0CAA+D;AAE/D;;GAEG;AACH,MAAa,eAAgB,SAAQ,0BAAY;IACxC,MAAM,CAAC,QAAQ,KAAK,wBAAU,CAAC,YAAY,CAAC,kCAAoB,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAE5F,gDAAgD;IACzC,KAAK,CAAC,IAAI,CAAC,WAA2B;QAC3C,OAAO,mBAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,sCAAsC;IAC/B,KAAK,CAAC,KAAK,CAAC,WAA2B,EAAE,OAA6B;QAC3E,MAAM,KAAK,GAAG,mBAAQ,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,OAAO,KAAK,kCAAoB,CAAC,IAAI;YACvC,OAAO,KAAK,CAAC;QACf,MAAM,cAAc,GAAG,iCAAsB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACrE,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,uEAAuE;IAChE,KAAK,CAAC,QAAQ,CAAC,WAA2B;QAC/C,OAAO,mBAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED,qCAAqC;IAC9B,KAAK,CAAC,WAAW,CAAC,WAA2B,EAAE,cAAsB,EAAE,QAAkB;QAC9F,OAAO,mBAAQ,CAAC,WAAW,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC;CACF;AA1BD,0CA0BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\nimport { LogLevel } from \"@itwin/core-bentley\";\nimport { DevToolsRpcInterface, DevToolsStatsOptions, IModelRpcProps, RpcInterface, RpcManager } from \"@itwin/core-common\";\nimport { DevTools, DevToolsStatsFormatter } from \"../DevTools\";\n\n/** The backend implementation of WipRpcInterface.\n * @internal\n */\nexport class DevToolsRpcImpl extends RpcInterface implements DevToolsRpcInterface { // eslint-disable-line deprecation/deprecation\n public static register() { RpcManager.registerImpl(DevToolsRpcInterface, DevToolsRpcImpl); }\n\n // Returns true if the backend received the ping\n public async ping(_tokenProps: IModelRpcProps): Promise<boolean> {\n return DevTools.ping();\n }\n\n // Returns JSON object with statistics\n public async stats(_tokenProps: IModelRpcProps, options: DevToolsStatsOptions): Promise<any> {\n const stats = DevTools.stats();\n if (options === DevToolsStatsOptions.None)\n return stats;\n const formattedStats = DevToolsStatsFormatter.toFormattedJson(stats);\n return formattedStats;\n }\n\n // Returns JSON object with backend versions (application and iModelJs)\n public async versions(_tokenProps: IModelRpcProps): Promise<any> {\n return DevTools.versions();\n }\n\n // Sets up a log level at the backend\n public async setLogLevel(_tokenProps: IModelRpcProps, loggerCategory: string, logLevel: LogLevel): Promise<LogLevel | undefined> {\n return DevTools.setLogLevel(loggerCategory, logLevel);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DevToolsRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/DevToolsRpcImpl.ts"],"names":[],"mappings":";;;AAQA,oDAA0H;AAC1H,0CAA+D;AAE/D;;GAEG;AACH,MAAa,eAAgB,SAAQ,0BAAY;IACxC,MAAM,CAAC,QAAQ,KAAK,wBAAU,CAAC,YAAY,CAAC,kCAAoB,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAE5F,gDAAgD;IACzC,KAAK,CAAC,IAAI,CAAC,WAA2B;QAC3C,OAAO,mBAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,sCAAsC;IAC/B,KAAK,CAAC,KAAK,CAAC,WAA2B,EAAE,OAA6B;QAC3E,MAAM,KAAK,GAAG,mBAAQ,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,OAAO,KAAK,kCAAoB,CAAC,IAAI;YACvC,OAAO,KAAK,CAAC;QACf,MAAM,cAAc,GAAG,iCAAsB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACrE,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,uEAAuE;IAChE,KAAK,CAAC,QAAQ,CAAC,WAA2B;QAC/C,OAAO,mBAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED,qCAAqC;IAC9B,KAAK,CAAC,WAAW,CAAC,WAA2B,EAAE,cAAsB,EAAE,QAAkB;QAC9F,OAAO,mBAAQ,CAAC,WAAW,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC;CACF;AA1BD,0CA0BC","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\nimport { LogLevel } from \"@itwin/core-bentley\";\r\nimport { DevToolsRpcInterface, DevToolsStatsOptions, IModelRpcProps, RpcInterface, RpcManager } from \"@itwin/core-common\";\r\nimport { DevTools, DevToolsStatsFormatter } from \"../DevTools\";\r\n\r\n/** The backend implementation of WipRpcInterface.\r\n * @internal\r\n */\r\nexport class DevToolsRpcImpl extends RpcInterface implements DevToolsRpcInterface { // eslint-disable-line deprecation/deprecation\r\n public static register() { RpcManager.registerImpl(DevToolsRpcInterface, DevToolsRpcImpl); }\r\n\r\n // Returns true if the backend received the ping\r\n public async ping(_tokenProps: IModelRpcProps): Promise<boolean> {\r\n return DevTools.ping();\r\n }\r\n\r\n // Returns JSON object with statistics\r\n public async stats(_tokenProps: IModelRpcProps, options: DevToolsStatsOptions): Promise<any> {\r\n const stats = DevTools.stats();\r\n if (options === DevToolsStatsOptions.None)\r\n return stats;\r\n const formattedStats = DevToolsStatsFormatter.toFormattedJson(stats);\r\n return formattedStats;\r\n }\r\n\r\n // Returns JSON object with backend versions (application and iModelJs)\r\n public async versions(_tokenProps: IModelRpcProps): Promise<any> {\r\n return DevTools.versions();\r\n }\r\n\r\n // Sets up a log level at the backend\r\n public async setLogLevel(_tokenProps: IModelRpcProps, loggerCategory: string, logLevel: LogLevel): Promise<LogLevel | undefined> {\r\n return DevTools.setLogLevel(loggerCategory, logLevel);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelReadRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/IModelReadRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAE6B;AAC7B,oDAU4B;AAE5B,oEAAiE;AACjE,0CAA8C;AAC9C,wDAAqD;AACrD,0EAAuE;AACvE,wDAA+D;AAG/D,wDAAqD;AACrD,4CAA0C;AAC1C,4DAAyD;AACzD,+DAA4D;AAQ5D,MAAM,wBAAyB,SAAQ,iCAAuC;IAIrE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAA4B;QACtD,IAAI,CAAC,IAAI,CAAC,SAAS;YACjB,IAAI,CAAC,SAAS,GAAG,IAAI,wBAAwB,EAAE,CAAC;QAElD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;QACE,MAAM,OAAO,GAAG,KAAK,EAAE,KAA4B,EAAE,EAAE;YACrD,MAAM,EAAE,GAAG,MAAM,yCAAmB,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;YACzF,MAAM,WAAW,GAAG,IAAI,mDAAwB,CAAC,EAAE,CAAC,CAAC;YACrD,OAAO,WAAW,CAAC,wBAAwB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC,CAAC;QAEF,MAAM,SAAS,GAAG,CAAC,KAA4B,EAAE,EAAE;YACjD,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC;YAC/B,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YACxC,OAAO,GAAG,KAAK,CAAC,GAAG,IAAI,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AAE,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;CACF;AAhSD,8CAgSC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport {\n AccessToken, assert, BeDuration, BentleyStatus, CompressedId64Set, GuidString, Id64, Id64String, IModelStatus, Logger,\n} from \"@itwin/core-bentley\";\nimport {\n Code, CodeProps, CustomViewState3dCreatorOptions, CustomViewState3dProps, DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse,\n ElementLoadOptions, ElementLoadProps, ElementMeshRequestProps, ElementProps, EntityMetaData, EntityQueryParams, FontMapProps,\n GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeometryContainmentRequestProps, GeometryContainmentResponseProps,\n GeometrySummaryRequestProps, HydrateViewStateRequestProps, HydrateViewStateResponseProps, ImageSourceFormat, IModel, IModelConnectionProps,\n IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps, IModelRpcProps,\n MassPropertiesPerCandidateRequestProps, MassPropertiesPerCandidateResponseProps, MassPropertiesRequestProps, MassPropertiesResponseProps,\n ModelExtentsProps, ModelProps, NoContentError, RpcInterface, RpcManager, RpcPendingResponse, SnapRequestProps, SnapResponseProps,\n SubCategoryResultRow, SyncMode, TextureData, TextureLoadProps, ViewStateLoadProps, ViewStateProps,\n ViewStoreRpc,\n} from \"@itwin/core-common\";\nimport { Range3dProps } from \"@itwin/core-geometry\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { SpatialCategory } from \"../Category\";\nimport { ConcurrentQuery } from \"../ConcurrentQuery\";\nimport { CustomViewState3dCreator } from \"../CustomViewState3dCreator\";\nimport { generateGeometrySummaries } from \"../GeometrySummary\";\nimport { IModelDb } from \"../IModelDb\";\nimport { DictionaryModel } from \"../Model\";\nimport { PromiseMemoizer } from \"../PromiseMemoizer\";\nimport { RpcTrace } from \"../rpc/tracing\";\nimport { ViewStateHydrator } from \"../ViewStateHydrator\";\nimport { RpcBriefcaseUtility } from \"./RpcBriefcaseUtility\";\n\ninterface ViewStateRequestProps {\n accessToken: AccessToken;\n tokenProps: IModelRpcProps;\n options: CustomViewState3dCreatorOptions;\n}\n\nclass ViewStateRequestMemoizer extends PromiseMemoizer<CustomViewState3dProps> {\n private readonly _timeoutMs: number;\n private static _instance?: ViewStateRequestMemoizer;\n\n public static async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\n if (!this._instance)\n this._instance = new ViewStateRequestMemoizer();\n\n return this._instance.perform(props);\n }\n\n private constructor() {\n const memoize = async (props: ViewStateRequestProps) => {\n const db = await RpcBriefcaseUtility.findOpenIModel(props.accessToken, props.tokenProps);\n const viewCreator = new CustomViewState3dCreator(db);\n return viewCreator.getCustomViewState3dData(props.options);\n };\n\n const stringify = (props: ViewStateRequestProps) => {\n const token = props.tokenProps;\n const modelIds = props.options.modelIds;\n return `${token.key}-${token.iTwinId}-${token.iModelId}-${token.changeset?.id}:${modelIds}`;\n };\n\n super(memoize, stringify);\n this._timeoutMs = 20 * 1000;\n }\n\n private async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\n const memo = this.memoize(props);\n\n // Rejections must be caught so that the memoization entry is deleted.\n await BeDuration.race(this._timeoutMs, memo.promise).catch(() => undefined);\n\n if (memo.isPending)\n throw new RpcPendingResponse(); // eslint-disable-line deprecation/deprecation\n\n this.deleteMemoized(props);\n\n if (memo.isFulfilled) {\n assert(undefined !== memo.result);\n return memo.result;\n }\n\n assert(memo.isRejected);\n throw memo.error; // eslint-disable-line no-throw-literal\n }\n}\n\nfunction currentActivity() {\n return RpcTrace.expectCurrentActivity;\n}\n\nasync function getIModelForRpc(tokenProps: IModelRpcProps): Promise<IModelDb> {\n return RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\n}\n\n/** The backend implementation of IModelReadRpcInterface.\n * @internal\n */\nexport class IModelReadRpcImpl extends RpcInterface implements IModelReadRpcInterface { // eslint-disable-line deprecation/deprecation\n\n public static register() { RpcManager.registerImpl(IModelReadRpcInterface, IModelReadRpcImpl); }\n\n public async getConnectionProps(tokenProps: IModelRpcOpenProps): Promise<IModelConnectionProps> {\n return RpcBriefcaseUtility.openWithTimeout(currentActivity(), tokenProps, SyncMode.FixedVersion);\n }\n\n public async getCustomViewState3dData(tokenProps: IModelRpcProps, options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps> {\n const accessToken = currentActivity().accessToken;\n return ViewStateRequestMemoizer.perform({ accessToken, tokenProps, options });\n }\n\n public async hydrateViewState(tokenProps: IModelRpcProps, options: HydrateViewStateRequestProps): Promise<HydrateViewStateResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const viewHydrater = new ViewStateHydrator(iModelDb);\n return viewHydrater.getHydrateResponseProps(options);\n }\n\n public async querySubCategories(tokenProps: IModelRpcProps, compressedCategoryIds: CompressedId64Set): Promise<SubCategoryResultRow[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const decompressedIds = CompressedId64Set.decompressArray(compressedCategoryIds);\n return iModelDb.querySubCategories(decompressedIds);\n }\n\n public async queryRows(tokenProps: IModelRpcProps, request: DbQueryRequest): Promise<DbQueryResponse> {\n const iModelDb = await getIModelForRpc(tokenProps);\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\n request.usePrimaryConn = false;\n }\n return ConcurrentQuery.executeQueryRequest(iModelDb.nativeDb, request);\n }\n\n public async queryBlob(tokenProps: IModelRpcProps, request: DbBlobRequest): Promise<DbBlobResponse> {\n const iModelDb = await getIModelForRpc(tokenProps);\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\n request.usePrimaryConn = false;\n }\n return ConcurrentQuery.executeBlobRequest(iModelDb.nativeDb, request);\n }\n\n public async queryModelRanges(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<Range3dProps[]> {\n const results = await this.queryModelExtents(tokenProps, modelIds);\n if (results.length === 1 && results[0].status !== IModelStatus.Success)\n throw new IModelError(results[0].status, \"error querying model range\");\n\n return results.filter((x) => x.status === IModelStatus.Success).map((x) => x.extents);\n }\n\n public async queryModelExtents(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<ModelExtentsProps[]> {\n const iModel = await getIModelForRpc(tokenProps);\n return iModel.models.queryExtents(modelIds);\n }\n\n public async getModelProps(tokenProps: IModelRpcProps, modelIdsList: Id64String[]): Promise<ModelProps[]> {\n const modelIds = new Set(modelIdsList);\n const iModelDb = await getIModelForRpc(tokenProps);\n const modelJsonArray: ModelProps[] = [];\n for (const id of modelIds) {\n try {\n const modelProps = iModelDb.models.getModelJson({ id });\n modelJsonArray.push(modelProps);\n } catch (error) {\n if (modelIds.size === 1)\n throw error; // if they're asking for more than one model, don't throw on error.\n }\n }\n return modelJsonArray;\n }\n\n public async queryModelProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ModelProps[]> {\n const ids = await this.queryEntityIds(tokenProps, params);\n return this.getModelProps(tokenProps, [...ids]);\n }\n\n public async getElementProps(tokenProps: IModelRpcProps, elementIdsList: Id64String[]): Promise<ElementProps[]> {\n const elementIds = new Set(elementIdsList);\n const iModelDb = await getIModelForRpc(tokenProps);\n const elementProps: ElementProps[] = [];\n for (const id of elementIds) {\n try {\n elementProps.push(iModelDb.elements.getElementJson({ id }));\n } catch (error) {\n if (elementIds.size === 1)\n throw error; // if they're asking for more than one element, don't throw on error.\n }\n }\n return elementProps;\n }\n\n public async loadElementProps(tokenProps: IModelRpcProps, identifier: Id64String | GuidString | CodeProps, options?: ElementLoadOptions): Promise<ElementProps | undefined> {\n const props: ElementLoadProps = options ? { ...options } : {};\n if (typeof identifier === \"string\") {\n if (Id64.isId64(identifier))\n props.id = identifier;\n else\n props.federationGuid = identifier;\n } else {\n props.code = Code.fromJSON(identifier);\n }\n\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.elements.tryGetElementProps(props);\n }\n\n public async getGeometrySummary(tokenProps: IModelRpcProps, request: GeometrySummaryRequestProps): Promise<string> {\n const iModel = await getIModelForRpc(tokenProps);\n return generateGeometrySummaries(request, iModel);\n }\n\n public async queryElementProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ElementProps[]> {\n const ids = await this.queryEntityIds(tokenProps, params);\n const res = this.getElementProps(tokenProps, [...ids]);\n return res;\n }\n\n public async queryEntityIds(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<Id64String[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const res = iModelDb.queryEntityIds(params);\n return [...res];\n }\n\n public async getClassHierarchy(tokenProps: IModelRpcProps, classFullName: string): Promise<string[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const classArray: string[] = [];\n while (true) {\n const classMetaData: EntityMetaData = iModelDb.getMetaData(classFullName);\n classArray.push(classFullName);\n if (!classMetaData.baseClasses || classMetaData.baseClasses.length === 0)\n break;\n\n classFullName = classMetaData.baseClasses[0];\n }\n return classArray;\n }\n\n public async getAllCodeSpecs(tokenProps: IModelRpcProps): Promise<any[]> {\n const codeSpecs: any[] = [];\n const iModelDb = await getIModelForRpc(tokenProps);\n iModelDb.withPreparedStatement(\"SELECT ECInstanceId AS id, name, jsonProperties FROM BisCore.CodeSpec\", (statement) => {\n for (const row of statement)\n codeSpecs.push({ id: row.id, name: row.name, jsonProperties: JSON.parse(row.jsonProperties) });\n });\n return codeSpecs;\n }\n\n public async getViewStateData(tokenProps: IModelRpcProps, viewDefinitionId: string, options?: ViewStateLoadProps): Promise<ViewStateProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.views.getViewStateProps(viewDefinitionId, options);\n }\n\n public async readFontJson(tokenProps: IModelRpcProps): Promise<FontMapProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.nativeDb.readFontMap();\n }\n\n public async requestSnap(tokenProps: IModelRpcProps, sessionId: string, props: SnapRequestProps): Promise<SnapResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.requestSnap(sessionId, props);\n }\n\n public async cancelSnap(tokenProps: IModelRpcProps, sessionId: string): Promise<void> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.cancelSnap(sessionId);\n }\n\n public async getGeometryContainment(tokenProps: IModelRpcProps, props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getGeometryContainment(props);\n }\n\n public async getMassProperties(tokenProps: IModelRpcProps, props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getMassProperties(props);\n }\n\n public async getMassPropertiesPerCandidate(tokenProps: IModelRpcProps, props: MassPropertiesPerCandidateRequestProps): Promise<MassPropertiesPerCandidateResponseProps[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n\n const getSingleCandidateMassProperties = async (candidate: string) => {\n try {\n const massPropResults: MassPropertiesResponseProps[] = [];\n\n for (const op of props.operations) {\n const massProperties = await iModelDb.getMassProperties({ operation: op, candidates: [candidate] });\n massPropResults.push(massProperties);\n }\n\n let singleCandidateResult: MassPropertiesPerCandidateResponseProps = { status: BentleyStatus.ERROR, candidate };\n\n if (massPropResults.some((r) => r.status !== BentleyStatus.ERROR)) {\n singleCandidateResult.status = BentleyStatus.SUCCESS;\n for (const r of massPropResults.filter((mpr) => mpr.status !== BentleyStatus.ERROR)) {\n singleCandidateResult = { ...singleCandidateResult, ...r };\n }\n }\n\n return singleCandidateResult;\n } catch {\n return { status: BentleyStatus.ERROR, candidate };\n }\n };\n\n const promises: Promise<MassPropertiesPerCandidateResponseProps>[] = [];\n\n for (const candidate of CompressedId64Set.iterable(props.candidates)) {\n promises.push(getSingleCandidateMassProperties(candidate));\n }\n\n return Promise.all(promises);\n }\n\n public async getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const el = iModelDb.elements.getElement(id);\n return (el === undefined) ? [] : el.getToolTipMessage();\n }\n\n /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.\n * @deprecated in 3.x - Use queryViewThumbnail instead\n */\n public async getViewThumbnail(tokenProps: IModelRpcProps, viewId: string): Promise<Uint8Array> {\n const iModelDb = await getIModelForRpc(tokenProps);\n // eslint-disable-next-line deprecation/deprecation\n const thumbnail = iModelDb.views.getThumbnail(viewId);\n if (undefined === thumbnail || 0 === thumbnail.image.length)\n throw new NoContentError();\n\n const val = new Uint8Array(thumbnail.image.length + 16); // allocate a new buffer 16 bytes larger than the image size\n new Uint32Array(val.buffer, 0, 4).set([thumbnail.image.length, thumbnail.format === \"jpeg\" ? ImageSourceFormat.Jpeg : ImageSourceFormat.Png, thumbnail.width, thumbnail.height]); // Put the metadata in the first 16 bytes.\n val.set(thumbnail.image, 16); // put the image data at offset 16 after metadata\n return val;\n }\n\n public async getDefaultViewId(tokenProps: IModelRpcProps): Promise<Id64String> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const spec = { namespace: \"dgn_View\", name: \"DefaultView\" };\n const blob = iModelDb.queryFilePropertyBlob(spec);\n if (undefined === blob || 8 !== blob.length)\n return Id64.invalid;\n\n const view = new Uint32Array(blob.buffer);\n return Id64.fromUint32Pair(view[0], view[1]);\n }\n public async getSpatialCategoryId(tokenProps: IModelRpcProps, categoryName: string): Promise<Id64String | undefined> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const dictionary: DictionaryModel = iModelDb.models.getModel<DictionaryModel>(IModel.dictionaryId);\n return SpatialCategory.queryCategoryIdByName(iModelDb, dictionary.id, categoryName);\n }\n\n public async getIModelCoordinatesFromGeoCoordinates(tokenProps: IModelRpcProps, props: IModelCoordinatesRequestProps): Promise<IModelCoordinatesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getIModelCoordinatesFromGeoCoordinates(props);\n }\n\n public async getGeoCoordinatesFromIModelCoordinates(tokenProps: IModelRpcProps, props: GeoCoordinatesRequestProps): Promise<GeoCoordinatesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getGeoCoordinatesFromIModelCoordinates(props);\n }\n\n public async queryTextureData(tokenProps: IModelRpcProps, textureLoadProps: TextureLoadProps): Promise<TextureData | undefined> {\n const db = await getIModelForRpc(tokenProps);\n return db.queryTextureData(textureLoadProps);\n }\n\n public async generateElementMeshes(tokenProps: IModelRpcProps, props: ElementMeshRequestProps): Promise<Uint8Array> {\n const db = await getIModelForRpc(tokenProps);\n return db.nativeDb.generateElementMeshes(props);\n }\n\n /** @internal */\n public async callViewStore(tokenProps: IModelRpcProps, version: string, forWrite: boolean, methodName: string, ...args: any[]): Promise<any> {\n if (!RpcInterface.isVersionCompatible(ViewStoreRpc.version, version))\n throw new Error(\"ViewStoreRpc version mismatch\");\n\n const db = await getIModelForRpc(tokenProps);\n const viewStore = await db.views.accessViewStore({ accessLevel: forWrite ? \"write\" : \"read\", userToken: RpcTrace.currentActivity?.accessToken });\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const access = viewStore[forWrite ? \"writeLocker\" : \"reader\"] as any;\n\n const func = access[methodName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Illegal ViewStore RPC call \"${methodName}\"`);\n\n return func.call(access, ...args);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IModelReadRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/IModelReadRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAE6B;AAC7B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AE,CAAC,QAAQ,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,gBAAgB;IACT,KAAK,CAAC,aAAa,CAAC,UAA0B,EAAE,OAAe,EAAE,QAAiB,EAAE,UAAkB,EAAE,GAAG,IAAW;QAC3H,IAAI,CAAC,0BAAY,CAAC,mBAAmB,CAAC,0BAAY,CAAC,OAAO,EAAE,OAAO,CAAC;YAClE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAEnD,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,kBAAQ,CAAC,eAAe,EAAE,WAAW,EAAE,CAAC,CAAC;QACjJ,4EAA4E;QAC5E,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAQ,CAAC;QAErE,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAChC,IAAI,OAAO,IAAI,KAAK,UAAU;YAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,gBAAgB,EAAE,+BAA+B,UAAU,GAAG,CAAC,CAAC;QAErG,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;CACF;AAhSD,8CAgSC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module RpcInterface\r\n */\r\n\r\nimport {\r\n AccessToken, assert, BeDuration, BentleyStatus, CompressedId64Set, GuidString, Id64, Id64String, IModelStatus, Logger,\r\n} from \"@itwin/core-bentley\";\r\nimport {\r\n Code, CodeProps, CustomViewState3dCreatorOptions, CustomViewState3dProps, DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse,\r\n ElementLoadOptions, ElementLoadProps, ElementMeshRequestProps, ElementProps, EntityMetaData, EntityQueryParams, FontMapProps,\r\n GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeometryContainmentRequestProps, GeometryContainmentResponseProps,\r\n GeometrySummaryRequestProps, HydrateViewStateRequestProps, HydrateViewStateResponseProps, ImageSourceFormat, IModel, IModelConnectionProps,\r\n IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps, IModelRpcProps,\r\n MassPropertiesPerCandidateRequestProps, MassPropertiesPerCandidateResponseProps, MassPropertiesRequestProps, MassPropertiesResponseProps,\r\n ModelExtentsProps, ModelProps, NoContentError, RpcInterface, RpcManager, RpcPendingResponse, SnapRequestProps, SnapResponseProps,\r\n SubCategoryResultRow, SyncMode, TextureData, TextureLoadProps, ViewStateLoadProps, ViewStateProps,\r\n ViewStoreRpc,\r\n} from \"@itwin/core-common\";\r\nimport { Range3dProps } from \"@itwin/core-geometry\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { SpatialCategory } from \"../Category\";\r\nimport { ConcurrentQuery } from \"../ConcurrentQuery\";\r\nimport { CustomViewState3dCreator } from \"../CustomViewState3dCreator\";\r\nimport { generateGeometrySummaries } from \"../GeometrySummary\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { DictionaryModel } from \"../Model\";\r\nimport { PromiseMemoizer } from \"../PromiseMemoizer\";\r\nimport { RpcTrace } from \"../rpc/tracing\";\r\nimport { ViewStateHydrator } from \"../ViewStateHydrator\";\r\nimport { RpcBriefcaseUtility } from \"./RpcBriefcaseUtility\";\r\n\r\ninterface ViewStateRequestProps {\r\n accessToken: AccessToken;\r\n tokenProps: IModelRpcProps;\r\n options: CustomViewState3dCreatorOptions;\r\n}\r\n\r\nclass ViewStateRequestMemoizer extends PromiseMemoizer<CustomViewState3dProps> {\r\n private readonly _timeoutMs: number;\r\n private static _instance?: ViewStateRequestMemoizer;\r\n\r\n public static async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\r\n if (!this._instance)\r\n this._instance = new ViewStateRequestMemoizer();\r\n\r\n return this._instance.perform(props);\r\n }\r\n\r\n private constructor() {\r\n const memoize = async (props: ViewStateRequestProps) => {\r\n const db = await RpcBriefcaseUtility.findOpenIModel(props.accessToken, props.tokenProps);\r\n const viewCreator = new CustomViewState3dCreator(db);\r\n return viewCreator.getCustomViewState3dData(props.options);\r\n };\r\n\r\n const stringify = (props: ViewStateRequestProps) => {\r\n const token = props.tokenProps;\r\n const modelIds = props.options.modelIds;\r\n return `${token.key}-${token.iTwinId}-${token.iModelId}-${token.changeset?.id}:${modelIds}`;\r\n };\r\n\r\n super(memoize, stringify);\r\n this._timeoutMs = 20 * 1000;\r\n }\r\n\r\n private async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\r\n const memo = this.memoize(props);\r\n\r\n // Rejections must be caught so that the memoization entry is deleted.\r\n await BeDuration.race(this._timeoutMs, memo.promise).catch(() => undefined);\r\n\r\n if (memo.isPending)\r\n throw new RpcPendingResponse(); // eslint-disable-line deprecation/deprecation\r\n\r\n this.deleteMemoized(props);\r\n\r\n if (memo.isFulfilled) {\r\n assert(undefined !== memo.result);\r\n return memo.result;\r\n }\r\n\r\n assert(memo.isRejected);\r\n throw memo.error; // eslint-disable-line no-throw-literal\r\n }\r\n}\r\n\r\nfunction currentActivity() {\r\n return RpcTrace.expectCurrentActivity;\r\n}\r\n\r\nasync function getIModelForRpc(tokenProps: IModelRpcProps): Promise<IModelDb> {\r\n return RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n}\r\n\r\n/** The backend implementation of IModelReadRpcInterface.\r\n * @internal\r\n */\r\nexport class IModelReadRpcImpl extends RpcInterface implements IModelReadRpcInterface { // eslint-disable-line deprecation/deprecation\r\n\r\n public static register() { RpcManager.registerImpl(IModelReadRpcInterface, IModelReadRpcImpl); }\r\n\r\n public async getConnectionProps(tokenProps: IModelRpcOpenProps): Promise<IModelConnectionProps> {\r\n return RpcBriefcaseUtility.openWithTimeout(currentActivity(), tokenProps, SyncMode.FixedVersion);\r\n }\r\n\r\n public async getCustomViewState3dData(tokenProps: IModelRpcProps, options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps> {\r\n const accessToken = currentActivity().accessToken;\r\n return ViewStateRequestMemoizer.perform({ accessToken, tokenProps, options });\r\n }\r\n\r\n public async hydrateViewState(tokenProps: IModelRpcProps, options: HydrateViewStateRequestProps): Promise<HydrateViewStateResponseProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const viewHydrater = new ViewStateHydrator(iModelDb);\r\n return viewHydrater.getHydrateResponseProps(options);\r\n }\r\n\r\n public async querySubCategories(tokenProps: IModelRpcProps, compressedCategoryIds: CompressedId64Set): Promise<SubCategoryResultRow[]> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const decompressedIds = CompressedId64Set.decompressArray(compressedCategoryIds);\r\n return iModelDb.querySubCategories(decompressedIds);\r\n }\r\n\r\n public async queryRows(tokenProps: IModelRpcProps, request: DbQueryRequest): Promise<DbQueryResponse> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\r\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\r\n request.usePrimaryConn = false;\r\n }\r\n return ConcurrentQuery.executeQueryRequest(iModelDb.nativeDb, request);\r\n }\r\n\r\n public async queryBlob(tokenProps: IModelRpcProps, request: DbBlobRequest): Promise<DbBlobResponse> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\r\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\r\n request.usePrimaryConn = false;\r\n }\r\n return ConcurrentQuery.executeBlobRequest(iModelDb.nativeDb, request);\r\n }\r\n\r\n public async queryModelRanges(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<Range3dProps[]> {\r\n const results = await this.queryModelExtents(tokenProps, modelIds);\r\n if (results.length === 1 && results[0].status !== IModelStatus.Success)\r\n throw new IModelError(results[0].status, \"error querying model range\");\r\n\r\n return results.filter((x) => x.status === IModelStatus.Success).map((x) => x.extents);\r\n }\r\n\r\n public async queryModelExtents(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<ModelExtentsProps[]> {\r\n const iModel = await getIModelForRpc(tokenProps);\r\n return iModel.models.queryExtents(modelIds);\r\n }\r\n\r\n public async getModelProps(tokenProps: IModelRpcProps, modelIdsList: Id64String[]): Promise<ModelProps[]> {\r\n const modelIds = new Set(modelIdsList);\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const modelJsonArray: ModelProps[] = [];\r\n for (const id of modelIds) {\r\n try {\r\n const modelProps = iModelDb.models.getModelJson({ id });\r\n modelJsonArray.push(modelProps);\r\n } catch (error) {\r\n if (modelIds.size === 1)\r\n throw error; // if they're asking for more than one model, don't throw on error.\r\n }\r\n }\r\n return modelJsonArray;\r\n }\r\n\r\n public async queryModelProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ModelProps[]> {\r\n const ids = await this.queryEntityIds(tokenProps, params);\r\n return this.getModelProps(tokenProps, [...ids]);\r\n }\r\n\r\n public async getElementProps(tokenProps: IModelRpcProps, elementIdsList: Id64String[]): Promise<ElementProps[]> {\r\n const elementIds = new Set(elementIdsList);\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const elementProps: ElementProps[] = [];\r\n for (const id of elementIds) {\r\n try {\r\n elementProps.push(iModelDb.elements.getElementJson({ id }));\r\n } catch (error) {\r\n if (elementIds.size === 1)\r\n throw error; // if they're asking for more than one element, don't throw on error.\r\n }\r\n }\r\n return elementProps;\r\n }\r\n\r\n public async loadElementProps(tokenProps: IModelRpcProps, identifier: Id64String | GuidString | CodeProps, options?: ElementLoadOptions): Promise<ElementProps | undefined> {\r\n const props: ElementLoadProps = options ? { ...options } : {};\r\n if (typeof identifier === \"string\") {\r\n if (Id64.isId64(identifier))\r\n props.id = identifier;\r\n else\r\n props.federationGuid = identifier;\r\n } else {\r\n props.code = Code.fromJSON(identifier);\r\n }\r\n\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.elements.tryGetElementProps(props);\r\n }\r\n\r\n public async getGeometrySummary(tokenProps: IModelRpcProps, request: GeometrySummaryRequestProps): Promise<string> {\r\n const iModel = await getIModelForRpc(tokenProps);\r\n return generateGeometrySummaries(request, iModel);\r\n }\r\n\r\n public async queryElementProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ElementProps[]> {\r\n const ids = await this.queryEntityIds(tokenProps, params);\r\n const res = this.getElementProps(tokenProps, [...ids]);\r\n return res;\r\n }\r\n\r\n public async queryEntityIds(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<Id64String[]> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const res = iModelDb.queryEntityIds(params);\r\n return [...res];\r\n }\r\n\r\n public async getClassHierarchy(tokenProps: IModelRpcProps, classFullName: string): Promise<string[]> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const classArray: string[] = [];\r\n while (true) {\r\n const classMetaData: EntityMetaData = iModelDb.getMetaData(classFullName);\r\n classArray.push(classFullName);\r\n if (!classMetaData.baseClasses || classMetaData.baseClasses.length === 0)\r\n break;\r\n\r\n classFullName = classMetaData.baseClasses[0];\r\n }\r\n return classArray;\r\n }\r\n\r\n public async getAllCodeSpecs(tokenProps: IModelRpcProps): Promise<any[]> {\r\n const codeSpecs: any[] = [];\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n iModelDb.withPreparedStatement(\"SELECT ECInstanceId AS id, name, jsonProperties FROM BisCore.CodeSpec\", (statement) => {\r\n for (const row of statement)\r\n codeSpecs.push({ id: row.id, name: row.name, jsonProperties: JSON.parse(row.jsonProperties) });\r\n });\r\n return codeSpecs;\r\n }\r\n\r\n public async getViewStateData(tokenProps: IModelRpcProps, viewDefinitionId: string, options?: ViewStateLoadProps): Promise<ViewStateProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.views.getViewStateProps(viewDefinitionId, options);\r\n }\r\n\r\n public async readFontJson(tokenProps: IModelRpcProps): Promise<FontMapProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.nativeDb.readFontMap();\r\n }\r\n\r\n public async requestSnap(tokenProps: IModelRpcProps, sessionId: string, props: SnapRequestProps): Promise<SnapResponseProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.requestSnap(sessionId, props);\r\n }\r\n\r\n public async cancelSnap(tokenProps: IModelRpcProps, sessionId: string): Promise<void> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.cancelSnap(sessionId);\r\n }\r\n\r\n public async getGeometryContainment(tokenProps: IModelRpcProps, props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.getGeometryContainment(props);\r\n }\r\n\r\n public async getMassProperties(tokenProps: IModelRpcProps, props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.getMassProperties(props);\r\n }\r\n\r\n public async getMassPropertiesPerCandidate(tokenProps: IModelRpcProps, props: MassPropertiesPerCandidateRequestProps): Promise<MassPropertiesPerCandidateResponseProps[]> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n\r\n const getSingleCandidateMassProperties = async (candidate: string) => {\r\n try {\r\n const massPropResults: MassPropertiesResponseProps[] = [];\r\n\r\n for (const op of props.operations) {\r\n const massProperties = await iModelDb.getMassProperties({ operation: op, candidates: [candidate] });\r\n massPropResults.push(massProperties);\r\n }\r\n\r\n let singleCandidateResult: MassPropertiesPerCandidateResponseProps = { status: BentleyStatus.ERROR, candidate };\r\n\r\n if (massPropResults.some((r) => r.status !== BentleyStatus.ERROR)) {\r\n singleCandidateResult.status = BentleyStatus.SUCCESS;\r\n for (const r of massPropResults.filter((mpr) => mpr.status !== BentleyStatus.ERROR)) {\r\n singleCandidateResult = { ...singleCandidateResult, ...r };\r\n }\r\n }\r\n\r\n return singleCandidateResult;\r\n } catch {\r\n return { status: BentleyStatus.ERROR, candidate };\r\n }\r\n };\r\n\r\n const promises: Promise<MassPropertiesPerCandidateResponseProps>[] = [];\r\n\r\n for (const candidate of CompressedId64Set.iterable(props.candidates)) {\r\n promises.push(getSingleCandidateMassProperties(candidate));\r\n }\r\n\r\n return Promise.all(promises);\r\n }\r\n\r\n public async getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const el = iModelDb.elements.getElement(id);\r\n return (el === undefined) ? [] : el.getToolTipMessage();\r\n }\r\n\r\n /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.\r\n * @deprecated in 3.x - Use queryViewThumbnail instead\r\n */\r\n public async getViewThumbnail(tokenProps: IModelRpcProps, viewId: string): Promise<Uint8Array> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n // eslint-disable-next-line deprecation/deprecation\r\n const thumbnail = iModelDb.views.getThumbnail(viewId);\r\n if (undefined === thumbnail || 0 === thumbnail.image.length)\r\n throw new NoContentError();\r\n\r\n const val = new Uint8Array(thumbnail.image.length + 16); // allocate a new buffer 16 bytes larger than the image size\r\n new Uint32Array(val.buffer, 0, 4).set([thumbnail.image.length, thumbnail.format === \"jpeg\" ? ImageSourceFormat.Jpeg : ImageSourceFormat.Png, thumbnail.width, thumbnail.height]); // Put the metadata in the first 16 bytes.\r\n val.set(thumbnail.image, 16); // put the image data at offset 16 after metadata\r\n return val;\r\n }\r\n\r\n public async getDefaultViewId(tokenProps: IModelRpcProps): Promise<Id64String> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const spec = { namespace: \"dgn_View\", name: \"DefaultView\" };\r\n const blob = iModelDb.queryFilePropertyBlob(spec);\r\n if (undefined === blob || 8 !== blob.length)\r\n return Id64.invalid;\r\n\r\n const view = new Uint32Array(blob.buffer);\r\n return Id64.fromUint32Pair(view[0], view[1]);\r\n }\r\n public async getSpatialCategoryId(tokenProps: IModelRpcProps, categoryName: string): Promise<Id64String | undefined> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const dictionary: DictionaryModel = iModelDb.models.getModel<DictionaryModel>(IModel.dictionaryId);\r\n return SpatialCategory.queryCategoryIdByName(iModelDb, dictionary.id, categoryName);\r\n }\r\n\r\n public async getIModelCoordinatesFromGeoCoordinates(tokenProps: IModelRpcProps, props: IModelCoordinatesRequestProps): Promise<IModelCoordinatesResponseProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.getIModelCoordinatesFromGeoCoordinates(props);\r\n }\r\n\r\n public async getGeoCoordinatesFromIModelCoordinates(tokenProps: IModelRpcProps, props: GeoCoordinatesRequestProps): Promise<GeoCoordinatesResponseProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.getGeoCoordinatesFromIModelCoordinates(props);\r\n }\r\n\r\n public async queryTextureData(tokenProps: IModelRpcProps, textureLoadProps: TextureLoadProps): Promise<TextureData | undefined> {\r\n const db = await getIModelForRpc(tokenProps);\r\n return db.queryTextureData(textureLoadProps);\r\n }\r\n\r\n public async generateElementMeshes(tokenProps: IModelRpcProps, props: ElementMeshRequestProps): Promise<Uint8Array> {\r\n const db = await getIModelForRpc(tokenProps);\r\n return db.nativeDb.generateElementMeshes(props);\r\n }\r\n\r\n /** @internal */\r\n public async callViewStore(tokenProps: IModelRpcProps, version: string, forWrite: boolean, methodName: string, ...args: any[]): Promise<any> {\r\n if (!RpcInterface.isVersionCompatible(ViewStoreRpc.version, version))\r\n throw new Error(\"ViewStoreRpc version mismatch\");\r\n\r\n const db = await getIModelForRpc(tokenProps);\r\n const viewStore = await db.views.accessViewStore({ accessLevel: forWrite ? \"write\" : \"read\", userToken: RpcTrace.currentActivity?.accessToken });\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n const access = viewStore[forWrite ? \"writeLocker\" : \"reader\"] as any;\r\n\r\n const func = access[methodName];\r\n if (typeof func !== \"function\")\r\n throw new IModelError(IModelStatus.FunctionNotFound, `Illegal ViewStore RPC call \"${methodName}\"`);\r\n\r\n return func.call(access, ...args);\r\n }\r\n}\r\n"]}
|