@itwin/core-backend 3.3.0-dev.8 → 3.3.0-dev.82

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 +26 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +32 -15
  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 +28 -6
  13. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  14. package/lib/cjs/CheckpointManager.js +117 -22
  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 +74 -0
  32. package/lib/cjs/GeoCoordConfig.js.map +1 -0
  33. package/lib/cjs/HubMock.d.ts +94 -0
  34. package/lib/cjs/HubMock.d.ts.map +1 -0
  35. package/lib/cjs/HubMock.js +191 -0
  36. package/lib/cjs/HubMock.js.map +1 -0
  37. package/lib/cjs/IModelDb.d.ts +26 -15
  38. package/lib/cjs/IModelDb.d.ts.map +1 -1
  39. package/lib/cjs/IModelDb.js +44 -35
  40. package/lib/cjs/IModelDb.js.map +1 -1
  41. package/lib/cjs/IModelHost.d.ts +75 -33
  42. package/lib/cjs/IModelHost.d.ts.map +1 -1
  43. package/lib/cjs/IModelHost.js +66 -80
  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 +138 -30
  62. package/lib/cjs/SQLiteDb.d.ts.map +1 -1
  63. package/lib/cjs/SQLiteDb.js +110 -38
  64. package/lib/cjs/SQLiteDb.js.map +1 -1
  65. package/lib/cjs/SqliteStatement.d.ts +8 -0
  66. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  67. package/lib/cjs/SqliteStatement.js +10 -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 +240 -144
  94. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  95. package/lib/cjs/workspace/Workspace.js +258 -95
  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 */
@@ -178,31 +209,36 @@ export declare class IModelHost {
178
209
  /** @internal */
179
210
  static loadNative(): void;
180
211
  private static registerPlatform;
181
- private static validateNativePlatformVersion;
182
212
  /**
183
213
  * @internal
184
- * @note Use [[IModelHostConfiguration.tileCacheService]] to set the service provider.
214
+ * @note Use [[IModelHostOptions.tileCacheService]] to set the service provider.
185
215
  */
186
216
  static tileCacheService?: CloudStorageService;
187
217
  /** @internal */
188
218
  static tileUploader?: CloudStorageTileUploader;
189
- private static _hubAccess;
219
+ private static _hubAccess?;
190
220
  /** @internal */
191
- static setHubAccess(hubAccess: BackendHubAccess): void;
221
+ static setHubAccess(hubAccess: BackendHubAccess | undefined): void;
222
+ /** get the current hubAccess, if present.
223
+ * @beta
224
+ */
225
+ static getHubAccess(): BackendHubAccess | undefined;
192
226
  /** Provides access to the IModelHub for this IModelHost
193
227
  * @beta
194
- * @note If [[IModelHostConfiguration.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.
228
+ * @note If [[IModelHostOptions.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.
229
+ * To determine whether one is present, use [[getHubAccess]].
195
230
  */
196
231
  static get hubAccess(): BackendHubAccess;
232
+ private static initializeWorkspace;
197
233
  private static _isValid;
198
234
  /** Returns true if IModelHost is started. */
199
235
  static get isValid(): boolean;
200
236
  /** This method must be called before any iTwin.js services are used.
201
- * @param configuration Host configuration data.
237
+ * @param options Host configuration data.
202
238
  * Raises [[onAfterStartup]].
203
239
  * @see [[shutdown]].
204
240
  */
205
- static startup(configuration?: IModelHostConfiguration): Promise<void>;
241
+ static startup(options?: IModelHostOptions): Promise<void>;
206
242
  private static _briefcaseCacheDir;
207
243
  private static logStartup;
208
244
  private static setupHostDirs;
@@ -228,11 +264,11 @@ export declare class IModelHost {
228
264
  static getCrashReportProperties(): CrashReportingConfigNameValuePair[];
229
265
  /** The directory where application assets may be found */
230
266
  static get appAssetsDir(): string | undefined;
231
- /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a "pending" status.
267
+ /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileTreeProps should wait before returning a "pending" status.
232
268
  * @internal
233
269
  */
234
270
  static get tileTreeRequestTimeout(): number;
235
- /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a "pending" status.
271
+ /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileContent should wait before returning a "pending" status.
236
272
  * @internal
237
273
  */
238
274
  static get tileContentRequestTimeout(): number;
@@ -253,6 +289,12 @@ export declare class IModelHost {
253
289
  */
254
290
  static get compressCachedTiles(): boolean;
255
291
  private static setupTileCache;
292
+ /** @internal */
293
+ static computeSchemaChecksum(arg: {
294
+ schemaXmlPath: string;
295
+ referencePaths: string[];
296
+ exactMatch?: boolean;
297
+ }): string;
256
298
  }
257
299
  /** Information about the platform on which the app is running. Also see [[KnownLocations]] and [[IModelJsFs]].
258
300
  * @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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;IAElL;;OAEG;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"}
@@ -10,17 +10,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.FileNameResolver = exports.KnownLocations = exports.Platform = exports.IModelHost = exports.IModelHostConfiguration = void 0;
11
11
  const os = require("os");
12
12
  const path = require("path");
13
- const semver = require("semver");
14
13
  const imodeljs_native_1 = require("@bentley/imodeljs-native");
15
- const core_telemetry_1 = require("@itwin/core-telemetry");
16
14
  const core_bentley_1 = require("@itwin/core-bentley");
17
15
  const core_common_1 = require("@itwin/core-common");
16
+ const core_telemetry_1 = require("@itwin/core-telemetry");
18
17
  const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
19
18
  const BisCoreSchema_1 = require("./BisCoreSchema");
20
19
  const BriefcaseManager_1 = require("./BriefcaseManager");
21
20
  const CloudStorageBackend_1 = require("./CloudStorageBackend");
22
21
  const FunctionalSchema_1 = require("./domains/FunctionalSchema");
23
22
  const GenericSchema_1 = require("./domains/GenericSchema");
23
+ const GeoCoordConfig_1 = require("./GeoCoordConfig");
24
24
  const IModelJsFs_1 = require("./IModelJsFs");
25
25
  const DevToolsRpcImpl_1 = require("./rpc-impl/DevToolsRpcImpl");
26
26
  const IModelReadRpcImpl_1 = require("./rpc-impl/IModelReadRpcImpl");
@@ -28,54 +28,37 @@ const IModelTileRpcImpl_1 = require("./rpc-impl/IModelTileRpcImpl");
28
28
  const SnapshotIModelRpcImpl_1 = require("./rpc-impl/SnapshotIModelRpcImpl");
29
29
  const WipRpcImpl_1 = require("./rpc-impl/WipRpcImpl");
30
30
  const RpcBackend_1 = require("./RpcBackend");
31
- const Workspace_1 = require("./workspace/Workspace");
32
31
  const Settings_1 = require("./workspace/Settings");
33
- const SettingsSpecRegistry_1 = require("./workspace/SettingsSpecRegistry");
32
+ const SettingsSchemas_1 = require("./workspace/SettingsSchemas");
33
+ const Workspace_1 = require("./workspace/Workspace");
34
34
  const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.IModelHost;
35
35
  /** Configuration of core-backend.
36
36
  * @public
37
37
  */
38
38
  class IModelHostConfiguration {
39
39
  constructor() {
40
- /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a "pending" status.
41
- * @internal
42
- */
40
+ /** @internal */
43
41
  this.tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;
44
- /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a "pending" status.
45
- * @internal
46
- */
42
+ /** @internal */
47
43
  this.tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;
48
- /** The backend will log when a tile took longer to load than this threshold in seconds.
49
- * @internal
50
- */
44
+ /** @internal */
51
45
  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
- */
46
+ /** @internal */
55
47
  this.logTileSizeThreshold = IModelHostConfiguration.defaultLogTileSizeThreshold;
56
48
  }
57
49
  }
58
50
  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
51
  IModelHostConfiguration.defaultTileRequestTimeout = 20 * 1000;
63
- /** The default time, in seconds, used for [[logTileLoadTimeThreshold]]. To change this, override that property.
64
- * @internal
65
- */
66
52
  IModelHostConfiguration.defaultLogTileLoadTimeThreshold = 40;
67
- /** The default size, in bytes, used for [[logTileSizeThreshold]]. To change this, override that property.
68
- * @internal
69
- */
70
53
  IModelHostConfiguration.defaultLogTileSizeThreshold = 20 * 1000000;
71
54
  /**
72
- * Settings for the application workspace.
55
+ * Settings for `IModelHost.appWorkspace`.
73
56
  * @note this includes the default dictionary from the SettingsSpecRegistry
74
57
  */
75
58
  class ApplicationSettings extends Settings_1.BaseSettings {
76
59
  constructor() {
77
60
  super();
78
- this._remove = SettingsSpecRegistry_1.SettingsSpecRegistry.onSpecsChanged.addListener(() => this.updateDefaults());
61
+ this._remove = SettingsSchemas_1.SettingsSchemas.onSchemaChanged.addListener(() => this.updateDefaults());
79
62
  this.updateDefaults();
80
63
  }
81
64
  verifyPriority(priority) {
@@ -84,9 +67,9 @@ class ApplicationSettings extends Settings_1.BaseSettings {
84
67
  }
85
68
  updateDefaults() {
86
69
  const defaults = {};
87
- for (const [specName, val] of SettingsSpecRegistry_1.SettingsSpecRegistry.allSpecs) {
70
+ for (const [schemaName, val] of SettingsSchemas_1.SettingsSchemas.allSchemas) {
88
71
  if (val.default)
89
- defaults[specName] = val.default;
72
+ defaults[schemaName] = val.default;
90
73
  }
91
74
  this.addDictionary("_default_", 0, defaults);
92
75
  }
@@ -145,7 +128,7 @@ class IModelHost {
145
128
  }
146
129
  /** @internal */
147
130
  static flushLog() {
148
- return this.platform.DgnDb.flushLog();
131
+ return this.platform.flushLog();
149
132
  }
150
133
  /** @internal */
151
134
  static loadNative() {
@@ -156,80 +139,75 @@ class IModelHost {
156
139
  this._platform = platform;
157
140
  if (undefined === platform)
158
141
  return;
159
- if (!core_bentley_1.ProcessDetector.isMobileAppBackend)
160
- this.validateNativePlatformVersion();
161
142
  platform.logger = core_bentley_1.Logger;
162
143
  }
163
- static validateNativePlatformVersion() {
164
- const requiredVersion = require("../../package.json").dependencies["@bentley/imodeljs-native"]; // eslint-disable-line @typescript-eslint/no-var-requires
165
- const thisVersion = this.platform.version;
166
- if (semver.satisfies(thisVersion, requiredVersion))
167
- return;
168
- if (IModelJsFs_1.IModelJsFs.existsSync(path.join(__dirname, "DevBuild.txt"))) {
169
- console.log("Bypassing version checks for development build"); // eslint-disable-line no-console
170
- return;
171
- }
172
- this._platform = undefined;
173
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, `imodeljs-native version is (${thisVersion}). core-backend requires version (${requiredVersion})`);
174
- }
175
144
  /** @internal */
176
145
  static setHubAccess(hubAccess) { this._hubAccess = hubAccess; }
146
+ /** get the current hubAccess, if present.
147
+ * @beta
148
+ */
149
+ static getHubAccess() { return this._hubAccess; }
177
150
  /** Provides access to the IModelHub for this IModelHost
178
151
  * @beta
179
- * @note If [[IModelHostConfiguration.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.
152
+ * @note If [[IModelHostOptions.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.
153
+ * To determine whether one is present, use [[getHubAccess]].
180
154
  */
181
155
  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
156
  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");
157
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "No BackendHubAccess supplied in IModelHostOptions");
188
158
  return this._hubAccess;
189
159
  }
160
+ static initializeWorkspace(configuration) {
161
+ const settingAssets = path.join(KnownLocations.packageAssetsDir, "Settings");
162
+ SettingsSchemas_1.SettingsSchemas.addDirectory(path.join(settingAssets, "Schemas"));
163
+ this._appWorkspace = new Workspace_1.ITwinWorkspace(new ApplicationSettings(), configuration.workspace);
164
+ this.appWorkspace.settings.addDirectory(settingAssets, Settings_1.SettingsPriority.defaults);
165
+ GeoCoordConfig_1.GeoCoordConfig.onStartup();
166
+ // allow applications to load their default settings
167
+ this.onWorkspaceStartup.raiseEvent();
168
+ }
190
169
  /** Returns true if IModelHost is started. */
191
170
  static get isValid() { return this._isValid; }
192
171
  /** This method must be called before any iTwin.js services are used.
193
- * @param configuration Host configuration data.
172
+ * @param options Host configuration data.
194
173
  * Raises [[onAfterStartup]].
195
174
  * @see [[shutdown]].
196
175
  */
197
- static async startup(configuration = new IModelHostConfiguration()) {
176
+ static async startup(options) {
177
+ var _a, _b, _c, _d;
198
178
  if (this._isValid)
199
179
  return; // we're already initialized
200
180
  this._isValid = true;
181
+ options = options !== null && options !== void 0 ? options : {};
201
182
  if (IModelHost.sessionId === "")
202
183
  IModelHost.sessionId = core_bentley_1.Guid.createValue();
203
- this.authorizationClient = configuration.authorizationClient;
184
+ this.authorizationClient = options.authorizationClient;
204
185
  this.logStartup();
205
186
  this.backendVersion = require("../../package.json").version; // eslint-disable-line @typescript-eslint/no-var-requires
206
- (0, RpcBackend_1.initializeRpcBackend)();
187
+ (0, RpcBackend_1.initializeRpcBackend)(options.enableOpenTelemetry);
207
188
  if (this._platform === undefined) {
208
189
  try {
209
190
  this.loadNative();
210
191
  }
211
192
  catch (error) {
212
- core_bentley_1.Logger.logError(loggerCategory, "Error registering/loading the native platform API", () => (configuration));
193
+ core_bentley_1.Logger.logError(loggerCategory, "Error registering/loading the native platform API", () => (options));
213
194
  throw error;
214
195
  }
215
196
  }
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
- });
197
+ if (options.crashReportingConfig && options.crashReportingConfig.crashDir && !core_bentley_1.ProcessDetector.isElectronAppBackend && !core_bentley_1.ProcessDetector.isMobileAppBackend) {
198
+ this.platform.setCrashReporting(options.crashReportingConfig);
199
+ core_bentley_1.Logger.logTrace(loggerCategory, "Configured crash reporting", {
200
+ enableCrashDumps: (_a = options.crashReportingConfig) === null || _a === void 0 ? void 0 : _a.enableCrashDumps,
201
+ wantFullMemoryDumps: (_b = options.crashReportingConfig) === null || _b === void 0 ? void 0 : _b.wantFullMemoryDumps,
202
+ enableNodeReport: (_c = options.crashReportingConfig) === null || _c === void 0 ? void 0 : _c.enableNodeReport,
203
+ uploadToBentley: (_d = options.crashReportingConfig) === null || _d === void 0 ? void 0 : _d.uploadToBentley,
226
204
  });
227
- if (configuration.crashReportingConfig.enableNodeReport) {
205
+ if (options.crashReportingConfig.enableNodeReport) {
228
206
  try {
229
207
  // node-report reports on V8 fatal errors and unhandled exceptions/Promise rejections.
230
208
  const nodereport = require("node-report/api"); // eslint-disable-line @typescript-eslint/no-var-requires
231
209
  nodereport.setEvents("exception+fatalerror+apicall");
232
- nodereport.setDirectory(configuration.crashReportingConfig.crashDir);
210
+ nodereport.setDirectory(options.crashReportingConfig.crashDir);
233
211
  nodereport.setVerbose("yes");
234
212
  core_bentley_1.Logger.logTrace(loggerCategory, "Configured native crash reporting (node-report)");
235
213
  }
@@ -238,8 +216,8 @@ class IModelHost {
238
216
  }
239
217
  }
240
218
  }
241
- this.setupHostDirs(configuration);
242
- this._appWorkspace = new Workspace_1.ITwinWorkspace(new ApplicationSettings(), configuration.workspace);
219
+ this.setupHostDirs(options);
220
+ this.initializeWorkspace(options);
243
221
  BriefcaseManager_1.BriefcaseManager.initialize(this._briefcaseCacheDir);
244
222
  [
245
223
  IModelReadRpcImpl_1.IModelReadRpcImpl,
@@ -253,13 +231,13 @@ class IModelHost {
253
231
  GenericSchema_1.GenericSchema,
254
232
  FunctionalSchema_1.FunctionalSchema,
255
233
  ].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();
234
+ if (undefined !== options.hubAccess)
235
+ this._hubAccess = options.hubAccess;
236
+ this.configuration = options;
237
+ this.setupTileCache();
260
238
  this.platform.setUseTileCache(IModelHost.tileCacheService ? false : true);
261
239
  process.once("beforeExit", IModelHost.shutdown);
262
- IModelHost.onAfterStartup.raiseEvent();
240
+ this.onAfterStartup.raiseEvent();
263
241
  }
264
242
  static logStartup() {
265
243
  if (!core_bentley_1.Logger.isEnabled(loggerCategory, core_bentley_1.LogLevel.Trace))
@@ -334,22 +312,24 @@ class IModelHost {
334
312
  }
335
313
  /** The directory where application assets may be found */
336
314
  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.
315
+ /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileTreeProps should wait before returning a "pending" status.
338
316
  * @internal
339
317
  */
340
318
  static get tileTreeRequestTimeout() {
341
- return undefined !== IModelHost.configuration ? IModelHost.configuration.tileTreeRequestTimeout : IModelHostConfiguration.defaultTileRequestTimeout;
319
+ var _a, _b;
320
+ return (_b = (_a = IModelHost.configuration) === null || _a === void 0 ? void 0 : _a.tileTreeRequestTimeout) !== null && _b !== void 0 ? _b : IModelHostConfiguration.defaultTileRequestTimeout;
342
321
  }
343
- /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a "pending" status.
322
+ /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileContent should wait before returning a "pending" status.
344
323
  * @internal
345
324
  */
346
325
  static get tileContentRequestTimeout() {
347
- return undefined !== IModelHost.configuration ? IModelHost.configuration.tileContentRequestTimeout : IModelHostConfiguration.defaultTileRequestTimeout;
326
+ var _a, _b;
327
+ return (_b = (_a = IModelHost.configuration) === null || _a === void 0 ? void 0 : _a.tileContentRequestTimeout) !== null && _b !== void 0 ? _b : IModelHostConfiguration.defaultTileRequestTimeout;
348
328
  }
349
329
  /** 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; }
330
+ 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
331
  /** 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; }
332
+ 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
333
  /** Whether external tile caching is active.
354
334
  * @internal
355
335
  */
@@ -382,12 +362,18 @@ class IModelHost {
382
362
  throw new core_common_1.IModelError(core_common_1.BentleyStatus.ERROR, "Cannot use both Azure and custom cloud storage providers for tile cache.");
383
363
  }
384
364
  }
365
+ /** @internal */
366
+ static computeSchemaChecksum(arg) {
367
+ return this.platform.computeSchemaChecksum(arg);
368
+ }
385
369
  }
386
370
  exports.IModelHost = IModelHost;
387
371
  /** @alpha */
388
372
  IModelHost.telemetry = new core_telemetry_1.TelemetryManager();
389
373
  IModelHost.backendVersion = "";
390
374
  IModelHost._cacheDir = "";
375
+ /** Event raised during startup to allow loading settings data */
376
+ IModelHost.onWorkspaceStartup = new core_bentley_1.BeEvent();
391
377
  /** Event raised just after the backend IModelHost was started */
392
378
  IModelHost.onAfterStartup = new core_bentley_1.BeEvent();
393
379
  /** Event raised just before the backend IModelHost is to be shut down */