@itwin/ecschema-metadata 5.3.0-dev.8 → 5.4.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,26 @@
1
1
  # Change Log - @itwin/ecschema-metadata
2
2
 
3
- This log was last generated on Thu, 02 Oct 2025 14:56:13 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 24 Oct 2025 16:22:31 GMT and should not be manually modified.
4
+
5
+ ## 5.2.4
6
+ Fri, 24 Oct 2025 16:20:38 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 5.2.3
11
+ Thu, 16 Oct 2025 23:00:31 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 5.2.2
16
+ Fri, 10 Oct 2025 14:49:15 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 5.2.1
21
+ Thu, 09 Oct 2025 17:10:26 GMT
22
+
23
+ _Version update only_
4
24
 
5
25
  ## 5.2.0
6
26
  Wed, 01 Oct 2025 20:22:54 GMT
@@ -256,9 +256,13 @@ export interface FormatSet {
256
256
  description?: string;
257
257
  /** A [UnitSystemKey]($quantity) that determines the unit system for this format set. */
258
258
  unitSystem: UnitSystemKey;
259
- /** A mapping of kind of quantity identifiers to their corresponding format properties. */
259
+ /**
260
+ * A mapping of kind of quantity identifiers to their corresponding format properties.
261
+ * When a format is a [FormatDefinition]($quantity), it defines the complete format specification.
262
+ * When a format is a string, it references another kindOfQuantityId to map one format to another.
263
+ */
260
264
  formats: {
261
- [kindOfQuantityId: string]: FormatDefinition;
265
+ [kindOfQuantityId: string]: FormatDefinition | string;
262
266
  };
263
267
  }
264
268
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"JsonProps.d.ts","sourceRoot":"","sources":["../../../src/Deserialization/JsonProps.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,C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G;;GAEG","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 Metadata\n */\n\nimport { FormatDefinition, FormatProps, UnitSystemKey } from \"@itwin/core-quantity\";\n\n/**\n * @public @preview\n */\nexport type AnyPropertyProps =\n | PrimitivePropertyProps\n | StructPropertyProps\n | PrimitiveArrayPropertyProps\n | StructArrayPropertyProps\n | NavigationPropertyProps;\n/**\n * @public @preview\n */\nexport type AnyClassProps =\n | EntityClassProps\n | MixinProps\n | CustomAttributeClassProps\n | RelationshipClassProps;\n/**\n * @public @preview\n */\nexport type AnySchemaItemProps =\n | AnyClassProps\n | EnumerationProps\n | KindOfQuantityProps\n | PropertyCategoryProps\n | SchemaItemUnitProps\n | InvertedUnitProps\n | ConstantProps\n | PhenomenonProps\n | SchemaItemFormatProps\n | SchemaItemOverrideFormatProps;\n\n/**\n * @public @preview\n */\nexport interface SchemaProps {\n readonly $schema: string;\n readonly name: string;\n readonly version: string;\n readonly alias: string;\n readonly label?: string;\n readonly description?: string;\n readonly references?: SchemaReferenceProps[];\n readonly items?: { [name: string]: SchemaItemProps };\n readonly customAttributes?: Array<{ [value: string]: any }>;\n readonly ecSpecMajorVersion?: number;\n readonly ecSpecMinorVersion?: number;\n}\n\n/**\n * JSON Object interface used to deserialize into a [[SchemaKey]].\n * @public @preview\n */\nexport interface SchemaKeyProps {\n /** The schema name */\n readonly name: string;\n /** Read version of the schema */\n readonly read: number;\n /** Write version of the schema */\n readonly write: number;\n /** Minor version of the schema */\n readonly minor: number;\n}\n\n/**\n * @public @preview\n */\nexport interface SchemaReferenceProps {\n readonly name: string;\n readonly version: string;\n}\n\n/**\n * @public @preview\n */\nexport interface SchemaItemProps {\n // NEEDSWORK: Still need to clarify how single-item deserialization works...\n readonly $schema?: string;\n readonly schema?: string; // conditionally required\n readonly schemaVersion?: string;\n readonly name?: string;\n readonly schemaItemType?: string;\n readonly label?: string;\n readonly description?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n readonly originalECSpecMajorVersion?: number;\n readonly originalECSpecMinorVersion?: number;\n}\n\n/**\n * @public @preview\n */\nexport interface ClassProps extends SchemaItemProps {\n readonly modifier?: string;\n readonly baseClass?: string;\n readonly properties?: AnyPropertyProps[];\n}\n\n/**\n * @public @preview\n */\nexport interface EntityClassProps extends ClassProps {\n readonly mixins?: string[];\n}\n\n/**\n * @public @preview\n */\nexport interface MixinProps extends ClassProps {\n readonly appliesTo: string;\n}\n\n/**\n * @public @preview\n */\nexport type StructClassProps = ClassProps;\n\n/**\n * @public @preview\n */\nexport interface CustomAttributeClassProps extends ClassProps {\n /**\n * Can be any combination of the [CustomAttributeContainerType]$(docs/bis/ec/customattribute-container-types.md) string values\n * separated by commas.\n */\n readonly appliesTo: string;\n}\n\n/**\n * @public @preview\n */\nexport interface RelationshipClassProps extends ClassProps {\n readonly strength: string;\n readonly strengthDirection: string;\n readonly source: RelationshipConstraintProps;\n readonly target: RelationshipConstraintProps;\n}\n\n/**\n * @public @preview\n */\nexport interface RelationshipConstraintProps {\n readonly multiplicity: string;\n readonly roleLabel: string;\n readonly polymorphic: boolean;\n readonly abstractConstraint?: string;\n readonly constraintClasses: string[];\n readonly customAttributes?: Array<{ [value: string]: any }>;\n}\n\n/**\n * @public @preview\n */\nexport interface EnumerationProps extends SchemaItemProps {\n readonly type: string;\n readonly isStrict: boolean;\n readonly enumerators: EnumeratorProps[];\n}\n\n/**\n * @public @preview\n */\nexport interface EnumeratorProps {\n readonly name: string;\n readonly value: string | number;\n readonly label?: string;\n readonly description?: string;\n}\n\n/**\n * @public @preview\n */\nexport interface KindOfQuantityProps extends SchemaItemProps {\n readonly persistenceUnit: string;\n readonly presentationUnits?: string | string[];\n readonly relativeError: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PropertyCategoryProps extends SchemaItemProps {\n readonly priority: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PropertyProps {\n readonly name: string;\n readonly type: string;\n readonly description?: string;\n readonly label?: string;\n readonly isReadOnly?: boolean;\n readonly category?: string;\n readonly priority?: number;\n readonly inherited?: boolean;\n readonly kindOfQuantity?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n}\n\n/**\n * @public @preview\n */\nexport interface PrimitiveOrEnumPropertyBaseProps extends PropertyProps {\n readonly extendedTypeName?: string;\n readonly minLength?: number;\n readonly maxLength?: number;\n readonly minValue?: number;\n readonly maxValue?: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PrimitivePropertyProps\n extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface StructPropertyProps extends PropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface EnumerationPropertyProps\n extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface ArrayPropertyProps extends PrimitiveOrEnumPropertyBaseProps {\n readonly minOccurs?: number;\n readonly maxOccurs?: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PrimitiveArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface StructArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface NavigationPropertyProps extends PropertyProps {\n readonly relationshipName: string;\n readonly direction: string;\n}\n\n/**\n * @public @preview\n */\nexport interface ConstantProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n}\n\n/**\n * @public @preview\n */\nexport type SchemaItemFormatProps = SchemaItemProps & FormatProps;\n\n/**\n * This interface defines properties necessary to support persistence of a set of formats.\n * @beta\n */\nexport interface FormatSet {\n /** The unique name identifier for this format set. */\n name: string;\n /** The display label for this format set. */\n label: string;\n /** The description for this format set. */\n description?: string;\n /** A [UnitSystemKey]($quantity) that determines the unit system for this format set. */\n unitSystem: UnitSystemKey;\n /** A mapping of kind of quantity identifiers to their corresponding format properties. */\n formats: { [kindOfQuantityId: string]: FormatDefinition };\n}\n\n/**\n * @public @preview\n */\nexport interface SchemaItemOverrideFormatProps extends SchemaItemFormatProps {\n readonly parent: string;\n}\n\n/**\n * @public @preview\n */\nexport interface InvertedUnitProps extends SchemaItemProps {\n readonly invertsUnit: string;\n readonly unitSystem: string;\n}\n\n/**\n * @public @preview\n */\nexport interface PhenomenonProps extends SchemaItemProps {\n readonly definition: string;\n}\n\n/**\n * @public @preview\n */\nexport type UnitSystemProps = SchemaItemProps;\n\n/**\n * @public @preview\n */\nexport interface SchemaItemUnitProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly unitSystem: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n readonly offset?: number;\n}\n"]}
1
+ {"version":3,"file":"JsonProps.js","sourceRoot":"","sources":["../../../src/Deserialization/JsonProps.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG","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 Metadata\n */\n\nimport { FormatDefinition, FormatProps, UnitSystemKey } from \"@itwin/core-quantity\";\n\n/**\n * @public @preview\n */\nexport type AnyPropertyProps =\n | PrimitivePropertyProps\n | StructPropertyProps\n | PrimitiveArrayPropertyProps\n | StructArrayPropertyProps\n | NavigationPropertyProps;\n/**\n * @public @preview\n */\nexport type AnyClassProps =\n | EntityClassProps\n | MixinProps\n | CustomAttributeClassProps\n | RelationshipClassProps;\n/**\n * @public @preview\n */\nexport type AnySchemaItemProps =\n | AnyClassProps\n | EnumerationProps\n | KindOfQuantityProps\n | PropertyCategoryProps\n | SchemaItemUnitProps\n | InvertedUnitProps\n | ConstantProps\n | PhenomenonProps\n | SchemaItemFormatProps\n | SchemaItemOverrideFormatProps;\n\n/**\n * @public @preview\n */\nexport interface SchemaProps {\n readonly $schema: string;\n readonly name: string;\n readonly version: string;\n readonly alias: string;\n readonly label?: string;\n readonly description?: string;\n readonly references?: SchemaReferenceProps[];\n readonly items?: { [name: string]: SchemaItemProps };\n readonly customAttributes?: Array<{ [value: string]: any }>;\n readonly ecSpecMajorVersion?: number;\n readonly ecSpecMinorVersion?: number;\n}\n\n/**\n * JSON Object interface used to deserialize into a [[SchemaKey]].\n * @public @preview\n */\nexport interface SchemaKeyProps {\n /** The schema name */\n readonly name: string;\n /** Read version of the schema */\n readonly read: number;\n /** Write version of the schema */\n readonly write: number;\n /** Minor version of the schema */\n readonly minor: number;\n}\n\n/**\n * @public @preview\n */\nexport interface SchemaReferenceProps {\n readonly name: string;\n readonly version: string;\n}\n\n/**\n * @public @preview\n */\nexport interface SchemaItemProps {\n // NEEDSWORK: Still need to clarify how single-item deserialization works...\n readonly $schema?: string;\n readonly schema?: string; // conditionally required\n readonly schemaVersion?: string;\n readonly name?: string;\n readonly schemaItemType?: string;\n readonly label?: string;\n readonly description?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n readonly originalECSpecMajorVersion?: number;\n readonly originalECSpecMinorVersion?: number;\n}\n\n/**\n * @public @preview\n */\nexport interface ClassProps extends SchemaItemProps {\n readonly modifier?: string;\n readonly baseClass?: string;\n readonly properties?: AnyPropertyProps[];\n}\n\n/**\n * @public @preview\n */\nexport interface EntityClassProps extends ClassProps {\n readonly mixins?: string[];\n}\n\n/**\n * @public @preview\n */\nexport interface MixinProps extends ClassProps {\n readonly appliesTo: string;\n}\n\n/**\n * @public @preview\n */\nexport type StructClassProps = ClassProps;\n\n/**\n * @public @preview\n */\nexport interface CustomAttributeClassProps extends ClassProps {\n /**\n * Can be any combination of the [CustomAttributeContainerType]$(docs/bis/ec/customattribute-container-types.md) string values\n * separated by commas.\n */\n readonly appliesTo: string;\n}\n\n/**\n * @public @preview\n */\nexport interface RelationshipClassProps extends ClassProps {\n readonly strength: string;\n readonly strengthDirection: string;\n readonly source: RelationshipConstraintProps;\n readonly target: RelationshipConstraintProps;\n}\n\n/**\n * @public @preview\n */\nexport interface RelationshipConstraintProps {\n readonly multiplicity: string;\n readonly roleLabel: string;\n readonly polymorphic: boolean;\n readonly abstractConstraint?: string;\n readonly constraintClasses: string[];\n readonly customAttributes?: Array<{ [value: string]: any }>;\n}\n\n/**\n * @public @preview\n */\nexport interface EnumerationProps extends SchemaItemProps {\n readonly type: string;\n readonly isStrict: boolean;\n readonly enumerators: EnumeratorProps[];\n}\n\n/**\n * @public @preview\n */\nexport interface EnumeratorProps {\n readonly name: string;\n readonly value: string | number;\n readonly label?: string;\n readonly description?: string;\n}\n\n/**\n * @public @preview\n */\nexport interface KindOfQuantityProps extends SchemaItemProps {\n readonly persistenceUnit: string;\n readonly presentationUnits?: string | string[];\n readonly relativeError: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PropertyCategoryProps extends SchemaItemProps {\n readonly priority: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PropertyProps {\n readonly name: string;\n readonly type: string;\n readonly description?: string;\n readonly label?: string;\n readonly isReadOnly?: boolean;\n readonly category?: string;\n readonly priority?: number;\n readonly inherited?: boolean;\n readonly kindOfQuantity?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n}\n\n/**\n * @public @preview\n */\nexport interface PrimitiveOrEnumPropertyBaseProps extends PropertyProps {\n readonly extendedTypeName?: string;\n readonly minLength?: number;\n readonly maxLength?: number;\n readonly minValue?: number;\n readonly maxValue?: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PrimitivePropertyProps\n extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface StructPropertyProps extends PropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface EnumerationPropertyProps\n extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface ArrayPropertyProps extends PrimitiveOrEnumPropertyBaseProps {\n readonly minOccurs?: number;\n readonly maxOccurs?: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PrimitiveArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface StructArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface NavigationPropertyProps extends PropertyProps {\n readonly relationshipName: string;\n readonly direction: string;\n}\n\n/**\n * @public @preview\n */\nexport interface ConstantProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n}\n\n/**\n * @public @preview\n */\nexport type SchemaItemFormatProps = SchemaItemProps & FormatProps;\n\n/**\n * This interface defines properties necessary to support persistence of a set of formats.\n * @beta\n */\nexport interface FormatSet {\n /** The unique name identifier for this format set. */\n name: string;\n /** The display label for this format set. */\n label: string;\n /** The description for this format set. */\n description?: string;\n /** A [UnitSystemKey]($quantity) that determines the unit system for this format set. */\n unitSystem: UnitSystemKey;\n /** \n * A mapping of kind of quantity identifiers to their corresponding format properties.\n * When a format is a [FormatDefinition]($quantity), it defines the complete format specification.\n * When a format is a string, it references another kindOfQuantityId to map one format to another.\n */\n formats: { [kindOfQuantityId: string]: FormatDefinition | string };\n}\n\n/**\n * @public @preview\n */\nexport interface SchemaItemOverrideFormatProps extends SchemaItemFormatProps {\n readonly parent: string;\n}\n\n/**\n * @public @preview\n */\nexport interface InvertedUnitProps extends SchemaItemProps {\n readonly invertsUnit: string;\n readonly unitSystem: string;\n}\n\n/**\n * @public @preview\n */\nexport interface PhenomenonProps extends SchemaItemProps {\n readonly definition: string;\n}\n\n/**\n * @public @preview\n */\nexport type UnitSystemProps = SchemaItemProps;\n\n/**\n * @public @preview\n */\nexport interface SchemaItemUnitProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly unitSystem: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n readonly offset?: number;\n}\n"]}
@@ -10,28 +10,42 @@ export declare class FormatSetFormatsProvider implements MutableFormatsProvider
10
10
  onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>;
11
11
  private _formatSet;
12
12
  private _fallbackProvider?;
13
+ private _references;
13
14
  constructor(props: {
14
15
  formatSet: FormatSet;
15
16
  fallbackProvider?: FormatsProvider;
16
17
  });
17
18
  /**
18
- * Adds a format definition to the format set or updates an existing one.
19
- * @param name The name of the format to add or update
20
- * @param format The format definition to add or update
19
+ * Adds or updates the format definition returned for a kind of quantity. Takes either a format definition or a kind of quantity full name that will be used to lookup the format that will be used.
20
+ * @param name A kind of quantity full name used as a key to lookup this format
21
+ * @param format The format definition or the name of a kind of quantity
21
22
  */
22
- addFormat(name: string, format: FormatDefinition): Promise<void>;
23
+ addFormat(name: string, format: FormatDefinition | string): Promise<void>;
23
24
  /**
24
25
  * Clears the fallback provider, if one is set.
25
26
  */
26
27
  clearFallbackProvider(): void;
27
28
  /**
28
29
  * Retrieves a format definition by its name from the format set. If not found, it checks the fallback provider to find the format, else returns undefined.
30
+ * If the format is a string reference to another format, it resolves the reference and returns the FormatDefinition.
29
31
  */
30
32
  getFormat(input: string): Promise<FormatDefinition | undefined>;
31
33
  /**
32
- * Removes a format definition from the format set.
34
+ * Resolves a string reference to its FormatDefinition, following chains of references.
35
+ * @param reference The string reference to resolve
36
+ * @param visited Set of visited references to detect circular references
37
+ */
38
+ private resolveReference;
39
+ /**
40
+ * Removes a format definition or string reference from the format set.
33
41
  * @param name The name of the format to remove
34
42
  */
35
43
  removeFormat(name: string): Promise<void>;
44
+ /**
45
+ * Gets all format names that reference the target format (directly or indirectly).
46
+ * @param target The format name to find references to
47
+ * @returns Set of format names that reference the target
48
+ */
49
+ private getFormatsReferencingTarget;
36
50
  }
37
51
  //# sourceMappingURL=FormatSetFormatsProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormatSetFormatsProvider.d.ts","sourceRoot":"","sources":["../../../src/Formatting/FormatSetFormatsProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACrH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD;;;;GAIG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IAC9D,gBAAgB,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC,CAAqD;IAEzH,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,iBAAiB,CAAC,CAAkB;gBAEzB,KAAK,EAAE;QAAC,SAAS,EAAE,SAAS,CAAC;QAAC,gBAAgB,CAAC,EAAE,eAAe,CAAA;KAAC;IAKpF;;;;OAIG;IACU,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7E;;OAEG;IACI,qBAAqB,IAAI,IAAI;IAIpC;;OAEG;IACU,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAW5E;;;OAGG;IACU,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIvD"}
1
+ {"version":3,"file":"FormatSetFormatsProvider.d.ts","sourceRoot":"","sources":["../../../src/Formatting/FormatSetFormatsProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACrH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD;;;;GAIG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IAC9D,gBAAgB,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC,CAAqD;IAEzH,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,iBAAiB,CAAC,CAAkB;IAC5C,OAAO,CAAC,WAAW,CAAsB;gBAEtB,KAAK,EAAE;QAAC,SAAS,EAAE,SAAS,CAAC;QAAC,gBAAgB,CAAC,EAAE,eAAe,CAAA;KAAC;IAapF;;;;OAIG;IACU,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBtF;;OAEG;IACI,qBAAqB,IAAI,IAAI;IAIpC;;;OAGG;IACU,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAmB5E;;;;OAIG;YACW,gBAAgB;IAwB9B;;;OAGG;IACU,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWtD;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;CAiBpC"}
@@ -12,18 +12,36 @@ class FormatSetFormatsProvider {
12
12
  onFormatsChanged = new core_bentley_1.BeEvent();
13
13
  _formatSet;
14
14
  _fallbackProvider;
15
+ _references; // Maps format name to the reference it points to
15
16
  constructor(props) {
16
17
  this._formatSet = props.formatSet;
17
18
  this._fallbackProvider = props.fallbackProvider;
19
+ this._references = new Map();
20
+ // Build up the map of string references
21
+ for (const [name, format] of Object.entries(this._formatSet.formats)) {
22
+ if (typeof format === "string") {
23
+ this._references.set(name, format);
24
+ }
25
+ }
18
26
  }
19
27
  /**
20
- * Adds a format definition to the format set or updates an existing one.
21
- * @param name The name of the format to add or update
22
- * @param format The format definition to add or update
28
+ * Adds or updates the format definition returned for a kind of quantity. Takes either a format definition or a kind of quantity full name that will be used to lookup the format that will be used.
29
+ * @param name A kind of quantity full name used as a key to lookup this format
30
+ * @param format The format definition or the name of a kind of quantity
23
31
  */
24
32
  async addFormat(name, format) {
25
33
  this._formatSet.formats[name] = format;
26
- this.onFormatsChanged.raiseEvent({ formatsChanged: [name] });
34
+ // Update the references map
35
+ if (typeof format === "string") {
36
+ this._references.set(name, format);
37
+ }
38
+ else {
39
+ this._references.delete(name);
40
+ }
41
+ // Collect all formats that reference this format (directly or indirectly)
42
+ const affectedFormats = this.getFormatsReferencingTarget(name);
43
+ affectedFormats.add(name); // Include the format itself
44
+ this.onFormatsChanged.raiseEvent({ formatsChanged: Array.from(affectedFormats) });
27
45
  }
28
46
  /**
29
47
  * Clears the fallback provider, if one is set.
@@ -33,25 +51,79 @@ class FormatSetFormatsProvider {
33
51
  }
34
52
  /**
35
53
  * Retrieves a format definition by its name from the format set. If not found, it checks the fallback provider to find the format, else returns undefined.
54
+ * If the format is a string reference to another format, it resolves the reference and returns the FormatDefinition.
36
55
  */
37
56
  async getFormat(input) {
38
57
  // Normalizes any schemaItem names coming from node addon 'schemaName:schemaItemName' -> 'schemaName.schemaItemName'
39
58
  const [schemaName, itemName] = SchemaItem_1.SchemaItem.parseFullName(input);
40
59
  const name = (schemaName === "") ? itemName : `${schemaName}.${itemName}`;
41
60
  const format = this._formatSet.formats[name];
42
- if (format)
61
+ if (format !== undefined) {
62
+ // If format is a string reference, resolve it
63
+ if (typeof format === "string") {
64
+ return this.resolveReference(format);
65
+ }
43
66
  return format;
67
+ }
44
68
  if (this._fallbackProvider)
45
69
  return this._fallbackProvider.getFormat(name);
46
70
  return undefined;
47
71
  }
48
72
  /**
49
- * Removes a format definition from the format set.
73
+ * Resolves a string reference to its FormatDefinition, following chains of references.
74
+ * @param reference The string reference to resolve
75
+ * @param visited Set of visited references to detect circular references
76
+ */
77
+ async resolveReference(reference, visited = new Set()) {
78
+ // Prevent infinite loops from circular references
79
+ if (visited.has(reference)) {
80
+ return undefined;
81
+ }
82
+ visited.add(reference);
83
+ const format = this._formatSet.formats[reference];
84
+ if (format === undefined) {
85
+ if (this._fallbackProvider) {
86
+ return this._fallbackProvider.getFormat(reference);
87
+ }
88
+ return undefined;
89
+ }
90
+ // If we found another string reference, resolve it recursively
91
+ if (typeof format === "string") {
92
+ return this.resolveReference(format, visited);
93
+ }
94
+ return format;
95
+ }
96
+ /**
97
+ * Removes a format definition or string reference from the format set.
50
98
  * @param name The name of the format to remove
51
99
  */
52
100
  async removeFormat(name) {
101
+ // Collect all formats that reference this format (directly or indirectly)
102
+ const affectedFormats = this.getFormatsReferencingTarget(name);
103
+ affectedFormats.add(name); // Include the format itself
53
104
  delete this._formatSet.formats[name];
54
- this.onFormatsChanged.raiseEvent({ formatsChanged: [name] });
105
+ this._references.delete(name);
106
+ this.onFormatsChanged.raiseEvent({ formatsChanged: Array.from(affectedFormats) });
107
+ }
108
+ /**
109
+ * Gets all format names that reference the target format (directly or indirectly).
110
+ * @param target The format name to find references to
111
+ * @returns Set of format names that reference the target
112
+ */
113
+ getFormatsReferencingTarget(target) {
114
+ const referencingFormats = new Set();
115
+ // Find all formats that directly reference the target
116
+ for (const [formatName, reference] of this._references.entries()) {
117
+ if (reference === target) {
118
+ referencingFormats.add(formatName);
119
+ // Recursively find formats that reference this format
120
+ const indirectReferences = this.getFormatsReferencingTarget(formatName);
121
+ for (const indirectRef of indirectReferences) {
122
+ referencingFormats.add(indirectRef);
123
+ }
124
+ }
125
+ }
126
+ return referencingFormats;
55
127
  }
56
128
  }
57
129
  exports.FormatSetFormatsProvider = FormatSetFormatsProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"FormatSetFormatsProvider.js","sourceRoot":"","sources":["../../../src/Formatting/FormatSetFormatsProvider.ts"],"names":[],"mappings":";;;AAAA,sDAA8C;AAG9C,uDAAoD;AAEpD;;;;GAIG;AACH,MAAa,wBAAwB;IAC5B,gBAAgB,GAAgD,IAAI,sBAAO,EAAsC,CAAC;IAEjH,UAAU,CAAY;IACtB,iBAAiB,CAAmB;IAE5C,YAAmB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C/D,CAAC;CACF;AAlDD,4DAkDC","sourcesContent":["import { BeEvent } from \"@itwin/core-bentley\";\nimport { FormatDefinition, FormatsChangedArgs, FormatsProvider, MutableFormatsProvider } from \"@itwin/core-quantity\";\nimport { FormatSet } from \"../Deserialization/JsonProps\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\n\n/**\n * A mutable format provider that manages format definitions within a format set.\n * When formats are added or removed, the underlying format set is automatically updated.\n * @beta\n */\nexport class FormatSetFormatsProvider implements MutableFormatsProvider {\n public onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void> = new BeEvent<(args: FormatsChangedArgs) => void>();\n\n private _formatSet: FormatSet;\n private _fallbackProvider?: FormatsProvider;\n\n public constructor(props: {formatSet: FormatSet, fallbackProvider?: FormatsProvider}) {\n this._formatSet = props.formatSet;\n this._fallbackProvider = props.fallbackProvider;\n }\n\n /**\n * Adds a format definition to the format set or updates an existing one.\n * @param name The name of the format to add or update\n * @param format The format definition to add or update\n */\n public async addFormat(name: string, format: FormatDefinition): Promise<void> {\n this._formatSet.formats[name] = format;\n this.onFormatsChanged.raiseEvent({ formatsChanged: [name] });\n }\n\n /**\n * Clears the fallback provider, if one is set.\n */\n public clearFallbackProvider(): void {\n this._fallbackProvider = undefined;\n }\n\n /**\n * Retrieves a format definition by its name from the format set. If not found, it checks the fallback provider to find the format, else returns undefined.\n */\n public async getFormat(input: string): Promise<FormatDefinition | undefined> {\n // Normalizes any schemaItem names coming from node addon 'schemaName:schemaItemName' -> 'schemaName.schemaItemName'\n const [schemaName, itemName] = SchemaItem.parseFullName(input);\n\n const name = (schemaName === \"\") ? itemName : `${schemaName}.${itemName}`;\n const format = this._formatSet.formats[name];\n if (format) return format;\n if (this._fallbackProvider) return this._fallbackProvider.getFormat(name);\n return undefined;\n }\n\n /**\n * Removes a format definition from the format set.\n * @param name The name of the format to remove\n */\n public async removeFormat(name: string): Promise<void> {\n delete this._formatSet.formats[name];\n this.onFormatsChanged.raiseEvent({ formatsChanged: [name] });\n }\n}\n"]}
1
+ {"version":3,"file":"FormatSetFormatsProvider.js","sourceRoot":"","sources":["../../../src/Formatting/FormatSetFormatsProvider.ts"],"names":[],"mappings":";;;AAAA,sDAA8C;AAG9C,uDAAoD;AAEpD;;;;GAIG;AACH,MAAa,wBAAwB;IAC5B,gBAAgB,GAAgD,IAAI,sBAAO,EAAsC,CAAC;IAEjH,UAAU,CAAY;IACtB,iBAAiB,CAAmB;IACpC,WAAW,CAAsB,CAAC,iDAAiD;IAE3F,YAAmB,KAAiE;QAClF,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,gBAAgB,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;QAE7C,wCAAwC;QACxC,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACrE,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC/B,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,SAAS,CAAC,IAAY,EAAE,MAAiC;QACpE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;QAEvC,4BAA4B;QAC5B,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAED,0EAA0E;QAC1E,MAAM,eAAe,GAAG,IAAI,CAAC,2BAA2B,CAAC,I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U,CAAC,CAAC;gBACnC,sDAAsD;gBACtD,MAAM,kBAAkB,GAAG,IAAI,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;gBACxE,KAAK,MAAM,WAAW,IAAI,kBAAkB,EAAE,CAAC;oBAC7C,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBACtC,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,kBAAkB,CAAC;IAC5B,CAAC;CACF;AA1ID,4DA0IC","sourcesContent":["import { BeEvent } from \"@itwin/core-bentley\";\nimport { FormatDefinition, FormatsChangedArgs, FormatsProvider, MutableFormatsProvider } from \"@itwin/core-quantity\";\nimport { FormatSet } from \"../Deserialization/JsonProps\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\n\n/**\n * A mutable format provider that manages format definitions within a format set.\n * When formats are added or removed, the underlying format set is automatically updated.\n * @beta\n */\nexport class FormatSetFormatsProvider implements MutableFormatsProvider {\n public onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void> = new BeEvent<(args: FormatsChangedArgs) => void>();\n\n private _formatSet: FormatSet;\n private _fallbackProvider?: FormatsProvider;\n private _references: Map<string, string>; // Maps format name to the reference it points to\n\n public constructor(props: {formatSet: FormatSet, fallbackProvider?: FormatsProvider}) {\n this._formatSet = props.formatSet;\n this._fallbackProvider = props.fallbackProvider;\n this._references = new Map<string, string>();\n\n // Build up the map of string references\n for (const [name, format] of Object.entries(this._formatSet.formats)) {\n if (typeof format === \"string\") {\n this._references.set(name, format);\n }\n }\n }\n\n /**\n * Adds or updates the format definition returned for a kind of quantity. Takes either a format definition or a kind of quantity full name that will be used to lookup the format that will be used.\n * @param name A kind of quantity full name used as a key to lookup this format\n * @param format The format definition or the name of a kind of quantity\n */\n public async addFormat(name: string, format: FormatDefinition | string): Promise<void> {\n this._formatSet.formats[name] = format;\n\n // Update the references map\n if (typeof format === \"string\") {\n this._references.set(name, format);\n } else {\n this._references.delete(name);\n }\n\n // Collect all formats that reference this format (directly or indirectly)\n const affectedFormats = this.getFormatsReferencingTarget(name);\n affectedFormats.add(name); // Include the format itself\n\n this.onFormatsChanged.raiseEvent({ formatsChanged: Array.from(affectedFormats) });\n }\n\n /**\n * Clears the fallback provider, if one is set.\n */\n public clearFallbackProvider(): void {\n this._fallbackProvider = undefined;\n }\n\n /**\n * Retrieves a format definition by its name from the format set. If not found, it checks the fallback provider to find the format, else returns undefined.\n * If the format is a string reference to another format, it resolves the reference and returns the FormatDefinition.\n */\n public async getFormat(input: string): Promise<FormatDefinition | undefined> {\n // Normalizes any schemaItem names coming from node addon 'schemaName:schemaItemName' -> 'schemaName.schemaItemName'\n const [schemaName, itemName] = SchemaItem.parseFullName(input);\n\n const name = (schemaName === \"\") ? itemName : `${schemaName}.${itemName}`;\n const format = this._formatSet.formats[name];\n\n if (format !== undefined) {\n // If format is a string reference, resolve it\n if (typeof format === \"string\") {\n return this.resolveReference(format);\n }\n return format;\n }\n\n if (this._fallbackProvider) return this._fallbackProvider.getFormat(name);\n return undefined;\n }\n\n /**\n * Resolves a string reference to its FormatDefinition, following chains of references.\n * @param reference The string reference to resolve\n * @param visited Set of visited references to detect circular references\n */\n private async resolveReference(reference: string, visited: Set<string> = new Set()): Promise<FormatDefinition | undefined> {\n // Prevent infinite loops from circular references\n if (visited.has(reference)) {\n return undefined;\n }\n visited.add(reference);\n\n const format = this._formatSet.formats[reference];\n\n if (format === undefined) {\n if (this._fallbackProvider) {\n return this._fallbackProvider.getFormat(reference);\n }\n return undefined;\n }\n\n // If we found another string reference, resolve it recursively\n if (typeof format === \"string\") {\n return this.resolveReference(format, visited);\n }\n\n return format;\n }\n\n /**\n * Removes a format definition or string reference from the format set.\n * @param name The name of the format to remove\n */\n public async removeFormat(name: string): Promise<void> {\n // Collect all formats that reference this format (directly or indirectly)\n const affectedFormats = this.getFormatsReferencingTarget(name);\n affectedFormats.add(name); // Include the format itself\n\n delete this._formatSet.formats[name];\n this._references.delete(name);\n\n this.onFormatsChanged.raiseEvent({ formatsChanged: Array.from(affectedFormats) });\n }\n\n /**\n * Gets all format names that reference the target format (directly or indirectly).\n * @param target The format name to find references to\n * @returns Set of format names that reference the target\n */\n private getFormatsReferencingTarget(target: string): Set<string> {\n const referencingFormats = new Set<string>();\n\n // Find all formats that directly reference the target\n for (const [formatName, reference] of this._references.entries()) {\n if (reference === target) {\n referencingFormats.add(formatName);\n // Recursively find formats that reference this format\n const indirectReferences = this.getFormatsReferencingTarget(formatName);\n for (const indirectRef of indirectReferences) {\n referencingFormats.add(indirectRef);\n }\n }\n }\n\n return referencingFormats;\n }\n}\n"]}
@@ -256,9 +256,13 @@ export interface FormatSet {
256
256
  description?: string;
257
257
  /** A [UnitSystemKey]($quantity) that determines the unit system for this format set. */
258
258
  unitSystem: UnitSystemKey;
259
- /** A mapping of kind of quantity identifiers to their corresponding format properties. */
259
+ /**
260
+ * A mapping of kind of quantity identifiers to their corresponding format properties.
261
+ * When a format is a [FormatDefinition]($quantity), it defines the complete format specification.
262
+ * When a format is a string, it references another kindOfQuantityId to map one format to another.
263
+ */
260
264
  formats: {
261
- [kindOfQuantityId: string]: FormatDefinition;
265
+ [kindOfQuantityId: string]: FormatDefinition | string;
262
266
  };
263
267
  }
264
268
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"JsonProps.d.ts","sourceRoot":"","sources":["../../../src/Deserialization/JsonProps.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEpF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,sBAAsB,GACtB,mBAAmB,GACnB,2BAA2B,GAC3B,wBAAwB,GACxB,uBAAuB,CAAC;AAC5B;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,gBAAgB,GAChB,UAAU,GACV,yBAAyB,GACzB,sBAAsB,CAAC;AAC3B;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,gBAAgB,GAChB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AAC,gBAAgB,EAAE,MAAM,GAAG,gBAAgB,GAAG,MAAM,CAAA;KAAE,CAAC;CACpE;AAED;;GAEG;AACH,MAAM,WAAW,6BAA8B,SAAQ,qBAAqB;IAC1E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"JsonProps.js","sourceRoot":"","sources":["../../../src/Deserialization/JsonProps.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG","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 Metadata\n */\n\nimport { FormatDefinition, FormatProps, UnitSystemKey } from \"@itwin/core-quantity\";\n\n/**\n * @public @preview\n */\nexport type AnyPropertyProps =\n | PrimitivePropertyProps\n | StructPropertyProps\n | PrimitiveArrayPropertyProps\n | StructArrayPropertyProps\n | NavigationPropertyProps;\n/**\n * @public @preview\n */\nexport type AnyClassProps =\n | EntityClassProps\n | MixinProps\n | CustomAttributeClassProps\n | RelationshipClassProps;\n/**\n * @public @preview\n */\nexport type AnySchemaItemProps =\n | AnyClassProps\n | EnumerationProps\n | KindOfQuantityProps\n | PropertyCategoryProps\n | SchemaItemUnitProps\n | InvertedUnitProps\n | ConstantProps\n | PhenomenonProps\n | SchemaItemFormatProps\n | SchemaItemOverrideFormatProps;\n\n/**\n * @public @preview\n */\nexport interface SchemaProps {\n readonly $schema: string;\n readonly name: string;\n readonly version: string;\n readonly alias: string;\n readonly label?: string;\n readonly description?: string;\n readonly references?: SchemaReferenceProps[];\n readonly items?: { [name: string]: SchemaItemProps };\n readonly customAttributes?: Array<{ [value: string]: any }>;\n readonly ecSpecMajorVersion?: number;\n readonly ecSpecMinorVersion?: number;\n}\n\n/**\n * JSON Object interface used to deserialize into a [[SchemaKey]].\n * @public @preview\n */\nexport interface SchemaKeyProps {\n /** The schema name */\n readonly name: string;\n /** Read version of the schema */\n readonly read: number;\n /** Write version of the schema */\n readonly write: number;\n /** Minor version of the schema */\n readonly minor: number;\n}\n\n/**\n * @public @preview\n */\nexport interface SchemaReferenceProps {\n readonly name: string;\n readonly version: string;\n}\n\n/**\n * @public @preview\n */\nexport interface SchemaItemProps {\n // NEEDSWORK: Still need to clarify how single-item deserialization works...\n readonly $schema?: string;\n readonly schema?: string; // conditionally required\n readonly schemaVersion?: string;\n readonly name?: string;\n readonly schemaItemType?: string;\n readonly label?: string;\n readonly description?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n readonly originalECSpecMajorVersion?: number;\n readonly originalECSpecMinorVersion?: number;\n}\n\n/**\n * @public @preview\n */\nexport interface ClassProps extends SchemaItemProps {\n readonly modifier?: string;\n readonly baseClass?: string;\n readonly properties?: AnyPropertyProps[];\n}\n\n/**\n * @public @preview\n */\nexport interface EntityClassProps extends ClassProps {\n readonly mixins?: string[];\n}\n\n/**\n * @public @preview\n */\nexport interface MixinProps extends ClassProps {\n readonly appliesTo: string;\n}\n\n/**\n * @public @preview\n */\nexport type StructClassProps = ClassProps;\n\n/**\n * @public @preview\n */\nexport interface CustomAttributeClassProps extends ClassProps {\n /**\n * Can be any combination of the [CustomAttributeContainerType]$(docs/bis/ec/customattribute-container-types.md) string values\n * separated by commas.\n */\n readonly appliesTo: string;\n}\n\n/**\n * @public @preview\n */\nexport interface RelationshipClassProps extends ClassProps {\n readonly strength: string;\n readonly strengthDirection: string;\n readonly source: RelationshipConstraintProps;\n readonly target: RelationshipConstraintProps;\n}\n\n/**\n * @public @preview\n */\nexport interface RelationshipConstraintProps {\n readonly multiplicity: string;\n readonly roleLabel: string;\n readonly polymorphic: boolean;\n readonly abstractConstraint?: string;\n readonly constraintClasses: string[];\n readonly customAttributes?: Array<{ [value: string]: any }>;\n}\n\n/**\n * @public @preview\n */\nexport interface EnumerationProps extends SchemaItemProps {\n readonly type: string;\n readonly isStrict: boolean;\n readonly enumerators: EnumeratorProps[];\n}\n\n/**\n * @public @preview\n */\nexport interface EnumeratorProps {\n readonly name: string;\n readonly value: string | number;\n readonly label?: string;\n readonly description?: string;\n}\n\n/**\n * @public @preview\n */\nexport interface KindOfQuantityProps extends SchemaItemProps {\n readonly persistenceUnit: string;\n readonly presentationUnits?: string | string[];\n readonly relativeError: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PropertyCategoryProps extends SchemaItemProps {\n readonly priority: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PropertyProps {\n readonly name: string;\n readonly type: string;\n readonly description?: string;\n readonly label?: string;\n readonly isReadOnly?: boolean;\n readonly category?: string;\n readonly priority?: number;\n readonly inherited?: boolean;\n readonly kindOfQuantity?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n}\n\n/**\n * @public @preview\n */\nexport interface PrimitiveOrEnumPropertyBaseProps extends PropertyProps {\n readonly extendedTypeName?: string;\n readonly minLength?: number;\n readonly maxLength?: number;\n readonly minValue?: number;\n readonly maxValue?: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PrimitivePropertyProps\n extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface StructPropertyProps extends PropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface EnumerationPropertyProps\n extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface ArrayPropertyProps extends PrimitiveOrEnumPropertyBaseProps {\n readonly minOccurs?: number;\n readonly maxOccurs?: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PrimitiveArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface StructArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface NavigationPropertyProps extends PropertyProps {\n readonly relationshipName: string;\n readonly direction: string;\n}\n\n/**\n * @public @preview\n */\nexport interface ConstantProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n}\n\n/**\n * @public @preview\n */\nexport type SchemaItemFormatProps = SchemaItemProps & FormatProps;\n\n/**\n * This interface defines properties necessary to support persistence of a set of formats.\n * @beta\n */\nexport interface FormatSet {\n /** The unique name identifier for this format set. */\n name: string;\n /** The display label for this format set. */\n label: string;\n /** The description for this format set. */\n description?: string;\n /** A [UnitSystemKey]($quantity) that determines the unit system for this format set. */\n unitSystem: UnitSystemKey;\n /** A mapping of kind of quantity identifiers to their corresponding format properties. */\n formats: { [kindOfQuantityId: string]: FormatDefinition };\n}\n\n/**\n * @public @preview\n */\nexport interface SchemaItemOverrideFormatProps extends SchemaItemFormatProps {\n readonly parent: string;\n}\n\n/**\n * @public @preview\n */\nexport interface InvertedUnitProps extends SchemaItemProps {\n readonly invertsUnit: string;\n readonly unitSystem: string;\n}\n\n/**\n * @public @preview\n */\nexport interface PhenomenonProps extends SchemaItemProps {\n readonly definition: string;\n}\n\n/**\n * @public @preview\n */\nexport type UnitSystemProps = SchemaItemProps;\n\n/**\n * @public @preview\n */\nexport interface SchemaItemUnitProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly unitSystem: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n readonly offset?: number;\n}\n"]}
1
+ {"version":3,"file":"JsonProps.js","sourceRoot":"","sources":["../../../src/Deserialization/JsonProps.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG","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 Metadata\n */\n\nimport { FormatDefinition, FormatProps, UnitSystemKey } from \"@itwin/core-quantity\";\n\n/**\n * @public @preview\n */\nexport type AnyPropertyProps =\n | PrimitivePropertyProps\n | StructPropertyProps\n | PrimitiveArrayPropertyProps\n | StructArrayPropertyProps\n | NavigationPropertyProps;\n/**\n * @public @preview\n */\nexport type AnyClassProps =\n | EntityClassProps\n | MixinProps\n | CustomAttributeClassProps\n | RelationshipClassProps;\n/**\n * @public @preview\n */\nexport type AnySchemaItemProps =\n | AnyClassProps\n | EnumerationProps\n | KindOfQuantityProps\n | PropertyCategoryProps\n | SchemaItemUnitProps\n | InvertedUnitProps\n | ConstantProps\n | PhenomenonProps\n | SchemaItemFormatProps\n | SchemaItemOverrideFormatProps;\n\n/**\n * @public @preview\n */\nexport interface SchemaProps {\n readonly $schema: string;\n readonly name: string;\n readonly version: string;\n readonly alias: string;\n readonly label?: string;\n readonly description?: string;\n readonly references?: SchemaReferenceProps[];\n readonly items?: { [name: string]: SchemaItemProps };\n readonly customAttributes?: Array<{ [value: string]: any }>;\n readonly ecSpecMajorVersion?: number;\n readonly ecSpecMinorVersion?: number;\n}\n\n/**\n * JSON Object interface used to deserialize into a [[SchemaKey]].\n * @public @preview\n */\nexport interface SchemaKeyProps {\n /** The schema name */\n readonly name: string;\n /** Read version of the schema */\n readonly read: number;\n /** Write version of the schema */\n readonly write: number;\n /** Minor version of the schema */\n readonly minor: number;\n}\n\n/**\n * @public @preview\n */\nexport interface SchemaReferenceProps {\n readonly name: string;\n readonly version: string;\n}\n\n/**\n * @public @preview\n */\nexport interface SchemaItemProps {\n // NEEDSWORK: Still need to clarify how single-item deserialization works...\n readonly $schema?: string;\n readonly schema?: string; // conditionally required\n readonly schemaVersion?: string;\n readonly name?: string;\n readonly schemaItemType?: string;\n readonly label?: string;\n readonly description?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n readonly originalECSpecMajorVersion?: number;\n readonly originalECSpecMinorVersion?: number;\n}\n\n/**\n * @public @preview\n */\nexport interface ClassProps extends SchemaItemProps {\n readonly modifier?: string;\n readonly baseClass?: string;\n readonly properties?: AnyPropertyProps[];\n}\n\n/**\n * @public @preview\n */\nexport interface EntityClassProps extends ClassProps {\n readonly mixins?: string[];\n}\n\n/**\n * @public @preview\n */\nexport interface MixinProps extends ClassProps {\n readonly appliesTo: string;\n}\n\n/**\n * @public @preview\n */\nexport type StructClassProps = ClassProps;\n\n/**\n * @public @preview\n */\nexport interface CustomAttributeClassProps extends ClassProps {\n /**\n * Can be any combination of the [CustomAttributeContainerType]$(docs/bis/ec/customattribute-container-types.md) string values\n * separated by commas.\n */\n readonly appliesTo: string;\n}\n\n/**\n * @public @preview\n */\nexport interface RelationshipClassProps extends ClassProps {\n readonly strength: string;\n readonly strengthDirection: string;\n readonly source: RelationshipConstraintProps;\n readonly target: RelationshipConstraintProps;\n}\n\n/**\n * @public @preview\n */\nexport interface RelationshipConstraintProps {\n readonly multiplicity: string;\n readonly roleLabel: string;\n readonly polymorphic: boolean;\n readonly abstractConstraint?: string;\n readonly constraintClasses: string[];\n readonly customAttributes?: Array<{ [value: string]: any }>;\n}\n\n/**\n * @public @preview\n */\nexport interface EnumerationProps extends SchemaItemProps {\n readonly type: string;\n readonly isStrict: boolean;\n readonly enumerators: EnumeratorProps[];\n}\n\n/**\n * @public @preview\n */\nexport interface EnumeratorProps {\n readonly name: string;\n readonly value: string | number;\n readonly label?: string;\n readonly description?: string;\n}\n\n/**\n * @public @preview\n */\nexport interface KindOfQuantityProps extends SchemaItemProps {\n readonly persistenceUnit: string;\n readonly presentationUnits?: string | string[];\n readonly relativeError: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PropertyCategoryProps extends SchemaItemProps {\n readonly priority: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PropertyProps {\n readonly name: string;\n readonly type: string;\n readonly description?: string;\n readonly label?: string;\n readonly isReadOnly?: boolean;\n readonly category?: string;\n readonly priority?: number;\n readonly inherited?: boolean;\n readonly kindOfQuantity?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n}\n\n/**\n * @public @preview\n */\nexport interface PrimitiveOrEnumPropertyBaseProps extends PropertyProps {\n readonly extendedTypeName?: string;\n readonly minLength?: number;\n readonly maxLength?: number;\n readonly minValue?: number;\n readonly maxValue?: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PrimitivePropertyProps\n extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface StructPropertyProps extends PropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface EnumerationPropertyProps\n extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface ArrayPropertyProps extends PrimitiveOrEnumPropertyBaseProps {\n readonly minOccurs?: number;\n readonly maxOccurs?: number;\n}\n\n/**\n * @public @preview\n */\nexport interface PrimitiveArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface StructArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @public @preview\n */\nexport interface NavigationPropertyProps extends PropertyProps {\n readonly relationshipName: string;\n readonly direction: string;\n}\n\n/**\n * @public @preview\n */\nexport interface ConstantProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n}\n\n/**\n * @public @preview\n */\nexport type SchemaItemFormatProps = SchemaItemProps & FormatProps;\n\n/**\n * This interface defines properties necessary to support persistence of a set of formats.\n * @beta\n */\nexport interface FormatSet {\n /** The unique name identifier for this format set. */\n name: string;\n /** The display label for this format set. */\n label: string;\n /** The description for this format set. */\n description?: string;\n /** A [UnitSystemKey]($quantity) that determines the unit system for this format set. */\n unitSystem: UnitSystemKey;\n /** \n * A mapping of kind of quantity identifiers to their corresponding format properties.\n * When a format is a [FormatDefinition]($quantity), it defines the complete format specification.\n * When a format is a string, it references another kindOfQuantityId to map one format to another.\n */\n formats: { [kindOfQuantityId: string]: FormatDefinition | string };\n}\n\n/**\n * @public @preview\n */\nexport interface SchemaItemOverrideFormatProps extends SchemaItemFormatProps {\n readonly parent: string;\n}\n\n/**\n * @public @preview\n */\nexport interface InvertedUnitProps extends SchemaItemProps {\n readonly invertsUnit: string;\n readonly unitSystem: string;\n}\n\n/**\n * @public @preview\n */\nexport interface PhenomenonProps extends SchemaItemProps {\n readonly definition: string;\n}\n\n/**\n * @public @preview\n */\nexport type UnitSystemProps = SchemaItemProps;\n\n/**\n * @public @preview\n */\nexport interface SchemaItemUnitProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly unitSystem: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n readonly offset?: number;\n}\n"]}
@@ -10,28 +10,42 @@ export declare class FormatSetFormatsProvider implements MutableFormatsProvider
10
10
  onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>;
11
11
  private _formatSet;
12
12
  private _fallbackProvider?;
13
+ private _references;
13
14
  constructor(props: {
14
15
  formatSet: FormatSet;
15
16
  fallbackProvider?: FormatsProvider;
16
17
  });
17
18
  /**
18
- * Adds a format definition to the format set or updates an existing one.
19
- * @param name The name of the format to add or update
20
- * @param format The format definition to add or update
19
+ * Adds or updates the format definition returned for a kind of quantity. Takes either a format definition or a kind of quantity full name that will be used to lookup the format that will be used.
20
+ * @param name A kind of quantity full name used as a key to lookup this format
21
+ * @param format The format definition or the name of a kind of quantity
21
22
  */
22
- addFormat(name: string, format: FormatDefinition): Promise<void>;
23
+ addFormat(name: string, format: FormatDefinition | string): Promise<void>;
23
24
  /**
24
25
  * Clears the fallback provider, if one is set.
25
26
  */
26
27
  clearFallbackProvider(): void;
27
28
  /**
28
29
  * Retrieves a format definition by its name from the format set. If not found, it checks the fallback provider to find the format, else returns undefined.
30
+ * If the format is a string reference to another format, it resolves the reference and returns the FormatDefinition.
29
31
  */
30
32
  getFormat(input: string): Promise<FormatDefinition | undefined>;
31
33
  /**
32
- * Removes a format definition from the format set.
34
+ * Resolves a string reference to its FormatDefinition, following chains of references.
35
+ * @param reference The string reference to resolve
36
+ * @param visited Set of visited references to detect circular references
37
+ */
38
+ private resolveReference;
39
+ /**
40
+ * Removes a format definition or string reference from the format set.
33
41
  * @param name The name of the format to remove
34
42
  */
35
43
  removeFormat(name: string): Promise<void>;
44
+ /**
45
+ * Gets all format names that reference the target format (directly or indirectly).
46
+ * @param target The format name to find references to
47
+ * @returns Set of format names that reference the target
48
+ */
49
+ private getFormatsReferencingTarget;
36
50
  }
37
51
  //# sourceMappingURL=FormatSetFormatsProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormatSetFormatsProvider.d.ts","sourceRoot":"","sources":["../../../src/Formatting/FormatSetFormatsProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACrH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD;;;;G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,EAAE,eAAe,CAAA;KAAC;IAapF;;;;OAIG;IACU,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBtF;;OAEG;IACI,qBAAqB,IAAI,IAAI;IAIpC;;;OAGG;IACU,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAmB5E;;;;OAIG;YACW,gBAAgB;IAwB9B;;;OAGG;IACU,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWtD;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;CAiBpC"}
@@ -9,18 +9,36 @@ export class FormatSetFormatsProvider {
9
9
  onFormatsChanged = new BeEvent();
10
10
  _formatSet;
11
11
  _fallbackProvider;
12
+ _references; // Maps format name to the reference it points to
12
13
  constructor(props) {
13
14
  this._formatSet = props.formatSet;
14
15
  this._fallbackProvider = props.fallbackProvider;
16
+ this._references = new Map();
17
+ // Build up the map of string references
18
+ for (const [name, format] of Object.entries(this._formatSet.formats)) {
19
+ if (typeof format === "string") {
20
+ this._references.set(name, format);
21
+ }
22
+ }
15
23
  }
16
24
  /**
17
- * Adds a format definition to the format set or updates an existing one.
18
- * @param name The name of the format to add or update
19
- * @param format The format definition to add or update
25
+ * Adds or updates the format definition returned for a kind of quantity. Takes either a format definition or a kind of quantity full name that will be used to lookup the format that will be used.
26
+ * @param name A kind of quantity full name used as a key to lookup this format
27
+ * @param format The format definition or the name of a kind of quantity
20
28
  */
21
29
  async addFormat(name, format) {
22
30
  this._formatSet.formats[name] = format;
23
- this.onFormatsChanged.raiseEvent({ formatsChanged: [name] });
31
+ // Update the references map
32
+ if (typeof format === "string") {
33
+ this._references.set(name, format);
34
+ }
35
+ else {
36
+ this._references.delete(name);
37
+ }
38
+ // Collect all formats that reference this format (directly or indirectly)
39
+ const affectedFormats = this.getFormatsReferencingTarget(name);
40
+ affectedFormats.add(name); // Include the format itself
41
+ this.onFormatsChanged.raiseEvent({ formatsChanged: Array.from(affectedFormats) });
24
42
  }
25
43
  /**
26
44
  * Clears the fallback provider, if one is set.
@@ -30,25 +48,79 @@ export class FormatSetFormatsProvider {
30
48
  }
31
49
  /**
32
50
  * Retrieves a format definition by its name from the format set. If not found, it checks the fallback provider to find the format, else returns undefined.
51
+ * If the format is a string reference to another format, it resolves the reference and returns the FormatDefinition.
33
52
  */
34
53
  async getFormat(input) {
35
54
  // Normalizes any schemaItem names coming from node addon 'schemaName:schemaItemName' -> 'schemaName.schemaItemName'
36
55
  const [schemaName, itemName] = SchemaItem.parseFullName(input);
37
56
  const name = (schemaName === "") ? itemName : `${schemaName}.${itemName}`;
38
57
  const format = this._formatSet.formats[name];
39
- if (format)
58
+ if (format !== undefined) {
59
+ // If format is a string reference, resolve it
60
+ if (typeof format === "string") {
61
+ return this.resolveReference(format);
62
+ }
40
63
  return format;
64
+ }
41
65
  if (this._fallbackProvider)
42
66
  return this._fallbackProvider.getFormat(name);
43
67
  return undefined;
44
68
  }
45
69
  /**
46
- * Removes a format definition from the format set.
70
+ * Resolves a string reference to its FormatDefinition, following chains of references.
71
+ * @param reference The string reference to resolve
72
+ * @param visited Set of visited references to detect circular references
73
+ */
74
+ async resolveReference(reference, visited = new Set()) {
75
+ // Prevent infinite loops from circular references
76
+ if (visited.has(reference)) {
77
+ return undefined;
78
+ }
79
+ visited.add(reference);
80
+ const format = this._formatSet.formats[reference];
81
+ if (format === undefined) {
82
+ if (this._fallbackProvider) {
83
+ return this._fallbackProvider.getFormat(reference);
84
+ }
85
+ return undefined;
86
+ }
87
+ // If we found another string reference, resolve it recursively
88
+ if (typeof format === "string") {
89
+ return this.resolveReference(format, visited);
90
+ }
91
+ return format;
92
+ }
93
+ /**
94
+ * Removes a format definition or string reference from the format set.
47
95
  * @param name The name of the format to remove
48
96
  */
49
97
  async removeFormat(name) {
98
+ // Collect all formats that reference this format (directly or indirectly)
99
+ const affectedFormats = this.getFormatsReferencingTarget(name);
100
+ affectedFormats.add(name); // Include the format itself
50
101
  delete this._formatSet.formats[name];
51
- this.onFormatsChanged.raiseEvent({ formatsChanged: [name] });
102
+ this._references.delete(name);
103
+ this.onFormatsChanged.raiseEvent({ formatsChanged: Array.from(affectedFormats) });
104
+ }
105
+ /**
106
+ * Gets all format names that reference the target format (directly or indirectly).
107
+ * @param target The format name to find references to
108
+ * @returns Set of format names that reference the target
109
+ */
110
+ getFormatsReferencingTarget(target) {
111
+ const referencingFormats = new Set();
112
+ // Find all formats that directly reference the target
113
+ for (const [formatName, reference] of this._references.entries()) {
114
+ if (reference === target) {
115
+ referencingFormats.add(formatName);
116
+ // Recursively find formats that reference this format
117
+ const indirectReferences = this.getFormatsReferencingTarget(formatName);
118
+ for (const indirectRef of indirectReferences) {
119
+ referencingFormats.add(indirectRef);
120
+ }
121
+ }
122
+ }
123
+ return referencingFormats;
52
124
  }
53
125
  }
54
126
  //# sourceMappingURL=FormatSetFormatsProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormatSetFormatsProvider.js","sourceRoot":"","sources":["../../../src/Formatting/FormatSetFormatsProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,OAAO,wBAAwB;IAC5B,gBAAgB,GAAgD,IAAI,OAAO,EAAsC,CAAC;IAEjH,UAAU,CAAY;IACtB,iBAAiB,CAAmB;IAE5C,YAAmB,KAAiE;QAClF,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,gBAAgB,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,SAAS,CAAC,IAAY,EAAE,MAAwB;QAC3D,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;QACvC,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACI,qBAAqB;QAC1B,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,SAAS,CAAC,KAAa;QAClC,oHAAoH;QACpH,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE/D,MAAM,IAAI,GAAG,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,QAAQ,EAAE,CAAC;QAC1E,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;QAC1B,IAAI,IAAI,CAAC,iBAAiB;YAAE,OAAO,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC1E,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,YAAY,CAAC,IAAY;QACpC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["import { BeEvent } from \"@itwin/core-bentley\";\nimport { FormatDefinition, FormatsChangedArgs, FormatsProvider, MutableFormatsProvider } from \"@itwin/core-quantity\";\nimport { FormatSet } from \"../Deserialization/JsonProps\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\n\n/**\n * A mutable format provider that manages format definitions within a format set.\n * When formats are added or removed, the underlying format set is automatically updated.\n * @beta\n */\nexport class FormatSetFormatsProvider implements MutableFormatsProvider {\n public onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void> = new BeEvent<(args: FormatsChangedArgs) => void>();\n\n private _formatSet: FormatSet;\n private _fallbackProvider?: FormatsProvider;\n\n public constructor(props: {formatSet: FormatSet, fallbackProvider?: FormatsProvider}) {\n this._formatSet = props.formatSet;\n this._fallbackProvider = props.fallbackProvider;\n }\n\n /**\n * Adds a format definition to the format set or updates an existing one.\n * @param name The name of the format to add or update\n * @param format The format definition to add or update\n */\n public async addFormat(name: string, format: FormatDefinition): Promise<void> {\n this._formatSet.formats[name] = format;\n this.onFormatsChanged.raiseEvent({ formatsChanged: [name] });\n }\n\n /**\n * Clears the fallback provider, if one is set.\n */\n public clearFallbackProvider(): void {\n this._fallbackProvider = undefined;\n }\n\n /**\n * Retrieves a format definition by its name from the format set. If not found, it checks the fallback provider to find the format, else returns undefined.\n */\n public async getFormat(input: string): Promise<FormatDefinition | undefined> {\n // Normalizes any schemaItem names coming from node addon 'schemaName:schemaItemName' -> 'schemaName.schemaItemName'\n const [schemaName, itemName] = SchemaItem.parseFullName(input);\n\n const name = (schemaName === \"\") ? itemName : `${schemaName}.${itemName}`;\n const format = this._formatSet.formats[name];\n if (format) return format;\n if (this._fallbackProvider) return this._fallbackProvider.getFormat(name);\n return undefined;\n }\n\n /**\n * Removes a format definition from the format set.\n * @param name The name of the format to remove\n */\n public async removeFormat(name: string): Promise<void> {\n delete this._formatSet.formats[name];\n this.onFormatsChanged.raiseEvent({ formatsChanged: [name] });\n }\n}\n"]}
1
+ {"version":3,"file":"FormatSetFormatsProvider.js","sourceRoot":"","sources":["../../../src/Formatting/FormatSetFormatsProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,OAAO,wBAA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,CAAC,WAAW,CAAC,CAAC;gBACtC,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,kBAAkB,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { BeEvent } from \"@itwin/core-bentley\";\nimport { FormatDefinition, FormatsChangedArgs, FormatsProvider, MutableFormatsProvider } from \"@itwin/core-quantity\";\nimport { FormatSet } from \"../Deserialization/JsonProps\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\n\n/**\n * A mutable format provider that manages format definitions within a format set.\n * When formats are added or removed, the underlying format set is automatically updated.\n * @beta\n */\nexport class FormatSetFormatsProvider implements MutableFormatsProvider {\n public onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void> = new BeEvent<(args: FormatsChangedArgs) => void>();\n\n private _formatSet: FormatSet;\n private _fallbackProvider?: FormatsProvider;\n private _references: Map<string, string>; // Maps format name to the reference it points to\n\n public constructor(props: {formatSet: FormatSet, fallbackProvider?: FormatsProvider}) {\n this._formatSet = props.formatSet;\n this._fallbackProvider = props.fallbackProvider;\n this._references = new Map<string, string>();\n\n // Build up the map of string references\n for (const [name, format] of Object.entries(this._formatSet.formats)) {\n if (typeof format === \"string\") {\n this._references.set(name, format);\n }\n }\n }\n\n /**\n * Adds or updates the format definition returned for a kind of quantity. Takes either a format definition or a kind of quantity full name that will be used to lookup the format that will be used.\n * @param name A kind of quantity full name used as a key to lookup this format\n * @param format The format definition or the name of a kind of quantity\n */\n public async addFormat(name: string, format: FormatDefinition | string): Promise<void> {\n this._formatSet.formats[name] = format;\n\n // Update the references map\n if (typeof format === \"string\") {\n this._references.set(name, format);\n } else {\n this._references.delete(name);\n }\n\n // Collect all formats that reference this format (directly or indirectly)\n const affectedFormats = this.getFormatsReferencingTarget(name);\n affectedFormats.add(name); // Include the format itself\n\n this.onFormatsChanged.raiseEvent({ formatsChanged: Array.from(affectedFormats) });\n }\n\n /**\n * Clears the fallback provider, if one is set.\n */\n public clearFallbackProvider(): void {\n this._fallbackProvider = undefined;\n }\n\n /**\n * Retrieves a format definition by its name from the format set. If not found, it checks the fallback provider to find the format, else returns undefined.\n * If the format is a string reference to another format, it resolves the reference and returns the FormatDefinition.\n */\n public async getFormat(input: string): Promise<FormatDefinition | undefined> {\n // Normalizes any schemaItem names coming from node addon 'schemaName:schemaItemName' -> 'schemaName.schemaItemName'\n const [schemaName, itemName] = SchemaItem.parseFullName(input);\n\n const name = (schemaName === \"\") ? itemName : `${schemaName}.${itemName}`;\n const format = this._formatSet.formats[name];\n\n if (format !== undefined) {\n // If format is a string reference, resolve it\n if (typeof format === \"string\") {\n return this.resolveReference(format);\n }\n return format;\n }\n\n if (this._fallbackProvider) return this._fallbackProvider.getFormat(name);\n return undefined;\n }\n\n /**\n * Resolves a string reference to its FormatDefinition, following chains of references.\n * @param reference The string reference to resolve\n * @param visited Set of visited references to detect circular references\n */\n private async resolveReference(reference: string, visited: Set<string> = new Set()): Promise<FormatDefinition | undefined> {\n // Prevent infinite loops from circular references\n if (visited.has(reference)) {\n return undefined;\n }\n visited.add(reference);\n\n const format = this._formatSet.formats[reference];\n\n if (format === undefined) {\n if (this._fallbackProvider) {\n return this._fallbackProvider.getFormat(reference);\n }\n return undefined;\n }\n\n // If we found another string reference, resolve it recursively\n if (typeof format === \"string\") {\n return this.resolveReference(format, visited);\n }\n\n return format;\n }\n\n /**\n * Removes a format definition or string reference from the format set.\n * @param name The name of the format to remove\n */\n public async removeFormat(name: string): Promise<void> {\n // Collect all formats that reference this format (directly or indirectly)\n const affectedFormats = this.getFormatsReferencingTarget(name);\n affectedFormats.add(name); // Include the format itself\n\n delete this._formatSet.formats[name];\n this._references.delete(name);\n\n this.onFormatsChanged.raiseEvent({ formatsChanged: Array.from(affectedFormats) });\n }\n\n /**\n * Gets all format names that reference the target format (directly or indirectly).\n * @param target The format name to find references to\n * @returns Set of format names that reference the target\n */\n private getFormatsReferencingTarget(target: string): Set<string> {\n const referencingFormats = new Set<string>();\n\n // Find all formats that directly reference the target\n for (const [formatName, reference] of this._references.entries()) {\n if (reference === target) {\n referencingFormats.add(formatName);\n // Recursively find formats that reference this format\n const indirectReferences = this.getFormatsReferencingTarget(formatName);\n for (const indirectRef of indirectReferences) {\n referencingFormats.add(indirectRef);\n }\n }\n }\n\n return referencingFormats;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/ecschema-metadata",
3
- "version": "5.3.0-dev.8",
3
+ "version": "5.4.0-dev.2",
4
4
  "description": "ECObjects core concepts in typescript",
5
5
  "license": "MIT",
6
6
  "main": "lib/cjs/ecschema-metadata.js",
@@ -48,13 +48,13 @@
48
48
  "rimraf": "^6.0.1",
49
49
  "sinon": "^17.0.2",
50
50
  "typescript": "~5.6.2",
51
- "@itwin/build-tools": "5.3.0-dev.8",
52
- "@itwin/core-bentley": "5.3.0-dev.8",
53
- "@itwin/core-quantity": "5.3.0-dev.8"
51
+ "@itwin/core-bentley": "5.4.0-dev.2",
52
+ "@itwin/build-tools": "5.4.0-dev.2",
53
+ "@itwin/core-quantity": "5.4.0-dev.2"
54
54
  },
55
55
  "peerDependencies": {
56
- "@itwin/core-bentley": "5.3.0-dev.8",
57
- "@itwin/core-quantity": "5.3.0-dev.8"
56
+ "@itwin/core-quantity": "5.4.0-dev.2",
57
+ "@itwin/core-bentley": "5.4.0-dev.2"
58
58
  },
59
59
  "nyc": {
60
60
  "extends": "./node_modules/@itwin/build-tools/.nycrc"