@itwin/core-backend 5.12.0-dev.5 → 5.12.0-dev.7

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -1
  3. package/lib/cjs/ChangeSummaryManager.js +33 -37
  4. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  5. package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
  6. package/lib/cjs/ChangesetECAdaptor.js +4 -7
  7. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  8. package/lib/cjs/ChangesetReader.d.ts +65 -23
  9. package/lib/cjs/ChangesetReader.d.ts.map +1 -1
  10. package/lib/cjs/ChangesetReader.js +162 -102
  11. package/lib/cjs/ChangesetReader.js.map +1 -1
  12. package/lib/cjs/ECDb.js +2 -2
  13. package/lib/cjs/ECDb.js.map +1 -1
  14. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  15. package/lib/cjs/ElementAspect.js +6 -10
  16. package/lib/cjs/ElementAspect.js.map +1 -1
  17. package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
  18. package/lib/cjs/ElementTreeWalker.js +16 -24
  19. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  20. package/lib/cjs/IModelDb.d.ts.map +1 -1
  21. package/lib/cjs/IModelDb.js +65 -85
  22. package/lib/cjs/IModelDb.js.map +1 -1
  23. package/lib/cjs/Relationship.d.ts.map +1 -1
  24. package/lib/cjs/Relationship.js +8 -11
  25. package/lib/cjs/Relationship.js.map +1 -1
  26. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  27. package/lib/cjs/ViewDefinition.js +8 -12
  28. package/lib/cjs/ViewDefinition.js.map +1 -1
  29. package/lib/cjs/ViewStore.d.ts.map +1 -1
  30. package/lib/cjs/ViewStore.js +6 -8
  31. package/lib/cjs/ViewStore.js.map +1 -1
  32. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  33. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +8 -11
  34. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  35. package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -1
  36. package/lib/cjs/internal/ChannelAdmin.js +6 -10
  37. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  38. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
  39. package/lib/cjs/internal/annotations/fields.js +19 -43
  40. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  41. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
  42. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +2 -3
  43. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  44. package/lib/esm/ChangeSummaryManager.d.ts.map +1 -1
  45. package/lib/esm/ChangeSummaryManager.js +34 -38
  46. package/lib/esm/ChangeSummaryManager.js.map +1 -1
  47. package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
  48. package/lib/esm/ChangesetECAdaptor.js +5 -8
  49. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  50. package/lib/esm/ChangesetReader.d.ts +65 -23
  51. package/lib/esm/ChangesetReader.d.ts.map +1 -1
  52. package/lib/esm/ChangesetReader.js +163 -103
  53. package/lib/esm/ChangesetReader.js.map +1 -1
  54. package/lib/esm/ECDb.js +2 -2
  55. package/lib/esm/ECDb.js.map +1 -1
  56. package/lib/esm/ElementAspect.d.ts.map +1 -1
  57. package/lib/esm/ElementAspect.js +8 -12
  58. package/lib/esm/ElementAspect.js.map +1 -1
  59. package/lib/esm/ElementTreeWalker.d.ts.map +1 -1
  60. package/lib/esm/ElementTreeWalker.js +18 -26
  61. package/lib/esm/ElementTreeWalker.js.map +1 -1
  62. package/lib/esm/IModelDb.d.ts.map +1 -1
  63. package/lib/esm/IModelDb.js +66 -86
  64. package/lib/esm/IModelDb.js.map +1 -1
  65. package/lib/esm/Relationship.d.ts.map +1 -1
  66. package/lib/esm/Relationship.js +9 -12
  67. package/lib/esm/Relationship.js.map +1 -1
  68. package/lib/esm/ViewDefinition.d.ts.map +1 -1
  69. package/lib/esm/ViewDefinition.js +10 -14
  70. package/lib/esm/ViewDefinition.js.map +1 -1
  71. package/lib/esm/ViewStore.d.ts.map +1 -1
  72. package/lib/esm/ViewStore.js +7 -9
  73. package/lib/esm/ViewStore.js.map +1 -1
  74. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  75. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +10 -13
  76. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  77. package/lib/esm/internal/ChannelAdmin.d.ts.map +1 -1
  78. package/lib/esm/internal/ChannelAdmin.js +7 -11
  79. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  80. package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
  81. package/lib/esm/internal/annotations/fields.js +21 -45
  82. package/lib/esm/internal/annotations/fields.js.map +1 -1
  83. package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
  84. package/lib/esm/rpc-impl/IModelReadRpcImpl.js +2 -3
  85. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  86. package/lib/esm/test/hubaccess/BriefcaseManager.test.js +1 -1
  87. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  88. package/lib/esm/test/imodel/IModel.test.js +9 -3
  89. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  90. package/lib/esm/test/standalone/ChangesetReader.test.js +725 -110
  91. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  92. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"file":"ECDb.js","sourceRoot":"","sources":["../../src/ECDb.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,E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AC,MAAM,EAAE;YAC3B,MAAM,IAAI,WAAW,CAAC,QAAQ,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QAEjE,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QACjD,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC7B,IAAI,GAAG,YAAY,OAAO,EAAE,CAAC;gBAC3B,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACN,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,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 ECDb\n */\nimport { assert, BeEvent, DbResult, Logger, OpenMode } from \"@itwin/core-bentley\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { DbQueryRequest, ECSchemaProps, ECSqlReader, IModelError, QueryBinder, QueryOptions } from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { ConcurrentQuery } from \"./ConcurrentQuery\";\nimport { ECSqlStatement, ECSqlWriteStatement } from \"./ECSqlStatement\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { SqliteStatement, StatementCache } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { ECSqlRowExecutor } from \"./ECSqlRowExecutor\";\nimport { ECSqlSyncReader, SynchronousQueryOptions } from \"./ECSqlSyncReader\";\n\nconst loggerCategory: string = BackendLoggerCategory.ECDb;\n\n/** Modes for how to open [ECDb]($backend) files.\n * @public\n */\nexport enum ECDbOpenMode {\n Readonly,\n ReadWrite,\n /** Opens the file read-write and upgrades the file if necessary to the latest file format version. */\n FileUpgrade,\n}\n\n/** An ECDb file\n * @public\n */\nexport class ECDb implements Disposable {\n private _nativeDb?: IModelJsNative.ECDb;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n private readonly _statementCache = new StatementCache<ECSqlStatement>();\n private _sqliteStatementCache = new StatementCache<SqliteStatement>();\n\n /** Event called when the ECDb is about to be closed. */\n public readonly onBeforeClose = new BeEvent<() => void>();\n\n /** only for tests\n * @internal\n */\n public resetSqliteCache(size: number) {\n this._sqliteStatementCache.clear();\n this._sqliteStatementCache = new StatementCache<SqliteStatement>(size);\n }\n\n constructor() {\n this._nativeDb = new IModelNative.platform.ECDb();\n }\n /** Call this function when finished with this ECDb object. This releases the native resources held by the\n * ECDb object.\n */\n public [Symbol.dispose](): void {\n if (!this._nativeDb)\n return;\n\n this.closeDb();\n this._nativeDb.dispose();\n this._nativeDb = undefined;\n }\n /**\n * Attach an iModel file to this connection and load and register its schemas.\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\n * @param fileName IModel file name\n * @param alias identifier for the attached file. This identifer is used to access schema from the attached file. e.g. if alias is 'abc' then schema can be accessed using 'abc.MySchema.MyClass'\n */\n public attachDb(fileName: string, alias: string): void {\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\n }\n this[_nativeDb].attachDb(fileName, alias);\n }\n /**\n * Detach the attached file from this connection. The attached file is closed and its schemas are unregistered.\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\n * @param alias identifer that was used in the call to [[attachDb]]\n */\n public detachDb(alias: string): void {\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\n }\n this.clearCaches();\n this[_nativeDb].detachDb(alias);\n }\n\n /** @deprecated in 5.0 - might be removed in next major version. Use [Symbol.dispose] instead. */\n public dispose(): void {\n this[Symbol.dispose]();\n }\n\n /** Create an ECDb\n * @param pathName The path to the ECDb file to create.\n * @throws [IModelError]($common) if the operation failed.\n */\n public createDb(pathName: string): void {\n const status: DbResult = this[_nativeDb].createDb(pathName);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to created ECDb\");\n }\n\n /** Open the ECDb.\n * @param pathName The path to the ECDb file to open\n * @param openMode Open mode\n * @throws [IModelError]($common) if the operation failed.\n */\n public openDb(pathName: string, openMode: ECDbOpenMode = ECDbOpenMode.Readonly): void {\n const nativeOpenMode: OpenMode = openMode === ECDbOpenMode.Readonly ? OpenMode.Readonly : OpenMode.ReadWrite;\n const tryUpgrade: boolean = openMode === ECDbOpenMode.FileUpgrade;\n const status: DbResult = this[_nativeDb].openDb(pathName, nativeOpenMode, tryUpgrade);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to open ECDb\");\n }\n\n /** Returns true if the ECDb is open */\n public get isOpen(): boolean { return this[_nativeDb].isOpen(); }\n\n /** Close the Db after saving any uncommitted changes.\n * @throws [IModelError]($common) if the database is not open.\n */\n public closeDb(): void {\n this.onBeforeClose.raiseEvent();\n this.clearCaches();\n this[_nativeDb].closeDb();\n }\n\n /** Clear all in-memory caches held in this ECDb.\n * @beta\n */\n public clearCaches(): void {\n this._statementCache.clear();\n this._sqliteStatementCache.clear();\n this[_nativeDb].clearECDbCache();\n }\n\n /** @internal use to test statement caching */\n public clearStatementCache() {\n this._statementCache.clear();\n }\n\n /** @internal use to test statement caching */\n public getCachedStatementCount() {\n return this._statementCache.size;\n }\n\n /** Commit the outermost transaction, writing changes to the file. Then, restart the transaction.\n * @param changesetName The name of the operation that generated these changes.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public saveChanges(changesetName?: string): void {\n const status: DbResult = this[_nativeDb].saveChanges(changesetName);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to save changes\");\n }\n\n /** Abandon (cancel) the outermost transaction, discarding all changes since last save. Then, restart the transaction.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public abandonChanges(): void {\n const status: DbResult = this[_nativeDb].abandonChanges();\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to abandon changes\");\n }\n\n /** Import a schema.\n *\n * If the import was successful, the database is automatically saved to disk.\n * @param pathName Path to ECSchema XML file to import.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public importSchema(pathName: string): void {\n const status: DbResult = this[_nativeDb].importSchema(pathName);\n if (status !== DbResult.BE_SQLITE_OK) {\n Logger.logError(loggerCategory, `Failed to import schema from '${pathName}'.`);\n throw new IModelError(status, `Failed to import schema from '${pathName}'.`);\n }\n this.clearCaches();\n }\n\n /** Removes unused schemas from the database.\n *\n * If the removal was successful, the database is automatically saved to disk.\n * @param schemaNames Array of schema names to drop\n * @throws [IModelError]($common) if the database if the operation failed.\n * @alpha\n */\n public dropSchemas(schemaNames: string[]): void {\n if (schemaNames.length === 0)\n return;\n if (this[_nativeDb].schemaSyncEnabled())\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Cannot drop schemas when schema sync is enabled\");\n\n try {\n this[_nativeDb].dropSchemas(schemaNames);\n this.saveChanges('dropped unused schemas');\n } catch (error: any) {\n Logger.logError(loggerCategory, `Failed to drop schemas: ${error}`);\n this.abandonChanges();\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Failed to drop schemas: ${error}`);\n } finally {\n this.clearCaches();\n }\n }\n\n /**\n * Returns the full schema for the input name.\n * @param name The name of the schema e.g. 'ECDbMeta'\n * @returns The SchemaProps for the requested schema\n * @throws if the schema can not be found or loaded.\n */\n public getSchemaProps(name: string): ECSchemaProps {\n return this[_nativeDb].getSchemaProps(name);\n }\n\n /**\n * Use a prepared ECSQL 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 ECSQL 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 [[withStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withWriteStatement]]\n * @beta\n */\n public withCachedWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\n const release = () => this._statementCache.addOrDispose(stmt);\n try {\n const val = callback(new ECSqlWriteStatement(stmt));\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withCachedWriteStatement]]\n * @beta\n */\n public withWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\n const stmt = this.prepareWriteStatement(ecsql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an ECSQL statement.\n * @param ecsql The ECSQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @beta\n */\n public prepareWriteStatement(ecsql: string, logErrors = true): ECSqlWriteStatement {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return new ECSqlWriteStatement(this.prepareStatement(ecsql, logErrors));\n }\n\n /**\n * Use a prepared ECSQL 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 ECSQL 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 [[withStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withStatement]]\n * @public\n * @deprecated in 4.11 - might be removed in next major version. Use [[createQueryReader]] for SELECT statements and [[withCachedWriteStatement]] for INSERT/UPDATE/DELETE instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\n const release = () => this._statementCache.addOrDispose(stmt);\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withPreparedStatement]]\n * @public\n * @deprecated in 4.11 - might be removed in next major version. Use [[createQueryReader]] for SELECT statements and [[withWriteStatement]] for INSERT/UPDATE/DELETE instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this.prepareStatement(ecsql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an ECSQL statement.\n * @param ecsql The ECSQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @deprecated in 4.11 - might be removed in next major version. Use [[prepareWriteStatement]] when preparing an INSERT/UPDATE/DELETE statement or [[createQueryReader]] to execute a SELECT statement.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public prepareStatement(ecsql: string, logErrors = true): ECSqlStatement {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = new ECSqlStatement();\n stmt.prepare(this[_nativeDb], ecsql, logErrors);\n return stmt;\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 * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withPreparedStatement]]\n * @public\n */\n public withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\n const stmt = this._sqliteStatementCache.findAndRemove(sql) ?? this.prepareSqliteStatement(sql, logErrors);\n const release = () => this._sqliteStatementCache.addOrDispose(stmt);\n try {\n const val: T = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared 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 * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @public\n */\n public withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\n const stmt = this.prepareSqliteStatement(sql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val: T = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an SQL statement.\n * @param sql The SQLite SQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\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 /** @internal */\n public get [_nativeDb](): IModelJsNative.ECDb {\n assert(undefined !== this._nativeDb);\n return this._nativeDb;\n }\n\n /** Allow to execute query and read results along with meta data. The result are streamed.\n *\n * See also:\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\n * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)\n * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)\n *\n * @param params The values to bind to the parameters (if the ECSQL has any).\n * @param config Allow to specify certain flags which control how query is executed.\n * @returns Returns an [ECSqlReader]($common) which helps iterate over the result set and also give access to metadata.\n * @public\n * */\n public createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader {\n if (!this._nativeDb || !this._nativeDb.isOpen()) {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"db not open\");\n }\n const executor = {\n execute: async (request: DbQueryRequest) => {\n return ConcurrentQuery.executeQueryRequest(this[_nativeDb], request);\n },\n };\n return new ECSqlReader(executor, ecsql, params, config);\n }\n\n /** Allow to execute query and read results along with meta data. The result are stepped one by one.\n *\n * See also:\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\n * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)\n * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)\n * @param ecsql The ECSQL query to execute.\n * @param callback the callback to invoke on the prepared ECSqlSyncReader\n * @param params The values to bind to the parameters (if the ECSQL has any).\n * @param config Optional flags which control how query is executed.\n * @returns the value returned by `callback`.\n * @throws IModelError if db is not open or if error occurs during statement execution\n * @beta\n * */\n public withQueryReader<T>(ecsql: string, callback: (reader: ECSqlSyncReader) => T, params?: QueryBinder, config?: SynchronousQueryOptions): T {\n if (!this[_nativeDb].isOpen())\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"db not open\");\n\n const executor = new ECSqlRowExecutor(this);\n const reader = new ECSqlSyncReader(executor, ecsql, params, config);\n const release = () => executor[Symbol.dispose]();\n try {\n const val = callback(reader);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err: any) {\n release();\n throw err;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"ECDb.js","sourceRoot":"","sources":["../../src/ECDb.ts"],"names":[],"mappings":"AA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E,QAAwC,EAAE,MAAoB,EAAE,MAAgC;QACvI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE;YAC3B,MAAM,IAAI,WAAW,CAAC,QAAQ,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC;QAEzE,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QACjD,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC7B,IAAI,GAAG,YAAY,OAAO,EAAE,CAAC;gBAC3B,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACN,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,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 ECDb\n */\nimport { assert, BeEvent, DbResult, Logger, OpenMode } from \"@itwin/core-bentley\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { DbQueryRequest, ECSchemaProps, ECSqlReader, IModelError, QueryBinder, QueryOptions } from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { ConcurrentQuery } from \"./ConcurrentQuery\";\nimport { ECSqlStatement, ECSqlWriteStatement } from \"./ECSqlStatement\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { SqliteStatement, StatementCache } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { ECSqlRowExecutor } from \"./ECSqlRowExecutor\";\nimport { ECSqlSyncReader, SynchronousQueryOptions } from \"./ECSqlSyncReader\";\n\nconst loggerCategory: string = BackendLoggerCategory.ECDb;\n\n/** Modes for how to open [ECDb]($backend) files.\n * @public\n */\nexport enum ECDbOpenMode {\n Readonly,\n ReadWrite,\n /** Opens the file read-write and upgrades the file if necessary to the latest file format version. */\n FileUpgrade,\n}\n\n/** An ECDb file\n * @public\n */\nexport class ECDb implements Disposable {\n private _nativeDb?: IModelJsNative.ECDb;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n private readonly _statementCache = new StatementCache<ECSqlStatement>();\n private _sqliteStatementCache = new StatementCache<SqliteStatement>();\n\n /** Event called when the ECDb is about to be closed. */\n public readonly onBeforeClose = new BeEvent<() => void>();\n\n /** only for tests\n * @internal\n */\n public resetSqliteCache(size: number) {\n this._sqliteStatementCache.clear();\n this._sqliteStatementCache = new StatementCache<SqliteStatement>(size);\n }\n\n constructor() {\n this._nativeDb = new IModelNative.platform.ECDb();\n }\n /** Call this function when finished with this ECDb object. This releases the native resources held by the\n * ECDb object.\n */\n public [Symbol.dispose](): void {\n if (!this._nativeDb)\n return;\n\n this.closeDb();\n this._nativeDb.dispose();\n this._nativeDb = undefined;\n }\n /**\n * Attach an iModel file to this connection and load and register its schemas.\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\n * @param fileName IModel file name\n * @param alias identifier for the attached file. This identifer is used to access schema from the attached file. e.g. if alias is 'abc' then schema can be accessed using 'abc.MySchema.MyClass'\n */\n public attachDb(fileName: string, alias: string): void {\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\n }\n this[_nativeDb].attachDb(fileName, alias);\n }\n /**\n * Detach the attached file from this connection. The attached file is closed and its schemas are unregistered.\n * @note There are some reserve tablespace names that cannot be used. They are 'main', 'schema_sync_db', 'ecchange' & 'temp'\n * @param alias identifer that was used in the call to [[attachDb]]\n */\n public detachDb(alias: string): void {\n if (alias.toLowerCase() === \"main\" || alias.toLowerCase() === \"schema_sync_db\" || alias.toLowerCase() === \"ecchange\" || alias.toLowerCase() === \"temp\") {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Reserved tablespace name cannot be used\");\n }\n this.clearCaches();\n this[_nativeDb].detachDb(alias);\n }\n\n /** @deprecated in 5.0 - might be removed in next major version. Use [Symbol.dispose] instead. */\n public dispose(): void {\n this[Symbol.dispose]();\n }\n\n /** Create an ECDb\n * @param pathName The path to the ECDb file to create.\n * @throws [IModelError]($common) if the operation failed.\n */\n public createDb(pathName: string): void {\n const status: DbResult = this[_nativeDb].createDb(pathName);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to created ECDb\");\n }\n\n /** Open the ECDb.\n * @param pathName The path to the ECDb file to open\n * @param openMode Open mode\n * @throws [IModelError]($common) if the operation failed.\n */\n public openDb(pathName: string, openMode: ECDbOpenMode = ECDbOpenMode.Readonly): void {\n const nativeOpenMode: OpenMode = openMode === ECDbOpenMode.Readonly ? OpenMode.Readonly : OpenMode.ReadWrite;\n const tryUpgrade: boolean = openMode === ECDbOpenMode.FileUpgrade;\n const status: DbResult = this[_nativeDb].openDb(pathName, nativeOpenMode, tryUpgrade);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to open ECDb\");\n }\n\n /** Returns true if the ECDb is open */\n public get isOpen(): boolean { return this[_nativeDb].isOpen(); }\n\n /** Close the Db after saving any uncommitted changes.\n * @throws [IModelError]($common) if the database is not open.\n */\n public closeDb(): void {\n this.onBeforeClose.raiseEvent();\n this.clearCaches();\n this[_nativeDb].closeDb();\n }\n\n /** Clear all in-memory caches held in this ECDb.\n * @beta\n */\n public clearCaches(): void {\n this._statementCache.clear();\n this._sqliteStatementCache.clear();\n this[_nativeDb].clearECDbCache();\n }\n\n /** @internal use to test statement caching */\n public clearStatementCache() {\n this._statementCache.clear();\n }\n\n /** @internal use to test statement caching */\n public getCachedStatementCount() {\n return this._statementCache.size;\n }\n\n /** Commit the outermost transaction, writing changes to the file. Then, restart the transaction.\n * @param changesetName The name of the operation that generated these changes.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public saveChanges(changesetName?: string): void {\n const status: DbResult = this[_nativeDb].saveChanges(changesetName);\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to save changes\");\n }\n\n /** Abandon (cancel) the outermost transaction, discarding all changes since last save. Then, restart the transaction.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public abandonChanges(): void {\n const status: DbResult = this[_nativeDb].abandonChanges();\n if (status !== DbResult.BE_SQLITE_OK)\n throw new IModelError(status, \"Failed to abandon changes\");\n }\n\n /** Import a schema.\n *\n * If the import was successful, the database is automatically saved to disk.\n * @param pathName Path to ECSchema XML file to import.\n * @throws [IModelError]($common) if the database is not open or if the operation failed.\n */\n public importSchema(pathName: string): void {\n const status: DbResult = this[_nativeDb].importSchema(pathName);\n if (status !== DbResult.BE_SQLITE_OK) {\n Logger.logError(loggerCategory, `Failed to import schema from '${pathName}'.`);\n throw new IModelError(status, `Failed to import schema from '${pathName}'.`);\n }\n this.clearCaches();\n }\n\n /** Removes unused schemas from the database.\n *\n * If the removal was successful, the database is automatically saved to disk.\n * @param schemaNames Array of schema names to drop\n * @throws [IModelError]($common) if the database if the operation failed.\n * @alpha\n */\n public dropSchemas(schemaNames: string[]): void {\n if (schemaNames.length === 0)\n return;\n if (this[_nativeDb].schemaSyncEnabled())\n throw new IModelError(DbResult.BE_SQLITE_ERROR, \"Cannot drop schemas when schema sync is enabled\");\n\n try {\n this[_nativeDb].dropSchemas(schemaNames);\n this.saveChanges('dropped unused schemas');\n } catch (error: any) {\n Logger.logError(loggerCategory, `Failed to drop schemas: ${error}`);\n this.abandonChanges();\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Failed to drop schemas: ${error}`);\n } finally {\n this.clearCaches();\n }\n }\n\n /**\n * Returns the full schema for the input name.\n * @param name The name of the schema e.g. 'ECDbMeta'\n * @returns The SchemaProps for the requested schema\n * @throws if the schema can not be found or loaded.\n */\n public getSchemaProps(name: string): ECSchemaProps {\n return this[_nativeDb].getSchemaProps(name);\n }\n\n /**\n * Use a prepared ECSQL 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 ECSQL 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 [[withStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withWriteStatement]]\n * @beta\n */\n public withCachedWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\n const release = () => this._statementCache.addOrDispose(stmt);\n try {\n const val = callback(new ECSqlWriteStatement(stmt));\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withCachedWriteStatement]]\n * @beta\n */\n public withWriteStatement<T>(ecsql: string, callback: (stmt: ECSqlWriteStatement) => T, logErrors = true): T {\n const stmt = this.prepareWriteStatement(ecsql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an ECSQL statement.\n * @param ecsql The ECSQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @beta\n */\n public prepareWriteStatement(ecsql: string, logErrors = true): ECSqlWriteStatement {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return new ECSqlWriteStatement(this.prepareStatement(ecsql, logErrors));\n }\n\n /**\n * Use a prepared ECSQL 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 ECSQL 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 [[withStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withStatement]]\n * @public\n * @deprecated in 4.11 - might be removed in next major version. Use [[createQueryReader]] for SELECT statements and [[withCachedWriteStatement]] for INSERT/UPDATE/DELETE instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this._statementCache.findAndRemove(ecsql) ?? this.prepareStatement(ecsql, logErrors);\n const release = () => this._statementCache.addOrDispose(stmt);\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed.\n * Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withPreparedStatement]]\n * @public\n * @deprecated in 4.11 - might be removed in next major version. Use [[createQueryReader]] for SELECT statements and [[withWriteStatement]] for INSERT/UPDATE/DELETE instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors = true): T {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = this.prepareStatement(ecsql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an ECSQL statement.\n * @param ecsql The ECSQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\n * @deprecated in 4.11 - might be removed in next major version. Use [[prepareWriteStatement]] when preparing an INSERT/UPDATE/DELETE statement or [[createQueryReader]] to execute a SELECT statement.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public prepareStatement(ecsql: string, logErrors = true): ECSqlStatement {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const stmt = new ECSqlStatement();\n stmt.prepare(this[_nativeDb], ecsql, logErrors);\n return stmt;\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 * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @see [[withPreparedStatement]]\n * @public\n */\n public withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\n const stmt = this._sqliteStatementCache.findAndRemove(sql) ?? this.prepareSqliteStatement(sql, logErrors);\n const release = () => this._sqliteStatementCache.addOrDispose(stmt);\n try {\n const val: T = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepared 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 * @param logErrors Determines if error will be logged if statement fail to prepare\n * @returns the value returned by `callback`.\n * @public\n */\n public withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors = true): T {\n const stmt = this.prepareSqliteStatement(sql, logErrors);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val: T = callback(stmt);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /** Prepare an SQL statement.\n * @param sql The SQLite SQL statement to prepare\n * @param logErrors Determines if error will be logged if statement fail to prepare\n * @throws [IModelError]($common) if there is a problem preparing the statement.\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 /** @internal */\n public get [_nativeDb](): IModelJsNative.ECDb {\n assert(undefined !== this._nativeDb);\n return this._nativeDb;\n }\n\n /** Allow to execute query and read results along with meta data. The result are streamed.\n *\n * See also:\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\n * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)\n * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)\n *\n * @param params The values to bind to the parameters (if the ECSQL has any).\n * @param config Allow to specify certain flags which control how query is executed.\n * @returns Returns an [ECSqlReader]($common) which helps iterate over the result set and also give access to metadata.\n * @public\n * */\n public createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader {\n if (!this._nativeDb || !this._nativeDb.isOpen()) {\n throw new IModelError(DbResult.BE_SQLITE_ERROR_NOTOPEN, \"db not open\");\n }\n const executor = {\n execute: async (request: DbQueryRequest) => {\n return ConcurrentQuery.executeQueryRequest(this[_nativeDb], request);\n },\n };\n return new ECSqlReader(executor, ecsql, params, config);\n }\n\n /** Allow to execute query and read results along with meta data. The result are stepped one by one.\n *\n * See also:\n * - [ECSQL Overview]($docs/learning/backend/ExecutingECSQL)\n * - [Code Examples]($docs/learning/backend/ECSQLCodeExamples)\n * - [ECSQL Row Format]($docs/learning/ECSQLRowFormat)\n * @param ecsql The ECSQL query to execute.\n * @param callback the callback to invoke on the prepared ECSqlSyncReader\n * @param params The values to bind to the parameters (if the ECSQL has any).\n * @param config Optional flags which control how query is executed.\n * @returns the value returned by `callback`.\n * @throws IModelError if db is not open or if error occurs during statement execution\n * @beta\n * */\n public withQueryReader<T>(ecsql: string, callback: (reader: ECSqlSyncReader) => T, params?: QueryBinder, config?: SynchronousQueryOptions): T {\n if (!this[_nativeDb].isOpen())\n throw new IModelError(DbResult.BE_SQLITE_ERROR_NOTOPEN, \"db not open\");\n\n const executor = new ECSqlRowExecutor(this);\n const reader = new ECSqlSyncReader(executor, ecsql, params, config);\n const release = () => executor[Symbol.dispose]();\n try {\n const val = callback(reader);\n if (val instanceof Promise) {\n val.then(release, release);\n } else {\n release();\n }\n return val;\n } catch (err: any) {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D,WAA2B,SAAS,IAAI,MAAM,CAAmC;IAEjF;;;OAGG;IACI,KAAK,EAAE,cAAc,CAAC;IAC7B,6DAA6D;IACtD,UAAU,EAAE,MAAM,CAAC;IAC1B,uDAAuD;IAChD,IAAI,EAAE,MAAM,CAAC;IACpB,mKAAmK;IAC5J,QAAQ,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACI,OAAO,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACI,cAAc,CAAC,EAAE,MAAM,CAAC;IAC/B,iHAAiH;IAC1G,MAAM,CAAC,EAAE,cAAc,CAAC;IAE/B,kFAAkF;gBACtE,KAAK,EAAE,yBAAyB,EAAE,MAAM,EAAE,QAAQ;IAW9D;;;;;;;;;;;MAWE;WACY,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,SAAS,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,UAAU,CAAA;KAAE,CAAC;IAW9I,MAAM,IAAI,yBAAyB;cAYhC,mBAAmB,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;CAQ/E;AAED,uBAAuB;AACvB,yBAAiB,oBAAoB,CAAC;IACpC;;OAEG;IACH,KAAY,IAAI;QACd,oFAAoF;QACpF,OAAO,YAAY;QACnB,yFAAyF;QACzF,YAAY,iBAAiB;QAC7B;;WAEG;QACH,KAAK,UAAU;KAChB;CACF"}
@@ -5,9 +5,9 @@
5
5
  /** @packageDocumentation
6
6
  * @module ElementAspects
7
7
  */
8
- import { RelatedElement } from "@itwin/core-common";
8
+ import { QueryBinder, RelatedElement } from "@itwin/core-common";
9
9
  import { Entity } from "./Entity";
10
- import { assert, DbResult } from "@itwin/core-bentley";
10
+ import { assert } from "@itwin/core-bentley";
11
11
  import { _implicitTxn, _verifyChannel } from "./internal/Symbols";
12
12
  import { SheetOwnsSheetInformationAspect } from "./NavigationRelationship";
13
13
  import { Sheet } from "./Element";
@@ -262,17 +262,13 @@ export class ExternalSourceAspect extends ElementMultiAspect {
262
262
  */
263
263
  static findAllBySource(iModelDb, scope, kind, identifier) {
264
264
  const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;
265
- const found = [];
266
- // eslint-disable-next-line @typescript-eslint/no-deprecated
267
- iModelDb.withPreparedStatement(sql, (statement) => {
268
- statement.bindId("scope", scope);
269
- statement.bindString("kind", kind);
270
- statement.bindString("identifier", identifier);
271
- while (DbResult.BE_SQLITE_ROW === statement.step()) {
272
- found.push({ elementId: statement.getValue(0).getId(), aspectId: statement.getValue(1).getId() });
265
+ return iModelDb.withQueryReader(sql, (reader) => {
266
+ const found = [];
267
+ for (const row of reader) {
268
+ found.push({ elementId: row[0], aspectId: row[1] });
273
269
  }
274
- });
275
- return found;
270
+ return found;
271
+ }, new QueryBinder().bindId("scope", scope).bindString("kind", kind).bindString("identifier", identifier));
276
272
  }
277
273
  toJSON() {
278
274
  const val = super.toJSON();
@@ -1 +1 @@
1
- {"version":3,"file":"ElementAspect.js","sourceRoot":"","sources":["../../src/ElementAspect.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA6F,cAAc,EAAiD,MAAM,oBAAoB,CAAC;AAC9L,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAc,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MA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AAY,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,MAAM;YACb,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF;AAED,uBAAuB;AACvB,WAAiB,oBAAoB;IACnC;;OAEG;IACH,IAAY,IASX;IATD,WAAY,IAAI;QACd,oFAAoF;QACpF,2BAAmB,CAAA;QACnB,yFAAyF;QACzF,qCAA6B,CAAA;QAC7B;;WAEG;QACH,uBAAe,CAAA;IACjB,CAAC,EATW,IAAI,GAAJ,yBAAI,KAAJ,yBAAI,QASf;AACH,CAAC,EAdgB,oBAAoB,KAApB,oBAAoB,QAcpC","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 ElementAspects\n */\n\nimport { ChannelRootAspectProps, ElementAspectProps, EntityReferenceSet, ExternalSourceAspectProps, RelatedElement, SheetInformation, SheetInformationAspectProps } from \"@itwin/core-common\";\nimport { Entity } from \"./Entity\";\nimport { IModelDb } from \"./IModelDb\";\nimport { ECSqlStatement } from \"./ECSqlStatement\";\nimport { assert, DbResult, Id64String } from \"@itwin/core-bentley\";\nimport { _implicitTxn, _verifyChannel } from \"./internal/Symbols\";\nimport { SheetOwnsSheetInformationAspect } from \"./NavigationRelationship\";\nimport { Sheet } from \"./Element\";\nimport { ECVersion } from \"@itwin/ecschema-metadata\";\nimport { EditTxn } from \"./EditTxn\";\n\n/** Argument for the `ElementAspect.onXxx` static methods\n * @beta\n */\nexport interface OnAspectArg {\n /** The iModel for the aspect affected by this event. */\n iModel: IModelDb;\n /** The model for the aspect affected by this event */\n model: Id64String;\n}\n/** Argument for the `ElementAspect.onXxx` static methods that supply the properties of an aspect to be inserted or updated.\n * @beta\n */\nexport interface OnAspectPropsArg extends OnAspectArg {\n /** The new properties of the aspect affected by this event. */\n props: Readonly<ElementAspectProps>;\n}\n/** Argument for the `ElementAspect.onXxx` static methods that only supply the Id of the affected aspect.\n * @beta\n */\nexport interface OnAspectIdArg extends OnAspectArg {\n /** The Id of the aspect affected by this event */\n aspectId: Id64String;\n}\n\n/** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.\n * Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.\n * BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.\n * @public @preview\n */\nexport class ElementAspect extends Entity {\n public static override get className(): string { return \"ElementAspect\"; }\n public element: RelatedElement;\n\n /** Construct an aspect from its JSON representation and its containing iModel. */\n constructor(props: ElementAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.element = RelatedElement.fromJSON(props.element)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n }\n\n public override toJSON(): ElementAspectProps {\n const val = super.toJSON() as ElementAspectProps;\n val.element = this.element;\n return val;\n }\n\n /** Called before a new ElementAspect is inserted.\n * @note throw an exception to disallow the insert\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onInsert(arg: OnAspectPropsArg): void {\n const { props, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n iModel.locks.checkExclusiveLock(props.element.id, \"element\", \"insert aspect\");\n }\n\n /** Called after a new ElementAspect was inserted.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onInserted(_arg: OnAspectPropsArg): void { }\n\n /** Called before an ElementAspect is updated.\n * @note throw an exception to disallow the update\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onUpdate(arg: OnAspectPropsArg): void {\n const { props, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n iModel.locks.checkExclusiveLock(props.element.id, \"element\", \"update aspect\");\n }\n\n /** Called after an ElementAspect was updated.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onUpdated(_arg: OnAspectPropsArg): void { }\n\n /** Called before an ElementAspect is deleted.\n * @note throw an exception to disallow the delete\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onDelete(arg: OnAspectIdArg): void {\n const { aspectId, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n const { element } = iModel.elements.getAspect(aspectId);\n iModel.locks.checkExclusiveLock(element.id, \"element\", \"delete aspect\");\n }\n\n /** Called after an ElementAspect was deleted.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onDeleted(_arg: OnAspectIdArg): void { }\n}\n/** An Element Unique Aspect is an ElementAspect where there can be only zero or one instance of the Element Aspect class per Element.\n * @public @preview\n */\nexport class ElementUniqueAspect extends ElementAspect {\n public static override get className(): string { return \"ElementUniqueAspect\"; }\n}\n\n/** An Element Multi-Aspect is an ElementAspect where there can be **n** instances of the Element Aspect class per Element.\n * @public @preview\n */\nexport class ElementMultiAspect extends ElementAspect {\n public static override get className(): string { return \"ElementMultiAspect\"; }\n}\n\n/**\n * @public @preview\n */\nexport class ChannelRootAspect extends ElementUniqueAspect {\n public static override get className(): string { return \"ChannelRootAspect\"; }\n /** Insert a ChannelRootAspect on the specified element.\n * @deprecated in 4.0 - might be removed in next major version. Use [[ChannelControl.makeChannelRoot]]. This method does not enforce the rule that channels may not nest and is therefore dangerous.\n */\n public static insert(iModel: IModelDb, ownerId: Id64String, channelName: string) {\n const props: ChannelRootAspectProps = { classFullName: this.classFullName, element: { id: ownerId }, owner: channelName };\n iModel[_implicitTxn].insertAspect(props);\n }\n}\n\nconst minimumBisCoreVersion = new ECVersion(1, 0, 25);\n\n/** An [[ElementUniqueAspect]] that captures common metadata about a single [[Sheet]].\n * Use [[getSheetInformation]] to retrieve the metadata for a Sheet and [[setSheetInformation]] to create, update, or delete it.\n * @beta\n */\nexport class SheetInformationAspect extends ElementUniqueAspect {\n public static override get className() { return \"SheetInformationAspect\"; }\n\n /** The sheet's metadata. */\n public sheetInformation: SheetInformation;\n\n protected static override onInsert(arg: OnAspectPropsArg): void {\n super.onInsert(arg);\n\n const sheet = arg.iModel.elements.tryGetElement<Sheet>(arg.props.element);\n if (!(sheet instanceof Sheet)) {\n throw new Error(\"SheetInformationAspect can only be applied to a Sheet element\");\n }\n }\n\n private constructor(props: SheetInformationAspectProps, iModel: IModelDb) {\n super(props, iModel);\n\n const designedDate = undefined !== props.designedDate ? new Date(props.designedDate) : undefined;\n\n this.sheetInformation = {\n designedBy: props.designedBy,\n designedDate,\n drawnBy: props.drawnBy,\n checkedBy: props.checkedBy,\n };\n }\n\n public override toJSON(): SheetInformationAspectProps {\n const props = super.toJSON() as SheetInformationAspectProps;\n for (const key of [\"designedBy\", \"drawnBy\", \"checkedBy\"] as const) {\n const value = this.sheetInformation[key];\n if (undefined !== value) {\n props[key] = value;\n }\n }\n\n if (undefined !== this.sheetInformation.designedDate) {\n props.designedDate = this.sheetInformation.designedDate.toISOString();\n }\n\n return props;\n }\n\n private static findForSheet(sheetId: Id64String, iModel: IModelDb): SheetInformationAspect | undefined {\n if (!iModel.meetsMinimumSchemaVersion(\"BisCore\", minimumBisCoreVersion)) {\n return undefined;\n }\n\n const aspects = iModel.elements.getAspects(sheetId, this.classFullName);\n if (aspects[0]) {\n assert(aspects[0] instanceof SheetInformationAspect);\n return aspects[0];\n }\n\n return undefined;\n }\n\n /** Retrieves the metadata hosted by the aspect on the specified sheet, returning `undefined` if no such metadata could be retrieved.\n * @see [[setSheetInformation]] to create, update, or delete the aspect.\n */\n public static getSheetInformation(sheetId: Id64String, iModel: IModelDb): SheetInformation | undefined {\n const aspect = this.findForSheet(sheetId, iModel);\n return aspect?.sheetInformation;\n }\n\n /** Sets the `information` for the [[Sheet]] element specified by ``sheetId`.\n * If `information` is `undefined`, any existing aspect will be deleted.\n * Otherwise, a new aspect will be inserted, or an existing aspect will be updated with the new metadata.\n * @throws Error if the iModel contains a version of the BisCore schema older than 01.00.25.\n * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use SheetInformationAspect.setSheetInformation(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.\n */\n public static setSheetInformation(information: SheetInformation | undefined, sheetId: Id64String, iModel: IModelDb): void;\n\n /** Sets the `information` for the [[Sheet]] element specified by `sheetId`, using an explicit EditTxn.\n * If `information` is `undefined`, any existing aspect will be deleted.\n * Otherwise, a new aspect will be inserted, or an existing aspect will be updated with the new metadata.\n * @throws Error if the iModel contains a version of the BisCore schema older than 01.00.25.\n * @throws EditTxnError if the EditTxn is not active.\n * @beta\n */\n public static setSheetInformation(txn: EditTxn, information: SheetInformation | undefined, sheetId: Id64String): void;\n public static setSheetInformation(arg1: EditTxn | SheetInformation | undefined, arg2: SheetInformation | Id64String | undefined, arg3: Id64String | IModelDb): void {\n let txn: EditTxn;\n let information: SheetInformation | undefined;\n let sheetId: Id64String;\n\n if (arg1 instanceof EditTxn) {\n txn = arg1;\n information = arg2 as SheetInformation | undefined;\n sheetId = arg3 as Id64String;\n } else {\n txn = (arg3 as IModelDb)[_implicitTxn];\n information = arg1;\n sheetId = arg2 as Id64String;\n }\n\n txn.iModel.requireMinimumSchemaVersion(\"BisCore\", minimumBisCoreVersion, \"SheetInformationAspect\");\n\n const aspect = this.findForSheet(sheetId, txn.iModel);\n if (!information) {\n if (aspect) {\n txn.deleteAspect(aspect.id);\n }\n\n return;\n }\n\n if (aspect) {\n aspect.sheetInformation = { ...information };\n txn.updateAspect(aspect.toJSON());\n } else {\n const info = { ...information } as any;\n for (const key of Object.keys(info)) {\n if (info[key] === undefined) {\n delete info[key];\n }\n }\n\n if (undefined !== info.designedDate) {\n info.designedDate = info.designedDate.toISOString();\n }\n\n const props: SheetInformationAspectProps = {\n classFullName: this.classFullName,\n element: {\n id: sheetId,\n relClassName: SheetOwnsSheetInformationAspect.classFullName,\n },\n ...info,\n };\n\n txn.insertAspect(props);\n }\n }\n}\n\n/** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.2\n * @public @preview\n */\nexport class ExternalSourceAspect extends ElementMultiAspect {\n public static override get className(): string { return \"ExternalSourceAspect\"; }\n\n /** An element that scopes the combination of `kind` and `identifier` to uniquely identify the object from the external source.\n * @note Warning: in a future major release the `scope` property will be optional, since the scope is intended to be potentially invalid.\n * all references should treat it as potentially undefined, but we cannot change the type yet since that is a breaking change.\n */\n public scope: RelatedElement;\n /** The identifier of the object in the source repository. */\n public identifier: string;\n /** The kind of object within the source repository. */\n public kind: string;\n /** The cryptographic hash (any algorithm) of the source object's content. If defined, it must be guaranteed to change when the source object's content changes. */\n public checksum?: string;\n /** An optional value that is typically a version number or a pseudo version number like last modified time.\n * It will be used by the synchronization process to detect that a source object is unchanged so that computing a cryptographic hash can be avoided.\n * If present, this value must be guaranteed to change when any of the source object's content changes.\n */\n public version?: string;\n /** A place where additional JSON properties can be stored. For example, provenance information or properties relating to the synchronization process.\n * @note Warning: in a future major release, the type of `jsonProperties` will be changed to object, and itwin.js will automatically stringify it when writing to the iModel.\n * This will be a breaking change, since application code will have to change from supplying a string to supplying an object.\n */\n public jsonProperties?: string;\n /** The source of the imported/synchronized object. Should point to an instance of [ExternalSource]($backend). */\n public source?: RelatedElement;\n\n /** Construct an aspect from its JSON representation and its containing iModel. */\n constructor(props: ExternalSourceAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.scope = RelatedElement.fromJSON(props.scope)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n this.source = RelatedElement.fromJSON(props.source);\n this.identifier = props.identifier;\n this.kind = props.kind;\n this.checksum = props.checksum;\n this.version = props.version;\n this.jsonProperties = props.jsonProperties;\n }\n\n /** Look up the elements that contain one or more ExternalSourceAspect with the specified Scope, Kind, and Identifier.\n * The result of this function is an array of all of the ExternalSourceAspects that were found, each associated with the owning element.\n * A given element could have more than one ExternalSourceAspect with the given scope, kind, and identifier.\n * Also, many elements could have ExternalSourceAspect with the same scope, kind, and identifier.\n * Therefore, the result array could have more than one entry with the same elementId.\n * Aspects are never shared. Each aspect has its own unique ECInstanceId.\n * @param iModelDb The iModel to query\n * @param scope The scope of the ExternalSourceAspects to find\n * @param kind The kind of the ExternalSourceAspects to find\n * @param identifier The identifier of the ExternalSourceAspects to find\n * @returns the query results\n */\n public static findAllBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): Array<{ elementId: Id64String, aspectId: Id64String }> {\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\n const found: Array<{ elementId: Id64String, aspectId: Id64String }> = [];\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\n statement.bindId(\"scope\", scope);\n statement.bindString(\"kind\", kind);\n statement.bindString(\"identifier\", identifier);\n while (DbResult.BE_SQLITE_ROW === statement.step()) {\n found.push({ elementId: statement.getValue(0).getId(), aspectId: statement.getValue(1).getId() });\n }\n });\n return found;\n }\n\n public override toJSON(): ExternalSourceAspectProps {\n const val = super.toJSON() as ExternalSourceAspectProps;\n val.scope = this.scope;\n val.source = this.source;\n val.identifier = this.identifier;\n val.kind = this.kind;\n val.checksum = this.checksum;\n val.version = this.version;\n val.jsonProperties = this.jsonProperties;\n return val;\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n if (this.scope)\n referenceIds.addElement(this.scope.id);\n referenceIds.addElement(this.element.id);\n if (this.source)\n referenceIds.addElement(this.source.id);\n }\n}\n\n/** @public @preview */\nexport namespace ExternalSourceAspect {\n /** Standard values for the `Kind` property of `ExternalSourceAspect`.\n * @public @preview\n */\n export enum Kind {\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Element]] provenance */\n Element = \"Element\",\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Relationship]] provenance */\n Relationship = \"Relationship\",\n /** Indicates that the [[ExternalSourceAspect]] is storing *scope* provenance\n * @see [[ExternalSourceAspect.scope]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AI,GAAG,IAAI,CAAC,IAAI,CAAC;QACrB,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QACzC,OAAO,GAAG,CAAC;IACb,CAAC;IAEkB,mBAAmB,CAAC,YAAgC;QACrE,KAAK,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;QACxC,IAAI,IAAI,CAAC,KAAK;YACZ,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,MAAM;YACb,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF;AAED,uBAAuB;AACvB,WAAiB,oBAAoB;IACnC;;OAEG;IACH,IAAY,IASX;IATD,WAAY,IAAI;QACd,oFAAoF;QACpF,2BAAmB,CAAA;QACnB,yFAAyF;QACzF,qCAA6B,CAAA;QAC7B;;WAEG;QACH,uBAAe,CAAA;IACjB,CAAC,EATW,IAAI,GAAJ,yBAAI,KAAJ,yBAAI,QASf;AACH,CAAC,EAdgB,oBAAoB,KAApB,oBAAoB,QAcpC","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 ElementAspects\n */\n\nimport { ChannelRootAspectProps, ElementAspectProps, EntityReferenceSet, ExternalSourceAspectProps, QueryBinder, RelatedElement, SheetInformation, SheetInformationAspectProps } from \"@itwin/core-common\";\nimport { Entity } from \"./Entity\";\nimport { IModelDb } from \"./IModelDb\";\nimport { assert, Id64String } from \"@itwin/core-bentley\";\nimport { _implicitTxn, _verifyChannel } from \"./internal/Symbols\";\nimport { SheetOwnsSheetInformationAspect } from \"./NavigationRelationship\";\nimport { Sheet } from \"./Element\";\nimport { ECVersion } from \"@itwin/ecschema-metadata\";\nimport { EditTxn } from \"./EditTxn\";\n\n/** Argument for the `ElementAspect.onXxx` static methods\n * @beta\n */\nexport interface OnAspectArg {\n /** The iModel for the aspect affected by this event. */\n iModel: IModelDb;\n /** The model for the aspect affected by this event */\n model: Id64String;\n}\n/** Argument for the `ElementAspect.onXxx` static methods that supply the properties of an aspect to be inserted or updated.\n * @beta\n */\nexport interface OnAspectPropsArg extends OnAspectArg {\n /** The new properties of the aspect affected by this event. */\n props: Readonly<ElementAspectProps>;\n}\n/** Argument for the `ElementAspect.onXxx` static methods that only supply the Id of the affected aspect.\n * @beta\n */\nexport interface OnAspectIdArg extends OnAspectArg {\n /** The Id of the aspect affected by this event */\n aspectId: Id64String;\n}\n\n/** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.\n * Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.\n * BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.\n * @public @preview\n */\nexport class ElementAspect extends Entity {\n public static override get className(): string { return \"ElementAspect\"; }\n public element: RelatedElement;\n\n /** Construct an aspect from its JSON representation and its containing iModel. */\n constructor(props: ElementAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.element = RelatedElement.fromJSON(props.element)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n }\n\n public override toJSON(): ElementAspectProps {\n const val = super.toJSON() as ElementAspectProps;\n val.element = this.element;\n return val;\n }\n\n /** Called before a new ElementAspect is inserted.\n * @note throw an exception to disallow the insert\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onInsert(arg: OnAspectPropsArg): void {\n const { props, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n iModel.locks.checkExclusiveLock(props.element.id, \"element\", \"insert aspect\");\n }\n\n /** Called after a new ElementAspect was inserted.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onInserted(_arg: OnAspectPropsArg): void { }\n\n /** Called before an ElementAspect is updated.\n * @note throw an exception to disallow the update\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onUpdate(arg: OnAspectPropsArg): void {\n const { props, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n iModel.locks.checkExclusiveLock(props.element.id, \"element\", \"update aspect\");\n }\n\n /** Called after an ElementAspect was updated.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onUpdated(_arg: OnAspectPropsArg): void { }\n\n /** Called before an ElementAspect is deleted.\n * @note throw an exception to disallow the delete\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onDelete(arg: OnAspectIdArg): void {\n const { aspectId, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n const { element } = iModel.elements.getAspect(aspectId);\n iModel.locks.checkExclusiveLock(element.id, \"element\", \"delete aspect\");\n }\n\n /** Called after an ElementAspect was deleted.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onDeleted(_arg: OnAspectIdArg): void { }\n}\n/** An Element Unique Aspect is an ElementAspect where there can be only zero or one instance of the Element Aspect class per Element.\n * @public @preview\n */\nexport class ElementUniqueAspect extends ElementAspect {\n public static override get className(): string { return \"ElementUniqueAspect\"; }\n}\n\n/** An Element Multi-Aspect is an ElementAspect where there can be **n** instances of the Element Aspect class per Element.\n * @public @preview\n */\nexport class ElementMultiAspect extends ElementAspect {\n public static override get className(): string { return \"ElementMultiAspect\"; }\n}\n\n/**\n * @public @preview\n */\nexport class ChannelRootAspect extends ElementUniqueAspect {\n public static override get className(): string { return \"ChannelRootAspect\"; }\n /** Insert a ChannelRootAspect on the specified element.\n * @deprecated in 4.0 - might be removed in next major version. Use [[ChannelControl.makeChannelRoot]]. This method does not enforce the rule that channels may not nest and is therefore dangerous.\n */\n public static insert(iModel: IModelDb, ownerId: Id64String, channelName: string) {\n const props: ChannelRootAspectProps = { classFullName: this.classFullName, element: { id: ownerId }, owner: channelName };\n iModel[_implicitTxn].insertAspect(props);\n }\n}\n\nconst minimumBisCoreVersion = new ECVersion(1, 0, 25);\n\n/** An [[ElementUniqueAspect]] that captures common metadata about a single [[Sheet]].\n * Use [[getSheetInformation]] to retrieve the metadata for a Sheet and [[setSheetInformation]] to create, update, or delete it.\n * @beta\n */\nexport class SheetInformationAspect extends ElementUniqueAspect {\n public static override get className() { return \"SheetInformationAspect\"; }\n\n /** The sheet's metadata. */\n public sheetInformation: SheetInformation;\n\n protected static override onInsert(arg: OnAspectPropsArg): void {\n super.onInsert(arg);\n\n const sheet = arg.iModel.elements.tryGetElement<Sheet>(arg.props.element);\n if (!(sheet instanceof Sheet)) {\n throw new Error(\"SheetInformationAspect can only be applied to a Sheet element\");\n }\n }\n\n private constructor(props: SheetInformationAspectProps, iModel: IModelDb) {\n super(props, iModel);\n\n const designedDate = undefined !== props.designedDate ? new Date(props.designedDate) : undefined;\n\n this.sheetInformation = {\n designedBy: props.designedBy,\n designedDate,\n drawnBy: props.drawnBy,\n checkedBy: props.checkedBy,\n };\n }\n\n public override toJSON(): SheetInformationAspectProps {\n const props = super.toJSON() as SheetInformationAspectProps;\n for (const key of [\"designedBy\", \"drawnBy\", \"checkedBy\"] as const) {\n const value = this.sheetInformation[key];\n if (undefined !== value) {\n props[key] = value;\n }\n }\n\n if (undefined !== this.sheetInformation.designedDate) {\n props.designedDate = this.sheetInformation.designedDate.toISOString();\n }\n\n return props;\n }\n\n private static findForSheet(sheetId: Id64String, iModel: IModelDb): SheetInformationAspect | undefined {\n if (!iModel.meetsMinimumSchemaVersion(\"BisCore\", minimumBisCoreVersion)) {\n return undefined;\n }\n\n const aspects = iModel.elements.getAspects(sheetId, this.classFullName);\n if (aspects[0]) {\n assert(aspects[0] instanceof SheetInformationAspect);\n return aspects[0];\n }\n\n return undefined;\n }\n\n /** Retrieves the metadata hosted by the aspect on the specified sheet, returning `undefined` if no such metadata could be retrieved.\n * @see [[setSheetInformation]] to create, update, or delete the aspect.\n */\n public static getSheetInformation(sheetId: Id64String, iModel: IModelDb): SheetInformation | undefined {\n const aspect = this.findForSheet(sheetId, iModel);\n return aspect?.sheetInformation;\n }\n\n /** Sets the `information` for the [[Sheet]] element specified by ``sheetId`.\n * If `information` is `undefined`, any existing aspect will be deleted.\n * Otherwise, a new aspect will be inserted, or an existing aspect will be updated with the new metadata.\n * @throws Error if the iModel contains a version of the BisCore schema older than 01.00.25.\n * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use SheetInformationAspect.setSheetInformation(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.\n */\n public static setSheetInformation(information: SheetInformation | undefined, sheetId: Id64String, iModel: IModelDb): void;\n\n /** Sets the `information` for the [[Sheet]] element specified by `sheetId`, using an explicit EditTxn.\n * If `information` is `undefined`, any existing aspect will be deleted.\n * Otherwise, a new aspect will be inserted, or an existing aspect will be updated with the new metadata.\n * @throws Error if the iModel contains a version of the BisCore schema older than 01.00.25.\n * @throws EditTxnError if the EditTxn is not active.\n * @beta\n */\n public static setSheetInformation(txn: EditTxn, information: SheetInformation | undefined, sheetId: Id64String): void;\n public static setSheetInformation(arg1: EditTxn | SheetInformation | undefined, arg2: SheetInformation | Id64String | undefined, arg3: Id64String | IModelDb): void {\n let txn: EditTxn;\n let information: SheetInformation | undefined;\n let sheetId: Id64String;\n\n if (arg1 instanceof EditTxn) {\n txn = arg1;\n information = arg2 as SheetInformation | undefined;\n sheetId = arg3 as Id64String;\n } else {\n txn = (arg3 as IModelDb)[_implicitTxn];\n information = arg1;\n sheetId = arg2 as Id64String;\n }\n\n txn.iModel.requireMinimumSchemaVersion(\"BisCore\", minimumBisCoreVersion, \"SheetInformationAspect\");\n\n const aspect = this.findForSheet(sheetId, txn.iModel);\n if (!information) {\n if (aspect) {\n txn.deleteAspect(aspect.id);\n }\n\n return;\n }\n\n if (aspect) {\n aspect.sheetInformation = { ...information };\n txn.updateAspect(aspect.toJSON());\n } else {\n const info = { ...information } as any;\n for (const key of Object.keys(info)) {\n if (info[key] === undefined) {\n delete info[key];\n }\n }\n\n if (undefined !== info.designedDate) {\n info.designedDate = info.designedDate.toISOString();\n }\n\n const props: SheetInformationAspectProps = {\n classFullName: this.classFullName,\n element: {\n id: sheetId,\n relClassName: SheetOwnsSheetInformationAspect.classFullName,\n },\n ...info,\n };\n\n txn.insertAspect(props);\n }\n }\n}\n\n/** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.2\n * @public @preview\n */\nexport class ExternalSourceAspect extends ElementMultiAspect {\n public static override get className(): string { return \"ExternalSourceAspect\"; }\n\n /** An element that scopes the combination of `kind` and `identifier` to uniquely identify the object from the external source.\n * @note Warning: in a future major release the `scope` property will be optional, since the scope is intended to be potentially invalid.\n * all references should treat it as potentially undefined, but we cannot change the type yet since that is a breaking change.\n */\n public scope: RelatedElement;\n /** The identifier of the object in the source repository. */\n public identifier: string;\n /** The kind of object within the source repository. */\n public kind: string;\n /** The cryptographic hash (any algorithm) of the source object's content. If defined, it must be guaranteed to change when the source object's content changes. */\n public checksum?: string;\n /** An optional value that is typically a version number or a pseudo version number like last modified time.\n * It will be used by the synchronization process to detect that a source object is unchanged so that computing a cryptographic hash can be avoided.\n * If present, this value must be guaranteed to change when any of the source object's content changes.\n */\n public version?: string;\n /** A place where additional JSON properties can be stored. For example, provenance information or properties relating to the synchronization process.\n * @note Warning: in a future major release, the type of `jsonProperties` will be changed to object, and itwin.js will automatically stringify it when writing to the iModel.\n * This will be a breaking change, since application code will have to change from supplying a string to supplying an object.\n */\n public jsonProperties?: string;\n /** The source of the imported/synchronized object. Should point to an instance of [ExternalSource]($backend). */\n public source?: RelatedElement;\n\n /** Construct an aspect from its JSON representation and its containing iModel. */\n constructor(props: ExternalSourceAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.scope = RelatedElement.fromJSON(props.scope)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n this.source = RelatedElement.fromJSON(props.source);\n this.identifier = props.identifier;\n this.kind = props.kind;\n this.checksum = props.checksum;\n this.version = props.version;\n this.jsonProperties = props.jsonProperties;\n }\n\n /** Look up the elements that contain one or more ExternalSourceAspect with the specified Scope, Kind, and Identifier.\n * The result of this function is an array of all of the ExternalSourceAspects that were found, each associated with the owning element.\n * A given element could have more than one ExternalSourceAspect with the given scope, kind, and identifier.\n * Also, many elements could have ExternalSourceAspect with the same scope, kind, and identifier.\n * Therefore, the result array could have more than one entry with the same elementId.\n * Aspects are never shared. Each aspect has its own unique ECInstanceId.\n * @param iModelDb The iModel to query\n * @param scope The scope of the ExternalSourceAspects to find\n * @param kind The kind of the ExternalSourceAspects to find\n * @param identifier The identifier of the ExternalSourceAspects to find\n * @returns the query results\n */\n public static findAllBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): Array<{ elementId: Id64String, aspectId: Id64String }> {\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\n return iModelDb.withQueryReader(sql, (reader): Array<{ elementId: Id64String, aspectId: Id64String }> => {\n const found: Array<{ elementId: Id64String, aspectId: Id64String }> = [];\n for (const row of reader) {\n found.push({ elementId: row[0], aspectId: row[1] });\n }\n return found;\n }, new QueryBinder().bindId(\"scope\", scope).bindString(\"kind\", kind).bindString(\"identifier\", identifier));\n }\n\n public override toJSON(): ExternalSourceAspectProps {\n const val = super.toJSON() as ExternalSourceAspectProps;\n val.scope = this.scope;\n val.source = this.source;\n val.identifier = this.identifier;\n val.kind = this.kind;\n val.checksum = this.checksum;\n val.version = this.version;\n val.jsonProperties = this.jsonProperties;\n return val;\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n if (this.scope)\n referenceIds.addElement(this.scope.id);\n referenceIds.addElement(this.element.id);\n if (this.source)\n referenceIds.addElement(this.source.id);\n }\n}\n\n/** @public @preview */\nexport namespace ExternalSourceAspect {\n /** Standard values for the `Kind` property of `ExternalSourceAspect`.\n * @public @preview\n */\n export enum Kind {\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Element]] provenance */\n Element = \"Element\",\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Relationship]] provenance */\n Relationship = \"Relationship\",\n /** Indicates that the [[ExternalSourceAspect]] is storing *scope* provenance\n * @see [[ExternalSourceAspect.scope]]\n */\n Scope = \"Scope\",\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ElementTreeWalker.d.ts","sourceRoot":"","sources":["../../src/ElementTreeWalker.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAoB,SAAS,EAAE,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AAGhG,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAmB,KAAK,EAAE,MAAM,SAAS,CAAC;AAKjD,YAAY;AACZ,MAAM,WAAW,0BAA0B;IAAG,KAAK,EAAE,KAAK,CAAC;IAAC,iBAAiB,EAAE,OAAO,CAAA;CAAE;AA+CxF;;GAEG;AACH,qBAAa,sBAAsB;IACjC,SAAgB,UAAU,EAAE,UAAU,CAAM;IAC5C,mDAAmD;IACnD,SAAgB,IAAI,EAAE,KAAK,CAAC,UAAU,GAAG,0BAA0B,CAAC,CAAM;IAC1E,uFAAuF;IACvF,SAAgB,kBAAkB,EAAE,0BAA0B,CAAC;gBAEnD,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK;gBACpC,cAAc,EAAE,sBAAsB,EAAE,QAAQ,EAAE,UAAU,GAAG,KAAK;IAwBhF,IAAW,cAAc,IAAI,KAAK,CAA0C;IAC5E,IAAW,iBAAiB,IAAI,OAAO,CAAsD;IAC7F,IAAW,iBAAiB,I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AE,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;AAClF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,UAAU,EAAE,UAAU,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC;AAkChH;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,0BAA0B,GAAG,IAAI,CAAC;AACtH;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,0BAA0B,GAAG,IAAI,CAAC"}
@@ -5,8 +5,8 @@
5
5
  /** @packageDocumentation
6
6
  * @module Elements
7
7
  */
8
- import { assert, DbResult, Logger, LogLevel } from "@itwin/core-bentley";
9
- import { IModel } from "@itwin/core-common";
8
+ import { assert, Logger, LogLevel } from "@itwin/core-bentley";
9
+ import { IModel, QueryBinder } from "@itwin/core-common";
10
10
  import { BackendLoggerCategory } from "./BackendLoggerCategory";
11
11
  import { EditTxn } from "./EditTxn";
12
12
  import { DefinitionContainer, DefinitionElement, DefinitionPartition, Element, Subject } from "./Element";
@@ -29,12 +29,10 @@ function sortChildrenBeforeParents(iModel, ids) {
29
29
  return [...sortChildrenBeforeParents(iModel, children), parents];
30
30
  }
31
31
  function isModelEmpty(iModel, modelId) {
32
- // eslint-disable-next-line @typescript-eslint/no-deprecated
33
- return iModel.withPreparedStatement(`select count(*) from ${Element.classFullName} where Model.Id = ?`, (stmt) => {
34
- stmt.bindId(1, modelId);
35
- stmt.step();
36
- return stmt.getValue(0).getInteger() === 0;
37
- });
32
+ return iModel.withQueryReader(`select count(*) from ${Element.classFullName} where Model.Id = ?`, (reader) => {
33
+ reader.step();
34
+ return reader.current[0] === 0;
35
+ }, new QueryBinder().bindId(1, modelId));
38
36
  }
39
37
  function isDefinitionModel(model) {
40
38
  return (model.id !== IModel.repositoryModelId) && (model instanceof DefinitionModel);
@@ -135,13 +133,11 @@ function logModel(op, iModel, modelId, scope, logElements) {
135
133
  const model = iModel.models.getModel(modelId);
136
134
  Logger.logTrace(loggerCategory, `${op} ${fmtModel(model)} ${scope ? scope.toString() : ""}`);
137
135
  if (logElements) {
138
- // eslint-disable-next-line @typescript-eslint/no-deprecated
139
- iModel.withPreparedStatement(`select ecinstanceid from ${Element.classFullName} where Model.Id = ?`, (stmt) => {
140
- stmt.bindId(1, modelId);
141
- while (stmt.step() === DbResult.BE_SQLITE_ROW) {
142
- logElement(" - ", iModel, stmt.getValue(0).getId());
136
+ iModel.withQueryReader(`select ecinstanceid from ${Element.classFullName} where Model.Id = ?`, (reader) => {
137
+ for (const row of reader) {
138
+ logElement(" - ", iModel, row[0]);
143
139
  }
144
- });
140
+ }, new QueryBinder().bindId(1, modelId));
145
141
  }
146
142
  }
147
143
  /** Does a depth-first search on the tree defined by an element and its sub-models and children.
@@ -195,14 +191,12 @@ export class ElementTreeBottomUp {
195
191
  _processSubModel(model, parenScope) {
196
192
  const scope = new ElementTreeWalkerScope(parenScope, model);
197
193
  // Visit only the top-level parents. processElementTree will visit their children (bottom-up).
198
- // eslint-disable-next-line @typescript-eslint/no-deprecated
199
- model.iModel.withPreparedStatement(`select ECInstanceId from bis:Element where Model.id=? and Parent.Id is null`, (stmt) => {
200
- stmt.bindId(1, model.id);
201
- while (stmt.step() === DbResult.BE_SQLITE_ROW) {
202
- const elementId = stmt.getValue(0).getId();
194
+ model.iModel.withQueryReader(`select ECInstanceId from bis:Element where Model.id=? and Parent.Id is null`, (reader) => {
195
+ for (const row of reader) {
196
+ const elementId = row[0];
203
197
  this.processElementTree(elementId, scope);
204
198
  }
205
- });
199
+ }, new QueryBinder().bindId(1, model.id));
206
200
  }
207
201
  }
208
202
  /** Helper class that manages the deletion of definitions and subjects */
@@ -355,14 +349,12 @@ class ElementTreeTopDown {
355
349
  _processSubModel(subModel, scope) {
356
350
  const subModelScope = new ElementTreeWalkerScope(scope, subModel);
357
351
  // Visit only the top-level parents. processElementTree will recurse into their children.
358
- // eslint-disable-next-line @typescript-eslint/no-deprecated
359
- this._iModel.withPreparedStatement(`select ECInstanceId from bis:Element where Model.id=? and Parent.Id is null`, (stmt) => {
360
- stmt.bindId(1, subModel.id);
361
- while (stmt.step() === DbResult.BE_SQLITE_ROW) {
362
- const elementId = stmt.getValue(0).getId();
352
+ this._iModel.withQueryReader(`select ECInstanceId from bis:Element where Model.id=? and Parent.Id is null`, (reader) => {
353
+ for (const row of reader) {
354
+ const elementId = row[0];
363
355
  this.processElementTree(elementId, subModelScope);
364
356
  }
365
- });
357
+ }, new QueryBinder().bindId(1, subModel.id));
366
358
  }
367
359
  }
368
360
  /** Performs a breadth-first search to visit elements in top-down order.