@itwin/presentation-shared 2.0.0-alpha.12 → 2.0.0-alpha.14

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 (37) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/README.md +19 -34
  3. package/lib/presentation-shared.d.ts +3 -2
  4. package/lib/presentation-shared.d.ts.map +1 -1
  5. package/lib/presentation-shared.js +4 -1
  6. package/lib/presentation-shared.js.map +1 -1
  7. package/lib/shared/EachValueFrom.d.ts +30 -0
  8. package/lib/shared/EachValueFrom.d.ts.map +1 -0
  9. package/lib/shared/EachValueFrom.js +115 -0
  10. package/lib/shared/EachValueFrom.js.map +1 -0
  11. package/lib/shared/Metadata.d.ts +43 -37
  12. package/lib/shared/Metadata.d.ts.map +1 -1
  13. package/lib/shared/Metadata.js +7 -6
  14. package/lib/shared/Metadata.js.map +1 -1
  15. package/lib/shared/Values.d.ts +15 -2
  16. package/lib/shared/Values.d.ts.map +1 -1
  17. package/lib/shared/Values.js +1 -1
  18. package/lib/shared/Values.js.map +1 -1
  19. package/lib/shared/ecsql-snippets/ECSqlJoinSnippets.d.ts +11 -4
  20. package/lib/shared/ecsql-snippets/ECSqlJoinSnippets.d.ts.map +1 -1
  21. package/lib/shared/ecsql-snippets/ECSqlJoinSnippets.js +14 -14
  22. package/lib/shared/ecsql-snippets/ECSqlJoinSnippets.js.map +1 -1
  23. package/lib/shared/ecsql-snippets/ECSqlValueSelectorSnippets.js +2 -2
  24. package/lib/shared/ecsql-snippets/ECSqlValueSelectorSnippets.js.map +1 -1
  25. package/lib/shared/instance-label-factory-impls/BisInstanceLabelSelectClauseFactory.d.ts +2 -2
  26. package/lib/shared/instance-label-factory-impls/BisInstanceLabelSelectClauseFactory.d.ts.map +1 -1
  27. package/lib/shared/instance-label-factory-impls/BisInstanceLabelSelectClauseFactory.js +1 -4
  28. package/lib/shared/instance-label-factory-impls/BisInstanceLabelSelectClauseFactory.js.map +1 -1
  29. package/lib/shared/instance-label-factory-impls/ClassBasedInstanceLabelSelectClauseFactory.d.ts +2 -2
  30. package/lib/shared/instance-label-factory-impls/ClassBasedInstanceLabelSelectClauseFactory.d.ts.map +1 -1
  31. package/lib/shared/instance-label-factory-impls/ClassBasedInstanceLabelSelectClauseFactory.js +3 -3
  32. package/lib/shared/instance-label-factory-impls/ClassBasedInstanceLabelSelectClauseFactory.js.map +1 -1
  33. package/lib/shared/instance-label-factory-impls/IModelInstanceLabelSelectClauseFactory.d.ts +2 -2
  34. package/lib/shared/instance-label-factory-impls/IModelInstanceLabelSelectClauseFactory.d.ts.map +1 -1
  35. package/lib/shared/instance-label-factory-impls/IModelInstanceLabelSelectClauseFactory.js +4 -5
  36. package/lib/shared/instance-label-factory-impls/IModelInstanceLabelSelectClauseFactory.js.map +1 -1
  37. package/package.json +8 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,128 @@
1
1
  # @itwin/presentation-shared
2
2
 
3
+ ## 2.0.0-alpha.14
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1551](https://github.com/iTwin/presentation/pull/1551): Introduced `NavigationValue` for representing instances targeted by navigation properties.
8
+
9
+ ## 2.0.0-alpha.13
10
+
11
+ ### Major Changes
12
+
13
+ - [#1531](https://github.com/iTwin/presentation/pull/1531): `EC.RelationshipConstraintMultiplicity`: Changed `upperLimit` type from `number` to `number | "unbounded"`.
14
+
15
+ Previously, `createECSchemaProvider` from `@itwin/presentation-core-interop` reported an unbounded (`*`) upper limit as `0`, which silently made the natural `upperLimit > 1` check treat many-valued relationships as single-valued. The limit is now an explicit `"unbounded"` value that consumers must handle:
16
+
17
+ ```ts
18
+ const isManyValued =
19
+ constraint.multiplicity.upperLimit === "unbounded" ||
20
+ constraint.multiplicity.upperLimit > 1;
21
+ ```
22
+
23
+ - [#1503](https://github.com/iTwin/presentation/pull/1503): Full class and property names are now compared case-sensitively. Provide names using the casing defined by their EC schemas.
24
+ - [#1493](https://github.com/iTwin/presentation/pull/1493): Expose access to enumerations, kind-of-quantities and property categories through `EC.Schema`, and extend `EC.KindOfQuantity` with `relativeError` and `persistenceUnit` attributes. Schemas returned by `createECSchemaProvider` now implement the new getters.
25
+
26
+ - `EC.Schema` now requires `getEnumeration`, `getKindOfQuantity` and `getPropertyCategory` methods (mirroring the existing `getClass`). Consumers that only use `EC.Schema` are unaffected, but custom implementations of the interface must add these getters:
27
+
28
+ ```ts
29
+ const schema: EC.Schema = {
30
+ name,
31
+ version,
32
+ isHidden,
33
+ getClass: (className) => classes.get(className),
34
+ // added:
35
+ getEnumeration: (enumName) => enumerations.get(enumName),
36
+ getKindOfQuantity: (koqName) => kindOfQuantities.get(koqName),
37
+ getPropertyCategory: (categoryName) => categories.get(categoryName),
38
+ };
39
+ ```
40
+
41
+ - `EC.KindOfQuantity` now requires `relativeError` (`number`) and `persistenceUnit` (`string`) attributes. Custom implementations must provide them.
42
+
43
+ - `createECSchemaProvider`: The `EC.Schema` returned by the provider now implements the new getters, giving access to enumerations, kind-of-quantities and property categories in addition to classes. Existing code keeps working without changes and can now read these additional schema items:
44
+
45
+ ```ts
46
+ const schemaProvider = createECSchemaProvider(imodel);
47
+ const schema = await schemaProvider.getSchema("BisCore");
48
+ const enumeration = schema?.getEnumeration("MySchema.MyEnum");
49
+ const koq = schema?.getKindOfQuantity("MySchema.MyKoq");
50
+ const category = schema?.getPropertyCategory("MySchema.MyCategory");
51
+ ```
52
+
53
+ - [#1491](https://github.com/iTwin/presentation/pull/1491): `ECSchemaProvider`: Added a `classDerivesFrom` method for checking whether one ECClass is the same as, or derives from, another. `createECSchemaProvider` (in `@itwin/presentation-core-interop`) implements it using the class hierarchy information it already loads, so the answer is returned synchronously once the hierarchy has been loaded and no additional round-trips to the iModel are needed.
54
+
55
+ Also, `ECClassHierarchyInspector` and `createCachingECClassHierarchyInspector` have been deprecated. Because `ECSchemaProvider` now exposes `classDerivesFrom` directly, a separate class hierarchy inspector is no longer needed when setting up iModel access:
56
+
57
+ ```ts
58
+ // Before:
59
+ import { createCachingECClassHierarchyInspector } from "@itwin/presentation-shared";
60
+ import {
61
+ createECSchemaProvider,
62
+ createECSqlQueryExecutor,
63
+ } from "@itwin/presentation-core-interop";
64
+
65
+ const schemaProvider = createECSchemaProvider(imodel);
66
+ const imodelAccess = {
67
+ ...schemaProvider,
68
+ ...createCachingECClassHierarchyInspector({ schemaProvider }),
69
+ ...createECSqlQueryExecutor(imodel),
70
+ };
71
+
72
+ // After:
73
+ import {
74
+ createECSchemaProvider,
75
+ createECSqlQueryExecutor,
76
+ } from "@itwin/presentation-core-interop";
77
+
78
+ const imodelAccess = {
79
+ ...createECSchemaProvider(imodel), // now also provides `classDerivesFrom`
80
+ ...createECSqlQueryExecutor(imodel),
81
+ };
82
+ ```
83
+
84
+ **Breaking changes:**
85
+
86
+ - `ECSchemaProvider` now requires a `classDerivesFrom` method. Objects created via `createECSchemaProvider` get it automatically, so most consumers don't need to change anything. Only custom, hand-written `ECSchemaProvider` implementations need to add the method.
87
+
88
+ - Renamed the `classHierarchyInspector` prop to `imodelAccess` on `createClassBasedInstanceLabelSelectClauseFactory`, `createBisInstanceLabelSelectClauseFactory` (both in `@itwin/presentation-shared`) and `createPredicateBasedHierarchyDefinition` (in `@itwin/presentation-hierarchies`). The prop's type is unchanged, so the value passed to it doesn't need to change - only the prop name:
89
+
90
+ ```ts
91
+ // Before:
92
+ const classHierarchyInspector = createCachingECClassHierarchyInspector({
93
+ schemaProvider: createECSchemaProvider(imodel),
94
+ });
95
+ createPredicateBasedHierarchyDefinition({
96
+ classHierarchyInspector,
97
+ hierarchy,
98
+ });
99
+
100
+ // After:
101
+ const imodelAccess = createECSchemaProvider(imodel);
102
+ createPredicateBasedHierarchyDefinition({ imodelAccess, hierarchy });
103
+ ```
104
+
105
+ - [#1394](https://github.com/iTwin/presentation/pull/1394): `EC` namespace interfaces in `@itwin/presentation-shared` no longer use `Promise` wrappers — once a schema is loaded via the still-async `ECSchemaProvider.getSchema`, all further navigation (`baseClass`, `is()`, `getProperty()`, `getProperties()`, `kindOfQuantity`, `relationshipClass`, `enumeration`, `abstractConstraint`) is synchronous.
106
+
107
+ Additional changes:
108
+
109
+ - The `EC.Class.getDerivedClasses()` method was replaced with `getDerivedClassNames(props?: { onlyDirect?: boolean })`. `ECSchemaProvider` can be used to load the derived classes by name, if needed.
110
+ - The `getCustomAttributes()` method has been removed from `EC.Schema`, `EC.Class`, and `EC.Property` and replaced with an `isHidden: boolean` property. `EC.CustomAttributeSet` and `EC.CustomAttribute` types have been removed.
111
+ - Added an `EC.Class.getOwnProperties()` method that returns only the properties defined on the class itself, without inherited properties.
112
+ - Added an `EC.EntityClass.getMixins()` method that returns all mixins applied to the entity class.
113
+ - Added an optional `EC.Property.category` attribute.
114
+ - Added a required `EC.RelationshipConstraint.constraintClasses` attribute.
115
+ - Added missing optional `description` attributes to `EC.Schema` and `EC.Property`.
116
+
117
+ ### Minor Changes
118
+
119
+ - [#1507](https://github.com/iTwin/presentation/pull/1507): Add `eachValueFrom` for consuming subscribable streams through async iteration.
120
+
121
+ ### Patch Changes
122
+
123
+ - [#1524](https://github.com/iTwin/presentation/pull/1524): Fix `eachValueFrom` dropping legitimately emitted `undefined` values when they're buffered before the consumer requests them.
124
+ - [#1496](https://github.com/iTwin/presentation/pull/1496): `createRelationshipPathJoinClause`: The pre-resolved (sync) overload now accepts a rendering-only input — each step only needs its `joins`, plus an optional top-level `bindings` — instead of the full `RelationshipPathJoinInfo` shape. Callers that only need to render JOINs no longer have to supply the unused `relationshipClassIdSelector`, `sourceClassIdSelector`, and `targetClassIdSelector` fields per step.
125
+
3
126
  ## 2.0.0-alpha.12
4
127
 
5
128
  ### Major Changes
@@ -248,6 +371,30 @@
248
371
 
249
372
  In reality, consumers will likely use `@itwin/presentation-core-interop` package for creating them, and the package has been updated to handle the change, so reacting to the breaking change is as simple as bumping the version of `@itwin/presentation-core-interop` package in the consumer's `package.json`.
250
373
 
374
+ ## 1.2.22
375
+
376
+ ### Patch Changes
377
+
378
+ - [#1543](https://github.com/iTwin/presentation/pull/1543): Update iTwin.js core dependencies to `^5.13.1` and refresh related tooling/test dependencies.
379
+
380
+ ## 1.2.21
381
+
382
+ ### Patch Changes
383
+
384
+ - [#1521](https://github.com/iTwin/presentation/pull/1521): `createRelationshipPathJoinClause`: fix produced ECSQL being invalid when joining with `joinType: "outer"`. The produced snippet used `OUTER JOIN`, which ECSQL fails to parse - now it uses `LEFT OUTER JOIN`.
385
+
386
+ ## 1.2.20
387
+
388
+ ### Patch Changes
389
+
390
+ - [#1500](https://github.com/iTwin/presentation/pull/1500): Update iTwin.js core dependencies to ^5.12.4 and refresh related tooling/test dependencies.
391
+
392
+ ## 1.2.19
393
+
394
+ ### Patch Changes
395
+
396
+ - [#1473](https://github.com/iTwin/presentation/pull/1473): Bump dependencies.
397
+
251
398
  ## 1.2.18
252
399
 
253
400
  ### Patch Changes
package/README.md CHANGED
@@ -16,50 +16,38 @@ The namespace defines all the [EC](https://www.itwinjs.org/bis/ec/) types that P
16
16
 
17
17
  ### `ECSchemaProvider` & `getClass`
18
18
 
19
- - `ECSchemaProvider` is an interface for something that knows how to get an [ECSchema](https://www.itwinjs.org/bis/ec/ec-schema/) from an iModel. The package itself doesn't provide an implementation for this interface and instead relies on `@itwin/presentation-core-interop` to do that.
19
+ - `ECSchemaProvider` is an interface for something that knows how to get an [ECSchema](https://www.itwinjs.org/bis/ec/ec-schema/) from an iModel, or check if one class is the same as, or derives from, another. The package itself doesn't provide an implementation for this interface and instead relies on `@itwin/presentation-core-interop` to do that.
20
20
 
21
21
  - `getClass` is an utility function that makes it easier to get an `EC.Class`, given an `ECSchemaProvider` and a full class name.
22
22
 
23
23
  Example usage:
24
24
 
25
25
  ```ts
26
- import { SchemaContext } from "@itwin/ecschema-metadata";
26
+ import { IModelConnection } from "@itwin/core-frontend";
27
27
  import { createECSchemaProvider } from "@itwin/presentation-core-interop";
28
28
  import { ECSchemaProvider, getClass } from "@itwin/presentation-shared";
29
29
 
30
- const schemas = new SchemaContext();
31
- const schemaProvider: ECSchemaProvider = createECSchemaProvider(schemas);
30
+ const iModelConnection: IModelConnection = ...; // obtain the IModelConnection instance
31
+ const schemaProvider: ECSchemaProvider = createECSchemaProvider(iModelConnection);
32
32
 
33
33
  // get schema and a class from it
34
34
  const ecSchema = await schemaProvider.getSchema("MySchema");
35
- const ecClassFromSchema = await ecSchema.getClass("MyClass");
35
+ const ecClassFromSchema = ecSchema.getClass("MyClass");
36
36
 
37
37
  // ... or use the `getClass` utility to get straight to the class
38
38
  const ecClassFromUtility = await getClass(schemaProvider, "MySchema.MyClass");
39
- ```
40
-
41
- ### `ECClassHierarchyInspector` & `createCachingECClassHierarchyInspector`
42
39
 
43
- - `ECClassHierarchyInspector` is an interface for something that knows how to check whether one `EC.Class` derives from another. While that can be achieved through `ECSchemaProvider` by getting an `EC.Class` and calling its `is` method, using this interface provides a more streamlined and, possibly, more efficient way to do the check. In addition, the `ECClassHierarchyInspector.classDerivesFrom` returns a `Promise<boolean> | boolean`, which lets the implementation return the result synchronously, if it's already known.
40
+ // check whether one class derives from another
41
+ const isGeometricElement = await schemaProvider.classDerivesFrom("MySchema.MyClass", "BisCore.GeometricElement");
42
+ ```
44
43
 
45
- - `createCachingECClassHierarchyInspector` is a factory method that creates `ECClassHierarchyInspector` instance that uses a LRU cache to store the check results. In Presentation library use cases, class inheritance checks are done very frequently to warrant caching these results.
44
+ ### `ECClassHierarchyInspector` & `createCachingECClassHierarchyInspector` (deprecated)
46
45
 
47
- Example usage:
46
+ > **Deprecated:** `ECClassHierarchyInspector` and `createCachingECClassHierarchyInspector` are deprecated. `ECSchemaProvider` now exposes a `classDerivesFrom` method directly, so a separate class hierarchy inspector is no longer needed.
48
47
 
49
- ```ts
50
- import { createCachingECClassHierarchyInspector, ECClassHierarchyInspector } from "@itwin/presentation-shared";
48
+ - `ECClassHierarchyInspector` is an interface for something that knows how to check whether one `EC.Class` derives from another. The same capability is now available directly on `ECSchemaProvider` via its `classDerivesFrom` method. Like the inspector, `ECSchemaProvider.classDerivesFrom` returns a `Promise<boolean> | boolean`, which lets the implementation return the result synchronously when it's already known.
51
49
 
52
- const classHierarchyInspector: ECClassHierarchyInspector = createCachingECClassHierarchyInspector({
53
- // provide `ECSchemaProvider` that will be used to access iModels schemas
54
- schemaProvider: getMetadataProvider(),
55
- // tell how many entries should be cached in LRU cache (0 or `undefined` stand for "no caching")
56
- cacheSize: 100,
57
- });
58
- const isGeometricElement = await classHierarchyInspector.classDerivesFrom(
59
- "MySchema.MyClass",
60
- "BisCore.GeometricElement",
61
- );
62
- ```
50
+ - `createCachingECClassHierarchyInspector` is a factory method that creates an `ECClassHierarchyInspector` instance that uses a LRU cache to store the check results. It is no longer needed - use `ECSchemaProvider.classDerivesFrom` instead.
63
51
 
64
52
  ## ECSql
65
53
 
@@ -343,14 +331,11 @@ This label selectors factory doesn't create labels on its own, but allows assign
343
331
  Example usage:
344
332
 
345
333
  ```ts
346
- import {
347
- createClassBasedInstanceLabelSelectClauseFactory,
348
- ECClassHierarchyInspector,
349
- } from "@itwin/presentation-shared";
334
+ import { createClassBasedInstanceLabelSelectClauseFactory, ECSchemaProvider } from "@itwin/presentation-shared";
350
335
 
351
- const classHierarchyInspector: ECClassHierarchyInspector = getClassHierarchyInspector();
336
+ const imodelAccess: ECSchemaProvider = getSchemaProvider();
352
337
  const labelsFactory = createClassBasedInstanceLabelSelectClauseFactory({
353
- classHierarchyInspector,
338
+ imodelAccess,
354
339
  clauses: [
355
340
  {
356
341
  className: "MySchema.MyClass",
@@ -377,10 +362,10 @@ This label selectors factory creates labels according to [BIS instance label rul
377
362
  Example usage:
378
363
 
379
364
  ```ts
380
- import { createBisInstanceLabelSelectClauseFactory, ECClassHierarchyInspector } from "@itwin/presentation-shared";
365
+ import { createBisInstanceLabelSelectClauseFactory, ECSchemaProvider } from "@itwin/presentation-shared";
381
366
 
382
- const classHierarchyInspector: ECClassHierarchyInspector = getClassHierarchyInspector();
383
- const labelsFactory = createBisInstanceLabelSelectClauseFactory({ classHierarchyInspector });
367
+ const imodelAccess: ECSchemaProvider = getSchemaProvider();
368
+ const labelsFactory = createBisInstanceLabelSelectClauseFactory({ imodelAccess });
384
369
  const ecsql = `SELECT ${await labelsFactory.createSelectClause({ classAlias: "element" })} AS [Label] FROM [BisCore].[Element] AS [element]`;
385
370
  // ...
386
371
  ```
@@ -397,7 +382,7 @@ Example usage:
397
382
  ```ts
398
383
  import { createIModelInstanceLabelSelectClauseFactory } from "@itwin/presentation-shared";
399
384
 
400
- // `imodelAccess` must satisfy `ECSqlQueryExecutor & ECClassHierarchyInspector & ECSchemaProvider`
385
+ // `imodelAccess` must satisfy `ECSqlQueryExecutor & ECSchemaProvider`
401
386
  const labelsFactory = createIModelInstanceLabelSelectClauseFactory({ imodelAccess });
402
387
  const ecsql = `SELECT ${await labelsFactory.createSelectClause({ classAlias: "element" })} AS [Label] FROM [BisCore].[Element] AS [element]`;
403
388
  // ...
@@ -1,5 +1,6 @@
1
1
  export * as ECSql from "./shared/ecsql-snippets/index.js";
2
2
  export { ConcatenatedValue, ConcatenatedValuePart } from "./shared/ConcatenatedValue.js";
3
+ export { eachValueFrom } from "./shared/EachValueFrom.js";
3
4
  export { ECSqlBinding } from "./shared/ECSqlCore.js";
4
5
  export type { ECSqlQueryDef, ECSqlQueryExecutor, ECSqlQueryReaderOptions, ECSqlQueryRow } from "./shared/ECSqlCore.js";
5
6
  export type { IPrimitiveValueFormatter } from "./shared/Formatting.js";
@@ -14,9 +15,9 @@ export type { ILogger, LogFunction, LogLevel } from "./shared/Logging.js";
14
15
  export { NOOP_LOGGER } from "./shared/Logging.js";
15
16
  export type { ArrayElement, OmitOverUnion, Props } from "./shared/MappedTypes.js";
16
17
  export type { ArrayValueDescriptor, EC, ECClassHierarchyInspector, ECSchemaProvider, NavigationValueDescriptor, PrimitiveValueDescriptor, PrimitiveValueType, RelationshipPath, StructValueDescriptor, ValueDescriptor, } from "./shared/Metadata.js";
17
- export { createCachingECClassHierarchyInspector, getClass } from "./shared/Metadata.js";
18
+ export { createCachingECClassHierarchyInspector, getClass, } from "./shared/Metadata.js";
18
19
  export { createMainThreadReleaseOnTimePassedHandler, julianToDateTime, normalizeFullClassName, parseFullClassName, releaseMainThread, trimWhitespace, } from "./shared/Utils.js";
19
20
  export { InstanceKey, PrimitiveValue, TypedPrimitiveValue } from "./shared/Values.js";
20
- export type { ArrayValue, StructValue, Value, Point2dValue, Point3dValue } from "./shared/Values.js";
21
+ export type { ArrayValue, StructValue, NavigationValue, Value, Point2dValue, Point3dValue } from "./shared/Values.js";
21
22
  export type { Event, RaisableEvent, EventArgs, EventListener } from "./shared/Event.js";
22
23
  //# sourceMappingURL=presentation-shared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"presentation-shared.d.ts","sourceRoot":"","sources":["../src/presentation-shared.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACvH,YAAY,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,YAAY,EAAE,iCAAiC,EAAE,MAAM,8CAA8C,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,6CAA6C,EAAE,MAAM,kFAAkF,CAAC;AACjJ,OAAO,EAAE,gDAAgD,EAAE,MAAM,qFAAqF,CAAC;AACvJ,OAAO,EAAE,yCAAyC,EAAE,MAAM,8EAA8E,CAAC;AACzI,OAAO,EAAE,4CAA4C,EAAE,MAAM,iFAAiF,CAAC;AAC/I,YAAY,EAAE,OA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AM,mBAAmB,CAAC"}
@@ -4,6 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  export * as ECSql from "./shared/ecsql-snippets/index.js";
6
6
  export { ConcatenatedValue, ConcatenatedValuePart } from "./shared/ConcatenatedValue.js";
7
+ export { eachValueFrom } from "./shared/EachValueFrom.js";
7
8
  export { ECSqlBinding } from "./shared/ECSqlCore.js";
8
9
  export { createDefaultValueFormatter, formatConcatenatedValue } from "./shared/Formatting.js";
9
10
  export { parseInstanceLabel } from "./shared/InstanceLabelSelectClauseFactory.js";
@@ -12,7 +13,9 @@ export { createClassBasedInstanceLabelSelectClauseFactory } from "./shared/insta
12
13
  export { createBisInstanceLabelSelectClauseFactory } from "./shared/instance-label-factory-impls/BisInstanceLabelSelectClauseFactory.js";
13
14
  export { createIModelInstanceLabelSelectClauseFactory } from "./shared/instance-label-factory-impls/IModelInstanceLabelSelectClauseFactory.js";
14
15
  export { NOOP_LOGGER } from "./shared/Logging.js";
15
- export { createCachingECClassHierarchyInspector, getClass } from "./shared/Metadata.js";
16
+ export {
17
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
18
+ createCachingECClassHierarchyInspector, getClass, } from "./shared/Metadata.js";
16
19
  export { createMainThreadReleaseOnTimePassedHandler, julianToDateTime, normalizeFullClassName, parseFullClassName, releaseMainThread, trimWhitespace, } from "./shared/Utils.js";
17
20
  export { InstanceKey, PrimitiveValue, TypedPrimitiveValue } from "./shared/Values.js";
18
21
  //# sourceMappingURL=presentation-shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"presentation-shared.js","sourceRoot":"","sources":["../src/presentation-shared.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,2BAA2B,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EAAE,4CAA4C,EAAE,MAAM,iFAAiF,CAAC;AAE/I,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAelD,OAAO;AACL,4DAA4D;AAC5D,sCAAsC,EACtC,QAAQ,GACT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,0CAA0C,EAC1C,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The subscription operations required by `eachValueFrom`.
3
+ *
4
+ * @public
5
+ */
6
+ export interface Subscribable<T> {
7
+ /**
8
+ * Subscribes to stream notifications.
9
+ */
10
+ subscribe(observer: {
11
+ next: (value: T) => void;
12
+ error: (reason: unknown) => void;
13
+ complete: () => void;
14
+ }): {
15
+ unsubscribe: () => void;
16
+ };
17
+ }
18
+ /**
19
+ * Converts a subscribable stream into an async iterator.
20
+ *
21
+ * This is pretty much a combination of:
22
+ * - https://github.com/benlesh/rxjs-for-await/blob/94f9cf9cb015ac3700dfd1850eb81d36962eb70f/src/index.ts#L33,
23
+ * - https://github.com/ReactiveX/rxjs/blob/2587ee852eb43eeb0883a7787bac2944d823392b/packages/observable/src/observable.ts#L922.
24
+ *
25
+ * Our implementation uses a linked list rather than an array to store values, which is more efficient.
26
+ *
27
+ * @public
28
+ */
29
+ export declare function eachValueFrom<T>(source: Subscribable<T>): AsyncIterableIterator<T>;
30
+ //# sourceMappingURL=EachValueFrom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EachValueFrom.d.ts","sourceRoot":"","sources":["../../src/shared/EachValueFrom.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE;QAAE,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;QAAC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;QAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG;QACzG,WAAW,EAAE,MAAM,IAAI,CAAC;KACzB,CAAC;CACH;AAED;;;;;;;;;;GAUG;AACH,wBAAuB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,CA0DzF"}
@@ -0,0 +1,115 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ // cspell:words deferreds
6
+ /**
7
+ * Converts a subscribable stream into an async iterator.
8
+ *
9
+ * This is pretty much a combination of:
10
+ * - https://github.com/benlesh/rxjs-for-await/blob/94f9cf9cb015ac3700dfd1850eb81d36962eb70f/src/index.ts#L33,
11
+ * - https://github.com/ReactiveX/rxjs/blob/2587ee852eb43eeb0883a7787bac2944d823392b/packages/observable/src/observable.ts#L922.
12
+ *
13
+ * Our implementation uses a linked list rather than an array to store values, which is more efficient.
14
+ *
15
+ * @public
16
+ */
17
+ export async function* eachValueFrom(source) {
18
+ const deferreds = new Queue();
19
+ const values = new Queue();
20
+ let error;
21
+ let completed = false;
22
+ const subs = source.subscribe({
23
+ next: (value) => {
24
+ const deferred = deferreds.pop();
25
+ if (deferred) {
26
+ deferred.resolve({ value, done: false });
27
+ }
28
+ else {
29
+ values.push(value);
30
+ }
31
+ },
32
+ error: (err) => {
33
+ error = err;
34
+ for (let deferred = deferreds.pop(); deferred !== undefined; deferred = deferreds.pop()) {
35
+ deferred.reject(err);
36
+ }
37
+ },
38
+ complete: () => {
39
+ completed = true;
40
+ for (let deferred = deferreds.pop(); deferred !== undefined; deferred = deferreds.pop()) {
41
+ deferred.resolve({ value: undefined, done: true });
42
+ }
43
+ },
44
+ });
45
+ try {
46
+ while (true) {
47
+ if (!values.isEmpty) {
48
+ // The queue is non-empty, so this is an actual buffered value — possibly a legitimately
49
+ // emitted `undefined`, which is why emptiness is checked explicitly rather than by
50
+ // comparing the popped value to `undefined`.
51
+ yield values.pop();
52
+ continue;
53
+ }
54
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
55
+ if (completed) {
56
+ return;
57
+ }
58
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
59
+ if (error) {
60
+ // eslint-disable-next-line @typescript-eslint/only-throw-error
61
+ throw error;
62
+ }
63
+ const result = await new Promise((resolve, reject) => {
64
+ deferreds.push({ resolve, reject });
65
+ });
66
+ if (result.done) {
67
+ return;
68
+ }
69
+ yield result.value;
70
+ }
71
+ }
72
+ catch (err) {
73
+ throw err;
74
+ }
75
+ finally {
76
+ subs.unsubscribe();
77
+ }
78
+ }
79
+ class QueueEntry {
80
+ value;
81
+ next;
82
+ constructor(value, next) {
83
+ this.value = value;
84
+ this.next = next;
85
+ }
86
+ }
87
+ class Queue {
88
+ _front;
89
+ _back;
90
+ get isEmpty() {
91
+ return this._front === undefined;
92
+ }
93
+ push(item) {
94
+ const entry = new QueueEntry(item);
95
+ if (this._back) {
96
+ this._back.next = entry;
97
+ }
98
+ this._back = entry;
99
+ if (!this._front) {
100
+ this._front = entry;
101
+ }
102
+ }
103
+ pop() {
104
+ if (!this._front) {
105
+ return undefined;
106
+ }
107
+ const value = this._front.value;
108
+ this._front = this._front.next;
109
+ if (!this._front) {
110
+ this._back = undefined;
111
+ }
112
+ return value;
113
+ }
114
+ }
115
+ //# sourceMappingURL=EachValueFrom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EachValueFrom.js","sourceRoot":"","sources":["../../src/shared/EachValueFrom.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,yBAAyB;AAgBzB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,K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