@itwin/core-backend 5.0.0-dev.4 → 5.0.0-dev.40

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 (134) hide show
  1. package/CHANGELOG.md +40 -1
  2. package/lib/cjs/BriefcaseManager.d.ts +10 -0
  3. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  4. package/lib/cjs/BriefcaseManager.js +49 -8
  5. package/lib/cjs/BriefcaseManager.js.map +1 -1
  6. package/lib/cjs/ChangeSummaryManager.js +1 -1
  7. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  8. package/lib/cjs/CheckpointManager.js +5 -5
  9. package/lib/cjs/CheckpointManager.js.map +1 -1
  10. package/lib/cjs/ClassRegistry.js +8 -14
  11. package/lib/cjs/ClassRegistry.js.map +1 -1
  12. package/lib/cjs/CloudSqlite.d.ts +2 -1
  13. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  14. package/lib/cjs/CloudSqlite.js +3 -3
  15. package/lib/cjs/CloudSqlite.js.map +1 -1
  16. package/lib/cjs/CodeService.d.ts +2 -0
  17. package/lib/cjs/CodeService.d.ts.map +1 -1
  18. package/lib/cjs/CodeService.js.map +1 -1
  19. package/lib/cjs/CodeSpecs.js +1 -1
  20. package/lib/cjs/CodeSpecs.js.map +1 -1
  21. package/lib/cjs/DevTools.js +16 -16
  22. package/lib/cjs/DevTools.js.map +1 -1
  23. package/lib/cjs/ECDb.d.ts +0 -4
  24. package/lib/cjs/ECDb.d.ts.map +1 -1
  25. package/lib/cjs/ECDb.js +0 -4
  26. package/lib/cjs/ECDb.js.map +1 -1
  27. package/lib/cjs/Element.js +23 -25
  28. package/lib/cjs/Element.js.map +1 -1
  29. package/lib/cjs/FontFile.d.ts +68 -0
  30. package/lib/cjs/FontFile.d.ts.map +1 -0
  31. package/lib/cjs/FontFile.js +36 -0
  32. package/lib/cjs/FontFile.js.map +1 -0
  33. package/lib/cjs/GeoCoordConfig.js +8 -8
  34. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  35. package/lib/cjs/HubMock.js +1 -1
  36. package/lib/cjs/HubMock.js.map +1 -1
  37. package/lib/cjs/IModelDb.d.ts +91 -15
  38. package/lib/cjs/IModelDb.d.ts.map +1 -1
  39. package/lib/cjs/IModelDb.js +112 -56
  40. package/lib/cjs/IModelDb.js.map +1 -1
  41. package/lib/cjs/IModelDbFonts.d.ts +54 -0
  42. package/lib/cjs/IModelDbFonts.d.ts.map +1 -0
  43. package/lib/cjs/IModelDbFonts.js +11 -0
  44. package/lib/cjs/IModelDbFonts.js.map +1 -0
  45. package/lib/cjs/IModelHost.d.ts +0 -7
  46. package/lib/cjs/IModelHost.d.ts.map +1 -1
  47. package/lib/cjs/IModelHost.js +19 -27
  48. package/lib/cjs/IModelHost.js.map +1 -1
  49. package/lib/cjs/IModelJsFs.d.ts.map +1 -1
  50. package/lib/cjs/IModelJsFs.js +8 -1
  51. package/lib/cjs/IModelJsFs.js.map +1 -1
  52. package/lib/cjs/IpcHost.js +2 -2
  53. package/lib/cjs/IpcHost.js.map +1 -1
  54. package/lib/cjs/LocalhostIpcHost.js +1 -1
  55. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  56. package/lib/cjs/NativeAppStorage.js +3 -3
  57. package/lib/cjs/NativeAppStorage.js.map +1 -1
  58. package/lib/cjs/NativeHost.js +3 -3
  59. package/lib/cjs/NativeHost.js.map +1 -1
  60. package/lib/cjs/NavigationRelationship.js +25 -25
  61. package/lib/cjs/NavigationRelationship.js.map +1 -1
  62. package/lib/cjs/Relationship.d.ts.map +1 -1
  63. package/lib/cjs/Relationship.js +1 -1
  64. package/lib/cjs/Relationship.js.map +1 -1
  65. package/lib/cjs/SQLiteDb.d.ts +6 -4
  66. package/lib/cjs/SQLiteDb.d.ts.map +1 -1
  67. package/lib/cjs/SQLiteDb.js +12 -6
  68. package/lib/cjs/SQLiteDb.js.map +1 -1
  69. package/lib/cjs/Schema.js +1 -1
  70. package/lib/cjs/Schema.js.map +1 -1
  71. package/lib/cjs/SqliteChangesetReader.d.ts +8 -0
  72. package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
  73. package/lib/cjs/SqliteChangesetReader.js +15 -0
  74. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  75. package/lib/cjs/TextAnnotationLayout.d.ts +6 -3
  76. package/lib/cjs/TextAnnotationLayout.d.ts.map +1 -1
  77. package/lib/cjs/TextAnnotationLayout.js +3 -3
  78. package/lib/cjs/TextAnnotationLayout.js.map +1 -1
  79. package/lib/cjs/TxnManager.d.ts +37 -1
  80. package/lib/cjs/TxnManager.d.ts.map +1 -1
  81. package/lib/cjs/TxnManager.js +148 -2
  82. package/lib/cjs/TxnManager.js.map +1 -1
  83. package/lib/cjs/ViewDefinition.js +19 -22
  84. package/lib/cjs/ViewDefinition.js.map +1 -1
  85. package/lib/cjs/core-backend.d.ts +2 -0
  86. package/lib/cjs/core-backend.d.ts.map +1 -1
  87. package/lib/cjs/core-backend.js +2 -0
  88. package/lib/cjs/core-backend.js.map +1 -1
  89. package/lib/cjs/domains/FunctionalElements.js +1 -1
  90. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  91. package/lib/cjs/internal/ChangesetConflictArgs.d.ts +40 -2
  92. package/lib/cjs/internal/ChangesetConflictArgs.d.ts.map +1 -1
  93. package/lib/cjs/internal/ChangesetConflictArgs.js +99 -0
  94. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  95. package/lib/cjs/internal/ChannelAdmin.js +1 -1
  96. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  97. package/lib/cjs/internal/FontFileImpl.d.ts +34 -0
  98. package/lib/cjs/internal/FontFileImpl.d.ts.map +1 -0
  99. package/lib/cjs/internal/FontFileImpl.js +142 -0
  100. package/lib/cjs/internal/FontFileImpl.js.map +1 -0
  101. package/lib/cjs/internal/IModelDbFontsImpl.d.ts +7 -0
  102. package/lib/cjs/internal/IModelDbFontsImpl.d.ts.map +1 -0
  103. package/lib/cjs/internal/IModelDbFontsImpl.js +188 -0
  104. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -0
  105. package/lib/cjs/internal/Symbols.d.ts +3 -0
  106. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  107. package/lib/cjs/internal/Symbols.js +4 -1
  108. package/lib/cjs/internal/Symbols.js.map +1 -1
  109. package/lib/cjs/internal/workspace/SettingsImpl.js +2 -2
  110. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  111. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +1 -1
  112. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  113. package/lib/cjs/internal/workspace/WorkspaceImpl.js +5 -5
  114. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  115. package/lib/cjs/rpc/multipart.d.ts.map +1 -1
  116. package/lib/cjs/rpc/multipart.js +2 -1
  117. package/lib/cjs/rpc/multipart.js.map +1 -1
  118. package/lib/cjs/rpc/tracing.js +2 -2
  119. package/lib/cjs/rpc/tracing.js.map +1 -1
  120. package/lib/cjs/rpc/web/request.d.ts.map +1 -1
  121. package/lib/cjs/rpc/web/request.js +2 -1
  122. package/lib/cjs/rpc/web/request.js.map +1 -1
  123. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  124. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +1 -1
  125. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  126. package/package.json +21 -19
  127. package/lib/cjs/ChangedElementsManager.d.ts +0 -42
  128. package/lib/cjs/ChangedElementsManager.d.ts.map +0 -1
  129. package/lib/cjs/ChangedElementsManager.js +0 -91
  130. package/lib/cjs/ChangedElementsManager.js.map +0 -1
  131. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +0 -17
  132. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts.map +0 -1
  133. package/lib/cjs/rpc-impl/WipRpcImpl.js +0 -40
  134. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +0 -1
@@ -0,0 +1,54 @@
1
+ /** @packageDocumentation
2
+ * @module iModels
3
+ */
4
+ import { FontFamilyDescriptor, FontFamilySelector, FontId, FontProps } from "@itwin/core-common";
5
+ import { _implementationProhibited } from "./internal/Symbols";
6
+ import { FontFile } from "./FontFile";
7
+ /** Arguments supplied to [[IModelDbFonts.embedFontFile]].
8
+ * @beta
9
+ */
10
+ export interface EmbedFontFileArgs {
11
+ /** The file to embed. */
12
+ file: FontFile;
13
+ /** Unless true, [[IModelDbFonts.acquireId]] will be used to ensure that every font family in [[file]] is assigned a [FontId]($common). */
14
+ skipFontIdAllocation?: boolean;
15
+ }
16
+ /** Arguments supplied to [[IModelDbFonts.queryMappedFamilies]].
17
+ * @beta
18
+ */
19
+ export interface QueryMappedFamiliesArgs {
20
+ /** If true, include families that have been assigned a [FontId]($common) but for which no [FontFace]($common)s have been embedded. */
21
+ includeNonEmbedded?: boolean;
22
+ }
23
+ /** Provides read-write access to the [font-related information]($docs/learning/backend/Fonts.md) stored in an [[IModelDb]].
24
+ * @see [[IModelDb.fonts]] to access the fonts for a specific iModel.
25
+ * @beta
26
+ */
27
+ export interface IModelDbFonts {
28
+ /** @internal */
29
+ readonly [_implementationProhibited]: unknown;
30
+ /** Obtain the collection of font families that have been assigned a [FontId]($common).
31
+ * By default, font families with no corresponding embedded font faces are omitted.
32
+ */
33
+ queryMappedFamilies(args?: QueryMappedFamiliesArgs): Iterable<FontProps>;
34
+ /** Obtain the collection of [[FontFile]]s embedded in the iModel.
35
+ * A FontFile obtained from one iModel can be embedded into another iModel using [[embedFontFile]], but the source iModel must remain open
36
+ */
37
+ queryEmbeddedFontFiles(): Iterable<FontFile>;
38
+ /** Store a [[FontFile]] in the iModel. By default, this method also ensures a [FontId]($common) is assigned to each font family in the file. */
39
+ embedFontFile(args: EmbedFontFileArgs): Promise<void>;
40
+ /** Returns the Id assigned to the specified font family, or `undefined` if no Id has been assigned.
41
+ * If only a name is supplied instead of a descriptor, and more than one family with the same name but different types exist, then
42
+ * [FontType.TrueType]($common) will be preferred over [FontType.Rsc]($common), and [FontType.Rsc]($common) over [FontType.Shx]($common).
43
+ * @see [[acquireId]] to assign an Id.
44
+ * @see [[findDescriptor]] to perform a reverse lookup.
45
+ */
46
+ findId(selector: FontFamilySelector): FontId | undefined;
47
+ /** Returns the font family associated with the specified Id, or `undefined` if no such mapping exists.
48
+ * @see [[findId]] to perform a reverse lookup.
49
+ */
50
+ findDescriptor(id: FontId): FontFamilyDescriptor | undefined;
51
+ /** Look up the Id assigned to the specified font family, allocating a new Id if one has not already been assigned. */
52
+ acquireId(descriptor: FontFamilyDescriptor): Promise<FontId>;
53
+ }
54
+ //# sourceMappingURL=IModelDbFonts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IModelDbFonts.d.ts","sourceRoot":"","sources":["../../src/IModelDbFonts.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,yBAAyB;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,0IAA0I;IAC1I,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,sIAAsI;IACtI,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,gBAAgB;IAChB,QAAQ,CAAC,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAE9C;;OAEG;IACH,mBAAmB,CAAC,IAAI,CAAC,EAAE,uBAAuB,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEzE;;OAEG;IACH,sBAAsB,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAE7C,gJAAgJ;IAChJ,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,GAAG,SAAS,CAAC;IAEzD;;OAEG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAAC;IAE7D,sHAAsH;IACtH,SAAS,CAAC,UAAU,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9D"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module iModels
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const Symbols_1 = require("./internal/Symbols");
11
+ //# sourceMappingURL=IModelDbFonts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IModelDbFonts.js","sourceRoot":"","sources":["../../src/IModelDbFonts.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAGH,gDAA+D","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\n\nimport { FontFamilyDescriptor, FontFamilySelector, FontId, FontProps } from \"@itwin/core-common\";\nimport { _implementationProhibited } from \"./internal/Symbols\";\nimport { FontFile } from \"./FontFile\";\n\n/** Arguments supplied to [[IModelDbFonts.embedFontFile]].\n * @beta\n */\nexport interface EmbedFontFileArgs {\n /** The file to embed. */\n file: FontFile;\n /** Unless true, [[IModelDbFonts.acquireId]] will be used to ensure that every font family in [[file]] is assigned a [FontId]($common). */\n skipFontIdAllocation?: boolean;\n}\n\n/** Arguments supplied to [[IModelDbFonts.queryMappedFamilies]].\n * @beta\n */\nexport interface QueryMappedFamiliesArgs {\n /** If true, include families that have been assigned a [FontId]($common) but for which no [FontFace]($common)s have been embedded. */\n includeNonEmbedded?: boolean;\n}\n\n/** Provides read-write access to the [font-related information]($docs/learning/backend/Fonts.md) stored in an [[IModelDb]].\n * @see [[IModelDb.fonts]] to access the fonts for a specific iModel.\n * @beta\n */\nexport interface IModelDbFonts {\n /** @internal */\n readonly [_implementationProhibited]: unknown;\n\n /** Obtain the collection of font families that have been assigned a [FontId]($common).\n * By default, font families with no corresponding embedded font faces are omitted.\n */\n queryMappedFamilies(args?: QueryMappedFamiliesArgs): Iterable<FontProps>;\n\n /** Obtain the collection of [[FontFile]]s embedded in the iModel.\n * A FontFile obtained from one iModel can be embedded into another iModel using [[embedFontFile]], but the source iModel must remain open\n */\n queryEmbeddedFontFiles(): Iterable<FontFile>;\n\n /** Store a [[FontFile]] in the iModel. By default, this method also ensures a [FontId]($common) is assigned to each font family in the file. */\n embedFontFile(args: EmbedFontFileArgs): Promise<void>;\n\n /** Returns the Id assigned to the specified font family, or `undefined` if no Id has been assigned.\n * If only a name is supplied instead of a descriptor, and more than one family with the same name but different types exist, then\n * [FontType.TrueType]($common) will be preferred over [FontType.Rsc]($common), and [FontType.Rsc]($common) over [FontType.Shx]($common).\n * @see [[acquireId]] to assign an Id.\n * @see [[findDescriptor]] to perform a reverse lookup.\n */\n findId(selector: FontFamilySelector): FontId | undefined;\n\n /** Returns the font family associated with the specified Id, or `undefined` if no such mapping exists.\n * @see [[findId]] to perform a reverse lookup.\n */\n findDescriptor(id: FontId): FontFamilyDescriptor | undefined;\n\n /** Look up the Id assigned to the specified font family, allocating a new Id if one has not already been assigned. */\n acquireId(descriptor: FontFamilyDescriptor): Promise<FontId>;\n}\n"]}
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import "./IModelDb";
5
5
  import "reflect-metadata";
6
- import { IModelJsNative } from "@bentley/imodeljs-native";
7
6
  import { AccessToken, BeEvent, GuidString, Mutable } from "@itwin/core-bentley";
8
7
  import { AuthorizationClient, LocalDirName, SessionProps } from "@itwin/core-common";
9
8
  import { ServerStorage } from "@itwin/object-storage-core";
@@ -187,12 +186,6 @@ export declare class IModelHost {
187
186
  private static _cacheDir;
188
187
  private static _settingsSchemas?;
189
188
  private static _appWorkspace?;
190
- /** Provides access to the entirely internal, low-level, unstable APIs provided by @bentley/imodel-native.
191
- * Should not be used outside of @itwin/core-backend, and certainly not outside of the itwinjs-core repository
192
- * @deprecated in 4.8. This internal API will be removed in 5.0. Use IModelHost's public API instead.
193
- * @internal
194
- */
195
- static get platform(): typeof IModelJsNative;
196
189
  static configuration?: IModelHostOptions;
197
190
  /**
198
191
  * The name of the *Profile* directory (a subdirectory of "[[cacheDir]]/profiles/") for this process.
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHost.d.ts","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,YAAY,CAAC;AAIpB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAU,OAAO,EAAkB,UAAU,EAAwB,OAAO,EAAmB,MAAM,qBAAqB,CAAC;AAC/I,OAAO,EAAE,mBAAmB,EAA8B,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAetD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,aAAa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CAEhD;IAED,8DAA8D;IAC9D,WAAkB,gBAAgB,IAAI,YAAY,CAEjD;IAED,+BAA+B;IAC/B,WAAkB,MAAM,IAAI,YAAY,CAEvC;CACF;AAED;;;;;GAKG;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"}
@@ -31,7 +31,6 @@ const DevToolsRpcImpl_1 = require("./rpc-impl/DevToolsRpcImpl");
31
31
  const IModelReadRpcImpl_1 = require("./rpc-impl/IModelReadRpcImpl");
32
32
  const IModelTileRpcImpl_1 = require("./rpc-impl/IModelTileRpcImpl");
33
33
  const SnapshotIModelRpcImpl_1 = require("./rpc-impl/SnapshotIModelRpcImpl");
34
- const WipRpcImpl_1 = require("./rpc-impl/WipRpcImpl");
35
34
  const RpcBackend_1 = require("./RpcBackend");
36
35
  const TileStorage_1 = require("./TileStorage");
37
36
  const Settings_1 = require("./workspace/Settings");
@@ -55,13 +54,13 @@ class IModelHostConfiguration {
55
54
  /** @internal */
56
55
  this.logTileSizeThreshold = IModelHostConfiguration.defaultLogTileSizeThreshold;
57
56
  }
57
+ static { this.defaultTileRequestTimeout = 20 * 1000; }
58
+ static { this.defaultLogTileLoadTimeThreshold = 40; }
59
+ static { this.defaultLogTileSizeThreshold = 20 * 1000000; }
60
+ /** @internal */
61
+ static { this.defaultMaxTileCacheDbSize = 1024 * 1024 * 1024; }
58
62
  }
59
63
  exports.IModelHostConfiguration = IModelHostConfiguration;
60
- IModelHostConfiguration.defaultTileRequestTimeout = 20 * 1000;
61
- IModelHostConfiguration.defaultLogTileLoadTimeThreshold = 40;
62
- IModelHostConfiguration.defaultLogTileSizeThreshold = 20 * 1000000;
63
- /** @internal */
64
- IModelHostConfiguration.defaultMaxTileCacheDbSize = 1024 * 1024 * 1024;
65
64
  /**
66
65
  * Settings for `IModelHost.appWorkspace`.
67
66
  * @note this includes the default dictionary from the SettingsSpecRegistry
@@ -102,12 +101,8 @@ const definedInStartup = (obj) => {
102
101
  */
103
102
  class IModelHost {
104
103
  constructor() { }
105
- /** Provides access to the entirely internal, low-level, unstable APIs provided by @bentley/imodel-native.
106
- * Should not be used outside of @itwin/core-backend, and certainly not outside of the itwinjs-core repository
107
- * @deprecated in 4.8. This internal API will be removed in 5.0. Use IModelHost's public API instead.
108
- * @internal
109
- */
110
- static get platform() { return NativePlatform_1.IModelNative.platform; }
104
+ static { this.backendVersion = ""; }
105
+ static { this._cacheDir = ""; }
111
106
  /**
112
107
  * The name of the *Profile* directory (a subdirectory of "[[cacheDir]]/profiles/") for this process.
113
108
  *
@@ -129,6 +124,14 @@ class IModelHost {
129
124
  static get profileDir() {
130
125
  return (0, path_1.join)(this._cacheDir, "profiles", this._profileName);
131
126
  }
127
+ /** Event raised during startup to allow loading settings data */
128
+ static { this.onWorkspaceStartup = new core_bentley_1.BeEvent(); }
129
+ /** Event raised just after the backend IModelHost was started */
130
+ static { this.onAfterStartup = new core_bentley_1.BeEvent(); }
131
+ /** Event raised just before the backend IModelHost is to be shut down */
132
+ static { this.onBeforeShutdown = new core_bentley_1.BeEvent(); }
133
+ /** @internal */
134
+ static { this.session = { applicationId: "2686", applicationVersion: "1.0.0", sessionId: "" }; }
132
135
  /** A uniqueId for this session */
133
136
  static get sessionId() { return this.session.sessionId; }
134
137
  static set sessionId(id) { this.session.sessionId = id; }
@@ -138,6 +141,8 @@ class IModelHost {
138
141
  /** The version of this application - needs to be set if is an agent application. The applicationVersion will otherwise originate at the frontend. */
139
142
  static get applicationVersion() { return this.session.applicationVersion; }
140
143
  static set applicationVersion(version) { this.session.applicationVersion = version; }
144
+ /** A string that can identify the current user to other users when collaborating. */
145
+ static { this.userMoniker = "unknown"; }
141
146
  /** Root directory holding files that iTwin.js caches */
142
147
  static get cacheDir() { return this._cacheDir; }
143
148
  /** The application [[Workspace]] for this `IModelHost`
@@ -223,6 +228,7 @@ class IModelHost {
223
228
  // allow applications to load their default settings
224
229
  this.onWorkspaceStartup.raiseEvent();
225
230
  }
231
+ static { this._isValid = false; }
226
232
  /** true between a successful call to [[startup]] and before [[shutdown]] */
227
233
  static get isValid() {
228
234
  return IModelHost._isValid;
@@ -250,7 +256,6 @@ class IModelHost {
250
256
  IModelReadRpcImpl_1.IModelReadRpcImpl,
251
257
  IModelTileRpcImpl_1.IModelTileRpcImpl,
252
258
  SnapshotIModelRpcImpl_1.SnapshotIModelRpcImpl, // eslint-disable-line @typescript-eslint/no-deprecated
253
- WipRpcImpl_1.WipRpcImpl, // eslint-disable-line @typescript-eslint/no-deprecated
254
259
  DevToolsRpcImpl_1.DevToolsRpcImpl,
255
260
  ].forEach((rpc) => rpc.register()); // register all of the RPC implementations
256
261
  [
@@ -365,7 +370,7 @@ class IModelHost {
365
370
  NativePlatform_1.IModelNative.platform.setMaxTileCacheSize(0);
366
371
  if (credentials) {
367
372
  if (storage)
368
- throw new core_common_1.IModelError(core_common_1.BentleyStatus.ERROR, "Cannot use both Azure and custom cloud storage providers for tile cache.");
373
+ throw new core_common_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Cannot use both Azure and custom cloud storage providers for tile cache.");
369
374
  this.setupAzureTileCache(credentials);
370
375
  }
371
376
  if (storage)
@@ -392,19 +397,6 @@ class IModelHost {
392
397
  }
393
398
  }
394
399
  exports.IModelHost = IModelHost;
395
- IModelHost.backendVersion = "";
396
- IModelHost._cacheDir = "";
397
- /** Event raised during startup to allow loading settings data */
398
- IModelHost.onWorkspaceStartup = new core_bentley_1.BeEvent();
399
- /** Event raised just after the backend IModelHost was started */
400
- IModelHost.onAfterStartup = new core_bentley_1.BeEvent();
401
- /** Event raised just before the backend IModelHost is to be shut down */
402
- IModelHost.onBeforeShutdown = new core_bentley_1.BeEvent();
403
- /** @internal */
404
- IModelHost.session = { applicationId: "2686", applicationVersion: "1.0.0", sessionId: "" };
405
- /** A string that can identify the current user to other users when collaborating. */
406
- IModelHost.userMoniker = "unknown";
407
- IModelHost._isValid = false;
408
400
  /** Information about the platform on which the app is running.
409
401
  * @public
410
402
  */
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHost.js","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yFAAyF;AACzF,sBAAoB,CAAC,mCAAmC;AAExD,8DAA6E;AAC7E,yBAAyB;AACzB,4BAA0B,CAAC,yJAAyJ;AACpL,8DAAyE;AACzE,oEAAyF;AACzF,sDAA+I;AAC/I,oDAAiH;AACjH,sEAAyE;AACzE,oEAA2D;AAE3D,mEAAgE;AAChE,mDAAgD;AAChD,yDAAsD;AACtD,+CAA4C;AAC5C,iEAA8D;AAC9D,2DAAwD;AACxD,qDAAkD;AAClD,6CAA0C;AAC1C,gEAA6D;AAC7D,oEAAiE;AACjE,oEAAiE;AACjE,4EAAyE;AACzE,sDAAmD;AACnD,6CAAoD;AACpD,+CAA4C;AAC5C,mDAA2E;AAG3E,yCAAsC;AACtC,+BAAuD;AACvD,sEAAwF;AACxF,oEAAiE;AACjE,kFAAoF;AAEpF,MAAM,cAAc,GAAG,6CAAqB,CAAC,UAAU,CAAC;AA2JxD;;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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AG,OAAO,eAAe,CAAC,CAAC;QAC1E,CAAC;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,CAAC;YACnC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,QAAQ,EAAE,GAAG,UAAU,eAAe,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAnCD,4CAmCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelHost\n */\n\n// To avoid circular load errors, the \"Element\" classes must be loaded before IModelHost.\nimport \"./IModelDb\"; // DO NOT REMOVE OR MOVE THIS LINE!\n\nimport { IModelNative, loadNativePlatform } from \"./internal/NativePlatform\";\nimport * as os from \"os\";\nimport \"reflect-metadata\"; // this has to be before @itwin/object-storage-* and @itwin/cloud-agnostic-core imports because those packages contain decorators that use this polyfill.\nimport { IModelJsNative, NativeLibrary } from \"@bentley/imodeljs-native\";\nimport { DependenciesConfig, Types as ExtensionTypes } from \"@itwin/cloud-agnostic-core\";\nimport { AccessToken, assert, BeEvent, DbResult, Guid, GuidString, IModelStatus, Logger, Mutable, ProcessDetector } from \"@itwin/core-bentley\";\nimport { AuthorizationClient, BentleyStatus, IModelError, LocalDirName, SessionProps } from \"@itwin/core-common\";\nimport { AzureServerStorageBindings } from \"@itwin/object-storage-azure\";\nimport { ServerStorage } from \"@itwin/object-storage-core\";\nimport { BackendHubAccess } from \"./BackendHubAccess\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { BisCoreSchema } from \"./BisCoreSchema\";\nimport { BriefcaseManager } from \"./BriefcaseManager\";\nimport { CloudSqlite } from \"./CloudSqlite\";\nimport { FunctionalSchema } from \"./domains/FunctionalSchema\";\nimport { GenericSchema } from \"./domains/GenericSchema\";\nimport { GeoCoordConfig } from \"./GeoCoordConfig\";\nimport { IModelJsFs } from \"./IModelJsFs\";\nimport { DevToolsRpcImpl } from \"./rpc-impl/DevToolsRpcImpl\";\nimport { IModelReadRpcImpl } from \"./rpc-impl/IModelReadRpcImpl\";\nimport { IModelTileRpcImpl } from \"./rpc-impl/IModelTileRpcImpl\";\nimport { SnapshotIModelRpcImpl } from \"./rpc-impl/SnapshotIModelRpcImpl\";\nimport { WipRpcImpl } from \"./rpc-impl/WipRpcImpl\";\nimport { initializeRpcBackend } from \"./RpcBackend\";\nimport { TileStorage } from \"./TileStorage\";\nimport { SettingsContainer, SettingsPriority } from \"./workspace/Settings\";\nimport { SettingsSchemas } from \"./workspace/SettingsSchemas\";\nimport { Workspace, WorkspaceOpts } from \"./workspace/Workspace\";\nimport { Container } from \"inversify\";\nimport { join, normalize as normalizeDir } from \"path\";\nimport { constructWorkspace, OwnedWorkspace } from \"./internal/workspace/WorkspaceImpl\";\nimport { SettingsImpl } from \"./internal/workspace/SettingsImpl\";\nimport { constructSettingsSchemas } from \"./internal/workspace/SettingsSchemasImpl\";\n\nconst loggerCategory = BackendLoggerCategory.IModelHost;\n\n// cspell:ignore nodereport fatalerror apicall alicloud rpcs inversify\n\n/** @internal */\nexport interface CrashReportingConfigNameValuePair {\n name: string;\n value: string;\n}\n\n/** Configuration of the crash-reporting system.\n * @internal\n */\nexport interface CrashReportingConfig {\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. */\n crashDir: string;\n /** max # .dmp files that may exist in crashDir. The default is 50. */\n maxDumpsInDir?: number;\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. */\n enableCrashDumps?: boolean;\n /** If enableCrashDumps is true, do you want a full-memory dump? Defaults to false. */\n wantFullMemoryDumps?: boolean;\n /** Enable Node.js crash reporting? If so, report files will be generated in the event of an unhandled exception or fatal error and written to crashDir. The default is false. */\n enableNodeReport?: boolean;\n /** Additional name, value pairs to write to iModelJsNativeCrash*.properties.txt file in the event of a crash. */\n params?: CrashReportingConfigNameValuePair[];\n /** Run this .js file to process .dmp and Node.js crash reporting .json files in the event of a crash.\n * This script will be executed with a single command-line parameter: the name of the dump or Node.js report file.\n * In the case of a dump file, there will be a second file with the same basename and the extension \".properties.txt\".\n * Since it runs in a separate process, this script will have no access to the Javascript\n * context of the exiting backend. No default.\n */\n dumpProcessorScriptFileName?: string;\n /** Upload crash dump and node-reports to Bentley's crash-reporting service? Defaults to false */\n uploadToBentley?: boolean;\n}\n\n/** @beta */\nexport interface AzureBlobStorageCredentials {\n account: string;\n accessKey: string;\n baseUrl?: string;\n}\n\n/**\n * Options for [[IModelHost.startup]]\n * @public\n */\nexport interface IModelHostOptions {\n /**\n * The name of the *Profile* subdirectory of [[cacheDir]] for this process. If not present, \"default\" is used.\n * @see [[IModelHost.profileName]]\n * @beta\n */\n profileName?: string;\n\n /**\n * Root of the directory holding all the files that iTwin.js caches\n * - If not specified at startup a platform specific default is used -\n * - Windows: $(HOMEDIR)/AppData/Local/iModelJs/\n * - Mac/iOS: $(HOMEDIR)/Library/Caches/iModelJs/\n * - Linux: $(HOMEDIR)/.cache/iModelJs/\n * where $(HOMEDIR) is documented [here](https://nodejs.org/api/os.html#os_os_homedir)\n * - if specified, ensure it is set to a folder with read/write access.\n * @see [[IModelHost.cacheDir]] for the value it's set to after startup\n */\n cacheDir?: LocalDirName;\n\n /** The directory where application assets are found. */\n appAssetsDir?: LocalDirName;\n\n /**\n * Options for creating the [[IModelHost.appWorkspace]]\n * @beta\n */\n workspace?: WorkspaceOpts;\n\n /**\n * The kind of iModel hub server to use.\n * @internal\n */\n hubAccess?: BackendHubAccess;\n\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.\n * @beta\n */\n tileCacheAzureCredentials?: AzureBlobStorageCredentials;\n\n /**\n * @beta\n * @note A reference implementation is set for AzureServerStorage from @itwin/object-storage-azure if [[tileCacheAzureCredentials]] property is set. To supply a different implementation for any service provider (such as AWS),\n * set this property with a custom ServerStorage.\n */\n tileCacheStorage?: ServerStorage;\n\n /** The maximum size in bytes to which a local sqlite database used for caching tiles can grow before it is purged of least-recently-used tiles.\n * The local cache is used only if an external cache has not been configured via [[tileCacheStorage]], and [[tileCacheAzureCredentials]].\n * Defaults to 1 GB. Must be an unsigned integer. A value of zero disables the local cache entirely.\n * @beta\n */\n maxTileCacheDbSize?: number;\n\n /** Whether to restrict tile cache URLs by client IP address (if available).\n * @beta\n */\n restrictTileUrlsByClientIp?: boolean;\n\n /** Whether to enable OpenTelemetry tracing.\n * Defaults to `false`.\n */\n enableOpenTelemetry?: boolean;\n\n /** Whether to compress cached tiles.\n * Defaults to `true`.\n */\n compressCachedTiles?: boolean;\n\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a \"pending\" status.\n * @internal\n */\n tileTreeRequestTimeout?: number;\n\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a \"pending\" status.\n * @internal\n */\n tileContentRequestTimeout?: number;\n\n /** The backend will log when a tile took longer to load than this threshold in seconds.\n * @internal\n */\n logTileLoadTimeThreshold?: number;\n\n /** The backend will log when a tile is loaded with a size in bytes above this threshold.\n * @internal\n */\n logTileSizeThreshold?: number;\n\n /** Crash-reporting configuration\n * @internal\n */\n crashReportingConfig?: CrashReportingConfig;\n\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\n authorizationClient?: AuthorizationClient;\n\n /**\n * Automatically enable shared channel when opening iModels for read/write (see [Working With Channels]($docs/learning/backend/Channel.md)).\n * If not present, defaults to `true` for backwards compatibility. This means that the shared channel may be edited by default. Generally\n * that is undesirable because it allows applications to \"accidentally\" modify data it shouldn't be allowed to modify. Unfortunately the\n * previous versions of iTwin.js allowed it so this is necessary so they won't break.\n * Will be changed to default to `false` in 5.0.\n */\n allowSharedChannel?: boolean;\n}\n\n/** Configuration of core-backend.\n * @public\n */\nexport class IModelHostConfiguration implements IModelHostOptions {\n public static defaultTileRequestTimeout = 20 * 1000;\n public static defaultLogTileLoadTimeThreshold = 40;\n public static defaultLogTileSizeThreshold = 20 * 1000000;\n /** @internal */\n public static defaultMaxTileCacheDbSize = 1024 * 1024 * 1024;\n\n public appAssetsDir?: LocalDirName;\n public cacheDir?: LocalDirName;\n\n /** @beta */\n public workspace?: WorkspaceOpts;\n /** @internal */\n public hubAccess?: BackendHubAccess;\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\n public authorizationClient?: AuthorizationClient;\n /** @beta */\n public restrictTileUrlsByClientIp?: boolean;\n public compressCachedTiles?: boolean;\n /** @beta */\n public tileCacheAzureCredentials?: AzureBlobStorageCredentials;\n /** @internal */\n public tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\n /** @internal */\n public tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\n /** @internal */\n public logTileLoadTimeThreshold = IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\n /** @internal */\n public logTileSizeThreshold = IModelHostConfiguration.defaultLogTileSizeThreshold;\n /** @internal */\n public crashReportingConfig?: CrashReportingConfig;\n}\n\n/**\n * Settings for `IModelHost.appWorkspace`.\n * @note this includes the default dictionary from the SettingsSpecRegistry\n */\nclass ApplicationSettings extends SettingsImpl {\n private _remove?: VoidFunction;\n protected override verifyPriority(priority: SettingsPriority) {\n if (priority > SettingsPriority.application) // only application or lower may appear in ApplicationSettings\n throw new Error(\"Use IModelSettings\");\n }\n private updateDefaults() {\n const defaults: SettingsContainer = {};\n for (const [schemaName, val] of IModelHost.settingsSchemas.settingDefs) {\n if (val.default)\n defaults[schemaName] = val.default;\n }\n this.addDictionary({ name: \"_default_\", priority: 0 }, defaults);\n }\n\n public constructor() {\n super();\n this._remove = IModelHost.settingsSchemas.onSchemaChanged.addListener(() => this.updateDefaults());\n this.updateDefaults();\n }\n\n public override close() {\n if (this._remove) {\n this._remove();\n this._remove = undefined;\n }\n }\n}\n\nconst definedInStartup = <T>(obj: T | undefined): T => {\n if (obj === undefined)\n throw new Error(\"IModelHost.startup must be called first\");\n return obj;\n};\n\n/** IModelHost initializes ($backend) and captures its configuration. A backend must call [[IModelHost.startup]] before using any backend classes.\n * See [the learning article]($docs/learning/backend/IModelHost.md)\n * @public\n */\nexport class IModelHost {\n private constructor() { }\n\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\n public static authorizationClient?: AuthorizationClient;\n\n public static backendVersion = \"\";\n private static _profileName: string;\n private static _cacheDir = \"\";\n private static _settingsSchemas?: SettingsSchemas;\n private static _appWorkspace?: OwnedWorkspace;\n\n /** Provides access to the entirely internal, low-level, unstable APIs provided by @bentley/imodel-native.\n * Should not be used outside of @itwin/core-backend, and certainly not outside of the itwinjs-core repository\n * @deprecated in 4.8. This internal API will be removed in 5.0. Use IModelHost's public API instead.\n * @internal\n */\n public static get platform(): typeof IModelJsNative { return IModelNative.platform; }\n\n public static configuration?: IModelHostOptions;\n\n /**\n * The name of the *Profile* directory (a subdirectory of \"[[cacheDir]]/profiles/\") for this process.\n *\n * The *Profile* directory is used to cache data that is specific to a type-of-usage of the iTwin.js library.\n * It is important that information in the profile cache be consistent but isolated across sessions (i.e.\n * data for a profile is maintained between runs, but each profile is completely independent and\n * unaffected by the presence ot use of others.)\n * @note **Only one process at a time may be using a given profile**, and an exception will be thrown by [[startup]]\n * if a second process attempts to use the same profile.\n * @beta\n */\n public static get profileName(): string {\n return this._profileName;\n }\n\n /** The full path of the Profile directory.\n * @see [[profileName]]\n * @beta\n */\n public static get profileDir(): LocalDirName {\n return join(this._cacheDir, \"profiles\", this._profileName);\n }\n\n /** Event raised during startup to allow loading settings data */\n public static readonly onWorkspaceStartup = new BeEvent<() => void>();\n\n /** Event raised just after the backend IModelHost was started */\n public static readonly onAfterStartup = new BeEvent<() => void>();\n\n /** Event raised just before the backend IModelHost is to be shut down */\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\n\n /** @internal */\n public static readonly session: Mutable<SessionProps> = { applicationId: \"2686\", applicationVersion: \"1.0.0\", sessionId: \"\" };\n\n /** A uniqueId for this session */\n public static get sessionId() { return this.session.sessionId; }\n public static set sessionId(id: GuidString) { this.session.sessionId = id; }\n\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. */\n public static get applicationId() { return this.session.applicationId; }\n public static set applicationId(id: string) { this.session.applicationId = id; }\n\n /** The version of this application - needs to be set if is an agent application. The applicationVersion will otherwise originate at the frontend. */\n public static get applicationVersion() { return this.session.applicationVersion; }\n public static set applicationVersion(version: string) { this.session.applicationVersion = version; }\n\n /** A string that can identify the current user to other users when collaborating. */\n public static userMoniker = \"unknown\";\n\n /** Root directory holding files that iTwin.js caches */\n public static get cacheDir(): LocalDirName { return this._cacheDir; }\n\n /** The application [[Workspace]] for this `IModelHost`\n * @note this `Workspace` only holds [[WorkspaceContainer]]s and [[Settings]] scoped to the currently loaded application(s).\n * All organization, iTwin, and iModel based containers or settings must be accessed through [[IModelDb.workspace]] and\n * attempting to add them to this Workspace will fail.\n * @beta\n */\n public static get appWorkspace(): Workspace { return definedInStartup(this._appWorkspace); }\n\n /** The registry of schemas describing the [[Setting]]s for the application session.\n * Applications should register their schemas via methods like [[SettingsSchemas.addGroup]].\n * @beta\n */\n public static get settingsSchemas(): SettingsSchemas { return definedInStartup(this._settingsSchemas); }\n\n /** The optional [[FileNameResolver]] that resolves keys and partial file names for snapshot iModels.\n * @deprecated in 4.10. When opening a snapshot by file name, ensure to pass already resolved path. Using a key to open a snapshot is now deprecated.\n */\n public static snapshotFileNameResolver?: FileNameResolver; // eslint-disable-line @typescript-eslint/no-deprecated\n\n /** Get the current access token for this IModelHost, or a blank string if none is available.\n * @note for web backends, this will *always* return a blank string because the backend itself has no token (but never needs one either.)\n * For all IpcHosts, where this backend is servicing a single frontend, this will be the user's token. For ElectronHost, the backend\n * obtains the token and forwards it to the frontend.\n * @note accessTokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\n * returned by this method may change over time throughout the course of a session.\n */\n public static async getAccessToken(): Promise<AccessToken> {\n try {\n return (await IModelHost.authorizationClient?.getAccessToken()) ?? \"\";\n } catch {\n return \"\";\n }\n }\n\n private static loadNative(options: IModelHostOptions) {\n loadNativePlatform();\n\n if (options.crashReportingConfig && options.crashReportingConfig.crashDir && !ProcessDetector.isElectronAppBackend && !ProcessDetector.isMobileAppBackend) {\n IModelNative.platform.setCrashReporting(options.crashReportingConfig);\n\n Logger.logTrace(loggerCategory, \"Configured crash reporting\", {\n enableCrashDumps: options.crashReportingConfig?.enableCrashDumps,\n wantFullMemoryDumps: options.crashReportingConfig?.wantFullMemoryDumps,\n enableNodeReport: options.crashReportingConfig?.enableNodeReport,\n uploadToBentley: options.crashReportingConfig?.uploadToBentley,\n });\n\n if (options.crashReportingConfig.enableNodeReport) {\n if (process.report !== undefined) {\n process.report.reportOnFatalError = true;\n process.report.reportOnUncaughtException = true;\n process.report.directory = options.crashReportingConfig.crashDir;\n Logger.logTrace(loggerCategory, \"Configured Node.js crash reporting\");\n } else {\n Logger.logWarning(loggerCategory, \"Unable to configure Node.js crash reporting\");\n }\n }\n }\n }\n\n /** @internal */\n public static tileStorage?: TileStorage;\n\n private static _hubAccess?: BackendHubAccess;\n /** @internal */\n public static setHubAccess(hubAccess: BackendHubAccess | undefined) { this._hubAccess = hubAccess; }\n\n /** get the current hubAccess, if present.\n * @internal\n */\n public static getHubAccess(): BackendHubAccess | undefined { return this._hubAccess; }\n\n /** Provides access to the IModelHub for this IModelHost\n * @internal\n * @note If [[IModelHostOptions.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.\n * To determine whether one is present, use [[getHubAccess]].\n */\n public static get hubAccess(): BackendHubAccess {\n if (IModelHost._hubAccess === undefined)\n throw new IModelError(IModelStatus.BadRequest, \"No BackendHubAccess supplied in IModelHostOptions\");\n return IModelHost._hubAccess;\n }\n\n private static initializeWorkspace(configuration: IModelHostOptions) {\n const settingAssets = join(KnownLocations.packageAssetsDir, \"Settings\");\n this._settingsSchemas = constructSettingsSchemas();\n this._settingsSchemas.addDirectory(join(settingAssets, \"Schemas\"));\n this._appWorkspace = constructWorkspace(new ApplicationSettings(), configuration.workspace);\n\n // Create the CloudCache for Workspaces. This will fail if another process is already using the same profile.\n try {\n this.appWorkspace.getCloudCache();\n } catch (e: any) {\n throw (e.errorNumber === DbResult.BE_SQLITE_BUSY) ? new IModelError(DbResult.BE_SQLITE_BUSY, `Profile [${this.profileDir}] is already in use by another process`) : e;\n }\n\n this.appWorkspace.settings.addDirectory(settingAssets, SettingsPriority.defaults);\n\n GeoCoordConfig.onStartup();\n // allow applications to load their default settings\n this.onWorkspaceStartup.raiseEvent();\n }\n\n private static _isValid = false;\n\n /** true between a successful call to [[startup]] and before [[shutdown]] */\n public static get isValid() {\n return IModelHost._isValid;\n }\n\n /** This method must be called before any iTwin.js services are used.\n * @param options Host configuration data.\n * Raises [[onAfterStartup]].\n * @see [[shutdown]].\n */\n public static async startup(options?: IModelHostOptions): Promise<void> {\n if (this._isValid)\n return; // we're already initialized\n this._isValid = true;\n\n options = options ?? {};\n if (this.sessionId === \"\")\n this.sessionId = Guid.createValue();\n\n this.authorizationClient = options.authorizationClient;\n\n this.backendVersion = require(\"../../package.json\").version; // eslint-disable-line @typescript-eslint/no-require-imports\n initializeRpcBackend(options.enableOpenTelemetry);\n\n this.loadNative(options);\n this.setupCacheDir(options);\n this.initializeWorkspace(options);\n\n BriefcaseManager.initialize(join(this._cacheDir, \"imodels\"));\n\n [\n IModelReadRpcImpl,\n IModelTileRpcImpl,\n SnapshotIModelRpcImpl, // eslint-disable-line @typescript-eslint/no-deprecated\n WipRpcImpl, // eslint-disable-line @typescript-eslint/no-deprecated\n DevToolsRpcImpl,\n ].forEach((rpc) => rpc.register()); // register all of the RPC implementations\n\n [\n BisCoreSchema,\n GenericSchema,\n FunctionalSchema,\n ].forEach((schema) => schema.registerSchema()); // register all of the schemas\n\n if (undefined !== options.hubAccess)\n this._hubAccess = options.hubAccess;\n\n this.configuration = options;\n this.setupTileCache();\n\n process.once(\"beforeExit\", IModelHost.shutdown);\n this.onAfterStartup.raiseEvent();\n }\n\n private static setupCacheDir(configuration: IModelHostOptions) {\n this._cacheDir = normalizeDir(configuration.cacheDir ?? NativeLibrary.defaultCacheDir);\n IModelJsFs.recursiveMkDirSync(this._cacheDir);\n\n this._profileName = configuration.profileName ?? \"default\";\n Logger.logInfo(loggerCategory, `cacheDir: [${this.cacheDir}], profileDir: [${this.profileDir}]`);\n }\n\n /** This method must be called when an iTwin.js host is shut down. Raises [[onBeforeShutdown]] */\n public static async shutdown(this: void): Promise<void> {\n // Note: This method is set as a node listener where `this` is unbound. Call private method to\n // ensure `this` is correct. Don't combine these methods.\n return IModelHost.doShutdown();\n }\n\n private static async doShutdown() {\n if (!this._isValid)\n return;\n\n this._isValid = false;\n this.onBeforeShutdown.raiseEvent();\n\n this.configuration = undefined;\n this.tileStorage = undefined;\n\n this._appWorkspace?.close();\n this._appWorkspace = undefined;\n this._settingsSchemas = undefined;\n\n CloudSqlite.CloudCaches.destroy();\n process.removeListener(\"beforeExit\", IModelHost.shutdown);\n }\n\n /**\n * Add or update a property that should be included in a crash report.\n * @internal\n */\n public static setCrashReportProperty(name: string, value: string): void {\n IModelNative.platform.setCrashReportProperty(name, value);\n }\n\n /**\n * Remove a previously defined property so that will not be included in a crash report.\n * @internal\n */\n public static removeCrashReportProperty(name: string): void {\n IModelNative.platform.setCrashReportProperty(name, undefined);\n }\n\n /**\n * Get all properties that will be included in a crash report.\n * @internal\n */\n public static getCrashReportProperties(): CrashReportingConfigNameValuePair[] {\n return IModelNative.platform.getCrashReportProperties();\n }\n\n /** The directory where application assets may be found */\n public static get appAssetsDir(): string | undefined {\n return undefined !== IModelHost.configuration ? IModelHost.configuration.appAssetsDir : undefined;\n }\n\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileTreeProps should wait before returning a \"pending\" status.\n * @internal\n */\n public static get tileTreeRequestTimeout(): number {\n return IModelHost.configuration?.tileTreeRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\n }\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileContent should wait before returning a \"pending\" status.\n * @internal\n */\n public static get tileContentRequestTimeout(): number {\n return IModelHost.configuration?.tileContentRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\n }\n\n /** The backend will log when a tile took longer to load than this threshold in seconds. */\n public static get logTileLoadTimeThreshold(): number {\n return IModelHost.configuration?.logTileLoadTimeThreshold ?? IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\n }\n /** The backend will log when a tile is loaded with a size in bytes above this threshold. */\n public static get logTileSizeThreshold(): number {\n return IModelHost.configuration?.logTileSizeThreshold ?? IModelHostConfiguration.defaultLogTileSizeThreshold;\n }\n\n /** Whether external tile caching is active.\n * @internal\n */\n public static get usingExternalTileCache(): boolean {\n return undefined !== IModelHost.tileStorage;\n }\n\n /** Whether to restrict tile cache URLs by client IP address.\n * @internal\n */\n public static get restrictTileUrlsByClientIp(): boolean {\n return undefined !== IModelHost.configuration && (IModelHost.configuration.restrictTileUrlsByClientIp ? true : false);\n }\n\n /** Whether to compress cached tiles.\n * @internal\n */\n public static get compressCachedTiles(): boolean {\n return false !== IModelHost.configuration?.compressCachedTiles;\n }\n\n private static setupTileCache() {\n assert(undefined !== IModelHost.configuration);\n const config = IModelHost.configuration;\n const storage = config.tileCacheStorage;\n const credentials = config.tileCacheAzureCredentials;\n\n if (!storage && !credentials) {\n IModelNative.platform.setMaxTileCacheSize(config.maxTileCacheDbSize ?? IModelHostConfiguration.defaultMaxTileCacheDbSize);\n return;\n }\n\n IModelNative.platform.setMaxTileCacheSize(0);\n if (credentials) {\n if (storage)\n throw new IModelError(BentleyStatus.ERROR, \"Cannot use both Azure and custom cloud storage providers for tile cache.\");\n this.setupAzureTileCache(credentials);\n }\n if (storage)\n IModelHost.tileStorage = new TileStorage(storage);\n }\n\n private static setupAzureTileCache(credentials: AzureBlobStorageCredentials) {\n const config = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ServerSideStorage: {\n dependencyName: \"azure\",\n accountName: credentials.account,\n accountKey: credentials.accessKey,\n baseUrl: credentials.baseUrl ?? `https://${credentials.account}.blob.core.windows.net`,\n },\n };\n const ioc: Container = new Container();\n ioc.bind<DependenciesConfig>(ExtensionTypes.dependenciesConfig).toConstantValue(config);\n new AzureServerStorageBindings().register(ioc, config.ServerSideStorage);\n IModelHost.tileStorage = new TileStorage(ioc.get(ServerStorage));\n }\n\n /** @internal */\n public static computeSchemaChecksum(arg: { schemaXmlPath: string, referencePaths: string[], exactMatch?: boolean }): string {\n return IModelNative.platform.computeSchemaChecksum(arg);\n }\n}\n\n/** Information about the platform on which the app is running.\n * @public\n */\nexport class Platform {\n /** Get the name of the platform. */\n public static get platformName(): \"win32\" | \"linux\" | \"darwin\" | \"ios\" | \"android\" | \"uwp\" {\n return process.platform as any;\n }\n}\n\n/** Well known directories that may be used by the application.\n * @public\n */\nexport class KnownLocations {\n\n /** The directory where the imodeljs-native assets are stored. */\n public static get nativeAssetsDir(): LocalDirName {\n return IModelNative.platform.DgnDb.getAssetsDir();\n }\n\n /** The directory where the core-backend assets are stored. */\n public static get packageAssetsDir(): LocalDirName {\n return join(__dirname, \"assets\");\n }\n\n /** The temporary directory. */\n public static get tmpdir(): LocalDirName {\n return os.tmpdir();\n }\n}\n\n/** Extend this class to provide custom file name resolution behavior.\n * @note Only `tryResolveKey` and/or `tryResolveFileName` need to be overridden as the implementations of `resolveKey` and `resolveFileName` work for most purposes.\n * @see [[IModelHost.snapshotFileNameResolver]]\n * @public\n * @deprecated in 4.10. When opening a snapshot by file name, ensure to pass already resolved path. Using a key to open a snapshot is now deprecated.\n */\nexport abstract class FileNameResolver {\n /** Resolve a file name from the specified key.\n * @param _fileKey The key that identifies the file name in a `Map` or other similar data structure.\n * @returns The resolved file name or `undefined` if not found.\n */\n public tryResolveKey(_fileKey: string): string | undefined { return undefined; }\n /** Resolve a file name from the specified key.\n * @param fileKey The key that identifies the file name in a `Map` or other similar data structure.\n * @returns The resolved file name.\n * @throws [[IModelError]] if not found.\n */\n public resolveKey(fileKey: string): string {\n const resolvedFileName: string | undefined = this.tryResolveKey(fileKey);\n if (undefined === resolvedFileName) {\n throw new IModelError(IModelStatus.NotFound, `${fileKey} not resolved`);\n }\n return resolvedFileName;\n }\n /** Resolve the input file name, which may be a partial name, into a full path file name.\n * @param inFileName The partial file name.\n * @returns The resolved full path file name or `undefined` if not found.\n */\n public tryResolveFileName(inFileName: string): string | undefined { return inFileName; }\n /** Resolve the input file name, which may be a partial name, into a full path file name.\n * @param inFileName The partial file name.\n * @returns The resolved full path file name.\n * @throws [[IModelError]] if not found.\n */\n public resolveFileName(inFileName: string): string {\n const resolvedFileName: string | undefined = this.tryResolveFileName(inFileName);\n if (undefined === resolvedFileName) {\n throw new IModelError(IModelStatus.NotFound, `${inFileName} not resolved`);\n }\n return resolvedFileName;\n }\n}\n"]}
1
+ {"version":3,"file":"IModelHost.js","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yFAAyF;AACzF,sBAAoB,CAAC,mCAAmC;AAExD,8DAA6E;AAC7E,yBAAyB;AACzB,4BAA0B,CAAC,yJAAyJ;AACpL,8DAAyD;AACzD,oEAAyF;AACzF,sDAA8J;AAC9J,oDAAkG;AAClG,sEAAyE;AACzE,oEAA2D;AAE3D,mEAAgE;AAChE,mDAAgD;AAChD,yDAAsD;AACtD,+CAA4C;AAC5C,iEAA8D;AAC9D,2DAAwD;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nC,CAAC;IAED,+BAA+B;IACxB,MAAM,KAAK,MAAM;QACtB,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC;CACF;AAhBD,wCAgBC;AAED;;;;;GAKG;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,CAAC;YACnC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,QAAQ,EAAE,GAAG,OAAO,eAAe,CAAC,CAAC;QAC1E,CAAC;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,CAAC;YACnC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,QAAQ,EAAE,GAAG,UAAU,eAAe,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAnCD,4CAmCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelHost\n */\n\n// To avoid circular load errors, the \"Element\" classes must be loaded before IModelHost.\nimport \"./IModelDb\"; // DO NOT REMOVE OR MOVE THIS LINE!\n\nimport { IModelNative, loadNativePlatform } from \"./internal/NativePlatform\";\nimport * as os from \"os\";\nimport \"reflect-metadata\"; // this has to be before @itwin/object-storage-* and @itwin/cloud-agnostic-core imports because those packages contain decorators that use this polyfill.\nimport { NativeLibrary } from \"@bentley/imodeljs-native\";\nimport { DependenciesConfig, Types as ExtensionTypes } from \"@itwin/cloud-agnostic-core\";\nimport { AccessToken, assert, BeEvent, BentleyStatus, DbResult, Guid, GuidString, IModelStatus, Logger, Mutable, ProcessDetector } from \"@itwin/core-bentley\";\nimport { AuthorizationClient, IModelError, LocalDirName, SessionProps } from \"@itwin/core-common\";\nimport { AzureServerStorageBindings } from \"@itwin/object-storage-azure\";\nimport { ServerStorage } from \"@itwin/object-storage-core\";\nimport { BackendHubAccess } from \"./BackendHubAccess\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { BisCoreSchema } from \"./BisCoreSchema\";\nimport { BriefcaseManager } from \"./BriefcaseManager\";\nimport { CloudSqlite } from \"./CloudSqlite\";\nimport { FunctionalSchema } from \"./domains/FunctionalSchema\";\nimport { GenericSchema } from \"./domains/GenericSchema\";\nimport { GeoCoordConfig } from \"./GeoCoordConfig\";\nimport { IModelJsFs } from \"./IModelJsFs\";\nimport { DevToolsRpcImpl } from \"./rpc-impl/DevToolsRpcImpl\";\nimport { IModelReadRpcImpl } from \"./rpc-impl/IModelReadRpcImpl\";\nimport { IModelTileRpcImpl } from \"./rpc-impl/IModelTileRpcImpl\";\nimport { SnapshotIModelRpcImpl } from \"./rpc-impl/SnapshotIModelRpcImpl\";\nimport { initializeRpcBackend } from \"./RpcBackend\";\nimport { TileStorage } from \"./TileStorage\";\nimport { SettingsContainer, SettingsPriority } from \"./workspace/Settings\";\nimport { SettingsSchemas } from \"./workspace/SettingsSchemas\";\nimport { Workspace, WorkspaceOpts } from \"./workspace/Workspace\";\nimport { Container } from \"inversify\";\nimport { join, normalize as normalizeDir } from \"path\";\nimport { constructWorkspace, OwnedWorkspace } from \"./internal/workspace/WorkspaceImpl\";\nimport { SettingsImpl } from \"./internal/workspace/SettingsImpl\";\nimport { constructSettingsSchemas } from \"./internal/workspace/SettingsSchemasImpl\";\n\nconst loggerCategory = BackendLoggerCategory.IModelHost;\n\n// cspell:ignore nodereport fatalerror apicall alicloud rpcs inversify\n\n/** @internal */\nexport interface CrashReportingConfigNameValuePair {\n name: string;\n value: string;\n}\n\n/** Configuration of the crash-reporting system.\n * @internal\n */\nexport interface CrashReportingConfig {\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. */\n crashDir: string;\n /** max # .dmp files that may exist in crashDir. The default is 50. */\n maxDumpsInDir?: number;\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. */\n enableCrashDumps?: boolean;\n /** If enableCrashDumps is true, do you want a full-memory dump? Defaults to false. */\n wantFullMemoryDumps?: boolean;\n /** Enable Node.js crash reporting? If so, report files will be generated in the event of an unhandled exception or fatal error and written to crashDir. The default is false. */\n enableNodeReport?: boolean;\n /** Additional name, value pairs to write to iModelJsNativeCrash*.properties.txt file in the event of a crash. */\n params?: CrashReportingConfigNameValuePair[];\n /** Run this .js file to process .dmp and Node.js crash reporting .json files in the event of a crash.\n * This script will be executed with a single command-line parameter: the name of the dump or Node.js report file.\n * In the case of a dump file, there will be a second file with the same basename and the extension \".properties.txt\".\n * Since it runs in a separate process, this script will have no access to the Javascript\n * context of the exiting backend. No default.\n */\n dumpProcessorScriptFileName?: string;\n /** Upload crash dump and node-reports to Bentley's crash-reporting service? Defaults to false */\n uploadToBentley?: boolean;\n}\n\n/** @beta */\nexport interface AzureBlobStorageCredentials {\n account: string;\n accessKey: string;\n baseUrl?: string;\n}\n\n/**\n * Options for [[IModelHost.startup]]\n * @public\n */\nexport interface IModelHostOptions {\n /**\n * The name of the *Profile* subdirectory of [[cacheDir]] for this process. If not present, \"default\" is used.\n * @see [[IModelHost.profileName]]\n * @beta\n */\n profileName?: string;\n\n /**\n * Root of the directory holding all the files that iTwin.js caches\n * - If not specified at startup a platform specific default is used -\n * - Windows: $(HOMEDIR)/AppData/Local/iModelJs/\n * - Mac/iOS: $(HOMEDIR)/Library/Caches/iModelJs/\n * - Linux: $(HOMEDIR)/.cache/iModelJs/\n * where $(HOMEDIR) is documented [here](https://nodejs.org/api/os.html#os_os_homedir)\n * - if specified, ensure it is set to a folder with read/write access.\n * @see [[IModelHost.cacheDir]] for the value it's set to after startup\n */\n cacheDir?: LocalDirName;\n\n /** The directory where application assets are found. */\n appAssetsDir?: LocalDirName;\n\n /**\n * Options for creating the [[IModelHost.appWorkspace]]\n * @beta\n */\n workspace?: WorkspaceOpts;\n\n /**\n * The kind of iModel hub server to use.\n * @internal\n */\n hubAccess?: BackendHubAccess;\n\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.\n * @beta\n */\n tileCacheAzureCredentials?: AzureBlobStorageCredentials;\n\n /**\n * @beta\n * @note A reference implementation is set for AzureServerStorage from @itwin/object-storage-azure if [[tileCacheAzureCredentials]] property is set. To supply a different implementation for any service provider (such as AWS),\n * set this property with a custom ServerStorage.\n */\n tileCacheStorage?: ServerStorage;\n\n /** The maximum size in bytes to which a local sqlite database used for caching tiles can grow before it is purged of least-recently-used tiles.\n * The local cache is used only if an external cache has not been configured via [[tileCacheStorage]], and [[tileCacheAzureCredentials]].\n * Defaults to 1 GB. Must be an unsigned integer. A value of zero disables the local cache entirely.\n * @beta\n */\n maxTileCacheDbSize?: number;\n\n /** Whether to restrict tile cache URLs by client IP address (if available).\n * @beta\n */\n restrictTileUrlsByClientIp?: boolean;\n\n /** Whether to enable OpenTelemetry tracing.\n * Defaults to `false`.\n */\n enableOpenTelemetry?: boolean;\n\n /** Whether to compress cached tiles.\n * Defaults to `true`.\n */\n compressCachedTiles?: boolean;\n\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a \"pending\" status.\n * @internal\n */\n tileTreeRequestTimeout?: number;\n\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a \"pending\" status.\n * @internal\n */\n tileContentRequestTimeout?: number;\n\n /** The backend will log when a tile took longer to load than this threshold in seconds.\n * @internal\n */\n logTileLoadTimeThreshold?: number;\n\n /** The backend will log when a tile is loaded with a size in bytes above this threshold.\n * @internal\n */\n logTileSizeThreshold?: number;\n\n /** Crash-reporting configuration\n * @internal\n */\n crashReportingConfig?: CrashReportingConfig;\n\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\n authorizationClient?: AuthorizationClient;\n\n /**\n * Automatically enable shared channel when opening iModels for read/write (see [Working With Channels]($docs/learning/backend/Channel.md)).\n * If not present, defaults to `true` for backwards compatibility. This means that the shared channel may be edited by default. Generally\n * that is undesirable because it allows applications to \"accidentally\" modify data it shouldn't be allowed to modify. Unfortunately the\n * previous versions of iTwin.js allowed it so this is necessary so they won't break.\n * Will be changed to default to `false` in 5.0.\n */\n allowSharedChannel?: boolean;\n\n}\n\n/** Configuration of core-backend.\n * @public\n */\nexport class IModelHostConfiguration implements IModelHostOptions {\n public static defaultTileRequestTimeout = 20 * 1000;\n public static defaultLogTileLoadTimeThreshold = 40;\n public static defaultLogTileSizeThreshold = 20 * 1000000;\n /** @internal */\n public static defaultMaxTileCacheDbSize = 1024 * 1024 * 1024;\n public appAssetsDir?: LocalDirName;\n public cacheDir?: LocalDirName;\n\n /** @beta */\n public workspace?: WorkspaceOpts;\n /** @internal */\n public hubAccess?: BackendHubAccess;\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\n public authorizationClient?: AuthorizationClient;\n /** @beta */\n public restrictTileUrlsByClientIp?: boolean;\n public compressCachedTiles?: boolean;\n /** @beta */\n public tileCacheAzureCredentials?: AzureBlobStorageCredentials;\n /** @internal */\n public tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\n /** @internal */\n public tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\n /** @internal */\n public logTileLoadTimeThreshold = IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\n /** @internal */\n public logTileSizeThreshold = IModelHostConfiguration.defaultLogTileSizeThreshold;\n /** @internal */\n public crashReportingConfig?: CrashReportingConfig;\n}\n\n/**\n * Settings for `IModelHost.appWorkspace`.\n * @note this includes the default dictionary from the SettingsSpecRegistry\n */\nclass ApplicationSettings extends SettingsImpl {\n private _remove?: VoidFunction;\n protected override verifyPriority(priority: SettingsPriority) {\n if (priority > SettingsPriority.application) // only application or lower may appear in ApplicationSettings\n throw new Error(\"Use IModelSettings\");\n }\n private updateDefaults() {\n const defaults: SettingsContainer = {};\n for (const [schemaName, val] of IModelHost.settingsSchemas.settingDefs) {\n if (val.default)\n defaults[schemaName] = val.default;\n }\n this.addDictionary({ name: \"_default_\", priority: 0 }, defaults);\n }\n\n public constructor() {\n super();\n this._remove = IModelHost.settingsSchemas.onSchemaChanged.addListener(() => this.updateDefaults());\n this.updateDefaults();\n }\n\n public override close() {\n if (this._remove) {\n this._remove();\n this._remove = undefined;\n }\n }\n}\n\nconst definedInStartup = <T>(obj: T | undefined): T => {\n if (obj === undefined)\n throw new Error(\"IModelHost.startup must be called first\");\n return obj;\n};\n\n/** IModelHost initializes ($backend) and captures its configuration. A backend must call [[IModelHost.startup]] before using any backend classes.\n * See [the learning article]($docs/learning/backend/IModelHost.md)\n * @public\n */\nexport class IModelHost {\n private constructor() { }\n\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\n public static authorizationClient?: AuthorizationClient;\n\n public static backendVersion = \"\";\n private static _profileName: string;\n private static _cacheDir = \"\";\n private static _settingsSchemas?: SettingsSchemas;\n private static _appWorkspace?: OwnedWorkspace;\n\n public static configuration?: IModelHostOptions;\n\n /**\n * The name of the *Profile* directory (a subdirectory of \"[[cacheDir]]/profiles/\") for this process.\n *\n * The *Profile* directory is used to cache data that is specific to a type-of-usage of the iTwin.js library.\n * It is important that information in the profile cache be consistent but isolated across sessions (i.e.\n * data for a profile is maintained between runs, but each profile is completely independent and\n * unaffected by the presence ot use of others.)\n * @note **Only one process at a time may be using a given profile**, and an exception will be thrown by [[startup]]\n * if a second process attempts to use the same profile.\n * @beta\n */\n public static get profileName(): string {\n return this._profileName;\n }\n\n /** The full path of the Profile directory.\n * @see [[profileName]]\n * @beta\n */\n public static get profileDir(): LocalDirName {\n return join(this._cacheDir, \"profiles\", this._profileName);\n }\n\n /** Event raised during startup to allow loading settings data */\n public static readonly onWorkspaceStartup = new BeEvent<() => void>();\n\n /** Event raised just after the backend IModelHost was started */\n public static readonly onAfterStartup = new BeEvent<() => void>();\n\n /** Event raised just before the backend IModelHost is to be shut down */\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\n\n /** @internal */\n public static readonly session: Mutable<SessionProps> = { applicationId: \"2686\", applicationVersion: \"1.0.0\", sessionId: \"\" };\n\n /** A uniqueId for this session */\n public static get sessionId() { return this.session.sessionId; }\n public static set sessionId(id: GuidString) { this.session.sessionId = id; }\n\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. */\n public static get applicationId() { return this.session.applicationId; }\n public static set applicationId(id: string) { this.session.applicationId = id; }\n\n /** The version of this application - needs to be set if is an agent application. The applicationVersion will otherwise originate at the frontend. */\n public static get applicationVersion() { return this.session.applicationVersion; }\n public static set applicationVersion(version: string) { this.session.applicationVersion = version; }\n\n /** A string that can identify the current user to other users when collaborating. */\n public static userMoniker = \"unknown\";\n\n /** Root directory holding files that iTwin.js caches */\n public static get cacheDir(): LocalDirName { return this._cacheDir; }\n\n /** The application [[Workspace]] for this `IModelHost`\n * @note this `Workspace` only holds [[WorkspaceContainer]]s and [[Settings]] scoped to the currently loaded application(s).\n * All organization, iTwin, and iModel based containers or settings must be accessed through [[IModelDb.workspace]] and\n * attempting to add them to this Workspace will fail.\n * @beta\n */\n public static get appWorkspace(): Workspace { return definedInStartup(this._appWorkspace); }\n\n /** The registry of schemas describing the [[Setting]]s for the application session.\n * Applications should register their schemas via methods like [[SettingsSchemas.addGroup]].\n * @beta\n */\n public static get settingsSchemas(): SettingsSchemas { return definedInStartup(this._settingsSchemas); }\n\n /** The optional [[FileNameResolver]] that resolves keys and partial file names for snapshot iModels.\n * @deprecated in 4.10. When opening a snapshot by file name, ensure to pass already resolved path. Using a key to open a snapshot is now deprecated.\n */\n public static snapshotFileNameResolver?: FileNameResolver; // eslint-disable-line @typescript-eslint/no-deprecated\n\n /** Get the current access token for this IModelHost, or a blank string if none is available.\n * @note for web backends, this will *always* return a blank string because the backend itself has no token (but never needs one either.)\n * For all IpcHosts, where this backend is servicing a single frontend, this will be the user's token. For ElectronHost, the backend\n * obtains the token and forwards it to the frontend.\n * @note accessTokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\n * returned by this method may change over time throughout the course of a session.\n */\n public static async getAccessToken(): Promise<AccessToken> {\n try {\n return (await IModelHost.authorizationClient?.getAccessToken()) ?? \"\";\n } catch {\n return \"\";\n }\n }\n\n private static loadNative(options: IModelHostOptions) {\n loadNativePlatform();\n\n if (options.crashReportingConfig && options.crashReportingConfig.crashDir && !ProcessDetector.isElectronAppBackend && !ProcessDetector.isMobileAppBackend) {\n IModelNative.platform.setCrashReporting(options.crashReportingConfig);\n\n Logger.logTrace(loggerCategory, \"Configured crash reporting\", {\n enableCrashDumps: options.crashReportingConfig?.enableCrashDumps,\n wantFullMemoryDumps: options.crashReportingConfig?.wantFullMemoryDumps,\n enableNodeReport: options.crashReportingConfig?.enableNodeReport,\n uploadToBentley: options.crashReportingConfig?.uploadToBentley,\n });\n\n if (options.crashReportingConfig.enableNodeReport) {\n if (process.report !== undefined) {\n process.report.reportOnFatalError = true;\n process.report.reportOnUncaughtException = true;\n process.report.directory = options.crashReportingConfig.crashDir;\n Logger.logTrace(loggerCategory, \"Configured Node.js crash reporting\");\n } else {\n Logger.logWarning(loggerCategory, \"Unable to configure Node.js crash reporting\");\n }\n }\n }\n }\n\n /** @internal */\n public static tileStorage?: TileStorage;\n\n private static _hubAccess?: BackendHubAccess;\n /** @internal */\n public static setHubAccess(hubAccess: BackendHubAccess | undefined) { this._hubAccess = hubAccess; }\n\n /** get the current hubAccess, if present.\n * @internal\n */\n public static getHubAccess(): BackendHubAccess | undefined { return this._hubAccess; }\n\n /** Provides access to the IModelHub for this IModelHost\n * @internal\n * @note If [[IModelHostOptions.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.\n * To determine whether one is present, use [[getHubAccess]].\n */\n public static get hubAccess(): BackendHubAccess {\n if (IModelHost._hubAccess === undefined)\n throw new IModelError(IModelStatus.BadRequest, \"No BackendHubAccess supplied in IModelHostOptions\");\n return IModelHost._hubAccess;\n }\n\n private static initializeWorkspace(configuration: IModelHostOptions) {\n const settingAssets = join(KnownLocations.packageAssetsDir, \"Settings\");\n this._settingsSchemas = constructSettingsSchemas();\n this._settingsSchemas.addDirectory(join(settingAssets, \"Schemas\"));\n this._appWorkspace = constructWorkspace(new ApplicationSettings(), configuration.workspace);\n\n // Create the CloudCache for Workspaces. This will fail if another process is already using the same profile.\n try {\n this.appWorkspace.getCloudCache();\n } catch (e: any) {\n throw (e.errorNumber === DbResult.BE_SQLITE_BUSY) ? new IModelError(DbResult.BE_SQLITE_BUSY, `Profile [${this.profileDir}] is already in use by another process`) : e;\n }\n\n this.appWorkspace.settings.addDirectory(settingAssets, SettingsPriority.defaults);\n\n GeoCoordConfig.onStartup();\n // allow applications to load their default settings\n this.onWorkspaceStartup.raiseEvent();\n }\n\n private static _isValid = false;\n\n /** true between a successful call to [[startup]] and before [[shutdown]] */\n public static get isValid() {\n return IModelHost._isValid;\n }\n\n /** This method must be called before any iTwin.js services are used.\n * @param options Host configuration data.\n * Raises [[onAfterStartup]].\n * @see [[shutdown]].\n */\n public static async startup(options?: IModelHostOptions): Promise<void> {\n if (this._isValid)\n return; // we're already initialized\n this._isValid = true;\n\n options = options ?? {};\n if (this.sessionId === \"\")\n this.sessionId = Guid.createValue();\n\n this.authorizationClient = options.authorizationClient;\n\n this.backendVersion = require(\"../../package.json\").version; // eslint-disable-line @typescript-eslint/no-require-imports\n initializeRpcBackend(options.enableOpenTelemetry);\n\n this.loadNative(options);\n this.setupCacheDir(options);\n this.initializeWorkspace(options);\n\n BriefcaseManager.initialize(join(this._cacheDir, \"imodels\"));\n\n [\n IModelReadRpcImpl,\n IModelTileRpcImpl,\n SnapshotIModelRpcImpl, // eslint-disable-line @typescript-eslint/no-deprecated\n DevToolsRpcImpl,\n ].forEach((rpc) => rpc.register()); // register all of the RPC implementations\n\n [\n BisCoreSchema,\n GenericSchema,\n FunctionalSchema,\n ].forEach((schema) => schema.registerSchema()); // register all of the schemas\n\n if (undefined !== options.hubAccess)\n this._hubAccess = options.hubAccess;\n\n this.configuration = options;\n this.setupTileCache();\n\n process.once(\"beforeExit\", IModelHost.shutdown);\n this.onAfterStartup.raiseEvent();\n }\n\n private static setupCacheDir(configuration: IModelHostOptions) {\n this._cacheDir = normalizeDir(configuration.cacheDir ?? NativeLibrary.defaultCacheDir);\n IModelJsFs.recursiveMkDirSync(this._cacheDir);\n\n this._profileName = configuration.profileName ?? \"default\";\n Logger.logInfo(loggerCategory, `cacheDir: [${this.cacheDir}], profileDir: [${this.profileDir}]`);\n }\n\n /** This method must be called when an iTwin.js host is shut down. Raises [[onBeforeShutdown]] */\n public static async shutdown(this: void): Promise<void> {\n // Note: This method is set as a node listener where `this` is unbound. Call private method to\n // ensure `this` is correct. Don't combine these methods.\n return IModelHost.doShutdown();\n }\n\n private static async doShutdown() {\n if (!this._isValid)\n return;\n\n this._isValid = false;\n this.onBeforeShutdown.raiseEvent();\n\n this.configuration = undefined;\n this.tileStorage = undefined;\n\n this._appWorkspace?.close();\n this._appWorkspace = undefined;\n this._settingsSchemas = undefined;\n\n CloudSqlite.CloudCaches.destroy();\n process.removeListener(\"beforeExit\", IModelHost.shutdown);\n }\n\n /**\n * Add or update a property that should be included in a crash report.\n * @internal\n */\n public static setCrashReportProperty(name: string, value: string): void {\n IModelNative.platform.setCrashReportProperty(name, value);\n }\n\n /**\n * Remove a previously defined property so that will not be included in a crash report.\n * @internal\n */\n public static removeCrashReportProperty(name: string): void {\n IModelNative.platform.setCrashReportProperty(name, undefined);\n }\n\n /**\n * Get all properties that will be included in a crash report.\n * @internal\n */\n public static getCrashReportProperties(): CrashReportingConfigNameValuePair[] {\n return IModelNative.platform.getCrashReportProperties();\n }\n\n /** The directory where application assets may be found */\n public static get appAssetsDir(): string | undefined {\n return undefined !== IModelHost.configuration ? IModelHost.configuration.appAssetsDir : undefined;\n }\n\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileTreeProps should wait before returning a \"pending\" status.\n * @internal\n */\n public static get tileTreeRequestTimeout(): number {\n return IModelHost.configuration?.tileTreeRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\n }\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileContent should wait before returning a \"pending\" status.\n * @internal\n */\n public static get tileContentRequestTimeout(): number {\n return IModelHost.configuration?.tileContentRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\n }\n\n /** The backend will log when a tile took longer to load than this threshold in seconds. */\n public static get logTileLoadTimeThreshold(): number {\n return IModelHost.configuration?.logTileLoadTimeThreshold ?? IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\n }\n /** The backend will log when a tile is loaded with a size in bytes above this threshold. */\n public static get logTileSizeThreshold(): number {\n return IModelHost.configuration?.logTileSizeThreshold ?? IModelHostConfiguration.defaultLogTileSizeThreshold;\n }\n\n /** Whether external tile caching is active.\n * @internal\n */\n public static get usingExternalTileCache(): boolean {\n return undefined !== IModelHost.tileStorage;\n }\n\n /** Whether to restrict tile cache URLs by client IP address.\n * @internal\n */\n public static get restrictTileUrlsByClientIp(): boolean {\n return undefined !== IModelHost.configuration && (IModelHost.configuration.restrictTileUrlsByClientIp ? true : false);\n }\n\n /** Whether to compress cached tiles.\n * @internal\n */\n public static get compressCachedTiles(): boolean {\n return false !== IModelHost.configuration?.compressCachedTiles;\n }\n\n private static setupTileCache() {\n assert(undefined !== IModelHost.configuration);\n const config = IModelHost.configuration;\n const storage = config.tileCacheStorage;\n const credentials = config.tileCacheAzureCredentials;\n\n if (!storage && !credentials) {\n IModelNative.platform.setMaxTileCacheSize(config.maxTileCacheDbSize ?? IModelHostConfiguration.defaultMaxTileCacheDbSize);\n return;\n }\n\n IModelNative.platform.setMaxTileCacheSize(0);\n if (credentials) {\n if (storage)\n throw new IModelError(BentleyStatus.ERROR, \"Cannot use both Azure and custom cloud storage providers for tile cache.\");\n this.setupAzureTileCache(credentials);\n }\n if (storage)\n IModelHost.tileStorage = new TileStorage(storage);\n }\n\n private static setupAzureTileCache(credentials: AzureBlobStorageCredentials) {\n const config = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ServerSideStorage: {\n dependencyName: \"azure\",\n accountName: credentials.account,\n accountKey: credentials.accessKey,\n baseUrl: credentials.baseUrl ?? `https://${credentials.account}.blob.core.windows.net`,\n },\n };\n const ioc: Container = new Container();\n ioc.bind<DependenciesConfig>(ExtensionTypes.dependenciesConfig).toConstantValue(config);\n new AzureServerStorageBindings().register(ioc, config.ServerSideStorage);\n IModelHost.tileStorage = new TileStorage(ioc.get(ServerStorage));\n }\n\n /** @internal */\n public static computeSchemaChecksum(arg: { schemaXmlPath: string, referencePaths: string[], exactMatch?: boolean }): string {\n return IModelNative.platform.computeSchemaChecksum(arg);\n }\n}\n\n/** Information about the platform on which the app is running.\n * @public\n */\nexport class Platform {\n /** Get the name of the platform. */\n public static get platformName(): \"win32\" | \"linux\" | \"darwin\" | \"ios\" | \"android\" | \"uwp\" {\n return process.platform as any;\n }\n}\n\n/** Well known directories that may be used by the application.\n * @public\n */\nexport class KnownLocations {\n\n /** The directory where the imodeljs-native assets are stored. */\n public static get nativeAssetsDir(): LocalDirName {\n return IModelNative.platform.DgnDb.getAssetsDir();\n }\n\n /** The directory where the core-backend assets are stored. */\n public static get packageAssetsDir(): LocalDirName {\n return join(__dirname, \"assets\");\n }\n\n /** The temporary directory. */\n public static get tmpdir(): LocalDirName {\n return os.tmpdir();\n }\n}\n\n/** Extend this class to provide custom file name resolution behavior.\n * @note Only `tryResolveKey` and/or `tryResolveFileName` need to be overridden as the implementations of `resolveKey` and `resolveFileName` work for most purposes.\n * @see [[IModelHost.snapshotFileNameResolver]]\n * @public\n * @deprecated in 4.10. When opening a snapshot by file name, ensure to pass already resolved path. Using a key to open a snapshot is now deprecated.\n */\nexport abstract class FileNameResolver {\n /** Resolve a file name from the specified key.\n * @param _fileKey The key that identifies the file name in a `Map` or other similar data structure.\n * @returns The resolved file name or `undefined` if not found.\n */\n public tryResolveKey(_fileKey: string): string | undefined { return undefined; }\n /** Resolve a file name from the specified key.\n * @param fileKey The key that identifies the file name in a `Map` or other similar data structure.\n * @returns The resolved file name.\n * @throws [[IModelError]] if not found.\n */\n public resolveKey(fileKey: string): string {\n const resolvedFileName: string | undefined = this.tryResolveKey(fileKey);\n if (undefined === resolvedFileName) {\n throw new IModelError(IModelStatus.NotFound, `${fileKey} not resolved`);\n }\n return resolvedFileName;\n }\n /** Resolve the input file name, which may be a partial name, into a full path file name.\n * @param inFileName The partial file name.\n * @returns The resolved full path file name or `undefined` if not found.\n */\n public tryResolveFileName(inFileName: string): string | undefined { return inFileName; }\n /** Resolve the input file name, which may be a partial name, into a full path file name.\n * @param inFileName The partial file name.\n * @returns The resolved full path file name.\n * @throws [[IModelError]] if not found.\n */\n public resolveFileName(inFileName: string): string {\n const resolvedFileName: string | undefined = this.tryResolveFileName(inFileName);\n if (undefined === resolvedFileName) {\n throw new IModelError(IModelStatus.NotFound, `${inFileName} not resolved`);\n }\n return resolvedFileName;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IModelJsFs.d.ts","sourceRoot":"","sources":["../../src/IModelJsFs.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,qBAAa,eAAe;IAEjB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,WAAW,EAAE,MAAM;IACnB,WA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AAE,MAAM,GAAG,IAAI;IAE/C,0BAA0B;WACZ,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAE/C,uBAAuB;WACT,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,KAAK,GAAE,MAAY,GAAG,IAAI;IAEnG,wBAAwB;WACV,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAEjE,4BAA4B;WACd,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI;IAEnE,6JAA6J;WAC/I,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAErD,gBAAgB;WACF,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAE7D,kEAAkE;IAClE,OAAO,CAAC,MAAM,CAAC,cAAc;IAS7B,oCAAoC;WACtB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAiBtE;;;;;OAKG;WACW,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAc3E;;;;OAIG;WACW,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI;IAkBnG,uEAAuE;WACzD,kBAAkB,CAAC,OAAO,EAAE,MAAM;IAehD,sCAAsC;WACxB,YAAY,CAAC,OAAO,EAAE,MAAM;CAc3C"}
@@ -118,7 +118,14 @@ class IModelJsFs {
118
118
  const parentPath = path.dirname(dirPath);
119
119
  if (parentPath !== dirPath)
120
120
  IModelJsFs.recursiveMkDirSync(parentPath);
121
- IModelJsFs.mkdirSync(dirPath);
121
+ try {
122
+ IModelJsFs.mkdirSync(dirPath);
123
+ }
124
+ catch (err) {
125
+ // Ignore the error if the folder has been created since the existence check
126
+ if (err?.code !== "EEXIST")
127
+ throw err;
128
+ }
122
129
  }
123
130
  /** Remove a directory, recursively */
124
131
  static purgeDirSync(dirPath) {
@@ -1 +1 @@
1
- {"version":3,"file":"IModelJsFs.js","sourceRoot":"","sources":["../../src/IModelJsFs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,uBAAuB;AAEvB,+BAA+B;AAC/B,6BAA6B;AAE7B,uDAAuD;AACvD;;GAEG;AACH,MAAa,eAAe;IAC1B,YACS,IAAY,EACZ,OAAe,EACf,OAAe,EACf,WAAmB,EACnB,WAAoB,EACpB,MAAe,EACf,QAAiB,EACjB,cAAuB,EACvB,UAAmB;QARnB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAQ;QACf,gBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAW,GAAX,WAAW,CAAS;QACpB,WAAM,GAAN,MAAM,CAAS;QACf,aAAQ,GAAR,QAAQ,CAAS;QACjB,mBAAc,GAAd,cAAc,CAAS;QACvB,eAAU,GAAV,UAAU,CAAS;IACxB,CAAC;CACN;AAZD,0CAYC;AAED;;GAEG;AACH,MAAa,UAAU;IAErB,oCAAoC;IAC7B,MAAM,CAAC,UAAU,CAAC,QAAgB,IAAa,OAAO,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEvF,qBAAqB;IACd,MAAM,CAAC,UAAU,CAAC,QAAgB,IAAU,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE7E,mDAAmD;IAC5C,MAAM,CAAC,UAAU,CAAC,QAAgB,IAAU,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE7E,0BAA0B;IACnB,MAAM,CAAC,SAAS,CAAC,QAAgB,IAAU,EA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;iBAAM,CAAC;gBACN,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAhID,gCAgIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Portability\n */\n\n// cspell: ignore wflag\n\nimport * as fs from \"fs-extra\";\nimport * as path from \"path\";\n\n/* TODO: define File Mode Constants: S_IWUSR, et al. */\n/** Information about a file. See [[IModelJsFs.lstatSync]]\n * @public\n */\nexport class IModelJsFsStats {\n constructor(\n public size: number,\n public atimeMs: number,\n public mtimeMs: number,\n public birthtimeMs: number,\n public isDirectory: boolean,\n public isFile: boolean,\n public isSocket: boolean,\n public isSymbolicLink: boolean,\n public isReadOnly: boolean,\n ) { }\n}\n\n/** File system operations that are defined on all platforms. See also [[Platform]] and [[KnownLocations]]\n * @public\n */\nexport class IModelJsFs {\n\n /** Does file or directory exist? */\n public static existsSync(pathname: string): boolean { return fs.existsSync(pathname); }\n\n /** Delete a file. */\n public static unlinkSync(pathname: string): void { fs.unlinkSync(pathname); }\n\n /** Delete a file or remove a directory (rm -r). */\n public static removeSync(pathname: string): void { fs.removeSync(pathname); }\n\n /** Create a directory. */\n public static mkdirSync(pathname: string): void { fs.mkdirSync(pathname); }\n\n /** Remove a directory. */\n public static rmdirSync(pathname: string): void { fs.rmdirSync(pathname); }\n\n /** Write to a file. */\n public static writeFileSync(pathname: string, data: string | Uint8Array, wflag: string = \"w\"): void { fs.writeFileSync(pathname, data, { flag: wflag }); }\n\n /** Append to a file. */\n public static appendFileSync(pathname: string, str: string): void { fs.appendFileSync(pathname, str); }\n\n /** Make a copy of a file */\n public static copySync(src: string, dest: string, opts?: any): void { fs.copySync(src, dest, opts); }\n\n /** Gets the file and directory names in the specified directory. Excludes \".\" and \"..\". Returns an empty array if the specified directory does not exist. */\n public static readdirSync(pathname: string): string[] { return fs.existsSync(pathname) ? fs.readdirSync(pathname) : []; }\n\n /** Read file */\n public static readFileSync(pathname: string): string | Buffer { return fs.readFileSync(pathname); }\n\n /** Test if the current user has permission to write to a file. */\n private static isFileWritable(pathname: string): boolean {\n try {\n fs.accessSync(pathname, fs.constants.W_OK);\n return true;\n } catch {\n return false;\n }\n }\n\n /** Get information about a file. */\n public static lstatSync(pathname: string): IModelJsFsStats | undefined {\n const stats = fs.lstatSync(pathname);\n if (stats === undefined)\n return undefined;\n\n return new IModelJsFsStats(\n stats.size,\n stats.atime.getTime(),\n stats.mtime.getTime(),\n stats.birthtime.getTime(),\n stats.isDirectory(),\n stats.isFile(),\n stats.isSocket(),\n stats.isSymbolicLink(),\n !IModelJsFs.isFileWritable(pathname));\n }\n\n /**\n * Finds files recursively based on a pattern\n * @param rootDir Directory from where to start searching for files.\n * @param pattern A Regex that would be match to basename of files including extension\n * @returns list of file that match the pattern.\n */\n public static recursiveFindSync(rootDir: string, pattern: RegExp): string[] {\n const files: string[] = [];\n IModelJsFs.walkDirSync(rootDir, (pathname: string, isDir: boolean) => {\n if (!isDir) {\n const fileName = path.basename(pathname);\n if (pattern.test(fileName)) {\n files.push(pathname);\n }\n }\n return true;\n });\n return files;\n }\n\n /**\n * Walks a directory in breadth first fashion\n * @param rootDir directory from where the traversal starts\n * @param cb callback that would be called with full path of file or directory\n */\n public static walkDirSync(rootDir: string, cb: (pathname: string, isDir: boolean) => boolean): void {\n const subDir = [];\n for (const childPath of IModelJsFs.readdirSync(rootDir)) {\n const fullPath = path.join(rootDir, childPath);\n const isDir = IModelJsFs.lstatSync(fullPath)?.isDirectory;\n if (!cb(fullPath, isDir ?? false)) {\n return;\n }\n // Need to check if the directory still exists in case the callback has deleted it.\n if (isDir && IModelJsFs.existsSync(fullPath)) {\n subDir.push(fullPath);\n }\n }\n subDir.forEach((v) => {\n IModelJsFs.walkDirSync(v, cb);\n });\n }\n\n /** Create a directory, recursively setting up the path as necessary */\n public static recursiveMkDirSync(dirPath: string) {\n if (IModelJsFs.existsSync(dirPath))\n return;\n const parentPath = path.dirname(dirPath);\n if (parentPath !== dirPath)\n IModelJsFs.recursiveMkDirSync(parentPath);\n IModelJsFs.mkdirSync(dirPath);\n }\n\n /** Remove a directory, recursively */\n public static purgeDirSync(dirPath: string) {\n if (!IModelJsFs.existsSync(dirPath))\n return;\n\n IModelJsFs.walkDirSync(dirPath, (pathName: string, isDir: boolean) => {\n if (isDir) {\n IModelJsFs.purgeDirSync(pathName);\n IModelJsFs.removeSync(pathName);\n } else {\n IModelJsFs.unlinkSync(pathName);\n }\n return true;\n });\n }\n}\n"]}
1
+ {"version":3,"file":"IModelJsFs.js","sourceRoot":"","sources":["../../src/IModelJsFs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,uBAAuB;AAEvB,+BAA+B;AAC/B,6BAA6B;AAE7B,uDAAuD;AACvD;;GAEG;AACH,MAAa,eAAe;IAC1B,YACS,IAAY,EACZ,OAAe,EACf,OAAe,EACf,WAAmB,EACnB,WAAoB,EACpB,MAAe,EACf,QAAiB,EACjB,cAAuB,EACvB,UAAmB;QARnB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAQ;QACf,gBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAW,GAAX,WAAW,CAAS;QACpB,WAAM,GAAN,MAAM,CAAS;QACf,aAAQ,GAAR,QAAQ,CAAS;QACjB,mBAAc,GAAd,cAAc,CAAS;QACvB,eAAU,GAAV,UAAU,CAAS;IACxB,CAAC;CACN;AAZD,0CAYC;AAED;;GAEG;AACH,MAAa,UAAU;IAErB,oCAAoC;IAC7B,MAAM,CAAC,UAAU,CAAC,QAAgB,IAAa,OAAO,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC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AC;YAClB,4EAA4E;YAC5E,IAAI,GAAG,EAAE,IAAI,KAAK,QAAQ;gBACxB,MAAM,GAAG,CAAC;QACd,CAAC;IACH,CAAC;IAED,sCAAsC;IAC/B,MAAM,CAAC,YAAY,CAAC,OAAe;QACxC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC;YACjC,OAAO;QAET,UAAU,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,QAAgB,EAAE,KAAc,EAAE,EAAE;YACnE,IAAI,KAAK,EAAE,CAAC;gBACV,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;gBAClC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtID,gCAsIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Portability\n */\n\n// cspell: ignore wflag\n\nimport * as fs from \"fs-extra\";\nimport * as path from \"path\";\n\n/* TODO: define File Mode Constants: S_IWUSR, et al. */\n/** Information about a file. See [[IModelJsFs.lstatSync]]\n * @public\n */\nexport class IModelJsFsStats {\n constructor(\n public size: number,\n public atimeMs: number,\n public mtimeMs: number,\n public birthtimeMs: number,\n public isDirectory: boolean,\n public isFile: boolean,\n public isSocket: boolean,\n public isSymbolicLink: boolean,\n public isReadOnly: boolean,\n ) { }\n}\n\n/** File system operations that are defined on all platforms. See also [[Platform]] and [[KnownLocations]]\n * @public\n */\nexport class IModelJsFs {\n\n /** Does file or directory exist? */\n public static existsSync(pathname: string): boolean { return fs.existsSync(pathname); }\n\n /** Delete a file. */\n public static unlinkSync(pathname: string): void { fs.unlinkSync(pathname); }\n\n /** Delete a file or remove a directory (rm -r). */\n public static removeSync(pathname: string): void { fs.removeSync(pathname); }\n\n /** Create a directory. */\n public static mkdirSync(pathname: string): void { fs.mkdirSync(pathname); }\n\n /** Remove a directory. */\n public static rmdirSync(pathname: string): void { fs.rmdirSync(pathname); }\n\n /** Write to a file. */\n public static writeFileSync(pathname: string, data: string | Uint8Array, wflag: string = \"w\"): void { fs.writeFileSync(pathname, data, { flag: wflag }); }\n\n /** Append to a file. */\n public static appendFileSync(pathname: string, str: string): void { fs.appendFileSync(pathname, str); }\n\n /** Make a copy of a file */\n public static copySync(src: string, dest: string, opts?: any): void { fs.copySync(src, dest, opts); }\n\n /** Gets the file and directory names in the specified directory. Excludes \".\" and \"..\". Returns an empty array if the specified directory does not exist. */\n public static readdirSync(pathname: string): string[] { return fs.existsSync(pathname) ? fs.readdirSync(pathname) : []; }\n\n /** Read file */\n public static readFileSync(pathname: string): string | Buffer { return fs.readFileSync(pathname); }\n\n /** Test if the current user has permission to write to a file. */\n private static isFileWritable(pathname: string): boolean {\n try {\n fs.accessSync(pathname, fs.constants.W_OK);\n return true;\n } catch {\n return false;\n }\n }\n\n /** Get information about a file. */\n public static lstatSync(pathname: string): IModelJsFsStats | undefined {\n const stats = fs.lstatSync(pathname);\n if (stats === undefined)\n return undefined;\n\n return new IModelJsFsStats(\n stats.size,\n stats.atime.getTime(),\n stats.mtime.getTime(),\n stats.birthtime.getTime(),\n stats.isDirectory(),\n stats.isFile(),\n stats.isSocket(),\n stats.isSymbolicLink(),\n !IModelJsFs.isFileWritable(pathname));\n }\n\n /**\n * Finds files recursively based on a pattern\n * @param rootDir Directory from where to start searching for files.\n * @param pattern A Regex that would be match to basename of files including extension\n * @returns list of file that match the pattern.\n */\n public static recursiveFindSync(rootDir: string, pattern: RegExp): string[] {\n const files: string[] = [];\n IModelJsFs.walkDirSync(rootDir, (pathname: string, isDir: boolean) => {\n if (!isDir) {\n const fileName = path.basename(pathname);\n if (pattern.test(fileName)) {\n files.push(pathname);\n }\n }\n return true;\n });\n return files;\n }\n\n /**\n * Walks a directory in breadth first fashion\n * @param rootDir directory from where the traversal starts\n * @param cb callback that would be called with full path of file or directory\n */\n public static walkDirSync(rootDir: string, cb: (pathname: string, isDir: boolean) => boolean): void {\n const subDir = [];\n for (const childPath of IModelJsFs.readdirSync(rootDir)) {\n const fullPath = path.join(rootDir, childPath);\n const isDir = IModelJsFs.lstatSync(fullPath)?.isDirectory;\n if (!cb(fullPath, isDir ?? false)) {\n return;\n }\n // Need to check if the directory still exists in case the callback has deleted it.\n if (isDir && IModelJsFs.existsSync(fullPath)) {\n subDir.push(fullPath);\n }\n }\n subDir.forEach((v) => {\n IModelJsFs.walkDirSync(v, cb);\n });\n }\n\n /** Create a directory, recursively setting up the path as necessary */\n public static recursiveMkDirSync(dirPath: string) {\n if (IModelJsFs.existsSync(dirPath))\n return;\n const parentPath = path.dirname(dirPath);\n if (parentPath !== dirPath)\n IModelJsFs.recursiveMkDirSync(parentPath);\n try {\n IModelJsFs.mkdirSync(dirPath);\n } catch (err: any) {\n // Ignore the error if the folder has been created since the existence check\n if (err?.code !== \"EEXIST\")\n throw err;\n }\n }\n\n /** Remove a directory, recursively */\n public static purgeDirSync(dirPath: string) {\n if (!IModelJsFs.existsSync(dirPath))\n return;\n\n IModelJsFs.walkDirSync(dirPath, (pathName: string, isDir: boolean) => {\n if (isDir) {\n IModelJsFs.purgeDirSync(pathName);\n IModelJsFs.removeSync(pathName);\n } else {\n IModelJsFs.unlinkSync(pathName);\n }\n return true;\n });\n }\n}\n"]}
@@ -23,6 +23,7 @@ const Symbols_1 = require("./internal/Symbols");
23
23
  * @public
24
24
  */
25
25
  class IpcHost {
26
+ static { this.noStack = false; }
26
27
  /** Get the implementation of the [IpcSocketBackend]($common) interface. */
27
28
  static get ipc() { return this._ipc; } // eslint-disable-line @typescript-eslint/no-non-null-assertion
28
29
  /** Determine whether Ipc is available for this backend. This will only be true if [[startup]] has been called on this class. */
@@ -98,7 +99,6 @@ class IpcHost {
98
99
  }
99
100
  }
100
101
  exports.IpcHost = IpcHost;
101
- IpcHost.noStack = false;
102
102
  /**
103
103
  * Base class for all implementations of an Ipc interface.
104
104
  *
@@ -233,7 +233,7 @@ class IpcAppHandler extends IpcHandler {
233
233
  return IModelDb_1.IModelDb.findByKey(key)[Symbols_1._nativeDb].getUndoString();
234
234
  }
235
235
  async getRedoString(key) {
236
- return IModelDb_1.IModelDb.findByKey(key)[Symbols_1._nativeDb].getUndoString();
236
+ return IModelDb_1.IModelDb.findByKey(key)[Symbols_1._nativeDb].getRedoString();
237
237
  }
238
238
  async pullChanges(key, toIndex, options) {
239
239
  const iModelDb = IModelDb_1.BriefcaseDb.findByKey(key);