@itwin/core-backend 5.1.0-dev.9 → 5.2.0-dev.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 +112 -1
- package/lib/cjs/BackendHubAccess.d.ts +1 -1
- package/lib/cjs/BackendHubAccess.js +1 -1
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BisCoreSchema.d.ts.map +1 -1
- package/lib/cjs/BisCoreSchema.js +4 -2
- package/lib/cjs/BisCoreSchema.js.map +1 -1
- package/lib/cjs/BriefcaseManager.d.ts +10 -2
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +16 -0
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +4 -4
- package/lib/cjs/Category.js +4 -4
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts +67 -8
- package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +248 -33
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ClassRegistry.d.ts +9 -1
- package/lib/cjs/ClassRegistry.d.ts.map +1 -1
- package/lib/cjs/ClassRegistry.js +9 -1
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.js +1 -1
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeSpecs.d.ts +1 -1
- package/lib/cjs/CodeSpecs.js +1 -1
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +4 -4
- package/lib/cjs/DisplayStyle.js +3 -3
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +4 -4
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +4 -4
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +15 -6
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js +19 -4
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +54 -51
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +67 -52
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +8 -8
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +8 -8
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/Entity.d.ts +10 -7
- package/lib/cjs/Entity.d.ts.map +1 -1
- package/lib/cjs/Entity.js +35 -13
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/ExportGraphics.d.ts +54 -8
- package/lib/cjs/ExportGraphics.d.ts.map +1 -1
- package/lib/cjs/ExportGraphics.js +158 -59
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/GeographicCRSServices.d.ts +6 -2
- package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
- package/lib/cjs/GeographicCRSServices.js +1 -1
- package/lib/cjs/GeographicCRSServices.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +37 -26
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +124 -47
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js +1 -1
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +2 -3
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +2 -3
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelIncrementalSchemaLocater.d.ts +36 -0
- package/lib/cjs/IModelIncrementalSchemaLocater.d.ts.map +1 -0
- package/lib/cjs/IModelIncrementalSchemaLocater.js +69 -0
- package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -0
- package/lib/cjs/LocalHub.d.ts.map +1 -1
- package/lib/cjs/LocalHub.js +6 -4
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/Material.d.ts +4 -3
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +5 -5
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +22 -22
- package/lib/cjs/Model.js +22 -22
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +3 -0
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +15 -0
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +1 -1
- package/lib/cjs/SQLiteDb.js +1 -1
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.d.ts +25 -0
- package/lib/cjs/Schema.d.ts.map +1 -1
- package/lib/cjs/Schema.js +25 -0
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/SqliteStatement.d.ts +1 -1
- package/lib/cjs/SqliteStatement.d.ts.map +1 -1
- package/lib/cjs/SqliteStatement.js +1 -1
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/Texture.d.ts +1 -1
- package/lib/cjs/Texture.js +1 -1
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +4 -4
- package/lib/cjs/TxnManager.js +1 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +40 -14
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +42 -14
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +61 -0
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -0
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +110 -0
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -0
- package/lib/cjs/annotations/FrameGeometry.d.ts +51 -0
- package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -0
- package/lib/cjs/annotations/FrameGeometry.js +249 -0
- package/lib/cjs/annotations/FrameGeometry.js.map +1 -0
- package/lib/cjs/annotations/LeaderGeometry.d.ts +53 -0
- package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -0
- package/lib/cjs/annotations/LeaderGeometry.js +184 -0
- package/lib/cjs/annotations/LeaderGeometry.js.map +1 -0
- package/lib/cjs/annotations/TextAnnotationElement.d.ts +204 -0
- package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -0
- package/lib/cjs/annotations/TextAnnotationElement.js +411 -0
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +33 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.js +137 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -0
- package/lib/cjs/annotations/TextBlockGeometry.d.ts +16 -0
- package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -0
- package/lib/cjs/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +28 -70
- package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -0
- package/lib/cjs/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +69 -22
- package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -0
- package/lib/cjs/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +174 -49
- package/lib/cjs/annotations/TextBlockLayout.js.map +1 -0
- package/lib/cjs/core-backend.d.ts +7 -3
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +27 -6
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/internal/ElementLRUCache.d.ts +23 -0
- package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -1
- package/lib/cjs/internal/ElementLRUCache.js +167 -3
- package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
- package/lib/cjs/internal/Symbols.d.ts +1 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +2 -1
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/internal/annotations/fields.d.ts +22 -0
- package/lib/cjs/internal/annotations/fields.d.ts.map +1 -0
- package/lib/cjs/internal/annotations/fields.js +237 -0
- package/lib/cjs/internal/annotations/fields.js.map +1 -0
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +0 -1
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/lib/esm/BackendHubAccess.d.ts +1 -1
- package/lib/esm/BackendHubAccess.js +1 -1
- package/lib/esm/BackendHubAccess.js.map +1 -1
- package/lib/esm/BisCoreSchema.d.ts.map +1 -1
- package/lib/esm/BisCoreSchema.js +4 -2
- package/lib/esm/BisCoreSchema.js.map +1 -1
- package/lib/esm/BriefcaseManager.d.ts +10 -2
- package/lib/esm/BriefcaseManager.d.ts.map +1 -1
- package/lib/esm/BriefcaseManager.js +17 -1
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/Category.d.ts +4 -4
- package/lib/esm/Category.js +4 -4
- package/lib/esm/Category.js.map +1 -1
- package/lib/esm/ChangesetECAdaptor.d.ts +67 -8
- package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/esm/ChangesetECAdaptor.js +248 -33
- package/lib/esm/ChangesetECAdaptor.js.map +1 -1
- package/lib/esm/ClassRegistry.d.ts +9 -1
- package/lib/esm/ClassRegistry.d.ts.map +1 -1
- package/lib/esm/ClassRegistry.js +9 -1
- package/lib/esm/ClassRegistry.js.map +1 -1
- package/lib/esm/CloudSqlite.js +1 -1
- package/lib/esm/CloudSqlite.js.map +1 -1
- package/lib/esm/CodeSpecs.d.ts +1 -1
- package/lib/esm/CodeSpecs.js +1 -1
- package/lib/esm/CodeSpecs.js.map +1 -1
- package/lib/esm/DisplayStyle.d.ts +4 -4
- package/lib/esm/DisplayStyle.js +3 -3
- package/lib/esm/DisplayStyle.js.map +1 -1
- package/lib/esm/ECDb.d.ts +4 -4
- package/lib/esm/ECDb.d.ts.map +1 -1
- package/lib/esm/ECDb.js +4 -4
- package/lib/esm/ECDb.js.map +1 -1
- package/lib/esm/ECSqlStatement.d.ts +15 -6
- package/lib/esm/ECSqlStatement.d.ts.map +1 -1
- package/lib/esm/ECSqlStatement.js +19 -4
- package/lib/esm/ECSqlStatement.js.map +1 -1
- package/lib/esm/Element.d.ts +54 -51
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +67 -52
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/ElementAspect.d.ts +8 -8
- package/lib/esm/ElementAspect.d.ts.map +1 -1
- package/lib/esm/ElementAspect.js +8 -8
- package/lib/esm/ElementAspect.js.map +1 -1
- package/lib/esm/Entity.d.ts +10 -7
- package/lib/esm/Entity.d.ts.map +1 -1
- package/lib/esm/Entity.js +36 -14
- package/lib/esm/Entity.js.map +1 -1
- package/lib/esm/ExportGraphics.d.ts +54 -8
- package/lib/esm/ExportGraphics.d.ts.map +1 -1
- package/lib/esm/ExportGraphics.js +156 -58
- package/lib/esm/ExportGraphics.js.map +1 -1
- package/lib/esm/GeographicCRSServices.d.ts +6 -2
- package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
- package/lib/esm/GeographicCRSServices.js +1 -1
- package/lib/esm/GeographicCRSServices.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +37 -26
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +128 -51
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelElementCloneContext.d.ts +1 -1
- package/lib/esm/IModelElementCloneContext.d.ts.map +1 -1
- package/lib/esm/IModelElementCloneContext.js +1 -1
- package/lib/esm/IModelElementCloneContext.js.map +1 -1
- package/lib/esm/IModelHost.d.ts +2 -3
- package/lib/esm/IModelHost.d.ts.map +1 -1
- package/lib/esm/IModelHost.js +2 -3
- package/lib/esm/IModelHost.js.map +1 -1
- package/lib/esm/IModelIncrementalSchemaLocater.d.ts +36 -0
- package/lib/esm/IModelIncrementalSchemaLocater.d.ts.map +1 -0
- package/lib/esm/IModelIncrementalSchemaLocater.js +65 -0
- package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -0
- package/lib/esm/LocalHub.d.ts.map +1 -1
- package/lib/esm/LocalHub.js +6 -4
- package/lib/esm/LocalHub.js.map +1 -1
- package/lib/esm/Material.d.ts +4 -3
- package/lib/esm/Material.d.ts.map +1 -1
- package/lib/esm/Material.js +5 -5
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Model.d.ts +22 -22
- package/lib/esm/Model.js +22 -22
- package/lib/esm/Model.js.map +1 -1
- package/lib/esm/Relationship.d.ts +3 -0
- package/lib/esm/Relationship.d.ts.map +1 -1
- package/lib/esm/Relationship.js +15 -0
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/SQLiteDb.d.ts +1 -1
- package/lib/esm/SQLiteDb.js +1 -1
- package/lib/esm/SQLiteDb.js.map +1 -1
- package/lib/esm/Schema.d.ts +25 -0
- package/lib/esm/Schema.d.ts.map +1 -1
- package/lib/esm/Schema.js +25 -0
- package/lib/esm/Schema.js.map +1 -1
- package/lib/esm/SqliteStatement.d.ts +1 -1
- package/lib/esm/SqliteStatement.d.ts.map +1 -1
- package/lib/esm/SqliteStatement.js +1 -1
- package/lib/esm/SqliteStatement.js.map +1 -1
- package/lib/esm/Texture.d.ts +1 -1
- package/lib/esm/Texture.js +1 -1
- package/lib/esm/Texture.js.map +1 -1
- package/lib/esm/TxnManager.d.ts +4 -4
- package/lib/esm/TxnManager.js +1 -1
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewDefinition.d.ts +40 -14
- package/lib/esm/ViewDefinition.d.ts.map +1 -1
- package/lib/esm/ViewDefinition.js +42 -14
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +61 -0
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -0
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js +105 -0
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -0
- package/lib/esm/annotations/FrameGeometry.d.ts +51 -0
- package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -0
- package/lib/esm/annotations/FrameGeometry.js +244 -0
- package/lib/esm/annotations/FrameGeometry.js.map +1 -0
- package/lib/esm/annotations/LeaderGeometry.d.ts +53 -0
- package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -0
- package/lib/esm/annotations/LeaderGeometry.js +179 -0
- package/lib/esm/annotations/LeaderGeometry.js.map +1 -0
- package/lib/esm/annotations/TextAnnotationElement.d.ts +204 -0
- package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -0
- package/lib/esm/annotations/TextAnnotationElement.js +405 -0
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -0
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts +33 -0
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -0
- package/lib/esm/annotations/TextAnnotationGeometry.js +134 -0
- package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -0
- package/lib/esm/annotations/TextBlockGeometry.d.ts +16 -0
- package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -0
- package/lib/esm/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +28 -70
- package/lib/esm/annotations/TextBlockGeometry.js.map +1 -0
- package/lib/esm/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +69 -22
- package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -0
- package/lib/esm/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +172 -48
- package/lib/esm/annotations/TextBlockLayout.js.map +1 -0
- package/lib/esm/core-backend.d.ts +7 -3
- package/lib/esm/core-backend.d.ts.map +1 -1
- package/lib/esm/core-backend.js +27 -3
- package/lib/esm/core-backend.js.map +1 -1
- package/lib/esm/internal/ElementLRUCache.d.ts +23 -0
- package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -1
- package/lib/esm/internal/ElementLRUCache.js +165 -2
- package/lib/esm/internal/ElementLRUCache.js.map +1 -1
- package/lib/esm/internal/Symbols.d.ts +1 -0
- package/lib/esm/internal/Symbols.d.ts.map +1 -1
- package/lib/esm/internal/Symbols.js +1 -0
- package/lib/esm/internal/Symbols.js.map +1 -1
- package/lib/esm/internal/annotations/fields.d.ts +22 -0
- package/lib/esm/internal/annotations/fields.d.ts.map +1 -0
- package/lib/esm/internal/annotations/fields.js +231 -0
- package/lib/esm/internal/annotations/fields.js.map +1 -0
- package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/esm/test/AnnotationTestUtils.d.ts +15 -0
- package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -0
- package/lib/esm/test/AnnotationTestUtils.js +41 -0
- package/lib/esm/test/AnnotationTestUtils.js.map +1 -0
- package/lib/esm/test/ElementLRUCache.test.js +224 -1
- package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
- package/lib/esm/test/IModelTestUtils.js +1 -0
- package/lib/esm/test/IModelTestUtils.js.map +1 -1
- package/lib/esm/test/TestUtils.d.ts +1 -1
- package/lib/esm/test/TestUtils.d.ts.map +1 -1
- package/lib/esm/test/TestUtils.js +1 -1
- package/lib/esm/test/TestUtils.js.map +1 -1
- package/lib/esm/test/annotations/Fields.test.d.ts +2 -0
- package/lib/esm/test/annotations/Fields.test.d.ts.map +1 -0
- package/lib/esm/test/annotations/Fields.test.js +576 -0
- package/lib/esm/test/annotations/Fields.test.js.map +1 -0
- package/lib/esm/test/annotations/FrameGeometry.test.d.ts +2 -0
- package/lib/esm/test/annotations/FrameGeometry.test.d.ts.map +1 -0
- package/lib/esm/test/annotations/FrameGeometry.test.js +86 -0
- package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -0
- package/lib/esm/test/annotations/LeaderGeometry.test.d.ts +2 -0
- package/lib/esm/test/annotations/LeaderGeometry.test.d.ts.map +1 -0
- package/lib/esm/test/annotations/LeaderGeometry.test.js +256 -0
- package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -0
- package/lib/esm/test/annotations/TextAnnotation.test.js +269 -1047
- package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
- package/lib/esm/test/annotations/TextBlock.test.d.ts +2 -0
- package/lib/esm/test/annotations/TextBlock.test.d.ts.map +1 -0
- package/lib/esm/test/annotations/TextBlock.test.js +1199 -0
- package/lib/esm/test/annotations/TextBlock.test.js.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.d.ts +60 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.d.ts.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js +69 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts +1442 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +817 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -0
- package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts +2 -0
- package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js +164 -0
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -0
- package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +22 -32
- package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECDb.test.js +29 -8
- package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlQuery.test.js +0 -55
- package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlStatement.test.js +192 -0
- package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
- package/lib/esm/test/hubaccess/ApplyChangeset.test.d.ts +2 -0
- package/lib/esm/test/hubaccess/ApplyChangeset.test.d.ts.map +1 -0
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js +86 -0
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -0
- package/lib/esm/test/imodel/IModel.test.js +313 -5
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.d.ts +2 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +343 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.d.ts +2 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +207 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts +11 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js +36 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts +17 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js +116 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +9 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +20 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -0
- package/lib/esm/test/misc/GeoServices.test.js +36 -10
- package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
- package/lib/esm/test/schema/ClassRegistry.test.js +104 -2
- package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +547 -136
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/ExportGraphics.test.js +53 -1
- package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
- package/lib/esm/test/standalone/GeometryStream.test.js +49 -1
- package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
- package/lib/esm/test/standalone/IModelLimits.test.d.ts +2 -0
- package/lib/esm/test/standalone/IModelLimits.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/IModelLimits.test.js +103 -0
- package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -0
- package/lib/esm/test/standalone/RenderMaterialElement.test.js +24 -1
- package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js +19 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
- package/lib/esm/workspace/Workspace.d.ts +0 -1
- package/lib/esm/workspace/Workspace.d.ts.map +1 -1
- package/lib/esm/workspace/Workspace.js.map +1 -1
- package/package.json +21 -15
- package/lib/cjs/TextAnnotationElement.d.ts +0 -54
- package/lib/cjs/TextAnnotationElement.d.ts.map +0 -1
- package/lib/cjs/TextAnnotationElement.js +0 -94
- package/lib/cjs/TextAnnotationElement.js.map +0 -1
- package/lib/cjs/TextAnnotationGeometry.d.ts +0 -32
- package/lib/cjs/TextAnnotationGeometry.d.ts.map +0 -1
- package/lib/cjs/TextAnnotationGeometry.js.map +0 -1
- package/lib/cjs/TextAnnotationLayout.d.ts.map +0 -1
- package/lib/cjs/TextAnnotationLayout.js.map +0 -1
- package/lib/esm/TextAnnotationElement.d.ts +0 -54
- package/lib/esm/TextAnnotationElement.d.ts.map +0 -1
- package/lib/esm/TextAnnotationElement.js +0 -89
- package/lib/esm/TextAnnotationElement.js.map +0 -1
- package/lib/esm/TextAnnotationGeometry.d.ts +0 -32
- package/lib/esm/TextAnnotationGeometry.d.ts.map +0 -1
- package/lib/esm/TextAnnotationGeometry.js.map +0 -1
- package/lib/esm/TextAnnotationLayout.d.ts.map +0 -1
- package/lib/esm/TextAnnotationLayout.js.map +0 -1
package/lib/esm/SQLiteDb.js
CHANGED
|
@@ -82,7 +82,7 @@ export class SQLiteDb {
|
|
|
82
82
|
return new IModelNative.platform.BlobIO();
|
|
83
83
|
}
|
|
84
84
|
/** alias for closeDb.
|
|
85
|
-
* @deprecated in 4.0
|
|
85
|
+
* @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[closeDb]]
|
|
86
86
|
*/
|
|
87
87
|
dispose() {
|
|
88
88
|
this.closeDb();
|
package/lib/esm/SQLiteDb.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SQLiteDb.js","sourceRoot":"","sources":["../../src/SQLiteDb.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAY,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAiB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,0CAA0C;AAE1C,0DAA0D;AAG1D;;;GAGG;AACH,MAAM,OAAO,QAAQ;IACnB,gBAAgB;IACA,CAAC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AEG;IACH,IAAY,cASX;IATD,WAAY,cAAc;QACxB,4GAA4G;QAC5G,mDAAQ,CAAA;QACR,4FAA4F;QAC5F,2DAAY,CAAA;QACZ,yEAAyE;QACzE,6DAAa,CAAA;QACb,yEAAyE;QACzE,6DAAa,CAAA;IACf,CAAC,EATW,cAAc,GAAd,uBAAc,KAAd,uBAAc,QASzB;AAgDH,CAAC,EAjIgB,QAAQ,KAAR,QAAQ,QAiIxB","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 SQLiteDb\n */\n\nimport * as fs from \"fs\";\nimport { dirname } from \"path\";\nimport * as semver from \"semver\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { DbResult, OpenMode } from \"@itwin/core-bentley\";\nimport { LocalFileName, SqliteError } from \"@itwin/core-common\";\nimport { CloudSqlite } from \"./CloudSqlite\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { IModelJsFs } from \"./IModelJsFs\";\nimport { SqliteStatement, StatementCache } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\n\n// cspell:ignore savepoint julianday rowid\n\n/* eslint-disable @typescript-eslint/unified-signatures */\n\n\n/**\n * A \"generic\" SQLiteDb. This class may be used to access local files or databases in a cloud container.\n * @public\n */\nexport class SQLiteDb {\n /** @internal */\n public readonly [_nativeDb] = new IModelNative.platform.SQLiteDb();\n private _sqliteStatementCache = new StatementCache<SqliteStatement>();\n\n /** @internal */\n public static createBlobIO(): SQLiteDb.BlobIO {\n return new IModelNative.platform.BlobIO();\n }\n\n /** alias for closeDb.\n * @deprecated in 4.0, use [[closeDb]]\n */\n public dispose(): void {\n this.closeDb();\n }\n\n /** Create a SQLiteDb\n * @param dbName The path to the SQLiteDb file to create.\n */\n public createDb(dbName: string): void;\n /** @beta */\n public createDb(dbName: string, container?: CloudSqlite.CloudContainer, params?: SQLiteDb.CreateParams): void;\n public createDb(dbName: string, container?: CloudSqlite.CloudContainer, params?: SQLiteDb.CreateParams): void {\n this[_nativeDb].createDb(dbName, container, params);\n }\n\n /** Open a SQLiteDb.\n * @param dbName The path to the SQLiteDb file to open\n */\n public openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams): void;\n /**\n * @param container optional CloudContainer holding database\n * @beta\n */\n public openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer): void;\n public openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer): void {\n this[_nativeDb].openDb(dbName, openMode, container);\n }\n\n /** Close SQLiteDb.\n * @param saveChanges if true, call `saveChanges` before closing db. Otherwise unsaved changes are abandoned.\n */\n public closeDb(saveChanges?: boolean): void {\n if (saveChanges && this.isOpen)\n this.saveChanges();\n this._sqliteStatementCache.clear();\n this[_nativeDb].closeDb();\n }\n\n /** Returns true if this SQLiteDb is open */\n public get isOpen(): boolean { return this[_nativeDb].isOpen(); }\n\n /** Returns true if this SQLiteDb is open readonly */\n public get isReadonly(): boolean { return this[_nativeDb].isReadonly(); }\n\n /** Create a new table in this database. */\n protected createTable(args: {\n /** The name of the table to create. */\n tableName: string;\n /** all of the columns in the table. */\n columns: string;\n /** any unique or foreign key constraints */\n constraints?: string;\n /** if true, add a \"lastMod\" timestamp column and triggers to automatically update it. */\n addTimestamp?: boolean;\n }) {\n const timestampCol = args.addTimestamp ? \",lastMod TIMESTAMP NOT NULL DEFAULT(julianday('now'))\" : \"\";\n const constraints = args.constraints ? `,${args.constraints}` : \"\";\n this.executeSQL(`CREATE TABLE ${args.tableName}(${args.columns}${timestampCol}${constraints})`);\n if (args.addTimestamp)\n this.executeSQL(`CREATE TRIGGER ${args.tableName}_timestamp AFTER UPDATE ON ${args.tableName} WHEN old.lastMod=new.lastMod AND old.lastMod != julianday('now') BEGIN UPDATE ${args.tableName} SET lastMod=julianday('now') WHERE rowid=new.rowid; END`);\n }\n\n /**\n * Get the last modified date for a row in a table of this database.\n * @note the table must have been created with `addTimestamp: true`\n */\n public readLastModTime(tableName: string, rowId: number): Date {\n return this.withSqliteStatement(`SELECT lastMod from ${tableName} WHERE rowid=?`, (stmt) => {\n stmt.bindInteger(1, rowId);\n return stmt.getValueDate(0);\n });\n }\n\n /**\n * Open a database, perform an operation, then close the database.\n *\n * Details:\n * - if database is open, throw an error\n * - open a database\n * - call a function with the database opened. If it is async, await its return.\n * - if function throws, abandon all changes, close database, and rethrow\n * - save all changes\n * - close the database\n * @return value from operation\n */\n public withOpenDb<T>(args: SQLiteDb.WithOpenDbArgs, operation: () => T): T {\n if (this.isOpen)\n SqliteError.throwError(\"already-open\", \"database is already open\", args.dbName);\n\n const save = () => this.closeDb(true), abandon = () => this.closeDb(false);\n this.openDb(args.dbName, args.openMode ?? OpenMode.Readonly, args.container);\n try {\n const result = operation();\n result instanceof Promise ? result.then(save, abandon) : save();\n return result;\n } catch (e) {\n abandon();\n throw e;\n }\n }\n\n /** The cloud container backing this SQLite database, if any.\n * @beta\n */\n public get cloudContainer(): CloudSqlite.CloudContainer | undefined {\n return this[_nativeDb].cloudContainer;\n }\n\n /** Returns the Id of the most-recently-inserted row in this database, per [sqlite3_last_insert_rowid](https://www.sqlite.org/c3ref/last_insert_rowid.html). */\n public getLastInsertRowId(): number {\n return this[_nativeDb].getLastInsertRowId();\n }\n\n /**\n * Perform an operation on a database in a CloudContainer with the write lock held.\n *\n * Details:\n * - acquire the write lock on a CloudContainer\n * - call `withOpenDb` with openMode `ReadWrite`\n * - upload changes\n * - release the write lock\n * @param args arguments to lock the container and open the database\n * @param operation an operation performed on the database with the write lock held.\n * @return value from operation\n * @internal\n */\n public async withLockedContainer<T>(args: CloudSqlite.LockAndOpenArgs, operation: () => Promise<T>) {\n return CloudSqlite.withWriteLock(args, async () => this.withOpenDb({ ...args, openMode: args.openMode ?? OpenMode.ReadWrite }, operation));\n }\n\n /** vacuum this database\n * @see https://www.sqlite.org/lang_vacuum.html\n */\n public vacuum(args?: SQLiteDb.VacuumDbArgs) {\n this[_nativeDb].vacuum(args);\n }\n\n /** Commit the outermost transaction, writing changes to the file. Then, restart the default transaction. */\n public saveChanges(): void {\n this[_nativeDb].saveChanges();\n }\n\n /** Abandon (cancel) the outermost transaction, discarding all changes since last save. Then, restart the default transaction. */\n public abandonChanges(): void {\n this[_nativeDb].abandonChanges();\n }\n\n /**\n * Use a prepared SQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for SQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @returns the value returned by `callback`.\n */\n public withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T {\n const stmt = this._sqliteStatementCache.findAndRemove(sql) ?? this.prepareSqliteStatement(sql);\n const release = () => this._sqliteStatementCache.addOrDispose(stmt);\n try {\n const val = callback(stmt);\n val instanceof Promise ? val.then(release, release) : release();\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepare and execute a callback on a SQL statement. After the callback completes the statement is disposed.\n * Use this method for SQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @returns the value returned by `callback`.\n */\n public withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T {\n const stmt = this.prepareSqliteStatement(sql);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val = callback(stmt);\n val instanceof Promise ? val.then(release, release) : release();\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Perform an operation on this database within a [savepoint](https://www.sqlite.org/lang_savepoint.html). If the operation completes successfully, the\n * changes remain in the current transaction. If the operation throws an exception, the savepoint is rolled back\n * and all changes to the database from this method are reversed, leaving the transaction exactly as it was before this method.\n */\n public withSavePoint(savePointName: string, operation: () => void) {\n if (this.isReadonly)\n SqliteError.throwError(\"readonly\", \"database is readonly\", this[_nativeDb].getFilePath());\n\n this.executeSQL(`SAVEPOINT ${savePointName}`);\n try {\n operation();\n this.executeSQL(`RELEASE ${savePointName}`);\n } catch (e) {\n this.executeSQL(`ROLLBACK TO ${savePointName}`);\n throw e;\n }\n }\n\n /** Prepare an SQL statement.\n * @param sql The SQLite SQL statement to prepare\n * @param logErrors Determine if errors are logged or not\n * @internal\n */\n public prepareSqliteStatement(sql: string, logErrors = true): SqliteStatement {\n const stmt = new SqliteStatement(sql);\n stmt.prepare(this[_nativeDb], logErrors);\n return stmt;\n }\n\n /** execute an SQL statement */\n public executeSQL(sql: string): DbResult {\n using stmt = this.prepareSqliteStatement(sql);\n return stmt.step();\n }\n}\n\n/**\n * Abstract base class for a SQLite database that has [[SQLiteDb.RequiredVersionRanges]] stored in it.\n * This class provides version checking when the database is opened, to guarantee that a valid version of software is\n * always used for access.\n *\n * Notes:\n * - This class may be used either to access a local file, or one stored in a cloud container.\n * - Subclasses must provide a `myVersion` member indicating the version of its software, and implement the `createDDL` member to create its\n * tables.\n * @beta\n */\nexport abstract class VersionedSqliteDb extends SQLiteDb {\n protected static _versionProps = { namespace: \"SQLiteDb\", name: \"versions\" } as const;\n\n /** The current semver \"persistence version\" of this class.\n * @note This value should only be changed when logic in its code is modified in a way that affects the operation of extant copies.\n * If this value is outside of the range of accepted versions of a to-be-opened VersionedSqliteDb, the operation will fail. In this manner, if\n * changes are made to the format of a VersionedSqliteDb, or if bug fixes are necessary, the `requiredVersions` property in a VersionedSqliteDb may be updated\n * and immediately old versions of the package will refuse to open the VersionedSqliteDb, with a message to the user that they need to upgrade their\n * software. Likewise, if a new version of the package is asked to open an older VersionedSqliteDb that has not been upgraded to the lowest version\n * supported by it, the user will be informed that they need to upgrade their software.\n * @note this identifier is independent of versions in `package.json` files.\n */\n public abstract myVersion: string;\n\n /**\n * Change the \"versions required to open this database\" property stored in this database. After this call,\n * versions of software that don't meet the supplied ranges will fail.\n * @param versions the new versions required for reading and writing this database.\n * @note the database must be opened for write access.\n */\n public setRequiredVersions(versions: SQLiteDb.RequiredVersionRanges) {\n // NOTE: It might look tempting to just stringify the supplied `versions` object, but we only include required members - there may be others.\n this[_nativeDb].saveFileProperty(VersionedSqliteDb._versionProps, JSON.stringify({ readVersion: versions.readVersion, writeVersion: versions.writeVersion }));\n }\n\n /** Get the required version ranges necessary to open this VersionedSqliteDb. */\n public getRequiredVersions() {\n const checkIsString = (value: any) => {\n if (typeof value !== \"string\")\n SqliteError.throwError(\"invalid-versions-property\", `CloudDb has invalid \"versions\" property`, this[_nativeDb].getFilePath());\n return value;\n };\n const versionJson = checkIsString(this[_nativeDb].queryFileProperty(VersionedSqliteDb._versionProps, true));\n const versionRanges = JSON.parse(versionJson) as SQLiteDb.RequiredVersionRanges;\n checkIsString(versionRanges.readVersion);\n checkIsString(versionRanges.writeVersion);\n return versionRanges;\n }\n\n /**\n * Implement this method to create all tables for this subclass of `VersionedSqliteDb` when a new database file is created. Called from [[createNewDb]].\n */\n protected abstract createDDL(args: any): void;\n\n /**\n * Create a new database file for the subclass of VersionedSqliteDb.\n * @note The required versions are saved as [[myVersion]] or newer for both read and write.\n */\n public static createNewDb(fileName: LocalFileName, setupArgs?: any) {\n const db = new (this as any)() as VersionedSqliteDb; // \"as any\" necessary because VersionedSqliteDb is abstract\n IModelJsFs.recursiveMkDirSync(dirname(fileName));\n if (fs.existsSync(fileName))\n fs.unlinkSync(fileName);\n\n db.createDb(fileName);\n db.createDDL(setupArgs);\n const minVer = `^${db.myVersion}`;\n db.setRequiredVersions({ readVersion: minVer, writeVersion: minVer });\n db.closeDb(true);\n }\n\n /**\n * Verify that this version of the software meets the required version range (as appropriate, read or write) stored in the database.\n * Throws otherwise.\n */\n protected verifyVersions() {\n const versions = this.getRequiredVersions();\n const isReadonly = this.isReadonly; // so we can tell read/write after the file is closed.\n const range = isReadonly ? versions.readVersion : versions.writeVersion;\n if (semver.satisfies(this.myVersion, range))\n return;\n\n this.closeDb();\n const tooNew = semver.gtr(this.myVersion, range);\n SqliteError.throwError(\"incompatible-version\", `requires ${tooNew ? \"older\" : \"newer\"} version of ${this.constructor.name} for ${isReadonly ? \"read\" : \"write\"}`, this[_nativeDb].getFilePath());\n\n }\n\n /**\n * Open this database and verify that this version of the software meets the required version range (as appropriate, read or write) stored in the database.\n * Throws otherwise.\n * @see [[SqliteDb.openDb]] for argument types\n */\n public override openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer) {\n super.openDb(dbName, openMode, container);\n this.verifyVersions();\n }\n\n public async upgradeSchema(arg: { dbName: string, lockContainer?: { container: CloudSqlite.CloudContainer, user: string }, upgradeFn: () => void }) {\n // can't use \"this\" because it checks for version, which we don't want here\n return (arg.lockContainer) ?\n super.withLockedContainer({ dbName: arg.dbName, ...arg.lockContainer }, async () => arg.upgradeFn) :\n super.withOpenDb({ ...arg, openMode: OpenMode.ReadWrite }, arg.upgradeFn);\n }\n}\n\n/** @public */\nexport namespace SQLiteDb {\n /** A semver version range.\n * @see https://docs.npmjs.com/cli/v6/using-npm/semver\n */\n export type VersionRange = string;\n\n /**\n * A pair of semver [[SQLiteDb.VersionRange]]s, one for read and one for write, required to access a [[VersionedSqliteDb]].\n * If the version of the software attempting to read or write the database does not satisfy the range, access is denied.\n */\n export interface RequiredVersionRanges {\n /** a range of acceptable persistence versions for reading from a VersionedSqliteDb. */\n readonly readVersion: VersionRange;\n /** a range of acceptable persistence versions for writing to a VersionedSqliteDb. */\n readonly writeVersion: VersionRange;\n }\n\n /** interface for reading and writing to a blob in a SQLiteDb\n * @internal\n */\n export interface BlobIO {\n /** Close this BlobIO if it is opened.\n * @note this BlobIO *may* be reused after this call by calling `open` again.\n */\n close(): void;\n /** get the total number of bytes in the blob */\n getNumBytes(): number;\n /** @return true if this BlobIO was successfully opened and may be use to read or write the blob */\n isValid(): boolean;\n /** Open this BlobIO against a table/row/column in a Db */\n open(\n /** The database for the blob */\n db: IModelJsNative.AnyDb,\n args: {\n /** the name of the table for the blob*/\n tableName: string;\n /** the name of the column for the blob */\n columnName: string;\n /** The rowId of the blob */\n row: number;\n /** If true, open this BlobIO for write access */\n writeable?: boolean;\n }): void;\n /** Read from a blob\n * @returns the contents of the requested byte range\n */\n read(args: {\n /** The number of bytes to read */\n numBytes: number;\n /** starting offset within the blob to read */\n offset: number;\n /** If present and of sufficient size, use this ArrayBuffer for the value. */\n blob?: ArrayBuffer;\n }): Uint8Array;\n /** Reposition this BlobIO to a new rowId\n * @note this BlobIO must be valid when this methods is called.\n */\n changeRow(row: number): void;\n /** Write to a blob */\n write(args: {\n /** The number of bytes to write */\n numBytes: number;\n /** starting offset within the blob to write */\n offset: number;\n /** the value to write */\n blob: ArrayBuffer;\n }): void;\n }\n\n /** Default transaction mode for SQLiteDbs.\n * @see https://www.sqlite.org/lang_transaction.html\n */\n export enum DefaultTxnMode {\n /** no default transaction is started. You must use BEGIN/COMMIT or SQLite will use implicit transactions */\n None = 0,\n /** A deferred transaction is started when the file is first opened. This is the default. */\n Deferred = 1,\n /** An immediate transaction is started when the file is first opened. */\n Immediate = 2,\n /** An exclusive transaction is started when the file is first opened. */\n Exclusive = 3\n }\n\n /** parameters common to opening or creating a new SQLiteDb */\n export interface OpenOrCreateParams {\n /** If true, do not require that the `be_Prop` table exist */\n rawSQLite?: boolean;\n /** @see immutable option at https://www.sqlite.org/c3ref/open.html */\n immutable?: boolean;\n /** Do not attempt to verify that the file is a valid sQLite file before opening. */\n skipFileCheck?: boolean;\n /** the default transaction mode\n * @see [[SQLiteDb.DefaultTxnMode]]\n */\n defaultTxn?: 0 | 1 | 2 | 3;\n /** see query parameters from 'URI Filenames' in https://www.sqlite.org/c3ref/open.html */\n queryParam?: string;\n }\n\n /** Parameters for opening an existing SQLiteDb */\n export interface OpenParams extends OpenOrCreateParams {\n /** use OpenMode.ReadWrite to open the file with write access */\n openMode: OpenMode;\n }\n\n /** Size of a SQLiteDb page in bytes */\n export interface PageSize {\n /** see https://www.sqlite.org/pragma.html#pragma_page_size */\n pageSize?: number;\n }\n\n /** Parameters for creating a new SQLiteDb */\n export type CreateParams = OpenOrCreateParams & PageSize;\n\n /** Arguments for `SqliteDb.withOpenDb` */\n export interface WithOpenDbArgs {\n /** The name of the database to open */\n dbName: string;\n /** either an object with the open parameters or just OpenMode value. */\n openMode?: OpenMode | SQLiteDb.OpenParams;\n /** @internal */\n container?: CloudSqlite.CloudContainer;\n }\n\n /** Arguments for `SQLiteDb.vacuum` */\n export interface VacuumDbArgs extends PageSize {\n /** if present, name of new file to [vacuum into](https://www.sqlite.org/lang_vacuum.html) */\n into?: LocalFileName;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SQLiteDb.js","sourceRoot":"","sources":["../../src/SQLiteDb.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAY,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAiB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,S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,EAAE,QAAQ,CAAC,SAAS,EAAE,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9E,CAAC;;AAGH,cAAc;AACd,WAAiB,QAAQ;IAqEvB;;OAEG;IACH,IAAY,cASX;IATD,WAAY,cAAc;QACxB,4GAA4G;QAC5G,mDAAQ,CAAA;QACR,4FAA4F;QAC5F,2DAAY,CAAA;QACZ,yEAAyE;QACzE,6DAAa,CAAA;QACb,yEAAyE;QACzE,6DAAa,CAAA;IACf,CAAC,EATW,cAAc,GAAd,uBAAc,KAAd,uBAAc,QASzB;AAgDH,CAAC,EAjIgB,QAAQ,KAAR,QAAQ,QAiIxB","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 SQLiteDb\n */\n\nimport * as fs from \"fs\";\nimport { dirname } from \"path\";\nimport * as semver from \"semver\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { DbResult, OpenMode } from \"@itwin/core-bentley\";\nimport { LocalFileName, SqliteError } from \"@itwin/core-common\";\nimport { CloudSqlite } from \"./CloudSqlite\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { IModelJsFs } from \"./IModelJsFs\";\nimport { SqliteStatement, StatementCache } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\n\n// cspell:ignore savepoint julianday rowid\n\n/* eslint-disable @typescript-eslint/unified-signatures */\n\n\n/**\n * A \"generic\" SQLiteDb. This class may be used to access local files or databases in a cloud container.\n * @public\n */\nexport class SQLiteDb {\n /** @internal */\n public readonly [_nativeDb] = new IModelNative.platform.SQLiteDb();\n private _sqliteStatementCache = new StatementCache<SqliteStatement>();\n\n /** @internal */\n public static createBlobIO(): SQLiteDb.BlobIO {\n return new IModelNative.platform.BlobIO();\n }\n\n /** alias for closeDb.\n * @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[closeDb]]\n */\n public dispose(): void {\n this.closeDb();\n }\n\n /** Create a SQLiteDb\n * @param dbName The path to the SQLiteDb file to create.\n */\n public createDb(dbName: string): void;\n /** @beta */\n public createDb(dbName: string, container?: CloudSqlite.CloudContainer, params?: SQLiteDb.CreateParams): void;\n public createDb(dbName: string, container?: CloudSqlite.CloudContainer, params?: SQLiteDb.CreateParams): void {\n this[_nativeDb].createDb(dbName, container, params);\n }\n\n /** Open a SQLiteDb.\n * @param dbName The path to the SQLiteDb file to open\n */\n public openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams): void;\n /**\n * @param container optional CloudContainer holding database\n * @beta\n */\n public openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer): void;\n public openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer): void {\n this[_nativeDb].openDb(dbName, openMode, container);\n }\n\n /** Close SQLiteDb.\n * @param saveChanges if true, call `saveChanges` before closing db. Otherwise unsaved changes are abandoned.\n */\n public closeDb(saveChanges?: boolean): void {\n if (saveChanges && this.isOpen)\n this.saveChanges();\n this._sqliteStatementCache.clear();\n this[_nativeDb].closeDb();\n }\n\n /** Returns true if this SQLiteDb is open */\n public get isOpen(): boolean { return this[_nativeDb].isOpen(); }\n\n /** Returns true if this SQLiteDb is open readonly */\n public get isReadonly(): boolean { return this[_nativeDb].isReadonly(); }\n\n /** Create a new table in this database. */\n protected createTable(args: {\n /** The name of the table to create. */\n tableName: string;\n /** all of the columns in the table. */\n columns: string;\n /** any unique or foreign key constraints */\n constraints?: string;\n /** if true, add a \"lastMod\" timestamp column and triggers to automatically update it. */\n addTimestamp?: boolean;\n }) {\n const timestampCol = args.addTimestamp ? \",lastMod TIMESTAMP NOT NULL DEFAULT(julianday('now'))\" : \"\";\n const constraints = args.constraints ? `,${args.constraints}` : \"\";\n this.executeSQL(`CREATE TABLE ${args.tableName}(${args.columns}${timestampCol}${constraints})`);\n if (args.addTimestamp)\n this.executeSQL(`CREATE TRIGGER ${args.tableName}_timestamp AFTER UPDATE ON ${args.tableName} WHEN old.lastMod=new.lastMod AND old.lastMod != julianday('now') BEGIN UPDATE ${args.tableName} SET lastMod=julianday('now') WHERE rowid=new.rowid; END`);\n }\n\n /**\n * Get the last modified date for a row in a table of this database.\n * @note the table must have been created with `addTimestamp: true`\n */\n public readLastModTime(tableName: string, rowId: number): Date {\n return this.withSqliteStatement(`SELECT lastMod from ${tableName} WHERE rowid=?`, (stmt) => {\n stmt.bindInteger(1, rowId);\n return stmt.getValueDate(0);\n });\n }\n\n /**\n * Open a database, perform an operation, then close the database.\n *\n * Details:\n * - if database is open, throw an error\n * - open a database\n * - call a function with the database opened. If it is async, await its return.\n * - if function throws, abandon all changes, close database, and rethrow\n * - save all changes\n * - close the database\n * @return value from operation\n */\n public withOpenDb<T>(args: SQLiteDb.WithOpenDbArgs, operation: () => T): T {\n if (this.isOpen)\n SqliteError.throwError(\"already-open\", \"database is already open\", args.dbName);\n\n const save = () => this.closeDb(true), abandon = () => this.closeDb(false);\n this.openDb(args.dbName, args.openMode ?? OpenMode.Readonly, args.container);\n try {\n const result = operation();\n result instanceof Promise ? result.then(save, abandon) : save();\n return result;\n } catch (e) {\n abandon();\n throw e;\n }\n }\n\n /** The cloud container backing this SQLite database, if any.\n * @beta\n */\n public get cloudContainer(): CloudSqlite.CloudContainer | undefined {\n return this[_nativeDb].cloudContainer;\n }\n\n /** Returns the Id of the most-recently-inserted row in this database, per [sqlite3_last_insert_rowid](https://www.sqlite.org/c3ref/last_insert_rowid.html). */\n public getLastInsertRowId(): number {\n return this[_nativeDb].getLastInsertRowId();\n }\n\n /**\n * Perform an operation on a database in a CloudContainer with the write lock held.\n *\n * Details:\n * - acquire the write lock on a CloudContainer\n * - call `withOpenDb` with openMode `ReadWrite`\n * - upload changes\n * - release the write lock\n * @param args arguments to lock the container and open the database\n * @param operation an operation performed on the database with the write lock held.\n * @return value from operation\n * @internal\n */\n public async withLockedContainer<T>(args: CloudSqlite.LockAndOpenArgs, operation: () => Promise<T>) {\n return CloudSqlite.withWriteLock(args, async () => this.withOpenDb({ ...args, openMode: args.openMode ?? OpenMode.ReadWrite }, operation));\n }\n\n /** vacuum this database\n * @see https://www.sqlite.org/lang_vacuum.html\n */\n public vacuum(args?: SQLiteDb.VacuumDbArgs) {\n this[_nativeDb].vacuum(args);\n }\n\n /** Commit the outermost transaction, writing changes to the file. Then, restart the default transaction. */\n public saveChanges(): void {\n this[_nativeDb].saveChanges();\n }\n\n /** Abandon (cancel) the outermost transaction, discarding all changes since last save. Then, restart the default transaction. */\n public abandonChanges(): void {\n this[_nativeDb].abandonChanges();\n }\n\n /**\n * Use a prepared SQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for SQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @returns the value returned by `callback`.\n */\n public withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T {\n const stmt = this._sqliteStatementCache.findAndRemove(sql) ?? this.prepareSqliteStatement(sql);\n const release = () => this._sqliteStatementCache.addOrDispose(stmt);\n try {\n const val = callback(stmt);\n val instanceof Promise ? val.then(release, release) : release();\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepare and execute a callback on a SQL statement. After the callback completes the statement is disposed.\n * Use this method for SQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @returns the value returned by `callback`.\n */\n public withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T {\n const stmt = this.prepareSqliteStatement(sql);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val = callback(stmt);\n val instanceof Promise ? val.then(release, release) : release();\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Perform an operation on this database within a [savepoint](https://www.sqlite.org/lang_savepoint.html). If the operation completes successfully, the\n * changes remain in the current transaction. If the operation throws an exception, the savepoint is rolled back\n * and all changes to the database from this method are reversed, leaving the transaction exactly as it was before this method.\n */\n public withSavePoint(savePointName: string, operation: () => void) {\n if (this.isReadonly)\n SqliteError.throwError(\"readonly\", \"database is readonly\", this[_nativeDb].getFilePath());\n\n this.executeSQL(`SAVEPOINT ${savePointName}`);\n try {\n operation();\n this.executeSQL(`RELEASE ${savePointName}`);\n } catch (e) {\n this.executeSQL(`ROLLBACK TO ${savePointName}`);\n throw e;\n }\n }\n\n /** Prepare an SQL statement.\n * @param sql The SQLite SQL statement to prepare\n * @param logErrors Determine if errors are logged or not\n * @internal\n */\n public prepareSqliteStatement(sql: string, logErrors = true): SqliteStatement {\n const stmt = new SqliteStatement(sql);\n stmt.prepare(this[_nativeDb], logErrors);\n return stmt;\n }\n\n /** execute an SQL statement */\n public executeSQL(sql: string): DbResult {\n using stmt = this.prepareSqliteStatement(sql);\n return stmt.step();\n }\n}\n\n/**\n * Abstract base class for a SQLite database that has [[SQLiteDb.RequiredVersionRanges]] stored in it.\n * This class provides version checking when the database is opened, to guarantee that a valid version of software is\n * always used for access.\n *\n * Notes:\n * - This class may be used either to access a local file, or one stored in a cloud container.\n * - Subclasses must provide a `myVersion` member indicating the version of its software, and implement the `createDDL` member to create its\n * tables.\n * @beta\n */\nexport abstract class VersionedSqliteDb extends SQLiteDb {\n protected static _versionProps = { namespace: \"SQLiteDb\", name: \"versions\" } as const;\n\n /** The current semver \"persistence version\" of this class.\n * @note This value should only be changed when logic in its code is modified in a way that affects the operation of extant copies.\n * If this value is outside of the range of accepted versions of a to-be-opened VersionedSqliteDb, the operation will fail. In this manner, if\n * changes are made to the format of a VersionedSqliteDb, or if bug fixes are necessary, the `requiredVersions` property in a VersionedSqliteDb may be updated\n * and immediately old versions of the package will refuse to open the VersionedSqliteDb, with a message to the user that they need to upgrade their\n * software. Likewise, if a new version of the package is asked to open an older VersionedSqliteDb that has not been upgraded to the lowest version\n * supported by it, the user will be informed that they need to upgrade their software.\n * @note this identifier is independent of versions in `package.json` files.\n */\n public abstract myVersion: string;\n\n /**\n * Change the \"versions required to open this database\" property stored in this database. After this call,\n * versions of software that don't meet the supplied ranges will fail.\n * @param versions the new versions required for reading and writing this database.\n * @note the database must be opened for write access.\n */\n public setRequiredVersions(versions: SQLiteDb.RequiredVersionRanges) {\n // NOTE: It might look tempting to just stringify the supplied `versions` object, but we only include required members - there may be others.\n this[_nativeDb].saveFileProperty(VersionedSqliteDb._versionProps, JSON.stringify({ readVersion: versions.readVersion, writeVersion: versions.writeVersion }));\n }\n\n /** Get the required version ranges necessary to open this VersionedSqliteDb. */\n public getRequiredVersions() {\n const checkIsString = (value: any) => {\n if (typeof value !== \"string\")\n SqliteError.throwError(\"invalid-versions-property\", `CloudDb has invalid \"versions\" property`, this[_nativeDb].getFilePath());\n return value;\n };\n const versionJson = checkIsString(this[_nativeDb].queryFileProperty(VersionedSqliteDb._versionProps, true));\n const versionRanges = JSON.parse(versionJson) as SQLiteDb.RequiredVersionRanges;\n checkIsString(versionRanges.readVersion);\n checkIsString(versionRanges.writeVersion);\n return versionRanges;\n }\n\n /**\n * Implement this method to create all tables for this subclass of `VersionedSqliteDb` when a new database file is created. Called from [[createNewDb]].\n */\n protected abstract createDDL(args: any): void;\n\n /**\n * Create a new database file for the subclass of VersionedSqliteDb.\n * @note The required versions are saved as [[myVersion]] or newer for both read and write.\n */\n public static createNewDb(fileName: LocalFileName, setupArgs?: any) {\n const db = new (this as any)() as VersionedSqliteDb; // \"as any\" necessary because VersionedSqliteDb is abstract\n IModelJsFs.recursiveMkDirSync(dirname(fileName));\n if (fs.existsSync(fileName))\n fs.unlinkSync(fileName);\n\n db.createDb(fileName);\n db.createDDL(setupArgs);\n const minVer = `^${db.myVersion}`;\n db.setRequiredVersions({ readVersion: minVer, writeVersion: minVer });\n db.closeDb(true);\n }\n\n /**\n * Verify that this version of the software meets the required version range (as appropriate, read or write) stored in the database.\n * Throws otherwise.\n */\n protected verifyVersions() {\n const versions = this.getRequiredVersions();\n const isReadonly = this.isReadonly; // so we can tell read/write after the file is closed.\n const range = isReadonly ? versions.readVersion : versions.writeVersion;\n if (semver.satisfies(this.myVersion, range))\n return;\n\n this.closeDb();\n const tooNew = semver.gtr(this.myVersion, range);\n SqliteError.throwError(\"incompatible-version\", `requires ${tooNew ? \"older\" : \"newer\"} version of ${this.constructor.name} for ${isReadonly ? \"read\" : \"write\"}`, this[_nativeDb].getFilePath());\n\n }\n\n /**\n * Open this database and verify that this version of the software meets the required version range (as appropriate, read or write) stored in the database.\n * Throws otherwise.\n * @see [[SqliteDb.openDb]] for argument types\n */\n public override openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer) {\n super.openDb(dbName, openMode, container);\n this.verifyVersions();\n }\n\n public async upgradeSchema(arg: { dbName: string, lockContainer?: { container: CloudSqlite.CloudContainer, user: string }, upgradeFn: () => void }) {\n // can't use \"this\" because it checks for version, which we don't want here\n return (arg.lockContainer) ?\n super.withLockedContainer({ dbName: arg.dbName, ...arg.lockContainer }, async () => arg.upgradeFn) :\n super.withOpenDb({ ...arg, openMode: OpenMode.ReadWrite }, arg.upgradeFn);\n }\n}\n\n/** @public */\nexport namespace SQLiteDb {\n /** A semver version range.\n * @see https://docs.npmjs.com/cli/v6/using-npm/semver\n */\n export type VersionRange = string;\n\n /**\n * A pair of semver [[SQLiteDb.VersionRange]]s, one for read and one for write, required to access a [[VersionedSqliteDb]].\n * If the version of the software attempting to read or write the database does not satisfy the range, access is denied.\n */\n export interface RequiredVersionRanges {\n /** a range of acceptable persistence versions for reading from a VersionedSqliteDb. */\n readonly readVersion: VersionRange;\n /** a range of acceptable persistence versions for writing to a VersionedSqliteDb. */\n readonly writeVersion: VersionRange;\n }\n\n /** interface for reading and writing to a blob in a SQLiteDb\n * @internal\n */\n export interface BlobIO {\n /** Close this BlobIO if it is opened.\n * @note this BlobIO *may* be reused after this call by calling `open` again.\n */\n close(): void;\n /** get the total number of bytes in the blob */\n getNumBytes(): number;\n /** @return true if this BlobIO was successfully opened and may be use to read or write the blob */\n isValid(): boolean;\n /** Open this BlobIO against a table/row/column in a Db */\n open(\n /** The database for the blob */\n db: IModelJsNative.AnyDb,\n args: {\n /** the name of the table for the blob*/\n tableName: string;\n /** the name of the column for the blob */\n columnName: string;\n /** The rowId of the blob */\n row: number;\n /** If true, open this BlobIO for write access */\n writeable?: boolean;\n }): void;\n /** Read from a blob\n * @returns the contents of the requested byte range\n */\n read(args: {\n /** The number of bytes to read */\n numBytes: number;\n /** starting offset within the blob to read */\n offset: number;\n /** If present and of sufficient size, use this ArrayBuffer for the value. */\n blob?: ArrayBuffer;\n }): Uint8Array;\n /** Reposition this BlobIO to a new rowId\n * @note this BlobIO must be valid when this methods is called.\n */\n changeRow(row: number): void;\n /** Write to a blob */\n write(args: {\n /** The number of bytes to write */\n numBytes: number;\n /** starting offset within the blob to write */\n offset: number;\n /** the value to write */\n blob: ArrayBuffer;\n }): void;\n }\n\n /** Default transaction mode for SQLiteDbs.\n * @see https://www.sqlite.org/lang_transaction.html\n */\n export enum DefaultTxnMode {\n /** no default transaction is started. You must use BEGIN/COMMIT or SQLite will use implicit transactions */\n None = 0,\n /** A deferred transaction is started when the file is first opened. This is the default. */\n Deferred = 1,\n /** An immediate transaction is started when the file is first opened. */\n Immediate = 2,\n /** An exclusive transaction is started when the file is first opened. */\n Exclusive = 3\n }\n\n /** parameters common to opening or creating a new SQLiteDb */\n export interface OpenOrCreateParams {\n /** If true, do not require that the `be_Prop` table exist */\n rawSQLite?: boolean;\n /** @see immutable option at https://www.sqlite.org/c3ref/open.html */\n immutable?: boolean;\n /** Do not attempt to verify that the file is a valid sQLite file before opening. */\n skipFileCheck?: boolean;\n /** the default transaction mode\n * @see [[SQLiteDb.DefaultTxnMode]]\n */\n defaultTxn?: 0 | 1 | 2 | 3;\n /** see query parameters from 'URI Filenames' in https://www.sqlite.org/c3ref/open.html */\n queryParam?: string;\n }\n\n /** Parameters for opening an existing SQLiteDb */\n export interface OpenParams extends OpenOrCreateParams {\n /** use OpenMode.ReadWrite to open the file with write access */\n openMode: OpenMode;\n }\n\n /** Size of a SQLiteDb page in bytes */\n export interface PageSize {\n /** see https://www.sqlite.org/pragma.html#pragma_page_size */\n pageSize?: number;\n }\n\n /** Parameters for creating a new SQLiteDb */\n export type CreateParams = OpenOrCreateParams & PageSize;\n\n /** Arguments for `SqliteDb.withOpenDb` */\n export interface WithOpenDbArgs {\n /** The name of the database to open */\n dbName: string;\n /** either an object with the open parameters or just OpenMode value. */\n openMode?: OpenMode | SQLiteDb.OpenParams;\n /** @internal */\n container?: CloudSqlite.CloudContainer;\n }\n\n /** Arguments for `SQLiteDb.vacuum` */\n export interface VacuumDbArgs extends PageSize {\n /** if present, name of new file to [vacuum into](https://www.sqlite.org/lang_vacuum.html) */\n into?: LocalFileName;\n }\n}\n"]}
|
package/lib/esm/Schema.d.ts
CHANGED
|
@@ -3,6 +3,31 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { SchemaKey } from "@itwin/ecschema-metadata";
|
|
5
5
|
/** Base class for all schema classes - see [working with schemas and elements in TypeScript]($docs/learning/backend/SchemasAndElementsInTypeScript.md).
|
|
6
|
+
*
|
|
7
|
+
* When subclassing from Schema, it is good practice to follow this pattern:
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* class MyCustomSchema extends Schema {
|
|
11
|
+
* public static override get schemaName(): string { return "MyCustomSchema"; }
|
|
12
|
+
* public static get classes(): typeof Entity[] {
|
|
13
|
+
* return [MyOwnECClass, AnotherECClass];
|
|
14
|
+
* }
|
|
15
|
+
* public static registerSchema() {
|
|
16
|
+
* if (this !== Schemas.getRegisteredSchema(this.schemaName)) {
|
|
17
|
+
* Schemas.unregisterSchema(this.schemaName);
|
|
18
|
+
* Schemas.registerSchema(this);
|
|
19
|
+
* for (const ecClass of this.classes) {
|
|
20
|
+
* ClassRegistry.register(ecClass, this);
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* public static unregisterSchema() {
|
|
26
|
+
* Schemas.unregisterSchema(this.schemaName);
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
6
31
|
* @public
|
|
7
32
|
*/
|
|
8
33
|
export declare class Schema {
|
package/lib/esm/Schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAa,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAEhE
|
|
1
|
+
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAa,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,MAAM;IACjB;;;;OAIG;IACH,WAAkB,UAAU,IAAI,MAAM,CAA4E;IAElH;;OAEG;IACH,WAAkB,SAAS,IAAI,SAAS,CAGvC;IAED;;;OAGG;IACH,WAAkB,uBAAuB,IAAI,OAAO,CAAkB;IAEtE;;;;;;OAMG;WACW,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM;IAQ3D;;;OAGG;IACH,SAAS;CACV;AAED;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoC;IAE7D,gBAAgB;IACT,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,MAAM,GAAG,SAAS;IAIzD,gBAAgB;IACT,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,MAAM,GAAG,IAAI;IAI3D,gBAAgB;IACT,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAI1C;;;OAGG;IACI,cAAc,CAAC,MAAM,EAAE,OAAO,MAAM;CAM5C;AAED;;GAEG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAmB;IACzD,OAAO;IAEP;;;OAGG;WACW,cAAc,CAAC,MAAM,EAAE,OAAO,MAAM;IAIlD;;;;OAIG;WACW,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAQ3D;;;OAGG;WACW,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,MAAM,GAAG,SAAS;CACjF"}
|
package/lib/esm/Schema.js
CHANGED
|
@@ -10,6 +10,31 @@ import { IModelError } from "@itwin/core-common";
|
|
|
10
10
|
import { ClassRegistry } from "./ClassRegistry";
|
|
11
11
|
import { ECVersion, SchemaKey } from "@itwin/ecschema-metadata";
|
|
12
12
|
/** Base class for all schema classes - see [working with schemas and elements in TypeScript]($docs/learning/backend/SchemasAndElementsInTypeScript.md).
|
|
13
|
+
*
|
|
14
|
+
* When subclassing from Schema, it is good practice to follow this pattern:
|
|
15
|
+
*
|
|
16
|
+
* ```typescript
|
|
17
|
+
* class MyCustomSchema extends Schema {
|
|
18
|
+
* public static override get schemaName(): string { return "MyCustomSchema"; }
|
|
19
|
+
* public static get classes(): typeof Entity[] {
|
|
20
|
+
* return [MyOwnECClass, AnotherECClass];
|
|
21
|
+
* }
|
|
22
|
+
* public static registerSchema() {
|
|
23
|
+
* if (this !== Schemas.getRegisteredSchema(this.schemaName)) {
|
|
24
|
+
* Schemas.unregisterSchema(this.schemaName);
|
|
25
|
+
* Schemas.registerSchema(this);
|
|
26
|
+
* for (const ecClass of this.classes) {
|
|
27
|
+
* ClassRegistry.register(ecClass, this);
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* public static unregisterSchema() {
|
|
33
|
+
* Schemas.unregisterSchema(this.schemaName);
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
13
38
|
* @public
|
|
14
39
|
*/
|
|
15
40
|
export class Schema {
|
package/lib/esm/Schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAEhE
|
|
1
|
+
{"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,MAAM;IACjB;;;;OAIG;IACI,MAAM,KAAK,UAAU,KAAa,MAAM,IAAI,KAAK,CAAC,0CAA0C,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAElH;;OAEG;IACI,MAAM,KAAK,SAAS;QACzB,mGAAmG;QACnG,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,EA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U,CAAC,WAAW,EAAE,CAAC;QAC5C,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YACf,MAAM,IAAI,WAAW,CAAC,YAAY,CAAC,aAAa,EAAE,WAAW,MAAM,CAAC,UAAU,yBAAyB,CAAC,CAAC;QAC3G,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACxB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,OAAO;IACV,MAAM,CAAU,cAAc,GAAG,IAAI,SAAS,EAAE,CAAC;IACzD,gBAAwB,CAAC,CAAC,sBAAsB;IAEhD;;;OAGG;IACI,MAAM,CAAC,cAAc,CAAC,MAAqB;QAChD,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,gBAAgB,CAAC,UAAkB;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACpD,IAAI,SAAS,KAAK,MAAM;YACtB,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAE9C,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,mBAAmB,CAAC,UAAkB,IAA+B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,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 Schema\n */\n\nimport { IModelStatus } from \"@itwin/core-bentley\";\nimport { IModelError } from \"@itwin/core-common\";\nimport { ClassRegistry } from \"./ClassRegistry\";\nimport { ECVersion, SchemaKey } from \"@itwin/ecschema-metadata\";\n\n/** Base class for all schema classes - see [working with schemas and elements in TypeScript]($docs/learning/backend/SchemasAndElementsInTypeScript.md).\n *\n * When subclassing from Schema, it is good practice to follow this pattern:\n *\n * ```typescript\n * class MyCustomSchema extends Schema {\n * public static override get schemaName(): string { return \"MyCustomSchema\"; }\n * public static get classes(): typeof Entity[] {\n * return [MyOwnECClass, AnotherECClass];\n * }\n * public static registerSchema() {\n * if (this !== Schemas.getRegisteredSchema(this.schemaName)) {\n * Schemas.unregisterSchema(this.schemaName);\n * Schemas.registerSchema(this);\n * for (const ecClass of this.classes) {\n * ClassRegistry.register(ecClass, this);\n * }\n * }\n * }\n *\n * public static unregisterSchema() {\n * Schemas.unregisterSchema(this.schemaName);\n * }\n * }\n * ```\n *\n * @public\n */\nexport class Schema {\n /** The name of the BIS schema handled by this Schema.\n * @note Every subclass of Schema ** MUST ** override this method to identify its BIS schema.\n * Failure to do so will ordinarily result in an error when the schema is registered, since there may only\n * be one JavaScript class for a given BIS schema (usually the errant schema will collide with its superclass.)\n */\n public static get schemaName(): string { throw new Error(`you must override static schemaName in ${this.name}`); }\n\n /** Unique identifier for this schema, typed variant of [[schemaName]].\n * @internal\n */\n public static get schemaKey(): SchemaKey {\n // We cannot cache this here because the schemaName may be overridden without this being overridden\n return new SchemaKey(this.schemaName, ECVersion.NO_VERSION); // backend cares little for versions right now, as only one version can exist in an imodel\n }\n\n /** if true, this Schema is a proxy for a missing Domain marked with the `BisCore.SchemaHasBehavior` customAttribute.\n * Classes generated for this Schema will disallow protected operations.\n * @internal\n */\n public static get missingRequiredBehavior(): boolean { return false; }\n\n /** Get a semver-compatible string from a padded version string.\n * works on unpadded version strings as well\n * if there is no write version, it will be added\n * @example Schema.toSemverString(\"1.02.03\") === \"1.2.3\"\n * @example Schema.toSemverString(\"1.01\") === \"1.0.1\" // write version was added\n * @beta\n */\n public static toSemverString(paddedVersion: string): string {\n const tuple = paddedVersion.split(\".\").map(Number);\n const noWriteVersion = tuple.length === 2;\n if (noWriteVersion)\n tuple.splice(1, 0, 0); // insert 0 before the second element\n return tuple.join(\".\");\n }\n\n /** Schemas may not be instantiated. The method is not private only because that precludes subclassing. It throws an\n * error if it is ever called.\n * @internal\n */\n protected constructor() { throw new Error(`cannot create an instance of a Schema ${this.constructor.name}`); }\n}\n\n/**\n * Holds a map of registered schemas.\n * @public\n */\nexport class SchemaMap {\n private readonly _schemas = new Map<string, typeof Schema>();\n\n /** @internal */\n public get(schemaName: string): typeof Schema | undefined {\n return this._schemas.get(schemaName.toLowerCase());\n }\n\n /** @internal */\n public set(schemaName: string, schema: typeof Schema): void {\n this._schemas.set(schemaName.toLowerCase(), schema);\n }\n\n /** @internal */\n public delete(schemaName: string): boolean {\n return this._schemas.delete(schemaName.toLowerCase());\n }\n\n /** Register a schema prior to using it.\n * @throws [[IModelError]] if a schema of the same name is already registered.\n * @public\n */\n public registerSchema(schema: typeof Schema) {\n const key = schema.schemaName.toLowerCase();\n if (this.get(key))\n throw new IModelError(IModelStatus.DuplicateName, `Schema \"${schema.schemaName}\" is already registered`);\n this.set(key, schema);\n }\n}\n\n/** Manages registered schemas\n * @public\n */\nexport class Schemas {\n private static readonly _globalSchemas = new SchemaMap();\n private constructor() { } // this is a singleton\n\n /** Register a schema prior to using it.\n * This method registers the schema globally, to register a schema within the scope of a single iModel, use `IModelDb.schemaMap`.\n * @throws [[IModelError]] if a schema of the same name is already registered.\n */\n public static registerSchema(schema: typeof Schema) {\n this._globalSchemas.registerSchema(schema);\n }\n\n /** Unregister a schema, by name, if one is already registered.\n * This function is not normally needed, but is useful for cases where a generated *proxy* schema needs to be replaced by the *real* schema.\n * @param schemaName Name of the schema to unregister\n * @return true if the schema was unregistered\n */\n public static unregisterSchema(schemaName: string): boolean {\n const schema = this.getRegisteredSchema(schemaName);\n if (undefined !== schema)\n ClassRegistry.unregisterClassesFrom(schema);\n\n return this._globalSchemas.delete(schemaName.toLowerCase());\n }\n\n /** Look up a previously registered schema\n * @param schemaName The name of the schema\n * @returns the previously registered schema or undefined if not registered.\n */\n public static getRegisteredSchema(schemaName: string): typeof Schema | undefined { return this._globalSchemas.get(schemaName.toLowerCase()); }\n}\n"]}
|
|
@@ -63,7 +63,7 @@ export declare class SqliteStatement implements IterableIterator<any>, Disposabl
|
|
|
63
63
|
reset(): void;
|
|
64
64
|
/** Call this function when finished with this statement. This releases the native resources held by the statement. */
|
|
65
65
|
[Symbol.dispose](): void;
|
|
66
|
-
/** @deprecated in 5.0 Use [Symbol.dispose] instead. */
|
|
66
|
+
/** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */
|
|
67
67
|
dispose(): void;
|
|
68
68
|
/**
|
|
69
69
|
* Call `step` on this statement and determine whether a new row is available.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteStatement.d.ts","sourceRoot":"","sources":["../../src/SqliteStatement.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAU,MAAM,qBAAqB,CAAC;AAErG,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAO1D;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;AAO5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,eAAgB,YAAW,gBAAgB,CAAC,GAAG,CAAC,EAAE,UAAU;IAIpD,OAAO,CAAC,IAAI;IAH/B,OAAO,CAAC,KAAK,CAA6C;IAC1D,OAAO,CAAC,GAAG,CAAmC;gBAEnB,IAAI,EAAE,MAAM;IACvC,IAAW,IAAI,IAAI,cAAc,CAAC,eAAe,CAAwB;IACzE,IAAW,GAAG,WAAwB;IAEtC,oEAAoE;IACpE,IAAW,UAAU,IAAI,O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AC/B,SAAS,IAAI,MAAM;IAC1B,mCAAmC;IAC5B,KAAK,IAAI,UAAU;IAC1B,oCAAoC;IAC7B,OAAO,IAAI,UAAU;CAC7B;AAED,UAAU,SAAS;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,IAAI,IAAI,CAAC;IAChB,KAAK,IAAI,IAAI,CAAC;IACd,aAAa,IAAI,IAAI,CAAC;CACvB;AAED;;;;GAIG;AACH,qBAAa,cAAc,CAAC,IAAI,SAAS,SAAS;IAChD,OAAO,CAAC,MAAM,CAAuB;gBAElB,QAAQ,SAAK;IAIhC,IAAW,IAAI,WAA+B;IACvC,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAiB9B,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAI5C,KAAK;CAIb;AAED,cAAc;AACd,yBAAiB,eAAe,CAAC;IAC/B,MAAa,OAAQ,SAAQ,YAAY;QACvC,6EAA6E;QAC7E,SAAgB,OAAO,EAAE,OAAO,CAAC;QAEjC,gBAAgB;oBACJ,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;KAI9D;IAED,KAAY,OAAO,GACjB,gBAAgB,GAChB,eAAe,GACf,cAAc,CAAC;CAClB"}
|
|
@@ -77,7 +77,7 @@ export class SqliteStatement {
|
|
|
77
77
|
this._db = undefined;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
/** @deprecated in 5.0 Use [Symbol.dispose] instead. */
|
|
80
|
+
/** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */
|
|
81
81
|
dispose() {
|
|
82
82
|
this[Symbol.dispose]();
|
|
83
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteStatement.js","sourceRoot":"","sources":["../../src/SqliteStatement.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC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AAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAG,CAAC;YACpC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IAEM,aAAa,CAAC,GAAW;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACF;AAED,cAAc;AACd,WAAiB,eAAe;IAC9B,MAAa,OAAQ,SAAQ,YAAY;QACvC,6EAA6E;QAC7D,OAAO,CAAU;QAEjC,gBAAgB;QAChB,YAAY,OAAgB,EAAE,MAAc,EAAE,OAAe;YAC3D,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,CAAC;KACF;IATY,uBAAO,UASnB,CAAA;AAMH,CAAC,EAhBgB,eAAe,KAAf,eAAe,QAgB/B","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 SQLite\n */\n\nimport { assert, BentleyError, DbResult, GuidString, Id64String, LRUMap } from \"@itwin/core-bentley\";\nimport { ECJsNames, IModelError } from \"@itwin/core-common\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { IModelNative } from \"./internal/NativePlatform\";\n\n// spell:ignore julianday\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\n/** Marks a string as either an [Id64String]($core-bentley) or [GuidString]($core-bentley), so\n * that it can be passed to the [bindValue]($backend.SqliteStatement) or [bindValues]($backend.SqliteStatement)\n * methods of [SqliteStatement]($backend).\n * @internal\n */\nexport interface StringParam {\n id?: Id64String;\n guid?: GuidString;\n}\n\n/** parameter Index (1-based), or name of the parameter (including the initial ':', '@' or '$')\n * @public\n */\nexport type BindParameter = number | string;\n\nfunction checkBind(stat: DbResult) {\n if (stat !== DbResult.BE_SQLITE_OK)\n throw new IModelError(stat, \"SQLite Bind error\");\n}\n\n/** Executes SQLite SQL statements.\n *\n * A statement must be prepared before it can be executed, and it must be released when no longer needed.\n * See [IModelDb.withPreparedSqliteStatement]($backend) or\n * [ECDb.withPreparedSqliteStatement]($backend) for a convenient and\n * reliable way to prepare, execute, and then release a statement.\n *\n * A statement may contain parameters that must be filled in before use by calling [SqliteStatement.bindValue]($backend)\n * or [SqliteStatement.bindValues]($backend).\n *\n * Once prepared (and parameters are bound, if any), the statement is executed by calling [SqliteStatement.step]($backend).\n * In case of an **SQL SELECT** statement, the current row can be retrieved with [SqliteStatement.getRow]($backend) as\n * a whole, or with [SqliteStatement.getValue]($backend) when individual values are needed.\n * Alternatively, query results of an **SQL SELECT** statement can be stepped through by using\n * standard iteration syntax, such as `for of`.\n *\n * > Preparing a statement can be time-consuming. The best way to reduce the effect of this overhead is to cache and reuse prepared\n * > statements. A cached prepared statement may be used in different places in an app, as long as the statement is general enough.\n * > The key to making this strategy work is to phrase a statement in a general way and use placeholders to represent parameters that will vary on each use.\n * @public\n */\nexport class SqliteStatement implements IterableIterator<any>, Disposable {\n private _stmt: IModelJsNative.SqliteStatement | undefined;\n private _db: IModelJsNative.AnyDb | undefined;\n\n public constructor(private _sql: string) { }\n public get stmt(): IModelJsNative.SqliteStatement { return this._stmt!; }\n public get sql() { return this._sql; }\n\n /** Check if this statement has been prepared successfully or not */\n public get isPrepared(): boolean { return undefined !== this._stmt; }\n\n /** Prepare this statement prior to first use.\n * @param db The DgnDb or ECDb to prepare the statement against\n * @param sql The SQL statement string to prepare\n * @param logErrors Determine if errors are logged or not\n * @throws if the SQL statement cannot be prepared. Normally, prepare fails due to SQL syntax errors or references to tables or properties that do not exist.\n * The error.message property will provide details.\n */\n public prepare(db: IModelJsNative.AnyDb, logErrors = true): void {\n if (this.isPrepared)\n throw new Error(\"SqliteStatement is already prepared\");\n this._db = db;\n this._stmt = new IModelNative.platform.SqliteStatement();\n this._stmt.prepare(db, this._sql, logErrors);\n }\n\n /** Indicates whether the prepared statement makes no **direct* changes to the content of the file\n * or not. See [SQLite docs](https://www.sqlite.org/c3ref/stmt_readonly.html) for details.\n */\n public get isReadonly(): boolean {\n return this.stmt.isReadonly();\n }\n\n /** Reset this statement so that the next call to step will return the first row, if any.\n */\n public reset(): void {\n this.stmt.reset();\n }\n\n /** Call this function when finished with this statement. This releases the native resources held by the statement. */\n public [Symbol.dispose](): void {\n if (this._stmt) {\n this._stmt.dispose(); // free native statement\n this._stmt = undefined;\n this._db = undefined;\n }\n }\n\n /** @deprecated in 5.0 Use [Symbol.dispose] instead. */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /**\n * Call `step` on this statement and determine whether a new row is available.\n * Use this method only when this statement has been prepared with a SELECT statement.\n * @return true if a new row is available, false otherwise.\n * @throws if `step` returns anything other than BE_SQLITE_ROW or BE_SQLITE_DONE.\n */\n public nextRow(): boolean {\n const rc = this.step();\n switch (rc) {\n case DbResult.BE_SQLITE_ROW:\n return true;\n case DbResult.BE_SQLITE_DONE:\n return false;\n }\n\n this.throwSqlError(rc);\n return false; // unreachable\n }\n\n public throwSqlError(rc: DbResult) {\n throw new SqliteStatement.DbError(\n rc === DbResult.BE_SQLITE_CONSTRAINT_FOREIGNKEY ? \"ValueIsInUse\" :\n rc === DbResult.BE_SQLITE_CONSTRAINT_UNIQUE ? \"DuplicateValue\" :\n \"SqlLogicError\", rc, `SQL error: ${this._db!.getLastError()}`);\n }\n\n public stepForWrite(): void {\n const rc = this.step();\n if (rc !== DbResult.BE_SQLITE_DONE)\n this.throwSqlError(rc);\n }\n\n /** Binds a value to the specified SQL parameter.\n * The value must be of one of these types:\n * JavaScript Type | SQLite Type\n * --- | ---\n * undefined | NULL\n * boolean | INTEGER with true being bound as 1 and false as 0\n * number | INTEGER if number is integral or REAL if number is not integral\n * string | TEXT\n * Uint8Array or ArrayBuffer | BLOB\n * [StringParam]($backend) where member **id** is set | INTEGER\n * [StringParam]($backend) where member **guid** is set | BLOB\n *\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param value Value to bind.\n * @throws [IModelError]($common) if the value is of an unsupported type or in\n * case of other binding errors.\n */\n public bindValue(parameter: BindParameter, value: any): void {\n let stat: DbResult;\n if (value === undefined || value === null) {\n stat = this.stmt.bindNull(parameter);\n } else if (typeof (value) === \"number\") {\n if (Number.isInteger(value))\n stat = this.stmt.bindInteger(parameter, value);\n else\n stat = this.stmt.bindDouble(parameter, value);\n } else if (typeof (value) === \"boolean\") {\n stat = this.stmt.bindInteger(parameter, value ? 1 : 0);\n } else if (typeof (value) === \"string\") {\n stat = this.stmt.bindString(parameter, value);\n } else if (!!value.id) {\n stat = this.stmt.bindId(parameter, value.id);\n } else if (!!value.guid) {\n stat = this.stmt.bindGuid(parameter, value.guid);\n } else if (value instanceof Uint8Array) {\n stat = this.stmt.bindBlob(parameter, value);\n } else\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Parameter value ${value} is of an unsupported data type.`);\n\n if (stat !== DbResult.BE_SQLITE_OK)\n throw new IModelError(stat, \"Error in bindValue\");\n }\n\n /** Bind an integer parameter\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val integer to bind.\n */\n public bindInteger(parameter: BindParameter, val: number) {\n checkBind(this.stmt.bindInteger(parameter, val));\n }\n /** Bind an integer parameter if it is defined. Otherwise do nothing.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val integer to bind.\n */\n public maybeBindInteger(parameter: BindParameter, val?: number) {\n if (val !== undefined)\n this.bindInteger(parameter, val);\n }\n /** Bind a boolean parameter.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val boolean to bind.\n */\n public bindBoolean(parameter: BindParameter, val: boolean) {\n this.bindInteger(parameter, val ? 1 : 0);\n }\n /** Bind a boolean parameter if it is defined. Otherwise do nothing.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val boolean to bind.\n */\n public maybeBindBoolean(parameter: BindParameter, val?: boolean) {\n if (val !== undefined)\n this.bindBoolean(parameter, val);\n }\n /** JSON.stringify a property value and bind the JSON string.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val object to bind.\n * @internal\n */\n public bindProps<T>(colIndex: number, val: T) {\n this.bindString(colIndex, JSON.stringify(val));\n }\n /** JSON.stringify a property value if it is defined, and bind the JSON string. Otherwise do nothing.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val object to bind.\n * @internal\n */\n public maybeBindProps<T>(colIndex: number, val?: T) {\n if (val !== undefined)\n this.bindProps(colIndex, val);\n }\n /** Bind a double parameter\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val double to bind.\n */\n public bindDouble(parameter: BindParameter, val: number) {\n checkBind(this.stmt.bindDouble(parameter, val));\n }\n /** Bind a double parameter if it is defined. Otherwise do nothing.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val double to bind.\n */\n public maybeBindDouble(parameter: BindParameter, val?: number) {\n if (val !== undefined)\n this.bindDouble(parameter, val);\n }\n /** Bind a string parameter\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val string to bind.\n */\n public bindString(parameter: BindParameter, val: string) {\n checkBind(this.stmt.bindString(parameter, val));\n }\n /** Bind a string parameter if it is defined. Otherwise do nothing.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val string to bind.\n */\n public maybeBindString(parameter: BindParameter, val?: string) {\n if (val !== undefined)\n this.bindString(parameter, val);\n }\n /** Bind an Id64String parameter as a 64-bit integer\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val Id to bind.\n */\n public bindId(parameter: BindParameter, id: Id64String) {\n checkBind(this.stmt.bindId(parameter, id));\n }\n /** Bind a Guid parameter\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val Guid to bind.\n */\n public bindGuid(parameter: BindParameter, guid: GuidString) {\n checkBind(this.stmt.bindGuid(parameter, guid));\n }\n /** Bind a blob parameter\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val blob to bind.\n */\n public bindBlob(parameter: BindParameter, blob: Uint8Array) {\n checkBind(this.stmt.bindBlob(parameter, blob));\n }\n /** Bind a blob parameter if it is defined. Otherwise do nothing.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val blob to bind.\n */\n public maybeBindBlob(parameter: BindParameter, val?: Uint8Array) {\n if (val !== undefined)\n this.bindBlob(parameter, val);\n }\n /** Bind null to a parameter\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n */\n public bindNull(parameter: BindParameter) {\n checkBind(this.stmt.bindNull(parameter));\n }\n\n /** Bind values to all parameters in the statement.\n * @param values The values to bind to the parameters.\n * Pass an *array* of values if the parameters are *positional*.\n * Pass an *object of the values keyed on the parameter name* for *named parameters*.\n * The values in either the array or object must match the respective types of the parameter.\n * See [[SqliteStatement.bindValue]] for details on the supported types.\n */\n public bindValues(values: any[] | object): void {\n if (Array.isArray(values)) {\n for (let i = 0; i < values.length; i++) {\n const paramIndex: number = i + 1;\n const paramValue: any = values[i];\n if (paramValue === undefined || paramValue === null)\n continue;\n\n this.bindValue(paramIndex, paramValue);\n }\n return;\n }\n\n for (const entry of Object.entries(values)) {\n const paramName: string = entry[0];\n const paramValue: any = entry[1];\n if (paramValue === undefined || paramValue === null)\n continue;\n\n this.bindValue(paramName, paramValue);\n }\n }\n\n /** Clear any bindings that were previously set on this statement.\n * @throws [IModelError]($common) in case of errors\n */\n public clearBindings(): void {\n const stat = this.stmt.clearBindings();\n if (stat !== DbResult.BE_SQLITE_OK)\n throw new IModelError(stat, \"Error in clearBindings\");\n }\n\n /** Step this statement to the next row.\n *\n * For **SQL SELECT** statements the method returns\n * - [DbResult.BE_SQLITE_ROW]($core-bentley) if the statement now points successfully to the next row.\n * - [DbResult.BE_SQLITE_DONE]($core-bentley) if the statement has no more rows.\n * - Error status in case of errors.\n *\n * For **SQL INSERT, UPDATE, DELETE** statements the method returns\n * - [DbResult.BE_SQLITE_DONE]($core-bentley) if the statement has been executed successfully.\n * - Error status in case of errors.\n */\n public step(): DbResult {\n return this.stmt.step();\n }\n /** Get the query result's column count (only for SQL SELECT statements). */\n public getColumnCount(): number {\n return this.stmt.getColumnCount();\n }\n /** Get the value for the column at the given index in the query result.\n * @param columnIx Index of SQL column in query result (0-based)\n */\n public getValue(columnIx: number): SqliteValue {\n return new SqliteValue(this.stmt, columnIx);\n }\n /** Determine whether the value of the specified column is null\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public isValueNull(colIndex: number): boolean {\n return this.stmt.isValueNull(colIndex);\n }\n /** Get a size in bytes of a blob or text column\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getColumnBytes(colIndex: number): number {\n return this.stmt.getColumnBytes(colIndex);\n }\n /** Get a value as a blob\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueBlob(colIndex: number): Uint8Array {\n return this.stmt.getValueBlob(colIndex);\n }\n /** Get the value as a blob, or undefined if it is null.\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueBlobMaybe(colIndex: number): Uint8Array | undefined {\n return this.isValueNull(colIndex) ? undefined : this.getValueBlob(colIndex);\n }\n /** Get a value as a double\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueDouble(colIndex: number): number {\n return this.stmt.getValueDouble(colIndex);\n }\n /** Get the value as an double, or undefined if it is null.\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueDoubleMaybe(colIndex: number): number | undefined {\n return this.isValueNull(colIndex) ? undefined : this.getValueDouble(colIndex);\n }\n /** Get a value as a integer\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueInteger(colIndex: number): number {\n return this.stmt.getValueInteger(colIndex);\n }\n /** Get the value as an integer, or undefined if it is null.\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueIntegerMaybe(colIndex: number): number | undefined {\n return this.isValueNull(colIndex) ? undefined : this.getValueInteger(colIndex);\n }\n /** Get a value as a string\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueString(colIndex: number): string {\n return this.stmt.getValueString(colIndex);\n }\n /** Get the value as a string, or undefined if it is null.\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueStringMaybe(colIndex: number): string | undefined {\n return this.isValueNull(colIndex) ? undefined : this.getValueString(colIndex);\n }\n /** Get a value as an Id\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueId(colIndex: number): Id64String {\n return this.stmt.getValueId(colIndex);\n }\n /** Get a value as a Guid\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueGuid(colIndex: number): GuidString {\n return this.stmt.getValueGuid(colIndex);\n }\n /** Get the value as a boolean. Returns `false` if the column is null.\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueBoolean(colIndex: number) {\n return this.isValueNull(colIndex) ? false : 0 !== this.getValueInteger(colIndex);\n }\n /** Get the value of a [julianday](https://www.sqlite.org/lang_datefunc.html) column as a JavaScript `Date`.\n * @param colIndex Index of SQL column in query result (0-based)\n * @beta\n */\n public getValueDate(colIndex: number) {\n return new Date((this.stmt.getValueDouble(colIndex) - 2440587.5) * 86400000); // conversion from julian day ms to unix epoch ms\n }\n /** Get the value as a \"props\" JSON string, then parse it and return the object\n * @param colIndex Index of SQL column in query result (0-based)\n * @internal\n */\n public getProps<T>(colIndex: number): T {\n return JSON.parse(this.getValueString(colIndex));\n }\n /** Get the value as a \"props\" JSON string, then parse it and return the object.\n * If the column is null, return undefined.\n * @param colIndex Index of SQL column in query result (0-based)\n * @internal\n */\n public getPropsMaybe<T>(colIndex: number): T | undefined {\n return this.isValueNull(colIndex) ? undefined : this.getProps(colIndex);\n }\n\n /** Get the current row.\n * The returned row is formatted as JavaScript object where every SELECT clause item becomes a property in the JavaScript object.\n *\n * The SQL select clause item's name becomes the member name of the JavaScript object, **with the first character lowered**.\n *\n * SQLite Type | JavaScript Type\n * --- | ---\n * [SqliteValueType.Null]($backend) | undefined\n * [SqliteValueType.Integer]($backend) | number\n * [SqliteValueType.Double]($backend) | number\n * [SqliteValueType.String]($backend) | string\n * [SqliteValueType.Blob]($backend) | Uint8Array\n */\n public getRow(): any {\n const colCount = this.getColumnCount();\n const row: object = {};\n const duplicatePropNames = new Map<string, number>();\n for (let i = 0; i < colCount; i++) {\n const sqliteValue = this.getValue(i);\n if (!sqliteValue.isNull) {\n const propName: string = SqliteStatement.determineResultRowPropertyName(duplicatePropNames, sqliteValue);\n let val: any;\n switch (sqliteValue.type) {\n case SqliteValueType.Blob:\n val = sqliteValue.getBlob();\n break;\n case SqliteValueType.Double:\n val = sqliteValue.getDouble();\n break;\n case SqliteValueType.Integer:\n val = sqliteValue.getInteger();\n break;\n case SqliteValueType.String:\n val = sqliteValue.getString();\n break;\n\n default:\n throw new Error(\"Unsupported SqliteValueType\");\n }\n\n Object.defineProperty(row, propName, { enumerable: true, configurable: true, writable: true, value: val });\n }\n }\n return row;\n }\n\n private static determineResultRowPropertyName(duplicatePropNames: Map<string, number>, sqliteValue: SqliteValue): string {\n let jsName = ECJsNames.toJsName(sqliteValue.columnName);\n\n // now check duplicates. If there are, append a numeric suffix to the duplicates\n let suffix = duplicatePropNames.get(jsName);\n if (suffix === undefined)\n duplicatePropNames.set(jsName, 0);\n else {\n suffix++;\n duplicatePropNames.set(jsName, suffix);\n jsName += `_${suffix}`;\n }\n\n return jsName;\n }\n\n /** Calls step when called as an iterator.\n */\n public next(): IteratorResult<any> {\n return DbResult.BE_SQLITE_ROW === this.step() ? { done: false, value: this.getRow() } : { done: true, value: undefined };\n }\n\n /** The iterator that will step through the results of this statement. */\n public [Symbol.iterator](): IterableIterator<any> { return this; }\n}\n\n/** Data type of a value in in an SQLite SQL query result.\n * See also:\n * - [SqliteValue]($backend)\n * - [SqliteStatement]($backend)\n * - [SqliteStatement.getValue]($backend)\n * @public\n */\nexport enum SqliteValueType {\n // do not change the values of that enum. It must correspond to the respective\n // enum DbValueType in the native BeSQLite API.\n Integer = 1,\n Double = 2,\n String = 3,\n Blob = 4,\n Null = 5,\n}\n\n/** Value of a column in a row of an SQLite SQL query result.\n * See also:\n * - [SqliteStatement]($backend)\n * - [SqliteStatement.getValue]($backend)\n * @public\n */\nexport class SqliteValue {\n private readonly _stmt: IModelJsNative.SqliteStatement;\n private readonly _colIndex: number;\n\n public constructor(stmt: IModelJsNative.SqliteStatement, colIndex: number) {\n this._stmt = stmt;\n this._colIndex = colIndex;\n }\n\n /** Indicates whether the value is NULL or not. */\n public get isNull(): boolean { return this._stmt.isValueNull(this._colIndex); }\n\n /** Gets the data type of the value. */\n public get type(): SqliteValueType { return this._stmt.getColumnType(this._colIndex); }\n\n /** Gets the name of the column of the value. */\n public get columnName(): string { return this._stmt.getColumnName(this._colIndex); }\n\n /** Gets the SqlValue as JavaScript value.\n *\n * SQLite Type | JavaScript Type\n * --- | ---\n * [SqliteValueType.Null]($backend) | undefined\n * [SqliteValueType.Integer]($backend) | number\n * [SqliteValueType.Double]($backend) | number\n * [SqliteValueType.String]($backend) | string\n * [SqliteValueType.Blob]($backend) | Uint8Array\n */\n public get value(): any {\n switch (this.type) {\n case SqliteValueType.Null:\n return undefined;\n case SqliteValueType.Blob:\n return this.getBlob();\n case SqliteValueType.Double:\n return this.getDouble();\n case SqliteValueType.Integer:\n return this.getInteger();\n case SqliteValueType.String:\n return this.getString();\n default:\n throw new Error(\"Unhandled SqliteValueType\");\n }\n }\n\n /** Get the value as Blob */\n public getBlob(): Uint8Array { return this._stmt.getValueBlob(this._colIndex); }\n /** Get the value as a double value */\n public getDouble(): number { return this._stmt.getValueDouble(this._colIndex); }\n /** Get the value as a integer value */\n public getInteger(): number { return this._stmt.getValueInteger(this._colIndex); }\n /** Get the value as a string value */\n public getString(): string { return this._stmt.getValueString(this._colIndex); }\n /** Get the value as an Id value */\n public getId(): Id64String { return this._stmt.getValueId(this._colIndex); }\n /** Get the value as a Guid value */\n public getGuid(): GuidString { return this._stmt.getValueGuid(this._colIndex); }\n}\n\ninterface Statement {\n isPrepared: boolean;\n sql: string;\n dispose(): void;\n reset(): void;\n clearBindings(): void;\n}\n\n/** A cache for previously prepared SqliteStatements.\n * It only holds Statements after they are no longer in use, resetting and clearing their bindings before saving them.\n * When a request to use a statement from the cache is made, it is first removed from the cache.\n * @internal\n */\nexport class StatementCache<Stmt extends Statement> {\n private _cache: LRUMap<string, Stmt>;\n\n public constructor(maxCount = 40) {\n this._cache = new LRUMap<string, Stmt>(maxCount);\n }\n\n public get size() { return this._cache.size; }\n public addOrDispose(stmt: Stmt): void {\n assert(stmt.isPrepared);\n\n const existing = this._cache.get(stmt.sql);\n if (existing !== undefined) {\n stmt.dispose(); // we already have a statement with this sql cached, we can't save another one so just dispose it\n return;\n }\n if (this._cache.size >= this._cache.limit) {\n const oldest = this._cache.shift()!;\n oldest[1].dispose();\n }\n stmt.reset();\n stmt.clearBindings();\n this._cache.set(stmt.sql, stmt);\n }\n\n public findAndRemove(sql: string): Stmt | undefined {\n return this._cache.delete(sql);\n }\n\n public clear() {\n this._cache.forEach((stmt) => stmt.dispose());\n this._cache.clear();\n }\n}\n\n/** @public */\nexport namespace SqliteStatement {\n export class DbError extends BentleyError {\n /** A string that indicates the type of problem that caused the exception. */\n public readonly errorId: ErrorId;\n\n /** @internal */\n constructor(errorId: ErrorId, errNum: number, message: string) {\n super(errNum, message);\n this.errorId = errorId;\n }\n }\n\n export type ErrorId =\n \"DuplicateValue\" |\n \"SqlLogicError\" |\n \"ValueIsInUse\";\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SqliteStatement.js","sourceRoot":"","sources":["../../src/SqliteStatement.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAA0B,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAqBzD,SAAS,SAAS,CAAC,IAAc;IAC/B,IAAI,IAAI,KAAK,QAAQ,CAAC,YAAY;QAChC,MAAM,IAAI,WAAW,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,eAAe;IAIC;IAHnB,KAAK,CAA6C;IAClD,GAAG,CAAmC;IAE9C,YAA2B,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAI,CAAC;IAC5C,IAAW,IAAI,KAAqC,OAAO,IAAI,CAAC,KAAM,CAAC,CAAC,CAAC;IACzE,IAAW,GAAG,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEtC,oEAAoE;IACpE,IAAW,UAAU,KAAc,OAAO,SAAS,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAErE;;;;;;OAMG;IACI,OAAO,CAAC,EAAwB,EAAE,SAAS,GAAG,IAAI;QACvD,IAAI,IAAI,CAAC,UAAU;YACjB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,IAAI,CAAC,GAAG,GA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,KAAf,eAAe,QAgB/B","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 SQLite\n */\n\nimport { assert, BentleyError, DbResult, GuidString, Id64String, LRUMap } from \"@itwin/core-bentley\";\nimport { ECJsNames, IModelError } from \"@itwin/core-common\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { IModelNative } from \"./internal/NativePlatform\";\n\n// spell:ignore julianday\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\n/** Marks a string as either an [Id64String]($core-bentley) or [GuidString]($core-bentley), so\n * that it can be passed to the [bindValue]($backend.SqliteStatement) or [bindValues]($backend.SqliteStatement)\n * methods of [SqliteStatement]($backend).\n * @internal\n */\nexport interface StringParam {\n id?: Id64String;\n guid?: GuidString;\n}\n\n/** parameter Index (1-based), or name of the parameter (including the initial ':', '@' or '$')\n * @public\n */\nexport type BindParameter = number | string;\n\nfunction checkBind(stat: DbResult) {\n if (stat !== DbResult.BE_SQLITE_OK)\n throw new IModelError(stat, \"SQLite Bind error\");\n}\n\n/** Executes SQLite SQL statements.\n *\n * A statement must be prepared before it can be executed, and it must be released when no longer needed.\n * See [IModelDb.withPreparedSqliteStatement]($backend) or\n * [ECDb.withPreparedSqliteStatement]($backend) for a convenient and\n * reliable way to prepare, execute, and then release a statement.\n *\n * A statement may contain parameters that must be filled in before use by calling [SqliteStatement.bindValue]($backend)\n * or [SqliteStatement.bindValues]($backend).\n *\n * Once prepared (and parameters are bound, if any), the statement is executed by calling [SqliteStatement.step]($backend).\n * In case of an **SQL SELECT** statement, the current row can be retrieved with [SqliteStatement.getRow]($backend) as\n * a whole, or with [SqliteStatement.getValue]($backend) when individual values are needed.\n * Alternatively, query results of an **SQL SELECT** statement can be stepped through by using\n * standard iteration syntax, such as `for of`.\n *\n * > Preparing a statement can be time-consuming. The best way to reduce the effect of this overhead is to cache and reuse prepared\n * > statements. A cached prepared statement may be used in different places in an app, as long as the statement is general enough.\n * > The key to making this strategy work is to phrase a statement in a general way and use placeholders to represent parameters that will vary on each use.\n * @public\n */\nexport class SqliteStatement implements IterableIterator<any>, Disposable {\n private _stmt: IModelJsNative.SqliteStatement | undefined;\n private _db: IModelJsNative.AnyDb | undefined;\n\n public constructor(private _sql: string) { }\n public get stmt(): IModelJsNative.SqliteStatement { return this._stmt!; }\n public get sql() { return this._sql; }\n\n /** Check if this statement has been prepared successfully or not */\n public get isPrepared(): boolean { return undefined !== this._stmt; }\n\n /** Prepare this statement prior to first use.\n * @param db The DgnDb or ECDb to prepare the statement against\n * @param sql The SQL statement string to prepare\n * @param logErrors Determine if errors are logged or not\n * @throws if the SQL statement cannot be prepared. Normally, prepare fails due to SQL syntax errors or references to tables or properties that do not exist.\n * The error.message property will provide details.\n */\n public prepare(db: IModelJsNative.AnyDb, logErrors = true): void {\n if (this.isPrepared)\n throw new Error(\"SqliteStatement is already prepared\");\n this._db = db;\n this._stmt = new IModelNative.platform.SqliteStatement();\n this._stmt.prepare(db, this._sql, logErrors);\n }\n\n /** Indicates whether the prepared statement makes no **direct* changes to the content of the file\n * or not. See [SQLite docs](https://www.sqlite.org/c3ref/stmt_readonly.html) for details.\n */\n public get isReadonly(): boolean {\n return this.stmt.isReadonly();\n }\n\n /** Reset this statement so that the next call to step will return the first row, if any.\n */\n public reset(): void {\n this.stmt.reset();\n }\n\n /** Call this function when finished with this statement. This releases the native resources held by the statement. */\n public [Symbol.dispose](): void {\n if (this._stmt) {\n this._stmt.dispose(); // free native statement\n this._stmt = undefined;\n this._db = undefined;\n }\n }\n\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /**\n * Call `step` on this statement and determine whether a new row is available.\n * Use this method only when this statement has been prepared with a SELECT statement.\n * @return true if a new row is available, false otherwise.\n * @throws if `step` returns anything other than BE_SQLITE_ROW or BE_SQLITE_DONE.\n */\n public nextRow(): boolean {\n const rc = this.step();\n switch (rc) {\n case DbResult.BE_SQLITE_ROW:\n return true;\n case DbResult.BE_SQLITE_DONE:\n return false;\n }\n\n this.throwSqlError(rc);\n return false; // unreachable\n }\n\n public throwSqlError(rc: DbResult) {\n throw new SqliteStatement.DbError(\n rc === DbResult.BE_SQLITE_CONSTRAINT_FOREIGNKEY ? \"ValueIsInUse\" :\n rc === DbResult.BE_SQLITE_CONSTRAINT_UNIQUE ? \"DuplicateValue\" :\n \"SqlLogicError\", rc, `SQL error: ${this._db!.getLastError()}`);\n }\n\n public stepForWrite(): void {\n const rc = this.step();\n if (rc !== DbResult.BE_SQLITE_DONE)\n this.throwSqlError(rc);\n }\n\n /** Binds a value to the specified SQL parameter.\n * The value must be of one of these types:\n * JavaScript Type | SQLite Type\n * --- | ---\n * undefined | NULL\n * boolean | INTEGER with true being bound as 1 and false as 0\n * number | INTEGER if number is integral or REAL if number is not integral\n * string | TEXT\n * Uint8Array or ArrayBuffer | BLOB\n * [StringParam]($backend) where member **id** is set | INTEGER\n * [StringParam]($backend) where member **guid** is set | BLOB\n *\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param value Value to bind.\n * @throws [IModelError]($common) if the value is of an unsupported type or in\n * case of other binding errors.\n */\n public bindValue(parameter: BindParameter, value: any): void {\n let stat: DbResult;\n if (value === undefined || value === null) {\n stat = this.stmt.bindNull(parameter);\n } else if (typeof (value) === \"number\") {\n if (Number.isInteger(value))\n stat = this.stmt.bindInteger(parameter, value);\n else\n stat = this.stmt.bindDouble(parameter, value);\n } else if (typeof (value) === \"boolean\") {\n stat = this.stmt.bindInteger(parameter, value ? 1 : 0);\n } else if (typeof (value) === \"string\") {\n stat = this.stmt.bindString(parameter, value);\n } else if (!!value.id) {\n stat = this.stmt.bindId(parameter, value.id);\n } else if (!!value.guid) {\n stat = this.stmt.bindGuid(parameter, value.guid);\n } else if (value instanceof Uint8Array) {\n stat = this.stmt.bindBlob(parameter, value);\n } else\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Parameter value ${value} is of an unsupported data type.`);\n\n if (stat !== DbResult.BE_SQLITE_OK)\n throw new IModelError(stat, \"Error in bindValue\");\n }\n\n /** Bind an integer parameter\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val integer to bind.\n */\n public bindInteger(parameter: BindParameter, val: number) {\n checkBind(this.stmt.bindInteger(parameter, val));\n }\n /** Bind an integer parameter if it is defined. Otherwise do nothing.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val integer to bind.\n */\n public maybeBindInteger(parameter: BindParameter, val?: number) {\n if (val !== undefined)\n this.bindInteger(parameter, val);\n }\n /** Bind a boolean parameter.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val boolean to bind.\n */\n public bindBoolean(parameter: BindParameter, val: boolean) {\n this.bindInteger(parameter, val ? 1 : 0);\n }\n /** Bind a boolean parameter if it is defined. Otherwise do nothing.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val boolean to bind.\n */\n public maybeBindBoolean(parameter: BindParameter, val?: boolean) {\n if (val !== undefined)\n this.bindBoolean(parameter, val);\n }\n /** JSON.stringify a property value and bind the JSON string.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val object to bind.\n * @internal\n */\n public bindProps<T>(colIndex: number, val: T) {\n this.bindString(colIndex, JSON.stringify(val));\n }\n /** JSON.stringify a property value if it is defined, and bind the JSON string. Otherwise do nothing.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val object to bind.\n * @internal\n */\n public maybeBindProps<T>(colIndex: number, val?: T) {\n if (val !== undefined)\n this.bindProps(colIndex, val);\n }\n /** Bind a double parameter\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val double to bind.\n */\n public bindDouble(parameter: BindParameter, val: number) {\n checkBind(this.stmt.bindDouble(parameter, val));\n }\n /** Bind a double parameter if it is defined. Otherwise do nothing.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val double to bind.\n */\n public maybeBindDouble(parameter: BindParameter, val?: number) {\n if (val !== undefined)\n this.bindDouble(parameter, val);\n }\n /** Bind a string parameter\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val string to bind.\n */\n public bindString(parameter: BindParameter, val: string) {\n checkBind(this.stmt.bindString(parameter, val));\n }\n /** Bind a string parameter if it is defined. Otherwise do nothing.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val string to bind.\n */\n public maybeBindString(parameter: BindParameter, val?: string) {\n if (val !== undefined)\n this.bindString(parameter, val);\n }\n /** Bind an Id64String parameter as a 64-bit integer\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val Id to bind.\n */\n public bindId(parameter: BindParameter, id: Id64String) {\n checkBind(this.stmt.bindId(parameter, id));\n }\n /** Bind a Guid parameter\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val Guid to bind.\n */\n public bindGuid(parameter: BindParameter, guid: GuidString) {\n checkBind(this.stmt.bindGuid(parameter, guid));\n }\n /** Bind a blob parameter\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val blob to bind.\n */\n public bindBlob(parameter: BindParameter, blob: Uint8Array) {\n checkBind(this.stmt.bindBlob(parameter, blob));\n }\n /** Bind a blob parameter if it is defined. Otherwise do nothing.\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n * @param val blob to bind.\n */\n public maybeBindBlob(parameter: BindParameter, val?: Uint8Array) {\n if (val !== undefined)\n this.bindBlob(parameter, val);\n }\n /** Bind null to a parameter\n * @param parameter Index (1-based) or name of the parameter (including the initial ':', '@' or '$')\n */\n public bindNull(parameter: BindParameter) {\n checkBind(this.stmt.bindNull(parameter));\n }\n\n /** Bind values to all parameters in the statement.\n * @param values The values to bind to the parameters.\n * Pass an *array* of values if the parameters are *positional*.\n * Pass an *object of the values keyed on the parameter name* for *named parameters*.\n * The values in either the array or object must match the respective types of the parameter.\n * See [[SqliteStatement.bindValue]] for details on the supported types.\n */\n public bindValues(values: any[] | object): void {\n if (Array.isArray(values)) {\n for (let i = 0; i < values.length; i++) {\n const paramIndex: number = i + 1;\n const paramValue: any = values[i];\n if (paramValue === undefined || paramValue === null)\n continue;\n\n this.bindValue(paramIndex, paramValue);\n }\n return;\n }\n\n for (const entry of Object.entries(values)) {\n const paramName: string = entry[0];\n const paramValue: any = entry[1];\n if (paramValue === undefined || paramValue === null)\n continue;\n\n this.bindValue(paramName, paramValue);\n }\n }\n\n /** Clear any bindings that were previously set on this statement.\n * @throws [IModelError]($common) in case of errors\n */\n public clearBindings(): void {\n const stat = this.stmt.clearBindings();\n if (stat !== DbResult.BE_SQLITE_OK)\n throw new IModelError(stat, \"Error in clearBindings\");\n }\n\n /** Step this statement to the next row.\n *\n * For **SQL SELECT** statements the method returns\n * - [DbResult.BE_SQLITE_ROW]($core-bentley) if the statement now points successfully to the next row.\n * - [DbResult.BE_SQLITE_DONE]($core-bentley) if the statement has no more rows.\n * - Error status in case of errors.\n *\n * For **SQL INSERT, UPDATE, DELETE** statements the method returns\n * - [DbResult.BE_SQLITE_DONE]($core-bentley) if the statement has been executed successfully.\n * - Error status in case of errors.\n */\n public step(): DbResult {\n return this.stmt.step();\n }\n /** Get the query result's column count (only for SQL SELECT statements). */\n public getColumnCount(): number {\n return this.stmt.getColumnCount();\n }\n /** Get the value for the column at the given index in the query result.\n * @param columnIx Index of SQL column in query result (0-based)\n */\n public getValue(columnIx: number): SqliteValue {\n return new SqliteValue(this.stmt, columnIx);\n }\n /** Determine whether the value of the specified column is null\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public isValueNull(colIndex: number): boolean {\n return this.stmt.isValueNull(colIndex);\n }\n /** Get a size in bytes of a blob or text column\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getColumnBytes(colIndex: number): number {\n return this.stmt.getColumnBytes(colIndex);\n }\n /** Get a value as a blob\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueBlob(colIndex: number): Uint8Array {\n return this.stmt.getValueBlob(colIndex);\n }\n /** Get the value as a blob, or undefined if it is null.\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueBlobMaybe(colIndex: number): Uint8Array | undefined {\n return this.isValueNull(colIndex) ? undefined : this.getValueBlob(colIndex);\n }\n /** Get a value as a double\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueDouble(colIndex: number): number {\n return this.stmt.getValueDouble(colIndex);\n }\n /** Get the value as an double, or undefined if it is null.\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueDoubleMaybe(colIndex: number): number | undefined {\n return this.isValueNull(colIndex) ? undefined : this.getValueDouble(colIndex);\n }\n /** Get a value as a integer\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueInteger(colIndex: number): number {\n return this.stmt.getValueInteger(colIndex);\n }\n /** Get the value as an integer, or undefined if it is null.\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueIntegerMaybe(colIndex: number): number | undefined {\n return this.isValueNull(colIndex) ? undefined : this.getValueInteger(colIndex);\n }\n /** Get a value as a string\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueString(colIndex: number): string {\n return this.stmt.getValueString(colIndex);\n }\n /** Get the value as a string, or undefined if it is null.\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueStringMaybe(colIndex: number): string | undefined {\n return this.isValueNull(colIndex) ? undefined : this.getValueString(colIndex);\n }\n /** Get a value as an Id\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueId(colIndex: number): Id64String {\n return this.stmt.getValueId(colIndex);\n }\n /** Get a value as a Guid\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueGuid(colIndex: number): GuidString {\n return this.stmt.getValueGuid(colIndex);\n }\n /** Get the value as a boolean. Returns `false` if the column is null.\n * @param colIndex Index of SQL column in query result (0-based)\n */\n public getValueBoolean(colIndex: number) {\n return this.isValueNull(colIndex) ? false : 0 !== this.getValueInteger(colIndex);\n }\n /** Get the value of a [julianday](https://www.sqlite.org/lang_datefunc.html) column as a JavaScript `Date`.\n * @param colIndex Index of SQL column in query result (0-based)\n * @beta\n */\n public getValueDate(colIndex: number) {\n return new Date((this.stmt.getValueDouble(colIndex) - 2440587.5) * 86400000); // conversion from julian day ms to unix epoch ms\n }\n /** Get the value as a \"props\" JSON string, then parse it and return the object\n * @param colIndex Index of SQL column in query result (0-based)\n * @internal\n */\n public getProps<T>(colIndex: number): T {\n return JSON.parse(this.getValueString(colIndex));\n }\n /** Get the value as a \"props\" JSON string, then parse it and return the object.\n * If the column is null, return undefined.\n * @param colIndex Index of SQL column in query result (0-based)\n * @internal\n */\n public getPropsMaybe<T>(colIndex: number): T | undefined {\n return this.isValueNull(colIndex) ? undefined : this.getProps(colIndex);\n }\n\n /** Get the current row.\n * The returned row is formatted as JavaScript object where every SELECT clause item becomes a property in the JavaScript object.\n *\n * The SQL select clause item's name becomes the member name of the JavaScript object, **with the first character lowered**.\n *\n * SQLite Type | JavaScript Type\n * --- | ---\n * [SqliteValueType.Null]($backend) | undefined\n * [SqliteValueType.Integer]($backend) | number\n * [SqliteValueType.Double]($backend) | number\n * [SqliteValueType.String]($backend) | string\n * [SqliteValueType.Blob]($backend) | Uint8Array\n */\n public getRow(): any {\n const colCount = this.getColumnCount();\n const row: object = {};\n const duplicatePropNames = new Map<string, number>();\n for (let i = 0; i < colCount; i++) {\n const sqliteValue = this.getValue(i);\n if (!sqliteValue.isNull) {\n const propName: string = SqliteStatement.determineResultRowPropertyName(duplicatePropNames, sqliteValue);\n let val: any;\n switch (sqliteValue.type) {\n case SqliteValueType.Blob:\n val = sqliteValue.getBlob();\n break;\n case SqliteValueType.Double:\n val = sqliteValue.getDouble();\n break;\n case SqliteValueType.Integer:\n val = sqliteValue.getInteger();\n break;\n case SqliteValueType.String:\n val = sqliteValue.getString();\n break;\n\n default:\n throw new Error(\"Unsupported SqliteValueType\");\n }\n\n Object.defineProperty(row, propName, { enumerable: true, configurable: true, writable: true, value: val });\n }\n }\n return row;\n }\n\n private static determineResultRowPropertyName(duplicatePropNames: Map<string, number>, sqliteValue: SqliteValue): string {\n let jsName = ECJsNames.toJsName(sqliteValue.columnName);\n\n // now check duplicates. If there are, append a numeric suffix to the duplicates\n let suffix = duplicatePropNames.get(jsName);\n if (suffix === undefined)\n duplicatePropNames.set(jsName, 0);\n else {\n suffix++;\n duplicatePropNames.set(jsName, suffix);\n jsName += `_${suffix}`;\n }\n\n return jsName;\n }\n\n /** Calls step when called as an iterator.\n */\n public next(): IteratorResult<any> {\n return DbResult.BE_SQLITE_ROW === this.step() ? { done: false, value: this.getRow() } : { done: true, value: undefined };\n }\n\n /** The iterator that will step through the results of this statement. */\n public [Symbol.iterator](): IterableIterator<any> { return this; }\n}\n\n/** Data type of a value in in an SQLite SQL query result.\n * See also:\n * - [SqliteValue]($backend)\n * - [SqliteStatement]($backend)\n * - [SqliteStatement.getValue]($backend)\n * @public\n */\nexport enum SqliteValueType {\n // do not change the values of that enum. It must correspond to the respective\n // enum DbValueType in the native BeSQLite API.\n Integer = 1,\n Double = 2,\n String = 3,\n Blob = 4,\n Null = 5,\n}\n\n/** Value of a column in a row of an SQLite SQL query result.\n * See also:\n * - [SqliteStatement]($backend)\n * - [SqliteStatement.getValue]($backend)\n * @public\n */\nexport class SqliteValue {\n private readonly _stmt: IModelJsNative.SqliteStatement;\n private readonly _colIndex: number;\n\n public constructor(stmt: IModelJsNative.SqliteStatement, colIndex: number) {\n this._stmt = stmt;\n this._colIndex = colIndex;\n }\n\n /** Indicates whether the value is NULL or not. */\n public get isNull(): boolean { return this._stmt.isValueNull(this._colIndex); }\n\n /** Gets the data type of the value. */\n public get type(): SqliteValueType { return this._stmt.getColumnType(this._colIndex); }\n\n /** Gets the name of the column of the value. */\n public get columnName(): string { return this._stmt.getColumnName(this._colIndex); }\n\n /** Gets the SqlValue as JavaScript value.\n *\n * SQLite Type | JavaScript Type\n * --- | ---\n * [SqliteValueType.Null]($backend) | undefined\n * [SqliteValueType.Integer]($backend) | number\n * [SqliteValueType.Double]($backend) | number\n * [SqliteValueType.String]($backend) | string\n * [SqliteValueType.Blob]($backend) | Uint8Array\n */\n public get value(): any {\n switch (this.type) {\n case SqliteValueType.Null:\n return undefined;\n case SqliteValueType.Blob:\n return this.getBlob();\n case SqliteValueType.Double:\n return this.getDouble();\n case SqliteValueType.Integer:\n return this.getInteger();\n case SqliteValueType.String:\n return this.getString();\n default:\n throw new Error(\"Unhandled SqliteValueType\");\n }\n }\n\n /** Get the value as Blob */\n public getBlob(): Uint8Array { return this._stmt.getValueBlob(this._colIndex); }\n /** Get the value as a double value */\n public getDouble(): number { return this._stmt.getValueDouble(this._colIndex); }\n /** Get the value as a integer value */\n public getInteger(): number { return this._stmt.getValueInteger(this._colIndex); }\n /** Get the value as a string value */\n public getString(): string { return this._stmt.getValueString(this._colIndex); }\n /** Get the value as an Id value */\n public getId(): Id64String { return this._stmt.getValueId(this._colIndex); }\n /** Get the value as a Guid value */\n public getGuid(): GuidString { return this._stmt.getValueGuid(this._colIndex); }\n}\n\ninterface Statement {\n isPrepared: boolean;\n sql: string;\n dispose(): void;\n reset(): void;\n clearBindings(): void;\n}\n\n/** A cache for previously prepared SqliteStatements.\n * It only holds Statements after they are no longer in use, resetting and clearing their bindings before saving them.\n * When a request to use a statement from the cache is made, it is first removed from the cache.\n * @internal\n */\nexport class StatementCache<Stmt extends Statement> {\n private _cache: LRUMap<string, Stmt>;\n\n public constructor(maxCount = 40) {\n this._cache = new LRUMap<string, Stmt>(maxCount);\n }\n\n public get size() { return this._cache.size; }\n public addOrDispose(stmt: Stmt): void {\n assert(stmt.isPrepared);\n\n const existing = this._cache.get(stmt.sql);\n if (existing !== undefined) {\n stmt.dispose(); // we already have a statement with this sql cached, we can't save another one so just dispose it\n return;\n }\n if (this._cache.size >= this._cache.limit) {\n const oldest = this._cache.shift()!;\n oldest[1].dispose();\n }\n stmt.reset();\n stmt.clearBindings();\n this._cache.set(stmt.sql, stmt);\n }\n\n public findAndRemove(sql: string): Stmt | undefined {\n return this._cache.delete(sql);\n }\n\n public clear() {\n this._cache.forEach((stmt) => stmt.dispose());\n this._cache.clear();\n }\n}\n\n/** @public */\nexport namespace SqliteStatement {\n export class DbError extends BentleyError {\n /** A string that indicates the type of problem that caused the exception. */\n public readonly errorId: ErrorId;\n\n /** @internal */\n constructor(errorId: ErrorId, errNum: number, message: string) {\n super(errNum, message);\n this.errorId = errorId;\n }\n }\n\n export type ErrorId =\n \"DuplicateValue\" |\n \"SqlLogicError\" |\n \"ValueIsInUse\";\n}\n"]}
|
package/lib/esm/Texture.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface TextureCreateProps extends Omit<TextureProps, "data"> {
|
|
|
13
13
|
data: Base64EncodedString | Uint8Array;
|
|
14
14
|
}
|
|
15
15
|
/** Defines a rendering texture that is associated with a Material and applied to surface geometry.
|
|
16
|
-
* @public
|
|
16
|
+
* @public @preview
|
|
17
17
|
*/
|
|
18
18
|
export declare class Texture extends DefinitionElement {
|
|
19
19
|
/** @internal */
|
package/lib/esm/Texture.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { Base64EncodedString, BisCodeSpec, Code, } from "@itwin/core-common";
|
|
9
9
|
import { DefinitionElement } from "./Element";
|
|
10
10
|
/** Defines a rendering texture that is associated with a Material and applied to surface geometry.
|
|
11
|
-
* @public
|
|
11
|
+
* @public @preview
|
|
12
12
|
*/
|
|
13
13
|
export class Texture extends DefinitionElement {
|
|
14
14
|
/** @internal */
|
package/lib/esm/Texture.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Texture.js","sourceRoot":"","sources":["../../src/Texture.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AA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AAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpH,CAAC;IAED;;;;;;;;;;OAUG;IACI,MAAM,CAAC,aAAa,CAAC,QAAkB,EAAE,iBAA6B,EAAE,IAAY,EAAE,MAAyB,EAAE,IAAsC,EAAE,WAAoB;QAClL,MAAM,YAAY,GAAuB;YACvC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC;YACxD,MAAM;YACN,IAAI;YACJ,WAAW;YACX,KAAK,EAAE,iBAAiB;YACxB,SAAS,EAAE,KAAK;SACjB,CAAC;QAEF,OAAO,IAAI,OAAO,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;;;;;OAUG;IACI,MAAM,CAAC,aAAa,CAAC,QAAkB,EAAE,iBAA6B,EAAE,IAAY,EAAE,MAAyB,EAAE,IAAsC,EAAE,WAAoB;QAClL,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QACjG,OAAO,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3D,CAAC;CACF","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 Base64EncodedString, BisCodeSpec, Code, CodeScopeProps, CodeSpec, ImageSourceFormat, TextureProps,\n} from \"@itwin/core-common\";\nimport { DefinitionElement } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\n\n/** A [TextureProps]($common) in which the image data can be specified either as a base-64-encoded string or a Uint8Array.\n * @see [[Texture]] constructor.\n * @beta\n */\nexport interface TextureCreateProps extends Omit<TextureProps, \"data\"> {\n data: Base64EncodedString | Uint8Array;\n}\n\n/** Defines a rendering texture that is associated with a Material and applied to surface geometry.\n * @public\n */\nexport class Texture extends DefinitionElement {\n /** @internal */\n public static override get className(): string { return \"Texture\"; }\n public format: ImageSourceFormat;\n public data: Uint8Array;\n public description?: string;\n\n /** @beta */\n protected constructor(props: TextureCreateProps, iModel: IModelDb) {\n super(props, iModel);\n this.format = props.format;\n this.data = typeof props.data === \"string\" ? Base64EncodedString.toUint8Array(props.data) : props.data;\n this.description = props.description;\n }\n\n public override toJSON(): TextureProps {\n const val = super.toJSON() as TextureProps;\n val.format = this.format;\n val.data = Base64EncodedString.fromUint8Array(this.data);\n val.description = this.description;\n return val;\n }\n\n /** Create a Code for a Texture given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModelDb\n * @param scopeModelId The Id of the DefinitionModel that contains the Texture and provides the scope for its name.\n * @param name The Texture name\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, name: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.texture);\n return 0 === name.length ? Code.createEmpty() : new Code({ spec: codeSpec.id, scope: scopeModelId, value: name });\n }\n\n /** Create a texture with the given parameters.\n * @param iModelDb The iModel to contain the texture.\n * @param definitionModelId The [[DefinitionModel]] to contain the texture.\n * @param name The name to serve as the texture's [Code]($common) value.\n * @param format The format of the image data.\n * @param data The image data in the format specified by `format`.\n * @param description An optional description of the texture\n * @returns The newly constructed Texture element.\n * @throws [[IModelError]] if unable to create the element.\n * @see [[insertTexture]] to insert a new texture into the iModel.\n */\n public static createTexture(iModelDb: IModelDb, definitionModelId: Id64String, name: string, format: ImageSourceFormat, data: Uint8Array | Base64EncodedString, description?: string): Texture {\n const textureProps: TextureCreateProps = {\n classFullName: this.classFullName,\n code: this.createCode(iModelDb, definitionModelId, name),\n format,\n data,\n description,\n model: definitionModelId,\n isPrivate: false,\n };\n\n return new Texture(textureProps, iModelDb);\n }\n\n /** Insert a new texture into a [[DefinitionModel]].\n * @param iModelDb The iModel to contain the texture.\n * @param definitionModelId The [[DefinitionModel]] to contain the texture.\n * @param name The name to serve as the texture's [Code]($common) value.\n * @param format The format of the image data.\n * @param data The image data in the format specified by `format`.\n * @param description An optional description of the texture\n * @returns The Id of the newly-inserted texture element.\n * @throws [[IModelError]] if unable to insert the element.\n * @see [[insertTexture]] to insert a new texture into the iModel.\n */\n public static insertTexture(iModelDb: IModelDb, definitionModelId: Id64String, name: string, format: ImageSourceFormat, data: Uint8Array | Base64EncodedString, description?: string): Id64String {\n const texture = this.createTexture(iModelDb, definitionModelId, name, format, data, description);\n return iModelDb.elements.insertElement(texture.toJSON());\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Texture.js","sourceRoot":"","sources":["../../src/Texture.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EACL,mBAAmB,EAAE,WAAW,EAAE,IAAI,GACvC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAW9C;;GAEG;AACH,MAAM,OAAO,OAAQ,SAAQ,iBAAiB;IAC5C,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,SAAS,CAAC,CAAC,CAAC;IAC7D,MAAM,CAAoB;IAC1B,IAAI,CAAa;IACjB,WAAW,CAAU;IAE5B,YAAY;IACZ,YAAsB,KAAyB,EAAE,MAAgB;QAC/D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,IAA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KAAK,EAAE,iBAAiB;YACxB,SAAS,EAAE,KAAK;SACjB,CAAC;QAEF,OAAO,IAAI,OAAO,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;;;;;OAUG;IACI,MAAM,CAAC,aAAa,CAAC,QAAkB,EAAE,iBAA6B,EAAE,IAAY,EAAE,MAAyB,EAAE,IAAsC,EAAE,WAAoB;QAClL,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QACjG,OAAO,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3D,CAAC;CACF","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 Base64EncodedString, BisCodeSpec, Code, CodeScopeProps, CodeSpec, ImageSourceFormat, TextureProps,\n} from \"@itwin/core-common\";\nimport { DefinitionElement } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\n\n/** A [TextureProps]($common) in which the image data can be specified either as a base-64-encoded string or a Uint8Array.\n * @see [[Texture]] constructor.\n * @beta\n */\nexport interface TextureCreateProps extends Omit<TextureProps, \"data\"> {\n data: Base64EncodedString | Uint8Array;\n}\n\n/** Defines a rendering texture that is associated with a Material and applied to surface geometry.\n * @public @preview\n */\nexport class Texture extends DefinitionElement {\n /** @internal */\n public static override get className(): string { return \"Texture\"; }\n public format: ImageSourceFormat;\n public data: Uint8Array;\n public description?: string;\n\n /** @beta */\n protected constructor(props: TextureCreateProps, iModel: IModelDb) {\n super(props, iModel);\n this.format = props.format;\n this.data = typeof props.data === \"string\" ? Base64EncodedString.toUint8Array(props.data) : props.data;\n this.description = props.description;\n }\n\n public override toJSON(): TextureProps {\n const val = super.toJSON() as TextureProps;\n val.format = this.format;\n val.data = Base64EncodedString.fromUint8Array(this.data);\n val.description = this.description;\n return val;\n }\n\n /** Create a Code for a Texture given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModelDb\n * @param scopeModelId The Id of the DefinitionModel that contains the Texture and provides the scope for its name.\n * @param name The Texture name\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, name: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.texture);\n return 0 === name.length ? Code.createEmpty() : new Code({ spec: codeSpec.id, scope: scopeModelId, value: name });\n }\n\n /** Create a texture with the given parameters.\n * @param iModelDb The iModel to contain the texture.\n * @param definitionModelId The [[DefinitionModel]] to contain the texture.\n * @param name The name to serve as the texture's [Code]($common) value.\n * @param format The format of the image data.\n * @param data The image data in the format specified by `format`.\n * @param description An optional description of the texture\n * @returns The newly constructed Texture element.\n * @throws [[IModelError]] if unable to create the element.\n * @see [[insertTexture]] to insert a new texture into the iModel.\n */\n public static createTexture(iModelDb: IModelDb, definitionModelId: Id64String, name: string, format: ImageSourceFormat, data: Uint8Array | Base64EncodedString, description?: string): Texture {\n const textureProps: TextureCreateProps = {\n classFullName: this.classFullName,\n code: this.createCode(iModelDb, definitionModelId, name),\n format,\n data,\n description,\n model: definitionModelId,\n isPrivate: false,\n };\n\n return new Texture(textureProps, iModelDb);\n }\n\n /** Insert a new texture into a [[DefinitionModel]].\n * @param iModelDb The iModel to contain the texture.\n * @param definitionModelId The [[DefinitionModel]] to contain the texture.\n * @param name The name to serve as the texture's [Code]($common) value.\n * @param format The format of the image data.\n * @param data The image data in the format specified by `format`.\n * @param description An optional description of the texture\n * @returns The Id of the newly-inserted texture element.\n * @throws [[IModelError]] if unable to insert the element.\n * @see [[insertTexture]] to insert a new texture into the iModel.\n */\n public static insertTexture(iModelDb: IModelDb, definitionModelId: Id64String, name: string, format: ImageSourceFormat, data: Uint8Array | Base64EncodedString, description?: string): Id64String {\n const texture = this.createTexture(iModelDb, definitionModelId, name, format, data, description);\n return iModelDb.elements.insertElement(texture.toJSON());\n }\n}\n"]}
|