@itwin/ecschema-rpcinterface-impl 5.1.0-dev.5 → 5.1.0-dev.51

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,58 @@
1
1
  # Change Log - @itwin/ecschema-rpcinterface-impl
2
2
 
3
- This log was last generated on Thu, 10 Apr 2025 17:50:15 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 26 Jun 2025 22:17:28 GMT and should not be manually modified.
4
+
5
+ ## 5.0.2
6
+ Thu, 26 Jun 2025 22:16:01 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 5.0.1
11
+ Tue, 17 Jun 2025 18:33:52 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 5.0.0
16
+ Fri, 13 Jun 2025 20:25:38 GMT
17
+
18
+ ### Updates
19
+
20
+ - Added ESM support
21
+
22
+ ## 4.11.6
23
+ Mon, 16 Jun 2025 15:00:15 GMT
24
+
25
+ _Version update only_
26
+
27
+ ## 4.11.5
28
+ Fri, 06 Jun 2025 13:41:18 GMT
29
+
30
+ _Version update only_
31
+
32
+ ## 4.11.4
33
+ Tue, 03 Jun 2025 16:15:19 GMT
34
+
35
+ _Version update only_
36
+
37
+ ## 4.11.3
38
+ Wed, 28 May 2025 13:56:23 GMT
39
+
40
+ _Version update only_
41
+
42
+ ## 4.11.2
43
+ Tue, 20 May 2025 20:14:46 GMT
44
+
45
+ _Version update only_
46
+
47
+ ## 4.11.1
48
+ Wed, 30 Apr 2025 13:13:21 GMT
49
+
50
+ _Version update only_
51
+
52
+ ## 4.11.0
53
+ Wed, 16 Apr 2025 15:50:28 GMT
54
+
55
+ _Version update only_
4
56
 
5
57
  ## 4.10.13
6
58
  Thu, 10 Apr 2025 17:47:21 GMT
@@ -1 +1 @@
1
- {"version":3,"file":"ECSchemaRpcImpl.js","sourceRoot":"","sources":["../../src/ECSchemaRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+F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CAAC,CAAC;QACpE,CAAC;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,aAAa,CAAC,UAA0B,EAAE,UAAkB;QACvE,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAChE,CAAC;CACF;AA1DD,0CA0DC","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\nimport * as backend from \"@itwin/core-backend\";\nimport { IModelRpcProps, QueryRowFormat, RpcInterface, RpcManager } from \"@itwin/core-common\";\nimport { SchemaKeyProps, SchemaProps } from \"@itwin/ecschema-metadata\";\nimport { ECSchemaRpcInterface } from \"@itwin/ecschema-rpcinterface-common\";\n\n/**\n * Defines the interface how the rows of the iModel query look like.\n * @internal\n */\ninterface SchemaNameRow {\n schemaName: string;\n read: string;\n write: string;\n minor: string;\n}\n\n/**\n * Implementation of the SchemaRpcInterface.\n * @internal\n */\nexport class ECSchemaRpcImpl extends RpcInterface implements ECSchemaRpcInterface {\n /**\n * Registers the RPC interface with its corresponding implementation class.\n */\n public static register() {\n RpcManager.registerImpl(ECSchemaRpcInterface, ECSchemaRpcImpl);\n }\n\n /**\n * Gets an iModelDb instance. It is important that the database has been opened before\n * otherwise it can't be found.\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\n * @returns Instance of IModelDb.\n */\n private async getIModelDatabase(tokenProps: IModelRpcProps): Promise<backend.IModelDb> {\n return new Promise<backend.IModelDb>((resolve) => {\n resolve(backend.IModelDb.findByKey(tokenProps.key));\n });\n }\n\n /**\n * Returns an array of SchemaKeyProps that exists in the current iModel context. The client can call\n * SchemaKey.fromJson() to parse the props to a SchemaKey.\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\n * @returns An array of SchemaKeyProps.\n */\n public async getSchemaKeys(tokenProps: IModelRpcProps): Promise<SchemaKeyProps[]> {\n\n const schemaKeyProps: SchemaKeyProps[] = [];\n const iModelDb = await this.getIModelDatabase(tokenProps);\n\n const schemaNameQuery = `SELECT Name as schemaName, VersionMajor as read, VersionWrite as write, VersionMinor as minor FROM main.meta.ECSchemaDef`;\n for await (const row of iModelDb.createQueryReader(schemaNameQuery, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames })) {\n const schemaDefinitionRow = row.toRow() as SchemaNameRow;\n const schemaFullName = schemaDefinitionRow.schemaName;\n const read = Number(schemaDefinitionRow.read);\n const write = Number(schemaDefinitionRow.write);\n const minor = Number(schemaDefinitionRow.minor);\n schemaKeyProps.push({ name: schemaFullName, read, write, minor });\n }\n return schemaKeyProps;\n }\n\n /**\n * Gets the schema JSON for the current iModel context and returns the schema as a SchemaProps which\n * the client can call Schema.fromJson() to return a Schema.\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\n * @param schemaName The name of the schema that shall be returned.\n * @returns The SchemaProps.\n */\n public async getSchemaJSON(tokenProps: IModelRpcProps, schemaName: string): Promise<SchemaProps> {\n if (schemaName === undefined || schemaName.length < 1) {\n throw new Error(`Schema name must not be undefined or empty.`);\n }\n\n const iModelDb = await this.getIModelDatabase(tokenProps);\n return iModelDb[backend._nativeDb].getSchemaProps(schemaName);\n }\n}\n"]}
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;AAa3E;;;GAGG;AACH,MAAa,e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AK,CAAC,aAAa,CAAC,UAA0B,EAAE,UAAkB;QACvE,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAChE,CAAC;CACF;AA1DD,0CA0DC","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 * @internal\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 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.createQueryReader(schemaNameQuery, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames })) {\r\n const schemaDefinitionRow = row.toRow() 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[backend._nativeDb].getSchemaProps(schemaName);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ecschema-rpc-impl.js","sourceRoot":"","sources":["../../src/ecschema-rpc-impl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,oDAAkC","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*--------------------------------------------------------------------------------------------*/\nexport * from \"./ECSchemaRpcImpl\";\n"]}
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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ECSchemaRpcImpl.js","sourceRoot":"","sources":["../../src/ECSchemaRpcImpl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAkB,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAa3E;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAC/C;;OAEG;IACI,MAAM,CAAC,QAAQ;QACpB,UAAU,CAAC,YAAY,CAAC,oBAAoB,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,CAA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E,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\nimport * as backend from \"@itwin/core-backend\";\nimport { IModelRpcProps, QueryRowFormat, RpcInterface, RpcManager } from \"@itwin/core-common\";\nimport { SchemaKeyProps, SchemaProps } from \"@itwin/ecschema-metadata\";\nimport { ECSchemaRpcInterface } from \"@itwin/ecschema-rpcinterface-common\";\n\n/**\n * Defines the interface how the rows of the iModel query look like.\n * @internal\n */\ninterface SchemaNameRow {\n schemaName: string;\n read: string;\n write: string;\n minor: string;\n}\n\n/**\n * Implementation of the SchemaRpcInterface.\n * @internal\n */\nexport class ECSchemaRpcImpl extends RpcInterface implements ECSchemaRpcInterface {\n /**\n * Registers the RPC interface with its corresponding implementation class.\n */\n public static register() {\n RpcManager.registerImpl(ECSchemaRpcInterface, ECSchemaRpcImpl);\n }\n\n /**\n * Gets an iModelDb instance. It is important that the database has been opened before\n * otherwise it can't be found.\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\n * @returns Instance of IModelDb.\n */\n private async getIModelDatabase(tokenProps: IModelRpcProps): Promise<backend.IModelDb> {\n return new Promise<backend.IModelDb>((resolve) => {\n resolve(backend.IModelDb.findByKey(tokenProps.key));\n });\n }\n\n /**\n * Returns an array of SchemaKeyProps that exists in the current iModel context. The client can call\n * SchemaKey.fromJson() to parse the props to a SchemaKey.\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\n * @returns An array of SchemaKeyProps.\n */\n public async getSchemaKeys(tokenProps: IModelRpcProps): Promise<SchemaKeyProps[]> {\n\n const schemaKeyProps: SchemaKeyProps[] = [];\n const iModelDb = await this.getIModelDatabase(tokenProps);\n\n const schemaNameQuery = `SELECT Name as schemaName, VersionMajor as read, VersionWrite as write, VersionMinor as minor FROM main.meta.ECSchemaDef`;\n for await (const row of iModelDb.createQueryReader(schemaNameQuery, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames })) {\n const schemaDefinitionRow = row.toRow() as SchemaNameRow;\n const schemaFullName = schemaDefinitionRow.schemaName;\n const read = Number(schemaDefinitionRow.read);\n const write = Number(schemaDefinitionRow.write);\n const minor = Number(schemaDefinitionRow.minor);\n schemaKeyProps.push({ name: schemaFullName, read, write, minor });\n }\n return schemaKeyProps;\n }\n\n /**\n * Gets the schema JSON for the current iModel context and returns the schema as a SchemaProps which\n * the client can call Schema.fromJson() to return a Schema.\n * @param tokenProps The iModelToken props that hold the information which iModel is used.\n * @param schemaName The name of the schema that shall be returned.\n * @returns The SchemaProps.\n */\n public async getSchemaJSON(tokenProps: IModelRpcProps, schemaName: string): Promise<SchemaProps> {\n if (schemaName === undefined || schemaName.length < 1) {\n throw new Error(`Schema name must not be undefined or empty.`);\n }\n\n const iModelDb = await this.getIModelDatabase(tokenProps);\n return iModelDb[backend._nativeDb].getSchemaProps(schemaName);\n }\n}\n"]}
1
+ {"version":3,"file":"ECSchemaRpcImpl.js","sourceRoot":"","sources":["../../src/ECSchemaRpcImpl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAkB,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAa3E;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAC/C;;OAEG;IACI,MAAM,CAAC,QAAQ;QACpB,UAAU,CAAC,YAAY,CAAC,oBAAoB,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,GA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Ac,CAAC,UAAU,CAAC,CAAC;IAChE,CAAC;CACF","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 * @internal\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 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.createQueryReader(schemaNameQuery, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames })) {\r\n const schemaDefinitionRow = row.toRow() 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[backend._nativeDb].getSchemaProps(schemaName);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ecschema-rpc-impl.js","sourceRoot":"","sources":["../../src/ecschema-rpc-impl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,cAAc,mBAAmB,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*--------------------------------------------------------------------------------------------*/\nexport * from \"./ECSchemaRpcImpl\";\n"]}
1
+ {"version":3,"file":"ecschema-rpc-impl.js","sourceRoot":"","sources":["../../src/ecschema-rpc-impl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,cAAc,mBAAmB,CAAC","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,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/ecschema-rpcinterface-impl",
3
- "version": "5.1.0-dev.5",
3
+ "version": "5.1.0-dev.51",
4
4
  "description": "Schema RPC Interface backend implementation",
5
5
  "main": "lib/cjs/ecschema-rpc-impl.js",
6
6
  "module": "lib/esm/ecschema-rpc-impl.js",
@@ -22,25 +22,25 @@
22
22
  "url": "http://www.bentley.com"
23
23
  },
24
24
  "peerDependencies": {
25
- "@itwin/core-backend": "5.1.0-dev.5",
26
- "@itwin/core-bentley": "5.1.0-dev.5",
27
- "@itwin/core-common": "5.1.0-dev.5",
28
- "@itwin/core-geometry": "5.1.0-dev.5",
29
- "@itwin/ecschema-metadata": "5.1.0-dev.5",
30
- "@itwin/ecschema-rpcinterface-common": "5.1.0-dev.5"
25
+ "@itwin/core-bentley": "5.1.0-dev.51",
26
+ "@itwin/core-common": "5.1.0-dev.51",
27
+ "@itwin/ecschema-metadata": "5.1.0-dev.51",
28
+ "@itwin/core-backend": "5.1.0-dev.51",
29
+ "@itwin/core-geometry": "5.1.0-dev.51",
30
+ "@itwin/ecschema-rpcinterface-common": "5.1.0-dev.51"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@itwin/eslint-plugin": "5.0.0-dev.1",
34
34
  "eslint": "^9.13.0",
35
35
  "rimraf": "^6.0.1",
36
36
  "typescript": "~5.6.2",
37
- "@itwin/build-tools": "5.1.0-dev.5",
38
- "@itwin/core-common": "5.1.0-dev.5",
39
- "@itwin/ecschema-metadata": "5.1.0-dev.5",
40
- "@itwin/core-bentley": "5.1.0-dev.5",
41
- "@itwin/core-backend": "5.1.0-dev.5",
42
- "@itwin/core-geometry": "5.1.0-dev.5",
43
- "@itwin/ecschema-rpcinterface-common": "5.1.0-dev.5"
37
+ "@itwin/build-tools": "5.1.0-dev.51",
38
+ "@itwin/core-bentley": "5.1.0-dev.51",
39
+ "@itwin/core-geometry": "5.1.0-dev.51",
40
+ "@itwin/core-backend": "5.1.0-dev.51",
41
+ "@itwin/core-common": "5.1.0-dev.51",
42
+ "@itwin/ecschema-metadata": "5.1.0-dev.51",
43
+ "@itwin/ecschema-rpcinterface-common": "5.1.0-dev.51"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "npm run -s build:cjs && npm run -s build:esm",