@itwin/core-backend 4.0.0-dev.80 → 4.0.0-dev.81
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.
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +12 -12
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +110 -42
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +42 -7
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeService.d.ts +61 -20
- package/lib/cjs/CodeService.d.ts.map +1 -1
- package/lib/cjs/CodeService.js +1 -1
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CodeSpecs.d.ts +6 -3
- package/lib/cjs/CodeSpecs.d.ts.map +1 -1
- package/lib/cjs/CodeSpecs.js +55 -25
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/Entity.d.ts +1 -1
- package/lib/cjs/Entity.d.ts.map +1 -1
- package/lib/cjs/Entity.js +3 -2
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +11 -5
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +15 -10
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +42 -29
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +121 -119
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/NativeHost.d.ts.map +1 -1
- package/lib/cjs/NativeHost.js +1 -3
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/core-backend.d.ts +27 -28
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +34 -35
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +3 -6
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js +3 -19
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/package.json +11 -11
package/lib/cjs/IModelHost.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module IModelHost
|
|
3
3
|
*/
|
|
4
|
+
import "./IModelDb";
|
|
4
5
|
import { IModelJsNative } from "@bentley/imodeljs-native";
|
|
5
|
-
import { ServerStorage } from "@itwin/object-storage-core";
|
|
6
6
|
import { AccessToken, BeEvent, GuidString, Mutable } from "@itwin/core-bentley";
|
|
7
7
|
import { AuthorizationClient, LocalDirName, SessionProps } from "@itwin/core-common";
|
|
8
8
|
import { TelemetryManager } from "@itwin/core-telemetry";
|
|
9
|
+
import { ServerStorage } from "@itwin/object-storage-core";
|
|
9
10
|
import { BackendHubAccess } from "./BackendHubAccess";
|
|
10
11
|
import { TileStorage } from "./TileStorage";
|
|
11
12
|
import { Workspace, WorkspaceOpts } from "./workspace/Workspace";
|
|
12
|
-
/** @
|
|
13
|
+
/** @internal */
|
|
13
14
|
export interface CrashReportingConfigNameValuePair {
|
|
14
15
|
name: string;
|
|
15
16
|
value: string;
|
|
16
17
|
}
|
|
17
18
|
/** Configuration of the crash-reporting system.
|
|
18
|
-
* @
|
|
19
|
+
* @internal
|
|
19
20
|
*/
|
|
20
21
|
export interface CrashReportingConfig {
|
|
21
22
|
/** The directory to which *.dmp and/or iModelJsNativeCrash*.properties.txt files are written. This directory will be created if it does not already exist. */
|
|
@@ -51,6 +52,12 @@ export interface AzureBlobStorageCredentials {
|
|
|
51
52
|
* @public
|
|
52
53
|
*/
|
|
53
54
|
export interface IModelHostOptions {
|
|
55
|
+
/**
|
|
56
|
+
* The name of the *Profile* subdirectory of [[cacheDir]] for this process. If not present, "default" is used.
|
|
57
|
+
* @see [[IModelHost.profileName]]
|
|
58
|
+
* @beta
|
|
59
|
+
*/
|
|
60
|
+
profileName?: string;
|
|
54
61
|
/**
|
|
55
62
|
* Root of the directory holding all the files that iTwin.js caches
|
|
56
63
|
* - If not specified at startup a platform specific default is used -
|
|
@@ -59,10 +66,6 @@ export interface IModelHostOptions {
|
|
|
59
66
|
* - Linux: $(HOMEDIR)/.cache/iModelJs/
|
|
60
67
|
* where $(HOMEDIR) is documented [here](https://nodejs.org/api/os.html#os_os_homedir)
|
|
61
68
|
* - if specified, ensure it is set to a folder with read/write access.
|
|
62
|
-
* - Sub-folders within this folder organize various caches -
|
|
63
|
-
* - bc/ -> Briefcases
|
|
64
|
-
* - appSettings/ -> Offline application settings (only relevant in native applications)
|
|
65
|
-
* - etc.
|
|
66
69
|
* @see [[IModelHost.cacheDir]] for the value it's set to after startup
|
|
67
70
|
*/
|
|
68
71
|
cacheDir?: LocalDirName;
|
|
@@ -123,7 +126,7 @@ export interface IModelHostOptions {
|
|
|
123
126
|
*/
|
|
124
127
|
logTileSizeThreshold?: number;
|
|
125
128
|
/** Crash-reporting configuration
|
|
126
|
-
* @
|
|
129
|
+
* @internal
|
|
127
130
|
*/
|
|
128
131
|
crashReportingConfig?: CrashReportingConfig;
|
|
129
132
|
/** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */
|
|
@@ -159,7 +162,7 @@ export declare class IModelHostConfiguration implements IModelHostOptions {
|
|
|
159
162
|
logTileLoadTimeThreshold: number;
|
|
160
163
|
/** @internal */
|
|
161
164
|
logTileSizeThreshold: number;
|
|
162
|
-
/** @
|
|
165
|
+
/** @internal */
|
|
163
166
|
crashReportingConfig?: CrashReportingConfig;
|
|
164
167
|
}
|
|
165
168
|
/** IModelHost initializes ($backend) and captures its configuration. A backend must call [[IModelHost.startup]] before using any backend classes.
|
|
@@ -173,12 +176,30 @@ export declare class IModelHost {
|
|
|
173
176
|
/** @alpha */
|
|
174
177
|
static readonly telemetry: TelemetryManager;
|
|
175
178
|
static backendVersion: string;
|
|
179
|
+
private static _profileName;
|
|
176
180
|
private static _cacheDir;
|
|
177
181
|
private static _appWorkspace?;
|
|
178
182
|
private static _platform?;
|
|
179
183
|
/** @internal */
|
|
180
184
|
static get platform(): typeof IModelJsNative;
|
|
181
185
|
static configuration?: IModelHostOptions;
|
|
186
|
+
/**
|
|
187
|
+
* The name of the *Profile* directory (a subdirectory of "[[cacheDir]]/profiles/") for this process.
|
|
188
|
+
*
|
|
189
|
+
* The *Profile* directory is used to cache data that is specific to a type-of-usage of the iTwin.js library.
|
|
190
|
+
* It is important that information in the profile cache be consistent but isolated across sessions (i.e.
|
|
191
|
+
* data for a profile is maintained between runs, but each profile is completely independent and
|
|
192
|
+
* unaffected by the presence ot use of others.)
|
|
193
|
+
* @note **Only one process at a time may be using a given profile**, and an exception will be thrown by [[startup]]
|
|
194
|
+
* if a second process attempts to use the same profile.
|
|
195
|
+
* @beta
|
|
196
|
+
*/
|
|
197
|
+
static get profileName(): string;
|
|
198
|
+
/** The full path of the Profile directory.
|
|
199
|
+
* @see [[profileName]]
|
|
200
|
+
* @beta
|
|
201
|
+
*/
|
|
202
|
+
static get profileDir(): LocalDirName;
|
|
182
203
|
/** Event raised during startup to allow loading settings data */
|
|
183
204
|
static readonly onWorkspaceStartup: BeEvent<() => void>;
|
|
184
205
|
/** Event raised just after the backend IModelHost was started */
|
|
@@ -217,10 +238,8 @@ export declare class IModelHost {
|
|
|
217
238
|
static getAccessToken(): Promise<AccessToken>;
|
|
218
239
|
/** @internal */
|
|
219
240
|
static flushLog(): void;
|
|
220
|
-
/** @internal */
|
|
221
|
-
static loadNative(): void;
|
|
222
241
|
private static syncNativeLogLevels;
|
|
223
|
-
private static
|
|
242
|
+
private static loadNative;
|
|
224
243
|
/** @internal */
|
|
225
244
|
static tileStorage?: TileStorage;
|
|
226
245
|
private static _hubAccess?;
|
|
@@ -238,7 +257,7 @@ export declare class IModelHost {
|
|
|
238
257
|
static get hubAccess(): BackendHubAccess;
|
|
239
258
|
private static initializeWorkspace;
|
|
240
259
|
private static _isValid;
|
|
241
|
-
/**
|
|
260
|
+
/** true between a successful call to [[startup]] and before [[shutdown]] */
|
|
242
261
|
static get isValid(): boolean;
|
|
243
262
|
/** This method must be called before any iTwin.js services are used.
|
|
244
263
|
* @param options Host configuration data.
|
|
@@ -246,27 +265,23 @@ export declare class IModelHost {
|
|
|
246
265
|
* @see [[shutdown]].
|
|
247
266
|
*/
|
|
248
267
|
static startup(options?: IModelHostOptions): Promise<void>;
|
|
249
|
-
private static
|
|
250
|
-
private static logStartup;
|
|
251
|
-
private static setupHostDirs;
|
|
268
|
+
private static setupCacheDir;
|
|
252
269
|
/** This method must be called when an iTwin.js host is shut down. Raises [[onBeforeShutdown]] */
|
|
253
270
|
static shutdown(): Promise<void>;
|
|
271
|
+
private static doShutdown;
|
|
254
272
|
/**
|
|
255
273
|
* Add or update a property that should be included in a crash report.
|
|
256
|
-
* @
|
|
257
|
-
* @param value The value of the property
|
|
258
|
-
* @alpha
|
|
274
|
+
* @internal
|
|
259
275
|
*/
|
|
260
276
|
static setCrashReportProperty(name: string, value: string): void;
|
|
261
277
|
/**
|
|
262
278
|
* Remove a previously defined property so that will not be included in a crash report.
|
|
263
|
-
* @
|
|
264
|
-
* @alpha
|
|
279
|
+
* @internal
|
|
265
280
|
*/
|
|
266
281
|
static removeCrashReportProperty(name: string): void;
|
|
267
282
|
/**
|
|
268
283
|
* Get all properties that will be included in a crash report.
|
|
269
|
-
* @
|
|
284
|
+
* @internal
|
|
270
285
|
*/
|
|
271
286
|
static getCrashReportProperties(): CrashReportingConfigNameValuePair[];
|
|
272
287
|
/** The directory where application assets may be found */
|
|
@@ -304,25 +319,23 @@ export declare class IModelHost {
|
|
|
304
319
|
exactMatch?: boolean;
|
|
305
320
|
}): string;
|
|
306
321
|
}
|
|
307
|
-
/** Information about the platform on which the app is running.
|
|
322
|
+
/** Information about the platform on which the app is running.
|
|
308
323
|
* @public
|
|
309
324
|
*/
|
|
310
325
|
export declare class Platform {
|
|
311
326
|
/** Get the name of the platform. */
|
|
312
327
|
static get platformName(): "win32" | "linux" | "darwin" | "ios" | "android" | "uwp";
|
|
313
|
-
/** @internal */
|
|
314
|
-
static load(): typeof IModelJsNative;
|
|
315
328
|
}
|
|
316
|
-
/** Well known directories that may be used by the application.
|
|
329
|
+
/** Well known directories that may be used by the application.
|
|
317
330
|
* @public
|
|
318
331
|
*/
|
|
319
332
|
export declare class KnownLocations {
|
|
320
333
|
/** The directory where the imodeljs-native assets are stored. */
|
|
321
|
-
static get nativeAssetsDir():
|
|
334
|
+
static get nativeAssetsDir(): LocalDirName;
|
|
322
335
|
/** The directory where the core-backend assets are stored. */
|
|
323
|
-
static get packageAssetsDir():
|
|
336
|
+
static get packageAssetsDir(): LocalDirName;
|
|
324
337
|
/** The temporary directory. */
|
|
325
|
-
static get tmpdir():
|
|
338
|
+
static get tmpdir(): LocalDirName;
|
|
326
339
|
}
|
|
327
340
|
/** Extend this class to provide custom file name resolution behavior.
|
|
328
341
|
* @note Only `tryResolveKey` and/or `tryResolveFileName` need to be overridden as the implementations of `resolveKey` and `resolveFileName` work for most purposes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelHost.d.ts","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"IModelHost.d.ts","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,YAAY,CAAC;AAGpB,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAU,OAAO,EAAkB,UAAU,EAAwB,OAAO,EAAmB,MAAM,qBAAqB,CAAC;AAC/I,OAAO,EAAE,mBAAmB,EAA8B,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,o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D"}
|
package/lib/cjs/IModelHost.js
CHANGED
|
@@ -8,19 +8,20 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.FileNameResolver = exports.KnownLocations = exports.Platform = exports.IModelHost = exports.IModelHostConfiguration = void 0;
|
|
11
|
+
// To avoid circular load errors, the "Element" classes must be loaded before IModelHost.
|
|
12
|
+
require("./IModelDb"); // DO NOT REMOVE OR MOVE THIS LINE!
|
|
13
|
+
const os = require("os");
|
|
11
14
|
const imodeljs_native_1 = require("@bentley/imodeljs-native");
|
|
12
|
-
const object_storage_azure_1 = require("@itwin/object-storage-azure");
|
|
13
15
|
const cloud_agnostic_core_1 = require("@itwin/cloud-agnostic-core");
|
|
14
|
-
const object_storage_core_1 = require("@itwin/object-storage-core");
|
|
15
16
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
16
17
|
const core_common_1 = require("@itwin/core-common");
|
|
17
18
|
const core_telemetry_1 = require("@itwin/core-telemetry");
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const path = require("path");
|
|
19
|
+
const object_storage_azure_1 = require("@itwin/object-storage-azure");
|
|
20
|
+
const object_storage_core_1 = require("@itwin/object-storage-core");
|
|
21
21
|
const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
|
|
22
22
|
const BisCoreSchema_1 = require("./BisCoreSchema");
|
|
23
23
|
const BriefcaseManager_1 = require("./BriefcaseManager");
|
|
24
|
+
const CloudSqlite_1 = require("./CloudSqlite");
|
|
24
25
|
const FunctionalSchema_1 = require("./domains/FunctionalSchema");
|
|
25
26
|
const GenericSchema_1 = require("./domains/GenericSchema");
|
|
26
27
|
const GeoCoordConfig_1 = require("./GeoCoordConfig");
|
|
@@ -35,6 +36,8 @@ const TileStorage_1 = require("./TileStorage");
|
|
|
35
36
|
const Settings_1 = require("./workspace/Settings");
|
|
36
37
|
const SettingsSchemas_1 = require("./workspace/SettingsSchemas");
|
|
37
38
|
const Workspace_1 = require("./workspace/Workspace");
|
|
39
|
+
const inversify_1 = require("inversify");
|
|
40
|
+
const path_1 = require("path");
|
|
38
41
|
const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.IModelHost;
|
|
39
42
|
/** Configuration of core-backend.
|
|
40
43
|
* @public
|
|
@@ -98,6 +101,27 @@ class IModelHost {
|
|
|
98
101
|
throw new Error("IModelHost.startup must be called first");
|
|
99
102
|
return this._platform;
|
|
100
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* The name of the *Profile* directory (a subdirectory of "[[cacheDir]]/profiles/") for this process.
|
|
106
|
+
*
|
|
107
|
+
* The *Profile* directory is used to cache data that is specific to a type-of-usage of the iTwin.js library.
|
|
108
|
+
* It is important that information in the profile cache be consistent but isolated across sessions (i.e.
|
|
109
|
+
* data for a profile is maintained between runs, but each profile is completely independent and
|
|
110
|
+
* unaffected by the presence ot use of others.)
|
|
111
|
+
* @note **Only one process at a time may be using a given profile**, and an exception will be thrown by [[startup]]
|
|
112
|
+
* if a second process attempts to use the same profile.
|
|
113
|
+
* @beta
|
|
114
|
+
*/
|
|
115
|
+
static get profileName() {
|
|
116
|
+
return this._profileName;
|
|
117
|
+
}
|
|
118
|
+
/** The full path of the Profile directory.
|
|
119
|
+
* @see [[profileName]]
|
|
120
|
+
* @beta
|
|
121
|
+
*/
|
|
122
|
+
static get profileDir() {
|
|
123
|
+
return (0, path_1.join)(this._cacheDir, "profiles", this._profileName);
|
|
124
|
+
}
|
|
101
125
|
/** A uniqueId for this session */
|
|
102
126
|
static get sessionId() { return this.session.sessionId; }
|
|
103
127
|
static set sessionId(id) { this.session.sessionId = id; }
|
|
@@ -125,7 +149,7 @@ class IModelHost {
|
|
|
125
149
|
*/
|
|
126
150
|
static async getAccessToken() {
|
|
127
151
|
try {
|
|
128
|
-
return (await
|
|
152
|
+
return (await IModelHost.authorizationClient?.getAccessToken()) ?? "";
|
|
129
153
|
}
|
|
130
154
|
catch (e) {
|
|
131
155
|
return "";
|
|
@@ -133,22 +157,37 @@ class IModelHost {
|
|
|
133
157
|
}
|
|
134
158
|
/** @internal */
|
|
135
159
|
static flushLog() {
|
|
136
|
-
return
|
|
137
|
-
}
|
|
138
|
-
/** @internal */
|
|
139
|
-
static loadNative() {
|
|
140
|
-
const platform = Platform.load();
|
|
141
|
-
this.registerPlatform(platform);
|
|
160
|
+
return IModelHost.platform.flushLog();
|
|
142
161
|
}
|
|
143
162
|
static syncNativeLogLevels() {
|
|
144
163
|
this.platform.clearLogLevelCache();
|
|
145
164
|
}
|
|
146
|
-
static
|
|
147
|
-
this._platform
|
|
148
|
-
if (undefined === platform)
|
|
165
|
+
static loadNative(options) {
|
|
166
|
+
if (undefined !== this._platform)
|
|
149
167
|
return;
|
|
150
|
-
|
|
151
|
-
|
|
168
|
+
this._platform = core_bentley_1.ProcessDetector.isMobileAppBackend ? process._linkedBinding("iModelJsNative") : imodeljs_native_1.NativeLibrary.load();
|
|
169
|
+
this._platform.logger = core_bentley_1.Logger;
|
|
170
|
+
core_bentley_1.Logger.logLevelChangedFn = () => IModelHost.syncNativeLogLevels(); // the arrow function exists only so that it can be spied in tests
|
|
171
|
+
if (options.crashReportingConfig && options.crashReportingConfig.crashDir && !core_bentley_1.ProcessDetector.isElectronAppBackend && !core_bentley_1.ProcessDetector.isMobileAppBackend) {
|
|
172
|
+
this.platform.setCrashReporting(options.crashReportingConfig);
|
|
173
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "Configured crash reporting", {
|
|
174
|
+
enableCrashDumps: options.crashReportingConfig?.enableCrashDumps,
|
|
175
|
+
wantFullMemoryDumps: options.crashReportingConfig?.wantFullMemoryDumps,
|
|
176
|
+
enableNodeReport: options.crashReportingConfig?.enableNodeReport,
|
|
177
|
+
uploadToBentley: options.crashReportingConfig?.uploadToBentley,
|
|
178
|
+
});
|
|
179
|
+
if (options.crashReportingConfig.enableNodeReport) {
|
|
180
|
+
if (process.report !== undefined) {
|
|
181
|
+
process.report.reportOnFatalError = true;
|
|
182
|
+
process.report.reportOnUncaughtException = true;
|
|
183
|
+
process.report.directory = options.crashReportingConfig.crashDir;
|
|
184
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "Configured Node.js crash reporting");
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
core_bentley_1.Logger.logWarning(loggerCategory, "Unable to configure Node.js crash reporting");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
152
191
|
}
|
|
153
192
|
/** @internal */
|
|
154
193
|
static setHubAccess(hubAccess) { this._hubAccess = hubAccess; }
|
|
@@ -162,21 +201,30 @@ class IModelHost {
|
|
|
162
201
|
* To determine whether one is present, use [[getHubAccess]].
|
|
163
202
|
*/
|
|
164
203
|
static get hubAccess() {
|
|
165
|
-
if (
|
|
204
|
+
if (IModelHost._hubAccess === undefined)
|
|
166
205
|
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "No BackendHubAccess supplied in IModelHostOptions");
|
|
167
|
-
return
|
|
206
|
+
return IModelHost._hubAccess;
|
|
168
207
|
}
|
|
169
208
|
static initializeWorkspace(configuration) {
|
|
170
|
-
const settingAssets =
|
|
171
|
-
SettingsSchemas_1.SettingsSchemas.addDirectory(
|
|
209
|
+
const settingAssets = (0, path_1.join)(KnownLocations.packageAssetsDir, "Settings");
|
|
210
|
+
SettingsSchemas_1.SettingsSchemas.addDirectory((0, path_1.join)(settingAssets, "Schemas"));
|
|
172
211
|
this._appWorkspace = new Workspace_1.ITwinWorkspace(new ApplicationSettings(), configuration.workspace);
|
|
212
|
+
// Create the CloudCache for Workspaces. This will fail if another process is already using the same profile.
|
|
213
|
+
try {
|
|
214
|
+
this.appWorkspace.getCloudCache();
|
|
215
|
+
}
|
|
216
|
+
catch (e) {
|
|
217
|
+
throw (e.errorNumber === core_bentley_1.DbResult.BE_SQLITE_BUSY) ? new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_BUSY, `Profile [${this.profileDir}] is already in use by another process`) : e;
|
|
218
|
+
}
|
|
173
219
|
this.appWorkspace.settings.addDirectory(settingAssets, Settings_1.SettingsPriority.defaults);
|
|
174
220
|
GeoCoordConfig_1.GeoCoordConfig.onStartup();
|
|
175
221
|
// allow applications to load their default settings
|
|
176
222
|
this.onWorkspaceStartup.raiseEvent();
|
|
177
223
|
}
|
|
178
|
-
/**
|
|
179
|
-
static get isValid() {
|
|
224
|
+
/** true between a successful call to [[startup]] and before [[shutdown]] */
|
|
225
|
+
static get isValid() {
|
|
226
|
+
return IModelHost._isValid;
|
|
227
|
+
}
|
|
180
228
|
/** This method must be called before any iTwin.js services are used.
|
|
181
229
|
* @param options Host configuration data.
|
|
182
230
|
* Raises [[onAfterStartup]].
|
|
@@ -187,44 +235,15 @@ class IModelHost {
|
|
|
187
235
|
return; // we're already initialized
|
|
188
236
|
this._isValid = true;
|
|
189
237
|
options = options ?? {};
|
|
190
|
-
if (
|
|
191
|
-
|
|
238
|
+
if (this.sessionId === "")
|
|
239
|
+
this.sessionId = core_bentley_1.Guid.createValue();
|
|
192
240
|
this.authorizationClient = options.authorizationClient;
|
|
193
|
-
this.logStartup();
|
|
194
241
|
this.backendVersion = require("../../package.json").version; // eslint-disable-line @typescript-eslint/no-var-requires
|
|
195
242
|
(0, RpcBackend_1.initializeRpcBackend)(options.enableOpenTelemetry);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
this.loadNative();
|
|
199
|
-
}
|
|
200
|
-
catch (error) {
|
|
201
|
-
core_bentley_1.Logger.logError(loggerCategory, "Error registering/loading the native platform API", () => (options));
|
|
202
|
-
throw error;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
if (options.crashReportingConfig && options.crashReportingConfig.crashDir && !core_bentley_1.ProcessDetector.isElectronAppBackend && !core_bentley_1.ProcessDetector.isMobileAppBackend) {
|
|
206
|
-
this.platform.setCrashReporting(options.crashReportingConfig);
|
|
207
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "Configured crash reporting", {
|
|
208
|
-
enableCrashDumps: options.crashReportingConfig?.enableCrashDumps,
|
|
209
|
-
wantFullMemoryDumps: options.crashReportingConfig?.wantFullMemoryDumps,
|
|
210
|
-
enableNodeReport: options.crashReportingConfig?.enableNodeReport,
|
|
211
|
-
uploadToBentley: options.crashReportingConfig?.uploadToBentley,
|
|
212
|
-
});
|
|
213
|
-
if (options.crashReportingConfig.enableNodeReport) {
|
|
214
|
-
if (process.report !== undefined) {
|
|
215
|
-
process.report.reportOnFatalError = true;
|
|
216
|
-
process.report.reportOnUncaughtException = true;
|
|
217
|
-
process.report.directory = options.crashReportingConfig.crashDir;
|
|
218
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "Configured Node.js crash reporting");
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
core_bentley_1.Logger.logWarning(loggerCategory, "Unable to configure Node.js crash reporting");
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
this.setupHostDirs(options);
|
|
243
|
+
this.loadNative(options);
|
|
244
|
+
this.setupCacheDir(options);
|
|
226
245
|
this.initializeWorkspace(options);
|
|
227
|
-
BriefcaseManager_1.BriefcaseManager.initialize(this.
|
|
246
|
+
BriefcaseManager_1.BriefcaseManager.initialize((0, path_1.join)(this._cacheDir, "imodels"));
|
|
228
247
|
[
|
|
229
248
|
IModelReadRpcImpl_1.IModelReadRpcImpl,
|
|
230
249
|
IModelTileRpcImpl_1.IModelTileRpcImpl,
|
|
@@ -244,78 +263,55 @@ class IModelHost {
|
|
|
244
263
|
process.once("beforeExit", IModelHost.shutdown);
|
|
245
264
|
this.onAfterStartup.raiseEvent();
|
|
246
265
|
}
|
|
247
|
-
static
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const serviceName = process.env.FABRIC_SERVICE_NAME;
|
|
253
|
-
if (serviceName) {
|
|
254
|
-
// e.g., fabric:/iModelWebViewer3.0/iModelJSGuest/1/08daaeb3-b56f-480b-9051-7efc834d18ae/512d971d-b641-4735-bb1c-c07ab3e44ce7/c1315fcce125ca40b2d405bb7809214daf8b4c85
|
|
255
|
-
const serviceNameComponents = serviceName.split("/");
|
|
256
|
-
if (serviceNameComponents.length === 7) {
|
|
257
|
-
startupInfo = {
|
|
258
|
-
...startupInfo,
|
|
259
|
-
iTwinId: serviceNameComponents[4],
|
|
260
|
-
iModelId: serviceNameComponents[5],
|
|
261
|
-
changesetId: serviceNameComponents[6],
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "IModelHost.startup", () => startupInfo);
|
|
266
|
-
}
|
|
267
|
-
static setupHostDirs(configuration) {
|
|
268
|
-
const setupDir = (dir) => {
|
|
269
|
-
dir = path.normalize(dir);
|
|
270
|
-
IModelJsFs_1.IModelJsFs.recursiveMkDirSync(dir);
|
|
271
|
-
return dir;
|
|
272
|
-
};
|
|
273
|
-
this._cacheDir = setupDir(configuration.cacheDir ?? imodeljs_native_1.NativeLibrary.defaultCacheDir);
|
|
274
|
-
this._briefcaseCacheDir = path.join(this._cacheDir, "imodels");
|
|
266
|
+
static setupCacheDir(configuration) {
|
|
267
|
+
this._cacheDir = (0, path_1.normalize)(configuration.cacheDir ?? imodeljs_native_1.NativeLibrary.defaultCacheDir);
|
|
268
|
+
IModelJsFs_1.IModelJsFs.recursiveMkDirSync(this._cacheDir);
|
|
269
|
+
this._profileName = configuration.profileName ?? "default";
|
|
270
|
+
core_bentley_1.Logger.logInfo(loggerCategory, `cacheDir: [${this.cacheDir}], profileDir: [${this.profileDir}]`);
|
|
275
271
|
}
|
|
276
272
|
/** This method must be called when an iTwin.js host is shut down. Raises [[onBeforeShutdown]] */
|
|
277
273
|
static async shutdown() {
|
|
278
|
-
//
|
|
279
|
-
|
|
274
|
+
// Note: This method is set as a node listener where `this` is unbound. Call private method to
|
|
275
|
+
// ensure `this` is correct. Don't combine these methods.
|
|
276
|
+
return IModelHost.doShutdown();
|
|
277
|
+
}
|
|
278
|
+
static async doShutdown() {
|
|
279
|
+
if (!this._isValid)
|
|
280
280
|
return;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
281
|
+
this._isValid = false;
|
|
282
|
+
this.onBeforeShutdown.raiseEvent();
|
|
283
|
+
this.configuration = undefined;
|
|
284
|
+
this.tileStorage = undefined;
|
|
285
|
+
this._appWorkspace?.close();
|
|
286
|
+
this._appWorkspace = undefined;
|
|
287
|
+
CloudSqlite_1.CloudSqlite.CloudCaches.destroy();
|
|
288
288
|
process.removeListener("beforeExit", IModelHost.shutdown);
|
|
289
289
|
}
|
|
290
290
|
/**
|
|
291
291
|
* Add or update a property that should be included in a crash report.
|
|
292
|
-
* @
|
|
293
|
-
* @param value The value of the property
|
|
294
|
-
* @alpha
|
|
292
|
+
* @internal
|
|
295
293
|
*/
|
|
296
294
|
static setCrashReportProperty(name, value) {
|
|
297
|
-
(
|
|
298
|
-
this._platform.setCrashReportProperty(name, value);
|
|
295
|
+
this.platform.setCrashReportProperty(name, value);
|
|
299
296
|
}
|
|
300
297
|
/**
|
|
301
298
|
* Remove a previously defined property so that will not be included in a crash report.
|
|
302
|
-
* @
|
|
303
|
-
* @alpha
|
|
299
|
+
* @internal
|
|
304
300
|
*/
|
|
305
301
|
static removeCrashReportProperty(name) {
|
|
306
|
-
(
|
|
307
|
-
this._platform.setCrashReportProperty(name, undefined);
|
|
302
|
+
this.platform.setCrashReportProperty(name, undefined);
|
|
308
303
|
}
|
|
309
304
|
/**
|
|
310
305
|
* Get all properties that will be included in a crash report.
|
|
311
|
-
* @
|
|
306
|
+
* @internal
|
|
312
307
|
*/
|
|
313
308
|
static getCrashReportProperties() {
|
|
314
|
-
|
|
315
|
-
return this._platform.getCrashReportProperties();
|
|
309
|
+
return this.platform.getCrashReportProperties();
|
|
316
310
|
}
|
|
317
311
|
/** The directory where application assets may be found */
|
|
318
|
-
static get appAssetsDir() {
|
|
312
|
+
static get appAssetsDir() {
|
|
313
|
+
return undefined !== IModelHost.configuration ? IModelHost.configuration.appAssetsDir : undefined;
|
|
314
|
+
}
|
|
319
315
|
/** The time, in milliseconds, for which IModelTileRpcInterface.requestTileTreeProps should wait before returning a "pending" status.
|
|
320
316
|
* @internal
|
|
321
317
|
*/
|
|
@@ -329,9 +325,13 @@ class IModelHost {
|
|
|
329
325
|
return IModelHost.configuration?.tileContentRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;
|
|
330
326
|
}
|
|
331
327
|
/** The backend will log when a tile took longer to load than this threshold in seconds. */
|
|
332
|
-
static get logTileLoadTimeThreshold() {
|
|
328
|
+
static get logTileLoadTimeThreshold() {
|
|
329
|
+
return IModelHost.configuration?.logTileLoadTimeThreshold ?? IModelHostConfiguration.defaultLogTileLoadTimeThreshold;
|
|
330
|
+
}
|
|
333
331
|
/** The backend will log when a tile is loaded with a size in bytes above this threshold. */
|
|
334
|
-
static get logTileSizeThreshold() {
|
|
332
|
+
static get logTileSizeThreshold() {
|
|
333
|
+
return IModelHost.configuration?.logTileSizeThreshold ?? IModelHostConfiguration.defaultLogTileSizeThreshold;
|
|
334
|
+
}
|
|
335
335
|
/** Whether external tile caching is active.
|
|
336
336
|
* @internal
|
|
337
337
|
*/
|
|
@@ -341,11 +341,15 @@ class IModelHost {
|
|
|
341
341
|
/** Whether to restrict tile cache URLs by client IP address.
|
|
342
342
|
* @internal
|
|
343
343
|
*/
|
|
344
|
-
static get restrictTileUrlsByClientIp() {
|
|
344
|
+
static get restrictTileUrlsByClientIp() {
|
|
345
|
+
return undefined !== IModelHost.configuration && (IModelHost.configuration.restrictTileUrlsByClientIp ? true : false);
|
|
346
|
+
}
|
|
345
347
|
/** Whether to compress cached tiles.
|
|
346
348
|
* @internal
|
|
347
349
|
*/
|
|
348
|
-
static get compressCachedTiles() {
|
|
350
|
+
static get compressCachedTiles() {
|
|
351
|
+
return false !== IModelHost.configuration?.compressCachedTiles;
|
|
352
|
+
}
|
|
349
353
|
static setupTileCache() {
|
|
350
354
|
(0, core_bentley_1.assert)(undefined !== IModelHost.configuration);
|
|
351
355
|
const config = IModelHost.configuration;
|
|
@@ -398,7 +402,7 @@ IModelHost.onBeforeShutdown = new core_bentley_1.BeEvent();
|
|
|
398
402
|
IModelHost.session = { applicationId: "2686", applicationVersion: "1.0.0", sessionId: "" };
|
|
399
403
|
IModelHost._isValid = false;
|
|
400
404
|
exports.IModelHost = IModelHost;
|
|
401
|
-
/** Information about the platform on which the app is running.
|
|
405
|
+
/** Information about the platform on which the app is running.
|
|
402
406
|
* @public
|
|
403
407
|
*/
|
|
404
408
|
class Platform {
|
|
@@ -406,21 +410,19 @@ class Platform {
|
|
|
406
410
|
static get platformName() {
|
|
407
411
|
return process.platform;
|
|
408
412
|
}
|
|
409
|
-
/** @internal */
|
|
410
|
-
static load() {
|
|
411
|
-
return core_bentley_1.ProcessDetector.isMobileAppBackend ? process._linkedBinding("iModelJsNative") : imodeljs_native_1.NativeLibrary.load();
|
|
412
|
-
}
|
|
413
413
|
}
|
|
414
414
|
exports.Platform = Platform;
|
|
415
|
-
/** Well known directories that may be used by the application.
|
|
415
|
+
/** Well known directories that may be used by the application.
|
|
416
416
|
* @public
|
|
417
417
|
*/
|
|
418
418
|
class KnownLocations {
|
|
419
419
|
/** The directory where the imodeljs-native assets are stored. */
|
|
420
|
-
static get nativeAssetsDir() {
|
|
420
|
+
static get nativeAssetsDir() {
|
|
421
|
+
return IModelHost.platform.DgnDb.getAssetsDir();
|
|
422
|
+
}
|
|
421
423
|
/** The directory where the core-backend assets are stored. */
|
|
422
424
|
static get packageAssetsDir() {
|
|
423
|
-
return
|
|
425
|
+
return (0, path_1.join)(__dirname, "assets");
|
|
424
426
|
}
|
|
425
427
|
/** The temporary directory. */
|
|
426
428
|
static get tmpdir() {
|