@itwin/presentation-backend 4.0.0-dev.8 → 4.0.0-dev.80

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 (59) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/lib/cjs/assets/supplemental-presentation-rules/BisCore.PresentationRuleSet.json +5 -3
  3. package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts +41 -41
  4. package/lib/cjs/presentation-backend/BackendLoggerCategory.js +50 -50
  5. package/lib/cjs/presentation-backend/Constants.d.ts +8 -8
  6. package/lib/cjs/presentation-backend/Constants.js +40 -36
  7. package/lib/cjs/presentation-backend/Constants.js.map +1 -1
  8. package/lib/cjs/presentation-backend/ElementPropertiesHelper.d.ts +11 -11
  9. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js +260 -262
  10. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js.map +1 -1
  11. package/lib/cjs/presentation-backend/NativePlatform.d.ts +87 -87
  12. package/lib/cjs/presentation-backend/NativePlatform.d.ts.map +1 -1
  13. package/lib/cjs/presentation-backend/NativePlatform.js +140 -140
  14. package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
  15. package/lib/cjs/presentation-backend/Presentation.d.ts +106 -106
  16. package/lib/cjs/presentation-backend/Presentation.d.ts.map +1 -1
  17. package/lib/cjs/presentation-backend/Presentation.js +148 -150
  18. package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
  19. package/lib/cjs/presentation-backend/PresentationIpcHandler.d.ts +12 -12
  20. package/lib/cjs/presentation-backend/PresentationIpcHandler.js +41 -41
  21. package/lib/cjs/presentation-backend/PresentationManager.d.ts +456 -445
  22. package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
  23. package/lib/cjs/presentation-backend/PresentationManager.js +309 -311
  24. package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
  25. package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts +61 -61
  26. package/lib/cjs/presentation-backend/PresentationManagerDetail.js +430 -430
  27. package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
  28. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts +62 -62
  29. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
  30. package/lib/cjs/presentation-backend/PresentationRpcImpl.js +388 -388
  31. package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
  32. package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts +102 -102
  33. package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts.map +1 -1
  34. package/lib/cjs/presentation-backend/RulesetEmbedder.js +284 -279
  35. package/lib/cjs/presentation-backend/RulesetEmbedder.js.map +1 -1
  36. package/lib/cjs/presentation-backend/RulesetManager.d.ts +53 -53
  37. package/lib/cjs/presentation-backend/RulesetManager.js +73 -73
  38. package/lib/cjs/presentation-backend/RulesetVariablesManager.d.ts +140 -140
  39. package/lib/cjs/presentation-backend/RulesetVariablesManager.js +129 -129
  40. package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts +28 -28
  41. package/lib/cjs/presentation-backend/SelectionScopesHelper.js +210 -213
  42. package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
  43. package/lib/cjs/presentation-backend/TemporaryStorage.d.ts +123 -123
  44. package/lib/cjs/presentation-backend/TemporaryStorage.js +151 -151
  45. package/lib/cjs/presentation-backend/UpdatesTracker.d.ts +27 -27
  46. package/lib/cjs/presentation-backend/UpdatesTracker.js +54 -54
  47. package/lib/cjs/presentation-backend/Utils.d.ts +49 -49
  48. package/lib/cjs/presentation-backend/Utils.d.ts.map +1 -1
  49. package/lib/cjs/presentation-backend/Utils.js +107 -106
  50. package/lib/cjs/presentation-backend/Utils.js.map +1 -1
  51. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.d.ts +16 -16
  52. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js +55 -51
  53. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
  54. package/lib/cjs/presentation-backend/domain/RulesetElements.d.ts +21 -21
  55. package/lib/cjs/presentation-backend/domain/RulesetElements.js +38 -38
  56. package/lib/cjs/presentation-backend.d.ts +19 -19
  57. package/lib/cjs/presentation-backend.js +39 -35
  58. package/lib/cjs/presentation-backend.js.map +1 -1
  59. package/package.json +18 -18
@@ -1,124 +1,124 @@
1
- /** @packageDocumentation
2
- * @module Core
3
- */
4
- import { IDisposable } from "@itwin/core-bentley";
5
- /**
6
- * Configuration properties for [[TemporaryStorage]].
7
- * @internal
8
- */
9
- export interface TemporaryStorageProps<T> {
10
- /** A method that's called for every value before it's removed from storage */
11
- cleanupHandler?: (id: string, value: T, reason: "timeout" | "dispose" | "request") => void;
12
- onDisposedSingle?: (id: string) => void;
13
- onDisposedAll?: () => void;
14
- /**
15
- * An interval at which the storage attempts to clean up its values.
16
- * When `0` or `undefined` is specified, values are not cleaned up
17
- * automatically and cleanup has to be initiated manually by calling
18
- * [[TemporaryStorage.disposeOutdatedValues]].
19
- */
20
- cleanupInterval?: number;
21
- /**
22
- * Shortest period of time which the value should be kept in storage
23
- * unused before it's cleaned up.
24
- *
25
- * `undefined` means the values may be kept unused in the storage indefinitely.
26
- * `0` means the values are removed from the storage on every cleanup (either manual
27
- * call to [[TemporaryStorage.disposeOutdatedValues]] or scheduled (controlled
28
- * by [[cleanupInterval]])).
29
- */
30
- unusedValueLifetime?: number;
31
- /**
32
- * The maximum period of time which the value should be kept in storage
33
- * before it's cleaned up. The time is measured from the moment the value is added
34
- * to the storage.
35
- *
36
- * `undefined` means the values may be kept indefinitely. `0` means they're removed
37
- * up on every cleanup (either manual call to [[TemporaryStorage.disposeOutdatedValues]]
38
- * or scheduled (controlled by [[cleanupInterval]])).
39
- */
40
- maxValueLifetime?: number;
41
- }
42
- /** Value with know last used time */
43
- interface TemporaryValue<T> {
44
- created: Date;
45
- lastUsed: Date;
46
- value: T;
47
- }
48
- /**
49
- * Storage for values that get removed from it after being unused (not-requested
50
- * for a specified amount of time).
51
- *
52
- * @internal
53
- */
54
- export declare class TemporaryStorage<T> implements IDisposable {
55
- private _timer?;
56
- protected _values: Map<string, TemporaryValue<T>>;
57
- readonly props: TemporaryStorageProps<T>;
58
- /**
59
- * Constructor. Creates the storage using supplied params.
60
- */
61
- constructor(props: TemporaryStorageProps<T>);
62
- /**
63
- * Destructor. Must be called to clean up the stored values
64
- * and other resources
65
- */
66
- dispose(): void;
67
- /**
68
- * Cleans up values that are currently outdated (based
69
- * on their max and unused value lifetimes specified through [[Props]]).
70
- */
71
- disposeOutdatedValues: () => void;
72
- private deleteExistingEntry;
73
- /**
74
- * Get a value from the storage.
75
- *
76
- * **Note:** requesting a value with this method updates it's last used time.
77
- */
78
- getValue(id: string): T | undefined;
79
- notifyValueUsed(id: string): void;
80
- /**
81
- * Adds a value into the storage.
82
- * @throws An error when trying to add a value with ID that's already stored in the storage.
83
- */
84
- addValue(id: string, value: T): void;
85
- /** Deletes a value with given id. */
86
- deleteValue(id: string): void;
87
- /**
88
- * Get all values currently in this storage.
89
- *
90
- * **Note:** requesting values with this method **doesn't**
91
- * update their last used times.
92
- */
93
- get values(): T[];
94
- }
95
- /**
96
- * Configuration properties for [[FactoryBasedTemporaryStorage]].
97
- * @internal
98
- */
99
- export interface FactoryBasedTemporaryStorageProps<T> extends TemporaryStorageProps<T> {
100
- /** A factory method that creates a stored value given it's identifier */
101
- factory: (id: string, onValueUsed: () => void) => T;
102
- }
103
- /**
104
- * Storage for values that get removed from it after being unused (not-requested
105
- * for a specified amount of time).
106
- *
107
- * @internal
108
- */
109
- export declare class FactoryBasedTemporaryStorage<T> extends TemporaryStorage<T> {
110
- readonly props: FactoryBasedTemporaryStorageProps<T>;
111
- /**
112
- * Constructor. Creates the storage using supplied params.
113
- */
114
- constructor(props: FactoryBasedTemporaryStorageProps<T>);
115
- /**
116
- * Get a value from the storage. If the value with the specified id
117
- * doesn't exist, it gets created.
118
- *
119
- * **Note:** requesting a value with this method updates it's last used time.
120
- */
121
- getValue(id: string): T;
122
- }
123
- export {};
1
+ /** @packageDocumentation
2
+ * @module Core
3
+ */
4
+ import { IDisposable } from "@itwin/core-bentley";
5
+ /**
6
+ * Configuration properties for [[TemporaryStorage]].
7
+ * @internal
8
+ */
9
+ export interface TemporaryStorageProps<T> {
10
+ /** A method that's called for every value before it's removed from storage */
11
+ cleanupHandler?: (id: string, value: T, reason: "timeout" | "dispose" | "request") => void;
12
+ onDisposedSingle?: (id: string) => void;
13
+ onDisposedAll?: () => void;
14
+ /**
15
+ * An interval at which the storage attempts to clean up its values.
16
+ * When `0` or `undefined` is specified, values are not cleaned up
17
+ * automatically and cleanup has to be initiated manually by calling
18
+ * [[TemporaryStorage.disposeOutdatedValues]].
19
+ */
20
+ cleanupInterval?: number;
21
+ /**
22
+ * Shortest period of time which the value should be kept in storage
23
+ * unused before it's cleaned up.
24
+ *
25
+ * `undefined` means the values may be kept unused in the storage indefinitely.
26
+ * `0` means the values are removed from the storage on every cleanup (either manual
27
+ * call to [[TemporaryStorage.disposeOutdatedValues]] or scheduled (controlled
28
+ * by [[cleanupInterval]])).
29
+ */
30
+ unusedValueLifetime?: number;
31
+ /**
32
+ * The maximum period of time which the value should be kept in storage
33
+ * before it's cleaned up. The time is measured from the moment the value is added
34
+ * to the storage.
35
+ *
36
+ * `undefined` means the values may be kept indefinitely. `0` means they're removed
37
+ * up on every cleanup (either manual call to [[TemporaryStorage.disposeOutdatedValues]]
38
+ * or scheduled (controlled by [[cleanupInterval]])).
39
+ */
40
+ maxValueLifetime?: number;
41
+ }
42
+ /** Value with know last used time */
43
+ interface TemporaryValue<T> {
44
+ created: Date;
45
+ lastUsed: Date;
46
+ value: T;
47
+ }
48
+ /**
49
+ * Storage for values that get removed from it after being unused (not-requested
50
+ * for a specified amount of time).
51
+ *
52
+ * @internal
53
+ */
54
+ export declare class TemporaryStorage<T> implements IDisposable {
55
+ private _timer?;
56
+ protected _values: Map<string, TemporaryValue<T>>;
57
+ readonly props: TemporaryStorageProps<T>;
58
+ /**
59
+ * Constructor. Creates the storage using supplied params.
60
+ */
61
+ constructor(props: TemporaryStorageProps<T>);
62
+ /**
63
+ * Destructor. Must be called to clean up the stored values
64
+ * and other resources
65
+ */
66
+ dispose(): void;
67
+ /**
68
+ * Cleans up values that are currently outdated (based
69
+ * on their max and unused value lifetimes specified through [[Props]]).
70
+ */
71
+ disposeOutdatedValues: () => void;
72
+ private deleteExistingEntry;
73
+ /**
74
+ * Get a value from the storage.
75
+ *
76
+ * **Note:** requesting a value with this method updates it's last used time.
77
+ */
78
+ getValue(id: string): T | undefined;
79
+ notifyValueUsed(id: string): void;
80
+ /**
81
+ * Adds a value into the storage.
82
+ * @throws An error when trying to add a value with ID that's already stored in the storage.
83
+ */
84
+ addValue(id: string, value: T): void;
85
+ /** Deletes a value with given id. */
86
+ deleteValue(id: string): void;
87
+ /**
88
+ * Get all values currently in this storage.
89
+ *
90
+ * **Note:** requesting values with this method **doesn't**
91
+ * update their last used times.
92
+ */
93
+ get values(): T[];
94
+ }
95
+ /**
96
+ * Configuration properties for [[FactoryBasedTemporaryStorage]].
97
+ * @internal
98
+ */
99
+ export interface FactoryBasedTemporaryStorageProps<T> extends TemporaryStorageProps<T> {
100
+ /** A factory method that creates a stored value given it's identifier */
101
+ factory: (id: string, onValueUsed: () => void) => T;
102
+ }
103
+ /**
104
+ * Storage for values that get removed from it after being unused (not-requested
105
+ * for a specified amount of time).
106
+ *
107
+ * @internal
108
+ */
109
+ export declare class FactoryBasedTemporaryStorage<T> extends TemporaryStorage<T> {
110
+ readonly props: FactoryBasedTemporaryStorageProps<T>;
111
+ /**
112
+ * Constructor. Creates the storage using supplied params.
113
+ */
114
+ constructor(props: FactoryBasedTemporaryStorageProps<T>);
115
+ /**
116
+ * Get a value from the storage. If the value with the specified id
117
+ * doesn't exist, it gets created.
118
+ *
119
+ * **Note:** requesting a value with this method updates it's last used time.
120
+ */
121
+ getValue(id: string): T;
122
+ }
123
+ export {};
124
124
  //# sourceMappingURL=TemporaryStorage.d.ts.map
@@ -1,152 +1,152 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Core
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.FactoryBasedTemporaryStorage = exports.TemporaryStorage = void 0;
11
- const core_bentley_1 = require("@itwin/core-bentley");
12
- const presentation_common_1 = require("@itwin/presentation-common");
13
- /**
14
- * Storage for values that get removed from it after being unused (not-requested
15
- * for a specified amount of time).
16
- *
17
- * @internal
18
- */
19
- class TemporaryStorage {
20
- /**
21
- * Constructor. Creates the storage using supplied params.
22
- */
23
- constructor(props) {
24
- /**
25
- * Cleans up values that are currently outdated (based
26
- * on their max and unused value lifetimes specified through [[Props]]).
27
- */
28
- this.disposeOutdatedValues = () => {
29
- const now = (new Date()).getTime();
30
- const valuesToDispose = [];
31
- for (const [key, entry] of this._values.entries()) {
32
- if (this.props.maxValueLifetime !== undefined) {
33
- if (this.props.maxValueLifetime === 0 || (now - entry.created.getTime()) > this.props.maxValueLifetime) {
34
- valuesToDispose.push(key);
35
- continue;
36
- }
37
- }
38
- if (this.props.unusedValueLifetime !== undefined) {
39
- if (this.props.unusedValueLifetime === 0 || (now - entry.lastUsed.getTime()) > this.props.unusedValueLifetime) {
40
- valuesToDispose.push(key);
41
- continue;
42
- }
43
- }
44
- }
45
- for (const id of valuesToDispose)
46
- this.deleteExistingEntry(id, true);
47
- };
48
- this.props = props;
49
- this._values = new Map();
50
- if (this.props.cleanupInterval)
51
- this._timer = setInterval(this.disposeOutdatedValues, this.props.cleanupInterval);
52
- }
53
- /**
54
- * Destructor. Must be called to clean up the stored values
55
- * and other resources
56
- */
57
- dispose() {
58
- if (this._timer)
59
- clearInterval(this._timer);
60
- if (this.props.cleanupHandler) {
61
- this._values.forEach((v, id) => {
62
- this.props.cleanupHandler(id, v.value, "dispose");
63
- });
64
- }
65
- this._values.clear();
66
- this.props.onDisposedAll && this.props.onDisposedAll();
67
- }
68
- deleteExistingEntry(id, isTimeout) {
69
- (0, core_bentley_1.assert)(this._values.has(id));
70
- this.props.cleanupHandler && this.props.cleanupHandler(id, this._values.get(id).value, isTimeout ? "timeout" : "request");
71
- this._values.delete(id);
72
- this.props.onDisposedSingle && this.props.onDisposedSingle(id);
73
- }
74
- /**
75
- * Get a value from the storage.
76
- *
77
- * **Note:** requesting a value with this method updates it's last used time.
78
- */
79
- getValue(id) {
80
- if (this._values.has(id)) {
81
- const v = this._values.get(id);
82
- v.lastUsed = new Date();
83
- return v.value;
84
- }
85
- return undefined;
86
- }
87
- notifyValueUsed(id) {
88
- const entry = this._values.get(id);
89
- // istanbul ignore else
90
- if (entry)
91
- entry.lastUsed = new Date();
92
- }
93
- /**
94
- * Adds a value into the storage.
95
- * @throws An error when trying to add a value with ID that's already stored in the storage.
96
- */
97
- addValue(id, value) {
98
- if (this._values.has(id))
99
- throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.InvalidArgument, `A value with given ID "${id}" already exists in this storage.`);
100
- this._values.set(id, { value, created: new Date(), lastUsed: new Date() });
101
- }
102
- /** Deletes a value with given id. */
103
- deleteValue(id) {
104
- // istanbul ignore else
105
- if (this._values.has(id))
106
- this.deleteExistingEntry(id, false);
107
- }
108
- /**
109
- * Get all values currently in this storage.
110
- *
111
- * **Note:** requesting values with this method **doesn't**
112
- * update their last used times.
113
- */
114
- get values() {
115
- const values = new Array();
116
- for (const v of this._values.values())
117
- values.push(v.value);
118
- return values;
119
- }
120
- }
121
- exports.TemporaryStorage = TemporaryStorage;
122
- /**
123
- * Storage for values that get removed from it after being unused (not-requested
124
- * for a specified amount of time).
125
- *
126
- * @internal
127
- */
128
- class FactoryBasedTemporaryStorage extends TemporaryStorage {
129
- /**
130
- * Constructor. Creates the storage using supplied params.
131
- */
132
- constructor(props) {
133
- super(props);
134
- this.props = props;
135
- }
136
- /**
137
- * Get a value from the storage. If the value with the specified id
138
- * doesn't exist, it gets created.
139
- *
140
- * **Note:** requesting a value with this method updates it's last used time.
141
- */
142
- getValue(id) {
143
- const existingValue = super.getValue(id);
144
- if (existingValue)
145
- return existingValue;
146
- const value = this.props.factory(id, () => this.notifyValueUsed(id));
147
- this.addValue(id, value);
148
- return value;
149
- }
150
- }
151
- exports.FactoryBasedTemporaryStorage = FactoryBasedTemporaryStorage;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Core
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.FactoryBasedTemporaryStorage = exports.TemporaryStorage = void 0;
11
+ const core_bentley_1 = require("@itwin/core-bentley");
12
+ const presentation_common_1 = require("@itwin/presentation-common");
13
+ /**
14
+ * Storage for values that get removed from it after being unused (not-requested
15
+ * for a specified amount of time).
16
+ *
17
+ * @internal
18
+ */
19
+ class TemporaryStorage {
20
+ /**
21
+ * Constructor. Creates the storage using supplied params.
22
+ */
23
+ constructor(props) {
24
+ /**
25
+ * Cleans up values that are currently outdated (based
26
+ * on their max and unused value lifetimes specified through [[Props]]).
27
+ */
28
+ this.disposeOutdatedValues = () => {
29
+ const now = (new Date()).getTime();
30
+ const valuesToDispose = [];
31
+ for (const [key, entry] of this._values.entries()) {
32
+ if (this.props.maxValueLifetime !== undefined) {
33
+ if (this.props.maxValueLifetime === 0 || (now - entry.created.getTime()) > this.props.maxValueLifetime) {
34
+ valuesToDispose.push(key);
35
+ continue;
36
+ }
37
+ }
38
+ if (this.props.unusedValueLifetime !== undefined) {
39
+ if (this.props.unusedValueLifetime === 0 || (now - entry.lastUsed.getTime()) > this.props.unusedValueLifetime) {
40
+ valuesToDispose.push(key);
41
+ continue;
42
+ }
43
+ }
44
+ }
45
+ for (const id of valuesToDispose)
46
+ this.deleteExistingEntry(id, true);
47
+ };
48
+ this.props = props;
49
+ this._values = new Map();
50
+ if (this.props.cleanupInterval)
51
+ this._timer = setInterval(this.disposeOutdatedValues, this.props.cleanupInterval);
52
+ }
53
+ /**
54
+ * Destructor. Must be called to clean up the stored values
55
+ * and other resources
56
+ */
57
+ dispose() {
58
+ if (this._timer)
59
+ clearInterval(this._timer);
60
+ if (this.props.cleanupHandler) {
61
+ this._values.forEach((v, id) => {
62
+ this.props.cleanupHandler(id, v.value, "dispose");
63
+ });
64
+ }
65
+ this._values.clear();
66
+ this.props.onDisposedAll && this.props.onDisposedAll();
67
+ }
68
+ deleteExistingEntry(id, isTimeout) {
69
+ (0, core_bentley_1.assert)(this._values.has(id));
70
+ this.props.cleanupHandler && this.props.cleanupHandler(id, this._values.get(id).value, isTimeout ? "timeout" : "request");
71
+ this._values.delete(id);
72
+ this.props.onDisposedSingle && this.props.onDisposedSingle(id);
73
+ }
74
+ /**
75
+ * Get a value from the storage.
76
+ *
77
+ * **Note:** requesting a value with this method updates it's last used time.
78
+ */
79
+ getValue(id) {
80
+ if (this._values.has(id)) {
81
+ const v = this._values.get(id);
82
+ v.lastUsed = new Date();
83
+ return v.value;
84
+ }
85
+ return undefined;
86
+ }
87
+ notifyValueUsed(id) {
88
+ const entry = this._values.get(id);
89
+ // istanbul ignore else
90
+ if (entry)
91
+ entry.lastUsed = new Date();
92
+ }
93
+ /**
94
+ * Adds a value into the storage.
95
+ * @throws An error when trying to add a value with ID that's already stored in the storage.
96
+ */
97
+ addValue(id, value) {
98
+ if (this._values.has(id))
99
+ throw new presentation_common_1.PresentationError(presentation_common_1.PresentationStatus.InvalidArgument, `A value with given ID "${id}" already exists in this storage.`);
100
+ this._values.set(id, { value, created: new Date(), lastUsed: new Date() });
101
+ }
102
+ /** Deletes a value with given id. */
103
+ deleteValue(id) {
104
+ // istanbul ignore else
105
+ if (this._values.has(id))
106
+ this.deleteExistingEntry(id, false);
107
+ }
108
+ /**
109
+ * Get all values currently in this storage.
110
+ *
111
+ * **Note:** requesting values with this method **doesn't**
112
+ * update their last used times.
113
+ */
114
+ get values() {
115
+ const values = new Array();
116
+ for (const v of this._values.values())
117
+ values.push(v.value);
118
+ return values;
119
+ }
120
+ }
121
+ exports.TemporaryStorage = TemporaryStorage;
122
+ /**
123
+ * Storage for values that get removed from it after being unused (not-requested
124
+ * for a specified amount of time).
125
+ *
126
+ * @internal
127
+ */
128
+ class FactoryBasedTemporaryStorage extends TemporaryStorage {
129
+ /**
130
+ * Constructor. Creates the storage using supplied params.
131
+ */
132
+ constructor(props) {
133
+ super(props);
134
+ this.props = props;
135
+ }
136
+ /**
137
+ * Get a value from the storage. If the value with the specified id
138
+ * doesn't exist, it gets created.
139
+ *
140
+ * **Note:** requesting a value with this method updates it's last used time.
141
+ */
142
+ getValue(id) {
143
+ const existingValue = super.getValue(id);
144
+ if (existingValue)
145
+ return existingValue;
146
+ const value = this.props.factory(id, () => this.notifyValueUsed(id));
147
+ this.addValue(id, value);
148
+ return value;
149
+ }
150
+ }
151
+ exports.FactoryBasedTemporaryStorage = FactoryBasedTemporaryStorage;
152
152
  //# sourceMappingURL=TemporaryStorage.js.map
@@ -1,28 +1,28 @@
1
- /** @packageDocumentation
2
- * @module Core
3
- */
4
- import { IDisposable } from "@itwin/core-bentley";
5
- import { NativePlatformDefinition } from "./NativePlatform";
6
- /**
7
- * Configuration properties for [[UpdatesTracker]].
8
- * @internal
9
- */
10
- export interface UpdatesTrackerProps {
11
- nativePlatformGetter: () => NativePlatformDefinition;
12
- pollInterval: number;
13
- }
14
- /**
15
- * An updates handler which polls native platform for update records
16
- * and emits an event to the frontend if any are found.
17
- *
18
- * @internal
19
- */
20
- export declare class UpdatesTracker implements IDisposable {
21
- private _getNativePlatform;
22
- private _intervalHandle;
23
- private constructor();
24
- static create(props: UpdatesTrackerProps): UpdatesTracker;
25
- dispose(): void;
26
- private onInterval;
27
- }
1
+ /** @packageDocumentation
2
+ * @module Core
3
+ */
4
+ import { IDisposable } from "@itwin/core-bentley";
5
+ import { NativePlatformDefinition } from "./NativePlatform";
6
+ /**
7
+ * Configuration properties for [[UpdatesTracker]].
8
+ * @internal
9
+ */
10
+ export interface UpdatesTrackerProps {
11
+ nativePlatformGetter: () => NativePlatformDefinition;
12
+ pollInterval: number;
13
+ }
14
+ /**
15
+ * An updates handler which polls native platform for update records
16
+ * and emits an event to the frontend if any are found.
17
+ *
18
+ * @internal
19
+ */
20
+ export declare class UpdatesTracker implements IDisposable {
21
+ private _getNativePlatform;
22
+ private _intervalHandle;
23
+ private constructor();
24
+ static create(props: UpdatesTrackerProps): UpdatesTracker;
25
+ dispose(): void;
26
+ private onInterval;
27
+ }
28
28
  //# sourceMappingURL=UpdatesTracker.d.ts.map