@itwin/presentation-shared 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +27 -21
  3. package/lib/cjs/shared/ConcatenatedValue.d.ts +2 -6
  4. package/lib/cjs/shared/ConcatenatedValue.d.ts.map +1 -1
  5. package/lib/cjs/shared/ConcatenatedValue.js +0 -6
  6. package/lib/cjs/shared/ConcatenatedValue.js.map +1 -1
  7. package/lib/cjs/shared/Formatting.d.ts +0 -3
  8. package/lib/cjs/shared/Formatting.d.ts.map +1 -1
  9. package/lib/cjs/shared/Formatting.js +1 -26
  10. package/lib/cjs/shared/Formatting.js.map +1 -1
  11. package/lib/cjs/shared/Values.d.ts +0 -12
  12. package/lib/cjs/shared/Values.d.ts.map +1 -1
  13. package/lib/cjs/shared/ecsql-snippets/ECSqlValueSelectorSnippets.d.ts +30 -33
  14. package/lib/cjs/shared/ecsql-snippets/ECSqlValueSelectorSnippets.d.ts.map +1 -1
  15. package/lib/cjs/shared/ecsql-snippets/ECSqlValueSelectorSnippets.js +76 -67
  16. package/lib/cjs/shared/ecsql-snippets/ECSqlValueSelectorSnippets.js.map +1 -1
  17. package/lib/cjs/shared/ecsql-snippets/index.d.ts +1 -1
  18. package/lib/cjs/shared/ecsql-snippets/index.d.ts.map +1 -1
  19. package/lib/cjs/shared/ecsql-snippets/index.js +2 -1
  20. package/lib/cjs/shared/ecsql-snippets/index.js.map +1 -1
  21. package/lib/esm/shared/ConcatenatedValue.d.ts +2 -6
  22. package/lib/esm/shared/ConcatenatedValue.d.ts.map +1 -1
  23. package/lib/esm/shared/ConcatenatedValue.js +0 -6
  24. package/lib/esm/shared/ConcatenatedValue.js.map +1 -1
  25. package/lib/esm/shared/Formatting.d.ts +0 -3
  26. package/lib/esm/shared/Formatting.d.ts.map +1 -1
  27. package/lib/esm/shared/Formatting.js +1 -26
  28. package/lib/esm/shared/Formatting.js.map +1 -1
  29. package/lib/esm/shared/Values.d.ts +0 -12
  30. package/lib/esm/shared/Values.d.ts.map +1 -1
  31. package/lib/esm/shared/ecsql-snippets/ECSqlValueSelectorSnippets.d.ts +30 -33
  32. package/lib/esm/shared/ecsql-snippets/ECSqlValueSelectorSnippets.d.ts.map +1 -1
  33. package/lib/esm/shared/ecsql-snippets/ECSqlValueSelectorSnippets.js +75 -67
  34. package/lib/esm/shared/ecsql-snippets/ECSqlValueSelectorSnippets.js.map +1 -1
  35. package/lib/esm/shared/ecsql-snippets/index.d.ts +1 -1
  36. package/lib/esm/shared/ecsql-snippets/index.d.ts.map +1 -1
  37. package/lib/esm/shared/ecsql-snippets/index.js +1 -1
  38. package/lib/esm/shared/ecsql-snippets/index.js.map +1 -1
  39. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # @itwin/presentation-shared
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#703](https://github.com/iTwin/presentation/pull/703): **BREAKING:** Removed the option to specify value + ECProperty identifier when creating a `ConcatenatedValue`.
8
+
9
+ The change provides two benefits:
10
+
11
+ 1. Access to schema is not required to format `ConcatenatedValue` parts as they already contain all the necessary metadata required for formatting the value. This is a step towards supporting multiple data sources, where schema information might be not available during formatting.
12
+ 2. Previously, the property type information had to be extracted for every row in the result set, which was inefficient. Now, the type information is extracted only once, when creating an ECSql query.
13
+
14
+ Full list of changes:
15
+
16
+ - `ConcatenatedValuePart.isProperty` - removed, as the "property" type was removed from the type union.
17
+ - `ECSql.createConcatenatedValueJsonSelector` and `ECSql.createConcatenatedValueStringSelector` don't accept an option to specify value + ECProperty identifier as a selector argument anymore. Instead, the option that specifies value selector + type information should be used. The latter kind of selector can be created using the newly added `ECSql.createPrimitivePropertyValueSelectorProps` function (see below).
18
+ - Added `ECSql.createPrimitivePropertyValueSelectorProps` function to help create a selector that specifies a value selector + type information. See README for more details.
19
+ - The change allows formatting `ConcatenatedValue` parts without the need to access schema information, so `formatConcatenatedValue` function now doesn't require a `schemaProvider` prop.
20
+
21
+ Mitigation example:
22
+
23
+ _Before:_
24
+
25
+ ```ts
26
+ const selector: ECSql.createConcatenatedValueJsonSelector([
27
+ { type: "String", value: "[" },
28
+ { propertyClassName: "MySchema.MyClass", propertyClassAlias: "this", propertyName: "PropX" },
29
+ { type: "String", value: "]" },
30
+ ]);
31
+ ```
32
+
33
+ _After:_
34
+
35
+ ```ts
36
+ const selector: ECSql.createConcatenatedValueJsonSelector([
37
+ { type: "String", value: "[" },
38
+ await ECSql.createPrimitivePropertyValueSelectorProps({ schemaProvider, propertyClassName: "MySchema.MyClass", propertyClassAlias: "this", propertyName: "PropX" }),
39
+ { type: "String", value: "]" },
40
+ ]);
41
+ ```
42
+
43
+ ### Patch Changes
44
+
45
+ - [#703](https://github.com/iTwin/presentation/pull/703): Fix `ECSql.createConcatenatedValueStringSelector` not casting property value to string. This could cause ECSQL query execution to fail when more than one selector is used.
46
+
47
+ ## 0.4.1
48
+
49
+ ### Patch Changes
50
+
51
+ - [#695](https://github.com/iTwin/presentation/pull/695): Bump `iTwin.js` core package dependency versions to `4.8.0`
52
+
3
53
  ## 0.4.0
4
54
 
5
55
  ### Minor Changes
package/README.md CHANGED
@@ -139,6 +139,28 @@ The ECSql utilities group contains a number of functions to help create complex
139
139
  // result = "'STRING VALUE'"
140
140
  ```
141
141
 
142
+ - `createPrimitivePropertyValueSelectorProps` - creates `TypedValueSelectClauseProps` for selecting a primitive property value, while also
143
+ accounting for the property type. The created props may be used when creating `ConcatenatedValue` selectors (see `createConcatenatedValueJsonSelector`
144
+ and `createConcatenatedValueStringSelector`).
145
+
146
+ Example usage:
147
+
148
+ ```ts
149
+ import { ECSql } from "@itwin/presentation-shared";
150
+
151
+ const categoryRankSelectorProps = ECSql.createPrimitivePropertyValueSelectorProps({
152
+ schemaProvider,
153
+ propertyClassAlias: "x",
154
+ propertyClassName: "BisCore.Category",
155
+ propertyName: "Rank",
156
+ });
157
+ // categoryRankSelectorProps = { selector: "[x].[Rank]", type: "Integer" }
158
+
159
+ // Now we can use the result to create a `ConcatenatedValue` selector:
160
+ const selector = ECSql.createConcatenatedValueJsonSelector(["Rank: ", categoryRankSelectorProps]);
161
+ // selector = `json_array('Rank: ', json_object('selector', '[x].[Rank]', 'type', 'Integer'))`
162
+ ```
163
+
142
164
  - `createInstanceKeySelector` - creates an ECSQL selector for a serialized `InstanceKey` JSON object.
143
165
 
144
166
  Example usage:
@@ -158,12 +180,7 @@ The ECSql utilities group contains a number of functions to help create complex
158
180
 
159
181
  const selector = ECSql.createConcatenatedValueJsonSelector([
160
182
  {
161
- propertyClassName: "MySchema.MyClass",
162
- propertyClassAlias: "my_class",
163
- propertyName: "MyProperty",
164
- },
165
- {
166
- selector: "my_class.MyOtherProperty",
183
+ selector: "my_class.MyProperty",
167
184
  },
168
185
  {
169
186
  value: 123.456,
@@ -171,12 +188,7 @@ The ECSql utilities group contains a number of functions to help create complex
171
188
  },
172
189
  ]);
173
190
  // selector = `json_array(
174
- // json_object(
175
- // 'className', 'MySchema.MyClass',
176
- // 'propertyName', 'MyProperty',
177
- // 'value', [my_class].[MyProperty]
178
- // ),
179
- // my_class.MyOtherProperty,
191
+ // my_class.MyProperty,
180
192
  // json_object(
181
193
  // 'value', 123.456,
182
194
  // 'type', 'Double'
@@ -205,19 +217,14 @@ The ECSql utilities group contains a number of functions to help create complex
205
217
 
206
218
  const selector = ECSql.createConcatenatedValueStringSelector([
207
219
  {
208
- propertyClassName: "MySchema.MyClass",
209
- propertyClassAlias: "my_class",
210
- propertyName: "MyProperty",
211
- },
212
- {
213
- selector: "my_class.MyOtherProperty",
220
+ selector: "my_class.MyProperty",
214
221
  },
215
222
  {
216
223
  value: 123.456,
217
224
  type: "Double",
218
225
  },
219
226
  ]);
220
- // selector = `[my_class].[MyProperty] || my_class.MyOtherProperty || 123.456`
227
+ // selector = `CAST(my_class.MyProperty AS TEXT) || '123.456'`
221
228
 
222
229
  const queryReader = queryExecutor.createQueryReader(
223
230
  {
@@ -274,11 +281,10 @@ The APIs in Values group contain various value types and utilities to work with
274
281
 
275
282
  - `create` - given a `PrimitiveValue`, its type and, optionally, extra information, validates the input and creates a `TypedPrimitiveValue`.
276
283
 
277
- - `ConcatenatedValuePart` - a union of different types that may be used to create a single, combined value: primitive ECInstance property value, hardcoded primitive value or just plain string. Also, a namespace, containing the following utilities:
284
+ - `ConcatenatedValuePart` - a union of different types that may be used to create a single, combined value: nested `ConcatenatedValue`, `TypedPrimitiveValue` or just plain string. Also, a namespace, containing the following utilities:
278
285
 
279
286
  - `isString` - type guard to check if the given `ConcatenatedValuePart` is a `string`.
280
287
  - `isPrimitive` - type guard to check if the given `ConcatenatedValuePart` is a `TypedPrimitiveValue`.
281
- - `isProperty` - type guard to check if the given `ConcatenatedValuePart` describes a primitive property value.
282
288
 
283
289
  - `ConcatenatedValue` - an array of `ConcatenatedValuePart`. Also, a namespace containing the following utilities:
284
290
 
@@ -1,9 +1,7 @@
1
- import { PrimitivePropertyValue, TypedPrimitiveValue } from "./Values";
1
+ import { TypedPrimitiveValue } from "./Values";
2
2
  /**
3
3
  * A part of a `ConcatenatedValue`, describing one piece of the value. Possible types:
4
4
  * - `ConcatenatedValue` describes a nested concatenated value.
5
- * - `PrimitivePropertyValue` describes an ECProperty value. Generally the value is formatted according to
6
- * property metadata before concatenating with other parts.
7
5
  * - `TypedPrimitiveValue` describes a value with its type. Generally the value is formatted
8
6
  * according to its type information before concatenating with other parts.
9
7
  * - `string` is just concatenated to other parts as-is.
@@ -11,7 +9,7 @@ import { PrimitivePropertyValue, TypedPrimitiveValue } from "./Values";
11
9
  * @see `ConcatenatedValue`
12
10
  * @beta
13
11
  */
14
- export type ConcatenatedValuePart = ConcatenatedValue | PrimitivePropertyValue | TypedPrimitiveValue | string;
12
+ export type ConcatenatedValuePart = ConcatenatedValue | TypedPrimitiveValue | string;
15
13
  /** @beta */
16
14
  export declare namespace ConcatenatedValuePart {
17
15
  /** @beta */
@@ -19,8 +17,6 @@ export declare namespace ConcatenatedValuePart {
19
17
  /** @beta */
20
18
  function isPrimitive(part: ConcatenatedValuePart): part is TypedPrimitiveValue;
21
19
  /** @beta */
22
- function isProperty(part: ConcatenatedValuePart): part is PrimitivePropertyValue;
23
- /** @beta */
24
20
  function isConcatenatedValue(part: ConcatenatedValuePart): part is ConcatenatedValue;
25
21
  }
26
22
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ConcatenatedValue.d.ts","sourceRoot":"","sources":["../../../src/shared/ConcatenatedValue.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEvE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG,sBAAsB,GAAG,mBAAmB,GAAG,MAAM,CAAC;AAE9G,YAAY;AAEZ,yBAAiB,qBAAqB,CAAC;IACrC,YAAY;IACZ,SAAgB,QAAQ,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,IAAI,MAAM,CAEpE;IAED,YAAY;IACZ,SAAgB,WAAW,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,IAAI,mBAAmB,CAEpF;IAED,YAAY;IACZ,SAAgB,UAAU,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,IAAI,sBAAsB,CAGtF;IAED,YAAY;IACZ,SAAgB,mBAAmB,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,IAAI,iBAAiB,CAE1F;CACF;AAED;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,EAAE,CAAC;AAExD,YAAY;AAEZ,yBAAiB,iBAAiB,CAAC;IACjC;;;;;OAKG;IACH,SAAsB,SAAS,CAAC,KAAK,EAAE;QACrC,yBAAyB;QACzB,KAAK,EAAE,iBAAiB,CAAC;QACzB,qDAAqD;QACrD,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QAC5F,6EAA6E;QAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,MAAM,CAAC,CAYlB;CACF"}
1
+ {"version":3,"file":"ConcatenatedValue.d.ts","sourceRoot":"","sources":["../../../src/shared/ConcatenatedValue.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,MAAM,CAAC;AAErF,YAAY;AAEZ,yBAAiB,qBAAqB,CAAC;IACrC,YAAY;IACZ,SAAgB,QAAQ,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,IAAI,MAAM,CAEpE;IAED,YAAY;IACZ,SAAgB,WAAW,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,IAAI,mBAAmB,CAEpF;IAED,YAAY;IACZ,SAAgB,mBAAmB,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,IAAI,iBAAiB,CAE1F;CACF;AAED;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,EAAE,CAAC;AAExD,YAAY;AAEZ,yBAAiB,iBAAiB,CAAC;IACjC;;;;;OAKG;IACH,SAAsB,SAAS,CAAC,KAAK,EAAE;QACrC,yBAAyB;QACzB,KAAK,EAAE,iBAAiB,CAAC;QACzB,qDAAqD;QACrD,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QAC5F,6EAA6E;QAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,MAAM,CAAC,CAYlB;CACF"}
@@ -20,12 +20,6 @@ var ConcatenatedValuePart;
20
20
  }
21
21
  ConcatenatedValuePart.isPrimitive = isPrimitive;
22
22
  /** @beta */
23
- function isProperty(part) {
24
- const candidate = part;
25
- return !!candidate.className && !!candidate.propertyName;
26
- }
27
- ConcatenatedValuePart.isProperty = isProperty;
28
- /** @beta */
29
23
  function isConcatenatedValue(part) {
30
24
  return Array.isArray(part);
31
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ConcatenatedValue.js","sourceRoot":"","sources":["../../../src/shared/ConcatenatedValue.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAkBhG,YAAY;AACZ,2DAA2D;AAC3D,IAAiB,qBAAqB,CAqBrC;AArBD,WAAiB,qBAAqB;IACpC,YAAY;IACZ,SAAgB,QAAQ,CAAC,IAA2B;QAClD,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC;IAClC,CAAC;IAFe,8BAAQ,WAEvB,CAAA;IAED,YAAY;IACZ,SAAgB,WAAW,CAAC,IAA2B;QACrD,OAAO,CAAC,CAAE,IAA4B,CAAC,IAAI,CAAC;IAC9C,CAAC;IAFe,iCAAW,cAE1B,CAAA;IAED,YAAY;IACZ,SAAgB,UAAU,CAAC,IAA2B;QACpD,MAAM,SAAS,GAAG,IAA8B,CAAC;QACjD,OAAO,CAAC,CAAC,SAAS,CAAC,SAAS,IAAI,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC;IAC3D,CAAC;IAHe,gCAAU,aAGzB,CAAA;IAED,YAAY;IACZ,SAAgB,mBAAmB,CAAC,IAA2B;QAC7D,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAFe,yCAAmB,sBAElC,CAAA;AACH,CAAC,EArBgB,qBAAqB,qCAArB,qBAAqB,QAqBrC;AAUD,YAAY;AACZ,2DAA2D;AAC3D,IAAiB,iBAAiB,CA2BjC;AA3BD,WAAiB,iBAAiB;IAChC;;;;;OAKG;IACI,KAAK,UAAU,SAAS,CAAC,KAO/B;QACC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,GAA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G;IACI,KAAK,UAAU,SAAS,CAAC,KAO/B;QACC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;QAClD,OAAO,CACL,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACvB,IAAI,qBAAqB,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;gBACpD,OAAO,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,CAAC;YAC9D,CAAC;YACD,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC,CAAC,CACH,CACF,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IAC1B,CAAC;IAnBqB,2BAAS,YAmB9B,CAAA;AACH,CAAC,EA3BgB,iBAAiB,iCAAjB,iBAAiB,QA2BjC"}
@@ -1,5 +1,4 @@
1
1
  import { ConcatenatedValue } from "./ConcatenatedValue";
2
- import { ECSchemaProvider } from "./Metadata";
3
2
  import { TypedPrimitiveValue } from "./Values";
4
3
  /**
5
4
  * A type definition for a function that knows how to create a display string for a typed primitive value.
@@ -11,12 +10,10 @@ export type IPrimitiveValueFormatter = (value: TypedPrimitiveValue) => Promise<s
11
10
  * Formats a concatenated value into a string, taking into account different types of `ConcatenatedValuePart` that
12
11
  * the value consists of.
13
12
  *
14
- * @throws Error if a `ConcatenatedValuePart` in given `ConcatenatedValue` references a non-primitive, `IGeometry` or `Binary` property.
15
13
  * @beta
16
14
  */
17
15
  export declare function formatConcatenatedValue(props: {
18
16
  value: ConcatenatedValue | string;
19
- schemaProvider: ECSchemaProvider;
20
17
  valueFormatter: IPrimitiveValueFormatter;
21
18
  }): Promise<string>;
22
19
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Formatting.d.ts","sourceRoot":"","sources":["../../../src/shared/Formatting.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAyB,MAAM,qBAAqB,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAY,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEvF;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,EAAE;IACnD,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAAC;IAClC,cAAc,EAAE,gBAAgB,CAAC;IACjC,cAAc,EAAE,wBAAwB,CAAC;CAC1C,GAAG,OAAO,CAAC,MAAM,CAAC,CA0ClB;AAOD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,2BAA2B,IAAI,wBAAwB,CAatE"}
1
+ {"version":3,"file":"Formatting.d.ts","sourceRoot":"","sources":["../../../src/shared/Formatting.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAyB,MAAM,qBAAqB,CAAC;AAE/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEvF;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAAC;IAAC,cAAc,EAAE,wBAAwB,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBrJ;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,2BAA2B,IAAI,wBAAwB,CAatE"}
@@ -9,16 +9,14 @@ exports.createDefaultValueFormatter = createDefaultValueFormatter;
9
9
  const core_bentley_1 = require("@itwin/core-bentley");
10
10
  const ConcatenatedValue_1 = require("./ConcatenatedValue");
11
11
  const InternalUtils_1 = require("./InternalUtils");
12
- const Metadata_1 = require("./Metadata");
13
12
  /**
14
13
  * Formats a concatenated value into a string, taking into account different types of `ConcatenatedValuePart` that
15
14
  * the value consists of.
16
15
  *
17
- * @throws Error if a `ConcatenatedValuePart` in given `ConcatenatedValue` references a non-primitive, `IGeometry` or `Binary` property.
18
16
  * @beta
19
17
  */
20
18
  async function formatConcatenatedValue(props) {
21
- const { value, schemaProvider, valueFormatter } = props;
19
+ const { value, valueFormatter } = props;
22
20
  if (typeof value === "string") {
23
21
  return valueFormatter({ value, type: "String" });
24
22
  }
@@ -32,34 +30,11 @@ async function formatConcatenatedValue(props) {
32
30
  type: "String",
33
31
  };
34
32
  }
35
- // for property parts - find property metadata and create `TypedPrimitiveValue` for them.
36
- if (ConcatenatedValue_1.ConcatenatedValuePart.isProperty(part)) {
37
- const property = await getProperty(part, schemaProvider);
38
- if (!property?.isPrimitive()) {
39
- throw new Error(`Concatenated values formatter expects a primitive property, but it's not.`);
40
- }
41
- if (property.primitiveType === "IGeometry") {
42
- throw new Error(`Concatenated values formatter does not support "IGeometry" values, but the provided ${part.className}.${part.propertyName} property is.`);
43
- }
44
- if (property.primitiveType === "Binary") {
45
- throw new Error(`Concatenated values formatter does not support "Binary" values, but the provided ${part.className}.${part.propertyName} property is.`);
46
- }
47
- part = {
48
- type: property.primitiveType,
49
- extendedType: property.extendedTypeName,
50
- koqName: (await property.kindOfQuantity)?.fullName,
51
- value: part.value,
52
- };
53
- }
54
33
  // finally, use provided value formatter to create a string from `TypedPrimitiveValue`
55
34
  return valueFormatter(part);
56
35
  },
57
36
  });
58
37
  }
59
- async function getProperty({ className, propertyName }, schemaProvider) {
60
- const propertyClass = await (0, Metadata_1.getClass)(schemaProvider, className);
61
- return propertyClass.getProperty(propertyName);
62
- }
63
38
  /**
64
39
  * A values' formatter that knows how to format the following types:
65
40
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Formatting.js","sourceRoot":"","sources":["../../../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AC7B,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IACrH,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IAClF,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -104,16 +104,4 @@ export declare namespace TypedPrimitiveValue {
104
104
  */
105
105
  function create(value: PrimitiveValue, type: PrimitiveValueType, koqName?: string, extendedType?: string): TypedPrimitiveValue;
106
106
  }
107
- /**
108
- * A type for a primitive property value and its metadata - property name and its class full name.
109
- * @beta
110
- */
111
- export interface PrimitivePropertyValue {
112
- /** Full name of the class containing the property with `propertyName` name. */
113
- className: string;
114
- /** Name of the primitive property whose value this data structure holds. */
115
- propertyName: string;
116
- /** Raw value of the primitive property. */
117
- value: PrimitiveValue;
118
- }
119
107
  //# sourceMappingURL=Values.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Values.d.ts","sourceRoot":"","sources":["../../../src/shared/Values.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,EAAE,EAAE,UAAU,CAAC;CAChB;AAED,YAAY;AACZ,yBAAiB,WAAW,CAAC;IAC3B;;;OAGG;IACH,SAAgB,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,GA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M,CAAC;CACvB,CAAC;AAEF,YAAY;AAEZ,yBAAiB,mBAAmB,CAAC;IACnC;;;;OAIG;IACH,SAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,mBAAmB,CA8EpI;CACF"}
@@ -1,51 +1,48 @@
1
- import { PrimitiveValueType } from "../Metadata";
1
+ import { ECSchemaProvider, PrimitiveValueType } from "../Metadata";
2
2
  import { PrimitiveValue, TypedPrimitiveValue } from "../Values";
3
3
  /**
4
- * A union of property types that need special handling when creating a property value selector.
5
- * For example, Guid values are stored as binary and need to be selected with `GuidToStr` function to
6
- * get a meaningful value.
4
+ * Props for selecting a `TypedPrimitiveValue` using given ECSQL selector.
7
5
  * @beta
8
6
  */
9
- type SpecialPropertyType = "Navigation" | "Guid" | "Point2d" | "Point3d";
10
- /**
11
- * Props for selecting property value along with its metadata.
12
- *
13
- * It's recommended to only select properties with metadata only when they need additional formatting and
14
- * otherwise use `createRawPropertyValueSelector` to select their value.
15
- *
16
- * @beta
17
- */
18
- interface PropertyValueSelectClauseProps {
19
- /** Full class name of the property. Format: `SchemaName.ClassName`. */
20
- propertyClassName: string;
21
- /** Query alias of the class that contains the property. */
22
- propertyClassAlias: string;
23
- /** Name of the property. */
24
- propertyName: string;
25
- /** Special type of the property if it matches any. */
26
- specialType?: SpecialPropertyType;
27
- }
28
- /**
29
- * Props for selecting a primitive value using given ECSQL selector.
30
- * @beta
31
- */
32
- interface PrimitiveValueSelectorProps {
7
+ type TypedPrimitiveValueSelectorProps = {
33
8
  /** ECSQL selector to query the value */
34
9
  selector: string;
10
+ } & ({
35
11
  /** Type of the value. Defaults to `String`. */
36
- type?: PrimitiveValueType;
37
- }
12
+ type?: undefined;
13
+ } | {
14
+ type: Exclude<PrimitiveValueType, "Double">;
15
+ extendedType?: string;
16
+ } | {
17
+ type: Extract<PrimitiveValueType, "Double">;
18
+ extendedType?: string;
19
+ koqName?: string;
20
+ });
38
21
  /**
39
22
  * A union of prop types for selecting a value and its metadata in ECSQL query.
40
23
  * @beta
41
24
  */
42
- export type TypedValueSelectClauseProps = PropertyValueSelectClauseProps | TypedPrimitiveValue | PrimitiveValueSelectorProps;
25
+ export type TypedValueSelectClauseProps = TypedPrimitiveValue | TypedPrimitiveValueSelectorProps;
43
26
  /** @beta */
44
27
  export declare namespace TypedValueSelectClauseProps {
45
- function isPropertySelector(props: TypedValueSelectClauseProps): props is PropertyValueSelectClauseProps;
46
28
  function isPrimitiveValue(props: TypedValueSelectClauseProps): props is TypedPrimitiveValue;
47
- function isPrimitiveValueSelector(props: TypedValueSelectClauseProps): props is PrimitiveValueSelectorProps;
29
+ function isPrimitiveValueSelector(props: TypedValueSelectClauseProps): props is TypedPrimitiveValueSelectorProps;
48
30
  }
31
+ /**
32
+ * A function for a creating a `TypedPrimitiveValueSelectorProps` object from given primitive ECProperty information.
33
+ * @throws Error if the property is not found, is not primitive or has unsupported primitive type (Binary, IGeometry).
34
+ * @beta
35
+ */
36
+ export declare function createPrimitivePropertyValueSelectorProps({ schemaProvider, propertyClassAlias, propertyClassName, propertyName, }: {
37
+ /** Access to schema information. */
38
+ schemaProvider: ECSchemaProvider;
39
+ /** Full class name of the property. Format: `SchemaName.ClassName`. */
40
+ propertyClassName: string;
41
+ /** Query alias of the class that contains the property. */
42
+ propertyClassAlias: string;
43
+ /** Name of the property to create `TypedPrimitiveValue` for. */
44
+ propertyName: string;
45
+ }): Promise<TypedPrimitiveValueSelectorProps>;
49
46
  /**
50
47
  * Creates an ECSQL selector for raw property value, or, optionally - it's component. Example result:
51
48
  * `[classAlias].[propertyName].[componentName]`.
@@ -1 +1 @@
1
- {"version":3,"file":"ECSqlValueSelectorSnippets.d.ts","sourceRoot":"","sources":["../../../../src/shared/ecsql-snippets/ECSqlValueSelectorSnippets.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,a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6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.TypedValueSelectClauseProps = void 0;
8
+ exports.createPrimitivePropertyValueSelectorProps = createPrimitivePropertyValueSelectorProps;
8
9
  exports.createRawPropertyValueSelector = createRawPropertyValueSelector;
9
10
  exports.createRawPrimitiveValueSelector = createRawPrimitiveValueSelector;
10
11
  exports.createInstanceKeySelector = createInstanceKeySelector;
@@ -12,24 +13,76 @@ exports.createNullableSelector = createNullableSelector;
12
13
  exports.createConcatenatedValueJsonSelector = createConcatenatedValueJsonSelector;
13
14
  exports.createConcatenatedValueStringSelector = createConcatenatedValueStringSelector;
14
15
  const core_bentley_1 = require("@itwin/core-bentley");
16
+ const Metadata_1 = require("../Metadata");
15
17
  const Values_1 = require("../Values");
16
18
  /** @beta */
17
19
  // eslint-disable-next-line @typescript-eslint/no-redeclare
18
20
  var TypedValueSelectClauseProps;
19
21
  (function (TypedValueSelectClauseProps) {
20
- function isPropertySelector(props) {
21
- return !!props.propertyName;
22
- }
23
- TypedValueSelectClauseProps.isPropertySelector = isPropertySelector;
24
22
  function isPrimitiveValue(props) {
25
- return !!props.value;
23
+ return "value" in props;
26
24
  }
27
25
  TypedValueSelectClauseProps.isPrimitiveValue = isPrimitiveValue;
28
26
  function isPrimitiveValueSelector(props) {
29
- return !!props.selector;
27
+ return "selector" in props;
30
28
  }
31
29
  TypedValueSelectClauseProps.isPrimitiveValueSelector = isPrimitiveValueSelector;
32
30
  })(TypedValueSelectClauseProps || (exports.TypedValueSelectClauseProps = TypedValueSelectClauseProps = {}));
31
+ /**
32
+ * A function for a creating a `TypedPrimitiveValueSelectorProps` object from given primitive ECProperty information.
33
+ * @throws Error if the property is not found, is not primitive or has unsupported primitive type (Binary, IGeometry).
34
+ * @beta
35
+ */
36
+ async function createPrimitivePropertyValueSelectorProps({ schemaProvider, propertyClassAlias, propertyClassName, propertyName, }) {
37
+ const ecClass = await (0, Metadata_1.getClass)(schemaProvider, propertyClassName);
38
+ const property = await ecClass.getProperty(propertyName);
39
+ if (!property) {
40
+ throw new Error(`The property "${propertyName}" not found in class "${propertyClassName}".`);
41
+ }
42
+ const propertySelector = createRawPropertyValueSelector(propertyClassAlias, propertyName);
43
+ if (property.isNavigation()) {
44
+ return { selector: `${propertySelector}.[Id]`, type: "Id" };
45
+ }
46
+ if (!property.isPrimitive()) {
47
+ throw new Error(`The property "${propertyName}" should be of either navigation or primitive type.`);
48
+ }
49
+ const propertyValueType = property.primitiveType;
50
+ const extendedType = property.extendedTypeName;
51
+ switch (propertyValueType) {
52
+ case "IGeometry":
53
+ throw new Error(`The property "${propertyName}" of type "IGeometry" is not supported.`);
54
+ case "Binary":
55
+ if (extendedType === "BeGuid") {
56
+ return { selector: `GuidToStr(${propertySelector})`, type: "String" };
57
+ }
58
+ throw new Error(`The property "${propertyName}" of type "Binary" is not supported.`);
59
+ case "Point2d":
60
+ return {
61
+ selector: `json_object('x', ${propertySelector}.[x], 'y', ${propertySelector}.[y])`,
62
+ type: "Point2d",
63
+ ...(extendedType ? { extendedType } : /* istanbul ignore next */ {}),
64
+ };
65
+ case "Point3d":
66
+ return {
67
+ selector: `json_object('x', ${propertySelector}.[x], 'y', ${propertySelector}.[y], 'z', ${propertySelector}.[z])`,
68
+ type: "Point3d",
69
+ ...(extendedType ? { extendedType } : /* istanbul ignore next */ {}),
70
+ };
71
+ case "Double":
72
+ const koqName = (await property.kindOfQuantity)?.fullName;
73
+ return {
74
+ selector: propertySelector,
75
+ type: "Double",
76
+ ...(extendedType ? { extendedType } : /* istanbul ignore next */ {}),
77
+ ...(koqName ? { koqName } : /* istanbul ignore next */ {}),
78
+ };
79
+ }
80
+ return {
81
+ selector: propertySelector,
82
+ type: propertyValueType,
83
+ ...(extendedType ? { extendedType } : /* istanbul ignore next */ {}),
84
+ };
85
+ }
33
86
  /**
34
87
  * Creates an ECSQL selector for raw property value, or, optionally - it's component. Example result:
35
88
  * `[classAlias].[propertyName].[componentName]`.
@@ -120,51 +173,28 @@ function createConcatenatedValueJsonSelector(selectors, checkSelector) {
120
173
  return combinedSelectors;
121
174
  }
122
175
  function createTypedValueJsonSelector(props) {
123
- if (TypedValueSelectClauseProps.isPropertySelector(props)) {
124
- if (props.specialType) {
125
- // eslint-disable-next-line @typescript-eslint/no-shadow
126
- const [valueSelector, typeOverride] = createSpecialPropertyValueJsonSelector(props.propertyClassAlias, props.propertyName, props.specialType);
127
- return createTypedValueJsonSelector({ selector: valueSelector, type: typeOverride });
128
- }
129
- return `
130
- json_object(
131
- 'className', '${props.propertyClassName}',
132
- 'propertyName', '${props.propertyName}',
133
- 'value', ${createRawPropertyValueSelector(props.propertyClassAlias, props.propertyName)}
134
- )
135
- `;
176
+ let valueSelector;
177
+ if (TypedValueSelectClauseProps.isPrimitiveValue(props)) {
178
+ valueSelector = createPrimitiveValueJsonSelector(props.value);
136
179
  }
137
- if (TypedValueSelectClauseProps.isPrimitiveValueSelector(props)) {
138
- if (props.type) {
139
- return `
140
- json_object(
141
- 'value', ${props.selector},
142
- 'type', '${props.type}'
143
- )
144
- `;
145
- }
180
+ else if (props.type) {
181
+ valueSelector = props.selector;
182
+ }
183
+ else {
146
184
  return props.selector;
147
185
  }
186
+ const args = {
187
+ value: valueSelector,
188
+ type: `'${props.type}'`,
189
+ ...(props.extendedType ? { extendedType: `'${props.extendedType}'` } : {}),
190
+ ...(props.type === "Double" && props.koqName ? { koqName: `'${props.koqName}'` } : {}),
191
+ };
148
192
  return `
149
- json_object(
150
- 'value', ${createPrimitiveValueJsonSelector(props.value)},
151
- 'type', '${props.type}'
152
- )
193
+ json_object(${Object.entries(args)
194
+ .map(([key, value]) => `'${key}', ${value}`)
195
+ .join(", ")})
153
196
  `;
154
197
  }
155
- function createSpecialPropertyValueJsonSelector(classAlias, propertyName, specialType) {
156
- const propertySelector = `[${classAlias}].[${propertyName}]`;
157
- switch (specialType) {
158
- case "Navigation":
159
- return [`${propertySelector}.[Id]`, "Id"];
160
- case "Guid":
161
- return [`GuidToStr(${propertySelector})`, "String"];
162
- case "Point2d":
163
- return [`json_object('x', ${propertySelector}.[x], 'y', ${propertySelector}.[y])`, "Point2d"];
164
- case "Point3d":
165
- return [`json_object('x', ${propertySelector}.[x], 'y', ${propertySelector}.[y], 'z', ${propertySelector}.[z])`, "Point3d"];
166
- }
167
- }
168
198
  function createPrimitiveValueJsonSelector(value) {
169
199
  if (value instanceof Date) {
170
200
  return `'${value.toISOString()}'`;
@@ -210,32 +240,11 @@ function createConcatenatedValueStringSelector(selectors, checkSelector) {
210
240
  return combinedSelectors;
211
241
  }
212
242
  function createTypedValueStringSelector(props) {
213
- if (TypedValueSelectClauseProps.isPropertySelector(props)) {
214
- if (props.specialType) {
215
- // eslint-disable-next-line @typescript-eslint/no-shadow
216
- const [valueSelector, typeOverride] = createSpecialPropertyValueStringSelector(props.propertyClassAlias, props.propertyName, props.specialType);
217
- return createTypedValueStringSelector({ selector: valueSelector, type: typeOverride });
218
- }
219
- return createRawPropertyValueSelector(props.propertyClassAlias, props.propertyName);
220
- }
221
243
  if (TypedValueSelectClauseProps.isPrimitiveValueSelector(props)) {
222
- return props.selector;
244
+ return `CAST(${props.selector} AS TEXT)`;
223
245
  }
224
246
  return createPrimitiveValueStringSelector(props.value);
225
247
  }
226
- function createSpecialPropertyValueStringSelector(classAlias, propertyName, specialType) {
227
- const propertySelector = createRawPropertyValueSelector(classAlias, propertyName);
228
- switch (specialType) {
229
- case "Navigation":
230
- return [`CAST(${propertySelector}.[Id] AS TEXT)`, "Id"];
231
- case "Guid":
232
- return [`GuidToStr(${propertySelector})`, "String"];
233
- case "Point2d":
234
- return [`'(' || ${propertySelector}.[x] || ', ' || ${propertySelector}.[y] || ')'`, "Point2d"];
235
- case "Point3d":
236
- return [`'(' || ${propertySelector}.[x] || ', ' || ${propertySelector}.[y] || ', ' || ${propertySelector}.[z] || ')'`, "Point3d"];
237
- }
238
- }
239
248
  function createPrimitiveValueStringSelector(value) {
240
249
  if (value instanceof Date) {
241
250
  return `'${value.toLocaleString()}'`;