@itwin/core-backend 5.3.0-dev.8 → 5.4.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -1
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +14 -0
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +11 -0
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +2 -2
- package/lib/cjs/DisplayStyle.d.ts.map +1 -1
- package/lib/cjs/DisplayStyle.js +4 -4
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.js +1 -1
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/Element.d.ts +2 -2
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +2 -2
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +15 -3
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +42 -5
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js +2 -2
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +1 -2
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +9 -17
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/Material.d.ts +1 -1
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +2 -2
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +5 -0
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +7 -0
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/TileStorage.d.ts +1 -1
- package/lib/cjs/TileStorage.d.ts.map +1 -1
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +8 -0
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +30 -2
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +1 -1
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +2 -2
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +4 -4
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.d.ts +5 -4
- package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.js +26 -11
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -1
- package/lib/cjs/internal/ElementLRUCache.js +2 -0
- package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
- package/lib/esm/BriefcaseManager.d.ts.map +1 -1
- package/lib/esm/BriefcaseManager.js +14 -0
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/CloudSqlite.d.ts +11 -0
- package/lib/esm/CloudSqlite.d.ts.map +1 -1
- package/lib/esm/CloudSqlite.js.map +1 -1
- package/lib/esm/DisplayStyle.d.ts +2 -2
- package/lib/esm/DisplayStyle.d.ts.map +1 -1
- package/lib/esm/DisplayStyle.js +4 -4
- package/lib/esm/DisplayStyle.js.map +1 -1
- package/lib/esm/ECDb.js +1 -1
- package/lib/esm/ECDb.js.map +1 -1
- package/lib/esm/Element.d.ts +2 -2
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +2 -2
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +15 -3
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +42 -5
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelElementCloneContext.d.ts +1 -1
- package/lib/esm/IModelElementCloneContext.d.ts.map +1 -1
- package/lib/esm/IModelElementCloneContext.js +2 -2
- package/lib/esm/IModelElementCloneContext.js.map +1 -1
- package/lib/esm/IModelHost.d.ts +1 -2
- package/lib/esm/IModelHost.d.ts.map +1 -1
- package/lib/esm/IModelHost.js +10 -18
- package/lib/esm/IModelHost.js.map +1 -1
- package/lib/esm/Material.d.ts +1 -1
- package/lib/esm/Material.d.ts.map +1 -1
- package/lib/esm/Material.js +2 -2
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Relationship.d.ts +5 -0
- package/lib/esm/Relationship.d.ts.map +1 -1
- package/lib/esm/Relationship.js +7 -0
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/TileStorage.d.ts +1 -1
- package/lib/esm/TileStorage.d.ts.map +1 -1
- package/lib/esm/TileStorage.js.map +1 -1
- package/lib/esm/TxnManager.d.ts +8 -0
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +30 -2
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewDefinition.d.ts +1 -1
- package/lib/esm/ViewDefinition.d.ts.map +1 -1
- package/lib/esm/ViewDefinition.js +2 -2
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js +4 -4
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.d.ts +5 -4
- package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.js +26 -11
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -1
- package/lib/esm/internal/ElementLRUCache.js +2 -0
- package/lib/esm/internal/ElementLRUCache.js.map +1 -1
- package/lib/esm/test/ElementDrivesElement.test.d.ts +93 -0
- package/lib/esm/test/ElementDrivesElement.test.d.ts.map +1 -0
- package/lib/esm/test/ElementDrivesElement.test.js +862 -0
- package/lib/esm/test/ElementDrivesElement.test.js.map +1 -0
- package/lib/esm/test/ElementLRUCache.test.js +19 -0
- package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
- package/lib/esm/test/IModelHost.test.js +17 -11
- package/lib/esm/test/IModelHost.test.js.map +1 -1
- package/lib/esm/test/annotations/Fields.test.js +44 -0
- package/lib/esm/test/annotations/Fields.test.js.map +1 -1
- package/lib/esm/test/annotations/TextAnnotation.test.js +71 -25
- package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js +2 -2
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlStatement.test.js +33 -2
- package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
- package/lib/esm/test/hubaccess/Rebase.test.js +169 -2
- package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
- package/lib/esm/test/imodel/Code.test.d.ts +2 -0
- package/lib/esm/test/imodel/Code.test.d.ts.map +1 -0
- package/lib/esm/test/imodel/Code.test.js +272 -0
- package/lib/esm/test/imodel/Code.test.js.map +1 -0
- package/lib/esm/test/imodel/IModel.test.js +144 -1
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +64 -55
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/DisplayStyle.test.js +6 -6
- package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
- package/lib/esm/test/standalone/ElementGraphics.test.js +75 -6
- package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
- package/lib/esm/test/standalone/RenderMaterialElement.test.js +4 -4
- package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
- package/lib/esm/test/standalone/TxnManager.test.js +33 -5
- package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
- package/package.json +16 -18
|
@@ -76,7 +76,7 @@ export declare class IModelElementCloneContext {
|
|
|
76
76
|
/** Clone the specified source Element into ElementProps for the target iModel.
|
|
77
77
|
* @internal
|
|
78
78
|
*/
|
|
79
|
-
cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps
|
|
79
|
+
cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): Promise<ElementProps>;
|
|
80
80
|
/**
|
|
81
81
|
* serialize state to a sqlite database at a given path
|
|
82
82
|
* assumes the database has not already had any context state serialized to it
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelElementCloneContext.d.ts","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAiC,YAAY,EAA4C,MAAM,oBAAoB,CAAC;AAC3H,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC;;GAEG;AACH,qBAAa,yBAAyB;IACpC,2BAA2B;IAC3B,SAAgB,QAAQ,EAAE,QAAQ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AI;IAMlF,uFAAuF;IAChF,iBAAiB,CAAC,mBAAmB,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,GAAG,IAAI;IAIxF,2FAA2F;IACpF,YAAY,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,GAAG,IAAI;IAIrE,8DAA8D;IACvD,aAAa,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI;IAIhD;;OAEG;IACI,oBAAoB,CAAC,QAAQ,EAAE,UAAU,GAAG,UAAU;IAO7D;;OAEG;IACI,mBAAmB,CAAC,eAAe,EAAE,UAAU,GAAG,UAAU;IAOnE;;;OAGG;IACI,iBAAiB,CAAC,mBAAmB,EAAE,UAAU,GAAG,IAAI;IAO/D,oEAAoE;IACpE,IAAW,oBAAoB,IAAI,OAAO,CAEzC;IAED,4DAA4D;IACrD,qBAAqB,CAAC,aAAa,EAAE,UAAU,GAAG,OAAO;IAIhE;;OAEG;IACI,UAAU,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI;IAKjD;;OAEG;IACI,cAAc,CAAC,gBAAgB,EAAE,UAAU,GAAG,IAAI;IAIzD;;OAEG;IACU,YAAY,CAAC,aAAa,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,cAAc,CAAC,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC;IA0B3H;;;;OAIG;IACI,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI;IAIxC;;;OAGG;IACI,eAAe,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI;CAG3C"}
|
|
@@ -124,7 +124,7 @@ export class IModelElementCloneContext {
|
|
|
124
124
|
/** Clone the specified source Element into ElementProps for the target iModel.
|
|
125
125
|
* @internal
|
|
126
126
|
*/
|
|
127
|
-
cloneElement(sourceElement, cloneOptions) {
|
|
127
|
+
async cloneElement(sourceElement, cloneOptions) {
|
|
128
128
|
const targetElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);
|
|
129
129
|
// Ensure that all NavigationProperties in targetElementProps have a defined value so "clearing" changes will be part of the JSON used for update
|
|
130
130
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
@@ -146,7 +146,7 @@ export class IModelElementCloneContext {
|
|
|
146
146
|
}
|
|
147
147
|
const jsClass = this.sourceDb.getJsClass(sourceElement.classFullName);
|
|
148
148
|
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
149
|
-
jsClass["onCloned"](this, sourceElement.toJSON(), targetElementProps);
|
|
149
|
+
await jsClass["onCloned"](this, sourceElement.toJSON(), targetElementProps);
|
|
150
150
|
return targetElementProps;
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelElementCloneContext.js","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,IAAI,EAAc,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,aAAa,EAA0B,MAAM,EAAoB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE3H,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,yBAAyB;IACpC,2BAA2B;IACX,QAAQ,CAAW;IACnC,2BAA2B;IACX,QAAQ,CAAW;IACnC,gCAAgC;IACxB,cAAc,CAA+B;IAErD;;;OAGG;IACH,YAAmB,QAAkB,EAAE,QAAmB;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,YAAY,CA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QACH,CAAC;QACD,yFAAyF;QACzF,IAAI,kBAAkB,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YACpG,kBAAkB,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAC/C,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAiB,aAAa,CAAC,aAAa,CAAC,CAAC;QACtF,2DAA2D;QAC3D,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC;QACtE,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,EAAY;QAC/B,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,EAAY;QACjC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IACrD,CAAC;CACF","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 */\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { Code, CodeScopeSpec, CodeSpec, ElementProps, IModel, PropertyMetaData, RelatedElement } from \"@itwin/core-common\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { SubCategory } from \"./Category\";\nimport { Element } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { SQLiteDb } from \"./SQLiteDb\";\nimport { _nativeDb } from \"./internal/Symbols\";\n\n/** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.\n * @beta\n */\nexport class IModelElementCloneContext {\n /** The source IModelDb. */\n public readonly sourceDb: IModelDb;\n /** The target IModelDb. */\n public readonly targetDb: IModelDb;\n /** The native import context */\n private _nativeContext: IModelJsNative.ImportContext;\n\n /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead\n * @param sourceDb The source IModelDb.\n * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.\n */\n public constructor(sourceDb: IModelDb, targetDb?: IModelDb) {\n this.sourceDb = sourceDb;\n this.targetDb = (undefined !== targetDb) ? targetDb : sourceDb;\n this._nativeContext = new IModelNative.platform.ImportContext(this.sourceDb[_nativeDb], this.targetDb[_nativeDb]);\n }\n\n /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */\n public async initialize() {\n }\n\n /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */\n public static async create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext> {\n const instance = new this(...args);\n await instance.initialize();\n return instance;\n }\n\n /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */\n public get isBetweenIModels(): boolean { return this.sourceDb !== this.targetDb; }\n\n /** Dispose any native resources associated with this IModelElementCloneContext. */\n public [Symbol.dispose](): void { this._nativeContext.dispose(); }\n\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /** Debugging aid that dumps the Id remapping details and other information to the specified output file.\n * @internal\n */\n public dump(outputFileName: string): void { this._nativeContext.dump(outputFileName); }\n\n /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).\n * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.\n * @param targetCodeSpecName The name of the CodeSpec from the target iModel.\n * @throws [[IModelError]] if either CodeSpec could not be found.\n */\n public remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void {\n const sourceCodeSpec: CodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);\n const targetCodeSpec: CodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);\n this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);\n }\n\n /** Add a rule that remaps the specified source class to the specified target class. */\n public remapElementClass(sourceClassFullName: string, targetClassFullName: string): void {\n this._nativeContext.addClass(sourceClassFullName, targetClassFullName);\n }\n\n /** Add a rule that remaps the specified source Element to the specified target Element. */\n public remapElement(sourceId: Id64String, targetId: Id64String): void {\n this._nativeContext.addElementId(sourceId, targetId);\n }\n\n /** Remove a rule that remaps the specified source Element. */\n public removeElement(sourceId: Id64String): void {\n this._nativeContext.removeElementId(sourceId);\n }\n\n /** Look up a target CodeSpecId from the source CodeSpecId.\n * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.\n */\n public findTargetCodeSpecId(sourceId: Id64String): Id64String {\n if (Id64.invalid === sourceId) {\n return Id64.invalid;\n }\n return this._nativeContext.findCodeSpecId(sourceId);\n }\n\n /** Look up a target ElementId from the source ElementId.\n * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.\n */\n public findTargetElementId(sourceElementId: Id64String): Id64String {\n if (Id64.invalid === sourceElementId) {\n return Id64.invalid;\n }\n return this._nativeContext.findElementId(sourceElementId);\n }\n\n /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.\n * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.\n * @see [SubCategory.isDefaultSubCategory]($backend)\n */\n public filterSubCategory(sourceSubCategoryId: Id64String): void {\n const sourceSubCategory = this.sourceDb.elements.tryGetElement<SubCategory>(sourceSubCategoryId, SubCategory);\n if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {\n this._nativeContext.filterSubCategoryId(sourceSubCategoryId);\n }\n }\n\n /** Returns `true` if there are any SubCategories being filtered. */\n public get hasSubCategoryFilter(): boolean {\n return this._nativeContext.hasSubCategoryFilter();\n }\n\n /** Returns `true` if this SubCategory is being filtered. */\n public isSubCategoryFiltered(subCategoryId: Id64String): boolean {\n return this._nativeContext.isSubCategoryFiltered(subCategoryId);\n }\n\n /** Import the specified font from the source iModel into the target iModel.\n * @internal\n */\n public importFont(sourceFontNumber: number): void {\n this.targetDb.clearFontMap(); // so it will be reloaded with new font info\n this._nativeContext.importFont(sourceFontNumber);\n }\n\n /** Import a single CodeSpec from the source iModel into the target iModel.\n * @internal\n */\n public importCodeSpec(sourceCodeSpecId: Id64String): void {\n this._nativeContext.importCodeSpec(sourceCodeSpecId);\n }\n\n /** Clone the specified source Element into ElementProps for the target iModel.\n * @internal\n */\n public cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps {\n const targetElementProps: ElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);\n // Ensure that all NavigationProperties in targetElementProps have a defined value so \"clearing\" changes will be part of the JSON used for update\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n sourceElement.forEachProperty((propertyName: string, meta: PropertyMetaData) => {\n if ((meta.isNavigation) && (undefined === (sourceElement as any)[propertyName])) {\n (targetElementProps as any)[propertyName] = RelatedElement.none;\n }\n }, false); // exclude custom because C++ has already handled them\n if (this.isBetweenIModels) {\n // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels\n targetElementProps.federationGuid = sourceElement.federationGuid;\n if (CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {\n targetElementProps.code.scope = IModel.rootSubjectId;\n }\n }\n // unlike other references, code cannot be null. If it is null, use an empty code instead\n if (targetElementProps.code.scope === Id64.invalid || targetElementProps.code.spec === Id64.invalid) {\n targetElementProps.code = Code.createEmpty();\n }\n const jsClass = this.sourceDb.getJsClass<typeof Element>(sourceElement.classFullName);\n // eslint-disable-next-line @typescript-eslint/dot-notation\n jsClass[\"onCloned\"](this, sourceElement.toJSON(), targetElementProps);\n return targetElementProps;\n }\n\n /**\n * serialize state to a sqlite database at a given path\n * assumes the database has not already had any context state serialized to it\n * @internal\n */\n public saveStateToDb(db: SQLiteDb): void {\n this._nativeContext.saveStateToDb(db[_nativeDb]);\n }\n\n /**\n * load state from a sqlite database at a given path\n * @internal\n */\n public loadStateFromDb(db: SQLiteDb): void {\n this._nativeContext.loadStateFromDb(db[_nativeDb]);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IModelElementCloneContext.js","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,IAAI,EAAc,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,aAAa,EAA0B,MAAM,EAAoB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE3H,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,yBAAyB;IACpC,2BAA2B;IACX,QAAQ,CAAW;IACnC,2BAA2B;IACX,QAAQ,CAAW;IACnC,gCAAgC;IACxB,cAAc,CAA+B;IAErD;;;OAGG;IACH,YAAmB,QAAkB,EAAE,QAAmB;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,YAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IACpH,CAAC;IAED,0HAA0H;IACnH,KAAK,CAAC,UAAU;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,CAAC;YACpG,kBAAkB,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAC/C,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAiB,aAAa,CAAC,aAAa,CAAC,CAAC;QACtF,2DAA2D;QAC3D,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC;QAC5E,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,EAAY;QAC/B,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,EAAY;QACjC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IACrD,CAAC;CACF","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 */\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { Code, CodeScopeSpec, CodeSpec, ElementProps, IModel, PropertyMetaData, RelatedElement } from \"@itwin/core-common\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { SubCategory } from \"./Category\";\nimport { Element } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { SQLiteDb } from \"./SQLiteDb\";\nimport { _nativeDb } from \"./internal/Symbols\";\n\n/** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.\n * @beta\n */\nexport class IModelElementCloneContext {\n /** The source IModelDb. */\n public readonly sourceDb: IModelDb;\n /** The target IModelDb. */\n public readonly targetDb: IModelDb;\n /** The native import context */\n private _nativeContext: IModelJsNative.ImportContext;\n\n /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead\n * @param sourceDb The source IModelDb.\n * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.\n */\n public constructor(sourceDb: IModelDb, targetDb?: IModelDb) {\n this.sourceDb = sourceDb;\n this.targetDb = (undefined !== targetDb) ? targetDb : sourceDb;\n this._nativeContext = new IModelNative.platform.ImportContext(this.sourceDb[_nativeDb], this.targetDb[_nativeDb]);\n }\n\n /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */\n public async initialize() {\n }\n\n /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */\n public static async create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext> {\n const instance = new this(...args);\n await instance.initialize();\n return instance;\n }\n\n /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */\n public get isBetweenIModels(): boolean { return this.sourceDb !== this.targetDb; }\n\n /** Dispose any native resources associated with this IModelElementCloneContext. */\n public [Symbol.dispose](): void { this._nativeContext.dispose(); }\n\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /** Debugging aid that dumps the Id remapping details and other information to the specified output file.\n * @internal\n */\n public dump(outputFileName: string): void { this._nativeContext.dump(outputFileName); }\n\n /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).\n * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.\n * @param targetCodeSpecName The name of the CodeSpec from the target iModel.\n * @throws [[IModelError]] if either CodeSpec could not be found.\n */\n public remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void {\n const sourceCodeSpec: CodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);\n const targetCodeSpec: CodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);\n this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);\n }\n\n /** Add a rule that remaps the specified source class to the specified target class. */\n public remapElementClass(sourceClassFullName: string, targetClassFullName: string): void {\n this._nativeContext.addClass(sourceClassFullName, targetClassFullName);\n }\n\n /** Add a rule that remaps the specified source Element to the specified target Element. */\n public remapElement(sourceId: Id64String, targetId: Id64String): void {\n this._nativeContext.addElementId(sourceId, targetId);\n }\n\n /** Remove a rule that remaps the specified source Element. */\n public removeElement(sourceId: Id64String): void {\n this._nativeContext.removeElementId(sourceId);\n }\n\n /** Look up a target CodeSpecId from the source CodeSpecId.\n * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.\n */\n public findTargetCodeSpecId(sourceId: Id64String): Id64String {\n if (Id64.invalid === sourceId) {\n return Id64.invalid;\n }\n return this._nativeContext.findCodeSpecId(sourceId);\n }\n\n /** Look up a target ElementId from the source ElementId.\n * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.\n */\n public findTargetElementId(sourceElementId: Id64String): Id64String {\n if (Id64.invalid === sourceElementId) {\n return Id64.invalid;\n }\n return this._nativeContext.findElementId(sourceElementId);\n }\n\n /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.\n * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.\n * @see [SubCategory.isDefaultSubCategory]($backend)\n */\n public filterSubCategory(sourceSubCategoryId: Id64String): void {\n const sourceSubCategory = this.sourceDb.elements.tryGetElement<SubCategory>(sourceSubCategoryId, SubCategory);\n if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {\n this._nativeContext.filterSubCategoryId(sourceSubCategoryId);\n }\n }\n\n /** Returns `true` if there are any SubCategories being filtered. */\n public get hasSubCategoryFilter(): boolean {\n return this._nativeContext.hasSubCategoryFilter();\n }\n\n /** Returns `true` if this SubCategory is being filtered. */\n public isSubCategoryFiltered(subCategoryId: Id64String): boolean {\n return this._nativeContext.isSubCategoryFiltered(subCategoryId);\n }\n\n /** Import the specified font from the source iModel into the target iModel.\n * @internal\n */\n public importFont(sourceFontNumber: number): void {\n this.targetDb.clearFontMap(); // so it will be reloaded with new font info\n this._nativeContext.importFont(sourceFontNumber);\n }\n\n /** Import a single CodeSpec from the source iModel into the target iModel.\n * @internal\n */\n public importCodeSpec(sourceCodeSpecId: Id64String): void {\n this._nativeContext.importCodeSpec(sourceCodeSpecId);\n }\n\n /** Clone the specified source Element into ElementProps for the target iModel.\n * @internal\n */\n public async cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): Promise<ElementProps> {\n const targetElementProps: ElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);\n // Ensure that all NavigationProperties in targetElementProps have a defined value so \"clearing\" changes will be part of the JSON used for update\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n sourceElement.forEachProperty((propertyName: string, meta: PropertyMetaData) => {\n if ((meta.isNavigation) && (undefined === (sourceElement as any)[propertyName])) {\n (targetElementProps as any)[propertyName] = RelatedElement.none;\n }\n }, false); // exclude custom because C++ has already handled them\n if (this.isBetweenIModels) {\n // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels\n targetElementProps.federationGuid = sourceElement.federationGuid;\n if (CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {\n targetElementProps.code.scope = IModel.rootSubjectId;\n }\n }\n // unlike other references, code cannot be null. If it is null, use an empty code instead\n if (targetElementProps.code.scope === Id64.invalid || targetElementProps.code.spec === Id64.invalid) {\n targetElementProps.code = Code.createEmpty();\n }\n const jsClass = this.sourceDb.getJsClass<typeof Element>(sourceElement.classFullName);\n // eslint-disable-next-line @typescript-eslint/dot-notation\n await jsClass[\"onCloned\"](this, sourceElement.toJSON(), targetElementProps);\n return targetElementProps;\n }\n\n /**\n * serialize state to a sqlite database at a given path\n * assumes the database has not already had any context state serialized to it\n * @internal\n */\n public saveStateToDb(db: SQLiteDb): void {\n this._nativeContext.saveStateToDb(db[_nativeDb]);\n }\n\n /**\n * load state from a sqlite database at a given path\n * @internal\n */\n public loadStateFromDb(db: SQLiteDb): void {\n this._nativeContext.loadStateFromDb(db[_nativeDb]);\n }\n}\n"]}
|
package/lib/esm/IModelHost.d.ts
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* @module IModelHost
|
|
3
3
|
*/
|
|
4
4
|
import "./IModelDb";
|
|
5
|
-
import "reflect-metadata";
|
|
6
5
|
import { AccessToken, BeEvent, GuidString, Mutable } from "@itwin/core-bentley";
|
|
7
6
|
import { AuthorizationClient, LocalDirName, SessionProps } from "@itwin/core-common";
|
|
8
|
-
import { ServerStorage } from "@itwin/object-storage-core";
|
|
7
|
+
import type { ServerStorage } from "@itwin/object-storage-core";
|
|
9
8
|
import { BackendHubAccess, CreateNewIModelProps } from "./BackendHubAccess";
|
|
10
9
|
import { TileStorage } from "./TileStorage";
|
|
11
10
|
import { SettingsSchemas } from "./workspace/SettingsSchemas";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelHost.d.ts","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"IModelHost.d.ts","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,YAAY,CAAC;AAKpB,OAAO,EAAE,WAAW,EAAU,OAAO,EAAiC,UAAU,EAAwB,OAAO,EAAmB,MAAM,qBAAqB,CAAC;AAC9J,OAAO,EAAE,mBAAmB,EAAe,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAc5E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA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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"}
|
package/lib/esm/IModelHost.js
CHANGED
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
// To avoid circular load errors, the "Element" classes must be loaded before IModelHost.
|
|
9
9
|
import "./IModelDb"; // DO NOT REMOVE OR MOVE THIS LINE!
|
|
10
10
|
import { IModelNative, loadNativePlatform } from "./internal/NativePlatform";
|
|
11
|
-
import * as os from "os";
|
|
12
|
-
import "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.
|
|
11
|
+
import * as os from "node:os";
|
|
13
12
|
import { NativeLibrary } from "@bentley/imodeljs-native";
|
|
14
|
-
import { Types as ExtensionTypes } from "@itwin/cloud-agnostic-core";
|
|
15
13
|
import { assert, BeEvent, BentleyStatus, DbResult, Guid, IModelStatus, Logger, ProcessDetector } from "@itwin/core-bentley";
|
|
16
14
|
import { IModelError } from "@itwin/core-common";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
15
|
+
import { AzureServerStorage, BlobServiceClientWrapper } from "@itwin/object-storage-azure";
|
|
16
|
+
import { BlobServiceClient, StorageSharedKeyCredential } from "@azure/storage-blob";
|
|
19
17
|
import { BackendLoggerCategory } from "./BackendLoggerCategory";
|
|
20
18
|
import { BisCoreSchema } from "./BisCoreSchema";
|
|
21
19
|
import { BriefcaseManager } from "./BriefcaseManager";
|
|
@@ -31,7 +29,6 @@ import { SnapshotIModelRpcImpl } from "./rpc-impl/SnapshotIModelRpcImpl";
|
|
|
31
29
|
import { initializeRpcBackend } from "./RpcBackend";
|
|
32
30
|
import { TileStorage } from "./TileStorage";
|
|
33
31
|
import { SettingsPriority } from "./workspace/Settings";
|
|
34
|
-
import { Container } from "inversify";
|
|
35
32
|
import { join, normalize as normalizeDir } from "path";
|
|
36
33
|
import { constructWorkspace } from "./internal/workspace/WorkspaceImpl";
|
|
37
34
|
import { SettingsImpl } from "./internal/workspace/SettingsImpl";
|
|
@@ -422,19 +419,14 @@ export class IModelHost {
|
|
|
422
419
|
IModelHost.tileStorage = new TileStorage(storage);
|
|
423
420
|
}
|
|
424
421
|
static setupAzureTileCache(credentials) {
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
accountName: credentials.account,
|
|
430
|
-
accountKey: credentials.accessKey,
|
|
431
|
-
baseUrl: credentials.baseUrl ?? `https://${credentials.account}.blob.core.windows.net`,
|
|
432
|
-
},
|
|
422
|
+
const storageConfig = {
|
|
423
|
+
accountName: credentials.account,
|
|
424
|
+
accountKey: credentials.accessKey,
|
|
425
|
+
baseUrl: credentials.baseUrl ?? `https://${credentials.account}.blob.core.windows.net`,
|
|
433
426
|
};
|
|
434
|
-
const
|
|
435
|
-
|
|
436
|
-
new
|
|
437
|
-
IModelHost.tileStorage = new TileStorage(ioc.get(ServerStorage));
|
|
427
|
+
const blobServiceClient = new BlobServiceClient(storageConfig.baseUrl, new StorageSharedKeyCredential(storageConfig.accountName, storageConfig.accountKey));
|
|
428
|
+
const azureStorage = new AzureServerStorage(storageConfig, new BlobServiceClientWrapper(blobServiceClient));
|
|
429
|
+
IModelHost.tileStorage = new TileStorage(azureStorage);
|
|
438
430
|
}
|
|
439
431
|
/** @internal */
|
|
440
432
|
static computeSchemaChecksum(arg) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelHost.js","sourceRoot":"","sources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C,CAAC;IAED,+BAA+B;IACxB,MAAM,KAAK,MAAM;QACtB,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAgB,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,WAAW,CAAC,YAAY,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,WAAW,CAAC,YAAY,CAAC,QAAQ,EAAE,GAAG,UAAU,eAAe,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF","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, CreateNewIModelProps } 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\";\nimport { _getHubAccess, _hubAccess, _setHubAccess } from \"./internal/Symbols\";\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 */\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 * Setting this to true will revert to the previous behavior of using the native side for all CRUD operations.\n * While set to false, the getElement(), getModel() and getAspect() functions will use a thinned down native workflow to read the entities from the database.\n * This workflow performs work previously done on the native side in the TS side, resulting in performance improvements, if errors are detected,\n * this option can be set to true to revert to old workflow.\n */\n disableThinnedNativeInstanceWorkflow?: boolean;\n\n /**\n * Configuration controlling whether to disable the creation of restore points during pull/merge operations.\n * @beta\n */\n disableRestorePointOnPullMerge?: true;\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 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 * Configuration controlling whether to use the thinned down native instance functions for element, model, and aspect CRUD operations\n * or use the previous behavior of using the native side for all CRUD operations. Set to true to revert to the previous behavior.\n * @beta\n */\n public disableThinnedNativeInstanceWorkflow?: boolean;\n\n /**\n * Configuration controlling whether to disable the creation of restore points during pull/merge operations.\n * @beta\n */\n public disableRestorePointOnPullMerge?: true;\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 // Omit the hubAccess field from configuration so it stays internal.\n public static configuration?: Omit<IModelHostOptions, \"hubAccess\">;\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 or 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 - will not be removed until after 2026-06-13. 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 const { hubAccess, ...otherOptions } = options;\n if (undefined !== hubAccess)\n this._hubAccess = hubAccess;\n\n this.configuration = otherOptions;\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 /**\n * Create a new iModel.\n * @returns the Guid of the newly created iModel.\n * @throws [IModelError]($common) in case of errors.\n * @note If [[IModelHostOptions.hubAccess]] was undefined in the call to [[startup]], this function will throw an error.\n */\n public static async createNewIModel(arg: CreateNewIModelProps): Promise<GuidString> {\n return this[_hubAccess].createNewIModel(arg);\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 - will not be removed until after 2026-06-13. 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,OAAO,YAAY,CAAC,CAAC,mCAAmC;AAExD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAe,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAc,YAAY,EAAE,MAAM,EAAW,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9J,OAAO,EAAuB,WAAW,EAA8B,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAA4B,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACrH,OAAO,EAAE,iBAAiB,EAAE,0BAA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I,WAAW,CAAC,YAAY,CAAC,QAAQ,EAAE,GAAG,UAAU,eAAe,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF","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 \"node:os\";\nimport { NativeLibrary } from \"@bentley/imodeljs-native\";\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 { AzureServerStorage, AzureServerStorageConfig, BlobServiceClientWrapper } from \"@itwin/object-storage-azure\";\nimport { BlobServiceClient, StorageSharedKeyCredential } from \"@azure/storage-blob\";\nimport type { ServerStorage } from \"@itwin/object-storage-core\";\nimport { BackendHubAccess, CreateNewIModelProps } 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 { 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\";\nimport { _getHubAccess, _hubAccess, _setHubAccess } from \"./internal/Symbols\";\n\nconst loggerCategory = BackendLoggerCategory.IModelHost;\n\n// cspell:ignore nodereport fatalerror apicall alicloud rpcs\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 */\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 * Setting this to true will revert to the previous behavior of using the native side for all CRUD operations.\n * While set to false, the getElement(), getModel() and getAspect() functions will use a thinned down native workflow to read the entities from the database.\n * This workflow performs work previously done on the native side in the TS side, resulting in performance improvements, if errors are detected,\n * this option can be set to true to revert to old workflow.\n */\n disableThinnedNativeInstanceWorkflow?: boolean;\n\n /**\n * Configuration controlling whether to disable the creation of restore points during pull/merge operations.\n * @beta\n */\n disableRestorePointOnPullMerge?: true;\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 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 * Configuration controlling whether to use the thinned down native instance functions for element, model, and aspect CRUD operations\n * or use the previous behavior of using the native side for all CRUD operations. Set to true to revert to the previous behavior.\n * @beta\n */\n public disableThinnedNativeInstanceWorkflow?: boolean;\n\n /**\n * Configuration controlling whether to disable the creation of restore points during pull/merge operations.\n * @beta\n */\n public disableRestorePointOnPullMerge?: true;\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 // Omit the hubAccess field from configuration so it stays internal.\n public static configuration?: Omit<IModelHostOptions, \"hubAccess\">;\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 or 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 - will not be removed until after 2026-06-13. 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 const { hubAccess, ...otherOptions } = options;\n if (undefined !== hubAccess)\n this._hubAccess = hubAccess;\n\n this.configuration = otherOptions;\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 /**\n * Create a new iModel.\n * @returns the Guid of the newly created iModel.\n * @throws [IModelError]($common) in case of errors.\n * @note If [[IModelHostOptions.hubAccess]] was undefined in the call to [[startup]], this function will throw an error.\n */\n public static async createNewIModel(arg: CreateNewIModelProps): Promise<GuidString> {\n return this[_hubAccess].createNewIModel(arg);\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 storageConfig: AzureServerStorageConfig = {\n accountName: credentials.account,\n accountKey: credentials.accessKey,\n baseUrl: credentials.baseUrl ?? `https://${credentials.account}.blob.core.windows.net`,\n }\n const blobServiceClient = new BlobServiceClient(\n storageConfig.baseUrl,\n new StorageSharedKeyCredential(storageConfig.accountName, storageConfig.accountKey),\n );\n const azureStorage: ServerStorage = new AzureServerStorage(storageConfig, new BlobServiceClientWrapper(blobServiceClient))\n IModelHost.tileStorage = new TileStorage(azureStorage);\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 - will not be removed until after 2026-06-13. 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"]}
|
package/lib/esm/Material.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ export declare class RenderMaterialElement extends DefinitionElement {
|
|
|
85
85
|
*/
|
|
86
86
|
static insert(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String;
|
|
87
87
|
/** @beta */
|
|
88
|
-
protected static onCloned(context: IModelElementCloneContext, sourceProps: ElementProps, targetProps: ElementProps): void
|
|
88
|
+
protected static onCloned(context: IModelElementCloneContext, sourceProps: ElementProps, targetProps: ElementProps): Promise<void>;
|
|
89
89
|
}
|
|
90
90
|
/** @public */
|
|
91
91
|
export declare namespace RenderMaterialElement {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Material.d.ts","sourceRoot":"","sources":["../../src/Material.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAa,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACQ,IAAI,EAAE,cAAc,EAAoC,YAAY,EAAE,cAAc,EAAgC,mBAAmB,EAAE,cAAc,EAAE,eAAe,EACtL,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIlF;;;GAGG;AACH,8BAAsB,gBAAiB,SAAQ,iBAAiB;IAC9D,WAA2B,SAAS,IAAI,MAAM,CAA+B;IAC7E;;;;OAIG;WACW,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAIjG;;;;;;OAMG;WACW,MAAM,CAAC,CAAC,SAAS,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;CAQzH;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,iBAAiB;IAC1D,WAA2B,SAAS,IAAI,MAAM,CAA6B;IAE3E,+EAA+E;IACxE,WAAW,EAAE,MAAM,CAAC;IAC3B,+CAA+C;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;I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O,EAAE,yBAAyB,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY;CAgBlI;AAED,cAAc;AACd,yBAAiB,qBAAqB,CAAC;IACrC;;;;OAIG;IACH,MAAa,MAAM;QACjB,mEAAmE;QAC5D,WAAW,EAAE,MAAM,CAAC;QAC3B,qDAAqD;QAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;QAC5B,iHAAiH;QAC1G,KAAK,CAAC,EAAE,cAAc,CAAC;QAC9B,kEAAkE;QAC3D,aAAa,CAAC,EAAE,cAAc,CAAC;QACtC;;WAEG;QACI,MAAM,CAAC,EAAE,MAAM,CAAC;QACvB;;;;WAIG;QACI,QAAQ,CAAC,EAAE,MAAM,CAAC;QACzB,wEAAwE;QACjE,OAAO,CAAC,EAAE,MAAM,CAAC;QACxB,yEAAyE;QAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;QACzB,wBAAwB;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACxB,wBAAwB;QACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QAC/B;;;WAGG;QACI,UAAU,CAAC,EAAE,eAAe,CAAC;QACpC;;;;WAIG;QACI,SAAS,CAAC,EAAE,cAAc,GAAG;YAClC;;eAEG;YACH,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;QAEF,gJAAgJ;oBAC7H,WAAW,EAAE,MAAM;KAGvC;CACF;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA4B,SAAQ,qBAAqB,CAAC,MAAM;CAChF"}
|
package/lib/esm/Material.js
CHANGED
|
@@ -192,8 +192,8 @@ export class RenderMaterialElement extends DefinitionElement {
|
|
|
192
192
|
return iModelDb.elements.insertElement(renderMaterial.toJSON());
|
|
193
193
|
}
|
|
194
194
|
/** @beta */
|
|
195
|
-
static onCloned(context, sourceProps, targetProps) {
|
|
196
|
-
super.onCloned(context, sourceProps, targetProps);
|
|
195
|
+
static async onCloned(context, sourceProps, targetProps) {
|
|
196
|
+
await super.onCloned(context, sourceProps, targetProps);
|
|
197
197
|
for (const mapName in sourceProps.jsonProperties?.materialAssets?.renderMaterial?.Map ?? {}) {
|
|
198
198
|
if (typeof mapName !== "string")
|
|
199
199
|
continue;
|
package/lib/esm/Material.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Material.js","sourceRoot":"","sources":["../../src/Material.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,WAAW,EAAE,IAAI,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAK9C,yDAAyD;AAEzD;;;GAGG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,iBAAiB;IACvD,MAAM,KAAc,SAAS,KAAa,OAAO,kBAAkB,CAAC,CAAC,CAAC;IAC7E;;;;OAIG;IACI,MAAM,CAAC,UAAU,CAAC,MAAgB,EAAE,iBAAiC,EAAE,IAAY;QACxF,MAAM,QAAQ,GAAa,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QACpF,OAAO,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChF,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAA6B,QAAkB,EAAE,iBAAiC,EAAE,IAAY;QAClH,MAAM,YAAY,GAA2B;YAC3C,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC;SACzD,CAAC;QACF,OAAO,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAA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ACjB,OAAO,CAAU;QACxB,wBAAwB;QACjB,YAAY,CAAY;QAC/B;;;WAGG;QACI,UAAU,CAAmB;QACpC;;;;WAIG;QACI,SAAS,CAKd;QAEF,gJAAgJ;QAChJ,YAAmB,WAAmB;YACpC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QACjC,CAAC;KACF;IAhDY,4BAAM,SAgDlB,CAAA;AACH,CAAC,EAvDgB,qBAAqB,KAArB,qBAAqB,QAuDrC","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 Elements\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport {\n BisCodeSpec, Code, CodeScopeProps, CodeSpec, DefinitionElementProps, ElementProps, NormalMapProps, RenderMaterialAssetMapsProps, RenderMaterialProps, RgbFactorProps, TextureMapProps,\n} from \"@itwin/core-common\";\nimport { DefinitionElement } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { IModelElementCloneContext } from \"./IModelElementCloneContext\";\nimport { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from \"./Entity\";\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/** A PhysicalMaterial defines the matter that makes up physical elements.\n * @note See [[RenderMaterialElement]] for the DefinitionElement used to define rendering characteristics.\n * @public\n */\nexport abstract class PhysicalMaterial extends DefinitionElement {\n public static override get className(): string { return \"PhysicalMaterial\"; }\n /** Create a Code for a PhysicalMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModelDb\n * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name.\n * @param name The name (codeValue) of the PhysicalMaterial\n */\n public static createCode(iModel: IModelDb, definitionModelId: CodeScopeProps, name: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.physicalMaterial);\n return new Code({ spec: codeSpec.id, scope: definitionModelId, value: name });\n }\n /** Create a PhysicalMaterial\n * @param iModelDb The IModelDb\n * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name.\n * @param name The name (codeValue) of the PhysicalMaterial\n * @returns The newly constructed PhysicalMaterial\n * @throws [[IModelError]] if there is a problem creating the PhysicalMaterial\n */\n public static create<T extends PhysicalMaterial>(iModelDb: IModelDb, definitionModelId: CodeScopeProps, name: string): T {\n const elementProps: DefinitionElementProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name),\n };\n return iModelDb.elements.createElement(elementProps);\n }\n}\n\n/** Defines a rendering material.\n * @note See [[PhysicalMaterial]] for the DefinitionElement used to define the matter that makes up physical elements.\n * @public\n */\nexport class RenderMaterialElement extends DefinitionElement {\n public static override get className(): string { return \"RenderMaterial\"; }\n\n /** The name of a palette that can be used to categorize multiple materials. */\n public paletteName: string;\n /** An optional description of the material. */\n public description?: string;\n\n private constructor(props: RenderMaterialProps, iModel: IModelDb) {\n super(props, iModel);\n this.paletteName = props.paletteName;\n this.description = props.description;\n }\n\n public override toJSON(): RenderMaterialProps {\n const val = super.toJSON() as RenderMaterialProps;\n val.paletteName = this.paletteName;\n val.description = this.description;\n return val;\n }\n\n /**\n * RenderMaterialElement custom HandledProps includes 'paletteName'.\n * @inheritdoc\n * @beta\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"paletteName\", source: \"Class\" },\n ];\n\n /**\n * RenderMaterialElement deserializes 'paletteName'.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): RenderMaterialProps {\n const elProps = super.deserialize(props) as RenderMaterialProps;\n const instance = props.row;\n elProps.paletteName = JsonUtils.asString(instance.paletteName);\n return elProps;\n }\n\n /**\n * RenderMaterialElement serializes 'paletteName'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: RenderMaterialProps, iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, iModel);\n inst.paletteName = props.paletteName;\n return inst;\n }\n\n /** Create a Code for a RenderMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModelDb\n * @param scopeModelId The Id of the DefinitionModel that contains the RenderMaterial and provides the scope for its name.\n * @param name The RenderMaterial name\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, name: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.renderMaterial);\n return 0 === name.length ? Code.createEmpty() : new Code({ spec: codeSpec.id, scope: scopeModelId, value: name });\n }\n /**\n * Create a RenderMaterial with given parameters.\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param materialName The name/CodeValue of the RenderMaterial\n * @param params Parameters object which describes how to construct the RenderMaterial\n * @returns The newly constructed RenderMaterial element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): RenderMaterialElement {\n let maps: RenderMaterialAssetMapsProps | undefined;\n const pbr_normal = params.normalMap?.scale;\n if (params.patternMap || params.normalMap) {\n // If both normal and pattern map are present, their texture mapping modes, angles, scales, etc are expected to match.\n type TexMap = Omit<TextureMapProps, \"TextureId\">;\n function choose<K extends keyof TexMap>(obj: TexMap, key: K): void {\n const pat = params.patternMap;\n if (pat && undefined !== pat[key])\n obj[key] = pat[key];\n else if (params.normalMap && undefined !== params.normalMap[key])\n obj[key] = params.normalMap[key];\n }\n\n const baseProps: TexMap = {};\n choose(baseProps, \"pattern_angle\");\n choose(baseProps, \"pattern_u_flip\");\n choose(baseProps, \"pattern_flip\");\n choose(baseProps, \"pattern_scale\");\n choose(baseProps, \"pattern_offset\");\n choose(baseProps, \"pattern_scalemode\");\n choose(baseProps, \"pattern_mapping\");\n choose(baseProps, \"pattern_weight\");\n choose(baseProps, \"pattern_useconstantlod\");\n choose(baseProps, \"pattern_constantlod_repetitions\");\n choose(baseProps, \"pattern_constantlod_offset\");\n choose(baseProps, \"pattern_constantlod_mindistanceclamp\");\n choose(baseProps, \"pattern_constantlod_maxdistanceclamp\");\n\n maps = {};\n if (params.patternMap)\n maps.Pattern = { ...params.patternMap, ...baseProps };\n\n if (params.normalMap) {\n maps.Normal = {\n ...params.normalMap,\n ...baseProps,\n };\n\n delete (maps.Normal as any).scale;\n }\n }\n\n const renderMaterialProps: RenderMaterialProps = {\n classFullName: this.classFullName,\n code: this.createCode(iModelDb, definitionModelId, materialName),\n paletteName: params.paletteName,\n description: params.description,\n jsonProperties: {\n materialAssets: {\n renderMaterial: {\n HasBaseColor: params.color !== undefined,\n color: params.color,\n HasSpecularColor: params.specularColor !== undefined,\n specular_color: params.specularColor,\n HasFinish: params.finish !== undefined,\n finish: params.finish,\n HasTransmit: params.transmit !== undefined ? true : undefined,\n transmit: params.transmit,\n HasDiffuse: params.diffuse !== undefined,\n diffuse: params.diffuse,\n HasSpecular: params.specular !== undefined,\n specular: params.specular,\n HasReflect: params.reflect !== undefined,\n reflect: params.reflect,\n HasReflectColor: params.reflectColor !== undefined,\n reflect_color: params.reflectColor,\n Map: maps,\n pbr_normal,\n },\n },\n },\n model: definitionModelId,\n isPrivate: false,\n };\n\n return new RenderMaterialElement(renderMaterialProps, iModelDb);\n }\n\n /**\n * Insert a new RenderMaterial into a model.\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new Texture into this DefinitionModel\n * @param materialName The name/CodeValue of the RenderMaterial\n * @param params Parameters object which describes how to construct the RenderMaterial\n * @returns The Id of the newly inserted RenderMaterial element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String {\n const renderMaterial = this.create(iModelDb, definitionModelId, materialName, params);\n return iModelDb.elements.insertElement(renderMaterial.toJSON());\n }\n\n /** @beta */\n protected static override onCloned(context: IModelElementCloneContext, sourceProps: ElementProps, targetProps: ElementProps) {\n super.onCloned(context, sourceProps, targetProps);\n for (const mapName in sourceProps.jsonProperties?.materialAssets?.renderMaterial?.Map ?? {}) {\n if (typeof mapName !== \"string\")\n continue;\n const sourceMap = sourceProps.jsonProperties.materialAssets.renderMaterial.Map[mapName];\n // sourceMap could be null/undefined, keep it the same in targetProps\n if (!sourceMap) {\n targetProps.jsonProperties.materialAssets.renderMaterial.Map[mapName] = sourceMap;\n continue;\n }\n if (!Id64.isValid(sourceMap.TextureId) || sourceMap.TextureId === undefined)\n continue;\n targetProps.jsonProperties.materialAssets.renderMaterial.Map[mapName].TextureId = context.findTargetElementId(sourceMap.TextureId ?? Id64.invalid);\n }\n }\n}\n\n/** @public */\nexport namespace RenderMaterialElement {\n /** Parameters used to construct a [[RenderMaterial]].\n * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat.\n * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type.\n * @deprecated in 3.6 - might be removed in next major version. Because it is not useful to use a `class` - just use [[RenderMaterialElementParams]] directly instead.\n */\n export class Params {\n /** A required palette name that categorizes this RenderMaterial */\n public paletteName: string;\n /** An optional description of this RenderMaterial */\n public description?: string;\n /** If defined, the color to use for surface fill or diffuse illumination, overriding the surface's own color. */\n public color?: RgbFactorProps;\n /** The color to use for specular illumination. Default: black. */\n public specularColor?: RgbFactorProps;\n /** The specular exponent describing the surface's shininess, in the range 0 through 128.\n * Default: 0.\n */\n public finish?: number;\n /** A transparency to be applied to the surface, ranging from 0 (fully opaque) to 1 (fully transparent).\n * If defined, then the material transparency overrides the transparency of whatever surface the material is applied to.\n * If undefined, the material has no effect on surface transparency.\n * Default: undefined.\n */\n public transmit?: number;\n /** The surface's diffuse reflectivity from 0.0 to 1.0. Default: 0.6. */\n public diffuse?: number;\n /** The surface's specular reflectivity from 0.0 to 1.0. Default: 0.0. */\n public specular?: number;\n /** Currently unused. */\n public reflect?: number;\n /** Currently unused. */\n public reflectColor?: number[];\n /** Specifies a texture image to map onto the surface, replacing or mixing with the surface's own color and transparency.\n * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both\n * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence.\n */\n public patternMap?: TextureMapProps;\n /** Specifies a [normal map](https://en.wikipedia.org/wiki/Normal_mapping) to apply to the surface to simulate more surface detail than is present in the\n * surface's geometry.\n * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both\n * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence.\n */\n public normalMap?: NormalMapProps & {\n /** A factor by which to multiply the components of the normal vectors read from the texture.\n * Default: 1.\n */\n scale?: number;\n };\n\n /** Construct a new RenderMaterial.Params object with the specified paletteName. Alter the public members on that object to specify settings. */\n public constructor(paletteName: string) {\n this.paletteName = paletteName;\n }\n }\n}\n\n/** Parameters used to create a [[RenderMaterial]] element.\n * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat.\n * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type.\n * @public\n */\nexport interface RenderMaterialElementParams extends RenderMaterialElement.Params { // eslint-disable-line @typescript-eslint/no-deprecated, @typescript-eslint/no-empty-object-type\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Material.js","sourceRoot":"","sources":["../../src/Material.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,WAAW,EAAE,IAAI,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAK9C,yDAAyD;AAEzD;;;GAGG;AACH,MAAM,OAAgB,gBAAiB,SAA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AAC,OAAO,CAAC,GAAG,SAAS,CAAC;gBAClF,SAAS;YACX,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,SAAS,KAAK,SAAS;gBACzE,SAAS;YACX,WAAW,CAAC,cAAc,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,SAAS,GAAG,OAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;QACrJ,CAAC;IACH,CAAC;;AAGH,cAAc;AACd,WAAiB,qBAAqB;IACpC;;;;OAIG;IACH,MAAa,MAAM;QACjB,mEAAmE;QAC5D,WAAW,CAAS;QAC3B,qDAAqD;QAC9C,WAAW,CAAU;QAC5B,iHAAiH;QAC1G,KAAK,CAAkB;QAC9B,kEAAkE;QAC3D,aAAa,CAAkB;QACtC;;WAEG;QACI,MAAM,CAAU;QACvB;;;;WAIG;QACI,QAAQ,CAAU;QACzB,wEAAwE;QACjE,OAAO,CAAU;QACxB,yEAAyE;QAClE,QAAQ,CAAU;QACzB,wBAAwB;QACjB,OAAO,CAAU;QACxB,wBAAwB;QACjB,YAAY,CAAY;QAC/B;;;WAGG;QACI,UAAU,CAAmB;QACpC;;;;WAIG;QACI,SAAS,CAKd;QAEF,gJAAgJ;QAChJ,YAAmB,WAAmB;YACpC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QACjC,CAAC;KACF;IAhDY,4BAAM,SAgDlB,CAAA;AACH,CAAC,EAvDgB,qBAAqB,KAArB,qBAAqB,QAuDrC","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 Elements\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport {\n BisCodeSpec, Code, CodeScopeProps, CodeSpec, DefinitionElementProps, ElementProps, NormalMapProps, RenderMaterialAssetMapsProps, RenderMaterialProps, RgbFactorProps, TextureMapProps,\n} from \"@itwin/core-common\";\nimport { DefinitionElement } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { IModelElementCloneContext } from \"./IModelElementCloneContext\";\nimport { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from \"./Entity\";\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/** A PhysicalMaterial defines the matter that makes up physical elements.\n * @note See [[RenderMaterialElement]] for the DefinitionElement used to define rendering characteristics.\n * @public\n */\nexport abstract class PhysicalMaterial extends DefinitionElement {\n public static override get className(): string { return \"PhysicalMaterial\"; }\n /** Create a Code for a PhysicalMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModelDb\n * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name.\n * @param name The name (codeValue) of the PhysicalMaterial\n */\n public static createCode(iModel: IModelDb, definitionModelId: CodeScopeProps, name: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.physicalMaterial);\n return new Code({ spec: codeSpec.id, scope: definitionModelId, value: name });\n }\n /** Create a PhysicalMaterial\n * @param iModelDb The IModelDb\n * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name.\n * @param name The name (codeValue) of the PhysicalMaterial\n * @returns The newly constructed PhysicalMaterial\n * @throws [[IModelError]] if there is a problem creating the PhysicalMaterial\n */\n public static create<T extends PhysicalMaterial>(iModelDb: IModelDb, definitionModelId: CodeScopeProps, name: string): T {\n const elementProps: DefinitionElementProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name),\n };\n return iModelDb.elements.createElement(elementProps);\n }\n}\n\n/** Defines a rendering material.\n * @note See [[PhysicalMaterial]] for the DefinitionElement used to define the matter that makes up physical elements.\n * @public\n */\nexport class RenderMaterialElement extends DefinitionElement {\n public static override get className(): string { return \"RenderMaterial\"; }\n\n /** The name of a palette that can be used to categorize multiple materials. */\n public paletteName: string;\n /** An optional description of the material. */\n public description?: string;\n\n private constructor(props: RenderMaterialProps, iModel: IModelDb) {\n super(props, iModel);\n this.paletteName = props.paletteName;\n this.description = props.description;\n }\n\n public override toJSON(): RenderMaterialProps {\n const val = super.toJSON() as RenderMaterialProps;\n val.paletteName = this.paletteName;\n val.description = this.description;\n return val;\n }\n\n /**\n * RenderMaterialElement custom HandledProps includes 'paletteName'.\n * @inheritdoc\n * @beta\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"paletteName\", source: \"Class\" },\n ];\n\n /**\n * RenderMaterialElement deserializes 'paletteName'.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): RenderMaterialProps {\n const elProps = super.deserialize(props) as RenderMaterialProps;\n const instance = props.row;\n elProps.paletteName = JsonUtils.asString(instance.paletteName);\n return elProps;\n }\n\n /**\n * RenderMaterialElement serializes 'paletteName'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: RenderMaterialProps, iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, iModel);\n inst.paletteName = props.paletteName;\n return inst;\n }\n\n /** Create a Code for a RenderMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModelDb\n * @param scopeModelId The Id of the DefinitionModel that contains the RenderMaterial and provides the scope for its name.\n * @param name The RenderMaterial name\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, name: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.renderMaterial);\n return 0 === name.length ? Code.createEmpty() : new Code({ spec: codeSpec.id, scope: scopeModelId, value: name });\n }\n /**\n * Create a RenderMaterial with given parameters.\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param materialName The name/CodeValue of the RenderMaterial\n * @param params Parameters object which describes how to construct the RenderMaterial\n * @returns The newly constructed RenderMaterial element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): RenderMaterialElement {\n let maps: RenderMaterialAssetMapsProps | undefined;\n const pbr_normal = params.normalMap?.scale;\n if (params.patternMap || params.normalMap) {\n // If both normal and pattern map are present, their texture mapping modes, angles, scales, etc are expected to match.\n type TexMap = Omit<TextureMapProps, \"TextureId\">;\n function choose<K extends keyof TexMap>(obj: TexMap, key: K): void {\n const pat = params.patternMap;\n if (pat && undefined !== pat[key])\n obj[key] = pat[key];\n else if (params.normalMap && undefined !== params.normalMap[key])\n obj[key] = params.normalMap[key];\n }\n\n const baseProps: TexMap = {};\n choose(baseProps, \"pattern_angle\");\n choose(baseProps, \"pattern_u_flip\");\n choose(baseProps, \"pattern_flip\");\n choose(baseProps, \"pattern_scale\");\n choose(baseProps, \"pattern_offset\");\n choose(baseProps, \"pattern_scalemode\");\n choose(baseProps, \"pattern_mapping\");\n choose(baseProps, \"pattern_weight\");\n choose(baseProps, \"pattern_useconstantlod\");\n choose(baseProps, \"pattern_constantlod_repetitions\");\n choose(baseProps, \"pattern_constantlod_offset\");\n choose(baseProps, \"pattern_constantlod_mindistanceclamp\");\n choose(baseProps, \"pattern_constantlod_maxdistanceclamp\");\n\n maps = {};\n if (params.patternMap)\n maps.Pattern = { ...params.patternMap, ...baseProps };\n\n if (params.normalMap) {\n maps.Normal = {\n ...params.normalMap,\n ...baseProps,\n };\n\n delete (maps.Normal as any).scale;\n }\n }\n\n const renderMaterialProps: RenderMaterialProps = {\n classFullName: this.classFullName,\n code: this.createCode(iModelDb, definitionModelId, materialName),\n paletteName: params.paletteName,\n description: params.description,\n jsonProperties: {\n materialAssets: {\n renderMaterial: {\n HasBaseColor: params.color !== undefined,\n color: params.color,\n HasSpecularColor: params.specularColor !== undefined,\n specular_color: params.specularColor,\n HasFinish: params.finish !== undefined,\n finish: params.finish,\n HasTransmit: params.transmit !== undefined ? true : undefined,\n transmit: params.transmit,\n HasDiffuse: params.diffuse !== undefined,\n diffuse: params.diffuse,\n HasSpecular: params.specular !== undefined,\n specular: params.specular,\n HasReflect: params.reflect !== undefined,\n reflect: params.reflect,\n HasReflectColor: params.reflectColor !== undefined,\n reflect_color: params.reflectColor,\n Map: maps,\n pbr_normal,\n },\n },\n },\n model: definitionModelId,\n isPrivate: false,\n };\n\n return new RenderMaterialElement(renderMaterialProps, iModelDb);\n }\n\n /**\n * Insert a new RenderMaterial into a model.\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new Texture into this DefinitionModel\n * @param materialName The name/CodeValue of the RenderMaterial\n * @param params Parameters object which describes how to construct the RenderMaterial\n * @returns The Id of the newly inserted RenderMaterial element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String {\n const renderMaterial = this.create(iModelDb, definitionModelId, materialName, params);\n return iModelDb.elements.insertElement(renderMaterial.toJSON());\n }\n\n /** @beta */\n protected static override async onCloned(context: IModelElementCloneContext, sourceProps: ElementProps, targetProps: ElementProps) {\n await super.onCloned(context, sourceProps, targetProps);\n for (const mapName in sourceProps.jsonProperties?.materialAssets?.renderMaterial?.Map ?? {}) {\n if (typeof mapName !== \"string\")\n continue;\n const sourceMap = sourceProps.jsonProperties.materialAssets.renderMaterial.Map[mapName];\n // sourceMap could be null/undefined, keep it the same in targetProps\n if (!sourceMap) {\n targetProps.jsonProperties.materialAssets.renderMaterial.Map[mapName] = sourceMap;\n continue;\n }\n if (!Id64.isValid(sourceMap.TextureId) || sourceMap.TextureId === undefined)\n continue;\n targetProps.jsonProperties.materialAssets.renderMaterial.Map[mapName].TextureId = context.findTargetElementId(sourceMap.TextureId ?? Id64.invalid);\n }\n }\n}\n\n/** @public */\nexport namespace RenderMaterialElement {\n /** Parameters used to construct a [[RenderMaterial]].\n * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat.\n * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type.\n * @deprecated in 3.6 - might be removed in next major version. Because it is not useful to use a `class` - just use [[RenderMaterialElementParams]] directly instead.\n */\n export class Params {\n /** A required palette name that categorizes this RenderMaterial */\n public paletteName: string;\n /** An optional description of this RenderMaterial */\n public description?: string;\n /** If defined, the color to use for surface fill or diffuse illumination, overriding the surface's own color. */\n public color?: RgbFactorProps;\n /** The color to use for specular illumination. Default: black. */\n public specularColor?: RgbFactorProps;\n /** The specular exponent describing the surface's shininess, in the range 0 through 128.\n * Default: 0.\n */\n public finish?: number;\n /** A transparency to be applied to the surface, ranging from 0 (fully opaque) to 1 (fully transparent).\n * If defined, then the material transparency overrides the transparency of whatever surface the material is applied to.\n * If undefined, the material has no effect on surface transparency.\n * Default: undefined.\n */\n public transmit?: number;\n /** The surface's diffuse reflectivity from 0.0 to 1.0. Default: 0.6. */\n public diffuse?: number;\n /** The surface's specular reflectivity from 0.0 to 1.0. Default: 0.0. */\n public specular?: number;\n /** Currently unused. */\n public reflect?: number;\n /** Currently unused. */\n public reflectColor?: number[];\n /** Specifies a texture image to map onto the surface, replacing or mixing with the surface's own color and transparency.\n * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both\n * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence.\n */\n public patternMap?: TextureMapProps;\n /** Specifies a [normal map](https://en.wikipedia.org/wiki/Normal_mapping) to apply to the surface to simulate more surface detail than is present in the\n * surface's geometry.\n * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both\n * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence.\n */\n public normalMap?: NormalMapProps & {\n /** A factor by which to multiply the components of the normal vectors read from the texture.\n * Default: 1.\n */\n scale?: number;\n };\n\n /** Construct a new RenderMaterial.Params object with the specified paletteName. Alter the public members on that object to specify settings. */\n public constructor(paletteName: string) {\n this.paletteName = paletteName;\n }\n }\n}\n\n/** Parameters used to create a [[RenderMaterial]] element.\n * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat.\n * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type.\n * @public\n */\nexport interface RenderMaterialElementParams extends RenderMaterialElement.Params { // eslint-disable-line @typescript-eslint/no-deprecated, @typescript-eslint/no-empty-object-type\n}\n"]}
|
|
@@ -368,6 +368,11 @@ export declare class Relationships {
|
|
|
368
368
|
updateInstance(props: RelationshipProps): void;
|
|
369
369
|
/** Delete an Relationship instance from this iModel. */
|
|
370
370
|
deleteInstance(props: RelationshipProps): void;
|
|
371
|
+
/** Delete multiple Relationship instances from this iModel.
|
|
372
|
+
* @param props The properties of the relationship instances to delete.
|
|
373
|
+
* @remarks This method handles bulk deletion of relationships and supports mixed collections containing instances from different relationship classes.
|
|
374
|
+
*/
|
|
375
|
+
deleteInstances(props: ReadonlyArray<RelationshipProps>): void;
|
|
371
376
|
/** Get the props of a Relationship instance
|
|
372
377
|
* @param relClassFullName The full class name of the relationship in the form of "schema:class"
|
|
373
378
|
* @param criteria Either the relationship instanceId or the source and target Ids
|