@itwin/presentation-common 5.5.0-dev.2 → 5.5.0-dev.4

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 (160) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/lib/assets/locales/en/Presentation.json +19 -19
  3. package/lib/cjs/presentation-common/AsyncTasks.js.map +1 -1
  4. package/lib/cjs/presentation-common/CommonLoggerCategory.js.map +1 -1
  5. package/lib/cjs/presentation-common/Diagnostics.js.map +1 -1
  6. package/lib/cjs/presentation-common/EC.js.map +1 -1
  7. package/lib/cjs/presentation-common/ElementProperties.js.map +1 -1
  8. package/lib/cjs/presentation-common/Error.js.map +1 -1
  9. package/lib/cjs/presentation-common/InstanceFilterDefinition.js.map +1 -1
  10. package/lib/cjs/presentation-common/KeySet.js.map +1 -1
  11. package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  12. package/lib/cjs/presentation-common/LabelDefinition.js.map +1 -1
  13. package/lib/cjs/presentation-common/LocalizationHelper.js.map +1 -1
  14. package/lib/cjs/presentation-common/PresentationIpcInterface.js.map +1 -1
  15. package/lib/cjs/presentation-common/PresentationManagerOptions.js.map +1 -1
  16. package/lib/cjs/presentation-common/PresentationRpcInterface.js.map +1 -1
  17. package/lib/cjs/presentation-common/RegisteredRuleset.js.map +1 -1
  18. package/lib/cjs/presentation-common/RpcRequestsHandler.js.map +1 -1
  19. package/lib/cjs/presentation-common/RulesetVariables.js.map +1 -1
  20. package/lib/cjs/presentation-common/RulesetsFactory.js.map +1 -1
  21. package/lib/cjs/presentation-common/Update.js.map +1 -1
  22. package/lib/cjs/presentation-common/Utils.js.map +1 -1
  23. package/lib/cjs/presentation-common/content/Category.js.map +1 -1
  24. package/lib/cjs/presentation-common/content/Content.js.map +1 -1
  25. package/lib/cjs/presentation-common/content/ContentTraverser.d.ts +2 -2
  26. package/lib/cjs/presentation-common/content/ContentTraverser.js +2 -2
  27. package/lib/cjs/presentation-common/content/ContentTraverser.js.map +1 -1
  28. package/lib/cjs/presentation-common/content/Descriptor.js.map +1 -1
  29. package/lib/cjs/presentation-common/content/DisplayTypes.js.map +1 -1
  30. package/lib/cjs/presentation-common/content/Editor.js.map +1 -1
  31. package/lib/cjs/presentation-common/content/Fields.js.map +1 -1
  32. package/lib/cjs/presentation-common/content/Item.js.map +1 -1
  33. package/lib/cjs/presentation-common/content/Property.js.map +1 -1
  34. package/lib/cjs/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  35. package/lib/cjs/presentation-common/content/Renderer.js.map +1 -1
  36. package/lib/cjs/presentation-common/content/TypeDescription.js.map +1 -1
  37. package/lib/cjs/presentation-common/content/Value.js.map +1 -1
  38. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  39. package/lib/cjs/presentation-common/hierarchy/Key.js.map +1 -1
  40. package/lib/cjs/presentation-common/hierarchy/Node.js.map +1 -1
  41. package/lib/cjs/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  42. package/lib/cjs/presentation-common/rules/ClassSpecifications.js.map +1 -1
  43. package/lib/cjs/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
  44. package/lib/cjs/presentation-common/rules/RelationshipDirection.js.map +1 -1
  45. package/lib/cjs/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
  46. package/lib/cjs/presentation-common/rules/Rule.js.map +1 -1
  47. package/lib/cjs/presentation-common/rules/Ruleset.js.map +1 -1
  48. package/lib/cjs/presentation-common/rules/SchemasSpecification.js.map +1 -1
  49. package/lib/cjs/presentation-common/rules/Variables.js.map +1 -1
  50. package/lib/cjs/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
  51. package/lib/cjs/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
  52. package/lib/cjs/presentation-common/rules/content/ContentRule.js.map +1 -1
  53. package/lib/cjs/presentation-common/rules/content/ContentSpecification.js.map +1 -1
  54. package/lib/cjs/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
  55. package/lib/cjs/presentation-common/rules/content/PropertySpecification.js.map +1 -1
  56. package/lib/cjs/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
  57. package/lib/cjs/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
  58. package/lib/cjs/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
  59. package/lib/cjs/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
  60. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
  61. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
  62. package/lib/cjs/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
  63. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  64. package/lib/cjs/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
  65. package/lib/cjs/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  66. package/lib/cjs/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
  67. package/lib/cjs/presentation-common/rules/customization/SortingRule.js.map +1 -1
  68. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  69. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  70. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  71. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  72. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  73. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  74. package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  75. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  76. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  77. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  78. package/lib/cjs/presentation-common/selection/SelectionScope.js.map +1 -1
  79. package/lib/cjs/presentation-common-internal.js.map +1 -1
  80. package/lib/cjs/presentation-common.js.map +1 -1
  81. package/lib/esm/presentation-common/AsyncTasks.js.map +1 -1
  82. package/lib/esm/presentation-common/CommonLoggerCategory.js.map +1 -1
  83. package/lib/esm/presentation-common/Diagnostics.js.map +1 -1
  84. package/lib/esm/presentation-common/EC.js.map +1 -1
  85. package/lib/esm/presentation-common/ElementProperties.js.map +1 -1
  86. package/lib/esm/presentation-common/Error.js.map +1 -1
  87. package/lib/esm/presentation-common/InstanceFilterDefinition.js.map +1 -1
  88. package/lib/esm/presentation-common/KeySet.js.map +1 -1
  89. package/lib/esm/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  90. package/lib/esm/presentation-common/LabelDefinition.js.map +1 -1
  91. package/lib/esm/presentation-common/LocalizationHelper.js.map +1 -1
  92. package/lib/esm/presentation-common/PresentationIpcInterface.js.map +1 -1
  93. package/lib/esm/presentation-common/PresentationManagerOptions.js.map +1 -1
  94. package/lib/esm/presentation-common/PresentationRpcInterface.js.map +1 -1
  95. package/lib/esm/presentation-common/RegisteredRuleset.js.map +1 -1
  96. package/lib/esm/presentation-common/RpcRequestsHandler.js.map +1 -1
  97. package/lib/esm/presentation-common/RulesetVariables.js.map +1 -1
  98. package/lib/esm/presentation-common/RulesetsFactory.js.map +1 -1
  99. package/lib/esm/presentation-common/Update.js.map +1 -1
  100. package/lib/esm/presentation-common/Utils.js.map +1 -1
  101. package/lib/esm/presentation-common/content/Category.js.map +1 -1
  102. package/lib/esm/presentation-common/content/Content.js.map +1 -1
  103. package/lib/esm/presentation-common/content/ContentTraverser.d.ts +2 -2
  104. package/lib/esm/presentation-common/content/ContentTraverser.js +2 -2
  105. package/lib/esm/presentation-common/content/ContentTraverser.js.map +1 -1
  106. package/lib/esm/presentation-common/content/Descriptor.js.map +1 -1
  107. package/lib/esm/presentation-common/content/DisplayTypes.js.map +1 -1
  108. package/lib/esm/presentation-common/content/Editor.js.map +1 -1
  109. package/lib/esm/presentation-common/content/Fields.js.map +1 -1
  110. package/lib/esm/presentation-common/content/Item.js.map +1 -1
  111. package/lib/esm/presentation-common/content/Property.js.map +1 -1
  112. package/lib/esm/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  113. package/lib/esm/presentation-common/content/Renderer.js.map +1 -1
  114. package/lib/esm/presentation-common/content/TypeDescription.js.map +1 -1
  115. package/lib/esm/presentation-common/content/Value.js.map +1 -1
  116. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  117. package/lib/esm/presentation-common/hierarchy/Key.js.map +1 -1
  118. package/lib/esm/presentation-common/hierarchy/Node.js.map +1 -1
  119. package/lib/esm/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  120. package/lib/esm/presentation-common/rules/ClassSpecifications.js.map +1 -1
  121. package/lib/esm/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
  122. package/lib/esm/presentation-common/rules/RelationshipDirection.js.map +1 -1
  123. package/lib/esm/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
  124. package/lib/esm/presentation-common/rules/Rule.js.map +1 -1
  125. package/lib/esm/presentation-common/rules/Ruleset.js.map +1 -1
  126. package/lib/esm/presentation-common/rules/SchemasSpecification.js.map +1 -1
  127. package/lib/esm/presentation-common/rules/Variables.js.map +1 -1
  128. package/lib/esm/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
  129. package/lib/esm/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
  130. package/lib/esm/presentation-common/rules/content/ContentRule.js.map +1 -1
  131. package/lib/esm/presentation-common/rules/content/ContentSpecification.js.map +1 -1
  132. package/lib/esm/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
  133. package/lib/esm/presentation-common/rules/content/PropertySpecification.js.map +1 -1
  134. package/lib/esm/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
  135. package/lib/esm/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
  136. package/lib/esm/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
  137. package/lib/esm/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
  138. package/lib/esm/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
  139. package/lib/esm/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
  140. package/lib/esm/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
  141. package/lib/esm/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  142. package/lib/esm/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
  143. package/lib/esm/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  144. package/lib/esm/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
  145. package/lib/esm/presentation-common/rules/customization/SortingRule.js.map +1 -1
  146. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  147. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  148. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  149. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  150. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  151. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  152. package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  153. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  154. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  155. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  156. package/lib/esm/presentation-common/selection/SelectionScope.js.map +1 -1
  157. package/lib/esm/presentation-common-internal.js.map +1 -1
  158. package/lib/esm/presentation-common.js.map +1 -1
  159. package/lib/public/locales/en/Presentation.json +19 -19
  160. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"KoqPropertyValueFormatter.js","sourceRoot":"","sources":["../../../src/presentation-common/KoqPropertyValueFormatter.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAgC,aAAa,EAAE,UAAU,EAAgC,MAAM,sBAAsB,CAAC;AACrI,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,qBAAqB,EAAE,SAAS,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAmE9J;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAC5B,cAAc,CAAgB;IAC9B,cAAc,CAAgB;IAC9B,gBAAgB,CAAmB;IAC3C,4DAA4D;IACpD,eAAe,CAAc;IAMrC,4DAA4D;IAC5D,YAAY,oBAAoE,EAAE,cAA2B,EAAE,eAAiC;QAC9I,IAAI,oBAAoB,YAAY,aAAa,EAAE,CAAC;YAClD,IAAI,CAAC,cAAc,GAAG,oBAAoB,CAAC;YAC3C,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;YACxC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,cAAc,GAAG,oBAAoB,CAAC,aAAa,CAAC;YACzD,IAAI,CAAC,gBAAgB,GAAG,oBAAoB,CAAC,eAAe,CAAC;QAC/D,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACpE,CAAC;IAED,qBAAqB;IACrB,gBAAgB;IAChB,4DAA4D;IAC5D,IAAW,cAA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EAAE,CAAC,EAAE,CAAC;QAC5D,MAAM,wBAAwB,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC3E,KAAK,MAAM,uBAAuB,IAAI,KAAK,CAAC,OAAO,CAAC,wBAAwB,CAAC;YAC3E,CAAC,CAAC,oBAAoB,CAAC,wBAAwB;YAC/C,CAAC,CAAC,CAAC,wBAAwB,CAAC,EAAE,CAAC;YAC/B,IAAI,uBAAuB,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC7D,OAAO,uBAAuB,CAAC,MAAM,CAAC;YACxC,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { Format, FormatProps, FormatsProvider, FormatterSpec, ParserSpec, UnitsProvider, UnitSystemKey } from \"@itwin/core-quantity\";\nimport { InvertedUnit, KindOfQuantity, SchemaContext, SchemaFormatsProvider, SchemaKey, SchemaMatchType, SchemaUnitProvider } from \"@itwin/ecschema-metadata\";\n\n/**\n * A data structure that associates unit systems with property value formatting props. The associations are used for\n * assigning formatting props for specific phenomenon and unit system combinations (see [[FormatsMap]]).\n *\n * @public\n *\n * @deprecated in 5.1 - will not be removed until after 2026-08-08. `FormatsMap` and related APIs have been deprecated in favor of [FormatsProvider]($core-quantity).\n */\nexport interface UnitSystemFormat {\n unitSystems: UnitSystemKey[];\n format: FormatProps;\n}\n\n/**\n * A data structure that associates specific phenomenon with one or more formatting props for specific unit system.\n *\n * Example:\n * ```json\n * {\n * length: [{\n * unitSystems: [\"metric\"],\n * format: formatForCentimeters,\n * }, {\n * unitSystems: [\"imperial\", \"usCustomary\"],\n * format: formatForInches,\n * }, {\n * unitSystems: [\"usSurvey\"],\n * format: formatForUsSurveyInches,\n * }]\n * }\n * ```\n *\n * @public\n *\n * @deprecated in 5.1 - will not be removed until after 2026-08-08. `FormatsMap` and related APIs have been deprecated in favor of [FormatsProvider]($core-quantity).\n */\nexport interface FormatsMap {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n [phenomenon: string]: UnitSystemFormat | UnitSystemFormat[];\n}\n\n/**\n * Options for finding a formatter spec to use in [[KoqPropertyValueFormatter]].\n * @public\n */\nexport interface FormatOptions {\n /** Full name of the `KindOfQuantity`, e.g. `SchemaName:KoqName`. */\n koqName: string;\n /** Unit system to use for formatting. */\n unitSystem?: UnitSystemKey;\n /** Optional overrides for the format used to parse or format values. */\n formatOverride?: Partial<Omit<FormatProps, \"type\">>;\n}\n\n/**\n * Props for creating [[KoqPropertyValueFormatter]].\n * @public\n */\ninterface KoqPropertyValueFormatterProps {\n /** Schema context to use for locating units, formats, etc. Generally retrieved through the `schemaContext` getter on an iModel. */\n schemaContext: SchemaContext;\n /** Formats provider to use for finding formatting props. Defaults to [SchemaFormatsProvider]($ecschema-metadata) when not supplied. */\n formatsProvider?: FormatsProvider;\n}\n\n/**\n * An utility for formatting property values based on `KindOfQuantity` and unit system.\n * @public\n */\nexport class KoqPropertyValueFormatter {\n private _schemaContext: SchemaContext;\n private _unitsProvider: UnitsProvider;\n private _formatsProvider?: FormatsProvider;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n private _defaultFormats?: FormatsMap;\n\n /** @deprecated in 5.1 - will not be removed until after 2026-08-08. Use the overload that takes a props object. */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n constructor(schemaContext: SchemaContext, defaultFormats?: FormatsMap, formatsProvider?: FormatsProvider);\n constructor(props: KoqPropertyValueFormatterProps);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n constructor(schemaContextOrProps: SchemaContext | KoqPropertyValueFormatterProps, defaultFormats?: FormatsMap, formatsProvider?: FormatsProvider) {\n if (schemaContextOrProps instanceof SchemaContext) {\n this._schemaContext = schemaContextOrProps;\n this._formatsProvider = formatsProvider;\n this.defaultFormats = defaultFormats;\n } else {\n this._schemaContext = schemaContextOrProps.schemaContext;\n this._formatsProvider = schemaContextOrProps.formatsProvider;\n }\n this._unitsProvider = new SchemaUnitProvider(this._schemaContext);\n }\n\n /* c8 ignore start */\n /** @internal */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public get defaultFormats(): FormatsMap | undefined {\n return this._defaultFormats;\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public set defaultFormats(value: FormatsMap | undefined) {\n this._defaultFormats = value\n ? Object.entries(value).reduce((acc, [phenomenon, unitSystemFormats]) => ({ ...acc, [phenomenon.toUpperCase()]: unitSystemFormats }), {})\n : undefined;\n }\n /* c8 ignore end */\n\n public async format(value: number, options: FormatOptions) {\n const formatterSpec = await this.getFormatterSpec(options);\n if (!formatterSpec) {\n return undefined;\n }\n return formatterSpec.applyFormatting(value);\n }\n\n public async getFormatterSpec(options: FormatOptions) {\n const formattingProps = await this.#getFormattingProps(options);\n if (!formattingProps) {\n return undefined;\n }\n const { formatProps, persistenceUnitName } = formattingProps;\n const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);\n const format = await Format.createFromJSON(\"\", this._unitsProvider, { ...formatProps, ...options.formatOverride });\n return FormatterSpec.create(\"\", format, this._unitsProvider, persistenceUnit);\n }\n\n public async getParserSpec(options: FormatOptions) {\n const formattingProps = await this.#getFormattingProps(options);\n if (!formattingProps) {\n return undefined;\n }\n const { formatProps, persistenceUnitName } = formattingProps;\n const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);\n const format = await Format.createFromJSON(\"\", this._unitsProvider, { ...formatProps, ...options.formatOverride });\n return ParserSpec.create(format, this._unitsProvider, persistenceUnit);\n }\n\n async #getFormattingProps(options: FormatOptions): Promise<FormattingProps | undefined> {\n const { koqName } = options;\n const koq = await getKoq(this._schemaContext, koqName);\n if (!koq) {\n return undefined;\n }\n const persistenceUnit = await koq.persistenceUnit;\n assert(!!persistenceUnit);\n\n // default to metric as it's the persistence unit system\n const unitSystem = options.unitSystem ?? \"metric\";\n\n const formatsProvider = this._formatsProvider ?? new SchemaFormatsProvider(this._schemaContext, unitSystem);\n const formatProps = await formatsProvider.getFormat(koqName);\n\n // `SchemaFormatsProvider` will fall back to default presentation format, but we want to fall back\n // to default formats' map first, and only then to the default presentation format. All of this can\n // be removed with the removal of default formats map.\n if (this._defaultFormats && (!formatProps || (await getUnitSystemKey(this._unitsProvider, formatProps)) !== unitSystem)) {\n const defaultFormatProps = await getFormatPropsFromDefaultFormats({\n schemaContext: this._schemaContext,\n formatsMap: this._defaultFormats,\n unitSystem,\n koqName,\n });\n if (defaultFormatProps) {\n return { formatProps: defaultFormatProps, persistenceUnitName: persistenceUnit.fullName };\n }\n }\n\n if (formatProps) {\n return { formatProps, persistenceUnitName: persistenceUnit.fullName };\n }\n\n return undefined;\n }\n}\n\ninterface FormattingProps {\n formatProps: FormatProps;\n persistenceUnitName: string;\n}\n\nasync function getKoq(schemaLocater: SchemaContext, fullName: string) {\n const [schemaName, propKoqName] = fullName.split(\":\");\n const schema = await schemaLocater.getSchema(new SchemaKey(schemaName), SchemaMatchType.Latest);\n if (!schema) {\n return undefined;\n }\n return schema.getItem(propKoqName, KindOfQuantity);\n}\n\nasync function getUnitSystemKey(unitsProvider: UnitsProvider, formatProps: FormatProps): Promise<UnitSystemKey | undefined> {\n const unitName = formatProps.composite?.units[0].name;\n assert(!!unitName);\n const unit = await unitsProvider.findUnitByName(unitName);\n assert(!!unit);\n const [_, unitSystemName] = unit.system.split(/[\\.:]/);\n switch (unitSystemName.toUpperCase()) {\n case \"METRIC\":\n return \"metric\";\n case \"IMPERIAL\":\n return \"imperial\";\n case \"USCUSTOM\":\n return \"usCustomary\";\n case \"USSURVEY\":\n return \"usSurvey\";\n /* c8 ignore next 2 */\n default:\n return undefined;\n }\n}\n\nasync function getFormatPropsFromDefaultFormats({\n schemaContext,\n formatsMap,\n unitSystem,\n koqName,\n}: {\n schemaContext: SchemaContext;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n formatsMap: FormatsMap;\n unitSystem: UnitSystemKey;\n koqName: string;\n}): Promise<FormatProps | undefined> {\n const koq = await getKoq(schemaContext, koqName);\n /* c8 ignore next 3 */\n if (!koq) {\n return undefined;\n }\n\n const persistenceUnit = await koq.persistenceUnit;\n /* c8 ignore next 3 */\n if (!persistenceUnit) {\n return undefined;\n }\n const actualPersistenceUnit = persistenceUnit instanceof InvertedUnit ? /* c8 ignore next */ await persistenceUnit.invertsUnit : persistenceUnit;\n const phenomenon = await actualPersistenceUnit?.phenomenon;\n if (phenomenon && formatsMap[phenomenon.name.toUpperCase()]) {\n const defaultPhenomenonFormats = formatsMap[phenomenon.name.toUpperCase()];\n for (const defaultUnitSystemFormat of Array.isArray(defaultPhenomenonFormats)\n ? /* c8 ignore next */ defaultPhenomenonFormats\n : [defaultPhenomenonFormats]) {\n if (defaultUnitSystemFormat.unitSystems.includes(unitSystem)) {\n return defaultUnitSystemFormat.format;\n }\n }\n }\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"KoqPropertyValueFormatter.js","sourceRoot":"","sources":["../../../src/presentation-common/KoqPropertyValueFormatter.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAgC,aAAa,EAAE,UAAU,EAAgC,MAAM,sBAAsB,CAAC;AACrI,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,qBAAqB,EAAE,SAAS,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAmE9J;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAC5B,cAAc,CAAgB;IAC9B,cAAc,CAAgB;IAC9B,gBAAgB,CAAmB;IAC3C,4DAA4D;IAC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O,GAOR;IACC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACjD,sBAAsB;IACtB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,eAAe,GAAG,MAAM,GAAG,CAAC,eAAe,CAAC;IAClD,sBAAsB;IACtB,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,qBAAqB,GAAG,eAAe,YAAY,YAAY,CAAC,CAAC,CAAC,oBAAoB,CAAC,MAAM,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC;IACjJ,MAAM,UAAU,GAAG,MAAM,qBAAqB,EAAE,UAAU,CAAC;IAC3D,IAAI,UAAU,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QAC5D,MAAM,wBAAwB,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC3E,KAAK,MAAM,uBAAuB,IAAI,KAAK,CAAC,OAAO,CAAC,wBAAwB,CAAC;YAC3E,CAAC,CAAC,oBAAoB,CAAC,wBAAwB;YAC/C,CAAC,CAAC,CAAC,wBAAwB,CAAC,EAAE,CAAC;YAC/B,IAAI,uBAAuB,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC7D,OAAO,uBAAuB,CAAC,MAAM,CAAC;YACxC,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","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 Core\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Format, FormatProps, FormatsProvider, FormatterSpec, ParserSpec, UnitsProvider, UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport { InvertedUnit, KindOfQuantity, SchemaContext, SchemaFormatsProvider, SchemaKey, SchemaMatchType, SchemaUnitProvider } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * A data structure that associates unit systems with property value formatting props. The associations are used for\r\n * assigning formatting props for specific phenomenon and unit system combinations (see [[FormatsMap]]).\r\n *\r\n * @public\r\n *\r\n * @deprecated in 5.1 - will not be removed until after 2026-08-08. `FormatsMap` and related APIs have been deprecated in favor of [FormatsProvider]($core-quantity).\r\n */\r\nexport interface UnitSystemFormat {\r\n unitSystems: UnitSystemKey[];\r\n format: FormatProps;\r\n}\r\n\r\n/**\r\n * A data structure that associates specific phenomenon with one or more formatting props for specific unit system.\r\n *\r\n * Example:\r\n * ```json\r\n * {\r\n * length: [{\r\n * unitSystems: [\"metric\"],\r\n * format: formatForCentimeters,\r\n * }, {\r\n * unitSystems: [\"imperial\", \"usCustomary\"],\r\n * format: formatForInches,\r\n * }, {\r\n * unitSystems: [\"usSurvey\"],\r\n * format: formatForUsSurveyInches,\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @public\r\n *\r\n * @deprecated in 5.1 - will not be removed until after 2026-08-08. `FormatsMap` and related APIs have been deprecated in favor of [FormatsProvider]($core-quantity).\r\n */\r\nexport interface FormatsMap {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n [phenomenon: string]: UnitSystemFormat | UnitSystemFormat[];\r\n}\r\n\r\n/**\r\n * Options for finding a formatter spec to use in [[KoqPropertyValueFormatter]].\r\n * @public\r\n */\r\nexport interface FormatOptions {\r\n /** Full name of the `KindOfQuantity`, e.g. `SchemaName:KoqName`. */\r\n koqName: string;\r\n /** Unit system to use for formatting. */\r\n unitSystem?: UnitSystemKey;\r\n /** Optional overrides for the format used to parse or format values. */\r\n formatOverride?: Partial<Omit<FormatProps, \"type\">>;\r\n}\r\n\r\n/**\r\n * Props for creating [[KoqPropertyValueFormatter]].\r\n * @public\r\n */\r\ninterface KoqPropertyValueFormatterProps {\r\n /** Schema context to use for locating units, formats, etc. Generally retrieved through the `schemaContext` getter on an iModel. */\r\n schemaContext: SchemaContext;\r\n /** Formats provider to use for finding formatting props. Defaults to [SchemaFormatsProvider]($ecschema-metadata) when not supplied. */\r\n formatsProvider?: FormatsProvider;\r\n}\r\n\r\n/**\r\n * An utility for formatting property values based on `KindOfQuantity` and unit system.\r\n * @public\r\n */\r\nexport class KoqPropertyValueFormatter {\r\n private _schemaContext: SchemaContext;\r\n private _unitsProvider: UnitsProvider;\r\n private _formatsProvider?: FormatsProvider;\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n private _defaultFormats?: FormatsMap;\r\n\r\n /** @deprecated in 5.1 - will not be removed until after 2026-08-08. Use the overload that takes a props object. */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n constructor(schemaContext: SchemaContext, defaultFormats?: FormatsMap, formatsProvider?: FormatsProvider);\r\n constructor(props: KoqPropertyValueFormatterProps);\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n constructor(schemaContextOrProps: SchemaContext | KoqPropertyValueFormatterProps, defaultFormats?: FormatsMap, formatsProvider?: FormatsProvider) {\r\n if (schemaContextOrProps instanceof SchemaContext) {\r\n this._schemaContext = schemaContextOrProps;\r\n this._formatsProvider = formatsProvider;\r\n this.defaultFormats = defaultFormats;\r\n } else {\r\n this._schemaContext = schemaContextOrProps.schemaContext;\r\n this._formatsProvider = schemaContextOrProps.formatsProvider;\r\n }\r\n this._unitsProvider = new SchemaUnitProvider(this._schemaContext);\r\n }\r\n\r\n /* c8 ignore start */\r\n /** @internal */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n public get defaultFormats(): FormatsMap | undefined {\r\n return this._defaultFormats;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n public set defaultFormats(value: FormatsMap | undefined) {\r\n this._defaultFormats = value\r\n ? Object.entries(value).reduce((acc, [phenomenon, unitSystemFormats]) => ({ ...acc, [phenomenon.toUpperCase()]: unitSystemFormats }), {})\r\n : undefined;\r\n }\r\n /* c8 ignore end */\r\n\r\n public async format(value: number, options: FormatOptions) {\r\n const formatterSpec = await this.getFormatterSpec(options);\r\n if (!formatterSpec) {\r\n return undefined;\r\n }\r\n return formatterSpec.applyFormatting(value);\r\n }\r\n\r\n public async getFormatterSpec(options: FormatOptions) {\r\n const formattingProps = await this.#getFormattingProps(options);\r\n if (!formattingProps) {\r\n return undefined;\r\n }\r\n const { formatProps, persistenceUnitName } = formattingProps;\r\n const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);\r\n const format = await Format.createFromJSON(\"\", this._unitsProvider, { ...formatProps, ...options.formatOverride });\r\n return FormatterSpec.create(\"\", format, this._unitsProvider, persistenceUnit);\r\n }\r\n\r\n public async getParserSpec(options: FormatOptions) {\r\n const formattingProps = await this.#getFormattingProps(options);\r\n if (!formattingProps) {\r\n return undefined;\r\n }\r\n const { formatProps, persistenceUnitName } = formattingProps;\r\n const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);\r\n const format = await Format.createFromJSON(\"\", this._unitsProvider, { ...formatProps, ...options.formatOverride });\r\n return ParserSpec.create(format, this._unitsProvider, persistenceUnit);\r\n }\r\n\r\n async #getFormattingProps(options: FormatOptions): Promise<FormattingProps | undefined> {\r\n const { koqName } = options;\r\n const koq = await getKoq(this._schemaContext, koqName);\r\n if (!koq) {\r\n return undefined;\r\n }\r\n const persistenceUnit = await koq.persistenceUnit;\r\n assert(!!persistenceUnit);\r\n\r\n // default to metric as it's the persistence unit system\r\n const unitSystem = options.unitSystem ?? \"metric\";\r\n\r\n const formatsProvider = this._formatsProvider ?? new SchemaFormatsProvider(this._schemaContext, unitSystem);\r\n const formatProps = await formatsProvider.getFormat(koqName);\r\n\r\n // `SchemaFormatsProvider` will fall back to default presentation format, but we want to fall back\r\n // to default formats' map first, and only then to the default presentation format. All of this can\r\n // be removed with the removal of default formats map.\r\n if (this._defaultFormats && (!formatProps || (await getUnitSystemKey(this._unitsProvider, formatProps)) !== unitSystem)) {\r\n const defaultFormatProps = await getFormatPropsFromDefaultFormats({\r\n schemaContext: this._schemaContext,\r\n formatsMap: this._defaultFormats,\r\n unitSystem,\r\n koqName,\r\n });\r\n if (defaultFormatProps) {\r\n return { formatProps: defaultFormatProps, persistenceUnitName: persistenceUnit.fullName };\r\n }\r\n }\r\n\r\n if (formatProps) {\r\n return { formatProps, persistenceUnitName: persistenceUnit.fullName };\r\n }\r\n\r\n return undefined;\r\n }\r\n}\r\n\r\ninterface FormattingProps {\r\n formatProps: FormatProps;\r\n persistenceUnitName: string;\r\n}\r\n\r\nasync function getKoq(schemaLocater: SchemaContext, fullName: string) {\r\n const [schemaName, propKoqName] = fullName.split(\":\");\r\n const schema = await schemaLocater.getSchema(new SchemaKey(schemaName), SchemaMatchType.Latest);\r\n if (!schema) {\r\n return undefined;\r\n }\r\n return schema.getItem(propKoqName, KindOfQuantity);\r\n}\r\n\r\nasync function getUnitSystemKey(unitsProvider: UnitsProvider, formatProps: FormatProps): Promise<UnitSystemKey | undefined> {\r\n const unitName = formatProps.composite?.units[0].name;\r\n assert(!!unitName);\r\n const unit = await unitsProvider.findUnitByName(unitName);\r\n assert(!!unit);\r\n const [_, unitSystemName] = unit.system.split(/[\\.:]/);\r\n switch (unitSystemName.toUpperCase()) {\r\n case \"METRIC\":\r\n return \"metric\";\r\n case \"IMPERIAL\":\r\n return \"imperial\";\r\n case \"USCUSTOM\":\r\n return \"usCustomary\";\r\n case \"USSURVEY\":\r\n return \"usSurvey\";\r\n /* c8 ignore next 2 */\r\n default:\r\n return undefined;\r\n }\r\n}\r\n\r\nasync function getFormatPropsFromDefaultFormats({\r\n schemaContext,\r\n formatsMap,\r\n unitSystem,\r\n koqName,\r\n}: {\r\n schemaContext: SchemaContext;\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n formatsMap: FormatsMap;\r\n unitSystem: UnitSystemKey;\r\n koqName: string;\r\n}): Promise<FormatProps | undefined> {\r\n const koq = await getKoq(schemaContext, koqName);\r\n /* c8 ignore next 3 */\r\n if (!koq) {\r\n return undefined;\r\n }\r\n\r\n const persistenceUnit = await koq.persistenceUnit;\r\n /* c8 ignore next 3 */\r\n if (!persistenceUnit) {\r\n return undefined;\r\n }\r\n const actualPersistenceUnit = persistenceUnit instanceof InvertedUnit ? /* c8 ignore next */ await persistenceUnit.invertsUnit : persistenceUnit;\r\n const phenomenon = await actualPersistenceUnit?.phenomenon;\r\n if (phenomenon && formatsMap[phenomenon.name.toUpperCase()]) {\r\n const defaultPhenomenonFormats = formatsMap[phenomenon.name.toUpperCase()];\r\n for (const defaultUnitSystemFormat of Array.isArray(defaultPhenomenonFormats)\r\n ? /* c8 ignore next */ defaultPhenomenonFormats\r\n : [defaultPhenomenonFormats]) {\r\n if (defaultUnitSystemFormat.unitSystems.includes(unitSystem)) {\r\n return defaultUnitSystemFormat.format;\r\n }\r\n }\r\n }\r\n return undefined;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LabelDefinition.js","sourceRoot":"","sources":["../../../src/presentation-common/LabelDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AA8BH,gBAAgB;AAChB,MAAM,CAAC,MAAM,mCAAmC,GAAG,WAAW,CAAC;AAE/D,cAAc;AACd,MAAM,KAAW,eAAe,CAoB/B;AApBD,WAAiB,eAAe;IAC9B;;;OAGG;IACH,SAAgB,qBAAqB,CAAC,GAAoB;QACxD,OAAO,GAAG,CAAC,QAAQ,KAAK,mCAAmC,CAAC;IAC9D,CAAC;IAFe,qCAAqB,wBAEpC,CAAA;IAED;;;OAGG;IACH,SAAgB,eAAe,CAAC,KAAa;QAC3C,OAAO;YACL,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,QAAQ;SACnB,CAAC;IACJ,CAAC;IANe,+BAAe,kBAM9B,CAAA;AACH,CAAC,EApBgB,eAAe,KAAf,eAAe,QAoB/B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Hierarchies\n */\n\n/**\n * Data structure that describes raw composite label value.\n * @public\n */\nexport interface LabelCompositeValue {\n separator: string;\n values: LabelDefinition[];\n}\n\n/**\n * Type definition of label raw value.\n * @public\n */\nexport type LabelRawValue = string | number | boolean | LabelCompositeValue;\n\n/**\n * Data structure that describes label definition.\n * @public\n */\nexport interface LabelDefinition {\n /** Display value of label */\n displayValue: string;\n /** Raw value of label */\n rawValue: LabelRawValue;\n /** Type name of raw value */\n typeName: string;\n}\n\n/** @internal */\nexport const COMPOSITE_LABEL_DEFINITION_TYPENAME = \"composite\";\n\n/** @public */\nexport namespace LabelDefinition {\n /**\n * Checks if provided [[LabelDefinition]] has raw value of type [[LabelCompositeValue]].\n * @public\n */\n export function isCompositeDefinition(def: LabelDefinition): def is LabelDefinition & { rawValue: LabelCompositeValue } {\n return def.typeName === COMPOSITE_LABEL_DEFINITION_TYPENAME;\n }\n\n /**\n * Creates [[LabelDefinition]] from string value.\n * @public\n */\n export function fromLabelString(label: string): LabelDefinition {\n return {\n displayValue: label,\n rawValue: label,\n typeName: \"string\",\n };\n }\n}\n"]}
1
+ {"version":3,"file":"LabelDefinition.js","sourceRoot":"","sources":["../../../src/presentation-common/LabelDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AA8BH,gBAAgB;AAChB,MAAM,CAAC,MAAM,mCAAmC,GAAG,WAAW,CAAC;AAE/D,cAAc;AACd,MAAM,KAAW,eAAe,CAoB/B;AApBD,WAAiB,eAAe;IAC9B;;;OAGG;IACH,SAAgB,qBAAqB,CAAC,GAAoB;QACxD,OAAO,GAAG,CAAC,QAAQ,KAAK,mCAAmC,CAAC;IAC9D,CAAC;IAFe,qCAAqB,wBAEpC,CAAA;IAED;;;OAGG;IACH,SAAgB,eAAe,CAAC,KAAa;QAC3C,OAAO;YACL,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,QAAQ;SACnB,CAAC;IACJ,CAAC;IANe,+BAAe,kBAM9B,CAAA;AACH,CAAC,EApBgB,eAAe,KAAf,eAAe,QAoB/B","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 Hierarchies\r\n */\r\n\r\n/**\r\n * Data structure that describes raw composite label value.\r\n * @public\r\n */\r\nexport interface LabelCompositeValue {\r\n separator: string;\r\n values: LabelDefinition[];\r\n}\r\n\r\n/**\r\n * Type definition of label raw value.\r\n * @public\r\n */\r\nexport type LabelRawValue = string | number | boolean | LabelCompositeValue;\r\n\r\n/**\r\n * Data structure that describes label definition.\r\n * @public\r\n */\r\nexport interface LabelDefinition {\r\n /** Display value of label */\r\n displayValue: string;\r\n /** Raw value of label */\r\n rawValue: LabelRawValue;\r\n /** Type name of raw value */\r\n typeName: string;\r\n}\r\n\r\n/** @internal */\r\nexport const COMPOSITE_LABEL_DEFINITION_TYPENAME = \"composite\";\r\n\r\n/** @public */\r\nexport namespace LabelDefinition {\r\n /**\r\n * Checks if provided [[LabelDefinition]] has raw value of type [[LabelCompositeValue]].\r\n * @public\r\n */\r\n export function isCompositeDefinition(def: LabelDefinition): def is LabelDefinition & { rawValue: LabelCompositeValue } {\r\n return def.typeName === COMPOSITE_LABEL_DEFINITION_TYPENAME;\r\n }\r\n\r\n /**\r\n * Creates [[LabelDefinition]] from string value.\r\n * @public\r\n */\r\n export function fromLabelString(label: string): LabelDefinition {\r\n return {\r\n displayValue: label,\r\n rawValue: label,\r\n typeName: \"string\",\r\n };\r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,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5G,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { CategoryDescription } from \"./content/Category.js\";\nimport { Content } from \"./content/Content.js\";\nimport { Descriptor } from \"./content/Descriptor.js\";\nimport { Field } from \"./content/Fields.js\";\nimport { Item } from \"./content/Item.js\";\nimport { DisplayValue, DisplayValueGroup, Value } from \"./content/Value.js\";\nimport { ElementProperties } from \"./ElementProperties.js\";\nimport { Node } from \"./hierarchy/Node.js\";\nimport { NodePathElement } from \"./hierarchy/NodePathElement.js\";\nimport { COMPOSITE_LABEL_DEFINITION_TYPENAME, LabelCompositeValue, LabelDefinition } from \"./LabelDefinition.js\";\n\nconst KEY_PATTERN = /@[\\w\\d\\-_]+:[\\w\\d\\-\\._]+?@/g;\n\ninterface LocalizationHelperProps {\n getLocalizedString: (key: string) => string;\n}\n\n/** @internal */\nexport class LocalizationHelper {\n private _getLocalizedString: (key: string) => string;\n\n constructor(props: LocalizationHelperProps) {\n this._getLocalizedString = props.getLocalizedString;\n }\n\n public getLocalizedString(text: string) {\n return text.replace(KEY_PATTERN, (key) => this._getLocalizedString(key.replace(/^@|@$/g, \"\")));\n }\n\n /* eslint-disable @typescript-eslint/no-deprecated */\n public getLocalizedNodes(nodes: Node[]): Node[] {\n return nodes.map((n) => this.getLocalizedNode(n));\n }\n\n public getLocalizedNode(node: Node): Node {\n return {\n ...node,\n label: this.getLocalizedLabelDefinition(node.label),\n ...(node.description ? { description: this.getLocalizedString(node.description) } : undefined),\n };\n }\n\n public getLocalizedNodePathElement(npe: NodePathElement): NodePathElement {\n return {\n ...npe,\n node: this.getLocalizedNode(npe.node),\n children: npe.children.map((c) => this.getLocalizedNodePathElement(c)),\n };\n }\n /* eslint-enable @typescript-eslint/no-deprecated */\n\n public getLocalizedDisplayValueGroup(group: DisplayValueGroup): DisplayValueGroup {\n return {\n ...group,\n displayValue: this.getLocalizedDisplayValue(group.displayValue),\n };\n }\n\n public getLocalizedLabelDefinition(labelDefinition: LabelDefinition): LabelDefinition {\n const getLocalizedComposite = (compositeValue: LabelCompositeValue) => ({\n ...compositeValue,\n values: compositeValue.values.map((value) => this.getLocalizedLabelDefinition(value)),\n });\n\n if (labelDefinition.typeName === COMPOSITE_LABEL_DEFINITION_TYPENAME) {\n return {\n ...labelDefinition,\n rawValue: getLocalizedComposite(labelDefinition.rawValue as LabelCompositeValue),\n };\n }\n if (labelDefinition.typeName === \"string\") {\n return {\n ...labelDefinition,\n rawValue: this.getLocalizedString(labelDefinition.rawValue as string),\n displayValue: this.getLocalizedString(labelDefinition.displayValue),\n };\n }\n return labelDefinition;\n }\n\n public getLocalizedLabelDefinitions(labelDefinitions: LabelDefinition[]) {\n return labelDefinitions.map((labelDefinition) => this.getLocalizedLabelDefinition(labelDefinition));\n }\n\n public getLocalizedContentDescriptor(descriptor: Descriptor) {\n const clone = new Descriptor(descriptor);\n clone.fields.forEach((field) => this.getLocalizedContentField(field));\n clone.categories.forEach((category) => this.getLocalizedCategoryDescription(category));\n return clone;\n }\n\n public getLocalizedContentItems(items: Item[]): Item[] {\n return items.map((item) => this.getLocalizedContentItem(item));\n }\n\n public getLocalizedContent(content: Content): Content {\n return new Content(this.getLocalizedContentDescriptor(content.descriptor), this.getLocalizedContentItems(content.contentSet));\n }\n\n public getLocalizedElementProperties(elem: ElementProperties): ElementProperties {\n return {\n ...elem,\n label: this.getLocalizedString(elem.label),\n };\n }\n\n // warning: this function mutates the item\n private getLocalizedContentItem(item: Item): Item {\n item.label = this.getLocalizedLabelDefinition(item.label);\n item.values = Object.entries(item.values).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {});\n item.displayValues = Object.entries(item.displayValues).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {});\n return item;\n }\n\n private getLocalizedRawValue(value: Value): Value {\n if (typeof value === \"string\") {\n return this.getLocalizedString(value);\n }\n if (Value.isNavigationValue(value)) {\n return {\n ...value,\n label: this.getLocalizedLabelDefinition(value.label),\n };\n }\n if (Value.isNestedContent(value)) {\n return value.map((item) => ({\n ...item,\n values: Object.entries(item.values).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {}),\n displayValues: Object.entries(item.displayValues).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {}),\n }));\n }\n if (Value.isArray(value)) {\n return value.map((v) => this.getLocalizedRawValue(v));\n }\n if (Value.isMap(value)) {\n return Object.entries(value).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {});\n }\n return value;\n }\n\n // warning: this function mutates the field\n private getLocalizedContentField<TField extends Field>(field: TField) {\n field.label = this.getLocalizedString(field.label);\n if (field.isPropertiesField()) {\n if (field.isStructPropertiesField()) {\n field.memberFields = field.memberFields.map((m) => this.getLocalizedContentField(m));\n } else if (field.isArrayPropertiesField()) {\n field.itemsField = this.getLocalizedContentField(field.itemsField);\n }\n } else if (field.isNestedContentField()) {\n field.nestedFields = field.nestedFields.map((m) => this.getLocalizedContentField(m));\n }\n return field;\n }\n\n // warning: this function mutates the category\n private getLocalizedCategoryDescription(category: CategoryDescription) {\n category.label = this.getLocalizedString(category.label);\n category.description = this.getLocalizedString(category.description);\n return category;\n }\n\n private getLocalizedDisplayValue(value: DisplayValue): DisplayValue {\n if (typeof value === \"undefined\") {\n return undefined;\n }\n if (typeof value === \"string\") {\n return this.getLocalizedString(value);\n }\n if (DisplayValue.isArray(value)) {\n return value.map((v) => this.getLocalizedDisplayValue(v));\n }\n return Object.entries(value).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {});\n }\n}\n"]}
1
+ {"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-common/LocalizationHelper.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI5E,OAAO,EAAE,mCAAmC,EAAwC,MAAM,sBAAsB,CAAC;AAEjH,MAAM,WAAW,GAAG,6BAA6B,CAAC;AAMlD,gBAAgB;AAChB,MAAM,OAAO,kBAAkB;IACrB,mBAAmB,CAA0B;IAErD,YAAY,KAA8B;QACxC,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,kBAAkB,CAAC;IACtD,CAAC;IAEM,kBAAkB,CAAC,IAAY;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IACjG,CAAC;IAED,qDAAqD;IAC9C,iBAAiB,CAAC,KAAa;QACpC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAEM,gBAAgB,CAAC,IAAU;QAChC,OAAO;YACL,GAAG,IAAI;YACP,KAAK,EAAE,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC;YACnD,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC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CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5G,CAAC;CACF","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 Core\r\n */\r\n\r\nimport { CategoryDescription } from \"./content/Category.js\";\r\nimport { Content } from \"./content/Content.js\";\r\nimport { Descriptor } from \"./content/Descriptor.js\";\r\nimport { Field } from \"./content/Fields.js\";\r\nimport { Item } from \"./content/Item.js\";\r\nimport { DisplayValue, DisplayValueGroup, Value } from \"./content/Value.js\";\r\nimport { ElementProperties } from \"./ElementProperties.js\";\r\nimport { Node } from \"./hierarchy/Node.js\";\r\nimport { NodePathElement } from \"./hierarchy/NodePathElement.js\";\r\nimport { COMPOSITE_LABEL_DEFINITION_TYPENAME, LabelCompositeValue, LabelDefinition } from \"./LabelDefinition.js\";\r\n\r\nconst KEY_PATTERN = /@[\\w\\d\\-_]+:[\\w\\d\\-\\._]+?@/g;\r\n\r\ninterface LocalizationHelperProps {\r\n getLocalizedString: (key: string) => string;\r\n}\r\n\r\n/** @internal */\r\nexport class LocalizationHelper {\r\n private _getLocalizedString: (key: string) => string;\r\n\r\n constructor(props: LocalizationHelperProps) {\r\n this._getLocalizedString = props.getLocalizedString;\r\n }\r\n\r\n public getLocalizedString(text: string) {\r\n return text.replace(KEY_PATTERN, (key) => this._getLocalizedString(key.replace(/^@|@$/g, \"\")));\r\n }\r\n\r\n /* eslint-disable @typescript-eslint/no-deprecated */\r\n public getLocalizedNodes(nodes: Node[]): Node[] {\r\n return nodes.map((n) => this.getLocalizedNode(n));\r\n }\r\n\r\n public getLocalizedNode(node: Node): Node {\r\n return {\r\n ...node,\r\n label: this.getLocalizedLabelDefinition(node.label),\r\n ...(node.description ? { description: this.getLocalizedString(node.description) } : undefined),\r\n };\r\n }\r\n\r\n public getLocalizedNodePathElement(npe: NodePathElement): NodePathElement {\r\n return {\r\n ...npe,\r\n node: this.getLocalizedNode(npe.node),\r\n children: npe.children.map((c) => this.getLocalizedNodePathElement(c)),\r\n };\r\n }\r\n /* eslint-enable @typescript-eslint/no-deprecated */\r\n\r\n public getLocalizedDisplayValueGroup(group: DisplayValueGroup): DisplayValueGroup {\r\n return {\r\n ...group,\r\n displayValue: this.getLocalizedDisplayValue(group.displayValue),\r\n };\r\n }\r\n\r\n public getLocalizedLabelDefinition(labelDefinition: LabelDefinition): LabelDefinition {\r\n const getLocalizedComposite = (compositeValue: LabelCompositeValue) => ({\r\n ...compositeValue,\r\n values: compositeValue.values.map((value) => this.getLocalizedLabelDefinition(value)),\r\n });\r\n\r\n if (labelDefinition.typeName === COMPOSITE_LABEL_DEFINITION_TYPENAME) {\r\n return {\r\n ...labelDefinition,\r\n rawValue: getLocalizedComposite(labelDefinition.rawValue as LabelCompositeValue),\r\n };\r\n }\r\n if (labelDefinition.typeName === \"string\") {\r\n return {\r\n ...labelDefinition,\r\n rawValue: this.getLocalizedString(labelDefinition.rawValue as string),\r\n displayValue: this.getLocalizedString(labelDefinition.displayValue),\r\n };\r\n }\r\n return labelDefinition;\r\n }\r\n\r\n public getLocalizedLabelDefinitions(labelDefinitions: LabelDefinition[]) {\r\n return labelDefinitions.map((labelDefinition) => this.getLocalizedLabelDefinition(labelDefinition));\r\n }\r\n\r\n public getLocalizedContentDescriptor(descriptor: Descriptor) {\r\n const clone = new Descriptor(descriptor);\r\n clone.fields.forEach((field) => this.getLocalizedContentField(field));\r\n clone.categories.forEach((category) => this.getLocalizedCategoryDescription(category));\r\n return clone;\r\n }\r\n\r\n public getLocalizedContentItems(items: Item[]): Item[] {\r\n return items.map((item) => this.getLocalizedContentItem(item));\r\n }\r\n\r\n public getLocalizedContent(content: Content): Content {\r\n return new Content(this.getLocalizedContentDescriptor(content.descriptor), this.getLocalizedContentItems(content.contentSet));\r\n }\r\n\r\n public getLocalizedElementProperties(elem: ElementProperties): ElementProperties {\r\n return {\r\n ...elem,\r\n label: this.getLocalizedString(elem.label),\r\n };\r\n }\r\n\r\n // warning: this function mutates the item\r\n private getLocalizedContentItem(item: Item): Item {\r\n item.label = this.getLocalizedLabelDefinition(item.label);\r\n item.values = Object.entries(item.values).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {});\r\n item.displayValues = Object.entries(item.displayValues).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {});\r\n return item;\r\n }\r\n\r\n private getLocalizedRawValue(value: Value): Value {\r\n if (typeof value === \"string\") {\r\n return this.getLocalizedString(value);\r\n }\r\n if (Value.isNavigationValue(value)) {\r\n return {\r\n ...value,\r\n label: this.getLocalizedLabelDefinition(value.label),\r\n };\r\n }\r\n if (Value.isNestedContent(value)) {\r\n return value.map((item) => ({\r\n ...item,\r\n values: Object.entries(item.values).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {}),\r\n displayValues: Object.entries(item.displayValues).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {}),\r\n }));\r\n }\r\n if (Value.isArray(value)) {\r\n return value.map((v) => this.getLocalizedRawValue(v));\r\n }\r\n if (Value.isMap(value)) {\r\n return Object.entries(value).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {});\r\n }\r\n return value;\r\n }\r\n\r\n // warning: this function mutates the field\r\n private getLocalizedContentField<TField extends Field>(field: TField) {\r\n field.label = this.getLocalizedString(field.label);\r\n if (field.isPropertiesField()) {\r\n if (field.isStructPropertiesField()) {\r\n field.memberFields = field.memberFields.map((m) => this.getLocalizedContentField(m));\r\n } else if (field.isArrayPropertiesField()) {\r\n field.itemsField = this.getLocalizedContentField(field.itemsField);\r\n }\r\n } else if (field.isNestedContentField()) {\r\n field.nestedFields = field.nestedFields.map((m) => this.getLocalizedContentField(m));\r\n }\r\n return field;\r\n }\r\n\r\n // warning: this function mutates the category\r\n private getLocalizedCategoryDescription(category: CategoryDescription) {\r\n category.label = this.getLocalizedString(category.label);\r\n category.description = this.getLocalizedString(category.description);\r\n return category;\r\n }\r\n\r\n private getLocalizedDisplayValue(value: DisplayValue): DisplayValue {\r\n if (typeof value === \"undefined\") {\r\n return undefined;\r\n }\r\n if (typeof value === \"string\") {\r\n return this.getLocalizedString(value);\r\n }\r\n if (DisplayValue.isArray(value)) {\r\n return value.map((v) => this.getLocalizedDisplayValue(v));\r\n }\r\n return Object.entries(value).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {});\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationIpcInterface.js","sourceRoot":"","sources":["../../../src/presentation-common/PresentationIpcInterface.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAIH,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B,GAAG,oCAAoC,CAAC;AAyBlF,gBAAgB;AAChB,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B;;OAEG;IACH,yDAAgC,CAAA;AAClC,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { RulesetVariableJSON } from \"./RulesetVariables.js\";\n\n/** @internal */\nexport const PRESENTATION_IPC_CHANNEL_NAME = \"itwinjs-presentation/ipc-interface\";\n\ninterface CommonIpcParams {\n clientId: string;\n}\n\ninterface SetRulesetVariableParams<TVariable> extends CommonIpcParams {\n rulesetId: string;\n variable: TVariable;\n}\n\ninterface UnsetRulesetVariableParams extends CommonIpcParams {\n rulesetId: string;\n variableId: string;\n}\n\n/** @internal */\nexport interface PresentationIpcInterface {\n /** Sets ruleset variable value. */\n setRulesetVariable(params: SetRulesetVariableParams<RulesetVariableJSON>): Promise<void>;\n\n /** Unsets ruleset variable value. */\n unsetRulesetVariable(params: UnsetRulesetVariableParams): Promise<void>;\n}\n\n/** @internal */\nexport enum PresentationIpcEvents {\n /**\n * ID of an event that's emitted when backend detects changes in presented data.\n */\n Update = \"presentation.onUpdate\",\n}\n"]}
1
+ {"version":3,"file":"PresentationIpcInterface.js","sourceRoot":"","sources":["../../../src/presentation-common/PresentationIpcInterface.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAIH,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B,GAAG,oCAAoC,CAAC;AAyBlF,gBAAgB;AAChB,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B;;OAEG;IACH,yDAAgC,CAAA;AAClC,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC","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 Core\r\n */\r\n\r\nimport { RulesetVariableJSON } from \"./RulesetVariables.js\";\r\n\r\n/** @internal */\r\nexport const PRESENTATION_IPC_CHANNEL_NAME = \"itwinjs-presentation/ipc-interface\";\r\n\r\ninterface CommonIpcParams {\r\n clientId: string;\r\n}\r\n\r\ninterface SetRulesetVariableParams<TVariable> extends CommonIpcParams {\r\n rulesetId: string;\r\n variable: TVariable;\r\n}\r\n\r\ninterface UnsetRulesetVariableParams extends CommonIpcParams {\r\n rulesetId: string;\r\n variableId: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface PresentationIpcInterface {\r\n /** Sets ruleset variable value. */\r\n setRulesetVariable(params: SetRulesetVariableParams<RulesetVariableJSON>): Promise<void>;\r\n\r\n /** Unsets ruleset variable value. */\r\n unsetRulesetVariable(params: UnsetRulesetVariableParams): Promise<void>;\r\n}\r\n\r\n/** @internal */\r\nexport enum PresentationIpcEvents {\r\n /**\r\n * ID of an event that's emitted when backend detects changes in presented data.\r\n */\r\n Update = \"presentation.onUpdate\",\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationManagerOptions.js","sourceRoot":"","sources":["../../../src/presentation-common/PresentationManagerOptions.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAiWH;;;GAGG;AACH,MAAM,UAAU,uCAAuC,CACrD,OAAuH;IAEvH,OAAQ,OAA0D,CAAC,SAAS,KAAK,SAAS,CAAC;AAC7F,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { BeEvent, Id64String } from \"@itwin/core-bentley\";\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\nimport { Descriptor, SelectionInfo } from \"./content/Descriptor.js\";\nimport { FieldDescriptor } from \"./content/Fields.js\";\nimport { Item } from \"./content/Item.js\";\nimport { InstanceKey } from \"./EC.js\";\nimport { ElementProperties } from \"./ElementProperties.js\";\nimport { InstanceFilterDefinition } from \"./InstanceFilterDefinition.js\";\nimport { Ruleset } from \"./rules/Ruleset.js\";\nimport { RulesetVariable } from \"./RulesetVariables.js\";\nimport { SelectionScopeProps } from \"./selection/SelectionScope.js\";\n\n/**\n * A generic request options type used for both hierarchy and content requests.\n * @public\n */\nexport interface RequestOptions<TIModel> {\n /** iModel to request data from */\n imodel: TIModel;\n\n /** Optional locale to use when formatting / localizing data */\n locale?: string;\n\n /**\n * Unit system to use when formatting property values with units. Default presentation\n * unit is used if unit system is not specified.\n */\n unitSystem?: UnitSystemKey;\n}\n\n/**\n * Options for requests that require presentation ruleset. Not\n * meant to be used directly, see one of the subclasses.\n *\n * @public\n */\nexport interface RequestOptionsWithRuleset<TIModel, TRulesetVariable = RulesetVariable> extends RequestOptions<TIModel> {\n /** Ruleset or id of the ruleset to use when requesting data */\n rulesetOrId: Ruleset | string;\n\n /** Ruleset variables to use when requesting data */\n rulesetVariables?: TRulesetVariable[];\n}\n\n/**\n * Request type for hierarchy requests.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport interface HierarchyRequestOptions<TIModel, TNodeKey, TRulesetVariable = RulesetVariable> extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\n /** Key of the parent node to get children for */\n parentKey?: TNodeKey;\n\n /**\n * An instance filter that should be applied for this hierarchy level.\n *\n * **Note:** May only be used on hierarchy levels that support filtering - check [[NavNode.supportsFiltering]] before\n * requesting filtered children.\n */\n instanceFilter?: InstanceFilterDefinition;\n\n /**\n * A limit to how many instances at most should be loaded for a hierarchy level. If the limit is exceeded,\n * the request fails with [[PresentationError]] having [[PresentationStatus.ResultSetTooLarge]] error number.\n *\n * Specifying the limit is useful when creating unlimited size result sets is not meaningful - this allows the library\n * to return early as soon as the limit is reached, instead of creating a very large result that's possibly too large to\n * be useful to be displayed to end users.\n *\n * @see [Hierarchies' filtering and limiting]($docs/presentation/hierarchies/FilteringLimiting.md)\n */\n sizeLimit?: number;\n}\n\n/**\n * Params for hierarchy level descriptor requests.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport interface HierarchyLevelDescriptorRequestOptions<TIModel, TNodeKey, TRulesetVariable = RulesetVariable>\n extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\n /** Key of the parent node to get hierarchy level descriptor for. */\n parentKey?: TNodeKey;\n}\n\n/**\n * Request type of filtering hierarchies by given ECInstance paths.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport interface FilterByInstancePathsHierarchyRequestOptions<TIModel, TRulesetVariable = RulesetVariable>\n extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\n /** A list of paths from root ECInstance to target ECInstance. */\n instancePaths: InstanceKey[][];\n\n /**\n * An optional index (`0 <= markedIndex < instancePaths.length`) to mark one of the instance paths. The\n * path is marked using `NodePathElement.isMarked` flag in the result.\n */\n markedIndex?: number;\n}\n\n/**\n * Request type of filtering hierarchies by given text.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport interface FilterByTextHierarchyRequestOptions<TIModel, TRulesetVariable = RulesetVariable> extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\n /** Text to filter the hierarchy by. */\n filterText: string;\n}\n\n/**\n * Request type for content sources requests.\n * @public\n */\nexport interface ContentSourcesRequestOptions<TIModel> extends RequestOptions<TIModel> {\n /** Full names of classes to get content sources for. Format for a full class name: `SchemaName:ClassName`. */\n classes: string[];\n}\n\n/**\n * Request type for content descriptor requests.\n * @public\n */\nexport interface ContentDescriptorRequestOptions<TIModel, TKeySet, TRulesetVariable = RulesetVariable>\n extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\n /**\n * Content display type.\n * @see [[DefaultContentDisplayTypes]]\n */\n displayType: string;\n /**\n * Content flags used for content customization.\n * @see [[ContentFlags]]\n */\n contentFlags?: number;\n /** Input keys for getting the content */\n keys: TKeySet;\n /** Information about the selection event that was the cause of this content request */\n selection?: SelectionInfo;\n}\n\n/**\n * Request type for content requests.\n * @public\n */\nexport interface ContentRequestOptions<TIModel, TDescriptor, TKeySet, TRulesetVariable = RulesetVariable>\n extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\n /** Content descriptor for customizing the returned content */\n descriptor: TDescriptor;\n /** Input keys for getting the content */\n keys: TKeySet;\n /**\n * Flag that specifies whether value formatting should be omitted or not.\n * Content is returned without `displayValues` when this is set to `true`.\n */\n omitFormattedValues?: boolean;\n}\n\n/**\n * Request type for distinct values' requests.\n * @public\n */\nexport interface DistinctValuesRequestOptions<TIModel, TDescriptor, TKeySet, TRulesetVariable = RulesetVariable>\n extends Paged<RequestOptionsWithRuleset<TIModel, TRulesetVariable>> {\n /** Content descriptor for customizing the returned content */\n descriptor: TDescriptor;\n /** Input keys for getting the content */\n keys: TKeySet;\n /** Descriptor for a field distinct values are requested for */\n fieldDescriptor: FieldDescriptor;\n}\n\n/**\n * Request type for element properties requests\n * @public\n * @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Use [[SingleElementPropertiesRequestOptions]] or [[MultiElementPropertiesRequestOptions]] directly.\n */\nexport type ElementPropertiesRequestOptions<TIModel, TParsedContent = ElementProperties> =\n | SingleElementPropertiesRequestOptions<TIModel>\n | MultiElementPropertiesRequestOptions<TIModel, TParsedContent>;\n\n/**\n * Request type for single element properties requests.\n * @public\n */\nexport interface SingleElementPropertiesRequestOptions<TIModel, TParsedContent = ElementProperties> extends RequestOptions<TIModel> {\n /** ID of the element to get properties for. */\n elementId: Id64String;\n\n /**\n * Content parser that creates a result item based on given content descriptor and content item. Defaults\n * to a parser that creates [[ElementProperties]] objects.\n */\n contentParser?: (descriptor: Descriptor, item: Item) => TParsedContent;\n}\n\n/**\n * Base request type for multiple elements properties requests.\n * @public\n */\nexport interface MultiElementPropertiesBaseRequestOptions<TIModel, TParsedContent = ElementProperties> extends RequestOptions<TIModel> {\n /**\n * Content parser that creates a result item based on given content descriptor and content item. Defaults\n * to a parser that creates [[ElementProperties]] objects.\n */\n contentParser?: (descriptor: Descriptor, item: Item) => TParsedContent;\n\n /**\n * The properties of multiple elements are going to be retrieved and returned in batches. Depending on the batch\n * size load on CPU vs MEMORY load may vary, so changing this attribute allows to fine tune the performance.\n * Defaults to `1000`.\n */\n batchSize?: number;\n}\n/**\n * Request type for multiple elements properties requests, where elements are specified by class.\n * @public\n */\nexport interface MultiElementPropertiesByClassRequestOptions<TIModel, TParsedContent = ElementProperties>\n extends MultiElementPropertiesBaseRequestOptions<TIModel, TParsedContent> {\n /**\n * Classes of the elements to get properties for. If [[elementClasses]] is `undefined`, all classes\n * are used. Classes should be specified in one of these formats: \"<schema name or alias>.<class_name>\" or\n * \"<schema name or alias>:<class_name>\".\n */\n elementClasses?: string[];\n}\n/**\n * Request type for multiple elements properties requests, where elements are specified by element id.\n * @public\n */\nexport interface MultiElementPropertiesByIdsRequestOptions<TIModel, TParsedContent = ElementProperties>\n extends MultiElementPropertiesBaseRequestOptions<TIModel, TParsedContent> {\n /**\n * A list of `bis.Element` IDs to get properties for.\n */\n elementIds?: Id64String[];\n}\n/**\n * Request type for multiple elements properties requests.\n * @public\n */\nexport type MultiElementPropertiesRequestOptions<TIModel, TParsedContent = ElementProperties> =\n | MultiElementPropertiesByClassRequestOptions<TIModel, TParsedContent>\n | MultiElementPropertiesByIdsRequestOptions<TIModel, TParsedContent>;\n\n/**\n * Request type for content instance keys' requests.\n * @public\n */\nexport interface ContentInstanceKeysRequestOptions<TIModel, TKeySet, TRulesetVariable = RulesetVariable>\n extends Paged<RequestOptionsWithRuleset<TIModel, TRulesetVariable>> {\n /**\n * Content display type.\n * @see [[DefaultContentDisplayTypes]]\n */\n displayType?: string;\n /** Input keys for getting the content. */\n keys: TKeySet;\n}\n\n/**\n * Request type for label requests\n * @public\n */\nexport interface DisplayLabelRequestOptions<TIModel, TInstanceKey> extends RequestOptions<TIModel> {\n /** Key of ECInstance to get label for */\n key: TInstanceKey;\n}\n\n/**\n * Request type for labels requests\n * @public\n */\nexport interface DisplayLabelsRequestOptions<TIModel, TInstanceKey> extends RequestOptions<TIModel> {\n /** Keys of ECInstances to get labels for */\n keys: TInstanceKey[];\n}\n\n/**\n * Request options used for selection scope related requests\n * @public\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\nexport interface SelectionScopeRequestOptions<TIModel> extends RequestOptions<TIModel> {} // eslint-disable-line @typescript-eslint/no-empty-object-type\n\n/**\n * Request options used for calculating selection based on given instance keys and selection scope.\n * @public\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\nexport interface ComputeSelectionRequestOptions<TIModel> extends RequestOptions<TIModel> {\n elementIds: Id64String[];\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n scope: SelectionScopeProps;\n}\n\n/**\n * Data structure for comparing a hierarchy after ruleset or ruleset variable changes.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport interface HierarchyCompareOptions<TIModel, TNodeKey, TRulesetVariable = RulesetVariable> extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\n prev: {\n rulesetOrId?: Ruleset | string;\n rulesetVariables?: TRulesetVariable[];\n };\n expandedNodeKeys?: TNodeKey[];\n continuationToken?: {\n prevHierarchyNode: string;\n currHierarchyNode: string;\n };\n resultSetSize?: number;\n}\n\n/**\n * Paging options\n * @public\n */\nexport interface PageOptions {\n /** Inclusive start 0-based index of the page */\n start?: number;\n /** Maximum size of the page */\n size?: number;\n}\n\n/**\n * A wrapper type that injects [[PageOptions]] into supplied type\n * @public\n */\nexport type Paged<TOptions extends object> = TOptions & {\n /** Optional paging parameters */\n paging?: PageOptions;\n};\n\n/**\n * A wrapper type that injects priority into supplied type.\n * @public\n */\nexport type Prioritized<TOptions extends object> = TOptions & {\n /** Optional priority */\n priority?: number;\n};\n\n/**\n * Checks if supplied request options are for single or multiple element properties.\n * @internal\n */\nexport function isSingleElementPropertiesRequestOptions<TIModel, TParsedContent = any>(\n options: SingleElementPropertiesRequestOptions<TIModel> | MultiElementPropertiesRequestOptions<TIModel, TParsedContent>,\n): options is SingleElementPropertiesRequestOptions<TIModel> {\n return (options as SingleElementPropertiesRequestOptions<TIModel>).elementId !== undefined;\n}\n\n/**\n * A wrapper type that injects cancelEvent into supplied type.\n * @public\n */\nexport type WithCancelEvent<TOptions extends object> = TOptions & {\n /** Event which is triggered when the request is canceled */\n cancelEvent?: BeEvent<() => void>;\n};\n"]}
1
+ {"version":3,"file":"PresentationManagerOptions.js","sourceRoot":"","sources":["../../../src/presentation-common/PresentationManagerOptions.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAiWH;;;GAGG;AACH,MAAM,UAAU,uCAAuC,CACrD,OAAuH;IAEvH,OAAQ,OAA0D,CAAC,SAAS,KAAK,SAAS,CAAC;AAC7F,CAAC","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 Core\r\n */\r\n\r\nimport { BeEvent, Id64String } from \"@itwin/core-bentley\";\r\nimport { UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport { Descriptor, SelectionInfo } from \"./content/Descriptor.js\";\r\nimport { FieldDescriptor } from \"./content/Fields.js\";\r\nimport { Item } from \"./content/Item.js\";\r\nimport { InstanceKey } from \"./EC.js\";\r\nimport { ElementProperties } from \"./ElementProperties.js\";\r\nimport { InstanceFilterDefinition } from \"./InstanceFilterDefinition.js\";\r\nimport { Ruleset } from \"./rules/Ruleset.js\";\r\nimport { RulesetVariable } from \"./RulesetVariables.js\";\r\nimport { SelectionScopeProps } from \"./selection/SelectionScope.js\";\r\n\r\n/**\r\n * A generic request options type used for both hierarchy and content requests.\r\n * @public\r\n */\r\nexport interface RequestOptions<TIModel> {\r\n /** iModel to request data from */\r\n imodel: TIModel;\r\n\r\n /** Optional locale to use when formatting / localizing data */\r\n locale?: string;\r\n\r\n /**\r\n * Unit system to use when formatting property values with units. Default presentation\r\n * unit is used if unit system is not specified.\r\n */\r\n unitSystem?: UnitSystemKey;\r\n}\r\n\r\n/**\r\n * Options for requests that require presentation ruleset. Not\r\n * meant to be used directly, see one of the subclasses.\r\n *\r\n * @public\r\n */\r\nexport interface RequestOptionsWithRuleset<TIModel, TRulesetVariable = RulesetVariable> extends RequestOptions<TIModel> {\r\n /** Ruleset or id of the ruleset to use when requesting data */\r\n rulesetOrId: Ruleset | string;\r\n\r\n /** Ruleset variables to use when requesting data */\r\n rulesetVariables?: TRulesetVariable[];\r\n}\r\n\r\n/**\r\n * Request type for hierarchy requests.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport interface HierarchyRequestOptions<TIModel, TNodeKey, TRulesetVariable = RulesetVariable> extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\r\n /** Key of the parent node to get children for */\r\n parentKey?: TNodeKey;\r\n\r\n /**\r\n * An instance filter that should be applied for this hierarchy level.\r\n *\r\n * **Note:** May only be used on hierarchy levels that support filtering - check [[NavNode.supportsFiltering]] before\r\n * requesting filtered children.\r\n */\r\n instanceFilter?: InstanceFilterDefinition;\r\n\r\n /**\r\n * A limit to how many instances at most should be loaded for a hierarchy level. If the limit is exceeded,\r\n * the request fails with [[PresentationError]] having [[PresentationStatus.ResultSetTooLarge]] error number.\r\n *\r\n * Specifying the limit is useful when creating unlimited size result sets is not meaningful - this allows the library\r\n * to return early as soon as the limit is reached, instead of creating a very large result that's possibly too large to\r\n * be useful to be displayed to end users.\r\n *\r\n * @see [Hierarchies' filtering and limiting]($docs/presentation/hierarchies/FilteringLimiting.md)\r\n */\r\n sizeLimit?: number;\r\n}\r\n\r\n/**\r\n * Params for hierarchy level descriptor requests.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport interface HierarchyLevelDescriptorRequestOptions<TIModel, TNodeKey, TRulesetVariable = RulesetVariable>\r\n extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\r\n /** Key of the parent node to get hierarchy level descriptor for. */\r\n parentKey?: TNodeKey;\r\n}\r\n\r\n/**\r\n * Request type of filtering hierarchies by given ECInstance paths.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport interface FilterByInstancePathsHierarchyRequestOptions<TIModel, TRulesetVariable = RulesetVariable>\r\n extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\r\n /** A list of paths from root ECInstance to target ECInstance. */\r\n instancePaths: InstanceKey[][];\r\n\r\n /**\r\n * An optional index (`0 <= markedIndex < instancePaths.length`) to mark one of the instance paths. The\r\n * path is marked using `NodePathElement.isMarked` flag in the result.\r\n */\r\n markedIndex?: number;\r\n}\r\n\r\n/**\r\n * Request type of filtering hierarchies by given text.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport interface FilterByTextHierarchyRequestOptions<TIModel, TRulesetVariable = RulesetVariable> extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\r\n /** Text to filter the hierarchy by. */\r\n filterText: string;\r\n}\r\n\r\n/**\r\n * Request type for content sources requests.\r\n * @public\r\n */\r\nexport interface ContentSourcesRequestOptions<TIModel> extends RequestOptions<TIModel> {\r\n /** Full names of classes to get content sources for. Format for a full class name: `SchemaName:ClassName`. */\r\n classes: string[];\r\n}\r\n\r\n/**\r\n * Request type for content descriptor requests.\r\n * @public\r\n */\r\nexport interface ContentDescriptorRequestOptions<TIModel, TKeySet, TRulesetVariable = RulesetVariable>\r\n extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\r\n /**\r\n * Content display type.\r\n * @see [[DefaultContentDisplayTypes]]\r\n */\r\n displayType: string;\r\n /**\r\n * Content flags used for content customization.\r\n * @see [[ContentFlags]]\r\n */\r\n contentFlags?: number;\r\n /** Input keys for getting the content */\r\n keys: TKeySet;\r\n /** Information about the selection event that was the cause of this content request */\r\n selection?: SelectionInfo;\r\n}\r\n\r\n/**\r\n * Request type for content requests.\r\n * @public\r\n */\r\nexport interface ContentRequestOptions<TIModel, TDescriptor, TKeySet, TRulesetVariable = RulesetVariable>\r\n extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\r\n /** Content descriptor for customizing the returned content */\r\n descriptor: TDescriptor;\r\n /** Input keys for getting the content */\r\n keys: TKeySet;\r\n /**\r\n * Flag that specifies whether value formatting should be omitted or not.\r\n * Content is returned without `displayValues` when this is set to `true`.\r\n */\r\n omitFormattedValues?: boolean;\r\n}\r\n\r\n/**\r\n * Request type for distinct values' requests.\r\n * @public\r\n */\r\nexport interface DistinctValuesRequestOptions<TIModel, TDescriptor, TKeySet, TRulesetVariable = RulesetVariable>\r\n extends Paged<RequestOptionsWithRuleset<TIModel, TRulesetVariable>> {\r\n /** Content descriptor for customizing the returned content */\r\n descriptor: TDescriptor;\r\n /** Input keys for getting the content */\r\n keys: TKeySet;\r\n /** Descriptor for a field distinct values are requested for */\r\n fieldDescriptor: FieldDescriptor;\r\n}\r\n\r\n/**\r\n * Request type for element properties requests\r\n * @public\r\n * @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Use [[SingleElementPropertiesRequestOptions]] or [[MultiElementPropertiesRequestOptions]] directly.\r\n */\r\nexport type ElementPropertiesRequestOptions<TIModel, TParsedContent = ElementProperties> =\r\n | SingleElementPropertiesRequestOptions<TIModel>\r\n | MultiElementPropertiesRequestOptions<TIModel, TParsedContent>;\r\n\r\n/**\r\n * Request type for single element properties requests.\r\n * @public\r\n */\r\nexport interface SingleElementPropertiesRequestOptions<TIModel, TParsedContent = ElementProperties> extends RequestOptions<TIModel> {\r\n /** ID of the element to get properties for. */\r\n elementId: Id64String;\r\n\r\n /**\r\n * Content parser that creates a result item based on given content descriptor and content item. Defaults\r\n * to a parser that creates [[ElementProperties]] objects.\r\n */\r\n contentParser?: (descriptor: Descriptor, item: Item) => TParsedContent;\r\n}\r\n\r\n/**\r\n * Base request type for multiple elements properties requests.\r\n * @public\r\n */\r\nexport interface MultiElementPropertiesBaseRequestOptions<TIModel, TParsedContent = ElementProperties> extends RequestOptions<TIModel> {\r\n /**\r\n * Content parser that creates a result item based on given content descriptor and content item. Defaults\r\n * to a parser that creates [[ElementProperties]] objects.\r\n */\r\n contentParser?: (descriptor: Descriptor, item: Item) => TParsedContent;\r\n\r\n /**\r\n * The properties of multiple elements are going to be retrieved and returned in batches. Depending on the batch\r\n * size load on CPU vs MEMORY load may vary, so changing this attribute allows to fine tune the performance.\r\n * Defaults to `1000`.\r\n */\r\n batchSize?: number;\r\n}\r\n/**\r\n * Request type for multiple elements properties requests, where elements are specified by class.\r\n * @public\r\n */\r\nexport interface MultiElementPropertiesByClassRequestOptions<TIModel, TParsedContent = ElementProperties>\r\n extends MultiElementPropertiesBaseRequestOptions<TIModel, TParsedContent> {\r\n /**\r\n * Classes of the elements to get properties for. If [[elementClasses]] is `undefined`, all classes\r\n * are used. Classes should be specified in one of these formats: \"<schema name or alias>.<class_name>\" or\r\n * \"<schema name or alias>:<class_name>\".\r\n */\r\n elementClasses?: string[];\r\n}\r\n/**\r\n * Request type for multiple elements properties requests, where elements are specified by element id.\r\n * @public\r\n */\r\nexport interface MultiElementPropertiesByIdsRequestOptions<TIModel, TParsedContent = ElementProperties>\r\n extends MultiElementPropertiesBaseRequestOptions<TIModel, TParsedContent> {\r\n /**\r\n * A list of `bis.Element` IDs to get properties for.\r\n */\r\n elementIds?: Id64String[];\r\n}\r\n/**\r\n * Request type for multiple elements properties requests.\r\n * @public\r\n */\r\nexport type MultiElementPropertiesRequestOptions<TIModel, TParsedContent = ElementProperties> =\r\n | MultiElementPropertiesByClassRequestOptions<TIModel, TParsedContent>\r\n | MultiElementPropertiesByIdsRequestOptions<TIModel, TParsedContent>;\r\n\r\n/**\r\n * Request type for content instance keys' requests.\r\n * @public\r\n */\r\nexport interface ContentInstanceKeysRequestOptions<TIModel, TKeySet, TRulesetVariable = RulesetVariable>\r\n extends Paged<RequestOptionsWithRuleset<TIModel, TRulesetVariable>> {\r\n /**\r\n * Content display type.\r\n * @see [[DefaultContentDisplayTypes]]\r\n */\r\n displayType?: string;\r\n /** Input keys for getting the content. */\r\n keys: TKeySet;\r\n}\r\n\r\n/**\r\n * Request type for label requests\r\n * @public\r\n */\r\nexport interface DisplayLabelRequestOptions<TIModel, TInstanceKey> extends RequestOptions<TIModel> {\r\n /** Key of ECInstance to get label for */\r\n key: TInstanceKey;\r\n}\r\n\r\n/**\r\n * Request type for labels requests\r\n * @public\r\n */\r\nexport interface DisplayLabelsRequestOptions<TIModel, TInstanceKey> extends RequestOptions<TIModel> {\r\n /** Keys of ECInstances to get labels for */\r\n keys: TInstanceKey[];\r\n}\r\n\r\n/**\r\n * Request options used for selection scope related requests\r\n * @public\r\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\r\n */\r\nexport interface SelectionScopeRequestOptions<TIModel> extends RequestOptions<TIModel> {} // eslint-disable-line @typescript-eslint/no-empty-object-type\r\n\r\n/**\r\n * Request options used for calculating selection based on given instance keys and selection scope.\r\n * @public\r\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\r\n */\r\nexport interface ComputeSelectionRequestOptions<TIModel> extends RequestOptions<TIModel> {\r\n elementIds: Id64String[];\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n scope: SelectionScopeProps;\r\n}\r\n\r\n/**\r\n * Data structure for comparing a hierarchy after ruleset or ruleset variable changes.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport interface HierarchyCompareOptions<TIModel, TNodeKey, TRulesetVariable = RulesetVariable> extends RequestOptionsWithRuleset<TIModel, TRulesetVariable> {\r\n prev: {\r\n rulesetOrId?: Ruleset | string;\r\n rulesetVariables?: TRulesetVariable[];\r\n };\r\n expandedNodeKeys?: TNodeKey[];\r\n continuationToken?: {\r\n prevHierarchyNode: string;\r\n currHierarchyNode: string;\r\n };\r\n resultSetSize?: number;\r\n}\r\n\r\n/**\r\n * Paging options\r\n * @public\r\n */\r\nexport interface PageOptions {\r\n /** Inclusive start 0-based index of the page */\r\n start?: number;\r\n /** Maximum size of the page */\r\n size?: number;\r\n}\r\n\r\n/**\r\n * A wrapper type that injects [[PageOptions]] into supplied type\r\n * @public\r\n */\r\nexport type Paged<TOptions extends object> = TOptions & {\r\n /** Optional paging parameters */\r\n paging?: PageOptions;\r\n};\r\n\r\n/**\r\n * A wrapper type that injects priority into supplied type.\r\n * @public\r\n */\r\nexport type Prioritized<TOptions extends object> = TOptions & {\r\n /** Optional priority */\r\n priority?: number;\r\n};\r\n\r\n/**\r\n * Checks if supplied request options are for single or multiple element properties.\r\n * @internal\r\n */\r\nexport function isSingleElementPropertiesRequestOptions<TIModel, TParsedContent = any>(\r\n options: SingleElementPropertiesRequestOptions<TIModel> | MultiElementPropertiesRequestOptions<TIModel, TParsedContent>,\r\n): options is SingleElementPropertiesRequestOptions<TIModel> {\r\n return (options as SingleElementPropertiesRequestOptions<TIModel>).elementId !== undefined;\r\n}\r\n\r\n/**\r\n * A wrapper type that injects cancelEvent into supplied type.\r\n * @public\r\n */\r\nexport type WithCancelEvent<TOptions extends object> = TOptions & {\r\n /** Event which is triggered when the request is canceled */\r\n cancelEvent?: BeEvent<() => void>;\r\n};\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationRpcInterface.js","sourceRoot":"","sources":["../../../src/presentation-common/PresentationRpcInterface.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;;;;;;;AAGH,OAAO,EAAkB,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAgChF,OAAO,EAAE,2BAA2B,EAAuB,MAAM,YAAY,CAAC;AAwJ9E;;;GAGG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,YAAY;IACxD,2CAA2C;IACpC,MAAM,CAAU,aAAa,GAAG,0BAA0B,CAAC;IAElE,6CAA6C;IACtC,MAAM,CAAC,gBAAgB,GAAG,OAAO,CAAC;IAEzC;;;iGAG6F;IAE7F,yKAAyK;IAClK,KAAK,CAAC,aAAa,CAAC,MAAsB,EAAE,QAAoC;QACrF,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,aAAa,CAAC,MAAsB,EAAE,QAA2C;QAC5F,OAAO,2BAA2B,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,kBAAkB,CAC7B,MAAsB,EACtB,QAAmD;QAEnD,OAAO,2BAA2B,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,C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O,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,gBAAgB,CAAC,MAAsB,EAAE,QAA2C;QAC/F,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;;AA7HU,wBAAwB;IADpC,YAAY,CAAC,gBAAgB,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;GAC7C,wBAAwB,CA8HpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/* eslint-disable @typescript-eslint/no-deprecated */\n/** @packageDocumentation\n * @module RPC\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { IModelRpcProps, RpcInterface, RpcOperation } from \"@itwin/core-common\";\nimport { DescriptorJSON, DescriptorOverrides, SelectClassInfoJSON } from \"./content/Descriptor.js\";\nimport { ItemJSON } from \"./content/Item.js\";\nimport { DisplayValueGroup } from \"./content/Value.js\";\nimport { ClientDiagnostics, ClientDiagnosticsOptions } from \"./Diagnostics.js\";\nimport { CompressedClassInfoJSON, InstanceKey } from \"./EC.js\";\nimport { ElementProperties } from \"./ElementProperties.js\";\nimport { PresentationStatus } from \"./Error.js\";\nimport { NodeKey } from \"./hierarchy/Key.js\";\nimport { Node } from \"./hierarchy/Node.js\";\nimport { NodePathElement } from \"./hierarchy/NodePathElement.js\";\nimport { KeySetJSON } from \"./KeySet.js\";\nimport { LabelDefinition } from \"./LabelDefinition.js\";\nimport {\n ComputeSelectionRequestOptions,\n ContentDescriptorRequestOptions,\n ContentInstanceKeysRequestOptions,\n ContentRequestOptions,\n ContentSourcesRequestOptions,\n DisplayLabelRequestOptions,\n DisplayLabelsRequestOptions,\n DistinctValuesRequestOptions,\n FilterByInstancePathsHierarchyRequestOptions,\n FilterByTextHierarchyRequestOptions,\n HierarchyLevelDescriptorRequestOptions,\n HierarchyRequestOptions,\n Paged,\n SelectionScopeRequestOptions,\n SingleElementPropertiesRequestOptions,\n} from \"./PresentationManagerOptions.js\";\nimport { RulesetVariableJSON } from \"./RulesetVariables.js\";\nimport { SelectionScope } from \"./selection/SelectionScope.js\";\nimport { deepReplaceNullsToUndefined, Omit, PagedResponse } from \"./Utils.js\";\n\n/**\n * Base options for all presentation RPC requests.\n * @public\n */\nexport type PresentationRpcRequestOptions<TManagerRequestOptions> = Omit<TManagerRequestOptions, \"imodel\" | \"diagnostics\"> & {\n /** @internal ID of the client requesting data */\n clientId?: string;\n /** RPC request diagnostics options. */\n diagnostics?: RpcDiagnosticsOptions;\n};\n\n/**\n * Data structure for presentation RPC responses\n * @public\n */\nexport interface PresentationRpcResponseData<TResult = undefined> {\n /** Response status code */\n statusCode: PresentationStatus;\n /** In case of an error response, the error message */\n errorMessage?: string;\n /** In case of a success response, the result */\n result?: TResult;\n /** Diagnostics response. */\n diagnostics?: ClientDiagnostics;\n}\n\n/**\n * Data structure for RPC diagnostics options.\n * @public\n */\nexport type RpcDiagnosticsOptions = Omit<ClientDiagnosticsOptions, \"handler\">;\n\n/**\n * A promise of [[PresentationRpcResponseData]].\n * @public\n */\nexport type PresentationRpcResponse<TResult = undefined> = Promise<PresentationRpcResponseData<TResult>>;\n\n/**\n * Data structure for hierarchy request options.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport type HierarchyRpcRequestOptions = PresentationRpcRequestOptions<HierarchyRequestOptions<never, NodeKey, RulesetVariableJSON>>;\n\n/**\n * Data structure for hierarchy level descriptor RPC request options.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport type HierarchyLevelDescriptorRpcRequestOptions = PresentationRpcRequestOptions<\n HierarchyLevelDescriptorRequestOptions<never, NodeKey, RulesetVariableJSON>\n>;\n\n/**\n * Data structure for filtering hierarchy by ECInstance paths request options.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport type FilterByInstancePathsHierarchyRpcRequestOptions = PresentationRpcRequestOptions<\n FilterByInstancePathsHierarchyRequestOptions<never, RulesetVariableJSON>\n>;\n\n/**\n * Data structure for filtering hierarchy by text request options.\n * @public\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\n * package for creating hierarchies.\n */\nexport type FilterByTextHierarchyRpcRequestOptions = PresentationRpcRequestOptions<FilterByTextHierarchyRequestOptions<never, RulesetVariableJSON>>;\n\n/**\n * Data structure for content sources RPC request options.\n * @public\n */\nexport type ContentSourcesRpcRequestOptions = PresentationRpcRequestOptions<ContentSourcesRequestOptions<never>>;\n/**\n * Data structure for content sources RPC response.\n * @public\n */\nexport interface ContentSourcesRpcResult {\n /** A list of objects containing content source information. */\n sources: SelectClassInfoJSON<Id64String>[];\n /** An `ECClassId` => [[CompressedClassInfoJSON]] map for deserializing [[sources]]. */\n classesMap: { [id: string]: CompressedClassInfoJSON };\n}\n\n/**\n * Data structure for content descriptor RPC request options.\n * @public\n */\nexport type ContentDescriptorRpcRequestOptions = PresentationRpcRequestOptions<ContentDescriptorRequestOptions<never, KeySetJSON, RulesetVariableJSON>>;\n\n/**\n * Data structure for content RPC request options.\n * @public\n */\nexport type ContentRpcRequestOptions = PresentationRpcRequestOptions<ContentRequestOptions<never, DescriptorOverrides, KeySetJSON, RulesetVariableJSON>>;\n\n/**\n * Data structure for single element properties RPC request options.\n * @public\n */\nexport type SingleElementPropertiesRpcRequestOptions = PresentationRpcRequestOptions<\n Omit<SingleElementPropertiesRequestOptions<never, never>, \"contentParser\">\n>;\n\n/**\n * Data structure for distinct values' request options.\n * @public\n */\nexport type DistinctValuesRpcRequestOptions = PresentationRpcRequestOptions<\n DistinctValuesRequestOptions<never, DescriptorOverrides, KeySetJSON, RulesetVariableJSON>\n>;\n\n/**\n * Data structure for content instance keys' request options.\n * @public\n */\nexport type ContentInstanceKeysRpcRequestOptions = PresentationRpcRequestOptions<ContentInstanceKeysRequestOptions<never, KeySetJSON, RulesetVariableJSON>>;\n\n/**\n * Data structure for label request options.\n * @public\n */\nexport type DisplayLabelRpcRequestOptions = PresentationRpcRequestOptions<DisplayLabelRequestOptions<never, InstanceKey>>;\n\n/**\n * Data structure for labels request options.\n * @public\n */\nexport type DisplayLabelsRpcRequestOptions = PresentationRpcRequestOptions<DisplayLabelsRequestOptions<never, InstanceKey>>;\n\n/**\n * Data structure for selection scope request options.\n * @public\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\nexport type SelectionScopeRpcRequestOptions = PresentationRpcRequestOptions<SelectionScopeRequestOptions<never>>;\n\n/**\n * Request options data structure for computing selection based on given selection scope and element IDs.\n * @public\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\nexport type ComputeSelectionRpcRequestOptions = PresentationRpcRequestOptions<ComputeSelectionRequestOptions<never>>;\n\n/**\n * Interface used for communication between Presentation backend and frontend.\n * @public\n */\n@RpcOperation.setDefaultPolicy({ retryInterval: () => 0 })\nexport class PresentationRpcInterface extends RpcInterface {\n /** The immutable name of the interface. */\n public static readonly interfaceName = \"PresentationRpcInterface\";\n\n /** The semantic version of the interface. */\n public static interfaceVersion = \"5.0.0\";\n\n /*===========================================================================================\n NOTE: Any add/remove/change to the methods below requires an update of the interface version.\n NOTE: Please consult the README in core/common/src/rpc for the semantic versioning rules.\n ===========================================================================================*/\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getNodesCount(_token: IModelRpcProps, _options: HierarchyRpcRequestOptions): PresentationRpcResponse<number> {\n return this.forward(arguments);\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getPagedNodes(_token: IModelRpcProps, _options: Paged<HierarchyRpcRequestOptions>): PresentationRpcResponse<PagedResponse<Node>> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getNodesDescriptor(\n _token: IModelRpcProps,\n _options: HierarchyLevelDescriptorRpcRequestOptions,\n ): PresentationRpcResponse<string | DescriptorJSON | undefined> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n // TODO: add paged version of this (#387280)\n public async getNodePaths(_token: IModelRpcProps, _options: FilterByInstancePathsHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElement[]> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n // TODO: add paged version of this (#387280)\n public async getFilteredNodePaths(_token: IModelRpcProps, _options: FilterByTextHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElement[]> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getContentSources(_token: IModelRpcProps, _options: ContentSourcesRpcRequestOptions): PresentationRpcResponse<ContentSourcesRpcResult> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getContentDescriptor(_token: IModelRpcProps, _options: ContentDescriptorRpcRequestOptions): PresentationRpcResponse<DescriptorJSON | undefined> {\n const response: PresentationRpcResponseData<string | undefined> = await this.forward(arguments);\n return {\n ...response,\n ...(response.result ? { result: JSON.parse(response.result) } : {}),\n };\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getContentSetSize(_token: IModelRpcProps, _options: ContentRpcRequestOptions): PresentationRpcResponse<number> {\n return this.forward(arguments);\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getPagedContent(\n _token: IModelRpcProps,\n _options: Paged<ContentRpcRequestOptions>,\n ): PresentationRpcResponse<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined> {\n const rpcResponse = await this.forward(arguments);\n return {\n ...rpcResponse,\n ...(rpcResponse.result\n ? /* c8 ignore next */ { result: { ...rpcResponse.result, contentSet: deepReplaceNullsToUndefined(rpcResponse.result.contentSet) } }\n : {}),\n };\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getPagedContentSet(_token: IModelRpcProps, _options: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<PagedResponse<ItemJSON>> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getElementProperties(\n _token: IModelRpcProps,\n _options: SingleElementPropertiesRpcRequestOptions,\n ): PresentationRpcResponse<ElementProperties | undefined> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getPagedDistinctValues(\n _token: IModelRpcProps,\n _options: DistinctValuesRpcRequestOptions,\n ): PresentationRpcResponse<PagedResponse<DisplayValueGroup>> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getContentInstanceKeys(\n _token: IModelRpcProps,\n _options: ContentInstanceKeysRpcRequestOptions,\n ): PresentationRpcResponse<{ total: number; items: KeySetJSON }> {\n return this.forward(arguments);\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getDisplayLabelDefinition(_token: IModelRpcProps, _options: DisplayLabelRpcRequestOptions): PresentationRpcResponse<LabelDefinition> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getPagedDisplayLabelDefinitions(\n _token: IModelRpcProps,\n _options: DisplayLabelsRpcRequestOptions,\n ): PresentationRpcResponse<PagedResponse<LabelDefinition>> {\n return deepReplaceNullsToUndefined(await this.forward(arguments));\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async getSelectionScopes(_token: IModelRpcProps, _options: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]> {\n return this.forward(arguments);\n }\n\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\n public async computeSelection(_token: IModelRpcProps, _options: ComputeSelectionRpcRequestOptions): PresentationRpcResponse<KeySetJSON> {\n return this.forward(arguments);\n }\n}\n"]}
1
+ {"version":3,"file":"PresentationRpcInterface.js","sourceRoot":"","sources":["../../../src/presentation-common/PresentationRpcInterface.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;;;;;;;AAGH,OAAO,EAAkB,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAgChF,OAAO,EAAE,2BAA2B,EAAuB,MAAM,YAAY,CAAC;AAwJ9E;;;GAGG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,YAAY;IACxD,2CAA2C;IACpC,MAAM,CAAU,aAAa,GAAG,0BAA0B,CAAC;IAElE,6CAA6C;IACtC,MAAM,CAAC,gBAAgB,GAAG,OAAO,CAAC;IAEzC;;;iGAG6F;IAE7F,yKAAyK;IAClK,KAAK,CAAC,aAAa,CAAC,MAAsB,EAAE,QAAoC;QACrF,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,aAAa,CAAC,MAAsB,EAAE,QAA2C;QAC5F,OAAO,2BAA2B,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,yKAAyK;IAClK,KAAK,CAAC,kBAAkB,CAC7B,MAAsB,EACtB,QAAmD;QAEnD,OAAO,2BAA2B,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,yKAAyK;IACzK,4CAA4C;IACrC,KAAK,CAAC,YAAY,CAAC,MAAsB,EAAE,QAAyD;QACzG,OAAO,2BAA2B,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,yKAAyK;IACzK,4CAA4C;IACrC,KAAK,CAAC,oBAAoB,CAAC,MAAsB,EAAE,QAAgD;QACxG,OAAO,2BAA2B,CAAC,MAAM,IAA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------------------------------------------------------------------------\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/* eslint-disable @typescript-eslint/no-deprecated */\r\n/** @packageDocumentation\r\n * @module RPC\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { IModelRpcProps, RpcInterface, RpcOperation } from \"@itwin/core-common\";\r\nimport { DescriptorJSON, DescriptorOverrides, SelectClassInfoJSON } from \"./content/Descriptor.js\";\r\nimport { ItemJSON } from \"./content/Item.js\";\r\nimport { DisplayValueGroup } from \"./content/Value.js\";\r\nimport { ClientDiagnostics, ClientDiagnosticsOptions } from \"./Diagnostics.js\";\r\nimport { CompressedClassInfoJSON, InstanceKey } from \"./EC.js\";\r\nimport { ElementProperties } from \"./ElementProperties.js\";\r\nimport { PresentationStatus } from \"./Error.js\";\r\nimport { NodeKey } from \"./hierarchy/Key.js\";\r\nimport { Node } from \"./hierarchy/Node.js\";\r\nimport { NodePathElement } from \"./hierarchy/NodePathElement.js\";\r\nimport { KeySetJSON } from \"./KeySet.js\";\r\nimport { LabelDefinition } from \"./LabelDefinition.js\";\r\nimport {\r\n ComputeSelectionRequestOptions,\r\n ContentDescriptorRequestOptions,\r\n ContentInstanceKeysRequestOptions,\r\n ContentRequestOptions,\r\n ContentSourcesRequestOptions,\r\n DisplayLabelRequestOptions,\r\n DisplayLabelsRequestOptions,\r\n DistinctValuesRequestOptions,\r\n FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions,\r\n HierarchyLevelDescriptorRequestOptions,\r\n HierarchyRequestOptions,\r\n Paged,\r\n SelectionScopeRequestOptions,\r\n SingleElementPropertiesRequestOptions,\r\n} from \"./PresentationManagerOptions.js\";\r\nimport { RulesetVariableJSON } from \"./RulesetVariables.js\";\r\nimport { SelectionScope } from \"./selection/SelectionScope.js\";\r\nimport { deepReplaceNullsToUndefined, Omit, PagedResponse } from \"./Utils.js\";\r\n\r\n/**\r\n * Base options for all presentation RPC requests.\r\n * @public\r\n */\r\nexport type PresentationRpcRequestOptions<TManagerRequestOptions> = Omit<TManagerRequestOptions, \"imodel\" | \"diagnostics\"> & {\r\n /** @internal ID of the client requesting data */\r\n clientId?: string;\r\n /** RPC request diagnostics options. */\r\n diagnostics?: RpcDiagnosticsOptions;\r\n};\r\n\r\n/**\r\n * Data structure for presentation RPC responses\r\n * @public\r\n */\r\nexport interface PresentationRpcResponseData<TResult = undefined> {\r\n /** Response status code */\r\n statusCode: PresentationStatus;\r\n /** In case of an error response, the error message */\r\n errorMessage?: string;\r\n /** In case of a success response, the result */\r\n result?: TResult;\r\n /** Diagnostics response. */\r\n diagnostics?: ClientDiagnostics;\r\n}\r\n\r\n/**\r\n * Data structure for RPC diagnostics options.\r\n * @public\r\n */\r\nexport type RpcDiagnosticsOptions = Omit<ClientDiagnosticsOptions, \"handler\">;\r\n\r\n/**\r\n * A promise of [[PresentationRpcResponseData]].\r\n * @public\r\n */\r\nexport type PresentationRpcResponse<TResult = undefined> = Promise<PresentationRpcResponseData<TResult>>;\r\n\r\n/**\r\n * Data structure for hierarchy request options.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport type HierarchyRpcRequestOptions = PresentationRpcRequestOptions<HierarchyRequestOptions<never, NodeKey, RulesetVariableJSON>>;\r\n\r\n/**\r\n * Data structure for hierarchy level descriptor RPC request options.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport type HierarchyLevelDescriptorRpcRequestOptions = PresentationRpcRequestOptions<\r\n HierarchyLevelDescriptorRequestOptions<never, NodeKey, RulesetVariableJSON>\r\n>;\r\n\r\n/**\r\n * Data structure for filtering hierarchy by ECInstance paths request options.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport type FilterByInstancePathsHierarchyRpcRequestOptions = PresentationRpcRequestOptions<\r\n FilterByInstancePathsHierarchyRequestOptions<never, RulesetVariableJSON>\r\n>;\r\n\r\n/**\r\n * Data structure for filtering hierarchy by text request options.\r\n * @public\r\n * @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)\r\n * package for creating hierarchies.\r\n */\r\nexport type FilterByTextHierarchyRpcRequestOptions = PresentationRpcRequestOptions<FilterByTextHierarchyRequestOptions<never, RulesetVariableJSON>>;\r\n\r\n/**\r\n * Data structure for content sources RPC request options.\r\n * @public\r\n */\r\nexport type ContentSourcesRpcRequestOptions = PresentationRpcRequestOptions<ContentSourcesRequestOptions<never>>;\r\n/**\r\n * Data structure for content sources RPC response.\r\n * @public\r\n */\r\nexport interface ContentSourcesRpcResult {\r\n /** A list of objects containing content source information. */\r\n sources: SelectClassInfoJSON<Id64String>[];\r\n /** An `ECClassId` => [[CompressedClassInfoJSON]] map for deserializing [[sources]]. */\r\n classesMap: { [id: string]: CompressedClassInfoJSON };\r\n}\r\n\r\n/**\r\n * Data structure for content descriptor RPC request options.\r\n * @public\r\n */\r\nexport type ContentDescriptorRpcRequestOptions = PresentationRpcRequestOptions<ContentDescriptorRequestOptions<never, KeySetJSON, RulesetVariableJSON>>;\r\n\r\n/**\r\n * Data structure for content RPC request options.\r\n * @public\r\n */\r\nexport type ContentRpcRequestOptions = PresentationRpcRequestOptions<ContentRequestOptions<never, DescriptorOverrides, KeySetJSON, RulesetVariableJSON>>;\r\n\r\n/**\r\n * Data structure for single element properties RPC request options.\r\n * @public\r\n */\r\nexport type SingleElementPropertiesRpcRequestOptions = PresentationRpcRequestOptions<\r\n Omit<SingleElementPropertiesRequestOptions<never, never>, \"contentParser\">\r\n>;\r\n\r\n/**\r\n * Data structure for distinct values' request options.\r\n * @public\r\n */\r\nexport type DistinctValuesRpcRequestOptions = PresentationRpcRequestOptions<\r\n DistinctValuesRequestOptions<never, DescriptorOverrides, KeySetJSON, RulesetVariableJSON>\r\n>;\r\n\r\n/**\r\n * Data structure for content instance keys' request options.\r\n * @public\r\n */\r\nexport type ContentInstanceKeysRpcRequestOptions = PresentationRpcRequestOptions<ContentInstanceKeysRequestOptions<never, KeySetJSON, RulesetVariableJSON>>;\r\n\r\n/**\r\n * Data structure for label request options.\r\n * @public\r\n */\r\nexport type DisplayLabelRpcRequestOptions = PresentationRpcRequestOptions<DisplayLabelRequestOptions<never, InstanceKey>>;\r\n\r\n/**\r\n * Data structure for labels request options.\r\n * @public\r\n */\r\nexport type DisplayLabelsRpcRequestOptions = PresentationRpcRequestOptions<DisplayLabelsRequestOptions<never, InstanceKey>>;\r\n\r\n/**\r\n * Data structure for selection scope request options.\r\n * @public\r\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\r\n */\r\nexport type SelectionScopeRpcRequestOptions = PresentationRpcRequestOptions<SelectionScopeRequestOptions<never>>;\r\n\r\n/**\r\n * Request options data structure for computing selection based on given selection scope and element IDs.\r\n * @public\r\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\r\n */\r\nexport type ComputeSelectionRpcRequestOptions = PresentationRpcRequestOptions<ComputeSelectionRequestOptions<never>>;\r\n\r\n/**\r\n * Interface used for communication between Presentation backend and frontend.\r\n * @public\r\n */\r\n@RpcOperation.setDefaultPolicy({ retryInterval: () => 0 })\r\nexport class PresentationRpcInterface extends RpcInterface {\r\n /** The immutable name of the interface. */\r\n public static readonly interfaceName = \"PresentationRpcInterface\";\r\n\r\n /** The semantic version of the interface. */\r\n public static interfaceVersion = \"5.0.0\";\r\n\r\n /*===========================================================================================\r\n NOTE: Any add/remove/change to the methods below requires an update of the interface version.\r\n NOTE: Please consult the README in core/common/src/rpc for the semantic versioning rules.\r\n ===========================================================================================*/\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getNodesCount(_token: IModelRpcProps, _options: HierarchyRpcRequestOptions): PresentationRpcResponse<number> {\r\n return this.forward(arguments);\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getPagedNodes(_token: IModelRpcProps, _options: Paged<HierarchyRpcRequestOptions>): PresentationRpcResponse<PagedResponse<Node>> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getNodesDescriptor(\r\n _token: IModelRpcProps,\r\n _options: HierarchyLevelDescriptorRpcRequestOptions,\r\n ): PresentationRpcResponse<string | DescriptorJSON | undefined> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n // TODO: add paged version of this (#387280)\r\n public async getNodePaths(_token: IModelRpcProps, _options: FilterByInstancePathsHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElement[]> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n // TODO: add paged version of this (#387280)\r\n public async getFilteredNodePaths(_token: IModelRpcProps, _options: FilterByTextHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElement[]> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getContentSources(_token: IModelRpcProps, _options: ContentSourcesRpcRequestOptions): PresentationRpcResponse<ContentSourcesRpcResult> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getContentDescriptor(_token: IModelRpcProps, _options: ContentDescriptorRpcRequestOptions): PresentationRpcResponse<DescriptorJSON | undefined> {\r\n const response: PresentationRpcResponseData<string | undefined> = await this.forward(arguments);\r\n return {\r\n ...response,\r\n ...(response.result ? { result: JSON.parse(response.result) } : {}),\r\n };\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getContentSetSize(_token: IModelRpcProps, _options: ContentRpcRequestOptions): PresentationRpcResponse<number> {\r\n return this.forward(arguments);\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getPagedContent(\r\n _token: IModelRpcProps,\r\n _options: Paged<ContentRpcRequestOptions>,\r\n ): PresentationRpcResponse<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined> {\r\n const rpcResponse = await this.forward(arguments);\r\n return {\r\n ...rpcResponse,\r\n ...(rpcResponse.result\r\n ? /* c8 ignore next */ { result: { ...rpcResponse.result, contentSet: deepReplaceNullsToUndefined(rpcResponse.result.contentSet) } }\r\n : {}),\r\n };\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getPagedContentSet(_token: IModelRpcProps, _options: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<PagedResponse<ItemJSON>> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getElementProperties(\r\n _token: IModelRpcProps,\r\n _options: SingleElementPropertiesRpcRequestOptions,\r\n ): PresentationRpcResponse<ElementProperties | undefined> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getPagedDistinctValues(\r\n _token: IModelRpcProps,\r\n _options: DistinctValuesRpcRequestOptions,\r\n ): PresentationRpcResponse<PagedResponse<DisplayValueGroup>> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getContentInstanceKeys(\r\n _token: IModelRpcProps,\r\n _options: ContentInstanceKeysRpcRequestOptions,\r\n ): PresentationRpcResponse<{ total: number; items: KeySetJSON }> {\r\n return this.forward(arguments);\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getDisplayLabelDefinition(_token: IModelRpcProps, _options: DisplayLabelRpcRequestOptions): PresentationRpcResponse<LabelDefinition> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getPagedDisplayLabelDefinitions(\r\n _token: IModelRpcProps,\r\n _options: DisplayLabelsRpcRequestOptions,\r\n ): PresentationRpcResponse<PagedResponse<LabelDefinition>> {\r\n return deepReplaceNullsToUndefined(await this.forward(arguments));\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async getSelectionScopes(_token: IModelRpcProps, _options: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]> {\r\n return this.forward(arguments);\r\n }\r\n\r\n /** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */\r\n public async computeSelection(_token: IModelRpcProps, _options: ComputeSelectionRpcRequestOptions): PresentationRpcResponse<KeySetJSON> {\r\n return this.forward(arguments);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RegisteredRuleset.js","sourceRoot":"","sources":["../../../src/presentation-common/RegisteredRuleset.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAMH;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IACpB,QAAQ,CAAU;IAClB,iBAAiB,CAAS;IAC1B,YAAY,CAAuC;IAE3D,kCAAkC;IAClC,YAAmB,OAAgB,EAAE,gBAAwB,EAAE,WAAiD;QAC9G,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAED,kCAAkC;IAC3B,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,qGAAqG;IACrG,sBAAsB;IACf,OAAO;QACZ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IACzB,CAAC;IAED,IAAW,gBAAgB;QACzB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IACD,IAAW,EAAE;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC1B,CAAC;IACD,IAAW,mBAAmB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAC3C,CAAC;IACD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC7B,CAAC;IACD,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;IACM,MAAM;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { Rule } from \"./rules/Rule.js\";\nimport { Ruleset, SupplementationInfo } from \"./rules/Ruleset.js\";\nimport { VariablesGroup } from \"./rules/Variables.js\";\n\n/**\n * A ruleset that is registered in a ruleset manager.\n * @public\n */\nexport class RegisteredRuleset implements Disposable, Ruleset {\n private _ruleset: Ruleset;\n private _uniqueIdentifier: string;\n private _disposeFunc: (ruleset: RegisteredRuleset) => void;\n\n /** Create a registered ruleset */\n public constructor(ruleset: Ruleset, uniqueIdentifier: string, disposeFunc: (ruleset: RegisteredRuleset) => void) {\n this._disposeFunc = disposeFunc;\n this._ruleset = ruleset;\n this._uniqueIdentifier = uniqueIdentifier;\n }\n\n /** Dispose registered ruleset. */\n public [Symbol.dispose]() {\n this._disposeFunc(this);\n }\n\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\n /* c8 ignore next 3 */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n public get uniqueIdentifier() {\n return this._uniqueIdentifier;\n }\n public get id(): string {\n return this._ruleset.id;\n }\n public get supplementationInfo(): SupplementationInfo | undefined {\n return this._ruleset.supplementationInfo;\n }\n public get rules(): Rule[] {\n return this._ruleset.rules;\n }\n public get vars(): VariablesGroup[] | undefined {\n return this._ruleset.vars;\n }\n public toJSON(): Ruleset {\n return this._ruleset;\n }\n}\n"]}
1
+ {"version":3,"file":"RegisteredRuleset.js","sourceRoot":"","sources":["../../../src/presentation-common/RegisteredRuleset.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAMH;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IACpB,QAAQ,CAAU;IAClB,iBAAiB,CAAS;IAC1B,YAAY,CAAuC;IAE3D,kCAAkC;IAClC,YAAmB,OAAgB,EAAE,gBAAwB,EAAE,WAAiD;QAC9G,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAED,kCAAkC;IAC3B,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,qGAAqG;IACrG,sBAAsB;IACf,OAAO;QACZ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IACzB,CAAC;IAED,IAAW,gBAAgB;QACzB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IACD,IAAW,EAAE;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC1B,CAAC;IACD,IAAW,mBAAmB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAC3C,CAAC;IACD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC7B,CAAC;IACD,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;IACM,MAAM;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF","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 Core\r\n */\r\n\r\nimport { Rule } from \"./rules/Rule.js\";\r\nimport { Ruleset, SupplementationInfo } from \"./rules/Ruleset.js\";\r\nimport { VariablesGroup } from \"./rules/Variables.js\";\r\n\r\n/**\r\n * A ruleset that is registered in a ruleset manager.\r\n * @public\r\n */\r\nexport class RegisteredRuleset implements Disposable, Ruleset {\r\n private _ruleset: Ruleset;\r\n private _uniqueIdentifier: string;\r\n private _disposeFunc: (ruleset: RegisteredRuleset) => void;\r\n\r\n /** Create a registered ruleset */\r\n public constructor(ruleset: Ruleset, uniqueIdentifier: string, disposeFunc: (ruleset: RegisteredRuleset) => void) {\r\n this._disposeFunc = disposeFunc;\r\n this._ruleset = ruleset;\r\n this._uniqueIdentifier = uniqueIdentifier;\r\n }\r\n\r\n /** Dispose registered ruleset. */\r\n public [Symbol.dispose]() {\r\n this._disposeFunc(this);\r\n }\r\n\r\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\r\n /* c8 ignore next 3 */\r\n public dispose() {\r\n this[Symbol.dispose]();\r\n }\r\n\r\n public get uniqueIdentifier() {\r\n return this._uniqueIdentifier;\r\n }\r\n public get id(): string {\r\n return this._ruleset.id;\r\n }\r\n public get supplementationInfo(): SupplementationInfo | undefined {\r\n return this._ruleset.supplementationInfo;\r\n }\r\n public get rules(): Rule[] {\r\n return this._ruleset.rules;\r\n }\r\n public get vars(): VariablesGroup[] | undefined {\r\n return this._ruleset.vars;\r\n }\r\n public toJSON(): Ruleset {\r\n return this._ruleset;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-common/RpcRequestsHandler.ts"],"names":[],"mappings":"AAAA;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K,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,IAAI;IACrB,mBAAmB,EAAE,IAAI;IACzB,IAAI,EAAE,IAAI;CACX,CAAC;AAEF,SAAS,cAAc,CAAC,OAAgB;IACtC,MAAM,gBAAgB,GAAY,EAAE,GAAG,OAAO,EAAE,CAAC;IAEjD,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACxD,IAAI,CAAC,gCAAgC,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,CAAC;YAClE,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC9B,OAAQ,gBAAwB,CAAC,WAAW,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,UAAU,CACf,gCAAgC,CAAC,OAAO,EACxC,qDAAqD,WAAW,2DAA2D,CAC5H,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/* eslint-disable @typescript-eslint/no-deprecated */\n/** @packageDocumentation\n * @module RPC\n */\n\nimport { Guid, Logger } from \"@itwin/core-bentley\";\nimport { IModelRpcProps, RpcManager, RpcRequest } from \"@itwin/core-common\";\nimport { PresentationCommonLoggerCategory } from \"./CommonLoggerCategory.js\";\nimport { DescriptorJSON, DescriptorOverrides } from \"./content/Descriptor.js\";\nimport { ItemJSON } from \"./content/Item.js\";\nimport { ClientDiagnostics, ClientDiagnosticsAttribute, ClientDiagnosticsHandler } from \"./Diagnostics.js\";\nimport { InstanceKey } from \"./EC.js\";\nimport { PresentationError, PresentationStatus } from \"./Error.js\";\nimport { NodeKey } from \"./hierarchy/Key.js\";\nimport { Node } from \"./hierarchy/Node.js\";\nimport { KeySetJSON } from \"./KeySet.js\";\nimport { LabelDefinition } from \"./LabelDefinition.js\";\nimport {\n ComputeSelectionRequestOptions,\n ContentDescriptorRequestOptions,\n ContentInstanceKeysRequestOptions,\n ContentRequestOptions,\n ContentSourcesRequestOptions,\n DisplayLabelRequestOptions,\n DisplayLabelsRequestOptions,\n DistinctValuesRequestOptions,\n FilterByInstancePathsHierarchyRequestOptions,\n FilterByTextHierarchyRequestOptions,\n HierarchyLevelDescriptorRequestOptions,\n HierarchyRequestOptions,\n Paged,\n RequestOptions,\n RequestOptionsWithRuleset,\n SelectionScopeRequestOptions,\n} from \"./PresentationManagerOptions.js\";\nimport { ContentSourcesRpcResult, PresentationRpcInterface, PresentationRpcRequestOptions, PresentationRpcResponse } from \"./PresentationRpcInterface.js\";\nimport { Ruleset } from \"./rules/Ruleset.js\";\nimport { RulesetVariableJSON } from \"./RulesetVariables.js\";\nimport { SelectionScope } from \"./selection/SelectionScope.js\";\nimport { createCancellableTimeoutPromise, PagedResponse } from \"./Utils.js\";\nimport { NodePathElement } from \"./hierarchy/NodePathElement.js\";\nimport { DisplayValueGroup } from \"./content/Value.js\";\n\n/**\n * Default timeout for how long we're going to wait for RPC request to be fulfilled before throwing\n * a timeout error.\n */\nconst DEFAULT_REQUEST_TIMEOUT = 10 * 60 * 1000; // 10 minutes\n\n/**\n * Configuration parameters for [[RpcRequestsHandler]].\n *\n * @internal\n */\nexport interface RpcRequestsHandlerProps {\n /**\n * Optional ID used to identify client that requests data. If not specified,\n * the handler creates a unique GUID as a client id.\n * @internal\n */\n clientId?: string;\n\n /** @internal */\n timeout?: number;\n}\n\n/**\n * RPC requests handler that wraps [[PresentationRpcInterface]] and\n * adds handling for cases when backend needs to be synced with client\n * state.\n *\n * @internal\n */\nexport class RpcRequestsHandler {\n /** Timeout for how long the handler going to wait for RPC request to be fulfilled before throwing a timeout error. */\n public readonly timeout: number;\n\n /** ID that identifies this handler as a client */\n public readonly clientId: string;\n\n public constructor(props?: RpcRequestsHandlerProps) {\n this.clientId = props?.clientId ?? Guid.createValue();\n this.timeout = props?.timeout ?? DEFAULT_REQUEST_TIMEOUT;\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private get rpcClient(): PresentationRpcInterface {\n return RpcManager.getClientForInterface(PresentationRpcInterface);\n }\n\n private async requestWithTimeout<TResult>(func: () => PresentationRpcResponse<TResult>, diagnosticsHandler?: ClientDiagnosticsHandler): Promise<TResult> {\n const rpcResponsePromise = func();\n const rpcRequest: RpcRequest | undefined = RpcRequest.current(this.rpcClient);\n const timeout = createCancellableTimeoutPromise(this.timeout);\n return Promise.race([\n (async () => {\n let diagnostics: ClientDiagnostics | undefined;\n try {\n const response = await rpcResponsePromise;\n diagnostics = response.diagnostics;\n switch (response.statusCode) {\n case PresentationStatus.Success:\n return response.result!;\n default:\n throw new PresentationError(response.statusCode, response.errorMessage);\n }\n } finally {\n diagnosticsHandler && diagnostics && diagnosticsHandler(diagnostics);\n }\n })(),\n timeout.promise.then(() => {\n throw new Error(`Processing the request took longer than the configured limit of ${this.timeout} ms`);\n }),\n ]).finally(() => {\n rpcRequest?.cancel();\n timeout.cancel();\n });\n }\n\n /**\n * Send the request to backend. We'll wait for the response for `this.timeout` ms, and if we don't get the response by\n * then, we'll throw an error.\n */\n public async request<TResult, TOptions extends RequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute, TArg = any>(\n func: (token: IModelRpcProps, options: PresentationRpcRequestOptions<TOptions>, ...args: TArg[]) => PresentationRpcResponse<TResult>,\n options: TOptions,\n ...additionalOptions: TArg[]\n ): Promise<TResult> {\n const { imodel, diagnostics, ...optionsNoIModel } = options;\n const { handler: diagnosticsHandler, ...diagnosticsOptions } = diagnostics ?? {};\n if (isOptionsWithRuleset(optionsNoIModel)) {\n optionsNoIModel.rulesetOrId = cleanupRuleset(optionsNoIModel.rulesetOrId);\n }\n const rpcOptions: PresentationRpcRequestOptions<TOptions> = {\n ...optionsNoIModel,\n clientId: this.clientId,\n };\n if (diagnostics) {\n rpcOptions.diagnostics = diagnosticsOptions;\n }\n const doRequest = async () => func(imodel, rpcOptions, ...additionalOptions);\n const result = await this.requestWithTimeout(doRequest, diagnosticsHandler);\n return result;\n }\n\n public async getNodesCount(options: HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<number> {\n return this.request<number, typeof options>(this.rpcClient.getNodesCount.bind(this.rpcClient), options);\n }\n\n public async getPagedNodes(\n options: Paged<HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON>> & ClientDiagnosticsAttribute,\n ): Promise<PagedResponse<Node>> {\n return this.request<PagedResponse<Node>, typeof options>(this.rpcClient.getPagedNodes.bind(this.rpcClient), options);\n }\n\n public async getNodesDescriptor(\n options: HierarchyLevelDescriptorRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<DescriptorJSON | undefined> {\n const response = await this.request<string | DescriptorJSON | undefined, typeof options>(this.rpcClient.getNodesDescriptor.bind(this.rpcClient), options);\n if (typeof response === \"string\") {\n return JSON.parse(response);\n }\n return response;\n }\n\n public async getNodePaths(\n options: FilterByInstancePathsHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<NodePathElement[]> {\n return this.request<NodePathElement[], typeof options>(this.rpcClient.getNodePaths.bind(this.rpcClient), options);\n }\n\n public async getFilteredNodePaths(\n options: FilterByTextHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<NodePathElement[]> {\n return this.request<NodePathElement[], typeof options>(this.rpcClient.getFilteredNodePaths.bind(this.rpcClient), options);\n }\n\n public async getContentSources(options: ContentSourcesRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<ContentSourcesRpcResult> {\n return this.request<ContentSourcesRpcResult, typeof options>(this.rpcClient.getContentSources.bind(this.rpcClient), options);\n }\n public async getContentDescriptor(\n options: ContentDescriptorRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<DescriptorJSON | undefined> {\n return this.request<DescriptorJSON | undefined, typeof options>(this.rpcClient.getContentDescriptor.bind(this.rpcClient), options);\n }\n public async getContentSetSize(\n options: ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<number> {\n return this.request<number, typeof options>(this.rpcClient.getContentSetSize.bind(this.rpcClient), options);\n }\n public async getPagedContent(\n options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>,\n ) {\n return this.request<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined, typeof options>(\n this.rpcClient.getPagedContent.bind(this.rpcClient),\n options,\n );\n }\n public async getPagedContentSet(\n options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>,\n ) {\n return this.request<PagedResponse<ItemJSON>, typeof options>(this.rpcClient.getPagedContentSet.bind(this.rpcClient), options);\n }\n\n public async getPagedDistinctValues(\n options: DistinctValuesRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<PagedResponse<DisplayValueGroup>> {\n return this.request<PagedResponse<DisplayValueGroup>, typeof options>(this.rpcClient.getPagedDistinctValues.bind(this.rpcClient), options);\n }\n\n public async getContentInstanceKeys(\n options: ContentInstanceKeysRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\n ): Promise<{ total: number; items: KeySetJSON }> {\n return this.request<{ total: number; items: KeySetJSON }, typeof options>(this.rpcClient.getContentInstanceKeys.bind(this.rpcClient), options);\n }\n\n public async getDisplayLabelDefinition(\n options: DisplayLabelRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute,\n ): Promise<LabelDefinition> {\n return this.request<LabelDefinition, typeof options>(this.rpcClient.getDisplayLabelDefinition.bind(this.rpcClient), options);\n }\n public async getPagedDisplayLabelDefinitions(\n options: DisplayLabelsRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute,\n ): Promise<PagedResponse<LabelDefinition>> {\n return this.request<PagedResponse<LabelDefinition>, typeof options>(this.rpcClient.getPagedDisplayLabelDefinitions.bind(this.rpcClient), options);\n }\n\n /* eslint-disable @typescript-eslint/no-deprecated */\n public async getSelectionScopes(options: SelectionScopeRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<SelectionScope[]> {\n return this.request<SelectionScope[], typeof options>(this.rpcClient.getSelectionScopes.bind(this.rpcClient), options);\n }\n public async computeSelection(options: ComputeSelectionRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<KeySetJSON> {\n return this.request<KeySetJSON, typeof options>(this.rpcClient.computeSelection.bind(this.rpcClient), options);\n }\n /* eslint-enable @typescript-eslint/no-deprecated */\n}\n\nfunction isOptionsWithRuleset(options: object): options is { rulesetOrId: Ruleset } {\n return typeof (options as RequestOptionsWithRuleset<any, any>).rulesetOrId === \"object\";\n}\n\ntype RulesetWithRequiredProperties = {\n [key in keyof Ruleset]-?: true;\n};\n\nconst RULESET_SUPPORTED_PROPERTIES_OBJ: RulesetWithRequiredProperties = {\n id: true,\n rules: true,\n version: true,\n requiredSchemas: true,\n supplementationInfo: true,\n vars: true,\n};\n\nfunction cleanupRuleset(ruleset: Ruleset): Ruleset {\n const cleanedUpRuleset: Ruleset = { ...ruleset };\n\n for (const propertyKey of Object.keys(cleanedUpRuleset)) {\n if (!RULESET_SUPPORTED_PROPERTIES_OBJ.hasOwnProperty(propertyKey)) {\n if (propertyKey === \"$schema\") {\n delete (cleanedUpRuleset as any)[propertyKey];\n } else {\n Logger.logWarning(\n PresentationCommonLoggerCategory.Package,\n `Provided ruleset contains unrecognized attribute '${propertyKey}'. It either doesn't exist or may be no longer supported.`,\n );\n }\n }\n }\n\n return cleanedUpRuleset;\n}\n"]}
1
+ {"version":3,"file":"RpcRequestsHandler.js","sourceRoot":"","sources":["../../../src/presentation-common/RpcRequestsHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAkB,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAK7E,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAuBnE,OAAO,EAA2B,wBAAwB,EAA0D,MAAM,+BAA+B,CAAC;AAI1J,OAAO,EAAE,+BAA+B,EAAiB,MAAM,YAAY,CAAC;AAI5E;;;GAGG;AACH,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAmB7D;;;;;;GAMG;AACH,MAAM,OAAO,kBAAkB;IAC7B,sHAAsH;IACtG,OAAO,CAAS;IAEhC,kDAAkD;IAClC,QAAQ,CAAS;IAEjC,YAAmB,KAA+B;QAChD,IAAI,CAAC,QAAQ,GAAG,KAAK,EAAE,QAAQ,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACtD,IAAI,CAAC,OAAO,GAAG,KAAK,EAAE,OAAO,IAAI,uBAAuB,CAAC;IAC3D,CAAC;IAED,gEAAgE;IAChE,IAAY,SAAS;QACnB,OAAO,UAAU,CAAC,qBAAqB,CAAC,wBAAwB,CAAC,CAAC;IACpE,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAU,IAA4C,EAAE,kBAA6C;QACnI,MAAM,kBAAkB,GAAG,IAAI,EAAE,CAAC;QAClC,MAAM,UAAU,GAA2B,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QA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,SAAS,oBAAoB,CAAC,OAAe;IAC3C,OAAO,OAAQ,OAA+C,CAAC,WAAW,KAAK,QAAQ,CAAC;AAC1F,CAAC;AAMD,MAAM,gCAAgC,GAAkC;IACtE,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,IAAI;IACrB,mBAAmB,EAAE,IAAI;IACzB,IAAI,EAAE,IAAI;CACX,CAAC;AAEF,SAAS,cAAc,CAAC,OAAgB;IACtC,MAAM,gBAAgB,GAAY,EAAE,GAAG,OAAO,EAAE,CAAC;IAEjD,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACxD,IAAI,CAAC,gCAAgC,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,CAAC;YAClE,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC9B,OAAQ,gBAAwB,CAAC,WAAW,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,UAAU,CACf,gCAAgC,CAAC,OAAO,EACxC,qDAAqD,WAAW,2DAA2D,CAC5H,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC","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/* eslint-disable @typescript-eslint/no-deprecated */\r\n/** @packageDocumentation\r\n * @module RPC\r\n */\r\n\r\nimport { Guid, Logger } from \"@itwin/core-bentley\";\r\nimport { IModelRpcProps, RpcManager, RpcRequest } from \"@itwin/core-common\";\r\nimport { PresentationCommonLoggerCategory } from \"./CommonLoggerCategory.js\";\r\nimport { DescriptorJSON, DescriptorOverrides } from \"./content/Descriptor.js\";\r\nimport { ItemJSON } from \"./content/Item.js\";\r\nimport { ClientDiagnostics, ClientDiagnosticsAttribute, ClientDiagnosticsHandler } from \"./Diagnostics.js\";\r\nimport { InstanceKey } from \"./EC.js\";\r\nimport { PresentationError, PresentationStatus } from \"./Error.js\";\r\nimport { NodeKey } from \"./hierarchy/Key.js\";\r\nimport { Node } from \"./hierarchy/Node.js\";\r\nimport { KeySetJSON } from \"./KeySet.js\";\r\nimport { LabelDefinition } from \"./LabelDefinition.js\";\r\nimport {\r\n ComputeSelectionRequestOptions,\r\n ContentDescriptorRequestOptions,\r\n ContentInstanceKeysRequestOptions,\r\n ContentRequestOptions,\r\n ContentSourcesRequestOptions,\r\n DisplayLabelRequestOptions,\r\n DisplayLabelsRequestOptions,\r\n DistinctValuesRequestOptions,\r\n FilterByInstancePathsHierarchyRequestOptions,\r\n FilterByTextHierarchyRequestOptions,\r\n HierarchyLevelDescriptorRequestOptions,\r\n HierarchyRequestOptions,\r\n Paged,\r\n RequestOptions,\r\n RequestOptionsWithRuleset,\r\n SelectionScopeRequestOptions,\r\n} from \"./PresentationManagerOptions.js\";\r\nimport { ContentSourcesRpcResult, PresentationRpcInterface, PresentationRpcRequestOptions, PresentationRpcResponse } from \"./PresentationRpcInterface.js\";\r\nimport { Ruleset } from \"./rules/Ruleset.js\";\r\nimport { RulesetVariableJSON } from \"./RulesetVariables.js\";\r\nimport { SelectionScope } from \"./selection/SelectionScope.js\";\r\nimport { createCancellableTimeoutPromise, PagedResponse } from \"./Utils.js\";\r\nimport { NodePathElement } from \"./hierarchy/NodePathElement.js\";\r\nimport { DisplayValueGroup } from \"./content/Value.js\";\r\n\r\n/**\r\n * Default timeout for how long we're going to wait for RPC request to be fulfilled before throwing\r\n * a timeout error.\r\n */\r\nconst DEFAULT_REQUEST_TIMEOUT = 10 * 60 * 1000; // 10 minutes\r\n\r\n/**\r\n * Configuration parameters for [[RpcRequestsHandler]].\r\n *\r\n * @internal\r\n */\r\nexport interface RpcRequestsHandlerProps {\r\n /**\r\n * Optional ID used to identify client that requests data. If not specified,\r\n * the handler creates a unique GUID as a client id.\r\n * @internal\r\n */\r\n clientId?: string;\r\n\r\n /** @internal */\r\n timeout?: number;\r\n}\r\n\r\n/**\r\n * RPC requests handler that wraps [[PresentationRpcInterface]] and\r\n * adds handling for cases when backend needs to be synced with client\r\n * state.\r\n *\r\n * @internal\r\n */\r\nexport class RpcRequestsHandler {\r\n /** Timeout for how long the handler going to wait for RPC request to be fulfilled before throwing a timeout error. */\r\n public readonly timeout: number;\r\n\r\n /** ID that identifies this handler as a client */\r\n public readonly clientId: string;\r\n\r\n public constructor(props?: RpcRequestsHandlerProps) {\r\n this.clientId = props?.clientId ?? Guid.createValue();\r\n this.timeout = props?.timeout ?? DEFAULT_REQUEST_TIMEOUT;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private get rpcClient(): PresentationRpcInterface {\r\n return RpcManager.getClientForInterface(PresentationRpcInterface);\r\n }\r\n\r\n private async requestWithTimeout<TResult>(func: () => PresentationRpcResponse<TResult>, diagnosticsHandler?: ClientDiagnosticsHandler): Promise<TResult> {\r\n const rpcResponsePromise = func();\r\n const rpcRequest: RpcRequest | undefined = RpcRequest.current(this.rpcClient);\r\n const timeout = createCancellableTimeoutPromise(this.timeout);\r\n return Promise.race([\r\n (async () => {\r\n let diagnostics: ClientDiagnostics | undefined;\r\n try {\r\n const response = await rpcResponsePromise;\r\n diagnostics = response.diagnostics;\r\n switch (response.statusCode) {\r\n case PresentationStatus.Success:\r\n return response.result!;\r\n default:\r\n throw new PresentationError(response.statusCode, response.errorMessage);\r\n }\r\n } finally {\r\n diagnosticsHandler && diagnostics && diagnosticsHandler(diagnostics);\r\n }\r\n })(),\r\n timeout.promise.then(() => {\r\n throw new Error(`Processing the request took longer than the configured limit of ${this.timeout} ms`);\r\n }),\r\n ]).finally(() => {\r\n rpcRequest?.cancel();\r\n timeout.cancel();\r\n });\r\n }\r\n\r\n /**\r\n * Send the request to backend. We'll wait for the response for `this.timeout` ms, and if we don't get the response by\r\n * then, we'll throw an error.\r\n */\r\n public async request<TResult, TOptions extends RequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute, TArg = any>(\r\n func: (token: IModelRpcProps, options: PresentationRpcRequestOptions<TOptions>, ...args: TArg[]) => PresentationRpcResponse<TResult>,\r\n options: TOptions,\r\n ...additionalOptions: TArg[]\r\n ): Promise<TResult> {\r\n const { imodel, diagnostics, ...optionsNoIModel } = options;\r\n const { handler: diagnosticsHandler, ...diagnosticsOptions } = diagnostics ?? {};\r\n if (isOptionsWithRuleset(optionsNoIModel)) {\r\n optionsNoIModel.rulesetOrId = cleanupRuleset(optionsNoIModel.rulesetOrId);\r\n }\r\n const rpcOptions: PresentationRpcRequestOptions<TOptions> = {\r\n ...optionsNoIModel,\r\n clientId: this.clientId,\r\n };\r\n if (diagnostics) {\r\n rpcOptions.diagnostics = diagnosticsOptions;\r\n }\r\n const doRequest = async () => func(imodel, rpcOptions, ...additionalOptions);\r\n const result = await this.requestWithTimeout(doRequest, diagnosticsHandler);\r\n return result;\r\n }\r\n\r\n public async getNodesCount(options: HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<number> {\r\n return this.request<number, typeof options>(this.rpcClient.getNodesCount.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getPagedNodes(\r\n options: Paged<HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON>> & ClientDiagnosticsAttribute,\r\n ): Promise<PagedResponse<Node>> {\r\n return this.request<PagedResponse<Node>, typeof options>(this.rpcClient.getPagedNodes.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getNodesDescriptor(\r\n options: HierarchyLevelDescriptorRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<DescriptorJSON | undefined> {\r\n const response = await this.request<string | DescriptorJSON | undefined, typeof options>(this.rpcClient.getNodesDescriptor.bind(this.rpcClient), options);\r\n if (typeof response === \"string\") {\r\n return JSON.parse(response);\r\n }\r\n return response;\r\n }\r\n\r\n public async getNodePaths(\r\n options: FilterByInstancePathsHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n return this.request<NodePathElement[], typeof options>(this.rpcClient.getNodePaths.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getFilteredNodePaths(\r\n options: FilterByTextHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<NodePathElement[]> {\r\n return this.request<NodePathElement[], typeof options>(this.rpcClient.getFilteredNodePaths.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getContentSources(options: ContentSourcesRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<ContentSourcesRpcResult> {\r\n return this.request<ContentSourcesRpcResult, typeof options>(this.rpcClient.getContentSources.bind(this.rpcClient), options);\r\n }\r\n public async getContentDescriptor(\r\n options: ContentDescriptorRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<DescriptorJSON | undefined> {\r\n return this.request<DescriptorJSON | undefined, typeof options>(this.rpcClient.getContentDescriptor.bind(this.rpcClient), options);\r\n }\r\n public async getContentSetSize(\r\n options: ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<number> {\r\n return this.request<number, typeof options>(this.rpcClient.getContentSetSize.bind(this.rpcClient), options);\r\n }\r\n public async getPagedContent(\r\n options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>,\r\n ) {\r\n return this.request<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON> } | undefined, typeof options>(\r\n this.rpcClient.getPagedContent.bind(this.rpcClient),\r\n options,\r\n );\r\n }\r\n public async getPagedContentSet(\r\n options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>,\r\n ) {\r\n return this.request<PagedResponse<ItemJSON>, typeof options>(this.rpcClient.getPagedContentSet.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getPagedDistinctValues(\r\n options: DistinctValuesRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<PagedResponse<DisplayValueGroup>> {\r\n return this.request<PagedResponse<DisplayValueGroup>, typeof options>(this.rpcClient.getPagedDistinctValues.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getContentInstanceKeys(\r\n options: ContentInstanceKeysRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute,\r\n ): Promise<{ total: number; items: KeySetJSON }> {\r\n return this.request<{ total: number; items: KeySetJSON }, typeof options>(this.rpcClient.getContentInstanceKeys.bind(this.rpcClient), options);\r\n }\r\n\r\n public async getDisplayLabelDefinition(\r\n options: DisplayLabelRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute,\r\n ): Promise<LabelDefinition> {\r\n return this.request<LabelDefinition, typeof options>(this.rpcClient.getDisplayLabelDefinition.bind(this.rpcClient), options);\r\n }\r\n public async getPagedDisplayLabelDefinitions(\r\n options: DisplayLabelsRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute,\r\n ): Promise<PagedResponse<LabelDefinition>> {\r\n return this.request<PagedResponse<LabelDefinition>, typeof options>(this.rpcClient.getPagedDisplayLabelDefinitions.bind(this.rpcClient), options);\r\n }\r\n\r\n /* eslint-disable @typescript-eslint/no-deprecated */\r\n public async getSelectionScopes(options: SelectionScopeRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<SelectionScope[]> {\r\n return this.request<SelectionScope[], typeof options>(this.rpcClient.getSelectionScopes.bind(this.rpcClient), options);\r\n }\r\n public async computeSelection(options: ComputeSelectionRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<KeySetJSON> {\r\n return this.request<KeySetJSON, typeof options>(this.rpcClient.computeSelection.bind(this.rpcClient), options);\r\n }\r\n /* eslint-enable @typescript-eslint/no-deprecated */\r\n}\r\n\r\nfunction isOptionsWithRuleset(options: object): options is { rulesetOrId: Ruleset } {\r\n return typeof (options as RequestOptionsWithRuleset<any, any>).rulesetOrId === \"object\";\r\n}\r\n\r\ntype RulesetWithRequiredProperties = {\r\n [key in keyof Ruleset]-?: true;\r\n};\r\n\r\nconst RULESET_SUPPORTED_PROPERTIES_OBJ: RulesetWithRequiredProperties = {\r\n id: true,\r\n rules: true,\r\n version: true,\r\n requiredSchemas: true,\r\n supplementationInfo: true,\r\n vars: true,\r\n};\r\n\r\nfunction cleanupRuleset(ruleset: Ruleset): Ruleset {\r\n const cleanedUpRuleset: Ruleset = { ...ruleset };\r\n\r\n for (const propertyKey of Object.keys(cleanedUpRuleset)) {\r\n if (!RULESET_SUPPORTED_PROPERTIES_OBJ.hasOwnProperty(propertyKey)) {\r\n if (propertyKey === \"$schema\") {\r\n delete (cleanedUpRuleset as any)[propertyKey];\r\n } else {\r\n Logger.logWarning(\r\n PresentationCommonLoggerCategory.Package,\r\n `Provided ruleset contains unrecognized attribute '${propertyKey}'. It either doesn't exist or may be no longer supported.`,\r\n );\r\n }\r\n }\r\n }\r\n\r\n return cleanedUpRuleset;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RulesetVariables.js","sourceRoot":"","sources":["../../../src/presentation-common/RulesetVariables.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAc,MAAM,qBAAqB,CAAC;AAEpE;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAkBX;AAlBD,WAAY,kBAAkB;IAC5B,oBAAoB;IACpB,iCAAW,CAAA;IAEX,8BAA8B;IAC9B,wCAAkB,CAAA;IAElB,oBAAoB;IACpB,mCAAa,CAAA;IAEb,mBAAmB;IACnB,uCAAiB,CAAA;IAEjB,uBAAuB;IACvB,mCAAa,CAAA;IAEb,iCAAiC;IACjC,0CAAoB,CAAA;AACtB,CAAC,EAlBW,kBAAkB,KAAlB,kBAAkB,QAkB7B;AAiHD,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,eAAe,CAsB/B;AAtBD,WAAiB,eAAe;IAC9B;;;OAGG;IACH,SAAgB,MAAM,CAAC,QAAyB;QAC9C,IAAI,QAAQ,CAAC,IAAI,KAAK,kBAAkB,CAAC,SAAS,EAAE,CAAC;YACnD,OAAO,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,iBAAiB,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjF,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IALe,sBAAM,SAKrB,CAAA;IAED,iDAAiD;IACjD,SAAgB,QAAQ,CAAC,IAAyB;QAChD,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC,SAAS,EAAE,CAAC;YAC/C,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACnC,OAAO,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3E,CAAC;YACD,OAAO,IAAW,CAAC,CAAC,kFAAkF;QACxG,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IARe,wBAAQ,WAQvB,CAAA;AACH,CAAC,EAtBgB,eAAe,KAAf,eAAe,QAsB/B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { CompressedId64Set, Id64String } from \"@itwin/core-bentley\";\n\n/**\n * Possible variable value types\n * @public\n */\nexport enum VariableValueTypes {\n /** Integer value */\n Int = \"int\",\n\n /** Array of integer values */\n IntArray = \"int[]\",\n\n /** Boolean value */\n Bool = \"bool\",\n\n /** String value */\n String = \"string\",\n\n /** Id64String value */\n Id64 = \"id64\",\n\n /** Array of Id64String values */\n Id64Array = \"id64[]\",\n}\n\n/**\n * Union of all supported variable value types\n * @public\n */\nexport type VariableValue = boolean | string | number | number[] | Id64String | Id64String[];\n\n/**\n * JSON representation of [[VariableValue]]\n * @public\n */\nexport type VariableValueJSON = boolean | string | number | number[] | Id64String | Id64String[] | CompressedId64Set;\n\n/**\n * Base data structure for representing ruleset variables.\n * @public\n */\nexport interface RulesetVariableBase {\n id: string;\n type: VariableValueTypes;\n value: VariableValue;\n}\n/**\n * Data structure for representing boolean ruleset variables.\n * @public\n */\nexport interface BooleanRulesetVariable extends RulesetVariableBase {\n type: VariableValueTypes.Bool;\n value: boolean;\n}\n/**\n * Data structure for representing string ruleset variables.\n * @public\n */\nexport interface StringRulesetVariable extends RulesetVariableBase {\n type: VariableValueTypes.String;\n value: string;\n}\n/**\n * Data structure for representing int ruleset variables.\n * @public\n */\nexport interface IntRulesetVariable extends RulesetVariableBase {\n type: VariableValueTypes.Int;\n value: number;\n}\n/**\n * Data structure for representing int array ruleset variables.\n * @public\n */\nexport interface IntsRulesetVariable extends RulesetVariableBase {\n type: VariableValueTypes.IntArray;\n value: number[];\n}\n/**\n * Data structure for representing ID ruleset variables.\n * @public\n */\nexport interface Id64RulesetVariable extends RulesetVariableBase {\n type: VariableValueTypes.Id64;\n value: Id64String;\n}\n/**\n * Data structure for representing ID array ruleset variables.\n * @public\n */\nexport interface Id64sRulesetVariable extends RulesetVariableBase {\n type: VariableValueTypes.Id64Array;\n value: Id64String[];\n}\n/**\n * Data structure for representing ruleset variables.\n * @public\n */\nexport type RulesetVariable =\n | BooleanRulesetVariable\n | StringRulesetVariable\n | IntRulesetVariable\n | IntsRulesetVariable\n | Id64RulesetVariable\n | Id64sRulesetVariable;\n\n/**\n * JSON representation of [[RulesetVariableBase]].\n * @public\n */\nexport interface RulesetVariableBaseJSON {\n id: string;\n type: VariableValueTypes;\n value: VariableValueJSON;\n}\n/**\n * JSON representation of [[Id64sRulesetVariable]].\n * @public\n */\nexport interface Id64sRulesetVariableJSON extends RulesetVariableBaseJSON {\n type: VariableValueTypes.Id64Array;\n value: Id64String[] | CompressedId64Set;\n}\n/**\n * JSON representation of [[RulesetVariable]].\n * @public\n */\n\nexport type RulesetVariableJSON =\n | BooleanRulesetVariable\n | StringRulesetVariable\n | IntRulesetVariable\n | IntsRulesetVariable\n | Id64RulesetVariable\n | Id64sRulesetVariableJSON;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace RulesetVariable {\n /**\n * Serialize given RulesetVariable to JSON.\n * Note: In case of [[Id64sRulesetVariable]], this method expects IDs are sorted. See [[OrderedId64Iterable.sortArray]].\n */\n export function toJSON(variable: RulesetVariable): RulesetVariableJSON {\n if (variable.type === VariableValueTypes.Id64Array) {\n return { ...variable, value: CompressedId64Set.compressArray(variable.value) };\n }\n return variable;\n }\n\n /** Deserialize [[RulesetVariable]] from JSON. */\n export function fromJSON(json: RulesetVariableJSON): RulesetVariable {\n if (json.type === VariableValueTypes.Id64Array) {\n if (typeof json.value === \"string\") {\n return { ...json, value: CompressedId64Set.decompressArray(json.value) };\n }\n return json as any; // for some reason TS doesn't understand that `json.value` is always an array here\n }\n return json;\n }\n}\n"]}
1
+ {"version":3,"file":"RulesetVariables.js","sourceRoot":"","sources":["../../../src/presentation-common/RulesetVariables.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAc,MAAM,qBAAqB,CAAC;AAEpE;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAkBX;AAlBD,WAAY,kBAAkB;IAC5B,oBAAoB;IACpB,iCAAW,CAAA;IAEX,8BAA8B;IAC9B,wCAAkB,CAAA;IAElB,oBAAoB;IACpB,mCAAa,CAAA;IAEb,mBAAmB;IACnB,uCAAiB,CAAA;IAEjB,uBAAuB;IACvB,mCAAa,CAAA;IAEb,iCAAiC;IACjC,0CAAoB,CAAA;AACtB,CAAC,EAlBW,kBAAkB,KAAlB,kBAAkB,QAkB7B;AAiHD,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,eAAe,CAsB/B;AAtBD,WAAiB,eAAe;IAC9B;;;OAGG;IACH,SAAgB,MAAM,CAAC,QAAyB;QAC9C,IAAI,QAAQ,CAAC,IAAI,KAAK,kBAAkB,CAAC,SAAS,EAAE,CAAC;YACnD,OAAO,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,iBAAiB,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjF,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IALe,sBAAM,SAKrB,CAAA;IAED,iDAAiD;IACjD,SAAgB,QAAQ,CAAC,IAAyB;QAChD,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC,SAAS,EAAE,CAAC;YAC/C,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACnC,OAAO,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3E,CAAC;YACD,OAAO,IAAW,CAAC,CAAC,kFAAkF;QACxG,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IARe,wBAAQ,WAQvB,CAAA;AACH,CAAC,EAtBgB,eAAe,KAAf,eAAe,QAsB/B","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 Core\r\n */\r\n\r\nimport { CompressedId64Set, Id64String } from \"@itwin/core-bentley\";\r\n\r\n/**\r\n * Possible variable value types\r\n * @public\r\n */\r\nexport enum VariableValueTypes {\r\n /** Integer value */\r\n Int = \"int\",\r\n\r\n /** Array of integer values */\r\n IntArray = \"int[]\",\r\n\r\n /** Boolean value */\r\n Bool = \"bool\",\r\n\r\n /** String value */\r\n String = \"string\",\r\n\r\n /** Id64String value */\r\n Id64 = \"id64\",\r\n\r\n /** Array of Id64String values */\r\n Id64Array = \"id64[]\",\r\n}\r\n\r\n/**\r\n * Union of all supported variable value types\r\n * @public\r\n */\r\nexport type VariableValue = boolean | string | number | number[] | Id64String | Id64String[];\r\n\r\n/**\r\n * JSON representation of [[VariableValue]]\r\n * @public\r\n */\r\nexport type VariableValueJSON = boolean | string | number | number[] | Id64String | Id64String[] | CompressedId64Set;\r\n\r\n/**\r\n * Base data structure for representing ruleset variables.\r\n * @public\r\n */\r\nexport interface RulesetVariableBase {\r\n id: string;\r\n type: VariableValueTypes;\r\n value: VariableValue;\r\n}\r\n/**\r\n * Data structure for representing boolean ruleset variables.\r\n * @public\r\n */\r\nexport interface BooleanRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Bool;\r\n value: boolean;\r\n}\r\n/**\r\n * Data structure for representing string ruleset variables.\r\n * @public\r\n */\r\nexport interface StringRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.String;\r\n value: string;\r\n}\r\n/**\r\n * Data structure for representing int ruleset variables.\r\n * @public\r\n */\r\nexport interface IntRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Int;\r\n value: number;\r\n}\r\n/**\r\n * Data structure for representing int array ruleset variables.\r\n * @public\r\n */\r\nexport interface IntsRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.IntArray;\r\n value: number[];\r\n}\r\n/**\r\n * Data structure for representing ID ruleset variables.\r\n * @public\r\n */\r\nexport interface Id64RulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Id64;\r\n value: Id64String;\r\n}\r\n/**\r\n * Data structure for representing ID array ruleset variables.\r\n * @public\r\n */\r\nexport interface Id64sRulesetVariable extends RulesetVariableBase {\r\n type: VariableValueTypes.Id64Array;\r\n value: Id64String[];\r\n}\r\n/**\r\n * Data structure for representing ruleset variables.\r\n * @public\r\n */\r\nexport type RulesetVariable =\r\n | BooleanRulesetVariable\r\n | StringRulesetVariable\r\n | IntRulesetVariable\r\n | IntsRulesetVariable\r\n | Id64RulesetVariable\r\n | Id64sRulesetVariable;\r\n\r\n/**\r\n * JSON representation of [[RulesetVariableBase]].\r\n * @public\r\n */\r\nexport interface RulesetVariableBaseJSON {\r\n id: string;\r\n type: VariableValueTypes;\r\n value: VariableValueJSON;\r\n}\r\n/**\r\n * JSON representation of [[Id64sRulesetVariable]].\r\n * @public\r\n */\r\nexport interface Id64sRulesetVariableJSON extends RulesetVariableBaseJSON {\r\n type: VariableValueTypes.Id64Array;\r\n value: Id64String[] | CompressedId64Set;\r\n}\r\n/**\r\n * JSON representation of [[RulesetVariable]].\r\n * @public\r\n */\r\n\r\nexport type RulesetVariableJSON =\r\n | BooleanRulesetVariable\r\n | StringRulesetVariable\r\n | IntRulesetVariable\r\n | IntsRulesetVariable\r\n | Id64RulesetVariable\r\n | Id64sRulesetVariableJSON;\r\n\r\n/** @public */\r\n// eslint-disable-next-line @typescript-eslint/no-redeclare\r\nexport namespace RulesetVariable {\r\n /**\r\n * Serialize given RulesetVariable to JSON.\r\n * Note: In case of [[Id64sRulesetVariable]], this method expects IDs are sorted. See [[OrderedId64Iterable.sortArray]].\r\n */\r\n export function toJSON(variable: RulesetVariable): RulesetVariableJSON {\r\n if (variable.type === VariableValueTypes.Id64Array) {\r\n return { ...variable, value: CompressedId64Set.compressArray(variable.value) };\r\n }\r\n return variable;\r\n }\r\n\r\n /** Deserialize [[RulesetVariable]] from JSON. */\r\n export function fromJSON(json: RulesetVariableJSON): RulesetVariable {\r\n if (json.type === VariableValueTypes.Id64Array) {\r\n if (typeof json.value === \"string\") {\r\n return { ...json, value: CompressedId64Set.decompressArray(json.value) };\r\n }\r\n return json as any; // for some reason TS doesn't understand that `json.value` is always an array here\r\n }\r\n return json;\r\n }\r\n}\r\n"]}