@itwin/core-backend 3.4.0-dev.10 → 3.4.0-dev.15
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/BackendHubAccess.d.ts.map +1 -1
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/CodeService.d.ts +404 -0
- package/lib/cjs/CodeService.d.ts.map +1 -0
- package/lib/cjs/CodeService.js +62 -0
- package/lib/cjs/CodeService.js.map +1 -0
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +4 -0
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.d.ts.map +1 -1
- package/lib/cjs/GeoCoordConfig.js +3 -2
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +11 -4
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +38 -11
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +3 -1
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelSchemaLoader.d.ts.map +1 -1
- package/lib/cjs/IModelSchemaLoader.js +10 -18
- package/lib/cjs/IModelSchemaLoader.js.map +1 -1
- package/lib/cjs/LocalHub.js +1 -1
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +62 -40
- package/lib/cjs/SQLiteDb.d.ts.map +1 -1
- package/lib/cjs/SQLiteDb.js +57 -40
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/SqliteStatement.d.ts +14 -2
- package/lib/cjs/SqliteStatement.d.ts.map +1 -1
- package/lib/cjs/SqliteStatement.js +50 -28
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/TxnManager.js +1 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/assets/Settings/backend.setting.json5 +1 -1
- package/lib/cjs/core-backend.d.ts +1 -0
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +1 -0
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +7 -3
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js +17 -18
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/package.json +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelHost.d.ts","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,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,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAoB,2BAA2B,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAarI,OAAO,EAAkB,SAAS,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAMjF,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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IAED,+BAA+B;IAC/B,WAAkB,MAAM,IAAI,MAAM,CAEjC;CACF;AAED;;;;GAIG;AACH,8BAAsB,gBAAgB;IACpC;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAC1D;;;;OAIG;IACI,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAO1C;;;OAGG;IACI,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IACjE;;;;OAIG;IACI,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;CAOnD"}
|
package/lib/cjs/IModelHost.js
CHANGED
|
@@ -271,6 +271,7 @@ class IModelHost {
|
|
|
271
271
|
}
|
|
272
272
|
/** This method must be called when an iTwin.js host is shut down. Raises [[onBeforeShutdown]] */
|
|
273
273
|
static async shutdown() {
|
|
274
|
+
var _a;
|
|
274
275
|
// NB: This method is set as a node listener where `this` is unbound
|
|
275
276
|
if (!IModelHost._isValid)
|
|
276
277
|
return;
|
|
@@ -279,8 +280,9 @@ class IModelHost {
|
|
|
279
280
|
IModelHost.configuration = undefined;
|
|
280
281
|
IModelHost.tileCacheService = undefined;
|
|
281
282
|
IModelHost.tileUploader = undefined;
|
|
282
|
-
IModelHost.
|
|
283
|
+
(_a = IModelHost._appWorkspace) === null || _a === void 0 ? void 0 : _a.close();
|
|
283
284
|
IModelHost._appWorkspace = undefined;
|
|
285
|
+
Workspace_1.ITwinWorkspace.finalize();
|
|
284
286
|
process.removeListener("beforeExit", IModelHost.shutdown);
|
|
285
287
|
}
|
|
286
288
|
/**
|
|
@@ -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,8DAAyE;AACzE,sDAA+I;AAC/I,oDAAiH;AACjH,0DAAyD;AAEzD,m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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 { 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/**\r\n * Options for [[IModelHost.startup]]\r\n * @public\r\n */\r\nexport interface IModelHostOptions {\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 cacheDir?: LocalDirName;\r\n\r\n /** The directory where application assets are found. */\r\n appAssetsDir?: LocalDirName;\r\n\r\n /**\r\n * Options for creating the [[Workspace]]\r\n * @beta\r\n */\r\n workspace?: WorkspaceOpts;\r\n\r\n /**\r\n * The kind of iModel hub server to use.\r\n * @beta\r\n */\r\n 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 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 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 restrictTileUrlsByClientIp?: boolean;\r\n\r\n /**\r\n * Whether to enable OpenTelemetry tracing\r\n * @beta\r\n */\r\n enableOpenTelemetry?: boolean;\r\n\r\n /** Whether to compress cached tiles.\r\n * Defaults to `true`.\r\n */\r\n 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 tileTreeRequestTimeout?: number;\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 tileContentRequestTimeout?: number;\r\n\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 logTileLoadTimeThreshold?: number;\r\n\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 logTileSizeThreshold?: number;\r\n\r\n /** Crash-reporting configuration\r\n * @alpha\r\n */\r\n crashReportingConfig?: CrashReportingConfig;\r\n\r\n /** The AuthorizationClient used to get accessTokens\r\n * @beta\r\n */\r\n authorizationClient?: AuthorizationClient;\r\n}\r\n\r\n/** Configuration of core-backend.\r\n * @public\r\n */\r\nexport class IModelHostConfiguration implements IModelHostOptions {\r\n public static defaultTileRequestTimeout = 20 * 1000;\r\n public static defaultLogTileLoadTimeThreshold = 40;\r\n public static defaultLogTileSizeThreshold = 20 * 1000000;\r\n\r\n public appAssetsDir?: LocalDirName;\r\n public cacheDir?: LocalDirName;\r\n\r\n /** @beta */\r\n public workspace?: WorkspaceOpts;\r\n /** @beta */\r\n public hubAccess?: BackendHubAccess;\r\n /** @beta */\r\n public authorizationClient?: AuthorizationClient;\r\n /** @beta */\r\n public tileCacheService?: CloudStorageService;\r\n /** @beta */\r\n public restrictTileUrlsByClientIp?: boolean;\r\n public compressCachedTiles?: boolean;\r\n /** @beta */\r\n public tileCacheAzureCredentials?: AzureBlobStorageCredentials;\r\n /** @internal */\r\n public tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** @internal */\r\n public tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** @internal */\r\n public logTileLoadTimeThreshold = IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\r\n /** @internal */\r\n public logTileSizeThreshold = IModelHostConfiguration.defaultLogTileSizeThreshold;\r\n /** @alpha */\r\n public crashReportingConfig?: CrashReportingConfig;\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?: IModelHostOptions;\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 platform.logger = Logger;\r\n }\r\n\r\n /**\r\n * @internal\r\n * @note Use [[IModelHostOptions.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 [[IModelHostOptions.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 IModelHostOptions\");\r\n return this._hubAccess;\r\n }\r\n\r\n private static initializeWorkspace(configuration: IModelHostOptions) {\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 options Host configuration data.\r\n * Raises [[onAfterStartup]].\r\n * @see [[shutdown]].\r\n */\r\n public static async startup(options?: IModelHostOptions): Promise<void> {\r\n if (this._isValid)\r\n return; // we're already initialized\r\n this._isValid = true;\r\n\r\n options = options ?? {};\r\n if (IModelHost.sessionId === \"\")\r\n IModelHost.sessionId = Guid.createValue();\r\n\r\n this.authorizationClient = options.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(options.enableOpenTelemetry);\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\", () => (options));\r\n throw error;\r\n }\r\n }\r\n\r\n if (options.crashReportingConfig && options.crashReportingConfig.crashDir && !ProcessDetector.isElectronAppBackend && !ProcessDetector.isMobileAppBackend) {\r\n this.platform.setCrashReporting(options.crashReportingConfig);\r\n\r\n Logger.logTrace(loggerCategory, \"Configured crash reporting\", {\r\n enableCrashDumps: options.crashReportingConfig?.enableCrashDumps,\r\n wantFullMemoryDumps: options.crashReportingConfig?.wantFullMemoryDumps,\r\n enableNodeReport: options.crashReportingConfig?.enableNodeReport,\r\n uploadToBentley: options.crashReportingConfig?.uploadToBentley,\r\n });\r\n\r\n if (options.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(options.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(options);\r\n this.initializeWorkspace(options);\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 !== options.hubAccess)\r\n this._hubAccess = options.hubAccess;\r\n\r\n this.configuration = options;\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: IModelHostOptions) {\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 should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileTreeRequestTimeout(): number {\r\n return IModelHost.configuration?.tileTreeRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\r\n }\r\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileContent should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileContentRequestTimeout(): number {\r\n return 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 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 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"]}
|
|
1
|
+
{"version":3,"file":"IModelHost.js","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yBAAyB;AACzB,6BAA6B;AAC7B,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;AAoIxD;;GAEG;AACH,MAAa,uBAAuB;IAApC;QAqBE,gBAAgB;QACT,2BAAsB,GAAG,uBAAuB,CAAC,yBAAyB,CAAC;QAClF,gBAAgB;QACT,8BAAyB,GAAG,uBAAuB,CAAC,yBAAyB,CAAC;QACrF,gBAAgB;QACT,6BAAwB,GAAG,uBAAuB,CAAC,+BAA+B,CAAC;QAC1F,gBAAgB;QACT,yBAAoB,GAAG,uBAAuB,CAAC,2BAA2B,CAAC;IAGpF,CAAC;;AA/BD,0DA+BC;AA9Be,iDAAyB,GAAG,EAAE,GAAG,IAAI,CAAC;AACtC,uDAA+B,GAAG,EAAE,CAAC;AACrC,mDAA2B,GAAG,EAAE,GAAG,OAAO,CAAC;AA8B3D;;;GAGG;AACH,MAAM,mBAAoB,SAAQ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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 { 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/**\r\n * Options for [[IModelHost.startup]]\r\n * @public\r\n */\r\nexport interface IModelHostOptions {\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 cacheDir?: LocalDirName;\r\n\r\n /** The directory where application assets are found. */\r\n appAssetsDir?: LocalDirName;\r\n\r\n /**\r\n * Options for creating the [[Workspace]]\r\n * @beta\r\n */\r\n workspace?: WorkspaceOpts;\r\n\r\n /**\r\n * The kind of iModel hub server to use.\r\n * @beta\r\n */\r\n 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 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 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 restrictTileUrlsByClientIp?: boolean;\r\n\r\n /**\r\n * Whether to enable OpenTelemetry tracing\r\n * @beta\r\n */\r\n enableOpenTelemetry?: boolean;\r\n\r\n /** Whether to compress cached tiles.\r\n * Defaults to `true`.\r\n */\r\n 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 tileTreeRequestTimeout?: number;\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 tileContentRequestTimeout?: number;\r\n\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 logTileLoadTimeThreshold?: number;\r\n\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 logTileSizeThreshold?: number;\r\n\r\n /** Crash-reporting configuration\r\n * @alpha\r\n */\r\n crashReportingConfig?: CrashReportingConfig;\r\n\r\n /** The AuthorizationClient used to get accessTokens\r\n * @beta\r\n */\r\n authorizationClient?: AuthorizationClient;\r\n}\r\n\r\n/** Configuration of core-backend.\r\n * @public\r\n */\r\nexport class IModelHostConfiguration implements IModelHostOptions {\r\n public static defaultTileRequestTimeout = 20 * 1000;\r\n public static defaultLogTileLoadTimeThreshold = 40;\r\n public static defaultLogTileSizeThreshold = 20 * 1000000;\r\n\r\n public appAssetsDir?: LocalDirName;\r\n public cacheDir?: LocalDirName;\r\n\r\n /** @beta */\r\n public workspace?: WorkspaceOpts;\r\n /** @beta */\r\n public hubAccess?: BackendHubAccess;\r\n /** @beta */\r\n public authorizationClient?: AuthorizationClient;\r\n /** @beta */\r\n public tileCacheService?: CloudStorageService;\r\n /** @beta */\r\n public restrictTileUrlsByClientIp?: boolean;\r\n public compressCachedTiles?: boolean;\r\n /** @beta */\r\n public tileCacheAzureCredentials?: AzureBlobStorageCredentials;\r\n /** @internal */\r\n public tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** @internal */\r\n public tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** @internal */\r\n public logTileLoadTimeThreshold = IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\r\n /** @internal */\r\n public logTileSizeThreshold = IModelHostConfiguration.defaultLogTileSizeThreshold;\r\n /** @alpha */\r\n public crashReportingConfig?: CrashReportingConfig;\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?: IModelHostOptions;\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 platform.logger = Logger;\r\n }\r\n\r\n /**\r\n * @internal\r\n * @note Use [[IModelHostOptions.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 [[IModelHostOptions.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 IModelHostOptions\");\r\n return this._hubAccess;\r\n }\r\n\r\n private static initializeWorkspace(configuration: IModelHostOptions) {\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 options Host configuration data.\r\n * Raises [[onAfterStartup]].\r\n * @see [[shutdown]].\r\n */\r\n public static async startup(options?: IModelHostOptions): Promise<void> {\r\n if (this._isValid)\r\n return; // we're already initialized\r\n this._isValid = true;\r\n\r\n options = options ?? {};\r\n if (IModelHost.sessionId === \"\")\r\n IModelHost.sessionId = Guid.createValue();\r\n\r\n this.authorizationClient = options.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(options.enableOpenTelemetry);\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\", () => (options));\r\n throw error;\r\n }\r\n }\r\n\r\n if (options.crashReportingConfig && options.crashReportingConfig.crashDir && !ProcessDetector.isElectronAppBackend && !ProcessDetector.isMobileAppBackend) {\r\n this.platform.setCrashReporting(options.crashReportingConfig);\r\n\r\n Logger.logTrace(loggerCategory, \"Configured crash reporting\", {\r\n enableCrashDumps: options.crashReportingConfig?.enableCrashDumps,\r\n wantFullMemoryDumps: options.crashReportingConfig?.wantFullMemoryDumps,\r\n enableNodeReport: options.crashReportingConfig?.enableNodeReport,\r\n uploadToBentley: options.crashReportingConfig?.uploadToBentley,\r\n });\r\n\r\n if (options.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(options.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(options);\r\n this.initializeWorkspace(options);\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 !== options.hubAccess)\r\n this._hubAccess = options.hubAccess;\r\n\r\n this.configuration = options;\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: IModelHostOptions) {\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 ITwinWorkspace.finalize();\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 should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileTreeRequestTimeout(): number {\r\n return IModelHost.configuration?.tileTreeRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\r\n }\r\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileContent should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileContentRequestTimeout(): number {\r\n return 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 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 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelSchemaLoader.d.ts","sourceRoot":"","sources":["../../src/IModelSchemaLoader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IModelSchemaLoader.d.ts","sourceRoot":"","sources":["../../src/IModelSchemaLoader.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAwC,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AA6B3G;;;;;;GAMG;AACH,qBAAa,kBAAkB;IAIV,OAAO,CAAC,OAAO;IAHlC,OAAO,CAAC,QAAQ,CAAuB;IAEvC,gBAAgB;gBACW,OAAO,EAAE,QAAQ;IAU5C;;;OAGG;IACI,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC;IAQ7D;;;OAGG;IACI,YAAY,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;CAM7E"}
|
|
@@ -97,26 +97,18 @@ class IModelSchemaLocater {
|
|
|
97
97
|
* @throws [IModelError]($common) if the schema exists, but cannot be loaded.
|
|
98
98
|
*/
|
|
99
99
|
getSchemaSync(schemaKey, _matchType, context) {
|
|
100
|
-
const schemaProps = this.
|
|
101
|
-
|
|
102
|
-
return undefined;
|
|
103
|
-
context = context ? context : new SchemaContext();
|
|
104
|
-
return Schema.fromJsonSync(schemaProps, context);
|
|
100
|
+
const schemaProps = this._iModel.nativeDb.getSchemaProps(schemaKey.name);
|
|
101
|
+
return Schema.fromJsonSync(schemaProps, context !== null && context !== void 0 ? context : new SchemaContext());
|
|
105
102
|
}
|
|
106
|
-
/**
|
|
107
|
-
* @param
|
|
108
|
-
* @
|
|
109
|
-
* @
|
|
103
|
+
/** Get a schema by [SchemaKey] asynchronously.
|
|
104
|
+
* @param schemaKey The [SchemaKey] that identifies the schema.
|
|
105
|
+
* * @param matchType The [SchemaMatchType] to used for comparing schema versions.
|
|
106
|
+
* @param context The [SchemaContext] used to facilitate schema location.
|
|
107
|
+
* @throws [Error] if the schema is not found or if the schema exists, but cannot be loaded.
|
|
110
108
|
*/
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
if (core_bentley_1.IModelStatus.NotFound === val.error.status) {
|
|
115
|
-
return undefined;
|
|
116
|
-
}
|
|
117
|
-
throw new core_common_1.IModelError(val.error.status, `reading schema=${schemaName}`);
|
|
118
|
-
}
|
|
119
|
-
return val.result;
|
|
109
|
+
async getSchemaAsync(schemaKey, _matchType, context) {
|
|
110
|
+
const schemaProps = await this._iModel.nativeDb.getSchemaPropsAsync(schemaKey.name);
|
|
111
|
+
return Schema.fromJsonSync(schemaProps, context !== null && context !== void 0 ? context : new SchemaContext());
|
|
120
112
|
}
|
|
121
113
|
}
|
|
122
114
|
//# sourceMappingURL=IModelSchemaLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelSchemaLoader.js","sourceRoot":"","sources":["../../src/IModelSchemaLoader.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAmD;AACnD,oDAAiD;
|
|
1
|
+
{"version":3,"file":"IModelSchemaLoader.js","sourceRoot":"","sources":["../../src/IModelSchemaLoader.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAmD;AACnD,oDAAiD;AAIjD,yDAAyD;AACzD,wDAAwD;AAExD,IAAI,MAAW,CAAC;AAChB,IAAI,aAAkB,CAAC;AACvB,IAAI,SAAc,CAAC;AACnB,IAAI,eAAoB,CAAC;AACzB,IAAI,SAAc,CAAC;AAEnB;;;GAGG;AACH,SAAS,YAAY;IACnB,IAAI;QACF,MAAM,QAAQ,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;QACrD,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QACzB,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC;QACvC,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;QAC/B,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC;QAC3C,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;QAC/B,OAAO,IAAI,CAAC;KACb;IAAC,MAAM;QACN,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAa,kBAAkB;IAG7B,gBAAgB;IAChB,YAA2B,OAAiB;QAAjB,YAAO,GAAP,OAAO,CAAU;QAC1C,wEAAwE;QACxE,IAAI,CAAC,YAAY,EAAE;YACjB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,QAAQ,EAAE,2EAA2E,CAAC,CAAC;QAE5H,IAAI,CAAC,QAAQ,G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AO,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,IAAI,aAAa,EAAE,CAAM,CAAC;IAC/E,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,cAAc,CAAuB,SAA2B,EAAE,UAAkC,EAAE,OAA0C;QAC3J,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpF,OAAO,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,IAAI,aAAa,EAAE,CAAM,CAAC;IAC/E,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { IModelStatus } from \"@itwin/core-bentley\";\r\nimport { IModelError } from \"@itwin/core-common\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport type { ISchemaLocater as ISchemaLocaterType, Schema as SchemaType } from \"@itwin/ecschema-metadata\";\r\n\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\n/* eslint-disable @typescript-eslint/no-var-requires */\r\n\r\nlet Schema: any;\r\nlet SchemaContext: any;\r\nlet SchemaKey: any;\r\nlet SchemaMatchType: any;\r\nlet ECVersion: any;\r\n\r\n/** The ecschema-metadata package is now an optional dependency. If the package\r\n * has not been installed, the exception is caught below. All the types will be\r\n * undefined, and an exception is throw in the IModelSchemaLoader constructor.\r\n */\r\nfunction loadMetadata(): boolean {\r\n try {\r\n const metadata = require(\"@itwin/ecschema-metadata\");\r\n Schema = metadata.Schema;\r\n SchemaContext = metadata.SchemaContext;\r\n SchemaKey = metadata.SchemaKey;\r\n SchemaMatchType = metadata.SchemaMatchType;\r\n ECVersion = metadata.ECVersion;\r\n return true;\r\n } catch {\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * A utility class for retrieving EC Schema objects from an iModel. Loaded schemas are held in memory within\r\n * a schema context managed by IModelSchemaLoader. The IModelSchemaLoader object should be held in memory if\r\n * multiple calls to [[getSchema]] or [[tryGetSchema]] is a possibility, thereby avoiding unnecessary schema\r\n * retrievals from an iModel.\r\n * @alpha\r\n */\r\nexport class IModelSchemaLoader {\r\n private _context: typeof SchemaContext;\r\n\r\n /** @internal */\r\n public constructor(private _iModel: IModelDb) {\r\n // If the ecschema-metadata package was not installed inform the caller.\r\n if (!loadMetadata())\r\n throw new IModelError(IModelStatus.NotFound, \"IModelSchemaLoader requires that @bentley/ecschema-metadata be installed.\");\r\n\r\n this._context = new SchemaContext();\r\n const locater = new IModelSchemaLocater(this._iModel);\r\n this._context.addLocater(locater);\r\n }\r\n\r\n /** Get a schema by name\r\n * @param schemaName a string with the name of the schema to load.\r\n * @throws [IModelError]($common) if the schema is not found or cannot be loaded.\r\n */\r\n public getSchema<T extends SchemaType>(schemaName: string): T {\r\n const schema = this.tryGetSchema(schemaName);\r\n if (!schema)\r\n throw new IModelError(IModelStatus.NotFound, `reading schema=${schemaName}`);\r\n\r\n return schema as T;\r\n }\r\n\r\n /** Attempts to get a schema by name\r\n * @param schemaName a string with the name of the schema to load.\r\n * @throws [IModelError]($common) if the schema exists, but cannot be loaded.\r\n */\r\n public tryGetSchema<T extends SchemaType>(schemaName: string): T | undefined {\r\n // SchemaKey version is not used when locating schema in an iModel, so the version is arbitrary.\r\n const key = new SchemaKey(schemaName, new ECVersion(1, 0, 0));\r\n const schema = this._context.getSchemaSync(key, SchemaMatchType.Latest);\r\n return schema as T;\r\n }\r\n}\r\n\r\n/**\r\n * A private ISchemaLocater implementation for locating and retrieving EC Schema objects from an iModel\r\n * @alpha\r\n */\r\nclass IModelSchemaLocater implements ISchemaLocaterType {\r\n /** @internal */\r\n public constructor(private _iModel: IModelDb) { }\r\n\r\n /** Get a schema by [SchemaKey]\r\n * @param schemaKey The [SchemaKey] that identifies the schema.\r\n * @param matchType The [SchemaMatchType] to used for comparing schema versions.\r\n * @param context The [SchemaContext] used to facilitate schema location.\r\n * @throws [IModelError]($common) if the schema exists, but cannot be loaded.\r\n */\r\n public async getSchema<T extends SchemaType>(schemaKey: typeof SchemaKey, matchType: typeof SchemaMatchType, context?: typeof SchemaContext | undefined): Promise<T | undefined> {\r\n return this.getSchemaSync(schemaKey, matchType, context) as T;\r\n }\r\n\r\n /** Get a schema by [SchemaKey] synchronously.\r\n * @param schemaKey The [SchemaKey] that identifies the schema.\r\n * * @param matchType The [SchemaMatchType] to used for comparing schema versions.\r\n * @param context The [SchemaContext] used to facilitate schema location.\r\n * @throws [IModelError]($common) if the schema exists, but cannot be loaded.\r\n */\r\n public getSchemaSync<T extends SchemaType>(schemaKey: typeof SchemaKey, _matchType: typeof SchemaMatchType, context?: typeof SchemaContext | undefined): T | undefined {\r\n const schemaProps = this._iModel.nativeDb.getSchemaProps(schemaKey.name);\r\n return Schema.fromJsonSync(schemaProps, context ?? new SchemaContext()) as T;\r\n }\r\n\r\n /** Get a schema by [SchemaKey] asynchronously.\r\n * @param schemaKey The [SchemaKey] that identifies the schema.\r\n * * @param matchType The [SchemaMatchType] to used for comparing schema versions.\r\n * @param context The [SchemaContext] used to facilitate schema location.\r\n * @throws [Error] if the schema is not found or if the schema exists, but cannot be loaded.\r\n */\r\n public async getSchemaAsync<T extends SchemaType>(schemaKey: typeof SchemaKey, _matchType: typeof SchemaMatchType, context?: typeof SchemaContext | undefined): Promise<T | undefined> {\r\n const schemaProps = await this._iModel.nativeDb.getSchemaPropsAsync(schemaKey.name);\r\n return Schema.fromJsonSync(schemaProps, context ?? new SchemaContext()) as T;\r\n }\r\n}\r\n"]}
|
package/lib/cjs/LocalHub.js
CHANGED
|
@@ -161,7 +161,7 @@ class LocalHub {
|
|
|
161
161
|
stmt.bindString(3, changeset.description);
|
|
162
162
|
stmt.bindInteger(4, stats.size);
|
|
163
163
|
stmt.bindInteger(5, (_a = changeset.changesType) !== null && _a !== void 0 ? _a : 0);
|
|
164
|
-
stmt.bindString(6, (_b = changeset.pushDate) !== null && _b !== void 0 ? _b : new Date().
|
|
164
|
+
stmt.bindString(6, (_b = changeset.pushDate) !== null && _b !== void 0 ? _b : new Date().toISOString());
|
|
165
165
|
stmt.bindString(7, (_c = changeset.userCreated) !== null && _c !== void 0 ? _c : "");
|
|
166
166
|
stmt.bindInteger(8, changeset.briefcaseId);
|
|
167
167
|
const rc = stmt.step();
|