@itwin/core-backend 3.3.0-dev.6 → 3.3.0-dev.60

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 (97) hide show
  1. package/CHANGELOG.md +33 -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 +17 -3
  42. package/lib/cjs/IModelHost.d.ts.map +1 -1
  43. package/lib/cjs/IModelHost.js +36 -19
  44. package/lib/cjs/IModelHost.js.map +1 -1
  45. package/lib/cjs/LocalHub.d.ts +163 -0
  46. package/lib/cjs/LocalHub.d.ts.map +1 -0
  47. package/lib/cjs/LocalHub.js +588 -0
  48. package/lib/cjs/LocalHub.js.map +1 -0
  49. package/lib/cjs/LocalhostIpcHost.d.ts.map +1 -1
  50. package/lib/cjs/LocalhostIpcHost.js +16 -0
  51. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  52. package/lib/cjs/RpcBackend.d.ts +2 -0
  53. package/lib/cjs/RpcBackend.d.ts.map +1 -1
  54. package/lib/cjs/RpcBackend.js +19 -2
  55. package/lib/cjs/RpcBackend.js.map +1 -1
  56. package/lib/cjs/SQLiteDb.d.ts +4 -3
  57. package/lib/cjs/SQLiteDb.d.ts.map +1 -1
  58. package/lib/cjs/SQLiteDb.js +5 -4
  59. package/lib/cjs/SQLiteDb.js.map +1 -1
  60. package/lib/cjs/SqliteStatement.d.ts +4 -0
  61. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  62. package/lib/cjs/SqliteStatement.js +4 -0
  63. package/lib/cjs/SqliteStatement.js.map +1 -1
  64. package/lib/cjs/ViewDefinition.d.ts +6 -6
  65. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  66. package/lib/cjs/ViewDefinition.js +20 -20
  67. package/lib/cjs/ViewDefinition.js.map +1 -1
  68. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +68 -0
  69. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +22 -0
  70. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +53 -0
  71. package/lib/cjs/assets/Settings/backend.setting.json5 +139 -0
  72. package/lib/cjs/core-backend.d.ts +9 -7
  73. package/lib/cjs/core-backend.d.ts.map +1 -1
  74. package/lib/cjs/core-backend.js +9 -7
  75. package/lib/cjs/core-backend.js.map +1 -1
  76. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +1 -1
  77. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
  78. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +8 -12
  79. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  80. package/lib/cjs/workspace/Settings.d.ts +8 -3
  81. package/lib/cjs/workspace/Settings.d.ts.map +1 -1
  82. package/lib/cjs/workspace/Settings.js +9 -0
  83. package/lib/cjs/workspace/Settings.js.map +1 -1
  84. package/lib/cjs/workspace/SettingsSchemas.d.ts +76 -0
  85. package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -0
  86. package/lib/cjs/workspace/SettingsSchemas.js +192 -0
  87. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -0
  88. package/lib/cjs/workspace/Workspace.d.ts +241 -146
  89. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  90. package/lib/cjs/workspace/Workspace.js +260 -96
  91. package/lib/cjs/workspace/Workspace.js.map +1 -1
  92. package/package.json +23 -18
  93. package/lib/cjs/assets/Settings.schema.json +0 -25
  94. package/lib/cjs/workspace/SettingsSpecRegistry.d.ts +0 -68
  95. package/lib/cjs/workspace/SettingsSpecRegistry.d.ts.map +0 -1
  96. package/lib/cjs/workspace/SettingsSpecRegistry.js +0 -122
  97. 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";
@@ -139,6 +139,8 @@ export declare class IModelHost {
139
139
  /** @internal */
140
140
  static get platform(): typeof IModelJsNative;
141
141
  static configuration?: IModelHostConfiguration;
142
+ /** Event raised during startup to allow loading settings data */
143
+ static readonly onWorkspaceStartup: BeEvent<() => void>;
142
144
  /** Event raised just after the backend IModelHost was started */
143
145
  static readonly onAfterStartup: BeEvent<() => void>;
144
146
  /** Event raised just before the backend IModelHost is to be shut down */
@@ -186,14 +188,20 @@ export declare class IModelHost {
186
188
  static tileCacheService?: CloudStorageService;
187
189
  /** @internal */
188
190
  static tileUploader?: CloudStorageTileUploader;
189
- private static _hubAccess;
191
+ private static _hubAccess?;
190
192
  /** @internal */
191
- static setHubAccess(hubAccess: BackendHubAccess): void;
193
+ static setHubAccess(hubAccess: BackendHubAccess | undefined): void;
194
+ /** get the current hubAccess, if present.
195
+ * @beta
196
+ */
197
+ static getHubAccess(): BackendHubAccess | undefined;
192
198
  /** Provides access to the IModelHub for this IModelHost
193
199
  * @beta
194
200
  * @note If [[IModelHostConfiguration.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.
201
+ * To determine whether one is present, use [[getHubAccess]].
195
202
  */
196
203
  static get hubAccess(): BackendHubAccess;
204
+ private static initializeWorkspace;
197
205
  private static _isValid;
198
206
  /** Returns true if IModelHost is started. */
199
207
  static get isValid(): boolean;
@@ -253,6 +261,12 @@ export declare class IModelHost {
253
261
  */
254
262
  static get compressCachedTiles(): boolean;
255
263
  private static setupTileCache;
264
+ /** @internal */
265
+ static computeSchemaChecksum(arg: {
266
+ schemaXmlPath: string;
267
+ referencePaths: string[];
268
+ exactMatch?: boolean;
269
+ }): string;
256
270
  }
257
271
  /** Information about the platform on which the app is running. Also see [[KnownLocations]] and [[IModelJsFs]].
258
272
  * @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,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,0KAA0K;IAC1K,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iHAAiH;IACjH,MAAM,CAAC,EAAE,iC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U,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,9 +29,9 @@ 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
@@ -69,13 +70,13 @@ IModelHostConfiguration.defaultLogTileLoadTimeThreshold = 40;
69
70
  */
70
71
  IModelHostConfiguration.defaultLogTileSizeThreshold = 20 * 1000000;
71
72
  /**
72
- * Settings for the application workspace.
73
+ * Settings for `IModelHost.appWorkspace`.
73
74
  * @note this includes the default dictionary from the SettingsSpecRegistry
74
75
  */
75
76
  class ApplicationSettings extends Settings_1.BaseSettings {
76
77
  constructor() {
77
78
  super();
78
- this._remove = SettingsSpecRegistry_1.SettingsSpecRegistry.onSpecsChanged.addListener(() => this.updateDefaults());
79
+ this._remove = SettingsSchemas_1.SettingsSchemas.onSchemaChanged.addListener(() => this.updateDefaults());
79
80
  this.updateDefaults();
80
81
  }
81
82
  verifyPriority(priority) {
@@ -84,9 +85,9 @@ class ApplicationSettings extends Settings_1.BaseSettings {
84
85
  }
85
86
  updateDefaults() {
86
87
  const defaults = {};
87
- for (const [specName, val] of SettingsSpecRegistry_1.SettingsSpecRegistry.allSpecs) {
88
+ for (const [schemaName, val] of SettingsSchemas_1.SettingsSchemas.allSchemas) {
88
89
  if (val.default)
89
- defaults[specName] = val.default;
90
+ defaults[schemaName] = val.default;
90
91
  }
91
92
  this.addDictionary("_default_", 0, defaults);
92
93
  }
@@ -145,7 +146,7 @@ class IModelHost {
145
146
  }
146
147
  /** @internal */
147
148
  static flushLog() {
148
- return this.platform.DgnDb.flushLog();
149
+ return this.platform.flushLog();
149
150
  }
150
151
  /** @internal */
151
152
  static loadNative() {
@@ -174,19 +175,29 @@ class IModelHost {
174
175
  }
175
176
  /** @internal */
176
177
  static setHubAccess(hubAccess) { this._hubAccess = hubAccess; }
178
+ /** get the current hubAccess, if present.
179
+ * @beta
180
+ */
181
+ static getHubAccess() { return this._hubAccess; }
177
182
  /** Provides access to the IModelHub for this IModelHost
178
183
  * @beta
179
184
  * @note If [[IModelHostConfiguration.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.
185
+ * To determine whether one is present, use [[getHubAccess]].
180
186
  */
181
187
  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
188
  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");
189
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, "No BackendHubAccess supplied in IModelHostConfiguration");
188
190
  return this._hubAccess;
189
191
  }
192
+ static initializeWorkspace(configuration) {
193
+ const settingAssets = path.join(KnownLocations.packageAssetsDir, "Settings");
194
+ SettingsSchemas_1.SettingsSchemas.addDirectory(path.join(settingAssets, "Schemas"));
195
+ this._appWorkspace = new Workspace_1.ITwinWorkspace(new ApplicationSettings(), configuration.workspace);
196
+ this.appWorkspace.settings.addDirectory(settingAssets, Settings_1.SettingsPriority.defaults);
197
+ GeoCoordConfig_1.GeoCoordConfig.onStartup();
198
+ // allow applications to load their default settings
199
+ this.onWorkspaceStartup.raiseEvent();
200
+ }
190
201
  /** Returns true if IModelHost is started. */
191
202
  static get isValid() { return this._isValid; }
192
203
  /** This method must be called before any iTwin.js services are used.
@@ -239,7 +250,7 @@ class IModelHost {
239
250
  }
240
251
  }
241
252
  this.setupHostDirs(configuration);
242
- this._appWorkspace = new Workspace_1.ITwinWorkspace(new ApplicationSettings(), configuration.workspace);
253
+ this.initializeWorkspace(configuration);
243
254
  BriefcaseManager_1.BriefcaseManager.initialize(this._briefcaseCacheDir);
244
255
  [
245
256
  IModelReadRpcImpl_1.IModelReadRpcImpl,
@@ -254,12 +265,12 @@ class IModelHost {
254
265
  FunctionalSchema_1.FunctionalSchema,
255
266
  ].forEach((schema) => schema.registerSchema()); // register all of the schemas
256
267
  if (undefined !== configuration.hubAccess)
257
- IModelHost._hubAccess = configuration.hubAccess;
258
- IModelHost.configuration = configuration;
259
- IModelHost.setupTileCache();
268
+ this._hubAccess = configuration.hubAccess;
269
+ this.configuration = configuration;
270
+ this.setupTileCache();
260
271
  this.platform.setUseTileCache(IModelHost.tileCacheService ? false : true);
261
272
  process.once("beforeExit", IModelHost.shutdown);
262
- IModelHost.onAfterStartup.raiseEvent();
273
+ this.onAfterStartup.raiseEvent();
263
274
  }
264
275
  static logStartup() {
265
276
  if (!core_bentley_1.Logger.isEnabled(loggerCategory, core_bentley_1.LogLevel.Trace))
@@ -301,7 +312,7 @@ class IModelHost {
301
312
  IModelHost.configuration = undefined;
302
313
  IModelHost.tileCacheService = undefined;
303
314
  IModelHost.tileUploader = undefined;
304
- IModelHost.appWorkspace.close();
315
+ await IModelHost.appWorkspace.close();
305
316
  IModelHost._appWorkspace = undefined;
306
317
  process.removeListener("beforeExit", IModelHost.shutdown);
307
318
  }
@@ -382,12 +393,18 @@ class IModelHost {
382
393
  throw new core_common_1.IModelError(core_common_1.BentleyStatus.ERROR, "Cannot use both Azure and custom cloud storage providers for tile cache.");
383
394
  }
384
395
  }
396
+ /** @internal */
397
+ static computeSchemaChecksum(arg) {
398
+ return this.platform.computeSchemaChecksum(arg);
399
+ }
385
400
  }
386
401
  exports.IModelHost = IModelHost;
387
402
  /** @alpha */
388
403
  IModelHost.telemetry = new core_telemetry_1.TelemetryManager();
389
404
  IModelHost.backendVersion = "";
390
405
  IModelHost._cacheDir = "";
406
+ /** Event raised during startup to allow loading settings data */
407
+ IModelHost.onWorkspaceStartup = new core_bentley_1.BeEvent();
391
408
  /** Event raised just after the backend IModelHost was started */
392
409
  IModelHost.onAfterStartup = new core_bentley_1.BeEvent();
393
410
  /** Event raised just before the backend IModelHost is to be shut down */
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHost.js","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yBAAyB;AACzB,6BAA6B;AAC7B,iCAAiC;AACjC,8D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AC,QAAQ,EAAE,GAAG,UAAU,eAAe,CAAC,CAAC;SAC5E;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAnCD,4CAmCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelHost\r\n */\r\n\r\nimport * as os from \"os\";\r\nimport * as path from \"path\";\r\nimport * as semver from \"semver\";\r\nimport { IModelJsNative, NativeLibrary } from \"@bentley/imodeljs-native\";\r\nimport { TelemetryManager } from \"@itwin/core-telemetry\";\r\nimport { AccessToken, assert, BeEvent, Guid, GuidString, IModelStatus, Logger, LogLevel, Mutable, ProcessDetector } from \"@itwin/core-bentley\";\r\nimport { AuthorizationClient, BentleyStatus, IModelError, LocalDirName, SessionProps } from \"@itwin/core-common\";\r\nimport { BackendHubAccess } from \"./BackendHubAccess\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { BisCoreSchema } from \"./BisCoreSchema\";\r\nimport { BriefcaseManager } from \"./BriefcaseManager\";\r\nimport { AzureBlobStorage, AzureBlobStorageCredentials, CloudStorageService, CloudStorageTileUploader } from \"./CloudStorageBackend\";\r\nimport { FunctionalSchema } from \"./domains/FunctionalSchema\";\r\nimport { GenericSchema } from \"./domains/GenericSchema\";\r\nimport { IModelJsFs } from \"./IModelJsFs\";\r\nimport { DevToolsRpcImpl } from \"./rpc-impl/DevToolsRpcImpl\";\r\nimport { IModelReadRpcImpl } from \"./rpc-impl/IModelReadRpcImpl\";\r\nimport { IModelTileRpcImpl } from \"./rpc-impl/IModelTileRpcImpl\";\r\nimport { SnapshotIModelRpcImpl } from \"./rpc-impl/SnapshotIModelRpcImpl\";\r\nimport { WipRpcImpl } from \"./rpc-impl/WipRpcImpl\";\r\nimport { initializeRpcBackend } from \"./RpcBackend\";\r\nimport { ITwinWorkspace, Workspace, WorkspaceOpts } from \"./workspace/Workspace\";\r\nimport { BaseSettings, SettingDictionary, SettingsPriority } from \"./workspace/Settings\";\r\nimport { SettingsSpecRegistry } from \"./workspace/SettingsSpecRegistry\";\r\n\r\nconst loggerCategory = BackendLoggerCategory.IModelHost;\r\n\r\n// cspell:ignore nodereport fatalerror apicall alicloud rpcs\r\n\r\n/** @alpha */\r\nexport interface CrashReportingConfigNameValuePair {\r\n name: string;\r\n value: string;\r\n}\r\n\r\n/** Configuration of the crash-reporting system.\r\n * @alpha\r\n */\r\nexport interface CrashReportingConfig {\r\n /** The directory to which *.dmp and/or iModelJsNativeCrash*.properties.txt files are written. This directory will be created if it does not already exist. */\r\n crashDir: string;\r\n /** max # .dmp files that may exist in crashDir. The default is 50. */\r\n maxDumpsInDir?: number;\r\n /** Enable crash-dumps? If so, .dmp and .properties.txt files will be generated and written to crashDir in the event of an unhandled native-code exception. If not, only .properties.txt files will be written. The default is false. */\r\n enableCrashDumps?: boolean;\r\n /** If enableCrashDumps is true, do you want a full-memory dump? Defaults to false. */\r\n wantFullMemoryDumps?: boolean;\r\n /** Enable node-report? If so, node-report files will be generated in the event of an unhandled exception or fatal error and written to crashDir. The default is false. */\r\n enableNodeReport?: boolean;\r\n /** Additional name, value pairs to write to iModelJsNativeCrash*.properties.txt file in the event of a crash. */\r\n params?: CrashReportingConfigNameValuePair[];\r\n /** Run this .js file to process .dmp and node-report files in the event of a crash.\r\n * This script will be executed with a single command-line parameter: the name of the dump or node-report file.\r\n * In the case of a dump file, there will be a second file with the same basename and the extension \".properties.txt\".\r\n * Since it runs in a separate process, this script will have no access to the Javascript\r\n * context of the exiting backend. No default.\r\n */\r\n dumpProcessorScriptFileName?: string;\r\n /** Upload crash dump and node-reports to Bentley's crash-reporting service? Defaults to false */\r\n uploadToBentley?: boolean;\r\n}\r\n\r\n/** Configuration of core-backend.\r\n * @public\r\n */\r\nexport class IModelHostConfiguration {\r\n\r\n /**\r\n * Root of the directory holding all the files that iTwin.js caches\r\n * - If not specified at startup a platform specific default is used -\r\n * - Windows: $(HOMEDIR)/AppData/Local/iModelJs/\r\n * - Mac/iOS: $(HOMEDIR)/Library/Caches/iModelJs/\r\n * - Linux: $(HOMEDIR)/.cache/iModelJs/\r\n * where $(HOMEDIR) is documented [here](https://nodejs.org/api/os.html#os_os_homedir)\r\n * - if specified, ensure it is set to a folder with read/write access.\r\n * - Sub-folders within this folder organize various caches -\r\n * - bc/ -> Briefcases\r\n * - appSettings/ -> Offline application settings (only relevant in native applications)\r\n * - etc.\r\n * @see [[IModelHost.cacheDir]] for the value it's set to after startup\r\n */\r\n public cacheDir?: LocalDirName;\r\n\r\n /** Options for creating the [[Workspace]]\r\n * @beta\r\n */\r\n public workspace?: WorkspaceOpts;\r\n\r\n /** The directory where the app's assets are found. */\r\n public appAssetsDir?: LocalDirName;\r\n\r\n /** The kind of iModel hub server to use.\r\n * @beta\r\n */\r\n public hubAccess?: BackendHubAccess;\r\n\r\n /** The Azure blob storage credentials to use for the tile cache service. If omitted and no external service implementation is provided, a local cache will be used.\r\n * @beta\r\n */\r\n public tileCacheAzureCredentials?: AzureBlobStorageCredentials;\r\n\r\n /**\r\n * @beta\r\n * @note A reference implementation is set for [[AzureBlobStorage]] if [[tileCacheAzureCredentials]] property is set. To supply a different implementation for any service provider (such as AWS),\r\n * set this property with a custom [[CloudStorageService]].\r\n */\r\n public tileCacheService?: CloudStorageService;\r\n\r\n /** Whether to restrict tile cache URLs by client IP address (if available).\r\n * @beta\r\n */\r\n public restrictTileUrlsByClientIp?: boolean;\r\n\r\n /** Whether to compress cached tiles.\r\n * Defaults to `true`.\r\n */\r\n public compressCachedTiles?: boolean;\r\n\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** The default time, in milliseconds, used for [[tileTreeRequestTimeout]] and [[tileContentRequestTimeout]]. To change this, override one or both of those properties.\r\n * @internal\r\n */\r\n public static defaultTileRequestTimeout = 20 * 1000;\r\n\r\n /** The default time, in seconds, used for [[logTileLoadTimeThreshold]]. To change this, override that property.\r\n * @internal\r\n */\r\n public static defaultLogTileLoadTimeThreshold = 40;\r\n /** The backend will log when a tile took longer to load than this threshold in seconds.\r\n * @internal\r\n */\r\n public logTileLoadTimeThreshold: number = IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\r\n\r\n /** The default size, in bytes, used for [[logTileSizeThreshold]]. To change this, override that property.\r\n * @internal\r\n */\r\n public static defaultLogTileSizeThreshold = 20 * 1000000;\r\n /** The backend will log when a tile is loaded with a size in bytes above this threshold.\r\n * @internal\r\n */\r\n public logTileSizeThreshold: number = IModelHostConfiguration.defaultLogTileSizeThreshold;\r\n\r\n /** Crash-reporting configuration\r\n * @alpha\r\n */\r\n public crashReportingConfig?: CrashReportingConfig;\r\n\r\n /** The AuthorizationClient used to get accessTokens\r\n * @beta\r\n */\r\n public authorizationClient?: AuthorizationClient;\r\n}\r\n\r\n/**\r\n * Settings for the application workspace.\r\n * @note this includes the default dictionary from the SettingsSpecRegistry\r\n */\r\nclass ApplicationSettings extends BaseSettings {\r\n private _remove?: VoidFunction;\r\n protected override verifyPriority(priority: SettingsPriority) {\r\n if (priority >= SettingsPriority.iModel) // iModel settings may not appear in ApplicationSettings\r\n throw new Error(\"Use IModelSettings\");\r\n }\r\n private updateDefaults() {\r\n const defaults: SettingDictionary = {};\r\n for (const [specName, val] of SettingsSpecRegistry.allSpecs) {\r\n if (val.default)\r\n defaults[specName] = val.default;\r\n }\r\n this.addDictionary(\"_default_\", 0, defaults);\r\n }\r\n\r\n public constructor() {\r\n super();\r\n this._remove = SettingsSpecRegistry.onSpecsChanged.addListener(() => this.updateDefaults());\r\n this.updateDefaults();\r\n }\r\n public override close() {\r\n if (this._remove) {\r\n this._remove();\r\n this._remove = undefined;\r\n }\r\n }\r\n}\r\n\r\n/** IModelHost initializes ($backend) and captures its configuration. A backend must call [[IModelHost.startup]] before using any backend classes.\r\n * See [the learning article]($docs/learning/backend/IModelHost.md)\r\n * @public\r\n */\r\nexport class IModelHost {\r\n private constructor() { }\r\n public static authorizationClient?: AuthorizationClient;\r\n\r\n /** @alpha */\r\n public static readonly telemetry = new TelemetryManager();\r\n\r\n public static backendVersion = \"\";\r\n private static _cacheDir = \"\";\r\n private static _appWorkspace?: Workspace;\r\n\r\n private static _platform?: typeof IModelJsNative;\r\n /** @internal */\r\n public static get platform(): typeof IModelJsNative {\r\n if (this._platform === undefined)\r\n throw new Error(\"IModelHost.startup must be called first\");\r\n return this._platform;\r\n }\r\n\r\n public static configuration?: IModelHostConfiguration;\r\n /** Event raised just after the backend IModelHost was started */\r\n public static readonly onAfterStartup = new BeEvent<() => void>();\r\n\r\n /** Event raised just before the backend IModelHost is to be shut down */\r\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\r\n\r\n /** @internal */\r\n public static readonly session: Mutable<SessionProps> = { applicationId: \"2686\", applicationVersion: \"1.0.0\", sessionId: \"\" };\r\n\r\n /** A uniqueId for this session */\r\n public static get sessionId() { return this.session.sessionId; }\r\n public static set sessionId(id: GuidString) { this.session.sessionId = id; }\r\n\r\n /** The Id of this application - needs to be set only if it is an agent application. The applicationId will otherwise originate at the frontend. */\r\n public static get applicationId() { return this.session.applicationId; }\r\n public static set applicationId(id: string) { this.session.applicationId = id; }\r\n\r\n /** The version of this application - needs to be set if is an agent application. The applicationVersion will otherwise originate at the frontend. */\r\n public static get applicationVersion() { return this.session.applicationVersion; }\r\n public static set applicationVersion(version: string) { this.session.applicationVersion = version; }\r\n\r\n /** Root directory holding files that iTwin.js caches */\r\n public static get cacheDir(): LocalDirName { return this._cacheDir; }\r\n\r\n /** The application [[Workspace]] for this `IModelHost`\r\n * @note this `Workspace` only holds [[WorkspaceContainer]]s and [[Settings]] scoped to the currently loaded application(s).\r\n * All organization, iTwin, and iModel based containers or settings must be accessed through [[IModelDb.workspace]] and\r\n * attempting to add them to this Workspace will fail.\r\n * @beta\r\n */\r\n public static get appWorkspace(): Workspace { return this._appWorkspace!; } // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n\r\n /** The optional [[FileNameResolver]] that resolves keys and partial file names for snapshot iModels. */\r\n public static snapshotFileNameResolver?: FileNameResolver;\r\n\r\n /** Get the current access token for this IModelHost, or a blank string if none is available.\r\n * @note for web backends, this will *always* return a blank string because the backend itself has no token (but never needs one either.)\r\n * For all IpcHosts, where this backend is servicing a single frontend, this will be the user's token. For ElectronHost, the backend\r\n * obtains the token and forwards it to the frontend.\r\n * @note accessTokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\r\n * returned by this method may change over time throughout the course of a session.\r\n */\r\n public static async getAccessToken(): Promise<AccessToken> {\r\n try {\r\n return (await this.authorizationClient?.getAccessToken()) ?? \"\";\r\n } catch (e) {\r\n return \"\";\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static flushLog() {\r\n return this.platform.DgnDb.flushLog();\r\n }\r\n /** @internal */\r\n public static loadNative(): void {\r\n const platform = Platform.load();\r\n this.registerPlatform(platform);\r\n }\r\n\r\n private static registerPlatform(platform: typeof IModelJsNative): void {\r\n this._platform = platform;\r\n if (undefined === platform)\r\n return;\r\n\r\n if (!ProcessDetector.isMobileAppBackend)\r\n this.validateNativePlatformVersion();\r\n\r\n platform.logger = Logger;\r\n }\r\n\r\n private static validateNativePlatformVersion(): void {\r\n const requiredVersion = require(\"../../package.json\").dependencies[\"@bentley/imodeljs-native\"]; // eslint-disable-line @typescript-eslint/no-var-requires\r\n const thisVersion = this.platform.version;\r\n if (semver.satisfies(thisVersion, requiredVersion))\r\n return;\r\n if (IModelJsFs.existsSync(path.join(__dirname, \"DevBuild.txt\"))) {\r\n console.log(\"Bypassing version checks for development build\"); // eslint-disable-line no-console\r\n return;\r\n }\r\n this._platform = undefined;\r\n throw new IModelError(IModelStatus.BadRequest, `imodeljs-native version is (${thisVersion}). core-backend requires version (${requiredVersion})`);\r\n }\r\n\r\n /**\r\n * @internal\r\n * @note Use [[IModelHostConfiguration.tileCacheService]] to set the service provider.\r\n */\r\n public static tileCacheService?: CloudStorageService;\r\n\r\n /** @internal */\r\n public static tileUploader?: CloudStorageTileUploader;\r\n\r\n private static _hubAccess: BackendHubAccess;\r\n /** @internal */\r\n public static setHubAccess(hubAccess: BackendHubAccess) { this._hubAccess = hubAccess; }\r\n\r\n /** Provides access to the IModelHub for this IModelHost\r\n * @beta\r\n * @note If [[IModelHostConfiguration.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.\r\n */\r\n public static get hubAccess(): BackendHubAccess {\r\n // Strictly speaking, _hubAccess should be marked as possibly undefined since it's not needed for Snapshot iModels.\r\n // However, a decision was made to not provide that type annotation so callers aren't forced to constantly check for\r\n // something that's required in all other workflows.\r\n // This check is here to provide a better error message when hubAccess is inadvertently undefined.\r\n if (this._hubAccess === undefined)\r\n throw new IModelError(IModelStatus.BadRequest, \"IModelHost.hubAccess is undefined. Specify an implementation in your IModelHostConfiguration\");\r\n return this._hubAccess;\r\n }\r\n\r\n private static _isValid = false;\r\n /** Returns true if IModelHost is started. */\r\n public static get isValid() { return this._isValid; }\r\n /** This method must be called before any iTwin.js services are used.\r\n * @param configuration Host configuration data.\r\n * Raises [[onAfterStartup]].\r\n * @see [[shutdown]].\r\n */\r\n public static async startup(configuration: IModelHostConfiguration = new IModelHostConfiguration()): Promise<void> {\r\n if (this._isValid)\r\n return; // we're already initialized\r\n this._isValid = true;\r\n\r\n if (IModelHost.sessionId === \"\")\r\n IModelHost.sessionId = Guid.createValue();\r\n\r\n this.authorizationClient = configuration.authorizationClient;\r\n\r\n this.logStartup();\r\n\r\n this.backendVersion = require(\"../../package.json\").version; // eslint-disable-line @typescript-eslint/no-var-requires\r\n initializeRpcBackend();\r\n\r\n if (this._platform === undefined) {\r\n try {\r\n this.loadNative();\r\n } catch (error) {\r\n Logger.logError(loggerCategory, \"Error registering/loading the native platform API\", () => (configuration));\r\n throw error;\r\n }\r\n }\r\n\r\n if (configuration.crashReportingConfig && configuration.crashReportingConfig.crashDir && !ProcessDetector.isElectronAppBackend && !ProcessDetector.isMobileAppBackend) {\r\n this.platform.setCrashReporting(configuration.crashReportingConfig);\r\n\r\n Logger.logTrace(loggerCategory, \"Configured crash reporting\", () => ({\r\n enableCrashDumps: configuration.crashReportingConfig?.enableCrashDumps,\r\n wantFullMemoryDumps: configuration.crashReportingConfig?.wantFullMemoryDumps,\r\n enableNodeReport: configuration.crashReportingConfig?.enableNodeReport,\r\n uploadToBentley: configuration.crashReportingConfig?.uploadToBentley,\r\n }));\r\n\r\n if (configuration.crashReportingConfig.enableNodeReport) {\r\n try {\r\n // node-report reports on V8 fatal errors and unhandled exceptions/Promise rejections.\r\n const nodereport = require(\"node-report/api\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n nodereport.setEvents(\"exception+fatalerror+apicall\");\r\n nodereport.setDirectory(configuration.crashReportingConfig.crashDir);\r\n nodereport.setVerbose(\"yes\");\r\n Logger.logTrace(loggerCategory, \"Configured native crash reporting (node-report)\");\r\n } catch (err) {\r\n Logger.logWarning(loggerCategory, \"node-report is not installed.\");\r\n }\r\n }\r\n }\r\n\r\n this.setupHostDirs(configuration);\r\n this._appWorkspace = new ITwinWorkspace(new ApplicationSettings(), configuration.workspace);\r\n\r\n BriefcaseManager.initialize(this._briefcaseCacheDir);\r\n\r\n [\r\n IModelReadRpcImpl,\r\n IModelTileRpcImpl,\r\n SnapshotIModelRpcImpl,\r\n WipRpcImpl,\r\n DevToolsRpcImpl,\r\n ].forEach((rpc) => rpc.register()); // register all of the RPC implementations\r\n\r\n [\r\n BisCoreSchema,\r\n GenericSchema,\r\n FunctionalSchema,\r\n ].forEach((schema) => schema.registerSchema()); // register all of the schemas\r\n\r\n if (undefined !== configuration.hubAccess)\r\n IModelHost._hubAccess = configuration.hubAccess;\r\n IModelHost.configuration = configuration;\r\n IModelHost.setupTileCache();\r\n\r\n this.platform.setUseTileCache(IModelHost.tileCacheService ? false : true);\r\n\r\n process.once(\"beforeExit\", IModelHost.shutdown);\r\n IModelHost.onAfterStartup.raiseEvent();\r\n }\r\n\r\n private static _briefcaseCacheDir: LocalDirName;\r\n\r\n private static logStartup() {\r\n if (!Logger.isEnabled(loggerCategory, LogLevel.Trace))\r\n return;\r\n\r\n // Extract the iModel details from environment - note this is very specific to Bentley hosted backends, but is quite useful for tracing\r\n let startupInfo: any = {};\r\n const serviceName = process.env.FABRIC_SERVICE_NAME;\r\n if (serviceName) {\r\n // e.g., fabric:/iModelWebViewer3.0/iModelJSGuest/1/08daaeb3-b56f-480b-9051-7efc834d18ae/512d971d-b641-4735-bb1c-c07ab3e44ce7/c1315fcce125ca40b2d405bb7809214daf8b4c85\r\n const serviceNameComponents = serviceName.split(\"/\");\r\n if (serviceNameComponents.length === 7) {\r\n startupInfo = {\r\n ...startupInfo,\r\n iTwinId: serviceNameComponents[4],\r\n iModelId: serviceNameComponents[5],\r\n changesetId: serviceNameComponents[6],\r\n };\r\n }\r\n }\r\n\r\n Logger.logTrace(loggerCategory, \"IModelHost.startup\", () => startupInfo);\r\n }\r\n\r\n private static setupHostDirs(configuration: IModelHostConfiguration) {\r\n const setupDir = (dir: LocalDirName) => {\r\n dir = path.normalize(dir);\r\n IModelJsFs.recursiveMkDirSync(dir);\r\n return dir;\r\n };\r\n this._cacheDir = setupDir(configuration.cacheDir ?? NativeLibrary.defaultCacheDir);\r\n this._briefcaseCacheDir = path.join(this._cacheDir, \"imodels\");\r\n }\r\n\r\n /** This method must be called when an iTwin.js host is shut down. Raises [[onBeforeShutdown]] */\r\n public static async shutdown(): Promise<void> {\r\n // NB: This method is set as a node listener where `this` is unbound\r\n if (!IModelHost._isValid)\r\n return;\r\n\r\n IModelHost._isValid = false;\r\n IModelHost.onBeforeShutdown.raiseEvent();\r\n IModelHost.configuration = undefined;\r\n IModelHost.tileCacheService = undefined;\r\n IModelHost.tileUploader = undefined;\r\n IModelHost.appWorkspace.close();\r\n IModelHost._appWorkspace = undefined;\r\n process.removeListener(\"beforeExit\", IModelHost.shutdown);\r\n }\r\n\r\n /**\r\n * Add or update a property that should be included in a crash report.\r\n * @param name The name of the property\r\n * @param value The value of the property\r\n * @alpha\r\n */\r\n public static setCrashReportProperty(name: string, value: string): void {\r\n assert(undefined !== this._platform);\r\n this._platform.setCrashReportProperty(name, value);\r\n }\r\n\r\n /**\r\n * Remove a previously defined property so that will not be included in a crash report.\r\n * @param name The name of the property\r\n * @alpha\r\n */\r\n public static removeCrashReportProperty(name: string): void {\r\n assert(undefined !== this._platform);\r\n this._platform.setCrashReportProperty(name, undefined);\r\n }\r\n\r\n /**\r\n * Get all properties that will be included in a crash report.\r\n * @alpha\r\n */\r\n public static getCrashReportProperties(): CrashReportingConfigNameValuePair[] {\r\n assert(undefined !== this._platform);\r\n return this._platform.getCrashReportProperties();\r\n }\r\n\r\n /** The directory where application assets may be found */\r\n public static get appAssetsDir(): string | undefined { return undefined !== IModelHost.configuration ? IModelHost.configuration.appAssetsDir : undefined; }\r\n\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileTreeRequestTimeout(): number {\r\n return undefined !== IModelHost.configuration ? IModelHost.configuration.tileTreeRequestTimeout : IModelHostConfiguration.defaultTileRequestTimeout;\r\n }\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileContentRequestTimeout(): number {\r\n return undefined !== IModelHost.configuration ? IModelHost.configuration.tileContentRequestTimeout : IModelHostConfiguration.defaultTileRequestTimeout;\r\n }\r\n\r\n /** The backend will log when a tile took longer to load than this threshold in seconds. */\r\n public static get logTileLoadTimeThreshold(): number { return undefined !== IModelHost.configuration ? IModelHost.configuration.logTileLoadTimeThreshold : IModelHostConfiguration.defaultLogTileLoadTimeThreshold; }\r\n /** The backend will log when a tile is loaded with a size in bytes above this threshold. */\r\n public static get logTileSizeThreshold(): number { return undefined !== IModelHost.configuration ? IModelHost.configuration.logTileSizeThreshold : IModelHostConfiguration.defaultLogTileSizeThreshold; }\r\n\r\n /** Whether external tile caching is active.\r\n * @internal\r\n */\r\n public static get usingExternalTileCache(): boolean {\r\n return undefined !== IModelHost.tileCacheService;\r\n }\r\n\r\n /** Whether to restrict tile cache URLs by client IP address.\r\n * @internal\r\n */\r\n public static get restrictTileUrlsByClientIp(): boolean { return undefined !== IModelHost.configuration && (IModelHost.configuration.restrictTileUrlsByClientIp ? true : false); }\r\n\r\n /** Whether to compress cached tiles.\r\n * @internal\r\n */\r\n public static get compressCachedTiles(): boolean { return false !== IModelHost.configuration?.compressCachedTiles; }\r\n\r\n private static setupTileCache() {\r\n assert(undefined !== IModelHost.configuration);\r\n const config = IModelHost.configuration;\r\n const service = config.tileCacheService;\r\n const credentials = config.tileCacheAzureCredentials;\r\n\r\n if (!service && !credentials)\r\n return;\r\n\r\n IModelHost.tileUploader = new CloudStorageTileUploader();\r\n\r\n if (credentials && !service) {\r\n IModelHost.tileCacheService = new AzureBlobStorage(credentials);\r\n } else if (!credentials && service) {\r\n IModelHost.tileCacheService = service;\r\n } else {\r\n throw new IModelError(BentleyStatus.ERROR, \"Cannot use both Azure and custom cloud storage providers for tile cache.\");\r\n }\r\n }\r\n}\r\n\r\n/** Information about the platform on which the app is running. Also see [[KnownLocations]] and [[IModelJsFs]].\r\n * @public\r\n */\r\nexport class Platform {\r\n /** Get the name of the platform. */\r\n public static get platformName(): \"win32\" | \"linux\" | \"darwin\" | \"ios\" | \"android\" | \"uwp\" {\r\n return process.platform as any;\r\n }\r\n\r\n /** @internal */\r\n public static load(): typeof IModelJsNative {\r\n return ProcessDetector.isMobileAppBackend ? (process as any)._linkedBinding(\"iModelJsNative\") : NativeLibrary.load();\r\n }\r\n}\r\n\r\n/** Well known directories that may be used by the application. Also see [[Platform]]\r\n * @public\r\n */\r\nexport class KnownLocations {\r\n\r\n /** The directory where the imodeljs-native assets are stored. */\r\n public static get nativeAssetsDir(): string { return IModelHost.platform.DgnDb.getAssetsDir(); }\r\n\r\n /** The directory where the core-backend assets are stored. */\r\n public static get packageAssetsDir(): string {\r\n return path.join(__dirname, \"assets\");\r\n }\r\n\r\n /** The temporary directory. */\r\n public static get tmpdir(): string {\r\n return os.tmpdir();\r\n }\r\n}\r\n\r\n/** Extend this class to provide custom file name resolution behavior.\r\n * @note Only `tryResolveKey` and/or `tryResolveFileName` need to be overridden as the implementations of `resolveKey` and `resolveFileName` work for most purposes.\r\n * @see [[IModelHost.snapshotFileNameResolver]]\r\n * @public\r\n */\r\nexport abstract class FileNameResolver {\r\n /** Resolve a file name from the specified key.\r\n * @param _fileKey The key that identifies the file name in a `Map` or other similar data structure.\r\n * @returns The resolved file name or `undefined` if not found.\r\n */\r\n public tryResolveKey(_fileKey: string): string | undefined { return undefined; }\r\n /** Resolve a file name from the specified key.\r\n * @param fileKey The key that identifies the file name in a `Map` or other similar data structure.\r\n * @returns The resolved file name.\r\n * @throws [[IModelError]] if not found.\r\n */\r\n public resolveKey(fileKey: string): string {\r\n const resolvedFileName: string | undefined = this.tryResolveKey(fileKey);\r\n if (undefined === resolvedFileName) {\r\n throw new IModelError(IModelStatus.NotFound, `${fileKey} not resolved`);\r\n }\r\n return resolvedFileName;\r\n }\r\n /** Resolve the input file name, which may be a partial name, into a full path file name.\r\n * @param inFileName The partial file name.\r\n * @returns The resolved full path file name or `undefined` if not found.\r\n */\r\n public tryResolveFileName(inFileName: string): string | undefined { return inFileName; }\r\n /** Resolve the input file name, which may be a partial name, into a full path file name.\r\n * @param inFileName The partial file name.\r\n * @returns The resolved full path file name.\r\n * @throws [[IModelError]] if not found.\r\n */\r\n public resolveFileName(inFileName: string): string {\r\n const resolvedFileName: string | undefined = this.tryResolveFileName(inFileName);\r\n if (undefined === resolvedFileName) {\r\n throw new IModelError(IModelStatus.NotFound, `${inFileName} not resolved`);\r\n }\r\n return resolvedFileName;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"IModelHost.js","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yBAAyB;AACzB,6BAA6B;AAC7B,iCAAiC;AACjC,8DAAyE;AACzE,sDAA+I;AAC/I,oDAAiH;AACjH,0DAAyD;AAEzD,mEAAgE;AAChE,mDAAgD;AAChD,yDAAsD;AACtD,+DAAqI;AACrI,iEAA8D;AAC9D,2DAAwD;AACxD,qDAAkD;AAClD,6CAA0C;AAC1C,gEAA6D;AAC7D,oEAAiE;AACjE,oEAAiE;AACjE,4EAAyE;AACzE,sDAAmD;AACnD,6CAAoD;AACpD,mDAAyF;AACzF,iEAA8D;AAC9D,qDAAiF;AAEjF,MAAM,cAAc,GAAG,6CAAqB,CAAC,UAAU,CAAC;AAqCxD;;GAEG;AACH,MAAa,uBAAuB;IAApC;QAqDE;;WAEG;QACI,2BAAsB,GAAG,uBAAuB,CAAC,yBAAyB,CAAC;QAClF;;WAEG;QACI,8BAAyB,GAAG,uBAAuB,CAAC,yBAAyB,CAAC;QAUrF;;WAEG;QACI,6BAAwB,GAAW,uBAAuB,CAAC,+BAA+B,CAAC;QAMlG;;WAEG;QACI,yBAAoB,GAAW,uBAAuB,CAAC,2BAA2B,CAAC;IAW5F,CAAC;;AA7FD,0DA6FC;AAhCC;;GAEG;AACW,iDAAyB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEpD;;GAEG;AACW,uDAA+B,GAAG,EAAE,CAAC;AAMnD;;GAEG;AACW,mDAA2B,GAAG,EAAE,GAAG,OAAO,CAAC;AAiB3D;;;GAGG;AACH,MAAM,mBAAoB,SAAQ,uBAAY;IAe5C;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC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H,MAAa,cAAc;IAEzB,iEAAiE;IAC1D,MAAM,KAAK,eAAe,KAAa,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IAEhG,8DAA8D;IACvD,MAAM,KAAK,gBAAgB;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED,+BAA+B;IACxB,MAAM,KAAK,MAAM;QACtB,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC;CACF;AAdD,wCAcC;AAED;;;;GAIG;AACH,MAAsB,gBAAgB;IACpC;;;OAGG;IACI,aAAa,CAAC,QAAgB,IAAwB,OAAO,SAAS,CAAC,CAAC,CAAC;IAChF;;;;OAIG;IACI,UAAU,CAAC,OAAe;QAC/B,MAAM,gBAAgB,GAAuB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACzE,IAAI,SAAS,KAAK,gBAAgB,EAAE;YAClC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,QAAQ,EAAE,GAAG,OAAO,eAAe,CAAC,CAAC;SACzE;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD;;;OAGG;IACI,kBAAkB,CAAC,UAAkB,IAAwB,OAAO,UAAU,CAAC,CAAC,CAAC;IACxF;;;;OAIG;IACI,eAAe,CAAC,UAAkB;QACvC,MAAM,gBAAgB,GAAuB,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACjF,IAAI,SAAS,KAAK,gBAAgB,EAAE;YAClC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,QAAQ,EAAE,GAAG,UAAU,eAAe,CAAC,CAAC;SAC5E;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAnCD,4CAmCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module IModelHost\r\n */\r\n\r\nimport * as os from \"os\";\r\nimport * as path from \"path\";\r\nimport * as semver from \"semver\";\r\nimport { IModelJsNative, NativeLibrary } from \"@bentley/imodeljs-native\";\r\nimport { AccessToken, assert, BeEvent, Guid, GuidString, IModelStatus, Logger, LogLevel, Mutable, ProcessDetector } from \"@itwin/core-bentley\";\r\nimport { AuthorizationClient, BentleyStatus, IModelError, LocalDirName, SessionProps } from \"@itwin/core-common\";\r\nimport { TelemetryManager } from \"@itwin/core-telemetry\";\r\nimport { BackendHubAccess } from \"./BackendHubAccess\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { BisCoreSchema } from \"./BisCoreSchema\";\r\nimport { BriefcaseManager } from \"./BriefcaseManager\";\r\nimport { AzureBlobStorage, AzureBlobStorageCredentials, CloudStorageService, CloudStorageTileUploader } from \"./CloudStorageBackend\";\r\nimport { FunctionalSchema } from \"./domains/FunctionalSchema\";\r\nimport { GenericSchema } from \"./domains/GenericSchema\";\r\nimport { GeoCoordConfig } from \"./GeoCoordConfig\";\r\nimport { IModelJsFs } from \"./IModelJsFs\";\r\nimport { DevToolsRpcImpl } from \"./rpc-impl/DevToolsRpcImpl\";\r\nimport { IModelReadRpcImpl } from \"./rpc-impl/IModelReadRpcImpl\";\r\nimport { IModelTileRpcImpl } from \"./rpc-impl/IModelTileRpcImpl\";\r\nimport { SnapshotIModelRpcImpl } from \"./rpc-impl/SnapshotIModelRpcImpl\";\r\nimport { WipRpcImpl } from \"./rpc-impl/WipRpcImpl\";\r\nimport { initializeRpcBackend } from \"./RpcBackend\";\r\nimport { BaseSettings, SettingDictionary, SettingsPriority } from \"./workspace/Settings\";\r\nimport { SettingsSchemas } from \"./workspace/SettingsSchemas\";\r\nimport { ITwinWorkspace, Workspace, WorkspaceOpts } from \"./workspace/Workspace\";\r\n\r\nconst loggerCategory = BackendLoggerCategory.IModelHost;\r\n\r\n// cspell:ignore nodereport fatalerror apicall alicloud rpcs\r\n\r\n/** @alpha */\r\nexport interface CrashReportingConfigNameValuePair {\r\n name: string;\r\n value: string;\r\n}\r\n\r\n/** Configuration of the crash-reporting system.\r\n * @alpha\r\n */\r\nexport interface CrashReportingConfig {\r\n /** The directory to which *.dmp and/or iModelJsNativeCrash*.properties.txt files are written. This directory will be created if it does not already exist. */\r\n crashDir: string;\r\n /** max # .dmp files that may exist in crashDir. The default is 50. */\r\n maxDumpsInDir?: number;\r\n /** Enable crash-dumps? If so, .dmp and .properties.txt files will be generated and written to crashDir in the event of an unhandled native-code exception. If not, only .properties.txt files will be written. The default is false. */\r\n enableCrashDumps?: boolean;\r\n /** If enableCrashDumps is true, do you want a full-memory dump? Defaults to false. */\r\n wantFullMemoryDumps?: boolean;\r\n /** Enable node-report? If so, node-report files will be generated in the event of an unhandled exception or fatal error and written to crashDir. The default is false. */\r\n enableNodeReport?: boolean;\r\n /** Additional name, value pairs to write to iModelJsNativeCrash*.properties.txt file in the event of a crash. */\r\n params?: CrashReportingConfigNameValuePair[];\r\n /** Run this .js file to process .dmp and node-report files in the event of a crash.\r\n * This script will be executed with a single command-line parameter: the name of the dump or node-report file.\r\n * In the case of a dump file, there will be a second file with the same basename and the extension \".properties.txt\".\r\n * Since it runs in a separate process, this script will have no access to the Javascript\r\n * context of the exiting backend. No default.\r\n */\r\n dumpProcessorScriptFileName?: string;\r\n /** Upload crash dump and node-reports to Bentley's crash-reporting service? Defaults to false */\r\n uploadToBentley?: boolean;\r\n}\r\n\r\n/** Configuration of core-backend.\r\n * @public\r\n */\r\nexport class IModelHostConfiguration {\r\n\r\n /**\r\n * Root of the directory holding all the files that iTwin.js caches\r\n * - If not specified at startup a platform specific default is used -\r\n * - Windows: $(HOMEDIR)/AppData/Local/iModelJs/\r\n * - Mac/iOS: $(HOMEDIR)/Library/Caches/iModelJs/\r\n * - Linux: $(HOMEDIR)/.cache/iModelJs/\r\n * where $(HOMEDIR) is documented [here](https://nodejs.org/api/os.html#os_os_homedir)\r\n * - if specified, ensure it is set to a folder with read/write access.\r\n * - Sub-folders within this folder organize various caches -\r\n * - bc/ -> Briefcases\r\n * - appSettings/ -> Offline application settings (only relevant in native applications)\r\n * - etc.\r\n * @see [[IModelHost.cacheDir]] for the value it's set to after startup\r\n */\r\n public cacheDir?: LocalDirName;\r\n\r\n /** Options for creating the [[Workspace]]\r\n * @beta\r\n */\r\n public workspace?: WorkspaceOpts;\r\n\r\n /** The directory where the app's assets are found. */\r\n public appAssetsDir?: LocalDirName;\r\n\r\n /** The kind of iModel hub server to use.\r\n * @beta\r\n */\r\n public hubAccess?: BackendHubAccess;\r\n\r\n /** The Azure blob storage credentials to use for the tile cache service. If omitted and no external service implementation is provided, a local cache will be used.\r\n * @beta\r\n */\r\n public tileCacheAzureCredentials?: AzureBlobStorageCredentials;\r\n\r\n /**\r\n * @beta\r\n * @note A reference implementation is set for [[AzureBlobStorage]] if [[tileCacheAzureCredentials]] property is set. To supply a different implementation for any service provider (such as AWS),\r\n * set this property with a custom [[CloudStorageService]].\r\n */\r\n public tileCacheService?: CloudStorageService;\r\n\r\n /** Whether to restrict tile cache URLs by client IP address (if available).\r\n * @beta\r\n */\r\n public restrictTileUrlsByClientIp?: boolean;\r\n\r\n /** Whether to compress cached tiles.\r\n * Defaults to `true`.\r\n */\r\n public compressCachedTiles?: boolean;\r\n\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** The default time, in milliseconds, used for [[tileTreeRequestTimeout]] and [[tileContentRequestTimeout]]. To change this, override one or both of those properties.\r\n * @internal\r\n */\r\n public static defaultTileRequestTimeout = 20 * 1000;\r\n\r\n /** The default time, in seconds, used for [[logTileLoadTimeThreshold]]. To change this, override that property.\r\n * @internal\r\n */\r\n public static defaultLogTileLoadTimeThreshold = 40;\r\n /** The backend will log when a tile took longer to load than this threshold in seconds.\r\n * @internal\r\n */\r\n public logTileLoadTimeThreshold: number = IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\r\n\r\n /** The default size, in bytes, used for [[logTileSizeThreshold]]. To change this, override that property.\r\n * @internal\r\n */\r\n public static defaultLogTileSizeThreshold = 20 * 1000000;\r\n /** The backend will log when a tile is loaded with a size in bytes above this threshold.\r\n * @internal\r\n */\r\n public logTileSizeThreshold: number = IModelHostConfiguration.defaultLogTileSizeThreshold;\r\n\r\n /** Crash-reporting configuration\r\n * @alpha\r\n */\r\n public crashReportingConfig?: CrashReportingConfig;\r\n\r\n /** The AuthorizationClient used to get accessTokens\r\n * @beta\r\n */\r\n public authorizationClient?: AuthorizationClient;\r\n}\r\n\r\n/**\r\n * Settings for `IModelHost.appWorkspace`.\r\n * @note this includes the default dictionary from the SettingsSpecRegistry\r\n */\r\nclass ApplicationSettings extends BaseSettings {\r\n private _remove?: VoidFunction;\r\n protected override verifyPriority(priority: SettingsPriority) {\r\n if (priority >= SettingsPriority.iModel) // iModel settings may not appear in ApplicationSettings\r\n throw new Error(\"Use IModelSettings\");\r\n }\r\n private updateDefaults() {\r\n const defaults: SettingDictionary = {};\r\n for (const [schemaName, val] of SettingsSchemas.allSchemas) {\r\n if (val.default)\r\n defaults[schemaName] = val.default;\r\n }\r\n this.addDictionary(\"_default_\", 0, defaults);\r\n }\r\n\r\n public constructor() {\r\n super();\r\n this._remove = SettingsSchemas.onSchemaChanged.addListener(() => this.updateDefaults());\r\n this.updateDefaults();\r\n }\r\n\r\n public override close() {\r\n if (this._remove) {\r\n this._remove();\r\n this._remove = undefined;\r\n }\r\n }\r\n}\r\n\r\n/** IModelHost initializes ($backend) and captures its configuration. A backend must call [[IModelHost.startup]] before using any backend classes.\r\n * See [the learning article]($docs/learning/backend/IModelHost.md)\r\n * @public\r\n */\r\nexport class IModelHost {\r\n private constructor() { }\r\n public static authorizationClient?: AuthorizationClient;\r\n\r\n /** @alpha */\r\n public static readonly telemetry = new TelemetryManager();\r\n\r\n public static backendVersion = \"\";\r\n private static _cacheDir = \"\";\r\n private static _appWorkspace?: Workspace;\r\n\r\n private static _platform?: typeof IModelJsNative;\r\n /** @internal */\r\n public static get platform(): typeof IModelJsNative {\r\n if (this._platform === undefined)\r\n throw new Error(\"IModelHost.startup must be called first\");\r\n return this._platform;\r\n }\r\n\r\n public static configuration?: IModelHostConfiguration;\r\n\r\n /** Event raised during startup to allow loading settings data */\r\n public static readonly onWorkspaceStartup = new BeEvent<() => void>();\r\n\r\n /** Event raised just after the backend IModelHost was started */\r\n public static readonly onAfterStartup = new BeEvent<() => void>();\r\n\r\n /** Event raised just before the backend IModelHost is to be shut down */\r\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\r\n\r\n /** @internal */\r\n public static readonly session: Mutable<SessionProps> = { applicationId: \"2686\", applicationVersion: \"1.0.0\", sessionId: \"\" };\r\n\r\n /** A uniqueId for this session */\r\n public static get sessionId() { return this.session.sessionId; }\r\n public static set sessionId(id: GuidString) { this.session.sessionId = id; }\r\n\r\n /** The Id of this application - needs to be set only if it is an agent application. The applicationId will otherwise originate at the frontend. */\r\n public static get applicationId() { return this.session.applicationId; }\r\n public static set applicationId(id: string) { this.session.applicationId = id; }\r\n\r\n /** The version of this application - needs to be set if is an agent application. The applicationVersion will otherwise originate at the frontend. */\r\n public static get applicationVersion() { return this.session.applicationVersion; }\r\n public static set applicationVersion(version: string) { this.session.applicationVersion = version; }\r\n\r\n /** Root directory holding files that iTwin.js caches */\r\n public static get cacheDir(): LocalDirName { return this._cacheDir; }\r\n\r\n /** The application [[Workspace]] for this `IModelHost`\r\n * @note this `Workspace` only holds [[WorkspaceContainer]]s and [[Settings]] scoped to the currently loaded application(s).\r\n * All organization, iTwin, and iModel based containers or settings must be accessed through [[IModelDb.workspace]] and\r\n * attempting to add them to this Workspace will fail.\r\n * @beta\r\n */\r\n public static get appWorkspace(): Workspace { return this._appWorkspace!; } // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n\r\n /** The optional [[FileNameResolver]] that resolves keys and partial file names for snapshot iModels. */\r\n public static snapshotFileNameResolver?: FileNameResolver;\r\n\r\n /** Get the current access token for this IModelHost, or a blank string if none is available.\r\n * @note for web backends, this will *always* return a blank string because the backend itself has no token (but never needs one either.)\r\n * For all IpcHosts, where this backend is servicing a single frontend, this will be the user's token. For ElectronHost, the backend\r\n * obtains the token and forwards it to the frontend.\r\n * @note accessTokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\r\n * returned by this method may change over time throughout the course of a session.\r\n */\r\n public static async getAccessToken(): Promise<AccessToken> {\r\n try {\r\n return (await this.authorizationClient?.getAccessToken()) ?? \"\";\r\n } catch (e) {\r\n return \"\";\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static flushLog() {\r\n return this.platform.flushLog();\r\n }\r\n /** @internal */\r\n public static loadNative(): void {\r\n const platform = Platform.load();\r\n this.registerPlatform(platform);\r\n }\r\n\r\n private static registerPlatform(platform: typeof IModelJsNative): void {\r\n this._platform = platform;\r\n if (undefined === platform)\r\n return;\r\n\r\n if (!ProcessDetector.isMobileAppBackend)\r\n this.validateNativePlatformVersion();\r\n\r\n platform.logger = Logger;\r\n }\r\n\r\n private static validateNativePlatformVersion(): void {\r\n const requiredVersion = require(\"../../package.json\").dependencies[\"@bentley/imodeljs-native\"]; // eslint-disable-line @typescript-eslint/no-var-requires\r\n const thisVersion = this.platform.version;\r\n if (semver.satisfies(thisVersion, requiredVersion))\r\n return;\r\n if (IModelJsFs.existsSync(path.join(__dirname, \"DevBuild.txt\"))) {\r\n console.log(\"Bypassing version checks for development build\"); // eslint-disable-line no-console\r\n return;\r\n }\r\n this._platform = undefined;\r\n throw new IModelError(IModelStatus.BadRequest, `imodeljs-native version is (${thisVersion}). core-backend requires version (${requiredVersion})`);\r\n }\r\n\r\n /**\r\n * @internal\r\n * @note Use [[IModelHostConfiguration.tileCacheService]] to set the service provider.\r\n */\r\n public static tileCacheService?: CloudStorageService;\r\n\r\n /** @internal */\r\n public static tileUploader?: CloudStorageTileUploader;\r\n\r\n private static _hubAccess?: BackendHubAccess;\r\n /** @internal */\r\n public static setHubAccess(hubAccess: BackendHubAccess | undefined) { this._hubAccess = hubAccess; }\r\n\r\n /** get the current hubAccess, if present.\r\n * @beta\r\n */\r\n public static getHubAccess(): BackendHubAccess | undefined { return this._hubAccess; }\r\n\r\n /** Provides access to the IModelHub for this IModelHost\r\n * @beta\r\n * @note If [[IModelHostConfiguration.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.\r\n * To determine whether one is present, use [[getHubAccess]].\r\n */\r\n public static get hubAccess(): BackendHubAccess {\r\n if (this._hubAccess === undefined)\r\n throw new IModelError(IModelStatus.BadRequest, \"No BackendHubAccess supplied in IModelHostConfiguration\");\r\n return this._hubAccess;\r\n }\r\n\r\n private static initializeWorkspace(configuration: IModelHostConfiguration) {\r\n const settingAssets = path.join(KnownLocations.packageAssetsDir, \"Settings\");\r\n SettingsSchemas.addDirectory(path.join(settingAssets, \"Schemas\"));\r\n this._appWorkspace = new ITwinWorkspace(new ApplicationSettings(), configuration.workspace);\r\n this.appWorkspace.settings.addDirectory(settingAssets, SettingsPriority.defaults);\r\n\r\n GeoCoordConfig.onStartup();\r\n // allow applications to load their default settings\r\n this.onWorkspaceStartup.raiseEvent();\r\n }\r\n\r\n private static _isValid = false;\r\n /** Returns true if IModelHost is started. */\r\n public static get isValid() { return this._isValid; }\r\n /** This method must be called before any iTwin.js services are used.\r\n * @param configuration Host configuration data.\r\n * Raises [[onAfterStartup]].\r\n * @see [[shutdown]].\r\n */\r\n public static async startup(configuration: IModelHostConfiguration = new IModelHostConfiguration()): Promise<void> {\r\n if (this._isValid)\r\n return; // we're already initialized\r\n this._isValid = true;\r\n\r\n if (IModelHost.sessionId === \"\")\r\n IModelHost.sessionId = Guid.createValue();\r\n\r\n this.authorizationClient = configuration.authorizationClient;\r\n\r\n this.logStartup();\r\n\r\n this.backendVersion = require(\"../../package.json\").version; // eslint-disable-line @typescript-eslint/no-var-requires\r\n initializeRpcBackend();\r\n\r\n if (this._platform === undefined) {\r\n try {\r\n this.loadNative();\r\n } catch (error) {\r\n Logger.logError(loggerCategory, \"Error registering/loading the native platform API\", () => (configuration));\r\n throw error;\r\n }\r\n }\r\n\r\n if (configuration.crashReportingConfig && configuration.crashReportingConfig.crashDir && !ProcessDetector.isElectronAppBackend && !ProcessDetector.isMobileAppBackend) {\r\n this.platform.setCrashReporting(configuration.crashReportingConfig);\r\n\r\n Logger.logTrace(loggerCategory, \"Configured crash reporting\", () => ({\r\n enableCrashDumps: configuration.crashReportingConfig?.enableCrashDumps,\r\n wantFullMemoryDumps: configuration.crashReportingConfig?.wantFullMemoryDumps,\r\n enableNodeReport: configuration.crashReportingConfig?.enableNodeReport,\r\n uploadToBentley: configuration.crashReportingConfig?.uploadToBentley,\r\n }));\r\n\r\n if (configuration.crashReportingConfig.enableNodeReport) {\r\n try {\r\n // node-report reports on V8 fatal errors and unhandled exceptions/Promise rejections.\r\n const nodereport = require(\"node-report/api\"); // eslint-disable-line @typescript-eslint/no-var-requires\r\n nodereport.setEvents(\"exception+fatalerror+apicall\");\r\n nodereport.setDirectory(configuration.crashReportingConfig.crashDir);\r\n nodereport.setVerbose(\"yes\");\r\n Logger.logTrace(loggerCategory, \"Configured native crash reporting (node-report)\");\r\n } catch (err) {\r\n Logger.logWarning(loggerCategory, \"node-report is not installed.\");\r\n }\r\n }\r\n }\r\n\r\n this.setupHostDirs(configuration);\r\n this.initializeWorkspace(configuration);\r\n\r\n BriefcaseManager.initialize(this._briefcaseCacheDir);\r\n\r\n [\r\n IModelReadRpcImpl,\r\n IModelTileRpcImpl,\r\n SnapshotIModelRpcImpl,\r\n WipRpcImpl,\r\n DevToolsRpcImpl,\r\n ].forEach((rpc) => rpc.register()); // register all of the RPC implementations\r\n\r\n [\r\n BisCoreSchema,\r\n GenericSchema,\r\n FunctionalSchema,\r\n ].forEach((schema) => schema.registerSchema()); // register all of the schemas\r\n\r\n if (undefined !== configuration.hubAccess)\r\n this._hubAccess = configuration.hubAccess;\r\n this.configuration = configuration;\r\n this.setupTileCache();\r\n\r\n this.platform.setUseTileCache(IModelHost.tileCacheService ? false : true);\r\n process.once(\"beforeExit\", IModelHost.shutdown);\r\n this.onAfterStartup.raiseEvent();\r\n }\r\n\r\n private static _briefcaseCacheDir: LocalDirName;\r\n\r\n private static logStartup() {\r\n if (!Logger.isEnabled(loggerCategory, LogLevel.Trace))\r\n return;\r\n\r\n // Extract the iModel details from environment - note this is very specific to Bentley hosted backends, but is quite useful for tracing\r\n let startupInfo: any = {};\r\n const serviceName = process.env.FABRIC_SERVICE_NAME;\r\n if (serviceName) {\r\n // e.g., fabric:/iModelWebViewer3.0/iModelJSGuest/1/08daaeb3-b56f-480b-9051-7efc834d18ae/512d971d-b641-4735-bb1c-c07ab3e44ce7/c1315fcce125ca40b2d405bb7809214daf8b4c85\r\n const serviceNameComponents = serviceName.split(\"/\");\r\n if (serviceNameComponents.length === 7) {\r\n startupInfo = {\r\n ...startupInfo,\r\n iTwinId: serviceNameComponents[4],\r\n iModelId: serviceNameComponents[5],\r\n changesetId: serviceNameComponents[6],\r\n };\r\n }\r\n }\r\n\r\n Logger.logTrace(loggerCategory, \"IModelHost.startup\", () => startupInfo);\r\n }\r\n\r\n private static setupHostDirs(configuration: IModelHostConfiguration) {\r\n const setupDir = (dir: LocalDirName) => {\r\n dir = path.normalize(dir);\r\n IModelJsFs.recursiveMkDirSync(dir);\r\n return dir;\r\n };\r\n this._cacheDir = setupDir(configuration.cacheDir ?? NativeLibrary.defaultCacheDir);\r\n this._briefcaseCacheDir = path.join(this._cacheDir, \"imodels\");\r\n }\r\n\r\n /** This method must be called when an iTwin.js host is shut down. Raises [[onBeforeShutdown]] */\r\n public static async shutdown(): Promise<void> {\r\n // NB: This method is set as a node listener where `this` is unbound\r\n if (!IModelHost._isValid)\r\n return;\r\n\r\n IModelHost._isValid = false;\r\n IModelHost.onBeforeShutdown.raiseEvent();\r\n IModelHost.configuration = undefined;\r\n IModelHost.tileCacheService = undefined;\r\n IModelHost.tileUploader = undefined;\r\n await IModelHost.appWorkspace.close();\r\n IModelHost._appWorkspace = undefined;\r\n process.removeListener(\"beforeExit\", IModelHost.shutdown);\r\n }\r\n\r\n /**\r\n * Add or update a property that should be included in a crash report.\r\n * @param name The name of the property\r\n * @param value The value of the property\r\n * @alpha\r\n */\r\n public static setCrashReportProperty(name: string, value: string): void {\r\n assert(undefined !== this._platform);\r\n this._platform.setCrashReportProperty(name, value);\r\n }\r\n\r\n /**\r\n * Remove a previously defined property so that will not be included in a crash report.\r\n * @param name The name of the property\r\n * @alpha\r\n */\r\n public static removeCrashReportProperty(name: string): void {\r\n assert(undefined !== this._platform);\r\n this._platform.setCrashReportProperty(name, undefined);\r\n }\r\n\r\n /**\r\n * Get all properties that will be included in a crash report.\r\n * @alpha\r\n */\r\n public static getCrashReportProperties(): CrashReportingConfigNameValuePair[] {\r\n assert(undefined !== this._platform);\r\n return this._platform.getCrashReportProperties();\r\n }\r\n\r\n /** The directory where application assets may be found */\r\n public static get appAssetsDir(): string | undefined { return undefined !== IModelHost.configuration ? IModelHost.configuration.appAssetsDir : undefined; }\r\n\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileTreeRequestTimeout(): number {\r\n return undefined !== IModelHost.configuration ? IModelHost.configuration.tileTreeRequestTimeout : IModelHostConfiguration.defaultTileRequestTimeout;\r\n }\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileContentRequestTimeout(): number {\r\n return undefined !== IModelHost.configuration ? IModelHost.configuration.tileContentRequestTimeout : IModelHostConfiguration.defaultTileRequestTimeout;\r\n }\r\n\r\n /** The backend will log when a tile took longer to load than this threshold in seconds. */\r\n public static get logTileLoadTimeThreshold(): number { return undefined !== IModelHost.configuration ? IModelHost.configuration.logTileLoadTimeThreshold : IModelHostConfiguration.defaultLogTileLoadTimeThreshold; }\r\n /** The backend will log when a tile is loaded with a size in bytes above this threshold. */\r\n public static get logTileSizeThreshold(): number { return undefined !== IModelHost.configuration ? IModelHost.configuration.logTileSizeThreshold : IModelHostConfiguration.defaultLogTileSizeThreshold; }\r\n\r\n /** Whether external tile caching is active.\r\n * @internal\r\n */\r\n public static get usingExternalTileCache(): boolean {\r\n return undefined !== IModelHost.tileCacheService;\r\n }\r\n\r\n /** Whether to restrict tile cache URLs by client IP address.\r\n * @internal\r\n */\r\n public static get restrictTileUrlsByClientIp(): boolean { return undefined !== IModelHost.configuration && (IModelHost.configuration.restrictTileUrlsByClientIp ? true : false); }\r\n\r\n /** Whether to compress cached tiles.\r\n * @internal\r\n */\r\n public static get compressCachedTiles(): boolean { return false !== IModelHost.configuration?.compressCachedTiles; }\r\n\r\n private static setupTileCache() {\r\n assert(undefined !== IModelHost.configuration);\r\n const config = IModelHost.configuration;\r\n const service = config.tileCacheService;\r\n const credentials = config.tileCacheAzureCredentials;\r\n\r\n if (!service && !credentials)\r\n return;\r\n\r\n IModelHost.tileUploader = new CloudStorageTileUploader();\r\n\r\n if (credentials && !service) {\r\n IModelHost.tileCacheService = new AzureBlobStorage(credentials);\r\n } else if (!credentials && service) {\r\n IModelHost.tileCacheService = service;\r\n } else {\r\n throw new IModelError(BentleyStatus.ERROR, \"Cannot use both Azure and custom cloud storage providers for tile cache.\");\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static computeSchemaChecksum(arg: { schemaXmlPath: string, referencePaths: string[], exactMatch?: boolean }): string {\r\n return this.platform.computeSchemaChecksum(arg);\r\n }\r\n}\r\n\r\n/** Information about the platform on which the app is running. Also see [[KnownLocations]] and [[IModelJsFs]].\r\n * @public\r\n */\r\nexport class Platform {\r\n /** Get the name of the platform. */\r\n public static get platformName(): \"win32\" | \"linux\" | \"darwin\" | \"ios\" | \"android\" | \"uwp\" {\r\n return process.platform as any;\r\n }\r\n\r\n /** @internal */\r\n public static load(): typeof IModelJsNative {\r\n return ProcessDetector.isMobileAppBackend ? (process as any)._linkedBinding(\"iModelJsNative\") : NativeLibrary.load();\r\n }\r\n}\r\n\r\n/** Well known directories that may be used by the application. Also see [[Platform]]\r\n * @public\r\n */\r\nexport class KnownLocations {\r\n\r\n /** The directory where the imodeljs-native assets are stored. */\r\n public static get nativeAssetsDir(): string { return IModelHost.platform.DgnDb.getAssetsDir(); }\r\n\r\n /** The directory where the core-backend assets are stored. */\r\n public static get packageAssetsDir(): string {\r\n return path.join(__dirname, \"assets\");\r\n }\r\n\r\n /** The temporary directory. */\r\n public static get tmpdir(): string {\r\n return os.tmpdir();\r\n }\r\n}\r\n\r\n/** Extend this class to provide custom file name resolution behavior.\r\n * @note Only `tryResolveKey` and/or `tryResolveFileName` need to be overridden as the implementations of `resolveKey` and `resolveFileName` work for most purposes.\r\n * @see [[IModelHost.snapshotFileNameResolver]]\r\n * @public\r\n */\r\nexport abstract class FileNameResolver {\r\n /** Resolve a file name from the specified key.\r\n * @param _fileKey The key that identifies the file name in a `Map` or other similar data structure.\r\n * @returns The resolved file name or `undefined` if not found.\r\n */\r\n public tryResolveKey(_fileKey: string): string | undefined { return undefined; }\r\n /** Resolve a file name from the specified key.\r\n * @param fileKey The key that identifies the file name in a `Map` or other similar data structure.\r\n * @returns The resolved file name.\r\n * @throws [[IModelError]] if not found.\r\n */\r\n public resolveKey(fileKey: string): string {\r\n const resolvedFileName: string | undefined = this.tryResolveKey(fileKey);\r\n if (undefined === resolvedFileName) {\r\n throw new IModelError(IModelStatus.NotFound, `${fileKey} not resolved`);\r\n }\r\n return resolvedFileName;\r\n }\r\n /** Resolve the input file name, which may be a partial name, into a full path file name.\r\n * @param inFileName The partial file name.\r\n * @returns The resolved full path file name or `undefined` if not found.\r\n */\r\n public tryResolveFileName(inFileName: string): string | undefined { return inFileName; }\r\n /** Resolve the input file name, which may be a partial name, into a full path file name.\r\n * @param inFileName The partial file name.\r\n * @returns The resolved full path file name.\r\n * @throws [[IModelError]] if not found.\r\n */\r\n public resolveFileName(inFileName: string): string {\r\n const resolvedFileName: string | undefined = this.tryResolveFileName(inFileName);\r\n if (undefined === resolvedFileName) {\r\n throw new IModelError(IModelStatus.NotFound, `${inFileName} not resolved`);\r\n }\r\n return resolvedFileName;\r\n }\r\n}\r\n"]}
@@ -0,0 +1,163 @@
1
+ import { GuidString, Id64String } from "@itwin/core-bentley";
2
+ import { BriefcaseId, ChangesetFileProps, ChangesetId, ChangesetIdWithIndex, ChangesetIndex, ChangesetIndexOrId, ChangesetProps, ChangesetRange, LocalDirName, LocalFileName } from "@itwin/core-common";
3
+ import { LockMap, LockProps, LockState } from "./BackendHubAccess";
4
+ /** @internal */
5
+ interface MockBriefcaseIdProps {
6
+ id: BriefcaseId;
7
+ user: string;
8
+ alias: string;
9
+ assigned: boolean;
10
+ }
11
+ /** @internal */
12
+ interface LocalHubProps {
13
+ readonly iTwinId: GuidString;
14
+ readonly iModelId: GuidString;
15
+ readonly iModelName: string;
16
+ readonly description?: string;
17
+ readonly version0?: string;
18
+ readonly noLocks?: true;
19
+ }
20
+ interface LocksEntry {
21
+ id: Id64String;
22
+ level: LockState;
23
+ lastCsIndex?: ChangesetIndex;
24
+ briefcaseId?: BriefcaseId;
25
+ }
26
+ interface LockStatusNone {
27
+ state: LockState.None;
28
+ lastCsIndex?: ChangesetIndex;
29
+ }
30
+ /** @internal exported for tests. */
31
+ export interface LockStatusExclusive {
32
+ state: LockState.Exclusive;
33
+ briefcaseId: BriefcaseId;
34
+ lastCsIndex?: ChangesetIndex;
35
+ }
36
+ /** @internal exported for tests. */
37
+ export interface LockStatusShared {
38
+ state: LockState.Shared;
39
+ sharedBy: Set<BriefcaseId>;
40
+ lastCsIndex?: ChangesetIndex;
41
+ }
42
+ interface BriefcaseIdAndChangeset {
43
+ changeset: ChangesetIdWithIndex;
44
+ briefcaseId: BriefcaseId;
45
+ }
46
+ declare type LockStatus = LockStatusNone | LockStatusExclusive | LockStatusShared;
47
+ /**
48
+ * A "local" mock for IModelHub to provide access to a single iModel. Used by HubMock.
49
+ * @internal
50
+ */
51
+ export declare class LocalHub {
52
+ readonly rootDir: LocalDirName;
53
+ readonly iTwinId: GuidString;
54
+ readonly iModelId: GuidString;
55
+ readonly iModelName: string;
56
+ readonly description?: string;
57
+ private _hubDb?;
58
+ private _nextBriefcaseId;
59
+ private _latestChangesetIndex;
60
+ get latestChangesetIndex(): number;
61
+ constructor(rootDir: LocalDirName, arg: LocalHubProps);
62
+ private get db();
63
+ get changesetDir(): string;
64
+ get checkpointDir(): string;
65
+ get mockDbName(): string;
66
+ /** Acquire the next available briefcaseId and assign it to the supplied user */
67
+ acquireNewBriefcaseId(user: string, alias?: string): BriefcaseId;
68
+ /** Release a briefcaseId */
69
+ releaseBriefcaseId(id: BriefcaseId): void;
70
+ /** Get an array of all of the currently assigned Briefcases */
71
+ getBriefcases(onlyAssigned?: boolean): MockBriefcaseIdProps[];
72
+ /** Get an array of all of the currently assigned BriefcaseIds for a user */
73
+ getBriefcaseIds(user: string): BriefcaseId[];
74
+ getBriefcase(id: BriefcaseId): MockBriefcaseIdProps;
75
+ private getChangesetFileName;
76
+ /** Add a changeset to the timeline
77
+ * @return the changesetIndex of the added changeset
78
+ */
79
+ addChangeset(changeset: ChangesetFileProps): ChangesetIndex;
80
+ getIndexFromChangeset(changeset: ChangesetIndexOrId): ChangesetIndex;
81
+ /** Get the index of a changeset by its Id */
82
+ getChangesetIndex(id: ChangesetId): ChangesetIndex;
83
+ /** Get the properties of a changeset by its Id */
84
+ getChangesetById(id: ChangesetId): ChangesetProps;
85
+ getPreviousIndex(index: ChangesetIndex): number;
86
+ getParentId(index: ChangesetIndex): ChangesetId;
87
+ /** Get the properties of a changeset by its index */
88
+ getChangesetByIndex(index: ChangesetIndex): ChangesetProps;
89
+ getLatestChangeset(): ChangesetProps;
90
+ getChangesetId(index: ChangesetIndex): ChangesetId;
91
+ /** Get an array of changesets starting with first to last, by index */
92
+ queryChangesets(range?: ChangesetRange): ChangesetProps[];
93
+ /** Name a version */
94
+ addNamedVersion(arg: {
95
+ versionName: string;
96
+ csIndex: ChangesetIndex;
97
+ }): void;
98
+ /** Delete a named version */
99
+ deleteNamedVersion(versionName: string): void;
100
+ /** find the changeset for a named version */
101
+ findNamedVersion(versionName: string): ChangesetProps;
102
+ checkpointNameFromIndex(csIndex: ChangesetIndex): string;
103
+ /** "upload" a checkpoint */
104
+ uploadCheckpoint(arg: {
105
+ changesetIndex: ChangesetIndex;
106
+ localFile: LocalFileName;
107
+ }): string;
108
+ /** Get an array of the indexes for a range of checkpoints */
109
+ getCheckpoints(range?: ChangesetRange): ChangesetIndex[];
110
+ /** Find the checkpoint that is no newer than a changesetIndex */
111
+ queryPreviousCheckpoint(changesetIndex: ChangesetIndex): ChangesetIndex;
112
+ /** "download" a checkpoint */
113
+ downloadCheckpoint(arg: {
114
+ changeset: ChangesetIndexOrId;
115
+ targetFile: LocalFileName;
116
+ }): {
117
+ index: number;
118
+ id: string;
119
+ };
120
+ private copyChangeset;
121
+ /** "download" a changeset */
122
+ downloadChangeset(arg: {
123
+ index: ChangesetIndex;
124
+ targetDir: LocalDirName;
125
+ }): ChangesetFileProps;
126
+ /** "download" all the changesets in a given range */
127
+ downloadChangesets(arg: {
128
+ range?: ChangesetRange;
129
+ targetDir: LocalDirName;
130
+ }): ChangesetFileProps[];
131
+ private querySharedLockHolders;
132
+ queryAllLocks(briefcaseId: BriefcaseId): LockProps[];
133
+ queryLockStatus(elementId: Id64String): LockStatus;
134
+ private reserveLock;
135
+ private clearLock;
136
+ private updateLockChangeset;
137
+ private requestLock;
138
+ private removeSharedLock;
139
+ private releaseLock;
140
+ /** Acquire a set of locks. If any lock cannot be acquired, no locks are acquired */
141
+ acquireLocks(locks: LockMap, briefcase: BriefcaseIdAndChangeset): void;
142
+ acquireLock(props: LockProps, briefcase: BriefcaseIdAndChangeset): void;
143
+ releaseLocks(locks: LockProps[], arg: {
144
+ briefcaseId: BriefcaseId;
145
+ changesetIndex: ChangesetIndex;
146
+ }): void;
147
+ releaseAllLocks(arg: {
148
+ briefcaseId: BriefcaseId;
149
+ changesetIndex: ChangesetIndex;
150
+ }): void;
151
+ private countTable;
152
+ countSharedLocks(): number;
153
+ countLocks(): number;
154
+ queryAllSharedLocks(): {
155
+ id: Id64String;
156
+ briefcaseId: BriefcaseId;
157
+ }[];
158
+ queryLocks(): LocksEntry[];
159
+ removeDir(dirName: string): void;
160
+ cleanup(): void;
161
+ }
162
+ export {};
163
+ //# sourceMappingURL=LocalHub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalHub.d.ts","sourceRoot":"","sources":["../../src/LocalHub.ts"],"names":[],"mappings":"AAMA,OAAO,EAAY,UAAU,EAAE,UAAU,EAA2C,MAAM,qBAAqB,CAAC;AAChH,OAAO,EACL,WAAW,EAAoB,kBAAkB,EAAE,WAAW,EAAE,oBAAoB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EACxI,cAAc,EAAe,YAAY,EAAE,aAAa,EACzD,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAgB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQjF,gBAAgB;AAChB,UAAU,oBAAoB;IAC5B,EAAE,EAAE,WAAW,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,gBAAgB;AAChB,UAAU,aAAa;IACrB,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,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