@itwin/ecschema-rpcinterface-impl 3.1.0-dev.7 → 3.1.1
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
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
# Change Log - @itwin/ecschema-rpcinterface-impl
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 31 Mar 2022 15:55:48 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 3.1.1
|
|
6
|
+
Thu, 31 Mar 2022 15:55:48 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 3.1.0
|
|
11
|
+
Tue, 29 Mar 2022 20:53:47 GMT
|
|
12
|
+
|
|
13
|
+
### Updates
|
|
14
|
+
|
|
15
|
+
- Minor fixes to ECSchemaRpcInterface
|
|
16
|
+
|
|
17
|
+
## 3.0.3
|
|
18
|
+
Fri, 25 Mar 2022 15:10:02 GMT
|
|
19
|
+
|
|
20
|
+
_Version update only_
|
|
21
|
+
|
|
22
|
+
## 3.0.2
|
|
23
|
+
Thu, 10 Mar 2022 21:18:13 GMT
|
|
24
|
+
|
|
25
|
+
_Version update only_
|
|
26
|
+
|
|
27
|
+
## 3.0.1
|
|
28
|
+
Thu, 24 Feb 2022 15:26:55 GMT
|
|
29
|
+
|
|
30
|
+
_Version update only_
|
|
31
|
+
|
|
32
|
+
## 3.0.0
|
|
33
|
+
Mon, 24 Jan 2022 14:00:52 GMT
|
|
34
|
+
|
|
35
|
+
### Updates
|
|
36
|
+
|
|
37
|
+
- fix code for breaking change to .query() method
|
|
38
|
+
- Upgrade target to ES2019
|
|
39
|
+
- fix ecsql row format
|
|
40
|
+
- use new @itwin package names
|
|
41
|
+
- rename to @itwin/ecschema-rpcinterface-impl
|
|
42
|
+
- remove ClientRequestContext.current
|
|
43
|
+
- Lock down and update version numbers so docs will build.
|
|
4
44
|
|
|
5
45
|
## 2.19.28
|
|
6
46
|
Wed, 12 Jan 2022 14:52:38 GMT
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IModelRpcProps } from "@itwin/core-common";
|
|
1
|
+
import { IModelRpcProps, RpcInterface } from "@itwin/core-common";
|
|
2
2
|
import { SchemaKeyProps, SchemaProps } from "@itwin/ecschema-metadata";
|
|
3
3
|
import { ECSchemaRpcInterface } from "@itwin/ecschema-rpcinterface-common";
|
|
4
4
|
/**
|
|
5
5
|
* Implementation of the SchemaRpcInterface.
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
|
-
export declare class ECSchemaRpcImpl extends ECSchemaRpcInterface {
|
|
8
|
+
export declare class ECSchemaRpcImpl extends RpcInterface implements ECSchemaRpcInterface {
|
|
9
9
|
/**
|
|
10
10
|
* Registers the RPC interface with its corresponding implementation class.
|
|
11
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECSchemaRpcImpl.d.ts","sourceRoot":"","sources":["../../src/ECSchemaRpcImpl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"ECSchemaRpcImpl.d.ts","sourceRoot":"","sources":["../../src/ECSchemaRpcImpl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAkB,YAAY,EAAc,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAKvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAY3E;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,YAAa,YAAW,oBAAoB;IAC/E;;OAEG;WACW,QAAQ;IAItB;;;;;OAKG;YACW,iBAAiB;IAM/B;;;;;OAKG;IACU,aAAa,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAmBjF;;;;;;OAMG;IACU,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAkBjG"}
|
|
@@ -12,7 +12,7 @@ const ecschema_rpcinterface_common_1 = require("@itwin/ecschema-rpcinterface-com
|
|
|
12
12
|
* Implementation of the SchemaRpcInterface.
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
|
-
class ECSchemaRpcImpl extends
|
|
15
|
+
class ECSchemaRpcImpl extends core_common_1.RpcInterface {
|
|
16
16
|
/**
|
|
17
17
|
* Registers the RPC interface with its corresponding implementation class.
|
|
18
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECSchemaRpcImpl.js","sourceRoot":"","sources":["../../src/ECSchemaRpcImpl.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"ECSchemaRpcImpl.js","sourceRoot":"","sources":["../../src/ECSchemaRpcImpl.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,oDAA8F;AAE9F;;;+FAG+F;AAC/F,sFAA2E;AAY3E;;;GAGG;AACH,MAAa,eAAgB,SAAQ,0BAAY;IAC/C;;OAEG;IACI,MAAM,CAAC,QAAQ;QACpB,wBAAU,CAAC,YAAY,CAAC,mDAAoB,EAAE,eAAe,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,iBAAiB,CAAC,UAA0B;QACxD,OAAO,IAAI,OAAO,CAAmB,CAAC,OAAO,EAAE,EAAE;YAC/C,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,aAAa,CAAC,UAA0B;QAEnD,MAAM,cAAc,GAAqB,EAAE,CAAC;QAC5C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC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BAAwB,CAAC,CAAC;SAC3C;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;CACF;AAtED,0CAsEC","sourcesContent":["import * as backend from \"@itwin/core-backend\";\r\nimport { IModelRpcProps, QueryRowFormat, RpcInterface, RpcManager } from \"@itwin/core-common\";\r\nimport { SchemaKeyProps, SchemaProps } from \"@itwin/ecschema-metadata\";\r\n/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { ECSchemaRpcInterface } from \"@itwin/ecschema-rpcinterface-common\";\r\n\r\n/**\r\n * Defines the interface how the rows of the iModel query look like.\r\n */\r\ninterface SchemaNameRow {\r\n schemaName: string;\r\n read: string;\r\n write: string;\r\n minor: string;\r\n}\r\n\r\n/**\r\n * Implementation of the SchemaRpcInterface.\r\n * @internal\r\n */\r\nexport class ECSchemaRpcImpl extends RpcInterface implements ECSchemaRpcInterface {\r\n /**\r\n * Registers the RPC interface with its corresponding implementation class.\r\n */\r\n public static register() {\r\n RpcManager.registerImpl(ECSchemaRpcInterface, ECSchemaRpcImpl);\r\n }\r\n\r\n /**\r\n * Gets an iModelDb instance. It is important that the database has been opened before\r\n * otherwise it can't be found.\r\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\r\n * @returns Instance of IModelDb.\r\n */\r\n private async getIModelDatabase(tokenProps: IModelRpcProps): Promise<backend.IModelDb> {\r\n return new Promise<backend.IModelDb>((resolve) => {\r\n resolve(backend.IModelDb.findByKey(tokenProps.key));\r\n });\r\n }\r\n\r\n /**\r\n * Returns an array of SchemaKeyProps that exists in the current iModel context. The client can call\r\n * SchemaKey.fromJson() to parse the props to a SchemaKey.\r\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\r\n * @returns An array of SchemaKeyProps.\r\n */\r\n public async getSchemaKeys(tokenProps: IModelRpcProps): Promise<SchemaKeyProps[]> {\r\n\r\n const schemaKeyProps: SchemaKeyProps[] = [];\r\n const iModelDb = await this.getIModelDatabase(tokenProps);\r\n\r\n // Iterate over the rows returned from AsyncIterableIterator. The custom Query overload returns\r\n // a typed row instance instead of any.\r\n const schemaNameQuery = `SELECT Name as schemaName, VersionMajor as read, VersionWrite as write, VersionMinor as minor FROM main.meta.ECSchemaDef`;\r\n for await (const row of iModelDb.query(schemaNameQuery, undefined, {rowFormat: QueryRowFormat.UseJsPropertyNames})) {\r\n const schemaDefinitionRow = row as SchemaNameRow;\r\n const schemaFullName = schemaDefinitionRow.schemaName;\r\n const read = Number(schemaDefinitionRow.read);\r\n const write = Number(schemaDefinitionRow.write);\r\n const minor = Number(schemaDefinitionRow.minor);\r\n schemaKeyProps.push({ name: schemaFullName, read, write, minor });\r\n }\r\n return schemaKeyProps;\r\n }\r\n\r\n /**\r\n * Gets the schema JSON for the current iModel context and returns the schema as a SchemaProps which\r\n * the client can call Schema.fromJson() to return a Schema.\r\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\r\n * @param schemaName The name of the schema that shall be returned.\r\n * @returns The SchemaProps.\r\n */\r\n public async getSchemaJSON(tokenProps: IModelRpcProps, schemaName: string): Promise<SchemaProps> {\r\n if (schemaName === undefined || schemaName.length < 1) {\r\n throw new Error(`Schema name must not be undefined or empty.`);\r\n }\r\n\r\n const iModelDb = await this.getIModelDatabase(tokenProps);\r\n const schemaResult = iModelDb.nativeDb.getSchema(schemaName);\r\n\r\n if (schemaResult.error !== undefined) {\r\n throw new Error(schemaResult.error.message);\r\n }\r\n\r\n if (schemaResult.result === undefined) {\r\n throw new Error(\"Schema does not exists\");\r\n }\r\n\r\n return JSON.parse(schemaResult.result);\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/ecschema-rpcinterface-impl",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Schema RPC Interface backend implementation",
|
|
5
5
|
"main": "lib/cjs/ecschema-rpc-impl.js",
|
|
6
6
|
"typings": "lib/cjs/ecschema-rpc-impl",
|
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
"url": "http://www.bentley.com"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@itwin/core-backend": "3.1.
|
|
24
|
-
"@itwin/core-bentley": "3.1.
|
|
25
|
-
"@itwin/core-common": "3.1.
|
|
26
|
-
"@itwin/core-geometry": "3.1.
|
|
27
|
-
"@itwin/ecschema-metadata": "3.1.
|
|
28
|
-
"@itwin/ecschema-rpcinterface-common": "3.1.
|
|
23
|
+
"@itwin/core-backend": "3.1.1",
|
|
24
|
+
"@itwin/core-bentley": "3.1.1",
|
|
25
|
+
"@itwin/core-common": "3.1.1",
|
|
26
|
+
"@itwin/core-geometry": "3.1.1",
|
|
27
|
+
"@itwin/ecschema-metadata": "3.1.1",
|
|
28
|
+
"@itwin/ecschema-rpcinterface-common": "3.1.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@itwin/build-tools": "3.1.
|
|
32
|
-
"@itwin/core-backend": "3.1.
|
|
33
|
-
"@itwin/core-bentley": "3.1.
|
|
34
|
-
"@itwin/core-common": "3.1.
|
|
35
|
-
"@itwin/core-geometry": "3.1.
|
|
36
|
-
"@itwin/ecschema-metadata": "3.1.
|
|
37
|
-
"@itwin/ecschema-rpcinterface-common": "3.1.
|
|
38
|
-
"@itwin/eslint-plugin": "3.1.
|
|
31
|
+
"@itwin/build-tools": "3.1.1",
|
|
32
|
+
"@itwin/core-backend": "3.1.1",
|
|
33
|
+
"@itwin/core-bentley": "3.1.1",
|
|
34
|
+
"@itwin/core-common": "3.1.1",
|
|
35
|
+
"@itwin/core-geometry": "3.1.1",
|
|
36
|
+
"@itwin/ecschema-metadata": "3.1.1",
|
|
37
|
+
"@itwin/ecschema-rpcinterface-common": "3.1.1",
|
|
38
|
+
"@itwin/eslint-plugin": "3.1.1",
|
|
39
39
|
"eslint": "^7.11.0",
|
|
40
40
|
"rimraf": "^3.0.2",
|
|
41
41
|
"typescript": "~4.4.0"
|