@itwin/core-backend 5.9.0-dev.9 → 5.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -1
- package/lib/cjs/BriefcaseManager.d.ts +14 -62
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +29 -159
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +4 -4
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts +9 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +7 -1
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChangesetReader.d.ts +186 -0
- package/lib/cjs/ChangesetReader.d.ts.map +1 -0
- package/lib/cjs/ChangesetReader.js +372 -0
- package/lib/cjs/ChangesetReader.js.map +1 -0
- package/lib/cjs/ChangesetReaderTypes.d.ts +120 -0
- package/lib/cjs/ChangesetReaderTypes.d.ts.map +1 -0
- package/lib/cjs/ChangesetReaderTypes.js +23 -0
- package/lib/cjs/ChangesetReaderTypes.js.map +1 -0
- package/lib/cjs/CloudSqlite.d.ts +1 -1
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +68 -13
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeSpecs.d.ts +3 -3
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +2 -2
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/EditTxn.d.ts +55 -1
- package/lib/cjs/EditTxn.d.ts.map +1 -1
- package/lib/cjs/EditTxn.js +43 -1
- package/lib/cjs/EditTxn.js.map +1 -1
- package/lib/cjs/Element.d.ts +79 -10
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +38 -2
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +1 -1
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts +5 -5
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/ExternalSource.d.ts +2 -2
- package/lib/cjs/ExternalSource.d.ts.map +1 -1
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/GeographicCRSServices.d.ts +15 -0
- package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
- package/lib/cjs/GeographicCRSServices.js +13 -4
- package/lib/cjs/GeographicCRSServices.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +31 -23
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +44 -25
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
- package/lib/cjs/IModelJsFs.d.ts +2 -0
- package/lib/cjs/IModelJsFs.d.ts.map +1 -1
- package/lib/cjs/IModelJsFs.js +14 -0
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.d.ts.map +1 -1
- package/lib/cjs/IpcHost.js +20 -9
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.d.ts +6 -6
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/Material.d.ts +1 -1
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +40 -6
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +24 -0
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/PartialChangeUnifier.d.ts +77 -0
- package/lib/cjs/PartialChangeUnifier.d.ts.map +1 -0
- package/lib/cjs/PartialChangeUnifier.js +234 -0
- package/lib/cjs/PartialChangeUnifier.js.map +1 -0
- package/lib/cjs/Relationship.d.ts +10 -10
- package/lib/cjs/Relationship.js +6 -6
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/SheetIndex.d.ts +4 -4
- package/lib/cjs/SheetIndex.d.ts.map +1 -1
- package/lib/cjs/SheetIndex.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js +1 -1
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/Texture.d.ts +1 -1
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +17 -0
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +120 -13
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +25 -13
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +77 -25
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStore.d.ts.map +1 -1
- package/lib/cjs/ViewStore.js +63 -21
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/core-backend.d.ts +3 -0
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +3 -0
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/GenericElements.d.ts +2 -2
- package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.d.ts +2 -2
- package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/IntegrityCheck.d.ts +10 -10
- package/lib/cjs/internal/IntegrityCheck.js +22 -22
- package/lib/cjs/internal/IntegrityCheck.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.d.ts +6 -4
- package/lib/cjs/workspace/Settings.d.ts.map +1 -1
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/esm/BriefcaseManager.d.ts +14 -62
- package/lib/esm/BriefcaseManager.d.ts.map +1 -1
- package/lib/esm/BriefcaseManager.js +30 -160
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/Category.d.ts +4 -4
- package/lib/esm/Category.js.map +1 -1
- package/lib/esm/ChangesetECAdaptor.d.ts +9 -1
- package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/esm/ChangesetECAdaptor.js +7 -1
- package/lib/esm/ChangesetECAdaptor.js.map +1 -1
- package/lib/esm/ChangesetReader.d.ts +186 -0
- package/lib/esm/ChangesetReader.d.ts.map +1 -0
- package/lib/esm/ChangesetReader.js +368 -0
- package/lib/esm/ChangesetReader.js.map +1 -0
- package/lib/esm/ChangesetReaderTypes.d.ts +120 -0
- package/lib/esm/ChangesetReaderTypes.d.ts.map +1 -0
- package/lib/esm/ChangesetReaderTypes.js +20 -0
- package/lib/esm/ChangesetReaderTypes.js.map +1 -0
- package/lib/esm/CloudSqlite.d.ts +1 -1
- package/lib/esm/CloudSqlite.d.ts.map +1 -1
- package/lib/esm/CloudSqlite.js +69 -14
- package/lib/esm/CloudSqlite.js.map +1 -1
- package/lib/esm/CodeSpecs.d.ts +3 -3
- package/lib/esm/CodeSpecs.js.map +1 -1
- package/lib/esm/ConcurrentQuery.js.map +1 -1
- package/lib/esm/DevTools.js.map +1 -1
- package/lib/esm/DisplayStyle.d.ts +2 -2
- package/lib/esm/DisplayStyle.js.map +1 -1
- package/lib/esm/ECSqlStatement.d.ts.map +1 -1
- package/lib/esm/ECSqlStatement.js.map +1 -1
- package/lib/esm/EditTxn.d.ts +55 -1
- package/lib/esm/EditTxn.d.ts.map +1 -1
- package/lib/esm/EditTxn.js +43 -1
- package/lib/esm/EditTxn.js.map +1 -1
- package/lib/esm/Element.d.ts +79 -10
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +38 -2
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/ElementAspect.d.ts +1 -1
- package/lib/esm/ElementAspect.js.map +1 -1
- package/lib/esm/ElementGraphics.js.map +1 -1
- package/lib/esm/ElementTreeWalker.d.ts +5 -5
- package/lib/esm/ElementTreeWalker.js.map +1 -1
- package/lib/esm/ExternalSource.d.ts +2 -2
- package/lib/esm/ExternalSource.d.ts.map +1 -1
- package/lib/esm/ExternalSource.js.map +1 -1
- package/lib/esm/GeographicCRSServices.d.ts +15 -0
- package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
- package/lib/esm/GeographicCRSServices.js +12 -4
- package/lib/esm/GeographicCRSServices.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +31 -23
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +45 -26
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
- package/lib/esm/IModelJsFs.d.ts +2 -0
- package/lib/esm/IModelJsFs.d.ts.map +1 -1
- package/lib/esm/IModelJsFs.js +14 -0
- package/lib/esm/IModelJsFs.js.map +1 -1
- package/lib/esm/IpcHost.d.ts.map +1 -1
- package/lib/esm/IpcHost.js +20 -9
- package/lib/esm/IpcHost.js.map +1 -1
- package/lib/esm/LineStyle.d.ts +6 -6
- package/lib/esm/LineStyle.js.map +1 -1
- package/lib/esm/Material.d.ts +1 -1
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Model.d.ts +40 -6
- package/lib/esm/Model.d.ts.map +1 -1
- package/lib/esm/Model.js +24 -0
- package/lib/esm/Model.js.map +1 -1
- package/lib/esm/PartialChangeUnifier.d.ts +77 -0
- package/lib/esm/PartialChangeUnifier.d.ts.map +1 -0
- package/lib/esm/PartialChangeUnifier.js +230 -0
- package/lib/esm/PartialChangeUnifier.js.map +1 -0
- package/lib/esm/Relationship.d.ts +10 -10
- package/lib/esm/Relationship.js +6 -6
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/SheetIndex.d.ts +4 -4
- package/lib/esm/SheetIndex.d.ts.map +1 -1
- package/lib/esm/SheetIndex.js.map +1 -1
- package/lib/esm/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/esm/SqliteChangesetReader.js +1 -1
- package/lib/esm/SqliteChangesetReader.js.map +1 -1
- package/lib/esm/Texture.d.ts +1 -1
- package/lib/esm/Texture.js.map +1 -1
- package/lib/esm/TxnManager.d.ts +17 -0
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +121 -14
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewDefinition.d.ts +25 -13
- package/lib/esm/ViewDefinition.d.ts.map +1 -1
- package/lib/esm/ViewDefinition.js +78 -26
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/ViewStore.d.ts.map +1 -1
- package/lib/esm/ViewStore.js +64 -22
- package/lib/esm/ViewStore.js.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/esm/core-backend.d.ts +3 -0
- package/lib/esm/core-backend.d.ts.map +1 -1
- package/lib/esm/core-backend.js +3 -0
- package/lib/esm/core-backend.js.map +1 -1
- package/lib/esm/domains/FunctionalElements.d.ts +1 -1
- package/lib/esm/domains/FunctionalElements.d.ts.map +1 -1
- package/lib/esm/domains/FunctionalElements.js.map +1 -1
- package/lib/esm/domains/GenericElements.d.ts +2 -2
- package/lib/esm/domains/GenericElements.d.ts.map +1 -1
- package/lib/esm/domains/GenericElements.js.map +1 -1
- package/lib/esm/internal/ChannelAdmin.d.ts +2 -2
- package/lib/esm/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/esm/internal/ChannelAdmin.js.map +1 -1
- package/lib/esm/internal/IntegrityCheck.d.ts +10 -10
- package/lib/esm/internal/IntegrityCheck.js +22 -22
- package/lib/esm/internal/IntegrityCheck.js.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/esm/test/ElementDrivesElement.test.d.ts.map +1 -1
- package/lib/esm/test/ElementDrivesElement.test.js.map +1 -1
- package/lib/esm/test/IModelTestUtils.d.ts +1 -0
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
- package/lib/esm/test/IModelTestUtils.js +5 -0
- package/lib/esm/test/IModelTestUtils.js.map +1 -1
- package/lib/esm/test/IpcHost.test.js +112 -0
- package/lib/esm/test/IpcHost.test.js.map +1 -1
- package/lib/esm/test/annotations/LeaderGeometry.test.js +0 -1
- package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
- package/lib/esm/test/element/DeleteDefinitionElements.test.js +819 -26
- package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
- package/lib/esm/test/element/ElementRoundTrip.test.js +144 -3
- package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
- package/lib/esm/test/element/SheetInformationAspect.test.js.map +1 -1
- package/lib/esm/test/hubaccess/Rebase.test.js +1 -1
- package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
- package/lib/esm/test/hubaccess/SemanticRebase.test.js +2242 -68
- package/lib/esm/test/hubaccess/SemanticRebase.test.js.map +1 -1
- package/lib/esm/test/imodel/IModel.test.js +1 -1
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/imodel/SchemaXmlImport.test.js +64 -0
- package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
- package/lib/esm/test/misc/GeoServices.test.js +43 -1
- package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
- package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +4184 -1654
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/DeleteElements.test.d.ts +2 -0
- package/lib/esm/test/standalone/DeleteElements.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/DeleteElements.test.js +625 -0
- package/lib/esm/test/standalone/DeleteElements.test.js.map +1 -0
- package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
- package/lib/esm/test/standalone/IntegrityCheck.test.js +214 -5
- package/lib/esm/test/standalone/IntegrityCheck.test.js.map +1 -1
- package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.d.ts +2 -0
- package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.js +1862 -0
- package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.js.map +1 -0
- package/lib/esm/test/standalone/TxnManager.test.js +90 -0
- package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
- package/lib/esm/test/standalone/ViewDefinition.test.js +18 -7
- package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
- package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
- package/lib/esm/workspace/Settings.d.ts +6 -4
- package/lib/esm/workspace/Settings.d.ts.map +1 -1
- package/lib/esm/workspace/Settings.js.map +1 -1
- package/package.json +15 -15
|
@@ -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;AACzE,wCAAqC;AACrC,iDAAmD;AAEnD;;GAEG;AACH,MAAsB,eAAgB,SAAQ,4BAAkB;IACvD,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;AALD,0CAKC;AAED;;GAEG;AACH,MAAa,SAAU,SAAQ,eAAe;IACrC,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;AALD,8BAKC;AAED;;GAEG;AACH,MAAa,mBAAoB,SAAQ,eAAe;IAC/C,MAAM,KAAc,SAAS,KAAa,OAAO,qBAAqB,CAAC,CAAC,CAAC;IAChF,YAAmB,KAA+B,EAAE,MAAgB;QAClE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AALD,kDAKC;AAED;;GAEG;AACH,MAAsB,OAAQ,SAAQ,eAAe;IAC5C,MAAM,KAAc,SAAS,KAAa,OAAO,SAAS,CAAC,CAAC,CAAC;IACpE,YAAmB,KAAmB,EAAE,MAAgB;QACtD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AALD,0BAKC;AAED;;GAEG;AACH,MAAa,cAAe,SAAQ,OAAO;IAClC,MAAM,KAAc,SAAS,KAAa,OAAO,gBAAgB,CAAC,CAAC,CAAC;IAC3E,YAAmB,KAAmB,EAAE,MAAg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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;AALD,0DAKC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,sBAAY;IAC5C,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;AALD,kDAKC;AAED;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,yBAAe;IAClD,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;AALD,wDAKC","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\";\nimport { EditTxn } from \"../EditTxn\";\nimport { _implicitTxn } from \"../internal/Symbols\";\n\n/** A graphical detailing symbol that is placed on a [[Drawing]] or [[Sheet]].\n * @public\n */\nexport abstract class DetailingSymbol extends GraphicalElement2d {\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 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 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 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 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 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 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 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 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 using an explicit transaction.\n * @param txn The EditTxn used to perform inserts.\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 * @beta\n */\n public static insert(txn: EditTxn, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String;\n /** @deprecated Use GenericGraphicalModel3d.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String;\n public static insert(txnOrDb: EditTxn | IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\n const iModelDb = txn.iModel;\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 = txn.insertElement(partitionProps);\n const modelProps: GeometricModel3dProps = {\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n isPlanProjection,\n };\n return txn.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 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 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 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 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 using an explicit transaction.\n * @param txn The EditTxn used to perform inserts.\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 * @beta\n */\n public static insert(txn: EditTxn, parentSubjectId: Id64String, name: string): Id64String;\n /** @deprecated Use GroupModel.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String;\n public static insert(txnOrDb: EditTxn | IModelDb, parentSubjectId: Id64String, name: string): Id64String {\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\n const partitionId = txn.insertElement({\n classFullName: GroupInformationPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: GroupInformationPartition.createCode(txn.iModel, parentSubjectId, name),\n });\n return txn.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 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 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 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 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 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":["../../../src/domains/GenericElements.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;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K,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AALD,0DAKC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,sBAAY;IAC5C,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;AALD,kDAKC;AAED;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,yBAAe;IAClD,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;AALD,wDAKC","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\";\nimport { EditTxn } from \"../EditTxn\";\nimport { _implicitTxn } from \"../internal/Symbols\";\n\n/** A graphical detailing symbol that is placed on a [[Drawing]] or [[Sheet]].\n * @public\n */\nexport abstract class DetailingSymbol extends GraphicalElement2d {\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 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 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 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 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 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 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 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 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 using an explicit transaction.\n * @param txn The EditTxn used to perform inserts.\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 * @beta\n */\n public static insert(txn: EditTxn, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String;\n /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use GenericGraphicalModel3d.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String;\n public static insert(txnOrDb: EditTxn | IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\n const iModelDb = txn.iModel;\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 = txn.insertElement(partitionProps);\n const modelProps: GeometricModel3dProps = {\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n isPlanProjection,\n };\n return txn.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 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 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 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 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 using an explicit transaction.\n * @param txn The EditTxn used to perform inserts.\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 * @beta\n */\n public static insert(txn: EditTxn, parentSubjectId: Id64String, name: string): Id64String;\n /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use GroupModel.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help. */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String;\n public static insert(txnOrDb: EditTxn | IModelDb, parentSubjectId: Id64String, name: string): Id64String {\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\n const partitionId = txn.insertElement({\n classFullName: GroupInformationPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: GroupInformationPartition.createCode(txn.iModel, parentSubjectId, name),\n });\n return txn.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 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 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 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 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 public static override get className(): string { return \"GraphicalType2d\"; }\n public constructor(props: TypeDefinitionElementProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n"]}
|
|
@@ -23,7 +23,7 @@ declare class ChannelAdmin implements ChannelControl {
|
|
|
23
23
|
channelKey: ChannelKey;
|
|
24
24
|
txn: EditTxn;
|
|
25
25
|
}): void;
|
|
26
|
-
/** @deprecated Use makeChannelRoot and supply `txn`. */
|
|
26
|
+
/** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use makeChannelRoot and supply `txn`. */
|
|
27
27
|
makeChannelRoot(args: {
|
|
28
28
|
elementId: Id64String;
|
|
29
29
|
channelKey: ChannelKey;
|
|
@@ -35,7 +35,7 @@ declare class ChannelAdmin implements ChannelControl {
|
|
|
35
35
|
description?: string;
|
|
36
36
|
txn: EditTxn;
|
|
37
37
|
}): Id64String;
|
|
38
|
-
/** @deprecated Use insertChannelSubject and supply `txn`. */
|
|
38
|
+
/** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use insertChannelSubject and supply `txn`. */
|
|
39
39
|
insertChannelSubject(args: {
|
|
40
40
|
subjectName: string;
|
|
41
41
|
channelKey: ChannelKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelAdmin.d.ts","sourceRoot":"","sources":["../../../src/internal/ChannelAdmin.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAY,UAAU,EAAgB,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAyB,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE7G,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAA2B,cAAc,EAAE,MAAM,WAAW,CAAC;AAG/F,cAAM,YAAa,YAAW,cAAc;IAQvB,OAAO,CAAC,OAAO;IAPlC,gBAAuB,gBAAgB,2BAA2B;IAElE,SAAgB,CAAC,yBAAyB,CAAC,YAAa;IACxD,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,cAAc,CAAyB;IAC/C,OAAO,CAAC,aAAa,CAAqC;gBAE/B,OAAO,EAAE,QAAQ;IAMrC,iBAAiB,CAAC,UAAU,EAAE,UAAU;IAKxC,oBAAoB,CAAC,UAAU,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a,EAAE,WAAW,OAAO,CAAC,UAAU,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QAEpH,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC;YACpD,iCAAmB,CAAC,UAAU,CAAC,aAAa,EAAE,qBAAqB,OAAO,CAAC,UAAU,SAAS,OAAO,CAAC,WAAW,OAAO,OAAO,CAAC,SAAS,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QAElL,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,UAAU,KAAK,+BAAc,CAAC,iBAAiB;YACvG,iCAAmB,CAAC,UAAU,CAAC,aAAa,EAAE,WAAW,OAAO,CAAC,UAAU,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QAE/G,MAAM,OAAO,GAA0B;YACrC,MAAM;YACN,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,IAAI;SACL,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,iCAAmB,CAAC,UAAU,CAAC,KAAK,EAAE,wBAAwB,EAAE,WAAW,OAAO,CAAC,UAAU,oBAAoB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACpI,CAAC;IACH,CAAC;;AAGH,SAAgB,oBAAoB,CAAC,MAAgB;IACnD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAClC,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 Elements\n */\n\nimport { DbResult, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { ChannelControlError, ChannelRootAspectProps, IModel, IModelError } from \"@itwin/core-common\";\nimport { ChannelControl, ChannelKey, ChannelUpgradeContext, ChannelUpgradeOptions } from \"../ChannelControl\";\nimport { Subject } from \"../Element\";\nimport { IModelDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\nimport { ElementOwnsChannelRootAspect } from \"../NavigationRelationship\";\nimport { EditTxn } from \"../EditTxn\";\nimport { _implementationProhibited, _implicitTxn, _nativeDb, _verifyChannel } from \"./Symbols\";\nimport * as semver from \"semver\";\n\nclass ChannelAdmin implements ChannelControl {\n public static readonly channelClassName = \"bis:ChannelRootAspect\";\n\n public readonly [_implementationProhibited] = undefined;\n private _allowedChannels = new Set<ChannelKey>();\n private _allowedModels = new Set<Id64String>();\n private _deniedModels = new Map<Id64String, ChannelKey>();\n\n public constructor(private _iModel: IModelDb) {\n // for backwards compatibility, allow the shared channel unless explicitly turned off in IModelHostOptions.\n if (IModelHost.configuration?.allowSharedChannel !== false)\n this._allowedChannels.add(ChannelControl.sharedChannelName);\n }\n\n public addAllowedChannel(channelKey: ChannelKey) {\n this._allowedChannels.add(channelKey);\n this._deniedModels.clear();\n }\n\n public removeAllowedChannel(channelKey: ChannelKey) {\n this._allowedChannels.delete(channelKey);\n this._allowedModels.clear();\n }\n\n public getChannelKey(elementId: Id64String): ChannelKey {\n if (elementId === IModel.rootSubjectId)\n return ChannelControl.sharedChannelName;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const channel = this._iModel.withPreparedStatement(`SELECT Owner FROM ${ChannelAdmin.channelClassName} WHERE Element.Id=?`, (stmt) => {\n stmt.bindId(1, elementId);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getString() : undefined;\n });\n\n if (channel !== undefined)\n return channel;\n } catch {\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\n // In that case all data in such iModel is assumed to be in the shared channel.\n return ChannelControl.sharedChannelName;\n }\n\n const parentId = this._iModel.withPreparedSqliteStatement(\"SELECT ParentId,ModelId FROM bis_Element WHERE id=?\", (stmt) => {\n stmt.bindId(1, elementId);\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\n throw new IModelError(IModelStatus.NotFound, \"Element does not exist\");\n return stmt.getValueId(0) ?? stmt.getValueId(1); // if parent is undefined, use modelId\n });\n\n return this.getChannelKey(parentId);\n }\n\n public [_verifyChannel](modelId: Id64String): void {\n // Note: indirect changes are permitted to change any channel\n if (this._allowedModels.has(modelId) || this._iModel[_nativeDb].getTxnMode() === \"indirect\")\n return;\n\n const deniedChannel = this._deniedModels.get(modelId);\n if (undefined !== deniedChannel)\n ChannelControlError.throwError(\"not-allowed\", `Channel ${deniedChannel} is not allowed`, deniedChannel);\n\n const channel = this.getChannelKey(modelId);\n if (this._allowedChannels.has(channel)) {\n this._allowedModels.add(modelId);\n return;\n }\n\n this._deniedModels.set(modelId, channel);\n return this[_verifyChannel](modelId);\n }\n\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey, txn: EditTxn }): void;\n /** @deprecated Use makeChannelRoot and supply `txn`. */\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey }): void;\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey, txn?: EditTxn }): void {\n const txn = args.txn ?? this._iModel[_implicitTxn];\n const channelKey = this.getChannelKey(args.elementId);\n if (ChannelControl.sharedChannelName !== channelKey)\n ChannelControlError.throwError(\"may-not-nest\", `Channel ${channelKey} may not nest`, channelKey);\n\n if (this.queryChannelRoot(args.channelKey) !== undefined)\n ChannelControlError.throwError(\"root-exists\", `Channel ${args.channelKey} root already exist`, channelKey);\n\n const props: ChannelRootAspectProps = {\n classFullName: ChannelAdmin.channelClassName,\n element: {\n id: args.elementId,\n relClassName: ElementOwnsChannelRootAspect.classFullName,\n },\n owner: args.channelKey,\n };\n txn.insertAspect(props);\n }\n\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string, txn: EditTxn }): Id64String;\n /** @deprecated Use insertChannelSubject and supply `txn`. */\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string }): Id64String;\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string, txn?: EditTxn }): Id64String {\n const txn = args.txn ?? this._iModel[_implicitTxn];\n // Check if channelKey already exists before inserting Subject.\n // makeChannelRoot will check that again, but at that point the new Subject is already inserted.\n // Prefer to check twice instead of deleting the Subject in the latter option.\n if (this.queryChannelRoot(args.channelKey) !== undefined)\n ChannelControlError.throwError(\"root-exists\", `Channel ${args.channelKey} root already exist`, args.channelKey);\n\n const elementId = Subject.insert(txn, args.parentSubjectId ?? IModel.rootSubjectId, args.subjectName, args.description);\n this.makeChannelRoot({ elementId, channelKey: args.channelKey, txn });\n return elementId;\n }\n\n public queryChannelRoot(channelKey: ChannelKey): Id64String | undefined {\n if (channelKey === ChannelControl.sharedChannelName)\n // RootSubject acts as the ChannelRoot element of the shared channel\n return IModel.rootSubjectId;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const channelRoot = this._iModel.withPreparedStatement(`SELECT Element.Id FROM ${ChannelAdmin.channelClassName} WHERE Owner=?`, (stmt) => {\n stmt.bindString(1, channelKey);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getId() : undefined;\n });\n\n return channelRoot;\n } catch {\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\n // In that case all data in such iModel is assumed to be in the shared channel.\n return undefined;\n }\n\n }\n\n public async upgradeChannel(options: ChannelUpgradeOptions, iModel: IModelDb, data?: any): Promise<void> {\n // Validations\n if (!this._allowedChannels.has(options.channelKey))\n ChannelControlError.throwError(\"not-allowed\", `Channel ${options.channelKey} is not allowed`, options.channelKey);\n\n if (semver.gte(options.fromVersion, options.toVersion))\n ChannelControlError.throwError(\"not-allowed\", `Upgrading channel ${options.channelKey} from ${options.fromVersion} to ${options.toVersion} is not allowed`, options.channelKey);\n\n if (!this.queryChannelRoot(options.channelKey) && options.channelKey !== ChannelControl.sharedChannelName)\n ChannelControlError.throwError(\"not-allowed\", `Channel ${options.channelKey} not found`, options.channelKey);\n\n const context: ChannelUpgradeContext = {\n iModel,\n channelKey: options.channelKey,\n fromVersion: options.fromVersion,\n toVersion: options.toVersion,\n data,\n };\n\n try {\n await options.callback(context);\n } catch (error: any) {\n ChannelControlError.throwError(error, \"channel-upgrade-failed\", `Channel ${options.channelKey} upgrade failed: ${error.message}`);\n }\n }\n}\n\nexport function createChannelControl(iModel: IModelDb): ChannelAdmin {\n return new ChannelAdmin(iModel);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ChannelAdmin.js","sourceRoot":"","sources":["../../../src/internal/ChannelAdmin.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AA4KH,oDAEC;AA5KD,sDAAyE;AACzE,oDAAsG;AACtG,sDAA6G;AAC7G,wCAAqC;AAErC,8CAA2C;AAC3C,sEAAyE;AAEzE,uCAA+F;AAC/F,iCAAiC;AAEjC,MAAM,YAAY;IAQW;IAPpB,MAAM,CAAU,gBAAgB,GAAG,uBAAuB,CAAC;IAElD,CAAC,mCAAyB,CAAC,GAAG,SAAS,CAAC;IAChD,gBAAgB,GAAG,IAAI,GAAG,EAAc,CAAC;IACzC,cAAc,GAAG,IAAI,GAAG,EAAc,CAAC;IACvC,aAAa,GAAG,IAAI,GAAG,EAA0B,CAAC;IAE1D,YAA2B,OAAiB;QAAjB,YAAO,GAAP,OAAO,CAAU;QAC1C,2GAA2G;QAC3G,IAAI,uBAAU,CAAC,aAAa,EAAE,kBAAkB,KAAK,KAAK;YACxD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,+BAAc,CAAC,iBAAiB,CAAC,CAAC;IAChE,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AC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,UAAU,KAAK,+BAAc,CAAC,iBAAiB;YACvG,iCAAmB,CAAC,UAAU,CAAC,aAAa,EAAE,WAAW,OAAO,CAAC,UAAU,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QAE/G,MAAM,OAAO,GAA0B;YACrC,MAAM;YACN,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,IAAI;SACL,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,iCAAmB,CAAC,UAAU,CAAC,KAAK,EAAE,wBAAwB,EAAE,WAAW,OAAO,CAAC,UAAU,oBAAoB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACpI,CAAC;IACH,CAAC;;AAGH,SAAgB,oBAAoB,CAAC,MAAgB;IACnD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAClC,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 Elements\n */\n\nimport { DbResult, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { ChannelControlError, ChannelRootAspectProps, IModel, IModelError } from \"@itwin/core-common\";\nimport { ChannelControl, ChannelKey, ChannelUpgradeContext, ChannelUpgradeOptions } from \"../ChannelControl\";\nimport { Subject } from \"../Element\";\nimport { IModelDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\nimport { ElementOwnsChannelRootAspect } from \"../NavigationRelationship\";\nimport { EditTxn } from \"../EditTxn\";\nimport { _implementationProhibited, _implicitTxn, _nativeDb, _verifyChannel } from \"./Symbols\";\nimport * as semver from \"semver\";\n\nclass ChannelAdmin implements ChannelControl {\n public static readonly channelClassName = \"bis:ChannelRootAspect\";\n\n public readonly [_implementationProhibited] = undefined;\n private _allowedChannels = new Set<ChannelKey>();\n private _allowedModels = new Set<Id64String>();\n private _deniedModels = new Map<Id64String, ChannelKey>();\n\n public constructor(private _iModel: IModelDb) {\n // for backwards compatibility, allow the shared channel unless explicitly turned off in IModelHostOptions.\n if (IModelHost.configuration?.allowSharedChannel !== false)\n this._allowedChannels.add(ChannelControl.sharedChannelName);\n }\n\n public addAllowedChannel(channelKey: ChannelKey) {\n this._allowedChannels.add(channelKey);\n this._deniedModels.clear();\n }\n\n public removeAllowedChannel(channelKey: ChannelKey) {\n this._allowedChannels.delete(channelKey);\n this._allowedModels.clear();\n }\n\n public getChannelKey(elementId: Id64String): ChannelKey {\n if (elementId === IModel.rootSubjectId)\n return ChannelControl.sharedChannelName;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const channel = this._iModel.withPreparedStatement(`SELECT Owner FROM ${ChannelAdmin.channelClassName} WHERE Element.Id=?`, (stmt) => {\n stmt.bindId(1, elementId);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getString() : undefined;\n });\n\n if (channel !== undefined)\n return channel;\n } catch {\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\n // In that case all data in such iModel is assumed to be in the shared channel.\n return ChannelControl.sharedChannelName;\n }\n\n const parentId = this._iModel.withPreparedSqliteStatement(\"SELECT ParentId,ModelId FROM bis_Element WHERE id=?\", (stmt) => {\n stmt.bindId(1, elementId);\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\n throw new IModelError(IModelStatus.NotFound, \"Element does not exist\");\n return stmt.getValueId(0) ?? stmt.getValueId(1); // if parent is undefined, use modelId\n });\n\n return this.getChannelKey(parentId);\n }\n\n public [_verifyChannel](modelId: Id64String): void {\n // Note: indirect changes are permitted to change any channel\n if (this._allowedModels.has(modelId) || this._iModel[_nativeDb].getTxnMode() === \"indirect\")\n return;\n\n const deniedChannel = this._deniedModels.get(modelId);\n if (undefined !== deniedChannel)\n ChannelControlError.throwError(\"not-allowed\", `Channel ${deniedChannel} is not allowed`, deniedChannel);\n\n const channel = this.getChannelKey(modelId);\n if (this._allowedChannels.has(channel)) {\n this._allowedModels.add(modelId);\n return;\n }\n\n this._deniedModels.set(modelId, channel);\n return this[_verifyChannel](modelId);\n }\n\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey, txn: EditTxn }): void;\n /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use makeChannelRoot and supply `txn`. */\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey }): void;\n public makeChannelRoot(args: { elementId: Id64String, channelKey: ChannelKey, txn?: EditTxn }): void {\n const txn = args.txn ?? this._iModel[_implicitTxn];\n const channelKey = this.getChannelKey(args.elementId);\n if (ChannelControl.sharedChannelName !== channelKey)\n ChannelControlError.throwError(\"may-not-nest\", `Channel ${channelKey} may not nest`, channelKey);\n\n if (this.queryChannelRoot(args.channelKey) !== undefined)\n ChannelControlError.throwError(\"root-exists\", `Channel ${args.channelKey} root already exist`, channelKey);\n\n const props: ChannelRootAspectProps = {\n classFullName: ChannelAdmin.channelClassName,\n element: {\n id: args.elementId,\n relClassName: ElementOwnsChannelRootAspect.classFullName,\n },\n owner: args.channelKey,\n };\n txn.insertAspect(props);\n }\n\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string, txn: EditTxn }): Id64String;\n /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use insertChannelSubject and supply `txn`. */\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string }): Id64String;\n public insertChannelSubject(args: { subjectName: string, channelKey: ChannelKey, parentSubjectId?: Id64String, description?: string, txn?: EditTxn }): Id64String {\n const txn = args.txn ?? this._iModel[_implicitTxn];\n // Check if channelKey already exists before inserting Subject.\n // makeChannelRoot will check that again, but at that point the new Subject is already inserted.\n // Prefer to check twice instead of deleting the Subject in the latter option.\n if (this.queryChannelRoot(args.channelKey) !== undefined)\n ChannelControlError.throwError(\"root-exists\", `Channel ${args.channelKey} root already exist`, args.channelKey);\n\n const elementId = Subject.insert(txn, args.parentSubjectId ?? IModel.rootSubjectId, args.subjectName, args.description);\n this.makeChannelRoot({ elementId, channelKey: args.channelKey, txn });\n return elementId;\n }\n\n public queryChannelRoot(channelKey: ChannelKey): Id64String | undefined {\n if (channelKey === ChannelControl.sharedChannelName)\n // RootSubject acts as the ChannelRoot element of the shared channel\n return IModel.rootSubjectId;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const channelRoot = this._iModel.withPreparedStatement(`SELECT Element.Id FROM ${ChannelAdmin.channelClassName} WHERE Owner=?`, (stmt) => {\n stmt.bindString(1, channelKey);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getValue(0).getId() : undefined;\n });\n\n return channelRoot;\n } catch {\n // Exception happens if the iModel is too old: ChannelRootAspect class not present in the BisCore schema (older than v1.0.10).\n // In that case all data in such iModel is assumed to be in the shared channel.\n return undefined;\n }\n\n }\n\n public async upgradeChannel(options: ChannelUpgradeOptions, iModel: IModelDb, data?: any): Promise<void> {\n // Validations\n if (!this._allowedChannels.has(options.channelKey))\n ChannelControlError.throwError(\"not-allowed\", `Channel ${options.channelKey} is not allowed`, options.channelKey);\n\n if (semver.gte(options.fromVersion, options.toVersion))\n ChannelControlError.throwError(\"not-allowed\", `Upgrading channel ${options.channelKey} from ${options.fromVersion} to ${options.toVersion} is not allowed`, options.channelKey);\n\n if (!this.queryChannelRoot(options.channelKey) && options.channelKey !== ChannelControl.sharedChannelName)\n ChannelControlError.throwError(\"not-allowed\", `Channel ${options.channelKey} not found`, options.channelKey);\n\n const context: ChannelUpgradeContext = {\n iModel,\n channelKey: options.channelKey,\n fromVersion: options.fromVersion,\n toVersion: options.toVersion,\n data,\n };\n\n try {\n await options.callback(context);\n } catch (error: any) {\n ChannelControlError.throwError(error, \"channel-upgrade-failed\", `Channel ${options.channelKey} upgrade failed: ${error.message}`);\n }\n }\n}\n\nexport function createChannelControl(iModel: IModelDb): ChannelAdmin {\n return new ChannelAdmin(iModel);\n}\n"]}
|
|
@@ -8,61 +8,61 @@ export declare const integrityCheckTypeMap: {
|
|
|
8
8
|
readonly name: "Check Data Columns";
|
|
9
9
|
readonly resultType: "CheckDataColumnsResultRow";
|
|
10
10
|
readonly sqlCommand: "check_data_columns";
|
|
11
|
-
readonly sqlQuery: "PRAGMA integrity_check(check_data_columns)
|
|
11
|
+
readonly sqlQuery: "PRAGMA integrity_check(check_data_columns) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES";
|
|
12
12
|
};
|
|
13
13
|
readonly checkECProfile: {
|
|
14
14
|
readonly name: "Check EC Profile";
|
|
15
15
|
readonly resultType: "CheckECProfileResultRow";
|
|
16
16
|
readonly sqlCommand: "check_ec_profile";
|
|
17
|
-
readonly sqlQuery: "PRAGMA integrity_check(check_ec_profile)
|
|
17
|
+
readonly sqlQuery: "PRAGMA integrity_check(check_ec_profile) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES";
|
|
18
18
|
};
|
|
19
19
|
readonly checkNavigationClassIds: {
|
|
20
20
|
readonly name: "Check Navigation Class Ids";
|
|
21
21
|
readonly resultType: "CheckNavClassIdsResultRow";
|
|
22
22
|
readonly sqlCommand: "check_nav_class_ids";
|
|
23
|
-
readonly sqlQuery: "PRAGMA integrity_check(check_nav_class_ids)
|
|
23
|
+
readonly sqlQuery: "PRAGMA integrity_check(check_nav_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES";
|
|
24
24
|
};
|
|
25
25
|
readonly checkNavigationIds: {
|
|
26
26
|
readonly name: "Check Navigation Ids";
|
|
27
27
|
readonly resultType: "CheckNavIdsResultRow";
|
|
28
28
|
readonly sqlCommand: "check_nav_ids";
|
|
29
|
-
readonly sqlQuery: "PRAGMA integrity_check(check_nav_ids)
|
|
29
|
+
readonly sqlQuery: "PRAGMA integrity_check(check_nav_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES";
|
|
30
30
|
};
|
|
31
31
|
readonly checkLinktableForeignKeyClassIds: {
|
|
32
32
|
readonly name: "Check Link Table Foreign Key Class Ids";
|
|
33
33
|
readonly resultType: "CheckLinkTableFkClassIdsResultRow";
|
|
34
34
|
readonly sqlCommand: "check_linktable_fk_class_ids";
|
|
35
|
-
readonly sqlQuery: "PRAGMA integrity_check(check_linktable_fk_class_ids)
|
|
35
|
+
readonly sqlQuery: "PRAGMA integrity_check(check_linktable_fk_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES";
|
|
36
36
|
};
|
|
37
37
|
readonly checkLinktableForeignKeyIds: {
|
|
38
38
|
readonly name: "Check Link Table Foreign Key Ids";
|
|
39
39
|
readonly resultType: "CheckLinkTableFkIdsResultRow";
|
|
40
40
|
readonly sqlCommand: "check_linktable_fk_ids";
|
|
41
|
-
readonly sqlQuery: "PRAGMA integrity_check(check_linktable_fk_ids)
|
|
41
|
+
readonly sqlQuery: "PRAGMA integrity_check(check_linktable_fk_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES";
|
|
42
42
|
};
|
|
43
43
|
readonly checkClassIds: {
|
|
44
44
|
readonly name: "Check Class Ids";
|
|
45
45
|
readonly resultType: "CheckClassIdsResultRow";
|
|
46
46
|
readonly sqlCommand: "check_class_ids";
|
|
47
|
-
readonly sqlQuery: "PRAGMA integrity_check(check_class_ids)
|
|
47
|
+
readonly sqlQuery: "PRAGMA integrity_check(check_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES";
|
|
48
48
|
};
|
|
49
49
|
readonly checkDataSchema: {
|
|
50
50
|
readonly name: "Check Data Schema";
|
|
51
51
|
readonly resultType: "CheckDataSchemaResultRow";
|
|
52
52
|
readonly sqlCommand: "check_data_schema";
|
|
53
|
-
readonly sqlQuery: "PRAGMA integrity_check(check_data_schema)
|
|
53
|
+
readonly sqlQuery: "PRAGMA integrity_check(check_data_schema) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES";
|
|
54
54
|
};
|
|
55
55
|
readonly checkSchemaLoad: {
|
|
56
56
|
readonly name: "Check Schema Load";
|
|
57
57
|
readonly resultType: "CheckSchemaLoadResultRow";
|
|
58
58
|
readonly sqlCommand: "check_schema_load";
|
|
59
|
-
readonly sqlQuery: "PRAGMA integrity_check(check_schema_load)
|
|
59
|
+
readonly sqlQuery: "PRAGMA integrity_check(check_schema_load) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES";
|
|
60
60
|
};
|
|
61
61
|
readonly checkMissingChildRows: {
|
|
62
62
|
readonly name: "Check Missing Child Rows";
|
|
63
63
|
readonly resultType: "CheckMissingChildRowsResultRow";
|
|
64
64
|
readonly sqlCommand: "check_missing_child_rows";
|
|
65
|
-
readonly sqlQuery: "PRAGMA integrity_check(check_missing_child_rows)
|
|
65
|
+
readonly sqlQuery: "PRAGMA integrity_check(check_missing_child_rows) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES";
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
/**
|
|
@@ -19,61 +19,61 @@ exports.integrityCheckTypeMap = {
|
|
|
19
19
|
name: "Check Data Columns",
|
|
20
20
|
resultType: "CheckDataColumnsResultRow",
|
|
21
21
|
sqlCommand: "check_data_columns",
|
|
22
|
-
sqlQuery: `PRAGMA integrity_check(check_data_columns)
|
|
22
|
+
sqlQuery: `PRAGMA integrity_check(check_data_columns) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
23
23
|
},
|
|
24
24
|
checkECProfile: {
|
|
25
25
|
name: "Check EC Profile",
|
|
26
26
|
resultType: "CheckECProfileResultRow",
|
|
27
27
|
sqlCommand: "check_ec_profile",
|
|
28
|
-
sqlQuery: `PRAGMA integrity_check(check_ec_profile)
|
|
28
|
+
sqlQuery: `PRAGMA integrity_check(check_ec_profile) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
29
29
|
},
|
|
30
30
|
checkNavigationClassIds: {
|
|
31
31
|
name: "Check Navigation Class Ids",
|
|
32
32
|
resultType: "CheckNavClassIdsResultRow",
|
|
33
33
|
sqlCommand: "check_nav_class_ids",
|
|
34
|
-
sqlQuery: `PRAGMA integrity_check(check_nav_class_ids)
|
|
34
|
+
sqlQuery: `PRAGMA integrity_check(check_nav_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
35
35
|
},
|
|
36
36
|
checkNavigationIds: {
|
|
37
37
|
name: "Check Navigation Ids",
|
|
38
38
|
resultType: "CheckNavIdsResultRow",
|
|
39
39
|
sqlCommand: "check_nav_ids",
|
|
40
|
-
sqlQuery: `PRAGMA integrity_check(check_nav_ids)
|
|
40
|
+
sqlQuery: `PRAGMA integrity_check(check_nav_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
41
41
|
},
|
|
42
42
|
checkLinktableForeignKeyClassIds: {
|
|
43
43
|
name: "Check Link Table Foreign Key Class Ids",
|
|
44
44
|
resultType: "CheckLinkTableFkClassIdsResultRow",
|
|
45
45
|
sqlCommand: "check_linktable_fk_class_ids",
|
|
46
|
-
sqlQuery: `PRAGMA integrity_check(check_linktable_fk_class_ids)
|
|
46
|
+
sqlQuery: `PRAGMA integrity_check(check_linktable_fk_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
47
47
|
},
|
|
48
48
|
checkLinktableForeignKeyIds: {
|
|
49
49
|
name: "Check Link Table Foreign Key Ids",
|
|
50
50
|
resultType: "CheckLinkTableFkIdsResultRow",
|
|
51
51
|
sqlCommand: "check_linktable_fk_ids",
|
|
52
|
-
sqlQuery: `PRAGMA integrity_check(check_linktable_fk_ids)
|
|
52
|
+
sqlQuery: `PRAGMA integrity_check(check_linktable_fk_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
53
53
|
},
|
|
54
54
|
checkClassIds: {
|
|
55
55
|
name: "Check Class Ids",
|
|
56
56
|
resultType: "CheckClassIdsResultRow",
|
|
57
57
|
sqlCommand: "check_class_ids",
|
|
58
|
-
sqlQuery: `PRAGMA integrity_check(check_class_ids)
|
|
58
|
+
sqlQuery: `PRAGMA integrity_check(check_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
59
59
|
},
|
|
60
60
|
checkDataSchema: {
|
|
61
61
|
name: "Check Data Schema",
|
|
62
62
|
resultType: "CheckDataSchemaResultRow",
|
|
63
63
|
sqlCommand: "check_data_schema",
|
|
64
|
-
sqlQuery: `PRAGMA integrity_check(check_data_schema)
|
|
64
|
+
sqlQuery: `PRAGMA integrity_check(check_data_schema) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
65
65
|
},
|
|
66
66
|
checkSchemaLoad: {
|
|
67
67
|
name: "Check Schema Load",
|
|
68
68
|
resultType: "CheckSchemaLoadResultRow",
|
|
69
69
|
sqlCommand: "check_schema_load",
|
|
70
|
-
sqlQuery: `PRAGMA integrity_check(check_schema_load)
|
|
70
|
+
sqlQuery: `PRAGMA integrity_check(check_schema_load) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
71
71
|
},
|
|
72
72
|
checkMissingChildRows: {
|
|
73
73
|
name: "Check Missing Child Rows",
|
|
74
74
|
resultType: "CheckMissingChildRowsResultRow",
|
|
75
75
|
sqlCommand: "check_missing_child_rows",
|
|
76
|
-
sqlQuery: `PRAGMA integrity_check(check_missing_child_rows)
|
|
76
|
+
sqlQuery: `PRAGMA integrity_check(check_missing_child_rows) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,
|
|
77
77
|
},
|
|
78
78
|
};
|
|
79
79
|
/**
|
|
@@ -106,9 +106,9 @@ function getIntegrityCheckName(check) {
|
|
|
106
106
|
* @internal
|
|
107
107
|
*/
|
|
108
108
|
async function performQuickIntegrityCheck(iModel) {
|
|
109
|
-
const integrityCheckQuery = "PRAGMA integrity_check
|
|
109
|
+
const integrityCheckQuery = "PRAGMA integrity_check ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES";
|
|
110
110
|
const integrityCheckResults = [];
|
|
111
|
-
for await (const row of iModel.createQueryReader(integrityCheckQuery)) {
|
|
111
|
+
for await (const row of iModel.createQueryReader(integrityCheckQuery, undefined, { usePrimaryConn: true })) {
|
|
112
112
|
integrityCheckResults.push({ check: getIntegrityCheckName(row.check), passed: row.result, elapsedSeconds: row.elapsed_sec });
|
|
113
113
|
}
|
|
114
114
|
;
|
|
@@ -118,70 +118,70 @@ async function performSpecificIntegrityCheck(iModel, check) {
|
|
|
118
118
|
switch (check) {
|
|
119
119
|
case "checkDataColumns": {
|
|
120
120
|
const results = [];
|
|
121
|
-
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkDataColumns.sqlQuery)) {
|
|
121
|
+
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkDataColumns.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
122
122
|
results.push({ sno: row.sno, table: row.table, column: row.column });
|
|
123
123
|
}
|
|
124
124
|
return results;
|
|
125
125
|
}
|
|
126
126
|
case "checkECProfile": {
|
|
127
127
|
const results = [];
|
|
128
|
-
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkECProfile.sqlQuery)) {
|
|
128
|
+
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkECProfile.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
129
129
|
results.push({ sno: row.sno, type: row.type, name: row.name, issue: row.issue });
|
|
130
130
|
}
|
|
131
131
|
return results;
|
|
132
132
|
}
|
|
133
133
|
case "checkNavigationClassIds": {
|
|
134
134
|
const results = [];
|
|
135
|
-
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkNavigationClassIds.sqlQuery)) {
|
|
135
|
+
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkNavigationClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
136
136
|
results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, navClassId: row.nav_classId });
|
|
137
137
|
}
|
|
138
138
|
return results;
|
|
139
139
|
}
|
|
140
140
|
case "checkNavigationIds": {
|
|
141
141
|
const results = [];
|
|
142
|
-
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkNavigationIds.sqlQuery)) {
|
|
142
|
+
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkNavigationIds.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
143
143
|
results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, primaryClass: row.primary_class });
|
|
144
144
|
}
|
|
145
145
|
return results;
|
|
146
146
|
}
|
|
147
147
|
case "checkLinktableForeignKeyClassIds": {
|
|
148
148
|
const results = [];
|
|
149
|
-
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkLinktableForeignKeyClassIds.sqlQuery)) {
|
|
149
|
+
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkLinktableForeignKeyClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
150
150
|
results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, keyClassId: row.key_classId });
|
|
151
151
|
}
|
|
152
152
|
return results;
|
|
153
153
|
}
|
|
154
154
|
case "checkLinktableForeignKeyIds": {
|
|
155
155
|
const results = [];
|
|
156
|
-
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkLinktableForeignKeyIds.sqlQuery)) {
|
|
156
|
+
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkLinktableForeignKeyIds.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
157
157
|
results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, primaryClass: row.primary_class });
|
|
158
158
|
}
|
|
159
159
|
return results;
|
|
160
160
|
}
|
|
161
161
|
case "checkClassIds": {
|
|
162
162
|
const results = [];
|
|
163
|
-
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkClassIds.sqlQuery)) {
|
|
163
|
+
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
164
164
|
results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, type: row.type });
|
|
165
165
|
}
|
|
166
166
|
return results;
|
|
167
167
|
}
|
|
168
168
|
case "checkDataSchema": {
|
|
169
169
|
const results = [];
|
|
170
|
-
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkDataSchema.sqlQuery)) {
|
|
170
|
+
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkDataSchema.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
171
171
|
results.push({ sno: row.sno, type: row.type, name: row.name });
|
|
172
172
|
}
|
|
173
173
|
return results;
|
|
174
174
|
}
|
|
175
175
|
case "checkSchemaLoad": {
|
|
176
176
|
const results = [];
|
|
177
|
-
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkSchemaLoad.sqlQuery)) {
|
|
177
|
+
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkSchemaLoad.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
178
178
|
results.push({ sno: row.sno, schema: row.schema });
|
|
179
179
|
}
|
|
180
180
|
return results;
|
|
181
181
|
}
|
|
182
182
|
case "checkMissingChildRows": {
|
|
183
183
|
const results = [];
|
|
184
|
-
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkMissingChildRows.sqlQuery)) {
|
|
184
|
+
for await (const row of iModel.createQueryReader(exports.integrityCheckTypeMap.checkMissingChildRows.sqlQuery, undefined, { usePrimaryConn: true })) {
|
|
185
185
|
results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, missingRowInTables: row.MissingRowInTables });
|
|
186
186
|
}
|
|
187
187
|
return results;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegrityCheck.js","sourceRoot":"","sources":["../../../src/internal/IntegrityCheck.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAwO/F,sDAcC;AAQD,gEAOC;AAqBD,sEA2EC;AAnWD,sDAAmD;AACnD,oDAAiD;AAGjD;;;GAGG;AACU,QAAA,qBAAqB,GAAG;IACnC,gBAAgB,EAAE;QAChB,IAAI,EAAE,oBAAoB;QAC1B,UAAU,EAAE,2BAA2B;QACvC,UAAU,EAAE,oBAAoB;QAChC,QAAQ,EAAE,iFAAiF;KAC5F;IACD,cAAc,EAAE;QACd,IAAI,EAAE,kBAAkB;QACxB,UAAU,EAAE,yBAAyB;QACrC,UAAU,EAAE,kBAAkB;QAC9B,QAAQ,EAAE,+EAA+E;KAC1F;IACD,uBAAuB,EAAE;QACvB,IAAI,EAAE,4BAA4B;QAClC,UAAU,EAAE,2BAA2B;QACvC,UAAU,EAAE,qBAAqB;QACjC,QAAQ,EAAE,kFAAkF;KAC7F;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,sBAAsB;QAC5B,UAAU,EAAE,sBAAsB;QAClC,UAAU,EAAE,eAAe;QAC3B,QAAQ,EAAE,4EAA4E;KACvF;IACD,gCAAgC,EAAE;QAChC,IAAI,EAAE,wCAAwC;QAC9C,UAAU,EAAE,mCAAmC;QAC/C,UAAU,EAAE,8BAA8B;QAC1C,QAAQ,EAAE,2FAA2F;KACtG;IACD,2BAA2B,EAAE;QAC3B,IAAI,EAAE,kCAAkC;QACxC,UAAU,EAAE,8BAA8B;QAC1C,UAAU,EAAE,wBAAwB;QACpC,QAAQ,EAAE,qFAAqF;KAChG;IACD,aAAa,EAAE;QACb,IAAI,EAAE,iBAAiB;QACvB,UAAU,EAAE,wBAAwB;QACpC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AY,CAAC,UAAU,EAAE,8BAA8B,CAAC,CAAC;IACnF,CAAC;AACH,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\nimport { IModelStatus } from \"@itwin/core-bentley\";\nimport { IModelError } from \"@itwin/core-common\";\nimport { IModelDb } from \"../IModelDb\";\n\n/**\n * Information about each integrity check type, including the name, expected result type, and SQL query to execute\n * @internal\n */\nexport const integrityCheckTypeMap = {\n checkDataColumns: {\n name: \"Check Data Columns\",\n resultType: \"CheckDataColumnsResultRow\",\n sqlCommand: \"check_data_columns\",\n sqlQuery: `PRAGMA integrity_check(check_data_columns) options enable_experimental_features`,\n },\n checkECProfile: {\n name: \"Check EC Profile\",\n resultType: \"CheckECProfileResultRow\",\n sqlCommand: \"check_ec_profile\",\n sqlQuery: `PRAGMA integrity_check(check_ec_profile) options enable_experimental_features`,\n },\n checkNavigationClassIds: {\n name: \"Check Navigation Class Ids\",\n resultType: \"CheckNavClassIdsResultRow\",\n sqlCommand: \"check_nav_class_ids\",\n sqlQuery: `PRAGMA integrity_check(check_nav_class_ids) options enable_experimental_features`,\n },\n checkNavigationIds: {\n name: \"Check Navigation Ids\",\n resultType: \"CheckNavIdsResultRow\",\n sqlCommand: \"check_nav_ids\",\n sqlQuery: `PRAGMA integrity_check(check_nav_ids) options enable_experimental_features`,\n },\n checkLinktableForeignKeyClassIds: {\n name: \"Check Link Table Foreign Key Class Ids\",\n resultType: \"CheckLinkTableFkClassIdsResultRow\",\n sqlCommand: \"check_linktable_fk_class_ids\",\n sqlQuery: `PRAGMA integrity_check(check_linktable_fk_class_ids) options enable_experimental_features`,\n },\n checkLinktableForeignKeyIds: {\n name: \"Check Link Table Foreign Key Ids\",\n resultType: \"CheckLinkTableFkIdsResultRow\",\n sqlCommand: \"check_linktable_fk_ids\",\n sqlQuery: `PRAGMA integrity_check(check_linktable_fk_ids) options enable_experimental_features`,\n },\n checkClassIds: {\n name: \"Check Class Ids\",\n resultType: \"CheckClassIdsResultRow\",\n sqlCommand: \"check_class_ids\",\n sqlQuery: `PRAGMA integrity_check(check_class_ids) options enable_experimental_features`,\n },\n checkDataSchema: {\n name: \"Check Data Schema\",\n resultType: \"CheckDataSchemaResultRow\",\n sqlCommand: \"check_data_schema\",\n sqlQuery: `PRAGMA integrity_check(check_data_schema) options enable_experimental_features`,\n },\n checkSchemaLoad: {\n name: \"Check Schema Load\",\n resultType: \"CheckSchemaLoadResultRow\",\n sqlCommand: \"check_schema_load\",\n sqlQuery: `PRAGMA integrity_check(check_schema_load) options enable_experimental_features`,\n },\n checkMissingChildRows: {\n name: \"Check Missing Child Rows\",\n resultType: \"CheckMissingChildRowsResultRow\",\n sqlCommand: \"check_missing_child_rows\",\n sqlQuery: `PRAGMA integrity_check(check_missing_child_rows) options enable_experimental_features`,\n },\n} as const;\n\n/**\n * Type representing the keys of the integrityCheckType map, which correspond to the different types of integrity checks that can be performed.\n */\nexport type IntegrityCheckKey = keyof typeof integrityCheckTypeMap;\n\n/** Map of integrity check keys to their result row types */\ninterface IntegrityCheckResultTypeMap {\n checkDataColumns: CheckDataColumnsResultRow;\n checkECProfile: CheckECProfileResultRow;\n checkNavigationClassIds: CheckNavClassIdsResultRow;\n checkNavigationIds: CheckNavIdsResultRow;\n checkLinktableForeignKeyClassIds: CheckLinkTableFkClassIdsResultRow;\n checkLinktableForeignKeyIds: CheckLinkTableFkIdsResultRow;\n checkClassIds: CheckClassIdsResultRow;\n checkDataSchema: CheckDataSchemaResultRow;\n checkSchemaLoad: CheckSchemaLoadResultRow;\n checkMissingChildRows: CheckMissingChildRowsResultRow;\n}\n\n/** Checks the Map to give the return type of a specific integrity check */\ntype IntegrityCheckResultRow<K extends IntegrityCheckKey> = IntegrityCheckResultTypeMap[K];\n\n/**\n * Return type for quick integrity check\n */\nexport interface QuickIntegrityCheckResultRow {\n check: string;\n passed: boolean;\n elapsedSeconds: string;\n}\n\n/**\n * Return type for Check Data Columns integrity check\n */\nexport interface CheckDataColumnsResultRow {\n sno: number;\n table: string;\n column: string;\n}\n\n/**\n * Return type for Check EC Profile integrity check\n */\nexport interface CheckECProfileResultRow {\n sno: number;\n type: string;\n name: string;\n issue: string;\n}\n\n/**\n * Return type for Check Navigation Class Ids integrity check\n */\nexport interface CheckNavClassIdsResultRow {\n sno: number;\n id: string;\n class: string;\n property: string;\n navId: string;\n navClassId: string;\n}\n\n/**\n * Return type for Check Navigation Ids integrity check\n */\nexport interface CheckNavIdsResultRow {\n sno: number;\n id: string;\n class: string;\n property: string;\n navId: string;\n primaryClass: string;\n}\n\n/**\n * Return type for Check Link Table Foreign Key Class Ids integrity check\n */\nexport interface CheckLinkTableFkClassIdsResultRow {\n sno: number;\n id: string;\n relationship: string;\n property: string;\n keyId: string;\n keyClassId: string;\n}\n\n/**\n * Return type for Check Link Table Foreign Key Ids integrity check\n */\nexport interface CheckLinkTableFkIdsResultRow {\n sno: number;\n id: string;\n relationship: string;\n property: string;\n keyId: string;\n primaryClass: string;\n}\n\n/**\n * Return type for Check Class Ids integrity check\n */\nexport interface CheckClassIdsResultRow {\n sno: number;\n class: string;\n id: string;\n classId: string;\n type: string;\n}\n\n/**\n * Return type for Check Data Schema integrity check\n */\nexport interface CheckDataSchemaResultRow {\n sno: number;\n type: string;\n name: string;\n}\n\n/**\n * Return type for Check Schema Load integrity check\n */\nexport interface CheckSchemaLoadResultRow {\n sno: number;\n schema: string;\n}\n\n/**\n * Return type for Check Missing Child Rows integrity check\n */\nexport interface CheckMissingChildRowsResultRow {\n sno: number;\n class: string;\n id: string;\n classId: string;\n missingRowInTables: string;\n}\n\n/**\n * Return type for integrity check results, including the check name, whether it passed, and the specific results (if any)\n */\nexport interface IntegrityCheckResult {\n /** The name of the integrity check that was performed */\n check: string;\n /** Whether the integrity check passed (i.e. no issues were found = true) */\n passed: boolean;\n /** The specific results returned by the integrity check, which may include details about any issues that were found.\n * In the case where issues are found, this will be an array of result rows specific to the type of check that was performed,\n * or an array of quick integrity check results if it was a quick check. */\n results: IntegrityCheckResultRow<IntegrityCheckKey>[] | QuickIntegrityCheckResultRow[];\n}\n\n/**\n * Gets the user-friendly name of an integrity check based on its key or SQL command.\n * It first attempts to find a direct match for the key in the integrityCheckTypeMap. If not found, it searches for a match based on the SQL command.\n * If still not found, it returns the original check string.\n * @param check - The integrity check key or SQL command to get the name of\n * @returns The user-friendly name of the integrity check, or the original check string if no match is found\n * @internal\n */\nexport function getIntegrityCheckName(check: string): string {\n // First try direct lookup by key\n const directLookup = integrityCheckTypeMap[check as IntegrityCheckKey];\n if (directLookup) {\n return directLookup.name;\n }\n // If not found, search by sqlCommand\n for (const [, value] of Object.entries(integrityCheckTypeMap)) {\n if (value.sqlCommand === check) {\n return value.name;\n }\n }\n // Fallback to the original check string\n return check;\n}\n\n/**\n * Performs a quick integrity check on the given iModel.\n * @param iModel The IModelDb instance to perform the integrity check on\n * @returns An array of results for each check performed, including the check name, whether it passed, and the elapsed time in seconds\n * @internal\n */\nexport async function performQuickIntegrityCheck(iModel: IModelDb): Promise<QuickIntegrityCheckResultRow[]> {\n const integrityCheckQuery = \"PRAGMA integrity_check options enable_experimental_features\";\n const integrityCheckResults: QuickIntegrityCheckResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckQuery)) {\n integrityCheckResults.push({ check: getIntegrityCheckName(row.check), passed: row.result, elapsedSeconds: row.elapsed_sec});\n };\n return integrityCheckResults;\n}\n\n/**\n * Performs a specific integrity check on the given iModel based on the provided check key, and returns the results specific to that check type.\n * @param iModel The IModelDb instance to perform the integrity check on\n * @param check The key of the specific integrity check to perform\n * @return An array of results specific to the integrity check that was performed. The type of the result rows will depend on the check that was executed.\n * @throws IModelError with status BadRequest if an unknown integrity check key is provided\n * @internal\n */\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDataColumns\"): Promise<IntegrityCheckResultRow<\"checkDataColumns\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkECProfile\"): Promise<IntegrityCheckResultRow<\"checkECProfile\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkNavigationClassIds\"): Promise<IntegrityCheckResultRow<\"checkNavigationClassIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkNavigationIds\"): Promise<IntegrityCheckResultRow<\"checkNavigationIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkLinktableForeignKeyClassIds\"): Promise<IntegrityCheckResultRow<\"checkLinktableForeignKeyClassIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkLinktableForeignKeyIds\"): Promise<IntegrityCheckResultRow<\"checkLinktableForeignKeyIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkClassIds\"): Promise<IntegrityCheckResultRow<\"checkClassIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDataSchema\"): Promise<IntegrityCheckResultRow<\"checkDataSchema\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkSchemaLoad\"): Promise<IntegrityCheckResultRow<\"checkSchemaLoad\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkMissingChildRows\"): Promise<IntegrityCheckResultRow<\"checkMissingChildRows\">[]>;\nexport async function performSpecificIntegrityCheck<K extends IntegrityCheckKey>(iModel: IModelDb, check: K): Promise<IntegrityCheckResultRow<K>[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: IntegrityCheckKey): Promise<IntegrityCheckResultRow<IntegrityCheckKey>[]> {\n switch (check) {\n case \"checkDataColumns\": {\n const results: CheckDataColumnsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataColumns.sqlQuery)) {\n results.push({ sno: row.sno, table: row.table, column: row.column });\n }\n return results;\n }\n case \"checkECProfile\": {\n const results: CheckECProfileResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkECProfile.sqlQuery)) {\n results.push({ sno: row.sno, type: row.type, name: row.name, issue: row.issue });\n }\n return results;\n }\n case \"checkNavigationClassIds\": {\n const results: CheckNavClassIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationClassIds.sqlQuery)) {\n results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, navClassId: row.nav_classId });\n }\n return results;\n }\n case \"checkNavigationIds\": {\n const results: CheckNavIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationIds.sqlQuery)) {\n results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, primaryClass: row.primary_class });\n }\n return results;\n }\n case \"checkLinktableForeignKeyClassIds\": {\n const results: CheckLinkTableFkClassIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyClassIds.sqlQuery)) {\n results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, keyClassId: row.key_classId });\n }\n return results;\n }\n case \"checkLinktableForeignKeyIds\": {\n const results: CheckLinkTableFkIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyIds.sqlQuery)) {\n results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, primaryClass: row.primary_class });\n }\n return results;\n }\n case \"checkClassIds\": {\n const results: CheckClassIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkClassIds.sqlQuery)) {\n results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, type: row.type });\n }\n return results;\n }\n case \"checkDataSchema\": {\n const results: CheckDataSchemaResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataSchema.sqlQuery)) {\n results.push({ sno: row.sno, type: row.type, name: row.name });\n }\n return results;\n }\n case \"checkSchemaLoad\": {\n const results: CheckSchemaLoadResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkSchemaLoad.sqlQuery)) {\n results.push({ sno: row.sno, schema: row.schema });\n }\n return results;\n }\n case \"checkMissingChildRows\": {\n const results: CheckMissingChildRowsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkMissingChildRows.sqlQuery)) {\n results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, missingRowInTables: row.MissingRowInTables });\n }\n return results;\n }\n default:\n throw new IModelError(IModelStatus.BadRequest, `Unknown integrity check type`);\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"IntegrityCheck.js","sourceRoot":"","sources":["../../../src/internal/IntegrityCheck.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAwO/F,sDAcC;AAQD,gEAOC;AAqBD,sEA2EC;AAnWD,sDAAmD;AACnD,oDAAiD;AAGjD;;;GAGG;AACU,QAAA,qBAAqB,GAAG;IACnC,gBAAgB,EAAE;QAChB,IAAI,EAAE,oBAAoB;QAC1B,UAAU,EAAE,2BAA2B;QACvC,UAAU,EAAE,oBAAoB;QAChC,QAAQ,EAAE,sFAAsF;KACjG;IACD,cAAc,EAAE;QACd,IAAI,EAAE,kBAAkB;QACxB,UAAU,EAAE,yBAAyB;QACrC,UAAU,EAAE,kBAAkB;QAC9B,QAAQ,EAAE,oFAAoF;KAC/F;IACD,uBAAuB,EAAE;QACvB,IAAI,EAAE,4BAA4B;QAClC,UAAU,EAAE,2BAA2B;QACvC,UAAU,EAAE,qBAAqB;QACjC,QAAQ,EAAE,uFAAuF;KAClG;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,sBAAsB;QAC5B,UAAU,EAAE,sBAAsB;QAClC,UAAU,EAAE,eAAe;QAC3B,QAAQ,EAAE,iFAAiF;KAC5F;IACD,gCAAgC,EAAE;QAChC,IAAI,EAAE,wCAAwC;QAC9C,UAAU,E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CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;gBACtI,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;YACrD,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,KAAK,uBAAuB,CAAC,CAAC,CAAC;YAC7B,MAAM,OAAO,GAAqC,EAAE,CAAC;YACrD,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,CAAC,iBAAiB,CAAC,6BAAqB,CAAC,qBAAqB,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;gBAC5I,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,QAAQ,EAAE,kBAAkB,EAAE,GAAG,CAAC,kBAAkB,EAAE,CAAC,CAAC;YAClI,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;QACD;YACE,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,8BAA8B,CAAC,CAAC;IACnF,CAAC;AACH,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\nimport { IModelStatus } from \"@itwin/core-bentley\";\nimport { IModelError } from \"@itwin/core-common\";\nimport { IModelDb } from \"../IModelDb\";\n\n/**\n * Information about each integrity check type, including the name, expected result type, and SQL query to execute\n * @internal\n */\nexport const integrityCheckTypeMap = {\n checkDataColumns: {\n name: \"Check Data Columns\",\n resultType: \"CheckDataColumnsResultRow\",\n sqlCommand: \"check_data_columns\",\n sqlQuery: `PRAGMA integrity_check(check_data_columns) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkECProfile: {\n name: \"Check EC Profile\",\n resultType: \"CheckECProfileResultRow\",\n sqlCommand: \"check_ec_profile\",\n sqlQuery: `PRAGMA integrity_check(check_ec_profile) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkNavigationClassIds: {\n name: \"Check Navigation Class Ids\",\n resultType: \"CheckNavClassIdsResultRow\",\n sqlCommand: \"check_nav_class_ids\",\n sqlQuery: `PRAGMA integrity_check(check_nav_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkNavigationIds: {\n name: \"Check Navigation Ids\",\n resultType: \"CheckNavIdsResultRow\",\n sqlCommand: \"check_nav_ids\",\n sqlQuery: `PRAGMA integrity_check(check_nav_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkLinktableForeignKeyClassIds: {\n name: \"Check Link Table Foreign Key Class Ids\",\n resultType: \"CheckLinkTableFkClassIdsResultRow\",\n sqlCommand: \"check_linktable_fk_class_ids\",\n sqlQuery: `PRAGMA integrity_check(check_linktable_fk_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkLinktableForeignKeyIds: {\n name: \"Check Link Table Foreign Key Ids\",\n resultType: \"CheckLinkTableFkIdsResultRow\",\n sqlCommand: \"check_linktable_fk_ids\",\n sqlQuery: `PRAGMA integrity_check(check_linktable_fk_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkClassIds: {\n name: \"Check Class Ids\",\n resultType: \"CheckClassIdsResultRow\",\n sqlCommand: \"check_class_ids\",\n sqlQuery: `PRAGMA integrity_check(check_class_ids) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkDataSchema: {\n name: \"Check Data Schema\",\n resultType: \"CheckDataSchemaResultRow\",\n sqlCommand: \"check_data_schema\",\n sqlQuery: `PRAGMA integrity_check(check_data_schema) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkSchemaLoad: {\n name: \"Check Schema Load\",\n resultType: \"CheckSchemaLoadResultRow\",\n sqlCommand: \"check_schema_load\",\n sqlQuery: `PRAGMA integrity_check(check_schema_load) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n checkMissingChildRows: {\n name: \"Check Missing Child Rows\",\n resultType: \"CheckMissingChildRowsResultRow\",\n sqlCommand: \"check_missing_child_rows\",\n sqlQuery: `PRAGMA integrity_check(check_missing_child_rows) ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES`,\n },\n} as const;\n\n/**\n * Type representing the keys of the integrityCheckType map, which correspond to the different types of integrity checks that can be performed.\n */\nexport type IntegrityCheckKey = keyof typeof integrityCheckTypeMap;\n\n/** Map of integrity check keys to their result row types */\ninterface IntegrityCheckResultTypeMap {\n checkDataColumns: CheckDataColumnsResultRow;\n checkECProfile: CheckECProfileResultRow;\n checkNavigationClassIds: CheckNavClassIdsResultRow;\n checkNavigationIds: CheckNavIdsResultRow;\n checkLinktableForeignKeyClassIds: CheckLinkTableFkClassIdsResultRow;\n checkLinktableForeignKeyIds: CheckLinkTableFkIdsResultRow;\n checkClassIds: CheckClassIdsResultRow;\n checkDataSchema: CheckDataSchemaResultRow;\n checkSchemaLoad: CheckSchemaLoadResultRow;\n checkMissingChildRows: CheckMissingChildRowsResultRow;\n}\n\n/** Checks the Map to give the return type of a specific integrity check */\ntype IntegrityCheckResultRow<K extends IntegrityCheckKey> = IntegrityCheckResultTypeMap[K];\n\n/**\n * Return type for quick integrity check\n */\nexport interface QuickIntegrityCheckResultRow {\n check: string;\n passed: boolean;\n elapsedSeconds: string;\n}\n\n/**\n * Return type for Check Data Columns integrity check\n */\nexport interface CheckDataColumnsResultRow {\n sno: number;\n table: string;\n column: string;\n}\n\n/**\n * Return type for Check EC Profile integrity check\n */\nexport interface CheckECProfileResultRow {\n sno: number;\n type: string;\n name: string;\n issue: string;\n}\n\n/**\n * Return type for Check Navigation Class Ids integrity check\n */\nexport interface CheckNavClassIdsResultRow {\n sno: number;\n id: string;\n class: string;\n property: string;\n navId: string;\n navClassId: string;\n}\n\n/**\n * Return type for Check Navigation Ids integrity check\n */\nexport interface CheckNavIdsResultRow {\n sno: number;\n id: string;\n class: string;\n property: string;\n navId: string;\n primaryClass: string;\n}\n\n/**\n * Return type for Check Link Table Foreign Key Class Ids integrity check\n */\nexport interface CheckLinkTableFkClassIdsResultRow {\n sno: number;\n id: string;\n relationship: string;\n property: string;\n keyId: string;\n keyClassId: string;\n}\n\n/**\n * Return type for Check Link Table Foreign Key Ids integrity check\n */\nexport interface CheckLinkTableFkIdsResultRow {\n sno: number;\n id: string;\n relationship: string;\n property: string;\n keyId: string;\n primaryClass: string;\n}\n\n/**\n * Return type for Check Class Ids integrity check\n */\nexport interface CheckClassIdsResultRow {\n sno: number;\n class: string;\n id: string;\n classId: string;\n type: string;\n}\n\n/**\n * Return type for Check Data Schema integrity check\n */\nexport interface CheckDataSchemaResultRow {\n sno: number;\n type: string;\n name: string;\n}\n\n/**\n * Return type for Check Schema Load integrity check\n */\nexport interface CheckSchemaLoadResultRow {\n sno: number;\n schema: string;\n}\n\n/**\n * Return type for Check Missing Child Rows integrity check\n */\nexport interface CheckMissingChildRowsResultRow {\n sno: number;\n class: string;\n id: string;\n classId: string;\n missingRowInTables: string;\n}\n\n/**\n * Return type for integrity check results, including the check name, whether it passed, and the specific results (if any)\n */\nexport interface IntegrityCheckResult {\n /** The name of the integrity check that was performed */\n check: string;\n /** Whether the integrity check passed (i.e. no issues were found = true) */\n passed: boolean;\n /** The specific results returned by the integrity check, which may include details about any issues that were found.\n * In the case where issues are found, this will be an array of result rows specific to the type of check that was performed,\n * or an array of quick integrity check results if it was a quick check. */\n results: IntegrityCheckResultRow<IntegrityCheckKey>[] | QuickIntegrityCheckResultRow[];\n}\n\n/**\n * Gets the user-friendly name of an integrity check based on its key or SQL command.\n * It first attempts to find a direct match for the key in the integrityCheckTypeMap. If not found, it searches for a match based on the SQL command.\n * If still not found, it returns the original check string.\n * @param check - The integrity check key or SQL command to get the name of\n * @returns The user-friendly name of the integrity check, or the original check string if no match is found\n * @internal\n */\nexport function getIntegrityCheckName(check: string): string {\n // First try direct lookup by key\n const directLookup = integrityCheckTypeMap[check as IntegrityCheckKey];\n if (directLookup) {\n return directLookup.name;\n }\n // If not found, search by sqlCommand\n for (const [, value] of Object.entries(integrityCheckTypeMap)) {\n if (value.sqlCommand === check) {\n return value.name;\n }\n }\n // Fallback to the original check string\n return check;\n}\n\n/**\n * Performs a quick integrity check on the given iModel.\n * @param iModel The IModelDb instance to perform the integrity check on\n * @returns An array of results for each check performed, including the check name, whether it passed, and the elapsed time in seconds\n * @internal\n */\nexport async function performQuickIntegrityCheck(iModel: IModelDb): Promise<QuickIntegrityCheckResultRow[]> {\n const integrityCheckQuery = \"PRAGMA integrity_check ECSQLOPTIONS ENABLE_EXPERIMENTAL_FEATURES\";\n const integrityCheckResults: QuickIntegrityCheckResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckQuery, undefined, { usePrimaryConn: true })) {\n integrityCheckResults.push({ check: getIntegrityCheckName(row.check), passed: row.result, elapsedSeconds: row.elapsed_sec});\n };\n return integrityCheckResults;\n}\n\n/**\n * Performs a specific integrity check on the given iModel based on the provided check key, and returns the results specific to that check type.\n * @param iModel The IModelDb instance to perform the integrity check on\n * @param check The key of the specific integrity check to perform\n * @return An array of results specific to the integrity check that was performed. The type of the result rows will depend on the check that was executed.\n * @throws IModelError with status BadRequest if an unknown integrity check key is provided\n * @internal\n */\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDataColumns\"): Promise<IntegrityCheckResultRow<\"checkDataColumns\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkECProfile\"): Promise<IntegrityCheckResultRow<\"checkECProfile\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkNavigationClassIds\"): Promise<IntegrityCheckResultRow<\"checkNavigationClassIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkNavigationIds\"): Promise<IntegrityCheckResultRow<\"checkNavigationIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkLinktableForeignKeyClassIds\"): Promise<IntegrityCheckResultRow<\"checkLinktableForeignKeyClassIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkLinktableForeignKeyIds\"): Promise<IntegrityCheckResultRow<\"checkLinktableForeignKeyIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkClassIds\"): Promise<IntegrityCheckResultRow<\"checkClassIds\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkDataSchema\"): Promise<IntegrityCheckResultRow<\"checkDataSchema\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkSchemaLoad\"): Promise<IntegrityCheckResultRow<\"checkSchemaLoad\">[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: \"checkMissingChildRows\"): Promise<IntegrityCheckResultRow<\"checkMissingChildRows\">[]>;\nexport async function performSpecificIntegrityCheck<K extends IntegrityCheckKey>(iModel: IModelDb, check: K): Promise<IntegrityCheckResultRow<K>[]>;\nexport async function performSpecificIntegrityCheck(iModel: IModelDb, check: IntegrityCheckKey): Promise<IntegrityCheckResultRow<IntegrityCheckKey>[]> {\n switch (check) {\n case \"checkDataColumns\": {\n const results: CheckDataColumnsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataColumns.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, table: row.table, column: row.column });\n }\n return results;\n }\n case \"checkECProfile\": {\n const results: CheckECProfileResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkECProfile.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, type: row.type, name: row.name, issue: row.issue });\n }\n return results;\n }\n case \"checkNavigationClassIds\": {\n const results: CheckNavClassIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, navClassId: row.nav_classId });\n }\n return results;\n }\n case \"checkNavigationIds\": {\n const results: CheckNavIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkNavigationIds.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, id: row.id, class: row.class, property: row.property, navId: row.nav_id, primaryClass: row.primary_class });\n }\n return results;\n }\n case \"checkLinktableForeignKeyClassIds\": {\n const results: CheckLinkTableFkClassIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, keyClassId: row.key_classId });\n }\n return results;\n }\n case \"checkLinktableForeignKeyIds\": {\n const results: CheckLinkTableFkIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkLinktableForeignKeyIds.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, id: row.id, relationship: row.relationship, property: row.property, keyId: row.key_id, primaryClass: row.primary_class });\n }\n return results;\n }\n case \"checkClassIds\": {\n const results: CheckClassIdsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkClassIds.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, type: row.type });\n }\n return results;\n }\n case \"checkDataSchema\": {\n const results: CheckDataSchemaResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkDataSchema.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, type: row.type, name: row.name });\n }\n return results;\n }\n case \"checkSchemaLoad\": {\n const results: CheckSchemaLoadResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkSchemaLoad.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, schema: row.schema });\n }\n return results;\n }\n case \"checkMissingChildRows\": {\n const results: CheckMissingChildRowsResultRow[] = [];\n for await (const row of iModel.createQueryReader(integrityCheckTypeMap.checkMissingChildRows.sqlQuery, undefined, { usePrimaryConn: true })) {\n results.push({ sno: row.sno, class: row.class, id: row.id, classId: row.class_id, missingRowInTables: row.MissingRowInTables });\n }\n return results;\n }\n default:\n throw new IModelError(IModelStatus.BadRequest, `Unknown integrity check type`);\n }\n}"]}
|