@itwin/ecschema-metadata 5.1.0-dev.9 → 5.2.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -1
- package/lib/cjs/Context.d.ts +1 -1
- package/lib/cjs/Context.js +1 -1
- package/lib/cjs/Context.js.map +1 -1
- package/lib/cjs/Deserialization/Helper.d.ts +30 -11
- package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
- package/lib/cjs/Deserialization/Helper.js +124 -96
- package/lib/cjs/Deserialization/Helper.js.map +1 -1
- package/lib/cjs/Deserialization/SchemaGraphUtil.d.ts +12 -3
- package/lib/cjs/Deserialization/SchemaGraphUtil.d.ts.map +1 -1
- package/lib/cjs/Deserialization/SchemaGraphUtil.js +36 -23
- package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js +14 -5
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.js +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/cjs/ECName.js +1 -1
- package/lib/cjs/ECName.js.map +1 -1
- package/lib/cjs/ECObjects.d.ts +1 -1
- package/lib/cjs/ECObjects.js +2 -2
- package/lib/cjs/ECObjects.js.map +1 -1
- package/lib/cjs/IncrementalLoading/ClassParsers.d.ts +60 -0
- package/lib/cjs/IncrementalLoading/ClassParsers.d.ts.map +1 -0
- package/lib/cjs/IncrementalLoading/ClassParsers.js +111 -0
- package/lib/cjs/IncrementalLoading/ClassParsers.js.map +1 -0
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.d.ts +211 -0
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.d.ts.map +1 -0
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js +387 -0
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -0
- package/lib/cjs/IncrementalLoading/FullSchemaQueries.d.ts +14 -0
- package/lib/cjs/IncrementalLoading/FullSchemaQueries.d.ts.map +1 -0
- package/lib/cjs/IncrementalLoading/FullSchemaQueries.js +609 -0
- package/lib/cjs/IncrementalLoading/FullSchemaQueries.js.map +1 -0
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.d.ts +109 -0
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.d.ts.map +1 -0
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js +219 -0
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -0
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.d.ts +36 -0
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.d.ts.map +1 -0
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js +77 -0
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js.map +1 -0
- package/lib/cjs/IncrementalLoading/PerformanceLogger.d.ts +60 -0
- package/lib/cjs/IncrementalLoading/PerformanceLogger.d.ts.map +1 -0
- package/lib/cjs/IncrementalLoading/PerformanceLogger.js +82 -0
- package/lib/cjs/IncrementalLoading/PerformanceLogger.js.map +1 -0
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.d.ts +51 -0
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.d.ts.map +1 -0
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.js +122 -0
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.js.map +1 -0
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.d.ts +16 -0
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.d.ts.map +1 -0
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.js +308 -0
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.js.map +1 -0
- package/lib/cjs/IncrementalLoading/SchemaParser.d.ts +42 -0
- package/lib/cjs/IncrementalLoading/SchemaParser.d.ts.map +1 -0
- package/lib/cjs/IncrementalLoading/SchemaParser.js +109 -0
- package/lib/cjs/IncrementalLoading/SchemaParser.js.map +1 -0
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.d.ts +12 -0
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.d.ts.map +1 -0
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.js +365 -0
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.js.map +1 -0
- package/lib/cjs/Metadata/Class.d.ts +5 -16
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +68 -68
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.d.ts +7 -1
- package/lib/cjs/Metadata/CustomAttribute.d.ts.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.d.ts +6 -6
- package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +48 -26
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/Format.d.ts +5 -0
- package/lib/cjs/Metadata/Format.d.ts.map +1 -1
- package/lib/cjs/Metadata/Format.js +7 -0
- package/lib/cjs/Metadata/Format.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/Metadata/Schema.d.ts +10 -0
- package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
- package/lib/cjs/Metadata/Schema.js +13 -0
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.d.ts +10 -0
- package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.js +13 -0
- package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
- package/lib/cjs/SchemaFormatsProvider.d.ts +4 -3
- package/lib/cjs/SchemaFormatsProvider.d.ts.map +1 -1
- package/lib/cjs/SchemaFormatsProvider.js +60 -17
- package/lib/cjs/SchemaFormatsProvider.js.map +1 -1
- package/lib/cjs/SchemaLoader.d.ts +4 -1
- package/lib/cjs/SchemaLoader.d.ts.map +1 -1
- package/lib/cjs/SchemaLoader.js +4 -1
- package/lib/cjs/SchemaLoader.js.map +1 -1
- package/lib/cjs/ecschema-metadata.d.ts +2 -0
- package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
- package/lib/cjs/ecschema-metadata.js +2 -0
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/lib/cjs/utils/SchemaLoadingController.d.ts +37 -0
- package/lib/cjs/utils/SchemaLoadingController.d.ts.map +1 -0
- package/lib/cjs/utils/SchemaLoadingController.js +65 -0
- package/lib/cjs/utils/SchemaLoadingController.js.map +1 -0
- package/lib/esm/Context.d.ts +1 -1
- package/lib/esm/Context.js +1 -1
- package/lib/esm/Context.js.map +1 -1
- package/lib/esm/Deserialization/Helper.d.ts +30 -11
- package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
- package/lib/esm/Deserialization/Helper.js +124 -96
- package/lib/esm/Deserialization/Helper.js.map +1 -1
- package/lib/esm/Deserialization/SchemaGraphUtil.d.ts +12 -3
- package/lib/esm/Deserialization/SchemaGraphUtil.d.ts.map +1 -1
- package/lib/esm/Deserialization/SchemaGraphUtil.js +36 -23
- package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/esm/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js +14 -5
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.js +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/esm/ECName.js +1 -1
- package/lib/esm/ECName.js.map +1 -1
- package/lib/esm/ECObjects.d.ts +1 -1
- package/lib/esm/ECObjects.js +2 -2
- package/lib/esm/ECObjects.js.map +1 -1
- package/lib/esm/IncrementalLoading/ClassParsers.d.ts +60 -0
- package/lib/esm/IncrementalLoading/ClassParsers.d.ts.map +1 -0
- package/lib/esm/IncrementalLoading/ClassParsers.js +104 -0
- package/lib/esm/IncrementalLoading/ClassParsers.js.map +1 -0
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.d.ts +211 -0
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.d.ts.map +1 -0
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js +383 -0
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -0
- package/lib/esm/IncrementalLoading/FullSchemaQueries.d.ts +14 -0
- package/lib/esm/IncrementalLoading/FullSchemaQueries.d.ts.map +1 -0
- package/lib/esm/IncrementalLoading/FullSchemaQueries.js +606 -0
- package/lib/esm/IncrementalLoading/FullSchemaQueries.js.map +1 -0
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.d.ts +109 -0
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.d.ts.map +1 -0
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js +215 -0
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -0
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.d.ts +36 -0
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.d.ts.map +1 -0
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js +73 -0
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js.map +1 -0
- package/lib/esm/IncrementalLoading/PerformanceLogger.d.ts +60 -0
- package/lib/esm/IncrementalLoading/PerformanceLogger.d.ts.map +1 -0
- package/lib/esm/IncrementalLoading/PerformanceLogger.js +78 -0
- package/lib/esm/IncrementalLoading/PerformanceLogger.js.map +1 -0
- package/lib/esm/IncrementalLoading/SchemaItemParsers.d.ts +51 -0
- package/lib/esm/IncrementalLoading/SchemaItemParsers.d.ts.map +1 -0
- package/lib/esm/IncrementalLoading/SchemaItemParsers.js +117 -0
- package/lib/esm/IncrementalLoading/SchemaItemParsers.js.map +1 -0
- package/lib/esm/IncrementalLoading/SchemaItemQueries.d.ts +16 -0
- package/lib/esm/IncrementalLoading/SchemaItemQueries.d.ts.map +1 -0
- package/lib/esm/IncrementalLoading/SchemaItemQueries.js +305 -0
- package/lib/esm/IncrementalLoading/SchemaItemQueries.js.map +1 -0
- package/lib/esm/IncrementalLoading/SchemaParser.d.ts +42 -0
- package/lib/esm/IncrementalLoading/SchemaParser.d.ts.map +1 -0
- package/lib/esm/IncrementalLoading/SchemaParser.js +104 -0
- package/lib/esm/IncrementalLoading/SchemaParser.js.map +1 -0
- package/lib/esm/IncrementalLoading/SchemaStubQueries.d.ts +12 -0
- package/lib/esm/IncrementalLoading/SchemaStubQueries.d.ts.map +1 -0
- package/lib/esm/IncrementalLoading/SchemaStubQueries.js +359 -0
- package/lib/esm/IncrementalLoading/SchemaStubQueries.js.map +1 -0
- package/lib/esm/Metadata/Class.d.ts +5 -16
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +68 -68
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/CustomAttribute.d.ts +7 -1
- package/lib/esm/Metadata/CustomAttribute.d.ts.map +1 -1
- package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.d.ts +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.js +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.d.ts +6 -6
- package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/esm/Metadata/EntityClass.js +48 -26
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/Format.d.ts +5 -0
- package/lib/esm/Metadata/Format.d.ts.map +1 -1
- package/lib/esm/Metadata/Format.js +7 -0
- package/lib/esm/Metadata/Format.js.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/esm/Metadata/Schema.d.ts +10 -0
- package/lib/esm/Metadata/Schema.d.ts.map +1 -1
- package/lib/esm/Metadata/Schema.js +13 -0
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/lib/esm/Metadata/SchemaItem.d.ts +10 -0
- package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/esm/Metadata/SchemaItem.js +13 -0
- package/lib/esm/Metadata/SchemaItem.js.map +1 -1
- package/lib/esm/SchemaFormatsProvider.d.ts +4 -3
- package/lib/esm/SchemaFormatsProvider.d.ts.map +1 -1
- package/lib/esm/SchemaFormatsProvider.js +61 -18
- package/lib/esm/SchemaFormatsProvider.js.map +1 -1
- package/lib/esm/SchemaLoader.d.ts +4 -1
- package/lib/esm/SchemaLoader.d.ts.map +1 -1
- package/lib/esm/SchemaLoader.js +4 -1
- package/lib/esm/SchemaLoader.js.map +1 -1
- package/lib/esm/ecschema-metadata.d.ts +2 -0
- package/lib/esm/ecschema-metadata.d.ts.map +1 -1
- package/lib/esm/ecschema-metadata.js +2 -0
- package/lib/esm/ecschema-metadata.js.map +1 -1
- package/lib/esm/utils/SchemaLoadingController.d.ts +37 -0
- package/lib/esm/utils/SchemaLoadingController.d.ts.map +1 -0
- package/lib/esm/utils/SchemaLoadingController.js +61 -0
- package/lib/esm/utils/SchemaLoadingController.js.map +1 -0
- package/package.json +15 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomAttributeClass.js","sourceRoot":"","sources":["../../../src/Metadata/CustomAttributeClass.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAEsB;AACtB,4CAA6D;AAC7D,mCAAkC;AAGlC;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,eAAO;IACtB,cAAc,GAAG,oBAAoB,CAAC,cAAc,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AU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,oBAA+C;QAC5E,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACO,YAAY,CAAC,aAA2C;QAChE,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,sBAAsB,CAAC,IAAiB;QACpD,IAAI,IAAI,IAAI,IAAI,CAAC,cAAc,KAAK,0BAAc,CAAC,oBAAoB;YACrE,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,4BAA4B,CAAC,IAAiB;QAC1D,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC;YACpC,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,qBAAqB,EAAE,aAAa,0BAAc,CAAC,oBAAoB,0BAA0B,CAAC,CAAC;IAC9I,CAAC;CACF;AA9ED,oDA8EC;AACD;;;GAGG;AACH,MAAsB,cAAe,SAAQ,oBAAoB;CAGhE;AAHD,wCAGC","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 { CustomAttributeClassProps } from \"../Deserialization/JsonProps\";\nimport {\n containerTypeToString, CustomAttributeContainerType, parseCustomAttributeContainerType, SchemaItemType,\n} from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { ECClass } from \"./Class\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECCustomAttributeClass.\n * @public @preview\n */\nexport class CustomAttributeClass extends ECClass {\n public override readonly schemaItemType = CustomAttributeClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.CustomAttributeClass; }\n private _appliesTo?: CustomAttributeContainerType;\n\n /**\n * @deprecated in 4.8
|
|
1
|
+
{"version":3,"file":"CustomAttributeClass.js","sourceRoot":"","sources":["../../../src/Metadata/CustomAttributeClass.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,4CAEsB;AACtB,4CAA6D;AAC7D,mCAAkC;AAGlC;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,eAAO;IACtB,cAAc,GAAG,oBAAoB,CAAC,cAAc,CAAC;IAC9E,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,0BAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC;IACnF,UAAU,CAAgC;IAElD;;SAEK;IACL,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAW,SAAS;QAClB,IAAI,SAAS,KAAK,IAAI,CAAC,UAAU;YAC/B,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,oBAAoB,EAAE,4BAA4B,IAAI,CAAC,IAAI,gDAAgD,CAAC,CAAC;QACtJ,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;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,SAAS,GAAG,IAAA,iCAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7D,OAAO,UAAuC,CAAC;IACjD,CAAC;IAED,gBAAgB;IACA,KAAK,CAAC,KAAK,CAAC,SAAmB;QAC7C,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACjD,WAAW,CAAC,YAAY,CAAC,WAAW,EAAE,IAAA,iCAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAC7E,OAAO,WAAW,CAAC;IACrB,CAAC;IAEe,YAAY,CAAC,oBAA+C;QAC1E,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;QACzC,MAAM,SAAS,GAAG,IAAA,6CAAiC,EAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QACpF,IAAI,SAAS,KAAK,SAAS;YACzB,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,oBAAoB,EAAE,GAAG,SAAS,+CAA+C,CAAC,CAAC;QAC5H,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,oBAA+C;QAC5E,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACO,YAAY,CAAC,aAA2C;QAChE,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,sBAAsB,CAAC,IAAiB;QACpD,IAAI,IAAI,IAAI,IAAI,CAAC,cAAc,KAAK,0BAAc,CAAC,oBAAoB;YACrE,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,4BAA4B,CAAC,IAAiB;QAC1D,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC;YACpC,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,qBAAqB,EAAE,aAAa,0BAAc,CAAC,oBAAoB,0BAA0B,CAAC,CAAC;IAC9I,CAAC;CACF;AA9ED,oDA8EC;AACD;;;GAGG;AACH,MAAsB,cAAe,SAAQ,oBAAoB;CAGhE;AAHD,wCAGC","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 { CustomAttributeClassProps } from \"../Deserialization/JsonProps\";\nimport {\n containerTypeToString, CustomAttributeContainerType, parseCustomAttributeContainerType, SchemaItemType,\n} from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { ECClass } from \"./Class\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECCustomAttributeClass.\n * @public @preview\n */\nexport class CustomAttributeClass extends ECClass {\n public override readonly schemaItemType = CustomAttributeClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.CustomAttributeClass; }\n private _appliesTo?: CustomAttributeContainerType;\n\n /**\n * @deprecated in 4.8 - will not be removed until after 2026-06-13. Use [[appliesTo]]\n * */\n public get containerType(): CustomAttributeContainerType {\n return this.appliesTo;\n }\n\n public get appliesTo(): CustomAttributeContainerType {\n if (undefined === this._appliesTo)\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `The CustomAttributeClass ${this.name} does not have a CustomAttributeContainerType.`);\n return this._appliesTo;\n }\n\n /**\n * Save this CustomAttributeClasses 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): CustomAttributeClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.appliesTo = containerTypeToString(this.appliesTo);\n return schemaJson as CustomAttributeClassProps;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n itemElement.setAttribute(\"appliesTo\", containerTypeToString(this.appliesTo));\n return itemElement;\n }\n\n public override fromJSONSync(customAttributeProps: CustomAttributeClassProps) {\n super.fromJSONSync(customAttributeProps);\n const appliesTo = parseCustomAttributeContainerType(customAttributeProps.appliesTo);\n if (undefined === appliesTo)\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${appliesTo} is not a valid CustomAttributeContainerType.`);\n this._appliesTo = appliesTo;\n }\n\n public override async fromJSON(customAttributeProps: CustomAttributeClassProps) {\n this.fromJSONSync(customAttributeProps);\n }\n\n /**\n * @internal\n */\n protected setAppliesTo(containerType: CustomAttributeContainerType) {\n this._appliesTo = containerType;\n }\n\n /**\n * Type guard to check if the SchemaItem is of type CustomAttributeClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is a CustomAttributeClass, false otherwise.\n */\n public static isCustomAttributeClass(item?: SchemaItem): item is CustomAttributeClass {\n if (item && item.schemaItemType === SchemaItemType.CustomAttributeClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type CustomAttributeClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to CustomAttributeClass if it is a CustomAttributeClass, undefined otherwise.\n * @internal\n */\n public static assertIsCustomAttributeClass(item?: SchemaItem): asserts item is CustomAttributeClass {\n if (!this.isCustomAttributeClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.CustomAttributeClass}' (CustomAttributeClass)`);\n }\n}\n/**\n * @internal\n * An abstract class used for Schema editing.\n */\nexport abstract class MutableCAClass extends CustomAttributeClass {\n public abstract override setAppliesTo(containerType: CustomAttributeContainerType): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
|
|
@@ -38,18 +38,18 @@ export declare class EntityClass extends ECClass implements HasMixins {
|
|
|
38
38
|
getInheritedPropertySync(name: string): Property | undefined;
|
|
39
39
|
/**
|
|
40
40
|
*
|
|
41
|
-
* @param
|
|
42
|
-
* @
|
|
41
|
+
* @param cache
|
|
42
|
+
* @returns
|
|
43
|
+
*
|
|
43
44
|
* @internal
|
|
44
45
|
*/
|
|
45
|
-
protected buildPropertyCache(
|
|
46
|
+
protected buildPropertyCache(): Promise<Map<string, Property>>;
|
|
46
47
|
/**
|
|
47
48
|
*
|
|
48
|
-
* @param
|
|
49
|
-
* @param existingValues
|
|
49
|
+
* @param cache
|
|
50
50
|
* @internal
|
|
51
51
|
*/
|
|
52
|
-
protected buildPropertyCacheSync(
|
|
52
|
+
protected buildPropertyCacheSync(): Map<string, Property>;
|
|
53
53
|
/**
|
|
54
54
|
*
|
|
55
55
|
* @param name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityClass.d.ts","sourceRoot":"","sources":["../../../src/Metadata/EntityClass.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAA0B,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEzF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,qBAAa,WAAY,SAAQ,OAAQ,YAAW,SAAS;IAC3D,SAAyB,cAAc,iBAA8B;IACrE,gBAAgB;IAChB,WAA2B,cAAc,mBAAyC;IAClF,OAAO,CAAC,OAAO,CAAC,CAAoB;IAEpC,IAAW,MAAM,IAAI,aAAa,CAAC,eAAe,CAAC,CAIlD;IAEO,aAAa,IAAI,QAAQ,CAAC,KAAK,CAAC;IAYxC;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK;IAQ/B;;;OAGG;IACmB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAc1F;;;OAGG;IACa,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG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AED,gBAAgB;AAChB,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAsB3L;AAED,gBAAgB;AAChB,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,GAAG,kBAAkB,CAsBhL"}
|
|
@@ -92,44 +92,64 @@ class EntityClass extends Class_1.ECClass {
|
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
*
|
|
95
|
-
* @param
|
|
96
|
-
* @
|
|
95
|
+
* @param cache
|
|
96
|
+
* @returns
|
|
97
|
+
*
|
|
97
98
|
* @internal
|
|
98
99
|
*/
|
|
99
|
-
async buildPropertyCache(
|
|
100
|
-
|
|
101
|
-
existingValues = new Map();
|
|
102
|
-
}
|
|
100
|
+
async buildPropertyCache() {
|
|
101
|
+
const cache = new Map();
|
|
103
102
|
const baseClass = await this.baseClass;
|
|
104
103
|
if (baseClass) {
|
|
105
|
-
|
|
104
|
+
for (const property of await baseClass.getProperties()) {
|
|
105
|
+
if (!cache.has(property.name.toUpperCase()))
|
|
106
|
+
cache.set(property.name.toUpperCase(), property);
|
|
107
|
+
}
|
|
106
108
|
}
|
|
107
109
|
for (const mixin of this.mixins) {
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
+
const mixinObj = await mixin;
|
|
111
|
+
const mixinProps = mixinObj.getPropertiesSync();
|
|
112
|
+
for (const property of mixinProps) {
|
|
113
|
+
if (!cache.has(property.name.toUpperCase()))
|
|
114
|
+
cache.set(property.name.toUpperCase(), property);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const localProps = await this.getProperties(true);
|
|
118
|
+
if (localProps) {
|
|
119
|
+
for (const property of localProps) {
|
|
120
|
+
cache.set(property.name.toUpperCase(), property);
|
|
121
|
+
}
|
|
110
122
|
}
|
|
111
|
-
|
|
112
|
-
Class_1.ECClass.mergeProperties(result, existingValues, localProps, true);
|
|
123
|
+
return cache;
|
|
113
124
|
}
|
|
114
125
|
/**
|
|
115
126
|
*
|
|
116
|
-
* @param
|
|
117
|
-
* @param existingValues
|
|
127
|
+
* @param cache
|
|
118
128
|
* @internal
|
|
119
129
|
*/
|
|
120
|
-
buildPropertyCacheSync(
|
|
121
|
-
|
|
122
|
-
existingValues = new Map();
|
|
123
|
-
}
|
|
130
|
+
buildPropertyCacheSync() {
|
|
131
|
+
const cache = new Map();
|
|
124
132
|
const baseClass = this.getBaseClassSync();
|
|
125
133
|
if (baseClass) {
|
|
126
|
-
|
|
134
|
+
Array.from(baseClass.getPropertiesSync()).forEach((property) => {
|
|
135
|
+
if (!cache.has(property.name.toUpperCase()))
|
|
136
|
+
cache.set(property.name.toUpperCase(), property);
|
|
137
|
+
});
|
|
127
138
|
}
|
|
128
139
|
for (const mixin of this.getMixinsSync()) {
|
|
129
|
-
|
|
140
|
+
const mixinProps = mixin.getPropertiesSync();
|
|
141
|
+
for (const property of mixinProps) {
|
|
142
|
+
if (!cache.has(property.name.toUpperCase()))
|
|
143
|
+
cache.set(property.name.toUpperCase(), property);
|
|
144
|
+
}
|
|
130
145
|
}
|
|
131
146
|
const localProps = this.getPropertiesSync(true);
|
|
132
|
-
|
|
147
|
+
if (localProps) {
|
|
148
|
+
Array.from(localProps).forEach(property => {
|
|
149
|
+
cache.set(property.name.toUpperCase(), property);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return cache;
|
|
133
153
|
}
|
|
134
154
|
/**
|
|
135
155
|
*
|
|
@@ -186,12 +206,14 @@ class EntityClass extends Class_1.ECClass {
|
|
|
186
206
|
const mixinSchemaItemKey = this.schema.getSchemaItemKey(name);
|
|
187
207
|
if (!mixinSchemaItemKey)
|
|
188
208
|
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin ("${name}") that cannot be found.`);
|
|
189
|
-
this._mixins.
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
209
|
+
if (!this._mixins.find((value) => mixinSchemaItemKey.matchesFullName(value.fullName))) {
|
|
210
|
+
this._mixins.push(new DelayedPromise_1.DelayedPromiseWithProps(mixinSchemaItemKey, async () => {
|
|
211
|
+
const mixin = await this.schema.lookupItem(mixinSchemaItemKey, Mixin_1.Mixin);
|
|
212
|
+
if (undefined === mixin)
|
|
213
|
+
throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin ("${name}") that cannot be found.`);
|
|
214
|
+
return mixin;
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
195
217
|
}
|
|
196
218
|
}
|
|
197
219
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityClass.js","sourceRoot":"","sources":["../../../src/Metadata/EntityClass.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAkQH,4DAsBC;AAGD,oEAsBC;AA/SD,sDAA4D;AAE5D,oFAAiF;AACjF,4CAAyF;AACzF,4CAA6D;AAG7D,mCAAkC;AAClC,mCAAgC;AAChC,yCAAuE;AACvE,2DAAwD;AAGxD;;;GAGG;AACH,MAAa,WAAY,SAAQ,eAAO;IACb,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC;IACrE,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,0BAAc,CAAC,WAAW,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAqB;IAEpC,IAAW,MAAM;QACf,IAAI,CAAC,IAAI,CAAC,OAAO;YACf,OAAO,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,CAAC,aAAa;QACn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,IAAI,CAAC;QAC/B,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,iBAAiB,EAAE,+BAA+B,IAAI,gCAAgC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;IAEhJ,IAAI,oBAAmD,CAAC;IACxD,IAAI,OAAO,CAAC,YAAY,CAAC,KAAK,QAAQ,EAAE,CAAC;QACvC,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,qCAAiB,CAAC,CAAC;IACxF,CAAC;;QACC,oBAAoB,GAAG,YAAY,CAAC;IAEtC,IAAI,CAAC,oBAAoB;QACvB,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,WAAW,EAAE,mCAAmC,YAAY,8CAA8C,CAAC,CAAC,CAAE,2DAA2D;IAElN,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,IAAA,kCAAsB,EAAC,SAAS,CAAC,CAAC;QACvD,IAAI,SAAS,KAAK,YAAY;YAC5B,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,wBAAwB,EAAE,mCAAmC,SAAS,qCAAqC,CAAC,CAAC;QACtJ,SAAS,GAAG,YAAY,CAAC;IAC3B,CAAC;IAED,MAAM,gBAAgB,GAAG,IAAI,wCAAuB,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,oBAAoB,CAAC,CAAC;IACjH,OAAO,IAAI,6BAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;AAC5E,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 { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { EntityClassProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { parseStrengthDirection, SchemaItemType, StrengthDirection } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { HasMixins, LazyLoadedMixin } from \"../Interfaces\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { ECClass } from \"./Class\";\nimport { Mixin } from \"./Mixin\";\nimport { AnyProperty, NavigationProperty, Property } from \"./Property\";\nimport { RelationshipClass } from \"./RelationshipClass\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECEntityClass.\n * @public @preview\n */\nexport class EntityClass extends ECClass implements HasMixins {\n public override readonly schemaItemType = EntityClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.EntityClass; }\n private _mixins?: LazyLoadedMixin[];\n\n public get mixins(): ReadonlyArray<LazyLoadedMixin> {\n if (!this._mixins)\n return [];\n return this._mixins;\n }\n\n public *getMixinsSync(): Iterable<Mixin> {\n if (!this._mixins)\n return;\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin, Mixin);\n if (mObj) {\n yield mObj;\n }\n }\n }\n\n /**\n *\n * @param mixin\n * @internal\n */\n protected addMixin(mixin: Mixin) {\n if (!this._mixins)\n this._mixins = [];\n\n this._mixins.push(new DelayedPromiseWithProps(mixin.key, async () => mixin));\n return;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override async getInheritedProperty(name: string): Promise<AnyProperty | undefined> {\n let inheritedProperty = await super.getInheritedProperty(name);\n\n if (!inheritedProperty && this._mixins) {\n const mixinProps = await Promise.all(this._mixins.map(async (mixin) => (await mixin).getProperty(name)));\n mixinProps.some((prop) => {\n inheritedProperty = prop as AnyProperty;\n return inheritedProperty !== undefined;\n });\n }\n\n return inheritedProperty as AnyProperty | undefined;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override getInheritedPropertySync(name: string): Property | undefined {\n const inheritedProperty = super.getInheritedPropertySync(name);\n if (inheritedProperty)\n return inheritedProperty;\n\n if (!this._mixins) {\n return undefined;\n }\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin);\n if (mObj && ECClass.isECClass(mObj)) {\n const result = mObj.getPropertySync(name, true);\n if (result) {\n return result;\n }\n }\n }\n\n return undefined;\n }\n\n /**\n *\n * @param result\n * @param existingValues\n * @internal\n */\n protected override async buildPropertyCache(result: Property[], existingValues?: Map<string, number>): Promise<void> {\n if (!existingValues) {\n existingValues = new Map<string, number>();\n }\n\n const baseClass = await this.baseClass;\n if (baseClass) {\n ECClass.mergeProperties(result, existingValues, await baseClass.getProperties(), false);\n }\n\n for (const mixin of this.mixins) {\n const resolvedMixin = await mixin;\n ECClass.mergeProperties(result, existingValues, await resolvedMixin.getProperties(), false);\n }\n\n const localProps = await this.getProperties();\n ECClass.mergeProperties(result, existingValues, localProps, true);\n }\n\n /**\n *\n * @param result\n * @param existingValues\n * @internal\n */\n protected override buildPropertyCacheSync(result: Property[], existingValues?: Map<string, number>): void {\n if (!existingValues) {\n existingValues = new Map<string, number>();\n }\n\n const baseClass = this.getBaseClassSync();\n if (baseClass) {\n ECClass.mergeProperties(result, existingValues, baseClass.getPropertiesSync(), false);\n }\n\n for (const mixin of this.getMixinsSync()) {\n ECClass.mergeProperties(result, existingValues, mixin.getPropertiesSync(), false);\n }\n\n const localProps = this.getPropertiesSync(true);\n ECClass.mergeProperties(result, existingValues, localProps, true);\n }\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 /**\n *\n * @param name\n * @param relationship\n * @param direction\n * @internal\n */\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 * Save this EntityClass' 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): EntityClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n if (this.mixins.length > 0)\n schemaJson.mixins = this.mixins.map((mixin) => mixin.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\n for (const lazyMixin of this.mixins) {\n const mixin = await lazyMixin;\n const mixinElement = schemaXml.createElement(\"BaseClass\");\n const mixinName = XmlSerializationUtils.createXmlTypedName(this.schema, mixin.schema, mixin.name);\n mixinElement.textContent = mixinName;\n itemElement.appendChild(mixinElement);\n }\n return itemElement;\n }\n\n public override async fromJSON(entityClassProps: EntityClassProps) {\n this.fromJSONSync(entityClassProps);\n }\n\n public override fromJSONSync(entityClassProps: EntityClassProps) {\n super.fromJSONSync(entityClassProps);\n\n if (undefined !== entityClassProps.mixins) {\n if (!this._mixins)\n this._mixins = [];\n for (const name of entityClassProps.mixins) {\n const mixinSchemaItemKey = this.schema.getSchemaItemKey(name);\n if (!mixinSchemaItemKey)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n this._mixins.push(new DelayedPromiseWithProps<SchemaItemKey, Mixin>(mixinSchemaItemKey,\n async () => {\n const mixin = await this.schema.lookupItem(mixinSchemaItemKey, Mixin);\n if (undefined === mixin)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n return mixin;\n }));\n }\n }\n }\n\n /**\n * Type guard to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is an EntityClass, false otherwise.\n */\n public static isEntityClass(item?: SchemaItem): item is EntityClass {\n if (item && item.schemaItemType === SchemaItemType.EntityClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to EntityClass if it is an EntityClass, undefined otherwise.\n * @internal\n */\n public static assertIsEntityClass(item?: SchemaItem): asserts item is EntityClass {\n if (!this.isEntityClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.EntityClass}' (EntityClass)`);\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 MutableEntityClass extends EntityClass {\n public abstract override addMixin(mixin: Mixin): any;\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\n/** @internal */\nexport async function createNavigationProperty(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n if (await ecClass.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = await ecClass.schema.lookupItem(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n\n/** @internal */\nexport function createNavigationPropertySync(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n if (ecClass.getPropertySync(name))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = ecClass.schema.lookupItemSync(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"EntityClass.js","sourceRoot":"","sources":["../../../src/Metadata/EntityClass.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAuRH,4DAsBC;AAGD,oEAsBC;AApUD,sDAA4D;AAE5D,oFAAiF;AACjF,4CAAyF;AACzF,4CAA6D;AAG7D,mCAAkC;AAClC,mCAAgC;AAChC,yCAAuE;AACvE,2DAAwD;AAGxD;;;GAGG;AACH,MAAa,WAAY,SAAQ,eAAO;IACb,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC;IACrE,gB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;AAChB,SAAgB,4BAA4B,CAAC,OAAgB,EAAE,IAAY,EAAE,YAAwC,EAAE,SAAqC;IAC1J,IAAI,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC;QAC/B,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,iBAAiB,EAAE,+BAA+B,IAAI,gCAAgC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;IAEhJ,IAAI,oBAAmD,CAAC;IACxD,IAAI,OAAO,CAAC,YAAY,CAAC,KAAK,QAAQ,EAAE,CAAC;QACvC,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,qCAAiB,CAAC,CAAC;IACxF,CAAC;;QACC,oBAAoB,GAAG,YAAY,CAAC;IAEtC,IAAI,CAAC,oBAAoB;QACvB,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,WAAW,EAAE,mCAAmC,YAAY,8CAA8C,CAAC,CAAC,CAAE,2DAA2D;IAElN,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,IAAA,kCAAsB,EAAC,SAAS,CAAC,CAAC;QACvD,IAAI,SAAS,KAAK,YAAY;YAC5B,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,wBAAwB,EAAE,mCAAmC,SAAS,qCAAqC,CAAC,CAAC;QACtJ,SAAS,GAAG,YAAY,CAAC;IAC3B,CAAC;IAED,MAAM,gBAAgB,GAAG,IAAI,wCAAuB,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,oBAAoB,CAAC,CAAC;IACjH,OAAO,IAAI,6BAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;AAC5E,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 { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { EntityClassProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { parseStrengthDirection, SchemaItemType, StrengthDirection } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { HasMixins, LazyLoadedMixin } from \"../Interfaces\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { ECClass } from \"./Class\";\nimport { Mixin } from \"./Mixin\";\nimport { AnyProperty, NavigationProperty, Property } from \"./Property\";\nimport { RelationshipClass } from \"./RelationshipClass\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECEntityClass.\n * @public @preview\n */\nexport class EntityClass extends ECClass implements HasMixins {\n public override readonly schemaItemType = EntityClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.EntityClass; }\n private _mixins?: LazyLoadedMixin[];\n\n public get mixins(): ReadonlyArray<LazyLoadedMixin> {\n if (!this._mixins)\n return [];\n return this._mixins;\n }\n\n public *getMixinsSync(): Iterable<Mixin> {\n if (!this._mixins)\n return;\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin, Mixin);\n if (mObj) {\n yield mObj;\n }\n }\n }\n\n /**\n *\n * @param mixin\n * @internal\n */\n protected addMixin(mixin: Mixin) {\n if (!this._mixins)\n this._mixins = [];\n\n this._mixins.push(new DelayedPromiseWithProps(mixin.key, async () => mixin));\n return;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override async getInheritedProperty(name: string): Promise<AnyProperty | undefined> {\n let inheritedProperty = await super.getInheritedProperty(name);\n\n if (!inheritedProperty && this._mixins) {\n const mixinProps = await Promise.all(this._mixins.map(async (mixin) => (await mixin).getProperty(name)));\n mixinProps.some((prop) => {\n inheritedProperty = prop as AnyProperty;\n return inheritedProperty !== undefined;\n });\n }\n\n return inheritedProperty as AnyProperty | undefined;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override getInheritedPropertySync(name: string): Property | undefined {\n const inheritedProperty = super.getInheritedPropertySync(name);\n if (inheritedProperty)\n return inheritedProperty;\n\n if (!this._mixins) {\n return undefined;\n }\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin);\n if (mObj && ECClass.isECClass(mObj)) {\n const result = mObj.getPropertySync(name, true);\n if (result) {\n return result;\n }\n }\n }\n\n return undefined;\n }\n\n /**\n *\n * @param cache\n * @returns\n *\n * @internal\n */\nprotected override async buildPropertyCache(): Promise<Map<string, Property>> {\n const cache = new Map<string, Property>();\n const baseClass = await this.baseClass;\n if (baseClass) {\n for (const property of await baseClass.getProperties()) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n for (const mixin of this.mixins) {\n const mixinObj = await mixin;\n const mixinProps = mixinObj.getPropertiesSync();\n for (const property of mixinProps) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n const localProps = await this.getProperties(true);\n if (localProps) {\n for (const property of localProps) {\n cache.set(property.name.toUpperCase(), property);\n }\n }\n return cache;\n}\n\n /**\n *\n * @param cache\n * @internal\n */\n protected override buildPropertyCacheSync(): Map<string, Property> {\n const cache = new Map<string, Property>();\n const baseClass = this.getBaseClassSync();\n if (baseClass) {\n Array.from(baseClass.getPropertiesSync()).forEach((property) => {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n });\n }\n\n for (const mixin of this.getMixinsSync()) {\n const mixinProps = mixin.getPropertiesSync();\n for (const property of mixinProps) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n const localProps = this.getPropertiesSync(true);\n if (localProps) {\n Array.from(localProps).forEach(property => {\n cache.set(property.name.toUpperCase(), property);\n });\n }\n return cache;\n }\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 /**\n *\n * @param name\n * @param relationship\n * @param direction\n * @internal\n */\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 * Save this EntityClass' 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): EntityClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n if (this.mixins.length > 0)\n schemaJson.mixins = this.mixins.map((mixin) => mixin.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\n for (const lazyMixin of this.mixins) {\n const mixin = await lazyMixin;\n const mixinElement = schemaXml.createElement(\"BaseClass\");\n const mixinName = XmlSerializationUtils.createXmlTypedName(this.schema, mixin.schema, mixin.name);\n mixinElement.textContent = mixinName;\n itemElement.appendChild(mixinElement);\n }\n return itemElement;\n }\n\n public override async fromJSON(entityClassProps: EntityClassProps) {\n this.fromJSONSync(entityClassProps);\n }\n\n public override fromJSONSync(entityClassProps: EntityClassProps) {\n super.fromJSONSync(entityClassProps);\n\n if (undefined !== entityClassProps.mixins) {\n if (!this._mixins)\n this._mixins = [];\n for (const name of entityClassProps.mixins) {\n const mixinSchemaItemKey = this.schema.getSchemaItemKey(name);\n if (!mixinSchemaItemKey)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n\n if (!this._mixins.find((value) => mixinSchemaItemKey.matchesFullName(value.fullName))) {\n this._mixins.push(new DelayedPromiseWithProps<SchemaItemKey, Mixin>(mixinSchemaItemKey,\n async () => {\n const mixin = await this.schema.lookupItem(mixinSchemaItemKey, Mixin);\n if (undefined === mixin)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n return mixin;\n }));\n }\n }\n }\n }\n\n /**\n * Type guard to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is an EntityClass, false otherwise.\n */\n public static isEntityClass(item?: SchemaItem): item is EntityClass {\n if (item && item.schemaItemType === SchemaItemType.EntityClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to EntityClass if it is an EntityClass, undefined otherwise.\n * @internal\n */\n public static assertIsEntityClass(item?: SchemaItem): asserts item is EntityClass {\n if (!this.isEntityClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.EntityClass}' (EntityClass)`);\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 MutableEntityClass extends EntityClass {\n public abstract override addMixin(mixin: Mixin): any;\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\n/** @internal */\nexport async function createNavigationProperty(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n if (await ecClass.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = await ecClass.schema.lookupItem(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n\n/** @internal */\nexport function createNavigationPropertySync(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n if (ecClass.getPropertySync(name))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = ecClass.schema.lookupItemSync(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n"]}
|
|
@@ -29,6 +29,7 @@ export declare class Format extends SchemaItem {
|
|
|
29
29
|
get uomSeparator(): string;
|
|
30
30
|
get stationSeparator(): string;
|
|
31
31
|
get stationOffsetSize(): number | undefined;
|
|
32
|
+
get stationBaseFactor(): number | undefined;
|
|
32
33
|
get formatTraits(): FormatTraits;
|
|
33
34
|
get spacer(): string | undefined;
|
|
34
35
|
get includeZero(): boolean | undefined;
|
|
@@ -91,6 +92,10 @@ export declare class Format extends SchemaItem {
|
|
|
91
92
|
* @internal
|
|
92
93
|
*/
|
|
93
94
|
protected setStationOffsetSize(stationOffsetSize: number): void;
|
|
95
|
+
/**
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
98
|
+
protected setStationBaseFactor(stationBaseFactor: number): void;
|
|
94
99
|
/**
|
|
95
100
|
* @internal
|
|
96
101
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Format.d.ts","sourceRoot":"","sources":["../../../src/Metadata/Format.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EACO,gBAAgB,EAAE,YAAY,EAAuB,UAAU,EAAE,mBAAmB,EAChG,cAAc,EAAE,cAAc,EAC/B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGvE;;GAEG;AACH,qBAAa,MAAO,SAAQ,UAAU;IACpC,SAAyB,cAAc,iBAAyB;IAChE,gBAAgB;IAChB,WAA2B,cAAc,mBAAoC;IAC7E,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,MAAM,CAAC,CAAuE;IAEtF,gBAAgB;gBACJ,MAAM,EAA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;WACW,cAAc,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM;CAIxE;AAED;;;GAGG;AACH,8BAAsB,aAAc,SAAQ,MAAM;aACvB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,sBAAsB,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;aAC5E,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;aACrC,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;aAC3C,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;aACzC,iBAAiB,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI;aACnD,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;aAC5C,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;aAC7C,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;aACxC,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;aAC5C,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;CACrE"}
|
|
@@ -41,6 +41,7 @@ class Format extends SchemaItem_1.SchemaItem {
|
|
|
41
41
|
get uomSeparator() { return this._base.uomSeparator; }
|
|
42
42
|
get stationSeparator() { return this._base.stationSeparator; }
|
|
43
43
|
get stationOffsetSize() { return this._base.stationOffsetSize; }
|
|
44
|
+
get stationBaseFactor() { return this._base.stationBaseFactor; }
|
|
44
45
|
get formatTraits() { return this._base.formatTraits; }
|
|
45
46
|
get spacer() { return this._base.spacer; }
|
|
46
47
|
get includeZero() { return this._base.includeZero; }
|
|
@@ -261,6 +262,12 @@ class Format extends SchemaItem_1.SchemaItem {
|
|
|
261
262
|
setStationOffsetSize(stationOffsetSize) {
|
|
262
263
|
this._base.stationOffsetSize = stationOffsetSize;
|
|
263
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* @internal
|
|
267
|
+
*/
|
|
268
|
+
setStationBaseFactor(stationBaseFactor) {
|
|
269
|
+
this._base.stationBaseFactor = stationBaseFactor;
|
|
270
|
+
}
|
|
264
271
|
/**
|
|
265
272
|
* @internal
|
|
266
273
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Format.js","sourceRoot":"","sources":["../../../src/Metadata/Format.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,oFAAiF;AACjF,4CAA8C;AAC9C,4CAA6D;AAC7D,wDAG8B;AAC9B,iDAA8C;AAE9C,6CAA0C;AAC1C,iCAA8B;AAE9B,sDAA4D;AAE5D;;GAEG;AACH,MAAa,MAAO,SAAQ,uBAAU;IACX,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAChE,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,0BAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACrE,KAAK,CAAa;IAClB,MAAM,CAAwE;IAEtF,gBAAgB;IAChB,YAAY,MAAc,EAAE,IAAY;QACtC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,0BAAU,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,IAAW,WAAW,KAAa,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IACnE,IAAW,IAAI,KAAiB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IACzD,IAAW,SAAS,KAA6C,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/F,IAAW,QAAQ,KAAyB,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IACzE,IAAW,cAAc,KAAiC,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;IAC7F,IAAW,cAAc,KAAqB,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;IAC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------------------------------------------------\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 { SchemaItemFormatProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport {\n BaseFormat, DecimalPrecision, FormatTraits, formatTraitsToArray, FormatType, FractionalPrecision,\n ScientificType, ShowSignOption,\n} from \"@itwin/core-quantity\";\nimport { InvertedUnit } from \"./InvertedUnit\";\nimport { Schema } from \"./Schema\";\nimport { SchemaItem } from \"./SchemaItem\";\nimport { Unit } from \"./Unit\";\nimport { LazyLoadedInvertedUnit, LazyLoadedUnit } from \"../Interfaces\";\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\n\n/**\n * @public @preview\n */\nexport class Format extends SchemaItem {\n public override readonly schemaItemType = Format.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.Format; }\n private _base: BaseFormat;\n private _units?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>;\n\n /** @internal */\n constructor(schema: Schema, name: string) {\n super(schema, name);\n this._base = new BaseFormat(name);\n }\n\n public get roundFactor(): number { return this._base.roundFactor; }\n public get type(): FormatType { return this._base.type; }\n public get precision(): DecimalPrecision | FractionalPrecision { return this._base.precision; }\n public get minWidth(): number | undefined { return this._base.minWidth; }\n public get scientificType(): ScientificType | undefined { return this._base.scientificType; }\n public get showSignOption(): ShowSignOption { return this._base.showSignOption; }\n public get decimalSeparator(): string { return this._base.decimalSeparator; }\n public get thousandSeparator(): string { return this._base.thousandSeparator; }\n public get uomSeparator(): string { return this._base.uomSeparator; }\n public get stationSeparator(): string { return this._base.stationSeparator; }\n public get stationOffsetSize(): number | undefined { return this._base.stationOffsetSize; }\n public get formatTraits(): FormatTraits { return this._base.formatTraits; }\n public get spacer(): string | undefined { return this._base.spacer; }\n public get includeZero(): boolean | undefined { return this._base.includeZero; }\n public get units(): ReadonlyArray<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined {\n return this._units;\n }\n\n private parseFormatTraits(formatTraitsFromJson: string | string[]) {\n return this._base.parseFormatTraits(formatTraitsFromJson);\n }\n\n public hasFormatTrait(formatTrait: FormatTraits) {\n return this._base.hasFormatTraitSet(formatTrait);\n }\n\n /**\n * Adds a Unit, or InvertedUnit, with an optional label override.\n * @param unit The Unit, or InvertedUnit, to add to this Format.\n * @param label A label that overrides the label defined within the Unit when a value is formatted.\n * @internal\n */\n protected addUnit(unit: LazyLoadedUnit | LazyLoadedInvertedUnit, label?: string) {\n if (undefined === this._units)\n this._units = [];\n else { // Validate that a duplicate is not added.\n for (const existingUnit of this._units) {\n if (unit.fullName.toLowerCase() === existingUnit[0].fullName.toLowerCase())\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Format ${this.fullName} has duplicate units, '${unit.fullName}'.`); // TODO: Validation - this should be a validation error not a hard failure.\n }\n }\n\n this._units.push([unit, label]);\n }\n\n /**\n *\n * @param precision\n * @internal\n */\n protected setPrecision(precision: number) { this._base.precision = precision; }\n\n private typecheck(formatProps: SchemaItemFormatProps) {\n this._base.loadFormatProperties(formatProps);\n\n if (undefined !== formatProps.composite) { // TODO: This is duplicated below when the units need to be processed...\n if (undefined !== formatProps.composite.includeZero)\n this._base.includeZero = formatProps.composite.includeZero;\n\n if (undefined !== formatProps.composite.spacer) {\n if (formatProps.composite.spacer.length > 1)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Format ${this.fullName} has a composite with an invalid 'spacer' attribute. It should be an empty or one character string.`);\n this._base.spacer = formatProps.composite.spacer;\n }\n\n // Composite requires 1-4 units\n if (formatProps.composite.units.length <= 0 || formatProps.composite.units.length > 4)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Format ${this.fullName} has an invalid 'Composite' attribute. It should have 1-4 units.`);\n }\n }\n\n public override fromJSONSync(formatProps: SchemaItemFormatProps) {\n super.fromJSONSync(formatProps);\n this.typecheck(formatProps);\n if (undefined === formatProps.composite)\n return;\n\n // Units are separated from the rest of the deserialization because of the need to have separate sync and async implementation\n for (const unit of formatProps.composite.units) {\n const newUnit = this.schema.lookupItemSync(unit.name);\n if (undefined === newUnit || (!Unit.isUnit(newUnit) && !InvertedUnit.isInvertedUnit(newUnit)))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n \n if(Unit.isUnit(newUnit))\n this.addUnit(new DelayedPromiseWithProps(newUnit.key, async () => newUnit), unit.label);\n else if(InvertedUnit.isInvertedUnit(newUnit))\n this.addUnit(new DelayedPromiseWithProps(newUnit.key, async () => newUnit), unit.label);\n }\n }\n\n public override async fromJSON(formatProps: SchemaItemFormatProps) {\n await super.fromJSON(formatProps);\n this.typecheck(formatProps);\n if (undefined === formatProps.composite)\n return;\n\n // Units are separated from the rest of the deserialization because of the need to have separate sync and async implementation\n for (const unit of formatProps.composite.units) {\n const newUnit = await this.schema.lookupItem(unit.name);\n if (undefined === newUnit || (!Unit.isUnit(newUnit) && !InvertedUnit.isInvertedUnit(newUnit)))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n\n if(Unit.isUnit(newUnit))\n this.addUnit(new DelayedPromiseWithProps(newUnit.key, async () => newUnit), unit.label);\n else if(InvertedUnit.isInvertedUnit(newUnit))\n this.addUnit(new DelayedPromiseWithProps(newUnit.key, async () => newUnit), unit.label);\n }\n }\n\n /**\n * Save this Format'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): SchemaItemFormatProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.type = this.type;\n schemaJson.precision = this.precision;\n\n // this._spacer = \" \";\n // this._includeZero = true;\n\n // Serialize the minimal amount of information needed so anything that is the same as the default, do not serialize.\n if (0.0 !== this.roundFactor)\n schemaJson.roundFactor = this.roundFactor;\n if (ShowSignOption.OnlyNegative !== this.showSignOption)\n schemaJson.showSignOption = this.showSignOption;\n if (FormatTraits.Uninitialized !== this.formatTraits)\n schemaJson.formatTraits = formatTraitsToArray(this.formatTraits);\n if (\".\" !== this.decimalSeparator)\n schemaJson.decimalSeparator = this.decimalSeparator;\n if (\",\" !== this.thousandSeparator)\n schemaJson.thousandSeparator = this.thousandSeparator;\n if (\" \" !== this.uomSeparator)\n schemaJson.uomSeparator = this.uomSeparator;\n\n if (undefined !== this.minWidth)\n schemaJson.minWidth = this.minWidth;\n\n if (FormatType.Scientific === this.type && undefined !== this.scientificType)\n schemaJson.scientificType = this.scientificType;\n\n if (FormatType.Station === this.type) {\n if (undefined !== this.stationOffsetSize)\n schemaJson.stationOffsetSize = this.stationOffsetSize;\n if (\" \" !== this.stationSeparator)\n schemaJson.stationSeparator = this.stationSeparator;\n }\n\n if (undefined === this.units)\n return schemaJson;\n\n schemaJson.composite = {};\n\n if (\" \" !== this.spacer)\n schemaJson.composite.spacer = this.spacer;\n\n if (true !== this.includeZero)\n schemaJson.composite.includeZero = this.includeZero;\n\n schemaJson.composite.units = [];\n for (const unit of this.units) {\n schemaJson.composite.units.push({\n name: unit[0].fullName,\n label: unit[1],\n });\n }\n\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(\"type\", this.type.toLowerCase());\n itemElement.setAttribute(\"precision\", this.precision.toString());\n itemElement.setAttribute(\"roundFactor\", this.roundFactor.toString());\n itemElement.setAttribute(\"showSignOption\", this.showSignOption);\n itemElement.setAttribute(\"decimalSeparator\", this.decimalSeparator);\n itemElement.setAttribute(\"thousandSeparator\", this.thousandSeparator);\n itemElement.setAttribute(\"uomSeparator\", this.uomSeparator);\n itemElement.setAttribute(\"stationSeparator\", this.stationSeparator);\n\n if (undefined !== this.minWidth)\n itemElement.setAttribute(\"minWidth\", this.minWidth.toString());\n if (undefined !== this.scientificType)\n itemElement.setAttribute(\"scientificType\", this.scientificType);\n if (undefined !== this.stationOffsetSize)\n itemElement.setAttribute(\"stationOffsetSize\", this.stationOffsetSize.toString());\n\n const formatTraits = formatTraitsToArray(this.formatTraits);\n if (formatTraits.length > 0)\n itemElement.setAttribute(\"formatTraits\", formatTraits.join(\"|\"));\n\n if (undefined !== this.units) {\n const compositeElement = schemaXml.createElement(\"Composite\");\n if (undefined !== this.spacer)\n compositeElement.setAttribute(\"spacer\", this.spacer);\n if (undefined !== this.includeZero)\n compositeElement.setAttribute(\"includeZero\", this.includeZero.toString());\n\n for(const [unit, label] of this.units) {\n const resolvedUnit = await unit;\n const unitElement = schemaXml.createElement(\"Unit\");\n if (undefined !== label)\n unitElement.setAttribute(\"label\", label);\n const unitName = XmlSerializationUtils.createXmlTypedName(this.schema, resolvedUnit.schema, resolvedUnit.name);\n unitElement.textContent = unitName;\n compositeElement.appendChild(unitElement);\n };\n\n itemElement.appendChild(compositeElement);\n }\n\n return itemElement;\n }\n\n /**\n * @internal\n */\n protected setFormatType(formatType: FormatType) {\n this._base.type = formatType;\n }\n\n /**\n * @internal\n */\n protected setRoundFactor(roundFactor: number) {\n this._base.roundFactor = roundFactor;\n }\n\n /**\n * @internal\n */\n protected setShowSignOption(signOption: ShowSignOption) {\n this._base.showSignOption = signOption;\n }\n\n /**\n * @internal\n */\n protected setDecimalSeparator(separator: string) {\n this._base.decimalSeparator = separator;\n }\n\n /**\n * @internal\n */\n protected setThousandSeparator(separator: string) {\n this._base.thousandSeparator = separator;\n }\n\n /**\n * @internal\n */\n protected setUomSeparator(separator: string) {\n this._base.uomSeparator = separator;\n }\n\n /**\n * @internal\n */\n protected setStationSeparator(separator: string) {\n this._base.stationSeparator = separator;\n }\n\n /**\n * @internal\n */\n protected setStationOffsetSize(stationOffsetSize: number) {\n this._base.stationOffsetSize = stationOffsetSize;\n }\n\n /**\n * @internal\n */\n protected setScientificType(scientificType: ScientificType) {\n this._base.scientificType = scientificType;\n }\n\n /**\n * @internal\n */\n protected setMinWidth(minWidth: number) {\n this._base.minWidth = minWidth;\n }\n\n /**\n * @internal\n */\n protected setSpacer(spacer: string) {\n this._base.spacer = spacer;\n }\n\n /**\n * @internal\n */\n protected setIncludeZero(includeZero: boolean) {\n this._base.includeZero = includeZero;\n }\n\n /**\n * @internal\n */\n protected setFormatTraits(formatTraits: FormatTraits) {\n this._base.formatTraits = formatTraits;\n }\n\n /**\n * @internal\n */\n protected setUnits(units: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>) {\n this._units = units;\n }\n\n /** Type guard to check if the SchemaItem is of type Format.\n * @param item The SchemaItem to check.\n * @returns True if the item is a Format, false otherwise.\n */\n public static isFormat(item?: SchemaItem): item is Format {\n if (item && item.schemaItemType === SchemaItemType.Format)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type Format.\n * @param item The SchemaItem to check.\n * @returns The item cast to Format if it is a Format, undefined otherwise.\n * @internal\n */\n public static assertIsFormat(item?: SchemaItem): asserts item is Format {\n if (!this.isFormat(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.Format}' (Format)`);\n }\n}\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableFormat extends Format {\n public abstract override addUnit(unit: LazyLoadedUnit | LazyLoadedInvertedUnit, label?: string): void;\n public abstract override setPrecision(precision: number): void;\n public abstract override setFormatType(formatType: FormatType): void;\n public abstract override setRoundFactor(roundFactor: number): void;\n public abstract override setShowSignOption(signOption: ShowSignOption): void;\n public abstract override setDecimalSeparator(separator: string): void;\n public abstract override setThousandSeparator(separator: string): void;\n public abstract override setUomSeparator(separator: string): void;\n public abstract override setStationSeparator(separator: string): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}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sB,aAAc,SAAQ,MAAM;CAWjD;AAXD,sCAWC","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 { SchemaItemFormatProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport {\n BaseFormat, DecimalPrecision, FormatTraits, formatTraitsToArray, FormatType, FractionalPrecision,\n ScientificType, ShowSignOption,\n} from \"@itwin/core-quantity\";\nimport { InvertedUnit } from \"./InvertedUnit\";\nimport { Schema } from \"./Schema\";\nimport { SchemaItem } from \"./SchemaItem\";\nimport { Unit } from \"./Unit\";\nimport { LazyLoadedInvertedUnit, LazyLoadedUnit } from \"../Interfaces\";\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\n\n/**\n * @public @preview\n */\nexport class Format extends SchemaItem {\n public override readonly schemaItemType = Format.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.Format; }\n private _base: BaseFormat;\n private _units?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>;\n\n /** @internal */\n constructor(schema: Schema, name: string) {\n super(schema, name);\n this._base = new BaseFormat(name);\n }\n\n public get roundFactor(): number { return this._base.roundFactor; }\n public get type(): FormatType { return this._base.type; }\n public get precision(): DecimalPrecision | FractionalPrecision { return this._base.precision; }\n public get minWidth(): number | undefined { return this._base.minWidth; }\n public get scientificType(): ScientificType | undefined { return this._base.scientificType; }\n public get showSignOption(): ShowSignOption { return this._base.showSignOption; }\n public get decimalSeparator(): string { return this._base.decimalSeparator; }\n public get thousandSeparator(): string { return this._base.thousandSeparator; }\n public get uomSeparator(): string { return this._base.uomSeparator; }\n public get stationSeparator(): string { return this._base.stationSeparator; }\n public get stationOffsetSize(): number | undefined { return this._base.stationOffsetSize; }\n public get stationBaseFactor(): number | undefined { return this._base.stationBaseFactor; }\n public get formatTraits(): FormatTraits { return this._base.formatTraits; }\n public get spacer(): string | undefined { return this._base.spacer; }\n public get includeZero(): boolean | undefined { return this._base.includeZero; }\n public get units(): ReadonlyArray<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined {\n return this._units;\n }\n\n private parseFormatTraits(formatTraitsFromJson: string | string[]) {\n return this._base.parseFormatTraits(formatTraitsFromJson);\n }\n\n public hasFormatTrait(formatTrait: FormatTraits) {\n return this._base.hasFormatTraitSet(formatTrait);\n }\n\n /**\n * Adds a Unit, or InvertedUnit, with an optional label override.\n * @param unit The Unit, or InvertedUnit, to add to this Format.\n * @param label A label that overrides the label defined within the Unit when a value is formatted.\n * @internal\n */\n protected addUnit(unit: LazyLoadedUnit | LazyLoadedInvertedUnit, label?: string) {\n if (undefined === this._units)\n this._units = [];\n else { // Validate that a duplicate is not added.\n for (const existingUnit of this._units) {\n if (unit.fullName.toLowerCase() === existingUnit[0].fullName.toLowerCase())\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Format ${this.fullName} has duplicate units, '${unit.fullName}'.`); // TODO: Validation - this should be a validation error not a hard failure.\n }\n }\n\n this._units.push([unit, label]);\n }\n\n /**\n *\n * @param precision\n * @internal\n */\n protected setPrecision(precision: number) { this._base.precision = precision; }\n\n private typecheck(formatProps: SchemaItemFormatProps) {\n this._base.loadFormatProperties(formatProps);\n\n if (undefined !== formatProps.composite) { // TODO: This is duplicated below when the units need to be processed...\n if (undefined !== formatProps.composite.includeZero)\n this._base.includeZero = formatProps.composite.includeZero;\n\n if (undefined !== formatProps.composite.spacer) {\n if (formatProps.composite.spacer.length > 1)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Format ${this.fullName} has a composite with an invalid 'spacer' attribute. It should be an empty or one character string.`);\n this._base.spacer = formatProps.composite.spacer;\n }\n\n // Composite requires 1-4 units\n if (formatProps.composite.units.length <= 0 || formatProps.composite.units.length > 4)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Format ${this.fullName} has an invalid 'Composite' attribute. It should have 1-4 units.`);\n }\n }\n\n public override fromJSONSync(formatProps: SchemaItemFormatProps) {\n super.fromJSONSync(formatProps);\n this.typecheck(formatProps);\n if (undefined === formatProps.composite)\n return;\n\n // Units are separated from the rest of the deserialization because of the need to have separate sync and async implementation\n for (const unit of formatProps.composite.units) {\n const newUnit = this.schema.lookupItemSync(unit.name);\n if (undefined === newUnit || (!Unit.isUnit(newUnit) && !InvertedUnit.isInvertedUnit(newUnit)))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n\n if(Unit.isUnit(newUnit))\n this.addUnit(new DelayedPromiseWithProps(newUnit.key, async () => newUnit), unit.label);\n else if(InvertedUnit.isInvertedUnit(newUnit))\n this.addUnit(new DelayedPromiseWithProps(newUnit.key, async () => newUnit), unit.label);\n }\n }\n\n public override async fromJSON(formatProps: SchemaItemFormatProps) {\n await super.fromJSON(formatProps);\n this.typecheck(formatProps);\n if (undefined === formatProps.composite)\n return;\n\n // Units are separated from the rest of the deserialization because of the need to have separate sync and async implementation\n for (const unit of formatProps.composite.units) {\n const newUnit = await this.schema.lookupItem(unit.name);\n if (undefined === newUnit || (!Unit.isUnit(newUnit) && !InvertedUnit.isInvertedUnit(newUnit)))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n\n if(Unit.isUnit(newUnit))\n this.addUnit(new DelayedPromiseWithProps(newUnit.key, async () => newUnit), unit.label);\n else if(InvertedUnit.isInvertedUnit(newUnit))\n this.addUnit(new DelayedPromiseWithProps(newUnit.key, async () => newUnit), unit.label);\n }\n }\n\n /**\n * Save this Format'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): SchemaItemFormatProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.type = this.type;\n schemaJson.precision = this.precision;\n\n // this._spacer = \" \";\n // this._includeZero = true;\n\n // Serialize the minimal amount of information needed so anything that is the same as the default, do not serialize.\n if (0.0 !== this.roundFactor)\n schemaJson.roundFactor = this.roundFactor;\n if (ShowSignOption.OnlyNegative !== this.showSignOption)\n schemaJson.showSignOption = this.showSignOption;\n if (FormatTraits.Uninitialized !== this.formatTraits)\n schemaJson.formatTraits = formatTraitsToArray(this.formatTraits);\n if (\".\" !== this.decimalSeparator)\n schemaJson.decimalSeparator = this.decimalSeparator;\n if (\",\" !== this.thousandSeparator)\n schemaJson.thousandSeparator = this.thousandSeparator;\n if (\" \" !== this.uomSeparator)\n schemaJson.uomSeparator = this.uomSeparator;\n\n if (undefined !== this.minWidth)\n schemaJson.minWidth = this.minWidth;\n\n if (FormatType.Scientific === this.type && undefined !== this.scientificType)\n schemaJson.scientificType = this.scientificType;\n\n if (FormatType.Station === this.type) {\n if (undefined !== this.stationOffsetSize)\n schemaJson.stationOffsetSize = this.stationOffsetSize;\n if (\" \" !== this.stationSeparator)\n schemaJson.stationSeparator = this.stationSeparator;\n }\n\n if (undefined === this.units)\n return schemaJson;\n\n schemaJson.composite = {};\n\n if (\" \" !== this.spacer)\n schemaJson.composite.spacer = this.spacer;\n\n if (true !== this.includeZero)\n schemaJson.composite.includeZero = this.includeZero;\n\n schemaJson.composite.units = [];\n for (const unit of this.units) {\n schemaJson.composite.units.push({\n name: unit[0].fullName,\n label: unit[1],\n });\n }\n\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(\"type\", this.type.toLowerCase());\n itemElement.setAttribute(\"precision\", this.precision.toString());\n itemElement.setAttribute(\"roundFactor\", this.roundFactor.toString());\n itemElement.setAttribute(\"showSignOption\", this.showSignOption);\n itemElement.setAttribute(\"decimalSeparator\", this.decimalSeparator);\n itemElement.setAttribute(\"thousandSeparator\", this.thousandSeparator);\n itemElement.setAttribute(\"uomSeparator\", this.uomSeparator);\n itemElement.setAttribute(\"stationSeparator\", this.stationSeparator);\n\n if (undefined !== this.minWidth)\n itemElement.setAttribute(\"minWidth\", this.minWidth.toString());\n if (undefined !== this.scientificType)\n itemElement.setAttribute(\"scientificType\", this.scientificType);\n if (undefined !== this.stationOffsetSize)\n itemElement.setAttribute(\"stationOffsetSize\", this.stationOffsetSize.toString());\n\n const formatTraits = formatTraitsToArray(this.formatTraits);\n if (formatTraits.length > 0)\n itemElement.setAttribute(\"formatTraits\", formatTraits.join(\"|\"));\n\n if (undefined !== this.units) {\n const compositeElement = schemaXml.createElement(\"Composite\");\n if (undefined !== this.spacer)\n compositeElement.setAttribute(\"spacer\", this.spacer);\n if (undefined !== this.includeZero)\n compositeElement.setAttribute(\"includeZero\", this.includeZero.toString());\n\n for(const [unit, label] of this.units) {\n const resolvedUnit = await unit;\n const unitElement = schemaXml.createElement(\"Unit\");\n if (undefined !== label)\n unitElement.setAttribute(\"label\", label);\n const unitName = XmlSerializationUtils.createXmlTypedName(this.schema, resolvedUnit.schema, resolvedUnit.name);\n unitElement.textContent = unitName;\n compositeElement.appendChild(unitElement);\n };\n\n itemElement.appendChild(compositeElement);\n }\n\n return itemElement;\n }\n\n /**\n * @internal\n */\n protected setFormatType(formatType: FormatType) {\n this._base.type = formatType;\n }\n\n /**\n * @internal\n */\n protected setRoundFactor(roundFactor: number) {\n this._base.roundFactor = roundFactor;\n }\n\n /**\n * @internal\n */\n protected setShowSignOption(signOption: ShowSignOption) {\n this._base.showSignOption = signOption;\n }\n\n /**\n * @internal\n */\n protected setDecimalSeparator(separator: string) {\n this._base.decimalSeparator = separator;\n }\n\n /**\n * @internal\n */\n protected setThousandSeparator(separator: string) {\n this._base.thousandSeparator = separator;\n }\n\n /**\n * @internal\n */\n protected setUomSeparator(separator: string) {\n this._base.uomSeparator = separator;\n }\n\n /**\n * @internal\n */\n protected setStationSeparator(separator: string) {\n this._base.stationSeparator = separator;\n }\n\n /**\n * @internal\n */\n protected setStationOffsetSize(stationOffsetSize: number) {\n this._base.stationOffsetSize = stationOffsetSize;\n }\n\n /**\n * @internal\n */\n protected setStationBaseFactor(stationBaseFactor: number) {\n this._base.stationBaseFactor = stationBaseFactor;\n }\n\n /**\n * @internal\n */\n protected setScientificType(scientificType: ScientificType) {\n this._base.scientificType = scientificType;\n }\n\n /**\n * @internal\n */\n protected setMinWidth(minWidth: number) {\n this._base.minWidth = minWidth;\n }\n\n /**\n * @internal\n */\n protected setSpacer(spacer: string) {\n this._base.spacer = spacer;\n }\n\n /**\n * @internal\n */\n protected setIncludeZero(includeZero: boolean) {\n this._base.includeZero = includeZero;\n }\n\n /**\n * @internal\n */\n protected setFormatTraits(formatTraits: FormatTraits) {\n this._base.formatTraits = formatTraits;\n }\n\n /**\n * @internal\n */\n protected setUnits(units: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>) {\n this._units = units;\n }\n\n /** Type guard to check if the SchemaItem is of type Format.\n * @param item The SchemaItem to check.\n * @returns True if the item is a Format, false otherwise.\n */\n public static isFormat(item?: SchemaItem): item is Format {\n if (item && item.schemaItemType === SchemaItemType.Format)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type Format.\n * @param item The SchemaItem to check.\n * @returns The item cast to Format if it is a Format, undefined otherwise.\n * @internal\n */\n public static assertIsFormat(item?: SchemaItem): asserts item is Format {\n if (!this.isFormat(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.Format}' (Format)`);\n }\n}\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableFormat extends Format {\n public abstract override addUnit(unit: LazyLoadedUnit | LazyLoadedInvertedUnit, label?: string): void;\n public abstract override setPrecision(precision: number): void;\n public abstract override setFormatType(formatType: FormatType): void;\n public abstract override setRoundFactor(roundFactor: number): void;\n public abstract override setShowSignOption(signOption: ShowSignOption): void;\n public abstract override setDecimalSeparator(separator: string): void;\n public abstract override setThousandSeparator(separator: string): void;\n public abstract override setUomSeparator(separator: string): void;\n public abstract override setStationSeparator(separator: string): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KindOfQuantity.js","sourceRoot":"","sources":["../../../src/Metadata/KindOfQuantity.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4D;AAE5D,oFAAiF;AACjF,4CAA8C;AAC9C,4CAA6D;AAE7D,qCAAkC;AAClC,iDAA8C;AAC9C,qDAAuE;AACvE,6CAA0C;AAC1C,iCAA8B;AAE9B;;GAEG;AACH,MAAa,cAAe,SAAQ,uBAAU;IACnB,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC;IACxE,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,0BAAc,CAAC,cAAc,CAAC,CAAC,CAAC;IAC7E,cAAc,GAAW,GAAG,CAAC;IAC7B,oBAAoB,GAA6C,EAAE,CAAC;IACpE,gBAAgB,CAA2C;IAEnE,4DAA4D;IAC5D,IAAW,yBAAyB,KAAoD,OAAO,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7H,sCAAsC;IACtC,IAAW,mBAAmB,KAA+C,OAAO,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAEhH,uBAAuB;IACvB,IAAW,eAAe,KAA0D,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEnH,IAAW,aAAa,KAAK,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;IAE1D;;;;;OAKG;IACO,qBAAqB,CAAC,MAAyC,EAAE,YAAqB,KAAK;QACnG,qCAAqC;QACrC,mEAAmE;QACnE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,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;IAC/E,CAAC;IAED;;;OAGG;IACO,gBAAgB,CAAC,aAAqB;QAC9C,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACtC,CAAC;IAED;;;OAGG;IACO,kBAAkB,CAAC,KAA0D;QACrF,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,gBAAgB,CAAC,IAAiB;QAC9C,IAAI,IAAI,IAAI,IAAI,CAAC,cAAc,KAAK,0BAAc,CAAC,cAAc;YAC/D,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,sBAAsB,CAAC,IAAiB;QACpD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;YAC9B,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,qBAAqB,EAAE,aAAa,0BAAc,CAAC,cAAc,oBAAoB,CAAC,CAAC;IAClI,CAAC;CACF;AAlPD,wCAkPC;AACD;;;GAGG;AACH,MAAsB,qBAAsB,SAAQ,cAAc;CAMjE;AAND,sDAMC","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 { KindOfQuantityProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { LazyLoadedFormat, LazyLoadedInvertedUnit, LazyLoadedUnit } from \"../Interfaces\";\nimport { Format } from \"./Format\";\nimport { InvertedUnit } from \"./InvertedUnit\";\nimport { OverrideFormat, OverrideFormatProps } from \"./OverrideFormat\";\nimport { SchemaItem } from \"./SchemaItem\";\nimport { Unit } from \"./Unit\";\n\n/** A Typescript class representation of a KindOfQuantity.\n * @public @preview\n */\nexport class KindOfQuantity extends SchemaItem {\n public override readonly schemaItemType = KindOfQuantity.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.KindOfQuantity; }\n private _relativeError: number = 1.0;\n private _presentationFormats: Array<LazyLoadedFormat | OverrideFormat> = [];\n private _persistenceUnit?: LazyLoadedUnit | LazyLoadedInvertedUnit;\n\n /** The first presentation format in the list of Formats. */\n public get defaultPresentationFormat(): LazyLoadedFormat | OverrideFormat | undefined { return this.presentationFormats[0]; }\n\n /** A list of presentation formats. */\n public get presentationFormats(): Array<LazyLoadedFormat | OverrideFormat> { return this._presentationFormats; }\n\n /** Persistence unit */\n public get persistenceUnit(): LazyLoadedUnit | LazyLoadedInvertedUnit | undefined { return this._persistenceUnit; }\n\n public get relativeError() { return this._relativeError; }\n\n /**\n *\n * @param format The Format to add to this KindOfQuantity\n * @param isDefault\n * @internal\n */\n protected addPresentationFormat(format: LazyLoadedFormat | OverrideFormat, isDefault: boolean = false) {\n // TODO: Add some sort of validation?\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n (isDefault) ? this._presentationFormats.splice(0, 0, format) : this._presentationFormats.push(format);\n }\n\n /** Creates an OverrideFormat in the context of this KindOfQuantity.\n * @param parent The Format to override.\n * @param precision The precision override\n * @param unitLabelOverrides The list of unit and label overrides.\n * @internal\n */\n protected createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): OverrideFormat {\n if (unitLabelOverrides && parent.units && parent.units.length !== unitLabelOverrides.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Cannot add presentation format to KindOfQuantity '${this.name}' because the number of unit overrides is inconsistent with the number in the Format '${parent.name}'.`);\n\n if (parent.units && 0 === parent.units.length && unitLabelOverrides && 0 < unitLabelOverrides.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Cannot add a presentation format to KindOfQuantity '${this.name}' without any units and no unit overrides.`);\n\n // TODO: Check compatibility of Unit overrides with the persistence unit\n\n return new OverrideFormat(parent, precision, unitLabelOverrides);\n }\n\n private async processPresentationUnits(presentationUnitsJson: string | string[]): Promise<void> {\n const presUnitsArr = Array.isArray(presentationUnitsJson) ? presentationUnitsJson : presentationUnitsJson.split(\";\");\n for (const formatString of presUnitsArr) {\n const presFormatOverride: OverrideFormatProps = OverrideFormat.parseFormatString(formatString);\n\n const format = await this.schema.lookupItem(presFormatOverride.name, Format);\n if (undefined === format || format.schemaItemType !== SchemaItemType.Format)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate Format '${presFormatOverride.name}' for the presentation unit on KindOfQuantity ${this.fullName}.`);\n\n if (undefined === presFormatOverride.precision && undefined === presFormatOverride.unitAndLabels) {\n this.addPresentationFormat(new DelayedPromiseWithProps(format.key, async () => format));\n continue;\n }\n\n let unitAndLabels: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined;\n if (undefined !== presFormatOverride.unitAndLabels) {\n if (4 < presFormatOverride.unitAndLabels.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n\n unitAndLabels = [];\n for (const unitOverride of presFormatOverride.unitAndLabels) {\n const unitOrInverted = await this.schema.lookupItem(unitOverride[0]);\n \n if(Unit.isUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else if(InvertedUnit.isInvertedUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${unitOverride[0]}.`);\n }\n }\n\n const overrideFormat = this.createFormatOverride(format, presFormatOverride.precision, unitAndLabels);\n this.addPresentationFormat(overrideFormat);\n }\n }\n\n private processPresentationUnitsSync(presentationUnitsJson: string | string[]): void {\n const presUnitsArr = Array.isArray(presentationUnitsJson) ? presentationUnitsJson : presentationUnitsJson.split(\";\");\n for (const formatString of presUnitsArr) {\n const presFormatOverride: OverrideFormatProps = OverrideFormat.parseFormatString(formatString);\n\n const format = this.schema.lookupItemSync(presFormatOverride.name, Format);\n if (undefined === format || format.schemaItemType !== SchemaItemType.Format)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate Format '${presFormatOverride.name}' for the presentation unit on KindOfQuantity ${this.fullName}.`);\n\n if (undefined === presFormatOverride.precision && undefined === presFormatOverride.unitAndLabels) {\n this.addPresentationFormat(new DelayedPromiseWithProps(format.key, async () => format));\n continue;\n }\n\n let unitAndLabels: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined;\n if (undefined !== presFormatOverride.unitAndLabels) {\n if (4 < presFormatOverride.unitAndLabels.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n\n unitAndLabels = [];\n for (const unitOverride of presFormatOverride.unitAndLabels) {\n const unitOrInverted = this.schema.lookupItemSync(unitOverride[0]);\n if(Unit.isUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else if(InvertedUnit.isInvertedUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${unitOverride[0]}.`);\n }\n }\n\n const overrideFormat = this.createFormatOverride(format, presFormatOverride.precision, unitAndLabels);\n this.addPresentationFormat(overrideFormat);\n }\n }\n\n /**\n * Save this KindOfQuantity'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): KindOfQuantityProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.relativeError = this.relativeError;\n schemaJson.persistenceUnit = this.persistenceUnit!.fullName;\n if (undefined !== this.presentationFormats && 0 < this.presentationFormats.length)\n schemaJson.presentationUnits = this.presentationFormats.map((format) => format.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\n const persistenceUnit = await this.persistenceUnit;\n if (undefined !== persistenceUnit) {\n const unitName = XmlSerializationUtils.createXmlTypedName(this.schema, persistenceUnit.schema, persistenceUnit.name);\n itemElement.setAttribute(\"persistenceUnit\", unitName);\n }\n\n if (undefined !== this.presentationFormats) {\n const presUnitStrings: string[] = [];\n for(const format of this.presentationFormats) {\n if (!OverrideFormat.isOverrideFormat(format)) {\n const resolvedFormat = await format;\n presUnitStrings.push(XmlSerializationUtils.createXmlTypedName(this.schema, resolvedFormat.schema, format.name));\n continue;\n }\n presUnitStrings.push(format.fullNameXml(this.schema));\n };\n itemElement.setAttribute(\"presentationUnits\", presUnitStrings.join(\";\"));\n }\n itemElement.setAttribute(\"relativeError\", this.relativeError.toString());\n\n return itemElement;\n }\n\n public override fromJSONSync(kindOfQuantityProps: KindOfQuantityProps): void {\n super.fromJSONSync(kindOfQuantityProps);\n this._relativeError = kindOfQuantityProps.relativeError;\n\n const persistenceUnit = this.schema.lookupItemSync(kindOfQuantityProps.persistenceUnit);\n if (undefined === persistenceUnit)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Unit ${kindOfQuantityProps.persistenceUnit} does not exist.`);\n\n if (!Unit.isUnit(persistenceUnit) && !InvertedUnit.isInvertedUnit(persistenceUnit))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The item ${kindOfQuantityProps.persistenceUnit} is not a Unit or InvertedUnit.`);\n\n if (Unit.isUnit(persistenceUnit))\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n else\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n\n if (undefined !== kindOfQuantityProps.presentationUnits)\n this.processPresentationUnitsSync(kindOfQuantityProps.presentationUnits);\n }\n\n public override async fromJSON(kindOfQuantityProps: KindOfQuantityProps): Promise<void> {\n await super.fromJSON(kindOfQuantityProps);\n this._relativeError = kindOfQuantityProps.relativeError;\n\n const persistenceUnit = await this.schema.lookupItem(kindOfQuantityProps.persistenceUnit);\n if (undefined === persistenceUnit)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Unit ${kindOfQuantityProps.persistenceUnit} does not exist.`);\n\n if (!Unit.isUnit(persistenceUnit) && !InvertedUnit.isInvertedUnit(persistenceUnit))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The item ${kindOfQuantityProps.persistenceUnit} is not a Unit or InvertedUnit.`);\n\n if (Unit.isUnit(persistenceUnit))\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n else\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n\n\n if (undefined !== kindOfQuantityProps.presentationUnits)\n await this.processPresentationUnits(kindOfQuantityProps.presentationUnits);\n }\n\n /**\n * Used for schema editing.\n * @internal\n */\n protected setRelativeError(relativeError: number): void {\n this._relativeError = relativeError;\n }\n\n /**\n * Used for schema editing.\n * @internal\n */\n protected setPersistenceUnit(value: LazyLoadedUnit | LazyLoadedInvertedUnit | undefined): void {\n this._persistenceUnit = value;\n }\n\n /**\n * Type guard to check if the SchemaItem is of type KindOfQuantity.\n * @param item The SchemaItem to check.\n * @returns True if the item is a KindOfQuantity, false otherwise.\n */\n public static isKindOfQuantity(item?: SchemaItem): item is KindOfQuantity {\n if (item && item.schemaItemType === SchemaItemType.KindOfQuantity)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type KindOfQuantity.\n * @param item The SchemaItem to check.\n * @returns The item cast to KindOfQuantity if it is a KindOfQuantity, undefined otherwise.\n * @internal\n */\n public static assertIsKindOfQuantity(item?: SchemaItem): asserts item is KindOfQuantity {\n if (!this.isKindOfQuantity(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.KindOfQuantity}' (KindOfQuantity)`);\n }\n}\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableKindOfQuantity extends KindOfQuantity {\n public abstract override addPresentationFormat(format: LazyLoadedFormat | OverrideFormat, isDefault: boolean): void;\n public abstract override createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): OverrideFormat;\n public abstract override setDisplayLabel(displayLabel: string): void;\n public abstract override setPersistenceUnit(value: LazyLoadedUnit | LazyLoadedInvertedUnit | undefined): void;\n public abstract override setRelativeError(relativeError: number): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"KindOfQuantity.js","sourceRoot":"","sources":["../../../src/Metadata/KindOfQuantity.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4D;AAE5D,oFAAiF;AACjF,4CAA8C;AAC9C,4CAA6D;AAE7D,qCAAkC;AAClC,iDAA8C;AAC9C,qDAAuE;AACvE,6CAA0C;AAC1C,iCAA8B;AAE9B;;GAEG;AACH,MAAa,cAAe,SAAQ,uBAAU;IACnB,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC;IACxE,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,0BAAc,CAAC,cAAc,CAAC,CAAC,CAAC;IAC7E,cAAc,GAAW,GAAG,CAAC;IAC7B,oBAAoB,GAA6C,EAAE,CAAC;IACpE,gBAAgB,CAA2C;IAEnE,4DAA4D;IAC5D,IAAW,yBAAyB,KAAoD,OAAO,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7H,sCAAsC;IACtC,IAAW,mBAAmB,KAA+C,OAA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AAgB,GAAG,IAAI,wCAAuB,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,eAAe,CAAC,CAAC;;YAEtG,IAAI,CAAC,gBAAgB,GAAG,IAAI,wCAAuB,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,eAAe,CAAC,CAAC;QAGxG,IAAI,SAAS,KAAK,mBAAmB,CAAC,iBAAiB;YACrD,MAAM,IAAI,CAAC,wBAAwB,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;IAC/E,CAAC;IAED;;;OAGG;IACO,gBAAgB,CAAC,aAAqB;QAC9C,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACtC,CAAC;IAED;;;OAGG;IACO,kBAAkB,CAAC,KAA0D;QACrF,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,gBAAgB,CAAC,IAAiB;QAC9C,IAAI,IAAI,IAAI,IAAI,CAAC,cAAc,KAAK,0BAAc,CAAC,cAAc;YAC/D,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,sBAAsB,CAAC,IAAiB;QACpD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;YAC9B,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,qBAAqB,EAAE,aAAa,0BAAc,CAAC,cAAc,oBAAoB,CAAC,CAAC;IAClI,CAAC;CACF;AAlPD,wCAkPC;AACD;;;GAGG;AACH,MAAsB,qBAAsB,SAAQ,cAAc;CAMjE;AAND,sDAMC","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 { KindOfQuantityProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { LazyLoadedFormat, LazyLoadedInvertedUnit, LazyLoadedUnit } from \"../Interfaces\";\nimport { Format } from \"./Format\";\nimport { InvertedUnit } from \"./InvertedUnit\";\nimport { OverrideFormat, OverrideFormatProps } from \"./OverrideFormat\";\nimport { SchemaItem } from \"./SchemaItem\";\nimport { Unit } from \"./Unit\";\n\n/** A Typescript class representation of a KindOfQuantity.\n * @public @preview\n */\nexport class KindOfQuantity extends SchemaItem {\n public override readonly schemaItemType = KindOfQuantity.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.KindOfQuantity; }\n private _relativeError: number = 1.0;\n private _presentationFormats: Array<LazyLoadedFormat | OverrideFormat> = [];\n private _persistenceUnit?: LazyLoadedUnit | LazyLoadedInvertedUnit;\n\n /** The first presentation format in the list of Formats. */\n public get defaultPresentationFormat(): LazyLoadedFormat | OverrideFormat | undefined { return this.presentationFormats[0]; }\n\n /** A list of presentation formats. */\n public get presentationFormats(): Array<LazyLoadedFormat | OverrideFormat> { return this._presentationFormats; }\n\n /** Persistence unit */\n public get persistenceUnit(): LazyLoadedUnit | LazyLoadedInvertedUnit | undefined { return this._persistenceUnit; }\n\n public get relativeError() { return this._relativeError; }\n\n /**\n *\n * @param format The Format to add to this KindOfQuantity\n * @param isDefault\n * @internal\n */\n protected addPresentationFormat(format: LazyLoadedFormat | OverrideFormat, isDefault: boolean = false) {\n // TODO: Add some sort of validation?\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n (isDefault) ? this._presentationFormats.splice(0, 0, format) : this._presentationFormats.push(format);\n }\n\n /** Creates an OverrideFormat in the context of this KindOfQuantity.\n * @param parent The Format to override.\n * @param precision The precision override\n * @param unitLabelOverrides The list of unit and label overrides.\n * @internal\n */\n protected createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): OverrideFormat {\n if (unitLabelOverrides && parent.units && parent.units.length !== unitLabelOverrides.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Cannot add presentation format to KindOfQuantity '${this.name}' because the number of unit overrides is inconsistent with the number in the Format '${parent.name}'.`);\n\n if (parent.units && 0 === parent.units.length && unitLabelOverrides && 0 < unitLabelOverrides.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Cannot add a presentation format to KindOfQuantity '${this.name}' without any units and no unit overrides.`);\n\n // TODO: Check compatibility of Unit overrides with the persistence unit\n\n return new OverrideFormat(parent, precision, unitLabelOverrides);\n }\n\n private async processPresentationUnits(presentationUnitsJson: string | string[]): Promise<void> {\n const presUnitsArr = Array.isArray(presentationUnitsJson) ? presentationUnitsJson : presentationUnitsJson.split(\";\");\n for (const formatString of presUnitsArr) {\n const presFormatOverride: OverrideFormatProps = OverrideFormat.parseFormatString(formatString);\n\n const format = await this.schema.lookupItem(presFormatOverride.name, Format);\n if (undefined === format || format.schemaItemType !== SchemaItemType.Format)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate Format '${presFormatOverride.name}' for the presentation unit on KindOfQuantity ${this.fullName}.`);\n\n if (undefined === presFormatOverride.precision && undefined === presFormatOverride.unitAndLabels) {\n this.addPresentationFormat(new DelayedPromiseWithProps(format.key, async () => format));\n continue;\n }\n\n let unitAndLabels: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined;\n if (undefined !== presFormatOverride.unitAndLabels) {\n if (4 < presFormatOverride.unitAndLabels.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n\n unitAndLabels = [];\n for (const unitOverride of presFormatOverride.unitAndLabels) {\n const unitOrInverted = await this.schema.lookupItem(unitOverride[0]);\n\n if(Unit.isUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else if(InvertedUnit.isInvertedUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${unitOverride[0]}.`);\n }\n }\n\n const overrideFormat = this.createFormatOverride(format, presFormatOverride.precision, unitAndLabels);\n this.addPresentationFormat(overrideFormat);\n }\n }\n\n private processPresentationUnitsSync(presentationUnitsJson: string | string[]): void {\n const presUnitsArr = Array.isArray(presentationUnitsJson) ? presentationUnitsJson : presentationUnitsJson.split(\";\");\n for (const formatString of presUnitsArr) {\n const presFormatOverride: OverrideFormatProps = OverrideFormat.parseFormatString(formatString);\n\n const format = this.schema.lookupItemSync(presFormatOverride.name, Format);\n if (undefined === format || format.schemaItemType !== SchemaItemType.Format)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate Format '${presFormatOverride.name}' for the presentation unit on KindOfQuantity ${this.fullName}.`);\n\n if (undefined === presFormatOverride.precision && undefined === presFormatOverride.unitAndLabels) {\n this.addPresentationFormat(new DelayedPromiseWithProps(format.key, async () => format));\n continue;\n }\n\n let unitAndLabels: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined;\n if (undefined !== presFormatOverride.unitAndLabels) {\n if (4 < presFormatOverride.unitAndLabels.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n\n unitAndLabels = [];\n for (const unitOverride of presFormatOverride.unitAndLabels) {\n const unitOrInverted = this.schema.lookupItemSync(unitOverride[0]);\n if(Unit.isUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else if(InvertedUnit.isInvertedUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${unitOverride[0]}.`);\n }\n }\n\n const overrideFormat = this.createFormatOverride(format, presFormatOverride.precision, unitAndLabels);\n this.addPresentationFormat(overrideFormat);\n }\n }\n\n /**\n * Save this KindOfQuantity'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): KindOfQuantityProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.relativeError = this.relativeError;\n schemaJson.persistenceUnit = this.persistenceUnit!.fullName;\n if (undefined !== this.presentationFormats && 0 < this.presentationFormats.length)\n schemaJson.presentationUnits = this.presentationFormats.map((format) => format.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\n const persistenceUnit = await this.persistenceUnit;\n if (undefined !== persistenceUnit) {\n const unitName = XmlSerializationUtils.createXmlTypedName(this.schema, persistenceUnit.schema, persistenceUnit.name);\n itemElement.setAttribute(\"persistenceUnit\", unitName);\n }\n\n if (undefined !== this.presentationFormats) {\n const presUnitStrings: string[] = [];\n for(const format of this.presentationFormats) {\n if (!OverrideFormat.isOverrideFormat(format)) {\n const resolvedFormat = await format;\n presUnitStrings.push(XmlSerializationUtils.createXmlTypedName(this.schema, resolvedFormat.schema, format.name));\n continue;\n }\n presUnitStrings.push(format.fullNameXml(this.schema));\n };\n itemElement.setAttribute(\"presentationUnits\", presUnitStrings.join(\";\"));\n }\n itemElement.setAttribute(\"relativeError\", this.relativeError.toString());\n\n return itemElement;\n }\n\n public override fromJSONSync(kindOfQuantityProps: KindOfQuantityProps): void {\n super.fromJSONSync(kindOfQuantityProps);\n this._relativeError = kindOfQuantityProps.relativeError;\n\n const persistenceUnit = this.schema.lookupItemSync(kindOfQuantityProps.persistenceUnit);\n if (undefined === persistenceUnit)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Unit ${kindOfQuantityProps.persistenceUnit} does not exist.`);\n\n if (!Unit.isUnit(persistenceUnit) && !InvertedUnit.isInvertedUnit(persistenceUnit))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The item ${kindOfQuantityProps.persistenceUnit} is not a Unit or InvertedUnit.`);\n\n if (Unit.isUnit(persistenceUnit))\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n else\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n\n if (undefined !== kindOfQuantityProps.presentationUnits)\n this.processPresentationUnitsSync(kindOfQuantityProps.presentationUnits);\n }\n\n public override async fromJSON(kindOfQuantityProps: KindOfQuantityProps): Promise<void> {\n await super.fromJSON(kindOfQuantityProps);\n this._relativeError = kindOfQuantityProps.relativeError;\n\n const persistenceUnit = await this.schema.lookupItem(kindOfQuantityProps.persistenceUnit);\n if (undefined === persistenceUnit)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Unit ${kindOfQuantityProps.persistenceUnit} does not exist.`);\n\n if (!Unit.isUnit(persistenceUnit) && !InvertedUnit.isInvertedUnit(persistenceUnit))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The item ${kindOfQuantityProps.persistenceUnit} is not a Unit or InvertedUnit.`);\n\n if (Unit.isUnit(persistenceUnit))\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n else\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n\n\n if (undefined !== kindOfQuantityProps.presentationUnits)\n await this.processPresentationUnits(kindOfQuantityProps.presentationUnits);\n }\n\n /**\n * Used for schema editing.\n * @internal\n */\n protected setRelativeError(relativeError: number): void {\n this._relativeError = relativeError;\n }\n\n /**\n * Used for schema editing.\n * @internal\n */\n protected setPersistenceUnit(value: LazyLoadedUnit | LazyLoadedInvertedUnit | undefined): void {\n this._persistenceUnit = value;\n }\n\n /**\n * Type guard to check if the SchemaItem is of type KindOfQuantity.\n * @param item The SchemaItem to check.\n * @returns True if the item is a KindOfQuantity, false otherwise.\n */\n public static isKindOfQuantity(item?: SchemaItem): item is KindOfQuantity {\n if (item && item.schemaItemType === SchemaItemType.KindOfQuantity)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type KindOfQuantity.\n * @param item The SchemaItem to check.\n * @returns The item cast to KindOfQuantity if it is a KindOfQuantity, undefined otherwise.\n * @internal\n */\n public static assertIsKindOfQuantity(item?: SchemaItem): asserts item is KindOfQuantity {\n if (!this.isKindOfQuantity(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.KindOfQuantity}' (KindOfQuantity)`);\n }\n}\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableKindOfQuantity extends KindOfQuantity {\n public abstract override addPresentationFormat(format: LazyLoadedFormat | OverrideFormat, isDefault: boolean): void;\n public abstract override createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): OverrideFormat;\n public abstract override setDisplayLabel(displayLabel: string): void;\n public abstract override setPersistenceUnit(value: LazyLoadedUnit | LazyLoadedInvertedUnit | undefined): void;\n public abstract override setRelativeError(relativeError: number): void;\n}\n"]}
|