@itwin/core-backend 5.14.0-dev.8 → 5.15.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/lib/cjs/BriefcaseManager.d.ts +6 -0
  3. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  4. package/lib/cjs/BriefcaseManager.js +1 -1
  5. package/lib/cjs/BriefcaseManager.js.map +1 -1
  6. package/lib/cjs/ChangesetReader.d.ts +1 -1
  7. package/lib/cjs/ChangesetReader.js +2 -2
  8. package/lib/cjs/ChangesetReader.js.map +1 -1
  9. package/lib/cjs/ChangesetReaderTypes.d.ts +4 -1
  10. package/lib/cjs/ChangesetReaderTypes.d.ts.map +1 -1
  11. package/lib/cjs/ChangesetReaderTypes.js +3 -0
  12. package/lib/cjs/ChangesetReaderTypes.js.map +1 -1
  13. package/lib/cjs/ECDb.d.ts +63 -6
  14. package/lib/cjs/ECDb.d.ts.map +1 -1
  15. package/lib/cjs/ECDb.js +62 -6
  16. package/lib/cjs/ECDb.js.map +1 -1
  17. package/lib/cjs/ECSqlStatement.d.ts +2 -2
  18. package/lib/cjs/ECSqlStatement.js +2 -2
  19. package/lib/cjs/ECSqlStatement.js.map +1 -1
  20. package/lib/cjs/Element.d.ts.map +1 -1
  21. package/lib/cjs/Element.js +6 -3
  22. package/lib/cjs/Element.js.map +1 -1
  23. package/lib/cjs/IModelDb.d.ts +53 -38
  24. package/lib/cjs/IModelDb.d.ts.map +1 -1
  25. package/lib/cjs/IModelDb.js +47 -27
  26. package/lib/cjs/IModelDb.js.map +1 -1
  27. package/lib/cjs/IpcHost.d.ts.map +1 -1
  28. package/lib/cjs/IpcHost.js +51 -17
  29. package/lib/cjs/IpcHost.js.map +1 -1
  30. package/lib/cjs/SchemaSync.d.ts +2 -2
  31. package/lib/cjs/SchemaSync.d.ts.map +1 -1
  32. package/lib/cjs/SchemaSync.js +2 -2
  33. package/lib/cjs/SchemaSync.js.map +1 -1
  34. package/lib/cjs/SqliteChangesetReader.d.ts +16 -8
  35. package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
  36. package/lib/cjs/SqliteChangesetReader.js +11 -1
  37. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  38. package/lib/cjs/TxnManager.d.ts.map +1 -1
  39. package/lib/cjs/TxnManager.js +4 -0
  40. package/lib/cjs/TxnManager.js.map +1 -1
  41. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +90 -5
  42. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  43. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +59 -1
  44. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  45. package/lib/cjs/internal/IntegrityCheck.d.ts +57 -0
  46. package/lib/cjs/internal/IntegrityCheck.d.ts.map +1 -1
  47. package/lib/cjs/internal/IntegrityCheck.js.map +1 -1
  48. package/lib/cjs/internal/annotations/fieldSpecs.d.ts +82 -0
  49. package/lib/cjs/internal/annotations/fieldSpecs.d.ts.map +1 -0
  50. package/lib/cjs/internal/annotations/fieldSpecs.js +187 -0
  51. package/lib/cjs/internal/annotations/fieldSpecs.js.map +1 -0
  52. package/lib/cjs/internal/annotations/fields.d.ts +39 -2
  53. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
  54. package/lib/cjs/internal/annotations/fields.js +140 -13
  55. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  56. package/lib/esm/BriefcaseManager.d.ts +6 -0
  57. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  58. package/lib/esm/BriefcaseManager.js +1 -1
  59. package/lib/esm/BriefcaseManager.js.map +1 -1
  60. package/lib/esm/ChangesetReader.d.ts +1 -1
  61. package/lib/esm/ChangesetReader.js +2 -2
  62. package/lib/esm/ChangesetReader.js.map +1 -1
  63. package/lib/esm/ChangesetReaderTypes.d.ts +4 -1
  64. package/lib/esm/ChangesetReaderTypes.d.ts.map +1 -1
  65. package/lib/esm/ChangesetReaderTypes.js +3 -0
  66. package/lib/esm/ChangesetReaderTypes.js.map +1 -1
  67. package/lib/esm/ECDb.d.ts +63 -6
  68. package/lib/esm/ECDb.d.ts.map +1 -1
  69. package/lib/esm/ECDb.js +62 -6
  70. package/lib/esm/ECDb.js.map +1 -1
  71. package/lib/esm/ECSqlStatement.d.ts +2 -2
  72. package/lib/esm/ECSqlStatement.js +2 -2
  73. package/lib/esm/ECSqlStatement.js.map +1 -1
  74. package/lib/esm/Element.d.ts.map +1 -1
  75. package/lib/esm/Element.js +6 -3
  76. package/lib/esm/Element.js.map +1 -1
  77. package/lib/esm/IModelDb.d.ts +53 -38
  78. package/lib/esm/IModelDb.d.ts.map +1 -1
  79. package/lib/esm/IModelDb.js +47 -27
  80. package/lib/esm/IModelDb.js.map +1 -1
  81. package/lib/esm/IpcHost.d.ts.map +1 -1
  82. package/lib/esm/IpcHost.js +52 -18
  83. package/lib/esm/IpcHost.js.map +1 -1
  84. package/lib/esm/SchemaSync.d.ts +2 -2
  85. package/lib/esm/SchemaSync.d.ts.map +1 -1
  86. package/lib/esm/SchemaSync.js +2 -2
  87. package/lib/esm/SchemaSync.js.map +1 -1
  88. package/lib/esm/SqliteChangesetReader.d.ts +16 -8
  89. package/lib/esm/SqliteChangesetReader.d.ts.map +1 -1
  90. package/lib/esm/SqliteChangesetReader.js +11 -1
  91. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  92. package/lib/esm/TxnManager.d.ts.map +1 -1
  93. package/lib/esm/TxnManager.js +4 -0
  94. package/lib/esm/TxnManager.js.map +1 -1
  95. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +90 -5
  96. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  97. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +60 -2
  98. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  99. package/lib/esm/internal/IntegrityCheck.d.ts +57 -0
  100. package/lib/esm/internal/IntegrityCheck.d.ts.map +1 -1
  101. package/lib/esm/internal/IntegrityCheck.js.map +1 -1
  102. package/lib/esm/internal/annotations/fieldSpecs.d.ts +82 -0
  103. package/lib/esm/internal/annotations/fieldSpecs.d.ts.map +1 -0
  104. package/lib/esm/internal/annotations/fieldSpecs.js +179 -0
  105. package/lib/esm/internal/annotations/fieldSpecs.js.map +1 -0
  106. package/lib/esm/internal/annotations/fields.d.ts +39 -2
  107. package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
  108. package/lib/esm/internal/annotations/fields.js +140 -13
  109. package/lib/esm/internal/annotations/fields.js.map +1 -1
  110. package/lib/esm/test/AnnotationTestUtils.d.ts +9 -0
  111. package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -1
  112. package/lib/esm/test/AnnotationTestUtils.js +17 -0
  113. package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
  114. package/lib/esm/test/annotations/FieldFormat.test.d.ts +2 -0
  115. package/lib/esm/test/annotations/FieldFormat.test.d.ts.map +1 -0
  116. package/lib/esm/test/annotations/FieldFormat.test.js +738 -0
  117. package/lib/esm/test/annotations/FieldFormat.test.js.map +1 -0
  118. package/lib/esm/test/annotations/FieldFormattingLifecycle.test.d.ts +2 -0
  119. package/lib/esm/test/annotations/FieldFormattingLifecycle.test.d.ts.map +1 -0
  120. package/lib/esm/test/annotations/FieldFormattingLifecycle.test.js +323 -0
  121. package/lib/esm/test/annotations/FieldFormattingLifecycle.test.js.map +1 -0
  122. package/lib/esm/test/annotations/FieldSpecs.test.d.ts +2 -0
  123. package/lib/esm/test/annotations/FieldSpecs.test.d.ts.map +1 -0
  124. package/lib/esm/test/annotations/FieldSpecs.test.js +54 -0
  125. package/lib/esm/test/annotations/FieldSpecs.test.js.map +1 -0
  126. package/lib/esm/test/annotations/Fields.test.js +221 -27
  127. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  128. package/lib/esm/test/ecdb/CSVImport.test.d.ts +2 -0
  129. package/lib/esm/test/ecdb/CSVImport.test.d.ts.map +1 -0
  130. package/lib/esm/test/ecdb/CSVImport.test.js +186 -0
  131. package/lib/esm/test/ecdb/CSVImport.test.js.map +1 -0
  132. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +19 -2
  133. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
  134. package/lib/esm/test/ecdb/ECDb.test.js +207 -95
  135. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  136. package/lib/esm/test/ecdb/ECSqlAst.test.js +2 -2
  137. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  138. package/lib/esm/test/ecdb/QueryReaders.test.js +105 -30
  139. package/lib/esm/test/ecdb/QueryReaders.test.js.map +1 -1
  140. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.d.ts.map +1 -1
  141. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js +7 -0
  142. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  143. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js +86 -7
  144. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  145. package/lib/esm/test/hubaccess/BriefcaseManager.test.js +65 -1
  146. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  147. package/lib/esm/test/imodel/IModelElements.test.js +5 -0
  148. package/lib/esm/test/imodel/IModelElements.test.js.map +1 -1
  149. package/lib/esm/test/standalone/ChangesetReader.test.js +111 -2
  150. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  151. package/lib/esm/test/standalone/DgnDomainMergeConflict.test.js +61 -0
  152. package/lib/esm/test/standalone/DgnDomainMergeConflict.test.js.map +1 -1
  153. package/lib/esm/test/standalone/SQLiteDb.test.d.ts.map +1 -1
  154. package/lib/esm/test/standalone/SQLiteDb.test.js +116 -0
  155. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  156. package/package.json +16 -14
@@ -1,13 +1,44 @@
1
1
  /** @packageDocumentation
2
2
  * @module Elements
3
3
  */
4
- import { Id64String } from "@itwin/core-bentley";
4
+ import { BeEvent, Id64String } from "@itwin/core-bentley";
5
5
  import { RelatedElement, TextBlock } from "@itwin/core-common";
6
+ import { UnitSystemKey } from "@itwin/core-quantity";
7
+ import { FormatSet } from "@itwin/ecschema-metadata";
6
8
  import { Element } from "../Element";
7
9
  import { IModelDb } from "../IModelDb";
8
10
  import { IModelElementCloneContext } from "../IModelElementCloneContext";
9
11
  import { ElementDrivesElement, OnDependencyArg } from "../Relationship";
10
12
  import { EditTxn } from "../EditTxn";
13
+ /** Configures how `"quantity"` and `"coordinate"` [FieldRun]($common)s in an iModel are
14
+ * formatted. Passed to [[ElementDrivesTextAnnotation.registerFieldFormatting]].
15
+ * @beta
16
+ */
17
+ export interface FieldFormattingArgs {
18
+ /** The iModel whose annotations this configuration formats. Its `schemaContext` supplies the
19
+ * KindOfQuantity presentation formats that every FormatSet falls back to.
20
+ */
21
+ iModel: IModelDb;
22
+ /** The FormatSet adopted for this iModel. It applies to every [FieldRun]($common) that does
23
+ * not name a different one via [QuantityFieldFormatOptions.formatSet]($common), and takes
24
+ * precedence over the schema's own presentation formats.
25
+ */
26
+ formatSet?: FormatSet;
27
+ /** Additional FormatSets addressable per-field, each paired with the id that
28
+ * [FieldRun]($common)s reference via [QuantityFieldFormatOptions.formatSet]($common).
29
+ * The id must be unique; if two entries share an id the last one wins. A field naming an id
30
+ * absent from this list falls back to [[formatSet]].
31
+ */
32
+ formatSets?: ReadonlyArray<{
33
+ id: string;
34
+ formatSet: FormatSet;
35
+ }>;
36
+ /** Unit system used to pick a KindOfQuantity's presentation format when the schema offers
37
+ * several. Defaults to [[formatSet]]'s own `unitSystem`, or `"metric"` when no FormatSet is
38
+ * adopted.
39
+ */
40
+ unitSystem?: UnitSystemKey;
41
+ }
11
42
  /** Describes one of potentially many [TextBlock]($common)s hosted by an [[ITextAnnotation]].
12
43
  * For example, a [[TextAnnotation2d]] hosts only a single text block, but an element representing a table may
13
44
  * host one text block for each cell in the table, in which case it might use the combination of row and column
@@ -66,9 +97,7 @@ export declare class ElementDrivesTextAnnotation extends ElementDrivesElement {
66
97
  * update when the source element changes.
67
98
  */
68
99
  static isSupportedForIModel(iModel: IModelDb): boolean;
69
- /** Examines all of the [FieldRun]($common)s within the specified [[ITextAnnotation]] and ensures that the appropriate
70
- * `ElementDrivesTextAnnotation` relationships exist between the fields' source elements and this target element.
71
- * It also deletes any stale relationships left over from fields that were deleted or whose source elements changed.
100
+ /** Ensures the `ElementDrivesTextAnnotation` relationships for the [FieldRun]($common)s in the specified annotation are up to date.
72
101
  * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use ElementDrivesTextAnnotation.updateFieldDependencies(txn, ...) instead.
73
102
  */
74
103
  static updateFieldDependencies(annotationElementId: Id64String, iModel: IModelDb): void;
@@ -78,10 +107,66 @@ export declare class ElementDrivesTextAnnotation extends ElementDrivesElement {
78
107
  */
79
108
  static updateFieldDependencies(txn: EditTxn, annotationElementId: Id64String): void;
80
109
  /** Recompute the display strings of all [FieldRun]($common)s in a [TextBlock]($common).
110
+ *
111
+ * `"quantity"` and `"coordinate"` fields are formatted through the FormatSets configured for
112
+ * `args.iModel` by [[registerFieldFormatting]], or otherwise through the format each
113
+ * KindOfQuantity's schema declares.
114
+ *
115
+ * A field whose format cannot be resolved falls back to `value.toString()` and is logged. A
116
+ * field whose property cannot be resolved, or whose format throws, is logged and rendered as
117
+ * [FieldRun.invalidContentIndicator]($common); one bad field does not abandon the rest of the
118
+ * block.
81
119
  * @returns the number of fields whose display strings were modified.
82
- * @throws Error if evaluation of any field fails.
83
120
  */
84
121
  static evaluateFields(args: EvaluateFieldsArgs): number;
122
+ /** Configures how `"quantity"` and `"coordinate"` [FieldRun]($common)s in `args.iModel` are
123
+ * formatted by [[evaluateFields]] and by `TxnManager` field-update callbacks.
124
+ *
125
+ * Calling this is optional. An iModel with no registration formats every field using the
126
+ * presentation format its schema declares for the KindOfQuantity, in the metric unit system.
127
+ * Register to layer application [FormatSet]($ecschema-metadata)s over those schema defaults,
128
+ * or to select a different unit system. Formats resolve in this order:
129
+ *
130
+ * 1. The FormatSet named by the field's [QuantityFieldFormatOptions.formatSet]($common).
131
+ * 2. The FormatSet adopted for the iModel ([[FieldFormattingArgs.formatSet]]).
132
+ * 3. The KindOfQuantity's presentation format for [[FieldFormattingArgs.unitSystem]].
133
+ * 4. `value.toString()`, with a warning logged.
134
+ *
135
+ * Units resolve through the bundled BIS [BasicUnitsProvider]($core-quantity) only. A field
136
+ * whose persistence unit, or whose format's units, are defined solely by the iModel's own
137
+ * schemas falls to step 4.
138
+ *
139
+ * Pass the iModel-wide default as `formatSet` and any per-field alternatives as `formatSets`,
140
+ * keyed by the id that [FieldRun]($common)s name via
141
+ * [QuantityFieldFormatOptions.formatSet]($common):
142
+ *
143
+ * ```ts
144
+ * ElementDrivesTextAnnotation.registerFieldFormatting({
145
+ * iModel,
146
+ * formatSet: metricFormatSet,
147
+ * formatSets: [{ id: imperialFormatSetId, formatSet: imperial }],
148
+ * });
149
+ * ```
150
+ *
151
+ * Each call replaces any prior registration for the same iModel; calling it with only
152
+ * `iModel` reverts to the schema defaults. Registering does not re-evaluate existing
153
+ * annotations; listen to [[onFieldFormattingChanged]] to do so. The registration lives as long
154
+ * as the `IModelDb` object and is released with it.
155
+ * @see [Quantity formatting for text annotation fields]($docs/learning/backend/TextAnnotationFields.md)
156
+ * @beta
157
+ */
158
+ static registerFieldFormatting(args: FieldFormattingArgs): void;
159
+ /** Raised after every [[registerFieldFormatting]] call, once the new configuration is in
160
+ * place, whether or not it differs from the previous one. Applications that cache formatted
161
+ * output, or that want to re-evaluate existing annotations against a newly adopted FormatSet,
162
+ * should listen here. A listener that throws does not undo the registration; its error is
163
+ * reported through [UnexpectedErrors]($bentley) rather than to the caller of
164
+ * `registerFieldFormatting`.
165
+ * @beta
166
+ */
167
+ static readonly onFieldFormattingChanged: BeEvent<(args: {
168
+ iModel: IModelDb;
169
+ }) => void>;
85
170
  /** When copying an [[ITextAnnotation]] from one iModel into another, remaps the element Ids in any [FieldPropertyHost]($common) within the cloned element
86
171
  * so that they refer to elements in the `context`'s target iModel, and sets any Ids that cannot be remapped to [Id64.invalid]($bentley).
87
172
  * Implementations of `ITextAnnotation` should invoke this function from their implementations of [[Element.onCloned]].
@@ -1 +1 @@
1
- {"version":3,"file":"ElementDrivesTextAnnotation.d.ts","sourceRoot":"","sources":["../../../src/annotations/ElementDrivesTextAnnotation.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAe,cAAc,EAAE,SAAS,EAA8B,MAAM,oBAAoB,CAAC;AAExG,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAGzE,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,sBAAsB;IACtB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,gIAAgI;IAChI,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;CACtB;AAKD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,oCAAoC,CAAC;IACxD,sFAAsF;IACtF,aAAa,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC;IAC1C,mGAAmG;IACnG,gBAAgB,CAAC,UAAU,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;CACtD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,eAAe,GAAG,OAAO,CAEx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B,oGAAoG;IACpG,MAAM,EAAE,QAAQ,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,qBAAa,2BAA4B,SAAQ,oBAAoB;IACnE,WAA2B,SAAS,IAAI,MAAM,CAA0C;IAExF,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAuE1C,gBAAgB;WACO,gBAAgB,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;IAInE,gBAAgB;WACO,sBAAsB,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;IAIzE;;;OAGG;WACW,oBAAoB,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO;IAI7D;;OAEG;WACW,uBAAuB,CAAC,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI;IAE9F;;;OAGG;WACW,uBAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,mBAAmB,EAAE,UAAU,GAAG,IAAI;IAU1F;;;;;;;;;;;OAWG;WACW,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM;IAI9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;WACW,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI;IAKtE;;;;;;;OAOG;IACH,gBAAuB,wBAAwB,iBAAsB;QAAE,MAAM,EAAE,QAAQ,CAAA;KAAE,KAAK,IAAI,EAAI;IAEtG;;;OAGG;WACW,WAAW,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,yBAAyB,GAAG,IAAI;CAwB5F;AAED;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,cAAc;IACtE,OAAc,aAAa,SAAkD;gBAC1D,qBAAqB,EAAE,UAAU,EAAE,YAAY,GAAE,MAA2D;CAGhI"}
@@ -13,6 +13,7 @@ const core_bentley_1 = require("@itwin/core-bentley");
13
13
  const core_common_1 = require("@itwin/core-common");
14
14
  const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
15
15
  const fields_1 = require("../internal/annotations/fields");
16
+ const fieldSpecs_1 = require("../internal/annotations/fieldSpecs");
16
17
  const Symbols_1 = require("../internal/Symbols");
17
18
  const Relationship_1 = require("../Relationship");
18
19
  const EditTxn_1 = require("../EditTxn");
@@ -114,12 +115,69 @@ class ElementDrivesTextAnnotation extends Relationship_1.ElementDrivesElement {
114
115
  this.updateFieldDependenciesImpl(arg2[Symbols_1._implicitTxn], arg1);
115
116
  }
116
117
  /** Recompute the display strings of all [FieldRun]($common)s in a [TextBlock]($common).
118
+ *
119
+ * `"quantity"` and `"coordinate"` fields are formatted through the FormatSets configured for
120
+ * `args.iModel` by [[registerFieldFormatting]], or otherwise through the format each
121
+ * KindOfQuantity's schema declares.
122
+ *
123
+ * A field whose format cannot be resolved falls back to `value.toString()` and is logged. A
124
+ * field whose property cannot be resolved, or whose format throws, is logged and rendered as
125
+ * [FieldRun.invalidContentIndicator]($common); one bad field does not abandon the rest of the
126
+ * block.
117
127
  * @returns the number of fields whose display strings were modified.
118
- * @throws Error if evaluation of any field fails.
119
128
  */
120
129
  static evaluateFields(args) {
121
130
  return (0, fields_1.updateFields)(args.block, (0, fields_1.createUpdateContext)(undefined, args.iModel, false));
122
131
  }
132
+ /** Configures how `"quantity"` and `"coordinate"` [FieldRun]($common)s in `args.iModel` are
133
+ * formatted by [[evaluateFields]] and by `TxnManager` field-update callbacks.
134
+ *
135
+ * Calling this is optional. An iModel with no registration formats every field using the
136
+ * presentation format its schema declares for the KindOfQuantity, in the metric unit system.
137
+ * Register to layer application [FormatSet]($ecschema-metadata)s over those schema defaults,
138
+ * or to select a different unit system. Formats resolve in this order:
139
+ *
140
+ * 1. The FormatSet named by the field's [QuantityFieldFormatOptions.formatSet]($common).
141
+ * 2. The FormatSet adopted for the iModel ([[FieldFormattingArgs.formatSet]]).
142
+ * 3. The KindOfQuantity's presentation format for [[FieldFormattingArgs.unitSystem]].
143
+ * 4. `value.toString()`, with a warning logged.
144
+ *
145
+ * Units resolve through the bundled BIS [BasicUnitsProvider]($core-quantity) only. A field
146
+ * whose persistence unit, or whose format's units, are defined solely by the iModel's own
147
+ * schemas falls to step 4.
148
+ *
149
+ * Pass the iModel-wide default as `formatSet` and any per-field alternatives as `formatSets`,
150
+ * keyed by the id that [FieldRun]($common)s name via
151
+ * [QuantityFieldFormatOptions.formatSet]($common):
152
+ *
153
+ * ```ts
154
+ * ElementDrivesTextAnnotation.registerFieldFormatting({
155
+ * iModel,
156
+ * formatSet: metricFormatSet,
157
+ * formatSets: [{ id: imperialFormatSetId, formatSet: imperial }],
158
+ * });
159
+ * ```
160
+ *
161
+ * Each call replaces any prior registration for the same iModel; calling it with only
162
+ * `iModel` reverts to the schema defaults. Registering does not re-evaluate existing
163
+ * annotations; listen to [[onFieldFormattingChanged]] to do so. The registration lives as long
164
+ * as the `IModelDb` object and is released with it.
165
+ * @see [Quantity formatting for text annotation fields]($docs/learning/backend/TextAnnotationFields.md)
166
+ * @beta
167
+ */
168
+ static registerFieldFormatting(args) {
169
+ (0, fieldSpecs_1.setFieldFormatting)(args.iModel, (0, fieldSpecs_1.createFieldFormatting)(args));
170
+ this.onFieldFormattingChanged.raiseEvent({ iModel: args.iModel });
171
+ }
172
+ /** Raised after every [[registerFieldFormatting]] call, once the new configuration is in
173
+ * place, whether or not it differs from the previous one. Applications that cache formatted
174
+ * output, or that want to re-evaluate existing annotations against a newly adopted FormatSet,
175
+ * should listen here. A listener that throws does not undo the registration; its error is
176
+ * reported through [UnexpectedErrors]($bentley) rather than to the caller of
177
+ * `registerFieldFormatting`.
178
+ * @beta
179
+ */
180
+ static onFieldFormattingChanged = new core_bentley_1.BeEvent();
123
181
  /** When copying an [[ITextAnnotation]] from one iModel into another, remaps the element Ids in any [FieldPropertyHost]($common) within the cloned element
124
182
  * so that they refer to elements in the `context`'s target iModel, and sets any Ids that cannot be remapped to [Id64.invalid]($bentley).
125
183
  * Implementations of `ITextAnnotation` should invoke this function from their implementations of [[Element.onCloned]].
@@ -1 +1 @@
1
- {"version":3,"file":"ElementDrivesTextAnnotation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,IAAI,CAAC;gBACpB,CAAC;YACH,CAAC;YAED,IAAI,UAAU,EAAE,CAAC;gBACf,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;QAED,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF;AArJD,kEAqJC;AAED;;GAEG;AACH,MAAa,oCAAqC,SAAQ,4BAAc;IAC/D,MAAM,CAAC,aAAa,GAAG,8CAA8C,CAAC;IAC7E,YAAmB,qBAAiC,EAAE,eAAuB,oCAAoC,CAAC,aAAa;QAC7H,KAAK,CAAC,EAAE,EAAE,EAAE,qBAAqB,EAAE,YAAY,EAAE,CAAC,CAAC;IACrD,CAAC;;AAJH,oFAKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { QueryBinder, RelatedElement, TextBlock, traverseTextBlockComponent } from \"@itwin/core-common\";\r\nimport { ECVersion } from \"@itwin/ecschema-metadata\";\r\nimport { Element } from \"../Element\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { IModelElementCloneContext } from \"../IModelElementCloneContext\";\r\nimport { createUpdateContext, updateAllFields, updateElementFields, updateFields } from \"../internal/annotations/fields\";\r\nimport { _implicitTxn } from \"../internal/Symbols\";\r\nimport { ElementDrivesElement, OnDependencyArg } from \"../Relationship\";\r\nimport { EditTxn } from \"../EditTxn\";\r\n\r\n/** Describes one of potentially many [TextBlock]($common)s hosted by an [[ITextAnnotation]].\r\n * For example, a [[TextAnnotation2d]] hosts only a single text block, but an element representing a table may\r\n * host one text block for each cell in the table, in which case it might use the combination of row and column\r\n * as the [[id]] for each text block.\r\n * @beta\r\n */\r\nexport interface TextBlockAndId {\r\n /** The text block. */\r\n readonly textBlock: TextBlock;\r\n /** An opaque identifier that allows the [[ITextAnnotation]] to discern which of its hosted text blocks is being referred to. */\r\n readonly id: unknown;\r\n}\r\n\r\n// ElementDrivesTextAnnotation was introduced in this version of BisCore - iModels with earlier versions cannot support field dependencies.\r\nconst minBisCoreVersion = new ECVersion(1, 0, 22);\r\n\r\n/** Interface implemented by [[GeometricElement]] subclasses whose schemas declare them to implement the mix-in `BisCore:ITextAnnotation`.\r\n * Such elements may host any number of [TextBlock]($common)s. `ITextAnnotation` provides a uniform way to interact with text regardless of\r\n * the type of element to which it belongs.\r\n * @beta\r\n */\r\nexport interface ITextAnnotation {\r\n /** The default [[AnnotationTextStyle]] used by the text annotation. */\r\n defaultTextStyle?: TextAnnotationUsesTextStyleByDefault;\r\n /** Obtain a collection of all of the [TextBlock]($common)s hosted by this element. */\r\n getTextBlocks(): Iterable<TextBlockAndId>;\r\n /** Update the element in-memory to replace the contents of the specified [TextBlock]($common)s. */\r\n updateTextBlocks(textBlocks: TextBlockAndId[]): void;\r\n}\r\n\r\n/** Returns `true` if the specified `element` implements [[ITextAnnotation]].\r\n * @beta\r\n */\r\nexport function isITextAnnotation(element: Element): element is ITextAnnotation & Element {\r\n return [\"getTextBlocks\", \"updateTextBlocks\"].every((x) => x in element && typeof (element as any)[x] === \"function\");\r\n}\r\n\r\n/** Arguments supplied to [[ElementDrivesTextAnnotation.evaluateFields]].\r\n * @beta\r\n */\r\nexport interface EvaluateFieldsArgs {\r\n /** The text block whose fields are to be evaluated. */\r\n block: TextBlock;\r\n /** The iModel containing the elements supplying the display strings for the fields in [[block]]. */\r\n iModel: IModelDb;\r\n}\r\n\r\n/** A relationship in which the source element hosts one or more properties that are displayed by a target [[ITextAnnotation]] element.\r\n * This relationship is used to automatically update the [FieldRun]($common)s contained in the target element when the source element is modified.\r\n * An [[ITextAnnotation]] element should invoke [[updateFieldDependencies]] from its [[Element.onInserted]] and [[Element.onUpdated]] functions to\r\n * establish or update the relationships required for the [FieldRun]($common)s it contains.\r\n * @note This relationship was introduced in version 01.00.22 of the BisCore schema. [FieldRun]($common)s created in iModels that have not been upgraded to\r\n * that version or newer will not automatically update. Use [[isSupportedForIModel]] to check.\r\n * @beta\r\n */\r\nexport class ElementDrivesTextAnnotation extends ElementDrivesElement {\r\n public static override get className(): string { return \"ElementDrivesTextAnnotation\"; }\r\n\r\n private static updateFieldDependenciesImpl(txn: EditTxn, annotationElementId: Id64String): void {\r\n const iModel = txn.iModel;\r\n const annotationElement = iModel.elements.tryGetElement<Element>(annotationElementId);\r\n if (!annotationElement || !isITextAnnotation(annotationElement)) {\r\n return;\r\n }\r\n\r\n // The native layer will allow us to insert relationships to invalid or non-existent source elements...errors will arise later. Prevent it.\r\n function isValidSourceId(id: Id64String): boolean {\r\n if (!Id64.isValidId64(id)) {\r\n return false;\r\n }\r\n\r\n return iModel.withQueryReader(\"SELECT CodeValue FROM BisCore.Element WHERE ECInstanceId=?\", (reader): boolean => {\r\n return reader.step();\r\n }, new QueryBinder().bindId(1, id));\r\n }\r\n\r\n const sourceToRelationship = new Map<Id64String, Id64String | null>();\r\n const blocks = annotationElement.getTextBlocks();\r\n\r\n let haveFields = false;\r\n for (const block of blocks) {\r\n for (const { child } of traverseTextBlockComponent(block.textBlock)) {\r\n if (child.type === \"field\") {\r\n haveFields = true;\r\n if (isValidSourceId(child.propertyHost.elementId)) {\r\n sourceToRelationship.set(child.propertyHost.elementId, null);\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (haveFields) {\r\n iModel.requireMinimumSchemaVersion(\"BisCore\", minBisCoreVersion, \"Text fields\");\r\n updateAllFields(annotationElementId, txn);\r\n }\r\n\r\n const staleRelationships = new Set<Id64String>();\r\n if (this.isSupportedForIModel(iModel)) {\r\n annotationElement.iModel.withQueryReader(\r\n \"SELECT ECInstanceId, SourceECInstanceId FROM BisCore.ElementDrivesTextAnnotation WHERE TargetECInstanceId=:targetId\",\r\n (reader) => {\r\n for (const row of reader) {\r\n const relationshipId: Id64String = row[0];\r\n const sourceId: Id64String = row[1];\r\n if (sourceToRelationship.has(sourceId)) {\r\n sourceToRelationship.set(sourceId, relationshipId);\r\n } else {\r\n staleRelationships.add(relationshipId);\r\n }\r\n }\r\n },\r\n new QueryBinder().bindId(\"targetId\", annotationElement.id),\r\n );\r\n }\r\n\r\n for (const [sourceId, relationshipId] of sourceToRelationship) {\r\n if (relationshipId === null) {\r\n txn.insertRelationship(ElementDrivesTextAnnotation.create(annotationElement.iModel, sourceId, annotationElement.id).toJSON());\r\n }\r\n }\r\n\r\n if (staleRelationships.size > 0) {\r\n const staleRelationshipProps = Array.from(staleRelationships).map((relationshipId) =>\r\n annotationElement.iModel.relationships.getInstanceProps(\"BisCore.ElementDrivesTextAnnotation\", relationshipId)\r\n );\r\n txn.deleteRelationships(staleRelationshipProps);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static override onRootChangedArg(arg: OnDependencyArg): void {\r\n updateElementFields(arg.props, arg.indirectEditTxn, false);\r\n }\r\n\r\n /** @internal */\r\n public static override onDeletedDependencyArg(arg: OnDependencyArg): void {\r\n updateElementFields(arg.props, arg.indirectEditTxn, true);\r\n }\r\n\r\n /** Returns true if `iModel` contains a version of the BisCore schema new enough to support this relationship.\r\n * If not, the schema should be updated before inserting any [FieldRun]($common)s, or those runs will not\r\n * update when the source element changes.\r\n */\r\n public static isSupportedForIModel(iModel: IModelDb): boolean {\r\n return iModel.meetsMinimumSchemaVersion(\"BisCore\", minBisCoreVersion);\r\n }\r\n\r\n /** Examines all of the [FieldRun]($common)s within the specified [[ITextAnnotation]] and ensures that the appropriate\r\n * `ElementDrivesTextAnnotation` relationships exist between the fields' source elements and this target element.\r\n * It also deletes any stale relationships left over from fields that were deleted or whose source elements changed.\r\n * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use ElementDrivesTextAnnotation.updateFieldDependencies(txn, ...) instead.\r\n */\r\n public static updateFieldDependencies(annotationElementId: Id64String, iModel: IModelDb): void;\r\n\r\n /** Examines all of the [FieldRun]($common)s within the specified [[ITextAnnotation]] and ensures that the appropriate\r\n * `ElementDrivesTextAnnotation` relationships exist between the fields' source elements and this target element.\r\n * It also deletes any stale relationships left over from fields that were deleted or whose source elements changed.\r\n */\r\n public static updateFieldDependencies(txn: EditTxn, annotationElementId: Id64String): void;\r\n public static updateFieldDependencies(arg1: EditTxn | Id64String, arg2: Id64String | IModelDb): void {\r\n if (arg1 instanceof EditTxn) {\r\n this.updateFieldDependenciesImpl(arg1, arg2 as Id64String);\r\n return;\r\n }\r\n\r\n this.updateFieldDependenciesImpl((arg2 as IModelDb)[_implicitTxn], arg1);\r\n }\r\n\r\n /** Recompute the display strings of all [FieldRun]($common)s in a [TextBlock]($common).\r\n * @returns the number of fields whose display strings were modified.\r\n * @throws Error if evaluation of any field fails.\r\n */\r\n public static evaluateFields(args: EvaluateFieldsArgs): number {\r\n return updateFields(args.block, createUpdateContext(undefined, args.iModel, false))\r\n }\r\n\r\n /** When copying an [[ITextAnnotation]] from one iModel into another, remaps the element Ids in any [FieldPropertyHost]($common) within the cloned element\r\n * so that they refer to elements in the `context`'s target iModel, and sets any Ids that cannot be remapped to [Id64.invalid]($bentley).\r\n * Implementations of `ITextAnnotation` should invoke this function from their implementations of [[Element.onCloned]].\r\n */\r\n public static remapFields(clone: ITextAnnotation, context: IModelElementCloneContext): void {\r\n if (!context.isBetweenIModels) {\r\n return;\r\n }\r\n\r\n const updatedBlocks = [];\r\n for (const block of clone.getTextBlocks()) {\r\n let anyUpdated = false;\r\n for (const { child } of traverseTextBlockComponent(block.textBlock)) {\r\n if (child.type === \"field\") {\r\n child.propertyHost.elementId = context.findTargetElementId(child.propertyHost.elementId);\r\n anyUpdated = true;\r\n }\r\n }\r\n\r\n if (anyUpdated) {\r\n updatedBlocks.push(block);\r\n }\r\n }\r\n\r\n if (updatedBlocks.length > 0) {\r\n clone.updateTextBlocks(updatedBlocks);\r\n }\r\n }\r\n}\r\n\r\n/** Relationship indicating that the [[AnnotationTextStyle]] is being used as the default style for the [[ITextAnnotation]].\r\n * @beta\r\n */\r\nexport class TextAnnotationUsesTextStyleByDefault extends RelatedElement {\r\n public static classFullName = \"BisCore:TextAnnotationUsesTextStyleByDefault\";\r\n public constructor(annotationTextStyleId: Id64String, relClassName: string = TextAnnotationUsesTextStyleByDefault.classFullName) {\r\n super({ id: annotationTextStyleId, relClassName });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ElementDrivesTextAnnotation.js","sourceRoot":"","sources":["../../../src/annotations/ElementDrivesTextAnnotation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA2EH,8CAEC;AA3ED,sDAAgE;AAChE,oDAAwG;AAExG,gEAAgE;AAIhE,2DAAyH;AACzH,mEAA+F;AAC/F,iDAAmD;AACnD,kDAAwE;AACxE,wCAAqC;AA0CrC,2IAA2I;AAC3I,MAAM,iBAAiB,GAAG,IAAI,6BAAS,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAgBlD;;GAEG;AACH,SAAgB,iBAAiB,CAAC,OAAgB;IAChD,OAAO,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,OAAO,IAAI,OAAQ,OAAe,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC;AACvH,CAAC;AAYD;;;;;;;GAOG;AACH,MAAa,2BAA4B,SAAQ,mCAAoB;IAC5D,MAAM,KAAc,SAAS,KAAa,OAAO,6BAA6B,CAAC,CAAC,CAAC;IAEhF,MAAM,CAAC,2BAA2B,CAAC,GAAY,EAAE,mBAA+B;QACtF,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QAC1B,MAAM,iBAAiB,GAAG,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAU,mBAAmB,CAAC,CAAC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AqB,EAAE,YAAY,EAAE,CAAC,CAAC;IACrD,CAAC;;AAJH,oFAKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { BeEvent, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { QueryBinder, RelatedElement, TextBlock, traverseTextBlockComponent } from \"@itwin/core-common\";\r\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport { ECVersion, FormatSet } from \"@itwin/ecschema-metadata\";\r\nimport { Element } from \"../Element\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { IModelElementCloneContext } from \"../IModelElementCloneContext\";\r\nimport { createUpdateContext, updateAllFields, updateElementFields, updateFields } from \"../internal/annotations/fields\";\r\nimport { createFieldFormatting, setFieldFormatting } from \"../internal/annotations/fieldSpecs\";\r\nimport { _implicitTxn } from \"../internal/Symbols\";\r\nimport { ElementDrivesElement, OnDependencyArg } from \"../Relationship\";\r\nimport { EditTxn } from \"../EditTxn\";\r\n\r\n/** Configures how `\"quantity\"` and `\"coordinate\"` [FieldRun]($common)s in an iModel are\r\n * formatted. Passed to [[ElementDrivesTextAnnotation.registerFieldFormatting]].\r\n * @beta\r\n */\r\nexport interface FieldFormattingArgs {\r\n /** The iModel whose annotations this configuration formats. Its `schemaContext` supplies the\r\n * KindOfQuantity presentation formats that every FormatSet falls back to.\r\n */\r\n iModel: IModelDb;\r\n /** The FormatSet adopted for this iModel. It applies to every [FieldRun]($common) that does\r\n * not name a different one via [QuantityFieldFormatOptions.formatSet]($common), and takes\r\n * precedence over the schema's own presentation formats.\r\n */\r\n formatSet?: FormatSet;\r\n /** Additional FormatSets addressable per-field, each paired with the id that\r\n * [FieldRun]($common)s reference via [QuantityFieldFormatOptions.formatSet]($common).\r\n * The id must be unique; if two entries share an id the last one wins. A field naming an id\r\n * absent from this list falls back to [[formatSet]].\r\n */\r\n formatSets?: ReadonlyArray<{ id: string, formatSet: FormatSet }>;\r\n /** Unit system used to pick a KindOfQuantity's presentation format when the schema offers\r\n * several. Defaults to [[formatSet]]'s own `unitSystem`, or `\"metric\"` when no FormatSet is\r\n * adopted.\r\n */\r\n unitSystem?: UnitSystemKey;\r\n}\r\n\r\n/** Describes one of potentially many [TextBlock]($common)s hosted by an [[ITextAnnotation]].\r\n * For example, a [[TextAnnotation2d]] hosts only a single text block, but an element representing a table may\r\n * host one text block for each cell in the table, in which case it might use the combination of row and column\r\n * as the [[id]] for each text block.\r\n * @beta\r\n */\r\nexport interface TextBlockAndId {\r\n /** The text block. */\r\n readonly textBlock: TextBlock;\r\n /** An opaque identifier that allows the [[ITextAnnotation]] to discern which of its hosted text blocks is being referred to. */\r\n readonly id: unknown;\r\n}\r\n\r\n// ElementDrivesTextAnnotation was introduced in this version of BisCore - iModels with earlier versions cannot support field dependencies.\r\nconst minBisCoreVersion = new ECVersion(1, 0, 22);\r\n\r\n/** Interface implemented by [[GeometricElement]] subclasses whose schemas declare them to implement the mix-in `BisCore:ITextAnnotation`.\r\n * Such elements may host any number of [TextBlock]($common)s. `ITextAnnotation` provides a uniform way to interact with text regardless of\r\n * the type of element to which it belongs.\r\n * @beta\r\n */\r\nexport interface ITextAnnotation {\r\n /** The default [[AnnotationTextStyle]] used by the text annotation. */\r\n defaultTextStyle?: TextAnnotationUsesTextStyleByDefault;\r\n /** Obtain a collection of all of the [TextBlock]($common)s hosted by this element. */\r\n getTextBlocks(): Iterable<TextBlockAndId>;\r\n /** Update the element in-memory to replace the contents of the specified [TextBlock]($common)s. */\r\n updateTextBlocks(textBlocks: TextBlockAndId[]): void;\r\n}\r\n\r\n/** Returns `true` if the specified `element` implements [[ITextAnnotation]].\r\n * @beta\r\n */\r\nexport function isITextAnnotation(element: Element): element is ITextAnnotation & Element {\r\n return [\"getTextBlocks\", \"updateTextBlocks\"].every((x) => x in element && typeof (element as any)[x] === \"function\");\r\n}\r\n\r\n/** Arguments supplied to [[ElementDrivesTextAnnotation.evaluateFields]].\r\n * @beta\r\n */\r\nexport interface EvaluateFieldsArgs {\r\n /** The text block whose fields are to be evaluated. */\r\n block: TextBlock;\r\n /** The iModel containing the elements supplying the display strings for the fields in [[block]]. */\r\n iModel: IModelDb;\r\n}\r\n\r\n/** A relationship in which the source element hosts one or more properties that are displayed by a target [[ITextAnnotation]] element.\r\n * This relationship is used to automatically update the [FieldRun]($common)s contained in the target element when the source element is modified.\r\n * An [[ITextAnnotation]] element should invoke [[updateFieldDependencies]] from its [[Element.onInserted]] and [[Element.onUpdated]] functions to\r\n * establish or update the relationships required for the [FieldRun]($common)s it contains.\r\n * @note This relationship was introduced in version 01.00.22 of the BisCore schema. [FieldRun]($common)s created in iModels that have not been upgraded to\r\n * that version or newer will not automatically update. Use [[isSupportedForIModel]] to check.\r\n * @beta\r\n */\r\nexport class ElementDrivesTextAnnotation extends ElementDrivesElement {\r\n public static override get className(): string { return \"ElementDrivesTextAnnotation\"; }\r\n\r\n private static updateFieldDependenciesImpl(txn: EditTxn, annotationElementId: Id64String): void {\r\n const iModel = txn.iModel;\r\n const annotationElement = iModel.elements.tryGetElement<Element>(annotationElementId);\r\n if (!annotationElement || !isITextAnnotation(annotationElement)) {\r\n return;\r\n }\r\n\r\n // The native layer will allow us to insert relationships to invalid or non-existent source elements...errors will arise later. Prevent it.\r\n function isValidSourceId(id: Id64String): boolean {\r\n if (!Id64.isValidId64(id)) {\r\n return false;\r\n }\r\n\r\n return iModel.withQueryReader(\"SELECT CodeValue FROM BisCore.Element WHERE ECInstanceId=?\", (reader): boolean => {\r\n return reader.step();\r\n }, new QueryBinder().bindId(1, id));\r\n }\r\n\r\n const sourceToRelationship = new Map<Id64String, Id64String | null>();\r\n const blocks = annotationElement.getTextBlocks();\r\n\r\n let haveFields = false;\r\n for (const block of blocks) {\r\n for (const { child } of traverseTextBlockComponent(block.textBlock)) {\r\n if (child.type === \"field\") {\r\n haveFields = true;\r\n if (isValidSourceId(child.propertyHost.elementId)) {\r\n sourceToRelationship.set(child.propertyHost.elementId, null);\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (haveFields) {\r\n iModel.requireMinimumSchemaVersion(\"BisCore\", minBisCoreVersion, \"Text fields\");\r\n updateAllFields(annotationElementId, txn);\r\n }\r\n\r\n const staleRelationships = new Set<Id64String>();\r\n if (this.isSupportedForIModel(iModel)) {\r\n annotationElement.iModel.withQueryReader(\r\n \"SELECT ECInstanceId, SourceECInstanceId FROM BisCore.ElementDrivesTextAnnotation WHERE TargetECInstanceId=:targetId\",\r\n (reader) => {\r\n for (const row of reader) {\r\n const relationshipId: Id64String = row[0];\r\n const sourceId: Id64String = row[1];\r\n if (sourceToRelationship.has(sourceId)) {\r\n sourceToRelationship.set(sourceId, relationshipId);\r\n } else {\r\n staleRelationships.add(relationshipId);\r\n }\r\n }\r\n },\r\n new QueryBinder().bindId(\"targetId\", annotationElement.id),\r\n );\r\n }\r\n\r\n for (const [sourceId, relationshipId] of sourceToRelationship) {\r\n if (relationshipId === null) {\r\n txn.insertRelationship(ElementDrivesTextAnnotation.create(annotationElement.iModel, sourceId, annotationElement.id).toJSON());\r\n }\r\n }\r\n\r\n if (staleRelationships.size > 0) {\r\n const staleRelationshipProps = Array.from(staleRelationships).map((relationshipId) =>\r\n annotationElement.iModel.relationships.getInstanceProps(\"BisCore.ElementDrivesTextAnnotation\", relationshipId)\r\n );\r\n txn.deleteRelationships(staleRelationshipProps);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static override onRootChangedArg(arg: OnDependencyArg): void {\r\n updateElementFields(arg.props, arg.indirectEditTxn, false);\r\n }\r\n\r\n /** @internal */\r\n public static override onDeletedDependencyArg(arg: OnDependencyArg): void {\r\n updateElementFields(arg.props, arg.indirectEditTxn, true);\r\n }\r\n\r\n /** Returns true if `iModel` contains a version of the BisCore schema new enough to support this relationship.\r\n * If not, the schema should be updated before inserting any [FieldRun]($common)s, or those runs will not\r\n * update when the source element changes.\r\n */\r\n public static isSupportedForIModel(iModel: IModelDb): boolean {\r\n return iModel.meetsMinimumSchemaVersion(\"BisCore\", minBisCoreVersion);\r\n }\r\n\r\n /** Ensures the `ElementDrivesTextAnnotation` relationships for the [FieldRun]($common)s in the specified annotation are up to date.\r\n * @deprecated in 5.9.0 - will not be removed until after 2027-05-04. Use ElementDrivesTextAnnotation.updateFieldDependencies(txn, ...) instead.\r\n */\r\n public static updateFieldDependencies(annotationElementId: Id64String, iModel: IModelDb): void;\r\n\r\n /** Examines all of the [FieldRun]($common)s within the specified [[ITextAnnotation]] and ensures that the appropriate\r\n * `ElementDrivesTextAnnotation` relationships exist between the fields' source elements and this target element.\r\n * It also deletes any stale relationships left over from fields that were deleted or whose source elements changed.\r\n */\r\n public static updateFieldDependencies(txn: EditTxn, annotationElementId: Id64String): void;\r\n public static updateFieldDependencies(arg1: EditTxn | Id64String, arg2: Id64String | IModelDb): void {\r\n if (arg1 instanceof EditTxn) {\r\n this.updateFieldDependenciesImpl(arg1, arg2 as Id64String);\r\n return;\r\n }\r\n\r\n this.updateFieldDependenciesImpl((arg2 as IModelDb)[_implicitTxn], arg1);\r\n }\r\n\r\n /** Recompute the display strings of all [FieldRun]($common)s in a [TextBlock]($common).\r\n *\r\n * `\"quantity\"` and `\"coordinate\"` fields are formatted through the FormatSets configured for\r\n * `args.iModel` by [[registerFieldFormatting]], or otherwise through the format each\r\n * KindOfQuantity's schema declares.\r\n *\r\n * A field whose format cannot be resolved falls back to `value.toString()` and is logged. A\r\n * field whose property cannot be resolved, or whose format throws, is logged and rendered as\r\n * [FieldRun.invalidContentIndicator]($common); one bad field does not abandon the rest of the\r\n * block.\r\n * @returns the number of fields whose display strings were modified.\r\n */\r\n public static evaluateFields(args: EvaluateFieldsArgs): number {\r\n return updateFields(args.block, createUpdateContext(undefined, args.iModel, false));\r\n }\r\n\r\n /** Configures how `\"quantity\"` and `\"coordinate\"` [FieldRun]($common)s in `args.iModel` are\r\n * formatted by [[evaluateFields]] and by `TxnManager` field-update callbacks.\r\n *\r\n * Calling this is optional. An iModel with no registration formats every field using the\r\n * presentation format its schema declares for the KindOfQuantity, in the metric unit system.\r\n * Register to layer application [FormatSet]($ecschema-metadata)s over those schema defaults,\r\n * or to select a different unit system. Formats resolve in this order:\r\n *\r\n * 1. The FormatSet named by the field's [QuantityFieldFormatOptions.formatSet]($common).\r\n * 2. The FormatSet adopted for the iModel ([[FieldFormattingArgs.formatSet]]).\r\n * 3. The KindOfQuantity's presentation format for [[FieldFormattingArgs.unitSystem]].\r\n * 4. `value.toString()`, with a warning logged.\r\n *\r\n * Units resolve through the bundled BIS [BasicUnitsProvider]($core-quantity) only. A field\r\n * whose persistence unit, or whose format's units, are defined solely by the iModel's own\r\n * schemas falls to step 4.\r\n *\r\n * Pass the iModel-wide default as `formatSet` and any per-field alternatives as `formatSets`,\r\n * keyed by the id that [FieldRun]($common)s name via\r\n * [QuantityFieldFormatOptions.formatSet]($common):\r\n *\r\n * ```ts\r\n * ElementDrivesTextAnnotation.registerFieldFormatting({\r\n * iModel,\r\n * formatSet: metricFormatSet,\r\n * formatSets: [{ id: imperialFormatSetId, formatSet: imperial }],\r\n * });\r\n * ```\r\n *\r\n * Each call replaces any prior registration for the same iModel; calling it with only\r\n * `iModel` reverts to the schema defaults. Registering does not re-evaluate existing\r\n * annotations; listen to [[onFieldFormattingChanged]] to do so. The registration lives as long\r\n * as the `IModelDb` object and is released with it.\r\n * @see [Quantity formatting for text annotation fields]($docs/learning/backend/TextAnnotationFields.md)\r\n * @beta\r\n */\r\n public static registerFieldFormatting(args: FieldFormattingArgs): void {\r\n setFieldFormatting(args.iModel, createFieldFormatting(args));\r\n this.onFieldFormattingChanged.raiseEvent({ iModel: args.iModel });\r\n }\r\n\r\n /** Raised after every [[registerFieldFormatting]] call, once the new configuration is in\r\n * place, whether or not it differs from the previous one. Applications that cache formatted\r\n * output, or that want to re-evaluate existing annotations against a newly adopted FormatSet,\r\n * should listen here. A listener that throws does not undo the registration; its error is\r\n * reported through [UnexpectedErrors]($bentley) rather than to the caller of\r\n * `registerFieldFormatting`.\r\n * @beta\r\n */\r\n public static readonly onFieldFormattingChanged = new BeEvent<(args: { iModel: IModelDb }) => void>();\r\n\r\n /** When copying an [[ITextAnnotation]] from one iModel into another, remaps the element Ids in any [FieldPropertyHost]($common) within the cloned element\r\n * so that they refer to elements in the `context`'s target iModel, and sets any Ids that cannot be remapped to [Id64.invalid]($bentley).\r\n * Implementations of `ITextAnnotation` should invoke this function from their implementations of [[Element.onCloned]].\r\n */\r\n public static remapFields(clone: ITextAnnotation, context: IModelElementCloneContext): void {\r\n if (!context.isBetweenIModels) {\r\n return;\r\n }\r\n\r\n const updatedBlocks = [];\r\n for (const block of clone.getTextBlocks()) {\r\n let anyUpdated = false;\r\n for (const { child } of traverseTextBlockComponent(block.textBlock)) {\r\n if (child.type === \"field\") {\r\n child.propertyHost.elementId = context.findTargetElementId(child.propertyHost.elementId);\r\n anyUpdated = true;\r\n }\r\n }\r\n\r\n if (anyUpdated) {\r\n updatedBlocks.push(block);\r\n }\r\n }\r\n\r\n if (updatedBlocks.length > 0) {\r\n clone.updateTextBlocks(updatedBlocks);\r\n }\r\n }\r\n}\r\n\r\n/** Relationship indicating that the [[AnnotationTextStyle]] is being used as the default style for the [[ITextAnnotation]].\r\n * @beta\r\n */\r\nexport class TextAnnotationUsesTextStyleByDefault extends RelatedElement {\r\n public static classFullName = \"BisCore:TextAnnotationUsesTextStyleByDefault\";\r\n public constructor(annotationTextStyleId: Id64String, relClassName: string = TextAnnotationUsesTextStyleByDefault.classFullName) {\r\n super({ id: annotationTextStyleId, relClassName });\r\n }\r\n}\r\n"]}
@@ -96,117 +96,174 @@ type IntegrityCheckResultRow<K extends IntegrityCheckKey> = IntegrityCheckResult
96
96
  * Return type for quick integrity check
97
97
  */
98
98
  export interface QuickIntegrityCheckResultRow {
99
+ /** Name of the integrity check. */
99
100
  check: string;
101
+ /** Whether the check passed. Quick checks do not include problem details. */
100
102
  passed: boolean;
103
+ /** Elapsed time for the check, in seconds. */
101
104
  elapsedSeconds: string;
102
105
  }
103
106
  /**
104
107
  * Return type for Check Data Columns integrity check
105
108
  */
106
109
  export interface CheckDataColumnsResultRow {
110
+ /** Sequential result row number. */
107
111
  sno: number;
112
+ /** Mapped data table containing a missing column. */
108
113
  table: string;
114
+ /** Name of the missing nonvirtual physical column. */
109
115
  column: string;
110
116
  }
111
117
  /**
112
118
  * Return type for Check EC Profile integrity check
113
119
  */
114
120
  export interface CheckECProfileResultRow {
121
+ /** Sequential result row number. */
115
122
  sno: number;
123
+ /** Type of EC profile object, such as a table, index, or iModel trigger. */
116
124
  type: string;
125
+ /** Name of the EC profile object. */
117
126
  name: string;
127
+ /** Description of the missing or mismatching object definition. */
118
128
  issue: string;
119
129
  }
120
130
  /**
121
131
  * Return type for Check Navigation Class Ids integrity check
122
132
  */
123
133
  export interface CheckNavClassIdsResultRow {
134
+ /** Sequential result row number. */
124
135
  sno: number;
136
+ /** ID of the source instance row containing the navigation property. */
125
137
  id: string;
138
+ /** Declaring or scanned class for the source row; rows from derived classes may be included. */
126
139
  class: string;
140
+ /** Name of the navigation property. */
127
141
  property: string;
142
+ /** ID of the referenced instance stored by the navigation property. */
128
143
  navId: string;
144
+ /** Relationship class ID stored by the navigation property, not the target instance class ID. */
129
145
  navClassId: string;
130
146
  }
131
147
  /**
132
148
  * Return type for Check Navigation Ids integrity check
133
149
  */
134
150
  export interface CheckNavIdsResultRow {
151
+ /** Sequential result row number. */
135
152
  sno: number;
153
+ /** ID of the source instance row containing the navigation property. */
136
154
  id: string;
155
+ /** Declaring or scanned class for the source row; rows from derived classes may be included. */
137
156
  class: string;
157
+ /** Name of the navigation property. */
138
158
  property: string;
159
+ /** ID of the referenced instance stored by the navigation property. */
139
160
  navId: string;
161
+ /** Class queried for the referenced row: the first relationship constraint class in the navigation direction, including derived classes. */
140
162
  primaryClass: string;
141
163
  }
142
164
  /**
143
165
  * Return type for Check Link Table Foreign Key Class Ids integrity check
144
166
  */
145
167
  export interface CheckLinkTableFkClassIdsResultRow {
168
+ /** Sequential result row number. */
146
169
  sno: number;
170
+ /** ID of the relationship row containing the foreign key. */
147
171
  id: string;
172
+ /** Link-table relationship class. */
148
173
  relationship: string;
174
+ /** Endpoint class-ID property: SourceECClassId or TargetECClassId. */
149
175
  property: string;
176
+ /** Source or target endpoint instance ID stored in the link table. */
150
177
  keyId: string;
178
+ /** Source or target endpoint class ID; the check verifies that the class exists. */
151
179
  keyClassId: string;
152
180
  }
153
181
  /**
154
182
  * Return type for Check Link Table Foreign Key Ids integrity check
155
183
  */
156
184
  export interface CheckLinkTableFkIdsResultRow {
185
+ /** Sequential result row number. */
157
186
  sno: number;
187
+ /** ID of the relationship row containing the foreign key. */
158
188
  id: string;
189
+ /** Link-table relationship class. */
159
190
  relationship: string;
191
+ /** Endpoint instance-ID property: SourceECInstanceId or TargetECInstanceId. */
160
192
  property: string;
193
+ /** Source or target endpoint instance ID stored in the link table. */
161
194
  keyId: string;
195
+ /** Class queried for the referenced endpoint row: the first endpoint constraint class, including derived classes. */
162
196
  primaryClass: string;
163
197
  }
164
198
  /**
165
199
  * Return type for Check Class Ids integrity check
166
200
  */
167
201
  export interface CheckClassIdsResultRow {
202
+ /** Sequential result row number. */
168
203
  sno: number;
204
+ /** Declaring or scanned class for the row; rows from derived classes may be included. */
169
205
  class: string;
206
+ /** ECInstanceId for primary/joined results, or the physical RowId for overflow results. */
170
207
  id: string;
208
+ /** Persisted ECClassId value with no matching class definition. */
171
209
  classId: string;
210
+ /** Check category: "primary", "joined", or "overflow". */
172
211
  type: string;
173
212
  }
174
213
  /**
175
214
  * Return type for Check Data Schema integrity check
176
215
  */
177
216
  export interface CheckDataSchemaResultRow {
217
+ /** Sequential result row number. */
178
218
  sno: number;
219
+ /** Type of missing mapped schema object, such as a table or index. */
179
220
  type: string;
221
+ /** Name of the missing mapped schema object. */
180
222
  name: string;
181
223
  }
182
224
  /**
183
225
  * Return type for Check Schema Load integrity check
184
226
  */
185
227
  export interface CheckSchemaLoadResultRow {
228
+ /** Sequential result row number. */
186
229
  sno: number;
230
+ /** Name of the schema that the schema manager could not load. */
187
231
  schema: string;
188
232
  }
189
233
  /**
190
234
  * Return type for Check Missing Child Rows integrity check
191
235
  */
192
236
  export interface CheckMissingChildRowsResultRow {
237
+ /** Sequential result row number. */
193
238
  sno: number;
239
+ /** Class used to identify the checked rows: "BisCore:Element". */
194
240
  class: string;
241
+ /** ID of the existing bis_Element row missing a required child row. */
195
242
  id: string;
243
+ /** Persisted ECClassId of the existing element row. */
196
244
  classId: string;
245
+ /** Comma-separated names of all child tables checked for the row, not only tables with a missing child row. */
197
246
  missingRowInTables: string;
198
247
  }
199
248
  /**
200
249
  * Return type for Check Diverged Property Maps integrity check
201
250
  */
202
251
  export interface CheckDivergedPropMapsResultRow {
252
+ /** Sequential result row number. */
203
253
  sno: number;
254
+ /** ID of the derived class whose inherited property map diverges. */
204
255
  derivedClassId: Id64String;
256
+ /** Name of the derived class whose inherited property map diverges. */
205
257
  derivedClassName: string;
258
+ /** ID of the base class whose mapping was compared with the derived class. */
206
259
  baseClassId: Id64String;
260
+ /** Name of the base class whose mapping was compared with the derived class. */
207
261
  baseClassName: string;
262
+ /** Access path of the inherited property with different column mappings. */
208
263
  propertyName: string;
264
+ /** Base class mapping, formatted as table.column. */
209
265
  baseColumn: string;
266
+ /** Derived class mapping, formatted as table.column. */
210
267
  divergedColumn: string;
211
268
  }
212
269
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"IntegrityCheck.d.ts","sourceRoot":"","sources":["../../../src/internal/IntegrityCheck.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAgB,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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