@itwin/presentation-core-interop 1.1.1 → 1.2.0
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 +25 -0
- package/README.md +16 -0
- package/lib/cjs/core-interop/IModelKey.d.ts +31 -0
- package/lib/cjs/core-interop/IModelKey.d.ts.map +1 -0
- package/lib/cjs/core-interop/IModelKey.js +36 -0
- package/lib/cjs/core-interop/IModelKey.js.map +1 -0
- package/lib/cjs/presentation-core-interop.d.ts +1 -0
- package/lib/cjs/presentation-core-interop.d.ts.map +1 -1
- package/lib/cjs/presentation-core-interop.js +3 -1
- package/lib/cjs/presentation-core-interop.js.map +1 -1
- package/lib/esm/core-interop/IModelKey.d.ts +31 -0
- package/lib/esm/core-interop/IModelKey.d.ts.map +1 -0
- package/lib/esm/core-interop/IModelKey.js +33 -0
- package/lib/esm/core-interop/IModelKey.js.map +1 -0
- package/lib/esm/presentation-core-interop.d.ts +1 -0
- package/lib/esm/presentation-core-interop.d.ts.map +1 -1
- package/lib/esm/presentation-core-interop.js +1 -0
- package/lib/esm/presentation-core-interop.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @itwin/presentation-core-interop
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#814](https://github.com/iTwin/presentation/pull/814): Add a `createIModelKey` function to safely create an identifier for an `IModel` in different situations.
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { IModelConnection } from "@itwin/core-frontend";
|
|
13
|
+
import { createIModelKey } from "@itwin/presentation-core-interop";
|
|
14
|
+
|
|
15
|
+
IModelConnection.onOpen.addListener((imodel: IModelConnection) => {
|
|
16
|
+
const key = createIModelKey(imodel);
|
|
17
|
+
console.log(`IModel opened: "${key}"`);
|
|
18
|
+
});
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 1.1.2
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies:
|
|
26
|
+
- @itwin/presentation-shared@1.2.0
|
|
27
|
+
|
|
3
28
|
## 1.1.1
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -11,6 +11,22 @@ Having this interop layer helps us evolve both sides without affecting one anoth
|
|
|
11
11
|
|
|
12
12
|
## API
|
|
13
13
|
|
|
14
|
+
### `createIModelKey`
|
|
15
|
+
|
|
16
|
+
Attempts to create a unique identifier for the given iModel. In majority of cases that's going to be the `key` property, but if it's not set (e.g. when using [BlankConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/blankconnection/)) - `name` property is used instead. Finally, if both are empty - the function will throw an error.
|
|
17
|
+
|
|
18
|
+
Example:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { IModelConnection } from "@itwin/core-frontend";
|
|
22
|
+
import { createIModelKey } from "@itwin/presentation-core-interop";
|
|
23
|
+
|
|
24
|
+
IModelConnection.onOpen.addListener((imodel: IModelConnection) => {
|
|
25
|
+
const key = createIModelKey(imodel);
|
|
26
|
+
console.log(`IModel opened: "${key}"`);
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
14
30
|
### `createECSqlQueryExecutor`
|
|
15
31
|
|
|
16
32
|
Maps an iModel in the form of `itwinjs-core` [IModelDb](https://www.itwinjs.org/reference/core-backend/imodels/imodeldb/) or [IModelConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/imodelconnection/) to an instance of `ECSqlQueryExecutor`, used in `@itwin/presentation-hierarchies` and `@itwin/unified-selection` packages.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines input for `createIModelKey`. Generally, this is an instance of either [IModelDb](https://www.itwinjs.org/reference/core-backend/imodels/imodeldb/)
|
|
3
|
+
* or [IModelConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/imodelconnection/).
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
interface CoreIModel {
|
|
7
|
+
key: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Attempts to create a unique identifier for the given iModel. In majority of cases that's going to be the `key` property, but if it's not
|
|
12
|
+
* set (e.g. when using [BlankConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/blankconnection/)) - `name` property
|
|
13
|
+
* is used instead. Finally, if both are empty - the function will throw an error.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { IModelConnection } from "@itwin/core-frontend";
|
|
19
|
+
* import { createIModelKey } from "@itwin/presentation-core-interop";
|
|
20
|
+
*
|
|
21
|
+
* IModelConnection.onOpen.addListener((imodel: IModelConnection) => {
|
|
22
|
+
* const key = createIModelKey(imodel);
|
|
23
|
+
* console.log(`IModel opened: "${key}"`);
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare function createIModelKey(imodel: CoreIModel): string;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=IModelKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModelKey.d.ts","sourceRoot":"","sources":["../../../src/core-interop/IModelKey.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAQ1D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createIModelKey = createIModelKey;
|
|
8
|
+
/**
|
|
9
|
+
* Attempts to create a unique identifier for the given iModel. In majority of cases that's going to be the `key` property, but if it's not
|
|
10
|
+
* set (e.g. when using [BlankConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/blankconnection/)) - `name` property
|
|
11
|
+
* is used instead. Finally, if both are empty - the function will throw an error.
|
|
12
|
+
*
|
|
13
|
+
* Example:
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { IModelConnection } from "@itwin/core-frontend";
|
|
17
|
+
* import { createIModelKey } from "@itwin/presentation-core-interop";
|
|
18
|
+
*
|
|
19
|
+
* IModelConnection.onOpen.addListener((imodel: IModelConnection) => {
|
|
20
|
+
* const key = createIModelKey(imodel);
|
|
21
|
+
* console.log(`IModel opened: "${key}"`);
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
function createIModelKey(imodel) {
|
|
28
|
+
if (imodel.key.length) {
|
|
29
|
+
return imodel.key;
|
|
30
|
+
}
|
|
31
|
+
if (imodel.name.length) {
|
|
32
|
+
return imodel.name;
|
|
33
|
+
}
|
|
34
|
+
throw new Error(`Provided iModel doesn't have a key or name.`);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=IModelKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModelKey.js","sourceRoot":"","sources":["../../../src/core-interop/IModelKey.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AA+BhG,0CAQC;AA3BD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,eAAe,CAAC,MAAkB;IAChD,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC,GAAG,CAAC;IACpB,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;AACjE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Defines input for `createIModelKey`. Generally, this is an instance of either [IModelDb](https://www.itwinjs.org/reference/core-backend/imodels/imodeldb/)\n * or [IModelConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/imodelconnection/).\n * @public\n */\ninterface CoreIModel {\n key: string;\n name: string;\n}\n\n/**\n * Attempts to create a unique identifier for the given iModel. In majority of cases that's going to be the `key` property, but if it's not\n * set (e.g. when using [BlankConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/blankconnection/)) - `name` property\n * is used instead. Finally, if both are empty - the function will throw an error.\n *\n * Example:\n *\n * ```ts\n * import { IModelConnection } from \"@itwin/core-frontend\";\n * import { createIModelKey } from \"@itwin/presentation-core-interop\";\n *\n * IModelConnection.onOpen.addListener((imodel: IModelConnection) => {\n * const key = createIModelKey(imodel);\n * console.log(`IModel opened: \"${key}\"`);\n * });\n * ```\n *\n * @public\n */\nexport function createIModelKey(imodel: CoreIModel): string {\n if (imodel.key.length) {\n return imodel.key;\n }\n if (imodel.name.length) {\n return imodel.name;\n }\n throw new Error(`Provided iModel doesn't have a key or name.`);\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createValueFormatter } from "./core-interop/Formatting.js";
|
|
2
|
+
export { createIModelKey } from "./core-interop/IModelKey.js";
|
|
2
3
|
export { createLogger } from "./core-interop/Logging.js";
|
|
3
4
|
export { createECSchemaProvider } from "./core-interop/Metadata.js";
|
|
4
5
|
export { createECSqlQueryExecutor } from "./core-interop/QueryExecutor.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation-core-interop.d.ts","sourceRoot":"","sources":["../../src/presentation-core-interop.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"presentation-core-interop.d.ts","sourceRoot":"","sources":["../../src/presentation-core-interop.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.registerTxnListeners = exports.createECSqlQueryExecutor = exports.createECSchemaProvider = exports.createLogger = exports.createValueFormatter = void 0;
|
|
7
|
+
exports.registerTxnListeners = exports.createECSqlQueryExecutor = exports.createECSchemaProvider = exports.createLogger = exports.createIModelKey = exports.createValueFormatter = void 0;
|
|
8
8
|
var Formatting_js_1 = require("./core-interop/Formatting.js");
|
|
9
9
|
Object.defineProperty(exports, "createValueFormatter", { enumerable: true, get: function () { return Formatting_js_1.createValueFormatter; } });
|
|
10
|
+
var IModelKey_js_1 = require("./core-interop/IModelKey.js");
|
|
11
|
+
Object.defineProperty(exports, "createIModelKey", { enumerable: true, get: function () { return IModelKey_js_1.createIModelKey; } });
|
|
10
12
|
var Logging_js_1 = require("./core-interop/Logging.js");
|
|
11
13
|
Object.defineProperty(exports, "createLogger", { enumerable: true, get: function () { return Logging_js_1.createLogger; } });
|
|
12
14
|
var Metadata_js_1 = require("./core-interop/Metadata.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation-core-interop.js","sourceRoot":"","sources":["../../src/presentation-core-interop.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,8DAAoE;AAA3D,qHAAA,oBAAoB,OAAA;AAC7B,wDAAyD;AAAhD,0GAAA,YAAY,OAAA;AACrB,0DAAoE;AAA3D,qHAAA,sBAAsB,OAAA;AAC/B,oEAA2E;AAAlE,4HAAA,wBAAwB,OAAA;AACjC,kEAAsE;AAA7D,uHAAA,oBAAoB,OAAA","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\nexport { createValueFormatter } from \"./core-interop/Formatting.js\";\nexport { createLogger } from \"./core-interop/Logging.js\";\nexport { createECSchemaProvider } from \"./core-interop/Metadata.js\";\nexport { createECSqlQueryExecutor } from \"./core-interop/QueryExecutor.js\";\nexport { registerTxnListeners } from \"./core-interop/Transactions.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"presentation-core-interop.js","sourceRoot":"","sources":["../../src/presentation-core-interop.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,8DAAoE;AAA3D,qHAAA,oBAAoB,OAAA;AAC7B,4DAA8D;AAArD,+GAAA,eAAe,OAAA;AACxB,wDAAyD;AAAhD,0GAAA,YAAY,OAAA;AACrB,0DAAoE;AAA3D,qHAAA,sBAAsB,OAAA;AAC/B,oEAA2E;AAAlE,4HAAA,wBAAwB,OAAA;AACjC,kEAAsE;AAA7D,uHAAA,oBAAoB,OAAA","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\nexport { createValueFormatter } from \"./core-interop/Formatting.js\";\nexport { createIModelKey } from \"./core-interop/IModelKey.js\";\nexport { createLogger } from \"./core-interop/Logging.js\";\nexport { createECSchemaProvider } from \"./core-interop/Metadata.js\";\nexport { createECSqlQueryExecutor } from \"./core-interop/QueryExecutor.js\";\nexport { registerTxnListeners } from \"./core-interop/Transactions.js\";\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines input for `createIModelKey`. Generally, this is an instance of either [IModelDb](https://www.itwinjs.org/reference/core-backend/imodels/imodeldb/)
|
|
3
|
+
* or [IModelConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/imodelconnection/).
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
interface CoreIModel {
|
|
7
|
+
key: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Attempts to create a unique identifier for the given iModel. In majority of cases that's going to be the `key` property, but if it's not
|
|
12
|
+
* set (e.g. when using [BlankConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/blankconnection/)) - `name` property
|
|
13
|
+
* is used instead. Finally, if both are empty - the function will throw an error.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { IModelConnection } from "@itwin/core-frontend";
|
|
19
|
+
* import { createIModelKey } from "@itwin/presentation-core-interop";
|
|
20
|
+
*
|
|
21
|
+
* IModelConnection.onOpen.addListener((imodel: IModelConnection) => {
|
|
22
|
+
* const key = createIModelKey(imodel);
|
|
23
|
+
* console.log(`IModel opened: "${key}"`);
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare function createIModelKey(imodel: CoreIModel): string;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=IModelKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModelKey.d.ts","sourceRoot":"","sources":["../../../src/core-interop/IModelKey.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAQ1D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* Attempts to create a unique identifier for the given iModel. In majority of cases that's going to be the `key` property, but if it's not
|
|
7
|
+
* set (e.g. when using [BlankConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/blankconnection/)) - `name` property
|
|
8
|
+
* is used instead. Finally, if both are empty - the function will throw an error.
|
|
9
|
+
*
|
|
10
|
+
* Example:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { IModelConnection } from "@itwin/core-frontend";
|
|
14
|
+
* import { createIModelKey } from "@itwin/presentation-core-interop";
|
|
15
|
+
*
|
|
16
|
+
* IModelConnection.onOpen.addListener((imodel: IModelConnection) => {
|
|
17
|
+
* const key = createIModelKey(imodel);
|
|
18
|
+
* console.log(`IModel opened: "${key}"`);
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export function createIModelKey(imodel) {
|
|
25
|
+
if (imodel.key.length) {
|
|
26
|
+
return imodel.key;
|
|
27
|
+
}
|
|
28
|
+
if (imodel.name.length) {
|
|
29
|
+
return imodel.name;
|
|
30
|
+
}
|
|
31
|
+
throw new Error(`Provided iModel doesn't have a key or name.`);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=IModelKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModelKey.js","sourceRoot":"","sources":["../../../src/core-interop/IModelKey.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAYhG;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,eAAe,CAAC,MAAkB;IAChD,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC,GAAG,CAAC;IACpB,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;AACjE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Defines input for `createIModelKey`. Generally, this is an instance of either [IModelDb](https://www.itwinjs.org/reference/core-backend/imodels/imodeldb/)\n * or [IModelConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/imodelconnection/).\n * @public\n */\ninterface CoreIModel {\n key: string;\n name: string;\n}\n\n/**\n * Attempts to create a unique identifier for the given iModel. In majority of cases that's going to be the `key` property, but if it's not\n * set (e.g. when using [BlankConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/blankconnection/)) - `name` property\n * is used instead. Finally, if both are empty - the function will throw an error.\n *\n * Example:\n *\n * ```ts\n * import { IModelConnection } from \"@itwin/core-frontend\";\n * import { createIModelKey } from \"@itwin/presentation-core-interop\";\n *\n * IModelConnection.onOpen.addListener((imodel: IModelConnection) => {\n * const key = createIModelKey(imodel);\n * console.log(`IModel opened: \"${key}\"`);\n * });\n * ```\n *\n * @public\n */\nexport function createIModelKey(imodel: CoreIModel): string {\n if (imodel.key.length) {\n return imodel.key;\n }\n if (imodel.name.length) {\n return imodel.name;\n }\n throw new Error(`Provided iModel doesn't have a key or name.`);\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createValueFormatter } from "./core-interop/Formatting.js";
|
|
2
|
+
export { createIModelKey } from "./core-interop/IModelKey.js";
|
|
2
3
|
export { createLogger } from "./core-interop/Logging.js";
|
|
3
4
|
export { createECSchemaProvider } from "./core-interop/Metadata.js";
|
|
4
5
|
export { createECSqlQueryExecutor } from "./core-interop/QueryExecutor.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation-core-interop.d.ts","sourceRoot":"","sources":["../../src/presentation-core-interop.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"presentation-core-interop.d.ts","sourceRoot":"","sources":["../../src/presentation-core-interop.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
export { createValueFormatter } from "./core-interop/Formatting.js";
|
|
6
|
+
export { createIModelKey } from "./core-interop/IModelKey.js";
|
|
6
7
|
export { createLogger } from "./core-interop/Logging.js";
|
|
7
8
|
export { createECSchemaProvider } from "./core-interop/Metadata.js";
|
|
8
9
|
export { createECSqlQueryExecutor } from "./core-interop/QueryExecutor.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation-core-interop.js","sourceRoot":"","sources":["../../src/presentation-core-interop.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC","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\nexport { createValueFormatter } from \"./core-interop/Formatting.js\";\nexport { createLogger } from \"./core-interop/Logging.js\";\nexport { createECSchemaProvider } from \"./core-interop/Metadata.js\";\nexport { createECSqlQueryExecutor } from \"./core-interop/QueryExecutor.js\";\nexport { registerTxnListeners } from \"./core-interop/Transactions.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"presentation-core-interop.js","sourceRoot":"","sources":["../../src/presentation-core-interop.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC","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\nexport { createValueFormatter } from \"./core-interop/Formatting.js\";\nexport { createIModelKey } from \"./core-interop/IModelKey.js\";\nexport { createLogger } from \"./core-interop/Logging.js\";\nexport { createECSchemaProvider } from \"./core-interop/Metadata.js\";\nexport { createECSqlQueryExecutor } from \"./core-interop/QueryExecutor.js\";\nexport { registerTxnListeners } from \"./core-interop/Transactions.js\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/presentation-core-interop",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "The package acts as a layer between iTwin.js Core and Presentation packages.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"rxjs": "^7.8.1",
|
|
34
|
-
"@itwin/presentation-shared": "~1.
|
|
34
|
+
"@itwin/presentation-shared": "~1.2.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@itwin/core-bentley": "^4.1.0",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"@itwin/ecschema-metadata": "^4.1.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@itwin/build-tools": "^4.10.
|
|
45
|
-
"@itwin/core-bentley": "^4.
|
|
46
|
-
"@itwin/core-common": "^4.
|
|
47
|
-
"@itwin/core-geometry": "^4.
|
|
48
|
-
"@itwin/core-quantity": "^4.
|
|
49
|
-
"@itwin/ecschema-metadata": "^4.
|
|
44
|
+
"@itwin/build-tools": "^4.10.1",
|
|
45
|
+
"@itwin/core-bentley": "^4.10.1",
|
|
46
|
+
"@itwin/core-common": "^4.10.1",
|
|
47
|
+
"@itwin/core-geometry": "^4.10.1",
|
|
48
|
+
"@itwin/core-quantity": "^4.10.1",
|
|
49
|
+
"@itwin/ecschema-metadata": "^4.10.1",
|
|
50
50
|
"@itwin/eslint-plugin": "5.0.0-dev.1",
|
|
51
51
|
"@types/chai": "^4.3.16",
|
|
52
52
|
"@types/chai-as-promised": "^7.1.8",
|