@itwin/core-backend 3.4.0-dev.48 → 3.4.0-dev.55

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 (245) hide show
  1. package/lib/cjs/AliCloudStorageService.d.ts +23 -17
  2. package/lib/cjs/AliCloudStorageService.d.ts.map +1 -1
  3. package/lib/cjs/AliCloudStorageService.js +71 -68
  4. package/lib/cjs/AliCloudStorageService.js.map +1 -1
  5. package/lib/cjs/BackendHubAccess.d.ts +224 -224
  6. package/lib/cjs/BackendHubAccess.js +41 -41
  7. package/lib/cjs/BackendHubAccess.js.map +1 -1
  8. package/lib/cjs/BackendLoggerCategory.d.ts +91 -82
  9. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
  10. package/lib/cjs/BackendLoggerCategory.js +99 -90
  11. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  12. package/lib/cjs/BisCoreSchema.d.ts +21 -21
  13. package/lib/cjs/BisCoreSchema.js +60 -60
  14. package/lib/cjs/BisCoreSchema.js.map +1 -1
  15. package/lib/cjs/BriefcaseManager.d.ts +165 -165
  16. package/lib/cjs/BriefcaseManager.js +405 -405
  17. package/lib/cjs/BriefcaseManager.js.map +1 -1
  18. package/lib/cjs/Category.d.ts +153 -153
  19. package/lib/cjs/Category.js +243 -243
  20. package/lib/cjs/Category.js.map +1 -1
  21. package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
  22. package/lib/cjs/ChangeSummaryManager.js +445 -445
  23. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  24. package/lib/cjs/ChangedElementsDb.d.ts +99 -99
  25. package/lib/cjs/ChangedElementsDb.js +165 -165
  26. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  27. package/lib/cjs/ChangedElementsManager.d.ts +39 -39
  28. package/lib/cjs/ChangedElementsManager.js +88 -88
  29. package/lib/cjs/ChangedElementsManager.js.map +1 -1
  30. package/lib/cjs/CheckpointManager.d.ts +120 -122
  31. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  32. package/lib/cjs/CheckpointManager.js +343 -354
  33. package/lib/cjs/CheckpointManager.js.map +1 -1
  34. package/lib/cjs/ClassRegistry.d.ts +71 -71
  35. package/lib/cjs/ClassRegistry.d.ts.map +1 -1
  36. package/lib/cjs/ClassRegistry.js +215 -213
  37. package/lib/cjs/ClassRegistry.js.map +1 -1
  38. package/lib/cjs/CloudSqlite.d.ts +328 -328
  39. package/lib/cjs/CloudSqlite.js +135 -135
  40. package/lib/cjs/CloudSqlite.js.map +1 -1
  41. package/lib/cjs/CloudStorageBackend.d.ts +58 -46
  42. package/lib/cjs/CloudStorageBackend.d.ts.map +1 -1
  43. package/lib/cjs/CloudStorageBackend.js +173 -164
  44. package/lib/cjs/CloudStorageBackend.js.map +1 -1
  45. package/lib/cjs/CodeService.d.ts +391 -391
  46. package/lib/cjs/CodeService.d.ts.map +1 -1
  47. package/lib/cjs/CodeService.js +63 -61
  48. package/lib/cjs/CodeService.js.map +1 -1
  49. package/lib/cjs/CodeSpecs.d.ts +50 -50
  50. package/lib/cjs/CodeSpecs.js +112 -112
  51. package/lib/cjs/CodeSpecs.js.map +1 -1
  52. package/lib/cjs/ConcurrentQuery.d.ts +11 -11
  53. package/lib/cjs/ConcurrentQuery.js +30 -30
  54. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  55. package/lib/cjs/CustomViewState3dCreator.d.ts +32 -32
  56. package/lib/cjs/CustomViewState3dCreator.d.ts.map +1 -1
  57. package/lib/cjs/CustomViewState3dCreator.js +113 -99
  58. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  59. package/lib/cjs/DevTools.d.ts +71 -71
  60. package/lib/cjs/DevTools.d.ts.map +1 -1
  61. package/lib/cjs/DevTools.js +154 -154
  62. package/lib/cjs/DevTools.js.map +1 -1
  63. package/lib/cjs/DisplayStyle.d.ts +106 -106
  64. package/lib/cjs/DisplayStyle.js +256 -256
  65. package/lib/cjs/DisplayStyle.js.map +1 -1
  66. package/lib/cjs/ECDb.d.ts +191 -191
  67. package/lib/cjs/ECDb.js +350 -350
  68. package/lib/cjs/ECDb.js.map +1 -1
  69. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
  70. package/lib/cjs/ECSchemaXmlContext.js +41 -41
  71. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  72. package/lib/cjs/ECSqlStatement.d.ts +466 -466
  73. package/lib/cjs/ECSqlStatement.js +791 -791
  74. package/lib/cjs/ECSqlStatement.js.map +1 -1
  75. package/lib/cjs/Element.d.ts +1109 -1109
  76. package/lib/cjs/Element.d.ts.map +1 -1
  77. package/lib/cjs/Element.js +1420 -1421
  78. package/lib/cjs/Element.js.map +1 -1
  79. package/lib/cjs/ElementAspect.d.ts +156 -156
  80. package/lib/cjs/ElementAspect.js +178 -178
  81. package/lib/cjs/ElementAspect.js.map +1 -1
  82. package/lib/cjs/ElementGraphics.d.ts +9 -9
  83. package/lib/cjs/ElementGraphics.js +41 -41
  84. package/lib/cjs/ElementGraphics.js.map +1 -1
  85. package/lib/cjs/ElementTreeWalker.d.ts +162 -162
  86. package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
  87. package/lib/cjs/ElementTreeWalker.js +409 -409
  88. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  89. package/lib/cjs/Entity.d.ts +76 -76
  90. package/lib/cjs/Entity.js +82 -82
  91. package/lib/cjs/Entity.js.map +1 -1
  92. package/lib/cjs/ExportGraphics.d.ts +317 -317
  93. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  94. package/lib/cjs/ExportGraphics.js +208 -208
  95. package/lib/cjs/ExportGraphics.js.map +1 -1
  96. package/lib/cjs/ExternalSource.d.ts +94 -94
  97. package/lib/cjs/ExternalSource.d.ts.map +1 -1
  98. package/lib/cjs/ExternalSource.js +125 -125
  99. package/lib/cjs/ExternalSource.js.map +1 -1
  100. package/lib/cjs/GeoCoordConfig.d.ts +19 -19
  101. package/lib/cjs/GeoCoordConfig.js +82 -82
  102. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  103. package/lib/cjs/GeometrySummary.d.ts +4 -4
  104. package/lib/cjs/GeometrySummary.js +380 -380
  105. package/lib/cjs/GeometrySummary.js.map +1 -1
  106. package/lib/cjs/HubMock.d.ts +93 -93
  107. package/lib/cjs/HubMock.js +190 -190
  108. package/lib/cjs/HubMock.js.map +1 -1
  109. package/lib/cjs/IModelCloneContext.d.ts +85 -85
  110. package/lib/cjs/IModelCloneContext.js +150 -150
  111. package/lib/cjs/IModelCloneContext.js.map +1 -1
  112. package/lib/cjs/IModelDb.d.ts +1164 -1164
  113. package/lib/cjs/IModelDb.d.ts.map +1 -1
  114. package/lib/cjs/IModelDb.js +2324 -2321
  115. package/lib/cjs/IModelDb.js.map +1 -1
  116. package/lib/cjs/IModelHost.d.ts +361 -347
  117. package/lib/cjs/IModelHost.d.ts.map +1 -1
  118. package/lib/cjs/IModelHost.js +491 -457
  119. package/lib/cjs/IModelHost.js.map +1 -1
  120. package/lib/cjs/IModelJsFs.d.ts +62 -62
  121. package/lib/cjs/IModelJsFs.js +140 -140
  122. package/lib/cjs/IModelJsFs.js.map +1 -1
  123. package/lib/cjs/IpcHost.d.ts +98 -98
  124. package/lib/cjs/IpcHost.js +234 -234
  125. package/lib/cjs/IpcHost.js.map +1 -1
  126. package/lib/cjs/LineStyle.d.ts +311 -311
  127. package/lib/cjs/LineStyle.js +295 -295
  128. package/lib/cjs/LineStyle.js.map +1 -1
  129. package/lib/cjs/LocalHub.d.ts +162 -162
  130. package/lib/cjs/LocalHub.js +587 -587
  131. package/lib/cjs/LocalHub.js.map +1 -1
  132. package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
  133. package/lib/cjs/LocalhostIpcHost.js +81 -81
  134. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  135. package/lib/cjs/Material.d.ts +103 -103
  136. package/lib/cjs/Material.js +147 -147
  137. package/lib/cjs/Material.js.map +1 -1
  138. package/lib/cjs/Model.d.ts +386 -386
  139. package/lib/cjs/Model.d.ts.map +1 -1
  140. package/lib/cjs/Model.js +471 -468
  141. package/lib/cjs/Model.js.map +1 -1
  142. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  143. package/lib/cjs/NativeAppStorage.js +202 -202
  144. package/lib/cjs/NativeAppStorage.js.map +1 -1
  145. package/lib/cjs/NativeHost.d.ts +52 -52
  146. package/lib/cjs/NativeHost.js +168 -168
  147. package/lib/cjs/NativeHost.js.map +1 -1
  148. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  149. package/lib/cjs/NavigationRelationship.js +225 -225
  150. package/lib/cjs/NavigationRelationship.js.map +1 -1
  151. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  152. package/lib/cjs/PromiseMemoizer.d.ts.map +1 -1
  153. package/lib/cjs/PromiseMemoizer.js +101 -95
  154. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  155. package/lib/cjs/PropertyStore.d.ts +132 -132
  156. package/lib/cjs/PropertyStore.js +11 -11
  157. package/lib/cjs/PropertyStore.js.map +1 -1
  158. package/lib/cjs/Relationship.d.ts +400 -400
  159. package/lib/cjs/Relationship.js +465 -465
  160. package/lib/cjs/Relationship.js.map +1 -1
  161. package/lib/cjs/RpcBackend.d.ts +28 -28
  162. package/lib/cjs/RpcBackend.js +126 -126
  163. package/lib/cjs/RpcBackend.js.map +1 -1
  164. package/lib/cjs/SQLiteDb.d.ts +219 -219
  165. package/lib/cjs/SQLiteDb.js +214 -214
  166. package/lib/cjs/SQLiteDb.js.map +1 -1
  167. package/lib/cjs/Schema.d.ts +55 -55
  168. package/lib/cjs/Schema.js +83 -83
  169. package/lib/cjs/Schema.js.map +1 -1
  170. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  171. package/lib/cjs/ServerBasedLocks.js +168 -168
  172. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  173. package/lib/cjs/SqliteStatement.d.ts +283 -283
  174. package/lib/cjs/SqliteStatement.js +448 -448
  175. package/lib/cjs/SqliteStatement.js.map +1 -1
  176. package/lib/cjs/Texture.d.ts +58 -58
  177. package/lib/cjs/Texture.js +82 -82
  178. package/lib/cjs/Texture.js.map +1 -1
  179. package/lib/cjs/TileStorage.d.ts +19 -0
  180. package/lib/cjs/TileStorage.d.ts.map +1 -0
  181. package/lib/cjs/TileStorage.js +91 -0
  182. package/lib/cjs/TileStorage.js.map +1 -0
  183. package/lib/cjs/TxnManager.d.ts +202 -202
  184. package/lib/cjs/TxnManager.d.ts.map +1 -1
  185. package/lib/cjs/TxnManager.js +356 -353
  186. package/lib/cjs/TxnManager.js.map +1 -1
  187. package/lib/cjs/ViewDefinition.d.ts +435 -435
  188. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  189. package/lib/cjs/ViewDefinition.js +635 -629
  190. package/lib/cjs/ViewDefinition.js.map +1 -1
  191. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  192. package/lib/cjs/ViewStateHydrator.js +103 -103
  193. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  194. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  195. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
  196. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
  197. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
  198. package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
  199. package/lib/cjs/core-backend.d.ts +182 -178
  200. package/lib/cjs/core-backend.d.ts.map +1 -1
  201. package/lib/cjs/core-backend.js +202 -198
  202. package/lib/cjs/core-backend.js.map +1 -1
  203. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  204. package/lib/cjs/domains/FunctionalElements.js +145 -145
  205. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  206. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  207. package/lib/cjs/domains/FunctionalSchema.js +40 -40
  208. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  209. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  210. package/lib/cjs/domains/GenericElements.js +263 -263
  211. package/lib/cjs/domains/GenericElements.js.map +1 -1
  212. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  213. package/lib/cjs/domains/GenericSchema.js +28 -28
  214. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  215. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  216. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  217. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  218. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +45 -45
  219. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +262 -262
  220. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  221. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -20
  222. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
  223. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +204 -195
  224. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  225. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  226. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
  227. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +168 -165
  228. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  229. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  230. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +43 -43
  231. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  232. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  233. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  234. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  235. package/lib/cjs/workspace/Settings.d.ts +186 -186
  236. package/lib/cjs/workspace/Settings.d.ts.map +1 -1
  237. package/lib/cjs/workspace/Settings.js +155 -152
  238. package/lib/cjs/workspace/Settings.js.map +1 -1
  239. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  240. package/lib/cjs/workspace/SettingsSchemas.js +191 -191
  241. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  242. package/lib/cjs/workspace/Workspace.d.ts +405 -405
  243. package/lib/cjs/workspace/Workspace.js +539 -539
  244. package/lib/cjs/workspace/Workspace.js.map +1 -1
  245. package/package.json +17 -13
@@ -1,96 +1,102 @@
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 Utils
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.PromiseMemoizer = exports.QueryablePromise = void 0;
11
- const core_bentley_1 = require("@itwin/core-bentley");
12
- const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
13
- /** Wrapper around a promise that allows synchronous queries of it's state
14
- * @internal
15
- */
16
- class QueryablePromise {
17
- constructor(promise) {
18
- this.promise = promise;
19
- this._fulfilled = false;
20
- this._rejected = false;
21
- this.promise
22
- .then((res) => { this.result = res; this._fulfilled = true; })
23
- .catch((err) => { this.error = err; this._rejected = true; });
24
- }
25
- get isPending() { return !this.isFulfilled && !this.isRejected; }
26
- get isFulfilled() { return this._fulfilled; }
27
- get isRejected() { return this._rejected; }
28
- }
29
- exports.QueryablePromise = QueryablePromise;
30
- /** Utility to cache and retrieve results of long running asynchronous functions.
31
- * The cache is keyed on the input arguments passed to these functions
32
- * @internal
33
- */
34
- class PromiseMemoizer {
35
- /**
36
- * Constructor
37
- * @param memoizeFn Function to memoize
38
- * @param generateKeyFn Function to generate the key for the memoized function
39
- * @param maxCacheSize Maximum size of the memoizer cache.
40
- * If the maximum cache size is exceeded, fulfilled/rejected entries are first discarded - these
41
- * may have been unclaimed/orphaned promises. If the cache size is still above the maxCacheSize
42
- * threshold, the entire cache is then cleared.
43
- */
44
- constructor(memoizeFn, generateKeyFn, maxCacheSize = 500, cacheTimeout = 30000) {
45
- this._cachedPromises = new Map();
46
- this._timers = new Map();
47
- /** Call the memoized function */
48
- this.memoize = (...args) => {
49
- const key = this._generateKeyFn(...args);
50
- let qp = this._cachedPromises.get(key);
51
- if (qp)
52
- return qp;
53
- if (this._cachedPromises.size >= this._maxCacheSize) {
54
- if (this._maxCacheSize > 1)
55
- core_bentley_1.Logger.logError(BackendLoggerCategory_1.BackendLoggerCategory.PromiseMemoizer, "Cleared too many unresolved entries in memoizer cache");
56
- this.clearCache();
57
- }
58
- const removeCachedPromise = (v) => {
59
- const cleanUp = () => {
60
- this._cachedPromises.delete(key);
61
- this._timers.delete(key);
62
- };
63
- this._timers.set(key, setTimeout(cleanUp, this._cacheTimeout));
64
- return v;
65
- };
66
- const p = this._memoizeFn(...args).then(removeCachedPromise, (e) => { throw removeCachedPromise(e); });
67
- qp = new QueryablePromise(p);
68
- this._cachedPromises.set(key, qp);
69
- return qp;
70
- };
71
- /** Delete the memoized function */
72
- this.deleteMemoized = (...args) => {
73
- const key = this._generateKeyFn(...args);
74
- this._cachedPromises.delete(key);
75
- const timer = this._timers.get(key);
76
- if (timer)
77
- clearTimeout(timer);
78
- };
79
- /** Clear all entries in the memoizer cache */
80
- this.clearCache = () => {
81
- this._cachedPromises.clear();
82
- };
83
- this.dispose = () => {
84
- for (const timer of this._timers.values())
85
- clearTimeout(timer);
86
- this._timers.clear();
87
- this.clearCache();
88
- };
89
- this._memoizeFn = memoizeFn;
90
- this._generateKeyFn = generateKeyFn;
91
- this._maxCacheSize = maxCacheSize;
92
- this._cacheTimeout = cacheTimeout;
93
- }
94
- }
95
- exports.PromiseMemoizer = PromiseMemoizer;
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 Utils
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.PromiseMemoizer = exports.QueryablePromise = void 0;
11
+ const core_bentley_1 = require("@itwin/core-bentley");
12
+ const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
13
+ /** Wrapper around a promise that allows synchronous queries of it's state
14
+ * @internal
15
+ */
16
+ class QueryablePromise {
17
+ constructor(promise) {
18
+ this.promise = promise;
19
+ this._fulfilled = false;
20
+ this._rejected = false;
21
+ this.promise.then((res) => {
22
+ this.result = res;
23
+ this._fulfilled = true;
24
+ }).catch((err) => {
25
+ this.error = err;
26
+ this._rejected = true;
27
+ });
28
+ }
29
+ get isPending() { return !this.isFulfilled && !this.isRejected; }
30
+ get isFulfilled() { return this._fulfilled; }
31
+ get isRejected() { return this._rejected; }
32
+ }
33
+ exports.QueryablePromise = QueryablePromise;
34
+ /** Utility to cache and retrieve results of long running asynchronous functions.
35
+ * The cache is keyed on the input arguments passed to these functions
36
+ * @internal
37
+ */
38
+ class PromiseMemoizer {
39
+ /**
40
+ * Constructor
41
+ * @param memoizeFn Function to memoize
42
+ * @param generateKeyFn Function to generate the key for the memoized function
43
+ * @param maxCacheSize Maximum size of the memoizer cache.
44
+ * If the maximum cache size is exceeded, fulfilled/rejected entries are first discarded - these
45
+ * may have been unclaimed/orphaned promises. If the cache size is still above the maxCacheSize
46
+ * threshold, the entire cache is then cleared.
47
+ */
48
+ constructor(memoizeFn, generateKeyFn, maxCacheSize = 500, cacheTimeout = 30000) {
49
+ this._cachedPromises = new Map();
50
+ this._timers = new Map();
51
+ /** Call the memoized function */
52
+ this.memoize = (...args) => {
53
+ const key = this._generateKeyFn(...args);
54
+ let qp = this._cachedPromises.get(key);
55
+ if (qp)
56
+ return qp;
57
+ if (this._cachedPromises.size >= this._maxCacheSize) {
58
+ if (this._maxCacheSize > 1)
59
+ core_bentley_1.Logger.logError(BackendLoggerCategory_1.BackendLoggerCategory.PromiseMemoizer, "Cleared too many unresolved entries in memoizer cache");
60
+ this.clearCache();
61
+ }
62
+ const removeCachedPromise = (v) => {
63
+ const cleanUp = () => {
64
+ this._cachedPromises.delete(key);
65
+ this._timers.delete(key);
66
+ };
67
+ this._timers.set(key, setTimeout(cleanUp, this._cacheTimeout));
68
+ return v;
69
+ };
70
+ const p = this._memoizeFn(...args).then(removeCachedPromise, (e) => {
71
+ throw removeCachedPromise(e);
72
+ });
73
+ qp = new QueryablePromise(p);
74
+ this._cachedPromises.set(key, qp);
75
+ return qp;
76
+ };
77
+ /** Delete the memoized function */
78
+ this.deleteMemoized = (...args) => {
79
+ const key = this._generateKeyFn(...args);
80
+ this._cachedPromises.delete(key);
81
+ const timer = this._timers.get(key);
82
+ if (timer)
83
+ clearTimeout(timer);
84
+ };
85
+ /** Clear all entries in the memoizer cache */
86
+ this.clearCache = () => {
87
+ this._cachedPromises.clear();
88
+ };
89
+ this.dispose = () => {
90
+ for (const timer of this._timers.values())
91
+ clearTimeout(timer);
92
+ this._timers.clear();
93
+ this.clearCache();
94
+ };
95
+ this._memoizeFn = memoizeFn;
96
+ this._generateKeyFn = generateKeyFn;
97
+ this._maxCacheSize = maxCacheSize;
98
+ this._cacheTimeout = cacheTimeout;
99
+ }
100
+ }
101
+ exports.PromiseMemoizer = PromiseMemoizer;
96
102
  //# sourceMappingURL=PromiseMemoizer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PromiseMemoizer.js","sourceRoot":"","sources":["../../src/PromiseMemoizer.ts"],"names":[],"mappings":"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","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utils\n */\n\nimport { IDisposable, Logger } from \"@itwin/core-bentley\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\n\n/** Wrapper around a promise that allows synchronous queries of it's state\n * @internal\n */\nexport class QueryablePromise<T> {\n public result?: T;\n public error?: any;\n\n private _fulfilled: boolean = false;\n private _rejected: boolean = false;\n\n public get isPending(): boolean { return !this.isFulfilled && !this.isRejected; }\n public get isFulfilled(): boolean { return this._fulfilled; }\n public get isRejected(): boolean { return this._rejected; }\n public constructor(public readonly promise: Promise<T>) {\n this.promise\n .then((res: T) => { this.result = res; this._fulfilled = true; })\n .catch((err: any) => { this.error = err; this._rejected = true; });\n }\n}\n\n/** @internal */\nexport type MemoizeFnType<T> = (...args: any[]) => Promise<T>;\n/** @internal */\nexport type GenerateKeyFnType = (...args: any[]) => string;\n\n/** Utility to cache and retrieve results of long running asynchronous functions.\n * The cache is keyed on the input arguments passed to these functions\n * @internal\n */\nexport class PromiseMemoizer<T> implements IDisposable {\n private readonly _cachedPromises: Map<string, QueryablePromise<T>> = new Map<string, QueryablePromise<T>>();\n private readonly _timers: Map<string, NodeJS.Timer> = new Map<string, NodeJS.Timer>();\n private readonly _memoizeFn: MemoizeFnType<T>;\n private readonly _generateKeyFn: GenerateKeyFnType;\n private readonly _maxCacheSize: number;\n private readonly _cacheTimeout: number;\n\n /**\n * Constructor\n * @param memoizeFn Function to memoize\n * @param generateKeyFn Function to generate the key for the memoized function\n * @param maxCacheSize Maximum size of the memoizer cache.\n * If the maximum cache size is exceeded, fulfilled/rejected entries are first discarded - these\n * may have been unclaimed/orphaned promises. If the cache size is still above the maxCacheSize\n * threshold, the entire cache is then cleared.\n */\n public constructor(memoizeFn: MemoizeFnType<T>, generateKeyFn: GenerateKeyFnType, maxCacheSize: number = 500, cacheTimeout: number = 30000) {\n this._memoizeFn = memoizeFn;\n this._generateKeyFn = generateKeyFn;\n this._maxCacheSize = maxCacheSize;\n this._cacheTimeout = cacheTimeout;\n }\n\n /** Call the memoized function */\n public memoize = (...args: any[]): QueryablePromise<T> => {\n const key: string = this._generateKeyFn(...args);\n let qp: QueryablePromise<T> | undefined = this._cachedPromises.get(key);\n if (qp)\n return qp;\n\n if (this._cachedPromises.size >= this._maxCacheSize) {\n if (this._maxCacheSize > 1)\n Logger.logError(BackendLoggerCategory.PromiseMemoizer, \"Cleared too many unresolved entries in memoizer cache\");\n this.clearCache();\n }\n\n const removeCachedPromise = (v: T) => {\n const cleanUp = () => {\n this._cachedPromises.delete(key);\n this._timers.delete(key);\n };\n this._timers.set(key, setTimeout(cleanUp, this._cacheTimeout));\n return v;\n };\n\n const p = this._memoizeFn(...args).then(removeCachedPromise, (e) => { throw removeCachedPromise(e); });\n qp = new QueryablePromise<T>(p);\n this._cachedPromises.set(key, qp);\n return qp;\n };\n\n /** Delete the memoized function */\n public deleteMemoized = (...args: any[]) => {\n const key: string = this._generateKeyFn(...args);\n this._cachedPromises.delete(key);\n const timer = this._timers.get(key);\n if (timer)\n clearTimeout(timer);\n };\n\n /** Clear all entries in the memoizer cache */\n public clearCache = () => {\n this._cachedPromises.clear();\n };\n\n public dispose = () => {\n for (const timer of this._timers.values())\n clearTimeout(timer);\n this._timers.clear();\n this.clearCache();\n };\n}\n"]}
1
+ {"version":3,"file":"PromiseMemoizer.js","sourceRoot":"","sources":["../../src/PromiseMemoizer.ts"],"names":[],"mappings":"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","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\nimport { IDisposable, Logger } from \"@itwin/core-bentley\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\n\r\n/** Wrapper around a promise that allows synchronous queries of it's state\r\n * @internal\r\n */\r\nexport class QueryablePromise<T> {\r\n public result?: T;\r\n public error?: any;\r\n\r\n private _fulfilled: boolean = false;\r\n private _rejected: boolean = false;\r\n\r\n public get isPending(): boolean { return !this.isFulfilled && !this.isRejected; }\r\n public get isFulfilled(): boolean { return this._fulfilled; }\r\n public get isRejected(): boolean { return this._rejected; }\r\n public constructor(public readonly promise: Promise<T>) {\r\n this.promise.then((res: T) => {\r\n this.result = res;\r\n this._fulfilled = true;\r\n }).catch((err: any) => {\r\n this.error = err;\r\n this._rejected = true;\r\n });\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type MemoizeFnType<T> = (...args: any[]) => Promise<T>;\r\n/** @internal */\r\nexport type GenerateKeyFnType = (...args: any[]) => string;\r\n\r\n/** Utility to cache and retrieve results of long running asynchronous functions.\r\n * The cache is keyed on the input arguments passed to these functions\r\n * @internal\r\n */\r\nexport class PromiseMemoizer<T> implements IDisposable {\r\n private readonly _cachedPromises: Map<string, QueryablePromise<T>> = new Map<string, QueryablePromise<T>>();\r\n private readonly _timers: Map<string, NodeJS.Timer> = new Map<string, NodeJS.Timer>();\r\n private readonly _memoizeFn: MemoizeFnType<T>;\r\n private readonly _generateKeyFn: GenerateKeyFnType;\r\n private readonly _maxCacheSize: number;\r\n private readonly _cacheTimeout: number;\r\n\r\n /**\r\n * Constructor\r\n * @param memoizeFn Function to memoize\r\n * @param generateKeyFn Function to generate the key for the memoized function\r\n * @param maxCacheSize Maximum size of the memoizer cache.\r\n * If the maximum cache size is exceeded, fulfilled/rejected entries are first discarded - these\r\n * may have been unclaimed/orphaned promises. If the cache size is still above the maxCacheSize\r\n * threshold, the entire cache is then cleared.\r\n */\r\n public constructor(memoizeFn: MemoizeFnType<T>, generateKeyFn: GenerateKeyFnType, maxCacheSize: number = 500, cacheTimeout: number = 30000) {\r\n this._memoizeFn = memoizeFn;\r\n this._generateKeyFn = generateKeyFn;\r\n this._maxCacheSize = maxCacheSize;\r\n this._cacheTimeout = cacheTimeout;\r\n }\r\n\r\n /** Call the memoized function */\r\n public memoize = (...args: any[]): QueryablePromise<T> => {\r\n const key: string = this._generateKeyFn(...args);\r\n let qp: QueryablePromise<T> | undefined = this._cachedPromises.get(key);\r\n if (qp)\r\n return qp;\r\n\r\n if (this._cachedPromises.size >= this._maxCacheSize) {\r\n if (this._maxCacheSize > 1)\r\n Logger.logError(BackendLoggerCategory.PromiseMemoizer, \"Cleared too many unresolved entries in memoizer cache\");\r\n this.clearCache();\r\n }\r\n\r\n const removeCachedPromise = (v: T) => {\r\n const cleanUp = () => {\r\n this._cachedPromises.delete(key);\r\n this._timers.delete(key);\r\n };\r\n this._timers.set(key, setTimeout(cleanUp, this._cacheTimeout));\r\n return v;\r\n };\r\n\r\n const p = this._memoizeFn(...args).then(removeCachedPromise, (e) => {\r\n throw removeCachedPromise(e);\r\n });\r\n\r\n qp = new QueryablePromise<T>(p);\r\n this._cachedPromises.set(key, qp);\r\n return qp;\r\n };\r\n\r\n /** Delete the memoized function */\r\n public deleteMemoized = (...args: any[]) => {\r\n const key: string = this._generateKeyFn(...args);\r\n this._cachedPromises.delete(key);\r\n const timer = this._timers.get(key);\r\n if (timer)\r\n clearTimeout(timer);\r\n };\r\n\r\n /** Clear all entries in the memoizer cache */\r\n public clearCache = () => {\r\n this._cachedPromises.clear();\r\n };\r\n\r\n public dispose = () => {\r\n for (const timer of this._timers.values())\r\n clearTimeout(timer);\r\n this._timers.clear();\r\n this.clearCache();\r\n };\r\n}\r\n"]}
@@ -1,133 +1,133 @@
1
- import { AccessToken } from "@itwin/core-bentley";
2
- import { CloudSqlite } from "./CloudSqlite";
3
- import { SettingObject } from "./workspace/Settings";
4
- /**
5
- * A persistent storage for a set of values of type `PropertyType`, each with a unique `PropertyName`.
6
- * `PropertyStore`s are stored in cloud containers, and require an access token that grants permission to read and/or write them.
7
- * All write operations will fail without an access token that grants write permission.
8
- * A `PropertyStore` is cached on a local drive so reads are fast and inexpensive, and may even be done offline after a prefetch.
9
- * However, that means that callers are responsible for synchronizing the local cache to ensure it includes changes
10
- * made by others, as appropriate (see [[synchronizeWithCloud]]).
11
- * @alpha */
12
- export interface PropertyStore {
13
- /** The collection of property values in the PropertyStore as of the last time it was synchronized. */
14
- readonly values: PropertyStore.Values;
15
- /** Application-supplied parameters for obtaining the write lock on the container for a PropertyStore.*/
16
- readonly appParams: CloudSqlite.ObtainLockParams;
17
- /**
18
- * The token that grants access to the cloud container for this PropertyStore. If it does not grant write permissions, all
19
- * write operations will fail. It should be refreshed (via a timer) before it expires.
20
- */
21
- sasToken: AccessToken;
22
- /**
23
- * Synchronize the local values in this PropertyStore with any changes by made by others.
24
- * @note This is called automatically whenever any write operation is performed on the PropertyStore. It is only necessary to
25
- * call this directly if you have not changed the PropertyStore recently, but wish to perform a readonly operation and want to
26
- * ensure it is up-to-date as of now.
27
- * @note There is no guarantee that the Values are up-to-date even immediately after calling this method, since others
28
- * may be modifying them at any time.
29
- */
30
- synchronizeWithCloud(): void;
31
- /** initiate a prefetch operation on this PropertyStore
32
- * @internal
33
- */
34
- startPrefetch(): CloudSqlite.CloudPrefetch;
35
- /** Save a single property in this PropertyStore. If the property already exists, its value is overwritten.
36
- * @note This will obtain the write lock, save the value, and then release the write lock.
37
- */
38
- saveProperty(name: PropertyStore.PropertyName, value: PropertyStore.PropertyType): Promise<void>;
39
- /** Save an array of properties in this PropertyStore. If a property already exists, its value is overwritten.
40
- * @note This will obtain the write lock, save the values, and then release the write lock.
41
- */
42
- saveProperties(props: PropertyStore.PropertyArray): Promise<void>;
43
- /** Delete a single property from this PropertyStore. If the value does not exist, this method does nothing.
44
- * @note This will obtain the write lock, delete the value, and then release the write lock.
45
- */
46
- deleteProperty(propName: PropertyStore.PropertyName): Promise<void>;
47
- /** Delete an array of properties from this PropertyStore. Any value that does not exist is ignored.
48
- * @note This will obtain the write lock, delete the values, and then release the write lock.
49
- */
50
- deleteProperties(propNames: PropertyStore.PropertyName[]): Promise<void>;
51
- }
52
- /** @alpha */
53
- export declare namespace PropertyStore {
54
- /** @internal */
55
- let openPropertyStore: ((props: CloudSqlite.ContainerAccessProps) => PropertyStore) | undefined;
56
- /** The set of valid types for properties in a PropertyStore. */
57
- type PropertyType = string | number | boolean | Uint8Array | SettingObject;
58
- /** The name of a Property. May not have leading or trailing spaces, and must be between 3 and 2048 characters long. */
59
- type PropertyName = string;
60
- /** An array of PropertyName/PropertyType pairs to be stored in a PropertyStore. */
61
- type PropertyArray = {
62
- name: PropertyName;
63
- value: PropertyType;
64
- }[];
65
- /** The return status of an iteration function. The value "stop" causes the iteration to terminate. */
66
- type IterationReturn = void | "stop";
67
- /** An iteration function over Properties in a PropertyStore. It is called with the name of a each Property. */
68
- type PropertyIteration = (name: string) => IterationReturn;
69
- /** A filter used to limit and/or sort the values returned by an iteration. */
70
- interface PropertyFilter {
71
- /** A value filter. May include wild cards when used with `GLOB` or `LIKE` */
72
- readonly value?: string;
73
- /** The comparison operator for `value`. Default is `=` */
74
- readonly valueCompare?: "GLOB" | "LIKE" | "NOT GLOB" | "NOT LIKE" | "=" | "<" | ">";
75
- /** Order results ascending or descending. If not supplied, the results are unordered (random). */
76
- readonly orderBy?: "ASC" | "DESC";
77
- /** An SQL expression to further filter results. This string is appended to the `WHERE` clause with an `AND` (that should not be part of the sqlExpression) */
78
- readonly sqlExpression?: string;
79
- }
80
- /**
81
- * A readonly set of Property values in a PropertyStore.
82
- * @alpha
83
- */
84
- interface Values {
85
- /** get the value of a Property by name.
86
- * @returns the property's value if it exists, `undefined` otherwise.
87
- */
88
- getProperty(name: PropertyName): PropertyType | undefined;
89
- /** Get the value of a string property by name.
90
- * @returns the property's value if it exists and is a string, `undefined` otherwise.
91
- */
92
- getString(name: PropertyName): string | undefined;
93
- /** Get the value of a string property by name.
94
- * @returns the property's value if it exists and is a string, otherwise the supplied default value.
95
- */
96
- getString(name: PropertyName, defaultValue: string): string;
97
- /** Get the value of a boolean property by name.
98
- * @returns the property's value if it exists and is a boolean, `undefined` otherwise.
99
- */
100
- getBoolean(name: PropertyName): boolean | undefined;
101
- /** Get the value of a boolean property by name.
102
- * @returns the property's value if it exists and is a boolean, otherwise the supplied default value.
103
- */
104
- getBoolean(name: PropertyName, defaultValue: boolean): boolean;
105
- /** Get the value of a number property by name.
106
- * @returns the property's value if it exists and is a number, `undefined` otherwise.
107
- */
108
- getNumber(name: PropertyName): number | undefined;
109
- /** Get the value of a number property by name.
110
- * @returns the property's value if it exists and is a number, otherwise the supplied default value.
111
- */
112
- getNumber(name: PropertyName, defaultValue: number): number;
113
- /** Get the value of a blob property by name.
114
- * @returns the property's value if it exists and is a blob, `undefined` otherwise.
115
- */
116
- getBlob(name: PropertyName): Uint8Array | undefined;
117
- /** Get the value of a blob property by name.
118
- * @returns the property's value if it exists and is a blob, otherwise the supplied default value.
119
- */
120
- getBlob(name: PropertyName, defaultValue: Uint8Array): Uint8Array;
121
- /** Get the value of an object property by name.
122
- * @returns the property's value if it exists and is an object, `undefined` otherwise.
123
- */
124
- getObject<T extends SettingObject>(name: PropertyName): T | undefined;
125
- /** Get the value of an object property by name.
126
- * @returns the property's value if it exists and is an object, otherwise the supplied default value.
127
- */
128
- getObject<T extends SettingObject>(name: PropertyName, defaultValue: T): T;
129
- /** call an iteration function for each property, optionally applying a filter */
130
- forAllProperties(iter: PropertyIteration, filter?: PropertyFilter): void;
131
- }
132
- }
1
+ import { AccessToken } from "@itwin/core-bentley";
2
+ import { CloudSqlite } from "./CloudSqlite";
3
+ import { SettingObject } from "./workspace/Settings";
4
+ /**
5
+ * A persistent storage for a set of values of type `PropertyType`, each with a unique `PropertyName`.
6
+ * `PropertyStore`s are stored in cloud containers, and require an access token that grants permission to read and/or write them.
7
+ * All write operations will fail without an access token that grants write permission.
8
+ * A `PropertyStore` is cached on a local drive so reads are fast and inexpensive, and may even be done offline after a prefetch.
9
+ * However, that means that callers are responsible for synchronizing the local cache to ensure it includes changes
10
+ * made by others, as appropriate (see [[synchronizeWithCloud]]).
11
+ * @alpha */
12
+ export interface PropertyStore {
13
+ /** The collection of property values in the PropertyStore as of the last time it was synchronized. */
14
+ readonly values: PropertyStore.Values;
15
+ /** Application-supplied parameters for obtaining the write lock on the container for a PropertyStore.*/
16
+ readonly appParams: CloudSqlite.ObtainLockParams;
17
+ /**
18
+ * The token that grants access to the cloud container for this PropertyStore. If it does not grant write permissions, all
19
+ * write operations will fail. It should be refreshed (via a timer) before it expires.
20
+ */
21
+ sasToken: AccessToken;
22
+ /**
23
+ * Synchronize the local values in this PropertyStore with any changes by made by others.
24
+ * @note This is called automatically whenever any write operation is performed on the PropertyStore. It is only necessary to
25
+ * call this directly if you have not changed the PropertyStore recently, but wish to perform a readonly operation and want to
26
+ * ensure it is up-to-date as of now.
27
+ * @note There is no guarantee that the Values are up-to-date even immediately after calling this method, since others
28
+ * may be modifying them at any time.
29
+ */
30
+ synchronizeWithCloud(): void;
31
+ /** initiate a prefetch operation on this PropertyStore
32
+ * @internal
33
+ */
34
+ startPrefetch(): CloudSqlite.CloudPrefetch;
35
+ /** Save a single property in this PropertyStore. If the property already exists, its value is overwritten.
36
+ * @note This will obtain the write lock, save the value, and then release the write lock.
37
+ */
38
+ saveProperty(name: PropertyStore.PropertyName, value: PropertyStore.PropertyType): Promise<void>;
39
+ /** Save an array of properties in this PropertyStore. If a property already exists, its value is overwritten.
40
+ * @note This will obtain the write lock, save the values, and then release the write lock.
41
+ */
42
+ saveProperties(props: PropertyStore.PropertyArray): Promise<void>;
43
+ /** Delete a single property from this PropertyStore. If the value does not exist, this method does nothing.
44
+ * @note This will obtain the write lock, delete the value, and then release the write lock.
45
+ */
46
+ deleteProperty(propName: PropertyStore.PropertyName): Promise<void>;
47
+ /** Delete an array of properties from this PropertyStore. Any value that does not exist is ignored.
48
+ * @note This will obtain the write lock, delete the values, and then release the write lock.
49
+ */
50
+ deleteProperties(propNames: PropertyStore.PropertyName[]): Promise<void>;
51
+ }
52
+ /** @alpha */
53
+ export declare namespace PropertyStore {
54
+ /** @internal */
55
+ let openPropertyStore: ((props: CloudSqlite.ContainerAccessProps) => PropertyStore) | undefined;
56
+ /** The set of valid types for properties in a PropertyStore. */
57
+ type PropertyType = string | number | boolean | Uint8Array | SettingObject;
58
+ /** The name of a Property. May not have leading or trailing spaces, and must be between 3 and 2048 characters long. */
59
+ type PropertyName = string;
60
+ /** An array of PropertyName/PropertyType pairs to be stored in a PropertyStore. */
61
+ type PropertyArray = {
62
+ name: PropertyName;
63
+ value: PropertyType;
64
+ }[];
65
+ /** The return status of an iteration function. The value "stop" causes the iteration to terminate. */
66
+ type IterationReturn = void | "stop";
67
+ /** An iteration function over Properties in a PropertyStore. It is called with the name of a each Property. */
68
+ type PropertyIteration = (name: string) => IterationReturn;
69
+ /** A filter used to limit and/or sort the values returned by an iteration. */
70
+ interface PropertyFilter {
71
+ /** A value filter. May include wild cards when used with `GLOB` or `LIKE` */
72
+ readonly value?: string;
73
+ /** The comparison operator for `value`. Default is `=` */
74
+ readonly valueCompare?: "GLOB" | "LIKE" | "NOT GLOB" | "NOT LIKE" | "=" | "<" | ">";
75
+ /** Order results ascending or descending. If not supplied, the results are unordered (random). */
76
+ readonly orderBy?: "ASC" | "DESC";
77
+ /** An SQL expression to further filter results. This string is appended to the `WHERE` clause with an `AND` (that should not be part of the sqlExpression) */
78
+ readonly sqlExpression?: string;
79
+ }
80
+ /**
81
+ * A readonly set of Property values in a PropertyStore.
82
+ * @alpha
83
+ */
84
+ interface Values {
85
+ /** get the value of a Property by name.
86
+ * @returns the property's value if it exists, `undefined` otherwise.
87
+ */
88
+ getProperty(name: PropertyName): PropertyType | undefined;
89
+ /** Get the value of a string property by name.
90
+ * @returns the property's value if it exists and is a string, `undefined` otherwise.
91
+ */
92
+ getString(name: PropertyName): string | undefined;
93
+ /** Get the value of a string property by name.
94
+ * @returns the property's value if it exists and is a string, otherwise the supplied default value.
95
+ */
96
+ getString(name: PropertyName, defaultValue: string): string;
97
+ /** Get the value of a boolean property by name.
98
+ * @returns the property's value if it exists and is a boolean, `undefined` otherwise.
99
+ */
100
+ getBoolean(name: PropertyName): boolean | undefined;
101
+ /** Get the value of a boolean property by name.
102
+ * @returns the property's value if it exists and is a boolean, otherwise the supplied default value.
103
+ */
104
+ getBoolean(name: PropertyName, defaultValue: boolean): boolean;
105
+ /** Get the value of a number property by name.
106
+ * @returns the property's value if it exists and is a number, `undefined` otherwise.
107
+ */
108
+ getNumber(name: PropertyName): number | undefined;
109
+ /** Get the value of a number property by name.
110
+ * @returns the property's value if it exists and is a number, otherwise the supplied default value.
111
+ */
112
+ getNumber(name: PropertyName, defaultValue: number): number;
113
+ /** Get the value of a blob property by name.
114
+ * @returns the property's value if it exists and is a blob, `undefined` otherwise.
115
+ */
116
+ getBlob(name: PropertyName): Uint8Array | undefined;
117
+ /** Get the value of a blob property by name.
118
+ * @returns the property's value if it exists and is a blob, otherwise the supplied default value.
119
+ */
120
+ getBlob(name: PropertyName, defaultValue: Uint8Array): Uint8Array;
121
+ /** Get the value of an object property by name.
122
+ * @returns the property's value if it exists and is an object, `undefined` otherwise.
123
+ */
124
+ getObject<T extends SettingObject>(name: PropertyName): T | undefined;
125
+ /** Get the value of an object property by name.
126
+ * @returns the property's value if it exists and is an object, otherwise the supplied default value.
127
+ */
128
+ getObject<T extends SettingObject>(name: PropertyName, defaultValue: T): T;
129
+ /** call an iteration function for each property, optionally applying a filter */
130
+ forAllProperties(iter: PropertyIteration, filter?: PropertyFilter): void;
131
+ }
132
+ }
133
133
  //# sourceMappingURL=PropertyStore.d.ts.map
@@ -1,12 +1,12 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.PropertyStore = void 0;
8
- /** @alpha */
9
- var PropertyStore;
10
- (function (PropertyStore) {
11
- })(PropertyStore = exports.PropertyStore || (exports.PropertyStore = {}));
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
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.PropertyStore = void 0;
8
+ /** @alpha */
9
+ var PropertyStore;
10
+ (function (PropertyStore) {
11
+ })(PropertyStore = exports.PropertyStore || (exports.PropertyStore = {}));
12
12
  //# sourceMappingURL=PropertyStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyStore.js","sourceRoot":"","sources":["../../src/PropertyStore.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AA6D/F,aAAa;AACb,IAAiB,aAAa,CA+E7B;AA/ED,WAAiB,aAAa;AA+E9B,CAAC,EA/EgB,aAAa,GAAb,qBAAa,KAAb,qBAAa,QA+E7B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { AccessToken } from \"@itwin/core-bentley\";\nimport { CloudSqlite } from \"./CloudSqlite\";\nimport { SettingObject } from \"./workspace/Settings\";\n\n/**\n * A persistent storage for a set of values of type `PropertyType`, each with a unique `PropertyName`.\n * `PropertyStore`s are stored in cloud containers, and require an access token that grants permission to read and/or write them.\n * All write operations will fail without an access token that grants write permission.\n * A `PropertyStore` is cached on a local drive so reads are fast and inexpensive, and may even be done offline after a prefetch.\n * However, that means that callers are responsible for synchronizing the local cache to ensure it includes changes\n * made by others, as appropriate (see [[synchronizeWithCloud]]).\n * @alpha */\nexport interface PropertyStore {\n\n /** The collection of property values in the PropertyStore as of the last time it was synchronized. */\n readonly values: PropertyStore.Values;\n\n /** Application-supplied parameters for obtaining the write lock on the container for a PropertyStore.*/\n readonly appParams: CloudSqlite.ObtainLockParams;\n\n /**\n * The token that grants access to the cloud container for this PropertyStore. If it does not grant write permissions, all\n * write operations will fail. It should be refreshed (via a timer) before it expires.\n */\n sasToken: AccessToken;\n\n /**\n * Synchronize the local values in this PropertyStore with any changes by made by others.\n * @note This is called automatically whenever any write operation is performed on the PropertyStore. It is only necessary to\n * call this directly if you have not changed the PropertyStore recently, but wish to perform a readonly operation and want to\n * ensure it is up-to-date as of now.\n * @note There is no guarantee that the Values are up-to-date even immediately after calling this method, since others\n * may be modifying them at any time.\n */\n synchronizeWithCloud(): void;\n\n /** initiate a prefetch operation on this PropertyStore\n * @internal\n */\n startPrefetch(): CloudSqlite.CloudPrefetch;\n\n /** Save a single property in this PropertyStore. If the property already exists, its value is overwritten.\n * @note This will obtain the write lock, save the value, and then release the write lock.\n */\n saveProperty(name: PropertyStore.PropertyName, value: PropertyStore.PropertyType): Promise<void>;\n /** Save an array of properties in this PropertyStore. If a property already exists, its value is overwritten.\n * @note This will obtain the write lock, save the values, and then release the write lock.\n */\n saveProperties(props: PropertyStore.PropertyArray): Promise<void>;\n /** Delete a single property from this PropertyStore. If the value does not exist, this method does nothing.\n * @note This will obtain the write lock, delete the value, and then release the write lock.\n */\n deleteProperty(propName: PropertyStore.PropertyName): Promise<void>;\n /** Delete an array of properties from this PropertyStore. Any value that does not exist is ignored.\n * @note This will obtain the write lock, delete the values, and then release the write lock.\n */\n deleteProperties(propNames: PropertyStore.PropertyName[]): Promise<void>;\n}\n\n/** @alpha */\nexport namespace PropertyStore {\n /** @internal */\n export let openPropertyStore: ((props: CloudSqlite.ContainerAccessProps) => PropertyStore) | undefined;\n\n /** The set of valid types for properties in a PropertyStore. */\n export type PropertyType = string | number | boolean | Uint8Array | SettingObject;\n /** The name of a Property. May not have leading or trailing spaces, and must be between 3 and 2048 characters long. */\n export type PropertyName = string;\n /** An array of PropertyName/PropertyType pairs to be stored in a PropertyStore. */\n export type PropertyArray = { name: PropertyName, value: PropertyType }[];\n /** The return status of an iteration function. The value \"stop\" causes the iteration to terminate. */\n export type IterationReturn = void | \"stop\";\n /** An iteration function over Properties in a PropertyStore. It is called with the name of a each Property. */\n export type PropertyIteration = (name: string) => IterationReturn;\n\n /** A filter used to limit and/or sort the values returned by an iteration. */\n export interface PropertyFilter {\n /** A value filter. May include wild cards when used with `GLOB` or `LIKE` */\n readonly value?: string;\n /** The comparison operator for `value`. Default is `=` */\n readonly valueCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\n /** Order results ascending or descending. If not supplied, the results are unordered (random). */\n readonly orderBy?: \"ASC\" | \"DESC\";\n /** An SQL expression to further filter results. This string is appended to the `WHERE` clause with an `AND` (that should not be part of the sqlExpression) */\n readonly sqlExpression?: string;\n }\n\n /**\n * A readonly set of Property values in a PropertyStore.\n * @alpha\n */\n export interface Values {\n /** get the value of a Property by name.\n * @returns the property's value if it exists, `undefined` otherwise.\n */\n getProperty(name: PropertyName): PropertyType | undefined;\n /** Get the value of a string property by name.\n * @returns the property's value if it exists and is a string, `undefined` otherwise.\n */\n getString(name: PropertyName): string | undefined;\n /** Get the value of a string property by name.\n * @returns the property's value if it exists and is a string, otherwise the supplied default value.\n */\n getString(name: PropertyName, defaultValue: string): string;\n /** Get the value of a boolean property by name.\n * @returns the property's value if it exists and is a boolean, `undefined` otherwise.\n */\n getBoolean(name: PropertyName): boolean | undefined;\n /** Get the value of a boolean property by name.\n * @returns the property's value if it exists and is a boolean, otherwise the supplied default value.\n */\n getBoolean(name: PropertyName, defaultValue: boolean): boolean;\n /** Get the value of a number property by name.\n * @returns the property's value if it exists and is a number, `undefined` otherwise.\n */\n getNumber(name: PropertyName): number | undefined;\n /** Get the value of a number property by name.\n * @returns the property's value if it exists and is a number, otherwise the supplied default value.\n */\n getNumber(name: PropertyName, defaultValue: number): number;\n /** Get the value of a blob property by name.\n * @returns the property's value if it exists and is a blob, `undefined` otherwise.\n */\n getBlob(name: PropertyName): Uint8Array | undefined;\n /** Get the value of a blob property by name.\n * @returns the property's value if it exists and is a blob, otherwise the supplied default value.\n */\n getBlob(name: PropertyName, defaultValue: Uint8Array): Uint8Array;\n /** Get the value of an object property by name.\n * @returns the property's value if it exists and is an object, `undefined` otherwise.\n */\n getObject<T extends SettingObject>(name: PropertyName): T | undefined;\n /** Get the value of an object property by name.\n * @returns the property's value if it exists and is an object, otherwise the supplied default value.\n */\n getObject<T extends SettingObject>(name: PropertyName, defaultValue: T): T;\n /** call an iteration function for each property, optionally applying a filter */\n forAllProperties(iter: PropertyIteration, filter?: PropertyFilter): void;\n }\n}\n"]}
1
+ {"version":3,"file":"PropertyStore.js","sourceRoot":"","sources":["../../src/PropertyStore.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AA6D/F,aAAa;AACb,IAAiB,aAAa,CA+E7B;AA/ED,WAAiB,aAAa;AA+E9B,CAAC,EA/EgB,aAAa,GAAb,qBAAa,KAAb,qBAAa,QA+E7B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { AccessToken } from \"@itwin/core-bentley\";\r\nimport { CloudSqlite } from \"./CloudSqlite\";\r\nimport { SettingObject } from \"./workspace/Settings\";\r\n\r\n/**\r\n * A persistent storage for a set of values of type `PropertyType`, each with a unique `PropertyName`.\r\n * `PropertyStore`s are stored in cloud containers, and require an access token that grants permission to read and/or write them.\r\n * All write operations will fail without an access token that grants write permission.\r\n * A `PropertyStore` is cached on a local drive so reads are fast and inexpensive, and may even be done offline after a prefetch.\r\n * However, that means that callers are responsible for synchronizing the local cache to ensure it includes changes\r\n * made by others, as appropriate (see [[synchronizeWithCloud]]).\r\n * @alpha */\r\nexport interface PropertyStore {\r\n\r\n /** The collection of property values in the PropertyStore as of the last time it was synchronized. */\r\n readonly values: PropertyStore.Values;\r\n\r\n /** Application-supplied parameters for obtaining the write lock on the container for a PropertyStore.*/\r\n readonly appParams: CloudSqlite.ObtainLockParams;\r\n\r\n /**\r\n * The token that grants access to the cloud container for this PropertyStore. If it does not grant write permissions, all\r\n * write operations will fail. It should be refreshed (via a timer) before it expires.\r\n */\r\n sasToken: AccessToken;\r\n\r\n /**\r\n * Synchronize the local values in this PropertyStore with any changes by made by others.\r\n * @note This is called automatically whenever any write operation is performed on the PropertyStore. It is only necessary to\r\n * call this directly if you have not changed the PropertyStore recently, but wish to perform a readonly operation and want to\r\n * ensure it is up-to-date as of now.\r\n * @note There is no guarantee that the Values are up-to-date even immediately after calling this method, since others\r\n * may be modifying them at any time.\r\n */\r\n synchronizeWithCloud(): void;\r\n\r\n /** initiate a prefetch operation on this PropertyStore\r\n * @internal\r\n */\r\n startPrefetch(): CloudSqlite.CloudPrefetch;\r\n\r\n /** Save a single property in this PropertyStore. If the property already exists, its value is overwritten.\r\n * @note This will obtain the write lock, save the value, and then release the write lock.\r\n */\r\n saveProperty(name: PropertyStore.PropertyName, value: PropertyStore.PropertyType): Promise<void>;\r\n /** Save an array of properties in this PropertyStore. If a property already exists, its value is overwritten.\r\n * @note This will obtain the write lock, save the values, and then release the write lock.\r\n */\r\n saveProperties(props: PropertyStore.PropertyArray): Promise<void>;\r\n /** Delete a single property from this PropertyStore. If the value does not exist, this method does nothing.\r\n * @note This will obtain the write lock, delete the value, and then release the write lock.\r\n */\r\n deleteProperty(propName: PropertyStore.PropertyName): Promise<void>;\r\n /** Delete an array of properties from this PropertyStore. Any value that does not exist is ignored.\r\n * @note This will obtain the write lock, delete the values, and then release the write lock.\r\n */\r\n deleteProperties(propNames: PropertyStore.PropertyName[]): Promise<void>;\r\n}\r\n\r\n/** @alpha */\r\nexport namespace PropertyStore {\r\n /** @internal */\r\n export let openPropertyStore: ((props: CloudSqlite.ContainerAccessProps) => PropertyStore) | undefined;\r\n\r\n /** The set of valid types for properties in a PropertyStore. */\r\n export type PropertyType = string | number | boolean | Uint8Array | SettingObject;\r\n /** The name of a Property. May not have leading or trailing spaces, and must be between 3 and 2048 characters long. */\r\n export type PropertyName = string;\r\n /** An array of PropertyName/PropertyType pairs to be stored in a PropertyStore. */\r\n export type PropertyArray = { name: PropertyName, value: PropertyType }[];\r\n /** The return status of an iteration function. The value \"stop\" causes the iteration to terminate. */\r\n export type IterationReturn = void | \"stop\";\r\n /** An iteration function over Properties in a PropertyStore. It is called with the name of a each Property. */\r\n export type PropertyIteration = (name: string) => IterationReturn;\r\n\r\n /** A filter used to limit and/or sort the values returned by an iteration. */\r\n export interface PropertyFilter {\r\n /** A value filter. May include wild cards when used with `GLOB` or `LIKE` */\r\n readonly value?: string;\r\n /** The comparison operator for `value`. Default is `=` */\r\n readonly valueCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"<\" | \">\";\r\n /** Order results ascending or descending. If not supplied, the results are unordered (random). */\r\n readonly orderBy?: \"ASC\" | \"DESC\";\r\n /** An SQL expression to further filter results. This string is appended to the `WHERE` clause with an `AND` (that should not be part of the sqlExpression) */\r\n readonly sqlExpression?: string;\r\n }\r\n\r\n /**\r\n * A readonly set of Property values in a PropertyStore.\r\n * @alpha\r\n */\r\n export interface Values {\r\n /** get the value of a Property by name.\r\n * @returns the property's value if it exists, `undefined` otherwise.\r\n */\r\n getProperty(name: PropertyName): PropertyType | undefined;\r\n /** Get the value of a string property by name.\r\n * @returns the property's value if it exists and is a string, `undefined` otherwise.\r\n */\r\n getString(name: PropertyName): string | undefined;\r\n /** Get the value of a string property by name.\r\n * @returns the property's value if it exists and is a string, otherwise the supplied default value.\r\n */\r\n getString(name: PropertyName, defaultValue: string): string;\r\n /** Get the value of a boolean property by name.\r\n * @returns the property's value if it exists and is a boolean, `undefined` otherwise.\r\n */\r\n getBoolean(name: PropertyName): boolean | undefined;\r\n /** Get the value of a boolean property by name.\r\n * @returns the property's value if it exists and is a boolean, otherwise the supplied default value.\r\n */\r\n getBoolean(name: PropertyName, defaultValue: boolean): boolean;\r\n /** Get the value of a number property by name.\r\n * @returns the property's value if it exists and is a number, `undefined` otherwise.\r\n */\r\n getNumber(name: PropertyName): number | undefined;\r\n /** Get the value of a number property by name.\r\n * @returns the property's value if it exists and is a number, otherwise the supplied default value.\r\n */\r\n getNumber(name: PropertyName, defaultValue: number): number;\r\n /** Get the value of a blob property by name.\r\n * @returns the property's value if it exists and is a blob, `undefined` otherwise.\r\n */\r\n getBlob(name: PropertyName): Uint8Array | undefined;\r\n /** Get the value of a blob property by name.\r\n * @returns the property's value if it exists and is a blob, otherwise the supplied default value.\r\n */\r\n getBlob(name: PropertyName, defaultValue: Uint8Array): Uint8Array;\r\n /** Get the value of an object property by name.\r\n * @returns the property's value if it exists and is an object, `undefined` otherwise.\r\n */\r\n getObject<T extends SettingObject>(name: PropertyName): T | undefined;\r\n /** Get the value of an object property by name.\r\n * @returns the property's value if it exists and is an object, otherwise the supplied default value.\r\n */\r\n getObject<T extends SettingObject>(name: PropertyName, defaultValue: T): T;\r\n /** call an iteration function for each property, optionally applying a filter */\r\n forAllProperties(iter: PropertyIteration, filter?: PropertyFilter): void;\r\n }\r\n}\r\n"]}