@itwin/core-backend 5.10.0-dev.10 → 5.10.0-dev.12

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 (121) hide show
  1. package/lib/cjs/Category.d.ts +4 -4
  2. package/lib/cjs/Category.js.map +1 -1
  3. package/lib/cjs/ChangesetECAdaptor.d.ts +6 -6
  4. package/lib/cjs/ChangesetECAdaptor.js +4 -4
  5. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  6. package/lib/cjs/CodeSpecs.d.ts +3 -3
  7. package/lib/cjs/CodeSpecs.js.map +1 -1
  8. package/lib/cjs/DisplayStyle.d.ts +2 -2
  9. package/lib/cjs/DisplayStyle.js.map +1 -1
  10. package/lib/cjs/Element.d.ts +10 -10
  11. package/lib/cjs/Element.js +2 -2
  12. package/lib/cjs/Element.js.map +1 -1
  13. package/lib/cjs/ElementAspect.d.ts +1 -1
  14. package/lib/cjs/ElementAspect.js.map +1 -1
  15. package/lib/cjs/ElementTreeWalker.d.ts +5 -5
  16. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  17. package/lib/cjs/ExternalSource.d.ts +2 -2
  18. package/lib/cjs/ExternalSource.js.map +1 -1
  19. package/lib/cjs/IModelDb.d.ts +33 -23
  20. package/lib/cjs/IModelDb.d.ts.map +1 -1
  21. package/lib/cjs/IModelDb.js +32 -20
  22. package/lib/cjs/IModelDb.js.map +1 -1
  23. package/lib/cjs/LineStyle.d.ts +6 -6
  24. package/lib/cjs/LineStyle.js.map +1 -1
  25. package/lib/cjs/LocalHub.d.ts +6 -0
  26. package/lib/cjs/LocalHub.d.ts.map +1 -1
  27. package/lib/cjs/LocalHub.js +23 -0
  28. package/lib/cjs/LocalHub.js.map +1 -1
  29. package/lib/cjs/Material.d.ts +1 -1
  30. package/lib/cjs/Material.js.map +1 -1
  31. package/lib/cjs/Model.d.ts +6 -6
  32. package/lib/cjs/Model.js.map +1 -1
  33. package/lib/cjs/Relationship.d.ts +10 -10
  34. package/lib/cjs/Relationship.js +6 -6
  35. package/lib/cjs/Relationship.js.map +1 -1
  36. package/lib/cjs/SheetIndex.d.ts +4 -4
  37. package/lib/cjs/SheetIndex.js.map +1 -1
  38. package/lib/cjs/Texture.d.ts +1 -1
  39. package/lib/cjs/Texture.js.map +1 -1
  40. package/lib/cjs/ViewDefinition.d.ts +6 -6
  41. package/lib/cjs/ViewDefinition.js.map +1 -1
  42. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
  43. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  44. package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -1
  45. package/lib/cjs/annotations/FrameGeometry.js +2 -3
  46. package/lib/cjs/annotations/FrameGeometry.js.map +1 -1
  47. package/lib/cjs/domains/FunctionalElements.d.ts +1 -1
  48. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  49. package/lib/cjs/domains/GenericElements.d.ts +2 -2
  50. package/lib/cjs/domains/GenericElements.js.map +1 -1
  51. package/lib/cjs/internal/ChannelAdmin.d.ts +2 -2
  52. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  53. package/lib/cjs/internal/HubMock.d.ts +24 -1
  54. package/lib/cjs/internal/HubMock.d.ts.map +1 -1
  55. package/lib/cjs/internal/HubMock.js +60 -39
  56. package/lib/cjs/internal/HubMock.js.map +1 -1
  57. package/lib/esm/Category.d.ts +4 -4
  58. package/lib/esm/Category.js.map +1 -1
  59. package/lib/esm/ChangesetECAdaptor.d.ts +6 -6
  60. package/lib/esm/ChangesetECAdaptor.js +4 -4
  61. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  62. package/lib/esm/CodeSpecs.d.ts +3 -3
  63. package/lib/esm/CodeSpecs.js.map +1 -1
  64. package/lib/esm/DisplayStyle.d.ts +2 -2
  65. package/lib/esm/DisplayStyle.js.map +1 -1
  66. package/lib/esm/Element.d.ts +10 -10
  67. package/lib/esm/Element.js +2 -2
  68. package/lib/esm/Element.js.map +1 -1
  69. package/lib/esm/ElementAspect.d.ts +1 -1
  70. package/lib/esm/ElementAspect.js.map +1 -1
  71. package/lib/esm/ElementTreeWalker.d.ts +5 -5
  72. package/lib/esm/ElementTreeWalker.js.map +1 -1
  73. package/lib/esm/ExternalSource.d.ts +2 -2
  74. package/lib/esm/ExternalSource.js.map +1 -1
  75. package/lib/esm/IModelDb.d.ts +33 -23
  76. package/lib/esm/IModelDb.d.ts.map +1 -1
  77. package/lib/esm/IModelDb.js +32 -20
  78. package/lib/esm/IModelDb.js.map +1 -1
  79. package/lib/esm/LineStyle.d.ts +6 -6
  80. package/lib/esm/LineStyle.js.map +1 -1
  81. package/lib/esm/LocalHub.d.ts +6 -0
  82. package/lib/esm/LocalHub.d.ts.map +1 -1
  83. package/lib/esm/LocalHub.js +23 -0
  84. package/lib/esm/LocalHub.js.map +1 -1
  85. package/lib/esm/Material.d.ts +1 -1
  86. package/lib/esm/Material.js.map +1 -1
  87. package/lib/esm/Model.d.ts +6 -6
  88. package/lib/esm/Model.js.map +1 -1
  89. package/lib/esm/Relationship.d.ts +10 -10
  90. package/lib/esm/Relationship.js +6 -6
  91. package/lib/esm/Relationship.js.map +1 -1
  92. package/lib/esm/SheetIndex.d.ts +4 -4
  93. package/lib/esm/SheetIndex.js.map +1 -1
  94. package/lib/esm/Texture.d.ts +1 -1
  95. package/lib/esm/Texture.js.map +1 -1
  96. package/lib/esm/ViewDefinition.d.ts +6 -6
  97. package/lib/esm/ViewDefinition.js.map +1 -1
  98. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
  99. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  100. package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -1
  101. package/lib/esm/annotations/FrameGeometry.js +2 -3
  102. package/lib/esm/annotations/FrameGeometry.js.map +1 -1
  103. package/lib/esm/domains/FunctionalElements.d.ts +1 -1
  104. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  105. package/lib/esm/domains/GenericElements.d.ts +2 -2
  106. package/lib/esm/domains/GenericElements.js.map +1 -1
  107. package/lib/esm/internal/ChannelAdmin.d.ts +2 -2
  108. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  109. package/lib/esm/internal/HubMock.d.ts +24 -1
  110. package/lib/esm/internal/HubMock.d.ts.map +1 -1
  111. package/lib/esm/internal/HubMock.js +61 -40
  112. package/lib/esm/internal/HubMock.js.map +1 -1
  113. package/lib/esm/test/SchemaChangesetCanBeReversed.test.d.ts +2 -0
  114. package/lib/esm/test/SchemaChangesetCanBeReversed.test.d.ts.map +1 -0
  115. package/lib/esm/test/SchemaChangesetCanBeReversed.test.js +239 -0
  116. package/lib/esm/test/SchemaChangesetCanBeReversed.test.js.map +1 -0
  117. package/lib/esm/test/annotations/FrameGeometry.test.js +2 -1
  118. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
  119. package/lib/esm/test/standalone/DeleteElements.test.js +45 -0
  120. package/lib/esm/test/standalone/DeleteElements.test.js.map +1 -1
  121. package/package.json +13 -13
@@ -56,7 +56,7 @@ export declare class CodeSpecs {
56
56
  * @returns The Id of the persistent CodeSpec.
57
57
  * @note If successful, this method will assign a valid CodeSpecId to the supplied CodeSpec
58
58
  * @throws IModelError if the insertion fails
59
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use CodeSpecs.insert(txn, codeSpec) instead.
59
+ * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use CodeSpecs.insert(txn, codeSpec) instead.
60
60
  */
61
61
  insert(codeSpec: CodeSpec): Id64String;
62
62
  /** Add a new CodeSpec to the IModelDb.
@@ -64,7 +64,7 @@ export declare class CodeSpecs {
64
64
  * @param properties The properties or the CodeSpec. For backwards compatibility this may also be a `CodeScopeSpec.Type`.
65
65
  * @returns The Id of the persistent CodeSpec.
66
66
  * @throws IModelError if the insertion fails
67
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use CodeSpecs.insert(txn, ...) instead.
67
+ * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use CodeSpecs.insert(txn, ...) instead.
68
68
  */
69
69
  insert(name: string, properties: CodeSpecProperties | CodeScopeSpec.Type): Id64String;
70
70
  /** Update the Json properties of an existing CodeSpec.
@@ -77,7 +77,7 @@ export declare class CodeSpecs {
77
77
  /** Update the Json properties of an existing CodeSpec.
78
78
  * @param codeSpec The codeSpec holding Json properties values to update.
79
79
  * @throws if unable to update the codeSpec.
80
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use CodeSpecs.updateProperties(txn, codeSpec) instead.
80
+ * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use CodeSpecs.updateProperties(txn, codeSpec) instead.
81
81
  */
82
82
  updateProperties(codeSpec: CodeSpec): void;
83
83
  /** Load a CodeSpec from the iModel
@@ -1 +1 @@
1
- {"version":3,"file":"CodeSpecs.js","sourceRoot":"","sources":["../../src/CodeSpecs.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA6F;AAC7F,oDAA4G;AAC5G,uCAAoC;AAGpC,gDAAkD;AAElD;;GAEG;AACH,MAAa,SAAS;IACZ,MAAM,CAAC,SAAS,GAAG,cAAc,CAAC;IAClC,OAAO,CAAW;IAClB,gBAAgB,GAAe,EAAE,CAAC;IAE1C,YAAY,MAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,MAAM,CAAC,aAAa,EAAE,EAAE,CAAC;YAC3B,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IAEO,UAAU,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,kBAAkB,SAAS,CAAC,SAAS,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE;YACrG,IAAI,CAAC,UAAU,CAAC,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AS,CAAC,SAAS,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;YACpH,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACjB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YAEtE,OAAO,sBAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/G,CAAC,CAAC,CAAC;IACL,CAAC;;AAjPH,8BAkPC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Codes\r\n */\r\n\r\nimport { BentleyError, DbResult, Id64, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { CodeScopeSpec, CodeSpec, CodeSpecProperties, EditTxnError, IModelError } from \"@itwin/core-common\";\r\nimport { EditTxn } from \"./EditTxn\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { CodeService } from \"./CodeService\";\r\nimport { _implicitTxn } from \"./internal/Symbols\";\r\n\r\n/** Manages [CodeSpecs]($docs/BIS/guide/fundamentals/element-fundamentals.md#codespec) within an [[IModelDb]]\r\n * @public @preview\r\n */\r\nexport class CodeSpecs {\r\n private static tableName = \"bis_CodeSpec\";\r\n private _imodel: IModelDb;\r\n private _loadedCodeSpecs: CodeSpec[] = [];\r\n\r\n constructor(imodel: IModelDb) {\r\n this._imodel = imodel;\r\n if (imodel.isBriefcaseDb()) {\r\n imodel.onChangesetApplied.addListener(() => this._loadedCodeSpecs.length = 0);\r\n }\r\n }\r\n\r\n private findByName(name: string): Id64String | undefined {\r\n return this._imodel.withSqliteStatement(`SELECT Id FROM ${CodeSpecs.tableName} WHERE Name=?`, (stmt) => {\r\n stmt.bindString(1, name);\r\n return stmt.nextRow() ? stmt.getValueId(0) : undefined;\r\n });\r\n }\r\n\r\n /** Look up the Id of the CodeSpec with the specified name. */\r\n public queryId(name: string): Id64String {\r\n const id = this.findByName(name);\r\n if (!id)\r\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\");\r\n return id;\r\n }\r\n\r\n /** Look up a CodeSpec by Id. The CodeSpec will be loaded from the database if necessary.\r\n * @param codeSpecId The Id of the CodeSpec to load\r\n * @returns The CodeSpec with the specified Id\r\n * @throws [[IModelError]] if the Id is invalid or if no CodeSpec with that Id could be found.\r\n */\r\n public getById(codeSpecId: Id64String): CodeSpec {\r\n // good chance it is already loaded - check there before running a query\r\n const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.id === codeSpecId);\r\n if (found !== undefined)\r\n return found;\r\n\r\n // must load this codespec\r\n const loadedCodeSpec = this.load(codeSpecId);\r\n this._loadedCodeSpecs.push(loadedCodeSpec);\r\n return loadedCodeSpec;\r\n }\r\n\r\n /** Returns true if the IModelDb has a CodeSpec of the specified Id. */\r\n public hasId(codeSpecId: Id64String): boolean {\r\n try {\r\n return undefined !== this.getById(codeSpecId);\r\n } catch {\r\n return false;\r\n }\r\n }\r\n\r\n /** Look up a CodeSpec by name. The CodeSpec will be loaded from the database if necessary.\r\n * @param name The name of the CodeSpec to load\r\n * @returns The CodeSpec with the specified name\r\n * @throws [[IModelError]] if no CodeSpec with the specified name could be found.\r\n */\r\n public getByName(name: string): CodeSpec {\r\n // good chance it is already loaded - check there before running a query\r\n const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.name === name);\r\n if (found !== undefined)\r\n return found;\r\n const codeSpecId = this.queryId(name);\r\n if (codeSpecId === undefined)\r\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\");\r\n return this.getById(codeSpecId);\r\n }\r\n\r\n /** Returns true if the IModelDb has a CodeSpec of the specified name. */\r\n public hasName(name: string): boolean {\r\n try {\r\n return undefined !== this.getByName(name);\r\n } catch {\r\n return false;\r\n }\r\n }\r\n\r\n private insertCodeSpec(specName: string, properties: CodeSpecProperties): Id64String {\r\n const iModel = this._imodel;\r\n const spec: CodeService.BisCodeSpecIndexProps = { name: specName.trim(), props: JSON.stringify(properties) };\r\n if (this.findByName(spec.name))\r\n throw new IModelError(IModelStatus.DuplicateName, \"CodeSpec already exists\");\r\n\r\n const internalCodes = iModel.codeService?.internalCodes;\r\n if (internalCodes) {\r\n // Since there is no lock on the codespec table, to add a codespec to an iModel it must first be reserved in the\r\n // internal code index via `internalCodes.reserveBisCodeSpecs` prior to calling this function.\r\n // This ensures that the Ids will be unique, and the property values consistent, even if more than one user\r\n // adds them without pushing their changes. The call to `verifyBisCodeSpec` will throw otherwise.\r\n internalCodes.reader.verifyBisCodeSpec(spec);\r\n } else {\r\n // If this iModel doesn't have an internal code index, we have no way of coordinating the Ids for CodeSpecs across multiple users.\r\n // Just look in this briefcase to find the currently highest used Id and hope for the best.\r\n spec.id = iModel.withSqliteStatement(`SELECT MAX(Id) FROM ${CodeSpecs.tableName}`, (stmt) => stmt.nextRow() ? stmt.getValueInteger(0) + 1 : 1);\r\n }\r\n\r\n const id = spec.id!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n iModel.withSqliteStatement(`INSERT INTO ${CodeSpecs.tableName}(Id,Name,JsonProperties) VALUES(?,?,?)`, (stmt) => {\r\n stmt.bindInteger(1, id);\r\n stmt.bindString(2, spec.name);\r\n stmt.bindString(3, spec.props);\r\n const rc = stmt.step();\r\n if (rc !== DbResult.BE_SQLITE_DONE)\r\n throw new BentleyError(rc, \"Error inserting codeSpec\");\r\n });\r\n\r\n return Id64.fromLocalAndBriefcaseIds(id, 0);\r\n }\r\n\r\n /** Add a new CodeSpec to the iModel.\r\n * @param txn The active EditTxn.\r\n * @param codeSpec The CodeSpec to insert\r\n * @returns The Id of the persistent CodeSpec.\r\n * @note If successful, this method will assign a valid CodeSpecId to the supplied CodeSpec\r\n * @throws IModelError if the insertion fails\r\n * @beta\r\n */\r\n public insert(txn: EditTxn, codeSpec: CodeSpec): Id64String;\r\n\r\n /** Add a new CodeSpec to the iModel.\r\n * @param txn The active EditTxn.\r\n * @param name The name for the new CodeSpec.\r\n * @param properties The properties of the CodeSpec. For backwards compatibility this may also be a `CodeScopeSpec.Type`.\r\n * @returns The Id of the persistent CodeSpec.\r\n * @throws IModelError if the insertion fails\r\n * @beta\r\n */\r\n public insert(txn: EditTxn, name: string, properties: CodeSpecProperties | CodeScopeSpec.Type): Id64String;\r\n\r\n /** Add a new CodeSpec to the iModel.\r\n * @param codeSpec The CodeSpec to insert\r\n * @returns The Id of the persistent CodeSpec.\r\n * @note If successful, this method will assign a valid CodeSpecId to the supplied CodeSpec\r\n * @throws IModelError if the insertion fails\r\n * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use CodeSpecs.insert(txn, codeSpec) instead.\r\n */\r\n public insert(codeSpec: CodeSpec): Id64String;\r\n\r\n /** Add a new CodeSpec to the IModelDb.\r\n * @param name The name for the new CodeSpec.\r\n * @param properties The properties or the CodeSpec. For backwards compatibility this may also be a `CodeScopeSpec.Type`.\r\n * @returns The Id of the persistent CodeSpec.\r\n * @throws IModelError if the insertion fails\r\n * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use CodeSpecs.insert(txn, ...) instead.\r\n */\r\n public insert(name: string, properties: CodeSpecProperties | CodeScopeSpec.Type): Id64String;\r\n public insert(\r\n txnOrCodeSpec: EditTxn | CodeSpec | string,\r\n codeSpecOrNameOrProps?: CodeSpec | string | CodeSpecProperties | CodeScopeSpec.Type,\r\n props?: CodeSpecProperties | CodeScopeSpec.Type,\r\n ): Id64String {\r\n if (txnOrCodeSpec instanceof EditTxn) {\r\n const txn = txnOrCodeSpec;\r\n if (txn.iModel !== this._imodel)\r\n EditTxnError.throwError(\"wrong-imodel\", \"EditTxn does not belong to this iModel\", txn.iModel.key);\r\n // CodeSpec insertion writes directly to SQLite, so enforce txn writability explicitly.\r\n txn.verifyWriteable();\r\n if (codeSpecOrNameOrProps instanceof CodeSpec) {\r\n const id = this.insertCodeSpec(codeSpecOrNameOrProps.name, codeSpecOrNameOrProps.properties);\r\n codeSpecOrNameOrProps.id = id;\r\n return id;\r\n }\r\n if (typeof codeSpecOrNameOrProps !== \"string\" || props === undefined)\r\n throw new IModelError(IModelStatus.BadArg, \"Invalid argument\");\r\n\r\n if (typeof props === \"object\")\r\n return this.insertCodeSpec(codeSpecOrNameOrProps, props);\r\n\r\n const spec = CodeSpec.create(this._imodel, codeSpecOrNameOrProps, props);\r\n return this.insertCodeSpec(spec.name, spec.properties);\r\n }\r\n\r\n // Deprecated overloads - use implicit transaction.\r\n if (txnOrCodeSpec instanceof CodeSpec)\r\n return this.insert(this._imodel[_implicitTxn], txnOrCodeSpec);\r\n\r\n if (codeSpecOrNameOrProps === undefined)\r\n throw new IModelError(IModelStatus.BadArg, \"Invalid argument\");\r\n\r\n if (typeof codeSpecOrNameOrProps === \"string\" || codeSpecOrNameOrProps instanceof CodeSpec)\r\n throw new IModelError(IModelStatus.BadArg, \"Invalid argument\");\r\n\r\n return this.insert(this._imodel[_implicitTxn], txnOrCodeSpec, codeSpecOrNameOrProps);\r\n }\r\n\r\n /** Update the Json properties of an existing CodeSpec.\r\n * @param txn The active EditTxn.\r\n * @param codeSpec The codeSpec holding Json properties values to update.\r\n * @throws if unable to update the codeSpec.\r\n * @beta\r\n */\r\n public updateProperties(txn: EditTxn, codeSpec: CodeSpec): void;\r\n\r\n /** Update the Json properties of an existing CodeSpec.\r\n * @param codeSpec The codeSpec holding Json properties values to update.\r\n * @throws if unable to update the codeSpec.\r\n * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use CodeSpecs.updateProperties(txn, codeSpec) instead.\r\n */\r\n public updateProperties(codeSpec: CodeSpec): void;\r\n public updateProperties(txnOrCodeSpec: EditTxn | CodeSpec, codeSpec?: CodeSpec): void {\r\n let effectiveTxn: EditTxn;\r\n let effectiveCodeSpec: CodeSpec;\r\n\r\n if (txnOrCodeSpec instanceof EditTxn) {\r\n effectiveTxn = txnOrCodeSpec;\r\n if (effectiveTxn.iModel !== this._imodel)\r\n EditTxnError.throwError(\"wrong-imodel\", \"EditTxn does not belong to this iModel\", effectiveTxn.iModel.key);\r\n\r\n if (undefined === codeSpec)\r\n throw new IModelError(IModelStatus.BadArg, \"Invalid argument\");\r\n\r\n effectiveCodeSpec = codeSpec;\r\n } else {\r\n effectiveTxn = this._imodel[_implicitTxn];\r\n effectiveCodeSpec = txnOrCodeSpec;\r\n }\r\n\r\n effectiveTxn.verifyWriteable();\r\n this._imodel.withSqliteStatement(`UPDATE ${CodeSpecs.tableName} SET JsonProperties=? WHERE Id=?`, (stmt) => {\r\n stmt.bindString(1, JSON.stringify(effectiveCodeSpec.properties));\r\n stmt.bindId(2, effectiveCodeSpec.id);\r\n if (DbResult.BE_SQLITE_DONE !== stmt.step())\r\n throw new IModelError(IModelStatus.BadArg, \"error updating CodeSpec properties\");\r\n });\r\n }\r\n\r\n /** Load a CodeSpec from the iModel\r\n * @param id The persistent Id of the CodeSpec to load\r\n */\r\n public load(id: Id64String): CodeSpec {\r\n if (Id64.isInvalid(id))\r\n throw new IModelError(IModelStatus.InvalidId, \"Invalid codeSpecId\");\r\n\r\n return this._imodel.withSqliteStatement(`SELECT Name,JsonProperties FROM ${CodeSpecs.tableName} WHERE Id=?`, (stmt) => {\r\n stmt.bindId(1, id);\r\n if (!stmt.nextRow())\r\n throw new IModelError(IModelStatus.InvalidId, \"CodeSpec not found\");\r\n\r\n return CodeSpec.createFromJson(this._imodel, id, stmt.getValueString(0), JSON.parse(stmt.getValueString(1)));\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CodeSpecs.js","sourceRoot":"","sources":["../../src/CodeSpecs.ts"],"names":[],"mappings":";AAAA;;;gGAG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AC,SAAS,kCAAkC,EAAE,CAAC,IAAI,EAAE,EAAE;YACzG,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;YACjE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,iBAAiB,CAAC,EAAE,CAAC,CAAC;YACrC,IAAI,uBAAQ,CAAC,cAAc,KAAK,IAAI,CAAC,IAAI,EAAE;gBACzC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,MAAM,EAAE,oCAAoC,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACI,IAAI,CAAC,EAAc;QACxB,IAAI,mBAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACpB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QAEtE,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,mCAAmC,SAAS,CAAC,SAAS,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;YACpH,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACjB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YAEtE,OAAO,sBAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/G,CAAC,CAAC,CAAC;IACL,CAAC;;AAjPH,8BAkPC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Codes\r\n */\r\n\r\nimport { BentleyError, DbResult, Id64, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { CodeScopeSpec, CodeSpec, CodeSpecProperties, EditTxnError, IModelError } from \"@itwin/core-common\";\r\nimport { EditTxn } from \"./EditTxn\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { CodeService } from \"./CodeService\";\r\nimport { _implicitTxn } from \"./internal/Symbols\";\r\n\r\n/** Manages [CodeSpecs]($docs/BIS/guide/fundamentals/element-fundamentals.md#codespec) within an [[IModelDb]]\r\n * @public @preview\r\n */\r\nexport class CodeSpecs {\r\n private static tableName = \"bis_CodeSpec\";\r\n private _imodel: IModelDb;\r\n private _loadedCodeSpecs: CodeSpec[] = [];\r\n\r\n constructor(imodel: IModelDb) {\r\n this._imodel = imodel;\r\n if (imodel.isBriefcaseDb()) {\r\n imodel.onChangesetApplied.addListener(() => this._loadedCodeSpecs.length = 0);\r\n }\r\n }\r\n\r\n private findByName(name: string): Id64String | undefined {\r\n return this._imodel.withSqliteStatement(`SELECT Id FROM ${CodeSpecs.tableName} WHERE Name=?`, (stmt) => {\r\n stmt.bindString(1, name);\r\n return stmt.nextRow() ? stmt.getValueId(0) : undefined;\r\n });\r\n }\r\n\r\n /** Look up the Id of the CodeSpec with the specified name. */\r\n public queryId(name: string): Id64String {\r\n const id = this.findByName(name);\r\n if (!id)\r\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\");\r\n return id;\r\n }\r\n\r\n /** Look up a CodeSpec by Id. The CodeSpec will be loaded from the database if necessary.\r\n * @param codeSpecId The Id of the CodeSpec to load\r\n * @returns The CodeSpec with the specified Id\r\n * @throws [[IModelError]] if the Id is invalid or if no CodeSpec with that Id could be found.\r\n */\r\n public getById(codeSpecId: Id64String): CodeSpec {\r\n // good chance it is already loaded - check there before running a query\r\n const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.id === codeSpecId);\r\n if (found !== undefined)\r\n return found;\r\n\r\n // must load this codespec\r\n const loadedCodeSpec = this.load(codeSpecId);\r\n this._loadedCodeSpecs.push(loadedCodeSpec);\r\n return loadedCodeSpec;\r\n }\r\n\r\n /** Returns true if the IModelDb has a CodeSpec of the specified Id. */\r\n public hasId(codeSpecId: Id64String): boolean {\r\n try {\r\n return undefined !== this.getById(codeSpecId);\r\n } catch {\r\n return false;\r\n }\r\n }\r\n\r\n /** Look up a CodeSpec by name. The CodeSpec will be loaded from the database if necessary.\r\n * @param name The name of the CodeSpec to load\r\n * @returns The CodeSpec with the specified name\r\n * @throws [[IModelError]] if no CodeSpec with the specified name could be found.\r\n */\r\n public getByName(name: string): CodeSpec {\r\n // good chance it is already loaded - check there before running a query\r\n const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.name === name);\r\n if (found !== undefined)\r\n return found;\r\n const codeSpecId = this.queryId(name);\r\n if (codeSpecId === undefined)\r\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\");\r\n return this.getById(codeSpecId);\r\n }\r\n\r\n /** Returns true if the IModelDb has a CodeSpec of the specified name. */\r\n public hasName(name: string): boolean {\r\n try {\r\n return undefined !== this.getByName(name);\r\n } catch {\r\n return false;\r\n }\r\n }\r\n\r\n private insertCodeSpec(specName: string, properties: CodeSpecProperties): Id64String {\r\n const iModel = this._imodel;\r\n const spec: CodeService.BisCodeSpecIndexProps = { name: specName.trim(), props: JSON.stringify(properties) };\r\n if (this.findByName(spec.name))\r\n throw new IModelError(IModelStatus.DuplicateName, \"CodeSpec already exists\");\r\n\r\n const internalCodes = iModel.codeService?.internalCodes;\r\n if (internalCodes) {\r\n // Since there is no lock on the codespec table, to add a codespec to an iModel it must first be reserved in the\r\n // internal code index via `internalCodes.reserveBisCodeSpecs` prior to calling this function.\r\n // This ensures that the Ids will be unique, and the property values consistent, even if more than one user\r\n // adds them without pushing their changes. The call to `verifyBisCodeSpec` will throw otherwise.\r\n internalCodes.reader.verifyBisCodeSpec(spec);\r\n } else {\r\n // If this iModel doesn't have an internal code index, we have no way of coordinating the Ids for CodeSpecs across multiple users.\r\n // Just look in this briefcase to find the currently highest used Id and hope for the best.\r\n spec.id = iModel.withSqliteStatement(`SELECT MAX(Id) FROM ${CodeSpecs.tableName}`, (stmt) => stmt.nextRow() ? stmt.getValueInteger(0) + 1 : 1);\r\n }\r\n\r\n const id = spec.id!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n iModel.withSqliteStatement(`INSERT INTO ${CodeSpecs.tableName}(Id,Name,JsonProperties) VALUES(?,?,?)`, (stmt) => {\r\n stmt.bindInteger(1, id);\r\n stmt.bindString(2, spec.name);\r\n stmt.bindString(3, spec.props);\r\n const rc = stmt.step();\r\n if (rc !== DbResult.BE_SQLITE_DONE)\r\n throw new BentleyError(rc, \"Error inserting codeSpec\");\r\n });\r\n\r\n return Id64.fromLocalAndBriefcaseIds(id, 0);\r\n }\r\n\r\n /** Add a new CodeSpec to the iModel.\r\n * @param txn The active EditTxn.\r\n * @param codeSpec The CodeSpec to insert\r\n * @returns The Id of the persistent CodeSpec.\r\n * @note If successful, this method will assign a valid CodeSpecId to the supplied CodeSpec\r\n * @throws IModelError if the insertion fails\r\n * @beta\r\n */\r\n public insert(txn: EditTxn, codeSpec: CodeSpec): Id64String;\r\n\r\n /** Add a new CodeSpec to the iModel.\r\n * @param txn The active EditTxn.\r\n * @param name The name for the new CodeSpec.\r\n * @param properties The properties of the CodeSpec. For backwards compatibility this may also be a `CodeScopeSpec.Type`.\r\n * @returns The Id of the persistent CodeSpec.\r\n * @throws IModelError if the insertion fails\r\n * @beta\r\n */\r\n public insert(txn: EditTxn, name: string, properties: CodeSpecProperties | CodeScopeSpec.Type): Id64String;\r\n\r\n /** Add a new CodeSpec to the iModel.\r\n * @param codeSpec The CodeSpec to insert\r\n * @returns The Id of the persistent CodeSpec.\r\n * @note If successful, this method will assign a valid CodeSpecId to the supplied CodeSpec\r\n * @throws IModelError if the insertion fails\r\n * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use CodeSpecs.insert(txn, codeSpec) instead.\r\n */\r\n public insert(codeSpec: CodeSpec): Id64String;\r\n\r\n /** Add a new CodeSpec to the IModelDb.\r\n * @param name The name for the new CodeSpec.\r\n * @param properties The properties or the CodeSpec. For backwards compatibility this may also be a `CodeScopeSpec.Type`.\r\n * @returns The Id of the persistent CodeSpec.\r\n * @throws IModelError if the insertion fails\r\n * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use CodeSpecs.insert(txn, ...) instead.\r\n */\r\n public insert(name: string, properties: CodeSpecProperties | CodeScopeSpec.Type): Id64String;\r\n public insert(\r\n txnOrCodeSpec: EditTxn | CodeSpec | string,\r\n codeSpecOrNameOrProps?: CodeSpec | string | CodeSpecProperties | CodeScopeSpec.Type,\r\n props?: CodeSpecProperties | CodeScopeSpec.Type,\r\n ): Id64String {\r\n if (txnOrCodeSpec instanceof EditTxn) {\r\n const txn = txnOrCodeSpec;\r\n if (txn.iModel !== this._imodel)\r\n EditTxnError.throwError(\"wrong-imodel\", \"EditTxn does not belong to this iModel\", txn.iModel.key);\r\n // CodeSpec insertion writes directly to SQLite, so enforce txn writability explicitly.\r\n txn.verifyWriteable();\r\n if (codeSpecOrNameOrProps instanceof CodeSpec) {\r\n const id = this.insertCodeSpec(codeSpecOrNameOrProps.name, codeSpecOrNameOrProps.properties);\r\n codeSpecOrNameOrProps.id = id;\r\n return id;\r\n }\r\n if (typeof codeSpecOrNameOrProps !== \"string\" || props === undefined)\r\n throw new IModelError(IModelStatus.BadArg, \"Invalid argument\");\r\n\r\n if (typeof props === \"object\")\r\n return this.insertCodeSpec(codeSpecOrNameOrProps, props);\r\n\r\n const spec = CodeSpec.create(this._imodel, codeSpecOrNameOrProps, props);\r\n return this.insertCodeSpec(spec.name, spec.properties);\r\n }\r\n\r\n // Deprecated overloads - use implicit transaction.\r\n if (txnOrCodeSpec instanceof CodeSpec)\r\n return this.insert(this._imodel[_implicitTxn], txnOrCodeSpec);\r\n\r\n if (codeSpecOrNameOrProps === undefined)\r\n throw new IModelError(IModelStatus.BadArg, \"Invalid argument\");\r\n\r\n if (typeof codeSpecOrNameOrProps === \"string\" || codeSpecOrNameOrProps instanceof CodeSpec)\r\n throw new IModelError(IModelStatus.BadArg, \"Invalid argument\");\r\n\r\n return this.insert(this._imodel[_implicitTxn], txnOrCodeSpec, codeSpecOrNameOrProps);\r\n }\r\n\r\n /** Update the Json properties of an existing CodeSpec.\r\n * @param txn The active EditTxn.\r\n * @param codeSpec The codeSpec holding Json properties values to update.\r\n * @throws if unable to update the codeSpec.\r\n * @beta\r\n */\r\n public updateProperties(txn: EditTxn, codeSpec: CodeSpec): void;\r\n\r\n /** Update the Json properties of an existing CodeSpec.\r\n * @param codeSpec The codeSpec holding Json properties values to update.\r\n * @throws if unable to update the codeSpec.\r\n * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use CodeSpecs.updateProperties(txn, codeSpec) instead.\r\n */\r\n public updateProperties(codeSpec: CodeSpec): void;\r\n public updateProperties(txnOrCodeSpec: EditTxn | CodeSpec, codeSpec?: CodeSpec): void {\r\n let effectiveTxn: EditTxn;\r\n let effectiveCodeSpec: CodeSpec;\r\n\r\n if (txnOrCodeSpec instanceof EditTxn) {\r\n effectiveTxn = txnOrCodeSpec;\r\n if (effectiveTxn.iModel !== this._imodel)\r\n EditTxnError.throwError(\"wrong-imodel\", \"EditTxn does not belong to this iModel\", effectiveTxn.iModel.key);\r\n\r\n if (undefined === codeSpec)\r\n throw new IModelError(IModelStatus.BadArg, \"Invalid argument\");\r\n\r\n effectiveCodeSpec = codeSpec;\r\n } else {\r\n effectiveTxn = this._imodel[_implicitTxn];\r\n effectiveCodeSpec = txnOrCodeSpec;\r\n }\r\n\r\n effectiveTxn.verifyWriteable();\r\n this._imodel.withSqliteStatement(`UPDATE ${CodeSpecs.tableName} SET JsonProperties=? WHERE Id=?`, (stmt) => {\r\n stmt.bindString(1, JSON.stringify(effectiveCodeSpec.properties));\r\n stmt.bindId(2, effectiveCodeSpec.id);\r\n if (DbResult.BE_SQLITE_DONE !== stmt.step())\r\n throw new IModelError(IModelStatus.BadArg, \"error updating CodeSpec properties\");\r\n });\r\n }\r\n\r\n /** Load a CodeSpec from the iModel\r\n * @param id The persistent Id of the CodeSpec to load\r\n */\r\n public load(id: Id64String): CodeSpec {\r\n if (Id64.isInvalid(id))\r\n throw new IModelError(IModelStatus.InvalidId, \"Invalid codeSpecId\");\r\n\r\n return this._imodel.withSqliteStatement(`SELECT Name,JsonProperties FROM ${CodeSpecs.tableName} WHERE Id=?`, (stmt) => {\r\n stmt.bindId(1, id);\r\n if (!stmt.nextRow())\r\n throw new IModelError(IModelStatus.InvalidId, \"CodeSpec not found\");\r\n\r\n return CodeSpec.createFromJson(this._imodel, id, stmt.getValueString(0), JSON.parse(stmt.getValueString(1)));\r\n });\r\n }\r\n}\r\n"]}
@@ -60,7 +60,7 @@ export declare class DisplayStyle2d extends DisplayStyle {
60
60
  static insert(txn: EditTxn, definitionModelId: Id64String, name: string): Id64String;
61
61
  /**
62
62
  * Insert a DisplayStyle2d for use by a ViewDefinition.
63
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use DisplayStyle2d.insert(txn, ...) instead.
63
+ * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use DisplayStyle2d.insert(txn, ...) instead.
64
64
  */
65
65
  static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string): Id64String;
66
66
  }
@@ -112,7 +112,7 @@ export declare class DisplayStyle3d extends DisplayStyle {
112
112
  static insert(txn: EditTxn, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): Id64String;
113
113
  /**
114
114
  * Insert a DisplayStyle3d for use by a ViewDefinition.
115
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use DisplayStyle3d.insert(txn, ...) instead.
115
+ * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use DisplayStyle3d.insert(txn, ...) instead.
116
116
  */
117
117
  static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): Id64String;
118
118
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DisplayStyle.js","sourceRoot":"","sources":["../../src/DisplayStyle.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0G;AAC1G,oDAG4B;AAC5B,uCAA8D;AAC9D,uCAAoC;AAIpC,gDAAkD;AAElD;;;;GAIG;AACH,MAAsB,YAAa,SAAQ,2BAAiB;IACnD,MAAM,KAAc,SAAS,KAAa,OAAO,cAAc,CAAC,CAAC,CAAC;IAGzE,YAAsB,KAAwB,EAAE,MAAgB;QAC9D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,YAAY;IACL,MAAM,CAAU,WAAW,CAAC,KAA4B;QAC7D,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACzC,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC;QAC5D,qDAAqD;QACrD,IAAI,CAAC,cAAc,EAAE,0BAA0B,IAAI,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;YACpG,MAAM,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,gBAAgB,CAAC;YACxE,IAAI,OAAO,gBAAgB,KAAK,QAAQ,IAAI,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC7E,MAAM,GAAG,GAAa,EAAE,CAAC;gBACzB,gCAAiB,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,EAAU,EAAE,EAAE;oBACvE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACf,CAAC,CAAC,CAAC;gBACH,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,gBAAgB,GAAG,GAAG,CAAC;YACvD,CAAC;QACH,CAAC;QAC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Ae,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;QAEjI,MAAM,QAAQ,GAAgC;YAC5C,GAAG,OAAO;YACV,SAAS;YACT,eAAe;SAChB,CAAC;QAEF,MAAM,iBAAiB,GAAwB;YAC7C,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC;YACxD,KAAK,EAAE,iBAAiB;YACxB,cAAc,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;YACpC,SAAS,EAAE,KAAK;SAEjB,CAAC;QAEF,OAAO,IAAI,cAAc,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC;IAiBM,MAAM,CAAC,MAAM,CAAC,OAA2B,EAAE,iBAA6B,EAAE,IAAY,EAAE,OAAqC;QAClI,MAAM,GAAG,GAAG,OAAO,YAAY,iBAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,sBAAY,CAAC,CAAC;QACzE,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/E,OAAO,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;CACF;AAnID,wCAmIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ViewDefinitions\r\n */\r\n\r\nimport { CompressedId64Set, Id64, Id64Array, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport {\r\n BisCodeSpec, Code, CodeScopeProps, CodeSpec, ColorDef, DisplayStyle3dProps, DisplayStyle3dSettings, DisplayStyle3dSettingsProps,\r\n DisplayStyleProps, DisplayStyleSettings, DisplayStyleSubCategoryProps, EntityReferenceSet, PlanProjectionSettingsProps, RenderSchedule, SkyBoxImageProps, ViewFlags,\r\n} from \"@itwin/core-common\";\r\nimport { DefinitionElement, RenderTimeline } from \"./Element\";\r\nimport { EditTxn } from \"./EditTxn\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { IModelElementCloneContext } from \"./IModelElementCloneContext\";\r\nimport { DeserializeEntityArgs, ECSqlRow } from \"./Entity\";\r\nimport { _implicitTxn } from \"./internal/Symbols\";\r\n\r\n/** A DisplayStyle defines the parameters for 'styling' the contents of a view.\r\n * Internally a DisplayStyle consists of a dictionary of several named 'styles' describing specific aspects of the display style as a whole.\r\n * Many ViewDefinitions may share the same DisplayStyle.\r\n * @public @preview\r\n */\r\nexport abstract class DisplayStyle extends DefinitionElement {\r\n public static override get className(): string { return \"DisplayStyle\"; }\r\n public abstract get settings(): DisplayStyleSettings;\r\n\r\n protected constructor(props: DisplayStyleProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n\r\n /** @beta */\r\n public static override deserialize(props: DeserializeEntityArgs): DisplayStyleProps {\r\n const elProps = super.deserialize(props);\r\n const displayOptions = props.options?.element?.displayStyle;\r\n // Uncompress excludedElements if they are compressed\r\n if (!displayOptions?.compressExcludedElementIds && elProps.jsonProperties?.styles?.excludedElements) {\r\n const excludedElements = elProps.jsonProperties.styles.excludedElements;\r\n if (typeof excludedElements === \"string\" && excludedElements.startsWith(\"+\")) {\r\n const ids: string[] = [];\r\n CompressedId64Set.decompressSet(excludedElements).forEach((id: string) => {\r\n ids.push(id);\r\n });\r\n elProps.jsonProperties.styles.excludedElements = ids;\r\n }\r\n }\r\n // Omit Schedule Script Element Ids if the option is set\r\n if (displayOptions?.omitScheduleScriptElementIds && elProps.jsonProperties?.styles?.scheduleScript) {\r\n const scheduleScript: RenderSchedule.ScriptProps = elProps.jsonProperties.styles.scheduleScript;\r\n elProps.jsonProperties.styles.scheduleScript = RenderSchedule.Script.removeScheduleScriptElementIds(scheduleScript);\r\n }\r\n return elProps;\r\n }\r\n\r\n /** @beta */\r\n public static override serialize(props: DisplayStyleProps, iModel: IModelDb): ECSqlRow {\r\n const inst = super.serialize(props, iModel);\r\n return inst;\r\n }\r\n\r\n /** Create a Code for a DisplayStyle given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModelDb\r\n * @param scopeModelId The Id of the DefinitionModel that contains the DisplayStyle and provides the scope for its name.\r\n * @param codeValue The DisplayStyle name\r\n */\r\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.displayStyle);\r\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n for (const [id] of this.settings.subCategoryOverrides) {\r\n referenceIds.addElement(id);\r\n }\r\n\r\n for (const excludedElementId of this.settings.excludedElementIds)\r\n referenceIds.addElement(excludedElementId);\r\n\r\n if (this.settings.renderTimeline) {\r\n referenceIds.addElement(this.settings.renderTimeline);\r\n } else {\r\n const script = this.loadScheduleScript();\r\n if (script)\r\n script.script.discloseIds(referenceIds);\r\n }\r\n }\r\n\r\n /** @alpha */\r\n protected static override async onCloned(context: IModelElementCloneContext, sourceElementProps: DisplayStyleProps, targetElementProps: DisplayStyleProps): Promise<void> {\r\n await super.onCloned(context, sourceElementProps, targetElementProps);\r\n\r\n if (!context.isBetweenIModels || !targetElementProps.jsonProperties?.styles)\r\n return;\r\n\r\n const settings = targetElementProps.jsonProperties.styles;\r\n if (settings.subCategoryOvr) {\r\n const targetOverrides: DisplayStyleSubCategoryProps[] = [];\r\n for (const ovr of settings.subCategoryOvr) {\r\n ovr.subCategory;\r\n const targetSubCategoryId = context.findTargetElementId(Id64.fromJSON(ovr.subCategory));\r\n if (Id64.isValid(targetSubCategoryId))\r\n targetOverrides.push({ ...ovr, subCategory: targetSubCategoryId });\r\n }\r\n settings.subCategoryOvr = targetOverrides;\r\n }\r\n\r\n if (settings.excludedElements) {\r\n const excluded: Id64Array = \"string\" === typeof settings.excludedElements ? CompressedId64Set.decompressArray(settings.excludedElements) : settings.excludedElements;\r\n const excludedTargetElements: Id64Array = [];\r\n for (const excludedElement of excluded) {\r\n const remapped = context.findTargetElementId(excludedElement);\r\n if (Id64.isValid(remapped))\r\n excludedTargetElements.push(remapped);\r\n }\r\n\r\n if (0 === excludedTargetElements.length)\r\n delete settings.excludedElements;\r\n else\r\n settings.excludedElements = CompressedId64Set.compressIds(OrderedId64Iterable.sortArray(excludedTargetElements));\r\n }\r\n\r\n if (settings.renderTimeline) {\r\n const renderTimeline = context.findTargetElementId(settings.renderTimeline);\r\n if (Id64.isValid(renderTimeline))\r\n settings.renderTimeline = renderTimeline;\r\n else\r\n delete settings.renderTimeline;\r\n } else if (settings.scheduleScript) {\r\n const scheduleScript = RenderTimeline.remapScript(context, settings.scheduleScript);\r\n if (scheduleScript.length > 0)\r\n settings.scheduleScript = scheduleScript;\r\n else\r\n delete settings.scheduleScript;\r\n }\r\n }\r\n\r\n public loadScheduleScript(): RenderSchedule.ScriptReference | undefined {\r\n let script;\r\n let sourceId;\r\n if (this.settings.renderTimeline) {\r\n const timeline = this.iModel.elements.tryGetElement<RenderTimeline>(this.settings.renderTimeline);\r\n if (timeline) {\r\n script = RenderSchedule.Script.fromJSON(timeline.scriptProps);\r\n sourceId = timeline.id;\r\n }\r\n } else if (this.settings.scheduleScriptProps) {\r\n script = RenderSchedule.Script.fromJSON(this.settings.scheduleScriptProps);\r\n sourceId = this.id;\r\n }\r\n\r\n return undefined !== sourceId && undefined !== script ? new RenderSchedule.ScriptReference(sourceId, script) : undefined;\r\n }\r\n}\r\n\r\n/** A DisplayStyle for 2d views.\r\n * @public @preview\r\n */\r\nexport class DisplayStyle2d extends DisplayStyle {\r\n public static override get className(): string { return \"DisplayStyle2d\"; }\r\n private readonly _settings: DisplayStyleSettings;\r\n\r\n public get settings(): DisplayStyleSettings { return this._settings; }\r\n\r\n protected constructor(props: DisplayStyleProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this._settings = new DisplayStyleSettings(this.jsonProperties);\r\n }\r\n /** Create a DisplayStyle2d for use by a ViewDefinition.\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param name The name/CodeValue of the DisplayStyle2d\r\n * @returns The newly constructed DisplayStyle2d element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): DisplayStyle2d {\r\n const displayStyleProps: DisplayStyleProps = {\r\n classFullName: this.classFullName,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n model: definitionModelId,\r\n isPrivate: false,\r\n jsonProperties: {\r\n styles: {\r\n backgroundColor: 0,\r\n monochromeColor: ColorDef.white.toJSON(),\r\n viewflags: ViewFlags.defaults,\r\n },\r\n },\r\n };\r\n return new DisplayStyle2d(displayStyleProps, iModelDb);\r\n }\r\n /**\r\n * Insert a DisplayStyle2d for use by a ViewDefinition.\r\n * @param txn The EditTxn to use\r\n * @param definitionModelId Insert the new DisplayStyle2d into this DefinitionModel\r\n * @param name The name of the DisplayStyle2d\r\n * @returns The Id of the newly inserted DisplayStyle2d element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, definitionModelId: Id64String, name: string): Id64String;\r\n /**\r\n * Insert a DisplayStyle2d for use by a ViewDefinition.\r\n * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use DisplayStyle2d.insert(txn, ...) instead.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, definitionModelId: Id64String, name: string): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const displayStyle = this.create(txn.iModel, definitionModelId, name);\r\n return displayStyle.insert(txn);\r\n }\r\n}\r\n\r\n/** Describes initial settings for a new [[DisplayStyle3d]].\r\n * Most properties are inherited from [DisplayStyle3dSettingsProps]($common), but for backwards compatibility reasons, this interface is slightly awkward:\r\n * - It adds a `viewFlags` member that differs only in case and type from [DisplayStyleSettingsProps.viewflags]($common); and\r\n * - It extends the type of [DisplayStyleSettingsProps.backgroundColor]($common) to include [ColorDef]($common).\r\n * These idiosyncrasies will be addressed in a future version of core-backend.\r\n * @see [[DisplayStyle3d.create]].\r\n * @public @preview\r\n */\r\nexport interface DisplayStyleCreationOptions extends Omit<DisplayStyle3dSettingsProps, \"backgroundColor\" | \"scheduleScript\"> {\r\n /** If supplied, the [ViewFlags]($common) applied by the display style.\r\n * If undefined, [DisplayStyle3dSettingsProps.viewflags]($common) will be used if present (note the difference in case); otherwise, default-constructed [ViewFlags]($common) will be used.\r\n */\r\n viewFlags?: ViewFlags;\r\n backgroundColor?: ColorDef | number;\r\n}\r\n\r\n/** A DisplayStyle for 3d views.\r\n * See [how to create a DisplayStyle3d]($docs/learning/backend/CreateElements.md#DisplayStyle3d).\r\n * @public @preview\r\n */\r\nexport class DisplayStyle3d extends DisplayStyle {\r\n public static override get className(): string { return \"DisplayStyle3d\"; }\r\n private readonly _settings: DisplayStyle3dSettings;\r\n\r\n public get settings(): DisplayStyle3dSettings { return this._settings; }\r\n\r\n protected constructor(props: DisplayStyle3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this._settings = new DisplayStyle3dSettings(this.jsonProperties);\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n for (const textureId of this.settings.environment.sky.textureIds)\r\n referenceIds.addElement(textureId);\r\n\r\n if (this.settings.planProjectionSettings)\r\n for (const planProjectionSetting of this.settings.planProjectionSettings)\r\n referenceIds.addElement(planProjectionSetting[0]);\r\n\r\n const groups = this.settings.contours.groups;\r\n for (const group of groups) {\r\n const subCategories = group.subCategories;\r\n for (const subCategoryId of subCategories) {\r\n referenceIds.addElement(subCategoryId);\r\n }\r\n }\r\n }\r\n\r\n /** @alpha */\r\n protected static override async onCloned(context: IModelElementCloneContext, sourceElementProps: DisplayStyle3dProps, targetElementProps: DisplayStyle3dProps): Promise<void> {\r\n await super.onCloned(context, sourceElementProps, targetElementProps);\r\n if (context.isBetweenIModels) {\r\n const convertTexture = (id: string) => Id64.isValidId64(id) ? context.findTargetElementId(id) : id;\r\n\r\n const skyBoxImageProps: SkyBoxImageProps | undefined = targetElementProps?.jsonProperties?.styles?.environment?.sky?.image;\r\n if (skyBoxImageProps?.texture && Id64.isValidId64(skyBoxImageProps.texture))\r\n skyBoxImageProps.texture = convertTexture(skyBoxImageProps.texture);\r\n\r\n if (skyBoxImageProps?.textures) {\r\n skyBoxImageProps.textures.front = convertTexture(skyBoxImageProps.textures.front);\r\n skyBoxImageProps.textures.back = convertTexture(skyBoxImageProps.textures.back);\r\n skyBoxImageProps.textures.left = convertTexture(skyBoxImageProps.textures.left);\r\n skyBoxImageProps.textures.right = convertTexture(skyBoxImageProps.textures.right);\r\n skyBoxImageProps.textures.top = convertTexture(skyBoxImageProps.textures.top);\r\n skyBoxImageProps.textures.bottom = convertTexture(skyBoxImageProps.textures.bottom);\r\n }\r\n\r\n if (targetElementProps?.jsonProperties?.styles?.planProjections) {\r\n const remappedPlanProjections: { [modelId: string]: PlanProjectionSettingsProps } = {};\r\n for (const entry of Object.entries(targetElementProps.jsonProperties.styles.planProjections)) {\r\n const remappedModelId: Id64String = context.findTargetElementId(entry[0]);\r\n if (Id64.isValidId64(remappedModelId)) {\r\n remappedPlanProjections[remappedModelId] = entry[1];\r\n }\r\n }\r\n targetElementProps.jsonProperties.styles.planProjections = remappedPlanProjections;\r\n }\r\n\r\n const groups = targetElementProps?.jsonProperties?.styles?.contours?.groups;\r\n if (groups) {\r\n for (const group of groups) {\r\n if (group.subCategories) {\r\n const subCategories = CompressedId64Set.decompressArray(group.subCategories);\r\n const remappedSubCategories: Id64String[] = [];\r\n for (const subCategoryId of subCategories) {\r\n const remappedSubCategoryId: Id64String = context.findTargetElementId(subCategoryId);\r\n if (Id64.isValidId64(remappedSubCategoryId)) {\r\n remappedSubCategories.push(remappedSubCategoryId);\r\n }\r\n }\r\n group.subCategories = CompressedId64Set.sortAndCompress(remappedSubCategories);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** Create a DisplayStyle3d for use by a ViewDefinition.\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param name The name/CodeValue of the DisplayStyle3d\r\n * @returns The newly constructed DisplayStyle3d element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): DisplayStyle3d {\r\n options = options ?? {};\r\n let viewflags = options.viewFlags?.toJSON();\r\n if (!viewflags)\r\n viewflags = options.viewflags ?? new ViewFlags().toJSON();\r\n\r\n const backgroundColor = options.backgroundColor instanceof ColorDef ? options.backgroundColor.toJSON() : options.backgroundColor;\r\n\r\n const settings: DisplayStyle3dSettingsProps = {\r\n ...options,\r\n viewflags,\r\n backgroundColor,\r\n };\r\n\r\n const displayStyleProps: DisplayStyle3dProps = {\r\n classFullName: this.classFullName,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n model: definitionModelId,\r\n jsonProperties: { styles: settings },\r\n isPrivate: false,\r\n\r\n };\r\n\r\n return new DisplayStyle3d(displayStyleProps, iModelDb);\r\n }\r\n /**\r\n * Insert a DisplayStyle3d for use by a ViewDefinition.\r\n * @param txn The EditTxn to use\r\n * @param definitionModelId Insert the new DisplayStyle3d into this [[DefinitionModel]]\r\n * @param name The name of the DisplayStyle3d\r\n * @param options Creation options\r\n * @returns The Id of the newly inserted DisplayStyle3d element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): Id64String;\r\n /**\r\n * Insert a DisplayStyle3d for use by a ViewDefinition.\r\n * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use DisplayStyle3d.insert(txn, ...) instead.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const displayStyle = this.create(txn.iModel, definitionModelId, name, options);\r\n return displayStyle.insert(txn);\r\n }\r\n}\r\n\r\n\r\n\r\n"]}
1
+ {"version":3,"file":"DisplayStyle.js","sourceRoot":"","sources":["../../src/DisplayStyle.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0G;AAC1G,oDAG4B;AAC5B,uCAA8D;AAC9D,uCAAoC;AAIpC,gDAAkD;AAElD;;;;GAIG;AACH,MAAsB,YAAa,SAAQ,2BAAiB;IACnD,MAAM,KAAc,SAAS,KAAa,OAAO,cAAc,CAAC,CAAC,CAAC;IAGzE,YAAsB,KAAwB,EAAE,MAAgB;QAC9D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,YAAY;IACL,MAAM,CAAU,WAAW,CAAC,KAA4B;QAC7D,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACzC,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC;QAC5D,qDAAqD;QACrD,IAAI,CAAC,cAAc,EAAE,0BAA0B,IAAI,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;YACpG,MAAM,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,g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C,GAAG,CAAC,CAAC;IAClC,CAAC;CACF;AAnID,wCAmIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ViewDefinitions\r\n */\r\n\r\nimport { CompressedId64Set, Id64, Id64Array, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\r\nimport {\r\n BisCodeSpec, Code, CodeScopeProps, CodeSpec, ColorDef, DisplayStyle3dProps, DisplayStyle3dSettings, DisplayStyle3dSettingsProps,\r\n DisplayStyleProps, DisplayStyleSettings, DisplayStyleSubCategoryProps, EntityReferenceSet, PlanProjectionSettingsProps, RenderSchedule, SkyBoxImageProps, ViewFlags,\r\n} from \"@itwin/core-common\";\r\nimport { DefinitionElement, RenderTimeline } from \"./Element\";\r\nimport { EditTxn } from \"./EditTxn\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { IModelElementCloneContext } from \"./IModelElementCloneContext\";\r\nimport { DeserializeEntityArgs, ECSqlRow } from \"./Entity\";\r\nimport { _implicitTxn } from \"./internal/Symbols\";\r\n\r\n/** A DisplayStyle defines the parameters for 'styling' the contents of a view.\r\n * Internally a DisplayStyle consists of a dictionary of several named 'styles' describing specific aspects of the display style as a whole.\r\n * Many ViewDefinitions may share the same DisplayStyle.\r\n * @public @preview\r\n */\r\nexport abstract class DisplayStyle extends DefinitionElement {\r\n public static override get className(): string { return \"DisplayStyle\"; }\r\n public abstract get settings(): DisplayStyleSettings;\r\n\r\n protected constructor(props: DisplayStyleProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n\r\n /** @beta */\r\n public static override deserialize(props: DeserializeEntityArgs): DisplayStyleProps {\r\n const elProps = super.deserialize(props);\r\n const displayOptions = props.options?.element?.displayStyle;\r\n // Uncompress excludedElements if they are compressed\r\n if (!displayOptions?.compressExcludedElementIds && elProps.jsonProperties?.styles?.excludedElements) {\r\n const excludedElements = elProps.jsonProperties.styles.excludedElements;\r\n if (typeof excludedElements === \"string\" && excludedElements.startsWith(\"+\")) {\r\n const ids: string[] = [];\r\n CompressedId64Set.decompressSet(excludedElements).forEach((id: string) => {\r\n ids.push(id);\r\n });\r\n elProps.jsonProperties.styles.excludedElements = ids;\r\n }\r\n }\r\n // Omit Schedule Script Element Ids if the option is set\r\n if (displayOptions?.omitScheduleScriptElementIds && elProps.jsonProperties?.styles?.scheduleScript) {\r\n const scheduleScript: RenderSchedule.ScriptProps = elProps.jsonProperties.styles.scheduleScript;\r\n elProps.jsonProperties.styles.scheduleScript = RenderSchedule.Script.removeScheduleScriptElementIds(scheduleScript);\r\n }\r\n return elProps;\r\n }\r\n\r\n /** @beta */\r\n public static override serialize(props: DisplayStyleProps, iModel: IModelDb): ECSqlRow {\r\n const inst = super.serialize(props, iModel);\r\n return inst;\r\n }\r\n\r\n /** Create a Code for a DisplayStyle given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModelDb\r\n * @param scopeModelId The Id of the DefinitionModel that contains the DisplayStyle and provides the scope for its name.\r\n * @param codeValue The DisplayStyle name\r\n */\r\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.displayStyle);\r\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n for (const [id] of this.settings.subCategoryOverrides) {\r\n referenceIds.addElement(id);\r\n }\r\n\r\n for (const excludedElementId of this.settings.excludedElementIds)\r\n referenceIds.addElement(excludedElementId);\r\n\r\n if (this.settings.renderTimeline) {\r\n referenceIds.addElement(this.settings.renderTimeline);\r\n } else {\r\n const script = this.loadScheduleScript();\r\n if (script)\r\n script.script.discloseIds(referenceIds);\r\n }\r\n }\r\n\r\n /** @alpha */\r\n protected static override async onCloned(context: IModelElementCloneContext, sourceElementProps: DisplayStyleProps, targetElementProps: DisplayStyleProps): Promise<void> {\r\n await super.onCloned(context, sourceElementProps, targetElementProps);\r\n\r\n if (!context.isBetweenIModels || !targetElementProps.jsonProperties?.styles)\r\n return;\r\n\r\n const settings = targetElementProps.jsonProperties.styles;\r\n if (settings.subCategoryOvr) {\r\n const targetOverrides: DisplayStyleSubCategoryProps[] = [];\r\n for (const ovr of settings.subCategoryOvr) {\r\n ovr.subCategory;\r\n const targetSubCategoryId = context.findTargetElementId(Id64.fromJSON(ovr.subCategory));\r\n if (Id64.isValid(targetSubCategoryId))\r\n targetOverrides.push({ ...ovr, subCategory: targetSubCategoryId });\r\n }\r\n settings.subCategoryOvr = targetOverrides;\r\n }\r\n\r\n if (settings.excludedElements) {\r\n const excluded: Id64Array = \"string\" === typeof settings.excludedElements ? CompressedId64Set.decompressArray(settings.excludedElements) : settings.excludedElements;\r\n const excludedTargetElements: Id64Array = [];\r\n for (const excludedElement of excluded) {\r\n const remapped = context.findTargetElementId(excludedElement);\r\n if (Id64.isValid(remapped))\r\n excludedTargetElements.push(remapped);\r\n }\r\n\r\n if (0 === excludedTargetElements.length)\r\n delete settings.excludedElements;\r\n else\r\n settings.excludedElements = CompressedId64Set.compressIds(OrderedId64Iterable.sortArray(excludedTargetElements));\r\n }\r\n\r\n if (settings.renderTimeline) {\r\n const renderTimeline = context.findTargetElementId(settings.renderTimeline);\r\n if (Id64.isValid(renderTimeline))\r\n settings.renderTimeline = renderTimeline;\r\n else\r\n delete settings.renderTimeline;\r\n } else if (settings.scheduleScript) {\r\n const scheduleScript = RenderTimeline.remapScript(context, settings.scheduleScript);\r\n if (scheduleScript.length > 0)\r\n settings.scheduleScript = scheduleScript;\r\n else\r\n delete settings.scheduleScript;\r\n }\r\n }\r\n\r\n public loadScheduleScript(): RenderSchedule.ScriptReference | undefined {\r\n let script;\r\n let sourceId;\r\n if (this.settings.renderTimeline) {\r\n const timeline = this.iModel.elements.tryGetElement<RenderTimeline>(this.settings.renderTimeline);\r\n if (timeline) {\r\n script = RenderSchedule.Script.fromJSON(timeline.scriptProps);\r\n sourceId = timeline.id;\r\n }\r\n } else if (this.settings.scheduleScriptProps) {\r\n script = RenderSchedule.Script.fromJSON(this.settings.scheduleScriptProps);\r\n sourceId = this.id;\r\n }\r\n\r\n return undefined !== sourceId && undefined !== script ? new RenderSchedule.ScriptReference(sourceId, script) : undefined;\r\n }\r\n}\r\n\r\n/** A DisplayStyle for 2d views.\r\n * @public @preview\r\n */\r\nexport class DisplayStyle2d extends DisplayStyle {\r\n public static override get className(): string { return \"DisplayStyle2d\"; }\r\n private readonly _settings: DisplayStyleSettings;\r\n\r\n public get settings(): DisplayStyleSettings { return this._settings; }\r\n\r\n protected constructor(props: DisplayStyleProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this._settings = new DisplayStyleSettings(this.jsonProperties);\r\n }\r\n /** Create a DisplayStyle2d for use by a ViewDefinition.\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param name The name/CodeValue of the DisplayStyle2d\r\n * @returns The newly constructed DisplayStyle2d element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): DisplayStyle2d {\r\n const displayStyleProps: DisplayStyleProps = {\r\n classFullName: this.classFullName,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n model: definitionModelId,\r\n isPrivate: false,\r\n jsonProperties: {\r\n styles: {\r\n backgroundColor: 0,\r\n monochromeColor: ColorDef.white.toJSON(),\r\n viewflags: ViewFlags.defaults,\r\n },\r\n },\r\n };\r\n return new DisplayStyle2d(displayStyleProps, iModelDb);\r\n }\r\n /**\r\n * Insert a DisplayStyle2d for use by a ViewDefinition.\r\n * @param txn The EditTxn to use\r\n * @param definitionModelId Insert the new DisplayStyle2d into this DefinitionModel\r\n * @param name The name of the DisplayStyle2d\r\n * @returns The Id of the newly inserted DisplayStyle2d element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, definitionModelId: Id64String, name: string): Id64String;\r\n /**\r\n * Insert a DisplayStyle2d for use by a ViewDefinition.\r\n * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use DisplayStyle2d.insert(txn, ...) instead.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, definitionModelId: Id64String, name: string): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const displayStyle = this.create(txn.iModel, definitionModelId, name);\r\n return displayStyle.insert(txn);\r\n }\r\n}\r\n\r\n/** Describes initial settings for a new [[DisplayStyle3d]].\r\n * Most properties are inherited from [DisplayStyle3dSettingsProps]($common), but for backwards compatibility reasons, this interface is slightly awkward:\r\n * - It adds a `viewFlags` member that differs only in case and type from [DisplayStyleSettingsProps.viewflags]($common); and\r\n * - It extends the type of [DisplayStyleSettingsProps.backgroundColor]($common) to include [ColorDef]($common).\r\n * These idiosyncrasies will be addressed in a future version of core-backend.\r\n * @see [[DisplayStyle3d.create]].\r\n * @public @preview\r\n */\r\nexport interface DisplayStyleCreationOptions extends Omit<DisplayStyle3dSettingsProps, \"backgroundColor\" | \"scheduleScript\"> {\r\n /** If supplied, the [ViewFlags]($common) applied by the display style.\r\n * If undefined, [DisplayStyle3dSettingsProps.viewflags]($common) will be used if present (note the difference in case); otherwise, default-constructed [ViewFlags]($common) will be used.\r\n */\r\n viewFlags?: ViewFlags;\r\n backgroundColor?: ColorDef | number;\r\n}\r\n\r\n/** A DisplayStyle for 3d views.\r\n * See [how to create a DisplayStyle3d]($docs/learning/backend/CreateElements.md#DisplayStyle3d).\r\n * @public @preview\r\n */\r\nexport class DisplayStyle3d extends DisplayStyle {\r\n public static override get className(): string { return \"DisplayStyle3d\"; }\r\n private readonly _settings: DisplayStyle3dSettings;\r\n\r\n public get settings(): DisplayStyle3dSettings { return this._settings; }\r\n\r\n protected constructor(props: DisplayStyle3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this._settings = new DisplayStyle3dSettings(this.jsonProperties);\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n for (const textureId of this.settings.environment.sky.textureIds)\r\n referenceIds.addElement(textureId);\r\n\r\n if (this.settings.planProjectionSettings)\r\n for (const planProjectionSetting of this.settings.planProjectionSettings)\r\n referenceIds.addElement(planProjectionSetting[0]);\r\n\r\n const groups = this.settings.contours.groups;\r\n for (const group of groups) {\r\n const subCategories = group.subCategories;\r\n for (const subCategoryId of subCategories) {\r\n referenceIds.addElement(subCategoryId);\r\n }\r\n }\r\n }\r\n\r\n /** @alpha */\r\n protected static override async onCloned(context: IModelElementCloneContext, sourceElementProps: DisplayStyle3dProps, targetElementProps: DisplayStyle3dProps): Promise<void> {\r\n await super.onCloned(context, sourceElementProps, targetElementProps);\r\n if (context.isBetweenIModels) {\r\n const convertTexture = (id: string) => Id64.isValidId64(id) ? context.findTargetElementId(id) : id;\r\n\r\n const skyBoxImageProps: SkyBoxImageProps | undefined = targetElementProps?.jsonProperties?.styles?.environment?.sky?.image;\r\n if (skyBoxImageProps?.texture && Id64.isValidId64(skyBoxImageProps.texture))\r\n skyBoxImageProps.texture = convertTexture(skyBoxImageProps.texture);\r\n\r\n if (skyBoxImageProps?.textures) {\r\n skyBoxImageProps.textures.front = convertTexture(skyBoxImageProps.textures.front);\r\n skyBoxImageProps.textures.back = convertTexture(skyBoxImageProps.textures.back);\r\n skyBoxImageProps.textures.left = convertTexture(skyBoxImageProps.textures.left);\r\n skyBoxImageProps.textures.right = convertTexture(skyBoxImageProps.textures.right);\r\n skyBoxImageProps.textures.top = convertTexture(skyBoxImageProps.textures.top);\r\n skyBoxImageProps.textures.bottom = convertTexture(skyBoxImageProps.textures.bottom);\r\n }\r\n\r\n if (targetElementProps?.jsonProperties?.styles?.planProjections) {\r\n const remappedPlanProjections: { [modelId: string]: PlanProjectionSettingsProps } = {};\r\n for (const entry of Object.entries(targetElementProps.jsonProperties.styles.planProjections)) {\r\n const remappedModelId: Id64String = context.findTargetElementId(entry[0]);\r\n if (Id64.isValidId64(remappedModelId)) {\r\n remappedPlanProjections[remappedModelId] = entry[1];\r\n }\r\n }\r\n targetElementProps.jsonProperties.styles.planProjections = remappedPlanProjections;\r\n }\r\n\r\n const groups = targetElementProps?.jsonProperties?.styles?.contours?.groups;\r\n if (groups) {\r\n for (const group of groups) {\r\n if (group.subCategories) {\r\n const subCategories = CompressedId64Set.decompressArray(group.subCategories);\r\n const remappedSubCategories: Id64String[] = [];\r\n for (const subCategoryId of subCategories) {\r\n const remappedSubCategoryId: Id64String = context.findTargetElementId(subCategoryId);\r\n if (Id64.isValidId64(remappedSubCategoryId)) {\r\n remappedSubCategories.push(remappedSubCategoryId);\r\n }\r\n }\r\n group.subCategories = CompressedId64Set.sortAndCompress(remappedSubCategories);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** Create a DisplayStyle3d for use by a ViewDefinition.\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param name The name/CodeValue of the DisplayStyle3d\r\n * @returns The newly constructed DisplayStyle3d element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): DisplayStyle3d {\r\n options = options ?? {};\r\n let viewflags = options.viewFlags?.toJSON();\r\n if (!viewflags)\r\n viewflags = options.viewflags ?? new ViewFlags().toJSON();\r\n\r\n const backgroundColor = options.backgroundColor instanceof ColorDef ? options.backgroundColor.toJSON() : options.backgroundColor;\r\n\r\n const settings: DisplayStyle3dSettingsProps = {\r\n ...options,\r\n viewflags,\r\n backgroundColor,\r\n };\r\n\r\n const displayStyleProps: DisplayStyle3dProps = {\r\n classFullName: this.classFullName,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n model: definitionModelId,\r\n jsonProperties: { styles: settings },\r\n isPrivate: false,\r\n\r\n };\r\n\r\n return new DisplayStyle3d(displayStyleProps, iModelDb);\r\n }\r\n /**\r\n * Insert a DisplayStyle3d for use by a ViewDefinition.\r\n * @param txn The EditTxn to use\r\n * @param definitionModelId Insert the new DisplayStyle3d into this [[DefinitionModel]]\r\n * @param name The name of the DisplayStyle3d\r\n * @param options Creation options\r\n * @returns The Id of the newly inserted DisplayStyle3d element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n * @beta\r\n */\r\n public static insert(txn: EditTxn, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): Id64String;\r\n /**\r\n * Insert a DisplayStyle3d for use by a ViewDefinition.\r\n * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use DisplayStyle3d.insert(txn, ...) instead.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): Id64String;\r\n public static insert(txnOrDb: EditTxn | IModelDb, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): Id64String {\r\n const txn = txnOrDb instanceof EditTxn ? txnOrDb : txnOrDb[_implicitTxn];\r\n const displayStyle = this.create(txn.iModel, definitionModelId, name, options);\r\n return displayStyle.insert(txn);\r\n }\r\n}\r\n\r\n\r\n\r\n"]}
@@ -353,7 +353,7 @@ export declare class Element extends Entity {
353
353
  * * none of the element's outputs have been processed.
354
354
  * @see [[ElementDrivesElement]] for more on element dependency graphs.
355
355
  * @beta
356
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use onBeforeOutputsHandledArg instead.
356
+ * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use onBeforeOutputsHandledArg instead.
357
357
  */
358
358
  protected static onBeforeOutputsHandled(_id: Id64String, _iModel: IModelDb): void;
359
359
  /** Called on an element in a graph after all of its inputs have been processed and before its outputs are processed.
@@ -376,7 +376,7 @@ export declare class Element extends Entity {
376
376
  * This method is not called if none of the element's inputs were changed.
377
377
  * @see [[ElementDrivesElement]] for more on element dependency graphs.
378
378
  * @beta
379
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use onAllInputsHandledArg instead.
379
+ * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use onAllInputsHandledArg instead.
380
380
  */
381
381
  protected static onAllInputsHandled(_id: Id64String, _iModel: IModelDb): void;
382
382
  toJSON(): ElementProps;
@@ -436,7 +436,7 @@ export declare class Element extends Entity {
436
436
  insert(txn: EditTxn): Id64String;
437
437
  /**
438
438
  * Insert this Element into the iModel.
439
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use Element.insert(txn) instead.
439
+ * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use Element.insert(txn) instead.
440
440
  */
441
441
  insert(): Id64String;
442
442
  /**
@@ -446,7 +446,7 @@ export declare class Element extends Entity {
446
446
  update(txn: EditTxn): void;
447
447
  /**
448
448
  * Update this Element in the iModel.
449
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use Element.update(txn) instead.
449
+ * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use Element.update(txn) instead.
450
450
  */
451
451
  update(): void;
452
452
  /**
@@ -456,7 +456,7 @@ export declare class Element extends Entity {
456
456
  delete(txn: EditTxn): void;
457
457
  /**
458
458
  * Delete this Element from the iModel.
459
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use Element.delete(txn) instead.
459
+ * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use Element.delete(txn) instead.
460
460
  */
461
461
  delete(): void;
462
462
  }
@@ -698,7 +698,7 @@ export declare class Subject extends InformationReferenceElement {
698
698
  */
699
699
  static insert(txn: EditTxn, parentSubjectId: Id64String, name: string, description?: string): Id64String;
700
700
  /** Insert a Subject
701
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use Subject.insert(txn, ...) instead.
701
+ * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use Subject.insert(txn, ...) instead.
702
702
  */
703
703
  static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, description?: string): Id64String;
704
704
  }
@@ -748,7 +748,7 @@ export declare class Drawing extends Document {
748
748
  * @beta
749
749
  */
750
750
  static insert(txn: EditTxn, documentListModelId: Id64String, name: string, scaleFactor?: number): Id64String;
751
- /** @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use Drawing.insert(txn, ...) instead. */
751
+ /** @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use Drawing.insert(txn, ...) instead. */
752
752
  static insert(iModelDb: IModelDb, documentListModelId: Id64String, name: string, scaleFactor?: number): Id64String;
753
753
  }
754
754
  /** A document that represents a section drawing, that is, a graphical documentation derived from a planar
@@ -885,7 +885,7 @@ export declare class DefinitionContainer extends DefinitionSet {
885
885
  * @beta
886
886
  */
887
887
  static insert(txn: EditTxn, definitionModelId: Id64String, code: Code, isPrivate?: boolean): Id64String;
888
- /** @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use DefinitionContainer.insert(txn, ...) instead. */
888
+ /** @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use DefinitionContainer.insert(txn, ...) instead. */
889
889
  static insert(iModelDb: IModelDb, definitionModelId: Id64String, code: Code, isPrivate?: boolean): Id64String;
890
890
  }
891
891
  /** A non-exclusive set of DefinitionElements grouped using the DefinitionGroupGroupsDefinitions relationship.
@@ -980,7 +980,7 @@ export declare class TemplateRecipe3d extends RecipeDefinitionElement {
980
980
  * @throws [[IModelError]] if there is a problem inserting the TemplateRecipe3d or its sub-model.
981
981
  */
982
982
  static insert(txn: EditTxn, definitionModelId: Id64String, name: string, isPrivate?: boolean): Id64String;
983
- /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use TemplateRecipe3d.insert(txn, ...) instead. */
983
+ /** @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use TemplateRecipe3d.insert(txn, ...) instead. */
984
984
  static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, isPrivate?: boolean): Id64String;
985
985
  }
986
986
  /** Defines a set of properties (the *type*) that can be associated with a 2D Graphical Element.
@@ -1024,7 +1024,7 @@ export declare class TemplateRecipe2d extends RecipeDefinitionElement {
1024
1024
  * @throws [[IModelError]] if there is a problem inserting the TemplateRecipe2d or its sub-model.
1025
1025
  */
1026
1026
  static insert(txn: EditTxn, definitionModelId: Id64String, name: string, isPrivate?: boolean): Id64String;
1027
- /** @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use TemplateRecipe2d.insert(txn, ...) instead. */
1027
+ /** @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use TemplateRecipe2d.insert(txn, ...) instead. */
1028
1028
  static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, isPrivate?: boolean): Id64String;
1029
1029
  }
1030
1030
  /** An abstract base class for elements that establishes a particular modeling perspective for its parent Subject.
@@ -341,7 +341,7 @@ class Element extends Entity_1.Entity {
341
341
  * * none of the element's outputs have been processed.
342
342
  * @see [[ElementDrivesElement]] for more on element dependency graphs.
343
343
  * @beta
344
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use onBeforeOutputsHandledArg instead.
344
+ * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use onBeforeOutputsHandledArg instead.
345
345
  */
346
346
  static onBeforeOutputsHandled(_id, _iModel) { }
347
347
  /** Called on an element in a graph after all of its inputs have been processed and before its outputs are processed.
@@ -367,7 +367,7 @@ class Element extends Entity_1.Entity {
367
367
  * This method is not called if none of the element's inputs were changed.
368
368
  * @see [[ElementDrivesElement]] for more on element dependency graphs.
369
369
  * @beta
370
- * @deprecated in 5.1.9 - will not be removed until after 2026-08-04. Use onAllInputsHandledArg instead.
370
+ * @deprecated in 5.9.0 - will not be removed until after 2026-08-04. Use onAllInputsHandledArg instead.
371
371
  */
372
372
  static onAllInputsHandled(_id, _iModel) { }
373
373
  toJSON() {