@itwin/ecschema-rpcinterface-impl 4.0.0-dev.7 → 4.0.0-dev.70
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 +13 -1
- package/lib/cjs/ECSchemaRpcImpl.d.ts +35 -35
- package/lib/cjs/ECSchemaRpcImpl.d.ts.map +1 -1
- package/lib/cjs/ECSchemaRpcImpl.js +71 -70
- package/lib/cjs/ECSchemaRpcImpl.js.map +1 -1
- package/lib/cjs/ecschema-rpc-impl.d.ts +1 -1
- package/lib/cjs/ecschema-rpc-impl.js +21 -17
- package/lib/cjs/ecschema-rpc-impl.js.map +1 -1
- package/package.json +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Change Log - @itwin/ecschema-rpcinterface-impl
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 08 Feb 2023 14:58:40 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 3.6.0
|
|
6
|
+
Wed, 08 Feb 2023 14:58:40 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- React to RPC deprecations.
|
|
11
|
+
|
|
12
|
+
## 3.5.6
|
|
13
|
+
Fri, 24 Feb 2023 16:02:47 GMT
|
|
14
|
+
|
|
15
|
+
_Version update only_
|
|
4
16
|
|
|
5
17
|
## 3.5.5
|
|
6
18
|
Thu, 26 Jan 2023 22:53:27 GMT
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { IModelRpcProps, RpcInterface } from "@itwin/core-common";
|
|
2
|
-
import { SchemaKeyProps, SchemaProps } from "@itwin/ecschema-metadata";
|
|
3
|
-
import { ECSchemaRpcInterface } from "@itwin/ecschema-rpcinterface-common";
|
|
4
|
-
/**
|
|
5
|
-
* Implementation of the SchemaRpcInterface.
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export declare class ECSchemaRpcImpl extends RpcInterface implements ECSchemaRpcInterface {
|
|
9
|
-
/**
|
|
10
|
-
* Registers the RPC interface with its corresponding implementation class.
|
|
11
|
-
*/
|
|
12
|
-
static register(): void;
|
|
13
|
-
/**
|
|
14
|
-
* Gets an iModelDb instance. It is important that the database has been opened before
|
|
15
|
-
* otherwise it can't be found.
|
|
16
|
-
* @param tokenProps The iModelToken props that hold the information which iModel is used.
|
|
17
|
-
* @returns Instance of IModelDb.
|
|
18
|
-
*/
|
|
19
|
-
private getIModelDatabase;
|
|
20
|
-
/**
|
|
21
|
-
* Returns an array of SchemaKeyProps that exists in the current iModel context. The client can call
|
|
22
|
-
* SchemaKey.fromJson() to parse the props to a SchemaKey.
|
|
23
|
-
* @param tokenProps The iModelToken props that hold the information which iModel is used.
|
|
24
|
-
* @returns An array of SchemaKeyProps.
|
|
25
|
-
*/
|
|
26
|
-
getSchemaKeys(tokenProps: IModelRpcProps): Promise<SchemaKeyProps[]>;
|
|
27
|
-
/**
|
|
28
|
-
* Gets the schema JSON for the current iModel context and returns the schema as a SchemaProps which
|
|
29
|
-
* the client can call Schema.fromJson() to return a Schema.
|
|
30
|
-
* @param tokenProps The iModelToken props that hold the information which iModel is used.
|
|
31
|
-
* @param schemaName The name of the schema that shall be returned.
|
|
32
|
-
* @returns The SchemaProps.
|
|
33
|
-
*/
|
|
34
|
-
getSchemaJSON(tokenProps: IModelRpcProps, schemaName: string): Promise<SchemaProps>;
|
|
35
|
-
}
|
|
1
|
+
import { IModelRpcProps, RpcInterface } from "@itwin/core-common";
|
|
2
|
+
import { SchemaKeyProps, SchemaProps } from "@itwin/ecschema-metadata";
|
|
3
|
+
import { ECSchemaRpcInterface } from "@itwin/ecschema-rpcinterface-common";
|
|
4
|
+
/**
|
|
5
|
+
* Implementation of the SchemaRpcInterface.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare class ECSchemaRpcImpl extends RpcInterface implements ECSchemaRpcInterface {
|
|
9
|
+
/**
|
|
10
|
+
* Registers the RPC interface with its corresponding implementation class.
|
|
11
|
+
*/
|
|
12
|
+
static register(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Gets an iModelDb instance. It is important that the database has been opened before
|
|
15
|
+
* otherwise it can't be found.
|
|
16
|
+
* @param tokenProps The iModelToken props that hold the information which iModel is used.
|
|
17
|
+
* @returns Instance of IModelDb.
|
|
18
|
+
*/
|
|
19
|
+
private getIModelDatabase;
|
|
20
|
+
/**
|
|
21
|
+
* Returns an array of SchemaKeyProps that exists in the current iModel context. The client can call
|
|
22
|
+
* SchemaKey.fromJson() to parse the props to a SchemaKey.
|
|
23
|
+
* @param tokenProps The iModelToken props that hold the information which iModel is used.
|
|
24
|
+
* @returns An array of SchemaKeyProps.
|
|
25
|
+
*/
|
|
26
|
+
getSchemaKeys(tokenProps: IModelRpcProps): Promise<SchemaKeyProps[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Gets the schema JSON for the current iModel context and returns the schema as a SchemaProps which
|
|
29
|
+
* the client can call Schema.fromJson() to return a Schema.
|
|
30
|
+
* @param tokenProps The iModelToken props that hold the information which iModel is used.
|
|
31
|
+
* @param schemaName The name of the schema that shall be returned.
|
|
32
|
+
* @returns The SchemaProps.
|
|
33
|
+
*/
|
|
34
|
+
getSchemaJSON(tokenProps: IModelRpcProps, schemaName: string): Promise<SchemaProps>;
|
|
35
|
+
}
|
|
36
36
|
//# sourceMappingURL=ECSchemaRpcImpl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECSchemaRpcImpl.d.ts","sourceRoot":"","sources":["../../src/ECSchemaRpcImpl.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAkB,YAAY,EAAc,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvE,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;
|
|
1
|
+
{"version":3,"file":"ECSchemaRpcImpl.d.ts","sourceRoot":"","sources":["../../src/ECSchemaRpcImpl.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAkB,YAAY,EAAc,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvE,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;IAoBjF;;;;;;OAMG;IACU,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAQjG"}
|
|
@@ -1,71 +1,72 @@
|
|
|
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.ECSchemaRpcImpl = void 0;
|
|
8
|
-
const backend = require("@itwin/core-backend");
|
|
9
|
-
const core_common_1 = require("@itwin/core-common");
|
|
10
|
-
const ecschema_rpcinterface_common_1 = require("@itwin/ecschema-rpcinterface-common");
|
|
11
|
-
/**
|
|
12
|
-
* Implementation of the SchemaRpcInterface.
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
class ECSchemaRpcImpl extends core_common_1.RpcInterface {
|
|
16
|
-
/**
|
|
17
|
-
* Registers the RPC interface with its corresponding implementation class.
|
|
18
|
-
*/
|
|
19
|
-
static register() {
|
|
20
|
-
core_common_1.RpcManager.registerImpl(ecschema_rpcinterface_common_1.ECSchemaRpcInterface, ECSchemaRpcImpl);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Gets an iModelDb instance. It is important that the database has been opened before
|
|
24
|
-
* otherwise it can't be found.
|
|
25
|
-
* @param tokenProps The iModelToken props that hold the information which iModel is used.
|
|
26
|
-
* @returns Instance of IModelDb.
|
|
27
|
-
*/
|
|
28
|
-
async getIModelDatabase(tokenProps) {
|
|
29
|
-
return new Promise((resolve) => {
|
|
30
|
-
resolve(backend.IModelDb.findByKey(tokenProps.key));
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Returns an array of SchemaKeyProps that exists in the current iModel context. The client can call
|
|
35
|
-
* SchemaKey.fromJson() to parse the props to a SchemaKey.
|
|
36
|
-
* @param tokenProps The iModelToken props that hold the information which iModel is used.
|
|
37
|
-
* @returns An array of SchemaKeyProps.
|
|
38
|
-
*/
|
|
39
|
-
async getSchemaKeys(tokenProps) {
|
|
40
|
-
const schemaKeyProps = [];
|
|
41
|
-
const iModelDb = await this.getIModelDatabase(tokenProps);
|
|
42
|
-
// Iterate over the rows returned from AsyncIterableIterator. The custom Query overload returns
|
|
43
|
-
// a typed row instance instead of any.
|
|
44
|
-
const schemaNameQuery = `SELECT Name as schemaName, VersionMajor as read, VersionWrite as write, VersionMinor as minor FROM main.meta.ECSchemaDef`;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
* the
|
|
58
|
-
*
|
|
59
|
-
* @param
|
|
60
|
-
* @
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
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.ECSchemaRpcImpl = void 0;
|
|
8
|
+
const backend = require("@itwin/core-backend");
|
|
9
|
+
const core_common_1 = require("@itwin/core-common");
|
|
10
|
+
const ecschema_rpcinterface_common_1 = require("@itwin/ecschema-rpcinterface-common");
|
|
11
|
+
/**
|
|
12
|
+
* Implementation of the SchemaRpcInterface.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
class ECSchemaRpcImpl extends core_common_1.RpcInterface {
|
|
16
|
+
/**
|
|
17
|
+
* Registers the RPC interface with its corresponding implementation class.
|
|
18
|
+
*/
|
|
19
|
+
static register() {
|
|
20
|
+
core_common_1.RpcManager.registerImpl(ecschema_rpcinterface_common_1.ECSchemaRpcInterface, ECSchemaRpcImpl);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Gets an iModelDb instance. It is important that the database has been opened before
|
|
24
|
+
* otherwise it can't be found.
|
|
25
|
+
* @param tokenProps The iModelToken props that hold the information which iModel is used.
|
|
26
|
+
* @returns Instance of IModelDb.
|
|
27
|
+
*/
|
|
28
|
+
async getIModelDatabase(tokenProps) {
|
|
29
|
+
return new Promise((resolve) => {
|
|
30
|
+
resolve(backend.IModelDb.findByKey(tokenProps.key));
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns an array of SchemaKeyProps that exists in the current iModel context. The client can call
|
|
35
|
+
* SchemaKey.fromJson() to parse the props to a SchemaKey.
|
|
36
|
+
* @param tokenProps The iModelToken props that hold the information which iModel is used.
|
|
37
|
+
* @returns An array of SchemaKeyProps.
|
|
38
|
+
*/
|
|
39
|
+
async getSchemaKeys(tokenProps) {
|
|
40
|
+
const schemaKeyProps = [];
|
|
41
|
+
const iModelDb = await this.getIModelDatabase(tokenProps);
|
|
42
|
+
// Iterate over the rows returned from AsyncIterableIterator. The custom Query overload returns
|
|
43
|
+
// a typed row instance instead of any.
|
|
44
|
+
const schemaNameQuery = `SELECT Name as schemaName, VersionMajor as read, VersionWrite as write, VersionMinor as minor FROM main.meta.ECSchemaDef`;
|
|
45
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
46
|
+
for await (const row of iModelDb.query(schemaNameQuery, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames })) {
|
|
47
|
+
const schemaDefinitionRow = row;
|
|
48
|
+
const schemaFullName = schemaDefinitionRow.schemaName;
|
|
49
|
+
const read = Number(schemaDefinitionRow.read);
|
|
50
|
+
const write = Number(schemaDefinitionRow.write);
|
|
51
|
+
const minor = Number(schemaDefinitionRow.minor);
|
|
52
|
+
schemaKeyProps.push({ name: schemaFullName, read, write, minor });
|
|
53
|
+
}
|
|
54
|
+
return schemaKeyProps;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Gets the schema JSON for the current iModel context and returns the schema as a SchemaProps which
|
|
58
|
+
* the client can call Schema.fromJson() to return a Schema.
|
|
59
|
+
* @param tokenProps The iModelToken props that hold the information which iModel is used.
|
|
60
|
+
* @param schemaName The name of the schema that shall be returned.
|
|
61
|
+
* @returns The SchemaProps.
|
|
62
|
+
*/
|
|
63
|
+
async getSchemaJSON(tokenProps, schemaName) {
|
|
64
|
+
if (schemaName === undefined || schemaName.length < 1) {
|
|
65
|
+
throw new Error(`Schema name must not be undefined or empty.`);
|
|
66
|
+
}
|
|
67
|
+
const iModelDb = await this.getIModelDatabase(tokenProps);
|
|
68
|
+
return iModelDb.nativeDb.getSchemaProps(schemaName);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.ECSchemaRpcImpl = ECSchemaRpcImpl;
|
|
71
72
|
//# sourceMappingURL=ECSchemaRpcImpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECSchemaRpcImpl.js","sourceRoot":"","sources":["../../src/ECSchemaRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+CAA+C;AAC/C,oDAA8F;AAE9F,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,CAAC;QAE1D,+FAA+F;QAC/F,uCAAuC;QACvC,MAAM,eAAe,GAAG,0HAA0H,CAAC;QACnJ,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,eAAe,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,4BAAc,CAAC,kBAAkB,EAAE,CAAC,EAAE;YACpH,MAAM,mBAAmB,GAAG,GAA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O,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IACtD,CAAC;CACF;AA7DD,0CA6DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport * 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\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 { // eslint-disable-line deprecation/deprecation\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 // eslint-disable-next-line deprecation/deprecation\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 return iModelDb.nativeDb.getSchemaProps(schemaName);\r\n }\r\n}\r\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./ECSchemaRpcImpl";
|
|
1
|
+
export * from "./ECSchemaRpcImpl";
|
|
2
2
|
//# sourceMappingURL=ecschema-rpc-impl.d.ts.map
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/*---------------------------------------------------------------------------------------------
|
|
18
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
19
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
20
|
+
*--------------------------------------------------------------------------------------------*/
|
|
21
|
+
__exportStar(require("./ECSchemaRpcImpl"), exports);
|
|
18
22
|
//# sourceMappingURL=ecschema-rpc-impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecschema-rpc-impl.js","sourceRoot":"","sources":["../../src/ecschema-rpc-impl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ecschema-rpc-impl.js","sourceRoot":"","sources":["../../src/ecschema-rpc-impl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,oDAAkC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nexport * from \"./ECSchemaRpcImpl\";\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/ecschema-rpcinterface-impl",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
3
|
+
"version": "4.0.0-dev.70",
|
|
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",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/iTwin/itwinjs-core
|
|
10
|
+
"url": "https://github.com/iTwin/itwinjs-core.git",
|
|
11
|
+
"directory": "core/ecschema-rpc/impl"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [
|
|
13
14
|
"iModel",
|
|
@@ -20,25 +21,25 @@
|
|
|
20
21
|
"url": "http://www.bentley.com"
|
|
21
22
|
},
|
|
22
23
|
"peerDependencies": {
|
|
23
|
-
"@itwin/core-backend": "4.0.0-dev.
|
|
24
|
-
"@itwin/core-bentley": "4.0.0-dev.
|
|
25
|
-
"@itwin/core-common": "4.0.0-dev.
|
|
26
|
-
"@itwin/core-geometry": "4.0.0-dev.
|
|
27
|
-
"@itwin/ecschema-metadata": "4.0.0-dev.
|
|
28
|
-
"@itwin/ecschema-rpcinterface-common": "4.0.0-dev.
|
|
24
|
+
"@itwin/core-backend": "4.0.0-dev.70",
|
|
25
|
+
"@itwin/core-bentley": "4.0.0-dev.70",
|
|
26
|
+
"@itwin/core-common": "4.0.0-dev.70",
|
|
27
|
+
"@itwin/core-geometry": "4.0.0-dev.70",
|
|
28
|
+
"@itwin/ecschema-metadata": "4.0.0-dev.70",
|
|
29
|
+
"@itwin/ecschema-rpcinterface-common": "4.0.0-dev.70"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@itwin/build-tools": "4.0.0-dev.
|
|
32
|
-
"@itwin/core-backend": "4.0.0-dev.
|
|
33
|
-
"@itwin/core-bentley": "4.0.0-dev.
|
|
34
|
-
"@itwin/core-common": "4.0.0-dev.
|
|
35
|
-
"@itwin/core-geometry": "4.0.0-dev.
|
|
36
|
-
"@itwin/ecschema-metadata": "4.0.0-dev.
|
|
37
|
-
"@itwin/ecschema-rpcinterface-common": "4.0.0-dev.
|
|
38
|
-
"@itwin/eslint-plugin": "4.0.0-dev.
|
|
32
|
+
"@itwin/build-tools": "4.0.0-dev.70",
|
|
33
|
+
"@itwin/core-backend": "4.0.0-dev.70",
|
|
34
|
+
"@itwin/core-bentley": "4.0.0-dev.70",
|
|
35
|
+
"@itwin/core-common": "4.0.0-dev.70",
|
|
36
|
+
"@itwin/core-geometry": "4.0.0-dev.70",
|
|
37
|
+
"@itwin/ecschema-metadata": "4.0.0-dev.70",
|
|
38
|
+
"@itwin/ecschema-rpcinterface-common": "4.0.0-dev.70",
|
|
39
|
+
"@itwin/eslint-plugin": "^4.0.0-dev.32",
|
|
39
40
|
"eslint": "^7.11.0",
|
|
40
41
|
"rimraf": "^3.0.2",
|
|
41
|
-
"typescript": "~
|
|
42
|
+
"typescript": "~5.0.2"
|
|
42
43
|
},
|
|
43
44
|
"eslintConfig": {
|
|
44
45
|
"plugins": [
|
|
@@ -48,7 +49,6 @@
|
|
|
48
49
|
},
|
|
49
50
|
"scripts": {
|
|
50
51
|
"build": "npm run -s build:cjs",
|
|
51
|
-
"build:ci": "npm run -s build",
|
|
52
52
|
"build:cjs": "tsc 1>&2 --outDir lib/cjs",
|
|
53
53
|
"clean": "rimraf lib .rush/temp/package-deps*.json",
|
|
54
54
|
"cover": "",
|