@itwin/grouping-mapping-widget 0.35.1 → 0.35.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"QueryBuilder.testdata.js","sourceRoot":"","sources":["../../../src/test/QueryBuilder.testdata.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,oEAAiE;AAGpD,QAAA,SAAS,GAAyB;IAC7C,SAAS,EAAE;QACT;YACE,IAAI,EAAE,6EAA6E;YACnF,cAAc,EAAE,4EAA4E;YAC5F,UAAU,EAAE;gBACV;oBACE,cAAc,EAAE,IAAI;oBACpB,aAAa,EAAE,aAAa;oBAC5B,mBAAmB,EAAE,yCAAmB,CAAC,UAAU;oBACnD,cAAc,EAAE;wBACd,KAAK,EAAE;4BACL,WAAW,EAAE,CAAC;4BACd,KAAK,EAAE,CAAC;yBACT;wBACD,QAAQ,EAAE;4BACR,QAAQ,EAAE,eAAe;4BACzB,IAAI,EAAE,cAAc;4BACpB,YAAY,EAAE,sBAAsB;yBACrC;qBACF;oBACD,eAAe,EAAE;wBACf,UAAU,EAAE;4BACV;gCACE,QAAQ,EAAE;oCACR,IAAI,EAAE,cAAc;oCACpB,SAAS,EAAE;wCACT,IAAI,EAAE,KAAK;qCACZ;iCACF;6BACF;yBACF;wBACD,IAAI,EAAE;4BACJ,QAAQ,EAAE,QAAQ;yBACnB;wBACD,MAAM,EAAE;4BACN,kBAAkB,EAAE,EAAE;yBACvB;qBACF;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,kGAAkG;YACxG,cAAc,EACZ,iUAAiU;YACnU,UAAU,EAAE;gBACV;oBACE,cAAc,EAAE,IAAI;oBACpB,aAAa,EAAE,aAAa;oBAC5B,mBAAmB,EAAE,yCAAmB,CAAC,UAAU;oBACnD,cAAc,EAAE;wBACd,KAAK,EAAE;4BACL,WAAW,EAAE,CAAC;4BACd,KAAK,EAAE,YAAY;yBACpB;wBACD,Q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AAc;4BACpB,YAAY,EAAE,sBAAsB;yBACrC;qBACF;oBACD,eAAe,EAAE;wBACf,UAAU,EAAE;4BACV;gCACE,QAAQ,EAAE;oCACR,IAAI,EAAE,cAAc;oCACpB,SAAS,EAAE;wCACT,IAAI,EAAE,WAAW;qCAClB;oCACD,sBAAsB,EAAE;wCACtB,SAAS,EAAE;4CACT,IAAI,EAAE,wCAAwC;yCAC/C;qCACF;iCACF;6BACF;yBACF;wBACD,IAAI,EAAE;4BACJ,QAAQ,EAAE,QAAQ;yBACnB;wBACD,MAAM,EAAE;4BACN,kBAAkB,EAAE,EAAE;yBACvB;qBACF;iBACF;aACF;SACF;KACF;CACF,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 *--------------------------------------------------------------------------------------------*/\nimport { FieldDescriptorType } from \"@itwin/presentation-common\";\nimport type { QueryBuilderTestData } from \"./QueryBuilderTestData\";\n\nexport const testCases: QueryBuilderTestData = {\n testCases: [\n {\n name: \"when non-relational property added, return query string with property value\",\n expectedResult: \"SELECT A.B.ECInstanceId, A.B.ECClassId FROM A.B WHERE A.B.somePropName = 1\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: 1,\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"number\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when relational property added, return query string with property value and relation chain to it\",\n expectedResult:\n \"SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE A.B.somePropName = 'someString'\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n ],\n },\n {\n name: \"when multiple relational properties added, return query string with property values and relation chains to them\",\n expectedResult:\n \"SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN G.H ON Rel.BC.TargetECInstanceId = G.H.ECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE G.H.someOtherPropName = 'someOtherString' AND A.B.somePropName = 'someString'\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someOtherString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"otherPropertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"someOtherPropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"G:H\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"G:H\",\n },\n },\n },\n },\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n ],\n },\n {\n name: \"when relational property and non-relational property from one of relational chain classes added, return query string with property values and relation chain\",\n expectedResult:\n \"SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE A.B.somePropName = 'someString' AND A.C.SomeOtherPropName = 1\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"somePropName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:C\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: 1,\n },\n property: {\n typename: \"notNavigation\",\n name: \"SomeOtherPropName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"SomeOtherPropName\",\n classInfo: {\n name: \"A:C\",\n },\n },\n },\n ],\n type: {\n typeName: \"number\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when relational and non-relational property from the same class added, return query string with property values and relation chain\",\n expectedResult:\n \"SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE A.B.somePropName = 'someString' AND A.B.SomeOtherPropName = 1\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: 1,\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName2\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"SomeOtherPropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"number\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when non-relational property removed, return empty string\",\n expectedResult: \"\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n contentClassInfo: {\n name: \"sourceClassName\",\n },\n },\n },\n },\n {\n operationType: \"removeProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n contentClassInfo: {\n name: \"sourceClassName\",\n },\n },\n },\n },\n ],\n },\n {\n name: \"when relational property removed, return empty string\",\n expectedResult: \"\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n {\n operationType: \"removeProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n ],\n },\n {\n name: \"when non-relational property re-added after removing, return query string with property value\",\n expectedResult: \"SELECT A.B.ECInstanceId, A.B.ECClassId FROM A.B WHERE A.B.somePropName = 'someOtherString'\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n contentClassInfo: {\n name: \"sourceClassName\",\n },\n },\n },\n },\n {\n operationType: \"removeProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n contentClassInfo: {\n name: \"sourceClassName\",\n },\n },\n },\n },\n {\n operationType: \"addProperty\",\n expectedResult: true,\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someOtherString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n contentClassInfo: {\n name: \"sourceClassName\",\n },\n },\n },\n },\n ],\n },\n {\n name: \"when relational property re-added after removing, return query string with property value and relation chain to it\",\n expectedResult:\n \"SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE A.B.somePropName = 'someOtherString'\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n {\n operationType: \"removeProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someOtherString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n ],\n },\n {\n name: \"when no properties added, return empty string\",\n expectedResult: \"\",\n operations: [],\n },\n {\n name: \"when property is float, return query string with ROUND\",\n expectedResult: \"SELECT A.B.ECInstanceId, A.B.ECClassId FROM A.B WHERE ROUND(A.B.somePropName, 4) = 3.1416\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: 3.14159,\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"number\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when property needsQuotes, return query string with property value in quotes\",\n expectedResult: \"SELECT A.B.ECInstanceId, A.B.ECClassId FROM A.B WHERE A.B.somePropName = 'https://valueThatNeedsQuotes.com'\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"https://valueThatNeedsQuotes.com\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"uri\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when property is category, return a category query string\",\n expectedResult:\n \"SELECT BisCore.B.ECInstanceId, BisCore.B.ECClassId FROM BisCore.B JOIN BisCore.Category ON BisCore.Category.ECInstanceId = BisCore.GeometricElement3d.category.id WHERE ((BisCore.Category.CodeValue = 'displayValueString') OR (BisCore.Category.UserLabel = 'displayValueString'))\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n displayValue: \"displayValueString\",\n },\n property: {\n typename: \"navigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"BisCore:B\",\n },\n navigationPropertyInfo: {\n classInfo: {\n name: \"BisCore:GeometricElement3dIsInCategory\",\n },\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when property is a model, return a model query string\",\n expectedResult:\n \"SELECT BisCore.B.ECInstanceId, BisCore.B.ECClassId FROM BisCore.B JOIN mockModeledElement ON mockModeledElement.ECInstanceId = BisCore.Element.Model.id WHERE mockModeledElement.UserLabel = 'displayValueString' OR mockModeledElement.CodeValue = 'displayValueString'\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: { id: \"fakeId\" },\n displayValue: \"displayValueString\",\n },\n property: {\n typename: \"navigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"BisCore:B\",\n },\n navigationPropertyInfo: {\n classInfo: {\n name: \"BisCore:ModelContainsElements\",\n },\n },\n },\n },\n ],\n type: {\n typeName: \"long\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when category property and relational property added, return query string with property value, relational chain and with category joined\",\n expectedResult:\n \"SELECT BisCore.B.ECInstanceId, BisCore.B.ECClassId FROM BisCore.B JOIN BisCore.Category ON BisCore.Category.ECInstanceId = BisCore.GeometricElement3d.category.id WHERE ((BisCore.Category.CodeValue = 'displayValueString') OR (BisCore.Category.UserLabel = 'displayValueString'))\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n displayValue: \"displayValueString\",\n },\n property: {\n typename: \"navigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"BisCore:B\",\n },\n navigationPropertyInfo: {\n classInfo: {\n name: \"BisCore:GeometricElement3dIsInCategory\",\n },\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n ],\n};\n"]}
1
+ {"version":3,"file":"QueryBuilder.testdata.js","sourceRoot":"","sources":["../../../src/test/QueryBuilder.testdata.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,oEAAiE;AAGpD,QAAA,SAAS,GAAyB;IAC7C,SAAS,EAAE;QACT;YACE,IAAI,EAAE,6EAA6E;YACnF,cAAc,EAAE,4EAA4E;YAC5F,UAAU,EAAE;gBACV;oBACE,cAAc,EAAE,IAAI;oBACpB,aAAa,EAAE,aAAa;oBAC5B,mBAAmB,EAAE,yCAAmB,CAAC,UAAU;oBACnD,cAAc,EAAE;wBACd,KAAK,EAAE;4BACL,WAAW,EAAE,CAAC;4BACd,KAAK,EAAE,CAAC;yBACT;wBACD,QAAQ,EAAE;4BACR,QAAQ,EAAE,eAAe;4BACzB,IAAI,EAAE,cAAc;4BACpB,YAAY,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ACD,sBAAsB,EAAE;wCACtB,SAAS,EAAE;4CACT,IAAI,EAAE,+BAA+B;yCACtC;qCACF;iCACF;6BACF;yBACF;wBACD,IAAI,EAAE;4BACJ,QAAQ,EAAE,MAAM;yBACjB;wBACD,MAAM,EAAE;4BACN,kBAAkB,EAAE,EAAE;yBACvB;qBACF;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,0IAA0I;YAChJ,cAAc,EACZ,sRAAsR;YACxR,UAAU,EAAE;gBACV;oBACE,cAAc,EAAE,IAAI;oBACpB,aAAa,EAAE,aAAa;oBAC5B,mBAAmB,EAAE,yCAAmB,CAAC,UAAU;oBACnD,cAAc,EAAE;wBACd,KAAK,EAAE;4BACL,WAAW,EAAE,CAAC;4BACd,KAAK,EAAE,YAAY;4BACnB,YAAY,EAAE,oBAAoB;yBACnC;wBACD,QAAQ,EAAE;4BACR,QAAQ,EAAE,YAAY;4BACtB,IAAI,EAAE,cAAc;4BACpB,YAAY,EAAE,sBAAsB;yBACrC;qBACF;oBACD,eAAe,EAAE;wBACf,UAAU,EAAE;4BACV;gCACE,QAAQ,EAAE;oCACR,IAAI,EAAE,cAAc;oCACpB,SAAS,EAAE;wCACT,IAAI,EAAE,WAAW;qCAClB;oCACD,sBAAsB,EAAE;wCACtB,SAAS,EAAE;4CACT,IAAI,EAAE,wCAAwC;yCAC/C;qCACF;iCACF;6BACF;yBACF;wBACD,IAAI,EAAE;4BACJ,QAAQ,EAAE,QAAQ;yBACnB;wBACD,MAAM,EAAE;4BACN,kBAAkB,EAAE,EAAE;yBACvB;qBACF;iBACF;aACF;SACF;KACF;CACF,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 *--------------------------------------------------------------------------------------------*/\nimport { FieldDescriptorType } from \"@itwin/presentation-common\";\nimport type { QueryBuilderTestData } from \"./QueryBuilderTestData\";\n\nexport const testCases: QueryBuilderTestData = {\n testCases: [\n {\n name: \"when non-relational property added, return query string with property value\",\n expectedResult: \"SELECT A.B.ECInstanceId, A.B.ECClassId FROM A.B WHERE A.B.somePropName = 1\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: 1,\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"number\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when relational property added, return query string with property value and relation chain to it\",\n expectedResult:\n \"SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE A.B.somePropName = 'someString'\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n ],\n },\n {\n name: \"when multiple relational properties added, return query string with property values and relation chains to them\",\n expectedResult:\n \"SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN G.H ON Rel.BC.TargetECInstanceId = G.H.ECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE G.H.someOtherPropName = 'someOtherString' AND A.B.somePropName = 'someString'\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someOtherString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"otherPropertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"someOtherPropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"G:H\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"G:H\",\n },\n },\n },\n },\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n ],\n },\n {\n name: \"when relational property and non-relational property from one of relational chain classes added, return query string with property values and relation chain\",\n expectedResult:\n \"SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE A.B.somePropName = 'someString' AND A.C.SomeOtherPropName = 1\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"somePropName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:C\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: 1,\n },\n property: {\n typename: \"notNavigation\",\n name: \"SomeOtherPropName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"SomeOtherPropName\",\n classInfo: {\n name: \"A:C\",\n },\n },\n },\n ],\n type: {\n typeName: \"number\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when relational and non-relational property from the same class added, return query string with property values and relation chain\",\n expectedResult:\n \"SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE A.B.somePropName = 'someString' AND A.B.SomeOtherPropName = 1\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: 1,\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName2\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"SomeOtherPropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"number\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when non-relational property removed, return empty string\",\n expectedResult: \"\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n contentClassInfo: {\n name: \"sourceClassName\",\n },\n },\n },\n },\n {\n operationType: \"removeProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n contentClassInfo: {\n name: \"sourceClassName\",\n },\n },\n },\n },\n ],\n },\n {\n name: \"when relational property removed, return empty string\",\n expectedResult: \"\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n {\n operationType: \"removeProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n ],\n },\n {\n name: \"when non-relational property re-added after removing, return query string with property value\",\n expectedResult: \"SELECT A.B.ECInstanceId, A.B.ECClassId FROM A.B WHERE A.B.somePropName = 'someOtherString'\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n contentClassInfo: {\n name: \"sourceClassName\",\n },\n },\n },\n },\n {\n operationType: \"removeProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n contentClassInfo: {\n name: \"sourceClassName\",\n },\n },\n },\n },\n {\n operationType: \"addProperty\",\n expectedResult: true,\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someOtherString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n contentClassInfo: {\n name: \"sourceClassName\",\n },\n },\n },\n },\n ],\n },\n {\n name: \"when relational property re-added after removing, return query string with property value and relation chain to it\",\n expectedResult:\n \"SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE A.B.somePropName = 'someOtherString'\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n {\n operationType: \"removeProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someOtherString\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [\n {\n sourceClassInfo: {\n id: \"id1\",\n name: \"A:B\",\n label: \"AB label\",\n },\n targetClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n isPolymorphicTargetClass: true,\n relationshipInfo: {\n id: \"id3\",\n name: \"Rel:BC\",\n label: \"Relationship BC label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: false,\n },\n {\n sourceClassInfo: {\n id: \"id2\",\n name: \"A:C\",\n label: \"AC label\",\n },\n targetClassInfo: {\n id: \"id4\",\n name: \"Z:X\",\n label: \"ZX label\",\n },\n isPolymorphicTargetClass: false,\n relationshipInfo: {\n id: \"id5\",\n name: \"Rel:CX\",\n label: \"Relationship CX label\",\n },\n isPolymorphicRelationship: true,\n isForwardRelationship: true,\n },\n ],\n contentClassInfo: {\n name: \"A:B\",\n },\n },\n },\n },\n ],\n },\n {\n name: \"when no properties added, return empty string\",\n expectedResult: \"\",\n operations: [],\n },\n {\n name: \"when property is float, return query string with ROUND\",\n expectedResult: \"SELECT A.B.ECInstanceId, A.B.ECClassId FROM A.B WHERE ROUND(A.B.somePropName, 4) = 3.1416\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: 3.14159,\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"number\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when property needsQuotes, return query string with property value in quotes\",\n expectedResult: \"SELECT A.B.ECInstanceId, A.B.ECClassId FROM A.B WHERE A.B.somePropName = 'https://valueThatNeedsQuotes.com'\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"https://valueThatNeedsQuotes.com\",\n },\n property: {\n typename: \"notNavigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"A:B\",\n },\n },\n },\n ],\n type: {\n typeName: \"uri\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when property is category, return a category query string\",\n expectedResult:\n \"SELECT BisCore.B.ECInstanceId, BisCore.B.ECClassId FROM BisCore.B JOIN BisCore.Category ON BisCore.Category.ECInstanceId = BisCore.GeometricElement3d.category.id WHERE ((BisCore.Category.CodeValue = 'displayValueString') OR (BisCore.Category.UserLabel = 'displayValueString'))\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n displayValue: \"displayValueString\",\n },\n property: {\n typename: \"navigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"BisCore:B\",\n },\n navigationPropertyInfo: {\n classInfo: {\n name: \"BisCore:GeometricElement3dIsInCategory\",\n },\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when property is a model, return a model query string\",\n expectedResult:\n \"SELECT BisCore.B.ECInstanceId, BisCore.B.ECClassId FROM BisCore.B JOIN mockModeledElement ON mockModeledElement.ECInstanceId = BisCore.B.Model.id WHERE (mockModeledElement.UserLabel = 'displayValueString' OR mockModeledElement.CodeValue = 'displayValueString')\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: { id: \"fakeId\" },\n displayValue: \"displayValueString\",\n },\n property: {\n typename: \"navigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"BisCore:B\",\n },\n navigationPropertyInfo: {\n classInfo: {\n name: \"BisCore:ModelContainsElements\",\n },\n },\n },\n },\n ],\n type: {\n typeName: \"long\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n {\n name: \"when category property and relational property added, return query string with property value, relational chain and with category joined\",\n expectedResult:\n \"SELECT BisCore.B.ECInstanceId, BisCore.B.ECClassId FROM BisCore.B JOIN BisCore.Category ON BisCore.Category.ECInstanceId = BisCore.GeometricElement3d.category.id WHERE ((BisCore.Category.CodeValue = 'displayValueString') OR (BisCore.Category.UserLabel = 'displayValueString'))\",\n operations: [\n {\n expectedResult: true,\n operationType: \"addProperty\",\n fieldDescriptorType: FieldDescriptorType.Properties,\n propertyRecord: {\n value: {\n valueFormat: 0,\n value: \"someString\",\n displayValue: \"displayValueString\",\n },\n property: {\n typename: \"navigation\",\n name: \"propertyName\",\n displayLabel: \"propertyDisplayLabel\",\n },\n },\n propertiesField: {\n properties: [\n {\n property: {\n name: \"somePropName\",\n classInfo: {\n name: \"BisCore:B\",\n },\n navigationPropertyInfo: {\n classInfo: {\n name: \"BisCore:GeometricElement3dIsInCategory\",\n },\n },\n },\n },\n ],\n type: {\n typeName: \"string\",\n },\n parent: {\n pathToPrimaryClass: [],\n },\n },\n },\n ],\n },\n ],\n};\n"]}
@@ -109,7 +109,9 @@ export class QueryBuilder {
109
109
  this.addRelatedToQuery(i, propertiesField, propertyName, propertyValue);
110
110
  }
111
111
  else {
112
- this.addPropertyToQuery(i, className, propertyName, propertyValue, this.needsQuote(propertiesField), isCategory, modeledElement, isAspect);
112
+ // Model properties with display values always need quotes
113
+ const needsQuote = !!modeledElement || this.needsQuote(propertiesField);
114
+ this.addPropertyToQuery(i, className, propertyName, propertyValue, needsQuote, isCategory, modeledElement, isAspect);
113
115
  }
114
116
  }
115
117
  return true;
@@ -186,7 +188,13 @@ export class QueryBuilder {
186
188
  });
187
189
  return;
188
190
  }
189
- const foundPropertyClass = this.query.unions[unionIndex].properties.find((p) => p.className === className);
191
+ // Model properties should be kept separate to ensure proper JOIN generation
192
+ const foundPropertyClass = this.query.unions[unionIndex].properties.find((p) => {
193
+ // Don't merge Model properties with regular properties
194
+ if (!!modeledElementClass !== !!p.modeledElementClass)
195
+ return false;
196
+ return p.className === className;
197
+ });
190
198
  if (foundPropertyClass) {
191
199
  const foundJoin = foundPropertyClass?.classProperties.find((join) => join.name === propertyName);
192
200
  if (foundJoin) {
@@ -222,8 +230,8 @@ export class QueryBuilder {
222
230
  continue;
223
231
  }
224
232
  else if (property.modeledElementClass) {
225
- querySegments.set(property.modeledElementClass, [`${property.modeledElementClass}.ECInstanceId = BisCore.Element.Model.id`]);
226
- whereSegments.push(`${property.modeledElementClass}.UserLabel = '${property.classProperties[0].value.toString()}' OR ${property.modeledElementClass}.CodeValue = '${property.classProperties[0].value.toString()}'`);
233
+ querySegments.set(property.modeledElementClass, [`${property.modeledElementClass}.ECInstanceId = ${baseClassName}.Model.id`]);
234
+ whereSegments.push(`(${property.modeledElementClass}.UserLabel = '${property.classProperties[0].value.toString()}' OR ${property.modeledElementClass}.CodeValue = '${property.classProperties[0].value.toString()}')`);
227
235
  continue;
228
236
  }
229
237
  const joinIdName = property.isAspect ? `${property.className}.Element.id` : `${property.className}.ECInstanceId`;
@@ -240,7 +248,8 @@ export class QueryBuilder {
240
248
  const whereClause = `WHERE ${whereSegments.join(" AND ")}`;
241
249
  unionSegments.push([selectClause, ...joinClauses, whereClause].join(" "));
242
250
  }
243
- return unionSegments.join(" UNION ");
251
+ const result = unionSegments.join(" UNION ");
252
+ return result;
244
253
  }
245
254
  selectClause(baseProperty, baseClass) {
246
255
  if (baseClass) {
@@ -1 +1 @@
1
- {"version":3,"file":"QueryBuilder.js","sourceRoot":"","sources":["../../../../../src/components/Groups/QueryBuilder/QueryBuilder.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AA0CjD,4FAA4F;AAC5F,MAAM,OAAO,YAAY;IAMvB,YACmB,YAA8C,EAC9C,gBAAkC;QADlC,iBAAY,GAAZ,YAAY,CAAkC;QAC9C,qBAAgB,GAAhB,gBAAgB,CAAkB;QAwB7C,iBAAY,GAA+B,IAAI,GAAG,EAAE,CAAC;QAEtD,sBAAiB,GAAG,GAAG,EAAE;YAC9B,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;QAChC,CAAC,CAAC;QAEM,oBAAe,GAAG,KAAK,IAAI,EAAE;YACnC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;YAEvB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE;gBACjD,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;aAC7E;QACH,CAAC,CAAC;QA2QM,2BAAsB,GAAG,CAAC,OAAqB,EAAE,aAAoC,EAAyB,EAAE;YACtH,KAAK,MAAM,UAAU,IAAI,OAAO,EAAE;gBAChC,K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CAAC,GAAG,CAAC,CAAC,CAAC;SAC3E;QAED,OAAO,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAEO,YAAY,CAAC,YAAuC,EAAE,SAAiC;QAC7F,IAAI,SAAS,EAAE;YACb,OAAO,UAAU,SAAS,CAAC,SAAS,kBAAkB,SAAS,CAAC,SAAS,mBAAmB,SAAS,CAAC,SAAS,EAAE,CAAC;SACnH;QAED,IAAI,YAAY,EAAE;YAChB,MAAM,UAAU,GAAG,YAAY,CAAC,QAAQ;gBACtC,CAAC,CAAC,GAAG,YAAY,CAAC,SAAS,0BAA0B;gBACrD,CAAC,CAAC,GAAG,YAAY,CAAC,SAAS,kBAAkB,YAAY,CAAC,SAAS,YAAY,CAAC;YAElF,OAAO,UAAU,UAAU,SAAS,YAAY,CAAC,SAAS,EAAE,CAAC;SAC9D;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IA4BO,kBAAkB,CAAC,SAAiB;QAC1C,OAAO,mCAAmC,SAAS,wCAAwC,SAAS,KAAK,CAAC;IAC5G,CAAC;IAEO,OAAO,CAAC,CAAU;QACxB,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;;AAtVuB,uCAA0B,GAAG,iCAAiC,CAAC;AAC/D,wCAA2B,GAAG,iCAAiC,CAAC;AAChE,qCAAwB,GAAG,CAAC,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 *--------------------------------------------------------------------------------------------*/\nimport type { PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\nimport type { InstanceKey, NavigationPropertyValue, PropertiesField } from \"@itwin/presentation-common\";\nimport type { Primitives, PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { toaster } from \"@itwin/itwinui-react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { QueryBinder } from \"@itwin/core-common\";\n\nexport interface Query {\n unions: QueryUnion[];\n}\n\nexport interface QueryUnion {\n classes: QueryClass[];\n properties: QueryProperty[];\n}\n\nexport interface QueryClass {\n // schemaName.className\n className: string;\n classJoins: ClassJoin[];\n}\n\nexport interface ClassJoin {\n classProperty: string;\n joinClassName: string;\n joinClassProperty: string;\n}\n\nexport interface QueryProperty {\n className: string;\n classProperties: ClassProperty[];\n isCategory: boolean;\n modeledElementClass?: string;\n isAspect: boolean;\n}\n\nexport interface ClassProperty {\n name: string;\n value: Primitives.Value;\n needsQuote: boolean;\n}\n\nexport interface AddedProperty {\n propertyRecord: PropertyRecord;\n propertiesField: PropertiesField;\n}\n\n/* This class is to build adaptive and dynamic query for find similar property selections */\nexport class QueryBuilder {\n private static readonly MULTI_ASPECT_PRIMARY_CLASS = \"BisCore:ElementOwnsMultiAspects\";\n private static readonly UNIQUE_ASPECT_PRIMARY_CLASS = \"BisCore:ElementOwnsUniqueAspect\";\n private static readonly DEFAULT_DOUBLE_PRECISION = 4;\n private query: Query | undefined;\n\n constructor(\n private readonly dataProvider: PresentationPropertyDataProvider,\n private readonly iModelConnection: IModelConnection,\n ) {}\n\n private isCategory(propertyField: PropertiesField): boolean {\n const classInfo = propertyField.properties[0].property.navigationPropertyInfo?.classInfo;\n return classInfo?.name === \"BisCore:GeometricElement3dIsInCategory\";\n }\n\n private async getPotentialModeledElement(propertyField: PropertiesField, propertyRecord: PropertyRecord): Promise<string | undefined> {\n const classInfo = propertyField.properties[0].property.navigationPropertyInfo?.classInfo;\n if (propertyRecord.value?.valueFormat !== PropertyValueFormat.Primitive) return;\n const navigationPropertyValue = propertyRecord.value.value as NavigationPropertyValue;\n if (classInfo?.name === \"BisCore:ModelContainsElements\") {\n // https://www.itwinjs.org/bis/guide/fundamentals/model-fundamentals/#model-identity\n // Lookup the modeled element as they share the same ECInstanceId\n const modeledElementQuery = `SELECT ec_classname(ecclassid) FROM biscore.element WHERE ecinstanceid = ? LIMIT 1`;\n const queryBinder = new QueryBinder();\n queryBinder.bindString(1, navigationPropertyValue.id);\n const modeledElement = (await this.iModelConnection.createQueryReader(modeledElementQuery, queryBinder).next()).value[0];\n return modeledElement.replace(\":\", \".\");\n }\n return;\n }\n\n private _propertyMap: Map<string, AddedProperty> = new Map();\n\n public resetQueryBuilder = () => {\n this._propertyMap = new Map();\n };\n\n private regenerateQuery = async () => {\n this.query = undefined;\n\n for (const property of this._propertyMap.values()) {\n await this.buildProperty(property.propertyRecord, property.propertiesField);\n }\n };\n\n public async addProperty(prop: PropertyRecord): Promise<boolean> {\n // TODO: only handle primitive properties now\n if (prop.value?.valueFormat !== PropertyValueFormat.Primitive) {\n toaster.warning(\"Only primitive types are supported for now.\");\n return false;\n }\n if (prop.value.value === undefined) {\n return false;\n }\n\n const propertyField = (await this.dataProvider.getFieldByPropertyRecord(prop)) as PropertiesField;\n\n if (!propertyField) {\n toaster.negative(\"Error. Failed to fetch field for this property record.\");\n return false;\n }\n\n this._propertyMap.set(JSON.stringify(propertyField.getFieldDescriptor()), { propertyRecord: prop, propertiesField: propertyField });\n return true;\n }\n\n public async removeProperty(prop: PropertyRecord) {\n const propertyField = (await this.dataProvider.getFieldByPropertyRecord(prop)) as PropertiesField;\n\n this._propertyMap.delete(JSON.stringify(propertyField.getFieldDescriptor()));\n }\n\n private async buildProperty(prop: PropertyRecord, propertiesField: PropertiesField) {\n if (prop.value?.valueFormat !== PropertyValueFormat.Primitive || prop.value.value === undefined) {\n toaster.negative(\"Error. An unexpected error has occured while building a query.\");\n return;\n }\n\n function replaceAll(str: string, match: string, replacement: string) {\n return str.split(match).join(replacement);\n }\n // if property value has single quote, escape\n if ((typeof prop.value.value === \"string\" || prop.value.value instanceof String) && String(prop.value.value).indexOf(\"'\") >= 0) {\n prop.value.value = replaceAll(prop.value.value.toString(), \"'\", \"''\");\n }\n\n const pathToPrimaryClass = propertiesField.parent?.pathToPrimaryClass;\n\n // get the special cases\n const isNavigation: boolean = prop.property.typename.toLowerCase() === \"navigation\";\n const isCategory: boolean = isNavigation && this.isCategory(propertiesField);\n const modeledElement = await this.getPotentialModeledElement(propertiesField, prop);\n\n const isAspect: boolean =\n pathToPrimaryClass?.find(\n (a) => a.relationshipInfo?.name === QueryBuilder.UNIQUE_ASPECT_PRIMARY_CLASS || a.relationshipInfo?.name === QueryBuilder.MULTI_ASPECT_PRIMARY_CLASS,\n ) !== undefined;\n\n for (let i = 0; i < propertiesField.properties.length; i++) {\n const property = propertiesField.properties[i].property;\n\n const className = property.classInfo.name.replace(\":\", \".\");\n const propertyName = isNavigation ? (isCategory || modeledElement ? `${property.name}.CodeValue` : `${property.name}.id`) : property.name;\n const propertyValue = isNavigation\n ? isCategory || modeledElement\n ? prop.value.displayValue ?? \"\"\n : (prop.value.value as InstanceKey).id\n : prop.value.value;\n\n if (!isAspect && pathToPrimaryClass && pathToPrimaryClass.length > 0) {\n this.addRelatedToQuery(i, propertiesField, propertyName, propertyValue);\n } else {\n this.addPropertyToQuery(i, className, propertyName, propertyValue, this.needsQuote(propertiesField), isCategory, modeledElement, isAspect);\n }\n }\n return true;\n }\n\n private needsQuote(propertyField: PropertiesField): boolean {\n // list of property types that need quote around property value\n const typeName = propertyField.type.typeName.toLowerCase();\n return \"string\" === typeName || \"uri\" === typeName;\n }\n\n private addRelatedToQuery(unionIndex: number, propertyField: PropertiesField, propertyName: string, propertyValue: Primitives.Value) {\n const paths = [...(propertyField.parent?.pathToPrimaryClass ?? [])];\n paths.reverse().forEach((path) => {\n const sourceClassName = path.sourceClassInfo?.name.replace(\":\", \".\");\n const targetClassName = path.targetClassInfo?.name.replace(\":\", \".\");\n const relClassName = path.relationshipInfo?.name.replace(\":\", \".\");\n\n const relClassProperty = path.isForwardRelationship ? `SourceECInstanceId` : `TargetECInstanceId`;\n\n const relPropertyValue = path.isForwardRelationship ? `TargetECInstanceId` : `SourceECInstanceId`;\n\n this.addClassToQuery(unionIndex, targetClassName, `ECInstanceId`, relClassName, relPropertyValue);\n\n this.addClassToQuery(unionIndex, relClassName, relClassProperty, sourceClassName, `ECInstanceId`);\n\n if (path.sourceClassInfo?.name === propertyField.parent?.contentClassInfo.name) {\n this.addPropertyToQuery(unionIndex, sourceClassName, propertyName, propertyValue, this.needsQuote(propertyField), false, \"\", false);\n }\n });\n }\n\n private addClassToQuery(unionIndex: number, className: string, classProperty: string, joinClassName: string, joinClassProperty: string) {\n if (this.query === undefined) {\n this.query = { unions: [] };\n }\n\n const classJoin: ClassJoin = {\n classProperty,\n joinClassName,\n joinClassProperty,\n };\n\n const queryClass: QueryClass = {\n className,\n classJoins: [classJoin],\n };\n\n if (this.query.unions.length <= unionIndex) {\n this.query.unions.push({\n classes: [queryClass],\n properties: [],\n });\n return;\n }\n\n const foundClass = this.query.unions[unionIndex].classes.find((c) => c.className === className);\n\n if (foundClass) {\n const foundJoin = foundClass.classJoins.find(\n (join) => join.classProperty === classProperty && join.joinClassName === joinClassName && join.joinClassProperty === joinClassProperty,\n );\n\n if (!foundJoin) foundClass.classJoins.push(classJoin);\n return;\n }\n\n this.query.unions[unionIndex].classes.push(queryClass);\n }\n\n private addPropertyToQuery(\n unionIndex: number,\n className: string,\n propertyName: string,\n propertyValue: Primitives.Value,\n needsQuote: boolean,\n isCategory: boolean,\n modeledElementClass: string | undefined,\n isAspect: boolean,\n ) {\n if (this.query === undefined) {\n this.query = { unions: [] };\n }\n\n const queryJoin: ClassProperty = {\n name: propertyName,\n value: propertyValue,\n needsQuote,\n };\n\n const queryProperty: QueryProperty = {\n className,\n isCategory,\n modeledElementClass,\n isAspect,\n classProperties: [queryJoin],\n };\n\n if (this.query.unions.length <= unionIndex) {\n this.query.unions.push({\n classes: [],\n properties: [queryProperty],\n });\n return;\n }\n\n const foundPropertyClass = this.query.unions[unionIndex].properties.find((p) => p.className === className);\n\n if (foundPropertyClass) {\n const foundJoin = foundPropertyClass?.classProperties.find((join) => join.name === propertyName);\n\n if (foundJoin) {\n foundJoin.value = propertyValue;\n return;\n }\n\n foundPropertyClass.classProperties.push(queryJoin);\n return;\n }\n\n this.query.unions[unionIndex].properties.push(queryProperty);\n }\n\n public async buildQueryString() {\n await this.regenerateQuery();\n if (this.query === undefined || this.query.unions.find((u) => u.classes.length === 0 && u.properties.length === 0)) {\n return \"\";\n }\n\n const unionSegments: string[] = [];\n for (const union of this.query.unions) {\n const baseClass = union.classes[0];\n const baseProperty = union.properties[0];\n const baseClassName = baseClass ? baseClass.className : baseProperty?.className;\n const baseIdName = `${baseClassName}.ECInstanceId`;\n\n const selectClause = this.selectClause(baseProperty, baseClass);\n\n let querySegments: Map<string, string[]> = new Map();\n querySegments = this.relationalJoinSegments(union.classes, querySegments);\n\n const whereSegments: string[] = [];\n for (const property of union.properties) {\n if (property.isCategory) {\n if (property.className !== baseClassName)\n querySegments.set(\"BisCore.GeometricElement3d\", [`BisCore.GeometricElement3d.ECInstanceId = ${baseIdName}`]);\n\n querySegments.set(\"BisCore.Category\", [`BisCore.Category.ECInstanceId = BisCore.GeometricElement3d.category.id`]);\n whereSegments.push(this.categoryWhereQuery(property.classProperties[0].value.toString()));\n continue;\n } else if (property.modeledElementClass) {\n querySegments.set(property.modeledElementClass, [`${property.modeledElementClass}.ECInstanceId = BisCore.Element.Model.id`]);\n whereSegments.push(\n `${property.modeledElementClass}.UserLabel = '${property.classProperties[0].value.toString()}' OR ${property.modeledElementClass}.CodeValue = '${property.classProperties[0].value.toString()}'`,\n );\n continue;\n }\n\n const joinIdName = property.isAspect ? `${property.className}.Element.id` : `${property.className}.ECInstanceId`;\n\n if (!querySegments.has(property.className) && property.className !== baseClassName)\n querySegments.set(property.className, [`${joinIdName} = ${baseIdName}`]);\n\n for (const prop of property.classProperties) {\n whereSegments.push(this.propertyQuerySegment(property.className, prop, prop.needsQuote));\n }\n }\n\n const joinClauses: string[] = [];\n for (const key of querySegments.keys()) {\n joinClauses.push(`JOIN ${key} ON ${querySegments.get(key)?.join(\" AND \")}`);\n }\n\n const whereClause = `WHERE ${whereSegments.join(\" AND \")}`;\n\n unionSegments.push([selectClause, ...joinClauses, whereClause].join(\" \"));\n }\n\n return unionSegments.join(\" UNION \");\n }\n\n private selectClause(baseProperty: QueryProperty | undefined, baseClass: QueryClass | undefined) {\n if (baseClass) {\n return `SELECT ${baseClass.className}.ECInstanceId, ${baseClass.className}.ECClassId FROM ${baseClass.className}`;\n }\n\n if (baseProperty) {\n const baseIdName = baseProperty.isAspect\n ? `${baseProperty.className}.Element.id ECInstanceId`\n : `${baseProperty.className}.ECInstanceId, ${baseProperty.className}.ECClassId`;\n\n return `SELECT ${baseIdName} FROM ${baseProperty.className}`;\n }\n\n return \"\";\n }\n\n private relationalJoinSegments = (classes: QueryClass[], querySegments: Map<string, string[]>): Map<string, string[]> => {\n for (const queryClass of classes) {\n for (const classJoin of queryClass.classJoins) {\n const querySegment = [\n ...(querySegments.get(classJoin.joinClassName) ?? []),\n `${queryClass.className}.${classJoin.classProperty} = ${classJoin.joinClassName}.${classJoin.joinClassProperty}`,\n ];\n querySegments.set(classJoin.joinClassName, querySegment);\n }\n }\n\n return querySegments;\n };\n\n private propertyQuerySegment = (className: string, property: ClassProperty, needsQuote: boolean): string => {\n if (this.isFloat(property.value))\n return (\n `ROUND(${className}.${property.name}, ` +\n `${QueryBuilder.DEFAULT_DOUBLE_PRECISION}) = ` +\n `${Number(property.value).toFixed(QueryBuilder.DEFAULT_DOUBLE_PRECISION)}`\n );\n\n const propertyValue = needsQuote ? `'${property.value}'` : property.value;\n return `${className}.${property.name} = ${propertyValue}`;\n };\n\n private categoryWhereQuery(codeValue: string): string {\n return `((BisCore.Category.CodeValue = '${codeValue}') OR (BisCore.Category.UserLabel = '${codeValue}'))`;\n }\n\n private isFloat(n: unknown): boolean {\n return Number(n) === n && n % 1 !== 0;\n }\n}\n"]}
1
+ {"version":3,"file":"QueryBuilder.js","sourceRoot":"","sources":["../../../../../src/components/Groups/QueryBuilder/QueryBuilder.ts"],"names":[],"mappings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YAAY,CAAC,YAAuC,EAAE,SAAiC;QAC7F,IAAI,SAAS,EAAE;YACb,OAAO,UAAU,SAAS,CAAC,SAAS,kBAAkB,SAAS,CAAC,SAAS,mBAAmB,SAAS,CAAC,SAAS,EAAE,CAAC;SACnH;QAED,IAAI,YAAY,EAAE;YAChB,MAAM,UAAU,GAAG,YAAY,CAAC,QAAQ;gBACtC,CAAC,CAAC,GAAG,YAAY,CAAC,SAAS,0BAA0B;gBACrD,CAAC,CAAC,GAAG,YAAY,CAAC,SAAS,kBAAkB,YAAY,CAAC,SAAS,YAAY,CAAC;YAElF,OAAO,UAAU,UAAU,SAAS,YAAY,CAAC,SAAS,EAAE,CAAC;SAC9D;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IA4BO,kBAAkB,CAAC,SAAiB;QAC1C,OAAO,mCAAmC,SAAS,wCAAwC,SAAS,KAAK,CAAC;IAC5G,CAAC;IAEO,OAAO,CAAC,CAAU;QACxB,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;;AA7VuB,uCAA0B,GAAG,iCAAiC,CAAC;AAC/D,wCAA2B,GAAG,iCAAiC,CAAC;AAChE,qCAAwB,GAAG,CAAC,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 *--------------------------------------------------------------------------------------------*/\nimport type { PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\nimport type { InstanceKey, NavigationPropertyValue, PropertiesField } from \"@itwin/presentation-common\";\nimport type { Primitives, PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { toaster } from \"@itwin/itwinui-react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { QueryBinder } from \"@itwin/core-common\";\n\nexport interface Query {\n unions: QueryUnion[];\n}\n\nexport interface QueryUnion {\n classes: QueryClass[];\n properties: QueryProperty[];\n}\n\nexport interface QueryClass {\n // schemaName.className\n className: string;\n classJoins: ClassJoin[];\n}\n\nexport interface ClassJoin {\n classProperty: string;\n joinClassName: string;\n joinClassProperty: string;\n}\n\nexport interface QueryProperty {\n className: string;\n classProperties: ClassProperty[];\n isCategory: boolean;\n modeledElementClass?: string;\n isAspect: boolean;\n}\n\nexport interface ClassProperty {\n name: string;\n value: Primitives.Value;\n needsQuote: boolean;\n}\n\nexport interface AddedProperty {\n propertyRecord: PropertyRecord;\n propertiesField: PropertiesField;\n}\n\n/* This class is to build adaptive and dynamic query for find similar property selections */\nexport class QueryBuilder {\n private static readonly MULTI_ASPECT_PRIMARY_CLASS = \"BisCore:ElementOwnsMultiAspects\";\n private static readonly UNIQUE_ASPECT_PRIMARY_CLASS = \"BisCore:ElementOwnsUniqueAspect\";\n private static readonly DEFAULT_DOUBLE_PRECISION = 4;\n private query: Query | undefined;\n\n constructor(\n private readonly dataProvider: PresentationPropertyDataProvider,\n private readonly iModelConnection: IModelConnection,\n ) {}\n\n private isCategory(propertyField: PropertiesField): boolean {\n const classInfo = propertyField.properties[0].property.navigationPropertyInfo?.classInfo;\n return classInfo?.name === \"BisCore:GeometricElement3dIsInCategory\";\n }\n\n private async getPotentialModeledElement(propertyField: PropertiesField, propertyRecord: PropertyRecord): Promise<string | undefined> {\n const classInfo = propertyField.properties[0].property.navigationPropertyInfo?.classInfo;\n if (propertyRecord.value?.valueFormat !== PropertyValueFormat.Primitive) return;\n const navigationPropertyValue = propertyRecord.value.value as NavigationPropertyValue;\n if (classInfo?.name === \"BisCore:ModelContainsElements\") {\n // https://www.itwinjs.org/bis/guide/fundamentals/model-fundamentals/#model-identity\n // Lookup the modeled element as they share the same ECInstanceId\n const modeledElementQuery = `SELECT ec_classname(ecclassid) FROM biscore.element WHERE ecinstanceid = ? LIMIT 1`;\n const queryBinder = new QueryBinder();\n queryBinder.bindString(1, navigationPropertyValue.id);\n const modeledElement = (await this.iModelConnection.createQueryReader(modeledElementQuery, queryBinder).next()).value[0];\n return modeledElement.replace(\":\", \".\");\n }\n return;\n }\n\n private _propertyMap: Map<string, AddedProperty> = new Map();\n\n public resetQueryBuilder = () => {\n this._propertyMap = new Map();\n };\n\n private regenerateQuery = async () => {\n this.query = undefined;\n\n for (const property of this._propertyMap.values()) {\n await this.buildProperty(property.propertyRecord, property.propertiesField);\n }\n };\n\n public async addProperty(prop: PropertyRecord): Promise<boolean> {\n // TODO: only handle primitive properties now\n if (prop.value?.valueFormat !== PropertyValueFormat.Primitive) {\n toaster.warning(\"Only primitive types are supported for now.\");\n return false;\n }\n if (prop.value.value === undefined) {\n return false;\n }\n\n const propertyField = (await this.dataProvider.getFieldByPropertyRecord(prop)) as PropertiesField;\n\n if (!propertyField) {\n toaster.negative(\"Error. Failed to fetch field for this property record.\");\n return false;\n }\n\n this._propertyMap.set(JSON.stringify(propertyField.getFieldDescriptor()), { propertyRecord: prop, propertiesField: propertyField });\n return true;\n }\n\n public async removeProperty(prop: PropertyRecord) {\n const propertyField = (await this.dataProvider.getFieldByPropertyRecord(prop)) as PropertiesField;\n\n this._propertyMap.delete(JSON.stringify(propertyField.getFieldDescriptor()));\n }\n\n private async buildProperty(prop: PropertyRecord, propertiesField: PropertiesField) {\n if (prop.value?.valueFormat !== PropertyValueFormat.Primitive || prop.value.value === undefined) {\n toaster.negative(\"Error. An unexpected error has occured while building a query.\");\n return;\n }\n\n function replaceAll(str: string, match: string, replacement: string) {\n return str.split(match).join(replacement);\n }\n // if property value has single quote, escape\n if ((typeof prop.value.value === \"string\" || prop.value.value instanceof String) && String(prop.value.value).indexOf(\"'\") >= 0) {\n prop.value.value = replaceAll(prop.value.value.toString(), \"'\", \"''\");\n }\n\n const pathToPrimaryClass = propertiesField.parent?.pathToPrimaryClass;\n\n // get the special cases\n const isNavigation: boolean = prop.property.typename.toLowerCase() === \"navigation\";\n const isCategory: boolean = isNavigation && this.isCategory(propertiesField);\n const modeledElement = await this.getPotentialModeledElement(propertiesField, prop);\n\n const isAspect: boolean =\n pathToPrimaryClass?.find(\n (a) => a.relationshipInfo?.name === QueryBuilder.UNIQUE_ASPECT_PRIMARY_CLASS || a.relationshipInfo?.name === QueryBuilder.MULTI_ASPECT_PRIMARY_CLASS,\n ) !== undefined;\n\n for (let i = 0; i < propertiesField.properties.length; i++) {\n const property = propertiesField.properties[i].property;\n\n const className = property.classInfo.name.replace(\":\", \".\");\n const propertyName = isNavigation ? (isCategory || modeledElement ? `${property.name}.CodeValue` : `${property.name}.id`) : property.name;\n const propertyValue = isNavigation\n ? isCategory || modeledElement\n ? prop.value.displayValue ?? \"\"\n : (prop.value.value as InstanceKey).id\n : prop.value.value;\n\n if (!isAspect && pathToPrimaryClass && pathToPrimaryClass.length > 0) {\n this.addRelatedToQuery(i, propertiesField, propertyName, propertyValue);\n } else {\n // Model properties with display values always need quotes\n const needsQuote = !!modeledElement || this.needsQuote(propertiesField);\n this.addPropertyToQuery(i, className, propertyName, propertyValue, needsQuote, isCategory, modeledElement, isAspect);\n }\n }\n return true;\n }\n\n private needsQuote(propertyField: PropertiesField): boolean {\n // list of property types that need quote around property value\n const typeName = propertyField.type.typeName.toLowerCase();\n return \"string\" === typeName || \"uri\" === typeName;\n }\n\n private addRelatedToQuery(unionIndex: number, propertyField: PropertiesField, propertyName: string, propertyValue: Primitives.Value) {\n const paths = [...(propertyField.parent?.pathToPrimaryClass ?? [])];\n paths.reverse().forEach((path) => {\n const sourceClassName = path.sourceClassInfo?.name.replace(\":\", \".\");\n const targetClassName = path.targetClassInfo?.name.replace(\":\", \".\");\n const relClassName = path.relationshipInfo?.name.replace(\":\", \".\");\n\n const relClassProperty = path.isForwardRelationship ? `SourceECInstanceId` : `TargetECInstanceId`;\n\n const relPropertyValue = path.isForwardRelationship ? `TargetECInstanceId` : `SourceECInstanceId`;\n\n this.addClassToQuery(unionIndex, targetClassName, `ECInstanceId`, relClassName, relPropertyValue);\n\n this.addClassToQuery(unionIndex, relClassName, relClassProperty, sourceClassName, `ECInstanceId`);\n\n if (path.sourceClassInfo?.name === propertyField.parent?.contentClassInfo.name) {\n this.addPropertyToQuery(unionIndex, sourceClassName, propertyName, propertyValue, this.needsQuote(propertyField), false, \"\", false);\n }\n });\n }\n\n private addClassToQuery(unionIndex: number, className: string, classProperty: string, joinClassName: string, joinClassProperty: string) {\n if (this.query === undefined) {\n this.query = { unions: [] };\n }\n\n const classJoin: ClassJoin = {\n classProperty,\n joinClassName,\n joinClassProperty,\n };\n\n const queryClass: QueryClass = {\n className,\n classJoins: [classJoin],\n };\n\n if (this.query.unions.length <= unionIndex) {\n this.query.unions.push({\n classes: [queryClass],\n properties: [],\n });\n return;\n }\n\n const foundClass = this.query.unions[unionIndex].classes.find((c) => c.className === className);\n\n if (foundClass) {\n const foundJoin = foundClass.classJoins.find(\n (join) => join.classProperty === classProperty && join.joinClassName === joinClassName && join.joinClassProperty === joinClassProperty,\n );\n\n if (!foundJoin) foundClass.classJoins.push(classJoin);\n return;\n }\n\n this.query.unions[unionIndex].classes.push(queryClass);\n }\n\n private addPropertyToQuery(\n unionIndex: number,\n className: string,\n propertyName: string,\n propertyValue: Primitives.Value,\n needsQuote: boolean,\n isCategory: boolean,\n modeledElementClass: string | undefined,\n isAspect: boolean,\n ) {\n if (this.query === undefined) {\n this.query = { unions: [] };\n }\n\n const queryJoin: ClassProperty = {\n name: propertyName,\n value: propertyValue,\n needsQuote,\n };\n\n const queryProperty: QueryProperty = {\n className,\n isCategory,\n modeledElementClass,\n isAspect,\n classProperties: [queryJoin],\n };\n\n if (this.query.unions.length <= unionIndex) {\n this.query.unions.push({\n classes: [],\n properties: [queryProperty],\n });\n return;\n }\n\n // Model properties should be kept separate to ensure proper JOIN generation\n const foundPropertyClass = this.query.unions[unionIndex].properties.find((p) => {\n // Don't merge Model properties with regular properties\n if (!!modeledElementClass !== !!p.modeledElementClass) return false;\n return p.className === className;\n });\n\n if (foundPropertyClass) {\n const foundJoin = foundPropertyClass?.classProperties.find((join) => join.name === propertyName);\n\n if (foundJoin) {\n foundJoin.value = propertyValue;\n return;\n }\n\n foundPropertyClass.classProperties.push(queryJoin);\n return;\n }\n\n this.query.unions[unionIndex].properties.push(queryProperty);\n }\n\n public async buildQueryString() {\n await this.regenerateQuery();\n if (this.query === undefined || this.query.unions.find((u) => u.classes.length === 0 && u.properties.length === 0)) {\n return \"\";\n }\n\n const unionSegments: string[] = [];\n for (const union of this.query.unions) {\n const baseClass = union.classes[0];\n const baseProperty = union.properties[0];\n const baseClassName = baseClass ? baseClass.className : baseProperty?.className;\n const baseIdName = `${baseClassName}.ECInstanceId`;\n\n const selectClause = this.selectClause(baseProperty, baseClass);\n\n let querySegments: Map<string, string[]> = new Map();\n querySegments = this.relationalJoinSegments(union.classes, querySegments);\n\n const whereSegments: string[] = [];\n for (const property of union.properties) {\n if (property.isCategory) {\n if (property.className !== baseClassName)\n querySegments.set(\"BisCore.GeometricElement3d\", [`BisCore.GeometricElement3d.ECInstanceId = ${baseIdName}`]);\n\n querySegments.set(\"BisCore.Category\", [`BisCore.Category.ECInstanceId = BisCore.GeometricElement3d.category.id`]);\n whereSegments.push(this.categoryWhereQuery(property.classProperties[0].value.toString()));\n continue;\n } else if (property.modeledElementClass) {\n querySegments.set(property.modeledElementClass, [`${property.modeledElementClass}.ECInstanceId = ${baseClassName}.Model.id`]);\n whereSegments.push(\n `(${property.modeledElementClass}.UserLabel = '${property.classProperties[0].value.toString()}' OR ${property.modeledElementClass}.CodeValue = '${property.classProperties[0].value.toString()}')`,\n );\n continue;\n }\n\n const joinIdName = property.isAspect ? `${property.className}.Element.id` : `${property.className}.ECInstanceId`;\n\n if (!querySegments.has(property.className) && property.className !== baseClassName)\n querySegments.set(property.className, [`${joinIdName} = ${baseIdName}`]);\n\n for (const prop of property.classProperties) {\n whereSegments.push(this.propertyQuerySegment(property.className, prop, prop.needsQuote));\n }\n }\n\n const joinClauses: string[] = [];\n for (const key of querySegments.keys()) {\n joinClauses.push(`JOIN ${key} ON ${querySegments.get(key)?.join(\" AND \")}`);\n }\n\n const whereClause = `WHERE ${whereSegments.join(\" AND \")}`;\n\n unionSegments.push([selectClause, ...joinClauses, whereClause].join(\" \"));\n }\n const result = unionSegments.join(\" UNION \");\n return result;\n }\n\n private selectClause(baseProperty: QueryProperty | undefined, baseClass: QueryClass | undefined) {\n if (baseClass) {\n return `SELECT ${baseClass.className}.ECInstanceId, ${baseClass.className}.ECClassId FROM ${baseClass.className}`;\n }\n\n if (baseProperty) {\n const baseIdName = baseProperty.isAspect\n ? `${baseProperty.className}.Element.id ECInstanceId`\n : `${baseProperty.className}.ECInstanceId, ${baseProperty.className}.ECClassId`;\n\n return `SELECT ${baseIdName} FROM ${baseProperty.className}`;\n }\n\n return \"\";\n }\n\n private relationalJoinSegments = (classes: QueryClass[], querySegments: Map<string, string[]>): Map<string, string[]> => {\n for (const queryClass of classes) {\n for (const classJoin of queryClass.classJoins) {\n const querySegment = [\n ...(querySegments.get(classJoin.joinClassName) ?? []),\n `${queryClass.className}.${classJoin.classProperty} = ${classJoin.joinClassName}.${classJoin.joinClassProperty}`,\n ];\n querySegments.set(classJoin.joinClassName, querySegment);\n }\n }\n\n return querySegments;\n };\n\n private propertyQuerySegment = (className: string, property: ClassProperty, needsQuote: boolean): string => {\n if (this.isFloat(property.value))\n return (\n `ROUND(${className}.${property.name}, ` +\n `${QueryBuilder.DEFAULT_DOUBLE_PRECISION}) = ` +\n `${Number(property.value).toFixed(QueryBuilder.DEFAULT_DOUBLE_PRECISION)}`\n );\n\n const propertyValue = needsQuote ? `'${property.value}'` : property.value;\n return `${className}.${property.name} = ${propertyValue}`;\n };\n\n private categoryWhereQuery(codeValue: string): string {\n return `((BisCore.Category.CodeValue = '${codeValue}') OR (BisCore.Category.UserLabel = '${codeValue}'))`;\n }\n\n private isFloat(n: unknown): boolean {\n return Number(n) === n && n % 1 !== 0;\n }\n}\n"]}
@@ -100,8 +100,12 @@ export const convertPresentationFields = (propertyFields) => {
100
100
  propertyFields.forEach((property) => {
101
101
  switch (property.type.valueFormat) {
102
102
  case PropertyValueFormat.Primitive: {
103
+ const propertiesField = property;
104
+ if (!propertiesField.properties) {
105
+ return;
106
+ }
103
107
  // Generate base ECProperty
104
- const extractedPrimitives = extractPrimitives([], property);
108
+ const extractedPrimitives = extractPrimitives([], propertiesField);
105
109
  extractedPrimitives.forEach((extractedPrimitive) => {
106
110
  extractedPrimitive.sourceSchema = "*";
107
111
  extractedPrimitive.sourceClassName = "*";