@itwin/ecschema-metadata 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 (122) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/Constants.js.map +1 -1
  3. package/lib/cjs/DelayedPromise.js.map +1 -1
  4. package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
  5. package/lib/cjs/Deserialization/Helper.js.map +1 -1
  6. package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
  7. package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
  8. package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
  9. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  10. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  11. package/lib/cjs/ECName.js.map +1 -1
  12. package/lib/cjs/ECObjects.js.map +1 -1
  13. package/lib/cjs/Exception.js.map +1 -1
  14. package/lib/cjs/Formatting/FormatSetFormatsProvider.js.map +1 -1
  15. package/lib/cjs/Formatting/SchemaFormatsProvider.js.map +1 -1
  16. package/lib/cjs/IncrementalLoading/ClassParsers.js.map +1 -1
  17. package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
  18. package/lib/cjs/IncrementalLoading/FullSchemaQueries.js +466 -466
  19. package/lib/cjs/IncrementalLoading/FullSchemaQueries.js.map +1 -1
  20. package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
  21. package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
  22. package/lib/cjs/IncrementalLoading/SchemaItemParsers.js.map +1 -1
  23. package/lib/cjs/IncrementalLoading/SchemaItemQueries.js +235 -235
  24. package/lib/cjs/IncrementalLoading/SchemaItemQueries.js.map +1 -1
  25. package/lib/cjs/IncrementalLoading/SchemaParser.js.map +1 -1
  26. package/lib/cjs/IncrementalLoading/SchemaStubQueries.js +309 -309
  27. package/lib/cjs/IncrementalLoading/SchemaStubQueries.js.map +1 -1
  28. package/lib/cjs/Interfaces.js.map +1 -1
  29. package/lib/cjs/Metadata/Class.js.map +1 -1
  30. package/lib/cjs/Metadata/Constant.js.map +1 -1
  31. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  32. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  33. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  34. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  35. package/lib/cjs/Metadata/Format.js.map +1 -1
  36. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  37. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  38. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  39. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  40. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  41. package/lib/cjs/Metadata/Property.js.map +1 -1
  42. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  43. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  44. package/lib/cjs/Metadata/Schema.js.map +1 -1
  45. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  46. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  47. package/lib/cjs/PropertyTypes.js.map +1 -1
  48. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  49. package/lib/cjs/SchemaKey.js.map +1 -1
  50. package/lib/cjs/SchemaLoader.js.map +1 -1
  51. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  52. package/lib/cjs/UnitConversion/Graph.js.map +1 -1
  53. package/lib/cjs/UnitConversion/Parser.js.map +1 -1
  54. package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
  55. package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
  56. package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
  57. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  58. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  59. package/lib/cjs/ecschema-metadata.js.map +1 -1
  60. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  61. package/lib/cjs/utils/SchemaLoadingController.js.map +1 -1
  62. package/lib/esm/Constants.js.map +1 -1
  63. package/lib/esm/DelayedPromise.js.map +1 -1
  64. package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
  65. package/lib/esm/Deserialization/Helper.js.map +1 -1
  66. package/lib/esm/Deserialization/JsonParser.js.map +1 -1
  67. package/lib/esm/Deserialization/JsonProps.js.map +1 -1
  68. package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
  69. package/lib/esm/Deserialization/XmlParser.js.map +1 -1
  70. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  71. package/lib/esm/ECName.js.map +1 -1
  72. package/lib/esm/ECObjects.js.map +1 -1
  73. package/lib/esm/Exception.js.map +1 -1
  74. package/lib/esm/Formatting/FormatSetFormatsProvider.js.map +1 -1
  75. package/lib/esm/Formatting/SchemaFormatsProvider.js.map +1 -1
  76. package/lib/esm/IncrementalLoading/ClassParsers.js.map +1 -1
  77. package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
  78. package/lib/esm/IncrementalLoading/FullSchemaQueries.js +466 -466
  79. package/lib/esm/IncrementalLoading/FullSchemaQueries.js.map +1 -1
  80. package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
  81. package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
  82. package/lib/esm/IncrementalLoading/SchemaItemParsers.js.map +1 -1
  83. package/lib/esm/IncrementalLoading/SchemaItemQueries.js +235 -235
  84. package/lib/esm/IncrementalLoading/SchemaItemQueries.js.map +1 -1
  85. package/lib/esm/IncrementalLoading/SchemaParser.js.map +1 -1
  86. package/lib/esm/IncrementalLoading/SchemaStubQueries.js +309 -309
  87. package/lib/esm/IncrementalLoading/SchemaStubQueries.js.map +1 -1
  88. package/lib/esm/Interfaces.js.map +1 -1
  89. package/lib/esm/Metadata/Class.js.map +1 -1
  90. package/lib/esm/Metadata/Constant.js.map +1 -1
  91. package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
  92. package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
  93. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  94. package/lib/esm/Metadata/Enumeration.js.map +1 -1
  95. package/lib/esm/Metadata/Format.js.map +1 -1
  96. package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
  97. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  98. package/lib/esm/Metadata/Mixin.js.map +1 -1
  99. package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
  100. package/lib/esm/Metadata/Phenomenon.js.map +1 -1
  101. package/lib/esm/Metadata/Property.js.map +1 -1
  102. package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
  103. package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
  104. package/lib/esm/Metadata/Schema.js.map +1 -1
  105. package/lib/esm/Metadata/SchemaItem.js.map +1 -1
  106. package/lib/esm/Metadata/UnitSystem.js.map +1 -1
  107. package/lib/esm/PropertyTypes.js.map +1 -1
  108. package/lib/esm/SchemaJsonLocater.js.map +1 -1
  109. package/lib/esm/SchemaKey.js.map +1 -1
  110. package/lib/esm/SchemaLoader.js.map +1 -1
  111. package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
  112. package/lib/esm/UnitConversion/Graph.js.map +1 -1
  113. package/lib/esm/UnitConversion/Parser.js.map +1 -1
  114. package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
  115. package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
  116. package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
  117. package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
  118. package/lib/esm/Validation/SchemaWalker.js.map +1 -1
  119. package/lib/esm/ecschema-metadata.js.map +1 -1
  120. package/lib/esm/utils/SchemaGraph.js.map +1 -1
  121. package/lib/esm/utils/SchemaLoadingController.js.map +1 -1
  122. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"OverrideFormat.js","sourceRoot":"","sources":["../../../src/Metadata/OverrideFormat.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAyOH,wCAEC;AAzOD,oFAAiF;AACjF,4CAA8C;AAC9C,wDAAqK;AAMrK,4CAA6D;AAW7D;;;GAGG;AACH,MAAa,cAAc;IACjB,UAAU,CAA0C;IACpD,MAAM,CAAwE;IAEtF,uDAAuD;IACvC,MAAM,CAAS;IAE/B;;;OAGG;IACa,IAAI,CAAS;IAE7B,gBAAgB;IAChB,YAAY,MAAc,EAAE,SAAkD,EAAE,aAAoF;QAClK,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,4BAA4B,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QAC1F,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC;IAC9B,CAAC;IAED,mCAAmC;IACnC,IAAW,SAAS;QAClB,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;IACnF,CAAC;IAED,IAAW,KAAK;QACd,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IACvE,CAAC;IAED,sCAAsC;IACtC,IAAW,QAAQ,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,IAAW,WAAW,KAAa,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;IACpE,IAAW,IAAI,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CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gBACvD,WAAW,EAAE,CAAC,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;gBACxE,KAAK;aACN,CAAC;QACJ,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AA3MD,wCA2MC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,MAA+B;IAC5D,OAAO,cAAc,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,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 Metadata\n */\n\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { DecimalPrecision, FormatProps, formatStringRgx, FormatTraits, FormatType, FractionalPrecision, ScientificType, ShowSignOption } from \"@itwin/core-quantity\";\nimport { Format } from \"./Format\";\nimport { Schema } from \"./Schema\";\nimport { SchemaItemOverrideFormatProps } from \"../Deserialization/JsonProps\";\nimport { Mutable } from \"@itwin/core-bentley\";\nimport { LazyLoadedInvertedUnit, LazyLoadedUnit } from \"../Interfaces\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\n\n/**\n * @public @preview\n */\nexport interface OverrideFormatProps {\n readonly name: string;\n readonly precision?: number;\n readonly unitAndLabels?: Array<[string, string | undefined]>; // Tuple of [unit name | unit label]\n}\n\n/**\n * Overrides of a Format, from a Schema, and is SchemaItem that is used specifically on KindOfQuantity.\n * @public @preview\n */\nexport class OverrideFormat {\n private _precision?: DecimalPrecision | FractionalPrecision;\n private _units?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>;\n\n /** The Format that this OverrideFormat is extending */\n public readonly parent: Format;\n\n /** The name of this OverrideFormat.\n *\n * This should be set to the [FormatString]($docs/bis/ec/kindofquantity/#format-string) which represents the format override.\n */\n public readonly name: string;\n\n /** @internal */\n constructor(parent: Format, precision?: DecimalPrecision | FractionalPrecision, unitAndLabels?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>) {\n this.parent = parent;\n this.name = OverrideFormat.createOverrideFormatFullName(parent, precision, unitAndLabels);\n this._precision = precision;\n this._units = unitAndLabels;\n }\n\n // Properties that can be overriden\n public get precision(): DecimalPrecision | FractionalPrecision {\n return (undefined === this._precision) ? this.parent.precision : this._precision;\n }\n\n public get units(): ReadonlyArray<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined {\n return (undefined === this._units) ? this.parent.units : this._units;\n }\n\n // Properties that cannot be overriden\n public get fullName(): string { return this.name; }\n public get roundFactor(): number { return this.parent.roundFactor; }\n public get type(): FormatType { return this.parent.type; }\n public get minWidth(): number | undefined { return this.parent.minWidth; }\n public get scientificType(): ScientificType | undefined { return this.parent.scientificType; }\n public get showSignOption(): ShowSignOption { return this.parent.showSignOption; }\n public get decimalSeparator(): string { return this.parent.decimalSeparator; }\n public get thousandSeparator(): string { return this.parent.thousandSeparator; }\n public get uomSeparator(): string { return this.parent.uomSeparator; }\n public get stationSeparator(): string { return this.parent.stationSeparator; }\n public get stationOffsetSize(): number | undefined { return this.parent.stationOffsetSize; }\n public get formatTraits(): FormatTraits { return this.parent.formatTraits; }\n public get spacer(): string | undefined { return this.parent.spacer; }\n public get includeZero(): boolean | undefined { return this.parent.includeZero; }\n\n public hasFormatTrait(formatTrait: FormatTraits) {\n return (this.parent.formatTraits & formatTrait) === formatTrait;\n }\n\n /** Returns the format string of this override in the Xml full name format.\n * @internal\n */\n public fullNameXml(koqSchema: Schema): string {\n let fullName = XmlSerializationUtils.createXmlTypedName(koqSchema, this.parent.schema, this.parent.name);\n\n if (undefined !== this.precision)\n fullName += `(${this.precision.toString()})`;\n\n if (undefined === this._units)\n return fullName;\n for (const [unit, unitLabel] of this._units) {\n const unitSchema = koqSchema.context.getSchemaSync(unit.schemaKey);\n if(unitSchema === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The unit schema ${unit.schemaKey} is not found in the context.`);\n\n fullName += \"[\";\n fullName += XmlSerializationUtils.createXmlTypedName(koqSchema, unitSchema, unit.name);\n if (unitLabel !== undefined)\n fullName += `|${unitLabel}`;\n fullName += `]`;\n }\n return fullName;\n }\n\n /**\n * Creates a valid OverrideFormat fullName from the parent Format and overridden units.\n * @param parent The parent Format.\n * @param unitAndLabels The overridden unit and labels collection.\n */\n public static createOverrideFormatFullName(parent: Format, precision?: DecimalPrecision | FractionalPrecision, unitAndLabels?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): string {\n let fullName = parent.fullName;\n\n if (precision)\n fullName += `(${precision.toString()})`;\n\n if (undefined === unitAndLabels)\n return fullName;\n for (const [unit, unitLabel] of unitAndLabels)\n if (undefined === unitLabel)\n fullName += `[${unit.fullName}]`;\n else\n fullName += `[${unit.fullName}|${unitLabel}]`;\n return fullName;\n }\n\n /** Parses the format string into the parts that make up an Override Format\n * @param formatString\n */\n public static parseFormatString(formatString: string): OverrideFormatProps {\n const match = formatString.split(formatStringRgx); // split string based on regex groups\n if (undefined === match[1])\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The format string, ${formatString}, on KindOfQuantity is missing a format.`);\n\n let precision: OverrideFormatProps[\"precision\"];\n if (undefined !== match[2] && undefined !== match[3]) {\n const overrideString = match[2];\n const tokens: string[] = [];\n let prevPos = 1; // Initial position is the character directly after the opening '(' in the override string.\n let currPos;\n\n // TODO need to include `,` as a valid search argument.\n while (-1 !== (currPos = overrideString.indexOf(\")\", prevPos))) {\n tokens.push(overrideString.substring(prevPos, currPos));\n prevPos = currPos + 1;\n }\n\n if (overrideString.length > 0 && undefined === tokens.find((token) => {\n return \"\" !== token; // there is at least one token that is not empty.\n })) {\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n }\n\n // The first override parameter overrides the default precision of the format\n const precisionIndx: number = 0;\n if (tokens.length >= precisionIndx + 1) {\n if (tokens[precisionIndx].length > 0) {\n precision = Number.parseInt(tokens[precisionIndx], 10);\n if (Number.isNaN(precision))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The format string '${formatString}' on KindOfQuantity has a precision override '${tokens[precisionIndx]}' that is not number.`);\n }\n }\n }\n\n let i = 4;\n let unitAndLabels: OverrideFormatProps[\"unitAndLabels\"];\n while (i < match.length - 1) { // The regex match ends with an empty last value, which causes problems when exactly 4 unit overrides as specified, so ignore this last empty value\n if (undefined === match[i])\n break;\n // Unit override required\n if (undefined === match[i + 1])\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n\n if (undefined === unitAndLabels)\n unitAndLabels = [];\n\n if (undefined !== match[i + 2]) // matches '|'\n unitAndLabels.push([match[i + 1], match[i + 3] ?? \"\"]); // add unit name and label override (if '|' matches and next value is undefined, save it as an empty string)\n else\n unitAndLabels.push([match[i + 1], undefined]); // add unit name\n\n i += 4;\n }\n\n return { name: match[1], precision, unitAndLabels };\n }\n\n /**\n * @internal\n */\n public static isOverrideFormat(format: unknown): format is OverrideFormat {\n const overrideFormat = format as Partial<OverrideFormat>;\n\n return overrideFormat !== undefined && overrideFormat.name !== undefined && overrideFormat.parent !== undefined && overrideFormat.parent.schemaItemType === SchemaItemType.Format;\n }\n\n /**\n * Returns a JSON object that contains the specification for the OverrideFormat where the precision and units properties have been overriden.\n * If the precision and/or units properties have been overriden, the returned object will contain a \"name\" and a \"parent\" property.\n * The \"name\" property identifies the OverrideFormat object itself and the \"parent\" property identifies the Format that has been overriden.\n * This method is not intended for complete serialization as it does not serialize any of the schema item properties.\n */\n public getFormatProps(): SchemaItemOverrideFormatProps {\n const formatJson = this.parent.toJSON() as Mutable<SchemaItemOverrideFormatProps>;\n\n if (this.parent.fullName !== this.fullName) {\n // Update name and parent properties to distinguish it from parent Format\n formatJson.name = this.fullName;\n formatJson.parent = this.parent.fullName;\n }\n\n // Update Precision overriden property\n formatJson.precision = this.precision;\n\n if (this.units !== undefined) {\n // Update Units overriden property\n const units = [];\n for (const unit of this.units) {\n units.push({\n name: unit[0].fullName,\n label: unit[1],\n });\n }\n\n formatJson.composite = {\n spacer: (this.spacer !== \" \") ? this.spacer : undefined,\n includeZero: (this.includeZero === false) ? this.includeZero : undefined,\n units,\n };\n }\n\n return formatJson;\n }\n}\n\n/**\n * @internal\n */\nexport function getFormatProps(format: Format | OverrideFormat): FormatProps {\n return OverrideFormat.isOverrideFormat(format) ? format.getFormatProps() : format.toJSON();\n}\n"]}
1
+ {"version":3,"file":"OverrideFormat.js","sourceRoot":"","sources":["../../../src/Metadata/OverrideFormat.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAyOH,wCAEC;AAzOD,oFAAiF;AACjF,4CAA8C;AAC9C,wDAAqK;AAMrK,4CAA6D;AAW7D;;;GAGG;AACH,MAAa,cAAc;IACjB,UAAU,CAA0C;IACpD,MAAM,CAAwE;IAEtF,uDAAuD;IACvC,MAAM,CAAS;IAE/B;;;OAGG;IACa,IAAI,CAAS;IAE7B,gBAAgB;IAChB,YAAY,MAAc,EAAE,SAAkD,EAAE,aAAoF;QAClK,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,4BAA4B,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QAC1F,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC;IAC9B,CAAC;IAED,mCAAmC;IACnC,IAAW,SAAS;QAClB,OAAO,CAAC,S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AAC,QAAQ,CAAC;QAC3C,CAAC;QAED,sCAAsC;QACtC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAEtC,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC7B,kCAAkC;YAClC,MAAM,KAAK,GAAG,EAAE,CAAC;YACjB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC9B,KAAK,CAAC,IAAI,CAAC;oBACT,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ;oBACtB,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;iBACf,CAAC,CAAC;YACL,CAAC;YAED,UAAU,CAAC,SAAS,GAAG;gBACrB,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gBACvD,WAAW,EAAE,CAAC,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;gBACxE,KAAK;aACN,CAAC;QACJ,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AA3MD,wCA2MC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,MAA+B;IAC5D,OAAO,cAAc,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,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 Metadata\r\n */\r\n\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { DecimalPrecision, FormatProps, formatStringRgx, FormatTraits, FormatType, FractionalPrecision, ScientificType, ShowSignOption } from \"@itwin/core-quantity\";\r\nimport { Format } from \"./Format\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItemOverrideFormatProps } from \"../Deserialization/JsonProps\";\r\nimport { Mutable } from \"@itwin/core-bentley\";\r\nimport { LazyLoadedInvertedUnit, LazyLoadedUnit } from \"../Interfaces\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\n\r\n/**\r\n * @public @preview\r\n */\r\nexport interface OverrideFormatProps {\r\n readonly name: string;\r\n readonly precision?: number;\r\n readonly unitAndLabels?: Array<[string, string | undefined]>; // Tuple of [unit name | unit label]\r\n}\r\n\r\n/**\r\n * Overrides of a Format, from a Schema, and is SchemaItem that is used specifically on KindOfQuantity.\r\n * @public @preview\r\n */\r\nexport class OverrideFormat {\r\n private _precision?: DecimalPrecision | FractionalPrecision;\r\n private _units?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>;\r\n\r\n /** The Format that this OverrideFormat is extending */\r\n public readonly parent: Format;\r\n\r\n /** The name of this OverrideFormat.\r\n *\r\n * This should be set to the [FormatString]($docs/bis/ec/kindofquantity/#format-string) which represents the format override.\r\n */\r\n public readonly name: string;\r\n\r\n /** @internal */\r\n constructor(parent: Format, precision?: DecimalPrecision | FractionalPrecision, unitAndLabels?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>) {\r\n this.parent = parent;\r\n this.name = OverrideFormat.createOverrideFormatFullName(parent, precision, unitAndLabels);\r\n this._precision = precision;\r\n this._units = unitAndLabels;\r\n }\r\n\r\n // Properties that can be overriden\r\n public get precision(): DecimalPrecision | FractionalPrecision {\r\n return (undefined === this._precision) ? this.parent.precision : this._precision;\r\n }\r\n\r\n public get units(): ReadonlyArray<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined {\r\n return (undefined === this._units) ? this.parent.units : this._units;\r\n }\r\n\r\n // Properties that cannot be overriden\r\n public get fullName(): string { return this.name; }\r\n public get roundFactor(): number { return this.parent.roundFactor; }\r\n public get type(): FormatType { return this.parent.type; }\r\n public get minWidth(): number | undefined { return this.parent.minWidth; }\r\n public get scientificType(): ScientificType | undefined { return this.parent.scientificType; }\r\n public get showSignOption(): ShowSignOption { return this.parent.showSignOption; }\r\n public get decimalSeparator(): string { return this.parent.decimalSeparator; }\r\n public get thousandSeparator(): string { return this.parent.thousandSeparator; }\r\n public get uomSeparator(): string { return this.parent.uomSeparator; }\r\n public get stationSeparator(): string { return this.parent.stationSeparator; }\r\n public get stationOffsetSize(): number | undefined { return this.parent.stationOffsetSize; }\r\n public get formatTraits(): FormatTraits { return this.parent.formatTraits; }\r\n public get spacer(): string | undefined { return this.parent.spacer; }\r\n public get includeZero(): boolean | undefined { return this.parent.includeZero; }\r\n\r\n public hasFormatTrait(formatTrait: FormatTraits) {\r\n return (this.parent.formatTraits & formatTrait) === formatTrait;\r\n }\r\n\r\n /** Returns the format string of this override in the Xml full name format.\r\n * @internal\r\n */\r\n public fullNameXml(koqSchema: Schema): string {\r\n let fullName = XmlSerializationUtils.createXmlTypedName(koqSchema, this.parent.schema, this.parent.name);\r\n\r\n if (undefined !== this.precision)\r\n fullName += `(${this.precision.toString()})`;\r\n\r\n if (undefined === this._units)\r\n return fullName;\r\n for (const [unit, unitLabel] of this._units) {\r\n const unitSchema = koqSchema.context.getSchemaSync(unit.schemaKey);\r\n if(unitSchema === undefined)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The unit schema ${unit.schemaKey} is not found in the context.`);\r\n\r\n fullName += \"[\";\r\n fullName += XmlSerializationUtils.createXmlTypedName(koqSchema, unitSchema, unit.name);\r\n if (unitLabel !== undefined)\r\n fullName += `|${unitLabel}`;\r\n fullName += `]`;\r\n }\r\n return fullName;\r\n }\r\n\r\n /**\r\n * Creates a valid OverrideFormat fullName from the parent Format and overridden units.\r\n * @param parent The parent Format.\r\n * @param unitAndLabels The overridden unit and labels collection.\r\n */\r\n public static createOverrideFormatFullName(parent: Format, precision?: DecimalPrecision | FractionalPrecision, unitAndLabels?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): string {\r\n let fullName = parent.fullName;\r\n\r\n if (precision)\r\n fullName += `(${precision.toString()})`;\r\n\r\n if (undefined === unitAndLabels)\r\n return fullName;\r\n for (const [unit, unitLabel] of unitAndLabels)\r\n if (undefined === unitLabel)\r\n fullName += `[${unit.fullName}]`;\r\n else\r\n fullName += `[${unit.fullName}|${unitLabel}]`;\r\n return fullName;\r\n }\r\n\r\n /** Parses the format string into the parts that make up an Override Format\r\n * @param formatString\r\n */\r\n public static parseFormatString(formatString: string): OverrideFormatProps {\r\n const match = formatString.split(formatStringRgx); // split string based on regex groups\r\n if (undefined === match[1])\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The format string, ${formatString}, on KindOfQuantity is missing a format.`);\r\n\r\n let precision: OverrideFormatProps[\"precision\"];\r\n if (undefined !== match[2] && undefined !== match[3]) {\r\n const overrideString = match[2];\r\n const tokens: string[] = [];\r\n let prevPos = 1; // Initial position is the character directly after the opening '(' in the override string.\r\n let currPos;\r\n\r\n // TODO need to include `,` as a valid search argument.\r\n while (-1 !== (currPos = overrideString.indexOf(\")\", prevPos))) {\r\n tokens.push(overrideString.substring(prevPos, currPos));\r\n prevPos = currPos + 1;\r\n }\r\n\r\n if (overrideString.length > 0 && undefined === tokens.find((token) => {\r\n return \"\" !== token; // there is at least one token that is not empty.\r\n })) {\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\r\n }\r\n\r\n // The first override parameter overrides the default precision of the format\r\n const precisionIndx: number = 0;\r\n if (tokens.length >= precisionIndx + 1) {\r\n if (tokens[precisionIndx].length > 0) {\r\n precision = Number.parseInt(tokens[precisionIndx], 10);\r\n if (Number.isNaN(precision))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The format string '${formatString}' on KindOfQuantity has a precision override '${tokens[precisionIndx]}' that is not number.`);\r\n }\r\n }\r\n }\r\n\r\n let i = 4;\r\n let unitAndLabels: OverrideFormatProps[\"unitAndLabels\"];\r\n while (i < match.length - 1) { // The regex match ends with an empty last value, which causes problems when exactly 4 unit overrides as specified, so ignore this last empty value\r\n if (undefined === match[i])\r\n break;\r\n // Unit override required\r\n if (undefined === match[i + 1])\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\r\n\r\n if (undefined === unitAndLabels)\r\n unitAndLabels = [];\r\n\r\n if (undefined !== match[i + 2]) // matches '|'\r\n unitAndLabels.push([match[i + 1], match[i + 3] ?? \"\"]); // add unit name and label override (if '|' matches and next value is undefined, save it as an empty string)\r\n else\r\n unitAndLabels.push([match[i + 1], undefined]); // add unit name\r\n\r\n i += 4;\r\n }\r\n\r\n return { name: match[1], precision, unitAndLabels };\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static isOverrideFormat(format: unknown): format is OverrideFormat {\r\n const overrideFormat = format as Partial<OverrideFormat>;\r\n\r\n return overrideFormat !== undefined && overrideFormat.name !== undefined && overrideFormat.parent !== undefined && overrideFormat.parent.schemaItemType === SchemaItemType.Format;\r\n }\r\n\r\n /**\r\n * Returns a JSON object that contains the specification for the OverrideFormat where the precision and units properties have been overriden.\r\n * If the precision and/or units properties have been overriden, the returned object will contain a \"name\" and a \"parent\" property.\r\n * The \"name\" property identifies the OverrideFormat object itself and the \"parent\" property identifies the Format that has been overriden.\r\n * This method is not intended for complete serialization as it does not serialize any of the schema item properties.\r\n */\r\n public getFormatProps(): SchemaItemOverrideFormatProps {\r\n const formatJson = this.parent.toJSON() as Mutable<SchemaItemOverrideFormatProps>;\r\n\r\n if (this.parent.fullName !== this.fullName) {\r\n // Update name and parent properties to distinguish it from parent Format\r\n formatJson.name = this.fullName;\r\n formatJson.parent = this.parent.fullName;\r\n }\r\n\r\n // Update Precision overriden property\r\n formatJson.precision = this.precision;\r\n\r\n if (this.units !== undefined) {\r\n // Update Units overriden property\r\n const units = [];\r\n for (const unit of this.units) {\r\n units.push({\r\n name: unit[0].fullName,\r\n label: unit[1],\r\n });\r\n }\r\n\r\n formatJson.composite = {\r\n spacer: (this.spacer !== \" \") ? this.spacer : undefined,\r\n includeZero: (this.includeZero === false) ? this.includeZero : undefined,\r\n units,\r\n };\r\n }\r\n\r\n return formatJson;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function getFormatProps(format: Format | OverrideFormat): FormatProps {\r\n return OverrideFormat.isOverrideFormat(format) ? format.getFormatProps() : format.toJSON();\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Phenomenon.js","sourceRoot":"","sources":["../../../src/Metadata/Phenomenon.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAA8C;AAC9C,4CAA6D;AAE7D,6CAA0C;AAE1C,uBAAuB;AACvB,MAAa,UAAW,SAAQ,uBAAU;IACf,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;IACpE,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,0BAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IACzE,WAAW,CAAS,CAAC,sKAAsK;IAEnM,gBAAgB;IAChB,YAAY,MAAc,EAAE,IAAY;QACtC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,IAAW,UAAU,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAE5D;;;;OAIG;IACa,MAAM,CAAC,aAAsB,KAAK,EAAE,uBAAgC,KAAK;QACvF,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,oBAAoB,CAAQ,CAAC;QACzE,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACxC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,gBAAg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;IAC1H,CAAC;CACF;AA3ED,gCA2EC;AAED;;;GAGG;AACH,MAAsB,iBAAkB,SAAQ,UAAU;CAGzD;AAHD,8CAGC","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 { PhenomenonProps } from \"../Deserialization/JsonProps\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { Schema } from \"./Schema\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/** @public @preview */\nexport class Phenomenon extends SchemaItem {\n public override readonly schemaItemType = Phenomenon.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.Phenomenon; }\n private _definition: string; // Contains a combination of Phenomena names which form this Phenomenon. Each Phenomena name is separated by a * and may have an exponent, specified using parentheses\n\n /** @internal */\n constructor(schema: Schema, name: string) {\n super(schema, name);\n this._definition = \"\";\n }\n\n public get definition(): string { return this._definition; }\n\n /**\n * Save this Phenomenon's properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): PhenomenonProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.definition = this.definition;\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"definition\", this.definition);\n return itemElement;\n }\n\n public override fromJSONSync(phenomenonProps: PhenomenonProps) {\n super.fromJSONSync(phenomenonProps);\n if (this._definition !== \"\" && phenomenonProps.definition.toLowerCase() !== this._definition.toLowerCase())\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Phenomenon ${this.name} has an invalid 'definition' attribute.`);\n else if (this._definition === \"\")\n this._definition = phenomenonProps.definition;\n }\n\n public override async fromJSON(phenomenonProps: PhenomenonProps) {\n this.fromJSONSync(phenomenonProps);\n }\n\n /**\n *\n * @param definition\n * @internal\n */\n protected async setDefinition(definition: string) {\n this._definition = definition;\n }\n\n /**\n * Type guard to check if the SchemaItem is of type Phenomenon.\n * @param item The SchemaItem to check.\n * @returns True if the item is a Phenomenon, false otherwise.\n */\n public static isPhenomenon(item?: SchemaItem): item is Phenomenon {\n if (item && item.schemaItemType === SchemaItemType.Phenomenon)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type Phenomenon.\n * @param item The SchemaItem to check.\n * @returns The item cast to Phenomenon if it is a Phenomenon, undefined otherwise.\n * @internal\n */\n public static assertIsPhenomenon(item?: SchemaItem): asserts item is Phenomenon {\n if (!this.isPhenomenon(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.Phenomenon}' (Phenomenon)`);\n }\n}\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutablePhenomenon extends Phenomenon {\n public abstract override setDefinition(definition: string): Promise<void>;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
1
+ {"version":3,"file":"Phenomenon.js","sourceRoot":"","sources":["../../../src/Metadata/Phenomenon.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAA8C;AAC9C,4CAA6D;AAE7D,6CAA0C;AAE1C,uBAAuB;AACvB,MAAa,UAAW,SAAQ,uBAAU;IACf,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;IACpE,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,0BAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IACzE,WAAW,CAAS,CAAC,sKAAsK;IAEnM,gBAAgB;IAChB,YAAY,MAAc,EAAE,IAAY;QACtC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;Q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,CAAC,YAAY,CAAC,IAAiB;QAC1C,IAAI,IAAI,IAAI,IAAI,CAAC,cAAc,KAAK,0BAAc,CAAC,UAAU;YAC3D,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,kBAAkB,CAAC,IAAiB;QAChD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;YAC1B,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,qBAAqB,EAAE,aAAa,0BAAc,CAAC,UAAU,gBAAgB,CAAC,CAAC;IAC1H,CAAC;CACF;AA3ED,gCA2EC;AAED;;;GAGG;AACH,MAAsB,iBAAkB,SAAQ,UAAU;CAGzD;AAHD,8CAGC","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 Metadata\r\n */\r\n\r\nimport { PhenomenonProps } from \"../Deserialization/JsonProps\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\n\r\n/** @public @preview */\r\nexport class Phenomenon extends SchemaItem {\r\n public override readonly schemaItemType = Phenomenon.schemaItemType;\r\n /** @internal */\r\n public static override get schemaItemType() { return SchemaItemType.Phenomenon; }\r\n private _definition: string; // Contains a combination of Phenomena names which form this Phenomenon. Each Phenomena name is separated by a * and may have an exponent, specified using parentheses\r\n\r\n /** @internal */\r\n constructor(schema: Schema, name: string) {\r\n super(schema, name);\r\n this._definition = \"\";\r\n }\r\n\r\n public get definition(): string { return this._definition; }\r\n\r\n /**\r\n * Save this Phenomenon's properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): PhenomenonProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.definition = this.definition;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n itemElement.setAttribute(\"definition\", this.definition);\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(phenomenonProps: PhenomenonProps) {\r\n super.fromJSONSync(phenomenonProps);\r\n if (this._definition !== \"\" && phenomenonProps.definition.toLowerCase() !== this._definition.toLowerCase())\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Phenomenon ${this.name} has an invalid 'definition' attribute.`);\r\n else if (this._definition === \"\")\r\n this._definition = phenomenonProps.definition;\r\n }\r\n\r\n public override async fromJSON(phenomenonProps: PhenomenonProps) {\r\n this.fromJSONSync(phenomenonProps);\r\n }\r\n\r\n /**\r\n *\r\n * @param definition\r\n * @internal\r\n */\r\n protected async setDefinition(definition: string) {\r\n this._definition = definition;\r\n }\r\n\r\n /**\r\n * Type guard to check if the SchemaItem is of type Phenomenon.\r\n * @param item The SchemaItem to check.\r\n * @returns True if the item is a Phenomenon, false otherwise.\r\n */\r\n public static isPhenomenon(item?: SchemaItem): item is Phenomenon {\r\n if (item && item.schemaItemType === SchemaItemType.Phenomenon)\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Type assertion to check if the SchemaItem is of type Phenomenon.\r\n * @param item The SchemaItem to check.\r\n * @returns The item cast to Phenomenon if it is a Phenomenon, undefined otherwise.\r\n * @internal\r\n */\r\n public static assertIsPhenomenon(item?: SchemaItem): asserts item is Phenomenon {\r\n if (!this.isPhenomenon(item))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.Phenomenon}' (Phenomenon)`);\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutablePhenomenon extends Phenomenon {\r\n public abstract override setDefinition(definition: string): Promise<void>;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Property.js","sourceRoot":"","sources":["../../../src/Metadata/Property.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4D;AAK5D,oFAAiF;AACjF,4CAAsJ;AACtJ,4CAA6D;AAE7D,oDAAyF;AAEzF,sCAAmC;AAEnC,uDAAkI;AAClI,+CAA4C;AAC5C,qDAAkD;AAClD,yDAAsD;AAItD;;;GAGG;AACH,MAAsB,QAAQ;IACpB,KAAK,CAAS;IACd,MAAM,CAAW,CAAC,kCAAkC;IACpD,YAAY,CAAU;IACtB,MAAM,CAAU;IAChB,WAAW,CAAW;IACtB,SAAS,CAAU;IACnB,SAAS,CAA8B;IACvC,eAAe,CAA4B;IAC3C,iBAAiB,CAAgC;IAEzD,gBAAgB;IACN,KAAK,CAAe;IAE9B,gBAAgB;IAChB,YAAY,OAAgB,EAAE,IAAY,EAAE,IAAkB;QAC5D,IAAI,CAAC,MAAM,GAAG,OAAmB,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAEM,OAAO,KAA+B,OAAO,iCAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACrF,WAAW,KAAmC,OAAO,iCAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjG,QAAQ,KAAgC,OAAO,iCAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxF,aAAa,KAAqC,OAAO,iCAAiB,CAAC,aAAa,CAAC,IAAI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C;CACF;AAJD,4DAIC;AAED,uBAAuB;AACvB,MAAa,mBAAoB,SAAQ,kBAAkB,CAAC,cAAc,CAAC;IACzE,gBAAgB;IAChB,YAAY,OAAgB,EAAE,IAAY,EAAE,IAAiB;QAC3D,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF;AALD,kDAKC;AAaD;;;GAGG;AACH,MAAsB,eAAgB,SAAQ,QAAQ;CAErD;AAFD,0CAEC","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 { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport {\n ArrayPropertyProps, EnumerationPropertyProps, NavigationPropertyProps, PrimitiveArrayPropertyProps, PrimitiveOrEnumPropertyBaseProps,\n PrimitivePropertyProps, PropertyProps, StructPropertyProps,\n} from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { parsePrimitiveType, PrimitiveType, primitiveTypeToString, SchemaItemType, StrengthDirection, strengthDirectionToString } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { AnyClass, LazyLoadedEnumeration, LazyLoadedKindOfQuantity, LazyLoadedPropertyCategory, LazyLoadedRelationshipClass } from \"../Interfaces\";\nimport { PropertyType, propertyTypeToString, PropertyTypeUtils } from \"../PropertyTypes\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { ECName } from \"../ECName\";\nimport { ECClass, StructClass } from \"./Class\";\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\nimport { Enumeration } from \"./Enumeration\";\nimport { KindOfQuantity } from \"./KindOfQuantity\";\nimport { PropertyCategory } from \"./PropertyCategory\";\nimport { type RelationshipClass } from \"./RelationshipClass\";\nimport { Schema } from \"./Schema\";\n\n/**\n * A common abstract class for all ECProperty types.\n * @public @preview\n */\nexport abstract class Property implements CustomAttributeContainerProps {\n private _name: ECName;\n private _class: AnyClass; // TODO: class seems to be unused?\n private _description?: string;\n private _label?: string;\n private _isReadOnly?: boolean;\n private _priority?: number;\n private _category?: LazyLoadedPropertyCategory;\n private _kindOfQuantity?: LazyLoadedKindOfQuantity;\n private _customAttributes?: Map<string, CustomAttribute>;\n\n /** @internal */\n protected _type: PropertyType;\n\n /** @internal */\n constructor(ecClass: ECClass, name: string, type: PropertyType) {\n this._class = ecClass as AnyClass;\n this._name = new ECName(name);\n this._type = type;\n }\n\n public isArray(): this is AnyArrayProperty { return PropertyTypeUtils.isArray(this._type); }\n public isPrimitive(): this is AnyPrimitiveProperty { return PropertyTypeUtils.isPrimitive(this._type); }\n public isStruct(): this is AnyStructProperty { return PropertyTypeUtils.isStruct(this._type); }\n public isEnumeration(): this is AnyEnumerationProperty { return PropertyTypeUtils.isEnumeration(this._type); }\n public isNavigation(): this is NavigationProperty { return PropertyTypeUtils.isNavigation(this._type); }\n\n public get name() { return this._name.name; }\n\n public get class() { return this._class; }\n\n public get label() { return this._label; }\n\n public get description() { return this._description; }\n\n public get isReadOnly() { return this._isReadOnly || false; }\n\n public get priority(): number {\n if (this._priority === undefined) {\n const baseProperty = this.class.getInheritedPropertySync(this.name);\n if (undefined !== baseProperty) {\n return baseProperty.priority;\n }\n }\n\n return this._priority || 0;\n }\n\n public get category(): LazyLoadedPropertyCategory | undefined {\n if (this._category === undefined) {\n const baseProperty = this.class.getInheritedPropertySync(this.name);\n if (undefined !== baseProperty) {\n return baseProperty.category;\n }\n }\n\n return this._category;\n }\n\n public get kindOfQuantity(): LazyLoadedKindOfQuantity | undefined {\n if (this._kindOfQuantity === undefined) {\n const baseProperty = this.class.getInheritedPropertySync(this.name);\n if (undefined !== baseProperty) {\n return baseProperty.kindOfQuantity;\n }\n }\n\n return this._kindOfQuantity;\n }\n\n public get propertyType() { return this._type; }\n\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\n\n /** Returns the name in the format 'ClassName.PropertyName'. */\n public get fullName(): string { return `${this._class.name}.${this.name}`; }\n\n /** Returns the schema of the class holding the property. */\n public get schema(): Schema { return this._class.schema; }\n\n public getCategorySync(): PropertyCategory | undefined {\n if (!this._category) {\n const baseProperty = this.class.getInheritedPropertySync(this.name);\n if (undefined !== baseProperty) {\n return baseProperty.getCategorySync();\n }\n\n return undefined;\n }\n\n return this.class.schema.lookupItemSync(this._category, PropertyCategory);\n }\n\n public getKindOfQuantitySync(): KindOfQuantity | undefined {\n if (!this._kindOfQuantity) {\n const baseProperty = this.class.getInheritedPropertySync(this.name);\n if (undefined !== baseProperty) {\n return baseProperty.getKindOfQuantitySync();\n }\n\n return undefined;\n }\n\n return this.class.schema.lookupItemSync(this._kindOfQuantity, KindOfQuantity);\n }\n\n /**\n * Save this Property's properties to an object for serializing to JSON.\n */\n public toJSON(): PropertyProps {\n const schemaJson: any = {};\n schemaJson.name = this.name;\n schemaJson.type = propertyTypeToString(this._type);\n if (this.description !== undefined)\n schemaJson.description = this.description;\n if (this.label !== undefined)\n schemaJson.label = this.label;\n if (this._isReadOnly !== undefined)\n schemaJson.isReadOnly = this._isReadOnly;\n if (this._category !== undefined)\n schemaJson.category = this._category.fullName; // needs to be fully qualified name\n if (this._priority !== undefined)\n schemaJson.priority = this._priority;\n if (this._kindOfQuantity !== undefined)\n schemaJson.kindOfQuantity = this._kindOfQuantity.fullName;\n const customAttributes = serializeCustomAttributes(this.customAttributes);\n if (customAttributes !== undefined)\n schemaJson.customAttributes = customAttributes;\n return schemaJson;\n }\n\n /** @internal */\n public async toXml(schemaXml: Document): Promise<Element> {\n const propType = `EC${propertyTypeToString(this._type)}`.replace(\"Primitive\", \"\");\n const itemElement = schemaXml.createElement(propType);\n itemElement.setAttribute(\"propertyName\", this.name);\n if (undefined !== this.description)\n itemElement.setAttribute(\"description\", this.description);\n if (undefined !== this.label)\n itemElement.setAttribute(\"displayLabel\", this.label);\n if (undefined !== this.isReadOnly)\n itemElement.setAttribute(\"readOnly\", String(this.isReadOnly));\n\n if (undefined !== this._category) {\n const category = await this._category;\n const categoryName = XmlSerializationUtils.createXmlTypedName(this.schema, category.schema, category.name);\n itemElement.setAttribute(\"category\", categoryName);\n }\n\n if (undefined !== this._priority)\n itemElement.setAttribute(\"priority\", this._priority.toString());\n\n if (undefined !== this._kindOfQuantity) {\n const kindOfQuantity = await this._kindOfQuantity;\n const kindOfQuantityName = XmlSerializationUtils.createXmlTypedName(this.schema, kindOfQuantity.schema, kindOfQuantity.name);\n itemElement.setAttribute(\"kindOfQuantity\", kindOfQuantityName);\n }\n\n if (this._customAttributes) {\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\n for (const [name, attribute] of this._customAttributes) {\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\n caContainerElement.appendChild(caElement);\n }\n itemElement.appendChild(caContainerElement);\n }\n\n return itemElement;\n }\n\n public fromJSONSync(propertyProps: PropertyProps) {\n if (undefined !== propertyProps.label) {\n this._label = propertyProps.label;\n }\n\n if (undefined !== propertyProps.description) {\n this._description = propertyProps.description;\n }\n\n if (undefined !== propertyProps.priority) {\n this._priority = propertyProps.priority;\n }\n\n if (undefined !== propertyProps.isReadOnly) {\n this._isReadOnly = propertyProps.isReadOnly;\n }\n\n if (undefined !== propertyProps.category) {\n const propertyCategorySchemaItemKey = this.class.schema.getSchemaItemKey(propertyProps.category);\n if (!propertyCategorySchemaItemKey)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Property ${this.name} has a 'category' (\"${propertyProps.category}\") that cannot be found.`);\n this._category = new DelayedPromiseWithProps<SchemaItemKey, PropertyCategory>(propertyCategorySchemaItemKey,\n async () => {\n const category = await this.class.schema.lookupItem(propertyCategorySchemaItemKey, PropertyCategory);\n if (undefined === category)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Property ${this.name} has a 'category' (\"${propertyProps.category}\") that cannot be found.`);\n return category;\n });\n }\n\n if (undefined !== propertyProps.kindOfQuantity) {\n const koqSchemaItemKey = this.class.schema.getSchemaItemKey(propertyProps.kindOfQuantity);\n if (!koqSchemaItemKey)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Property ${this.name} has a 'kindOfQuantity' (\"${propertyProps.kindOfQuantity}\") that cannot be found.`);\n this._kindOfQuantity = new DelayedPromiseWithProps<SchemaItemKey, KindOfQuantity>(koqSchemaItemKey,\n async () => {\n const koq = await this.class.schema.lookupItem(koqSchemaItemKey, KindOfQuantity);\n if (undefined === koq)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Property ${this.name} has a 'kindOfQuantity' (\"${propertyProps.kindOfQuantity}\") that cannot be found.`);\n return koq;\n });\n }\n }\n\n public async fromJSON(propertyProps: PropertyProps) {\n this.fromJSONSync(propertyProps);\n }\n\n /** @internal */\n protected addCustomAttribute(customAttribute: CustomAttribute) {\n if (!this._customAttributes)\n this._customAttributes = new Map<string, CustomAttribute>();\n\n this._customAttributes.set(customAttribute.className, customAttribute);\n }\n\n /** @internal */\n protected setName(name: ECName) {\n this._name = name;\n }\n\n /**\n * @internal Used in schema editing.\n */\n protected setDescription(description: string) {\n this._description = description;\n }\n\n /**\n * @internal Used in schema editing.\n */\n protected setLabel(label: string) {\n this._label = label;\n }\n\n /**\n * @internal Used in schema editing.\n */\n protected setIsReadOnly(isReadOnly: boolean) {\n this._isReadOnly = isReadOnly;\n }\n\n /**\n * @internal Used in schema editing.\n */\n protected setPriority(priority: number) {\n this._priority = priority;\n }\n\n /**\n * @internal Used in schema editing.\n */\n protected setCategory(category: LazyLoadedPropertyCategory) {\n this._category = category;\n }\n\n /**\n * @internal Used in schema editing.\n */\n protected setKindOfQuantity(kindOfQuantity: LazyLoadedKindOfQuantity) {\n this._kindOfQuantity = kindOfQuantity;\n }\n\n /**\n * Retrieve all custom attributes in the current property and its base\n * This is the async version of getCustomAttributesSync()\n */\n public async getCustomAttributes(): Promise<CustomAttributeSet> {\n return this.getCustomAttributesSync();\n }\n\n /**\n * Retrieve all custom attributes in the current property and its base.\n */\n public getCustomAttributesSync(): CustomAttributeSet {\n let customAttributes: Map<string, CustomAttribute> | undefined = this._customAttributes;\n if (undefined === customAttributes) {\n customAttributes = new Map<string, CustomAttribute>();\n }\n\n const baseProperty = this.class.getInheritedPropertySync(this.name);\n let baseCustomAttributes;\n if (undefined !== baseProperty)\n baseCustomAttributes = baseProperty.getCustomAttributesSync();\n if (undefined !== baseCustomAttributes) {\n customAttributes = new Map<string, CustomAttribute>([...baseCustomAttributes, ...customAttributes]);\n }\n\n return customAttributes;\n }\n /**\n * @internal\n */\n public static isProperty(object: any): object is AnyProperty {\n const property = object as Property;\n\n return property !== undefined && property.class !== undefined && property.name !== undefined\n && property.propertyType !== undefined;\n }\n}\n\n\n\n/** @public @preview */\nexport abstract class PrimitiveOrEnumPropertyBase extends Property {\n /** @internal */\n protected _extendedTypeName?: string;\n /** @internal */\n protected _minLength?: number;\n /** @internal */\n protected _maxLength?: number;\n /** @internal */\n protected _minValue?: number;\n /** @internal */\n protected _maxValue?: number;\n\n public get extendedTypeName() { return this._extendedTypeName; }\n public get minLength() { return this._minLength; }\n public get maxLength() { return this._maxLength; }\n public get minValue() { return this._minValue; }\n public get maxValue() { return this._maxValue; }\n\n /** @internal */\n constructor(ecClass: ECClass, name: string, type: PropertyType) {\n super(ecClass, name, type);\n }\n\n /**\n * Save this PrimitiveOrEnumPropertyBase's properties to an object for serializing to JSON.\n */\n public override toJSON(): PrimitiveOrEnumPropertyBaseProps {\n const schemaJson = super.toJSON() as any;\n if (this.extendedTypeName !== undefined)\n schemaJson.extendedTypeName = this.extendedTypeName;\n if (this._minLength !== undefined)\n schemaJson.minLength = this.minLength;\n if (this._maxLength !== undefined)\n schemaJson.maxLength = this.maxLength;\n if (this._minValue !== undefined)\n schemaJson.minValue = this.minValue;\n if (this._maxValue !== undefined)\n schemaJson.maxValue = this.maxValue;\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n if (undefined !== this.extendedTypeName)\n itemElement.setAttribute(\"extendedTypeName\", this.extendedTypeName);\n if (undefined !== this.minValue)\n itemElement.setAttribute(\"minimumValue\", this.minValue.toString());\n if (undefined !== this.maxValue)\n itemElement.setAttribute(\"maximumValue\", this.maxValue.toString());\n if (undefined !== this.minLength)\n itemElement.setAttribute(\"minimumLength\", this.minLength.toString());\n if (undefined !== this.maxLength)\n itemElement.setAttribute(\"maximumLength\", this.maxLength.toString());\n\n return itemElement;\n }\n\n public override fromJSONSync(propertyBaseProps: PrimitiveOrEnumPropertyBaseProps) {\n super.fromJSONSync(propertyBaseProps);\n\n if (undefined !== propertyBaseProps.minLength) {\n this._minLength = propertyBaseProps.minLength;\n }\n\n if (undefined !== propertyBaseProps.maxLength) {\n this._maxLength = propertyBaseProps.maxLength;\n }\n\n if (undefined !== propertyBaseProps.minValue) {\n this._minValue = propertyBaseProps.minValue;\n }\n\n if (undefined !== propertyBaseProps.maxValue) {\n this._maxValue = propertyBaseProps.maxValue;\n }\n\n if (undefined !== propertyBaseProps.extendedTypeName) {\n this._extendedTypeName = propertyBaseProps.extendedTypeName;\n }\n }\n /**\n * @internal Used in schema editing.\n */\n protected setExtendedTypeName(extendedTypeName: string) {\n this._extendedTypeName = extendedTypeName;\n }\n\n /**\n * @internal Used in schema editing.\n */\n protected setMinLength(minLength: number) {\n this._minLength = minLength;\n }\n\n /**\n * @internal Used in schema editing.\n */\n protected setMaxLength(maxLength: number) {\n this._maxLength = maxLength;\n }\n\n /**\n * @internal Used in schema editing.\n */\n protected setMinValue(minValue: number) {\n this._minValue = minValue;\n }\n\n /**\n * @internal Used in schema editing.\n */\n protected setMaxValue(maxValue: number) {\n this._maxValue = maxValue;\n }\n\n public override async fromJSON(propertyBaseProps: PrimitiveOrEnumPropertyBaseProps) {\n this.fromJSONSync(propertyBaseProps);\n }\n}\n\n/** @public @preview */\nexport class PrimitiveProperty extends PrimitiveOrEnumPropertyBase {\n public get primitiveType(): PrimitiveType { return PropertyTypeUtils.getPrimitiveType(this.propertyType); }\n\n /** @internal */\n constructor(ecClass: ECClass, name: string, primitiveType: PrimitiveType = PrimitiveType.Integer) {\n super(ecClass, name, PropertyTypeUtils.fromPrimitiveType(primitiveType));\n }\n\n public override fromJSONSync(primitivePropertyProps: PrimitivePropertyProps) {\n super.fromJSONSync(primitivePropertyProps);\n if (undefined !== primitivePropertyProps.typeName) {\n if (this.primitiveType !== parsePrimitiveType(primitivePropertyProps.typeName))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n }\n }\n\n public override async fromJSON(primitivePropertyProps: PrimitivePropertyProps) {\n this.fromJSONSync(primitivePropertyProps);\n }\n\n /**\n * Save this PrimitiveProperty's properties to an object for serializing to JSON.\n */\n public override toJSON(): PrimitivePropertyProps {\n const schemaJson = super.toJSON() as any;\n schemaJson.typeName = primitiveTypeToString(this.primitiveType);\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"typeName\", primitiveTypeToString(this.primitiveType));\n return itemElement;\n }\n}\n\n/** @public @preview */\nexport class EnumerationProperty extends PrimitiveOrEnumPropertyBase {\n /** @internal */\n protected _enumeration?: LazyLoadedEnumeration;\n\n public get enumeration(): LazyLoadedEnumeration | undefined { return this._enumeration; }\n\n /**\n * Save this EnumerationProperty's properties to an object for serializing to JSON.\n */\n public override toJSON(): EnumerationPropertyProps {\n const schemaJson = super.toJSON() as any;\n schemaJson.typeName = this.enumeration!.fullName;\n return schemaJson;\n }\n\n /** @internal */\n constructor(ecClass: ECClass, name: string, type: LazyLoadedEnumeration) {\n // TODO: Should we allow specifying the backing type?\n super(ecClass, name, PropertyType.Integer_Enumeration);\n this._enumeration = type;\n }\n\n public override fromJSONSync(enumerationPropertyProps: EnumerationPropertyProps) {\n super.fromJSONSync(enumerationPropertyProps);\n if (undefined !== enumerationPropertyProps.typeName) {\n if (!(this.enumeration!.fullName).match(enumerationPropertyProps.typeName)) // need to match {schema}.{version}.{itemName} on typeName\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n const enumSchemaItemKey = this.class.schema.getSchemaItemKey(this.enumeration!.fullName);\n if (!enumSchemaItemKey)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the enumeration ${enumerationPropertyProps.typeName}.`);\n this._enumeration = new DelayedPromiseWithProps<SchemaItemKey, Enumeration>(enumSchemaItemKey,\n async () => {\n const enumeration = await this.class.schema.lookupItem(enumSchemaItemKey, Enumeration);\n if (undefined === enumeration)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the enumeration ${enumerationPropertyProps.typeName}.`);\n return enumeration;\n });\n }\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n const enumeration = await this.enumeration;\n const enumerationName = XmlSerializationUtils.createXmlTypedName(this.schema, enumeration!.schema, enumeration!.name);\n itemElement.setAttribute(\"typeName\", enumerationName);\n return itemElement;\n }\n\n public override async fromJSON(enumerationPropertyProps: EnumerationPropertyProps) {\n this.fromJSONSync(enumerationPropertyProps);\n }\n\n}\n\n/** @public @preview */\nexport class StructProperty extends Property {\n /** @internal */\n protected _structClass: StructClass;\n\n public get structClass(): StructClass { return this._structClass; }\n\n /** @internal */\n constructor(ecClass: ECClass, name: string, type: StructClass) {\n super(ecClass, name, PropertyType.Struct);\n this._structClass = type;\n }\n\n /**\n * Save this StructProperty's properties to an object for serializing to JSON.\n */\n public override toJSON(): StructPropertyProps {\n const schemaJson = super.toJSON() as any;\n schemaJson.typeName = this.structClass.fullName;\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n const structClassName = XmlSerializationUtils.createXmlTypedName(this.schema, this.structClass.schema, this.structClass.name);\n itemElement.setAttribute(\"typeName\", structClassName);\n return itemElement;\n }\n\n public override fromJSONSync(structPropertyProps: StructPropertyProps) {\n super.fromJSONSync(structPropertyProps);\n if (undefined !== structPropertyProps.typeName) {\n if (!this.structClass.key.matchesFullName(structPropertyProps.typeName))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n }\n }\n\n public override async fromJSON(structPropertyProps: StructPropertyProps) {\n this.fromJSONSync(structPropertyProps);\n }\n}\n\n/** @public @preview */\nexport class NavigationProperty extends Property {\n /** @internal */\n protected _relationshipClass: LazyLoadedRelationshipClass;\n /** @internal */\n protected _direction: StrengthDirection;\n\n public get relationshipClass(): LazyLoadedRelationshipClass { return this._relationshipClass; }\n\n public getRelationshipClassSync(): RelationshipClass | undefined {\n if (!this._relationshipClass) // eslint-disable-line @typescript-eslint/no-misused-promises\n return undefined;\n\n // We cannot use the type guard here to avoid a circular dependency\n const result = this.class.schema.lookupItemSync(this._relationshipClass);\n return result?.schemaItemType === SchemaItemType.RelationshipClass ? result as RelationshipClass : undefined\n }\n\n public get direction() { return this._direction; }\n\n /**\n * Save this NavigationProperty's properties to an object for serializing to JSON.\n */\n public override toJSON(): NavigationPropertyProps {\n const schemaJson = super.toJSON() as any;\n schemaJson.relationshipName = this.relationshipClass.fullName;\n schemaJson.direction = strengthDirectionToString(this.direction);\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n const relationshipClass = await this.relationshipClass;\n const relationshipClassName = XmlSerializationUtils.createXmlTypedName(this.schema, relationshipClass.schema, relationshipClass.name);\n itemElement.setAttribute(\"relationshipName\", relationshipClassName);\n itemElement.setAttribute(\"direction\", strengthDirectionToString(this.direction));\n\n return itemElement;\n }\n\n /** @internal */\n constructor(ecClass: ECClass, name: string, relationship: LazyLoadedRelationshipClass, direction?: StrengthDirection) {\n super(ecClass, name, PropertyType.Navigation);\n this._relationshipClass = relationship;\n\n this._direction = (direction !== undefined) ? direction : StrengthDirection.Forward;\n }\n}\n\ntype Constructor<T> = new (...args: any[]) => T;\n\n// TODO: Consolidate all of the INT32_MAX variables.\nconst INT32_MAX = 2147483647;\n\n/** @public @preview */\nexport abstract class ArrayProperty extends Property {\n /** @internal */\n protected _minOccurs: number = 0;\n /** @internal */\n protected _maxOccurs?: number = INT32_MAX;\n\n public get minOccurs() { return this._minOccurs; }\n public get maxOccurs() { return this._maxOccurs; }\n\n /**\n * @internal Used in schema editing.\n */\n protected setMinOccurs(minOccurs: number) {\n this._minOccurs = minOccurs;\n }\n\n /**\n * @internal Used in schema editing.\n */\n protected setMaxOccurs(maxOccurs: number) {\n this._maxOccurs = maxOccurs;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst ArrayPropertyMixin = <T extends Constructor<Property>>(Base: T) => {\n return class extends Base {\n /** @internal */\n protected _minOccurs: number = 0;\n /** @internal */\n protected _maxOccurs: number = INT32_MAX;\n\n public get minOccurs() { return this._minOccurs; }\n public get maxOccurs() { return this._maxOccurs; }\n\n constructor(...args: any[]) {\n super(...args);\n this._type = PropertyTypeUtils.asArray(this.propertyType);\n }\n\n public override fromJSONSync(arrayPropertyProps: PrimitiveArrayPropertyProps) {\n super.fromJSONSync(arrayPropertyProps);\n if (undefined !== arrayPropertyProps.minOccurs) {\n this._minOccurs = arrayPropertyProps.minOccurs;\n }\n\n if (undefined !== arrayPropertyProps.maxOccurs) {\n this._maxOccurs = arrayPropertyProps.maxOccurs;\n }\n }\n\n public override async fromJSON(arrayPropertyProps: PrimitiveArrayPropertyProps) {\n this.fromJSONSync(arrayPropertyProps);\n }\n\n /**\n * Save this ArrayProperty's properties to an object for serializing to JSON.\n */\n public override toJSON(): ArrayPropertyProps {\n const schemaJson = super.toJSON() as any;\n schemaJson.minOccurs = this.minOccurs;\n if (this.maxOccurs !== undefined)\n schemaJson.maxOccurs = this.maxOccurs;\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"minOccurs\", this.minOccurs.toString());\n if (this.maxOccurs)\n itemElement.setAttribute(\"maxOccurs\", this.maxOccurs.toString());\n\n return itemElement;\n }\n\n /**\n * @internal Used in schema editing.\n */\n protected setMinOccurs(minOccurs: number) {\n this._minOccurs = minOccurs;\n }\n\n /**\n * @internal Used in schema editing.\n */\n protected setMaxOccurs(maxOccurs: number) {\n this._maxOccurs = maxOccurs;\n }\n } as Constructor<Property> as typeof Base & Constructor<ArrayProperty>;\n};\n\n/** @public @preview */\nexport class PrimitiveArrayProperty extends ArrayPropertyMixin(PrimitiveProperty) {\n /** @internal */\n constructor(ecClass: ECClass, name: string, primitiveType: PrimitiveType = PrimitiveType.Integer) {\n super(ecClass, name, primitiveType);\n }\n\n /**\n * Save this PrimitiveArrayProperty's properties to an object for serializing to JSON.\n */\n public override toJSON(): PrimitiveArrayPropertyProps {\n return super.toJSON();\n }\n\n}\n\n/** @public @preview */\nexport class EnumerationArrayProperty extends ArrayPropertyMixin(EnumerationProperty) {\n constructor(ecClass: ECClass, name: string, type: LazyLoadedEnumeration) {\n super(ecClass, name, type);\n }\n}\n\n/** @public @preview */\nexport class StructArrayProperty extends ArrayPropertyMixin(StructProperty) {\n /** @internal */\n constructor(ecClass: ECClass, name: string, type: StructClass) {\n super(ecClass, name, type);\n }\n}\n\n/** @public @preview */\nexport type AnyArrayProperty = PrimitiveArrayProperty | EnumerationArrayProperty | StructArrayProperty;\n/** @public @preview */\nexport type AnyPrimitiveProperty = PrimitiveProperty | PrimitiveArrayProperty;\n/** @public @preview */\nexport type AnyEnumerationProperty = EnumerationProperty | EnumerationArrayProperty;\n/** @public @preview */\nexport type AnyStructProperty = StructProperty | StructArrayProperty;\n/** @public @preview */\nexport type AnyProperty = AnyPrimitiveProperty | AnyEnumerationProperty | AnyStructProperty | NavigationProperty;\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * @internal\n */\nexport abstract class MutableProperty extends Property {\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\n}\n"]}
1
+ {"version":3,"file":"Property.js","sourceRoot":"","sources":["../../../src/Metadata/Property.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4D;AAK5D,oFAAiF;AACjF,4CAAsJ;AACtJ,4CAA6D;AAE7D,oDAAyF;AAEzF,sCAAmC;AAEnC,uDAAkI;AAClI,+CAA4C;AAC5C,qDAAkD;AAClD,yDAAsD;AAItD;;;GAGG;AACH,MAAsB,QAAQ;IACpB,KAAK,CAAS;IACd,MAAM,CAAW,CAAC,kCAAkC;IACpD,YAAY,CAAU;IACtB,MAAM,CAAU;IAChB,WAAW,CAAW;IACtB,SAAS,CAAU;IACnB,SAAS,CAA8B;IACvC,eAAe,CAA4B;IAC3C,iBAAiB,CAAgC;IAEzD,gBAAgB;IACN,KAAK,CAAe;IAE9B,gBAAgB;IAChB,YAAY,OAAgB,EAAE,IAAY,EAAE,IAAkB;QAC5D,IAAI,CAAC,MAAM,GAAG,OAAmB,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAEM,OAAO,KAA+B,OAAO,iCAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACrF,WAAW,KAAmC,OAAO,iCAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjG,QAAQ,KAAgC,OAAO,iCAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxF,aAAa,KAAqC,OAAO,iCAAiB,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvG,YAAY,K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oB,SAAQ,kBAAkB,CAAC,cAAc,CAAC;IACzE,gBAAgB;IAChB,YAAY,OAAgB,EAAE,IAAY,EAAE,IAAiB;QAC3D,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF;AALD,kDAKC;AAaD;;;GAGG;AACH,MAAsB,eAAgB,SAAQ,QAAQ;CAErD;AAFD,0CAEC","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 Metadata\r\n */\r\n\r\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport {\r\n ArrayPropertyProps, EnumerationPropertyProps, NavigationPropertyProps, PrimitiveArrayPropertyProps, PrimitiveOrEnumPropertyBaseProps,\r\n PrimitivePropertyProps, PropertyProps, StructPropertyProps,\r\n} from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { parsePrimitiveType, PrimitiveType, primitiveTypeToString, SchemaItemType, StrengthDirection, strengthDirectionToString } from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { AnyClass, LazyLoadedEnumeration, LazyLoadedKindOfQuantity, LazyLoadedPropertyCategory, LazyLoadedRelationshipClass } from \"../Interfaces\";\r\nimport { PropertyType, propertyTypeToString, PropertyTypeUtils } from \"../PropertyTypes\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { ECName } from \"../ECName\";\r\nimport { ECClass, StructClass } from \"./Class\";\r\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\r\nimport { Enumeration } from \"./Enumeration\";\r\nimport { KindOfQuantity } from \"./KindOfQuantity\";\r\nimport { PropertyCategory } from \"./PropertyCategory\";\r\nimport { type RelationshipClass } from \"./RelationshipClass\";\r\nimport { Schema } from \"./Schema\";\r\n\r\n/**\r\n * A common abstract class for all ECProperty types.\r\n * @public @preview\r\n */\r\nexport abstract class Property implements CustomAttributeContainerProps {\r\n private _name: ECName;\r\n private _class: AnyClass; // TODO: class seems to be unused?\r\n private _description?: string;\r\n private _label?: string;\r\n private _isReadOnly?: boolean;\r\n private _priority?: number;\r\n private _category?: LazyLoadedPropertyCategory;\r\n private _kindOfQuantity?: LazyLoadedKindOfQuantity;\r\n private _customAttributes?: Map<string, CustomAttribute>;\r\n\r\n /** @internal */\r\n protected _type: PropertyType;\r\n\r\n /** @internal */\r\n constructor(ecClass: ECClass, name: string, type: PropertyType) {\r\n this._class = ecClass as AnyClass;\r\n this._name = new ECName(name);\r\n this._type = type;\r\n }\r\n\r\n public isArray(): this is AnyArrayProperty { return PropertyTypeUtils.isArray(this._type); }\r\n public isPrimitive(): this is AnyPrimitiveProperty { return PropertyTypeUtils.isPrimitive(this._type); }\r\n public isStruct(): this is AnyStructProperty { return PropertyTypeUtils.isStruct(this._type); }\r\n public isEnumeration(): this is AnyEnumerationProperty { return PropertyTypeUtils.isEnumeration(this._type); }\r\n public isNavigation(): this is NavigationProperty { return PropertyTypeUtils.isNavigation(this._type); }\r\n\r\n public get name() { return this._name.name; }\r\n\r\n public get class() { return this._class; }\r\n\r\n public get label() { return this._label; }\r\n\r\n public get description() { return this._description; }\r\n\r\n public get isReadOnly() { return this._isReadOnly || false; }\r\n\r\n public get priority(): number {\r\n if (this._priority === undefined) {\r\n const baseProperty = this.class.getInheritedPropertySync(this.name);\r\n if (undefined !== baseProperty) {\r\n return baseProperty.priority;\r\n }\r\n }\r\n\r\n return this._priority || 0;\r\n }\r\n\r\n public get category(): LazyLoadedPropertyCategory | undefined {\r\n if (this._category === undefined) {\r\n const baseProperty = this.class.getInheritedPropertySync(this.name);\r\n if (undefined !== baseProperty) {\r\n return baseProperty.category;\r\n }\r\n }\r\n\r\n return this._category;\r\n }\r\n\r\n public get kindOfQuantity(): LazyLoadedKindOfQuantity | undefined {\r\n if (this._kindOfQuantity === undefined) {\r\n const baseProperty = this.class.getInheritedPropertySync(this.name);\r\n if (undefined !== baseProperty) {\r\n return baseProperty.kindOfQuantity;\r\n }\r\n }\r\n\r\n return this._kindOfQuantity;\r\n }\r\n\r\n public get propertyType() { return this._type; }\r\n\r\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\r\n\r\n /** Returns the name in the format 'ClassName.PropertyName'. */\r\n public get fullName(): string { return `${this._class.name}.${this.name}`; }\r\n\r\n /** Returns the schema of the class holding the property. */\r\n public get schema(): Schema { return this._class.schema; }\r\n\r\n public getCategorySync(): PropertyCategory | undefined {\r\n if (!this._category) {\r\n const baseProperty = this.class.getInheritedPropertySync(this.name);\r\n if (undefined !== baseProperty) {\r\n return baseProperty.getCategorySync();\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n return this.class.schema.lookupItemSync(this._category, PropertyCategory);\r\n }\r\n\r\n public getKindOfQuantitySync(): KindOfQuantity | undefined {\r\n if (!this._kindOfQuantity) {\r\n const baseProperty = this.class.getInheritedPropertySync(this.name);\r\n if (undefined !== baseProperty) {\r\n return baseProperty.getKindOfQuantitySync();\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n return this.class.schema.lookupItemSync(this._kindOfQuantity, KindOfQuantity);\r\n }\r\n\r\n /**\r\n * Save this Property's properties to an object for serializing to JSON.\r\n */\r\n public toJSON(): PropertyProps {\r\n const schemaJson: any = {};\r\n schemaJson.name = this.name;\r\n schemaJson.type = propertyTypeToString(this._type);\r\n if (this.description !== undefined)\r\n schemaJson.description = this.description;\r\n if (this.label !== undefined)\r\n schemaJson.label = this.label;\r\n if (this._isReadOnly !== undefined)\r\n schemaJson.isReadOnly = this._isReadOnly;\r\n if (this._category !== undefined)\r\n schemaJson.category = this._category.fullName; // needs to be fully qualified name\r\n if (this._priority !== undefined)\r\n schemaJson.priority = this._priority;\r\n if (this._kindOfQuantity !== undefined)\r\n schemaJson.kindOfQuantity = this._kindOfQuantity.fullName;\r\n const customAttributes = serializeCustomAttributes(this.customAttributes);\r\n if (customAttributes !== undefined)\r\n schemaJson.customAttributes = customAttributes;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public async toXml(schemaXml: Document): Promise<Element> {\r\n const propType = `EC${propertyTypeToString(this._type)}`.replace(\"Primitive\", \"\");\r\n const itemElement = schemaXml.createElement(propType);\r\n itemElement.setAttribute(\"propertyName\", this.name);\r\n if (undefined !== this.description)\r\n itemElement.setAttribute(\"description\", this.description);\r\n if (undefined !== this.label)\r\n itemElement.setAttribute(\"displayLabel\", this.label);\r\n if (undefined !== this.isReadOnly)\r\n itemElement.setAttribute(\"readOnly\", String(this.isReadOnly));\r\n\r\n if (undefined !== this._category) {\r\n const category = await this._category;\r\n const categoryName = XmlSerializationUtils.createXmlTypedName(this.schema, category.schema, category.name);\r\n itemElement.setAttribute(\"category\", categoryName);\r\n }\r\n\r\n if (undefined !== this._priority)\r\n itemElement.setAttribute(\"priority\", this._priority.toString());\r\n\r\n if (undefined !== this._kindOfQuantity) {\r\n const kindOfQuantity = await this._kindOfQuantity;\r\n const kindOfQuantityName = XmlSerializationUtils.createXmlTypedName(this.schema, kindOfQuantity.schema, kindOfQuantity.name);\r\n itemElement.setAttribute(\"kindOfQuantity\", kindOfQuantityName);\r\n }\r\n\r\n if (this._customAttributes) {\r\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\r\n for (const [name, attribute] of this._customAttributes) {\r\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\r\n caContainerElement.appendChild(caElement);\r\n }\r\n itemElement.appendChild(caContainerElement);\r\n }\r\n\r\n return itemElement;\r\n }\r\n\r\n public fromJSONSync(propertyProps: PropertyProps) {\r\n if (undefined !== propertyProps.label) {\r\n this._label = propertyProps.label;\r\n }\r\n\r\n if (undefined !== propertyProps.description) {\r\n this._description = propertyProps.description;\r\n }\r\n\r\n if (undefined !== propertyProps.priority) {\r\n this._priority = propertyProps.priority;\r\n }\r\n\r\n if (undefined !== propertyProps.isReadOnly) {\r\n this._isReadOnly = propertyProps.isReadOnly;\r\n }\r\n\r\n if (undefined !== propertyProps.category) {\r\n const propertyCategorySchemaItemKey = this.class.schema.getSchemaItemKey(propertyProps.category);\r\n if (!propertyCategorySchemaItemKey)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Property ${this.name} has a 'category' (\"${propertyProps.category}\") that cannot be found.`);\r\n this._category = new DelayedPromiseWithProps<SchemaItemKey, PropertyCategory>(propertyCategorySchemaItemKey,\r\n async () => {\r\n const category = await this.class.schema.lookupItem(propertyCategorySchemaItemKey, PropertyCategory);\r\n if (undefined === category)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Property ${this.name} has a 'category' (\"${propertyProps.category}\") that cannot be found.`);\r\n return category;\r\n });\r\n }\r\n\r\n if (undefined !== propertyProps.kindOfQuantity) {\r\n const koqSchemaItemKey = this.class.schema.getSchemaItemKey(propertyProps.kindOfQuantity);\r\n if (!koqSchemaItemKey)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Property ${this.name} has a 'kindOfQuantity' (\"${propertyProps.kindOfQuantity}\") that cannot be found.`);\r\n this._kindOfQuantity = new DelayedPromiseWithProps<SchemaItemKey, KindOfQuantity>(koqSchemaItemKey,\r\n async () => {\r\n const koq = await this.class.schema.lookupItem(koqSchemaItemKey, KindOfQuantity);\r\n if (undefined === koq)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Property ${this.name} has a 'kindOfQuantity' (\"${propertyProps.kindOfQuantity}\") that cannot be found.`);\r\n return koq;\r\n });\r\n }\r\n }\r\n\r\n public async fromJSON(propertyProps: PropertyProps) {\r\n this.fromJSONSync(propertyProps);\r\n }\r\n\r\n /** @internal */\r\n protected addCustomAttribute(customAttribute: CustomAttribute) {\r\n if (!this._customAttributes)\r\n this._customAttributes = new Map<string, CustomAttribute>();\r\n\r\n this._customAttributes.set(customAttribute.className, customAttribute);\r\n }\r\n\r\n /** @internal */\r\n protected setName(name: ECName) {\r\n this._name = name;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setDescription(description: string) {\r\n this._description = description;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setLabel(label: string) {\r\n this._label = label;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setIsReadOnly(isReadOnly: boolean) {\r\n this._isReadOnly = isReadOnly;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setPriority(priority: number) {\r\n this._priority = priority;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setCategory(category: LazyLoadedPropertyCategory) {\r\n this._category = category;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setKindOfQuantity(kindOfQuantity: LazyLoadedKindOfQuantity) {\r\n this._kindOfQuantity = kindOfQuantity;\r\n }\r\n\r\n /**\r\n * Retrieve all custom attributes in the current property and its base\r\n * This is the async version of getCustomAttributesSync()\r\n */\r\n public async getCustomAttributes(): Promise<CustomAttributeSet> {\r\n return this.getCustomAttributesSync();\r\n }\r\n\r\n /**\r\n * Retrieve all custom attributes in the current property and its base.\r\n */\r\n public getCustomAttributesSync(): CustomAttributeSet {\r\n let customAttributes: Map<string, CustomAttribute> | undefined = this._customAttributes;\r\n if (undefined === customAttributes) {\r\n customAttributes = new Map<string, CustomAttribute>();\r\n }\r\n\r\n const baseProperty = this.class.getInheritedPropertySync(this.name);\r\n let baseCustomAttributes;\r\n if (undefined !== baseProperty)\r\n baseCustomAttributes = baseProperty.getCustomAttributesSync();\r\n if (undefined !== baseCustomAttributes) {\r\n customAttributes = new Map<string, CustomAttribute>([...baseCustomAttributes, ...customAttributes]);\r\n }\r\n\r\n return customAttributes;\r\n }\r\n /**\r\n * @internal\r\n */\r\n public static isProperty(object: any): object is AnyProperty {\r\n const property = object as Property;\r\n\r\n return property !== undefined && property.class !== undefined && property.name !== undefined\r\n && property.propertyType !== undefined;\r\n }\r\n}\r\n\r\n\r\n\r\n/** @public @preview */\r\nexport abstract class PrimitiveOrEnumPropertyBase extends Property {\r\n /** @internal */\r\n protected _extendedTypeName?: string;\r\n /** @internal */\r\n protected _minLength?: number;\r\n /** @internal */\r\n protected _maxLength?: number;\r\n /** @internal */\r\n protected _minValue?: number;\r\n /** @internal */\r\n protected _maxValue?: number;\r\n\r\n public get extendedTypeName() { return this._extendedTypeName; }\r\n public get minLength() { return this._minLength; }\r\n public get maxLength() { return this._maxLength; }\r\n public get minValue() { return this._minValue; }\r\n public get maxValue() { return this._maxValue; }\r\n\r\n /** @internal */\r\n constructor(ecClass: ECClass, name: string, type: PropertyType) {\r\n super(ecClass, name, type);\r\n }\r\n\r\n /**\r\n * Save this PrimitiveOrEnumPropertyBase's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): PrimitiveOrEnumPropertyBaseProps {\r\n const schemaJson = super.toJSON() as any;\r\n if (this.extendedTypeName !== undefined)\r\n schemaJson.extendedTypeName = this.extendedTypeName;\r\n if (this._minLength !== undefined)\r\n schemaJson.minLength = this.minLength;\r\n if (this._maxLength !== undefined)\r\n schemaJson.maxLength = this.maxLength;\r\n if (this._minValue !== undefined)\r\n schemaJson.minValue = this.minValue;\r\n if (this._maxValue !== undefined)\r\n schemaJson.maxValue = this.maxValue;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n if (undefined !== this.extendedTypeName)\r\n itemElement.setAttribute(\"extendedTypeName\", this.extendedTypeName);\r\n if (undefined !== this.minValue)\r\n itemElement.setAttribute(\"minimumValue\", this.minValue.toString());\r\n if (undefined !== this.maxValue)\r\n itemElement.setAttribute(\"maximumValue\", this.maxValue.toString());\r\n if (undefined !== this.minLength)\r\n itemElement.setAttribute(\"minimumLength\", this.minLength.toString());\r\n if (undefined !== this.maxLength)\r\n itemElement.setAttribute(\"maximumLength\", this.maxLength.toString());\r\n\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(propertyBaseProps: PrimitiveOrEnumPropertyBaseProps) {\r\n super.fromJSONSync(propertyBaseProps);\r\n\r\n if (undefined !== propertyBaseProps.minLength) {\r\n this._minLength = propertyBaseProps.minLength;\r\n }\r\n\r\n if (undefined !== propertyBaseProps.maxLength) {\r\n this._maxLength = propertyBaseProps.maxLength;\r\n }\r\n\r\n if (undefined !== propertyBaseProps.minValue) {\r\n this._minValue = propertyBaseProps.minValue;\r\n }\r\n\r\n if (undefined !== propertyBaseProps.maxValue) {\r\n this._maxValue = propertyBaseProps.maxValue;\r\n }\r\n\r\n if (undefined !== propertyBaseProps.extendedTypeName) {\r\n this._extendedTypeName = propertyBaseProps.extendedTypeName;\r\n }\r\n }\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setExtendedTypeName(extendedTypeName: string) {\r\n this._extendedTypeName = extendedTypeName;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMinLength(minLength: number) {\r\n this._minLength = minLength;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMaxLength(maxLength: number) {\r\n this._maxLength = maxLength;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMinValue(minValue: number) {\r\n this._minValue = minValue;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMaxValue(maxValue: number) {\r\n this._maxValue = maxValue;\r\n }\r\n\r\n public override async fromJSON(propertyBaseProps: PrimitiveOrEnumPropertyBaseProps) {\r\n this.fromJSONSync(propertyBaseProps);\r\n }\r\n}\r\n\r\n/** @public @preview */\r\nexport class PrimitiveProperty extends PrimitiveOrEnumPropertyBase {\r\n public get primitiveType(): PrimitiveType { return PropertyTypeUtils.getPrimitiveType(this.propertyType); }\r\n\r\n /** @internal */\r\n constructor(ecClass: ECClass, name: string, primitiveType: PrimitiveType = PrimitiveType.Integer) {\r\n super(ecClass, name, PropertyTypeUtils.fromPrimitiveType(primitiveType));\r\n }\r\n\r\n public override fromJSONSync(primitivePropertyProps: PrimitivePropertyProps) {\r\n super.fromJSONSync(primitivePropertyProps);\r\n if (undefined !== primitivePropertyProps.typeName) {\r\n if (this.primitiveType !== parsePrimitiveType(primitivePropertyProps.typeName))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\r\n }\r\n }\r\n\r\n public override async fromJSON(primitivePropertyProps: PrimitivePropertyProps) {\r\n this.fromJSONSync(primitivePropertyProps);\r\n }\r\n\r\n /**\r\n * Save this PrimitiveProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): PrimitivePropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.typeName = primitiveTypeToString(this.primitiveType);\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n itemElement.setAttribute(\"typeName\", primitiveTypeToString(this.primitiveType));\r\n return itemElement;\r\n }\r\n}\r\n\r\n/** @public @preview */\r\nexport class EnumerationProperty extends PrimitiveOrEnumPropertyBase {\r\n /** @internal */\r\n protected _enumeration?: LazyLoadedEnumeration;\r\n\r\n public get enumeration(): LazyLoadedEnumeration | undefined { return this._enumeration; }\r\n\r\n /**\r\n * Save this EnumerationProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): EnumerationPropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.typeName = this.enumeration!.fullName;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n constructor(ecClass: ECClass, name: string, type: LazyLoadedEnumeration) {\r\n // TODO: Should we allow specifying the backing type?\r\n super(ecClass, name, PropertyType.Integer_Enumeration);\r\n this._enumeration = type;\r\n }\r\n\r\n public override fromJSONSync(enumerationPropertyProps: EnumerationPropertyProps) {\r\n super.fromJSONSync(enumerationPropertyProps);\r\n if (undefined !== enumerationPropertyProps.typeName) {\r\n if (!(this.enumeration!.fullName).match(enumerationPropertyProps.typeName)) // need to match {schema}.{version}.{itemName} on typeName\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\r\n const enumSchemaItemKey = this.class.schema.getSchemaItemKey(this.enumeration!.fullName);\r\n if (!enumSchemaItemKey)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the enumeration ${enumerationPropertyProps.typeName}.`);\r\n this._enumeration = new DelayedPromiseWithProps<SchemaItemKey, Enumeration>(enumSchemaItemKey,\r\n async () => {\r\n const enumeration = await this.class.schema.lookupItem(enumSchemaItemKey, Enumeration);\r\n if (undefined === enumeration)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the enumeration ${enumerationPropertyProps.typeName}.`);\r\n return enumeration;\r\n });\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n const enumeration = await this.enumeration;\r\n const enumerationName = XmlSerializationUtils.createXmlTypedName(this.schema, enumeration!.schema, enumeration!.name);\r\n itemElement.setAttribute(\"typeName\", enumerationName);\r\n return itemElement;\r\n }\r\n\r\n public override async fromJSON(enumerationPropertyProps: EnumerationPropertyProps) {\r\n this.fromJSONSync(enumerationPropertyProps);\r\n }\r\n\r\n}\r\n\r\n/** @public @preview */\r\nexport class StructProperty extends Property {\r\n /** @internal */\r\n protected _structClass: StructClass;\r\n\r\n public get structClass(): StructClass { return this._structClass; }\r\n\r\n /** @internal */\r\n constructor(ecClass: ECClass, name: string, type: StructClass) {\r\n super(ecClass, name, PropertyType.Struct);\r\n this._structClass = type;\r\n }\r\n\r\n /**\r\n * Save this StructProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): StructPropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.typeName = this.structClass.fullName;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n const structClassName = XmlSerializationUtils.createXmlTypedName(this.schema, this.structClass.schema, this.structClass.name);\r\n itemElement.setAttribute(\"typeName\", structClassName);\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(structPropertyProps: StructPropertyProps) {\r\n super.fromJSONSync(structPropertyProps);\r\n if (undefined !== structPropertyProps.typeName) {\r\n if (!this.structClass.key.matchesFullName(structPropertyProps.typeName))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\r\n }\r\n }\r\n\r\n public override async fromJSON(structPropertyProps: StructPropertyProps) {\r\n this.fromJSONSync(structPropertyProps);\r\n }\r\n}\r\n\r\n/** @public @preview */\r\nexport class NavigationProperty extends Property {\r\n /** @internal */\r\n protected _relationshipClass: LazyLoadedRelationshipClass;\r\n /** @internal */\r\n protected _direction: StrengthDirection;\r\n\r\n public get relationshipClass(): LazyLoadedRelationshipClass { return this._relationshipClass; }\r\n\r\n public getRelationshipClassSync(): RelationshipClass | undefined {\r\n if (!this._relationshipClass) // eslint-disable-line @typescript-eslint/no-misused-promises\r\n return undefined;\r\n\r\n // We cannot use the type guard here to avoid a circular dependency\r\n const result = this.class.schema.lookupItemSync(this._relationshipClass);\r\n return result?.schemaItemType === SchemaItemType.RelationshipClass ? result as RelationshipClass : undefined\r\n }\r\n\r\n public get direction() { return this._direction; }\r\n\r\n /**\r\n * Save this NavigationProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): NavigationPropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.relationshipName = this.relationshipClass.fullName;\r\n schemaJson.direction = strengthDirectionToString(this.direction);\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n const relationshipClass = await this.relationshipClass;\r\n const relationshipClassName = XmlSerializationUtils.createXmlTypedName(this.schema, relationshipClass.schema, relationshipClass.name);\r\n itemElement.setAttribute(\"relationshipName\", relationshipClassName);\r\n itemElement.setAttribute(\"direction\", strengthDirectionToString(this.direction));\r\n\r\n return itemElement;\r\n }\r\n\r\n /** @internal */\r\n constructor(ecClass: ECClass, name: string, relationship: LazyLoadedRelationshipClass, direction?: StrengthDirection) {\r\n super(ecClass, name, PropertyType.Navigation);\r\n this._relationshipClass = relationship;\r\n\r\n this._direction = (direction !== undefined) ? direction : StrengthDirection.Forward;\r\n }\r\n}\r\n\r\ntype Constructor<T> = new (...args: any[]) => T;\r\n\r\n// TODO: Consolidate all of the INT32_MAX variables.\r\nconst INT32_MAX = 2147483647;\r\n\r\n/** @public @preview */\r\nexport abstract class ArrayProperty extends Property {\r\n /** @internal */\r\n protected _minOccurs: number = 0;\r\n /** @internal */\r\n protected _maxOccurs?: number = INT32_MAX;\r\n\r\n public get minOccurs() { return this._minOccurs; }\r\n public get maxOccurs() { return this._maxOccurs; }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMinOccurs(minOccurs: number) {\r\n this._minOccurs = minOccurs;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMaxOccurs(maxOccurs: number) {\r\n this._maxOccurs = maxOccurs;\r\n }\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst ArrayPropertyMixin = <T extends Constructor<Property>>(Base: T) => {\r\n return class extends Base {\r\n /** @internal */\r\n protected _minOccurs: number = 0;\r\n /** @internal */\r\n protected _maxOccurs: number = INT32_MAX;\r\n\r\n public get minOccurs() { return this._minOccurs; }\r\n public get maxOccurs() { return this._maxOccurs; }\r\n\r\n constructor(...args: any[]) {\r\n super(...args);\r\n this._type = PropertyTypeUtils.asArray(this.propertyType);\r\n }\r\n\r\n public override fromJSONSync(arrayPropertyProps: PrimitiveArrayPropertyProps) {\r\n super.fromJSONSync(arrayPropertyProps);\r\n if (undefined !== arrayPropertyProps.minOccurs) {\r\n this._minOccurs = arrayPropertyProps.minOccurs;\r\n }\r\n\r\n if (undefined !== arrayPropertyProps.maxOccurs) {\r\n this._maxOccurs = arrayPropertyProps.maxOccurs;\r\n }\r\n }\r\n\r\n public override async fromJSON(arrayPropertyProps: PrimitiveArrayPropertyProps) {\r\n this.fromJSONSync(arrayPropertyProps);\r\n }\r\n\r\n /**\r\n * Save this ArrayProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): ArrayPropertyProps {\r\n const schemaJson = super.toJSON() as any;\r\n schemaJson.minOccurs = this.minOccurs;\r\n if (this.maxOccurs !== undefined)\r\n schemaJson.maxOccurs = this.maxOccurs;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n itemElement.setAttribute(\"minOccurs\", this.minOccurs.toString());\r\n if (this.maxOccurs)\r\n itemElement.setAttribute(\"maxOccurs\", this.maxOccurs.toString());\r\n\r\n return itemElement;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMinOccurs(minOccurs: number) {\r\n this._minOccurs = minOccurs;\r\n }\r\n\r\n /**\r\n * @internal Used in schema editing.\r\n */\r\n protected setMaxOccurs(maxOccurs: number) {\r\n this._maxOccurs = maxOccurs;\r\n }\r\n } as Constructor<Property> as typeof Base & Constructor<ArrayProperty>;\r\n};\r\n\r\n/** @public @preview */\r\nexport class PrimitiveArrayProperty extends ArrayPropertyMixin(PrimitiveProperty) {\r\n /** @internal */\r\n constructor(ecClass: ECClass, name: string, primitiveType: PrimitiveType = PrimitiveType.Integer) {\r\n super(ecClass, name, primitiveType);\r\n }\r\n\r\n /**\r\n * Save this PrimitiveArrayProperty's properties to an object for serializing to JSON.\r\n */\r\n public override toJSON(): PrimitiveArrayPropertyProps {\r\n return super.toJSON();\r\n }\r\n\r\n}\r\n\r\n/** @public @preview */\r\nexport class EnumerationArrayProperty extends ArrayPropertyMixin(EnumerationProperty) {\r\n constructor(ecClass: ECClass, name: string, type: LazyLoadedEnumeration) {\r\n super(ecClass, name, type);\r\n }\r\n}\r\n\r\n/** @public @preview */\r\nexport class StructArrayProperty extends ArrayPropertyMixin(StructProperty) {\r\n /** @internal */\r\n constructor(ecClass: ECClass, name: string, type: StructClass) {\r\n super(ecClass, name, type);\r\n }\r\n}\r\n\r\n/** @public @preview */\r\nexport type AnyArrayProperty = PrimitiveArrayProperty | EnumerationArrayProperty | StructArrayProperty;\r\n/** @public @preview */\r\nexport type AnyPrimitiveProperty = PrimitiveProperty | PrimitiveArrayProperty;\r\n/** @public @preview */\r\nexport type AnyEnumerationProperty = EnumerationProperty | EnumerationArrayProperty;\r\n/** @public @preview */\r\nexport type AnyStructProperty = StructProperty | StructArrayProperty;\r\n/** @public @preview */\r\nexport type AnyProperty = AnyPrimitiveProperty | AnyEnumerationProperty | AnyStructProperty | NavigationProperty;\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableProperty extends Property {\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyCategory.js","sourceRoot":"","sources":["../../../src/Metadata/PropertyCategory.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAA8C;AAC9C,4CAA6D;AAE7D,6CAA0C;AAE1C;;GAEG;AACH,MAAa,gBAAiB,SAAQ,uBAAU;IACrB,cAAc,GAAG,gBAAgB,CAAC,cAAc,CAAC;IAC1E,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,0BAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC/E,SAAS,CAAS;IAE1B,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,gBAAgB;IAChB,YAAY,MAAc,E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AAI,CAAC;YAChC,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,qBAAqB,EAAE,aAAa,0BAAc,CAAC,gBAAgB,sBAAsB,CAAC,CAAC;IACtI,CAAC;CACF;AAxED,4CAwEC;AAED;;;GAGG;AACH,MAAsB,uBAAwB,SAAQ,gBAAgB;CAGrE;AAHD,0DAGC","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 { PropertyCategoryProps } from \"../Deserialization/JsonProps\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { Schema } from \"./Schema\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * @public @preview\n */\nexport class PropertyCategory extends SchemaItem {\n public override readonly schemaItemType = PropertyCategory.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.PropertyCategory; }\n private _priority: number;\n\n public get priority() {\n return this._priority;\n }\n\n /** @internal */\n constructor(schema: Schema, name: string) {\n super(schema, name);\n this._priority = 0;\n }\n\n /**\n * Save this PropertyCategory's properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): PropertyCategoryProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.priority = this.priority;\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"priority\", this.priority.toString());\n return itemElement;\n }\n\n public override fromJSONSync(propertyCategoryProps: PropertyCategoryProps) {\n super.fromJSONSync(propertyCategoryProps);\n this._priority = propertyCategoryProps.priority;\n }\n\n public override async fromJSON(propertyCategoryProps: PropertyCategoryProps) {\n this.fromJSONSync(propertyCategoryProps);\n }\n /**\n * Used for schema editing.\n * @internal\n */\n protected setPriority(priority: number) {\n this._priority = priority;\n }\n\n /**\n * Type guard to check if the SchemaItem is of type PropertyCategory.\n * @param item The SchemaItem to check.\n * @returns True if the item is a PropertyCategory, false otherwise.\n */\n public static isPropertyCategory(item?: SchemaItem): item is PropertyCategory {\n if (item && item.schemaItemType === SchemaItemType.PropertyCategory)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type PropertyCategory.\n * @param item The SchemaItem to check.\n * @returns The item cast to PropertyCategory if it is a PropertyCategory, undefined otherwise.\n * @internal\n */\n public static assertIsPropertyCategory(item?: SchemaItem): asserts item is PropertyCategory {\n if (!this.isPropertyCategory(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.PropertyCategory}' (PropertyCategory)`);\n }\n}\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutablePropertyCategory extends PropertyCategory {\n public abstract override setPriority(priority: number): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
1
+ {"version":3,"file":"PropertyCategory.js","sourceRoot":"","sources":["../../../src/Metadata/PropertyCategory.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAA8C;AAC9C,4CAA6D;AAE7D,6CAA0C;AAE1C;;GAEG;AACH,MAAa,gBAAiB,SAAQ,uBAAU;IACrB,cAAc,GAAG,gBAAgB,CAAC,cAAc,CAAC;IAC1E,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,0BAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC/E,SAAS,CAAS;IAE1B,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,gBAAgB;IAChB,YAAY,MAAc,EAAE,IAAY;QACtC,KAAK,CAAC,MAAM,EAAE,IAAI,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c,CAAC,qBAAqB,EAAE,aAAa,0BAAc,CAAC,gBAAgB,sBAAsB,CAAC,CAAC;IACtI,CAAC;CACF;AAxED,4CAwEC;AAED;;;GAGG;AACH,MAAsB,uBAAwB,SAAQ,gBAAgB;CAGrE;AAHD,0DAGC","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 Metadata\r\n */\r\n\r\nimport { PropertyCategoryProps } from \"../Deserialization/JsonProps\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\n\r\n/**\r\n * @public @preview\r\n */\r\nexport class PropertyCategory extends SchemaItem {\r\n public override readonly schemaItemType = PropertyCategory.schemaItemType;\r\n /** @internal */\r\n public static override get schemaItemType() { return SchemaItemType.PropertyCategory; }\r\n private _priority: number;\r\n\r\n public get priority() {\r\n return this._priority;\r\n }\r\n\r\n /** @internal */\r\n constructor(schema: Schema, name: string) {\r\n super(schema, name);\r\n this._priority = 0;\r\n }\r\n\r\n /**\r\n * Save this PropertyCategory's properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): PropertyCategoryProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.priority = this.priority;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n itemElement.setAttribute(\"priority\", this.priority.toString());\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(propertyCategoryProps: PropertyCategoryProps) {\r\n super.fromJSONSync(propertyCategoryProps);\r\n this._priority = propertyCategoryProps.priority;\r\n }\r\n\r\n public override async fromJSON(propertyCategoryProps: PropertyCategoryProps) {\r\n this.fromJSONSync(propertyCategoryProps);\r\n }\r\n /**\r\n * Used for schema editing.\r\n * @internal\r\n */\r\n protected setPriority(priority: number) {\r\n this._priority = priority;\r\n }\r\n\r\n /**\r\n * Type guard to check if the SchemaItem is of type PropertyCategory.\r\n * @param item The SchemaItem to check.\r\n * @returns True if the item is a PropertyCategory, false otherwise.\r\n */\r\n public static isPropertyCategory(item?: SchemaItem): item is PropertyCategory {\r\n if (item && item.schemaItemType === SchemaItemType.PropertyCategory)\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Type assertion to check if the SchemaItem is of type PropertyCategory.\r\n * @param item The SchemaItem to check.\r\n * @returns The item cast to PropertyCategory if it is a PropertyCategory, undefined otherwise.\r\n * @internal\r\n */\r\n public static assertIsPropertyCategory(item?: SchemaItem): asserts item is PropertyCategory {\r\n if (!this.isPropertyCategory(item))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.PropertyCategory}' (PropertyCategory)`);\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutablePropertyCategory extends PropertyCategory {\r\n public abstract override setPriority(priority: number): void;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipClass.js","sourceRoot":"","sources":["../../../src/Metadata/RelationshipClass.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4D;AAC5D,sDAA4E;AAE5E,oFAAiF;AACjF,4CAGsB;AACtB,4CAA6D;AAG7D,mCAAkC;AAClC,uDAAkI;AAClI,+CAAoG;AACpG,mCAAgC;AAGhC,6CAA0C;AAI1C;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,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IAEM,QAAQ;QACb,OAAO,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC;IAC1F,CAAC;;AAxCH,4DAyCC;AAED;;;GAGG;AACH,MAAsB,wBAAyB,SAAQ,iBAAiB;IACtE,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;IACtF,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;CAMvF;AARD,4DAQC","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 { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\nimport { RelationshipClassProps, RelationshipConstraintProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport {\n ECClassModifier, parseStrength, parseStrengthDirection, RelationshipEnd, SchemaItemType, StrengthDirection, strengthDirectionToString,\n strengthToString, StrengthType,\n} from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { LazyLoadedRelationshipConstraintClass } from \"../Interfaces\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { ECClass } from \"./Class\";\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\nimport { createNavigationProperty, createNavigationPropertySync, EntityClass } from \"./EntityClass\";\nimport { Mixin } from \"./Mixin\";\nimport { NavigationProperty } from \"./Property\";\nimport { Schema } from \"./Schema\";\nimport { SchemaItem } from \"./SchemaItem\";\n\ntype AnyConstraintClass = EntityClass | Mixin | RelationshipClass;\n\n/**\n * A Typescript class representation of a ECRelationshipClass.\n * @public @preview\n */\nexport class RelationshipClass extends ECClass {\n public override readonly schemaItemType = RelationshipClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.RelationshipClass; }\n /** @internal */\n protected _strength: StrengthType;\n /** @internal */\n protected _strengthDirection: StrengthDirection;\n /** @internal */\n protected _source: RelationshipConstraint;\n /** @internal */\n protected _target: RelationshipConstraint;\n\n /** @internal */\n constructor(schema: Schema, name: string, modifier?: ECClassModifier) {\n super(schema, name, modifier);\n this._strengthDirection = StrengthDirection.Forward;\n this._strength = StrengthType.Referencing;\n this._source = new RelationshipConstraint(this, RelationshipEnd.Source);\n this._target = new RelationshipConstraint(this, RelationshipEnd.Target);\n }\n\n public get strength() { return this._strength; }\n public get strengthDirection() { return this._strengthDirection; }\n public get source() { return this._source; }\n public get target() { return this._target; }\n\n /**\n *\n * @param name\n * @param relationship\n * @param direction\n * @internal\n */\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\n }\n\n /** @internal */\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\n }\n\n /**\n * @internal Used for schema editing.\n */\n protected setStrength(strength: StrengthType) {\n this._strength = strength;\n }\n\n /**\n * @internal Used for schema editing.\n */\n protected setStrengthDirection(direction: StrengthDirection) {\n this._strengthDirection = direction;\n }\n\n /**\n * @internal Used for schema editing.\n */\n protected setSourceConstraint(source: RelationshipConstraint) {\n this._source = source;\n }\n\n /**\n * @internal Used for schema editing.\n */\n protected setTargetConstraint(target: RelationshipConstraint) {\n this._target = target;\n }\n /**\n * Save this RelationshipClass's properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): RelationshipClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.strength = strengthToString(this.strength);\n schemaJson.strengthDirection = strengthDirectionToString(this.strengthDirection);\n schemaJson.source = this.source.toJSON();\n schemaJson.target = this.target.toJSON();\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"strength\", strengthToString(this.strength));\n itemElement.setAttribute(\"strengthDirection\", strengthDirectionToString(this.strengthDirection));\n itemElement.appendChild(await this.source.toXml(schemaXml));\n itemElement.appendChild(await this.target.toXml(schemaXml));\n return itemElement;\n }\n\n public override fromJSONSync(relationshipClassProps: RelationshipClassProps) {\n super.fromJSONSync(relationshipClassProps);\n\n let strength = parseStrength(relationshipClassProps.strength);\n if (undefined === strength) {\n if (SchemaReadHelper.isECSpecVersionNewer({ readVersion: relationshipClassProps.originalECSpecMajorVersion, writeVersion: relationshipClassProps.originalECSpecMinorVersion } as ECSpecVersion))\n strength = StrengthType.Referencing;\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strength' attribute. '${relationshipClassProps.strength}' is not a valid StrengthType.`);\n }\n\n const strengthDirection = parseStrengthDirection(relationshipClassProps.strengthDirection);\n if (undefined === strengthDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strengthDirection' attribute. '${relationshipClassProps.strengthDirection}' is not a valid StrengthDirection.`);\n\n this._strength = strength;\n this._strengthDirection = strengthDirection;\n }\n\n public override async fromJSON(relationshipClassProps: RelationshipClassProps) {\n this.fromJSONSync(relationshipClassProps);\n }\n\n /**\n * Type guard to check if the SchemaItem is of type RelationshipClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is a RelationshipClass, false otherwise.\n */\n public static isRelationshipClass(item?: SchemaItem): item is RelationshipClass {\n if (item && item.schemaItemType === SchemaItemType.RelationshipClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type RelationshipClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to RelationshipClass if it is a RelationshipClass, undefined otherwise.\n * @internal\n */\n public static assertIsRelationshipClass(item?: SchemaItem): asserts item is RelationshipClass {\n if (!this.isRelationshipClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.RelationshipClass}' (RelationshipClass)`);\n }\n}\n\n/**\n * A Typescript class representation of a ECRelationshipConstraint.\n * @public @preview\n */\nexport class RelationshipConstraint implements CustomAttributeContainerProps {\n private _abstractConstraint?: LazyLoadedRelationshipConstraintClass;\n private _relationshipClass: RelationshipClass;\n private _relationshipEnd: RelationshipEnd;\n private _multiplicity?: RelationshipMultiplicity;\n private _polymorphic?: boolean;\n private _roleLabel?: string;\n private _constraintClasses?: LazyLoadedRelationshipConstraintClass[];\n private _customAttributes?: Map<string, CustomAttribute>;\n\n /** @internal */\n constructor(relClass: RelationshipClass, relEnd: RelationshipEnd, roleLabel?: string, polymorphic?: boolean) {\n this._relationshipEnd = relEnd;\n if (polymorphic)\n this._polymorphic = polymorphic;\n else\n this._polymorphic = false;\n\n this._multiplicity = RelationshipMultiplicity.zeroOne;\n this._relationshipClass = relClass;\n this._roleLabel = roleLabel;\n }\n\n public get multiplicity() { return this._multiplicity ?? RelationshipMultiplicity.zeroOne; }\n\n public get polymorphic() { return this._polymorphic ?? false; }\n\n public get roleLabel() { return this._roleLabel; }\n\n public get constraintClasses(): ReadonlyArray<LazyLoadedRelationshipConstraintClass> | undefined { return this._constraintClasses; }\n\n public get relationshipClass() { return this._relationshipClass; }\n\n public get relationshipEnd() { return this._relationshipEnd; }\n\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\n\n /** Returns the constraint name, ie. 'RelationshipName.Source/Target' */\n public get fullName() { return `${this._relationshipClass.name}:${this.isSource ? \"Source\" : \"Target\"}`; }\n\n /** Returns the schema of the RelationshipClass. */\n public get schema(): Schema { return this._relationshipClass.schema; }\n\n public get abstractConstraint(): LazyLoadedRelationshipConstraintClass | undefined {\n if (this._abstractConstraint)\n return this._abstractConstraint;\n\n if (this.constraintClasses && this.constraintClasses.length === 1)\n return this.constraintClasses[0];\n\n return this._abstractConstraint;\n }\n\n /**\n * True if this RelationshipConstraint is the Source relationship end.\n */\n public get isSource(): boolean { return this.relationshipEnd === RelationshipEnd.Source; }\n\n /**\n * Adds the provided class as a constraint class to this constraint.\n * @param constraint The class to add as a constraint class.\n * @internal\n */\n public addClass(constraint: LazyLoadedRelationshipConstraintClass): void {\n // TODO: Ensure we don't start mixing constraint class types\n // TODO: Check that this class is or subclasses abstract constraint?\n\n if (!this._constraintClasses)\n this._constraintClasses = [];\n\n // TODO: Handle relationship constraints\n this._constraintClasses.push(constraint);\n }\n\n /**\n * Removes the provided class as a constraint class from this constraint.\n * @param constraint The class to add as a constraint class.\n *\n * @internal\n */\n protected removeClass(constraint: LazyLoadedRelationshipConstraintClass): void {\n if (undefined === this._constraintClasses)\n return;\n\n this._constraintClasses.forEach((item, index) => {\n const constraintName = item.fullName;\n if (constraintName === constraint.fullName)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._constraintClasses?.splice(index, 1);\n });\n }\n\n /**\n * Save this RelationshipConstraint's properties to an object for serializing to JSON.\n */\n public toJSON(): RelationshipConstraintProps {\n const schemaJson: { [value: string]: any } = {};\n schemaJson.multiplicity = this.multiplicity.toString();\n schemaJson.roleLabel = this.roleLabel;\n schemaJson.polymorphic = this.polymorphic;\n if (undefined !== this._abstractConstraint)\n schemaJson.abstractConstraint = this._abstractConstraint.fullName;\n if (undefined !== this.constraintClasses && this.constraintClasses.length > 0)\n schemaJson.constraintClasses = this.constraintClasses.map((constraintClass) => constraintClass.fullName);\n\n const customAttributes = serializeCustomAttributes(this.customAttributes);\n if (undefined !== customAttributes)\n schemaJson.customAttributes = customAttributes;\n return schemaJson as RelationshipConstraintProps;\n }\n\n /** @internal */\n public async toXml(schemaXml: Document): Promise<Element> {\n const elementName = this.isSource ? \"Source\" : \"Target\";\n const itemElement = schemaXml.createElement(elementName);\n if (undefined !== this.polymorphic)\n itemElement.setAttribute(\"polymorphic\", this.polymorphic.toString());\n if (undefined !== this.roleLabel)\n itemElement.setAttribute(\"roleLabel\", this.roleLabel);\n if (undefined !== this.multiplicity)\n itemElement.setAttribute(\"multiplicity\", this.multiplicity.toString());\n\n const abstractConstraint = await this.abstractConstraint;\n if (undefined !== abstractConstraint) {\n const abstractConstraintName = XmlSerializationUtils.createXmlTypedName(this.schema, abstractConstraint.schema, abstractConstraint.name);\n itemElement.setAttribute(\"abstractConstraint\", abstractConstraintName);\n }\n\n if (undefined !== this.constraintClasses) {\n for (const item of this.constraintClasses) {\n const constraintClass = await item;\n const classElement = schemaXml.createElement(\"Class\");\n const constraintClassName = XmlSerializationUtils.createXmlTypedName(this.schema, constraintClass.schema, constraintClass.name);\n classElement.setAttribute(\"class\", constraintClassName);\n itemElement.appendChild(classElement);\n }\n }\n\n if (this._customAttributes) {\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\n for (const [name, attribute] of this._customAttributes) {\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\n caContainerElement.appendChild(caElement);\n }\n itemElement.appendChild(caContainerElement);\n }\n\n return itemElement;\n }\n\n public fromJSONSync(relationshipConstraintProps: RelationshipConstraintProps) {\n\n this._roleLabel = relationshipConstraintProps.roleLabel;\n this._polymorphic = relationshipConstraintProps.polymorphic;\n\n const parsedMultiplicity = RelationshipMultiplicity.fromString(relationshipConstraintProps.multiplicity);\n if (!parsedMultiplicity)\n throw new ECSchemaError(ECSchemaStatus.InvalidMultiplicity, ``);\n this._multiplicity = parsedMultiplicity;\n\n const relClassSchema = this.relationshipClass.schema;\n\n if (undefined !== relationshipConstraintProps.abstractConstraint) {\n const abstractConstraintSchemaItemKey = relClassSchema.getSchemaItemKey(relationshipConstraintProps.abstractConstraint);\n if (!abstractConstraintSchemaItemKey)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\n this.setAbstractConstraint(new DelayedPromiseWithProps<SchemaItemKey, AnyConstraintClass>(abstractConstraintSchemaItemKey,\n async () => {\n const tempAbstractConstraint = await relClassSchema.lookupItem(relationshipConstraintProps.abstractConstraint!);\n if (undefined === tempAbstractConstraint ||\n (!EntityClass.isEntityClass(tempAbstractConstraint) && !Mixin.isMixin(tempAbstractConstraint) && !RelationshipClass.isRelationshipClass(tempAbstractConstraint)))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\n\n return tempAbstractConstraint;\n }));\n }\n\n const loadEachConstraint = (constraintClassName: any) => {\n const tempConstraintClass = relClassSchema.lookupItemSync(constraintClassName);\n if (!tempConstraintClass ||\n (!EntityClass.isEntityClass(tempConstraintClass) && !Mixin.isMixin(tempConstraintClass) && !RelationshipClass.isRelationshipClass(tempConstraintClass)))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n return tempConstraintClass;\n };\n\n for (const constraintClassName of relationshipConstraintProps.constraintClasses) {\n const constraintClass = loadEachConstraint(constraintClassName);\n this.addClass(new DelayedPromiseWithProps(constraintClass.key, async () => constraintClass));\n }\n }\n\n public async fromJSON(relationshipConstraintProps: RelationshipConstraintProps) {\n this.fromJSONSync(relationshipConstraintProps);\n }\n\n /**\n * Indicates if the provided [[ECClass]] is supported by this [[RelationshipConstraint]].\n * @param ecClass The class to check.\n */\n public async supportsClass(ecClass: ECClass): Promise<boolean> {\n if (!this.constraintClasses) {\n if (this.relationshipClass.baseClass) {\n const baseRelationship = await this.relationshipClass.baseClass as RelationshipClass;\n const baseConstraint = this.isSource ? baseRelationship.source : baseRelationship.target;\n return baseConstraint.supportsClass(ecClass);\n }\n return false;\n }\n\n if (ecClass.schemaItemType !== SchemaItemType.EntityClass && ecClass.schemaItemType !== SchemaItemType.RelationshipClass &&\n ecClass.schemaItemType !== SchemaItemType.Mixin) {\n return false;\n }\n\n const abstractConstraint = await this.abstractConstraint;\n\n if (abstractConstraint && await RelationshipConstraint.classCompatibleWithConstraint(abstractConstraint, ecClass, this.polymorphic || false))\n return true;\n\n for (const constraint of this.constraintClasses) {\n if (await RelationshipConstraint.classCompatibleWithConstraint(await constraint, ecClass, this.polymorphic || false))\n return true;\n }\n\n return false;\n }\n\n /**\n * Indicates if an ECClass is of the type or applies to the type (if a mixin) of the ECClass specified by the constraintClass parameter.\n * @param constraintClass The ECClass that is a constraint class of a relationship.\n * @param testClass The ECClass to check against the constraint class.\n * @param isPolymorphic Indicates if the testClass should be checked polymorphically.\n */\n public static async classCompatibleWithConstraint(constraintClass: ECClass, testClass: ECClass, isPolymorphic: boolean): Promise<boolean> {\n if (SchemaItem.equalByKey(constraintClass, testClass))\n return true;\n\n if (isPolymorphic) {\n if (testClass.schemaItemType === SchemaItemType.EntityClass || testClass.schemaItemType === SchemaItemType.RelationshipClass) {\n return testClass.is(constraintClass);\n }\n\n if (testClass.schemaItemType === SchemaItemType.Mixin) {\n if (constraintClass.schemaItemType === SchemaItemType.EntityClass)\n return (testClass as Mixin).applicableTo(constraintClass as EntityClass);\n else\n return testClass.is(constraintClass);\n }\n }\n return false;\n }\n\n /**\n * @internal\n */\n public static isRelationshipConstraint(object: any): object is RelationshipConstraint {\n const relationshipConstraint = object as RelationshipConstraint;\n\n return relationshipConstraint !== undefined && relationshipConstraint.polymorphic !== undefined && relationshipConstraint.multiplicity !== undefined\n && relationshipConstraint.relationshipEnd !== undefined && relationshipConstraint._relationshipClass !== undefined;\n }\n\n /** @internal */\n protected addCustomAttribute(customAttribute: CustomAttribute) {\n if (!this._customAttributes)\n this._customAttributes = new Map<string, CustomAttribute>();\n\n this._customAttributes.set(customAttribute.className, customAttribute);\n }\n\n /** @internal */\n protected setRoleLabel(roleLabel: string | undefined) {\n this._roleLabel = roleLabel;\n }\n\n /** @internal */\n protected setRelationshipEnd(relationshipEnd: RelationshipEnd) {\n this._relationshipEnd = relationshipEnd;\n }\n\n /** @internal */\n protected setPolymorphic(polymorphic: boolean) {\n this._polymorphic = polymorphic;\n }\n\n /** @internal */\n protected setMultiplicity(multiplicity: RelationshipMultiplicity) {\n this._multiplicity = multiplicity;\n }\n\n /** @internal */\n protected setAbstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined) {\n this._abstractConstraint = abstractConstraint;\n }\n}\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * @internal\n */\nexport abstract class MutableRelationshipConstraint extends RelationshipConstraint {\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\n public abstract override setRoleLabel(roleLabel: string | undefined): void;\n public abstract override setRelationshipEnd(relationshipEnd: RelationshipEnd): void;\n public abstract override setPolymorphic(polymorphic: boolean): void;\n public abstract override setMultiplicity(multiplicity: RelationshipMultiplicity): void;\n public abstract override setAbstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined): void;\n}\n\nconst INT32_MAX = 2147483647;\n\n/**\n * @public @preview\n */\nexport class RelationshipMultiplicity {\n public static readonly zeroOne = new RelationshipMultiplicity(0, 1);\n public static readonly zeroMany = new RelationshipMultiplicity(0, INT32_MAX);\n public static readonly oneOne = new RelationshipMultiplicity(1, 1);\n public static readonly oneMany = new RelationshipMultiplicity(1, INT32_MAX);\n\n public readonly lowerLimit: number;\n public readonly upperLimit: number;\n\n /** @internal */\n constructor(lowerLimit: number, upperLimit: number) {\n this.lowerLimit = lowerLimit;\n this.upperLimit = upperLimit;\n }\n\n public static fromString(str: string): RelationshipMultiplicity | undefined {\n const matches = /^\\(([0-9]*)\\.\\.([0-9]*|\\*)\\)$/.exec(str);\n if (matches === null || matches.length !== 3)\n return undefined;\n\n const lowerLimit = parseInt(matches[1], 10);\n const upperLimit = matches[2] === \"*\" ? INT32_MAX : parseInt(matches[2], 10);\n if (0 === lowerLimit && 1 === upperLimit)\n return RelationshipMultiplicity.zeroOne;\n else if (0 === lowerLimit && INT32_MAX === upperLimit)\n return RelationshipMultiplicity.zeroMany;\n else if (1 === lowerLimit && 1 === upperLimit)\n return RelationshipMultiplicity.oneOne;\n else if (1 === lowerLimit && INT32_MAX === upperLimit)\n return RelationshipMultiplicity.oneMany;\n\n return new RelationshipMultiplicity(lowerLimit, upperLimit);\n }\n\n public equals(rhs: RelationshipMultiplicity): boolean {\n return this.lowerLimit === rhs.lowerLimit && this.upperLimit === rhs.upperLimit;\n }\n\n public toString(): string {\n return `(${this.lowerLimit}..${this.upperLimit === INT32_MAX ? \"*\" : this.upperLimit})`;\n }\n}\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableRelationshipClass extends RelationshipClass {\n public override get source() { return this._source as MutableRelationshipConstraint; }\n public override get target() { return this._target as MutableRelationshipConstraint; }\n public abstract override setStrength(strength: StrengthType): void;\n public abstract override setStrengthDirection(direction: StrengthDirection): void;\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
1
+ {"version":3,"file":"RelationshipClass.js","sourceRoot":"","sources":["../../../src/Metadata/RelationshipClass.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4D;AAC5D,sDAA4E;AAE5E,oFAAiF;AACjF,4CAGsB;AACtB,4CAA6D;AAG7D,mCAAkC;AAClC,uDAAkI;AAClI,+CAAoG;AACpG,mCAAgC;AAGhC,6CAA0C;AAI1C;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,eAAO;IACnB,cAAc,GAAG,iBAAiB,CAAC,cAAc,CAAC;IAC3E,gBAAgB;IACT,MAAM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K,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC;IAC1F,CAAC;;AAxCH,4DAyCC;AAED;;;GAGG;AACH,MAAsB,wBAAyB,SAAQ,iBAAiB;IACtE,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;IACtF,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;CAMvF;AARD,4DAQC","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 Metadata\r\n */\r\n\r\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\r\nimport { RelationshipClassProps, RelationshipConstraintProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport {\r\n ECClassModifier, parseStrength, parseStrengthDirection, RelationshipEnd, SchemaItemType, StrengthDirection, strengthDirectionToString,\r\n strengthToString, StrengthType,\r\n} from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { LazyLoadedRelationshipConstraintClass } from \"../Interfaces\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { ECClass } from \"./Class\";\r\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\r\nimport { createNavigationProperty, createNavigationPropertySync, EntityClass } from \"./EntityClass\";\r\nimport { Mixin } from \"./Mixin\";\r\nimport { NavigationProperty } from \"./Property\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\n\r\ntype AnyConstraintClass = EntityClass | Mixin | RelationshipClass;\r\n\r\n/**\r\n * A Typescript class representation of a ECRelationshipClass.\r\n * @public @preview\r\n */\r\nexport class RelationshipClass extends ECClass {\r\n public override readonly schemaItemType = RelationshipClass.schemaItemType;\r\n /** @internal */\r\n public static override get schemaItemType() { return SchemaItemType.RelationshipClass; }\r\n /** @internal */\r\n protected _strength: StrengthType;\r\n /** @internal */\r\n protected _strengthDirection: StrengthDirection;\r\n /** @internal */\r\n protected _source: RelationshipConstraint;\r\n /** @internal */\r\n protected _target: RelationshipConstraint;\r\n\r\n /** @internal */\r\n constructor(schema: Schema, name: string, modifier?: ECClassModifier) {\r\n super(schema, name, modifier);\r\n this._strengthDirection = StrengthDirection.Forward;\r\n this._strength = StrengthType.Referencing;\r\n this._source = new RelationshipConstraint(this, RelationshipEnd.Source);\r\n this._target = new RelationshipConstraint(this, RelationshipEnd.Target);\r\n }\r\n\r\n public get strength() { return this._strength; }\r\n public get strengthDirection() { return this._strengthDirection; }\r\n public get source() { return this._source; }\r\n public get target() { return this._target; }\r\n\r\n /**\r\n *\r\n * @param name\r\n * @param relationship\r\n * @param direction\r\n * @internal\r\n */\r\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\r\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\r\n }\r\n\r\n /** @internal */\r\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\r\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\r\n }\r\n\r\n /**\r\n * @internal Used for schema editing.\r\n */\r\n protected setStrength(strength: StrengthType) {\r\n this._strength = strength;\r\n }\r\n\r\n /**\r\n * @internal Used for schema editing.\r\n */\r\n protected setStrengthDirection(direction: StrengthDirection) {\r\n this._strengthDirection = direction;\r\n }\r\n\r\n /**\r\n * @internal Used for schema editing.\r\n */\r\n protected setSourceConstraint(source: RelationshipConstraint) {\r\n this._source = source;\r\n }\r\n\r\n /**\r\n * @internal Used for schema editing.\r\n */\r\n protected setTargetConstraint(target: RelationshipConstraint) {\r\n this._target = target;\r\n }\r\n /**\r\n * Save this RelationshipClass's properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): RelationshipClassProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.strength = strengthToString(this.strength);\r\n schemaJson.strengthDirection = strengthDirectionToString(this.strengthDirection);\r\n schemaJson.source = this.source.toJSON();\r\n schemaJson.target = this.target.toJSON();\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n itemElement.setAttribute(\"strength\", strengthToString(this.strength));\r\n itemElement.setAttribute(\"strengthDirection\", strengthDirectionToString(this.strengthDirection));\r\n itemElement.appendChild(await this.source.toXml(schemaXml));\r\n itemElement.appendChild(await this.target.toXml(schemaXml));\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(relationshipClassProps: RelationshipClassProps) {\r\n super.fromJSONSync(relationshipClassProps);\r\n\r\n let strength = parseStrength(relationshipClassProps.strength);\r\n if (undefined === strength) {\r\n if (SchemaReadHelper.isECSpecVersionNewer({ readVersion: relationshipClassProps.originalECSpecMajorVersion, writeVersion: relationshipClassProps.originalECSpecMinorVersion } as ECSpecVersion))\r\n strength = StrengthType.Referencing;\r\n else\r\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strength' attribute. '${relationshipClassProps.strength}' is not a valid StrengthType.`);\r\n }\r\n\r\n const strengthDirection = parseStrengthDirection(relationshipClassProps.strengthDirection);\r\n if (undefined === strengthDirection)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `The RelationshipClass ${this.fullName} has an invalid 'strengthDirection' attribute. '${relationshipClassProps.strengthDirection}' is not a valid StrengthDirection.`);\r\n\r\n this._strength = strength;\r\n this._strengthDirection = strengthDirection;\r\n }\r\n\r\n public override async fromJSON(relationshipClassProps: RelationshipClassProps) {\r\n this.fromJSONSync(relationshipClassProps);\r\n }\r\n\r\n /**\r\n * Type guard to check if the SchemaItem is of type RelationshipClass.\r\n * @param item The SchemaItem to check.\r\n * @returns True if the item is a RelationshipClass, false otherwise.\r\n */\r\n public static isRelationshipClass(item?: SchemaItem): item is RelationshipClass {\r\n if (item && item.schemaItemType === SchemaItemType.RelationshipClass)\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Type assertion to check if the SchemaItem is of type RelationshipClass.\r\n * @param item The SchemaItem to check.\r\n * @returns The item cast to RelationshipClass if it is a RelationshipClass, undefined otherwise.\r\n * @internal\r\n */\r\n public static assertIsRelationshipClass(item?: SchemaItem): asserts item is RelationshipClass {\r\n if (!this.isRelationshipClass(item))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.RelationshipClass}' (RelationshipClass)`);\r\n }\r\n}\r\n\r\n/**\r\n * A Typescript class representation of a ECRelationshipConstraint.\r\n * @public @preview\r\n */\r\nexport class RelationshipConstraint implements CustomAttributeContainerProps {\r\n private _abstractConstraint?: LazyLoadedRelationshipConstraintClass;\r\n private _relationshipClass: RelationshipClass;\r\n private _relationshipEnd: RelationshipEnd;\r\n private _multiplicity?: RelationshipMultiplicity;\r\n private _polymorphic?: boolean;\r\n private _roleLabel?: string;\r\n private _constraintClasses?: LazyLoadedRelationshipConstraintClass[];\r\n private _customAttributes?: Map<string, CustomAttribute>;\r\n\r\n /** @internal */\r\n constructor(relClass: RelationshipClass, relEnd: RelationshipEnd, roleLabel?: string, polymorphic?: boolean) {\r\n this._relationshipEnd = relEnd;\r\n if (polymorphic)\r\n this._polymorphic = polymorphic;\r\n else\r\n this._polymorphic = false;\r\n\r\n this._multiplicity = RelationshipMultiplicity.zeroOne;\r\n this._relationshipClass = relClass;\r\n this._roleLabel = roleLabel;\r\n }\r\n\r\n public get multiplicity() { return this._multiplicity ?? RelationshipMultiplicity.zeroOne; }\r\n\r\n public get polymorphic() { return this._polymorphic ?? false; }\r\n\r\n public get roleLabel() { return this._roleLabel; }\r\n\r\n public get constraintClasses(): ReadonlyArray<LazyLoadedRelationshipConstraintClass> | undefined { return this._constraintClasses; }\r\n\r\n public get relationshipClass() { return this._relationshipClass; }\r\n\r\n public get relationshipEnd() { return this._relationshipEnd; }\r\n\r\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\r\n\r\n /** Returns the constraint name, ie. 'RelationshipName.Source/Target' */\r\n public get fullName() { return `${this._relationshipClass.name}:${this.isSource ? \"Source\" : \"Target\"}`; }\r\n\r\n /** Returns the schema of the RelationshipClass. */\r\n public get schema(): Schema { return this._relationshipClass.schema; }\r\n\r\n public get abstractConstraint(): LazyLoadedRelationshipConstraintClass | undefined {\r\n if (this._abstractConstraint)\r\n return this._abstractConstraint;\r\n\r\n if (this.constraintClasses && this.constraintClasses.length === 1)\r\n return this.constraintClasses[0];\r\n\r\n return this._abstractConstraint;\r\n }\r\n\r\n /**\r\n * True if this RelationshipConstraint is the Source relationship end.\r\n */\r\n public get isSource(): boolean { return this.relationshipEnd === RelationshipEnd.Source; }\r\n\r\n /**\r\n * Adds the provided class as a constraint class to this constraint.\r\n * @param constraint The class to add as a constraint class.\r\n * @internal\r\n */\r\n public addClass(constraint: LazyLoadedRelationshipConstraintClass): void {\r\n // TODO: Ensure we don't start mixing constraint class types\r\n // TODO: Check that this class is or subclasses abstract constraint?\r\n\r\n if (!this._constraintClasses)\r\n this._constraintClasses = [];\r\n\r\n // TODO: Handle relationship constraints\r\n this._constraintClasses.push(constraint);\r\n }\r\n\r\n /**\r\n * Removes the provided class as a constraint class from this constraint.\r\n * @param constraint The class to add as a constraint class.\r\n *\r\n * @internal\r\n */\r\n protected removeClass(constraint: LazyLoadedRelationshipConstraintClass): void {\r\n if (undefined === this._constraintClasses)\r\n return;\r\n\r\n this._constraintClasses.forEach((item, index) => {\r\n const constraintName = item.fullName;\r\n if (constraintName === constraint.fullName)\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._constraintClasses?.splice(index, 1);\r\n });\r\n }\r\n\r\n /**\r\n * Save this RelationshipConstraint's properties to an object for serializing to JSON.\r\n */\r\n public toJSON(): RelationshipConstraintProps {\r\n const schemaJson: { [value: string]: any } = {};\r\n schemaJson.multiplicity = this.multiplicity.toString();\r\n schemaJson.roleLabel = this.roleLabel;\r\n schemaJson.polymorphic = this.polymorphic;\r\n if (undefined !== this._abstractConstraint)\r\n schemaJson.abstractConstraint = this._abstractConstraint.fullName;\r\n if (undefined !== this.constraintClasses && this.constraintClasses.length > 0)\r\n schemaJson.constraintClasses = this.constraintClasses.map((constraintClass) => constraintClass.fullName);\r\n\r\n const customAttributes = serializeCustomAttributes(this.customAttributes);\r\n if (undefined !== customAttributes)\r\n schemaJson.customAttributes = customAttributes;\r\n return schemaJson as RelationshipConstraintProps;\r\n }\r\n\r\n /** @internal */\r\n public async toXml(schemaXml: Document): Promise<Element> {\r\n const elementName = this.isSource ? \"Source\" : \"Target\";\r\n const itemElement = schemaXml.createElement(elementName);\r\n if (undefined !== this.polymorphic)\r\n itemElement.setAttribute(\"polymorphic\", this.polymorphic.toString());\r\n if (undefined !== this.roleLabel)\r\n itemElement.setAttribute(\"roleLabel\", this.roleLabel);\r\n if (undefined !== this.multiplicity)\r\n itemElement.setAttribute(\"multiplicity\", this.multiplicity.toString());\r\n\r\n const abstractConstraint = await this.abstractConstraint;\r\n if (undefined !== abstractConstraint) {\r\n const abstractConstraintName = XmlSerializationUtils.createXmlTypedName(this.schema, abstractConstraint.schema, abstractConstraint.name);\r\n itemElement.setAttribute(\"abstractConstraint\", abstractConstraintName);\r\n }\r\n\r\n if (undefined !== this.constraintClasses) {\r\n for (const item of this.constraintClasses) {\r\n const constraintClass = await item;\r\n const classElement = schemaXml.createElement(\"Class\");\r\n const constraintClassName = XmlSerializationUtils.createXmlTypedName(this.schema, constraintClass.schema, constraintClass.name);\r\n classElement.setAttribute(\"class\", constraintClassName);\r\n itemElement.appendChild(classElement);\r\n }\r\n }\r\n\r\n if (this._customAttributes) {\r\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\r\n for (const [name, attribute] of this._customAttributes) {\r\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\r\n caContainerElement.appendChild(caElement);\r\n }\r\n itemElement.appendChild(caContainerElement);\r\n }\r\n\r\n return itemElement;\r\n }\r\n\r\n public fromJSONSync(relationshipConstraintProps: RelationshipConstraintProps) {\r\n\r\n this._roleLabel = relationshipConstraintProps.roleLabel;\r\n this._polymorphic = relationshipConstraintProps.polymorphic;\r\n\r\n const parsedMultiplicity = RelationshipMultiplicity.fromString(relationshipConstraintProps.multiplicity);\r\n if (!parsedMultiplicity)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidMultiplicity, ``);\r\n this._multiplicity = parsedMultiplicity;\r\n\r\n const relClassSchema = this.relationshipClass.schema;\r\n\r\n if (undefined !== relationshipConstraintProps.abstractConstraint) {\r\n const abstractConstraintSchemaItemKey = relClassSchema.getSchemaItemKey(relationshipConstraintProps.abstractConstraint);\r\n if (!abstractConstraintSchemaItemKey)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\r\n this.setAbstractConstraint(new DelayedPromiseWithProps<SchemaItemKey, AnyConstraintClass>(abstractConstraintSchemaItemKey,\r\n async () => {\r\n const tempAbstractConstraint = await relClassSchema.lookupItem(relationshipConstraintProps.abstractConstraint!);\r\n if (undefined === tempAbstractConstraint ||\r\n (!EntityClass.isEntityClass(tempAbstractConstraint) && !Mixin.isMixin(tempAbstractConstraint) && !RelationshipClass.isRelationshipClass(tempAbstractConstraint)))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the abstractConstraint ${relationshipConstraintProps.abstractConstraint}.`);\r\n\r\n return tempAbstractConstraint;\r\n }));\r\n }\r\n\r\n const loadEachConstraint = (constraintClassName: any) => {\r\n const tempConstraintClass = relClassSchema.lookupItemSync(constraintClassName);\r\n if (!tempConstraintClass ||\r\n (!EntityClass.isEntityClass(tempConstraintClass) && !Mixin.isMixin(tempConstraintClass) && !RelationshipClass.isRelationshipClass(tempConstraintClass)))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\r\n return tempConstraintClass;\r\n };\r\n\r\n for (const constraintClassName of relationshipConstraintProps.constraintClasses) {\r\n const constraintClass = loadEachConstraint(constraintClassName);\r\n this.addClass(new DelayedPromiseWithProps(constraintClass.key, async () => constraintClass));\r\n }\r\n }\r\n\r\n public async fromJSON(relationshipConstraintProps: RelationshipConstraintProps) {\r\n this.fromJSONSync(relationshipConstraintProps);\r\n }\r\n\r\n /**\r\n * Indicates if the provided [[ECClass]] is supported by this [[RelationshipConstraint]].\r\n * @param ecClass The class to check.\r\n */\r\n public async supportsClass(ecClass: ECClass): Promise<boolean> {\r\n if (!this.constraintClasses) {\r\n if (this.relationshipClass.baseClass) {\r\n const baseRelationship = await this.relationshipClass.baseClass as RelationshipClass;\r\n const baseConstraint = this.isSource ? baseRelationship.source : baseRelationship.target;\r\n return baseConstraint.supportsClass(ecClass);\r\n }\r\n return false;\r\n }\r\n\r\n if (ecClass.schemaItemType !== SchemaItemType.EntityClass && ecClass.schemaItemType !== SchemaItemType.RelationshipClass &&\r\n ecClass.schemaItemType !== SchemaItemType.Mixin) {\r\n return false;\r\n }\r\n\r\n const abstractConstraint = await this.abstractConstraint;\r\n\r\n if (abstractConstraint && await RelationshipConstraint.classCompatibleWithConstraint(abstractConstraint, ecClass, this.polymorphic || false))\r\n return true;\r\n\r\n for (const constraint of this.constraintClasses) {\r\n if (await RelationshipConstraint.classCompatibleWithConstraint(await constraint, ecClass, this.polymorphic || false))\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Indicates if an ECClass is of the type or applies to the type (if a mixin) of the ECClass specified by the constraintClass parameter.\r\n * @param constraintClass The ECClass that is a constraint class of a relationship.\r\n * @param testClass The ECClass to check against the constraint class.\r\n * @param isPolymorphic Indicates if the testClass should be checked polymorphically.\r\n */\r\n public static async classCompatibleWithConstraint(constraintClass: ECClass, testClass: ECClass, isPolymorphic: boolean): Promise<boolean> {\r\n if (SchemaItem.equalByKey(constraintClass, testClass))\r\n return true;\r\n\r\n if (isPolymorphic) {\r\n if (testClass.schemaItemType === SchemaItemType.EntityClass || testClass.schemaItemType === SchemaItemType.RelationshipClass) {\r\n return testClass.is(constraintClass);\r\n }\r\n\r\n if (testClass.schemaItemType === SchemaItemType.Mixin) {\r\n if (constraintClass.schemaItemType === SchemaItemType.EntityClass)\r\n return (testClass as Mixin).applicableTo(constraintClass as EntityClass);\r\n else\r\n return testClass.is(constraintClass);\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static isRelationshipConstraint(object: any): object is RelationshipConstraint {\r\n const relationshipConstraint = object as RelationshipConstraint;\r\n\r\n return relationshipConstraint !== undefined && relationshipConstraint.polymorphic !== undefined && relationshipConstraint.multiplicity !== undefined\r\n && relationshipConstraint.relationshipEnd !== undefined && relationshipConstraint._relationshipClass !== undefined;\r\n }\r\n\r\n /** @internal */\r\n protected addCustomAttribute(customAttribute: CustomAttribute) {\r\n if (!this._customAttributes)\r\n this._customAttributes = new Map<string, CustomAttribute>();\r\n\r\n this._customAttributes.set(customAttribute.className, customAttribute);\r\n }\r\n\r\n /** @internal */\r\n protected setRoleLabel(roleLabel: string | undefined) {\r\n this._roleLabel = roleLabel;\r\n }\r\n\r\n /** @internal */\r\n protected setRelationshipEnd(relationshipEnd: RelationshipEnd) {\r\n this._relationshipEnd = relationshipEnd;\r\n }\r\n\r\n /** @internal */\r\n protected setPolymorphic(polymorphic: boolean) {\r\n this._polymorphic = polymorphic;\r\n }\r\n\r\n /** @internal */\r\n protected setMultiplicity(multiplicity: RelationshipMultiplicity) {\r\n this._multiplicity = multiplicity;\r\n }\r\n\r\n /** @internal */\r\n protected setAbstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined) {\r\n this._abstractConstraint = abstractConstraint;\r\n }\r\n}\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableRelationshipConstraint extends RelationshipConstraint {\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n public abstract override setRoleLabel(roleLabel: string | undefined): void;\r\n public abstract override setRelationshipEnd(relationshipEnd: RelationshipEnd): void;\r\n public abstract override setPolymorphic(polymorphic: boolean): void;\r\n public abstract override setMultiplicity(multiplicity: RelationshipMultiplicity): void;\r\n public abstract override setAbstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined): void;\r\n}\r\n\r\nconst INT32_MAX = 2147483647;\r\n\r\n/**\r\n * @public @preview\r\n */\r\nexport class RelationshipMultiplicity {\r\n public static readonly zeroOne = new RelationshipMultiplicity(0, 1);\r\n public static readonly zeroMany = new RelationshipMultiplicity(0, INT32_MAX);\r\n public static readonly oneOne = new RelationshipMultiplicity(1, 1);\r\n public static readonly oneMany = new RelationshipMultiplicity(1, INT32_MAX);\r\n\r\n public readonly lowerLimit: number;\r\n public readonly upperLimit: number;\r\n\r\n /** @internal */\r\n constructor(lowerLimit: number, upperLimit: number) {\r\n this.lowerLimit = lowerLimit;\r\n this.upperLimit = upperLimit;\r\n }\r\n\r\n public static fromString(str: string): RelationshipMultiplicity | undefined {\r\n const matches = /^\\(([0-9]*)\\.\\.([0-9]*|\\*)\\)$/.exec(str);\r\n if (matches === null || matches.length !== 3)\r\n return undefined;\r\n\r\n const lowerLimit = parseInt(matches[1], 10);\r\n const upperLimit = matches[2] === \"*\" ? INT32_MAX : parseInt(matches[2], 10);\r\n if (0 === lowerLimit && 1 === upperLimit)\r\n return RelationshipMultiplicity.zeroOne;\r\n else if (0 === lowerLimit && INT32_MAX === upperLimit)\r\n return RelationshipMultiplicity.zeroMany;\r\n else if (1 === lowerLimit && 1 === upperLimit)\r\n return RelationshipMultiplicity.oneOne;\r\n else if (1 === lowerLimit && INT32_MAX === upperLimit)\r\n return RelationshipMultiplicity.oneMany;\r\n\r\n return new RelationshipMultiplicity(lowerLimit, upperLimit);\r\n }\r\n\r\n public equals(rhs: RelationshipMultiplicity): boolean {\r\n return this.lowerLimit === rhs.lowerLimit && this.upperLimit === rhs.upperLimit;\r\n }\r\n\r\n public toString(): string {\r\n return `(${this.lowerLimit}..${this.upperLimit === INT32_MAX ? \"*\" : this.upperLimit})`;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableRelationshipClass extends RelationshipClass {\r\n public override get source() { return this._source as MutableRelationshipConstraint; }\r\n public override get target() { return this._target as MutableRelationshipConstraint; }\r\n public abstract override setStrength(strength: StrengthType): void;\r\n public abstract override setStrengthDirection(direction: StrengthDirection): void;\r\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\r\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}