@itwin/core-backend 3.3.0-dev.7 → 3.3.0-dev.72

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 (102) hide show
  1. package/CHANGELOG.md +38 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +2 -7
  3. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  4. package/lib/cjs/BackendHubAccess.js.map +1 -1
  5. package/lib/cjs/BisCoreSchema.d.ts +1 -1
  6. package/lib/cjs/BisCoreSchema.js +1 -1
  7. package/lib/cjs/BisCoreSchema.js.map +1 -1
  8. package/lib/cjs/BriefcaseManager.d.ts +10 -11
  9. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  10. package/lib/cjs/BriefcaseManager.js +10 -11
  11. package/lib/cjs/BriefcaseManager.js.map +1 -1
  12. package/lib/cjs/CheckpointManager.d.ts +16 -4
  13. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  14. package/lib/cjs/CheckpointManager.js +103 -20
  15. package/lib/cjs/CheckpointManager.js.map +1 -1
  16. package/lib/cjs/ClassRegistry.js +6 -6
  17. package/lib/cjs/ClassRegistry.js.map +1 -1
  18. package/lib/cjs/CodeSpecs.d.ts +1 -1
  19. package/lib/cjs/CodeSpecs.js +1 -1
  20. package/lib/cjs/CodeSpecs.js.map +1 -1
  21. package/lib/cjs/DisplayStyle.d.ts +2 -2
  22. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  23. package/lib/cjs/DisplayStyle.js +14 -17
  24. package/lib/cjs/DisplayStyle.js.map +1 -1
  25. package/lib/cjs/Element.d.ts +36 -25
  26. package/lib/cjs/Element.d.ts.map +1 -1
  27. package/lib/cjs/Element.js +54 -39
  28. package/lib/cjs/Element.js.map +1 -1
  29. package/lib/cjs/GeoCoordConfig.d.ts +14 -0
  30. package/lib/cjs/GeoCoordConfig.d.ts.map +1 -0
  31. package/lib/cjs/GeoCoordConfig.js +73 -0
  32. package/lib/cjs/GeoCoordConfig.js.map +1 -0
  33. package/lib/cjs/HubMock.d.ts +99 -0
  34. package/lib/cjs/HubMock.d.ts.map +1 -0
  35. package/lib/cjs/HubMock.js +193 -0
  36. package/lib/cjs/HubMock.js.map +1 -0
  37. package/lib/cjs/IModelDb.d.ts +25 -15
  38. package/lib/cjs/IModelDb.d.ts.map +1 -1
  39. package/lib/cjs/IModelDb.js +43 -34
  40. package/lib/cjs/IModelDb.js.map +1 -1
  41. package/lib/cjs/IModelHost.d.ts +75 -32
  42. package/lib/cjs/IModelHost.d.ts.map +1 -1
  43. package/lib/cjs/IModelHost.js +66 -65
  44. package/lib/cjs/IModelHost.js.map +1 -1
  45. package/lib/cjs/IpcHost.d.ts +2 -2
  46. package/lib/cjs/IpcHost.d.ts.map +1 -1
  47. package/lib/cjs/IpcHost.js +1 -1
  48. package/lib/cjs/IpcHost.js.map +1 -1
  49. package/lib/cjs/LocalHub.d.ts +163 -0
  50. package/lib/cjs/LocalHub.d.ts.map +1 -0
  51. package/lib/cjs/LocalHub.js +588 -0
  52. package/lib/cjs/LocalHub.js.map +1 -0
  53. package/lib/cjs/LocalhostIpcHost.d.ts +2 -2
  54. package/lib/cjs/LocalhostIpcHost.d.ts.map +1 -1
  55. package/lib/cjs/LocalhostIpcHost.js +16 -0
  56. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  57. package/lib/cjs/RpcBackend.d.ts +3 -1
  58. package/lib/cjs/RpcBackend.d.ts.map +1 -1
  59. package/lib/cjs/RpcBackend.js +27 -3
  60. package/lib/cjs/RpcBackend.js.map +1 -1
  61. package/lib/cjs/SQLiteDb.d.ts +4 -3
  62. package/lib/cjs/SQLiteDb.d.ts.map +1 -1
  63. package/lib/cjs/SQLiteDb.js +5 -4
  64. package/lib/cjs/SQLiteDb.js.map +1 -1
  65. package/lib/cjs/SqliteStatement.d.ts +4 -0
  66. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  67. package/lib/cjs/SqliteStatement.js +4 -0
  68. package/lib/cjs/SqliteStatement.js.map +1 -1
  69. package/lib/cjs/ViewDefinition.d.ts +6 -6
  70. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  71. package/lib/cjs/ViewDefinition.js +20 -20
  72. package/lib/cjs/ViewDefinition.js.map +1 -1
  73. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +68 -0
  74. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +22 -0
  75. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +53 -0
  76. package/lib/cjs/assets/Settings/backend.setting.json5 +139 -0
  77. package/lib/cjs/core-backend.d.ts +9 -7
  78. package/lib/cjs/core-backend.d.ts.map +1 -1
  79. package/lib/cjs/core-backend.js +9 -7
  80. package/lib/cjs/core-backend.js.map +1 -1
  81. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +1 -1
  82. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
  83. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +8 -12
  84. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  85. package/lib/cjs/workspace/Settings.d.ts +8 -3
  86. package/lib/cjs/workspace/Settings.d.ts.map +1 -1
  87. package/lib/cjs/workspace/Settings.js +9 -0
  88. package/lib/cjs/workspace/Settings.js.map +1 -1
  89. package/lib/cjs/workspace/SettingsSchemas.d.ts +76 -0
  90. package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -0
  91. package/lib/cjs/workspace/SettingsSchemas.js +192 -0
  92. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -0
  93. package/lib/cjs/workspace/Workspace.d.ts +235 -140
  94. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  95. package/lib/cjs/workspace/Workspace.js +262 -91
  96. package/lib/cjs/workspace/Workspace.js.map +1 -1
  97. package/package.json +23 -18
  98. package/lib/cjs/assets/Settings.schema.json +0 -25
  99. package/lib/cjs/workspace/SettingsSpecRegistry.d.ts +0 -68
  100. package/lib/cjs/workspace/SettingsSpecRegistry.d.ts.map +0 -1
  101. package/lib/cjs/workspace/SettingsSpecRegistry.js +0 -122
  102. package/lib/cjs/workspace/SettingsSpecRegistry.js.map +0 -1
@@ -2,9 +2,9 @@
2
2
  * @module IModelHost
3
3
  */
4
4
  import { IModelJsNative } from "@bentley/imodeljs-native";
5
- import { TelemetryManager } from "@itwin/core-telemetry";
6
5
  import { AccessToken, BeEvent, GuidString, Mutable } from "@itwin/core-bentley";
7
6
  import { AuthorizationClient, LocalDirName, SessionProps } from "@itwin/core-common";
7
+ import { TelemetryManager } from "@itwin/core-telemetry";
8
8
  import { BackendHubAccess } from "./BackendHubAccess";
9
9
  import { AzureBlobStorageCredentials, CloudStorageService, CloudStorageTileUploader } from "./CloudStorageBackend";
10
10
  import { Workspace, WorkspaceOpts } from "./workspace/Workspace";
@@ -39,10 +39,11 @@ export interface CrashReportingConfig {
39
39
  /** Upload crash dump and node-reports to Bentley's crash-reporting service? Defaults to false */
40
40
  uploadToBentley?: boolean;
41
41
  }
42
- /** Configuration of core-backend.
42
+ /**
43
+ * Options for [[IModelHost.startup]]
43
44
  * @public
44
45
  */
45
- export declare class IModelHostConfiguration {
46
+ export interface IModelHostOptions {
46
47
  /**
47
48
  * Root of the directory holding all the files that iTwin.js caches
48
49
  * - If not specified at startup a platform specific default is used -
@@ -58,13 +59,15 @@ export declare class IModelHostConfiguration {
58
59
  * @see [[IModelHost.cacheDir]] for the value it's set to after startup
59
60
  */
60
61
  cacheDir?: LocalDirName;
61
- /** Options for creating the [[Workspace]]
62
+ /** The directory where application assets are found. */
63
+ appAssetsDir?: LocalDirName;
64
+ /**
65
+ * Options for creating the [[Workspace]]
62
66
  * @beta
63
67
  */
64
68
  workspace?: WorkspaceOpts;
65
- /** The directory where the app's assets are found. */
66
- appAssetsDir?: LocalDirName;
67
- /** The kind of iModel hub server to use.
69
+ /**
70
+ * The kind of iModel hub server to use.
68
71
  * @beta
69
72
  */
70
73
  hubAccess?: BackendHubAccess;
@@ -82,6 +85,11 @@ export declare class IModelHostConfiguration {
82
85
  * @beta
83
86
  */
84
87
  restrictTileUrlsByClientIp?: boolean;
88
+ /**
89
+ * Whether to enable OpenTelemetry tracing
90
+ * @beta
91
+ */
92
+ enableOpenTelemetry?: boolean;
85
93
  /** Whether to compress cached tiles.
86
94
  * Defaults to `true`.
87
95
  */
@@ -89,31 +97,19 @@ export declare class IModelHostConfiguration {
89
97
  /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a "pending" status.
90
98
  * @internal
91
99
  */
92
- tileTreeRequestTimeout: number;
100
+ tileTreeRequestTimeout?: number;
93
101
  /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a "pending" status.
94
102
  * @internal
95
103
  */
96
- tileContentRequestTimeout: number;
97
- /** The default time, in milliseconds, used for [[tileTreeRequestTimeout]] and [[tileContentRequestTimeout]]. To change this, override one or both of those properties.
98
- * @internal
99
- */
100
- static defaultTileRequestTimeout: number;
101
- /** The default time, in seconds, used for [[logTileLoadTimeThreshold]]. To change this, override that property.
102
- * @internal
103
- */
104
- static defaultLogTileLoadTimeThreshold: number;
104
+ tileContentRequestTimeout?: number;
105
105
  /** The backend will log when a tile took longer to load than this threshold in seconds.
106
106
  * @internal
107
107
  */
108
- logTileLoadTimeThreshold: number;
109
- /** The default size, in bytes, used for [[logTileSizeThreshold]]. To change this, override that property.
110
- * @internal
111
- */
112
- static defaultLogTileSizeThreshold: number;
108
+ logTileLoadTimeThreshold?: number;
113
109
  /** The backend will log when a tile is loaded with a size in bytes above this threshold.
114
110
  * @internal
115
111
  */
116
- logTileSizeThreshold: number;
112
+ logTileSizeThreshold?: number;
117
113
  /** Crash-reporting configuration
118
114
  * @alpha
119
115
  */
@@ -123,6 +119,39 @@ export declare class IModelHostConfiguration {
123
119
  */
124
120
  authorizationClient?: AuthorizationClient;
125
121
  }
122
+ /** Configuration of core-backend.
123
+ * @public
124
+ */
125
+ export declare class IModelHostConfiguration implements IModelHostOptions {
126
+ static defaultTileRequestTimeout: number;
127
+ static defaultLogTileLoadTimeThreshold: number;
128
+ static defaultLogTileSizeThreshold: number;
129
+ appAssetsDir?: LocalDirName;
130
+ cacheDir?: LocalDirName;
131
+ /** @beta */
132
+ workspace?: WorkspaceOpts;
133
+ /** @beta */
134
+ hubAccess?: BackendHubAccess;
135
+ /** @beta */
136
+ authorizationClient?: AuthorizationClient;
137
+ /** @beta */
138
+ tileCacheService?: CloudStorageService;
139
+ /** @beta */
140
+ restrictTileUrlsByClientIp?: boolean;
141
+ compressCachedTiles?: boolean;
142
+ /** @beta */
143
+ tileCacheAzureCredentials?: AzureBlobStorageCredentials;
144
+ /** @internal */
145
+ tileTreeRequestTimeout: number;
146
+ /** @internal */
147
+ tileContentRequestTimeout: number;
148
+ /** @internal */
149
+ logTileLoadTimeThreshold: number;
150
+ /** @internal */
151
+ logTileSizeThreshold: number;
152
+ /** @alpha */
153
+ crashReportingConfig?: CrashReportingConfig;
154
+ }
126
155
  /** IModelHost initializes ($backend) and captures its configuration. A backend must call [[IModelHost.startup]] before using any backend classes.
127
156
  * See [the learning article]($docs/learning/backend/IModelHost.md)
128
157
  * @public
@@ -138,7 +167,9 @@ export declare class IModelHost {
138
167
  private static _platform?;
139
168
  /** @internal */
140
169
  static get platform(): typeof IModelJsNative;
141
- static configuration?: IModelHostConfiguration;
170
+ static configuration?: IModelHostOptions;
171
+ /** Event raised during startup to allow loading settings data */
172
+ static readonly onWorkspaceStartup: BeEvent<() => void>;
142
173
  /** Event raised just after the backend IModelHost was started */
143
174
  static readonly onAfterStartup: BeEvent<() => void>;
144
175
  /** Event raised just before the backend IModelHost is to be shut down */
@@ -181,28 +212,34 @@ export declare class IModelHost {
181
212
  private static validateNativePlatformVersion;
182
213
  /**
183
214
  * @internal
184
- * @note Use [[IModelHostConfiguration.tileCacheService]] to set the service provider.
215
+ * @note Use [[IModelHostOptions.tileCacheService]] to set the service provider.
185
216
  */
186
217
  static tileCacheService?: CloudStorageService;
187
218
  /** @internal */
188
219
  static tileUploader?: CloudStorageTileUploader;
189
- private static _hubAccess;
220
+ private static _hubAccess?;
190
221
  /** @internal */
191
- static setHubAccess(hubAccess: BackendHubAccess): void;
222
+ static setHubAccess(hubAccess: BackendHubAccess | undefined): void;
223
+ /** get the current hubAccess, if present.
224
+ * @beta
225
+ */
226
+ static getHubAccess(): BackendHubAccess | undefined;
192
227
  /** Provides access to the IModelHub for this IModelHost
193
228
  * @beta
194
- * @note If [[IModelHostConfiguration.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.
229
+ * @note If [[IModelHostOptions.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.
230
+ * To determine whether one is present, use [[getHubAccess]].
195
231
  */
196
232
  static get hubAccess(): BackendHubAccess;
233
+ private static initializeWorkspace;
197
234
  private static _isValid;
198
235
  /** Returns true if IModelHost is started. */
199
236
  static get isValid(): boolean;
200
237
  /** This method must be called before any iTwin.js services are used.
201
- * @param configuration Host configuration data.
238
+ * @param options Host configuration data.
202
239
  * Raises [[onAfterStartup]].
203
240
  * @see [[shutdown]].
204
241
  */
205
- static startup(configuration?: IModelHostConfiguration): Promise<void>;
242
+ static startup(options?: IModelHostOptions): Promise<void>;
206
243
  private static _briefcaseCacheDir;
207
244
  private static logStartup;
208
245
  private static setupHostDirs;
@@ -228,11 +265,11 @@ export declare class IModelHost {
228
265
  static getCrashReportProperties(): CrashReportingConfigNameValuePair[];
229
266
  /** The directory where application assets may be found */
230
267
  static get appAssetsDir(): string | undefined;
231
- /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a "pending" status.
268
+ /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileTreeProps should wait before returning a "pending" status.
232
269
  * @internal
233
270
  */
234
271
  static get tileTreeRequestTimeout(): number;
235
- /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a "pending" status.
272
+ /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileContent should wait before returning a "pending" status.
236
273
  * @internal
237
274
  */
238
275
  static get tileContentRequestTimeout(): number;
@@ -253,6 +290,12 @@ export declare class IModelHost {
253
290
  */
254
291
  static get compressCachedTiles(): boolean;
255
292
  private static setupTileCache;
293
+ /** @internal */
294
+ static computeSchemaChecksum(arg: {
295
+ schemaXmlPath: string;
296
+ referencePaths: string[];
297
+ exactMatch?: boolean;
298
+ }): string;
256
299
  }
257
300
  /** Information about the platform on which the app is running. Also see [[KnownLocations]] and [[IModelJsFs]].
258
301
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHost.d.ts","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAU,OAAO,EAAQ,UAAU,EAAkC,OAAO,EAAmB,MAAM,qBAAqB,CAAC;AAC/I,OAAO,EAAE,mBAAmB,EAA8B,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAoB,2BAA2B,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAUrI,OAAO,EAAkB,SAAS,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAQjF,aAAa;AACb,MAAM,WAAW,iCAAiC;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,8JAA8J;IAC9J,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wOAAwO;IACxO,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,sFAAsF;IACtF,m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AEG;IACH,WAAkB,mBAAmB,IAAI,OAAO,CAAoE;IAEpH,OAAO,CAAC,MAAM,CAAC,cAAc;IAoB7B,gBAAgB;WACF,qBAAqB,CAAC,GAAG,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM;CAG5H;AAED;;GAEG;AACH,qBAAa,QAAQ;IACnB,oCAAoC;IACpC,WAAkB,YAAY,IAAI,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAEzF;IAED,gBAAgB;WACF,IAAI,IAAI,OAAO,cAAc;CAG5C;AAED;;GAEG;AACH,qBAAa,cAAc;IAEzB,iEAAiE;IACjE,WAAkB,eAAe,IAAI,MAAM,CAAqD;IAEhG,8DAA8D;IAC9D,WAAkB,gBAAgB,IAAI,MAAM,CAE3C;IAED,+BAA+B;IAC/B,WAAkB,MAAM,IAAI,MAAM,CAEjC;CACF;AAED;;;;GAIG;AACH,8BAAsB,gBAAgB;IACpC;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAC1D;;;;OAIG;IACI,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAO1C;;;OAGG;IACI,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IACjE;;;;OAIG;IACI,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;CAOnD"}
@@ -12,15 +12,16 @@ const os = require("os");
12
12
  const path = require("path");
13
13
  const semver = require("semver");
14
14
  const imodeljs_native_1 = require("@bentley/imodeljs-native");
15
- const core_telemetry_1 = require("@itwin/core-telemetry");
16
15
  const core_bentley_1 = require("@itwin/core-bentley");
17
16
  const core_common_1 = require("@itwin/core-common");
17
+ const core_telemetry_1 = require("@itwin/core-telemetry");
18
18
  const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
19
19
  const BisCoreSchema_1 = require("./BisCoreSchema");
20
20
  const BriefcaseManager_1 = require("./BriefcaseManager");
21
21
  const CloudStorageBackend_1 = require("./CloudStorageBackend");
22
22
  const FunctionalSchema_1 = require("./domains/FunctionalSchema");
23
23
  const GenericSchema_1 = require("./domains/GenericSchema");
24
+ const GeoCoordConfig_1 = require("./GeoCoordConfig");
24
25
  const IModelJsFs_1 = require("./IModelJsFs");
25
26
  const DevToolsRpcImpl_1 = require("./rpc-impl/DevToolsRpcImpl");
26
27
  const IModelReadRpcImpl_1 = require("./rpc-impl/IModelReadRpcImpl");
@@ -28,54 +29,37 @@ const IModelTileRpcImpl_1 = require("./rpc-impl/IModelTileRpcImpl");
28
29
  const SnapshotIModelRpcImpl_1 = require("./rpc-impl/SnapshotIModelRpcImpl");
29
30
  const WipRpcImpl_1 = require("./rpc-impl/WipRpcImpl");
30
31
  const RpcBackend_1 = require("./RpcBackend");
31
- const Workspace_1 = require("./workspace/Workspace");
32
32
  const Settings_1 = require("./workspace/Settings");
33
- const SettingsSpecRegistry_1 = require("./workspace/SettingsSpecRegistry");
33
+ const SettingsSchemas_1 = require("./workspace/SettingsSchemas");
34
+ const Workspace_1 = require("./workspace/Workspace");
34
35
  const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.IModelHost;
35
36
  /** Configuration of core-backend.
36
37
  * @public
37
38
  */
38
39
  class IModelHostConfiguration {
39
40
  constructor() {
40
- /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a "pending" status.
41
- * @internal
42
- */
41
+ /** @internal */
43
42
  this.tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;
44
- /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a "pending" status.
45
- * @internal
46
- */
43
+ /** @internal */
47
44
  this.tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;
48
- /** The backend will log when a tile took longer to load than this threshold in seconds.
49
- * @internal
50
- */
45
+ /** @internal */
51
46
  this.logTileLoadTimeThreshold = IModelHostConfiguration.defaultLogTileLoadTimeThreshold;
52
- /** The backend will log when a tile is loaded with a size in bytes above this threshold.
53
- * @internal
54
- */
47
+ /** @internal */
55
48
  this.logTileSizeThreshold = IModelHostConfiguration.defaultLogTileSizeThreshold;
56
49
  }
57
50
  }
58
51
  exports.IModelHostConfiguration = IModelHostConfiguration;
59
- /** The default time, in milliseconds, used for [[tileTreeRequestTimeout]] and [[tileContentRequestTimeout]]. To change this, override one or both of those properties.
60
- * @internal
61
- */
62
52
  IModelHostConfiguration.defaultTileRequestTimeout = 20 * 1000;
63
- /** The default time, in seconds, used for [[logTileLoadTimeThreshold]]. To change this, override that property.
64
- * @internal
65
- */
66
53
  IModelHostConfiguration.defaultLogTileLoadTimeThreshold = 40;
67
- /** The default size, in bytes, used for [[logTileSizeThreshold]]. To change this, override that property.
68
- * @internal
69
- */
70
54
  IModelHostConfiguration.defaultLogTileSizeThreshold = 20 * 1000000;
71
55
  /**
72
- * Settings for the application workspace.
56
+ * Settings for `IModelHost.appWorkspace`.
73
57
  * @note this includes the default dictionary from the SettingsSpecRegistry
74
58
  */
75
59
  class ApplicationSettings extends Settings_1.BaseSettings {
76
60
  constructor() {
77
61
  super();
78
- this._remove = SettingsSpecRegistry_1.SettingsSpecRegistry.onSpecsChanged.addListener(() => this.updateDefaults());
62
+ this._remove = SettingsSchemas_1.SettingsSchemas.onSchemaChanged.addListener(() => this.updateDefaults());
79
63
  this.updateDefaults();
80
64
  }
81
65
  verifyPriority(priority) {
@@ -84,9 +68,9 @@ class ApplicationSettings extends Settings_1.BaseSettings {
84
68
  }
85
69
  updateDefaults() {
86
70
  const defaults = {};
87
- for (const [specName, val] of SettingsSpecRegistry_1.SettingsSpecRegistry.allSpecs) {
71
+ for (const [schemaName, val] of SettingsSchemas_1.SettingsSchemas.allSchemas) {
88
72
  if (val.default)
89
- defaults[specName] = val.default;
73
+ defaults[schemaName] = val.default;
90
74
  }
91
75
  this.addDictionary("_default_", 0, defaults);
92
76
  }
@@ -145,7 +129,7 @@ class IModelHost {
145
129
  }
146
130
  /** @internal */
147
131
  static flushLog() {
148
- return this.platform.DgnDb.flushLog();
132
+ return this.platform.flushLog();
149
133
  }
150
134
  /** @internal */
151
135
  static loadNative() {
@@ -174,62 +158,71 @@ class IModelHost {
174
158
  }
175
159
  /** @internal */
176
160
  static setHubAccess(hubAccess) { this._hubAccess = hubAccess; }
161
+ /** get the current hubAccess, if present.
162
+ * @beta
163
+ */
164
+ static getHubAccess() { return this._hubAccess; }
177
165
  /** Provides access to the IModelHub for this IModelHost
178
166
  * @beta
179
- * @note If [[IModelHostConfiguration.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.
167
+ * @note If [[IModelHostOptions.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.
168
+ * To determine whether one is present, use [[getHubAccess]].
180
169
  */
181
170
  static get hubAccess() {
182
- // Strictly speaking, _hubAccess should be marked as possibly undefined since it's not needed for Snapshot iModels.
183
- // However, a decision was made to not provide that type annotation so callers aren't forced to constantly check for
184
- // something that's required in all other workflows.
185
- // This check is here to provide a better error message when hubAccess is inadvertently undefined.
186
171
  if (this._hubAccess === undefined)
187
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "IModelHost.hubAccess is undefined. Specify an implementation in your IModelHostConfiguration");
172
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "No BackendHubAccess supplied in IModelHostOptions");
188
173
  return this._hubAccess;
189
174
  }
175
+ static initializeWorkspace(configuration) {
176
+ const settingAssets = path.join(KnownLocations.packageAssetsDir, "Settings");
177
+ SettingsSchemas_1.SettingsSchemas.addDirectory(path.join(settingAssets, "Schemas"));
178
+ this._appWorkspace = new Workspace_1.ITwinWorkspace(new ApplicationSettings(), configuration.workspace);
179
+ this.appWorkspace.settings.addDirectory(settingAssets, Settings_1.SettingsPriority.defaults);
180
+ GeoCoordConfig_1.GeoCoordConfig.onStartup();
181
+ // allow applications to load their default settings
182
+ this.onWorkspaceStartup.raiseEvent();
183
+ }
190
184
  /** Returns true if IModelHost is started. */
191
185
  static get isValid() { return this._isValid; }
192
186
  /** This method must be called before any iTwin.js services are used.
193
- * @param configuration Host configuration data.
187
+ * @param options Host configuration data.
194
188
  * Raises [[onAfterStartup]].
195
189
  * @see [[shutdown]].
196
190
  */
197
- static async startup(configuration = new IModelHostConfiguration()) {
191
+ static async startup(options) {
192
+ var _a, _b, _c, _d;
198
193
  if (this._isValid)
199
194
  return; // we're already initialized
200
195
  this._isValid = true;
196
+ options = options !== null && options !== void 0 ? options : {};
201
197
  if (IModelHost.sessionId === "")
202
198
  IModelHost.sessionId = core_bentley_1.Guid.createValue();
203
- this.authorizationClient = configuration.authorizationClient;
199
+ this.authorizationClient = options.authorizationClient;
204
200
  this.logStartup();
205
201
  this.backendVersion = require("../../package.json").version; // eslint-disable-line @typescript-eslint/no-var-requires
206
- (0, RpcBackend_1.initializeRpcBackend)();
202
+ (0, RpcBackend_1.initializeRpcBackend)(options.enableOpenTelemetry);
207
203
  if (this._platform === undefined) {
208
204
  try {
209
205
  this.loadNative();
210
206
  }
211
207
  catch (error) {
212
- core_bentley_1.Logger.logError(loggerCategory, "Error registering/loading the native platform API", () => (configuration));
208
+ core_bentley_1.Logger.logError(loggerCategory, "Error registering/loading the native platform API", () => (options));
213
209
  throw error;
214
210
  }
215
211
  }
216
- if (configuration.crashReportingConfig && configuration.crashReportingConfig.crashDir && !core_bentley_1.ProcessDetector.isElectronAppBackend && !core_bentley_1.ProcessDetector.isMobileAppBackend) {
217
- this.platform.setCrashReporting(configuration.crashReportingConfig);
218
- core_bentley_1.Logger.logTrace(loggerCategory, "Configured crash reporting", () => {
219
- var _a, _b, _c, _d;
220
- return ({
221
- enableCrashDumps: (_a = configuration.crashReportingConfig) === null || _a === void 0 ? void 0 : _a.enableCrashDumps,
222
- wantFullMemoryDumps: (_b = configuration.crashReportingConfig) === null || _b === void 0 ? void 0 : _b.wantFullMemoryDumps,
223
- enableNodeReport: (_c = configuration.crashReportingConfig) === null || _c === void 0 ? void 0 : _c.enableNodeReport,
224
- uploadToBentley: (_d = configuration.crashReportingConfig) === null || _d === void 0 ? void 0 : _d.uploadToBentley,
225
- });
212
+ if (options.crashReportingConfig && options.crashReportingConfig.crashDir && !core_bentley_1.ProcessDetector.isElectronAppBackend && !core_bentley_1.ProcessDetector.isMobileAppBackend) {
213
+ this.platform.setCrashReporting(options.crashReportingConfig);
214
+ core_bentley_1.Logger.logTrace(loggerCategory, "Configured crash reporting", {
215
+ enableCrashDumps: (_a = options.crashReportingConfig) === null || _a === void 0 ? void 0 : _a.enableCrashDumps,
216
+ wantFullMemoryDumps: (_b = options.crashReportingConfig) === null || _b === void 0 ? void 0 : _b.wantFullMemoryDumps,
217
+ enableNodeReport: (_c = options.crashReportingConfig) === null || _c === void 0 ? void 0 : _c.enableNodeReport,
218
+ uploadToBentley: (_d = options.crashReportingConfig) === null || _d === void 0 ? void 0 : _d.uploadToBentley,
226
219
  });
227
- if (configuration.crashReportingConfig.enableNodeReport) {
220
+ if (options.crashReportingConfig.enableNodeReport) {
228
221
  try {
229
222
  // node-report reports on V8 fatal errors and unhandled exceptions/Promise rejections.
230
223
  const nodereport = require("node-report/api"); // eslint-disable-line @typescript-eslint/no-var-requires
231
224
  nodereport.setEvents("exception+fatalerror+apicall");
232
- nodereport.setDirectory(configuration.crashReportingConfig.crashDir);
225
+ nodereport.setDirectory(options.crashReportingConfig.crashDir);
233
226
  nodereport.setVerbose("yes");
234
227
  core_bentley_1.Logger.logTrace(loggerCategory, "Configured native crash reporting (node-report)");
235
228
  }
@@ -238,8 +231,8 @@ class IModelHost {
238
231
  }
239
232
  }
240
233
  }
241
- this.setupHostDirs(configuration);
242
- this._appWorkspace = new Workspace_1.ITwinWorkspace(new ApplicationSettings(), configuration.workspace);
234
+ this.setupHostDirs(options);
235
+ this.initializeWorkspace(options);
243
236
  BriefcaseManager_1.BriefcaseManager.initialize(this._briefcaseCacheDir);
244
237
  [
245
238
  IModelReadRpcImpl_1.IModelReadRpcImpl,
@@ -253,13 +246,13 @@ class IModelHost {
253
246
  GenericSchema_1.GenericSchema,
254
247
  FunctionalSchema_1.FunctionalSchema,
255
248
  ].forEach((schema) => schema.registerSchema()); // register all of the schemas
256
- if (undefined !== configuration.hubAccess)
257
- IModelHost._hubAccess = configuration.hubAccess;
258
- IModelHost.configuration = configuration;
259
- IModelHost.setupTileCache();
249
+ if (undefined !== options.hubAccess)
250
+ this._hubAccess = options.hubAccess;
251
+ this.configuration = options;
252
+ this.setupTileCache();
260
253
  this.platform.setUseTileCache(IModelHost.tileCacheService ? false : true);
261
254
  process.once("beforeExit", IModelHost.shutdown);
262
- IModelHost.onAfterStartup.raiseEvent();
255
+ this.onAfterStartup.raiseEvent();
263
256
  }
264
257
  static logStartup() {
265
258
  if (!core_bentley_1.Logger.isEnabled(loggerCategory, core_bentley_1.LogLevel.Trace))
@@ -334,22 +327,24 @@ class IModelHost {
334
327
  }
335
328
  /** The directory where application assets may be found */
336
329
  static get appAssetsDir() { return undefined !== IModelHost.configuration ? IModelHost.configuration.appAssetsDir : undefined; }
337
- /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a "pending" status.
330
+ /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileTreeProps should wait before returning a "pending" status.
338
331
  * @internal
339
332
  */
340
333
  static get tileTreeRequestTimeout() {
341
- return undefined !== IModelHost.configuration ? IModelHost.configuration.tileTreeRequestTimeout : IModelHostConfiguration.defaultTileRequestTimeout;
334
+ var _a, _b;
335
+ return (_b = (_a = IModelHost.configuration) === null || _a === void 0 ? void 0 : _a.tileTreeRequestTimeout) !== null && _b !== void 0 ? _b : IModelHostConfiguration.defaultTileRequestTimeout;
342
336
  }
343
- /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a "pending" status.
337
+ /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileContent should wait before returning a "pending" status.
344
338
  * @internal
345
339
  */
346
340
  static get tileContentRequestTimeout() {
347
- return undefined !== IModelHost.configuration ? IModelHost.configuration.tileContentRequestTimeout : IModelHostConfiguration.defaultTileRequestTimeout;
341
+ var _a, _b;
342
+ return (_b = (_a = IModelHost.configuration) === null || _a === void 0 ? void 0 : _a.tileContentRequestTimeout) !== null && _b !== void 0 ? _b : IModelHostConfiguration.defaultTileRequestTimeout;
348
343
  }
349
344
  /** The backend will log when a tile took longer to load than this threshold in seconds. */
350
- static get logTileLoadTimeThreshold() { return undefined !== IModelHost.configuration ? IModelHost.configuration.logTileLoadTimeThreshold : IModelHostConfiguration.defaultLogTileLoadTimeThreshold; }
345
+ static get logTileLoadTimeThreshold() { var _a, _b; return (_b = (_a = IModelHost.configuration) === null || _a === void 0 ? void 0 : _a.logTileLoadTimeThreshold) !== null && _b !== void 0 ? _b : IModelHostConfiguration.defaultLogTileLoadTimeThreshold; }
351
346
  /** The backend will log when a tile is loaded with a size in bytes above this threshold. */
352
- static get logTileSizeThreshold() { return undefined !== IModelHost.configuration ? IModelHost.configuration.logTileSizeThreshold : IModelHostConfiguration.defaultLogTileSizeThreshold; }
347
+ static get logTileSizeThreshold() { var _a, _b; return (_b = (_a = IModelHost.configuration) === null || _a === void 0 ? void 0 : _a.logTileSizeThreshold) !== null && _b !== void 0 ? _b : IModelHostConfiguration.defaultLogTileSizeThreshold; }
353
348
  /** Whether external tile caching is active.
354
349
  * @internal
355
350
  */
@@ -382,12 +377,18 @@ class IModelHost {
382
377
  throw new core_common_1.IModelError(core_common_1.BentleyStatus.ERROR, "Cannot use both Azure and custom cloud storage providers for tile cache.");
383
378
  }
384
379
  }
380
+ /** @internal */
381
+ static computeSchemaChecksum(arg) {
382
+ return this.platform.computeSchemaChecksum(arg);
383
+ }
385
384
  }
386
385
  exports.IModelHost = IModelHost;
387
386
  /** @alpha */
388
387
  IModelHost.telemetry = new core_telemetry_1.TelemetryManager();
389
388
  IModelHost.backendVersion = "";
390
389
  IModelHost._cacheDir = "";
390
+ /** Event raised during startup to allow loading settings data */
391
+ IModelHost.onWorkspaceStartup = new core_bentley_1.BeEvent();
391
392
  /** Event raised just after the backend IModelHost was started */
392
393
  IModelHost.onAfterStartup = new core_bentley_1.BeEvent();
393
394
  /** Event raised just before the backend IModelHost is to be shut down */